diff --git a/.github/workflows/Readme.md b/.github/workflows/Readme.md index 3e700e7..bae1a5d 100644 --- a/.github/workflows/Readme.md +++ b/.github/workflows/Readme.md @@ -2,12 +2,12 @@ ## Release -1. Create pull-request for relese "Release vX.X.X" +1. Create a pull request for release "Release vX.X.X" 2. Run in root `yarn bump-release X.X.X` -3. yarn bump-release will bump focal version, update deps in private packages and create a commit +3. run `yarn bump-release` to bump focal and focal-atom version, update dependancies in private packages and create a commit 4. Merge and manually create [GitHub Release](https://github.com/grammarly/focal/releases) -5. On release "publish" GitHub Actions will trigger build and attach tarball to "Release". For details see `release.yml` +5. On release, "publish" GitHub Actions will trigger build and attach tarball to "Release". For details, see `release.yml` ## Tests -For each push into pull_reusets CI runs tests. Check `tests.yml` for details. +For each push into pull_request, CI runs tests. Check `tests.yml` for details. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a400ca..df4f86f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,17 +13,25 @@ jobs: id: branch_name run: | echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} - echo ::set-output name=TARBALL::grammarly-focal-${GITHUB_REF#refs/tags/}.tgz + echo ::set-output name=TARBALL_FOCAL::grammarly-focal-${GITHUB_REF#refs/tags/}.tgz + echo ::set-output name=TARBALL_FOCAL_ATOM::grammarly-focal-atom-${GITHUB_REF#refs/tags/}.tgz - name: Checkout code uses: actions/checkout@v2 - run: yarn install - run: yarn build - run: yarn test - run: yarn package - - name: Upload binaries to release + - name: Upload @grammarly/focal binaries to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./packages/focal/${{ steps.branch_name.outputs.TARBALL }} - asset_name: ${{ steps.branch_name.outputs.TARBALL }} + file: ./packages/focal/${{ steps.branch_name.outputs.TARBALL_FOCAL }} + asset_name: ${{ steps.branch_name.outputs.TARBALL_FOCAL }} + tag: ${{ github.ref }} + - name: Upload @grammarly/focal-atom binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./packages/focal-atom/${{ steps.branch_name.outputs.TARBALL_FOCAL_ATOM }} + asset_name: ${{ steps.branch_name.outputs.TARBALL_FOCAL_ATOM }} tag: ${{ github.ref }} diff --git a/README.md b/README.md index 586362e..13b93a0 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,11 @@ Type safe, expressive and composable state management for [React](https://facebo - Use [lenses](https://en.wikibooks.org/wiki/Haskell/Lenses_and_functional_references) to decompose the application state into smaller parts, so you can isolate UI components in a clean way and manipulate application state effortlessly. - Write less code that is easier to understand. +# Packages + +`@grammarly/focal` - Type safe, expressive and composable state management for [React](https://facebook.github.io/react/) applications. +`@grammarly/focal-atom` - Type safe, expressive and composable state management for any application. + # Example Here's a typical example of a 'counter' UI component and how it fits within the whole application: @@ -75,13 +80,18 @@ There's also a more elaborate version of [this example](packages/examples/all/sr # Installation ```bash -yarn add @grammarly/focal +yarn add @grammarly/focal-atom @grammarly/focal +# or +yarn add @grammarly/focal-atom + ``` or ```bash -npm install --save @grammarly/focal +npm install --save @grammarly/focal-atom @grammarly/focal +# or +npm install --save @grammarly/focal-atom ``` It is important to satisfy the RxJS peer dependency (required for `instanceof Observable` tests to work correctly). @@ -100,7 +110,7 @@ The example above might be a bit too overwhelming. Let's go over the main concep In Focal, state is stored in `Atom`s. `Atom` is a data cell that holds a single immutable value, which you can read and write to: ```typescript -import { Atom } from '@grammarly/focal' +import { Atom } from '@grammarly/focal-atom' // create an Atom with initial value of 0 const count = Atom.create(0) @@ -125,7 +135,7 @@ console.log(count.get()) You can also track (get notified of) changes that happen to an `Atom`'s value. In this sense, an `Atom` can be thought of as a _reactive variable_: ```typescript -import { Atom } from '@grammarly/focal' +import { Atom } from '@grammarly/focal-atom' const count = Atom.create(0) @@ -287,7 +297,7 @@ interface Lens { And an example usage: ```typescript -import { Lens } from '@grammarly/focal' +import { Lens } from '@grammarly/focal-atom' // an object that we want to operate on const obj = { @@ -400,7 +410,7 @@ We can accomplish this by combining atoms with lenses, making _lensed atoms_. A lensed atom is just an `Atom`, in sense that on the outside it looks and behaves just like another atom. The difference is in how it is created: a lensed atom operates on a part of some other atom's state. This means that if you `.set` or `.modify` a lensed atom's value, the part of the source atom's value at which this lensed atom's lens is focused will also change. For example: ```typescript -import { Atom, Lens } from '@grammarly/focal' +import { Atom, Lens } from '@grammarly/focal-atom' // create an atom to hold our object const obj = Atom.create({ diff --git a/package.json b/package.json index 902366a..8ebf3d4 100644 --- a/package.json +++ b/package.json @@ -1,32 +1,40 @@ { "private": true, "name": "focal", + "version": "0.0.0", + "workspaces": [ + "packages/focal-atom", + "packages/focal", + "packages/test", + "packages/examples/*" + ], + "nohoist": [ + "tslint-eslint-rules" + ], "scripts": { - "build": "yarn workspace @grammarly/focal build", - "lint": "yarn lint:focal && yarn lint:test && yarn lint:todomvc && yarn lint:examples", + "build": "yarn clean && yarn workspace @grammarly/focal build", + "dev": "yarn workspace @grammarly/focal dev", + "clean": "yarn workspace @grammarly/focal-atom clean && yarn workspace @grammarly/focal clean", + "docs": "yarn workspace @grammarly/focal-atom docs && yarn workspace @grammarly/focal docs", + "lint": "yarn lint:focal-atom && yarn lint:focal && yarn lint:test && yarn lint:todomvc && yarn lint:examples", "lint:focal": "yarn workspace @grammarly/focal lint", + "lint:focal-atom": "yarn workspace @grammarly/focal-atom lint", "lint:test": "yarn workspace focal-manual-tests lint", "lint:todomvc": "yarn workspace focal-todomvc lint", "lint:examples": "yarn workspace focal-examples lint", - "package": "yarn workspace @grammarly/focal pack", - "test": "yarn workspace @grammarly/focal test && yarn workspace focal-todomvc build && yarn workspace focal-examples build && yarn workspace focal-manual-tests build", - "postinstall": "yarn build", - "bump-version": "sh ./scripts/release.sh" + "test": "yarn workspace @grammarly/focal-atom test && yarn workspace @grammarly/focal test && yarn workspace focal-todomvc build && yarn workspace focal-examples build && yarn workspace focal-manual-tests build", + "package": "yarn workspace @grammarly/focal-atom pack && yarn workspace @grammarly/focal pack", + "bump-version": "sh ./scripts/bump-version.sh" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "^4.14.0", - "@typescript-eslint/eslint-plugin-tslint": "^4.14.0", - "@typescript-eslint/parser": "^4.14.0", + "@typescript-eslint/eslint-plugin": "^5.36.2", + "@typescript-eslint/eslint-plugin-tslint": "^5.36.2", + "@typescript-eslint/parser": "^5.36.2", "eslint": "^7.18.0", "eslint-plugin-jsdoc": "^31.0.8", "eslint-plugin-react": "^7.22.0", "typescript": "^4.7.4" }, - "workspaces": [ - "packages/focal", - "packages/test", - "packages/examples/*" - ], "resolutions": { "@types/react": "^18.0.14", "@types/react-dom": "^18.0.0" diff --git a/packages/focal-atom/.eslintrc.js b/packages/focal-atom/.eslintrc.js new file mode 100644 index 0000000..533533f --- /dev/null +++ b/packages/focal-atom/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + "parserOptions": { + "project": "./tsconfig.json", + "sourceType": "module", + "tsconfigRootDir": __dirname, + } +} diff --git a/packages/focal-atom/.gitignore b/packages/focal-atom/.gitignore new file mode 100644 index 0000000..1521c8b --- /dev/null +++ b/packages/focal-atom/.gitignore @@ -0,0 +1 @@ +dist diff --git a/packages/focal-atom/jest.config.js b/packages/focal-atom/jest.config.js new file mode 100644 index 0000000..c55da1b --- /dev/null +++ b/packages/focal-atom/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + clearMocks: true, + moduleFileExtensions: [ + 'js', + 'ts', + 'tsx', + ], + testEnvironment: 'jest-environment-jsdom', + testMatch: [ + '**/*.test.ts?(x)', + ], + transform: { + '.(ts|tsx)': 'ts-jest', + }, + preset: 'ts-jest' +} diff --git a/packages/focal-atom/package.json b/packages/focal-atom/package.json new file mode 100644 index 0000000..d0a7e82 --- /dev/null +++ b/packages/focal-atom/package.json @@ -0,0 +1,106 @@ +{ + "name": "@grammarly/focal-atom", + "version": "0.9.0", + "description": "FRP Atom: observables, immutable data and lenses", + "main": "dist/_cjs/src/index.js", + "module": "dist/_esm5/src/index.js", + "es2015": "dist/_esm2015/src/index.js", + "types": "dist/_cjs/src/index.d.ts", + "sideEffects": [ + "./dist/_cjs/src/lens/json.js", + "./dist/_esm5/src/lens/json.js", + "./dist/_esm2015/src/lens/json.js" + ], + "files": [ + "dist/_cjs/src/", + "dist/_esm5/src/", + "dist/_esm2015/src/" + ], + "scripts": { + "docs": "rm -rf ./docs && typedoc --out docs --theme minimal --ignoreCompilerErrors --tsconfig tsconfig.json", + "clean": "rm -rf ./dist", + "dev": "tsc -b -w tsconfig.build.cjs.json", + "build:cjs": "tsc -b tsconfig.build.cjs.json", + "build:es5": "tsc -b tsconfig.build.es5.json", + "build:es2015": "tsc -b tsconfig.build.es2015.json", + "build": "npm run clean && yarn build:cjs && yarn build:es5 && yarn build:es2015 && npm run lint", + "test": "jest", + "test:watch": "jest --watch", + "lint": "eslint './src/**/*.ts*' 'test/**/*.ts*' && tsc --noemit", + "prepack": "cp ../../README.md ./ && cp ../../LICENSE ./", + "postpack": "rm README.md && rm LICENSE" + }, + "author": "Serhii Yavnyi ", + "contributors": [ + { + "name": "Serhii Yavnyi", + "email": "serhii.yavnyi@grammarly.com" + }, + { + "name": "Valentyn Gaidylo", + "email": "valentyn.gaidylo@grammarly.com" + }, + { + "name": "Igor Kononuchenko", + "email": "igor.kononuchenko@grammarly.com" + }, + { + "name": "Alisa Mansurova", + "email": "alisa.mansurova@grammarly.com" + }, + { + "name": "Eugene Chechuryn", + "email": "eugene.chechuryn@grammarly.com" + }, + { + "name": "Yaroslav Voloshchuk", + "email": "yaroslav.voloshchuk@grammarly.com" + }, + { + "name": "Sergii Rudenko", + "email": "rudenko.sergey92@gmail.com" + }, + { + "name": "Gregory Shehet", + "email": "gregory.shehet@grammarly.com" + }, + { + "name": "Anton Verinov", + "email": "anton@verinov.com" + }, + { + "name": "Oleksii Levzhynskyi", + "email": "oleksii.levzhynskyi@grammarly.com" + }, + { + "name": "Vladyslav Bozhko", + "email": "vladyslav.bozhko@grammarly.com" + } + ], + "keywords": [ + "frp", + "rx", + "rxjs", + "reactive", + "react", + "reactjs", + "lens" + ], + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/grammarly/focal.git" + }, + "dependencies": {}, + "devDependencies": { + "@types/jest": "^24.0.20", + "@types/node": "^18.0.0", + "jest": "^28.1.1", + "rxjs": "6.3.3", + "ts-jest": "^28.0.5", + "typescript": "^4.7.4" + }, + "peerDependencies": { + "rxjs": ">= 6.3.3 < 7.0.0-0" + } +} diff --git a/packages/focal/src/atom/base.ts b/packages/focal-atom/src/atom/base.ts similarity index 99% rename from packages/focal/src/atom/base.ts rename to packages/focal-atom/src/atom/base.ts index bbdc4af..1b64ae2 100644 --- a/packages/focal/src/atom/base.ts +++ b/packages/focal-atom/src/atom/base.ts @@ -1,5 +1,6 @@ import { Lens, Prism, PropExpr } from './../lens' -import { structEq, Option } from './../utils' +import { Option } from './../utils' +import { structEq } from './../equals' import { Observable, Subscriber, Subscription, BehaviorSubject, combineLatest } from 'rxjs' diff --git a/packages/focal/src/atom/index.ts b/packages/focal-atom/src/atom/index.ts similarity index 100% rename from packages/focal/src/atom/index.ts rename to packages/focal-atom/src/atom/index.ts diff --git a/packages/focal/src/equals.ts b/packages/focal-atom/src/equals.ts similarity index 97% rename from packages/focal/src/equals.ts rename to packages/focal-atom/src/equals.ts index 3b7567d..3dfe20f 100644 --- a/packages/focal/src/equals.ts +++ b/packages/focal-atom/src/equals.ts @@ -193,7 +193,7 @@ function type(val: any) { * var b = {}; b.v = b * equals(a, b); //=> true */ -export function equals(a: any, b: any, stackA: any[] = [], stackB: any[] = []) { +export function structEq(a: any, b: any, stackA: any[] = [], stackB: any[] = []) { if (identical(a, b)) return true if (type(a) !== type(b)) return false if (a == null || b == null) return false @@ -244,7 +244,7 @@ export function equals(a: any, b: any, stackA: any[] = [], stackB: any[] = []) { case 'Map': case 'Set': - if (!equals(arrayFromIterator(a.entries()), arrayFromIterator(b.entries()), stackA, stackB)) + if (!structEq(arrayFromIterator(a.entries()), arrayFromIterator(b.entries()), stackA, stackB)) return false break @@ -286,7 +286,7 @@ export function equals(a: any, b: any, stackA: any[] = [], stackB: any[] = []) { while (idx >= 0) { const key = keysA[idx] - if (!(has(key, b) && equals(b[key], a[key], stackA, stackB))) + if (!(has(key, b) && structEq(b[key], a[key], stackA, stackB))) return false idx -= 1 diff --git a/packages/focal-atom/src/index.ts b/packages/focal-atom/src/index.ts new file mode 100644 index 0000000..1157b21 --- /dev/null +++ b/packages/focal-atom/src/index.ts @@ -0,0 +1,4 @@ +export { Lens, Prism, Optic } from './lens/index' +export { Atom, ReadOnlyAtom } from './atom/index' +export { Option } from './utils' +export { structEq } from './equals' diff --git a/packages/focal/src/lens/base.ts b/packages/focal-atom/src/lens/base.ts similarity index 100% rename from packages/focal/src/lens/base.ts rename to packages/focal-atom/src/lens/base.ts diff --git a/packages/focal/src/lens/index.ts b/packages/focal-atom/src/lens/index.ts similarity index 100% rename from packages/focal/src/lens/index.ts rename to packages/focal-atom/src/lens/index.ts diff --git a/packages/focal/src/lens/json.ts b/packages/focal-atom/src/lens/json.ts similarity index 99% rename from packages/focal/src/lens/json.ts rename to packages/focal-atom/src/lens/json.ts index 8baf3ab..71fcdd9 100644 --- a/packages/focal/src/lens/json.ts +++ b/packages/focal-atom/src/lens/json.ts @@ -5,7 +5,6 @@ */ import { - structEq, setKey, conservatively, findIndex, @@ -14,6 +13,10 @@ import { warning } from './../utils' +import { + structEq +} from './../equals' + import { Lens, Prism } from './base' export type PropExpr = (x: O) => P diff --git a/packages/focal-atom/src/utils.ts b/packages/focal-atom/src/utils.ts new file mode 100644 index 0000000..1811601 --- /dev/null +++ b/packages/focal-atom/src/utils.ts @@ -0,0 +1,53 @@ +import { structEq } from './equals' + +export const DEV_ENV = typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' + +export function setKey(k: K, v: T[K], o: T): T { + if (k in o && structEq(v, o[k])) { + return o + } else { + // this is the fastest way to do it, see + // https://jsperf.com/focal-setkey-for-loop-vs-object-assign + const r: { [k in keyof T]: T[k] } = {} as any + for (const p in o) r[p] = o[p] + r[k] = v + + return r + } +} + +/** + * 'Conserve' a value's identity if its structure doesn't change. + */ +function conserve(x: T, y: T): T { + return structEq(x, y) ? y : x +} + +/** + * Make a fold function's behaviour conservative in its input value's + * identity. + */ +export function conservatively(fn: ((y: T, c0: U) => U)) { + return (y: T, c0: U) => conserve(fn(y, c0), c0) +} + +export function findIndex(xs: T[], p: (x: T) => boolean): number { + for (let i = 0; i < xs.length; i++) { + if (p(xs[i])) return i + } + return -1 +} + +export function warning(message: string) { + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error('[Focal]: ' + message) // tslint:disable-line no-console + } + + // Throw a dummy error so it's possible to enter debugger with + // 'break on all exceptions'. + try { + throw new Error(message) + } catch (_) { /* no-op */ } +} + +export type Option = T | undefined diff --git a/packages/focal/test/atom.test.ts b/packages/focal-atom/test/atom.test.ts similarity index 99% rename from packages/focal/test/atom.test.ts rename to packages/focal-atom/test/atom.test.ts index b52c9d7..544f6a3 100644 --- a/packages/focal/test/atom.test.ts +++ b/packages/focal-atom/test/atom.test.ts @@ -1,7 +1,7 @@ import { merge, Observable, from, Subject, never, throwError, empty } from 'rxjs' import { take, toArray, tap, materialize, map } from 'rxjs/operators' import { Atom, Lens, ReadOnlyAtom } from '../src' -import { structEq } from '../src/utils' +import { structEq } from '../src/equals' function testAtom(newAtom: (x: number) => Atom) { it('atom/basic', async () => { diff --git a/packages/focal/test/lens.test.ts b/packages/focal-atom/test/lens.test.ts similarity index 99% rename from packages/focal/test/lens.test.ts rename to packages/focal-atom/test/lens.test.ts index ddb39b3..a859d8a 100644 --- a/packages/focal/test/lens.test.ts +++ b/packages/focal-atom/test/lens.test.ts @@ -1,5 +1,5 @@ import { Lens } from '../src' -import { structEq } from '../src/utils' +import { structEq } from '../src/equals' import { extractPropertyPath, parsePropertyPath } from '../src/lens/json' function roundtrip( diff --git a/packages/focal-atom/tsconfig.build.cjs.json b/packages/focal-atom/tsconfig.build.cjs.json new file mode 100644 index 0000000..69fb604 --- /dev/null +++ b/packages/focal-atom/tsconfig.build.cjs.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["**/*.spec.ts*"], + "compilerOptions": { + "outDir": "dist/_cjs", + "module": "commonjs", + "target": "es5" + } +} diff --git a/packages/focal-atom/tsconfig.build.es2015.json b/packages/focal-atom/tsconfig.build.es2015.json new file mode 100644 index 0000000..34be7d9 --- /dev/null +++ b/packages/focal-atom/tsconfig.build.es2015.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["**/*.spec.ts*"], + "compilerOptions": { + "outDir": "dist/_esm2015", + "module": "es2015", + "target": "esnext" + } +} diff --git a/packages/focal-atom/tsconfig.build.es5.json b/packages/focal-atom/tsconfig.build.es5.json new file mode 100644 index 0000000..98f2583 --- /dev/null +++ b/packages/focal-atom/tsconfig.build.es5.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["**/*.spec.ts*"], + "compilerOptions": { + "outDir": "dist/_esm5", + "module": "commonjs", + "target": "es2015", + } +} diff --git a/packages/focal-atom/tsconfig.json b/packages/focal-atom/tsconfig.json new file mode 100644 index 0000000..2242e08 --- /dev/null +++ b/packages/focal-atom/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "declaration": true, + "composite": true, + "target": "es5", + "sourceMap": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "rootDir": ".", + "noEmitOnError": true, + "noImplicitReturns": true, + "noImplicitAny": true, + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "moduleResolution": "node", + "jsx": "react", + "strictNullChecks": true, + "noImplicitThis": true, + "lib": ["es6", "es2015", "dom", "scripthost"] + }, + "include": [ + "src/**/*.ts*", + "test/**/*.ts*" + ] +} diff --git a/packages/focal/package.json b/packages/focal/package.json index c6fdddd..42340c8 100644 --- a/packages/focal/package.json +++ b/packages/focal/package.json @@ -22,21 +22,22 @@ "scripts": { "docs": "rm -rf ./docs && typedoc --out docs --theme minimal --ignoreCompilerErrors --tsconfig tsconfig.json", "clean": "rm -rf ./dist", - "build:cjs": "tsc --module commonjs --target es5 --outDir dist/_cjs", - "build:es5": "tsc --module es2015 --outDir dist/_esm5", - "build:es2015": "tsc --module es2015 --target es2015 --outDir dist/_esm2015", - "build": "npm run clean && yarn build:cjs && yarn build:es5 && yarn build:es2015 && npm run lint", + "dev": "tsc -b -w tsconfig.build.cjs.json", + "build:cjs": "tsc -b tsconfig.build.cjs.json", + "build:es5": "tsc -b tsconfig.build.es5.json", + "build:es2015": "tsc -b tsconfig.build.es2015.json", + "build": "yarn run clean && yarn build:cjs && yarn build:es5 && yarn build:es2015 && yarn run lint", "test": "jest", "test:watch": "jest --watch", "lint": "eslint './src/**/*.ts*' 'test/**/*.ts*' && tsc --noemit", "prepack": "cp ../../README.md ./ && cp ../../LICENSE ./", "postpack": "rm README.md && rm LICENSE" }, - "author": "Sergey Yavnyi ", + "author": "Serhii Yavnyi ", "contributors": [ { - "name": "Sergey Yavnyi", - "email": "sergey.yavnyi@grammarly.com" + "name": "Serhii Yavnyi", + "email": "serhii.yavnyi@grammarly.com" }, { "name": "Valentyn Gaidylo", @@ -59,8 +60,8 @@ "email": "yaroslav.voloshchuk@grammarly.com" }, { - "name": "Sergey Rudenko", - "email": "sergey.rudenko@grammarly.com" + "name": "Sergii Rudenko", + "email": "rudenko.sergey92@gmail.com" }, { "name": "Gregory Shehet", @@ -94,7 +95,7 @@ "url": "https://github.com/grammarly/focal.git" }, "devDependencies": { - "@types/jest": "24.0.20", + "@types/jest": "^24.0.20", "@types/node": "^18.0.0", "@types/react": "^18.0.14", "@types/react-dom": "^18.0.0", @@ -106,6 +107,9 @@ "ts-jest": "^28.0.5", "typescript": "^4.7.4" }, + "dependencies": { + "@grammarly/focal-atom": "^0.9.0" + }, "peerDependencies": { "@types/react": ">= 18.0.0 < 19.0.0-0", "@types/react-dom": ">= 18.0.0 < 19.0.0-0", diff --git a/packages/focal/src/index.ts b/packages/focal/src/index.ts index 0bf7450..0185766 100644 --- a/packages/focal/src/index.ts +++ b/packages/focal/src/index.ts @@ -1,7 +1,6 @@ -export { Atom, ReadOnlyAtom } from './atom/index' -export { Lens, Optic, Prism } from './lens/index' +export { Lens, Prism, Optic, Atom, ReadOnlyAtom, Option, structEq } from '@grammarly/focal-atom' + export { bind, bindElementProps, classes, F, lift, reactiveList } from './react' -export { Option } from './utils' diff --git a/packages/focal/src/react/react.ts b/packages/focal/src/react/react.ts index f896576..2b2878e 100644 --- a/packages/focal/src/react/react.ts +++ b/packages/focal/src/react/react.ts @@ -1,12 +1,11 @@ import * as React from 'react' +import { Atom, structEq } from '@grammarly/focal-atom' +import { warning, getReactComponentName, DEV_ENV } from './../utils' import { combineLatest, Observable, ObservableInput, of, Subscription as RxSubscription } from 'rxjs' import { map, scan } from 'rxjs/operators' -import { Atom } from './../atom' -import { DEV_ENV, getReactComponentName, structEq, warning } from './../utils' - export interface Subscription { unsubscribe(): void } @@ -35,8 +34,6 @@ export interface LiftWrapperState { */ export class LiftWrapper extends React.Component, LiftWrapperState> { - state = LiftWrapper._initState - static _initState: LiftWrapperState = { renderCache: null, subscription: null @@ -46,6 +43,8 @@ export class LiftWrapper subscription: null } + state = LiftWrapper._initState + render() { return this.state.renderCache || null } diff --git a/packages/focal/src/utils.ts b/packages/focal/src/utils.ts index 99f1408..9040147 100644 --- a/packages/focal/src/utils.ts +++ b/packages/focal/src/utils.ts @@ -1,45 +1,7 @@ import * as React from 'react' -import { equals as structEq } from './equals' -export { equals as structEq } from './equals' export const DEV_ENV = typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' -export function setKey(k: K, v: T[K], o: T): T { - if (k in o && structEq(v, o[k])) { - return o - } else { - // this is the fastest way to do it, see - // https://jsperf.com/focal-setkey-for-loop-vs-object-assign - const r: { [k in keyof T]: T[k] } = {} as any - for (const p in o) r[p] = o[p] - r[k] = v - - return r - } -} - -/** - * 'Conserve' a value's identity if its structure doesn't change. - */ -function conserve(x: T, y: T): T { - return structEq(x, y) ? y : x -} - -/** - * Make a fold function's behaviour conservative in its input value's - * identity. - */ -export function conservatively(fn: ((y: T, c0: U) => U)) { - return (y: T, c0: U) => conserve(fn(y, c0), c0) -} - -export function findIndex(xs: T[], p: (x: T) => boolean): number { - for (let i = 0; i < xs.length; i++) { - if (p(xs[i])) return i - } - return -1 -} - export function warning(message: string) { if (typeof console !== 'undefined' && typeof console.error === 'function') { console.error('[Focal]: ' + message) @@ -69,5 +31,3 @@ export function getReactComponentName( ? component.constructor.name : undefined } - -export type Option = T | undefined diff --git a/packages/focal/test/react.test.tsx b/packages/focal/test/react.test.tsx index 129e8d5..84be500 100644 --- a/packages/focal/test/react.test.tsx +++ b/packages/focal/test/react.test.tsx @@ -1,10 +1,15 @@ import * as React from 'react' import * as ReactDOM from 'react-dom/server' +import { Atom } from '@grammarly/focal-atom' import { EMPTY, NEVER, of } from 'rxjs' import { map, throttleTime } from 'rxjs/operators' import { - Atom, bind, bindElementProps, classes, F, - lift, reactiveList + F, + lift, + bind, + reactiveList, + classes, + bindElementProps } from '../src' class Comp extends React.Component<{ test: string }, {}> { diff --git a/packages/focal/tsconfig.build.cjs.json b/packages/focal/tsconfig.build.cjs.json new file mode 100644 index 0000000..369b5b8 --- /dev/null +++ b/packages/focal/tsconfig.build.cjs.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["**/*.spec.ts*"], + "compilerOptions": { + "outDir": "dist/_cjs", + "module": "commonjs", + "target": "es5" + }, + "references": [ + { "path": "../focal-atom/tsconfig.build.cjs.json" }, + ] +} diff --git a/packages/focal/tsconfig.build.es2015.json b/packages/focal/tsconfig.build.es2015.json new file mode 100644 index 0000000..fe14373 --- /dev/null +++ b/packages/focal/tsconfig.build.es2015.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["**/*.spec.ts*"], + "compilerOptions": { + "outDir": "dist/_esm2015", + "module": "es2015", + "target": "esnext" + }, + "references": [ + { "path": "../focal-atom/tsconfig.build.es2015.json" }, + ] +} diff --git a/packages/focal/tsconfig.build.es5.json b/packages/focal/tsconfig.build.es5.json new file mode 100644 index 0000000..77991a8 --- /dev/null +++ b/packages/focal/tsconfig.build.es5.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["**/*.spec.ts*"], + "compilerOptions": { + "outDir": "dist/_esm5", + "module": "commonjs", + "target": "es2015", + }, + "references": [ + { "path": "../focal-atom/tsconfig.build.es5.json" }, + ] +} diff --git a/packages/focal/tsconfig.json b/packages/focal/tsconfig.json index 75fb280..e8e59c5 100644 --- a/packages/focal/tsconfig.json +++ b/packages/focal/tsconfig.json @@ -22,5 +22,8 @@ "include": [ "src/**/*.ts*", "test/**/*.ts*" + ], + "references": [ + { "path": "../focal-atom/tsconfig.json" } ] } diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh new file mode 100644 index 0000000..468d6c3 --- /dev/null +++ b/scripts/bump-version.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +VER=$1 + +echo Bumping version to v${VER}... + +cd packages/focal && yarn version --new-version $VER --no-git-tag-version && cd ../.. +sed -i '' 's/grammarly\/focal":.*$/grammarly\/focal": "'${VER}'",/g' packages/examples/all/package.json +sed -i '' 's/grammarly\/focal":.*$/grammarly\/focal": "'${VER}'",/g' packages/examples/todomvc/package.json +sed -i '' 's/grammarly\/focal":.*$/grammarly\/focal": "'${VER}'",/g' packages/test/package.json + +echo Bumping version to v${VER}... + +cd packages/focal-atom && yarn version --new-version $VER --no-git-tag-version && cd ../.. +sed -i '' 's/grammarly\/focal-atom":.*$/grammarly\/focal-atom": "'${VER}'",/g' packages/focal/package.json +sed -i '' 's/grammarly\/focal-atom":.*$/grammarly\/focal-atom": "'${VER}'",/g' packages/examples/all/package.json +sed -i '' 's/grammarly\/focal-atom":.*$/grammarly\/focal-atom": "'${VER}'",/g' packages/examples/todomvc/package.json +sed -i '' 's/grammarly\/focal-atom":.*$/grammarly\/focal-atom": "'${VER}'",/g' packages/test/package.json + +# update yarn.lock +yarn && yarn test + +# commit changes +git add . +git commit -m "v$VER" diff --git a/scripts/release.sh b/scripts/release.sh deleted file mode 100644 index 8dc984d..0000000 --- a/scripts/release.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -VER=$1 - -echo "Releasing version $1" - -cd packages/focal && yarn version --new-version $VER --no-git-tag-version && cd ../.. -sed -i '' 's/grammarly\/focal":.*$/grammarly\/focal": "'${VER}'",/g' packages/examples/all/package.json -sed -i '' 's/grammarly\/focal":.*$/grammarly\/focal": "'${VER}'",/g' packages/examples/todomvc/package.json -sed -i '' 's/grammarly\/focal":.*$/grammarly\/focal": "'${VER}'",/g' packages/test/package.json -# yarn -git add . -git commit -m "v$VER" diff --git a/yarn.lock b/yarn.lock index 4fa0bfd..597f7f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -517,6 +517,15 @@ slash "^3.0.0" write-file-atomic "^4.0.1" +"@jest/types@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" + integrity sha1-Y8smy3UA0Gnlo4lEGnxqtekJ/Fk= + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^1.1.1" + "@types/yargs" "^13.0.0" + "@jest/types@^28.1.1": version "28.1.1" resolved "https://registry.npmjs.org/@jest/types/-/types-28.1.1.tgz#d059bbc80e6da6eda9f081f293299348bd78ee0b" @@ -647,7 +656,7 @@ dependencies: "@babel/types" "^7.3.0" -"@types/eslint@^7.2.6", "@types/eslint@^7.29.0": +"@types/eslint@^7.29.0": version "7.29.0" resolved "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz#e56ddc8e542815272720bb0b4ccc2aff9c3e1c78" integrity sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng== @@ -667,18 +676,31 @@ dependencies: "@types/node" "*" -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762" + integrity sha1-S6jdtyAiH0MuRDvV+RF/0iz9R2I= + +"@types/istanbul-lib-coverage@^2.0.1": version "2.0.4" resolved "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== "@types/istanbul-lib-report@*": version "3.0.0" - resolved "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" - integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" + integrity sha1-wUwk8Y6oGQwRjudWK3/5mjZVJoY= dependencies: "@types/istanbul-lib-coverage" "*" +"@types/istanbul-reports@^1.1.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-1.1.2.tgz#e875cc689e47bce549ec81f3df5e6f6f11cfaeb2" + integrity sha1-6HXMaJ5HvOVJ7IHz315vbxHPrrI= + dependencies: + "@types/istanbul-lib-coverage" "*" + "@types/istanbul-lib-report" "*" + "@types/istanbul-reports@^3.0.0": version "3.0.1" resolved "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" @@ -686,19 +708,12 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest-diff@*": - version "24.3.0" - resolved "https://registry.npmjs.org/@types/jest-diff/-/jest-diff-24.3.0.tgz#29e237a3d954babfe6e23cc59b57ecd8ca8d858d" - integrity sha512-vx1CRDeDUwQ0Pc7v+hS61O1ETA81kD04IMEC0hS1kPyVtHDdZrokAvpF7MT9VI/fVSzicelUZNCepDvhRV1PeA== +"@types/jest@^24.0.20": + version "24.9.1" + resolved "https://registry.npmjs.org/@types/jest/-/jest-24.9.1.tgz#02baf9573c78f1b9974a5f36778b366aa77bd534" + integrity sha1-Arr5Vzx48bmXSl82d4s2aqd71TQ= dependencies: - jest-diff "*" - -"@types/jest@24.0.20": - version "24.0.20" - resolved "https://registry.npmjs.org/@types/jest/-/jest-24.0.20.tgz#729d5fe8684e7fb06368d3bd557ac6d91289d861" - integrity sha512-M8ebEkOpykGdLoRrmew7UowTZ1DANeeP0HiSIChl/4DGgmnSC1ntitNtkyNSXjMTsZvXuaxJrxjImEnRWNPsPw== - dependencies: - "@types/jest-diff" "*" + jest-diff "^24.3.0" "@types/jsdom@^16.2.4": version "16.2.14" @@ -709,10 +724,10 @@ "@types/parse5" "*" "@types/tough-cookie" "*" -"@types/json-schema@*", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.7", "@types/json-schema@^7.0.8": +"@types/json-schema@*", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.11" resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" - integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== + integrity sha1-1CG2xSejA398hEM/0sQingFoY9M= "@types/node@*", "@types/node@^18.0.0": version "18.0.0" @@ -766,9 +781,16 @@ integrity sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw== "@types/yargs-parser@*": - version "21.0.0" - resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" - integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== + version "20.2.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.0.tgz#dd3e6699ba3237f0348cd085e4698780204842f9" + integrity sha1-3T5mmboyN/A0jNCF5GmHgCBIQvk= + +"@types/yargs@^13.0.0": + version "13.0.11" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.11.tgz#def2f0c93e4bdf2c61d7e34899b17e34be28d3b1" + integrity sha1-3vLwyT5L3yxh1+NImbF+NL4o07E= + dependencies: + "@types/yargs-parser" "*" "@types/yargs@^17.0.8": version "17.0.10" @@ -777,83 +799,94 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin-tslint@^4.14.0": - version "4.33.0" - resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin-tslint/-/eslint-plugin-tslint-4.33.0.tgz#c0f2a5a8a53a915d6c24983888013b7e78e75b44" - integrity sha512-o3ujMErtZJPgiNRETRJefo1bFNrloocOa5dMU49OW/G+Rq92IbXTY6FSF5MOwrdQK1X+VBEcA8y6PhUPWGlYqA== +"@typescript-eslint/eslint-plugin-tslint@^5.36.2": + version "5.36.2" + resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin-tslint/-/eslint-plugin-tslint-5.36.2.tgz#f34060fd72813317dc885c9afae1ff82f3064091" + integrity sha1-80Bg/XKBMxfciFya+uH/gvMGQJE= dependencies: - "@typescript-eslint/experimental-utils" "4.33.0" + "@typescript-eslint/utils" "5.36.2" lodash "^4.17.21" -"@typescript-eslint/eslint-plugin@^4.14.0": - version "4.33.0" - resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.33.0.tgz#c24dc7c8069c7706bc40d99f6fa87edcb2005276" - integrity sha512-aINiAxGVdOl1eJyVjaWn/YcVAq4Gi/Yo35qHGCnqbWVz61g39D0h23veY/MA0rFFGfxK7TySg2uwDeNv+JgVpg== +"@typescript-eslint/eslint-plugin@^5.36.2": + version "5.36.2" + resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.36.2.tgz#6df092a20e0f9ec748b27f293a12cb39d0c1fe4d" + integrity sha1-bfCSog4PnsdIsn8pOhLLOdDB/k0= dependencies: - "@typescript-eslint/experimental-utils" "4.33.0" - "@typescript-eslint/scope-manager" "4.33.0" - debug "^4.3.1" + "@typescript-eslint/scope-manager" "5.36.2" + "@typescript-eslint/type-utils" "5.36.2" + "@typescript-eslint/utils" "5.36.2" + debug "^4.3.4" functional-red-black-tree "^1.0.1" - ignore "^5.1.8" - regexpp "^3.1.0" - semver "^7.3.5" + ignore "^5.2.0" + regexpp "^3.2.0" + semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/experimental-utils@4.33.0": - version "4.33.0" - resolved "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.33.0.tgz#6f2a786a4209fa2222989e9380b5331b2810f7fd" - integrity sha512-zeQjOoES5JFjTnAhI5QY7ZviczMzDptls15GFsI6jyUOq0kOf9+WonkhtlIhh0RgHRnqj5gdNxW5j1EvAyYg6Q== +"@typescript-eslint/parser@^5.36.2": + version "5.36.2" + resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.36.2.tgz#3ddf323d3ac85a25295a55fcb9c7a49ab4680ddd" + integrity sha1-Pd8yPTrIWiUpWlX8ucekmrRoDd0= dependencies: - "@types/json-schema" "^7.0.7" - "@typescript-eslint/scope-manager" "4.33.0" - "@typescript-eslint/types" "4.33.0" - "@typescript-eslint/typescript-estree" "4.33.0" - eslint-scope "^5.1.1" - eslint-utils "^3.0.0" + "@typescript-eslint/scope-manager" "5.36.2" + "@typescript-eslint/types" "5.36.2" + "@typescript-eslint/typescript-estree" "5.36.2" + debug "^4.3.4" -"@typescript-eslint/parser@^4.14.0": - version "4.33.0" - resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.33.0.tgz#dfe797570d9694e560528d18eecad86c8c744899" - integrity sha512-ZohdsbXadjGBSK0/r+d87X0SBmKzOq4/S5nzK6SBgJspFo9/CUDJ7hjayuze+JK7CZQLDMroqytp7pOcFKTxZA== +"@typescript-eslint/scope-manager@5.36.2": + version "5.36.2" + resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.36.2.tgz#a75eb588a3879ae659514780831370642505d1cd" + integrity sha1-p161iKOHmuZZUUeAgxNwZCUF0c0= dependencies: - "@typescript-eslint/scope-manager" "4.33.0" - "@typescript-eslint/types" "4.33.0" - "@typescript-eslint/typescript-estree" "4.33.0" - debug "^4.3.1" + "@typescript-eslint/types" "5.36.2" + "@typescript-eslint/visitor-keys" "5.36.2" -"@typescript-eslint/scope-manager@4.33.0": - version "4.33.0" - resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.33.0.tgz#d38e49280d983e8772e29121cf8c6e9221f280a3" - integrity sha512-5IfJHpgTsTZuONKbODctL4kKuQje/bzBRkwHE8UOZ4f89Zeddg+EGZs8PD8NcN4LdM3ygHWYB3ukPAYjvl/qbQ== +"@typescript-eslint/type-utils@5.36.2": + version "5.36.2" + resolved "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.36.2.tgz#752373f4babf05e993adf2cd543a763632826391" + integrity sha1-dSNz9Lq/BemTrfLNVDp2NjKCY5E= dependencies: - "@typescript-eslint/types" "4.33.0" - "@typescript-eslint/visitor-keys" "4.33.0" + "@typescript-eslint/typescript-estree" "5.36.2" + "@typescript-eslint/utils" "5.36.2" + debug "^4.3.4" + tsutils "^3.21.0" -"@typescript-eslint/types@4.33.0": - version "4.33.0" - resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.33.0.tgz#a1e59036a3b53ae8430ceebf2a919dc7f9af6d72" - integrity sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ== +"@typescript-eslint/types@5.36.2": + version "5.36.2" + resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.36.2.tgz#a5066e500ebcfcee36694186ccc57b955c05faf9" + integrity sha1-pQZuUA68/O42aUGGzMV7lVwF+vk= + +"@typescript-eslint/typescript-estree@5.36.2": + version "5.36.2" + resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.36.2.tgz#0c93418b36c53ba0bc34c61fe9405c4d1d8fe560" + integrity sha1-DJNBizbFO6C8NMYf6UBcTR2P5WA= + dependencies: + "@typescript-eslint/types" "5.36.2" + "@typescript-eslint/visitor-keys" "5.36.2" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@4.33.0": - version "4.33.0" - resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz#0dfb51c2908f68c5c08d82aefeaf166a17c24609" - integrity sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA== +"@typescript-eslint/utils@5.36.2": + version "5.36.2" + resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.36.2.tgz#b01a76f0ab244404c7aefc340c5015d5ce6da74c" + integrity sha1-sBp28KskRATHrvw0DFAV1c5tp0w= dependencies: - "@typescript-eslint/types" "4.33.0" - "@typescript-eslint/visitor-keys" "4.33.0" - debug "^4.3.1" - globby "^11.0.3" - is-glob "^4.0.1" - semver "^7.3.5" - tsutils "^3.21.0" + "@types/json-schema" "^7.0.9" + "@typescript-eslint/scope-manager" "5.36.2" + "@typescript-eslint/types" "5.36.2" + "@typescript-eslint/typescript-estree" "5.36.2" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" -"@typescript-eslint/visitor-keys@4.33.0": - version "4.33.0" - resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz#2a22f77a41604289b7a186586e9ec48ca92ef1dd" - integrity sha512-uqi/2aSz9g2ftcHWf8uLPJA70rUv6yuMW5Bohw+bwcuzaxQIHaKFZCKGoGXIrc9vkTJ3+0txM73K0Hq3d5wgIg== +"@typescript-eslint/visitor-keys@5.36.2": + version "5.36.2" + resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.36.2.tgz#2f8f78da0a3bad3320d2ac24965791ac39dace5a" + integrity sha1-L4942go7rTMg0qwklleRrDnazlo= dependencies: - "@typescript-eslint/types" "4.33.0" - eslint-visitor-keys "^2.0.0" + "@typescript-eslint/types" "5.36.2" + eslint-visitor-keys "^3.3.0" "@webassemblyjs/ast@1.9.0": version "1.9.0" @@ -1115,7 +1148,7 @@ ansi-html-community@0.0.8: resolved "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz#69fbc4d6ccbe383f9736934ae34c3f8290f1bf41" integrity sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw== -ansi-regex@^4.1.0: +ansi-regex@^4.0.0, ansi-regex@^4.1.0: version "4.1.1" resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz#164daac87ab2d6f6db3a29875e2d1766582dabed" integrity sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g== @@ -1657,6 +1690,14 @@ chalk@^2.0.0, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^2.0.1: + version "2.4.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.0.tgz#a060a297a6b57e15b61ca63ce84995daa0fe6e52" + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + chalk@^4.0.0, chalk@^4.1.0: version "4.1.2" resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" @@ -2045,10 +2086,10 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3: dependencies: ms "2.0.0" -debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: +debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.4: version "4.3.4" resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + integrity sha1-Exn2V5NX8jONMzfSzdSRS7XcyGU= dependencies: ms "2.1.2" @@ -2145,6 +2186,11 @@ detect-newline@^3.0.0: resolved "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== +diff-sequences@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" + integrity sha1-VxXWJE4qpl9Iu6C8ly2wsLEelbU= + diff-sequences@^28.1.1: version "28.1.1" resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-28.1.1.tgz#9989dc731266dc2903457a70e996f3a041913ac6" @@ -2469,16 +2515,10 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== -eslint-webpack-plugin@2.5.3: - version "2.5.3" - resolved "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-2.5.3.tgz#a125585a1d8bb9c939f2a920a9bc9be4a21cdb58" - integrity sha512-LewNevZf9ghDCxCGT6QltNWVi8KIYWc4LKcin8K9Azh1hypG7YAmobUDIU67fAPa+eMjRnU4rjEkLbYI1w5/UA== - dependencies: - "@types/eslint" "^7.2.6" - arrify "^2.0.1" - jest-worker "^26.6.2" - micromatch "^4.0.2" - schema-utils "^3.0.0" +eslint-visitor-keys@^3.3.0: + version "3.3.0" + resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" + integrity sha1-9kgPprHzDv4tGWiqisdFuGJGmCY= eslint-webpack-plugin@^2.5.3: version "2.7.0" @@ -3080,10 +3120,10 @@ globals@^13.6.0, globals@^13.9.0: dependencies: type-fest "^0.20.2" -globby@^11.0.3: +globby@^11.1.0: version "11.1.0" resolved "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" - integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + integrity sha1-vUvpi7BC+D15b344EZkfvoKg00s= dependencies: array-union "^2.1.0" dir-glob "^3.0.1" @@ -3306,7 +3346,7 @@ ignore@^4.0.6: resolved "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -ignore@^5.1.8, ignore@^5.2.0: +ignore@^5.2.0: version "5.2.0" resolved "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== @@ -3535,10 +3575,10 @@ is-glob@^3.1.0: dependencies: is-extglob "^2.1.0" -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + integrity sha1-ZPYeQsu7LuwgcanawLKLoeZdUIQ= dependencies: is-extglob "^2.1.1" @@ -3772,7 +3812,17 @@ jest-config@^28.1.1: slash "^3.0.0" strip-json-comments "^3.1.1" -jest-diff@*, jest-diff@^28.1.1: +jest-diff@^24.3.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" + integrity sha1-kxt9DVd4obr3RSy4FuMl43JAVdo= + dependencies: + chalk "^2.0.1" + diff-sequences "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" + +jest-diff@^28.1.1: version "28.1.1" resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-28.1.1.tgz#1a3eedfd81ae79810931c63a1d0f201b9120106c" integrity sha512-/MUUxeR2fHbqHoMMiffe/Afm+U8U4olFRJ0hiVG2lZatPJcnGxx292ustVu7bULhjV65IYMxRdploAKLbcrsyg== @@ -3826,6 +3876,11 @@ jest-environment-node@^28.1.1: jest-mock "^28.1.1" jest-util "^28.1.1" +jest-get-type@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e" + integrity sha1-FoSgyKUPLkkBtmRK6GH1ee7S7w4= + jest-get-type@^28.0.2: version "28.0.2" resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz#34622e628e4fdcd793d46db8a242227901fcf203" @@ -4046,15 +4101,6 @@ jest-watcher@^28.1.1: jest-util "^28.1.1" string-length "^4.0.1" -jest-worker@^26.6.2: - version "26.6.2" - resolved "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" - integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ== - dependencies: - "@types/node" "*" - merge-stream "^2.0.0" - supports-color "^7.0.0" - jest-worker@^27.5.1: version "27.5.1" resolved "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" @@ -4426,7 +4472,7 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: snapdragon "^0.8.1" to-regex "^3.0.2" -micromatch@^4.0.0, micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5: +micromatch@^4.0.0, micromatch@^4.0.4, micromatch@^4.0.5: version "4.0.5" resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== @@ -5056,6 +5102,16 @@ prelude-ls@~1.1.2: resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== +pretty-format@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" + integrity sha1-EvrDGzcBmk7qPBGqmpWet2KKp8k= + dependencies: + "@jest/types" "^24.9.0" + ansi-regex "^4.0.0" + ansi-styles "^3.2.0" + react-is "^16.8.4" + pretty-format@^28.1.1: version "28.1.1" resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.1.tgz#f731530394e0f7fcd95aba6b43c50e02d86b95cb" @@ -5243,7 +5299,7 @@ react-dom@^18.0.0: loose-envify "^1.1.0" scheduler "^0.23.0" -react-is@^16.13.1: +react-is@^16.13.1, react-is@^16.8.4: version "16.13.1" resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== @@ -5346,10 +5402,10 @@ regexp.prototype.flags@^1.4.1, regexp.prototype.flags@^1.4.3: define-properties "^1.1.3" functions-have-names "^1.2.2" -regexpp@^3.1.0: +regexpp@^3.1.0, regexpp@^3.2.0: version "3.2.0" resolved "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" - integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== + integrity sha1-BCWido2PI7rXDKS5BGH6LxIT4bI= regextras@^0.7.1: version "0.7.1" @@ -5558,7 +5614,7 @@ schema-utils@^2.7.0: ajv "^6.12.4" ajv-keywords "^3.5.2" -schema-utils@^3.0.0, schema-utils@^3.1.1: +schema-utils@^3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz#bc74c4b6b6995c1d88f76a8b77bea7219e0c8281" integrity sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw== @@ -5567,10 +5623,10 @@ schema-utils@^3.0.0, schema-utils@^3.1.1: ajv "^6.12.5" ajv-keywords "^3.5.2" -semver@7.x, semver@^7.2.1, semver@^7.3.4, semver@^7.3.5: +semver@7.x, semver@^7.2.1, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7: version "7.3.7" resolved "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f" - integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g== + integrity sha1-EsW2Sa/b+QSXB3luIqQCiBTOUj8= dependencies: lru-cache "^6.0.0"