@pagefront/lint-commerce 0.11.0 → 0.12.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/README.md +33 -13
- package/dist/catalogue.js +4 -2
- package/dist/generated/release-manifest.d.ts +8 -0
- package/dist/generated/release-manifest.js +9 -0
- package/dist/generated/schema-ids.js +2 -0
- package/dist/generated/schemas.js +2450 -7
- package/dist/organization-catalogue.js +3 -2
- package/dist/rules/org-e-001.js +2 -0
- package/dist/rules/org-e-002.js +2 -0
- package/dist/rules/org-e-003.js +2 -0
- package/dist/rules/org-e-004.d.ts +11 -0
- package/dist/rules/org-e-004.js +18 -0
- package/dist/rules/org-w-001.js +2 -0
- package/dist/rules/org-w-002.js +2 -0
- package/dist/rules/org-w-003.js +2 -0
- package/dist/rules/org-w-004.js +2 -0
- package/dist/rules/org-w-005.js +2 -0
- package/dist/rules/org-w-006.js +2 -0
- package/dist/rules/pdp-e-001.js +2 -0
- package/dist/rules/pdp-e-002.js +2 -0
- package/dist/rules/pdp-e-003.js +2 -0
- package/dist/rules/pdp-e-004.js +2 -0
- package/dist/rules/pdp-e-005.js +2 -0
- package/dist/rules/pdp-e-006.js +2 -0
- package/dist/rules/pdp-e-007.js +2 -0
- package/dist/rules/pdp-e-008.js +2 -0
- package/dist/rules/pdp-e-009.js +2 -0
- package/dist/rules/pdp-e-010.js +2 -0
- package/dist/rules/pdp-e-011.js +2 -0
- package/dist/rules/pdp-e-012.js +2 -0
- package/dist/rules/pdp-e-013.js +2 -0
- package/dist/rules/pdp-e-014.js +2 -0
- package/dist/rules/pdp-e-015.js +2 -0
- package/dist/rules/pdp-e-016.js +2 -0
- package/dist/rules/pdp-e-017.d.ts +2 -0
- package/dist/rules/pdp-e-017.js +80 -0
- package/dist/rules/pdp-e-018.d.ts +11 -0
- package/dist/rules/pdp-e-018.js +18 -0
- package/dist/rules/pdp-i-001.js +2 -0
- package/dist/rules/pdp-w-001.js +2 -0
- package/dist/rules/pdp-w-002.js +2 -0
- package/dist/rules/pdp-w-003.js +2 -0
- package/dist/rules/pdp-w-004.js +2 -0
- package/dist/rules/pdp-w-005.js +2 -0
- package/dist/rules/pdp-w-006.js +2 -0
- package/dist/rules/pdp-w-007.js +2 -0
- package/dist/rules/pdp-w-008.js +2 -0
- package/dist/rules/pdp-w-009.js +2 -0
- package/dist/rules/pdp-w-010.js +2 -0
- package/dist/rules/pdp-w-011.js +2 -0
- package/dist/rules/pdp-w-012.js +2 -0
- package/dist/rules/pdp-w-013.js +2 -0
- package/dist/rules/pdp-w-014.js +2 -0
- package/dist/rules/pdp-w-015.js +2 -0
- package/dist/rules/pdp-w-016.js +2 -0
- package/dist/rules/pdp-w-017.js +2 -0
- package/dist/rules/pdp-w-018.js +2 -0
- package/dist/rules/pdp-w-019.js +2 -0
- package/dist/rules/pdp-w-020.js +2 -0
- package/dist/rules/pdp-w-021.js +2 -0
- package/dist/rules/pdp-w-022.js +2 -0
- package/dist/rules/pdp-w-023.js +2 -0
- package/dist/rules/pdp-w-024.js +2 -0
- package/dist/rules/pdp-w-025.js +2 -0
- package/dist/rules/pdp-w-026.js +2 -0
- package/dist/rules/pdp-w-027.js +2 -0
- package/dist/rules/pdp-w-028.js +2 -0
- package/dist/rules/pdp-w-029.js +2 -0
- package/dist/rules/pdp-w-030.js +2 -0
- package/dist/rules/pdp-w-031.js +2 -0
- package/dist/rules/pdp-w-032.js +2 -0
- package/dist/rules/pdp-w-033.js +2 -0
- package/dist/rules/pdp-w-034.js +2 -0
- package/dist/rules/pdp-w-035.js +2 -0
- package/dist/rules/pdp-w-036.js +2 -0
- package/dist/rules/pdp-w-037.js +2 -0
- package/dist/rules/pdp-w-038.js +2 -0
- package/dist/rules/pdp-w-039.js +2 -0
- package/dist/rules/release-schema.d.ts +18 -7
- package/dist/rules/release-schema.js +55 -15
- package/dist/schema-registry.d.ts +27 -14
- package/dist/schema-registry.js +29 -12
- package/dist/schema-validators.js +12 -4
- package/dist/validate-and-lint.d.ts +13 -9
- package/dist/validate-and-lint.js +23 -10
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -26,11 +26,11 @@ lint with their own catalogue, dispatched by sheet type.
|
|
|
26
26
|
|
|
27
27
|
## Catalogue
|
|
28
28
|
|
|
29
|
-
Catalogue 0.
|
|
30
|
-
0.
|
|
31
|
-
0.9):
|
|
32
|
-
`PDP-W-039`, `PDP-I-001`) and
|
|
33
|
-
`ORG-E-
|
|
29
|
+
Catalogue 0.16.0, supporting commerce releases 0.4.0 (Product Sheet spec
|
|
30
|
+
0.10.0, Organization Sheet spec 0.4.0) and 0.3.0, and the legacy draft line
|
|
31
|
+
(format 0.9): 58 product rules (`PDP-E-001` to `PDP-E-018`, `PDP-W-001` to
|
|
32
|
+
`PDP-W-039`, `PDP-I-001`) and 10 organization rules (`ORG-E-001` to
|
|
33
|
+
`ORG-E-004`, `ORG-W-001` to `ORG-W-006`), each defined in
|
|
34
34
|
[`rules.md`](https://github.com/themachineweb/pagefront/blob/main/commerce/spec/rules.md)
|
|
35
35
|
with its target, check, message and remediation. Every report carries the
|
|
36
36
|
`catalogue_version` it was produced with.
|
|
@@ -155,6 +155,26 @@ Changed in 0.11.0 (catalogue 0.15.0, unchanged):
|
|
|
155
155
|
it now fails Layer 1 against the schema it names.
|
|
156
156
|
- New exports: `CURRENT_RELEASE`, `schemaUrlFor`, `BUNDLED_SCHEMA_IDS`.
|
|
157
157
|
|
|
158
|
+
Added in 0.12.0 (catalogue 0.16.0), with commerce release 0.4.0. Requires
|
|
159
|
+
`@pagefront/lint-core` 0.3.0.
|
|
160
|
+
|
|
161
|
+
- **A sheet is judged by the release it declares.** Layer 1 validates it
|
|
162
|
+
against the schema its `release` bundles for its type (release 0.4.0:
|
|
163
|
+
`product/v0.10.0.json`, `organization/v0.4.0.json`, which require
|
|
164
|
+
`$schema`; release 0.3.0: the 0.3.0 schemas). Legacy sheets keep
|
|
165
|
+
resolving through `$schema`.
|
|
166
|
+
- **Rules are gated by release.** Every rule has an `appliesFrom` release
|
|
167
|
+
and the engine skips it on a sheet declaring a lower one. All earlier
|
|
168
|
+
rules apply from 0.3.0 and to legacy sheets.
|
|
169
|
+
- `PDP-E-002` and `ORG-E-003` compare a present `$schema` with the URL of
|
|
170
|
+
the schema the release bundles, and are quiet when `$schema` is absent.
|
|
171
|
+
- `PDP-E-017` (applies from release 0.4.0) — an exclusion, or an
|
|
172
|
+
adjustment's `when`, names a dimension the configurator does not declare
|
|
173
|
+
or an option the dimension does not list. Values are compared strictly:
|
|
174
|
+
`1` is not `"1"`.
|
|
175
|
+
- `PDP-E-018` and `ORG-E-004` — the sheet declares a `release` the release
|
|
176
|
+
manifest does not list. At Layer 1 this is a single error at `/release`.
|
|
177
|
+
|
|
158
178
|
## API
|
|
159
179
|
|
|
160
180
|
The public surface — everything importable from the package root, and
|
|
@@ -163,16 +183,16 @@ internal):
|
|
|
163
183
|
|
|
164
184
|
- `validateAndLint(input: unknown, options?: LintOptions)` — the CLI's
|
|
165
185
|
own pipeline as a function: Layer 1 against the published schema the
|
|
166
|
-
document's
|
|
167
|
-
catalogue (see `detectSheetType`)
|
|
186
|
+
document's declared release bundles for its page type, then Layer 2
|
|
187
|
+
against that page type's catalogue (see `detectSheetType`), with the
|
|
188
|
+
rules that apply from that release. Returns
|
|
168
189
|
`{ layer: 1, schemaErrors: SchemaError[] }` or
|
|
169
190
|
`{ layer: 2, report: Report }`. The package bundles every published
|
|
170
|
-
schema, on both lines
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
(
|
|
174
|
-
|
|
175
|
-
its `release` or `format_version` leads to.
|
|
191
|
+
schema, on both lines. A `release` the manifest does not list fails
|
|
192
|
+
Layer 1 with a single error at `/release` (keyword `release`). A
|
|
193
|
+
`$schema` that disagrees with the release is a Layer 2 finding. Legacy
|
|
194
|
+
sheets (`format_version`) are validated against the schema their
|
|
195
|
+
`$schema` names, or the legacy schema when it is absent.
|
|
176
196
|
Layer 1 runs validators compiled ahead of time at
|
|
177
197
|
package build, so the pipeline needs no runtime code generation and
|
|
178
198
|
runs under Cloudflare Workers and strict Content Security Policies.
|
package/dist/catalogue.js
CHANGED
|
@@ -15,6 +15,8 @@ import { pdpE013 } from "./rules/pdp-e-013.js";
|
|
|
15
15
|
import { pdpE014 } from "./rules/pdp-e-014.js";
|
|
16
16
|
import { pdpE015 } from "./rules/pdp-e-015.js";
|
|
17
17
|
import { pdpE016 } from "./rules/pdp-e-016.js";
|
|
18
|
+
import { pdpE017 } from "./rules/pdp-e-017.js";
|
|
19
|
+
import { pdpE018 } from "./rules/pdp-e-018.js";
|
|
18
20
|
import { pdpW001 } from "./rules/pdp-w-001.js";
|
|
19
21
|
import { pdpW002 } from "./rules/pdp-w-002.js";
|
|
20
22
|
import { pdpW003 } from "./rules/pdp-w-003.js";
|
|
@@ -65,6 +67,6 @@ import { pdpI001 } from "./rules/pdp-i-001.js";
|
|
|
65
67
|
export const commerceCatalogue = {
|
|
66
68
|
vertical: "commerce",
|
|
67
69
|
releases: KNOWN_RELEASES,
|
|
68
|
-
catalogueVersion: "0.
|
|
69
|
-
rules: [pdpE001, pdpE002, pdpE003, pdpE004, pdpE005, pdpE006, pdpE007, pdpE008, pdpE009, pdpE010, pdpE011, pdpE012, pdpE013, pdpE014, pdpE015, pdpE016, pdpW001, pdpW002, pdpW003, pdpW004, pdpW005, pdpW006, pdpW007, pdpW008, pdpW009, pdpW010, pdpW011, pdpW012, pdpW013, pdpW014, pdpW015, pdpW016, pdpW017, pdpW018, pdpW019, pdpW020, pdpW021, pdpW022, pdpW023, pdpW024, pdpW025, pdpW026, pdpW027, pdpW028, pdpW029, pdpW030, pdpW031, pdpW032, pdpW033, pdpW034, pdpW035, pdpW036, pdpW037, pdpW038, pdpW039, pdpI001],
|
|
70
|
+
catalogueVersion: "0.16.0",
|
|
71
|
+
rules: [pdpE001, pdpE002, pdpE003, pdpE004, pdpE005, pdpE006, pdpE007, pdpE008, pdpE009, pdpE010, pdpE011, pdpE012, pdpE013, pdpE014, pdpE015, pdpE016, pdpE017, pdpE018, pdpW001, pdpW002, pdpW003, pdpW004, pdpW005, pdpW006, pdpW007, pdpW008, pdpW009, pdpW010, pdpW011, pdpW012, pdpW013, pdpW014, pdpW015, pdpW016, pdpW017, pdpW018, pdpW019, pdpW020, pdpW021, pdpW022, pdpW023, pdpW024, pdpW025, pdpW026, pdpW027, pdpW028, pdpW029, pdpW030, pdpW031, pdpW032, pdpW033, pdpW034, pdpW035, pdpW036, pdpW037, pdpW038, pdpW039, pdpI001],
|
|
70
72
|
};
|
|
@@ -10,6 +10,14 @@ export declare const RELEASE_MANIFEST: {
|
|
|
10
10
|
readonly product: "0.9.0";
|
|
11
11
|
readonly organization: "0.3.0";
|
|
12
12
|
};
|
|
13
|
+
}, {
|
|
14
|
+
readonly release: "0.4.0";
|
|
15
|
+
readonly date: "2026-10-02";
|
|
16
|
+
readonly vocabulary: "0.4.0";
|
|
17
|
+
readonly sheets: {
|
|
18
|
+
readonly product: "0.10.0";
|
|
19
|
+
readonly organization: "0.4.0";
|
|
20
|
+
};
|
|
13
21
|
}];
|
|
14
22
|
readonly legacy: {
|
|
15
23
|
readonly envelope_field: "format_version";
|
|
@@ -12,6 +12,15 @@ export const RELEASE_MANIFEST = {
|
|
|
12
12
|
"product": "0.9.0",
|
|
13
13
|
"organization": "0.3.0"
|
|
14
14
|
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"release": "0.4.0",
|
|
18
|
+
"date": "2026-10-02",
|
|
19
|
+
"vocabulary": "0.4.0",
|
|
20
|
+
"sheets": {
|
|
21
|
+
"product": "0.10.0",
|
|
22
|
+
"organization": "0.4.0"
|
|
23
|
+
}
|
|
15
24
|
}
|
|
16
25
|
],
|
|
17
26
|
"legacy": {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// Generated by scripts/bundle-schemas.mjs; do not edit, do not commit.
|
|
2
2
|
export const SCHEMA_IDS = [
|
|
3
3
|
"https://themachineweb.org/pagefront/spec/commerce/organization/v0.3.0.json",
|
|
4
|
+
"https://themachineweb.org/pagefront/spec/commerce/organization/v0.4.0.json",
|
|
4
5
|
"https://themachineweb.org/pagefront/spec/commerce/organization/v0.9.json",
|
|
6
|
+
"https://themachineweb.org/pagefront/spec/commerce/product/v0.10.0.json",
|
|
5
7
|
"https://themachineweb.org/pagefront/spec/commerce/product/v0.9.0.json",
|
|
6
8
|
"https://themachineweb.org/pagefront/spec/commerce/product/v0.9.json"
|
|
7
9
|
];
|