@caelo-cms/shared 0.2.2
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/ai-tools.d.ts +571 -0
- package/dist/ai-tools.d.ts.map +1 -0
- package/dist/ai-tools.js +696 -0
- package/dist/ai-tools.js.map +1 -0
- package/dist/auth-forms.d.ts +24 -0
- package/dist/auth-forms.d.ts.map +1 -0
- package/dist/auth-forms.js +27 -0
- package/dist/auth-forms.js.map +1 -0
- package/dist/cap-failures.d.ts +17 -0
- package/dist/cap-failures.d.ts.map +1 -0
- package/dist/cap-failures.js +58 -0
- package/dist/cap-failures.js.map +1 -0
- package/dist/content.d.ts +111 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/content.js +137 -0
- package/dist/content.js.map +1 -0
- package/dist/context.d.ts +40 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +3 -0
- package/dist/context.js.map +1 -0
- package/dist/i18n.d.ts +49 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +154 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +56 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +84 -0
- package/dist/logger.js.map +1 -0
- package/dist/media.d.ts +143 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +168 -0
- package/dist/media.js.map +1 -0
- package/dist/preview-compose.d.ts +84 -0
- package/dist/preview-compose.d.ts.map +1 -0
- package/dist/preview-compose.js +385 -0
- package/dist/preview-compose.js.map +1 -0
- package/dist/preview-scanner.d.ts +44 -0
- package/dist/preview-scanner.d.ts.map +1 -0
- package/dist/preview-scanner.js +177 -0
- package/dist/preview-scanner.js.map +1 -0
- package/dist/result.d.ts +21 -0
- package/dist/result.d.ts.map +1 -0
- package/dist/result.js +14 -0
- package/dist/result.js.map +1 -0
- package/dist/seo.d.ts +128 -0
- package/dist/seo.d.ts.map +1 -0
- package/dist/seo.js +176 -0
- package/dist/seo.js.map +1 -0
- package/dist/skills.d.ts +88 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +127 -0
- package/dist/skills.js.map +1 -0
- package/dist/snapshots.d.ts +54 -0
- package/dist/snapshots.d.ts.map +1 -0
- package/dist/snapshots.js +59 -0
- package/dist/snapshots.js.map +1 -0
- package/dist/structured-sets.d.ts +116 -0
- package/dist/structured-sets.d.ts.map +1 -0
- package/dist/structured-sets.js +154 -0
- package/dist/structured-sets.js.map +1 -0
- package/dist/subagents.d.ts +123 -0
- package/dist/subagents.d.ts.map +1 -0
- package/dist/subagents.js +202 -0
- package/dist/subagents.js.map +1 -0
- package/dist/translation.d.ts +127 -0
- package/dist/translation.d.ts.map +1 -0
- package/dist/translation.js +208 -0
- package/dist/translation.js.map +1 -0
- package/dist/version.d.ts +46 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +46 -0
- package/dist/version.js.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/**
|
|
3
|
+
* P10 — translation primitives shared between the AI prompt builder,
|
|
4
|
+
* the Mode 1 / Mode 2 op handlers, and the dashboard.
|
|
5
|
+
*
|
|
6
|
+
* computeBlockDiff(source, variant) — block-level diff per
|
|
7
|
+
* CMS_REQUIREMENTS §7.6: matches modules by (block_name, position),
|
|
8
|
+
* returns typed `changed` / `added` / `removed` operations. Pure
|
|
9
|
+
* function; the AI receives this as Mode 2 prompt context.
|
|
10
|
+
*
|
|
11
|
+
* buildModeOnePrompt(...) / buildModeTwoPrompt(...) — assemble the
|
|
12
|
+
* §7.6 sample-payload shapes with glossary + style guide injected.
|
|
13
|
+
* Returns the prompt + a structured payload for unit-tests to
|
|
14
|
+
* assert against.
|
|
15
|
+
*/
|
|
16
|
+
import { z } from "zod";
|
|
17
|
+
/**
|
|
18
|
+
* Diff a source page's modules against a variant's modules. Match by
|
|
19
|
+
* (blockName, position) — the §7.5 contract is that translations
|
|
20
|
+
* share STRUCTURE with the source (block + position alignment) and
|
|
21
|
+
* differ only in CONTENT (html / alt / caption per locale). Anything
|
|
22
|
+
* mis-aligned is `added` (source has it, variant doesn't) or
|
|
23
|
+
* `removed` (variant has it, source doesn't).
|
|
24
|
+
*
|
|
25
|
+
* `changed` rows contain BOTH before + after so the AI prompt can
|
|
26
|
+
* show the structured diff per the §7.6 sample payload.
|
|
27
|
+
*/
|
|
28
|
+
export function computeBlockDiff(source, variant) {
|
|
29
|
+
const ops = [];
|
|
30
|
+
const variantBy = new Map();
|
|
31
|
+
for (const v of variant)
|
|
32
|
+
variantBy.set(`${v.blockName}|${v.position}`, v);
|
|
33
|
+
const sourceBy = new Map();
|
|
34
|
+
for (const s of source)
|
|
35
|
+
sourceBy.set(`${s.blockName}|${s.position}`, s);
|
|
36
|
+
for (const s of source) {
|
|
37
|
+
const key = `${s.blockName}|${s.position}`;
|
|
38
|
+
const v = variantBy.get(key);
|
|
39
|
+
if (!v) {
|
|
40
|
+
ops.push({ kind: "added", blockName: s.blockName, position: s.position, module: s });
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (s.html !== v.html || s.altText !== v.altText || s.caption !== v.caption) {
|
|
44
|
+
ops.push({
|
|
45
|
+
kind: "changed",
|
|
46
|
+
blockName: s.blockName,
|
|
47
|
+
position: s.position,
|
|
48
|
+
moduleId: v.moduleId,
|
|
49
|
+
before: v,
|
|
50
|
+
after: s,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
for (const v of variant) {
|
|
55
|
+
const key = `${v.blockName}|${v.position}`;
|
|
56
|
+
if (!sourceBy.has(key)) {
|
|
57
|
+
ops.push({ kind: "removed", blockName: v.blockName, position: v.position, module: v });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return ops;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The AI returns this shape for both Mode 1 and Mode 2: one entry per
|
|
64
|
+
* source module slot, with the translated content fields. The handler
|
|
65
|
+
* matches entries back to the variant page's module rows by
|
|
66
|
+
* (blockName, position).
|
|
67
|
+
*
|
|
68
|
+
* Mode 1 returns one entry per source module.
|
|
69
|
+
* Mode 2 returns entries ONLY for changed blocks (preserves prior
|
|
70
|
+
* translation on unchanged ones).
|
|
71
|
+
*/
|
|
72
|
+
export const translationResultModule = z
|
|
73
|
+
.object({
|
|
74
|
+
blockName: z.string().min(1),
|
|
75
|
+
position: z.number().int().min(0),
|
|
76
|
+
/** Translated module HTML body. */
|
|
77
|
+
html: z.string(),
|
|
78
|
+
altText: z.string().nullable().optional(),
|
|
79
|
+
caption: z.string().nullable().optional(),
|
|
80
|
+
})
|
|
81
|
+
.strict();
|
|
82
|
+
export const translationResultPayload = z
|
|
83
|
+
.object({
|
|
84
|
+
modules: z.array(translationResultModule),
|
|
85
|
+
})
|
|
86
|
+
.strict();
|
|
87
|
+
function renderGlossaryBlock(glossary) {
|
|
88
|
+
if (glossary.length === 0)
|
|
89
|
+
return "";
|
|
90
|
+
const lines = glossary.map((g) => g.context
|
|
91
|
+
? `- "${g.sourceTerm}" → "${g.translation}" (${g.context})`
|
|
92
|
+
: `- "${g.sourceTerm}" → "${g.translation}"`);
|
|
93
|
+
return ["", "## Glossary (use these exact translations)", ...lines].join("\n");
|
|
94
|
+
}
|
|
95
|
+
function renderStyleGuideBlock(styleGuide) {
|
|
96
|
+
if (!styleGuide || styleGuide.trim().length === 0)
|
|
97
|
+
return "";
|
|
98
|
+
return ["", "## Style guide", styleGuide.trim()].join("\n");
|
|
99
|
+
}
|
|
100
|
+
function renderSourceModulesBlock(modules) {
|
|
101
|
+
const rendered = modules.map((m) => {
|
|
102
|
+
const parts = [
|
|
103
|
+
`### Module ${m.moduleSlug} (block=${m.blockName}, position=${m.position})`,
|
|
104
|
+
"HTML:",
|
|
105
|
+
"```html",
|
|
106
|
+
m.html,
|
|
107
|
+
"```",
|
|
108
|
+
];
|
|
109
|
+
if (m.altText !== null)
|
|
110
|
+
parts.push(`alt: ${m.altText}`);
|
|
111
|
+
if (m.caption !== null)
|
|
112
|
+
parts.push(`caption: ${m.caption}`);
|
|
113
|
+
return parts.join("\n");
|
|
114
|
+
});
|
|
115
|
+
return rendered.join("\n\n");
|
|
116
|
+
}
|
|
117
|
+
export function buildModeOnePrompt(input) {
|
|
118
|
+
const targetLabel = input.targetLocaleDisplayName ?? input.targetLocale;
|
|
119
|
+
const system = [
|
|
120
|
+
"You are translating a web page from one locale to another.",
|
|
121
|
+
`Source locale: ${input.sourceLocale}.`,
|
|
122
|
+
`Target locale: ${input.targetLocale} (${targetLabel}).`,
|
|
123
|
+
"",
|
|
124
|
+
"STRUCTURAL LOCK — the page's module layout (block names + positions) is identical across locales. You may NOT add, remove, or reorder modules. Translate ONLY the content fields (html, alt, caption) of each existing module.",
|
|
125
|
+
"",
|
|
126
|
+
"Translate every module listed below into the target locale. Preserve every HTML tag, attribute, class, id, href, and inline style verbatim — only the human-readable text inside tags + the alt/caption fields are translated. Numbers, code samples, and untranslatable proper nouns stay as-is.",
|
|
127
|
+
"",
|
|
128
|
+
'Respond with a JSON object matching: {"modules": [{"blockName": str, "position": int, "html": str, "altText": str|null, "caption": str|null}, ...]}. Return ONE entry per source module — same blockName + position.',
|
|
129
|
+
renderGlossaryBlock(input.glossary),
|
|
130
|
+
renderStyleGuideBlock(input.styleGuide),
|
|
131
|
+
]
|
|
132
|
+
.filter((s) => s.length > 0)
|
|
133
|
+
.join("\n");
|
|
134
|
+
const user = [
|
|
135
|
+
`# Source page modules (${input.sourceLocale} → ${input.targetLocale})`,
|
|
136
|
+
"",
|
|
137
|
+
renderSourceModulesBlock(input.sourceModules),
|
|
138
|
+
].join("\n");
|
|
139
|
+
return { system, user };
|
|
140
|
+
}
|
|
141
|
+
export function buildModeTwoPrompt(input) {
|
|
142
|
+
const targetLabel = input.targetLocaleDisplayName ?? input.targetLocale;
|
|
143
|
+
const changed = input.diff.filter((d) => d.kind === "changed");
|
|
144
|
+
const added = input.diff.filter((d) => d.kind === "added");
|
|
145
|
+
const removed = input.diff.filter((d) => d.kind === "removed");
|
|
146
|
+
const system = [
|
|
147
|
+
"You are updating an existing translation of a web page after the source changed.",
|
|
148
|
+
`Source locale: ${input.sourceLocale}.`,
|
|
149
|
+
`Target locale: ${input.targetLocale} (${targetLabel}).`,
|
|
150
|
+
"",
|
|
151
|
+
"STRUCTURAL LOCK — the page's module layout (block names + positions) is identical across locales. You may NOT add, remove, or reorder modules. Translate ONLY the content fields (html, alt, caption) that have CHANGED on the source. Preserve the existing translation verbatim for unchanged modules.",
|
|
152
|
+
"",
|
|
153
|
+
"Numbers, code samples, and untranslatable proper nouns stay as-is. Preserve every HTML tag/attribute/class/id/href/inline style in the source verbatim.",
|
|
154
|
+
"",
|
|
155
|
+
'Respond with a JSON object matching: {"modules": [{"blockName": str, "position": int, "html": str, "altText": str|null, "caption": str|null}, ...]}. Return ONE entry per CHANGED module — do NOT include unchanged modules in the response.',
|
|
156
|
+
renderGlossaryBlock(input.glossary),
|
|
157
|
+
renderStyleGuideBlock(input.styleGuide),
|
|
158
|
+
]
|
|
159
|
+
.filter((s) => s.length > 0)
|
|
160
|
+
.join("\n");
|
|
161
|
+
const userLines = [
|
|
162
|
+
`# Update translation: ${input.sourceLocale} → ${input.targetLocale}`,
|
|
163
|
+
"",
|
|
164
|
+
"## Current source (full, for context)",
|
|
165
|
+
"",
|
|
166
|
+
renderSourceModulesBlock(input.sourceModules),
|
|
167
|
+
"",
|
|
168
|
+
"## Existing translation (preserve unchanged modules verbatim)",
|
|
169
|
+
"",
|
|
170
|
+
renderSourceModulesBlock(input.variantModules),
|
|
171
|
+
"",
|
|
172
|
+
"## Structured diff",
|
|
173
|
+
];
|
|
174
|
+
if (changed.length === 0 && added.length === 0 && removed.length === 0) {
|
|
175
|
+
userLines.push("(no changes detected — return an empty `modules` array)");
|
|
176
|
+
}
|
|
177
|
+
for (const c of changed) {
|
|
178
|
+
if (c.kind !== "changed")
|
|
179
|
+
continue;
|
|
180
|
+
userLines.push("");
|
|
181
|
+
userLines.push(`### CHANGED — block=${c.blockName} position=${c.position} module=${c.moduleId}`);
|
|
182
|
+
userLines.push("Before (existing translation):");
|
|
183
|
+
userLines.push("```html");
|
|
184
|
+
userLines.push(c.before.html);
|
|
185
|
+
userLines.push("```");
|
|
186
|
+
userLines.push("Source after (current source HTML to re-translate):");
|
|
187
|
+
userLines.push("```html");
|
|
188
|
+
userLines.push(c.after.html);
|
|
189
|
+
userLines.push("```");
|
|
190
|
+
}
|
|
191
|
+
for (const a of added) {
|
|
192
|
+
if (a.kind !== "added")
|
|
193
|
+
continue;
|
|
194
|
+
userLines.push("");
|
|
195
|
+
userLines.push(`### ADDED in source — block=${a.blockName} position=${a.position} (must translate)`);
|
|
196
|
+
userLines.push("```html");
|
|
197
|
+
userLines.push(a.module.html);
|
|
198
|
+
userLines.push("```");
|
|
199
|
+
}
|
|
200
|
+
for (const r of removed) {
|
|
201
|
+
if (r.kind !== "removed")
|
|
202
|
+
continue;
|
|
203
|
+
userLines.push("");
|
|
204
|
+
userLines.push(`### REMOVED from source — block=${r.blockName} position=${r.position} (drop from the translation)`);
|
|
205
|
+
}
|
|
206
|
+
return { system, user: userLines.join("\n") };
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=translation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation.js","sourceRoot":"","sources":["../src/translation.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+BxB;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAkC,EAClC,OAAmC;IAEnC,MAAM,GAAG,GAAkB,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAI,GAAG,EAA2B,CAAC;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AAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* P17.0 — single source of truth for the Caelo version.
|
|
3
|
+
*
|
|
4
|
+
* Bumped via `bun run scripts/release.ts <new-version>` which:
|
|
5
|
+
* 1. Updates this constant + the root package.json `version`,
|
|
6
|
+
* 2. Re-signs every Tier-1 plugin manifest under packages/plugins/,
|
|
7
|
+
* 3. Builds + writes the release notes via `scripts/release-notes.ts`,
|
|
8
|
+
* 4. Tags the commit as `vX.Y.Z`,
|
|
9
|
+
* 5. Pushes — GitHub Actions takes over for the publish step.
|
|
10
|
+
*
|
|
11
|
+
* Read by:
|
|
12
|
+
* - admin's /security index page (header badge + about-modal),
|
|
13
|
+
* - cms-provision CLI's `version` subcommand,
|
|
14
|
+
* - User-Agent header on plugin-host's outbound HTTP calls,
|
|
15
|
+
* - Tier-1 manifest signing (the version is hashed into the
|
|
16
|
+
* signature payload so a manifest from version 0.5.0 can't be
|
|
17
|
+
* replayed as a 0.6.0 manifest).
|
|
18
|
+
*
|
|
19
|
+
* Format: SemVer 2.0.0. Pre-1.0 minor bumps are breaking; post-1.0
|
|
20
|
+
* follow standard SemVer.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CAELO_VERSION = "0.2.2";
|
|
23
|
+
/**
|
|
24
|
+
* Deprecated alias for back-compat — early P17 work spelled this
|
|
25
|
+
* `CALEO_VERSION` (typo of "Caelo"). New code should import
|
|
26
|
+
* `CAELO_VERSION`. Kept as a re-export so existing callers keep
|
|
27
|
+
* compiling; remove once external consumers have migrated.
|
|
28
|
+
*
|
|
29
|
+
* @deprecated use CAELO_VERSION
|
|
30
|
+
*/
|
|
31
|
+
export declare const CALEO_VERSION = "0.2.2";
|
|
32
|
+
/**
|
|
33
|
+
* Parsed shape — major/minor/patch + optional pre-release tag.
|
|
34
|
+
* Stable interface for callers that need to feature-gate (rare —
|
|
35
|
+
* Caelo doesn't do feature flags, but version-gating a deprecation
|
|
36
|
+
* warning is a legitimate use).
|
|
37
|
+
*/
|
|
38
|
+
export interface CaeloVersion {
|
|
39
|
+
readonly major: number;
|
|
40
|
+
readonly minor: number;
|
|
41
|
+
readonly patch: number;
|
|
42
|
+
readonly preRelease: string | null;
|
|
43
|
+
readonly raw: string;
|
|
44
|
+
}
|
|
45
|
+
export declare function parseVersion(raw?: string): CaeloVersion;
|
|
46
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,aAAa,UAAU,CAAC;AAErC;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,UAAgB,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAsB,GAAG,YAAY,CAYtE"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/**
|
|
3
|
+
* P17.0 — single source of truth for the Caelo version.
|
|
4
|
+
*
|
|
5
|
+
* Bumped via `bun run scripts/release.ts <new-version>` which:
|
|
6
|
+
* 1. Updates this constant + the root package.json `version`,
|
|
7
|
+
* 2. Re-signs every Tier-1 plugin manifest under packages/plugins/,
|
|
8
|
+
* 3. Builds + writes the release notes via `scripts/release-notes.ts`,
|
|
9
|
+
* 4. Tags the commit as `vX.Y.Z`,
|
|
10
|
+
* 5. Pushes — GitHub Actions takes over for the publish step.
|
|
11
|
+
*
|
|
12
|
+
* Read by:
|
|
13
|
+
* - admin's /security index page (header badge + about-modal),
|
|
14
|
+
* - cms-provision CLI's `version` subcommand,
|
|
15
|
+
* - User-Agent header on plugin-host's outbound HTTP calls,
|
|
16
|
+
* - Tier-1 manifest signing (the version is hashed into the
|
|
17
|
+
* signature payload so a manifest from version 0.5.0 can't be
|
|
18
|
+
* replayed as a 0.6.0 manifest).
|
|
19
|
+
*
|
|
20
|
+
* Format: SemVer 2.0.0. Pre-1.0 minor bumps are breaking; post-1.0
|
|
21
|
+
* follow standard SemVer.
|
|
22
|
+
*/
|
|
23
|
+
export const CAELO_VERSION = "0.2.2";
|
|
24
|
+
/**
|
|
25
|
+
* Deprecated alias for back-compat — early P17 work spelled this
|
|
26
|
+
* `CALEO_VERSION` (typo of "Caelo"). New code should import
|
|
27
|
+
* `CAELO_VERSION`. Kept as a re-export so existing callers keep
|
|
28
|
+
* compiling; remove once external consumers have migrated.
|
|
29
|
+
*
|
|
30
|
+
* @deprecated use CAELO_VERSION
|
|
31
|
+
*/
|
|
32
|
+
export const CALEO_VERSION = CAELO_VERSION;
|
|
33
|
+
export function parseVersion(raw = CAELO_VERSION) {
|
|
34
|
+
const m = /^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/.exec(raw);
|
|
35
|
+
if (!m) {
|
|
36
|
+
throw new Error(`invalid Caelo version: ${raw}`);
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
major: Number.parseInt(m[1] ?? "0", 10),
|
|
40
|
+
minor: Number.parseInt(m[2] ?? "0", 10),
|
|
41
|
+
patch: Number.parseInt(m[3] ?? "0", 10),
|
|
42
|
+
preRelease: m[4] ?? null,
|
|
43
|
+
raw,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC;AAgB3C,MAAM,UAAU,YAAY,CAAC,MAAc,aAAa;IACtD,MAAM,CAAC,GAAG,iCAAiC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtD,IAAI,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC;QACvC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC;QACvC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC;QACvC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI;QACxB,GAAG;KACJ,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@caelo-cms/shared",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"private": false,
|
|
5
|
+
"license": "MPL-2.0",
|
|
6
|
+
"description": "Shared Zod schemas + types + the two-pass HTML composer used by every Caelo CMS workspace package. Stable enough for plugin authors and embedders to depend on directly.",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/caelo-cms/caelo-cms.git",
|
|
10
|
+
"directory": "packages/shared"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/caelo-cms/caelo-cms#readme",
|
|
13
|
+
"bugs": "https://github.com/caelo-cms/caelo-cms/issues",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"default": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist/",
|
|
26
|
+
"README.md",
|
|
27
|
+
"package.json"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"typecheck": "tsc -b",
|
|
31
|
+
"build": "tsc -b --force",
|
|
32
|
+
"prepublishOnly": "tsc -b --force"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"htmlparser2": "^12.0.0",
|
|
36
|
+
"zod": "4.3.6"
|
|
37
|
+
}
|
|
38
|
+
}
|