Skip to content

feat(compartment-mapper): expose findUnknownCanonicalNames()#3205

Merged
boneskull merged 1 commit intoboneskull/ast-servicefrom
boneskull/export-find-canonical-names
Apr 30, 2026
Merged

feat(compartment-mapper): expose findUnknownCanonicalNames()#3205
boneskull merged 1 commit intoboneskull/ast-servicefrom
boneskull/export-find-canonical-names

Conversation

@boneskull
Copy link
Copy Markdown
Member

This exports a new function findUnknownCanonicalNames() from policy.js.

This function was extracted from the existing validatePolicyResources() in node-modules.js.

The use-case for this function is to help gather unknown canonical names in the case where mapNodeModules() is called without policy. Currently, policy is required for the unknownCanonicalNameHook to fire, which makes sense. Instead, we can use this new function to compare an arbitrary policy against the result of mapNodeModules().

Practically speaking, @lavamoat/node can use this to compare generated policy and/or policy overrides against the result of mapNodeModules().

@boneskull
Copy link
Copy Markdown
Member Author

Warning

This PR is part of a stack and targets branch boneskull/cjs-ast-parser, not master.
DO NOT MERGE until create Babel-based AST parser for CommonJS sources #3162 is merged into master.

📚 Pull Request Stack


Managed by gh-stack

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 29, 2026

🦋 Changeset detected

Latest commit: 198d94c

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

This PR includes changesets to release 7 packages
Name Type
@endo/compartment-mapper Minor
@endo/bundle-source Patch
@endo/check-bundle Patch
@endo/daemon Patch
@endo/import-bundle Patch
@endo/test262-runner Patch
@endo/cli Patch

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

Expose `findUnknownCanonicalNames()` from new export `@endo/compartment-mapper/policy.js`.

Should be used _after_ `captureFromMap` when called without policy, since unknown canonical names are not emitted by the `UnknownCanonicalNameHook` unless a policy is present.
@boneskull boneskull force-pushed the boneskull/cjs-ast-parser branch from d74629e to edbf51e Compare April 30, 2026 01:37
@boneskull boneskull force-pushed the boneskull/export-find-canonical-names branch from 77b0347 to 198d94c Compare April 30, 2026 01:37
Base automatically changed from boneskull/cjs-ast-parser to boneskull/ast-service April 30, 2026 01:37
@boneskull boneskull merged commit 198d94c into boneskull/ast-service Apr 30, 2026
16 of 25 checks passed
@boneskull boneskull deleted the boneskull/export-find-canonical-names branch April 30, 2026 01:37
@boneskull boneskull restored the boneskull/export-find-canonical-names branch April 30, 2026 01:42
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.

1 participant