@tomsher/cms-theme-kit 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
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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QAAQ,OACnB,YAAY,QAAQ,SAAS,SAAS,QAAQ,WAAW,EACzD,KAAK,oBAAoB;AAE9B,YAAM,IAAI,KAAK,OAAO;AACtB,cAAQ,MAAM,MAAM;AAChB,YAAI,MAAM,IAAI,GAAG,MAAM,SAAS;AAC5B,gBAAM,OAAO,GAAG;AAAA,QACpB;AAAA,MACJ,CAAC;AAED,aAAO;AAAA,IACX;AAAA,EACJ;AACJ;","names":["path"]}
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  liquidThemeAllowedDirectories,
4
4
  sha256Hex
5
- } from "./chunk-JNTSZZHB.js";
5
+ } from "./chunk-UOEFVNM4.js";
6
6
 
7
7
  // src/lib/theme-files.ts
8
8
  import { readdir, readFile } from "fs/promises";
@@ -53,4 +53,4 @@ export {
53
53
  readLocalTheme,
54
54
  toHashMap
55
55
  };
56
- //# sourceMappingURL=chunk-O6HJD7DS.js.map
56
+ //# sourceMappingURL=chunk-C5SWGZ55.js.map
@@ -13,9 +13,11 @@ import {
13
13
  themeAssetUrlPatterns,
14
14
  themeCustomizerLocaleNamespace,
15
15
  themeCustomizerLocalizedSettingTypes,
16
+ themeEntityBindingSource,
16
17
  themeFileExtensions,
17
- themeLinkTargetKinds
18
- } from "./chunk-JNTSZZHB.js";
18
+ themeLinkTargetKinds,
19
+ themeSettingTypeConstants
20
+ } from "./chunk-UOEFVNM4.js";
19
21
 
20
22
  // ../node_modules/lodash/isArray.js
