@umijs/preset-umi 4.6.67 → 4.6.68
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.
- package/dist/commands/build.d.ts +1 -1
- package/dist/commands/config/config.d.ts +1 -1
- package/dist/commands/config/list.d.ts +1 -1
- package/dist/commands/config/remove.js +2 -1
- package/dist/commands/config/set.js +2 -1
- package/dist/commands/deadcode.d.ts +1 -1
- package/dist/commands/deadcode.js +2 -1
- package/dist/commands/dev/createRouteMiddleware.js +2 -1
- package/dist/commands/dev/depBuildWorker/depBuildWorker.js +3 -3
- package/dist/commands/dev/depBuildWorker/depBuilder.d.ts +1 -1
- package/dist/commands/dev/depBuildWorker/depBuilder.js +6 -5
- package/dist/commands/dev/depBuildWorker/dev-config.d.ts +1 -1
- package/dist/commands/dev/depBuildWorker/getConfig.js +2 -2
- package/dist/commands/dev/depBuildWorker/workerPreset.d.ts +2 -2
- package/dist/commands/dev/dev.d.ts +1 -1
- package/dist/commands/dev/dev.js +2 -1
- package/dist/commands/generators/api.d.ts +1 -1
- package/dist/commands/generators/component.d.ts +1 -1
- package/dist/commands/generators/component.js +0 -2
- package/dist/commands/generators/cypress.d.ts +1 -1
- package/dist/commands/generators/dva.d.ts +1 -1
- package/dist/commands/generators/jest.d.ts +1 -1
- package/dist/commands/generators/mock.d.ts +1 -1
- package/dist/commands/generators/page.d.ts +1 -1
- package/dist/commands/generators/page.js +9 -8
- package/dist/commands/generators/precommit.d.ts +1 -1
- package/dist/commands/generators/prettier.d.ts +1 -1
- package/dist/commands/generators/tailwindcss.d.ts +1 -1
- package/dist/commands/generators/tsconfig.d.ts +1 -1
- package/dist/commands/generators/utils.js +0 -2
- package/dist/commands/help.d.ts +1 -1
- package/dist/commands/lint.d.ts +1 -1
- package/dist/commands/mfsu/mfsu.d.ts +1 -1
- package/dist/commands/mfsu/util.js +0 -2
- package/dist/commands/plugin.d.ts +1 -1
- package/dist/commands/preview.d.ts +1 -1
- package/dist/commands/setup.d.ts +1 -1
- package/dist/commands/verify-commit.d.ts +1 -1
- package/dist/commands/version.d.ts +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +3 -0
- package/dist/features/404/404.d.ts +2 -2
- package/dist/features/__sample.d.ts +1 -1
- package/dist/features/aiDev/aiDev.d.ts +1 -1
- package/dist/features/aiDev/aiDev.js +2 -1
- package/dist/features/apiRoute/apiRoute.d.ts +1 -1
- package/dist/features/apiRoute/apiRoute.js +2 -1
- package/dist/features/apiRoute/dev-server/esbuild.js +2 -1
- package/dist/features/apiRoute/request.d.ts +0 -2
- package/dist/features/apiRoute/request.js +6 -5
- package/dist/features/apiRoute/response.d.ts +0 -1
- package/dist/features/apiRoute/response.js +0 -1
- package/dist/features/apiRoute/utils.js +18 -9
- package/dist/features/appData/appData.d.ts +1 -1
- package/dist/features/appData/appData.js +2 -2
- package/dist/features/appData/umiInfo.d.ts +1 -1
- package/dist/features/bundler/bundler.d.ts +1 -1
- package/dist/features/check/babel722.d.ts +1 -1
- package/dist/features/check/check.d.ts +1 -1
- package/dist/features/classPropertiesLoose/classPropertiesLoose.d.ts +1 -1
- package/dist/features/clickToComponent/clickToComponent.d.ts +1 -1
- package/dist/features/clientLoader/clientLoader.d.ts +1 -1
- package/dist/features/codeSplitting/codeSplitting.d.ts +1 -1
- package/dist/features/codeSplitting/codeSplitting.js +4 -2
- package/dist/features/configPlugins/configPlugins.d.ts +1 -1
- package/dist/features/crossorigin/crossorigin.d.ts +1 -1
- package/dist/features/depsOnDemand/depsOnDemand.d.ts +1 -1
- package/dist/features/devTool/devTool.d.ts +1 -1
- package/dist/features/esbuildHelperChecker/esbuildHelperChecker.d.ts +1 -1
- package/dist/features/esbuildHelperChecker/esbuildHelperChecker.js +10 -5
- package/dist/features/esmi/Service.js +5 -5
- package/dist/features/esmi/esmi.d.ts +1 -1
- package/dist/features/exportStatic/exportStatic.d.ts +1 -1
- package/dist/features/favicons/favicons.d.ts +1 -1
- package/dist/features/favicons/favicons.js +4 -2
- package/dist/features/helmet/helmet.d.ts +2 -2
- package/dist/features/icons/icons.d.ts +1 -1
- package/dist/features/icons/svgr.js +4 -2
- package/dist/features/legacy/legacy.d.ts +1 -1
- package/dist/features/legacy/legacy.js +6 -6
- package/dist/features/lowImport/lowImport.d.ts +1 -1
- package/dist/features/mako/mako.d.ts +1 -1
- package/dist/features/mock/createMockMiddleware.js +2 -1
- package/dist/features/monorepo/redirect.d.ts +1 -1
- package/dist/features/monorepo/redirect.js +4 -2
- package/dist/features/mpa/mpa.d.ts +1 -1
- package/dist/features/mpa/mpa.js +10 -5
- package/dist/features/okam/okam.d.ts +1 -1
- package/dist/features/overrides/overrides.d.ts +1 -1
- package/dist/features/overrides/overrides.js +2 -1
- package/dist/features/overrides/transform.js +4 -2
- package/dist/features/phantomDependency/phantomDependency.d.ts +1 -1
- package/dist/features/phantomDependency/phantomDependency.js +30 -15
- package/dist/features/polyfill/polyfill.d.ts +1 -1
- package/dist/features/polyfill/publicPathPolyfill.d.ts +1 -1
- package/dist/features/prepare/esbuildPlugins/esbuildAliasPlugin.js +8 -4
- package/dist/features/prepare/prepare.d.ts +1 -1
- package/dist/features/prepare/prepare.js +2 -1
- package/dist/features/reactCompiler/forget.d.ts +1 -1
- package/dist/features/reactCompiler/reactCompiler.d.ts +1 -1
- package/dist/features/reactCompiler/reactCompiler.js +4 -2
- package/dist/features/routePrefetch/routePrefetch.d.ts +1 -1
- package/dist/features/routePreloadOnLoad/routePreloadOnLoad.d.ts +1 -1
- package/dist/features/routePreloadOnLoad/routePreloadOnLoad.js +4 -2
- package/dist/features/routeProps/routeProps.d.ts +1 -1
- package/dist/features/ssr/builder/css-loader.js +2 -2
- package/dist/features/ssr/mako/mako.d.ts +1 -0
- package/dist/features/ssr/mako/mako.js +2 -2
- package/dist/features/ssr/ssr.d.ts +1 -1
- package/dist/features/ssr/ssr.js +4 -3
- package/dist/features/ssr/utils.js +4 -2
- package/dist/features/ssr/utoopack/utoopack.js +3 -3
- package/dist/features/ssr/webpack/webpack.js +2 -2
- package/dist/features/stagewise/stagewise.d.ts +1 -1
- package/dist/features/swc/swc.d.ts +1 -1
- package/dist/features/terminal/terminal.d.ts +1 -1
- package/dist/features/test/test.d.ts +1 -1
- package/dist/features/tmpFiles/configTypes.d.ts +1 -1
- package/dist/features/tmpFiles/getModuleExports.js +2 -2
- package/dist/features/tmpFiles/routes.js +7 -6
- package/dist/features/tmpFiles/tmpFiles.d.ts +1 -1
- package/dist/features/tmpFiles/tmpFiles.js +13 -14
- package/dist/features/transform/CodeFrameError.js +0 -1
- package/dist/features/transform/transform.d.ts +1 -1
- package/dist/features/ui/ui.d.ts +1 -1
- package/dist/features/ui/ui.js +2 -1
- package/dist/features/utoopack/utoopack.d.ts +1 -1
- package/dist/features/vite/vite.d.ts +1 -1
- package/dist/features/webpack/webpack.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/libs/folderCache/AutoUpdateFolderCache.js +3 -9
- package/dist/libs/folderCache/AutoUpdateSourceCodeCache.d.ts +2 -2
- package/dist/libs/folderCache/AutoUpdateSourceCodeCache.js +2 -5
- package/dist/libs/folderCache/FolderWatch.js +2 -5
- package/dist/libs/folderCache/LazySourceCodeCache.d.ts +2 -2
- package/dist/libs/folderCache/LazySourceCodeCache.js +6 -10
- package/dist/libs/folderCache/constant.d.ts +28 -28
- package/dist/libs/folderCache/types.d.ts +5 -5
- package/dist/libs/scan.d.ts +1 -1
- package/dist/libs/scan.js +4 -2
- package/dist/registerMethods.d.ts +1 -1
- package/dist/types.d.ts +12 -13
- package/dist/utils/extractEntryAssets.d.ts +1 -1
- package/dist/utils/routeExportExtractor.d.ts +1 -1
- package/dist/utils/routeExportExtractor.js +2 -1
- package/dist/utils/serializeAppData.js +2 -1
- package/package.json +15 -15
|
@@ -49,7 +49,8 @@ var codeSplitting_default = (api) => {
|
|
|
49
49
|
enableBy: api.EnableBy.config
|
|
50
50
|
});
|
|
51
51
|
api.chainWebpack((memo) => {
|
|
52
|
-
if (api.env !== "production")
|
|
52
|
+
if (api.env !== "production")
|
|
53
|
+
return;
|
|
53
54
|
const { jsStrategy, jsStrategyOptions, cssStrategy } = api.config.codeSplitting;
|
|
54
55
|
if (jsStrategy === "bigVendors") {
|
|
55
56
|
memo.optimization.splitChunks({
|
|
@@ -74,7 +75,8 @@ var codeSplitting_default = (api) => {
|
|
|
74
75
|
name(module2) {
|
|
75
76
|
const path = module2.context.replace(/.pnpm[\\/]/, "");
|
|
76
77
|
const match = path.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/);
|
|
77
|
-
if (!match)
|
|
78
|
+
if (!match)
|
|
79
|
+
return "npm.unknown";
|
|
78
80
|
const packageName = match[1];
|
|
79
81
|
return `npm.${packageName.replace(/@/g, "_at_").replace(/\+/g, "_")}`;
|
|
80
82
|
}
|
|
@@ -9,8 +9,8 @@ export interface IOnDemandInstallDep {
|
|
|
9
9
|
*/
|
|
10
10
|
dev?: boolean;
|
|
11
11
|
}
|
|
12
|
-
declare const _default: (api: IApi) => void;
|
|
13
12
|
export default _default;
|
|
13
|
+
declare function _default(api: IApi): void;
|
|
14
14
|
export declare function addDeps(opts: {
|
|
15
15
|
pkgPath: string;
|
|
16
16
|
deps: IOnDemandInstallDep[];
|
|
@@ -109,12 +109,17 @@ var esbuildHelperChecker_default = (api) => {
|
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
api.onBuildComplete(async ({ err }) => {
|
|
112
|
-
if (api.config.vite || api.config.mako || api.config.utoopack)
|
|
113
|
-
|
|
112
|
+
if (api.config.vite || api.config.mako || api.config.utoopack)
|
|
113
|
+
return;
|
|
114
|
+
if (err)
|
|
115
|
+
return;
|
|
114
116
|
const jsMinifier = api.config.jsMinifier || "esbuild";
|
|
115
|
-
if (jsMinifier !== "esbuild")
|
|
116
|
-
|
|
117
|
-
if (
|
|
117
|
+
if (jsMinifier !== "esbuild")
|
|
118
|
+
return;
|
|
119
|
+
if (api.config.esbuildMinifyIIFE)
|
|
120
|
+
return;
|
|
121
|
+
if (process.env.COMPRESS === "none")
|
|
122
|
+
return;
|
|
118
123
|
try {
|
|
119
124
|
await checkDir({
|
|
120
125
|
dir: api.paths.absOutputPath
|
|
@@ -36,11 +36,11 @@ var import_utils = require("@umijs/utils");
|
|
|
36
36
|
var import_crypto = require("crypto");
|
|
37
37
|
var import_fs = __toESM(require("fs"));
|
|
38
38
|
var import_path = __toESM(require("path"));
|
|
39
|
-
var ESMIService = class
|
|
40
|
-
cdnOrigin = "";
|
|
41
|
-
cacheDir = "";
|
|
42
|
-
cache = {};
|
|
39
|
+
var ESMIService = class {
|
|
43
40
|
constructor(opts) {
|
|
41
|
+
this.cdnOrigin = "";
|
|
42
|
+
this.cacheDir = "";
|
|
43
|
+
this.cache = {};
|
|
44
44
|
this.cdnOrigin = opts.cdnOrigin;
|
|
45
45
|
this.cacheDir = opts.cacheDir;
|
|
46
46
|
const cacheFilePath = import_path.default.join(this.cacheDir, "importmap.json");
|
|
@@ -102,7 +102,7 @@ var ESMIService = class _ESMIService {
|
|
|
102
102
|
* @returns importmap
|
|
103
103
|
*/
|
|
104
104
|
async getImportmap(data) {
|
|
105
|
-
const cacheKey =
|
|
105
|
+
const cacheKey = ESMIService.getCacheKey(data);
|
|
106
106
|
const cache = this.getCache(cacheKey);
|
|
107
107
|
const stamp = +/* @__PURE__ */ new Date();
|
|
108
108
|
if (cache) {
|
|
@@ -44,7 +44,8 @@ var favicons_default = (api) => {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
api.modifyAppData(async (memo) => {
|
|
47
|
-
if (api.config.favicons)
|
|
47
|
+
if (api.config.favicons)
|
|
48
|
+
return memo;
|
|
48
49
|
const faviconFiles = getFaviconFiles(api.paths.absSrcPath);
|
|
49
50
|
if (faviconFiles) {
|
|
50
51
|
memo.faviconFiles = faviconFiles;
|
|
@@ -64,7 +65,8 @@ var favicons_default = (api) => {
|
|
|
64
65
|
}
|
|
65
66
|
]);
|
|
66
67
|
api.onBuildComplete(({ err }) => {
|
|
67
|
-
if (err)
|
|
68
|
+
if (err)
|
|
69
|
+
return;
|
|
68
70
|
if (api.appData.faviconFiles) {
|
|
69
71
|
api.appData.faviconFiles.forEach((e) => {
|
|
70
72
|
(0, import_fs.copyFileSync)(
|
|
@@ -74,8 +74,10 @@ function loadLocalIcon(icon, localIconDir) {
|
|
|
74
74
|
}
|
|
75
75
|
function normalizeSvgr(str) {
|
|
76
76
|
return str.split("\n").filter((line) => {
|
|
77
|
-
if (line.startsWith('import * as React from "react";'))
|
|
78
|
-
|
|
77
|
+
if (line.startsWith('import * as React from "react";'))
|
|
78
|
+
return false;
|
|
79
|
+
if (line.startsWith("export default "))
|
|
80
|
+
return false;
|
|
79
81
|
return true;
|
|
80
82
|
}).join("\n");
|
|
81
83
|
}
|
|
@@ -32,7 +32,7 @@ __export(legacy_exports, {
|
|
|
32
32
|
default: () => legacy_default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(legacy_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_bundler_webpack = require("@umijs/bundler-webpack");
|
|
36
36
|
var import_utils = require("@umijs/utils");
|
|
37
37
|
var import_path = require("path");
|
|
38
38
|
var legacy_default = (api) => {
|
|
@@ -52,7 +52,7 @@ var legacy_default = (api) => {
|
|
|
52
52
|
const legacyModeLabel = import_utils.chalk.bold.bgBlue(" LEGACY MODE ");
|
|
53
53
|
const pluginConfig = api.config.legacy || api.userConfig.legacy || {};
|
|
54
54
|
const enableEsCheck = pluginConfig == null ? void 0 : pluginConfig.checkOutput;
|
|
55
|
-
if (api.env ===
|
|
55
|
+
if (api.env === import_bundler_webpack.Env.production && enableEsCheck) {
|
|
56
56
|
api.addOnDemandDeps(() => {
|
|
57
57
|
return [
|
|
58
58
|
{
|
|
@@ -89,7 +89,7 @@ var legacy_default = (api) => {
|
|
|
89
89
|
var _a, _b;
|
|
90
90
|
const { userConfig } = api;
|
|
91
91
|
const { buildOnly = true, nodeModulesTransform = true } = pluginConfig;
|
|
92
|
-
if (api.env ===
|
|
92
|
+
if (api.env === import_bundler_webpack.Env.development) {
|
|
93
93
|
if (buildOnly) {
|
|
94
94
|
return memo;
|
|
95
95
|
}
|
|
@@ -114,9 +114,9 @@ var legacy_default = (api) => {
|
|
|
114
114
|
"Manual configuration of legacy mode is not supported."
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
|
-
memo.srcTranspiler =
|
|
118
|
-
memo.jsMinifier =
|
|
119
|
-
memo.cssMinifier =
|
|
117
|
+
memo.srcTranspiler = import_bundler_webpack.Transpiler.babel;
|
|
118
|
+
memo.jsMinifier = import_bundler_webpack.JSMinifier.terser;
|
|
119
|
+
memo.cssMinifier = import_bundler_webpack.CSSMinifier.cssnano;
|
|
120
120
|
const ieTarget = ((_a = userConfig.targets) == null ? void 0 : _a.ie) || ((_b = api.config.targets) == null ? void 0 : _b.ie) || 11;
|
|
121
121
|
memo.targets = {
|
|
122
122
|
...userConfig.targets,
|
|
@@ -40,7 +40,8 @@ function createMockMiddleware(opts) {
|
|
|
40
40
|
const method = req.method.toUpperCase();
|
|
41
41
|
for (const key of Object.keys(opts.context.mockData)) {
|
|
42
42
|
const mock = opts.context.mockData[key];
|
|
43
|
-
if (mock.method !== method)
|
|
43
|
+
if (mock.method !== method)
|
|
44
|
+
continue;
|
|
44
45
|
const { keys, re } = getPathReAndKeys(mock.path);
|
|
45
46
|
const m = re.exec(req.path);
|
|
46
47
|
if (m) {
|
|
@@ -68,7 +68,8 @@ var redirect_default = (api) => {
|
|
|
68
68
|
// APP_ROOT: https://github.com/umijs/umi/issues/9461
|
|
69
69
|
cwd: useRootProject ? currentProjectRoot : (0, import_path.dirname)(currentProjectRoot)
|
|
70
70
|
});
|
|
71
|
-
if (!rootPkg)
|
|
71
|
+
if (!rootPkg)
|
|
72
|
+
return memo;
|
|
72
73
|
const root = (0, import_path.dirname)(rootPkg);
|
|
73
74
|
(0, import_assert.default)(
|
|
74
75
|
(0, import_utils.isMonorepo)({ root }),
|
|
@@ -83,7 +84,8 @@ var redirect_default = (api) => {
|
|
|
83
84
|
const usingDeps = collectPkgDeps(api.pkg).filter((name) => {
|
|
84
85
|
return !exclude.some((reg) => reg.test(name));
|
|
85
86
|
});
|
|
86
|
-
if (!usingDeps.length)
|
|
87
|
+
if (!usingDeps.length)
|
|
88
|
+
return memo;
|
|
87
89
|
const projects = await collectAllProjects({ root });
|
|
88
90
|
const alias = usingDeps.reduce((obj, name) => {
|
|
89
91
|
const pkgInfo = projects[name];
|
package/dist/features/mpa/mpa.js
CHANGED
|
@@ -107,7 +107,8 @@ ${renderer}
|
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
api.modifyEntry((memo) => {
|
|
110
|
-
if ("umi" in memo)
|
|
110
|
+
if ("umi" in memo)
|
|
111
|
+
delete memo["umi"];
|
|
111
112
|
api.appData.mpa.entry.forEach((entry) => {
|
|
112
113
|
memo[entry.name] = (0, import_path.join)(api.paths.absTmpPath, entry.tmpFilePath);
|
|
113
114
|
});
|
|
@@ -176,10 +177,14 @@ async function collectEntry(root, opts, mountElementId) {
|
|
|
176
177
|
);
|
|
177
178
|
}
|
|
178
179
|
function getIndexFile(dir) {
|
|
179
|
-
if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.tsx")))
|
|
180
|
-
|
|
181
|
-
if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.
|
|
182
|
-
|
|
180
|
+
if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.tsx")))
|
|
181
|
+
return (0, import_path.join)(dir, "index.tsx");
|
|
182
|
+
if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.ts")))
|
|
183
|
+
return (0, import_path.join)(dir, "index.ts");
|
|
184
|
+
if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.jsx")))
|
|
185
|
+
return (0, import_path.join)(dir, "index.jsx");
|
|
186
|
+
if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.js")))
|
|
187
|
+
return (0, import_path.join)(dir, "index.js");
|
|
183
188
|
return null;
|
|
184
189
|
}
|
|
185
190
|
async function getConfig(indexFile) {
|
|
@@ -38,7 +38,8 @@ var overrides_default = (api) => {
|
|
|
38
38
|
if (api.appData.overridesCSS.length) {
|
|
39
39
|
const filePath = api.appData.overridesCSS[0];
|
|
40
40
|
let content = (0, import_fs.readFileSync)(filePath, "utf-8");
|
|
41
|
-
if (content === cachedContent)
|
|
41
|
+
if (content === cachedContent)
|
|
42
|
+
return;
|
|
42
43
|
const subPath = "core/overrides.css";
|
|
43
44
|
const targetPath = (0, import_path.join)(api.paths.absTmpPath, subPath);
|
|
44
45
|
const isLess = filePath.endsWith(".less");
|
|
@@ -43,8 +43,10 @@ async function transform(cssContent, filePath) {
|
|
|
43
43
|
let origin = atRule.params;
|
|
44
44
|
origin = origin.replace(/^url\((.+)\)$/g, "$1");
|
|
45
45
|
origin = origin.replace(/^'(.+)'$/g, "$1").replace(/^"(.+)"$/g, "$1");
|
|
46
|
-
if (origin.startsWith("~"))
|
|
47
|
-
|
|
46
|
+
if (origin.startsWith("~"))
|
|
47
|
+
return;
|
|
48
|
+
if (origin.startsWith("/"))
|
|
49
|
+
return;
|
|
48
50
|
function getResolvedPath(origin2) {
|
|
49
51
|
return (0, import_utils.winPath)(import_path.default.resolve(import_path.default.dirname(filePath), origin2));
|
|
50
52
|
}
|
|
@@ -57,10 +57,14 @@ var phantomDependency_default = (api) => {
|
|
|
57
57
|
const importsBySource = /* @__PURE__ */ new Map();
|
|
58
58
|
for (const file of files) {
|
|
59
59
|
const winP = (0, import_utils.winPath)(file);
|
|
60
|
-
if (winP.includes(".umi/"))
|
|
61
|
-
|
|
62
|
-
if (winP.
|
|
63
|
-
|
|
60
|
+
if (winP.includes(".umi/"))
|
|
61
|
+
continue;
|
|
62
|
+
if (winP.includes("/node_modules/"))
|
|
63
|
+
continue;
|
|
64
|
+
if (winP.startsWith("../"))
|
|
65
|
+
continue;
|
|
66
|
+
if (import_path.default.isAbsolute(file))
|
|
67
|
+
continue;
|
|
64
68
|
const { imports } = result.metafile.inputs[file];
|
|
65
69
|
for (const imp of imports) {
|
|
66
70
|
if (imp.kind === "import-statement" && imp.external) {
|
|
@@ -73,17 +77,27 @@ var phantomDependency_default = (api) => {
|
|
|
73
77
|
}
|
|
74
78
|
const phantomDeps = [];
|
|
75
79
|
for (const [source, files2] of importsBySource) {
|
|
76
|
-
if (source.startsWith("<"))
|
|
77
|
-
|
|
78
|
-
if (source.startsWith("
|
|
79
|
-
|
|
80
|
+
if (source.startsWith("<"))
|
|
81
|
+
continue;
|
|
82
|
+
if (source.startsWith("."))
|
|
83
|
+
continue;
|
|
84
|
+
if (source.startsWith("/"))
|
|
85
|
+
continue;
|
|
86
|
+
if (source.startsWith("@/") || source.startsWith("@@/"))
|
|
87
|
+
continue;
|
|
80
88
|
const pkgName = getPkgName(source);
|
|
81
|
-
if ((_a = api.config.phantomDependency.exclude) == null ? void 0 : _a.includes(pkgName))
|
|
82
|
-
|
|
83
|
-
if ((
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
|
|
89
|
+
if ((_a = api.config.phantomDependency.exclude) == null ? void 0 : _a.includes(pkgName))
|
|
90
|
+
continue;
|
|
91
|
+
if ((_b = api.pkg.dependencies) == null ? void 0 : _b[pkgName])
|
|
92
|
+
continue;
|
|
93
|
+
if ((_c = api.pkg.devDependencies) == null ? void 0 : _c[pkgName])
|
|
94
|
+
continue;
|
|
95
|
+
if ((_d = api.pkg.clientDependencies) == null ? void 0 : _d[pkgName])
|
|
96
|
+
continue;
|
|
97
|
+
if (matchAlias(source, api.config.alias || {}))
|
|
98
|
+
continue;
|
|
99
|
+
if (matchExternals(source, api.config.externals || {}))
|
|
100
|
+
continue;
|
|
87
101
|
phantomDeps.push(source);
|
|
88
102
|
import_utils.logger.error(
|
|
89
103
|
`[phantomDependency] ${import_utils.chalk.red(
|
|
@@ -104,7 +118,8 @@ var phantomDependency_default = (api) => {
|
|
|
104
118
|
});
|
|
105
119
|
function getPkgName(source) {
|
|
106
120
|
const arr = source.split("/");
|
|
107
|
-
if (source.startsWith("@"))
|
|
121
|
+
if (source.startsWith("@"))
|
|
122
|
+
return arr[0] + "/" + arr[1];
|
|
108
123
|
return arr[0];
|
|
109
124
|
}
|
|
110
125
|
function matchAlias(source, alias) {
|
|
@@ -53,10 +53,14 @@ async function resolve(context, path2) {
|
|
|
53
53
|
}
|
|
54
54
|
function sortByAffix(opts) {
|
|
55
55
|
return opts.keys.sort((a, b) => {
|
|
56
|
-
if (a.endsWith(opts.affix) && b.endsWith(opts.affix))
|
|
57
|
-
|
|
58
|
-
if (
|
|
59
|
-
|
|
56
|
+
if (a.endsWith(opts.affix) && b.endsWith(opts.affix))
|
|
57
|
+
return 0;
|
|
58
|
+
if (a.endsWith(opts.affix))
|
|
59
|
+
return -1;
|
|
60
|
+
if (b.endsWith(opts.affix))
|
|
61
|
+
return 1;
|
|
62
|
+
else
|
|
63
|
+
return 0;
|
|
60
64
|
});
|
|
61
65
|
}
|
|
62
66
|
function addSlashAffix(key) {
|
|
@@ -30,7 +30,8 @@ function getReactCompilerConfig(api) {
|
|
|
30
30
|
return api.userConfig.reactCompiler === true ? {} : api.userConfig.reactCompiler || {};
|
|
31
31
|
}
|
|
32
32
|
const forgetConfig = api.userConfig.forget;
|
|
33
|
-
if (forgetConfig === true)
|
|
33
|
+
if (forgetConfig === true)
|
|
34
|
+
return {};
|
|
34
35
|
return (forgetConfig == null ? void 0 : forgetConfig.ReactCompilerConfig) || {};
|
|
35
36
|
}
|
|
36
37
|
function resolveReactCompilerPlugin(api) {
|
|
@@ -55,7 +56,8 @@ var reactCompiler_default = (api) => {
|
|
|
55
56
|
}
|
|
56
57
|
},
|
|
57
58
|
enableBy: ({ userConfig }) => {
|
|
58
|
-
if (userConfig.reactCompiler === false)
|
|
59
|
+
if (userConfig.reactCompiler === false)
|
|
60
|
+
return false;
|
|
59
61
|
return "reactCompiler" in userConfig || "forget" in userConfig;
|
|
60
62
|
}
|
|
61
63
|
});
|
|
@@ -62,7 +62,8 @@ async function getRouteChunkFilesMap(chunks, opts) {
|
|
|
62
62
|
const pickPreloadFiles = (files) => files.filter((f) => f.endsWith(".js") || f.endsWith(".css"));
|
|
63
63
|
const routeFileResolveCache = {};
|
|
64
64
|
for (const chunk of chunks) {
|
|
65
|
-
if (chunk.entry)
|
|
65
|
+
if (chunk.entry)
|
|
66
|
+
continue;
|
|
66
67
|
const pickedFiles = pickPreloadFiles(chunk.files);
|
|
67
68
|
const routeOrigins = (chunk.origins || []).filter(
|
|
68
69
|
(origin) => {
|
|
@@ -104,7 +105,8 @@ async function getRoutePathFilesMap(routes, fileChunksMap, opts) {
|
|
|
104
105
|
const { resolver, absPagesPath } = opts;
|
|
105
106
|
const routeFilesMap = {};
|
|
106
107
|
for (const route of Object.values(routes)) {
|
|
107
|
-
if (!route.file)
|
|
108
|
+
if (!route.file)
|
|
109
|
+
continue;
|
|
108
110
|
if (!((_a = route.absPath) == null ? void 0 : _a.startsWith("/"))) {
|
|
109
111
|
import_utils.logger.error(
|
|
110
112
|
`[routePreloadOnLoad]: route absPath error, cannot preload for ${route.absPath}`
|
|
@@ -38,7 +38,7 @@ function hashString(str) {
|
|
|
38
38
|
return hash;
|
|
39
39
|
}
|
|
40
40
|
function getClassNames(code, filename) {
|
|
41
|
-
const { exports
|
|
41
|
+
const { exports } = import_parcelCSS.parcelCSS.transform({
|
|
42
42
|
filename,
|
|
43
43
|
code,
|
|
44
44
|
minify: false,
|
|
@@ -48,7 +48,7 @@ function getClassNames(code, filename) {
|
|
|
48
48
|
dashedIdents: false
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
-
return Object.keys(
|
|
51
|
+
return Object.keys(exports || {});
|
|
52
52
|
}
|
|
53
53
|
function cssLoader(opts) {
|
|
54
54
|
return {
|
|
@@ -32,7 +32,7 @@ __export(mako_exports, {
|
|
|
32
32
|
build: () => build
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(mako_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_bundler_webpack = require("@umijs/bundler-webpack");
|
|
36
36
|
var import_utils = require("@umijs/utils");
|
|
37
37
|
var import_lodash = require("@umijs/utils/compiled/lodash");
|
|
38
38
|
var import_fs = require("fs");
|
|
@@ -44,7 +44,7 @@ var build = async (api) => {
|
|
|
44
44
|
const absOutputFile = (0, import_utils2.absServerBuildPath)(api);
|
|
45
45
|
require("@umijs/bundler-webpack/dist/requireHook");
|
|
46
46
|
const { build: build2 } = require(process.env.OKAM);
|
|
47
|
-
const useHash = api.config.hash && api.env ===
|
|
47
|
+
const useHash = api.config.hash && api.env === import_bundler_webpack.Env.production;
|
|
48
48
|
const publicPath = api.userConfig.publicPath || "/";
|
|
49
49
|
const entry = import_path.default.resolve(api.paths.absTmpPath, "umi.server.ts");
|
|
50
50
|
const options = {
|
package/dist/features/ssr/ssr.js
CHANGED
|
@@ -32,7 +32,7 @@ __export(ssr_exports, {
|
|
|
32
32
|
default: () => ssr_default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(ssr_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_core = require("@umijs/core");
|
|
36
36
|
var import_utils = require("@umijs/utils");
|
|
37
37
|
var import_assert = __toESM(require("assert"));
|
|
38
38
|
var import_fs = require("fs");
|
|
@@ -70,7 +70,7 @@ var ssr_default = (api) => {
|
|
|
70
70
|
}).deepPartial();
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
|
-
enableBy:
|
|
73
|
+
enableBy: import_core.EnableBy.config
|
|
74
74
|
});
|
|
75
75
|
api.onCheck(() => {
|
|
76
76
|
const reactVersion = parseInt(api.appData.react.version.split(".")[0], 10) || 0;
|
|
@@ -219,7 +219,8 @@ export type {
|
|
|
219
219
|
}
|
|
220
220
|
});
|
|
221
221
|
api.onBuildComplete(async ({ err }) => {
|
|
222
|
-
if (err)
|
|
222
|
+
if (err)
|
|
223
|
+
return;
|
|
223
224
|
if (api.config.ssr.platform === "vercel") {
|
|
224
225
|
const jsonFile = (0, import_path.join)(api.cwd, "vercel.json");
|
|
225
226
|
const json = (0, import_fs.existsSync)(jsonFile) ? import_utils.fsExtra.readJSONSync(jsonFile) : {};
|