feat(module-source): fix types, expose analyzer.js subpath#3218
Draft
boneskull wants to merge 1 commit intoboneskull/evasive-pipeline2from
Draft
feat(module-source): fix types, expose analyzer.js subpath#3218boneskull wants to merge 1 commit intoboneskull/evasive-pipeline2from
boneskull wants to merge 1 commit intoboneskull/evasive-pipeline2from
Conversation
Member
Author
|
Warning This PR is part of a stack and targets branch 📚 Pull Request Stack
Managed by gh-stack |
🦋 Changeset detectedLatest commit: c604f08 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
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 |
This was referenced Apr 30, 2026
b72e412 to
0041c99
Compare
124c871 to
a993aef
Compare
0041c99 to
3f047de
Compare
a993aef to
29ff6f4
Compare
Introduces a low-level analysis primitive `analyzeModule` which is exported from the `analyzer.js` subpath.
- Adds `src/types/external.ts` as a single re-export index for the public types (`SourceMapHook`, `SourceMapHookDetails`, `SourceMapObject`, `ModuleSourceOptions`) and the new analyzer types. `src/external.types.d.ts` now delegates to it.
- Adds `src/types/analyzer.ts` with `AnalysisContext<T>`, `ModuleAnalysisContext`, `AnalysisOptions`, and `VisitorPlugin` — typed by `tsc` rather than inferred from JSDoc.
- Adds `src/shim.types.d.ts` for the global `ModuleSource` augmentation used by the SES shim.
- `tsconfig.json` is tightened: `stripInternal` removes `@internal` declarations from emitted `.d.ts` files.
- Update `typedoc.json` to also consider the additional entry points
- We no longer need to provide custom `@babel/types` exports to these functions. So, `makeModulePlugins` and `makeCjsModulePlugins` no longer return `PluginFactory` functions (`({ types }) => ({ visitor })`). Both now return plain `{ analyzePlugin: { visitor }, transformPlugin: { visitor } }` objects with `@babel/types` imported at module scope. `transform-source.js` is updated accordingly.
- Benchmark and test fixture updated for the new API shape.
- Adds `./analyzer.js` as a new package export. The `analyzeModule(options?)` function creates a fresh per-parse context with `analyzePass` / `transformPass` (plain `Visitor` objects) and `buildRecord(code, location)`. The same function powers the `ModuleSource` constructor internally. This will be consumed by the forthcoming `@endo/parser-pipeline`.
3f047de to
2b97a5e
Compare
29ff6f4 to
c604f08
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces a low-level analysis primitive
analyzeModulewhich is exported from theanalyzer.jssubpath.Adds
src/types/external.tsas a single re-export index for the public types (SourceMapHook,SourceMapHookDetails,SourceMapObject,ModuleSourceOptions) and the new analyzer types.src/external.types.d.tsnow delegates to it.Adds
src/types/analyzer.tswithAnalysisContext<T>,ModuleAnalysisContext,AnalysisOptions, andVisitorPlugin— typed bytscrather than inferred from JSDoc.Adds
src/shim.types.d.tsfor the globalModuleSourceaugmentation used by the SES shim.tsconfig.jsonis tightened:stripInternalremoves@internaldeclarations from emitted.d.tsfiles.Update
typedoc.jsonto also consider the additional entry pointsWe no longer need to provide custom
@babel/typesexports to these functions. So,makeModulePluginsandmakeCjsModulePluginsno longer returnPluginFactoryfunctions (({ types }) => ({ visitor })). Both now return plain{ analyzePlugin: { visitor }, transformPlugin: { visitor } }objects with@babel/typesimported at module scope.transform-source.jsis updated accordingly.Benchmark and test fixture updated for the new API shape.
Adds
./analyzer.jsas a new package export. TheanalyzeModule(options?)function creates a fresh per-parse context withanalyzePass/transformPass(plainVisitorobjects) andbuildRecord(code, location). The same function powers theModuleSourceconstructor internally. This will be consumed by the forthcoming@endo/parser-pipeline.