@umijs/preset-umi 4.0.1 → 4.0.2

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.
@@ -1,2 +1,2 @@
1
- import type { Root } from '@umijs/core/compiled/@hapi/joi';
1
+ import type { Root } from '@umijs/utils/compiled/@hapi/joi';
2
2
  export declare function getSchemas(): Record<string, (Joi: Root) => any>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSchemas = void 0;
4
+ // sort-object-keys
4
5
  const utils_1 = require("@umijs/utils");
5
6
  function getSchemas() {
6
7
  return {
@@ -4,7 +4,6 @@ const types_1 = require("@umijs/core/dist/types");
4
4
  const utils_1 = require("@umijs/utils");
5
5
  const fs_1 = require("fs");
6
6
  const path_1 = require("path");
7
- const builder_1 = require("./builder/builder");
8
7
  const utils_2 = require("./utils");
9
8
  exports.default = (api) => {
10
9
  api.describe({
@@ -52,7 +51,8 @@ export { React };
52
51
  });
53
52
  });
54
53
  api.onBeforeCompiler(async () => {
55
- await (0, builder_1.build)({
54
+ const { build } = (0, utils_1.importLazy)(require.resolve('./builder/builder'));
55
+ await build({
56
56
  api,
57
57
  watch: api.env === 'development',
58
58
  });
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const joi_1 = __importDefault(require("@umijs/core/compiled/@hapi/joi"));
6
+ const joi_1 = __importDefault(require("@umijs/utils/compiled/@hapi/joi"));
7
7
  // @ts-ignore
8
8
  const joi2types_1 = __importDefault(require("../../../compiled/joi2types"));
9
9
  exports.default = (api) => {
@@ -159,7 +159,7 @@ exports.getRoutes = getRoutes;
159
159
  async function getRouteComponents(opts) {
160
160
  const imports = Object.keys(opts.routes)
161
161
  .map((key) => {
162
- const useSuspense = true; // opts.api.appData.react.version.startsWith('18.');
162
+ const useSuspense = opts.api.appData.framework === 'react' ? true : false; // opts.api.appData.react.version.startsWith('18.');
163
163
  const route = opts.routes[key];
164
164
  if (!route.file) {
165
165
  return useSuspense
@@ -302,6 +302,7 @@ export default function EmptyRoute() {
302
302
  path: 'core/route.tsx',
303
303
  tplPath: (0, path_1.join)(constants_1.TEMPLATES_DIR, 'route.tpl'),
304
304
  context: {
305
+ isReact: api.appData.framework === 'react',
305
306
  isClientLoaderEnabled: !!api.config.clientLoader,
306
307
  routes: JSON.stringify(clonedRoutes)
307
308
  // "clientLoaders['foo']" > clientLoaders['foo']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/preset-umi",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
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",
@@ -21,20 +21,20 @@
21
21
  "scripts": {
22
22
  "build": "pnpm tsc",
23
23
  "build:deps": "umi-scripts bundleDeps",
24
- "dev": "pnpm build -- --watch",
24
+ "dev": "pnpm build --watch",
25
25
  "test": "umi-scripts jest-turbo"
26
26
  },
27
27
  "dependencies": {
28
28
  "@types/multer": "1.4.7",
29
- "@umijs/ast": "4.0.1",
30
- "@umijs/babel-preset-umi": "4.0.1",
31
- "@umijs/bundler-utils": "4.0.1",
32
- "@umijs/bundler-vite": "4.0.1",
33
- "@umijs/bundler-webpack": "4.0.1",
34
- "@umijs/core": "4.0.1",
35
- "@umijs/renderer-react": "4.0.1",
36
- "@umijs/server": "4.0.1",
37
- "@umijs/utils": "4.0.1",
29
+ "@umijs/ast": "4.0.2",
30
+ "@umijs/babel-preset-umi": "4.0.2",
31
+ "@umijs/bundler-utils": "4.0.2",
32
+ "@umijs/bundler-vite": "4.0.2",
33
+ "@umijs/bundler-webpack": "4.0.2",
34
+ "@umijs/core": "4.0.2",
35
+ "@umijs/renderer-react": "4.0.2",
36
+ "@umijs/server": "4.0.2",
37
+ "@umijs/utils": "4.0.2",
38
38
  "core-js": "3.22.4",
39
39
  "current-script-polyfill": "1.0.0",
40
40
  "enhanced-resolve": "5.9.3",
@@ -1,7 +1,9 @@
1
1
  {{#isClientLoaderEnabled}}
2
2
  import clientLoaders from './loaders.js';
3
3
  {{/isClientLoaderEnabled}}
4
+ {{#isReact}}
4
5
  import React from 'react';
6
+ {{/isReact}}
5
7
 
6
8
  export async function getRoutes() {
7
9
  return {