@umijs/core 3.5.17 → 4.0.0-beta.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 (84) hide show
  1. package/README.md +2 -0
  2. package/dist/config/config.d.ts +63 -0
  3. package/dist/config/config.js +178 -0
  4. package/dist/config/utils.d.ts +8 -0
  5. package/dist/config/utils.js +15 -0
  6. package/dist/constants.d.ts +9 -0
  7. package/dist/constants.js +12 -0
  8. package/dist/index.d.ts +5 -0
  9. package/dist/index.js +19 -0
  10. package/dist/route/defineRoutes.d.ts +1 -0
  11. package/dist/route/defineRoutes.js +28 -0
  12. package/dist/route/route.d.ts +2 -0
  13. package/dist/route/route.js +18 -0
  14. package/dist/route/routeUtils.d.ts +7 -0
  15. package/dist/route/routeUtils.js +21 -0
  16. package/dist/route/routesConfig.d.ts +0 -0
  17. package/dist/route/routesConfig.js +1 -0
  18. package/dist/route/routesConvention.d.ts +3 -0
  19. package/dist/route/routesConvention.js +73 -0
  20. package/dist/route/utils.d.ts +7 -0
  21. package/dist/route/utils.js +26 -0
  22. package/dist/service/command.d.ts +27 -0
  23. package/dist/service/command.js +14 -0
  24. package/dist/service/env.d.ts +4 -0
  25. package/dist/service/env.js +21 -0
  26. package/dist/service/hook.d.ts +16 -0
  27. package/dist/service/hook.js +18 -0
  28. package/dist/service/path.d.ts +13 -0
  29. package/dist/service/path.js +31 -0
  30. package/dist/service/plugin.d.ts +53 -0
  31. package/dist/service/plugin.js +137 -0
  32. package/dist/service/pluginAPI.d.ts +35 -0
  33. package/dist/service/pluginAPI.js +120 -0
  34. package/dist/service/service.d.ts +91 -0
  35. package/dist/service/service.js +361 -0
  36. package/dist/service/servicePlugin.d.ts +3 -0
  37. package/dist/service/servicePlugin.js +14 -0
  38. package/dist/service/utils.d.ts +2 -0
  39. package/dist/service/utils.js +12 -0
  40. package/dist/types.d.ts +108 -0
  41. package/dist/types.js +42 -0
  42. package/package.json +35 -15
  43. package/lib/Config/Config.d.ts +0 -39
  44. package/lib/Config/Config.js +0 -348
  45. package/lib/Config/types.d.ts +0 -21
  46. package/lib/Config/utils/configUtils.d.ts +0 -9
  47. package/lib/Config/utils/configUtils.js +0 -54
  48. package/lib/Config/utils/isEqual.d.ts +0 -1
  49. package/lib/Config/utils/isEqual.js +0 -45
  50. package/lib/Config/utils/mergeDefault.d.ts +0 -6
  51. package/lib/Config/utils/mergeDefault.js +0 -41
  52. package/lib/Html/Html.d.ts +0 -16
  53. package/lib/Html/Html.js +0 -292
  54. package/lib/Html/document.ejs +0 -12
  55. package/lib/Html/types.d.ts +0 -55
  56. package/lib/Logger/Common.d.ts +0 -13
  57. package/lib/Logger/Common.js +0 -53
  58. package/lib/Logger/Logger.d.ts +0 -17
  59. package/lib/Logger/Logger.js +0 -87
  60. package/lib/Route/Route.d.ts +0 -32
  61. package/lib/Route/Route.js +0 -228
  62. package/lib/Route/getConventionalRoutes.d.ts +0 -10
  63. package/lib/Route/getConventionalRoutes.js +0 -259
  64. package/lib/Route/routesToJSON.d.ts +0 -9
  65. package/lib/Route/routesToJSON.js +0 -140
  66. package/lib/Route/types.d.ts +0 -11
  67. package/lib/Service/PluginAPI.d.ts +0 -38
  68. package/lib/Service/PluginAPI.js +0 -193
  69. package/lib/Service/Service.d.ts +0 -96
  70. package/lib/Service/Service.js +0 -694
  71. package/lib/Service/enums.d.ts +0 -29
  72. package/lib/Service/enums.js +0 -67
  73. package/lib/Service/getPaths.d.ts +0 -6
  74. package/lib/Service/getPaths.js +0 -79
  75. package/lib/Service/types.d.ts +0 -52
  76. package/lib/Service/types.js +0 -17
  77. package/lib/Service/utils/isPromise.d.ts +0 -1
  78. package/lib/Service/utils/isPromise.js +0 -22
  79. package/lib/Service/utils/loadDotEnv.d.ts +0 -5
  80. package/lib/Service/utils/loadDotEnv.js +0 -54
  81. package/lib/Service/utils/pluginUtils.d.ts +0 -42
  82. package/lib/Service/utils/pluginUtils.js +0 -201
  83. package/lib/index.d.ts +0 -14
  84. package/lib/index.js +0 -81
