From a9bd0dec4ce088f9a7a3f4bbb43b1da000a82877 Mon Sep 17 00:00:00 2001 From: Manish Jha Date: Wed, 21 Aug 2024 15:34:58 +0530 Subject: [PATCH 1/5] preact vX upgrade --- .../.codemodrc.json | 15 ++++ .../.gitignore | 2 + .../default-import-to-namespace-mport/LICENSE | 9 ++ .../README.md | 14 ++++ .../__testfixtures__/fixture1.input.ts | 1 + .../__testfixtures__/fixture1.output.ts | 1 + .../cdmd_dist/index.cjs | 35 ++++++++ .../package.json | 19 +++++ .../src/index.ts | 23 +++++ .../test/test.ts | 48 +++++++++++ .../tsconfig.json | 35 ++++++++ .../vitest.config.ts | 7 ++ .../X/import-source-update/.codemodrc.json | 15 ++++ .../preact/X/import-source-update/.gitignore | 2 + .../preact/X/import-source-update/LICENSE | 9 ++ .../preact/X/import-source-update/README.md | 23 +++++ .../__testfixtures__/fixture1.input.ts | 3 + .../__testfixtures__/fixture1.output.ts | 4 + .../import-source-update/cdmd_dist/index.cjs | 36 ++++++++ .../X/import-source-update/package.json | 19 +++++ .../X/import-source-update/src/index.ts | 25 ++++++ .../X/import-source-update/test/test.ts | 48 +++++++++++ .../X/import-source-update/tsconfig.json | 35 ++++++++ .../X/import-source-update/vitest.config.ts | 7 ++ .../.codemodrc.json | 15 ++++ .../.gitignore | 2 + .../LICENSE | 9 ++ .../README.md | 41 +++++++++ .../__testfixtures__/fixture1.input.ts | 12 +++ .../__testfixtures__/fixture1.output.ts | 12 +++ .../__testfixtures__/fixture2.input.ts | 18 ++++ .../__testfixtures__/fixture2.output.ts | 11 +++ .../cdmd_dist/index.cjs | 53 ++++++++++++ .../package.json | 19 +++++ .../src/index.ts | 47 +++++++++++ .../test/test.ts | 73 ++++++++++++++++ .../tsconfig.json | 35 ++++++++ .../vitest.config.ts | 7 ++ .../.codemodrc.json | 15 ++++ .../props-children-to-child-array/.gitignore | 2 + .../X/props-children-to-child-array/LICENSE | 9 ++ .../X/props-children-to-child-array/README.md | 26 ++++++ .../__testfixtures__/fixture1.input.ts | 4 + .../__testfixtures__/fixture1.output.ts | 6 ++ .../cdmd_dist/index.cjs | 84 +++++++++++++++++++ .../package.json | 19 +++++ .../src/index.ts | 75 +++++++++++++++++ .../test/test.ts | 48 +++++++++++ .../tsconfig.json | 35 ++++++++ .../vitest.config.ts | 7 ++ .../.codemodrc.json | 15 ++++ .../.gitignore | 2 + .../replace-this-state-with-prevstate/LICENSE | 9 ++ .../README.md | 20 +++++ .../__testfixtures__/fixture1.input.ts | 1 + .../__testfixtures__/fixture1.output.ts | 3 + .../cdmd_dist/index.cjs | 49 +++++++++++ .../package.json | 19 +++++ .../src/index.ts | 42 ++++++++++ .../test/test.ts | 48 +++++++++++ .../tsconfig.json | 35 ++++++++ .../vitest.config.ts | 7 ++ 62 files changed, 1369 insertions(+) create mode 100644 packages/codemods/preact/X/default-import-to-namespace-mport/.codemodrc.json create mode 100644 packages/codemods/preact/X/default-import-to-namespace-mport/.gitignore create mode 100644 packages/codemods/preact/X/default-import-to-namespace-mport/LICENSE create mode 100644 packages/codemods/preact/X/default-import-to-namespace-mport/README.md create mode 100644 packages/codemods/preact/X/default-import-to-namespace-mport/__testfixtures__/fixture1.input.ts create mode 100644 packages/codemods/preact/X/default-import-to-namespace-mport/__testfixtures__/fixture1.output.ts create mode 100644 packages/codemods/preact/X/default-import-to-namespace-mport/cdmd_dist/index.cjs create mode 100644 packages/codemods/preact/X/default-import-to-namespace-mport/package.json create mode 100644 packages/codemods/preact/X/default-import-to-namespace-mport/src/index.ts create mode 100644 packages/codemods/preact/X/default-import-to-namespace-mport/test/test.ts create mode 100644 packages/codemods/preact/X/default-import-to-namespace-mport/tsconfig.json create mode 100644 packages/codemods/preact/X/default-import-to-namespace-mport/vitest.config.ts create mode 100644 packages/codemods/preact/X/import-source-update/.codemodrc.json create mode 100644 packages/codemods/preact/X/import-source-update/.gitignore create mode 100644 packages/codemods/preact/X/import-source-update/LICENSE create mode 100644 packages/codemods/preact/X/import-source-update/README.md create mode 100644 packages/codemods/preact/X/import-source-update/__testfixtures__/fixture1.input.ts create mode 100644 packages/codemods/preact/X/import-source-update/__testfixtures__/fixture1.output.ts create mode 100644 packages/codemods/preact/X/import-source-update/cdmd_dist/index.cjs create mode 100644 packages/codemods/preact/X/import-source-update/package.json create mode 100644 packages/codemods/preact/X/import-source-update/src/index.ts create mode 100644 packages/codemods/preact/X/import-source-update/test/test.ts create mode 100644 packages/codemods/preact/X/import-source-update/tsconfig.json create mode 100644 packages/codemods/preact/X/import-source-update/vitest.config.ts create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/.codemodrc.json create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/.gitignore create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/LICENSE create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/README.md create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture1.input.ts create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture1.output.ts create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.input.ts create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.output.ts create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/cdmd_dist/index.cjs create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/package.json create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/src/index.ts create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/test/test.ts create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/tsconfig.json create mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/vitest.config.ts create mode 100644 packages/codemods/preact/X/props-children-to-child-array/.codemodrc.json create mode 100644 packages/codemods/preact/X/props-children-to-child-array/.gitignore create mode 100644 packages/codemods/preact/X/props-children-to-child-array/LICENSE create mode 100644 packages/codemods/preact/X/props-children-to-child-array/README.md create mode 100644 packages/codemods/preact/X/props-children-to-child-array/__testfixtures__/fixture1.input.ts create mode 100644 packages/codemods/preact/X/props-children-to-child-array/__testfixtures__/fixture1.output.ts create mode 100644 packages/codemods/preact/X/props-children-to-child-array/cdmd_dist/index.cjs create mode 100644 packages/codemods/preact/X/props-children-to-child-array/package.json create mode 100644 packages/codemods/preact/X/props-children-to-child-array/src/index.ts create mode 100644 packages/codemods/preact/X/props-children-to-child-array/test/test.ts create mode 100644 packages/codemods/preact/X/props-children-to-child-array/tsconfig.json create mode 100644 packages/codemods/preact/X/props-children-to-child-array/vitest.config.ts create mode 100644 packages/codemods/preact/X/replace-this-state-with-prevstate/.codemodrc.json create mode 100644 packages/codemods/preact/X/replace-this-state-with-prevstate/.gitignore create mode 100644 packages/codemods/preact/X/replace-this-state-with-prevstate/LICENSE create mode 100644 packages/codemods/preact/X/replace-this-state-with-prevstate/README.md create mode 100644 packages/codemods/preact/X/replace-this-state-with-prevstate/__testfixtures__/fixture1.input.ts create mode 100644 packages/codemods/preact/X/replace-this-state-with-prevstate/__testfixtures__/fixture1.output.ts create mode 100644 packages/codemods/preact/X/replace-this-state-with-prevstate/cdmd_dist/index.cjs create mode 100644 packages/codemods/preact/X/replace-this-state-with-prevstate/package.json create mode 100644 packages/codemods/preact/X/replace-this-state-with-prevstate/src/index.ts create mode 100644 packages/codemods/preact/X/replace-this-state-with-prevstate/test/test.ts create mode 100644 packages/codemods/preact/X/replace-this-state-with-prevstate/tsconfig.json create mode 100644 packages/codemods/preact/X/replace-this-state-with-prevstate/vitest.config.ts diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/.codemodrc.json b/packages/codemods/preact/X/default-import-to-namespace-mport/.codemodrc.json new file mode 100644 index 000000000..753e19a11 --- /dev/null +++ b/packages/codemods/preact/X/default-import-to-namespace-mport/.codemodrc.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json", + "name": "preact/X/default-import-to-namespace-import", + "version": "1.0.0", + "engine": "jscodeshift", + "private": false, + "arguments": [], + "meta": { + "tags": ["preact", "X", "migration"], + "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/preact/X/default-import-to-namespace-import" + }, + "applicability": { + "from": [["preact", "<", "8.x"]] + } +} diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/.gitignore b/packages/codemods/preact/X/default-import-to-namespace-mport/.gitignore new file mode 100644 index 000000000..76add878f --- /dev/null +++ b/packages/codemods/preact/X/default-import-to-namespace-mport/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/LICENSE b/packages/codemods/preact/X/default-import-to-namespace-mport/LICENSE new file mode 100644 index 000000000..335a784ea --- /dev/null +++ b/packages/codemods/preact/X/default-import-to-namespace-mport/LICENSE @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2024 manishjha-04 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/README.md b/packages/codemods/preact/X/default-import-to-namespace-mport/README.md new file mode 100644 index 000000000..16bae92a1 --- /dev/null +++ b/packages/codemods/preact/X/default-import-to-namespace-mport/README.md @@ -0,0 +1,14 @@ +A codemod that converts named imports of Preact to namespace imports for improved compatibility and consistency. + +### Before + +```ts +import Preact from 'preact'; +``` + +### After + +```ts +import * as preact from 'preact'; +``` + diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/__testfixtures__/fixture1.input.ts b/packages/codemods/preact/X/default-import-to-namespace-mport/__testfixtures__/fixture1.input.ts new file mode 100644 index 000000000..014961544 --- /dev/null +++ b/packages/codemods/preact/X/default-import-to-namespace-mport/__testfixtures__/fixture1.input.ts @@ -0,0 +1 @@ +import Preact from 'preact'; \ No newline at end of file diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/__testfixtures__/fixture1.output.ts b/packages/codemods/preact/X/default-import-to-namespace-mport/__testfixtures__/fixture1.output.ts new file mode 100644 index 000000000..c441c553f --- /dev/null +++ b/packages/codemods/preact/X/default-import-to-namespace-mport/__testfixtures__/fixture1.output.ts @@ -0,0 +1 @@ +import * as preact from 'preact'; \ No newline at end of file diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/cdmd_dist/index.cjs b/packages/codemods/preact/X/default-import-to-namespace-mport/cdmd_dist/index.cjs new file mode 100644 index 000000000..8d75a39b7 --- /dev/null +++ b/packages/codemods/preact/X/default-import-to-namespace-mport/cdmd_dist/index.cjs @@ -0,0 +1,35 @@ +/*! @license +The MIT License (MIT) + +Copyright (c) 2024 manishjha-04 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +Object.defineProperty(exports, "default", { + enumerable: true, + get: () => transformer, +}); +function transformer(fileInfo, api) { + const j = api.jscodeshift; + const root = j(fileInfo.source); + root + .find(j.ImportDeclaration, { source: { value: "preact" } }) + .forEach((path) => { + const defaultImportSpecifier = path.node.specifiers.find( + (specifier) => specifier.type === "ImportDefaultSpecifier", + ); + if (defaultImportSpecifier) { + path.node.specifiers = [ + j.importNamespaceSpecifier(j.identifier("preact")), + ]; + } + }); + return root.toSource(); +} diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/package.json b/packages/codemods/preact/X/default-import-to-namespace-mport/package.json new file mode 100644 index 000000000..890796f18 --- /dev/null +++ b/packages/codemods/preact/X/default-import-to-namespace-mport/package.json @@ -0,0 +1,19 @@ +{ + "name": "preact-convert-default-import-to-namespace-import", + "license": "MIT", + "devDependencies": { + "@types/node": "20.9.0", + "typescript": "^5.2.2", + "vitest": "^1.0.1", + "@codemod.com/codemod-utils": "*", + "jscodeshift": "^0.15.1", + "@types/jscodeshift": "^0.11.10" + }, + "scripts": { + "test": "vitest run", + "test:watch": "vitest watch" + }, + "files": ["README.md", ".codemodrc.json", "/dist/index.cjs"], + "type": "module", + "author": "manishjha-04" +} diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/src/index.ts b/packages/codemods/preact/X/default-import-to-namespace-mport/src/index.ts new file mode 100644 index 000000000..b5ec7b34a --- /dev/null +++ b/packages/codemods/preact/X/default-import-to-namespace-mport/src/index.ts @@ -0,0 +1,23 @@ +export default function transformer(fileInfo, api) { + const j = api.jscodeshift; + const root = j(fileInfo.source); + + // Find all import declarations from 'preact' + root + .find(j.ImportDeclaration, { source: { value: "preact" } }) + .forEach((path) => { + // Check if the import is a default import + const defaultImportSpecifier = path.node.specifiers.find( + (specifier) => specifier.type === "ImportDefaultSpecifier", + ); + + if (defaultImportSpecifier) { + // Replace the default import with a namespace import + path.node.specifiers = [ + j.importNamespaceSpecifier(j.identifier("preact")), + ]; + } + }); + + return root.toSource(); +} diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/test/test.ts b/packages/codemods/preact/X/default-import-to-namespace-mport/test/test.ts new file mode 100644 index 000000000..7d49f7ac2 --- /dev/null +++ b/packages/codemods/preact/X/default-import-to-namespace-mport/test/test.ts @@ -0,0 +1,48 @@ +import assert from "node:assert"; +import { readFile } from "node:fs/promises"; +import { join } from "node:path"; +import jscodeshift, { type API } from "jscodeshift"; +import { describe, it } from "vitest"; +import transform from "../src/index.js"; + +const buildApi = (parser: string | undefined): API => ({ + j: parser ? jscodeshift.withParser(parser) : jscodeshift, + jscodeshift: parser ? jscodeshift.withParser(parser) : jscodeshift, + stats: () => { + console.error( + "The stats function was called, which is not supported on purpose", + ); + }, + report: () => { + console.error( + "The report function was called, which is not supported on purpose", + ); + }, +}); + +describe("preact/convert-default-import-to-namespace-import", () => { + it("test #1", async () => { + const INPUT = await readFile( + join(__dirname, "..", "__testfixtures__/fixture1.input.ts"), + "utf-8", + ); + const OUTPUT = await readFile( + join(__dirname, "..", "__testfixtures__/fixture1.output.ts"), + "utf-8", + ); + + const actualOutput = transform( + { + path: "index.js", + source: INPUT, + }, + buildApi("tsx"), + {}, + ); + + assert.deepEqual( + actualOutput?.replace(/W/gm, ""), + OUTPUT.replace(/W/gm, ""), + ); + }); +}); diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/tsconfig.json b/packages/codemods/preact/X/default-import-to-namespace-mport/tsconfig.json new file mode 100644 index 000000000..e63ca9bdc --- /dev/null +++ b/packages/codemods/preact/X/default-import-to-namespace-mport/tsconfig.json @@ -0,0 +1,35 @@ +{ + "compilerOptions": { + "module": "NodeNext", + "target": "ESNext", + "moduleResolution": "NodeNext", + "lib": ["ESNext", "DOM"], + "skipLibCheck": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "isolatedModules": true, + "jsx": "react-jsx", + "useDefineForClassFields": true, + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "preserveWatchOutput": true, + "strict": true, + "strictNullChecks": true, + "incremental": true, + "noUncheckedIndexedAccess": true, + "noPropertyAccessFromIndexSignature": false, + "allowJs": true + }, + "include": [ + "./src/**/*.ts", + "./src/**/*.js", + "./test/**/*.ts", + "./test/**/*.js" + ], + "exclude": ["node_modules", "./dist/**/*"], + "ts-node": { + "transpileOnly": true + } +} diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/vitest.config.ts b/packages/codemods/preact/X/default-import-to-namespace-mport/vitest.config.ts new file mode 100644 index 000000000..772ad4c3b --- /dev/null +++ b/packages/codemods/preact/X/default-import-to-namespace-mport/vitest.config.ts @@ -0,0 +1,7 @@ +import { configDefaults, defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + include: [...configDefaults.include, "**/test/*.ts"], + }, +}); diff --git a/packages/codemods/preact/X/import-source-update/.codemodrc.json b/packages/codemods/preact/X/import-source-update/.codemodrc.json new file mode 100644 index 000000000..206e686d5 --- /dev/null +++ b/packages/codemods/preact/X/import-source-update/.codemodrc.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json", + "name": "preact/X/preact-import-source-update", + "version": "1.0.0", + "engine": "jscodeshift", + "private": false, + "arguments": [], + "meta": { + "tags": ["preact", "X", "migration"], + "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/preact/X/import-source-update" + }, + "applicability": { + "from": [["preact", "<", "8.x"]] + } +} diff --git a/packages/codemods/preact/X/import-source-update/.gitignore b/packages/codemods/preact/X/import-source-update/.gitignore new file mode 100644 index 000000000..76add878f --- /dev/null +++ b/packages/codemods/preact/X/import-source-update/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/packages/codemods/preact/X/import-source-update/LICENSE b/packages/codemods/preact/X/import-source-update/LICENSE new file mode 100644 index 000000000..335a784ea --- /dev/null +++ b/packages/codemods/preact/X/import-source-update/LICENSE @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2024 manishjha-04 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/codemods/preact/X/import-source-update/README.md b/packages/codemods/preact/X/import-source-update/README.md new file mode 100644 index 000000000..e0310db3e --- /dev/null +++ b/packages/codemods/preact/X/import-source-update/README.md @@ -0,0 +1,23 @@ +A codemod that updates imports from Preact to React equivalents and modifies certain Preact imports for compatibility. + +**Detailed description:** +This codemod refactors imports in your codebase to align with React or modern Preact practices. It changes `preact-redux` imports to `react-redux`, updates `mobx-preact` to `mobx-react`, and ensures that Preact compatibility imports are correctly handled by switching to `preact/compat`. + +## Example + +### Before + +```ts +import { Provider } from 'preact-redux'; +import { observer } from 'mobx-preact'; +import { render } from 'preact-compat'; +``` + +### After + +```ts +import { Provider } from 'react-redux'; +import { observer } from 'mobx-react'; +import { createPortal } from 'preact/compat'; +import { render } from 'preact/compat'; +``` \ No newline at end of file diff --git a/packages/codemods/preact/X/import-source-update/__testfixtures__/fixture1.input.ts b/packages/codemods/preact/X/import-source-update/__testfixtures__/fixture1.input.ts new file mode 100644 index 000000000..a11f686f7 --- /dev/null +++ b/packages/codemods/preact/X/import-source-update/__testfixtures__/fixture1.input.ts @@ -0,0 +1,3 @@ +import { Provider } from 'preact-redux'; +import { observer } from 'mobx-preact'; +import { render } from 'preact-compat'; \ No newline at end of file diff --git a/packages/codemods/preact/X/import-source-update/__testfixtures__/fixture1.output.ts b/packages/codemods/preact/X/import-source-update/__testfixtures__/fixture1.output.ts new file mode 100644 index 000000000..ccb49a746 --- /dev/null +++ b/packages/codemods/preact/X/import-source-update/__testfixtures__/fixture1.output.ts @@ -0,0 +1,4 @@ +import { Provider } from 'react-redux'; +import { observer } from 'mobx-react'; +import { createPortal } from 'preact/compat'; +import { render } from 'preact/compat'; \ No newline at end of file diff --git a/packages/codemods/preact/X/import-source-update/cdmd_dist/index.cjs b/packages/codemods/preact/X/import-source-update/cdmd_dist/index.cjs new file mode 100644 index 000000000..c9f89a758 --- /dev/null +++ b/packages/codemods/preact/X/import-source-update/cdmd_dist/index.cjs @@ -0,0 +1,36 @@ +/*! @license +The MIT License (MIT) + +Copyright (c) 2024 manishjha-04 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +Object.defineProperty(exports, "default", { + enumerable: true, + get: () => transform, +}); +function transform(fileInfo, api) { + const j = api.jscodeshift; + return j(fileInfo.source) + .find(j.ImportDeclaration) + .forEach((path) => { + const importSource = path.node.source.value; + if (importSource === "preact-compat") { + path.node.source.value = "preact/compat"; + } + if (importSource === "preact-redux") { + path.node.source.value = "react-redux"; + } + if (importSource === "mobx-preact") { + path.node.source.value = "mobx-react"; + } + }) + .toSource(); +} diff --git a/packages/codemods/preact/X/import-source-update/package.json b/packages/codemods/preact/X/import-source-update/package.json new file mode 100644 index 000000000..8c00a113e --- /dev/null +++ b/packages/codemods/preact/X/import-source-update/package.json @@ -0,0 +1,19 @@ +{ + "name": "preact-10-import-source-update", + "license": "MIT", + "devDependencies": { + "@types/node": "20.9.0", + "typescript": "^5.2.2", + "vitest": "^1.0.1", + "@codemod.com/codemod-utils": "*", + "jscodeshift": "^0.15.1", + "@types/jscodeshift": "^0.11.10" + }, + "scripts": { + "test": "vitest run", + "test:watch": "vitest watch" + }, + "files": ["README.md", ".codemodrc.json", "/dist/index.cjs"], + "type": "module", + "author": "manishjha-04" +} diff --git a/packages/codemods/preact/X/import-source-update/src/index.ts b/packages/codemods/preact/X/import-source-update/src/index.ts new file mode 100644 index 000000000..28a9092d6 --- /dev/null +++ b/packages/codemods/preact/X/import-source-update/src/index.ts @@ -0,0 +1,25 @@ +export default function transform(fileInfo, api) { + const j = api.jscodeshift; + + return j(fileInfo.source) + .find(j.ImportDeclaration) + .forEach((path) => { + const importSource = path.node.source.value; + + // Update imports from 'preact-compat' to 'preact/compat' + if (importSource === "preact-compat") { + path.node.source.value = "preact/compat"; + } + + // Update imports from 'preact-redux' to 'react-redux' + if (importSource === "preact-redux") { + path.node.source.value = "react-redux"; + } + + // Update imports from 'mobx-preact' to 'mobx-react' + if (importSource === "mobx-preact") { + path.node.source.value = "mobx-react"; + } + }) + .toSource(); +} diff --git a/packages/codemods/preact/X/import-source-update/test/test.ts b/packages/codemods/preact/X/import-source-update/test/test.ts new file mode 100644 index 000000000..7edd23933 --- /dev/null +++ b/packages/codemods/preact/X/import-source-update/test/test.ts @@ -0,0 +1,48 @@ +import assert from "node:assert"; +import { readFile } from "node:fs/promises"; +import { join } from "node:path"; +import jscodeshift, { type API } from "jscodeshift"; +import { describe, it } from "vitest"; +import transform from "../src/index.js"; + +const buildApi = (parser: string | undefined): API => ({ + j: parser ? jscodeshift.withParser(parser) : jscodeshift, + jscodeshift: parser ? jscodeshift.withParser(parser) : jscodeshift, + stats: () => { + console.error( + "The stats function was called, which is not supported on purpose", + ); + }, + report: () => { + console.error( + "The report function was called, which is not supported on purpose", + ); + }, +}); + +describe("preact/10/import-source-update", () => { + it("test #1", async () => { + const INPUT = await readFile( + join(__dirname, "..", "__testfixtures__/fixture1.input.ts"), + "utf-8", + ); + const OUTPUT = await readFile( + join(__dirname, "..", "__testfixtures__/fixture1.output.ts"), + "utf-8", + ); + + const actualOutput = transform( + { + path: "index.js", + source: INPUT, + }, + buildApi("tsx"), + {}, + ); + + assert.deepEqual( + actualOutput?.replace(/W/gm, ""), + OUTPUT.replace(/W/gm, ""), + ); + }); +}); diff --git a/packages/codemods/preact/X/import-source-update/tsconfig.json b/packages/codemods/preact/X/import-source-update/tsconfig.json new file mode 100644 index 000000000..e63ca9bdc --- /dev/null +++ b/packages/codemods/preact/X/import-source-update/tsconfig.json @@ -0,0 +1,35 @@ +{ + "compilerOptions": { + "module": "NodeNext", + "target": "ESNext", + "moduleResolution": "NodeNext", + "lib": ["ESNext", "DOM"], + "skipLibCheck": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "isolatedModules": true, + "jsx": "react-jsx", + "useDefineForClassFields": true, + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "preserveWatchOutput": true, + "strict": true, + "strictNullChecks": true, + "incremental": true, + "noUncheckedIndexedAccess": true, + "noPropertyAccessFromIndexSignature": false, + "allowJs": true + }, + "include": [ + "./src/**/*.ts", + "./src/**/*.js", + "./test/**/*.ts", + "./test/**/*.js" + ], + "exclude": ["node_modules", "./dist/**/*"], + "ts-node": { + "transpileOnly": true + } +} diff --git a/packages/codemods/preact/X/import-source-update/vitest.config.ts b/packages/codemods/preact/X/import-source-update/vitest.config.ts new file mode 100644 index 000000000..772ad4c3b --- /dev/null +++ b/packages/codemods/preact/X/import-source-update/vitest.config.ts @@ -0,0 +1,7 @@ +import { configDefaults, defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + include: [...configDefaults.include, "**/test/*.ts"], + }, +}); diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/.codemodrc.json b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/.codemodrc.json new file mode 100644 index 000000000..e056f694b --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/.codemodrc.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json", + "name": "preact/X/libraryAuthors-attribute-node-children-renaming", + "version": "1.0.0", + "engine": "jscodeshift", + "private": false, + "arguments": [], + "meta": { + "tags": ["preact", "X", "migration"], + "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming" + }, + "applicability": { + "from": [["preact", "<", "8.x"]] + } +} diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/.gitignore b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/.gitignore new file mode 100644 index 000000000..76add878f --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/LICENSE b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/LICENSE new file mode 100644 index 000000000..335a784ea --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/LICENSE @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2024 manishjha-04 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/README.md b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/README.md new file mode 100644 index 000000000..f86fc339d --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/README.md @@ -0,0 +1,41 @@ + +This codemod is intended for library authors who are maintaining packages to be used with Preact X. + +**Detailed description:** +This codemod refactors JSX-like virtual node objects by replacing the outdated `nodeName` and `attributes` properties with the current `type` and `props` properties. This update aligns your code with modern Preact conventions, ensuring compatibility and improving code clarity. + + + +### Before + +```ts +const myVNode = { + nodeName: 'div', + attributes: { + id: 'example', + className: 'container', + }, + children: [{ + nodeName: 'span', + attributes: { className: 'text' }, + children: ['Hello, World!'], + }, ], +}; +``` + +### After + +```ts +const myVNode = { + type: 'div', + props: { + id: 'example', + className: 'container', + }, + children: [{ + type: 'span', + props: { className: 'text' }, + children: ['Hello, World!'], + }, ], +}; +``` \ No newline at end of file diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture1.input.ts b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture1.input.ts new file mode 100644 index 000000000..73842448a --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture1.input.ts @@ -0,0 +1,12 @@ +const myVNode = { + nodeName: 'div', + attributes: { + id: 'example', + className: 'container', + }, + children: [{ + nodeName: 'span', + attributes: { className: 'text' }, + children: ['Hello, World!'], + }, ], +}; \ No newline at end of file diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture1.output.ts b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture1.output.ts new file mode 100644 index 000000000..9e851f139 --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture1.output.ts @@ -0,0 +1,12 @@ +const myVNode = { + type: 'div', + props: { + id: 'example', + className: 'container', + }, + children: [{ + type: 'span', + props: { className: 'text' }, + children: ['Hello, World!'], + }, ], +}; \ No newline at end of file diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.input.ts b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.input.ts new file mode 100644 index 000000000..7eb02b36b --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.input.ts @@ -0,0 +1,18 @@ +class HTTPError extends Error {} + +const response = await fetch('https://example.com', { + method: 'POST', + body: JSON.stringify({ foo: true }), + headers: { + 'content-type': 'application/json', + }, +}); + +if (!response.ok) { + throw new HTTPError(`Fetch error: ${response.statusText}`); +} + +const json = await response.json(); + +console.log(json); +//=> `{data: 'πŸ¦„'}` \ No newline at end of file diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.output.ts b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.output.ts new file mode 100644 index 000000000..e3faf4d0b --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.output.ts @@ -0,0 +1,11 @@ +import ky from 'ky'; +class HTTPError extends Error {} + +const response = await ky.post('https://example.com', { + json: { foo: true }, +}); + +const json = await response.json(); + +console.log(json); +//=> `{data: 'πŸ¦„'}` \ No newline at end of file diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/cdmd_dist/index.cjs b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/cdmd_dist/index.cjs new file mode 100644 index 000000000..11d0ba453 --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/cdmd_dist/index.cjs @@ -0,0 +1,53 @@ +/*! @license +The MIT License (MIT) + +Copyright (c) 2024 manishjha-04 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +Object.defineProperty(exports, "default", { + enumerable: true, + get: () => transform, +}); +function transform(fileInfo, api) { + const j = api.jscodeshift; + const root = j(fileInfo.source); + root + .find(j.Identifier, { name: "attributes" }) + .replaceWith(j.identifier("props")); + root + .find(j.Identifier, { name: "nodeName" }) + .replaceWith(j.identifier("type")); + root.find(j.Property, { key: { name: "children" } }).forEach((path) => { + const parent = path.parentPath.value; + if (parent.type === "ObjectExpression" && parent.properties) { + const propsProperty = parent.properties.find( + (prop) => prop.key.name === "props", + ); + if (propsProperty) { + propsProperty.value.properties.push( + j.property("init", j.identifier("children"), path.value.value), + ); + j(path).remove(); + } else { + j(path).replaceWith( + j.property( + "init", + j.identifier("props"), + j.objectExpression([ + j.property("init", j.identifier("children"), path.value.value), + ]), + ), + ); + } + } + }); + return root.toSource(); +} diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/package.json b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/package.json new file mode 100644 index 000000000..42be1afc4 --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/package.json @@ -0,0 +1,19 @@ +{ + "name": "preact-to-react-attribute-node-children-renaming", + "license": "MIT", + "devDependencies": { + "@types/node": "20.9.0", + "typescript": "^5.2.2", + "vitest": "^1.0.1", + "@codemod.com/codemod-utils": "*", + "jscodeshift": "^0.15.1", + "@types/jscodeshift": "^0.11.10" + }, + "scripts": { + "test": "vitest run", + "test:watch": "vitest watch" + }, + "files": ["README.md", ".codemodrc.json", "/dist/index.cjs"], + "type": "module", + "author": "manishjha-04" +} diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/src/index.ts b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/src/index.ts new file mode 100644 index 000000000..6fab74200 --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/src/index.ts @@ -0,0 +1,47 @@ +export default function transform(fileInfo, api) { + const j = api.jscodeshift; + const root = j(fileInfo.source); + + // Rename `attributes` to `props` + root + .find(j.Identifier, { name: "attributes" }) + .replaceWith(j.identifier("props")); + + // Rename `nodeName` to `type` + root + .find(j.Identifier, { name: "nodeName" }) + .replaceWith(j.identifier("type")); + + // Move `children` inside `props` if it’s outside + root.find(j.Property, { key: { name: "children" } }).forEach((path) => { + const parent = path.parentPath.value; + + if (parent.type === "ObjectExpression" && parent.properties) { + const propsProperty = parent.properties.find( + (prop) => prop.key.name === "props", + ); + + if (propsProperty) { + // Add children to props + propsProperty.value.properties.push( + j.property("init", j.identifier("children"), path.value.value), + ); + // Remove original children property + j(path).remove(); + } else { + // If props does not exist, wrap children in a props object + j(path).replaceWith( + j.property( + "init", + j.identifier("props"), + j.objectExpression([ + j.property("init", j.identifier("children"), path.value.value), + ]), + ), + ); + } + } + }); + + return root.toSource(); +} diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/test/test.ts b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/test/test.ts new file mode 100644 index 000000000..fec5921fc --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/test/test.ts @@ -0,0 +1,73 @@ +import assert from "node:assert"; +import { readFile } from "node:fs/promises"; +import { join } from "node:path"; +import jscodeshift, { type API } from "jscodeshift"; +import { describe, it } from "vitest"; +import transform from "../src/index.js"; + +const buildApi = (parser: string | undefined): API => ({ + j: parser ? jscodeshift.withParser(parser) : jscodeshift, + jscodeshift: parser ? jscodeshift.withParser(parser) : jscodeshift, + stats: () => { + console.error( + "The stats function was called, which is not supported on purpose", + ); + }, + report: () => { + console.error( + "The report function was called, which is not supported on purpose", + ); + }, +}); + +describe("preact-to-react/attribute-node-children-renaming", () => { + it("test #1", async () => { + const INPUT = await readFile( + join(__dirname, "..", "__testfixtures__/fixture1.input.ts"), + "utf-8", + ); + const OUTPUT = await readFile( + join(__dirname, "..", "__testfixtures__/fixture1.output.ts"), + "utf-8", + ); + + const actualOutput = transform( + { + path: "index.js", + source: INPUT, + }, + buildApi("tsx"), + {}, + ); + + assert.deepEqual( + actualOutput?.replace(/W/gm, ""), + OUTPUT.replace(/W/gm, ""), + ); + }); + + it("test #2", async () => { + const INPUT = await readFile( + join(__dirname, "..", "__testfixtures__/fixture2.input.ts"), + "utf-8", + ); + const OUTPUT = await readFile( + join(__dirname, "..", "__testfixtures__/fixture2.output.ts"), + "utf-8", + ); + + const actualOutput = transform( + { + path: "index.js", + source: INPUT, + }, + buildApi("tsx"), + {}, + ); + + assert.deepEqual( + actualOutput?.replace(/W/gm, ""), + OUTPUT.replace(/W/gm, ""), + ); + }); +}); diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/tsconfig.json b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/tsconfig.json new file mode 100644 index 000000000..e63ca9bdc --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/tsconfig.json @@ -0,0 +1,35 @@ +{ + "compilerOptions": { + "module": "NodeNext", + "target": "ESNext", + "moduleResolution": "NodeNext", + "lib": ["ESNext", "DOM"], + "skipLibCheck": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "isolatedModules": true, + "jsx": "react-jsx", + "useDefineForClassFields": true, + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "preserveWatchOutput": true, + "strict": true, + "strictNullChecks": true, + "incremental": true, + "noUncheckedIndexedAccess": true, + "noPropertyAccessFromIndexSignature": false, + "allowJs": true + }, + "include": [ + "./src/**/*.ts", + "./src/**/*.js", + "./test/**/*.ts", + "./test/**/*.js" + ], + "exclude": ["node_modules", "./dist/**/*"], + "ts-node": { + "transpileOnly": true + } +} diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/vitest.config.ts b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/vitest.config.ts new file mode 100644 index 000000000..772ad4c3b --- /dev/null +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/vitest.config.ts @@ -0,0 +1,7 @@ +import { configDefaults, defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + include: [...configDefaults.include, "**/test/*.ts"], + }, +}); diff --git a/packages/codemods/preact/X/props-children-to-child-array/.codemodrc.json b/packages/codemods/preact/X/props-children-to-child-array/.codemodrc.json new file mode 100644 index 000000000..2e23a282f --- /dev/null +++ b/packages/codemods/preact/X/props-children-to-child-array/.codemodrc.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json", + "name": "preact/X/props-children-to-child-array", + "version": "1.0.0", + "engine": "jscodeshift", + "private": false, + "arguments": [], + "meta": { + "tags": ["preact", "X", "migration"], + "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/preact/X/props-children-to-child-array" + }, + "applicability": { + "from": [["preact", "<", "8.x"]] + } +} diff --git a/packages/codemods/preact/X/props-children-to-child-array/.gitignore b/packages/codemods/preact/X/props-children-to-child-array/.gitignore new file mode 100644 index 000000000..76add878f --- /dev/null +++ b/packages/codemods/preact/X/props-children-to-child-array/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/packages/codemods/preact/X/props-children-to-child-array/LICENSE b/packages/codemods/preact/X/props-children-to-child-array/LICENSE new file mode 100644 index 000000000..335a784ea --- /dev/null +++ b/packages/codemods/preact/X/props-children-to-child-array/LICENSE @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2024 manishjha-04 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/codemods/preact/X/props-children-to-child-array/README.md b/packages/codemods/preact/X/props-children-to-child-array/README.md new file mode 100644 index 000000000..4004280d7 --- /dev/null +++ b/packages/codemods/preact/X/props-children-to-child-array/README.md @@ -0,0 +1,26 @@ +A codemod that enhances child handling in Preact components by using `toChildArray` for accurate child count. + +**Detailed description:** +This codemod refactors Preact components to improve the handling of `props.children`. It introduces the `toChildArray` utility from Preact, ensuring that child elements are accurately counted, especially when dealing with fragments or nested arrays. This leads to more robust and predictable behavior in your components. + +## Example + +### Before + +```ts +function Foo(props) { + const count = props.children.length; + return < div > I have { count } children < /div>; +} +``` + +### After + +```ts +import { toChildArray } from 'preact'; + +function Foo(props) { + const count = toChildArray(props.children).length; + return < div > I have { count } children < /div>; +} +``` \ No newline at end of file diff --git a/packages/codemods/preact/X/props-children-to-child-array/__testfixtures__/fixture1.input.ts b/packages/codemods/preact/X/props-children-to-child-array/__testfixtures__/fixture1.input.ts new file mode 100644 index 000000000..15644e283 --- /dev/null +++ b/packages/codemods/preact/X/props-children-to-child-array/__testfixtures__/fixture1.input.ts @@ -0,0 +1,4 @@ +function Foo(props) { + const count = props.children.length; + return < div > I have { count } children < /div>; +} \ No newline at end of file diff --git a/packages/codemods/preact/X/props-children-to-child-array/__testfixtures__/fixture1.output.ts b/packages/codemods/preact/X/props-children-to-child-array/__testfixtures__/fixture1.output.ts new file mode 100644 index 000000000..4d91aa51e --- /dev/null +++ b/packages/codemods/preact/X/props-children-to-child-array/__testfixtures__/fixture1.output.ts @@ -0,0 +1,6 @@ +import { toChildArray } from 'preact'; + +function Foo(props) { + const count = toChildArray(props.children).length; + return < div > I have { count } children < /div>; +} \ No newline at end of file diff --git a/packages/codemods/preact/X/props-children-to-child-array/cdmd_dist/index.cjs b/packages/codemods/preact/X/props-children-to-child-array/cdmd_dist/index.cjs new file mode 100644 index 000000000..3ababc0b1 --- /dev/null +++ b/packages/codemods/preact/X/props-children-to-child-array/cdmd_dist/index.cjs @@ -0,0 +1,84 @@ +/*! @license +The MIT License (MIT) + +Copyright (c) 2024 manishjha-04 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +Object.defineProperty(exports, "default", { + enumerable: true, + get: () => transformer, +}); +function transformer(fileInfo, api) { + const j = api.jscodeshift; + const root = j(fileInfo.source); + const propsChildrenUsage = root.find(j.MemberExpression, { + object: { + type: "MemberExpression", + object: { type: "Identifier", name: "props" }, + property: { type: "Identifier", name: "children" }, + }, + }); + if (propsChildrenUsage.size() > 0) { + const preactImport = root.find(j.ImportDeclaration, { + source: { value: "preact" }, + }); + if (preactImport.size() === 0) { + root + .get() + .node.program.body.unshift( + j.importDeclaration( + [j.importSpecifier(j.identifier("toChildArray"))], + j.literal("preact"), + ), + ); + } else { + preactImport.forEach((path) => { + const hasToChildArray = path.node.specifiers.some( + (specifier) => + specifier.imported && specifier.imported.name === "toChildArray", + ); + if (!hasToChildArray) { + path.node.specifiers.push( + j.importSpecifier(j.identifier("toChildArray")), + ); + } + }); + } + root + .find(j.MemberExpression, { + object: { + type: "MemberExpression", + object: { type: "Identifier", name: "props" }, + property: { type: "Identifier", name: "children" }, + }, + property: { type: "Identifier", name: "length" }, + }) + .forEach((path) => { + j(path).replaceWith( + j.memberExpression( + j.callExpression(j.identifier("toChildArray"), [ + j.memberExpression( + j.identifier("props"), + j.identifier("children"), + ), + ]), + j.identifier("length"), + ), + ); + }); + preactImport.forEach((path) => { + path.node.specifiers = [ + j.importNamespaceSpecifier(j.identifier("preact")), + ]; + }); + } + return root.toSource(); +} diff --git a/packages/codemods/preact/X/props-children-to-child-array/package.json b/packages/codemods/preact/X/props-children-to-child-array/package.json new file mode 100644 index 000000000..912e89c77 --- /dev/null +++ b/packages/codemods/preact/X/props-children-to-child-array/package.json @@ -0,0 +1,19 @@ +{ + "name": "preact-10-props-children-to-child-array", + "license": "MIT", + "devDependencies": { + "@types/node": "20.9.0", + "typescript": "^5.2.2", + "vitest": "^1.0.1", + "@codemod.com/codemod-utils": "*", + "jscodeshift": "^0.15.1", + "@types/jscodeshift": "^0.11.10" + }, + "scripts": { + "test": "vitest run", + "test:watch": "vitest watch" + }, + "files": ["README.md", ".codemodrc.json", "/dist/index.cjs"], + "type": "module", + "author": "manishjha-04" +} diff --git a/packages/codemods/preact/X/props-children-to-child-array/src/index.ts b/packages/codemods/preact/X/props-children-to-child-array/src/index.ts new file mode 100644 index 000000000..1a9072db7 --- /dev/null +++ b/packages/codemods/preact/X/props-children-to-child-array/src/index.ts @@ -0,0 +1,75 @@ +export default function transformer(fileInfo, api) { + const j = api.jscodeshift; + const root = j(fileInfo.source); + // Check if `props.children` is used in the code + const propsChildrenUsage = root.find(j.MemberExpression, { + object: { + type: "MemberExpression", + object: { type: "Identifier", name: "props" }, + property: { type: "Identifier", name: "children" }, + }, + }); + // Add import for `toChildArray` from 'preact' if it doesn't exist + if (propsChildrenUsage.size() > 0) { + // Add import for `toChildArray` from 'preact' if it doesn't exist + const preactImport = root.find(j.ImportDeclaration, { + source: { value: "preact" }, + }); + + if (preactImport.size() === 0) { + root + .get() + .node.program.body.unshift( + j.importDeclaration( + [j.importSpecifier(j.identifier("toChildArray"))], + j.literal("preact"), + ), + ); + } else { + preactImport.forEach((path) => { + const hasToChildArray = path.node.specifiers.some( + (specifier) => + specifier.imported && specifier.imported.name === "toChildArray", + ); + if (!hasToChildArray) { + path.node.specifiers.push( + j.importSpecifier(j.identifier("toChildArray")), + ); + } + }); + } + + // Replace `props.children.length` with `toChildArray(props.children).length` + root + .find(j.MemberExpression, { + object: { + type: "MemberExpression", + object: { type: "Identifier", name: "props" }, + property: { type: "Identifier", name: "children" }, + }, + property: { type: "Identifier", name: "length" }, + }) + .forEach((path) => { + j(path).replaceWith( + j.memberExpression( + j.callExpression(j.identifier("toChildArray"), [ + j.memberExpression( + j.identifier("props"), + j.identifier("children"), + ), + ]), + j.identifier("length"), + ), + ); + }); + + // Ensure the import statement for `preact` is correctly transformed to `import * as preact from 'preact';` + preactImport.forEach((path) => { + path.node.specifiers = [ + j.importNamespaceSpecifier(j.identifier("preact")), + ]; + }); + } + + return root.toSource(); +} diff --git a/packages/codemods/preact/X/props-children-to-child-array/test/test.ts b/packages/codemods/preact/X/props-children-to-child-array/test/test.ts new file mode 100644 index 000000000..84f3fe0bf --- /dev/null +++ b/packages/codemods/preact/X/props-children-to-child-array/test/test.ts @@ -0,0 +1,48 @@ +import assert from "node:assert"; +import { readFile } from "node:fs/promises"; +import { join } from "node:path"; +import jscodeshift, { type API } from "jscodeshift"; +import { describe, it } from "vitest"; +import transform from "../src/index.js"; + +const buildApi = (parser: string | undefined): API => ({ + j: parser ? jscodeshift.withParser(parser) : jscodeshift, + jscodeshift: parser ? jscodeshift.withParser(parser) : jscodeshift, + stats: () => { + console.error( + "The stats function was called, which is not supported on purpose", + ); + }, + report: () => { + console.error( + "The report function was called, which is not supported on purpose", + ); + }, +}); + +describe("preact/10/props-children-to-child-array", () => { + it("test #1", async () => { + const INPUT = await readFile( + join(__dirname, "..", "__testfixtures__/fixture1.input.ts"), + "utf-8", + ); + const OUTPUT = await readFile( + join(__dirname, "..", "__testfixtures__/fixture1.output.ts"), + "utf-8", + ); + + const actualOutput = transform( + { + path: "index.js", + source: INPUT, + }, + buildApi("tsx"), + {}, + ); + + assert.deepEqual( + actualOutput?.replace(/W/gm, ""), + OUTPUT.replace(/W/gm, ""), + ); + }); +}); diff --git a/packages/codemods/preact/X/props-children-to-child-array/tsconfig.json b/packages/codemods/preact/X/props-children-to-child-array/tsconfig.json new file mode 100644 index 000000000..e63ca9bdc --- /dev/null +++ b/packages/codemods/preact/X/props-children-to-child-array/tsconfig.json @@ -0,0 +1,35 @@ +{ + "compilerOptions": { + "module": "NodeNext", + "target": "ESNext", + "moduleResolution": "NodeNext", + "lib": ["ESNext", "DOM"], + "skipLibCheck": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "isolatedModules": true, + "jsx": "react-jsx", + "useDefineForClassFields": true, + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "preserveWatchOutput": true, + "strict": true, + "strictNullChecks": true, + "incremental": true, + "noUncheckedIndexedAccess": true, + "noPropertyAccessFromIndexSignature": false, + "allowJs": true + }, + "include": [ + "./src/**/*.ts", + "./src/**/*.js", + "./test/**/*.ts", + "./test/**/*.js" + ], + "exclude": ["node_modules", "./dist/**/*"], + "ts-node": { + "transpileOnly": true + } +} diff --git a/packages/codemods/preact/X/props-children-to-child-array/vitest.config.ts b/packages/codemods/preact/X/props-children-to-child-array/vitest.config.ts new file mode 100644 index 000000000..772ad4c3b --- /dev/null +++ b/packages/codemods/preact/X/props-children-to-child-array/vitest.config.ts @@ -0,0 +1,7 @@ +import { configDefaults, defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + include: [...configDefaults.include, "**/test/*.ts"], + }, +}); diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/.codemodrc.json b/packages/codemods/preact/X/replace-this-state-with-prevstate/.codemodrc.json new file mode 100644 index 000000000..0dc426b2a --- /dev/null +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/.codemodrc.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json", + "name": "preact/X/replace-this-state-with-prevstate", + "version": "1.0.0", + "engine": "jscodeshift", + "private": false, + "arguments": [], + "meta": { + "tags": ["preact", "X", "migration"], + "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/preact/X/replace-this-state-with-prevstate" + }, + "applicability": { + "from": [["preact", "<", "8.x"]] + } +} diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/.gitignore b/packages/codemods/preact/X/replace-this-state-with-prevstate/.gitignore new file mode 100644 index 000000000..76add878f --- /dev/null +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/LICENSE b/packages/codemods/preact/X/replace-this-state-with-prevstate/LICENSE new file mode 100644 index 000000000..335a784ea --- /dev/null +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/LICENSE @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2024 manishjha-04 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/README.md b/packages/codemods/preact/X/replace-this-state-with-prevstate/README.md new file mode 100644 index 000000000..b2ebd7371 --- /dev/null +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/README.md @@ -0,0 +1,20 @@ +A codemod that prevents synchronous state access in Preact by converting `setState` to use a callback function. + +**Detailed description:** +In Preact X, state updates are no longer applied synchronously, meaning that accessing `this.state` immediately after calling `setState` may return outdated values. This codemod refactors your code to use the functional form of `setState`, ensuring that state updates correctly depend on the previous state, preventing potential bugs and ensuring compatibility with Preact X. + +## Example + +### Before + +```ts +this.setState({ counter: this.state.counter + 1 }); +``` + +### After + +```ts +this.setState((prevState) => { + return { counter: prevState.counter + 1 }; +}); +``` \ No newline at end of file diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/__testfixtures__/fixture1.input.ts b/packages/codemods/preact/X/replace-this-state-with-prevstate/__testfixtures__/fixture1.input.ts new file mode 100644 index 000000000..114ca26e9 --- /dev/null +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/__testfixtures__/fixture1.input.ts @@ -0,0 +1 @@ +this.setState({ counter: this.state.counter + 1 }); \ No newline at end of file diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/__testfixtures__/fixture1.output.ts b/packages/codemods/preact/X/replace-this-state-with-prevstate/__testfixtures__/fixture1.output.ts new file mode 100644 index 000000000..e92324ff7 --- /dev/null +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/__testfixtures__/fixture1.output.ts @@ -0,0 +1,3 @@ +this.setState((prevState) => { + return { counter: prevState.counter + 1 }; +}); \ No newline at end of file diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/cdmd_dist/index.cjs b/packages/codemods/preact/X/replace-this-state-with-prevstate/cdmd_dist/index.cjs new file mode 100644 index 000000000..fe5ecf3b7 --- /dev/null +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/cdmd_dist/index.cjs @@ -0,0 +1,49 @@ +/*! @license +The MIT License (MIT) + +Copyright (c) 2024 manishjha-04 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +Object.defineProperty(exports, "default", { + enumerable: true, + get: () => transform, +}); +function transform(file, api) { + const j = api.jscodeshift; + const root = j(file.source); + let dirtyFlag = false; + root + .find(j.CallExpression, { + callee: { + object: { type: "ThisExpression" }, + property: { name: "setState" }, + }, + }) + .forEach((path) => { + const args = path.node.arguments; + if (args.length === 1 && j.ObjectExpression.check(args[0])) { + const objectExpression = args[0]; + j(objectExpression) + .find(j.MemberExpression, { + object: { type: "ThisExpression" }, + property: { name: "state" }, + }) + .replaceWith(() => j.identifier("prevState")); + const arrowFunction = j.arrowFunctionExpression( + [j.identifier("prevState")], + j.blockStatement([j.returnStatement(objectExpression)]), + ); + path.node.arguments = [arrowFunction]; + dirtyFlag = true; + } + }); + return dirtyFlag ? root.toSource() : undefined; +} diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/package.json b/packages/codemods/preact/X/replace-this-state-with-prevstate/package.json new file mode 100644 index 000000000..9e773f1ac --- /dev/null +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/package.json @@ -0,0 +1,19 @@ +{ + "name": "react-16-replace-this-state-with-prevstate", + "license": "MIT", + "devDependencies": { + "@types/node": "20.9.0", + "typescript": "^5.2.2", + "vitest": "^1.0.1", + "@codemod.com/codemod-utils": "*", + "jscodeshift": "^0.15.1", + "@types/jscodeshift": "^0.11.10" + }, + "scripts": { + "test": "vitest run", + "test:watch": "vitest watch" + }, + "files": ["README.md", ".codemodrc.json", "/dist/index.cjs"], + "type": "module", + "author": "manishjha-04" +} diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/src/index.ts b/packages/codemods/preact/X/replace-this-state-with-prevstate/src/index.ts new file mode 100644 index 000000000..5c6d93b5e --- /dev/null +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/src/index.ts @@ -0,0 +1,42 @@ +export default function transform(file, api) { + const j = api.jscodeshift; + const root = j(file.source); + let dirtyFlag = false; + + // Find all `this.setState` calls + root + .find(j.CallExpression, { + callee: { + object: { type: "ThisExpression" }, + property: { name: "setState" }, + }, + }) + .forEach((path) => { + const args = path.node.arguments; + + // Ensure the argument is an object expression + if (args.length === 1 && j.ObjectExpression.check(args[0])) { + const objectExpression = args[0]; + + // Replace `this.state` with `prevState` inside the object expression + j(objectExpression) + .find(j.MemberExpression, { + object: { type: "ThisExpression" }, + property: { name: "state" }, + }) + .replaceWith(() => j.identifier("prevState")); + + // Create the new arrow function expression + const arrowFunction = j.arrowFunctionExpression( + [j.identifier("prevState")], + j.blockStatement([j.returnStatement(objectExpression)]), + ); + + // Replace the argument with the new arrow function + path.node.arguments = [arrowFunction]; + dirtyFlag = true; + } + }); + + return dirtyFlag ? root.toSource() : undefined; +} diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/test/test.ts b/packages/codemods/preact/X/replace-this-state-with-prevstate/test/test.ts new file mode 100644 index 000000000..a8ff6868c --- /dev/null +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/test/test.ts @@ -0,0 +1,48 @@ +import assert from "node:assert"; +import { readFile } from "node:fs/promises"; +import { join } from "node:path"; +import jscodeshift, { type API } from "jscodeshift"; +import { describe, it } from "vitest"; +import transform from "../src/index.js"; + +const buildApi = (parser: string | undefined): API => ({ + j: parser ? jscodeshift.withParser(parser) : jscodeshift, + jscodeshift: parser ? jscodeshift.withParser(parser) : jscodeshift, + stats: () => { + console.error( + "The stats function was called, which is not supported on purpose", + ); + }, + report: () => { + console.error( + "The report function was called, which is not supported on purpose", + ); + }, +}); + +describe("react/16/replace-this-state-with-prevstate", () => { + it("test #1", async () => { + const INPUT = await readFile( + join(__dirname, "..", "__testfixtures__/fixture1.input.ts"), + "utf-8", + ); + const OUTPUT = await readFile( + join(__dirname, "..", "__testfixtures__/fixture1.output.ts"), + "utf-8", + ); + + const actualOutput = transform( + { + path: "index.js", + source: INPUT, + }, + buildApi("tsx"), + {}, + ); + + assert.deepEqual( + actualOutput?.replace(/W/gm, ""), + OUTPUT.replace(/W/gm, ""), + ); + }); +}); diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/tsconfig.json b/packages/codemods/preact/X/replace-this-state-with-prevstate/tsconfig.json new file mode 100644 index 000000000..e63ca9bdc --- /dev/null +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/tsconfig.json @@ -0,0 +1,35 @@ +{ + "compilerOptions": { + "module": "NodeNext", + "target": "ESNext", + "moduleResolution": "NodeNext", + "lib": ["ESNext", "DOM"], + "skipLibCheck": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "isolatedModules": true, + "jsx": "react-jsx", + "useDefineForClassFields": true, + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "preserveWatchOutput": true, + "strict": true, + "strictNullChecks": true, + "incremental": true, + "noUncheckedIndexedAccess": true, + "noPropertyAccessFromIndexSignature": false, + "allowJs": true + }, + "include": [ + "./src/**/*.ts", + "./src/**/*.js", + "./test/**/*.ts", + "./test/**/*.js" + ], + "exclude": ["node_modules", "./dist/**/*"], + "ts-node": { + "transpileOnly": true + } +} diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/vitest.config.ts b/packages/codemods/preact/X/replace-this-state-with-prevstate/vitest.config.ts new file mode 100644 index 000000000..772ad4c3b --- /dev/null +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/vitest.config.ts @@ -0,0 +1,7 @@ +import { configDefaults, defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + include: [...configDefaults.include, "**/test/*.ts"], + }, +}); From b2d9bbbf4995099e647579c92c7959f687dfe04c Mon Sep 17 00:00:00 2001 From: Manish Jha Date: Wed, 21 Aug 2024 16:18:33 +0530 Subject: [PATCH 2/5] linting fix --- .../.codemodrc.json | 2 +- .../.gitignore | 0 .../LICENSE | 0 .../README.md | 0 .../__testfixtures__/fixture1.input.ts | 0 .../__testfixtures__/fixture1.output.ts | 0 .../cdmd_dist/index.cjs | 0 .../package.json | 0 .../src/index.ts | 0 .../test/test.ts | 0 .../tsconfig.json | 0 .../vitest.config.ts | 0 pnpm-lock.yaml | 457 +++++++++++------- 13 files changed, 287 insertions(+), 172 deletions(-) rename packages/codemods/preact/X/{default-import-to-namespace-mport => default-import-to-namespace-import}/.codemodrc.json (91%) rename packages/codemods/preact/X/{default-import-to-namespace-mport => default-import-to-namespace-import}/.gitignore (100%) rename packages/codemods/preact/X/{default-import-to-namespace-mport => default-import-to-namespace-import}/LICENSE (100%) rename packages/codemods/preact/X/{default-import-to-namespace-mport => default-import-to-namespace-import}/README.md (100%) rename packages/codemods/preact/X/{default-import-to-namespace-mport => default-import-to-namespace-import}/__testfixtures__/fixture1.input.ts (100%) rename packages/codemods/preact/X/{default-import-to-namespace-mport => default-import-to-namespace-import}/__testfixtures__/fixture1.output.ts (100%) rename packages/codemods/preact/X/{default-import-to-namespace-mport => default-import-to-namespace-import}/cdmd_dist/index.cjs (100%) rename packages/codemods/preact/X/{default-import-to-namespace-mport => default-import-to-namespace-import}/package.json (100%) rename packages/codemods/preact/X/{default-import-to-namespace-mport => default-import-to-namespace-import}/src/index.ts (100%) rename packages/codemods/preact/X/{default-import-to-namespace-mport => default-import-to-namespace-import}/test/test.ts (100%) rename packages/codemods/preact/X/{default-import-to-namespace-mport => default-import-to-namespace-import}/tsconfig.json (100%) rename packages/codemods/preact/X/{default-import-to-namespace-mport => default-import-to-namespace-import}/vitest.config.ts (100%) diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/.codemodrc.json b/packages/codemods/preact/X/default-import-to-namespace-import/.codemodrc.json similarity index 91% rename from packages/codemods/preact/X/default-import-to-namespace-mport/.codemodrc.json rename to packages/codemods/preact/X/default-import-to-namespace-import/.codemodrc.json index 753e19a11..098c660ec 100644 --- a/packages/codemods/preact/X/default-import-to-namespace-mport/.codemodrc.json +++ b/packages/codemods/preact/X/default-import-to-namespace-import/.codemodrc.json @@ -6,7 +6,7 @@ "private": false, "arguments": [], "meta": { - "tags": ["preact", "X", "migration"], + "tags": ["preact", "migration"], "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/preact/X/default-import-to-namespace-import" }, "applicability": { diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/.gitignore b/packages/codemods/preact/X/default-import-to-namespace-import/.gitignore similarity index 100% rename from packages/codemods/preact/X/default-import-to-namespace-mport/.gitignore rename to packages/codemods/preact/X/default-import-to-namespace-import/.gitignore diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/LICENSE b/packages/codemods/preact/X/default-import-to-namespace-import/LICENSE similarity index 100% rename from packages/codemods/preact/X/default-import-to-namespace-mport/LICENSE rename to packages/codemods/preact/X/default-import-to-namespace-import/LICENSE diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/README.md b/packages/codemods/preact/X/default-import-to-namespace-import/README.md similarity index 100% rename from packages/codemods/preact/X/default-import-to-namespace-mport/README.md rename to packages/codemods/preact/X/default-import-to-namespace-import/README.md diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/__testfixtures__/fixture1.input.ts b/packages/codemods/preact/X/default-import-to-namespace-import/__testfixtures__/fixture1.input.ts similarity index 100% rename from packages/codemods/preact/X/default-import-to-namespace-mport/__testfixtures__/fixture1.input.ts rename to packages/codemods/preact/X/default-import-to-namespace-import/__testfixtures__/fixture1.input.ts diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/__testfixtures__/fixture1.output.ts b/packages/codemods/preact/X/default-import-to-namespace-import/__testfixtures__/fixture1.output.ts similarity index 100% rename from packages/codemods/preact/X/default-import-to-namespace-mport/__testfixtures__/fixture1.output.ts rename to packages/codemods/preact/X/default-import-to-namespace-import/__testfixtures__/fixture1.output.ts diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/cdmd_dist/index.cjs b/packages/codemods/preact/X/default-import-to-namespace-import/cdmd_dist/index.cjs similarity index 100% rename from packages/codemods/preact/X/default-import-to-namespace-mport/cdmd_dist/index.cjs rename to packages/codemods/preact/X/default-import-to-namespace-import/cdmd_dist/index.cjs diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/package.json b/packages/codemods/preact/X/default-import-to-namespace-import/package.json similarity index 100% rename from packages/codemods/preact/X/default-import-to-namespace-mport/package.json rename to packages/codemods/preact/X/default-import-to-namespace-import/package.json diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/src/index.ts b/packages/codemods/preact/X/default-import-to-namespace-import/src/index.ts similarity index 100% rename from packages/codemods/preact/X/default-import-to-namespace-mport/src/index.ts rename to packages/codemods/preact/X/default-import-to-namespace-import/src/index.ts diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/test/test.ts b/packages/codemods/preact/X/default-import-to-namespace-import/test/test.ts similarity index 100% rename from packages/codemods/preact/X/default-import-to-namespace-mport/test/test.ts rename to packages/codemods/preact/X/default-import-to-namespace-import/test/test.ts diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/tsconfig.json b/packages/codemods/preact/X/default-import-to-namespace-import/tsconfig.json similarity index 100% rename from packages/codemods/preact/X/default-import-to-namespace-mport/tsconfig.json rename to packages/codemods/preact/X/default-import-to-namespace-import/tsconfig.json diff --git a/packages/codemods/preact/X/default-import-to-namespace-mport/vitest.config.ts b/packages/codemods/preact/X/default-import-to-namespace-import/vitest.config.ts similarity index 100% rename from packages/codemods/preact/X/default-import-to-namespace-mport/vitest.config.ts rename to packages/codemods/preact/X/default-import-to-namespace-import/vitest.config.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 734689b55..c70dfb11e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1038,7 +1038,7 @@ importers: version: 5.4.1 langchain: specifier: 'catalog:' - version: 0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) + version: 0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) openai: specifier: 'catalog:' version: 4.23.0 @@ -1466,7 +1466,7 @@ importers: version: 1.15.1 jscodeshift: specifier: ^0.15.0 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) jszip: specifier: 'catalog:' version: 3.10.1 @@ -2200,7 +2200,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2225,7 +2225,7 @@ importers: version: 0.11.11 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2247,7 +2247,7 @@ importers: version: 0.11.11 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2269,7 +2269,7 @@ importers: version: 0.11.11 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) typescript: specifier: ^5.2.2 version: 5.5.2 @@ -2288,7 +2288,7 @@ importers: version: 0.11.11 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) typescript: specifier: ^5.2.2 version: 5.5.2 @@ -2297,7 +2297,7 @@ importers: devDependencies: jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) packages/codemods/axios/fetch: devDependencies: @@ -2327,7 +2327,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2370,7 +2370,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -2403,7 +2403,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -2436,7 +2436,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -2469,7 +2469,7 @@ importers: version: 1.6.0(vitest@1.1.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -2496,7 +2496,7 @@ importers: version: 1.6.0(vitest@1.1.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -2520,7 +2520,7 @@ importers: version: 20.9.0 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) typescript: specifier: 5.2.2 version: 5.2.2 @@ -2556,7 +2556,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2580,7 +2580,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2604,7 +2604,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2628,7 +2628,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2652,7 +2652,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2676,7 +2676,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2700,7 +2700,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2724,7 +2724,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2748,7 +2748,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2772,7 +2772,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2796,7 +2796,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2820,7 +2820,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2844,7 +2844,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2868,7 +2868,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2892,7 +2892,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2916,7 +2916,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2940,7 +2940,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -2997,7 +2997,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3021,7 +3021,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3045,7 +3045,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3069,7 +3069,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3096,7 +3096,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -3126,7 +3126,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3150,7 +3150,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3174,7 +3174,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3198,7 +3198,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3222,7 +3222,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3246,7 +3246,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3270,7 +3270,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3294,7 +3294,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3318,7 +3318,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3342,7 +3342,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3366,7 +3366,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3390,7 +3390,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3414,7 +3414,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3438,7 +3438,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3469,7 +3469,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -3496,7 +3496,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3713,7 +3713,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3737,7 +3737,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3761,7 +3761,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3785,7 +3785,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3809,7 +3809,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3833,7 +3833,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3857,7 +3857,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3881,7 +3881,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3905,7 +3905,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3929,7 +3929,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3953,7 +3953,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -3977,7 +3977,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4001,7 +4001,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4027,7 +4027,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4051,7 +4051,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4108,7 +4108,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -4141,7 +4141,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -4190,7 +4190,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -4222,7 +4222,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4246,7 +4246,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4274,7 +4274,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4298,7 +4298,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4322,7 +4322,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4346,7 +4346,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4406,7 +4406,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -4439,7 +4439,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -4491,7 +4491,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -4545,7 +4545,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -4596,7 +4596,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4620,7 +4620,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4641,7 +4641,7 @@ importers: version: 20.9.0 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) typescript: specifier: ^5.2.2 version: 5.5.3 @@ -4674,7 +4674,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4695,7 +4695,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4716,7 +4716,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4754,7 +4754,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4775,7 +4775,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4822,6 +4822,111 @@ importers: specifier: ^1.0.1 version: 1.6.0(@types/node@20.9.0)(jsdom@23.2.0)(terser@5.31.1) + packages/codemods/preact/X/default-import-to-namespace-import: + devDependencies: + '@codemod.com/codemod-utils': + specifier: '*' + version: 1.0.0(@babel/preset-env@7.24.7(@babel/core@7.24.7)) + '@types/jscodeshift': + specifier: ^0.11.10 + version: 0.11.11 + '@types/node': + specifier: 20.9.0 + version: 20.9.0 + jscodeshift: + specifier: ^0.15.1 + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) + typescript: + specifier: ^5.2.2 + version: 5.5.3 + vitest: + specifier: ^1.0.1 + version: 1.1.0(@types/node@20.9.0)(jsdom@23.2.0)(terser@5.31.1) + + packages/codemods/preact/X/import-source-update: + devDependencies: + '@codemod.com/codemod-utils': + specifier: '*' + version: 1.0.0(@babel/preset-env@7.24.7(@babel/core@7.24.7)) + '@types/jscodeshift': + specifier: ^0.11.10 + version: 0.11.11 + '@types/node': + specifier: 20.9.0 + version: 20.9.0 + jscodeshift: + specifier: ^0.15.1 + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) + typescript: + specifier: ^5.2.2 + version: 5.5.3 + vitest: + specifier: ^1.0.1 + version: 1.1.0(@types/node@20.9.0)(jsdom@23.2.0)(terser@5.31.1) + + packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming: + devDependencies: + '@codemod.com/codemod-utils': + specifier: '*' + version: 1.0.0(@babel/preset-env@7.24.7(@babel/core@7.24.7)) + '@types/jscodeshift': + specifier: ^0.11.10 + version: 0.11.11 + '@types/node': + specifier: 20.9.0 + version: 20.9.0 + jscodeshift: + specifier: ^0.15.1 + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) + typescript: + specifier: ^5.2.2 + version: 5.5.3 + vitest: + specifier: ^1.0.1 + version: 1.1.0(@types/node@20.9.0)(jsdom@23.2.0)(terser@5.31.1) + + packages/codemods/preact/X/props-children-to-child-array: + devDependencies: + '@codemod.com/codemod-utils': + specifier: '*' + version: 1.0.0(@babel/preset-env@7.24.7(@babel/core@7.24.7)) + '@types/jscodeshift': + specifier: ^0.11.10 + version: 0.11.11 + '@types/node': + specifier: 20.9.0 + version: 20.9.0 + jscodeshift: + specifier: ^0.15.1 + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) + typescript: + specifier: ^5.2.2 + version: 5.5.3 + vitest: + specifier: ^1.0.1 + version: 1.1.0(@types/node@20.9.0)(jsdom@23.2.0)(terser@5.31.1) + + packages/codemods/preact/X/replace-this-state-with-prevstate: + devDependencies: + '@codemod.com/codemod-utils': + specifier: '*' + version: 1.0.0(@babel/preset-env@7.24.7(@babel/core@7.24.7)) + '@types/jscodeshift': + specifier: ^0.11.10 + version: 0.11.11 + '@types/node': + specifier: 20.9.0 + version: 20.9.0 + jscodeshift: + specifier: ^0.15.1 + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) + typescript: + specifier: ^5.2.2 + version: 5.5.3 + vitest: + specifier: ^1.0.1 + version: 1.1.0(@types/node@20.9.0)(jsdom@23.2.0)(terser@5.31.1) + packages/codemods/prisma/5/json-protocol: dependencies: '@mrleebo/prisma-ast': @@ -4845,7 +4950,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -4877,7 +4982,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4901,7 +5006,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4925,7 +5030,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4949,7 +5054,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4973,7 +5078,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -4997,7 +5102,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5021,7 +5126,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5045,7 +5150,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5069,7 +5174,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5090,7 +5195,7 @@ importers: version: 20.9.0 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) typescript: specifier: ^5.2.2 version: 5.5.2 @@ -5111,7 +5216,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5135,7 +5240,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5159,7 +5264,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5183,7 +5288,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5207,7 +5312,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5234,7 +5339,7 @@ importers: version: 0.19.5 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5258,7 +5363,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5282,7 +5387,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5306,7 +5411,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5330,7 +5435,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5354,7 +5459,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5378,7 +5483,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5402,7 +5507,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5426,7 +5531,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5450,7 +5555,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5474,7 +5579,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5498,7 +5603,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5522,7 +5627,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5546,7 +5651,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5570,7 +5675,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5594,7 +5699,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5618,7 +5723,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5642,7 +5747,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5666,7 +5771,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5692,7 +5797,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5719,7 +5824,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5743,7 +5848,7 @@ importers: version: 20.9.0 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) typescript: specifier: ^5.2.2 version: 5.5.2 @@ -5767,7 +5872,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5788,7 +5893,7 @@ importers: version: 20.14.8 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) typescript: specifier: ^5.2.2 version: 5.5.2 @@ -5809,7 +5914,7 @@ importers: version: 20.9.0 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) typescript: specifier: ^5.2.2 version: 5.5.2 @@ -5830,7 +5935,7 @@ importers: version: 20.9.0 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) typescript: specifier: ^5.2.2 version: 5.5.2 @@ -5848,7 +5953,7 @@ importers: version: 20.9.0 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) typescript: specifier: ^5.2.2 version: 5.5.2 @@ -5869,7 +5974,7 @@ importers: version: 20.9.0 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) typescript: specifier: 5.2.2 version: 5.2.2 @@ -5893,7 +5998,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5914,7 +6019,7 @@ importers: version: 20.14.8 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) typescript: specifier: ^5.2.2 version: 5.5.2 @@ -5935,7 +6040,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5959,7 +6064,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -5983,7 +6088,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -6007,7 +6112,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -6031,7 +6136,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -6055,7 +6160,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -6079,7 +6184,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -6106,7 +6211,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) memfs: specifier: ^4.6.0 version: 4.9.3 @@ -6184,7 +6289,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -6211,7 +6316,7 @@ importers: version: 1.6.0(vitest@1.6.0(@types/node@20.14.8)(jsdom@23.2.0)(terser@5.31.1)) jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@20.14.8)(typescript@5.5.2) @@ -6232,7 +6337,7 @@ importers: version: 20.14.8 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) typescript: specifier: ^5.2.2 version: 5.5.2 @@ -6262,8 +6367,6 @@ importers: specifier: ^4.11.0 version: 4.15.7 - packages/database/generated/client: {} - packages/deprecated: {} packages/filemod: @@ -6500,7 +6603,7 @@ importers: version: 1.15.1 jscodeshift: specifier: ^0.15.1 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) ms: specifier: 'catalog:' version: 2.1.3 @@ -6612,7 +6715,7 @@ importers: version: 9.2.23 jscodeshift: specifier: ^0.15.0 - version: 0.15.2(@babel/preset-env@7.24.7) + version: 0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)) lodash-es: specifier: 'catalog:' version: 4.17.21 @@ -8067,6 +8170,9 @@ packages: '@codemirror/view@6.28.2': resolution: {integrity: sha512-A3DmyVfjgPsGIjiJqM/zvODUAPQdQl3ci0ghehYNnbt5x+o76xq+dL5+mMBuysDXnI3kapgOkoeJ0sbtL/3qPw==} + '@codemod.com/codemod-utils@1.0.0': + resolution: {integrity: sha512-Uo7oA2kgpfRJS5LFL9ARdsaeenRyEsRHINoTcIsHeBFBce+imLhrkYlEhXcrNYuTLVXmlGx2Mdn6NeUio4wpfw==} + '@colors/colors@1.5.0': resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} engines: {node: '>=0.1.90'} @@ -23014,6 +23120,15 @@ snapshots: style-mod: 4.1.2 w3c-keyname: 2.2.8 + '@codemod.com/codemod-utils@1.0.0(@babel/preset-env@7.24.7(@babel/core@7.24.7))': + dependencies: + '@babel/parser': 7.24.7 + '@types/jscodeshift': 0.11.11 + jscodeshift: 0.16.1(@babel/preset-env@7.24.7(@babel/core@7.24.7)) + transitivePeerDependencies: + - '@babel/preset-env' + - supports-color + '@colors/colors@1.5.0': optional: true @@ -23980,13 +24095,13 @@ snapshots: '@kwsites/promise-deferred@1.1.1': {} - '@langchain/community@0.0.57(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(chromadb@1.7.2(openai@4.23.0))(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0)': + '@langchain/community@0.0.57(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(chromadb@1.7.2(openai@4.23.0))(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0)': dependencies: - '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) - '@langchain/openai': 0.0.34(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0)) + '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) + '@langchain/openai': 0.0.34(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0)) expr-eval: 2.0.2 flat: 5.0.2 - langsmith: 0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) + langsmith: 0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) uuid: 9.0.1 zod: 3.23.8 zod-to-json-schema: 3.23.1(zod@3.23.8) @@ -24007,13 +24122,13 @@ snapshots: - langchain - openai - '@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0)': + '@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0)': dependencies: ansi-styles: 5.2.0 camelcase: 6.3.0 decamelize: 1.2.0 js-tiktoken: 1.0.12 - langsmith: 0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) + langsmith: 0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) ml-distance: 4.0.1 mustache: 4.2.0 p-queue: 6.6.2 @@ -24025,13 +24140,13 @@ snapshots: - langchain - openai - '@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0)': + '@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0)': dependencies: ansi-styles: 5.2.0 camelcase: 6.3.0 decamelize: 1.2.0 js-tiktoken: 1.0.12 - langsmith: 0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0) + langsmith: 0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0) ml-distance: 4.0.1 mustache: 4.2.0 p-queue: 6.6.2 @@ -24043,9 +24158,9 @@ snapshots: - langchain - openai - '@langchain/openai@0.0.34(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))': + '@langchain/openai@0.0.34(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))': dependencies: - '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0) + '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0) js-tiktoken: 1.0.12 openai: 4.52.0 zod: 3.23.8 @@ -31550,7 +31665,7 @@ snapshots: transitivePeerDependencies: - supports-color - jscodeshift@0.15.2(@babel/preset-env@7.24.7): + jscodeshift@0.15.2(@babel/preset-env@7.24.7(@babel/core@7.24.7)): dependencies: '@babel/core': 7.24.7 '@babel/parser': 7.24.7 @@ -31781,12 +31896,12 @@ snapshots: kolorist@1.8.0: {} - langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0): + langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0): dependencies: '@anthropic-ai/sdk': 0.9.1 - '@langchain/community': 0.0.57(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(chromadb@1.7.2(openai@4.23.0))(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) - '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) - '@langchain/openai': 0.0.34(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0)) + '@langchain/community': 0.0.57(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(chromadb@1.7.2(openai@4.23.0))(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) + '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) + '@langchain/openai': 0.0.34(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0)) binary-extensions: 2.3.0 expr-eval: 2.0.2 js-tiktoken: 1.0.12 @@ -31892,7 +32007,7 @@ snapshots: p-retry: 4.6.2 uuid: 9.0.1 - langsmith@0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0): + langsmith@0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0): dependencies: '@types/uuid': 9.0.8 commander: 10.0.1 @@ -31900,11 +32015,11 @@ snapshots: p-retry: 4.6.2 uuid: 9.0.1 optionalDependencies: - '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) - langchain: 0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) + '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) + langchain: 0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) openai: 4.23.0 - langsmith@0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0): + langsmith@0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0): dependencies: '@types/uuid': 9.0.8 commander: 10.0.1 @@ -31912,8 +32027,8 @@ snapshots: p-retry: 4.6.2 uuid: 9.0.1 optionalDependencies: - '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0) - langchain: 0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0(@aws-sdk/client-sts@3.600.0))(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) + '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0) + langchain: 0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) openai: 4.52.0 language-subtag-registry@0.3.23: {} From ee0c6ddc4f2ca4992da2f84608b32b09c4281696 Mon Sep 17 00:00:00 2001 From: Manish Jha Date: Wed, 21 Aug 2024 16:47:16 +0530 Subject: [PATCH 3/5] migration recipe --- .../preact/X/migration-recipe/.codemodrc.json | 22 +++++++++++++++++++ .../preact/X/migration-recipe/README.md | 19 ++++++++++++++++ .../preact/X/migration-recipe/package.json | 6 +++++ 3 files changed, 47 insertions(+) create mode 100644 packages/codemods/preact/X/migration-recipe/.codemodrc.json create mode 100644 packages/codemods/preact/X/migration-recipe/README.md create mode 100644 packages/codemods/preact/X/migration-recipe/package.json diff --git a/packages/codemods/preact/X/migration-recipe/.codemodrc.json b/packages/codemods/preact/X/migration-recipe/.codemodrc.json new file mode 100644 index 000000000..5fb3f5e71 --- /dev/null +++ b/packages/codemods/preact/X/migration-recipe/.codemodrc.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json", + "name": "preact/X/migration-recipe", + "version": "1.0.3", + "engine": "recipe", + "private": false, + "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"], + "arguments": [], + "meta": { + "tags": ["migration", "preact"], + "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/preact/X/migration-recipe" + }, + "applicability": { + "from": [["preact", "<", "8.x"]] + }, + "names": [ + "preact/X/replace-this-state-with-prevstate", + "preact/X/props-children-to-child-array", + "preact/X/preact-import-source-update", + "preact/X/default-import-to-namespace-import" + ] +} diff --git a/packages/codemods/preact/X/migration-recipe/README.md b/packages/codemods/preact/X/migration-recipe/README.md new file mode 100644 index 000000000..bfd4db969 --- /dev/null +++ b/packages/codemods/preact/X/migration-recipe/README.md @@ -0,0 +1,19 @@ + +This recipe provides a collection of codemods to help you migrate your codebase to [Preact X](https://preactjs.com/guide/v10/upgrade-guide). These codemods are designed to streamline the transition process by automating common code transformations. + +## Codemods Included + +The following codemods are included in this recipe: + +1. **Replace `this.state` with `prevState`** + Converts instances of `this.state` to use `prevState` to align with Preact X best practices. + +2. **Convert `props.children` to `childArray`** + Transforms `props.children` into a child array, which is the recommended structure in Preact X. + +3. **Update Preact Import Source** + Updates import paths to the new Preact X syntax, ensuring that your imports align with the latest version. + +4. **Convert Default Import to Namespace Import** + Replaces default imports with namespace imports (`import * as Preact from 'preact';`) to prevent potential issues and improve compatibility with Preact X. + diff --git a/packages/codemods/preact/X/migration-recipe/package.json b/packages/codemods/preact/X/migration-recipe/package.json new file mode 100644 index 000000000..09b3d3cc0 --- /dev/null +++ b/packages/codemods/preact/X/migration-recipe/package.json @@ -0,0 +1,6 @@ +{ + "name": "@codemod/preact-X-migration-recipe", + "files": ["./README.md", "./.codemodrc.json"], + "type": "module", + "private": true +} From c4a0c7547849c4dc11dbbcac5f19ec7f0394890a Mon Sep 17 00:00:00 2001 From: Manish Jha Date: Wed, 21 Aug 2024 16:56:00 +0530 Subject: [PATCH 4/5] minor fix --- .../cdmd_dist/index.cjs | 35 -------- .../__testfixtures__/fixture1.output.ts | 8 +- .../import-source-update/cdmd_dist/index.cjs | 36 -------- .../__testfixtures__/fixture2.input.ts | 18 ---- .../__testfixtures__/fixture2.output.ts | 11 --- .../cdmd_dist/index.cjs | 53 ------------ .../__testfixtures__/fixture1.output.ts | 2 +- .../cdmd_dist/index.cjs | 84 ------------------- .../__testfixtures__/fixture1.output.ts | 2 +- .../cdmd_dist/index.cjs | 49 ----------- 10 files changed, 6 insertions(+), 292 deletions(-) delete mode 100644 packages/codemods/preact/X/default-import-to-namespace-import/cdmd_dist/index.cjs delete mode 100644 packages/codemods/preact/X/import-source-update/cdmd_dist/index.cjs delete mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.input.ts delete mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.output.ts delete mode 100644 packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/cdmd_dist/index.cjs delete mode 100644 packages/codemods/preact/X/props-children-to-child-array/cdmd_dist/index.cjs delete mode 100644 packages/codemods/preact/X/replace-this-state-with-prevstate/cdmd_dist/index.cjs diff --git a/packages/codemods/preact/X/default-import-to-namespace-import/cdmd_dist/index.cjs b/packages/codemods/preact/X/default-import-to-namespace-import/cdmd_dist/index.cjs deleted file mode 100644 index 8d75a39b7..000000000 --- a/packages/codemods/preact/X/default-import-to-namespace-import/cdmd_dist/index.cjs +++ /dev/null @@ -1,35 +0,0 @@ -/*! @license -The MIT License (MIT) - -Copyright (c) 2024 manishjha-04 - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -*/ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -Object.defineProperty(exports, "default", { - enumerable: true, - get: () => transformer, -}); -function transformer(fileInfo, api) { - const j = api.jscodeshift; - const root = j(fileInfo.source); - root - .find(j.ImportDeclaration, { source: { value: "preact" } }) - .forEach((path) => { - const defaultImportSpecifier = path.node.specifiers.find( - (specifier) => specifier.type === "ImportDefaultSpecifier", - ); - if (defaultImportSpecifier) { - path.node.specifiers = [ - j.importNamespaceSpecifier(j.identifier("preact")), - ]; - } - }); - return root.toSource(); -} diff --git a/packages/codemods/preact/X/import-source-update/__testfixtures__/fixture1.output.ts b/packages/codemods/preact/X/import-source-update/__testfixtures__/fixture1.output.ts index ccb49a746..510c08be4 100644 --- a/packages/codemods/preact/X/import-source-update/__testfixtures__/fixture1.output.ts +++ b/packages/codemods/preact/X/import-source-update/__testfixtures__/fixture1.output.ts @@ -1,4 +1,4 @@ -import { Provider } from 'react-redux'; -import { observer } from 'mobx-react'; -import { createPortal } from 'preact/compat'; -import { render } from 'preact/compat'; \ No newline at end of file +import { Provider } from "react-redux"; +import { observer } from "mobx-react"; +import { createPortal } from "preact/compat"; +import { render } from "preact/compat"; \ No newline at end of file diff --git a/packages/codemods/preact/X/import-source-update/cdmd_dist/index.cjs b/packages/codemods/preact/X/import-source-update/cdmd_dist/index.cjs deleted file mode 100644 index c9f89a758..000000000 --- a/packages/codemods/preact/X/import-source-update/cdmd_dist/index.cjs +++ /dev/null @@ -1,36 +0,0 @@ -/*! @license -The MIT License (MIT) - -Copyright (c) 2024 manishjha-04 - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -*/ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -Object.defineProperty(exports, "default", { - enumerable: true, - get: () => transform, -}); -function transform(fileInfo, api) { - const j = api.jscodeshift; - return j(fileInfo.source) - .find(j.ImportDeclaration) - .forEach((path) => { - const importSource = path.node.source.value; - if (importSource === "preact-compat") { - path.node.source.value = "preact/compat"; - } - if (importSource === "preact-redux") { - path.node.source.value = "react-redux"; - } - if (importSource === "mobx-preact") { - path.node.source.value = "mobx-react"; - } - }) - .toSource(); -} diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.input.ts b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.input.ts deleted file mode 100644 index 7eb02b36b..000000000 --- a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.input.ts +++ /dev/null @@ -1,18 +0,0 @@ -class HTTPError extends Error {} - -const response = await fetch('https://example.com', { - method: 'POST', - body: JSON.stringify({ foo: true }), - headers: { - 'content-type': 'application/json', - }, -}); - -if (!response.ok) { - throw new HTTPError(`Fetch error: ${response.statusText}`); -} - -const json = await response.json(); - -console.log(json); -//=> `{data: 'πŸ¦„'}` \ No newline at end of file diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.output.ts b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.output.ts deleted file mode 100644 index e3faf4d0b..000000000 --- a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/__testfixtures__/fixture2.output.ts +++ /dev/null @@ -1,11 +0,0 @@ -import ky from 'ky'; -class HTTPError extends Error {} - -const response = await ky.post('https://example.com', { - json: { foo: true }, -}); - -const json = await response.json(); - -console.log(json); -//=> `{data: 'πŸ¦„'}` \ No newline at end of file diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/cdmd_dist/index.cjs b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/cdmd_dist/index.cjs deleted file mode 100644 index 11d0ba453..000000000 --- a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/cdmd_dist/index.cjs +++ /dev/null @@ -1,53 +0,0 @@ -/*! @license -The MIT License (MIT) - -Copyright (c) 2024 manishjha-04 - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -*/ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -Object.defineProperty(exports, "default", { - enumerable: true, - get: () => transform, -}); -function transform(fileInfo, api) { - const j = api.jscodeshift; - const root = j(fileInfo.source); - root - .find(j.Identifier, { name: "attributes" }) - .replaceWith(j.identifier("props")); - root - .find(j.Identifier, { name: "nodeName" }) - .replaceWith(j.identifier("type")); - root.find(j.Property, { key: { name: "children" } }).forEach((path) => { - const parent = path.parentPath.value; - if (parent.type === "ObjectExpression" && parent.properties) { - const propsProperty = parent.properties.find( - (prop) => prop.key.name === "props", - ); - if (propsProperty) { - propsProperty.value.properties.push( - j.property("init", j.identifier("children"), path.value.value), - ); - j(path).remove(); - } else { - j(path).replaceWith( - j.property( - "init", - j.identifier("props"), - j.objectExpression([ - j.property("init", j.identifier("children"), path.value.value), - ]), - ), - ); - } - } - }); - return root.toSource(); -} diff --git a/packages/codemods/preact/X/props-children-to-child-array/__testfixtures__/fixture1.output.ts b/packages/codemods/preact/X/props-children-to-child-array/__testfixtures__/fixture1.output.ts index 4d91aa51e..f834bb7a9 100644 --- a/packages/codemods/preact/X/props-children-to-child-array/__testfixtures__/fixture1.output.ts +++ b/packages/codemods/preact/X/props-children-to-child-array/__testfixtures__/fixture1.output.ts @@ -1,4 +1,4 @@ -import { toChildArray } from 'preact'; +import { toChildArray } from "preact"; function Foo(props) { const count = toChildArray(props.children).length; diff --git a/packages/codemods/preact/X/props-children-to-child-array/cdmd_dist/index.cjs b/packages/codemods/preact/X/props-children-to-child-array/cdmd_dist/index.cjs deleted file mode 100644 index 3ababc0b1..000000000 --- a/packages/codemods/preact/X/props-children-to-child-array/cdmd_dist/index.cjs +++ /dev/null @@ -1,84 +0,0 @@ -/*! @license -The MIT License (MIT) - -Copyright (c) 2024 manishjha-04 - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -*/ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -Object.defineProperty(exports, "default", { - enumerable: true, - get: () => transformer, -}); -function transformer(fileInfo, api) { - const j = api.jscodeshift; - const root = j(fileInfo.source); - const propsChildrenUsage = root.find(j.MemberExpression, { - object: { - type: "MemberExpression", - object: { type: "Identifier", name: "props" }, - property: { type: "Identifier", name: "children" }, - }, - }); - if (propsChildrenUsage.size() > 0) { - const preactImport = root.find(j.ImportDeclaration, { - source: { value: "preact" }, - }); - if (preactImport.size() === 0) { - root - .get() - .node.program.body.unshift( - j.importDeclaration( - [j.importSpecifier(j.identifier("toChildArray"))], - j.literal("preact"), - ), - ); - } else { - preactImport.forEach((path) => { - const hasToChildArray = path.node.specifiers.some( - (specifier) => - specifier.imported && specifier.imported.name === "toChildArray", - ); - if (!hasToChildArray) { - path.node.specifiers.push( - j.importSpecifier(j.identifier("toChildArray")), - ); - } - }); - } - root - .find(j.MemberExpression, { - object: { - type: "MemberExpression", - object: { type: "Identifier", name: "props" }, - property: { type: "Identifier", name: "children" }, - }, - property: { type: "Identifier", name: "length" }, - }) - .forEach((path) => { - j(path).replaceWith( - j.memberExpression( - j.callExpression(j.identifier("toChildArray"), [ - j.memberExpression( - j.identifier("props"), - j.identifier("children"), - ), - ]), - j.identifier("length"), - ), - ); - }); - preactImport.forEach((path) => { - path.node.specifiers = [ - j.importNamespaceSpecifier(j.identifier("preact")), - ]; - }); - } - return root.toSource(); -} diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/__testfixtures__/fixture1.output.ts b/packages/codemods/preact/X/replace-this-state-with-prevstate/__testfixtures__/fixture1.output.ts index e92324ff7..eb700ef95 100644 --- a/packages/codemods/preact/X/replace-this-state-with-prevstate/__testfixtures__/fixture1.output.ts +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/__testfixtures__/fixture1.output.ts @@ -1,3 +1,3 @@ -this.setState((prevState) => { +this.setState(prevState => { return { counter: prevState.counter + 1 }; }); \ No newline at end of file diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/cdmd_dist/index.cjs b/packages/codemods/preact/X/replace-this-state-with-prevstate/cdmd_dist/index.cjs deleted file mode 100644 index fe5ecf3b7..000000000 --- a/packages/codemods/preact/X/replace-this-state-with-prevstate/cdmd_dist/index.cjs +++ /dev/null @@ -1,49 +0,0 @@ -/*! @license -The MIT License (MIT) - -Copyright (c) 2024 manishjha-04 - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -*/ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -Object.defineProperty(exports, "default", { - enumerable: true, - get: () => transform, -}); -function transform(file, api) { - const j = api.jscodeshift; - const root = j(file.source); - let dirtyFlag = false; - root - .find(j.CallExpression, { - callee: { - object: { type: "ThisExpression" }, - property: { name: "setState" }, - }, - }) - .forEach((path) => { - const args = path.node.arguments; - if (args.length === 1 && j.ObjectExpression.check(args[0])) { - const objectExpression = args[0]; - j(objectExpression) - .find(j.MemberExpression, { - object: { type: "ThisExpression" }, - property: { name: "state" }, - }) - .replaceWith(() => j.identifier("prevState")); - const arrowFunction = j.arrowFunctionExpression( - [j.identifier("prevState")], - j.blockStatement([j.returnStatement(objectExpression)]), - ); - path.node.arguments = [arrowFunction]; - dirtyFlag = true; - } - }); - return dirtyFlag ? root.toSource() : undefined; -} From 865584d02d6850e0b40ca333a8fe7c0a20eabdb7 Mon Sep 17 00:00:00 2001 From: Manish Jha Date: Wed, 21 Aug 2024 16:58:31 +0530 Subject: [PATCH 5/5] lincense fix --- .../preact/X/default-import-to-namespace-import/LICENSE | 2 +- packages/codemods/preact/X/import-source-update/LICENSE | 2 +- .../X/libraryAuthors_attribute-node-children-renaming/LICENSE | 2 +- .../codemods/preact/X/props-children-to-child-array/LICENSE | 2 +- .../codemods/preact/X/replace-this-state-with-prevstate/LICENSE | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/codemods/preact/X/default-import-to-namespace-import/LICENSE b/packages/codemods/preact/X/default-import-to-namespace-import/LICENSE index 335a784ea..8695657d6 100644 --- a/packages/codemods/preact/X/default-import-to-namespace-import/LICENSE +++ b/packages/codemods/preact/X/default-import-to-namespace-import/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 manishjha-04 +Copyright (c) 2024 Codemod Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/packages/codemods/preact/X/import-source-update/LICENSE b/packages/codemods/preact/X/import-source-update/LICENSE index 335a784ea..8695657d6 100644 --- a/packages/codemods/preact/X/import-source-update/LICENSE +++ b/packages/codemods/preact/X/import-source-update/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 manishjha-04 +Copyright (c) 2024 Codemod Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/LICENSE b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/LICENSE index 335a784ea..8695657d6 100644 --- a/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/LICENSE +++ b/packages/codemods/preact/X/libraryAuthors_attribute-node-children-renaming/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 manishjha-04 +Copyright (c) 2024 Codemod Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/packages/codemods/preact/X/props-children-to-child-array/LICENSE b/packages/codemods/preact/X/props-children-to-child-array/LICENSE index 335a784ea..8695657d6 100644 --- a/packages/codemods/preact/X/props-children-to-child-array/LICENSE +++ b/packages/codemods/preact/X/props-children-to-child-array/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 manishjha-04 +Copyright (c) 2024 Codemod Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/packages/codemods/preact/X/replace-this-state-with-prevstate/LICENSE b/packages/codemods/preact/X/replace-this-state-with-prevstate/LICENSE index 335a784ea..8695657d6 100644 --- a/packages/codemods/preact/X/replace-this-state-with-prevstate/LICENSE +++ b/packages/codemods/preact/X/replace-this-state-with-prevstate/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 manishjha-04 +Copyright (c) 2024 Codemod Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: