@tarojs/service 3.5.0-beta.4 → 3.5.0-theta.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/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
  }
@@ -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;
@@ -67,7 +67,13 @@ function resolvePresetsOrPlugins(root, args, type) {
67
67
  type,
68
68
  opts: args[item] || {},
69
69
  apply() {
70
- return (0, helper_1.getModuleDefaultExport)(require(fPath));
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/service",
3
- "version": "3.5.0-beta.4",
3
+ "version": "3.5.0-theta.0",
4
4
  "description": "Taro Service",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "dev": "tsc -w",
10
10
  "prod": "tsc",
11
11
  "clean": "rimraf dist",
12
- "prepack": "npm run build",
12
+ "prepack": "pnpm run build",
13
13
  "test": "jest",
14
14
  "test:dev": "jest --watch"
15
15
  },
@@ -33,15 +33,14 @@
33
33
  },
34
34
  "homepage": "https://github.com/NervJS/taro#readme",
35
35
  "dependencies": {
36
- "@tarojs/helper": "3.5.0-beta.4",
37
- "@tarojs/shared": "3.5.0-beta.4",
38
- "@tarojs/taro": "3.5.0-beta.4",
36
+ "@tarojs/helper": "workspace:*",
37
+ "@tarojs/shared": "workspace:*",
38
+ "@tarojs/taro": "workspace:*",
39
39
  "fs-extra": "^8.1.0",
40
40
  "joi": "^17.6.0",
41
41
  "lodash": "^4.17.21",
42
42
  "resolve": "^1.22.0",
43
43
  "tapable": "^1.1.3",
44
44
  "webpack-merge": "^4.2.2"
45
- },
46
- "gitHead": "7aca7841ed7e2af1b182ff5d24e91f44730ce783"
45
+ }
47
46
  }
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
  }
@@ -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
- return getModuleDefaultExport(require(fPath))
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
  })
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2018
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.