@aiot-toolkit/aiotpack 2.0.2-beta.1 → 2.0.2-beta.2

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.
@@ -108,6 +108,17 @@ class JavascriptCompiler {
108
108
  Array.isArray(readyRules) && readyRules.length > 0
109
109
  ? [...configuratorRules, ...readyRules]
110
110
  : configuratorRules;
111
+ // 判断devtool类型 inline-source-map时,添加第0列关系映射
112
+ if (devtool === 'inline-source-map') {
113
+ result.module.rules.unshift({
114
+ test: /\.js$/,
115
+ use: [
116
+ {
117
+ loader: path_1.default.join(__dirname, '../javascript/vela/utils/webpackLoader/addColSourceMap.js')
118
+ }
119
+ ]
120
+ });
121
+ }
111
122
  }
112
123
  if (configurator.createPlugins) {
113
124
  result.plugins = configurator.createPlugins();
@@ -0,0 +1,3 @@
1
+ import { LoaderContext } from "webpack";
2
+ declare function addColSourceMap(this: LoaderContext<any>, source: string, map: any): Promise<void>;
3
+ export default addColSourceMap;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const SourceMapUtil_1 = __importDefault(require("@aiot-toolkit/parser/lib/ux/translate/vela/utils/SourceMapUtil"));
16
+ function addColSourceMap(source, map) {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ const callback = this.async();
19
+ if (!map) {
20
+ callback(null, source, map);
21
+ }
22
+ let { consumer, tempGenerator } = yield SourceMapUtil_1.default.createConsumerAndGenerator(JSON.stringify(map));
23
+ let recordLine = -1;
24
+ consumer.eachMapping(mapping => {
25
+ if (mapping.source === consumer.sources[consumer.sources.length - 1]) {
26
+ if (recordLine < mapping.generatedLine && (mapping.generatedColumn !== 0 || mapping.originalColumn !== 0)) {
27
+ tempGenerator.addMapping({
28
+ generated: {
29
+ line: mapping.generatedLine,
30
+ column: 0
31
+ },
32
+ original: {
33
+ line: mapping.originalLine,
34
+ column: 0
35
+ },
36
+ source: mapping.source,
37
+ name: ''
38
+ });
39
+ }
40
+ recordLine = mapping.generatedLine;
41
+ }
42
+ tempGenerator.addMapping({
43
+ generated: {
44
+ line: mapping.generatedLine,
45
+ column: mapping.generatedColumn
46
+ },
47
+ original: {
48
+ line: mapping.originalLine,
49
+ column: mapping.originalColumn
50
+ },
51
+ source: mapping.source,
52
+ name: mapping.name
53
+ });
54
+ });
55
+ callback(null, source, JSON.parse(tempGenerator.toString()));
56
+ });
57
+ }
58
+ exports.default = addColSourceMap;
@@ -24,7 +24,10 @@ declare class UxConfig implements IFileLaneConfig<IJavascriptCompileOption> {
24
24
  })[];
25
25
  };
26
26
  preWorks: import("file-lane/lib/interface/IFileLaneConfig").PreWork<IJavascriptCompileOption>[];
27
- followWorks: import("file-lane/lib/interface/IFileLaneConfig").FollowWork<IJavascriptCompileOption>[];
27
+ followWorks: {
28
+ worker: import("file-lane/lib/interface/IFileLaneConfig").FollowWork<IJavascriptCompileOption>;
29
+ workerDescribe: string;
30
+ }[];
28
31
  watchIgnores: RegExp[];
29
32
  }
30
33
  export default UxConfig;
@@ -9,8 +9,8 @@ const JsLoader_1 = __importDefault(require("../loader/ux/JsLoader"));
9
9
  const PngLoader_1 = __importDefault(require("../loader/ux/PngLoader"));
10
10
  const UxLoader_1 = __importDefault(require("../loader/ux/UxLoader"));
11
11
  const PreWorkUtils_1 = __importDefault(require("../utils/PreWorkUtils"));
