fumadocs-mdx 13.0.8 → 14.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.
Files changed (111) hide show
  1. package/dist/bin.cjs +985 -893
  2. package/dist/bin.js +3 -3
  3. package/dist/build-mdx-6UAK5FF5.js +8 -0
  4. package/dist/bun/index.cjs +613 -471
  5. package/dist/bun/index.d.cts +9 -2
  6. package/dist/bun/index.d.ts +9 -2
  7. package/dist/bun/index.js +15 -14
  8. package/dist/chunk-4JSFLXXT.js +8 -0
  9. package/dist/chunk-5OBUOALK.js +141 -0
  10. package/dist/{chunk-2E2JCOSO.js → chunk-6NISOLQ6.js} +16 -44
  11. package/dist/chunk-7UKSZSPY.js +331 -0
  12. package/dist/chunk-BEBCWQC7.js +224 -0
  13. package/dist/chunk-E5DJTSIM.js +86 -0
  14. package/dist/{chunk-K5ZLPEIQ.js → chunk-FBLMK4RS.js} +9 -6
  15. package/dist/chunk-IQGEFL2B.js +17 -0
  16. package/dist/{chunk-5FTSWCB4.js → chunk-K6HCOGOX.js} +9 -11
  17. package/dist/{chunk-QXHN25N3.js → chunk-MTTISKQJ.js} +6 -6
  18. package/dist/{chunk-3J3WL7WN.js → chunk-SLY7WXTX.js} +71 -58
  19. package/dist/chunk-TYJDYTKH.js +85 -0
  20. package/dist/chunk-WBIHDYMN.js +126 -0
  21. package/dist/{chunk-2HXTGJBI.js → chunk-ZY6UZ7NH.js} +22 -19
  22. package/dist/config/index.cjs +79 -71
  23. package/dist/config/index.d.cts +7 -1
  24. package/dist/config/index.d.ts +7 -1
  25. package/dist/config/index.js +5 -5
  26. package/dist/core-B9ZoS6sA.d.ts +341 -0
  27. package/dist/core-DTuP23zu.d.cts +341 -0
  28. package/dist/index-BD8Woo4m.d.cts +8 -0
  29. package/dist/index-CNOvhtOn.d.ts +8 -0
  30. package/dist/index.d.cts +38 -56
  31. package/dist/index.d.ts +38 -56
  32. package/dist/load-from-file-5HUQN36V.js +8 -0
  33. package/dist/next/index.cjs +763 -473
  34. package/dist/next/index.d.cts +16 -1
  35. package/dist/next/index.d.ts +16 -1
  36. package/dist/next/index.js +80 -281
  37. package/dist/node/loader.cjs +764 -627
  38. package/dist/node/loader.js +10 -11
  39. package/dist/plugins/index-file.cjs +495 -0
  40. package/dist/plugins/index-file.d.cts +14 -0
  41. package/dist/plugins/index-file.d.ts +14 -0
  42. package/dist/plugins/index-file.js +8 -0
  43. package/dist/plugins/json-schema.d.cts +9 -2
  44. package/dist/plugins/json-schema.d.ts +9 -2
  45. package/dist/plugins/last-modified.cjs +110 -0
  46. package/dist/plugins/last-modified.d.cts +37 -0
  47. package/dist/plugins/last-modified.d.ts +37 -0
  48. package/dist/plugins/last-modified.js +74 -0
  49. package/dist/runtime/browser.cjs +93 -0
  50. package/dist/runtime/browser.d.cts +53 -0
  51. package/dist/runtime/browser.d.ts +53 -0
  52. package/dist/runtime/browser.js +67 -0
  53. package/dist/runtime/dynamic.cjs +1023 -0
  54. package/dist/runtime/dynamic.d.cts +27 -0
  55. package/dist/runtime/dynamic.d.ts +27 -0
  56. package/dist/runtime/dynamic.js +79 -0
  57. package/dist/runtime/server.cjs +176 -0
  58. package/dist/runtime/server.d.cts +14 -0
  59. package/dist/runtime/server.d.ts +14 -0
  60. package/dist/runtime/server.js +8 -0
  61. package/dist/runtime/types.cjs +18 -0
  62. package/dist/runtime/types.d.cts +61 -0
  63. package/dist/runtime/types.d.ts +61 -0
  64. package/dist/runtime/types.js +0 -0
  65. package/dist/vite/index.cjs +984 -621
  66. package/dist/vite/index.d.cts +17 -22
  67. package/dist/vite/index.d.ts +17 -22
  68. package/dist/vite/index.js +32 -222
  69. package/dist/webpack/mdx.cjs +647 -514
  70. package/dist/webpack/mdx.d.cts +15 -1
  71. package/dist/webpack/mdx.d.ts +15 -1
  72. package/dist/webpack/mdx.js +12 -17
  73. package/dist/webpack/meta.cjs +360 -231
  74. package/dist/webpack/meta.d.cts +15 -1
  75. package/dist/webpack/meta.d.ts +15 -1
  76. package/dist/webpack/meta.js +13 -15
  77. package/package.json +15 -32
  78. package/dist/build-mdx-BjXOmv0b.d.cts +0 -53
  79. package/dist/build-mdx-CY5UldCO.d.ts +0 -53
  80. package/dist/chunk-2AQRQXSO.js +0 -119
  81. package/dist/chunk-CXA4JO4Z.js +0 -45
  82. package/dist/chunk-DMJ6I4C3.js +0 -76
  83. package/dist/chunk-FSZMKRVH.js +0 -80
  84. package/dist/chunk-II3H5ZVZ.js +0 -77
  85. package/dist/chunk-KILFIBVW.js +0 -75
  86. package/dist/chunk-NVRDCY6Z.js +0 -30
  87. package/dist/chunk-VUEZTR2H.js +0 -26
  88. package/dist/core-DB7TdlyC.d.cts +0 -234
  89. package/dist/core-DB7TdlyC.d.ts +0 -234
  90. package/dist/index-D7s7kCc2.d.cts +0 -7
  91. package/dist/index-D7s7kCc2.d.ts +0 -7
  92. package/dist/load-from-file-AVYOFOI7.js +0 -7
  93. package/dist/preset-ZMP6U62C.js +0 -6
  94. package/dist/runtime/next/async.cjs +0 -760
  95. package/dist/runtime/next/async.d.cts +0 -19
  96. package/dist/runtime/next/async.d.ts +0 -19
  97. package/dist/runtime/next/async.js +0 -86
  98. package/dist/runtime/next/index.cjs +0 -136
  99. package/dist/runtime/next/index.d.cts +0 -33
  100. package/dist/runtime/next/index.d.ts +0 -33
  101. package/dist/runtime/next/index.js +0 -11
  102. package/dist/runtime/vite/browser.cjs +0 -107
  103. package/dist/runtime/vite/browser.d.cts +0 -59
  104. package/dist/runtime/vite/browser.d.ts +0 -59
  105. package/dist/runtime/vite/browser.js +0 -11
  106. package/dist/runtime/vite/server.cjs +0 -243
  107. package/dist/runtime/vite/server.d.cts +0 -30
  108. package/dist/runtime/vite/server.d.ts +0 -30
  109. package/dist/runtime/vite/server.js +0 -111
  110. package/dist/types-Bnh9n7mj.d.cts +0 -45
  111. package/dist/types-ey1AZqrg.d.ts +0 -45
