fuma-content 1.2.1 → 1.2.3
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/bun/index.d.ts +1 -1
- package/dist/bun/index.js +1 -1
- package/dist/{code-generator-pLUE7Rk7.js → code-generator-DFGEY6P5.js} +13 -13
- package/dist/code-generator-DFGEY6P5.js.map +1 -0
- package/dist/collections/data/runtime.d.ts +5 -4
- package/dist/collections/data/runtime.d.ts.map +1 -1
- package/dist/collections/data/runtime.js.map +1 -1
- 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/fs.js +10 -10
- package/dist/collections/fs.js.map +1 -1
- package/dist/collections/index.d.ts +1 -1
- package/dist/collections/index.js +1 -1
- package/dist/collections/json/loader-webpack.d.ts +1 -1
- package/dist/collections/mdx/loader-webpack.d.ts +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-browser.js.map +1 -1
- package/dist/collections/mdx/runtime-dynamic.d.ts +7 -5
- package/dist/collections/mdx/runtime-dynamic.d.ts.map +1 -1
- package/dist/collections/mdx/runtime-dynamic.js +1 -1
- package/dist/collections/mdx/runtime-dynamic.js.map +1 -1
- package/dist/collections/mdx/runtime.d.ts +1 -1
- package/dist/collections/mdx/runtime.js.map +1 -1
- package/dist/collections/mdx/vue.d.ts +2 -2
- package/dist/collections/mdx.d.ts +1 -1
- package/dist/collections/mdx.js +2 -2
- package/dist/collections/obsidian.d.ts +1 -1
- package/dist/collections/obsidian.js +1 -1
- package/dist/collections/runtime/file-store.d.ts +1 -1
- package/dist/collections/runtime/store.d.ts +1 -1
- package/dist/collections/runtime/store.js +7 -7
- package/dist/collections/runtime/store.js.map +1 -1
- package/dist/collections/yaml/loader-webpack.d.ts +1 -1
- package/dist/{collections-BuskUhft.js → collections-Bl9hpWMS.js} +12 -8
- package/dist/collections-Bl9hpWMS.js.map +1 -0
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js.map +1 -1
- package/dist/{core-15rgY8JW.d.ts → core-BbTeLenA.d.ts} +18 -17
- package/dist/core-BbTeLenA.d.ts.map +1 -0
- package/dist/{core-BfIQeHzH.js → core-CrYszxmc.js} +9 -10
- package/dist/core-CrYszxmc.js.map +1 -0
- package/dist/{dynamic-CwBRfhBm.d.ts → dynamic-CNEaikCN.d.ts} +2 -2
- package/dist/{dynamic-CwBRfhBm.d.ts.map → dynamic-CNEaikCN.d.ts.map} +1 -1
- package/dist/dynamic.d.ts +1 -1
- package/dist/{file-store-270Y4Sx7.d.ts → file-store-DutRtol_.d.ts} +2 -2
- package/dist/{file-store-270Y4Sx7.d.ts.map → file-store-DutRtol_.d.ts.map} +1 -1
- package/dist/{fs-DDVhjRBi.d.ts → fs-KJjb32Nq.d.ts} +3 -6
- package/dist/fs-KJjb32Nq.d.ts.map +1 -0
- package/dist/{git-Ce7r2zfM.d.ts → git-BxnPg5Ao.d.ts} +2 -2
- package/dist/{git-Ce7r2zfM.d.ts.map → git-BxnPg5Ao.d.ts.map} +1 -1
- package/dist/{index-B9DAFF8c.d.ts → index-DVqrqxzl.d.ts} +3 -3
- package/dist/{index-B9DAFF8c.d.ts.map → index-DVqrqxzl.d.ts.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{mdx-BfaapI6d.d.ts → mdx-L0I8mePE.d.ts} +3 -3
- package/dist/{mdx-BfaapI6d.d.ts.map → mdx-L0I8mePE.d.ts.map} +1 -1
- 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/plugins/git.d.ts +1 -1
- package/dist/plugins/git.js +2 -2
- package/dist/plugins/git.js.map +1 -1
- package/dist/plugins/json-schema.d.ts +1 -1
- package/dist/plugins/json-schema.js +2 -2
- package/dist/plugins/json-schema.js.map +1 -1
- package/dist/plugins/loader/index.d.ts +1 -1
- package/dist/plugins/loader/index.js +4 -7
- package/dist/plugins/loader/index.js.map +1 -1
- package/dist/plugins/loader/webpack.d.ts +1 -1
- package/dist/plugins/loader/webpack.js +1 -1
- package/dist/{runtime-bpro4VYw.d.ts → runtime-TETi5Giq.d.ts} +8 -6
- package/dist/runtime-TETi5Giq.d.ts.map +1 -0
- package/dist/{runtime-browser-BT3GpIH7.d.ts → runtime-browser-M4sE6SmL.d.ts} +7 -5
- package/dist/{runtime-browser-BT3GpIH7.d.ts.map → runtime-browser-M4sE6SmL.d.ts.map} +1 -1
- package/dist/{store-Cc6y2CDE.d.ts → store-BC3n1VPY.d.ts} +3 -4
- package/dist/store-BC3n1VPY.d.ts.map +1 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/package.json +1 -1
- package/dist/code-generator-pLUE7Rk7.js.map +0 -1
- package/dist/collections-BuskUhft.js.map +0 -1
- package/dist/core-15rgY8JW.d.ts.map +0 -1
- package/dist/core-BfIQeHzH.js.map +0 -1
- package/dist/fs-DDVhjRBi.d.ts.map +0 -1
- package/dist/runtime-bpro4VYw.d.ts.map +0 -1
- package/dist/store-Cc6y2CDE.d.ts.map +0 -1
package/dist/bun/index.d.ts
CHANGED
package/dist/bun/index.js
CHANGED
|
@@ -5,9 +5,9 @@ import { URLSearchParams } from "node:url";
|
|
|
5
5
|
* Code generator (one instance per file)
|
|
6
6
|
*/
|
|
7
7
|
var CodeGenerator = class {
|
|
8
|
-
lines = [];
|
|
9
|
-
importInfos = /* @__PURE__ */ new Map();
|
|
10
|
-
eagerImportId = 0;
|
|
8
|
+
#lines = [];
|
|
9
|
+
#importInfos = /* @__PURE__ */ new Map();
|
|
10
|
+
#eagerImportId = 0;
|
|
11
11
|
options;
|
|
12
12
|
constructor({ jsExtension = false, outDir = "" }) {
|
|
13
13
|
this.options = {
|
|
@@ -16,8 +16,8 @@ var CodeGenerator = class {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
addNamespaceImport(namespace, specifier, typeOnly = false) {
|
|
19
|
-
const info = this
|
|
20
|
-
this
|
|
19
|
+
const info = this.#importInfos.get(specifier) ?? {};
|
|
20
|
+
this.#importInfos.set(specifier, info);
|
|
21
21
|
if (!typeOnly) {
|
|
22
22
|
info.isUsed ??= /* @__PURE__ */ new Set();
|
|
23
23
|
info.isUsed.add(namespace);
|
|
@@ -26,8 +26,8 @@ var CodeGenerator = class {
|
|
|
26
26
|
info.namespaces.add(namespace);
|
|
27
27
|
}
|
|
28
28
|
addNamedImport(names, specifier, typeOnly = false) {
|
|
29
|
-
const info = this
|
|
30
|
-
this
|
|
29
|
+
const info = this.#importInfos.get(specifier) ?? {};
|
|
30
|
+
this.#importInfos.set(specifier, info);
|
|
31
31
|
info.named ??= /* @__PURE__ */ new Map();
|
|
32
32
|
for (const name of names) {
|
|
33
33
|
const [memberName, importName = memberName] = name.split(/\s+as\s+/, 2);
|
|
@@ -39,17 +39,17 @@ var CodeGenerator = class {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
push(...insert) {
|
|
42
|
-
this
|
|
42
|
+
this.#lines.push(...insert);
|
|
43
43
|
}
|
|
44
44
|
async pushAsync(insert) {
|
|
45
45
|
for (const line of await Promise.all(insert)) {
|
|
46
46
|
if (line === void 0) continue;
|
|
47
|
-
this
|
|
47
|
+
this.#lines.push(line);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
/** generate a random import name that is unique in file. */
|
|
51
51
|
generateImportName() {
|
|
52
|
-
return `__${this
|
|
52
|
+
return `__${this.#eagerImportId++}`;
|
|
53
53
|
}
|
|
54
54
|
formatDynamicImport(specifier, mod) {
|
|
55
55
|
let s = `import("${specifier}")`;
|
|
@@ -80,7 +80,7 @@ var CodeGenerator = class {
|
|
|
80
80
|
}
|
|
81
81
|
toString() {
|
|
82
82
|
const final = ["// @ts-nocheck"];
|
|
83
|
-
for (const [specifier, { namespaces, isUsed, named }] of this
|
|
83
|
+
for (const [specifier, { namespaces, isUsed, named }] of this.#importInfos) {
|
|
84
84
|
if (namespaces) for (const namespace of namespaces) final.push(isUsed?.has(namespace) ? `import * as ${namespace} from "${specifier}";` : `import type * as ${namespace} from "${specifier}";`);
|
|
85
85
|
if (named && named.size > 0) {
|
|
86
86
|
const namedImports = [];
|
|
@@ -91,7 +91,7 @@ var CodeGenerator = class {
|
|
|
91
91
|
final.push(`import { ${namedImports.join(", ")} } from "${specifier}";`);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
final.push(...this
|
|
94
|
+
final.push(...this.#lines);
|
|
95
95
|
return final.join("\n");
|
|
96
96
|
}
|
|
97
97
|
};
|
|
@@ -102,4 +102,4 @@ function slash(path) {
|
|
|
102
102
|
//#endregion
|
|
103
103
|
export { slash as n, CodeGenerator as t };
|
|
104
104
|
|
|
105
|
-
//# sourceMappingURL=code-generator-
|
|
105
|
+
//# sourceMappingURL=code-generator-DFGEY6P5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-generator-DFGEY6P5.js","names":["#lines","#importInfos","#eagerImportId"],"sources":["../src/utils/code-generator.ts"],"sourcesContent":["import type { EmitConfig } from \"@/config\";\nimport path from \"node:path\";\nimport { URLSearchParams } from \"node:url\";\n\nexport interface CodeGeneratorOptions extends EmitConfig {\n outDir: string;\n}\n\ninterface ImportInfo {\n /**\n * import name -> member name\n */\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\n/**\n * Code generator (one instance per file)\n */\nexport class CodeGenerator {\n readonly #lines: string[] = [];\n // specifier -> imported members/info\n readonly #importInfos = new Map<string, ImportInfo>();\n #eagerImportId = 0;\n\n readonly options: CodeGeneratorOptions;\n constructor({ jsExtension = false, outDir = \"\" }: Partial<CodeGeneratorOptions>) {\n this.options = {\n jsExtension,\n outDir,\n };\n }\n\n addNamespaceImport(namespace: string, specifier: string, typeOnly = false) {\n const info = this.#importInfos.get(specifier) ?? {};\n this.#importInfos.set(specifier, info);\n if (!typeOnly) {\n info.isUsed ??= new Set();\n info.isUsed.add(namespace);\n }\n\n info.namespaces ??= new Set();\n info.namespaces.add(namespace);\n }\n\n addNamedImport(names: string[], specifier: string, typeOnly = false) {\n const info = this.#importInfos.get(specifier) ?? {};\n this.#importInfos.set(specifier, info);\n info.named ??= new Map();\n\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) {\n info.isUsed ??= new Set();\n info.isUsed.add(importName);\n }\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 switch (ext) {\n case \".ts\":\n case \".tsx\":\n filename = file.substring(0, file.length - ext.length);\n if (this.options.jsExtension) filename += \".js\";\n break;\n default:\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\n for (const [specifier, { namespaces, isUsed, named }] of this.#importInfos) {\n if (namespaces)\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 if (named && named.size > 0) {\n const namedImports: string[] = [];\n\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 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":";;;;;;AAuBA,IAAa,gBAAb,MAA2B;CACzB,SAA4B,EAAE;CAE9B,+BAAwB,IAAI,KAAyB;CACrD,iBAAiB;CAEjB;CACA,YAAY,EAAE,cAAc,OAAO,SAAS,MAAqC;AAC/E,OAAK,UAAU;GACb;GACA;GACD;;CAGH,mBAAmB,WAAmB,WAAmB,WAAW,OAAO;EACzE,MAAM,OAAO,MAAA,YAAkB,IAAI,UAAU,IAAI,EAAE;AACnD,QAAA,YAAkB,IAAI,WAAW,KAAK;AACtC,MAAI,CAAC,UAAU;AACb,QAAK,2BAAW,IAAI,KAAK;AACzB,QAAK,OAAO,IAAI,UAAU;;AAG5B,OAAK,+BAAe,IAAI,KAAK;AAC7B,OAAK,WAAW,IAAI,UAAU;;CAGhC,eAAe,OAAiB,WAAmB,WAAW,OAAO;EACnE,MAAM,OAAO,MAAA,YAAkB,IAAI,UAAU,IAAI,EAAE;AACnD,QAAA,YAAkB,IAAI,WAAW,KAAK;AACtC,OAAK,0BAAU,IAAI,KAAK;AAExB,OAAK,MAAM,QAAQ,OAAO;GACxB,MAAM,CAAC,YAAY,aAAa,cAAc,KAAK,MAAM,YAAY,EAAE;AACvE,QAAK,MAAM,IAAI,YAAY,WAAW;AACtC,OAAI,CAAC,UAAU;AACb,SAAK,2BAAW,IAAI,KAAK;AACzB,SAAK,OAAO,IAAI,WAAW;;;;CAKjC,KAAK,GAAG,QAAkB;AACxB,QAAA,MAAY,KAAK,GAAG,OAAO;;CAG7B,MAAM,UAAU,QAAuC;AACrD,OAAK,MAAM,QAAQ,MAAM,QAAQ,IAAI,OAAO,EAAE;AAC5C,OAAI,SAAS,KAAA,EAAW;AAExB,SAAA,MAAY,KAAK,KAAK;;;;CAK1B,qBAA6B;AAC3B,SAAO,KAAK,MAAA;;CAGd,oBAAoB,WAAmB,KAAsB;EAC3D,IAAI,IAAI,WAAW,UAAU;AAC7B,MAAI,IAAK,MAAK,oBAAoB,IAAI;AACtC,SAAO;;CAGT,YAAY,OAA2C;EACrD,MAAM,SAAS,IAAI,iBAAiB;AACpC,OAAK,MAAM,KAAK,OAAO;GACrB,MAAM,QAAQ,MAAM;AACpB,OAAI,OAAO,UAAU,SAAU,QAAO,IAAI,GAAG,MAAM;;AAErD,SAAO,OAAO,UAAU;;CAG1B,iBAAiB,MAAc;EAC7B,MAAM,MAAM,KAAK,QAAQ,KAAK;EAC9B,IAAI;AAEJ,UAAQ,KAAR;GACE,KAAK;GACL,KAAK;AACH,eAAW,KAAK,UAAU,GAAG,KAAK,SAAS,IAAI,OAAO;AACtD,QAAI,KAAK,QAAQ,YAAa,aAAY;AAC1C;GACF,QACE,YAAW;;EAGf,MAAM,aAAa,MAAM,KAAK,SAAS,KAAK,QAAQ,QAAQ,SAAS,CAAC;AACtE,SAAO,WAAW,WAAW,MAAM,GAAG,aAAa,KAAK;;CAG1D,WAAW;EACT,MAAM,QAAkB,CAAC,iBAAiB;AAE1C,OAAK,MAAM,CAAC,WAAW,EAAE,YAAY,QAAQ,YAAY,MAAA,aAAmB;AAC1E,OAAI,WACF,MAAK,MAAM,aAAa,WACtB,OAAM,KACJ,QAAQ,IAAI,UAAU,GAClB,eAAe,UAAU,SAAS,UAAU,MAC5C,oBAAoB,UAAU,SAAS,UAAU,IACtD;AAGL,OAAI,SAAS,MAAM,OAAO,GAAG;IAC3B,MAAM,eAAyB,EAAE;AAEjC,SAAK,MAAM,CAAC,YAAY,eAAe,OAAO;KAC5C,MAAM,OAAO,eAAe,aAAa,aAAa,GAAG,WAAW,MAAM;AAE1E,kBAAa,KAAK,QAAQ,IAAI,WAAW,GAAG,OAAO,QAAQ,OAAO;;AAGpE,UAAM,KAAK,YAAY,aAAa,KAAK,KAAK,CAAC,WAAW,UAAU,IAAI;;;AAI5E,QAAM,KAAK,GAAG,MAAA,MAAY;AAC1B,SAAO,MAAM,KAAK,KAAK;;;AAI3B,SAAgB,MAAM,MAAsB;AAG1C,KAF6B,KAAK,WAAW,UAAU,CAGrD,QAAO;AAGT,QAAO,KAAK,WAAW,MAAM,IAAI"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { D as GetCollectionConfig } from "../../core-
|
|
2
|
-
import {
|
|
3
|
-
import { t as FileCollectionStore } from "../../file-store-270Y4Sx7.js";
|
|
1
|
+
import { D as GetCollectionConfig } from "../../core-BbTeLenA.js";
|
|
2
|
+
import { t as FileCollectionStore } from "../../file-store-DutRtol_.js";
|
|
4
3
|
|
|
5
4
|
//#region src/collections/data/runtime.d.ts
|
|
6
5
|
declare function dataStore<Config, Name extends string>(_name: Name, base: string, input: Record<string, unknown>): FileCollectionStore<{
|
|
7
|
-
data: GetCollectionConfig<Config, Name> extends
|
|
6
|
+
data: GetCollectionConfig<Config, Name> extends {
|
|
7
|
+
$inferOutput: unknown;
|
|
8
|
+
} ? GetCollectionConfig<Config, Name>["$inferOutput"] : never;
|
|
8
9
|
}>;
|
|
9
10
|
//#endregion
|
|
10
11
|
export { dataStore };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../../../src/collections/data/runtime.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../../../src/collections/data/runtime.ts"],"mappings":";;;;iBAGgB,SAAA,6BAAA,CACd,KAAA,EAAO,IAAA,EACP,IAAA,UACA,KAAA,EAAO,MAAA,oBACN,mBAAA;EACD,IAAA,EAAM,mBAAA,CAAoB,MAAA,EAAQ,IAAA;IAAgB,YAAA;EAAA,IAC9C,mBAAA,CAAoB,MAAA,EAAQ,IAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","names":[],"sources":["../../../src/collections/data/runtime.ts"],"sourcesContent":["import type { GetCollectionConfig } from \"@/types\";\nimport { FileCollectionStore } from \"@/collections/runtime/file-store\";\
|
|
1
|
+
{"version":3,"file":"runtime.js","names":[],"sources":["../../../src/collections/data/runtime.ts"],"sourcesContent":["import type { GetCollectionConfig } from \"@/types\";\nimport { FileCollectionStore } from \"@/collections/runtime/file-store\";\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 { $inferOutput: unknown }\n ? GetCollectionConfig<Config, Name>[\"$inferOutput\"]\n : never;\n}> {\n type Data =\n GetCollectionConfig<Config, Name> extends { $inferOutput: unknown }\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":";;AAGA,SAAgB,UACd,OACA,MACA,OAKC;CAKD,MAAM,SAKF,EAAE;AAEN,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC9C,QAAO,OAAO,EACZ,MAAM,OACP;AAGH,QAAO,IAAI,oBAAoB,MAAM,OAAO"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { v as AsyncPipe } from "../core-
|
|
2
|
-
import { n as LoaderConfig } from "../index-
|
|
3
|
-
import { n as FileSystemCollectionConfig, t as FileSystemCollection } from "../fs-
|
|
1
|
+
import { v as AsyncPipe } from "../core-BbTeLenA.js";
|
|
2
|
+
import { n as LoaderConfig } from "../index-DVqrqxzl.js";
|
|
3
|
+
import { n as FileSystemCollectionConfig, t as FileSystemCollection } from "../fs-KJjb32Nq.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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as asyncPipe } from "../collections-
|
|
2
|
-
import { n as slash } from "../code-generator-
|
|
1
|
+
import { r as asyncPipe } from "../collections-Bl9hpWMS.js";
|
|
2
|
+
import { n as slash } from "../code-generator-DFGEY6P5.js";
|
|
3
3
|
import { loaderHook } from "../plugins/loader/index.js";
|
|
4
4
|
import { FileSystemCollection } from "./fs.js";
|
|
5
5
|
import path from "node:path";
|
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-KJjb32Nq.js";
|
|
2
2
|
export { FileSystemCollection, FileSystemCollectionConfig, fileSystemCollection };
|
package/dist/collections/fs.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { t as Collection } from "../collections-
|
|
1
|
+
import { t as Collection } from "../collections-Bl9hpWMS.js";
|
|
2
2
|
import { t as createCache } from "../async-cache-C47yxLCv.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import picomatch from "picomatch";
|
|
5
5
|
//#region src/collections/fs.ts
|
|
6
6
|
var FileSystemCollection = class extends Collection {
|
|
7
|
-
matcher;
|
|
7
|
+
#matcher;
|
|
8
8
|
/**
|
|
9
9
|
* content directory (absolute)
|
|
10
10
|
*/
|
|
11
11
|
dir;
|
|
12
|
-
filesCache = createCache();
|
|
12
|
+
#filesCache = createCache();
|
|
13
13
|
/** the glob patterns to match files in collection, this doesn't take `supportedFormats` into account. */
|
|
14
|
-
patterns;
|
|
14
|
+
#patterns;
|
|
15
15
|
supportedFileFormats;
|
|
16
16
|
constructor(config) {
|
|
17
17
|
super();
|
|
18
18
|
const { files, supportedFormats } = config;
|
|
19
19
|
this.dir = config.dir;
|
|
20
|
-
this
|
|
20
|
+
this.#patterns = files ?? [supportedFormats ? `**/*.{${supportedFormats.join(",")}}` : `**/*`];
|
|
21
21
|
this.supportedFileFormats = supportedFormats;
|
|
22
22
|
this.onInit.hook(({ core }) => {
|
|
23
23
|
this.dir = path.resolve(core.getOptions().cwd, this.dir);
|
|
@@ -27,7 +27,7 @@ var FileSystemCollection = class extends Collection {
|
|
|
27
27
|
server.watcher.add(this.dir);
|
|
28
28
|
server.watcher.on("all", (event, file) => {
|
|
29
29
|
if (event === "change" || !this.hasFile(file)) return;
|
|
30
|
-
this
|
|
30
|
+
this.#filesCache.invalidate("");
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -41,19 +41,19 @@ var FileSystemCollection = class extends Collection {
|
|
|
41
41
|
* the result is cached.
|
|
42
42
|
*/
|
|
43
43
|
async getFiles() {
|
|
44
|
-
return this
|
|
44
|
+
return this.#filesCache.cached("", async () => {
|
|
45
45
|
const { glob } = await import("tinyglobby");
|
|
46
|
-
return (await glob(this
|
|
46
|
+
return (await glob(this.#patterns, { cwd: this.dir })).filter((v) => this.isFileSupported(v));
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
hasFile(filePath) {
|
|
50
50
|
if (!this.isFileSupported(filePath)) return false;
|
|
51
51
|
const relativePath = path.relative(this.dir, filePath);
|
|
52
52
|
if (relativePath.startsWith(`..${path.sep}`)) return false;
|
|
53
|
-
return (this
|
|
53
|
+
return (this.#matcher ??= picomatch(this.#patterns))(relativePath);
|
|
54
54
|
}
|
|
55
55
|
invalidateCache() {
|
|
56
|
-
this
|
|
56
|
+
this.#filesCache.invalidate("");
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
function fileSystemCollection(config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.js","names":[],"sources":["../../src/collections/fs.ts"],"sourcesContent":["import picomatch from \"picomatch\";\nimport path from \"node:path\";\nimport { Collection } from \".\";\nimport { createCache } from \"@/utils/async-cache\";\n\nexport class FileSystemCollection extends Collection {\n
|
|
1
|
+
{"version":3,"file":"fs.js","names":["#filesCache","#patterns","#matcher"],"sources":["../../src/collections/fs.ts"],"sourcesContent":["import picomatch from \"picomatch\";\nimport path from \"node:path\";\nimport { Collection } from \".\";\nimport { createCache } from \"@/utils/async-cache\";\n\nexport class FileSystemCollection extends Collection {\n #matcher: picomatch.Matcher | undefined;\n /**\n * content directory (absolute)\n */\n dir: string;\n readonly #filesCache = createCache<string[]>();\n /** the glob patterns to match files in collection, this doesn't take `supportedFormats` into account. */\n readonly #patterns: string[];\n readonly supportedFileFormats: string[] | undefined;\n\n constructor(config: FileSystemCollectionConfig) {\n super();\n const { files, supportedFormats } = config;\n this.dir = config.dir;\n this.#patterns = files ?? [supportedFormats ? `**/*.{${supportedFormats.join(\",\")}}` : `**/*`];\n this.supportedFileFormats = supportedFormats;\n this.onInit.hook(({ core }) => {\n this.dir = path.resolve(core.getOptions().cwd, this.dir);\n });\n this.onServer.hook(({ server }) => {\n if (!server.watcher) return;\n server.watcher.add(this.dir);\n server.watcher.on(\"all\", (event, file) => {\n if (event === \"change\" || !this.hasFile(file)) return;\n this.#filesCache.invalidate(\"\");\n });\n });\n }\n\n isFileSupported(filePath: string) {\n if (!this.supportedFileFormats) return true;\n return this.supportedFileFormats.some((format) => filePath.endsWith(`.${format}`));\n }\n\n /**\n * get all included files, relative to `dir`.\n *\n * the result is cached.\n */\n async getFiles() {\n return this.#filesCache.cached(\"\", async () => {\n const { glob } = await import(\"tinyglobby\");\n\n const out = await glob(this.#patterns, { cwd: this.dir });\n return out.filter((v) => this.isFileSupported(v));\n });\n }\n\n hasFile(filePath: string) {\n if (!this.isFileSupported(filePath)) return false;\n\n const relativePath = path.relative(this.dir, filePath);\n if (relativePath.startsWith(`..${path.sep}`)) return false;\n\n return (this.#matcher ??= picomatch(this.#patterns))(relativePath);\n }\n\n invalidateCache() {\n this.#filesCache.invalidate(\"\");\n }\n}\n\nexport interface FileSystemCollectionConfig {\n /**\n * Directory to scan\n */\n dir: string;\n\n /**\n * what files to include/exclude (glob patterns)\n *\n * Include all files if not specified\n */\n files?: string[];\n\n /**\n * Restrict to a list of file extensions to include, e.g. `['js', 'ts']`.\n */\n supportedFormats?: string[];\n}\n\nexport function fileSystemCollection(config: FileSystemCollectionConfig) {\n return new FileSystemCollection(config);\n}\n"],"mappings":";;;;;AAKA,IAAa,uBAAb,cAA0C,WAAW;CACnD;;;;CAIA;CACA,cAAuB,aAAuB;;CAE9C;CACA;CAEA,YAAY,QAAoC;AAC9C,SAAO;EACP,MAAM,EAAE,OAAO,qBAAqB;AACpC,OAAK,MAAM,OAAO;AAClB,QAAA,WAAiB,SAAS,CAAC,mBAAmB,SAAS,iBAAiB,KAAK,IAAI,CAAC,KAAK,OAAO;AAC9F,OAAK,uBAAuB;AAC5B,OAAK,OAAO,MAAM,EAAE,WAAW;AAC7B,QAAK,MAAM,KAAK,QAAQ,KAAK,YAAY,CAAC,KAAK,KAAK,IAAI;IACxD;AACF,OAAK,SAAS,MAAM,EAAE,aAAa;AACjC,OAAI,CAAC,OAAO,QAAS;AACrB,UAAO,QAAQ,IAAI,KAAK,IAAI;AAC5B,UAAO,QAAQ,GAAG,QAAQ,OAAO,SAAS;AACxC,QAAI,UAAU,YAAY,CAAC,KAAK,QAAQ,KAAK,CAAE;AAC/C,UAAA,WAAiB,WAAW,GAAG;KAC/B;IACF;;CAGJ,gBAAgB,UAAkB;AAChC,MAAI,CAAC,KAAK,qBAAsB,QAAO;AACvC,SAAO,KAAK,qBAAqB,MAAM,WAAW,SAAS,SAAS,IAAI,SAAS,CAAC;;;;;;;CAQpF,MAAM,WAAW;AACf,SAAO,MAAA,WAAiB,OAAO,IAAI,YAAY;GAC7C,MAAM,EAAE,SAAS,MAAM,OAAO;AAG9B,WADY,MAAM,KAAK,MAAA,UAAgB,EAAE,KAAK,KAAK,KAAK,CAAC,EAC9C,QAAQ,MAAM,KAAK,gBAAgB,EAAE,CAAC;IACjD;;CAGJ,QAAQ,UAAkB;AACxB,MAAI,CAAC,KAAK,gBAAgB,SAAS,CAAE,QAAO;EAE5C,MAAM,eAAe,KAAK,SAAS,KAAK,KAAK,SAAS;AACtD,MAAI,aAAa,WAAW,KAAK,KAAK,MAAM,CAAE,QAAO;AAErD,UAAQ,MAAA,YAAkB,UAAU,MAAA,SAAe,EAAE,aAAa;;CAGpE,kBAAkB;AAChB,QAAA,WAAiB,WAAW,GAAG;;;AAuBnC,SAAgB,qBAAqB,QAAoC;AACvE,QAAO,IAAI,qBAAqB,OAAO"}
|
|
@@ -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,2 +1,2 @@
|
|
|
1
|
-
import { n as defineCollectionHook, t as Collection } from "../collections-
|
|
1
|
+
import { n as defineCollectionHook, t as Collection } from "../collections-Bl9hpWMS.js";
|
|
2
2
|
export { Collection, defineCollectionHook };
|
|
@@ -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-L0I8mePE.js";
|
|
2
|
+
import { t as MDXStoreBrowserData } from "../../runtime-browser-M4sE6SmL.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/collections/mdx/react.d.ts
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as _internal_data, r as mdxStoreBrowser, t as MDXStoreBrowserData } from "../../runtime-browser-
|
|
2
|
-
import { r as WithGit } from "../../runtime-
|
|
1
|
+
import { n as _internal_data, r as mdxStoreBrowser, t as MDXStoreBrowserData } from "../../runtime-browser-M4sE6SmL.js";
|
|
2
|
+
import { r as WithGit } from "../../runtime-TETi5Giq.js";
|
|
3
3
|
export { MDXStoreBrowserData, WithGit, _internal_data, mdxStoreBrowser };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-browser.js","names":[],"sources":["../../../src/collections/mdx/runtime-browser.ts"],"sourcesContent":["\"use client\";\n\nimport type { Awaitable, GetCollectionConfig } from \"@/types\";\nimport { MapCollectionStore } from \"@/collections/runtime/store\";\nimport { type AsyncCache, createCache } from \"@/utils/async-cache\";\nimport type { CompiledMDX } from \"@/collections/mdx/build-mdx\";\
|
|
1
|
+
{"version":3,"file":"runtime-browser.js","names":[],"sources":["../../../src/collections/mdx/runtime-browser.ts"],"sourcesContent":["\"use client\";\n\nimport type { Awaitable, GetCollectionConfig } from \"@/types\";\nimport { MapCollectionStore } from \"@/collections/runtime/store\";\nimport { type AsyncCache, createCache } from \"@/utils/async-cache\";\nimport type { CompiledMDX } from \"@/collections/mdx/build-mdx\";\n\nexport interface MDXStoreBrowserData<Frontmatter, Attached = unknown> {\n id: string;\n preload: () => Awaitable<CompiledMDX<Frontmatter> & Attached>;\n _store: StoreContext;\n}\n\ninterface StoreContext {\n storeId: string;\n}\n\ninterface StoreData {\n preloaded: AsyncCache<CompiledMDX>;\n}\n\ntype GetFrontmatter<Config, Name extends string> =\n GetCollectionConfig<Config, Name> extends { $inferFrontmatter: unknown }\n ? GetCollectionConfig<Config, Name>[\"$inferFrontmatter\"]\n : never;\n\nexport const _internal_data = new Map<string, StoreData>();\n\nexport function mdxStoreBrowser<Config, Name extends string, Attached>(\n name: Name,\n _input: Record<string, () => Promise<unknown>>,\n): MapCollectionStore<string, MDXStoreBrowserData<GetFrontmatter<Config, Name>, Attached>> {\n const input = _input as Record<\n string,\n () => Promise<CompiledMDX<GetFrontmatter<Config, Name>> & Attached>\n >;\n const merged = new Map<string, MDXStoreBrowserData<GetFrontmatter<Config, Name>, Attached>>();\n function getStoreData(): StoreData {\n let store = _internal_data.get(name);\n if (store) return store;\n\n store = {\n preloaded: createCache(),\n };\n _internal_data.set(name, store);\n return store;\n }\n\n const context: StoreContext = {\n storeId: name,\n };\n\n for (const [key, value] of Object.entries(input)) {\n merged.set(key, {\n id: key,\n preload() {\n return getStoreData()\n .preloaded.$value<CompiledMDX<GetFrontmatter<Config, Name>> & Attached>()\n .cached(key, value);\n },\n _store: context,\n });\n }\n\n return new MapCollectionStore(merged);\n}\n\nexport type { WithGit } from \"./runtime\";\n"],"mappings":";;;;AA0BA,MAAa,iCAAiB,IAAI,KAAwB;AAE1D,SAAgB,gBACd,MACA,QACyF;CACzF,MAAM,QAAQ;CAId,MAAM,yBAAS,IAAI,KAA0E;CAC7F,SAAS,eAA0B;EACjC,IAAI,QAAQ,eAAe,IAAI,KAAK;AACpC,MAAI,MAAO,QAAO;AAElB,UAAQ,EACN,WAAW,aAAa,EACzB;AACD,iBAAe,IAAI,MAAM,MAAM;AAC/B,SAAO;;CAGT,MAAM,UAAwB,EAC5B,SAAS,MACV;AAED,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC9C,QAAO,IAAI,KAAK;EACd,IAAI;EACJ,UAAU;AACR,UAAO,cAAc,CAClB,UAAU,QAA8D,CACxE,OAAO,KAAK,MAAM;;EAEvB,QAAQ;EACT,CAAC;AAGJ,QAAO,IAAI,mBAAmB,OAAO"}
|
|
@@ -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
|
|
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-DutRtol_.js";
|
|
3
|
+
import { i as CompiledMDX } from "../../mdx-L0I8mePE.js";
|
|
4
|
+
import { r as WithGit } from "../../runtime-TETi5Giq.js";
|
|
5
5
|
import { MDXContent } from "mdx/types";
|
|
6
6
|
|
|
7
7
|
//#region src/collections/mdx/runtime-dynamic.d.ts
|
|
@@ -10,7 +10,9 @@ interface MDXStoreDynamicData<Frontmatter, Attached = unknown> {
|
|
|
10
10
|
frontmatter: Frontmatter;
|
|
11
11
|
compile: () => Promise<CompiledMDX<Frontmatter> & Attached>;
|
|
12
12
|
}
|
|
13
|
-
type GetFrontmatter<Config, Name extends string> = GetCollectionConfig<Config, Name> extends
|
|
13
|
+
type GetFrontmatter<Config, Name extends string> = GetCollectionConfig<Config, Name> extends {
|
|
14
|
+
$inferFrontmatter: unknown;
|
|
15
|
+
} ? GetCollectionConfig<Config, Name>["$inferFrontmatter"] : never;
|
|
14
16
|
declare function mdxStoreDynamic<Config, Name extends string, Attached>(config: Config, coreOptions: CoreOptions, name: Name, base: string, _frontmatter: Record<string, unknown>, jsxRuntime: unknown): Promise<FileCollectionStore<MDXStoreDynamicData<GetFrontmatter<Config, Name>, Attached>>>;
|
|
15
17
|
type MdxContent = MDXContent;
|
|
16
18
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-dynamic.d.ts","names":[],"sources":["../../../src/collections/mdx/runtime-dynamic.ts"],"mappings":";;;;;;;UAYiB,mBAAA;EACf,EAAA;EACA,WAAA,EAAa,WAAA;EACb,OAAA,QAAe,OAAA,CAAQ,WAAA,CAAY,WAAA,IAAe,QAAA;AAAA;AAAA,KAK/C,cAAA,gCACH,mBAAA,CAAoB,MAAA,EAAQ,IAAA,
|
|
1
|
+
{"version":3,"file":"runtime-dynamic.d.ts","names":[],"sources":["../../../src/collections/mdx/runtime-dynamic.ts"],"mappings":";;;;;;;UAYiB,mBAAA;EACf,EAAA;EACA,WAAA,EAAa,WAAA;EACb,OAAA,QAAe,OAAA,CAAQ,WAAA,CAAY,WAAA,IAAe,QAAA;AAAA;AAAA,KAK/C,cAAA,gCACH,mBAAA,CAAoB,MAAA,EAAQ,IAAA;EAAgB,iBAAA;AAAA,IACxC,mBAAA,CAAoB,MAAA,EAAQ,IAAA;AAAA,iBAGZ,eAAA,uCAAA,CACpB,MAAA,EAAQ,MAAA,EACR,WAAA,EAAa,WAAA,EACb,IAAA,EAAM,IAAA,EACN,IAAA,UACA,YAAA,EAAc,MAAA,mBACd,UAAA,YACC,OAAA,CAAQ,mBAAA,CAAoB,mBAAA,CAAoB,cAAA,CAAe,MAAA,EAAQ,IAAA,GAAO,QAAA;AAAA,KAsDrE,UAAA,GAAa,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-dynamic.js","names":[],"sources":["../../../src/collections/mdx/runtime-dynamic.ts"],"sourcesContent":["import { buildMDX, type CompiledMDX } from \"@/collections/mdx/build-mdx\";\nimport { pathToFileURL } from \"node:url\";\nimport { fumaMatter } from \"@/collections/mdx/fuma-matter\";\nimport fs from \"node:fs/promises\";\nimport { type CoreOptions, Core } from \"@/core\";\nimport type { MDXContent } from \"mdx/types\";\nimport { FileCollectionStore } from \"@/collections/runtime/file-store\";\nimport type { GetCollectionConfig } from \"@/types\";\nimport { MDXCollection } from \"@/collections/mdx\";\nimport path from \"node:path\";\nimport { createCache } from \"@/utils/async-cache\";\n\nexport interface MDXStoreDynamicData<Frontmatter, Attached = unknown> {\n id: string;\n frontmatter: Frontmatter;\n compile: () => Promise<CompiledMDX<Frontmatter> & Attached>;\n}\n\nlet corePromise: Promise<Core>;\n\ntype GetFrontmatter<Config, Name extends string> =\n GetCollectionConfig<Config, Name> extends
|
|
1
|
+
{"version":3,"file":"runtime-dynamic.js","names":[],"sources":["../../../src/collections/mdx/runtime-dynamic.ts"],"sourcesContent":["import { buildMDX, type CompiledMDX } from \"@/collections/mdx/build-mdx\";\nimport { pathToFileURL } from \"node:url\";\nimport { fumaMatter } from \"@/collections/mdx/fuma-matter\";\nimport fs from \"node:fs/promises\";\nimport { type CoreOptions, Core } from \"@/core\";\nimport type { MDXContent } from \"mdx/types\";\nimport { FileCollectionStore } from \"@/collections/runtime/file-store\";\nimport type { GetCollectionConfig } from \"@/types\";\nimport { MDXCollection } from \"@/collections/mdx\";\nimport path from \"node:path\";\nimport { createCache } from \"@/utils/async-cache\";\n\nexport interface MDXStoreDynamicData<Frontmatter, Attached = unknown> {\n id: string;\n frontmatter: Frontmatter;\n compile: () => Promise<CompiledMDX<Frontmatter> & Attached>;\n}\n\nlet corePromise: Promise<Core>;\n\ntype GetFrontmatter<Config, Name extends string> =\n GetCollectionConfig<Config, Name> extends { $inferFrontmatter: unknown }\n ? GetCollectionConfig<Config, Name>[\"$inferFrontmatter\"]\n : never;\n\nexport async function mdxStoreDynamic<Config, Name extends string, Attached>(\n config: Config,\n coreOptions: CoreOptions,\n name: Name,\n base: string,\n _frontmatter: Record<string, unknown>,\n jsxRuntime: unknown,\n): Promise<FileCollectionStore<MDXStoreDynamicData<GetFrontmatter<Config, Name>, Attached>>> {\n corePromise ??= (async () => {\n const core = new Core(coreOptions);\n await core.init({\n config: config as Record<string, unknown>,\n });\n return core;\n })();\n const core = await corePromise;\n const frontmatter = _frontmatter as Record<string, GetFrontmatter<Config, Name>>;\n const collection = core.getCollection(name);\n if (!collection || !(collection instanceof MDXCollection))\n throw new Error(\"invalid collection name\");\n\n const merged: Record<string, MDXStoreDynamicData<GetFrontmatter<Config, Name>, Attached>> = {};\n const cache = createCache<CompiledMDX<GetFrontmatter<Config, Name>> & Attached>();\n\n for (const [k, v] of Object.entries(frontmatter)) {\n merged[k] = {\n id: k,\n frontmatter: v,\n async compile() {\n return cache.cached(k, async () => {\n const filePath = path.join(base, k);\n let content = (await fs.readFile(filePath)).toString();\n content = fumaMatter(content).content;\n\n const compiled = await buildMDX({\n core,\n collection,\n filePath,\n source: content,\n frontmatter: v as unknown as Record<string, unknown>,\n isDevelopment: false,\n environment: \"runtime\",\n compiler: {\n collection,\n core,\n addDependency() {},\n },\n });\n\n return (await executeMdx(String(compiled.value), {\n baseUrl: pathToFileURL(filePath),\n jsxRuntime,\n })) as CompiledMDX<GetFrontmatter<Config, Name>> & Attached;\n });\n },\n };\n }\n\n return new FileCollectionStore(base, merged);\n}\n\nexport type MdxContent = MDXContent;\n\ninterface Options {\n scope?: Record<string, unknown>;\n baseUrl?: string | URL;\n jsxRuntime?: unknown;\n}\n\nconst AsyncFunction: new (...args: string[]) => (...args: unknown[]) => Promise<unknown> =\n Object.getPrototypeOf(executeMdx).constructor;\n\nasync function executeMdx(compiled: string, options: Options = {}) {\n const { opts: scopeOpts, ...scope } = options.scope ?? {};\n const fullScope = {\n opts: {\n ...(scopeOpts as object),\n ...(options.jsxRuntime as object),\n baseUrl: options.baseUrl,\n },\n ...scope,\n };\n\n const hydrateFn = new AsyncFunction(...Object.keys(fullScope), compiled);\n return (await hydrateFn.apply(hydrateFn, Object.values(fullScope))) as {\n default: MdxContent;\n };\n}\n\nexport type { WithGit } from \"./runtime\";\n"],"mappings":";;;;;;;;;;;AAkBA,IAAI;AAOJ,eAAsB,gBACpB,QACA,aACA,MACA,MACA,cACA,YAC2F;AAC3F,kBAAiB,YAAY;EAC3B,MAAM,OAAO,IAAI,KAAK,YAAY;AAClC,QAAM,KAAK,KAAK,EACN,QACT,CAAC;AACF,SAAO;KACL;CACJ,MAAM,OAAO,MAAM;CACnB,MAAM,cAAc;CACpB,MAAM,aAAa,KAAK,cAAc,KAAK;AAC3C,KAAI,CAAC,cAAc,EAAE,sBAAsB,eACzC,OAAM,IAAI,MAAM,0BAA0B;CAE5C,MAAM,SAAsF,EAAE;CAC9F,MAAM,QAAQ,aAAmE;AAEjF,MAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,YAAY,CAC9C,QAAO,KAAK;EACV,IAAI;EACJ,aAAa;EACb,MAAM,UAAU;AACd,UAAO,MAAM,OAAO,GAAG,YAAY;IACjC,MAAM,WAAW,KAAK,KAAK,MAAM,EAAE;IACnC,IAAI,WAAW,MAAM,GAAG,SAAS,SAAS,EAAE,UAAU;AACtD,cAAU,WAAW,QAAQ,CAAC;IAE9B,MAAM,WAAW,MAAM,SAAS;KAC9B;KACA;KACA;KACA,QAAQ;KACR,aAAa;KACb,eAAe;KACf,aAAa;KACb,UAAU;MACR;MACA;MACA,gBAAgB;MACjB;KACF,CAAC;AAEF,WAAQ,MAAM,WAAW,OAAO,SAAS,MAAM,EAAE;KAC/C,SAAS,cAAc,SAAS;KAChC;KACD,CAAC;KACF;;EAEL;AAGH,QAAO,IAAI,oBAAoB,MAAM,OAAO;;AAW9C,MAAM,gBACJ,OAAO,eAAe,WAAW,CAAC;AAEpC,eAAe,WAAW,UAAkB,UAAmB,EAAE,EAAE;CACjE,MAAM,EAAE,MAAM,WAAW,GAAG,UAAU,QAAQ,SAAS,EAAE;CACzD,MAAM,YAAY;EAChB,MAAM;GACJ,GAAI;GACJ,GAAI,QAAQ;GACZ,SAAS,QAAQ;GAClB;EACD,GAAG;EACJ;CAED,MAAM,YAAY,IAAI,cAAc,GAAG,OAAO,KAAK,UAAU,EAAE,SAAS;AACxE,QAAQ,MAAM,UAAU,MAAM,WAAW,OAAO,OAAO,UAAU,CAAC"}
|
|
@@ -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-TETi5Giq.js";
|
|
2
2
|
export { MDXStoreData, MDXStoreLazyData, WithGit, mdxStore, mdxStoreLazy };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","names":[],"sources":["../../../src/collections/mdx/runtime.ts"],"sourcesContent":["import type { GetCollectionConfig } from \"@/types\";\nimport
|
|
1
|
+
{"version":3,"file":"runtime.js","names":[],"sources":["../../../src/collections/mdx/runtime.ts"],"sourcesContent":["import type { GetCollectionConfig } from \"@/types\";\nimport { FileCollectionStore } from \"@/collections/runtime/file-store\";\nimport type { GitFileData } from \"@/plugins/git\";\nimport type { CompiledMDX } from \"@/collections/mdx/build-mdx\";\n\nexport interface MDXStoreData<Frontmatter, Attached = unknown> {\n id: string;\n compiled: CompiledMDX<Frontmatter> & Attached;\n}\n\ntype GetFrontmatter<Config, Name extends string> =\n GetCollectionConfig<Config, Name> extends { $inferFrontmatter: unknown }\n ? GetCollectionConfig<Config, Name>[\"$inferFrontmatter\"]\n : never;\n\nexport function mdxStore<Config, Name extends string, Attached>(\n _name: Name,\n base: string,\n _input: Record<string, unknown>,\n): FileCollectionStore<MDXStoreData<GetFrontmatter<Config, Name>, Attached>> {\n const input = _input as Record<string, CompiledMDX<GetFrontmatter<Config, Name>> & Attached>;\n const merged: Record<string, MDXStoreData<GetFrontmatter<Config, Name>, Attached>> = {};\n\n for (const [key, value] of Object.entries(input)) {\n merged[key] = {\n id: key,\n compiled: value,\n };\n }\n\n return new FileCollectionStore(base, merged);\n}\n\nexport interface MDXStoreLazyData<Frontmatter, Attached> {\n id: string;\n frontmatter: Frontmatter;\n load: () => Promise<CompiledMDX<Frontmatter> & Attached>;\n}\n\nexport function mdxStoreLazy<Config, Name extends string, Attached>(\n _name: Name,\n base: string,\n _input: {\n head: Record<string, unknown>;\n body: Record<string, () => Promise<unknown>>;\n },\n): FileCollectionStore<MDXStoreLazyData<GetFrontmatter<Config, Name>, Attached>> {\n const input = _input as {\n head: Record<string, GetFrontmatter<Config, Name>>;\n body: Record<string, () => Promise<CompiledMDX<GetFrontmatter<Config, Name>> & Attached>>;\n };\n const merged: Record<string, MDXStoreLazyData<GetFrontmatter<Config, Name>, Attached>> = {};\n\n for (const [key, value] of Object.entries(input.head)) {\n merged[key] = {\n id: key,\n frontmatter: value,\n load: input.body[key],\n };\n }\n\n return new FileCollectionStore(base, merged);\n}\n\nexport type WithGit = GitFileData;\n"],"mappings":";;AAeA,SAAgB,SACd,OACA,MACA,QAC2E;CAC3E,MAAM,QAAQ;CACd,MAAM,SAA+E,EAAE;AAEvF,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC9C,QAAO,OAAO;EACZ,IAAI;EACJ,UAAU;EACX;AAGH,QAAO,IAAI,oBAAoB,MAAM,OAAO;;AAS9C,SAAgB,aACd,OACA,MACA,QAI+E;CAC/E,MAAM,QAAQ;CAId,MAAM,SAAmF,EAAE;AAE3F,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,KAAK,CACnD,QAAO,OAAO;EACZ,IAAI;EACJ,aAAa;EACb,MAAM,MAAM,KAAK;EAClB;AAGH,QAAO,IAAI,oBAAoB,MAAM,OAAO"}
|
|
@@ -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-L0I8mePE.js";
|
|
2
|
+
import { t as MDXStoreBrowserData } from "../../runtime-browser-M4sE6SmL.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-L0I8mePE.js";
|
|
2
2
|
export { CompiledMDX, LinkReference, MDXCollection, MDXCollectionConfig, mdxCollection };
|
package/dist/collections/mdx.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as pipe, r as asyncPipe } from "../collections-
|
|
2
|
-
import { n as slash } from "../code-generator-
|
|
1
|
+
import { i as pipe, r as asyncPipe } from "../collections-Bl9hpWMS.js";
|
|
2
|
+
import { n as slash } from "../code-generator-DFGEY6P5.js";
|
|
3
3
|
import { r as validate } from "../validation-Bf_v2L3p.js";
|
|
4
4
|
import { t as createCache } from "../async-cache-C47yxLCv.js";
|
|
5
5
|
import { loaderHook } from "../plugins/loader/index.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as slash } from "../code-generator-
|
|
1
|
+
import { n as slash } from "../code-generator-DFGEY6P5.js";
|
|
2
2
|
import "../validation-Bf_v2L3p.js";
|
|
3
3
|
import { MDXCollection, mdxCollection } from "./mdx.js";
|
|
4
4
|
import { t as fumaMatter } from "../fuma-matter-E30PU53R.js";
|
|
@@ -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-DutRtol_.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,16 +1,16 @@
|
|
|
1
1
|
//#region src/collections/runtime/store.ts
|
|
2
2
|
var MapCollectionStore = class MapCollectionStore {
|
|
3
|
-
dataMap;
|
|
4
|
-
dataList;
|
|
3
|
+
#dataMap;
|
|
4
|
+
#dataList;
|
|
5
5
|
constructor(input) {
|
|
6
|
-
this
|
|
7
|
-
this
|
|
6
|
+
this.#dataMap = input;
|
|
7
|
+
this.#dataList = Array.from(input.values());
|
|
8
8
|
}
|
|
9
9
|
get(id) {
|
|
10
|
-
return this
|
|
10
|
+
return this.#dataMap.get(id);
|
|
11
11
|
}
|
|
12
12
|
list() {
|
|
13
|
-
return this
|
|
13
|
+
return this.#dataList;
|
|
14
14
|
}
|
|
15
15
|
castData(_cast) {
|
|
16
16
|
return this;
|
|
@@ -20,7 +20,7 @@ var MapCollectionStore = class MapCollectionStore {
|
|
|
20
20
|
*/
|
|
21
21
|
transform(fn) {
|
|
22
22
|
const updated = /* @__PURE__ */ new Map();
|
|
23
|
-
for (const [k, v] of this
|
|
23
|
+
for (const [k, v] of this.#dataMap) {
|
|
24
24
|
const out = fn(k, v);
|
|
25
25
|
updated.set(out[0], out[1]);
|
|
26
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","names":[],"sources":["../../../src/collections/runtime/store.ts"],"sourcesContent":["import type { Awaitable } from \"@/types\";\n\nexport interface CollectionStore<Id, Data> {\n /**\n * type-only operation to cast data type, doesn't do any runtime transformation.\n */\n castData: <T>(_cast: (input: Data) => T) => CollectionStore<Id, T>;\n\n get: (id: Id) => Awaitable<Data | undefined>;\n list: () => Awaitable<Data[]>;\n\n /**\n * For typescript to infer data types, don't access the value of this property.\n */\n $inferData: Data;\n}\n\nexport class MapCollectionStore<Id, Data> implements CollectionStore<Id, Data> {\n
|
|
1
|
+
{"version":3,"file":"store.js","names":["#dataMap","#dataList"],"sources":["../../../src/collections/runtime/store.ts"],"sourcesContent":["import type { Awaitable } from \"@/types\";\n\nexport interface CollectionStore<Id, Data> {\n /**\n * type-only operation to cast data type, doesn't do any runtime transformation.\n */\n castData: <T>(_cast: (input: Data) => T) => CollectionStore<Id, T>;\n\n get: (id: Id) => Awaitable<Data | undefined>;\n list: () => Awaitable<Data[]>;\n\n /**\n * For typescript to infer data types, don't access the value of this property.\n */\n $inferData: Data;\n}\n\nexport class MapCollectionStore<Id, Data> implements CollectionStore<Id, Data> {\n readonly #dataMap: Map<Id, Data>;\n readonly #dataList: Data[];\n\n constructor(input: Map<Id, Data>) {\n this.#dataMap = input;\n this.#dataList = Array.from(input.values());\n }\n\n get(id: Id): Data | undefined {\n return this.#dataMap.get(id);\n }\n\n list(): Data[] {\n return this.#dataList;\n }\n\n castData<T>(_cast: (input: Data) => T): MapCollectionStore<Id, T> {\n return this as unknown as MapCollectionStore<Id, T>;\n }\n\n /**\n * transform entry and create a new store\n */\n transform<$Id, T>(fn: (id: Id, data: Data) => [$Id, T]): MapCollectionStore<$Id, T> {\n const updated = new Map<$Id, T>();\n\n for (const [k, v] of this.#dataMap) {\n const out = fn(k, v);\n updated.set(out[0], out[1]);\n }\n\n return new MapCollectionStore(updated);\n }\n\n get $inferData(): Data {\n return undefined as Data;\n }\n}\n"],"mappings":";AAiBA,IAAa,qBAAb,MAAa,mBAAkE;CAC7E;CACA;CAEA,YAAY,OAAsB;AAChC,QAAA,UAAgB;AAChB,QAAA,WAAiB,MAAM,KAAK,MAAM,QAAQ,CAAC;;CAG7C,IAAI,IAA0B;AAC5B,SAAO,MAAA,QAAc,IAAI,GAAG;;CAG9B,OAAe;AACb,SAAO,MAAA;;CAGT,SAAY,OAAsD;AAChE,SAAO;;;;;CAMT,UAAkB,IAAkE;EAClF,MAAM,0BAAU,IAAI,KAAa;AAEjC,OAAK,MAAM,CAAC,GAAG,MAAM,MAAA,SAAe;GAClC,MAAM,MAAM,GAAG,GAAG,EAAE;AACpB,WAAQ,IAAI,IAAI,IAAI,IAAI,GAAG;;AAG7B,SAAO,IAAI,mBAAmB,QAAQ;;CAGxC,IAAI,aAAmB"}
|
|
@@ -54,7 +54,7 @@ function asyncPipe(steps = []) {
|
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/collections/index.ts
|
|
56
56
|
var Collection = class {
|
|
57
|
-
pluginHooks = /* @__PURE__ */ new Map();
|
|
57
|
+
#pluginHooks = /* @__PURE__ */ new Map();
|
|
58
58
|
name = null;
|
|
59
59
|
/**
|
|
60
60
|
* on config loaded/updated
|
|
@@ -68,23 +68,27 @@ var Collection = class {
|
|
|
68
68
|
onEmit = asyncPipe();
|
|
69
69
|
plugins = [];
|
|
70
70
|
pluginHook(hook, options) {
|
|
71
|
-
let created = this
|
|
71
|
+
let created = this.#pluginHooks.get(hook.id);
|
|
72
72
|
if (created) return created;
|
|
73
73
|
created = hook.create(this, options);
|
|
74
|
-
this
|
|
74
|
+
this.#pluginHooks.set(hook.id, created);
|
|
75
75
|
return created;
|
|
76
76
|
}
|
|
77
77
|
getPluginHook(hook) {
|
|
78
|
-
return this
|
|
78
|
+
return this.#pluginHooks.get(hook.id);
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
function defineCollectionHook(
|
|
82
|
-
return {
|
|
81
|
+
function defineCollectionHook(...args) {
|
|
82
|
+
if (args.length === 1) return {
|
|
83
83
|
id: Symbol(),
|
|
84
|
-
create:
|
|
84
|
+
create: args[0]
|
|
85
|
+
};
|
|
86
|
+
return {
|
|
87
|
+
id: args[0],
|
|
88
|
+
create: args[1]
|
|
85
89
|
};
|
|
86
90
|
}
|
|
87
91
|
//#endregion
|
|
88
92
|
export { asyncHook as a, pipe as i, defineCollectionHook as n, hook as o, asyncPipe as r, Collection as t };
|
|
89
93
|
|
|
90
|
-
//# sourceMappingURL=collections-
|
|
94
|
+
//# sourceMappingURL=collections-Bl9hpWMS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections-Bl9hpWMS.js","names":["#pluginHooks"],"sources":["../src/utils/hook.ts","../src/utils/pipe.ts","../src/collections/index.ts"],"sourcesContent":["import type { Awaitable } from \"@/types\";\n\nexport interface Hook<Context = undefined> {\n /**\n * add a hook\n *\n * @returns the same pipe instance\n */\n hook: (fn: (context: Context) => void) => Hook<Context>;\n run: (context: Context) => void;\n $inferHandler: (context: Context) => Awaitable<void>;\n}\n\nexport interface AsyncHook<Context = undefined> {\n /**\n * add a hook\n *\n * @returns the same pipe instance\n */\n hook: (fn: (context: Context) => Awaitable<void>) => AsyncHook<Context>;\n run: (context: Context) => Awaitable<void>;\n $inferHandler: (context: Context) => Awaitable<void>;\n}\n\nexport function hook<Context>(steps: ((ctx: Context) => void)[] = []): Hook<Context> {\n return {\n async run(ctx) {\n for (const step of steps) step(ctx);\n },\n hook(fn) {\n steps.push(fn);\n return this;\n },\n $inferHandler: undefined as never,\n };\n}\n\nexport function asyncHook<Context>(\n steps: ((ctx: Context) => Awaitable<void>)[] = [],\n): AsyncHook<Context> {\n return {\n async run(ctx) {\n await Promise.all(steps.map((step) => step(ctx)));\n },\n hook(fn) {\n steps.push(fn);\n return this;\n },\n $inferHandler: undefined as never,\n };\n}\n","import type { Awaitable } from \"@/types\";\n\nexport interface Pipe<Data, Context = undefined> {\n /**\n * add a transformation step\n *\n * @returns the same pipe instance\n */\n pipe: (fn: (data: Data, context: Context) => Data) => Pipe<Data, Context>;\n run: (data: Data, context: Context) => Data;\n $inferHandler: (data: Data, context: Context) => Data;\n}\n\nexport interface AsyncPipe<Data, Context = undefined> {\n /**\n * add a transformation step\n *\n * @returns the same pipe instance\n */\n pipe: (fn: (data: Data, context: Context) => Awaitable<Data>) => AsyncPipe<Data, Context>;\n run: (data: Data, context: Context) => Awaitable<Data>;\n $inferHandler: (data: Data, context: Context) => Awaitable<Data>;\n}\n\nexport function pipe<Data, Context>(\n steps: ((data: Data, context: Context) => Data)[] = [],\n): Pipe<Data, Context> {\n return {\n run(data, ctx) {\n for (const step of steps) {\n data = step(data, ctx);\n }\n return data;\n },\n pipe(fn) {\n steps.push(fn);\n return this;\n },\n $inferHandler: undefined as never,\n };\n}\n\nexport function asyncPipe<Data, Context>(\n steps: ((data: Data, context: Context) => Awaitable<Data>)[] = [],\n): AsyncPipe<Data, Context> {\n return {\n async run(data, ctx) {\n for (const step of steps) {\n data = await step(data, ctx);\n }\n return data;\n },\n pipe(fn) {\n steps.push(fn);\n return this;\n },\n $inferHandler: undefined as never,\n };\n}\n","import { Core, EmitContext, EmitEntry, PluginOption, ResolvedConfig, ServerContext } from \"@/core\";\nimport { asyncHook, hook } from \"@/utils/hook\";\nimport { asyncPipe } from \"@/utils/pipe\";\n\nexport interface CollectionHookContext {\n core: Core;\n}\n\nexport class Collection {\n readonly #pluginHooks = new Map<symbol | string, unknown>();\n name = null as unknown as string;\n\n /**\n * on config loaded/updated\n */\n readonly onConfig = hook<CollectionHookContext & { config: ResolvedConfig }>();\n /**\n * Configure watch/dev server\n */\n readonly onServer = hook<CollectionHookContext & { server: ServerContext }>();\n readonly onInit = asyncHook<CollectionHookContext>();\n readonly onEmit = asyncPipe<EmitEntry[], EmitContext>();\n readonly plugins: PluginOption[] = [];\n\n pluginHook<T, Options>(hook: CollectionHook<T, Options>, options: Options): T;\n pluginHook<T>(hook: CollectionHook<T>): T;\n\n pluginHook<T, O>(hook: CollectionHook<T, O>, options?: O): T {\n let created = this.#pluginHooks.get(hook.id) as T | undefined;\n if (created) return created;\n\n created = hook.create(this, options as O);\n this.#pluginHooks.set(hook.id, created);\n return created;\n }\n\n getPluginHook<T>(hook: CollectionHook<T>): T | undefined {\n return this.#pluginHooks.get(hook.id) as T | undefined;\n }\n}\n\nexport interface CollectionHook<T = unknown, Options = undefined> {\n id: string | symbol;\n create: (collection: Collection, options: Options) => T;\n}\n\nexport function defineCollectionHook<T, Options = undefined>(\n init: (collection: Collection, options: Options) => T,\n): CollectionHook<T, Options>;\n\nexport function defineCollectionHook<T, Options = undefined>(\n id: string,\n init: (collection: Collection, options: Options) => T,\n): CollectionHook<T, Options>;\n\nexport function defineCollectionHook<T, Options = undefined>(\n ...args:\n | [init: (collection: Collection, options: Options) => T]\n | [id: string, init: (collection: Collection, options: Options) => T]\n): CollectionHook<T, Options> {\n if (args.length === 1)\n return {\n id: Symbol(),\n create: args[0],\n };\n\n return {\n id: args[0],\n create: args[1],\n };\n}\n"],"mappings":";AAwBA,SAAgB,KAAc,QAAoC,EAAE,EAAiB;AACnF,QAAO;EACL,MAAM,IAAI,KAAK;AACb,QAAK,MAAM,QAAQ,MAAO,MAAK,IAAI;;EAErC,KAAK,IAAI;AACP,SAAM,KAAK,GAAG;AACd,UAAO;;EAET,eAAe,KAAA;EAChB;;AAGH,SAAgB,UACd,QAA+C,EAAE,EAC7B;AACpB,QAAO;EACL,MAAM,IAAI,KAAK;AACb,SAAM,QAAQ,IAAI,MAAM,KAAK,SAAS,KAAK,IAAI,CAAC,CAAC;;EAEnD,KAAK,IAAI;AACP,SAAM,KAAK,GAAG;AACd,UAAO;;EAET,eAAe,KAAA;EAChB;;;;ACzBH,SAAgB,KACd,QAAoD,EAAE,EACjC;AACrB,QAAO;EACL,IAAI,MAAM,KAAK;AACb,QAAK,MAAM,QAAQ,MACjB,QAAO,KAAK,MAAM,IAAI;AAExB,UAAO;;EAET,KAAK,IAAI;AACP,SAAM,KAAK,GAAG;AACd,UAAO;;EAET,eAAe,KAAA;EAChB;;AAGH,SAAgB,UACd,QAA+D,EAAE,EACvC;AAC1B,QAAO;EACL,MAAM,IAAI,MAAM,KAAK;AACnB,QAAK,MAAM,QAAQ,MACjB,QAAO,MAAM,KAAK,MAAM,IAAI;AAE9B,UAAO;;EAET,KAAK,IAAI;AACP,SAAM,KAAK,GAAG;AACd,UAAO;;EAET,eAAe,KAAA;EAChB;;;;ACjDH,IAAa,aAAb,MAAwB;CACtB,+BAAwB,IAAI,KAA+B;CAC3D,OAAO;;;;CAKP,WAAoB,MAA0D;;;;CAI9E,WAAoB,MAAyD;CAC7E,SAAkB,WAAkC;CACpD,SAAkB,WAAqC;CACvD,UAAmC,EAAE;CAKrC,WAAiB,MAA4B,SAAgB;EAC3D,IAAI,UAAU,MAAA,YAAkB,IAAI,KAAK,GAAG;AAC5C,MAAI,QAAS,QAAO;AAEpB,YAAU,KAAK,OAAO,MAAM,QAAa;AACzC,QAAA,YAAkB,IAAI,KAAK,IAAI,QAAQ;AACvC,SAAO;;CAGT,cAAiB,MAAwC;AACvD,SAAO,MAAA,YAAkB,IAAI,KAAK,GAAG;;;AAkBzC,SAAgB,qBACd,GAAG,MAGyB;AAC5B,KAAI,KAAK,WAAW,EAClB,QAAO;EACL,IAAI,QAAQ;EACZ,QAAQ,KAAK;EACd;AAEH,QAAO;EACL,IAAI,KAAK;EACT,QAAQ,KAAK;EACd"}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { EmitConfig, GlobalConfig, WorkspaceConfig, defineConfig };
|
|
1
|
+
import { A as GlobalConfig, M as defineConfig, O as CollectionsPack, j as WorkspaceConfig, k as EmitConfig } from "../core-BbTeLenA.js";
|
|
2
|
+
export { CollectionsPack, EmitConfig, GlobalConfig, WorkspaceConfig, defineConfig };
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/config/index.ts"],"sourcesContent":["import { Collection } from \"@/collections\";\nimport type { PluginOption } from \"@/core\";\n\nexport
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/config/index.ts"],"sourcesContent":["import { Collection } from \"@/collections\";\nimport type { PluginOption } from \"@/core\";\n\nexport type CollectionsPack = {\n [key: string]: Collection | CollectionsPack;\n};\n\nexport interface GlobalConfig<Collections extends CollectionsPack = CollectionsPack> {\n plugins?: PluginOption[];\n collections?: Collections;\n workspaces?: Record<string, WorkspaceConfig>;\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 /**\n * configure code generation\n */\n emit?: EmitConfig;\n}\n\nexport interface EmitConfig {\n /**\n * add .js extenstion to imports\n */\n jsExtension?: boolean;\n}\n\nexport interface WorkspaceConfig {\n dir: string;\n config: GlobalConfig | { default: GlobalConfig };\n}\n\nexport function defineConfig<Collections extends CollectionsPack = CollectionsPack>(\n config: GlobalConfig<Collections> = {},\n): GlobalConfig<Collections> {\n return config;\n}\n"],"mappings":";AAqCA,SAAgB,aACd,SAAoC,EAAE,EACX;AAC3B,QAAO"}
|