yamlite 0.0.0-stage → 0.35.0

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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +746 -2
  3. package/dist/browser/aliases.d.mts +6 -0
  4. package/dist/browser/aliases.mjs +42 -0
  5. package/dist/browser/chokidar.d.mts +17 -0
  6. package/dist/browser/chokidar.mjs +64 -0
  7. package/dist/browser/crypto.d.mts +11 -0
  8. package/dist/browser/crypto.mjs +27 -0
  9. package/dist/browser/expose.d.mts +3 -0
  10. package/dist/browser/expose.mjs +80 -0
  11. package/dist/browser/fs.d.mts +85 -0
  12. package/dist/browser/fs.mjs +1 -0
  13. package/dist/browser/globals.d.mts +1 -0
  14. package/dist/browser/globals.mjs +21 -0
  15. package/dist/browser/os.d.mts +9 -0
  16. package/dist/browser/os.mjs +9 -0
  17. package/dist/browser/path.d.mts +28 -0
  18. package/dist/browser/path.mjs +15 -0
  19. package/dist/browser/sqlite.d.mts +48 -0
  20. package/dist/browser/sqlite.mjs +219 -0
  21. package/dist/browser/unavailable.d.mts +15 -0
  22. package/dist/browser/unavailable.mjs +21 -0
  23. package/dist/cli.d.mts +1 -0
  24. package/dist/cli.mjs +433 -0
  25. package/dist/core.d.mts +527 -0
  26. package/dist/core.mjs +3 -0
  27. package/dist/fs-DZ4QHM93.mjs +251 -0
  28. package/dist/guide.md +171 -0
  29. package/dist/index-BBHZ8yok.d.mts +316 -0
  30. package/dist/index.d.mts +2 -0
  31. package/dist/index.mjs +1 -0
  32. package/dist/src-DKu7thkC.mjs +8030 -0
  33. package/dist/ui/assets/ErdView-Bpo3_oCp.js +8 -0
  34. package/dist/ui/assets/ErdView-DLioOiRN.css +1 -0
  35. package/dist/ui/assets/MarkdownField-CRtDmSzB.js +32 -0
  36. package/dist/ui/assets/PageView-6iig-DcM.js +1 -0
  37. package/dist/ui/assets/index-BIkG4xcY.css +2 -0
  38. package/dist/ui/assets/index-CqIdjmI5.js +125 -0
  39. package/dist/ui/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  40. package/dist/ui/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  41. package/dist/ui/assets/jetbrains-mono-latin-700-normal-BYuf6tUa.woff2 +0 -0
  42. package/dist/ui/assets/jetbrains-mono-latin-700-normal-D3wTyLJW.woff +0 -0
  43. package/dist/ui/assets/load-kYvvjpD1.js +2 -0
  44. package/dist/ui/assets/outfit-latin-400-normal-BGsTXAXT.woff2 +0 -0
  45. package/dist/ui/assets/outfit-latin-400-normal-DMwTpYkH.woff +0 -0
  46. package/dist/ui/assets/outfit-latin-500-normal-ClnHRwRh.woff +0 -0
  47. package/dist/ui/assets/outfit-latin-500-normal-DKnIMDSk.woff2 +0 -0
  48. package/dist/ui/assets/outfit-latin-600-normal-B7SfZ07L.woff2 +0 -0
  49. package/dist/ui/assets/outfit-latin-600-normal-BEfTtDA7.woff +0 -0
  50. package/dist/ui/assets/outfit-latin-700-normal-Cu9v6i1X.woff2 +0 -0
  51. package/dist/ui/assets/outfit-latin-700-normal-D4itBLBr.woff +0 -0
  52. package/dist/ui/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  53. package/dist/ui/assets/sql-wasm-C1D_RJuy.wasm +0 -0
  54. package/dist/ui/assets/sql-wasm-Dnr4gnQb.js +1 -0
  55. package/dist/ui/assets/sql-wasm-browser-CNwHQfY0.js +2 -0
  56. package/dist/ui/assets/theme-CMaLONsO.js +1 -0
  57. package/dist/ui/favicon.svg +6 -0
  58. package/dist/ui/index.html +26 -0
  59. package/dist/ui-embed/ErdView-Dk-iexgy.js +10362 -0
  60. package/dist/ui-embed/HintPopover-D5P2UuTa.js +8257 -0
  61. package/dist/ui-embed/MarkdownField-DTAEh2oz.js +5211 -0
  62. package/dist/ui-embed/PageView-Cpq5JtTW.js +818 -0
  63. package/dist/ui-embed/activity-letLdXN4.js +190 -0
  64. package/dist/ui-embed/dist-CkcIwL4M.js +8142 -0
  65. package/dist/ui-embed/embed.js +18684 -0
  66. package/dist/ui-embed/favicon.svg +6 -0
  67. package/dist/ui-embed/page-frame.js +7 -0
  68. package/dist/ui-embed/pageFrame-Dm62WvvT.js +2556 -0
  69. package/dist/ui-embed/style.css +3 -0
  70. package/dist/ui-embed/tabs-CLBiDAgo.js +17095 -0
  71. package/dist/ui-embed/theme-BwJfOY1V.js +2951 -0
  72. package/dist/workspace-BHg_GGkH.mjs +896 -0
  73. package/package.json +171 -3
