@tarve/core 0.4.0 → 0.6.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.
- package/CHANGELOG.md +126 -1
- package/README.md +121 -12
- package/dist/npm/build.js +1401 -85
- package/dist/npm/cli.js +1940 -117
- package/dist/npm/embedded-assets.js +22 -3
- package/dist/npm/index.js +5274 -975
- package/dist/npm/jsx-dev-runtime.js +1268 -0
- package/dist/npm/jsx-runtime.js +1268 -0
- package/dist/npm/native-runtime.json +3 -3
- package/dist/npm/node-build.js +1159 -0
- package/dist/npm/protocol.js +1 -1
- package/dist/npm/runtime.js +5 -5
- package/dist/npm/txiki/fetch.ts +228 -0
- package/dist/npm/txiki/intl-data.ts +7 -0
- package/dist/npm/txiki/intl.test.ts +53 -0
- package/dist/npm/txiki/intl.ts +249 -0
- package/dist/npm/txiki/prelude.ts +132 -0
- package/dist/npm/txiki/runtime.ts +6 -0
- package/dist/npm/txiki/shims/buffer.ts +112 -0
- package/dist/npm/txiki/shims/child-process.ts +151 -0
- package/dist/npm/txiki/shims/crypto.ts +30 -0
- package/dist/npm/txiki/shims/events.ts +75 -0
- package/dist/npm/txiki/shims/fs-promises.ts +77 -0
- package/dist/npm/txiki/shims/fs.ts +231 -0
- package/dist/npm/txiki/shims/module.ts +8 -0
- package/dist/npm/txiki/shims/net.ts +69 -0
- package/dist/npm/txiki/shims/os.ts +72 -0
- package/dist/npm/txiki/shims/path.ts +4 -0
- package/dist/npm/txiki/shims/timers-promises.ts +9 -0
- package/dist/npm/txiki/shims/zlib.ts +9 -0
- package/dist/npm/txiki/tjs.d.ts +58 -0
- package/dist/npm/txiki/unavailable.ts +10 -0
- package/dist/types/core/build.d.ts +24 -0
- package/dist/types/core/cli.d.ts +1 -1
- package/dist/types/core/esbuild-file-imports.d.ts +8 -0
- package/dist/types/core/jsx-compile.d.ts +7 -0
- package/dist/types/core/node-build.d.ts +7 -0
- package/dist/types/core/node-dev.d.ts +4 -0
- package/dist/types/core/node-target.d.ts +10 -0
- package/dist/types/core/package-metadata.d.ts +49 -0
- package/dist/types/core/runtime-select.d.ts +8 -0
- package/dist/types/core/src/advanced-controls.d.ts +1 -1
- package/dist/types/core/src/app/element-events.d.ts +18 -0
- package/dist/types/core/src/app/media.d.ts +15 -0
- package/dist/types/core/src/app/requests.d.ts +25 -0
- package/dist/types/core/src/app/shadow.d.ts +7 -0
- package/dist/types/core/src/app/stats.d.ts +12 -0
- package/dist/types/core/src/app/tray.d.ts +40 -0
- package/dist/types/core/src/app-metadata.d.ts +18 -0
- package/dist/types/core/src/app.d.ts +89 -2
- package/dist/types/core/src/assets.d.ts +4 -0
- package/dist/types/core/src/bridge/binding.d.ts +10 -34
- package/dist/types/core/src/bridge/index.d.ts +1 -1
- package/dist/types/core/src/canvas.d.ts +161 -0
- package/dist/types/core/src/chat-controls.d.ts +2 -1
- package/dist/types/core/src/components/button.d.ts +1 -1
- package/dist/types/core/src/components/glass.d.ts +52 -0
- package/dist/types/core/src/components/icon.d.ts +1 -1
- package/dist/types/core/src/components/image.d.ts +8 -4
- package/dist/types/core/src/components/layout.d.ts +5 -4
- package/dist/types/core/src/components/pressable.d.ts +3 -3
- package/dist/types/core/src/components/rich-content.d.ts +1 -1
- package/dist/types/core/src/components/scroll.d.ts +2 -2
- package/dist/types/core/src/components/svg.d.ts +1 -1
- package/dist/types/core/src/components/titlebar.d.ts +15 -1
- package/dist/types/core/src/components/window.d.ts +21 -1
- package/dist/types/core/src/components.d.ts +2 -0
- package/dist/types/core/src/css-shadow.d.ts +1 -1
- package/dist/types/core/src/desktop-controls.d.ts +2 -2
- package/dist/types/core/src/embedded-assets.d.ts +3 -2
- package/dist/types/core/src/extra-controls.d.ts +2 -2
- package/dist/types/core/src/form-controls.d.ts +1 -1
- package/dist/types/core/src/html-elements.d.ts +26 -0
- package/dist/types/core/src/index.d.ts +23 -11
- package/dist/types/core/src/inline-text.d.ts +25 -0
- package/dist/types/core/src/intrinsic-style.d.ts +1 -1
- package/dist/types/core/src/jsx-runtime.d.ts +182 -5
- package/dist/types/core/src/media-element.d.ts +70 -0
- package/dist/types/core/src/memo.d.ts +28 -0
- package/dist/types/core/src/motion.d.ts +1 -1
- package/dist/types/core/src/png.d.ts +29 -0
- package/dist/types/core/src/popups.d.ts +4 -3
- package/dist/types/core/src/protocol.d.ts +6 -0
- package/dist/types/core/src/reconciler/diff.d.ts +11 -0
- package/dist/types/core/src/reconciler/intrinsics.d.ts +24 -0
- package/dist/types/core/src/reconciler.d.ts +33 -10
- package/dist/types/core/src/render-scope.d.ts +8 -0
- package/dist/types/core/src/style.d.ts +1 -1
- package/dist/types/core/src/tailwind-palette.d.ts +1 -0
- package/dist/types/core/src/tailwind.d.ts +8 -0
- package/dist/types/core/src/test-renderer.d.ts +3 -1
- package/dist/types/core/src/text-search.d.ts +1 -1
- package/dist/types/core/src/theme.d.ts +10 -2
- package/dist/types/core/src/updates.d.ts +87 -0
- package/dist/types/core/src/virtual-list.d.ts +8 -2
- package/dist/types/core/txiki/fetch.d.ts +1 -0
- package/dist/types/core/txiki/intl-data.d.ts +6 -0
- package/dist/types/core/txiki/intl.d.ts +92 -0
- package/dist/types/core/txiki/prelude.d.ts +1 -0
- package/dist/types/core/txiki/runtime.d.ts +2 -0
- package/dist/types/core/txiki/shims/buffer.d.ts +37 -0
- package/dist/types/core/txiki/shims/child-process.d.ts +46 -0
- package/dist/types/core/txiki/shims/crypto.d.ts +16 -0
- package/dist/types/core/txiki/shims/events.d.ts +21 -0
- package/dist/types/core/txiki/shims/fs-promises.d.ts +41 -0
- package/dist/types/core/txiki/shims/fs.d.ts +44 -0
- package/dist/types/core/txiki/shims/module.d.ts +5 -0
- package/dist/types/core/txiki/shims/net.d.ts +22 -0
- package/dist/types/core/txiki/shims/os.d.ts +52 -0
- package/dist/types/core/txiki/shims/path.d.ts +3 -0
- package/dist/types/core/txiki/shims/timers-promises.d.ts +7 -0
- package/dist/types/core/txiki/shims/zlib.d.ts +11 -0
- package/dist/types/core/txiki/unavailable.d.ts +5 -0
- package/dist/types/core/txiki-build.d.ts +23 -0
- package/dist/types/core/updates-build.d.ts +35 -0
- package/dist/types/core/windows-executable.d.ts +16 -0
- package/dist/types/protocol/src/index.d.ts +344 -11
- package/native/linux-x64/libtarve_native.so +0 -0
- package/native/linux-x64/runtime.json +4 -4
- package/native/win32-x64/runtime.json +4 -4
- package/native/win32-x64/tarve_native.dll +0 -0
- package/package.json +13 -3
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** node:events: the EventEmitter subset apps and the shims use. */
|
|
2
|
+
type Listener = (...args: any[]) => void;
|
|
3
|
+
|
|
4
|
+
export class EventEmitter {
|
|
5
|
+
private readonly events = new Map<string | symbol, Listener[]>();
|
|
6
|
+
|
|
7
|
+
on(event: string | symbol, listener: Listener): this {
|
|
8
|
+
this.events.set(event, [...this.events.get(event) ?? [], listener]);
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
addListener(event: string | symbol, listener: Listener): this {
|
|
13
|
+
return this.on(event, listener);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
once(event: string | symbol, listener: Listener): this {
|
|
17
|
+
const wrapper: Listener = (...args) => {
|
|
18
|
+
this.off(event, wrapper);
|
|
19
|
+
listener(...args);
|
|
20
|
+
};
|
|
21
|
+
return this.on(event, wrapper);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
off(event: string | symbol, listener: Listener): this {
|
|
25
|
+
const listeners = this.events.get(event);
|
|
26
|
+
if (listeners) this.events.set(event, listeners.filter(item => item !== listener));
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
removeListener(event: string | symbol, listener: Listener): this {
|
|
31
|
+
return this.off(event, listener);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
removeAllListeners(event?: string | symbol): this {
|
|
35
|
+
if (event === undefined) this.events.clear();
|
|
36
|
+
else this.events.delete(event);
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
emit(event: string | symbol, ...args: unknown[]): boolean {
|
|
41
|
+
const listeners = this.events.get(event);
|
|
42
|
+
if (!listeners?.length) {
|
|
43
|
+
if (event === "error") throw args[0] instanceof Error ? args[0] : new Error(String(args[0]));
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
for (const listener of [...listeners]) listener(...args);
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
listenerCount(event: string | symbol): number {
|
|
51
|
+
return this.events.get(event)?.length ?? 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
setMaxListeners(_count: number): this {
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Resolves with the event's arguments; rejects on "error" (except when waiting for "error"). */
|
|
60
|
+
export function once(emitter: EventEmitter, event: string): Promise<unknown[]> {
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
const done = (...args: unknown[]) => {
|
|
63
|
+
emitter.off("error", fail);
|
|
64
|
+
resolve(args);
|
|
65
|
+
};
|
|
66
|
+
const fail = (error: unknown) => {
|
|
67
|
+
emitter.off(event, done);
|
|
68
|
+
reject(error);
|
|
69
|
+
};
|
|
70
|
+
emitter.once(event, done);
|
|
71
|
+
if (event !== "error") emitter.once("error", fail);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default Object.assign(EventEmitter, { EventEmitter, once });
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** node:fs/promises over the asynchronous tjs file API. */
|
|
2
|
+
import { Buffer } from "./buffer";
|
|
3
|
+
|
|
4
|
+
type Encoding = BufferEncoding | { encoding?: BufferEncoding | null } | null | undefined;
|
|
5
|
+
|
|
6
|
+
function encodingOf(options: Encoding): BufferEncoding | undefined {
|
|
7
|
+
return typeof options === "string" ? options : options?.encoding ?? undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface TjsFiles {
|
|
11
|
+
readFile(path: string): Promise<Uint8Array>;
|
|
12
|
+
writeFile(path: string, data: Uint8Array): Promise<void>;
|
|
13
|
+
makeDir(path: string, options?: { recursive?: boolean }): Promise<void>;
|
|
14
|
+
makeTempDir(template: string): Promise<string>;
|
|
15
|
+
remove(path: string): Promise<void>;
|
|
16
|
+
rename(from: string, to: string): Promise<void>;
|
|
17
|
+
copyFile(from: string, to: string): Promise<void>;
|
|
18
|
+
stat(path: string): Promise<{ size: number; isFile: boolean; isDirectory: boolean; mtim: Date }>;
|
|
19
|
+
readDir(path: string): Promise<AsyncIterable<{ name: string; isFile: boolean; isDirectory: boolean }> & { close(): Promise<void> }>;
|
|
20
|
+
}
|
|
21
|
+
const files = tjs as unknown as TjsFiles;
|
|
22
|
+
|
|
23
|
+
export async function readFile(path: string, options?: Encoding): Promise<any> {
|
|
24
|
+
const bytes = Buffer.from(await files.readFile(path));
|
|
25
|
+
const encoding = encodingOf(options);
|
|
26
|
+
return encoding ? bytes.toString(encoding as "utf8") : bytes;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function writeFile(path: string, data: string | Uint8Array): Promise<void> {
|
|
30
|
+
await files.writeFile(path, typeof data === "string" ? Buffer.from(data) : data);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function mkdir(path: string, options?: { recursive?: boolean }): Promise<void> {
|
|
34
|
+
await files.makeDir(path, options);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export async function mkdtemp(prefix: string): Promise<string> {
|
|
38
|
+
return files.makeTempDir(`${prefix}XXXXXX`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function rm(path: string, options?: { force?: boolean; recursive?: boolean }): Promise<void> {
|
|
42
|
+
try {
|
|
43
|
+
await files.stat(path);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
if (options?.force) return;
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
await files.remove(path);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const unlink = (path: string) => files.remove(path);
|
|
52
|
+
export const rename = (from: string, to: string) => files.rename(from, to);
|
|
53
|
+
export const copyFile = (from: string, to: string) => files.copyFile(from, to);
|
|
54
|
+
|
|
55
|
+
export async function stat(path: string) {
|
|
56
|
+
const info = await files.stat(path);
|
|
57
|
+
return { size: info.size, mtimeMs: info.mtim.getTime(), mtime: info.mtim, isFile: () => info.isFile, isDirectory: () => info.isDirectory };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export async function access(path: string): Promise<void> {
|
|
61
|
+
await files.stat(path);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function readdir(path: string, options?: { withFileTypes?: boolean }): Promise<any[]> {
|
|
65
|
+
const directory = await files.readDir(path);
|
|
66
|
+
const entries: any[] = [];
|
|
67
|
+
try {
|
|
68
|
+
for await (const entry of directory) {
|
|
69
|
+
entries.push(options?.withFileTypes ? { name: entry.name, isFile: () => entry.isFile, isDirectory: () => entry.isDirectory } : entry.name);
|
|
70
|
+
}
|
|
71
|
+
} finally {
|
|
72
|
+
await directory.close();
|
|
73
|
+
}
|
|
74
|
+
return entries;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default { access, copyFile, mkdir, mkdtemp, readFile, readdir, rename, rm, stat, unlink, writeFile };
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synchronous node:fs over the C runtime, through tjs:ffi: txiki.js only has an
|
|
3
|
+
* asynchronous file API, and the core reads icons, fonts and assets synchronously.
|
|
4
|
+
*/
|
|
5
|
+
import { dlopen } from "tjs:ffi";
|
|
6
|
+
import { Buffer } from "./buffer";
|
|
7
|
+
|
|
8
|
+
declare const TARVE_TXIKI_PLATFORM: "win32" | "linux";
|
|
9
|
+
const windows = TARVE_TXIKI_PLATFORM === "win32";
|
|
10
|
+
|
|
11
|
+
const S_IFMT = 0xf000;
|
|
12
|
+
const S_IFDIR = 0x4000;
|
|
13
|
+
const S_IFREG = 0x8000;
|
|
14
|
+
|
|
15
|
+
function load() {
|
|
16
|
+
if (windows) {
|
|
17
|
+
const c = dlopen("ucrtbase.dll", {
|
|
18
|
+
_wfopen: { args: ["buffer", "buffer"], returns: "ptr" },
|
|
19
|
+
fclose: { args: ["ptr"], returns: "i32" },
|
|
20
|
+
fread: { args: ["buffer", "size_t", "size_t", "ptr"], returns: "size_t" },
|
|
21
|
+
fwrite: { args: ["buffer", "size_t", "size_t", "ptr"], returns: "size_t" },
|
|
22
|
+
_wstat64: { args: ["buffer", "buffer"], returns: "i32" },
|
|
23
|
+
_wmkdir: { args: ["buffer"], returns: "i32" },
|
|
24
|
+
_wremove: { args: ["buffer"], returns: "i32" },
|
|
25
|
+
_wrmdir: { args: ["buffer"], returns: "i32" },
|
|
26
|
+
}).symbols;
|
|
27
|
+
const kernel = dlopen("kernel32.dll", {
|
|
28
|
+
MoveFileExW: { args: ["buffer", "buffer", "u32"], returns: "i32" },
|
|
29
|
+
FindFirstFileW: { args: ["buffer", "buffer"], returns: "ptr" },
|
|
30
|
+
FindNextFileW: { args: ["ptr", "buffer"], returns: "i32" },
|
|
31
|
+
FindClose: { args: ["ptr"], returns: "i32" },
|
|
32
|
+
}).symbols;
|
|
33
|
+
const wide = (value: string) => {
|
|
34
|
+
const units = new Uint16Array(value.length + 1);
|
|
35
|
+
for (let index = 0; index < value.length; index++) units[index] = value.charCodeAt(index);
|
|
36
|
+
return new Uint8Array(units.buffer);
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
open: (path: string, mode: string) => c._wfopen(wide(path), wide(mode)),
|
|
40
|
+
close: c.fclose, read: c.fread, write: c.fwrite,
|
|
41
|
+
// struct _stat64: st_mode is a u16 at 6, st_size an i64 at 24, st_mtime an i64 at 40.
|
|
42
|
+
stat(path: string) {
|
|
43
|
+
const buffer = new Uint8Array(56);
|
|
44
|
+
if (c._wstat64(wide(path), buffer) !== 0) return undefined;
|
|
45
|
+
const view = new DataView(buffer.buffer);
|
|
46
|
+
return { mode: view.getUint16(6, true), size: Number(view.getBigInt64(24, true)), mtimeMs: Number(view.getBigInt64(40, true)) * 1000 };
|
|
47
|
+
},
|
|
48
|
+
mkdir: (path: string) => c._wmkdir(wide(path)),
|
|
49
|
+
remove: (path: string) => c._wremove(wide(path)),
|
|
50
|
+
rmdir: (path: string) => c._wrmdir(wide(path)),
|
|
51
|
+
// MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED, like Node's renameSync.
|
|
52
|
+
rename: (from: string, to: string) => kernel.MoveFileExW(wide(from), wide(to), 3) !== 0 ? 0 : -1,
|
|
53
|
+
chmod: (_path: string, _mode: number) => 0,
|
|
54
|
+
// WIN32_FIND_DATAW: dwFileAttributes at 0, cFileName (WCHAR[260]) at 44.
|
|
55
|
+
readdir(path: string): { name: string; directory: boolean }[] | undefined {
|
|
56
|
+
const data = new Uint8Array(592);
|
|
57
|
+
const handle = kernel.FindFirstFileW(wide(path.replace(/[\\/]*$/, "\\*")), data);
|
|
58
|
+
if (isNull(handle) || (handle as { addr?: bigint | number }).addr === -1n || BigInt((handle as { addr?: bigint | number }).addr ?? 0) === 0xffffffffffffffffn) return undefined;
|
|
59
|
+
const entries: { name: string; directory: boolean }[] = [];
|
|
60
|
+
const view = new DataView(data.buffer);
|
|
61
|
+
try {
|
|
62
|
+
do {
|
|
63
|
+
const units = new Uint16Array(data.buffer, 44, 260);
|
|
64
|
+
const name = String.fromCharCode(...units.subarray(0, units.indexOf(0)));
|
|
65
|
+
if (name !== "." && name !== "..") entries.push({ name, directory: (view.getUint32(0, true) & 0x10) !== 0 });
|
|
66
|
+
} while (kernel.FindNextFileW(handle, data) !== 0);
|
|
67
|
+
} finally {
|
|
68
|
+
kernel.FindClose(handle);
|
|
69
|
+
}
|
|
70
|
+
return entries;
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const c = dlopen("c", {
|
|
75
|
+
fopen: { args: ["string", "string"], returns: "ptr" },
|
|
76
|
+
fclose: { args: ["ptr"], returns: "i32" },
|
|
77
|
+
fread: { args: ["buffer", "size_t", "size_t", "ptr"], returns: "size_t" },
|
|
78
|
+
fwrite: { args: ["buffer", "size_t", "size_t", "ptr"], returns: "size_t" },
|
|
79
|
+
stat: { args: ["string", "buffer"], returns: "i32" },
|
|
80
|
+
mkdir: { args: ["string", "u32"], returns: "i32" },
|
|
81
|
+
remove: { args: ["string"], returns: "i32" },
|
|
82
|
+
rmdir: { args: ["string"], returns: "i32" },
|
|
83
|
+
rename: { args: ["string", "string"], returns: "i32" },
|
|
84
|
+
}).symbols;
|
|
85
|
+
return {
|
|
86
|
+
open: c.fopen, close: c.fclose, read: c.fread, write: c.fwrite,
|
|
87
|
+
// x86-64 glibc struct stat: st_mode is a u32 at 24, st_size an i64 at 48, st_mtime an i64 at 88.
|
|
88
|
+
stat(path: string) {
|
|
89
|
+
const buffer = new Uint8Array(144);
|
|
90
|
+
if (c.stat(path, buffer) !== 0) return undefined;
|
|
91
|
+
const view = new DataView(buffer.buffer);
|
|
92
|
+
return { mode: view.getUint32(24, true), size: Number(view.getBigInt64(48, true)), mtimeMs: Number(view.getBigInt64(88, true)) * 1000 };
|
|
93
|
+
},
|
|
94
|
+
mkdir: (path: string) => c.mkdir(path, 0o777),
|
|
95
|
+
remove: c.remove, rmdir: c.rmdir, rename: c.rename,
|
|
96
|
+
chmod: (path: string, mode: number) => dlopen("c", { chmod: { args: ["string", "u32"], returns: "i32" } }).symbols.chmod(path, mode),
|
|
97
|
+
readdir(_path: string): { name: string; directory: boolean }[] | undefined {
|
|
98
|
+
throw new Error("fs.readdirSync is not available in the Tarve txiki.js runtime on Linux; use fs/promises readdir.");
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let native: ReturnType<typeof load> | undefined;
|
|
104
|
+
const crt = () => (native ??= load());
|
|
105
|
+
|
|
106
|
+
function failure(code: string, syscall: string, path: string): Error {
|
|
107
|
+
return Object.assign(new Error(`${code}: ${syscall} '${path}'`), { code, syscall, path });
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function isNull(pointer: unknown): boolean {
|
|
111
|
+
return pointer == null || pointer === 0 || pointer === 0n || (typeof pointer === "object" && (pointer as { isNull?: boolean }).isNull === true);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
type Encoding = BufferEncoding | { encoding?: BufferEncoding | null; flag?: string } | null | undefined;
|
|
115
|
+
|
|
116
|
+
function encodingOf(options: Encoding): BufferEncoding | undefined {
|
|
117
|
+
return typeof options === "string" ? options : options?.encoding ?? undefined;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface Stats {
|
|
121
|
+
size: number;
|
|
122
|
+
mtimeMs: number;
|
|
123
|
+
isFile(): boolean;
|
|
124
|
+
isDirectory(): boolean;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function statSync(path: string, options?: { throwIfNoEntry?: boolean }): Stats {
|
|
128
|
+
const stat = crt().stat(path);
|
|
129
|
+
if (!stat) {
|
|
130
|
+
if (options?.throwIfNoEntry === false) return undefined as unknown as Stats;
|
|
131
|
+
throw failure("ENOENT", "stat", path);
|
|
132
|
+
}
|
|
133
|
+
return { size: stat.size, mtimeMs: stat.mtimeMs, isFile: () => (stat.mode & S_IFMT) === S_IFREG, isDirectory: () => (stat.mode & S_IFMT) === S_IFDIR };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function existsSync(path: string): boolean {
|
|
137
|
+
return typeof path === "string" && crt().stat(path) !== undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function readFileSync(path: string, options?: Encoding): any {
|
|
141
|
+
const stat = statSync(path);
|
|
142
|
+
if (stat.isDirectory()) throw failure("EISDIR", "read", path);
|
|
143
|
+
const file = crt().open(path, "rb");
|
|
144
|
+
if (isNull(file)) throw failure("EACCES", "open", path);
|
|
145
|
+
const bytes = new Buffer(stat.size);
|
|
146
|
+
let read = 0;
|
|
147
|
+
try {
|
|
148
|
+
while (read < bytes.length) {
|
|
149
|
+
const count = Number(crt().read(bytes.subarray(read), 1, bytes.length - read, file));
|
|
150
|
+
if (count <= 0) break;
|
|
151
|
+
read += count;
|
|
152
|
+
}
|
|
153
|
+
} finally {
|
|
154
|
+
crt().close(file);
|
|
155
|
+
}
|
|
156
|
+
// subarray keeps the Buffer subclass (Symbol.species).
|
|
157
|
+
const result = (read === bytes.length ? bytes : bytes.subarray(0, read)) as Buffer;
|
|
158
|
+
const encoding = encodingOf(options);
|
|
159
|
+
return encoding ? result.toString(encoding as "utf8") : result;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function writeFileSync(path: string, data: string | Uint8Array, options?: Encoding): void {
|
|
163
|
+
const flag = typeof options === "object" && options ? options.flag ?? "w" : "w";
|
|
164
|
+
const exclusive = flag.includes("x");
|
|
165
|
+
if (exclusive && existsSync(path)) throw failure("EEXIST", "open", path);
|
|
166
|
+
const bytes = typeof data === "string" ? Buffer.from(data, (encodingOf(options) ?? "utf8") as "utf8") : data;
|
|
167
|
+
const file = crt().open(path, flag.startsWith("a") ? "ab" : "wb");
|
|
168
|
+
if (isNull(file)) throw failure("EACCES", "open", path);
|
|
169
|
+
try {
|
|
170
|
+
if (bytes.length && Number(crt().write(bytes, 1, bytes.length, file)) !== bytes.length) throw failure("EIO", "write", path);
|
|
171
|
+
} finally {
|
|
172
|
+
crt().close(file);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function mkdirSync(path: string, options?: { recursive?: boolean }): void {
|
|
177
|
+
if (options?.recursive) {
|
|
178
|
+
const stat = crt().stat(path);
|
|
179
|
+
if (stat && (stat.mode & S_IFMT) === S_IFDIR) return;
|
|
180
|
+
const parent = path.replace(/[\\/]+[^\\/]*[\\/]*$/, "");
|
|
181
|
+
if (parent && parent !== path && !/^[A-Za-z]:$/.test(parent)) mkdirSync(parent, options);
|
|
182
|
+
}
|
|
183
|
+
if (crt().mkdir(path) !== 0 && !(options?.recursive && existsSync(path))) throw failure("EEXIST", "mkdir", path);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export function renameSync(from: string, to: string): void {
|
|
187
|
+
if (crt().rename(from, to) !== 0) throw failure(existsSync(from) ? "EPERM" : "ENOENT", "rename", from);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export function rmSync(path: string, options?: { force?: boolean; recursive?: boolean }): void {
|
|
191
|
+
const stat = crt().stat(path);
|
|
192
|
+
if (!stat) {
|
|
193
|
+
if (options?.force) return;
|
|
194
|
+
throw failure("ENOENT", "rm", path);
|
|
195
|
+
}
|
|
196
|
+
const directory = (stat.mode & S_IFMT) === S_IFDIR;
|
|
197
|
+
if (directory && !options?.recursive) throw failure("ERR_FS_EISDIR", "rm", path);
|
|
198
|
+
// Recursive, like Node: empty the directory first.
|
|
199
|
+
if (directory) for (const name of readdirSync(path) as string[]) rmSync(path + "/" + name, { recursive: true, force: true });
|
|
200
|
+
if ((directory ? crt().rmdir(path) : crt().remove(path)) !== 0) throw failure(directory ? "ENOTEMPTY" : "EPERM", "rm", path);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function readdirSync(path: string, options?: { withFileTypes?: boolean }): any[] {
|
|
204
|
+
// Check first: an invalid FindFirstFileW handle is not reliably recognisable through tjs:ffi.
|
|
205
|
+
const stat = crt().stat(path);
|
|
206
|
+
if (!stat) throw failure("ENOENT", "scandir", path);
|
|
207
|
+
if ((stat.mode & S_IFMT) !== S_IFDIR) throw failure("ENOTDIR", "scandir", path);
|
|
208
|
+
const entries = crt().readdir(path);
|
|
209
|
+
if (!entries) throw failure("ENOENT", "scandir", path);
|
|
210
|
+
return options?.withFileTypes
|
|
211
|
+
? entries.map(entry => ({ name: entry.name, isFile: () => !entry.directory, isDirectory: () => entry.directory }))
|
|
212
|
+
: entries.map(entry => entry.name);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function mkdtempSync(prefix: string): string {
|
|
216
|
+
for (let attempt = 0; attempt < 16; attempt++) {
|
|
217
|
+
const path = prefix + crypto.randomUUID().replace(/-/g, "").slice(0, 6);
|
|
218
|
+
if (crt().mkdir(path) === 0) return path;
|
|
219
|
+
}
|
|
220
|
+
throw failure("EEXIST", "mkdtemp", prefix);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export function chmodSync(path: string, mode: number): void {
|
|
224
|
+
if (crt().chmod(path, mode) !== 0) throw failure("ENOENT", "chmod", path);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function unlinkSync(path: string): void {
|
|
228
|
+
if (crt().remove(path) !== 0) throw failure("ENOENT", "unlink", path);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export default { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function createRequire(_from: string | URL) {
|
|
2
|
+
return (id: string): unknown => {
|
|
3
|
+
if (id === "node:sea") return { isSea: () => false };
|
|
4
|
+
throw new Error(`require("${id}") is not available in the Tarve txiki.js runtime`);
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default { createRequire };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* node:net createConnection for the native event wake pipe (a Windows named pipe or a
|
|
3
|
+
* Unix socket), over tjs.connect("pipe"). Only the events the bridge listens to exist.
|
|
4
|
+
*/
|
|
5
|
+
type Listener = (...args: any[]) => void;
|
|
6
|
+
|
|
7
|
+
export class Socket {
|
|
8
|
+
destroyed = false;
|
|
9
|
+
private readonly listeners = new Map<string, Listener[]>();
|
|
10
|
+
private connection?: TjsConnection;
|
|
11
|
+
|
|
12
|
+
constructor(path: string) {
|
|
13
|
+
tjs.connect("pipe", path).then(async connection => {
|
|
14
|
+
if (this.destroyed) {
|
|
15
|
+
connection.close();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
this.connection = connection;
|
|
19
|
+
const { readable } = await connection.opened;
|
|
20
|
+
this.emit("connect");
|
|
21
|
+
void this.pump(readable);
|
|
22
|
+
}).catch(error => this.fail(error));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private async pump(readable: ReadableStream<Uint8Array>): Promise<void> {
|
|
26
|
+
const reader = readable.getReader();
|
|
27
|
+
try {
|
|
28
|
+
for (;;) {
|
|
29
|
+
const { done, value } = await reader.read();
|
|
30
|
+
if (this.destroyed) return;
|
|
31
|
+
if (done) break;
|
|
32
|
+
this.emit("data", value);
|
|
33
|
+
}
|
|
34
|
+
this.destroyed = true;
|
|
35
|
+
this.emit("close", false);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
this.fail(error);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private fail(error: unknown): void {
|
|
42
|
+
if (this.destroyed) return;
|
|
43
|
+
this.destroyed = true;
|
|
44
|
+
this.emit("error", error instanceof Error ? error : new Error(String(error)));
|
|
45
|
+
this.emit("close", true);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private emit(event: string, ...args: unknown[]): void {
|
|
49
|
+
for (const listener of this.listeners.get(event) ?? []) listener(...args);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
on(event: string, listener: Listener): this {
|
|
53
|
+
this.listeners.set(event, [...this.listeners.get(event) ?? [], listener]);
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
destroy(): this {
|
|
58
|
+
if (this.destroyed) return this;
|
|
59
|
+
this.destroyed = true;
|
|
60
|
+
this.connection?.close();
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function createConnection(path: string): Socket {
|
|
66
|
+
return new Socket(path);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default { Socket, createConnection };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { dlopen } from "tjs:ffi";
|
|
2
|
+
import { readFileSync } from "./fs";
|
|
3
|
+
|
|
4
|
+
declare const TARVE_TXIKI_PLATFORM: "win32" | "linux";
|
|
5
|
+
const windows = TARVE_TXIKI_PLATFORM === "win32";
|
|
6
|
+
|
|
7
|
+
interface TjsSystem {
|
|
8
|
+
cpus: { model: string; speed: number; times: { user: number; nice: number; sys: number; idle: number; irq: number } }[];
|
|
9
|
+
loadAvg: [number, number, number];
|
|
10
|
+
uptime: number;
|
|
11
|
+
networkInterfaces: { name: string; address: string; netmask: string; mac: string; internal: boolean; scopeId?: number }[];
|
|
12
|
+
userInfo: { userName: string; userId: number; groupId: number; shell: string | null; homeDir: string };
|
|
13
|
+
}
|
|
14
|
+
const system = () => (tjs as unknown as { system: TjsSystem }).system;
|
|
15
|
+
|
|
16
|
+
export const EOL = windows ? "\r\n" : "\n";
|
|
17
|
+
export function tmpdir(): string { return tjs.tmpDir; }
|
|
18
|
+
export function homedir(): string { return tjs.homeDir; }
|
|
19
|
+
export function hostname(): string { return (tjs as unknown as { hostName: string }).hostName; }
|
|
20
|
+
export function platform(): string { return TARVE_TXIKI_PLATFORM; }
|
|
21
|
+
export function type(): string { return windows ? "Windows_NT" : "Linux"; }
|
|
22
|
+
export function arch(): string { return "x64"; }
|
|
23
|
+
export function cpus() { return system().cpus; }
|
|
24
|
+
export function availableParallelism(): number { return Math.max(1, system().cpus.length); }
|
|
25
|
+
export function loadavg(): number[] { return [...system().loadAvg]; }
|
|
26
|
+
export function uptime(): number { return system().uptime; }
|
|
27
|
+
export function userInfo() {
|
|
28
|
+
const info = system().userInfo;
|
|
29
|
+
return { username: info.userName, uid: info.userId, gid: info.groupId, shell: info.shell, homedir: info.homeDir };
|
|
30
|
+
}
|
|
31
|
+
export function networkInterfaces() {
|
|
32
|
+
const out: Record<string, object[]> = {};
|
|
33
|
+
for (const { name, ...entry } of system().networkInterfaces) {
|
|
34
|
+
(out[name] ??= []).push({ ...entry, family: entry.address.includes(":") ? "IPv6" : "IPv4", cidr: null });
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let kernel: ReturnType<typeof loadKernel> | undefined;
|
|
40
|
+
function loadKernel() {
|
|
41
|
+
return dlopen("kernel32.dll", { GlobalMemoryStatusEx: { args: ["buffer"], returns: "i32" } }).symbols;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** [total, available] physical memory in bytes. */
|
|
45
|
+
function memory(): [number, number] {
|
|
46
|
+
if (windows) {
|
|
47
|
+
// MEMORYSTATUSEX: dwLength at 0, ullTotalPhys at 8, ullAvailPhys at 16.
|
|
48
|
+
const status = new Uint8Array(64);
|
|
49
|
+
const view = new DataView(status.buffer);
|
|
50
|
+
view.setUint32(0, 64, true);
|
|
51
|
+
(kernel ??= loadKernel()).GlobalMemoryStatusEx(status);
|
|
52
|
+
return [Number(view.getBigUint64(8, true)), Number(view.getBigUint64(16, true))];
|
|
53
|
+
}
|
|
54
|
+
const info = readFileSync("/proc/meminfo", "utf8") as string;
|
|
55
|
+
const kib = (key: string) => Number(new RegExp(`^${key}:\\s+(\\d+)`, "m").exec(info)?.[1] ?? 0) * 1024;
|
|
56
|
+
return [kib("MemTotal"), kib("MemAvailable")];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function totalmem(): number { return memory()[0]; }
|
|
60
|
+
export function freemem(): number { return memory()[1]; }
|
|
61
|
+
|
|
62
|
+
/** Kernel version, e.g. "10.0.26100" on Windows (RtlGetVersion is not shimmed by compatibility modes). */
|
|
63
|
+
export function release(): string {
|
|
64
|
+
if (!windows) return (readFileSync("/proc/sys/kernel/osrelease", "utf8") as string).trim();
|
|
65
|
+
const info = new Uint8Array(276);
|
|
66
|
+
const view = new DataView(info.buffer);
|
|
67
|
+
view.setUint32(0, 276, true);
|
|
68
|
+
dlopen("ntdll.dll", { RtlGetVersion: { args: ["buffer"], returns: "i32" } }).symbols.RtlGetVersion(info);
|
|
69
|
+
return `${view.getUint32(4, true)}.${view.getUint32(8, true)}.${view.getUint32(12, true)}`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default { EOL, arch, availableParallelism, cpus, freemem, homedir, hostname, loadavg, networkInterfaces, platform, release, tmpdir, totalmem, type, uptime, userInfo };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function setTimeout<T = void>(milliseconds = 0, value?: T): Promise<T> {
|
|
2
|
+
return new Promise(resolve => globalThis.setTimeout(() => resolve(value as T), milliseconds));
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function setImmediate<T = void>(value?: T): Promise<T> {
|
|
6
|
+
return setTimeout(0, value);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default { setImmediate, setTimeout };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function unavailable(name: string): never {
|
|
2
|
+
throw new Error(`zlib.${name} is not available in the Tarve txiki.js runtime`);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export const deflateSync = (_data: Uint8Array): Uint8Array => unavailable("deflateSync");
|
|
6
|
+
export const inflateSync = (_data: Uint8Array): Uint8Array => unavailable("inflateSync");
|
|
7
|
+
export const gzipSync = (_data: Uint8Array): Uint8Array => unavailable("gzipSync");
|
|
8
|
+
export const gunzipSync = (_data: Uint8Array): Uint8Array => unavailable("gunzipSync");
|
|
9
|
+
export default { deflateSync, gunzipSync, gzipSync, inflateSync };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// The slice of the txiki.js (tjs) runtime API the Tarve txiki runtime uses.
|
|
2
|
+
// https://txikijs.org/docs/api
|
|
3
|
+
|
|
4
|
+
interface TjsFileHandle {
|
|
5
|
+
read(buffer: Uint8Array, position?: number): Promise<number | null>;
|
|
6
|
+
stat(): Promise<{ size: number }>;
|
|
7
|
+
close(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** A WinterTC-style socket: streams arrive with `opened`. */
|
|
11
|
+
interface TjsConnection {
|
|
12
|
+
readonly opened: Promise<{ readable: ReadableStream<Uint8Array>; writable: WritableStream<Uint8Array> }>;
|
|
13
|
+
close(): void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface TjsGlobal {
|
|
17
|
+
readonly args: string[];
|
|
18
|
+
readonly env: Record<string, string | undefined>;
|
|
19
|
+
readonly exePath: string;
|
|
20
|
+
readonly tmpDir: string;
|
|
21
|
+
readonly homeDir: string;
|
|
22
|
+
readonly version: string;
|
|
23
|
+
readonly engine: { versions: Record<string, string | number> };
|
|
24
|
+
readonly cwd: string;
|
|
25
|
+
chdir(directory: string): void;
|
|
26
|
+
exit(code?: number): never;
|
|
27
|
+
open(path: string, mode: string): Promise<TjsFileHandle>;
|
|
28
|
+
stat(path: string): Promise<{ size: number }>;
|
|
29
|
+
makeDir(path: string, options?: { recursive?: boolean }): Promise<void>;
|
|
30
|
+
writeFile(path: string, data: Uint8Array): Promise<void>;
|
|
31
|
+
rename(from: string, to: string): Promise<void>;
|
|
32
|
+
remove(path: string): Promise<void>;
|
|
33
|
+
connect(transport: "pipe" | "tcp", host: string, port?: number): Promise<TjsConnection>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare var tjs: TjsGlobal;
|
|
37
|
+
|
|
38
|
+
declare module "tjs:ffi" {
|
|
39
|
+
type FfiType = "void" | "u8" | "i8" | "u16" | "i16" | "u32" | "i32" | "u64" | "i64" | "f32" | "f64" | "ptr" | "buffer" | "string" | "size_t";
|
|
40
|
+
export interface SymbolDefinition { args: readonly FfiType[]; returns: FfiType }
|
|
41
|
+
export function dlopen<T extends Record<string, SymbolDefinition>>(path: string, symbols: T): {
|
|
42
|
+
symbols: { [K in keyof T]: (...args: any[]) => any };
|
|
43
|
+
close(): void;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare module "tjs:hashing" {
|
|
48
|
+
export function createHash(algorithm: string): {
|
|
49
|
+
update(data: Uint8Array): unknown;
|
|
50
|
+
digest(encoding: "hex"): string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare module "tjs:path" {
|
|
55
|
+
import type * as path from "node:path";
|
|
56
|
+
const value: typeof path;
|
|
57
|
+
export default value;
|
|
58
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stands in for a Node API txiki.js lacks. Each call site is a pure call that tree
|
|
3
|
+
* shaking removes when the API is unused; txiki-build rejects a bundle where one is left.
|
|
4
|
+
*/
|
|
5
|
+
export function unavailable(marker: string): any {
|
|
6
|
+
const fail = (): never => {
|
|
7
|
+
throw new Error(`${marker.replace(/^[^:]+:/, "")} is not available in the Tarve txiki.js runtime`);
|
|
8
|
+
};
|
|
9
|
+
return new Proxy(fail, { get: fail, apply: fail, construct: fail });
|
|
10
|
+
}
|
|
@@ -3,11 +3,35 @@ export { BUILD_TARGETS, hostBuildTarget, isBuildTarget, nativeDirectoryForBuildT
|
|
|
3
3
|
export interface BuildOptions {
|
|
4
4
|
entrypoint: string;
|
|
5
5
|
outfile?: string;
|
|
6
|
+
/** Executable, window and app-identity metadata; each also reads from package.json `tarve`. */
|
|
6
7
|
name?: string;
|
|
7
8
|
version?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
publisher?: string;
|
|
11
|
+
copyright?: string;
|
|
12
|
+
/** .png (square, 256 px or more) or .ico. */
|
|
13
|
+
icon?: string;
|
|
14
|
+
/** Windows AppUserModelID / Linux app id, e.g. `Acme.Notes`. */
|
|
15
|
+
appId?: string;
|
|
8
16
|
target?: BuildTarget;
|
|
9
17
|
/** Override for building the repository against a freshly compiled release library. */
|
|
10
18
|
nativeLibrary?: string;
|
|
19
|
+
/** "txiki": a txiki.js (QuickJS-ng) executable, no Bun or Node.js at run time. */
|
|
20
|
+
runtime?: "bun" | "node" | "txiki";
|
|
21
|
+
/** Experimental: compile JSX into reusable templates at build time (packages/core/jsx-compile.ts). Bun and txiki.js builds. */
|
|
22
|
+
compileJsx?: boolean;
|
|
23
|
+
/** Runtime binary for the target OS (Node.js or txiki.js); required when cross-compiling a Node SEA or txiki.js app. */
|
|
24
|
+
targetExecutable?: string;
|
|
11
25
|
}
|
|
12
26
|
/** Compile an ordinary Tarve app. No production entrypoint or app-side bridge setup is needed. */
|
|
13
27
|
export declare function build(options: BuildOptions): Promise<string>;
|
|
28
|
+
/** The metadata fields of build options, as overrides of package.json `tarve`. */
|
|
29
|
+
export declare function metadataOverrides(options: BuildOptions): {
|
|
30
|
+
name: string | undefined;
|
|
31
|
+
version: string | undefined;
|
|
32
|
+
description: string | undefined;
|
|
33
|
+
publisher: string | undefined;
|
|
34
|
+
copyright: string | undefined;
|
|
35
|
+
icon: string | undefined;
|
|
36
|
+
appId: string | undefined;
|
|
37
|
+
};
|
package/dist/types/core/cli.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
export {};
|