diff --git a/.github/workflows/publish-sim-cli.yml b/.github/workflows/publish-sim-cli.yml index f3d68151afc..2d77a608bdf 100644 --- a/.github/workflows/publish-sim-cli.yml +++ b/.github/workflows/publish-sim-cli.yml @@ -41,7 +41,7 @@ jobs: persist-credentials: false # Vitest 5 requires Node 22.12+; the published bundle is also - # smoke-tested on Node 22 below, its minimum supported runtime. + # smoke-tested below on Node 22.18.0, its minimum supported runtime. - name: Setup workspace uses: ./.github/actions/setup with: @@ -131,10 +131,10 @@ jobs: working-directory: packages/sim-cli run: bun pm pack --ignore-scripts --filename "$RUNNER_TEMP/package.tgz" --quiet - - name: Setup Node 22 for the bundle smoke test + - name: Setup the minimum supported Node for the bundle smoke test uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6 with: - node-version: '22' + node-version: '22.18.0' - name: Smoke-test packed Node bundle env: diff --git a/apps/docs/content/docs/cli/index.mdx b/apps/docs/content/docs/cli/index.mdx index b9259a9ff7c..d44f4e9b9ee 100644 --- a/apps/docs/content/docs/cli/index.mdx +++ b/apps/docs/content/docs/cli/index.mdx @@ -7,7 +7,7 @@ Use `sim` to run workflows, query tables, move files, search knowledge bases, an ## Install -The installed CLI requires Node.js 22 or newer. Install it globally with Bun, then check the version: +The installed CLI requires Node.js 22.18 or newer on the 22 line, or 24.11 or newer. Install it globally with Bun, then check the version: ```bash bun add -g sim diff --git a/bun.lock b/bun.lock index a46678d1a16..d635b56d614 100644 --- a/bun.lock +++ b/bun.lock @@ -5,7 +5,7 @@ "": { "name": "simstudio", "devDependencies": { - "@babel/parser": "7.29.9", + "@babel/parser": "8.1.2", "@biomejs/biome": "2.0.6", "@mdx-js/mdx": "3.1.1", "@octokit/rest": "^22.0.1", @@ -16,7 +16,7 @@ "@typescript/typescript6": "^6.0.2", "@vercel/og": "0.6.8", "ajv": "8.20.0", - "commander": "^11.1.0", + "commander": "^15.1.0", "concurrently": "10.0.6", "glob": "13.0.6", "gray-matter": "4.0.3", @@ -760,8 +760,8 @@ "sim": "dist/index.js", }, "dependencies": { - "chalk": "5.6.2", - "commander": "^11.1.0", + "chalk": "6.0.1", + "commander": "^15.1.0", "csv-parse": "7.0.3", "diff": "9.0.0", "js-yaml": "4.3.2", @@ -871,13 +871,13 @@ "name": "@sim/workflow-code", "version": "0.1.0", "dependencies": { - "@babel/parser": "7.29.9", + "@babel/parser": "8.1.2", "@noble/hashes": "2.2.0", "@sim/utils": "workspace:*", "@sim/workflow-types": "workspace:*", }, "devDependencies": { - "@babel/types": "7.29.8", + "@babel/types": "8.1.2", "@sim/testing": "workspace:*", "@sim/tsconfig": "workspace:*", "@xyflow/react": "12.12.1", @@ -971,13 +971,13 @@ "name": "@sim/workspace-code", "version": "0.1.0", "dependencies": { - "@babel/parser": "7.29.9", + "@babel/parser": "8.1.2", "@sim/table-cells": "workspace:*", "@sim/utils": "workspace:*", "@sim/workflow-code": "workspace:*", }, "devDependencies": { - "@babel/types": "7.29.8", + "@babel/types": "8.1.2", "@sim/testing": "workspace:*", "@sim/tsconfig": "workspace:*", "@types/js-yaml": "4.0.9", @@ -1270,7 +1270,7 @@ "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="], - "@babel/parser": ["@babel/parser@7.29.9", "", { "dependencies": { "@babel/types": "^7.29.8" }, "bin": "./bin/babel-parser.js" }, "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA=="], + "@babel/parser": ["@babel/parser@8.1.2", "", { "dependencies": { "@babel/types": "^8.1.2" }, "bin": "./bin/babel-parser.js" }, "sha512-ZDKU7vaX0VORd2BhaO+3FKr/30TKjbUy3SMZcydiPngnAb+MesgUoh5SJcE5EwEyBj14M5J6fK56GuBqvYmOpw=="], "@babel/runtime": ["@babel/runtime@7.29.7", "", {}, "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw=="], @@ -2844,7 +2844,7 @@ "comma-separated-tokens": ["comma-separated-tokens@2.0.3", "", {}, "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg=="], - "commander": ["commander@11.1.0", "", {}, "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ=="], + "commander": ["commander@15.1.0", "", {}, "sha512-cgnQ88TRrWcC7pVq46RzJVRMktu3W2RcbnoidnfBsl1bmDCBwJS/udcIZpKoCrbAYYaCqsz1yZCVIgbIaU3ddQ=="], "compare-version": ["compare-version@0.1.2", "", {}, "sha512-pJDh5/4wrEnXX/VWRZvruAGHkzKdr46z11OlTPN+VrATlWWhSKewNCJ1futCO5C7eJB3nPMFZA1LeYtcFboZ2A=="], @@ -4962,6 +4962,8 @@ "@babel/generator/@babel/types": ["@babel/types@7.29.7", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA=="], + "@babel/parser/@babel/types": ["@babel/types@8.1.2", "", { "dependencies": { "@babel/helper-string-parser": "^8.1.2", "@babel/helper-validator-identifier": "^8.0.6" } }, "sha512-uXt6qt2f5G61jZwNIzK1RKu7l5Xjt1VXtPPOGuVveha9fxbx0QM94U1kM4pFZKTRLjWK+X8vmwjwbIemJjiQTA=="], + "@babel/template/@babel/parser": ["@babel/parser@7.29.7", "", { "dependencies": { "@babel/types": "^7.29.7" }, "bin": "./bin/babel-parser.js" }, "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg=="], "@babel/template/@babel/types": ["@babel/types@7.29.7", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA=="], @@ -5078,6 +5080,12 @@ "@shuding/opentype.js/fflate": ["fflate@0.7.5", "", {}, "sha512-QieYf//cis6ywHNi5qW1+PXPQ4bC+XVJAtS4AXIML8P76GroEiOxm/oQtn1f02UkJY1+KsXMJcC+R2v/Eg4G3g=="], + "@sim/app/@babel/parser": ["@babel/parser@7.29.9", "", { "dependencies": { "@babel/types": "^7.29.8" }, "bin": "./bin/babel-parser.js" }, "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA=="], + + "@sim/workflow-code/@babel/types": ["@babel/types@8.1.2", "", { "dependencies": { "@babel/helper-string-parser": "^8.1.2", "@babel/helper-validator-identifier": "^8.0.6" } }, "sha512-uXt6qt2f5G61jZwNIzK1RKu7l5Xjt1VXtPPOGuVveha9fxbx0QM94U1kM4pFZKTRLjWK+X8vmwjwbIemJjiQTA=="], + + "@sim/workspace-code/@babel/types": ["@babel/types@8.1.2", "", { "dependencies": { "@babel/helper-string-parser": "^8.1.2", "@babel/helper-validator-identifier": "^8.0.6" } }, "sha512-uXt6qt2f5G61jZwNIzK1RKu7l5Xjt1VXtPPOGuVveha9fxbx0QM94U1kM4pFZKTRLjWK+X8vmwjwbIemJjiQTA=="], + "@smithy/core/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], "@smithy/credential-provider-imds/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="], @@ -5400,6 +5408,8 @@ "micromatch/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="], + "mssql/commander": ["commander@11.1.0", "", {}, "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ=="], + "neo4j-driver-bolt-connection/buffer": ["buffer@6.0.3", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" } }, "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA=="], "node-fetch/whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="], @@ -5464,6 +5474,8 @@ "serialize-error/type-fest": ["type-fest@0.13.1", "", {}, "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg=="], + "sim/chalk": ["chalk@6.0.1", "", {}, "sha512-/Ce6KNm3vIbWdMlNna6RVIZ/ICQxnJxCicet5LBKK9ZffBkqzDw0xh9EiKSljdRtiIQ1S1z4YgcscUUGzNCWrA=="], + "slice-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], "slice-ansi/is-fullwidth-code-point": ["is-fullwidth-code-point@5.1.0", "", { "dependencies": { "get-east-asian-width": "^1.3.1" } }, "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ=="], @@ -5538,6 +5550,10 @@ "@aws-crypto/util/@aws-sdk/types/@smithy/types": ["@smithy/types@4.15.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Z5TAOxygoFvybJV3igo5SloFflSokHx2hu1eFA+DxDTcn+FtKxUSui+rbTRG1pAafMA888Z3MVvCWUuvCrTXjg=="], + "@babel/parser/@babel/types/@babel/helper-string-parser": ["@babel/helper-string-parser@8.1.2", "", {}, "sha512-TRz5Z0MgfIfWqwEIq/pCpUpEXQxUt2Ig2ZbxG3SdmhSbHMAFFYGOix0kI4JLV371/TA+qWnQ4xWHPWjojkyRFA=="], + + "@babel/parser/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@8.0.6", "", {}, "sha512-HYx0YmuchRxRSpnjvcNffnPS8DCauKNmnumIuHG3jnQAVewRA7kfJGwF13ayEpSZs7s4R/oBH4eppuXcAQd5JQ=="], + "@better-auth/sso/tldts/tldts-core": ["tldts-core@6.1.86", "", {}, "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA=="], "@browserbasehq/sdk/@types/node/undici-types": ["undici-types@5.26.5", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="], @@ -5648,6 +5664,14 @@ "@react-email/render/html-to-text/selderee": ["selderee@0.12.0", "", { "dependencies": { "parseley": "~0.13.1" } }, "sha512-b1YMh3+DHZp59DLna3qVwQ5iOla/nrI6mLBNW02XxU77M3046Df6VLkoaJyFz20VsGIG5kkp+FK0kg4K4HnUFw=="], + "@sim/workflow-code/@babel/types/@babel/helper-string-parser": ["@babel/helper-string-parser@8.1.2", "", {}, "sha512-TRz5Z0MgfIfWqwEIq/pCpUpEXQxUt2Ig2ZbxG3SdmhSbHMAFFYGOix0kI4JLV371/TA+qWnQ4xWHPWjojkyRFA=="], + + "@sim/workflow-code/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@8.0.6", "", {}, "sha512-HYx0YmuchRxRSpnjvcNffnPS8DCauKNmnumIuHG3jnQAVewRA7kfJGwF13ayEpSZs7s4R/oBH4eppuXcAQd5JQ=="], + + "@sim/workspace-code/@babel/types/@babel/helper-string-parser": ["@babel/helper-string-parser@8.1.2", "", {}, "sha512-TRz5Z0MgfIfWqwEIq/pCpUpEXQxUt2Ig2ZbxG3SdmhSbHMAFFYGOix0kI4JLV371/TA+qWnQ4xWHPWjojkyRFA=="], + + "@sim/workspace-code/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@8.0.6", "", {}, "sha512-HYx0YmuchRxRSpnjvcNffnPS8DCauKNmnumIuHG3jnQAVewRA7kfJGwF13ayEpSZs7s4R/oBH4eppuXcAQd5JQ=="], + "@smithy/eventstream-codec/@smithy/core/@smithy/types": ["@smithy/types@4.15.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Z5TAOxygoFvybJV3igo5SloFflSokHx2hu1eFA+DxDTcn+FtKxUSui+rbTRG1pAafMA888Z3MVvCWUuvCrTXjg=="], "@smithy/util-utf8/@smithy/core/@smithy/types": ["@smithy/types@4.15.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Z5TAOxygoFvybJV3igo5SloFflSokHx2hu1eFA+DxDTcn+FtKxUSui+rbTRG1pAafMA888Z3MVvCWUuvCrTXjg=="], diff --git a/package.json b/package.json index 5f86645b41a..5341b7d309c 100644 --- a/package.json +++ b/package.json @@ -185,7 +185,7 @@ "@next/swc-linux-x64-gnu": "16.4.5" }, "devDependencies": { - "@babel/parser": "7.29.9", + "@babel/parser": "8.1.2", "@biomejs/biome": "2.0.6", "@mdx-js/mdx": "3.1.1", "@octokit/rest": "^22.0.1", @@ -196,7 +196,7 @@ "@typescript/typescript6": "^6.0.2", "@vercel/og": "0.6.8", "ajv": "8.20.0", - "commander": "^11.1.0", + "commander": "^15.1.0", "concurrently": "10.0.6", "glob": "13.0.6", "gray-matter": "4.0.3", diff --git a/packages/sim-cli/README.md b/packages/sim-cli/README.md index dc8382b6fa8..7bb2c60b192 100644 --- a/packages/sim-cli/README.md +++ b/packages/sim-cli/README.md @@ -12,7 +12,7 @@ to set up a Sim deployment. ## Install -The CLI requires Node.js 22 or newer. Install it globally with Bun (npm and pnpm work too; keep upgrading with the manager that owns the installation, or run `sim update`): +The CLI requires Node.js 22.18 or newer on the 22 line, or 24.11 or newer. Install it globally with Bun (npm and pnpm work too; keep upgrading with the manager that owns the installation, or run `sim update`): ```bash bun add --global sim diff --git a/packages/sim-cli/package.json b/packages/sim-cli/package.json index 41288e2bfd1..4c33f12fa54 100644 --- a/packages/sim-cli/package.json +++ b/packages/sim-cli/package.json @@ -47,11 +47,11 @@ "access": "public" }, "engines": { - "node": ">=22" + "node": "^22.18.0 || >=24.11.0" }, "dependencies": { - "chalk": "5.6.2", - "commander": "^11.1.0", + "chalk": "6.0.1", + "commander": "^15.1.0", "csv-parse": "7.0.3", "diff": "9.0.0", "js-yaml": "4.3.2", diff --git a/packages/workflow-code/package.json b/packages/workflow-code/package.json index cb9570ae5d5..4310cea77e3 100644 --- a/packages/workflow-code/package.json +++ b/packages/workflow-code/package.json @@ -7,7 +7,7 @@ "license": "Apache-2.0", "engines": { "bun": ">=1.4.4", - "node": ">=22.0.0" + "node": "^22.18.0 || >=24.11.0" }, "exports": { ".": { @@ -77,13 +77,13 @@ "test:watch": "vitest" }, "dependencies": { - "@babel/parser": "7.29.9", + "@babel/parser": "8.1.2", "@noble/hashes": "2.2.0", "@sim/utils": "workspace:*", "@sim/workflow-types": "workspace:*" }, "devDependencies": { - "@babel/types": "7.29.8", + "@babel/types": "8.1.2", "@sim/testing": "workspace:*", "@sim/tsconfig": "workspace:*", "@xyflow/react": "12.12.1", diff --git a/packages/workflow-code/src/babel.ts b/packages/workflow-code/src/babel.ts index bb3f94cdf1b..629de6d8718 100644 --- a/packages/workflow-code/src/babel.ts +++ b/packages/workflow-code/src/babel.ts @@ -2,7 +2,7 @@ * The Babel AST walk and error reading shared by the compiler and the code-file reader. */ -import type { MemberExpression, Node } from '@babel/types' +import type { MemberExpression, Node, OptionalMemberExpression } from '@babel/types' import { isIndexSegment, isNameSegment, type RefSegment } from './code-files/ref-path' /** The fields a thrown or recovered Babel error may carry. */ @@ -47,9 +47,14 @@ export function childNodes(node: Node): Node[] { return children } +/** Whether `node` is a member access, optional or not. */ +export function isMemberAccess(node: Node): node is MemberExpression | OptionalMemberExpression { + return node.type === 'MemberExpression' || node.type === 'OptionalMemberExpression' +} + /** The name a member access reads: `.name` or `['name']` (optional or not); `null` otherwise. */ export function memberName(node: Node): string | null { - if (node.type !== 'MemberExpression' && node.type !== 'OptionalMemberExpression') return null + if (!isMemberAccess(node)) return null if (!node.computed && node.property.type === 'Identifier') return node.property.name return node.property.type === 'StringLiteral' ? node.property.value : null } diff --git a/packages/workflow-code/src/code-files/from-file.ts b/packages/workflow-code/src/code-files/from-file.ts index 9d81cbe57f1..3170891ddb0 100644 --- a/packages/workflow-code/src/code-files/from-file.ts +++ b/packages/workflow-code/src/code-files/from-file.ts @@ -1,5 +1,5 @@ import { type ParserOptions, parse } from '@babel/parser' -import type { Expression, MemberExpression, Node } from '@babel/types' +import type { MemberExpression, Node } from '@babel/types' import { isLikelyWorkflowReferenceSegment } from '@sim/utils/workflow-references' import { babelErrorShape, childNodes, memberSegment } from '../babel' import { ENV_VAR_NAME, formatStoredPath, type RefSegment } from './ref-path' @@ -106,7 +106,10 @@ function isParenthesized(node: Node): boolean { } /** The members of a chain, innermost first, and its root; stops at a parenthesized object. */ -function flattenChain(top: MemberExpression): { root: Expression; members: MemberExpression[] } { +function flattenChain(top: MemberExpression): { + root: MemberExpression['object'] + members: MemberExpression[] +} { const members: MemberExpression[] = [top] let object = top.object while (object.type === 'MemberExpression' && !isParenthesized(object)) { @@ -133,7 +136,7 @@ function envName(member: MemberExpression): string | null { * rooted at `$ref`/`$env` or maps no member. */ function chainReplacement( - root: Expression, + root: MemberExpression['object'], members: MemberExpression[] ): { replacement: Replacement; consumed: number } | null { if (root.type !== 'Identifier' || members.length === 0) return null diff --git a/packages/workflow-code/src/compile/function-returns.ts b/packages/workflow-code/src/compile/function-returns.ts index 37c98d83d38..cd6f17f6a70 100644 --- a/packages/workflow-code/src/compile/function-returns.ts +++ b/packages/workflow-code/src/compile/function-returns.ts @@ -15,7 +15,7 @@ import { parse } from '@babel/parser' import type { Expression, Node, ObjectExpression, PatternLike } from '@babel/types' -import { childNodes, memberName } from '../babel' +import { childNodes, isMemberAccess, memberName } from '../babel' import { parseStoredPath } from '../code-files/ref-path' import { toCodeFile } from '../code-files/to-file' import type { BlockKey, CanonicalBlock } from '../model' @@ -295,8 +295,9 @@ class Inference { if (BOOLEAN_FUNCTIONS.has(callee.name)) return 'boolean' return undefined } + if (!isMemberAccess(callee)) return undefined const method = memberName(callee) - if (method === null || !('object' in callee)) return undefined + if (method === null) return undefined if (callee.object.type === 'Identifier') { if (callee.object.name === 'Math') return this.isBuiltin('Math') ? 'number' : undefined const known = STATIC_KINDS[`${callee.object.name}.${method}`] @@ -356,8 +357,9 @@ class Inference { private isArray(node: Node, strict = false): boolean { if (node.type === 'ArrayExpression') return true if (node.type === 'CallExpression' || node.type === 'OptionalCallExpression') { + if (!isMemberAccess(node.callee)) return false const method = memberName(node.callee) - if (method === null || !('object' in node.callee)) return false + if (method === null) return false if (node.callee.object.type === 'Identifier' && node.callee.object.name === 'Object') { return ( this.isBuiltin('Object') && diff --git a/packages/workflow-code/src/compile/hints.ts b/packages/workflow-code/src/compile/hints.ts index 5f0abc6bcb4..7c06a2eea6e 100644 --- a/packages/workflow-code/src/compile/hints.ts +++ b/packages/workflow-code/src/compile/hints.ts @@ -112,7 +112,6 @@ export function hintForNode(node: Node): string { case 'YieldExpression': case 'ThisExpression': case 'Super': - case 'Import': case 'ImportExpression': case 'MetaProperty': return HINTS.calls diff --git a/packages/workflow-code/src/compile/values.ts b/packages/workflow-code/src/compile/values.ts index 32486939295..59e02f08aef 100644 --- a/packages/workflow-code/src/compile/values.ts +++ b/packages/workflow-code/src/compile/values.ts @@ -1,7 +1,6 @@ import type { ArrayExpression, CallExpression, - Expression, MemberExpression, Node, ObjectExpression, @@ -533,7 +532,10 @@ function singleStringArgument( return { text, node: argument } } -function flattenMembers(node: MemberExpression): { root: Expression; members: MemberExpression[] } { +function flattenMembers(node: MemberExpression): { + root: MemberExpression['object'] + members: MemberExpression[] +} { const members: MemberExpression[] = [node] let object = node.object while (object.type === 'MemberExpression') { diff --git a/packages/workflow-sdk/package.json b/packages/workflow-sdk/package.json index 6b1398d2da1..baa2073fefe 100644 --- a/packages/workflow-sdk/package.json +++ b/packages/workflow-sdk/package.json @@ -7,7 +7,7 @@ "license": "Apache-2.0", "engines": { "bun": ">=1.4.4", - "node": ">=22.0.0" + "node": "^22.18.0 || >=24.11.0" }, "exports": { ".": { diff --git a/packages/workspace-code/package.json b/packages/workspace-code/package.json index d8742480b69..085c18a3653 100644 --- a/packages/workspace-code/package.json +++ b/packages/workspace-code/package.json @@ -7,7 +7,7 @@ "license": "Apache-2.0", "engines": { "bun": ">=1.4.4", - "node": ">=22.0.0" + "node": "^22.18.0 || >=24.11.0" }, "exports": { ".": { @@ -53,13 +53,13 @@ "test:watch": "vitest" }, "dependencies": { - "@babel/parser": "7.29.9", + "@babel/parser": "8.1.2", "@sim/table-cells": "workspace:*", "@sim/utils": "workspace:*", "@sim/workflow-code": "workspace:*" }, "devDependencies": { - "@babel/types": "7.29.8", + "@babel/types": "8.1.2", "@sim/testing": "workspace:*", "@sim/tsconfig": "workspace:*", "@types/js-yaml": "4.0.9", diff --git a/scripts/check-source-conventions.ts b/scripts/check-source-conventions.ts index ba4ce7ce89d..30e752cc744 100644 --- a/scripts/check-source-conventions.ts +++ b/scripts/check-source-conventions.ts @@ -209,14 +209,13 @@ function isBarrel(file: string): boolean { return /(?:^|\/)index\.tsx?$/.test(file) } -/** The specifier of `import('x')` or `require('x')`, in either AST shape Babel produces. */ +/** The specifier of `import('x')` or `require('x')`. */ function dynamicSpecifier(node: Node): string | undefined { if (node.type === 'ImportExpression') return stringValue(node.source) if (node.type !== 'CallExpression') return undefined const callee = node.callee as Node - const isImportOrRequire = - callee.type === 'Import' || (callee.type === 'Identifier' && callee.name === 'require') - return isImportOrRequire ? stringValue((node.arguments as Node[])[0]) : undefined + const isRequire = callee.type === 'Identifier' && callee.name === 'require' + return isRequire ? stringValue((node.arguments as Node[])[0]) : undefined } /** The specifier of a static `import`, `import x = require()`, or `export … from`. */ @@ -273,9 +272,7 @@ function isBarrelReExport(node: Node, specifier: string, reExported: Set /** The specifier of a type-position `import('./x').T`. */ function importTypeSpecifier(node: Node): string | undefined { - if (node.type !== 'TSImportType') return undefined - const argument = node.argument as Node - return stringValue(argument.type === 'TSLiteralType' ? argument.literal : argument) + return node.type === 'TSImportType' ? stringValue(node.source) : undefined } function findRelativeImports(file: string, program: Node): Violation[] { diff --git a/scripts/check-sql-date-binding.ts b/scripts/check-sql-date-binding.ts index 3078a7b89db..c1fab8e89e2 100644 --- a/scripts/check-sql-date-binding.ts +++ b/scripts/check-sql-date-binding.ts @@ -254,27 +254,12 @@ function collectSqlBindings(program: SyntaxNode): SqlBindings { return bindings } -/** - * `import('drizzle-orm')`, with or without an `await`. - * - * Babel parses a dynamic import as a `CallExpression` whose callee is `Import`; - * the `ImportExpression` spelling is accepted too so a parser upgrade cannot - * silently reopen the hole this closes. - */ +/** `import('drizzle-orm')`, with or without an `await`. */ function isDrizzleImportCall(node: unknown): boolean { if (!isSyntaxNode(node)) return false const current = node.type === 'AwaitExpression' ? unwrapAwait(node) : node - if (!isSyntaxNode(current)) return false - const isImport = - current.type === 'ImportExpression' || - (current.type === 'CallExpression' && - isSyntaxNode(current.callee) && - current.callee.type === 'Import') - if (!isImport) return false - const args = Array.isArray(current.arguments) ? current.arguments : [] - const source = isSyntaxNode(current.source) ? current.source : args.find(isSyntaxNode) - const value = source?.value - return isDrizzleModule(value) + if (!isSyntaxNode(current) || current.type !== 'ImportExpression') return false + return isSyntaxNode(current.source) && isDrizzleModule(current.source.value) } const unwrapAwait = (node: SyntaxNode): unknown => diff --git a/scripts/check-test-patterns.ts b/scripts/check-test-patterns.ts index 622bfba77ab..21485a71e45 100644 --- a/scripts/check-test-patterns.ts +++ b/scripts/check-test-patterns.ts @@ -589,12 +589,7 @@ function centralMockName( /** A dynamic `import('@sim/testing/…')`. */ function importsTesting(node: Node | undefined): boolean { - const source = - node?.type === 'CallExpression' && (node.callee as Node).type === 'Import' - ? (node.arguments as Node[])[0] - : node?.type === 'ImportExpression' - ? (node.source as Node) - : undefined + const source = node?.type === 'ImportExpression' ? (node.source as Node) : undefined return ( source?.type === 'StringLiteral' && (source as { value: string }).value.startsWith('@sim/testing')