@tarojs/service 3.6.0-canary.9 → 3.6.0

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.
package/dist/index.js CHANGED
@@ -14,11 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.TaroPlatformBase = exports.Kernel = void 0;
17
+ exports.TaroPlatformWeb = exports.TaroPlatformBase = exports.Kernel = void 0;
18
18
  const Kernel_1 = require("./Kernel");
19
19
  exports.Kernel = Kernel_1.default;
20
20
  const platform_plugin_base_1 = require("./platform-plugin-base");
21
21
  Object.defineProperty(exports, "TaroPlatformBase", { enumerable: true, get: function () { return platform_plugin_base_1.TaroPlatformBase; } });
22
+ Object.defineProperty(exports, "TaroPlatformWeb", { enumerable: true, get: function () { return platform_plugin_base_1.TaroPlatformWeb; } });
22
23
  __exportStar(require("./utils/types"), exports);
23
- exports.default = { Kernel: Kernel_1.default, TaroPlatformBase: platform_plugin_base_1.TaroPlatformBase };
24
+ exports.default = { Kernel: Kernel_1.default, TaroPlatformBase: platform_plugin_base_1.TaroPlatformBase, TaroPlatformWeb: platform_plugin_base_1.TaroPlatformWeb };
24
25
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAA6B;AAIpB,iBAJF,gBAAM,CAIE;AAHf,iEAAyD;AAIhD,iGAJA,uCAAgB,OAIA;AAFzB,gDAA6B;AAG7B,kBAAe,EAAE,MAAM,EAAN,gBAAM,EAAE,gBAAgB,EAAhB,uCAAgB,EAAE,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAA6B;AAIpB,iBAJF,gBAAM,CAIE;AAHf,iEAA0E;AAGzD,iGAHR,uCAAgB,OAGQ;AAAE,gGAHR,sCAAe,OAGQ;AADlD,gDAA6B;AAE7B,kBAAe,EAAE,MAAM,EAAN,gBAAM,EAAE,gBAAgB,EAAhB,uCAAgB,EAAE,eAAe,EAAf,sCAAe,EAAE,CAAA"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./mini"), exports);
18
+ __exportStar(require("./web"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform-plugin-base/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,wCAAqB"}
@@ -10,51 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.TaroPlatformBase = void 0;
13
- class Transaction {
14
- constructor() {
15
- this.wrappers = [];
16
- }
17
- perform(fn, scope, ...args) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- this.initAll(scope);
20
- yield fn.call(scope, ...args);
21
- this.closeAll(scope);
22
- });
23
- }
24
- initAll(scope) {
25
- const wrappers = this.wrappers;
26
- wrappers.forEach(wrapper => { var _a; return (_a = wrapper.init) === null || _a === void 0 ? void 0 : _a.call(scope); });
27
- }
28
- closeAll(scope) {
29
- const wrappers = this.wrappers;
30
- wrappers.forEach(wrapper => { var _a; return (_a = wrapper.close) === null || _a === void 0 ? void 0 : _a.call(scope); });
31
- }
32
- addWrapper(wrapper) {
33
- this.wrappers.push(wrapper);
34
- }
35
- }
36
- class TaroPlatformBase {
37
- constructor(ctx, config) {
38
- this.setupTransaction = new Transaction();
39
- this.buildTransaction = new Transaction();
40
- this.ctx = ctx;
41
- this.helper = ctx.helper;
42
- this.config = config;
43
- this.updateOutputPath(config);
44
- const _compiler = config.compiler;
45
- this.compiler = typeof _compiler === 'object' ? _compiler.type : _compiler;
46
- }
47
- /**
48
- * 如果分端编译详情webpack配置了output则需更新outputPath位置
49
- * 小程序端才能将project.config.json生成到正确的位置
50
- */
51
- updateOutputPath(config) {
52
- var _a;
53
- const platformPath = (_a = config.output) === null || _a === void 0 ? void 0 : _a.path;
54
- if (platformPath) {
55
- this.ctx.paths.outputPath = platformPath;
56
- }
57
- }
13
+ const platform_1 = require("./platform");
14
+ class TaroPlatformBase extends platform_1.default {
58
15
  /**
59
16
  * 1. 清空 dist 文件夹
60
17
  * 2. 输出编译提示
@@ -82,10 +39,6 @@ class TaroPlatformBase {
82
39
  printLog("start" /* processTypeEnum.START */, '开发者工具-项目目录', `${this.ctx.paths.outputPath}`);
83
40
  }
84
41
  }
85
- emptyOutputDir() {
86
- const { outputPath } = this.ctx.paths;
87
- this.helper.emptyDirectory(outputPath);
88
- }
89
42
  printDevelopmentTip(platform) {
90
43
  var _a;
91
44
  const tips = [];
@@ -149,7 +102,7 @@ ${exampleCommand}`));
149
102
  yield this.buildTransaction.perform(this.buildImpl, this, extraOptions);
150
103
  });
151
104
  }
152
- buildImpl(extraOptions) {
105
+ buildImpl(extraOptions = {}) {
153
106
  return __awaiter(this, void 0, void 0, function* () {
154
107
  const runner = yield this.getRunner();
155
108
  const options = this.getOptions(Object.assign({
@@ -203,4 +156,4 @@ ${exampleCommand}`));
203
156
  }
204
157
  }