@@ -1,4 +1,18 @@
1
1
  import { NextConfig } from 'next';
2
+ import { I as IndexFilePluginOptions } from '../core-DTuP23zu.cjs';
3
+ import '@mdx-js/mdx';
4
+ import '@standard-schema/spec';
5
+ import 'unified';
6
+ import 'fumadocs-core/mdx-plugins';
7
+ import 'zod';
8
+ import 'chokidar';
9
+ import 'vfile';
10
+ import 'fumadocs-core/source';
11
+ import '../runtime/types.cjs';
12
+ import 'fumadocs-core/mdx-plugins/remark-structure';
13
+ import 'fumadocs-core/toc';
14
+ import 'mdast';
15
+ import 'mdx/types';
2
16
 
3
17
  interface CreateMDXOptions {
4
18
  /**
@@ -11,8 +25,9 @@ interface CreateMDXOptions {
11
25
  * @defaultValue '.source'
12
26
  */
13
27
  outDir?: string;
28
+ index?: IndexFilePluginOptions | false;
14
29
  }
15
30
  declare function createMDX(createOptions?: CreateMDXOptions): (nextConfig?: NextConfig) => NextConfig;
16
- declare function postInstall(configPath?: string, outDir?: string): Promise<void>;
31
+ declare function postInstall(options: CreateMDXOptions): Promise<void>;
17
32
 
18
33
  export { type CreateMDXOptions, createMDX, postInstall };
