qarpeo 0.3.1 → 0.3.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/chunks/tools.mjs +1 -1
- package/dist/module.mjs +7 -3
- package/dist/runtime/server/utils/cms/markdown.mjs +7 -2
- package/dist/runtime/server/utils/cms/references.mjs +1 -2
- package/dist/runtime/server/utils/cms/revisions.mjs +1 -1
- package/dist/runtime/server/utils/cms/sync.mjs +12 -3
- package/package.json +1 -1
package/dist/chunks/tools.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { useRuntimeConfig } from 'nuxt/server';
|
|
|
11
11
|
import { mkdir, writeFile, readFile } from 'node:fs/promises';
|
|
12
12
|
import { defu } from 'defu';
|
|
13
13
|
|
|
14
|
-
const version = "0.3.
|
|
14
|
+
const version = "0.3.3";
|
|
15
15
|
|
|
16
16
|
function resolveBindingName(service, override, defaultName) {
|
|
17
17
|
if (override && typeof override === "string") {
|
package/dist/module.mjs
CHANGED
|
@@ -6,8 +6,8 @@ import { x as resolveTableName, y as resolveIndexName, z as buildDevWranglerConf
|
|
|
6
6
|
export { A as ALL_CMS_TABLE_NAMES, d as ALL_COMMENTS_TABLE_NAMES, c as ALL_STORE_TABLE_NAMES, M as cmsBookmarks, N as cmsCategories, O as cmsCollections, P as cmsEntries, Q as cmsRevisions, R as cmsSubscribers, S as cmsTags, b as getActiveAuthTableNames, T as getActiveCmsTableNames, U as getActiveCommentsTableNames, V as getActiveStoreTableNames, W as hasDatabaseSchema, r as resolveDatabaseTarget, k as resolveProjectName } from './chunks/tools.mjs';
|
|
7
7
|
import { createHash } from 'node:crypto';
|
|
8
8
|
import { readdir, readFile } from 'node:fs/promises';
|
|
9
|
-
import { downloadTemplate } from 'giget';
|
|
10
9
|
import { createRequire } from 'node:module';
|
|
10
|
+
import { downloadTemplate } from 'giget';
|
|
11
11
|
import { fileURLToPath } from 'node:url';
|
|
12
12
|
import 'node:child_process';
|
|
13
13
|
import 'drizzle-orm/node-sqlite';
|
|
@@ -462,10 +462,14 @@ async function resolveAllCmsSources(options) {
|
|
|
462
462
|
return resolvedList;
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
+
let _yamlMod = null;
|
|
465
466
|
function _requireYamlSync() {
|
|
467
|
+
if (_yamlMod) return _yamlMod;
|
|
466
468
|
try {
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
+
const req = createRequire(import.meta.url);
|
|
470
|
+
const m = req("yaml");
|
|
471
|
+
_yamlMod = { parse: m.parse };
|
|
472
|
+
return _yamlMod;
|
|
469
473
|
} catch {
|
|
470
474
|
throw new Error(
|
|
471
475
|
`[qarpeo] CMS content scanning requires the \`yaml\` package.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
import { useRuntimeConfig } from "nuxt/server";
|
|
2
3
|
import { getQarpeoConfig } from "../config.mjs";
|
|
3
4
|
function _requireComark() {
|
|
@@ -14,10 +15,14 @@ Install it with: pnpm add comark`
|
|
|
14
15
|
);
|
|
15
16
|
});
|
|
16
17
|
}
|
|
18
|
+
let _yamlMod = null;
|
|
17
19
|
function _requireYamlSync() {
|
|
20
|
+
if (_yamlMod) return _yamlMod;
|
|
18
21
|
try {
|
|
19
|
-
const
|
|
20
|
-
|
|
22
|
+
const req = typeof require !== "undefined" ? require : createRequire(import.meta.url);
|
|
23
|
+
const m = req("yaml");
|
|
24
|
+
_yamlMod = { parse: m.parse, stringify: m.stringify };
|
|
25
|
+
return _yamlMod;
|
|
21
26
|
} catch {
|
|
22
27
|
throw new Error(
|
|
23
28
|
`[qarpeo] CMS frontmatter parsing requires the \`yaml\` package.
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
cmsCollectionTbl,
|
|
8
8
|
cmsEntryTbl
|
|
9
9
|
} from "./common.mjs";
|
|
10
|
+
import { getCMSEntry } from "./queries.mjs";
|
|
10
11
|
const userTbl = (e) => resolveTableName("user", e);
|
|
11
12
|
export function isReferenceValue(v) {
|
|
12
13
|
return !!v && typeof v === "object" && !Array.isArray(v) && typeof v.collectionId === "string" && typeof v.slug === "string";
|
|
@@ -86,7 +87,6 @@ async function resolveReferenceInput(event, input, defaultTargetCollectionId, fi
|
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
89
|
if (filter && Object.keys(filter).length > 0) {
|
|
89
|
-
const { getCMSEntry } = await import("./queries.mjs");
|
|
90
90
|
const fullEntry = await getCMSEntry(event, collectionId, resolved.id, { preview: true });
|
|
91
91
|
if (fullEntry) {
|
|
92
92
|
for (const [key, expected] of Object.entries(filter)) {
|
|
@@ -210,7 +210,6 @@ export async function resolveReference(event, ref) {
|
|
|
210
210
|
if (!collectionId) return null;
|
|
211
211
|
const slugOrId = ref.id || ref.slug;
|
|
212
212
|
if (!slugOrId) return null;
|
|
213
|
-
const { getCMSEntry } = await import("./queries.mjs");
|
|
214
213
|
return getCMSEntry(event, collectionId, slugOrId);
|
|
215
214
|
}
|
|
216
215
|
export async function populateReferenceFields(event, entry, populate) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createError } from "nuxt/server";
|
|
2
2
|
import { getCMSDb, getCMSTenantId, cmsEntryTbl, cmsRevisionTbl } from "./common.mjs";
|
|
3
|
+
import { updateCMSEntry } from "./mutations.mjs";
|
|
3
4
|
export async function pruneRevisions(event, entryId, max) {
|
|
4
5
|
const db = getCMSDb(event);
|
|
5
6
|
await db.prepare(
|
|
@@ -51,7 +52,6 @@ export async function restoreCMSRevision(event, entryId, revisionId) {
|
|
|
51
52
|
delete meta._ast;
|
|
52
53
|
delete meta._toc;
|
|
53
54
|
delete meta._nav;
|
|
54
|
-
const { updateCMSEntry } = await import("./mutations.mjs");
|
|
55
55
|
return await updateCMSEntry(event, entryId, {
|
|
56
56
|
title: rev.title,
|
|
57
57
|
contentMd: rev.content_md,
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
async function _requireYaml() {
|
|
2
|
+
try {
|
|
3
|
+
return await import("yaml");
|
|
4
|
+
} catch {
|
|
5
|
+
throw new Error(
|
|
6
|
+
`[qarpeo] CMS sync requires the \`yaml\` package.
|
|
7
|
+
Install it with: pnpm add yaml`
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
2
11
|
import { getKVBinding } from "../../../kv.mjs";
|
|
3
12
|
import { resolveIndexName } from "../table-names.mjs";
|
|
4
13
|
import {
|
|
@@ -430,7 +439,7 @@ export async function syncLocalContentFiles(event, contentDir, collectionsConfig
|
|
|
430
439
|
if (existsSync(navYmlPath)) {
|
|
431
440
|
try {
|
|
432
441
|
const raw = await readFile(navYmlPath);
|
|
433
|
-
return
|
|
442
|
+
return (await _requireYaml()).parse(raw) || {};
|
|
434
443
|
} catch {
|
|
435
444
|
}
|
|
436
445
|
}
|
|
@@ -778,7 +787,7 @@ export async function syncLocalContentFiles(event, contentDir, collectionsConfig
|
|
|
778
787
|
}
|
|
779
788
|
} else {
|
|
780
789
|
try {
|
|
781
|
-
parsed =
|
|
790
|
+
parsed = (await _requireYaml()).parse(rawContent) || {};
|
|
782
791
|
} catch {
|
|
783
792
|
}
|
|
784
793
|
}
|