21
23
  var require_isArray = __commonJS({
@@ -873,101 +875,6 @@ var require_get = __commonJS({
873
875
  }
874
876
  });
875
877
 
876
- // ../cms-theme-engines/dist/chunk-HLWHVLM3.js
877
- var liquidAssetUrlPatterns = {
878
- themeAssetPrefix: /^assets\//i
879
- };
880
- var maxRenderMs = 3e3;
881
- var maxOutputBytes = 1024 * 1024;
882
- var maxTemplateChars = 128 * 1024;
883
- var maxPackageChars = 4 * 1024 * 1024;
884
- var maxIterations = 1e6;
885
- var maxIncludeDepth = 8;
886
- var maxContextDepth = 12;
887
- var maxContextArray = 1e3;
888
- var maxContextKeys = 500;
889
- var publicContextKeys = /* @__PURE__ */ new Set(["shop", "settings", "routes", "page", "collection", "contentCollections", "linkTargets", "localization", "search", "entities", "forms", "contentLoading", "contentError", "pageTitle", "section", "item"]);
890
- var privateField = /^(?:__proto__|prototype|constructor|password|secret|token|access[_-]?token|refresh[_-]?token|api[_-]?key|private[_-]?key|notification[_-]?emails|internal[_-]?notes)$/i;
891
- var allowedTags = /* @__PURE__ */ new Set(["assign", "for", "capture", "case", "comment", "cycle", "if", "unless", "break", "continue", "echo", "raw", "liquid", "#", "tablerow", "increment", "decrement", "render", "section"]);
892
- var allowedFilters = /* @__PURE__ */ new Set([
893
- "abs",
894
- "append",
895
- "at_least",
896
- "at_most",
897
- "capitalize",
898
- "ceil",
899
- "compact",
900
- "concat",
901
- "date",
902
- "default",
903
- "divided_by",
904
- "downcase",
905
- "escape",
906
- "escape_once",
907
- "first",
908
- "floor",
909
- "join",
910
- "last",
911
- "lstrip",
912
- "map",
913
- "minus",
914
- "modulo",
915
- "newline_to_br",
916
- "plus",
917
- "prepend",
918
- "remove",
919
- "remove_first",
920
- "replace",
921
- "replace_first",
922
- "reverse",
923
- "round",
924
- "rstrip",
925
- "size",
926
- "slice",
927
- "sort",
928
- "sort_natural",
929
- "split",
930
- "strip",
931
- "strip_html",
932
- "strip_newlines",
933
- "times",
934
- "truncate",
935
- "truncatewords",
936
- "uniq",
937
- "upcase",
938
- "url_encode",
939
- "where",
940
- "assetUrl",
941
- "stylesheetTag",
942
- "scriptTag",
943
- "t",
944
- "json",
945
- "imageUrl",
946
- "richtext",
947
- "localizeUrl"
948
- ]);
949
- var defaultTemplate = liquidThemeTemplatePaths.index;
950
- var defaultLayout = "theme";
951
- var isSafePartialName = (name) => /^[a-zA-Z0-9][a-zA-Z0-9/_-]{0,127}(?:\.liquid|\.html)?$/.test(name) && !name.includes("//");
952
- var blockTagPatterns = [
953
- /\{%\s*schema\s*%\}[\s\S]*?\{%\s*endschema\s*%\}/gi,
954
- /\{%\s*stylesheet\s*%\}[\s\S]*?\{%\s*endstylesheet\s*%\}/gi,
955
- /\{%\s*javascript\s*%\}[\s\S]*?\{%\s*endjavascript\s*%\}/gi,
956
- /\{%\s*entityQuery\b[^%]*%\}/gi
957
- ];
958
- var themeSettingTypeConstants = {
959
- entity: "entity",
960
- collection: "collection"
961
- };
962
- var themePostMessageEvents = {
963
- select: "THEME_CUSTOMIZER_SELECT"
964
- };
965
- var customCssKey = "customCss";
966
- var themeEntityBindingSource = "entity";
967
-
968
- // ../cms-theme-engines/dist/chunk-W3TDIWZX.js
969
- import sanitizeHtml from "sanitize-html";
970
-
971
878
  // ../cms-core/dist/utils/index.js
972
879
  var setTranslatableArrayFieldPathValue = (target, schemaFields, fieldPath, value, isTranslatable) => {
973
880
  const path = fieldPath.split(".");
@@ -1094,6 +1001,26 @@ var getThemeLinkTargetReferenceKey = (value) => {
1094
1001
  const reference = normalizeThemeLinkTargetReference(value);
1095
1002
  return reference ? JSON.stringify(reference) : null;
1096
1003
  };
1004
+ var collectThemeLinkTargetReferences = (value) => {
1005
+ const references = /* @__PURE__ */ new Map();
1006
+ const visit = (current) => {
1007
+ if (Array.isArray(current)) {
1008
+ current.forEach(visit);
1009
+ return;
1010
+ }
1011
+ if (!current || typeof current !== "object") return;
1012
+ if (current.kind === themeLinkTargetKinds.external) return;
1013
+ const reference = normalizeThemeLinkTargetReference(current);
1014
+ const key = reference && getThemeLinkTargetReferenceKey(reference);
1015
+ if (reference && key) {
1016
+ references.set(key, reference);
1017
+ return;
1018
+ }
1019
+ Object.values(current).forEach(visit);
1020
+ };
1021
+ visit(value);
1022
+ return [...references.values()];
1023
+ };
1097
1024
  var safeDecodeAssetPath = (path) => {
1098
1025
  try {
1099
1026
  return decodeURIComponent(path);
@@ -1167,7 +1094,95 @@ var renderThemeHtmlWithStylesheets = ({ html, stylesheets }) => {
1167
1094
  };
1168
1095
  var ensureThemeStylesheetsBeforeContent = (html) => renderThemeHtmlWithStylesheets(extractThemeStylesheets(html));
1169
1096
 
1170
- // ../cms-theme-engines/dist/chunk-W3TDIWZX.js
1097
+ // ../cms-theme-engines/dist/chunk-OAKZOSNS.js
1098
+ var liquidAssetUrlPatterns = {
1099
+ themeAssetPrefix: /^assets\//i
1100
+ };
1101
+ var maxRenderMs = 3e3;
1102
+ var maxOutputBytes = 1024 * 1024;
1103
+ var maxTemplateChars = 128 * 1024;
1104
+ var maxPackageChars = 4 * 1024 * 1024;
1105
+ var maxIterations = 1e6;
1106
+ var maxIncludeDepth = 8;
1107
+ var maxContextDepth = 12;
1108
+ var maxContextArray = 1e3;
1109
+ var maxContextKeys = 500;
1110
+ var publicContextKeys = /* @__PURE__ */ new Set(["shop", "settings", "routes", "page", "collection", "contentCollections", "linkTargets", "localization", "search", "entities", "forms", "contentLoading", "contentError", "pageTitle", "section", "item"]);
1111
+ var privateField = /^(?:__proto__|prototype|constructor|password|secret|token|access[_-]?token|refresh[_-]?token|api[_-]?key|private[_-]?key|notification[_-]?emails|internal[_-]?notes)$/i;
1112
+ var allowedTags = /* @__PURE__ */ new Set(["assign", "for", "capture", "case", "comment", "cycle", "if", "unless", "break", "continue", "echo", "raw", "liquid", "#", "tablerow", "increment", "decrement", "render", "section"]);
1113
+ var allowedFilters = /* @__PURE__ */ new Set([
1114
+ "abs",
1115
+ "append",
1116
+ "at_least",
1117
+ "at_most",
1118
+ "capitalize",
1119
+ "ceil",
1120
+ "compact",
1121
+ "concat",
1122
+ "date",
1123
+ "default",
1124
+ "divided_by",
1125
+ "downcase",
1126
+ "escape",
1127
+ "escape_once",
1128
+ "first",
1129
+ "floor",
1130
+ "join",
1131
+ "last",
1132
+ "lstrip",
1133
+ "map",
1134
+ "minus",
1135
+ "modulo",
1136
+ "newline_to_br",
1137
+ "plus",
1138
+ "prepend",
1139
+ "remove",
1140
+ "remove_first",
1141
+ "replace",
1142
+ "replace_first",
1143
+ "reverse",
1144
+ "round",
1145
+ "rstrip",
1146
+ "size",
1147
+ "slice",
1148
+ "sort",
1149
+ "sort_natural",
1150
+ "split",
1151
+ "strip",
1152
+ "strip_html",
1153
+ "strip_newlines",
1154
+ "times",
1155
+ "truncate",
1156
+ "truncatewords",
1157
+ "uniq",
1158
+ "upcase",
1159
+ "url_encode",
1160
+ "where",
1161
+ "assetUrl",
1162
+ "stylesheetTag",
1163
+ "scriptTag",
1164
+ "t",
1165
+ "json",
1166
+ "imageUrl",
1167
+ "richtext",
1168
+ "localizeUrl"
1169
+ ]);
1170
+ var defaultTemplate = liquidThemeTemplatePaths.index;
1171
+ var defaultLayout = "theme";
1172
+ var isSafePartialName = (name) => /^[a-zA-Z0-9][a-zA-Z0-9/_-]{0,127}(?:\.liquid|\.html)?$/.test(name) && !name.includes("//");
1173
+ var blockTagPatterns = [
1174
+ /\{%\s*schema\s*%\}[\s\S]*?\{%\s*endschema\s*%\}/gi,
1175
+ /\{%\s*stylesheet\s*%\}[\s\S]*?\{%\s*endstylesheet\s*%\}/gi,
1176
+ /\{%\s*javascript\s*%\}[\s\S]*?\{%\s*endjavascript\s*%\}/gi,
1177
+ /\{%\s*entityQuery\b[^%]*%\}/gi
1178
+ ];
1179
+ var themePostMessageEvents = {
1180
+ select: "THEME_CUSTOMIZER_SELECT"
1181
+ };
1182
+ var customCssKey = "customCss";
1183
+
1184
+ // ../cms-theme-engines/dist/chunk-X4AIS34X.js
1185
+ import sanitizeHtml from "sanitize-html";
1171
1186
  var import_get = __toESM(require_get(), 1);
1172
1187
  var import_get2 = __toESM(require_get(), 1);
1173
1188
  var formatImageUrl = (url) => {
@@ -1794,6 +1809,7 @@ export {
1794
1809
  isSafePartialName,
1795
1810
  customCssKey,
1796
1811
  localizeStorefrontUrl,
1812
+ collectThemeLinkTargetReferences,
1797
1813
  rewriteLiquidThemeAssetBuffers,
1798
1814
  getThemeAssetUrls,
1799
1815
  extractThemeStylesheets,
@@ -1835,4 +1851,4 @@ export {
1835
1851
  getLiquidThemeCollectionHandles,
1836
1852
  applyThemeCustomizerLocaleOverrides
1837
1853
  };
1838
- //# sourceMappingURL=chunk-NRS5OZJC.js.map
1854
+ //# sourceMappingURL=chunk-IDKQZJPL.js.map