@@ -1,4 +1,18 @@
1
1
  import { NextConfig } from 'next';
2
+ import { I as IndexFilePluginOptions } from '../core-B9ZoS6sA.js';
3
+ import '@mdx-js/mdx';
4
+ import '@standard-schema/spec';
5
+ import 'unified';
6
+ import 'fumadocs-core/mdx-plugins';
7
+ import 'zod';
8
+ import 'chokidar';
9
+ import 'vfile';
10
+ import 'fumadocs-core/source';
11
+ import '../runtime/types.js';
12
+ import 'fumadocs-core/mdx-plugins/remark-structure';
13
+ import 'fumadocs-core/toc';
14
+ import 'mdast';
15
+ import 'mdx/types';
2
16
 
3
17
  interface CreateMDXOptions {
4
18
  /**
@@ -11,8 +25,9 @@ interface CreateMDXOptions {
11
25
  * @defaultValue '.source'
12
26
  */
13
27
  outDir?: string;
28
+ index?: IndexFilePluginOptions | false;
14
29
  }
15
30
  declare function createMDX(createOptions?: CreateMDXOptions): (nextConfig?: NextConfig) => NextConfig;
16
- declare function postInstall(configPath?: string, outDir?: string): Promise<void>;
31
+ declare function postInstall(options: CreateMDXOptions): Promise<void>;
17
32
 
18
33
  export { type CreateMDXOptions, createMDX, postInstall };
