fuma-content 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{async-cache-C0J_pTbk.js → async-cache-U87GzQTb.js} +1 -1
- package/dist/{async-cache-C0J_pTbk.js.map → async-cache-U87GzQTb.js.map} +1 -1
- package/dist/{build-mdx-DugsQ0sk.js → build-mdx-BZxE8t2a.js} +14 -9
- package/dist/build-mdx-BZxE8t2a.js.map +1 -0
- package/dist/build-mdx-LhpFasX-.js +4 -0
- package/dist/bun/index.d.ts +7 -4
- package/dist/bun/index.d.ts.map +1 -1
- package/dist/bun/index.js +25 -14
- package/dist/bun/index.js.map +1 -1
- package/dist/{bun-Br1ReMiq.js → bun-CBROq3I0.js} +2 -2
- package/dist/bun-CBROq3I0.js.map +1 -0
- package/dist/code-generator-CjC4EEXg.js +102 -0
- package/dist/code-generator-CjC4EEXg.js.map +1 -0
- package/dist/collections/data/runtime.d.ts +15 -0
- package/dist/collections/data/runtime.d.ts.map +1 -0
- package/dist/collections/{meta → data}/runtime.js +4 -4
- package/dist/collections/data/runtime.js.map +1 -0
- package/dist/collections/data.d.ts +47 -0
- package/dist/collections/data.d.ts.map +1 -0
- package/dist/collections/data.js +5 -0
- package/dist/collections/fs.d.ts +3 -0
- package/dist/collections/fs.js +3 -0
- package/dist/collections/index.d.ts +2 -2
- package/dist/collections/index.js +2 -15
- package/dist/collections/json/loader-webpack.d.ts +9 -0
- package/dist/collections/json/loader-webpack.d.ts.map +1 -0
- package/dist/collections/json/loader-webpack.js +15 -0
- package/dist/collections/json/loader-webpack.js.map +1 -0
- package/dist/collections/mdx/loader-webpack.d.ts +5 -5
- package/dist/collections/mdx/loader-webpack.d.ts.map +1 -1
- package/dist/collections/mdx/loader-webpack.js +11 -21
- package/dist/collections/mdx/loader-webpack.js.map +1 -1
- package/dist/collections/mdx/react.d.ts +22 -0
- package/dist/collections/mdx/react.d.ts.map +1 -0
- package/dist/collections/mdx/react.js +35 -0
- package/dist/collections/mdx/react.js.map +1 -0
- package/dist/collections/mdx/runtime-browser.d.ts +11 -45
- package/dist/collections/mdx/runtime-browser.js +6 -44
- package/dist/collections/mdx/runtime-browser.js.map +1 -1
- package/dist/collections/mdx/runtime-dynamic.d.ts +16 -28
- package/dist/collections/mdx/runtime-dynamic.d.ts.map +1 -1
- package/dist/collections/mdx/runtime-dynamic.js +17 -20
- package/dist/collections/mdx/runtime-dynamic.js.map +1 -1
- package/dist/collections/mdx/runtime.d.ts +10 -49
- package/dist/collections/mdx/runtime.js +2 -11
- package/dist/collections/mdx/runtime.js.map +1 -1
- package/dist/collections/mdx.d.ts +6 -2
- package/dist/collections/mdx.js +6 -247
- package/dist/collections/runtime/file-store.d.ts +4 -22
- package/dist/collections/runtime/file-store.js +15 -14
- package/dist/collections/runtime/file-store.js.map +1 -1
- package/dist/collections/runtime/store.d.ts +3 -3
- package/dist/collections/runtime/store.js +2 -2
- package/dist/collections/yaml/loader-webpack.d.ts +9 -0
- package/dist/collections/yaml/loader-webpack.d.ts.map +1 -0
- package/dist/collections/yaml/loader-webpack.js +15 -0
- package/dist/collections/yaml/loader-webpack.js.map +1 -0
- package/dist/collections-DNFRdCuB.js +98 -0
- package/dist/collections-DNFRdCuB.js.map +1 -0
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/core-BO3b8jMg.d.ts +313 -0
- package/dist/core-BO3b8jMg.d.ts.map +1 -0
- package/dist/{core-CnZQDCJ1.js → core-D5QHSKk6.js} +65 -47
- package/dist/core-D5QHSKk6.js.map +1 -0
- package/dist/data-9h98oZwj.js +158 -0
- package/dist/data-9h98oZwj.js.map +1 -0
- package/dist/dynamic-CTYYdl7_.d.ts +33 -0
- package/dist/dynamic-CTYYdl7_.d.ts.map +1 -0
- package/dist/dynamic-DhKTOrIl.js +29 -0
- package/dist/dynamic-DhKTOrIl.js.map +1 -0
- package/dist/dynamic.d.ts +3 -24
- package/dist/dynamic.js +2 -27
- package/dist/file-store-laO4IjvB.d.ts +21 -0
- package/dist/file-store-laO4IjvB.d.ts.map +1 -0
- package/dist/fs-D34Sztbh.d.ts +44 -0
- package/dist/fs-D34Sztbh.d.ts.map +1 -0
- package/dist/fs-WWbLA7Gx.js +66 -0
- package/dist/fs-WWbLA7Gx.js.map +1 -0
- package/dist/{fuma-matter-D3kkMkdj.js → fuma-matter-BuBO2w-p.js} +1 -1
- package/dist/{fuma-matter-D3kkMkdj.js.map → fuma-matter-BuBO2w-p.js.map} +1 -1
- package/dist/git-2CjUW3M5.d.ts +37 -0
- package/dist/git-2CjUW3M5.d.ts.map +1 -0
- package/dist/git-CQWA37-X.js +60 -0
- package/dist/git-CQWA37-X.js.map +1 -0
- package/dist/index-Da88Sj8w.d.ts +87 -0
- package/dist/index-Da88Sj8w.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -5
- package/dist/load-from-file-BZxc_BhC.js +3 -0
- package/dist/{load-from-file-XiM8eZha.js → load-from-file-irx0JI6j.js} +4 -6
- package/dist/load-from-file-irx0JI6j.js.map +1 -0
- package/dist/loader-AIEwGc2f.js +9 -0
- package/dist/loader-BhXHF8vy.js +16 -0
- package/dist/loader-BhXHF8vy.js.map +1 -0
- package/dist/loader-BuR4gkKg.js +77 -0
- package/dist/loader-BuR4gkKg.js.map +1 -0
- package/dist/loader-BzQpSBvP.js +59 -0
- package/dist/loader-BzQpSBvP.js.map +1 -0
- package/dist/{loader-C7W_Rwj8.js → loader-D6StkShK.js} +7 -6
- package/dist/loader-D6StkShK.js.map +1 -0
- package/dist/loader-DCK4RwOh.js +8 -0
- package/dist/loader-DwpOcxgh.js +17 -0
- package/dist/loader-DwpOcxgh.js.map +1 -0
- package/dist/loader-zsTVgQjO.js +8 -0
- package/dist/mdx-Dt9hirUu.d.ts +144 -0
- package/dist/mdx-Dt9hirUu.d.ts.map +1 -0
- package/dist/mdx-iZ2uP27Z.js +303 -0
- package/dist/mdx-iZ2uP27Z.js.map +1 -0
- package/dist/next/index.d.ts +6 -10
- package/dist/next/index.d.ts.map +1 -1
- package/dist/next/index.js +20 -28
- package/dist/next/index.js.map +1 -1
- package/dist/node/index.d.ts +8 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +10 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/loader.d.ts +5 -2
- package/dist/node/loader.d.ts.map +1 -1
- package/dist/node/loader.js +17 -11
- package/dist/node/loader.js.map +1 -1
- package/dist/{node-CVAU22o3.js → node-2VZOh3P9.js} +7 -5
- package/dist/node-2VZOh3P9.js.map +1 -0
- package/dist/plugins/git.d.ts +3 -2
- package/dist/plugins/git.js +2 -61
- package/dist/plugins/json-schema.d.ts +26 -2
- package/dist/plugins/json-schema.d.ts.map +1 -0
- package/dist/plugins/json-schema.js +41 -50
- package/dist/plugins/json-schema.js.map +1 -1
- package/dist/plugins/loader/index.d.ts +4 -0
- package/dist/plugins/loader/index.js +3 -0
- package/dist/plugins/loader/webpack.d.ts +4 -0
- package/dist/plugins/loader/webpack.js +60 -0
- package/dist/plugins/loader/webpack.js.map +1 -0
- package/dist/runtime-HN-HSB0Z.d.ts +31 -0
- package/dist/runtime-HN-HSB0Z.d.ts.map +1 -0
- package/dist/runtime-browser-BQEk7qjc.d.ts +29 -0
- package/dist/runtime-browser-BQEk7qjc.d.ts.map +1 -0
- package/dist/store-DiuGdV5M.d.ts +31 -0
- package/dist/store-DiuGdV5M.d.ts.map +1 -0
- package/dist/{store-D166MOLw.js → store-IvpEBdxi.js} +4 -4
- package/dist/store-IvpEBdxi.js.map +1 -0
- package/dist/{validation-BYUzZIfc.js → validation-BvVvvLII.js} +1 -1
- package/dist/{validation-BYUzZIfc.js.map → validation-BvVvvLII.js.map} +1 -1
- package/dist/vite/index.d.ts +5 -15
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +18 -21
- package/dist/vite/index.js.map +1 -1
- package/dist/{vite-6awgG092.js → vite-C1qXY47G.js} +2 -2
- package/dist/vite-C1qXY47G.js.map +1 -0
- package/package.json +19 -18
- package/dist/build-mdx-CSrSOQxF.js +0 -4
- package/dist/build-mdx-DugsQ0sk.js.map +0 -1
- package/dist/bun-Br1ReMiq.js.map +0 -1
- package/dist/code-generator-BvuyL0UO.js +0 -133
- package/dist/code-generator-BvuyL0UO.js.map +0 -1
- package/dist/collections/handlers/fs.d.ts +0 -2
- package/dist/collections/handlers/fs.js +0 -31
- package/dist/collections/handlers/fs.js.map +0 -1
- package/dist/collections/index.js.map +0 -1
- package/dist/collections/mdx/runtime-browser.d.ts.map +0 -1
- package/dist/collections/mdx/runtime.d.ts.map +0 -1
- package/dist/collections/mdx.js.map +0 -1
- package/dist/collections/meta/loader-webpack.d.ts +0 -9
- package/dist/collections/meta/loader-webpack.d.ts.map +0 -1
- package/dist/collections/meta/loader-webpack.js +0 -25
- package/dist/collections/meta/loader-webpack.js.map +0 -1
- package/dist/collections/meta/runtime.d.ts +0 -11
- package/dist/collections/meta/runtime.d.ts.map +0 -1
- package/dist/collections/meta/runtime.js.map +0 -1
- package/dist/collections/meta.d.ts +0 -2
- package/dist/collections/meta.js +0 -131
- package/dist/collections/meta.js.map +0 -1
- package/dist/collections/runtime/file-store.d.ts.map +0 -1
- package/dist/core-CRWvbE7W.d.ts +0 -588
- package/dist/core-CRWvbE7W.d.ts.map +0 -1
- package/dist/core-CnZQDCJ1.js.map +0 -1
- package/dist/dynamic.d.ts.map +0 -1
- package/dist/dynamic.js.map +0 -1
- package/dist/load-from-file-BctwhOUd.js +0 -3
- package/dist/load-from-file-XiM8eZha.js.map +0 -1
- package/dist/loader-BHMDOncZ.js +0 -4
- package/dist/loader-C7W_Rwj8.js.map +0 -1
- package/dist/loader-DLSJPUiO.js +0 -69
- package/dist/loader-DLSJPUiO.js.map +0 -1
- package/dist/loader-DkmGoUvo.js +0 -4
- package/dist/next/index.cjs +0 -497
- package/dist/node-CVAU22o3.js.map +0 -1
- package/dist/pipe-UEMV1mRg.js +0 -31
- package/dist/pipe-UEMV1mRg.js.map +0 -1
- package/dist/plugins/git.js.map +0 -1
- package/dist/plugins/with-loader/index.d.ts +0 -2
- package/dist/plugins/with-loader/index.js +0 -28
- package/dist/plugins/with-loader/index.js.map +0 -1
- package/dist/plugins/with-loader/webpack.d.ts +0 -19
- package/dist/plugins/with-loader/webpack.d.ts.map +0 -1
- package/dist/plugins/with-loader/webpack.js +0 -43
- package/dist/plugins/with-loader/webpack.js.map +0 -1
- package/dist/store-BtGmZUAC.d.ts +0 -31
- package/dist/store-BtGmZUAC.d.ts.map +0 -1
- package/dist/store-D166MOLw.js.map +0 -1
- package/dist/vite-6awgG092.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-cache-
|
|
1
|
+
{"version":3,"file":"async-cache-U87GzQTb.js","names":[],"sources":["../src/utils/async-cache.ts"],"sourcesContent":["export interface AsyncCache<V> {\n cached: (key: string, fn: () => V | Promise<V>) => V | Promise<V>;\n $value: <T>() => AsyncCache<T>;\n invalidate: (key: string) => void;\n}\n\n/**\n * cache for async resources, finished promises will be resolved into original value, otherwise wrapped with a promise.\n */\nexport function createCache<V>(store = new Map<string, V | Promise<V>>()): AsyncCache<V> {\n return {\n cached(key, fn) {\n let cached = store.get(key);\n if (cached) return cached;\n\n cached = fn();\n if (cached instanceof Promise) {\n cached = cached.then((out) => {\n // replace with resolved if still exists\n if (store.has(key)) {\n store.set(key, out);\n }\n\n return out;\n });\n }\n store.set(key, cached);\n return cached;\n },\n invalidate(key) {\n store.delete(key);\n },\n $value<T>() {\n return this as unknown as AsyncCache<T>;\n },\n };\n}\n"],"mappings":";;;;AASA,SAAgB,YAAe,wBAAQ,IAAI,KAA6B,EAAiB;AACvF,QAAO;EACL,OAAO,KAAK,IAAI;GACd,IAAI,SAAS,MAAM,IAAI,IAAI;AAC3B,OAAI,OAAQ,QAAO;AAEnB,YAAS,IAAI;AACb,OAAI,kBAAkB,QACpB,UAAS,OAAO,MAAM,QAAQ;AAE5B,QAAI,MAAM,IAAI,IAAI,CAChB,OAAM,IAAI,KAAK,IAAI;AAGrB,WAAO;KACP;AAEJ,SAAM,IAAI,KAAK,OAAO;AACtB,UAAO;;EAET,WAAW,KAAK;AACd,SAAM,OAAO,IAAI;;EAEnB,SAAY;AACV,UAAO;;EAEV"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createCache } from "./async-cache-
|
|
2
|
-
import { t as fumaMatter } from "./fuma-matter-
|
|
1
|
+
import { t as createCache } from "./async-cache-U87GzQTb.js";
|
|
2
|
+
import { t as fumaMatter } from "./fuma-matter-BuBO2w-p.js";
|
|
3
3
|
import * as fs$1 from "node:fs/promises";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
5
5
|
import { createProcessor } from "@mdx-js/mdx";
|
|
@@ -273,10 +273,16 @@ function remarkPostprocess({ _format, includeProcessedMarkdown = false, includeM
|
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
275
|
if (includeProcessedMarkdown) {
|
|
276
|
+
const { headingIds = true } = typeof includeProcessedMarkdown === "object" ? includeProcessedMarkdown : {};
|
|
276
277
|
const processor = getStringifyProcessor();
|
|
277
278
|
const markdown = toMarkdown(tree, {
|
|
278
279
|
...processor.data("settings"),
|
|
279
|
-
extensions: processor.data("toMarkdownExtensions") || []
|
|
280
|
+
extensions: processor.data("toMarkdownExtensions") || [],
|
|
281
|
+
handlers: { heading: (node) => {
|
|
282
|
+
const id = node.data?.hProperties?.id;
|
|
283
|
+
const content = flattenNode(node);
|
|
284
|
+
return headingIds && id ? `${content} [#${id}]` : content;
|
|
285
|
+
} }
|
|
280
286
|
});
|
|
281
287
|
file.data["mdx-export"].push({
|
|
282
288
|
name: "_markdown",
|
|
@@ -346,16 +352,15 @@ function remarkPreprocess(options) {
|
|
|
346
352
|
//#endregion
|
|
347
353
|
//#region src/collections/mdx/build-mdx.ts
|
|
348
354
|
async function buildMDX(core, collection, { filePath, frontmatter, source, _compiler, environment, isDevelopment }) {
|
|
349
|
-
const handler = collection?.handlers.mdx;
|
|
350
355
|
const processorCache = createCache(core.cache).$value();
|
|
351
356
|
function getProcessor(format) {
|
|
352
357
|
const key = `build-mdx:${collection?.name ?? "global"}:${format}`;
|
|
353
358
|
return processorCache.cached(key, async () => {
|
|
354
|
-
const mdxOptions = await
|
|
355
|
-
const preprocessPlugin = [remarkPreprocess,
|
|
359
|
+
const mdxOptions = await collection?.getMDXOptions?.(environment);
|
|
360
|
+
const preprocessPlugin = [remarkPreprocess, collection?.preprocess];
|
|
356
361
|
const postprocessOptions = {
|
|
357
362
|
_format: format,
|
|
358
|
-
...
|
|
363
|
+
...collection?.postprocess
|
|
359
364
|
};
|
|
360
365
|
const remarkIncludeOptions = { preprocess: [preprocessPlugin] };
|
|
361
366
|
return createProcessor({
|
|
@@ -382,7 +387,7 @@ async function buildMDX(core, collection, { filePath, frontmatter, source, _comp
|
|
|
382
387
|
_getProcessor: getProcessor
|
|
383
388
|
}
|
|
384
389
|
});
|
|
385
|
-
if (collection &&
|
|
390
|
+
if (collection && collection) vfile = await collection.vfile.run(vfile, {
|
|
386
391
|
collection,
|
|
387
392
|
filePath,
|
|
388
393
|
source
|
|
@@ -392,4 +397,4 @@ async function buildMDX(core, collection, { filePath, frontmatter, source, _comp
|
|
|
392
397
|
|
|
393
398
|
//#endregion
|
|
394
399
|
export { buildMDX as t };
|
|
395
|
-
//# sourceMappingURL=build-mdx-
|
|
400
|
+
//# sourceMappingURL=build-mdx-BZxE8t2a.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-mdx-BZxE8t2a.js","names":["newChildren: RootContent[]","ElementLikeTypes: ElementLikeContent[\"type\"][]","attributes: Record<string, string | null>","nodes: RootContent[] | undefined","extractedLines: string[]","content: string","fs","path","queue: Promise<void>[]","_stringifyProcessor: Processor | undefined","urls: ExtractedReference[]","postprocessOptions: PostprocessOptions","remarkIncludeOptions: RemarkIncludeOptions"],"sources":["../src/collections/mdx/remark-unravel.ts","../src/collections/mdx/mdast-utils.ts","../src/collections/mdx/remark-include.ts","../src/collections/mdx/remark-postprocess.ts","../src/collections/mdx/remark-preprocess.ts","../src/collections/mdx/build-mdx.ts"],"sourcesContent":["// from internal remark plugins in https://github.com/mdx-js/mdx/blob/main/packages/mdx/lib/plugin/remark-mark-and-unravel.js\n// we need to ensure consistency with MDX.js when parsing embed content in `remark-include`\nimport { visit } from \"unist-util-visit\";\nimport type { Transformer } from \"unified\";\nimport type { Root, RootContent } from \"mdast\";\n\nexport function remarkMarkAndUnravel(): Transformer<Root, Root> {\n return (tree) => {\n visit(tree, (node, index, parent) => {\n let offset = -1;\n let all = true;\n let oneOrMore = false;\n\n if (parent && typeof index === \"number\" && node.type === \"paragraph\") {\n const children = node.children;\n\n while (++offset < children.length) {\n const child = children[offset];\n\n if (child.type === \"mdxJsxTextElement\" || child.type === \"mdxTextExpression\") {\n oneOrMore = true;\n } else if (child.type === \"text\" && child.value.trim().length === 0) {\n // Empty.\n } else {\n all = false;\n break;\n }\n }\n\n if (all && oneOrMore) {\n offset = -1;\n const newChildren: RootContent[] = [];\n\n while (++offset < children.length) {\n const child = children[offset];\n\n if (child.type === \"mdxJsxTextElement\") {\n // @ts-expect-error: mutate because it is faster; content model is fine.\n child.type = \"mdxJsxFlowElement\";\n }\n\n if (child.type === \"mdxTextExpression\") {\n // @ts-expect-error: mutate because it is faster; content model is fine.\n child.type = \"mdxFlowExpression\";\n }\n\n if (child.type === \"text\" && /^[\\t\\r\\n ]+$/.test(String(child.value))) {\n // Empty.\n } else {\n newChildren.push(child);\n }\n }\n\n parent.children.splice(index, 1, ...newChildren);\n return index;\n }\n }\n });\n };\n}\n","import type { RootContent } from \"mdast\";\n\nexport function flattenNode(node: RootContent): string {\n if (\"children\" in node) return node.children.map((child) => flattenNode(child)).join(\"\");\n\n if (\"value\" in node) return node.value;\n\n return \"\";\n}\n","import { type PluggableList, type Processor, type Transformer, unified } from \"unified\";\nimport { visit } from \"unist-util-visit\";\nimport type { Code, Node, Root, RootContent } from \"mdast\";\nimport * as path from \"node:path\";\nimport * as fs from \"node:fs/promises\";\nimport { fumaMatter } from \"@/collections/mdx/fuma-matter\";\nimport type { MdxJsxFlowElement, MdxJsxTextElement } from \"mdast-util-mdx-jsx\";\nimport { VFile } from \"vfile\";\nimport type { Directives } from \"mdast-util-directive\";\nimport { remarkMarkAndUnravel } from \"@/collections/mdx/remark-unravel\";\nimport { flattenNode } from \"./mdast-utils\";\n\nexport interface Params {\n lang?: string;\n meta?: string;\n}\n\nconst ElementLikeTypes: ElementLikeContent[\"type\"][] = [\n \"mdxJsxFlowElement\",\n \"mdxJsxTextElement\",\n \"containerDirective\",\n \"textDirective\",\n \"leafDirective\",\n];\ntype ElementLikeContent = MdxJsxFlowElement | MdxJsxTextElement | Directives;\n\nfunction isElementLike(node: Node): node is ElementLikeContent {\n return ElementLikeTypes.includes(node.type as ElementLikeContent[\"type\"]);\n}\n\nfunction parseElementAttributes(\n element: ElementLikeContent,\n): Record<string, string | null | undefined> {\n if (Array.isArray(element.attributes)) {\n const attributes: Record<string, string | null> = {};\n\n for (const attr of element.attributes) {\n if (\n attr.type === \"mdxJsxAttribute\" &&\n (typeof attr.value === \"string\" || attr.value === null)\n ) {\n attributes[attr.name] = attr.value;\n }\n }\n\n return attributes;\n }\n\n return element.attributes ?? {};\n}\n\nfunction parseSpecifier(specifier: string): {\n file: string;\n section?: string;\n} {\n const idx = specifier.lastIndexOf(\"#\");\n if (idx === -1) return { file: specifier };\n\n return {\n file: specifier.slice(0, idx),\n section: specifier.slice(idx + 1),\n };\n}\n\nfunction extractSection(root: Root, section: string): Root | undefined {\n let nodes: RootContent[] | undefined;\n let capturingHeadingContent = false;\n\n visit(root, (node) => {\n if (node.type === \"heading\") {\n if (capturingHeadingContent) {\n return false;\n }\n\n if (node.data?.hProperties?.id === section) {\n capturingHeadingContent = true;\n nodes = [node];\n return \"skip\";\n }\n\n return;\n }\n\n if (capturingHeadingContent) {\n nodes?.push(node as RootContent);\n return \"skip\";\n }\n\n if (isElementLike(node) && node.name === \"section\") {\n const attributes = parseElementAttributes(node);\n\n if (attributes.id === section) {\n nodes = node.children;\n return false;\n }\n }\n });\n\n if (nodes)\n return {\n type: \"root\",\n children: nodes,\n };\n}\n\n// region marker regexes\nconst REGION_MARKERS = [\n {\n start: /^\\s*\\/\\/\\s*#?region\\b\\s*(.*?)\\s*$/,\n end: /^\\s*\\/\\/\\s*#?endregion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*<!--\\s*#?region\\b\\s*(.*?)\\s*-->/,\n end: /^\\s*<!--\\s*#?endregion\\b\\s*(.*?)\\s*-->/,\n },\n {\n start: /^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\//,\n end: /^\\s*\\/\\*\\s*#endregion\\b\\s*(.*?)\\s*\\*\\//,\n },\n {\n start: /^\\s*#[rR]egion\\b\\s*(.*?)\\s*$/,\n end: /^\\s*#[eE]nd ?[rR]egion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*#\\s*#?region\\b\\s*(.*?)\\s*$/,\n end: /^\\s*#\\s*#?endregion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*(?:--|::|@?REM)\\s*#region\\b\\s*(.*?)\\s*$/,\n end: /^\\s*(?:--|::|@?REM)\\s*#endregion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*#pragma\\s+region\\b\\s*(.*?)\\s*$/,\n end: /^\\s*#pragma\\s+endregion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*\\(\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\)/,\n end: /^\\s*\\(\\*\\s*#endregion\\b\\s*(.*?)\\s*\\*\\)/,\n },\n];\n\nfunction dedent(lines: string[]): string {\n const minIndent = lines.reduce((min, line) => {\n const match = line.match(/^(\\s*)\\S/);\n return match ? Math.min(min, match[1].length) : min;\n }, Infinity);\n\n return minIndent === Infinity\n ? lines.join(\"\\n\")\n : lines.map((l) => l.slice(minIndent)).join(\"\\n\");\n}\n\nfunction extractCodeRegion(content: string, regionName: string): string {\n const lines = content.split(\"\\n\");\n\n for (let i = 0; i < lines.length; i++) {\n for (const re of REGION_MARKERS) {\n let match = re.start.exec(lines[i]);\n if (match?.[1] !== regionName) continue;\n\n let depth = 1;\n const extractedLines: string[] = [];\n for (let j = i + 1; j < lines.length; j++) {\n match = re.start.exec(lines[j]);\n if (match) {\n depth++;\n continue;\n }\n\n match = re.end.exec(lines[j]);\n if (match) {\n if (match[1] === regionName) depth = 0;\n else if (match[1] === \"\") depth--;\n else continue;\n\n if (depth > 0) continue;\n return dedent(extractedLines);\n } else {\n extractedLines.push(lines[j]);\n }\n }\n }\n }\n throw new Error(`Region \"${regionName}\" not found`);\n}\n\nexport interface RemarkIncludeOptions {\n /**\n * remark plugins to preprocess the MDAST tree before scanning headings/sections.\n *\n * e.g. parse headings before extraction.\n */\n preprocess?: PluggableList;\n}\n\nexport function remarkInclude(\n this: Processor,\n { preprocess = [] }: RemarkIncludeOptions = {},\n): Transformer<Root, Root> {\n const TagName = \"include\";\n const preprocessor = unified().use(remarkMarkAndUnravel).use(preprocess);\n\n const embedContent = async (\n targetPath: string,\n heading: string | undefined,\n params: Params,\n parent: VFile,\n ) => {\n const { _getProcessor = () => this, _compiler } = parent.data;\n let content: string;\n try {\n content = (await fs.readFile(targetPath)).toString();\n } catch (e) {\n throw new Error(\n `failed to read file ${targetPath}\\n${e instanceof Error ? e.message : String(e)}`,\n { cause: e },\n );\n }\n\n const ext = path.extname(targetPath);\n _compiler?.addDependency(targetPath);\n if (params.lang || (ext !== \".md\" && ext !== \".mdx\")) {\n const lang = params.lang ?? ext.slice(1);\n\n return {\n type: \"code\",\n lang,\n meta: params.meta,\n value: heading ? extractCodeRegion(content, heading) : content,\n data: {},\n } satisfies Code;\n }\n\n const parser = await _getProcessor(ext === \".mdx\" ? \"mdx\" : \"md\");\n const parsed = fumaMatter(content);\n const targetFile = new VFile({\n path: targetPath,\n value: parsed.content,\n data: {\n ...parent.data,\n frontmatter: parsed.data as Record<string, unknown>,\n },\n });\n\n let mdast = await preprocessor.run(parser.parse(targetFile) as Root, targetFile);\n\n if (heading) {\n const extracted = extractSection(mdast, heading);\n if (!extracted)\n throw new Error(\n `Cannot find section ${heading} in ${targetPath}, make sure you have encapsulated the section in a <section id=\"${heading}\"> tag, or a :::section directive with remark-directive configured.`,\n );\n\n mdast = extracted;\n }\n\n await update(mdast, targetFile);\n return mdast;\n };\n\n async function update(tree: Root, file: VFile) {\n const queue: Promise<void>[] = [];\n\n visit(tree, ElementLikeTypes, (_node, _, parent) => {\n const node = _node as ElementLikeContent;\n if (node.name !== TagName) return;\n\n const specifier = flattenNode(node);\n if (specifier.length === 0) return \"skip\";\n\n const attributes = parseElementAttributes(node);\n const { file: relativePath, section } = parseSpecifier(specifier);\n const targetPath = path.resolve(\n \"cwd\" in attributes ? file.cwd : (file.dirname ?? \"\"),\n relativePath,\n );\n\n queue.push(\n embedContent(targetPath, section, attributes, file).then((replace) => {\n Object.assign(parent && parent.type === \"paragraph\" ? parent : node, replace);\n }),\n );\n\n return \"skip\";\n });\n\n await Promise.all(queue);\n }\n\n return async (tree, file) => {\n await update(tree, file);\n };\n}\n","import type { Processor, Transformer } from \"unified\";\nimport type { Heading, Root, RootContent } from \"mdast\";\nimport { visit } from \"unist-util-visit\";\nimport { toMarkdown } from \"mdast-util-to-markdown\";\nimport { valueToEstree } from \"estree-util-value-to-estree\";\nimport { removePosition } from \"unist-util-remove-position\";\nimport remarkMdx from \"remark-mdx\";\nimport { flattenNode } from \"./mdast-utils\";\n\nexport interface ExtractedReference {\n href: string;\n}\n\nexport interface PostprocessOptions {\n _format: \"md\" | \"mdx\";\n\n /**\n * Properties to export from `vfile.data`\n */\n valueToExport?: string[];\n\n /**\n * stringify MDAST and export via `_markdown`.\n */\n includeProcessedMarkdown?:\n | boolean\n | {\n /**\n * include heading IDs into the processed markdown.\n */\n headingIds?: boolean;\n };\n\n /**\n * extract link references, export via `extractedReferences`.\n */\n extractLinkReferences?: boolean;\n\n /**\n * store MDAST and export via `_mdast`.\n */\n includeMDAST?:\n | boolean\n | {\n removePosition?: boolean;\n };\n}\n\n/**\n * - collect references\n * - write frontmatter (auto-title & description)\n */\nexport function remarkPostprocess(\n this: Processor,\n {\n _format,\n includeProcessedMarkdown = false,\n includeMDAST = false,\n extractLinkReferences = false,\n valueToExport = [],\n }: PostprocessOptions,\n): Transformer<Root, Root> {\n let _stringifyProcessor: Processor | undefined;\n const getStringifyProcessor = () => {\n return (_stringifyProcessor ??=\n _format === \"mdx\"\n ? this\n : // force Markdown processor to stringify MDX nodes\n this().use(remarkMdx).freeze());\n };\n\n return (tree, file) => {\n const frontmatter = (file.data.frontmatter ??= {});\n if (!frontmatter.title) {\n visit(tree, \"heading\", (node) => {\n if (node.depth === 1) {\n frontmatter.title = flattenNode(node);\n return false;\n }\n });\n }\n\n file.data[\"mdx-export\"] ??= [];\n file.data[\"mdx-export\"].push({\n name: \"frontmatter\",\n value: frontmatter,\n });\n\n if (extractLinkReferences) {\n const urls: ExtractedReference[] = [];\n\n visit(tree, \"link\", (node) => {\n urls.push({\n href: node.url,\n });\n return \"skip\";\n });\n\n file.data[\"mdx-export\"].push({\n name: \"extractedReferences\",\n value: urls,\n });\n }\n\n if (includeProcessedMarkdown) {\n const { headingIds = true } =\n typeof includeProcessedMarkdown === \"object\" ? includeProcessedMarkdown : {};\n const processor = getStringifyProcessor();\n const markdown = toMarkdown(tree, {\n ...processor.data(\"settings\"),\n // from https://github.com/remarkjs/remark/blob/main/packages/remark-stringify/lib/index.js\n extensions: processor.data(\"toMarkdownExtensions\") || [],\n handlers: {\n heading: (node: Heading) => {\n const id = node.data?.hProperties?.id;\n const content = flattenNode(node);\n return headingIds && id ? `${content} [#${id}]` : content;\n },\n },\n });\n\n file.data[\"mdx-export\"].push({\n name: \"_markdown\",\n value: markdown,\n });\n }\n\n if (includeMDAST) {\n const options = includeMDAST === true ? {} : includeMDAST;\n const mdast = JSON.stringify(\n options.removePosition ? removePosition(structuredClone(tree)) : tree,\n );\n\n file.data[\"mdx-export\"].push({\n name: \"_mdast\",\n value: mdast,\n });\n }\n\n for (const { name, value } of file.data[\"mdx-export\"]) {\n tree.children.unshift(getMdastExport(name, value));\n }\n\n // reset the data to reduce memory usage\n file.data[\"mdx-export\"] = [];\n\n for (const name of valueToExport) {\n if (!(name in file.data)) continue;\n\n tree.children.unshift(getMdastExport(name, file.data[name]));\n }\n };\n}\n\n/**\n * MDX.js first converts javascript (with esm support) into mdast nodes with remark-mdx, then handle the other remark plugins\n *\n * Therefore, if we want to inject an export, we must convert the object into AST, then add the mdast node\n */\nfunction getMdastExport(name: string, value: unknown): RootContent {\n return {\n type: \"mdxjsEsm\",\n value: \"\",\n data: {\n estree: {\n type: \"Program\",\n sourceType: \"module\",\n body: [\n {\n type: \"ExportNamedDeclaration\",\n specifiers: [],\n attributes: [],\n source: null,\n declaration: {\n type: \"VariableDeclaration\",\n kind: \"let\",\n declarations: [\n {\n type: \"VariableDeclarator\",\n id: {\n type: \"Identifier\",\n name,\n },\n init: valueToEstree(value),\n },\n ],\n },\n },\n ],\n },\n },\n };\n}\n","import type { Processor, Transformer } from \"unified\";\nimport type { Root } from \"mdast\";\n\nexport interface PreprocessOptions {\n preprocessor?: Processor<Root>;\n}\n\ndeclare module \"vfile\" {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extend data map\n interface DataMap {\n _preprocessed?: boolean;\n }\n}\n\nexport function remarkPreprocess(options?: PreprocessOptions): Transformer<Root, Root> {\n return async (tree, file) => {\n if (file.data._preprocessed) return;\n file.data._preprocessed = true;\n\n if (options?.preprocessor) {\n return (await options.preprocessor.run(tree)) as Root;\n }\n };\n}\n","import { createProcessor } from \"@mdx-js/mdx\";\nimport { VFile } from \"vfile\";\nimport { remarkInclude, type RemarkIncludeOptions } from \"@/collections/mdx/remark-include\";\nimport { type PostprocessOptions, remarkPostprocess } from \"@/collections/mdx/remark-postprocess\";\nimport type { Core } from \"@/core\";\nimport { remarkPreprocess } from \"@/collections/mdx/remark-preprocess\";\nimport type { Pluggable } from \"unified\";\nimport { createCache } from \"@/utils/async-cache\";\nimport type { CompilerOptions } from \"@/plugins/loader\";\nimport type { MDXContent } from \"mdx/types\";\nimport { MDXCollection } from \"../mdx\";\n\ntype MDXProcessor = ReturnType<typeof createProcessor>;\n\ninterface BuildMDXOptions {\n /**\n * Specify a file path for source\n */\n filePath: string;\n source: string;\n frontmatter?: Record<string, unknown>;\n\n environment: \"bundler\" | \"runtime\";\n isDevelopment: boolean;\n _compiler?: CompilerOptions;\n}\n\nexport interface FumaContentDataMap {\n /**\n * [Fuma Content] raw frontmatter, you can modify it\n */\n frontmatter?: Record<string, unknown>;\n\n /**\n * [Fuma Content] additional ESM exports to write\n */\n \"mdx-export\"?: { name: string; value: unknown }[];\n\n /**\n * [Fuma Content] The compiler object from loader\n */\n _compiler?: CompilerOptions;\n\n /**\n * [Fuma Content] get internal processor, do not use this on user land.\n */\n _getProcessor?: (format: \"md\" | \"mdx\") => MDXProcessor | Promise<MDXProcessor>;\n}\n\ndeclare module \"vfile\" {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extend data map\n interface DataMap extends FumaContentDataMap {}\n}\n\nexport interface CompiledMDX<Frontmatter = Record<string, unknown>> extends Record<\n string,\n unknown\n> {\n frontmatter: Frontmatter;\n default: MDXContent;\n\n /**\n * Enable from `postprocess` option.\n */\n _markdown?: string;\n /**\n * Enable from `postprocess` option.\n */\n _mdast?: string;\n}\n\nexport async function buildMDX(\n core: Core,\n collection: MDXCollection | undefined,\n { filePath, frontmatter, source, _compiler, environment, isDevelopment }: BuildMDXOptions,\n): Promise<VFile> {\n const processorCache = createCache(core.cache).$value<MDXProcessor>();\n\n function getProcessor(format: \"md\" | \"mdx\") {\n const key = `build-mdx:${collection?.name ?? \"global\"}:${format}`;\n\n return processorCache.cached(key, async () => {\n const mdxOptions = await collection?.getMDXOptions?.(environment);\n const preprocessPlugin = [remarkPreprocess, collection?.preprocess] satisfies Pluggable;\n const postprocessOptions: PostprocessOptions = {\n _format: format,\n ...collection?.postprocess,\n };\n const remarkIncludeOptions: RemarkIncludeOptions = {\n preprocess: [preprocessPlugin],\n };\n\n return createProcessor({\n outputFormat: \"program\",\n development: isDevelopment,\n ...mdxOptions,\n remarkPlugins: [\n preprocessPlugin,\n [remarkInclude, remarkIncludeOptions],\n ...(mdxOptions?.remarkPlugins ?? []),\n [remarkPostprocess, postprocessOptions],\n ],\n format,\n });\n });\n }\n\n let vfile = new VFile({\n value: source,\n path: filePath,\n cwd: core.getOptions().cwd,\n data: {\n frontmatter,\n _compiler,\n _getProcessor: getProcessor,\n },\n });\n\n if (collection && collection) {\n vfile = await collection.vfile.run(vfile, {\n collection,\n filePath,\n source,\n });\n }\n\n return (await getProcessor(filePath.endsWith(\".mdx\") ? \"mdx\" : \"md\")).process(vfile);\n}\n"],"mappings":";;;;;;;;;;;;;;AAMA,SAAgB,uBAAgD;AAC9D,SAAQ,SAAS;AACf,QAAM,OAAO,MAAM,OAAO,WAAW;GACnC,IAAI,SAAS;GACb,IAAI,MAAM;GACV,IAAI,YAAY;AAEhB,OAAI,UAAU,OAAO,UAAU,YAAY,KAAK,SAAS,aAAa;IACpE,MAAM,WAAW,KAAK;AAEtB,WAAO,EAAE,SAAS,SAAS,QAAQ;KACjC,MAAM,QAAQ,SAAS;AAEvB,SAAI,MAAM,SAAS,uBAAuB,MAAM,SAAS,oBACvD,aAAY;cACH,MAAM,SAAS,UAAU,MAAM,MAAM,MAAM,CAAC,WAAW,GAAG,QAE9D;AACL,YAAM;AACN;;;AAIJ,QAAI,OAAO,WAAW;AACpB,cAAS;KACT,MAAMA,cAA6B,EAAE;AAErC,YAAO,EAAE,SAAS,SAAS,QAAQ;MACjC,MAAM,QAAQ,SAAS;AAEvB,UAAI,MAAM,SAAS,oBAEjB,OAAM,OAAO;AAGf,UAAI,MAAM,SAAS,oBAEjB,OAAM,OAAO;AAGf,UAAI,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;GACJ;GACA;GACA,eAAe;GAChB;EACF,CAAC;AAEF,KAAI,cAAc,WAChB,SAAQ,MAAM,WAAW,MAAM,IAAI,OAAO;EACxC;EACA;EACA;EACD,CAAC;AAGJ,SAAQ,MAAM,aAAa,SAAS,SAAS,OAAO,GAAG,QAAQ,KAAK,EAAE,QAAQ,MAAM"}
|
package/dist/bun/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { n as CoreOptions } from "../core-
|
|
1
|
+
import { n as CoreOptions, t as Core } from "../core-BO3b8jMg.js";
|
|
2
2
|
import { BunPlugin } from "bun";
|
|
3
3
|
|
|
4
4
|
//#region src/bun/index.d.ts
|
|
5
|
-
type
|
|
6
|
-
declare function
|
|
5
|
+
type BunOptions = Omit<CoreOptions, "plugins" | "workspace">;
|
|
6
|
+
declare function createContent(options?: BunOptions): Promise<BunCore>;
|
|
7
|
+
declare class BunCore extends Core {
|
|
8
|
+
createBunPlugin(): BunPlugin;
|
|
9
|
+
}
|
|
7
10
|
//#endregion
|
|
8
|
-
export {
|
|
11
|
+
export { BunCore, BunOptions, createContent };
|
|
9
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/bun/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/bun/index.ts"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/bun/index.ts"],"sourcesContent":[],"mappings":";;;;KAKY,UAAA,GAAa,KAAK;iBAER,aAAA,WAAuB,aAAkB,QAAQ;AAF3D,cAeC,OAAA,SAAgB,IAAA,CAfJ;EAEH,eAAA,CAAA,CAAa,EAcd,SAdc"}
|
package/dist/bun/index.js
CHANGED
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import {
|
|
1
|
+
import { t as Core } from "../core-D5QHSKk6.js";
|
|
2
|
+
import { n as loaderPlugin } from "../loader-BuR4gkKg.js";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
|
|
5
5
|
//#region src/bun/index.ts
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
for (const plugin of core.getPlugins(true)) await plugin.bun?.build?.call(ctx, build);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
6
|
+
async function createContent(options = {}) {
|
|
7
|
+
const core = new BunCore({
|
|
8
|
+
...options,
|
|
9
|
+
plugins: [loaderPlugin()]
|
|
10
|
+
});
|
|
11
|
+
const importPath = pathToFileURL(core.getOptions().configPath).href;
|
|
12
|
+
await core.init({ config: await import(importPath) });
|
|
13
|
+
return core;
|
|
17
14
|
}
|
|
15
|
+
var BunCore = class extends Core {
|
|
16
|
+
createBunPlugin() {
|
|
17
|
+
return {
|
|
18
|
+
name: "fuma-content",
|
|
19
|
+
setup: async (build) => {
|
|
20
|
+
const ctx = this.getPluginContext();
|
|
21
|
+
for (const plugin of this.getPlugins(true)) {
|
|
22
|
+
const setup = plugin.bun?.setup;
|
|
23
|
+
if (setup) await setup.call(ctx, build);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
};
|
|
18
29
|
|
|
19
30
|
//#endregion
|
|
20
|
-
export {
|
|
31
|
+
export { BunCore, createContent };
|
|
21
32
|
//# sourceMappingURL=index.js.map
|
package/dist/bun/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/bun/index.ts"],"sourcesContent":["import type { BunPlugin } from \"bun\";\nimport { pathToFileURL } from \"node:url\";\nimport { type CoreOptions, Core } from \"@/core\";\n\nexport type
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/bun/index.ts"],"sourcesContent":["import type { BunPlugin } from \"bun\";\nimport { pathToFileURL } from \"node:url\";\nimport { type CoreOptions, Core } from \"@/core\";\nimport { loaderPlugin } from \"@/plugins/loader\";\n\nexport type BunOptions = Omit<CoreOptions, \"plugins\" | \"workspace\">;\n\nexport async function createContent(options: BunOptions = {}): Promise<BunCore> {\n const core = new BunCore({\n ...options,\n plugins: [loaderPlugin()],\n });\n const importPath = pathToFileURL(core.getOptions().configPath).href;\n\n await core.init({\n config: await import(importPath),\n });\n return core;\n}\n\nexport class BunCore extends Core {\n createBunPlugin(): BunPlugin {\n return {\n name: \"fuma-content\",\n setup: async (build) => {\n const ctx = this.getPluginContext();\n\n for (const plugin of this.getPlugins(true)) {\n const setup = plugin.bun?.setup;\n if (setup) await setup.call(ctx, build);\n }\n },\n };\n }\n}\n"],"mappings":";;;;;AAOA,eAAsB,cAAc,UAAsB,EAAE,EAAoB;CAC9E,MAAM,OAAO,IAAI,QAAQ;EACvB,GAAG;EACH,SAAS,CAAC,cAAc,CAAC;EAC1B,CAAC;CACF,MAAM,aAAa,cAAc,KAAK,YAAY,CAAC,WAAW,CAAC;AAE/D,OAAM,KAAK,KAAK,EACd,QAAQ,MAAM,OAAO,aACtB,CAAC;AACF,QAAO;;AAGT,IAAa,UAAb,cAA6B,KAAK;CAChC,kBAA6B;AAC3B,SAAO;GACL,MAAM;GACN,OAAO,OAAO,UAAU;IACtB,MAAM,MAAM,KAAK,kBAAkB;AAEnC,SAAK,MAAM,UAAU,KAAK,WAAW,KAAK,EAAE;KAC1C,MAAM,QAAQ,OAAO,KAAK;AAC1B,SAAI,MAAO,OAAM,MAAM,KAAK,KAAK,MAAM;;;GAG5C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { parse } from "node:querystring";
|
|
3
3
|
|
|
4
|
-
//#region src/plugins/
|
|
4
|
+
//#region src/plugins/loader/bun.ts
|
|
5
5
|
function toBun(test = /.+/, loader) {
|
|
6
6
|
function toResult(output) {
|
|
7
7
|
if (!output) return;
|
|
@@ -32,4 +32,4 @@ function toBun(test = /.+/, loader) {
|
|
|
32
32
|
|
|
33
33
|
//#endregion
|
|
34
34
|
export { toBun };
|
|
35
|
-
//# sourceMappingURL=bun-
|
|
35
|
+
//# sourceMappingURL=bun-CBROq3I0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bun-CBROq3I0.js","names":["input: LoaderInput"],"sources":["../src/plugins/loader/bun.ts"],"sourcesContent":["import { parse } from \"node:querystring\";\nimport { readFileSync } from \"node:fs\";\nimport type { LoaderInput, Loader, LoaderOutput } from \"@/plugins/loader\";\n\nexport function toBun(test: RegExp = /.+/, loader: Loader) {\n function toResult(output: LoaderOutput | null): Bun.OnLoadResult {\n // it errors, treat this as an exception\n if (!output) return;\n\n return {\n contents: output.code,\n loader: output.moduleType ?? \"js\",\n };\n }\n\n return (build: Bun.PluginBuilder): void => {\n // avoid using async here, because it will cause dynamic require() to fail\n build.onLoad({ filter: test }, (args) => {\n const [filePath, query = \"\"] = args.path.split(\"?\", 2);\n const input: LoaderInput = {\n async getSource() {\n return Bun.file(filePath).text();\n },\n query: parse(query),\n filePath,\n development: false,\n compiler: {\n addDependency() {},\n },\n };\n\n if (loader.bun?.load) {\n return loader.bun.load(readFileSync(filePath).toString(), input);\n }\n\n const result = loader.load(input);\n if (result instanceof Promise) {\n return result.then(toResult);\n }\n return toResult(result);\n });\n };\n}\n"],"mappings":";;;;AAIA,SAAgB,MAAM,OAAe,MAAM,QAAgB;CACzD,SAAS,SAAS,QAA+C;AAE/D,MAAI,CAAC,OAAQ;AAEb,SAAO;GACL,UAAU,OAAO;GACjB,QAAQ,OAAO,cAAc;GAC9B;;AAGH,SAAQ,UAAmC;AAEzC,QAAM,OAAO,EAAE,QAAQ,MAAM,GAAG,SAAS;GACvC,MAAM,CAAC,UAAU,QAAQ,MAAM,KAAK,KAAK,MAAM,KAAK,EAAE;GACtD,MAAMA,QAAqB;IACzB,MAAM,YAAY;AAChB,YAAO,IAAI,KAAK,SAAS,CAAC,MAAM;;IAElC,OAAO,MAAM,MAAM;IACnB;IACA,aAAa;IACb,UAAU,EACR,gBAAgB,IACjB;IACF;AAED,OAAI,OAAO,KAAK,KACd,QAAO,OAAO,IAAI,KAAK,aAAa,SAAS,CAAC,UAAU,EAAE,MAAM;GAGlE,MAAM,SAAS,OAAO,KAAK,MAAM;AACjC,OAAI,kBAAkB,QACpB,QAAO,OAAO,KAAK,SAAS;AAE9B,UAAO,SAAS,OAAO;IACvB"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { URLSearchParams } from "node:url";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/code-generator.ts
|
|
5
|
+
function importInfo() {
|
|
6
|
+
return {
|
|
7
|
+
named: /* @__PURE__ */ new Map(),
|
|
8
|
+
namespaces: /* @__PURE__ */ new Set(),
|
|
9
|
+
isUsed: /* @__PURE__ */ new Set()
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Code generator (one instance per file)
|
|
14
|
+
*/
|
|
15
|
+
var CodeGenerator = class {
|
|
16
|
+
lines = [];
|
|
17
|
+
importInfos = /* @__PURE__ */ new Map();
|
|
18
|
+
eagerImportId = 0;
|
|
19
|
+
options;
|
|
20
|
+
constructor({ target = "default", jsExtension = false, outDir = "" }) {
|
|
21
|
+
this.options = {
|
|
22
|
+
target,
|
|
23
|
+
jsExtension,
|
|
24
|
+
outDir
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
addNamespaceImport(namespace, specifier, typeOnly = false) {
|
|
28
|
+
const info = this.importInfos.get(specifier) ?? importInfo();
|
|
29
|
+
this.importInfos.set(specifier, info);
|
|
30
|
+
if (!typeOnly) info.isUsed.add(namespace);
|
|
31
|
+
info.namespaces.add(namespace);
|
|
32
|
+
}
|
|
33
|
+
addNamedImport(names, specifier, typeOnly = false) {
|
|
34
|
+
const info = this.importInfos.get(specifier) ?? importInfo();
|
|
35
|
+
this.importInfos.set(specifier, info);
|
|
36
|
+
for (const name of names) {
|
|
37
|
+
const [memberName, importName = memberName] = name.split(/\s+as\s+/, 2);
|
|
38
|
+
info.named.set(importName, memberName);
|
|
39
|
+
if (!typeOnly) info.isUsed.add(importName);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
push(...insert) {
|
|
43
|
+
this.lines.push(...insert);
|
|
44
|
+
}
|
|
45
|
+
async pushAsync(insert) {
|
|
46
|
+
for (const line of await Promise.all(insert)) {
|
|
47
|
+
if (line === void 0) continue;
|
|
48
|
+
this.lines.push(line);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** generate a random import name that is unique in file. */
|
|
52
|
+
generateImportName() {
|
|
53
|
+
return `__${this.eagerImportId++}`;
|
|
54
|
+
}
|
|
55
|
+
formatDynamicImport(specifier, mod) {
|
|
56
|
+
let s = `import("${specifier}")`;
|
|
57
|
+
if (mod) s += `.then(mod => mod.${mod})`;
|
|
58
|
+
return s;
|
|
59
|
+
}
|
|
60
|
+
formatQuery(query) {
|
|
61
|
+
const params = new URLSearchParams();
|
|
62
|
+
for (const k in query) {
|
|
63
|
+
const value = query[k];
|
|
64
|
+
if (typeof value === "string") params.set(k, value);
|
|
65
|
+
}
|
|
66
|
+
return params.toString();
|
|
67
|
+
}
|
|
68
|
+
formatImportPath(file) {
|
|
69
|
+
const ext = path.extname(file);
|
|
70
|
+
let filename;
|
|
71
|
+
if (ext === ".ts" || ext === ".tsx") {
|
|
72
|
+
filename = file.substring(0, file.length - ext.length);
|
|
73
|
+
if (this.options.jsExtension) filename += ".js";
|
|
74
|
+
} else filename = file;
|
|
75
|
+
const importPath = slash(path.relative(this.options.outDir, filename));
|
|
76
|
+
return importPath.startsWith("../") ? importPath : `./${importPath}`;
|
|
77
|
+
}
|
|
78
|
+
toString() {
|
|
79
|
+
const final = ["// @ts-nocheck"];
|
|
80
|
+
if (this.options.target === "vite") final.push("/// <reference types=\"vite/client\" />");
|
|
81
|
+
for (const [specifier, info] of this.importInfos) {
|
|
82
|
+
const { namespaces, named, isUsed } = info;
|
|
83
|
+
for (const namespace of namespaces) final.push(isUsed.has(namespace) ? `import * as ${namespace} from "${specifier}";` : `import type * as ${namespace} from "${specifier}";`);
|
|
84
|
+
const namedImports = [];
|
|
85
|
+
for (const [importName, memberName] of named) {
|
|
86
|
+
const item = importName === memberName ? importName : `${memberName} as ${importName}`;
|
|
87
|
+
namedImports.push(isUsed.has(importName) ? item : `type ${item}`);
|
|
88
|
+
}
|
|
89
|
+
if (namedImports.length > 0) final.push(`import { ${namedImports.join(", ")} } from "${specifier}";`);
|
|
90
|
+
}
|
|
91
|
+
final.push(...this.lines);
|
|
92
|
+
return final.join("\n");
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
function slash(path$1) {
|
|
96
|
+
if (path$1.startsWith("\\\\?\\")) return path$1;
|
|
97
|
+
return path$1.replaceAll("\\", "/");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
//#endregion
|
|
101
|
+
export { slash as n, CodeGenerator as t };
|
|
102
|
+
//# sourceMappingURL=code-generator-CjC4EEXg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-generator-CjC4EEXg.js","names":["filename: string","final: string[]","namedImports: string[]","path"],"sources":["../src/utils/code-generator.ts"],"sourcesContent":["import path from \"node:path\";\nimport { URLSearchParams } from \"node:url\";\n\nexport interface CodeGeneratorOptions {\n target: \"default\" | \"vite\";\n outDir: string;\n /**\n * add .js extenstion to imports\n */\n jsExtension: boolean;\n}\n\ninterface ImportInfo {\n // import name -> member name\n named: Map<string, string>;\n namespaces: Set<string>;\n /**\n * a set of import names, the import is type-only if its name is missing in this set.\n */\n isUsed: Set<string>;\n}\n\nfunction importInfo(): ImportInfo {\n return {\n named: new Map(),\n namespaces: new Set(),\n isUsed: new Set(),\n };\n}\n\n/**\n * Code generator (one instance per file)\n */\nexport class CodeGenerator {\n private readonly lines: string[] = [];\n // specifier -> imported members/info\n private readonly importInfos = new Map<string, ImportInfo>();\n private eagerImportId = 0;\n\n readonly options: CodeGeneratorOptions;\n constructor({\n target = \"default\",\n jsExtension = false,\n outDir = \"\",\n }: Partial<CodeGeneratorOptions>) {\n this.options = {\n target,\n jsExtension,\n outDir,\n };\n }\n\n addNamespaceImport(namespace: string, specifier: string, typeOnly = false) {\n const info = this.importInfos.get(specifier) ?? importInfo();\n this.importInfos.set(specifier, info);\n if (!typeOnly) info.isUsed.add(namespace);\n info.namespaces.add(namespace);\n }\n\n addNamedImport(names: string[], specifier: string, typeOnly = false) {\n const info = this.importInfos.get(specifier) ?? importInfo();\n this.importInfos.set(specifier, info);\n for (const name of names) {\n const [memberName, importName = memberName] = name.split(/\\s+as\\s+/, 2);\n info.named.set(importName, memberName);\n if (!typeOnly) info.isUsed.add(importName);\n }\n }\n\n push(...insert: string[]) {\n this.lines.push(...insert);\n }\n\n async pushAsync(insert: Promise<string | undefined>[]) {\n for (const line of await Promise.all(insert)) {\n if (line === undefined) continue;\n\n this.lines.push(line);\n }\n }\n\n /** generate a random import name that is unique in file. */\n generateImportName(): string {\n return `__${this.eagerImportId++}`;\n }\n\n formatDynamicImport(specifier: string, mod?: string): string {\n let s = `import(\"${specifier}\")`;\n if (mod) s += `.then(mod => mod.${mod})`;\n return s;\n }\n\n formatQuery(query: Record<string, string | undefined>) {\n const params = new URLSearchParams();\n for (const k in query) {\n const value = query[k];\n if (typeof value === \"string\") params.set(k, value);\n }\n return params.toString();\n }\n\n formatImportPath(file: string) {\n const ext = path.extname(file);\n let filename: string;\n\n if (ext === \".ts\" || ext === \".tsx\") {\n filename = file.substring(0, file.length - ext.length);\n if (this.options.jsExtension) filename += \".js\";\n } else {\n filename = file;\n }\n\n const importPath = slash(path.relative(this.options.outDir, filename));\n return importPath.startsWith(\"../\") ? importPath : `./${importPath}`;\n }\n\n toString() {\n const final: string[] = [\"// @ts-nocheck\"];\n if (this.options.target === \"vite\") {\n final.push('/// <reference types=\"vite/client\" />');\n }\n\n for (const [specifier, info] of this.importInfos) {\n const { namespaces, named, isUsed } = info;\n for (const namespace of namespaces) {\n final.push(\n isUsed.has(namespace)\n ? `import * as ${namespace} from \"${specifier}\";`\n : `import type * as ${namespace} from \"${specifier}\";`,\n );\n }\n\n const namedImports: string[] = [];\n for (const [importName, memberName] of named) {\n const item = importName === memberName ? importName : `${memberName} as ${importName}`;\n\n namedImports.push(isUsed.has(importName) ? item : `type ${item}`);\n }\n\n if (namedImports.length > 0) {\n final.push(`import { ${namedImports.join(\", \")} } from \"${specifier}\";`);\n }\n }\n\n final.push(...this.lines);\n return final.join(\"\\n\");\n }\n}\n\nexport function slash(path: string): string {\n const isExtendedLengthPath = path.startsWith(\"\\\\\\\\?\\\\\");\n\n if (isExtendedLengthPath) {\n return path;\n }\n\n return path.replaceAll(\"\\\\\", \"/\");\n}\n\nexport function ident(code: string, tab: number = 1) {\n return code\n .split(\"\\n\")\n .map((v) => \" \".repeat(tab) + v)\n .join(\"\\n\");\n}\n"],"mappings":";;;;AAsBA,SAAS,aAAyB;AAChC,QAAO;EACL,uBAAO,IAAI,KAAK;EAChB,4BAAY,IAAI,KAAK;EACrB,wBAAQ,IAAI,KAAK;EAClB;;;;;AAMH,IAAa,gBAAb,MAA2B;CACzB,AAAiB,QAAkB,EAAE;CAErC,AAAiB,8BAAc,IAAI,KAAyB;CAC5D,AAAQ,gBAAgB;CAExB,AAAS;CACT,YAAY,EACV,SAAS,WACT,cAAc,OACd,SAAS,MACuB;AAChC,OAAK,UAAU;GACb;GACA;GACA;GACD;;CAGH,mBAAmB,WAAmB,WAAmB,WAAW,OAAO;EACzE,MAAM,OAAO,KAAK,YAAY,IAAI,UAAU,IAAI,YAAY;AAC5D,OAAK,YAAY,IAAI,WAAW,KAAK;AACrC,MAAI,CAAC,SAAU,MAAK,OAAO,IAAI,UAAU;AACzC,OAAK,WAAW,IAAI,UAAU;;CAGhC,eAAe,OAAiB,WAAmB,WAAW,OAAO;EACnE,MAAM,OAAO,KAAK,YAAY,IAAI,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rD,OAAK,MAAM,CAAC,WAAW,SAAS,KAAK,aAAa;GAChD,MAAM,EAAE,YAAY,OAAO,WAAW;AACtC,QAAK,MAAM,aAAa,WACtB,OAAM,KACJ,OAAO,IAAI,UAAU,GACjB,eAAe,UAAU,SAAS,UAAU,MAC5C,oBAAoB,UAAU,SAAS,UAAU,IACtD;GAGH,MAAMC,eAAyB,EAAE;AACjC,QAAK,MAAM,CAAC,YAAY,eAAe,OAAO;IAC5C,MAAM,OAAO,eAAe,aAAa,aAAa,GAAG,WAAW,MAAM;AAE1E,iBAAa,KAAK,OAAO,IAAI,WAAW,GAAG,OAAO,QAAQ,OAAO;;AAGnE,OAAI,aAAa,SAAS,EACxB,OAAM,KAAK,YAAY,aAAa,KAAK,KAAK,CAAC,WAAW,UAAU,IAAI;;AAI5E,QAAM,KAAK,GAAG,KAAK,MAAM;AACzB,SAAO,MAAM,KAAK,KAAK;;;AAI3B,SAAgB,MAAM,QAAsB;AAG1C,KAF6BC,OAAK,WAAW,UAAU,CAGrD,QAAOA;AAGT,QAAOA,OAAK,WAAW,MAAM,IAAI"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { D as GetCollectionConfig } from "../../core-BO3b8jMg.js";
|
|
2
|
+
import "../../dynamic-CTYYdl7_.js";
|
|
3
|
+
import "../../index-Da88Sj8w.js";
|
|
4
|
+
import "../../fs-D34Sztbh.js";
|
|
5
|
+
import { DataCollection } from "../data.js";
|
|
6
|
+
import "../../store-DiuGdV5M.js";
|
|
7
|
+
import { t as FileCollectionStore } from "../../file-store-laO4IjvB.js";
|
|
8
|
+
|
|
9
|
+
//#region src/collections/data/runtime.d.ts
|
|
10
|
+
declare function dataStore<Config, Name extends string>(_name: Name, base: string, input: Record<string, unknown>): FileCollectionStore<{
|
|
11
|
+
data: GetCollectionConfig<Config, Name> extends DataCollection ? GetCollectionConfig<Config, Name>["$inferOutput"] : never;
|
|
12
|
+
}>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { dataStore };
|
|
15
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../../../src/collections/data/runtime.ts"],"sourcesContent":[],"mappings":";;;;;;;;;iBAIgB,8CACP,2BAEA,0BACN;QACK,oBAAoB,QAAQ,cAAc,iBAC5C,oBAAoB,QAAQ"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { FileCollectionStore } from "../runtime/file-store.js";
|
|
2
2
|
|
|
3
|
-
//#region src/collections/
|
|
4
|
-
function
|
|
5
|
-
const merged =
|
|
3
|
+
//#region src/collections/data/runtime.ts
|
|
4
|
+
function dataStore(_name, base, input) {
|
|
5
|
+
const merged = {};
|
|
6
6
|
for (const [key, value] of Object.entries(input)) merged[key] = { data: value };
|
|
7
7
|
return new FileCollectionStore(base, merged);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
|
-
export {
|
|
11
|
+
export { dataStore };
|
|
12
12
|
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","names":["merged: Record<\n string,\n {\n data: Data;\n }\n >"],"sources":["../../../src/collections/data/runtime.ts"],"sourcesContent":["import type { GetCollectionConfig } from \"@/types\";\nimport { FileCollectionStore } from \"@/collections/runtime/file-store\";\nimport type { DataCollection } from \"@/collections/data\";\n\nexport function dataStore<Config, Name extends string>(\n _name: Name,\n base: string,\n input: Record<string, unknown>,\n): FileCollectionStore<{\n data: GetCollectionConfig<Config, Name> extends DataCollection\n ? GetCollectionConfig<Config, Name>[\"$inferOutput\"]\n : never;\n}> {\n type Data =\n GetCollectionConfig<Config, Name> extends DataCollection\n ? GetCollectionConfig<Config, Name>[\"$inferOutput\"]\n : never;\n const merged: Record<\n string,\n {\n data: Data;\n }\n > = {};\n\n for (const [key, value] of Object.entries(input)) {\n merged[key] = {\n data: value as Data,\n };\n }\n\n return new FileCollectionStore(base, merged);\n}\n"],"mappings":";;;AAIA,SAAgB,UACd,OACA,MACA,OAKC;CAKD,MAAMA,SAKF,EAAE;AAEN,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC9C,QAAO,OAAO,EACZ,MAAM,OACP;AAGH,QAAO,IAAI,oBAAoB,MAAM,OAAO"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { v as AsyncPipe } from "../core-BO3b8jMg.js";
|
|
2
|
+
import "../dynamic-CTYYdl7_.js";
|
|
3
|
+
import { r as LoaderConfig } from "../index-Da88Sj8w.js";
|
|
4
|
+
import { n as FileSystemCollectionConfig, t as FileSystemCollection } from "../fs-D34Sztbh.js";
|
|
5
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
|
+
|
|
7
|
+
//#region src/collections/data.d.ts
|
|
8
|
+
interface DataTransformationContext {
|
|
9
|
+
path: string;
|
|
10
|
+
source: string;
|
|
11
|
+
}
|
|
12
|
+
interface LoadersConfig {
|
|
13
|
+
json?: boolean;
|
|
14
|
+
yaml?: boolean;
|
|
15
|
+
custom?: Record<string, LoaderConfig>;
|
|
16
|
+
}
|
|
17
|
+
interface DataCollectionConfig<Schema extends StandardSchemaV1 | undefined> extends Omit<FileSystemCollectionConfig, "supportedFormats"> {
|
|
18
|
+
schema?: Schema;
|
|
19
|
+
/**
|
|
20
|
+
* Configurations for loaders to parse data files.
|
|
21
|
+
*
|
|
22
|
+
* By default, JSON and YAML are enabled.
|
|
23
|
+
* */
|
|
24
|
+
loaders?: LoadersConfig;
|
|
25
|
+
}
|
|
26
|
+
declare class DataCollection<Schema extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined> extends FileSystemCollection {
|
|
27
|
+
schema?: Schema;
|
|
28
|
+
/**
|
|
29
|
+
* Transform data
|
|
30
|
+
*/
|
|
31
|
+
readonly onLoad: AsyncPipe<unknown, DataTransformationContext>;
|
|
32
|
+
$inferInput: Schema extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Schema> : unknown;
|
|
33
|
+
$inferOutput: Schema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Schema> : unknown;
|
|
34
|
+
constructor({
|
|
35
|
+
dir,
|
|
36
|
+
files,
|
|
37
|
+
loaders: _loadersConfig,
|
|
38
|
+
schema
|
|
39
|
+
}: DataCollectionConfig<Schema>);
|
|
40
|
+
private generateCollectionStore;
|
|
41
|
+
}
|
|
42
|
+
declare function dataCollection<Schema extends StandardSchemaV1 | undefined = undefined>(config: DataCollectionConfig<Schema>): DataCollection<Schema>;
|
|
43
|
+
declare function yamlLoader(): LoaderConfig;
|
|
44
|
+
declare function jsonLoader(): LoaderConfig;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { DataCollection, DataCollectionConfig, DataTransformationContext, dataCollection, jsonLoader, yamlLoader };
|
|
47
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","names":[],"sources":["../../src/collections/data.ts"],"sourcesContent":[],"mappings":";;;;;;;UAUiB,yBAAA;;;;AAAjB,UAKU,aAAA,CALO;EAKP,IAAA,CAAA,EAAA,OAAA;EAMO,IAAA,CAAA,EAAA,OAAA;EAAoC,MAAA,CAAA,EAH1C,MAG0C,CAAA,MAAA,EAH3B,YAG2B,CAAA;;AAI1C,UAJM,oBAIN,CAAA,eAJ0C,gBAI1C,GAAA,SAAA,CAAA,SAJgF,IAIhF,CAHT,0BAGS,EAAA,kBAAA,CAAA,CAAA;EAMC,MAAA,CAAA,EAND,MAMC;EAV+E;;AAa3F;;;EAGW,OAAA,CAAA,EANC,aAMD;;AAIM,cAPJ,cAOI,CAAA,eANA,gBAMA,GAAA,SAAA,GAN+B,gBAM/B,GAAA,SAAA,CAAA,SALP,oBAAA,CAKO;EACF,MAAA,CAAA,EALJ,MAKI;EAAe;;;EAEd,SAAA,MAAA,EAHC,SAGD,CAAA,OAAA,EAHC,yBAGD,CAAA;EAAe,WAAA,EAFhB,MAEgB,SAFD,gBAEC,GAFkB,gBAAA,CAAiB,UAEnC,CAF8C,MAE9C,CAAA,GAAA,OAAA;EAAgD,YAAA,EAA/D,MAA+D,SAAhD,gBAAgD,GAA7B,gBAAA,CAAiB,WAAY,CAAA,MAAA,CAAA,GAAA,OAAA;EAA7B,WAAA,CAAA;IAAiB,GAAA;IAAA,KAAA;IAAA,OAAA,EAG9B,cAH8B;IAAA;EAAA,CAAA,EAGC,oBAHD,CAGsB,MAHtB,CAAA;EAGnD,QAAA,uBAAA;;AAAqB,iBA4DrB,cA5DqB,CAAA,eA4DS,gBA5DT,GAAA,SAAA,GAAA,SAAA,CAAA,CAAA,MAAA,EA6D3B,oBA7D2B,CA6DN,MA7DM,CAAA,CAAA,EA6DC,cA7DD,CA6DC,MA7DD,CAAA;AAAqB,iBAkE1C,UAAA,CAAA,CAlE0C,EAkE5B,YAlE4B;AAA+B,iBAwHzE,UAAA,CAAA,CAxHyE,EAwH3D,YAxH2D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
export { Collection,
|
|
1
|
+
import { _ as defineCollectionHook, g as CollectionHookContext, h as CollectionHook, m as Collection } from "../core-BO3b8jMg.js";
|
|
2
|
+
export { Collection, CollectionHook, CollectionHookContext, defineCollectionHook };
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
function createCollection(info, init) {
|
|
3
|
-
return {
|
|
4
|
-
name: "",
|
|
5
|
-
handlers: {},
|
|
6
|
-
init(options) {
|
|
7
|
-
this.name = options.name;
|
|
8
|
-
init(this, options);
|
|
9
|
-
},
|
|
10
|
-
typeInfo: info
|
|
11
|
-
};
|
|
12
|
-
}
|
|
1
|
+
import { n as defineCollectionHook, t as Collection } from "../collections-DNFRdCuB.js";
|
|
13
2
|
|
|
14
|
-
|
|
15
|
-
export { createCollection };
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
3
|
+
export { Collection, defineCollectionHook };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "../../core-BO3b8jMg.js";
|
|
2
|
+
import "../../dynamic-CTYYdl7_.js";
|
|
3
|
+
import { l as WebpackLoader } from "../../index-Da88Sj8w.js";
|
|
4
|
+
|
|
5
|
+
//#region src/collections/json/loader-webpack.d.ts
|
|
6
|
+
declare const _default: WebpackLoader;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { _default as default };
|
|
9
|
+
//# sourceMappingURL=loader-webpack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-webpack.d.ts","names":[],"sources":["../../../src/collections/json/loader-webpack.ts"],"sourcesContent":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "../../dynamic-DhKTOrIl.js";
|
|
2
|
+
import "../../validation-BvVvvLII.js";
|
|
3
|
+
import "../../loader-BuR4gkKg.js";
|
|
4
|
+
import "../../fs-WWbLA7Gx.js";
|
|
5
|
+
import "../../data-9h98oZwj.js";
|
|
6
|
+
import { createWebpackLoader } from "../../plugins/loader/webpack.js";
|
|
7
|
+
import "../../loader-BzQpSBvP.js";
|
|
8
|
+
import { t as createJsonLoader } from "../../loader-BhXHF8vy.js";
|
|
9
|
+
|
|
10
|
+
//#region src/collections/json/loader-webpack.ts
|
|
11
|
+
var loader_webpack_default = createWebpackLoader((core) => createJsonLoader(core, "json"));
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { loader_webpack_default as default };
|
|
15
|
+
//# sourceMappingURL=loader-webpack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-webpack.js","names":[],"sources":["../../../src/collections/json/loader-webpack.ts"],"sourcesContent":["import { createWebpackLoader } from \"@/plugins/loader/webpack\";\nimport { createJsonLoader } from \"./loader\";\n\nexport default createWebpackLoader((core) => createJsonLoader(core, \"json\"));\n"],"mappings":";;;;;;;;;;AAGA,6BAAe,qBAAqB,SAAS,iBAAiB,MAAM,OAAO,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "../../core-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import "../../core-BO3b8jMg.js";
|
|
2
|
+
import "../../dynamic-CTYYdl7_.js";
|
|
3
|
+
import { l as WebpackLoader } from "../../index-Da88Sj8w.js";
|
|
4
4
|
|
|
5
5
|
//#region src/collections/mdx/loader-webpack.d.ts
|
|
6
|
-
declare
|
|
6
|
+
declare const _default: WebpackLoader;
|
|
7
7
|
//#endregion
|
|
8
|
-
export {
|
|
8
|
+
export { _default as default };
|
|
9
9
|
//# sourceMappingURL=loader-webpack.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader-webpack.d.ts","names":[],"sources":["../../../src/collections/mdx/loader-webpack.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader-webpack.d.ts","names":[],"sources":["../../../src/collections/mdx/loader-webpack.ts"],"sourcesContent":[],"mappings":""}
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../../
|
|
3
|
-
import "../../
|
|
4
|
-
import "../../
|
|
5
|
-
import "../../
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
1
|
+
import "../../dynamic-DhKTOrIl.js";
|
|
2
|
+
import "../../validation-BvVvvLII.js";
|
|
3
|
+
import "../../loader-BuR4gkKg.js";
|
|
4
|
+
import "../../fs-WWbLA7Gx.js";
|
|
5
|
+
import "../../git-CQWA37-X.js";
|
|
6
|
+
import "../../mdx-iZ2uP27Z.js";
|
|
7
|
+
import { createWebpackLoader } from "../../plugins/loader/webpack.js";
|
|
8
|
+
import "../../fuma-matter-BuBO2w-p.js";
|
|
9
|
+
import { t as createMdxLoader } from "../../loader-D6StkShK.js";
|
|
8
10
|
|
|
9
11
|
//#region src/collections/mdx/loader-webpack.ts
|
|
10
|
-
|
|
11
|
-
async function loader(source) {
|
|
12
|
-
const callback = this.async();
|
|
13
|
-
const options = this.getOptions();
|
|
14
|
-
this.cacheable(true);
|
|
15
|
-
this.addDependency(options.absoluteCompiledConfigPath);
|
|
16
|
-
if (!instance) instance = toWebpack(createMdxLoader(createDynamicCore({
|
|
17
|
-
core: getCore(options),
|
|
18
|
-
buildConfig: false,
|
|
19
|
-
mode: options.isDev ? "dev" : "production"
|
|
20
|
-
})));
|
|
21
|
-
await instance.call(this, source, callback);
|
|
22
|
-
}
|
|
12
|
+
var loader_webpack_default = createWebpackLoader(createMdxLoader);
|
|
23
13
|
|
|
24
14
|
//#endregion
|
|
25
|
-
export {
|
|
15
|
+
export { loader_webpack_default as default };
|
|
26
16
|
//# sourceMappingURL=loader-webpack.js.map
|