qarpeo 0.1.5 → 0.1.6
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/module.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import 'drizzle-orm/node-sqlite';
|
|
|
19
19
|
import 'node:process';
|
|
20
20
|
import 'node:readline/promises';
|
|
21
21
|
|
|
22
|
-
const version = "0.1.
|
|
22
|
+
const version = "0.1.6";
|
|
23
23
|
|
|
24
24
|
function ensureDevEnv(rootDir) {
|
|
25
25
|
const envPath = join(rootDir, ".env");
|
|
@@ -261,7 +261,7 @@ async function discoverSources(contentDir) {
|
|
|
261
261
|
return results;
|
|
262
262
|
}
|
|
263
263
|
async function resolveAllCmsSources(options) {
|
|
264
|
-
const { contentDir, rootDir, cacheDir, configSources = [] } = options;
|
|
264
|
+
const { contentDir, rootDir, cacheDir, configSources = [], cacheOnly = false } = options;
|
|
265
265
|
const discovered = await discoverSources(contentDir);
|
|
266
266
|
const resolvedList = [];
|
|
267
267
|
for (const item of discovered) {
|
|
@@ -282,17 +282,19 @@ async function resolveAllCmsSources(options) {
|
|
|
282
282
|
if (cached.length > 0) {
|
|
283
283
|
resolvedDir = targetDir;
|
|
284
284
|
} else {
|
|
285
|
-
rmSync(targetDir, { recursive: true, force: true });
|
|
285
|
+
if (!cacheOnly) rmSync(targetDir, { recursive: true, force: true });
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
if (!resolvedDir) {
|
|
288
|
+
if (!resolvedDir && !cacheOnly) {
|
|
289
289
|
await downloadTemplate(src.from, { dir: targetDir, auth: _auth });
|
|
290
290
|
resolvedDir = targetDir;
|
|
291
291
|
}
|
|
292
292
|
} catch (err) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
293
|
+
if (!cacheOnly) {
|
|
294
|
+
console.warn(
|
|
295
|
+
`[qarpeo:cms] Failed to download remote source "${src.from}": ${err?.message ?? String(err)}`
|
|
296
|
+
);
|
|
297
|
+
}
|
|
296
298
|
if (existsSync(targetDir)) resolvedDir = targetDir;
|
|
297
299
|
}
|
|
298
300
|
} else {
|
|
@@ -330,17 +332,19 @@ async function resolveAllCmsSources(options) {
|
|
|
330
332
|
if (cached.length > 0) {
|
|
331
333
|
resolvedDir = targetDir;
|
|
332
334
|
} else {
|
|
333
|
-
rmSync(targetDir, { recursive: true, force: true });
|
|
335
|
+
if (!cacheOnly) rmSync(targetDir, { recursive: true, force: true });
|
|
334
336
|
}
|
|
335
337
|
}
|
|
336
|
-
if (!resolvedDir) {
|
|
338
|
+
if (!resolvedDir && !cacheOnly) {
|
|
337
339
|
await downloadTemplate(src.from, { dir: targetDir, auth: _auth2 });
|
|
338
340
|
resolvedDir = targetDir;
|
|
339
341
|
}
|
|
340
342
|
} catch (err) {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
343
|
+
if (!cacheOnly) {
|
|
344
|
+
console.warn(
|
|
345
|
+
`[qarpeo:cms] Failed to download remote source "${src.from}": ${err?.message ?? String(err)}`
|
|
346
|
+
);
|
|
347
|
+
}
|
|
344
348
|
if (existsSync(targetDir)) resolvedDir = targetDir;
|
|
345
349
|
}
|
|
346
350
|
} else {
|
|
@@ -427,9 +431,19 @@ async function readNavJson(dir) {
|
|
|
427
431
|
return {};
|
|
428
432
|
}
|
|
429
433
|
async function scanContentEntries(options) {
|
|
430
|
-
const { contentDir, collectionsConfig = {}, sources = [], exclude } = options;
|
|
434
|
+
const { contentDir, collectionsConfig = {}, sources = [], exclude, shiki } = options;
|
|
431
435
|
const entries = [];
|
|
432
436
|
const now = Date.now();
|
|
437
|
+
let shikiPluginInstance = null;
|
|
438
|
+
if (shiki !== false) {
|
|
439
|
+
try {
|
|
440
|
+
const shikiMod = await import('comark/plugins/shiki');
|
|
441
|
+
const shikiPlugin = shikiMod.default || shikiMod;
|
|
442
|
+
const shikiOptions = typeof shiki === "object" ? shiki : {};
|
|
443
|
+
shikiPluginInstance = shikiPlugin(shikiOptions);
|
|
444
|
+
} catch {
|
|
445
|
+
}
|
|
446
|
+
}
|
|
433
447
|
async function syncSource(source) {
|
|
434
448
|
if (!source?.resolvedDir || !existsSync(source.resolvedDir)) return;
|
|
435
449
|
let orderCounter = 0;
|
|
@@ -515,7 +529,8 @@ async function scanContentEntries(options) {
|
|
|
515
529
|
let ast = { nodes: [], frontmatter: {}, meta: {} };
|
|
516
530
|
let contentHtml = "";
|
|
517
531
|
try {
|
|
518
|
-
|
|
532
|
+
const plugins = shikiPluginInstance ? [shikiPluginInstance] : [];
|
|
533
|
+
ast = await parseMarkdown(body, { plugins });
|
|
519
534
|
contentHtml = (await render(ast, { format: "text/html" })).trim();
|
|
520
535
|
} catch {
|
|
521
536
|
contentHtml = body;
|
|
@@ -3306,7 +3321,8 @@ export default queueHandler;
|
|
|
3306
3321
|
contentDir: resolvedContentDir,
|
|
3307
3322
|
rootDir: nuxt.options.rootDir,
|
|
3308
3323
|
cacheDir,
|
|
3309
|
-
configSources: cmsConfig.sources
|
|
3324
|
+
configSources: cmsConfig.sources,
|
|
3325
|
+
cacheOnly: true
|
|
3310
3326
|
});
|
|
3311
3327
|
} catch (err) {
|
|
3312
3328
|
console.warn("[qarpeo:cms] Error resolving CMS sources:", err);
|
|
@@ -3370,16 +3386,36 @@ export default queueHandler;
|
|
|
3370
3386
|
])
|
|
3371
3387
|
)
|
|
3372
3388
|
};
|
|
3389
|
+
nuxt.hook("build:before", async () => {
|
|
3390
|
+
try {
|
|
3391
|
+
const freshSources = await resolveAllCmsSources({
|
|
3392
|
+
contentDir: resolvedContentDir,
|
|
3393
|
+
rootDir: nuxt.options.rootDir,
|
|
3394
|
+
cacheDir,
|
|
3395
|
+
configSources: cmsConfig.sources
|
|
3396
|
+
});
|
|
3397
|
+
resolvedSources.length = 0;
|
|
3398
|
+
resolvedSources.push(...freshSources);
|
|
3399
|
+
if (nuxt.options.runtimeConfig.qarpeo?.cms) {
|
|
3400
|
+
;
|
|
3401
|
+
nuxt.options.runtimeConfig.qarpeo.cms.sources = freshSources;
|
|
3402
|
+
}
|
|
3403
|
+
} catch (err) {
|
|
3404
|
+
console.warn("[qarpeo:cms] Error resolving CMS sources in build:before:", err);
|
|
3405
|
+
}
|
|
3406
|
+
});
|
|
3373
3407
|
const cmsManifestTemplate = addTemplate({
|
|
3374
3408
|
filename: "qarpeo/cms-manifest.mjs",
|
|
3375
3409
|
write: true,
|
|
3376
3410
|
async getContents() {
|
|
3377
3411
|
try {
|
|
3412
|
+
const shikiOpt = cmsConfig.shiki !== void 0 ? cmsConfig.shiki : cmsConfig.plugins?.shiki;
|
|
3378
3413
|
const entries = await scanContentEntries({
|
|
3379
3414
|
contentDir: resolvedContentDir,
|
|
3380
3415
|
collectionsConfig: cmsConfig.collections,
|
|
3381
3416
|
sources: resolvedSources,
|
|
3382
|
-
exclude: cmsConfig.exclude
|
|
3417
|
+
exclude: cmsConfig.exclude,
|
|
3418
|
+
shiki: shikiOpt !== false ? typeof shikiOpt === "object" ? shikiOpt : true : false
|
|
3383
3419
|
});
|
|
3384
3420
|
const payload = JSON.stringify({
|
|
3385
3421
|
entries,
|
|
@@ -3407,11 +3443,13 @@ export const manifestCollections = ${JSON.stringify(cmsConfig.collections || {})
|
|
|
3407
3443
|
const prerenderPatterns = Object.entries(routeRules).filter(([_, rule]) => rule?.prerender === true).map(([pattern]) => pattern);
|
|
3408
3444
|
if (prerenderPatterns.length > 0) {
|
|
3409
3445
|
try {
|
|
3446
|
+
const shikiOpt = cmsConfig.shiki !== void 0 ? cmsConfig.shiki : cmsConfig.plugins?.shiki;
|
|
3410
3447
|
const entries = await scanContentEntries({
|
|
3411
3448
|
contentDir: resolvedContentDir,
|
|
3412
3449
|
collectionsConfig: cmsConfig.collections,
|
|
3413
3450
|
sources: resolvedSources,
|
|
3414
|
-
exclude: cmsConfig.exclude
|
|
3451
|
+
exclude: cmsConfig.exclude,
|
|
3452
|
+
shiki: shikiOpt !== false ? typeof shikiOpt === "object" ? shikiOpt : true : false
|
|
3415
3453
|
});
|
|
3416
3454
|
const matchingRoutes = entries.map((e) => e.path).filter((p) => Boolean(p) && matchPathPatterns(p, prerenderPatterns));
|
|
3417
3455
|
if (matchingRoutes.length > 0) {
|
|
@@ -12,12 +12,14 @@ const props = withDefaults(
|
|
|
12
12
|
size?: "xs" | "sm" | "md"
|
|
13
13
|
color?: "primary" | "neutral" | "secondary"
|
|
14
14
|
class?: string
|
|
15
|
+
repo?: string
|
|
15
16
|
}>(),
|
|
16
17
|
{
|
|
17
18
|
variant: "dropdown",
|
|
18
19
|
size: "xs",
|
|
19
20
|
color: "primary",
|
|
20
21
|
class: "",
|
|
22
|
+
repo: "qarpeo/qarpeo",
|
|
21
23
|
},
|
|
22
24
|
)
|
|
23
25
|
|
|
@@ -29,6 +31,15 @@ const currentLabel = computed(() => {
|
|
|
29
31
|
return currentVersion.value === "latest" ? "latest" : currentVersion.value
|
|
30
32
|
})
|
|
31
33
|
|
|
34
|
+
const releaseNotesUrl = computed(() => {
|
|
35
|
+
const raw = currentVersion.value === "latest" ? currentLabel.value : currentVersion.value
|
|
36
|
+
const clean = (raw || "").replace(/^v/, "").trim()
|
|
37
|
+
if (clean && /^\d+\.\d+/.test(clean)) {
|
|
38
|
+
return `https://github.com/${props.repo}/releases/tag/v${clean}`
|
|
39
|
+
}
|
|
40
|
+
return `https://github.com/${props.repo}/releases`
|
|
41
|
+
})
|
|
42
|
+
|
|
32
43
|
const dropdownItems = computed(() => [
|
|
33
44
|
(versions.value || []).map((v) => ({
|
|
34
45
|
label: v.label,
|
|
@@ -113,14 +124,17 @@ const selectItems = computed(() =>
|
|
|
113
124
|
</UDropdownMenu>
|
|
114
125
|
</template>
|
|
115
126
|
|
|
116
|
-
<!-- Single version or loading fallback:
|
|
117
|
-
<
|
|
127
|
+
<!-- Single version or loading fallback: interactive Nuxt UI UButton linking to release notes -->
|
|
128
|
+
<UButton
|
|
118
129
|
v-else
|
|
119
|
-
:
|
|
130
|
+
:label="currentLabel"
|
|
131
|
+
:aria-label="`Open ${currentLabel} release notes on GitHub`"
|
|
120
132
|
variant="subtle"
|
|
121
133
|
:size="size"
|
|
122
|
-
|
|
134
|
+
:color="color"
|
|
135
|
+
:to="releaseNotesUrl"
|
|
136
|
+
target="_blank"
|
|
137
|
+
class="font-semibold text-xs cursor-pointer hover:bg-primary/10 active:bg-primary/10 transition-colors"
|
|
123
138
|
:class="props.class"
|
|
124
|
-
:label="currentLabel"
|
|
125
139
|
/>
|
|
126
140
|
</template>
|
|
@@ -3118,27 +3118,54 @@ export async function getCMSNavigationTree(event, collectionId, options) {
|
|
|
3118
3118
|
section.title = sectionMeta.title;
|
|
3119
3119
|
if (sectionMeta.icon) section.icon = sectionMeta.icon;
|
|
3120
3120
|
}
|
|
3121
|
-
const
|
|
3121
|
+
const isFeatureSection = segments[0] === "docs" && segments[1] === "features";
|
|
3122
|
+
const subFeatureKey = isFeatureSection && segments.length >= 3 ? segments[2] : null;
|
|
3123
|
+
const isSubFeature = Boolean(
|
|
3124
|
+
subFeatureKey && (segments.length >= 4 || segments.length === 3 && meta._isIndex && meta._nav?.title && meta._nav.title !== "Features")
|
|
3125
|
+
);
|
|
3122
3126
|
let targetParent = section;
|
|
3123
|
-
if (isSubFeature) {
|
|
3124
|
-
const subFeaturePath = `/${segments[0]}/${segments[1]}/${
|
|
3125
|
-
let subFeatureNode = section.children?.find(
|
|
3127
|
+
if (isSubFeature && subFeatureKey) {
|
|
3128
|
+
const subFeaturePath = `/${segments[0]}/${segments[1]}/${subFeatureKey}`;
|
|
3129
|
+
let subFeatureNode = section.children?.find(
|
|
3130
|
+
(c) => c._subFeatureKey === subFeatureKey || c.path === subFeaturePath
|
|
3131
|
+
);
|
|
3126
3132
|
if (!subFeatureNode) {
|
|
3127
|
-
const subFeatureTitle =
|
|
3133
|
+
const subFeatureTitle = meta._nav?.title || subFeatureKey.charAt(0).toUpperCase() + subFeatureKey.slice(1).replace(/-/g, " ");
|
|
3134
|
+
const subFeatureOrder = typeof meta._nav?.order === "number" ? meta._nav.order : meta._sectionOrder ?? 500;
|
|
3128
3135
|
const newNode = {
|
|
3129
3136
|
title: subFeatureTitle,
|
|
3130
3137
|
path: subFeaturePath,
|
|
3138
|
+
icon: meta._nav?.icon || "i-lucide-layers",
|
|
3131
3139
|
children: []
|
|
3132
3140
|
};
|
|
3133
|
-
newNode.
|
|
3141
|
+
newNode._subFeatureKey = subFeatureKey;
|
|
3142
|
+
newNode._groupOrder = subFeatureOrder;
|
|
3134
3143
|
section.children = section.children || [];
|
|
3135
3144
|
section.children.push(newNode);
|
|
3136
3145
|
subFeatureNode = newNode;
|
|
3146
|
+
} else {
|
|
3147
|
+
if (meta._nav?.title && subFeatureNode.title !== meta._nav.title) {
|
|
3148
|
+
subFeatureNode.title = meta._nav.title;
|
|
3149
|
+
}
|
|
3150
|
+
if (meta._nav?.icon) {
|
|
3151
|
+
subFeatureNode.icon = meta._nav.icon;
|
|
3152
|
+
}
|
|
3153
|
+
if (typeof meta._nav?.order === "number") {
|
|
3154
|
+
;
|
|
3155
|
+
subFeatureNode._groupOrder = meta._nav.order;
|
|
3156
|
+
}
|
|
3137
3157
|
}
|
|
3138
3158
|
if (!subFeatureNode.children) {
|
|
3139
3159
|
subFeatureNode.children = [];
|
|
3140
3160
|
}
|
|
3141
3161
|
targetParent = subFeatureNode;
|
|
3162
|
+
targetParent.children.push({
|
|
3163
|
+
title: itemTitle,
|
|
3164
|
+
path: entryPath,
|
|
3165
|
+
icon: meta.navigation?.icon || meta._nav?.icon,
|
|
3166
|
+
_groupOrder: meta._isIndex ? 0 : 500
|
|
3167
|
+
});
|
|
3168
|
+
continue;
|
|
3142
3169
|
}
|
|
3143
3170
|
if (meta._group) {
|
|
3144
3171
|
const groupKey = meta._group.key;
|
|
@@ -3235,6 +3262,7 @@ export async function getCMSNavigationTree(event, collectionId, options) {
|
|
|
3235
3262
|
delete c._groupKey;
|
|
3236
3263
|
delete c._groupOrder;
|
|
3237
3264
|
delete c._subGroupKey;
|
|
3265
|
+
delete c._subFeatureKey;
|
|
3238
3266
|
cleanAndSortNode(c);
|
|
3239
3267
|
}
|
|
3240
3268
|
}
|
package/dist/utils/cms-scan.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface ScanContentOptions {
|
|
|
25
25
|
collectionsConfig?: Record<string, CMSCollectionConfig>;
|
|
26
26
|
sources?: any[];
|
|
27
27
|
exclude?: string | string[];
|
|
28
|
+
shiki?: boolean | any;
|
|
28
29
|
}
|
|
29
30
|
export declare function extractTOC(md: string): any[];
|
|
30
31
|
export declare function parseFrontmatter(raw: string): {
|
|
@@ -52,11 +52,16 @@ export declare function discoverSources(contentDir: string): Promise<Array<{
|
|
|
52
52
|
/**
|
|
53
53
|
* Resolves all discovered and config-declared sources into absolute disk paths and normalized
|
|
54
54
|
* prefixes. Downloads remote sources via giget tarball into the cache directory.
|
|
55
|
+
*
|
|
56
|
+
* @param options.cacheOnly When true, skips remote downloads and only uses already-cached dirs.
|
|
57
|
+
* Use this in Nuxt module `setup()` to avoid blocking startup — then call again (without
|
|
58
|
+
* cacheOnly) in a `build:before` hook to fetch any missing remote sources.
|
|
55
59
|
*/
|
|
56
60
|
export declare function resolveAllCmsSources(options: {
|
|
57
61
|
contentDir: string;
|
|
58
62
|
rootDir: string;
|
|
59
63
|
cacheDir: string;
|
|
60
64
|
configSources?: CMSSourceConfig[];
|
|
65
|
+
cacheOnly?: boolean;
|
|
61
66
|
}): Promise<CMSResolvedSource[]>;
|
|
62
67
|
export { matchesSourceFilters, matchesGlobFilter } from "../runtime/server/utils/cms-filter";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qarpeo",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Zero-config Cloudflare Edge Platform for Nuxt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analytics-engine",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@comark/nuxt": "^0.8.1",
|
|
57
57
|
"@comark/vue": "^0.8.1",
|
|
58
58
|
"@nuxt/devtools-kit": "^4.1.0",
|
|
59
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@^5.0.0-
|
|
59
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@^5.0.0-2611052317-a04317f",
|
|
60
60
|
"@simplewebauthn/browser": "14.0.0",
|
|
61
61
|
"@simplewebauthn/server": "14.0.3",
|
|
62
62
|
"citty": "^0.2.2",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@typescript/typescript6": "^6.0.2",
|
|
82
82
|
"h3": "^2.0.8",
|
|
83
83
|
"nitro": "3.0.261103-rc",
|
|
84
|
-
"nuxt": "npm:nuxt-nightly@^5.0.0-
|
|
84
|
+
"nuxt": "npm:nuxt-nightly@^5.0.0-2611052317-a04317f",
|
|
85
85
|
"typescript": "^7.0.2",
|
|
86
86
|
"unbuild": "^3.6.1",
|
|
87
87
|
"vite-plus": "1.5.0",
|