@@ -1,263 +1,37 @@
1
1
  import {
2
2
  loadConfig
3
- } from "../chunk-QXHN25N3.js";
3
+ } from "../chunk-MTTISKQJ.js";
4
+ import "../chunk-ZY6UZ7NH.js";
5
+ import "../chunk-E5DJTSIM.js";
4
6
  import {
5
- getImportCode,
6
- toImportPath
7
- } from "../chunk-CXA4JO4Z.js";
8
- import "../chunk-2HXTGJBI.js";
9
- import {
10
- getGitTimestamp
11
- } from "../chunk-VUEZTR2H.js";
7
+ mdxLoaderGlob,
8
+ metaLoaderGlob
9
+ } from "../chunk-4JSFLXXT.js";
12
10
  import {
13
11
  ValidationError,
14
- createCore,
15
- findConfigFile,
16
- mdxLoaderGlob,
17
- validate
18
- } from "../chunk-2AQRQXSO.js";
12
+ _Defaults,
13
+ createCore
14
+ } from "../chunk-BEBCWQC7.js";
19
15
  import {
20
- fumaMatter
21
- } from "../chunk-VWJKRQZR.js";
22
-
23
- // src/next/index.ts
24
- import * as path3 from "path";
25
-
26
- // src/next/file-cache.ts
27
- import { LRUCache } from "lru-cache";
28
- import fs from "fs/promises";
29
- import path from "path";
30
- var map = new LRUCache({
31
- max: 100
32
- });
33
- function toFullPath(file) {
34
- if (path.isAbsolute(file)) {
35
- return path.relative(process.cwd(), file);
36
- }
37
- return file;
38
- }
39
- async function readFileWithCache(file) {
40
- const fullPath = toFullPath(file);
41
- const cached = map.get(fullPath);
42
- if (cached) return cached;
43
- const read = fs.readFile(fullPath).then((s) => s.toString());
44
- map.set(fullPath, read);
45
- return read;
46
- }
47
- function removeFileCache(file) {
48
- map.delete(toFullPath(file));
49
- }
50
-
51
- // src/plugins/next.ts
52
- import * as path2 from "path";
53
- import { createHash } from "crypto";
54
- import { load } from "js-yaml";
55
- function next() {
56
- let config;
57
- let shouldEmitOnChange = false;
58
- return {
59
- name: "next",
60
- config(v) {
61
- config = v;
62
- shouldEmitOnChange = config.collectionList.some((collection) => {
63
- return collection.type === "doc" && collection.async || collection.type === "docs" || collection.type === "meta";
64
- });
65
- },
66
- configureServer(server) {
67
- if (!server.watcher) return;
68
- server.watcher.on("all", async (event) => {
69
- if (event === "change" && !shouldEmitOnChange) return;
70
- await this.core.emitAndWrite({
71
- filterPlugin: (plugin) => plugin.name === "next"
72
- });
73
- });
74
- },
75
- async emit() {
76
- return [
77
- {
78
- path: "index.ts",
79
- content: await indexFile(this.configPath, config, {
80
- relativeTo: this.outDir
81
- })
82
- }
83
- ];
84
- }
85
- };
86
- }
87
- async function indexFile(configPath, config, importPath) {
88
- let asyncInit = false;
89
- const lines = [
90
- getImportCode({
91
- type: "named",
92
- names: ["_runtime"],
93
- specifier: "fumadocs-mdx/runtime/next"
94
- }),
95
- getImportCode({
96
- type: "namespace",
97
- specifier: toImportPath(configPath, importPath),
98
- name: "_source"
99
- })
100
- ];
101
- function getDocEntries(collection, files) {
102
- return files.map((file, i) => {
103
- const importId = `d_${collection.name}_${i}`;
104
- const params = [`collection=${collection.name}`];
105
- lines.unshift(
106
- getImportCode({
107
- type: "namespace",
108
- name: importId,
109
- specifier: `${toImportPath(file.fullPath, importPath)}?${params.join("&")}`
110
- })
111
- );
112
- return `{ info: ${JSON.stringify(file)}, data: ${importId} }`;
113
- });
114
- }
115
- async function getMetaEntries(collection, files) {
116
- const items = files.map(async (file) => {
117
- const source = await readFileWithCache(file.fullPath).catch(() => "");
118
- let data = source.length === 0 ? {} : parseMetaEntry(file.fullPath, source);
119
- if (collection?.schema) {
120
- data = await validate(
121
- collection.schema,
122
- data,
123
- {
124
- source,
125
- path: file.fullPath
126
- },
127
- `invalid data in ${file.fullPath}`
128
- );
129
- }
130
- return JSON.stringify({
131
- info: file,
132
- data
133
- });
134
- });
135
- return Promise.all(items);
136
- }
137
- async function getAsyncEntries(collection, files) {
138
- if (!asyncInit) {
139
- lines.unshift(
140
- getImportCode({
141
- type: "named",
142
- specifier: "fumadocs-mdx/runtime/async",
143
- names: ["_runtimeAsync", "buildConfig"]
144
- }),
145
- "const _sourceConfig = buildConfig(_source)",
146
- getImportCode({
147
- type: "default",
148
- name: "path",
149
- specifier: "node:path"
150
- })
151
- );
152
- asyncInit = true;
153
- }
154
- const entries = files.map(async (file) => {
155
- const content = await readFileWithCache(file.fullPath).catch(() => "");
156
- const parsed = fumaMatter(content);
157
- let data = parsed.data;
158
- if (collection.schema) {
159
- data = await validate(
160
- collection.schema,
161
- parsed.data,
162
- { path: file.fullPath, source: parsed.content },
163
- `invalid frontmatter in ${file.fullPath}`
164
- );
165
- }
166
- let lastModified;
167
- if (config.global?.lastModifiedTime === "git") {
168
- lastModified = await getGitTimestamp(file.fullPath);
169
- }
170
- const hash = createHash("md5").update(content).digest("hex");
171
- const infoStr = [];
172
- for (const [k, v] of Object.entries({ ...file, hash })) {
173
- infoStr.push(`${k}: ${JSON.stringify(v)}`);
174
- }
175
- infoStr.push(
176
- `absolutePath: path.resolve(${JSON.stringify(file.fullPath)})`
177
- );
178
- return `{ info: { ${infoStr.join(", ")} }, lastModified: ${JSON.stringify(lastModified)}, data: ${JSON.stringify(data)} }`;
179
- });
180
- return Promise.all(entries);
181
- }
182
- const declares = config.collectionList.map(async (collection) => {
183
- const k = collection.name;
184
- if (collection.type === "docs") {
185
- const docs = await globCollectionFiles(collection.docs);
186
- const metas = await globCollectionFiles(collection.meta);
187
- const metaEntries = (await getMetaEntries(collection.meta, metas)).join(
188
- ", "
189
- );
190
- if (collection.docs.async) {
191
- const docsEntries2 = (await getAsyncEntries(collection.docs, docs)).join(
192
- ", "
193
- );
194
- return `export const ${k} = _runtimeAsync.docs<typeof _source.${k}>([${docsEntries2}], [${metaEntries}], "${k}", _sourceConfig)`;
195
- }
196
- const docsEntries = getDocEntries(collection.docs, docs).join(", ");
197
- return `export const ${k} = _runtime.docs<typeof _source.${k}>([${docsEntries}], [${metaEntries}])`;
198
- }
199
- const files = await globCollectionFiles(collection);
200
- if (collection.type === "meta") {
201
- return `export const ${k} = _runtime.meta<typeof _source.${k}>([${(await getMetaEntries(collection, files)).join(", ")}]);`;
202
- }
203
- if (collection.async) {
204
- return `export const ${k} = _runtimeAsync.doc<typeof _source.${k}>([${(await getAsyncEntries(collection, files)).join(", ")}], "${k}", _sourceConfig)`;
205
- }
206
- return `export const ${k} = _runtime.doc<typeof _source.${k}>([${getDocEntries(collection, files).join(", ")}]);`;
207
- });
208
- const resolvedDeclares = await Promise.all(declares);
209
- return [
210
- `// @ts-nocheck -- skip type checking`,
211
- ...lines,
212
- ...resolvedDeclares
213
- ].join("\n");
214
- }
215
- function parseMetaEntry(file, content) {
216
- const extname2 = path2.extname(file);
217
- try {
218
- if (extname2 === ".json") return JSON.parse(content);
219
- if (extname2 === ".yaml") return load(content);
220
- } catch (e) {
221
- throw new Error(`Failed to parse meta file: ${file}.`, {
222
- cause: e
223
- });
224
- }
225
- throw new Error(`Unknown meta file format: ${extname2}, in ${file}.`);
226
- }
227
- async function globCollectionFiles(collection) {
228
- const { glob } = await import("tinyglobby");
229
- const files = /* @__PURE__ */ new Map();
230
- const dirs = Array.isArray(collection.dir) ? collection.dir : [collection.dir];
231
- await Promise.all(
232
- dirs.map(async (dir) => {
233
- const result = await glob(collection.patterns, {
234
- cwd: path2.resolve(dir)
235
- });
236
- for (const item of result) {
237
- if (!collection.isFileSupported(item)) continue;
238
- const fullPath = path2.join(dir, item);
239
- files.set(fullPath, {
240
- path: item,
241
- fullPath
242
- });
243
- }
244
- })
245
- );
246
- return Array.from(files.values());
247
- }
16
+ indexFile
17
+ } from "../chunk-7UKSZSPY.js";
18
+ import "../chunk-WBIHDYMN.js";
19
+ import "../chunk-VWJKRQZR.js";
248
20
 
