@packall/core 0.0.1 → 0.1.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/dist/{Archive.d.ts → archive.d.ts} +5 -5
- package/dist/archive.d.ts.map +1 -0
- package/dist/{Bundle.d.ts → bundle.d.ts} +51 -36
- 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} +7 -7
- 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 +44 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2416 -1180
- 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 → integrity.d.ts} +3 -3
- package/dist/integrity.d.ts.map +1 -0
- package/dist/{Layout.d.ts → layout.d.ts} +1 -1
- package/dist/{Layout.d.ts.map → layout.d.ts.map} +1 -1
- 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/{Options.d.ts → options.d.ts} +9 -27
- package/dist/options.d.ts.map +1 -0
- package/dist/{Platform.d.ts → platform.d.ts} +9 -9
- 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 +3 -2
- package/src/{Archive.ts → archive.ts} +92 -92
- package/src/{Bundle.ts → bundle.ts} +616 -570
- package/src/{DependencyRange.ts → dependency-range.ts} +115 -115
- package/src/{Download.ts → download.ts} +133 -132
- 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 → errors.ts} +87 -5
- package/src/index.ts +133 -35
- package/src/{InputFile.ts → input-file.ts} +127 -44
- package/src/{Integrity.ts → integrity.ts} +121 -122
- package/src/locked-resolve.ts +461 -0
- package/src/lockfile/bun.ts +207 -0
- package/src/lockfile/detect.ts +80 -0
- package/src/lockfile/json.ts +132 -0
- package/src/lockfile/names.ts +20 -0
- package/src/lockfile/npm.ts +308 -0
- package/src/lockfile/parse.ts +56 -0
- package/src/lockfile/pnpm.ts +225 -0
- package/src/lockfile/tree-builder.ts +166 -0
- package/src/lockfile/types.ts +74 -0
- package/src/{Manifest.ts → manifest.ts} +133 -133
- package/src/{Options.ts → options.ts} +7 -27
- package/src/{Platform.ts → platform.ts} +23 -23
- package/src/{Progress.ts → progress.ts} +106 -106
- package/src/{Registry.ts → registry.ts} +115 -121
- package/src/{Resolve.ts → resolve.ts} +537 -528
- package/src/schemas/lenient.ts +123 -0
- package/src/schemas/package-json.ts +27 -0
- package/src/{Spec.ts → spec.ts} +11 -19
- package/src/types/value-of.ts +8 -0
- package/src/utils/is-record.ts +8 -0
- 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.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/{Layout.ts → layout.ts} +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `--file` handling.
|
|
3
|
+
*
|
|
4
|
+
* One flag, three accepted shapes, detected from the content rather than the
|
|
5
|
+
* extension so that `--file deps.json` and `--file my-packages` both do the
|
|
6
|
+
* obvious thing:
|
|
7
|
+
*
|
|
8
|
+
* - a **package.json** — bundle everything it depends on
|
|
9
|
+
* - a **lockfile** — npm, pnpm or bun; bundle the exact versions it pins
|
|
10
|
+
* - a **newline-delimited list** — one spec per line, `#` and `//` comments
|
|
11
|
+
* allowed, blank lines ignored
|
|
12
|
+
*
|
|
13
|
+
* A lockfile is checked for first, because `package-lock.json` and
|
|
14
|
+
* `package.json` are both JSON objects and only the content tells them apart.
|
|
15
|
+
*/
|
|
16
|
+
import * as Effect from "effect/Effect";
|
|
17
|
+
import * as FileSystem from "effect/FileSystem";
|
|
18
|
+
import { InputFileKind } from "./enums/input-file-kind.js";
|
|
19
|
+
import type { LockfileError } from "./errors.js";
|
|
20
|
+
import { InvalidInputFileError } from "./errors.js";
|
|
21
|
+
import type { LockedTree } from "./lockfile/types.js";
|
|
22
|
+
import type { PackageSpec } from "./spec.js";
|
|
23
|
+
export type InputFileResult = {
|
|
24
|
+
readonly kind: InputFileKind;
|
|
25
|
+
readonly specs: ReadonlyArray<PackageSpec>;
|
|
26
|
+
/** Entries that were recognised but cannot be bundled from a registry. */
|
|
27
|
+
readonly warnings: ReadonlyArray<string>;
|
|
28
|
+
/**
|
|
29
|
+
* The pinned graph, set only for a lockfile.
|
|
30
|
+
*
|
|
31
|
+
* `specs` carries the same roots for display, but a lockfile run must resolve
|
|
32
|
+
* from this — see `locked-resolve` for why re-resolving the roots' ranges
|
|
33
|
+
* would quietly produce a different bundle.
|
|
34
|
+
*/
|
|
35
|
+
readonly lockfile?: LockedTree | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Names from the blocks a package.json always installs — `dependencies` and,
|
|
38
|
+
* unless `--prod`, `devDependencies`.
|
|
39
|
+
*
|
|
40
|
+
* Used to check a lockfile against the manifest beside it. Deliberately
|
|
41
|
+
* excludes optional and peer entries: both are legitimately absent from a
|
|
42
|
+
* lockfile (an optional dependency that failed to build, a peer the consumer
|
|
43
|
+
* is expected to supply), so including them would turn a useful staleness
|
|
44
|
+
* check into a false alarm.
|
|
45
|
+
*/
|
|
46
|
+
readonly required?: ReadonlyArray<string> | undefined;
|
|
47
|
+
};
|
|
48
|
+
/** Which dependency blocks of a package.json become root specs. */
|
|
49
|
+
export type InputFileOptions = {
|
|
50
|
+
/**
|
|
51
|
+
* Include `devDependencies`.
|
|
52
|
+
*
|
|
53
|
+
* On by default: if you are pointing this tool at a package.json, you are
|
|
54
|
+
* almost certainly trying to make that project installable behind the
|
|
55
|
+
* firewall, and a project without its dev tooling does not build. `--prod`
|
|
56
|
+
* turns it off.
|
|
57
|
+
*/
|
|
58
|
+
readonly includeDev: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* For a lockfile, which workspace member's dependencies are the roots.
|
|
61
|
+
*
|
|
62
|
+
* Set when a package.json found its lockfile by walking up: the file then
|
|
63
|
+
* covers the whole repository, and only one member of it was asked for.
|
|
64
|
+
*/
|
|
65
|
+
readonly importer?: string | undefined;
|
|
66
|
+
};
|
|
67
|
+
export declare const defaultInputFileOptions: InputFileOptions;
|
|
68
|
+
/** Reads and parses an input file. */
|
|
69
|
+
export declare const readInputFile: (filePath: string, options?: InputFileOptions) => Effect.Effect<InputFileResult, InvalidInputFileError | LockfileError, FileSystem.FileSystem>;
|
|
70
|
+
/**
|
|
71
|
+
* Parses file content that has already been read.
|
|
72
|
+
*
|
|
73
|
+
* Split out from the IO so the whole of this logic is testable with plain
|
|
74
|
+
* strings and no file system at all.
|
|
75
|
+
*/
|
|
76
|
+
export declare const parseInputFile: (filePath: string, content: string, options?: InputFileOptions) => InputFileResult;
|
|
77
|
+
//# sourceMappingURL=input-file.d.ts.map
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AC,eAAe,EAAE,qBAAqB,GAAG,aAAa,EAAE,UAAU,CAAC,UAAU,CAwB1F,CAAA;AAKJ;;;;;GAKG;AACH,eAAO,MAAM,cAAc,aACf,MAAM,WACP,MAAM,YACN,gBAAgB,KACxB,eAoBF,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** One parsed SRI hash. */
|
|
2
|
-
export
|
|
2
|
+
export type IntegrityHash = {
|
|
3
3
|
readonly algorithm: string;
|
|
4
4
|
/** Base64 digest, exactly as written in the SRI string. */
|
|
5
5
|
readonly digest: string;
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
7
|
/**
|
|
8
8
|
* Parses an SRI string such as `sha512-abc...==`.
|
|
9
9
|
*
|
|
@@ -45,4 +45,4 @@ export declare const verify: (data: Uint8Array, dist: {
|
|
|
45
45
|
readonly integrity?: string | undefined;
|
|
46
46
|
readonly shasum?: string | undefined;
|
|
47
47
|
}) => VerificationResult;
|
|
48
|
-
//# sourceMappingURL=
|
|
48
|
+
//# sourceMappingURL=integrity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrity.d.ts","sourceRoot":"","sources":["../src/integrity.ts"],"names":[],"mappings":"AAcA,2BAA2B;AAC3B,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB,CAAA;AAID;;;;;GAKG;AACH,eAAO,MAAM,cAAc,cAAe,MAAM,KAAG,aAAa,CAAC,aAAa,CAY7E,CAAA;AAED,oEAAoE;AACpE,eAAO,MAAM,QAAQ,SAAU,UAAU,aAAa,MAAM,KAAG,MACV,CAAA;AAErD,6EAA6E;AAC7E,eAAO,MAAM,WAAW,SAAU,UAAU,aAAa,MAAM,KAAG,MAChB,CAAA;AAElD,qCAAqC;AACrC,MAAM,MAAM,kBAAkB;AAC5B,8CAA8C;AAC5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M,KAAG,MAIlE,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,iBAAiB,qBAAsB,MAAuB,CAAA;AAE3E;;;;;GAKG;AACH,eAAO,MAAM,WAAW,YAAa;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B,KAAG,MA+BH,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolution driven by a lockfile instead of by semver.
|
|
3
|
+
*
|
|
4
|
+
* The distinction matters more than it first looks. Feeding a lockfile's
|
|
5
|
+
* versions in as exact root specs and letting the ordinary walk run would still
|
|
6
|
+
* produce the wrong bundle: every *transitive* edge is a range, and
|
|
7
|
+
* `Resolve.walk` answers a range with whatever is newest today. Lock `tslib` at
|
|
8
|
+
* 2.6.0 and let something depending on `tslib@^2` be re-resolved, and the
|
|
9
|
+
* bundle grows a second copy at 2.8.1 that CI never installed.
|
|
10
|
+
*
|
|
11
|
+
* So the lockfile is treated as the graph, not as a set of hints. The package
|
|
12
|
+
* set *is* what the file pins, and every edge is satisfied from inside it.
|
|
13
|
+
* Nothing here calls `selectVersions`; the only thing the registry is asked for
|
|
14
|
+
* is the metadata that a lockfile does not record — `dist`, and the `os`/`cpu`
|
|
15
|
+
* constraints that `--platform` narrows on.
|
|
16
|
+
*
|
|
17
|
+
* The result is an ordinary `Resolution`, so layout, archiving, the manifest
|
|
18
|
+
* and the summary cannot tell which path produced it.
|
|
19
|
+
*/
|
|
20
|
+
import * as Effect from "effect/Effect";
|
|
21
|
+
import type { BundlerError } from "./errors.js";
|
|
22
|
+
import type { LockedTree } from "./lockfile/types.js";
|
|
23
|
+
import type { ResolveOptions } from "./options.js";
|
|
24
|
+
import * as Progress from "./progress.js";
|
|
25
|
+
import { Registry } from "./registry.js";
|
|
26
|
+
import type { Resolution } from "./resolve.js";
|
|
27
|
+
/** Options for a lockfile-pinned resolution. */
|
|
28
|
+
export type LockedResolveOptions = ResolveOptions & {
|
|
29
|
+
/**
|
|
30
|
+
* Include the project's `devDependencies`.
|
|
31
|
+
*
|
|
32
|
+
* Matches `--file package.json`: on by default, because a project without its
|
|
33
|
+
* dev tooling does not build behind the firewall either.
|
|
34
|
+
*/
|
|
35
|
+
readonly includeDev: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Direct dependency names declared by the accompanying package.json.
|
|
38
|
+
*
|
|
39
|
+
* When present, anything declared there but absent from the lockfile's roots
|
|
40
|
+
* means the two have drifted — which is exactly the silent-mismatch case this
|
|
41
|
+
* whole feature exists to catch, so it is reported rather than papered over.
|
|
42
|
+
*/
|
|
43
|
+
readonly declared?: ReadonlyArray<string> | undefined;
|
|
44
|
+
};
|
|
45
|
+
/** Turns a parsed lockfile into a resolution, pinning every version. */
|
|
46
|
+
export declare const resolveLocked: (lock: LockedTree, options: LockedResolveOptions) => Effect.Effect<Resolution, BundlerError, Registry | Progress.Progress>;
|
|
47
|
+
//# sourceMappingURL=locked-resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locked-resolve.d.ts","sourceRoot":"","sources":["../src/locked-resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAKvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAGR,UAAU,EAIb,MAAM,cAAc,CAAA;AAKrB,gDAAgD;AAChD,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG;IAChD;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;CACxD,CAAA;AAED,wEAAwE;AACxE,eAAO,MAAM,aAAa,SAChB,UAAU,WACP,oBAAoB,KAC9B,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CA6EjE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../../src/lockfile/bun.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,YAAY,CAAA;AAqBxD,eAAO,MAAM,gBAAgB,SACrB,MAAM,WACH,MAAM,YACL,MAAM,GAAG,SAAS,KAC3B,UAsBF,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Working out which lockfile — if any — some content is.
|
|
3
|
+
*
|
|
4
|
+
* Detection is by content, matching how `--file` treats everything else: a
|
|
5
|
+
* lockfile renamed to `deps.txt` still parses, and a `package-lock.json` that
|
|
6
|
+
* is actually a package.json still gets read as one.
|
|
7
|
+
*/
|
|
8
|
+
import { LockfileFormat } from "../enums/lockfile-format.js";
|
|
9
|
+
/** What a blob of file content turned out to be. */
|
|
10
|
+
export type LockfileDetection = {
|
|
11
|
+
readonly _tag: "Supported";
|
|
12
|
+
readonly format: LockfileFormat;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Recognisably a lockfile, but not one we can read. Named explicitly so the
|
|
16
|
+
* error says "yarn.lock is not supported yet" rather than leaving somebody to
|
|
17
|
+
* work out why their file parsed as a spec list.
|
|
18
|
+
*/
|
|
19
|
+
| {
|
|
20
|
+
readonly _tag: "Unsupported";
|
|
21
|
+
readonly label: string;
|
|
22
|
+
readonly hint: string;
|
|
23
|
+
} | {
|
|
24
|
+
readonly _tag: "NotALockfile";
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Deliberately cheap and total: it never throws, so `--file` can try this
|
|
28
|
+
* first and fall through to its other shapes when the answer is `NotALockfile`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const detectLockfile: (content: string) => LockfileDetection;
|
|
31
|
+
//# sourceMappingURL=detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../src/lockfile/detect.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAI5D,oDAAoD;AACpD,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;CAAE;AACjE;;;;GAIG;GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/E;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;CAAE,CAAA;AAErC;;;GAGG;AACH,eAAO,MAAM,cAAc,YAAa,MAAM,KAAG,iBA8BhD,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const stringOr: (value: unknown, fallback: string) => string;
|
|
2
|
+
/** Keeps only the string-valued members of an untyped object. */
|
|
3
|
+
export declare const stringRecord: (value: unknown) => Readonly<Record<string, string>>;
|
|
4
|
+
/** Names a package marked its peers optional with. */
|
|
5
|
+
export declare const optionalPeerNames: (value: unknown) => ReadonlySet<string>;
|
|
6
|
+
export declare const parseJsonObject: (path: string, content: string) => Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* Parses JSON, tolerating the comments and trailing commas bun writes.
|
|
9
|
+
*
|
|
10
|
+
* `bun.lock` is JSONC by design — bun puts explanatory comments in it — so
|
|
11
|
+
* plain `JSON.parse` rejects real lockfiles. Returns `undefined` rather than
|
|
12
|
+
* throwing so detection can use it as a probe.
|
|
13
|
+
*/
|
|
14
|
+
export declare const tryParseJsonc: (content: string) => unknown;
|
|
15
|
+
/**
|
|
16
|
+
* Removes comments and trailing commas.
|
|
17
|
+
*
|
|
18
|
+
* String-aware, because a `//` inside a tarball URL is not a comment and an
|
|
19
|
+
* escaped quote does not end a string. Both appear in every real lockfile.
|
|
20
|
+
*/
|
|
21
|
+
export declare const stripJsonc: (content: string) => string;
|
|
22
|
+
export declare const describeError: (error: unknown) => string;
|
|
23
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/lockfile/json.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ,UAAW,OAAO,YAAY,MAAM,KAAG,MACd,CAAA;AAI9C,iEAAiE;AACjE,eAAO,MAAM,YAAY,UAAW,OAAO,KAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CACI,CAAA;AAIjF,sDAAsD;AACtD,eAAO,MAAM,iBAAiB,UAAW,OAAO,KAAG,WAAW,CAAC,MAAM,CAQpE,CAAA;AAED,eAAO,MAAM,eAAe,SAAU,MAAM,WAAW,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CASrF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,YAAa,MAAM,KAAG,OAU/C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,YAAa,MAAM,KAAG,MAuD5C,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,OAAO,KAAG,MACS,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LockfileFormat } from "../enums/lockfile-format.js";
|
|
2
|
+
/**
|
|
3
|
+
* The file name each supported manager writes, in detection order.
|
|
4
|
+
*
|
|
5
|
+
* Ordered: `package-lock.json` before `npm-shrinkwrap.json` before pnpm's and
|
|
6
|
+
* bun's, so a directory holding several is searched the way npm itself would.
|
|
7
|
+
*/
|
|
8
|
+
export declare const formatByLockfileName: {
|
|
9
|
+
readonly "package-lock.json": "npm";
|
|
10
|
+
readonly "npm-shrinkwrap.json": "npm";
|
|
11
|
+
readonly "pnpm-lock.yaml": "pnpm";
|
|
12
|
+
readonly "bun.lock": "bun";
|
|
13
|
+
};
|
|
14
|
+
/** The names a given manager writes. */
|
|
15
|
+
export declare const lockfileNamesFor: (format: LockfileFormat) => ReadonlyArray<string>;
|
|
16
|
+
//# sourceMappingURL=names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../../src/lockfile/names.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;CAKkB,CAAA;AAEnD,wCAAwC;AACxC,eAAO,MAAM,gBAAgB,WAAY,cAAc,KAAG,aAAa,CAAC,MAAM,CAG3E,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm.d.ts","sourceRoot":"","sources":["../../src/lockfile/npm.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,YAAY,CAAA;AAgCxD,eAAO,MAAM,gBAAgB,SACrB,MAAM,WACH,MAAM,YACL,MAAM,GAAG,SAAS,KAC3B,UAuBF,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lockfile parsing — npm, pnpm and bun.
|
|
3
|
+
*
|
|
4
|
+
* `--file package.json` reads *ranges*, and a range resolves to whatever is
|
|
5
|
+
* newest at the moment the command runs. That is the right answer for "bundle
|
|
6
|
+
* me something installable" and the wrong one for "bundle exactly what CI
|
|
7
|
+
* installed" — which is what a lockfile records and what this module reads.
|
|
8
|
+
*
|
|
9
|
+
* Three formats, one output shape. Each parser's real job is the same: turn a
|
|
10
|
+
* manager-specific encoding of "package X at path P depends on Y" into a flat
|
|
11
|
+
* graph keyed by `name@version`, with every edge already pointing at a concrete
|
|
12
|
+
* version. Once that is done, nothing downstream has to know which manager
|
|
13
|
+
* wrote the file.
|
|
14
|
+
*/
|
|
15
|
+
import { LockfileFormat } from "../enums/lockfile-format.js";
|
|
16
|
+
import type { LockedTree, LockfileParseOptions } from "./types.js";
|
|
17
|
+
/**
|
|
18
|
+
* Parses lockfile content into a flat graph.
|
|
19
|
+
*
|
|
20
|
+
* Throws `LockfileError`; the caller is expected to be inside an `Effect.try`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const parseLockfile: (path: string, content: string, format?: LockfileFormat, options?: LockfileParseOptions) => LockedTree;
|
|
23
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/lockfile/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAM5D,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAElE;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAClB,MAAM,WACH,MAAM,WACN,cAAc,YACd,oBAAoB,KAC5B,UAWF,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { LockedTree } from "./types.js";
|
|
2
|
+
/** `name@version`, as a snapshot or importer entry resolves to. */
|
|
3
|
+
type PnpmReference = {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly version: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const parsePnpmLockfile: (path: string, content: string, importer: string | undefined) => LockedTree;
|
|
8
|
+
/**
|
|
9
|
+
* Splits a package key into name and version.
|
|
10
|
+
*
|
|
11
|
+
* Three encodings across the versions still in the wild:
|
|
12
|
+
* v5 `/@babel/core/7.0.0`
|
|
13
|
+
* v6 `/@babel/core@7.0.0`
|
|
14
|
+
* v9 `@babel/core@7.0.0`
|
|
15
|
+
*
|
|
16
|
+
* plus an optional `(peer@1.0.0)` or `(patch_hash=…)` suffix on any of them.
|
|
17
|
+
*/
|
|
18
|
+
export declare const parsePnpmKey: (key: string) => PnpmReference | null;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=pnpm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pnpm.d.ts","sourceRoot":"","sources":["../../src/lockfile/pnpm.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,YAAY,CAAA;AAExD,mEAAmE;AACnE,KAAK,aAAa,GAAG;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,CAAA;AASD,eAAO,MAAM,iBAAiB,SACtB,MAAM,WACH,MAAM,YACL,MAAM,GAAG,SAAS,KAC3B,UA2CF,CAAA;AA6FD;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,QAAS,MAAM,KAAG,aAAa,GAAG,IAc1D,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { LockfileFormat } from "../enums/lockfile-format.js";
|
|
2
|
+
import type { LockedPackage, LockedRoot, LockedTree } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Which manifest block each root kind is declared in.
|
|
5
|
+
*
|
|
6
|
+
* The block names are the same across npm, pnpm and bun; only which of them a
|
|
7
|
+
* given format writes differs, which is why each parser supplies its own order
|
|
8
|
+
* rather than iterating this.
|
|
9
|
+
*/
|
|
10
|
+
export declare const fieldByRootKind: {
|
|
11
|
+
readonly prod: "dependencies";
|
|
12
|
+
readonly optional: "optionalDependencies";
|
|
13
|
+
readonly dev: "devDependencies";
|
|
14
|
+
readonly peer: "peerDependencies";
|
|
15
|
+
};
|
|
16
|
+
export declare class TreeBuilder {
|
|
17
|
+
readonly packages: Map<string, LockedPackage>;
|
|
18
|
+
readonly roots: Array<LockedRoot>;
|
|
19
|
+
readonly warnings: Array<string>;
|
|
20
|
+
readonly incomplete: Array<string>;
|
|
21
|
+
/** Names dropped on purpose, so an edge into one is explained, not alarming. */
|
|
22
|
+
private readonly skipped;
|
|
23
|
+
private readonly seenWarnings;
|
|
24
|
+
add(pkg: LockedPackage): void;
|
|
25
|
+
addRoot(root: LockedRoot): void;
|
|
26
|
+
warn(message: string): void;
|
|
27
|
+
/** Notes an entry that is real but cannot come from a registry. */
|
|
28
|
+
skip(name: string, spec: string, reason: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Records a required edge that resolved to nothing.
|
|
31
|
+
*
|
|
32
|
+
* An edge into something skipped on purpose is expected — you cannot bundle a
|
|
33
|
+
* `workspace:` sibling from a registry — so it stays a warning. Anything else
|
|
34
|
+
* means the file does not pin what it claims to.
|
|
35
|
+
*/
|
|
36
|
+
dangling(from: string, name: string): void;
|
|
37
|
+
finish(input: {
|
|
38
|
+
readonly format: LockfileFormat;
|
|
39
|
+
readonly lockfileVersion: string;
|
|
40
|
+
readonly path: string;
|
|
41
|
+
readonly importer?: string | undefined;
|
|
42
|
+
}): LockedTree;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Reads the right-hand side of a locked entry as an exact version.
|
|
46
|
+
*
|
|
47
|
+
* Returns the version when it is one, or the reason it is not — `file:../x`,
|
|
48
|
+
* `workspace:*`, a git URL. `parseDependencyTarget` already classifies every
|
|
49
|
+
* one of those for package.json parsing, so the vocabulary of skip reasons
|
|
50
|
+
* stays identical between the two paths.
|
|
51
|
+
*/
|
|
52
|
+
export declare const asExactVersion: (name: string, raw: string) => {
|
|
53
|
+
readonly _tag: "Version";
|
|
54
|
+
readonly version: string;
|
|
55
|
+
} | {
|
|
56
|
+
readonly _tag: "Unsupported";
|
|
57
|
+
readonly reason: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Raised when a lockfile found by walking up turns out not to cover the
|
|
61
|
+
* package.json that went looking for it.
|
|
62
|
+
*
|
|
63
|
+
* Worth distinguishing from "no lockfile at all": the file exists and is
|
|
64
|
+
* readable, it simply belongs to a different project, and bundling it would
|
|
65
|
+
* produce someone else's dependency set.
|
|
66
|
+
*/
|
|
67
|
+
export declare const notCovered: (path: string, importer: string, known: ReadonlyArray<string>) => never;
|
|
68
|
+
/** `""` is how npm and bun spell the project at the lockfile's own level. */
|
|
69
|
+
export declare const importerKey: (importer: string) => string;
|
|
70
|
+
//# sourceMappingURL=tree-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-builder.d.ts","sourceRoot":"","sources":["../../src/lockfile/tree-builder.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,KAAK,EAAc,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEnF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;mBACH,cAAc;uBACV,sBAAsB;kBAC3B,iBAAiB;mBAChB,kBAAkB;CACQ,CAAA;AAEnD,qBAAa,WAAW;IACtB,QAAQ,CAAC,QAAQ,6BAAmC;IACpD,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAK;IACtC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAK;IACrC,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAK;IACvC,gFAAgF;IAChF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoB;IAEjD,GAAG,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAc5B;IAED,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAG9B;IAED,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAI1B;IAED,mEAAmE;IACnE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAGrD;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAMzC;IAED,MAAM,CAAC,KAAK,EAAE;QACZ,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;QAC/B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;QAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KACvC,GAAG,UAAU,CAcb;CACF;AAaD;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,SACnB,MAAM,OACP,MAAM,KAET;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAO1D,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,SACf,MAAM,YACF,MAAM,SACT,aAAa,CAAC,MAAM,CAAC,KAC3B,KAUF,CAAA;AAED,6EAA6E;AAC7E,eAAO,MAAM,WAAW,aAAc,MAAM,KAAG,MAA4C,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one output shape every lockfile parser produces.
|
|
3
|
+
*
|
|
4
|
+
* npm, pnpm and bun encode "package X at path P depends on Y" in three
|
|
5
|
+
* different ways; once flattened into this graph, nothing downstream has to
|
|
6
|
+
* know which manager wrote the file.
|
|
7
|
+
*/
|
|
8
|
+
import type { EdgeKind, LockedRootKind } from "../enums/edge-kind.js";
|
|
9
|
+
import type { LockfileFormat } from "../enums/lockfile-format.js";
|
|
10
|
+
/** One edge out of a locked package, already pinned to an exact version. */
|
|
11
|
+
export type LockedEdge = {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly version: string;
|
|
14
|
+
readonly kind: EdgeKind;
|
|
15
|
+
};
|
|
16
|
+
/** One package pinned by a lockfile. */
|
|
17
|
+
export type LockedPackage = {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly version: string;
|
|
20
|
+
readonly dependencies: ReadonlyArray<LockedEdge>;
|
|
21
|
+
};
|
|
22
|
+
/** A direct dependency of the locked project. */
|
|
23
|
+
export type LockedRoot = {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly version: string;
|
|
26
|
+
readonly kind: LockedRootKind;
|
|
27
|
+
/** The range the manifest asked for, kept for reporting. */
|
|
28
|
+
readonly specifier?: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
/** Options for reading a lockfile. */
|
|
31
|
+
export type LockfileParseOptions = {
|
|
32
|
+
/**
|
|
33
|
+
* Which workspace member's dependencies become the roots, as a path relative
|
|
34
|
+
* to the lockfile in POSIX form — `"packages/core"`, or `"."` for the project
|
|
35
|
+
* at the lockfile's own level.
|
|
36
|
+
*
|
|
37
|
+
* Left undefined, every workspace member in the file contributes, which is
|
|
38
|
+
* what pointing `--file` straight at a lockfile should mean. It matters when
|
|
39
|
+
* a package.json found a lockfile by walking *up*: the file then pins the
|
|
40
|
+
* whole repository, and only one member of it was asked for.
|
|
41
|
+
*/
|
|
42
|
+
readonly importer?: string | undefined;
|
|
43
|
+
};
|
|
44
|
+
/** A whole lockfile, flattened. */
|
|
45
|
+
export type LockedTree = {
|
|
46
|
+
readonly format: LockfileFormat;
|
|
47
|
+
/** As the file declares it: `3`, `'9.0'`, `1`. */
|
|
48
|
+
readonly lockfileVersion: string;
|
|
49
|
+
/** Where it was read from, for error messages. */
|
|
50
|
+
readonly path: string;
|
|
51
|
+
/** The workspace member the roots came from, when one was selected. */
|
|
52
|
+
readonly importer?: string | undefined;
|
|
53
|
+
/** Every pinned package, keyed by `name@version`. */
|
|
54
|
+
readonly packages: ReadonlyMap<string, LockedPackage>;
|
|
55
|
+
/** The project's direct dependencies. */
|
|
56
|
+
readonly roots: ReadonlyArray<LockedRoot>;
|
|
57
|
+
/** Entries that were recognised but cannot be fetched from a registry. */
|
|
58
|
+
readonly warnings: ReadonlyArray<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Required edges pointing at nothing the file pins.
|
|
61
|
+
*
|
|
62
|
+
* Distinct from `warnings`: a `workspace:` dependency that cannot be bundled
|
|
63
|
+
* is expected and gets a warning, while an ordinary registry dependency with
|
|
64
|
+
* no entry means the lockfile is genuinely partial and the bundle it produces
|
|
65
|
+
* would be missing a package. The caller decides what to do about it, but the
|
|
66
|
+
* two must not be confused.
|
|
67
|
+
*/
|
|
68
|
+
readonly incomplete: ReadonlyArray<string>;
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lockfile/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAEjE,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CACxB,CAAA;AAED,wCAAwC;AACxC,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,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. 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
|
-
//# sourceMapp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AAa,CAAA;IAC/B,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IAClE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3C,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;CACtC,KAAG,cAgDH,CAAA;AAED,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,aAAc,cAAc,KAAG,MACnB,CAAA"}
|
|
@@ -5,28 +5,10 @@
|
|
|
5
5
|
* actually installs offline on a machine that is not the one you built it on.
|
|
6
6
|
* Every switch that makes the bundle smaller is opt-in.
|
|
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
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,KAAK,EAA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