205
158
  exports.TaroPlatformBase = TaroPlatformBase;
206
- //# sourceMappingURL=platform-plugin-base.js.map
159
+ //# sourceMappingURL=mini.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mini.js","sourceRoot":"","sources":["../../src/platform-plugin-base/mini.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAqC;AAYrC,MAAsB,gBAAiB,SAAQ,kBAAY;IAOzD;;;;OAIG;IACW,KAAK;;;YACjB,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;YACzD,MAAA,MAAA,IAAI,CAAC,GAAG,EAAC,YAAY,mDAAG,IAAI,CAAC,CAAA;;KAC9B;IAEO,SAAS;;QACf,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QACvC,IAAI,OAAO,eAAe,KAAK,WAAW,IAAI,CAAC,CAAC,eAAe,EAAE;YAC/D,IAAI,CAAC,cAAc,EAAE,CAAA;SACtB;QACD,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACvC,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1B,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;SACnD;QACD,IAAI,CAAA,MAAA,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,0CAAE,KAAK,MAAK,KAAK,EAAE;YAClD,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAA;YACrD,QAAQ,sCAAwB,YAAY,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAA;SAC9E;IACH,C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@ -0,0 +1,64 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Transaction = void 0;
13
+ class Transaction {
14
+ constructor() {
15
+ this.wrappers = [];
16
+ }
17
+ perform(fn, scope, ...args) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ this.initAll(scope);
20
+ yield fn.call(scope, ...args);
21
+ this.closeAll(scope);
22
+ });
23
+ }
24
+ initAll(scope) {
25
+ const wrappers = this.wrappers;
26
+ wrappers.forEach(wrapper => { var _a; return (_a = wrapper.init) === null || _a === void 0 ? void 0 : _a.call(scope); });
27
+ }
28
+ closeAll(scope) {
29
+ const wrappers = this.wrappers;
30
+ wrappers.forEach(wrapper => { var _a; return (_a = wrapper.close) === null || _a === void 0 ? void 0 : _a.call(scope); });
31
+ }
32
+ addWrapper(wrapper) {
33
+ this.wrappers.push(wrapper);
34
+ }
35
+ }
36
+ exports.Transaction = Transaction;
37
+ class TaroPlatform {
38
+ constructor(ctx, config) {
39
+ this.setupTransaction = new Transaction();
40
+ this.buildTransaction = new Transaction();
41
+ this.ctx = ctx;
42
+ this.helper = ctx.helper;
43
+ this.config = config;
44
+ this.updateOutputPath(config);
45
+ const _compiler = config.compiler;
46
+ this.compiler = typeof _compiler === 'object' ? _compiler.type : _compiler;
47
+ }
48
+ emptyOutputDir() {
49
+ const { outputPath } = this.ctx.paths;
50
+ this.helper.emptyDirectory(outputPath);
51
+ }
52
+ /**
53
+ * 如果分端编译详情 webpack 配置了 output 则需更新 outputPath 位置
54
+ */
55
+ updateOutputPath(config) {
56
+ var _a;
57
+ const platformPath = (_a = config.output) === null || _a === void 0 ? void 0 : _a.path;
58
+ if (platformPath) {
59
+ this.ctx.paths.outputPath = platformPath;
60
+ }
61
+ }
62
+ }
63
+ exports.default = TaroPlatform;
64
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/platform-plugin-base/platform.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA,MAAa,WAAW;IAAxB;QACE,aAAQ,GAAe,EAAE,CAAA;IAqB3B,CAAC;IAnBO,OAAO,CAAE,EAAQ,EAAE,KAAQ,EAAE,GAAG,IAAW;;YAC/C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;YACnB,MAAM,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAA;YAC7B,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QACtB,CAAC;KAAA;IAED,OAAO,CAAE,KAAQ;QACf,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,WAAC,OAAA,MAAA,OAAO,CAAC,IAAI,0CAAE,IAAI,CAAC,KAAK,CAAC,CAAA,EAAA,CAAC,CAAA;IACxD,CAAC;IAED,QAAQ,CAAE,KAAQ;QAChB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,WAAC,OAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,IAAI,CAAC,KAAK,CAAC,CAAA,EAAA,CAAC,CAAA;IACzD,CAAC;IAED,UAAU,CAAE,OAAiB;QAC3B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC7B,CAAC;CACF;AAtBD,kCAsBC;AAGD,MAA8B,YAAY;IAYxC,YAAa,GAAmB,EAAE,MAAS;QAHjC,qBAAgB,GAAG,IAAI,WAAW,EAAQ,CAAA;QAC1C,qBAAgB,GAAG,IAAI,WAAW,EAAQ,CAAA;QAGlD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;QAC7B,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAA;QACjC,IAAI,CAAC,QAAQ,GAAG,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;IAC5E,CAAC;IAES,cAAc;QACtB,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAA;QACrC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;IACxC,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAE,MAAe;;QACvC,MAAM,YAAY,GAAG,MAAA,MAAM,CAAC,MAAM,0CAAE,IAAI,CAAA;QACxC,IAAG,YAAY,EAAE;YACf,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,GAAG,YAAY,CAAA;SACzC;IACH,CAAC;CAMF;AAxCD,+BAwCC"}
@@ -0,0 +1,129 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TaroPlatformWeb = void 0;
13
+ const lodash_1 = require("lodash");
14
+ const path = require("path");
15
+ const package_1 = require("../utils/package");
16
+ const platform_1 = require("./platform");
17
+ class TaroPlatformWeb extends platform_1.default {
18
+ /**
19
+ * 1. 清空 dist 文件夹
20
+ * 2. 输出编译提示
21
+ */
22
+ setup() {
23
+ var _a, _b;
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ yield this.setupTransaction.perform(this.setupWebApp, this);
26
+ (_b = (_a = this.ctx).onSetupClose) === null || _b === void 0 ? void 0 : _b.call(_a, this);
27
+ });
28
+ }
29
+ setupWebApp() {
30
+ const { needClearOutput } = this.config;
31
+ if (typeof needClearOutput === 'undefined' || !!needClearOutput) {
32
+ this.emptyOutputDir();
33
+ }
34
+ this.printDevelopmentTip();
35
+ }
36
+ printDevelopmentTip() {
37
+ var _a;
38
+ const tips = [];
39
+ const config = this.config;
40
+ const { chalk } = this.helper;
41
+ if (this.compiler === 'webpack5' && !((_a = config.cache) === null || _a === void 0 ? void 0 : _a.enable)) {
42
+ tips.push(chalk.yellowBright('建议开启持久化缓存功能,能有效提升二次编译速度,详情请参考: https://docs.taro.zone/docs/config-detail#cache。'));
43
+ }
44
+ if (tips.length) {
45
+ console.log(chalk.yellowBright('Tips:'));
46
+ tips.forEach((item, index) => console.log(`${chalk.yellowBright(index + 1)}. ${item}`));
47
+ console.log('\n');
48
+ }
49
+ }
50
+ /**
51
+ * 返回当前项目内的 runner 包
52
+ */
53
+ getRunner() {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const { appPath } = this.ctx.paths;
56
+ const { npm } = this.helper;
57
+ let runnerPkg;
58
+ switch (this.compiler) {
59
+ case 'webpack5':
60
+ runnerPkg = '@tarojs/webpack5-runner';
61
+ break;
62
+ default:
63
+ runnerPkg = '@tarojs/webpack-runner';
64
+ }
65
+ const runner = yield npm.getNpmPkg(runnerPkg, appPath);
66
+ return runner.bind(null, appPath);
67
+ });
68
+ }
69
+ /**
70
+ * 准备 runner 参数
71
+ * @param extraOptions 需要额外合入 Options 的配置项
72
+ */
73
+ getOptions(extraOptions = {}) {
74
+ const { sourcePath } = this.ctx.paths;
75
+ const { initialConfig } = this.ctx;
76
+ const { port } = this.ctx.runOpts.options;
77
+ const { recursiveMerge, ENTRY, SOURCE_DIR, OUTPUT_DIR } = this.ctx.helper;
78
+ const entryFileName = `${ENTRY}.config`;
79
+ const entryFile = path.basename(entryFileName);
80
+ const defaultEntry = {
81
+ [ENTRY]: [path.join(sourcePath, entryFile)]
82
+ };
83
+ const customEntry = (0, lodash_1.get)(initialConfig, 'h5.entry');
84
+ const config = recursiveMerge(Object.assign({}, this.config), {
85
+ entryFileName: ENTRY,
86
+ env: {
87
+ TARO_ENV: JSON.stringify('h5'),
88
+ FRAMEWORK: JSON.stringify(this.config.framework),
89
+ TARO_VERSION: JSON.stringify((0, package_1.getPkgVersion)())
90
+ },
91
+ devServer: { port },
92
+ sourceRoot: this.config.sourceRoot || SOURCE_DIR,
93
+ outputRoot: this.config.outputRoot || OUTPUT_DIR
94
+ });
95
+ config.entry = (0, lodash_1.merge)(defaultEntry, customEntry);
96
+ return Object.assign(Object.assign({}, config), extraOptions);
97
+ }
98
+ /**
99
+ * 调用 runner 开始编译
100
+ * @param extraOptions 需要额外传入 runner 的配置项
101
+ */
102
+ build(extraOptions = {}) {
103
+ var _a, _b;
104
+ return __awaiter(this, void 0, void 0, function* () {
105
+ (_b = (_a = this.ctx).onBuildInit) === null || _b === void 0 ? void 0 : _b.call(_a, this);
106
+ yield this.buildTransaction.perform(this.buildWebApp, this, extraOptions);
107
+ });
108
+ }
109
+ buildWebApp(extraOptions = {}) {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ const runner = yield this.getRunner();
112
+ const options = this.getOptions(Object.assign({
113
+ runtimePath: this.runtimePath,
114
+ }, extraOptions));
115
+ yield runner(options);
116
+ });
117
+ }
118
+ /**
119
+ * 调用 runner 开启编译
120
+ */
121
+ start() {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ yield this.setup();
124
+ yield this.build();
125
+ });
126
+ }
127
+ }
128
+ exports.TaroPlatformWeb = TaroPlatformWeb;
129
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/platform-plugin-base/web.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAmC;AACnC,6BAA4B;AAE5B,8CAAgD;AAChD,yCAAqC;AAErC,MAAsB,eAAgB,SAAQ,kBAAY;IACxD;;;OAGG;IACW,KAAK;;;YACjB,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;YAC3D,MAAA,MAAA,IAAI,CAAC,GAAG,EAAC,YAAY,mDAAG,IAAI,CAAC,CAAA;;KAC9B;IAEO,WAAW;QACjB,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QACvC,IAAI,OAAO,eAAe,KAAK,WAAW,IAAI,CAAC,CAAC,eAAe,EAAE;YAC/D,IAAI,CAAC,cAAc,EAAE,CAAA;SACtB;QACD,IAAI,CAAC,mBAAmB,EAAE,CAAA;IAC5B,CAAC;IAES,mBAAmB;;QAC3B,MAAM,IAAI,GAAa,EAAE,CAAA;QACzB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QAC1B,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QAE7B,IAAI,IAAI,CAAC,QAAQ,KAAK,UAAU,IAAI,CAAC,CAAA,MAAA,MAAM,CAAC,KAAK,0CAAE,MAAM,CAAA,EAAE;YACzD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,iFAAiF,CAAC,CAAC,CAAA;SACjH;QAED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GAAG,EAAE;;YAC1C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAA;YACrC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC;gBAC5C,WAAW,EAAE,IAAI,CAAC,WAAW;aAC9B,EAAE,YAAY,CAAC,CAAC,CAAA;YACjB,MAAM,MAAM,CAAC,OAAO,CAAC,CAAA;QACvB,CAAC;KAAA;IAED;;OAEG;IACU,KAAK;;YAChB,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;YAClB,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC;KAAA;CACF;AAjHD,0CAiHC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printPkgVersion = exports.getPkgVersion = exports.getRootPath = void 0;
4
+ /* eslint-disable no-console */
5
+ const path = require("path");
6
+ function getRootPath() {
7
+ return path.resolve(__dirname, '../../');
8
+ }
9
+ exports.getRootPath = getRootPath;
10
+ function getPkgVersion() {
11
+ return require(path.join(getRootPath(), 'package.json')).version;
12
+ }
13
+ exports.getPkgVersion = getPkgVersion;
14
+ function printPkgVersion() {
15
+ console.log(`👽 Taro v${getPkgVersion()}`);
16
+ console.log();
17
+ }
18
+ exports.printPkgVersion = printPkgVersion;
19
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.js","sourceRoot":"","sources":["../../src/utils/package.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,6BAA4B;AAE5B,SAAgB,WAAW;IACzB,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;AAC1C,CAAC;AAFD,kCAEC;AAED,SAAgB,aAAa;IAC3B,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,CAAA;AAClE,CAAC;AAFD,sCAEC;AAED,SAAgB,eAAe;IAC7B,OAAO,CAAC,GAAG,CAAC,YAAY,aAAa,EAAE,EAAE,CAAC,CAAA;IAC1C,OAAO,CAAC,GAAG,EAAE,CAAA;AACf,CAAC;AAHD,0CAGC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/service",
3
- "version": "3.6.0-canary.9",
3
+ "version": "3.6.0",
4
4
  "description": "Taro Service",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -30,9 +30,9 @@