249
21
  // src/next/index.ts
22
+ import * as path from "path";
250
23
  var defaultPageExtensions = ["mdx", "md", "jsx", "js", "tsx", "ts"];
251
24
  function createMDX(createOptions = {}) {
252
- const options = applyDefaults(createOptions);
25
+ const core = createNextCore(applyDefaults(createOptions));
253
26
  const isDev = process.env.NODE_ENV === "development";
254
27
  if (process.env._FUMADOCS_MDX !== "1") {
255
28
  process.env._FUMADOCS_MDX = "1";
256
- void init(isDev, options);
29
+ void init(isDev, core);
257
30
  }
258
31
  return (nextConfig = {}) => {
259
32
  const loaderOptions = {
260
- ...options,
33
+ ...core.getOptions(),
34
+ compiledConfigPath: core.getCompiledConfigPath(),
261
35
  isDev
262
36
  };
263
37
  const turbopack = {
@@ -272,6 +46,24 @@ function createMDX(createOptions = {}) {
272
46
  }
273
47
  ],
274
48
  as: "*.js"
49
+ },
50
+ "*.json": {
51
+ loaders: [
52
+ {
53
+ loader: "fumadocs-mdx/loader-meta",
54
+ options: loaderOptions
55
+ }
56
+ ],
57
+ as: "*.json"
58
+ },
59
+ "*.yaml": {
60
+ loaders: [
61
+ {
62
+ loader: "fumadocs-mdx/loader-meta",
63
+ options: loaderOptions
64
+ }
65
+ ],
66
+ as: "*.js"
275
67
  }
276
68
  }
277
69
  };
