forgepress 0.0.0 → 0.0.1
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/THIRD-PARTY-LICENSES.md +97 -0
- package/dist/_chunks/client.d.mts +2 -0
- package/dist/_chunks/config.d.mts +35 -0
- package/dist/_chunks/config.mjs +37 -0
- package/dist/_chunks/entry.d.mts +194 -0
- package/dist/_chunks/error.mjs +4 -0
- package/dist/_chunks/fetch.mjs +13 -0
- package/dist/_chunks/libs/@oxc-project/types.d.mts +1297 -0
- package/dist/_chunks/libs/@rolldown/pluginutils.d.mts +62 -0
- package/dist/_chunks/libs/rolldown.d.mts +4711 -0
- package/dist/_chunks/locate.mjs +7 -0
- package/dist/_chunks/output.mjs +258 -0
- package/dist/_chunks/output2.mjs +333 -0
- package/dist/_chunks/overlay.mjs +8 -0
- package/dist/_chunks/parse.mjs +22 -0
- package/dist/_chunks/reader.mjs +23 -0
- package/dist/_chunks/reader2.mjs +849 -0
- package/dist/_chunks/references.mjs +53 -0
- package/dist/_chunks/types.d.mts +25 -0
- package/dist/_chunks/types.mjs +2 -0
- package/dist/_chunks/validate.mjs +600 -0
- package/dist/_chunks/value.mjs +17 -0
- package/dist/cli/bin.d.mts +1 -0
- package/dist/cli/bin.mjs +48 -0
- package/dist/disk/reader.d.mts +4 -0
- package/dist/disk/reader.mjs +2 -0
- package/dist/editor/index.d.mts +3 -0
- package/dist/editor/index.mjs +60643 -0
- package/dist/index.d.mts +105 -0
- package/dist/index.mjs +247 -0
- package/dist/preview/index.d.mts +5 -0
- package/dist/preview/index.mjs +244 -0
- package/dist/query/fetch.d.mts +3 -0
- package/dist/query/fetch.mjs +2 -0
- package/dist/unplugin.d.mts +18 -0
- package/dist/unplugin.mjs +501 -0
- package/package.json +82 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/cli/bin.mjs
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { errorMessage } from "../_chunks/error.mjs";
|
|
3
|
+
import { findRoot, loadConfig, resolveConfig } from "../_chunks/config.mjs";
|
|
4
|
+
import { ContentError, formatIssue } from "../_chunks/validate.mjs";
|
|
5
|
+
import { buildOutput, checkContent } from "../_chunks/output2.mjs";
|
|
6
|
+
import process from "node:process";
|
|
7
|
+
const USAGE = `Usage: forgepress <command>
|
|
8
|
+
|
|
9
|
+
Commands:
|
|
10
|
+
check Check the schema and all content the way the build does
|
|
11
|
+
build Check the content, then write the content output`;
|
|
12
|
+
function report(issues, terminal) {
|
|
13
|
+
terminal.error(`${issues.map(formatIssue).join("\n")}\n\n${issues.length} ${issues.length === 1 ? "problem" : "problems"} found`);
|
|
14
|
+
return 1;
|
|
15
|
+
}
|
|
16
|
+
async function check(root, terminal) {
|
|
17
|
+
const config = resolveConfig(await loadConfig(root));
|
|
18
|
+
const issues = await checkContent(root, config.paths);
|
|
19
|
+
if (issues.length > 0) return report(issues, terminal);
|
|
20
|
+
terminal.log("No problems found");
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
async function build(root, terminal) {
|
|
24
|
+
const result = await buildOutput(root, resolveConfig(await loadConfig(root)));
|
|
25
|
+
terminal.log(`Wrote the content output to ${result.dir} (${result.files} files, ${result.commit ? `commit ${result.commit.slice(0, 7)}` : "no commit found"})`);
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
async function run(args, cwd, terminal) {
|
|
29
|
+
const [command, ...rest] = args;
|
|
30
|
+
if (command === void 0 || command === "help" || command === "--help" || command === "-h") {
|
|
31
|
+
terminal.log(USAGE);
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
if (command !== "check" && command !== "build" || rest.length > 0) {
|
|
35
|
+
terminal.error(`${command !== "check" && command !== "build" ? `Unknown command ${JSON.stringify(command)}` : `${command} takes no arguments`}\n\n${USAGE}`);
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const root = findRoot(cwd);
|
|
40
|
+
return command === "check" ? await check(root, terminal) : await build(root, terminal);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
if (error instanceof ContentError) return report(error.issues, terminal);
|
|
43
|
+
terminal.error(errorMessage(error));
|
|
44
|
+
return 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
process.exitCode = await run(process.argv.slice(2), process.cwd(), console);
|
|
48
|
+
export {};
|