@aiot-toolkit/aiotpack 2.0.3-beta.7 → 2.0.3-beta.9

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.
Files changed (56) hide show
  1. package/lib/afterCompile/ux/UxAfterCompile.js +303 -266
  2. package/lib/afterCompile/xts/entryTemplate.js +111 -113
  3. package/lib/afterCompile/xts/generateRpk.js +25 -54
  4. package/lib/afterCompile/xts/ts2wasm.js +62 -63
  5. package/lib/afterWorks/ux/UxAfterWorks.js +12 -19
  6. package/lib/beforeCompile/ux/UxBeforeCompile.js +26 -25
  7. package/lib/beforeCompile/xts/preInstall.js +50 -55
  8. package/lib/beforeWorks/ux/UxBeforeWorks.js +12 -19
  9. package/lib/compiler/enum/CompileMode.js +16 -23
  10. package/lib/compiler/interface/ICompileParam.js +1 -2
  11. package/lib/compiler/interface/ICompiler.js +1 -2
  12. package/lib/compiler/interface/ISignConfig.js +1 -2
  13. package/lib/compiler/javascript/JavascriptCompiler.js +147 -154
  14. package/lib/compiler/javascript/JavascriptDefaultCompileOption.js +20 -16
  15. package/lib/compiler/javascript/android/AndroidWebpackConfigurator.js +13 -11
  16. package/lib/compiler/javascript/android/plugin/WrapPlugin.js +52 -48
  17. package/lib/compiler/javascript/interface/IJavascriptCompileOption.js +1 -2
  18. package/lib/compiler/javascript/interface/IWebpackConfigurator.js +4 -1
  19. package/lib/compiler/javascript/vela/VelaWebpackConfigurator.js +78 -75
  20. package/lib/compiler/javascript/vela/enum/BuildNameFormatType.js +30 -41
  21. package/lib/compiler/javascript/vela/enum/EntryType.js +15 -29
  22. package/lib/compiler/javascript/vela/interface/IChunk.js +4 -1
  23. package/lib/compiler/javascript/vela/interface/IManifest.js +1 -2
  24. package/lib/compiler/javascript/vela/interface/IQuickAppConfig.js +1 -2
  25. package/lib/compiler/javascript/vela/model/Package.js +80 -51
  26. package/lib/compiler/javascript/vela/plugin/WrapPlugin.js +30 -26
  27. package/lib/compiler/javascript/vela/utils/Jsc.js +30 -33
  28. package/lib/compiler/javascript/vela/utils/UxCompileUtil.js +152 -130
  29. package/lib/compiler/javascript/vela/utils/ZipUtil.js +282 -276
  30. package/lib/compiler/javascript/vela/utils/signature/Base64.js +65 -67
  31. package/lib/compiler/javascript/vela/utils/signature/CRC32.js +37 -35
  32. package/lib/compiler/javascript/vela/utils/signature/SignUtil.js +755 -731
  33. package/lib/compiler/javascript/vela/utils/signature/Signer.js +24 -22
  34. package/lib/compiler/javascript/vela/utils/webpackLoader/addColSourceMap.js +47 -52
  35. package/lib/compiler/javascript/vela/utils/webpackLoader/extractMapData.js +21 -17
  36. package/lib/config/UxConfig.js +145 -173
  37. package/lib/config/XtsConfig.js +30 -40
  38. package/lib/index.js +88 -41
  39. package/lib/interface/ICompileOptions.js +5 -2
  40. package/lib/interface/IDeviceList.js +1 -2
  41. package/lib/loader/ux/JsLoader.js +32 -30
  42. package/lib/loader/ux/PngLoader.js +47 -53
  43. package/lib/loader/ux/android/UxLoader.js +30 -31
  44. package/lib/loader/ux/vela/AppUxLoader.js +23 -24
  45. package/lib/loader/ux/vela/HmlLoader.js +59 -55
  46. package/lib/loader/ux/vela/UxLoader.js +29 -35
  47. package/lib/loader/xts/XtsLoader.js +55 -41
  48. package/lib/utils/BeforeCompileUtils.js +100 -92
  49. package/lib/utils/PngUtils.js +42 -36
  50. package/lib/utils/ux/ManifestSchema.js +198 -194
  51. package/lib/utils/ux/UxFileUtils.js +130 -116
  52. package/lib/utils/ux/UxLoaderUtils.js +292 -307
  53. package/lib/utils/ux/android/AndroidUx.js +88 -90
  54. package/lib/utils/xts/XtsFileLaneUtils.js +58 -65
  55. package/lib/utils/xts/XtsFollowWorks.js +122 -129
  56. package/package.json +6 -6
