@pagefront/lint-commerce 0.10.0 → 0.11.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 CHANGED
@@ -143,23 +143,36 @@ that replaces format versions:
143
143
  - New exports: `detectSheetLine`, `RELEASE_MANIFEST`, `KNOWN_RELEASES`,
144
144
  `sheetSpecVersionFor`.
145
145
 
146
+ Changed in 0.11.0 (catalogue 0.15.0, unchanged):
147
+
148
+ - Layer 1 validates a sheet against the published schema its `$schema`
149
+ names. The package bundles every file in the repository's frozen schema
150
+ store (`commerce/schemas/`) at build time, with the release manifest;
151
+ nothing is embedded by hand.
152
+ - A `$schema` naming no bundled schema fails Layer 1 with one error. In
153
+ 0.10.0 the schema was chosen from the envelope field, so a release
154
+ sheet pointing at another version passed Layer 1 and fired `PDP-E-002`;
155
+ it now fails Layer 1 against the schema it names.
156
+ - New exports: `CURRENT_RELEASE`, `schemaUrlFor`, `BUNDLED_SCHEMA_IDS`.
157
+
146
158
  ## API
147
159
 
148
160
  The public surface — everything importable from the package root, and
149
- nothing else (the bundled schema and the individual rule modules are
161
+ nothing else (the bundled schemas and the individual rule modules are
150
162
  internal):
151
163
 
152
164
  - `validateAndLint(input: unknown, options?: LintOptions)` — the CLI's
153
- own pipeline as a function: Layer 1 against the bundled schema for
154
- the document's page type, then Layer 2 against that page type's
155
- catalogue. Product sheets route to the product schema and catalogue,
156
- Commerce Organization Sheets to the organization ones (see
157
- `detectSheetType`). Returns
165
+ own pipeline as a function: Layer 1 against the published schema the
166
+ document's `$schema` names, then Layer 2 against its page type's
167
+ catalogue (see `detectSheetType`). Returns
158
168
  `{ layer: 1, schemaErrors: SchemaError[] }` or
159
- `{ layer: 2, report: Report }`. Two lines are validated: a sheet
160
- carrying `release` against the current sheet-spec schema for its type,
161
- and a legacy sheet carrying `format_version` against the frozen legacy
162
- schema (format 0.9). A sheet carrying both fields fails Layer 1.
169
+ `{ layer: 2, report: Report }`. The package bundles every published
170
+ schema, on both lines: the sheet-spec versions of each release and the
171
+ legacy format 0.9 schemas. A `$schema` naming a version the package
172
+ does not bundle fails Layer 1 with a single error at `/$schema`
173
+ (keyword `$schema`); the document is not validated against another
174
+ version. A document with no `$schema` is validated against the schema
175
+ its `release` or `format_version` leads to.
163
176
  Layer 1 runs validators compiled ahead of time at
164
177
  package build, so the pipeline needs no runtime code generation and
165
178
  runs under Cloudflare Workers and strict Content Security Policies.
@@ -167,7 +180,7 @@ internal):
167
180
  only, for input you have already schema-validated. Dispatches to the
168
181
  page type's catalogue the same way.
169
182
  - `validateOrganizationSheet(input: unknown)` — Layer 1 only, against
170
- the bundled Commerce Organization Sheet schema. Returns
183
+ the Commerce Organization Sheet schema the document names. Returns
171
184
  `{ valid: true }` or `{ valid: false, schemaErrors: SchemaError[] }`.
172
185
  - `detectSheetType(sheet: Sheet): SheetType` — the page-type dispatch:
173
186
  `"organization"` when the envelope `$schema` path contains
