fuma-content 1.0.0 → 1.0.2
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-BM9Yf4Nw.js +29 -0
- package/dist/async-cache-BM9Yf4Nw.js.map +1 -0
- package/dist/bin.d.ts +1 -1
- package/dist/bin.js +21 -14
- package/dist/bin.js.map +1 -0
- package/dist/build-D8A5ByFk.js +42 -0
- package/dist/build-D8A5ByFk.js.map +1 -0
- package/dist/build-mdx-C1PZsGp2.js +395 -0
- package/dist/build-mdx-C1PZsGp2.js.map +1 -0
- package/dist/build-mdx-DFndaVbS.js +4 -0
- package/dist/bun/index.d.ts +6 -13
- package/dist/bun/index.d.ts.map +1 -0
- package/dist/bun/index.js +23 -33
- package/dist/bun/index.js.map +1 -0
- package/dist/bun-QKQnqgIi.js +35 -0
- package/dist/bun-QKQnqgIi.js.map +1 -0
- package/dist/code-generator-gPtrfZ6Q.js +133 -0
- package/dist/code-generator-gPtrfZ6Q.js.map +1 -0
- package/dist/collections/handlers/fs.d.ts +2 -10
- package/dist/collections/handlers/fs.js +28 -6
- package/dist/collections/handlers/fs.js.map +1 -0
- package/dist/collections/index.d.ts +2 -10
- package/dist/collections/index.js +16 -6
- package/dist/collections/index.js.map +1 -0
- package/dist/collections/mdx/loader-webpack.d.ts +6 -14
- package/dist/collections/mdx/loader-webpack.d.ts.map +1 -0
- package/dist/collections/mdx/loader-webpack.js +23 -35
- package/dist/collections/mdx/loader-webpack.js.map +1 -0
- package/dist/collections/mdx/runtime-browser.d.ts +33 -32
- package/dist/collections/mdx/runtime-browser.d.ts.map +1 -0
- package/dist/collections/mdx/runtime-browser.js +57 -62
- package/dist/collections/mdx/runtime-browser.js.map +1 -0
- package/dist/collections/mdx/runtime-dynamic.d.ts +24 -31
- package/dist/collections/mdx/runtime-dynamic.d.ts.map +1 -0
- package/dist/collections/mdx/runtime-dynamic.js +63 -83
- package/dist/collections/mdx/runtime-dynamic.js.map +1 -0
- package/dist/collections/mdx/runtime.d.ts +34 -54
- package/dist/collections/mdx/runtime.d.ts.map +1 -0
- package/dist/collections/mdx/runtime.js +24 -34
- package/dist/collections/mdx/runtime.js.map +1 -0
- package/dist/collections/mdx.d.ts +2 -10
- package/dist/collections/mdx.js +240 -280
- package/dist/collections/mdx.js.map +1 -0
- package/dist/collections/meta/loader-webpack.d.ts +6 -14
- package/dist/collections/meta/loader-webpack.d.ts.map +1 -0
- package/dist/collections/meta/loader-webpack.js +25 -38
- package/dist/collections/meta/loader-webpack.js.map +1 -0
- package/dist/collections/meta/runtime.d.ts +7 -15
- package/dist/collections/meta/runtime.d.ts.map +1 -0
- package/dist/collections/meta/runtime.js +9 -15
- package/dist/collections/meta/runtime.js.map +1 -0
- package/dist/collections/meta.d.ts +2 -10
- package/dist/collections/meta.js +128 -160
- package/dist/collections/meta.js.map +1 -0
- package/dist/collections/runtime/file-store.d.ts +17 -14
- package/dist/collections/runtime/file-store.d.ts.map +1 -0
- package/dist/collections/runtime/file-store.js +30 -6
- package/dist/collections/runtime/file-store.js.map +1 -0
- package/dist/collections/runtime/store.d.ts +3 -28
- package/dist/collections/runtime/store.js +3 -6
- package/dist/config/index.d.ts +2 -10
- package/dist/config/index.js +6 -5
- package/dist/config/index.js.map +1 -0
- package/dist/core-Bkh-SI_3.d.ts +561 -0
- package/dist/core-Bkh-SI_3.d.ts.map +1 -0
- package/dist/core-ZuoVBkeg.js +170 -0
- package/dist/core-ZuoVBkeg.js.map +1 -0
- package/dist/dynamic-B40uAtdo.js +28 -0
- package/dist/dynamic-B40uAtdo.js.map +1 -0
- package/dist/fuma-matter-O4fA6nSx.js +27 -0
- package/dist/fuma-matter-O4fA6nSx.js.map +1 -0
- package/dist/index.d.ts +13 -14
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/load-from-file-1f4WaHsf.js +38 -0
- package/dist/load-from-file-1f4WaHsf.js.map +1 -0
- package/dist/load-from-file-BTNnBu6f.js +3 -0
- package/dist/loader-80abXEHx.js +4 -0
- package/dist/loader-BFhPyg3z.js +4 -0
- package/dist/loader-CXnMFuyE.js +80 -0
- package/dist/loader-CXnMFuyE.js.map +1 -0
- package/dist/loader-gk94iHf5.js +66 -0
- package/dist/loader-gk94iHf5.js.map +1 -0
- package/dist/next/index.cjs +459 -528
- package/dist/next/index.d.ts +16 -22
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +71 -88
- package/dist/next/index.js.map +1 -0
- package/dist/node/loader.d.ts +4 -2
- package/dist/node/loader.d.ts.map +1 -0
- package/dist/node/loader.js +32 -43
- package/dist/node/loader.js.map +1 -0
- package/dist/node-CGIIJIcs.js +31 -0
- package/dist/node-CGIIJIcs.js.map +1 -0
- package/dist/pipe-5cnvE6KY.js +31 -0
- package/dist/pipe-5cnvE6KY.js.map +1 -0
- package/dist/plugins/git.d.ts +2 -10
- package/dist/plugins/git.js +57 -65
- package/dist/plugins/git.js.map +1 -0
- package/dist/plugins/json-schema.d.ts +2 -10
- package/dist/plugins/json-schema.js +60 -58
- package/dist/plugins/json-schema.js.map +1 -0
- package/dist/plugins/with-loader/index.d.ts +2 -61
- package/dist/plugins/with-loader/index.js +28 -6
- package/dist/plugins/with-loader/index.js.map +1 -0
- package/dist/plugins/with-loader/webpack.d.ts +10 -18
- package/dist/plugins/with-loader/webpack.d.ts.map +1 -0
- package/dist/plugins/with-loader/webpack.js +43 -11
- package/dist/plugins/with-loader/webpack.js.map +1 -0
- package/dist/store-0LQ2PlH6.js +37 -0
- package/dist/store-0LQ2PlH6.js.map +1 -0
- package/dist/store-DEjYYF6a.d.ts +31 -0
- package/dist/store-DEjYYF6a.d.ts.map +1 -0
- package/dist/validation-BOJKRAp5.js +28 -0
- package/dist/validation-BOJKRAp5.js.map +1 -0
- package/dist/vite/index.d.ts +22 -28
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +37 -51
- package/dist/vite/index.js.map +1 -0
- package/dist/vite-X-2Al8fq.js +32 -0
- package/dist/vite-X-2Al8fq.js.map +1 -0
- package/package.json +15 -13
- package/dist/build-mdx-Q4RMDWYK.js +0 -8
- package/dist/bun-DMNX4PBC.js +0 -40
- package/dist/chunk-3VQS3KSP.js +0 -39
- package/dist/chunk-4RMSJCK2.js +0 -50
- package/dist/chunk-6XDQG2GV.js +0 -17
- package/dist/chunk-AMBGM4OK.js +0 -412
- package/dist/chunk-BTRE6MOX.js +0 -16
- package/dist/chunk-E4HRKSP4.js +0 -24
- package/dist/chunk-ERBMAQYP.js +0 -33
- package/dist/chunk-IGLM4N4P.js +0 -34
- package/dist/chunk-LDBQ66H3.js +0 -38
- package/dist/chunk-M72VQL5M.js +0 -40
- package/dist/chunk-OUJENWQ4.js +0 -45
- package/dist/chunk-PNA5UGSL.js +0 -104
- package/dist/chunk-RMSV4HP6.js +0 -85
- package/dist/chunk-RXR7OL76.js +0 -37
- package/dist/chunk-VWJKRQZR.js +0 -19
- package/dist/chunk-Z7KHD7MS.js +0 -368
- package/dist/core-DxnSmTRe.d.ts +0 -411
- package/dist/load-from-file-MLL4WQ5J.js +0 -7
- package/dist/loader-T756NSCS.js +0 -7
- package/dist/loader-VGDLYG4T.js +0 -7
- package/dist/node-DCMYL4DL.js +0 -34
- package/dist/vite-QCUPZHHB.js +0 -32
|
@@ -1,41 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "../../chunk-4RMSJCK2.js";
|
|
8
|
-
import "../../chunk-OUJENWQ4.js";
|
|
9
|
-
import {
|
|
10
|
-
createDynamicCore
|
|
11
|
-
} from "../../chunk-LDBQ66H3.js";
|
|
12
|
-
import "../../chunk-Z7KHD7MS.js";
|
|
13
|
-
import "../../chunk-6XDQG2GV.js";
|
|
1
|
+
import "../../code-generator-gPtrfZ6Q.js";
|
|
2
|
+
import "../../core-ZuoVBkeg.js";
|
|
3
|
+
import "../../validation-BOJKRAp5.js";
|
|
4
|
+
import { t as createDynamicCore } from "../../dynamic-B40uAtdo.js";
|
|
5
|
+
import { getCore, toWebpack } from "../../plugins/with-loader/webpack.js";
|
|
6
|
+
import { t as createMetaLoader } from "../../loader-gk94iHf5.js";
|
|
14
7
|
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
//#region src/collections/meta/loader-webpack.ts
|
|
9
|
+
let instance;
|
|
17
10
|
async function loader(source) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
json: "json",
|
|
32
|
-
yaml: "js"
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
await instance.call(this, source, callback);
|
|
11
|
+
const callback = this.async();
|
|
12
|
+
const options = this.getOptions();
|
|
13
|
+
this.cacheable(true);
|
|
14
|
+
this.addDependency(options.absoluteCompiledConfigPath);
|
|
15
|
+
if (!instance) instance = toWebpack(createMetaLoader(createDynamicCore({
|
|
16
|
+
core: getCore(options),
|
|
17
|
+
buildConfig: false,
|
|
18
|
+
mode: options.isDev ? "dev" : "production"
|
|
19
|
+
}), {
|
|
20
|
+
json: "json",
|
|
21
|
+
yaml: "js"
|
|
22
|
+
}));
|
|
23
|
+
await instance.call(this, source, callback);
|
|
38
24
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { loader as default };
|
|
28
|
+
//# sourceMappingURL=loader-webpack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-webpack.js","names":["instance: WebpackLoader | undefined"],"sources":["../../../src/collections/meta/loader-webpack.ts"],"sourcesContent":["import type { LoaderContext } from \"webpack\";\nimport { createMetaLoader } from \"@/collections/meta/loader\";\nimport {\n toWebpack,\n getCore,\n type WebpackLoader,\n type WebpackLoaderOptions,\n} from \"@/plugins/with-loader/webpack\";\nimport { createDynamicCore } from \"@/config/dynamic\";\n\nlet instance: WebpackLoader | undefined;\n\nexport default async function loader(\n this: LoaderContext<WebpackLoaderOptions>,\n source: string,\n): Promise<void> {\n const callback = this.async();\n const options = this.getOptions();\n this.cacheable(true);\n this.addDependency(options.absoluteCompiledConfigPath);\n\n if (!instance) {\n instance = toWebpack(\n createMetaLoader(\n createDynamicCore({\n core: getCore(options),\n buildConfig: false,\n mode: options.isDev ? \"dev\" : \"production\",\n }),\n {\n json: \"json\",\n yaml: \"js\",\n },\n ),\n );\n }\n\n await instance.call(this, source, callback);\n}\n"],"mappings":";;;;;;;;AAUA,IAAIA;AAEJ,eAA8B,OAE5B,QACe;CACf,MAAM,WAAW,KAAK,OAAO;CAC7B,MAAM,UAAU,KAAK,YAAY;AACjC,MAAK,UAAU,KAAK;AACpB,MAAK,cAAc,QAAQ,2BAA2B;AAEtD,KAAI,CAAC,SACH,YAAW,UACT,iBACE,kBAAkB;EAChB,MAAM,QAAQ,QAAQ;EACtB,aAAa;EACb,MAAM,QAAQ,QAAQ,QAAQ;EAC/B,CAAC,EACF;EACE,MAAM;EACN,MAAM;EACP,CACF,CACF;AAGH,OAAM,SAAS,KAAK,MAAM,QAAQ,SAAS"}
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import { GetCollectionConfig } from
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import '../runtime/store.js';
|
|
5
|
-
import 'chokidar';
|
|
6
|
-
import '@mdx-js/mdx';
|
|
7
|
-
import 'vfile';
|
|
8
|
-
import '@standard-schema/spec';
|
|
9
|
-
import 'unified';
|
|
10
|
-
import 'mdast';
|
|
11
|
-
import 'vite';
|
|
12
|
-
import 'next';
|
|
13
|
-
import 'node:module';
|
|
1
|
+
import { T as MetaCollection, q as GetCollectionConfig } from "../../core-Bkh-SI_3.js";
|
|
2
|
+
import "../../store-DEjYYF6a.js";
|
|
3
|
+
import { FileCollectionStore } from "../runtime/file-store.js";
|
|
14
4
|
|
|
5
|
+
//#region src/collections/meta/runtime.d.ts
|
|
15
6
|
declare function metaStore<Config, Name extends string>(_name: Name, base: string, input: Record<string, unknown>): FileCollectionStore<{
|
|
16
|
-
|
|
7
|
+
data: GetCollectionConfig<Config, Name> extends MetaCollection<infer Data> ? Data : never;
|
|
17
8
|
}>;
|
|
18
|
-
|
|
9
|
+
//#endregion
|
|
19
10
|
export { metaStore };
|
|
11
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../../../src/collections/meta/runtime.ts"],"sourcesContent":[],"mappings":";;;;;iBAIgB,8CACP,2BAEA,0BACN;QACK,oBAAoB,QAAQ,cAAc;AALlD,CAAA,CAAA"}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FileCollectionStore
|
|
3
|
-
} from "../../chunk-RXR7OL76.js";
|
|
4
|
-
import "../../chunk-3VQS3KSP.js";
|
|
1
|
+
import { FileCollectionStore } from "../runtime/file-store.js";
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
//#region src/collections/meta/runtime.ts
|
|
7
4
|
function metaStore(_name, base, input) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
data: value
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
return new FileCollectionStore(base, merged);
|
|
5
|
+
const merged = input;
|
|
6
|
+
for (const [key, value] of Object.entries(input)) merged[key] = { data: value };
|
|
7
|
+
return new FileCollectionStore(base, merged);
|
|
15
8
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { metaStore };
|
|
12
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","names":[],"sources":["../../../src/collections/meta/runtime.ts"],"sourcesContent":["import type { GetCollectionConfig } from \"@/types\";\nimport { FileCollectionStore } from \"@/collections/runtime/file-store\";\nimport type { MetaCollection } from \"@/collections/meta\";\n\nexport function metaStore<Config, Name extends string>(\n _name: Name,\n base: string,\n input: Record<string, unknown>,\n): FileCollectionStore<{\n data: GetCollectionConfig<Config, Name> extends MetaCollection<infer Data>\n ? Data\n : never;\n}> {\n type Metadata =\n GetCollectionConfig<Config, Name> extends MetaCollection<infer Data>\n ? Data\n : never;\n const merged = input as Record<\n string,\n {\n data: Metadata;\n }\n >;\n\n for (const [key, value] of Object.entries(input)) {\n merged[key] = {\n data: value as Metadata,\n };\n }\n\n return new FileCollectionStore(base, merged);\n}\n"],"mappings":";;;AAIA,SAAgB,UACd,OACA,MACA,OAKC;CAKD,MAAM,SAAS;AAOf,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC9C,QAAO,OAAO,EACZ,MAAM,OACP;AAGH,QAAO,IAAI,oBAAoB,MAAM,OAAO"}
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import 'chokidar';
|
|
4
|
-
import '@mdx-js/mdx';
|
|
5
|
-
import 'vfile';
|
|
6
|
-
import 'unified';
|
|
7
|
-
import 'mdast';
|
|
8
|
-
import 'vite';
|
|
9
|
-
import 'next';
|
|
10
|
-
import 'node:module';
|
|
1
|
+
import { D as MetaCollectionHandler, E as MetaCollectionConfig, O as MetaTransformationContext, T as MetaCollection, k as defineMeta } from "../core-Bkh-SI_3.js";
|
|
2
|
+
export { MetaCollection, MetaCollectionConfig, MetaCollectionHandler, MetaTransformationContext, defineMeta };
|
package/dist/collections/meta.js
CHANGED
|
@@ -1,166 +1,134 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from "
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
} from "../chunk-E4HRKSP4.js";
|
|
7
|
-
import {
|
|
8
|
-
createCollection
|
|
9
|
-
} from "../chunk-BTRE6MOX.js";
|
|
1
|
+
import { t as asyncPipe } from "../pipe-5cnvE6KY.js";
|
|
2
|
+
import { createCollection } from "./index.js";
|
|
3
|
+
import { initFileCollection } from "./handlers/fs.js";
|
|
4
|
+
import { withLoader } from "../plugins/with-loader/index.js";
|
|
5
|
+
import path from "node:path";
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
plugins: [plugin()]
|
|
7
|
+
//#region src/collections/meta.ts
|
|
8
|
+
const metaTypeInfo = {
|
|
9
|
+
id: "meta",
|
|
10
|
+
plugins: [plugin()]
|
|
16
11
|
};
|
|
17
12
|
function defineMeta(config) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
13
|
+
return createCollection(metaTypeInfo, (collection, options) => {
|
|
14
|
+
const handlers = collection.handlers;
|
|
15
|
+
initFileCollection(collection, options, {
|
|
16
|
+
supportedFormats: ["json", "yaml"],
|
|
17
|
+
...config
|
|
18
|
+
});
|
|
19
|
+
handlers.meta = {
|
|
20
|
+
schema: config.schema,
|
|
21
|
+
transform: asyncPipe()
|
|
22
|
+
};
|
|
23
|
+
handlers["json-schema"] = { async create() {
|
|
24
|
+
const { z, ZodType } = await import("zod");
|
|
25
|
+
if (config.schema instanceof ZodType) return z.toJSONSchema(config.schema, {
|
|
26
|
+
io: "input",
|
|
27
|
+
unrepresentable: "any"
|
|
28
|
+
});
|
|
29
|
+
else return config.schema["~standard"]?.jsonSchema.input({ target: "draft-2020-12" });
|
|
30
|
+
} };
|
|
31
|
+
});
|
|
35
32
|
}
|
|
36
33
|
function plugin() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
config.module.rules.push({
|
|
134
|
-
test: metaLoaderGlob,
|
|
135
|
-
enforce: "pre",
|
|
136
|
-
use: [
|
|
137
|
-
{
|
|
138
|
-
loader: loaderPath,
|
|
139
|
-
options: loaderOptions
|
|
140
|
-
}
|
|
141
|
-
]
|
|
142
|
-
});
|
|
143
|
-
return nextConfig.webpack?.(config, options) ?? config;
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
return withLoader(base, {
|
|
150
|
-
test: metaLoaderGlob,
|
|
151
|
-
async createLoader(environment) {
|
|
152
|
-
const { createMetaLoader } = await import("../loader-T756NSCS.js");
|
|
153
|
-
return createMetaLoader(
|
|
154
|
-
{
|
|
155
|
-
getCore: () => this.core
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
json: environment === "vite" ? "json" : "js"
|
|
159
|
-
}
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
});
|
|
34
|
+
const metaLoaderGlob = /\.(json|yaml)(\?.+?)?$/;
|
|
35
|
+
async function generateCollectionStore(context, collection) {
|
|
36
|
+
const fsHandler = collection.handlers.fs;
|
|
37
|
+
if (!fsHandler) return;
|
|
38
|
+
const { codegen, core } = context;
|
|
39
|
+
codegen.addNamedImport(["metaStore"], "fuma-content/collections/meta/runtime");
|
|
40
|
+
codegen.addNamespaceImport("Config", codegen.formatImportPath(core.getOptions().configPath), true);
|
|
41
|
+
const base = path.relative(process.cwd(), fsHandler.dir);
|
|
42
|
+
const glob = await codegen.generateGlobImport(fsHandler.patterns, {
|
|
43
|
+
query: {
|
|
44
|
+
collection: collection.name,
|
|
45
|
+
workspace: context.workspace
|
|
46
|
+
},
|
|
47
|
+
import: "default",
|
|
48
|
+
base: fsHandler.dir,
|
|
49
|
+
eager: true
|
|
50
|
+
});
|
|
51
|
+
const initializer = `metaStore<typeof Config, "${collection.name}">("${collection.name}", "${base}", ${glob})`;
|
|
52
|
+
codegen.push(`export const ${collection.name} = ${initializer};`);
|
|
53
|
+
}
|
|
54
|
+
return withLoader({
|
|
55
|
+
name: "meta",
|
|
56
|
+
configureServer(server) {
|
|
57
|
+
if (!server.watcher) return;
|
|
58
|
+
server.watcher.on("all", async (event, file) => {
|
|
59
|
+
if (event === "change") return;
|
|
60
|
+
if (!this.core.getCollections().find((collection) => {
|
|
61
|
+
const handlers = collection.handlers;
|
|
62
|
+
if (!handlers.meta || !handlers.fs) return false;
|
|
63
|
+
return handlers.fs.hasFile(file);
|
|
64
|
+
})) return;
|
|
65
|
+
await this.core.emit({
|
|
66
|
+
filterPlugin: (plugin$1) => plugin$1.name === "meta",
|
|
67
|
+
filterWorkspace: () => false,
|
|
68
|
+
write: true
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
emit() {
|
|
73
|
+
return Promise.all([this.createCodeGenerator("meta.ts", async (ctx) => {
|
|
74
|
+
for (const collection of this.core.getCollections()) await generateCollectionStore(ctx, collection);
|
|
75
|
+
})]);
|
|
76
|
+
},
|
|
77
|
+
next: { config(nextConfig) {
|
|
78
|
+
const { configPath, outDir } = this.core.getOptions();
|
|
79
|
+
const loaderPath = "fuma-content/collections/meta/loader-webpack";
|
|
80
|
+
const loaderOptions = {
|
|
81
|
+
configPath,
|
|
82
|
+
outDir,
|
|
83
|
+
absoluteCompiledConfigPath: path.resolve(this.core.getCompiledConfigPath()),
|
|
84
|
+
isDev: process.env.NODE_ENV === "development"
|
|
85
|
+
};
|
|
86
|
+
return {
|
|
87
|
+
...nextConfig,
|
|
88
|
+
turbopack: {
|
|
89
|
+
...nextConfig.turbopack,
|
|
90
|
+
rules: {
|
|
91
|
+
...nextConfig.turbopack?.rules,
|
|
92
|
+
"*.json": {
|
|
93
|
+
loaders: [{
|
|
94
|
+
loader: loaderPath,
|
|
95
|
+
options: loaderOptions
|
|
96
|
+
}],
|
|
97
|
+
as: "*.json"
|
|
98
|
+
},
|
|
99
|
+
"*.yaml": {
|
|
100
|
+
loaders: [{
|
|
101
|
+
loader: loaderPath,
|
|
102
|
+
options: loaderOptions
|
|
103
|
+
}],
|
|
104
|
+
as: "*.js"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
webpack(config, options) {
|
|
109
|
+
config.module ||= {};
|
|
110
|
+
config.module.rules ||= [];
|
|
111
|
+
config.module.rules.push({
|
|
112
|
+
test: metaLoaderGlob,
|
|
113
|
+
enforce: "pre",
|
|
114
|
+
use: [{
|
|
115
|
+
loader: loaderPath,
|
|
116
|
+
options: loaderOptions
|
|
117
|
+
}]
|
|
118
|
+
});
|
|
119
|
+
return nextConfig.webpack?.(config, options) ?? config;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
} }
|
|
123
|
+
}, {
|
|
124
|
+
test: metaLoaderGlob,
|
|
125
|
+
async createLoader(environment) {
|
|
126
|
+
const { createMetaLoader } = await import("../loader-BFhPyg3z.js");
|
|
127
|
+
return createMetaLoader({ getCore: () => this.core }, { json: environment === "vite" ? "json" : "js" });
|
|
128
|
+
}
|
|
129
|
+
});
|
|
163
130
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
};
|
|
131
|
+
|
|
132
|
+
//#endregion
|
|
133
|
+
export { defineMeta };
|
|
134
|
+
//# sourceMappingURL=meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","names":["metaTypeInfo: CollectionTypeInfo","plugin","loaderOptions: WebpackLoaderOptions"],"sources":["../../src/collections/meta.ts"],"sourcesContent":["import {\n type Collection,\n type CollectionTypeInfo,\n createCollection,\n} from \"@/collections\";\nimport {\n type FileHandlerConfig,\n initFileCollection,\n} from \"@/collections/handlers/fs\";\nimport type { EmitCodeGeneratorContext, Plugin } from \"@/core\";\nimport type {\n StandardSchemaV1,\n StandardJSONSchemaV1,\n} from \"@standard-schema/spec\";\nimport path from \"node:path\";\nimport type { Configuration } from \"webpack\";\nimport { withLoader } from \"@/plugins/with-loader\";\nimport type { TurbopackLoaderOptions } from \"next/dist/server/config-shared\";\nimport type { WebpackLoaderOptions } from \"@/plugins/with-loader/webpack\";\nimport { type AsyncPipe, asyncPipe } from \"@/utils/pipe\";\n\nexport interface MetaTransformationContext {\n path: string;\n source: string;\n}\n\nexport interface MetaCollectionHandler {\n /**\n * Transform metadata\n */\n transform: AsyncPipe<unknown, MetaTransformationContext>;\n schema?: StandardSchemaV1;\n}\n\nexport interface MetaCollectionConfig<\n Schema extends StandardSchemaV1,\n> extends Omit<FileHandlerConfig, \"supportedFormats\"> {\n schema?: Schema;\n}\n\nexport type MetaCollection<_Data> = Collection & {\n _type?: _Data;\n};\n\nconst metaTypeInfo: CollectionTypeInfo = {\n id: \"meta\",\n plugins: [plugin()],\n};\n\nexport function defineMeta<Schema extends StandardSchemaV1>(\n config: MetaCollectionConfig<Schema>,\n): MetaCollection<\n Schema extends StandardSchemaV1\n ? StandardSchemaV1.InferOutput<Schema>\n : Record<string, unknown>\n> {\n return createCollection(metaTypeInfo, (collection, options) => {\n const handlers = collection.handlers;\n initFileCollection(collection, options, {\n supportedFormats: [\"json\", \"yaml\"],\n ...config,\n });\n handlers.meta = {\n schema: config.schema,\n transform: asyncPipe(),\n };\n handlers[\"json-schema\"] = {\n async create() {\n const { z, ZodType } = await import(\"zod\");\n\n if (config.schema instanceof ZodType)\n return z.toJSONSchema(config.schema, {\n io: \"input\",\n unrepresentable: \"any\",\n });\n else\n return (config.schema as unknown as Partial<StandardJSONSchemaV1>)[\n \"~standard\"\n ]?.jsonSchema.input({\n target: \"draft-2020-12\",\n });\n },\n };\n });\n}\n\nfunction plugin(): Plugin {\n const metaLoaderGlob = /\\.(json|yaml)(\\?.+?)?$/;\n\n async function generateCollectionStore(\n context: EmitCodeGeneratorContext,\n collection: Collection,\n ) {\n const fsHandler = collection.handlers.fs;\n if (!fsHandler) return;\n const { codegen, core } = context;\n\n codegen.addNamedImport(\n [\"metaStore\"],\n \"fuma-content/collections/meta/runtime\",\n );\n codegen.addNamespaceImport(\n \"Config\",\n codegen.formatImportPath(core.getOptions().configPath),\n true,\n );\n const base = path.relative(process.cwd(), fsHandler.dir);\n const glob = await codegen.generateGlobImport(fsHandler.patterns, {\n query: {\n collection: collection.name,\n workspace: context.workspace,\n },\n import: \"default\",\n base: fsHandler.dir,\n eager: true,\n });\n const initializer = `metaStore<typeof Config, \"${collection.name}\">(\"${collection.name}\", \"${base}\", ${glob})`;\n codegen.push(`export const ${collection.name} = ${initializer};`);\n }\n\n const base: Plugin = {\n name: \"meta\",\n configureServer(server) {\n if (!server.watcher) return;\n\n server.watcher.on(\"all\", async (event, file) => {\n if (event === \"change\") return;\n const updatedCollection = this.core\n .getCollections()\n .find((collection) => {\n const handlers = collection.handlers;\n if (!handlers.meta || !handlers.fs) return false;\n return handlers.fs.hasFile(file);\n });\n\n if (!updatedCollection) return;\n await this.core.emit({\n filterPlugin: (plugin) => plugin.name === \"meta\",\n filterWorkspace: () => false,\n write: true,\n });\n });\n },\n emit() {\n return Promise.all([\n this.createCodeGenerator(\"meta.ts\", async (ctx) => {\n for (const collection of this.core.getCollections()) {\n await generateCollectionStore(ctx, collection);\n }\n }),\n ]);\n },\n next: {\n config(nextConfig) {\n const { configPath, outDir } = this.core.getOptions();\n const loaderPath = \"fuma-content/collections/meta/loader-webpack\";\n const loaderOptions: WebpackLoaderOptions = {\n configPath,\n outDir,\n absoluteCompiledConfigPath: path.resolve(\n this.core.getCompiledConfigPath(),\n ),\n isDev: process.env.NODE_ENV === \"development\",\n };\n\n return {\n ...nextConfig,\n turbopack: {\n ...nextConfig.turbopack,\n rules: {\n ...nextConfig.turbopack?.rules,\n \"*.json\": {\n loaders: [\n {\n loader: loaderPath,\n options: loaderOptions as unknown as TurbopackLoaderOptions,\n },\n ],\n as: \"*.json\",\n },\n \"*.yaml\": {\n loaders: [\n {\n loader: loaderPath,\n options: loaderOptions as unknown as TurbopackLoaderOptions,\n },\n ],\n as: \"*.js\",\n },\n },\n },\n webpack(config: Configuration, options) {\n config.module ||= {};\n config.module.rules ||= [];\n config.module.rules.push({\n test: metaLoaderGlob,\n enforce: \"pre\",\n use: [\n {\n loader: loaderPath,\n options: loaderOptions,\n },\n ],\n });\n\n return nextConfig.webpack?.(config, options) ?? config;\n },\n };\n },\n },\n };\n\n return withLoader(base, {\n test: metaLoaderGlob,\n async createLoader(environment) {\n const { createMetaLoader } = await import(\"./meta/loader\");\n return createMetaLoader(\n {\n getCore: () => this.core,\n },\n {\n json: environment === \"vite\" ? \"json\" : \"js\",\n },\n );\n },\n });\n}\n"],"mappings":"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"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../core-Bkh-SI_3.js";
|
|
2
|
+
import { n as SimpleCollectionStore } from "../../store-DEjYYF6a.js";
|
|
2
3
|
|
|
4
|
+
//#region src/collections/runtime/file-store.d.ts
|
|
3
5
|
interface FileInfo {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
/**
|
|
7
|
+
* path relative to content directory
|
|
8
|
+
*/
|
|
9
|
+
path: string;
|
|
10
|
+
/**
|
|
11
|
+
* the full file path in file system
|
|
12
|
+
*/
|
|
13
|
+
fullPath: string;
|
|
12
14
|
}
|
|
13
15
|
declare class FileCollectionStore<V> extends SimpleCollectionStore<FileInfo & V> {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
constructor(base: string, glob: Record<string, V>);
|
|
17
|
+
transform<T>(fn: (input: FileInfo & V) => FileInfo & T): FileCollectionStore<T>;
|
|
18
|
+
$data<T>(_cast: (input: FileInfo & V) => FileInfo & T): FileCollectionStore<T>;
|
|
17
19
|
}
|
|
18
|
-
|
|
19
|
-
export { FileCollectionStore,
|
|
20
|
+
//#endregion
|
|
21
|
+
export { FileCollectionStore, FileInfo };
|
|
22
|
+
//# sourceMappingURL=file-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-store.d.ts","names":[],"sources":["../../../src/collections/runtime/file-store.ts"],"sourcesContent":[],"mappings":";;;;UAGiB,QAAA;;;AAAjB;EAuBa,IAAA,EAAA,MAAA;EACX;;;EAEgC,QAAA,EAAA,MAAA;;AAYP,cAfd,mBAec,CAAA,CAAA,CAAA,SAfiB,qBAejB,CAdzB,QAcyB,GAdd,CAcc,CAAA,CAAA;EAAM,WAAA,CAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAZC,MAYD,CAAA,MAAA,EAZgB,CAYhB,CAAA;EAAW,SAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,KAAA,EAA5B,QAA4B,GAAjB,CAAiB,EAAA,GAAX,QAAW,GAAA,CAAA,CAAA,EACvC,mBADuC,CACnB,CADmB,CAAA;EACnB,KAAA,CAAA,CAAA,CAAA,CAAA,KAAA,EAAA,CAAA,KAAA,EAKN,QALM,GAKK,CALL,EAAA,GAKW,QALX,GAKsB,CALtB,CAAA,EAMpB,mBANoB,CAMA,CANA,CAAA"}
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { t as SimpleCollectionStore } from "../../store-0LQ2PlH6.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
//#region src/collections/runtime/file-store.ts
|
|
5
|
+
function fileInfo(base, globKey) {
|
|
6
|
+
if (globKey.startsWith("./")) globKey = globKey.slice(2);
|
|
7
|
+
return {
|
|
8
|
+
path: globKey,
|
|
9
|
+
fullPath: path.join(base, globKey)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
var FileCollectionStore = class extends SimpleCollectionStore {
|
|
13
|
+
constructor(base, glob) {
|
|
14
|
+
const data = /* @__PURE__ */ new Map();
|
|
15
|
+
for (const [key, value] of Object.entries(glob)) data.set(key, {
|
|
16
|
+
...value,
|
|
17
|
+
...fileInfo(base, key)
|
|
18
|
+
});
|
|
19
|
+
super(data);
|
|
20
|
+
}
|
|
21
|
+
transform(fn) {
|
|
22
|
+
return super.transform(fn);
|
|
23
|
+
}
|
|
24
|
+
$data(_cast) {
|
|
25
|
+
return super.$data(_cast);
|
|
26
|
+
}
|
|
7
27
|
};
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { FileCollectionStore };
|
|
31
|
+
//# sourceMappingURL=file-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-store.js","names":[],"sources":["../../../src/collections/runtime/file-store.ts"],"sourcesContent":["import path from \"node:path\";\nimport { SimpleCollectionStore } from \"@/collections/runtime/store\";\n\nexport interface FileInfo {\n /**\n * path relative to content directory\n */\n path: string;\n\n /**\n * the full file path in file system\n */\n fullPath: string;\n}\n\nfunction fileInfo(base: string, globKey: string): FileInfo {\n if (globKey.startsWith(\"./\")) {\n globKey = globKey.slice(2);\n }\n\n return {\n path: globKey,\n fullPath: path.join(base, globKey),\n };\n}\n\nexport class FileCollectionStore<V> extends SimpleCollectionStore<\n FileInfo & V\n> {\n constructor(base: string, glob: Record<string, V>) {\n const data = new Map<string, FileInfo & V>();\n for (const [key, value] of Object.entries(glob)) {\n data.set(key, {\n ...value,\n ...fileInfo(base, key),\n });\n }\n super(data);\n }\n\n transform<T>(\n fn: (input: FileInfo & V) => FileInfo & T,\n ): FileCollectionStore<T> {\n return super.transform(fn);\n }\n\n $data<T>(\n _cast: (input: FileInfo & V) => FileInfo & T,\n ): FileCollectionStore<T> {\n return super.$data(_cast);\n }\n}\n"],"mappings":";;;;AAeA,SAAS,SAAS,MAAc,SAA2B;AACzD,KAAI,QAAQ,WAAW,KAAK,CAC1B,WAAU,QAAQ,MAAM,EAAE;AAG5B,QAAO;EACL,MAAM;EACN,UAAU,KAAK,KAAK,MAAM,QAAQ;EACnC;;AAGH,IAAa,sBAAb,cAA4C,sBAE1C;CACA,YAAY,MAAc,MAAyB;EACjD,MAAM,uBAAO,IAAI,KAA2B;AAC5C,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,CAC7C,MAAK,IAAI,KAAK;GACZ,GAAG;GACH,GAAG,SAAS,MAAM,IAAI;GACvB,CAAC;AAEJ,QAAM,KAAK;;CAGb,UACE,IACwB;AACxB,SAAO,MAAM,UAAU,GAAG;;CAG5B,MACE,OACwB;AACxB,SAAO,MAAM,MAAM,MAAM"}
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* type-only operation to change data type, doesn't do any runtime transformation.
|
|
5
|
-
*/
|
|
6
|
-
$data: <T>(_cast: (input: Data) => T) => CollectionStore<Id, T>;
|
|
7
|
-
get: (id: Id) => Awaitable<Data | undefined>;
|
|
8
|
-
list: () => Awaitable<Data[]>;
|
|
9
|
-
/**
|
|
10
|
-
* For typescript to infer data types, can be anything
|
|
11
|
-
*/
|
|
12
|
-
$inferData: Data;
|
|
13
|
-
}
|
|
14
|
-
declare class SimpleCollectionStore<Data> implements CollectionStore<string, Data> {
|
|
15
|
-
private readonly dataMap;
|
|
16
|
-
private readonly dataList;
|
|
17
|
-
constructor(input: Map<string, Data>);
|
|
18
|
-
get(id: string): Data | undefined;
|
|
19
|
-
list(): Data[];
|
|
20
|
-
$data<T>(_cast: (input: Data) => T): SimpleCollectionStore<T>;
|
|
21
|
-
/**
|
|
22
|
-
* in-place transformation on all data
|
|
23
|
-
*/
|
|
24
|
-
transform<T>(fn: (input: Data) => T): SimpleCollectionStore<T>;
|
|
25
|
-
get $inferData(): Data;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { type CollectionStore, SimpleCollectionStore };
|
|
1
|
+
import "../../core-Bkh-SI_3.js";
|
|
2
|
+
import { n as SimpleCollectionStore, t as CollectionStore } from "../../store-DEjYYF6a.js";
|
|
3
|
+
export { CollectionStore, SimpleCollectionStore };
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import '@mdx-js/mdx';
|
|
4
|
-
import 'vfile';
|
|
5
|
-
import '@standard-schema/spec';
|
|
6
|
-
import 'unified';
|
|
7
|
-
import 'mdast';
|
|
8
|
-
import 'vite';
|
|
9
|
-
import 'next';
|
|
10
|
-
import 'node:module';
|
|
1
|
+
import { f as GlobalConfig, m as defineConfig, p as WorkspaceConfig } from "../core-Bkh-SI_3.js";
|
|
2
|
+
export { GlobalConfig, WorkspaceConfig, defineConfig };
|
package/dist/config/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/config/index.ts"],"sourcesContent":["import type { PluginOption } from \"@/core\";\nimport type { Collection } from \"@/collections\";\n\nexport interface GlobalConfig<\n Collections extends Record<string, Collection> = Record<string, Collection>,\n> {\n plugins?: PluginOption[];\n collections?: Collections;\n workspaces?: Record<string, Omit<WorkspaceConfig, \"name\">>;\n\n /**\n * specify a directory to access & store cache (disabled during development mode).\n *\n * The cache will never be updated, delete the cache folder to clean.\n */\n experimentalBuildCache?: string;\n}\n\nexport interface WorkspaceConfig {\n name: string;\n dir: string;\n config: GlobalConfig | { default: GlobalConfig };\n}\n\nexport function defineConfig<\n Collections extends Record<string, Collection> = Record<string, Collection>,\n>(config: GlobalConfig<Collections> = {}): GlobalConfig<Collections> {\n return config;\n}\n"],"mappings":";AAwBA,SAAgB,aAEd,SAAoC,EAAE,EAA6B;AACnE,QAAO"}
|