@effected/lockfiles 0.14.0 → 0.15.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/ImporterDependency.js +1 -1
- package/Lockfile.js +14 -10
- package/LockfileIntegrity.js +4 -4
- package/PnpmEnvLockfile.js +2 -0
- package/README.md +4 -4
- package/index.d.ts +21 -15
- package/internal/bun.js +1 -1
- package/internal/shared.js +1 -1
- package/package.json +6 -6
package/ImporterDependency.js
CHANGED
|
@@ -24,7 +24,7 @@ import { DependencyField, DependencySpecifier } from "@effected/npm";
|
|
|
24
24
|
* `name` against `Lockfile.packages`.
|
|
25
25
|
* - `peerSuffix` — pnpm's peer-disambiguation context: the raw parenthesized
|
|
26
26
|
* chain the lockfile recorded after the version, e.g.
|
|
27
|
-
* `(effect@4.0.0
|
|
27
|
+
* `(effect@4.0.0)(ioredis@5.11.1(supports-color@8.1.1))`. Present
|
|
28
28
|
* only when the lockfile recorded one — never for suffix-free pnpm entries,
|
|
29
29
|
* and never for the other formats, which do not record peer context per
|
|
30
30
|
* importer dependency.
|
package/Lockfile.js
CHANGED
|
@@ -31,8 +31,11 @@ const EMPTY_IMPORTERS = [];
|
|
|
31
31
|
* @public
|
|
32
32
|
*/
|
|
33
33
|
var LockfileParseError = class extends Schema.TaggedError()("LockfileParseError", {
|
|
34
|
+
/** The lockfile format that was being parsed. */
|
|
34
35
|
format: LockfileFormat,
|
|
36
|
+
/** Whether the text itself failed to parse (`"syntax"`) or parsed but had the wrong shape (`"validation"`). */
|
|
35
37
|
stage: Schema.Literals(["syntax", "validation"]),
|
|
38
|
+
/** The underlying engine or schema failure, preserved structurally. */
|
|
36
39
|
cause: Schema.Defect()
|
|
37
40
|
}) {
|
|
38
41
|
get message() {
|
|
@@ -44,14 +47,13 @@ var LockfileParseError = class extends Schema.TaggedError()("LockfileParseError"
|
|
|
44
47
|
* lockfile document could be located in it.
|
|
45
48
|
*
|
|
46
49
|
* @remarks
|
|
47
|
-
* `pnpm-lock.yaml` is a YAML **stream**. pnpm
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* documents. The
|
|
50
|
+
* `pnpm-lock.yaml` is a YAML **stream**. pnpm writes an env preamble document
|
|
51
|
+
* ahead of the lockfile whenever the workspace declares `configDependencies`
|
|
52
|
+
* or `devEngines.packageManager`, so the file holds two documents. The
|
|
51
53
|
* lockfile is the last one — pnpm composes the preamble as a prefix — and a
|
|
52
|
-
* parser that
|
|
53
|
-
* that *validates*,
|
|
54
|
-
*
|
|
54
|
+
* parser that read only the first document would get the preamble: a document
|
|
55
|
+
* that *validates*, yielding a lockfile with an empty workspace. This error
|
|
56
|
+
* makes that case fail instead of succeeding quietly.
|
|
55
57
|
*
|
|
56
58
|
* - `format` — which format was being parsed.
|
|
57
59
|
* - `documents` — how many YAML documents the stream carried.
|
|
@@ -82,12 +84,15 @@ var LockfileParseError = class extends Schema.TaggedError()("LockfileParseError"
|
|
|
82
84
|
* @public
|
|
83
85
|
*/
|
|
84
86
|
var LockfileFramingError = class extends Schema.TaggedError()("LockfileFramingError", {
|
|
87
|
+
/** The lockfile format that was being parsed. */
|
|
85
88
|
format: LockfileFormat,
|
|
89
|
+
/** Which framing check failed; see the class remarks for each. */
|
|
86
90
|
reason: Schema.Literals([
|
|
87
91
|
"noLockfileDocument",
|
|
88
92
|
"noImporters",
|
|
89
93
|
"unexpectedDocuments"
|
|
90
94
|
]),
|
|
95
|
+
/** How many YAML documents the stream carried. */
|
|
91
96
|
documents: Schema.Int
|
|
92
97
|
}) {
|
|
93
98
|
get message() {
|
|
@@ -288,9 +293,8 @@ var Lockfile = class Lockfile extends Schema.Class("Lockfile")({
|
|
|
288
293
|
*
|
|
289
294
|
* @remarks
|
|
290
295
|
* `ResolvedPackage.instanceId` is what a resolved edge points at, so peer and
|
|
291
|
-
* dependency resolution is a lookup through this index rather than a scan
|
|
292
|
-
*
|
|
293
|
-
* which is O(n) per walk and one more place for the key choice to drift.
|
|
296
|
+
* dependency resolution is a lookup through this index rather than a scan
|
|
297
|
+
* over `packages`.
|
|
294
298
|
*
|
|
295
299
|
* The index is a `Map`, so an instance id that collides with an `Object`
|
|
296
300
|
* member name (`__proto__`, `constructor`) neither pollutes nor
|
package/LockfileIntegrity.js
CHANGED
|
@@ -61,7 +61,7 @@ var LockfileIntegrity = class LockfileIntegrity extends Schema.Class("LockfileIn
|
|
|
61
61
|
* @remarks
|
|
62
62
|
* Constraint checking is best-effort by design: `workspace:` / `link:` /
|
|
63
63
|
* `file:` specifiers and rows whose range (or every resolved version) does
|
|
64
|
-
* not parse as SemVer are skipped
|
|
64
|
+
* not parse as SemVer are skipped.
|
|
65
65
|
* A lockfile may resolve the same package at several versions; a
|
|
66
66
|
* constraint is satisfied when *any* resolved version matches, and an
|
|
67
67
|
* unsatisfied row reports every candidate in `resolved`. The
|
|
@@ -69,9 +69,9 @@ var LockfileIntegrity = class LockfileIntegrity extends Schema.Class("LockfileIn
|
|
|
69
69
|
* `Lockfile#withImporterNames` first so workspace names align with
|
|
70
70
|
* manifest names.
|
|
71
71
|
*
|
|
72
|
-
* (Named `compare`, not `check`: every
|
|
73
|
-
*
|
|
74
|
-
*
|
|
72
|
+
* (Named `compare`, not `check`: every `Schema.Class` already carries a
|
|
73
|
+
* `static check(...checks)` for attaching schema checks, and statics cannot
|
|
74
|
+
* be shadowed with an incompatible signature.)
|
|
75
75
|
*
|
|
76
76
|
* @param lockfile - The parsed lockfile.
|
|
77
77
|
* @param manifests - The workspace manifests to compare against.
|
package/PnpmEnvLockfile.js
CHANGED
|
@@ -16,6 +16,8 @@ const configDependencies = Effect.fn("PnpmEnvLockfile.configDependencies")((cont
|
|
|
16
16
|
* import { PnpmEnvLockfile } from "@effected/lockfiles";
|
|
17
17
|
* import { Effect, Option } from "effect";
|
|
18
18
|
*
|
|
19
|
+
* declare const content: string; // the text of a pnpm-lock.yaml
|
|
20
|
+
*
|
|
19
21
|
* const program = Effect.gen(function* () {
|
|
20
22
|
* const lock = yield* PnpmEnvLockfile.packageManager(content);
|
|
21
23
|
* const configDependencies = yield* PnpmEnvLockfile.configDependencies(content);
|
package/README.md
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
Lockfile parsing for [Effect](https://effect.website) v4: bun (`bun.lock`), npm (`package-lock.json`), pnpm (`pnpm-lock.yaml`) and yarn Berry (`yarn.lock`) all normalized into one `Lockfile` schema model, plus pure integrity checking of that model against workspace manifests. Four formats, one model, no IO and no external runtime dependencies.
|
|
9
9
|
|
|
10
|
-
> **Pre
|
|
11
|
-
>
|
|
12
|
-
> `1.0.0`
|
|
13
|
-
>
|
|
10
|
+
> **Pre-`1.0.0`.** This package is part of the `@effected/*` kit, built on stable
|
|
11
|
+
> Effect v4 (`effect` `^4.0.0`) and still in `0.x` development. Stable Effect
|
|
12
|
+
> makes a kit `1.0.0` possible, not automatic. To keep your `effect` and
|
|
13
|
+
> `@effect/*` versions on the line the kit is built and tested against, install
|
|
14
14
|
> [`@effected/pnpm-plugin-effect`](https://www.npmjs.com/package/@effected/pnpm-plugin-effect).
|
|
15
15
|
>
|
|
16
16
|
> **Stability: unstable.** This package's API surface is not yet considered
|
package/index.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ declare const ImporterDependency_base: Schema.Class<ImporterDependency, Schema.S
|
|
|
85
85
|
* `name` against `Lockfile.packages`.
|
|
86
86
|
* - `peerSuffix` — pnpm's peer-disambiguation context: the raw parenthesized
|
|
87
87
|
* chain the lockfile recorded after the version, e.g.
|
|
88
|
-
* `(effect@4.0.0
|
|
88
|
+
* `(effect@4.0.0)(ioredis@5.11.1(supports-color@8.1.1))`. Present
|
|
89
89
|
* only when the lockfile recorded one — never for suffix-free pnpm entries,
|
|
90
90
|
* and never for the other formats, which do not record peer context per
|
|
91
91
|
* importer dependency.
|
|
@@ -355,8 +355,11 @@ export declare const fromFilename: (name: string) => Option.Option<LockfileForma
|
|
|
355
355
|
//#endregion
|
|
356
356
|
//#region src/Lockfile.d.ts
|
|
357
357
|
declare const LockfileParseError_base: Schema.Class<LockfileParseError, Schema.TaggedStruct<"LockfileParseError", {
|
|
358
|
+
/** The lockfile format that was being parsed. */
|
|
358
359
|
readonly format: Schema.Literals<readonly ["bun", "npm", "pnpm", "yarn"]>;
|
|
360
|
+
/** Whether the text itself failed to parse (`"syntax"`) or parsed but had the wrong shape (`"validation"`). */
|
|
359
361
|
readonly stage: Schema.Literals<readonly ["syntax", "validation"]>;
|
|
362
|
+
/** The underlying engine or schema failure, preserved structurally. */
|
|
360
363
|
readonly cause: Schema.Defect;
|
|
361
364
|
}>, import("effect/Cause").YieldableError>;
|
|
362
365
|
/**
|
|
@@ -381,8 +384,11 @@ export declare class LockfileParseError extends LockfileParseError_base {
|
|
|
381
384
|
get message(): string;
|
|
382
385
|
}
|
|
383
386
|
declare const LockfileFramingError_base: Schema.Class<LockfileFramingError, Schema.TaggedStruct<"LockfileFramingError", {
|
|
387
|
+
/** The lockfile format that was being parsed. */
|
|
384
388
|
readonly format: Schema.Literals<readonly ["bun", "npm", "pnpm", "yarn"]>;
|
|
389
|
+
/** Which framing check failed; see the class remarks for each. */
|
|
385
390
|
readonly reason: Schema.Literals<readonly ["noLockfileDocument", "noImporters", "unexpectedDocuments"]>;
|
|
391
|
+
/** How many YAML documents the stream carried. */
|
|
386
392
|
readonly documents: Schema.Int;
|
|
387
393
|
}>, import("effect/Cause").YieldableError>;
|
|
388
394
|
/**
|
|
@@ -390,14 +396,13 @@ declare const LockfileFramingError_base: Schema.Class<LockfileFramingError, Sche
|
|
|
390
396
|
* lockfile document could be located in it.
|
|
391
397
|
*
|
|
392
398
|
* @remarks
|
|
393
|
-
* `pnpm-lock.yaml` is a YAML **stream**. pnpm
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
* documents. The
|
|
399
|
+
* `pnpm-lock.yaml` is a YAML **stream**. pnpm writes an env preamble document
|
|
400
|
+
* ahead of the lockfile whenever the workspace declares `configDependencies`
|
|
401
|
+
* or `devEngines.packageManager`, so the file holds two documents. The
|
|
397
402
|
* lockfile is the last one — pnpm composes the preamble as a prefix — and a
|
|
398
|
-
* parser that
|
|
399
|
-
* that *validates*,
|
|
400
|
-
*
|
|
403
|
+
* parser that read only the first document would get the preamble: a document
|
|
404
|
+
* that *validates*, yielding a lockfile with an empty workspace. This error
|
|
405
|
+
* makes that case fail instead of succeeding quietly.
|
|
401
406
|
*
|
|
402
407
|
* - `format` — which format was being parsed.
|
|
403
408
|
* - `documents` — how many YAML documents the stream carried.
|
|
@@ -529,9 +534,8 @@ export declare class Lockfile extends Lockfile_base {
|
|
|
529
534
|
*
|
|
530
535
|
* @remarks
|
|
531
536
|
* `ResolvedPackage.instanceId` is what a resolved edge points at, so peer and
|
|
532
|
-
* dependency resolution is a lookup through this index rather than a scan
|
|
533
|
-
*
|
|
534
|
-
* which is O(n) per walk and one more place for the key choice to drift.
|
|
537
|
+
* dependency resolution is a lookup through this index rather than a scan
|
|
538
|
+
* over `packages`.
|
|
535
539
|
*
|
|
536
540
|
* The index is a `Map`, so an instance id that collides with an `Object`
|
|
537
541
|
* member name (`__proto__`, `constructor`) neither pollutes nor
|
|
@@ -603,7 +607,7 @@ export declare class LockfileIntegrity extends LockfileIntegrity_base {
|
|
|
603
607
|
* @remarks
|
|
604
608
|
* Constraint checking is best-effort by design: `workspace:` / `link:` /
|
|
605
609
|
* `file:` specifiers and rows whose range (or every resolved version) does
|
|
606
|
-
* not parse as SemVer are skipped
|
|
610
|
+
* not parse as SemVer are skipped.
|
|
607
611
|
* A lockfile may resolve the same package at several versions; a
|
|
608
612
|
* constraint is satisfied when *any* resolved version matches, and an
|
|
609
613
|
* unsatisfied row reports every candidate in `resolved`. The
|
|
@@ -611,9 +615,9 @@ export declare class LockfileIntegrity extends LockfileIntegrity_base {
|
|
|
611
615
|
* `Lockfile#withImporterNames` first so workspace names align with
|
|
612
616
|
* manifest names.
|
|
613
617
|
*
|
|
614
|
-
* (Named `compare`, not `check`: every
|
|
615
|
-
*
|
|
616
|
-
*
|
|
618
|
+
* (Named `compare`, not `check`: every `Schema.Class` already carries a
|
|
619
|
+
* `static check(...checks)` for attaching schema checks, and statics cannot
|
|
620
|
+
* be shadowed with an incompatible signature.)
|
|
617
621
|
*
|
|
618
622
|
* @param lockfile - The parsed lockfile.
|
|
619
623
|
* @param manifests - The workspace manifests to compare against.
|
|
@@ -733,6 +737,8 @@ interface PnpmEnvLockfileReaders {
|
|
|
733
737
|
* import { PnpmEnvLockfile } from "@effected/lockfiles";
|
|
734
738
|
* import { Effect, Option } from "effect";
|
|
735
739
|
*
|
|
740
|
+
* declare const content: string; // the text of a pnpm-lock.yaml
|
|
741
|
+
*
|
|
736
742
|
* const program = Effect.gen(function* () {
|
|
737
743
|
* const lock = yield* PnpmEnvLockfile.packageManager(content);
|
|
738
744
|
* const configDependencies = yield* PnpmEnvLockfile.configDependencies(content);
|
package/internal/bun.js
CHANGED
|
@@ -49,7 +49,7 @@ const BunLockfileRaw = Schema.Struct({
|
|
|
49
49
|
/**
|
|
50
50
|
* Parse bun `bun.lock` (JSONC) content into the unified field bundle.
|
|
51
51
|
* Resolved packages are tuples whose first element is `"name@version"`;
|
|
52
|
-
* the integrity hash is assumed at tuple index 3 (
|
|
52
|
+
* the integrity hash is assumed at tuple index 3 (a permissive
|
|
53
53
|
* reading of an under-documented upstream shape).
|
|
54
54
|
*
|
|
55
55
|
* @internal
|
package/internal/shared.js
CHANGED
|
@@ -6,7 +6,7 @@ import { DependencySpecifier, IntegrityHash } from "@effected/npm";
|
|
|
6
6
|
//#region src/internal/shared.ts
|
|
7
7
|
/**
|
|
8
8
|
* The four dependency sections of a manifest, in a stable order — the shared
|
|
9
|
-
* dependency-sections table
|
|
9
|
+
* dependency-sections table. Each entry is both the
|
|
10
10
|
* manifest field name to read and the `@effected/npm` `DependencyField` it maps
|
|
11
11
|
* to, since the two coincide. Consumed by `extractWorkspaceDeps` and by the
|
|
12
12
|
* pnpm/bun/npm importer builders.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effected/lockfiles",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Pure lockfile parsing for bun, npm, pnpm and yarn Berry into one unified Effect schema model, with pure integrity checking against workspace manifests.",
|
|
6
6
|
"keywords": [
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"./package.json": "./package.json"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@effected/jsonc": "^0.
|
|
44
|
-
"@effected/npm": "^0.
|
|
45
|
-
"@effected/semver": "^0.
|
|
46
|
-
"@effected/yaml": "^0.
|
|
47
|
-
"effect": "4.0.0
|
|
43
|
+
"@effected/jsonc": "^0.15.0",
|
|
44
|
+
"@effected/npm": "^0.20.0",
|
|
45
|
+
"@effected/semver": "^0.11.0",
|
|
46
|
+
"@effected/yaml": "^0.19.0",
|
|
47
|
+
"effect": "^4.0.0"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=24.11.0"
|