@@ -0,0 +1,22 @@
1
+ export declare const RELEASE_MANIFEST: {
2
+ readonly $comment: "The commerce release manifest: each release and the member versions it bundles. Consumed by the linter; the human-readable form is releases.md.";
3
+ readonly vertical: "commerce";
4
+ readonly schema_url_template: "https://themachineweb.org/pagefront/spec/commerce/{sheet}/v{version}.json";
5
+ readonly releases: readonly [{
6
+ readonly release: "0.3.0";
7
+ readonly date: "2026-10-01";
8
+ readonly vocabulary: "0.3.0";
9
+ readonly sheets: {
10
+ readonly product: "0.9.0";
11
+ readonly organization: "0.3.0";
12
+ };
13
+ }];
14
+ readonly legacy: {
15
+ readonly envelope_field: "format_version";
16
+ readonly format_versions: readonly ["0.9"];
17
+ readonly schemas: {
18
+ readonly product: "https://themachineweb.org/pagefront/spec/commerce/product/v0.9.json";
19
+ readonly organization: "https://themachineweb.org/pagefront/spec/commerce/organization/v0.9.json";
20
+ };
21
+ };
22
+ };
@@ -0,0 +1,27 @@
1
+ // Generated by scripts/bundle-schemas.mjs; do not edit, do not commit.
2
+ export const RELEASE_MANIFEST = {
3
+ "$comment": "The commerce release manifest: each release and the member versions it bundles. Consumed by the linter; the human-readable form is releases.md.",
4
+ "vertical": "commerce",
5
+ "schema_url_template": "https://themachineweb.org/pagefront/spec/commerce/{sheet}/v{version}.json",
6
+ "releases": [
7
+ {
8
+ "release": "0.3.0",
9
+ "date": "2026-10-01",
10
+ "vocabulary": "0.3.0",
11
+ "sheets": {
12
+ "product": "0.9.0",
13
+ "organization": "0.3.0"
14
+ }
15
+ }
16
+ ],
17
+ "legacy": {
18
+ "envelope_field": "format_version",
19
+ "format_versions": [
20
+ "0.9"
21
+ ],
22
+ "schemas": {
23
+ "product": "https://themachineweb.org/pagefront/spec/commerce/product/v0.9.json",
24
+ "organization": "https://themachineweb.org/pagefront/spec/commerce/organization/v0.9.json"
25
+ }
26
+ }
27
+ };
@@ -0,0 +1 @@
1
+ export declare const SCHEMA_IDS: readonly string[];
@@ -0,0 +1,7 @@
1
+ // Generated by scripts/bundle-schemas.mjs; do not edit, do not commit.
2
+ export const SCHEMA_IDS = [
3
+ "https://themachineweb.org/pagefront/spec/commerce/organization/v0.3.0.json",
4
+ "https://themachineweb.org/pagefront/spec/commerce/organization/v0.9.json",
5
+ "https://themachineweb.org/pagefront/spec/commerce/product/v0.9.0.json",
6
+ "https://themachineweb.org/pagefront/spec/commerce/product/v0.9.json"
7
+ ];
@@ -0,0 +1 @@
1
+ export declare const DATA_BLOCK_PROPERTIES: readonly string[];
@@ -1,12 +1,4 @@
1
- /**
2
- * The data-block property inventory for PDP-I-001, derived from the
3
- * Pagefront JSON Schema (commerce/spec/product.json, format 0.9) —
4
- * the normative property inventory per the catalogue's Definitions
5
- * section. Generated from `$defs.dataBlock.properties`; the
6
- * inventory drift test (test/inventory.test.mjs) fails when the
7
- * schema and this list diverge. Regenerate on schema change, in the
8
- * same catalogue-versioned change.
9
- */
1
+ // Generated by scripts/bundle-schemas.mjs; do not edit, do not commit.
10
2
  export const DATA_BLOCK_PROPERTIES = [
11
3
  "@context",
12
4
  "@id",
@@ -64,5 +56,5 @@ export const DATA_BLOCK_PROPERTIES = [
64
56
  "variesBy",
65
57
  "video",
66
58
  "weight",
67
- "width",
59
+ "width"
68
60
  ];
@@ -0,0 +1 @@
1
+ export declare const SCHEMAS: Readonly<Record<string, Record<string, unknown>>>;