Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/publish-sim-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/cli/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 34 additions & 10 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/sim-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions packages/sim-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions packages/workflow-code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
".": {
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 7 additions & 2 deletions packages/workflow-code/src/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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
}
Expand Down
9 changes: 6 additions & 3 deletions packages/workflow-code/src/code-files/from-file.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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)) {
Expand All @@ -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
Expand Down
8 changes: 5 additions & 3 deletions packages/workflow-code/src/compile/function-returns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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}`]
Expand Down Expand Up @@ -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') &&
Expand Down
1 change: 0 additions & 1 deletion packages/workflow-code/src/compile/hints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions packages/workflow-code/src/compile/values.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type {
ArrayExpression,
CallExpression,
Expression,
MemberExpression,
Node,
ObjectExpression,
Expand Down Expand Up @@ -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') {
Expand Down
2 changes: 1 addition & 1 deletion packages/workflow-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
".": {
Expand Down
6 changes: 3 additions & 3 deletions packages/workspace-code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
".": {
Expand Down Expand Up @@ -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",
Expand Down
Loading
Loading