blume 0.5.1 → 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 +121 -78
- package/dist/cli/index.js.map +10 -9
- package/package.json +1 -1
- package/src/astro/generate.ts +11 -1
- package/src/astro/templates.ts +34 -8
- package/src/cli/commands/init.ts +2 -27
- package/src/core/package-json.ts +32 -0
- package/src/core/sources/mintlify.ts +44 -1
- package/src/migrate/mintlify/index.ts +24 -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
|
|
@@ -4019,11 +4019,11 @@ var hasScalarReferences = (config) => resolveReferences(config).some((ref) => re
|
|
|
4019
4019
|
|
|
4020
4020
|
// src/openapi/scalar.ts
|
|
4021
4021
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
4022
|
-
import { isAbsolute as
|
|
4022
|
+
import { isAbsolute as isAbsolute5, join as join12 } from "pathe";
|
|
4023
4023
|
|
|
4024
4024
|
// src/astro/templates.ts
|
|
4025
4025
|
import { existsSync as existsSync8, readFileSync as readFileSync4 } from "node:fs";
|
|
4026
|
-
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";
|
|
4027
4027
|
|
|
4028
4028
|
// src/core/assets.ts
|
|
4029
4029
|
import { join as join10 } from "pathe";
|
|
@@ -4396,10 +4396,15 @@ var stagedContentDir = (outDir) => join11(outDir, "content");
|
|
|
4396
4396
|
var contentConfigTemplate = (options) => {
|
|
4397
4397
|
const { context, config } = options;
|
|
4398
4398
|
const stagedBase = options.stagedBase ?? stagedContentDir(context.outDir);
|
|
4399
|
-
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 ? [
|
|
4400
4403
|
...config.content.include,
|
|
4401
|
-
...(config.content.exclude ?? []).map((pattern) => `!${pattern}`)
|
|
4402
|
-
|
|
4404
|
+
...(config.content.exclude ?? []).map((pattern) => `!${pattern}`),
|
|
4405
|
+
"!**/node_modules/**",
|
|
4406
|
+
...outDirIgnore
|
|
4407
|
+
] : [];
|
|
4403
4408
|
const stagedBlock = options.staged ? `
|
|
4404
4409
|
const staged = defineCollection({
|
|
4405
4410
|
loader: glob({
|
|
@@ -5404,7 +5409,7 @@ var specConfiguration = async (spec, root) => {
|
|
|
5404
5409
|
if (URL_SPEC.test(spec)) {
|
|
5405
5410
|
return { config: { url: spec } };
|
|
5406
5411
|
}
|
|
5407
|
-
const absolute =
|
|
5412
|
+
const absolute = isAbsolute5(spec) ? spec : join12(root, spec);
|
|
5408
5413
|
try {
|
|
5409
5414
|
return { config: { content: await readFile5(absolute, "utf-8") } };
|
|
5410
5415
|
} catch {
|
|
@@ -5607,7 +5612,7 @@ var extractOperations = (document, baseRoute) => {
|
|
|
5607
5612
|
// src/openapi/parse.ts
|
|
5608
5613
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
5609
5614
|
import { normalize as normalize2, upgrade } from "@scalar/openapi-parser";
|
|
5610
|
-
import { isAbsolute as
|
|
5615
|
+
import { isAbsolute as isAbsolute6, join as join14 } from "pathe";
|
|
5611
5616
|
var URL_SPEC2 = /^https?:\/\//u;
|
|
5612
5617
|
var readSpecText = async (spec, root) => {
|
|
5613
5618
|
if (URL_SPEC2.test(spec)) {
|
|
@@ -5617,7 +5622,7 @@ var readSpecText = async (spec, root) => {
|
|
|
5617
5622
|
}
|
|
5618
5623
|
return await response.text();
|
|
5619
5624
|
}
|
|
5620
|
-
const absolute =
|
|
5625
|
+
const absolute = isAbsolute6(spec) ? spec : join14(root, spec);
|
|
5621
5626
|
return await readFile7(absolute, "utf-8");
|
|
5622
5627
|
};
|
|
5623
5628
|
var parseSpec = async (spec, root) => {
|
|
@@ -6523,7 +6528,7 @@ export const layoutOverrides = { ...(overrides.layout ?? {})${layoutEntries.leng
|
|
|
6523
6528
|
|
|
6524
6529
|
// src/astro/examples.ts
|
|
6525
6530
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
6526
|
-
import { join as join16, relative as
|
|
6531
|
+
import { join as join16, relative as relative5 } from "pathe";
|
|
6527
6532
|
import { glob as glob2 } from "tinyglobby";
|
|
6528
6533
|
|
|
6529
6534
|
// src/astro/islands.ts
|
|
@@ -6637,7 +6642,7 @@ var discoverExamples = async (root, pattern = "examples") => {
|
|
|
6637
6642
|
if (!(ext && framework)) {
|
|
6638
6643
|
continue;
|
|
6639
6644
|
}
|
|
6640
|
-
const path =
|
|
6645
|
+
const path = relative5(dir, file).slice(0, -(ext.length + 1));
|
|
6641
6646
|
const existing = seen.get(path);
|
|
6642
6647
|
if (existing) {
|
|
6643
6648
|
warnings.push(`Two examples both resolve to "${path}" ("${existing}" and "${file}"); ignoring the second. Give them distinct paths.`);
|
|
@@ -6658,7 +6663,7 @@ var discoverExamples = async (root, pattern = "examples") => {
|
|
|
6658
6663
|
};
|
|
6659
6664
|
|
|
6660
6665
|
// src/astro/pages.ts
|
|
6661
|
-
import { extname as extname2, relative as
|
|
6666
|
+
import { extname as extname2, relative as relative6 } from "pathe";
|
|
6662
6667
|
import { glob as glob3 } from "tinyglobby";
|
|
6663
6668
|
var discoverPages = async (pagesRoot) => {
|
|
6664
6669
|
const files = await glob3(["**/*.astro"], {
|
|
@@ -6668,7 +6673,7 @@ var discoverPages = async (pagesRoot) => {
|
|
|
6668
6673
|
});
|
|
6669
6674
|
files.sort();
|
|
6670
6675
|
return files.map((file) => {
|
|
6671
|
-
const rel =
|
|
6676
|
+
const rel = relative6(pagesRoot, file);
|
|
6672
6677
|
const withoutExt = rel.slice(0, rel.length - extname2(rel).length);
|
|
6673
6678
|
const parts = withoutExt.split("/");
|
|
6674
6679
|
if (parts.at(-1) === "index") {
|
|
@@ -6942,7 +6947,7 @@ var buildRuntimeData = (project) => {
|
|
|
6942
6947
|
if (!(editBase && sourcePath)) {
|
|
6943
6948
|
return null;
|
|
6944
6949
|
}
|
|
6945
|
-
const rel =
|
|
6950
|
+
const rel = relative7(context.root, sourcePath).split("\\").join("/");
|
|
6946
6951
|
return `${editBase}/${github?.dir ? `${github.dir}/${rel}` : rel}`;
|
|
6947
6952
|
};
|
|
6948
6953
|
const { i18n } = config;
|
|
@@ -7166,6 +7171,7 @@ var generateRuntime = async (project) => {
|
|
|
7166
7171
|
pages.push(...mcp.discoveryPages);
|
|
7167
7172
|
const staged = collectStaged(project);
|
|
7168
7173
|
const hasStaged = staged.size > 0;
|
|
7174
|
+
const hasFilesystemSource = project.sources.some((source) => !source.staged);
|
|
7169
7175
|
const structural = await Promise.all([
|
|
7170
7176
|
write(join17(out, "astro.config.mjs"), astroConfigTemplate({
|
|
7171
7177
|
aliases: resolveTsconfigAliases(context.root),
|
|
@@ -7185,7 +7191,12 @@ var generateRuntime = async (project) => {
|
|
|
7185
7191
|
write(join17(out, "package.json"), runtimePackageTemplate(runtimeDependencies({ config, needsReact, needsSvelte, needsVue }))),
|
|
7186
7192
|
write(join17(out, "tsconfig.json"), runtimeTsconfigTemplate()),
|
|
7187
7193
|
write(join17(srcDir, "env.d.ts"), envTemplate()),
|
|
7188
|
-
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
|
+
})),
|
|
7189
7200
|
write(join17(srcDir, "pages", "[...slug].astro"), catchAllPageTemplate({
|
|
7190
7201
|
askEnabled,
|
|
7191
7202
|
exportEpub,
|
|
@@ -7339,7 +7350,7 @@ var assetSegments = (config) => {
|
|
|
7339
7350
|
|
|
7340
7351
|
// src/migrate/mintlify/config.ts
|
|
7341
7352
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
7342
|
-
import { dirname as dirname8, relative as
|
|
7353
|
+
import { dirname as dirname8, relative as relative8, resolve as resolve5 } from "pathe";
|
|
7343
7354
|
var MINTLIFY_DEFAULT_IGNORES = [
|
|
7344
7355
|
"**/_*",
|
|
7345
7356
|
"**/.*",
|
|
@@ -7375,7 +7386,7 @@ var asDirectoryMode = (value) => value === "accordion" || value === "card" || va
|
|
|
7375
7386
|
var withoutUndefined = (value) => Object.fromEntries(Object.entries(value).filter(([, item]) => item !== undefined));
|
|
7376
7387
|
var hasOwn = (object, key) => Object.hasOwn(object, key);
|
|
7377
7388
|
var isInsideRoot = (root, candidate) => {
|
|
7378
|
-
const rel =
|
|
7389
|
+
const rel = relative8(root, candidate);
|
|
7379
7390
|
return rel === "" || !rel.startsWith("..") && !rel.startsWith("/");
|
|
7380
7391
|
};
|
|
7381
7392
|
var readJsonFile = async (file) => {
|
|
@@ -9065,7 +9076,7 @@ var buildContentGraph = (pages, options) => {
|
|
|
9065
9076
|
|
|
9066
9077
|
// src/core/last-modified.ts
|
|
9067
9078
|
import { execFileSync } from "node:child_process";
|
|
9068
|
-
import { relative as
|
|
9079
|
+
import { relative as relative9 } from "pathe";
|
|
9069
9080
|
var resolveLastModifiedConfig = (value) => {
|
|
9070
9081
|
if (value === false) {
|
|
9071
9082
|
return { enabled: false, source: "git" };
|
|
@@ -9105,7 +9116,7 @@ var gitLastModifiedTimes = (root, contentRoot, sourcePaths) => {
|
|
|
9105
9116
|
const byRepoPath = parseGitLog(output);
|
|
9106
9117
|
const result = new Map;
|
|
9107
9118
|
for (const sourcePath of sourcePaths) {
|
|
9108
|
-
const iso = byRepoPath.get(
|
|
9119
|
+
const iso = byRepoPath.get(relative9(gitRoot, sourcePath));
|
|
9109
9120
|
if (iso) {
|
|
9110
9121
|
result.set(sourcePath, iso);
|
|
9111
9122
|
}
|
|
@@ -9117,7 +9128,7 @@ var gitLastModifiedTimes = (root, contentRoot, sourcePaths) => {
|
|
|
9117
9128
|
};
|
|
9118
9129
|
|
|
9119
9130
|
// src/core/meta.ts
|
|
9120
|
-
import { basename as basename3, dirname as dirname9, relative as
|
|
9131
|
+
import { basename as basename3, dirname as dirname9, relative as relative10 } from "pathe";
|
|
9121
9132
|
import { glob as glob5 } from "tinyglobby";
|
|
9122
9133
|
var META_FILES = [
|
|
9123
9134
|
"**/meta.ts",
|
|
@@ -9147,7 +9158,7 @@ var discoverFolderMeta = async (contentRoot) => {
|
|
|
9147
9158
|
const shared = new Map;
|
|
9148
9159
|
const diagnostics = [];
|
|
9149
9160
|
for (const entry of loaded) {
|
|
9150
|
-
const dir =
|
|
9161
|
+
const dir = relative10(contentRoot, dirname9(entry.file));
|
|
9151
9162
|
if (!entry.ok) {
|
|
9152
9163
|
diagnostics.push({
|
|
9153
9164
|
code: "BLUME_META_LOAD_FAILED",
|
|
@@ -9352,10 +9363,10 @@ import { join as join26 } from "pathe";
|
|
|
9352
9363
|
// src/core/sources/filesystem.ts
|
|
9353
9364
|
import { existsSync as existsSync13, watch as fsWatch } from "node:fs";
|
|
9354
9365
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
9355
|
-
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";
|
|
9356
9367
|
import { glob as glob6 } from "tinyglobby";
|
|
9357
9368
|
var filesystemSource = (options) => {
|
|
9358
|
-
const contentRoot =
|
|
9369
|
+
const contentRoot = isAbsolute7(options.root) ? options.root : join19(resolve6(options.projectRoot), options.root);
|
|
9359
9370
|
const load2 = async () => {
|
|
9360
9371
|
const files = await glob6(options.include, {
|
|
9361
9372
|
absolute: true,
|
|
@@ -9372,7 +9383,7 @@ var filesystemSource = (options) => {
|
|
|
9372
9383
|
return {
|
|
9373
9384
|
body: { format, text: parsed.content },
|
|
9374
9385
|
data: parsed.data,
|
|
9375
|
-
ref:
|
|
9386
|
+
ref: relative11(contentRoot, file),
|
|
9376
9387
|
sourcePath: file
|
|
9377
9388
|
};
|
|
9378
9389
|
}));
|
|
@@ -9680,16 +9691,35 @@ var mdxRemoteSource = (options, ctx) => {
|
|
|
9680
9691
|
// src/core/sources/mintlify.ts
|
|
9681
9692
|
import { existsSync as existsSync15, watch as fsWatch2 } from "node:fs";
|
|
9682
9693
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
9683
|
-
import { isAbsolute as
|
|
9694
|
+
import { isAbsolute as isAbsolute9, join as join22, relative as relative15, resolve as resolve8 } from "pathe";
|
|
9684
9695
|
import { glob as glob7 } from "tinyglobby";
|
|
9685
9696
|
|
|
9686
9697
|
// src/migrate/shared.ts
|
|
9687
9698
|
import { existsSync as existsSync14 } from "node:fs";
|
|
9688
9699
|
import { readFile as readFile14, writeFile as writeFile5 } from "node:fs/promises";
|
|
9689
|
-
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
|
|
9690
9720
|
var isInsideRoot2 = (root, candidate) => {
|
|
9691
|
-
const rel =
|
|
9692
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
9721
|
+
const rel = relative12(root, candidate);
|
|
9722
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute8(rel);
|
|
9693
9723
|
};
|
|
9694
9724
|
var writeBlumeConfig = async (root, config) => {
|
|
9695
9725
|
const body = `import { defineConfig } from "blume";
|
|
@@ -9739,6 +9769,14 @@ var rewriteFrameworkScripts = async (root, cli, remove) => {
|
|
|
9739
9769
|
return changed;
|
|
9740
9770
|
};
|
|
9741
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
|
+
};
|
|
9742
9780
|
var attribute = (attrs, name) => {
|
|
9743
9781
|
const match = attrs.match(new RegExp(`\\b${name}=(?:"(?<dq>[^"]*)"|'(?<sq>[^']*)')`, "u"));
|
|
9744
9782
|
return match?.groups?.dq ?? match?.groups?.sq;
|
|
@@ -10135,7 +10173,7 @@ var isLiteralObject = (value) => typeof value === "object" && value !== null &&
|
|
|
10135
10173
|
var asLiteralArray = (value) => Array.isArray(value) ? value : undefined;
|
|
10136
10174
|
|
|
10137
10175
|
// src/migrate/mintlify/content.ts
|
|
10138
|
-
import { dirname as dirname10, join as join21, relative as
|
|
10176
|
+
import { dirname as dirname10, join as join21, relative as relative13 } from "pathe";
|
|
10139
10177
|
var CALLOUT_DIRECTIVES = {
|
|
10140
10178
|
Check: "success",
|
|
10141
10179
|
Danger: "danger",
|
|
@@ -10174,7 +10212,7 @@ var rewriteSnippetImports = (source, options) => {
|
|
|
10174
10212
|
}
|
|
10175
10213
|
const target = join21(options.root, importSource.replace(/^\/+/u, ""));
|
|
10176
10214
|
components.push(importSource.replace(/^\/+/u, ""));
|
|
10177
|
-
let rel =
|
|
10215
|
+
let rel = relative13(dirname10(options.filePath), target);
|
|
10178
10216
|
if (!rel.startsWith(".")) {
|
|
10179
10217
|
rel = `./${rel}`;
|
|
10180
10218
|
}
|
|
@@ -10364,7 +10402,7 @@ var rewriteMintlifySvgIconProps = (source) => {
|
|
|
10364
10402
|
|
|
10365
10403
|
// src/migrate/mintlify/snippets.ts
|
|
10366
10404
|
import { readFile as readFileFromDisk } from "node:fs/promises";
|
|
10367
|
-
import { dirname as dirname11, relative as
|
|
10405
|
+
import { dirname as dirname11, relative as relative14, resolve as resolve7 } from "pathe";
|
|
10368
10406
|
var MARKDOWN_SNIPPET_IMPORT = /^import\s+(?<name>[$A-Z_a-z][$\w]*)\s+from\s+["'](?<source>[^"']+\.mdx?)["'];?\s*$/gmu;
|
|
10369
10407
|
var NAMED_SNIPPET_IMPORT = /^import\s+\{(?<names>[^}]+)\}\s+from\s+["'](?<source>[^"']+\.mdx?)["'];?\s*$/gmu;
|
|
10370
10408
|
var EXPORTED_STRING_CONST = /^export\s+const\s+(?<name>[$A-Z_a-z][$\w]*)\s*=\s*(?:"(?<double>(?:\\.|[^"\\])*)"|'(?<single>(?:\\.|[^'\\])*)'|`(?<template>(?:\\.|[^`\\])*)`)\s*;?\s*$/gmu;
|
|
@@ -10374,14 +10412,14 @@ var GLOBAL_VARIABLE = /\{\{\s*(?<name>[A-Za-z0-9-]+)\s*\}\}/gu;
|
|
|
10374
10412
|
var FRONTMATTER_BLOCK = /^---\r?\n[\s\S]*?\r?\n---\r?\n?/u;
|
|
10375
10413
|
var USER_EXPORT = /^(?:export\s+)?(?:const|let|var)\s+user\s*=|^import\s+\{\s*user\s*\}/mu;
|
|
10376
10414
|
var isInsideRoot3 = (root, candidate) => {
|
|
10377
|
-
const rel =
|
|
10415
|
+
const rel = relative14(root, candidate);
|
|
10378
10416
|
return rel === "" || !rel.startsWith("..") && !rel.startsWith("/");
|
|
10379
10417
|
};
|
|
10380
10418
|
var escapeRegExp2 = (value) => value.replaceAll(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
10381
10419
|
var snippetSelfClosingTagPattern = (name) => new RegExp(`<${escapeRegExp2(name)}(?<attrs>[^>]*?)\\s*/>`, "gu");
|
|
10382
10420
|
var snippetPairedTagPattern = (name) => new RegExp(`<${escapeRegExp2(name)}(?<attrs>[^>]*?)>[\\s\\S]*?</${escapeRegExp2(name)}>`, "gu");
|
|
10383
10421
|
var rootRelativePath = (root, file) => {
|
|
10384
|
-
const rel =
|
|
10422
|
+
const rel = relative14(root, file);
|
|
10385
10423
|
return rel ? `/${rel}` : "/";
|
|
10386
10424
|
};
|
|
10387
10425
|
var snippetCycleMessage = (root, file, trail) => {
|
|
@@ -10584,8 +10622,18 @@ var MINTLIFY_SOURCE_IGNORES = [
|
|
|
10584
10622
|
"public/**",
|
|
10585
10623
|
"snippets/**"
|
|
10586
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
|
+
};
|
|
10587
10635
|
var mintlifySource = (options) => {
|
|
10588
|
-
const contentRoot =
|
|
10636
|
+
const contentRoot = isAbsolute9(options.root) ? options.root : join22(resolve8(options.projectRoot), options.root);
|
|
10589
10637
|
const ignore = [...new Set([...options.exclude, ...MINTLIFY_SOURCE_IGNORES])];
|
|
10590
10638
|
const transform = (raw, file) => transformMintlifyContent(raw, {
|
|
10591
10639
|
filePath: file,
|
|
@@ -10611,7 +10659,7 @@ var mintlifySource = (options) => {
|
|
|
10611
10659
|
body: { format: "mdx", text: parsed.content },
|
|
10612
10660
|
data: parsed.data,
|
|
10613
10661
|
raw: result.content,
|
|
10614
|
-
ref:
|
|
10662
|
+
ref: relative15(contentRoot, file),
|
|
10615
10663
|
sourcePath: file
|
|
10616
10664
|
};
|
|
10617
10665
|
}));
|
|
@@ -10638,7 +10686,7 @@ var mintlifySource = (options) => {
|
|
|
10638
10686
|
const watch = (onChange) => {
|
|
10639
10687
|
const disposers = [];
|
|
10640
10688
|
if (existsSync15(contentRoot)) {
|
|
10641
|
-
const watcher = fsWatch2(contentRoot, { recursive: true }, onChange);
|
|
10689
|
+
const watcher = fsWatch2(contentRoot, { recursive: true }, mintlifyWatchListener(onChange));
|
|
10642
10690
|
disposers.push(() => watcher.close());
|
|
10643
10691
|
}
|
|
10644
10692
|
if (options.configFile && existsSync15(options.configFile)) {
|
|
@@ -11845,7 +11893,7 @@ import { dev } from "astro";
|
|
|
11845
11893
|
import { defineCommand as defineCommand4 } from "citty";
|
|
11846
11894
|
|
|
11847
11895
|
// src/astro/static-assets.ts
|
|
11848
|
-
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";
|
|
11849
11897
|
|
|
11850
11898
|
// src/astro/integration.ts
|
|
11851
11899
|
var overlayServer = null;
|
|
@@ -12073,12 +12121,12 @@ var doctorCommand = defineCommand5({
|
|
|
12073
12121
|
// src/cli/commands/eject.ts
|
|
12074
12122
|
import { readFile as readFile17, writeFile as writeFile9 } from "node:fs/promises";
|
|
12075
12123
|
import { defineCommand as defineCommand6 } from "citty";
|
|
12076
|
-
import { join as join32, relative as
|
|
12124
|
+
import { join as join32, relative as relative18 } from "pathe";
|
|
12077
12125
|
|
|
12078
12126
|
// src/registry/eject.ts
|
|
12079
12127
|
import { existsSync as existsSync19 } from "node:fs";
|
|
12080
12128
|
import { cp, mkdir as mkdir5, readFile as readFile16, rm as rm2, writeFile as writeFile8 } from "node:fs/promises";
|
|
12081
|
-
import { join as join31, relative as
|
|
12129
|
+
import { join as join31, relative as relative17 } from "pathe";
|
|
12082
12130
|
var POSIX = (path) => path.split("\\").join("/");
|
|
12083
12131
|
var ejectOpenApiData = (project) => {
|
|
12084
12132
|
const source = project.sources.find(isOpenApiSource);
|
|
@@ -12130,13 +12178,13 @@ var eject = async (root) => {
|
|
|
12130
12178
|
const needsSvelte = frameworks.has("svelte");
|
|
12131
12179
|
const relContext = {
|
|
12132
12180
|
...context,
|
|
12133
|
-
contentRoot: POSIX(
|
|
12181
|
+
contentRoot: POSIX(relative17(root, context.contentRoot)),
|
|
12134
12182
|
outDir: ".",
|
|
12135
12183
|
root: "."
|
|
12136
12184
|
};
|
|
12137
|
-
const componentsImport = context.componentsFile ? `../../${POSIX(
|
|
12185
|
+
const componentsImport = context.componentsFile ? `../../${POSIX(relative17(root, context.componentsFile))}` : null;
|
|
12138
12186
|
const relPages = pages.map((page) => ({
|
|
12139
|
-
entrypoint: POSIX(
|
|
12187
|
+
entrypoint: POSIX(relative17(root, page.entrypoint)),
|
|
12140
12188
|
pattern: page.pattern
|
|
12141
12189
|
}));
|
|
12142
12190
|
const staged = collectStaged(project);
|
|
@@ -12354,7 +12402,7 @@ var ejectCommand = defineCommand6({
|
|
|
12354
12402
|
await updatePackageScripts(root);
|
|
12355
12403
|
logger.success(`Ejected ${files.length} file(s):`);
|
|
12356
12404
|
for (const file of files) {
|
|
12357
|
-
process.stdout.write(` ${
|
|
12405
|
+
process.stdout.write(` ${relative18(root, file)}
|
|
12358
12406
|
`);
|
|
12359
12407
|
}
|
|
12360
12408
|
logger.box(`Your project is now a standalone Astro app.
|
|
@@ -12370,22 +12418,7 @@ The blume package remains importable.`);
|
|
|
12370
12418
|
import { existsSync as existsSync20 } from "node:fs";
|
|
12371
12419
|
import { mkdir as mkdir6, writeFile as writeFile10 } from "node:fs/promises";
|
|
12372
12420
|
import { defineCommand as defineCommand7 } from "citty";
|
|
12373
|
-
import { basename as
|
|
12374
|
-
var toPackageName = (raw) => raw.toLowerCase().replaceAll(/[^a-z0-9._-]+/gu, "-").replaceAll(/^[-_.]+|[-_.]+$/gu, "") || "docs";
|
|
12375
|
-
var packageTemplate = (name, version) => `{
|
|
12376
|
-
"name": ${JSON.stringify(name)},
|
|
12377
|
-
"private": true,
|
|
12378
|
-
"type": "module",
|
|
12379
|
-
"scripts": {
|
|
12380
|
-
"dev": "blume dev",
|
|
12381
|
-
"build": "blume build",
|
|
12382
|
-
"doctor": "blume doctor"
|
|
12383
|
-
},
|
|
12384
|
-
"dependencies": {
|
|
12385
|
-
"blume": "^${version}"
|
|
12386
|
-
}
|
|
12387
|
-
}
|
|
12388
|
-
`;
|
|
12421
|
+
import { basename as basename5, dirname as dirname13, isAbsolute as isAbsolute10, join as join33, relative as relative19 } from "pathe";
|
|
12389
12422
|
var TEMPLATES = ["docs", "api", "sdk", "changelog"];
|
|
12390
12423
|
var PACKAGE_MANAGERS = ["npm", "pnpm", "yarn", "bun"];
|
|
12391
12424
|
var configFor = (extra) => `import { defineConfig } from "blume";
|
|
@@ -12519,7 +12552,7 @@ var initCommand = defineCommand7({
|
|
|
12519
12552
|
async run({ args }) {
|
|
12520
12553
|
const root = process.cwd();
|
|
12521
12554
|
const contentDir = args["content-dir"] ?? "docs";
|
|
12522
|
-
if (
|
|
12555
|
+
if (isAbsolute10(contentDir) || relative19(root, join33(root, contentDir)).startsWith("..")) {
|
|
12523
12556
|
logger.error(`Invalid --content-dir "${contentDir}" (must be a path inside the project).`);
|
|
12524
12557
|
process.exit(1);
|
|
12525
12558
|
}
|
|
@@ -12534,7 +12567,7 @@ var initCommand = defineCommand7({
|
|
|
12534
12567
|
process.exit(1);
|
|
12535
12568
|
}
|
|
12536
12569
|
const starter = STARTERS[template];
|
|
12537
|
-
const createdPackage = await writeFileSafe(join33(root, "package.json"),
|
|
12570
|
+
const createdPackage = await writeFileSafe(join33(root, "package.json"), blumePackageJson(toPackageName(basename5(root))));
|
|
12538
12571
|
await writeFileSafe(join33(root, "blume.config.ts"), starter.config);
|
|
12539
12572
|
await Promise.all(starter.files(contentDir).map((file) => writeFileSafe(join33(root, file.path), file.content)));
|
|
12540
12573
|
const ignored = await ensureGitignore(root, [".blume/", "dist/"]);
|
|
@@ -12579,13 +12612,13 @@ import { defineCommand as defineCommand8 } from "citty";
|
|
|
12579
12612
|
// src/migrate/fumadocs/index.ts
|
|
12580
12613
|
import { existsSync as existsSync24 } from "node:fs";
|
|
12581
12614
|
import { mkdir as mkdir8, readFile as readFile19, rename as rename3, rm as rm3, writeFile as writeFile12 } from "node:fs/promises";
|
|
12582
|
-
import { dirname as dirname16, join as join36, relative as
|
|
12615
|
+
import { dirname as dirname16, join as join36, relative as relative20 } from "pathe";
|
|
12583
12616
|
import { glob as glob8 } from "tinyglobby";
|
|
12584
12617
|
|
|
12585
12618
|
// src/migrate/fumadocs/config.ts
|
|
12586
12619
|
import { existsSync as existsSync21 } from "node:fs";
|
|
12587
12620
|
import { readFile as readFile18 } from "node:fs/promises";
|
|
12588
|
-
import { basename as
|
|
12621
|
+
import { basename as basename6, dirname as dirname14, join as join34 } from "pathe";
|
|
12589
12622
|
var SOURCE_FILES = [
|
|
12590
12623
|
"lib/source.ts",
|
|
12591
12624
|
"app/source.ts",
|
|
@@ -12640,7 +12673,7 @@ var readTitle = async (root) => {
|
|
|
12640
12673
|
if (GENERIC_NAMES.has(bareName(name).toLowerCase())) {
|
|
12641
12674
|
const repoRoot = gitRepoRoot(root);
|
|
12642
12675
|
if (repoRoot && repoRoot !== root) {
|
|
12643
|
-
const repoTitle = prettifyTitle(
|
|
12676
|
+
const repoTitle = prettifyTitle(basename6(repoRoot));
|
|
12644
12677
|
if (repoTitle !== "Documentation") {
|
|
12645
12678
|
return repoTitle;
|
|
12646
12679
|
}
|
|
@@ -12932,7 +12965,7 @@ var normalizeFumadocsPageMeta = (value) => {
|
|
|
12932
12965
|
// src/migrate/fumadocs/groups.ts
|
|
12933
12966
|
import { existsSync as existsSync23, statSync as statSync2 } from "node:fs";
|
|
12934
12967
|
import { mkdir as mkdir7, rename as rename2, writeFile as writeFile11 } from "node:fs/promises";
|
|
12935
|
-
import { basename as
|
|
12968
|
+
import { basename as basename7, join as join35 } from "pathe";
|
|
12936
12969
|
|
|
12937
12970
|
// src/migrate/fumadocs/meta.ts
|
|
12938
12971
|
var SEPARATOR = /^---(?<label>.*)---$/u;
|
|
@@ -13121,7 +13154,7 @@ var moveItemIntoGroup = async (item, docsDir, groupDir, label, warnings) => {
|
|
|
13121
13154
|
warnings.push(`Sidebar entry "${item.name}" in section "${label}" matched no page or folder; skipped.`);
|
|
13122
13155
|
return null;
|
|
13123
13156
|
}
|
|
13124
|
-
const dest = join35(groupDir,
|
|
13157
|
+
const dest = join35(groupDir, basename7(resolved.path));
|
|
13125
13158
|
if (existsSync23(dest)) {
|
|
13126
13159
|
warnings.push(`Skipped moving "${item.name}" into section "${label}" (target already exists).`);
|
|
13127
13160
|
return null;
|
|
@@ -13194,7 +13227,7 @@ var FUMADOCS_LEFTOVERS = [
|
|
|
13194
13227
|
"app"
|
|
13195
13228
|
];
|
|
13196
13229
|
var movePage = async (abs, base, root) => {
|
|
13197
|
-
const rel =
|
|
13230
|
+
const rel = relative20(base, abs);
|
|
13198
13231
|
const dest = join36(root, "docs", rel);
|
|
13199
13232
|
if (existsSync24(dest)) {
|
|
13200
13233
|
return {
|
|
@@ -13241,7 +13274,7 @@ var writeMeta = async (dest, meta, rel, warnings) => {
|
|
|
13241
13274
|
return warnings;
|
|
13242
13275
|
};
|
|
13243
13276
|
var convertMeta = async (abs, base, root) => {
|
|
13244
|
-
const rel =
|
|
13277
|
+
const rel = relative20(base, abs);
|
|
13245
13278
|
const raw = await readFile19(abs, "utf-8");
|
|
13246
13279
|
let parsed;
|
|
13247
13280
|
try {
|
|
@@ -13491,6 +13524,15 @@ var applyRelocatedAssets = (config, assets, warnings) => {
|
|
|
13491
13524
|
warnings.push(`Moved assets into public/: ${assets.moved.join(", ")}.`);
|
|
13492
13525
|
}
|
|
13493
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
|
+
};
|
|
13494
13536
|
var cleanupSnippets = async (root, kept, warnings) => {
|
|
13495
13537
|
const dir = join37(root, "snippets");
|
|
13496
13538
|
if (!existsSync25(dir)) {
|
|
@@ -13582,6 +13624,7 @@ var migrateMintlifyProject = async (root) => {
|
|
|
13582
13624
|
}
|
|
13583
13625
|
applyRelocatedAssets(config, assets, warnings);
|
|
13584
13626
|
await writeBlumeConfig2(root, config);
|
|
13627
|
+
await scaffoldProjectFiles(root, warnings);
|
|
13585
13628
|
if (Object.keys(variables).length > 0) {
|
|
13586
13629
|
warnings.push(`Inlined ${Object.keys(variables).length} docs.json variable(s) into content; Blume has no runtime variable substitution.`);
|
|
13587
13630
|
}
|
|
@@ -13598,7 +13641,7 @@ var migrateMintlifyProject = async (root) => {
|
|
|
13598
13641
|
// src/migrate/nextra/index.ts
|
|
13599
13642
|
import { existsSync as existsSync26 } from "node:fs";
|
|
13600
13643
|
import { mkdir as mkdir10, readFile as readFile21, rename as rename5, rm as rm5, writeFile as writeFile14 } from "node:fs/promises";
|
|
13601
|
-
import { basename as
|
|
13644
|
+
import { basename as basename8, dirname as dirname18, extname as extname8, join as join38, relative as relative21 } from "pathe";
|
|
13602
13645
|
import { glob as glob10 } from "tinyglobby";
|
|
13603
13646
|
|
|
13604
13647
|
// src/migrate/nextra/content.ts
|
|
@@ -13833,16 +13876,16 @@ var indexFolders = (base, pageFiles, metaFiles) => {
|
|
|
13833
13876
|
}
|
|
13834
13877
|
};
|
|
13835
13878
|
for (const abs of pageFiles) {
|
|
13836
|
-
const rel =
|
|
13879
|
+
const rel = relative21(base, abs);
|
|
13837
13880
|
const dir = normalizeDir(dirname18(rel));
|
|
13838
|
-
const slug =
|
|
13881
|
+
const slug = basename8(rel).replace(/\.mdx?$/u, "");
|
|
13839
13882
|
const folder = pagesByDir.get(dir) ?? new Map;
|
|
13840
13883
|
folder.set(slug, abs);
|
|
13841
13884
|
pagesByDir.set(dir, folder);
|
|
13842
13885
|
registerDir(dir);
|
|
13843
13886
|
}
|
|
13844
13887
|
for (const abs of metaFiles) {
|
|
13845
|
-
registerDir(normalizeDir(dirname18(
|
|
13888
|
+
registerDir(normalizeDir(dirname18(relative21(base, abs))));
|
|
13846
13889
|
}
|
|
13847
13890
|
const childDirs = new Map;
|
|
13848
13891
|
for (const dir of allDirs) {
|
|
@@ -13851,7 +13894,7 @@ var indexFolders = (base, pageFiles, metaFiles) => {
|
|
|
13851
13894
|
}
|
|
13852
13895
|
const parent = normalizeDir(dirname18(dir));
|
|
13853
13896
|
const children = childDirs.get(parent) ?? new Set;
|
|
13854
|
-
children.add(
|
|
13897
|
+
children.add(basename8(dir));
|
|
13855
13898
|
childDirs.set(parent, children);
|
|
13856
13899
|
}
|
|
13857
13900
|
return { childDirs, pagesByDir };
|
|
@@ -13904,7 +13947,7 @@ var planMetas = (metas, index) => {
|
|
|
13904
13947
|
return plan;
|
|
13905
13948
|
};
|
|
13906
13949
|
var movePage2 = async (abs, options) => {
|
|
13907
|
-
const rel =
|
|
13950
|
+
const rel = relative21(options.base, abs);
|
|
13908
13951
|
const dest = join38(options.root, "docs", rel);
|
|
13909
13952
|
if (existsSync26(dest)) {
|
|
13910
13953
|
return { moved: 0, removed: [], skipped: rel, unsupported: [] };
|
|
@@ -14008,7 +14051,7 @@ var migrateNextraProject = async (root) => {
|
|
|
14008
14051
|
abs,
|
|
14009
14052
|
ext: extname8(abs),
|
|
14010
14053
|
raw: await readFile21(abs, "utf-8"),
|
|
14011
|
-
rel:
|
|
14054
|
+
rel: relative21(base, abs)
|
|
14012
14055
|
})));
|
|
14013
14056
|
const plan = planMetas(metas, index);
|
|
14014
14057
|
const moves = await Promise.all(pageFiles.map((abs) => movePage2(abs, { base, overrides: plan.pageOverrides, root })));
|
|
@@ -14668,7 +14711,7 @@ import { join as join44 } from "pathe";
|
|
|
14668
14711
|
|
|
14669
14712
|
// src/core/links.ts
|
|
14670
14713
|
import { existsSync as existsSync30 } from "node:fs";
|
|
14671
|
-
import { basename as
|
|
14714
|
+
import { basename as basename9, join as join43 } from "pathe";
|
|
14672
14715
|
var HTTP = /^https?:\/\//iu;
|
|
14673
14716
|
var PROTOCOL_RELATIVE = /^\/\//u;
|
|
14674
14717
|
var SCHEME = /^[a-z][a-z0-9+.-]*:/iu;
|
|
@@ -14688,7 +14731,7 @@ var assetIsPresent = (resolved, ctx) => {
|
|
|
14688
14731
|
};
|
|
14689
14732
|
var isIndexPage = (page2) => {
|
|
14690
14733
|
const ref = page2.source?.ref ?? page2.sourcePath ?? "";
|
|
14691
|
-
return /^index\.(?:md|mdx)$/iu.test(
|
|
14734
|
+
return /^index\.(?:md|mdx)$/iu.test(basename9(ref));
|
|
14692
14735
|
};
|
|
14693
14736
|
var resolveRelative = (pageRoute, target, isIndex) => {
|
|
14694
14737
|
const segments = pageRoute.split("/").filter(Boolean);
|
|
@@ -14994,5 +15037,5 @@ process.on("unhandledRejection", (error) => {
|
|
|
14994
15037
|
});
|
|
14995
15038
|
runMain(main);
|
|
14996
15039
|
|
|
14997
|
-
//# debugId=
|
|
15040
|
+
//# debugId=19E77FB94468BA6064756E2164756E21
|
|
14998
15041
|
//# sourceMappingURL=index.js.map
|