@umijs/preset-umi 4.0.85 → 4.0.87
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.js +1 -2
- package/dist/commands/config/config.js +0 -2
- package/dist/commands/deadcode.js +0 -2
- package/dist/commands/dev/depBuildWorker/depBuilder.js +2 -2
- package/dist/commands/dev/depBuildWorker/dev-config.js +0 -2
- package/dist/commands/dev/depBuildWorker/workerPreset.js +0 -2
- package/dist/commands/dev/dev.js +1 -2
- package/dist/commands/dev/plugins/ViteHtmlPlugin.js +0 -2
- package/dist/commands/generators/cypress.js +0 -2
- package/dist/commands/generators/dva.js +0 -2
- package/dist/commands/generators/jest.js +0 -2
- package/dist/commands/generators/mock.js +0 -2
- package/dist/commands/generators/precommit.js +0 -2
- package/dist/commands/generators/prettier.js +0 -2
- package/dist/commands/generators/tailwindcss.js +0 -2
- package/dist/commands/generators/tsconfig.js +0 -2
- package/dist/commands/help.js +0 -2
- package/dist/commands/lint.js +0 -2
- package/dist/commands/mfsu/mfsu.js +0 -2
- package/dist/commands/plugin.js +0 -2
- package/dist/commands/preview.js +0 -2
- package/dist/commands/setup.js +0 -2
- package/dist/commands/verify-commit.js +0 -2
- package/dist/commands/version.js +0 -2
- package/dist/features/__sample.js +0 -2
- package/dist/features/apiRoute/apiRoute.js +0 -2
- package/dist/features/apiRoute/dev-server/esbuild.js +0 -2
- package/dist/features/apiRoute/response.js +0 -2
- package/dist/features/apiRoute/vercel/esbuild.js +0 -2
- package/dist/features/appData/appData.js +0 -2
- package/dist/features/appData/umiInfo.js +0 -2
- package/dist/features/check/babel722.js +0 -2
- package/dist/features/check/check.js +0 -2
- package/dist/features/classPropertiesLoose/classPropertiesLoose.js +0 -2
- package/dist/features/clickToComponent/clickToComponent.js +0 -2
- package/dist/features/clientLoader/clientLoader.js +0 -2
- package/dist/features/codeSplitting/codeSplitting.js +0 -2
- package/dist/features/crossorigin/crossorigin.js +0 -2
- package/dist/features/esmi/Service.js +2 -4
- package/dist/features/esmi/esbuildPlugins/requireToImport.js +0 -2
- package/dist/features/esmi/esbuildPlugins/topLevelExternal.js +0 -2
- package/dist/features/esmi/esmi.js +0 -2
- package/dist/features/favicons/favicons.js +0 -2
- package/dist/features/helmet/helmet.js +0 -2
- package/dist/features/hmrGuardian/hmrGuardian.js +0 -2
- package/dist/features/icons/icons.js +0 -2
- package/dist/features/legacy/legacy.js +0 -2
- package/dist/features/lowImport/babelPlugin.js +0 -2
- package/dist/features/lowImport/lowImport.js +0 -2
- package/dist/features/mock/mock.js +0 -2
- package/dist/features/mpa/mpa.js +2 -4
- package/dist/features/overrides/compileLess.d.ts +1 -0
- package/dist/features/overrides/compileLess.js +52 -0
- package/dist/features/overrides/compileLess.manullytest.d.ts +1 -0
- package/dist/features/overrides/compileLess.manullytest.js +62 -0
- package/dist/features/overrides/overrides.js +36 -25
- package/dist/features/overrides/transform.d.ts +1 -0
- package/dist/features/overrides/transform.js +86 -0
- package/dist/features/phantomDependency/phantomDependency.js +0 -2
- package/dist/features/polyfill/polyfill.js +0 -2
- package/dist/features/polyfill/publicPathPolyfill.js +0 -2
- package/dist/features/prepare/prepare.js +0 -2
- package/dist/features/routePrefetch/routePrefetch.js +0 -2
- package/dist/features/routeProps/routeProps.js +0 -2
- package/dist/features/ssr/builder/builder.js +2 -2
- package/dist/features/ssr/builder/svg-loader.js +0 -2
- package/dist/features/ssr/ssr.js +0 -3
- package/dist/features/swc/swc.js +0 -2
- package/dist/features/terminal/terminal.js +0 -2
- package/dist/features/test/test.js +0 -2
- package/dist/features/tmpFiles/configTypes.js +0 -2
- package/dist/features/tmpFiles/tmpFiles.js +1 -6
- package/dist/features/transform/CodeFrameError.js +0 -2
- package/dist/features/transform/babelPlugin.js +0 -2
- package/dist/features/transform/transform.js +0 -2
- package/dist/features/ui/ui.js +0 -2
- package/dist/features/vite/vite.js +0 -2
- package/dist/features/webpack/webpack.js +0 -2
- package/dist/registerMethods.js +0 -2
- package/package.json +17 -15
package/dist/commands/build.js
CHANGED
|
@@ -131,6 +131,7 @@ umi build --clean
|
|
|
131
131
|
if (api.config.vite) {
|
|
132
132
|
stats = await bundlerVite.build(opts);
|
|
133
133
|
} else if (process.env.OKAM) {
|
|
134
|
+
require("@umijs/bundler-webpack/dist/requireHook");
|
|
134
135
|
const { build } = require(process.env.OKAM);
|
|
135
136
|
stats = await build(opts);
|
|
136
137
|
} else {
|
|
@@ -192,5 +193,3 @@ umi build --clean
|
|
|
192
193
|
}
|
|
193
194
|
});
|
|
194
195
|
};
|
|
195
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
196
|
-
0 && (module.exports = {});
|
|
@@ -85,7 +85,7 @@ var DepBuilderInWorker = class {
|
|
|
85
85
|
const tmpDir = this.opts.tmpBase;
|
|
86
86
|
const entryPath = (0, import_path.join)(tmpDir, ENTRY_FILE);
|
|
87
87
|
(0, import_fs.writeFileSync)(entryPath, entryContent, "utf-8");
|
|
88
|
-
const date = new Date().getTime();
|
|
88
|
+
const date = (/* @__PURE__ */ new Date()).getTime();
|
|
89
89
|
await (0, import_bundler_esbuild.build)({
|
|
90
90
|
cwd: this.opts.cwd,
|
|
91
91
|
entry: {
|
|
@@ -100,7 +100,7 @@ var DepBuilderInWorker = class {
|
|
|
100
100
|
inlineStyle: true
|
|
101
101
|
});
|
|
102
102
|
import_utils.logger.event(
|
|
103
|
-
`[mfsu] compiled with esbuild successfully in ${
|
|
103
|
+
`[mfsu] compiled with esbuild successfully in ${+/* @__PURE__ */ new Date() - date} ms`
|
|
104
104
|
);
|
|
105
105
|
opts.onBuildComplete();
|
|
106
106
|
}
|
package/dist/commands/dev/dev.js
CHANGED
|
@@ -380,6 +380,7 @@ PORT=8888 umi dev
|
|
|
380
380
|
if (enableVite) {
|
|
381
381
|
await bundlerVite.dev(opts);
|
|
382
382
|
} else if (process.env.OKAM) {
|
|
383
|
+
require("@umijs/bundler-webpack/dist/requireHook");
|
|
383
384
|
const { dev } = require(process.env.OKAM);
|
|
384
385
|
await dev(opts);
|
|
385
386
|
} else {
|
|
@@ -415,5 +416,3 @@ PORT=8888 umi dev
|
|
|
415
416
|
return viteConfig;
|
|
416
417
|
});
|
|
417
418
|
};
|
|
418
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
419
|
-
0 && (module.exports = {});
|
package/dist/commands/help.js
CHANGED
package/dist/commands/lint.js
CHANGED
package/dist/commands/plugin.js
CHANGED
package/dist/commands/preview.js
CHANGED
package/dist/commands/setup.js
CHANGED
package/dist/commands/version.js
CHANGED
|
@@ -104,7 +104,7 @@ var ESMIService = class {
|
|
|
104
104
|
async getImportmap(data) {
|
|
105
105
|
const cacheKey = ESMIService.getCacheKey(data);
|
|
106
106
|
const cache = this.getCache(cacheKey);
|
|
107
|
-
const stamp =
|
|
107
|
+
const stamp = +/* @__PURE__ */ new Date();
|
|
108
108
|
if (cache) {
|
|
109
109
|
import_utils.logger.info("ESMi cache used");
|
|
110
110
|
return cache;
|
|
@@ -125,7 +125,7 @@ var ESMIService = class {
|
|
|
125
125
|
if (res.data.success) {
|
|
126
126
|
this.setCache(cacheKey, res.data.data);
|
|
127
127
|
import_utils.logger.info(
|
|
128
|
-
`Done, took ${((
|
|
128
|
+
`Done, took ${((+/* @__PURE__ */ new Date() - stamp) / 1e3).toFixed(1)}s`
|
|
129
129
|
);
|
|
130
130
|
return res.data.data;
|
|
131
131
|
}
|
|
@@ -135,5 +135,3 @@ var ESMIService = class {
|
|
|
135
135
|
return deferrer();
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
139
|
-
0 && (module.exports = {});
|
package/dist/features/mpa/mpa.js
CHANGED
|
@@ -131,10 +131,10 @@ ${renderer}
|
|
|
131
131
|
});
|
|
132
132
|
};
|
|
133
133
|
async function collectEntryWithTimeCount(root, opts, mountElementId) {
|
|
134
|
-
const d = new Date();
|
|
134
|
+
const d = /* @__PURE__ */ new Date();
|
|
135
135
|
const entries = await collectEntry(root, opts, mountElementId);
|
|
136
136
|
import_utils.logger.info(
|
|
137
|
-
`[MPA] Collect Entries in ${new Date().getTime() - d.getTime()}ms`
|
|
137
|
+
`[MPA] Collect Entries in ${(/* @__PURE__ */ new Date()).getTime() - d.getTime()}ms`
|
|
138
138
|
);
|
|
139
139
|
return entries;
|
|
140
140
|
}
|
|
@@ -226,5 +226,3 @@ function checkConfig(config) {
|
|
|
226
226
|
(0, import_assert.default)(Array.isArray(config.scripts), "scripts must be string");
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
230
|
-
0 && (module.exports = {});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function compileLess(lessContent: string, filePath: string, modifyVars?: Record<string, string>, alias?: Record<string, string>): Promise<string>;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 });
|
|
10
|
+
};
|
|
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(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/features/overrides/compileLess.ts
|
|
30
|
+
var compileLess_exports = {};
|
|
31
|
+
__export(compileLess_exports, {
|
|
32
|
+
compileLess: () => compileLess
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(compileLess_exports);
|
|
35
|
+
var import_less = __toESM(require("@umijs/bundler-utils/compiled/less"));
|
|
36
|
+
async function compileLess(lessContent, filePath, modifyVars = {}, alias = {}) {
|
|
37
|
+
const result = await import_less.default.render(lessContent, {
|
|
38
|
+
filename: filePath,
|
|
39
|
+
plugins: [
|
|
40
|
+
new (require("less-plugin-resolve"))({
|
|
41
|
+
aliases: alias
|
|
42
|
+
})
|
|
43
|
+
],
|
|
44
|
+
javascriptEnabled: true,
|
|
45
|
+
modifyVars
|
|
46
|
+
});
|
|
47
|
+
return result.css;
|
|
48
|
+
}
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
compileLess
|
|
52
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from))
|
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
|
|
24
|
+
// src/features/overrides/compileLess.manullytest.ts
|
|
25
|
+
var import_assert = __toESM(require("assert"));
|
|
26
|
+
var import_fs = __toESM(require("fs"));
|
|
27
|
+
var import_path = require("path");
|
|
28
|
+
var import_compileLess = require("./compileLess");
|
|
29
|
+
var fixturesDir = (0, import_path.join)(__dirname, "../../../fixtures");
|
|
30
|
+
(async () => {
|
|
31
|
+
const filePath = (0, import_path.join)(fixturesDir, "overrides/less/index.less");
|
|
32
|
+
const modifyVars = {
|
|
33
|
+
"primary-color": "#1DA57A"
|
|
34
|
+
};
|
|
35
|
+
const alias = {
|
|
36
|
+
barbar: (0, import_path.join)(filePath, "../node_modules/bar")
|
|
37
|
+
};
|
|
38
|
+
const result = await (0, import_compileLess.compileLess)(
|
|
39
|
+
import_fs.default.readFileSync(filePath, "utf-8"),
|
|
40
|
+
filePath,
|
|
41
|
+
modifyVars,
|
|
42
|
+
alias
|
|
43
|
+
);
|
|
44
|
+
(0, import_assert.default)(
|
|
45
|
+
result.includes(
|
|
46
|
+
`
|
|
47
|
+
.bar {
|
|
48
|
+
color: red;
|
|
49
|
+
}
|
|
50
|
+
.foo {
|
|
51
|
+
color: red;
|
|
52
|
+
}
|
|
53
|
+
.a {
|
|
54
|
+
aaa: green;
|
|
55
|
+
bbb: #1DA57A;
|
|
56
|
+
}
|
|
57
|
+
`.trim()
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
})().catch((e) => {
|
|
61
|
+
console.error(e);
|
|
62
|
+
});
|
|
@@ -23,39 +23,50 @@ __export(overrides_exports, {
|
|
|
23
23
|
getOverridesCSS: () => getOverridesCSS
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(overrides_exports);
|
|
26
|
-
var import_utils = require("@umijs/utils");
|
|
27
26
|
var import_fs = require("fs");
|
|
28
27
|
var import_path = require("path");
|
|
29
28
|
var import_watch = require("../../commands/dev/watch");
|
|
29
|
+
var import_compileLess = require("./compileLess");
|
|
30
|
+
var import_transform = require("./transform");
|
|
30
31
|
function getOverridesCSS(absSrcPath) {
|
|
31
32
|
return (0, import_watch.expandCSSPaths)((0, import_path.join)(absSrcPath, "overrides")).find(import_fs.existsSync);
|
|
32
33
|
}
|
|
33
34
|
var overrides_default = (api) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
35
|
+
let cachedContent = null;
|
|
36
|
+
api.onGenerateFiles(async () => {
|
|
37
|
+
var _a;
|
|
38
|
+
if (api.appData.overridesCSS.length) {
|
|
39
|
+
const filePath = api.appData.overridesCSS[0];
|
|
40
|
+
let content = (0, import_fs.readFileSync)(filePath, "utf-8");
|
|
41
|
+
if (content === cachedContent)
|
|
42
|
+
return;
|
|
43
|
+
const isLess = filePath.endsWith(".less");
|
|
44
|
+
if (isLess) {
|
|
45
|
+
content = await (0, import_compileLess.compileLess)(
|
|
46
|
+
content,
|
|
47
|
+
filePath,
|
|
48
|
+
{
|
|
49
|
+
...api.config.theme,
|
|
50
|
+
...(_a = api.config.lessLoader) == null ? void 0 : _a.modifyVars
|
|
51
|
+
},
|
|
52
|
+
api.config.alias
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
content = await (0, import_transform.transform)(content, filePath);
|
|
56
|
+
api.writeTmpFile({
|
|
57
|
+
path: "core/overrides.css",
|
|
58
|
+
content,
|
|
59
|
+
noPluginDir: true
|
|
60
|
+
});
|
|
61
|
+
cachedContent = content;
|
|
57
62
|
}
|
|
58
|
-
|
|
63
|
+
});
|
|
64
|
+
api.addEntryImports(() => {
|
|
65
|
+
return [
|
|
66
|
+
api.appData.overridesCSS.length && {
|
|
67
|
+
source: "@@/core/overrides.css"
|
|
68
|
+
}
|
|
69
|
+
].filter(Boolean);
|
|
59
70
|
});
|
|
60
71
|
};
|
|
61
72
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function transform(cssContent: string, filePath: string): Promise<any>;
|
|
@@ -0,0 +1,86 @@
|
|
|
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 });
|
|
10
|
+
};
|
|
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(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/features/overrides/transform.ts
|
|
30
|
+
var transform_exports = {};
|
|
31
|
+
__export(transform_exports, {
|
|
32
|
+
transform: () => transform
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(transform_exports);
|
|
35
|
+
var import_utils = require("@umijs/utils");
|
|
36
|
+
var import_fs = __toESM(require("fs"));
|
|
37
|
+
var import_path = __toESM(require("path"));
|
|
38
|
+
async function transform(cssContent, filePath) {
|
|
39
|
+
const importPlugin = {
|
|
40
|
+
postcssPlugin: "importPlugin",
|
|
41
|
+
AtRule: {
|
|
42
|
+
import(atRule) {
|
|
43
|
+
let origin = atRule.params;
|
|
44
|
+
origin = origin.replace(/^url\((.+)\)$/g, "$1");
|
|
45
|
+
origin = origin.replace(/^'(.+)'$/g, "$1").replace(/^"(.+)"$/g, "$1");
|
|
46
|
+
if (origin.startsWith("~"))
|
|
47
|
+
return;
|
|
48
|
+
if (origin.startsWith("/"))
|
|
49
|
+
return;
|
|
50
|
+
function getResolvedPath(origin2) {
|
|
51
|
+
return (0, import_utils.winPath)(import_path.default.resolve(import_path.default.dirname(filePath), origin2));
|
|
52
|
+
}
|
|
53
|
+
const resolvedPath = getResolvedPath(origin);
|
|
54
|
+
if (import_fs.default.existsSync(resolvedPath)) {
|
|
55
|
+
atRule.params = `"${resolvedPath}"`;
|
|
56
|
+
} else {
|
|
57
|
+
if (origin.startsWith("./") || origin.startsWith("../")) {
|
|
58
|
+
console.warn(`File does not exist: ${resolvedPath}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const selectorPlugin = require("postcss-prefix-selector")({
|
|
65
|
+
// why not #root?
|
|
66
|
+
// antd will insert dom into body, prefix #root will not work for that
|
|
67
|
+
prefix: "body",
|
|
68
|
+
transform(_p, selector, prefixedSelector) {
|
|
69
|
+
if (selector === "html") {
|
|
70
|
+
return `html:first-child`;
|
|
71
|
+
} else if (/^body([\s+~>[:]|$)/.test(selector)) {
|
|
72
|
+
return `html ${selector}`;
|
|
73
|
+
}
|
|
74
|
+
return prefixedSelector;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const result = await require("postcss")([
|
|
78
|
+
selectorPlugin,
|
|
79
|
+
importPlugin
|
|
80
|
+
]).process(cssContent, {});
|
|
81
|
+
return result.css;
|
|
82
|
+
}
|
|
83
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
+
0 && (module.exports = {
|
|
85
|
+
transform
|
|
86
|
+
});
|
|
@@ -45,7 +45,7 @@ var import_svg_loader = __toESM(require("./svg-loader"));
|
|
|
45
45
|
async function build(opts) {
|
|
46
46
|
const { api, watch } = opts;
|
|
47
47
|
import_utils.logger.wait("[SSR] Compiling...");
|
|
48
|
-
const now = new Date().getTime();
|
|
48
|
+
const now = (/* @__PURE__ */ new Date()).getTime();
|
|
49
49
|
function getExternal() {
|
|
50
50
|
if ((0, import_utils.isMonorepo)({ root: api.paths.cwd })) {
|
|
51
51
|
return [];
|
|
@@ -92,7 +92,7 @@ async function build(opts) {
|
|
|
92
92
|
} else {
|
|
93
93
|
await import_esbuild.default.build(buildOptions);
|
|
94
94
|
}
|
|
95
|
-
const diff = new Date().getTime() - now;
|
|
95
|
+
const diff = (/* @__PURE__ */ new Date()).getTime() - now;
|
|
96
96
|
import_utils.logger.info(`[SSR] Compiled in ${diff}ms`);
|
|
97
97
|
}
|
|
98
98
|
var loader = {
|
package/dist/features/ssr/ssr.js
CHANGED
|
@@ -154,9 +154,6 @@ export default function handler(request, response) {
|
|
|
154
154
|
import_utils.logger.info(`[SSR] write api/umi.server.js`);
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
|
-
api.onBuildHtmlComplete(() => {
|
|
158
|
-
import_utils.fsExtra.copyFileSync((0, import_path.join)(api.paths.absOutputPath, "index.html"), (0, import_path.join)(api.paths.absOutputPath, "*.html"));
|
|
159
|
-
});
|
|
160
157
|
const pluginName = "ProcessAssetsPlugin";
|
|
161
158
|
class ProcessAssetsPlugin {
|
|
162
159
|
apply(compiler) {
|
package/dist/features/swc/swc.js
CHANGED
|
@@ -307,12 +307,7 @@ declare module '*.txt' {
|
|
|
307
307
|
imports: (0, import_importsToStr.importsToStr)(
|
|
308
308
|
await api.applyPlugins({
|
|
309
309
|
key: "addEntryImports",
|
|
310
|
-
initialValue: [
|
|
311
|
-
// append overrides.{ext} style file
|
|
312
|
-
api.appData.overridesCSS.length && {
|
|
313
|
-
source: api.appData.overridesCSS[0]
|
|
314
|
-
}
|
|
315
|
-
].filter(Boolean)
|
|
310
|
+
initialValue: []
|
|
316
311
|
})
|
|
317
312
|
).join("\n"),
|
|
318
313
|
basename: api.config.base,
|
package/dist/features/ui/ui.js
CHANGED
package/dist/registerMethods.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/preset-umi",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.87",
|
|
4
4
|
"description": "@umijs/preset-umi",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/preset-umi#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -30,28 +30,30 @@
|
|
|
30
30
|
"enhanced-resolve": "5.9.3",
|
|
31
31
|
"fast-glob": "3.2.12",
|
|
32
32
|
"html-webpack-plugin": "5.5.0",
|
|
33
|
+
"less-plugin-resolve": "1.0.0",
|
|
33
34
|
"path-to-regexp": "1.7.0",
|
|
35
|
+
"postcss": "^8.4.21",
|
|
34
36
|
"postcss-prefix-selector": "1.16.0",
|
|
35
37
|
"react": "18.1.0",
|
|
36
38
|
"react-dom": "18.1.0",
|
|
37
39
|
"react-router": "6.3.0",
|
|
38
40
|
"react-router-dom": "6.3.0",
|
|
39
41
|
"regenerator-runtime": "0.13.11",
|
|
40
|
-
"@umijs/ast": "4.0.
|
|
41
|
-
"@umijs/bundler-
|
|
42
|
-
"@umijs/bundler-
|
|
43
|
-
"@umijs/
|
|
44
|
-
"@umijs/
|
|
45
|
-
"@umijs/
|
|
46
|
-
"@umijs/
|
|
47
|
-
"@umijs/
|
|
48
|
-
"@umijs/
|
|
49
|
-
"@umijs/server": "4.0.85",
|
|
50
|
-
"@umijs/renderer-react": "4.0.85",
|
|
42
|
+
"@umijs/ast": "4.0.87",
|
|
43
|
+
"@umijs/bundler-utils": "4.0.87",
|
|
44
|
+
"@umijs/bundler-vite": "4.0.87",
|
|
45
|
+
"@umijs/did-you-know": "1.0.3",
|
|
46
|
+
"@umijs/core": "4.0.87",
|
|
47
|
+
"@umijs/bundler-esbuild": "4.0.87",
|
|
48
|
+
"@umijs/babel-preset-umi": "4.0.87",
|
|
49
|
+
"@umijs/mfsu": "4.0.87",
|
|
50
|
+
"@umijs/bundler-webpack": "4.0.87",
|
|
51
51
|
"@umijs/ui": "3.0.1",
|
|
52
|
-
"@umijs/
|
|
53
|
-
"@umijs/
|
|
54
|
-
"@umijs/
|
|
52
|
+
"@umijs/renderer-react": "4.0.87",
|
|
53
|
+
"@umijs/utils": "4.0.87",
|
|
54
|
+
"@umijs/server": "4.0.87",
|
|
55
|
+
"@umijs/zod2ts": "4.0.87",
|
|
56
|
+
"@umijs/plugin-run": "4.0.87"
|
|
55
57
|
},
|
|
56
58
|
"devDependencies": {
|
|
57
59
|
"@manypkg/get-packages": "1.1.3",
|