@umijs/plugins 4.2.4 → 4.2.6-alpha.0
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/initial-state.js +1 -1
- package/dist/layout.js +8 -2
- package/dist/qiankun/master.js +10 -0
- package/dist/qiankun/slave.js +12 -6
- package/dist/react-query.js +55 -135
- package/libs/qiankun/master/MicroApp.tsx +6 -9
- package/libs/qiankun/master/masterRuntimePlugin.tsx +8 -0
- package/libs/qiankun/slave/slaveRuntimePlugin.ts +4 -0
- package/package.json +3 -3
- package/dist/utils/npmClient.d.ts +0 -2
- package/dist/utils/npmClient.js +0 -45
package/dist/initial-state.js
CHANGED
|
@@ -65,7 +65,7 @@ export default function InitialStateProvider(props: any) {
|
|
|
65
65
|
appLoaded.current = true;
|
|
66
66
|
}
|
|
67
67
|
}, [loading]);
|
|
68
|
-
if (loading && !appLoaded.current) {
|
|
68
|
+
if (loading && !appLoaded.current && typeof window !== 'undefined') {
|
|
69
69
|
return <Loading />;
|
|
70
70
|
}
|
|
71
71
|
return props.children;
|
package/dist/layout.js
CHANGED
|
@@ -36,7 +36,6 @@ var import_fs = require("fs");
|
|
|
36
36
|
var import_path = require("path");
|
|
37
37
|
var import_umi = require("umi");
|
|
38
38
|
var import_plugin_utils = require("umi/plugin-utils");
|
|
39
|
-
var import_npmClient = require("./utils/npmClient");
|
|
40
39
|
var import_resolveProjectDep = require("./utils/resolveProjectDep");
|
|
41
40
|
var import_withTmpPath = require("./utils/withTmpPath");
|
|
42
41
|
var antIconsPath = (0, import_plugin_utils.winPath)(
|
|
@@ -119,7 +118,14 @@ var layout_default = (api) => {
|
|
|
119
118
|
return memo;
|
|
120
119
|
});
|
|
121
120
|
api.onGenerateFiles(() => {
|
|
122
|
-
|
|
121
|
+
var _a;
|
|
122
|
+
let realNpmClient = api.appData.npmClient;
|
|
123
|
+
if (api.appData.npmClient === import_plugin_utils.NpmClientEnum.tnpm && ((_a = api.pkg.tnpm) == null ? void 0 : _a.mode) && [import_plugin_utils.NpmClientEnum.npm, import_plugin_utils.NpmClientEnum.yarn].includes(api.pkg.tnpm.mode)) {
|
|
124
|
+
realNpmClient = api.pkg.tnpm.mode;
|
|
125
|
+
}
|
|
126
|
+
const isFlattedDepsDir = [import_plugin_utils.NpmClientEnum.npm, import_plugin_utils.NpmClientEnum.yarn].includes(
|
|
127
|
+
realNpmClient
|
|
128
|
+
);
|
|
123
129
|
const PKG_TYPE_REFERENCE = `
|
|
124
130
|
/// <reference types="${isFlattedDepsDir ? ANT_PRO_COMPONENT : resolvedPkgPath}" />
|
|
125
131
|
${isFlattedDepsDir ? '/// <reference types="antd" />' : ""}
|
package/dist/qiankun/master.js
CHANGED
|
@@ -219,6 +219,16 @@ export { MicroAppWithMemoHistory } from './MicroAppWithMemoHistory';
|
|
|
219
219
|
`
|
|
220
220
|
});
|
|
221
221
|
});
|
|
222
|
+
api.chainWebpack((config, { ssr }) => {
|
|
223
|
+
if (ssr) {
|
|
224
|
+
const originalExternals = config.get("externals");
|
|
225
|
+
config.externals({
|
|
226
|
+
...originalExternals,
|
|
227
|
+
qiankun: "fs"
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return config;
|
|
231
|
+
});
|
|
222
232
|
};
|
|
223
233
|
// Annotate the CommonJS export names for ESM import in node:
|
|
224
234
|
0 && (module.exports = {
|
package/dist/qiankun/slave.js
CHANGED
|
@@ -171,7 +171,10 @@ export interface IRuntimeConfig {
|
|
|
171
171
|
`window.publicPath = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ || "${api.config.publicPath || "/"}";`
|
|
172
172
|
];
|
|
173
173
|
});
|
|
174
|
-
api.chainWebpack((config) => {
|
|
174
|
+
api.chainWebpack((config, { ssr }) => {
|
|
175
|
+
if (ssr) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
175
178
|
(0, import_assert.default)(api.pkg.name, "You should have name in package.json.");
|
|
176
179
|
const {
|
|
177
180
|
shouldNotAddLibraryChunkName = api.env === "production" || !Boolean(api.config.mfsu)
|
|
@@ -201,11 +204,14 @@ export interface IRuntimeConfig {
|
|
|
201
204
|
});
|
|
202
205
|
api.addEntryCode(() => [
|
|
203
206
|
`
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
export const
|
|
207
|
-
export const
|
|
208
|
-
|
|
207
|
+
const qiankun_noop = () => new Error('qiankun lifecycle is not available for server runtime!');
|
|
208
|
+
const isServer = typeof window === 'undefined';
|
|
209
|
+
export const bootstrap = isServer ? qiankun_noop: qiankun_genBootstrap(render);
|
|
210
|
+
export const mount = isServer ? qiankun_noop : qiankun_genMount('${api.config.mountElementId}');
|
|
211
|
+
export const unmount = isServer ? qiankun_noop : qiankun_genUnmount('${api.config.mountElementId}');
|
|
212
|
+
export const update = isServer ? qiankun_noop : qiankun_genUpdate();
|
|
213
|
+
// 增加 ssr 的判断
|
|
214
|
+
if (!isServer && !window.__POWERED_BY_QIANKUN__) {
|
|
209
215
|
bootstrap().then(mount);
|
|
210
216
|
}
|
|
211
217
|
`
|
package/dist/react-query.js
CHANGED
|
@@ -24,20 +24,25 @@ __export(react_query_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(react_query_exports);
|
|
25
25
|
var import_utils = require("@umijs/utils");
|
|
26
26
|
var import_path = require("path");
|
|
27
|
-
var import_npmClient = require("./utils/npmClient");
|
|
28
27
|
var import_resolveProjectDep = require("./utils/resolveProjectDep");
|
|
29
28
|
var import_withTmpPath = require("./utils/withTmpPath");
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
var react_query_default = (api) => {
|
|
30
|
+
api.describe({
|
|
31
|
+
key: "reactQuery",
|
|
32
|
+
config: {
|
|
33
|
+
schema({ zod }) {
|
|
34
|
+
return zod.object({
|
|
35
|
+
devtool: zod.union([zod.record(zod.any()), zod.boolean()]),
|
|
36
|
+
queryClient: zod.union([zod.record(zod.any()), zod.boolean()])
|
|
37
|
+
}).deepPartial();
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
enableBy: api.EnableBy.config
|
|
41
|
+
});
|
|
38
42
|
let pkgPath;
|
|
39
43
|
let devtoolsPkgPath;
|
|
40
|
-
|
|
44
|
+
const REACT_QUERY_DEP_NAME = "@tanstack/react-query";
|
|
45
|
+
const REACT_QUERY_DEVTOOLS_DEP_NAME = "@tanstack/react-query-devtools";
|
|
41
46
|
const defaultPkgPath = (0, import_utils.winPath)(
|
|
42
47
|
(0, import_path.dirname)(require.resolve(`${REACT_QUERY_DEP_NAME}/package.json`))
|
|
43
48
|
);
|
|
@@ -56,16 +61,6 @@ var getReactQueryPkgInfo = (api) => {
|
|
|
56
61
|
`[reactQuery] package '${REACT_QUERY_DEP_NAME}' resolve failed, ${e.message}`
|
|
57
62
|
);
|
|
58
63
|
}
|
|
59
|
-
try {
|
|
60
|
-
corePath = (0, import_utils.winPath)(
|
|
61
|
-
(0, import_path.dirname)(
|
|
62
|
-
require.resolve(`${REACT_QUERY_CORE_DEP_NAME}/package.json`, {
|
|
63
|
-
paths: [pkgPath]
|
|
64
|
-
})
|
|
65
|
-
)
|
|
66
|
-
);
|
|
67
|
-
} catch {
|
|
68
|
-
}
|
|
69
64
|
try {
|
|
70
65
|
const localDevtoolsPkgPath = (0, import_resolveProjectDep.resolveProjectDep)({
|
|
71
66
|
pkg: api.pkg,
|
|
@@ -87,35 +82,7 @@ var getReactQueryPkgInfo = (api) => {
|
|
|
87
82
|
const useV5 = pkgVersion.startsWith("5");
|
|
88
83
|
const useV5Devtools = devtoolsVersion.startsWith("5");
|
|
89
84
|
const canUseDevtools = useV4 && useV4Devtools || useV5 && useV5Devtools;
|
|
90
|
-
reactQueryInfo = {
|
|
91
|
-
pkgPath,
|
|
92
|
-
devtoolsPkgPath,
|
|
93
|
-
defaultPkgPath,
|
|
94
|
-
defaultDevtoolPkgPath,
|
|
95
|
-
pkgVersion,
|
|
96
|
-
canUseDevtools,
|
|
97
|
-
useV4,
|
|
98
|
-
useV5,
|
|
99
|
-
corePath
|
|
100
|
-
};
|
|
101
|
-
return reactQueryInfo;
|
|
102
|
-
};
|
|
103
|
-
var react_query_default = (api) => {
|
|
104
|
-
api.describe({
|
|
105
|
-
key: "reactQuery",
|
|
106
|
-
config: {
|
|
107
|
-
schema({ zod }) {
|
|
108
|
-
return zod.object({
|
|
109
|
-
devtool: zod.union([zod.record(zod.any()), zod.boolean()]),
|
|
110
|
-
queryClient: zod.union([zod.record(zod.any()), zod.boolean()])
|
|
111
|
-
}).deepPartial();
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
enableBy: api.EnableBy.config
|
|
115
|
-
});
|
|
116
85
|
api.onStart(() => {
|
|
117
|
-
getReactQueryPkgInfo(api);
|
|
118
|
-
const { pkgPath, defaultPkgPath, pkgVersion } = reactQueryInfo;
|
|
119
86
|
if (pkgPath !== defaultPkgPath && !process.env.IS_UMI_BUILD_WORKER) {
|
|
120
87
|
api.logger.info(`[reactQuery] use local package, version: ${pkgVersion}`);
|
|
121
88
|
}
|
|
@@ -127,7 +94,6 @@ var react_query_default = (api) => {
|
|
|
127
94
|
return ["reactQuery"];
|
|
128
95
|
});
|
|
129
96
|
api.modifyConfig((memo) => {
|
|
130
|
-
const { pkgPath, devtoolsPkgPath, canUseDevtools } = getReactQueryPkgInfo(api);
|
|
131
97
|
memo.alias[REACT_QUERY_DEP_NAME] = pkgPath;
|
|
132
98
|
if (canUseDevtools) {
|
|
133
99
|
memo.alias[REACT_QUERY_DEVTOOLS_DEP_NAME] = devtoolsPkgPath;
|
|
@@ -136,7 +102,6 @@ var react_query_default = (api) => {
|
|
|
136
102
|
});
|
|
137
103
|
api.onGenerateFiles(() => {
|
|
138
104
|
var _a;
|
|
139
|
-
const { pkgPath, devtoolsPkgPath, canUseDevtools, useV4, useV5 } = getReactQueryPkgInfo(api);
|
|
140
105
|
const enableDevTools = api.config.reactQuery.devtool !== false && canUseDevtools;
|
|
141
106
|
const enableQueryClient = api.config.reactQuery.queryClient !== false;
|
|
142
107
|
const reactQueryRuntimeCode = ((_a = api.appData.appJS) == null ? void 0 : _a.exports.includes(
|
|
@@ -169,105 +134,60 @@ export function rootContainer(container) {
|
|
|
169
134
|
</QueryClientProvider>
|
|
170
135
|
);
|
|
171
136
|
}
|
|
172
|
-
` : "
|
|
137
|
+
` : ""
|
|
173
138
|
});
|
|
174
|
-
const exportMembers = [
|
|
175
|
-
// from @tanstack/query-core
|
|
176
|
-
"QueryClient",
|
|
177
|
-
"QueryCache",
|
|
178
|
-
"MutationCache",
|
|
179
|
-
"QueryObserver",
|
|
180
|
-
"InfiniteQueryObserver",
|
|
181
|
-
"QueriesObserver",
|
|
182
|
-
"MutationObserver",
|
|
183
|
-
// from @tanstack/react-query
|
|
184
|
-
"useQuery",
|
|
185
|
-
"useQueries",
|
|
186
|
-
"useInfiniteQuery",
|
|
187
|
-
"useMutation",
|
|
188
|
-
"useIsFetching",
|
|
189
|
-
"useIsMutating",
|
|
190
|
-
...useV5 ? [
|
|
191
|
-
"useMutationState",
|
|
192
|
-
"useSuspenseQuery",
|
|
193
|
-
"useSuspenseInfiniteQuery",
|
|
194
|
-
"useSuspenseQueries",
|
|
195
|
-
"queryOptions",
|
|
196
|
-
"infiniteQueryOptions"
|
|
197
|
-
] : [],
|
|
198
|
-
"QueryClientProvider",
|
|
199
|
-
"useQueryClient",
|
|
200
|
-
"QueryErrorResetBoundary",
|
|
201
|
-
"useQueryErrorResetBoundary",
|
|
202
|
-
"useIsRestoring",
|
|
203
|
-
"IsRestoringProvider"
|
|
204
|
-
].filter(Boolean);
|
|
205
139
|
api.writeTmpFile({
|
|
206
140
|
path: "index.tsx",
|
|
207
141
|
content: `
|
|
208
142
|
export {
|
|
209
|
-
|
|
143
|
+
// from @tanstack/query-core
|
|
144
|
+
QueryClient,
|
|
145
|
+
MutationObserver,
|
|
146
|
+
MutationCache,
|
|
147
|
+
InfiniteQueryObserver,
|
|
148
|
+
QueriesObserver,
|
|
149
|
+
QueryObserver,
|
|
150
|
+
QueryCache,
|
|
151
|
+
// from @tanstack/react-query
|
|
152
|
+
useIsRestoring,
|
|
153
|
+
IsRestoringProvider,
|
|
154
|
+
useInfiniteQuery,
|
|
155
|
+
useIsMutating,
|
|
156
|
+
useIsFetching,
|
|
157
|
+
useMutation,
|
|
158
|
+
useQueries,
|
|
159
|
+
useQuery,
|
|
160
|
+
QueryClientProvider,
|
|
161
|
+
useQueryClient,
|
|
162
|
+
QueryErrorResetBoundary,
|
|
163
|
+
useQueryErrorResetBoundary,
|
|
164
|
+
${useV5 ? "queryOptions," : ""}
|
|
210
165
|
} from '${pkgPath}';
|
|
211
166
|
`
|
|
212
167
|
});
|
|
213
|
-
const exportTypes = [
|
|
214
|
-
// from @tanstack/query-core
|
|
215
|
-
"Query",
|
|
216
|
-
"QueryState",
|
|
217
|
-
"Mutation",
|
|
218
|
-
// from @tanstack/react-query
|
|
219
|
-
"QueriesResults",
|
|
220
|
-
"QueriesOptions",
|
|
221
|
-
"QueryErrorResetBoundaryProps",
|
|
222
|
-
"QueryClientProviderProps",
|
|
223
|
-
useV4 && "ContextOptions as QueryContextOptions,",
|
|
224
|
-
"UseQueryOptions",
|
|
225
|
-
"UseBaseQueryOptions",
|
|
226
|
-
"UseQueryResult",
|
|
227
|
-
"UseBaseQueryResult",
|
|
228
|
-
"UseInfiniteQueryOptions",
|
|
229
|
-
"UseMutationResult",
|
|
230
|
-
"UseMutateFunction",
|
|
231
|
-
"UseMutateAsyncFunction",
|
|
232
|
-
"UseBaseMutationResult"
|
|
233
|
-
].filter(Boolean);
|
|
234
168
|
api.writeTmpFile({
|
|
235
169
|
path: "types.d.ts",
|
|
236
170
|
content: `
|
|
237
171
|
export type {
|
|
238
|
-
|
|
172
|
+
// from @tanstack/query-core
|
|
173
|
+
Query, QueryState, Mutation,
|
|
174
|
+
// from @tanstack/react-query
|
|
175
|
+
QueriesResults,
|
|
176
|
+
QueriesOptions,
|
|
177
|
+
QueryErrorResetBoundaryProps,
|
|
178
|
+
QueryClientProviderProps,
|
|
179
|
+
${useV4 ? "ContextOptions as QueryContextOptions," : ""}
|
|
180
|
+
UseQueryOptions,
|
|
181
|
+
UseBaseQueryOptions,
|
|
182
|
+
UseQueryResult,
|
|
183
|
+
UseBaseQueryResult,
|
|
184
|
+
UseInfiniteQueryOptions,
|
|
185
|
+
UseMutationResult,
|
|
186
|
+
UseMutateFunction,
|
|
187
|
+
UseMutateAsyncFunction,
|
|
188
|
+
UseBaseMutationResult,
|
|
239
189
|
} from '${pkgPath}';
|
|
240
190
|
`
|
|
241
191
|
});
|
|
242
|
-
api.writeTmpFile({
|
|
243
|
-
path: "types.d.ts",
|
|
244
|
-
content: enableQueryClient ? `
|
|
245
|
-
import React from 'react';
|
|
246
|
-
import { QueryClientConfig } from '${pkgPath}';
|
|
247
|
-
${enableDevTools ? `
|
|
248
|
-
import { ReactQueryDevtools } from '${devtoolsPkgPath}';
|
|
249
|
-
` : ""}
|
|
250
|
-
|
|
251
|
-
export type RuntimeReactQueryType = {
|
|
252
|
-
${enableDevTools ? `
|
|
253
|
-
devtool?: React.ComponentProps<typeof ReactQueryDevtools>
|
|
254
|
-
` : ""}
|
|
255
|
-
queryClient?: QueryClientConfig
|
|
256
|
-
}` : "export type RuntimeReactQueryType = {}"
|
|
257
|
-
});
|
|
258
192
|
});
|
|
259
|
-
const isFlattedDepsDir = (0, import_npmClient.isFlattedNodeModulesDir)(api);
|
|
260
|
-
if (!isFlattedDepsDir) {
|
|
261
|
-
api.modifyTSConfig((config) => {
|
|
262
|
-
const { corePath, useV5 } = getReactQueryPkgInfo(api);
|
|
263
|
-
if (useV5 && (corePath == null ? void 0 : corePath.length)) {
|
|
264
|
-
import_utils.lodash.set(
|
|
265
|
-
config,
|
|
266
|
-
`compilerOptions.paths["${REACT_QUERY_CORE_DEP_NAME}"]`,
|
|
267
|
-
[corePath]
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
return config;
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
193
|
};
|
|
@@ -167,13 +167,6 @@ export const MicroApp = forwardRef(
|
|
|
167
167
|
props: { settings: settingsFromConfig = {}, ...propsFromConfig } = {},
|
|
168
168
|
} = appConfig || {};
|
|
169
169
|
|
|
170
|
-
const __globalRoutesInfo = {
|
|
171
|
-
appNameKeyAlias,
|
|
172
|
-
masterHistoryType,
|
|
173
|
-
base: globalSettings.base,
|
|
174
|
-
microAppRoutes: globalSettings.microAppRoutes,
|
|
175
|
-
};
|
|
176
|
-
|
|
177
170
|
useEffect(() => {
|
|
178
171
|
setComponentError(null);
|
|
179
172
|
setLoading(true);
|
|
@@ -192,7 +185,12 @@ export const MicroApp = forwardRef(
|
|
|
192
185
|
...propsFromConfig,
|
|
193
186
|
...stateForSlave,
|
|
194
187
|
...propsFromParams,
|
|
195
|
-
__globalRoutesInfo
|
|
188
|
+
__globalRoutesInfo: {
|
|
189
|
+
appNameKeyAlias,
|
|
190
|
+
masterHistoryType,
|
|
191
|
+
base: globalSettings.base,
|
|
192
|
+
microAppRoutes: globalSettings.microAppRoutes,
|
|
193
|
+
},
|
|
196
194
|
setLoading,
|
|
197
195
|
},
|
|
198
196
|
},
|
|
@@ -265,7 +263,6 @@ export const MicroApp = forwardRef(
|
|
|
265
263
|
...propsFromConfig,
|
|
266
264
|
...stateForSlave,
|
|
267
265
|
...propsFromParams,
|
|
268
|
-
__globalRoutesInfo,
|
|
269
266
|
setLoading,
|
|
270
267
|
};
|
|
271
268
|
|
|
@@ -77,6 +77,10 @@ function patchMicroAppRouteComponent(routes: any[]) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
export async function render(oldRender: typeof noop) {
|
|
80
|
+
// 在 ssr 的场景下,直接返回旧的 render
|
|
81
|
+
if (typeof window === 'undefined') {
|
|
82
|
+
return oldRender();
|
|
83
|
+
}
|
|
80
84
|
const runtimeOptions = await getMasterRuntime();
|
|
81
85
|
let masterOptions: MasterOptions = {
|
|
82
86
|
...getMasterOptions(),
|
|
@@ -138,6 +142,10 @@ export async function render(oldRender: typeof noop) {
|
|
|
138
142
|
}
|
|
139
143
|
|
|
140
144
|
export function patchClientRoutes({ routes }: { routes: any[] }) {
|
|
145
|
+
// 在 ssr 的场景下,不执行主应用的 patchClientRoutes
|
|
146
|
+
if (typeof window === 'undefined') {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
141
149
|
const microAppRoutes = [].concat(
|
|
142
150
|
deepFilterLeafRoutes(routes),
|
|
143
151
|
deepFilterLeafRoutes(microAppRuntimeRoutes),
|
|
@@ -3,6 +3,10 @@ import { createHistory } from '@@/core/history';
|
|
|
3
3
|
import qiankunRender, { contextOptsStack } from './lifecycles';
|
|
4
4
|
|
|
5
5
|
export function render(oldRender: any) {
|
|
6
|
+
// 在 ssr 的场景下,直接返回旧的 render
|
|
7
|
+
if (typeof window === 'undefined') {
|
|
8
|
+
return oldRender();
|
|
9
|
+
}
|
|
6
10
|
return qiankunRender().then(oldRender);
|
|
7
11
|
}
|
|
8
12
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.6-alpha.0",
|
|
4
4
|
"description": "@umijs/plugins",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"styled-components": "6.1.1",
|
|
46
46
|
"tslib": "^2",
|
|
47
47
|
"warning": "^4.0.3",
|
|
48
|
-
"@umijs/bundler-utils": "4.2.
|
|
48
|
+
"@umijs/bundler-utils": "4.2.6-alpha.0",
|
|
49
49
|
"@umijs/valtio": "1.0.4"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"antd": "^4.24.1",
|
|
53
|
-
"umi": "4.2.
|
|
53
|
+
"umi": "4.2.6-alpha.0"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
package/dist/utils/npmClient.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/utils/npmClient.ts
|
|
20
|
-
var npmClient_exports = {};
|
|
21
|
-
__export(npmClient_exports, {
|
|
22
|
-
isFlattedNodeModulesDir: () => isFlattedNodeModulesDir
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(npmClient_exports);
|
|
25
|
-
var import_plugin_utils = require("umi/plugin-utils");
|
|
26
|
-
var FLATTED_NPM_CLIENT = [
|
|
27
|
-
import_plugin_utils.NpmClientEnum.npm,
|
|
28
|
-
import_plugin_utils.NpmClientEnum.yarn
|
|
29
|
-
];
|
|
30
|
-
var isFlattedNodeModulesDir = (api) => {
|
|
31
|
-
var _a;
|
|
32
|
-
let currentNpmClient = api.appData.npmClient;
|
|
33
|
-
const tnpmCompatMode = api.appData.npmClient === import_plugin_utils.NpmClientEnum.tnpm && ((_a = api.pkg.tnpm) == null ? void 0 : _a.mode);
|
|
34
|
-
if (tnpmCompatMode) {
|
|
35
|
-
if (FLATTED_NPM_CLIENT.includes(api.pkg.tnpm.mode)) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const isFlattedDir = FLATTED_NPM_CLIENT.includes(currentNpmClient);
|
|
40
|
-
return isFlattedDir;
|
|
41
|
-
};
|
|
42
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 && (module.exports = {
|
|
44
|
-
isFlattedNodeModulesDir
|
|
45
|
-
});
|