@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,87 @@
|
|
|
1
|
+
/** One downloadable build of a release, keyed by `<platform>-<arch>` (e.g. `win32-x64`). */
|
|
2
|
+
export interface UpdateArtifact {
|
|
3
|
+
url: string;
|
|
4
|
+
sha256: string;
|
|
5
|
+
size: number;
|
|
6
|
+
}
|
|
7
|
+
/** What `tarve release` signs: the release and one artifact per platform. */
|
|
8
|
+
export interface UpdateManifest {
|
|
9
|
+
name?: string;
|
|
10
|
+
version: string;
|
|
11
|
+
notes?: string;
|
|
12
|
+
pubDate: string;
|
|
13
|
+
platforms: Record<string, UpdateArtifact>;
|
|
14
|
+
}
|
|
15
|
+
/** The file served at the update URL: the manifest as signed text plus its Ed25519 signature (base64). */
|
|
16
|
+
export interface SignedUpdateManifest {
|
|
17
|
+
payload: string;
|
|
18
|
+
signature: string;
|
|
19
|
+
}
|
|
20
|
+
export interface Update extends UpdateArtifact {
|
|
21
|
+
version: string;
|
|
22
|
+
currentVersion: string;
|
|
23
|
+
notes?: string;
|
|
24
|
+
pubDate: string;
|
|
25
|
+
platform: string;
|
|
26
|
+
}
|
|
27
|
+
export interface CheckForUpdateOptions {
|
|
28
|
+
/** URL of the signed manifest (`latest.json`). HTTPS, or HTTP on localhost. */
|
|
29
|
+
url: string;
|
|
30
|
+
/** Ed25519 public key from `tarve keygen` (base64, 32 bytes). */
|
|
31
|
+
publicKey: string;
|
|
32
|
+
/** Defaults to the version baked in by `tarve build`. */
|
|
33
|
+
currentVersion?: string;
|
|
34
|
+
/** Defaults to `${process.platform}-${process.arch}`. */
|
|
35
|
+
platform?: string;
|
|
36
|
+
/** Reject a manifest released under another name; defaults to the app name baked in by `tarve build`. */
|
|
37
|
+
name?: string;
|
|
38
|
+
/** Accept plain HTTP from hosts other than localhost (the manifest is still signed). */
|
|
39
|
+
allowInsecure?: boolean;
|
|
40
|
+
fetch?: typeof fetch;
|
|
41
|
+
signal?: AbortSignal;
|
|
42
|
+
}
|
|
43
|
+
export interface DownloadUpdateOptions {
|
|
44
|
+
onProgress?: (received: number, total: number) => void;
|
|
45
|
+
/** Where to write the download; defaults to next to the executable, so install is a rename. */
|
|
46
|
+
path?: string;
|
|
47
|
+
allowInsecure?: boolean;
|
|
48
|
+
fetch?: typeof fetch;
|
|
49
|
+
signal?: AbortSignal;
|
|
50
|
+
}
|
|
51
|
+
export interface InstallUpdateOptions {
|
|
52
|
+
/** Executable to replace; defaults to `process.execPath`. */
|
|
53
|
+
executable?: string;
|
|
54
|
+
/** Start the new version and exit this process (default true). */
|
|
55
|
+
restart?: boolean;
|
|
56
|
+
args?: string[];
|
|
57
|
+
}
|
|
58
|
+
export declare function updatePlatform(): string;
|
|
59
|
+
/** `1.2.3`, `v1.2`, `1.0.0-beta.1+build.5`. */
|
|
60
|
+
export declare function isValidVersion(version: string): boolean;
|
|
61
|
+
/** `win32-x64` style: the OS (as in `process.platform`) and the architecture. */
|
|
62
|
+
export declare function isValidPlatform(platform: string): boolean;
|
|
63
|
+
/** Throws unless `url` is HTTPS, or HTTP on localhost (or `allowInsecure`). */
|
|
64
|
+
export declare function assertUpdateUrl(url: string, allowInsecure?: boolean): URL;
|
|
65
|
+
/** Checks the shape of a parsed manifest; throws a TypeError naming the bad field. */
|
|
66
|
+
export declare function validateUpdateManifest(value: unknown): UpdateManifest;
|
|
67
|
+
/** Verifies `signed` against `publicKey` and returns the manifest; throws on a bad signature or shape. */
|
|
68
|
+
export declare function verifyUpdateManifest(signed: SignedUpdateManifest, publicKey: string): UpdateManifest;
|
|
69
|
+
/** Semver-ish comparison: numeric core, a pre-release sorts before its release. */
|
|
70
|
+
export declare function compareVersions(a: string, b: string): number;
|
|
71
|
+
/** Fetches and verifies the manifest; resolves the newer release for this platform, or null. */
|
|
72
|
+
export declare function checkForUpdate(options: CheckForUpdateOptions): Promise<Update | null>;
|
|
73
|
+
/** Bytes every executable for `platform` starts with; undefined when Tarve does not know the format. */
|
|
74
|
+
export declare function executableMagic(platform: string): Uint8Array | undefined;
|
|
75
|
+
/** Whether `bytes` (the start of a file) looks like an executable for `platform`. */
|
|
76
|
+
export declare function looksExecutable(bytes: Uint8Array, platform: string): boolean;
|
|
77
|
+
/** Downloads the update, checking its size, SHA-256 and executable format; resolves the file path. */
|
|
78
|
+
export declare function downloadUpdate(update: Update, options?: DownloadUpdateOptions): Promise<string>;
|
|
79
|
+
/** Whether this process can replace its own executable (a built app in a writable folder). */
|
|
80
|
+
export declare function canInstallUpdate(executable?: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Swaps the executable for `file` (Windows keeps the running one as `<exe>.old`,
|
|
83
|
+
* removed on the next check) and, by default, starts the new version and exits.
|
|
84
|
+
*/
|
|
85
|
+
export declare function installUpdate(file: string, options?: InstallUpdateOptions): void;
|
|
86
|
+
/** Removes what a finished update left behind (`<exe>.old`). Safe to call at any time. */
|
|
87
|
+
export declare function cleanupUpdate(executable?: string): void;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { type BaseProps, type Child, type VNode } from "./jsx-runtime";
|
|
2
|
+
import type { ScrollInfo } from "./protocol";
|
|
2
3
|
export interface VirtualListProps<T> extends BaseProps {
|
|
3
4
|
items: readonly T[];
|
|
4
5
|
itemHeight: number;
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Viewport height in px. Omit it (with an `id`) to fill the parent like
|
|
8
|
+
* `flex: 1`: the list follows its real laid-out height, window resizes included.
|
|
9
|
+
*/
|
|
10
|
+
height?: number;
|
|
6
11
|
offset: number;
|
|
7
12
|
overscan?: number;
|
|
8
13
|
keyForItem?: (item: T, index: number) => string | number;
|
|
9
14
|
renderItem: (item: T, index: number) => Child;
|
|
10
|
-
|
|
15
|
+
/** `info.source` tells the user's scrolling from a scrollToItem (and its smooth steps). */
|
|
16
|
+
onScroll: (offset: number, max: number, info: ScrollInfo) => void;
|
|
11
17
|
}
|
|
12
18
|
export interface VariableVirtualListProps<T> extends Omit<VirtualListProps<T>, "itemHeight" | "keyForItem"> {
|
|
13
19
|
/** Stable list id is required so measured heights survive rerenders. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createFetch(fallback: typeof fetch): typeof fetch;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** [group, decimal, minimum grouping digits, secondary group size, percent pattern, minus sign, date formats per DATE_OPTIONS]. */
|
|
2
|
+
export type LocaleData = [string, string, number, number, string, string, number[][]];
|
|
3
|
+
export declare const DATE_KEYS: string[];
|
|
4
|
+
export declare const TEMPLATES: string[];
|
|
5
|
+
export declare const NAMES: string[][];
|
|
6
|
+
export declare const LOCALES: Record<string, LocaleData>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
interface NumberOptions {
|
|
2
|
+
style?: "decimal" | "percent" | "unit" | "currency";
|
|
3
|
+
minimumFractionDigits?: number;
|
|
4
|
+
maximumFractionDigits?: number;
|
|
5
|
+
useGrouping?: boolean;
|
|
6
|
+
unit?: string;
|
|
7
|
+
currency?: string;
|
|
8
|
+
}
|
|
9
|
+
declare class NumberFormat {
|
|
10
|
+
private readonly options;
|
|
11
|
+
private readonly locale;
|
|
12
|
+
private readonly data;
|
|
13
|
+
constructor(locales?: string | string[], options?: NumberOptions);
|
|
14
|
+
format(input: number | bigint): string;
|
|
15
|
+
formatToParts(input: number | bigint): {
|
|
16
|
+
type: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}[];
|
|
19
|
+
resolvedOptions(): {
|
|
20
|
+
style?: "decimal" | "percent" | "unit" | "currency";
|
|
21
|
+
minimumFractionDigits?: number;
|
|
22
|
+
maximumFractionDigits?: number;
|
|
23
|
+
useGrouping?: boolean;
|
|
24
|
+
unit?: string;
|
|
25
|
+
currency?: string;
|
|
26
|
+
locale: string;
|
|
27
|
+
numberingSystem: string;
|
|
28
|
+
};
|
|
29
|
+
static supportedLocalesOf(locales: string | string[]): string[];
|
|
30
|
+
}
|
|
31
|
+
type Width = "numeric" | "2-digit" | "short" | "long" | "narrow";
|
|
32
|
+
interface DateTimeOptions {
|
|
33
|
+
weekday?: Width;
|
|
34
|
+
era?: Width;
|
|
35
|
+
year?: Width;
|
|
36
|
+
month?: Width;
|
|
37
|
+
day?: Width;
|
|
38
|
+
hour?: Width;
|
|
39
|
+
minute?: Width;
|
|
40
|
+
second?: Width;
|
|
41
|
+
hour12?: boolean;
|
|
42
|
+
timeZone?: string;
|
|
43
|
+
dateStyle?: "full" | "long" | "medium" | "short";
|
|
44
|
+
timeStyle?: "full" | "long" | "medium" | "short";
|
|
45
|
+
}
|
|
46
|
+
declare class DateTimeFormat {
|
|
47
|
+
private readonly locale;
|
|
48
|
+
private readonly options;
|
|
49
|
+
private readonly entry;
|
|
50
|
+
constructor(locales?: string | string[], options?: DateTimeOptions);
|
|
51
|
+
format(value?: Date | number): string;
|
|
52
|
+
/** en-US composition for option sets intl-data.ts does not carry. */
|
|
53
|
+
private fallback;
|
|
54
|
+
formatToParts(value?: Date | number): {
|
|
55
|
+
type: string;
|
|
56
|
+
value: string;
|
|
57
|
+
}[];
|
|
58
|
+
resolvedOptions(): {
|
|
59
|
+
weekday?: Width;
|
|
60
|
+
era?: Width;
|
|
61
|
+
year?: Width;
|
|
62
|
+
month?: Width;
|
|
63
|
+
day?: Width;
|
|
64
|
+
hour?: Width;
|
|
65
|
+
minute?: Width;
|
|
66
|
+
second?: Width;
|
|
67
|
+
hour12?: boolean;
|
|
68
|
+
dateStyle?: "full" | "long" | "medium" | "short";
|
|
69
|
+
timeStyle?: "full" | "long" | "medium" | "short";
|
|
70
|
+
locale: string;
|
|
71
|
+
calendar: string;
|
|
72
|
+
numberingSystem: string;
|
|
73
|
+
timeZone: string;
|
|
74
|
+
};
|
|
75
|
+
static supportedLocalesOf(locales: string | string[]): string[];
|
|
76
|
+
}
|
|
77
|
+
declare class Collator {
|
|
78
|
+
private readonly options;
|
|
79
|
+
constructor(_locales?: string | string[], options?: {
|
|
80
|
+
numeric?: boolean;
|
|
81
|
+
sensitivity?: string;
|
|
82
|
+
});
|
|
83
|
+
compare: (left: string, right: string) => number;
|
|
84
|
+
}
|
|
85
|
+
export declare function installIntl(): void;
|
|
86
|
+
/** For tests: the shim's classes, without installing them. */
|
|
87
|
+
export declare const txikiIntl: {
|
|
88
|
+
DateTimeFormat: typeof DateTimeFormat;
|
|
89
|
+
NumberFormat: typeof NumberFormat;
|
|
90
|
+
Collator: typeof Collator;
|
|
91
|
+
};
|
|
92
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** The part of Node's Buffer the Tarve core uses, over Uint8Array. */
|
|
2
|
+
type Encoding = "utf8" | "utf-8" | "base64" | "hex" | "latin1" | "binary" | "ascii";
|
|
3
|
+
declare class BufferBytes extends Uint8Array {
|
|
4
|
+
static fromValue(value: string | ArrayBufferLike | ArrayLike<number> | ArrayBufferView, encodingOrOffset?: Encoding | number, length?: number): BufferBytes;
|
|
5
|
+
static alloc(size: number, fill?: number): BufferBytes;
|
|
6
|
+
static concat(list: readonly Uint8Array[], totalLength?: number): BufferBytes;
|
|
7
|
+
static isBuffer(value: unknown): value is BufferBytes;
|
|
8
|
+
static byteLength(value: string | ArrayBufferView | ArrayBuffer, encoding?: Encoding): number;
|
|
9
|
+
private static wrap;
|
|
10
|
+
toString(encoding?: Encoding, start?: number, end?: number): string;
|
|
11
|
+
write(value: string, offset?: number, encoding?: Encoding): number;
|
|
12
|
+
private view;
|
|
13
|
+
writeUInt8(value: number, offset?: number): number;
|
|
14
|
+
writeUInt16LE(value: number, offset?: number): number;
|
|
15
|
+
writeUInt16BE(value: number, offset?: number): number;
|
|
16
|
+
writeUInt32LE(value: number, offset?: number): number;
|
|
17
|
+
writeUInt32BE(value: number, offset?: number): number;
|
|
18
|
+
writeInt32LE(value: number, offset?: number): number;
|
|
19
|
+
writeInt32BE(value: number, offset?: number): number;
|
|
20
|
+
readUInt8(offset?: number): number;
|
|
21
|
+
readUInt16LE(offset?: number): number;
|
|
22
|
+
readUInt16BE(offset?: number): number;
|
|
23
|
+
readUInt32LE(offset?: number): number;
|
|
24
|
+
readUInt32BE(offset?: number): number;
|
|
25
|
+
readInt32LE(offset?: number): number;
|
|
26
|
+
readInt32BE(offset?: number): number;
|
|
27
|
+
}
|
|
28
|
+
/** Node's Buffer: `Buffer.from` takes encodings and offsets, unlike Uint8Array.from. */
|
|
29
|
+
type BufferConstructor = Omit<typeof BufferBytes, "from" | "prototype"> & {
|
|
30
|
+
from: typeof BufferBytes.fromValue;
|
|
31
|
+
prototype: BufferBytes;
|
|
32
|
+
new (length: number): BufferBytes;
|
|
33
|
+
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): BufferBytes;
|
|
34
|
+
};
|
|
35
|
+
export declare const Buffer: BufferConstructor;
|
|
36
|
+
export type Buffer = BufferBytes;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** node:child_process spawn over tjs.spawn: exit/error events and stream-like stdio. */
|
|
2
|
+
import { Buffer } from "./buffer";
|
|
3
|
+
import { EventEmitter } from "./events";
|
|
4
|
+
type Stdio = "pipe" | "ignore" | "inherit";
|
|
5
|
+
export interface SpawnOptions {
|
|
6
|
+
cwd?: string;
|
|
7
|
+
env?: Record<string, string | undefined>;
|
|
8
|
+
stdio?: Stdio | Stdio[];
|
|
9
|
+
windowsHide?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** A Node-style readable over a web stream: "data"/"end" events or async iteration. */
|
|
12
|
+
declare class Readable extends EventEmitter {
|
|
13
|
+
private readonly stream;
|
|
14
|
+
private encoding?;
|
|
15
|
+
private started;
|
|
16
|
+
constructor(stream: ReadableStream<Uint8Array>);
|
|
17
|
+
setEncoding(encoding: string): this;
|
|
18
|
+
private chunk;
|
|
19
|
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
20
|
+
private pump;
|
|
21
|
+
[Symbol.asyncIterator](): AsyncGenerator<Buffer | string>;
|
|
22
|
+
}
|
|
23
|
+
declare class Writable extends EventEmitter {
|
|
24
|
+
private readonly writer;
|
|
25
|
+
constructor(stream: WritableStream<Uint8Array>);
|
|
26
|
+
write(data: string | Uint8Array, callback?: (error?: Error) => void): boolean;
|
|
27
|
+
end(data?: string | Uint8Array): this;
|
|
28
|
+
}
|
|
29
|
+
export declare class ChildProcess extends EventEmitter {
|
|
30
|
+
pid?: number;
|
|
31
|
+
exitCode: number | null;
|
|
32
|
+
signalCode: string | null;
|
|
33
|
+
killed: boolean;
|
|
34
|
+
stdin: Writable | null;
|
|
35
|
+
stdout: Readable | null;
|
|
36
|
+
stderr: Readable | null;
|
|
37
|
+
private process?;
|
|
38
|
+
constructor(command: string, args: readonly string[], options?: SpawnOptions);
|
|
39
|
+
kill(signal?: string): boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare function spawn(command: string, args?: readonly string[] | SpawnOptions, options?: SpawnOptions): ChildProcess;
|
|
42
|
+
declare const _default: {
|
|
43
|
+
ChildProcess: typeof ChildProcess;
|
|
44
|
+
spawn: typeof spawn;
|
|
45
|
+
};
|
|
46
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Buffer } from "./buffer";
|
|
2
|
+
export declare function createHash(algorithm: string): {
|
|
3
|
+
update(data: string | Uint8Array): {
|
|
4
|
+
update(data: string | Uint8Array): /*elided*/ any;
|
|
5
|
+
digest(encoding?: "hex" | "base64"): any;
|
|
6
|
+
};
|
|
7
|
+
digest(encoding?: "hex" | "base64"): any;
|
|
8
|
+
};
|
|
9
|
+
export declare function randomUUID(): string;
|
|
10
|
+
export declare function randomBytes(size: number): Buffer;
|
|
11
|
+
declare const _default: {
|
|
12
|
+
createHash: typeof createHash;
|
|
13
|
+
randomBytes: typeof randomBytes;
|
|
14
|
+
randomUUID: typeof randomUUID;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** node:events: the EventEmitter subset apps and the shims use. */
|
|
2
|
+
type Listener = (...args: any[]) => void;
|
|
3
|
+
export declare class EventEmitter {
|
|
4
|
+
private readonly events;
|
|
5
|
+
on(event: string | symbol, listener: Listener): this;
|
|
6
|
+
addListener(event: string | symbol, listener: Listener): this;
|
|
7
|
+
once(event: string | symbol, listener: Listener): this;
|
|
8
|
+
off(event: string | symbol, listener: Listener): this;
|
|
9
|
+
removeListener(event: string | symbol, listener: Listener): this;
|
|
10
|
+
removeAllListeners(event?: string | symbol): this;
|
|
11
|
+
emit(event: string | symbol, ...args: unknown[]): boolean;
|
|
12
|
+
listenerCount(event: string | symbol): number;
|
|
13
|
+
setMaxListeners(_count: number): this;
|
|
14
|
+
}
|
|
15
|
+
/** Resolves with the event's arguments; rejects on "error" (except when waiting for "error"). */
|
|
16
|
+
export declare function once(emitter: EventEmitter, event: string): Promise<unknown[]>;
|
|
17
|
+
declare const _default: typeof EventEmitter & {
|
|
18
|
+
EventEmitter: typeof EventEmitter;
|
|
19
|
+
once: typeof once;
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
type Encoding = BufferEncoding | {
|
|
2
|
+
encoding?: BufferEncoding | null;
|
|
3
|
+
} | null | undefined;
|
|
4
|
+
export declare function readFile(path: string, options?: Encoding): Promise<any>;
|
|
5
|
+
export declare function writeFile(path: string, data: string | Uint8Array): Promise<void>;
|
|
6
|
+
export declare function mkdir(path: string, options?: {
|
|
7
|
+
recursive?: boolean;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
export declare function mkdtemp(prefix: string): Promise<string>;
|
|
10
|
+
export declare function rm(path: string, options?: {
|
|
11
|
+
force?: boolean;
|
|
12
|
+
recursive?: boolean;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
export declare const unlink: (path: string) => Promise<void>;
|
|
15
|
+
export declare const rename: (from: string, to: string) => Promise<void>;
|
|
16
|
+
export declare const copyFile: (from: string, to: string) => Promise<void>;
|
|
17
|
+
export declare function stat(path: string): Promise<{
|
|
18
|
+
size: number;
|
|
19
|
+
mtimeMs: number;
|
|
20
|
+
mtime: Date;
|
|
21
|
+
isFile: () => boolean;
|
|
22
|
+
isDirectory: () => boolean;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function access(path: string): Promise<void>;
|
|
25
|
+
export declare function readdir(path: string, options?: {
|
|
26
|
+
withFileTypes?: boolean;
|
|
27
|
+
}): Promise<any[]>;
|
|
28
|
+
declare const _default: {
|
|
29
|
+
access: typeof access;
|
|
30
|
+
copyFile: typeof copyFile;
|
|
31
|
+
mkdir: typeof mkdir;
|
|
32
|
+
mkdtemp: typeof mkdtemp;
|
|
33
|
+
readFile: typeof readFile;
|
|
34
|
+
readdir: typeof readdir;
|
|
35
|
+
rename: typeof rename;
|
|
36
|
+
rm: typeof rm;
|
|
37
|
+
stat: typeof stat;
|
|
38
|
+
unlink: typeof unlink;
|
|
39
|
+
writeFile: typeof writeFile;
|
|
40
|
+
};
|
|
41
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
type Encoding = BufferEncoding | {
|
|
2
|
+
encoding?: BufferEncoding | null;
|
|
3
|
+
flag?: string;
|
|
4
|
+
} | null | undefined;
|
|
5
|
+
export interface Stats {
|
|
6
|
+
size: number;
|
|
7
|
+
mtimeMs: number;
|
|
8
|
+
isFile(): boolean;
|
|
9
|
+
isDirectory(): boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function statSync(path: string, options?: {
|
|
12
|
+
throwIfNoEntry?: boolean;
|
|
13
|
+
}): Stats;
|
|
14
|
+
export declare function existsSync(path: string): boolean;
|
|
15
|
+
export declare function readFileSync(path: string, options?: Encoding): any;
|
|
16
|
+
export declare function writeFileSync(path: string, data: string | Uint8Array, options?: Encoding): void;
|
|
17
|
+
export declare function mkdirSync(path: string, options?: {
|
|
18
|
+
recursive?: boolean;
|
|
19
|
+
}): void;
|
|
20
|
+
export declare function renameSync(from: string, to: string): void;
|
|
21
|
+
export declare function rmSync(path: string, options?: {
|
|
22
|
+
force?: boolean;
|
|
23
|
+
recursive?: boolean;
|
|
24
|
+
}): void;
|
|
25
|
+
export declare function readdirSync(path: string, options?: {
|
|
26
|
+
withFileTypes?: boolean;
|
|
27
|
+
}): any[];
|
|
28
|
+
export declare function mkdtempSync(prefix: string): string;
|
|
29
|
+
export declare function chmodSync(path: string, mode: number): void;
|
|
30
|
+
export declare function unlinkSync(path: string): void;
|
|
31
|
+
declare const _default: {
|
|
32
|
+
chmodSync: typeof chmodSync;
|
|
33
|
+
existsSync: typeof existsSync;
|
|
34
|
+
mkdirSync: typeof mkdirSync;
|
|
35
|
+
mkdtempSync: typeof mkdtempSync;
|
|
36
|
+
readFileSync: typeof readFileSync;
|
|
37
|
+
readdirSync: typeof readdirSync;
|
|
38
|
+
renameSync: typeof renameSync;
|
|
39
|
+
rmSync: typeof rmSync;
|
|
40
|
+
statSync: typeof statSync;
|
|
41
|
+
unlinkSync: typeof unlinkSync;
|
|
42
|
+
writeFileSync: typeof writeFileSync;
|
|
43
|
+
};
|
|
44
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
export declare class Socket {
|
|
7
|
+
destroyed: boolean;
|
|
8
|
+
private readonly listeners;
|
|
9
|
+
private connection?;
|
|
10
|
+
constructor(path: string);
|
|
11
|
+
private pump;
|
|
12
|
+
private fail;
|
|
13
|
+
private emit;
|
|
14
|
+
on(event: string, listener: Listener): this;
|
|
15
|
+
destroy(): this;
|
|
16
|
+
}
|
|
17
|
+
export declare function createConnection(path: string): Socket;
|
|
18
|
+
declare const _default: {
|
|
19
|
+
Socket: typeof Socket;
|
|
20
|
+
createConnection: typeof createConnection;
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export declare const EOL: string;
|
|
2
|
+
export declare function tmpdir(): string;
|
|
3
|
+
export declare function homedir(): string;
|
|
4
|
+
export declare function hostname(): string;
|
|
5
|
+
export declare function platform(): string;
|
|
6
|
+
export declare function type(): string;
|
|
7
|
+
export declare function arch(): string;
|
|
8
|
+
export declare function cpus(): {
|
|
9
|
+
model: string;
|
|
10
|
+
speed: number;
|
|
11
|
+
times: {
|
|
12
|
+
user: number;
|
|
13
|
+
nice: number;
|
|
14
|
+
sys: number;
|
|
15
|
+
idle: number;
|
|
16
|
+
irq: number;
|
|
17
|
+
};
|
|
18
|
+
}[];
|
|
19
|
+
export declare function availableParallelism(): number;
|
|
20
|
+
export declare function loadavg(): number[];
|
|
21
|
+
export declare function uptime(): number;
|
|
22
|
+
export declare function userInfo(): {
|
|
23
|
+
username: string;
|
|
24
|
+
uid: number;
|
|
25
|
+
gid: number;
|
|
26
|
+
shell: string | null;
|
|
27
|
+
homedir: string;
|
|
28
|
+
};
|
|
29
|
+
export declare function networkInterfaces(): Record<string, object[]>;
|
|
30
|
+
export declare function totalmem(): number;
|
|
31
|
+
export declare function freemem(): number;
|
|
32
|
+
/** Kernel version, e.g. "10.0.26100" on Windows (RtlGetVersion is not shimmed by compatibility modes). */
|
|
33
|
+
export declare function release(): string;
|
|
34
|
+
declare const _default: {
|
|
35
|
+
EOL: string;
|
|
36
|
+
arch: typeof arch;
|
|
37
|
+
availableParallelism: typeof availableParallelism;
|
|
38
|
+
cpus: typeof cpus;
|
|
39
|
+
freemem: typeof freemem;
|
|
40
|
+
homedir: typeof homedir;
|
|
41
|
+
hostname: typeof hostname;
|
|
42
|
+
loadavg: typeof loadavg;
|
|
43
|
+
networkInterfaces: typeof networkInterfaces;
|
|
44
|
+
platform: typeof platform;
|
|
45
|
+
release: typeof release;
|
|
46
|
+
tmpdir: typeof tmpdir;
|
|
47
|
+
totalmem: typeof totalmem;
|
|
48
|
+
type: typeof type;
|
|
49
|
+
uptime: typeof uptime;
|
|
50
|
+
userInfo: typeof userInfo;
|
|
51
|
+
};
|
|
52
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import path from "tjs:path";
|
|
2
|
+
export declare const basename: typeof import("node:path").basename, delimiter: ":" | ";", dirname: typeof import("node:path").dirname, extname: typeof import("node:path").extname, format: typeof import("node:path").format, isAbsolute: typeof import("node:path").isAbsolute, join: typeof import("node:path").join, normalize: typeof import("node:path").normalize, parse: typeof import("node:path").parse, posix: typeof import("node:path"), relative: typeof import("node:path").relative, resolve: typeof import("node:path").resolve, sep: "/" | "\\", toNamespacedPath: typeof import("node:path").toNamespacedPath, win32: typeof import("node:path");
|
|
3
|
+
export default path;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function setTimeout<T = void>(milliseconds?: number, value?: T): Promise<T>;
|
|
2
|
+
export declare function setImmediate<T = void>(value?: T): Promise<T>;
|
|
3
|
+
declare const _default: {
|
|
4
|
+
setImmediate: typeof setImmediate;
|
|
5
|
+
setTimeout: typeof setTimeout;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const deflateSync: (_data: Uint8Array) => Uint8Array;
|
|
2
|
+
export declare const inflateSync: (_data: Uint8Array) => Uint8Array;
|
|
3
|
+
export declare const gzipSync: (_data: Uint8Array) => Uint8Array;
|
|
4
|
+
export declare const gunzipSync: (_data: Uint8Array) => Uint8Array;
|
|
5
|
+
declare const _default: {
|
|
6
|
+
deflateSync: typeof deflateSync;
|
|
7
|
+
gunzipSync: typeof gunzipSync;
|
|
8
|
+
gzipSync: typeof gzipSync;
|
|
9
|
+
inflateSync: typeof inflateSync;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type BuildOptions } from "./build";
|
|
2
|
+
export interface TxikiBuildOptions extends BuildOptions {
|
|
3
|
+
/** txiki.js (tjs) used to compile the bundle. Defaults to TARVE_TXIKI, then `tjs` on PATH. */
|
|
4
|
+
txikiExecutable?: string;
|
|
5
|
+
}
|
|
6
|
+
interface EmbeddedFile {
|
|
7
|
+
name: string;
|
|
8
|
+
data: Uint8Array;
|
|
9
|
+
gzip: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Bundle a TSX app for txiki.js (QuickJS-ng + libuv) and fuse it, with the native
|
|
13
|
+
* runtime and assets, into one executable: no Bun or Node.js at run time.
|
|
14
|
+
*
|
|
15
|
+
* Layout: [txiki.js][files][index JSON][u32 index length][u32 0]["TARVEBLB"][tjs payload]["tx1k1.js"][u32 payload offset]
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildTxiki(options: TxikiBuildOptions): Promise<string>;
|
|
18
|
+
/** Fails the build when a placeholder for a missing Node API survived tree shaking: the app would throw at run time. */
|
|
19
|
+
export declare function assertAvailable(bundle: string, importers?: ReadonlyMap<string, ReadonlySet<string>>): void;
|
|
20
|
+
/** The bytecode `tjs compile` appended to its own binary, without the trailer. */
|
|
21
|
+
export declare function txikiPayload(compiled: Uint8Array, hostSize: number): Uint8Array;
|
|
22
|
+
export declare function fuse(executable: Uint8Array, files: readonly EmbeddedFile[], payload: Uint8Array): Uint8Array;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type SignedUpdateManifest, type UpdateManifest } from "./src/updates";
|
|
2
|
+
export interface UpdateKeys {
|
|
3
|
+
/** Base64 raw Ed25519 public key: pass to checkForUpdate. */
|
|
4
|
+
publicKey: string;
|
|
5
|
+
/** Base64 PKCS#8 private key: keep secret, give to tarve release. */
|
|
6
|
+
privateKey: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function generateUpdateKeys(): UpdateKeys;
|
|
9
|
+
/** The base64 public key that belongs to `privateKey`. */
|
|
10
|
+
export declare function updatePublicKey(privateKey: string): string;
|
|
11
|
+
export declare function signUpdateManifest(manifest: UpdateManifest, privateKey: string): SignedUpdateManifest;
|
|
12
|
+
export interface ReleaseOptions {
|
|
13
|
+
version: string;
|
|
14
|
+
/** `platform=path` pairs, e.g. `win32-x64=dist/App.exe`. */
|
|
15
|
+
artifacts: string[];
|
|
16
|
+
/** Base64 PKCS#8 key, or a path to a file holding it. */
|
|
17
|
+
privateKey: string;
|
|
18
|
+
/** Public key the app ships with: release fails when the private key does not match it. */
|
|
19
|
+
publicKey?: string;
|
|
20
|
+
outDir?: string;
|
|
21
|
+
/** Prefix for artifact URLs; relative to the manifest URL when omitted. */
|
|
22
|
+
baseUrl?: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
notes?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Authenticode command run on each Windows artifact (the copy in `outDir`) before it is hashed, e.g.
|
|
27
|
+
* `signtool sign /fd sha256 /tr http://timestamp.digicert.com /td sha256 {file}`. `{file}` is the quoted
|
|
28
|
+
* path; without it the path is appended.
|
|
29
|
+
*/
|
|
30
|
+
sign?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Runs `command` on `file` through the shell (see ReleaseOptions.sign); throws when it fails. */
|
|
33
|
+
export declare function signFile(command: string, file: string): void;
|
|
34
|
+
/** Copies the artifacts into `outDir` and writes the signed `latest.json` beside them. */
|
|
35
|
+
export declare function release(options: ReleaseOptions): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface WindowsExecutableInfo {
|
|
2
|
+
name: string;
|
|
3
|
+
version: string;
|
|
4
|
+
filename: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
publisher?: string;
|
|
7
|
+
copyright?: string;
|
|
8
|
+
/** .ico bytes; replace the host executable's icon. */
|
|
9
|
+
ico?: Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Give a Node.js single-executable app the identity `bun build --compile` gives a
|
|
13
|
+
* Tarve app: its own name, description and version instead of Node.js branding, and
|
|
14
|
+
* the GUI subsystem so double-clicking it does not open a console window.
|
|
15
|
+
*/
|
|
16
|
+
export declare function brandWindowsExecutable(path: string, info: WindowsExecutableInfo): void;
|