12
- const UxFollowWorks_1 = __importDefault(require("../utils/ux/UxFollowWorks"));
13
- const UxPreWorks_1 = __importDefault(require("../utils/ux/UxPreWorks"));
12
+ const UxFollowWorks_1 = __importDefault(require("../followWorks/ux/UxFollowWorks"));
13
+ const UxPreWorks_1 = __importDefault(require("../preWorks/ux/UxPreWorks"));
14
14
  class UxConfig {
15
15
  constructor(projectPath) {
16
16
  this.projectPath = projectPath;
@@ -44,13 +44,34 @@ class UxConfig {
44
44
  PreWorkUtils_1.default.getGlobalVar
45
45
  ];
46
46
  this.followWorks = [
47
- UxFollowWorks_1.default.symlinkNodeModule,
48
- UxFollowWorks_1.default.webpack,
49
- UxFollowWorks_1.default.copyResource,
50
- UxFollowWorks_1.default.jsc,
51
- UxFollowWorks_1.default.toRpk,
52
- UxFollowWorks_1.default.moveBackResult,
53
- UxFollowWorks_1.default.protobuf
47
+ {
48
+ worker: UxFollowWorks_1.default.symlinkNodeModule,
49
+ workerDescribe: 'Create a soft link to the node_modules folder'
50
+ },
51
+ {
52
+ worker: UxFollowWorks_1.default.webpack,
53
+ workerDescribe: 'Compile the project using webpack'
54
+ },
55
+ {
56
+ worker: UxFollowWorks_1.default.copyResource,
57
+ workerDescribe: 'Copy resource files'
58
+ },
59
+ {
60
+ worker: UxFollowWorks_1.default.jsc,
61
+ workerDescribe: 'Generate jsc bytecode'
62
+ },
63
+ {
64
+ worker: UxFollowWorks_1.default.protobuf,
65
+ workerDescribe: 'Generate protobuf json'
66
+ },
67
+ {
68
+ worker: UxFollowWorks_1.default.toRpk,
69
+ workerDescribe: 'Package the project into an RPK file'
70
+ },
71
+ {
72
+ worker: UxFollowWorks_1.default.moveBackResult,
73
+ workerDescribe: 'Migrate temporary project'
74
+ }
54
75
  ];
55
76
  this.watchIgnores = [/node_modules/];
56
77
  }
@@ -13,6 +13,8 @@ declare class XtsConfig implements IFileLaneConfig {
13
13
  }[];
14
14
  };
15
15
  preWorks: import("file-lane/lib/interface/IFileLaneConfig").PreWork<import("../interface/ICompileOptions").IXtsCompileOptions>[];
16
- followWorks: import("file-lane/lib/interface/IFileLaneConfig").FollowWork<import("../interface/ICompileOptions").IXtsCompileOptions>[];
16
+ followWorks: {
17
+ worker: import("file-lane/lib/interface/IFileLaneConfig").FollowWork<import("../interface/ICompileOptions").IXtsCompileOptions>;
18
+ }[];
17
19
  }
18
20
  export default XtsConfig;
@@ -24,7 +24,17 @@ class XtsConfig {
24
24
  ]
25
25
  };
26
26
  this.preWorks = [preInstall_1.preInstall];
27
- this.followWorks = [entryTemplate_1.generateEntryFile, ts2wasm_1.ts2wasm, generateRpk_1.generateRpk];
27
+ this.followWorks = [
28
+ {
29
+ worker: entryTemplate_1.generateEntryFile
30
+ },
31
+ {
32
+ worker: ts2wasm_1.ts2wasm
33
+ },
34
+ {
35
+ worker: generateRpk_1.generateRpk
36
+ }
37
+ ];
28
38
  }
29
39
  }
30
40
  exports.default = XtsConfig;
