@colletdev/core 0.1.5 → 0.1.6
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/generated/index.js +1 -1
- package/package.json +1 -1
- package/src/vite-plugin.js +12 -6
package/generated/index.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
import { initWasm, loadSharedStyles, loadInlineSharedStyles, loadMotionStyles, loadInlineMotionStyles, injectTokensToHead, injectFoucPrevention, CxElement, CxFormElement } from '../src/runtime.js';
|
|
24
24
|
|
|
25
25
|
// Package version — used for CDN fallback URL
|
|
26
|
-
const PKG_VERSION = '0.1.
|
|
26
|
+
const PKG_VERSION = '0.1.5';
|
|
27
27
|
|
|
28
28
|
// ─── Lazy WASM + CSS ───
|
|
29
29
|
// WASM glue and CSS strings are NOT imported at module level.
|
package/package.json
CHANGED
package/src/vite-plugin.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
// preload: true, // Inject <link rel="preload"> for WASM
|
|
18
18
|
// })
|
|
19
19
|
|
|
20
|
-
import { existsSync, copyFileSync, mkdirSync, readFileSync } from 'fs';
|
|
20
|
+
import { existsSync, copyFileSync, mkdirSync, readFileSync, statSync } from 'fs';
|
|
21
21
|
import { dirname, join, resolve } from 'path';
|
|
22
22
|
import { fileURLToPath } from 'url';
|
|
23
23
|
import { UTILITIES_CSS, TOKENS_SHADOW_CSS } from '../generated/styles.js';
|
|
@@ -72,13 +72,19 @@ export function colletPlugin(options = {}) {
|
|
|
72
72
|
// 2. Copy WASM to public/ if missing
|
|
73
73
|
// 3. Serve CSS assets for DSD <link> refs
|
|
74
74
|
configureServer(server) {
|
|
75
|
-
//
|
|
75
|
+
// Always copy WASM to public/ — overwrites stale binaries from previous
|
|
76
|
+
// package versions. Without this, upgrading @colletdev/core leaves the old
|
|
77
|
+
// WASM in public/ and new components fail with "Unknown component" errors.
|
|
76
78
|
const wasmSrc = join(PKG_ROOT, 'wasm', 'wasm_api_bg.wasm');
|
|
77
79
|
const wasmDest = join(publicDir, 'wasm_api_bg.wasm');
|
|
78
|
-
if (existsSync(wasmSrc)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
if (existsSync(wasmSrc)) {
|
|
81
|
+
const srcSize = statSync(wasmSrc).size;
|
|
82
|
+
const destSize = existsSync(wasmDest) ? statSync(wasmDest).size : 0;
|
|
83
|
+
if (srcSize !== destSize) {
|
|
84
|
+
mkdirSync(publicDir, { recursive: true });
|
|
85
|
+
copyFileSync(wasmSrc, wasmDest);
|
|
86
|
+
server.config.logger.info('[collet] Updated wasm_api_bg.wasm in public/ (new version)');
|
|
87
|
+
}
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
server.middlewares.use((req, res, next) => {
|