@umijs/preset-umi 4.0.0-beta.17 → 4.0.0-beta.18

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.
@@ -7,7 +7,6 @@ exports.default = (api) => {
7
7
  description: 'inspect umi plugins',
8
8
  fn({ args }) {
9
9
  const command = args._[0];
10
- console.log('command', command);
11
10
  if (!command) {
12
11
  throw new Error(`
13
12
  Sub command not found: umi plugin
@@ -31,12 +31,26 @@ function getRoutes(opts) {
31
31
  prefix: '',
32
32
  });
33
33
  }
34
+ function localPath(path) {
35
+ if (path.charAt(0) !== '.') {
36
+ return `./${path}`;
37
+ }
38
+ {
39
+ return path;
40
+ }
41
+ }
34
42
  for (const id of Object.keys(routes)) {
35
- // TODO: cache for performance
36
- const file = (0, path_1.isAbsolute)(routes[id].file)
37
- ? routes[id].file
38
- : (0, path_1.join)(((_c = opts.api.config.conventionRoutes) === null || _c === void 0 ? void 0 : _c.base) || opts.api.paths.absPagesPath, routes[id].file);
39
- routes[id].__content = (0, fs_1.readFileSync)(file, 'utf-8');
43
+ if (routes[id].file) {
44
+ // TODO: cache for performance
45
+ const file = (0, path_1.isAbsolute)(routes[id].file)
46
+ ? routes[id].file
47
+ : utils_1.resolve.sync(localPath(routes[id].file), {
48
+ basedir: ((_c = opts.api.config.conventionRoutes) === null || _c === void 0 ? void 0 : _c.base) ||
49
+ opts.api.paths.absPagesPath,
50
+ extensions: ['.js', '.jsx', '.tsx', '.ts'],
51
+ });
52
+ routes[id].__content = (0, fs_1.readFileSync)(file, 'utf-8');
53
+ }
40
54
  }
41
55
  // layout routes
42
56
  const absLayoutPath = (0, path_1.join)(opts.api.paths.absSrcPath, 'layouts/index.tsx');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/preset-umi",
3
- "version": "4.0.0-beta.17",
3
+ "version": "4.0.0-beta.18",
4
4
  "description": "@umijs/preset-umi",
5
5
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/preset-umi#readme",
6
6
  "bugs": "https://github.com/umijs/umi-next/issues",
@@ -24,15 +24,15 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@types/multer": "1.4.7",
27
- "@umijs/ast": "4.0.0-beta.17",
28
- "@umijs/babel-preset-umi": "4.0.0-beta.17",
29
- "@umijs/bundler-utils": "4.0.0-beta.17",
30
- "@umijs/bundler-vite": "4.0.0-beta.17",
31
- "@umijs/bundler-webpack": "4.0.0-beta.17",
32
- "@umijs/core": "4.0.0-beta.17",
33
- "@umijs/renderer-react": "4.0.0-beta.17",
34
- "@umijs/server": "4.0.0-beta.17",
35
- "@umijs/utils": "4.0.0-beta.17",
27
+ "@umijs/ast": "4.0.0-beta.18",
28
+ "@umijs/babel-preset-umi": "4.0.0-beta.18",
29
+ "@umijs/bundler-utils": "4.0.0-beta.18",
30
+ "@umijs/bundler-vite": "4.0.0-beta.18",
31
+ "@umijs/bundler-webpack": "4.0.0-beta.18",
32
+ "@umijs/core": "4.0.0-beta.18",
33
+ "@umijs/renderer-react": "4.0.0-beta.18",
34
+ "@umijs/server": "4.0.0-beta.18",
35
+ "@umijs/utils": "4.0.0-beta.18",
36
36
  "core-js": "3.19.2",
37
37
  "current-script-polyfill": "1.0.0",
38
38
  "enhanced-resolve": "5.8.3",