UNPKG

@endo/compartment-mapper

Version:

The compartment mapper assembles Node applications in a sandbox

256 lines (79 loc) 7.29 kB
import { ATTENUATORS_COMPARTMENT } from '../policy-format.js'; /** * A mapping of conditions to their resolved exports. * Each condition key (e.g., "import", "require", "node", "default") * maps to an {@link Exports} value. * * @see {@link https://github.com/sindresorhus/type-fest/blob/850b33c4dd292e0ff8cff039ee167d69be324fce/source/package-json.d.ts#L227-L248 | type-fest ExportConditions} */ /** * Entry points of a module, optionally with conditions and subpath exports. * Follows the recursive structure defined by Node.js for `package.json` * `exports` and `imports` fields. * * - `null` excludes a subpath (null target). * - `string` is a direct path. * - `Array` is a fallback list (first match wins). * - `ExportConditions` is a mapping of conditions to nested `Exports`. * * @see {@link https://github.com/sindresorhus/type-fest/blob/850b33c4dd292e0ff8cff039ee167d69be324fce/source/package-json.d.ts#L227-L248 | type-fest Exports} */ /** * The `imports` field of `package.json`. * Keys must start with `#`. * * @see {@link https://github.com/sindresorhus/type-fest/blob/850b33c4dd292e0ff8cff039ee167d69be324fce/source/package-json.d.ts#L227-L248 | type-fest Imports} */ /** * Options bag containing {@link CommonDependencyDescriptors} that will be added to * _all_ packages in the graph. */ /** * Options bag containing a {@link PackageDependenciesHook} */ /** * Options for `graphPackage()` */ /** * Options for `graphPackages()` */ /** * Options for `gatherDependency()` */ /** * The type of a `package.json` file containing relevant fields; used by `graphPackages` and its ilk */ /** * Value in {@link Graph} */ /** * A node in the graph that has been finalized, meaning it has a `label` and is * ready for conversion into a `CompartmentDescriptor`. */ /** * The graph is an intermediate object model that the functions of this module * build by exploring the `node_modules` tree dropped by tools like npm and * consumed by tools like Node.js. This gets translated finally into a * compartment map. * * Keys may either be a file URL string to a package or the special * `<ATTENUATORS>` string. */ /** * A graph, but contains {@link FinalNode}s instead of {@link Node}s. * * A "final node" has a `label` prop. */ /** * Object result of `findPackage()` */ /** * Specific type of {@link GenericGraph} that uses file URL strings for nodes; * used by `mapNodeModules()` and its ilk. */ /** * Options for `translateGraph()` */ /** * Mapping to enable reverse-lookups of `CompartmentDescriptor`s from policy. */