@tomsher/cms-theme-kit 0.1.0 → 0.1.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.
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/errors.ts","../../cms-core/src/constants/content-model/custom-fields.constants.ts","../../cms-core/src/constants/theme/theme.constants.ts","../../cms-core/src/constants/theme/theme-template.constants.ts","../../cms-core/src/constants/theme/liquid-theme.constants.ts","../../cms-core/src/constants/theme/theme-link-target.constants.ts","../../cms-core/src/constants/content-model/entity.constants.ts","../../cms-core/src/constants/http/query-keys.constants.ts","../../cms-core/src/constants/locale/languages.constants.ts","../../cms-core/src/constants/theme/theme-page.constants.ts","../../cms-core/src/constants/theme/content-template-bindings.constants.ts","../../cms-core/src/constants/theme/static-theme.constants.ts","../../cms-core/src/constants/theme/theme-assets.constants.ts","../src/lib/hash.ts"],"sourcesContent":["export class CliError extends Error {\n readonly exitCode: number;\n\n constructor(message: string, exitCode = 1) {\n super(message);\n this.name = 'CliError';\n this.exitCode = exitCode;\n }\n}\n\nexport class ApiError extends CliError {\n readonly status: number;\n readonly body: unknown;\n\n constructor(message: string, status: number, body: unknown) {\n super(message);\n this.name = 'ApiError';\n this.status = status;\n this.body = body;\n }\n\n static async fromResponse(response: Response): Promise<ApiError> {\n const text = await response.text();\n const body = parseBody(text);\n const serverMessage = extractServerMessage(body) || response.statusText || 'Request failed';\n const hint = response.status === 401 ? ' Check your login or CMS_THEME_KIT_TOKEN.' : '';\n const conflicts = extractConflictLines(body);\n const message = `HTTP ${response.status}: ${serverMessage}.${hint}${conflicts}`;\n return new ApiError(message, response.status, body);\n }\n}\n\nconst parseBody = (text: string): unknown => {\n if (!text) {\n return null;\n }\n\n try {\n return JSON.parse(text) as unknown;\n } catch {\n return text;\n }\n};\n\nconst extractServerMessage = (body: unknown): string => {\n if (typeof body === 'string') {\n return body;\n }\n\n if (body && typeof body === 'object' && 'message' in body) {\n const message = (body as { message: unknown }).message;\n\n if (typeof message === 'string') {\n return message;\n }\n\n if (Array.isArray(message)) {\n return message.map(String).join('; ');\n }\n }\n\n return '';\n};\n\nconst extractConflictLines = (body: unknown): string => {\n if (!body || typeof body !== 'object' || !('conflicts' in body)) {\n return '';\n }\n\n const conflicts = (body as { conflicts: unknown }).conflicts;\n\n if (!Array.isArray(conflicts)) {\n return '';\n }\n\n const lines = conflicts.map((conflict) => {\n const item = conflict as { filename?: string; currentHash?: string | null };\n return `\\n - ${item.filename ?? 'unknown file'} (remote hash ${item.currentHash ?? 'missing'})`;\n });\n\n return lines.join('');\n};\n","export const customFieldTypeConstants = {\n text: 'text',\n textarea: 'textarea',\n richtext: 'richtext',\n color: 'color',\n number: 'number',\n boolean: 'boolean',\n date: 'date',\n datetime: 'datetime',\n select: 'select',\n file: 'file',\n object: 'object',\n array: 'array',\n relation: 'relation',\n component: 'component',\n linkSelector: 'linkSelector',\n} as const;\n\nexport type CustomFieldType = (typeof customFieldTypeConstants)[keyof typeof customFieldTypeConstants];\n\nexport interface CustomFieldTypeMetadata {\n type: CustomFieldType;\n label: string;\n description: string;\n}\n\nexport const customFieldTypeMetadataConstants: CustomFieldTypeMetadata[] = [\n {\n type: customFieldTypeConstants.text,\n label: 'Text',\n description: 'Single line text (title, name)',\n },\n {\n type: customFieldTypeConstants.textarea,\n label: 'Long Text',\n description: 'Multi-line text (description)',\n },\n {\n type: customFieldTypeConstants.richtext,\n label: 'Rich Text',\n description: 'WYSIWYG HTML article editor',\n },\n {\n type: customFieldTypeConstants.color,\n label: 'Color',\n description: 'Color value with visual picker and hex input',\n },\n {\n type: customFieldTypeConstants.number,\n label: 'Number',\n description: 'Integer, decimal, price, count',\n },\n {\n type: customFieldTypeConstants.boolean,\n label: 'Boolean',\n description: 'Yes or no switcher / toggle',\n },\n {\n type: customFieldTypeConstants.date,\n label: 'Date',\n description: 'Calendar date picker',\n },\n {\n type: customFieldTypeConstants.datetime,\n label: 'Date & Time',\n description: 'Calendar date with time picker',\n },\n {\n type: customFieldTypeConstants.select,\n label: 'Select / Choice',\n description: 'Dropdown options',\n },\n {\n type: customFieldTypeConstants.file,\n label: 'Media / File',\n description: 'Image or document attachment',\n },\n {\n type: customFieldTypeConstants.array,\n label: 'Array / List',\n description: 'Repeated list of text or values',\n },\n {\n type: customFieldTypeConstants.relation,\n label: 'Relation',\n description: 'Link to Content Type or Entity',\n },\n {\n type: customFieldTypeConstants.component,\n label: 'Component',\n description: 'Embed reusable component fields',\n },\n {\n type: customFieldTypeConstants.linkSelector,\n label: 'Link Selector',\n description: 'Select a routable CMS page or an external HTTPS URL',\n },\n];\n\nexport const customFieldTypeOptions = [\n { label: 'Short Text', value: customFieldTypeConstants.text },\n { label: 'Long Text (Textarea)', value: customFieldTypeConstants.textarea },\n { label: 'Rich Text / HTML', value: customFieldTypeConstants.richtext },\n { label: 'Color', value: customFieldTypeConstants.color },\n { label: 'Number', value: customFieldTypeConstants.number },\n { label: 'Boolean (Toggle)', value: customFieldTypeConstants.boolean },\n { label: 'Date', value: customFieldTypeConstants.date },\n { label: 'Date & Time', value: customFieldTypeConstants.datetime },\n { label: 'Dropdown / Select', value: customFieldTypeConstants.select },\n { label: 'Media / File Upload', value: customFieldTypeConstants.file },\n { label: 'Array / List', value: customFieldTypeConstants.array },\n { label: 'Relation (Content-Type / Entity)', value: customFieldTypeConstants.relation },\n { label: 'Component Reference', value: customFieldTypeConstants.component },\n { label: 'Link Selector', value: customFieldTypeConstants.linkSelector },\n];\n\nexport const customFieldWidthConstants = {\n full: 'full',\n half: '1/2',\n third: '1/3',\n} as const;\n\nexport type CustomFieldWidth = (typeof customFieldWidthConstants)[keyof typeof customFieldWidthConstants];\n","export const themeStatusConstants = {\n archived: 0,\n active: 1,\n draft: 2,\n} as const;\n\nexport type ThemeStatus = (typeof themeStatusConstants)[keyof typeof themeStatusConstants];\n\nexport const themeFileChangeTypes = {\n added: 'added',\n modified: 'modified',\n deleted: 'deleted',\n} as const;\n\nexport type ThemeFileChangeType = (typeof themeFileChangeTypes)[keyof typeof themeFileChangeTypes];\n\nexport const themeFileExtensions = {\n liquid: '.liquid',\n html: '.html',\n txt: '.txt',\n css: '.css',\n scss: '.scss',\n json: '.json',\n js: '.js',\n ts: '.ts',\n png: '.png',\n jpg: '.jpg',\n jpeg: '.jpeg',\n svg: '.svg',\n webp: '.webp',\n} as const;\n\nexport const themeRenderModes = {\n liquid: 'liquid',\n static: 'static',\n} as const;\n\nexport type ThemeRenderMode = (typeof themeRenderModes)[keyof typeof themeRenderModes];\n\nexport const themePageSlugConstants = { home: 'home' } as const;\n\nexport const themeUploadMaxArchiveMb = 200;\n","export const themeTemplatePrefix = {\n page: 'page.',\n collection: 'collection.',\n detail: 'detail.',\n system: null,\n} as const;\n\nexport const themeTemplateCategoryKeys = {\n pages: 'pages',\n collections: 'collections',\n details: 'details',\n system: 'system',\n} as const;\n\nexport const themeTemplateCategories = {\n pages: { label: 'Pages', prefix: themeTemplatePrefix.page },\n collections: { label: 'Collections', prefix: themeTemplatePrefix.collection },\n details: { label: 'Details', prefix: themeTemplatePrefix.detail },\n system: { label: 'System', prefix: themeTemplatePrefix.system },\n} as const;\n\nexport type ThemeTemplateCategory = Exclude<keyof typeof themeTemplateCategories, 'system'>;\n","import { themeFileExtensions } from './theme.constants';\nimport { themeTemplateCategoryKeys, type ThemeTemplateCategory } from './theme-template.constants';\nimport { customFieldTypeConstants } from '../content-model/custom-fields.constants';\n\nexport const themeCustomizerLocaleNamespace = 'themeCustomizer';\n\nexport const themeCustomizerLocalizedSettingTypes = {\n text: customFieldTypeConstants.text,\n textarea: customFieldTypeConstants.textarea,\n richtext: customFieldTypeConstants.richtext,\n inlineRichtext: 'inlineRichtext',\n} as const;\n\nexport const liquidThemeFolderNames = {\n layout: 'layout',\n templates: 'templates',\n sections: 'sections',\n snippets: 'snippets',\n assets: 'assets',\n config: 'config',\n locales: 'locales',\n constants: 'constants',\n} as const;\n\nexport const liquidThemeFolderStrictExtensions: Record<keyof typeof liquidThemeFolderNames, string[]> = {\n layout: [themeFileExtensions.liquid, themeFileExtensions.html],\n templates: ['.json'],\n sections: [themeFileExtensions.liquid, themeFileExtensions.html],\n snippets: [themeFileExtensions.liquid, themeFileExtensions.html],\n assets: ['.css', '.js', '.svg', '.png', '.jpg', '.jpeg', '.webp', '.gif', '.mp4', '.woff', '.woff2', '.ttf', '.txt'],\n config: ['.json'],\n locales: ['.json'],\n constants: ['.json'],\n};\n\nexport const liquidThemeAllowedDirectories = [\n liquidThemeFolderNames.layout,\n liquidThemeFolderNames.templates,\n liquidThemeFolderNames.sections,\n liquidThemeFolderNames.snippets,\n liquidThemeFolderNames.assets,\n liquidThemeFolderNames.config,\n liquidThemeFolderNames.locales,\n liquidThemeFolderNames.constants,\n] as const;\n\nexport const liquidThemeConfigFilePaths = {\n settingsData: 'config/settings_data.json',\n settingsSchema: 'config/settings_schema.json',\n routes: 'config/routes.json',\n} as const;\n\nexport const liquidThemeTemplatePaths = {\n index: 'templates/index.json',\n collection: 'templates/collection.json',\n entityDetails: 'templates/entity.json',\n notFound: 'templates/404.json',\n} as const;\n\nexport const liquidThemeRequiredTemplatePaths = [\n liquidThemeTemplatePaths.index,\n liquidThemeTemplatePaths.collection,\n liquidThemeTemplatePaths.entityDetails,\n liquidThemeTemplatePaths.notFound,\n] as const;\n\nexport const liquidThemeRequiredFilePaths = [liquidThemeConfigFilePaths.settingsData, liquidThemeConfigFilePaths.settingsSchema] as const;\n\nexport const liquidThemeTemplateCategoryDefaultPaths: Record<ThemeTemplateCategory, string> = {\n [themeTemplateCategoryKeys.pages]: liquidThemeTemplatePaths.index,\n [themeTemplateCategoryKeys.collections]: liquidThemeTemplatePaths.collection,\n [themeTemplateCategoryKeys.details]: liquidThemeTemplatePaths.entityDetails,\n};\n","export const themeLinkTargetKinds = {\n single: 'single',\n listing: 'listing',\n entry: 'entry',\n external: 'external',\n} as const;\n\nexport type ThemeLinkTargetKind = (typeof themeLinkTargetKinds)[keyof typeof themeLinkTargetKinds];\n\nexport const themeLinkTargetKindOptions = [\n { value: themeLinkTargetKinds.single, label: 'Single page' },\n { value: themeLinkTargetKinds.listing, label: 'Collection listing' },\n { value: themeLinkTargetKinds.entry, label: 'Collection entry' },\n { value: themeLinkTargetKinds.external, label: 'External HTTPS URL' },\n] as const;\n","export const entityKinds = {\n collection: 'collection',\n single: 'single',\n} as const;\n","export const queryFlagConstants = {\n enabled: '1',\n} as const;\n\nexport const queryKeys = {\n page: 'page',\n limit: 'limit',\n sortBy: 'sortby',\n sortOrder: 'sortorder',\n themeSortBy: 'sortBy',\n themeSortOrder: 'sortOrder',\n keyword: 'keyword',\n type: 'type',\n handle: 'handle',\n fields: 'fields',\n populate: 'populate',\n queries: 'queries',\n entities: 'entities',\n filename: 'filename',\n lang: 'lang',\n countryId: 'countryId',\n preview: 'preview',\n block: 'block',\n blockReference: 'blockReference',\n slug: 'slug',\n path: 'path',\n templatePath: 'templatePath',\n listingHandle: 'listingHandle',\n entityType: 'entityType',\n filterQuery: 'filterQuery',\n relationField: 'relationField',\n relationTarget: 'relationTarget',\n excludeCurrent: 'excludeCurrent',\n period: 'period',\n startDate: 'startDate',\n endDate: 'endDate',\n severity: 'severity',\n check: 'check',\n status: 'status',\n provider: 'provider',\n tenant: 'tenant',\n tenantIds: 'tenantIds',\n} as const;\n","export const languageStorageConstants = {\n key: 'language-code',\n listKey: 'languages-list',\n} as const;\n\nexport const defaultLanguageCode = 'en';\n\nexport const languageDirectionConstants = {\n ltr: 'ltr',\n rtl: 'rtl',\n} as const;\n\nexport const rightToLeftLanguageCodes = ['ar', 'ckb', 'dv', 'fa', 'he', 'ku', 'nqo', 'ps', 'sd', 'syr', 'ug', 'ur', 'yi'] as const;\n\nexport type LanguageDirection = typeof languageDirectionConstants[keyof typeof languageDirectionConstants];\n\nexport const languageStatusConstants = {\n active: '1',\n inactive: '2',\n} as const;\n\nexport type LanguageStatus = typeof languageStatusConstants[keyof typeof languageStatusConstants];\n\nexport const languageStatusOptions = [\n { label: 'All Statuses', value: '' },\n { label: 'Active', value: languageStatusConstants.active },\n { label: 'Inactive', value: languageStatusConstants.inactive },\n];\n\nexport const languageFormStatusOptions = [\n { label: 'Active', value: languageStatusConstants.active },\n { label: 'Inactive', value: languageStatusConstants.inactive },\n];\n\n","export const themePageTypes = {\n singlePage: 'single-page',\n collectionDetail: 'collection-detail',\n collectionListing: 'collection-listing',\n} as const;\n","import type { ThemeTemplateCategory } from './theme-template.constants';\nimport { themePageTypes } from './theme-page.constants';\n\nexport const categoryRouteKinds: Record<ThemeTemplateCategory, string> = {\n pages: themePageTypes.singlePage,\n collections: themePageTypes.collectionListing,\n details: themePageTypes.collectionDetail,\n};\n\nexport const themeBindingEntityTypeConstants = {\n contentTypes: 'contentTypes',\n} as const;\n\nexport const categoryLabels: Record<ThemeTemplateCategory, string> = {\n pages: 'Page template',\n collections: 'Listing template',\n details: 'Detail template',\n};\n","import { themeFileExtensions } from './theme.constants';\n\nexport const staticThemeFolderNames = {\n root: 'static'\n} as const;\n\nexport const staticThemeHomeFileName = `index${themeFileExtensions.html}`;\nexport const staticThemeHomeFilePattern = new RegExp(`/index${themeFileExtensions.html.replace('.', '\\\\.')}?$`, 'i');\nexport const staticThemeHtmlExtensionPattern = new RegExp(`${themeFileExtensions.html.replace('.', '\\\\.')}?$`, 'i');\nexport const staticThemeHomePath = `${staticThemeFolderNames.root}/${staticThemeHomeFileName}`;\nexport const staticThemeAllowedDirectories = [staticThemeFolderNames.root] as const;\nexport const staticThemeRequiredTemplatePaths: readonly string[] = [staticThemeHomePath];\nexport const staticAssetPattern = /\\.(?:svg|png|jpe?g|gif|webp|mp4|avif|ico|css|js|map|woff2?|ttf|eot|otf|json)$/i;\n","export const themeAssetUrlPatterns = {\n safeExternalUrl: /^(?:https?:|blob:)/i,\n safeDataUrl: /^data:(?:image|video|audio|font)\\//i,\n} as const;\n","import { createHash } from 'node:crypto';\n\nexport const sha256Hex = (bytes: Uint8Array): string => {\n return createHash('sha256').update(bytes).digest('hex');\n};\n\nexport const diffHashes = (\n base: Record<string, string>,\n local: Record<string, string>,\n): ThemeDiff => {\n const added: string[] = [];\n const modified: string[] = [];\n const deleted: string[] = [];\n\n for (const path of Object.keys(local).sort()) {\n if (base[path] === undefined) {\n added.push(path);\n } else if (base[path] !== local[path]) {\n modified.push(path);\n }\n }\n\n for (const path of Object.keys(base).sort()) {\n if (local[path] === undefined) {\n deleted.push(path);\n }\n }\n\n return { added, modified, deleted };\n};\n\nexport interface ThemeDiff {\n added: string[];\n modified: string[];\n deleted: string[];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,IAAM,WAAN,cAAuB,MAAM;AAAA,EACvB;AAAA,EAET,YAAY,SAAiB,WAAW,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,WAAW;AAAA,EACpB;AACJ;AAEO,IAAM,WAAN,MAAM,kBAAiB,SAAS;AAAA,EAC1B;AAAA,EACA;AAAA,EAET,YAAY,SAAiB,QAAgB,MAAe;AACxD,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AAAA,EAChB;AAAA,EAEA,aAAa,aAAa,UAAuC;AAC7D,UAAM,OAAO,MAAM,SAAS,KAAK;AACjC,UAAM,OAAO,UAAU,IAAI;AAC3B,UAAM,gBAAgB,qBAAqB,IAAI,KAAK,SAAS,cAAc;AAC3E,UAAM,OAAO,SAAS,WAAW,MAAM,8CAA8C;AACrF,UAAM,YAAY,qBAAqB,IAAI;AAC3C,UAAM,UAAU,QAAQ,SAAS,MAAM,KAAK,aAAa,IAAI,IAAI,GAAG,SAAS;AAC7E,WAAO,IAAI,UAAS,SAAS,SAAS,QAAQ,IAAI;AAAA,EACtD;AACJ;AAEA,IAAM,YAAY,CAAC,SAA0B;AACzC,MAAI,CAAC,MAAM;AACP,WAAO;AAAA,EACX;AAEA,MAAI;AACA,WAAO,KAAK,MAAM,IAAI;AAAA,EAC1B,QAAQ;AACJ,WAAO;AAA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QAAI,KAAK,IAAI,MAAM,QAAW;AAC1B,YAAM,KAAK,IAAI;AAAA,IACnB,WAAW,KAAK,IAAI,MAAM,MAAM,IAAI,GAAG;AACnC,eAAS,KAAK,IAAI;AAAA,IACtB;AAAA,EACJ;AAEA,aAAW,QAAQ,OAAO,KAAK,IAAI,EAAE,KAAK,GAAG;AACzC,QAAI,MAAM,IAAI,MAAM,QAAW;AAC3B,cAAQ,KAAK,IAAI;AAAA,IACrB;AAAA,EACJ;AAEA,SAAO,EAAE,OAAO,UAAU,QAAQ;AACtC;","names":[]}
@@ -1,158 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- CliError
4
- } from "./chunk-TN3DQWJE.js";
5
-
6
- // src/lib/dev/server-shared.ts
7
- import { readFile } from "fs/promises";
8
- import { createServer } from "http";
9
- import { extname, resolve, sep } from "path";
10
- var contentTypes = {
11
- ".css": "text/css; charset=utf-8",
12
- ".js": "application/javascript; charset=utf-8",
13
- ".json": "application/json; charset=utf-8",
14
- ".svg": "image/svg+xml",
15
- ".txt": "text/plain; charset=utf-8",
16
- ".png": "image/png",
17
- ".jpg": "image/jpeg",
18
- ".jpeg": "image/jpeg",
19
- ".webp": "image/webp",
20
- ".gif": "image/gif",
21
- ".mp4": "video/mp4",
22
- ".woff": "font/woff",
23
- ".woff2": "font/woff2",
24
- ".ttf": "font/ttf"
25
- };
26
- var reloadScript = [
27
- "<script>",
28
- "(function () {",
29
- ' var source = new EventSource("/__events");',
30
- ' source.addEventListener("reload", function () { location.reload(); });',
31
- "})();",
32
- "</script>"
33
- ].join("\n");
34
- var injectReloadScript = (html) => {
35
- if (/<\/body>/i.test(html)) {
36
- return html.replace(/<\/body>/i, (tag) => `${reloadScript}${tag}`);
37
- }
38
- return `${html}${reloadScript}`;
39
- };
40
- var safeDecode = (value) => {
41
- try {
42
- return decodeURIComponent(value);
43
- } catch {
44
- return null;
45
- }
46
- };
47
- var escapeHtml = (value) => {
48
- return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
49
- };
50
- var sendResponse = (response, status, headers, body) => {
51
- response.writeHead(status, { ...headers, "Cache-Control": "no-store" });
52
- response.end(body);
53
- };
54
- var sendHtml = (response, status, html) => {
55
- sendResponse(response, status, { "Content-Type": "text/html; charset=utf-8" }, injectReloadScript(html));
56
- };
57
- var linkListHtml = (title, links) => {
58
- const items = links.map((link) => `<li><a href="${escapeHtml(link.href)}">${escapeHtml(link.label)}</a></li>`).join("");
59
- return `<!DOCTYPE html><html><head><meta charset="utf-8"><title>${escapeHtml(title)}</title></head><body style="font-family:sans-serif;padding:32px;"><h1>${escapeHtml(title)}</h1><ul>${items}</ul></body></html>`;
60
- };
61
- var notFoundHtml = (message) => {
62
- return `<!DOCTYPE html><html><body style="font-family:sans-serif;padding:32px;"><h2>Not found</h2><p>${escapeHtml(message)}</p></body></html>`;
63
- };
64
- var renderErrorPage = (error) => {
65
- const message = error instanceof Error ? error.message : String(error);
66
- const stack = error instanceof Error ? error.stack ?? "" : "";
67
- return `<!DOCTYPE html><html><body style="font-family:sans-serif;padding:32px;color:#dc2626;background:#fff1f2;"><h2 style="margin-top:0;">Theme Preview Rendering Error</h2><p style="color:#991b1b;">${escapeHtml(message)}</p><pre style="background:#fee2e2;padding:16px;border-radius:8px;overflow:auto;">${escapeHtml(stack)}</pre></body></html>`;
68
- };
69
- var serveFile = async (response, rootDir, encodedPath) => {
70
- const relativePath = safeDecode(encodedPath);
71
- const filePath = relativePath === null ? "" : resolve(rootDir, relativePath);
72
- if (!filePath.startsWith(`${rootDir}${sep}`)) {
73
- sendResponse(response, 404, { "Content-Type": "text/plain; charset=utf-8" }, "Not found");
74
- return;
75
- }
76
- try {
77
- const bytes = await readFile(filePath);
78
- const contentType = contentTypes[extname(filePath).toLowerCase()] ?? "application/octet-stream";
79
- sendResponse(response, 200, { "Content-Type": contentType }, bytes);
80
- } catch {
81
- sendResponse(response, 404, { "Content-Type": "text/plain; charset=utf-8" }, "Not found");
82
- }
83
- };
84
- var createReloadHub = () => {
85
- const clients = /* @__PURE__ */ new Set();
86
- return {
87
- open: (request, response) => {
88
- response.writeHead(200, {
89
- "Content-Type": "text/event-stream",
90
- "Cache-Control": "no-cache",
91
- Connection: "keep-alive"
92
- });
93
- response.write("retry: 1000\n\n");
94
- clients.add(response);
95
- request.on("close", () => {
96
- clients.delete(response);
97
- });
98
- },
99
- broadcast: () => {
100
- for (const client of clients) {
101
- client.write("event: reload\ndata: 1\n\n");
102
- }
103
- },
104
- close: () => {
105
- for (const client of clients) {
106
- client.end();
107
- }
108
- clients.clear();
109
- }
110
- };
111
- };
112
- var createRouteServer = (route) => {
113
- return createServer((request, response) => {
114
- route(request, response).catch((error) => {
115
- if (!response.headersSent) {
116
- sendHtml(response, 500, renderErrorPage(error));
117
- }
118
- });
119
- });
120
- };
121
- var listenOnLocalhost = (server, port) => {
122
- return new Promise((resolveListen, rejectListen) => {
123
- server.once("error", (error) => {
124
- if (error.code === "EADDRINUSE") {
125
- rejectListen(new CliError(`Port ${port} is already in use. Pass --port <n>.`));
126
- return;
127
- }
128
- rejectListen(error);
129
- });
130
- server.listen(port, "localhost", () => {
131
- resolveListen();
132
- });
133
- });
134
- };
135
- var closeServer = (server, reload) => {
136
- reload.close();
137
- return new Promise((resolveClose) => {
138
- server.close(() => {
139
- resolveClose();
140
- });
141
- server.closeAllConnections();
142
- });
143
- };
144
-
145
- export {
146
- safeDecode,
147
- sendResponse,
148
- sendHtml,
149
- linkListHtml,
150
- notFoundHtml,
151
- renderErrorPage,
152
- serveFile,
153
- createReloadHub,
154
- createRouteServer,
155
- listenOnLocalhost,
156
- closeServer
157
- };
158
- //# sourceMappingURL=chunk-UDJL2R66.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/dev/server-shared.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { createServer, type IncomingMessage, type Server, type ServerResponse } from 'node:http';\nimport { extname, resolve, sep } from 'node:path';\nimport { CliError } from '../errors';\n\n// Shared by the liquid and static dev servers. Kept free of the liquid engine so static preview does not load it.\n\nconst contentTypes: Record<string, string> = {\n '.css': 'text/css; charset=utf-8',\n '.js': 'application/javascript; charset=utf-8',\n '.json': 'application/json; charset=utf-8',\n '.svg': 'image/svg+xml',\n '.txt': 'text/plain; charset=utf-8',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.webp': 'image/webp',\n '.gif': 'image/gif',\n '.mp4': 'video/mp4',\n '.woff': 'font/woff',\n '.woff2': 'font/woff2',\n '.ttf': 'font/ttf',\n};\n\n// Injected before </body> so every rendered page reloads when the theme changes.\nconst reloadScript = [\n '<script>',\n '(function () {',\n ' var source = new EventSource(\"/__events\");',\n ' source.addEventListener(\"reload\", function () { location.reload(); });',\n '})();',\n '</script>',\n].join('\\n');\n\nconst injectReloadScript = (html: string): string => {\n if (/<\\/body>/i.test(html)) {\n return html.replace(/<\\/body>/i, (tag) => `${reloadScript}${tag}`);\n }\n\n return `${html}${reloadScript}`;\n};\n\nexport const safeDecode = (value: string): string | null => {\n try {\n return decodeURIComponent(value);\n } catch {\n return null;\n }\n};\n\nexport const escapeHtml = (value: string): string => {\n return value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;');\n};\n\nexport const sendResponse = (response: ServerResponse, status: number, headers: Record<string, string>, body: string | Uint8Array): void => {\n response.writeHead(status, { ...headers, 'Cache-Control': 'no-store' });\n response.end(body);\n};\n\nexport const sendHtml = (response: ServerResponse, status: number, html: string): void => {\n sendResponse(response, status, { 'Content-Type': 'text/html; charset=utf-8' }, injectReloadScript(html));\n};\n\nexport const linkListHtml = (title: string, links: { href: string; label: string }[]): string => {\n const items = links\n .map((link) => `<li><a href=\"${escapeHtml(link.href)}\">${escapeHtml(link.label)}</a></li>`)\n .join('');\n\n return `<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>${escapeHtml(title)}</title></head><body style=\"font-family:sans-serif;padding:32px;\"><h1>${escapeHtml(title)}</h1><ul>${items}</ul></body></html>`;\n};\n\nexport const notFoundHtml = (message: string): string => {\n return `<!DOCTYPE html><html><body style=\"font-family:sans-serif;padding:32px;\"><h2>Not found</h2><p>${escapeHtml(message)}</p></body></html>`;\n};\n\nexport const renderErrorPage = (error: unknown): string => {\n const message = error instanceof Error ? error.message : String(error);\n const stack = error instanceof Error ? error.stack ?? '' : '';\n\n return `<!DOCTYPE html><html><body style=\"font-family:sans-serif;padding:32px;color:#dc2626;background:#fff1f2;\"><h2 style=\"margin-top:0;\">Theme Preview Rendering Error</h2><p style=\"color:#991b1b;\">${escapeHtml(message)}</p><pre style=\"background:#fee2e2;padding:16px;border-radius:8px;overflow:auto;\">${escapeHtml(stack)}</pre></body></html>`;\n};\n\n// Serves a file under rootDir. The resolved path must stay inside rootDir, so ../ segments get a 404.\nexport const serveFile = async (response: ServerResponse, rootDir: string, encodedPath: string): Promise<void> => {\n const relativePath = safeDecode(encodedPath);\n const filePath = relativePath === null ? '' : resolve(rootDir, relativePath);\n\n if (!filePath.startsWith(`${rootDir}${sep}`)) {\n sendResponse(response, 404, { 'Content-Type': 'text/plain; charset=utf-8' }, 'Not found');\n return;\n }\n\n try {\n const bytes = await readFile(filePath);\n const contentType = contentTypes[extname(filePath).toLowerCase()] ?? 'application/octet-stream';\n sendResponse(response, 200, { 'Content-Type': contentType }, bytes);\n } catch {\n sendResponse(response, 404, { 'Content-Type': 'text/plain; charset=utf-8' }, 'Not found');\n }\n};\n\nexport interface ReloadHub {\n open: (request: IncomingMessage, response: ServerResponse) => void;\n broadcast: () => void;\n close: () => void;\n}\n\nexport const createReloadHub = (): ReloadHub => {\n const clients = new Set<ServerResponse>();\n\n return {\n open: (request, response) => {\n response.writeHead(200, {\n 'Content-Type': 'text/event-stream',\n 'Cache-Control': 'no-cache',\n Connection: 'keep-alive',\n });\n response.write('retry: 1000\\n\\n');\n clients.add(response);\n request.on('close', () => {\n clients.delete(response);\n });\n },\n broadcast: () => {\n for (const client of clients) {\n client.write('event: reload\\ndata: 1\\n\\n');\n }\n },\n close: () => {\n for (const client of clients) {\n client.end();\n }\n\n clients.clear();\n },\n };\n};\n\nexport const createRouteServer = (route: (request: IncomingMessage, response: ServerResponse) => Promise<void>): Server => {\n return createServer((request, response) => {\n route(request, response).catch((error: unknown) => {\n if (!response.headersSent) {\n sendHtml(response, 500, renderErrorPage(error));\n }\n });\n });\n};\n\nexport const listenOnLocalhost = (server: Server, port: number): Promise<void> => {\n return new Promise<void>((resolveListen, rejectListen) => {\n server.once('error', (error: NodeJS.ErrnoException) => {\n if (error.code === 'EADDRINUSE') {\n rejectListen(new CliError(`Port ${port} is already in use. Pass --port <n>.`));\n return;\n }\n\n rejectListen(error);\n });\n server.listen(port, 'localhost', () => {\n resolveListen();\n });\n });\n};\n\nexport const closeServer = (server: Server, reload: ReloadHub): Promise<void> => {\n reload.close();\n\n return new Promise<void>((resolveClose) => {\n server.close(() => {\n resolveClose();\n });\n server.closeAllConnections();\n });\n};\n"],"mappings":";;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,oBAA4E;AACrF,SAAS,SAAS,SAAS,WAAW;AAKtC,IAAM,eAAuC;AAAA,EACzC,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,UAAU;AAAA,EACV,QAAQ;AACZ;AAGA,IAAM,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,EAAE,KAAK,IAAI;AAEX,IAAM,qBAAqB,CAAC,SAAyB;AACjD,MAAI,YAAY,KAAK,IAAI,GAAG;AACxB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