@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
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
* default is "take every platform" and narrowing is opt-in.
|
|
15
15
|
*/
|
|
16
16
|
/** A target to keep, e.g. `linux-x64`, `linux-x64-musl`, or just `linux`. */
|
|
17
|
-
export
|
|
17
|
+
export type PlatformTarget = {
|
|
18
18
|
readonly os: string;
|
|
19
19
|
/** Undefined means "every architecture for this OS". */
|
|
20
20
|
readonly cpu?: string | undefined;
|
|
21
21
|
/** `glibc` / `musl`. Undefined means "don't care". */
|
|
22
22
|
readonly libc?: string | undefined;
|
|
23
|
-
}
|
|
23
|
+
};
|
|
24
24
|
/**
|
|
25
25
|
* Which platforms optional dependencies should be resolved for.
|
|
26
26
|
*
|
|
@@ -33,6 +33,12 @@ export type PlatformFilter = {
|
|
|
33
33
|
readonly _tag: "Targets";
|
|
34
34
|
readonly targets: ReadonlyArray<PlatformTarget>;
|
|
35
35
|
};
|
|
36
|
+
/** Constraints declared by a package, as they appear in its manifest. */
|
|
37
|
+
export type PlatformConstraints = {
|
|
38
|
+
readonly os?: ReadonlyArray<string> | undefined;
|
|
39
|
+
readonly cpu?: ReadonlyArray<string> | undefined;
|
|
40
|
+
readonly libc?: ReadonlyArray<string> | undefined;
|
|
41
|
+
};
|
|
36
42
|
export declare const allPlatforms: PlatformFilter;
|
|
37
43
|
export declare const platformTargets: (targets: ReadonlyArray<PlatformTarget>) => PlatformFilter;
|
|
38
44
|
/** The machine we are currently running on. */
|
|
@@ -50,12 +56,6 @@ export declare const currentPlatform: () => PlatformTarget;
|
|
|
50
56
|
* once alongside the list of accepted forms.
|
|
51
57
|
*/
|
|
52
58
|
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
59
|
/** Would this package install on this specific target? */
|
|
60
60
|
export declare const matchesTarget: (constraints: PlatformConstraints, target: PlatformTarget) => boolean;
|
|
61
61
|
/**
|
|
@@ -66,4 +66,4 @@ export declare const matchesTarget: (constraints: PlatformConstraints, target: P
|
|
|
66
66
|
export declare const isIncluded: (constraints: PlatformConstraints, filter: PlatformFilter) => boolean;
|
|
67
67
|
/** Renders a filter for the manifest and for `--dry-run` output. */
|
|
68
68
|
export declare const formatPlatformFilter: (filter: PlatformFilter) => string;
|
|
69
|
-
//# sourceMappingURL=
|
|
69
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,wDAAwD;IACxD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACnC,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACtB;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,CAAA;AAEjF,yEAAyE;AACzE,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;IAC/C,QAAQ,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;IAChD,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;CAClD,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,cAAgC,CAAA;AAE3D,eAAO,MAAM,eAAe,YAAa,aAAa,CAAC,cAAc,CAAC,KAAG,cAGvE,CAAA;AAEF,+CAA+C;AAC/C,eAAO,MAAM,eAAe,QAAO,cAGjC,CAAA;AAkCF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,UAAW,MAAM,KAAG,cAAc,GAAG,IAiBpE,CAAA;AA+BD,0DAA0D;AAC1D,eAAO,MAAM,aAAa,gBACX,mBAAmB,UACxB,cAAc,KACrB,OAOF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,gBACR,mBAAmB,UACxB,cAAc,KACrB,OAGF,CAAA;AAED,oEAAoE;AACpE,eAAO,MAAM,oBAAoB,WAAY,cAAc,KAAG,MAO7D,CAAA"}
|
|
@@ -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,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE7C,mCAAmC;AACnC,MAAM,MAAM,aAAa;AACvB,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,IAA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Q,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AACtF,qEAAqE;GACnE;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1D,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,0BAA0B;IAC1B,KAAY,OAAO,GAAG;QACpB,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;KAC7D,CAAA;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,CAI3E,CAAA;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAE5C,CAAA;AAEF,iEAAiE;AACjE,eAAO,MAAM,aAAa,YACf,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,KACtC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAGnB,CAAA;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;gBAMxB,CAAA"}
|
|
@@ -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,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,kEAAkE;AAClE,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,8DAA8D;I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Q,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,CAAA;AAGvC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAGtD,sDAAsD;AACtD,MAAM,MAAM,MAAM,GACd;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IA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|
+
* 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,CAAA;AAIvC;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,CAAC,GAAG,UAAU,CAAC,6FAKrD,CAAA;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,4HAW9B,CAAA;AAED,sFAAsF;AACtF,eAAO,MAAM,iBAAiB,4FAM7B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB;;iEAWpC,CAAA;AAcD,eAAO,MAAM,0BAA0B,6NAKtC,CAAA;AAED,eAAO,MAAM,yBAAyB,6KAMrC,CAAA;AAED,eAAO,MAAM,gCAAgC;;;;gFAU5C,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The package.json blocks `--file` reads, and what counts as readable.
|
|
3
|
+
*
|
|
4
|
+
* A narrow view on purpose: the only thing this tool wants from a package.json
|
|
5
|
+
* is which packages it declares. Everything else — `scripts`, `exports`, the
|
|
6
|
+
* half of the file that belongs to a bundler — is none of its business, and a
|
|
7
|
+
* schema that insisted on understanding it would reject files that are fine.
|
|
8
|
+
*
|
|
9
|
+
* Every block is optional and every wrongly-typed one is simply absent, so a
|
|
10
|
+
* hand-edited manifest produces a smaller spec list rather than a crash. That
|
|
11
|
+
* is what `tolerant` buys: a `dependencies: "all of them"` loses one block, not
|
|
12
|
+
* the file.
|
|
13
|
+
*/
|
|
14
|
+
import * as Schema from "effect/Schema";
|
|
15
|
+
export declare const PackageJsonSchema: Schema.Struct<{
|
|
16
|
+
readonly dependencies: Schema.optional<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.decodeTo<Schema.$Record<Schema.String, Schema.String>, Schema.$Record<Schema.String, Schema.Unknown>, never, never>>, never>>;
|
|
17
|
+
readonly devDependencies: Schema.optional<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.decodeTo<Schema.$Record<Schema.String, Schema.String>, Schema.$Record<Schema.String, Schema.Unknown>, never, never>>, never>>;
|
|
18
|
+
readonly optionalDependencies: Schema.optional<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.decodeTo<Schema.$Record<Schema.String, Schema.String>, Schema.$Record<Schema.String, Schema.Unknown>, never, never>>, never>>;
|
|
19
|
+
readonly peerDependencies: Schema.optional<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.decodeTo<Schema.$Record<Schema.String, Schema.String>, Schema.$Record<Schema.String, Schema.Unknown>, never, never>>, never>>;
|
|
20
|
+
readonly peerDependenciesMeta: Schema.optional<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Struct<{
|
|
21
|
+
readonly optional: Schema.Boolean;
|
|
22
|
+
}>>, Schema.$Record<Schema.String, Schema.Unknown>, never, never>>, never>>;
|
|
23
|
+
}>;
|
|
24
|
+
export type PackageJson = typeof PackageJsonSchema.Type;
|
|
25
|
+
export declare const decodePackageJson: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Option").Option<{
|
|
26
|
+
readonly dependencies?: {
|
|
27
|
+
readonly [x: string]: string;
|
|
28
|
+
} | undefined;
|
|
29
|
+
readonly devDependencies?: {
|
|
30
|
+
readonly [x: string]: string;
|
|
31
|
+
} | undefined;
|
|
32
|
+
readonly optionalDependencies?: {
|
|
33
|
+
readonly [x: string]: string;
|
|
34
|
+
} | undefined;
|
|
35
|
+
readonly peerDependencies?: {
|
|
36
|
+
readonly [x: string]: string;
|
|
37
|
+
} | undefined;
|
|
38
|
+
readonly peerDependenciesMeta?: {
|
|
39
|
+
readonly [x: string]: {
|
|
40
|
+
readonly optional: boolean;
|
|
41
|
+
};
|
|
42
|
+
} | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
//# sourceMappingURL=package-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../src/schemas/package-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,eAAO,MAAM,iBAAiB;;;;;;;;EAM5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAEvD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAAgD,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InvalidSpecError } from "./
|
|
1
|
+
import { InvalidSpecError } from "./errors.js";
|
|
2
2
|
/** How a spec narrows down which version(s) of a package we want. */
|
|
3
3
|
export type Selector =
|
|
4
4
|
/** An exact, fully-qualified version: `react@18.2.0`. */
|
|
@@ -17,14 +17,14 @@ export type Selector =
|
|
|
17
17
|
readonly tag: string;
|
|
18
18
|
};
|
|
19
19
|
/** A parsed, validated package spec. */
|
|
20
|
-
export
|
|
20
|
+
export type PackageSpec = {
|
|
21
21
|
/** The npm package name, including scope. */
|
|
22
22
|
readonly name: string;
|
|
23
23
|
/** What the user asked for after the `@`. */
|
|
24
24
|
readonly selector: Selector;
|
|
25
25
|
/** The original string, kept verbatim for error messages and the manifest. */
|
|
26
26
|
readonly raw: string;
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
28
|
/** Renders a spec back into the canonical `name@selector` form. */
|
|
29
29
|
export declare const formatSpec: (spec: PackageSpec) => string;
|
|
30
30
|
/** Human-readable form of just the selector part. */
|
|
@@ -59,4 +59,4 @@ export declare const parseSpecs: (inputs: ReadonlyArray<string>) => {
|
|
|
59
59
|
* download React twice.
|
|
60
60
|
*/
|
|
61
61
|
export declare const dedupeSpecs: (specs: ReadonlyArray<PackageSpec>) => ReadonlyArray<PackageSpec>;
|
|
62
|
-
//# sourceMappingURL=
|
|
62
|
+
//# sourceMappingURL=spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../src/spec.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,qEAAqE;AACrE,MAAM,MAAM,QAAQ;AAClB,yDAAyD;AACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AACtD,gEAAgE;GAC9D;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AACpD,qDAAqD;GACnD;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAElD,wCAAwC;AACxC,MAAM,MAAM,WAAW,GAAG;IACxB,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,6CAA6C;IAC7C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB,CAAA;AASD,mEAAmE;AACnE,eAAO,MAAM,UAAU,SAAU,WAAW,KAAG,MACE,CAAA;AAEjD,qDAAqD;AACrD,eAAO,MAAM,cAAc,aAAc,QAAQ,KAAG,MASnD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,SAAU,MAAM,KAAG,MAAM,GAAG,IA0B3D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,QAAS,MAAM,KAAG,WAqBvC,CAAA;AAED,qFAAqF;AACrF,eAAO,MAAM,aAAa,QAAS,MAAM,QAAQ,MAAM,KAAG,QAqBzD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,WACb,aAAa,CAAC,MAAM,CAAC,KAC5B;IAAE,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAA;CAehG,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,UAAW,aAAa,CAAC,WAAW,CAAC,KAAG,aAAa,CAAC,WAAW,CAUxF,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The union of an object's value types.
|
|
3
|
+
*
|
|
4
|
+
* The companion to the `as const` object-enum pattern used throughout this
|
|
5
|
+
* package: the object is the value, `ValueOf<typeof X>` is the type, and the two
|
|
6
|
+
* share one name.
|
|
7
|
+
*/
|
|
8
|
+
export type ValueOf<T> = T[keyof T];
|
|
9
|
+
//# sourceMappingURL=value-of.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-of.d.ts","sourceRoot":"","sources":["../../src/types/value-of.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Narrows an unknown value to a plain object.
|
|
3
|
+
*
|
|
4
|
+
* The entry point for reading anything the tool does not control — lockfiles,
|
|
5
|
+
* package.json files, registry responses — without reaching for a cast.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
8
|
+
//# sourceMappingURL=is-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-record.d.ts","sourceRoot":"","sources":["../../src/utils/is-record.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,UAAW,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACH,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@packall/core",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Registry-agnostic engine for bundling npm packages and their full dependency closure for offline import.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"semver": "^7.7.2",
|
|
21
|
-
"tar": "^7.5.1"
|
|
21
|
+
"tar": "^7.5.1",
|
|
22
|
+
"yaml": "^2.8.1"
|
|
22
23
|
},
|
|
23
24
|
"peerDependencies": {
|
|
24
25
|
"effect": "4.0.0-beta.103"
|