@meng-xi/vite-plugin 0.1.6 → 0.1.8

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.
Files changed (66) hide show
  1. package/README-en.md +42 -16
  2. package/README.md +55 -29
  3. package/dist/common/concurrency/index.cjs +1 -0
  4. package/dist/common/concurrency/index.d.cts +26 -0
  5. package/dist/common/concurrency/index.d.mts +26 -0
  6. package/dist/common/concurrency/index.d.ts +26 -0
  7. package/dist/common/concurrency/index.mjs +1 -0
  8. package/dist/common/format/index.cjs +1 -1
  9. package/dist/common/format/index.d.cts +19 -1
  10. package/dist/common/format/index.d.mts +19 -1
  11. package/dist/common/format/index.d.ts +19 -1
  12. package/dist/common/format/index.mjs +1 -1
  13. package/dist/common/fs/index.cjs +1 -1
  14. package/dist/common/fs/index.d.cts +19 -1
  15. package/dist/common/fs/index.d.mts +19 -1
  16. package/dist/common/fs/index.d.ts +19 -1
  17. package/dist/common/fs/index.mjs +1 -1
  18. package/dist/common/index.cjs +1 -1
  19. package/dist/common/index.d.cts +4 -2
  20. package/dist/common/index.d.mts +4 -2
  21. package/dist/common/index.d.ts +4 -2
  22. package/dist/common/index.mjs +1 -1
  23. package/dist/common/path/index.cjs +1 -0
  24. package/dist/common/path/index.d.cts +103 -0
  25. package/dist/common/path/index.d.mts +103 -0
  26. package/dist/common/path/index.d.ts +103 -0
  27. package/dist/common/path/index.mjs +1 -0
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.d.cts +6 -2
  30. package/dist/index.d.mts +6 -2
  31. package/dist/index.d.ts +6 -2
  32. package/dist/index.mjs +1 -1
  33. package/dist/plugins/assetManifest/index.cjs +1 -0
  34. package/dist/plugins/assetManifest/index.d.cts +162 -0
  35. package/dist/plugins/assetManifest/index.d.mts +162 -0
  36. package/dist/plugins/assetManifest/index.d.ts +162 -0
  37. package/dist/plugins/assetManifest/index.mjs +1 -0
  38. package/dist/plugins/autoImport/index.cjs +13 -13
  39. package/dist/plugins/autoImport/index.mjs +8 -8
  40. package/dist/plugins/bundleAnalyzer/index.cjs +1 -1
  41. package/dist/plugins/bundleAnalyzer/index.mjs +2 -2
  42. package/dist/plugins/compressAssets/index.cjs +1 -1
  43. package/dist/plugins/compressAssets/index.mjs +1 -1
  44. package/dist/plugins/copyFile/index.cjs +1 -1
  45. package/dist/plugins/copyFile/index.mjs +1 -1
  46. package/dist/plugins/envGuard/index.cjs +1 -1
  47. package/dist/plugins/envGuard/index.mjs +1 -1
  48. package/dist/plugins/faviconManager/index.cjs +1 -1
  49. package/dist/plugins/faviconManager/index.mjs +1 -1
  50. package/dist/plugins/generateRouter/index.cjs +3 -3
  51. package/dist/plugins/generateRouter/index.mjs +1 -1
  52. package/dist/plugins/generateVersion/index.cjs +1 -1
  53. package/dist/plugins/generateVersion/index.mjs +1 -1
  54. package/dist/plugins/htmlInject/index.cjs +7 -7
  55. package/dist/plugins/htmlInject/index.mjs +2 -2
  56. package/dist/plugins/imageOptimizer/index.cjs +5 -0
  57. package/dist/plugins/imageOptimizer/index.d.cts +242 -0
  58. package/dist/plugins/imageOptimizer/index.d.mts +242 -0
  59. package/dist/plugins/imageOptimizer/index.d.ts +242 -0
  60. package/dist/plugins/imageOptimizer/index.mjs +5 -0
  61. package/dist/plugins/index.cjs +1 -1
  62. package/dist/plugins/index.d.cts +2 -0
  63. package/dist/plugins/index.d.mts +2 -0
  64. package/dist/plugins/index.d.ts +2 -0
  65. package/dist/plugins/index.mjs +1 -1
  66. package/package.json +25 -1
