@effected/package-json 0.12.0 → 0.13.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/Funding.js +146 -0
- package/LenientManifest.js +5 -0
- package/License.js +48 -3
- package/Package.js +2 -0
- package/README.md +4 -1
- package/Repository.js +96 -4
- package/index.d.ts +166 -1
- package/index.js +3 -2
- package/package.json +3 -3
package/Funding.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Effect, Schema, SchemaTransformation } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/Funding.ts
|
|
4
|
+
const entryWires = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
/**
|
|
6
|
+
* Entries that were the WHOLE field, written bare rather than inside an array.
|
|
7
|
+
*
|
|
8
|
+
* Keyed by the ENTRY, not by the decoded array: `Schema.Array` rebuilds the
|
|
9
|
+
* array on the way out of the transform, so an array-keyed WeakMap is empty by
|
|
10
|
+
* the time `encode` runs — verified by the arity round trip failing under it.
|
|
11
|
+
* Arity provenance therefore rides the one instance that was the field, and
|
|
12
|
+
* the replay is guarded on that instance still being alone.
|
|
13
|
+
*/
|
|
14
|
+
const bareEntries = /* @__PURE__ */ new WeakSet();
|
|
15
|
+
const KNOWN_FUNDING_KEYS = /* @__PURE__ */ new Set(["type", "url"]);
|
|
16
|
+
const FundingFields = Schema.Struct({
|
|
17
|
+
type: Schema.optionalKey(Schema.String),
|
|
18
|
+
url: Schema.String
|
|
19
|
+
});
|
|
20
|
+
const decodeFundingFields = Schema.decodeUnknownEffect(FundingFields);
|
|
21
|
+
const restOf = (raw) => {
|
|
22
|
+
const rest = {};
|
|
23
|
+
for (const [key, value] of Object.entries(raw)) if (!KNOWN_FUNDING_KEYS.has(key)) rest[key] = value;
|
|
24
|
+
return rest;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Whether the remembered object still describes this entry. Guarding the
|
|
28
|
+
* replay is load-bearing: `Schema.Class` instances are not frozen, so an entry
|
|
29
|
+
* mutated in place keeps a provenance entry that no longer describes it, and
|
|
30
|
+
* an unguarded replay would write the ORIGINAL object back — silently
|
|
31
|
+
* discarding the edit.
|
|
32
|
+
*/
|
|
33
|
+
const isFaithfulObject = (wire, funding) => {
|
|
34
|
+
if (wire.url !== funding.url) return false;
|
|
35
|
+
if ((typeof wire.type === "string" ? wire.type : void 0) !== funding.type) return false;
|
|
36
|
+
for (const [key, value] of Object.entries(funding.rest ?? {})) if (wire[key] !== value) return false;
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
/** Whether the bare string form can still carry everything this entry holds. */
|
|
40
|
+
const isStringExpressible = (funding) => funding.type === void 0 && Object.keys(funding.rest ?? {}).length === 0;
|
|
41
|
+
const encodeEntry = (funding) => {
|
|
42
|
+
const wire = entryWires.get(funding);
|
|
43
|
+
if (typeof wire === "string" && isStringExpressible(funding)) return funding.url;
|
|
44
|
+
if (wire !== void 0 && typeof wire !== "string" && isFaithfulObject(wire, funding)) return wire;
|
|
45
|
+
return {
|
|
46
|
+
...funding.type !== void 0 && { type: funding.type },
|
|
47
|
+
url: funding.url,
|
|
48
|
+
...funding.rest
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const decodeEntry = (input) => {
|
|
52
|
+
if (typeof input === "string") {
|
|
53
|
+
const funding = Funding.make({ url: input });
|
|
54
|
+
entryWires.set(funding, input);
|
|
55
|
+
return Effect.succeed(funding);
|
|
56
|
+
}
|
|
57
|
+
return decodeFundingFields(input).pipe(Effect.mapError((error) => error.issue), Effect.map((fields) => {
|
|
58
|
+
const rest = restOf(input);
|
|
59
|
+
const funding = Funding.make({
|
|
60
|
+
...fields,
|
|
61
|
+
...Object.keys(rest).length > 0 ? { rest } : {}
|
|
62
|
+
});
|
|
63
|
+
entryWires.set(funding, input);
|
|
64
|
+
return funding;
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
const EntryValue = Schema.Union([Schema.Record(Schema.String, Schema.Unknown), Schema.String]);
|
|
68
|
+
const FieldValue = Schema.Union([EntryValue, Schema.Array(EntryValue)]);
|
|
69
|
+
/**
|
|
70
|
+
* Where to send money for a package: one funding entry.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* npm's `funding` field accepts a bare URL string, this object form, or an
|
|
74
|
+
* array of either. `url` is **required** — it is the only thing the field
|
|
75
|
+
* actually says — so an object without one fails to decode rather than
|
|
76
|
+
* producing a half-populated entry. `type` (`"individual"`, `"github"`, …) is
|
|
77
|
+
* caller data and is kept **verbatim**, never normalized.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* import { Funding } from "@effected/package-json";
|
|
82
|
+
* import { Effect, Schema } from "effect";
|
|
83
|
+
*
|
|
84
|
+
* const program = Effect.gen(function* () {
|
|
85
|
+
* // Always an array, whichever encoding the manifest used.
|
|
86
|
+
* const entries = yield* Schema.decodeUnknownEffect(Funding.FromField)("https://example.com/sponsor");
|
|
87
|
+
* console.log(entries[0]?.url); // "https://example.com/sponsor"
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
var Funding = class Funding extends Schema.Class("Funding")({
|
|
94
|
+
/** The funding platform, when the object form carried one (`"github"`, …). */
|
|
95
|
+
type: Schema.optionalKey(Schema.String),
|
|
96
|
+
/** Where the money goes, exactly as the manifest wrote it. */
|
|
97
|
+
url: Schema.String,
|
|
98
|
+
/** Keys outside the documented set, preserved so encoding does not drop them. */
|
|
99
|
+
rest: Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown))
|
|
100
|
+
}) {
|
|
101
|
+
/**
|
|
102
|
+
* A single `funding` entry: the bare URL string or the object form, always
|
|
103
|
+
* decoded to a {@link Funding} and always re-encoded in the form it was read
|
|
104
|
+
* from.
|
|
105
|
+
*
|
|
106
|
+
* @remarks
|
|
107
|
+
* Provenance belongs to the instance, so an entry that is *rebuilt* rather
|
|
108
|
+
* than carried through has none and encodes in the canonical object form.
|
|
109
|
+
*/
|
|
110
|
+
static FromValue = EntryValue.pipe(Schema.decodeTo(Schema.instanceOf(Funding), SchemaTransformation.transformOrFail({
|
|
111
|
+
decode: (input) => decodeEntry(input),
|
|
112
|
+
encode: (funding) => Effect.succeed(encodeEntry(funding))
|
|
113
|
+
})));
|
|
114
|
+
/**
|
|
115
|
+
* The `funding` field: a lone entry or an array of them, **always** decoded
|
|
116
|
+
* to an array so a consumer never branches on arity.
|
|
117
|
+
*
|
|
118
|
+
* @remarks
|
|
119
|
+
* The normalization is one-directional. A field written bare re-encodes
|
|
120
|
+
* bare, not as a one-element array — the arity is remembered against the
|
|
121
|
+
* single entry that WAS the field, and the replay is guarded on that entry
|
|
122
|
+
* still being alone, so pushing a second entry into the decoded array in
|
|
123
|
+
* place upgrades the field to the array form instead of silently dropping
|
|
124
|
+
* the addition. An entry built by hand has no provenance, so an array of
|
|
125
|
+
* such entries encodes as an array.
|
|
126
|
+
*/
|
|
127
|
+
static FromField = FieldValue.pipe(Schema.decodeTo(Schema.Array(Schema.instanceOf(Funding)), SchemaTransformation.transformOrFail({
|
|
128
|
+
decode: (input) => {
|
|
129
|
+
const bare = !Array.isArray(input);
|
|
130
|
+
const values = bare ? [input] : input;
|
|
131
|
+
return Effect.map(Effect.forEach(values, decodeEntry), (entries) => {
|
|
132
|
+
const only = entries[0];
|
|
133
|
+
if (bare && only !== void 0) bareEntries.add(only);
|
|
134
|
+
return entries;
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
encode: (entries) => {
|
|
138
|
+
const only = entries.length === 1 ? entries[0] : void 0;
|
|
139
|
+
if (only !== void 0 && bareEntries.has(only)) return Effect.succeed(encodeEntry(only));
|
|
140
|
+
return Effect.succeed(entries.map(encodeEntry));
|
|
141
|
+
}
|
|
142
|
+
})));
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
//#endregion
|
|
146
|
+
export { Funding };
|
package/LenientManifest.js
CHANGED
|
@@ -60,6 +60,10 @@ const FIELD_GUARDS = /* @__PURE__ */ new Map([
|
|
|
60
60
|
}],
|
|
61
61
|
["repository", stringOrRecordGuard],
|
|
62
62
|
["bugs", stringOrRecordGuard],
|
|
63
|
+
["funding", {
|
|
64
|
+
expected: "a string, an object, or an array of either",
|
|
65
|
+
test: (value) => isStringOrRecord(value) || isStringOrRecordArray(value)
|
|
66
|
+
}],
|
|
63
67
|
["homepage", stringGuard],
|
|
64
68
|
["dependencies", stringRecordGuard],
|
|
65
69
|
["devDependencies", stringRecordGuard],
|
|
@@ -163,6 +167,7 @@ var LenientManifest = class LenientManifest extends Schema.Class("LenientManifes
|
|
|
163
167
|
keywords: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
164
168
|
repository: Schema.optionalKey(StringOrRecord),
|
|
165
169
|
bugs: Schema.optionalKey(StringOrRecord),
|
|
170
|
+
funding: Schema.optionalKey(Schema.Union([StringOrRecord, Schema.Array(StringOrRecord)])),
|
|
166
171
|
homepage: Schema.optionalKey(Schema.String),
|
|
167
172
|
dependencies: Schema.optionalKey(StringRecord),
|
|
168
173
|
devDependencies: Schema.optionalKey(StringRecord),
|
package/License.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
import { isValidExpression } from "@effected/spdx";
|
|
1
|
+
import { Result, Schema } from "effect";
|
|
2
|
+
import { SpdxExpression, isValidExpression } from "@effected/spdx";
|
|
3
3
|
|
|
4
4
|
//#region src/License.ts
|
|
5
5
|
/**
|
|
@@ -32,9 +32,54 @@ const isValidSpdx = (value) => {
|
|
|
32
32
|
* A valid SPDX license identifier, expression, `UNLICENSED`, or
|
|
33
33
|
* `SEE LICENSE IN <file>`.
|
|
34
34
|
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* **A branded value here is not necessarily parseable as SPDX.** npm's
|
|
37
|
+
* `license` field admits two strings that the SPDX grammar does not —
|
|
38
|
+
* `UNLICENSED` and `SEE LICENSE IN <file>` — and this brand accepts both,
|
|
39
|
+
* because it models what a manifest may legally carry, not what SPDX defines.
|
|
40
|
+
* Feeding a branded value straight to `SpdxExpression.parse` therefore fails
|
|
41
|
+
* on exactly those two forms. Do not hand-screen for them — reach for
|
|
42
|
+
* {@link licenseExpressionOf}, which answers "what expression is this, if any"
|
|
43
|
+
* and yields `Option.none()` for a spelling that is not one. Reach for
|
|
44
|
+
* {@link isValidSpdx} when the question is instead "may a manifest carry this".
|
|
45
|
+
*
|
|
35
46
|
* @public
|
|
36
47
|
*/
|
|
37
48
|
const SpdxLicense = Schema.String.pipe(Schema.check(Schema.makeFilter((value) => isValidSpdx(value) ? void 0 : "Expected a valid SPDX license expression")), Schema.brand("SpdxLicense"));
|
|
49
|
+
/**
|
|
50
|
+
* The parsed SPDX expression a manifest's `license` denotes, or `Option.none()`
|
|
51
|
+
* when it denotes no expression at all.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* This is the accessor to reach for whenever a branded `SpdxLicense` has
|
|
55
|
+
* to become an actual expression — a license URL, a badge, structured data, a
|
|
56
|
+
* policy check. It exists because the brand and the grammar disagree, and that
|
|
57
|
+
* disagreement is knowledge these two packages jointly own rather than
|
|
58
|
+
* something each consumer should rediscover.
|
|
59
|
+
*
|
|
60
|
+
* `UNLICENSED` and `SEE LICENSE IN <file>` are legal in a manifest and are not
|
|
61
|
+
* SPDX expressions, so they yield `Option.none()`. Everything else parses.
|
|
62
|
+
* A consumer screening for those two spellings by hand gets it wrong the day
|
|
63
|
+
* npm admits a third — this accessor is the mechanism that prose could not be,
|
|
64
|
+
* and it needs no change on that day, because "not an expression" is answered
|
|
65
|
+
* by the grammar rather than by a list of spellings kept in step with npm.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* import { licenseExpressionOf } from "@effected/package-json";
|
|
70
|
+
* import { SpdxExpression } from "@effected/spdx";
|
|
71
|
+
*
|
|
72
|
+
* // "MIT" => Option.some(<LicenseNode MIT>)
|
|
73
|
+
* // "UNLICENSED" => Option.none()
|
|
74
|
+
* // "SEE LICENSE IN LICENSE.txt" => Option.none()
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @param license - a branded manifest license value
|
|
78
|
+
* @returns the parsed expression, or none for a spelling that is not one
|
|
79
|
+
*
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
const licenseExpressionOf = (license) => Result.getSuccess(SpdxExpression.parseResult(license));
|
|
38
83
|
|
|
39
84
|
//#endregion
|
|
40
|
-
export { InvalidSpdxLicenseError, SpdxLicense, isValidSpdx };
|
|
85
|
+
export { InvalidSpdxLicenseError, SpdxLicense, isValidSpdx, licenseExpressionOf };
|
package/Package.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Dependency } from "./Dependency.js";
|
|
2
2
|
import { DevEnginesSchema } from "./DevEngines.js";
|
|
3
|
+
import { Funding } from "./Funding.js";
|
|
3
4
|
import { renderJson, resolveFormatOptions } from "./internal/format.js";
|
|
4
5
|
import { makeWire } from "./internal/wire.js";
|
|
5
6
|
import { InvalidSpdxLicenseError, SpdxLicense, isValidSpdx } from "./License.js";
|
|
@@ -121,6 +122,7 @@ var Package = class Package extends Schema.Class("Package")({
|
|
|
121
122
|
keywords: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
122
123
|
repository: Schema.optionalKey(Repository.FromValue),
|
|
123
124
|
bugs: Schema.optionalKey(Bugs.FromValue),
|
|
125
|
+
funding: Schema.optionalKey(Funding.FromField),
|
|
124
126
|
homepage: Schema.optionalKey(Schema.String),
|
|
125
127
|
dependencies: DependencyMapField,
|
|
126
128
|
devDependencies: DependencyMapField,
|
package/README.md
CHANGED
|
@@ -264,7 +264,10 @@ Every failure is a `Schema.TaggedError` routed with `Effect.catchTag`. Causes ar
|
|
|
264
264
|
- `resolveEntryPoint` — the pure, `Result`-returning entry-point resolver over a manifest's `exports`/`main`, honoring `exports` encapsulation rather than falling through to `main`, with `EntryPointManifest` as its tolerant input shape.
|
|
265
265
|
- `LenientManifest` — the shape-lenient discovery tier below `PackageManifest`: malformed known fields degrade to absence, are preserved verbatim in `rest` and reported on `issues`, rather than failing the document; `decodeResult`/`decode` and `parseResult`/`parse` in the package's usual `Result`/`Effect` pairing.
|
|
266
266
|
- `Package.resolve` — `catalog:` and `workspace:` expansion over the `@effected/npm` contracts with pnpm's publish-time projection (alias form included), as an explicit step that `write` never performs for you.
|
|
267
|
-
- `PackageName`, `DependencySpecifier`, `Dependency`, `SpdxLicense`, `PackageManager`, `Person`, `Repository`, `Bugs`, `DevEngine` — the leaf concepts, each owning its own statics, brand and error, usable independently of `Package`. `Repository` and `Bugs` decode the `repository` and `bugs` fields from either their shorthand or object form, the same way `Person` does for `author`, `contributors` and `maintainers`; `Repository` also exposes `browseUrl` and `gitUrl` getters that normalize a shorthand or SSH form to `https://`.
|
|
267
|
+
- `PackageName`, `DependencySpecifier`, `Dependency`, `SpdxLicense`, `PackageManager`, `Person`, `Repository`, `Bugs`, `Funding`, `DevEngine` — the leaf concepts, each owning its own statics, brand and error, usable independently of `Package`. `Repository` and `Bugs` decode the `repository` and `bugs` fields from either their shorthand or object form, the same way `Person` does for `author`, `contributors` and `maintainers`; `Repository` also exposes `browseUrl` and `gitUrl` getters that normalize a shorthand or SSH form to `https://`.
|
|
268
|
+
- `Repository.directoryUrl` — the browse URL of a monorepo member's own subdirectory, built from `repository.directory` against the host's path convention on GitHub, GitLab and Bitbucket. `none` for a host whose convention is unknown, or for a `directory` that climbs out of the repository — a guessed path would resolve to nothing while looking authoritative. With no `directory`, it is `browseUrl`.
|
|
269
|
+
- `Funding` — the `funding` field, decoded from a bare URL string, an object, or an array of either, and **always** to an array so a consumer never branches on arity. Each entry re-encodes in the form it was read from, and unrecognized keys survive in `rest`.
|
|
270
|
+
- `licenseExpressionOf` — a `SpdxLicense` as an `Option<SpdxExpression>` from `@effected/spdx`, for a caller that wants the parsed expression rather than the string. `none` for the `SEE LICENSE IN …` and `UNLICENSED` forms, which are valid `license` values but not license expressions.
|
|
268
271
|
- `Package` also types `keywords`, `maintainers` and `homepage` directly, alongside the existing `author` and `contributors`.
|
|
269
272
|
- Field schemas (`DependencyMapField`, `BinField`, `ExportsField`, `PublishConfigField`, `PeerDependenciesMetaField`, `StringMapField`) exported for subclasses that extend the model. `RepositoryField` is exported too but deprecated: `Package.repository` now decodes through `Repository.FromValue`, which round-trips the original shorthand or object form; `RepositoryField` remains only for consumers still matching on the raw union.
|
|
270
273
|
|
package/Repository.js
CHANGED
|
@@ -13,6 +13,16 @@ const BARE_SHORTHAND = /^[\w.-]+\/[\w.-]+$/;
|
|
|
13
13
|
const PREFIXED_SHORTHAND = /^([a-z]+):(.+)$/;
|
|
14
14
|
/** The scp-like form git accepts: `git@host:owner/name.git`. */
|
|
15
15
|
const SCP_LIKE = /^(?:([\w.-]+)@)?([\w.-]+):(.+)$/;
|
|
16
|
+
/**
|
|
17
|
+
* How each known forge spells "browse this subdirectory". `HEAD` is used
|
|
18
|
+
* rather than a branch name because the default branch is not knowable from a
|
|
19
|
+
* manifest, and every one of these hosts resolves `HEAD` to it.
|
|
20
|
+
*/
|
|
21
|
+
const DIRECTORY_PATHS = /* @__PURE__ */ new Map([
|
|
22
|
+
["github.com", "tree/HEAD"],
|
|
23
|
+
["gitlab.com", "-/tree/HEAD"],
|
|
24
|
+
["bitbucket.org", "src/HEAD"]
|
|
25
|
+
]);
|
|
16
26
|
const stripGitSuffix = (value) => value.endsWith(".git") ? value.slice(0, -4) : value;
|
|
17
27
|
/**
|
|
18
28
|
* The browsable `https://host/path` form of a repository reference, or none
|
|
@@ -53,6 +63,34 @@ const KNOWN_REPOSITORY_KEYS = /* @__PURE__ */ new Set([
|
|
|
53
63
|
"directory"
|
|
54
64
|
]);
|
|
55
65
|
const KNOWN_BUGS_KEYS = /* @__PURE__ */ new Set(["url", "email"]);
|
|
66
|
+
const sameRest = (a, b) => JSON.stringify(a ?? {}) === JSON.stringify(b ?? {});
|
|
67
|
+
/** The keys of `wire` outside the documented set, which is what `rest` holds. */
|
|
68
|
+
const restOf = (wire, known) => {
|
|
69
|
+
const rest = {};
|
|
70
|
+
for (const [key, value] of Object.entries(wire)) if (!known.has(key)) rest[key] = value;
|
|
71
|
+
return rest;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Whether the shorthand string can still carry everything this value holds.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* A shorthand is only a `url` — it has no syntax for `type`, `directory` or an
|
|
78
|
+
* unknown key. So a repository decoded from a string that later GAINS one of
|
|
79
|
+
* those is no longer described by the wire it remembers, and replaying that
|
|
80
|
+
* wire drops the addition silently. This is the same stale-provenance class the
|
|
81
|
+
* object branch guards, reached through the one field the shorthand cannot
|
|
82
|
+
* express, and `Person.isShorthandExpressible` / `Funding.isStringExpressible`
|
|
83
|
+
* already gate their own string branches this way.
|
|
84
|
+
*
|
|
85
|
+
* `directory` is the live case: this package ships `Repository.directoryUrl`,
|
|
86
|
+
* so a consumer reading a bare-string `repository` and making it a monorepo
|
|
87
|
+
* member is the natural mutator.
|
|
88
|
+
*/
|
|
89
|
+
const isStringExpressibleRepository = (repository) => repository.type === void 0 && repository.directory === void 0 && Object.keys(repository.rest ?? {}).length === 0;
|
|
90
|
+
/** Whether the bare URL string can still carry everything this `bugs` entry holds. */
|
|
91
|
+
const isStringExpressibleBugs = (bugs) => bugs.email === void 0 && Object.keys(bugs.rest ?? {}).length === 0;
|
|
92
|
+
const isFaithfulRepository = (wire, repository) => wire.url === repository.url && wire.type === repository.type && wire.directory === repository.directory && sameRest(restOf(wire, KNOWN_REPOSITORY_KEYS), repository.rest);
|
|
93
|
+
const isFaithfulBugs = (wire, bugs) => wire.url === bugs.url && wire.email === bugs.email && sameRest(restOf(wire, KNOWN_BUGS_KEYS), bugs.rest);
|
|
56
94
|
/**
|
|
57
95
|
* Where a package's source lives.
|
|
58
96
|
*
|
|
@@ -92,6 +130,60 @@ var Repository = class Repository extends Schema.Class("Repository")({
|
|
|
92
130
|
return Option.map(this.browseUrl, (url) => `${url}.git`);
|
|
93
131
|
}
|
|
94
132
|
/**
|
|
133
|
+
* The browsable URL of **this package** — {@link Repository.browseUrl}
|
|
134
|
+
* descended into `directory` when the package is a monorepo
|
|
135
|
+
* member.
|
|
136
|
+
*
|
|
137
|
+
* @remarks
|
|
138
|
+
* Prefer this over `browseUrl` whenever the question is "where does this
|
|
139
|
+
* package live". For a monorepo, `browseUrl` answers with the repository
|
|
140
|
+
* root, so every member of the repository reports the same location — which
|
|
141
|
+
* matters because that URL is exactly what a consumer (a docs site's
|
|
142
|
+
* structured data, say) uses to tell two packages apart.
|
|
143
|
+
*
|
|
144
|
+
* The three outcomes are deliberately distinct:
|
|
145
|
+
*
|
|
146
|
+
* - **No `directory`** — the package *is* the repository root, so this is
|
|
147
|
+
* `browseUrl`. A correct answer, not a missing one.
|
|
148
|
+
* - **`directory` on a host this model knows** (GitHub, GitLab, Bitbucket) —
|
|
149
|
+
* the descended URL.
|
|
150
|
+
* - **`directory` on any other host** — `Option.none()`. The path convention
|
|
151
|
+
* for browsing a subdirectory is per-forge and cannot be guessed, and
|
|
152
|
+
* fabricating one would produce a URL that resolves to nothing while
|
|
153
|
+
* looking authoritative.
|
|
154
|
+
*
|
|
155
|
+
* What to do with that `none` is a policy this getter deliberately leaves to
|
|
156
|
+
* the caller, because it depends on what is being filled in. Falling back to
|
|
157
|
+
* {@link Repository.browseUrl} is reasonable wherever a less precise answer
|
|
158
|
+
* beats no answer — the repository root is a *true* location for the package,
|
|
159
|
+
* merely one that does not distinguish it from its siblings. Omit the value
|
|
160
|
+
* instead wherever that lack of distinction is the whole point. What is never
|
|
161
|
+
* reasonable is inventing a subdirectory path for a host this model does not
|
|
162
|
+
* recognize, which is the case this `none` exists to prevent.
|
|
163
|
+
*
|
|
164
|
+
* A `directory` that escapes the repository (any `..` segment) is refused the
|
|
165
|
+
* same way. One that resolves to the root itself (`"."`, `"/"`) is the root.
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts
|
|
169
|
+
* // { url: "effected/kit", directory: "packages/spdx" }
|
|
170
|
+
* // => https://github.com/effected/kit/tree/HEAD/packages/spdx
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
get directoryUrl() {
|
|
174
|
+
const directory = this.directory;
|
|
175
|
+
if (directory === void 0) return this.browseUrl;
|
|
176
|
+
const segments = directory.split("/").map((segment) => segment.trim()).filter((segment) => segment !== "" && segment !== ".");
|
|
177
|
+
if (segments.some((segment) => segment === "..")) return Option.none();
|
|
178
|
+
if (segments.length === 0) return this.browseUrl;
|
|
179
|
+
return Option.flatMap(this.browseUrl, (url) => {
|
|
180
|
+
const host = /^https:\/\/([^/]+)/.exec(url)?.[1];
|
|
181
|
+
const path = host === void 0 ? void 0 : DIRECTORY_PATHS.get(host);
|
|
182
|
+
if (path === void 0) return Option.none();
|
|
183
|
+
return Option.some(`${url}/${path}/${segments.map((segment) => encodeURIComponent(segment)).join("/")}`);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
95
187
|
* The `repository` field: the shorthand string or the object form, always
|
|
96
188
|
* decoded to a {@link Repository}, and always re-encoded in the form it was
|
|
97
189
|
* read from.
|
|
@@ -116,8 +208,8 @@ var Repository = class Repository extends Schema.Class("Repository")({
|
|
|
116
208
|
},
|
|
117
209
|
encode: (repository) => {
|
|
118
210
|
const wire = repositoryWires.get(repository);
|
|
119
|
-
if (typeof wire === "string" && wire === repository.url) return wire;
|
|
120
|
-
if (wire !== void 0 && typeof wire !== "string") return wire;
|
|
211
|
+
if (typeof wire === "string" && wire === repository.url && isStringExpressibleRepository(repository)) return wire;
|
|
212
|
+
if (wire !== void 0 && typeof wire !== "string" && isFaithfulRepository(wire, repository)) return wire;
|
|
121
213
|
return {
|
|
122
214
|
...repository.type !== void 0 && { type: repository.type },
|
|
123
215
|
url: repository.url,
|
|
@@ -164,8 +256,8 @@ var Bugs = class Bugs extends Schema.Class("Bugs")({
|
|
|
164
256
|
},
|
|
165
257
|
encode: (bugs) => {
|
|
166
258
|
const wire = bugsWires.get(bugs);
|
|
167
|
-
if (typeof wire === "string" && wire === bugs.url && bugs
|
|
168
|
-
if (wire !== void 0 && typeof wire !== "string") return wire;
|
|
259
|
+
if (typeof wire === "string" && wire === bugs.url && isStringExpressibleBugs(bugs)) return wire;
|
|
260
|
+
if (wire !== void 0 && typeof wire !== "string" && isFaithfulBugs(wire, bugs)) return wire;
|
|
169
261
|
return {
|
|
170
262
|
...bugs.url !== void 0 && { url: bugs.url },
|
|
171
263
|
...bugs.email !== void 0 && { email: bugs.email },
|
package/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { JsoncEdit, JsoncEdit as JsoncEdit$1, JsoncPath, JsoncPath as JsoncPath$
|
|
|
2
2
|
import { CatalogResolver, DependencyKind, DependencyProtocol, DependencyProtocol as DependencyProtocol$1, DependencySpecifier, DependencySpecifierBrand, InvalidDependencySpecifierError, WorkspaceResolver, isValidDependencySpecifier } from "@effected/npm";
|
|
3
3
|
import { InvalidVersionError, Range, SemVer } from "@effected/semver";
|
|
4
4
|
import { Brand, Context, Effect, FileSystem, HashMap, Layer, Option, Path, Result, Schema } from "effect";
|
|
5
|
+
import { SpdxExpression } from "@effected/spdx";
|
|
5
6
|
//#region src/Dependency.d.ts
|
|
6
7
|
declare const Dependency_base: Schema.Class<Dependency, Schema.Struct<{
|
|
7
8
|
/** The package name. */
|
|
@@ -224,6 +225,72 @@ interface EntryPointManifest {
|
|
|
224
225
|
*/
|
|
225
226
|
declare const resolveEntryPoint: (manifest: EntryPointManifest, options?: ResolveEntryPointOptions) => Result.Result<string, UnresolvedEntryPointError>;
|
|
226
227
|
//#endregion
|
|
228
|
+
//#region src/Funding.d.ts
|
|
229
|
+
declare const Funding_base: Schema.Class<Funding, Schema.Struct<{
|
|
230
|
+
/** The funding platform, when the object form carried one (`"github"`, …). */
|
|
231
|
+
readonly type: Schema.optionalKey<Schema.String>;
|
|
232
|
+
/** Where the money goes, exactly as the manifest wrote it. */
|
|
233
|
+
readonly url: Schema.String;
|
|
234
|
+
/** Keys outside the documented set, preserved so encoding does not drop them. */
|
|
235
|
+
readonly rest: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
236
|
+
}>, {}>;
|
|
237
|
+
/**
|
|
238
|
+
* Where to send money for a package: one funding entry.
|
|
239
|
+
*
|
|
240
|
+
* @remarks
|
|
241
|
+
* npm's `funding` field accepts a bare URL string, this object form, or an
|
|
242
|
+
* array of either. `url` is **required** — it is the only thing the field
|
|
243
|
+
* actually says — so an object without one fails to decode rather than
|
|
244
|
+
* producing a half-populated entry. `type` (`"individual"`, `"github"`, …) is
|
|
245
|
+
* caller data and is kept **verbatim**, never normalized.
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```ts
|
|
249
|
+
* import { Funding } from "@effected/package-json";
|
|
250
|
+
* import { Effect, Schema } from "effect";
|
|
251
|
+
*
|
|
252
|
+
* const program = Effect.gen(function* () {
|
|
253
|
+
* // Always an array, whichever encoding the manifest used.
|
|
254
|
+
* const entries = yield* Schema.decodeUnknownEffect(Funding.FromField)("https://example.com/sponsor");
|
|
255
|
+
* console.log(entries[0]?.url); // "https://example.com/sponsor"
|
|
256
|
+
* });
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
259
|
+
* @public
|
|
260
|
+
*/
|
|
261
|
+
declare class Funding extends Funding_base {
|
|
262
|
+
/**
|
|
263
|
+
* A single `funding` entry: the bare URL string or the object form, always
|
|
264
|
+
* decoded to a {@link Funding} and always re-encoded in the form it was read
|
|
265
|
+
* from.
|
|
266
|
+
*
|
|
267
|
+
* @remarks
|
|
268
|
+
* Provenance belongs to the instance, so an entry that is *rebuilt* rather
|
|
269
|
+
* than carried through has none and encodes in the canonical object form.
|
|
270
|
+
*/
|
|
271
|
+
static readonly FromValue: Schema.Codec<Funding, string | {
|
|
272
|
+
readonly [k: string]: unknown;
|
|
273
|
+
}>;
|
|
274
|
+
/**
|
|
275
|
+
* The `funding` field: a lone entry or an array of them, **always** decoded
|
|
276
|
+
* to an array so a consumer never branches on arity.
|
|
277
|
+
*
|
|
278
|
+
* @remarks
|
|
279
|
+
* The normalization is one-directional. A field written bare re-encodes
|
|
280
|
+
* bare, not as a one-element array — the arity is remembered against the
|
|
281
|
+
* single entry that WAS the field, and the replay is guarded on that entry
|
|
282
|
+
* still being alone, so pushing a second entry into the decoded array in
|
|
283
|
+
* place upgrades the field to the array form instead of silently dropping
|
|
284
|
+
* the addition. An entry built by hand has no provenance, so an array of
|
|
285
|
+
* such entries encodes as an array.
|
|
286
|
+
*/
|
|
287
|
+
static readonly FromField: Schema.Codec<ReadonlyArray<Funding>, string | {
|
|
288
|
+
readonly [k: string]: unknown;
|
|
289
|
+
} | ReadonlyArray<string | {
|
|
290
|
+
readonly [k: string]: unknown;
|
|
291
|
+
}>>;
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
227
294
|
//#region src/License.d.ts
|
|
228
295
|
declare const InvalidSpdxLicenseError_base: Schema.Class<InvalidSpdxLicenseError, Schema.TaggedStruct<"InvalidSpdxLicenseError", {
|
|
229
296
|
/** The raw input string that failed validation. */
|
|
@@ -251,6 +318,17 @@ declare const isValidSpdx: (value: string) => boolean;
|
|
|
251
318
|
* A valid SPDX license identifier, expression, `UNLICENSED`, or
|
|
252
319
|
* `SEE LICENSE IN <file>`.
|
|
253
320
|
*
|
|
321
|
+
* @remarks
|
|
322
|
+
* **A branded value here is not necessarily parseable as SPDX.** npm's
|
|
323
|
+
* `license` field admits two strings that the SPDX grammar does not —
|
|
324
|
+
* `UNLICENSED` and `SEE LICENSE IN <file>` — and this brand accepts both,
|
|
325
|
+
* because it models what a manifest may legally carry, not what SPDX defines.
|
|
326
|
+
* Feeding a branded value straight to `SpdxExpression.parse` therefore fails
|
|
327
|
+
* on exactly those two forms. Do not hand-screen for them — reach for
|
|
328
|
+
* {@link licenseExpressionOf}, which answers "what expression is this, if any"
|
|
329
|
+
* and yields `Option.none()` for a spelling that is not one. Reach for
|
|
330
|
+
* {@link isValidSpdx} when the question is instead "may a manifest carry this".
|
|
331
|
+
*
|
|
254
332
|
* @public
|
|
255
333
|
*/
|
|
256
334
|
declare const SpdxLicense: Schema.brand<Schema.String, "SpdxLicense">;
|
|
@@ -260,6 +338,40 @@ declare const SpdxLicense: Schema.brand<Schema.String, "SpdxLicense">;
|
|
|
260
338
|
* @public
|
|
261
339
|
*/
|
|
262
340
|
type SpdxLicense = string & Brand.Brand<"SpdxLicense">;
|
|
341
|
+
/**
|
|
342
|
+
* The parsed SPDX expression a manifest's `license` denotes, or `Option.none()`
|
|
343
|
+
* when it denotes no expression at all.
|
|
344
|
+
*
|
|
345
|
+
* @remarks
|
|
346
|
+
* This is the accessor to reach for whenever a branded `SpdxLicense` has
|
|
347
|
+
* to become an actual expression — a license URL, a badge, structured data, a
|
|
348
|
+
* policy check. It exists because the brand and the grammar disagree, and that
|
|
349
|
+
* disagreement is knowledge these two packages jointly own rather than
|
|
350
|
+
* something each consumer should rediscover.
|
|
351
|
+
*
|
|
352
|
+
* `UNLICENSED` and `SEE LICENSE IN <file>` are legal in a manifest and are not
|
|
353
|
+
* SPDX expressions, so they yield `Option.none()`. Everything else parses.
|
|
354
|
+
* A consumer screening for those two spellings by hand gets it wrong the day
|
|
355
|
+
* npm admits a third — this accessor is the mechanism that prose could not be,
|
|
356
|
+
* and it needs no change on that day, because "not an expression" is answered
|
|
357
|
+
* by the grammar rather than by a list of spellings kept in step with npm.
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```ts
|
|
361
|
+
* import { licenseExpressionOf } from "@effected/package-json";
|
|
362
|
+
* import { SpdxExpression } from "@effected/spdx";
|
|
363
|
+
*
|
|
364
|
+
* // "MIT" => Option.some(<LicenseNode MIT>)
|
|
365
|
+
* // "UNLICENSED" => Option.none()
|
|
366
|
+
* // "SEE LICENSE IN LICENSE.txt" => Option.none()
|
|
367
|
+
* ```
|
|
368
|
+
*
|
|
369
|
+
* @param license - a branded manifest license value
|
|
370
|
+
* @returns the parsed expression, or none for a spelling that is not one
|
|
371
|
+
*
|
|
372
|
+
* @public
|
|
373
|
+
*/
|
|
374
|
+
declare const licenseExpressionOf: (license: SpdxLicense) => Option.Option<SpdxExpression>;
|
|
263
375
|
//#endregion
|
|
264
376
|
//#region src/PackageManager.d.ts
|
|
265
377
|
declare const PackageManager_base: Schema.Class<PackageManager, Schema.Struct<{
|
|
@@ -505,6 +617,48 @@ declare class Repository extends Repository_base {
|
|
|
505
617
|
get browseUrl(): Option.Option<string>;
|
|
506
618
|
/** The canonical https clone URL, or none when it cannot be derived. */
|
|
507
619
|
get gitUrl(): Option.Option<string>;
|
|
620
|
+
/**
|
|
621
|
+
* The browsable URL of **this package** — {@link Repository.browseUrl}
|
|
622
|
+
* descended into `directory` when the package is a monorepo
|
|
623
|
+
* member.
|
|
624
|
+
*
|
|
625
|
+
* @remarks
|
|
626
|
+
* Prefer this over `browseUrl` whenever the question is "where does this
|
|
627
|
+
* package live". For a monorepo, `browseUrl` answers with the repository
|
|
628
|
+
* root, so every member of the repository reports the same location — which
|
|
629
|
+
* matters because that URL is exactly what a consumer (a docs site's
|
|
630
|
+
* structured data, say) uses to tell two packages apart.
|
|
631
|
+
*
|
|
632
|
+
* The three outcomes are deliberately distinct:
|
|
633
|
+
*
|
|
634
|
+
* - **No `directory`** — the package *is* the repository root, so this is
|
|
635
|
+
* `browseUrl`. A correct answer, not a missing one.
|
|
636
|
+
* - **`directory` on a host this model knows** (GitHub, GitLab, Bitbucket) —
|
|
637
|
+
* the descended URL.
|
|
638
|
+
* - **`directory` on any other host** — `Option.none()`. The path convention
|
|
639
|
+
* for browsing a subdirectory is per-forge and cannot be guessed, and
|
|
640
|
+
* fabricating one would produce a URL that resolves to nothing while
|
|
641
|
+
* looking authoritative.
|
|
642
|
+
*
|
|
643
|
+
* What to do with that `none` is a policy this getter deliberately leaves to
|
|
644
|
+
* the caller, because it depends on what is being filled in. Falling back to
|
|
645
|
+
* {@link Repository.browseUrl} is reasonable wherever a less precise answer
|
|
646
|
+
* beats no answer — the repository root is a *true* location for the package,
|
|
647
|
+
* merely one that does not distinguish it from its siblings. Omit the value
|
|
648
|
+
* instead wherever that lack of distinction is the whole point. What is never
|
|
649
|
+
* reasonable is inventing a subdirectory path for a host this model does not
|
|
650
|
+
* recognize, which is the case this `none` exists to prevent.
|
|
651
|
+
*
|
|
652
|
+
* A `directory` that escapes the repository (any `..` segment) is refused the
|
|
653
|
+
* same way. One that resolves to the root itself (`"."`, `"/"`) is the root.
|
|
654
|
+
*
|
|
655
|
+
* @example
|
|
656
|
+
* ```ts
|
|
657
|
+
* // { url: "effected/kit", directory: "packages/spdx" }
|
|
658
|
+
* // => https://github.com/effected/kit/tree/HEAD/packages/spdx
|
|
659
|
+
* ```
|
|
660
|
+
*/
|
|
661
|
+
get directoryUrl(): Option.Option<string>;
|
|
508
662
|
/**
|
|
509
663
|
* The `repository` field: the shorthand string or the object form, always
|
|
510
664
|
* decoded to a {@link Repository}, and always re-encoded in the form it was
|
|
@@ -681,6 +835,11 @@ declare const Package_base: Schema.Class<Package, Schema.Struct<{
|
|
|
681
835
|
readonly bugs: Schema.optionalKey<Schema.Codec<Bugs, string | {
|
|
682
836
|
readonly [k: string]: unknown;
|
|
683
837
|
}, never, never>>;
|
|
838
|
+
readonly funding: Schema.optionalKey<Schema.Codec<readonly Funding[], string | readonly (string | {
|
|
839
|
+
readonly [k: string]: unknown;
|
|
840
|
+
})[] | {
|
|
841
|
+
readonly [k: string]: unknown;
|
|
842
|
+
}, never, never>>;
|
|
684
843
|
readonly homepage: Schema.optionalKey<Schema.String>;
|
|
685
844
|
readonly dependencies: Schema.decodeTo<Schema.HashMap<Schema.String, Schema.String>, Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.String>, never>, never, never>;
|
|
686
845
|
readonly devDependencies: Schema.decodeTo<Schema.HashMap<Schema.String, Schema.String>, Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.String>, never>, never, never>;
|
|
@@ -1112,6 +1271,7 @@ declare const LenientManifest_base: Schema.Class<LenientManifest, Schema.Struct<
|
|
|
1112
1271
|
readonly keywords: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
1113
1272
|
readonly repository: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.$Record<Schema.String, Schema.Unknown>]>>;
|
|
1114
1273
|
readonly bugs: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.$Record<Schema.String, Schema.Unknown>]>>;
|
|
1274
|
+
readonly funding: Schema.optionalKey<Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.$Record<Schema.String, Schema.Unknown>]>>]>>;
|
|
1115
1275
|
readonly homepage: Schema.optionalKey<Schema.String>;
|
|
1116
1276
|
readonly dependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
1117
1277
|
readonly devDependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
@@ -1343,6 +1503,11 @@ declare const PackageManifest_base: Schema.Class<PackageManifest, Schema.Struct<
|
|
|
1343
1503
|
readonly bugs: Schema.optionalKey<Schema.Codec<Bugs, string | {
|
|
1344
1504
|
readonly [k: string]: unknown;
|
|
1345
1505
|
}, never, never>>;
|
|
1506
|
+
readonly funding: Schema.optionalKey<Schema.Codec<readonly Funding[], string | readonly (string | {
|
|
1507
|
+
readonly [k: string]: unknown;
|
|
1508
|
+
})[] | {
|
|
1509
|
+
readonly [k: string]: unknown;
|
|
1510
|
+
}, never, never>>;
|
|
1346
1511
|
readonly homepage: Schema.optionalKey<Schema.String>;
|
|
1347
1512
|
readonly dependencies: Schema.decodeTo<Schema.HashMap<Schema.String, Schema.String>, Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.String>, never>, never, never>;
|
|
1348
1513
|
readonly devDependencies: Schema.decodeTo<Schema.HashMap<Schema.String, Schema.String>, Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.String>, never>, never, never>;
|
|
@@ -1700,5 +1865,5 @@ declare class PackageValidator extends PackageValidator_base {
|
|
|
1700
1865
|
}): Layer.Layer<PackageValidator>;
|
|
1701
1866
|
}
|
|
1702
1867
|
//#endregion
|
|
1703
|
-
export { BinField, Bugs, Dependency, type DependencyKind, DependencyMapField, type DependencyProtocol, DependencySpecifier, type DependencySpecifierBrand, DevEngine, DevEngineOrArray, type DevEngines, DevEnginesSchema, type EntryPointManifest, ExportsField, InvalidDependencySpecifierError, InvalidPackageNameError, InvalidSpdxLicenseError, JsoncEdit, type JsoncPath, type LenientFieldIssue, LenientManifest, Package, PackageDecodeError, type PackageFieldEdit, type PackageFormatOptions, type PackageFormatTextOptions, type PackageIndent, PackageJsonFile, type PackageJsonFileShape, PackageJsonFormat, PackageJsonModifyError, PackageJsonNotFoundError, PackageJsonParseError, PackageJsonReadError, PackageJsonSyntaxError, PackageJsonWriteError, PackageManager, PackageManagerRange, PackageManifest, PackageName, type PackagePatch, PackageValidationError, PackageValidator, PeerDependenciesMetaField, Person, PublishConfigField, Repository, RepositoryField, type ResolveEntryPointOptions, type RuleFailure, ScopedPackageName, SpdxLicense, StringMapField, type UnresolvedDependency, UnresolvedEntryPointError, UnscopedPackageName, type ValidationRule, defaultRules, isUnresolvedDependency, isValidDependencySpecifier, isValidSpdx, noLocalDepsRule, noUnresolvedDepsRule, resolveEntryPoint };
|
|
1868
|
+
export { BinField, Bugs, Dependency, type DependencyKind, DependencyMapField, type DependencyProtocol, DependencySpecifier, type DependencySpecifierBrand, DevEngine, DevEngineOrArray, type DevEngines, DevEnginesSchema, type EntryPointManifest, ExportsField, Funding, InvalidDependencySpecifierError, InvalidPackageNameError, InvalidSpdxLicenseError, JsoncEdit, type JsoncPath, type LenientFieldIssue, LenientManifest, Package, PackageDecodeError, type PackageFieldEdit, type PackageFormatOptions, type PackageFormatTextOptions, type PackageIndent, PackageJsonFile, type PackageJsonFileShape, PackageJsonFormat, PackageJsonModifyError, PackageJsonNotFoundError, PackageJsonParseError, PackageJsonReadError, PackageJsonSyntaxError, PackageJsonWriteError, PackageManager, PackageManagerRange, PackageManifest, PackageName, type PackagePatch, PackageValidationError, PackageValidator, PeerDependenciesMetaField, Person, PublishConfigField, Repository, RepositoryField, type ResolveEntryPointOptions, type RuleFailure, ScopedPackageName, SpdxLicense, StringMapField, type UnresolvedDependency, UnresolvedEntryPointError, UnscopedPackageName, type ValidationRule, defaultRules, isUnresolvedDependency, isValidDependencySpecifier, isValidSpdx, licenseExpressionOf, noLocalDepsRule, noUnresolvedDepsRule, resolveEntryPoint };
|
|
1704
1869
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Dependency, isUnresolvedDependency } from "./Dependency.js";
|
|
2
2
|
import { DevEngine, DevEngineOrArray, DevEnginesSchema } from "./DevEngines.js";
|
|
3
3
|
import { UnresolvedEntryPointError, resolveEntryPoint } from "./EntryPoint.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Funding } from "./Funding.js";
|
|
5
|
+
import { InvalidSpdxLicenseError, SpdxLicense, isValidSpdx, licenseExpressionOf } from "./License.js";
|
|
5
6
|
import { PackageManager } from "./PackageManager.js";
|
|
6
7
|
import { InvalidPackageNameError, PackageName, ScopedPackageName, UnscopedPackageName } from "./PackageName.js";
|
|
7
8
|
import { Person } from "./Person.js";
|
|
@@ -16,4 +17,4 @@ import { PackageValidationError, PackageValidator, defaultRules, noLocalDepsRule
|
|
|
16
17
|
import { JsoncEdit } from "@effected/jsonc";
|
|
17
18
|
import { DependencySpecifier, InvalidDependencySpecifierError, isValidDependencySpecifier } from "@effected/npm";
|
|
18
19
|
|
|
19
|
-
export { BinField, Bugs, Dependency, DependencyMapField, DependencySpecifier, DevEngine, DevEngineOrArray, DevEnginesSchema, ExportsField, InvalidDependencySpecifierError, InvalidPackageNameError, InvalidSpdxLicenseError, JsoncEdit, LenientManifest, Package, PackageDecodeError, PackageJsonFile, PackageJsonFormat, PackageJsonModifyError, PackageJsonNotFoundError, PackageJsonParseError, PackageJsonReadError, PackageJsonSyntaxError, PackageJsonWriteError, PackageManager, PackageManagerRange, PackageManifest, PackageName, PackageValidationError, PackageValidator, PeerDependenciesMetaField, Person, PublishConfigField, Repository, RepositoryField, ScopedPackageName, SpdxLicense, StringMapField, UnresolvedEntryPointError, UnscopedPackageName, defaultRules, isUnresolvedDependency, isValidDependencySpecifier, isValidSpdx, noLocalDepsRule, noUnresolvedDepsRule, resolveEntryPoint };
|
|
20
|
+
export { BinField, Bugs, Dependency, DependencyMapField, DependencySpecifier, DevEngine, DevEngineOrArray, DevEnginesSchema, ExportsField, Funding, InvalidDependencySpecifierError, InvalidPackageNameError, InvalidSpdxLicenseError, JsoncEdit, LenientManifest, Package, PackageDecodeError, PackageJsonFile, PackageJsonFormat, PackageJsonModifyError, PackageJsonNotFoundError, PackageJsonParseError, PackageJsonReadError, PackageJsonSyntaxError, PackageJsonWriteError, PackageManager, PackageManagerRange, PackageManifest, PackageName, PackageValidationError, PackageValidator, PeerDependenciesMetaField, Person, PublishConfigField, Repository, RepositoryField, ScopedPackageName, SpdxLicense, StringMapField, UnresolvedEntryPointError, UnscopedPackageName, defaultRules, isUnresolvedDependency, isValidDependencySpecifier, isValidSpdx, licenseExpressionOf, noLocalDepsRule, noUnresolvedDepsRule, resolveEntryPoint };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effected/package-json",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "package.json parsing, editing, validation and file IO as Effect schemas.",
|
|
6
6
|
"keywords": [
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@effected/jsonc": "^0.8.0",
|
|
42
|
-
"@effected/npm": "^0.12.
|
|
42
|
+
"@effected/npm": "^0.12.1",
|
|
43
43
|
"@effected/semver": "^0.5.0",
|
|
44
|
-
"@effected/spdx": "^0.
|
|
44
|
+
"@effected/spdx": "^0.5.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"effect": "4.0.0-rc.109"
|