@eldrajs/vite-plugin-theme 0.3.2 → 0.3.4
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/index.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import { A as TemplateSeedLayout, C as ManifestTemplateRoles, D as ScanOptions, E as PageSeedTarget, F as ThemeMessages, M as TemplateSeedReusableNode, N as TemplateSeedSchemaApiId, O as ScanResult, P as ThemeManifest, S as ManifestRoute, T as ManifestTemplateSeedBlock, _ as ManifestFormSeedFieldType, a as DeclaredPageSeed, b as ManifestPageSeedEntry, c as DeclaredPageSeedRegion, d as DeclaredTemplateSeedBlock, f as DeclaredThemeCodePage, g as ManifestFormSeedField, h as ManifestFormSeed, i as DeclaredFormSeed, j as TemplateSeedLayoutNode, k as TemplateSeedBlockNode, l as DeclaredSeed, m as LegacyThemeTokens, n as BlockField, o as DeclaredPageSeedBlock, p as EldraThemeOptions, r as BlockMigration, s as DeclaredPageSeedEntry, t as BlockDefinition, u as DeclaredTemplateSeed, v as ManifestPageSeed, w as ManifestTemplateSeed, x as ManifestPageSeedRegion, y as ManifestPageSeedBlock } from "./types-
|
|
1
|
+
import { A as TemplateSeedLayout, C as ManifestTemplateRoles, D as ScanOptions, E as PageSeedTarget, F as ThemeMessages, M as TemplateSeedReusableNode, N as TemplateSeedSchemaApiId, O as ScanResult, P as ThemeManifest, S as ManifestRoute, T as ManifestTemplateSeedBlock, _ as ManifestFormSeedFieldType, a as DeclaredPageSeed, b as ManifestPageSeedEntry, c as DeclaredPageSeedRegion, d as DeclaredTemplateSeedBlock, f as DeclaredThemeCodePage, g as ManifestFormSeedField, h as ManifestFormSeed, i as DeclaredFormSeed, j as TemplateSeedLayoutNode, k as TemplateSeedBlockNode, l as DeclaredSeed, m as LegacyThemeTokens, n as BlockField, o as DeclaredPageSeedBlock, p as EldraThemeOptions, r as BlockMigration, s as DeclaredPageSeedEntry, t as BlockDefinition, u as DeclaredTemplateSeed, v as ManifestPageSeed, w as ManifestTemplateSeed, x as ManifestPageSeedRegion, y as ManifestPageSeedBlock } from "./types-Zt7J0J6v.js";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
|
-
//#region src/plugin.d.ts
|
|
4
3
|
export default function eldraTheme(options?: EldraThemeOptions): Plugin;
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/blockTypes.d.ts
|
|
7
4
|
export declare function generateBlockTypes(blocks: BlockDefinition[], messages?: ThemeMessages): string;
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/formSeeds.d.ts
|
|
10
5
|
/**
|
|
11
6
|
* Validates the declared `formSeeds`: the forms a site is created with, ingested by Core's
|
|
12
7
|
* `site_forms` seeding. It rejects an unknown key outright and enforces the wire contract
|
|
@@ -18,8 +13,6 @@ export declare function generateBlockTypes(blocks: BlockDefinition[], messages?:
|
|
|
18
13
|
* Absent (`undefined`) and empty both mean "this theme seeds no forms".
|
|
19
14
|
*/
|
|
20
15
|
export declare function validateFormSeeds(seeds: ReadonlyArray<DeclaredFormSeed> | undefined, errors: string[]): ManifestFormSeed[];
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/templates.d.ts
|
|
23
16
|
/**
|
|
24
17
|
* The layout a seed gets when it declares none: one column of its blocks in
|
|
25
18
|
* order, framed by the header and footer roles unless the seed opts out. The
|
|
@@ -83,5 +76,4 @@ export declare function validatePageSeeds(seeds: ReadonlyArray<DeclaredSeed>, bl
|
|
|
83
76
|
* it, so Core is never handed a template it cannot seed a site with.
|
|
84
77
|
*/
|
|
85
78
|
export declare function validateTemplateRoles(roles: ManifestTemplateRoles | undefined, blocks: ReadonlyArray<Record<string, unknown>>, templates: ReadonlyArray<ManifestTemplateSeed>, errors: string[]): ManifestTemplateRoles | undefined;
|
|
86
|
-
//#endregion
|
|
87
79
|
export type { BlockDefinition, BlockField, BlockMigration, DeclaredFormSeed, DeclaredPageSeed, DeclaredPageSeedBlock, DeclaredPageSeedEntry, DeclaredPageSeedRegion, DeclaredSeed, DeclaredTemplateSeed, DeclaredTemplateSeedBlock, DeclaredThemeCodePage, EldraThemeOptions, LegacyThemeTokens, ManifestFormSeed, ManifestFormSeedField, ManifestFormSeedFieldType, ManifestPageSeed, ManifestPageSeedBlock, ManifestPageSeedEntry, ManifestPageSeedRegion, ManifestRoute, ManifestTemplateRoles, ManifestTemplateSeed, ManifestTemplateSeedBlock, PageSeedTarget, ScanOptions, ScanResult, TemplateSeedBlockNode, TemplateSeedLayout, TemplateSeedLayoutNode, TemplateSeedReusableNode, TemplateSeedSchemaApiId, ThemeManifest, ThemeMessages };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as validateTemplateRoles, i as validatePageSeeds, n as scanTheme, o as validateTemplateSeeds, r as seedLayout, s as validateFormSeeds, t as readPreviousManifest } from "./scan-
|
|
1
|
+
import { a as validateTemplateRoles, i as validatePageSeeds, n as scanTheme, o as validateTemplateSeeds, r as seedLayout, s as validateFormSeeds, t as readPreviousManifest } from "./scan-ClxSvaDL.js";
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join, relative } from "node:path";
|
|
4
4
|
import { generateDesignTokenCss, generateTailwindThemeCss, normalizeThemeDesignTokens } from "@eldrajs/theme-core/design-tokens";
|
|
5
5
|
import { DEFAULT_LAYOUT_BREAKPOINTS } from "@eldrajs/theme-core/layout";
|
|
6
|
-
|
|
6
|
+
// src/blockTypes.ts
|
|
7
7
|
/**
|
|
8
8
|
* Generates `.eldra/block-types.d.ts`: a global ambient contract for every
|
|
9
9
|
* block declared under `blocks/*.block.json` — `interface EldraBlockData`
|
|
@@ -206,8 +206,7 @@ function isBlockFieldLike(value) {
|
|
|
206
206
|
function isRecord(value) {
|
|
207
207
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
208
208
|
}
|
|
209
|
-
|
|
210
|
-
//#region src/plugin.ts
|
|
209
|
+
// src/plugin.ts
|
|
211
210
|
const MANIFEST_ID = "virtual:eldra/manifest";
|
|
212
211
|
const BLOCKS_ID = "virtual:eldra/blocks";
|
|
213
212
|
const BLOCK_FIELDS_ID = "virtual:eldra/block-fields";
|
|
@@ -449,5 +448,4 @@ function findJsonStringEnd(text, start) {
|
|
|
449
448
|
while (text[i] !== "\"") i += text[i] === "\\" ? 2 : 1;
|
|
450
449
|
return i;
|
|
451
450
|
}
|
|
452
|
-
//#endregion
|
|
453
451
|
export { eldraTheme as default, generateBlockTypes, seedLayout, validateFormSeeds, validatePageSeeds, validateTemplateRoles, validateTemplateSeeds };
|
|
@@ -6,7 +6,7 @@ import { resolveLayoutBreakpoints } from "@eldrajs/theme-core/layout";
|
|
|
6
6
|
import Ajv from "ajv";
|
|
7
7
|
import { RESERVED_THEME_IDS, RICH_TEXT_TOOLBAR_CONTROLS, THEME_ID_PATTERN, parseDynamicRoutePattern } from "@eldrajs/theme-core";
|
|
8
8
|
import { safeLinkHref } from "@eldrajs/theme-core/links";
|
|
9
|
-
|
|
9
|
+
// src/blockSchema.ts
|
|
10
10
|
const API_ID_PATTERN = "^[a-z][a-z0-9-]{1,48}$";
|
|
11
11
|
const FIELD_ID_PATTERN$1 = "^[a-z][a-zA-Z0-9]{0,48}$";
|
|
12
12
|
const blockJsonSchema = {
|
|
@@ -277,8 +277,7 @@ const blockJsonSchema = {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
};
|
|
280
|
-
|
|
281
|
-
//#region src/migrations.ts
|
|
280
|
+
// src/migrations.ts
|
|
282
281
|
const STORED_FIELD_TYPES = /* @__PURE__ */ new Set([
|
|
283
282
|
"bool",
|
|
284
283
|
"color",
|
|
@@ -611,8 +610,7 @@ function storedObject(value, keys) {
|
|
|
611
610
|
function isRecord$1(value) {
|
|
612
611
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
613
612
|
}
|
|
614
|
-
|
|
615
|
-
//#region src/util.ts
|
|
613
|
+
// src/util.ts
|
|
616
614
|
/** Helpers shared by the scanner and the validators it calls. Kept in their own
|
|
617
615
|
* module so nothing has to import back out of `scan.ts`, which would make the
|
|
618
616
|
* graph circular. */
|
|
@@ -629,8 +627,7 @@ function stripPlainTextControls(value) {
|
|
|
629
627
|
function codePointLength(value) {
|
|
630
628
|
return Array.from(value).length;
|
|
631
629
|
}
|
|
632
|
-
|
|
633
|
-
//#region src/seedData.ts
|
|
630
|
+
// src/seedData.ts
|
|
634
631
|
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
635
632
|
const MEDIA_VALUE_KEYS = /* @__PURE__ */ new Set(["assetId", "framing"]);
|
|
636
633
|
/** The two shapes a seed may name a referenced object by: one that already
|
|
@@ -830,8 +827,7 @@ function validLinkTarget(target, kind) {
|
|
|
830
827
|
if (keys.every((key) => REFERENCE_ID_KEYS.has(key)) && typeof target.id === "string" && UUID_PATTERN.test(target.id)) return true;
|
|
831
828
|
return keys.every((key) => LINK_SLUG_KEYS.has(key)) && LINK_SLUG_TYPES.has(kind) && typeof target.slug === "string" && target.slug.trim() !== "";
|
|
832
829
|
}
|
|
833
|
-
|
|
834
|
-
//#region src/formSeeds.ts
|
|
830
|
+
// src/formSeeds.ts
|
|
835
831
|
const MAX_FORM_SEEDS = 8;
|
|
836
832
|
const MAX_FIELDS = 30;
|
|
837
833
|
const MAX_OPTIONS = 50;
|
|
@@ -1156,8 +1152,7 @@ function validateSuccess(at, value, errors) {
|
|
|
1156
1152
|
}
|
|
1157
1153
|
return success;
|
|
1158
1154
|
}
|
|
1159
|
-
|
|
1160
|
-
//#region src/templates.ts
|
|
1155
|
+
// src/templates.ts
|
|
1161
1156
|
const MAX_TEMPLATES = 8;
|
|
1162
1157
|
const MAX_PAGE_SEEDS = 16;
|
|
1163
1158
|
const MAX_TEMPLATE_BLOCKS = 50;
|
|
@@ -1736,8 +1731,7 @@ function validateTemplateRoles(roles, blocks, templates, errors) {
|
|
|
1736
1731
|
}
|
|
1737
1732
|
return normalized.header === void 0 && normalized.footer === void 0 ? void 0 : normalized;
|
|
1738
1733
|
}
|
|
1739
|
-
|
|
1740
|
-
//#region src/scan.ts
|
|
1734
|
+
// src/scan.ts
|
|
1741
1735
|
const MAX_BLOCKS = 100;
|
|
1742
1736
|
const MAX_MOCK_BYTES = 65536;
|
|
1743
1737
|
const MAX_MANIFEST_BYTES = 2097152;
|
|
@@ -2508,5 +2502,4 @@ function readPreviousManifest(themeDir, errors) {
|
|
|
2508
2502
|
const parsed = readJsonObject(path, themeDir, errors);
|
|
2509
2503
|
return parsed === null ? void 0 : parsed;
|
|
2510
2504
|
}
|
|
2511
|
-
//#endregion
|
|
2512
2505
|
export { validateTemplateRoles as a, validatePageSeeds as i, scanTheme as n, validateTemplateSeeds as o, seedLayout as r, validateFormSeeds as s, readPreviousManifest as t };
|
package/dist/scan.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { D as ScanOptions, O as ScanResult, P as ThemeManifest, S as ManifestRoute, u as DeclaredTemplateSeed, w as ManifestTemplateSeed } from "./types-
|
|
2
|
-
//#region src/scan.d.ts
|
|
1
|
+
import { D as ScanOptions, O as ScanResult, P as ThemeManifest, S as ManifestRoute, u as DeclaredTemplateSeed, w as ManifestTemplateSeed } from "./types-Zt7J0J6v.js";
|
|
3
2
|
export declare function scanTheme(opts: ScanOptions): ScanResult;
|
|
4
3
|
export declare function readPreviousManifest(themeDir: string, errors: string[]): ThemeManifest | undefined;
|
|
5
|
-
//#endregion
|
|
6
4
|
export type { DeclaredTemplateSeed, ManifestRoute, ManifestTemplateSeed, ScanOptions, ScanResult, ThemeManifest };
|
package/dist/scan.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { readPreviousManifest, scanTheme };
|
|
1
|
+
export { t as readPreviousManifest, n as scanTheme } from "./scan-ClxSvaDL.js";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ThemeDesignTokens } from "@eldrajs/theme-core/design-tokens";
|
|
2
2
|
import { LayoutBreakpoints } from "@eldrajs/theme-core/layout";
|
|
3
|
-
//#region src/types.d.ts
|
|
4
3
|
interface ManifestRoute {
|
|
5
4
|
pattern: string;
|
|
6
5
|
kind: 'page' | 'entry';
|
|
@@ -495,5 +494,4 @@ interface EldraThemeOptions {
|
|
|
495
494
|
*/
|
|
496
495
|
resolveTokens?: (manifestTokens: ThemeDesignTokens | LegacyThemeTokens) => ThemeDesignTokens;
|
|
497
496
|
}
|
|
498
|
-
//#endregion
|
|
499
497
|
export { TemplateSeedLayout as A, ManifestTemplateRoles as C, ScanOptions as D, PageSeedTarget as E, ThemeMessages as F, TemplateSeedReusableNode as M, TemplateSeedSchemaApiId as N, ScanResult as O, ThemeManifest as P, ManifestRoute as S, ManifestTemplateSeedBlock as T, ManifestFormSeedFieldType as _, DeclaredPageSeed as a, ManifestPageSeedEntry as b, DeclaredPageSeedRegion as c, DeclaredTemplateSeedBlock as d, DeclaredThemeCodePage as f, ManifestFormSeedField as g, ManifestFormSeed as h, DeclaredFormSeed as i, TemplateSeedLayoutNode as j, TemplateSeedBlockNode as k, DeclaredSeed as l, LegacyThemeTokens as m, BlockField as n, DeclaredPageSeedBlock as o, EldraThemeOptions as p, BlockMigration as r, DeclaredPageSeedEntry as s, BlockDefinition as t, DeclaredTemplateSeed as u, ManifestPageSeed as v, ManifestTemplateSeed as w, ManifestPageSeedRegion as x, ManifestPageSeedBlock as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eldrajs/vite-plugin-theme",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Vite plugin for Eldra themes: scans blocks/*/block.json, validates them, emits the theme manifest and the virtual modules the runtime reads (blocks, manifest, block fields, breakpoints, tokens CSS).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"ajv": "^8.17.1",
|
|
44
|
-
"@eldrajs/theme-core": "^0.3.
|
|
44
|
+
"@eldrajs/theme-core": "^0.3.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@tailwindcss/vite": "^4.1.14",
|