@@ -0,0 +1,162 @@
1
+ import { BasePluginOptions, PluginFactory } from '../../factory/index.cjs';
2
+ import 'vite';
3
+ import '../../shared/vite-plugin.B8FuZce1.cjs';
4
+ import '../../shared/vite-plugin.DRRlWY8P.cjs';
5
+
6
+ /**
7
+ * 清单输出格式
8
+ *
9
+ * @typedef {('vite' | 'webpack' | 'custom')} ManifestOutputFormat
10
+ * @description 支持的清单格式:
11
+ * - `vite`: Vite 标准格式,键为原始路径,值为带 hash 的输出路径
12
+ * - `webpack`: Webpack 兼容格式,包含 files、entry 等字段
13
+ * - `custom`: 自定义格式,通过 customFormatter 回调生成
14
+ */
15
+ type ManifestOutputFormat = 'vite' | 'webpack' | 'custom';
16
+ /**
17
+ * 资源映射表
18
+ *
19
+ * @interface AssetMap
20
+ * @description 键为原始资源路径,值为带 hash 的输出路径
21
+ */
22
+ interface AssetMap {
23
+ [key: string]: string;
24
+ }
25
+ /**
26
+ * 按入口分组的资源信息
27
+ *
28
+ * @interface AssetGroup
29
+ * @description 描述一个入口点及其关联的所有资源文件
30
+ */
31
+ interface AssetGroup {
32
+ /** 入口名称 */
33
+ entry: string;
34
+ /** 入口关联的资源分类 */
35
+ assets: {
36
+ /** JavaScript 文件列表 */
37
+ js: string[];
38
+ /** CSS 文件列表 */
39
+ css: string[];
40
+ /** 其他资源文件列表(图片、字体等) */
41
+ other: string[];
42
+ };
43
+ }
44
+ /**
45
+ * 资源清单生成结果
46
+ *
47
+ * @interface AssetManifestResult
48
+ * @description 插件生成的完整资源清单数据
49
+ */
50
+ interface AssetManifestResult {
51
+ /** 清单版本号 */
52
+ version: string;
53
+ /** 生成时间戳(ISO 8601 格式) */
54
+ timestamp: string;
55
+ /** 公共路径前缀 */
56
+ publicPath: string;
57
+ /** 资源映射表 */
58
+ assets: AssetMap;
59
+ /** 按入口分组的资源信息,仅在 groupByEntry 为 true 时存在 */
60
+ groups?: AssetGroup[];
61
+ }
62
+ /**
63
+ * Webpack 兼容格式的入口资源信息
64
+ *
65
+ * @interface WebpackEntryAsset
66
+ * @description 模拟 Webpack ManifestPlugin 的输出结构
67
+ */
68
+ interface WebpackEntryAsset {
69
+ /** 入口名称 */
70
+ name: string;
71
+ /** 该入口的所有输出文件路径列表 */
72
+ files: string[];
73
+ }
74
+ /**
75
+ * Webpack 兼容格式的清单输出
76
+ *
77
+ * @interface WebpackManifestOutput
78
+ */
79
+ interface WebpackManifestOutput {
80
+ /** 所有入口的资源信息 */
81
+ entries: WebpackEntryAsset[];
82
+ /** 资源映射表(与 vite 格式相同) */
83
+ assets: AssetMap;
84
+ }
85
+ /**
86
+ * 自定义格式化器函数类型
87
+ *
88
+ * @param manifest - 资源映射表
89
+ * @returns 自定义格式的输出对象
90
+ */
91
+ type CustomFormatter = (manifest: AssetMap) => Record<string, any>;
92
+ /**
93
+ * 资源清单生成插件的配置选项
94
+ *
95
+ * @interface AssetManifestOptions
96
+ * @extends {BasePluginOptions}
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * assetManifest({
101
+ * outputFormat: 'vite',
102
+ * publicPath: 'https://cdn.example.com/',
103
+ * injectRuntime: true,
104
+ * groupByEntry: true
105
+ * })
106
+ * ```
107
+ */
108
+ interface AssetManifestOptions extends BasePluginOptions {
109
+ /** 清单输出格式,支持 vite 标准、webpack 兼容或自定义 */
110
+ outputFormat?: ManifestOutputFormat;
111
+ /** 清单输出文件名,相对于构建输出目录 */
112
+ outputFile?: string;
113
+ /** 需要包含在清单中的文件扩展名列表,为空则包含所有 */
114
+ includeExtensions?: string[];
115
+ /** 公共路径前缀,会添加到所有资源路径前 */
116
+ publicPath?: string;
117
+ /** 是否将清单注入为运行时全局变量 */
118
+ injectRuntime?: boolean;
119
+ /** 运行时全局变量名称 */
120
+ runtimeGlobalName?: string;
121
+ /** 自定义格式化器,仅在 outputFormat 为 'custom' 时生效 */
122
+ customFormatter?: CustomFormatter | null;
123
+ /** 是否按入口分组资源 */
124
+ groupByEntry?: boolean;
125
+ /** 需要排除的文件扩展名列表,优先级高于 includeExtensions */
126
+ excludeExtensions?: string[];
127
+ /** 需要排除的路径模式列表 */
128
+ excludePaths?: string[];
129
+ }
130
+
131
+ /**
132
+ * 创建资源清单生成插件
133
+ *
134
+ * @function assetManifest
135
+ * @param {Partial<AssetManifestOptions>} [options] - 插件配置选项
136
+ * @returns {Plugin} Vite 插件实例
137
+ *
138
+ * @description 在 Vite 构建完成后自动扫描输出目录中的文件,
139
+ * 生成资源映射清单,支持 Vite 标准、Webpack 兼容和自定义三种输出格式。
140
+ * 支持按入口分组、运行时注入、自定义格式化等功能。
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * // vite.config.ts
145
+ * import { assetManifest } from '@meng-xi/vite-plugin'
146
+ *
147
+ * export default defineConfig({
148
+ * plugins: [
149
+ * assetManifest({
150
+ * outputFormat: 'vite',
151
+ * publicPath: 'https://cdn.example.com/',
152
+ * injectRuntime: true,
153
+ * groupByEntry: true
154
+ * })
155
+ * ]
156
+ * })
157
+ * ```
158
+ */
159
+ declare const assetManifest: PluginFactory<AssetManifestOptions, AssetManifestOptions>;
160
+
161
+ export { assetManifest };
162
+ export type { AssetGroup, AssetManifestOptions, AssetManifestResult, AssetMap, CustomFormatter, ManifestOutputFormat, WebpackEntryAsset, WebpackManifestOutput };
@@ -0,0 +1,162 @@
1
+ import { BasePluginOptions, PluginFactory } from '../../factory/index.mjs';
2
+ import 'vite';
3
+ import '../../shared/vite-plugin.B8FuZce1.mjs';
4
+ import '../../shared/vite-plugin.DRRlWY8P.mjs';
5
+
6
+ /**
7
+ * 清单输出格式
8
+ *
9
+ * @typedef {('vite' | 'webpack' | 'custom')} ManifestOutputFormat
10
+ * @description 支持的清单格式:
11
+ * - `vite`: Vite 标准格式,键为原始路径,值为带 hash 的输出路径
12
+ * - `webpack`: Webpack 兼容格式,包含 files、entry 等字段
13
+ * - `custom`: 自定义格式,通过 customFormatter 回调生成
14
+ */
15
+ type ManifestOutputFormat = 'vite' | 'webpack' | 'custom';
16
+ /**
17
+ * 资源映射表
18
+ *
19
+ * @interface AssetMap
20
+ * @description 键为原始资源路径,值为带 hash 的输出路径
21
+ */
22
+ interface AssetMap {
23
+ [key: string]: string;
24
+ }
25
+ /**
26
+ * 按入口分组的资源信息
27
+ *
28
+ * @interface AssetGroup
29
+ * @description 描述一个入口点及其关联的所有资源文件
30
+ */
31
+ interface AssetGroup {
32
+ /** 入口名称 */
33
+ entry: string;
34
+ /** 入口关联的资源分类 */
35
+ assets: {
36
+ /** JavaScript 文件列表 */
37
+ js: string[];
38
+ /** CSS 文件列表 */
39
+ css: string[];
40
+ /** 其他资源文件列表(图片、字体等) */
41
+ other: string[];
42
+ };
43
+ }
44
+ /**
45
+ * 资源清单生成结果
46
+ *
47
+ * @interface AssetManifestResult
48
+ * @description 插件生成的完整资源清单数据
49
+ */
50
+ interface AssetManifestResult {
51
+ /** 清单版本号 */
52
+ version: string;
53
+ /** 生成时间戳(ISO 8601 格式) */
54
+ timestamp: string;
55
+ /** 公共路径前缀 */
56
+ publicPath: string;
57
+ /** 资源映射表 */
58
+ assets: AssetMap;
59
+ /** 按入口分组的资源信息,仅在 groupByEntry 为 true 时存在 */
60
+ groups?: AssetGroup[];
61
+ }
62
+ /**
63
+ * Webpack 兼容格式的入口资源信息
64
+ *
65
+ * @interface WebpackEntryAsset
66
+ * @description 模拟 Webpack ManifestPlugin 的输出结构
67
+ */
68
+ interface WebpackEntryAsset {
69
+ /** 入口名称 */
70
+ name: string;
71
+ /** 该入口的所有输出文件路径列表 */
72
+ files: string[];
73
+ }
74
+ /**
75
+ * Webpack 兼容格式的清单输出
76
+ *
77
+ * @interface WebpackManifestOutput
78
+ */
79
+ interface WebpackManifestOutput {
80
+ /** 所有入口的资源信息 */
81
+ entries: WebpackEntryAsset[];
82
+ /** 资源映射表(与 vite 格式相同) */
83
+ assets: AssetMap;
84
+ }
85
+ /**
86
+ * 自定义格式化器函数类型
87
+ *
88
+ * @param manifest - 资源映射表
89
+ * @returns 自定义格式的输出对象
90
+ */
91
+ type CustomFormatter = (manifest: AssetMap) => Record<string, any>;
92
+ /**
93
+ * 资源清单生成插件的配置选项
94
+ *
95
+ * @interface AssetManifestOptions
96
+ * @extends {BasePluginOptions}
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * assetManifest({
101
+ * outputFormat: 'vite',
102
+ * publicPath: 'https://cdn.example.com/',
103
+ * injectRuntime: true,
104
+ * groupByEntry: true
105
+ * })
106
+ * ```
107
+ */
108
+ interface AssetManifestOptions extends BasePluginOptions {
109
+ /** 清单输出格式,支持 vite 标准、webpack 兼容或自定义 */
110
+ outputFormat?: ManifestOutputFormat;
111
+ /** 清单输出文件名,相对于构建输出目录 */
112
+ outputFile?: string;
113
+ /** 需要包含在清单中的文件扩展名列表,为空则包含所有 */
114
+ includeExtensions?: string[];
115
+ /** 公共路径前缀,会添加到所有资源路径前 */
116
+ publicPath?: string;
117
+ /** 是否将清单注入为运行时全局变量 */
118
+ injectRuntime?: boolean;
119
+ /** 运行时全局变量名称 */
120
+ runtimeGlobalName?: string;
121
+ /** 自定义格式化器,仅在 outputFormat 为 'custom' 时生效 */
122
+ customFormatter?: CustomFormatter | null;
123
+ /** 是否按入口分组资源 */
124
+ groupByEntry?: boolean;
125
+ /** 需要排除的文件扩展名列表,优先级高于 includeExtensions */
126
+ excludeExtensions?: string[];
127
+ /** 需要排除的路径模式列表 */
128
+ excludePaths?: string[];
129
+ }
130
+
131
+ /**
132
+ * 创建资源清单生成插件
133
+ *
134
+ * @function assetManifest
135
+ * @param {Partial<AssetManifestOptions>} [options] - 插件配置选项
136
+ * @returns {Plugin} Vite 插件实例
137
+ *
138
+ * @description 在 Vite 构建完成后自动扫描输出目录中的文件,
139
+ * 生成资源映射清单,支持 Vite 标准、Webpack 兼容和自定义三种输出格式。
140
+ * 支持按入口分组、运行时注入、自定义格式化等功能。
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * // vite.config.ts
145
+ * import { assetManifest } from '@meng-xi/vite-plugin'
146
+ *
147
+ * export default defineConfig({
148
+ * plugins: [
149
+ * assetManifest({
150
+ * outputFormat: 'vite',
151
+ * publicPath: 'https://cdn.example.com/',
152
+ * injectRuntime: true,
153
+ * groupByEntry: true
154
+ * })
155
+ * ]
156
+ * })
157
+ * ```
158
+ */
159
+ declare const assetManifest: PluginFactory<AssetManifestOptions, AssetManifestOptions>;
160
+
161
+ export { assetManifest };
162
+ export type { AssetGroup, AssetManifestOptions, AssetManifestResult, AssetMap, CustomFormatter, ManifestOutputFormat, WebpackEntryAsset, WebpackManifestOutput };
@@ -0,0 +1,162 @@
1
+ import { BasePluginOptions, PluginFactory } from '../../factory/index.js';
2
+ import 'vite';
3
+ import '../../shared/vite-plugin.B8FuZce1.js';
4
+ import '../../shared/vite-plugin.DRRlWY8P.js';
5
+
6
+ /**
7
+ * 清单输出格式
8
+ *
9
+ * @typedef {('vite' | 'webpack' | 'custom')} ManifestOutputFormat
10
+ * @description 支持的清单格式:
11
+ * - `vite`: Vite 标准格式,键为原始路径,值为带 hash 的输出路径
12
+ * - `webpack`: Webpack 兼容格式,包含 files、entry 等字段
13
+ * - `custom`: 自定义格式,通过 customFormatter 回调生成
14
+ */
15
+ type ManifestOutputFormat = 'vite' | 'webpack' | 'custom';
16
+ /**
17
+ * 资源映射表
18
+ *
19
+ * @interface AssetMap
20
+ * @description 键为原始资源路径,值为带 hash 的输出路径
21
+ */
22
+ interface AssetMap {
23
+ [key: string]: string;
24
+ }
25
+ /**
26
+ * 按入口分组的资源信息
27
+ *
28
+ * @interface AssetGroup
29
+ * @description 描述一个入口点及其关联的所有资源文件
30
+ */
31
+ interface AssetGroup {
32
+ /** 入口名称 */
33
+ entry: string;
34
+ /** 入口关联的资源分类 */
35
+ assets: {
36
+ /** JavaScript 文件列表 */
37
+ js: string[];
38
+ /** CSS 文件列表 */
39
+ css: string[];
40
+ /** 其他资源文件列表(图片、字体等) */
41
+ other: string[];
42
+ };
43
+ }
44
+ /**
45
+ * 资源清单生成结果
46
+ *
47
+ * @interface AssetManifestResult
48
+ * @description 插件生成的完整资源清单数据
49
+ */
50
+ interface AssetManifestResult {
51
+ /** 清单版本号 */
52
+ version: string;
53
+ /** 生成时间戳(ISO 8601 格式) */
54
+ timestamp: string;
55
+ /** 公共路径前缀 */
56
+ publicPath: string;
57
+ /** 资源映射表 */
58
+ assets: AssetMap;
59
+ /** 按入口分组的资源信息,仅在 groupByEntry 为 true 时存在 */
60
+ groups?: AssetGroup[];
61
+ }
62
+ /**
63
+ * Webpack 兼容格式的入口资源信息
64
+ *
65
+ * @interface WebpackEntryAsset
66
+ * @description 模拟 Webpack ManifestPlugin 的输出结构
67
+ */
68
+ interface WebpackEntryAsset {
69
+ /** 入口名称 */
70
+ name: string;
71
+ /** 该入口的所有输出文件路径列表 */
72
+ files: string[];
73
+ }
74
+ /**
75
+ * Webpack 兼容格式的清单输出
76
+ *
77
+ * @interface WebpackManifestOutput
78
+ */
79
+ interface WebpackManifestOutput {
80
+ /** 所有入口的资源信息 */
81
+ entries: WebpackEntryAsset[];
82
+ /** 资源映射表(与 vite 格式相同) */
83
+ assets: AssetMap;
84
+ }
85
+ /**
86
+ * 自定义格式化器函数类型
87
+ *
88
+ * @param manifest - 资源映射表
89
+ * @returns 自定义格式的输出对象
90
+ */
91
+ type CustomFormatter = (manifest: AssetMap) => Record<string, any>;
92
+ /**
93
+ * 资源清单生成插件的配置选项
94
+ *
95
+ * @interface AssetManifestOptions
96
+ * @extends {BasePluginOptions}
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * assetManifest({
101
+ * outputFormat: 'vite',
102
+ * publicPath: 'https://cdn.example.com/',
103
+ * injectRuntime: true,
104
+ * groupByEntry: true
105
+ * })
106
+ * ```
107
+ */
108
+ interface AssetManifestOptions extends BasePluginOptions {
109
+ /** 清单输出格式,支持 vite 标准、webpack 兼容或自定义 */
110
+ outputFormat?: ManifestOutputFormat;
111
+ /** 清单输出文件名,相对于构建输出目录 */
112
+ outputFile?: string;
113
+ /** 需要包含在清单中的文件扩展名列表,为空则包含所有 */
114
+ includeExtensions?: string[];
115
+ /** 公共路径前缀,会添加到所有资源路径前 */
116
+ publicPath?: string;
117
+ /** 是否将清单注入为运行时全局变量 */
118
+ injectRuntime?: boolean;
119
+ /** 运行时全局变量名称 */
120
+ runtimeGlobalName?: string;
121
+ /** 自定义格式化器,仅在 outputFormat 为 'custom' 时生效 */
122
+ customFormatter?: CustomFormatter | null;
123
+ /** 是否按入口分组资源 */
124
+ groupByEntry?: boolean;
125
+ /** 需要排除的文件扩展名列表,优先级高于 includeExtensions */
126
+ excludeExtensions?: string[];
127
+ /** 需要排除的路径模式列表 */
128
+ excludePaths?: string[];
129
+ }
130
+
131
+ /**
132
+ * 创建资源清单生成插件
133
+ *
134
+ * @function assetManifest
135
+ * @param {Partial<AssetManifestOptions>} [options] - 插件配置选项
136
+ * @returns {Plugin} Vite 插件实例
137
+ *
138
+ * @description 在 Vite 构建完成后自动扫描输出目录中的文件,
139
+ * 生成资源映射清单,支持 Vite 标准、Webpack 兼容和自定义三种输出格式。
140
+ * 支持按入口分组、运行时注入、自定义格式化等功能。
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * // vite.config.ts
145
+ * import { assetManifest } from '@meng-xi/vite-plugin'
146
+ *
147
+ * export default defineConfig({
148
+ * plugins: [
149
+ * assetManifest({
150
+ * outputFormat: 'vite',
151
+ * publicPath: 'https://cdn.example.com/',
152
+ * injectRuntime: true,
153
+ * groupByEntry: true
154
+ * })
155
+ * ]
156
+ * })
157
+ * ```
158
+ */
159
+ declare const assetManifest: PluginFactory<AssetManifestOptions, AssetManifestOptions>;
160
+
161
+ export { assetManifest };
162
+ export type { AssetGroup, AssetManifestOptions, AssetManifestResult, AssetMap, CustomFormatter, ManifestOutputFormat, WebpackEntryAsset, WebpackManifestOutput };
@@ -0,0 +1 @@
1
+ import c from"node:path";import F from"node:fs";import{createPluginFactory as v,BasePlugin as C}from"../../factory/index.mjs";import{scanDirectory as P,writeFileContent as g}from"../../common/fs/index.mjs";import{normalizePath as h,isExtensionIncluded as y,isPathExcluded as A,isPreCompressed as w}from"../../common/path/index.mjs";import{injectBeforeTag as j}from"../../common/html/index.mjs";import{validateGlobalName as D}from"../../common/validation/index.mjs";import"../../logger/index.mjs";import"../../shared/vite-plugin.DcExl6jd.mjs";import"fs";import"path";import"../../common/concurrency/index.mjs";import"../../shared/vite-plugin.CuXEJAWX.mjs";function b(s,t,e){const u=h(s);if(!y(t,{includeExtensions:e.includeExtensions,excludeExtensions:e.excludeExtensions})||A(s,e.excludePaths,{matchMode:"segment"}))return!1;const i=h(e.outputFile);return!(u===i||u.endsWith("/"+i)||u.endsWith("manifest.json")||u.endsWith("asset-manifest.json")||w(t))}async function B(s,t){return(await P(s,{filter:(e,u,i)=>{const r=h(c.relative(s,e));return b(r,u,t)}})).map(e=>({filePath:e.filePath,relativePath:h(c.relative(s,e.filePath)),size:e.size,ext:e.extension}))}function $(s,t,e){const u={},i=t.endsWith("/")?t:t+"/";for(const r of s){const o=x(r.relativePath),n=i+r.relativePath;u[o]!==void 0&&u[o]!==n?(u[r.relativePath]=n,e?.(`\u8D44\u6E90\u952E\u540D\u51B2\u7A81: "${o}" \u5DF2\u88AB ${u[o]} \u5360\u7528\uFF0C"${r.relativePath}" \u5C06\u4F7F\u7528\u5B8C\u6574\u8DEF\u5F84\u4F5C\u4E3A\u952E`)):u[o]=n}return u}function x(s){const t=/[-.]([0-9a-f]{6,20})(?=\.)/g;return s.replace(t,"")}function M(s,t,e,u,i){switch(t){case"vite":return E(s,u,i);case"webpack":return N(s,i);case"custom":return O(s,e);default:return E(s,u,i)}}function E(s,t,e){const u={version:"1.0",timestamp:new Date().toISOString(),publicPath:t,assets:s};return e&&e.length>0&&(u.groups=e),u}function N(s,t){return t&&t.length>0?{entries:t.map(e=>({name:e.entry,files:[...e.assets.js,...e.assets.css,...e.assets.other]})),assets:s}:{entries:[{name:"main",files:Object.values(s)}],assets:s}}function O(s,t){if(!t)throw new Error('outputFormat \u4E3A "custom" \u65F6\uFF0CcustomFormatter \u4E0D\u80FD\u4E3A\u7A7A');return t(s)}function S(s,t){const e=new Map,u=new Set,i=s.filter(_);for(const n of i){const a=f(n.relativePath);e.has(a)||e.set(a,{entry:a,assets:{js:[],css:[],other:[]}});const l=e.get(a),p=t[n.relativePath]||n.relativePath;m(l,p,n.ext),u.add(n.relativePath)}const r=s.filter(n=>!u.has(n.relativePath)&&!G(n));for(const n of r){const a=W(n,i),l=a?f(a.relativePath):"_shared";e.has(l)||e.set(l,{entry:l,assets:{js:[],css:[],other:[]}});const p=e.get(l),d=t[n.relativePath]||n.relativePath;m(p,d,n.ext),u.add(n.relativePath)}const o=s.filter(n=>!u.has(n.relativePath));if(o.length>0){e.has("_shared")||e.set("_shared",{entry:"_shared",assets:{js:[],css:[],other:[]}});const n=e.get("_shared");for(const a of o){const l=t[a.relativePath]||a.relativePath;m(n,l,a.ext)}}return Array.from(e.values())}function _(s){const{relativePath:t,ext:e}=s,u=t.split("/").pop()||"";return!!(e===".html"||(e===".js"||e===".mjs")&&(u.startsWith("entry-")||u.startsWith("main")||!t.includes("/")))}function G(s){return[".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".woff",".woff2",".ttf",".eot",".map"].includes(s.ext)}function f(s){let t=(s.split("/").pop()||"").replace(/\.[^.]+$/,"");return t.startsWith("entry-")&&(t=t.slice(6)),t.replace(/[-.][0-9a-f]{6,20}$/,"")||t}function W(s,t){const e=s.relativePath.split("/").slice(0,-1).join("/"),u=(s.relativePath.split("/").pop()||"").replace(/\.[^.]+$/,"").replace(/[-.][0-9a-f]{6,20}$/,"");let i=null,r=0;for(const o of t){const n=o.relativePath.split("/").slice(0,-1).join("/"),a=f(o.relativePath);if(e===n)return o;u.startsWith(a)&&a.length>r&&(i=o,r=a.length)}return i}function m(s,t,e){e===".js"||e===".mjs"?s.assets.js.push(t):e===".css"?s.assets.css.push(t):s.assets.other.push(t)}function R(s,t){const e=JSON.stringify(s).replace(/<\/script>/gi,"<\\/script>");return`<script>Object.defineProperty(window,"${t}",{value:Object.freeze(${e}),writable:false,configurable:false})<\/script>`}function T(s,t,e){const u=R(t,e);return j(s,"</head>",u)}class H extends C{manifest=null;assetMap={};groups=null;getDefaultOptions(){return{outputFormat:"vite",outputFile:"manifest.json",includeExtensions:[],publicPath:"/",injectRuntime:!1,runtimeGlobalName:"__ASSET_MANIFEST__",customFormatter:null,groupByEntry:!1,excludeExtensions:[".map",".gz",".br"],excludePaths:[]}}validateOptions(){this.validator.field("outputFormat").enum(["vite","webpack","custom"]).field("outputFile").custom(t=>typeof t=="string"&&t.length>0,"outputFile \u5FC5\u987B\u4E3A\u975E\u7A7A\u5B57\u7B26\u4E32").field("publicPath").custom(t=>typeof t=="string"&&t.length>0,"publicPath \u5FC5\u987B\u4E3A\u975E\u7A7A\u5B57\u7B26\u4E32").field("injectRuntime").boolean().field("runtimeGlobalName").custom(t=>typeof t=="string"&&t.length>0,"runtimeGlobalName \u5FC5\u987B\u4E3A\u975E\u7A7A\u5B57\u7B26\u4E32").field("groupByEntry").boolean().field("customFormatter").custom(t=>this.options.outputFormat!=="custom"||typeof t=="function",'outputFormat \u4E3A "custom" \u65F6\uFF0CcustomFormatter \u5FC5\u987B\u4E3A\u51FD\u6570').validate(),D(this.options.runtimeGlobalName,"runtimeGlobalName")}getPluginName(){return"asset-manifest"}getEnforce(){return"post"}addPluginHooks(t){t.writeBundle={order:"post",handler:async()=>{await this.safeExecute(()=>this.generateManifest(),"\u751F\u6210\u8D44\u6E90\u6E05\u5355")}}}async generateManifest(){if(!this.viteConfig)return;const t=this.viteConfig.build.outDir,e=Date.now();this.logger.info(`\u5F00\u59CB\u626B\u63CF\u6784\u5EFA\u4EA7\u7269\u76EE\u5F55: ${t}`);const u=await B(t,this.options);if(u.length===0){this.logger.info("\u672A\u627E\u5230\u9700\u8981\u8BB0\u5F55\u7684\u8D44\u6E90\u6587\u4EF6");return}this.assetMap=$(u,this.options.publicPath,n=>{this.logger.warn(n)}),this.options.groupByEntry&&(this.groups=S(u,this.assetMap));const i=M(this.assetMap,this.options.outputFormat,this.options.customFormatter,this.options.publicPath,this.groups??void 0),r=c.isAbsolute(this.options.outputFile)?this.options.outputFile:c.join(t,this.options.outputFile);await g(r,JSON.stringify(i,null,2)),this.options.outputFormat==="vite"&&(this.manifest=i),this.options.injectRuntime&&await this.injectRuntimeToHtmlFiles(t);const o=Date.now()-e;this.logStats(u.length,o)}async injectRuntimeToHtmlFiles(t){if(!this.manifest&&Object.keys(this.assetMap).length===0){this.logger.warn("\u8D44\u6E90\u6E05\u5355\u5C1A\u672A\u751F\u6210\uFF0C\u8DF3\u8FC7\u8FD0\u884C\u65F6\u6CE8\u5165");return}const e=this.manifest?.assets||this.assetMap,u=await this.findHtmlFiles(t);if(u.length===0){this.logger.warn("\u672A\u627E\u5230 HTML \u6587\u4EF6\uFF0C\u8FD0\u884C\u65F6\u6E05\u5355\u6CE8\u5165\u8DF3\u8FC7");return}for(const i of u)try{const r=await F.promises.readFile(i,"utf-8"),o=T(r,e,this.options.runtimeGlobalName);o.injected?(await g(i,o.html),this.logger.info(`\u8FD0\u884C\u65F6\u6E05\u5355\u5DF2\u6CE8\u5165\u5230: ${c.relative(t,i)}`)):this.logger.warn(`\u672A\u627E\u5230 </head> \u6807\u7B7E\uFF0C\u8DF3\u8FC7\u6CE8\u5165: ${c.relative(t,i)}`)}catch(r){this.logger.error(`\u6CE8\u5165\u8FD0\u884C\u65F6\u6E05\u5355\u5931\u8D25: ${i} - ${r instanceof Error?r.message:String(r)}`)}this.logger.info(`\u8FD0\u884C\u65F6\u6E05\u5355\u5168\u5C40\u53D8\u91CF: ${this.options.runtimeGlobalName}`)}async findHtmlFiles(t){const e=[];async function u(i){const r=await F.promises.readdir(i,{withFileTypes:!0});for(const o of r){const n=c.join(i,o.name);o.isDirectory()?await u(n):o.isFile()&&o.name.endsWith(".html")&&e.push(n)}}return await u(t),e}logStats(t,e){const u=Object.keys(this.assetMap).length;this.logger.success(`\u8D44\u6E90\u6E05\u5355\u5DF2\u751F\u6210: ${t} \u4E2A\u8D44\u6E90\u6587\u4EF6\uFF0C${u} \u6761\u6620\u5C04\u8BB0\u5F55`,`\u683C\u5F0F: ${this.options.outputFormat}\uFF0C\u8F93\u51FA: ${this.options.outputFile}\uFF0C\u8017\u65F6: ${e}ms`),this.groups&&this.groups.length>0&&this.logger.info(`\u5165\u53E3\u5206\u7EC4: ${this.groups.map(i=>`${i.entry}(${i.assets.js.length+i.assets.css.length+i.assets.other.length})`).join(", ")}`)}getAssetMap(){return{...this.assetMap}}getManifest(){return this.manifest}getGroups(){return this.groups}}const k=v(H);export{k as assetManifest};
@@ -1,19 +1,19 @@
1
- "use strict";const factory_index=require("../../factory/index.cjs"),u=require("node:fs"),l=require("node:path"),common_fs_index=require("../../common/fs/index.cjs");require("../../logger/index.cjs"),require("../../shared/vite-plugin.Bcg6RW2N.cjs"),require("fs"),require("path");function _interopDefaultCompat(s){return s&&typeof s=="object"&&"default"in s?s.default:s}const u__default=_interopDefaultCompat(u),l__default=_interopDefaultCompat(l);function h$1(s,e){const t=v(s,e);if(t.length>0)return t;const n=l__default.isAbsolute(s)?s:l__default.resolve(e,s),o=["",".ts",".js",".mts",".mjs","/index.ts","/index.js"];for(const c of o){const r=n+c;if(u__default.existsSync(r)&&u__default.statSync(r).isFile()){const a=parseModuleExports(r);if(a&&a.exports.length>0)return a.exports}}const i=R$1(s,e);if(i){const c=parseModuleExports(i);if(c&&c.exports.length>0)return c.exports}return[]}function v(s,e){try{let t=null;try{const r=require.resolve(s,{paths:[e]});let a=l__default.dirname(r);for(;a!==l__default.dirname(a);){if(u__default.existsSync(l__default.join(a,"package.json"))){t=a;break}a=l__default.dirname(a)}}catch{}if(!t){const r=l__default.resolve(e,"node_modules",s);u__default.existsSync(l__default.join(r,"package.json"))&&(t=r)}if(!t)return[];const n=l__default.join(t,"package.json"),o=JSON.parse(u__default.readFileSync(n,"utf-8"));let i=null;const c=o.types||o.typings;if(c&&typeof c=="string"){const r=l__default.resolve(t,c);u__default.existsSync(r)&&(i=r)}if(!i&&o.exports){const r=o.exports["."];if(r){const a=typeof r=="string"?null:r.import?.types||r.types||r.default?.types;if(typeof a=="string"){const p=l__default.resolve(t,a);u__default.existsSync(p)&&(i=p)}}}if(!i){const r=["dist/index.d.ts","index.d.ts","dist/index.d.mts","index.d.mts"];for(const a of r){const p=l__default.resolve(t,a);if(u__default.existsSync(p)){i=p;break}}}return i?E(i,e,new Set):[]}catch{return[]}}function E(s,e,t){if(t.has(s))return[];t.add(s);const n=new Set;try{const o=u__default.readFileSync(s,"utf-8"),i=/export\s*\{([^}]+)\}/g;let c;for(;(c=i.exec(o))!==null;){const $=c[1].split(",").map(m=>{const x=m.trim().split(/\s+as\s+/);return x.length>1?x[x.length-1].trim():x[0].trim()});for(const m of $)m&&m!=="default"&&n.add(m)}const r=/export\s+declare\s+(?:const|let|var|function|class)\s+(\w+)/g;for(;(c=r.exec(o))!==null;)n.add(c[1]);const a=/export\s+(?:type|interface)\s+(\w+)/g;for(;(c=a.exec(o))!==null;)n.add(c[1]);const p=/export\s+\*\s+from\s+['"]([^'"]+)['"]/g;for(;(c=p.exec(o))!==null;){const $=c[1],m=w($,s,e,t);for(const x of m)n.add(x)}}catch{}return[...n]}function w(s,e,t,n){if(s.startsWith(".")){const o=l__default.dirname(e),i=[".d.ts",".d.mts","/index.d.ts","/index.d.mts"];for(const c of i){const r=l__default.resolve(o,s+c);if(u__default.existsSync(r))return E(r,t,n)}}return v(s,t)}function R$1(s,e){try{const t=require.resolve(s,{paths:[e]});if(u__default.existsSync(t))return t}catch{}try{let t=null;try{const c=require.resolve(s,{paths:[e]});let r=l__default.dirname(c);for(;r!==l__default.dirname(r);){if(u__default.existsSync(l__default.join(r,"package.json"))){t=r;break}r=l__default.dirname(r)}}catch{}if(!t){const c=l__default.resolve(e,"node_modules",s);u__default.existsSync(l__default.join(c,"package.json"))&&(t=c)}if(!t)return null;const n=l__default.join(t,"package.json"),o=JSON.parse(u__default.readFileSync(n,"utf-8"));if(o.exports){const c=typeof o.exports=="string"?o.exports:o.exports["."]?.import||o.exports["."]?.default||o.exports["."];if(typeof c=="string"){const r=l__default.resolve(t,c);if(u__default.existsSync(r))return r}}if(o.main){const c=l__default.resolve(t,o.main);if(u__default.existsSync(c))return c}const i=l__default.resolve(t,"index.js");return u__default.existsSync(i)?i:null}catch{return null}}function resolveImports(s,e){if(!s)return[];const t=[];if(Array.isArray(s))for(const n of s)if("module"in n&&"names"in n){const o=n;if(o.names.includes("*")){const i=e||process.cwd(),c=h$1(o.module,i);for(const r of c)t.push({module:o.module,name:r,isDefault:o.defaultImport??!1})}else for(const i of o.names)t.push({module:o.module,name:i,isDefault:o.defaultImport??!1})}else{const o=n;for(const[i,c]of Object.entries(o))if(c.includes("*")){const r=e||process.cwd(),a=h$1(i,r);for(const p of a)t.push({module:i,name:p,isDefault:!1})}else for(const r of c)t.push({module:i,name:r,isDefault:!1})}else for(const[n,o]of Object.entries(s))if(o.includes("*")){const i=e||process.cwd(),c=h$1(n,i);for(const r of c)t.push({module:n,name:r,isDefault:!1})}else for(const i of o)t.push({module:n,name:i,isDefault:!1});return t}function buildNameLookup(s){const e=new Map;for(const t of s)e.set(t.name,t);return e}function j$1(s){const e=l__default.basename(s,l__default.extname(s));return e==="index"?l__default.basename(l__default.dirname(s)):e}function scanDirectories(s,e){const t=[];for(const n of s){const o=l__default.isAbsolute(n)?n:l__default.resolve(e,n);!u__default.existsSync(o)||!u__default.statSync(o).isDirectory()||S(o,t)}return t}function S(s,e){const t=u__default.readdirSync(s,{withFileTypes:!0});for(const n of t){const o=l__default.join(s,n.name);if(n.isDirectory()){if(n.name==="node_modules"||n.name.startsWith("."))continue;S(o,e);continue}if(!n.isFile())continue;const i=l__default.extname(n.name).toLowerCase();if(![".ts",".js",".mts",".mjs"].includes(i)||n.name.endsWith(".d.ts"))continue;const c=parseModuleExports(o);c&&e.push(c)}}function parseModuleExports(s){try{const e=u__default.readFileSync(s,"utf-8"),t=[];let n=null;const o=/export\s+(?:async\s+)?function\s+(\w+)/g;let i;for(;(i=o.exec(e))!==null;)t.push(i[1]);const c=/export\s+(?:const|let|var)\s+(\w+)/g;for(;(i=c.exec(e))!==null;)t.push(i[1]);const r=/export\s+class\s+(\w+)/g;for(;(i=r.exec(e))!==null;)t.push(i[1]);const a=/export\s*\{([^}]+)\}/g;for(;(i=a.exec(e))!==null;){const x=i[1].split(",").map(A=>{const g=A.trim().split(/\s+as\s+/);return g.length>1?g[g.length-1].trim():g[0].trim()});for(const A of x)A&&A!=="default"&&t.push(A)}const p=/export\s+default\s+(?:function\s+(\w+)|class\s+(\w+)|(\w+))?/.exec(e);p&&(n=p[1]||p[2]||p[3]||j$1(s));const $=/export\s+(?:type|interface)\s+(\w+)/g;for(;(i=$.exec(e))!==null;)t.push(i[1]);const m=/^(?:exports\.(\w+)\s*=|module\.exports\s*=\s*\{)/gm;for(;(i=m.exec(e))!==null;)i[1]&&t.push(i[1]);return t.length===0&&n===null?null:{filePath:s,exports:t,defaultExport:n}}catch{return null}}function scannedModulesToImports(s){const e=[];for(const t of s){for(const n of t.exports)e.push({module:t.filePath,name:n,isDefault:!1});t.defaultExport&&e.push({module:t.filePath,name:t.defaultExport,isDefault:!0})}return e}const h=new Set(["break","case","catch","continue","debugger","default","delete","do","else","finally","for","function","if","in","instanceof","new","return","switch","this","throw","try","typeof","var","void","while","with","class","const","enum","export","extends","import","super","implements","interface","let","package","private","protected","public","static","yield","async","await","of","true","false","null","undefined","NaN","Infinity","console","window","document","global","globalThis","process","require","module","exports","__dirname","__filename","Object","Array","String","Number","Boolean","Symbol","BigInt","Map","Set","WeakMap","WeakSet","Promise","Proxy","Reflect","Error","TypeError","RangeError","SyntaxError","ReferenceError","Date","RegExp","Math","JSON","Intl","ArrayBuffer","DataView","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray"]);function b(s){const e=[];let t=0;const n=s.length;for(;t<n;){if(s[t]==="/"&&s[t+1]==="/"){for(;t<n&&s[t]!==`
2
- `;)e.push(" "),t++;continue}if(s[t]==="/"&&s[t+1]==="*"){for(e.push(" "),e.push(" "),t+=2;t<n&&!(s[t-1]==="*"&&s[t]==="/");)e.push(s[t]===`
1
+ "use strict";const factory_index=require("../../factory/index.cjs"),u=require("node:fs"),l=require("node:path"),common_fs_index=require("../../common/fs/index.cjs");require("../../logger/index.cjs"),require("../../shared/vite-plugin.Bcg6RW2N.cjs"),require("fs"),require("path"),require("../../common/concurrency/index.cjs");function _interopDefaultCompat(n){return n&&typeof n=="object"&&"default"in n?n.default:n}const u__default=_interopDefaultCompat(u),l__default=_interopDefaultCompat(l);function h$1(n,e){const t=v(n,e);if(t.length>0)return t;const s=l__default.isAbsolute(n)?n:l__default.resolve(e,n),o=["",".ts",".js",".mts",".mjs","/index.ts","/index.js"];for(const c of o){const r=s+c;if(u__default.existsSync(r)&&u__default.statSync(r).isFile()){const a=parseModuleExports(r);if(a&&a.exports.length>0)return a.exports}}const i=R$1(n,e);if(i){const c=parseModuleExports(i);if(c&&c.exports.length>0)return c.exports}return[]}function v(n,e){try{let t=null;try{const r=require.resolve(n,{paths:[e]});let a=l__default.dirname(r);for(;a!==l__default.dirname(a);){if(u__default.existsSync(l__default.join(a,"package.json"))){t=a;break}a=l__default.dirname(a)}}catch{}if(!t){const r=l__default.resolve(e,"node_modules",n);u__default.existsSync(l__default.join(r,"package.json"))&&(t=r)}if(!t)return[];const s=l__default.join(t,"package.json"),o=JSON.parse(u__default.readFileSync(s,"utf-8"));let i=null;const c=o.types||o.typings;if(c&&typeof c=="string"){const r=l__default.resolve(t,c);u__default.existsSync(r)&&(i=r)}if(!i&&o.exports){const r=o.exports["."];if(r){const a=typeof r=="string"?null:r.import?.types||r.types||r.default?.types;if(typeof a=="string"){const p=l__default.resolve(t,a);u__default.existsSync(p)&&(i=p)}}}if(!i){const r=["dist/index.d.ts","index.d.ts","dist/index.d.mts","index.d.mts"];for(const a of r){const p=l__default.resolve(t,a);if(u__default.existsSync(p)){i=p;break}}}return i?E(i,e,new Set):[]}catch{return[]}}function E(n,e,t){if(t.has(n))return[];t.add(n);const s=new Set;try{const o=u__default.readFileSync(n,"utf-8"),i=/export\s*\{([^}]+)\}/g;let c;for(;(c=i.exec(o))!==null;){const k=c[1].split(",").map(m=>{const x=m.trim().split(/\s+as\s+/);return x.length>1?x[x.length-1].trim():x[0].trim()});for(const m of k)m&&m!=="default"&&s.add(m)}const r=/export\s+declare\s+(?:const|let|var|function|class)\s+(\w+)/g;for(;(c=r.exec(o))!==null;)s.add(c[1]);const a=/export\s+(?:type|interface)\s+(\w+)/g;for(;(c=a.exec(o))!==null;)s.add(c[1]);const p=/export\s+\*\s+from\s+['"]([^'"]+)['"]/g;for(;(c=p.exec(o))!==null;){const k=c[1],m=w(k,n,e,t);for(const x of m)s.add(x)}}catch{}return[...s]}function w(n,e,t,s){if(n.startsWith(".")){const o=l__default.dirname(e),i=[".d.ts",".d.mts","/index.d.ts","/index.d.mts"];for(const c of i){const r=l__default.resolve(o,n+c);if(u__default.existsSync(r))return E(r,t,s)}}return v(n,t)}function R$1(n,e){try{const t=require.resolve(n,{paths:[e]});if(u__default.existsSync(t))return t}catch{}try{let t=null;try{const c=require.resolve(n,{paths:[e]});let r=l__default.dirname(c);for(;r!==l__default.dirname(r);){if(u__default.existsSync(l__default.join(r,"package.json"))){t=r;break}r=l__default.dirname(r)}}catch{}if(!t){const c=l__default.resolve(e,"node_modules",n);u__default.existsSync(l__default.join(c,"package.json"))&&(t=c)}if(!t)return null;const s=l__default.join(t,"package.json"),o=JSON.parse(u__default.readFileSync(s,"utf-8"));if(o.exports){const c=typeof o.exports=="string"?o.exports:o.exports["."]?.import||o.exports["."]?.default||o.exports["."];if(typeof c=="string"){const r=l__default.resolve(t,c);if(u__default.existsSync(r))return r}}if(o.main){const c=l__default.resolve(t,o.main);if(u__default.existsSync(c))return c}const i=l__default.resolve(t,"index.js");return u__default.existsSync(i)?i:null}catch{return null}}function resolveImports(n,e){if(!n)return[];const t=[];if(Array.isArray(n))for(const s of n)if("module"in s&&"names"in s){const o=s;if(o.names.includes("*")){const i=e||process.cwd(),c=h$1(o.module,i);for(const r of c)t.push({module:o.module,name:r,isDefault:o.defaultImport??!1})}else for(const i of o.names)t.push({module:o.module,name:i,isDefault:o.defaultImport??!1})}else{const o=s;for(const[i,c]of Object.entries(o))if(c.includes("*")){const r=e||process.cwd(),a=h$1(i,r);for(const p of a)t.push({module:i,name:p,isDefault:!1})}else for(const r of c)t.push({module:i,name:r,isDefault:!1})}else for(const[s,o]of Object.entries(n))if(o.includes("*")){const i=e||process.cwd(),c=h$1(s,i);for(const r of c)t.push({module:s,name:r,isDefault:!1})}else for(const i of o)t.push({module:s,name:i,isDefault:!1});return t}function buildNameLookup(n){const e=new Map;for(const t of n)e.set(t.name,t);return e}function j$1(n){const e=l__default.basename(n,l__default.extname(n));return e==="index"?l__default.basename(l__default.dirname(n)):e}function scanDirectories(n,e){const t=[];for(const s of n){const o=l__default.isAbsolute(s)?s:l__default.resolve(e,s);!u__default.existsSync(o)||!u__default.statSync(o).isDirectory()||S(o,t)}return t}function S(n,e){const t=u__default.readdirSync(n,{withFileTypes:!0});for(const s of t){const o=l__default.join(n,s.name);if(s.isDirectory()){if(s.name==="node_modules"||s.name.startsWith("."))continue;S(o,e);continue}if(!s.isFile())continue;const i=l__default.extname(s.name).toLowerCase();if(![".ts",".js",".mts",".mjs"].includes(i)||s.name.endsWith(".d.ts"))continue;const c=parseModuleExports(o);c&&e.push(c)}}function parseModuleExports(n){try{const e=u__default.readFileSync(n,"utf-8"),t=[];let s=null;const o=/export\s+(?:async\s+)?function\s+(\w+)/g;let i;for(;(i=o.exec(e))!==null;)t.push(i[1]);const c=/export\s+(?:const|let|var)\s+(\w+)/g;for(;(i=c.exec(e))!==null;)t.push(i[1]);const r=/export\s+class\s+(\w+)/g;for(;(i=r.exec(e))!==null;)t.push(i[1]);const a=/export\s*\{([^}]+)\}/g;for(;(i=a.exec(e))!==null;){const x=i[1].split(",").map($=>{const g=$.trim().split(/\s+as\s+/);return g.length>1?g[g.length-1].trim():g[0].trim()});for(const $ of x)$&&$!=="default"&&t.push($)}const p=/export\s+default\s+(?:function\s+(\w+)|class\s+(\w+)|(\w+))?/.exec(e);p&&(s=p[1]||p[2]||p[3]||j$1(n));const k=/export\s+(?:type|interface)\s+(\w+)/g;for(;(i=k.exec(e))!==null;)t.push(i[1]);const m=/^(?:exports\.(\w+)\s*=|module\.exports\s*=\s*\{)/gm;for(;(i=m.exec(e))!==null;)i[1]&&t.push(i[1]);return t.length===0&&s===null?null:{filePath:n,exports:t,defaultExport:s}}catch{return null}}function scannedModulesToImports(n){const e=[];for(const t of n){for(const s of t.exports)e.push({module:t.filePath,name:s,isDefault:!1});t.defaultExport&&e.push({module:t.filePath,name:t.defaultExport,isDefault:!0})}return e}const h=new Set(["break","case","catch","continue","debugger","default","delete","do","else","finally","for","function","if","in","instanceof","new","return","switch","this","throw","try","typeof","var","void","while","with","class","const","enum","export","extends","import","super","implements","interface","let","package","private","protected","public","static","yield","async","await","of","true","false","null","undefined","NaN","Infinity","console","window","document","global","globalThis","process","require","module","exports","__dirname","__filename","Object","Array","String","Number","Boolean","Symbol","BigInt","Map","Set","WeakMap","WeakSet","Promise","Proxy","Reflect","Error","TypeError","RangeError","SyntaxError","ReferenceError","Date","RegExp","Math","JSON","Intl","ArrayBuffer","DataView","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray"]);function b(n){const e=[];let t=0;const s=n.length;for(;t<s;){if(n[t]==="/"&&n[t+1]==="/"){for(;t<s&&n[t]!==`
2
+ `;)e.push(" "),t++;continue}if(n[t]==="/"&&n[t+1]==="*"){for(e.push(" "),e.push(" "),t+=2;t<s&&!(n[t-1]==="*"&&n[t]==="/");)e.push(n[t]===`
3
3
  `?`
4
- `:" "),t++;t<n&&(e.push(" "),t++);continue}if(s[t]==="'"){for(e.push(" "),t++;t<n&&s[t]!=="'";){if(s[t]==="\\"&&t+1<n){e.push(" "),e.push(" "),t+=2;continue}e.push(s[t]===`
4
+ `:" "),t++;t<s&&(e.push(" "),t++);continue}if(n[t]==="'"){for(e.push(" "),t++;t<s&&n[t]!=="'";){if(n[t]==="\\"&&t+1<s){e.push(" "),e.push(" "),t+=2;continue}e.push(n[t]===`
5
5
  `?`
6
- `:" "),t++}t<n&&(e.push(" "),t++);continue}if(s[t]==='"'){for(e.push(" "),t++;t<n&&s[t]!=='"';){if(s[t]==="\\"&&t+1<n){e.push(" "),e.push(" "),t+=2;continue}e.push(s[t]===`
6
+ `:" "),t++}t<s&&(e.push(" "),t++);continue}if(n[t]==='"'){for(e.push(" "),t++;t<s&&n[t]!=='"';){if(n[t]==="\\"&&t+1<s){e.push(" "),e.push(" "),t+=2;continue}e.push(n[t]===`
7
7
  `?`
8
- `:" "),t++}t<n&&(e.push(" "),t++);continue}if(s[t]==="`"){for(e.push(" "),t++;t<n&&s[t]!=="`";){if(s[t]==="\\"&&t+1<n){e.push(" "),e.push(" "),t+=2;continue}if(s[t]==="$"&&s[t+1]==="{"){e.push(" "),e.push(" "),t+=2;let o=1;for(;t<n&&o>0;)s[t]==="{"&&o++,s[t]==="}"&&o--,o>0&&(e.push(s[t]),t++);t<n&&(e.push(" "),t++);continue}e.push(s[t]===`
8
+ `:" "),t++}t<s&&(e.push(" "),t++);continue}if(n[t]==="`"){for(e.push(" "),t++;t<s&&n[t]!=="`";){if(n[t]==="\\"&&t+1<s){e.push(" "),e.push(" "),t+=2;continue}if(n[t]==="$"&&n[t+1]==="{"){e.push(" "),e.push(" "),t+=2;let o=1;for(;t<s&&o>0;)n[t]==="{"&&o++,n[t]==="}"&&o--,o>0&&(e.push(n[t]),t++);t<s&&(e.push(" "),t++);continue}e.push(n[t]===`
9
9
  `?`
10
- `:" "),t++}t<n&&(e.push(" "),t++);continue}e.push(s[t]),t++}return e.join("")}function f(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function detectUsedImports(s,e,t){const n=[],o=new Set,i=b(s),c=/(?<![.\w$])([a-zA-Z_$][\w$]*)(?=\s*[<(.,:;\n\r)\]}]|$)/g;let r;for(;(r=c.exec(i))!==null;){const a=r[1];if(h.has(a)||o.has(a)||t.has(a))continue;const p=e.get(a);p&&(o.add(a),n.push(p))}return n}function isAlreadyImported(s,e){return!!(new RegExp(`import\\s*\\{[^}]*\\b${f(e)}\\b[^}]*\\}\\s*from`,"m").test(s)||new RegExp(`import\\s+${f(e)}\\s+from`,"m").test(s)||new RegExp(`import\\s*\\*\\s*as\\s+${f(e)}\\s+from`,"m").test(s))}function generateImportStatements(s){const e=new Map;for(const n of s){e.has(n.module)||e.set(n.module,{named:[],default_:null});const o=e.get(n.module);n.isDefault?o.default_===null&&(o.default_=n.name):o.named.includes(n.name)||o.named.push(n.name)}const t=[];for(const[n,o]of e){const i=[];o.default_&&i.push(o.default_),o.named.length>0&&i.push(`{ ${o.named.join(", ")} }`),i.length>0&&t.push(`import ${i.join(", ")} from '${n}'`)}return t.join(`
11
- `)}function injectImports(s,e,t){if(!e.trim())return s;if(t==="top")return d(s,e);const n=findLastImportEnd(s);return n===-1?d(s,e):s.slice(0,n)+`
10
+ `:" "),t++}t<s&&(e.push(" "),t++);continue}e.push(n[t]),t++}return e.join("")}function f(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function detectUsedImports(n,e,t){const s=[],o=new Set,i=b(n),c=/(?<![.\w$])([a-zA-Z_$][\w$]*)(?=\s*[<(.,:;\n\r)\]}]|$)/g;let r;for(;(r=c.exec(i))!==null;){const a=r[1];if(h.has(a)||o.has(a)||t.has(a))continue;const p=e.get(a);p&&(o.add(a),s.push(p))}return s}function isAlreadyImported(n,e){return!!(new RegExp(`import\\s*\\{[^}]*\\b${f(e)}\\b[^}]*\\}\\s*from`,"m").test(n)||new RegExp(`import\\s+${f(e)}\\s+from`,"m").test(n)||new RegExp(`import\\s*\\*\\s*as\\s+${f(e)}\\s+from`,"m").test(n))}function generateImportStatements(n){const e=new Map;for(const s of n){e.has(s.module)||e.set(s.module,{named:[],default_:null});const o=e.get(s.module);s.isDefault?o.default_===null&&(o.default_=s.name):o.named.includes(s.name)||o.named.push(s.name)}const t=[];for(const[s,o]of e){const i=[];o.default_&&i.push(o.default_),o.named.length>0&&i.push(`{ ${o.named.join(", ")} }`),i.length>0&&t.push(`import ${i.join(", ")} from '${s}'`)}return t.join(`
11
+ `)}function injectImports(n,e,t){if(!e.trim())return n;if(t==="top")return d$1(n,e);const s=findLastImportEnd(n);return s===-1?d$1(n,e):n.slice(0,s)+`
12
12
  `+e+`
13
- `+s.slice(n)}function d(s,e){let t=0;if(s.startsWith("#!")){const o=s.indexOf(`
14
- `);o!==-1?t=o+1:t=s.length}const n=s.slice(t).match(/^\s*["']use strict["'];?\s*\n?/);return n&&(t+=n[0].length),s.slice(0,t)+e+`
15
- `+s.slice(t)}function findLastImportEnd(s){let e=-1;const t=/^import\s+[\s\S]+?from\s+['"][^'"]+['"];?\s*$/gm;let n;for(;(n=t.exec(s))!==null;){const o=n.index+n[0].length;o>e&&(e=o)}return e}function detectVueTemplateImports(s,e,t){const n=s.match(/<template[^>]*>([\s\S]*?)<\/template>/);if(!n)return[];const o=n[1],i=[],c=/\{\{([\s\S]*?)\}\}/g;let r;for(;(r=c.exec(o))!==null;)i.push(r[1]);const a=/(?:v-[\w-]+|:[\w-]+|@[\w-]+)(?:\.[\w-]+)*="([^"]*)"/g;for(;(r=a.exec(o))!==null;)i.push(r[1]);const p=/v-model="([^"]*)"/g;for(;(r=p.exec(o))!==null;)i.push(r[1]);if(i.length===0)return[];const $=i.join(`
16
- `),m=[],x=new Set,A=/(?<![.\w$])([a-zA-Z_$][\w$]*)(?=\s*[<(.,:;\n\r)\]}]|$)/g;for(;(r=A.exec($))!==null;){const g=r[1];if(x.has(g)||t.has(g)||h.has(g)||R(g)||I(g))continue;const k=e.get(g);k&&(x.add(g),m.push(k))}return m}const y=new Set(["div","span","p","a","img","ul","ol","li","h1","h2","h3","h4","h5","h6","table","tr","td","th","thead","tbody","form","input","button","select","option","textarea","label","section","article","header","footer","nav","main","aside","script","style","link","meta","title","head","body","html","br","hr","pre","code","em","strong","b","i","u","sub","sup","small","mark","del","ins","blockquote","q","cite","abbr","dfn","kbd","samp","var","time","figure","figcaption","details","summary","dialog","menu","template","slot","component","transition","transition-group","keep-alive","teleport","suspense","video","audio","source","canvas","svg","path","circle","rect","line","polygon","iframe","embed","object","picture","area","map","base","col","colgroup","datalist","fieldset","legend","meter","optgroup","output","progress","ruby","rt","rp","wbr"]);function R(s){return y.has(s.toLowerCase())}function injectIntoScriptSetup(s,e){if(!e.trim())return s;const t=s.match(/<script\s+setup[^>]*>/);if(!t)return s;const n=t.index+t[0].length;return s.slice(0,n)+`
13
+ `+n.slice(s)}function d$1(n,e){let t=0;if(n.startsWith("#!")){const o=n.indexOf(`
14
+ `);o!==-1?t=o+1:t=n.length}const s=n.slice(t).match(/^\s*["']use strict["'];?\s*\n?/);return s&&(t+=s[0].length),n.slice(0,t)+e+`
15
+ `+n.slice(t)}function findLastImportEnd(n){let e=-1;const t=/^import\s+[\s\S]+?from\s+['"][^'"]+['"];?\s*$/gm;let s;for(;(s=t.exec(n))!==null;){const o=s.index+s[0].length;o>e&&(e=o)}return e}function detectVueTemplateImports(n,e,t){const s=n.match(/<template[^>]*>([\s\S]*?)<\/template>/);if(!s)return[];const o=s[1],i=[],c=/\{\{([\s\S]*?)\}\}/g;let r;for(;(r=c.exec(o))!==null;)i.push(r[1]);const a=/(?:v-[\w-]+|:[\w-]+|@[\w-]+)(?:\.[\w-]+)*="([^"]*)"/g;for(;(r=a.exec(o))!==null;)i.push(r[1]);const p=/v-model="([^"]*)"/g;for(;(r=p.exec(o))!==null;)i.push(r[1]);if(i.length===0)return[];const k=i.join(`
16
+ `),m=[],x=new Set,$=/(?<![.\w$])([a-zA-Z_$][\w$]*)(?=\s*[<(.,:;\n\r)\]}]|$)/g;for(;(r=$.exec(k))!==null;){const g=r[1];if(x.has(g)||t.has(g)||h.has(g)||R(g)||I(g))continue;const A=e.get(g);A&&(x.add(g),m.push(A))}return m}const y=new Set(["div","span","p","a","img","ul","ol","li","h1","h2","h3","h4","h5","h6","table","tr","td","th","thead","tbody","form","input","button","select","option","textarea","label","section","article","header","footer","nav","main","aside","script","style","link","meta","title","head","body","html","br","hr","pre","code","em","strong","b","i","u","sub","sup","small","mark","del","ins","blockquote","q","cite","abbr","dfn","kbd","samp","var","time","figure","figcaption","details","summary","dialog","menu","template","slot","component","transition","transition-group","keep-alive","teleport","suspense","video","audio","source","canvas","svg","path","circle","rect","line","polygon","iframe","embed","object","picture","area","map","base","col","colgroup","datalist","fieldset","legend","meter","optgroup","output","progress","ruby","rt","rp","wbr"]);function R(n){return y.has(n.toLowerCase())}function injectIntoScriptSetup(n,e){if(!e.trim())return n;const t=n.match(/<script\s+setup[^>]*>/);if(!t)return n;const s=t.index+t[0].length;return n.slice(0,s)+`
17
17
  `+e+`
18
- `+s.slice(n)}function isRawSfc(s){return/<script[\s>]/.test(s)}function I(s){return s.startsWith("v")&&s.length>1&&s[1]===s[1].toUpperCase()}function generateDtsContent(s){const e=[];e.push("// Auto generated by @meng-xi/vite-plugin autoImport"),e.push("// @ts-nocheck"),e.push("export {}"),e.push("");const t=new Map;for(const c of s)t.has(c.module)||t.set(c.module,[]),t.get(c.module).push(c);const n=new Set,o=new Map,i=[...t.entries()].reverse();for(const[c,r]of i){const a=[];for(const p of r)n.has(p.name)||(n.add(p.name),a.push(p));a.length>0&&o.set(c,a)}e.push("declare global {");for(const c of t.keys()){const r=o.get(c);if(r){e.push(` // from '${c}'`);for(const a of r)a.isDefault?e.push(` const ${a.name}: typeof import('${c}')['default']`):e.push(` const ${a.name}: typeof import('${c}')['${a.name}']`);e.push("")}}return e.push("}"),e.join(`
19
- `)}function writeDtsFile(s,e){common_fs_index.writeFileSyncSafely(s,e)}function shouldUpdateDts(s,e){return common_fs_index.shouldUpdateFileContent(s,e)}class j extends factory_index.BasePlugin{nameLookup=new Map;allResolvedImports=[];ignoreSet=new Set;initialized=!1;getDefaultOptions(){return{imports:{},dirs:[],dts:"src/auto-imports.d.ts",vueTemplate:!1,ignore:[],fileFilter:/^(?!.*node_modules).*\.(vue|jsx|tsx|ts|js|mjs)$/,injectAtPosition:"top"}}validateOptions(){this.validator.field("dts").custom(e=>e===!1||e===!0||typeof e=="string","dts \u5FC5\u987B\u4E3A false\u3001true \u6216\u5B57\u7B26\u4E32\u8DEF\u5F84").field("vueTemplate").boolean().field("injectAtPosition").enum(["top","after-last-import"]).validate()}getPluginName(){return"auto-import"}addPluginHooks(e){e.configResolved=()=>{this.initialize()},e.transform={order:"pre",handler:(t,n)=>!this.initialized||!this.options.fileFilter.test(n)?null:this.transformCode(t,n)},e.buildEnd=()=>{this.options.dts&&this.initialized&&this.generateDts()}}initialize(){const e=this.viteConfig?.root||process.cwd(),t=resolveImports(this.options.imports,e),n=scanDirectories(this.options.dirs,e),o=scannedModulesToImports(n);this.allResolvedImports=[...t,...o],this.nameLookup=buildNameLookup(this.allResolvedImports),this.ignoreSet=new Set(this.options.ignore),this.initialized=!0,this.logger.info(`\u521D\u59CB\u5316\u5B8C\u6210: ${this.allResolvedImports.length} \u4E2A\u81EA\u52A8\u5BFC\u5165\u6620\u5C04, ${n.length} \u4E2A\u626B\u63CF\u6A21\u5757`),this.options.dts&&this.generateDts()}transformCode(e,t){const n=t.endsWith(".vue")&&isRawSfc(e);let o=detectUsedImports(e,this.nameLookup,this.ignoreSet);if(this.options.vueTemplate&&n){const c=detectVueTemplateImports(e,this.nameLookup,this.ignoreSet),r=new Set(o.map(a=>a.name));for(const a of c)r.has(a.name)||(r.add(a.name),o.push(a))}if(o=o.filter(c=>!isAlreadyImported(e,c.name)),o.length===0)return null;const i=generateImportStatements(o);return{code:n?injectIntoScriptSetup(e,i):injectImports(e,i,this.options.injectAtPosition)}}generateDts(){if(this.allResolvedImports.length===0)return;const e=this.viteConfig?.root||process.cwd(),t=typeof this.options.dts=="string"?this.options.dts:"src/auto-imports.d.ts",n=l__default.isAbsolute(t)?t:l__default.resolve(e,t),o=generateDtsContent(this.allResolvedImports);shouldUpdateDts(n,o)&&this.safeExecuteSync(()=>{writeDtsFile(n,o),this.logger.info(`\u7C7B\u578B\u58F0\u660E\u6587\u4EF6\u5DF2\u751F\u6210: ${this.options.dts}`)},"\u751F\u6210\u7C7B\u578B\u58F0\u660E\u6587\u4EF6")}getResolvedImports(){return[...this.allResolvedImports]}getNameLookup(){return new Map(this.nameLookup)}}const autoImport=factory_index.createPluginFactory(j);exports.autoImport=autoImport;
18
+ `+n.slice(s)}function isRawSfc(n){return/<script[\s>]/.test(n)}function I(n){return n.startsWith("v")&&n.length>1&&n[1]===n[1].toUpperCase()}const d=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","as","implements","interface","let","package","private","protected","public","static","yield","abstract","any","boolean","constructor","declare","get","infer","is","keyof","module","namespace","never","readonly","require","number","object","set","string","symbol","type","undefined","unique","unknown","from","of","async","await","global"]);function generateDtsContent(n){const e=[];e.push("// Auto generated by @meng-xi/vite-plugin autoImport"),e.push("// @ts-nocheck"),e.push("export {}"),e.push("");const t=new Map;for(const c of n)t.has(c.module)||t.set(c.module,[]),t.get(c.module).push(c);const s=new Set,o=new Map,i=[...t.entries()].reverse();for(const[c,r]of i){const a=[];for(const p of r)s.has(p.name)||(s.add(p.name),a.push(p));a.length>0&&o.set(c,a)}e.push("declare global {");for(const c of t.keys()){const r=o.get(c);if(r){e.push(` // from '${c}'`);for(const a of r)d.has(a.name)||(a.isDefault?e.push(` const ${a.name}: typeof import('${c}')['default']`):e.push(` const ${a.name}: typeof import('${c}')['${a.name}']`));e.push("")}}return e.push("}"),e.join(`
19
+ `)}function writeDtsFile(n,e){common_fs_index.writeFileSyncSafely(n,e)}function shouldUpdateDts(n,e){return common_fs_index.shouldUpdateFileContent(n,e)}class j extends factory_index.BasePlugin{nameLookup=new Map;allResolvedImports=[];ignoreSet=new Set;initialized=!1;getDefaultOptions(){return{imports:{},dirs:[],dts:"src/auto-imports.d.ts",vueTemplate:!1,ignore:[],fileFilter:/^(?!.*node_modules).*\.(vue|jsx|tsx|ts|js|mjs)$/,injectAtPosition:"top"}}validateOptions(){this.validator.field("dts").custom(e=>e===!1||e===!0||typeof e=="string","dts \u5FC5\u987B\u4E3A false\u3001true \u6216\u5B57\u7B26\u4E32\u8DEF\u5F84").field("vueTemplate").boolean().field("injectAtPosition").enum(["top","after-last-import"]).validate()}getPluginName(){return"auto-import"}addPluginHooks(e){e.configResolved=()=>{this.initialize()},e.transform={order:"pre",handler:(t,s)=>!this.initialized||!this.options.fileFilter.test(s)?null:this.transformCode(t,s)},e.buildEnd=()=>{this.options.dts&&this.initialized&&this.generateDts()}}initialize(){const e=this.viteConfig?.root||process.cwd(),t=resolveImports(this.options.imports,e),s=scanDirectories(this.options.dirs,e),o=scannedModulesToImports(s);this.allResolvedImports=[...t,...o],this.nameLookup=buildNameLookup(this.allResolvedImports),this.ignoreSet=new Set(this.options.ignore),this.initialized=!0,this.logger.info(`\u521D\u59CB\u5316\u5B8C\u6210: ${this.allResolvedImports.length} \u4E2A\u81EA\u52A8\u5BFC\u5165\u6620\u5C04, ${s.length} \u4E2A\u626B\u63CF\u6A21\u5757`),this.options.dts&&this.generateDts()}transformCode(e,t){const s=t.endsWith(".vue")&&isRawSfc(e);let o=detectUsedImports(e,this.nameLookup,this.ignoreSet);if(this.options.vueTemplate&&s){const c=detectVueTemplateImports(e,this.nameLookup,this.ignoreSet),r=new Set(o.map(a=>a.name));for(const a of c)r.has(a.name)||(r.add(a.name),o.push(a))}if(o=o.filter(c=>!isAlreadyImported(e,c.name)),o.length===0)return null;const i=generateImportStatements(o);return{code:s?injectIntoScriptSetup(e,i):injectImports(e,i,this.options.injectAtPosition)}}generateDts(){if(this.allResolvedImports.length===0)return;const e=this.viteConfig?.root||process.cwd(),t=typeof this.options.dts=="string"?this.options.dts:"src/auto-imports.d.ts",s=l__default.isAbsolute(t)?t:l__default.resolve(e,t),o=generateDtsContent(this.allResolvedImports);shouldUpdateDts(s,o)&&this.safeExecuteSync(()=>{writeDtsFile(s,o),this.logger.info(`\u7C7B\u578B\u58F0\u660E\u6587\u4EF6\u5DF2\u751F\u6210: ${this.options.dts}`)},"\u751F\u6210\u7C7B\u578B\u58F0\u660E\u6587\u4EF6")}getResolvedImports(){return[...this.allResolvedImports]}getNameLookup(){return new Map(this.nameLookup)}}const autoImport=factory_index.createPluginFactory(j);exports.autoImport=autoImport;