Files
rea/src/domain/javascript/javascriptSemanticExecutionPoints.ts
T
dependabot[bot]andVincent Koc 029ad60f4f chore(deps): update 37 npm pins and preserve capture and release behavior (#14231)
* chore(deps): bump the npm-minor-and-patch group across 2 directories with 38 updates

Bumps the npm-minor-and-patch group with 37 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@babel/parser](https://github.com/babel/babel/tree/HEAD/packages/babel-parser) | `8.0.4` | `8.1.2` |
| [@babel/types](https://github.com/babel/babel/tree/HEAD/packages/babel-types) | `8.0.4` | `8.1.2` |
| [@bufbuild/protobuf](https://github.com/bufbuild/protobuf-es/tree/HEAD/packages/protobuf) | `2.16.0` | `2.17.0` |
| [@clack/prompts](https://github.com/bombshell-dev/clack/tree/HEAD/packages/prompts) | `1.7.0` | `1.9.0` |
| [@zip.js/zip.js](https://github.com/gildas-lormeau/zip.js) | `2.15.0` | `2.25.0` |
| [evmole](https://github.com/cdump/evmole/tree/HEAD/javascript) | `0.9.3` | `0.9.4` |
| [ignore](https://github.com/kaelzhang/node-ignore) | `7.0.6` | `7.0.14` |
| [isomorphic-git](https://github.com/isomorphic-git/isomorphic-git) | `1.38.7` | `1.44.15` |
| [lossless-json](https://github.com/josdejong/lossless-json) | `4.3.1` | `4.3.3` |
| [parse5](https://github.com/inikulin/parse5) | `8.0.1` | `8.1.1` |
| [playwright-core](https://github.com/microsoft/playwright) | `1.64.1` | `1.65.1` |
| [plist](https://github.com/TooTallNate/plist.js) | `5.0.0` | `5.1.1` |
| [semver](https://github.com/npm/node-semver) | `7.8.5` | `7.8.6` |
| [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) | `7.7.1` | `7.8.0` |
| [smol-toml](https://github.com/squirrelchat/smol-toml) | `1.9.0` | `1.9.1` |
| [stream-chain](https://github.com/uhop/stream-chain) | `4.2.6` | `4.4.2` |
| [stream-json](https://github.com/uhop/stream-json) | `3.7.0` | `3.9.0` |
| [ws](https://github.com/websockets/ws) | `8.21.0` | `8.23.0` |
| [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) | `8.18.1` | `8.18.2` |
| [yaml](https://github.com/eemeli/yaml) | `2.9.0` | `2.9.1` |
| [zod](https://github.com/colinhacks/zod) | `4.6.6` | `4.6.7` |
| [@electron/asar](https://github.com/electron/asar) | `4.2.0` | `4.3.2` |
| [@stryker-mutator/core](https://github.com/stryker-mutator/stryker-js/tree/HEAD/packages/core) | `10.0.0` | `10.1.1` |
| [@stryker-mutator/typescript-checker](https://github.com/stryker-mutator/stryker-js/tree/HEAD/packages/typescript-checker) | `10.0.0` | `10.1.1` |
| [@stryker-mutator/vitest-runner](https://github.com/stryker-mutator/stryker-js/tree/HEAD/packages/vitest-runner) | `10.0.0` | `10.1.1` |
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `26.6.4` | `26.6.6` |
| [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) | `7.7.1` | `7.8.0` |
| [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) | `8.18.1` | `8.18.2` |
| [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) | `5.0.3` | `5.1.0` |
| [jscpd](https://github.com/kucherenko/jscpd/tree/HEAD/rust/jscpd) | `5.0.12` | `5.4.3` |
| [knip](https://github.com/webpro-nl/knip/tree/HEAD/packages/knip) | `6.39.0` | `6.45.1` |
| [oxfmt](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxfmt) | `0.72.0` | `0.79.0` |
| [oxlint](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxlint) | `1.87.0` | `1.94.0` |
| [oxlint-tsgolint](https://github.com/oxc-project/tsgolint) | `7.0.2005` | `7.0.2007` |
| [release-please](https://github.com/googleapis/release-please) | `17.3.0` | `17.11.2` |
| [rolldown](https://github.com/rolldown/rolldown/tree/HEAD/packages/rolldown) | `1.2.12` | `1.3.2` |
| [turbo](https://github.com/vercel/turborepo) | `2.11.7` | `2.11.11` |
| [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) | `5.0.3` | `5.1.0` |
| [frida](https://github.com/frida/frida-node) | `17.23.2` | `17.26.4` |

Bumps the npm-minor-and-patch group with 1 update in the /scripts/verify-tools/skills directory: [skills](https://github.com/vercel-labs/skills).


Updates `@babel/parser` from 8.0.4 to 8.1.2
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v8.1.2/packages/babel-parser)

Updates `@babel/types` from 8.0.4 to 8.1.2
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v8.1.2/packages/babel-types)

Updates `@bufbuild/protobuf` from 2.16.0 to 2.17.0
- [Release notes](https://github.com/bufbuild/protobuf-es/releases)
- [Commits](https://github.com/bufbuild/protobuf-es/commits/v2.17.0/packages/protobuf)

Updates `@clack/prompts` from 1.7.0 to 1.9.0
- [Release notes](https://github.com/bombshell-dev/clack/releases)
- [Changelog](https://github.com/bombshell-dev/clack/blob/main/packages/prompts/CHANGELOG.md)
- [Commits](https://github.com/bombshell-dev/clack/commits/@clack/prompts@1.9.0/packages/prompts)

Updates `@zip.js/zip.js` from 2.15.0 to 2.25.0
- [Release notes](https://github.com/gildas-lormeau/zip.js/releases)
- [Commits](https://github.com/gildas-lormeau/zip.js/compare/v2.15.0...v2.25.0)

Updates `evmole` from 0.9.3 to 0.9.4
- [Release notes](https://github.com/cdump/evmole/releases)
- [Commits](https://github.com/cdump/evmole/commits/0.9.4/javascript)

Updates `ignore` from 7.0.6 to 7.0.14
- [Release notes](https://github.com/kaelzhang/node-ignore/releases)
- [Commits](https://github.com/kaelzhang/node-ignore/compare/7.0.6...7.0.14)

Updates `isomorphic-git` from 1.38.7 to 1.44.15
- [Release notes](https://github.com/isomorphic-git/isomorphic-git/releases)
- [Commits](https://github.com/isomorphic-git/isomorphic-git/compare/v1.38.7...v1.44.15)

Updates `lossless-json` from 4.3.1 to 4.3.3
- [Changelog](https://github.com/josdejong/lossless-json/blob/main/CHANGELOG.md)
- [Commits](https://github.com/josdejong/lossless-json/compare/v4.3.1...v4.3.3)

Updates `parse5` from 8.0.1 to 8.1.1
- [Release notes](https://github.com/inikulin/parse5/releases)
- [Commits](https://github.com/inikulin/parse5/compare/v8.0.1...v8.1.1)

Updates `playwright-core` from 1.64.1 to 1.65.1
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.64.1...v1.65.1)

Updates `plist` from 5.0.0 to 5.1.1
- [Release notes](https://github.com/TooTallNate/plist.js/releases)
- [Changelog](https://github.com/TooTallNate/plist.js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TooTallNate/plist.js/compare/plist@5.0.0...plist@5.1.1)

Updates `semver` from 7.8.5 to 7.8.6
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.8.5...v7.8.6)

Updates `@types/semver` from 7.7.1 to 7.8.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver)

Updates `smol-toml` from 1.9.0 to 1.9.1
- [Release notes](https://github.com/squirrelchat/smol-toml/releases)
- [Commits](https://github.com/squirrelchat/smol-toml/compare/v1.9.0...v1.9.1)

Updates `stream-chain` from 4.2.6 to 4.4.2
- [Commits](https://github.com/uhop/stream-chain/compare/4.2.6...4.4.2)

Updates `stream-json` from 3.7.0 to 3.9.0
- [Commits](https://github.com/uhop/stream-json/compare/3.7.0...3.9.0)

Updates `ws` from 8.21.0 to 8.23.0
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/8.21.0...8.23.0)

Updates `@types/ws` from 8.18.1 to 8.18.2
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

Updates `yaml` from 2.9.0 to 2.9.1
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v2.9.0...v2.9.1)

Updates `zod` from 4.6.6 to 4.6.7
- [Release notes](https://github.com/colinhacks/zod/releases)
- [Commits](https://github.com/colinhacks/zod/compare/v4.6.6...v4.6.7)

Updates `@electron/asar` from 4.2.0 to 4.3.2
- [Release notes](https://github.com/electron/asar/releases)
- [Changelog](https://github.com/electron/asar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/electron/asar/compare/v4.2.0...v4.3.2)

Updates `@stryker-mutator/core` from 10.0.0 to 10.1.1
- [Release notes](https://github.com/stryker-mutator/stryker-js/releases)
- [Changelog](https://github.com/stryker-mutator/stryker-js/blob/master/packages/core/CHANGELOG.md)
- [Commits](https://github.com/stryker-mutator/stryker-js/commits/v10.1.1/packages/core)

Updates `@stryker-mutator/typescript-checker` from 10.0.0 to 10.1.1
- [Release notes](https://github.com/stryker-mutator/stryker-js/releases)
- [Changelog](https://github.com/stryker-mutator/stryker-js/blob/master/packages/typescript-checker/CHANGELOG.md)
- [Commits](https://github.com/stryker-mutator/stryker-js/commits/v10.1.1/packages/typescript-checker)

Updates `@stryker-mutator/vitest-runner` from 10.0.0 to 10.1.1
- [Release notes](https://github.com/stryker-mutator/stryker-js/releases)
- [Changelog](https://github.com/stryker-mutator/stryker-js/blob/master/packages/vitest-runner/CHANGELOG.md)
- [Commits](https://github.com/stryker-mutator/stryker-js/commits/v10.1.1/packages/vitest-runner)

Updates `@types/node` from 26.6.4 to 26.6.6
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `@types/semver` from 7.7.1 to 7.8.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver)

Updates `@types/ws` from 8.18.1 to 8.18.2
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

Updates `@vitest/coverage-v8` from 5.0.3 to 5.1.0
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md)
- [Commits](https://github.com/vitest-dev/vitest/commits/v5.1.0/packages/coverage-v8)

Updates `jscpd` from 5.0.12 to 5.4.3
- [Release notes](https://github.com/kucherenko/jscpd/releases)
- [Commits](https://github.com/kucherenko/jscpd/commits/v5.4.3/rust/jscpd)

Updates `knip` from 6.39.0 to 6.45.1
- [Release notes](https://github.com/webpro-nl/knip/releases)
- [Commits](https://github.com/webpro-nl/knip/commits/knip@6.45.1/packages/knip)

Updates `oxfmt` from 0.72.0 to 0.79.0
- [Release notes](https://github.com/oxc-project/oxc/releases)
- [Changelog](https://github.com/oxc-project/oxc/blob/main/npm/oxfmt/CHANGELOG.md)
- [Commits](https://github.com/oxc-project/oxc/commits/oxfmt_v0.79.0/npm/oxfmt)

Updates `oxlint` from 1.87.0 to 1.94.0
- [Release notes](https://github.com/oxc-project/oxc/releases)
- [Changelog](https://github.com/oxc-project/oxc/blob/main/npm/oxlint/CHANGELOG.md)
- [Commits](https://github.com/oxc-project/oxc/commits/oxlint_v1.94.0/npm/oxlint)

Updates `oxlint-tsgolint` from 7.0.2005 to 7.0.2007
- [Release notes](https://github.com/oxc-project/tsgolint/releases)
- [Commits](https://github.com/oxc-project/tsgolint/compare/v7.0.2005...v7.0.2007)

Updates `release-please` from 17.3.0 to 17.11.2
- [Release notes](https://github.com/googleapis/release-please/releases)
- [Changelog](https://github.com/googleapis/release-please/blob/main/CHANGELOG.md)
- [Commits](https://github.com/googleapis/release-please/compare/v17.3.0...v17.11.2)

Updates `rolldown` from 1.2.12 to 1.3.2
- [Release notes](https://github.com/rolldown/rolldown/releases)
- [Changelog](https://github.com/rolldown/rolldown/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rolldown/rolldown/commits/v1.3.2/packages/rolldown)

Updates `turbo` from 2.11.7 to 2.11.11
- [Release notes](https://github.com/vercel/turborepo/releases)
- [Changelog](https://github.com/vercel/turborepo/blob/main/RELEASE.md)
- [Commits](https://github.com/vercel/turborepo/compare/v2.11.7...v2.11.11)

Updates `vitest` from 5.0.3 to 5.1.0
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md)
- [Commits](https://github.com/vitest-dev/vitest/commits/v5.1.0/packages/vitest)

Updates `frida` from 17.23.2 to 17.26.4
- [Commits](https://github.com/frida/frida-node/compare/17.23.2...17.26.4)

Updates `skills` from 1.7.2 to 1.9.0
- [Release notes](https://github.com/vercel-labs/skills/releases)
- [Commits](https://github.com/vercel-labs/skills/compare/v1.7.2...v1.9.0)

---
updated-dependencies:
- dependency-name: "@babel/parser"
  dependency-version: 8.1.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: "@babel/types"
  dependency-version: 8.1.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: "@bufbuild/protobuf"
  dependency-version: 2.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: "@clack/prompts"
  dependency-version: 1.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: "@electron/asar"
  dependency-version: 4.3.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: "@stryker-mutator/core"
  dependency-version: 10.1.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: "@stryker-mutator/typescript-checker"
  dependency-version: 10.1.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: "@stryker-mutator/vitest-runner"
  dependency-version: 10.1.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: "@types/node"
  dependency-version: 26.6.6
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: "@types/semver"
  dependency-version: 7.8.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: "@types/semver"
  dependency-version: 7.8.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: "@types/ws"
  dependency-version: 8.18.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: "@types/ws"
  dependency-version: 8.18.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: "@vitest/coverage-v8"
  dependency-version: 5.1.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: "@zip.js/zip.js"
  dependency-version: 2.25.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: evmole
  dependency-version: 0.9.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: frida
  dependency-version: 17.26.4
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: ignore
  dependency-version: 7.0.14
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: isomorphic-git
  dependency-version: 1.44.15
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: jscpd
  dependency-version: 5.4.3
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: knip
  dependency-version: 6.45.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: lossless-json
  dependency-version: 4.3.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: oxfmt
  dependency-version: 0.79.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: oxlint
  dependency-version: 1.94.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: oxlint-tsgolint
  dependency-version: 7.0.2007
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: parse5
  dependency-version: 8.1.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: playwright-core
  dependency-version: 1.65.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: plist
  dependency-version: 5.1.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: release-please
  dependency-version: 17.11.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: rolldown
  dependency-version: 1.3.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: semver
  dependency-version: 7.8.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: skills
  dependency-version: 1.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: smol-toml
  dependency-version: 1.9.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: stream-chain
  dependency-version: 4.4.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: stream-json
  dependency-version: 3.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: turbo
  dependency-version: 2.11.11
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: vitest
  dependency-version: 5.1.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: ws
  dependency-version: 8.23.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: yaml
  dependency-version: 2.9.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: zod
  dependency-version: 4.6.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix(deps): adapt release tooling and capture metadata to the new npm pins

* fix(deps): preserve numeric, plist and archive evidence semantics

* test(zip): verify malformed compression with CRC checks enabled

* fix(capture): preserve exact decimal projections and redaction

* test(apple): verify keyed archive controls before altering the trailer

* test(lint): cover safe and suggested regex escape fixes

* fix(reference): preserve directory exclusion provenance with ignore 7

* docs(examples): refresh HAR evidence identities for the current decoder

* fix(reference): preserve metadata failures with strict Git ref reads

* chore(config): remove the unused MCP profile type alias

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-11-24 21:26:48 +08:00

603 lines
20 KiB
TypeScript

import * as t from "@babel/types";
import {
javaScriptComputedDefinitionKey,
semanticWriteSiteReadsFirst,
semanticWriteSiteTarget,
semanticWriteTargets,
unwrapJavaScriptExpression,
} from "./javascriptAstValues.js";
import { childNodes } from "./javascriptSemanticTraversal.js";
/**
* How evaluating one syntax node can run code that the analyzed source does
* not spell as a call. Each kind names the language mechanism; operands are
* the values that mechanism exposes to the code it may run.
*
* - `call`, `construction`, `tagged-template`: explicit invocation. Direct
* `eval` is a `call`; its rebinding authority belongs to the opaque-effect
* owner because it depends on scope resolution, not syntax.
* - `property-read`, `property-write`: accessors (and Proxy traps) on member
* reads and on member or destructuring stores. Member nodes that are only
* written are still listed as reads; the enclosing `property-write`
* identifies them through its target.
* - `destructuring`, `property-copy`: getters run by object patterns and by
* object spread/rest. Projections belong to `semanticPropertyReadSources`.
* - `iteration`: the iterator protocol (for-of, array spread, spread
* arguments, array patterns, `yield*`).
* - `enumeration`: for-in enumeration may invoke Proxy traps.
* - `thenable`: `await` reads and calls `then` on its operand.
* - `suspension`: `yield` hands its operand to whoever resumes the generator.
* - `coercion`: user-defined primitive conversion and operator hooks
* (`Symbol.toPrimitive`, `valueOf`, `toString`, `Symbol.hasInstance`).
* - `disposal`: `using` declarations call `Symbol.dispose` at scope exit.
* - `class-definition`: heritage, computed keys, static blocks and static
* field values run when a class is defined.
* - `decorator`: a class definition calls its decorators with the class or
* its members.
* - `dynamic-import`: `import()` converts its specifier and reads its options.
* - `dynamic-scope`: identifier lookups inside `with` read object properties.
* - `jsx-element`: JSX compiles to a call into the configured runtime.
* - `module-evaluation`: static imports and re-exports evaluate other modules
* before this module body runs.
* - `unsupported-syntax`: proposal or flow-runtime syntax the parser does not
* enable; it may run code in ways this table does not describe.
*/
export type JavaScriptExecutionKind =
| "call"
| "construction"
| "tagged-template"
| "property-read"
| "property-write"
| "destructuring"
| "property-copy"
| "iteration"
| "enumeration"
| "thenable"
| "suspension"
| "coercion"
| "disposal"
| "class-definition"
| "decorator"
| "dynamic-import"
| "dynamic-scope"
| "jsx-element"
| "module-evaluation"
| "unsupported-syntax";
export type JavaScriptExecution =
| {
readonly kind: "property-write";
readonly node: t.Node;
readonly operands: readonly t.Node[];
/** The direct or destructuring target, from the write-site owner. */
readonly target: t.Node;
/** Whether the site reads the previous target value before writing. */
readonly readsFirst: boolean;
}
| {
readonly kind: Exclude<JavaScriptExecutionKind, "property-write">;
readonly node: t.Node;
readonly operands: readonly t.Node[];
};
export interface JavaScriptExecutionOptions {
/**
* Proof that an operand is an object. Loose equality between two objects
* compares identity and performs no conversion.
*/
readonly isObject?: (operand: t.Node) => boolean;
}
type Classifier<Node extends t.Node> = (
node: Node,
parent: t.Node | null,
options: JavaScriptExecutionOptions,
) => readonly JavaScriptExecution[];
/** Syntax with no runtime representation: TypeScript and Flow type nodes. */
type TypeOnlyNode = Exclude<
t.Flow | t.TSType | t.TSTypeElement,
t.EnumDeclaration
>;
type ClassifiedType = Exclude<t.Node["type"], TypeOnlyNode["type"]>;
const typeOnlyAliases = ["Flow", "TSType", "TSTypeElement"] as const;
const none = (): readonly JavaScriptExecution[] => [];
const execution = (
kind: Exclude<JavaScriptExecutionKind, "property-write">,
node: t.Node,
operands: readonly (t.Node | null | undefined)[],
): JavaScriptExecution => ({
kind,
node,
operands: operands.filter((operand): operand is t.Node => operand != null),
});
const memberReceiver = (callee: t.Node): t.Node | undefined => {
const expression = unwrapJavaScriptExpression(callee).node;
return t.isMemberExpression(expression) ||
t.isOptionalMemberExpression(expression)
? expression.object
: undefined;
};
const argumentValues = (
values: readonly (t.Node | null)[],
): readonly t.Node[] =>
values.flatMap((value) =>
value === null ? [] : [t.isSpreadElement(value) ? value.argument : value],
);
/** Member stores may run setters on their receivers; binding stores cannot. */
const writeSite = (node: t.Node): readonly JavaScriptExecution[] => {
const target = semanticWriteSiteTarget(node);
if (target === null) return [];
const receivers = [...semanticWriteTargets(target)].flatMap((leaf) =>
t.isIdentifier(leaf) ? [] : [leaf.object],
);
return receivers.length === 0
? []
: [
{
kind: "property-write",
node,
target,
readsFirst: semanticWriteSiteReadsFirst(node),
operands: receivers,
},
];
};
/** Pattern-owning sites evaluate getters or the iterator of their source. */
const patternSource = (
node: t.Node,
pattern: t.Node,
source: t.Node | null | undefined,
): readonly JavaScriptExecution[] =>
t.isObjectPattern(pattern)
? [execution("destructuring", node, [source])]
: t.isArrayPattern(pattern)
? [execution("iteration", node, [source])]
: [];
/** User-defined primitive conversion and operator hooks for one node. */
const coercionOperands = (
node: t.Node,
parent: t.Node | null,
isObject: (operand: t.Node) => boolean,
): readonly t.Node[] => {
if (t.isBinaryExpression(node)) {
if (["===", "!=="].includes(node.operator)) return [];
if (node.operator === "instanceof") return [node.left, node.right];
if (
["==", "!="].includes(node.operator) &&
((t.isThisExpression(node.left) && t.isThisExpression(node.right)) ||
(isObject(node.left) && isObject(node.right)))
)
return [];
return node.operator === "in" ? [node.left] : [node.left, node.right];
}
if (t.isUnaryExpression(node) && ["+", "-", "~"].includes(node.operator))
return [node.argument];
if (t.isUpdateExpression(node)) return [node.argument];
if (
t.isAssignmentExpression(node) &&
!["=", "&&=", "||=", "??="].includes(node.operator)
)
return [node.left, node.right];
if (
(t.isMemberExpression(node) ||
t.isOptionalMemberExpression(node) ||
t.isObjectProperty(node) ||
t.isObjectMethod(node) ||
t.isClassProperty(node) ||
t.isClassMethod(node) ||
t.isClassAccessorProperty(node)) &&
node.computed
)
return [
t.isMemberExpression(node) || t.isOptionalMemberExpression(node)
? node.property
: node.key,
];
if (t.isTemplateLiteral(node) && !t.isTaggedTemplateExpression(parent))
return node.expressions;
return [];
};
const coercion: Classifier<t.Node> = (node, parent, options) => {
const operands = coercionOperands(
node,
parent,
options.isObject ?? (() => false),
);
return operands.length === 0 ? [] : [execution("coercion", node, operands)];
};
/** Spread arguments are iterated before the call; consumers that model the
* iterator protocol read them from the invocation node. */
const call: Classifier<t.CallExpression | t.OptionalCallExpression> = (
node,
) => [
execution("call", node, [
memberReceiver(node.callee),
...argumentValues(node.arguments),
]),
];
const member: Classifier<t.MemberExpression | t.OptionalMemberExpression> = (
node,
parent,
options,
) => [
execution("property-read", node, [node.object]),
...coercion(node, parent, options),
];
const computedMember: Classifier<t.Node> = coercion;
/** Decorators on the class and its members, called with the class definition. */
const classDecorators = (node: t.Class): readonly t.Decorator[] => [
...(node.decorators ?? []),
...node.body.body.flatMap((member) =>
"decorators" in member ? (member.decorators ?? []) : [],
),
];
/** Members whose computed keys a definition evaluates and converts immediately. */
const computedDefinitionMembers = (node: t.Function | t.Class): t.Node[] => {
if (t.isObjectMethod(node))
return javaScriptComputedDefinitionKey(node, node.key) ? [node] : [];
if (!t.isClass(node)) return [];
return node.body.body.filter(
(member) =>
"key" in member && javaScriptComputedDefinitionKey(member, member.key),
);
};
/**
* Expressions a definition runs immediately: heritage, computed keys,
* decorators, static blocks and static field values. Deferred bodies and instance initializers
* stay out; `this` inside static work is the class, not the enclosing receiver.
*/
export const javaScriptDefinitionTimeExpressions = (
node: t.Function | t.Class,
): t.Node[] => [
...(t.isClass(node) && node.superClass != null ? [node.superClass] : []),
...computedDefinitionMembers(node).flatMap((member) =>
"key" in member ? [member.key] : [],
),
...(t.isClass(node) ? classDecorators(node) : []),
...(t.isClass(node)
? node.body.body.flatMap((member): t.Node[] =>
t.isStaticBlock(member)
? [member]
: (t.isClassProperty(member) || t.isClassPrivateProperty(member)) &&
member.static &&
member.value != null
? [member.value]
: [],
)
: []),
];
/** Computed definition keys converted when a function or class is defined. */
export const javaScriptDefinitionKeyCoercions = (
node: t.Function | t.Class,
): readonly t.Node[] =>
computedDefinitionMembers(node).flatMap((member) =>
coercionOperands(member, node, () => false),
);
const classDefinition: Classifier<t.ClassDeclaration | t.ClassExpression> = (
node,
) => [
// Evaluating heritage reads `prototype` from the superclass.
execution("class-definition", node, [node.superClass]),
// Each decorator is called with the class or one of its members, and a
// member decorator reaches the member's function or initializer, including
// an instance member the class itself does not run.
...(classDecorators(node).length === 0
? []
: [
execution("decorator", node, [
node,
...node.body.body.flatMap((member): t.Node[] =>
!("decorators" in member) || (member.decorators ?? []).length === 0
? []
: t.isClassMethod(member) || t.isClassPrivateMethod(member)
? [member]
: "value" in member &&
member.value !== null &&
member.value !== undefined
? [member.value]
: [],
),
]),
]),
];
const jsxElement: Classifier<t.JSXElement | t.JSXFragment> = (node) => {
const operands: t.Node[] = [];
const attributes = t.isJSXElement(node) ? node.openingElement.attributes : [];
for (const attribute of attributes)
if (t.isJSXSpreadAttribute(attribute)) operands.push(attribute.argument);
else if (t.isJSXExpressionContainer(attribute.value))
operands.push(attribute.value.expression);
for (const child of node.children)
if (t.isJSXExpressionContainer(child) || t.isJSXSpreadChild(child))
operands.push(child.expression);
return [
execution(
"jsx-element",
node,
operands.filter((operand) => !t.isJSXEmptyExpression(operand)),
),
];
};
/** Syntax this table does not describe exposes every operand it holds. */
const unsupported: Classifier<t.Node> = (node) => [
execution("unsupported-syntax", node, childNodes(node)),
];
const moduleEvaluation: Classifier<t.Node> = (node) => [
execution("module-evaluation", node, []),
];
/**
* One classifier per runtime Babel node type. The mapped type makes a new
* Babel node type a compile error.
*/
const classifiers: {
readonly [Type in ClassifiedType]: Classifier<
Extract<t.Node, { type: Type }>
>;
} = {
// Programs, statements and declarations without implicit work.
File: none,
Program: none,
InterpreterDirective: none,
Directive: none,
DirectiveLiteral: none,
BlockStatement: none,
BreakStatement: none,
ContinueStatement: none,
DebuggerStatement: none,
DoWhileStatement: none,
EmptyStatement: none,
ExpressionStatement: none,
ForStatement: none,
IfStatement: none,
LabeledStatement: none,
ReturnStatement: none,
// Strict-equality case matching performs no conversion.
SwitchStatement: none,
SwitchCase: none,
ThrowStatement: none,
TryStatement: none,
CatchClause: (node) =>
node.param == null ? [] : patternSource(node, node.param, undefined),
WhileStatement: none,
VariableDeclaration: none,
StaticBlock: none,
ClassBody: none,
// Literals and plain references.
StringLiteral: none,
NumericLiteral: none,
NullLiteral: none,
BooleanLiteral: none,
RegExpLiteral: none,
BigIntLiteral: none,
TemplateElement: none,
// A binding lookup itself is plain; `with` lookups are `dynamic-scope`.
Identifier: none,
ThisExpression: none,
Super: none,
MetaProperty: none,
PrivateName: none,
// Expressions whose own evaluation is plain; operands classify separately.
ArrayExpression: none,
ObjectExpression: none,
ConditionalExpression: none,
LogicalExpression: none,
SequenceExpression: none,
ParenthesizedExpression: none,
ArrowFunctionExpression: none,
FunctionDeclaration: none,
FunctionExpression: none,
ClassPrivateMethod: none,
ClassPrivateProperty: none,
// Pattern leaves; their sources are classified at the owning site.
AssignmentPattern: none,
ArrayPattern: none,
ObjectPattern: none,
RestElement: (node, parent) =>
t.isObjectPattern(parent) ? [execution("property-copy", node, [])] : [],
VoidPattern: none,
// Module syntax.
ImportDeclaration: moduleEvaluation,
ExportAllDeclaration: moduleEvaluation,
ExportNamedDeclaration: (node, parent, options) =>
node.source == null ? none() : moduleEvaluation(node, parent, options),
ExportDefaultDeclaration: none,
ExportSpecifier: none,
ExportDefaultSpecifier: none,
ExportNamespaceSpecifier: none,
ImportDefaultSpecifier: none,
ImportNamespaceSpecifier: none,
ImportSpecifier: none,
ImportAttribute: none,
Import: none,
ImportExpression: (node) => [
execution("dynamic-import", node, [node.source, node.options]),
],
// Explicit invocation.
CallExpression: call,
OptionalCallExpression: call,
NewExpression: (node) => [
execution("construction", node, argumentValues(node.arguments)),
],
TaggedTemplateExpression: (node) => [
execution("tagged-template", node, [
memberReceiver(node.tag),
...node.quasi.expressions,
]),
],
// Evaluating the decorator expression is ordinary; the class calls it.
Decorator: none,
// Accessors, conversion and protocols.
MemberExpression: member,
OptionalMemberExpression: member,
AssignmentExpression: (node, parent, options) => [
...writeSite(node),
...coercion(node, parent, options),
...patternSource(node, node.left, node.right),
],
UpdateExpression: (node, parent, options) => [
...writeSite(node),
...coercion(node, parent, options),
],
UnaryExpression: (node, parent, options) =>
node.operator === "delete"
? writeSite(node)
: coercion(node, parent, options),
BinaryExpression: coercion,
TemplateLiteral: coercion,
ObjectProperty: computedMember,
ObjectMethod: computedMember,
ClassMethod: computedMember,
ClassProperty: computedMember,
ClassAccessorProperty: computedMember,
ForInStatement: (node) => [
...writeSite(node),
execution("enumeration", node, [node.right]),
],
ForOfStatement: (node) => [
...writeSite(node),
execution(node.await ? "thenable" : "iteration", node, [node.right]),
],
SpreadElement: (node, parent) =>
t.isObjectExpression(parent)
? [execution("property-copy", node, [node.argument])]
: t.isArrayExpression(parent)
? [execution("iteration", node, [node.argument])]
: // Call and construction arguments: classified by the invocation.
[],
VariableDeclarator: (node, parent) => [
...(t.isVariableDeclaration(parent) &&
(parent.kind === "using" || parent.kind === "await using")
? [execution("disposal", node, [node.init ?? node.id])]
: []),
...patternSource(node, node.id, node.init),
],
AwaitExpression: (node) => [execution("thenable", node, [node.argument])],
YieldExpression: (node) => [
execution(node.delegate ? "iteration" : "suspension", node, [
node.argument,
]),
],
ClassDeclaration: classDefinition,
ClassExpression: classDefinition,
WithStatement: (node) => [execution("dynamic-scope", node, [node.object])],
// JSX: the element is the runtime call; its parts are its operands.
JSXElement: jsxElement,
JSXFragment: jsxElement,
JSXAttribute: none,
JSXClosingElement: none,
JSXEmptyExpression: none,
JSXExpressionContainer: none,
JSXSpreadChild: none,
JSXIdentifier: none,
JSXMemberExpression: none,
JSXNamespacedName: none,
JSXOpeningElement: none,
JSXSpreadAttribute: none,
JSXText: none,
JSXOpeningFragment: none,
JSXClosingFragment: none,
// TypeScript declarations and erased wrappers.
TSAsExpression: none,
TSSatisfiesExpression: none,
TSTypeAssertion: none,
TSNonNullExpression: none,
TSInstantiationExpression: none,
TSDeclareFunction: none,
TSDeclareMethod: none,
TSInterfaceDeclaration: none,
TSInterfaceBody: none,
TSTypeAliasDeclaration: none,
TSTypeAnnotation: none,
TSTypeParameterInstantiation: none,
TSTypeParameterDeclaration: none,
TSTypeParameter: none,
TSQualifiedName: none,
TSNamespaceExportDeclaration: none,
TSExportAssignment: none,
TSExternalModuleReference: none,
TSEnumDeclaration: none,
TSEnumBody: none,
TSEnumMember: none,
TSModuleDeclaration: none,
TSModuleBlock: none,
// `import x = require(...)` evaluates a module; `import x = N.y` reads N.y.
TSImportEqualsDeclaration: (node) => [
t.isTSExternalModuleReference(node.moduleReference)
? execution("module-evaluation", node, [])
: execution("property-read", node, []),
],
// Assignment semantics store the parameter on `this`.
TSParameterProperty: (node) => [
{
kind: "property-write",
node,
target: node.parameter,
readsFirst: false,
operands: [],
},
],
// Deprecated Babel 6 spellings the parser no longer produces.
NumberLiteral: none,
RegexLiteral: none,
RestProperty: (node) => [execution("property-copy", node, [])],
SpreadProperty: (node) => [execution("property-copy", node, [node.argument])],
// Flow enums compile to a runtime call; the parser enables no Flow syntax.
EnumDeclaration: unsupported,
// Proposals the parser does not enable.
Placeholder: unsupported,
V8IntrinsicIdentifier: unsupported,
ArgumentPlaceholder: unsupported,
BindExpression: unsupported,
DoExpression: unsupported,
ModuleExpression: unsupported,
TopicReference: unsupported,
StructBody: unsupported,
StructDeclaration: unsupported,
};
const isTypeOnly = (node: t.Node): node is TypeOnlyNode =>
!t.isEnumDeclaration(node) &&
typeOnlyAliases.some((alias) => t.is(alias, node));
/**
* The single owner for "may evaluating this node run code it does not spell
* as a call". An empty result is a proof that the node's own evaluation runs
* no user code; operands still classify separately. Unknown node types are
* classified as unsupported syntax rather than as inert.
*/
export const javaScriptExecutions = (
node: t.Node,
parent: t.Node | null,
options: JavaScriptExecutionOptions = {},
): readonly JavaScriptExecution[] => {
if (isTypeOnly(node)) return [];
const classify = (classifiers as Partial<Record<string, Classifier<t.Node>>>)[
node.type
];
return classify === undefined
? unsupported(node, parent, options)
: classify(node, parent, options);
};