@umijs/core 4.0.0-canary.20220718.1 → 4.0.0-canary.20220727.1

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.
Files changed (67) hide show
  1. package/dist/config/config.d.ts +0 -1
  2. package/dist/config/config.js +197 -187
  3. package/dist/config/utils.d.ts +0 -1
  4. package/dist/config/utils.js +36 -11
  5. package/dist/constants.d.ts +0 -1
  6. package/dist/constants.js +44 -11
  7. package/dist/index.d.ts +0 -1
  8. package/dist/index.js +46 -24
  9. package/dist/route/defineRoutes.d.ts +0 -1
  10. package/dist/route/defineRoutes.js +52 -28
  11. package/dist/route/route.d.ts +0 -1
  12. package/dist/route/route.js +20 -22
  13. package/dist/route/routeUtils.d.ts +0 -1
  14. package/dist/route/routeUtils.js +40 -20
  15. package/dist/route/routesConfig.d.ts +0 -1
  16. package/dist/route/routesConfig.js +120 -75
  17. package/dist/route/routesConvention.d.ts +0 -1
  18. package/dist/route/routesConvention.js +89 -67
  19. package/dist/route/utils.d.ts +0 -1
  20. package/dist/route/utils.js +48 -23
  21. package/dist/service/command.d.ts +0 -1
  22. package/dist/service/command.js +39 -15
  23. package/dist/service/env.d.ts +0 -1
  24. package/dist/service/env.js +44 -20
  25. package/dist/service/generatePlugin.d.ts +0 -1
  26. package/dist/service/generatePlugin.js +98 -77
  27. package/dist/service/generator.d.ts +0 -1
  28. package/dist/service/generator.js +50 -12
  29. package/dist/service/hook.d.ts +0 -1
  30. package/dist/service/hook.js +41 -17
  31. package/dist/service/path.d.ts +0 -1
  32. package/dist/service/path.js +51 -29
  33. package/dist/service/plugin.d.ts +0 -1
  34. package/dist/service/plugin.js +137 -140
  35. package/dist/service/pluginAPI.d.ts +0 -1
  36. package/dist/service/pluginAPI.js +183 -161
  37. package/dist/service/service.d.ts +0 -1
  38. package/dist/service/service.js +385 -420
  39. package/dist/service/servicePlugin.d.ts +0 -1
  40. package/dist/service/servicePlugin.js +37 -13
  41. package/dist/service/utils.d.ts +0 -1
  42. package/dist/service/utils.js +32 -8
  43. package/dist/types.d.ts +0 -1
  44. package/dist/types.js +77 -42
  45. package/package.json +5 -5
  46. package/dist/config/config.d.ts.map +0 -1
  47. package/dist/config/utils.d.ts.map +0 -1
  48. package/dist/constants.d.ts.map +0 -1
  49. package/dist/index.d.ts.map +0 -1
  50. package/dist/route/defineRoutes.d.ts.map +0 -1
  51. package/dist/route/route.d.ts.map +0 -1
  52. package/dist/route/routeUtils.d.ts.map +0 -1
  53. package/dist/route/routesConfig.d.ts.map +0 -1
  54. package/dist/route/routesConvention.d.ts.map +0 -1
  55. package/dist/route/utils.d.ts.map +0 -1
  56. package/dist/service/command.d.ts.map +0 -1
  57. package/dist/service/env.d.ts.map +0 -1
  58. package/dist/service/generatePlugin.d.ts.map +0 -1
  59. package/dist/service/generator.d.ts.map +0 -1
  60. package/dist/service/hook.d.ts.map +0 -1
  61. package/dist/service/path.d.ts.map +0 -1
  62. package/dist/service/plugin.d.ts.map +0 -1
  63. package/dist/service/pluginAPI.d.ts.map +0 -1
  64. package/dist/service/service.d.ts.map +0 -1
  65. package/dist/service/servicePlugin.d.ts.map +0 -1
  66. package/dist/service/utils.d.ts.map +0 -1
  67. package/dist/types.d.ts.map +0 -1
@@ -61,4 +61,3 @@ export declare class Config {
61
61
  };
