@endo/compartment-mapper
Advanced tools
Comparing version 0.7.15 to 0.8.0
@@ -6,2 +6,23 @@ # Change Log | ||
## [0.8.0](https://github.com/endojs/endo/compare/@endo/compartment-mapper@0.7.15...@endo/compartment-mapper@0.8.0) (2022-11-14) | ||
### ⚠ BREAKING CHANGES | ||
* **compartment-mapper:** Remove support for globalLexicals | ||
### Features | ||
* **compartment-mapper:** Bundles evaluate to entrypoint namespace ([85a69aa](https://github.com/endojs/endo/commit/85a69aaf8133fa84ec3548e8004777097cf7c326)) | ||
* **compartment-mapper:** Remove support for globalLexicals ([7d9603d](https://github.com/endojs/endo/commit/7d9603d0c838e02c1b052cf6e8f725ebf195aaf2)) | ||
* **compartment-mapper:** support peerDependencies and bundleDependencies ([3afd7c5](https://github.com/endojs/endo/commit/3afd7c5680813063a1ab7ff93af1a116e6af2f02)) | ||
* **compartment-mapper:** support various types of optional deps ([72fa6e7](https://github.com/endojs/endo/commit/72fa6e7a3089be31be97caee2616090ac842bb3e)) | ||
### Bug Fixes | ||
* assert touchups ([#1350](https://github.com/endojs/endo/issues/1350)) ([3fcb5b1](https://github.com/endojs/endo/commit/3fcb5b117eccb326c6c81339ae6a293a6bcaa9d4)) | ||
### [0.7.15](https://github.com/endojs/endo/compare/@endo/compartment-mapper@0.7.14...@endo/compartment-mapper@0.7.15) (2022-10-24) | ||
@@ -8,0 +29,0 @@ |
{ | ||
"name": "@endo/compartment-mapper", | ||
"version": "0.7.15", | ||
"version": "0.8.0", | ||
"description": "The compartment mapper assembles Node applications in a sandbox", | ||
@@ -44,6 +44,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@endo/cjs-module-analyzer": "^0.2.27", | ||
"@endo/static-module-record": "^0.7.14", | ||
"@endo/zip": "^0.2.27", | ||
"ses": "^0.17.0" | ||
"@endo/cjs-module-analyzer": "^0.2.28", | ||
"@endo/static-module-record": "^0.7.15", | ||
"@endo/zip": "^0.2.28", | ||
"ses": "^0.18.0" | ||
}, | ||
@@ -62,3 +62,3 @@ "devDependencies": { | ||
"prettier": "^1.19.1", | ||
"typescript": "~4.6.2" | ||
"typescript": "~4.8.4" | ||
}, | ||
@@ -98,3 +98,3 @@ "files": [ | ||
}, | ||
"gitHead": "8fb324d8f13a0c6939dc0c1feb831f72298f1853" | ||
"gitHead": "da16a94856482e36296b7cae16d715aa63344928" | ||
} |
@@ -340,2 +340,4 @@ // @ts-check | ||
)}\ | ||
return cells[cells.length - 1]['*'].get(); | ||
})(); | ||
@@ -342,0 +344,0 @@ `; |
// @ts-check | ||
/// <reference types="ses"/> | ||
// TODO convert to the new `||` assert style. | ||
// Deferred because this file pervasively uses simple template strings rather than | ||
// template strings tagged with `assert.details` (aka `X`), and uses | ||
// this definition of `q` rather than `assert.quote` | ||
const q = JSON.stringify; | ||
@@ -5,0 +9,0 @@ |
@@ -32,3 +32,3 @@ // @ts-check | ||
const { quote: q, details: d } = assert; | ||
const { Fail, quote: q } = assert; | ||
@@ -211,8 +211,6 @@ const textDecoder = new TextDecoder(); | ||
const unseen = new Set(archive.files.keys()); | ||
assert( | ||
unseen.size >= 2, | ||
`Archive failed sanity check: should contain at least a compartment map file and one module file in ${q( | ||
unseen.size >= 2 || | ||
Fail`Archive failed sanity check: should contain at least a compartment map file and one module file in ${q( | ||
archiveLocation, | ||
)}`, | ||
); | ||
)}`; | ||
@@ -285,8 +283,6 @@ /** | ||
await compartment.load(moduleSpecifier); | ||
assert( | ||
unseen.size === 0, | ||
d`Archive contains extraneous files: ${q([...unseen])} in ${q( | ||
unseen.size === 0 || | ||
Fail`Archive contains extraneous files: ${q([...unseen])} in ${q( | ||
archiveLocation, | ||
)}`, | ||
); | ||
)}`; | ||
} | ||
@@ -296,10 +292,4 @@ | ||
const execute = options => { | ||
const { | ||
globals, | ||
globalLexicals, | ||
modules, | ||
transforms, | ||
__shimTransforms__, | ||
Compartment, | ||
} = options || {}; | ||
const { globals, modules, transforms, __shimTransforms__, Compartment } = | ||
options || {}; | ||
const makeImportHook = makeArchiveImportHookMaker( | ||
@@ -316,3 +306,2 @@ get, | ||
globals, | ||
globalLexicals, | ||
modules, | ||
@@ -323,3 +312,4 @@ transforms, | ||
}); | ||
return compartment.import(moduleSpecifier); | ||
// eslint-disable-next-line dot-notation | ||
return compartment['import'](moduleSpecifier); | ||
}; | ||
@@ -326,0 +316,0 @@ |
@@ -70,3 +70,2 @@ // @ts-check | ||
globals, | ||
globalLexicals, | ||
modules, | ||
@@ -82,3 +81,2 @@ transforms, | ||
globals, | ||
globalLexicals, | ||
modules, | ||
@@ -85,0 +83,0 @@ transforms, |
@@ -336,3 +336,2 @@ // @ts-check | ||
globals = {}, | ||
globalLexicals = {}, | ||
transforms = [], | ||
@@ -405,3 +404,2 @@ moduleTransforms = {}, | ||
__shimTransforms__, | ||
globalLexicals, | ||
name: location, | ||
@@ -408,0 +406,0 @@ }); |
@@ -255,9 +255,33 @@ // @ts-check | ||
/** @type {Record<string, string>} */ | ||
const dependencies = {}; | ||
const dependencyLocations = {}; | ||
const children = []; | ||
const predicates = packageDescriptor.dependencies || {}; | ||
const optionals = new Set(); | ||
const { | ||
dependencies = {}, | ||
peerDependencies = {}, | ||
peerDependenciesMeta = {}, | ||
bundleDependencies = {}, | ||
optionalDependencies = {}, | ||
devDependencies = {}, | ||
} = packageDescriptor; | ||
const allDependencies = {}; | ||
assign(allDependencies, dependencies); | ||
assign(allDependencies, peerDependencies); | ||
for (const [name, { optional }] of Object.entries(peerDependenciesMeta)) { | ||
if (optional) { | ||
optionals.add(name); | ||
} | ||
} | ||
assign(allDependencies, bundleDependencies); | ||
assign(allDependencies, optionalDependencies); | ||
Object.keys(optionalDependencies).forEach(name => { | ||
optionals.add(name); | ||
}); | ||
if (dev) { | ||
assign(predicates, packageDescriptor.devDependencies || {}); | ||
assign(allDependencies, devDependencies); | ||
} | ||
for (const name of keys(predicates).sort()) { | ||
for (const name of keys(allDependencies).sort()) { | ||
const optional = optionals.has(name); | ||
children.push( | ||
@@ -270,6 +294,7 @@ // Mutual recursion ahead: | ||
graph, | ||
dependencies, | ||
dependencyLocations, | ||
packageLocation, | ||
name, | ||
tags, | ||
optional, | ||
), | ||
@@ -296,3 +321,3 @@ ); | ||
exports: inferExports(packageDescriptor, tags, types), | ||
dependencies, | ||
dependencies: dependencyLocations, | ||
types, | ||
@@ -323,2 +348,3 @@ parsers: inferParsers(packageDescriptor, packageLocation), | ||
* @param {Set<string>} tags | ||
* @param {boolean} optional - whether the dependency is optional | ||
*/ | ||
@@ -333,2 +359,3 @@ const gatherDependency = async ( | ||
tags, | ||
optional = false, | ||
) => { | ||
@@ -342,2 +369,6 @@ const dependency = await findPackage( | ||
if (dependency === undefined) { | ||
// allow the dependency to be missing if optional | ||
if (optional) { | ||
return; | ||
} | ||
throw new Error(`Cannot find dependency ${name} for ${packageLocation}`); | ||
@@ -344,0 +375,0 @@ } |
@@ -237,3 +237,2 @@ // @ts-check | ||
* @property {Object} [globals] | ||
* @property {Object} [globalLexicals] | ||
* @property {Array<Transform>} [transforms] | ||
@@ -240,0 +239,0 @@ * @property {Array<Transform>} [__shimTransforms__] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
200296
4263
0
- Removedses@0.17.1(transitive)
Updated@endo/zip@^0.2.28
Updatedses@^0.18.0