@aiot-toolkit/aiotpack 2.0.5-beta.1 → 2.0.5-beta.3

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.
@@ -6,6 +6,6 @@ import IJavascriptCompileOption from '../../compiler/javascript/interface/IJavas
6
6
  declare class JsLoader implements ILoader {
7
7
  context: IFileLaneContext;
8
8
  compilerOption: IJavascriptCompileOption;
9
- parser(files: IFileParam<any>[]): IFileParam<any>[] | Promise<IFileParam<any>[]>;
9
+ parser(files: IFileParam<any>[]): Promise<IFileParam<any>[]>;
10
10
  }
11
11
  export default JsLoader;
@@ -10,29 +10,32 @@ var _sharedUtils = require("@aiot-toolkit/shared-utils");
10
10
  * JsLoader
11
11
  */
12
12
  class JsLoader {
13
- parser(files) {
13
+ async parser(files) {
14
14
  const onLog = () => {};
15
- return files.map(item => {
15
+ const result = [];
16
+ for (const item of files) {
16
17
  if (!item.content) {
17
- return {
18
+ result.push({
18
19
  path: item.path,
19
20
  content: item.content
21
+ });
22
+ } else {
23
+ const options = {
24
+ filePath: item.path,
25
+ projectPath: this.context.projectPath,
26
+ content: item.content.toString(),
27
+ projectType: _sharedUtils.ProjectType.getProjectType(this.context.projectPath),
28
+ onLog
20
29
  };
30
+ result.push({
31
+ path: item.path,
32
+ content: (await new _parser.ScriptToTypescript(options, this.compilerOption, this.context).translate({
33
+ content: new _parser.ScriptParser(options).parser(item.content.toString()).ast.content
34
+ }, [])).targetTree.getFullText()
35
+ });
21
36
  }
22
- const options = {
23
- filePath: item.path,
24
- projectPath: this.context.projectPath,
25
- content: item.content.toString(),
26
- projectType: _sharedUtils.ProjectType.getProjectType(this.context.projectPath),
27
- onLog
28
- };
29
- return {
30
- path: item.path,
31
- content: new _parser.ScriptToTypescript(options, this.compilerOption, this.context).translate({
32
- content: new _parser.ScriptParser(options).parser(item.content.toString()).ast.content
33
- }, []).targetTree.getFullText()
34
- };
35
- });
37
+ }
38
+ return result;
36
39
  }
37
40
  }
38
41
  var _default = exports.default = JsLoader;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/aiotpack",
3
- "version": "2.0.5-beta.1",
3
+ "version": "2.0.5-beta.3",
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.1",
23
- "@aiot-toolkit/parser": "2.0.5-beta.1",
24
- "@aiot-toolkit/shared-utils": "2.0.5-beta.1",
22
+ "@aiot-toolkit/generator": "2.0.5-beta.3",
23
+ "@aiot-toolkit/parser": "2.0.5-beta.3",
24
+ "@aiot-toolkit/shared-utils": "2.0.5-beta.3",
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.5-beta.1",
31
+ "file-lane": "2.0.5-beta.3",
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": "44f8c6ee763bc01bd53c655b93e09c698057fc3e"
49
+ "gitHead": "273b9c3c85c4e199d642fd7aced0f140b7eac496"
50
50
  }