@@ -26,7 +26,7 @@ const JavascriptCompiler_1 = __importDefault(require("../../compiler/javascript/
26
26
  const JavascriptDefaultCompileOption_1 = __importDefault(require("../../compiler/javascript/JavascriptDefaultCompileOption"));
27
27
  const Jsc_1 = __importDefault(require("../../compiler/javascript/vela/utils/Jsc"));
28
28
  const ZipUtil_1 = __importDefault(require("../../compiler/javascript/vela/utils/ZipUtil"));
29
- const UxFileUtils_1 = __importDefault(require("./UxFileUtils"));
29
+ const UxFileUtils_1 = __importDefault(require("../../utils/ux/UxFileUtils"));
30
30
  const BinaryPlugin = require('@aiot-toolkit/parser/lib/ux/translate/vela/protobuf/BinaryPlugin');
31
31
  /**
32
32
  * UxFollowWorks
@@ -242,12 +242,17 @@ UxFollowWorks.symlinkNodeModule = (context, config, compilerOption) => __awaiter
242
242
  if (!compilerOption) {
243
243
  return;
244
244
  }
245
- const foldList = ['node_modules'];
246
- foldList.forEach((item) => {
247
- const sourcePath = path_1.default.join(context.projectPath, item);
248
- if (fs_extra_1.default.existsSync(sourcePath)) {
249
- fs_extra_1.default.symlinkSync(sourcePath, path_1.default.join(compilerOption.projectPath, item), 'junction');
250
- }
251
- });
245
+ try {
246
+ const foldList = ['node_modules'];
247
+ foldList.forEach((item) => {
248
+ const sourcePath = path_1.default.join(context.projectPath, item);
249
+ if (fs_extra_1.default.existsSync(sourcePath)) {
250
+ fs_extra_1.default.symlinkSync(sourcePath, path_1.default.join(compilerOption.projectPath, item), 'junction');
251
+ }
252
+ });
253
+ }
254
+ catch (error) {
255
+ throw new Error(`${(error === null || error === void 0 ? void 0 : error.toString()) || 'unknown error'}. Please check whether the file system of the current disk supports the creation of soft links.`);
256
+ }
252
257
  });
253
258
  exports.default = UxFollowWorks;
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  var _a;
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- const UxFileUtils_1 = __importDefault(require("./UxFileUtils"));
16
+ const UxFileUtils_1 = __importDefault(require("../../utils/ux/UxFileUtils"));
17
17
  /**
18
18
  * UxPreWorks
19
19
  */
@@ -99,6 +99,7 @@ PreWorkUtils.clean = (context, _, config, compileOption) => __awaiter(void 0, vo
99
99
  BinaryPlugin.reset();
100
100
  BinaryPlugin.config = {
101
101
  projectPath: context.projectPath,
102
+ outputProjectPath: path_1.default.join(context.projectPath, context.output),
102
103
  source: compileOption === null || compileOption === void 0 ? void 0 : compileOption.sourceRoot,
103
104
  output: compileOption === null || compileOption === void 0 ? void 0 : compileOption.outputPath
104
105
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/aiotpack",
3
- "version": "2.0.2-beta.1",
3
+ "version": "2.0.2-beta.2",
4
4
  "description": "The process tool for packaging aiot projects.",
5
5
  "keywords": [
6
6
  "aiotpack"
@@ -19,17 +19,18 @@
19
19
  "test": "node ./__tests__/aiotpack.test.js"
20
20
  },
21
21
  "dependencies": {
22
- "@aiot-toolkit/generator": "2.0.2-beta.1",
23
- "@aiot-toolkit/parser": "2.0.2-beta.1",
22
+ "@aiot-toolkit/generator": "2.0.2-beta.2",
23
+ "@aiot-toolkit/parser": "2.0.2-beta.2",
24
24
  "@hap-toolkit/aaptjs": "^2.0.0",
25
25
  "babel-loader": "^9.1.3",
26
26
  "del": "^4.1.0",
27
27
  "fast-glob": "^3.3.2",
28
- "file-lane": "2.0.2-beta.1",
28
+ "file-lane": "2.0.2-beta.2",
29
29
  "file-loader": "^6.2.0",
30
30
  "fs-extra": "^11.2.0",
31
31
  "jsrsasign": "^7.2.2",
32
32
  "jszip": "^3.10.1",
33
+ "source-map": "^0.7.4",
33
34
  "url-loader": "^4.1.1",
34
35
  "webpack": "^5.89.0",
35
36
  "webpack-sources": "^3.2.3"
@@ -38,5 +39,5 @@
38
39
  "@types/jsrsasign": "^10.5.12",
39
40
  "@types/webpack-sources": "^3.2.3"
40
41
  },
41
- "gitHead": "9244af36e617295ea4ff11a2f4f07f0e4f9f5f59"
42
+ "gitHead": "5226bdb0ba61daef207531c2eaaf3d034e04c50f"
42
43
  }
File without changes