@packall/core 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/archive-6sqTn1C4.js +274 -0
- package/dist/archive-6sqTn1C4.js.map +1 -0
- package/dist/archive.d.ts +64 -0
- package/dist/archive.d.ts.map +1 -0
- package/dist/{Bundle.d.ts → bundle.d.ts} +56 -38
- package/dist/bundle.d.ts.map +1 -0
- package/dist/{DependencyRange.d.ts → dependency-range.d.ts} +2 -2
- package/dist/dependency-range.d.ts.map +1 -0
- package/dist/{Download.d.ts → download.d.ts} +9 -8
- package/dist/download.d.ts.map +1 -0
- package/dist/enums/artifact-kind.d.ts +8 -0
- package/dist/enums/artifact-kind.d.ts.map +1 -0
- package/dist/enums/edge-kind.d.ts +29 -0
- package/dist/enums/edge-kind.d.ts.map +1 -0
- package/dist/enums/input-file-kind.d.ts +12 -0
- package/dist/enums/input-file-kind.d.ts.map +1 -0
- package/dist/enums/layout.d.ts +23 -0
- package/dist/enums/layout.d.ts.map +1 -0
- package/dist/enums/lockfile-format.d.ts +9 -0
- package/dist/enums/lockfile-format.d.ts.map +1 -0
- package/dist/enums/phase.d.ts +11 -0
- package/dist/enums/phase.d.ts.map +1 -0
- package/dist/{Errors.d.ts → errors.d.ts} +49 -7
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.d.ts +46 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2121 -1060
- package/dist/index.js.map +1 -1
- package/dist/input-file.d.ts +77 -0
- package/dist/input-file.d.ts.map +1 -0
- package/dist/integrity.d.ts +80 -0
- package/dist/integrity.d.ts.map +1 -0
- package/dist/layout.d.ts +87 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/locked-resolve.d.ts +47 -0
- package/dist/locked-resolve.d.ts.map +1 -0
- package/dist/lockfile/bun.d.ts +3 -0
- package/dist/lockfile/bun.d.ts.map +1 -0
- package/dist/lockfile/detect.d.ts +31 -0
- package/dist/lockfile/detect.d.ts.map +1 -0
- package/dist/lockfile/json.d.ts +23 -0
- package/dist/lockfile/json.d.ts.map +1 -0
- package/dist/lockfile/names.d.ts +16 -0
- package/dist/lockfile/names.d.ts.map +1 -0
- package/dist/lockfile/npm.d.ts +3 -0
- package/dist/lockfile/npm.d.ts.map +1 -0
- package/dist/lockfile/parse.d.ts +23 -0
- package/dist/lockfile/parse.d.ts.map +1 -0
- package/dist/lockfile/pnpm.d.ts +20 -0
- package/dist/lockfile/pnpm.d.ts.map +1 -0
- package/dist/lockfile/tree-builder.d.ts +70 -0
- package/dist/lockfile/tree-builder.d.ts.map +1 -0
- package/dist/lockfile/types.d.ts +70 -0
- package/dist/lockfile/types.d.ts.map +1 -0
- package/dist/{Manifest.d.ts → manifest.d.ts} +7 -15
- package/dist/manifest.d.ts.map +1 -0
- package/dist/node/archiver.d.ts +5 -0
- package/dist/node/archiver.d.ts.map +1 -0
- package/dist/node/index.d.ts +13 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +55 -0
- package/dist/node/index.js.map +1 -0
- package/dist/{Options.d.ts → options.d.ts} +12 -30
- package/dist/options.d.ts.map +1 -0
- package/dist/{Platform.d.ts → platform.d.ts} +14 -19
- package/dist/platform.d.ts.map +1 -0
- package/dist/{Progress.d.ts → progress.d.ts} +10 -9
- package/dist/progress.d.ts.map +1 -0
- package/dist/{Registry.d.ts → registry.d.ts} +42 -44
- package/dist/registry.d.ts.map +1 -0
- package/dist/{Resolve.d.ts → resolve.d.ts} +25 -26
- package/dist/resolve.d.ts.map +1 -0
- package/dist/schemas/lenient.d.ts +38 -0
- package/dist/schemas/lenient.d.ts.map +1 -0
- package/dist/schemas/package-json.d.ts +44 -0
- package/dist/schemas/package-json.d.ts.map +1 -0
- package/dist/{Spec.d.ts → spec.d.ts} +4 -4
- package/dist/spec.d.ts.map +1 -0
- package/dist/types/value-of.d.ts +9 -0
- package/dist/types/value-of.d.ts.map +1 -0
- package/dist/utils/is-record.d.ts +8 -0
- package/dist/utils/is-record.d.ts.map +1 -0
- package/package.json +13 -11
- package/src/archive.ts +95 -0
- package/src/bundle.ts +736 -0
- package/src/dependency-range.ts +121 -0
- package/src/download.ts +155 -0
- package/src/enums/artifact-kind.ts +9 -0
- package/src/enums/edge-kind.ts +32 -0
- package/src/enums/input-file-kind.ts +13 -0
- package/src/enums/layout.ts +25 -0
- package/src/enums/lockfile-format.ts +10 -0
- package/src/enums/phase.ts +12 -0
- package/src/errors.ts +300 -0
- package/src/index.ts +146 -35
- package/src/input-file.ts +324 -0
- package/src/integrity.ts +165 -0
- package/src/layout.ts +137 -0
- package/src/locked-resolve.ts +471 -0
- package/src/lockfile/bun.ts +214 -0
- package/src/lockfile/detect.ts +80 -0
- package/src/lockfile/json.ts +131 -0
- package/src/lockfile/names.ts +20 -0
- package/src/lockfile/npm.ts +328 -0
- package/src/lockfile/parse.ts +56 -0
- package/src/lockfile/pnpm.ts +230 -0
- package/src/lockfile/tree-builder.ts +166 -0
- package/src/lockfile/types.ts +74 -0
- package/src/manifest.ts +129 -0
- package/src/node/archiver.ts +85 -0
- package/src/node/index.ts +13 -0
- package/src/options.ts +103 -0
- package/src/platform.ts +178 -0
- package/src/progress.ts +105 -0
- package/src/registry.ts +116 -0
- package/src/resolve.ts +560 -0
- package/src/schemas/lenient.ts +130 -0
- package/src/schemas/package-json.ts +28 -0
- package/src/spec.ts +182 -0
- package/src/types/value-of.ts +8 -0
- package/src/utils/is-record.ts +8 -0
- package/dist/Archive.d.ts +0 -32
- package/dist/Archive.d.ts.map +0 -1
- package/dist/Bundle.d.ts.map +0 -1
- package/dist/DependencyRange.d.ts.map +0 -1
- package/dist/Download.d.ts.map +0 -1
- package/dist/Errors.d.ts.map +0 -1
- package/dist/InputFile.d.ts +0 -46
- package/dist/InputFile.d.ts.map +0 -1
- package/dist/Integrity.d.ts +0 -48
- package/dist/Integrity.d.ts.map +0 -1
- package/dist/Layout.d.ts +0 -53
- package/dist/Layout.d.ts.map +0 -1
- package/dist/Manifest.d.ts.map +0 -1
- package/dist/Options.d.ts.map +0 -1
- package/dist/Platform.d.ts.map +0 -1
- package/dist/Progress.d.ts.map +0 -1
- package/dist/Registry.d.ts.map +0 -1
- package/dist/Resolve.d.ts.map +0 -1
- package/dist/Spec.d.ts.map +0 -1
- package/src/Archive.ts +0 -92
- package/src/Bundle.ts +0 -570
- package/src/DependencyRange.ts +0 -115
- package/src/Download.ts +0 -132
- package/src/Errors.ts +0 -216
- package/src/InputFile.ts +0 -229
- package/src/Integrity.ts +0 -122
- package/src/Layout.ts +0 -103
- package/src/Manifest.ts +0 -133
- package/src/Options.ts +0 -123
- package/src/Platform.ts +0 -182
- package/src/Progress.ts +0 -106
- package/src/Registry.ts +0 -121
- package/src/Resolve.ts +0 -528
- package/src/Spec.ts +0 -186
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* This is the audit trail. Before anything is imported into a corporate
|
|
5
|
-
* registry somebody is usually required to answer "what exactly is in here and
|
|
6
|
-
* where did it come from" — this file answers that without unpacking a single
|
|
7
|
-
* tarball.
|
|
8
|
-
*/
|
|
9
|
-
import type { Resolution, ResolvedPackage } from "./Resolve.js";
|
|
10
|
-
import type { BundleOptions } from "./Options.js";
|
|
1
|
+
import type { BundleOptions } from "./options.js";
|
|
2
|
+
import type { Resolution, ResolvedPackage } from "./resolve.js";
|
|
11
3
|
/** Schema version, bumped when the shape changes incompatibly. */
|
|
12
4
|
export declare const MANIFEST_VERSION = 1;
|
|
13
|
-
export
|
|
5
|
+
export type ManifestEntry = {
|
|
14
6
|
readonly name: string;
|
|
15
7
|
readonly version: string;
|
|
16
8
|
/** Path of this tarball inside the bundle. */
|
|
@@ -25,8 +17,8 @@ export interface ManifestEntry {
|
|
|
25
17
|
readonly bytes?: number | undefined;
|
|
26
18
|
/** Human-readable justifications: `root:react@18.2.0`, `prod:scheduler@0.23.0`. */
|
|
27
19
|
readonly reasons: ReadonlyArray<string>;
|
|
28
|
-
}
|
|
29
|
-
export
|
|
20
|
+
};
|
|
21
|
+
export type BundleManifest = {
|
|
30
22
|
readonly manifestVersion: number;
|
|
31
23
|
readonly tool: {
|
|
32
24
|
readonly name: string;
|
|
@@ -60,7 +52,7 @@ export interface BundleManifest {
|
|
|
60
52
|
readonly packages: number;
|
|
61
53
|
readonly bytes: number;
|
|
62
54
|
};
|
|
63
|
-
}
|
|
55
|
+
};
|
|
64
56
|
/** Renders a package's reasons into short, greppable strings. */
|
|
65
57
|
export declare const formatReasons: (pkg: ResolvedPackage) => ReadonlyArray<string>;
|
|
66
58
|
/** Builds the manifest for a completed (or dry) run. */
|
|
@@ -79,4 +71,4 @@ export declare const buildManifest: (input: {
|
|
|
79
71
|
}) => BundleManifest;
|
|
80
72
|
/** Serialises a manifest with stable key order and a trailing newline. */
|
|
81
73
|
export declare const serializeManifest: (manifest: BundleManifest) => string;
|
|
82
|
-
//# sourceMappingURL=
|
|
74
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGhE,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,MAAM,MAAM,aAAa,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,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C;AAqCzC,gCAAgC;AAChC,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAE9C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@packall/core/node` — the engine's Node-specific layers.
|
|
3
|
+
*
|
|
4
|
+
* Everything here is separated from the main barrel for one reason: importing
|
|
5
|
+
* `@packall/core` must stay safe in a browser. The engine itself reaches the
|
|
6
|
+
* outside world only through services — `Registry`, `Progress`, `Archiver`,
|
|
7
|
+
* `FileSystem`, `Path`, `Crypto` — so the platform lives at the edges, and this
|
|
8
|
+
* is the Node edge. A browser supplies its own.
|
|
9
|
+
*
|
|
10
|
+
* This is the entry point's whole public API.
|
|
11
|
+
*/
|
|
12
|
+
export { layerArchiver } from "./archiver.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { c as ArchiveError, t as Archiver } from "../archive-6sqTn1C4.js";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as FileSystem from "effect/FileSystem";
|
|
5
|
+
import { create } from "tar";
|
|
6
|
+
|
|
7
|
+
//#region src/node/archiver.ts
|
|
8
|
+
const createArchive = (options) => Effect.gen(function* () {
|
|
9
|
+
const fs = yield* FileSystem.FileSystem;
|
|
10
|
+
yield* Effect.tryPromise({
|
|
11
|
+
try: () => create({
|
|
12
|
+
gzip: options.gzipLevel === void 0 ? true : { level: options.gzipLevel },
|
|
13
|
+
file: options.outPath,
|
|
14
|
+
cwd: options.cwd,
|
|
15
|
+
portable: true,
|
|
16
|
+
onWriteEntry: (entry) => {
|
|
17
|
+
entry.path = entry.path.replace(/^\.\//, "");
|
|
18
|
+
}
|
|
19
|
+
}, options.entries.toSorted().map(dotSlash)),
|
|
20
|
+
catch: (cause) => new ArchiveError(options.outPath, describe(cause), { cause })
|
|
21
|
+
});
|
|
22
|
+
const info = yield* fs.stat(options.outPath);
|
|
23
|
+
return {
|
|
24
|
+
path: options.outPath,
|
|
25
|
+
bytes: Number(info.size)
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
/** The Node packing backend. */
|
|
29
|
+
const layerArchiver = Layer.succeed(Archiver)({ create: createArchive });
|
|
30
|
+
/**
|
|
31
|
+
* Guards every entry against tar's `@` convention.
|
|
32
|
+
*
|
|
33
|
+
* In a tar file list, a leading `@` means "splice in the entries of this other
|
|
34
|
+
* archive" — a GNU convention `node-tar` implements by stripping the `@` and
|
|
35
|
+
* looking for what is left. Every scoped package is a top-level entry starting
|
|
36
|
+
* with `@`, so this hit the bundler in both possible ways:
|
|
37
|
+
*
|
|
38
|
+
* - `@oxc-project` became `oxc-project`, which does not exist, and the run died
|
|
39
|
+
* with an ENOENT naming a path that appears nowhere in the staging tree.
|
|
40
|
+
* - `@esbuild` became `esbuild`, which *does* exist — the unscoped package of
|
|
41
|
+
* the same name sitting right next to it. No error, and every scoped tarball
|
|
42
|
+
* silently missing from a bundle that reported success. That is the dangerous
|
|
43
|
+
* one: you would not find out until the install failed behind the firewall.
|
|
44
|
+
*
|
|
45
|
+
* `./@scope` is not subject to the convention and resolves identically.
|
|
46
|
+
*
|
|
47
|
+
* Any other backend has to answer this question too — the browser writer must
|
|
48
|
+
* be held to the same test.
|
|
49
|
+
*/
|
|
50
|
+
const dotSlash = (entry) => entry.startsWith("./") ? entry : `./${entry}`;
|
|
51
|
+
const describe = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { layerArchiver };
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["layerArchiver: Layer.Layer<Archiver>"],"sources":["../../src/node/archiver.ts"],"sourcesContent":["/**\n * The Node `Archiver`, backed by `node-tar`.\n *\n * Behind `@packall/core/node` rather than the main barrel: importing\n * `@packall/core` must not drag `node-tar` — and through it `node:fs` — into a\n * browser bundle. Anything running on Node reaches for this explicitly.\n *\n * Uses `node-tar`, the same library npm itself packs with. Writing a USTAR\n * encoder by hand would be a fun afternoon and a bad idea: scoped package\n * paths routinely exceed the 100-byte name field, so correctness depends on\n * prefix-splitting and PAX headers that `tar` already gets right.\n */\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport { create } from \"tar\";\n\nimport type { ArchiveResult, CreateArchiveOptions } from \"../archive.js\";\nimport { Archiver } from \"../archive.js\";\nimport { ArchiveError } from \"../errors.js\";\n\nconst createArchive = (\n\toptions: CreateArchiveOptions,\n): Effect.Effect<ArchiveResult, ArchiveError | PlatformError, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\n\t\tyield* Effect.tryPromise({\n\t\t\ttry: () =>\n\t\t\t\tcreate(\n\t\t\t\t\t{\n\t\t\t\t\t\tgzip: options.gzipLevel === undefined ? true : { level: options.gzipLevel },\n\t\t\t\t\t\tfile: options.outPath,\n\t\t\t\t\t\tcwd: options.cwd,\n\t\t\t\t\t\t// Normalises uid/gid/mtime so the same inputs produce byte-identical\n\t\t\t\t\t\t// output — which matters when a security team wants to diff two\n\t\t\t\t\t\t// bundles or re-derive one from a manifest.\n\t\t\t\t\t\tportable: true,\n\t\t\t\t\t\t// Undo the `./` added below, so recorded entry names stay exactly\n\t\t\t\t\t\t// the registry paths the manifest lists.\n\t\t\t\t\t\tonWriteEntry: (entry) => {\n\t\t\t\t\t\t\tentry.path = entry.path.replace(/^\\.\\//, \"\");\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t// Sorted so archive order is stable across runs and platforms.\n\t\t\t\t\toptions.entries.toSorted().map(dotSlash),\n\t\t\t\t),\n\t\t\tcatch: (cause) => new ArchiveError(options.outPath, describe(cause), { cause }),\n\t\t});\n\n\t\tconst info = yield* fs.stat(options.outPath);\n\n\t\treturn { path: options.outPath, bytes: Number(info.size) };\n\t});\n\n/** The Node packing backend. */\nexport const layerArchiver: Layer.Layer<Archiver> = Layer.succeed(Archiver)({\n\tcreate: createArchive,\n});\n\n/**\n * Guards every entry against tar's `@` convention.\n *\n * In a tar file list, a leading `@` means \"splice in the entries of this other\n * archive\" — a GNU convention `node-tar` implements by stripping the `@` and\n * looking for what is left. Every scoped package is a top-level entry starting\n * with `@`, so this hit the bundler in both possible ways:\n *\n * - `@oxc-project` became `oxc-project`, which does not exist, and the run died\n * with an ENOENT naming a path that appears nowhere in the staging tree.\n * - `@esbuild` became `esbuild`, which *does* exist — the unscoped package of\n * the same name sitting right next to it. No error, and every scoped tarball\n * silently missing from a bundle that reported success. That is the dangerous\n * one: you would not find out until the install failed behind the firewall.\n *\n * `./@scope` is not subject to the convention and resolves identically.\n *\n * Any other backend has to answer this question too — the browser writer must\n * be held to the same test.\n */\nconst dotSlash = (entry: string): string => (entry.startsWith(\"./\") ? entry : `./${entry}`);\n\nconst describe = (cause: unknown): string =>\n\tcause instanceof Error ? cause.message : String(cause);\n"],"mappings":";;;;;;;AAsBA,MAAM,iBACL,YAEA,OAAO,IAAI,aAAa;CACvB,MAAM,KAAK,OAAO,WAAW;AAE7B,QAAO,OAAO,WAAW;EACxB,WACC,OACC;GACC,MAAM,QAAQ,cAAc,SAAY,OAAO,EAAE,OAAO,QAAQ,WAAW;GAC3E,MAAM,QAAQ;GACd,KAAK,QAAQ;GAIb,UAAU;GAGV,eAAe,UAAU;AACxB,UAAM,OAAO,MAAM,KAAK,QAAQ,SAAS,GAAG;;GAE7C,EAED,QAAQ,QAAQ,UAAU,CAAC,IAAI,SAAS,CACxC;EACF,QAAQ,UAAU,IAAI,aAAa,QAAQ,SAAS,SAAS,MAAM,EAAE,EAAE,OAAO,CAAC;EAC/E,CAAC;CAEF,MAAM,OAAO,OAAO,GAAG,KAAK,QAAQ,QAAQ;AAE5C,QAAO;EAAE,MAAM,QAAQ;EAAS,OAAO,OAAO,KAAK,KAAK;EAAE;EACzD;;AAGH,MAAaA,gBAAuC,MAAM,QAAQ,SAAS,CAAC,EAC3E,QAAQ,eACR,CAAC;;;;;;;;;;;;;;;;;;;;;AAsBF,MAAM,YAAY,UAA2B,MAAM,WAAW,KAAK,GAAG,QAAQ,KAAK;AAEnF,MAAM,YAAY,UACjB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM"}
|
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Option types shared by the resolver and the bundler, plus their defaults.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The rule the defaults below are derived from is stated once, beside the flags
|
|
5
|
+
* that expose them — see `descriptors.ts` in `@packall/cli`, and
|
|
6
|
+
* `notes/requirements.md` § FR-13.
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
export type Layout =
|
|
11
|
-
/**
|
|
12
|
-
* One tarball per requested spec, each carrying its own complete dependency
|
|
13
|
-
* closure. Shared dependencies repeat across tarballs, so the total is
|
|
14
|
-
* larger — but each one imports, rolls back and hands off independently.
|
|
15
|
-
*/
|
|
16
|
-
"per-spec"
|
|
17
|
-
/**
|
|
18
|
-
* One tarball for everything, with the union of all closures deduplicated.
|
|
19
|
-
* Smallest output and a single import step; all-or-nothing to roll back.
|
|
20
|
-
*/
|
|
21
|
-
| "single"
|
|
22
|
-
/**
|
|
23
|
-
* No archive at all — just the npm-layout directory tree, ready for
|
|
24
|
-
* `jf rt upload` or rsync.
|
|
25
|
-
*/
|
|
26
|
-
| "dir";
|
|
27
|
-
export declare const layouts: ReadonlyArray<Layout>;
|
|
8
|
+
import { Layout } from "./enums/layout.js";
|
|
9
|
+
import type { PlatformFilter } from "./platform.js";
|
|
28
10
|
/** Which dependency edges the resolver follows. */
|
|
29
|
-
export
|
|
11
|
+
export type DependencyScope = {
|
|
30
12
|
/**
|
|
31
13
|
* Follow `optionalDependencies`. On by default — this is where per-platform
|
|
32
14
|
* native binaries live, and omitting them is the most common reason an
|
|
@@ -40,10 +22,10 @@ export interface DependencyScope {
|
|
|
40
22
|
readonly peer: boolean;
|
|
41
23
|
/** Which platforms optional dependencies are kept for. */
|
|
42
24
|
readonly platforms: PlatformFilter;
|
|
43
|
-
}
|
|
25
|
+
};
|
|
44
26
|
export declare const defaultScope: DependencyScope;
|
|
45
27
|
/** Options governing version selection and the dependency walk. */
|
|
46
|
-
export
|
|
28
|
+
export type ResolveOptions = {
|
|
47
29
|
readonly scope: DependencyScope;
|
|
48
30
|
/**
|
|
49
31
|
* When a root spec is a range, take *every* published version that satisfies
|
|
@@ -59,10 +41,10 @@ export interface ResolveOptions {
|
|
|
59
41
|
readonly includePrerelease: boolean;
|
|
60
42
|
/** How many registry requests to have in flight at once. */
|
|
61
43
|
readonly concurrency: number;
|
|
62
|
-
}
|
|
44
|
+
};
|
|
63
45
|
export declare const defaultResolveOptions: ResolveOptions;
|
|
64
46
|
/** Options for a full bundle run. */
|
|
65
|
-
export
|
|
47
|
+
export type BundleOptions = ResolveOptions & {
|
|
66
48
|
readonly layout: Layout;
|
|
67
49
|
/** Directory the finished artifacts are written to. */
|
|
68
50
|
readonly outDir: string;
|
|
@@ -95,6 +77,6 @@ export interface BundleOptions extends ResolveOptions {
|
|
|
95
77
|
* still ask about anything else".
|
|
96
78
|
*/
|
|
97
79
|
readonly overwrite?: ReadonlySet<string> | undefined;
|
|
98
|
-
}
|
|
80
|
+
};
|
|
99
81
|
export declare const defaultBundleOptions: Omit<BundleOptions, "outDir">;
|
|
100
|
-
//# sourceMappingURL=
|
|
82
|
+
//# s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G;IACH,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACxD;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;CACrD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAM9D,CAAC"}
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Platform matching for optional dependencies.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* The default is "keep every platform" and narrowing is opt-in — see
|
|
5
|
+
* `notes/requirements.md` § FR-13 for the failure mode that decides it.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* only the one matching the current machine and silently skips the rest.
|
|
10
|
-
*
|
|
11
|
-
* So if you bundle on a Mac and skip the non-matching optional deps, the
|
|
12
|
-
* resulting bundle installs fine on your Mac and fails on the Linux CI box
|
|
13
|
-
* inside the firewall — which is the only place it actually matters. Hence the
|
|
14
|
-
* default is "take every platform" and narrowing is opt-in.
|
|
7
|
+
* The mechanics that decision rests on are here rather than there: a package
|
|
8
|
+
* declares `os`, `cpu` and `libc` in its own manifest, and this module keeps a
|
|
9
|
+
* package when the filter *could* install it, not when it matches exactly.
|
|
15
10
|
*/
|
|
16
11
|
/** A target to keep, e.g. `linux-x64`, `linux-x64-musl`, or just `linux`. */
|
|
17
|
-
export
|
|
12
|
+
export type PlatformTarget = {
|
|
18
13
|
readonly os: string;
|
|
19
14
|
/** Undefined means "every architecture for this OS". */
|
|
20
15
|
readonly cpu?: string | undefined;
|
|
21
16
|
/** `glibc` / `musl`. Undefined means "don't care". */
|
|
22
17
|
readonly libc?: string | undefined;
|
|
23
|
-
}
|
|
18
|
+
};
|
|
24
19
|
/**
|
|
25
20
|
* Which platforms optional dependencies should be resolved for.
|
|
26
21
|
*
|
|
@@ -33,6 +28,12 @@ export type PlatformFilter = {
|
|
|
33
28
|
readonly _tag: "Targets";
|
|
34
29
|
readonly targets: ReadonlyArray<PlatformTarget>;
|
|
35
30
|
};
|
|
31
|
+
/** Constraints declared by a package, as they appear in its manifest. */
|
|
32
|
+
export type PlatformConstraints = {
|
|
33
|
+
readonly os?: ReadonlyArray<string> | undefined;
|
|
34
|
+
readonly cpu?: ReadonlyArray<string> | undefined;
|
|
35
|
+
readonly libc?: ReadonlyArray<string> | undefined;
|
|
36
|
+
};
|
|
36
37
|
export declare const allPlatforms: PlatformFilter;
|
|
37
38
|
export declare const platformTargets: (targets: ReadonlyArray<PlatformTarget>) => PlatformFilter;
|
|
38
39
|
/** The machine we are currently running on. */
|
|
@@ -50,12 +51,6 @@ export declare const currentPlatform: () => PlatformTarget;
|
|
|
50
51
|
* once alongside the list of accepted forms.
|
|
51
52
|
*/
|
|
52
53
|
export declare const parsePlatformTarget: (input: string) => PlatformTarget | null;
|
|
53
|
-
/** Constraints declared by a package, as they appear in its manifest. */
|
|
54
|
-
export interface PlatformConstraints {
|
|
55
|
-
readonly os?: ReadonlyArray<string> | undefined;
|
|
56
|
-
readonly cpu?: ReadonlyArray<string> | undefined;
|
|
57
|
-
readonly libc?: ReadonlyArray<string> | undefined;
|
|
58
|
-
}
|
|
59
54
|
/** Would this package install on this specific target? */
|
|
60
55
|
export declare const matchesTarget: (constraints: PlatformConstraints, target: PlatformTarget) => boolean;
|
|
61
56
|
/**
|
|
@@ -66,4 +61,4 @@ export declare const matchesTarget: (constraints: PlatformConstraints, target: P
|
|
|
66
61
|
export declare const isIncluded: (constraints: PlatformConstraints, filter: PlatformFilter) => boolean;
|
|
67
62
|
/** Renders a filter for the manifest and for `--dry-run` output. */
|
|
68
63
|
export declare const formatPlatformFilter: (filter: PlatformFilter) => string;
|
|
69
|
-
//# sourceMappingURL=
|
|
64
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;CAAE,CAAC;AAEjF,yEAAyE;AACzE,MAAM,MAAM,mBAAmB,GAAG;IACjC,QAAQ,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACjD,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;CAClD,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAAgC,CAAC;AAE5D,eAAO,MAAM,eAAe,YAAa,aAAa,CAAC,cAAc,CAAC,KAAG,cAGvE,CAAC;AAEH,+CAA+C;AAC/C,eAAO,MAAM,eAAe,QAAO,cAGjC,CAAC;AAkCH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,UAAW,MAAM,KAAG,cAAc,GAAG,IAqBpE,CAAC;AA+BF,0DAA0D;AAC1D,eAAO,MAAM,aAAa,gBACZ,mBAAmB,UACxB,cAAc,KACpB,OAOF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,gBAAiB,mBAAmB,UAAU,cAAc,KAAG,OAGrF,CAAC;AAEF,oEAAoE;AACpE,eAAO,MAAM,oBAAoB,WAAY,cAAc,KAAG,MAO7D,CAAC"}
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
import * as Context from "effect/Context";
|
|
10
10
|
import * as Effect from "effect/Effect";
|
|
11
11
|
import * as Layer from "effect/Layer";
|
|
12
|
-
|
|
13
|
-
export type Phase = "preflight" | "resolve" | "download" | "archive" | "done";
|
|
12
|
+
import type { Phase } from "./enums/phase.js";
|
|
14
13
|
/** A structured progress event. */
|
|
15
14
|
export type ProgressEvent =
|
|
16
15
|
/** A phase began. `total` is set only when it is known up front. */
|
|
@@ -74,11 +73,13 @@ export type ProgressEvent =
|
|
|
74
73
|
readonly _tag: "Warning";
|
|
75
74
|
readonly message: string;
|
|
76
75
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
export declare namespace Progress {
|
|
77
|
+
/** The reporting sink. */
|
|
78
|
+
type Service = {
|
|
79
|
+
readonly emit: (event: ProgressEvent) => Effect.Effect<void>;
|
|
80
|
+
};
|
|
80
81
|
}
|
|
81
|
-
declare const Progress_base: Context.ServiceClass<Progress, "@packall/core/Progress",
|
|
82
|
+
declare const Progress_base: Context.ServiceClass<Progress, "@packall/core/Progress", Progress.Service>;
|
|
82
83
|
/** Service tag for progress reporting. */
|
|
83
84
|
export declare class Progress extends Progress_base {
|
|
84
85
|
}
|
|
@@ -96,12 +97,12 @@ export declare const layerCallback: (onEvent: (event: ProgressEvent) => void) =>
|
|
|
96
97
|
/**
|
|
97
98
|
* Accumulates every event into a `Ref`, for assertions.
|
|
98
99
|
*
|
|
99
|
-
* Returned as `
|
|
100
|
-
* transcript afterwards.
|
|
100
|
+
* Returned as `{ layer, events }` so a test can provide the layer and then read
|
|
101
|
+
* the transcript afterwards.
|
|
101
102
|
*/
|
|
102
103
|
export declare const makeCollector: Effect.Effect<{
|
|
103
104
|
readonly layer: Layer.Layer<Progress, never, never>;
|
|
104
105
|
readonly events: Effect.Effect<readonly ProgressEvent[], never, never>;
|
|
105
106
|
}, never, never>;
|
|
106
107
|
export {};
|
|
107
|
-
//# sourceMappingURL=
|
|
108
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../src/progress.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,mCAAmC;AACnC,MAAM,MAAM,aAAa;AACxB,oEAAoE;AAClE;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE;AAC/F,wBAAwB;GACtB;IAAE,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE;AAC5D,iEAAiE;GAC/D;IACA,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8DAA8D;IAC9D,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,4CAA4C;IAC5C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC7B;AACH,kCAAkC;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C,KAAK,EAAE,aAAa,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KAC7D,CAAC;CACF;;AAED,0CAA0C;AAC1C,qBAAa,QAAS,SAAQ,aAE7B;CAAG;AAEJ,yDAAyD;AACzD,eAAO,MAAM,IAAI,UAAW,aAAa,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAI5E,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAE5C,CAAC;AAEH,iEAAiE;AACjE,eAAO,MAAM,aAAa,YAAa,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,KAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,CAGzF,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;gBAMxB,CAAC"}
|
|
@@ -12,7 +12,17 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import * as Context from "effect/Context";
|
|
14
14
|
import type * as Effect from "effect/Effect";
|
|
15
|
-
import type { BundlerError } from "./
|
|
15
|
+
import type { BundlerError } from "./errors.js";
|
|
16
|
+
/** Where the tarball lives and how to prove it arrived intact. */
|
|
17
|
+
export type PackageDist = {
|
|
18
|
+
readonly tarball: string;
|
|
19
|
+
/** SRI string, e.g. `sha512-...`. Preferred over `shasum`. */
|
|
20
|
+
readonly integrity?: string | undefined;
|
|
21
|
+
/** Legacy hex sha1. Still the only checksum on very old versions. */
|
|
22
|
+
readonly shasum?: string | undefined;
|
|
23
|
+
readonly unpackedSize?: number | undefined;
|
|
24
|
+
readonly fileCount?: number | undefined;
|
|
25
|
+
};
|
|
16
26
|
/**
|
|
17
27
|
* A single published version, as the registry describes it.
|
|
18
28
|
*
|
|
@@ -21,7 +31,7 @@ import type { BundlerError } from "./Errors.js";
|
|
|
21
31
|
* because registries add metadata over time and a bundler that breaks on new
|
|
22
32
|
* metadata is worse than useless.
|
|
23
33
|
*/
|
|
24
|
-
export
|
|
34
|
+
export type PackageManifest = {
|
|
25
35
|
readonly name: string;
|
|
26
36
|
readonly version: string;
|
|
27
37
|
readonly dependencies?: Readonly<Record<string, string>> | undefined;
|
|
@@ -38,50 +48,42 @@ export interface PackageManifest {
|
|
|
38
48
|
readonly libc?: ReadonlyArray<string> | undefined;
|
|
39
49
|
readonly deprecated?: string | undefined;
|
|
40
50
|
readonly dist: PackageDist;
|
|
41
|
-
}
|
|
42
|
-
/** Where the tarball lives and how to prove it arrived intact. */
|
|
43
|
-
export interface PackageDist {
|
|
44
|
-
readonly tarball: string;
|
|
45
|
-
/** SRI string, e.g. `sha512-...`. Preferred over `shasum`. */
|
|
46
|
-
readonly integrity?: string | undefined;
|
|
47
|
-
/** Legacy hex sha1. Still the only checksum on very old versions. */
|
|
48
|
-
readonly shasum?: string | undefined;
|
|
49
|
-
readonly unpackedSize?: number | undefined;
|
|
50
|
-
readonly fileCount?: number | undefined;
|
|
51
|
-
}
|
|
51
|
+
};
|
|
52
52
|
/** Everything the registry knows about one package. */
|
|
53
|
-
export
|
|
53
|
+
export type Packument = {
|
|
54
54
|
readonly name: string;
|
|
55
55
|
/** `{ latest: "1.2.3", next: "2.0.0-beta.1" }` */
|
|
56
56
|
readonly distTags: Readonly<Record<string, string>>;
|
|
57
57
|
/** Every published version, keyed by version string. */
|
|
58
58
|
readonly versions: Readonly<Record<string, PackageManifest>>;
|
|
59
|
+
};
|
|
60
|
+
export declare namespace Registry {
|
|
61
|
+
/** The set of operations a registry backend has to provide. */
|
|
62
|
+
type Service = {
|
|
63
|
+
/** Short identifier for the manifest and for error messages, e.g. `"npm"`. */
|
|
64
|
+
readonly kind: string;
|
|
65
|
+
/**
|
|
66
|
+
* The registry URL that will actually be used for a given package, after
|
|
67
|
+
* per-scope configuration is applied. Used for reporting only.
|
|
68
|
+
*/
|
|
69
|
+
readonly registryFor: (packageName: string) => string;
|
|
70
|
+
/**
|
|
71
|
+
* Cheap liveness check, run once before any real work.
|
|
72
|
+
*
|
|
73
|
+
* This is what turns "hangs forever behind a dead VPN" into a five-second
|
|
74
|
+
* error naming the host we could not reach.
|
|
75
|
+
*/
|
|
76
|
+
readonly preflight: Effect.Effect<void, BundlerError>;
|
|
77
|
+
/**
|
|
78
|
+
* Full metadata for a package. Implementations are expected to memoise:
|
|
79
|
+
* the dependency walk asks for the same popular packages repeatedly.
|
|
80
|
+
*/
|
|
81
|
+
readonly packument: (packageName: string) => Effect.Effect<Packument, BundlerError>;
|
|
82
|
+
/** Fetches the tarball bytes for one published version. */
|
|
83
|
+
readonly download: (manifest: PackageManifest) => Effect.Effect<Uint8Array, BundlerError>;
|
|
84
|
+
};
|
|
59
85
|
}
|
|
60
|
-
|
|
61
|
-
export interface RegistryService {
|
|
62
|
-
/** Short identifier for the manifest and for error messages, e.g. `"npm"`. */
|
|
63
|
-
readonly kind: string;
|
|
64
|
-
/**
|
|
65
|
-
* The registry URL that will actually be used for a given package, after
|
|
66
|
-
* per-scope configuration is applied. Used for reporting only.
|
|
67
|
-
*/
|
|
68
|
-
readonly registryFor: (packageName: string) => string;
|
|
69
|
-
/**
|
|
70
|
-
* Cheap liveness check, run once before any real work.
|
|
71
|
-
*
|
|
72
|
-
* This is what turns "hangs forever behind a dead VPN" into a five-second
|
|
73
|
-
* error naming the host we could not reach.
|
|
74
|
-
*/
|
|
75
|
-
readonly preflight: Effect.Effect<void, BundlerError>;
|
|
76
|
-
/**
|
|
77
|
-
* Full metadata for a package. Implementations are expected to memoise:
|
|
78
|
-
* the dependency walk asks for the same popular packages repeatedly.
|
|
79
|
-
*/
|
|
80
|
-
readonly packument: (packageName: string) => Effect.Effect<Packument, BundlerError>;
|
|
81
|
-
/** Fetches the tarball bytes for one published version. */
|
|
82
|
-
readonly download: (manifest: PackageManifest) => Effect.Effect<Uint8Array, BundlerError>;
|
|
83
|
-
}
|
|
84
|
-
declare const Registry_base: Context.ServiceClass<Registry, "@packall/core/Registry", RegistryService>;
|
|
86
|
+
declare const Registry_base: Context.ServiceClass<Registry, "@packall/core/Registry", Registry.Service>;
|
|
85
87
|
/**
|
|
86
88
|
* Service tag for the registry backend.
|
|
87
89
|
*
|
|
@@ -98,9 +100,5 @@ declare const Registry_base: Context.ServiceClass<Registry, "@packall/core/Regis
|
|
|
98
100
|
*/
|
|
99
101
|
export declare class Registry extends Registry_base {
|
|
100
102
|
}
|
|
101
|
-
/** Extracts the dist-tag mapping, defaulting sensibly when a registry omits it. */
|
|
102
|
-
export declare const resolveDistTag: (packument: Packument, tag: string) => string | undefined;
|
|
103
|
-
/** All published version strings, in registry order. */
|
|
104
|
-
export declare const publishedVersions: (packument: Packument) => ReadonlyArray<string>;
|
|
105
103
|
export {};
|
|
106
|
-
//# sourceMappingURL=
|
|
104
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,kEAAkE;AAClE,MAAM,MAAM,WAAW,GAAG;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,qEAAqE;IACrE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC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D,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;CAC7D,CAAC;AAEF,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IACjC,+DAA+D;IAC/D,KAAY,OAAO,GAAG;QACrB,8EAA8E;QAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAEtB;;;WAGG;QACH,QAAQ,CAAC,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC;QAEtD;;;;;WAKG;QACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAEtD;;;WAGG;QACH,QAAQ,CAAC,SAAS,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAEpF,2DAA2D;QAC3D,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;KAC1F,CAAC;CACF;;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,QAAS,SAAQ,aAE7B;CAAG"}
|
|
@@ -17,14 +17,13 @@
|
|
|
17
17
|
* is touched exactly once per package.
|
|
18
18
|
*/
|
|
19
19
|
import * as Effect from "effect/Effect";
|
|
20
|
-
import
|
|
21
|
-
import type {
|
|
22
|
-
import type {
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
export type EdgeKind = "prod" | "optional" | "peer";
|
|
20
|
+
import { EdgeKind } from "./enums/edge-kind.js";
|
|
21
|
+
import type { BundlerError } from "./errors.js";
|
|
22
|
+
import type { ResolveOptions } from "./options.js";
|
|
23
|
+
import * as Progress from "./progress.js";
|
|
24
|
+
import type { PackageManifest, Packument } from "./registry.js";
|
|
25
|
+
import { Registry } from "./registry.js";
|
|
26
|
+
import type { PackageSpec, Selector } from "./spec.js";
|
|
28
27
|
/** A single justification for including a package. */
|
|
29
28
|
export type Reason = {
|
|
30
29
|
readonly _tag: "Root";
|
|
@@ -36,22 +35,21 @@ export type Reason = {
|
|
|
36
35
|
};
|
|
37
36
|
/** `name@version` — the identity of a resolved package throughout the engine. */
|
|
38
37
|
export type PackageKey = string;
|
|
39
|
-
export declare const packageKey: (name: string, version: string) => PackageKey;
|
|
40
38
|
/** One package, pinned to one version, with every reason it was pulled in. */
|
|
41
|
-
export
|
|
39
|
+
export type ResolvedPackage = {
|
|
42
40
|
readonly name: string;
|
|
43
41
|
readonly version: string;
|
|
44
42
|
readonly manifest: PackageManifest;
|
|
45
43
|
readonly reasons: ReadonlyArray<Reason>;
|
|
46
|
-
}
|
|
44
|
+
};
|
|
47
45
|
/** Something we could not include, reported rather than thrown. */
|
|
48
|
-
export
|
|
46
|
+
export type ResolutionWarning = {
|
|
49
47
|
readonly message: string;
|
|
50
48
|
/** `name@version` of the package whose manifest contained the problem. */
|
|
51
49
|
readonly from?: string | undefined;
|
|
52
|
-
}
|
|
50
|
+
};
|
|
53
51
|
/** What one requested spec expanded to. */
|
|
54
|
-
export
|
|
52
|
+
export type RootResolution = {
|
|
55
53
|
readonly spec: PackageSpec;
|
|
56
54
|
/** The concrete versions the spec selected — more than one under `--all-versions`. */
|
|
57
55
|
readonly versions: ReadonlyArray<string>;
|
|
@@ -59,14 +57,23 @@ export interface RootResolution {
|
|
|
59
57
|
readonly closures: ReadonlyMap<string, ReadonlyArray<PackageKey>>;
|
|
60
58
|
/** Union of every per-version closure. */
|
|
61
59
|
readonly closure: ReadonlyArray<PackageKey>;
|
|
62
|
-
}
|
|
60
|
+
};
|
|
63
61
|
/** The complete result of resolving every requested spec. */
|
|
64
|
-
export
|
|
62
|
+
export type Resolution = {
|
|
65
63
|
readonly roots: ReadonlyArray<RootResolution>;
|
|
66
64
|
/** The deduplicated union of every closure, sorted by name then version. */
|
|
67
65
|
readonly packages: ReadonlyArray<ResolvedPackage>;
|
|
68
66
|
readonly warnings: ReadonlyArray<ResolutionWarning>;
|
|
69
|
-
}
|
|
67
|
+
};
|
|
68
|
+
/** One pending item on the BFS frontier. */
|
|
69
|
+
export type Task = {
|
|
70
|
+
readonly name: string;
|
|
71
|
+
readonly selector: Selector;
|
|
72
|
+
readonly reason: Reason;
|
|
73
|
+
/** Optional edges tolerate resolution failure; required ones do not. */
|
|
74
|
+
readonly tolerateFailure: boolean;
|
|
75
|
+
};
|
|
76
|
+
export declare const packageKey: (name: string, version: string) => PackageKey;
|
|
70
77
|
/** Index of a resolution by `name@version`, for lookups during bundling. */
|
|
71
78
|
export declare const indexPackages: (resolution: Resolution) => ReadonlyMap<PackageKey, ResolvedPackage>;
|
|
72
79
|
/**
|
|
@@ -81,14 +88,6 @@ export declare const selectVersions: (packument: Packument, selector: Selector,
|
|
|
81
88
|
readonly maxVersions?: number | undefined;
|
|
82
89
|
readonly includePrerelease: boolean;
|
|
83
90
|
}) => ReadonlyArray<string>;
|
|
84
|
-
/** One pending item on the BFS frontier. */
|
|
85
|
-
export interface Task {
|
|
86
|
-
readonly name: string;
|
|
87
|
-
readonly selector: Selector;
|
|
88
|
-
readonly reason: Reason;
|
|
89
|
-
/** Optional edges tolerate resolution failure; required ones do not. */
|
|
90
|
-
readonly tolerateFailure: boolean;
|
|
91
|
-
}
|
|
92
91
|
/** Expands one resolved manifest into the edges that follow from it. */
|
|
93
92
|
export declare const edgesOf: (manifest: PackageManifest, options: ResolveOptions) => {
|
|
94
93
|
readonly tasks: ReadonlyArray<Task>;
|
|
@@ -102,4 +101,4 @@ export declare const edgesOf: (manifest: PackageManifest, options: ResolveOption
|
|
|
102
101
|
* reached from twenty roots is fetched once.
|
|
103
102
|
*/
|
|
104
103
|
export declare const resolve: (specs: ReadonlyArray<PackageSpec>, options: ResolveOptions) => Effect.Effect<Resolution, BundlerError, Registry | Progress.Progress>;
|
|
105
|
-
//# sourceMappingURL=
|
|
104
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGvD,sDAAsD;AACtD,MAAM,MAAM,MAAM,GACf;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE7E,iFAAiF;AACjF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,8EAA8E;AAC9E,MAAM,MAAM,eAAe,GAAG;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAA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AAM,aAAa,eAAgB,UAAU,KAAG,WAAW,CAAC,UAAU,EAAE,eAAe,CACV,CAAC;AAMrF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,cACf,SAAS,YACV,QAAQ,WACT;IACR,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;CACpC,KACC,aAAa,CAAC,MAAM,CAqDtB,CAAC;AA+EF,wEAAwE;AACxE,eAAO,MAAM,OAAO,aACT,eAAe,WAChB,cAAc,KACrB;IACF,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;CAsDpD,CAAC;AA8LF;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,UACZ,aAAa,CAAC,WAAW,CAAC,WACxB,cAAc,KACrB,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAkDpE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
/**
|
|
3
|
+
* An optional field that goes *absent* rather than failing when it is
|
|
4
|
+
* malformed.
|
|
5
|
+
*
|
|
6
|
+
* This is the difference between "we do not understand this field" and "we do
|
|
7
|
+
* not understand this document". An `os: "linux"` where an array was expected
|
|
8
|
+
* costs the platform filter one signal; it should not cost the run the package.
|
|
9
|
+
*/
|
|
10
|
+
export declare const tolerant: <S extends Schema.Top>(schema: S) => Schema.optional<Schema.middlewareDecoding<Schema.UndefinedOr<S>, S["DecodingServices"]>>;
|
|
11
|
+
/**
|
|
12
|
+
* Keeps only the string-valued members of an untyped object.
|
|
13
|
+
*
|
|
14
|
+
* `{ "lodash": "^4.0.0", "broken": 3 }` decodes to `{ "lodash": "^4.0.0" }`.
|
|
15
|
+
* Per-entry rather than whole-record tolerance, because one unreadable edge in
|
|
16
|
+
* a dependency block is no reason to forget the others.
|
|
17
|
+
*/
|
|
18
|
+
export declare const StringRecordSchema: Schema.decodeTo<Schema.$Record<Schema.String, Schema.String>, Schema.$Record<Schema.String, Schema.Unknown>, never, never>;
|
|
19
|
+
/** The same per-entry tolerance for a list: `["linux", 7]` decodes to `["linux"]`. */
|
|
20
|
+
export declare const StringArraySchema: Schema.decodeTo<Schema.$Array<Schema.String>, Schema.$Array<Schema.Unknown>, never, never>;
|
|
21
|
+
/**
|
|
22
|
+
* `peerDependenciesMeta`, normalised.
|
|
23
|
+
*
|
|
24
|
+
* Only `optional` is read, and only its `true` is meaningful — npm writes the
|
|
25
|
+
* flag as a boolean, a hand-edited file may carry anything, and every other
|
|
26
|
+
* value means "not optional".
|
|
27
|
+
*/
|
|
28
|
+
export declare const OptionalFlagRecordSchema: Schema.decodeTo<Schema.$Record<Schema.String, Schema.Struct<{
|
|
29
|
+
readonly optional: Schema.Boolean;
|
|
30
|
+
}>>, Schema.$Record<Schema.String, Schema.Unknown>, never, never>;
|
|
31
|
+
export declare const OptionalStringRecordSchema: Schema.decodeTo<Schema.UndefinedOr<Schema.$Record<Schema.String, Schema.String>>, Schema.decodeTo<Schema.$Record<Schema.String, Schema.String>, Schema.$Record<Schema.String, Schema.Unknown>, never, never>, never, never>;
|
|
32
|
+
export declare const OptionalStringArraySchema: Schema.decodeTo<Schema.UndefinedOr<Schema.$Array<Schema.String>>, Schema.decodeTo<Schema.$Array<Schema.String>, Schema.$Array<Schema.Unknown>, never, never>, never, never>;
|
|
33
|
+
export declare const OptionalFlagRecordOrAbsentSchema: Schema.decodeTo<Schema.UndefinedOr<Schema.$Record<Schema.String, Schema.Struct<{
|
|
34
|
+
readonly optional: Schema.Boolean;
|
|
35
|
+
}>>>, Schema.decodeTo<Schema.$Record<Schema.String, Schema.Struct<{
|
|
36
|
+
readonly optional: Schema.Boolean;
|
|
37
|
+
}>>, Schema.$Record<Schema.String, Schema.Unknown>, never, never>, never, never>;
|
|
38
|
+
//# sourceMappingURL=lenient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lenient.d.ts","sourceRoot":"","sources":["../../src/schemas/lenient.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,CAAC,GAAG,UAAU,CAAC,6FAKtD,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,4HAW9B,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,iBAAiB,4FAO7B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB;;iEAWpC,CAAC;AAcF,eAAO,MAAM,0BAA0B,6NAKtC,CAAC;AAEF,eAAO,MAAM,yBAAyB,6KAOrC,CAAC;AAEF,eAAO,MAAM,gCAAgC;;;;gFAc5C,CAAC"}
|