@aiot-toolkit/aiotpack 2.0.4-beta.2 → 2.0.5-alpha.1

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.
@@ -22,7 +22,7 @@ class VelaWebpackConfigurator {
22
22
  return result;
23
23
  }
24
24
  createWrapPlugin() {
25
- return new _WrapPlugin.default();
25
+ return new _WrapPlugin.default(this.param);
26
26
  }
27
27
  createBundleAnalyzerPlugin() {
28
28
  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
@@ -1,5 +1,8 @@
1
1
  import { Compiler } from '@rspack/core';
2
+ import IJavascriptCompileOption from '../../interface/IJavascriptCompileOption';
2
3
  declare class WrapPlugin {
4
+ private compilerOption;
5
+ constructor(compilerOption: IJavascriptCompileOption);
3
6
  apply(compiler: Compiler): void;
4
7
  private wrap;
5
8
  }
@@ -7,6 +7,9 @@ exports.default = void 0;
7
7
  var _core = require("@rspack/core");
8
8
  var _webpackSources = require("webpack-sources");
9
9
  class WrapPlugin {
10
+ constructor(compilerOption) {
11
+ this.compilerOption = compilerOption;
12
+ }
10
13
  apply(compiler) {
11
14
  // 给入口文件加上包裹函数
12
15
  compiler.hooks.compilation.tap('WrapPlugin', compilation => {
@@ -19,6 +22,9 @@ class WrapPlugin {
19
22
  });
20
23
  }
21
24
  wrap(compilation) {
25
+ const {
26
+ enableE2e
27
+ } = this.compilerOption;
22
28
  // 获取入口文件
23
29
  const entrys = Object.keys(compilation.options.entry).map(item => `${item}.js`);
24
30
  // 从chunk找到所有入口文件,添加包裹函数
@@ -36,6 +42,8 @@ class WrapPlugin {
36
42
  var clearInterval = global.clearInterval;
37
43
  var $app_require$ = global.$app_require$ || org_app_require
38
44
 
45
+ ${enableE2e ? `globalThis = undefined; \n global = typeof window === "undefined" ? global.__proto__ : window;` : ''}
46
+
39
47
  // 转换动态 style 的函数
40
48
  var $translateStyle$ = function (value) {
41
49
  if (typeof value === 'string') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/aiotpack",
3
- "version": "2.0.4-beta.2",
3
+ "version": "2.0.5-alpha.1",
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.4-beta.2",
23
- "@aiot-toolkit/parser": "2.0.4-beta.2",
24
- "@aiot-toolkit/shared-utils": "2.0.4-beta.2",
22
+ "@aiot-toolkit/generator": "2.0.5-alpha.1",
23
+ "@aiot-toolkit/parser": "2.0.5-alpha.1",
24
+ "@aiot-toolkit/shared-utils": "2.0.5-alpha.1",
25
25
  "@hap-toolkit/aaptjs": "^2.0.0",
26
26
  "@rspack/core": "^1.1.8",
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.4-beta.2",
31
+ "file-lane": "2.0.5-alpha.1",
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": "e9015685f29790709c420a9f8c41ade936a85300"
49
+ "gitHead": "8c8033a7a52e7cdb83606298ed8c4d6a585ba3ec"
50
50
  }