@ikas/component-cli 1.4.0-beta.1 → 1.4.0-beta.100

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.
Files changed (146) hide show
  1. package/dist/commands/add-sections-to-page.d.ts +3 -0
  2. package/dist/commands/add-sections-to-page.d.ts.map +1 -0
  3. package/dist/commands/add-sections-to-page.js +39 -0
  4. package/dist/commands/add-sections-to-page.js.map +1 -0
  5. package/dist/commands/add-to-page.d.ts +3 -0
  6. package/dist/commands/add-to-page.d.ts.map +1 -0
  7. package/dist/commands/add-to-page.js +41 -0
  8. package/dist/commands/add-to-page.js.map +1 -0
  9. package/dist/commands/add.d.ts.map +1 -1
  10. package/dist/commands/add.js +10 -1
  11. package/dist/commands/add.js.map +1 -1
  12. package/dist/commands/build.d.ts.map +1 -1
  13. package/dist/commands/build.js +5 -165
  14. package/dist/commands/build.js.map +1 -1
  15. package/dist/commands/config.d.ts.map +1 -1
  16. package/dist/commands/config.js +484 -157
  17. package/dist/commands/config.js.map +1 -1
  18. package/dist/commands/create-design-tokens.d.ts +24 -0
  19. package/dist/commands/create-design-tokens.d.ts.map +1 -0
  20. package/dist/commands/create-design-tokens.js +317 -0
  21. package/dist/commands/create-design-tokens.js.map +1 -0
  22. package/dist/commands/create-global-variable.d.ts +3 -0
  23. package/dist/commands/create-global-variable.d.ts.map +1 -0
  24. package/dist/commands/create-global-variable.js +53 -0
  25. package/dist/commands/create-global-variable.js.map +1 -0
  26. package/dist/commands/create-page.d.ts +3 -0
  27. package/dist/commands/create-page.d.ts.map +1 -0
  28. package/dist/commands/create-page.js +31 -0
  29. package/dist/commands/create-page.js.map +1 -0
  30. package/dist/commands/delete-theme-globals.d.ts +4 -0
  31. package/dist/commands/delete-theme-globals.d.ts.map +1 -0
  32. package/dist/commands/delete-theme-globals.js +48 -0
  33. package/dist/commands/delete-theme-globals.js.map +1 -0
  34. package/dist/commands/dev.d.ts.map +1 -1
  35. package/dist/commands/dev.js +299 -32
  36. package/dist/commands/dev.js.map +1 -1
  37. package/dist/commands/get-component-props.d.ts +3 -0
  38. package/dist/commands/get-component-props.d.ts.map +1 -0
  39. package/dist/commands/get-component-props.js +32 -0
  40. package/dist/commands/get-component-props.js.map +1 -0
  41. package/dist/commands/get-page-by-type.d.ts +3 -0
  42. package/dist/commands/get-page-by-type.d.ts.map +1 -0
  43. package/dist/commands/get-page-by-type.js +25 -0
  44. package/dist/commands/get-page-by-type.js.map +1 -0
  45. package/dist/commands/get-section-values.d.ts +3 -0
  46. package/dist/commands/get-section-values.d.ts.map +1 -0
  47. package/dist/commands/get-section-values.js +39 -0
  48. package/dist/commands/get-section-values.js.map +1 -0
  49. package/dist/commands/import.d.ts +3 -0
  50. package/dist/commands/import.d.ts.map +1 -0
  51. package/dist/commands/import.js +25 -0
  52. package/dist/commands/import.js.map +1 -0
  53. package/dist/commands/list-entities.d.ts +3 -0
  54. package/dist/commands/list-entities.d.ts.map +1 -0
  55. package/dist/commands/list-entities.js +32 -0
  56. package/dist/commands/list-entities.js.map +1 -0
  57. package/dist/commands/list-imported.d.ts +3 -0
  58. package/dist/commands/list-imported.d.ts.map +1 -0
  59. package/dist/commands/list-imported.js +25 -0
  60. package/dist/commands/list-imported.js.map +1 -0
  61. package/dist/commands/list-page-sections.d.ts +3 -0
  62. package/dist/commands/list-page-sections.d.ts.map +1 -0
  63. package/dist/commands/list-page-sections.js +25 -0
  64. package/dist/commands/list-page-sections.js.map +1 -0
  65. package/dist/commands/list-pages.d.ts +3 -0
  66. package/dist/commands/list-pages.d.ts.map +1 -0
  67. package/dist/commands/list-pages.js +21 -0
  68. package/dist/commands/list-pages.js.map +1 -0
  69. package/dist/commands/list-theme-globals.d.ts +3 -0
  70. package/dist/commands/list-theme-globals.d.ts.map +1 -0
  71. package/dist/commands/list-theme-globals.js +22 -0
  72. package/dist/commands/list-theme-globals.js.map +1 -0
  73. package/dist/commands/publish-theme.d.ts +3 -0
  74. package/dist/commands/publish-theme.d.ts.map +1 -0
  75. package/dist/commands/publish-theme.js +29 -0
  76. package/dist/commands/publish-theme.js.map +1 -0
  77. package/dist/commands/publish.d.ts.map +1 -1
  78. package/dist/commands/publish.js +23 -2
  79. package/dist/commands/publish.js.map +1 -1
  80. package/dist/commands/search-products.d.ts +3 -0
  81. package/dist/commands/search-products.d.ts.map +1 -0
  82. package/dist/commands/search-products.js +40 -0
  83. package/dist/commands/search-products.js.map +1 -0
  84. package/dist/commands/update-global-variable.d.ts +3 -0
  85. package/dist/commands/update-global-variable.d.ts.map +1 -0
  86. package/dist/commands/update-global-variable.js +47 -0
  87. package/dist/commands/update-global-variable.js.map +1 -0
  88. package/dist/commands/update-page-sections.d.ts +3 -0
  89. package/dist/commands/update-page-sections.d.ts.map +1 -0
  90. package/dist/commands/update-page-sections.js +39 -0
  91. package/dist/commands/update-page-sections.js.map +1 -0
  92. package/dist/commands/update-section-prop.d.ts +3 -0
  93. package/dist/commands/update-section-prop.d.ts.map +1 -0
  94. package/dist/commands/update-section-prop.js +59 -0
  95. package/dist/commands/update-section-prop.js.map +1 -0
  96. package/dist/commands/upload-image.d.ts +3 -0
  97. package/dist/commands/upload-image.d.ts.map +1 -0
  98. package/dist/commands/upload-image.js +38 -0
  99. package/dist/commands/upload-image.js.map +1 -0
  100. package/dist/commands/upload-images.d.ts +3 -0
  101. package/dist/commands/upload-images.d.ts.map +1 -0
  102. package/dist/commands/upload-images.js +48 -0
  103. package/dist/commands/upload-images.js.map +1 -0
  104. package/dist/index.d.ts.map +1 -1
  105. package/dist/index.js +55 -0
  106. package/dist/index.js.map +1 -1
  107. package/dist/types.d.ts +11 -1
  108. package/dist/types.d.ts.map +1 -1
  109. package/dist/utils/compile.d.ts +4 -1
  110. package/dist/utils/compile.d.ts.map +1 -1
  111. package/dist/utils/compile.js +630 -102
  112. package/dist/utils/compile.js.map +1 -1
  113. package/dist/utils/component-helpers.d.ts +64 -3
  114. package/dist/utils/component-helpers.d.ts.map +1 -1
  115. package/dist/utils/component-helpers.js +151 -4
  116. package/dist/utils/component-helpers.js.map +1 -1
  117. package/dist/utils/editor-action-client.d.ts +28 -0
  118. package/dist/utils/editor-action-client.d.ts.map +1 -0
  119. package/dist/utils/editor-action-client.js +116 -0
  120. package/dist/utils/editor-action-client.js.map +1 -0
  121. package/dist/utils/forbid-deep-imports.d.ts +3 -0
  122. package/dist/utils/forbid-deep-imports.d.ts.map +1 -0
  123. package/dist/utils/forbid-deep-imports.js +54 -0
  124. package/dist/utils/forbid-deep-imports.js.map +1 -0
  125. package/dist/utils/forbid-external-packages.d.ts +16 -0
  126. package/dist/utils/forbid-external-packages.d.ts.map +1 -0
  127. package/dist/utils/forbid-external-packages.js +89 -0
  128. package/dist/utils/forbid-external-packages.js.map +1 -0
  129. package/dist/utils/load-image.d.ts +16 -0
  130. package/dist/utils/load-image.d.ts.map +1 -0
  131. package/dist/utils/load-image.js +50 -0
  132. package/dist/utils/load-image.js.map +1 -0
  133. package/dist/utils/websocket-server.d.ts +52 -2
  134. package/dist/utils/websocket-server.d.ts.map +1 -1
  135. package/dist/utils/websocket-server.js +59 -1
  136. package/dist/utils/websocket-server.js.map +1 -1
  137. package/package.json +1 -1
  138. package/templates/add/section.css +11 -0
  139. package/dist/commands/create.d.ts +0 -9
  140. package/dist/commands/create.d.ts.map +0 -1
  141. package/dist/commands/create.js +0 -9
  142. package/dist/commands/create.js.map +0 -1
  143. package/dist/commands/proxy.d.ts +0 -39
  144. package/dist/commands/proxy.d.ts.map +0 -1
  145. package/dist/commands/proxy.js +0 -212
  146. package/dist/commands/proxy.js.map +0 -1