62
62
  }
63
63
  export {};
64
- //# sourceMappingURL=config.d.ts.map
@@ -1,197 +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 types_1 = require("../types");
16
- const utils_2 = require("./utils");
17
- class Config {
18
- constructor(opts) {
19
- this.files = [];
20
- this.opts = opts;
21
- this.mainConfigFile = Config.getMainConfigFile(this.opts);
22
- this.prevConfig = null;
23
- }
24
- getUserConfig() {
25
- const configFiles = Config.getConfigFiles({
26
- mainConfigFile: this.mainConfigFile,
27
- env: this.opts.env,
28
- specifiedEnv: this.opts.specifiedEnv,
29
- });
30
- return Config.getUserConfig({
31
- configFiles: (0, utils_2.getAbsFiles)({
32
- files: configFiles,
33
- cwd: this.opts.cwd,
34
- }),
35
- });
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
+ }
36
107
  }
37
- getConfig(opts) {
38
- const { config, files } = this.getUserConfig();
39
- Config.validateConfig({ config, schemas: opts.schemas });
40
- this.files = files;
41
- return (this.prevConfig = {
42
- config: config,
43
- files,
44
- });
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
+ }
45
128
  }
46
- watch(opts) {
47
- const watcher = utils_1.chokidar.watch([
48
- ...this.files,
49
- ...(this.mainConfigFile
50
- ? []
51
- : (0, utils_2.getAbsFiles)({
52
- files: this.opts.defaultConfigFiles || constants_1.DEFAULT_CONFIG_FILES,
53
- cwd: this.opts.cwd,
54
- })),
55
- ], {
56
- ignoreInitial: true,
57
- 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
58
138
  });
59
- watcher.on('all', utils_1.lodash.debounce((event, path) => {
60
- const { config: origin } = this.prevConfig;
61
- const { config: updated, files } = this.getConfig({
62
- schemas: opts.schemas,
63
- });
64
- watcher.add(files);
65
- const data = Config.diffConfigs({
66
- origin,
67
- updated,
68
- onChangeTypes: opts.onChangeTypes,
69
- });
70
- opts
71
- .onChange({
72
- data,
73
- event,
74
- path,
75
- })
76
- .catch((e) => {
77
- throw new Error(e);
78
- });
79
- }, constants_1.WATCH_DEBOUNCE_STEP));
80
- return () => watcher.close();
81
- }
82
- static getMainConfigFile(opts) {
83
- let mainConfigFile = null;
84
- for (const configFile of opts.defaultConfigFiles || constants_1.DEFAULT_CONFIG_FILES) {
85
- const absConfigFile = (0, path_1.join)(opts.cwd, configFile);
86
- if ((0, fs_1.existsSync)(absConfigFile)) {
87
- mainConfigFile = absConfigFile;
88
- break;
89
- }
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
+ });
90
146
  }
91
- return mainConfigFile;
92
- }
93
- static getConfigFiles(opts) {
94
- const ret = [];
95
- const { mainConfigFile } = opts;
96
- const specifiedEnv = opts.specifiedEnv || '';
97
- if (mainConfigFile) {
98
- const env = constants_1.SHORT_ENV[opts.env] || opts.env;
99
- ret.push(...[
100
- mainConfigFile,
101
- specifiedEnv &&
102
- (0, utils_2.addExt)({ file: mainConfigFile, ext: `.${specifiedEnv}` }),
103
- (0, utils_2.addExt)({ file: mainConfigFile, ext: `.${env}` }),
104
- specifiedEnv &&
105
- (0, utils_2.addExt)({
106
- file: mainConfigFile,
107
- ext: `.${env}.${specifiedEnv}`,
108
- }),
109
- ].filter(Boolean));
110
- if (opts.env === types_1.Env.development) {
111
- ret.push((0, utils_2.addExt)({ file: mainConfigFile, ext: constants_1.LOCAL_EXT }));
112
- }
147
+ for (const file of import_utils.register.getFiles()) {
148
+ delete require.cache[file];
113
149
  }
114
- return ret;
150
+ files.push(...import_utils.register.getFiles());
151
+ import_utils.register.restore();
152
+ } else {
153
+ files.push(configFile);
154
+ }
115
155
  }