@@ -1,39 +1,33 @@
1
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 path_1 = __importDefault(require("path"));
16
- const UxLoaderUtils_1 = __importDefault(require("../../../utils/ux/UxLoaderUtils"));
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _path = _interopRequireDefault(require("path"));
8
+ var _UxLoaderUtils = _interopRequireDefault(require("../../../utils/ux/UxLoaderUtils"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
10
  class UxLoader {
18
- parser(files) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- const resultFiles = [];
21
- const { projectPath } = this.context;
22
- for (const file of files) {
23
- // 转换每个文件
24
- const { files: compiledFiles, logs } = yield UxLoaderUtils_1.default.compileUxToJavascript(file, this.context, false, this.compilerOption);
25
- this.logs = logs.map((item) => {
26
- var _a;
27
- return Object.assign(Object.assign({}, item), { filePath: ((_a = item.position) === null || _a === void 0 ? void 0 : _a.source)
28
- ? item.position.source
29
- : item.filePath
30
- ? path_1.default.relative(projectPath, item.filePath)
31
- : '' });
32
- });
33
- resultFiles.push(...compiledFiles);
34
- }
35
- return resultFiles;
36
- });
11
+ async parser(files) {
12
+ const resultFiles = [];
13
+ const {
14
+ projectPath
15
+ } = this.context;
16
+ for (const file of files) {
17
+ // 转换每个文件
18
+ const {
19
+ files: compiledFiles,
20
+ logs
21
+ } = await _UxLoaderUtils.default.compileUxToJavascript(file, this.context, false, this.compilerOption);
22
+ this.logs = logs.map(item => {
23
+ return {
24
+ ...item,
25
+ filePath: item.position?.source ? item.position.source : item.filePath ? _path.default.relative(projectPath, item.filePath) : ''
26
+ };
27
+ });
28
+ resultFiles.push(...compiledFiles);
37
29
  }
30
+ return resultFiles;
31
+ }
38
32
  }
39
- exports.default = UxLoader;
33
+ var _default = exports.default = UxLoader;
@@ -1,48 +1,62 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const generator_1 = require("@aiot-toolkit/generator");
7
- const parser_1 = require("@aiot-toolkit/parser");
8
- const shared_utils_1 = require("@aiot-toolkit/shared-utils");
9
- const path_1 = __importDefault(require("path"));
10
- const ts_morph_1 = require("ts-morph");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _generator = require("@aiot-toolkit/generator");
8
+ var _parser = require("@aiot-toolkit/parser");
9
+ var _sharedUtils = require("@aiot-toolkit/shared-utils");
10
+ var _path = _interopRequireDefault(require("path"));
11
+ var _tsMorph = require("ts-morph");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
13
  /**
12
14
  * XtsLoader
13
15
  */
