@tomsher/cms-theme-kit 0.1.4 → 0.1.6

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.
@@ -94,7 +94,7 @@ var extractConflictLines = (body) => {
94
94
  return lines.join("");
95
95
  };
96
96
 
97
- // ../cms-core/dist/chunk-DNDBQLRL.js
97
+ // ../cms-core/dist/chunk-SVBGW7SW.js
98
98
  var customFieldTypeConstants = {
99
99
  text: "text",
100
100
  textarea: "textarea",
@@ -200,6 +200,54 @@ var customFieldTypeOptions = [
200
200
  { label: "Component Reference", value: customFieldTypeConstants.component },
201
201
  { label: "Link Selector", value: customFieldTypeConstants.linkSelector }
202
202
  ];
203
+ var entityKinds = {
204
+ collection: "collection",
205
+ single: "single"
206
+ };
207
+ var queryKeys = {
208
+ page: "page",
209
+ limit: "limit",
210
+ sortBy: "sortby",
211
+ sortOrder: "sortorder",
212
+ themeSortBy: "sortBy",
213
+ themeSortOrder: "sortOrder",
214
+ keyword: "keyword",
215
+ type: "type",
216
+ handle: "handle",
217
+ fields: "fields",
218
+ populate: "populate",
219
+ queries: "queries",
220
+ entities: "entities",
221
+ filename: "filename",
222
+ lang: "lang",
223
+ countryId: "countryId",
224
+ preview: "preview",
225
+ block: "block",
226
+ blockReference: "blockReference",
227
+ slug: "slug",
228
+ path: "path",
229
+ templatePath: "templatePath",
230
+ listingHandle: "listingHandle",
231
+ entityType: "entityType",
232
+ filterQuery: "filterQuery",
233
+ relationField: "relationField",
234
+ relationTarget: "relationTarget",
235
+ excludeCurrent: "excludeCurrent",
236
+ period: "period",
237
+ startDate: "startDate",
238
+ endDate: "endDate",
239
+ severity: "severity",
240
+ check: "check",
241
+ status: "status",
242
+ provider: "provider",
243
+ tenant: "tenant",
244
+ tenantIds: "tenantIds",
245
+ versionId: "versionId",
246
+ facets: "facets"
247
+ };
248
+ var liquidAssetUrlPatterns = {
249
+ themeAssetPrefix: /^assets\//i
250
+ };
203
251
  var themeFileExtensions = {
204
252
  liquid: ".liquid",
205
253
  html: ".html",
@@ -309,6 +357,18 @@ var themeSettingTypeConstants = {
309
357
  collection: "collection"
310
358
  };
311
359
  var themeEntityBindingSource = "entity";
360
+ var staticThemeFolderNames = {
361
+ root: "static"
362
+ };
363
+ var staticThemeHomeFileName = `index${themeFileExtensions.html}`;
364
+ var staticThemeHomeFilePattern = new RegExp(`/index${themeFileExtensions.html.replace(".", "\\.")}?$`, "i");
365
+ var staticThemeHtmlExtensionPattern = new RegExp(`${themeFileExtensions.html.replace(".", "\\.")}?$`, "i");
366
+ var staticThemeHomePath = `${staticThemeFolderNames.root}/${staticThemeHomeFileName}`;
367
+ var staticThemeAllowedDirectories = [staticThemeFolderNames.root];
368
+ var themeAssetUrlPatterns = {
369
+ safeExternalUrl: /^(?:https?:|blob:)/i,
370
+ safeDataUrl: /^data:(?:image|video|audio|font)\//i
371
+ };
312
372
  var themeLinkTargetKinds = {
313
373
  single: "single",
314
374
  listing: "listing",
@@ -321,53 +381,90 @@ var themeLinkTargetKindOptions = [
321
381
  { value: themeLinkTargetKinds.entry, label: "Collection entry" },
322
382
  { value: themeLinkTargetKinds.external, label: "External HTTPS URL" }
323
383
  ];
324
-
325
- // ../cms-core/dist/constants/index.js
326
- var entityKinds = {
327
- collection: "collection",
328
- single: "single"
329
- };
330
- var queryKeys = {
331
- page: "page",
332
- limit: "limit",
333
- sortBy: "sortby",
334
- sortOrder: "sortorder",
335
- themeSortBy: "sortBy",
336
- themeSortOrder: "sortOrder",
337
- keyword: "keyword",
338
- type: "type",
339
- handle: "handle",
340
- fields: "fields",
341
- populate: "populate",
342
- queries: "queries",
343
- entities: "entities",
344
- filename: "filename",
345
- lang: "lang",
346
- countryId: "countryId",
347
- preview: "preview",
348
- block: "block",
349
- blockReference: "blockReference",
350
- slug: "slug",
351
- path: "path",
352
- templatePath: "templatePath",
353
- listingHandle: "listingHandle",
354
- entityType: "entityType",
355
- filterQuery: "filterQuery",
356
- relationField: "relationField",
357
- relationTarget: "relationTarget",
358
- excludeCurrent: "excludeCurrent",
359
- period: "period",
360
- startDate: "startDate",
361
- endDate: "endDate",
362
- severity: "severity",
363
- check: "check",
364
- status: "status",
365
- provider: "provider",
366
- tenant: "tenant",
367
- tenantIds: "tenantIds",
368
- versionId: "versionId",
369
- facets: "facets"
384
+ var maxRenderMs = 3e3;
385
+ var maxOutputBytes = 1024 * 1024;
386
+ var maxTemplateChars = 128 * 1024;
387
+ var maxPackageChars = 4 * 1024 * 1024;
388
+ var maxIterations = 1e6;
389
+ var maxIncludeDepth = 8;
390
+ var maxContextDepth = 12;
391
+ var maxContextArray = 1e3;
392
+ var maxContextKeys = 500;
393
+ var publicContextKeys = /* @__PURE__ */ new Set(["shop", "settings", "routes", "page", "collection", "contentCollections", "linkTargets", "localization", "search", "entities", "forms", "contentLoading", "contentError", "pageTitle", "section", "item"]);
394
+ var privateField = /^(?:__proto__|prototype|constructor|password|secret|token|access[_-]?token|refresh[_-]?token|api[_-]?key|private[_-]?key|notification[_-]?emails|internal[_-]?notes)$/i;
395
+ var allowedTags = /* @__PURE__ */ new Set(["assign", "for", "capture", "case", "comment", "cycle", "if", "unless", "break", "continue", "echo", "raw", "liquid", "#", "tablerow", "increment", "decrement", "render", "section"]);
396
+ var allowedFilters = /* @__PURE__ */ new Set([
397
+ "abs",
398
+ "append",
399
+ "at_least",
400
+ "at_most",
401
+ "capitalize",
402
+ "ceil",
403
+ "compact",
404
+ "concat",
405
+ "date",
406
+ "default",
407
+ "divided_by",
408
+ "downcase",
409
+ "escape",
410
+ "escape_once",
411
+ "first",
412
+ "floor",
413
+ "join",
414
+ "last",
415
+ "lstrip",
416
+ "map",
417
+ "minus",
418
+ "modulo",
419
+ "newline_to_br",
420
+ "plus",
421
+ "prepend",
422
+ "remove",
423
+ "remove_first",
424
+ "replace",
425
+ "replace_first",
426
+ "reverse",
427
+ "round",
428
+ "rstrip",
429
+ "size",
430
+ "slice",
431
+ "sort",
432
+ "sort_natural",
433
+ "split",
434
+ "strip",
435
+ "strip_html",
436
+ "strip_newlines",
437
+ "times",
438
+ "truncate",
439
+ "truncatewords",
440
+ "uniq",
441
+ "upcase",
442
+ "url_encode",
443
+ "where",
444
+ "assetUrl",
445
+ "stylesheetTag",
446
+ "scriptTag",
447
+ "t",
448
+ "json",
449
+ "imageUrl",
450
+ "richtext",
451
+ "localizeUrl"
452
+ ]);
453
+ var defaultTemplate = liquidThemeTemplatePaths.index;
454
+ var defaultLayout = "theme";
455
+ var isSafePartialName = (name) => /^[a-zA-Z0-9][a-zA-Z0-9/_-]{0,127}(?:\.liquid|\.html)?$/.test(name) && !name.includes("//");
456
+ var blockTagPatterns = [
457
+ /\{%\s*schema\s*%\}[\s\S]*?\{%\s*endschema\s*%\}/gi,
458
+ /\{%\s*stylesheet\s*%\}[\s\S]*?\{%\s*endstylesheet\s*%\}/gi,
459
+ /\{%\s*javascript\s*%\}[\s\S]*?\{%\s*endjavascript\s*%\}/gi,
460
+ /\{%\s*entityQuery\b[^%]*%\}/gi
461
+ ];
462
+ var themePostMessageEvents = {
463
+ select: "THEME_CUSTOMIZER_SELECT"
370
464
  };
465
+ var customCssKey = "customCss";
466
+
467
+ // ../cms-core/dist/chunk-WTGNSAFO.js
371
468
  var defaultLanguageCode = "en";
372
469
  var languageStatusConstants = {
373
470
  active: "1",
@@ -382,6 +479,8 @@ var languageFormStatusOptions = [
382
479
  { label: "Active", value: languageStatusConstants.active },
383
480
  { label: "Inactive", value: languageStatusConstants.inactive }
384
481
  ];
482
+
483
+ // ../cms-core/dist/constants/index.js
385
484
  var themePageTypes = {
386
485
  singlePage: "single-page",
387
486
  collectionDetail: "collection-detail",
@@ -392,18 +491,6 @@ var categoryRouteKinds = {
392
491
  collections: themePageTypes.collectionListing,
393
492
  details: themePageTypes.collectionDetail
394
493
  };
395
- var staticThemeFolderNames = {
396
- root: "static"
397
- };
398
- var staticThemeHomeFileName = `index${themeFileExtensions.html}`;
399
- var staticThemeHomeFilePattern = new RegExp(`/index${themeFileExtensions.html.replace(".", "\\.")}?$`, "i");
400
- var staticThemeHtmlExtensionPattern = new RegExp(`${themeFileExtensions.html.replace(".", "\\.")}?$`, "i");
401
- var staticThemeHomePath = `${staticThemeFolderNames.root}/${staticThemeHomeFileName}`;
402
- var staticThemeAllowedDirectories = [staticThemeFolderNames.root];
403
- var themeAssetUrlPatterns = {
404
- safeExternalUrl: /^(?:https?:|blob:)/i,
405
- safeDataUrl: /^data:(?:image|video|audio|font)\//i
406
- };
407
494
 
408
495
  // src/lib/hash.ts
409
496
  import { createHash } from "crypto";
@@ -434,7 +521,11 @@ export {
434
521
  __toESM,
435
522
  CliError,
436
523
  ApiError,
524
+ defaultLanguageCode,
437
525
  customFieldTypeConstants,
526
+ entityKinds,
527
+ queryKeys,
528
+ liquidAssetUrlPatterns,
438
529
  themeFileExtensions,
439
530
  themeTemplateCategoryKeys,
440
531
  themeTemplateCategories,
@@ -449,14 +540,30 @@ export {
449
540
  liquidTemplateLimits,
450
541
  themeSettingTypeConstants,
451
542
  themeEntityBindingSource,
452
- themeLinkTargetKinds,
453
- entityKinds,
454
- queryKeys,
455
- defaultLanguageCode,
456
543
  staticThemeFolderNames,
457
544
  staticThemeHomePath,
458
545
  themeAssetUrlPatterns,
546
+ themeLinkTargetKinds,
547
+ maxRenderMs,
548
+ maxOutputBytes,
549
+ maxTemplateChars,
550
+ maxPackageChars,
551
+ maxIterations,
552
+ maxIncludeDepth,
553
+ maxContextDepth,
554
+ maxContextArray,
555
+ maxContextKeys,
556
+ publicContextKeys,
557
+ privateField,
558
+ allowedTags,
559
+ allowedFilters,
560
+ defaultTemplate,
561
+ defaultLayout,
562
+ isSafePartialName,
563
+ blockTagPatterns,
564
+ themePostMessageEvents,
565
+ customCssKey,
459
566
  sha256Hex,
460
567
  diffHashes
461
568
  };
462
- //# sourceMappingURL=chunk-UOEFVNM4.js.map
569
+ //# sourceMappingURL=chunk-VY553LTO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/errors.ts","../../cms-core/src/constants/content-model/custom-fields.constants.ts","../../cms-core/src/constants/content-model/entity.constants.ts","../../cms-core/src/constants/http/query-keys.constants.ts","../../cms-core/src/constants/liquid/render/asset.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/static-theme.constants.ts","../../cms-core/src/constants/theme/theme-assets.constants.ts","../../cms-core/src/constants/theme/theme-link-target.constants.ts","../../cms-core/src/constants/liquid/render/renderer.constants.ts","../../cms-core/src/constants/liquid/render/theme-editor.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","../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 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 versionId: 'versionId',\n facets: 'facets',\n} as const;\n","export const liquidAssetUrlPatterns = {\n themeAssetPrefix: /^assets\\//i,\n} as const;\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\nexport const themeEntityQueryTag = 'entityQuery' as const;\n\n// {% entityQuery \"type\", \"handle\", key: value %}: group 1 type, group 2 handle, group 3 the options\nexport const liquidEntityQueryPattern = new RegExp(\n `\\\\{%\\\\s*${themeEntityQueryTag}\\\\s+[\"']([a-zA-Z0-9_-]+)[\"']\\\\s*,\\\\s*[\"']([a-zA-Z0-9_-]+)[\"']\\\\s*((?:,\\\\s*[a-zA-Z][a-zA-Z0-9]*\\\\s*:\\\\s*(?:\"[^\"]*\"|'[^']*'|[^,\\\\s]+)\\\\s*)*)%\\\\}`,\n 'g',\n);\nexport const liquidEntityQueryOptionPattern = /([a-zA-Z][a-zA-Z0-9]*)\\s*:\\s*(?:\"([^\"]*)\"|'([^']*)'|([^,\\s]+))/g;\n\nexport const liquidTemplateLimits = {\n templateMaxBytes: 200 * 1024,\n renderTimeoutMs: 500,\n renderMemoryBytes: 20 * 1024 * 1024,\n} as const;\n\nexport const themeSettingTypeConstants = {\n entity: 'entity',\n collection: 'collection',\n} as const;\n\nexport const themeEntityBindingSource = 'entity' as const;\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","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","import { liquidThemeTemplatePaths } from '../../theme';\n\nexport const maxRenderMs = 3000;\nexport const maxOutputBytes = 1024 * 1024;\nexport const maxTemplateChars = 128 * 1024;\nexport const maxPackageChars = 4 * 1024 * 1024;\nexport const maxIterations = 1000000;\nexport const maxIncludeDepth = 8;\nexport const maxContextDepth = 12;\nexport const maxContextArray = 1000;\nexport const maxContextKeys = 500;\n\nexport const publicContextKeys = new Set(['shop', 'settings', 'routes', 'page', 'collection', 'contentCollections', 'linkTargets', 'localization', 'search', 'entities', 'forms', 'contentLoading', 'contentError', 'pageTitle', 'section', 'item']);\n\nexport const privateField = /^(?:__proto__|prototype|constructor|password|secret|token|access[_-]?token|refresh[_-]?token|api[_-]?key|private[_-]?key|notification[_-]?emails|internal[_-]?notes)$/i;\n\nexport const allowedTags = new Set(['assign', 'for', 'capture', 'case', 'comment', 'cycle', 'if', 'unless', 'break', 'continue', 'echo', 'raw', 'liquid', '#', 'tablerow', 'increment', 'decrement', 'render', 'section']);\n\nexport const allowedFilters = new Set([\n 'abs', 'append', 'at_least', 'at_most', 'capitalize', 'ceil', 'compact', 'concat', 'date', 'default', 'divided_by',\n 'downcase', 'escape', 'escape_once', 'first', 'floor', 'join', 'last', 'lstrip', 'map', 'minus', 'modulo', 'newline_to_br',\n 'plus', 'prepend', 'remove', 'remove_first', 'replace', 'replace_first', 'reverse', 'round', 'rstrip', 'size', 'slice',\n 'sort', 'sort_natural', 'split', 'strip', 'strip_html', 'strip_newlines', 'times', 'truncate', 'truncatewords', 'uniq',\n 'upcase', 'url_encode', 'where', 'assetUrl', 'stylesheetTag', 'scriptTag', 't', 'json', 'imageUrl', 'richtext', 'localizeUrl',\n]);\n\nexport const defaultTemplate = liquidThemeTemplatePaths.index;\n\nexport const defaultLayout = 'theme';\n\nexport const isSafePartialName = (name: string): boolean => /^[a-zA-Z0-9][a-zA-Z0-9/_-]{0,127}(?:\\.liquid|\\.html)?$/.test(name) && !name.includes('//');\n\nexport const blockTagPatterns = [\n /\\{%\\s*schema\\s*%\\}[\\s\\S]*?\\{%\\s*endschema\\s*%\\}/gi,\n /\\{%\\s*stylesheet\\s*%\\}[\\s\\S]*?\\{%\\s*endstylesheet\\s*%\\}/gi,\n /\\{%\\s*javascript\\s*%\\}[\\s\\S]*?\\{%\\s*endjavascript\\s*%\\}/gi,\n /\\{%\\s*entityQuery\\b[^%]*%\\}/gi,\n];\n","export const themePostMessageEvents = {\n select: 'THEME_CUSTOMIZER_SELECT',\n} as const;\n\nexport const themeCustomizerTabs = {\n sections: 'sections',\n themeSettings: 'themeSettings',\n} as const;\n\nexport const themeDeviceModes = {\n desktop: 'desktop',\n tablet: 'tablet',\n mobile: 'mobile',\n} as const;\n\nexport const customCssKey = 'customCss';\n\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 { 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;AAAA,EACX;AACJ;AAEA,IAAM,uBAAuB,CAAC,SAA0B;AACpD,MAAI,OAAO,SAAS,UAAU;AAC1B,WAAO;AAAA,EACX;A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C1D;AAEO,IAAM,aAAa,CACtB,MACA,UACY;AACZ,QAAM,QAAkB,CAAC;AACzB,QAAM,WAAqB,CAAC;AAC5B,QAAM,UAAoB,CAAC;AAE3B,aAAW,QAAQ,OAAO,KAAK,KAAK,EAAE,KAAK,GAAG;AAC1C,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":[]}
@@ -4,13 +4,13 @@ import {
4
4
  createFixturesDataSource,
5
5
  createLiveDataSource,
6
6
  normalizePreviewData
7
- } from "./chunk-3JOYRR5G.js";
8
- import "./chunk-IDKQZJPL.js";
9
- import "./chunk-UOEFVNM4.js";
7
+ } from "./chunk-OATE235V.js";
8
+ import "./chunk-UMGL5N53.js";
9
+ import "./chunk-VY553LTO.js";
10
10
  export {
11
11
  buildPreviewRequest,
12
12
  createFixturesDataSource,
13
13
  createLiveDataSource,
14
14
  normalizePreviewData
15
15
  };
16
- //# sourceMappingURL=data-source-BM6CEGRB.js.map
16
+ //# sourceMappingURL=data-source-I5BXXWXI.js.map
@@ -13,25 +13,25 @@ import {
13
13
  sendHtml,
14
14
  sendResponse,
15
15
  serveFile
16
- } from "./chunk-ME523CX2.js";
16
+ } from "./chunk-VDICVCKJ.js";
17
17
  import {
18
18
  isTextPath,
19
19
  readLocalTheme
20
- } from "./chunk-C5SWGZ55.js";
20
+ } from "./chunk-PEG6K5NX.js";
21
21
  import {
22
22
  buildPreviewRequest
23
- } from "./chunk-3JOYRR5G.js";
23
+ } from "./chunk-OATE235V.js";
24
24
  import {
25
25
  applyThemeCustomizerLocaleOverrides,
26
26
  ensureThemeStylesheetsBeforeContent,
27
27
  getThemeAssetUrls,
28
28
  resolveThemeMediaUrl,
29
29
  rewriteLiquidThemeAssetBuffers
30
- } from "./chunk-IDKQZJPL.js";
30
+ } from "./chunk-UMGL5N53.js";
31
31
  import {
32
32
  defaultLanguageCode,
33
33
  liquidThemeFolderNames
34
- } from "./chunk-UOEFVNM4.js";
34
+ } from "./chunk-VY553LTO.js";
35
35
 
36
36
  // src/lib/dev/server.ts
37
37
  import { join, resolve } from "path";
@@ -201,4 +201,4 @@ var startDevServer = async (options) => {
201
201
  export {
202
202
  startDevServer
203
203
  };
204
- //# sourceMappingURL=server-LYLM7BR3.js.map
204
+ //# sourceMappingURL=server-PV5PFQ7A.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/dev/server.ts","../src/lib/dev/render-page.ts"],"sourcesContent":["import type { IncomingMessage, ServerResponse } from 'node:http';\nimport type { AddressInfo } from 'node:net';\nimport { join, resolve } from 'node:path';\nimport { isTextPath, readLocalTheme } from '../theme-files';\nimport type { DataSource } from './data-source';\nimport { renderThemePage } from './render-page';\nimport { closeServer, createReloadHub, createRouteServer, linkListHtml, listenOnLocalhost, notFoundHtml, renderErrorPage, safeDecode, sendHtml, sendResponse, serveFile } from './server-shared';\n\nexport interface DevServerOptions {\n themeDir: string;\n port: number;\n templatePath: string;\n languageCode: string;\n countryCode?: string;\n dataSource: DataSource;\n}\n\nexport interface DevServer {\n url: string;\n notifyChanged: () => Promise<void>;\n close: () => Promise<void>;\n}\n\ninterface ThemeSnapshot {\n buffers: Record<string, string>;\n assetPaths: string[];\n}\n\nconst readThemeSnapshot = async (themeDir: string): Promise<ThemeSnapshot> => {\n const files = await readLocalTheme(themeDir);\n const buffers: Record<string, string> = {};\n const assetPaths: string[] = [];\n\n for (const file of files) {\n if (file.path.startsWith('assets/')) {\n assetPaths.push(file.path);\n }\n\n if (isTextPath(file.path)) {\n buffers[file.path] = new TextDecoder().decode(file.bytes);\n }\n }\n\n return { buffers, assetPaths };\n};\n\n// Dev server for one theme folder. The theme is read at start and again on each notifyChanged call.\nexport const startDevServer = async (options: DevServerOptions): Promise<DevServer> => {\n const themeDir = resolve(options.themeDir);\n const assetsDir = join(themeDir, 'assets');\n const reload = createReloadHub();\n let snapshot = await readThemeSnapshot(themeDir);\n\n const templatePathsOf = (): string[] => {\n return Object.keys(snapshot.buffers)\n .filter((path) => /^templates\\/[^/]+\\.json$/.test(path))\n .sort();\n };\n\n const renderTemplate = async (response: ServerResponse, templatePath: string, assetOrigin: string, path?: string): Promise<void> => {\n if (snapshot.buffers[templatePath] === undefined) {\n sendHtml(response, 404, notFoundHtml(`${templatePath} does not exist. See /__templates.`));\n return;\n }\n\n try {\n const data = await options.dataSource.load({ templatePath, buffers: snapshot.buffers, path });\n const html = await renderThemePage({\n buffers: snapshot.buffers,\n assetPaths: snapshot.assetPaths,\n templatePath,\n data,\n languageCode: options.languageCode,\n countryCode: options.countryCode,\n assetOrigin,\n });\n sendHtml(response, 200, html);\n } catch (error) {\n sendHtml(response, 500, renderErrorPage(error));\n }\n };\n\n const route = async (request: IncomingMessage, response: ServerResponse): Promise<void> => {\n if (request.method !== 'GET') {\n sendResponse(response, 405, { 'Content-Type': 'text/plain; charset=utf-8', Allow: 'GET' }, 'Method not allowed');\n return;\n }\n\n const pathname = new URL(request.url ?? '/', 'http://localhost').pathname;\n const address = server.address() as AddressInfo;\n const assetOrigin = `http://localhost:${address.port}`;\n\n if (pathname === '/__events') {\n reload.open(request, response);\n return;\n }\n\n if (pathname === '/__templates') {\n const links = templatePathsOf().map((path) => ({ href: `/t/${encodeURI(path)}`, label: path }));\n sendHtml(response, 200, linkListHtml('Templates', links));\n return;\n }\n\n if (pathname === '/__routes' && options.dataSource.listRoutes) {\n try {\n const routes = await options.dataSource.listRoutes();\n const links = routes.map((route) => ({ href: encodeURI(route.path), label: `${route.path} (${route.kind})` }));\n sendHtml(response, 200, linkListHtml('Routes', links));\n } catch (error) {\n sendHtml(response, 500, renderErrorPage(error));\n }\n\n return;\n }\n\n if (pathname.startsWith('/assets/')) {\n await serveFile(response, assetsDir, pathname.slice('/assets/'.length));\n return;\n }\n\n if (pathname === '/') {\n await renderTemplate(response, options.templatePath, assetOrigin);\n return;\n }\n\n if (pathname.startsWith('/t/')) {\n const templatePath = safeDecode(pathname.slice('/t/'.length));\n\n if (templatePath === null) {\n sendHtml(response, 400, notFoundHtml('Malformed template path.'));\n return;\n }\n\n await renderTemplate(response, templatePath, assetOrigin);\n return;\n }\n\n if (!options.dataSource.resolveRoute) {\n sendHtml(response, 404, notFoundHtml(`No route for ${pathname}.`));\n return;\n }\n\n let routedTemplatePath: string | null;\n\n try {\n routedTemplatePath = await options.dataSource.resolveRoute(pathname, templatePathsOf());\n } catch (error) {\n sendHtml(response, 500, renderErrorPage(error));\n return;\n }\n\n if (routedTemplatePath === null) {\n sendHtml(response, 404, notFoundHtml(`No route for ${pathname}. See /__routes.`));\n return;\n }\n\n await renderTemplate(response, routedTemplatePath, assetOrigin, pathname);\n };\n\n const server = createRouteServer(route);\n\n await listenOnLocalhost(server, options.port);\n\n const address = server.address() as AddressInfo;\n\n return {\n url: `http://localhost:${address.port}`,\n notifyChanged: async () => {\n snapshot = await readThemeSnapshot(themeDir);\n reload.broadcast();\n },\n close: () => closeServer(server, reload),\n };\n};\n","import { getThemeAssetUrls } from '@tomsher/cms-core/utils';\nimport { resolveThemeMediaUrl } from '@tomsher/cms-core/utils';\nimport { applyThemeCustomizerLocaleOverrides } from '@tomsher/cms-core/utils';\nimport { createLiquidFilters } from '@tomsher/cms-core/engine';\nimport { defaultLanguageCode } from '@tomsher/cms-core/constants';\nimport { ensureThemeStylesheetsBeforeContent, rewriteLiquidThemeAssetBuffers } from '@tomsher/cms-core/utils';\nimport { liquidThemeFolderNames } from '@tomsher/cms-core/constants';\nimport { renderLiquidThemeBundle } from '@tomsher/cms-core/engine';\nimport type { StorefrontLocalization } from '@tomsher/cms-core/types';\nimport { buildPreviewRequest, type PreviewData } from './data-source';\n\nexport interface RenderPageOptions {\n buffers: Record<string, string>;\n assetPaths: string[];\n templatePath: string;\n data: PreviewData;\n languageCode: string;\n countryCode?: string;\n assetOrigin: string;\n}\n\nconst buildLocalization = (languageCode: string, countryCode?: string): StorefrontLocalization => {\n return {\n country: countryCode ? { name: countryCode, countryCode } : undefined,\n language: { languageCode, languageName: languageCode },\n availableCountries: [],\n availableLanguages: [],\n };\n};\n\n// Same page context shape as useThemeVisualBuilderPreview.\nconst buildPageContext = (data: PreviewData): Record<string, unknown> => {\n if (!data.page) {\n return {};\n }\n\n const entry = (data.page.entry as Record<string, unknown> | undefined) ?? {};\n\n return {\n page: { ...entry, entity: data.page.entity, type: data.page.type },\n collection: data.collection,\n };\n};\n\n// Renders one template the way the admin editor preview does. Throws on render failure.\nexport const renderThemePage = async (options: RenderPageOptions): Promise<string> => {\n const { buffers, assetPaths, templatePath, data, languageCode, countryCode, assetOrigin } = options;\n const localizedBuffers = applyThemeCustomizerLocaleOverrides(buffers, languageCode, defaultLanguageCode);\n const assetFiles = assetPaths.map((path) => ({ path, fileUrl: `${assetOrigin}/${path}` }));\n const themeAssetUrls = getThemeAssetUrls(assetFiles, liquidThemeFolderNames.assets, resolveThemeMediaUrl);\n const previewBuffers = rewriteLiquidThemeAssetBuffers(localizedBuffers, themeAssetUrls);\n const localization = buildLocalization(languageCode, countryCode);\n const customFilters = createLiquidFilters({ fileBuffers: localizedBuffers, activeLocale: languageCode, localization });\n const { entities: entityQueries } = buildPreviewRequest(buffers, templatePath);\n const renderedHtml = await renderLiquidThemeBundle(previewBuffers, {\n customFilters,\n themeAssetUrls,\n templatePath,\n context: {\n entities: data.entities,\n contentCollections: data.contentCollections,\n entityQueries,\n linkTargets: data.linkTargets ?? {},\n contentLoading: false,\n localization,\n ...buildPageContext(data),\n },\n });\n\n return ensureThemeStylesheetsBeforeContent(renderedHtml);\n};\n"],"mappings":";;;;;;;;;;;;;;;;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
14
  serveFile
15
- } from "./chunk-ME523CX2.js";
15
+ } from "./chunk-VDICVCKJ.js";
16
16
  import {
17
17
  isTextPath
18
- } from "./chunk-C5SWGZ55.js";
19
- import "./chunk-IDKQZJPL.js";
18
+ } from "./chunk-PEG6K5NX.js";
19
+ import "./chunk-UMGL5N53.js";
20
20
  import {
21
21
  CliError,
22
22
  staticThemeFolderNames,
23
23
  staticThemeHomePath,
24
24
  themeFileExtensions
25
- } from "./chunk-UOEFVNM4.js";
25
+ } from "./chunk-VY553LTO.js";
26
26
 
