@umijs/plugins 4.0.7 → 4.0.10

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/qiankun.js CHANGED
@@ -1,20 +1,47 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = (api) => {
4
- api.describe({
5
- config: {
6
- schema(joi) {
7
- return joi.object().keys({
8
- slave: joi.object(),
9
- master: joi.object(),
10
- externalQiankun: joi.boolean(),
11
- });
12
- },
13
- },
14
- });
15
- api.addRuntimePluginKey(() => ['qiankun']);
16
- api.registerPlugins([
17
- require.resolve('./qiankun/master'),
18
- require.resolve('./qiankun/slave'),
19
- ]);
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 });
20
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(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/qiankun.ts
23
+ var qiankun_exports = {};
24
+ __export(qiankun_exports, {
25
+ default: () => qiankun_default
26
+ });
27
+ module.exports = __toCommonJS(qiankun_exports);
28
+ var qiankun_default = (api) => {
29
+ api.describe({
30
+ config: {
31
+ schema(Joi) {
32
+ return Joi.alternatives().try(Joi.object().keys({
33
+ slave: Joi.object(),
34
+ master: Joi.object(),
35
+ externalQiankun: Joi.boolean()
36
+ }), Joi.boolean().invalid(true));
37
+ }
38
+ }
39
+ });
40
+ api.addRuntimePluginKey(() => ["qiankun"]);
41
+ api.registerPlugins([
42
+ require.resolve("./qiankun/master"),
43
+ require.resolve("./qiankun/slave")
44
+ ]);
45
+ };
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {});
package/dist/request.js CHANGED
@@ -1,24 +1,47 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const path_1 = require("path");
4
- const plugin_utils_1 = require("umi/plugin-utils");
5
- exports.default = (api) => {
6
- api.describe({
7
- key: 'request',
8
- config: {
9
- schema: (joi) => {
10
- return joi.object({
11
- dataField: joi
12
- .string()
13
- .pattern(/^[a-zA-Z]*$/)
14
- .allow(''),
15
- });
16
- },
17
- },
18
- enableBy: api.EnableBy.config,
19
- });
20
- api.addRuntimePluginKey(() => ['request']);
21
- const requestTpl = `
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(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/request.ts
23
+ var request_exports = {};
24
+ __export(request_exports, {
25
+ default: () => request_default
26
+ });
27
+ module.exports = __toCommonJS(request_exports);
28
+ var import_path = require("path");
29
+ var import_umi = require("umi");
30
+ var import_plugin_utils = require("umi/plugin-utils");
31
+ var request_default = (api) => {
32
+ api.describe({
33
+ key: "request",
34
+ config: {
35
+ schema: (Joi) => {
36
+ return Joi.alternatives().try(Joi.object({
37
+ dataField: Joi.string().pattern(/^[a-zA-Z]*$/).allow("")
38
+ }), Joi.boolean().invalid(true));
39
+ }
40
+ },
41
+ enableBy: api.EnableBy.config
42
+ });
43
+ api.addRuntimePluginKey(() => ["request"]);
44
+ const requestTpl = `
22
45
  import axios, {
23
46
  type AxiosInstance,
24
47
  type AxiosRequestConfig,
@@ -101,7 +124,7 @@ function useRequest(service: any, options: any = {}) {
101
124
  });
102
125
  }
103
126
 