14
16
  class XtsLoader {
15
- parser(files) {
16
- const project = new ts_morph_1.Project();
17
- const resultFiles = [];
18
- for (const file in files) {
19
- const { path, content } = files[file];
20
- const { name, ext } = path_1.default.parse(path);
21
- const fullName = `${name}${ext}`;
22
- const newFileName = `${name}.ts`;
23
- //判断文本,空文本则结束该文件处理
24
- if (!content) {
25
- shared_utils_1.ColorConsole.warn(`The file '${fullName}' under the path '${path}' has no content `);
26
- return [];
27
- }
28
- const parserResult = new parser_1.XtsParser(project, shared_utils_1.ColorConsole.logger).parser(content.toString(), fullName);
29
- const { ast, mapList } = new parser_1.XtsToTypescript(project, shared_utils_1.ColorConsole.logger, this.context, path).translate(parserResult.ast, parserResult.offsetList);
30
- const { code, sourcemap } = new generator_1.TypescriptGenerator().generate({
31
- sourceFilePath: fullName,
32
- targetFilePath: newFileName,
33
- ast,
34
- mapList
35
- });
36
- resultFiles.push({
37
- path: shared_utils_1.FileUtil.updateFileName(path, newFileName),
38
- content: code
39
- }, {
40
- path: shared_utils_1.FileUtil.updateFileName(path, `${name}.map.ts`),
41
- content: sourcemap
42
- });
43
- }
44
- // 返回内容
45
- return resultFiles;
17
+ parser(files) {
18
+ const project = new _tsMorph.Project();
19
+ const resultFiles = [];
20
+ for (const file in files) {
21
+ const {
22
+ path,
23
+ content
24
+ } = files[file];
25
+ const {
26
+ name,
27
+ ext
28
+ } = _path.default.parse(path);
29
+ const fullName = `${name}${ext}`;
30
+ const newFileName = `${name}.ts`;
31
+ //判断文本,空文本则结束该文件处理
32
+ if (!content) {
33
+ _sharedUtils.ColorConsole.warn(`The file '${fullName}' under the path '${path}' has no content `);
34
+ return [];
35
+ }
36
+ const parserResult = new _parser.XtsParser(project, _sharedUtils.ColorConsole.logger).parser(content.toString(), fullName);
37
+ const {
38
+ ast,
39
+ mapList
40
+ } = new _parser.XtsToTypescript(project, _sharedUtils.ColorConsole.logger, this.context, path).translate(parserResult.ast, parserResult.offsetList);
41
+ const {
42
+ code,
43
+ sourcemap
44
+ } = new _generator.TypescriptGenerator().generate({
45
+ sourceFilePath: fullName,
46
+ targetFilePath: newFileName,
47
+ ast,
48
+ mapList
49
+ });
50
+ resultFiles.push({
51
+ path: _sharedUtils.FileUtil.updateFileName(path, newFileName),
52
+ content: code
53
+ }, {
54
+ path: _sharedUtils.FileUtil.updateFileName(path, `${name}.map.ts`),
55
+ content: sourcemap
56
+ });
46
57
  }
58
+ // 返回内容
59
+ return resultFiles;
60
+ }
47
61
  }
48
- exports.default = XtsLoader;
62
+ var _default = exports.default = XtsLoader;
@@ -1,115 +1,123 @@
1
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
- var _a;
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- const parser_1 = require("@aiot-toolkit/parser");
17
- const shared_utils_1 = require("@aiot-toolkit/shared-utils");
18
- const fs_extra_1 = __importDefault(require("fs-extra"));
19
- const path_1 = __importDefault(require("path"));
20
- const TranslateCache_1 = __importDefault(require("@aiot-toolkit/parser/lib/ux/translate/vela/TranslateCache"));
21
- const UxFileUtils_1 = __importDefault(require("./ux/UxFileUtils"));
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _parser = require("@aiot-toolkit/parser");
8
+ var _sharedUtils = require("@aiot-toolkit/shared-utils");
9
+ var _fsExtra = _interopRequireDefault(require("fs-extra"));
10
+ var _path = _interopRequireDefault(require("path"));
11
+ var _TranslateCache = _interopRequireDefault(require("@aiot-toolkit/parser/lib/ux/translate/vela/TranslateCache"));
12
+ var _UxFileUtils = _interopRequireDefault(require("./ux/UxFileUtils"));
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
14
  const BinaryPlugin = require('@aiot-toolkit/parser/lib/ux/translate/vela/protobuf/BinaryPlugin');
15
+
23
16
  /**
24
17
  * BeforeCompileUtils
25
18
  */
26
19
  class BeforeCompileUtils {
27
- }
28
- _a = BeforeCompileUtils;
29
- /**
30
- * 获取ux项目的路由入口
31
- * @param context
32
- * @param fileList
33
- * @returns
34
- */
35
- BeforeCompileUtils.getEntries = (params) => {
36
- const { context, compilerOption } = params;
37
- const { projectPath } = context;
38
- const srcPath = path_1.default.join(projectPath, compilerOption.sourceRoot);
20
+ /**
21
+ * 获取ux项目的路由入口
22
+ * @param context
23
+ * @param fileList
24
+ * @returns
25
+ */
26
+ static getEntries = params => {
27
+ const {
28
+ context,
29
+ compilerOption
30
+ } = params;
31
+ const {
32
+ projectPath
33
+ } = context;
34
+ const srcPath = _path.default.join(projectPath, compilerOption.sourceRoot);
39
35
  // 判断路径是否真实存在
40
- const manifestContent = UxFileUtils_1.default.getMainfestInfo(projectPath);
36
+ const manifestContent = _UxFileUtils.default.getMainfestInfo(projectPath);
41
37
  // 存储entries
42
38
  let entryList = [];
43
- const { router } = manifestContent;
39
+ const {
40
+ router
41
+ } = manifestContent;
44
42
  if (router) {
45
- const { pages } = router;
46
- if (pages) {
47
- Object.keys(pages).map((page) => {
48
- const pageContent = pages[page];
49
- const entryDir = path_1.default.join(srcPath, page);
50
- const entryPages = parser_1.ExtensionConfig.TEMPLATES.map((item) => `${pageContent.component}${item}`);
51
- const entry = entryPages.find((item) => fs_extra_1.default.existsSync(path_1.default.join(entryDir, item)));
52
- if (entry) {
53
- entryList.push(path_1.default.join(entryDir, entry));
54
- }
55
- else {
56
- // 路径不存在
57
- shared_utils_1.ColorConsole.throw(`### manifest ### path '${path_1.default.join(entryDir, entryPages.join(' | '))}' does not exist`);
58
- }
59
- });
60
- }
61
- else {
62
- // 没有pages配置
63
- shared_utils_1.ColorConsole.throw(`### manifest ### No pages configuration`);
64
- }
65
- }
66
- else {
67
- // 没有router配置
68
- shared_utils_1.ColorConsole.throw(`### manifest ### No router configuration`);
43
+ const {
44
+ pages
45
+ } = router;
46
+ if (pages) {
47
+ Object.keys(pages).map(page => {
48
+ const pageContent = pages[page];
49
+ const entryDir = _path.default.join(srcPath, page);
50
+ const entryPages = _parser.ExtensionConfig.TEMPLATES.map(item => `${pageContent.component}${item}`);
51
+ const entry = entryPages.find(item => _fsExtra.default.existsSync(_path.default.join(entryDir, item)));
52
+ if (entry) {
53
+ entryList.push(_path.default.join(entryDir, entry));
54
+ } else {
55
+ // 路径不存在
56
+ _sharedUtils.ColorConsole.throw(`### manifest ### path '${_path.default.join(entryDir, entryPages.join(' | '))}' does not exist`);
57
+ }
58
+ });
59
+ } else {
60
+ // 没有pages配置
61
+ _sharedUtils.ColorConsole.throw(`### manifest ### No pages configuration`);
62
+ }
63
+ } else {
64
+ // 没有router配置
65
+ _sharedUtils.ColorConsole.throw(`### manifest ### No router configuration`);
69
66
  }
70
67
  context['entries'] = entryList;
71
68
  return Promise.resolve();
72
- };
73
- BeforeCompileUtils.clean = (params) => __awaiter(void 0, void 0, void 0, function* () {
74
- const { context, compilerOption, compalition } = params;
69
+ };
70
+ static clean = async params => {
71
+ const {
72
+ context,
73
+ compilerOption,
74
+ compalition
75
+ } = params;
75
76
  if (compilerOption) {
76
- // 存储build中的文件列表
77
- const buildPath = path_1.default.join(context.projectPath, compilerOption.outputPath);
78
- const buildFileList = fs_extra_1.default.existsSync(buildPath)
79
- ? shared_utils_1.FileUtil.readAlldirSync(buildPath).map((filePath) => {
80
- const relativePath = path_1.default.relative(buildPath, filePath);
81
- const fileContent = fs_extra_1.default.readFileSync(filePath);
82
- return { path: relativePath, content: fileContent };
83
- })
84
- : [];
85
- if (compalition) {
86
- compalition.buildFileList = buildFileList;
87
- }
77
+ // 存储build中的文件列表
78
+ const buildPath = _path.default.join(context.projectPath, compilerOption.outputPath);
79
+ const buildFileList = _fsExtra.default.existsSync(buildPath) ? _sharedUtils.FileUtil.readAlldirSync(buildPath).map(filePath => {
80
+ const relativePath = _path.default.relative(buildPath, filePath);
81
+ const fileContent = _fsExtra.default.readFileSync(filePath);
82
+ return {
83
+ path: relativePath,
84
+ content: fileContent
85
+ };
86
+ }) : [];
87
+ if (compalition) {
88
+ compalition.buildFileList = buildFileList;
89
+ }
88
90
  }
89
- context.translateCache = new TranslateCache_1.default();
91
+ context.translateCache = new _TranslateCache.default();
90
92
  BinaryPlugin.reset();
91
93
  BinaryPlugin.config = {
92
- projectPath: context.projectPath,
93
- outputProjectPath: path_1.default.join(context.projectPath, context.output),
94
- source: compilerOption === null || compilerOption === void 0 ? void 0 : compilerOption.sourceRoot,
95
- output: compilerOption === null || compilerOption === void 0 ? void 0 : compilerOption.outputPath
94
+ projectPath: context.projectPath,
95
+ outputProjectPath: _path.default.join(context.projectPath, context.output),
96
+ source: compilerOption?.sourceRoot,
97
+ output: compilerOption?.outputPath
96
98
  };
97
- });
98
- /**
99
- * 获取项目的全局样式变量配置
100
- * @param context
101
- */
102
- BeforeCompileUtils.getGlobalVar = (params) => {
103
- const { context, compilerOption } = params;
104
- const { projectPath } = context;
105
- const filePath = path_1.default.join(projectPath, (compilerOption === null || compilerOption === void 0 ? void 0 : compilerOption.sourceRoot) || '', 'globalVar.json');
99
+ };
100
+ /**
101
+ * 获取项目的全局样式变量配置
102
+ * @param context
103
+ */
104
+ static getGlobalVar = params => {
105
+ const {
106
+ context,
107
+ compilerOption
108
+ } = params;
109
+ const {
110
+ projectPath
111
+ } = context;
112
+ const filePath = _path.default.join(projectPath, compilerOption?.sourceRoot || '', 'globalVar.json');
106
113
  let globalVar = {};
107
114
  // 判断文件是否存在
108
- if (fs_extra_1.default.existsSync(filePath)) {
109
- // 存在则取内容,否则内容为空
110
- globalVar = fs_extra_1.default.readJSONSync(filePath);
115
+ if (_fsExtra.default.existsSync(filePath)) {
116
+ // 存在则取内容,否则内容为空
117
+ globalVar = _fsExtra.default.readJSONSync(filePath);
111
118
  }
112
119
  context.globalVar = globalVar;
113
120
  return Promise.resolve();
114
- };
115
- exports.default = BeforeCompileUtils;
121
+ };
122
+ }
123
+ var _default = exports.default = BeforeCompileUtils;
@@ -1,43 +1,49 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_extra_1 = __importDefault(require("fs-extra"));
7
- const path_1 = __importDefault(require("path"));
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _fsExtra = _interopRequireDefault(require("fs-extra"));
8
+ var _path = _interopRequireDefault(require("path"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
10
  /**
9
11
  * PngUtils
10
12
  */
11
13
  class PngUtils {
12
- /**
13
- * 检测.9.png是否编码
14
- * @param filePath
15
- * @returns
16
- */
17
- static isEncode9Png(filePath) {
18
- const buff = fs_extra_1.default.readFileSync(filePath);
19
- const start = 37;
20
- const end = 41;
21
- const encode = buff.subarray(start, end).toString() === 'npTc' ||
22
- buff.subarray(start, end).toString() === 'npOl';
23
- return encode;
24
- }
25
- /**
26
- * 计算文件转换后的目标路径
27
- * @param filePath
28
- * @param context
29
- * @returns
30
- */
31
- static convertOutputPath(filePath, context) {
32
- const { projectPath, output } = context;
33
- const fileRelativePath = path_1.default.relative(projectPath, filePath);
34
- const outputPath = path_1.default.join(projectPath, output, fileRelativePath);
35
- const outputDir = path_1.default.dirname(outputPath);
36
- // 判断输出文件夹是否存在,不存在则循环创建
37
- if (!fs_extra_1.default.existsSync(outputDir)) {
38
- fs_extra_1.default.mkdirSync(outputDir, { recursive: true });
39
- }
40
- return outputPath;
14
+ /**
15
+ * 检测.9.png是否编码
16
+ * @param filePath
17
+ * @returns
18
+ */
19
+ static isEncode9Png(filePath) {
20
+ const buff = _fsExtra.default.readFileSync(filePath);
21
+ const start = 37;
22
+ const end = 41;
23
+ const encode = buff.subarray(start, end).toString() === 'npTc' || buff.subarray(start, end).toString() === 'npOl';
24
+ return encode;
25
+ }
26
+ /**
27
+ * 计算文件转换后的目标路径
28
+ * @param filePath
29
+ * @param context
30
+ * @returns
31
+ */
32
+ static convertOutputPath(filePath, context) {
33
+ const {
34
+ projectPath,
35
+ output
36
+ } = context;
37
+ const fileRelativePath = _path.default.relative(projectPath, filePath);
38
+ const outputPath = _path.default.join(projectPath, output, fileRelativePath);
39
+ const outputDir = _path.default.dirname(outputPath);
40
+ // 判断输出文件夹是否存在,不存在则循环创建
41
+ if (!_fsExtra.default.existsSync(outputDir)) {
42
+ _fsExtra.default.mkdirSync(outputDir, {
43
+ recursive: true
44
+ });
41
45
  }
46
+ return outputPath;
47
+ }
42
48
  }
43
- exports.default = PngUtils;
49
+ var _default = exports.default = PngUtils;