@umijs/plugins 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/access.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -1,3 +1,3 @@
1
1
  import type { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
package/dist/antd.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
package/dist/dva.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IApi } from 'umi';
2
2
  import { Model, ModelUtils } from './utils/modelUtils';
3
- declare const _default: (api: IApi) => void;
4
3
  export default _default;
4
+ declare function _default(api: IApi): void;
5
5
  export declare function getModelUtil(api: IApi | null): ModelUtils;
6
6
  export declare function getAllModels(api: IApi): Model[];
package/dist/dva.js CHANGED
@@ -266,7 +266,8 @@ export interface DvaModel<T, E = EffectsMapObject, R = ReducersMapObject<T>> {
266
266
  function getModelUtil(api) {
267
267
  return new import_modelUtils.ModelUtils(api, {
268
268
  contentTest(content) {
269
- if (api == null ? void 0 : api.config.dva.skipModelValidate) return true;
269
+ if (api == null ? void 0 : api.config.dva.skipModelValidate)
270
+ return true;
270
271
  return content.startsWith("// @dva-model");
271
272
  },
272
273
  astTest({ node, content }) {
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
package/dist/layout.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
package/dist/locale.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { IApi } from 'umi';
2
2
  export declare const packageNormalize: (packageName: string) => string;
3
- declare const _default: (api: IApi) => void;
4
3
  export default _default;
4
+ declare function _default(api: IApi): void;
package/dist/mf.js CHANGED
@@ -142,14 +142,14 @@ function mf(api) {
142
142
  (0, import_path.join)(api.paths.absTmpPath, "umi.ts"),
143
143
  "utf-8"
144
144
  );
145
- const [_imports, exports2] = await (0, import_bundler_utils.parseModule)({ content, path: entry });
145
+ const [_imports, exports] = await (0, import_bundler_utils.parseModule)({ content, path: entry });
146
146
  const mfEntryContent = [];
147
147
  let hasDefaultExport = false;
148
- if (exports2.length) {
148
+ if (exports.length) {
149
149
  mfEntryContent.push(
150
150
  `const umiExports = await import('${(0, import_plugin_utils.winPath)(entry)}')`
151
151
  );
152
- for (const exportName of exports2) {
152
+ for (const exportName of exports) {
153
153
  if (exportName === "default") {
154
154
  hasDefaultExport = true;
155
155
  mfEntryContent.push(`export default umiExports.${exportName}`);
package/dist/model.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -2,5 +2,5 @@ import { IApi } from 'umi';
2
2
  export declare function isMasterEnable(opts: {
3
3
  userConfig: any;
4
4
  }): boolean;
5
- declare const _default: (api: IApi) => void;
6
5
  export default _default;
6
+ declare function _default(api: IApi): void;
@@ -101,8 +101,8 @@ var master_default = (api) => {
101
101
  api.register({
102
102
  key: "addExtraModels",
103
103
  fn() {
104
- const { path, exports: exports2 } = api.appData.appJS || {};
105
- return path && exports2.includes(import_constants.MODEL_EXPORT_NAME) ? [
104
+ const { path, exports } = api.appData.appJS || {};
105
+ return path && exports.includes(import_constants.MODEL_EXPORT_NAME) ? [
106
106
  `${path}#{"namespace":"${import_constants.qiankunStateForSlaveModelNamespace}","exportName":"${import_constants.MODEL_EXPORT_NAME}"}`
107
107
  ] : [];
108
108
  }
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
package/dist/qiankun.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
package/dist/request.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
package/dist/request.js CHANGED
@@ -326,7 +326,8 @@ export type {
326
326
  );
327
327
  const axiosPath = (0, import_plugin_utils.winPath)((0, import_path.dirname)(require.resolve("axios/package.json")));
328
328
  let dataField = (_a = api.config.request) == null ? void 0 : _a.dataField;
329
- if (dataField === void 0) dataField = "data";
329
+ if (dataField === void 0)
330
+ dataField = "data";
330
331
  const isEmpty = dataField === "";
331
332
  const formatResult = isEmpty ? `result => result` : `result => result?.${dataField}`;
332
333
  const resultDataType = isEmpty ? dataField : `${dataField}?: T;`;
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -101,7 +101,7 @@ var tailwindcss_default = (api) => {
101
101
  inputPath,
102
102
  "-o",
103
103
  generatedPath,
104
- api.env === "development" ? "--watch" : ""
104
+ api.env === "development" ? "--watch=always" : ""
105
105
  ],
106
106
  {
107
107
  stdio: "inherit",
@@ -167,7 +167,8 @@ function getTailwindBinPath(opts) {
167
167
  function getTailwindWebpackLoaderPath(opts, api) {
168
168
  for (const cwd of [__dirname, opts.cwd]) {
169
169
  const loaderPath = tryResolveTailwindWebpackLoader(cwd);
170
- if (loaderPath) return loaderPath;
170
+ if (loaderPath)
171
+ return loaderPath;
171
172
  }
172
173
  api.logger.error(
173
174
  "tailwindcss v4 with webpack or utoopack requires @tailwindcss/webpack"
package/dist/unocss.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
package/dist/unocss.js CHANGED
@@ -40,7 +40,8 @@ var unocss_default = (api) => {
40
40
  });
41
41
  const outputPath = "uno.css";
42
42
  api.onBeforeCompiler(async () => {
43
- if (process.env.IS_UMI_BUILD_WORKER) return;
43
+ if (process.env.IS_UMI_BUILD_WORKER)
44
+ return;
44
45
  if (!(0, import_fs.existsSync)((0, import_path.join)(api.paths.cwd, "unocss.config.ts")))
45
46
  api.logger.warn(
46
47
  "请在项目目录中添加 unocss.config.ts 文件,并配置需要的 unocss presets,否则插件将没有效果!"
@@ -1,3 +1,3 @@
1
1
  import * as Babel from '@umijs/bundler-utils/compiled/babel/core';
2
2
  import * as t from '@umijs/bundler-utils/compiled/babel/types';
3
- export declare function getIdentifierDeclaration(node: t.Node, path: Babel.NodePath): Babel.types.Node;
3
+ export declare function getIdentifierDeclaration(node: t.Node, path: Babel.NodePath): t.Node;
@@ -1,4 +1,4 @@
1
- export declare type IAddAntdLocales = (args: {
1
+ export type IAddAntdLocales = (args: {
2
2
  lang: string;
3
3
  country: string;
4
4
  }) => Promise<string[]>;
@@ -1,16 +1,16 @@
1
- declare type SimpleRemote = {
1
+ type SimpleRemote = {
2
2
  entry: string;
3
3
  name: string;
4
4
  aliasName?: string;
5
5
  runtimeEntryPath?: object;
6
6
  };
7
- declare type RemoteEntries = {
7
+ type RemoteEntries = {
8
8
  name: string;
9
9
  entries: object;
10
10
  keyResolver: string;
11
11
  aliasName?: string;
12
12
  runtimeEntryPath?: object;
13
13
  };
14
- declare type Remote = SimpleRemote | RemoteEntries;
14
+ type Remote = SimpleRemote | RemoteEntries;
15
15
  export declare function toRemotesCodeString(remotes: Remote[]): string;
16
16
  export {};
@@ -66,11 +66,6 @@ function getNamespace(absFilePath, absSrcPath) {
66
66
  return [...validDirs, normalizedFile].join(".");
67
67
  }
68
68
  var Model = class {
69
- file;
70
- namespace;
71
- id;
72
- exportName;
73
- deps;
74
69
  constructor(file, absSrcPath, sort, id) {
75
70
  let namespace;
76
71
  let exportName;
@@ -111,11 +106,10 @@ var Model = class {
111
106
  return [...deps];
112
107
  }
113
108
  };
114
- var ModelUtils = class _ModelUtils {
115
- api;
116
- opts = {};
117
- count = 1;
109
+ var _ModelUtils = class {
118
110
  constructor(api, opts) {
111
+ this.opts = {};
112
+ this.count = 1;
119
113
  this.api = api;
120
114
  this.opts = opts;
121
115
  }
@@ -162,8 +156,10 @@ var ModelUtils = class _ModelUtils {
162
156
  cwd: opts.base,
163
157
  absolute: true
164
158
  }).map(import_plugin_utils.winPath).filter((file) => {
165
- if (/\.d.ts$/.test(file)) return false;
166
- if (/\.(test|e2e|spec).([jt])sx?$/.test(file)) return false;
159
+ if (/\.d.ts$/.test(file))
160
+ return false;
161
+ if (/\.(test|e2e|spec).([jt])sx?$/.test(file))
162
+ return false;
167
163
  const content = (0, import_fs.readFileSync)(file, "utf-8");
168
164
  return this.isModelValid({ content, file });
169
165
  });
@@ -208,57 +204,6 @@ var ModelUtils = class _ModelUtils {
208
204
  });
209
205
  return ret;
210
206
  }
211
- // https://github.com/umijs/umi/issues/9837
212
- static topologicalSort = (models) => {
213
- const graph = [];
214
- const namespaceToNode = {};
215
- models.forEach((model, index) => {
216
- const node = {
217
- namespace: model.namespace,
218
- deps: model.deps,
219
- index,
220
- in: 0,
221
- childs: []
222
- };
223
- if (namespaceToNode[model.namespace]) {
224
- throw new Error(`Duplicate namespace in models: ${model.namespace}`);
225
- }
226
- namespaceToNode[model.namespace] = node;
227
- graph.push(node);
228
- });
229
- graph.forEach((node) => {
230
- node.deps.forEach((dep) => {
231
- const depNode = namespaceToNode[dep];
232
- if (!depNode) {
233
- throw new Error(`Model namespace not found: ${dep}`);
234
- }
235
- depNode.childs.push(node);
236
- node.in++;
237
- });
238
- });
239
- const queue = [];
240
- while (true) {
241
- const zeronode = graph.find((n) => {
242
- return n && n.in === 0;
243
- });
244
- if (!zeronode) {
245
- break;
246
- }
247
- queue.push(zeronode.namespace);
248
- zeronode.childs.forEach((child) => {
249
- child.in--;
250
- });
251
- zeronode.childs = [];
252
- delete graph[zeronode.index];
253
- }
254
- const leftNodes = graph.filter(Boolean);
255
- if (leftNodes.length > 0) {
256
- throw new Error(
257
- `Circle dependency detected in models: ${leftNodes.map((m) => import_plugin_utils.chalk.red(m.namespace)).join(", ")}`
258
- );
259
- }
260
- return queue;
261
- };
262
207
  static getModelsContent(models) {
263
208
  const imports = [];
264
209
  const modelProps = [];
@@ -288,6 +233,58 @@ ${modelProps.join("\n")}
288
233
  } as const`;
289
234
  }
290
235
  };
236
+ var ModelUtils = _ModelUtils;
237
+ // https://github.com/umijs/umi/issues/9837
238
+ ModelUtils.topologicalSort = (models) => {
239
+ const graph = [];
240
+ const namespaceToNode = {};
241
+ models.forEach((model, index) => {
242
+ const node = {
243
+ namespace: model.namespace,
244
+ deps: model.deps,
245
+ index,
246
+ in: 0,
247
+ childs: []
248
+ };
249
+ if (namespaceToNode[model.namespace]) {
250
+ throw new Error(`Duplicate namespace in models: ${model.namespace}`);
251
+ }
252
+ namespaceToNode[model.namespace] = node;
253
+ graph.push(node);
254
+ });
255
+ graph.forEach((node) => {
256
+ node.deps.forEach((dep) => {
257
+ const depNode = namespaceToNode[dep];
258
+ if (!depNode) {
259
+ throw new Error(`Model namespace not found: ${dep}`);
260
+ }
261
+ depNode.childs.push(node);
262
+ node.in++;
263
+ });
264
+ });
265
+ const queue = [];
266
+ while (true) {
267
+ const zeronode = graph.find((n) => {
268
+ return n && n.in === 0;
269
+ });
270
+ if (!zeronode) {
271
+ break;
272
+ }
273
+ queue.push(zeronode.namespace);
274
+ zeronode.childs.forEach((child) => {
275
+ child.in--;
276
+ });
277
+ zeronode.childs = [];
278
+ delete graph[zeronode.index];
279
+ }
280
+ const leftNodes = graph.filter(Boolean);
281
+ if (leftNodes.length > 0) {
282
+ throw new Error(
283
+ `Circle dependency detected in models: ${leftNodes.map((m) => import_plugin_utils.chalk.red(m.namespace)).join(", ")}`
284
+ );
285
+ }
286
+ return queue;
287
+ };
291
288
  // Annotate the CommonJS export names for ESM import in node:
292
289
  0 && (module.exports = {
293
290
  Model,
package/dist/valtio.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { IApi } from 'umi';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.6.67",
3
+ "version": "4.6.68",
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",
@@ -46,12 +46,12 @@
46
46
  "styled-components": "6.1.1",
47
47
  "tslib": "^2",
48
48
  "warning": "^4.0.3",
49
- "@umijs/bundler-utils": "4.6.67",
50
- "@umijs/valtio": "1.0.4"
49
+ "@umijs/valtio": "1.0.4",
50
+ "@umijs/bundler-utils": "4.6.68"
51
51
  },
52
52
  "devDependencies": {
53
53
  "antd": "^4.24.1",
54
- "umi": "4.6.67"
54
+ "umi": "4.6.68"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"