@tarojs/service 3.5.0-beta.2 → 3.5.0-beta.5
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/Kernel.js +2 -0
- package/dist/platform-plugin-base.js +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +7 -1
- package/package.json +13 -15
- package/src/Config.ts +1 -1
- package/src/Kernel.ts +2 -0
- package/src/utils/index.ts +7 -2
- package/src/utils/types.ts +2 -2
package/dist/Kernel.js
CHANGED
|
@@ -115,6 +115,7 @@ class Kernel extends events_1.EventEmitter {
|
|
|
115
115
|
if (typeof pluginCtx.optsSchema !== 'function') {
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
|
+
this.debugger('checkPluginOpts', pluginCtx);
|
|
118
119
|
const joi = require('joi');
|
|
119
120
|
const schema = pluginCtx.optsSchema(joi);
|
|
120
121
|
if (!joi.isSchema(schema)) {
|
|
@@ -127,6 +128,7 @@ class Kernel extends events_1.EventEmitter {
|
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
registerPlugin(plugin) {
|
|
131
|
+
this.debugger('registerPlugin', plugin);
|
|
130
132
|
if (this.plugins.has(plugin.id)) {
|
|
131
133
|
throw new Error(`插件 ${plugin.id} 已被注册`);
|
|
132
134
|
}
|
|
@@ -67,7 +67,7 @@ class TaroPlatformBase {
|
|
|
67
67
|
}
|
|
68
68
|
if (((_a = this.ctx.initialConfig.logger) === null || _a === void 0 ? void 0 : _a.quiet) === false) {
|
|
69
69
|
const { printLog, processTypeEnum } = this.ctx.helper;
|
|
70
|
-
printLog(
|
|
70
|
+
printLog(processTypeEnum.START, '开发者工具-项目目录', `${this.ctx.paths.outputPath}`);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
emptyOutputDir() {
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PluginItem } from '@tarojs/taro/types/compile';
|
|
1
|
+
import type { PluginItem } from '@tarojs/taro/types/compile';
|
|
2
2
|
import { PluginType } from './constants';
|
|
3
3
|
import { IPlugin, IPluginsObject } from './types';
|
|
4
4
|
export declare const isNpmPkg: (name: string) => boolean;
|
package/dist/utils/index.js
CHANGED
|
@@ -67,7 +67,13 @@ function resolvePresetsOrPlugins(root, args, type) {
|
|
|
67
67
|
type,
|
|
68
68
|
opts: args[item] || {},
|
|
69
69
|
apply() {
|
|
70
|
-
|
|
70
|
+
try {
|
|
71
|
+
return (0, helper_1.getModuleDefaultExport)(require(fPath));
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.error(error);
|
|
75
|
+
throw new Error(`插件依赖 "${item}" 加载失败,请检查插件配置`);
|
|
76
|
+
}
|
|
71
77
|
}
|
|
72
78
|
};
|
|
73
79
|
});
|
package/package.json
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/service",
|
|
3
|
-
"version": "3.5.0-beta.
|
|
3
|
+
"version": "3.5.0-beta.5",
|
|
4
4
|
"description": "Taro Service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "run-s clean prod",
|
|
9
|
-
"dev": "tsc -w",
|
|
10
|
-
"prod": "tsc",
|
|
11
|
-
"clean": "rimraf dist",
|
|
12
|
-
"prepack": "npm run build",
|
|
13
|
-
"test": "jest",
|
|
14
|
-
"test:dev": "jest --watch"
|
|
15
|
-
},
|
|
16
7
|
"repository": {
|
|
17
8
|
"type": "git",
|
|
18
9
|
"url": "git+https://github.com/NervJS/taro.git"
|
|
@@ -33,9 +24,9 @@
|
|
|
33
24
|
},
|
|
34
25
|
"homepage": "https://github.com/NervJS/taro#readme",
|
|
35
26
|
"dependencies": {
|
|
36
|
-
"@tarojs/helper": "3.5.0-beta.
|
|
37
|
-
"@tarojs/shared": "3.5.0-beta.
|
|
38
|
-
"@tarojs/taro": "3.5.0-beta.
|
|
27
|
+
"@tarojs/helper": "3.5.0-beta.5",
|
|
28
|
+
"@tarojs/shared": "3.5.0-beta.5",
|
|
29
|
+
"@tarojs/taro": "3.5.0-beta.5",
|
|
39
30
|
"fs-extra": "^8.1.0",
|
|
40
31
|
"joi": "^17.6.0",
|
|
41
32
|
"lodash": "^4.17.21",
|
|
@@ -43,5 +34,12 @@
|
|
|
43
34
|
"tapable": "^1.1.3",
|
|
44
35
|
"webpack-merge": "^4.2.2"
|
|
45
36
|
},
|
|
46
|
-
"
|
|
47
|
-
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "run-s clean prod",
|
|
39
|
+
"dev": "tsc -w",
|
|
40
|
+
"prod": "tsc",
|
|
41
|
+
"clean": "rimraf dist",
|
|
42
|
+
"test": "jest",
|
|
43
|
+
"test:dev": "jest --watch"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/Config.ts
CHANGED
package/src/Kernel.ts
CHANGED
|
@@ -160,6 +160,7 @@ export default class Kernel extends EventEmitter {
|
|
|
160
160
|
if (typeof pluginCtx.optsSchema !== 'function') {
|
|
161
161
|
return
|
|
162
162
|
}
|
|
163
|
+
this.debugger('checkPluginOpts', pluginCtx)
|
|
163
164
|
const joi = require('joi')
|
|
164
165
|
const schema = pluginCtx.optsSchema(joi)
|
|
165
166
|
if (!joi.isSchema(schema)) {
|
|
@@ -173,6 +174,7 @@ export default class Kernel extends EventEmitter {
|
|
|
173
174
|
}
|
|
174
175
|
|
|
175
176
|
registerPlugin (plugin: IPlugin) {
|
|
177
|
+
this.debugger('registerPlugin', plugin)
|
|
176
178
|
if (this.plugins.has(plugin.id)) {
|
|
177
179
|
throw new Error(`插件 ${plugin.id} 已被注册`)
|
|
178
180
|
}
|
package/src/utils/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { chalk, getModuleDefaultExport } from '@tarojs/helper'
|
|
2
|
-
import { PluginItem } from '@tarojs/taro/types/compile'
|
|
2
|
+
import type { PluginItem } from '@tarojs/taro/types/compile'
|
|
3
3
|
import { merge } from 'lodash'
|
|
4
4
|
import * as path from 'path'
|
|
5
5
|
import * as resolve from 'resolve'
|
|
@@ -64,7 +64,12 @@ export function resolvePresetsOrPlugins (root: string, args, type: PluginType):
|
|
|
64
64
|
type,
|
|
65
65
|
opts: args[item] || {},
|
|
66
66
|
apply () {
|
|
67
|
-
|
|
67
|
+
try {
|
|
68
|
+
return getModuleDefaultExport(require(fPath))
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error(error)
|
|
71
|
+
throw new Error(`插件依赖 "${item}" 加载失败,请检查插件配置`)
|
|
72
|
+
}
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
75
|
})
|