@topik/cli 0.1.0-alpha.6 → 0.1.0-alpha.7
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.mjs +10 -19
- package/package.json +9 -9
package/dist/cli.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { ManifestSourceError, PublicCompileError, TOPIK_PREVIEW_PROTOCOL, compil
|
|
|
8
8
|
import { sanitizeTopikContentDiagnostic } from "@topik/content";
|
|
9
9
|
import { createServer } from "node:http";
|
|
10
10
|
import { parseAllDocuments } from "yaml";
|
|
11
|
-
|
|
11
|
+
// src/diagnostics.ts
|
|
12
12
|
function formatDiagnostic(diagnostic) {
|
|
13
13
|
const sanitized = sanitizeTopikContentDiagnostic(diagnostic);
|
|
14
14
|
return `${sanitized.file ?? "content"}${sanitized.lines.length > 0 ? `:${sanitized.lines.join(",")}` : ""} ${sanitized.level} ${sanitized.id}: ${sanitized.message}`;
|
|
@@ -20,8 +20,7 @@ function printDiagnostics(diagnostics) {
|
|
|
20
20
|
else console.warn(output);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
//#region src/errors.ts
|
|
23
|
+
// src/errors.ts
|
|
25
24
|
var CliError = class extends Error {
|
|
26
25
|
constructor(message, options) {
|
|
27
26
|
super(message, options);
|
|
@@ -61,16 +60,14 @@ function formatPublicCliError(error) {
|
|
|
61
60
|
if (error instanceof PublicCompileError) return publicCompileErrorMessage(error.id) ?? "Topik command failed.";
|
|
62
61
|
return "Topik command failed.";
|
|
63
62
|
}
|
|
64
|
-
|
|
65
|
-
//#region src/validation-output.ts
|
|
63
|
+
// src/validation-output.ts
|
|
66
64
|
function formatValidationFailure(errors, resourceCount, context) {
|
|
67
65
|
const lines = errors.map((error) => `${error.resource}: ${error.path} ${error.message}`);
|
|
68
66
|
lines.push("");
|
|
69
67
|
lines.push(`${errors.length} validation error(s) in ${resourceCount} resources while ${context}`);
|
|
70
68
|
return lines.join("\n");
|
|
71
69
|
}
|
|
72
|
-
|
|
73
|
-
//#region src/compile/index.ts
|
|
70
|
+
// src/compile/index.ts
|
|
74
71
|
const COMPILATION_GENERATION_PREFIX = ".topik-compilation-generation-";
|
|
75
72
|
const COMPILATION_PRIOR_PREFIX = ".topik-compilation-prior-";
|
|
76
73
|
const COMPILATION_DIRECTORIES = ["blobs", "resources"];
|
|
@@ -540,11 +537,9 @@ function procFd(fd) {
|
|
|
540
537
|
function procFdChild(fd, component) {
|
|
541
538
|
return `${procFd(fd)}/${component}`;
|
|
542
539
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
//#endregion
|
|
547
|
-
//#region src/dev/index.ts
|
|
540
|
+
// package.json
|
|
541
|
+
var version = "0.1.0-alpha.7";
|
|
542
|
+
// src/dev/index.ts
|
|
548
543
|
const DEV_HOST = "127.0.0.1";
|
|
549
544
|
const DEFAULT_ALLOWED_ORIGIN = "https://write.subtopik.com";
|
|
550
545
|
const REQUEST_VARY_HEADERS = "Origin, Sec-Fetch-Site";
|
|
@@ -814,8 +809,7 @@ const dev = command({
|
|
|
814
809
|
});
|
|
815
810
|
}
|
|
816
811
|
});
|
|
817
|
-
|
|
818
|
-
//#region src/lint/index.ts
|
|
812
|
+
// src/lint/index.ts
|
|
819
813
|
const lint$1 = command({
|
|
820
814
|
name: "lint",
|
|
821
815
|
desc: "Lint Topik source content without writing compiled resources",
|
|
@@ -836,8 +830,7 @@ const lint$1 = command({
|
|
|
836
830
|
console.log(`Lint passed${warnings > 0 ? ` with ${warnings} warning(s)` : ""}`);
|
|
837
831
|
}
|
|
838
832
|
});
|
|
839
|
-
|
|
840
|
-
//#region src/validate/index.ts
|
|
833
|
+
// src/validate/index.ts
|
|
841
834
|
function parseJson(content) {
|
|
842
835
|
try {
|
|
843
836
|
return JSON.parse(content);
|
|
@@ -907,8 +900,7 @@ const validate = command({
|
|
|
907
900
|
else throw new PublicCliError("resource-validation-failed");
|
|
908
901
|
}
|
|
909
902
|
});
|
|
910
|
-
|
|
911
|
-
//#region src/cli.ts
|
|
903
|
+
// src/cli.ts
|
|
912
904
|
try {
|
|
913
905
|
await run([
|
|
914
906
|
compile$1,
|
|
@@ -923,5 +915,4 @@ try {
|
|
|
923
915
|
console.error(formatPublicCliError(error));
|
|
924
916
|
process.exitCode = 1;
|
|
925
917
|
}
|
|
926
|
-
//#endregion
|
|
927
918
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topik/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.7",
|
|
4
4
|
"description": "Topik CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@drizzle-team/brocli": "^0.12.
|
|
27
|
-
"
|
|
28
|
-
"@topik/
|
|
29
|
-
"
|
|
26
|
+
"@drizzle-team/brocli": "^0.12.1",
|
|
27
|
+
"@topik/content": "0.1.0-alpha.7",
|
|
28
|
+
"@topik/core": "0.1.0-alpha.7",
|
|
29
|
+
"yaml": "^2.9.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/bun": "^1.4.
|
|
33
|
-
"@types/node": "22.20.
|
|
32
|
+
"@types/bun": "^1.4.4",
|
|
33
|
+
"@types/node": "22.20.5",
|
|
34
34
|
"typescript": "^7.0.2",
|
|
35
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@1.
|
|
36
|
-
"vite-plus": "1.
|
|
35
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
|
|
36
|
+
"vite-plus": "1.4.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "vp pack",
|