30
30
  "resolve": "^1.22.0",
31
31
  "tapable": "^1.1.3",
32
32
  "webpack-merge": "^4.2.2",
33
- "@tarojs/helper": "3.6.0-canary.9",
34
- "@tarojs/shared": "3.6.0-canary.9",
35
- "@tarojs/taro": "3.6.0-canary.9"
33
+ "@tarojs/helper": "3.6.0",
34
+ "@tarojs/shared": "3.6.0",
35
+ "@tarojs/taro": "3.6.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "webpack": "5.69.0"
package/src/index.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import Kernel from './Kernel'
2
- import { TaroPlatformBase } from './platform-plugin-base'
2
+ import { TaroPlatformBase, TaroPlatformWeb } from './platform-plugin-base'
3
3
 
4
4
  export * from './utils/types'
5
- export { Kernel }
6
- export { TaroPlatformBase }
7
- export default { Kernel, TaroPlatformBase }
5
+ export { Kernel, TaroPlatformBase, TaroPlatformWeb }
6
+ export default { Kernel, TaroPlatformBase, TaroPlatformWeb }
8
7
 
9
8
  export type { IPluginContext } from './utils/types'
@@ -0,0 +1,2 @@
1
+ export * from './mini'
2
+ export * from './web'
@@ -1,5 +1,6 @@
1
+ import TaroPlatform from './platform'
2
+
1
3
  import type { RecursiveTemplate, UnRecursiveTemplate } from '@tarojs/shared/dist/template'
