Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #139

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 15 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,49 +42,38 @@
"<rootDir>/packages/**/*.(js|jsx|ts|tsx)",
"!<rootDir>/packages/*/(.dist|dist|es|lib)/**/*",
"!**/*.(spec|test).*",
"!**/babel.config.js",
"!**/rollup.config.js",
"!**/rollup-config.ts"
]
},
"dependencies": {
"@babel/core": "^7.23.3",
"@babel/eslint-parser": "^7.23.3",
"@babel/plugin-transform-runtime": "^7.23.4",
"@babel/preset-env": "^7.23.3",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@babel/register": "^7.22.15",
"@changesets/cli": "^2.26.2",
"@manypkg/cli": "^0.21.0",
"@testing-library/jest-dom": "^6.1.4",
"@types/babel__core": "^7.20.5",
"@types/content-type": "^1.1.8",
"@types/jest": "^29.5.10",
"@changesets/cli": "^2.27.1",
"@manypkg/cli": "^0.21.2",
"@testing-library/jest-dom": "^6.4.1",
"@types/jest": "^29.5.12",
"@types/jest-when": "^3.5.5",
"@types/lodash": "^4.14.202",
"@types/node": "^20.9.5",
"@types/react-dom": "^18.2.17",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"babel-plugin-import": "^1.13.8",
"core-js": "^3.33.3",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"@types/node": "^20.11.16",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"core-js": "^3.35.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.33.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^22.1.0",
"jsdom-global": "^3.0.2",
"lodash": "^4.17.21",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.3",
"prettier": "^3.2.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.1",
"typescript": "^5.3.2"
"ts-jest": "^29.1.2",
"typescript": "^5.3.3"
}
}
14 changes: 7 additions & 7 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kablamo/eslint-config",
"version": "0.0.17",
"version": "0.0.18",
"main": "index.js",
"repository": "https://github.com/KablamoOSS/kerosene/tree/master/packages/eslint-config",
"bugs": {
Expand All @@ -18,22 +18,22 @@
"eslint": "^7 || ^8"
},
"devDependencies": {
"eslint": "^8.54.0"
"eslint": "^8.56.0"
},
"engines": {
"node": ">=18.12.0"
},
"dependencies": {
"@kablamo/eslint-plugin": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"eslint": "^7 || ^8"
},
"devDependencies": {
"@types/eslint": "^8.44.7",
"eslint": "^8.54.0"
"@types/eslint": "^8.56.2",
"eslint": "^8.56.0"
}
}
6 changes: 3 additions & 3 deletions packages/kerosene-test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kablamo/kerosene-test",
"version": "0.0.15",
"version": "0.0.16",
"repository": "https://github.com/KablamoOSS/kerosene/tree/master/packages/kerosene-test",
"bugs": {
"url": "https://github.com/KablamoOSS/kerosene/issues"
Expand Down Expand Up @@ -46,9 +46,9 @@
"utils"
],
"dependencies": {
"@kablamo/kerosene": "^0.0.39",
"@kablamo/kerosene": "^0.0.40",
"@types/lodash": "^4.14.202",
"@types/sinon": "^17.0.2",
"@types/sinon": "^17.0.3",
"lodash": "^4.17.21",
"sinon": "^17.0.1"
},
Expand Down
1 change: 0 additions & 1 deletion packages/kerosene-ui/.npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
__snapshots__
config
babel.config.js
rollup-config.ts
rollup.config.js
**.spec.ts
Expand Down
20 changes: 10 additions & 10 deletions packages/kerosene-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,31 @@
"node": ">=18.12.0"
},
"dependencies": {
"@kablamo/kerosene": "^0.0.39",
"@kablamo/kerosene": "^0.0.40",
"@types/lodash": "^4.14.202",
"esbuild-register": "^3.5.0",
"lodash": "^4.17.21",
"use-sync-external-store": "^1.2.0"
},
"devDependencies": {
"@kablamo/kerosene-test": "^0.0.15",
"@kablamo/kerosene-test": "^0.0.16",
"@kablamo/rollup-plugin-resolve-externals": "^0.0.2",
"@optimize-lodash/rollup-plugin": "^4.0.4",
"@sinonjs/fake-timers": "^11.2.2",
"@tanstack/react-query": "^5.12.2",
"@testing-library/dom": "^9.3.3",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.1",
"@tanstack/react-query": "^5.18.0",
"@testing-library/dom": "^9.3.4",
"@testing-library/react": "^14.2.1",
"@testing-library/user-event": "^14.5.2",
"@types/sinonjs__fake-timers": "^8.1.5",
"@types/use-sync-external-store": "^0.0.6",
"esbuild": "^0.19.11",
"esbuild": "^0.20.0",
"jest-sandbox": "^1.1.2",
"jest-when": "^3.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.11",
"rollup": "^4.5.1",
"rollup-plugin-esbuild": "^6.1.0"
"react-error-boundary": "^4.0.12",
"rollup": "^4.9.6",
"rollup-plugin-esbuild": "^6.1.1"
},
"peerDependencies": {
"@tanstack/react-query": ">=5.0.0 <6.0.0",
Expand Down
17 changes: 8 additions & 9 deletions packages/kerosene-ui/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
* Unwraps the decorated typings from a decorator-wrapped components to provide the original type of the underlying
* component. Useful in unit testing when stubbing decorators with the identity function.
*/
export type UnwrapComponent<T> = T extends React.MemoExoticComponent<
infer TMemoComponent
>
? UnwrapComponent<TMemoComponent>
: T extends React.LazyExoticComponent<infer TLazyComponent>
? UnwrapComponent<TLazyComponent>
: "WrappedComponent" extends keyof T
? UnwrapComponent<T["WrappedComponent"]>
: T;
export type UnwrapComponent<T> =
T extends React.MemoExoticComponent<infer TMemoComponent>
? UnwrapComponent<TMemoComponent>
: T extends React.LazyExoticComponent<infer TLazyComponent>
? UnwrapComponent<TLazyComponent>
: "WrappedComponent" extends keyof T
? UnwrapComponent<T["WrappedComponent"]>
: T;
2 changes: 1 addition & 1 deletion packages/kerosene-ui/src/utils/getSafeAreaInsets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function getSafeAreaInsets(): SafeAreaInsets {
return SIDES.reduce(
(acc, side) => ({
...acc,
[side]: (computed[side] && parseInt(computed[side]!, 10)) || 0,
[side]: (computed[side] && parseInt(computed[side], 10)) || 0,
}),
{} as Partial<SafeAreaInsets> as SafeAreaInsets,
);
Expand Down
13 changes: 7 additions & 6 deletions packages/kerosene/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kablamo/kerosene",
"version": "0.0.39",
"version": "0.0.40",
"repository": "https://github.com/KablamoOSS/kerosene/tree/master/packages/kerosene",
"bugs": {
"url": "https://github.com/KablamoOSS/kerosene/issues"
Expand Down Expand Up @@ -32,20 +32,21 @@
"dependencies": {
"@types/lodash": "^4.14.202",
"content-type": "^1.0.5",
"core-js-pure": "^3.33.3",
"date-fns": "^2.30.0",
"core-js-pure": "^3.35.1",
"date-fns": "^3.3.1",
"lodash": "^4.17.21"
},
"devDependencies": {
"@kablamo/rollup-plugin-resolve-externals": "^0.0.2",
"@optimize-lodash/rollup-plugin": "^4.0.4",
"@sinonjs/fake-timers": "^11.2.2",
"@types/content-type": "^1.1.8",
"@types/seed-random": "^2.2.4",
"esbuild": "^0.19.11",
"esbuild": "^0.20.0",
"esbuild-register": "^3.5.0",
"jest-when": "^3.6.0",
"rollup": "^4.5.1",
"rollup-plugin-esbuild": "^6.1.0",
"rollup": "^4.9.6",
"rollup-plugin-esbuild": "^6.1.1",
"seed-random": "^2.2.0"
},
"peerDependencies": {},
Expand Down
12 changes: 6 additions & 6 deletions packages/kerosene/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,27 @@ Otherwise, immutably removes that item from the array.

### `SECOND`

1000 milliseconds
Milliseconds in one second (1,000).

### `MINUTE`

60,000 milliseconds
Milliseconds in one minute (60,000).

### `HOUR`

3,600,000 milliseconds
Milliseconds in one hour (3,600,000).

### `DAY`

86,400,000 milliseconds
Milliseconds in one 24-hour day (86,400,000).

### `Month`

A 0-indexed enum for the months of the Gregorian Calendar
A 0-indexed enum for the months of the Gregorian Calendar.

### `DayOfWeek`

A 0-indexed enum for the days of the week
A 0-indexed enum for the days of the week, starting at Sunday.

### `getCalendarWeeks(month, startOfWeek)`

Expand Down
48 changes: 42 additions & 6 deletions packages/kerosene/src/datetime/constants.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,48 @@
export const SECOND = 1_000;
import {
daysInWeek,
millisecondsInDay,
millisecondsInHour,
millisecondsInMinute,
millisecondsInSecond,
monthsInYear,
} from "date-fns/constants";

export const MINUTE = 60 * SECOND;
/**
* Milliseconds in one second
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that we'll get hints now, did take me a minute originally to understand how to use these.

export const SECOND = millisecondsInSecond;

export const HOUR = 60 * MINUTE;
/**
* Milliseconds in one minute
*/
export const MINUTE = millisecondsInMinute;

export const DAY = 24 * HOUR;
/**
* Milliseconds in one hour
*/
export const HOUR = millisecondsInHour;

export const DAYS_PER_WEEK = 7;
/**
* Milliseconds in one 24-hour day
*
* Be aware of the [falsehoods programmers believe about time](https://gist.github.com/timvisee/fcda9bbdff88d45cc9061606b4b923ca).
* Not all days have 24 hours.
*/
export const DAY = millisecondsInDay;

export const MONTHS_PER_YEAR = 12;
/**
* Number of days in one week
*/
export const DAYS_PER_WEEK = daysInWeek;

/**
* Number of months in one year
*/
export const MONTHS_PER_YEAR = monthsInYear;

/**
* A 0-indexed enum for the months of the Gregorian Calendar
*/
export enum Month {
JANUARY = 0,
FEBRUARY,
Expand All @@ -25,6 +58,9 @@ export enum Month {
DECEMBER,
}

/**
* A 0-indexed enum for the days of the week, starting at Sunday
*/
export enum DayOfWeek {
SUNDAY = 0,
MONDAY,
Expand Down
2 changes: 2 additions & 0 deletions packages/kerosene/src/datetime/getCalendarWeeks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export type CalendarWeeks =
* to the timezone of the environment).
* @param month Date for the month
* @param firstDayOfWeek 0-indexed `DayOfWeek`
*
* @deprecated Use a library like `react-aria-components` which accounts for internationalisation
*/
export default function getCalendarWeeks(
month: Date | number,
Expand Down
6 changes: 3 additions & 3 deletions packages/kerosene/src/string/domSafeJson.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import domSafeJson from "./domSafeJson";

describe("domSafeJson", () => {
it("should escape the opening angle bracket", () => {
it("should escape ampersand and angle brackets", () => {
expect(
domSafeJson({
field: "</script>",
field: "&</script>",
}),
).toBe('{"field":"\\u003c/script>"}');
).toBe('{"field":"\\u0026\\u003c/script\\u003e"}');
});

it("should escape unicode characters in the range 007f to ffff", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/kerosene/src/string/domSafeJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import escape from "./escape";
/**
* These characters are unsafe
*/
const UNSAFE_CHARACTERS_REGEX = /([<\u007f-\uffff])/g;
const UNSAFE_CHARACTERS_REGEX = /([&><\u007f-\uffff])/g;

/**
* Like `JSON.stringify(value)`, but escaped for safe insertion into the DOM, such as inside a `<script>` tag for SSR
Expand Down
4 changes: 2 additions & 2 deletions packages/rollup-plugin-resolve-externals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
"lodash": "^4.17.21"
},
"devDependencies": {
"rollup": "^4.5.1"
"rollup": "^4.9.6"
},
"peerDependencies": {
"rollup": "^4.5.1"
"rollup": "^4.9.6"
},
"scripts": {
"build": "tsc",
Expand Down
Loading
Loading