@@ -0,0 +1,116 @@
1
+ import { WebSocket } from "ws";
2
+ const DEFAULT_PORT = 5201;
3
+ const DEFAULT_TIMEOUT_MS = 10_000;
4
+ /**
5
+ * Open a short-lived WebSocket connection to the running `ikas-component dev`
6
+ * server, send an `editor-action` message, and wait for the editor's reply.
7
+ *
8
+ * The dev server forwards the action to its connected editor client and routes
9
+ * the result back to this socket (matched by requestId).
10
+ */
11
+ export function runEditorAction(action, payload, options = {}) {
12
+ const port = options.port ?? DEFAULT_PORT;
13
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
14
+ const requestId = `cli_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
15
+ return new Promise((resolve, reject) => {
16
+ const ws = new WebSocket(`ws://127.0.0.1:${port}`);
17
+ let settled = false;
18
+ const cleanup = () => {
19
+ try {
20
+ ws.removeAllListeners();
21
+ if (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING) {
22
+ ws.close();
23
+ }
24
+ }
25
+ catch {
26
+ // ignore
27
+ }
28
+ };
29
+ const finish = (fn) => {
30
+ if (settled)
31
+ return;
32
+ settled = true;
33
+ clearTimeout(timer);
34
+ cleanup();
35
+ fn();
36
+ };
37
+ const timer = setTimeout(() => {
38
+ finish(() => reject(new Error(`Timed out after ${timeoutMs}ms waiting for editor response`)));
39
+ }, timeoutMs);
40
+ ws.on("open", () => {
41
+ ws.send(JSON.stringify({
42
+ type: "editor-action",
43
+ requestId,
44
+ action,
45
+ payload: payload ?? {},
46
+ }));
47
+ });
48
+ ws.on("message", (data) => {
49
+ let msg;
50
+ try {
51
+ msg = JSON.parse(data.toString());
52
+ }
53
+ catch {
54
+ return;
55
+ }
56
+ // Ignore unrelated broadcasts (initial-state, component-update, etc.) —
57
+ // the dev server fans those out to every connected client on open.
58
+ if (msg?.type !== "editor-action-result" || msg.requestId !== requestId)
59
+ return;
60
+ finish(() => resolve({
61
+ success: !!msg.success,
62
+ payload: msg.payload,
63
+ error: msg.error,
64
+ }));
65
+ });
66
+ ws.on("error", (err) => {
67
+ finish(() => {
68
+ const e = err;
69
+ if (e.code === "ECONNREFUSED") {
70
+ reject(new Error(`Could not connect to dev server on port ${port}. Run \`ikas-component dev\` in another terminal first.`));
71
+ return;
72
+ }
73
+ reject(err instanceof Error ? err : new Error(String(err)));
74
+ });
75
+ });
76
+ ws.on("close", () => {
77
+ finish(() => reject(new Error("Connection closed before editor response was received")));
78
+ });
79
+ });
80
+ }
81
+ /**
82
+ * Write a single JSON line to stdout and exit — but only AFTER the write has
83
+ * fully flushed to the pipe.
84
+ *
85
+ * Why not `process.stdout.write(...); process.exit(code)`? When stdout is a pipe
86
+ * (which it always is when the MCP server shells out via `execFile`), writes are
87
+ * asynchronous. Calling `process.exit()` immediately after a large write tears
88
+ * the process down before the OS drains the pipe, truncating the JSON mid-stream.
89
+ * The MCP then sees an incomplete object and reports "no parseable JSON". This
90
+ * bites exactly the big batch responses (get-component-props for many ids,
91
+ * list-entities on a large store, add-sections-to-page echoing many sections).
92
+ *
93
+ * Passing the exit to the write callback guarantees the full line is flushed
94
+ * first. The pending write keeps the event loop alive until the callback fires.
95
+ */
96
+ function writeJsonLineAndExit(obj, code) {
97
+ process.stdout.write(JSON.stringify(obj) + "\n", () => process.exit(code));
98
+ // The write callback ends the process; control never meaningfully returns here.
99
+ return undefined;
100
+ }
101
+ /**
102
+ * Standard JSON printer for control commands. Always emits a single line of
103
+ * JSON to stdout; sets exit code 0 on success, 1 on failure. The shape is
104
+ * stable so MCP tools can parse it.
105
+ */
106
+ export function printResultAndExit(result) {
107
+ if (result.success) {
108
+ return writeJsonLineAndExit({ ok: true, ...(result.payload ?? {}) }, 0);
109
+ }
110
+ return writeJsonLineAndExit({ ok: false, error: result.error ?? "Unknown error" }, 1);
111
+ }
112
+ export function printErrorAndExit(error) {
113
+ const message = error instanceof Error ? error.message : String(error);
114
+ return writeJsonLineAndExit({ ok: false, error: message }, 1);
115
+ }
116
+ //# sourceMappingURL=editor-action-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor-action-client.js","sourceRoot":"","sources":["../../src/utils/editor-action-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE/B,MAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAQlC;;;;;;GAMG;AACH,MAAM,UAAU,eAA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CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from "esbuild";
2
+ export declare function forbidDeepStorefrontImportsPlugin(): Plugin;
3
+ //# sourceMappingURL=forbid-deep-imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forbid-deep-imports.d.ts","sourceRoot":"","sources":["../../src/utils/forbid-deep-imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AA2BtC,wBAAgB,iCAAiC,IAAI,MAAM,CA6B1D"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Fail the build on deep imports into the storefront packages.
3
+ *
4
+ * `@ikas/bp-storefront` (and its `-models` / `-config` / `-api` siblings) are marked
5
+ * EXTERNAL during compilation, so esbuild does NOT resolve their subpaths — a hand-written
6
+ * deep import like `@ikas/bp-storefront/dist/functions/api/cart` would otherwise sail through
7
+ * the bundle untouched and only break later (the published storefront exposes the package as
8
+ * window globals keyed off the ROOT export names; a `/dist/...` or `/src/...` subpath has no
9
+ * corresponding global, so the component throws at runtime in the canvas/published theme).
10
+ *
11
+ * The public contract is: import ONLY from the bare package root. Anything after the package
12
+ * name is a private path. This plugin turns that contract into a hard compile error with a
13
+ * message pointing at the correct root import, instead of letting the component build "succeed"
14
+ * and fail in the browser. Models often reach for these subpaths when they can't find a public
15
+ * helper (e.g. coupon code) — the error nudges them back to the documented root exports.
16
+ */
17
+ // Matches `@ikas/bp-storefront` (and its -models / -config / -api siblings) with an OPTIONAL
18
+ // subpath. Group 1 = package root, group 2 = the subpath (including its leading "/"), if any.
19
+ //
20
+ // NOTE: these packages MUST NOT also sit in esbuild's `external: [...]` array. esbuild applies
21
+ // the external array BEFORE running plugin onResolve callbacks, so an external-listed deep
22
+ // import is short-circuited and the plugin never sees it. We therefore externalize the valid
23
+ // ROOT import from inside this plugin instead, which lets the same callback reject subpaths.
24
+ const STOREFRONT_PKG = /^(@ikas\/bp-storefront(?:-(?:models|config|api))?)(\/.*)?$/;
25
+ export function forbidDeepStorefrontImportsPlugin() {
26
+ return {
27
+ name: "ikas-forbid-deep-storefront-imports",
28
+ setup(build) {
29
+ build.onResolve({ filter: STOREFRONT_PKG }, (args) => {
30
+ const [, root, subpath] = args.path.match(STOREFRONT_PKG);
31
+ // Bare root import (or a lone trailing slash) — the allowed form. Externalize it, the
32
+ // same way the old `external: [...]` entry did, so the published storefront's window
33
+ // globals satisfy it.
34
+ if (!subpath || subpath === "/") {
35
+ return { path: root, external: true };
36
+ }
37
+ return {
38
+ errors: [
39
+ {
40
+ text: `Deep import "${args.path}" is not allowed. Import only from the package root ` +
41
+ `"${root}" — e.g. import { saveCouponCode, getCart } from "${root}". ` +
42
+ `Subpaths like "/dist/..." or "/src/..." are private: they bundle fine but have ` +
43
+ `no window global in the published storefront, so the component breaks at runtime. ` +
44
+ `If a helper seems missing from the root, it almost always has a public name there ` +
45
+ `(coupon code, for instance, is getCouponCodeForm / setCouponCodeFormCouponCode / ` +
46
+ `submitCouponCodeForm).`,
47
+ },
48
+ ],
49
+ };
50
+ });
51
+ },
52
+ };
53
+ }
54
+ //# sourceMappingURL=forbid-deep-imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forbid-deep-imports.js","sourceRoot":"","sources":["../../src/utils/forbid-deep-imports.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,6FAA6F;AAC7F,8FAA8F;AAC9F,EAAE;AACF,+FAA+F;AAC/F,2FAA2F;AAC3F,6FAA6F;AAC7F,6FAA6F;AAC7F,MAAM,cAAc,GAAG,4DAA4D,CAAC;AAEpF,MAAM,UAAU,iCAAiC;IAC/C,OAAO;QACL,IAAI,EAAE,qCAAqC;QAC3C,KAAK,CAAC,KAAK;YACT,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE;gBACnD,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAE,CAAC;gBAC3D,sFAAsF;gBACtF,qFAAqF;gBACrF,sBAAsB;gBACtB,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;oBAChC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;gBACxC,CAAC;gBACD,OAAO;oBACL,MAAM,EAAE;wBACN;4BACE,IAAI,EACF,gBAAgB,IAAI,CAAC,IAAI,sDAAsD;gCAC/E,IAAI,IAAI,qDAAqD,IAAI,KAAK;gCACtE,iFAAiF;gCACjF,oFAAoF;gCACpF,oFAAoF;gCACpF,mFAAmF;gCACnF,wBAAwB;yBAC3B;qBACF;iBACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { Plugin } from "esbuild";
2
+ /**
3
+ * Fail the build when a code component imports an npm package that is not on the allowlist.
4
+ *
5
+ * Themes are untrusted source. Only the reference-theme baseline packages plus `three` and
6
+ * `animejs` may be bundled into a component. Anything else (lodash, axios, a random UI kit, ...)
7
+ * becomes a hard compile error instead of a silently-bundled dependency — so installing an extra
8
+ * package and importing it blows the build up immediately with an actionable message.
9
+ *
10
+ * NOTE: esbuild applies the `external: [...]` array BEFORE plugin onResolve, so the externalized
11
+ * runtime packages (preact, preact/hooks, mobx, preact-render-to-string) are short-circuited and
12
+ * never reach this plugin — they are allowed implicitly. Non-external subpaths (e.g.
13
+ * `preact/compat`) DO reach here and resolve to an allowed root.
14
+ */
15
+ export declare function forbidExternalPackagesPlugin(): Plugin;
16
+ //# sourceMappingURL=forbid-external-packages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forbid-external-packages.d.ts","sourceRoot":"","sources":["../../src/utils/forbid-external-packages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAqDtC;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CA4BrD"}
@@ -0,0 +1,89 @@
1
+ import { builtinModules } from "module";
2
+ /**
3
+ * Allowlist of npm packages a theme's code components are permitted to import.
4
+ *
5
+ * Intentionally STATIC — it is NOT derived from the theme's own package.json. The whole point
6
+ * is to stop themes from pulling in arbitrary third-party packages, so trusting their manifest
7
+ * would defeat the purpose: a theme could just add the dependency there. Instead we pin the set
8
+ * here, mirroring apps/reference-theme/package.json's runtime dependencies plus the two
9
+ * explicitly-permitted libraries.
10
+ *
11
+ * The list holds package ROOTS. Subpaths resolve to their root (e.g. `preact/hooks` → `preact`,
12
+ * `three/examples/jsm/...` → `three`), so every subpath of an allowed package is allowed too.
13
+ * Deep imports into the storefront SDK are separately restricted by
14
+ * `forbidDeepStorefrontImportsPlugin` (which runs first).
15
+ */
16
+ const ALLOWED_PACKAGE_ROOTS = new Set([
17
+ // Preact runtime (root + any subpath: preact/hooks, preact/compat, preact/jsx-runtime, ...).
18
+ // The bare `preact` / `preact/hooks` specifiers are externalized (short-circuited before this
19
+ // plugin runs), but non-external subpaths like `preact/compat` still resolve through here.
20
+ "preact",
21
+ // MobX reactivity — pulled in by the injected observer runtime. Externalized in both builds,
22
+ // so this is a guard in case the externals list ever changes rather than a reachable import.
23
+ "mobx",
24
+ // ikas storefront SDK (deep-import rules enforced by forbidDeepStorefrontImportsPlugin)
25
+ "@ikas/bp-storefront",
26
+ "@ikas/bp-storefront-models",
27
+ "@ikas/bp-storefront-config",
28
+ "@ikas/bp-storefront-api",
29
+ // Virtual module injected by ikasComponentUtilsPlugin
30
+ "@ikas/component-utils",
31
+ // Explicitly permitted third-party libraries for themes
32
+ "three",
33
+ "animejs",
34
+ ]);
35
+ // Node built-ins (with and without the `node:` prefix). Only an already-allowed package would
36
+ // reach for these, and platform:node externalizes them anyway — never flag them.
37
+ const NODE_BUILTINS = new Set([
38
+ ...builtinModules,
39
+ ...builtinModules.map((m) => `node:${m}`),
40
+ ]);
41
+ /** Extract the package root from a bare import specifier (handles `@scope/name`). */
42
+ function packageRootOf(specifier) {
43
+ if (specifier.startsWith("@")) {
44
+ const parts = specifier.split("/");
45
+ return parts.slice(0, 2).join("/");
46
+ }
47
+ return specifier.split("/")[0];
48
+ }
49
+ /**
50
+ * Fail the build when a code component imports an npm package that is not on the allowlist.
51
+ *
52
+ * Themes are untrusted source. Only the reference-theme baseline packages plus `three` and
53
+ * `animejs` may be bundled into a component. Anything else (lodash, axios, a random UI kit, ...)
54
+ * becomes a hard compile error instead of a silently-bundled dependency — so installing an extra
55
+ * package and importing it blows the build up immediately with an actionable message.
56
+ *
57
+ * NOTE: esbuild applies the `external: [...]` array BEFORE plugin onResolve, so the externalized
58
+ * runtime packages (preact, preact/hooks, mobx, preact-render-to-string) are short-circuited and
59
+ * never reach this plugin — they are allowed implicitly. Non-external subpaths (e.g.
60
+ * `preact/compat`) DO reach here and resolve to an allowed root.
61
+ */
62
+ export function forbidExternalPackagesPlugin() {
63
+ return {
64
+ name: "ikas-forbid-external-packages",
65
+ setup(build) {
66
+ // Bare specifiers only — skip relative ("./", "../") and absolute ("/") imports.
67
+ build.onResolve({ filter: /^[^./]/ }, (args) => {
68
+ const specifier = args.path;
69
+ if (NODE_BUILTINS.has(specifier))
70
+ return undefined;
71
+ const root = packageRootOf(specifier);
72
+ if (ALLOWED_PACKAGE_ROOTS.has(root))
73
+ return undefined;
74
+ return {
75
+ errors: [
76
+ {
77
+ text: `Package "${root}" is not allowed in ikas themes. ` +
78
+ `Code components may only import the default theme packages plus "three" and "animejs", ` +
79
+ `so installing and importing "${specifier}" fails the build by design. ` +
80
+ `Remove the dependency (inline the code you need, or switch to an allowed package). ` +
81
+ `Allowed packages: ${Array.from(ALLOWED_PACKAGE_ROOTS).sort().join(", ")}.`,
82
+ },
83
+ ],
84
+ };
85
+ });
86
+ },
87
+ };
88
+ }
89
+ //# sourceMappingURL=forbid-external-packages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forbid-external-packages.js","sourceRoot":"","sources":["../../src/utils/forbid-external-packages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC;;;;;;;;;;;;;GAaG;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAS;IAC5C,6FAA6F;IAC7F,8FAA8F;IAC9F,2FAA2F;IAC3F,QAAQ;IACR,6FAA6F;IAC7F,6FAA6F;IAC7F,MAAM;IACN,wFAAwF;IACxF,qBAAqB;IACrB,4BAA4B;IAC5B,4BAA4B;IAC5B,yBAAyB;IACzB,sDAAsD;IACtD,uBAAuB;IACvB,wDAAwD;IACxD,OAAO;IACP,SAAS;CACV,CAAC,CAAC;AAEH,8FAA8F;AAC9F,iFAAiF;AACjF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAS;IACpC,GAAG,cAAc;IACjB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;CAC1C,CAAC,CAAC;AAEH,qFAAqF;AACrF,SAAS,aAAa,CAAC,SAAiB;IACtC,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,4BAA4B;IAC1C,OAAO;QACL,IAAI,EAAE,+BAA+B;QACrC,KAAK,CAAC,KAAK;YACT,iFAAiF;YACjF,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE;gBAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC;gBAE5B,IAAI,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC;oBAAE,OAAO,SAAS,CAAC;gBAEnD,MAAM,IAAI,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;gBACtC,IAAI,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC;oBAAE,OAAO,SAAS,CAAC;gBAEtD,OAAO;oBACL,MAAM,EAAE;wBACN;4BACE,IAAI,EACF,YAAY,IAAI,mCAAmC;gCACnD,yFAAyF;gCACzF,gCAAgC,SAAS,+BAA+B;gCACxE,qFAAqF;gCACrF,qBAAqB,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;yBAC9E;qBACF;iBACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const VALID_IMAGE_TYPES: string[];
2
+ export interface ImageSource {
3
+ file?: string;
4
+ url?: string;
5
+ }
6
+ export interface LoadedImage {
7
+ base64: string;
8
+ mimeType: string;
9
+ fileName: string;
10
+ }
11
+ /**
12
+ * Read an image from a local file path or URL and return its base64 (raw, no
13
+ * data: prefix), mime type, and a file name. Validates type and the 10MB limit.
14
+ */
15
+ export declare function loadImageSource(src: ImageSource): Promise<LoadedImage>;
16
+ //# sourceMappingURL=load-image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-image.d.ts","sourceRoot":"","sources":["../../src/utils/load-image.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,iBAAiB,UAA6B,CAAC;AAG5D,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAsC5E"}
@@ -0,0 +1,50 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { basename, extname } from "node:path";
3
+ const MIME_BY_EXT = {
4
+ ".png": "image/png",
5
+ ".jpg": "image/jpeg",
6
+ ".jpeg": "image/jpeg",
7
+ ".webp": "image/webp",
8
+ ".gif": "image/gif",
9
+ };
10
+ export const VALID_IMAGE_TYPES = Object.values(MIME_BY_EXT);
11
+ const MAX_SIZE_BYTES = 10 * 1024 * 1024; // 10MB, mirrors the editor's IMAGE_UPLOAD_LIMIT_SIZE
12
+ /**
13
+ * Read an image from a local file path or URL and return its base64 (raw, no
14
+ * data: prefix), mime type, and a file name. Validates type and the 10MB limit.
15
+ */
16
+ export async function loadImageSource(src) {
17
+ if (src.file && src.url) {
18
+ throw new Error("Provide only one of file or url, not both");
19
+ }
20
+ if (src.file) {
21
+ const buffer = await readFile(src.file);
22
+ const ext = extname(src.file).toLowerCase();
23
+ const mimeType = MIME_BY_EXT[ext];
24
+ if (!mimeType) {
25
+ throw new Error(`Unsupported image extension "${ext || "(none)"}" for ${src.file}. Supported: ${Object.keys(MIME_BY_EXT).join(", ")}`);
26
+ }
27
+ if (buffer.byteLength > MAX_SIZE_BYTES) {
28
+ throw new Error(`${src.file} is ${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB; the limit is 10MB`);
29
+ }
30
+ return { base64: buffer.toString("base64"), mimeType, fileName: basename(src.file) };
31
+ }
32
+ if (src.url) {
33
+ const res = await fetch(src.url);
34
+ if (!res.ok) {
35
+ throw new Error(`Failed to fetch ${src.url}: ${res.status} ${res.statusText}`);
36
+ }
37
+ const mimeType = (res.headers.get("content-type") || "").split(";")[0].trim();
38
+ if (!VALID_IMAGE_TYPES.includes(mimeType)) {
39
+ throw new Error(`${src.url} returned content-type "${mimeType || "(none)"}". Supported: ${VALID_IMAGE_TYPES.join(", ")}`);
40
+ }
41
+ const buffer = Buffer.from(await res.arrayBuffer());
42
+ if (buffer.byteLength > MAX_SIZE_BYTES) {
43
+ throw new Error(`${src.url} is ${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB; the limit is 10MB`);
44
+ }
45
+ const urlName = basename(new URL(src.url).pathname) || "image";
46
+ return { base64: buffer.toString("base64"), mimeType, fileName: urlName };
47
+ }
48
+ throw new Error("Provide a file path or url");
49
+ }
50
+ //# sourceMappingURL=load-image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-image.js","sourceRoot":"","sources":["../../src/utils/load-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,WAAW,GAA2B;IAC1C,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAC5D,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,qDAAqD;AAa9F;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAgB;IACpD,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,GAAG,GAAG,OAAO,C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,QAAQ,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,2BAA2B,QAAQ,IAAI,QAAQ,iBAAiB,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5H,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;QACpD,IAAI,MAAM,CAAC,UAAU,GAAG,cAAc,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC;QACxG,CAAC;QACD,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC;QAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAC5E,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAChD,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ComponentProp } from "../types.js";
1
+ import type { ComponentProp, ThemeSettingMeta } from "../types.js";
2
2
  import type { IThemePropGroupData } from "./component-helpers.js";
