@umijs/core 4.0.6 → 4.0.9
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/compiled/dotenv-expand/LICENSE +24 -0
- package/compiled/dotenv-expand/index.js +1 -0
- package/compiled/dotenv-expand/lib/main.d.ts +29 -0
- package/compiled/dotenv-expand/package.json +1 -0
- package/dist/config/config.js +197 -184
- package/dist/config/utils.js +36 -11
- package/dist/constants.js +44 -11
- package/dist/index.js +46 -24
- package/dist/route/defineRoutes.js +52 -28
- package/dist/route/route.js +20 -22
- package/dist/route/routeUtils.js +40 -20
- package/dist/route/routesConfig.js +120 -73
- package/dist/route/routesConvention.js +89 -62
- package/dist/route/utils.js +48 -23
- package/dist/service/command.js +39 -15
- package/dist/service/env.js +44 -18
- package/dist/service/generatePlugin.js +98 -77
- package/dist/service/generator.js +50 -12
- package/dist/service/hook.js +41 -17
- package/dist/service/path.js +51 -29
- package/dist/service/plugin.js +137 -140
- package/dist/service/pluginAPI.js +183 -161
- package/dist/service/service.js +385 -420
- package/dist/service/servicePlugin.js +37 -13
- package/dist/service/utils.js +32 -8
- package/dist/types.js +77 -42
- package/package.json +6 -5
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Copyright (c) 2016, Scott Motte
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
15
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
16
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
17
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
18
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
19
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
20
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
21
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
22
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
23
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){"use strict";var e={212:function(e){function _interpolate(e,r,t){const n=e.match(/(.?\${*[\w]*(?::-[\w/]*)?}*)/g)||[];return n.reduce((function(e,o,a){const p=/(.?)\${*([\w]*(?::-[\w/]*)?)?}*/g.exec(o);if(!p||p.length===0){return e}const s=p[1];let c,i;if(s==="\\"){i=p[0];c=i.replace("\\$","$")}else{const o=p[2].split(":-");const _=o[0];i=p[0].substring(s.length);c=Object.prototype.hasOwnProperty.call(r,_)?r[_]:t.parsed[_]||o[1]||"";if(o.length>1&&c){const r=n[a+1];n[a+1]="";e=e.replace(r,"")}c=_interpolate(c,r,t)}return e.replace(i,c)}),e)}function expand(e){const r=e.ignoreProcessEnv?{}:process.env;for(const t in e.parsed){const n=Object.prototype.hasOwnProperty.call(r,t)?r[t]:e.parsed[t];e.parsed[t]=_interpolate(n,r,e)}for(const t in e.parsed){r[t]=e.parsed[t]}return e}e.exports.expand=expand}};var r={};function __nccwpck_require__(t){var n=r[t];if(n!==undefined){return n.exports}var o=r[t]={exports:{}};var a=true;try{e[t](o,o.exports,__nccwpck_require__);a=false}finally{if(a)delete r[t]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(212);module.exports=t})();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// TypeScript Version: 3.0
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
|
|
4
|
+
export interface DotenvExpandOptions {
|
|
5
|
+
ignoreProcessEnv?: boolean;
|
|
6
|
+
error?: Error;
|
|
7
|
+
parsed?: {
|
|
8
|
+
[name: string]: string;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface DotenvExpandOutput {
|
|
13
|
+
ignoreProcessEnv?: boolean;
|
|
14
|
+
error?: Error;
|
|
15
|
+
parsed?: {
|
|
16
|
+
[name: string]: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Adds variable expansion on top of dotenv.
|
|
22
|
+
*
|
|
23
|
+
* See https://docs.dotenv.org
|
|
24
|
+
*
|
|
25
|
+
* @param options - additional options. example: `{ ignoreProcessEnv: false, error: null, parsed: { { KEY: 'value' } }`
|
|
26
|
+
* @returns an object with a `parsed` key if successful or `error` key if an error occurred. example: { parsed: { KEY: 'value' } }
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export function expand(options?: DotenvExpandOptions): DotenvExpandOutput
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"dotenv-expand","author":"motdotla","license":"BSD-2-Clause","types":"lib/main.d.ts"}
|
package/dist/config/config.js
CHANGED
|
@@ -1,194 +1,207 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
4
10
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// config.ts
|
|
23
|
+
var config_exports = {};
|
|
24
|
+
__export(config_exports, {
|
|
25
|
+
Config: () => Config
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(config_exports);
|
|
28
|
+
var import_esbuild = __toESM(require("@umijs/bundler-utils/compiled/esbuild"));
|
|
29
|
+
var import_utils = require("@umijs/utils");
|
|
30
|
+
var import_joi = __toESM(require("@umijs/utils/compiled/@hapi/joi"));
|
|
31
|
+
var import_assert = __toESM(require("assert"));
|
|
32
|
+
var import_fs = require("fs");
|
|
33
|
+
var import_path = require("path");
|
|
34
|
+
var import_just_diff = require("../../compiled/just-diff");
|
|
35
|
+
var import_constants = require("../constants");
|
|
36
|
+
var import_types = require("../types");
|
|
37
|
+
var import_utils2 = require("./utils");
|
|
38
|
+
var Config = class {
|
|
39
|
+
constructor(opts) {
|
|
40
|
+
this.files = [];
|
|
41
|
+
this.opts = opts;
|
|
42
|
+
this.mainConfigFile = Config.getMainConfigFile(this.opts);
|
|
43
|
+
this.prevConfig = null;
|
|
44
|
+
}
|
|
45
|
+
getUserConfig() {
|
|
46
|
+
const configFiles = Config.getConfigFiles({
|
|
47
|
+
mainConfigFile: this.mainConfigFile,
|
|
48
|
+
env: this.opts.env,
|
|
49
|
+
specifiedEnv: this.opts.specifiedEnv
|
|
50
|
+
});
|
|
51
|
+
return Config.getUserConfig({
|
|
52
|
+
configFiles: (0, import_utils2.getAbsFiles)({
|
|
53
|
+
files: configFiles,
|
|
54
|
+
cwd: this.opts.cwd
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
getConfig(opts) {
|
|
59
|
+
const { config, files } = this.getUserConfig();
|
|
60
|
+
Config.validateConfig({ config, schemas: opts.schemas });
|
|
61
|
+
this.files = files;
|
|
62
|
+
return this.prevConfig = {
|
|
63
|
+
config,
|
|
64
|
+
files
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
watch(opts) {
|
|
68
|
+
const watcher = import_utils.chokidar.watch([
|
|
69
|
+
...this.files,
|
|
70
|
+
...this.mainConfigFile ? [] : (0, import_utils2.getAbsFiles)({
|
|
71
|
+
files: this.opts.defaultConfigFiles || import_constants.DEFAULT_CONFIG_FILES,
|
|
72
|
+
cwd: this.opts.cwd
|
|
73
|
+
})
|
|
74
|
+
], {
|
|
75
|
+
ignoreInitial: true,
|
|
76
|
+
cwd: this.opts.cwd
|
|
77
|
+
});
|
|
78
|
+
watcher.on("all", import_utils.lodash.debounce((event, path) => {
|
|
79
|
+
const { config: origin } = this.prevConfig;
|
|
80
|
+
const { config: updated, files } = this.getConfig({
|
|
81
|
+
schemas: opts.schemas
|
|
82
|
+
});
|
|
83
|
+
watcher.add(files);
|
|
84
|
+
const data = Config.diffConfigs({
|
|
85
|
+
origin,
|
|
86
|
+
updated,
|
|
87
|
+
onChangeTypes: opts.onChangeTypes
|
|
88
|
+
});
|
|
89
|
+
opts.onChange({
|
|
90
|
+
data,
|
|
91
|
+
event,
|
|
92
|
+
path
|
|
93
|
+
}).catch((e) => {
|
|
94
|
+
throw new Error(e);
|
|
95
|
+
});
|
|
96
|
+
}, import_constants.WATCH_DEBOUNCE_STEP));
|
|
97
|
+
return () => watcher.close();
|
|
98
|
+
}
|
|
99
|
+
static getMainConfigFile(opts) {
|
|
100
|
+
let mainConfigFile = null;
|
|
101
|
+
for (const configFile of opts.defaultConfigFiles || import_constants.DEFAULT_CONFIG_FILES) {
|
|
102
|
+
const absConfigFile = (0, import_path.join)(opts.cwd, configFile);
|
|
103
|
+
if ((0, import_fs.existsSync)(absConfigFile)) {
|
|
104
|
+
mainConfigFile = absConfigFile;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
35
107
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
108
|
+
return mainConfigFile;
|
|
109
|
+
}
|
|
110
|
+
static getConfigFiles(opts) {
|
|
111
|
+
const ret = [];
|
|
112
|
+
const { mainConfigFile } = opts;
|
|
113
|
+
const specifiedEnv = opts.specifiedEnv || "";
|
|
114
|
+
if (mainConfigFile) {
|
|
115
|
+
const env = import_constants.SHORT_ENV[opts.env] || opts.env;
|
|
116
|
+
ret.push(...[
|
|
117
|
+
mainConfigFile,
|
|
118
|
+
specifiedEnv && (0, import_utils2.addExt)({ file: mainConfigFile, ext: `.${specifiedEnv}` }),
|
|
119
|
+
(0, import_utils2.addExt)({ file: mainConfigFile, ext: `.${env}` }),
|
|
120
|
+
specifiedEnv && (0, import_utils2.addExt)({
|
|
121
|
+
file: mainConfigFile,
|
|
122
|
+
ext: `.${env}.${specifiedEnv}`
|
|
123
|
+
})
|
|
124
|
+
].filter(Boolean));
|
|
125
|
+
if (opts.env === import_types.Env.development) {
|
|
126
|
+
ret.push((0, import_utils2.addExt)({ file: mainConfigFile, ext: import_constants.LOCAL_EXT }));
|
|
127
|
+
}
|
|
44
128
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
], {
|
|
55
|
-
ignoreInitial: true,
|
|
56
|
-
cwd: this.opts.cwd,
|
|
129
|
+
return ret;
|
|
130
|
+
}
|
|
131
|
+
static getUserConfig(opts) {
|
|
132
|
+
let config = {};
|
|
133
|
+
let files = [];
|
|
134
|
+
for (const configFile of opts.configFiles) {
|
|
135
|
+
if ((0, import_fs.existsSync)(configFile)) {
|
|
136
|
+
import_utils.register.register({
|
|
137
|
+
implementor: import_esbuild.default
|
|
57
138
|
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
origin,
|
|
66
|
-
updated,
|
|
67
|
-
onChangeTypes: opts.onChangeTypes,
|
|
68
|
-
});
|
|
69
|
-
opts
|
|
70
|
-
.onChange({
|
|
71
|
-
data,
|
|
72
|
-
event,
|
|
73
|
-
path,
|
|
74
|
-
})
|
|
75
|
-
.catch((e) => {
|
|
76
|
-
throw new Error(e);
|
|
77
|
-
});
|
|
78
|
-
}, constants_1.WATCH_DEBOUNCE_STEP));
|
|
79
|
-
return () => watcher.close();
|
|
80
|
-
}
|
|
81
|
-
static getMainConfigFile(opts) {
|
|
82
|
-
let mainConfigFile = null;
|
|
83
|
-
for (const configFile of opts.defaultConfigFiles || constants_1.DEFAULT_CONFIG_FILES) {
|
|
84
|
-
const absConfigFile = (0, path_1.join)(opts.cwd, configFile);
|
|
85
|
-
if ((0, fs_1.existsSync)(absConfigFile)) {
|
|
86
|
-
mainConfigFile = absConfigFile;
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
139
|
+
import_utils.register.clearFiles();
|
|
140
|
+
try {
|
|
141
|
+
config = import_utils.lodash.merge(config, require(configFile).default);
|
|
142
|
+
} catch (e) {
|
|
143
|
+
throw new Error(`Parse config file failed: [${configFile}]`, {
|
|
144
|
+
cause: e
|
|
145
|
+
});
|
|
89
146
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
static getConfigFiles(opts) {
|
|
93
|
-
const ret = [];
|
|
94
|
-
const { mainConfigFile } = opts;
|
|
95
|
-
const specifiedEnv = opts.specifiedEnv || '';
|
|
96
|
-
if (mainConfigFile) {
|
|
97
|
-
const env = constants_1.SHORT_ENV[opts.env] || opts.env;
|
|
98
|
-
ret.push(...[
|
|
99
|
-
mainConfigFile,
|
|
100
|
-
specifiedEnv &&
|
|
101
|
-
(0, utils_2.addExt)({ file: mainConfigFile, ext: `.${specifiedEnv}` }),
|
|
102
|
-
(0, utils_2.addExt)({ file: mainConfigFile, ext: `.${env}` }),
|
|
103
|
-
specifiedEnv &&
|
|
104
|
-
(0, utils_2.addExt)({
|
|
105
|
-
file: mainConfigFile,
|
|
106
|
-
ext: `.${env}.${specifiedEnv}`,
|
|
107
|
-
}),
|
|
108
|
-
(0, utils_2.addExt)({ file: mainConfigFile, ext: constants_1.LOCAL_EXT }),
|
|
109
|
-
].filter(Boolean));
|
|
147
|
+
for (const file of import_utils.register.getFiles()) {
|
|
148
|
+
delete require.cache[file];
|
|
110
149
|
}
|
|
111
|
-
|
|
150
|
+
files.push(...import_utils.register.getFiles());
|
|
151
|
+
import_utils.register.restore();
|
|
152
|
+
} else {
|
|
153
|
+
files.push(configFile);
|
|
154
|
+
}
|
|
112
155
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
for (const file of utils_1.register.getFiles()) {
|
|
132
|
-
delete require.cache[file];
|
|
133
|
-
}
|
|
134
|
-
// includes the config File
|
|
135
|
-
files.push(...utils_1.register.getFiles());
|
|
136
|
-
utils_1.register.restore();
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
files.push(configFile);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
config,
|
|
144
|
-
files,
|
|
145
|
-
};
|
|
156
|
+
return {
|
|
157
|
+
config,
|
|
158
|
+
files
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
static validateConfig(opts) {
|
|
162
|
+
const errors = /* @__PURE__ */ new Map();
|
|
163
|
+
const configKeys = new Set(Object.keys(opts.config));
|
|
164
|
+
for (const key of Object.keys(opts.schemas)) {
|
|
165
|
+
configKeys.delete(key);
|
|
166
|
+
if (!opts.config[key])
|
|
167
|
+
continue;
|
|
168
|
+
const schema = opts.schemas[key](import_joi.default);
|
|
169
|
+
(0, import_assert.default)(import_joi.default.isSchema(schema), `schema for config ${key} is not valid.`);
|
|
170
|
+
const { error } = schema.validate(opts.config[key]);
|
|
171
|
+
if (error)
|
|
172
|
+
errors.set(key, error);
|
|
146
173
|
}
|
|
147
|
-
|
|
148
|
-
const errors = new Map();
|
|
149
|
-
const configKeys = new Set(Object.keys(opts.config));
|
|
150
|
-
for (const key of Object.keys(opts.schemas)) {
|
|
151
|
-
configKeys.delete(key);
|
|
152
|
-
if (!opts.config[key])
|
|
153
|
-
continue;
|
|
154
|
-
const schema = opts.schemas[key](joi_1.default);
|
|
155
|
-
// invalid schema
|
|
156
|
-
(0, assert_1.default)(joi_1.default.isSchema(schema), `schema for config ${key} is not valid.`);
|
|
157
|
-
const { error } = schema.validate(opts.config[key]);
|
|
158
|
-
if (error)
|
|
159
|
-
errors.set(key, error);
|
|
160
|
-
}
|
|
161
|
-
// invalid config values
|
|
162
|
-
(0, assert_1.default)(errors.size === 0, `Invalid config values: ${Array.from(errors.keys()).join(', ')}
|
|
174
|
+
(0, import_assert.default)(errors.size === 0, `Invalid config values: ${Array.from(errors.keys()).join(", ")}
|
|
163
175
|
${Array.from(errors.keys()).map((key) => {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
176
|
+
return `Invalid value for ${key}:
|
|
177
|
+
${errors.get(key).message}`;
|
|
178
|
+
})}`);
|
|
179
|
+
(0, import_assert.default)(configKeys.size === 0, `Invalid config keys: ${Array.from(configKeys).join(", ")}`);
|
|
180
|
+
}
|
|
181
|
+
static diffConfigs(opts) {
|
|
182
|
+
const patch = (0, import_just_diff.diff)(opts.origin, opts.updated);
|
|
183
|
+
const changes = {};
|
|
184
|
+
const fns = [];
|
|
185
|
+
for (const item of patch) {
|
|
186
|
+
const key = item.path[0];
|
|
187
|
+
const onChange = opts.onChangeTypes[key];
|
|
188
|
+
(0, import_assert.default)(onChange, `Invalid onChange config for key ${key}`);
|
|
189
|
+
if (typeof onChange === "string") {
|
|
190
|
+
changes[onChange] || (changes[onChange] = []);
|
|
191
|
+
changes[onChange].push(String(key));
|
|
192
|
+
} else if (typeof onChange === "function") {
|
|
193
|
+
fns.push(onChange);
|
|
194
|
+
} else {
|
|
195
|
+
throw new Error(`Invalid onChange value for key ${key}`);
|
|
196
|
+
}
|
|
168
197
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
changes[onChange].push(String(key));
|
|
180
|
-
}
|
|
181
|
-
else if (typeof onChange === 'function') {
|
|
182
|
-
fns.push(onChange);
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
throw new Error(`Invalid onChange value for key ${key}`);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return {
|
|
189
|
-
changes,
|
|
190
|
-
fns,
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
exports.Config = Config;
|
|
198
|
+
return {
|
|
199
|
+
changes,
|
|
200
|
+
fns
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
205
|
+
0 && (module.exports = {
|
|
206
|
+
Config
|
|
207
|
+
});
|
package/dist/config/utils.js
CHANGED
|
@@ -1,15 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// utils.ts
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
addExt: () => addExt,
|
|
23
|
+
getAbsFiles: () => getAbsFiles
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(utils_exports);
|
|
26
|
+
var import_path = require("path");
|
|
5
27
|
function addExt(opts) {
|
|
6
|
-
|
|
7
|
-
|
|
28
|
+
const index = opts.file.lastIndexOf(".");
|
|
29
|
+
return `${opts.file.slice(0, index)}${opts.ext}${opts.file.slice(index)}`;
|
|
8
30
|
}
|
|
9
|
-
exports.addExt = addExt;
|
|
10
31
|
function getAbsFiles(opts) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
32
|
+
return opts.files.map((file) => {
|
|
33
|
+
return (0, import_path.isAbsolute)(file) ? file : (0, import_path.join)(opts.cwd, file);
|
|
34
|
+
});
|
|
14
35
|
}
|
|
15
|
-
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
addExt,
|
|
39
|
+
getAbsFiles
|
|
40
|
+
});
|
package/dist/constants.js
CHANGED
|
@@ -1,12 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
test: 'test',
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
8
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// constants.ts
|
|
20
|
+
var constants_exports = {};
|
|
21
|
+
__export(constants_exports, {
|
|
22
|
+
DEFAULT_CONFIG_FILES: () => DEFAULT_CONFIG_FILES,
|
|
23
|
+
DEFAULT_FRAMEWORK_NAME: () => DEFAULT_FRAMEWORK_NAME,
|
|
24
|
+
LOCAL_EXT: () => LOCAL_EXT,
|
|
25
|
+
SHORT_ENV: () => SHORT_ENV,
|
|
26
|
+
WATCH_DEBOUNCE_STEP: () => WATCH_DEBOUNCE_STEP
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(constants_exports);
|
|
29
|
+
var DEFAULT_CONFIG_FILES = ["config.ts", "config.js"];
|
|
30
|
+
var SHORT_ENV = {
|
|
31
|
+
development: "dev",
|
|
32
|
+
production: "prod",
|
|
33
|
+
test: "test"
|
|
34
|
+
};
|
|
35
|
+
var LOCAL_EXT = ".local";
|
|
36
|
+
var WATCH_DEBOUNCE_STEP = 300;
|
|
37
|
+
var DEFAULT_FRAMEWORK_NAME = "umi";
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
DEFAULT_CONFIG_FILES,
|
|
41
|
+
DEFAULT_FRAMEWORK_NAME,
|
|
42
|
+
LOCAL_EXT,
|
|
43
|
+
SHORT_ENV,
|
|
44
|
+
WATCH_DEBOUNCE_STEP
|
|
45
|
+
});
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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);
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
8
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
Env: () => import_types.Env,
|
|
24
|
+
Generator: () => import_generator.Generator,
|
|
25
|
+
GeneratorType: () => import_generator.GeneratorType,
|
|
26
|
+
IAdd: () => import_types.IAdd,
|
|
27
|
+
IEvent: () => import_types.IEvent,
|
|
28
|
+
IModify: () => import_types.IModify,
|
|
29
|
+
IRoute: () => import_types.IRoute
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(src_exports);
|
|
32
|
+
__reExport(src_exports, require("./config/config"), module.exports);
|
|
33
|
+
__reExport(src_exports, require("./route/route"), module.exports);
|
|
34
|
+
var import_generator = require("./service/generator");
|
|
35
|
+
__reExport(src_exports, require("./service/pluginAPI"), module.exports);
|
|
36
|
+
__reExport(src_exports, require("./service/service"), module.exports);
|
|
37
|
+
var import_types = require("./types");
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
Env,
|
|
41
|
+
Generator,
|
|
42
|
+
GeneratorType,
|
|
43
|
+
IAdd,
|
|
44
|
+
IEvent,
|
|
45
|
+
IModify,
|
|
46
|
+
IRoute
|
|
47
|
+
});
|