blume 1.6.4 → 1.6.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/CHANGELOG.md +41 -0
- package/bin/blume.mjs +3 -2
- package/dist/cli/chunk-0ewz4trd.js +679 -0
- package/dist/cli/chunk-0ewz4trd.js.map +15 -0
- package/dist/cli/chunk-27gtm2ym.js +69 -0
- package/dist/cli/chunk-27gtm2ym.js.map +11 -0
- package/dist/cli/chunk-2aj8ddew.js +72 -0
- package/dist/cli/chunk-2aj8ddew.js.map +10 -0
- package/dist/cli/chunk-3k0kzs6d.js +69 -0
- package/dist/cli/chunk-3k0kzs6d.js.map +11 -0
- package/dist/cli/chunk-3r94j3tc.js +221 -0
- package/dist/cli/chunk-3r94j3tc.js.map +10 -0
- package/dist/cli/chunk-4trphnvy.js +102 -0
- package/dist/cli/chunk-4trphnvy.js.map +11 -0
- package/dist/cli/chunk-4xyggvgf.js +21 -0
- package/dist/cli/chunk-4xyggvgf.js.map +10 -0
- package/dist/cli/chunk-5hs6gb7n.js +32 -0
- package/dist/cli/chunk-5hs6gb7n.js.map +10 -0
- package/dist/cli/chunk-5yvt556e.js +185 -0
- package/dist/cli/chunk-5yvt556e.js.map +11 -0
- package/dist/cli/chunk-62qsssnh.js +3808 -0
- package/dist/cli/chunk-62qsssnh.js.map +36 -0
- package/dist/cli/chunk-6kzzpsx8.js +26 -0
- package/dist/cli/chunk-6kzzpsx8.js.map +10 -0
- package/dist/cli/chunk-8gnpdsn1.js +952 -0
- package/dist/cli/chunk-8gnpdsn1.js.map +12 -0
- package/dist/cli/chunk-9sh49q0h.js +30 -0
- package/dist/cli/chunk-9sh49q0h.js.map +10 -0
- package/dist/cli/chunk-aerwpe14.js +2370 -0
- package/dist/cli/chunk-aerwpe14.js.map +15 -0
- package/dist/cli/chunk-ag1zyr5x.js +176 -0
- package/dist/cli/chunk-ag1zyr5x.js.map +10 -0
- package/dist/cli/chunk-bawgnt8x.js +277 -0
- package/dist/cli/chunk-bawgnt8x.js.map +11 -0
- package/dist/cli/chunk-bcy492zc.js +16 -0
- package/dist/cli/chunk-bcy492zc.js.map +10 -0
- package/dist/cli/chunk-btfr9yvw.js +41 -0
- package/dist/cli/chunk-btfr9yvw.js.map +10 -0
- package/dist/cli/chunk-cbjnx4s8.js +73 -0
- package/dist/cli/chunk-cbjnx4s8.js.map +10 -0
- package/dist/cli/chunk-cnvm6k3e.js +96 -0
- package/dist/cli/chunk-cnvm6k3e.js.map +10 -0
- package/dist/cli/chunk-etsqspj6.js +5170 -0
- package/dist/cli/chunk-etsqspj6.js.map +47 -0
- package/dist/cli/chunk-ev67ycx0.js +15 -0
- package/dist/cli/chunk-ev67ycx0.js.map +10 -0
- package/dist/cli/chunk-ey89bjj1.js +209 -0
- package/dist/cli/chunk-ey89bjj1.js.map +11 -0
- package/dist/cli/chunk-f75cqye8.js +76 -0
- package/dist/cli/chunk-f75cqye8.js.map +10 -0
- package/dist/cli/chunk-j00ezcg5.js +259 -0
- package/dist/cli/chunk-j00ezcg5.js.map +11 -0
- package/dist/cli/chunk-jtb45atp.js +467 -0
- package/dist/cli/chunk-jtb45atp.js.map +14 -0
- package/dist/cli/chunk-m3p3wahd.js +117 -0
- package/dist/cli/chunk-m3p3wahd.js.map +10 -0
- package/dist/cli/chunk-n0y172hf.js +387 -0
- package/dist/cli/chunk-n0y172hf.js.map +12 -0
- package/dist/cli/chunk-n4qjabmt.js +1062 -0
- package/dist/cli/chunk-n4qjabmt.js.map +25 -0
- package/dist/cli/chunk-nyqzjdhj.js +111 -0
- package/dist/cli/chunk-nyqzjdhj.js.map +11 -0
- package/dist/cli/chunk-pxj10x8y.js +35 -0
- package/dist/cli/chunk-pxj10x8y.js.map +10 -0
- package/dist/cli/chunk-s4jn7f1q.js +54 -0
- package/dist/cli/chunk-s4jn7f1q.js.map +10 -0
- package/dist/cli/chunk-s4k1pnvf.js +81 -0
- package/dist/cli/chunk-s4k1pnvf.js.map +10 -0
- package/dist/cli/chunk-s5e5jt53.js +227 -0
- package/dist/cli/chunk-s5e5jt53.js.map +11 -0
- package/dist/cli/chunk-sbdqrjbb.js +81 -0
- package/dist/cli/chunk-sbdqrjbb.js.map +10 -0
- package/dist/cli/chunk-tc89yh2r.js +136 -0
- package/dist/cli/chunk-tc89yh2r.js.map +10 -0
- package/dist/cli/chunk-vt8fgygt.js +23 -0
- package/dist/cli/chunk-vt8fgygt.js.map +10 -0
- package/dist/cli/chunk-vv237fp3.js +1002 -0
- package/dist/cli/chunk-vv237fp3.js.map +13 -0
- package/dist/cli/chunk-vv3f8mb6.js +5314 -0
- package/dist/cli/chunk-vv3f8mb6.js.map +58 -0
- package/dist/cli/chunk-vxv4x1n8.js +17 -0
- package/dist/cli/chunk-vxv4x1n8.js.map +10 -0
- package/dist/cli/chunk-wb067mv3.js +758 -0
- package/dist/cli/chunk-wb067mv3.js.map +13 -0
- package/dist/cli/chunk-wd27zjcz.js +60 -0
- package/dist/cli/chunk-wd27zjcz.js.map +10 -0
- package/dist/cli/chunk-wkq5tbtq.js +1141 -0
- package/dist/cli/chunk-wkq5tbtq.js.map +19 -0
- package/dist/cli/chunk-x1vrdjyk.js +1967 -0
- package/dist/cli/chunk-x1vrdjyk.js.map +34 -0
- package/dist/cli/chunk-x66c5yjn.js +23 -0
- package/dist/cli/chunk-x66c5yjn.js.map +10 -0
- package/dist/cli/index.js +55 -27587
- package/dist/cli/index.js.map +5 -243
- package/dist/types/ai/ask-context.d.ts +26 -0
- package/dist/types/core/code-fences.d.ts +11 -0
- package/dist/types/core/config-input.d.ts +10 -0
- package/dist/types/core/package-root.d.ts +1 -1
- package/dist/types/core/schema.d.ts +74 -1
- package/docs/02-deployment.mdx +1 -1
- package/docs/configuration/analytics.mdx +21 -2
- package/docs/configuration/ask-ai.mdx +1 -1
- package/docs/configuration/customization.mdx +2 -9
- package/docs/content/syntax.mdx +1 -1
- package/docs/reference/cli.mdx +1 -1
- package/package.json +16 -14
- package/src/ai/api/handlers.ts +4 -7
- package/src/ai/api/paths.ts +8 -0
- package/src/ai/api/spec.ts +2 -1
- package/src/ai/ask-context.ts +378 -22
- package/src/astro/generate.ts +25 -29
- package/src/astro/include-hmr.ts +10 -13
- package/src/astro/include-refresh.ts +0 -0
- package/src/astro/index.ts +6 -1
- package/src/astro/integration.ts +269 -53
- package/src/astro/module-types.ts +74 -0
- package/src/astro/templates.ts +85 -97
- package/src/audit/image-size.ts +10 -8
- package/src/cli/command-meta.ts +77 -0
- package/src/cli/commands/add.ts +2 -4
- package/src/cli/commands/audit.ts +2 -4
- package/src/cli/commands/build.ts +42 -346
- package/src/cli/commands/check.ts +2 -4
- package/src/cli/commands/dev.ts +31 -42
- package/src/cli/commands/doctor.ts +2 -4
- package/src/cli/commands/eject.ts +3 -41
- package/src/cli/commands/eval.ts +2 -5
- package/src/cli/commands/init.ts +2 -4
- package/src/cli/commands/mcp-stdio.ts +2 -5
- package/src/cli/commands/preview.ts +3 -5
- package/src/cli/commands/sync.ts +2 -4
- package/src/cli/commands/translate.ts +2 -5
- package/src/cli/commands/validate.ts +2 -4
- package/src/cli/commands/version.ts +2 -4
- package/src/cli/eject-scripts.ts +0 -45
- package/src/cli/host-args.ts +16 -0
- package/src/cli/index.ts +84 -35
- package/src/cli/lazy-command.ts +47 -0
- package/src/components/content/GithubInfo.astro +4 -1
- package/src/components/content/mermaid-element.ts +8 -0
- package/src/components/layout/Analytics.astro +20 -1
- package/src/components/layout/PageLayout.astro +14 -3
- package/src/components/layout/ReferenceLayout.astro +15 -4
- package/src/components/layout/RootLayout.astro +15 -4
- package/src/components/layout/analytics-client.ts +2 -1
- package/src/components/layout/page-locale.ts +29 -0
- package/src/components/openapi/AsyncApiOperation.astro +5 -3
- package/src/components/openapi/Authorization.astro +4 -6
- package/src/components/openapi/Bindings.astro +2 -2
- package/src/components/openapi/Description.astro +109 -0
- package/src/components/openapi/GraphqlFieldsTable.astro +5 -7
- package/src/components/openapi/GraphqlOperation.astro +4 -3
- package/src/components/openapi/GraphqlType.astro +4 -6
- package/src/components/openapi/ParametersTable.astro +5 -7
- package/src/components/openapi/RequestBody.astro +2 -4
- package/src/components/openapi/Responses.astro +4 -3
- package/src/components/openapi/SchemaProperty.astro +11 -6
- package/src/components/openapi/description.ts +91 -0
- package/src/core/api-name.ts +18 -0
- package/src/core/code-fences.ts +48 -0
- package/src/core/config-input.ts +10 -0
- package/src/core/content-assets.ts +3 -7
- package/src/core/includes.ts +3 -7
- package/src/core/package-root.ts +1 -1
- package/src/core/schema.ts +27 -0
- package/src/core/sources/normalize.ts +2 -37
- package/src/core/sources/obsidian.ts +3 -2
- package/src/core/svg-dimensions.ts +97 -0
- package/src/core/version-cut.ts +2 -2
- package/src/deploy/artifacts.ts +370 -0
- package/src/deploy/cloudflare-negotiation.ts +97 -32
- package/src/deploy/function-bundle.ts +66 -20
- package/src/deploy/sitemap.ts +6 -0
- package/src/deploy/vercel-negotiation.ts +8 -30
- package/src/og/card.ts +6 -12
- package/src/openapi/render-mdx.ts +9 -5
- package/src/registry/eject.ts +0 -2
- package/src/theme/entry.ts +9 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/core/fs-atomic.ts
|
|
4
|
+
import { mkdir } from "node:fs/promises";
|
|
5
|
+
import { dirname } from "pathe";
|
|
6
|
+
import writeFileAtomic from "write-file-atomic";
|
|
7
|
+
var writeTextAtomic = async (path, text) => {
|
|
8
|
+
await mkdir(dirname(path), { recursive: true });
|
|
9
|
+
await writeFileAtomic(path, text, { encoding: "utf-8", fsync: false });
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { writeTextAtomic };
|
|
13
|
+
|
|
14
|
+
//# debugId=33DFD366D208CE0864756E2164756E21
|
|
15
|
+
//# sourceMappingURL=chunk-ev67ycx0.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/fs-atomic.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { mkdir } from \"node:fs/promises\";\n\nimport { dirname } from \"pathe\";\nimport writeFileAtomic from \"write-file-atomic\";\n\n/**\n * Write text to `path` atomically (unique temp file + rename) after ensuring\n * the parent directory exists, so a concurrent reader or file watcher never\n * observes a missing or half-written file. write-file-atomic's temp names are\n * unique per call — a pid-suffixed temp name is not, and two concurrent\n * writers to the same target in one process (translate lanes, staged-content\n * writes) would interleave through a shared temp file. `fsync` is off to\n * match the previous behavior: the point is watcher atomicity, not crash\n * durability, and a per-file fsync would slow dev regeneration.\n */\nexport const writeTextAtomic = async (\n path: string,\n text: string\n): Promise<void> => {\n await mkdir(dirname(path), { recursive: true });\n await writeFileAtomic(path, text, { encoding: \"utf-8\", fsync: false });\n};\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;AAAA;AAEA;AACA;AAYO,IAAM,kBAAkB,OAC7B,MACA,SACkB;AAAA,EAClB,MAAM,MAAM,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;AAAA,EAC9C,MAAM,gBAAgB,MAAM,MAAM,EAAE,UAAU,SAAS,OAAO,MAAM,CAAC;AAAA;",
|
|
8
|
+
"debugId": "33DFD366D208CE0864756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/core/diagnostics.ts
|
|
4
|
+
import { colors } from "consola/utils";
|
|
5
|
+
import { relative } from "pathe";
|
|
6
|
+
|
|
7
|
+
class BlumeError extends Error {
|
|
8
|
+
diagnostic;
|
|
9
|
+
constructor(diagnostic) {
|
|
10
|
+
super(diagnostic.message);
|
|
11
|
+
this.name = "BlumeError";
|
|
12
|
+
this.diagnostic = diagnostic;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
var DOCS_BASE = "https://useblume.dev";
|
|
16
|
+
var DOCS_DEPLOYMENT = "/docs/deployment";
|
|
17
|
+
var DOCS_REFERENCE_CLI = "/docs/reference/cli";
|
|
18
|
+
var DOCS_CONTENT_SOURCES = "/docs/content/sources";
|
|
19
|
+
var DOCS_CONTENT_NAVIGATION = "/docs/content/navigation";
|
|
20
|
+
var DOCS_CONTENT_INCLUDES = "/docs/content/includes";
|
|
21
|
+
var DOCS_PATHS = new Map(Object.entries({
|
|
22
|
+
BLUME_ADAPTER_REQUIRED: DOCS_DEPLOYMENT,
|
|
23
|
+
BLUME_ASSETS_UNCHECKED: DOCS_REFERENCE_CLI,
|
|
24
|
+
BLUME_ASSET_FETCH_FAILED: DOCS_CONTENT_SOURCES,
|
|
25
|
+
BLUME_BROKEN_ANCHOR: DOCS_REFERENCE_CLI,
|
|
26
|
+
BLUME_BROKEN_ASSET: DOCS_REFERENCE_CLI,
|
|
27
|
+
BLUME_BROKEN_LINK: DOCS_REFERENCE_CLI,
|
|
28
|
+
BLUME_CONFIG_INVALID: "/docs/configuration",
|
|
29
|
+
BLUME_CONFIG_LOAD_FAILED: "/docs/configuration",
|
|
30
|
+
BLUME_CONTENT_ROOT_MISSING: DOCS_CONTENT_SOURCES,
|
|
31
|
+
BLUME_DEAD_LINK: DOCS_REFERENCE_CLI,
|
|
32
|
+
BLUME_DUPLICATE_ROUTE: DOCS_CONTENT_NAVIGATION,
|
|
33
|
+
BLUME_DUPLICATE_SIDEBAR_ORDER: DOCS_CONTENT_NAVIGATION,
|
|
34
|
+
BLUME_FRONTMATTER_INVALID: "/docs/reference/frontmatter",
|
|
35
|
+
BLUME_INCLUDE_CYCLE: DOCS_CONTENT_INCLUDES,
|
|
36
|
+
BLUME_INCLUDE_NOT_FOUND: DOCS_CONTENT_INCLUDES,
|
|
37
|
+
BLUME_INCLUDE_OUTSIDE_ROOT: DOCS_CONTENT_INCLUDES,
|
|
38
|
+
BLUME_MDX_CURLY_ANCHOR: "/docs/content/syntax",
|
|
39
|
+
BLUME_META_INVALID: "/docs/content/meta",
|
|
40
|
+
BLUME_META_LOAD_FAILED: "/docs/content/meta",
|
|
41
|
+
BLUME_MISSING_SECRET: DOCS_DEPLOYMENT,
|
|
42
|
+
BLUME_NAV_DUPLICATE_LABEL: DOCS_CONTENT_NAVIGATION,
|
|
43
|
+
BLUME_NAV_HIDDEN_IN_SIDEBAR: DOCS_CONTENT_NAVIGATION,
|
|
44
|
+
BLUME_NAV_INDEX_TITLE_MISMATCH: DOCS_CONTENT_NAVIGATION,
|
|
45
|
+
BLUME_NAV_MISSING_PAGE: DOCS_CONTENT_NAVIGATION,
|
|
46
|
+
BLUME_NODE_VERSION: "/docs/quickstart",
|
|
47
|
+
BLUME_SERVER_FEATURE_REQUIRED: DOCS_DEPLOYMENT,
|
|
48
|
+
BLUME_SIDEBAR_DISPLAY_IGNORED: DOCS_CONTENT_NAVIGATION,
|
|
49
|
+
BLUME_SOURCE_FETCH_FAILED: DOCS_CONTENT_SOURCES,
|
|
50
|
+
BLUME_SOURCE_MISCONFIGURED: DOCS_CONTENT_SOURCES,
|
|
51
|
+
BLUME_SOURCE_OFFLINE: DOCS_CONTENT_SOURCES,
|
|
52
|
+
BLUME_SOURCE_SDK_MISSING: DOCS_CONTENT_SOURCES,
|
|
53
|
+
BLUME_SOURCE_UNAVAILABLE: DOCS_CONTENT_SOURCES,
|
|
54
|
+
BLUME_UNKNOWN_COMPONENT: "/docs/configuration/customization",
|
|
55
|
+
BLUME_UNKNOWN_ICON: DOCS_CONTENT_NAVIGATION,
|
|
56
|
+
BLUME_WIKILINK_AMBIGUOUS: DOCS_CONTENT_SOURCES,
|
|
57
|
+
BLUME_WIKILINK_UNRESOLVED: DOCS_CONTENT_SOURCES
|
|
58
|
+
}));
|
|
59
|
+
var resolveDocsUrl = (code) => {
|
|
60
|
+
const path = DOCS_PATHS.get(code);
|
|
61
|
+
return path ? `${DOCS_BASE}${path}` : undefined;
|
|
62
|
+
};
|
|
63
|
+
var enrichDiagnostic = (diagnostic) => diagnostic.docsUrl ? diagnostic : { ...diagnostic, docsUrl: resolveDocsUrl(diagnostic.code) };
|
|
64
|
+
var REGEXP_SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
|
|
65
|
+
var escapeRegExp = (value) => value.replaceAll(REGEXP_SPECIAL, String.raw`\$&`);
|
|
66
|
+
var isKeySegment = (segment) => typeof segment === "string";
|
|
67
|
+
var stepSegment = (source, segment, cursor) => {
|
|
68
|
+
if (!isKeySegment(segment)) {
|
|
69
|
+
return { index: -1, next: cursor, stop: false };
|
|
70
|
+
}
|
|
71
|
+
const matcher = new RegExp(`(?<![\\w$])${escapeRegExp(segment)}\\s*[:=]`, "gu");
|
|
72
|
+
matcher.lastIndex = cursor;
|
|
73
|
+
const match = matcher.exec(source);
|
|
74
|
+
if (!match) {
|
|
75
|
+
return { index: -1, next: cursor, stop: true };
|
|
76
|
+
}
|
|
77
|
+
return { index: match.index, next: matcher.lastIndex, stop: false };
|
|
78
|
+
};
|
|
79
|
+
var locatePath = (source, path) => {
|
|
80
|
+
let cursor = 0;
|
|
81
|
+
let found = -1;
|
|
82
|
+
for (const segment of path) {
|
|
83
|
+
const step = stepSegment(source, segment, cursor);
|
|
84
|
+
if (step.stop) {
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
cursor = step.next;
|
|
88
|
+
if (step.index >= 0) {
|
|
89
|
+
found = step.index;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (found < 0) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const before = source.slice(0, found);
|
|
96
|
+
const lastNewline = before.lastIndexOf(`
|
|
97
|
+
`);
|
|
98
|
+
return { column: found - lastNewline, line: before.split(`
|
|
99
|
+
`).length };
|
|
100
|
+
};
|
|
101
|
+
var FRONTMATTER = /^---\r?\n(?<body>[\s\S]*?)\r?\n---/u;
|
|
102
|
+
var locateFrontmatterKey = (source, path) => {
|
|
103
|
+
const block = FRONTMATTER.exec(source);
|
|
104
|
+
if (!block) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const position = locatePath(block.groups?.body ?? "", path);
|
|
108
|
+
return position && { column: position.column, line: position.line + 1 };
|
|
109
|
+
};
|
|
110
|
+
var diagnosticsFromIssues = (issues, options) => issues.map((issue) => {
|
|
111
|
+
const schemaPath = issue.path.join(".");
|
|
112
|
+
const position = options.source ? locatePath(options.source, issue.path) : undefined;
|
|
113
|
+
return {
|
|
114
|
+
code: options.code,
|
|
115
|
+
column: position?.column,
|
|
116
|
+
file: options.file,
|
|
117
|
+
line: position?.line,
|
|
118
|
+
message: schemaPath ? `${schemaPath}: ${issue.message}` : issue.message,
|
|
119
|
+
schemaPath: schemaPath || undefined,
|
|
120
|
+
severity: "error"
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
var diagnosticsFromZod = (error, options) => diagnosticsFromIssues(error.issues.map((issue) => ({
|
|
124
|
+
message: issue.message,
|
|
125
|
+
path: issue.path.filter((segment) => typeof segment !== "symbol")
|
|
126
|
+
})), options);
|
|
127
|
+
var severityColor = (severity) => {
|
|
128
|
+
if (severity === "error") {
|
|
129
|
+
return colors.red;
|
|
130
|
+
}
|
|
131
|
+
if (severity === "warning") {
|
|
132
|
+
return colors.yellow;
|
|
133
|
+
}
|
|
134
|
+
return colors.blue;
|
|
135
|
+
};
|
|
136
|
+
var formatDiagnostic = (diagnostic, root) => {
|
|
137
|
+
const color = severityColor(diagnostic.severity);
|
|
138
|
+
const lines = [
|
|
139
|
+
`${color(colors.bold(diagnostic.code))} ${diagnostic.message}`
|
|
140
|
+
];
|
|
141
|
+
if (diagnostic.url) {
|
|
142
|
+
lines.push(` ${colors.dim(`at ${diagnostic.url}`)}`);
|
|
143
|
+
}
|
|
144
|
+
if (diagnostic.file) {
|
|
145
|
+
const location = root ? relative(root, diagnostic.file) : diagnostic.file;
|
|
146
|
+
const column = diagnostic.column === undefined ? "" : `:${diagnostic.column}`;
|
|
147
|
+
const position = diagnostic.line === undefined ? "" : `:${diagnostic.line}${column}`;
|
|
148
|
+
const label = diagnostic.url ? "in" : "at";
|
|
149
|
+
lines.push(` ${colors.dim(`${label} ${location}${position}`)}`);
|
|
150
|
+
}
|
|
151
|
+
if (diagnostic.suggestion) {
|
|
152
|
+
lines.push(` ${colors.cyan(`fix: ${diagnostic.suggestion}`)}`);
|
|
153
|
+
}
|
|
154
|
+
if (diagnostic.docsUrl) {
|
|
155
|
+
lines.push(` ${colors.dim(`docs: ${diagnostic.docsUrl}`)}`);
|
|
156
|
+
}
|
|
157
|
+
return lines.join(`
|
|
158
|
+
`);
|
|
159
|
+
};
|
|
160
|
+
var hasErrors = (diagnostics) => diagnostics.some((d) => d.severity === "error");
|
|
161
|
+
var countBySeverity = (diagnostics) => {
|
|
162
|
+
const counts = { error: 0, info: 0, warning: 0 };
|
|
163
|
+
for (const diagnostic of diagnostics) {
|
|
164
|
+
counts[diagnostic.severity] += 1;
|
|
165
|
+
}
|
|
166
|
+
return counts;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
// src/cli/log.ts
|
|
170
|
+
import { consola } from "consola";
|
|
171
|
+
import { relative as relative2 } from "pathe";
|
|
172
|
+
var logger = consola.withTag("blume");
|
|
173
|
+
var flushStdout = () => new Promise((resolve) => {
|
|
174
|
+
process.stdout.write("", () => resolve());
|
|
175
|
+
});
|
|
176
|
+
var reportDiagnosticsJson = (diagnostics, root) => {
|
|
177
|
+
const enriched = diagnostics.map((diagnostic) => {
|
|
178
|
+
const withDocs = enrichDiagnostic(diagnostic);
|
|
179
|
+
return withDocs.file && root ? { ...withDocs, file: relative2(root, withDocs.file) } : withDocs;
|
|
180
|
+
});
|
|
181
|
+
process.stdout.write(`${JSON.stringify({ diagnostics: enriched, summary: countBySeverity(diagnostics) }, null, 2)}
|
|
182
|
+
`);
|
|
183
|
+
return hasErrors(diagnostics);
|
|
184
|
+
};
|
|
185
|
+
var reportDiagnostics = (diagnostics, root) => {
|
|
186
|
+
if (diagnostics.length === 0) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
for (const diagnostic of diagnostics) {
|
|
190
|
+
process.stderr.write(`${formatDiagnostic(enrichDiagnostic(diagnostic), root)}
|
|
191
|
+
`);
|
|
192
|
+
}
|
|
193
|
+
const counts = countBySeverity(diagnostics);
|
|
194
|
+
const summary = [
|
|
195
|
+
counts.error ? `${counts.error} error(s)` : null,
|
|
196
|
+
counts.warning ? `${counts.warning} warning(s)` : null
|
|
197
|
+
].filter(Boolean).join(", ");
|
|
198
|
+
if (summary) {
|
|
199
|
+
process.stderr.write(`
|
|
200
|
+
${summary}
|
|
201
|
+
`);
|
|
202
|
+
}
|
|
203
|
+
return hasErrors(diagnostics);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export { BlumeError, enrichDiagnostic, locateFrontmatterKey, diagnosticsFromIssues, diagnosticsFromZod, hasErrors, countBySeverity, logger, flushStdout, reportDiagnosticsJson, reportDiagnostics };
|
|
207
|
+
|
|
208
|
+
//# debugId=ACFDBD3E8C054D7D64756E2164756E21
|
|
209
|
+
//# sourceMappingURL=chunk-ey89bjj1.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/diagnostics.ts", "../src/cli/log.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { colors } from \"consola/utils\";\nimport { relative } from \"pathe\";\nimport type { ZodError } from \"zod\";\n\nimport type { Diagnostic } from \"./types.ts\";\n\n/** A recoverable error carrying a structured diagnostic. */\nexport class BlumeError extends Error {\n readonly diagnostic: Diagnostic;\n\n constructor(diagnostic: Diagnostic) {\n super(diagnostic.message);\n this.name = \"BlumeError\";\n this.diagnostic = diagnostic;\n }\n}\n\nexport const createDiagnostic = (diagnostic: Diagnostic): Diagnostic =>\n diagnostic;\n\n/** Docs site base; diagnostic help links resolve against it. */\nconst DOCS_BASE = \"https://useblume.dev\";\n\nconst DOCS_DEPLOYMENT = \"/docs/deployment\";\nconst DOCS_REFERENCE_CLI = \"/docs/reference/cli\";\nconst DOCS_CONTENT_SOURCES = \"/docs/content/sources\";\nconst DOCS_CONTENT_NAVIGATION = \"/docs/content/navigation\";\nconst DOCS_CONTENT_INCLUDES = \"/docs/content/includes\";\n\n/** Diagnostic code → the docs page that explains it. */\nconst DOCS_PATHS = new Map(\n Object.entries({\n BLUME_ADAPTER_REQUIRED: DOCS_DEPLOYMENT,\n BLUME_ASSETS_UNCHECKED: DOCS_REFERENCE_CLI,\n BLUME_ASSET_FETCH_FAILED: DOCS_CONTENT_SOURCES,\n BLUME_BROKEN_ANCHOR: DOCS_REFERENCE_CLI,\n BLUME_BROKEN_ASSET: DOCS_REFERENCE_CLI,\n BLUME_BROKEN_LINK: DOCS_REFERENCE_CLI,\n BLUME_CONFIG_INVALID: \"/docs/configuration\",\n BLUME_CONFIG_LOAD_FAILED: \"/docs/configuration\",\n BLUME_CONTENT_ROOT_MISSING: DOCS_CONTENT_SOURCES,\n BLUME_DEAD_LINK: DOCS_REFERENCE_CLI,\n BLUME_DUPLICATE_ROUTE: DOCS_CONTENT_NAVIGATION,\n BLUME_DUPLICATE_SIDEBAR_ORDER: DOCS_CONTENT_NAVIGATION,\n BLUME_FRONTMATTER_INVALID: \"/docs/reference/frontmatter\",\n BLUME_INCLUDE_CYCLE: DOCS_CONTENT_INCLUDES,\n BLUME_INCLUDE_NOT_FOUND: DOCS_CONTENT_INCLUDES,\n BLUME_INCLUDE_OUTSIDE_ROOT: DOCS_CONTENT_INCLUDES,\n BLUME_MDX_CURLY_ANCHOR: \"/docs/content/syntax\",\n\n BLUME_META_INVALID: \"/docs/content/meta\",\n BLUME_META_LOAD_FAILED: \"/docs/content/meta\",\n BLUME_MISSING_SECRET: DOCS_DEPLOYMENT,\n BLUME_NAV_DUPLICATE_LABEL: DOCS_CONTENT_NAVIGATION,\n BLUME_NAV_HIDDEN_IN_SIDEBAR: DOCS_CONTENT_NAVIGATION,\n BLUME_NAV_INDEX_TITLE_MISMATCH: DOCS_CONTENT_NAVIGATION,\n BLUME_NAV_MISSING_PAGE: DOCS_CONTENT_NAVIGATION,\n BLUME_NODE_VERSION: \"/docs/quickstart\",\n BLUME_SERVER_FEATURE_REQUIRED: DOCS_DEPLOYMENT,\n BLUME_SIDEBAR_DISPLAY_IGNORED: DOCS_CONTENT_NAVIGATION,\n BLUME_SOURCE_FETCH_FAILED: DOCS_CONTENT_SOURCES,\n BLUME_SOURCE_MISCONFIGURED: DOCS_CONTENT_SOURCES,\n BLUME_SOURCE_OFFLINE: DOCS_CONTENT_SOURCES,\n BLUME_SOURCE_SDK_MISSING: DOCS_CONTENT_SOURCES,\n BLUME_SOURCE_UNAVAILABLE: DOCS_CONTENT_SOURCES,\n BLUME_UNKNOWN_COMPONENT: \"/docs/configuration/customization\",\n BLUME_UNKNOWN_ICON: DOCS_CONTENT_NAVIGATION,\n BLUME_WIKILINK_AMBIGUOUS: DOCS_CONTENT_SOURCES,\n BLUME_WIKILINK_UNRESOLVED: DOCS_CONTENT_SOURCES,\n })\n);\n\n/** The docs URL that explains a diagnostic code, if one is mapped. */\nexport const resolveDocsUrl = (code: string): string | undefined => {\n const path = DOCS_PATHS.get(code);\n return path ? `${DOCS_BASE}${path}` : undefined;\n};\n\n/** Fill in `docsUrl` from the code map where a diagnostic doesn't set its own. */\nexport const enrichDiagnostic = (diagnostic: Diagnostic): Diagnostic =>\n diagnostic.docsUrl\n ? diagnostic\n : { ...diagnostic, docsUrl: resolveDocsUrl(diagnostic.code) };\n\nconst REGEXP_SPECIAL = /[$()*+.?[\\\\\\]^{|}]/gu;\nconst escapeRegExp = (value: string): string =>\n value.replaceAll(REGEXP_SPECIAL, String.raw`\\$&`);\n\n/** A key segment scans the source text; an array index has no key to find. */\nconst isKeySegment = (segment: string | number): segment is string =>\n typeof segment === \"string\";\n\n/**\n * Best-effort source position for a Zod issue path (e.g. `[\"seo\", \"title\"]`) in\n * the raw config / frontmatter text. Narrows key-by-key — finding each string\n * segment as a `key:`/`key =` at or after the previous match — so a nested key\n * lands under its parent. Array indices are skipped. Returns 1-based line/column,\n * or undefined when nothing matches.\n */\nconst stepSegment = (\n source: string,\n segment: string | number,\n cursor: number\n) => {\n // A non-string path segment (array index) is skipped without moving on.\n if (!isKeySegment(segment)) {\n return { index: -1, next: cursor, stop: false };\n }\n // The negative lookbehind keeps a segment like `title` from matching the\n // tail of an unrelated key such as `subtitle:`.\n const matcher = new RegExp(\n `(?<![\\\\w$])${escapeRegExp(segment)}\\\\s*[:=]`,\n \"gu\"\n );\n matcher.lastIndex = cursor;\n const match = matcher.exec(source);\n if (!match) {\n return { index: -1, next: cursor, stop: true };\n }\n return { index: match.index, next: matcher.lastIndex, stop: false };\n};\n\nconst locatePath = (\n source: string,\n path: readonly (string | number)[]\n): { column: number; line: number } | undefined => {\n let cursor = 0;\n let found = -1;\n for (const segment of path) {\n const step = stepSegment(source, segment, cursor);\n if (step.stop) {\n break;\n }\n cursor = step.next;\n if (step.index >= 0) {\n found = step.index;\n }\n }\n if (found < 0) {\n return;\n }\n const before = source.slice(0, found);\n const lastNewline = before.lastIndexOf(\"\\n\");\n return { column: found - lastNewline, line: before.split(\"\\n\").length };\n};\n\n/** The YAML front matter block of a `.md`/`.mdx` source, if it has one. */\nconst FRONTMATTER = /^---\\r?\\n(?<body>[\\s\\S]*?)\\r?\\n---/u;\n\n/**\n * Locate a front matter key in a content file, e.g. `[\"seo\", \"description\"]` in\n * `docs/api.mdx`. Scoped to the front matter block so a `title:` written in the\n * page body can't be mistaken for the front matter key of the same name; returns\n * undefined when the file has no front matter or the key isn't set (a missing\n * key has no line to point at — callers anchor to the file instead).\n */\nexport const locateFrontmatterKey = (\n source: string,\n path: readonly (string | number)[]\n): { column: number; line: number } | undefined => {\n const block = FRONTMATTER.exec(source);\n if (!block) {\n return;\n }\n // `locatePath` reports lines 1-based within the text it was given, and the\n // front matter body starts one line below the opening `---`.\n const position = locatePath(block.groups?.body ?? \"\", path);\n return position && { column: position.column, line: position.line + 1 };\n};\n\n/**\n * Convert generic validation issues (message + path, the shape shared by Zod\n * and Standard Schema issues) into Blume diagnostics, anchored to a file.\n */\nexport const diagnosticsFromIssues = (\n issues: readonly {\n message: string;\n path: readonly (string | number)[];\n }[],\n options: { code: string; file?: string; source?: string }\n): Diagnostic[] =>\n issues.map((issue) => {\n const schemaPath = issue.path.join(\".\");\n const position = options.source\n ? locatePath(options.source, issue.path)\n : undefined;\n return {\n code: options.code,\n column: position?.column,\n file: options.file,\n line: position?.line,\n message: schemaPath ? `${schemaPath}: ${issue.message}` : issue.message,\n schemaPath: schemaPath || undefined,\n severity: \"error\",\n } satisfies Diagnostic;\n });\n\n/** Convert a ZodError into Blume diagnostics, anchored to a file. */\nexport const diagnosticsFromZod = (\n error: ZodError,\n options: { code: string; file?: string; source?: string }\n): Diagnostic[] =>\n diagnosticsFromIssues(\n error.issues.map((issue) => ({\n message: issue.message,\n // Zod 4 paths are PropertyKey[]; a symbol segment has no place in a\n // dotted schema path or a source-position scan.\n path: issue.path.filter(\n (segment): segment is string | number => typeof segment !== \"symbol\"\n ),\n })),\n options\n );\n\nconst severityColor = (severity: Diagnostic[\"severity\"]) => {\n if (severity === \"error\") {\n return colors.red;\n }\n if (severity === \"warning\") {\n return colors.yellow;\n }\n return colors.blue;\n};\n\n/** Format a single diagnostic for terminal output. */\nexport const formatDiagnostic = (\n diagnostic: Diagnostic,\n root?: string\n): string => {\n const color = severityColor(diagnostic.severity);\n const lines: string[] = [\n `${color(colors.bold(diagnostic.code))} ${diagnostic.message}`,\n ];\n\n // An audit finding is about a built URL, and names the source file that fixes\n // it as a second line (\"at /docs/api\" / \"in docs/api.mdx:3:2\"). Everything\n // else is about a file alone, and keeps the original single `at file` line.\n if (diagnostic.url) {\n lines.push(` ${colors.dim(`at ${diagnostic.url}`)}`);\n }\n if (diagnostic.file) {\n const location = root ? relative(root, diagnostic.file) : diagnostic.file;\n const column =\n diagnostic.column === undefined ? \"\" : `:${diagnostic.column}`;\n const position =\n diagnostic.line === undefined ? \"\" : `:${diagnostic.line}${column}`;\n const label = diagnostic.url ? \"in\" : \"at\";\n lines.push(` ${colors.dim(`${label} ${location}${position}`)}`);\n }\n\n if (diagnostic.suggestion) {\n lines.push(` ${colors.cyan(`fix: ${diagnostic.suggestion}`)}`);\n }\n\n if (diagnostic.docsUrl) {\n lines.push(` ${colors.dim(`docs: ${diagnostic.docsUrl}`)}`);\n }\n\n return lines.join(\"\\n\");\n};\n\nexport const hasErrors = (diagnostics: Diagnostic[]): boolean =>\n diagnostics.some((d) => d.severity === \"error\");\n\nexport const countBySeverity = (diagnostics: Diagnostic[]) => {\n const counts = { error: 0, info: 0, warning: 0 } satisfies Record<\n Diagnostic[\"severity\"],\n number\n >;\n for (const diagnostic of diagnostics) {\n counts[diagnostic.severity] += 1;\n }\n return counts;\n};\n",
|
|
6
|
+
"import { consola } from \"consola\";\nimport { relative } from \"pathe\";\n\nimport {\n countBySeverity,\n enrichDiagnostic,\n formatDiagnostic,\n hasErrors,\n} from \"../core/diagnostics.ts\";\nimport type { Diagnostic } from \"../core/types.ts\";\n\nexport const logger = consola.withTag(\"blume\");\n\n/**\n * Resolve once stdout has drained. `process.exit` doesn't flush a piped stdout,\n * so await this before exiting non-zero after writing machine-readable output\n * (e.g. `--json`), otherwise the payload can be truncated in CI.\n */\nexport const flushStdout = (): Promise<void> =>\n // oxlint-disable-next-line promise/avoid-new -- adapt stdout's write callback\n new Promise((resolve) => {\n process.stdout.write(\"\", () => resolve());\n });\n\n/**\n * Print diagnostics as a JSON document on stdout for CI and editors: each is\n * enriched with its `docsUrl` and its `file` made root-relative. Returns whether\n * any were errors, matching {@link reportDiagnostics}.\n */\nexport const reportDiagnosticsJson = (\n diagnostics: Diagnostic[],\n root?: string\n): boolean => {\n const enriched = diagnostics.map((diagnostic) => {\n const withDocs = enrichDiagnostic(diagnostic);\n return withDocs.file && root\n ? { ...withDocs, file: relative(root, withDocs.file) }\n : withDocs;\n });\n process.stdout.write(\n `${JSON.stringify(\n { diagnostics: enriched, summary: countBySeverity(diagnostics) },\n null,\n 2\n )}\\n`\n );\n return hasErrors(diagnostics);\n};\n\n/** Print a batch of diagnostics and return whether any were errors. */\nexport const reportDiagnostics = (\n diagnostics: Diagnostic[],\n root?: string\n): boolean => {\n if (diagnostics.length === 0) {\n return false;\n }\n\n for (const diagnostic of diagnostics) {\n process.stderr.write(\n `${formatDiagnostic(enrichDiagnostic(diagnostic), root)}\\n`\n );\n }\n\n const counts = countBySeverity(diagnostics);\n const summary = [\n counts.error ? `${counts.error} error(s)` : null,\n counts.warning ? `${counts.warning} warning(s)` : null,\n ]\n .filter(Boolean)\n .join(\", \");\n if (summary) {\n process.stderr.write(`\\n${summary}\\n`);\n }\n\n return hasErrors(diagnostics);\n};\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";;;AAAA;AACA;AAAA;AAMO,MAAM,mBAAmB,MAAM;AAAA,EAC3B;AAAA,EAET,WAAW,CAAC,YAAwB;AAAA,IAClC,MAAM,WAAW,OAAO;AAAA,IACxB,KAAK,OAAO;AAAA,IACZ,KAAK,aAAa;AAAA;AAEtB;AAMA,IAAM,YAAY;AAElB,IAAM,kBAAkB;AACxB,IAAM,qBAAqB;AAC3B,IAAM,uBAAuB;AAC7B,IAAM,0BAA0B;AAChC,IAAM,wBAAwB;AAG9B,IAAM,aAAa,IAAI,IACrB,OAAO,QAAQ;AAAA,EACb,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB,0BAA0B;AAAA,EAC1B,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,sBAAsB;AAAA,EACtB,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,+BAA+B;AAAA,EAC/B,2BAA2B;AAAA,EAC3B,qBAAqB;AAAA,EACrB,yBAAyB;AAAA,EACzB,4BAA4B;AAAA,EAC5B,wBAAwB;AAAA,EAExB,oBAAoB;AAAA,EACpB,wBAAwB;AAAA,EACxB,sBAAsB;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OAAO,UAAU,GAAG,OAAO,uBAAuB;AAAA,EACpD,EACG,OAAO,OAAO,EACd,KAAK,IAAI;AAAA,EACZ,IAAI,SAAS;AAAA,IACX,QAAQ,OAAO,MAAM;AAAA,EAAK;AAAA,CAAW;AAAA,EACvC;AAAA,EAEA,OAAO,UAAU,WAAW;AAAA;",
|
|
9
|
+
"debugId": "ACFDBD3E8C054D7D64756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
commandsFor,
|
|
4
|
+
detectProjectPackageManager,
|
|
5
|
+
eject,
|
|
6
|
+
updatePackageScripts
|
|
7
|
+
} from "./chunk-wb067mv3.js";
|
|
8
|
+
import {
|
|
9
|
+
refuseIfDevRunning
|
|
10
|
+
} from "./chunk-tc89yh2r.js";
|
|
11
|
+
import"./chunk-62qsssnh.js";
|
|
12
|
+
import"./chunk-n4qjabmt.js";
|
|
13
|
+
import"./chunk-pxj10x8y.js";
|
|
14
|
+
import"./chunk-sbdqrjbb.js";
|
|
15
|
+
import"./chunk-5yvt556e.js";
|
|
16
|
+
import"./chunk-ev67ycx0.js";
|
|
17
|
+
import"./chunk-vt8fgygt.js";
|
|
18
|
+
import"./chunk-3r94j3tc.js";
|
|
19
|
+
import"./chunk-aerwpe14.js";
|
|
20
|
+
import"./chunk-3k0kzs6d.js";
|
|
21
|
+
import"./chunk-vxv4x1n8.js";
|
|
22
|
+
import"./chunk-wd27zjcz.js";
|
|
23
|
+
import"./chunk-etsqspj6.js";
|
|
24
|
+
import"./chunk-vv3f8mb6.js";
|
|
25
|
+
import"./chunk-27gtm2ym.js";
|
|
26
|
+
import"./chunk-4xyggvgf.js";
|
|
27
|
+
import"./chunk-6kzzpsx8.js";
|
|
28
|
+
import {
|
|
29
|
+
logger
|
|
30
|
+
} from "./chunk-ey89bjj1.js";
|
|
31
|
+
import {
|
|
32
|
+
commandMeta
|
|
33
|
+
} from "./chunk-2aj8ddew.js";
|
|
34
|
+
|
|
35
|
+
// src/cli/commands/eject.ts
|
|
36
|
+
import { defineCommand } from "citty";
|
|
37
|
+
import { relative } from "pathe";
|
|
38
|
+
var ejectCommand = defineCommand({
|
|
39
|
+
args: {
|
|
40
|
+
yes: { description: "Skip the confirmation prompt.", type: "boolean" }
|
|
41
|
+
},
|
|
42
|
+
meta: commandMeta.eject,
|
|
43
|
+
async run({ args }) {
|
|
44
|
+
const root = process.cwd();
|
|
45
|
+
refuseIfDevRunning(root, "ejecting");
|
|
46
|
+
if (!args.yes) {
|
|
47
|
+
logger.warn("Eject is one-way: it writes astro.config.mjs, src/, and (if absent) tsconfig.json, rewrites your package.json scripts, and removes .blume. An existing tsconfig.json is left untouched.");
|
|
48
|
+
logger.info("Re-run with --yes to proceed.");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const { files, warnings } = await eject(root);
|
|
52
|
+
await updatePackageScripts(root);
|
|
53
|
+
for (const warning of warnings) {
|
|
54
|
+
logger.warn(warning);
|
|
55
|
+
}
|
|
56
|
+
logger.success(`Ejected ${files.length} file(s):`);
|
|
57
|
+
for (const file of files) {
|
|
58
|
+
process.stdout.write(` ${relative(root, file)}
|
|
59
|
+
`);
|
|
60
|
+
}
|
|
61
|
+
const pm = await detectProjectPackageManager(root);
|
|
62
|
+
const { build, dev } = commandsFor(pm);
|
|
63
|
+
logger.box(`Your project is now a standalone Astro app.
|
|
64
|
+
|
|
65
|
+
${dev}
|
|
66
|
+
${build}
|
|
67
|
+
|
|
68
|
+
The blume package remains importable.`);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
export {
|
|
72
|
+
ejectCommand
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
//# debugId=7089C2D59766320964756E2164756E21
|
|
76
|
+
//# sourceMappingURL=chunk-f75cqye8.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/cli/commands/eject.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { defineCommand } from \"citty\";\nimport { relative } from \"pathe\";\n\nimport { eject } from \"../../registry/eject.ts\";\nimport { commandMeta } from \"../command-meta.ts\";\nimport { refuseIfDevRunning } from \"../dev-lock.ts\";\nimport { updatePackageScripts } from \"../eject-scripts.ts\";\nimport { commandsFor, detectProjectPackageManager } from \"../init/scaffold.ts\";\nimport { logger } from \"../log.ts\";\n\nexport const ejectCommand = defineCommand({\n args: {\n yes: { description: \"Skip the confirmation prompt.\", type: \"boolean\" },\n },\n meta: commandMeta.eject,\n async run({ args }) {\n const root = process.cwd();\n refuseIfDevRunning(root, \"ejecting\");\n\n if (!args.yes) {\n logger.warn(\n \"Eject is one-way: it writes astro.config.mjs, src/, and (if absent) tsconfig.json, rewrites your package.json scripts, and removes .blume. An existing tsconfig.json is left untouched.\"\n );\n logger.info(\"Re-run with --yes to proceed.\");\n return;\n }\n\n const { files, warnings } = await eject(root);\n await updatePackageScripts(root);\n\n // The same surface as the generated-runtime path (prepare.ts): one warn\n // per generation warning, e.g. a Scalar reference spec that wasn't found.\n for (const warning of warnings) {\n logger.warn(warning);\n }\n\n logger.success(`Ejected ${files.length} file(s):`);\n for (const file of files) {\n process.stdout.write(` ${relative(root, file)}\\n`);\n }\n // Print run commands matching the project's package manager (lockfile\n // detection, since eject runs inside an existing project).\n const pm = await detectProjectPackageManager(root);\n const { build, dev } = commandsFor(pm);\n logger.box(\n `Your project is now a standalone Astro app.\\n\\n ${dev}\\n ${build}\\n\\nThe blume package remains importable.`\n );\n },\n});\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AASO,IAAM,eAAe,cAAc;AAAA,EACxC,MAAM;AAAA,IACJ,KAAK,EAAE,aAAa,iCAAiC,MAAM,UAAU;AAAA,EACvE;AAAA,EACA,MAAM,YAAY;AAAA,OACZ,IAAG,GAAG,QAAQ;AAAA,IAClB,MAAM,OAAO,QAAQ,IAAI;AAAA,IACzB,mBAAmB,MAAM,UAAU;AAAA,IAEnC,IAAI,CAAC,KAAK,KAAK;AAAA,MACb,OAAO,KACL,yLACF;AAAA,MACA,OAAO,KAAK,+BAA+B;AAAA,MAC3C;AAAA,IACF;AAAA,IAEA,QAAQ,OAAO,aAAa,MAAM,MAAM,IAAI;AAAA,IAC5C,MAAM,qBAAqB,IAAI;AAAA,IAI/B,WAAW,WAAW,UAAU;AAAA,MAC9B,OAAO,KAAK,OAAO;AAAA,IACrB;AAAA,IAEA,OAAO,QAAQ,WAAW,MAAM,iBAAiB;AAAA,IACjD,WAAW,QAAQ,OAAO;AAAA,MACxB,QAAQ,OAAO,MAAM,KAAK,SAAS,MAAM,IAAI;AAAA,CAAK;AAAA,IACpD;AAAA,IAGA,MAAM,KAAK,MAAM,4BAA4B,IAAI;AAAA,IACjD,QAAQ,OAAO,QAAQ,YAAY,EAAE;AAAA,IACrC,OAAO,IACL;AAAA;AAAA,IAAoD;AAAA,IAAU;AAAA;AAAA,sCAChE;AAAA;AAEJ,CAAC;",
|
|
8
|
+
"debugId": "7089C2D59766320964756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
ensureGitignore
|
|
4
|
+
} from "./chunk-5hs6gb7n.js";
|
|
5
|
+
import {
|
|
6
|
+
PACKAGE_MANAGERS,
|
|
7
|
+
TEMPLATES,
|
|
8
|
+
applyPlan,
|
|
9
|
+
buildPlan,
|
|
10
|
+
commandsFor,
|
|
11
|
+
detectPackageManager,
|
|
12
|
+
eject,
|
|
13
|
+
nextSteps,
|
|
14
|
+
titleize,
|
|
15
|
+
updatePackageScripts,
|
|
16
|
+
validateContentDir
|
|
17
|
+
} from "./chunk-wb067mv3.js";
|
|
18
|
+
import"./chunk-62qsssnh.js";
|
|
19
|
+
import"./chunk-n4qjabmt.js";
|
|
20
|
+
import"./chunk-pxj10x8y.js";
|
|
21
|
+
import"./chunk-sbdqrjbb.js";
|
|
22
|
+
import"./chunk-5yvt556e.js";
|
|
23
|
+
import"./chunk-ev67ycx0.js";
|
|
24
|
+
import"./chunk-vt8fgygt.js";
|
|
25
|
+
import"./chunk-3r94j3tc.js";
|
|
26
|
+
import"./chunk-aerwpe14.js";
|
|
27
|
+
import"./chunk-3k0kzs6d.js";
|
|
28
|
+
import"./chunk-vxv4x1n8.js";
|
|
29
|
+
import"./chunk-wd27zjcz.js";
|
|
30
|
+
import"./chunk-etsqspj6.js";
|
|
31
|
+
import"./chunk-vv3f8mb6.js";
|
|
32
|
+
import"./chunk-27gtm2ym.js";
|
|
33
|
+
import"./chunk-4xyggvgf.js";
|
|
34
|
+
import"./chunk-6kzzpsx8.js";
|
|
35
|
+
import {
|
|
36
|
+
logger
|
|
37
|
+
} from "./chunk-ey89bjj1.js";
|
|
38
|
+
import {
|
|
39
|
+
commandMeta
|
|
40
|
+
} from "./chunk-2aj8ddew.js";
|
|
41
|
+
|
|
42
|
+
// src/cli/commands/init.ts
|
|
43
|
+
import * as clack from "@clack/prompts";
|
|
44
|
+
import { defineCommand } from "citty";
|
|
45
|
+
import { resolve as resolve2 } from "pathe";
|
|
46
|
+
|
|
47
|
+
// src/cli/init/questions.ts
|
|
48
|
+
import { basename, resolve } from "pathe";
|
|
49
|
+
var cancelled = (value) => typeof value === "symbol";
|
|
50
|
+
var collectAnswers = async (prompter, flags, defaults) => {
|
|
51
|
+
const directory = flags.directory ?? await prompter.text({
|
|
52
|
+
defaultValue: ".",
|
|
53
|
+
message: "Where should we create your project?",
|
|
54
|
+
placeholder: "./my-docs"
|
|
55
|
+
});
|
|
56
|
+
if (cancelled(directory)) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const root = resolve(defaults.cwd, directory);
|
|
60
|
+
const title = await prompter.text({
|
|
61
|
+
initialValue: titleize(basename(root)),
|
|
62
|
+
message: "What's your docs site called?",
|
|
63
|
+
validate: (value) => value?.trim() ? undefined : "Give your docs site a name."
|
|
64
|
+
});
|
|
65
|
+
if (cancelled(title)) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const template = flags.template ?? await prompter.select({
|
|
69
|
+
message: "Which template?",
|
|
70
|
+
options: [
|
|
71
|
+
{ hint: "Markdown docs site", label: "docs", value: "docs" },
|
|
72
|
+
{ hint: "OpenAPI reference at /api", label: "api", value: "api" },
|
|
73
|
+
{ hint: "SDK docs with an install page", label: "sdk", value: "sdk" },
|
|
74
|
+
{
|
|
75
|
+
hint: "Docs plus a changelog tab",
|
|
76
|
+
label: "changelog",
|
|
77
|
+
value: "changelog"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
if (cancelled(template)) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
const picked = await prompter.multiselect({
|
|
85
|
+
initialValues: ["filesystem"],
|
|
86
|
+
message: "Where does your content live?",
|
|
87
|
+
options: [
|
|
88
|
+
{ hint: "Local .mdx files", label: "filesystem", value: "filesystem" },
|
|
89
|
+
{ hint: "An Obsidian vault", label: "obsidian", value: "obsidian" },
|
|
90
|
+
{
|
|
91
|
+
hint: "Changelog from GitHub Releases",
|
|
92
|
+
label: "github-releases",
|
|
93
|
+
value: "github-releases"
|
|
94
|
+
},
|
|
95
|
+
{ hint: "A Notion database", label: "notion", value: "notion" },
|
|
96
|
+
{ hint: "A Sanity dataset", label: "sanity", value: "sanity" },
|
|
97
|
+
{
|
|
98
|
+
hint: "MDX fetched from a GitHub repo",
|
|
99
|
+
label: "mdx-remote",
|
|
100
|
+
value: "mdx-remote"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
required: false
|
|
104
|
+
});
|
|
105
|
+
if (cancelled(picked)) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
const sources = picked.length === 0 ? ["filesystem"] : picked;
|
|
109
|
+
let contentDir = flags.contentDir ?? "docs";
|
|
110
|
+
if (flags.contentDir === undefined && sources.includes("filesystem")) {
|
|
111
|
+
const answer = await prompter.text({
|
|
112
|
+
defaultValue: "docs",
|
|
113
|
+
message: "Content directory?",
|
|
114
|
+
placeholder: "docs",
|
|
115
|
+
validate: (value) => validateContentDir(root, value || "docs")
|
|
116
|
+
});
|
|
117
|
+
if (cancelled(answer)) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
contentDir = answer;
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
contentDir,
|
|
124
|
+
directory,
|
|
125
|
+
packageManager: flags.packageManager ?? detectPackageManager(defaults.userAgent),
|
|
126
|
+
sources,
|
|
127
|
+
template,
|
|
128
|
+
title
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// src/cli/commands/init.ts
|
|
133
|
+
var ejectScaffold = async (root, answers) => {
|
|
134
|
+
const commands = commandsFor(answers.packageManager);
|
|
135
|
+
const cd = answers.directory === "." ? [] : [`cd ${answers.directory}`];
|
|
136
|
+
try {
|
|
137
|
+
await eject(root);
|
|
138
|
+
await updatePackageScripts(root);
|
|
139
|
+
logger.success("Ejected to a standalone Astro project.");
|
|
140
|
+
const steps = [...cd, commands.install, commands.dev];
|
|
141
|
+
logger.box(`Next steps:
|
|
142
|
+
|
|
143
|
+
${steps.join(`
|
|
144
|
+
`)}
|
|
145
|
+
`);
|
|
146
|
+
} catch (error) {
|
|
147
|
+
logger.warn(`Scaffolded, but eject needs the project's dependencies installed to load blume.config.ts: ${error.message}`);
|
|
148
|
+
const steps = [
|
|
149
|
+
...cd,
|
|
150
|
+
commands.install,
|
|
151
|
+
`${commands.exec} blume eject --yes`
|
|
152
|
+
];
|
|
153
|
+
logger.box(`Next steps:
|
|
154
|
+
|
|
155
|
+
${steps.join(`
|
|
156
|
+
`)}
|
|
157
|
+
`);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
var initCommand = defineCommand({
|
|
161
|
+
args: {
|
|
162
|
+
"content-dir": {
|
|
163
|
+
description: "Content directory.",
|
|
164
|
+
type: "string"
|
|
165
|
+
},
|
|
166
|
+
dir: {
|
|
167
|
+
description: "Directory to scaffold into (default: current directory).",
|
|
168
|
+
required: false,
|
|
169
|
+
type: "positional"
|
|
170
|
+
},
|
|
171
|
+
eject: {
|
|
172
|
+
description: "Eject to a standalone Astro project after scaffolding.",
|
|
173
|
+
type: "boolean"
|
|
174
|
+
},
|
|
175
|
+
"package-manager": {
|
|
176
|
+
description: "Package manager for the next-steps hint (npm|pnpm|yarn|bun).",
|
|
177
|
+
type: "string"
|
|
178
|
+
},
|
|
179
|
+
template: {
|
|
180
|
+
description: "Starter template: docs | api | sdk | changelog.",
|
|
181
|
+
type: "string"
|
|
182
|
+
},
|
|
183
|
+
yes: {
|
|
184
|
+
description: "Skip prompts and scaffold with defaults.",
|
|
185
|
+
type: "boolean"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
meta: commandMeta.init,
|
|
189
|
+
async run({ args }) {
|
|
190
|
+
const cwd = process.cwd();
|
|
191
|
+
const template = TEMPLATES.find((candidate) => candidate === args.template);
|
|
192
|
+
if (args.template !== undefined && template === undefined) {
|
|
193
|
+
logger.error(`Unknown template "${args.template}" (use ${TEMPLATES.join(" | ")}).`);
|
|
194
|
+
process.exit(1);
|
|
195
|
+
}
|
|
196
|
+
const pm = PACKAGE_MANAGERS.find((candidate) => candidate === args["package-manager"]);
|
|
197
|
+
if (args["package-manager"] !== undefined && pm === undefined) {
|
|
198
|
+
logger.error(`Unknown package manager "${args["package-manager"]}" (use ${PACKAGE_MANAGERS.join(" | ")}).`);
|
|
199
|
+
process.exit(1);
|
|
200
|
+
}
|
|
201
|
+
const interactive = !args.yes && process.stdin.isTTY === true && clack.isTTY(process.stdout) && !clack.isCI();
|
|
202
|
+
let answers;
|
|
203
|
+
if (interactive) {
|
|
204
|
+
clack.intro("blume init");
|
|
205
|
+
const collected = await collectAnswers(clack, {
|
|
206
|
+
contentDir: args["content-dir"],
|
|
207
|
+
directory: args.dir,
|
|
208
|
+
packageManager: pm,
|
|
209
|
+
template
|
|
210
|
+
}, { cwd, userAgent: process.env.npm_config_user_agent });
|
|
211
|
+
if (collected === null) {
|
|
212
|
+
clack.cancel("Cancelled — nothing was written.");
|
|
213
|
+
process.exit(0);
|
|
214
|
+
}
|
|
215
|
+
answers = collected;
|
|
216
|
+
} else {
|
|
217
|
+
answers = {
|
|
218
|
+
contentDir: args["content-dir"] ?? "docs",
|
|
219
|
+
directory: args.dir ?? ".",
|
|
220
|
+
packageManager: pm ?? detectPackageManager(process.env.npm_config_user_agent),
|
|
221
|
+
sources: ["filesystem"],
|
|
222
|
+
template: template ?? "docs",
|
|
223
|
+
title: "My Docs"
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
const root = resolve2(cwd, answers.directory);
|
|
227
|
+
if (validateContentDir(root, answers.contentDir) !== undefined) {
|
|
228
|
+
logger.error(`Invalid --content-dir "${answers.contentDir}" (must be a path inside the project).`);
|
|
229
|
+
process.exit(1);
|
|
230
|
+
}
|
|
231
|
+
const sink = interactive ? clack.log : logger;
|
|
232
|
+
const { createdPackage } = await applyPlan(buildPlan(root, answers), sink);
|
|
233
|
+
const ignored = await ensureGitignore(root, [
|
|
234
|
+
"node_modules/",
|
|
235
|
+
".blume/",
|
|
236
|
+
"dist/"
|
|
237
|
+
]);
|
|
238
|
+
if (ignored.length > 0) {
|
|
239
|
+
sink.success(`Added ${ignored.join(", ")} to .gitignore`);
|
|
240
|
+
}
|
|
241
|
+
if (args.eject) {
|
|
242
|
+
await ejectScaffold(root, answers);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const steps = nextSteps(answers, createdPackage);
|
|
246
|
+
if (interactive) {
|
|
247
|
+
clack.note(steps.trimEnd());
|
|
248
|
+
clack.outro("You're all set.");
|
|
249
|
+
} else {
|
|
250
|
+
logger.box(steps);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
export {
|
|
255
|
+
initCommand
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
//# debugId=E1A6E93028E72EA864756E2164756E21
|
|
259
|
+
//# sourceMappingURL=chunk-j00ezcg5.js.map
|