feat(evasive-transform): expose makeEvasiveTransformVisitor#3217
feat(evasive-transform): expose makeEvasiveTransformVisitor#3217boneskull wants to merge 1 commit into
Conversation
📚 Pull Request Stack
Managed by gh-stack |
🦋 Changeset detectedLatest commit: ce5b1cc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
b72e412 to
0041c99
Compare
0e4addb to
80a974c
Compare
0041c99 to
3f047de
Compare
80a974c to
d47070d
Compare
3f047de to
2b97a5e
Compare
d47070d to
6e65a53
Compare
2b97a5e to
cc633e8
Compare
6e65a53 to
cef6137
Compare
cc633e8 to
58609c1
Compare
There was a problem hiding this comment.
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
makeEvasiveTransformVisitorvia a newvisitor.jsentrypoint and refactortransformAstto use it. - Extend
SourceTypewithcommonjsand adjustparseAst’sallowReturnOutsideFunctionbehavior. - Type/JSDoc and build tidy-ups (remove
SourceMapOption, addstripInternal, 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.
| allowReturnOutsideFunction: | ||
| opts.sourceType === 'script' || opts.sourceType === 'commonjs', | ||
| ...(opts.sourceType !== undefined && { sourceType: opts.sourceType }), | ||
| }); |
There was a problem hiding this comment.
This is incorrect; commonjs is an allowed value (and is in fact preferred over script for our use-case).
cef6137 to
2464145
Compare
58609c1 to
9725c9a
Compare
9725c9a to
82706e8
Compare
2464145 to
f8ae9f3
Compare
82706e8 to
933188b
Compare
f8ae9f3 to
f7c5375
Compare
933188b to
6f77dc7
Compare
f7c5375 to
8975d6a
Compare
6f77dc7 to
1d7eeb4
Compare
8975d6a to
8101f56
Compare
1d7eeb4 to
2df8ad0
Compare
8101f56 to
fe28002
Compare
2df8ad0 to
0ac5359
Compare
a63baeb to
8ef1ce3
Compare
0ac5359 to
ba8cedb
Compare
8ef1ce3 to
9ba12b8
Compare
ba8cedb to
b66011e
Compare
9ba12b8 to
5aa2a37
Compare
b66011e to
3b71436
Compare
5aa2a37 to
d5be9d8
Compare
3b71436 to
25002f8
Compare
25002f8 to
a0b6ba7
Compare
a0b6ba7 to
868963d
Compare
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)
868963d to
ce5b1cc
Compare
naugtur
left a comment
There was a problem hiding this comment.
I have read and understood the changes and they are correct.
Extracts
makeTransformCommentsVisitorfromtransformAstand exports it via a new./visitor.jssubpath.transformAstis reimplemented as a thin wrapper that callsmakeTransformCommentsVisitorand traverses — no logic change, just inversion of control.Additional tidy-ups in the same diff:
SourceTypenow includescommonjs, andparseAstpassesallowReturnOutsideFunction: truefor that source type (which it does by default, if we didn't have it being set forscriptas well)SourceMapOptiontype removed; its usages are replaced withobject | string(actual referenced type does not exist)import()type references in JSDoc replaced with@importdeclarations at the top of each file.stripInternal: trueadded totsconfig.jsonso@internalitems are excluded from generated.d.tsoutput.@types/babel__generatorand@types/babel__traverse(prod) added as dependencies (they were missing)