@ikas/component-cli 1.4.0-beta.21 → 1.4.0-beta.212
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.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 +5 -165
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/config.d.ts +35 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +1082 -147
- 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 +48 -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 +218 -31
- 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 +27 -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 +39 -0
- package/dist/commands/get-section-values.js.map +1 -0
- 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-page-sections.d.ts.map +1 -1
- package/dist/commands/list-page-sections.js +8 -2
- package/dist/commands/list-page-sections.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/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 +54 -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/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 +39 -0
- package/dist/commands/update-page-sections.js.map +1 -0
- package/dist/commands/update-section-prop.d.ts.map +1 -1
- package/dist/commands/update-section-prop.js +25 -8
- package/dist/commands/update-section-prop.js.map +1 -1
- package/dist/commands/upload-image.d.ts.map +1 -1
- package/dist/commands/upload-image.js +5 -46
- package/dist/commands/upload-image.js.map +1 -1
- 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 +54 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/archive-project.d.ts +69 -0
- package/dist/utils/archive-project.d.ts.map +1 -0
- package/dist/utils/archive-project.js +202 -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 +750 -117
- package/dist/utils/compile.js.map +1 -1
- package/dist/utils/component-helpers.d.ts +167 -2
- package/dist/utils/component-helpers.d.ts.map +1 -1
- package/dist/utils/component-helpers.js +452 -29
- 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/editor-action-client.d.ts +4 -3
- package/dist/utils/editor-action-client.d.ts.map +1 -1
- package/dist/utils/editor-action-client.js +55 -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/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/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 +119 -5
- package/dist/utils/websocket-server.d.ts.map +1 -1
- package/dist/utils/websocket-server.js +255 -44
- 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 -228
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/proxy.d.ts +0 -39
- package/dist/commands/proxy.d.ts.map +0 -1
- package/dist/commands/proxy.js +0 -210
- package/dist/commands/proxy.js.map +0 -1
|
@@ -0,0 +1,202 @@
|
|
|
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
|
+
/**
|
|
165
|
+
* PUT the zip to a presigned URL (Cloudflare R2 / S3 style). The CLI holds no
|
|
166
|
+
* cloud credentials: the editor asks the ikas backend for a short-lived signed
|
|
167
|
+
* URL and hands it over, so the bytes go straight from the partner's machine
|
|
168
|
+
* to the bucket without passing through the browser or the websocket tunnel.
|
|
169
|
+
*/
|
|
170
|
+
export async function uploadArchive(options) {
|
|
171
|
+
const body = fs.readFileSync(options.zipPath);
|
|
172
|
+
const method = (options.method ?? "PUT").toUpperCase();
|
|
173
|
+
const headers = {
|
|
174
|
+
"Content-Type": "application/zip",
|
|
175
|
+
"Content-Length": String(body.byteLength),
|
|
176
|
+
...(options.headers ?? {}),
|
|
177
|
+
};
|
|
178
|
+
const response = await fetch(options.uploadUrl, { method, headers, body });
|
|
179
|
+
if (!response.ok) {
|
|
180
|
+
const text = await response.text().catch(() => "");
|
|
181
|
+
throw new Error(`Archive upload failed: ${response.status} ${response.statusText}${text ? ` — ${text.slice(0, 300)}` : ""}`);
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
status: response.status,
|
|
185
|
+
etag: response.headers.get("etag") ?? undefined,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
/** Delete the zip; also drops the temp dir when it is one `archiveProject` created. */
|
|
189
|
+
export function removeArchive(zipPath) {
|
|
190
|
+
try {
|
|
191
|
+
fs.rmSync(zipPath, { force: true });
|
|
192
|
+
const dir = path.dirname(zipPath);
|
|
193
|
+
if (path.basename(dir).startsWith(TEMP_DIR_PREFIX) &&
|
|
194
|
+
fs.readdirSync(dir).length === 0) {
|
|
195
|
+
fs.rmdirSync(dir);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
// best-effort temp cleanup
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
//# 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;AAoC9C;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACpC,OAAO;IACP,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,KAAK;IACL,OAAO;CACR,CAAC,CAAC;AACH,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,mBAAmB;IACnB,gBAAgB;IAChB,WAAW;CACZ,CAAC,CAAC;AAEH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1C,OAAO,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,GAA2B;IAE3B,MA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AAG,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;AAmElG;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,iBAAiB,CAAC,CA8E5B;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;AAsCD;;;;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"}
|