@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.
- package/LICENSE +174 -0
- package/dist/Config.d.ts +21 -0
- package/dist/Config.js +135 -0
- package/dist/Config.js.map +1 -0
- package/dist/Kernel.d.ts +66 -0
- package/dist/Kernel.js +357 -0
- package/dist/Kernel.js.map +1 -0
- package/dist/Plugin.d.ts +15 -0
- package/dist/Plugin.js +73 -0
- package/dist/Plugin.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/platform-plugin-base/index.d.ts +3 -0
- package/dist/platform-plugin-base/index.js +25 -0
- package/dist/platform-plugin-base/index.js.map +1 -0
- package/dist/platform-plugin-base/mini.d.ts +57 -0
- package/dist/platform-plugin-base/mini.js +165 -0
- package/dist/platform-plugin-base/mini.js.map +1 -0
- package/dist/platform-plugin-base/platform.d.ts +38 -0
- package/dist/platform-plugin-base/platform.js +67 -0
- package/dist/platform-plugin-base/platform.js.map +1 -0
- package/dist/platform-plugin-base/web.d.ts +32 -0
- package/dist/platform-plugin-base/web.js +150 -0
- package/dist/platform-plugin-base/web.js.map +1 -0
- package/dist/platform-plugin-base/webpack/hmr-plugin.d.ts +4 -0
- package/dist/platform-plugin-base/webpack/hmr-plugin.js +37 -0
- package/dist/platform-plugin-base/webpack/hmr-plugin.js.map +1 -0
- package/dist/utils/constants.d.ts +16 -0
- package/dist/utils/constants.js +21 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.js +186 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/package.d.ts +3 -0
- package/dist/utils/package.js +51 -0
- package/dist/utils/package.js.map +1 -0
- package/dist/utils/types.d.ts +187 -0
- package/dist/utils/types.js +3 -0
- package/dist/utils/types.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 O2Team
|
|
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.
|
|
22
|
+
|
|
23
|
+
========================================================================
|
|
24
|
+
|
|
25
|
+
MIT (react-devtools):
|
|
26
|
+
The following files embed [react-devtools](https://github.com/facebook/react) MIT:
|
|
27
|
+
`/packages/taro-plugin-react-devtools/src/backend/index.js`
|
|
28
|
+
See `/LICENSE` for details of the license.
|
|
29
|
+
|
|
30
|
+
==================
|
|
31
|
+
|
|
32
|
+
MIT (vue-devtools):
|
|
33
|
+
The following files embed [vue-devtools](https://github.com/vuejs/devtools) MIT:
|
|
34
|
+
`/packages/taro-plugin-vue-devtools/src/backend/*`
|
|
35
|
+
See `/LICENSE` for details of the license.
|
|
36
|
+
|
|
37
|
+
==================
|
|
38
|
+
|
|
39
|
+
MIT (vite):
|
|
40
|
+
The following files embed [vite](https://github.com/vitejs/vite) MIT:
|
|
41
|
+
`/packages/taro-webpack5-prebundle/src/prebundle/scanImport.ts`,
|
|
42
|
+
`/packages/taro-webpack5-prebundle/src/prebundle/bundle.ts`,
|
|
43
|
+
`/packages/taro-webpack5-prebundle/src/h5.ts`,
|
|
44
|
+
`/packages/taro-webpack5-prebundle/src/min.ts`
|
|
45
|
+
See `/LICENSE` for details of the license.
|
|
46
|
+
|
|
47
|
+
==================
|
|
48
|
+
|
|
49
|
+
MIT (webpack):
|
|
50
|
+
The following files embed [webpack](https://github.com/webpack/webpack) MIT:
|
|
51
|
+
`/packages/taro-webpack5-prebundle/src/webpack/TaroContainerEntryModule.ts`,
|
|
52
|
+
`/packages/taro-webpack5-prebundle/src/webpack/TaroContainerPlugin.ts`,
|
|
53
|
+
`/packages/taro-webpack5-prebundle/src/webpack/TaroContainerReferencePlugin.ts`,
|
|
54
|
+
`/packages/taro-webpack5-prebundle/src/webpack/TaroModuleFederationPlugin.ts`
|
|
55
|
+
See `/LICENSE` for details of the license.
|
|
56
|
+
|
|
57
|
+
==================
|
|
58
|
+
|
|
59
|
+
MIT (sizzle):
|
|
60
|
+
The following files embed [sizzle](https://github.com/jquery/sizzle) MIT:
|
|
61
|
+
`/packages/taro-extends/src/jquery/sizzle.js`
|
|
62
|
+
See `/LICENSE.txt` for details of the license.
|
|
63
|
+
|
|
64
|
+
==================
|
|
65
|
+
|
|
66
|
+
MIT (zepto):
|
|
67
|
+
The following files embed [zepto](https://github.com/madrobby/zepto) MIT:
|
|
68
|
+
`/packages/taro-extends/src/jquery/zepto.js`,
|
|
69
|
+
`/packages/taro-extends/src/jquery/event.js`
|
|
70
|
+
See `/MIT-LICENSE` for details of the license.
|
|
71
|
+
|
|
72
|
+
==================
|
|
73
|
+
|
|
74
|
+
MIT (css-to-react-native):
|
|
75
|
+
The following files embed [css-to-react-native](https://github.com/styled-components/css-to-react-native) MIT:
|
|
76
|
+
`/packages/css-to-react-native/src/css-to-react-native/*`
|
|
77
|
+
See `/LICENSE.md` for details of the license.
|
|
78
|
+
|
|
79
|
+
==================
|
|
80
|
+
|
|
81
|
+
MIT (reactify-wc):
|
|
82
|
+
The following files embed [reactify-wc](https://github.com/BBKolton/reactify-wc) MIT:
|
|
83
|
+
`/packages/taro-components-library-react/src/component-lib/reactify-wc.ts`
|
|
84
|
+
See `/LICENSE` for details of the license.
|
|
85
|
+
|
|
86
|
+
==================
|
|
87
|
+
|
|
88
|
+
MIT (ant-design-mobile-rn):
|
|
89
|
+
The following files embed [ant-design-mobile-rn](https://github.com/ant-design/ant-design-mobile-rn) MIT:
|
|
90
|
+
`/packages/taro-components-rn/src/components/Swiper/carousel.tsx`
|
|
91
|
+
See `/LICENSE` for details of the license.
|
|
92
|
+
|
|
93
|
+
==================
|
|
94
|
+
|
|
95
|
+
MIT (react-wx-images-viewer):
|
|
96
|
+
The following files embed [react-wx-images-viewer](https://github.com/react-ld/react-wx-images-viewer) MIT:
|
|
97
|
+
`/packages/taro-h5/src/api/media/image/previewImage.ts`
|
|
98
|
+
See `/LICENSE` for details of the license.
|
|
99
|
+
|
|
100
|
+
==================
|
|
101
|
+
|
|
102
|
+
MIT (webpack-contrib/css-loader):
|
|
103
|
+
The following files embed [webpack-contrib/css-loader](https://github.com/webpack-contrib/css-loader) MIT:
|
|
104
|
+
`/packages/taro-rn-style-transformer/src/utils/index.ts`
|
|
105
|
+
See `/LICENSE` for details of the license.
|
|
106
|
+
|
|
107
|
+
==================
|
|
108
|
+
|
|
109
|
+
MIT (react-native):
|
|
110
|
+
The following files embed [react-native](https://github.com/facebook/react-native) MIT:
|
|
111
|
+
`/packages/taro-rn-style-transformer/src/transforms/StyleSheet/*`
|
|
112
|
+
See `/LICENSE` for details of the license.
|
|
113
|
+
|
|
114
|
+
==================
|
|
115
|
+
|
|
116
|
+
MIT (myrne/performance-now):
|
|
117
|
+
The following files embed [myrne/performance-now](https://github.com/myrne/performance-now) MIT:
|
|
118
|
+
`/packages/taro-runtime/src/bom/raf.ts`
|
|
119
|
+
See `/LICENSE` for details of the license.
|
|
120
|
+
|
|
121
|
+
==================
|
|
122
|
+
|
|
123
|
+
Apache (chameleon-api):
|
|
124
|
+
The following files embed [chameleon-api](https://github.com/chameleon-team/chameleon-api) Apache:
|
|
125
|
+
`/packages/taro-h5/src/api/device/clipboard.ts`
|
|
126
|
+
|
|
127
|
+
==================
|
|
128
|
+
|
|
129
|
+
MIT (uni-app):
|
|
130
|
+
The following files embed [uni-app](https://github.com/dcloudio/uni-app) MIT:
|
|
131
|
+
`/packages/taro-components-rn/src/components/Video/index.tsx`
|
|
132
|
+
See `/LICENSE` for details of the license.
|
|
133
|
+
|
|
134
|
+
==================
|
|
135
|
+
|
|
136
|
+
MIT (miniprogram-render):
|
|
137
|
+
The following files embed [miniprogram-render](https://github.com/Tencent/kbone) MIT:
|
|
138
|
+
`/packages/taro-plugin-http/src/runtime/Cookie.ts`
|
|
139
|
+
See `/LICENSE` for details of the license.
|
|
140
|
+
|
|
141
|
+
==================
|
|
142
|
+
|
|
143
|
+
MIT (stencil-ds-output-targets):
|
|
144
|
+
The following files embed [stencil-ds-output-targets](https://github.com/ionic-team/stencil-ds-output-targets/) MIT:
|
|
145
|
+
`/packages/taro-components-library-react/src/react-component-lib/utils/attachProps.ts`
|
|
146
|
+
`/packages/taro-components-library-react/src/react-component-lib/utils/case.ts`
|
|
147
|
+
`/packages/taro-components-library-react/src/react-component-lib/utils/dev.ts`
|
|
148
|
+
`/packages/taro-components-library-react/src/react-component-lib/utils/index.tsx`
|
|
149
|
+
`/packages/taro-components-library-react/src/react-component-lib/createComponent.tsx`
|
|
150
|
+
`/packages/taro-components-library-react/src/react-component-lib/createOverlayComponent.tsx`
|
|
151
|
+
`/packages/taro-components-library-react/src/react-component-lib/interfaces.ts`
|
|
152
|
+
`/packages/taro-components-library-vue3/src/vue-component-lib/utils.ts`
|
|
153
|
+
See `/LICENSE` for details of the license.
|
|
154
|
+
|
|
155
|
+
==================
|
|
156
|
+
|
|
157
|
+
MIT (weui):
|
|
158
|
+
The following files embed [weui](https://github.com/Tencent/weui) MIT:
|
|
159
|
+
`/packages/taro-components/src/components/*.scss`
|
|
160
|
+
See `/LICENSE.txt` for details of the license.
|
|
161
|
+
|
|
162
|
+
==================
|
|
163
|
+
|
|
164
|
+
Apache-2.0 (intersection-observer):
|
|
165
|
+
The following files embed [intersection-observer](https://github.com/GoogleChromeLabs/intersection-observer) Apache-2.0:
|
|
166
|
+
`/packages/taro-api/src/polyfill/intersection-observer.ts`
|
|
167
|
+
See `/LICENSE.txt` for details of the license.
|
|
168
|
+
|
|
169
|
+
==================
|
|
170
|
+
|
|
171
|
+
MIT (babel-plugin-jsx-dom-expressions):
|
|
172
|
+
The following files embed [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/blob/main/packages/babel-plugin-jsx-dom-expressions) MIT:
|
|
173
|
+
`/packages/babel-plugin-transform-solid-jsx/src/*`
|
|
174
|
+
See `/LICENSE` for details of the license.
|
package/dist/Config.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IProjectConfig } from '@spcsn/taro/types/compile';
|
|
2
|
+
interface IConfigOptions {
|
|
3
|
+
appPath: string;
|
|
4
|
+
disableGlobalConfig?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export default class Config {
|
|
7
|
+
appPath: string;
|
|
8
|
+
configPath: string;
|
|
9
|
+
initialConfig: IProjectConfig;
|
|
10
|
+
initialGlobalConfig: IProjectConfig;
|
|
11
|
+
isInitSuccess: boolean;
|
|
12
|
+
disableGlobalConfig: boolean;
|
|
13
|
+
constructor(opts: IConfigOptions);
|
|
14
|
+
init(configEnv: {
|
|
15
|
+
mode: string;
|
|
16
|
+
command: string;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
initGlobalConfig(command?: string): void;
|
|
19
|
+
getConfigWithNamed(platform: any, configName: any): any;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
package/dist/Config.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
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 path = __importStar(require("node:path"));
|
|
40
|
+
const taro_helper_1 = require("@spcsn/taro-helper");
|
|
41
|
+
const ora_1 = __importDefault(require("ora"));
|
|
42
|
+
const webpack_merge_1 = require("webpack-merge");
|
|
43
|
+
const utils_1 = require("./utils");
|
|
44
|
+
const constants_1 = require("./utils/constants");
|
|
45
|
+
class Config {
|
|
46
|
+
constructor(opts) {
|
|
47
|
+
this.appPath = opts.appPath;
|
|
48
|
+
this.disableGlobalConfig = !!opts?.disableGlobalConfig;
|
|
49
|
+
}
|
|
50
|
+
async init(configEnv) {
|
|
51
|
+
this.initialConfig = {};
|
|
52
|
+
this.initialGlobalConfig = {};
|
|
53
|
+
this.isInitSuccess = false;
|
|
54
|
+
this.configPath = (0, taro_helper_1.resolveScriptPath)(path.join(this.appPath, constants_1.CONFIG_DIR_NAME, constants_1.DEFAULT_CONFIG_FILE));
|
|
55
|
+
if (!taro_helper_1.fs.existsSync(this.configPath)) {
|
|
56
|
+
if (this.disableGlobalConfig)
|
|
57
|
+
return;
|
|
58
|
+
this.initGlobalConfig();
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.initGlobalConfig(configEnv.command);
|
|
62
|
+
(0, taro_helper_1.createSwcRegister)({
|
|
63
|
+
only: [(filePath) => filePath.indexOf(path.join(this.appPath, constants_1.CONFIG_DIR_NAME)) >= 0],
|
|
64
|
+
});
|
|
65
|
+
try {
|
|
66
|
+
const userExport = (0, taro_helper_1.getModuleDefaultExport)(require(this.configPath));
|
|
67
|
+
this.initialConfig = typeof userExport === 'function' ? await userExport(webpack_merge_1.merge, configEnv) : userExport;
|
|
68
|
+
this.isInitSuccess = true;
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
console.log(err);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
initGlobalConfig(command = '') {
|
|
76
|
+
const homedir = (0, taro_helper_1.getUserHomeDir)();
|
|
77
|
+
if (!homedir)
|
|
78
|
+
return console.error('获取不到用户 home 路径');
|
|
79
|
+
const globalPluginConfigPath = path.join((0, taro_helper_1.getUserHomeDir)(), taro_helper_1.TARO_GLOBAL_CONFIG_DIR, taro_helper_1.TARO_GLOBAL_CONFIG_FILE);
|
|
80
|
+
if (!taro_helper_1.fs.existsSync(globalPluginConfigPath))
|
|
81
|
+
return;
|
|
82
|
+
const spinner = (0, ora_1.default)(`开始获取 taro 全局配置文件: ${globalPluginConfigPath}`).start();
|
|
83
|
+
try {
|
|
84
|
+
this.initialGlobalConfig = taro_helper_1.fs.readJSONSync(globalPluginConfigPath) || {};
|
|
85
|
+
this.initialGlobalConfig = (0, utils_1.filterGlobalConfig)(this.initialGlobalConfig, command);
|
|
86
|
+
spinner.succeed('获取 taro 全局配置成功');
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
spinner.stop();
|
|
90
|
+
console.warn(`获取全局配置失败,如果需要启用全局插件请查看配置文件: ${globalPluginConfigPath} `);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
getConfigWithNamed(platform, configName) {
|
|
94
|
+
const initialConfig = this.initialConfig;
|
|
95
|
+
const sourceDirName = initialConfig.sourceRoot || taro_helper_1.SOURCE_DIR;
|
|
96
|
+
const outputDirName = initialConfig.outputRoot || taro_helper_1.OUTPUT_DIR;
|
|
97
|
+
const sourceDir = path.join(this.appPath, sourceDirName);
|
|
98
|
+
const entryName = taro_helper_1.ENTRY;
|
|
99
|
+
const entryFilePath = (0, taro_helper_1.resolveScriptPath)(path.join(sourceDir, entryName));
|
|
100
|
+
const entry = {
|
|
101
|
+
[entryName]: [entryFilePath],
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
entry,
|
|
105
|
+
alias: initialConfig.alias || {},
|
|
106
|
+
copy: initialConfig.copy,
|
|
107
|
+
sourceRoot: sourceDirName,
|
|
108
|
+
outputRoot: outputDirName,
|
|
109
|
+
platform,
|
|
110
|
+
framework: initialConfig.framework,
|
|
111
|
+
compiler: initialConfig.compiler,
|
|
112
|
+
cache: initialConfig.cache,
|
|
113
|
+
logger: initialConfig.logger,
|
|
114
|
+
baseLevel: initialConfig.baseLevel,
|
|
115
|
+
csso: initialConfig.csso,
|
|
116
|
+
sass: initialConfig.sass,
|
|
117
|
+
uglify: initialConfig.uglify,
|
|
118
|
+
plugins: initialConfig.plugins,
|
|
119
|
+
projectName: initialConfig.projectName,
|
|
120
|
+
env: initialConfig.env,
|
|
121
|
+
defineConstants: initialConfig.defineConstants,
|
|
122
|
+
designWidth: initialConfig.designWidth,
|
|
123
|
+
deviceRatio: initialConfig.deviceRatio,
|
|
124
|
+
projectConfigName: initialConfig.projectConfigName,
|
|
125
|
+
jsMinimizer: initialConfig.jsMinimizer,
|
|
126
|
+
cssMinimizer: initialConfig.cssMinimizer,
|
|
127
|
+
terser: initialConfig.terser,
|
|
128
|
+
esbuild: initialConfig.esbuild,
|
|
129
|
+
...initialConfig[configName],
|
|
130
|
+
...initialConfig[platform],
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.default = Config;
|
|
135
|
+
//# sourceMappingURL=Config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../src/Config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAElC,oDAW4B;AAC5B,8CAAsB;AACtB,iDAAsC;AAEtC,mCAA6C;AAC7C,iDAAyE;AASzE,MAAqB,MAAM;IAQzB,YAAY,IAAoB;QAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACzD,CAAC;IAED,K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IProjectConfig, PluginItem } from '@spcsn/taro/types/compile';
|
|
4
|
+
import type Config from './Config';
|
|
5
|
+
import type { ICommand, IHook, IPaths, IPlatform, IPlugin, IPluginsObject, IPreset } from './utils/types';
|
|
6
|
+
interface IKernelOptions {
|
|
7
|
+
appPath: string;
|
|
8
|
+
config: Config;
|
|
9
|
+
presets?: PluginItem[];
|
|
10
|
+
plugins?: PluginItem[];
|
|
11
|
+
}
|
|
12
|
+
export default class Kernel extends EventEmitter {
|
|
13
|
+
appPath: string;
|
|
14
|
+
isWatch: boolean;
|
|
15
|
+
isProduction: boolean;
|
|
16
|
+
optsPresets: PluginItem[] | void;
|
|
17
|
+
optsPlugins: PluginItem[] | void;
|
|
18
|
+
plugins: Map<string, IPlugin>;
|
|
19
|
+
paths: IPaths;
|
|
20
|
+
extraPlugins: IPluginsObject;
|
|
21
|
+
globalExtraPlugins: IPluginsObject;
|
|
22
|
+
config: Config;
|
|
23
|
+
initialConfig: IProjectConfig;
|
|
24
|
+
initialGlobalConfig: IProjectConfig;
|
|
25
|
+
hooks: Map<string, IHook[]>;
|
|
26
|
+
methods: Map<string, Func[]>;
|
|
27
|
+
cliCommands: string[];
|
|
28
|
+
cliCommandsPath: string;
|
|
29
|
+
commands: Map<string, ICommand>;
|
|
30
|
+
platforms: Map<string, IPlatform>;
|
|
31
|
+
helper: any;
|
|
32
|
+
runnerUtils: any;
|
|
33
|
+
runOpts: any;
|
|
34
|
+
debugger: any;
|
|
35
|
+
constructor(options: IKernelOptions);
|
|
36
|
+
initConfig(): void;
|
|
37
|
+
initPaths(): void;
|
|
38
|
+
initHelper(): void;
|
|
39
|
+
initRunnerUtils(): void;
|
|
40
|
+
initPresetsAndPlugins(): void;
|
|
41
|
+
resolvePresets(cliAndProjectPresets: IPluginsObject, globalPresets: IPluginsObject): void;
|
|
42
|
+
resolvePlugins(cliAndProjectPlugins: IPluginsObject, globalPlugins: IPluginsObject): void;
|
|
43
|
+
initPreset(preset: IPreset, isGlobalConfigPreset?: boolean): void;
|
|
44
|
+
initPlugin(plugin: IPlugin): void;
|
|
45
|
+
applyCliCommandPlugin(commandNames?: string[]): void;
|
|
46
|
+
checkPluginOpts(pluginCtx: any, opts: any): void;
|
|
47
|
+
registerPlugin(plugin: IPlugin): void;
|
|
48
|
+
initPluginCtx({ id, path, ctx }: {
|
|
49
|
+
id: string;
|
|
50
|
+
path: string;
|
|
51
|
+
ctx: Kernel;
|
|
52
|
+
}): Plugin;
|
|
53
|
+
applyPlugins(args: string | {
|
|
54
|
+
name: string;
|
|
55
|
+
initialVal?: any;
|
|
56
|
+
opts?: any;
|
|
57
|
+
}): Promise<any>;
|
|
58
|
+
runWithPlatform(platform: any): any;
|
|
59
|
+
setRunOpts(opts: any): void;
|
|
60
|
+
runHelp(name: string): void;
|
|
61
|
+
run(args: string | {
|
|
62
|
+
name: string;
|
|
63
|
+
opts?: any;
|
|
64
|
+
}): Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
export {};
|