@spcsn/taro-service 0.1.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.
Files changed (41) hide show
  1. package/LICENSE +174 -0
  2. package/dist/Config.d.ts +21 -0
  3. package/dist/Config.js +135 -0
  4. package/dist/Config.js.map +1 -0
  5. package/dist/Kernel.d.ts +66 -0
  6. package/dist/Kernel.js +357 -0
  7. package/dist/Kernel.js.map +1 -0
  8. package/dist/Plugin.d.ts +15 -0
  9. package/dist/Plugin.js +73 -0
  10. package/dist/Plugin.js.map +1 -0
  11. package/dist/index.d.ts +14 -0
  12. package/dist/index.js +31 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/platform-plugin-base/index.d.ts +3 -0
  15. package/dist/platform-plugin-base/index.js +25 -0
  16. package/dist/platform-plugin-base/index.js.map +1 -0
  17. package/dist/platform-plugin-base/mini.d.ts +57 -0
  18. package/dist/platform-plugin-base/mini.js +165 -0
  19. package/dist/platform-plugin-base/mini.js.map +1 -0
  20. package/dist/platform-plugin-base/platform.d.ts +38 -0
  21. package/dist/platform-plugin-base/platform.js +67 -0
  22. package/dist/platform-plugin-base/platform.js.map +1 -0
  23. package/dist/platform-plugin-base/web.d.ts +32 -0
  24. package/dist/platform-plugin-base/web.js +150 -0
  25. package/dist/platform-plugin-base/web.js.map +1 -0
  26. package/dist/platform-plugin-base/webpack/hmr-plugin.d.ts +4 -0
  27. package/dist/platform-plugin-base/webpack/hmr-plugin.js +37 -0
  28. package/dist/platform-plugin-base/webpack/hmr-plugin.js.map +1 -0
  29. package/dist/utils/constants.d.ts +16 -0
  30. package/dist/utils/constants.js +21 -0
  31. package/dist/utils/constants.js.map +1 -0
  32. package/dist/utils/index.d.ts +10 -0
  33. package/dist/utils/index.js +186 -0
  34. package/dist/utils/index.js.map +1 -0
  35. package/dist/utils/package.d.ts +3 -0
  36. package/dist/utils/package.js +51 -0
  37. package/dist/utils/package.js.map +1 -0
  38. package/dist/utils/types.d.ts +187 -0
  39. package/dist/utils/types.js +3 -0
  40. package/dist/utils/types.js.map +1 -0
  41. package/package.json +48 -0
