Skip to content

Commit

Permalink
fix(endo): Ensure conditions include default, import, and endo
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Mar 17, 2022
1 parent 7d27020 commit 1361abd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/compartment-mapper/NEWS.md
Expand Up @@ -6,6 +6,8 @@ User-visible changes to the compartment mapper:
`package.json`: When the compartment mapper encounters such a package, every
module in that package with `.js` extension including the referenced module
will be treated an ESM, as if it had the `.mjs` extension.
- Ensures that the `"endo"`, `"import"`, and `"default"` tags (Node.js
conditions) are respected in `package.json` `"exports"` conditions.

# v0.7.0 (2022-03-01)

Expand Down
3 changes: 3 additions & 0 deletions packages/compartment-mapper/src/archive.js
Expand Up @@ -203,6 +203,9 @@ const digestLocation = async (powers, moduleLocation, options) => {

/** @type {Set<string>} */
const tags = new Set();
tags.add('endo');
tags.add('import');
tags.add('default');

const packageDescriptor = parseLocatedJson(
packageDescriptorText,
Expand Down
2 changes: 2 additions & 0 deletions packages/compartment-mapper/src/node-modules.js
Expand Up @@ -364,6 +364,8 @@ const graphPackages = async (

tags = new Set(tags || []);
tags.add('import');
tags.add('default');
tags.add('endo');

if (packageDescriptor === undefined) {
throw new Error(
Expand Down
4 changes: 2 additions & 2 deletions packages/ses/package.json.md
Expand Up @@ -99,8 +99,8 @@ The variations differ only in file name extension.
Node.js and other tools will use this file when importing `ses` as an ESM.
(JavaScript module).
We have in the past experimented with using the precompiled bundle of SES here
(`./dist/ses.cjs`), but found that this interacted poorly with Endo,
because an Endo bundle contains symbols that SES censors.
(`./dist/ses.cjs` or `./dist/ses.umd.js`), but found that this interacted
poorly with Endo, because an Endo bundle contains identifiers that SES censors.

## "require": "./dist/ses.cjs",

Expand Down

0 comments on commit 1361abd

Please sign in to comment.