3
3
  /**
4
4
  * Shared module data sent to editors (chunk extracted by code splitting)
@@ -10,6 +10,11 @@ export interface ISharedModuleData {
10
10
  compiledClientJs: string;
11
11
  canvasClientJs: string;
12
12
  compiledCss: string;
13
+ /**
14
+ * SHA-256 of the compiled artifacts. Editors compare this to their stored hash and skip
15
+ * applying the update when unchanged, so unrelated saves don't re-flag every component.
16
+ */
17
+ contentHash?: string;
13
18
  }
14
19
  /**
15
20
  * Global style data for a code component project (unscoped CSS)
@@ -17,6 +22,13 @@ export interface ISharedModuleData {
17
22
  export interface IGlobalStyleData {
18
23
  projectId: string;
19
24
  compiledCss: string;
25
+ /**
26
+ * Bumped only when `compiledCss` actually changes between rebuilds. Lets the editor (and
27
+ * the publish UI) show a "globals updated" indicator independently of any component, so
28
+ * designers can publish global-CSS edits as a standalone unit without re-flagging every
29
+ * code component.
30
+ */
31
+ updatedAt?: number;
20
32
  }
21
33
  /**
22
34
  * Code component data sent to editors
@@ -76,6 +88,13 @@ export interface ICodeComponentData {
76
88
  customTypes?: Array<Record<string, any>>;
77
89
  /** Project-prefixed shared-module IDs this component depends on (transitive). */
