fumadocs-mdx 9.0.4 → 10.0.1

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.
@@ -0,0 +1,239 @@
1
+ import {
2
+ findConfigFile,
3
+ getConfigHash,
4
+ getTypeFromPath,
5
+ loadConfig,
6
+ loadConfigCached,
7
+ writeManifest
8
+ } from "../chunk-P6WKCOD5.mjs";
9
+
10
+ // src/next/create.ts
11
+ import path3 from "node:path";
12
+
13
+ // src/map/index.ts
14
+ import path2 from "node:path";
15
+ import fs from "node:fs";
16
+
17
+ // src/map/watcher.ts
18
+ import { watch } from "chokidar";
19
+ function watcher(configPath, config) {
20
+ const deps = [configPath];
21
+ for (const collection of config.collections.values()) {
22
+ if (Array.isArray(collection.dir)) deps.push(...collection.dir);
23
+ else deps.push(collection.dir);
24
+ }
25
+ return watch(deps, {
26
+ ignoreInitial: true
27
+ });
28
+ }
29
+
30
+ // src/map/generate.ts
31
+ import path from "node:path";
32
+ import fg from "fast-glob";
33
+ async function generateJS(configPath, config, outputPath, hash) {
34
+ const outDir2 = path.dirname(outputPath);
35
+ const imports = ['import { toRuntime } from "fumadocs-mdx"'];
36
+ const importedCollections = /* @__PURE__ */ new Set();
37
+ const sources = [];
38
+ let importId = 0;
39
+ config._runtime.files.clear();
40
+ await Promise.all(
41
+ Array.from(config.collections.entries()).map(async ([name, collection]) => {
42
+ const entries = [];
43
+ const dirs = Array.isArray(collection.dir) ? collection.dir : [collection.dir];
44
+ await Promise.all(
45
+ dirs.map(async (dir) => {
46
+ const included = await fg(collection.files ?? ["**/*"], {
47
+ cwd: dir,
48
+ absolute: true
49
+ });
50
+ for (const file of included) {
51
+ if (getTypeFromPath(file) !== collection.type) continue;
52
+ if (config._runtime.files.has(file)) {
53
+ console.warn(
54
+ `[MDX] Files cannot exist in multiple collections: ${file} (${config._runtime.files.get(file) ?? ""})`
55
+ );
56
+ continue;
57
+ }
58
+ config._runtime.files.set(file, name);
59
+ const importName = `file_${(importId++).toString()}`;
60
+ imports.push(
61
+ `import * as ${importName} from ${JSON.stringify(`${toImportPath(file, outDir2)}?collection=${name}&hash=${hash}`)}`
62
+ );
63
+ const info = {
64
+ path: path.relative(dir, file),
65
+ absolutePath: file
66
+ };
67
+ entries.push(
68
+ `toRuntime("${collection.type}", ${importName}, ${JSON.stringify(info)})`
69
+ );
70
+ }
71
+ })
72
+ );
73
+ if (collection.transform) {
74
+ if (config.global) importedCollections.add("default");
75
+ importedCollections.add(name);
76
+ sources.push(
77
+ `export const ${name} = await Promise.all([${entries.join(",")}].map(v => c_${name}.transform(v, c_default)))`
78
+ );
79
+ } else {
80
+ sources.push(`export const ${name} = [${entries.join(",")}]`);
81
+ }
82
+ })
83
+ );
84
+ if (importedCollections.size > 0) {
85
+ imports.push(
86
+ `import { ${Array.from(importedCollections.values()).map((v) => `${v} as c_${v}`).join(
87
+ ", "
88
+ )} } from ${JSON.stringify(toImportPath(configPath, outDir2))}`
89
+ );
90
+ }
91
+ return [...imports, ...sources].join("\n");
92
+ }
93
+ function toImportPath(file, dir) {
94
+ let importPath = path.relative(dir, file);
95
+ if (!path.isAbsolute(importPath) && !importPath.startsWith(".")) {
96
+ importPath = `./${importPath}`;
97
+ }
98
+ return importPath.replaceAll(path.sep, "/");
99
+ }
100
+ function generateTypes(configPath, config, outputPath) {
101
+ const importPath = JSON.stringify(
102
+ toImportPath(configPath, path.dirname(outputPath))
103
+ );
104
+ const lines = [
105
+ 'import type { GetOutput } from "fumadocs-mdx/config"'
106
+ ];
107
+ for (const name of config.collections.keys()) {
108
+ lines.push(
109
+ `export declare const ${name}: GetOutput<typeof import(${importPath}).${name}>`
110
+ );
111
+ }
112
+ return lines.join("\n");
113
+ }
114
+
115
+ // src/map/index.ts
116
+ async function start(dev, configPath, outDir2) {
117
+ let configHash = await getConfigHash(configPath);
118
+ let config = await loadConfigCached(configPath, configHash);
119
+ const manifestPath = path2.resolve(outDir2, "manifest.json");
120
+ const jsOut = path2.resolve(outDir2, `index.js`);
121
+ const typeOut = path2.resolve(outDir2, `index.d.ts`);
122
+ if (dev) {
123
+ const instance = watcher(configPath, config);
124
+ instance.on("ready", () => {
125
+ console.log("[MDX] started dev server");
126
+ });
127
+ instance.on("all", (event, file) => {
128
+ const onUpdate = async () => {
129
+ const isConfigFile = path2.resolve(file) === configPath;
130
+ if (isConfigFile) {
131
+ configHash = await getConfigHash(configPath);
132
+ config = await loadConfigCached(configPath, configHash);
133
+ fs.writeFileSync(typeOut, generateTypes(configPath, config, typeOut));
134
+ console.log("[MDX] Updated map types");
135
+ }
136
+ if (isConfigFile || event !== "change") {
137
+ fs.writeFileSync(
138
+ jsOut,
139
+ await generateJS(configPath, config, jsOut, configHash)
140
+ );
141
+ console.log("[MDX] Updated map file");
142
+ }
143
+ };
144
+ void onUpdate();
145
+ });
146
+ process.on("exit", () => {
147
+ console.log("[MDX] closing dev server");
148
+ void instance.close();
149
+ });
150
+ }
151
+ fs.mkdirSync(outDir2, { recursive: true });
152
+ fs.writeFileSync(
153
+ jsOut,
154
+ await generateJS(configPath, config, jsOut, configHash)
155
+ );
156
+ fs.writeFileSync(typeOut, generateTypes(configPath, config, typeOut));
157
+ console.log("[MDX] initialized map file");
158
+ if (config.global?.generateManifest && !dev) {
159
+ process.on("exit", () => {
160
+ console.log("[MDX] writing manifest");
161
+ writeManifest(manifestPath, config);
162
+ });
163
+ }
164
+ }
165
+
166
+ // src/next/create.ts
167
+ var outDir = path3.resolve(".source");
168
+ var defaultPageExtensions = ["mdx", "md", "jsx", "js", "tsx", "ts"];
169
+ function createMDX({
170
+ configPath = findConfigFile()
171
+ } = {}) {
172
+ const isDev = process.argv.includes("dev");
173
+ const isBuild = process.argv.includes("build");
174
+ if (isDev || isBuild) {
175
+ void start(isDev, configPath, outDir);
176
+ }
177
+ return (nextConfig = {}) => {
178
+ const mdxLoaderOptions = {
179
+ _ctx: {
180
+ configPath
181
+ }
182
+ };
183
+ return {
184
+ ...nextConfig,
185
+ experimental: {
186
+ ...nextConfig.experimental,
187
+ turbo: {
188
+ ...nextConfig.experimental?.turbo,
189
+ rules: {
190
+ ...nextConfig.experimental?.turbo?.rules,
191
+ // @ts-expect-error -- safe types
192
+ "*.{md,mdx}": {
193
+ loaders: [
194
+ {
195
+ loader: "fumadocs-mdx/loader-mdx",
196
+ options: mdxLoaderOptions
197
+ }
198
+ ],
199
+ as: "*.js"
200
+ }
201
+ }
202
+ }
203
+ },
204
+ pageExtensions: nextConfig.pageExtensions ?? defaultPageExtensions,
205
+ webpack: (config, options) => {
206
+ config.resolve ||= {};
207
+ config.module ||= {};
208
+ config.module.rules ||= [];
209
+ config.module.rules.push({
210
+ test: /\.mdx?$/,
211
+ use: [
212
+ options.defaultLoaders.babel,
213
+ {
214
+ loader: "fumadocs-mdx/loader-mdx",
215
+ options: mdxLoaderOptions
216
+ }
217
+ ]
218
+ });
219
+ config.plugins ||= [];
220
+ return nextConfig.webpack?.(config, options) ?? config;
221
+ }
222
+ };
223
+ };
224
+ }
225
+
226
+ // src/postinstall.ts
227
+ import path4 from "node:path";
228
+ import fs2 from "node:fs";
229
+ async function postInstall(configPath = findConfigFile()) {
230
+ const typeOut = path4.resolve(".source/index.d.ts");
231
+ const config = await loadConfig(configPath);
232
+ fs2.mkdirSync(path4.dirname(typeOut), { recursive: true });
233
+ fs2.writeFileSync(typeOut, generateTypes(configPath, config, typeOut));
234
+ console.log("[MDX] types generated");
235
+ }
236
+ export {
237
+ createMDX,
238
+ postInstall
239
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-mdx",
3
- "version": "9.0.4",
3
+ "version": "10.0.1",
4
4
  "description": "The built-in source for Fumadocs",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -11,11 +11,14 @@
11
11
  "license": "MIT",
12
12
  "author": "Fuma Nama",
13
13
  "exports": {
14
- "./loader": "./loader.js",
15
14
  "./loader-mdx": "./loader-mdx.js",
16
15
  "./config": {
17
- "import": "./dist/config.mjs",
18
- "types": "./dist/config.d.mts"
16
+ "import": "./dist/config/index.mjs",
17
+ "types": "./dist/config/index.d.mts"
18
+ },
19
+ "./next": {
20
+ "import": "./dist/next/index.mjs",
21
+ "types": "./dist/next/index.d.mts"
19
22
  },
20
23
  ".": {
21
24
  "import": "./dist/index.mjs",
@@ -27,33 +30,41 @@
27
30
  "typesVersions": {
28
31
  "*": {
29
32
  "config": [
30
- "./dist/config.d.mts"
33
+ "./dist/config/index.d.mts"
34
+ ],
35
+ "next": [
36
+ "./dist/next/index.d.mts"
31
37
  ]
32
38
  }
33
39
  },
40
+ "bin": "./bin.mjs",
34
41
  "files": [
35
42
  "dist/*",
36
43
  "loader-mdx.js",
37
- "loader.js"
44
+ "bin.mjs"
38
45
  ],
39
46
  "dependencies": {
40
47
  "@mdx-js/mdx": "^3.0.1",
48
+ "chokidar": "^3.6.0",
41
49
  "cross-spawn": "^7.0.3",
50
+ "esbuild": "^0.23.1",
42
51
  "estree-util-value-to-estree": "^3.1.2",
43
52
  "fast-glob": "^3.3.1",
44
53
  "gray-matter": "^4.0.3",
54
+ "micromatch": "^4.0.8",
45
55
  "zod": "^3.23.8"
46
56
  },
47
57
  "devDependencies": {
48
58
  "@types/cross-spawn": "^6.0.6",
49
59
  "@types/mdast": "^4.0.3",
50
60
  "@types/mdx": "^2.0.13",
51
- "@types/react": "^18.3.3",
52
- "next": "^14.2.5",
61
+ "@types/micromatch": "^4.0.9",
62
+ "@types/react": "^18.3.5",
63
+ "next": "^14.2.7",
53
64
  "unified": "^11.0.5",
54
65
  "webpack": "^5.90.3",
55
66
  "eslint-config-custom": "0.0.0",
56
- "fumadocs-core": "13.4.1",
67
+ "fumadocs-core": "13.4.5",
57
68
  "tsconfig": "0.0.0"
58
69
  },
59
70
  "peerDependencies": {
package/dist/config.d.mts DELETED
@@ -1,45 +0,0 @@
1
- import { NextConfig } from 'next';
2
- import { StructureOptions, RemarkHeadingOptions, RemarkImageOptions, RehypeCodeOptions } from 'fumadocs-core/mdx-plugins';
3
- import { Pluggable } from 'unified';
4
- import { Options as Options$1 } from './loader-mdx.mjs';
5
- import { O as Options } from './search-index-plugin-DG9nZ1CX.mjs';
6
- import '@mdx-js/mdx';
7
- import 'webpack';
8
-
9
- type MDXOptions = Omit<NonNullable<Options$1>, 'rehypePlugins' | 'remarkPlugins'> & {
10
- rehypePlugins?: ResolvePlugins;
11
- remarkPlugins?: ResolvePlugins;
12
- /**
13
- * Properties to export from `vfile.data`
14
- */
15
- valueToExport?: string[];
16
- remarkStructureOptions?: StructureOptions | false;
17
- remarkHeadingOptions?: RemarkHeadingOptions;
18
- remarkImageOptions?: RemarkImageOptions | false;
19
- rehypeCodeOptions?: RehypeCodeOptions | false;
20
- };
21
- type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
22
- interface CreateMDXOptions {
23
- cwd?: string;
24
- mdxOptions?: MDXOptions;
25
- buildSearchIndex?: Omit<Options, 'rootContentDir' | 'rootMapFile'> | boolean;
26
- /**
27
- * Where the root map.ts should be, relative to cwd
28
- *
29
- * @defaultValue `'./.map.ts'`
30
- */
31
- rootMapPath?: string;
32
- /**
33
- * Where the content directory should be, relative to cwd
34
- *
35
- * @defaultValue `'./content'`
36
- */
37
- rootContentPath?: string;
38
- /**
39
- * {@link LoaderOptions.include}
40
- */
41
- include?: string | string[];
42
- }
43
- declare function createMDX({ mdxOptions, cwd, rootMapPath, rootContentPath, buildSearchIndex, ...loadOptions }?: CreateMDXOptions): (nextConfig?: NextConfig) => NextConfig;
44
-
45
- export { type CreateMDXOptions, createMDX as default };
package/dist/config.mjs DELETED
@@ -1,264 +0,0 @@
1
- // src/config.ts
2
- import path2 from "node:path";
3
- import {
4
- rehypeCode,
5
- remarkGfm,
6
- remarkStructure,
7
- remarkHeading,
8
- remarkImage
9
- } from "fumadocs-core/mdx-plugins";
10
-
11
- // src/webpack-plugins/map-plugin.ts
12
- import * as fs from "node:fs";
13
- var firstLoad = true;
14
- var content = `
15
- /** Auto-generated **/
16
- declare const map: Record<string, unknown>
17
-
18
- export { map }
19
- `.trim();
20
- var MapWebpackPlugin = class _MapWebpackPlugin {
21
- constructor(options) {
22
- this.options = options;
23
- }
24
- apply(compiler) {
25
- const logger = compiler.getInfrastructureLogger(_MapWebpackPlugin.name);
26
- compiler.hooks.beforeCompile.tap(_MapWebpackPlugin.name, () => {
27
- if (firstLoad && !fs.existsSync(this.options.rootMapFile)) {
28
- fs.writeFileSync(this.options.rootMapFile, content);
29
- logger.info("Created map.ts file for you automatically");
30
- firstLoad = false;
31
- }
32
- });
33
- }
34
- };
35
-
36
- // src/mdx-plugins/utils.ts
37
- import { valueToEstree } from "estree-util-value-to-estree";
38
- function getMdastExport(name, value) {
39
- return {
40
- type: "mdxjsEsm",
41
- value: "",
42
- data: {
43
- estree: {
44
- type: "Program",
45
- sourceType: "module",
46
- body: [
47
- {
48
- type: "ExportNamedDeclaration",
49
- specifiers: [],
50
- source: null,
51
- declaration: {
52
- type: "VariableDeclaration",
53
- kind: "let",
54
- declarations: [
55
- {
56
- type: "VariableDeclarator",
57
- id: {
58
- type: "Identifier",
59
- name
60
- },
61
- init: valueToEstree(value)
62
- }
63
- ]
64
- }
65
- }
66
- ]
67
- }
68
- }
69
- };
70
- }
71
-
72
- // src/mdx-plugins/remark-exports.ts
73
- function remarkMdxExport({ values }) {
74
- return (tree, vfile) => {
75
- for (const name of values) {
76
- if (!(name in vfile.data)) return;
77
- tree.children.unshift(getMdastExport(name, vfile.data[name]));
78
- }
79
- };
80
- }
81
-
82
- // src/webpack-plugins/search-index-plugin.ts
83
- import * as path from "node:path";
84
- import { createRequire } from "node:module";
85
- import { createGetUrl, getSlugs, parseFilePath } from "fumadocs-core/source";
86
- var require2 = createRequire(import.meta.url);
87
- var pkg = require2("next/dist/compiled/webpack/webpack.js");
88
- var SearchIndexPlugin = class _SearchIndexPlugin {
89
- constructor(options) {
90
- this.options = options;
91
- }
92
- apply(compiler) {
93
- const {
94
- rootContentDir,
95
- productionOnly = true,
96
- filter = () => true,
97
- getUrl = (file) => {
98
- return createGetUrl("/")(getSlugs(parseFilePath(file)));
99
- }
100
- } = this.options;
101
- const logger = compiler.getInfrastructureLogger(_SearchIndexPlugin.name);
102
- const isProduction = process.env.NODE_ENV === "production";
103
- if (productionOnly && !isProduction) return;
104
- compiler.hooks.compilation.tap(_SearchIndexPlugin.name, (compilation) => {
105
- if (compilation.name !== "server") return;
106
- compilation.hooks.processAssets.tap(
107
- {
108
- name: _SearchIndexPlugin.name,
109
- stage: pkg.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
110
- },
111
- () => {
112
- const indexFiles = /* @__PURE__ */ new Map();
113
- for (const m of compilation.modules.values()) {
114
- if (!m.buildInfo || !("__fumadocs" in m.buildInfo)) continue;
115
- const info = m.buildInfo.__fumadocs;
116
- const relativePath = path.relative(rootContentDir, info.path);
117
- if (relativePath.startsWith("../") || !filter(relativePath))
118
- continue;
119
- indexFiles.set(info.path, {
120
- id: info.path,
121
- structuredData: info.data.structuredData,
122
- title: info.data.frontmatter.title,
123
- description: info.data.frontmatter.description,
124
- url: getUrl(relativePath),
125
- _data: info.data
126
- });
127
- }
128
- compilation.emitAsset(
129
- "fumadocs_search.json",
130
- new pkg.sources.RawSource(
131
- JSON.stringify(Array.from(indexFiles.values()))
132
- )
133
- );
134
- logger.info("Generated Search Indexes");
135
- }
136
- );
137
- });
138
- }
139
- };
140
-
141
- // src/config.ts
142
- function pluginOption(def, options = []) {
143
- const list = def(Array.isArray(options) ? options : []).filter(
144
- Boolean
145
- );
146
- if (typeof options === "function") {
147
- return options(list);
148
- }
149
- return list;
150
- }
151
- function getMDXLoaderOptions({
152
- valueToExport = [],
153
- rehypeCodeOptions,
154
- remarkImageOptions,
155
- remarkHeadingOptions,
156
- remarkStructureOptions,
157
- ...mdxOptions
158
- }) {
159
- const mdxExports = [
160
- "structuredData",
161
- "toc",
162
- "frontmatter",
163
- "lastModified",
164
- ...valueToExport
165
- ];
166
- const remarkPlugins = pluginOption(
167
- (v) => [
168
- remarkGfm,
169
- [remarkHeading, remarkHeadingOptions],
170
- remarkImageOptions !== false && [remarkImage, remarkImageOptions],
171
- ...v,
172
- remarkStructureOptions !== false && [
173
- remarkStructure,
174
- remarkStructureOptions
175
- ],
176
- [remarkMdxExport, { values: mdxExports }]
177
- ],
178
- mdxOptions.remarkPlugins
179
- );
180
- const rehypePlugins = pluginOption(
181
- (v) => [
182
- rehypeCodeOptions !== false && [rehypeCode, rehypeCodeOptions],
183
- ...v
184
- ],
185
- mdxOptions.rehypePlugins
186
- );
187
- return {
188
- providerImportSource: "next-mdx-import-source-file",
189
- ...mdxOptions,
190
- remarkPlugins,
191
- rehypePlugins
192
- };
193
- }
194
- var defaultPageExtensions = ["mdx", "md", "jsx", "js", "tsx", "ts"];
195
- function createMDX({
196
- mdxOptions = {},
197
- cwd = process.cwd(),
198
- rootMapPath = "./.map.ts",
199
- rootContentPath = "./content",
200
- buildSearchIndex = false,
201
- ...loadOptions
202
- } = {}) {
203
- const rootMapFile = path2.resolve(cwd, rootMapPath);
204
- const rootContentDir = path2.resolve(cwd, rootContentPath);
205
- const mdxLoaderOptions = getMDXLoaderOptions(mdxOptions);
206
- return (nextConfig = {}) => {
207
- return {
208
- ...nextConfig,
209
- pageExtensions: nextConfig.pageExtensions ?? defaultPageExtensions,
210
- webpack: (config, options) => {
211
- config.resolve ||= {};
212
- const alias = config.resolve.alias;
213
- alias["next-mdx-import-source-file"] = [
214
- "private-next-root-dir/src/mdx-components",
215
- "private-next-root-dir/mdx-components",
216
- "@mdx-js/react"
217
- ];
218
- config.module ||= {};
219
- config.module.rules ||= [];
220
- config.module.rules.push(
221
- {
222
- test: /\.mdx?$/,
223
- use: [
224
- options.defaultLoaders.babel,
225
- {
226
- loader: "fumadocs-mdx/loader-mdx",
227
- options: mdxLoaderOptions
228
- }
229
- ]
230
- },
231
- {
232
- test: rootMapFile,
233
- use: {
234
- loader: "fumadocs-mdx/loader",
235
- options: {
236
- rootContentDir,
237
- rootMapFile,
238
- ...loadOptions
239
- }
240
- }
241
- }
242
- );
243
- config.plugins ||= [];
244
- config.plugins.push(
245
- new MapWebpackPlugin({
246
- rootMapFile
247
- })
248
- );
249
- if (buildSearchIndex !== false)
250
- config.plugins.push(
251
- new SearchIndexPlugin({
252
- rootContentDir,
253
- rootMapFile,
254
- ...typeof buildSearchIndex === "object" ? buildSearchIndex : {}
255
- })
256
- );
257
- return nextConfig.webpack?.(config, options) ?? config;
258
- }
259
- };
260
- };
261
- }
262
- export {
263
- createMDX as default
264
- };
package/dist/loader.d.mts DELETED
@@ -1,18 +0,0 @@
1
- import { LoaderContext } from 'webpack';
2
-
3
- interface LoaderOptions {
4
- rootContentDir: string;
5
- rootMapFile: string;
6
- /**
7
- * Included files in the map file
8
- *
9
- * @defaultValue '.&#47;**&#47;*.&#123;md,mdx,json&#125;'
10
- */
11
- include?: string | string[];
12
- }
13
- /**
14
- * Load the root `.map.ts` file
15
- */
16
- declare function loader(this: LoaderContext<LoaderOptions>, _source: string, callback: LoaderContext<LoaderOptions>['callback']): void;
17
-
18
- export { type LoaderOptions, loader as default };
package/dist/loader.mjs DELETED
@@ -1,36 +0,0 @@
1
- // src/loader.ts
2
- import path from "node:path";
3
- import fg from "fast-glob";
4
- function loader(_source, callback) {
5
- const options = this.getOptions();
6
- this.cacheable(true);
7
- this.addContextDependency(options.rootContentDir);
8
- callback(null, buildMap(options));
9
- }
10
- function buildMap({
11
- rootContentDir,
12
- rootMapFile,
13
- include = ["./**/*.{md,mdx,json}"]
14
- }) {
15
- const mapDir = path.dirname(rootMapFile);
16
- const files = fg.sync(include, {
17
- cwd: rootContentDir
18
- });
19
- const imports = [];
20
- const entries = [];
21
- files.forEach((file, i) => {
22
- let importPath = path.relative(mapDir, path.join(rootContentDir, file)).replaceAll(path.sep, "/");
23
- if (!importPath.startsWith(".")) {
24
- importPath = `./${importPath}`;
25
- }
26
- const name = `file_${i.toString()}`;
27
- imports.push(`import * as ${name} from ${JSON.stringify(importPath)};`);
28
- entries.push(`${JSON.stringify(file)}: ${name}`);
29
- });
30
- return [imports.join("\n"), `export const map = {${entries.join(",")}}`].join(
31
- "\n"
32
- );
33
- }
34
- export {
35
- loader as default
36
- };