116
- static getUserConfig(opts) {
117
- let config = {};
118
- let files = [];
119
- for (const configFile of opts.configFiles) {
120
- if ((0, fs_1.existsSync)(configFile)) {
121
- utils_1.register.register({
122
- implementor: esbuild_1.default,
123
- });
124
- utils_1.register.clearFiles();
125
- try {
126
- config = utils_1.lodash.merge(config, require(configFile).default);
127
- }
128
- catch (e) {
129
- // @ts-ignore
130
- throw new Error(`Parse config file failed: [${configFile}]`, {
131
- cause: e,
132
- });
133
- }
134
- for (const file of utils_1.register.getFiles()) {
135
- delete require.cache[file];
136
- }
137
- // includes the config File
138
- files.push(...utils_1.register.getFiles());
139
- utils_1.register.restore();
140
- }
141
- else {
142
- files.push(configFile);
143
- }
144
- }
145
- return {
146
- config,
147
- files,
148
- };
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);
149
173
  }
150
- static validateConfig(opts) {
151
- const errors = new Map();
152
- const configKeys = new Set(Object.keys(opts.config));
153
- for (const key of Object.keys(opts.schemas)) {
154
- configKeys.delete(key);
155
- if (!opts.config[key])
156
- continue;
157
- const schema = opts.schemas[key](joi_1.default);
158
- // invalid schema
159
- (0, assert_1.default)(joi_1.default.isSchema(schema), `schema for config ${key} is not valid.`);
160
- const { error } = schema.validate(opts.config[key]);
161
- if (error)
162
- errors.set(key, error);
163
- }
164
- // invalid config values
165
- (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(", ")}
166
175
  ${Array.from(errors.keys()).map((key) => {
167
- return `Invalid value for ${key}:\n${errors.get(key).message}`;
168
- })}`);
169
- // invalid config keys
170
- (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
+ }
171
197
  }
172
- static diffConfigs(opts) {
173
- const patch = (0, just_diff_1.diff)(opts.origin, opts.updated);
174
- const changes = {};
175
- const fns = [];
176
- for (const item of patch) {
177
- const key = item.path[0];
178
- const onChange = opts.onChangeTypes[key];
179
- (0, assert_1.default)(onChange, `Invalid onChange config for key ${key}`);
180
- if (typeof onChange === 'string') {
181
- changes[onChange] || (changes[onChange] = []);
182
- changes[onChange].push(String(key));
183
- }
184
- else if (typeof onChange === 'function') {
185
- fns.push(onChange);
186
- }
187
- else {
188
- throw new Error(`Invalid onChange value for key ${key}`);
189
- }
190
- }
191
- return {
192
- changes,
193
- fns,
194
- };
195
- }
196
- }
197
- 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
+ });
@@ -6,4 +6,3 @@ export declare function getAbsFiles(opts: {
6
6
  files: string[];
7
7
  cwd: string;
8
8
  }): string[];
9
- //# sourceMappingURL=utils.d.ts.map
@@ -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
+ // 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
+ });
@@ -7,4 +7,3 @@ export declare const SHORT_ENV: {
7
7
  export declare const LOCAL_EXT = ".local";
8
8
  export declare const WATCH_DEBOUNCE_STEP = 300;
9
9
  export declare const DEFAULT_FRAMEWORK_NAME = "umi";
10
- //# sourceMappingURL=constants.d.ts.map
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
+ // 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.d.ts CHANGED
@@ -4,4 +4,3 @@ export { Generator, GeneratorType } from './service/generator';
4
4
  export * from './service/pluginAPI';
5
5
  export * from './service/service';
6
6
  export { Env, IAdd, IEvent, IModify, IRoute } from './types';
7
- //# sourceMappingURL=index.d.ts.map
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
+ // 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
+ });
@@ -1,2 +1 @@
1
1
  export declare function defineRoutes(callback: (defineRoute: Function) => void): any;
2
- //# sourceMappingURL=defineRoutes.d.ts.map