78
90
  usedSharedModuleIds?: string[];
91
+ /**
92
+ * SHA-256 of the editor-relevant fields (compiled artifacts, props, prop groups, custom
93
+ * types, type/header/footer flags, name, projectId, usedSharedModuleIds). Editors compare
94
+ * this to their stored hash and skip applying the update when unchanged. Recomputed every
95
+ * rebuild — when it matches, no `updatedAt` bump and no "has updates" badge.
96
+ */
97
+ contentHash?: string;
79
98
  }
80
99
  /**
81
100
  * Messages from dev server to editor
@@ -129,6 +148,17 @@ export type DevServerMessage = {
129
148
  enumOptions?: Record<string, string>;
130
149
  }>;
131
150
  };
151
+ } | {
152
+ type: "editor-action";
153
+ requestId: string;
154
+ action: "list-pages" | "list-imported-components" | "import-component" | "add-section-to-page" | "add-sections-to-page" | "list-page-sections" | "get-section-values" | "get-component-props" | "update-section-prop" | "upload-image" | "search-products" | "list-entities" | "get-page-by-type" | "update-page-sections" | "upload-images";
155
+ payload?: any;
156
+ } | {
157
+ type: "editor-action-result";
158
+ requestId: string;
159
+ success: boolean;
160
+ payload?: any;
161
+ error?: string;
132
162
  };
133
163
  /**
134
164
  * Messages from editor to dev server
@@ -229,6 +259,8 @@ export type EditorMessage = {
229
259
  enumOptions?: Record<string, string>;
230
260
  }>;
231
261
  customTypes?: Array<Record<string, any>>;
262
+ /** Theme global variables (Styles panel) — drives the typed key union in global-types.ts. */
263
+ themeSettings?: Array<ThemeSettingMeta>;
232
264
  };
