@aiot-toolkit/aiotpack 2.0.5-beta.4 → 2.0.5-beta.5
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.
|
@@ -45,8 +45,6 @@ class WrapPlugin {
|
|
|
45
45
|
var $app_require$ = global.$app_require$ || org_app_require
|
|
46
46
|
|
|
47
47
|
${enableE2e ? `globalThis = undefined; \n global = typeof window === "undefined" ? global.__proto__ : window;` : ''}
|
|
48
|
-
// 转换动态 style 的函数
|
|
49
|
-
${isApp ? this.translateStyleFunc() : ''}
|
|
50
48
|
var ${createFuncnName} = function() {
|
|
51
49
|
return `, source, `
|
|
52
50
|
}
|
|
@@ -115,11 +115,38 @@ class UxLoaderUtils {
|
|
|
115
115
|
// 区分app.ux和一般ux
|
|
116
116
|
// app.ux解析结果中加上manifest.json的内容
|
|
117
117
|
const manifestJson = `require('./manifest.json')`;
|
|
118
|
+
function translateStyleFunc() {
|
|
119
|
+
return `
|
|
120
|
+
var $translateStyle$ = function (value) {
|
|
121
|
+
if (typeof value === 'string') {
|
|
122
|
+
return Object.fromEntries(
|
|
123
|
+
value
|
|
124
|
+
.split(';')
|
|
125
|
+
.filter((item) => Boolean(item && item.trim()))
|
|
126
|
+
.map((item) => {
|
|
127
|
+
const matchs = item.match(/([^:]+):(.*)/);
|
|
128
|
+
if (matchs && matchs.length > 2) {
|
|
129
|
+
return [
|
|
130
|
+
matchs[1]
|
|
131
|
+
.trim()
|
|
132
|
+
.replace(/-([a-z])/g, (_, match) => match.toUpperCase()),
|
|
133
|
+
matchs[2].trim(),
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
return [];
|
|
137
|
+
})
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
return value;
|
|
141
|
+
};
|
|
142
|
+
global.$translateStyle$ = $translateStyle$
|
|
143
|
+
`;
|
|
144
|
+
}
|
|
118
145
|
const integrateFunction = (appImport, appStyleTree, appTemplateTree, appScriptTree) => {
|
|
119
146
|
const scriptCode = appScriptTree.getText();
|
|
120
147
|
const hasScript = Boolean(scriptCode) && scriptCode !== '""';
|
|
121
148
|
// script代码放在第三个位置不能变化,影响更新source map
|
|
122
|
-
return isAppUx ? [`${appImport.join('\n')}`, `var $app_style$ = ${UxLoaderUtils.wrapStyle(appStyleTree, file, compilerOption)}`, hasScript ? `var $app_script$ = ${UxLoaderUtils.wrapScript(false, appScriptTree)}` : '', hasScript ? `$app_script$({}, $app_exports$, $app_require$);` : `$app_exports$.default = {}`, `$app_exports$.default.style = $app_style$;`, `$app_exports$.default.manifest = ${manifestJson}
|
|
149
|
+
return isAppUx ? [`${appImport.join('\n')}`, `var $app_style$ = ${UxLoaderUtils.wrapStyle(appStyleTree, file, compilerOption)}`, hasScript ? `var $app_script$ = ${UxLoaderUtils.wrapScript(false, appScriptTree)}` : '', hasScript ? `$app_script$({}, $app_exports$, $app_require$);` : `$app_exports$.default = {}`, `$app_exports$.default.style = $app_style$;`, `$app_exports$.default.manifest = ${manifestJson}`, translateStyleFunc()] : [`${appImport.join('\n')}`, `var $app_style$ = ${UxLoaderUtils.wrapStyle(appStyleTree, file, compilerOption)}`, hasScript ? `var $app_script$ = ${UxLoaderUtils.wrapScript(isPageUx, appScriptTree)}` : '', `var $app_template$ = ${UxLoaderUtils.wrapTempalte(appTemplateTree, file, compilerOption)}`, `${UxLoaderUtils.getReturnType(isPageUx)} function ($app_exports$) {`, hasScript ? `$app_script$({}, $app_exports$, $app_require$);` : `$app_exports$.default = {}`, `$app_exports$.default.template = $app_template$;`, `$app_exports$.default.style = $app_style$;`, `}`];
|
|
123
150
|
};
|
|
124
151
|
const {
|
|
125
152
|
targetTree,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/aiotpack",
|
|
3
|
-
"version": "2.0.5-beta.
|
|
3
|
+
"version": "2.0.5-beta.5",
|
|
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.5-beta.
|
|
23
|
-
"@aiot-toolkit/parser": "2.0.5-beta.
|
|
24
|
-
"@aiot-toolkit/shared-utils": "2.0.5-beta.
|
|
22
|
+
"@aiot-toolkit/generator": "2.0.5-beta.5",
|
|
23
|
+
"@aiot-toolkit/parser": "2.0.5-beta.5",
|
|
24
|
+
"@aiot-toolkit/shared-utils": "2.0.5-beta.5",
|
|
25
25
|
"@hap-toolkit/aaptjs": "^2.0.0",
|
|
26
26
|
"@rspack/core": "^1.1.8",
|
|
27
27
|
"aiot-parse5": "^1.0.2",
|
|
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.5-beta.
|
|
31
|
+
"file-lane": "2.0.5-beta.5",
|
|
32
32
|
"file-loader": "^6.2.0",
|
|
33
33
|
"fs-extra": "^11.2.0",
|
|
34
34
|
"jsrsasign": "^11.1.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@types/jsrsasign": "^10.5.12",
|
|
47
47
|
"@types/webpack-sources": "^3.2.3"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "c90b16e8706edad7825777a1b40d367b28d76ed3"
|
|
50
50
|
}
|