@aiot-toolkit/aiotpack 2.1.0-prender.7 → 2.1.0-prender.8
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.
|
@@ -238,6 +238,30 @@ class ViteCompiler {
|
|
|
238
238
|
}
|
|
239
239
|
},
|
|
240
240
|
plugins: [{
|
|
241
|
+
name: 'image-asset-string',
|
|
242
|
+
enforce: 'pre',
|
|
243
|
+
load(id) {
|
|
244
|
+
// require("./x.png") in .ux <script> must resolve to a path string,
|
|
245
|
+
// matching webpack file-loader / vivo blueos-pack semantics. Without
|
|
246
|
+
// this hook rolldown treats each image as an ES module and emits
|
|
247
|
+
// `(init_x(), __toCommonJS(x_exports))` — the site assigns
|
|
248
|
+
// `{ default: fn }` to src and runtime cannot render.
|
|
249
|
+
const match = id.match(/\.(png|jpe?g|gif|svg|webp|bmp|ico)(\?.*)?$/i);
|
|
250
|
+
if (!match) return null;
|
|
251
|
+
const filePath = id.replace(/\?.*$/, '');
|
|
252
|
+
if (!_fsExtra.default.existsSync(filePath)) return null;
|
|
253
|
+
const relFromSrc = _path.default.relative(srcPath, filePath).split(_path.default.sep).join('/');
|
|
254
|
+
// Assets outside src/ (typically node_modules) fall through to the
|
|
255
|
+
// default asset handler — the caller is responsible for their path
|
|
256
|
+
// resolution. Vivo blueos-pack + webpack file-loader use rpk-root
|
|
257
|
+
// absolute paths (`/common/...`, `/dynamicAssets/name-hash.png`);
|
|
258
|
+
// runtime <image src> resolves against the rpk root, so relative
|
|
259
|
+
// `./common/...` from a nested page directory would misdirect.
|
|
260
|
+
if (relFromSrc.startsWith('..')) return null;
|
|
261
|
+
const runtimePath = '/' + relFromSrc;
|
|
262
|
+
return `module.exports = ${JSON.stringify(runtimePath)};`;
|
|
263
|
+
}
|
|
264
|
+
}, {
|
|
241
265
|
name: "cjs-shim",
|
|
242
266
|
enforce: "pre",
|
|
243
267
|
load(id) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/aiotpack",
|
|
3
|
-
"version": "2.1.0-prender.
|
|
3
|
+
"version": "2.1.0-prender.8",
|
|
4
4
|
"description": "The process tool for packaging aiot projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aiotpack"
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
"test": "node ./__tests__/aiotpack.test.js"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@aiot-toolkit/generator": "2.1.0-prender.
|
|
23
|
-
"@aiot-toolkit/parser": "2.1.0-prender.
|
|
24
|
-
"@aiot-toolkit/shared-utils": "2.1.0-prender.
|
|
22
|
+
"@aiot-toolkit/generator": "2.1.0-prender.8",
|
|
23
|
+
"@aiot-toolkit/parser": "2.1.0-prender.8",
|
|
24
|
+
"@aiot-toolkit/shared-utils": "2.1.0-prender.8",
|
|
25
25
|
"@hap-toolkit/aaptjs": "^2.0.0",
|
|
26
26
|
"@rspack/core": "^1.3.9",
|
|
27
27
|
"acorn": "^8.16.0",
|
|
28
28
|
"aiot-parse5": "^1.0.2",
|
|
29
29
|
"astring": "^1.9.0",
|
|
30
30
|
"babel-loader": "^9.1.3",
|
|
31
|
-
"file-lane": "2.1.0-prender.
|
|
31
|
+
"file-lane": "2.1.0-prender.8",
|
|
32
32
|
"file-loader": "^6.2.0",
|
|
33
33
|
"fs-extra": "^11.2.0",
|
|
34
34
|
"jsrsasign": "^11.1.0",
|