@@ -279,42 +71,54 @@ function createMDX(createOptions = {}) {
279
71
  ...nextConfig,
280
72
  turbopack,
281
73
  pageExtensions: nextConfig.pageExtensions ?? defaultPageExtensions,
282
- webpack: (config, options2) => {
74
+ webpack: (config, options) => {
283
75
  config.resolve ||= {};
284
76
  config.module ||= {};
285
77
  config.module.rules ||= [];
286
- config.module.rules.push({
287
- test: mdxLoaderGlob,
288
- use: [
289
- options2.defaultLoaders.babel,
290
- {
291
- loader: "fumadocs-mdx/loader-mdx",
292
- options: loaderOptions
293
- }
294
- ]
295
- });
78
+ config.module.rules.push(
79
+ {
80
+ test: mdxLoaderGlob,
81
+ use: [
82
+ options.defaultLoaders.babel,
83
+ {
84
+ loader: "fumadocs-mdx/loader-mdx",
85
+ options: loaderOptions
86
+ }
87
+ ]
88
+ },
89
+ {
90
+ test: metaLoaderGlob,
91
+ use: [
92
+ options.defaultLoaders.babel,
93
+ {
94
+ loader: "fumadocs-mdx/loader-meta",
95
+ options: loaderOptions
96
+ }
97
+ ]
98
+ }
99
+ );
296
100
  config.plugins ||= [];
297
- return nextConfig.webpack?.(config, options2) ?? config;
101
+ return nextConfig.webpack?.(config, options) ?? config;
298
102
  }
299
103
  };
300
104
  };
301
105
  }
302
- async function init(dev, options) {
303
- const core = createNextCore(options);
106
+ async function init(dev, core) {
304
107
  async function initOrReload() {
305
108
  await core.init({
306
- config: loadConfig(options.configPath, options.outDir, true)
109
+ config: loadConfig(core, true)
307
110
  });
308
111
  await core.emitAndWrite();
309
112
  }
310
113
  async function devServer() {
311
114
  const { FSWatcher } = await import("chokidar");
115
+ const { configPath, outDir } = core.getOptions();
312
116
  const watcher = new FSWatcher({
313
117
  ignoreInitial: true,
314
118
  persistent: true,
315
- ignored: [options.outDir]
119
+ ignored: [outDir]
316
120
  });
317
- watcher.add(options.configPath);
121
+ watcher.add(configPath);
318
122
  for (const collection of core.getConfig().collectionList) {
319
123
  if (collection.type === "docs") {
320
124
  watcher.add(collection.docs.dir);
@@ -326,10 +130,9 @@ async function init(dev, options) {
326
130
  watcher.on("ready", () => {
327
131
  console.log("[MDX] started dev server");
328
132
  });
329
- watcher.on("all", async (event, file) => {
330
- const absolutePath = path3.resolve(file);
331
- if (event === "change") removeFileCache(absolutePath);
332
- if (absolutePath === path3.resolve(options.configPath)) {
133
+ const absoluteConfigPath = path.resolve(configPath);
134
+ watcher.on("all", async (_event, file) => {
135
+ if (path.resolve(file) === absoluteConfigPath) {
333
136
  watcher.removeAllListeners();
334
137
  await watcher.close();
335
138
  await initOrReload();
@@ -349,32 +152,28 @@ async function init(dev, options) {
349
152
  await devServer();
350
153
  }
351
154
  }
352
- async function postInstall(configPath = findConfigFile(), outDir = ".source") {
353
- const core = await createNextCore({
354
- outDir,
355
- configPath
356
- }).init({
357
- config: loadConfig(configPath, outDir, true)
155
+ async function postInstall(options) {
156
+ const core = createNextCore(applyDefaults(options));
157
+ await core.init({
158
+ config: loadConfig(core, true)
358
159
  });
359
160
  await core.emitAndWrite();
360
161
  }
361
162
  function applyDefaults(options) {
362
163
  return {
363
- outDir: options.outDir ?? ".source",
364
- configPath: options.configPath ?? findConfigFile()
164
+ index: {},
165
+ outDir: options.outDir ?? _Defaults.outDir,
166
+ configPath: options.configPath ?? _Defaults.configPath
365
167
  };
366
168
  }
367
- function createNextCore({
368
- outDir,
369
- configPath
370
- }) {
169
+ function createNextCore(options) {
371
170
  const core = createCore(
372
171
  {
373
172
  environment: "next",
374
- outDir,
375
- configPath
173
+ outDir: options.outDir,
174
+ configPath: options.configPath
376
175
  },
377
- [next()]
176
+ [options.index && indexFile(options.index)]
378
177
  );
379
178
  return {
380
179
  ...core,
@@ -383,7 +182,7 @@ function createNextCore({
383
182
  await core.emitAndWrite(...args);
384
183
  } catch (err) {
385
184
  if (err instanceof ValidationError) {
386
- console.error(err.toStringFormatted());
185
+ console.error(await err.toStringFormatted());
387
186
  } else {
388
187
  console.error(err);
389
188
  }