package/lib/Html/Html.js DELETED
@@ -1,292 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- function _react() {
9
- const data = _interopRequireDefault(require("react"));
10
-
11
- _react = function _react() {
12
- return data;
13
- };
14
-
15
- return data;
16
- }
17
-
18
- function _ejs() {
19
- const data = _interopRequireDefault(require("@umijs/deps/compiled/ejs"));
20
-
21
- _ejs = function _ejs() {
22
- return data;
23
- };
24
-
25
- return data;
26
- }
27
-
28
- function _prettier() {
29
- const data = _interopRequireDefault(require("@umijs/deps/reexported/prettier"));
30
-
31
- _prettier = function _prettier() {
32
- return data;
33
- };
34
-
35
- return data;
36
- }
37
-
38
- function _utils() {
39
- const data = require("@umijs/utils");
40
-
41
- _utils = function _utils() {
42
- return data;
43
- };
44
-
45
- return data;
46
- }
47
-
48
- function _assert() {
49
- const data = _interopRequireDefault(require("assert"));
50
-
51
- _assert = function _assert() {
52
- return data;
53
- };
54
-
55
- return data;
56
- }
57
-
58
- function _fs() {
59
- const data = require("fs");
60
-
61
- _fs = function _fs() {
62
- return data;
63
- };
64
-
65
- return data;
66
- }
67
-
68
- function _path() {
69
- const data = require("path");
70
-
71
- _path = function _path() {
72
- return data;
73
- };
74
-
75
- return data;
76
- }
77
-
78
- const _excluded = ["content"],
79
- _excluded2 = ["content"];
80
-
81
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
82
-
83
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
84
-
85
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
86
-
87
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
88
-
89
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
90
-
91
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
92
-
93
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
94
-
95
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
96
-
97
- class Html {
98
- constructor(opts) {
99
- this.config = void 0;
100
- this.tplPath = void 0;
101
- this.config = opts.config;
102
- this.tplPath = opts.tplPath;
103
- }
104
-
105
- getHtmlPath(path) {
106
- if (path === '/') {
107
- return 'index.html';
108
- } // remove first and last slash
109
-
110
-
111
- path = path.replace(/^\//, '');
112
- path = path.replace(/\/$/, '');
113
-
114
- if (this.config.exportStatic && this.config.exportStatic.htmlSuffix || path === 'index.html') {
115
- return `${path}`;
116
- } else {
117
- return `${path}/index.html`;
118
- }
119
- }
120
-
121
- getRelPathToPublicPath(path) {
122
- const htmlPath = this.getHtmlPath(path);
123
- const len = htmlPath.split('/').length;
124
- return Array(this.config.exportStatic && this.config.exportStatic.htmlSuffix ? len : len - 1).join('../') || './';
125
- }
126
-
127
- getAsset(opts) {
128
- if (/^https?:\/\//.test(opts.file)) {
129
- return opts.file;
130
- }
131
-
132
- const file = opts.file.charAt(0) === '/' ? opts.file.slice(1) : opts.file;
133
-
134
- if (this.config.exportStatic && this.config.exportStatic.dynamicRoot) {
135
- return `${this.getRelPathToPublicPath(opts.path || '/')}${file}`;
136
- } else {
137
- return `${this.config.publicPath}${file}`;
138
- }
139
- }
140
-
141
- getScriptsContent(scripts) {
142
- return scripts.map(script => {
143
- const content = script.content,
144
- attrs = _objectWithoutProperties(script, _excluded);
145
-
146
- if (content && !attrs.src) {
147
- const newAttrs = Object.keys(attrs).reduce((memo, key) => {
148
- return [...memo, `${key}="${attrs[key]}"`];
149
- }, []);
150
- return [`<script${newAttrs.length ? ' ' : ''}${newAttrs.join(' ')}>`, content.split('\n').map(line => ` ${line}`).join('\n'), '</script>'].join('\n');
151
- } else {
152
- const newAttrs = Object.keys(attrs).reduce((memo, key) => {
153
- return [...memo, `${key}="${attrs[key]}"`];
154
- }, []);
155
- return `<script ${newAttrs.join(' ')}></script>`;
156
- }
157
- }).join('\n');
158
- }
159
-
160
- getContent(args) {
161
- var _this = this;
162
-
163
- return _asyncToGenerator(function* () {
164
- const route = args.route,
165
- _args$tplPath = args.tplPath,
166
- tplPath = _args$tplPath === void 0 ? _this.tplPath : _args$tplPath;
167
- let _args$metas = args.metas,
168
- metas = _args$metas === void 0 ? [] : _args$metas,
169
- _args$links = args.links,
170
- links = _args$links === void 0 ? [] : _args$links,
171
- _args$styles = args.styles,
172
- styles = _args$styles === void 0 ? [] : _args$styles,
173
- _args$headJSFiles = args.headJSFiles,
174
- headJSFiles = _args$headJSFiles === void 0 ? [] : _args$headJSFiles,
175
- _args$headScripts = args.headScripts,
176
- headScripts = _args$headScripts === void 0 ? [] : _args$headScripts,
177
- _args$scripts = args.scripts,
178
- scripts = _args$scripts === void 0 ? [] : _args$scripts,
179
- _args$jsFiles = args.jsFiles,
180
- jsFiles = _args$jsFiles === void 0 ? [] : _args$jsFiles,
181
- _args$cssFiles = args.cssFiles,
182
- cssFiles = _args$cssFiles === void 0 ? [] : _args$cssFiles;
183
- const config = _this.config;
184
-
185
- if (tplPath) {
186
- (0, _assert().default)((0, _fs().existsSync)(tplPath), `getContent() failed, tplPath of ${tplPath} not exists.`);
187
- }
188
-
189
- const tpl = (0, _fs().readFileSync)(tplPath || (0, _path().join)(__dirname, 'document.ejs'), 'utf-8');
190
-
191
- const context = _objectSpread({
192
- config
193
- }, config.exportStatic ? {
194
- route
195
- } : {});
196
-
197
- let html = _ejs().default.render(tpl, context, {
198
- _with: false,
199
- localsName: 'context',
200
- filename: 'document.ejs'
201
- });
202
-
203
- let $ = _utils().cheerio.load(html, {
204
- // @ts-ignore
205
- decodeEntities: false
206
- }); // metas
207
-
208
-
209
- metas.forEach(meta => {
210
- $('head').append(['<meta', ...Object.keys(meta).reduce((memo, key) => {
211
- return memo.concat(`${key}="${meta[key]}"`);
212
- }, []), '/>'].join(' '));
213
- }); // links
214
-
215
- links.forEach(link => {
216
- $('head').append(['<link', ...Object.keys(link).reduce((memo, key) => {
217
- return memo.concat(`${key}="${link[key]}"`);
218
- }, []), '/>'].join(' '));
219
- }); // styles
220
-
221
- styles.forEach(style => {
222
- const _style$content = style.content,
223
- content = _style$content === void 0 ? '' : _style$content,
224
- attrs = _objectWithoutProperties(style, _excluded2);
225
-
226
- const newAttrs = Object.keys(attrs).reduce((memo, key) => {
227
- return memo.concat(`${key}="${attrs[key]}"`);
228
- }, []);
229
- $('head').append([`<style${newAttrs.length ? ' ' : ''}${newAttrs.join(' ')}>`, content.split('\n').map(line => ` ${line}`).join('\n'), '</style>'].join('\n'));
230
- }); // css
231
-
232
- cssFiles.forEach(file => {
233
- $('head').append(`<link rel="stylesheet" href="${_this.getAsset({
234
- file,
235
- path: route.path
236
- })}" />`);
237
- }); // root element
238
-
239
- const mountElementId = config.mountElementId || 'root';
240
-
241
- if (!$(`#${mountElementId}`).length) {
242
- const bodyEl = $('body');
243
- (0, _assert().default)(bodyEl.length, `<body> not found in html template.`);
244
- bodyEl.append(`<div id="${mountElementId}"></div>`);
245
- } // js
246
-
247
-
248
- if (headScripts.length) {
249
- $('head').append(_this.getScriptsContent(headScripts));
250
- }
251
-
252
- headJSFiles.forEach(file => {
253
- $('head').append(`<script src="${_this.getAsset({
254
- file,
255
- path: route.path
256
- })}"></script>`);
257
- });
258
-
259
- if (scripts.length) {
260
- $('body').append(_this.getScriptsContent(scripts));
261
- }
262
-
263
- jsFiles.forEach(file => {
264
- $('body').append(`<script src="${_this.getAsset({
265
- file,
266
- path: route.path
267
- })}"></script>`);
268
- });
269
-
270
- if (args.modifyHTML) {
271
- $ = yield args.modifyHTML($, {
272
- route
273
- });
274
- }
275
-
276
- html = $.html(); // Node 8 not support prettier v2
277
- // https://github.com/prettier/eslint-plugin-prettier/issues/278
278
-
279
- try {
280
- html = _prettier().default.format(html, {
281
- parser: 'html'
282
- });
283
- } catch (_) {}
284
-
285
- return html;
286
- })();
287
- }
288
-
289
- }
290
-
291
- var _default = Html;
292
- exports.default = _default;
@@ -1,12 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
6
- </head>
7
- <body>
8
-
9
- <div id="<%= context.config.mountElementId || 'root' %>"></div>
10
-
11
- </body>
12
- </html>
@@ -1,55 +0,0 @@
1
- import { IConfig, IRoute } from '..';
2
-
3
- export interface IHTMLTag {
4
- [key: string]: string;
5
- }
6
-
7
- export interface IModifyHTML {
8
- (memo: any, args: any): Promise<any>;
9
- }
10
-
11
- export interface IAddHTML<T> {
12
- (memo: T, args: { route?: IRoute }): Promise<T>;
13
- }
14
-
15
- export interface IScript extends Partial<HTMLScriptElement> {
16
- content?: string;
17
- }
18
- export interface IStyle extends Partial<HTMLStyleElement> {
19
- content: string;
20
- }
21
-
22
- export type IScriptConfig = Array<IScript | string>;
23
- export type IStyleConfig = Array<IStyle | string>;
24
-
25
- export interface IOpts {
26
- config: IConfig;
27
- tplPath?: string;
28
- addHTMLHeadScripts?: IAddHTML<IHTMLTag[]>;
29
- addHTMLScripts?: IAddHTML<IHTMLTag[]>;
30
- addHTMLMetas?: IAddHTML<IHTMLTag[]>;
31
- addHTMLLinks?: IAddHTML<Partial<HTMLLinkElement>[]>;
32
- addHTMLStyles?: IAddHTML<Partial<IStyle>[]>;
33
- modifyHTML?: IModifyHTML;
34
- }
35
-
36
- export interface ILink {
37
- [key: string]: string;
38
- }
39
-
40
- export interface IHtmlConfig {
41
- metas?: IHTMLTag[];
42
- links?: Partial<HTMLLinkElement>[];
43
- styles?: Partial<IStyle>[];
44
- headScripts?: IHTMLTag[];
45
- scripts?: IHTMLTag[];
46
- }
47
-
48
- export interface IGetContentArgs extends IHtmlConfig {
49
- route: IRoute;
50
- headJSFiles?: string[];
51
- jsFiles?: string[];
52
- cssFiles?: string[];
53
- tplPath?: string;
54
- modifyHTML?: IModifyHTML;
55
- }
@@ -1,13 +0,0 @@
1
- import { Debugger } from '@umijs/utils';
2
- declare abstract class Common {
3
- debug: Debugger;
4
- protected namespace: string;
5
- protected profilers: object;
6
- protected formatTiming(timing: number): string;
7
- constructor(namespace: string);
8
- abstract error(msg: string): void;
9
- abstract log(msg: string): void;
10
- abstract info(msg: string): void;
11
- abstract profile(id: string, ...args: any): void;
12
- }
13
- export default Common;
@@ -1,53 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- function _react() {
9
- const data = _interopRequireDefault(require("react"));
10
-
11
- _react = function _react() {
12
- return data;
13
- };
14
-
15
- return data;
16
- }
17
-
18
- function _utils() {
19
- const data = require("@umijs/utils");
20
-
21
- _utils = function _utils() {
22
- return data;
23
- };
24
-
25
- return data;
26
- }
27
-
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
-
30
- class Common {
31
- formatTiming(timing) {
32
- return timing < 60 * 1000 ? `${Math.round(timing / 10) / 100}s` : `${Math.round(timing / 600) / 100}m`;
33
- }
34
-
35
- constructor(namespace) {
36
- this.debug = void 0;
37
- this.namespace = void 0;
38
- this.profilers = void 0;
39
-
40
- // TODO: get namespace filename accounding caller function
41
- if (!namespace) {
42
- throw new Error(`logger needs namespace`);
43
- }
44
-
45
- this.namespace = namespace;
46
- this.profilers = {};
47
- this.debug = (0, _utils().createDebug)(this.namespace);
48
- }
49
-
50
- }
51
-
52
- var _default = Common;
53
- exports.default = _default;
@@ -1,17 +0,0 @@
1
- import Common from './Common';
2
- export default class Logger extends Common {
3
- LOG: string;
4
- INFO: string;
5
- WARN: string;
6
- ERROR: string;
7
- PROFILE: string;
8
- log(...args: any): void;
9
- /**
10
- * The {@link logger.info} function is an alias for {@link logger.log()}.
11
- * @param args
12
- */
13
- info(...args: any): void;
14
- error(...args: any): void;
15
- warn(...args: any): void;
16
- profile(id: string, message?: string): string;
17
- }
@@ -1,87 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- function _react() {
9
- const data = _interopRequireDefault(require("react"));
10
-
11
- _react = function _react() {
12
- return data;
13
- };
14
-
15
- return data;
16
- }
17
-
18
- function _utils() {
19
- const data = require("@umijs/utils");
20
-
21
- _utils = function _utils() {
22
- return data;
23
- };
24
-
25
- return data;
26
- }
27
-
28
- var _Common = _interopRequireDefault(require("./Common"));
29
-
30
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
-
32
- class Logger extends _Common.default {
33
- constructor(...args) {
34
- super(...args);
35
- this.LOG = _utils().chalk.black.bgBlue('LOG');
36
- this.INFO = _utils().chalk.black.bgBlue('INFO');
37
- this.WARN = _utils().chalk.black.bgHex('#faad14')('WARN');
38
- this.ERROR = _utils().chalk.black.bgRed('ERROR');
39
- this.PROFILE = _utils().chalk.black.bgCyan('PROFILE');
40
- }
41
-
42
- log(...args) {
43
- // TODO: node env production
44
- console.log(this.LOG, ...args);
45
- }
46
- /**
47
- * The {@link logger.info} function is an alias for {@link logger.log()}.
48
- * @param args
49
- */
50
-
51
-
52
- info(...args) {
53
- console.log(this.INFO, ...args);
54
- }
55
-
56
- error(...args) {
57
- console.error(this.ERROR, ...args);
58
- }
59
-
60
- warn(...args) {
61
- console.warn(this.WARN, ...args);
62
- }
63
-
64
- profile(id, message) {
65
- const time = Date.now();
66
- const namespace = `${this.namespace}:${id}`; // for test
67
-
68
- let msg;
69
-
70
- if (this.profilers[id]) {
71
- const timeEnd = this.profilers[id];
72
- delete this.profilers[id];
73
- process.stderr.write(this.PROFILE + ' ');
74
- msg = `${this.PROFILE} ${_utils().chalk.cyan(`└ ${namespace}`)} Completed in ${this.formatTiming(time - timeEnd)}`;
75
- console.log(msg);
76
- } else {
77
- msg = `${this.PROFILE} ${_utils().chalk.cyan(`┌ ${namespace}`)} ${message || ''}`;
78
- console.log(msg);
79
- }
80
-
81
- this.profilers[id] = time;
82
- return msg;
83
- }
84
-
85
- }
86
-
87
- exports.default = Logger;
@@ -1,32 +0,0 @@
1
- import { IConfig, IRoute } from '..';
2
- interface IOpts {
3
- onPatchRoutesBefore?: Function;
4
- onPatchRoutes?: Function;
5
- onPatchRouteBefore?: Function;
6
- onPatchRoute?: Function;
7
- }
8
- interface IGetRoutesOpts {
9
- config: IConfig;
10
- root: string;
11
- componentPrefix?: string;
12
- isConventional?: boolean;
13
- parentRoute?: IRoute;
14
- }
15
- declare class Route {
16
- opts: IOpts;
17
- constructor(opts?: IOpts);
18
- getRoutes(opts: IGetRoutesOpts): Promise<any>;
19
- patchRoutes(routes: IRoute[], opts: IGetRoutesOpts): Promise<void>;
20
- patchRoute(route: IRoute, opts: IGetRoutesOpts): Promise<void>;
21
- getConventionRoutes(opts: any): IRoute[];
22
- getJSON(opts: {
23
- routes: IRoute[];
24
- config: IConfig;
25
- cwd: string;
26
- isServer?: boolean;
27
- }): string;
28
- getPaths({ routes }: {
29
- routes: IRoute[];
30
- }): string[];
31
- }
32
- export default Route;