@umijs/core 4.0.7 → 4.0.10

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.
@@ -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"}
@@ -1,194 +1,207 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
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
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Config = void 0;
7
- const esbuild_1 = __importDefault(require("@umijs/bundler-utils/compiled/esbuild"));
8
- const utils_1 = require("@umijs/utils");
9
- const joi_1 = __importDefault(require("@umijs/utils/compiled/@hapi/joi"));
10
- const assert_1 = __importDefault(require("assert"));
11
- const fs_1 = require("fs");
12
- const path_1 = require("path");
13
- const just_diff_1 = require("../../compiled/just-diff");
14
- const constants_1 = require("../constants");
15
- const utils_2 = require("./utils");
16
- class Config {
17
- constructor(opts) {
18
- this.files = [];
19
- this.opts = opts;
20
- this.mainConfigFile = Config.getMainConfigFile(this.opts);
21
- this.prevConfig = null;
22
- }
23
- getUserConfig() {
24
- const configFiles = Config.getConfigFiles({
25
- mainConfigFile: this.mainConfigFile,
26
- env: this.opts.env,
27
- specifiedEnv: this.opts.specifiedEnv,
28
- });
29
- return Config.getUserConfig({
30
- configFiles: (0, utils_2.getAbsFiles)({
31
- files: configFiles,
32
- cwd: this.opts.cwd,
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
+ // src/config/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
- getConfig(opts) {
37
- const { config, files } = this.getUserConfig();
38
- Config.validateConfig({ config, schemas: opts.schemas });
39
- this.files = files;
40
- return (this.prevConfig = {
41
- config: config,
42
- files,
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
- watch(opts) {
46
- const watcher = utils_1.chokidar.watch([
47
- ...this.files,
48
- ...(this.mainConfigFile
49
- ? []
50
- : (0, utils_2.getAbsFiles)({
51
- files: this.opts.defaultConfigFiles || constants_1.DEFAULT_CONFIG_FILES,
52
- cwd: this.opts.cwd,
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
- watcher.on('all', utils_1.lodash.debounce((event, path) => {
59
- const { config: origin } = this.prevConfig;
60
- const { config: updated, files } = this.getConfig({
61
- schemas: opts.schemas,
62
- });
63
- watcher.add(files);
64
- const data = Config.diffConfigs({
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
- return mainConfigFile;
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
- return ret;
150
+ files.push(...import_utils.register.getFiles());
151
+ import_utils.register.restore();
152
+ } else {
153
+ files.push(configFile);
154
+ }
112
155
  }
113
- static getUserConfig(opts) {
114
- let config = {};
115
- let files = [];
116
- for (const configFile of opts.configFiles) {
117
- if ((0, fs_1.existsSync)(configFile)) {
118
- utils_1.register.register({
119
- implementor: esbuild_1.default,
120
- });
121
- utils_1.register.clearFiles();
122
- try {
123
- config = utils_1.lodash.merge(config, require(configFile).default);
124
- }
125
- catch (e) {
126
- // @ts-ignore
127
- throw new Error(`Parse config file failed: [${configFile}]`, {
128
- cause: e,
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
- static validateConfig(opts) {
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
- return `Invalid value for ${key}:\n${errors.get(key).message}`;
165
- })}`);
166
- // invalid config keys
167
- (0, assert_1.default)(configKeys.size === 0, `Invalid config keys: ${Array.from(configKeys).join(', ')}`);
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
- static diffConfigs(opts) {
170
- const patch = (0, just_diff_1.diff)(opts.origin, opts.updated);
171
- const changes = {};
172
- const fns = [];
173
- for (const item of patch) {
174
- const key = item.path[0];
175
- const onChange = opts.onChangeTypes[key];
176
- (0, assert_1.default)(onChange, `Invalid onChange config for key ${key}`);
177
- if (typeof onChange === 'string') {
178
- changes[onChange] || (changes[onChange] = []);
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
+ });
@@ -1,15 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAbsFiles = exports.addExt = void 0;
4
- const path_1 = require("path");
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
+ // src/config/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
- const index = opts.file.lastIndexOf('.');
7
- return `${opts.file.slice(0, index)}${opts.ext}${opts.file.slice(index)}`;
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
- return opts.files.map((file) => {
12
- return (0, path_1.isAbsolute)(file) ? file : (0, path_1.join)(opts.cwd, file);
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
- exports.getAbsFiles = getAbsFiles;
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_FRAMEWORK_NAME = exports.WATCH_DEBOUNCE_STEP = exports.LOCAL_EXT = exports.SHORT_ENV = exports.DEFAULT_CONFIG_FILES = void 0;
4
- exports.DEFAULT_CONFIG_FILES = ['config.ts', 'config.js'];
5
- exports.SHORT_ENV = {
6
- development: 'dev',
7
- production: 'prod',
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
- exports.LOCAL_EXT = '.local';
11
- exports.WATCH_DEBOUNCE_STEP = 300;
12
- exports.DEFAULT_FRAMEWORK_NAME = 'umi';
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
+ // src/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
- "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);
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
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Env = exports.GeneratorType = void 0;
18
- __exportStar(require("./config/config"), exports);
19
- __exportStar(require("./route/route"), exports);
20
- var generator_1 = require("./service/generator");
21
- Object.defineProperty(exports, "GeneratorType", { enumerable: true, get: function () { return generator_1.GeneratorType; } });
22
- __exportStar(require("./service/pluginAPI"), exports);
23
- __exportStar(require("./service/service"), exports);
24
- var types_1 = require("./types");
25
- Object.defineProperty(exports, "Env", { enumerable: true, get: function () { return types_1.Env; } });
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
+ // src/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
+ });