233
265
  } | {
234
266
  type: "request-types";
@@ -253,6 +285,17 @@ export type EditorMessage = {
253
285
  payload: {
254
286
  enumId: string;
255
287
  };
288
+ } | {
289
+ type: "editor-action";
290
+ requestId: string;
291
+ action: "list-pages" | "list-imported-components" | "import-component" | "add-section-to-page" | "add-sections-to-page" | "list-page-sections" | "get-section-values" | "get-component-props" | "update-section-prop" | "upload-image" | "search-products" | "list-entities" | "get-page-by-type" | "update-page-sections" | "upload-images";
292
+ payload?: any;
293
+ } | {
294
+ type: "editor-action-result";
295
+ requestId: string;
296
+ success: boolean;
297
+ payload?: any;
298
+ error?: string;
256
299
  };
257
300
  /**
258
301
  * Handlers for editor messages that require action from dev.ts
@@ -289,7 +332,7 @@ export interface EditorMessageHandlers {
289
332
  category: "type" | "enum";
290
333
  sectionAllowed: boolean;
291
334
  enumOptions?: Record<string, string>;
292
- }>, customTypes?: Array<Record<string, any>>) => void;
335
+ }>, customTypes?: Array<Record<string, any>>, themeSettings?: Array<ThemeSettingMeta>) => void;
293
336
  onRequestTypes?: () => Array<{
294
337
  id: string;
295
338
  name: string;
@@ -312,6 +355,7 @@ export declare class DevServerWebSocket {
312
355
  private httpServer;
313
356
  private clients;
314
357
  private port;
358
+ private pendingEditorActions;
315
359
  constructor(port?: number);
316
360
  /**
317
361
  * Start the WebSocket server
@@ -321,6 +365,12 @@ export declare class DevServerWebSocket {
321
365
  * Handle incoming messages from editor
322
366
  */
323
367
  private handleMessage;
368
+ /**
369
+ * Remove pending editor-action entries originated by a disconnecting client,
370
+ * so we don't leak entries and don't accidentally route a future reply to a
371
+ * dead socket.
372
+ */
373
+ private dropPendingEditorActionsForClient;
324
374
  /**
325
375
  * Send message to a specific client
326
376
  */
@@ -1 +1 @@
1
- {"version":3,"file":"websocket-server.d.ts","sourceRoot":"","sources":["../../src/utils/websocket-server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAwC,MAAM,aAAa,CAAC;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,CAExB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,OAAO,CAExB;IAED;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAiCtB"}
1
+ {"version":3,"file":"websocket-server.d.ts","sourceRoot":"","sources":["../../src/utils/websocket-server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,OAAO,CAAC;QACpB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,wDAAwD;QACxD,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,kDAAkD;QAClD,MAAM,CAAC,EAAE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