@aiot-toolkit/aiotpack 2.0.3-beta.11 → 2.0.3-beta.12

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.
@@ -114,8 +114,10 @@ class UxLoaderUtils {
114
114
  // app.ux解析结果中加上manifest.json的内容
115
115
  const manifestJson = `require('./manifest.json')`;
116
116
  const integrateFunction = (appImport, appStyleTree, appTemplateTree, appScriptTree) => {
117
+ const scriptCode = appScriptTree.getText();
118
+ const hasScript = Boolean(scriptCode) && scriptCode !== '""';
117
119
  // script代码放在第三个位置不能变化,影响更新source map
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$;`, `}`];
120
+ 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}`] : [`${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$;`, `}`];
119
121
  };
120
122
  const {
121
123
  targetTree,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/aiotpack",
3
- "version": "2.0.3-beta.11",
3
+ "version": "2.0.3-beta.12",
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.11",
23
- "@aiot-toolkit/parser": "2.0.3-beta.11",
24
- "@aiot-toolkit/shared-utils": "2.0.3-beta.11",
22
+ "@aiot-toolkit/generator": "2.0.3-beta.12",
23
+ "@aiot-toolkit/parser": "2.0.3-beta.12",
24
+ "@aiot-toolkit/shared-utils": "2.0.3-beta.12",
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.11",
31
+ "file-lane": "2.0.3-beta.12",
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": "3c249a6cc68ad4881bc627aaae6120ab27605b2d"
48
+ "gitHead": "a20d364161209141515de30555c800e7a4eff733"
49
49
  }