2
- import type { Func, IPluginContext } from './utils/types'
3
4
 
4
5
  interface IFileType {
5
6
  templ: string
@@ -9,72 +10,13 @@ interface IFileType {
9
10
  xs?: string
10
11
  }
11
12
 
12
- interface IWrapper {
13
- init? (): void
14
- close? (): void
15
- }
16
-
17
- class Transaction {
18
- wrappers: IWrapper[] = []
19
-
20
- async perform (fn: Func, scope: TaroPlatformBase, ...args) {
21
- this.initAll(scope)
22
- await fn.call(scope, ...args)
23
- this.closeAll(scope)
24
- }
25
-
26
- initAll (scope) {
27
- const wrappers = this.wrappers
28
- wrappers.forEach(wrapper => wrapper.init?.call(scope))
29
- }
30
-
31
- closeAll (scope) {
32
- const wrappers = this.wrappers
33
- wrappers.forEach(wrapper => wrapper.close?.call(scope))
34
- }
35
-
36
- addWrapper (wrapper: IWrapper) {
37
- this.wrappers.push(wrapper)
38
- }
39
- }
40
-
41
- export abstract class TaroPlatformBase {
42
- ctx: IPluginContext
43
- helper: IPluginContext['helper']
44
- config: any
45
- compiler: string
46
-
47
- abstract platform: string
13
+ export abstract class TaroPlatformBase extends TaroPlatform {
48
14
  abstract globalObject: string
49
- abstract runtimePath: string | string[]
50
15
  abstract fileType: IFileType
51
16
  abstract template: RecursiveTemplate | UnRecursiveTemplate
52
17
  projectConfigJson?: string
53
18
  taroComponentsPath?: string
54
19
 
55
- setupTransaction = new Transaction()
56
- buildTransaction = new Transaction()
57
-
58
- constructor (ctx: IPluginContext, config) {
59
- this.ctx = ctx
60
- this.helper = ctx.helper
61
- this.config = config
62
- this.updateOutputPath(config)
63
- const _compiler = config.compiler
64
- this.compiler = typeof _compiler === 'object' ? _compiler.type : _compiler
65
- }
66
-
67
- /**
68
- * 如果分端编译详情webpack配置了output则需更新outputPath位置
69
- * 小程序端才能将project.config.json生成到正确的位置
70
- */
71
- private updateOutputPath (config) {
72
- const platformPath = config.output?.path
73
- if(platformPath) {
74
- this.ctx.paths.outputPath = platformPath
75
- }
76
- }
77
-
78
20
  /**
79
21
  * 1. 清空 dist 文件夹
80
22
  * 2. 输出编译提示
@@ -100,11 +42,6 @@ export abstract class TaroPlatformBase {
100
42
  }
101
43
  }
102
44
 
103
- protected emptyOutputDir () {
104
- const { outputPath } = this.ctx.paths
105
- this.helper.emptyDirectory(outputPath)
106
- }
107
-
108
45
  protected printDevelopmentTip (platform: string) {
109
46
  const tips: string[] = []
110
47
  const config = this.config
@@ -180,7 +117,7 @@ ${exampleCommand}`))
180
117
  await this.buildTransaction.perform(this.buildImpl, this, extraOptions)
181
118
  }
182
119
 
183
- private async buildImpl (extraOptions) {
120
+ private async buildImpl (extraOptions = {}) {
184
121
  const runner = await this.getRunner()
185
122
  const options = this.getOptions(Object.assign({
186
123
  runtimePath: this.runtimePath,
@@ -0,0 +1,73 @@
1
+ import type { Func, IPluginContext, TConfig } from '../utils/types'
2
+
3
+ interface IWrapper {
4
+ init? (): void
5
+ close? (): void
6
+ }
7
+
8
+ export class Transaction<T = TaroPlatform> {
9
+ wrappers: IWrapper[] = []
10
+
11
+ async perform (fn: Func, scope: T, ...args: any[]) {
12
+ this.initAll(scope)
13
+ await fn.call(scope, ...args)
14
+ this.closeAll(scope)
15
+ }
16
+
17
+ initAll (scope: T) {
18
+ const wrappers = this.wrappers
19
+ wrappers.forEach(wrapper => wrapper.init?.call(scope))
20
+ }
21
+
22
+ closeAll (scope: T) {
23
+ const wrappers = this.wrappers
24
+ wrappers.forEach(wrapper => wrapper.close?.call(scope))
25
+ }
26
+
27
+ addWrapper (wrapper: IWrapper) {
28
+ this.wrappers.push(wrapper)
29
+ }
30
+ }
31
+
32
+
33
+ export default abstract class TaroPlatform<T extends TConfig = TConfig> {
34
+ protected ctx: IPluginContext
35
+ protected config: T
36
+ protected helper: IPluginContext['helper']
37
+ protected compiler: string
38
+
39
+ abstract platform: string
40
+ abstract runtimePath: string | string[]
41
+
42
+ protected setupTransaction = new Transaction<this>()
43
+ protected buildTransaction = new Transaction<this>()
44
+
45
+ constructor (ctx: IPluginContext, config: T) {
46
+ this.ctx = ctx
47
+ this.helper = ctx.helper
48
+ this.config = config
49
+ this.updateOutputPath(config)
50
+ const _compiler = config.compiler
51
+ this.compiler = typeof _compiler === 'object' ? _compiler.type : _compiler
52
+ }
53
+
54
+ protected emptyOutputDir () {
55
+ const { outputPath } = this.ctx.paths
56
+ this.helper.emptyDirectory(outputPath)
57
+ }
58
+
59
+ /**
60
+ * 如果分端编译详情 webpack 配置了 output 则需更新 outputPath 位置
61
+ */
62
+ private updateOutputPath (config: TConfig) {
63
+ const platformPath = config.output?.path
64
+ if(platformPath) {
65
+ this.ctx.paths.outputPath = platformPath
66
+ }
67
+ }
68
+
69
+ /**
70
+ * 调用 runner 开启编译
71
+ */
72
+ abstract start(): Promise<void>
73
+ }
@@ -0,0 +1,120 @@
1
+ import { get, merge } from 'lodash'
2
+ import * as path from 'path'
3
+
4
+ import { getPkgVersion } from '../utils/package'
5
+ import TaroPlatform from './platform'
6
+
7
+ export abstract class TaroPlatformWeb extends TaroPlatform {
8
+ /**
9
+ * 1. 清空 dist 文件夹
10
+ * 2. 输出编译提示
11
+ */
12
+ private async setup () {
13
+ await this.setupTransaction.perform(this.setupWebApp, this)
14
+ this.ctx.onSetupClose?.(this)
15
+ }
16
+
17
+ private setupWebApp () {
18
+ const { needClearOutput } = this.config
19
+ if (typeof needClearOutput === 'undefined' || !!needClearOutput) {
20
+ this.emptyOutputDir()
21
+ }
22
+ this.printDevelopmentTip()
23
+ }
24
+
25
+ protected printDevelopmentTip () {
26
+ const tips: string[] = []
27
+ const config = this.config
28
+ const { chalk } = this.helper
29
+
30
+ if (this.compiler === 'webpack5' && !config.cache?.enable) {
31
+ tips.push(chalk.yellowBright('建议开启持久化缓存功能,能有效提升二次编译速度,详情请参考: https://docs.taro.zone/docs/config-detail#cache。'))
32
+ }
33
+
34
+ if (tips.length) {
35
+ console.log(chalk.yellowBright('Tips:'))
36
+ tips.forEach((item, index) => console.log(`${chalk.yellowBright(index + 1)}. ${item}`))
37
+ console.log('\n')
38
+ }
39
+ }
40
+
41
+ /**
42
+ * 返回当前项目内的 runner 包
43
+ */
44
+ protected async getRunner () {
45
+ const { appPath } = this.ctx.paths
46
+ const { npm } = this.helper
47
+
48
+ let runnerPkg: string
49
+ switch (this.compiler) {
50
+ case 'webpack5':
51
+ runnerPkg = '@tarojs/webpack5-runner'
52
+ break
53
+ default:
54
+ runnerPkg = '@tarojs/webpack-runner'
55
+ }
56
+
57
+ const runner = await npm.getNpmPkg(runnerPkg, appPath)
58
+
59
+ return runner.bind(null, appPath)
60
+ }
61
+
62
+ /**
63
+ * 准备 runner 参数
64
+ * @param extraOptions 需要额外合入 Options 的配置项
65
+ */
66
+ protected getOptions (extraOptions = {}) {
67
+ const { sourcePath } = this.ctx.paths
68
+ const { initialConfig } = this.ctx
69
+ const { port } = this.ctx.runOpts.options
70
+ const { recursiveMerge, ENTRY, SOURCE_DIR, OUTPUT_DIR } = this.ctx.helper
71
+ const entryFileName = `${ENTRY}.config`
72
+ const entryFile = path.basename(entryFileName)
73
+ const defaultEntry = {
74
+ [ENTRY]: [path.join(sourcePath, entryFile)]
75
+ }
76
+ const customEntry = get(initialConfig, 'h5.entry')
77
+ const config = recursiveMerge(Object.assign({}, this.config), {
78
+ entryFileName: ENTRY,
79
+ env: {
80
+ TARO_ENV: JSON.stringify('h5'),
81
+ FRAMEWORK: JSON.stringify(this.config.framework),
82
+ TARO_VERSION: JSON.stringify(getPkgVersion())
83
+ },
84
+ devServer: { port },
85
+ sourceRoot: this.config.sourceRoot || SOURCE_DIR,
86
+ outputRoot: this.config.outputRoot || OUTPUT_DIR
87
+ })
88
+ config.entry = merge(defaultEntry, customEntry)
89
+
90
+ return {
91
+ ...config,
92
+ ...extraOptions
93
+ }
94
+ }
95
+
96
+ /**
97
+ * 调用 runner 开始编译
98
+ * @param extraOptions 需要额外传入 runner 的配置项
99
+ */
100
+ private async build (extraOptions = {}) {
101
+ this.ctx.onBuildInit?.(this)
102
+ await this.buildTransaction.perform(this.buildWebApp, this, extraOptions)
103
+ }
104
+
105
+ private async buildWebApp (extraOptions = {}) {
106
+ const runner = await this.getRunner()
107
+ const options = this.getOptions(Object.assign({
108
+ runtimePath: this.runtimePath,
109
+ }, extraOptions))
110
+ await runner(options)
111
+ }
112
+
113
+ /**
114
+ * 调用 runner 开启编译
115
+ */
116
+ public async start () {
117
+ await this.setup()
118
+ await this.build()
119
+ }
120
+ }
@@ -0,0 +1,15 @@
1
+ /* eslint-disable no-console */
2
+ import * as path from 'path'
3
+
4
+ export function getRootPath (): string {
5
+ return path.resolve(__dirname, '../../')
6
+ }
7
+
8
+ export function getPkgVersion (): string {
9
+ return require(path.join(getRootPath(), 'package.json')).version
10
+ }
11
+
12
+ export function printPkgVersion () {
13
+ console.log(`👽 Taro v${getPkgVersion()}`)
14
+ console.log()
15
+ }
@@ -2,7 +2,8 @@ import type helper from '@tarojs/helper'
2
2
  import type { IProjectConfig } from '@tarojs/taro/types/compile'
3
3
  import type { Attrs, Tagname } from '@tarojs/taro/types/compile/hooks'
4
4
  import type joi from 'joi'
5
- import type { Compilation, Compiler } from 'webpack'
5
+ import type Webpack from 'webpack'
6
+ import type Chain from 'webpack-chain'
6
7
  import type { PluginType } from './constants'
7
8
 
8
9
  export interface IPaths {
@@ -142,11 +143,11 @@ export declare interface IPluginContext {
142
143
  /**
143
144
  * 修改编译过程中的页面组件配置
144
145
  */
145
- onCompilerMake: (fn: (args: { compilation: Compilation, compiler: Compiler, plugin: any }) => void) => void
146
+ onCompilerMake: (fn: (args: { compilation: Webpack.Compilation, compiler: Webpack.Compiler, plugin: any }) => void) => void
146
147
  /**
147
148
  * 编译中修改 webpack 配置,在这个钩子中,你可以对 webpackChain 作出想要的调整,等同于配置 [`webpackChain`](./config-detail.md#miniwebpackchain)
148
149
  */
149
- modifyWebpackChain: (fn: (args: { chain: any, webpack: any, data?: IModifyWebpackChain }) => void) => void
150
+ modifyWebpackChain: (fn: (args: { chain: Chain, webpack: typeof Webpack, data?: IModifyWebpackChain }) => void) => void
150
151
  /**
151
152
  * 修改编译后的结果
152
153
  */
@@ -158,3 +159,5 @@ export declare interface IPluginContext {
158
159
 
159
160
  [key: string]: any
160
161
  }
162
+
163
+ export declare type TConfig = Record<string, any>
package/types/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import Kernel from './Kernel';
2
- import { TaroPlatformBase } from './platform-plugin-base';
2
+ import { TaroPlatformBase, TaroPlatformWeb } from './platform-plugin-base';
3
3
  export * from './utils/types';
4
- export { Kernel };
5
- export { TaroPlatformBase };
4
+ export { Kernel, TaroPlatformBase, TaroPlatformWeb };
6
5
  declare const _default: {
7
6
  Kernel: typeof Kernel;
8
7
  TaroPlatformBase: typeof TaroPlatformBase;
8
+ TaroPlatformWeb: typeof TaroPlatformWeb;
9
9
  };
10
10
  export default _default;
11
11
  export type { IPluginContext } from './utils/types';
@@ -0,0 +1,2 @@
1
+ export * from './mini';
2
+ export * from './web';
@@ -1,5 +1,5 @@
1
+ import TaroPlatform from './platform';
1
2
  import type { RecursiveTemplate, UnRecursiveTemplate } from '@tarojs/shared/dist/template';
2
- import type { Func, IPluginContext } from './utils/types';
3
3
  interface IFileType {
4
4
  templ: string;
5
5
  style: string;
@@ -7,37 +7,12 @@ interface IFileType {
7
7
  script: string;
8
8
  xs?: string;
9
9
  }
10
- interface IWrapper {
11
- init?(): void;
12
- close?(): void;
13
- }
14
- declare class Transaction {
15
- wrappers: IWrapper[];
16
- perform(fn: Func, scope: TaroPlatformBase, ...args: any[]): Promise<void>;
17
- initAll(scope: any): void;
18
- closeAll(scope: any): void;
19
- addWrapper(wrapper: IWrapper): void;
20
- }
21
- export declare abstract class TaroPlatformBase {
22
- ctx: IPluginContext;
23
- helper: IPluginContext['helper'];
24
- config: any;
25
- compiler: string;
26
- abstract platform: string;
10
+ export declare abstract class TaroPlatformBase extends TaroPlatform {
27
11
  abstract globalObject: string;
28
- abstract runtimePath: string | string[];
29
12
  abstract fileType: IFileType;
30
13
  abstract template: RecursiveTemplate | UnRecursiveTemplate;
31
14
  projectConfigJson?: string;
32
15
  taroComponentsPath?: string;
33
- setupTransaction: Transaction;
34
- buildTransaction: Transaction;
35
- constructor(ctx: IPluginContext, config: any);
36
- /**
37
- * 如果分端编译详情webpack配置了output则需更新outputPath位置
38
- * 小程序端才能将project.config.json生成到正确的位置
39
- */
40
- private updateOutputPath;
41
16
  /**
42
17
  * 1. 清空 dist 文件夹
43
18
  * 2. 输出编译提示
@@ -45,7 +20,6 @@ export declare abstract class TaroPlatformBase {
45
20
  */
46
21
  private setup;
47
22
  private setupImpl;
48
- protected emptyOutputDir(): void;
49
23
  protected printDevelopmentTip(platform: string): void;
50
24
  /**
51
25
  * 返回当前项目内的 @tarojs/mini-runner 包
@@ -55,7 +29,13 @@ export declare abstract class TaroPlatformBase {
55
29
  * 准备 mini-runner 参数
56
30
  * @param extraOptions 需要额外合入 Options 的配置项
57
31
  */
58
- protected getOptions(extraOptions?: {}): any;
32
+ protected getOptions(extraOptions?: {}): {
33
+ nodeModulesPath: string;
34
+ buildAdapter: any;
35
+ globalObject: string;
36
+ fileType: IFileType;
37
+ template: RecursiveTemplate | UnRecursiveTemplate;
38
+ };
59
39
  /**
60
40
  * 调用 mini-runner 开始编译
61
41
  * @param extraOptions 需要额外传入 @tarojs/mini-runner 的配置项
@@ -0,0 +1,33 @@
1
+ import type { Func, IPluginContext, TConfig } from '../utils/types';
2
+ interface IWrapper {
3
+ init?(): void;
4
+ close?(): void;
5
+ }
6
+ export declare class Transaction<T = TaroPlatform> {
7
+ wrappers: IWrapper[];
8
+ perform(fn: Func, scope: T, ...args: any[]): Promise<void>;
9
+ initAll(scope: T): void;
10
+ closeAll(scope: T): void;
11
+ addWrapper(wrapper: IWrapper): void;
12
+ }
13
+ export default abstract class TaroPlatform<T extends TConfig = TConfig> {
14
+ protected ctx: IPluginContext;
15
+ protected config: T;
16
+ protected helper: IPluginContext['helper'];
17
+ protected compiler: string;
18
+ abstract platform: string;
19
+ abstract runtimePath: string | string[];
20
+ protected setupTransaction: Transaction<this>;
21
+ protected buildTransaction: Transaction<this>;
22
+ constructor(ctx: IPluginContext, config: T);
23
+ protected emptyOutputDir(): void;
24
+ /**
25
+ * 如果分端编译详情 webpack 配置了 output 则需更新 outputPath 位置
26
+ */
27
+ private updateOutputPath;
28
+ /**
29
+ * 调用 runner 开启编译
30
+ */
31
+ abstract start(): Promise<void>;
32
+ }
33
+ export {};
@@ -0,0 +1,29 @@
1
+ import TaroPlatform from './platform';
2
+ export declare abstract class TaroPlatformWeb extends TaroPlatform {
3
+ /**
4
+ * 1. 清空 dist 文件夹
5
+ * 2. 输出编译提示
6
+ */
7
+ private setup;
8
+ private setupWebApp;
9
+ protected printDevelopmentTip(): void;
10
+ /**
11
+ * 返回当前项目内的 runner 包
12
+ */
13
+ protected getRunner(): Promise<any>;
14
+ /**
15
+ * 准备 runner 参数
16
+ * @param extraOptions 需要额外合入 Options 的配置项
17
+ */
18
+ protected getOptions(extraOptions?: {}): any;
19
+ /**
20
+ * 调用 runner 开始编译
21
+ * @param extraOptions 需要额外传入 runner 的配置项
22
+ */
23
+ private build;
24
+ private buildWebApp;
25
+ /**
26
+ * 调用 runner 开启编译
27
+ */
28
+ start(): Promise<void>;
29
+ }
@@ -0,0 +1,3 @@
1
+ export declare function getRootPath(): string;
2
+ export declare function getPkgVersion(): string;
3
+ export declare function printPkgVersion(): void;
@@ -2,7 +2,8 @@ import type helper from '@tarojs/helper';
2
2
  import type { IProjectConfig } from '@tarojs/taro/types/compile';
3
3
  import type { Attrs, Tagname } from '@tarojs/taro/types/compile/hooks';
4
4
  import type joi from 'joi';
5
- import type { Compilation, Compiler } from 'webpack';
5
+ import type Webpack from 'webpack';
6
+ import type Chain from 'webpack-chain';
6
7
  import type { PluginType } from './constants';
7
8
  export interface IPaths {
8
9
  /**
@@ -139,16 +140,16 @@ export declare interface IPluginContext {
139
140
  * 修改编译过程中的页面组件配置
140
141
  */
141
142
  onCompilerMake: (fn: (args: {
142
- compilation: Compilation;
143
- compiler: Compiler;
143
+ compilation: Webpack.Compilation;
144
+ compiler: Webpack.Compiler;
144
145
  plugin: any;
145
146
  }) => void) => void;
146
147
  /**
147
148
  * 编译中修改 webpack 配置,在这个钩子中,你可以对 webpackChain 作出想要的调整,等同于配置 [`webpackChain`](./config-detail.md#miniwebpackchain)
148
149
  */
149
150
  modifyWebpackChain: (fn: (args: {
150
- chain: any;
151
- webpack: any;
151
+ chain: Chain;
152
+ webpack: typeof Webpack;
152
153
  data?: IModifyWebpackChain;
153
154
  }) => void) => void;
154
155
  /**
@@ -166,4 +167,5 @@ export declare interface IPluginContext {
166
167
  }) => void) => void;
167
168
  [key: string]: any;
168
169
  }
170
+ export declare type TConfig = Record<string, any>;
169
171
  export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"platform-plugin-base.js","sourceRoot":"","sources":["../src/platform-plugin-base.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,MAAM,WAAW;IAAjB;QACE,aAAQ,GAAe,EAAE,CAAA;IAqB3B,CAAC;IAnBO,OAAO,CAAE,EAAQ,EAAE,KAAuB,EAAE,GAAG,IAAI;;YACvD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;YACnB,MAAM,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAA;YAC7B,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QACtB,CAAC;KAAA;IAED,OAAO,CAAE,KAAK;QACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,WAAC,OAAA,MAAA,OAAO,CAAC,IAAI,0CAAE,IAAI,CAAC,KAAK,CAAC,CAAA,EAAA,CAAC,CAAA;IACxD,CAAC;IAED,QAAQ,CAAE,KAAK;QACb,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,WAAC,OAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,IAAI,CAAC,KAAK,CAAC,CAAA,EAAA,CAAC,CAAA;IACzD,CAAC;IAED,UAAU,CAAE,OAAiB;QA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