@tomsher/cms-theme-kit 0.1.7 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +22 -8
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-PEG6K5NX.js → chunk-MHTCCMQU.js} +2 -2
- package/dist/{chunk-VY553LTO.js → chunk-NLFY255A.js} +61 -166
- package/dist/chunk-NLFY255A.js.map +1 -0
- package/dist/chunk-RR53HSKJ.js +158 -0
- package/dist/chunk-RR53HSKJ.js.map +1 -0
- package/dist/{chunk-OATE235V.js → chunk-VA6IQPFX.js} +27 -26
- package/dist/chunk-VA6IQPFX.js.map +1 -0
- package/dist/{chunk-VDICVCKJ.js → chunk-Z7WA4YHH.js} +1810 -251
- package/dist/chunk-Z7WA4YHH.js.map +1 -0
- package/dist/data-source-IVR7NX5Z.js +18 -0
- package/dist/{server-PV5PFQ7A.js → server-OIS3KTQY.js} +23 -14
- package/dist/server-OIS3KTQY.js.map +1 -0
- package/dist/{static-server-7NG4AY2E.js → static-server-LFDHJZB6.js} +7 -6
- package/dist/static-server-LFDHJZB6.js.map +1 -0
- package/package.json +2 -2
- package/dist/chunk-OATE235V.js.map +0 -1
- package/dist/chunk-UMGL5N53.js +0 -1761
- package/dist/chunk-UMGL5N53.js.map +0 -1
- package/dist/chunk-VDICVCKJ.js.map +0 -1
- package/dist/chunk-VY553LTO.js.map +0 -1
- package/dist/data-source-I5BXXWXI.js +0 -16
- package/dist/server-PV5PFQ7A.js.map +0 -1
- package/dist/static-server-7NG4AY2E.js.map +0 -1
- /package/dist/{chunk-PEG6K5NX.js.map → chunk-MHTCCMQU.js.map} +0 -0
- /package/dist/{data-source-I5BXXWXI.js.map → data-source-IVR7NX5Z.js.map} +0 -0
|
@@ -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/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;AAEA,MAAI,QAAQ,OAAO,SAAS,YAAY,aAAa,MAAM;AACvD,UAAM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AAC;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":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
buildPreviewRequest,
|
|
4
|
-
createFixturesDataSource,
|
|
5
|
-
createLiveDataSource,
|
|
6
|
-
normalizePreviewData
|
|
7
|
-
} from "./chunk-OATE235V.js";
|
|
8
|
-
import "./chunk-UMGL5N53.js";
|
|
9
|
-
import "./chunk-VY553LTO.js";
|
|
10
|
-
export {
|
|
11
|
-
buildPreviewRequest,
|
|
12
|
-
createFixturesDataSource,
|
|
13
|
-
createLiveDataSource,
|
|
14
|
-
normalizePreviewData
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=data-source-I5BXXWXI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,MAAM,eAAe;;;ACmB9B,IAAM,oBAAoB,CAAC,cAAsB,gBAAiD;AAC9F,SAAO;AAAA,IACH,SAAS,cAAc,EAAE,MAAM,aAAa,YAAY,IAAI;AAAA,IAC5D,UAAU,EAAE,cAAc,cAAc,aAAa;AAAA,IACrD,oBAAoB,CAAC;AAAA,IACrB,oBAAoB,CAAC;AAAA,EACzB;AACJ;AAGA,IAAM,mBAAmB,CAAC,SAA+C;AACrE,MAAI,CAAC,KAAK,MAAM;AACZ,WAAO,CAAC;AAAA,EACZ;AAEA,QAAM,QAAS,KAAK,KAAK,SAAiD,CAAC;AAE3E,SAAO;AAAA,IACH,MAAM,EAAE,GAAG,OAAO,QAAQ,KAAK,KAAK,QAAQ,MAAM,KAAK,KAAK,KAAK;AAAA,IACjE,YAAY,KAAK;AAAA,EACrB;AACJ;AAGO,IAAM,kBAAkB,OAAO,YAAgD;AAClF,QAAM,EAAE,SAAS,YAAY,cAAc,MAAM,cAAc,aAAa,YAAY,IAAI;AAC5F,QAAM,mBAAmB,oCAAoC,SAAS,cAAc,mBAAmB;AACvG,QAAM,aAAa,WAAW,IAAI,CAAC,UAAU,EAAE,MAAM,SAAS,GAAG,WAAW,IAAI,IAAI,GAAG,E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;AAEA,UAAM,eAAe,UAAU,oBAAoB,aAAa,QAAQ;AAAA,EAC5E;AAEA,QAAM,SAAS,kBAAkB,KAAK;AAEtC,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,kBAAkB,QAAQ;AAC3C,aAAO,UAAU;AAAA,IACrB;AAAA,IACA,OAAO,MAAM,YAAY,QAAQ,MAAM;AAAA,EAC3C;AACJ;","names":["address","route"]}
|
|
@@ -1 +0,0 @@
|
|
|
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,oBAAoB;AAC1B,IAAM,gBAAgB,oBAAoB;AAG1C,IAAM,qBAAqB,OAAO,aAA8C;AAC5E,QAAM,YAAY,KAAK,UAAU,uBAAuB,IAAI;AAC5D,QAAM,UAAU,MAAM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