You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@endo/compartment-mapper

Package Overview
Dependencies
Maintainers
5
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@endo/compartment-mapper - npm Package Compare versions

Comparing version
1.6.1
to
1.6.2
+9
-8
package.json
{
"name": "@endo/compartment-mapper",
"version": "1.6.1",
"version": "1.6.2",
"description": "The compartment mapper assembles Node applications in a sandbox",

@@ -53,3 +53,3 @@ "keywords": [

"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"postpack": "git clean -fX \"*.d.ts*\" \"*.d.cts*\" \"*.d.mts*\" \"*.tsbuildinfo\"",
"cover": "c8 ava",

@@ -64,7 +64,8 @@ "lint": "yarn lint:types && yarn lint:eslint",

"dependencies": {
"@endo/cjs-module-analyzer": "^1.0.10",
"@endo/module-source": "^1.3.1",
"@endo/trampoline": "^1.0.4",
"@endo/zip": "^1.0.10",
"ses": "^1.13.0"
"@endo/cjs-module-analyzer": "^1.0.11",
"@endo/module-source": "^1.3.2",
"@endo/path-compare": "^1.1.0",
"@endo/trampoline": "^1.0.5",
"@endo/zip": "^1.0.11",
"ses": "^1.13.1"
},

@@ -123,3 +124,3 @@ "devDependencies": {

},
"gitHead": "571b7803cf10df7cb4fa9d70e4d53a0b53767fa8"
"gitHead": "03b92fc383da5d8bb4ea993b90149a0db5799d0b"
}
/** @type {(a: string, b: string) => number} */
export const stringCompare: (a: string, b: string) => number;
export function pathCompare(a: Array<string> | undefined, b: Array<string> | undefined): number;
export function assertCompartmentMap(allegedCompartmentMap: unknown, url?: string): asserts allegedCompartmentMap is CompartmentMapDescriptor;
import type { CompartmentMapDescriptor } from './types.js';
//# sourceMappingURL=compartment-map.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"compartment-map.d.ts","sourceRoot":"","sources":["compartment-map.js"],"names":[],"mappings":"AAYA,+CAA+C;AAE/C,4BAFW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAE2B;AAc/D,+BAHI,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,KACzB,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,UAqCnC;AA8ZM,4DALI,OAAO,QACP,MAAM,GACJ,QAAQ,qBAAqB,IAAI,wBAAwB,CA+BrE;8CArf2C,YAAY"}
{"version":3,"file":"compartment-map.d.ts","sourceRoot":"","sources":["compartment-map.js"],"names":[],"mappings":"AAYA,+CAA+C;AAE/C,4BAFW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAE2B;AA8Z/D,4DALI,OAAO,QACP,MAAM,GACJ,QAAQ,qBAAqB,IAAI,wBAAwB,CA+BrE;8CApc2C,YAAY"}

@@ -18,51 +18,2 @@ /* Validates a compartment map against its schema. */

/**
* @param {number} length
* @param {string} term
*/
const cumulativeLength = (length, term) => {
return length + term.length;
};
/**
* @param {Array<string> | undefined} a
* @param {Array<string> | undefined} b
*/
export const pathCompare = (a, b) => {
// Undefined is not preferred
if (a === undefined && b === undefined) {
return 0;
}
if (a === undefined) {
return 1;
}
if (b === undefined) {
return -1;
}
// Prefer the shortest dependency path.
if (a.length !== b.length) {
return a.length - b.length;
}
// Otherwise, favor the shortest cumulative length.
const aSum = a.reduce(cumulativeLength, 0);
const bSum = b.reduce(cumulativeLength, 0);
if (aSum !== bSum) {
return aSum - bSum;
}
// Otherwise, compare terms lexically.
assert(a.length === b.length); // Reminder
// This loop guarantees that if any pair of terms is different, including the
// case where one is a prefix of the other, we will return a non-zero value.
for (let i = 0; i < a.length; i += 1) {
const comparison = stringCompare(a[i], b[i]);
if (comparison !== 0) {
return comparison;
}
}
// If all pairs of terms are the same respective lengths, we are guaranteed
// that they are exactly the same or one of them is lexically distinct and would
// have already been caught.
return 0;
};
/**
* @template T

@@ -69,0 +20,0 @@ * @param {Iterable<T>} iterable

@@ -1,1 +0,1 @@

{"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["digest.js"],"names":[],"mappings":"AAwLO,qDAJI,wBAAwB,WACxB,OAAO,GACL,YAAY,CAoDxB;8CA3NS,YAAY;6BAAZ,YAAY;kCAAZ,YAAY"}
{"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["digest.js"],"names":[],"mappings":"AAqLO,qDAJI,wBAAwB,WACxB,OAAO,GACL,YAAY,CAoDxB;8CAxNS,YAAY;6BAAZ,YAAY;kCAAZ,YAAY"}

@@ -19,7 +19,4 @@ /* eslint-disable no-shadow */

import {
assertCompartmentMap,
pathCompare,
stringCompare,
} from './compartment-map.js';
import { pathCompare } from '@endo/path-compare';
import { assertCompartmentMap, stringCompare } from './compartment-map.js';

@@ -26,0 +23,0 @@ const { create, fromEntries, entries, keys } = Object;

@@ -45,3 +45,3 @@ /**

import { pathCompare } from './compartment-map.js';
import { pathCompare } from '@endo/path-compare';
import { inferExportsAndAliases } from './infer-exports.js';

@@ -48,0 +48,0 @@ import { parseLocatedJson } from './json.js';

@@ -1,1 +0,1 @@

{"version":3,"file":"parse-cjs-shared-export-wrapper.d.ts","sourceRoot":"","sources":["parse-cjs-shared-export-wrapper.js"],"names":[],"mappings":"AA0CO,2CAPI,UAAU,GAAG,MAAM,GAAG,SAAS,YAC/B,MAAM,GACJ;IACR,QAAQ,EAAC,MAAM,GAAC,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,GAAC,IAAI,CAAA;CACrB,CAgCH;AAmBM,uGAZJ;IAAmB,uBAAuB,EAAlC,MAAM;IACU,WAAW,EAA3B,WAAW;IACgB,eAAe,EAA1C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IACX,QAAQ,EAAnB,MAAM;IAC8B,UAAU,EAA9C,MAAM,GAAG,UAAU,GAAG,SAAS;CACvC,GAAU;IACR,MAAM,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAC;IACzB,aAAa,EAAE,GAAG,CAAC;IACnB,YAAY,WAAW;IACvB,OAAO,WAAW;CACnB,CA2HH;gCA5MqC,YAAY;4BAAZ,YAAY"}
{"version":3,"file":"parse-cjs-shared-export-wrapper.d.ts","sourceRoot":"","sources":["parse-cjs-shared-export-wrapper.js"],"names":[],"mappings":"AA0CO,2CAPI,UAAU,GAAG,MAAM,GAAG,SAAS,YAC/B,MAAM,GACJ;IACR,QAAQ,EAAC,MAAM,GAAC,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,GAAC,IAAI,CAAA;CACrB,CAgCH;AAmBM,uGAZJ;IAAmB,uBAAuB,EAAlC,MAAM;IACU,WAAW,EAA3B,WAAW;IACgB,eAAe,EAA1C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IACX,QAAQ,EAAnB,MAAM;IAC8B,UAAU,EAA9C,MAAM,GAAG,UAAU,GAAG,SAAS;CACvC,GAAU;IACR,MAAM,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAC;IACzB,aAAa,EAAE,GAAG,CAAC;IACnB,YAAY,WAAW;IACvB,OAAO,WAAW;CACnB,CA+IH;gCAhOqC,YAAY;4BAAZ,YAAY"}

@@ -185,2 +185,22 @@ /**

// stub implementation of require.extensions
const requireExtensions = create(null);
const fail = freeze(
/**
* @param {NodeJS.Module} _module
* @param {string} _filename
* @returns {any}
*/
(_module, _filename) => {
throw Error('Not implemented');
},
);
requireExtensions['.js'] = fail;
requireExtensions['.json'] = fail;
requireExtensions['.node'] = fail;
freeze(requireExtensions);
require.extensions = /** @type {NodeJS.Require['extensions']} */ (
requireExtensions
);
freeze(require);

@@ -187,0 +207,0 @@