@aiot-toolkit/aiotpack 2.0.3-beta.10 → 2.0.3-beta.11
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IStyleNode } from '@aiot-toolkit/parser';
|
|
1
2
|
import { ILog } from '@aiot-toolkit/shared-utils';
|
|
2
3
|
import { IFileLaneContext, IFileParam } from 'file-lane';
|
|
3
4
|
import { SourceFile } from 'ts-morph';
|
|
@@ -54,7 +55,7 @@ declare class UxLoaderUtils {
|
|
|
54
55
|
* @returns
|
|
55
56
|
*/
|
|
56
57
|
static wrapTempalte(templateTree: SourceFile, file: IFileParam, compilerOption: IJavascriptCompileOption): string;
|
|
57
|
-
static wrapStyle(
|
|
58
|
+
static wrapStyle(styleNodes: IStyleNode[], file: IFileParam, compilerOption: IJavascriptCompileOption): string;
|
|
58
59
|
/**
|
|
59
60
|
* 给script增加外层包裹内容
|
|
60
61
|
* @param isPageUx
|
|
@@ -115,7 +115,7 @@ class UxLoaderUtils {
|
|
|
115
115
|
const manifestJson = `require('./manifest.json')`;
|
|
116
116
|
const integrateFunction = (appImport, appStyleTree, appTemplateTree, appScriptTree) => {
|
|
117
117
|
// script代码放在第三个位置不能变化,影响更新source map
|
|
118
|
-
return isAppUx ? [`${appImport.join('\n')}`, `var $app_style$ = ${UxLoaderUtils.wrapStyle(
|
|
118
|
+
return isAppUx ? [`${appImport.join('\n')}`, `var $app_style$ = ${UxLoaderUtils.wrapStyle(appStyleTree, file, compilerOption)}`, `var $app_script$ = ${UxLoaderUtils.wrapScript(false, appScriptTree)}`, `$app_script$({}, $app_exports$, $app_require$);`, `$app_exports$.default.style = $app_style$;`, `$app_exports$.default.manifest = ${manifestJson}`] : [`${appImport.join('\n')}`, `var $app_style$ = ${UxLoaderUtils.wrapStyle(appStyleTree, file, compilerOption)}`, `var $app_script$ = ${UxLoaderUtils.wrapScript(isPageUx, appScriptTree)}`, `var $app_template$ = ${UxLoaderUtils.wrapTempalte(appTemplateTree, file, compilerOption)}`, `${UxLoaderUtils.getReturnType(isPageUx)} function ($app_exports$) {`, `$app_script$({}, $app_exports$, $app_require$);`, `$app_exports$.default.template = $app_template$;`, `$app_exports$.default.style = $app_style$;`, `}`];
|
|
119
119
|
};
|
|
120
120
|
const {
|
|
121
121
|
targetTree,
|
|
@@ -302,10 +302,13 @@ class UxLoaderUtils {
|
|
|
302
302
|
}
|
|
303
303
|
return result;
|
|
304
304
|
}
|
|
305
|
-
static wrapStyle(
|
|
305
|
+
static wrapStyle(styleNodes, file, compilerOption) {
|
|
306
|
+
const code = JSON.stringify(styleNodes);
|
|
306
307
|
if (compilerOption.enableProtobuf) {
|
|
307
|
-
|
|
308
|
-
|
|
308
|
+
if (styleNodes?.length) {
|
|
309
|
+
const result = BinaryPlugin.addStyle(file.path, file.path, code);
|
|
310
|
+
return `['${result.name}', ${result.index}]`;
|
|
311
|
+
}
|
|
309
312
|
}
|
|
310
313
|
return code;
|
|
311
314
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/aiotpack",
|
|
3
|
-
"version": "2.0.3-beta.
|
|
3
|
+
"version": "2.0.3-beta.11",
|
|
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.0.3-beta.
|
|
23
|
-
"@aiot-toolkit/parser": "2.0.3-beta.
|
|
24
|
-
"@aiot-toolkit/shared-utils": "2.0.3-beta.
|
|
22
|
+
"@aiot-toolkit/generator": "2.0.3-beta.11",
|
|
23
|
+
"@aiot-toolkit/parser": "2.0.3-beta.11",
|
|
24
|
+
"@aiot-toolkit/shared-utils": "2.0.3-beta.11",
|
|
25
25
|
"@hap-toolkit/aaptjs": "^2.0.0",
|
|
26
26
|
"@rspack/core": "^1.0.0",
|
|
27
27
|
"aiot-parse5": "^1.0.0",
|
|
28
28
|
"archiver": "^7.0.1",
|
|
29
29
|
"babel-loader": "^9.1.3",
|
|
30
30
|
"fast-glob": "^3.3.2",
|
|
31
|
-
"file-lane": "2.0.3-beta.
|
|
31
|
+
"file-lane": "2.0.3-beta.11",
|
|
32
32
|
"file-loader": "^6.2.0",
|
|
33
33
|
"fs-extra": "^11.2.0",
|
|
34
34
|
"jsrsasign": "^11.1.0",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"@types/jsrsasign": "^10.5.12",
|
|
46
46
|
"@types/webpack-sources": "^3.2.3"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "3c249a6cc68ad4881bc627aaae6120ab27605b2d"
|
|
49
49
|
}
|