@umijs/preset-umi 4.7.1 → 4.7.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.
- package/dist/commands/dev/dev.js +17 -7
- package/dist/commands/dev/watch.d.ts +4 -0
- package/dist/commands/dev/watch.js +9 -0
- package/dist/types.d.ts +7 -3
- package/package.json +15 -15
package/dist/commands/dev/dev.js
CHANGED
|
@@ -123,15 +123,25 @@ PORT=8888 umi dev
|
|
|
123
123
|
...(0, import_watch.expandCSSPaths)((0, import_path.join)(absSrcPath, "overrides"))
|
|
124
124
|
].filter(Boolean)
|
|
125
125
|
});
|
|
126
|
-
import_utils.lodash.
|
|
126
|
+
import_utils.lodash.uniqBy(
|
|
127
|
+
watcherPaths.map((watcher) => {
|
|
128
|
+
const normalized = typeof watcher === "string" ? { path: watcher } : watcher;
|
|
129
|
+
return { ...normalized, path: (0, import_utils.winPath)(normalized.path) };
|
|
130
|
+
}),
|
|
131
|
+
({ events, path }) => `${path}:${events ? [...events].sort().join(",") : "*"}`
|
|
132
|
+
).forEach(({ events, path: watcherPath }) => {
|
|
133
|
+
const onChange = (0, import_watch.createDebouncedHandler)({
|
|
134
|
+
timeout: 2e3,
|
|
135
|
+
async onChange(opts2) {
|
|
136
|
+
await generate({ files: opts2.files, isFirstTime: false });
|
|
137
|
+
}
|
|
138
|
+
});
|
|
127
139
|
(0, import_watch.watch)({
|
|
128
|
-
path:
|
|
140
|
+
path: watcherPath,
|
|
129
141
|
addToUnWatches: true,
|
|
130
|
-
onChange: (0, import_watch.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
await generate({ files: opts2.files, isFirstTime: false });
|
|
134
|
-
}
|
|
142
|
+
onChange: (0, import_watch.createEventFilteredHandler)({
|
|
143
|
+
events,
|
|
144
|
+
onChange
|
|
135
145
|
})
|
|
136
146
|
});
|
|
137
147
|
});
|
|
@@ -6,6 +6,10 @@ export declare function watch(opts: {
|
|
|
6
6
|
addToUnWatches?: boolean;
|
|
7
7
|
onChange: (event: string, path: string) => void;
|
|
8
8
|
}): chokidar.FSWatcher;
|
|
9
|
+
export declare function createEventFilteredHandler(opts: {
|
|
10
|
+
events?: ReadonlyArray<string>;
|
|
11
|
+
onChange: (event: string, path: string) => void;
|
|
12
|
+
}): (event: string, path: string) => void;
|
|
9
13
|
export declare function createDebouncedHandler(opts: {
|
|
10
14
|
timeout?: number;
|
|
11
15
|
onChange: (opts: {
|
|
@@ -21,6 +21,7 @@ var watch_exports = {};
|
|
|
21
21
|
__export(watch_exports, {
|
|
22
22
|
addUnWatch: () => addUnWatch,
|
|
23
23
|
createDebouncedHandler: () => createDebouncedHandler,
|
|
24
|
+
createEventFilteredHandler: () => createEventFilteredHandler,
|
|
24
25
|
expandCSSPaths: () => expandCSSPaths,
|
|
25
26
|
expandJSPaths: () => expandJSPaths,
|
|
26
27
|
unwatch: () => unwatch,
|
|
@@ -45,6 +46,13 @@ function watch(opts) {
|
|
|
45
46
|
}
|
|
46
47
|
return watcher;
|
|
47
48
|
}
|
|
49
|
+
function createEventFilteredHandler(opts) {
|
|
50
|
+
return (event, path) => {
|
|
51
|
+
if (!opts.events || opts.events.includes(event)) {
|
|
52
|
+
opts.onChange(event, path);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
48
56
|
function createDebouncedHandler(opts) {
|
|
49
57
|
let timer = null;
|
|
50
58
|
let files = [];
|
|
@@ -77,6 +85,7 @@ function expandCSSPaths(path) {
|
|
|
77
85
|
0 && (module.exports = {
|
|
78
86
|
addUnWatch,
|
|
79
87
|
createDebouncedHandler,
|
|
88
|
+
createEventFilteredHandler,
|
|
80
89
|
expandCSSPaths,
|
|
81
90
|
expandJSPaths,
|
|
82
91
|
unwatch,
|
package/dist/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { BuildResult as ESBuildBuildResult, Plugin as ESBuildPlugin } from
|
|
|
3
3
|
import type { Express, IConfig, RequestHandler, webpack } from '@umijs/bundler-webpack';
|
|
4
4
|
import type WebpackChain from '@umijs/bundler-webpack/compiled/webpack-5-chain';
|
|
5
5
|
import { createWebSocketServer } from '@umijs/bundler-webpack/dist/server/ws';
|
|
6
|
-
import type { IAdd,
|
|
6
|
+
import type { IAdd, IRoute as ICoreRoute, IEvent, IModify, IServicePluginAPI, PluginAPI } from '@umijs/core';
|
|
7
7
|
import { Env } from '@umijs/core';
|
|
8
8
|
import type { getMarkup } from '@umijs/server';
|
|
9
9
|
import type { CheerioAPI } from '@umijs/utils/compiled/cheerio';
|
|
@@ -13,7 +13,7 @@ import type { IOnDemandInstallDep } from './features/depsOnDemand/depsOnDemand';
|
|
|
13
13
|
import type CodeFrameError from './features/transform/CodeFrameError';
|
|
14
14
|
export type { IUtoopackUserConfig } from '@umijs/bundler-utoopack';
|
|
15
15
|
export { UmiApiRequest, UmiApiResponse } from './features/apiRoute';
|
|
16
|
-
export {
|
|
16
|
+
export { IConfig, webpack };
|
|
17
17
|
export type IScript = Partial<{
|
|
18
18
|
async: boolean;
|
|
19
19
|
charset: string;
|
|
@@ -63,6 +63,10 @@ export type IFileInfo = Array<{
|
|
|
63
63
|
event: string;
|
|
64
64
|
path: string;
|
|
65
65
|
}>;
|
|
66
|
+
export interface ITmpGenerateWatcher {
|
|
67
|
+
path: string;
|
|
68
|
+
events?: string[];
|
|
69
|
+
}
|
|
66
70
|
export interface IOnGenerateFiles {
|
|
67
71
|
files?: IFileInfo | null;
|
|
68
72
|
isFirstTime?: boolean;
|
|
@@ -127,7 +131,7 @@ export type IApi = PluginAPI & IServicePluginAPI & {
|
|
|
127
131
|
addPrepareBuildPlugins: IAdd<null, ESBuildPlugin>;
|
|
128
132
|
addRuntimePlugin: IAdd<null, string>;
|
|
129
133
|
addRuntimePluginKey: IAdd<null, string>;
|
|
130
|
-
addTmpGenerateWatcherPaths: IAdd<null, string>;
|
|
134
|
+
addTmpGenerateWatcherPaths: IAdd<null, string | ITmpGenerateWatcher>;
|
|
131
135
|
addUIModules: IAdd<null, IUIModule[]>;
|
|
132
136
|
chainWebpack: {
|
|
133
137
|
(fn: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/preset-umi",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.2",
|
|
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",
|
|
@@ -43,21 +43,21 @@
|
|
|
43
43
|
"react-router": "6.3.0",
|
|
44
44
|
"react-router-dom": "6.3.0",
|
|
45
45
|
"regenerator-runtime": "0.13.11",
|
|
46
|
-
"@umijs/ast": "4.7.
|
|
47
|
-
"@umijs/bundler-esbuild": "4.7.
|
|
48
|
-
"@umijs/bundler-utils": "4.7.
|
|
49
|
-
"@umijs/bundler-utoopack": "4.7.
|
|
50
|
-
"@umijs/bundler-
|
|
51
|
-
"@umijs/babel-preset-umi": "4.7.
|
|
52
|
-
"@umijs/bundler-
|
|
53
|
-
"@umijs/
|
|
54
|
-
"@umijs/mfsu": "4.7.
|
|
55
|
-
"@umijs/
|
|
56
|
-
"@umijs/server": "4.7.
|
|
46
|
+
"@umijs/ast": "4.7.2",
|
|
47
|
+
"@umijs/bundler-esbuild": "4.7.2",
|
|
48
|
+
"@umijs/bundler-utils": "4.7.2",
|
|
49
|
+
"@umijs/bundler-utoopack": "4.7.2",
|
|
50
|
+
"@umijs/bundler-vite": "4.7.2",
|
|
51
|
+
"@umijs/babel-preset-umi": "4.7.2",
|
|
52
|
+
"@umijs/bundler-webpack": "4.7.2",
|
|
53
|
+
"@umijs/plugin-run": "4.7.2",
|
|
54
|
+
"@umijs/mfsu": "4.7.2",
|
|
55
|
+
"@umijs/renderer-react": "4.7.2",
|
|
56
|
+
"@umijs/server": "4.7.2",
|
|
57
57
|
"@umijs/ui": "3.0.1",
|
|
58
|
-
"@umijs/
|
|
59
|
-
"@umijs/utils": "4.7.
|
|
60
|
-
"@umijs/zod2ts": "4.7.
|
|
58
|
+
"@umijs/core": "4.7.2",
|
|
59
|
+
"@umijs/utils": "4.7.2",
|
|
60
|
+
"@umijs/zod2ts": "4.7.2"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@manypkg/get-packages": "1.1.3",
|