package/dist/Kernel.js ADDED
@@ -0,0 +1,357 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const node_events_1 = require("node:events");
40
+ const path = __importStar(require("node:path"));
41
+ const helper = __importStar(require("@spcsn/taro-helper"));
42
+ const runnerUtils = __importStar(require("@spcsn/taro-runner-utils"));
43
+ const taro_shared_1 = require("@spcsn/taro-shared");
44
+ const lodash_1 = require("lodash");
45
+ const tapable_1 = require("tapable");
46
+ const Plugin_1 = __importDefault(require("./Plugin"));
47
+ const utils_1 = require("./utils");
48
+ const constants_1 = require("./utils/constants");
49
+ class Kernel extends node_events_1.EventEmitter {
50
+ constructor(options) {
51
+ super();
52
+ this.debugger = process.env.DEBUG === 'Taro:Kernel' ? helper.createDebug('Taro:Kernel') : function () { };
53
+ this.appPath = options.appPath || process.cwd();
54
+ this.optsPresets = options.presets;
55
+ this.optsPlugins = options.plugins;
56
+ this.config = options.config;
57
+ this.hooks = new Map();
58
+ this.methods = new Map();
59
+ this.commands = new Map();
60
+ this.platforms = new Map();
61
+ this.initHelper();
62
+ this.initConfig();
63
+ this.initPaths();
64
+ this.initRunnerUtils();
65
+ }
66
+ initConfig() {
67
+ this.initialConfig = this.config.initialConfig;
68
+ this.initialGlobalConfig = this.config.initialGlobalConfig;
69
+ this.debugger('initConfig', this.initialConfig);
70
+ }
71
+ initPaths() {
72
+ this.paths = {
73
+ appPath: this.appPath,
74
+ nodeModulesPath: helper.recursiveFindNodeModules(path.join(this.appPath, helper.NODE_MODULES)),
75
+ };
76
+ if (this.config.isInitSuccess) {
77
+ Object.assign(this.paths, {
78
+ configPath: this.config.configPath,
79
+ sourcePath: path.join(this.appPath, this.initialConfig.sourceRoot),
80
+ outputPath: path.resolve(this.appPath, this.initialConfig.outputRoot),
81
+ });
82
+ }
83
+ this.debugger(`initPaths:${JSON.stringify(this.paths, null, 2)}`);
84
+ }
85
+ initHelper() {
86
+ this.helper = helper;
87
+ this.debugger('initHelper');
88
+ }
89
+ initRunnerUtils() {
90
+ this.runnerUtils = runnerUtils;
91
+ this.debugger('initRunnerUtils');
92
+ }
93
+ initPresetsAndPlugins() {
94
+ const initialConfig = this.initialConfig;
95
+ const initialGlobalConfig = this.initialGlobalConfig;
96
+ const cliAndProjectConfigPresets = (0, utils_1.mergePlugins)(this.optsPresets || [], initialConfig.presets || [])();
97
+ const cliAndProjectPlugins = (0, utils_1.mergePlugins)(this.optsPlugins || [], initialConfig.plugins || [])();
98
+ const globalPlugins = (0, utils_1.convertPluginsToObject)(initialGlobalConfig.plugins || [])();
99
+ const globalPresets = (0, utils_1.convertPluginsToObject)(initialGlobalConfig.presets || [])();
100
+ this.debugger('initPresetsAndPlugins', cliAndProjectConfigPresets, cliAndProjectPlugins);
101
+ this.debugger('globalPresetsAndPlugins', globalPlugins, globalPresets);
102
+ process.env.NODE_ENV !== 'test' &&
103
+ helper.createSwcRegister({
104
+ only: [
105
+ ...Object.keys(cliAndProjectConfigPresets),
106
+ ...Object.keys(cliAndProjectPlugins),
107
+ ...Object.keys(globalPresets),
108
+ ...Object.keys(globalPlugins),
109
+ ],
110
+ });
111
+ this.plugins = new Map();
112
+ this.extraPlugins = {};
113
+ this.globalExtraPlugins = {};
114
+ this.resolvePresets(cliAndProjectConfigPresets, globalPresets);
115
+ this.resolvePlugins(cliAndProjectPlugins, globalPlugins);
116
+ }
117
+ resolvePresets(cliAndProjectPresets, globalPresets) {
118
+ const resolvedCliAndProjectPresets = (0, utils_1.resolvePresetsOrPlugins)(this.appPath, cliAndProjectPresets, constants_1.PluginType.Preset);
119
+ while (resolvedCliAndProjectPresets.length) {
120
+ this.initPreset(resolvedCliAndProjectPresets.shift());
121
+ }
122
+ const globalConfigRootPath = path.join(helper.getUserHomeDir(), helper.TARO_GLOBAL_CONFIG_DIR);
123
+ const resolvedGlobalPresets = (0, utils_1.resolvePresetsOrPlugins)(globalConfigRootPath, globalPresets, constants_1.PluginType.Plugin, true);
124
+ while (resolvedGlobalPresets.length) {
125
+ this.initPreset(resolvedGlobalPresets.shift(), true);
126
+ }
127
+ }
128
+ resolvePlugins(cliAndProjectPlugins, globalPlugins) {
129
+ cliAndProjectPlugins = (0, lodash_1.merge)(this.extraPlugins, cliAndProjectPlugins);
130
+ const resolvedCliAndProjectPlugins = (0, utils_1.resolvePresetsOrPlugins)(this.appPath, cliAndProjectPlugins, constants_1.PluginType.Plugin);
131
+ globalPlugins = (0, lodash_1.merge)(this.globalExtraPlugins, globalPlugins);
132
+ const globalConfigRootPath = path.join(helper.getUserHomeDir(), helper.TARO_GLOBAL_CONFIG_DIR);
133
+ const resolvedGlobalPlugins = (0, utils_1.resolvePresetsOrPlugins)(globalConfigRootPath, globalPlugins, constants_1.PluginType.Plugin, true);
134
+ const resolvedPlugins = resolvedCliAndProjectPlugins.concat(resolvedGlobalPlugins);
135
+ while (resolvedPlugins.length) {
136
+ this.initPlugin(resolvedPlugins.shift());
137
+ }
138
+ this.extraPlugins = {};
139
+ this.globalExtraPlugins = {};
140
+ }
141
+ initPreset(preset, isGlobalConfigPreset) {
142
+ this.debugger('initPreset', preset);
143
+ const { id, path, opts, apply } = preset;
144
+ const pluginCtx = this.initPluginCtx({ id, path, ctx: this });
145
+ const { presets, plugins } = apply()(pluginCtx, opts) || {};
146
+ this.registerPlugin(preset);
147
+ if (Array.isArray(presets)) {
148
+ const _presets = (0, utils_1.resolvePresetsOrPlugins)(this.appPath, (0, utils_1.convertPluginsToObject)(presets)(), constants_1.PluginType.Preset, isGlobalConfigPreset);
149
+ while (_presets.length) {
150
+ this.initPreset(_presets.shift(), isGlobalConfigPreset);
151
+ }
152
+ }
153
+ if (Array.isArray(plugins)) {
154
+ isGlobalConfigPreset
155
+ ? (this.globalExtraPlugins = (0, lodash_1.merge)(this.globalExtraPlugins, (0, utils_1.convertPluginsToObject)(plugins)()))
156
+ : (this.extraPlugins = (0, lodash_1.merge)(this.extraPlugins, (0, utils_1.convertPluginsToObject)(plugins)()));
157
+ }
158
+ }
159
+ initPlugin(plugin) {
160
+ const { id, path, opts, apply } = plugin;
161
+ const pluginCtx = this.initPluginCtx({ id, path, ctx: this });
162
+ this.debugger('initPlugin', plugin);
163
+ this.registerPlugin(plugin);
164
+ apply()(pluginCtx, opts);
165
+ this.checkPluginOpts(pluginCtx, opts);
166
+ }
167
+ applyCliCommandPlugin(commandNames = []) {
168
+ const existsCliCommand = [];
169
+ for (let i = 0; i < commandNames.length; i++) {
170
+ const commandName = commandNames[i];
171
+ const commandFilePath = path.resolve(this.cliCommandsPath, `${commandName}.js`);
172
+ if (this.cliCommands.includes(commandName))
173
+ existsCliCommand.push(commandFilePath);
174
+ }
175
+ const commandPlugins = (0, utils_1.convertPluginsToObject)(existsCliCommand || [])();
176
+ helper.createSwcRegister({ only: [...Object.keys(commandPlugins)] });
177
+ const resolvedCommandPlugins = (0, utils_1.resolvePresetsOrPlugins)(this.appPath, commandPlugins, constants_1.PluginType.Plugin);
178
+ while (resolvedCommandPlugins.length) {
179
+ this.initPlugin(resolvedCommandPlugins.shift());
180
+ }
181
+ }
182
+ checkPluginOpts(pluginCtx, opts) {
183
+ if (typeof pluginCtx.optsSchema !== 'function') {
184
+ return;
185
+ }
186
+ this.debugger('checkPluginOpts', pluginCtx);
187
+ const joi = require('joi');
188
+ const schema = pluginCtx.optsSchema(joi);
189
+ if (!joi.isSchema(schema)) {
190
+ throw new Error(`插件${pluginCtx.id}中设置参数检查 schema 有误,请检查!`);
191
+ }
192
+ const { error } = schema.validate(opts);
193
+ if (error) {
194
+ error.message = `插件${pluginCtx.id}获得的参数不符合要求,请检查!`;
195
+ throw error;
196
+ }
197
+ }
198
+ registerPlugin(plugin) {
199
+ this.debugger('registerPlugin', plugin);
200
+ if (this.plugins.has(plugin.id)) {
201
+ throw new Error(`插件 ${plugin.id} 已被注册`);
202
+ }
203
+ this.plugins.set(plugin.id, plugin);
204
+ }
205
+ initPluginCtx({ id, path, ctx }) {
206
+ const pluginCtx = new Plugin_1.default({ id, path, ctx });
207
+ const internalMethods = ['onReady', 'onStart'];
208
+ const kernelApis = [
209
+ 'appPath',
210
+ 'plugins',
211
+ 'platforms',
212
+ 'paths',
213
+ 'helper',
214
+ 'runOpts',
215
+ 'runnerUtils',
216
+ 'initialConfig',
217
+ 'applyPlugins',
218
+ 'applyCliCommandPlugin',
219
+ ];
220
+ internalMethods.forEach((name) => {
221
+ if (!this.methods.has(name)) {
222
+ pluginCtx.registerMethod(name);
223
+ }
224
+ });
225
+ return new Proxy(pluginCtx, {
226
+ get: (target, name) => {
227
+ if (this.methods.has(name)) {
228
+ const method = this.methods.get(name);
229
+ if (Array.isArray(method)) {
230
+ return (...arg) => {
231
+ method.forEach((item) => {
232
+ item.apply(this, arg);
233
+ });
234
+ };
235
+ }
236
+ return method;
237
+ }
238
+ if (kernelApis.includes(name)) {
239
+ return typeof this[name] === 'function' ? this[name].bind(this) : this[name];
240
+ }
241
+ return target[name];
242
+ },
243
+ });
244
+ }
245
+ async applyPlugins(args) {
246
+ let name;
247
+ let initialVal;
248
+ let opts;
249
+ if (typeof args === 'string') {
250
+ name = args;
251
+ }
252
+ else {
253
+ name = args.name;
254
+ initialVal = args.initialVal;
255
+ opts = args.opts;
256
+ }
257
+ this.debugger('applyPlugins');
258
+ this.debugger(`applyPlugins:name:${name}`);
259
+ this.debugger(`applyPlugins:initialVal:${initialVal}`);
260
+ this.debugger(`applyPlugins:opts:${opts}`);
261
+ if (typeof name !== 'string') {
262
+ throw new Error('调用失败,未传入正确的名称!');
263
+ }
264
+ const hooks = this.hooks.get(name) || [];
265
+ if (!hooks.length) {
266
+ return await initialVal;
267
+ }
268
+ const waterfall = new tapable_1.AsyncSeriesWaterfallHook(['arg']);
269
+ if (hooks.length) {
270
+ const resArr = [];
271
+ for (const hook of hooks) {
272
+ waterfall.tapPromise({
273
+ name: hook.plugin,
274
+ stage: hook.stage || 0,
275
+ // @ts-ignore
276
+ before: hook.before,
277
+ }, async (arg) => {
278
+ const res = await hook.fn(opts, arg);
279
+ if (constants_1.IS_MODIFY_HOOK.test(name) || constants_1.IS_EVENT_HOOK.test(name)) {
280
+ return res;
281
+ }
282
+ if (constants_1.IS_ADD_HOOK.test(name)) {
283
+ resArr.push(res);
284
+ return resArr;
285
+ }
286
+ return null;
287
+ });
288
+ }
289
+ }
290
+ return await waterfall.promise(initialVal);
291
+ }
292
+ runWithPlatform(platform) {
293
+ if (!this.platforms.has(platform)) {
294
+ throw new Error(`不存在编译平台 ${platform}`);
295
+ }
296
+ const config = this.platforms.get(platform);
297
+ const withNameConfig = this.config.getConfigWithNamed(config.name, config.useConfigName);
298
+ process.env.TARO_PLATFORM = (0, taro_shared_1.getPlatformType)(config.name, config.useConfigName);
299
+ return withNameConfig;
300
+ }
301
+ setRunOpts(opts) {
302
+ this.runOpts = opts;
303
+ }
304
+ runHelp(name) {
305
+ const command = this.commands.get(name);
306
+ const defaultOptionsMap = new Map();
307
+ defaultOptionsMap.set('-h, --help', 'output usage information');
308
+ let customOptionsMap = new Map();
309
+ if (command?.optionsMap) {
310
+ customOptionsMap = new Map(Object.entries(command?.optionsMap));
311
+ }
312
+ const optionsMap = new Map([...customOptionsMap, ...defaultOptionsMap]);
313
+ (0, utils_1.printHelpLog)(name, optionsMap, command?.synopsisList ? new Set(command?.synopsisList) : new Set());
314
+ }
315
+ async run(args) {
316
+ let name;
317
+ let opts;
318
+ if (typeof args === 'string') {
319
+ name = args;
320
+ }
321
+ else {
322
+ name = args.name;
323
+ opts = args.opts;
324
+ }
325
+ this.debugger('command:run');
326
+ this.debugger(`command:run:name:${name}`);
327
+ this.debugger('command:runOpts');
328
+ this.debugger(`command:runOpts:${JSON.stringify(opts, null, 2)}`);
329
+ this.setRunOpts(opts);
330
+ this.debugger('initPresetsAndPlugins');
331
+ this.initPresetsAndPlugins();
332
+ await this.applyPlugins('onReady');
333
+ this.debugger('command:onStart');
334
+ await this.applyPlugins('onStart');
335
+ if (!this.commands.has(name)) {
336
+ throw new Error(`${name} 命令不存在`);
337
+ }
338
+ if (opts?.isHelp) {
339
+ return this.runHelp(name);
340
+ }
341
+ if (opts?.options?.platform) {
342
+ opts.config = this.runWithPlatform(opts.options.platform);
343
+ await this.applyPlugins({
344
+ name: 'modifyRunnerOpts',
345
+ opts: {
346
+ opts: opts?.config,
347
+ },
348
+ });
349
+ }
350
+ await this.applyPlugins({
351
+ name,
352
+ opts,
353
+ });
354
+ }
355
+ }
356
+ exports.default = Kernel;
357
+ //# sourceMapping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AI,EAAE,kBAAkB;gBACxB,IAAI,EAAE;oBACJ,IAAI,EAAE,IAAI,EAAE,MAAM;iBACnB;aACF,CAAC,CAAC;QACL,CAAC;QAED,MAAM,IAAI,CAAC,YAAY,CAAC;YACtB,IAAI;YACJ,IAAI;SACL,CAAC,CAAC;IACL,CAAC;CACF;AA5WD,yBA4WC"}
@@ -0,0 +1,15 @@
1
+ import type { Func } from '@spcsn/taro/types/compile';
2
+ import type Kernel from './Kernel';
3
+ import type { ICommand, IHook, IPlatform } from './utils/types';
4
+ export default class Plugin {
5
+ id: string;
6
+ path: string;
7
+ ctx: Kernel;
8
+ optsSchema: Func;
9
+ constructor(opts: any);
10
+ register(hook: IHook): void;
11
+ registerCommand(command: ICommand): void;
12
+ registerPlatform(platform: IPlatform): void;
13
+ registerMethod(...args: any[]): void;
14
+ addPluginOptsSchema(schema: any): void;
15
+ }
package/dist/Plugin.js ADDED
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const taro_helper_1 = require("@spcsn/taro-helper");
4
+ class Plugin {
5
+ constructor(opts) {
6
+ this.id = opts.id;
7
+ this.path = opts.path;
8
+ this.ctx = opts.ctx;
9
+ }
10
+ register(hook) {
11
+ if (typeof hook.name !== 'string') {
12
+ throw new Error(`插件 ${this.id} 中注册 hook 失败, hook.name 必须是 string 类型`);
13
+ }
14
+ if (typeof hook.fn !== 'function') {
15
+ throw new Error(`插件 ${this.id} 中注册 hook 失败, hook.fn 必须是 function 类型`);
16
+ }
17
+ const hooks = this.ctx.hooks.get(hook.name) || [];
18
+ hook.plugin = this.id;
19
+ this.ctx.hooks.set(hook.name, hooks.concat(hook));
20
+ }
21
+ registerCommand(command) {
22
+ if (this.ctx.commands.has(command.name)) {
23
+ throw new Error(`命令 ${command.name} 已存在`);
24
+ }
25
+ this.ctx.commands.set(command.name, command);
26
+ this.register(command);
27
+ }
28
+ registerPlatform(platform) {
29
+ if (this.ctx.platforms.has(platform.name)) {
30
+ throw new Error(`适配平台 ${platform.name} 已存在`);
31
+ }
32
+ (0, taro_helper_1.addPlatforms)(platform.name);
33
+ this.ctx.platforms.set(platform.name, platform);
34
+ this.register(platform);
35
+ }
36
+ registerMethod(...args) {
37
+ const { name, fn } = processArgs(args);
38
+ const methods = this.ctx.methods.get(name) || [];
39
+ methods.push(fn ||
40
+ function (fn) {
41
+ this.register({
42
+ name,
43
+ fn,
44
+ });
45
+ }.bind(this));
46
+ this.ctx.methods.set(name, methods);
47
+ }
48
+ addPluginOptsSchema(schema) {
49
+ this.optsSchema = schema;
50
+ }
51
+ }
52
+ exports.default = Plugin;
53
+ function processArgs(args) {
54
+ let name, fn;
55
+ if (!args.length) {
56
+ throw new Error('参数为空');
57
+ }
58
+ else if (args.length === 1) {
59
+ if (typeof args[0] === 'string') {
60
+ name = args[0];
61
+ }
62
+ else {
63
+ name = args[0].name;
64
+ fn = args[0].fn;
65
+ }
66
+ }
67
+ else {
68
+ name = args[0];
69
+ fn = args[1];
70
+ }
71
+ return { name, fn };
72
+ }
73
+ //# sourceMappingURL=Plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../src/Plugin.ts"],"names":[],"mappings":";;AAAA,oDAAkD;AAMlD,MAAqB,MAAM;IAMzB,YAAY,IAAI;QACd,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACtB,CAAC;IAED,QAAQ,CAAC,IAAW;QAClB,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE,uCAAuC,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UAAU,EAAE,CAAC;YAClC,M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 -0,0 +1,14 @@
1
+ import Config from './Config';
2
+ import Kernel from './Kernel';
3
+ import { TaroPlatform, TaroPlatformBase, TaroPlatformWeb } from './platform-plugin-base';
4
+ export * from './utils/types';
5
+ export { Config, Kernel, TaroPlatform, TaroPlatformBase, TaroPlatformWeb };
6
+ declare const _default: {
7
+ Config: typeof Config;
8
+ Kernel: typeof Kernel;
9
+ TaroPlatform: typeof TaroPlatform;
10
+ TaroPlatformBase: typeof TaroPlatformBase;
11
+ TaroPlatformWeb: typeof TaroPlatformWeb;
12
+ };
13
+ export default _default;
14
+ export type { IPluginContext } from './utils/types';
package/dist/index.js ADDED
@@ -0,0 +1,31 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.TaroPlatformWeb = exports.TaroPlatformBase = exports.TaroPlatform = exports.Kernel = exports.Config = void 0;
21
+ const Config_1 = __importDefault(require("./Config"));
22
+ exports.Config = Config_1.default;
23
+ const Kernel_1 = __importDefault(require("./Kernel"));
24
+ exports.Kernel = Kernel_1.default;
25
+ const platform_plugin_base_1 = require("./platform-plugin-base");
26
+ Object.defineProperty(exports, "TaroPlatform", { enumerable: true, get: function () { return platform_plugin_base_1.TaroPlatform; } });
27
+ Object.defineProperty(exports, "TaroPlatformBase", { enumerable: true, get: function () { return platform_plugin_base_1.TaroPlatformBase; } });
28
+ Object.defineProperty(exports, "TaroPlatformWeb", { enumerable: true, get: function () { return platform_plugin_base_1.TaroPlatformWeb; } });
29
+ __exportStar(require("./utils/types"), exports);
30
+ exports.default = { Config: Config_1.default, Kernel: Kernel_1.default, TaroPlatform: platform_plugin_base_1.TaroPlatform, TaroPlatformBase: platform_plugin_base_1.TaroPlatformBase, TaroPlatformWeb: platform_plugin_base_1.TaroPlatformWeb };
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,sDAA8B;AAKrB,iBALF,gBAAM,CAKE;AAJf,sDAA8B;AAIb,iBAJV,gBAAM,CAIU;AAHvB,iEAAyF;AAGhE,6FAHhB,mCAAY,OAGgB;AAAE,iGAHhB,uCAAgB,OAGgB;AAAE,gGAHhB,sCAAe,OAGgB;AADxE,gDAA8B;AAE9B,kBAAe,EAAE,MAAM,EAAN,gBAAM,EAAE,MAAM,EAAN,gBAAM,EAAE,YAAY,EAAZ,mCAAY,EAAE,gBAAgB,EAAhB,uCAAgB,EAAE,eAAe,EAAf,sCAAe,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './mini';
2
+ export { default as TaroPlatform } from './platform';
3
+ export * from './web';
@@ -0,0 +1,25 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.TaroPlatform = void 0;
21
+ __exportStar(require("./mini"), exports);
22
+ var platform_1 = require("./platform");
23
+ Object.defineProperty(exports, "TaroPlatform", { enumerable: true, get: function () { return __importDefault(platform_1).default; } });
24
+ __exportStar(require("./web"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform-plugin-base/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,uCAAqD;AAA5C,yHAAA,OAAO,OAAgB;AAChC,wCAAsB"}
@@ -0,0 +1,57 @@
1
+ import { PLATFORM_TYPE } from '@spcsn/taro-shared';
2
+ import TaroPlatform from './platform';
3
+ import type { RecursiveTemplate, UnRecursiveTemplate } from '@spcsn/taro-shared/dist/template';
4
+ import type { TConfig } from '../utils/types';
5
+ interface IFileType {
6
+ templ: string;
7
+ style: string;
8
+ config: string;
9
+ script: string;
10
+ xs?: string;
11
+ }
12
+ export declare abstract class TaroPlatformBase<T extends TConfig = TConfig> extends TaroPlatform<T> {
13
+ platformType: PLATFORM_TYPE;
14
+ abstract globalObject: string;
15
+ abstract fileType: IFileType;
16
+ abstract template: RecursiveTemplate | UnRecursiveTemplate;
17
+ taroComponentsPath: string;
18
+ projectConfigJson?: string;
19
+ /**
20
+ * 1. 清空 dist 文件夹
21
+ * 2. 输出编译提示
22
+ * 3. 生成 project.config.json
23
+ */
24
+ private setup;
25
+ private setupImpl;
26
+ protected printDevelopmentTip(platform: string): void;
27
+ /**
28
+ * 返回当前项目内的 runner 包
29
+ */
30
+ protected getRunner(): Promise<any>;
31
+ /**
32
+ * 准备 runner 参数
33
+ * @param extraOptions 需要额外合入 Options 的配置项
34
+ */
35
+ protected getOptions(extraOptions?: {}): any;
36
+ /**
37
+ * 调用 runner 开始编译
38
+ * @param extraOptions 需要额外传入 runner 的配置项
39
+ */
40
+ private build;
41
+ private buildImpl;
42
+ /**
43
+ * 生成 project.config.json
44
+ * @param src 项目源码中配置文件的名称
45
+ * @param dist 编译后配置文件的名称,默认为 'project.config.json'
46
+ */
47
+ protected generateProjectConfig(src: string, dist?: string): void;
48
+ /**
49
+ * 递归替换对象的 key 值
50
+ */
51
+ protected recursiveReplaceObjectKeys(obj: any, keyMap: any): void;
52
+ /**
53
+ * 调用 runner 开启编译
54
+ */
55
+ start(): Promise<void>;
56
+ }
57
+ export {};