Skip to content

feat(evasive-transform): expose makeEvasiveTransformVisitor#3217

Open
boneskull wants to merge 1 commit into
masterfrom
boneskull/evasive-pipeline2
Open

feat(evasive-transform): expose makeEvasiveTransformVisitor#3217
boneskull wants to merge 1 commit into
masterfrom
boneskull/evasive-pipeline2

Conversation

@boneskull

Copy link
Copy Markdown
Member

Extracts makeTransformCommentsVisitor from transformAst and exports it via a new ./visitor.js subpath.

transformAst is reimplemented as a thin wrapper that calls makeTransformCommentsVisitor and traverses — no logic change, just inversion of control.

Additional tidy-ups in the same diff:

  • SourceType now includes commonjs, and parseAst passes allowReturnOutsideFunction: true for that source type (which it does by default, if we didn't have it being set for script as well)
  • SourceMapOption type removed; its usages are replaced with object | string (actual referenced type does not exist)
  • Inline import() type references in JSDoc replaced with @import declarations at the top of each file.
  • stripInternal: true added to tsconfig.json so @internal items are excluded from generated .d.ts output.
  • @types/babel__generator and @types/babel__traverse (prod) added as dependencies (they were missing)

@boneskull

boneskull commented Apr 30, 2026

Copy link
Copy Markdown
Member Author

📚 Pull Request Stack


Managed by gh-stack

@changeset-bot

changeset-bot Bot commented Apr 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ce5b1cc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@endo/evasive-transform Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@boneskull boneskull self-assigned this Apr 30, 2026
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from b72e412 to 0041c99 Compare April 30, 2026 02:05
@boneskull boneskull added enhancement New feature or request lavamoat labels Apr 30, 2026
@boneskull boneskull force-pushed the boneskull/async-parser branch from 0e4addb to 80a974c Compare May 5, 2026 18:00
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 0041c99 to 3f047de Compare May 5, 2026 18:00
@boneskull boneskull force-pushed the boneskull/async-parser branch from 80a974c to d47070d Compare May 5, 2026 20:07
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 3f047de to 2b97a5e Compare May 5, 2026 20:07
@boneskull boneskull force-pushed the boneskull/async-parser branch from d47070d to 6e65a53 Compare May 7, 2026 17:38
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 2b97a5e to cc633e8 Compare May 7, 2026 17:38
@boneskull boneskull force-pushed the boneskull/async-parser branch from 6e65a53 to cef6137 Compare May 12, 2026 23:27
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from cc633e8 to 58609c1 Compare May 12, 2026 23:27
@boneskull boneskull requested review from Copilot and naugtur May 19, 2026 23:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes a new low-level Babel visitor factory from @endo/evasive-transform via a visitor.js subpath, refactoring transformAst into a wrapper that constructs the visitor and then traverses the AST. It also includes type/JSDoc cleanups, adjusts parser options for an added commonjs source type, and tweaks TypeScript declaration generation.

Changes:

  • Extract and export makeEvasiveTransformVisitor via a new visitor.js entrypoint and refactor transformAst to use it.
  • Extend SourceType with commonjs and adjust parseAst’s allowReturnOutsideFunction behavior.
  • Type/JSDoc and build tidy-ups (remove SourceMapOption, add stripInternal, add missing Babel @types/* deps).

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
yarn.lock Adds lock entries for @types/babel__generator / @types/babel__traverse and their transitive deps.
packages/evasive-transform/visitor.js Adds a top-level entrypoint re-exporting the visitor factory.
packages/evasive-transform/tsconfig.json Enables stripInternal for generated declarations.
packages/evasive-transform/src/visitor.js Introduces src entrypoint exporting the visitor factory from transform-ast.js.
packages/evasive-transform/src/transform-code.js JSDoc @import refactor and minor internal cleanup in transforms.
packages/evasive-transform/src/transform-ast.js Extracts visitor factory and makes transformAst a wrapper around traverse + visitor.
packages/evasive-transform/src/parse-ast.js Adds commonjs to SourceType and adjusts parse options.
packages/evasive-transform/src/index.js Replaces removed SourceMapOption usage with `object
packages/evasive-transform/src/generate.js Removes SourceMapOption typedef; minor doc formatting; TS suppression for inputSourceMap.
packages/evasive-transform/package.json Exposes ./visitor.js subpath and adds Babel @types/* dependencies.
.changeset/itchy-meteors-cover.md Declares a minor bump and documents the new entrypoint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +40 to 43
allowReturnOutsideFunction:
opts.sourceType === 'script' || opts.sourceType === 'commonjs',
...(opts.sourceType !== undefined && { sourceType: opts.sourceType }),
});

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect; commonjs is an allowed value (and is in fact preferred over script for our use-case).

Comment thread packages/evasive-transform/package.json Outdated
Comment thread .changeset/itchy-meteors-cover.md
Comment thread packages/evasive-transform/visitor.js
@boneskull boneskull force-pushed the boneskull/async-parser branch from cef6137 to 2464145 Compare May 20, 2026 01:21
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 58609c1 to 9725c9a Compare May 20, 2026 01:21
@boneskull boneskull changed the title feat(evasive-transform): expose makeTransformCommentsVisitor feat(evasive-transform): expose makeEvasiveTransformVisitor May 20, 2026
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 9725c9a to 82706e8 Compare May 20, 2026 02:08
@boneskull boneskull force-pushed the boneskull/async-parser branch from 2464145 to f8ae9f3 Compare May 20, 2026 02:10
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 82706e8 to 933188b Compare May 20, 2026 02:10
@boneskull boneskull force-pushed the boneskull/async-parser branch from f8ae9f3 to f7c5375 Compare May 20, 2026 20:19
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 933188b to 6f77dc7 Compare May 20, 2026 20:19
@boneskull boneskull force-pushed the boneskull/async-parser branch from f7c5375 to 8975d6a Compare May 20, 2026 21:23
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 6f77dc7 to 1d7eeb4 Compare May 20, 2026 21:23
@boneskull boneskull force-pushed the boneskull/async-parser branch from 8975d6a to 8101f56 Compare May 21, 2026 21:43
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 1d7eeb4 to 2df8ad0 Compare May 21, 2026 21:43
@boneskull boneskull force-pushed the boneskull/async-parser branch from 8101f56 to fe28002 Compare May 22, 2026 21:47
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 2df8ad0 to 0ac5359 Compare May 22, 2026 21:47
@boneskull boneskull force-pushed the boneskull/async-parser branch from a63baeb to 8ef1ce3 Compare May 25, 2026 22:14
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 0ac5359 to ba8cedb Compare May 25, 2026 22:14
@boneskull boneskull force-pushed the boneskull/async-parser branch from 8ef1ce3 to 9ba12b8 Compare May 25, 2026 22:32
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from ba8cedb to b66011e Compare May 25, 2026 22:32
@boneskull boneskull force-pushed the boneskull/async-parser branch from 9ba12b8 to 5aa2a37 Compare May 26, 2026 02:22
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from b66011e to 3b71436 Compare May 26, 2026 02:22
@boneskull boneskull force-pushed the boneskull/async-parser branch from 5aa2a37 to d5be9d8 Compare May 29, 2026 00:41
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 3b71436 to 25002f8 Compare May 29, 2026 00:41
Base automatically changed from boneskull/async-parser to master May 29, 2026 01:06
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 25002f8 to a0b6ba7 Compare May 29, 2026 22:38
@boneskull boneskull marked this pull request as ready for review May 29, 2026 22:39
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from a0b6ba7 to 868963d Compare June 3, 2026 23:04
Extracts `makeEvasiveTransformVisitor ` from `transformAst` and exports it via a new `./visitor.js` subpath.

`transformAst` is reimplemented as a thin wrapper that calls `makeEvasiveTransformVisitor ` and traverses — no logic change, just inversion of control.

Additional tidy-ups in the same diff:

- `SourceType` now includes `commonjs`, and `parseAst` passes `allowReturnOutsideFunction: true` for that source type (which it does by default, if we didn't have it being set for `script` as well)
- `SourceMapOption` type removed; its usages are replaced with `object | string` (actual referenced type does not exist)
- Inline `import()` type references in JSDoc replaced with `@import` declarations at the top of each file.
- `stripInternal: true` added to `tsconfig.json` so `@internal` items are excluded from generated `.d.ts` output.
- `@types/babel__generator` and `@types/babel__traverse` (prod) added as dependencies (they were missing)
@boneskull boneskull force-pushed the boneskull/evasive-pipeline2 branch from 868963d to ce5b1cc Compare June 5, 2026 00:59

@naugtur naugtur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have read and understood the changes and they are correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lavamoat

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants