blume 0.5.0 → 0.5.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/cli/index.js +160 -182
- package/dist/cli/index.js.map +17 -16
- package/dist/types/core/schema.d.ts +0 -26
- package/dist/types/core/types.d.ts +0 -6
- package/dist/types/migrate/mintlify/config.d.ts +14 -0
- package/docs/01-quickstart.mdx +6 -2
- package/docs/02-deployment.mdx +3 -1
- package/docs/advanced/api-reference.mdx +6 -2
- package/docs/advanced/bridge.mdx +3 -1
- package/docs/advanced/custom-pages.mdx +3 -1
- package/docs/advanced/migrate.mdx +6 -2
- package/docs/configuration/ai.mdx +3 -1
- package/docs/configuration/analytics.mdx +3 -1
- package/docs/configuration/export.mdx +6 -2
- package/docs/configuration/seo.mdx +3 -1
- package/docs/content/i18n.mdx +6 -2
- package/docs/content/islands.mdx +6 -2
- package/docs/content/meta.mdx +3 -1
- package/docs/content/syntax.mdx +40 -14
- package/package.json +1 -1
- package/src/astro/generate.ts +11 -2
- package/src/astro/templates.ts +34 -8
- package/src/cli/commands/init.ts +2 -27
- package/src/core/graph.ts +0 -3
- package/src/core/nav-diagnostics.ts +2 -12
- package/src/core/navigation.ts +0 -10
- package/src/core/package-json.ts +32 -0
- package/src/core/schema.ts +0 -8
- package/src/core/sources/mintlify.ts +44 -1
- package/src/core/types.ts +0 -7
- package/src/migrate/mintlify/config.ts +40 -99
- package/src/migrate/mintlify/content.ts +16 -0
- package/src/migrate/mintlify/index.ts +42 -1
- package/src/migrate/mintlify/transform.ts +2 -0
- package/src/migrate/shared.ts +24 -1
package/dist/cli/index.js
CHANGED
|
@@ -2917,7 +2917,7 @@ import {
|
|
|
2917
2917
|
} from "node:fs/promises";
|
|
2918
2918
|
import { createRequire as createRequire5 } from "node:module";
|
|
2919
2919
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
2920
|
-
import { basename as basename2, dirname as dirname7, join as join17, normalize as normalize3, relative as
|
|
2920
|
+
import { basename as basename2, dirname as dirname7, join as join17, normalize as normalize3, relative as relative7 } from "pathe";
|
|
2921
2921
|
import { glob as glob4 } from "tinyglobby";
|
|
2922
2922
|
|
|
2923
2923
|
// src/ai/ask-data.ts
|
|
@@ -3616,10 +3616,7 @@ var collectIcons = (navigation) => {
|
|
|
3616
3616
|
push(item.icon, `selector "${item.label}"`);
|
|
3617
3617
|
}
|
|
3618
3618
|
}
|
|
3619
|
-
const sidebars = [
|
|
3620
|
-
navigation.sidebar,
|
|
3621
|
-
...navigation.sidebarVariants.map((variant) => variant.sidebar)
|
|
3622
|
-
];
|
|
3619
|
+
const sidebars = [navigation.sidebar];
|
|
3623
3620
|
for (const sidebar of sidebars) {
|
|
3624
3621
|
for (const node of flattenNodes(sidebar)) {
|
|
3625
3622
|
push(node.icon, `"${node.label}"`);
|
|
@@ -3692,11 +3689,7 @@ var duplicateLabelDiagnostics = (navigation) => {
|
|
|
3692
3689
|
}
|
|
3693
3690
|
};
|
|
3694
3691
|
const sidebars = [
|
|
3695
|
-
{ nodes: navigation.sidebar, where: "at the top level" }
|
|
3696
|
-
...navigation.sidebarVariants.map((variant) => ({
|
|
3697
|
-
nodes: variant.sidebar,
|
|
3698
|
-
where: `in the "${variant.path}" section`
|
|
3699
|
-
}))
|
|
3692
|
+
{ nodes: navigation.sidebar, where: "at the top level" }
|
|
3700
3693
|
];
|
|
3701
3694
|
for (const { nodes, where } of sidebars) {
|
|
3702
3695
|
checkLevel(nodes, where);
|
|
@@ -3708,10 +3701,7 @@ var hiddenInSidebarDiagnostics = (navigation, pages) => {
|
|
|
3708
3701
|
if (hidden.size === 0) {
|
|
3709
3702
|
return [];
|
|
3710
3703
|
}
|
|
3711
|
-
const sidebars = [
|
|
3712
|
-
navigation.sidebar,
|
|
3713
|
-
...navigation.sidebarVariants.map((variant) => variant.sidebar)
|
|
3714
|
-
];
|
|
3704
|
+
const sidebars = [navigation.sidebar];
|
|
3715
3705
|
const diagnostics = [];
|
|
3716
3706
|
const seen = new Set;
|
|
3717
3707
|
for (const sidebar of sidebars) {
|
|
@@ -4029,11 +4019,11 @@ var hasScalarReferences = (config) => resolveReferences(config).some((ref) => re
|
|
|
4029
4019
|
|
|
4030
4020
|
// src/openapi/scalar.ts
|
|
4031
4021
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
4032
|
-
import { isAbsolute as
|
|
4022
|
+
import { isAbsolute as isAbsolute5, join as join12 } from "pathe";
|
|
4033
4023
|
|
|
4034
4024
|
// src/astro/templates.ts
|
|
4035
4025
|
import { existsSync as existsSync8, readFileSync as readFileSync4 } from "node:fs";
|
|
4036
|
-
import { dirname as dirname6, join as join11 } from "pathe";
|
|
4026
|
+
import { dirname as dirname6, isAbsolute as isAbsolute4, join as join11, relative as relative4 } from "pathe";
|
|
4037
4027
|
|
|
4038
4028
|
// src/core/assets.ts
|
|
4039
4029
|
import { join as join10 } from "pathe";
|
|
@@ -4406,10 +4396,15 @@ var stagedContentDir = (outDir) => join11(outDir, "content");
|
|
|
4406
4396
|
var contentConfigTemplate = (options) => {
|
|
4407
4397
|
const { context, config } = options;
|
|
4408
4398
|
const stagedBase = options.stagedBase ?? stagedContentDir(context.outDir);
|
|
4409
|
-
const
|
|
4399
|
+
const outDirRel = relative4(context.contentRoot, context.outDir);
|
|
4400
|
+
const outDirIgnore = outDirRel && !outDirRel.startsWith("..") && !isAbsolute4(outDirRel) ? [`!${outDirRel}/**`] : [];
|
|
4401
|
+
const filesystem = options.filesystem ?? true;
|
|
4402
|
+
const docsPattern = filesystem ? [
|
|
4410
4403
|
...config.content.include,
|
|
4411
|
-
...(config.content.exclude ?? []).map((pattern) => `!${pattern}`)
|
|
4412
|
-
|
|
4404
|
+
...(config.content.exclude ?? []).map((pattern) => `!${pattern}`),
|
|
4405
|
+
"!**/node_modules/**",
|
|
4406
|
+
...outDirIgnore
|
|
4407
|
+
] : [];
|
|
4413
4408
|
const stagedBlock = options.staged ? `
|
|
4414
4409
|
const staged = defineCollection({
|
|
4415
4410
|
loader: glob({
|
|
@@ -5414,7 +5409,7 @@ var specConfiguration = async (spec, root) => {
|
|
|
5414
5409
|
if (URL_SPEC.test(spec)) {
|
|
5415
5410
|
return { config: { url: spec } };
|
|
5416
5411
|
}
|
|
5417
|
-
const absolute =
|
|
5412
|
+
const absolute = isAbsolute5(spec) ? spec : join12(root, spec);
|
|
5418
5413
|
try {
|
|
5419
5414
|
return { config: { content: await readFile5(absolute, "utf-8") } };
|
|
5420
5415
|
} catch {
|
|
@@ -5617,7 +5612,7 @@ var extractOperations = (document, baseRoute) => {
|
|
|
5617
5612
|
// src/openapi/parse.ts
|
|
5618
5613
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
5619
5614
|
import { normalize as normalize2, upgrade } from "@scalar/openapi-parser";
|
|
5620
|
-
import { isAbsolute as
|
|
5615
|
+
import { isAbsolute as isAbsolute6, join as join14 } from "pathe";
|
|
5621
5616
|
var URL_SPEC2 = /^https?:\/\//u;
|
|
5622
5617
|
var readSpecText = async (spec, root) => {
|
|
5623
5618
|
if (URL_SPEC2.test(spec)) {
|
|
@@ -5627,7 +5622,7 @@ var readSpecText = async (spec, root) => {
|
|
|
5627
5622
|
}
|
|
5628
5623
|
return await response.text();
|
|
5629
5624
|
}
|
|
5630
|
-
const absolute =
|
|
5625
|
+
const absolute = isAbsolute6(spec) ? spec : join14(root, spec);
|
|
5631
5626
|
return await readFile7(absolute, "utf-8");
|
|
5632
5627
|
};
|
|
5633
5628
|
var parseSpec = async (spec, root) => {
|
|
@@ -6533,7 +6528,7 @@ export const layoutOverrides = { ...(overrides.layout ?? {})${layoutEntries.leng
|
|
|
6533
6528
|
|
|
6534
6529
|
// src/astro/examples.ts
|
|
6535
6530
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
6536
|
-
import { join as join16, relative as
|
|
6531
|
+
import { join as join16, relative as relative5 } from "pathe";
|
|
6537
6532
|
import { glob as glob2 } from "tinyglobby";
|
|
6538
6533
|
|
|
6539
6534
|
// src/astro/islands.ts
|
|
@@ -6647,7 +6642,7 @@ var discoverExamples = async (root, pattern = "examples") => {
|
|
|
6647
6642
|
if (!(ext && framework)) {
|
|
6648
6643
|
continue;
|
|
6649
6644
|
}
|
|
6650
|
-
const path =
|
|
6645
|
+
const path = relative5(dir, file).slice(0, -(ext.length + 1));
|
|
6651
6646
|
const existing = seen.get(path);
|
|
6652
6647
|
if (existing) {
|
|
6653
6648
|
warnings.push(`Two examples both resolve to "${path}" ("${existing}" and "${file}"); ignoring the second. Give them distinct paths.`);
|
|
@@ -6668,7 +6663,7 @@ var discoverExamples = async (root, pattern = "examples") => {
|
|
|
6668
6663
|
};
|
|
6669
6664
|
|
|
6670
6665
|
// src/astro/pages.ts
|
|
6671
|
-
import { extname as extname2, relative as
|
|
6666
|
+
import { extname as extname2, relative as relative6 } from "pathe";
|
|
6672
6667
|
import { glob as glob3 } from "tinyglobby";
|
|
6673
6668
|
var discoverPages = async (pagesRoot) => {
|
|
6674
6669
|
const files = await glob3(["**/*.astro"], {
|
|
@@ -6678,7 +6673,7 @@ var discoverPages = async (pagesRoot) => {
|
|
|
6678
6673
|
});
|
|
6679
6674
|
files.sort();
|
|
6680
6675
|
return files.map((file) => {
|
|
6681
|
-
const rel =
|
|
6676
|
+
const rel = relative6(pagesRoot, file);
|
|
6682
6677
|
const withoutExt = rel.slice(0, rel.length - extname2(rel).length);
|
|
6683
6678
|
const parts = withoutExt.split("/");
|
|
6684
6679
|
if (parts.at(-1) === "index") {
|
|
@@ -6952,7 +6947,7 @@ var buildRuntimeData = (project) => {
|
|
|
6952
6947
|
if (!(editBase && sourcePath)) {
|
|
6953
6948
|
return null;
|
|
6954
6949
|
}
|
|
6955
|
-
const rel =
|
|
6950
|
+
const rel = relative7(context.root, sourcePath).split("\\").join("/");
|
|
6956
6951
|
return `${editBase}/${github?.dir ? `${github.dir}/${rel}` : rel}`;
|
|
6957
6952
|
};
|
|
6958
6953
|
const { i18n } = config;
|
|
@@ -6978,7 +6973,6 @@ var buildRuntimeData = (project) => {
|
|
|
6978
6973
|
chromeVariants: [],
|
|
6979
6974
|
selectors: [],
|
|
6980
6975
|
sidebar: [],
|
|
6981
|
-
sidebarVariants: [],
|
|
6982
6976
|
tabs: []
|
|
6983
6977
|
})
|
|
6984
6978
|
])) : {};
|
|
@@ -7177,6 +7171,7 @@ var generateRuntime = async (project) => {
|
|
|
7177
7171
|
pages.push(...mcp.discoveryPages);
|
|
7178
7172
|
const staged = collectStaged(project);
|
|
7179
7173
|
const hasStaged = staged.size > 0;
|
|
7174
|
+
const hasFilesystemSource = project.sources.some((source) => !source.staged);
|
|
7180
7175
|
const structural = await Promise.all([
|
|
7181
7176
|
write(join17(out, "astro.config.mjs"), astroConfigTemplate({
|
|
7182
7177
|
aliases: resolveTsconfigAliases(context.root),
|
|
@@ -7196,7 +7191,12 @@ var generateRuntime = async (project) => {
|
|
|
7196
7191
|
write(join17(out, "package.json"), runtimePackageTemplate(runtimeDependencies({ config, needsReact, needsSvelte, needsVue }))),
|
|
7197
7192
|
write(join17(out, "tsconfig.json"), runtimeTsconfigTemplate()),
|
|
7198
7193
|
write(join17(srcDir, "env.d.ts"), envTemplate()),
|
|
7199
|
-
write(join17(srcDir, "content.config.ts"), contentConfigTemplate({
|
|
7194
|
+
write(join17(srcDir, "content.config.ts"), contentConfigTemplate({
|
|
7195
|
+
config,
|
|
7196
|
+
context,
|
|
7197
|
+
filesystem: hasFilesystemSource,
|
|
7198
|
+
staged: hasStaged
|
|
7199
|
+
})),
|
|
7200
7200
|
write(join17(srcDir, "pages", "[...slug].astro"), catchAllPageTemplate({
|
|
7201
7201
|
askEnabled,
|
|
7202
7202
|
exportEpub,
|
|
@@ -7350,7 +7350,7 @@ var assetSegments = (config) => {
|
|
|
7350
7350
|
|
|
7351
7351
|
// src/migrate/mintlify/config.ts
|
|
7352
7352
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
7353
|
-
import { dirname as dirname8, relative as
|
|
7353
|
+
import { dirname as dirname8, relative as relative8, resolve as resolve5 } from "pathe";
|
|
7354
7354
|
var MINTLIFY_DEFAULT_IGNORES = [
|
|
7355
7355
|
"**/_*",
|
|
7356
7356
|
"**/.*",
|
|
@@ -7386,7 +7386,7 @@ var asDirectoryMode = (value) => value === "accordion" || value === "card" || va
|
|
|
7386
7386
|
var withoutUndefined = (value) => Object.fromEntries(Object.entries(value).filter(([, item]) => item !== undefined));
|
|
7387
7387
|
var hasOwn = (object, key) => Object.hasOwn(object, key);
|
|
7388
7388
|
var isInsideRoot = (root, candidate) => {
|
|
7389
|
-
const rel =
|
|
7389
|
+
const rel = relative8(root, candidate);
|
|
7390
7390
|
return rel === "" || !rel.startsWith("..") && !rel.startsWith("/");
|
|
7391
7391
|
};
|
|
7392
7392
|
var readJsonFile = async (file) => {
|
|
@@ -7558,16 +7558,6 @@ var mintlifyBackgroundDecoration = (value) => {
|
|
|
7558
7558
|
}
|
|
7559
7559
|
return;
|
|
7560
7560
|
};
|
|
7561
|
-
var sidebarItemPaths = (items) => items.flatMap((item) => {
|
|
7562
|
-
if (typeof item === "string") {
|
|
7563
|
-
return [tabPathFromRef(item)];
|
|
7564
|
-
}
|
|
7565
|
-
if (item.href) {
|
|
7566
|
-
return [item.href];
|
|
7567
|
-
}
|
|
7568
|
-
const paths = item.root ? [tabPathFromRef(item.root)] : [];
|
|
7569
|
-
return item.items ? [...paths, ...sidebarItemPaths(item.items)] : paths;
|
|
7570
|
-
});
|
|
7571
7561
|
var collapsedFromExpanded = (value) => {
|
|
7572
7562
|
if (value === false) {
|
|
7573
7563
|
return true;
|
|
@@ -7652,59 +7642,6 @@ var selectorItemsFor = (items) => items.flatMap((item) => {
|
|
|
7652
7642
|
];
|
|
7653
7643
|
});
|
|
7654
7644
|
var isExternalRoute = (path) => path.startsWith("http://") || path.startsWith("https://") || path.startsWith("mailto:") || path.startsWith("tel:");
|
|
7655
|
-
var hasOwnNavigationContent = (item) => Boolean(asString(item.root)) || childItemsFor(item).length > 0;
|
|
7656
|
-
var mintlifySidebarVariants = async (spec) => {
|
|
7657
|
-
const navigation = asObject(spec.navigation) ?? {};
|
|
7658
|
-
const global = asObject(navigation.global) ?? {};
|
|
7659
|
-
const candidates = [];
|
|
7660
|
-
const addCandidate = (item) => {
|
|
7661
|
-
const path = navItemPath(item);
|
|
7662
|
-
if (!path || isExternalRoute(path)) {
|
|
7663
|
-
return;
|
|
7664
|
-
}
|
|
7665
|
-
candidates.push({ item, path });
|
|
7666
|
-
};
|
|
7667
|
-
for (const item of [
|
|
7668
|
-
...asArray(navigation.tabs),
|
|
7669
|
-
...asArray(navigation.anchors),
|
|
7670
|
-
...asArray(global.anchors)
|
|
7671
|
-
]) {
|
|
7672
|
-
const object = asObject(item);
|
|
7673
|
-
if (!object) {
|
|
7674
|
-
addCandidate(item);
|
|
7675
|
-
continue;
|
|
7676
|
-
}
|
|
7677
|
-
for (const menuItem of asArray(object.menu)) {
|
|
7678
|
-
addCandidate(menuItem);
|
|
7679
|
-
}
|
|
7680
|
-
if (hasOwnNavigationContent(object)) {
|
|
7681
|
-
addCandidate(item);
|
|
7682
|
-
}
|
|
7683
|
-
}
|
|
7684
|
-
for (const item of [
|
|
7685
|
-
...asArray(navigation.dropdowns),
|
|
7686
|
-
...asArray(navigation.products),
|
|
7687
|
-
...asArray(navigation.versions),
|
|
7688
|
-
...asArray(navigation.languages)
|
|
7689
|
-
]) {
|
|
7690
|
-
addCandidate(item);
|
|
7691
|
-
}
|
|
7692
|
-
const resolved = await Promise.all(candidates.map(async (candidate) => {
|
|
7693
|
-
const items = await toSidebarItems([candidate.item], {});
|
|
7694
|
-
if (items.length === 0) {
|
|
7695
|
-
return [];
|
|
7696
|
-
}
|
|
7697
|
-
return [candidate.path, ...sidebarItemPaths(items)].filter((path) => !isExternalRoute(path)).map((path) => ({ items, path }));
|
|
7698
|
-
}));
|
|
7699
|
-
const seen = new Set;
|
|
7700
|
-
return resolved.flat().flatMap((variant) => {
|
|
7701
|
-
if (!variant || seen.has(variant.path)) {
|
|
7702
|
-
return [];
|
|
7703
|
-
}
|
|
7704
|
-
seen.add(variant.path);
|
|
7705
|
-
return [variant];
|
|
7706
|
-
});
|
|
7707
|
-
};
|
|
7708
7645
|
var mintlifyTabs = (spec) => {
|
|
7709
7646
|
const navigation = asObject(spec.navigation) ?? {};
|
|
7710
7647
|
const global = asObject(navigation.global) ?? {};
|
|
@@ -7776,18 +7713,30 @@ var mintignorePatterns = async (root) => {
|
|
|
7776
7713
|
};
|
|
7777
7714
|
var REDIRECT_PARAM = /:(?<name>[A-Za-z_]\w*)(?<modifier>[*+?])?/gu;
|
|
7778
7715
|
var toAstroRedirectPath = (path) => path.replaceAll(REDIRECT_PARAM, (_match, name, modifier) => modifier === "*" || modifier === "+" ? `[...${name}]` : `[${name}]`);
|
|
7779
|
-
var
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7716
|
+
var isDynamicRedirectPath = (path) => path.includes("[");
|
|
7717
|
+
var partitionMintlifyRedirects = (spec) => {
|
|
7718
|
+
const kept = [];
|
|
7719
|
+
const dropped = [];
|
|
7720
|
+
for (const redirect of asArray(spec.redirects)) {
|
|
7721
|
+
const object = asObject(redirect);
|
|
7722
|
+
if (!object) {
|
|
7723
|
+
continue;
|
|
7724
|
+
}
|
|
7725
|
+
const source = asString(object.source) ?? asString(object.from);
|
|
7726
|
+
const destination = asString(object.destination) ?? asString(object.to) ?? asString(object.redirect);
|
|
7727
|
+
if (!source || !destination) {
|
|
7728
|
+
continue;
|
|
7729
|
+
}
|
|
7730
|
+
const from = toAstroRedirectPath(source);
|
|
7731
|
+
const to = toAstroRedirectPath(destination);
|
|
7732
|
+
if (isDynamicRedirectPath(from) || isDynamicRedirectPath(to)) {
|
|
7733
|
+
dropped.push(source);
|
|
7734
|
+
} else {
|
|
7735
|
+
kept.push({ from, to });
|
|
7736
|
+
}
|
|
7788
7737
|
}
|
|
7789
|
-
return
|
|
7790
|
-
}
|
|
7738
|
+
return { dropped, kept };
|
|
7739
|
+
};
|
|
7791
7740
|
var openapiRouteFromDirectory = (value) => {
|
|
7792
7741
|
const directory = normalizeDirectory(asString(value) ?? "");
|
|
7793
7742
|
return directory.length > 0 ? `/${directory}` : undefined;
|
|
@@ -8052,11 +8001,10 @@ var loadMintlifyConfig = async (root, file) => {
|
|
|
8052
8001
|
chromeVariants: mintlifyChromeVariants(spec),
|
|
8053
8002
|
selectors: mintlifySelectors(spec),
|
|
8054
8003
|
sidebar: await toSidebarItems(mintlifyNavigationItems(navigation), {}),
|
|
8055
|
-
sidebarVariants: await mintlifySidebarVariants(spec),
|
|
8056
8004
|
tabs: mintlifyTabs(spec)
|
|
8057
8005
|
},
|
|
8058
8006
|
openapi: mintlifyOpenapi(spec),
|
|
8059
|
-
redirects:
|
|
8007
|
+
redirects: partitionMintlifyRedirects(spec).kept,
|
|
8060
8008
|
search: {
|
|
8061
8009
|
indexing: {
|
|
8062
8010
|
includeHiddenPages: seo.indexing === "all"
|
|
@@ -8441,10 +8389,6 @@ var sidebarItemSchema = z2.lazy(() => z2.union([
|
|
|
8441
8389
|
root: z2.string().optional()
|
|
8442
8390
|
}).strict()
|
|
8443
8391
|
]));
|
|
8444
|
-
var sidebarVariantSchema = z2.object({
|
|
8445
|
-
items: z2.array(sidebarItemSchema).default([]),
|
|
8446
|
-
path: z2.string()
|
|
8447
|
-
}).strict();
|
|
8448
8392
|
var variablesConfigSchema = z2.record(z2.string().regex(/^[A-Za-z0-9-]+$/u), z2.string()).default({});
|
|
8449
8393
|
var fontSlug = z2.string().refine(isFontSlug, (value) => ({
|
|
8450
8394
|
message: `Unknown font "${value}". Supported fonts: ${FONT_SLUGS.join(", ")}.`
|
|
@@ -8558,7 +8502,6 @@ var navigationConfigSchema = z2.object({
|
|
|
8558
8502
|
repo: z2.boolean().default(true),
|
|
8559
8503
|
selectors: z2.array(navSelectorSchema).default([]),
|
|
8560
8504
|
sidebar: z2.array(sidebarItemSchema).optional(),
|
|
8561
|
-
sidebarVariants: z2.array(sidebarVariantSchema).default([]),
|
|
8562
8505
|
tabs: z2.array(navTabSchema).optional()
|
|
8563
8506
|
}).strict();
|
|
8564
8507
|
var exportConfigSchema = z2.union([
|
|
@@ -9025,16 +8968,11 @@ var buildNavigation = (pages, options) => {
|
|
|
9025
8968
|
options.refByLogical ? page.translationKey : page.route,
|
|
9026
8969
|
page
|
|
9027
8970
|
]));
|
|
9028
|
-
const sidebarVariants = (options.sidebarVariants ?? []).map((variant) => ({
|
|
9029
|
-
path: variant.path,
|
|
9030
|
-
sidebar: buildConfigSidebar(variant.items, byRoute)
|
|
9031
|
-
}));
|
|
9032
8971
|
if (options.sidebar) {
|
|
9033
8972
|
return {
|
|
9034
8973
|
chromeVariants,
|
|
9035
8974
|
selectors,
|
|
9036
8975
|
sidebar: buildConfigSidebar(options.sidebar, byRoute),
|
|
9037
|
-
sidebarVariants,
|
|
9038
8976
|
tabs
|
|
9039
8977
|
};
|
|
9040
8978
|
}
|
|
@@ -9042,7 +8980,6 @@ var buildNavigation = (pages, options) => {
|
|
|
9042
8980
|
chromeVariants,
|
|
9043
8981
|
selectors,
|
|
9044
8982
|
sidebar: buildFileSystemSidebar(pages, options.folderMeta, sharedFolderMeta, metaPrefix),
|
|
9045
|
-
sidebarVariants,
|
|
9046
8983
|
tabs
|
|
9047
8984
|
};
|
|
9048
8985
|
};
|
|
@@ -9107,7 +9044,6 @@ var buildContentGraph = (pages, options) => {
|
|
|
9107
9044
|
selectors: options.navigation.selectors,
|
|
9108
9045
|
sharedFolderMeta: options.sharedFolderMeta,
|
|
9109
9046
|
sidebar: options.navigation.sidebar,
|
|
9110
|
-
sidebarVariants: options.navigation.sidebarVariants,
|
|
9111
9047
|
tabs
|
|
9112
9048
|
});
|
|
9113
9049
|
}
|
|
@@ -9115,7 +9051,6 @@ var buildContentGraph = (pages, options) => {
|
|
|
9115
9051
|
chromeVariants: [],
|
|
9116
9052
|
selectors: [],
|
|
9117
9053
|
sidebar: [],
|
|
9118
|
-
sidebarVariants: [],
|
|
9119
9054
|
tabs: []
|
|
9120
9055
|
};
|
|
9121
9056
|
} else {
|
|
@@ -9125,7 +9060,6 @@ var buildContentGraph = (pages, options) => {
|
|
|
9125
9060
|
selectors: options.navigation.selectors,
|
|
9126
9061
|
sharedFolderMeta: options.sharedFolderMeta,
|
|
9127
9062
|
sidebar: options.navigation.sidebar,
|
|
9128
|
-
sidebarVariants: options.navigation.sidebarVariants,
|
|
9129
9063
|
tabs: options.navigation.tabs
|
|
9130
9064
|
});
|
|
9131
9065
|
}
|
|
@@ -9142,7 +9076,7 @@ var buildContentGraph = (pages, options) => {
|
|
|
9142
9076
|
|
|
9143
9077
|
// src/core/last-modified.ts
|
|
9144
9078
|
import { execFileSync } from "node:child_process";
|
|
9145
|
-
import { relative as
|
|
9079
|
+
import { relative as relative9 } from "pathe";
|
|
9146
9080
|
var resolveLastModifiedConfig = (value) => {
|
|
9147
9081
|
if (value === false) {
|
|
9148
9082
|
return { enabled: false, source: "git" };
|
|
@@ -9182,7 +9116,7 @@ var gitLastModifiedTimes = (root, contentRoot, sourcePaths) => {
|
|
|
9182
9116
|
const byRepoPath = parseGitLog(output);
|
|
9183
9117
|
const result = new Map;
|
|
9184
9118
|
for (const sourcePath of sourcePaths) {
|
|
9185
|
-
const iso = byRepoPath.get(
|
|
9119
|
+
const iso = byRepoPath.get(relative9(gitRoot, sourcePath));
|
|
9186
9120
|
if (iso) {
|
|
9187
9121
|
result.set(sourcePath, iso);
|
|
9188
9122
|
}
|
|
@@ -9194,7 +9128,7 @@ var gitLastModifiedTimes = (root, contentRoot, sourcePaths) => {
|
|
|
9194
9128
|
};
|
|
9195
9129
|
|
|
9196
9130
|
// src/core/meta.ts
|
|
9197
|
-
import { basename as basename3, dirname as dirname9, relative as
|
|
9131
|
+
import { basename as basename3, dirname as dirname9, relative as relative10 } from "pathe";
|
|
9198
9132
|
import { glob as glob5 } from "tinyglobby";
|
|
9199
9133
|
var META_FILES = [
|
|
9200
9134
|
"**/meta.ts",
|
|
@@ -9224,7 +9158,7 @@ var discoverFolderMeta = async (contentRoot) => {
|
|
|
9224
9158
|
const shared = new Map;
|
|
9225
9159
|
const diagnostics = [];
|
|
9226
9160
|
for (const entry of loaded) {
|
|
9227
|
-
const dir =
|
|
9161
|
+
const dir = relative10(contentRoot, dirname9(entry.file));
|
|
9228
9162
|
if (!entry.ok) {
|
|
9229
9163
|
diagnostics.push({
|
|
9230
9164
|
code: "BLUME_META_LOAD_FAILED",
|
|
@@ -9429,10 +9363,10 @@ import { join as join26 } from "pathe";
|
|
|
9429
9363
|
// src/core/sources/filesystem.ts
|
|
9430
9364
|
import { existsSync as existsSync13, watch as fsWatch } from "node:fs";
|
|
9431
9365
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
9432
|
-
import { extname as extname5, isAbsolute as
|
|
9366
|
+
import { extname as extname5, isAbsolute as isAbsolute7, join as join19, relative as relative11, resolve as resolve6 } from "pathe";
|
|
9433
9367
|
import { glob as glob6 } from "tinyglobby";
|
|
9434
9368
|
var filesystemSource = (options) => {
|
|
9435
|
-
const contentRoot =
|
|
9369
|
+
const contentRoot = isAbsolute7(options.root) ? options.root : join19(resolve6(options.projectRoot), options.root);
|
|
9436
9370
|
const load2 = async () => {
|
|
9437
9371
|
const files = await glob6(options.include, {
|
|
9438
9372
|
absolute: true,
|
|
@@ -9449,7 +9383,7 @@ var filesystemSource = (options) => {
|
|
|
9449
9383
|
return {
|
|
9450
9384
|
body: { format, text: parsed.content },
|
|
9451
9385
|
data: parsed.data,
|
|
9452
|
-
ref:
|
|
9386
|
+
ref: relative11(contentRoot, file),
|
|
9453
9387
|
sourcePath: file
|
|
9454
9388
|
};
|
|
9455
9389
|
}));
|
|
@@ -9757,16 +9691,35 @@ var mdxRemoteSource = (options, ctx) => {
|
|
|
9757
9691
|
// src/core/sources/mintlify.ts
|
|
9758
9692
|
import { existsSync as existsSync15, watch as fsWatch2 } from "node:fs";
|
|
9759
9693
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
9760
|
-
import { isAbsolute as
|
|
9694
|
+
import { isAbsolute as isAbsolute9, join as join22, relative as relative15, resolve as resolve8 } from "pathe";
|
|
9761
9695
|
import { glob as glob7 } from "tinyglobby";
|
|
9762
9696
|
|
|
9763
9697
|
// src/migrate/shared.ts
|
|
9764
9698
|
import { existsSync as existsSync14 } from "node:fs";
|
|
9765
9699
|
import { readFile as readFile14, writeFile as writeFile5 } from "node:fs/promises";
|
|
9766
|
-
import { isAbsolute as
|
|
9700
|
+
import { basename as basename4, isAbsolute as isAbsolute8, join as join20, relative as relative12 } from "pathe";
|
|
9701
|
+
|
|
9702
|
+
// src/core/package-json.ts
|
|
9703
|
+
var toPackageName = (raw) => raw.toLowerCase().replaceAll(/[^a-z0-9._-]+/gu, "-").replaceAll(/^[-_.]+|[-_.]+$/gu, "") || "docs";
|
|
9704
|
+
var blumePackageJson = (name) => `{
|
|
9705
|
+
"name": ${JSON.stringify(name)},
|
|
9706
|
+
"private": true,
|
|
9707
|
+
"type": "module",
|
|
9708
|
+
"scripts": {
|
|
9709
|
+
"dev": "blume dev",
|
|
9710
|
+
"build": "blume build",
|
|
9711
|
+
"doctor": "blume doctor"
|
|
9712
|
+
},
|
|
9713
|
+
"dependencies": {
|
|
9714
|
+
"blume": "^${getBlumeVersion()}"
|
|
9715
|
+
}
|
|
9716
|
+
}
|
|
9717
|
+
`;
|
|
9718
|
+
|
|
9719
|
+
// src/migrate/shared.ts
|
|
9767
9720
|
var isInsideRoot2 = (root, candidate) => {
|
|
9768
|
-
const rel =
|
|
9769
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
9721
|
+
const rel = relative12(root, candidate);
|
|
9722
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute8(rel);
|
|
9770
9723
|
};
|
|
9771
9724
|
var writeBlumeConfig = async (root, config) => {
|
|
9772
9725
|
const body = `import { defineConfig } from "blume";
|
|
@@ -9816,6 +9769,14 @@ var rewriteFrameworkScripts = async (root, cli, remove) => {
|
|
|
9816
9769
|
return changed;
|
|
9817
9770
|
};
|
|
9818
9771
|
var leftoverFiles = (root, candidates) => candidates.filter((candidate) => existsSync14(join20(root, candidate)));
|
|
9772
|
+
var ensurePackageJson = async (root) => {
|
|
9773
|
+
const pkgPath = join20(root, "package.json");
|
|
9774
|
+
if (existsSync14(pkgPath)) {
|
|
9775
|
+
return false;
|
|
9776
|
+
}
|
|
9777
|
+
await writeFile5(pkgPath, blumePackageJson(toPackageName(basename4(root))), "utf-8");
|
|
9778
|
+
return true;
|
|
9779
|
+
};
|
|
9819
9780
|
var attribute = (attrs, name) => {
|
|
9820
9781
|
const match = attrs.match(new RegExp(`\\b${name}=(?:"(?<dq>[^"]*)"|'(?<sq>[^']*)')`, "u"));
|
|
9821
9782
|
return match?.groups?.dq ?? match?.groups?.sq;
|
|
@@ -10212,7 +10173,7 @@ var isLiteralObject = (value) => typeof value === "object" && value !== null &&
|
|
|
10212
10173
|
var asLiteralArray = (value) => Array.isArray(value) ? value : undefined;
|
|
10213
10174
|
|
|
10214
10175
|
// src/migrate/mintlify/content.ts
|
|
10215
|
-
import { dirname as dirname10, join as join21, relative as
|
|
10176
|
+
import { dirname as dirname10, join as join21, relative as relative13 } from "pathe";
|
|
10216
10177
|
var CALLOUT_DIRECTIVES = {
|
|
10217
10178
|
Check: "success",
|
|
10218
10179
|
Danger: "danger",
|
|
@@ -10241,6 +10202,7 @@ var rewriteMintlifyCallouts = (source) => rewriteCallouts(source, {
|
|
|
10241
10202
|
typeDirectives: CALLOUT_TYPE_DIRECTIVES
|
|
10242
10203
|
});
|
|
10243
10204
|
var rewriteMintlifyExampleBlocks = (source) => source.replaceAll(/<(?<close>\/?)(?:Request|Response)Example\b/gu, "<$<close>CodeGroup");
|
|
10205
|
+
var rewriteMintlifyAccordions = (source) => source.replaceAll(/<(?<close>\/?)Accordion(?<group>Group)?\b/gu, (_match, close, group) => group ? `<${close}Accordion` : `<${close}AccordionItem`);
|
|
10244
10206
|
var SNIPPET_IMPORT = /^import\s+[\s\S]*?\s+from\s+["'](?<source>\/snippets\/[^"']+)["'];?[ \t]*\n?/gmu;
|
|
10245
10207
|
var rewriteSnippetImports = (source, options) => {
|
|
10246
10208
|
const components = [];
|
|
@@ -10250,7 +10212,7 @@ var rewriteSnippetImports = (source, options) => {
|
|
|
10250
10212
|
}
|
|
10251
10213
|
const target = join21(options.root, importSource.replace(/^\/+/u, ""));
|
|
10252
10214
|
components.push(importSource.replace(/^\/+/u, ""));
|
|
10253
|
-
let rel =
|
|
10215
|
+
let rel = relative13(dirname10(options.filePath), target);
|
|
10254
10216
|
if (!rel.startsWith(".")) {
|
|
10255
10217
|
rel = `./${rel}`;
|
|
10256
10218
|
}
|
|
@@ -10440,7 +10402,7 @@ var rewriteMintlifySvgIconProps = (source) => {
|
|
|
10440
10402
|
|
|
10441
10403
|
// src/migrate/mintlify/snippets.ts
|
|
10442
10404
|
import { readFile as readFileFromDisk } from "node:fs/promises";
|
|
10443
|
-
import { dirname as dirname11, relative as
|
|
10405
|
+
import { dirname as dirname11, relative as relative14, resolve as resolve7 } from "pathe";
|
|
10444
10406
|
var MARKDOWN_SNIPPET_IMPORT = /^import\s+(?<name>[$A-Z_a-z][$\w]*)\s+from\s+["'](?<source>[^"']+\.mdx?)["'];?\s*$/gmu;
|
|
10445
10407
|
var NAMED_SNIPPET_IMPORT = /^import\s+\{(?<names>[^}]+)\}\s+from\s+["'](?<source>[^"']+\.mdx?)["'];?\s*$/gmu;
|
|
10446
10408
|
var EXPORTED_STRING_CONST = /^export\s+const\s+(?<name>[$A-Z_a-z][$\w]*)\s*=\s*(?:"(?<double>(?:\\.|[^"\\])*)"|'(?<single>(?:\\.|[^'\\])*)'|`(?<template>(?:\\.|[^`\\])*)`)\s*;?\s*$/gmu;
|
|
@@ -10450,14 +10412,14 @@ var GLOBAL_VARIABLE = /\{\{\s*(?<name>[A-Za-z0-9-]+)\s*\}\}/gu;
|
|
|
10450
10412
|
var FRONTMATTER_BLOCK = /^---\r?\n[\s\S]*?\r?\n---\r?\n?/u;
|
|
10451
10413
|
var USER_EXPORT = /^(?:export\s+)?(?:const|let|var)\s+user\s*=|^import\s+\{\s*user\s*\}/mu;
|
|
10452
10414
|
var isInsideRoot3 = (root, candidate) => {
|
|
10453
|
-
const rel =
|
|
10415
|
+
const rel = relative14(root, candidate);
|
|
10454
10416
|
return rel === "" || !rel.startsWith("..") && !rel.startsWith("/");
|
|
10455
10417
|
};
|
|
10456
10418
|
var escapeRegExp2 = (value) => value.replaceAll(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
10457
10419
|
var snippetSelfClosingTagPattern = (name) => new RegExp(`<${escapeRegExp2(name)}(?<attrs>[^>]*?)\\s*/>`, "gu");
|
|
10458
10420
|
var snippetPairedTagPattern = (name) => new RegExp(`<${escapeRegExp2(name)}(?<attrs>[^>]*?)>[\\s\\S]*?</${escapeRegExp2(name)}>`, "gu");
|
|
10459
10421
|
var rootRelativePath = (root, file) => {
|
|
10460
|
-
const rel =
|
|
10422
|
+
const rel = relative14(root, file);
|
|
10461
10423
|
return rel ? `/${rel}` : "/";
|
|
10462
10424
|
};
|
|
10463
10425
|
var snippetCycleMessage = (root, file, trail) => {
|
|
@@ -10636,6 +10598,7 @@ var transformMintlifyContent = async (raw, options) => {
|
|
|
10636
10598
|
text = snippetImports.source;
|
|
10637
10599
|
text = rewriteMintlifySvgIconProps(text);
|
|
10638
10600
|
text = rewriteMintlifyExampleBlocks(text);
|
|
10601
|
+
text = rewriteMintlifyAccordions(text);
|
|
10639
10602
|
text = rewriteMintlifyCallouts(text);
|
|
10640
10603
|
const unsupported = unsupportedMintlifyComponents(text);
|
|
10641
10604
|
const parsed = frontmatter_default(text);
|
|
@@ -10659,8 +10622,18 @@ var MINTLIFY_SOURCE_IGNORES = [
|
|
|
10659
10622
|
"public/**",
|
|
10660
10623
|
"snippets/**"
|
|
10661
10624
|
];
|
|
10625
|
+
var WATCH_IGNORE_DIRS = new Set([
|
|
10626
|
+
...MINTLIFY_SOURCE_IGNORES.map((pattern) => pattern.replace(/\/\*\*$/u, "")),
|
|
10627
|
+
".git"
|
|
10628
|
+
]);
|
|
10629
|
+
var mintlifyWatchListener = (onChange) => (_event, filename) => {
|
|
10630
|
+
if (typeof filename === "string" && filename.split(/[/\\]/u).some((segment) => WATCH_IGNORE_DIRS.has(segment))) {
|
|
10631
|
+
return;
|
|
10632
|
+
}
|
|
10633
|
+
onChange();
|
|
10634
|
+
};
|
|
10662
10635
|
var mintlifySource = (options) => {
|
|
10663
|
-
const contentRoot =
|
|
10636
|
+
const contentRoot = isAbsolute9(options.root) ? options.root : join22(resolve8(options.projectRoot), options.root);
|
|
10664
10637
|
const ignore = [...new Set([...options.exclude, ...MINTLIFY_SOURCE_IGNORES])];
|
|
10665
10638
|
const transform = (raw, file) => transformMintlifyContent(raw, {
|
|
10666
10639
|
filePath: file,
|
|
@@ -10686,7 +10659,7 @@ var mintlifySource = (options) => {
|
|
|
10686
10659
|
body: { format: "mdx", text: parsed.content },
|
|
10687
10660
|
data: parsed.data,
|
|
10688
10661
|
raw: result.content,
|
|
10689
|
-
ref:
|
|
10662
|
+
ref: relative15(contentRoot, file),
|
|
10690
10663
|
sourcePath: file
|
|
10691
10664
|
};
|
|
10692
10665
|
}));
|
|
@@ -10713,7 +10686,7 @@ var mintlifySource = (options) => {
|
|
|
10713
10686
|
const watch = (onChange) => {
|
|
10714
10687
|
const disposers = [];
|
|
10715
10688
|
if (existsSync15(contentRoot)) {
|
|
10716
|
-
const watcher = fsWatch2(contentRoot, { recursive: true }, onChange);
|
|
10689
|
+
const watcher = fsWatch2(contentRoot, { recursive: true }, mintlifyWatchListener(onChange));
|
|
10717
10690
|
disposers.push(() => watcher.close());
|
|
10718
10691
|
}
|
|
10719
10692
|
if (options.configFile && existsSync15(options.configFile)) {
|
|
@@ -11920,7 +11893,7 @@ import { dev } from "astro";
|
|
|
11920
11893
|
import { defineCommand as defineCommand4 } from "citty";
|
|
11921
11894
|
|
|
11922
11895
|
// src/astro/static-assets.ts
|
|
11923
|
-
import { extname as extname7, join as join30, relative as
|
|
11896
|
+
import { extname as extname7, join as join30, relative as relative16, resolve as resolve10, sep } from "pathe";
|
|
11924
11897
|
|
|
11925
11898
|
// src/astro/integration.ts
|
|
11926
11899
|
var overlayServer = null;
|
|
@@ -12148,12 +12121,12 @@ var doctorCommand = defineCommand5({
|
|
|
12148
12121
|
// src/cli/commands/eject.ts
|
|
12149
12122
|
import { readFile as readFile17, writeFile as writeFile9 } from "node:fs/promises";
|
|
12150
12123
|
import { defineCommand as defineCommand6 } from "citty";
|
|
12151
|
-
import { join as join32, relative as
|
|
12124
|
+
import { join as join32, relative as relative18 } from "pathe";
|
|
12152
12125
|
|
|
12153
12126
|
// src/registry/eject.ts
|
|
12154
12127
|
import { existsSync as existsSync19 } from "node:fs";
|
|
12155
12128
|
import { cp, mkdir as mkdir5, readFile as readFile16, rm as rm2, writeFile as writeFile8 } from "node:fs/promises";
|
|
12156
|
-
import { join as join31, relative as
|
|
12129
|
+
import { join as join31, relative as relative17 } from "pathe";
|
|
12157
12130
|
var POSIX = (path) => path.split("\\").join("/");
|
|
12158
12131
|
var ejectOpenApiData = (project) => {
|
|
12159
12132
|
const source = project.sources.find(isOpenApiSource);
|
|
@@ -12205,13 +12178,13 @@ var eject = async (root) => {
|
|
|
12205
12178
|
const needsSvelte = frameworks.has("svelte");
|
|
12206
12179
|
const relContext = {
|
|
12207
12180
|
...context,
|
|
12208
|
-
contentRoot: POSIX(
|
|
12181
|
+
contentRoot: POSIX(relative17(root, context.contentRoot)),
|
|
12209
12182
|
outDir: ".",
|
|
12210
12183
|
root: "."
|
|
12211
12184
|
};
|
|
12212
|
-
const componentsImport = context.componentsFile ? `../../${POSIX(
|
|
12185
|
+
const componentsImport = context.componentsFile ? `../../${POSIX(relative17(root, context.componentsFile))}` : null;
|
|
12213
12186
|
const relPages = pages.map((page) => ({
|
|
12214
|
-
entrypoint: POSIX(
|
|
12187
|
+
entrypoint: POSIX(relative17(root, page.entrypoint)),
|
|
12215
12188
|
pattern: page.pattern
|
|
12216
12189
|
}));
|
|
12217
12190
|
const staged = collectStaged(project);
|
|
@@ -12429,7 +12402,7 @@ var ejectCommand = defineCommand6({
|
|
|
12429
12402
|
await updatePackageScripts(root);
|
|
12430
12403
|
logger.success(`Ejected ${files.length} file(s):`);
|
|
12431
12404
|
for (const file of files) {
|
|
12432
|
-
process.stdout.write(` ${
|
|
12405
|
+
process.stdout.write(` ${relative18(root, file)}
|
|
12433
12406
|
`);
|
|
12434
12407
|
}
|
|
12435
12408
|
logger.box(`Your project is now a standalone Astro app.
|
|
@@ -12445,22 +12418,7 @@ The blume package remains importable.`);
|
|
|
12445
12418
|
import { existsSync as existsSync20 } from "node:fs";
|
|
12446
12419
|
import { mkdir as mkdir6, writeFile as writeFile10 } from "node:fs/promises";
|
|
12447
12420
|
import { defineCommand as defineCommand7 } from "citty";
|
|
12448
|
-
import { basename as
|
|
12449
|
-
var toPackageName = (raw) => raw.toLowerCase().replaceAll(/[^a-z0-9._-]+/gu, "-").replaceAll(/^[-_.]+|[-_.]+$/gu, "") || "docs";
|
|
12450
|
-
var packageTemplate = (name, version) => `{
|
|
12451
|
-
"name": ${JSON.stringify(name)},
|
|
12452
|
-
"private": true,
|
|
12453
|
-
"type": "module",
|
|
12454
|
-
"scripts": {
|
|
12455
|
-
"dev": "blume dev",
|
|
12456
|
-
"build": "blume build",
|
|
12457
|
-
"doctor": "blume doctor"
|
|
12458
|
-
},
|
|
12459
|
-
"dependencies": {
|
|
12460
|
-
"blume": "^${version}"
|
|
12461
|
-
}
|
|
12462
|
-
}
|
|
12463
|
-
`;
|
|
12421
|
+
import { basename as basename5, dirname as dirname13, isAbsolute as isAbsolute10, join as join33, relative as relative19 } from "pathe";
|
|
12464
12422
|
var TEMPLATES = ["docs", "api", "sdk", "changelog"];
|
|
12465
12423
|
var PACKAGE_MANAGERS = ["npm", "pnpm", "yarn", "bun"];
|
|
12466
12424
|
var configFor = (extra) => `import { defineConfig } from "blume";
|
|
@@ -12594,7 +12552,7 @@ var initCommand = defineCommand7({
|
|
|
12594
12552
|
async run({ args }) {
|
|
12595
12553
|
const root = process.cwd();
|
|
12596
12554
|
const contentDir = args["content-dir"] ?? "docs";
|
|
12597
|
-
if (
|
|
12555
|
+
if (isAbsolute10(contentDir) || relative19(root, join33(root, contentDir)).startsWith("..")) {
|
|
12598
12556
|
logger.error(`Invalid --content-dir "${contentDir}" (must be a path inside the project).`);
|
|
12599
12557
|
process.exit(1);
|
|
12600
12558
|
}
|
|
@@ -12609,7 +12567,7 @@ var initCommand = defineCommand7({
|
|
|
12609
12567
|
process.exit(1);
|
|
12610
12568
|
}
|
|
12611
12569
|
const starter = STARTERS[template];
|
|
12612
|
-
const createdPackage = await writeFileSafe(join33(root, "package.json"),
|
|
12570
|
+
const createdPackage = await writeFileSafe(join33(root, "package.json"), blumePackageJson(toPackageName(basename5(root))));
|
|
12613
12571
|
await writeFileSafe(join33(root, "blume.config.ts"), starter.config);
|
|
12614
12572
|
await Promise.all(starter.files(contentDir).map((file) => writeFileSafe(join33(root, file.path), file.content)));
|
|
12615
12573
|
const ignored = await ensureGitignore(root, [".blume/", "dist/"]);
|
|
@@ -12654,13 +12612,13 @@ import { defineCommand as defineCommand8 } from "citty";
|
|
|
12654
12612
|
// src/migrate/fumadocs/index.ts
|
|
12655
12613
|
import { existsSync as existsSync24 } from "node:fs";
|
|
12656
12614
|
import { mkdir as mkdir8, readFile as readFile19, rename as rename3, rm as rm3, writeFile as writeFile12 } from "node:fs/promises";
|
|
12657
|
-
import { dirname as dirname16, join as join36, relative as
|
|
12615
|
+
import { dirname as dirname16, join as join36, relative as relative20 } from "pathe";
|
|
12658
12616
|
import { glob as glob8 } from "tinyglobby";
|
|
12659
12617
|
|
|
12660
12618
|
// src/migrate/fumadocs/config.ts
|
|
12661
12619
|
import { existsSync as existsSync21 } from "node:fs";
|
|
12662
12620
|
import { readFile as readFile18 } from "node:fs/promises";
|
|
12663
|
-
import { basename as
|
|
12621
|
+
import { basename as basename6, dirname as dirname14, join as join34 } from "pathe";
|
|
12664
12622
|
var SOURCE_FILES = [
|
|
12665
12623
|
"lib/source.ts",
|
|
12666
12624
|
"app/source.ts",
|
|
@@ -12715,7 +12673,7 @@ var readTitle = async (root) => {
|
|
|
12715
12673
|
if (GENERIC_NAMES.has(bareName(name).toLowerCase())) {
|
|
12716
12674
|
const repoRoot = gitRepoRoot(root);
|
|
12717
12675
|
if (repoRoot && repoRoot !== root) {
|
|
12718
|
-
const repoTitle = prettifyTitle(
|
|
12676
|
+
const repoTitle = prettifyTitle(basename6(repoRoot));
|
|
12719
12677
|
if (repoTitle !== "Documentation") {
|
|
12720
12678
|
return repoTitle;
|
|
12721
12679
|
}
|
|
@@ -13007,7 +12965,7 @@ var normalizeFumadocsPageMeta = (value) => {
|
|
|
13007
12965
|
// src/migrate/fumadocs/groups.ts
|
|
13008
12966
|
import { existsSync as existsSync23, statSync as statSync2 } from "node:fs";
|
|
13009
12967
|
import { mkdir as mkdir7, rename as rename2, writeFile as writeFile11 } from "node:fs/promises";
|
|
13010
|
-
import { basename as
|
|
12968
|
+
import { basename as basename7, join as join35 } from "pathe";
|
|
13011
12969
|
|
|
13012
12970
|
// src/migrate/fumadocs/meta.ts
|
|
13013
12971
|
var SEPARATOR = /^---(?<label>.*)---$/u;
|
|
@@ -13196,7 +13154,7 @@ var moveItemIntoGroup = async (item, docsDir, groupDir, label, warnings) => {
|
|
|
13196
13154
|
warnings.push(`Sidebar entry "${item.name}" in section "${label}" matched no page or folder; skipped.`);
|
|
13197
13155
|
return null;
|
|
13198
13156
|
}
|
|
13199
|
-
const dest = join35(groupDir,
|
|
13157
|
+
const dest = join35(groupDir, basename7(resolved.path));
|
|
13200
13158
|
if (existsSync23(dest)) {
|
|
13201
13159
|
warnings.push(`Skipped moving "${item.name}" into section "${label}" (target already exists).`);
|
|
13202
13160
|
return null;
|
|
@@ -13269,7 +13227,7 @@ var FUMADOCS_LEFTOVERS = [
|
|
|
13269
13227
|
"app"
|
|
13270
13228
|
];
|
|
13271
13229
|
var movePage = async (abs, base, root) => {
|
|
13272
|
-
const rel =
|
|
13230
|
+
const rel = relative20(base, abs);
|
|
13273
13231
|
const dest = join36(root, "docs", rel);
|
|
13274
13232
|
if (existsSync24(dest)) {
|
|
13275
13233
|
return {
|
|
@@ -13316,7 +13274,7 @@ var writeMeta = async (dest, meta, rel, warnings) => {
|
|
|
13316
13274
|
return warnings;
|
|
13317
13275
|
};
|
|
13318
13276
|
var convertMeta = async (abs, base, root) => {
|
|
13319
|
-
const rel =
|
|
13277
|
+
const rel = relative20(base, abs);
|
|
13320
13278
|
const raw = await readFile19(abs, "utf-8");
|
|
13321
13279
|
let parsed;
|
|
13322
13280
|
try {
|
|
@@ -13490,6 +13448,15 @@ var droppedChromeWarnings = (spec, config) => {
|
|
|
13490
13448
|
}
|
|
13491
13449
|
return warnings;
|
|
13492
13450
|
};
|
|
13451
|
+
var droppedRedirectWarnings = (spec) => {
|
|
13452
|
+
const { dropped } = partitionMintlifyRedirects(spec);
|
|
13453
|
+
if (dropped.length === 0) {
|
|
13454
|
+
return [];
|
|
13455
|
+
}
|
|
13456
|
+
return [
|
|
13457
|
+
`Dropped ${dropped.length} dynamic redirect(s) Blume can't model as static path-to-path (${dropped.join(", ")}); re-add them as host-level rules (e.g. _redirects or vercel.json).`
|
|
13458
|
+
];
|
|
13459
|
+
};
|
|
13493
13460
|
var prune = (value) => {
|
|
13494
13461
|
if (Array.isArray(value)) {
|
|
13495
13462
|
return value.map(prune);
|
|
@@ -13557,6 +13524,15 @@ var applyRelocatedAssets = (config, assets, warnings) => {
|
|
|
13557
13524
|
warnings.push(`Moved assets into public/: ${assets.moved.join(", ")}.`);
|
|
13558
13525
|
}
|
|
13559
13526
|
};
|
|
13527
|
+
var scaffoldProjectFiles = async (root, warnings) => {
|
|
13528
|
+
if (await ensurePackageJson(root)) {
|
|
13529
|
+
warnings.push("Created a package.json with blume as a dependency; run `npm install`, then `npm run dev`.");
|
|
13530
|
+
}
|
|
13531
|
+
const ignored = await ensureGitignore(root, [".blume/", "dist/"]);
|
|
13532
|
+
if (ignored.length > 0) {
|
|
13533
|
+
warnings.push(`Added ${ignored.join(", ")} to .gitignore.`);
|
|
13534
|
+
}
|
|
13535
|
+
};
|
|
13560
13536
|
var cleanupSnippets = async (root, kept, warnings) => {
|
|
13561
13537
|
const dir = join37(root, "snippets");
|
|
13562
13538
|
if (!existsSync25(dir)) {
|
|
@@ -13597,6 +13573,7 @@ var migrateMintlifyProject = async (root) => {
|
|
|
13597
13573
|
warnings.push(`Mapped ${openapiSources.length} OpenAPI spec source(s) to openapi.sources (native reference renderer); verify each spec path or URL resolves.`);
|
|
13598
13574
|
}
|
|
13599
13575
|
warnings.push(...droppedChromeWarnings(spec, config));
|
|
13576
|
+
warnings.push(...droppedRedirectWarnings(spec));
|
|
13600
13577
|
} else {
|
|
13601
13578
|
warnings.push("No docs.json or mint.json found; writing a default config.");
|
|
13602
13579
|
config = { content: { root: "." }, title: "Documentation" };
|
|
@@ -13647,6 +13624,7 @@ var migrateMintlifyProject = async (root) => {
|
|
|
13647
13624
|
}
|
|
13648
13625
|
applyRelocatedAssets(config, assets, warnings);
|
|
13649
13626
|
await writeBlumeConfig2(root, config);
|
|
13627
|
+
await scaffoldProjectFiles(root, warnings);
|
|
13650
13628
|
if (Object.keys(variables).length > 0) {
|
|
13651
13629
|
warnings.push(`Inlined ${Object.keys(variables).length} docs.json variable(s) into content; Blume has no runtime variable substitution.`);
|
|
13652
13630
|
}
|
|
@@ -13663,7 +13641,7 @@ var migrateMintlifyProject = async (root) => {
|
|
|
13663
13641
|
// src/migrate/nextra/index.ts
|
|
13664
13642
|
import { existsSync as existsSync26 } from "node:fs";
|
|
13665
13643
|
import { mkdir as mkdir10, readFile as readFile21, rename as rename5, rm as rm5, writeFile as writeFile14 } from "node:fs/promises";
|
|
13666
|
-
import { basename as
|
|
13644
|
+
import { basename as basename8, dirname as dirname18, extname as extname8, join as join38, relative as relative21 } from "pathe";
|
|
13667
13645
|
import { glob as glob10 } from "tinyglobby";
|
|
13668
13646
|
|
|
13669
13647
|
// src/migrate/nextra/content.ts
|
|
@@ -13898,16 +13876,16 @@ var indexFolders = (base, pageFiles, metaFiles) => {
|
|
|
13898
13876
|
}
|
|
13899
13877
|
};
|
|
13900
13878
|
for (const abs of pageFiles) {
|
|
13901
|
-
const rel =
|
|
13879
|
+
const rel = relative21(base, abs);
|
|
13902
13880
|
const dir = normalizeDir(dirname18(rel));
|
|
13903
|
-
const slug =
|
|
13881
|
+
const slug = basename8(rel).replace(/\.mdx?$/u, "");
|
|
13904
13882
|
const folder = pagesByDir.get(dir) ?? new Map;
|
|
13905
13883
|
folder.set(slug, abs);
|
|
13906
13884
|
pagesByDir.set(dir, folder);
|
|
13907
13885
|
registerDir(dir);
|
|
13908
13886
|
}
|
|
13909
13887
|
for (const abs of metaFiles) {
|
|
13910
|
-
registerDir(normalizeDir(dirname18(
|
|
13888
|
+
registerDir(normalizeDir(dirname18(relative21(base, abs))));
|
|
13911
13889
|
}
|
|
13912
13890
|
const childDirs = new Map;
|
|
13913
13891
|
for (const dir of allDirs) {
|
|
@@ -13916,7 +13894,7 @@ var indexFolders = (base, pageFiles, metaFiles) => {
|
|
|
13916
13894
|
}
|
|
13917
13895
|
const parent = normalizeDir(dirname18(dir));
|
|
13918
13896
|
const children = childDirs.get(parent) ?? new Set;
|
|
13919
|
-
children.add(
|
|
13897
|
+
children.add(basename8(dir));
|
|
13920
13898
|
childDirs.set(parent, children);
|
|
13921
13899
|
}
|
|
13922
13900
|
return { childDirs, pagesByDir };
|
|
@@ -13969,7 +13947,7 @@ var planMetas = (metas, index) => {
|
|
|
13969
13947
|
return plan;
|
|
13970
13948
|
};
|
|
13971
13949
|
var movePage2 = async (abs, options) => {
|
|
13972
|
-
const rel =
|
|
13950
|
+
const rel = relative21(options.base, abs);
|
|
13973
13951
|
const dest = join38(options.root, "docs", rel);
|
|
13974
13952
|
if (existsSync26(dest)) {
|
|
13975
13953
|
return { moved: 0, removed: [], skipped: rel, unsupported: [] };
|
|
@@ -14073,7 +14051,7 @@ var migrateNextraProject = async (root) => {
|
|
|
14073
14051
|
abs,
|
|
14074
14052
|
ext: extname8(abs),
|
|
14075
14053
|
raw: await readFile21(abs, "utf-8"),
|
|
14076
|
-
rel:
|
|
14054
|
+
rel: relative21(base, abs)
|
|
14077
14055
|
})));
|
|
14078
14056
|
const plan = planMetas(metas, index);
|
|
14079
14057
|
const moves = await Promise.all(pageFiles.map((abs) => movePage2(abs, { base, overrides: plan.pageOverrides, root })));
|
|
@@ -14733,7 +14711,7 @@ import { join as join44 } from "pathe";
|
|
|
14733
14711
|
|
|
14734
14712
|
// src/core/links.ts
|
|
14735
14713
|
import { existsSync as existsSync30 } from "node:fs";
|
|
14736
|
-
import { basename as
|
|
14714
|
+
import { basename as basename9, join as join43 } from "pathe";
|
|
14737
14715
|
var HTTP = /^https?:\/\//iu;
|
|
14738
14716
|
var PROTOCOL_RELATIVE = /^\/\//u;
|
|
14739
14717
|
var SCHEME = /^[a-z][a-z0-9+.-]*:/iu;
|
|
@@ -14753,7 +14731,7 @@ var assetIsPresent = (resolved, ctx) => {
|
|
|
14753
14731
|
};
|
|
14754
14732
|
var isIndexPage = (page2) => {
|
|
14755
14733
|
const ref = page2.source?.ref ?? page2.sourcePath ?? "";
|
|
14756
|
-
return /^index\.(?:md|mdx)$/iu.test(
|
|
14734
|
+
return /^index\.(?:md|mdx)$/iu.test(basename9(ref));
|
|
14757
14735
|
};
|
|
14758
14736
|
var resolveRelative = (pageRoute, target, isIndex) => {
|
|
14759
14737
|
const segments = pageRoute.split("/").filter(Boolean);
|
|
@@ -15059,5 +15037,5 @@ process.on("unhandledRejection", (error) => {
|
|
|
15059
15037
|
});
|
|
15060
15038
|
runMain(main);
|
|
15061
15039
|
|
|
15062
|
-
//# debugId=
|
|
15040
|
+
//# debugId=19E77FB94468BA6064756E2164756E21
|
|
15063
15041
|
//# sourceMappingURL=index.js.map
|