fuma-content 1.3.0 → 1.4.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-svlxyp4V.d.ts +10 -0
- package/dist/bun/index.d.ts +1 -1
- package/dist/bun/index.js +1 -1
- package/dist/collections/comark/loader-webpack.d.ts +6 -0
- package/dist/collections/comark/loader-webpack.js +6 -0
- package/dist/collections/comark/runtime-browser.d.ts +24 -0
- package/dist/collections/comark/runtime-browser.js +27 -0
- package/dist/collections/comark/runtime.d.ts +27 -0
- package/dist/collections/comark/runtime.js +23 -0
- package/dist/collections/comark.d.ts +40 -0
- package/dist/collections/comark.js +202 -0
- package/dist/collections/data/runtime.d.ts +2 -2
- package/dist/collections/data.d.ts +3 -3
- package/dist/collections/data.js +2 -2
- package/dist/collections/fs.d.ts +1 -1
- package/dist/collections/index.d.ts +1 -1
- package/dist/collections/json/loader-webpack.d.ts +1 -1
- package/dist/collections/json/loader-webpack.js +1 -1
- package/dist/collections/mdx/loader-webpack.d.ts +1 -1
- package/dist/collections/mdx/loader-webpack.js +1 -1
- package/dist/collections/mdx/react.d.ts +2 -2
- package/dist/collections/mdx/runtime-browser.d.ts +2 -2
- package/dist/collections/mdx/runtime-dynamic.d.ts +4 -4
- package/dist/collections/mdx/runtime-dynamic.js +2 -2
- package/dist/collections/mdx/runtime.d.ts +1 -1
- package/dist/collections/mdx/vue.d.ts +2 -2
- package/dist/collections/mdx.d.ts +1 -1
- package/dist/collections/mdx.js +1 -1
- package/dist/collections/obsidian.d.ts +1 -1
- package/dist/collections/runtime/file-store.d.ts +1 -1
- package/dist/collections/runtime/store.d.ts +1 -1
- package/dist/collections/yaml/loader-webpack.d.ts +1 -1
- package/dist/collections/yaml/loader-webpack.js +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/{core-CrYszxmc.js → core-Cgc-cdSx.js} +11 -10
- package/dist/{dynamic-C15fv7uG.d.ts → dynamic-CO84t8d3.d.ts} +1 -1
- package/dist/dynamic.d.ts +1 -1
- package/dist/{file-store-Bs81Afz5.d.ts → file-store-D5nKTMSL.d.ts} +1 -1
- package/dist/{fs-DYfoYdl-.d.ts → fs-_EGvbkVM.d.ts} +1 -1
- package/dist/{git-C0-Uazuh.d.ts → git-BxnPg5Ao.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{loader-BTPxE-0W.js → loader-9KbB2Twu.js} +6 -3
- package/dist/{loader-DJcLC5Gg.js → loader-D_sKOzDc.js} +1 -1
- package/dist/loader-DjDk5eLt.js +51 -0
- package/dist/{loader-CORy1xd9.js → loader-e2SkeDfY.js} +1 -1
- package/dist/{mdx-0plToRQa.d.ts → mdx-CkXj06oG.d.ts} +2 -2
- package/dist/next/index.d.ts +1 -1
- package/dist/next/index.js +1 -1
- package/dist/node/loader.d.ts +1 -1
- package/dist/node/loader.js +1 -1
- package/dist/{node--IKK4_8Y.js → node-XtGkkaiN.js} +4 -4
- package/dist/plugins/git.d.ts +1 -1
- package/dist/plugins/json-schema.d.ts +1 -1
- package/dist/plugins/loader/index.d.ts +1 -1
- package/dist/plugins/loader/index.js +3 -3
- package/dist/plugins/loader/webpack.d.ts +1 -1
- package/dist/plugins/loader/webpack.js +1 -1
- package/dist/{runtime-4S3BDs-G.d.ts → runtime-5EdZjL1e.d.ts} +4 -4
- package/dist/{runtime-browser-CXjm3FXK.d.ts → runtime-browser-BI2h1vjc.d.ts} +4 -10
- package/dist/{store-j10gHjm1.d.ts → store-BC3n1VPY.d.ts} +1 -1
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/{index-Dfg2QKTT.d.ts → webpack-C8ABoMB_.d.ts} +16 -16
- package/package.json +6 -1
- /package/dist/{build-mdx-DjMJg3TP.js → build-mdx-DRJ7dZuq.js} +0 -0
- /package/dist/{bun-qVjHRKNw.js → bun-NahDFkhR.js} +0 -0
- /package/dist/{core-Dmd3yqUH.d.ts → core-BbTeLenA.d.ts} +0 -0
- /package/dist/{loader-B19JQedw.js → loader-ol04zeoP.js} +0 -0
- /package/dist/{vite-myuLielb.js → vite-DVIOnBqW.js} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { E as Awaitable } from "./core-BbTeLenA.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/async-cache.d.ts
|
|
4
|
+
interface AsyncCache<V> {
|
|
5
|
+
cached: (key: string, fn: () => Awaitable<V>) => V | PromiseLike<V>;
|
|
6
|
+
$value: <T>() => AsyncCache<T>;
|
|
7
|
+
invalidate: (key: string) => void;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { AsyncCache as t };
|
package/dist/bun/index.d.ts
CHANGED
package/dist/bun/index.js
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { t as createComarkLoader } from "../../loader-DjDk5eLt.js";
|
|
2
|
+
import { createWebpackLoader } from "../../plugins/loader/webpack.js";
|
|
3
|
+
//#region src/collections/comark/loader-webpack.ts
|
|
4
|
+
var loader_webpack_default = createWebpackLoader(createComarkLoader);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { loader_webpack_default as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { D as GetCollectionConfig, E as Awaitable } from "../../core-BbTeLenA.js";
|
|
2
|
+
import { n as MapCollectionStore } from "../../store-BC3n1VPY.js";
|
|
3
|
+
import { t as AsyncCache } from "../../async-cache-svlxyp4V.js";
|
|
4
|
+
import { ParsedComark } from "./runtime.js";
|
|
5
|
+
|
|
6
|
+
//#region src/collections/comark/runtime-browser.d.ts
|
|
7
|
+
interface ComarkStoreBrowserData<Frontmatter, Attached = unknown> {
|
|
8
|
+
id: string;
|
|
9
|
+
preload: () => Awaitable<ParsedComark<Frontmatter> & Attached>;
|
|
10
|
+
_store: StoreContext;
|
|
11
|
+
}
|
|
12
|
+
interface StoreContext {
|
|
13
|
+
storeId: string;
|
|
14
|
+
}
|
|
15
|
+
interface StoreData {
|
|
16
|
+
preloaded: AsyncCache<ParsedComark<unknown>>;
|
|
17
|
+
}
|
|
18
|
+
type GetFrontmatter<Config, Name extends string> = GetCollectionConfig<Config, Name> extends {
|
|
19
|
+
$inferFrontmatter: unknown;
|
|
20
|
+
} ? GetCollectionConfig<Config, Name>["$inferFrontmatter"] : never;
|
|
21
|
+
declare const _internal_data: Map<string, StoreData>;
|
|
22
|
+
declare function comarkStoreBrowser<Config, Name extends string, Attached>(name: Name, _input: Record<string, () => Promise<unknown>>): MapCollectionStore<string, ComarkStoreBrowserData<GetFrontmatter<Config, Name>, Attached>>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ComarkStoreBrowserData, _internal_data, comarkStoreBrowser };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as createCache } from "../../async-cache-C47yxLCv.js";
|
|
3
|
+
import { MapCollectionStore } from "../runtime/store.js";
|
|
4
|
+
//#region src/collections/comark/runtime-browser.ts
|
|
5
|
+
const _internal_data = /* @__PURE__ */ new Map();
|
|
6
|
+
function comarkStoreBrowser(name, _input) {
|
|
7
|
+
const input = _input;
|
|
8
|
+
const merged = /* @__PURE__ */ new Map();
|
|
9
|
+
function getStoreData() {
|
|
10
|
+
let store = _internal_data.get(name);
|
|
11
|
+
if (store) return store;
|
|
12
|
+
store = { preloaded: createCache() };
|
|
13
|
+
_internal_data.set(name, store);
|
|
14
|
+
return store;
|
|
15
|
+
}
|
|
16
|
+
const context = { storeId: name };
|
|
17
|
+
for (const [key, value] of Object.entries(input)) merged.set(key, {
|
|
18
|
+
id: key,
|
|
19
|
+
preload() {
|
|
20
|
+
return getStoreData().preloaded.$value().cached(key, value);
|
|
21
|
+
},
|
|
22
|
+
_store: context
|
|
23
|
+
});
|
|
24
|
+
return new MapCollectionStore(merged);
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { _internal_data, comarkStoreBrowser };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { D as GetCollectionConfig } from "../../core-BbTeLenA.js";
|
|
2
|
+
import { t as FileCollectionStore } from "../../file-store-D5nKTMSL.js";
|
|
3
|
+
import { ComarkTree } from "comark";
|
|
4
|
+
|
|
5
|
+
//#region src/collections/comark/runtime.d.ts
|
|
6
|
+
type ParsedComark<Frontmatter> = Omit<ComarkTree, "frontmatter"> & {
|
|
7
|
+
frontmatter: Frontmatter;
|
|
8
|
+
};
|
|
9
|
+
interface ComarkStoreData<Frontmatter, Attached = unknown> {
|
|
10
|
+
id: string;
|
|
11
|
+
tree: ParsedComark<Frontmatter> & Attached;
|
|
12
|
+
}
|
|
13
|
+
type GetFrontmatter<Config, Name extends string> = GetCollectionConfig<Config, Name> extends {
|
|
14
|
+
$inferFrontmatter: unknown;
|
|
15
|
+
} ? GetCollectionConfig<Config, Name>["$inferFrontmatter"] : never;
|
|
16
|
+
declare function comarkStore<Config, Name extends string, Attached>(_name: Name, base: string, _input: Record<string, unknown>): FileCollectionStore<ComarkStoreData<GetFrontmatter<Config, Name>, Attached>>;
|
|
17
|
+
interface ComarkStoreLazyData<Frontmatter, Attached> {
|
|
18
|
+
id: string;
|
|
19
|
+
frontmatter: Frontmatter;
|
|
20
|
+
load: () => Promise<ParsedComark<Frontmatter> & Attached>;
|
|
21
|
+
}
|
|
22
|
+
declare function comarkStoreLazy<Config, Name extends string, Attached>(_name: Name, base: string, _input: {
|
|
23
|
+
head: Record<string, unknown>;
|
|
24
|
+
body: Record<string, () => Promise<unknown>>;
|
|
25
|
+
}): FileCollectionStore<ComarkStoreLazyData<GetFrontmatter<Config, Name>, Attached>>;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { ComarkStoreData, ComarkStoreLazyData, ParsedComark, comarkStore, comarkStoreLazy };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FileCollectionStore } from "../runtime/file-store.js";
|
|
2
|
+
//#region src/collections/comark/runtime.ts
|
|
3
|
+
function comarkStore(_name, base, _input) {
|
|
4
|
+
const input = _input;
|
|
5
|
+
const merged = {};
|
|
6
|
+
for (const [key, value] of Object.entries(input)) merged[key] = {
|
|
7
|
+
id: key,
|
|
8
|
+
tree: value
|
|
9
|
+
};
|
|
10
|
+
return new FileCollectionStore(base, merged);
|
|
11
|
+
}
|
|
12
|
+
function comarkStoreLazy(_name, base, _input) {
|
|
13
|
+
const input = _input;
|
|
14
|
+
const merged = {};
|
|
15
|
+
for (const [key, value] of Object.entries(input.head)) merged[key] = {
|
|
16
|
+
id: key,
|
|
17
|
+
frontmatter: value,
|
|
18
|
+
load: input.body[key]
|
|
19
|
+
};
|
|
20
|
+
return new FileCollectionStore(base, merged);
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { comarkStore, comarkStoreLazy };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { E as Awaitable, m as Collection, v as AsyncPipe } from "../core-BbTeLenA.js";
|
|
2
|
+
import { n as FileSystemCollectionConfig, t as FileSystemCollection } from "../fs-_EGvbkVM.js";
|
|
3
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
|
+
import { ComarkTree, ComarkTree as ComarkTree$1, ParseOptions, ParseOptions as ParseOptions$1 } from "comark";
|
|
5
|
+
|
|
6
|
+
//#region src/collections/comark.d.ts
|
|
7
|
+
interface CompilationContext {
|
|
8
|
+
collection: Collection;
|
|
9
|
+
filePath: string;
|
|
10
|
+
source: string;
|
|
11
|
+
}
|
|
12
|
+
interface ComarkCollectionConfig<FrontmatterSchema extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined> extends Omit<FileSystemCollectionConfig, "supportedFormats"> {
|
|
13
|
+
frontmatter?: FrontmatterSchema;
|
|
14
|
+
options?: ParseOptions$1 | ((environment: "bundler" | "runtime") => Awaitable<ParseOptions$1>);
|
|
15
|
+
lazy?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare class ComarkCollection<FrontmatterSchema extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined> extends FileSystemCollection {
|
|
18
|
+
#private;
|
|
19
|
+
readonly lazy: boolean;
|
|
20
|
+
getComarkOptions(environment: "bundler" | "runtime"): Promise<ParseOptions$1>;
|
|
21
|
+
/**
|
|
22
|
+
* Frontmatter schema
|
|
23
|
+
*/
|
|
24
|
+
frontmatterSchema?: FrontmatterSchema;
|
|
25
|
+
/**
|
|
26
|
+
* Transform & validate frontmatter
|
|
27
|
+
*/
|
|
28
|
+
frontmatter: AsyncPipe<Record<string, unknown> | undefined, CompilationContext>;
|
|
29
|
+
/**
|
|
30
|
+
* Transform the parsed Comark tree.
|
|
31
|
+
*/
|
|
32
|
+
tree: AsyncPipe<ComarkTree$1, CompilationContext>;
|
|
33
|
+
$inferFrontmatter: FrontmatterSchema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<FrontmatterSchema> : Record<string, unknown>;
|
|
34
|
+
constructor(config: ComarkCollectionConfig<FrontmatterSchema>);
|
|
35
|
+
private generateFrontmatterGlob;
|
|
36
|
+
private generateTreeGlob;
|
|
37
|
+
}
|
|
38
|
+
declare function comarkCollection<FrontmatterSchema extends StandardSchemaV1 | undefined = undefined>(config: ComarkCollectionConfig<FrontmatterSchema>): ComarkCollection<FrontmatterSchema>;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { ComarkCollection, ComarkCollectionConfig, type ComarkTree, type ParseOptions, comarkCollection };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { r as asyncPipe } from "../collections-Bl9hpWMS.js";
|
|
2
|
+
import { n as slash } from "../code-generator-DFGEY6P5.js";
|
|
3
|
+
import { r as validate } from "../validation-Bf_v2L3p.js";
|
|
4
|
+
import { t as createCache } from "../async-cache-C47yxLCv.js";
|
|
5
|
+
import { loaderHook } from "../plugins/loader/index.js";
|
|
6
|
+
import { FileSystemCollection } from "./fs.js";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
//#region src/collections/comark.ts
|
|
9
|
+
function formatInitializer(code) {
|
|
10
|
+
return `${code.fn}<${code.typeParams.join()}>(${code.params.join()})`;
|
|
11
|
+
}
|
|
12
|
+
var ComarkCollection = class extends FileSystemCollection {
|
|
13
|
+
lazy;
|
|
14
|
+
#comarkOptions;
|
|
15
|
+
#comarkOptionsCache;
|
|
16
|
+
async getComarkOptions(environment) {
|
|
17
|
+
const options = this.#comarkOptions;
|
|
18
|
+
if (!options) return {};
|
|
19
|
+
if (typeof options !== "function") return options;
|
|
20
|
+
this.#comarkOptionsCache ??= createCache();
|
|
21
|
+
return this.#comarkOptionsCache.cached(environment, () => options(environment));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Frontmatter schema
|
|
25
|
+
*/
|
|
26
|
+
frontmatterSchema;
|
|
27
|
+
/**
|
|
28
|
+
* Transform & validate frontmatter
|
|
29
|
+
*/
|
|
30
|
+
frontmatter = asyncPipe();
|
|
31
|
+
/**
|
|
32
|
+
* Transform the parsed Comark tree.
|
|
33
|
+
*/
|
|
34
|
+
tree = asyncPipe();
|
|
35
|
+
$inferFrontmatter = void 0;
|
|
36
|
+
constructor(config) {
|
|
37
|
+
super({
|
|
38
|
+
dir: config.dir,
|
|
39
|
+
files: config.files,
|
|
40
|
+
supportedFormats: ["md", "mdc"]
|
|
41
|
+
});
|
|
42
|
+
this.#comarkOptions = config.options;
|
|
43
|
+
this.lazy = config.lazy ?? false;
|
|
44
|
+
this.frontmatterSchema = config.frontmatter;
|
|
45
|
+
this.frontmatter.pipe(this.#onFrontmatter.bind(this));
|
|
46
|
+
this.onServer.hook(this.#onServerHandler.bind(this));
|
|
47
|
+
this.onEmit.pipe(this.#onEmitHandler.bind(this));
|
|
48
|
+
this.pluginHook(loaderHook).loaders.push(comarkLoader());
|
|
49
|
+
}
|
|
50
|
+
#onFrontmatter = (data, { filePath }) => {
|
|
51
|
+
if (!this.frontmatterSchema) return data;
|
|
52
|
+
return validate(this.frontmatterSchema, data, void 0, `invalid frontmatter in ${filePath}`);
|
|
53
|
+
};
|
|
54
|
+
#onServerHandler = ({ server, core }) => {
|
|
55
|
+
if (!server.watcher) return;
|
|
56
|
+
server.watcher.on("all", async (event, file) => {
|
|
57
|
+
if (event === "change" || !this.hasFile(file)) return;
|
|
58
|
+
await core.emit({
|
|
59
|
+
filterCollection: (item) => item === this,
|
|
60
|
+
filterWorkspace: () => false,
|
|
61
|
+
write: true
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
#onEmitHandler = async (entries, { core, createCodeGenerator }) => {
|
|
66
|
+
entries.push(await createCodeGenerator(`${this.name}.ts`, async ({ codegen }) => {
|
|
67
|
+
const base = slash(core._toRuntimePath(this.dir));
|
|
68
|
+
codegen.addNamespaceImport("Config", codegen.formatImportPath(core.getOptions().configPath), true);
|
|
69
|
+
if (this.lazy) {
|
|
70
|
+
codegen.addNamedImport(["comarkStoreLazy"], "fuma-content/collections/comark/runtime");
|
|
71
|
+
const headGlob = await this.generateFrontmatterGlob(core, codegen, true);
|
|
72
|
+
const bodyGlob = await this.generateTreeGlob(core, codegen);
|
|
73
|
+
codegen.push(`export const ${this.name} = ${formatInitializer({
|
|
74
|
+
fn: "comarkStoreLazy",
|
|
75
|
+
typeParams: [
|
|
76
|
+
"typeof Config",
|
|
77
|
+
`"${this.name}"`,
|
|
78
|
+
"unknown"
|
|
79
|
+
],
|
|
80
|
+
params: [
|
|
81
|
+
`"${this.name}"`,
|
|
82
|
+
`"${base}"`,
|
|
83
|
+
`{ head: ${headGlob}, body: ${bodyGlob} }`
|
|
84
|
+
]
|
|
85
|
+
})};`);
|
|
86
|
+
} else {
|
|
87
|
+
codegen.addNamedImport(["comarkStore"], "fuma-content/collections/comark/runtime");
|
|
88
|
+
codegen.push(`export const ${this.name} = ${formatInitializer({
|
|
89
|
+
fn: "comarkStore",
|
|
90
|
+
typeParams: [
|
|
91
|
+
"typeof Config",
|
|
92
|
+
`"${this.name}"`,
|
|
93
|
+
"unknown"
|
|
94
|
+
],
|
|
95
|
+
params: [
|
|
96
|
+
`"${this.name}"`,
|
|
97
|
+
`"${base}"`,
|
|
98
|
+
await this.generateTreeGlob(core, codegen, true)
|
|
99
|
+
]
|
|
100
|
+
})};`);
|
|
101
|
+
}
|
|
102
|
+
}), await createCodeGenerator(`${this.name}.browser.ts`, async ({ codegen }) => {
|
|
103
|
+
codegen.addNamedImport(["comarkStoreBrowser"], "fuma-content/collections/comark/runtime-browser");
|
|
104
|
+
codegen.addNamespaceImport("Config", codegen.formatImportPath(core.getOptions().configPath), true);
|
|
105
|
+
codegen.push(`export const ${this.name} = ${formatInitializer({
|
|
106
|
+
fn: "comarkStoreBrowser",
|
|
107
|
+
typeParams: [
|
|
108
|
+
"typeof Config",
|
|
109
|
+
`"${this.name}"`,
|
|
110
|
+
"unknown"
|
|
111
|
+
],
|
|
112
|
+
params: [`"${this.name}"`, await this.generateTreeGlob(core, codegen)]
|
|
113
|
+
})};`);
|
|
114
|
+
}));
|
|
115
|
+
return entries;
|
|
116
|
+
};
|
|
117
|
+
async generateFrontmatterGlob(core, codegen, eager = false) {
|
|
118
|
+
let s = `{`;
|
|
119
|
+
const query = codegen.formatQuery({
|
|
120
|
+
collection: this.name,
|
|
121
|
+
only: "frontmatter",
|
|
122
|
+
workspace: core.getWorkspace()?.name
|
|
123
|
+
});
|
|
124
|
+
for (const file of await this.getFiles()) {
|
|
125
|
+
const fullPath = path.join(this.dir, file);
|
|
126
|
+
const specifier = `${codegen.formatImportPath(fullPath)}?${query}`;
|
|
127
|
+
if (eager) {
|
|
128
|
+
const name = codegen.generateImportName();
|
|
129
|
+
codegen.addNamedImport([`frontmatter as ${name}`], specifier);
|
|
130
|
+
s += `"${slash(file)}": ${name},`;
|
|
131
|
+
} else s += `"${slash(file)}": () => ${codegen.formatDynamicImport(specifier, "frontmatter")},`;
|
|
132
|
+
}
|
|
133
|
+
s += "}";
|
|
134
|
+
return s;
|
|
135
|
+
}
|
|
136
|
+
async generateTreeGlob(core, codegen, eager = false) {
|
|
137
|
+
let s = `{`;
|
|
138
|
+
const query = codegen.formatQuery({
|
|
139
|
+
collection: this.name,
|
|
140
|
+
workspace: core.getWorkspace()?.name
|
|
141
|
+
});
|
|
142
|
+
for (const file of await this.getFiles()) {
|
|
143
|
+
const fullPath = path.join(this.dir, file);
|
|
144
|
+
const specifier = `${codegen.formatImportPath(fullPath)}?${query}`;
|
|
145
|
+
if (eager) {
|
|
146
|
+
const name = codegen.generateImportName();
|
|
147
|
+
codegen.addNamedImport([`default as ${name}`], specifier);
|
|
148
|
+
s += `"${slash(file)}": ${name},`;
|
|
149
|
+
} else s += `"${slash(file)}": () => ${codegen.formatDynamicImport(specifier, "default")},`;
|
|
150
|
+
}
|
|
151
|
+
s += "}";
|
|
152
|
+
return s;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
function comarkCollection(config) {
|
|
156
|
+
return new ComarkCollection(config);
|
|
157
|
+
}
|
|
158
|
+
function comarkLoader() {
|
|
159
|
+
const test = /\.(?:md|mdc)(\?.+?)?$/;
|
|
160
|
+
return {
|
|
161
|
+
id: "comark",
|
|
162
|
+
test,
|
|
163
|
+
configureNext(nextConfig) {
|
|
164
|
+
const loaderPath = "fuma-content/collections/comark/loader-webpack";
|
|
165
|
+
const loaderOptions = this.getLoaderOptions();
|
|
166
|
+
return {
|
|
167
|
+
...nextConfig,
|
|
168
|
+
turbopack: {
|
|
169
|
+
...nextConfig.turbopack,
|
|
170
|
+
rules: {
|
|
171
|
+
...nextConfig.turbopack?.rules,
|
|
172
|
+
"*.{md,mdc}": {
|
|
173
|
+
loaders: [{
|
|
174
|
+
loader: loaderPath,
|
|
175
|
+
options: loaderOptions
|
|
176
|
+
}],
|
|
177
|
+
as: "*.js"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
webpack(config, options) {
|
|
182
|
+
config.module ||= {};
|
|
183
|
+
config.module.rules ||= [];
|
|
184
|
+
config.module.rules.push({
|
|
185
|
+
test,
|
|
186
|
+
use: [options.defaultLoaders.babel, {
|
|
187
|
+
loader: loaderPath,
|
|
188
|
+
options: loaderOptions
|
|
189
|
+
}]
|
|
190
|
+
});
|
|
191
|
+
return nextConfig.webpack?.(config, options) ?? config;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
},
|
|
195
|
+
async createLoader() {
|
|
196
|
+
const { createComarkLoader } = await import("../loader-DjDk5eLt.js").then((n) => n.n);
|
|
197
|
+
return createComarkLoader({ getCore: () => this.core });
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
//#endregion
|
|
202
|
+
export { ComarkCollection, comarkCollection };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as GetCollectionConfig } from "../../core-
|
|
2
|
-
import { t as FileCollectionStore } from "../../file-store-
|
|
1
|
+
import { D as GetCollectionConfig } from "../../core-BbTeLenA.js";
|
|
2
|
+
import { t as FileCollectionStore } from "../../file-store-D5nKTMSL.js";
|
|
3
3
|
|
|
4
4
|
//#region src/collections/data/runtime.d.ts
|
|
5
5
|
declare function dataStore<Config, Name extends string>(_name: Name, base: string, input: Record<string, unknown>): FileCollectionStore<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { v as AsyncPipe } from "../core-
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
1
|
+
import { v as AsyncPipe } from "../core-BbTeLenA.js";
|
|
2
|
+
import { n as FileSystemCollectionConfig, t as FileSystemCollection } from "../fs-_EGvbkVM.js";
|
|
3
|
+
import { a as LoaderConfig } from "../webpack-C8ABoMB_.js";
|
|
4
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
5
|
|
|
6
6
|
//#region src/collections/data.d.ts
|
package/dist/collections/data.js
CHANGED
|
@@ -101,7 +101,7 @@ function yamlLoader() {
|
|
|
101
101
|
};
|
|
102
102
|
},
|
|
103
103
|
async createLoader() {
|
|
104
|
-
const { createYamlLoader } = await import("../loader-
|
|
104
|
+
const { createYamlLoader } = await import("../loader-D_sKOzDc.js").then((n) => n.n);
|
|
105
105
|
const core = this.core;
|
|
106
106
|
return createYamlLoader({ getCore: () => core });
|
|
107
107
|
}
|
|
@@ -146,7 +146,7 @@ function jsonLoader() {
|
|
|
146
146
|
};
|
|
147
147
|
},
|
|
148
148
|
async createLoader(environment) {
|
|
149
|
-
const { createJsonLoader } = await import("../loader-
|
|
149
|
+
const { createJsonLoader } = await import("../loader-e2SkeDfY.js").then((n) => n.n);
|
|
150
150
|
const core = this.core;
|
|
151
151
|
return createJsonLoader({ getCore: () => core }, environment === "vite" ? "json" : "js");
|
|
152
152
|
}
|
package/dist/collections/fs.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as FileSystemCollectionConfig, r as fileSystemCollection, t as FileSystemCollection } from "../fs-
|
|
1
|
+
import { n as FileSystemCollectionConfig, r as fileSystemCollection, t as FileSystemCollection } from "../fs-_EGvbkVM.js";
|
|
2
2
|
export { FileSystemCollection, FileSystemCollectionConfig, fileSystemCollection };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as defineCollectionHook, g as CollectionHookContext, h as CollectionHook, m as Collection } from "../core-
|
|
1
|
+
import { _ as defineCollectionHook, g as CollectionHookContext, h as CollectionHook, m as Collection } from "../core-BbTeLenA.js";
|
|
2
2
|
export { Collection, CollectionHook, CollectionHookContext, defineCollectionHook };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createWebpackLoader } from "../../plugins/loader/webpack.js";
|
|
2
|
-
import { t as createJsonLoader } from "../../loader-
|
|
2
|
+
import { t as createJsonLoader } from "../../loader-e2SkeDfY.js";
|
|
3
3
|
//#region src/collections/json/loader-webpack.ts
|
|
4
4
|
var loader_webpack_default = createWebpackLoader((core) => createJsonLoader(core, "json"));
|
|
5
5
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createWebpackLoader } from "../../plugins/loader/webpack.js";
|
|
2
|
-
import { t as createMdxLoader } from "../../loader-
|
|
2
|
+
import { t as createMdxLoader } from "../../loader-9KbB2Twu.js";
|
|
3
3
|
//#region src/collections/mdx/loader-webpack.ts
|
|
4
4
|
var loader_webpack_default = createWebpackLoader(createMdxLoader);
|
|
5
5
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as CompiledMDX } from "../../mdx-
|
|
2
|
-
import { t as MDXStoreBrowserData } from "../../runtime-browser-
|
|
1
|
+
import { i as CompiledMDX } from "../../mdx-CkXj06oG.js";
|
|
2
|
+
import { t as MDXStoreBrowserData } from "../../runtime-browser-BI2h1vjc.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/collections/mdx/react.d.ts
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as
|
|
1
|
+
import { r as WithGit } from "../../runtime-5EdZjL1e.js";
|
|
2
|
+
import { n as _internal_data, r as mdxStoreBrowser, t as MDXStoreBrowserData } from "../../runtime-browser-BI2h1vjc.js";
|
|
3
3
|
export { MDXStoreBrowserData, WithGit, _internal_data, mdxStoreBrowser };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { D as GetCollectionConfig, n as CoreOptions } from "../../core-
|
|
2
|
-
import { t as FileCollectionStore } from "../../file-store-
|
|
3
|
-
import { i as CompiledMDX } from "../../mdx-
|
|
4
|
-
import { r as WithGit } from "../../runtime-
|
|
1
|
+
import { D as GetCollectionConfig, n as CoreOptions } from "../../core-BbTeLenA.js";
|
|
2
|
+
import { t as FileCollectionStore } from "../../file-store-D5nKTMSL.js";
|
|
3
|
+
import { i as CompiledMDX } from "../../mdx-CkXj06oG.js";
|
|
4
|
+
import { r as WithGit } from "../../runtime-5EdZjL1e.js";
|
|
5
5
|
import { MDXContent } from "mdx/types";
|
|
6
6
|
|
|
7
7
|
//#region src/collections/mdx/runtime-dynamic.d.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as Core } from "../../core-
|
|
1
|
+
import { t as Core } from "../../core-Cgc-cdSx.js";
|
|
2
2
|
import { t as createCache } from "../../async-cache-C47yxLCv.js";
|
|
3
3
|
import { MDXCollection } from "../mdx.js";
|
|
4
4
|
import { parseFrontmatter } from "../../utils/frontmatter.js";
|
|
5
5
|
import { FileCollectionStore } from "../runtime/file-store.js";
|
|
6
|
-
import { t as buildMDX } from "../../build-mdx-
|
|
6
|
+
import { t as buildMDX } from "../../build-mdx-DRJ7dZuq.js";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import { pathToFileURL } from "node:url";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as mdxStoreLazy, i as mdxStore, n as MDXStoreLazyData, r as WithGit, t as MDXStoreData } from "../../runtime-
|
|
1
|
+
import { a as mdxStoreLazy, i as mdxStore, n as MDXStoreLazyData, r as WithGit, t as MDXStoreData } from "../../runtime-5EdZjL1e.js";
|
|
2
2
|
export { MDXStoreData, MDXStoreLazyData, WithGit, mdxStore, mdxStoreLazy };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as CompiledMDX } from "../../mdx-
|
|
2
|
-
import { t as MDXStoreBrowserData } from "../../runtime-browser-
|
|
1
|
+
import { i as CompiledMDX } from "../../mdx-CkXj06oG.js";
|
|
2
|
+
import { t as MDXStoreBrowserData } from "../../runtime-browser-BI2h1vjc.js";
|
|
3
3
|
import * as _$vue from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/collections/mdx/vue.vue.d.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as LinkReference, i as CompiledMDX, n as MDXCollectionConfig, r as mdxCollection, t as MDXCollection } from "../mdx-
|
|
1
|
+
import { a as LinkReference, i as CompiledMDX, n as MDXCollectionConfig, r as mdxCollection, t as MDXCollection } from "../mdx-CkXj06oG.js";
|
|
2
2
|
export { CompiledMDX, LinkReference, MDXCollection, MDXCollectionConfig, mdxCollection };
|
package/dist/collections/mdx.js
CHANGED
|
@@ -312,7 +312,7 @@ function mdxLoader() {
|
|
|
312
312
|
};
|
|
313
313
|
},
|
|
314
314
|
async createLoader() {
|
|
315
|
-
const { createMdxLoader } = await import("../loader-
|
|
315
|
+
const { createMdxLoader } = await import("../loader-9KbB2Twu.js").then((n) => n.n);
|
|
316
316
|
return createMdxLoader({ getCore: () => this.core });
|
|
317
317
|
}
|
|
318
318
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as FileInfo, t as FileCollectionStore } from "../../file-store-
|
|
1
|
+
import { n as FileInfo, t as FileCollectionStore } from "../../file-store-D5nKTMSL.js";
|
|
2
2
|
export { FileCollectionStore, FileInfo };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as MapCollectionStore, t as CollectionStore } from "../../store-
|
|
1
|
+
import { n as MapCollectionStore, t as CollectionStore } from "../../store-BC3n1VPY.js";
|
|
2
2
|
export { CollectionStore, MapCollectionStore };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createWebpackLoader } from "../../plugins/loader/webpack.js";
|
|
2
|
-
import { t as createYamlLoader } from "../../loader-
|
|
2
|
+
import { t as createYamlLoader } from "../../loader-D_sKOzDc.js";
|
|
3
3
|
//#region src/collections/yaml/loader-webpack.ts
|
|
4
4
|
var loader_webpack_default = createWebpackLoader((core) => createYamlLoader(core));
|
|
5
5
|
//#endregion
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as GlobalConfig, M as defineConfig, O as CollectionsPack, j as WorkspaceConfig, k as EmitConfig } from "../core-
|
|
1
|
+
import { A as GlobalConfig, M as defineConfig, O as CollectionsPack, j as WorkspaceConfig, k as EmitConfig } from "../core-BbTeLenA.js";
|
|
2
2
|
export { CollectionsPack, EmitConfig, GlobalConfig, WorkspaceConfig, defineConfig };
|
|
@@ -186,16 +186,17 @@ var Core = class Core {
|
|
|
186
186
|
}
|
|
187
187
|
async initConfig(config) {
|
|
188
188
|
const collections = /* @__PURE__ */ new Map();
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
globalConfig
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
189
|
+
const globalConfig = {};
|
|
190
|
+
for (const [k, v] of Object.entries(config)) if (v instanceof Collection) {
|
|
191
|
+
globalConfig.collections ??= {};
|
|
192
|
+
globalConfig.collections[k] = v;
|
|
193
|
+
} else if (k === "default") {
|
|
194
|
+
const { collections, ...rest } = v;
|
|
195
|
+
globalConfig.collections ??= {};
|
|
196
|
+
Object.assign(globalConfig, rest);
|
|
197
|
+
Object.assign(globalConfig.collections, collections);
|
|
198
|
+
} else globalConfig[k] = v;
|
|
199
|
+
const pendingCollections = new Map(globalConfig.collections ? Object.entries(globalConfig.collections) : void 0);
|
|
199
200
|
while (pendingCollections.size > 0) {
|
|
200
201
|
const entries = Array.from(pendingCollections.entries());
|
|
201
202
|
pendingCollections.clear();
|
package/dist/dynamic.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createDynamicCore, t as DynamicCore } from "./dynamic-
|
|
1
|
+
import { n as createDynamicCore, t as DynamicCore } from "./dynamic-CO84t8d3.js";
|
|
2
2
|
export { DynamicCore, createDynamicCore };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Hook, D as GetCollectionConfig, S as AsyncHook, T as hook, a as EmitOptions, b as asyncPipe, c as PluginContext, d as ResolvedCoreOptions, f as ServerContext, i as EmitEntry, l as PluginOption, n as CoreOptions, o as EmitOutput, r as EmitContext, s as Plugin, t as Core, u as ResolvedConfig, v as AsyncPipe, w as asyncHook, x as pipe, y as Pipe } from "./core-
|
|
1
|
+
import { C as Hook, D as GetCollectionConfig, S as AsyncHook, T as hook, a as EmitOptions, b as asyncPipe, c as PluginContext, d as ResolvedCoreOptions, f as ServerContext, i as EmitEntry, l as PluginOption, n as CoreOptions, o as EmitOutput, r as EmitContext, s as Plugin, t as Core, u as ResolvedConfig, v as AsyncPipe, w as asyncHook, x as pipe, y as Pipe } from "./core-BbTeLenA.js";
|
|
2
2
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/validation.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as asyncHook, i as pipe, o as hook, r as asyncPipe } from "./collections-Bl9hpWMS.js";
|
|
2
|
-
import { t as Core } from "./core-
|
|
2
|
+
import { t as Core } from "./core-Cgc-cdSx.js";
|
|
3
3
|
import { n as getJSONSchema, r as validate, t as ValidationError } from "./validation-Bf_v2L3p.js";
|
|
4
4
|
export { Core, ValidationError, asyncHook, asyncPipe, getJSONSchema, hook, pipe, validate };
|
|
@@ -24,6 +24,11 @@ function createMdxLoader({ getCore }) {
|
|
|
24
24
|
const matter = parseFrontmatter(value);
|
|
25
25
|
const { collection: collectionName, workspace, only } = querySchema.parse(query);
|
|
26
26
|
if (workspace) core = core.getWorkspaces().get(workspace) ?? core;
|
|
27
|
+
let collection = collectionName ? core.getCollection(collectionName) : void 0;
|
|
28
|
+
if (!(collection instanceof MDXCollection)) {
|
|
29
|
+
if (collectionName) return null;
|
|
30
|
+
collection = void 0;
|
|
31
|
+
}
|
|
27
32
|
let after;
|
|
28
33
|
const { experimentalBuildCache = false } = core.getConfig();
|
|
29
34
|
if (!isDevelopment && experimentalBuildCache) {
|
|
@@ -39,8 +44,6 @@ function createMdxLoader({ getCore }) {
|
|
|
39
44
|
}));
|
|
40
45
|
};
|
|
41
46
|
}
|
|
42
|
-
let collection = collectionName ? core.getCollection(collectionName) : void 0;
|
|
43
|
-
if (!(collection instanceof MDXCollection)) collection = void 0;
|
|
44
47
|
if (collection?.frontmatter) matter.data = await collection.frontmatter.run(matter.data, {
|
|
45
48
|
collection,
|
|
46
49
|
filePath,
|
|
@@ -51,7 +54,7 @@ function createMdxLoader({ getCore }) {
|
|
|
51
54
|
map: null
|
|
52
55
|
};
|
|
53
56
|
const lineOffset = isDevelopment ? countLines(matter.matter) : 0;
|
|
54
|
-
const { buildMDX } = await import("./build-mdx-
|
|
57
|
+
const { buildMDX } = await import("./build-mdx-DRJ7dZuq.js").then((n) => n.n);
|
|
55
58
|
const compiled = await buildMDX({
|
|
56
59
|
core,
|
|
57
60
|
collection,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-CiIaOW0V.js";
|
|
2
|
-
import { t as createDataLoader } from "./loader-
|
|
2
|
+
import { t as createDataLoader } from "./loader-ol04zeoP.js";
|
|
3
3
|
import { load } from "js-yaml";
|
|
4
4
|
//#region src/collections/yaml/loader.ts
|
|
5
5
|
var loader_exports = /* @__PURE__ */ __exportAll({ createYamlLoader: () => createYamlLoader });
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-CiIaOW0V.js";
|
|
2
|
+
import { ComarkCollection } from "./collections/comark.js";
|
|
3
|
+
import { parseFrontmatter } from "./utils/frontmatter.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region src/collections/comark/loader.ts
|
|
6
|
+
var loader_exports = /* @__PURE__ */ __exportAll({ createComarkLoader: () => createComarkLoader });
|
|
7
|
+
const querySchema = z.object({
|
|
8
|
+
only: z.literal(["frontmatter", "all"]).default("all"),
|
|
9
|
+
collection: z.string().optional(),
|
|
10
|
+
workspace: z.string().optional()
|
|
11
|
+
}).loose();
|
|
12
|
+
function createComarkLoader({ getCore }) {
|
|
13
|
+
return { async load({ getSource, query, filePath }) {
|
|
14
|
+
let core = await getCore();
|
|
15
|
+
const value = await getSource();
|
|
16
|
+
const matter = parseFrontmatter(value);
|
|
17
|
+
const { collection: collectionName, workspace, only } = querySchema.parse(query);
|
|
18
|
+
if (workspace) core = core.getWorkspaces().get(workspace) ?? core;
|
|
19
|
+
let collection = collectionName ? core.getCollection(collectionName) : void 0;
|
|
20
|
+
if (!(collection instanceof ComarkCollection)) {
|
|
21
|
+
if (collectionName) return null;
|
|
22
|
+
collection = void 0;
|
|
23
|
+
}
|
|
24
|
+
if (collection?.frontmatter) matter.data = await collection.frontmatter.run(matter.data, {
|
|
25
|
+
collection,
|
|
26
|
+
filePath,
|
|
27
|
+
source: value
|
|
28
|
+
});
|
|
29
|
+
if (only === "frontmatter") return {
|
|
30
|
+
code: `export const frontmatter = ${JSON.stringify(matter.data)}`,
|
|
31
|
+
map: null
|
|
32
|
+
};
|
|
33
|
+
const { parse } = await import("comark");
|
|
34
|
+
let tree = await parse(value, await collection?.getComarkOptions("bundler"));
|
|
35
|
+
tree.frontmatter = matter.data;
|
|
36
|
+
if (collection?.tree) tree = await collection.tree.run(tree, {
|
|
37
|
+
collection,
|
|
38
|
+
filePath,
|
|
39
|
+
source: value
|
|
40
|
+
});
|
|
41
|
+
const serialized = JSON.stringify(tree);
|
|
42
|
+
return {
|
|
43
|
+
code: `export const frontmatter = ${JSON.stringify(tree.frontmatter)};
|
|
44
|
+
export const tree = ${serialized};
|
|
45
|
+
export default tree;`,
|
|
46
|
+
map: null
|
|
47
|
+
};
|
|
48
|
+
} };
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { loader_exports as n, createComarkLoader as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-CiIaOW0V.js";
|
|
2
|
-
import { t as createDataLoader } from "./loader-
|
|
2
|
+
import { t as createDataLoader } from "./loader-ol04zeoP.js";
|
|
3
3
|
//#region src/collections/json/loader.ts
|
|
4
4
|
var loader_exports = /* @__PURE__ */ __exportAll({ createJsonLoader: () => createJsonLoader });
|
|
5
5
|
function createJsonLoader(core, resolveJson = "js") {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as Awaitable, m as Collection, p as CodeGenerator, t as Core, v as AsyncPipe, y as Pipe } from "./core-
|
|
2
|
-
import { n as FileSystemCollectionConfig, t as FileSystemCollection } from "./fs-
|
|
1
|
+
import { E as Awaitable, m as Collection, p as CodeGenerator, t as Core, v as AsyncPipe, y as Pipe } from "./core-BbTeLenA.js";
|
|
2
|
+
import { n as FileSystemCollectionConfig, t as FileSystemCollection } from "./fs-_EGvbkVM.js";
|
|
3
3
|
import { VFile } from "vfile";
|
|
4
4
|
import { ProcessorOptions, createProcessor } from "@mdx-js/mdx";
|
|
5
5
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
package/dist/next/index.d.ts
CHANGED
package/dist/next/index.js
CHANGED
package/dist/node/loader.d.ts
CHANGED
package/dist/node/loader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createDynamicCore } from "../dynamic.js";
|
|
2
|
-
import { t as Core } from "../core-
|
|
2
|
+
import { t as Core } from "../core-Cgc-cdSx.js";
|
|
3
3
|
import { t as createCache } from "../async-cache-C47yxLCv.js";
|
|
4
4
|
import { loaderPlugin } from "../plugins/loader/index.js";
|
|
5
5
|
//#region src/node/loader.ts
|
|
@@ -4,10 +4,10 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
function toNode(loaders) {
|
|
5
5
|
return async (url, _context, nextLoad) => {
|
|
6
6
|
if (!url.startsWith("file:///")) return nextLoad(url);
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const parsedUrl = new URL(url);
|
|
8
|
+
const filePath = fileURLToPath(parsedUrl);
|
|
9
|
+
for (const config of loaders) {
|
|
10
|
+
if (config.test && !config.test.test(url)) continue;
|
|
11
11
|
const result = await config.loader.load({
|
|
12
12
|
filePath,
|
|
13
13
|
query: Object.fromEntries(parsedUrl.searchParams.entries()),
|
package/dist/plugins/git.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as gitHook, i as git, n as GitFileData, r as GitHook, t as GitClient } from "../git-
|
|
1
|
+
import { a as gitHook, i as git, n as GitFileData, r as GitHook, t as GitClient } from "../git-BxnPg5Ao.js";
|
|
2
2
|
export { GitClient, GitFileData, GitHook, git as default, gitHook };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as LoaderConfig, c as LoaderOutput, i as Loader, l as loaderHook, o as LoaderHook, s as LoaderInput, u as loaderPlugin } from "../../webpack-C8ABoMB_.js";
|
|
2
2
|
export { Loader, LoaderConfig, LoaderHook, LoaderInput, LoaderOutput, loaderHook, loaderPlugin };
|
|
@@ -52,15 +52,15 @@ function loaderPlugin() {
|
|
|
52
52
|
return config;
|
|
53
53
|
} },
|
|
54
54
|
bun: { async setup(build) {
|
|
55
|
-
const { toBun } = await import("../../bun-
|
|
55
|
+
const { toBun } = await import("../../bun-NahDFkhR.js");
|
|
56
56
|
for (const loader of await initLoaders(this, "bun")) toBun(loader.test, loader.loader)(build);
|
|
57
57
|
} },
|
|
58
58
|
node: { async createLoad() {
|
|
59
|
-
const { toNode } = await import("../../node
|
|
59
|
+
const { toNode } = await import("../../node-XtGkkaiN.js");
|
|
60
60
|
return toNode(await initLoaders(this, "node"));
|
|
61
61
|
} },
|
|
62
62
|
vite: { async createPlugin() {
|
|
63
|
-
const { toVite } = await import("../../vite-
|
|
63
|
+
const { toVite } = await import("../../vite-DVIOnBqW.js");
|
|
64
64
|
return (await initLoaders(this, "vite")).map((loader) => {
|
|
65
65
|
return toVite(`fuma-content:${loader.id}`, loader.test, loader.loader);
|
|
66
66
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as WebpackLoaderOptions, r as createWebpackLoader, t as WebpackLoader } from "../../webpack-C8ABoMB_.js";
|
|
2
2
|
export { WebpackLoader, WebpackLoaderOptions, createWebpackLoader };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createDynamicCore } from "../../dynamic.js";
|
|
2
|
-
import { t as Core } from "../../core-
|
|
2
|
+
import { t as Core } from "../../core-Cgc-cdSx.js";
|
|
3
3
|
import { t as ValidationError } from "../../validation-Bf_v2L3p.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { parse } from "node:querystring";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { D as GetCollectionConfig } from "./core-
|
|
2
|
-
import { t as FileCollectionStore } from "./file-store-
|
|
3
|
-
import { i as CompiledMDX } from "./mdx-
|
|
4
|
-
import { n as GitFileData } from "./git-
|
|
1
|
+
import { D as GetCollectionConfig } from "./core-BbTeLenA.js";
|
|
2
|
+
import { t as FileCollectionStore } from "./file-store-D5nKTMSL.js";
|
|
3
|
+
import { i as CompiledMDX } from "./mdx-CkXj06oG.js";
|
|
4
|
+
import { n as GitFileData } from "./git-BxnPg5Ao.js";
|
|
5
5
|
|
|
6
6
|
//#region src/collections/mdx/runtime.d.ts
|
|
7
7
|
interface MDXStoreData<Frontmatter, Attached = unknown> {
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import { D as GetCollectionConfig, E as Awaitable } from "./core-
|
|
2
|
-
import { n as MapCollectionStore } from "./store-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
interface AsyncCache<V> {
|
|
6
|
-
cached: (key: string, fn: () => Awaitable<V>) => V | PromiseLike<V>;
|
|
7
|
-
$value: <T>() => AsyncCache<T>;
|
|
8
|
-
invalidate: (key: string) => void;
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
1
|
+
import { D as GetCollectionConfig, E as Awaitable } from "./core-BbTeLenA.js";
|
|
2
|
+
import { n as MapCollectionStore } from "./store-BC3n1VPY.js";
|
|
3
|
+
import { t as AsyncCache } from "./async-cache-svlxyp4V.js";
|
|
4
|
+
import { i as CompiledMDX } from "./mdx-CkXj06oG.js";
|
|
11
5
|
//#region src/collections/mdx/runtime-browser.d.ts
|
|
12
6
|
interface MDXStoreBrowserData<Frontmatter, Attached = unknown> {
|
|
13
7
|
id: string;
|
package/dist/vite/index.d.ts
CHANGED
package/dist/vite/index.js
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
import { c as PluginContext, h as CollectionHook, s as Plugin } from "./core-
|
|
2
|
-
import { t as DynamicCore } from "./dynamic-
|
|
1
|
+
import { c as PluginContext, h as CollectionHook, s as Plugin } from "./core-BbTeLenA.js";
|
|
2
|
+
import { t as DynamicCore } from "./dynamic-CO84t8d3.js";
|
|
3
3
|
import { NextConfig } from "next";
|
|
4
4
|
import { LoaderContext } from "webpack";
|
|
5
5
|
|
|
6
|
-
//#region src/plugins/loader/webpack.d.ts
|
|
7
|
-
interface WebpackLoaderOptions {
|
|
8
|
-
absoluteCompiledConfigPath: string;
|
|
9
|
-
configPath: string;
|
|
10
|
-
outDir: string;
|
|
11
|
-
isDev: boolean;
|
|
12
|
-
}
|
|
13
|
-
type WebpackLoader = (this: LoaderContext<WebpackLoaderOptions>, source: string) => void;
|
|
14
|
-
/**
|
|
15
|
-
* Note: need to handle the `test` regex in Webpack config instead.
|
|
16
|
-
*/
|
|
17
|
-
declare function createWebpackLoader(loaderFactory: (core: DynamicCore) => Loader): WebpackLoader;
|
|
18
|
-
//#endregion
|
|
19
6
|
//#region src/plugins/loader/index.d.ts
|
|
20
7
|
type Awaitable<T> = T | Promise<T>;
|
|
21
8
|
type LoaderEnvironment = "vite" | "bun" | "node";
|
|
@@ -80,4 +67,17 @@ interface LoaderHook {
|
|
|
80
67
|
}
|
|
81
68
|
declare const loaderHook: CollectionHook<LoaderHook, undefined>;
|
|
82
69
|
//#endregion
|
|
83
|
-
|
|
70
|
+
//#region src/plugins/loader/webpack.d.ts
|
|
71
|
+
interface WebpackLoaderOptions {
|
|
72
|
+
absoluteCompiledConfigPath: string;
|
|
73
|
+
configPath: string;
|
|
74
|
+
outDir: string;
|
|
75
|
+
isDev: boolean;
|
|
76
|
+
}
|
|
77
|
+
type WebpackLoader = (this: LoaderContext<WebpackLoaderOptions>, source: string) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Note: need to handle the `test` regex in Webpack config instead.
|
|
80
|
+
*/
|
|
81
|
+
declare function createWebpackLoader(loaderFactory: (core: DynamicCore) => Loader): WebpackLoader;
|
|
82
|
+
//#endregion
|
|
83
|
+
export { LoaderConfig as a, LoaderOutput as c, Loader as i, loaderHook as l, WebpackLoaderOptions as n, LoaderHook as o, createWebpackLoader as r, LoaderInput as s, WebpackLoader as t, loaderPlugin as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fuma-content",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "The content processing layer for your app.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Content",
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
".": "./dist/index.js",
|
|
23
23
|
"./bun": "./dist/bun/index.js",
|
|
24
24
|
"./collections": "./dist/collections/index.js",
|
|
25
|
+
"./collections/comark": "./dist/collections/comark.js",
|
|
26
|
+
"./collections/comark/loader-webpack": "./dist/collections/comark/loader-webpack.js",
|
|
27
|
+
"./collections/comark/runtime": "./dist/collections/comark/runtime.js",
|
|
28
|
+
"./collections/comark/runtime-browser": "./dist/collections/comark/runtime-browser.js",
|
|
25
29
|
"./collections/data": "./dist/collections/data.js",
|
|
26
30
|
"./collections/data/runtime": "./dist/collections/data/runtime.js",
|
|
27
31
|
"./collections/fs": "./dist/collections/fs.js",
|
|
@@ -58,6 +62,7 @@
|
|
|
58
62
|
"@mdx-js/mdx": "^3.1.1",
|
|
59
63
|
"@standard-schema/spec": "^1.1.0",
|
|
60
64
|
"chokidar": "^5.0.0",
|
|
65
|
+
"comark": "^0.3.2",
|
|
61
66
|
"esbuild": "^0.28.0",
|
|
62
67
|
"estree-util-value-to-estree": "^3.5.0",
|
|
63
68
|
"github-slugger": "^2.0.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|