27
27
  // src/lib/dev/static-server.ts
28
28
  import { readdir, readFile } from "fs/promises";
@@ -129,4 +129,4 @@ var startStaticDevServer = async (options) => {
129
129
  export {
130
130
  startStaticDevServer
131
131
  };
132
- //# sourceMappingURL=static-server-FTGVF5XC.js.map
132
+ //# sourceMappingURL=static-server-7NG4AY2E.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/dev/static-server.ts"],"sourcesContent":["import { readdir, readFile } from 'node:fs/promises';\nimport type { IncomingMessage, ServerResponse } from 'node:http';\nimport type { AddressInfo } from 'node:net';\nimport { join, relative, resolve, sep } from 'node:path';\nimport { staticThemeFolderNames, staticThemeHomePath, themeFileExtensions } from '@tomsher/cms-core/constants';\nimport { renderStaticHtmlTheme } from '@tomsher/cms-core/engine';\nimport { CliError } from '../errors';\nimport { isTextPath } from '../theme-files';\nimport type { DevServer } from './server';\nimport { closeServer, createReloadHub, createRouteServer, linkListHtml, listenOnLocalhost, notFoundHtml, renderErrorPage, safeDecode, sendHtml, sendResponse, serveFile } from './server-shared';\n\nexport interface StaticDevServerOptions {\n themeDir: string;\n port: number;\n}\n\ninterface StaticSnapshot {\n files: Record<string, string>;\n assetUrls: Record<string, string>;\n}\n\nconst staticRootPrefix = `${staticThemeFolderNames.root}/`;\nconst staticFilesPrefix = '/static-files/';\nconst htmlExtension = themeFileExtensions.html;\n\n// Text files are renderer sources. Every non-HTML file gets a local URL that the dev server serves from disk.\nconst readStaticSnapshot = async (themeDir: string): Promise<StaticSnapshot> => {\n const staticDir = join(themeDir, staticThemeFolderNames.root);\n const entries = await readdir(staticDir, { recursive: true, withFileTypes: true }).catch((error: NodeJS.ErrnoException) => {\n if (error.code === 'ENOENT') {\n throw new CliError(`No ${staticThemeFolderNames.root}/ folder in ${themeDir}. Pass --mode liquid for a liquid theme.`);\n }\n\n throw error;\n });\n const files: Record<string, string> = {};\n const assetUrls: Record<string, string> = {};\n\n for (const entry of entries) {\n if (!entry.isFile()) {\n continue;\n }\n\n const absolutePath = join(entry.parentPath, entry.name);\n const path = relative(themeDir, absolutePath).split(sep).join('/');\n const relativePath = path.slice(staticRootPrefix.length);\n\n if (!path.toLowerCase().endsWith(htmlExtension)) {\n assetUrls[path] = `${staticFilesPrefix}${relativePath.split('/').map(encodeURIComponent).join('/')}`;\n }\n\n if (isTextPath(path)) {\n files[path] = new TextDecoder().decode(await readFile(absolutePath));\n }\n }\n\n return { files, assetUrls };\n};\n\n// Lookup order for a route: static/<route>.html, then static/<route>/index.html. The route \"\" is the home page.\nconst pageCandidates = (route: string): string[] => {\n const name = route.replace(/\\/+$/, '');\n\n if (name === '') {\n return [staticThemeHomePath];\n }\n\n if (name.endsWith(htmlExtension)) {\n return [`${staticRootPrefix}${name}`];\n }\n\n return [`${staticRootPrefix}${name}${htmlExtension}`, `${staticRootPrefix}${name}/index${htmlExtension}`];\n};\n\n// static/docs/index.html is served at /docs and static/index.html at /.\nconst routeOfPage = (path: string): string => {\n const name = path.slice(staticRootPrefix.length, -htmlExtension.length);\n\n return name === 'index' ? '/' : `/${name.replace(/\\/index$/, '')}`;\n};\n\n// Dev server for a static theme folder (static/ holds the pages and their assets). Files are re-read on each notifyChanged call.\nexport const startStaticDevServer = async (options: StaticDevServerOptions): Promise<DevServer> => {\n const themeDir = resolve(options.themeDir);\n const staticDir = join(themeDir, staticThemeFolderNames.root);\n const reload = createReloadHub();\n let snapshot = await readStaticSnapshot(themeDir);\n\n const renderPage = (response: ServerResponse, pathname: string, route: string): void => {\n const templatePath = pageCandidates(route).find((candidate) => snapshot.files[candidate] !== undefined);\n\n if (templatePath === undefined) {\n sendHtml(response, 404, notFoundHtml(`No page for ${pathname}. See /__templates.`));\n return;\n }\n\n try {\n const { documentHtml } = renderStaticHtmlTheme({ templatePath, files: snapshot.files, assetUrls: snapshot.assetUrls });\n sendHtml(response, 200, documentHtml ?? '');\n } catch (error) {\n sendHtml(response, 500, renderErrorPage(error));\n }\n };\n\n const handleRequest = async (request: IncomingMessage, response: ServerResponse): Promise<void> => {\n if (request.method !== 'GET') {\n sendResponse(response, 405, { 'Content-Type': 'text/plain; charset=utf-8', Allow: 'GET' }, 'Method not allowed');\n return;\n }\n\n const pathname = new URL(request.url ?? '/', 'http://localhost').pathname;\n\n if (pathname === '/__events') {\n reload.open(request, response);\n return;\n }\n\n if (pathname === '/__templates') {\n const links = Object.keys(snapshot.files)\n .filter((path) => path.toLowerCase().endsWith(htmlExtension))\n .sort()\n .map((path) => ({ href: encodeURI(routeOfPage(path)), label: path }));\n sendHtml(response, 200, linkListHtml('Pages', links));\n return;\n }\n\n if (pathname.startsWith(staticFilesPrefix)) {\n await serveFile(response, staticDir, pathname.slice(staticFilesPrefix.length));\n return;\n }\n\n const routePath = safeDecode(pathname.slice(1));\n\n if (routePath === null) {\n sendHtml(response, 400, notFoundHtml('Malformed page path.'));\n return;\n }\n\n renderPage(response, pathname, routePath);\n };\n\n const server = createRouteServer(handleRequest);\n\n await listenOnLocalhost(server, options.port);\n\n const address = server.address() as AddressInfo;\n\n return {\n url: `http://localhost:${address.port}`,\n notifyChanged: async () => {\n snapshot = await readStaticSnapshot(themeDir);\n reload.broadcast();\n },\n close: () => closeServer(server, reload),\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS,gBAAgB;AAGlC,SAAS,MAAM,UAAU,SAAS,WAAW;AAkB7C,IAAM,mBAAmB,GAAG,uBAAuB,IAAI;AACvD,IAAM,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;AAC7B;AAAA,IACJ;AAEA,QAAI,aAAa,gBAAgB;AAC7B,YAAM,QAAQ,OAAO,KAAK,SAAS,KAAK,EACnC,OAAO,CAAC,SAAS,KAAK,YAAY,EAAE,SAAS,aAAa,CAAC,EAC3D,KAAK,EACL,IAAI,CAAC,UAAU,EAAE,MAAM,UAAU,YAAY,IAAI,CAAC,GAAG,OAAO,KAAK,EAAE;AACxE,eAAS,UAAU,KAAK,aAAa,SAAS,KAAK,CAAC;AACpD;AAAA,IACJ;AAEA,QAAI,SAAS,WAAW,iBAAiB,GAAG;AACxC,YAAM,UAAU,UAAU,WAAW,SAAS,MAAM,kBAAkB,MAAM,CAAC;AAC7E;AAAA,IACJ;AAEA,UAAM,YAAY,WAAW,SAAS,MAAM,CAAC,CAAC;AAE9C,QAAI,cAAc,MAAM;AACpB,eAAS,UAAU,KAAK,aAAa,sBAAsB,CAAC;AAC5D;AAAA,IACJ;AAEA,eAAW,UAAU,UAAU,SAAS;AAAA,EAC5C;AAEA,QAAM,SAAS,kBAAkB,aAAa;AAE9C,QAAM,kBAAkB,QAAQ,QAAQ,IAAI;AAE5C,QAAM,UAAU,OAAO,QAAQ;AAE/B,SAAO;AAAA,IACH,KAAK,oBAAoB,QAAQ,IAAI;AAAA,IACrC,eAAe,YAAY;AACvB,iBAAW,MAAM,mBAAmB,QAAQ;AAC5C,aAAO,UAAU;AAAA,IACrB;AAAA,IACA,OAAO,MAAM,YAAY,QAAQ,MAAM;AAAA,EAC3C;AACJ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomsher/cms-theme-kit",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Pull a theme from a Tomsher CMS, edit it locally and push it back as a draft.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,8 +22,7 @@
22
22
  "sanitize-html": "^2.18.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@tomsher/cms-core": "0.1.4",
26
- "@tomsher/cms-theme-engines": "0.1.4",
25
+ "@tomsher/cms-core": "0.1.6",
27
26
  "@types/node": "^22.10.0",
28
27
  "tsup": "^8.5.0",
29
28
  "typescript": "^5.9.3",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/dev/data-source.ts","../../cms-theme-engines/src/utils/analysis/liquid-theme-template.utils.ts","../../cms-theme-engines/src/utils/static-editor/static-html-editor.utils.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { getLiquidThemeCollectionHandles, getLiquidThemeEntityQueries, getLiquidThemeEntitySources, getLiquidThemeReachableBuffers, getLiquidThemeTemplateCategory, requiresCurrentEntry } from '@tomsher/cms-theme-engines/utils';\nimport { themeTemplateCategoryKeys } from '@tomsher/cms-core/constants';\nimport { collectThemeLinkTargetReferences } from '@tomsher/cms-core/utils';\nimport type { CmsClient, RemoteRoute, ThemePreviewRequest } from '../cms-client';\nimport { CliError } from '../errors';\nimport { sha256Hex } from '../hash';\n\nexport interface PreviewData {\n entities: Record<string, Record<string, unknown>>;\n contentCollections: Record<string, unknown>;\n linkTargets?: Record<string, unknown>;\n page?: Record<string, unknown>;\n collection?: Record<string, unknown>;\n}\n\nexport interface DataSourceInput {\n templatePath: string;\n buffers: Record<string, string>;\n path?: string;\n}\n\nexport interface DataSource {\n load: (input: DataSourceInput) => Promise<PreviewData>;\n resolveRoute?: (path: string, templatePaths: string[]) => Promise<string | null>;\n listRoutes?: () => Promise<RemoteRoute[]>;\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => {\n return Boolean(value) && typeof value === 'object' && !Array.isArray(value);\n};\n\nconst emptyPreviewData = (): PreviewData => {\n return { entities: {}, contentCollections: {} };\n};\n\nconst hasLinkTargetReferences = (content: string): boolean => {\n try {\n return collectThemeLinkTargetReferences(JSON.parse(content)).length > 0;\n } catch {\n return false;\n }\n};\n\n// Mirrors useThemeVisualBuilderEntities in the admin editor.\nexport const buildPreviewRequest = (buffers: Record<string, string>, templatePath: string, path?: string): ThemePreviewRequest => {\n const reachable = getLiquidThemeReachableBuffers(buffers, templatePath);\n const category = getLiquidThemeTemplateCategory(templatePath);\n const page = category === themeTemplateCategoryKeys.collections || category === themeTemplateCategoryKeys.details ? { templatePath, category, ...(path ? { path } : {}) } : undefined;\n const entities = getLiquidThemeEntityQueries(reachable, templatePath).filter((query) => page || !requiresCurrentEntry(query));\n const contentCollections = getLiquidThemeCollectionHandles(buffers, templatePath);\n const sources = getLiquidThemeEntitySources(reachable, templatePath);\n\n const templatePaths = Object.keys(buffers).filter((path) => /^templates\\/[^/]+\\.json$/.test(path));\n const linkSources = Object.entries(buffers)\n .filter(([path, content]) => path.endsWith('.json') && hasLinkTargetReferences(content))\n .map(([, content]) => content);\n\n return { entities, contentCollections, sources, linkSources, templatePaths, page };\n};\n\n// The response is either the envelope { requestedData } or a bare payload; the editor reads requestedData.\nexport const normalizePreviewData = (raw: unknown): PreviewData => {\n const body = isRecord(raw) ? raw : {};\n let payload: Record<string, unknown> = body;\n\n if (isRecord(body.requestedData)) {\n payload = body.requestedData;\n } else if (isRecord(body.data)) {\n payload = body.data;\n }\n\n return {\n entities: isRecord(payload.entities) ? (payload.entities as PreviewData['entities']) : {},\n contentCollections: isRecord(payload.contentCollections) ? payload.contentCollections : {},\n linkTargets: isRecord(payload.linkTargets) ? payload.linkTargets : undefined,\n page: isRecord(payload.page) ? payload.page : undefined,\n collection: isRecord(payload.collection) ? payload.collection : undefined,\n };\n};\n\nexport const createFixturesDataSource = (themeDir: string): DataSource => {\n return {\n load: async ({ templatePath }) => {\n const fixturePath = join(themeDir, 'fixtures', templatePath.replace(/\\//g, '-'));\n let raw: string;\n\n try {\n raw = await readFile(fixturePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n return emptyPreviewData();\n }\n\n throw error;\n }\n\n try {\n return normalizePreviewData(JSON.parse(raw));\n } catch {\n throw new CliError(`${fixturePath} is not valid JSON.`);\n }\n },\n };\n};\n\nexport interface LiveDataSourceOptions {\n client: CmsClient;\n themeId: string;\n countryCode?: string;\n}\n\nconst hasPreviewWork = (request: ThemePreviewRequest): boolean => {\n return request.entities.length > 0 || request.contentCollections.length > 0 || request.linkSources.length > 0 || Boolean(request.page);\n};\n\n// The key covers the query inputs only, so markup and CSS edits that keep the same queries reuse the cached data.\nconst cacheKeyOf = (request: ThemePreviewRequest): string => {\n const keyInput = { entities: request.entities, contentCollections: request.contentCollections, linkSources: request.linkSources, templatePaths: request.templatePaths, page: request.page };\n return sha256Hex(new TextEncoder().encode(JSON.stringify(keyInput)));\n};\n\n// Cached until the process restarts; a restart is also the only time theme metadata is read again.\nexport const createLiveDataSource = (options: LiveDataSourceOptions): DataSource => {\n const cache = new Map<string, Promise<PreviewData>>();\n\n return {\n resolveRoute: (path, templatePaths) => options.client.resolveRoute(options.themeId, path, templatePaths, options.countryCode),\n listRoutes: () => options.client.listRoutes(options.themeId, options.countryCode),\n load: async ({ buffers, templatePath, path }) => {\n const request = buildPreviewRequest(buffers, templatePath, path);\n\n if (!hasPreviewWork(request)) {\n return emptyPreviewData();\n }\n\n const key = cacheKeyOf(request);\n const cached = cache.get(key);\n\n if (cached) {\n return cached;\n }\n\n const pending = options.client\n .previewData(options.themeId, request, options.countryCode)\n .then(normalizePreviewData);\n\n cache.set(key, pending);\n pending.catch(() => {\n if (cache.get(key) === pending) {\n cache.delete(key);\n }\n });\n\n return pending;\n },\n };\n};\n","import { themeTemplateCategories, themeTemplateCategoryKeys, type ThemeTemplateCategory } from '@tomsher/cms-core/constants';\nimport { liquidThemeFolderNames, liquidThemeTemplatePaths } from '@tomsher/cms-core/constants';\n\nexport const getLiquidThemeTemplateCategory = (path: string): ThemeTemplateCategory | 'system' | null => {\n if (path === liquidThemeTemplatePaths.index) return themeTemplateCategoryKeys.pages;\n if (path === liquidThemeTemplatePaths.collection) return themeTemplateCategoryKeys.collections;\n if (path === liquidThemeTemplatePaths.entityDetails) return themeTemplateCategoryKeys.details;\n if (path === liquidThemeTemplatePaths.notFound) return themeTemplateCategoryKeys.system;\n\n for (const category of Object.keys(themeTemplateCategories) as (keyof typeof themeTemplateCategories)[]) {\n const prefix = themeTemplateCategories[category].prefix;\n if (!prefix) continue;\n const categoryPrefix = `${liquidThemeFolderNames.templates}/${prefix}`;\n const name = path.startsWith(categoryPrefix) ? path.slice(categoryPrefix.length) : '';\n if (/^[a-z0-9][a-z0-9_-]*\\.json$/.test(name)) return category;\n }\n return null;\n};\n\nexport const getLiquidThemeTemplateTitle = (path: string, category?: ThemeTemplateCategory): string => {\n if (path === liquidThemeTemplatePaths.index) return 'Home page';\n if (path === liquidThemeTemplatePaths.collection) return 'Collection';\n if (path === liquidThemeTemplatePaths.entityDetails) return 'Entity details';\n\n const templateCategory = category || getLiquidThemeTemplateCategory(path);\n const prefix = templateCategory && templateCategory !== themeTemplateCategoryKeys.system ? themeTemplateCategories[templateCategory].prefix : null;\n const templateName = path.replace(`${liquidThemeFolderNames.templates}/`, '').replace(/\\.json$/, '').replace(prefix || '', '');\n return templateName.replace(/[-_]/g, ' ').replace(/\\b\\w/g, (letter) => letter.toUpperCase());\n};\n\nexport const createLiquidThemeTemplatePath = (category: ThemeTemplateCategory, name: string): string =>\n `${liquidThemeFolderNames.templates}/${themeTemplateCategories[category].prefix}${name}.json`;\n","import { staticThemeFolderNames, staticThemeHtmlExtensionPattern } from '@tomsher/cms-core/constants';\n\nexport const getStaticHtmlPaths = (files: Array<{ path: string }>): string[] =>\n files\n .map((file) => file.path)\n .filter((path) => path.startsWith(`${staticThemeFolderNames.root}/`) && staticThemeHtmlExtensionPattern.test(path))\n .sort();\n\nexport const getStaticHtmlPageOptions = (paths: string[]) => paths.map((path) => ({ value: path, label: path }));\n\nexport const getStaticHtmlPageContent = (\n selectedPath: string,\n fileBuffers: Record<string, string | undefined>,\n files: Array<{ path: string; content?: string | null }>,\n): string => selectedPath ? fileBuffers[selectedPath] ?? files.find((file) => file.path === selectedPath)?.content ?? '' : '';\n"],"mappings":";;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