@tobos/cli 0.4.19 → 0.4.20
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.
|
@@ -55055,6 +55055,11 @@ function parseMediaJson(text3) {
|
|
|
55055
55055
|
}
|
|
55056
55056
|
return { media: own(Object.entries(raw)), problems: [] };
|
|
55057
55057
|
}
|
|
55058
|
+
function formatMediaJson(media) {
|
|
55059
|
+
const sorted = Object.entries(media).sort(([a], [b]) => a.localeCompare(b));
|
|
55060
|
+
return `${JSON.stringify(Object.fromEntries(sorted), null, 2)}
|
|
55061
|
+
`;
|
|
55062
|
+
}
|
|
55058
55063
|
function parseMasterJson(text3) {
|
|
55059
55064
|
if (text3 === void 0) return { rules: {}, problems: [] };
|
|
55060
55065
|
const bad = (message) => ({
|
|
@@ -55721,7 +55726,61 @@ function servesModule(manifest, path) {
|
|
|
55721
55726
|
return Object.values(manifest.imports).includes(path) || (manifest.styles ?? []).includes(path);
|
|
55722
55727
|
}
|
|
55723
55728
|
|
|
55729
|
+
// ../deck/src/format-problems.ts
|
|
55730
|
+
init_define_TOBOS_PRESENT_TYPES();
|
|
55731
|
+
init_define_TOBOS_SKILL();
|
|
55732
|
+
init_define_TOBOS_TOOLCHAIN();
|
|
55733
|
+
function formatProblems(problems, limit = Infinity) {
|
|
55734
|
+
const lines2 = problems.slice(0, limit).map((p) => {
|
|
55735
|
+
const where = p.line ? `${p.file}:${p.line}${p.column ? `:${p.column}` : ""}` : p.file;
|
|
55736
|
+
return `${where} ${p.severity} ${p.rule}: ${p.message}`;
|
|
55737
|
+
});
|
|
55738
|
+
const more = problems.length - lines2.length;
|
|
55739
|
+
if (more > 0) lines2.push(`\u2026 and ${more} more: \`tobos check\` lists them all.`);
|
|
55740
|
+
return lines2.join("\n");
|
|
55741
|
+
}
|
|
55742
|
+
|
|
55743
|
+
// ../deck/src/media-type.ts
|
|
55744
|
+
init_define_TOBOS_PRESENT_TYPES();
|
|
55745
|
+
init_define_TOBOS_SKILL();
|
|
55746
|
+
init_define_TOBOS_TOOLCHAIN();
|
|
55747
|
+
import { extname } from "node:path";
|
|
55748
|
+
var TYPES = {
|
|
55749
|
+
".jpg": "image/jpeg",
|
|
55750
|
+
".jpeg": "image/jpeg",
|
|
55751
|
+
".png": "image/png",
|
|
55752
|
+
".webp": "image/webp",
|
|
55753
|
+
".avif": "image/avif",
|
|
55754
|
+
".gif": "image/gif",
|
|
55755
|
+
".svg": "image/svg+xml",
|
|
55756
|
+
".mp4": "video/mp4",
|
|
55757
|
+
".webm": "video/webm",
|
|
55758
|
+
".mov": "video/quicktime",
|
|
55759
|
+
".mp3": "audio/mpeg",
|
|
55760
|
+
".m4a": "audio/mp4",
|
|
55761
|
+
".aac": "audio/aac",
|
|
55762
|
+
".opus": "audio/ogg",
|
|
55763
|
+
".ogg": "audio/ogg",
|
|
55764
|
+
".weba": "audio/webm",
|
|
55765
|
+
".flac": "audio/flac",
|
|
55766
|
+
".wav": "audio/wav",
|
|
55767
|
+
".aif": "audio/aiff",
|
|
55768
|
+
".aiff": "audio/aiff",
|
|
55769
|
+
".pdf": "application/pdf",
|
|
55770
|
+
".glb": "model/gltf-binary",
|
|
55771
|
+
".gltf": "model/gltf+json",
|
|
55772
|
+
".json": "application/json",
|
|
55773
|
+
".bin": "application/octet-stream",
|
|
55774
|
+
".woff2": "font/woff2",
|
|
55775
|
+
".vtt": "text/vtt",
|
|
55776
|
+
".txt": "text/plain"
|
|
55777
|
+
};
|
|
55778
|
+
function mediaTypeOf(name) {
|
|
55779
|
+
return TYPES[extname(name).toLowerCase()] ?? "application/octet-stream";
|
|
55780
|
+
}
|
|
55781
|
+
|
|
55724
55782
|
export {
|
|
55783
|
+
formatProblems,
|
|
55725
55784
|
TEXT_MAX,
|
|
55726
55785
|
openActivity,
|
|
55727
55786
|
activitiesOf,
|
|
@@ -55731,10 +55790,12 @@ export {
|
|
|
55731
55790
|
ID,
|
|
55732
55791
|
parseDeckJson,
|
|
55733
55792
|
parseMediaJson,
|
|
55793
|
+
formatMediaJson,
|
|
55734
55794
|
sha256,
|
|
55735
55795
|
createCache,
|
|
55736
55796
|
buildDeck,
|
|
55737
55797
|
masterOf,
|
|
55738
55798
|
sharedManifest,
|
|
55739
|
-
servesModule
|
|
55799
|
+
servesModule,
|
|
55800
|
+
mediaTypeOf
|
|
55740
55801
|
};
|
package/dist/cli.js
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
import { createRequire as __tobosRequire } from 'node:module';
|
|
3
3
|
const require = __tobosRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
formatMediaJson,
|
|
6
|
+
formatProblems,
|
|
7
|
+
mediaTypeOf
|
|
8
|
+
} from "./chunk-L3I6AVL4.js";
|
|
7
9
|
import {
|
|
8
10
|
ASK_THE_PERSON,
|
|
9
11
|
CliError,
|
|
@@ -87,7 +89,7 @@ function settings() {
|
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
// src/api.ts
|
|
90
|
-
var VERSION = true ? "0.4.
|
|
92
|
+
var VERSION = true ? "0.4.20" : "dev";
|
|
91
93
|
function newer(a, b) {
|
|
92
94
|
const parse = (v) => /^\d+\.\d+\.\d+/.test(v) ? v.split(".").map((n) => parseInt(n)) : null;
|
|
93
95
|
const x = parse(a);
|
|
@@ -340,38 +342,8 @@ import {
|
|
|
340
342
|
statSync,
|
|
341
343
|
writeFileSync as writeFileSync2
|
|
342
344
|
} from "node:fs";
|
|
343
|
-
import {
|
|
345
|
+
import { join as join4, relative, sep } from "node:path";
|
|
344
346
|
import { Readable } from "node:stream";
|
|
345
|
-
var TYPES = {
|
|
346
|
-
".jpg": "image/jpeg",
|
|
347
|
-
".jpeg": "image/jpeg",
|
|
348
|
-
".png": "image/png",
|
|
349
|
-
".webp": "image/webp",
|
|
350
|
-
".avif": "image/avif",
|
|
351
|
-
".gif": "image/gif",
|
|
352
|
-
".svg": "image/svg+xml",
|
|
353
|
-
".mp4": "video/mp4",
|
|
354
|
-
".webm": "video/webm",
|
|
355
|
-
".mov": "video/quicktime",
|
|
356
|
-
".mp3": "audio/mpeg",
|
|
357
|
-
".m4a": "audio/mp4",
|
|
358
|
-
".aac": "audio/aac",
|
|
359
|
-
".opus": "audio/ogg",
|
|
360
|
-
".ogg": "audio/ogg",
|
|
361
|
-
".weba": "audio/webm",
|
|
362
|
-
".flac": "audio/flac",
|
|
363
|
-
".wav": "audio/wav",
|
|
364
|
-
".aif": "audio/aiff",
|
|
365
|
-
".aiff": "audio/aiff",
|
|
366
|
-
".pdf": "application/pdf",
|
|
367
|
-
".glb": "model/gltf-binary",
|
|
368
|
-
".gltf": "model/gltf+json",
|
|
369
|
-
".json": "application/json",
|
|
370
|
-
".bin": "application/octet-stream",
|
|
371
|
-
".woff2": "font/woff2",
|
|
372
|
-
".vtt": "text/vtt",
|
|
373
|
-
".txt": "text/plain"
|
|
374
|
-
};
|
|
375
347
|
var LOSSLESS = /\.(wav|aiff?|flac)$/i;
|
|
376
348
|
var shellWord = (path) => /^[\w./-]+$/.test(path) ? path : `'${path.replaceAll("'", "'\\''")}'`;
|
|
377
349
|
function sizeNote(name, size) {
|
|
@@ -439,13 +411,13 @@ async function syncMediaJson(root) {
|
|
|
439
411
|
media[name] = {
|
|
440
412
|
hash,
|
|
441
413
|
size,
|
|
442
|
-
type:
|
|
414
|
+
type: mediaTypeOf(name)
|
|
443
415
|
};
|
|
444
416
|
}
|
|
445
417
|
mkdirSync2(join4(root, ".tobos"), { recursive: true });
|
|
446
418
|
writeFileSync2(cacheFile, JSON.stringify(cache));
|
|
447
419
|
const sorted = Object.fromEntries(Object.entries(media).sort(([a], [b]) => a.localeCompare(b)));
|
|
448
|
-
const after =
|
|
420
|
+
const after = formatMediaJson(sorted);
|
|
449
421
|
if (after !== before) writeFileSync2(file2, after);
|
|
450
422
|
return { media: sorted, changed: after !== before };
|
|
451
423
|
}
|
|
@@ -758,7 +730,7 @@ async function pushedFiles(root) {
|
|
|
758
730
|
}
|
|
759
731
|
}
|
|
760
732
|
async function runCheck(dir2) {
|
|
761
|
-
const { buildDeck } = await import("./src-
|
|
733
|
+
const { buildDeck } = await import("./src-HNFV4MW7.js");
|
|
762
734
|
const started = performance.now();
|
|
763
735
|
const files = await pushedFiles(dir2.root);
|
|
764
736
|
const result = await buildDeck(directoryTree(dir2.root, files));
|
|
@@ -819,7 +791,7 @@ async function check(out, args) {
|
|
|
819
791
|
await syncMediaJson(deck.root);
|
|
820
792
|
const result = await runCheck(deck);
|
|
821
793
|
if (args.values.types) {
|
|
822
|
-
const { checkTypes } = await import("./types-
|
|
794
|
+
const { checkTypes } = await import("./types-NZUVJ337.js");
|
|
823
795
|
const sent = result.files && new Set(result.files);
|
|
824
796
|
result.problems.push(
|
|
825
797
|
...(await checkTypes(deck.root, (m) => out.note(m))).filter((p) => sent?.has(p.file) ?? true)
|
|
@@ -7,8 +7,11 @@ import {
|
|
|
7
7
|
activitiesOf,
|
|
8
8
|
buildDeck,
|
|
9
9
|
createCache,
|
|
10
|
+
formatMediaJson,
|
|
11
|
+
formatProblems,
|
|
10
12
|
isSafePath,
|
|
11
13
|
masterOf,
|
|
14
|
+
mediaTypeOf,
|
|
12
15
|
memoryTree,
|
|
13
16
|
openActivity,
|
|
14
17
|
parseDeckJson,
|
|
@@ -17,10 +20,7 @@ import {
|
|
|
17
20
|
servesModule,
|
|
18
21
|
sha256,
|
|
19
22
|
sharedManifest
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import {
|
|
22
|
-
formatProblems
|
|
23
|
-
} from "./chunk-XJ7FDNTP.js";
|
|
23
|
+
} from "./chunk-L3I6AVL4.js";
|
|
24
24
|
import "./chunk-O52ON2LV.js";
|
|
25
25
|
export {
|
|
26
26
|
ID,
|
|
@@ -28,9 +28,11 @@ export {
|
|
|
28
28
|
activitiesOf,
|
|
29
29
|
buildDeck,
|
|
30
30
|
createCache,
|
|
31
|
+
formatMediaJson,
|
|
31
32
|
formatProblems,
|
|
32
33
|
isSafePath,
|
|
33
34
|
masterOf,
|
|
35
|
+
mediaTypeOf,
|
|
34
36
|
memoryTree,
|
|
35
37
|
openActivity,
|
|
36
38
|
parseDeckJson,
|
|
@@ -3,8 +3,7 @@ import { createRequire as __tobosRequire } from 'node:module';
|
|
|
3
3
|
const require = __tobosRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
parseDeckJson
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-XJ7FDNTP.js";
|
|
6
|
+
} from "./chunk-L3I6AVL4.js";
|
|
8
7
|
import {
|
|
9
8
|
CliError
|
|
10
9
|
} from "./chunk-4CLH25WE.js";
|
package/package.json
CHANGED
package/dist/chunk-XJ7FDNTP.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __tobosRequire } from 'node:module';
|
|
3
|
-
const require = __tobosRequire(import.meta.url);
|
|
4
|
-
import {
|
|
5
|
-
init_define_TOBOS_PRESENT_TYPES,
|
|
6
|
-
init_define_TOBOS_SKILL,
|
|
7
|
-
init_define_TOBOS_TOOLCHAIN
|
|
8
|
-
} from "./chunk-O52ON2LV.js";
|
|
9
|
-
|
|
10
|
-
// ../deck/src/format-problems.ts
|
|
11
|
-
init_define_TOBOS_PRESENT_TYPES();
|
|
12
|
-
init_define_TOBOS_SKILL();
|
|
13
|
-
init_define_TOBOS_TOOLCHAIN();
|
|
14
|
-
function formatProblems(problems, limit = Infinity) {
|
|
15
|
-
const lines = problems.slice(0, limit).map((p) => {
|
|
16
|
-
const where = p.line ? `${p.file}:${p.line}${p.column ? `:${p.column}` : ""}` : p.file;
|
|
17
|
-
return `${where} ${p.severity} ${p.rule}: ${p.message}`;
|
|
18
|
-
});
|
|
19
|
-
const more = problems.length - lines.length;
|
|
20
|
-
if (more > 0) lines.push(`\u2026 and ${more} more: \`tobos check\` lists them all.`);
|
|
21
|
-
return lines.join("\n");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
formatProblems
|
|
26
|
-
};
|