@@ -0,0 +1,6 @@
1
+ //#region src/browser/aliases.d.ts
2
+ export declare function browserAliases(): {
3
+ find: RegExp;
4
+ replacement: string;
5
+ }[];
6
+ //#endregion
@@ -0,0 +1,42 @@
1
+ import { fileURLToPath } from "node:url";
2
+ //#region src/browser/aliases.ts
3
+ const ext = import.meta.url.endsWith(".ts") ? ".ts" : ".mjs";
4
+ const here = (name) => fileURLToPath(new URL(`./${name}${ext}`, import.meta.url));
5
+ function browserAliases() {
6
+ return [
7
+ {
8
+ find: /^node:sqlite$/,
9
+ replacement: here("sqlite")
10
+ },
11
+ {
12
+ find: /^node:fs$/,
13
+ replacement: here("fs")
14
+ },
15
+ {
16
+ find: /^(node:)?path$/,
17
+ replacement: here("path")
18
+ },
19
+ {
20
+ find: /^node:os$/,
21
+ replacement: here("os")
22
+ },
23
+ {
24
+ find: /^node:crypto$/,
25
+ replacement: here("crypto")
26
+ },
27
+ {
28
+ find: /^(node:url|node:child_process|node:stream|node:http|node:util|node:module)$/,
29
+ replacement: here("unavailable")
30
+ },
31
+ {
32
+ find: /^chokidar$/,
33
+ replacement: here("chokidar")
34
+ },
35
+ {
36
+ find: /^buffer$/,
37
+ replacement: fileURLToPath(import.meta.resolve("buffer/index.js"))
38
+ }
39
+ ];
40
+ }
41
+ //#endregion
42
+ export { browserAliases };
@@ -0,0 +1,17 @@
1
+ //#region src/browser/chokidar.d.ts
2
+ type Listener = (...args: any[]) => void;
3
+ export interface FSWatcher {
4
+ on(event: string, fn: Listener): FSWatcher;
5
+ once(event: string, fn: Listener): FSWatcher;
6
+ add(paths: string | string[]): FSWatcher;
7
+ unwatch(paths: string | string[]): FSWatcher;
8
+ close(): Promise<void>;
9
+ }
10
+ interface Options {
11
+ depth?: number;
12
+ ignored?: (path: string) => boolean;
13
+ ignoreInitial?: boolean;
14
+ }
15
+ export declare function watch(paths: string | string[], opts?: Options): FSWatcher;
16
+ //#endregion
17
+ export {};
@@ -0,0 +1,64 @@
1
+ import { p as onChange } from "../fs-DZ4QHM93.mjs";
2
+ import { resolve } from "pathe";
3
+ //#region src/browser/chokidar.ts
4
+ const list = (paths) => (Array.isArray(paths) ? paths : [paths]).map((p) => resolve(p));
5
+ const below = (root, path) => {
6
+ if (path === root) return [];
7
+ const prefix = root === "/" ? "/" : `${root}/`;
8
+ return path.startsWith(prefix) ? path.slice(prefix.length).split("/") : null;
9
+ };
10
+ function watch(paths, opts = {}) {
11
+ const roots = new Set(list(paths));
12
+ const listeners = /* @__PURE__ */ new Map();
13
+ let closed = false;
14
+ const fire = (event, ...args) => {
15
+ for (const fn of Array.from(listeners.get(event) ?? [])) fn(...args);
16
+ };
17
+ const wanted = (path) => [...roots].some((root) => {
18
+ const parts = below(root, path);
19
+ if (!parts) return false;
20
+ if (opts.depth !== void 0 && parts.length > 0 && parts.length - 1 > opts.depth) return false;
21
+ let at = root;
22
+ return !parts.some((part) => {
23
+ at = at === "/" ? `/${part}` : `${at}/${part}`;
24
+ return opts.ignored?.(at);
25
+ });
26
+ });
27
+ const off = onChange((event, path) => {
28
+ if (closed || !wanted(path)) return;
29
+ fire(event, path);
30
+ fire("all", event, path);
31
+ });
32
+ const w = {
33
+ on(event, fn) {
34
+ const set = listeners.get(event) ?? /* @__PURE__ */ new Set();
35
+ set.add(fn);
36
+ listeners.set(event, set);
37
+ return w;
38
+ },
39
+ once(event, fn) {
40
+ const wrapped = (...args) => {
41
+ listeners.get(event)?.delete(wrapped);
42
+ fn(...args);
43
+ };
44
+ return w.on(event, wrapped);
45
+ },
46
+ add(p) {
47
+ for (const x of list(p)) roots.add(x);
48
+ return w;
49
+ },
50
+ unwatch(p) {
51
+ for (const x of list(p)) roots.delete(x);
52
+ return w;
53
+ },
54
+ async close() {
55
+ closed = true;
56
+ off();
57
+ listeners.clear();
58
+ }
59
+ };
60
+ queueMicrotask(() => !closed && fire("ready"));
61
+ return w;
62
+ }
63
+ //#endregion
64
+ export { watch };
@@ -0,0 +1,11 @@
1
+ //#region src/browser/crypto.d.ts
2
+ export declare function createHash(alg: string): {
3
+ update(data: string | Uint8Array): {
4
+ update(data: string | Uint8Array): /*elided*/ any;
5
+ digest(enc: "hex"): string;
6
+ };
7
+ digest(enc: "hex"): string;
8
+ };
9
+ export declare const randomBytes: (n: number) => Buffer<ArrayBuffer>;
10
+ export declare const timingSafeEqual: (a: Uint8Array, b: Uint8Array) => boolean;
11
+ //#endregion
@@ -0,0 +1,27 @@
1
+ import { sha256 } from "@noble/hashes/sha2.js";
2
+ import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
3
+ //#region src/browser/crypto.ts
4
+ function createHash(alg) {
5
+ if (alg !== "sha256") throw new Error(`createHash(${alg}) is not available in the browser build`);
6
+ const parts = [];
7
+ return {
8
+ update(data) {
9
+ parts.push(typeof data === "string" ? utf8ToBytes(data) : data);
10
+ return this;
11
+ },
12
+ digest(enc) {
13
+ const all = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));
14
+ let at = 0;
15
+ for (const p of parts) {
16
+ all.set(p, at);
17
+ at += p.length;
18
+ }
19
+ if (enc !== "hex") throw new Error("only hex digests");
20
+ return bytesToHex(sha256(all));
21
+ }
22
+ };
23
+ }
24
+ const randomBytes = (n) => Buffer.from(crypto.getRandomValues(new Uint8Array(n)));
25
+ const timingSafeEqual = (a, b) => a.length === b.length && a.every((x, i) => x === b[i]);
26
+ //#endregion
27
+ export { createHash, randomBytes, timingSafeEqual };
@@ -0,0 +1,3 @@
1
+ //#region src/browser/expose.d.ts
2
+ export declare function expose(port: MessagePort, dispatch: (r: Request) => Promise<Response>): () => void;
3
+ //#endregion
@@ -0,0 +1,80 @@
1
+ //#region src/browser/expose.ts
2
+ function expose(port, dispatch) {
3
+ const open = /* @__PURE__ */ new Map();
4
+ port.onmessage = async (e) => {
5
+ const m = e.data;
6
+ if (m.kind === "abort") {
7
+ open.get(m.id)?.abort();
8
+ return;
9
+ }
10
+ const ac = new AbortController();
11
+ open.set(m.id, ac);
12
+ let headSent = false;
13
+ try {
14
+ const res = await dispatch(new Request(new URL(m.url, "http://worker"), {
15
+ method: m.method,
16
+ headers: m.headers,
17
+ body: m.body,
18
+ signal: ac.signal
19
+ }));
20
+ if (ac.signal.aborted) {
21
+ res.body?.cancel();
22
+ return;
23
+ }
24
+ port.postMessage({
25
+ id: m.id,
26
+ kind: "head",
27
+ status: res.status,
28
+ headers: [...res.headers]
29
+ });
30
+ headSent = true;
31
+ if (res.body) {
32
+ const decoder = new TextDecoder();
33
+ const reader = res.body.getReader();
34
+ ac.signal.addEventListener("abort", () => void reader.cancel(), { once: true });
35
+ for (;;) {
36
+ const { done, value } = await reader.read();
37
+ if (done) break;
38
+ port.postMessage({
39
+ id: m.id,
40
+ kind: "chunk",
41
+ data: decoder.decode(value, { stream: true })
42
+ });
43
+ }
44
+ const rest = decoder.decode();
45
+ if (rest) port.postMessage({
46
+ id: m.id,
47
+ kind: "chunk",
48
+ data: rest
49
+ });
50
+ }
51
+ } catch (err) {
52
+ if (!ac.signal.aborted && !headSent) {
53
+ port.postMessage({
54
+ id: m.id,
55
+ kind: "head",
56
+ status: 500,
57
+ headers: [["content-type", "application/json"]]
58
+ });
59
+ port.postMessage({
60
+ id: m.id,
61
+ kind: "chunk",
62
+ data: JSON.stringify({ error: String(err) })
63
+ });
64
+ }
65
+ } finally {
66
+ open.delete(m.id);
67
+ port.postMessage({
68
+ id: m.id,
69
+ kind: "end"
70
+ });
71
+ }
72
+ };
73
+ port.start?.();
74
+ return () => {
75
+ for (const ac of open.values()) ac.abort();
76
+ port.onmessage = null;
77
+ };
78
+ }
79
+ //#endregion
80
+ export { expose };
@@ -0,0 +1,85 @@
1
+ //#region src/browser/fs.d.ts
2
+ export type FsEvent = "add" | "change" | "unlink" | "addDir" | "unlinkDir";
3
+ export declare function onChange(fn: (event: FsEvent, path: string) => void): () => void;
4
+ export declare function onRemove(fn: (path: string) => void): void;
5
+ export declare function external(fn: (path: string) => boolean): void;
6
+ export declare const constants: {
7
+ F_OK: number;
8
+ R_OK: number;
9
+ W_OK: number;
10
+ X_OK: number;
11
+ };
12
+ export declare const existsSync: (p: string) => boolean;
13
+ export declare function statSync(p: string, opts?: {
14
+ throwIfNoEntry?: boolean;
15
+ }): {
16
+ isDirectory: () => boolean;
17
+ isFile: () => boolean;
18
+ isSymbolicLink: () => boolean;
19
+ mtimeMs: number;
20
+ mtime: Date;
21
+ size: number;
22
+ mode: number;
23
+ } | undefined;
24
+ export declare const lstatSync: typeof statSync;
25
+ export declare function accessSync(p: string): void;
26
+ export declare function realpathSync(p: string): string;
27
+ export declare function readFileSync(p: string, opts?: string | {
28
+ encoding?: string;
29
+ }): string | Buffer<ArrayBuffer>;
30
+ export declare function writeFileSync(p: string, content: string | Uint8Array, opts?: {
31
+ flag?: string;
32
+ } | string): void;
33
+ export declare function mkdirSync(p: string, opts?: {
34
+ recursive?: boolean;
35
+ }): string | undefined;
36
+ export declare function readdirSync(p: string, opts?: {
37
+ withFileTypes?: boolean;
38
+ }): string[] | {
39
+ name: string;
40
+ parentPath: string;
41
+ path: string;
42
+ isDirectory: () => boolean;
43
+ isFile: () => boolean;
44
+ isSymbolicLink: () => boolean;
45
+ }[];
46
+ export declare function unlinkSync(p: string): void;
47
+ export declare function rmdirSync(p: string): void;
48
+ export declare function rmSync(p: string, opts?: {
49
+ recursive?: boolean;
50
+ force?: boolean;
51
+ }): void;
52
+ export declare function renameSync(from: string, to: string): void;
53
+ export declare function linkSync(from: string, to: string): void;
54
+ export declare function cpSync(from: string, to: string): void;
55
+ export declare function chmodSync(p: string, mode: number): void;
56
+ export declare function mkdtempSync(prefix: string): string;
57
+ export declare function createReadStream(): never;
58
+ declare const _default: {
59
+ accessSync: typeof accessSync;
60
+ chmodSync: typeof chmodSync;
61
+ constants: {
62
+ F_OK: number;
63
+ R_OK: number;
64
+ W_OK: number;
65
+ X_OK: number;
66
+ };
67
+ cpSync: typeof cpSync;
68
+ createReadStream: typeof createReadStream;
69
+ existsSync: typeof existsSync;
70
+ linkSync: typeof linkSync;
71
+ lstatSync: typeof statSync;
72
+ mkdirSync: typeof mkdirSync;
73
+ mkdtempSync: typeof mkdtempSync;
74
+ readdirSync: typeof readdirSync;
75
+ readFileSync: typeof readFileSync;
76
+ realpathSync: typeof realpathSync;
77
+ renameSync: typeof renameSync;
78
+ rmdirSync: typeof rmdirSync;
79
+ rmSync: typeof rmSync;
80
+ statSync: typeof statSync;
81
+ unlinkSync: typeof unlinkSync;
82
+ writeFileSync: typeof writeFileSync;
83
+ };
84
+ //#endregion
85
+ export { _default as default };
@@ -0,0 +1 @@
1
+ export { t as accessSync, n as chmodSync, r as constants, i as cpSync, a as createReadStream, c as default, o as existsSync, s as external, l as linkSync, u as lstatSync, d as mkdirSync, f as mkdtempSync, p as onChange, m as onRemove, h as readFileSync, g as readdirSync, _ as realpathSync, v as renameSync, y as rmSync, b as rmdirSync, x as statSync, S as unlinkSync, C as writeFileSync } from "../fs-DZ4QHM93.mjs";
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,21 @@
1
+ import { Buffer } from "buffer";
2
+ //#region src/browser/globals.ts
3
+ const g = globalThis;
4
+ g.Buffer ??= Buffer;
5
+ g.global ??= globalThis;
6
+ g.process ??= {
7
+ env: {},
8
+ pid: 1,
9
+ platform: "browser",
10
+ argv: [],
11
+ versions: {},
12
+ cwd: () => "/",
13
+ kill: () => true,
14
+ nextTick: (fn, ...args) => queueMicrotask(() => fn(...args)),
15
+ emitWarning: () => {},
16
+ on: () => {},
17
+ once: () => {},
18
+ getuid: () => 1e3
19
+ };
20
+ //#endregion
21
+ export {};
@@ -0,0 +1,9 @@
1
+ //#region src/browser/os.d.ts
2
+ export declare const tmpdir: () => string;
3
+ export declare const homedir: () => string;
4
+ declare const _default: {
5
+ tmpdir: typeof tmpdir;
6
+ homedir: typeof homedir;
7
+ };
8
+ //#endregion
9
+ export { _default as default };
@@ -0,0 +1,9 @@
1
+ //#region src/browser/os.ts
2
+ const tmpdir = () => "/tmp";
3
+ const homedir = () => "/home";
4
+ var os_default = {
5
+ tmpdir,
6
+ homedir
7
+ };
8
+ //#endregion
9
+ export { os_default as default, homedir, tmpdir };
@@ -0,0 +1,28 @@
1
+ import * as pathe from "pathe";
2
+ export * from "pathe";
3
+ //#region src/browser/path.d.ts
4
+ export declare const posix: typeof pathe;
5
+ export declare const delimiter = ":";
6
+ export declare const matchesGlob: (path: string, glob: string) => boolean;
7
+ declare const _default: {
8
+ basename: typeof import("node:path").basename;
9
+ default: typeof import("node:path");
10
+ dirname: typeof import("node:path").dirname;
11
+ extname: typeof import("node:path").extname;
12
+ format: typeof import("node:path").format;
13
+ isAbsolute: typeof import("node:path").isAbsolute;
14
+ join: typeof import("node:path").join;
15
+ normalize: typeof import("node:path").normalize;
16
+ normalizeString: typeof pathe.normalizeString;
17
+ parse: typeof import("node:path").parse;
18
+ relative: typeof import("node:path").relative;
19
+ resolve: typeof import("node:path").resolve;
20
+ sep: "/";
21
+ toNamespacedPath: typeof import("node:path").toNamespacedPath;
22
+ win32: typeof import("node:path");
23
+ posix: typeof pathe;
24
+ delimiter: string;
25
+ matchesGlob: typeof matchesGlob;
26
+ };
27
+ //#endregion
28
+ export { _default as default };
@@ -0,0 +1,15 @@
1
+ import * as pathe from "pathe";
2
+ import picomatch from "picomatch";
3
+ export * from "pathe";
4
+ //#region src/browser/path.ts
5
+ const posix = pathe;
6
+ const delimiter = ":";
7
+ const matchesGlob = (path, glob) => picomatch(glob, { dot: true })(path);
8
+ var path_default = {
9
+ ...pathe,
10
+ posix: pathe,
11
+ delimiter: ":",
12
+ matchesGlob
13
+ };
14
+ //#endregion
15
+ export { path_default as default, delimiter, matchesGlob, posix };
@@ -0,0 +1,48 @@
1
+ //#region src/browser/sqlite.d.ts
2
+ export declare const sqlite3: any;
3
+ export declare const opfs: any;
4
+ export declare function registerVfs(name: string): void;
5
+ type Value = null | number | bigint | string | Uint8Array;
6
+ type Row = Record<string, Value>;
7
+ export declare const constants: Record<string, number>;
8
+ export declare class StatementSync {
9
+ private readonly db;
10
+ private readonly stmt;
11
+ private bigInts;
12
+ private arrays;
13
+ constructor(db: any, stmt: any, open: Set<any>);
14
+ setReadBigInts(on: boolean): void;
15
+ setReturnArrays(on: boolean): void;
16
+ columns(): Array<{
17
+ name: string;
18
+ type: string | null;
19
+ }>;
20
+ private bind;
21
+ private row;
22
+ private step;
23
+ all(...params: unknown[]): (Value[] | Row)[];
24
+ get(...params: unknown[]): Value[] | Row | undefined;
25
+ iterate(...params: unknown[]): Generator<Value[] | Row, void, unknown>;
26
+ run(...params: unknown[]): {
27
+ changes: bigint;
28
+ lastInsertRowid: bigint;
29
+ } | {
30
+ changes: number;
31
+ lastInsertRowid: number;
32
+ };
33
+ }
34
+ export declare class DatabaseSync {
35
+ private readonly db;
36
+ private readonly stmts;
37
+ constructor(path: string, opts?: {
38
+ readOnly?: boolean;
39
+ });
40
+ get isOpen(): boolean;
41
+ get isTransaction(): boolean;
42
+ exec(sql: string): void;
43
+ prepare(sql: string): StatementSync;
44
+ setAuthorizer(fn: ((action: number, ...args: Array<string | null>) => number) | null): void;
45
+ close(): void;
46
+ }
47
+ //#endregion
48
+ export {};