104
- // request 方法 opts 参数的接口
127
+ // request \u65B9\u6CD5 opts \u53C2\u6570\u7684\u63A5\u53E3
105
128
  interface IRequestOptions extends AxiosRequestConfig {
106
129
  skipErrorHandler?: boolean;
107
130
  requestInterceptors?: IRequestInterceptorTuple[];
@@ -120,8 +143,8 @@ interface IRequestOptionsWithoutResponse extends IRequestOptions{
120
143
  interface IRequest{
121
144
  <T = any>(url: string, opts: IRequestOptionsWithResponse): Promise<AxiosResponse<T>>;
122
145
  <T = any>(url: string, opts: IRequestOptionsWithoutResponse): Promise<T>;
123
- <T = any>(url: string, opts: IRequestOptions): Promise<T>; // getResponse 默认是 false 因此不提供该参数时,只返回 data
124
- <T = any>(url: string): Promise<T>; // 不提供 opts 时,默认使用 'GET' method,并且默认返回 data
146
+ <T = any>(url: string, opts: IRequestOptions): Promise<T>; // getResponse \u9ED8\u8BA4\u662F false\uFF0C \u56E0\u6B64\u4E0D\u63D0\u4F9B\u8BE5\u53C2\u6570\u65F6\uFF0C\u53EA\u8FD4\u56DE data
147
+ <T = any>(url: string): Promise<T>; // \u4E0D\u63D0\u4F9B opts \u65F6\uFF0C\u9ED8\u8BA4\u4F7F\u7528 'GET' method\uFF0C\u5E76\u4E14\u9ED8\u8BA4\u8FD4\u56DE data
125
148
  }
126
149
 
127
150
  type RequestError = AxiosError | Error
@@ -131,7 +154,7 @@ interface IErrorHandler {
131
154
  }
132
155
  type IRequestInterceptorAxios = (config: RequestOptions) => RequestOptions;
133
156
  type IRequestInterceptorUmiRequest = (url: string, config : RequestOptions) => { url: string, options: RequestOptions };
134
- type IRequestInterceptor = IRequestInterceptorAxios;
157
+ type IRequestInterceptor = IRequestInterceptorAxios | IRequestInterceptorUmiRequest;
135
158
  type IErrorInterceptor = (error: Error) => Promise<Error>;
136
159
  type IResponseInterceptor = <T = any>(response : AxiosResponse<T>) => AxiosResponse<T> ;
137
160
  type IRequestInterceptorTuple = [IRequestInterceptor , IErrorInterceptor] | [ IRequestInterceptor ] | IRequestInterceptor
@@ -191,7 +214,7 @@ const getRequestInstance = (): AxiosInstance => {
191
214
  requestInstance.interceptors.response.use(interceptor);
192
215
  });
193
216
 
194
- // 当响应的数据 success false 的时候,抛出 error 以供 errorHandler 处理。
217
+ // \u5F53\u54CD\u5E94\u7684\u6570\u636E success \u662F false \u7684\u65F6\u5019\uFF0C\u629B\u51FA error \u4EE5\u4F9B errorHandler \u5904\u7406\u3002
195
218
  requestInstance.interceptors.response.use((response) => {
196
219
  const { data } = response;
197
220
  if(data?.success === false && config?.errorConfig?.errorThrower){
@@ -275,50 +298,63 @@ export type {
275
298
  AxiosInstance,
276
299
  AxiosRequestConfig,
277
300
  AxiosResponse,
301
+ AxiosError,
302
+ RequestError,
278
303
  IResponseInterceptor as ResponseInterceptor,
279
304
  IRequestOptions as RequestOptions,
280
305
  IRequest as Request,
281
306
  };
282
307
 
283
308
  `;
284
- api.onGenerateFiles(() => {
285
- var _a;
286
- const umiRequestPath = (0, plugin_utils_1.winPath)((0, path_1.dirname)(require.resolve('@ahooksjs/use-request/package.json')));
287
- const axiosPath = (0, plugin_utils_1.winPath)((0, path_1.dirname)(require.resolve('axios/package.json')));
288
- let dataField = (_a = api.config.request) === null || _a === void 0 ? void 0 : _a.dataField;
289
- if (dataField === undefined)
290
- dataField = 'data';
291
- const formatResult = dataField === '' ? `result => result` : `result => result?.${dataField}`;
292
- api.writeTmpFile({
293
- path: 'request.ts',
294
- content: plugin_utils_1.Mustache.render(requestTpl, {
295
- umiRequestPath,
296
- axiosPath,
297
- formatResult,
298
- }),
299
- });
300
- api.writeTmpFile({
301
- path: 'types.d.ts',
302
- content: `
303
- export type {
304
- RequestConfig,
309
+ api.onGenerateFiles(() => {
310
+ var _a;
311
+ const umiRequestPath = (0, import_plugin_utils.winPath)((0, import_path.dirname)(require.resolve("@ahooksjs/use-request/package.json")));
312
+ const axiosPath = (0, import_plugin_utils.winPath)((0, import_path.dirname)(require.resolve("axios/package.json")));
313
+ let dataField = (_a = api.config.request) == null ? void 0 : _a.dataField;
314
+ if (dataField === void 0)
315
+ dataField = "data";
316
+ const formatResult = dataField === "" ? `result => result` : `result => result?.${dataField}`;
317
+ api.writeTmpFile({
318
+ path: "request.ts",
319
+ content: import_plugin_utils.Mustache.render(requestTpl, {
320
+ umiRequestPath,
321
+ axiosPath,
322
+ formatResult
323
+ })
324
+ });
325
+ api.writeTmpFile({
326
+ path: "types.d.ts",
327
+ content: `
328
+ export type {
329
+ RequestConfig,
305
330
  AxiosInstance,
306
331
  AxiosRequestConfig,
307
- AxiosResponse,
332
+ AxiosResponse,
308
333
  AxiosError,
309
334
  RequestError,
310
335
  ResponseInterceptor } from './request';
311
- `,
312
- });
313
- api.writeTmpFile({
314
- path: 'index.ts',
315
- content: `
336
+ `
337
+ });
338
+ api.writeTmpFile({
339
+ path: "index.ts",
340
+ content: `
316
341
  export {
317
342
  useRequest,
318
343
  UseRequestProvider,
319
344
  request,
320
345
  } from './request';
321
- `,
322
- });
346
+ `
323
347
  });
348
+ api.writeTmpFile({
349
+ path: import_umi.RUNTIME_TYPE_FILE_NAME,
350
+ content: `
351
+ import type { RequestConfig } from './types.d'
352
+ export type IRuntimeConfig = {
353
+ request?: RequestConfig
354
+ };
355
+ `
356
+ });
357
+ });
324
358
  };
359
+ // Annotate the CommonJS export names for ESM import in node:
360
+ 0 && (module.exports = {});
@@ -1,52 +1,77 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const path_1 = require("path");
4
- const plugin_utils_1 = require("umi/plugin-utils");
5
- exports.default = (api) => {
6
- api.describe({
7
- key: 'tailwindcss',
8
- config: {
9
- schema(Joi) {
10
- return Joi.object();
11
- },
12
- },
13
- enableBy: api.EnableBy.config,
14
- });
15
- let tailwind = null;
16
- const outputPath = 'plugin-tailwindcss/tailwind.css';
17
- api.onBeforeCompiler(() => {
18
- const inputPath = (0, path_1.join)(api.cwd, 'tailwind.css');
19
- const generatedPath = (0, path_1.join)(api.paths.absTmpPath, outputPath);
20
- const binPath = (0, path_1.join)(api.cwd, 'node_modules/.bin/tailwind');
21
- return new Promise((resolve) => {
22
- /** 透过子进程建立 tailwindcss 服务,将生成的 css 写入 generatedPath */
23
- tailwind = (0, plugin_utils_1.crossSpawn)(`${binPath}`, [
24
- '-i',
25
- inputPath,
26
- '-o',
27
- generatedPath,
28
- api.env === 'development' ? '--watch' : '',
29
- ], {
30
- stdio: 'inherit',
31
- });
32
- tailwind.on('error', (m) => {
33
- api.logger.error('tailwindcss service encounter an error: ' + m);
34
- });
35
- if (api.env === 'production') {
36
- tailwind.on('exit', () => {
37
- api.logger.info('tailwindcss service exited');
38
- resolve();
39
- });
40
- }
41
- else {
42
- api.logger.info('tailwindcss service started');
43
- resolve();
44
- }
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/tailwindcss.ts
20
+ var tailwindcss_exports = {};
21
+ __export(tailwindcss_exports, {
22
+ default: () => tailwindcss_default
23
+ });
24
+ module.exports = __toCommonJS(tailwindcss_exports);
25
+ var import_path = require("path");
26
+ var import_plugin_utils = require("umi/plugin-utils");
27
+ var tailwindcss_default = (api) => {
28
+ api.describe({
29
+ key: "tailwindcss",
30
+ config: {
31
+ schema(Joi) {
32
+ return Joi.alternatives().try(Joi.object(), Joi.boolean().invalid(true));
33
+ }
34
+ },
35
+ enableBy: api.EnableBy.config
36
+ });
37
+ let tailwind = null;
38
+ const outputPath = "plugin-tailwindcss/tailwind.css";
39
+ api.onBeforeCompiler(() => {
40
+ const inputPath = (0, import_path.join)(api.cwd, "tailwind.css");
41
+ const generatedPath = (0, import_path.join)(api.paths.absTmpPath, outputPath);
42
+ const binPath = (0, import_path.join)(api.cwd, "node_modules/.bin/tailwind");
43
+ const configPath = (0, import_path.join)(process.env.APP_ROOT || api.cwd, "tailwind.config.js");
44
+ return new Promise((resolve) => {
45
+ tailwind = (0, import_plugin_utils.crossSpawn)(`${binPath}`, [
46
+ "-c",
47
+ configPath,
48
+ "-i",
49
+ inputPath,
50
+ "-o",
51
+ generatedPath,
52
+ api.env === "development" ? "--watch" : ""
53
+ ], {
54
+ stdio: "inherit",
55
+ cwd: process.env.APP_ROOT || api.cwd
56
+ });
57
+ tailwind.on("error", (m) => {
58
+ api.logger.error("tailwindcss service encounter an error: " + m);
59
+ });
60
+ if (api.env === "production") {
61
+ tailwind.on("exit", () => {
62
+ api.logger.info("tailwindcss service exited");
63
+ resolve();
45
64
  });
65
+ } else {
66
+ api.logger.info("tailwindcss service started");
67
+ resolve();
68
+ }
46
69
  });
47
- /** 将生成的 css 文件加入到 import 中 */
48
- api.addEntryImports(() => {
49
- const generatedPath = (0, plugin_utils_1.winPath)((0, path_1.join)(api.paths.absTmpPath, outputPath));
50
- return [{ source: generatedPath }];
51
- });
70
+ });
71
+ api.addEntryImports(() => {
72
+ const generatedPath = (0, import_plugin_utils.winPath)((0, import_path.join)(api.paths.absTmpPath, outputPath));
73
+ return [{ source: generatedPath }];
74
+ });
52
75
  };
76
+ // Annotate the CommonJS export names for ESM import in node:
77
+ 0 && (module.exports = {});
package/dist/unocss.js CHANGED
@@ -1,39 +1,59 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const child_process_1 = require("child_process");
4
- const fs_1 = require("fs");
5
- const path_1 = require("path");
6
- const plugin_utils_1 = require("umi/plugin-utils");
7
- exports.default = (api) => {
8
- api.describe({
9
- key: 'unocss',
10
- config: {
11
- schema(Joi) {
12
- return Joi.object({
13
- watch: Joi.array(),
14
- });
15
- },
16
- },
17
- enableBy: api.EnableBy.config,
18
- });
19
- const outputPath = 'uno.css';
20
- api.onBeforeCompiler(() => {
21
- /** 由于 @unocss/cli 对设置文件进行了检查,因此加入需要 unocss.config.ts 设置的提示
22
- * https://github.com/antfu/unocss/blob/main/packages/cli/src/index.ts#L93 */
23
- if (!(0, fs_1.existsSync)((0, path_1.join)(api.paths.cwd, 'unocss.config.ts')))
24
- api.logger.warn('请在项目目录中添加 unocss.config.ts 文件,并配置需要的 unocss presets,否则插件将没有效果!');
25
- const generatedPath = (0, path_1.join)(api.paths.absTmpPath, outputPath);
26
- const binPath = (0, path_1.join)(api.cwd, 'node_modules/.bin/unocss');
27
- const watchDirs = api.config.unocss.watch;
28
- /** 透过子进程建立 unocss 服务,将生成的 css 写入 generatedPath */
29
- const unocss = (0, child_process_1.exec)(`${binPath} ${watchDirs.join(' ')} --out-file ${generatedPath} ${api.env === 'development' ? '--watch' : ''}`, { cwd: api.cwd });
30
- unocss.on('error', (m) => {
31
- api.logger.error('unocss service encounter an error: ' + m);
32
- });
33
- });
34
- /** 将生成的 css 文件加入到 import 中 */
35
- api.addEntryImports(() => {
36
- const generatedPath = (0, plugin_utils_1.winPath)((0, path_1.join)(api.paths.absTmpPath, outputPath));
37
- return [{ source: generatedPath }];
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/unocss.ts
20
+ var unocss_exports = {};
21
+ __export(unocss_exports, {
22
+ default: () => unocss_default
23
+ });
24
+ module.exports = __toCommonJS(unocss_exports);
25
+ var import_child_process = require("child_process");
26
+ var import_fs = require("fs");
27
+ var import_path = require("path");
28
+ var import_plugin_utils = require("umi/plugin-utils");
29
+ var unocss_default = (api) => {
30
+ api.describe({
31
+ key: "unocss",
32
+ config: {
33
+ schema(Joi) {
34
+ return Joi.alternatives().try(Joi.object({
35
+ watch: Joi.array()
36
+ }), Joi.boolean().invalid(true));
37
+ }
38
+ },
39
+ enableBy: api.EnableBy.config
40
+ });
41
+ const outputPath = "uno.css";
42
+ api.onBeforeCompiler(() => {
43
+ if (!(0, import_fs.existsSync)((0, import_path.join)(api.paths.cwd, "unocss.config.ts")))
44
+ api.logger.warn("\u8BF7\u5728\u9879\u76EE\u76EE\u5F55\u4E2D\u6DFB\u52A0 unocss.config.ts \u6587\u4EF6\uFF0C\u5E76\u914D\u7F6E\u9700\u8981\u7684 unocss presets\uFF0C\u5426\u5219\u63D2\u4EF6\u5C06\u6CA1\u6709\u6548\u679C\uFF01");
45
+ const generatedPath = (0, import_path.join)(api.paths.absTmpPath, outputPath);
46
+ const binPath = (0, import_path.join)(api.cwd, "node_modules/.bin/unocss");
47
+ const watchDirs = api.config.unocss.watch;
48
+ const unocss = (0, import_child_process.exec)(`${binPath} ${watchDirs.join(" ")} --out-file ${generatedPath} ${api.env === "development" ? "--watch" : ""}`, { cwd: api.cwd });
49
+ unocss.on("error", (m) => {
50
+ api.logger.error("unocss service encounter an error: " + m);
38
51
  });
52
+ });
53
+ api.addEntryImports(() => {
54
+ const generatedPath = (0, import_plugin_utils.winPath)((0, import_path.join)(api.paths.absTmpPath, outputPath));
55
+ return [{ source: generatedPath }];
56
+ });
39
57
  };
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {});
@@ -1,38 +1,42 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
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;
24
18
  };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getIdentifierDeclaration = void 0;
27
- const t = __importStar(require("@umijs/bundler-utils/compiled/babel/types"));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/utils/astUtils.ts
23
+ var astUtils_exports = {};
24
+ __export(astUtils_exports, {
25
+ getIdentifierDeclaration: () => getIdentifierDeclaration
26
+ });
27
+ module.exports = __toCommonJS(astUtils_exports);
28
+ var t = __toESM(require("@umijs/bundler-utils/compiled/babel/types"));
28
29
  function getIdentifierDeclaration(node, path) {
29
- if (t.isIdentifier(node) && path.scope.hasBinding(node.name)) {
30
- let bindingNode = path.scope.getBinding(node.name).path.node;
31
- if (t.isVariableDeclarator(bindingNode)) {
32
- bindingNode = bindingNode.init;
33
- }
34
- return bindingNode;
30
+ if (t.isIdentifier(node) && path.scope.hasBinding(node.name)) {
31
+ let bindingNode = path.scope.getBinding(node.name).path.node;
32
+ if (t.isVariableDeclarator(bindingNode)) {
33
+ bindingNode = bindingNode.init;
35
34
  }
36
- return node;
35
+ return bindingNode;
36
+ }
37
+ return node;
37
38
  }
38
- exports.getIdentifierDeclaration = getIdentifierDeclaration;
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ getIdentifierDeclaration
42
+ });