@ikas/component-cli 1.4.0-beta.23 → 1.4.0-beta.231
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/build-tools.d.ts +37 -0
- package/dist/build-tools.d.ts.map +1 -0
- package/dist/build-tools.js +36 -0
- package/dist/build-tools.js.map +1 -0
- package/dist/commands/add-sections-to-page.d.ts +3 -0
- package/dist/commands/add-sections-to-page.d.ts.map +1 -0
- package/dist/commands/add-sections-to-page.js +39 -0
- package/dist/commands/add-sections-to-page.js.map +1 -0
- package/dist/commands/add-to-page.js +1 -1
- package/dist/commands/add-to-page.js.map +1 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +11 -2
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +23 -170
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/config-texts.d.ts +39 -0
- package/dist/commands/config-texts.d.ts.map +1 -0
- package/dist/commands/config-texts.js +192 -0
- package/dist/commands/config-texts.js.map +1 -0
- package/dist/commands/config.d.ts +45 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +1205 -154
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/create-design-tokens.d.ts +24 -0
- package/dist/commands/create-design-tokens.d.ts.map +1 -0
- package/dist/commands/create-design-tokens.js +388 -0
- package/dist/commands/create-design-tokens.js.map +1 -0
- package/dist/commands/create-global-variable.d.ts +3 -0
- package/dist/commands/create-global-variable.d.ts.map +1 -0
- package/dist/commands/create-global-variable.js +73 -0
- package/dist/commands/create-global-variable.js.map +1 -0
- package/dist/commands/create-page.d.ts +3 -0
- package/dist/commands/create-page.d.ts.map +1 -0
- package/dist/commands/create-page.js +31 -0
- package/dist/commands/create-page.js.map +1 -0
- package/dist/commands/delete-page.d.ts +3 -0
- package/dist/commands/delete-page.d.ts.map +1 -0
- package/dist/commands/delete-page.js +28 -0
- package/dist/commands/delete-page.js.map +1 -0
- package/dist/commands/delete-theme-globals.d.ts +4 -0
- package/dist/commands/delete-theme-globals.d.ts.map +1 -0
- package/dist/commands/delete-theme-globals.js +50 -0
- package/dist/commands/delete-theme-globals.js.map +1 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +328 -39
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/enable-builtin-pages.d.ts +3 -0
- package/dist/commands/enable-builtin-pages.d.ts.map +1 -0
- package/dist/commands/enable-builtin-pages.js +28 -0
- package/dist/commands/enable-builtin-pages.js.map +1 -0
- package/dist/commands/get-component-props.d.ts +3 -0
- package/dist/commands/get-component-props.d.ts.map +1 -0
- package/dist/commands/get-component-props.js +32 -0
- package/dist/commands/get-component-props.js.map +1 -0
- package/dist/commands/get-page-by-type.d.ts +3 -0
- package/dist/commands/get-page-by-type.d.ts.map +1 -0
- package/dist/commands/get-page-by-type.js +25 -0
- package/dist/commands/get-page-by-type.js.map +1 -0
- package/dist/commands/get-section-values.d.ts +3 -0
- package/dist/commands/get-section-values.d.ts.map +1 -0
- package/dist/commands/get-section-values.js +43 -0
- package/dist/commands/get-section-values.js.map +1 -0
- package/dist/commands/import.js +1 -1
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/list-builtin-pages.d.ts +3 -0
- package/dist/commands/list-builtin-pages.d.ts.map +1 -0
- package/dist/commands/list-builtin-pages.js +28 -0
- package/dist/commands/list-builtin-pages.js.map +1 -0
- package/dist/commands/list-entities.d.ts +3 -0
- package/dist/commands/list-entities.d.ts.map +1 -0
- package/dist/commands/list-entities.js +32 -0
- package/dist/commands/list-entities.js.map +1 -0
- package/dist/commands/list-imported.js +1 -1
- package/dist/commands/list-imported.js.map +1 -1
- package/dist/commands/list-page-sections.d.ts +3 -0
- package/dist/commands/list-page-sections.d.ts.map +1 -0
- package/dist/commands/list-page-sections.js +31 -0
- package/dist/commands/list-page-sections.js.map +1 -0
- package/dist/commands/list-pages.js +1 -1
- package/dist/commands/list-pages.js.map +1 -1
- package/dist/commands/list-theme-globals.d.ts +3 -0
- package/dist/commands/list-theme-globals.d.ts.map +1 -0
- package/dist/commands/list-theme-globals.js +22 -0
- package/dist/commands/list-theme-globals.js.map +1 -0
- package/dist/commands/list-translations.d.ts +3 -0
- package/dist/commands/list-translations.d.ts.map +1 -0
- package/dist/commands/list-translations.js +33 -0
- package/dist/commands/list-translations.js.map +1 -0
- package/dist/commands/move-page-section.d.ts +3 -0
- package/dist/commands/move-page-section.d.ts.map +1 -0
- package/dist/commands/move-page-section.js +62 -0
- package/dist/commands/move-page-section.js.map +1 -0
- package/dist/commands/publish-theme.d.ts +3 -0
- package/dist/commands/publish-theme.d.ts.map +1 -0
- package/dist/commands/publish-theme.js +29 -0
- package/dist/commands/publish-theme.js.map +1 -0
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +72 -3
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/remove-page-section.d.ts +3 -0
- package/dist/commands/remove-page-section.d.ts.map +1 -0
- package/dist/commands/remove-page-section.js +40 -0
- package/dist/commands/remove-page-section.js.map +1 -0
- package/dist/commands/search-products.d.ts +3 -0
- package/dist/commands/search-products.d.ts.map +1 -0
- package/dist/commands/search-products.js +40 -0
- package/dist/commands/search-products.js.map +1 -0
- package/dist/commands/translation-languages.d.ts +3 -0
- package/dist/commands/translation-languages.d.ts.map +1 -0
- package/dist/commands/translation-languages.js +43 -0
- package/dist/commands/translation-languages.js.map +1 -0
- package/dist/commands/update-builtin-page-prop.d.ts +3 -0
- package/dist/commands/update-builtin-page-prop.d.ts.map +1 -0
- package/dist/commands/update-builtin-page-prop.js +49 -0
- package/dist/commands/update-builtin-page-prop.js.map +1 -0
- package/dist/commands/update-global-variable.d.ts +3 -0
- package/dist/commands/update-global-variable.d.ts.map +1 -0
- package/dist/commands/update-global-variable.js +70 -0
- package/dist/commands/update-global-variable.js.map +1 -0
- package/dist/commands/update-page-sections.d.ts +3 -0
- package/dist/commands/update-page-sections.d.ts.map +1 -0
- package/dist/commands/update-page-sections.js +42 -0
- package/dist/commands/update-page-sections.js.map +1 -0
- package/dist/commands/update-section-prop.d.ts +3 -0
- package/dist/commands/update-section-prop.d.ts.map +1 -0
- package/dist/commands/update-section-prop.js +81 -0
- package/dist/commands/update-section-prop.js.map +1 -0
- package/dist/commands/update-translations.d.ts +3 -0
- package/dist/commands/update-translations.d.ts.map +1 -0
- package/dist/commands/update-translations.js +45 -0
- package/dist/commands/update-translations.js.map +1 -0
- package/dist/commands/upload-image.d.ts +3 -0
- package/dist/commands/upload-image.d.ts.map +1 -0
- package/dist/commands/upload-image.js +38 -0
- package/dist/commands/upload-image.js.map +1 -0
- package/dist/commands/upload-images.d.ts +3 -0
- package/dist/commands/upload-images.d.ts.map +1 -0
- package/dist/commands/upload-images.js +48 -0
- package/dist/commands/upload-images.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +66 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +77 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/archive-project.d.ts +50 -0
- package/dist/utils/archive-project.d.ts.map +1 -0
- package/dist/utils/archive-project.js +178 -0
- package/dist/utils/archive-project.js.map +1 -0
- package/dist/utils/compile.d.ts +17 -2
- package/dist/utils/compile.d.ts.map +1 -1
- package/dist/utils/compile.js +742 -109
- package/dist/utils/compile.js.map +1 -1
- package/dist/utils/component-helpers.d.ts +236 -4
- package/dist/utils/component-helpers.d.ts.map +1 -1
- package/dist/utils/component-helpers.js +656 -37
- package/dist/utils/component-helpers.js.map +1 -1
- package/dist/utils/css-import-resolver.d.ts +4 -1
- package/dist/utils/css-import-resolver.d.ts.map +1 -1
- package/dist/utils/css-import-resolver.js +9 -1
- package/dist/utils/css-import-resolver.js.map +1 -1
- package/dist/utils/dev-server-auth.d.ts +28 -0
- package/dist/utils/dev-server-auth.d.ts.map +1 -0
- package/dist/utils/dev-server-auth.js +79 -0
- package/dist/utils/dev-server-auth.js.map +1 -0
- package/dist/utils/editor-action-client.d.ts +20 -3
- package/dist/utils/editor-action-client.d.ts.map +1 -1
- package/dist/utils/editor-action-client.js +81 -19
- package/dist/utils/editor-action-client.js.map +1 -1
- package/dist/utils/esm-transform.d.ts +30 -0
- package/dist/utils/esm-transform.d.ts.map +1 -1
- package/dist/utils/esm-transform.js +169 -2
- package/dist/utils/esm-transform.js.map +1 -1
- package/dist/utils/find-component-for-file.d.ts +12 -0
- package/dist/utils/find-component-for-file.d.ts.map +1 -0
- package/dist/utils/find-component-for-file.js +24 -0
- package/dist/utils/find-component-for-file.js.map +1 -0
- package/dist/utils/forbid-deep-imports.d.ts +3 -0
- package/dist/utils/forbid-deep-imports.d.ts.map +1 -0
- package/dist/utils/forbid-deep-imports.js +54 -0
- package/dist/utils/forbid-deep-imports.js.map +1 -0
- package/dist/utils/forbid-external-packages.d.ts +26 -0
- package/dist/utils/forbid-external-packages.d.ts.map +1 -0
- package/dist/utils/forbid-external-packages.js +99 -0
- package/dist/utils/forbid-external-packages.js.map +1 -0
- package/dist/utils/i18n.d.ts +98 -0
- package/dist/utils/i18n.d.ts.map +1 -0
- package/dist/utils/i18n.js +408 -0
- package/dist/utils/i18n.js.map +1 -0
- package/dist/utils/load-image.d.ts +16 -0
- package/dist/utils/load-image.d.ts.map +1 -0
- package/dist/utils/load-image.js +50 -0
- package/dist/utils/load-image.js.map +1 -0
- package/dist/utils/storefront-t.d.ts +17 -0
- package/dist/utils/storefront-t.d.ts.map +1 -0
- package/dist/utils/storefront-t.js +187 -0
- package/dist/utils/storefront-t.js.map +1 -0
- package/dist/utils/vendor-storefront.d.ts +13 -0
- package/dist/utils/vendor-storefront.d.ts.map +1 -0
- package/dist/utils/vendor-storefront.js +91 -0
- package/dist/utils/vendor-storefront.js.map +1 -0
- package/dist/utils/websocket-server.d.ts +165 -7
- package/dist/utils/websocket-server.d.ts.map +1 -1
- package/dist/utils/websocket-server.js +326 -45
- package/dist/utils/websocket-server.js.map +1 -1
- package/package.json +19 -2
- package/templates/add/section.css +11 -0
- package/dist/commands/create.d.ts +0 -4
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js +0 -176
- package/dist/commands/create.js.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -13,10 +13,18 @@ export interface IkasComponentConfig {
|
|
|
13
13
|
projectId?: string;
|
|
14
14
|
/** Path to a global CSS file (e.g., "./src/global.css") — compiled but NOT scoped */
|
|
15
15
|
globalStyles?: string;
|
|
16
|
+
/** Path to the UI texts folder (e.g., "./src/i18n"): `default.json` and a `<locale>.json` per language */
|
|
17
|
+
i18n?: string;
|
|
16
18
|
components: ComponentDefinition[];
|
|
17
19
|
/** Custom type definitions received from the editor (for portability across projects) */
|
|
18
20
|
customTypes?: Array<Record<string, any>>;
|
|
19
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Translations keyed by locale, as the config holds them: `{ "en": { "displayName": "Heading" } }`.
|
|
24
|
+
* The base field (`name`, `displayName`, ...) is the default text; a locale's entry is that
|
|
25
|
+
* language's text. The CLI turns the map into the editor's record list (see `translationRecords`).
|
|
26
|
+
*/
|
|
27
|
+
export type ConfigTranslations<T> = Record<string, T>;
|
|
20
28
|
/**
|
|
21
29
|
* Definition of a single component in the project
|
|
22
30
|
*/
|
|
@@ -26,6 +34,14 @@ export interface ComponentDefinition {
|
|
|
26
34
|
entry: string;
|
|
27
35
|
styles: string;
|
|
28
36
|
props: ComponentProp[];
|
|
37
|
+
/**
|
|
38
|
+
* The component's name in an editor language (`en`), and a store language's default prop
|
|
39
|
+
* values (`propValues`, by prop name) over the config's `defaultValue`s.
|
|
40
|
+
*/
|
|
41
|
+
translations?: ConfigTranslations<{
|
|
42
|
+
name?: string;
|
|
43
|
+
propValues?: Record<string, unknown>;
|
|
44
|
+
}>;
|
|
29
45
|
/** Component type - 'component' (child of section) or 'section' (page-level section) */
|
|
30
46
|
type?: "component" | "section";
|
|
31
47
|
/** Mark this section as the store's header (only for type: "section") */
|
|
@@ -42,7 +58,30 @@ export interface ComponentPropGroup {
|
|
|
42
58
|
id: string;
|
|
43
59
|
name: string;
|
|
44
60
|
description?: string;
|
|
61
|
+
/** The group's name and description in an editor language (`en`). */
|
|
62
|
+
translations?: ConfigTranslations<{
|
|
63
|
+
name?: string;
|
|
64
|
+
description?: string;
|
|
65
|
+
}>;
|
|
45
66
|
children?: ComponentPropGroup[];
|
|
67
|
+
/**
|
|
68
|
+
* Conditional visibility ("Koşullu Prop"). Names a BOOLEAN or ENUM prop on this component; the
|
|
69
|
+
* group and everything under it are drawn in the editor's settings panel only while that prop
|
|
70
|
+
* satisfies the condition, and a required prop hidden this way stops blocking a publish.
|
|
71
|
+
*
|
|
72
|
+
* A NAME, not an id — config props carry no id, the CLI mints those from position, and a name
|
|
73
|
+
* survives a reorder where an index would not.
|
|
74
|
+
*
|
|
75
|
+
* Nothing under a hidden group is dropped from the theme or from what renders; the controls come
|
|
76
|
+
* back with what they held.
|
|
77
|
+
*/
|
|
78
|
+
requiredProp?: string;
|
|
79
|
+
/** For a BOOLEAN gate — which state of `requiredProp` shows this group. Defaults to `true`. */
|
|
80
|
+
requiredPropValue?: boolean;
|
|
81
|
+
/** For an ENUM gate — the option's id. */
|
|
82
|
+
requiredEnumOptionId?: string;
|
|
83
|
+
/** For an ENUM gate — the option value `requiredProp` must hold. */
|
|
84
|
+
requiredEnumOptionValue?: string;
|
|
46
85
|
}
|
|
47
86
|
/**
|
|
48
87
|
* Prop definition for a component
|
|
@@ -54,12 +93,24 @@ export interface ComponentProp {
|
|
|
54
93
|
required: boolean;
|
|
55
94
|
defaultValue?: unknown;
|
|
56
95
|
description?: string;
|
|
96
|
+
/** The prop's label and description in an editor language (`en`). */
|
|
97
|
+
translations?: ConfigTranslations<{
|
|
98
|
+
displayName?: string;
|
|
99
|
+
description?: string;
|
|
100
|
+
}>;
|
|
57
101
|
/** Assign this prop to a group (references ComponentPropGroup.id) */
|
|
58
102
|
groupId?: string;
|
|
59
103
|
/** For TYPE props — the type ID from TypeStore (e.g. "@ikas/bp-storefront-models-PaddingStyleType") */
|
|
60
104
|
typeId?: string;
|
|
61
105
|
/** For ENUM props — the enum type ID from TypeStore (e.g. "@ikas/bp-storefront-models-FlexDirectionStyleType") */
|
|
62
106
|
enumTypeId?: string;
|
|
107
|
+
/** For NUMBER_RANGE props — slider config (min/max/interval/unit) */
|
|
108
|
+
numberRangeData?: {
|
|
109
|
+
min?: number;
|
|
110
|
+
max?: number;
|
|
111
|
+
interval?: number;
|
|
112
|
+
unit?: string;
|
|
113
|
+
};
|
|
63
114
|
/** For COMPONENT/COMPONENT_LIST props — map of variable keys to { id, typeId } */
|
|
64
115
|
privateVarMap?: Record<string, {
|
|
65
116
|
id: string;
|
|
@@ -67,6 +118,16 @@ export interface ComponentProp {
|
|
|
67
118
|
}>;
|
|
68
119
|
/** For COMPONENT/COMPONENT_LIST props — restrict which components can be selected */
|
|
69
120
|
filteredComponentIds?: string[];
|
|
121
|
+
/**
|
|
122
|
+
* Conditional visibility — see {@link ComponentPropGroup.requiredProp} for the full contract.
|
|
123
|
+
*/
|
|
124
|
+
requiredProp?: string;
|
|
125
|
+
/** For a BOOLEAN gate — which state of `requiredProp` shows this prop. Defaults to `true`. */
|
|
126
|
+
requiredPropValue?: boolean;
|
|
127
|
+
/** For an ENUM gate — the option's id. */
|
|
128
|
+
requiredEnumOptionId?: string;
|
|
129
|
+
/** For an ENUM gate — the option value `requiredProp` must hold. */
|
|
130
|
+
requiredEnumOptionValue?: string;
|
|
70
131
|
}
|
|
71
132
|
/**
|
|
72
133
|
* Result of component compilation
|
|
@@ -114,4 +175,20 @@ export interface SharedModuleData {
|
|
|
114
175
|
canvasClientJs: string;
|
|
115
176
|
compiledCss: string;
|
|
116
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Theme global-variable metadata carried over the dev-server `sync-types` protocol
|
|
180
|
+
* (name / displayName / type only — no value). Drives the generated `ThemeSettingName`
|
|
181
|
+
* union in the author's `src/global-types.ts`.
|
|
182
|
+
*/
|
|
183
|
+
export type ThemeSettingMeta = {
|
|
184
|
+
name: string;
|
|
185
|
+
displayName: string;
|
|
186
|
+
type: string;
|
|
187
|
+
/**
|
|
188
|
+
* ENUM only — id of the project enum the setting selects from. Types the setting's entry in
|
|
189
|
+
* the generated value map as that enum's union type, and forces the union to be emitted even
|
|
190
|
+
* when no component prop uses the enum.
|
|
191
|
+
*/
|
|
192
|
+
enumTypeId?: string;
|
|
193
|
+
};
|
|
117
194
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,WAAW,GACX,QAAQ,GACR,cAAc,GACd,SAAS,GACT,OAAO,GACP,YAAY,GACZ,OAAO,GACP,KAAK,GACL,UAAU,GACV,MAAM,GACN,MAAM,GACN,cAAc,GACd,OAAO,GACP,MAAM,GACN,SAAS,GACT,cAAc,GACd,mBAAmB,GACnB,wBAAwB,GACxB,UAAU,GACV,eAAe,GACf,OAAO,GACP,YAAY,GACZ,MAAM,GACN,WAAW,GACX,eAAe,GACf,oBAAoB,GACpB,MAAM,GACN,WAAW,GACX,gBAAgB,CAAC;AAErB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,yFAAyF;IACzF,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAA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EAAE,MAAM,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Directory / file names that never belong in a theme source archive.
|
|
3
|
+
* `node_modules` is the reason this module exists (a theme folder is a few MB
|
|
4
|
+
* without it and hundreds of MB with it); the rest are either machine-local
|
|
5
|
+
* noise or secrets that must not be copied to cloud storage.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_ARCHIVE_EXCLUDES: string[];
|
|
8
|
+
export interface ArchiveProjectOptions {
|
|
9
|
+
/** Absolute path of the folder to archive (the theme project root). */
|
|
10
|
+
rootDir: string;
|
|
11
|
+
/** Extra exclude patterns (directory / file names, matched at every depth). */
|
|
12
|
+
exclude?: string[];
|
|
13
|
+
/** Where to write the zip; defaults to a unique file in the OS temp dir. */
|
|
14
|
+
outputPath?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Id table applied to the archived source text (see `rewriteIdsInText`).
|
|
17
|
+
* Only the zip gets the rewritten text; files on disk are never modified.
|
|
18
|
+
*/
|
|
19
|
+
rewriteIds?: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
export interface ArchiveProjectResult {
|
|
22
|
+
zipPath: string;
|
|
23
|
+
size: number;
|
|
24
|
+
fileCount: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function isRewritableFile(rel: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Replace every occurrence of a table key with its value, longest key first so
|
|
29
|
+
* a full id (`<projectId>-hero-slider`) wins over its project-id root, which
|
|
30
|
+
* still covers everything derived from it (chunk ids, `cc_<projectId>_…`
|
|
31
|
+
* scopes). Plain substring semantics, same as the editor's publish rewrite.
|
|
32
|
+
*/
|
|
33
|
+
export declare function rewriteIdsInText(text: string, ids: Record<string, string>): string;
|
|
34
|
+
export declare function isExcluded(name: string, patterns: string[]): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Recursively list files under `rootDir`, skipping excluded names at every
|
|
37
|
+
* depth (a nested `node_modules` inside a workspace package is dropped too).
|
|
38
|
+
* Returns paths relative to `rootDir` with forward slashes, sorted for a
|
|
39
|
+
* deterministic archive.
|
|
40
|
+
*/
|
|
41
|
+
export declare function collectProjectFiles(rootDir: string, patterns: string[]): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Zip the project folder WITHOUT its node_modules (and the other excludes).
|
|
44
|
+
* The working tree is never modified — the archive is simply built without
|
|
45
|
+
* those entries, which yields the same zip as deleting them first would.
|
|
46
|
+
*/
|
|
47
|
+
export declare function archiveProject(options: ArchiveProjectOptions): Promise<ArchiveProjectResult>;
|
|
48
|
+
/** Delete the zip; also drops the temp dir when it is one `archiveProject` created. */
|
|
49
|
+
export declare function removeArchive(zipPath: string): void;
|
|
50
|
+
//# sourceMappingURL=archive-project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive-project.d.ts","sourceRoot":"","sources":["../../src/utils/archive-project.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,UAUpC,CAAC;AAIF,MAAM,WAAW,qBAAqB;IACpC,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AA0BD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAIrD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,MAAM,CAUR;AAUD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAAE,GACjB,MAAM,EAAE,CAkBV;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CA2D/B;AAED,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAanD"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import archiver from "archiver";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as os from "os";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
/**
|
|
6
|
+
* Directory / file names that never belong in a theme source archive.
|
|
7
|
+
* `node_modules` is the reason this module exists (a theme folder is a few MB
|
|
8
|
+
* without it and hundreds of MB with it); the rest are either machine-local
|
|
9
|
+
* noise or secrets that must not be copied to cloud storage.
|
|
10
|
+
*/
|
|
11
|
+
export const DEFAULT_ARCHIVE_EXCLUDES = [
|
|
12
|
+
"node_modules",
|
|
13
|
+
".git",
|
|
14
|
+
".DS_Store",
|
|
15
|
+
".env",
|
|
16
|
+
".env.*",
|
|
17
|
+
".ikas-tmp",
|
|
18
|
+
// `ikas theme link` state (editor URL, store name, storefront/theme ids) —
|
|
19
|
+
// the partner's own store; a customer links the copy to theirs.
|
|
20
|
+
".ikas",
|
|
21
|
+
];
|
|
22
|
+
const TEMP_DIR_PREFIX = "ikas-theme-archive-";
|
|
23
|
+
/**
|
|
24
|
+
* Source files whose text may carry ids: the config, code, styles and docs.
|
|
25
|
+
* Lockfiles are left alone — their integrity hashes are opaque base64 that a
|
|
26
|
+
* short id could in theory occur in, and they never reference ids anyway.
|
|
27
|
+
*/
|
|
28
|
+
const REWRITABLE_EXTENSIONS = new Set([
|
|
29
|
+
".json",
|
|
30
|
+
".ts",
|
|
31
|
+
".tsx",
|
|
32
|
+
".js",
|
|
33
|
+
".jsx",
|
|
34
|
+
".mjs",
|
|
35
|
+
".cjs",
|
|
36
|
+
".css",
|
|
37
|
+
".scss",
|
|
38
|
+
".md",
|
|
39
|
+
".html",
|
|
40
|
+
]);
|
|
41
|
+
const NEVER_REWRITE = new Set([
|
|
42
|
+
"package-lock.json",
|
|
43
|
+
"pnpm-lock.yaml",
|
|
44
|
+
"yarn.lock",
|
|
45
|
+
]);
|
|
46
|
+
export function isRewritableFile(rel) {
|
|
47
|
+
const base = path.posix.basename(rel);
|
|
48
|
+
if (NEVER_REWRITE.has(base))
|
|
49
|
+
return false;
|
|
50
|
+
return REWRITABLE_EXTENSIONS.has(path.posix.extname(base).toLowerCase());
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Replace every occurrence of a table key with its value, longest key first so
|
|
54
|
+
* a full id (`<projectId>-hero-slider`) wins over its project-id root, which
|
|
55
|
+
* still covers everything derived from it (chunk ids, `cc_<projectId>_…`
|
|
56
|
+
* scopes). Plain substring semantics, same as the editor's publish rewrite.
|
|
57
|
+
*/
|
|
58
|
+
export function rewriteIdsInText(text, ids) {
|
|
59
|
+
const keys = Object.keys(ids)
|
|
60
|
+
.filter((k) => k && ids[k] && ids[k] !== k)
|
|
61
|
+
.sort((a, b) => b.length - a.length);
|
|
62
|
+
if (keys.length === 0)
|
|
63
|
+
return text;
|
|
64
|
+
const pattern = new RegExp(keys.map((k) => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), "g");
|
|
65
|
+
return text.replace(pattern, (match) => ids[match]);
|
|
66
|
+
}
|
|
67
|
+
/** Glob-lite matcher: supports a trailing/leading `*` only, which is all the exclude list needs. */
|
|
68
|
+
function matchesPattern(name, pattern) {
|
|
69
|
+
if (pattern === name)
|
|
70
|
+
return true;
|
|
71
|
+
if (pattern.endsWith("*"))
|
|
72
|
+
return name.startsWith(pattern.slice(0, -1));
|
|
73
|
+
if (pattern.startsWith("*"))
|
|
74
|
+
return name.endsWith(pattern.slice(1));
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
export function isExcluded(name, patterns) {
|
|
78
|
+
return patterns.some((p) => matchesPattern(name, p));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Recursively list files under `rootDir`, skipping excluded names at every
|
|
82
|
+
* depth (a nested `node_modules` inside a workspace package is dropped too).
|
|
83
|
+
* Returns paths relative to `rootDir` with forward slashes, sorted for a
|
|
84
|
+
* deterministic archive.
|
|
85
|
+
*/
|
|
86
|
+
export function collectProjectFiles(rootDir, patterns) {
|
|
87
|
+
const files = [];
|
|
88
|
+
const walk = (dir) => {
|
|
89
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
90
|
+
for (const entry of entries) {
|
|
91
|
+
if (isExcluded(entry.name, patterns))
|
|
92
|
+
continue;
|
|
93
|
+
const full = path.join(dir, entry.name);
|
|
94
|
+
if (entry.isDirectory()) {
|
|
95
|
+
walk(full);
|
|
96
|
+
}
|
|
97
|
+
else if (entry.isFile()) {
|
|
98
|
+
files.push(path.relative(rootDir, full).split(path.sep).join("/"));
|
|
99
|
+
}
|
|
100
|
+
// symlinks and other special entries are skipped on purpose: a symlinked
|
|
101
|
+
// node_modules or a socket file must not end up in the archive.
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
walk(rootDir);
|
|
105
|
+
return files.sort();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Zip the project folder WITHOUT its node_modules (and the other excludes).
|
|
109
|
+
* The working tree is never modified — the archive is simply built without
|
|
110
|
+
* those entries, which yields the same zip as deleting them first would.
|
|
111
|
+
*/
|
|
112
|
+
export async function archiveProject(options) {
|
|
113
|
+
const rootDir = path.resolve(options.rootDir);
|
|
114
|
+
if (!fs.existsSync(rootDir) || !fs.statSync(rootDir).isDirectory()) {
|
|
115
|
+
throw new Error(`Project folder not found: ${rootDir}`);
|
|
116
|
+
}
|
|
117
|
+
const patterns = [...DEFAULT_ARCHIVE_EXCLUDES, ...(options.exclude ?? [])];
|
|
118
|
+
const files = collectProjectFiles(rootDir, patterns);
|
|
119
|
+
const rewriteIds = options.rewriteIds ?? {};
|
|
120
|
+
const shouldRewrite = Object.keys(rewriteIds).length > 0;
|
|
121
|
+
if (files.length === 0) {
|
|
122
|
+
throw new Error(`Nothing to archive in ${rootDir} (every file is excluded)`);
|
|
123
|
+
}
|
|
124
|
+
const zipPath = options.outputPath ??
|
|
125
|
+
path.join(fs.mkdtempSync(path.join(os.tmpdir(), TEMP_DIR_PREFIX)), "theme-source.zip");
|
|
126
|
+
await new Promise((resolve, reject) => {
|
|
127
|
+
const output = fs.createWriteStream(zipPath);
|
|
128
|
+
const archive = archiver("zip", { zlib: { level: 9 } });
|
|
129
|
+
output.on("close", () => resolve());
|
|
130
|
+
output.on("error", reject);
|
|
131
|
+
archive.on("error", reject);
|
|
132
|
+
archive.on("warning", (err) => {
|
|
133
|
+
// ENOENT = a file vanished between listing and zipping (editor save, build
|
|
134
|
+
// output churn); skip it rather than fail the whole archive.
|
|
135
|
+
if (err.code === "ENOENT")
|
|
136
|
+
return;
|
|
137
|
+
reject(err);
|
|
138
|
+
});
|
|
139
|
+
archive.pipe(output);
|
|
140
|
+
for (const rel of files) {
|
|
141
|
+
const full = path.join(rootDir, rel);
|
|
142
|
+
if (shouldRewrite && isRewritableFile(rel)) {
|
|
143
|
+
let text;
|
|
144
|
+
try {
|
|
145
|
+
text = fs.readFileSync(full, "utf-8");
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
// Same tolerance as archiver's ENOENT warning above: a file that
|
|
149
|
+
// vanished since listing is skipped, anything else fails the archive.
|
|
150
|
+
if (err.code === "ENOENT")
|
|
151
|
+
continue;
|
|
152
|
+
throw err;
|
|
153
|
+
}
|
|
154
|
+
archive.append(rewriteIdsInText(text, rewriteIds), { name: rel });
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
archive.file(full, { name: rel });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
void archive.finalize();
|
|
161
|
+
});
|
|
162
|
+
return { zipPath, size: fs.statSync(zipPath).size, fileCount: files.length };
|
|
163
|
+
}
|
|
164
|
+
/** Delete the zip; also drops the temp dir when it is one `archiveProject` created. */
|
|
165
|
+
export function removeArchive(zipPath) {
|
|
166
|
+
try {
|
|
167
|
+
fs.rmSync(zipPath, { force: true });
|
|
168
|
+
const dir = path.dirname(zipPath);
|
|
169
|
+
if (path.basename(dir).startsWith(TEMP_DIR_PREFIX) &&
|
|
170
|
+
fs.readdirSync(dir).length === 0) {
|
|
171
|
+
fs.rmdirSync(dir);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
// best-effort temp cleanup
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=archive-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive-project.js","sourceRoot":"","sources":["../../src/utils/archive-project.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,cAAc;IACd,MAAM;IACN,WAAW;IACX,MAAM;IACN,QAAQ;IACR,WAAW;IACX,2EAA2E;IAC3E,gEAAgE;IAChE,OAAO;CACR,CAAC;AAEF,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAsB9C;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACpC,OAAO;IACP,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM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,CAAC,IAAI,KAAK,QAAQ;wBAAE,SAAS;oBAC/D,MAAM,GAAG,CAAC;gBACZ,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;YACpE,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;QACD,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AAC/E,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,IAAI,CAAC;QACH,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACpC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAClC,IACE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC;YAC9C,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAChC,CAAC;YACD,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,2BAA2B;IAC7B,CAAC;AACH,CAAC"}
|
package/dist/utils/compile.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ import type { CompilationResult, MultiCompilationResult } from "../types.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function compileComponent(entryPath: string, stylesPath: string, componentId: string): Promise<CompilationResult>;
|
|
6
6
|
/**
|
|
7
|
-
* Scope CSS selectors with a component-specific class prefix
|
|
7
|
+
* Scope CSS selectors with a component-specific class prefix, then namespace any
|
|
8
|
+
* document-global CSS identifiers (`@keyframes`, `@font-face` font-family,
|
|
9
|
+
* `@counter-style`) DEFINED in this component so two components — or the host theme —
|
|
10
|
+
* declaring the same name can't collide in the page's global namespace.
|
|
8
11
|
*/
|
|
9
12
|
export declare function scopeCSS(css: string, componentId: string): string;
|
|
10
13
|
/**
|
|
@@ -12,6 +15,18 @@ export declare function scopeCSS(css: string, componentId: string): string;
|
|
|
12
15
|
* Each selector becomes: .cc_id1 .sel, .cc_id2 .sel { ... }
|
|
13
16
|
*/
|
|
14
17
|
export declare function scopeCSSMulti(css: string, componentIds: string[]): string;
|
|
18
|
+
export interface CompileAllOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Bundle the `@ikas/bp-storefront*` packages into the artifact instead of leaving them for the
|
|
21
|
+
* host to resolve. See `vendorStorefrontPlugin` for why, and for what it costs.
|
|
22
|
+
*
|
|
23
|
+
* Off by default: a theme's own code components SHOULD bind to the storefront the theme ships,
|
|
24
|
+
* so a merchant gets one `customerStore` and one router. Turn it on only for artifacts that are
|
|
25
|
+
* published independently of any theme — today that means the built-in account pages, which are
|
|
26
|
+
* delivered from the CDN and cannot assume anything about the theme they land in.
|
|
27
|
+
*/
|
|
28
|
+
vendorStorefront?: boolean;
|
|
29
|
+
}
|
|
15
30
|
/**
|
|
16
31
|
* Compile all components together with esbuild code splitting.
|
|
17
32
|
* Shared code is automatically extracted into chunk files.
|
|
@@ -21,5 +36,5 @@ export declare function compileAllComponents(components: {
|
|
|
21
36
|
id: string;
|
|
22
37
|
entryPath: string;
|
|
23
38
|
stylesPath: string;
|
|
24
|
-
}[], globalStylesPath?: string): Promise<MultiCompilationResult>;
|
|
39
|
+
}[], globalStylesPath?: string, options?: CompileAllOptions): Promise<MultiCompilationResult>;
|
|
25
40
|
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/utils/compile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAuB,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/utils/compile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAuB,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAoElG;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,iBAAiB,CAAC,CAgF5B;AAiBD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAIjE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAGzE;AAkiBD,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AA4CD;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,EACnE,gBAAgB,CAAC,EAAE,MAAM,EACzB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,sBAAsB,CAAC,CAwXjC"}
|