@jitl/opentui-core 0.1.97 → 0.2.15
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/NativeSpanFeed.d.ts +2 -2
- package/README.md +2 -1
- package/Renderable.d.ts +12 -1
- package/audio.d.ts +89 -0
- package/buffer.d.ts +6 -5
- package/console.d.ts +3 -1
- package/edit-buffer.d.ts +1 -1
- package/editor-view.d.ts +1 -1
- package/{index-yxe6e14n.js → index-46f5e8m6.js} +1388 -1721
- package/index-46f5e8m6.js.map +36 -0
- package/index-5zwezmgj.js +639 -0
- package/index-5zwezmgj.js.map +11 -0
- package/index-axv7cw60.js +44 -0
- package/index-axv7cw60.js.map +10 -0
- package/{index-rhfjv9c1.js → index-g9agybj3.js} +4626 -984
- package/index-g9agybj3.js.map +82 -0
- package/index-k18nf2r7.js +21 -0
- package/{ffi-x3zvcksd.js.map → index-k18nf2r7.js.map} +1 -1
- package/{index-tkk6cmr2.js → index-rp7vz5rh.js} +125 -23
- package/index-rp7vz5rh.js.map +10 -0
- package/{index-kcpn1hka.js → index-xwsdfq5x.js} +16 -6
- package/index-xwsdfq5x.js.map +10 -0
- package/index.d.ts +1 -0
- package/index.js +37 -17
- package/index.js.map +1 -1
- package/lib/RGBA.d.ts +22 -6
- package/lib/clipboard.d.ts +1 -1
- package/lib/{keymapping.d.ts → keybinding.internal.d.ts} +10 -2
- package/lib/objects-in-viewport.d.ts +4 -4
- package/lib/parse.keypress-kitty.d.ts +1 -0
- package/lib/parse.keypress.d.ts +1 -0
- package/lib/render-geometry.d.ts +8 -0
- package/lib/stdin-parser.d.ts +4 -1
- package/lib/terminal-capability-detection.d.ts +2 -0
- package/lib/terminal-palette.d.ts +20 -5
- package/lib/tree-sitter/assets/update.d.ts +1 -0
- package/lib/tree-sitter/client.d.ts +2 -0
- package/lib/tree-sitter/default-parsers.d.ts +1 -1
- package/lib/tree-sitter/index.d.ts +0 -2
- package/lib/tree-sitter/update-assets.d.ts +3 -0
- package/lib/tree-sitter/update-assets.js +377 -0
- package/lib/tree-sitter/update-assets.js.map +12 -0
- package/lib/tree-sitter-styled-text.d.ts +6 -4
- package/node22-bun-ffi-structs-ha8fmzzb.js +396 -0
- package/node22-bun-ffi-structs-ha8fmzzb.js.map +10 -0
- package/package.json +23 -22
- package/parser.worker.js +161 -24
- package/parser.worker.js.map +12 -5
- package/platform/bun-ffi-structs.d.ts +2 -0
- package/platform/ffi.d.ts +126 -0
- package/platform/node22-bun-ffi-structs.d.ts +33 -0
- package/platform/node22-ffi.d.ts +33 -0
- package/{compat → platform}/runtime.d.ts +6 -0
- package/platform/worker.d.ts +4 -0
- package/renderables/Code.d.ts +4 -0
- package/renderables/Markdown.d.ts +62 -0
- package/renderables/ScrollBox.d.ts +1 -0
- package/renderables/Select.d.ts +3 -1
- package/renderables/TabSelect.d.ts +3 -1
- package/renderables/TextBufferRenderable.d.ts +1 -0
- package/renderables/TextTable.d.ts +15 -1
- package/renderables/Textarea.d.ts +5 -3
- package/renderables/markdown-parser.d.ts +1 -0
- package/renderer-theme-mode.d.ts +29 -0
- package/renderer.d.ts +142 -16
- package/runtime-plugin-support-configure.d.ts +4 -0
- package/runtime-plugin-support-configure.js +20 -0
- package/{index-re3ntm60.js.map → runtime-plugin-support-configure.js.map} +1 -1
- package/runtime-plugin-support.d.ts +3 -3
- package/runtime-plugin-support.js +9 -18
- package/runtime-plugin-support.js.map +3 -3
- package/runtime-plugin.d.ts +1 -4
- package/runtime-plugin.js +5 -5
- package/syntax-style.d.ts +11 -3
- package/testing/terminal-capabilities.d.ts +7 -0
- package/testing/test-recorder.d.ts +6 -6
- package/testing/test-renderer.d.ts +34 -2
- package/testing.d.ts +2 -0
- package/testing.js +329 -23
- package/testing.js.map +7 -5
- package/text-buffer-view.d.ts +2 -1
- package/text-buffer.d.ts +1 -1
- package/types.d.ts +33 -1
- package/zig-structs.d.ts +111 -20
- package/zig.d.ts +57 -7
- package/3d/SpriteResourceManager.d.ts +0 -74
- package/3d/SpriteUtils.d.ts +0 -13
- package/3d/TextureUtils.d.ts +0 -24
- package/3d/ThreeRenderable.d.ts +0 -40
- package/3d/WGPURenderer.d.ts +0 -61
- package/3d/animation/ExplodingSpriteEffect.d.ts +0 -71
- package/3d/animation/PhysicsExplodingSpriteEffect.d.ts +0 -76
- package/3d/animation/SpriteAnimator.d.ts +0 -124
- package/3d/animation/SpriteParticleGenerator.d.ts +0 -62
- package/3d/canvas.d.ts +0 -44
- package/3d/index.d.ts +0 -12
- package/3d/physics/PlanckPhysicsAdapter.d.ts +0 -19
- package/3d/physics/RapierPhysicsAdapter.d.ts +0 -19
- package/3d/physics/physics-interface.d.ts +0 -27
- package/3d.d.ts +0 -2
- package/3d.js +0 -33843
- package/3d.js.map +0 -155
- package/Worker-vajwjk0s.js +0 -94
- package/Worker-vajwjk0s.js.map +0 -10
- package/compat/FFIType.d.ts +0 -304
- package/compat/Worker.d.ts +0 -1
- package/compat/bun-ffi-structs.d.ts +0 -2
- package/compat/ffi.d.ts +0 -86
- package/compat/nodejs/Worker.d.ts +0 -16
- package/compat/nodejs/bun-ffi-structs/index.d.ts +0 -46
- package/compat/nodejs/ffi.d.ts +0 -21
- package/compat/nodejs/registerResolveJs.d.ts +0 -1
- package/compat/nodejs/runtime.d.ts +0 -7
- package/compat/nodejs/test.d.ts +0 -4
- package/compat/nodejs/trampoline.worker.d.ts +0 -1
- package/compat/test.d.ts +0 -1
- package/compat/testHelpers.d.ts +0 -18
- package/ffi-x3zvcksd.js +0 -25
- package/index-5yqvbmcz.js +0 -220
- package/index-5yqvbmcz.js.map +0 -10
- package/index-bnfz2g63.js +0 -654
- package/index-bnfz2g63.js.map +0 -10
- package/index-cbvybypy.js +0 -43
- package/index-cbvybypy.js.map +0 -10
- package/index-kcpn1hka.js.map +0 -10
- package/index-re3ntm60.js +0 -51
- package/index-rhfjv9c1.js.map +0 -70
- package/index-tkk6cmr2.js.map +0 -10
- package/index-yxe6e14n.js.map +0 -42
- package/runtime-hdpkc6qf.js +0 -220
- package/runtime-hdpkc6qf.js.map +0 -17
- /package/{compat/nodejs/registerBun.d.ts → native-event-worker-repro.worker.d.ts} +0 -0
package/Worker-vajwjk0s.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import"./index-re3ntm60.js";
|
|
3
|
-
|
|
4
|
-
// src/compat/nodejs/Worker.ts
|
|
5
|
-
import { existsSync } from "fs";
|
|
6
|
-
import { extname } from "path";
|
|
7
|
-
import { pathToFileURL } from "url";
|
|
8
|
-
import { Worker as NodeWorker } from "worker_threads";
|
|
9
|
-
var ownExtension = extname(import.meta.url);
|
|
10
|
-
var knownProtocolRegex = /^(file|data|node):/;
|
|
11
|
-
var windowsDriveProtocolRegex = /^[a-zA-Z]:$/;
|
|
12
|
-
var windowsAbsolutePathRegex = /^[a-zA-Z]:[\\/]/;
|
|
13
|
-
function pathLikeToFileURL(path) {
|
|
14
|
-
if (windowsAbsolutePathRegex.test(path)) {
|
|
15
|
-
return new URL(`file:///${path.replace(/\\/g, "/")}`).href;
|
|
16
|
-
}
|
|
17
|
-
return pathToFileURL(path).href;
|
|
18
|
-
}
|
|
19
|
-
function resolveWorkerTarget(url) {
|
|
20
|
-
if (url instanceof URL) {
|
|
21
|
-
if (windowsDriveProtocolRegex.test(url.protocol)) {
|
|
22
|
-
return pathLikeToFileURL(url.href);
|
|
23
|
-
}
|
|
24
|
-
return url.href;
|
|
25
|
-
}
|
|
26
|
-
if (knownProtocolRegex.test(url)) {
|
|
27
|
-
return url;
|
|
28
|
-
}
|
|
29
|
-
return pathLikeToFileURL(url);
|
|
30
|
-
}
|
|
31
|
-
function resolveWorkerEntrypoint(url) {
|
|
32
|
-
const target = resolveWorkerTarget(url);
|
|
33
|
-
if (knownProtocolRegex.test(target)) {
|
|
34
|
-
return new URL(target);
|
|
35
|
-
}
|
|
36
|
-
return target;
|
|
37
|
-
}
|
|
38
|
-
function resolveImportArg(url) {
|
|
39
|
-
return `--import=${resolveWorkerTarget(url)}`;
|
|
40
|
-
}
|
|
41
|
-
function normalizeExtension(specifier) {
|
|
42
|
-
if (existsSync(specifier)) {
|
|
43
|
-
return specifier;
|
|
44
|
-
}
|
|
45
|
-
const stringSpecifier = String(specifier);
|
|
46
|
-
const extension = extname(stringSpecifier);
|
|
47
|
-
if (extension === ownExtension) {
|
|
48
|
-
return specifier;
|
|
49
|
-
}
|
|
50
|
-
const newSpecifier = stringSpecifier.slice(0, -extension.length) + ownExtension;
|
|
51
|
-
if (specifier instanceof URL) {
|
|
52
|
-
return new URL(newSpecifier);
|
|
53
|
-
}
|
|
54
|
-
return newSpecifier;
|
|
55
|
-
}
|
|
56
|
-
var trampoline;
|
|
57
|
-
var registerJs;
|
|
58
|
-
|
|
59
|
-
class Worker extends NodeWorker {
|
|
60
|
-
onmessage = null;
|
|
61
|
-
onerror = null;
|
|
62
|
-
constructor(url) {
|
|
63
|
-
let execArgv = process.execArgv;
|
|
64
|
-
if (import.meta.url.endsWith(".ts")) {
|
|
65
|
-
registerJs ??= normalizeExtension(new URL("./registerResolveJs.js", import.meta.url));
|
|
66
|
-
const registerJsArg = resolveImportArg(registerJs);
|
|
67
|
-
if (!execArgv.includes(registerJsArg)) {
|
|
68
|
-
execArgv = [...execArgv, registerJsArg];
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
trampoline ??= normalizeExtension(new URL("./trampoline.worker.js", import.meta.url));
|
|
72
|
-
super(resolveWorkerEntrypoint(trampoline), {
|
|
73
|
-
workerData: {
|
|
74
|
-
targetUrl: resolveWorkerTarget(url)
|
|
75
|
-
},
|
|
76
|
-
execArgv
|
|
77
|
-
});
|
|
78
|
-
this.on("message", (data) => {
|
|
79
|
-
this.onmessage?.({ data });
|
|
80
|
-
});
|
|
81
|
-
this.on("error", (error) => {
|
|
82
|
-
this.onerror?.(error);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export {
|
|
87
|
-
resolveWorkerTarget,
|
|
88
|
-
resolveWorkerEntrypoint,
|
|
89
|
-
resolveImportArg,
|
|
90
|
-
Worker
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
//# debugId=36C6CCB87B5479F264756E2164756E21
|
|
94
|
-
//# sourceMappingURL=Worker-vajwjk0s.js.map
|
package/Worker-vajwjk0s.js.map
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/compat/nodejs/Worker.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { existsSync } from \"node:fs\"\nimport { extname } from \"node:path\"\nimport { pathToFileURL } from \"node:url\"\nimport { Worker as NodeWorker } from \"node:worker_threads\"\n\ntype MessageEventLike<T = unknown> = { data: T }\ntype ErrorEventLike = { message: string }\n\nconst ownExtension = extname(import.meta.url)\nconst knownProtocolRegex = /^(file|data|node):/\nconst windowsDriveProtocolRegex = /^[a-zA-Z]:$/\nconst windowsAbsolutePathRegex = /^[a-zA-Z]:[\\\\/]/\n\nfunction pathLikeToFileURL(path: string): string {\n if (windowsAbsolutePathRegex.test(path)) {\n return new URL(`file:///${path.replace(/\\\\/g, \"/\")}`).href\n }\n\n return pathToFileURL(path).href\n}\n\nexport function resolveWorkerTarget(url: string | URL): string {\n if (url instanceof URL) {\n if (windowsDriveProtocolRegex.test(url.protocol)) {\n return pathLikeToFileURL(url.href)\n }\n return url.href\n }\n\n // allowing any <words>:<anything> will confuse windows absolute path starting\n // with a drive letter with a valid url.\n if (knownProtocolRegex.test(url)) {\n return url\n }\n\n return pathLikeToFileURL(url)\n}\n\nexport function resolveWorkerEntrypoint(url: string | URL): string | URL {\n const target = resolveWorkerTarget(url)\n if (knownProtocolRegex.test(target)) {\n return new URL(target)\n }\n return target\n}\n\nexport function resolveImportArg(url: string | URL): string {\n return `--import=${resolveWorkerTarget(url)}`\n}\n\nfunction normalizeExtension(specifier: string): string\nfunction normalizeExtension(specifier: URL): URL\nfunction normalizeExtension(specifier: string | URL): string | URL {\n if (existsSync(specifier)) {\n return specifier\n }\n\n const stringSpecifier = String(specifier)\n const extension = extname(stringSpecifier)\n if (extension === ownExtension) {\n return specifier\n }\n\n const newSpecifier = stringSpecifier.slice(0, -extension.length) + ownExtension\n if (specifier instanceof URL) {\n return new URL(newSpecifier)\n }\n return newSpecifier\n}\n\nlet trampoline: URL | undefined\nlet registerJs: string | URL | undefined\n\nexport class Worker extends NodeWorker {\n onmessage: ((event: MessageEventLike) => void) | null = null\n onerror: ((event: ErrorEventLike) => void) | null = null\n\n constructor(url: string | URL) {\n let execArgv = process.execArgv\n if (import.meta.url.endsWith(\".ts\")) {\n registerJs ??= normalizeExtension(new URL(\"./registerResolveJs.js\", import.meta.url))\n const registerJsArg = resolveImportArg(registerJs)\n if (!execArgv.includes(registerJsArg)) {\n execArgv = [...execArgv, registerJsArg]\n }\n }\n\n trampoline ??= normalizeExtension(new URL(\"./trampoline.worker.js\", import.meta.url))\n super(resolveWorkerEntrypoint(trampoline), {\n workerData: {\n targetUrl: resolveWorkerTarget(url),\n },\n execArgv,\n })\n\n this.on(\"message\", (data: unknown) => {\n this.onmessage?.({ data })\n })\n\n this.on(\"error\", (error: Error) => {\n this.onerror?.(error)\n })\n }\n}\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";;;;AAAA;AACA;AACA;AACA,mBAAS;AAKT,IAAM,eAAe,QAAQ,YAAY,GAAG;AAC5C,IAAM,qBAAqB;AAC3B,IAAM,4BAA4B;AAClC,IAAM,2BAA2B;AAEjC,SAAS,iBAAiB,CAAC,MAAsB;AAAA,EAC/C,IAAI,yBAAyB,KAAK,IAAI,GAAG;AAAA,IACvC,OAAO,IAAI,IAAI,WAAW,KAAK,QAAQ,OAAO,GAAG,GAAG,EAAE;AAAA,EACxD;AAAA,EAEA,OAAO,cAAc,IAAI,EAAE;AAAA;AAGtB,SAAS,mBAAmB,CAAC,KAA2B;AAAA,EAC7D,IAAI,eAAe,KAAK;AAAA,IACtB,IAAI,0BAA0B,KAAK,IAAI,QAAQ,GAAG;AAAA,MAChD,OAAO,kBAAkB,IAAI,IAAI;AAAA,IACnC;AAAA,IACA,OAAO,IAAI;AAAA,EACb;AAAA,EAIA,IAAI,mBAAmB,KAAK,GAAG,GAAG;AAAA,IAChC,OAAO;AAAA,EACT;AAAA,EAEA,OAAO,kBAAkB,GAAG;AAAA;AAGvB,SAAS,uBAAuB,CAAC,KAAiC;AAAA,EACvE,MAAM,SAAS,oBAAoB,GAAG;AAAA,EACtC,IAAI,mBAAmB,KAAK,MAAM,GAAG;AAAA,IACnC,OAAO,IAAI,IAAI,MAAM;AAAA,EACvB;AAAA,EACA,OAAO;AAAA;AAGF,SAAS,gBAAgB,CAAC,KAA2B;AAAA,EAC1D,OAAO,YAAY,oBAAoB,GAAG;AAAA;AAK5C,SAAS,kBAAkB,CAAC,WAAuC;AAAA,EACjE,IAAI,WAAW,SAAS,GAAG;AAAA,IACzB,OAAO;AAAA,EACT;AAAA,EAEA,MAAM,kBAAkB,OAAO,SAAS;AAAA,EACxC,MAAM,YAAY,QAAQ,eAAe;AAAA,EACzC,IAAI,cAAc,cAAc;AAAA,IAC9B,OAAO;AAAA,EACT;AAAA,EAEA,MAAM,eAAe,gBAAgB,MAAM,GAAG,CAAC,UAAU,MAAM,IAAI;AAAA,EACnE,IAAI,qBAAqB,KAAK;AAAA,IAC5B,OAAO,IAAI,IAAI,YAAY;AAAA,EAC7B;AAAA,EACA,OAAO;AAAA;AAGT,IAAI;AACJ,IAAI;AAAA;AAEG,MAAM,eAAe,WAAW;AAAA,EACrC,YAAwD;AAAA,EACxD,UAAoD;AAAA,EAEpD,WAAW,CAAC,KAAmB;AAAA,IAC7B,IAAI,WAAW,QAAQ;AAAA,IACvB,IAAI,YAAY,IAAI,SAAS,KAAK,GAAG;AAAA,MACnC,eAAe,mBAAmB,IAAI,IAAI,0BAA0B,YAAY,GAAG,CAAC;AAAA,MACpF,MAAM,gBAAgB,iBAAiB,UAAU;AAAA,MACjD,IAAI,CAAC,SAAS,SAAS,aAAa,GAAG;AAAA,QACrC,WAAW,CAAC,GAAG,UAAU,aAAa;AAAA,MACxC;AAAA,IACF;AAAA,IAEA,eAAe,mBAAmB,IAAI,IAAI,0BAA0B,YAAY,GAAG,CAAC;AAAA,IACpF,MAAM,wBAAwB,UAAU,GAAG;AAAA,MACzC,YAAY;AAAA,QACV,WAAW,oBAAoB,GAAG;AAAA,MACpC;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IAED,KAAK,GAAG,WAAW,CAAC,SAAkB;AAAA,MACpC,KAAK,YAAY,EAAE,KAAK,CAAC;AAAA,KAC1B;AAAA,IAED,KAAK,GAAG,SAAS,CAAC,UAAiB;AAAA,MACjC,KAAK,UAAU,KAAK;AAAA,KACrB;AAAA;AAEL;",
|
|
8
|
-
"debugId": "36C6CCB87B5479F264756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
package/compat/FFIType.d.ts
DELETED
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
/** Copy of bun:ffi#FFIType */
|
|
2
|
-
export declare enum FFIType {
|
|
3
|
-
char = 0,
|
|
4
|
-
/**
|
|
5
|
-
* 8-bit signed integer
|
|
6
|
-
*
|
|
7
|
-
* Must be a value between -127 and 127
|
|
8
|
-
*
|
|
9
|
-
* When passing to a FFI function (C ABI), type coercion is not performed.
|
|
10
|
-
*
|
|
11
|
-
* In C:
|
|
12
|
-
* ```c
|
|
13
|
-
* signed char
|
|
14
|
-
* char // on x64 & aarch64 macOS
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* In JavaScript:
|
|
18
|
-
* ```js
|
|
19
|
-
* var num = 0;
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
int8_t = 1,
|
|
23
|
-
/**
|
|
24
|
-
* 8-bit signed integer
|
|
25
|
-
*
|
|
26
|
-
* Must be a value between -127 and 127
|
|
27
|
-
*
|
|
28
|
-
* When passing to a FFI function (C ABI), type coercion is not performed.
|
|
29
|
-
*
|
|
30
|
-
* In C:
|
|
31
|
-
* ```c
|
|
32
|
-
* signed char
|
|
33
|
-
* char // on x64 & aarch64 macOS
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* In JavaScript:
|
|
37
|
-
* ```js
|
|
38
|
-
* var num = 0;
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
i8 = 1,
|
|
42
|
-
/**
|
|
43
|
-
* 8-bit unsigned integer
|
|
44
|
-
*
|
|
45
|
-
* Must be a value between 0 and 255
|
|
46
|
-
*
|
|
47
|
-
* When passing to a FFI function (C ABI), type coercion is not performed.
|
|
48
|
-
*
|
|
49
|
-
* In C:
|
|
50
|
-
* ```c
|
|
51
|
-
* unsigned char
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* In JavaScript:
|
|
55
|
-
* ```js
|
|
56
|
-
* var num = 0;
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
uint8_t = 2,
|
|
60
|
-
/**
|
|
61
|
-
* 8-bit unsigned integer
|
|
62
|
-
*
|
|
63
|
-
* Must be a value between 0 and 255
|
|
64
|
-
*
|
|
65
|
-
* When passing to a FFI function (C ABI), type coercion is not performed.
|
|
66
|
-
*
|
|
67
|
-
* In C:
|
|
68
|
-
* ```c
|
|
69
|
-
* unsigned char
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* In JavaScript:
|
|
73
|
-
* ```js
|
|
74
|
-
* var num = 0;
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
u8 = 2,
|
|
78
|
-
/**
|
|
79
|
-
* 16-bit signed integer
|
|
80
|
-
*
|
|
81
|
-
* Must be a value between -32768 and 32767
|
|
82
|
-
*
|
|
83
|
-
* When passing to a FFI function (C ABI), type coercion is not performed.
|
|
84
|
-
*
|
|
85
|
-
* In C:
|
|
86
|
-
* ```c
|
|
87
|
-
* in16_t
|
|
88
|
-
* short // on arm64 & x64
|
|
89
|
-
* ```
|
|
90
|
-
*
|
|
91
|
-
* In JavaScript:
|
|
92
|
-
* ```js
|
|
93
|
-
* var num = 0;
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
int16_t = 3,
|
|
97
|
-
/**
|
|
98
|
-
* 16-bit signed integer
|
|
99
|
-
*
|
|
100
|
-
* Must be a value between -32768 and 32767
|
|
101
|
-
*
|
|
102
|
-
* When passing to a FFI function (C ABI), type coercion is not performed.
|
|
103
|
-
*
|
|
104
|
-
* In C:
|
|
105
|
-
* ```c
|
|
106
|
-
* in16_t
|
|
107
|
-
* short // on arm64 & x64
|
|
108
|
-
* ```
|
|
109
|
-
*
|
|
110
|
-
* In JavaScript:
|
|
111
|
-
* ```js
|
|
112
|
-
* var num = 0;
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
i16 = 3,
|
|
116
|
-
/**
|
|
117
|
-
* 16-bit unsigned integer
|
|
118
|
-
*
|
|
119
|
-
* Must be a value between 0 and 65535, inclusive.
|
|
120
|
-
*
|
|
121
|
-
* When passing to a FFI function (C ABI), type coercion is not performed.
|
|
122
|
-
*
|
|
123
|
-
* In C:
|
|
124
|
-
* ```c
|
|
125
|
-
* uint16_t
|
|
126
|
-
* unsigned short // on arm64 & x64
|
|
127
|
-
* ```
|
|
128
|
-
*
|
|
129
|
-
* In JavaScript:
|
|
130
|
-
* ```js
|
|
131
|
-
* var num = 0;
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
uint16_t = 4,
|
|
135
|
-
/**
|
|
136
|
-
* 16-bit unsigned integer
|
|
137
|
-
*
|
|
138
|
-
* Must be a value between 0 and 65535, inclusive.
|
|
139
|
-
*
|
|
140
|
-
* When passing to a FFI function (C ABI), type coercion is not performed.
|
|
141
|
-
*
|
|
142
|
-
* In C:
|
|
143
|
-
* ```c
|
|
144
|
-
* uint16_t
|
|
145
|
-
* unsigned short // on arm64 & x64
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* In JavaScript:
|
|
149
|
-
* ```js
|
|
150
|
-
* var num = 0;
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
u16 = 4,
|
|
154
|
-
/**
|
|
155
|
-
* 32-bit signed integer
|
|
156
|
-
*/
|
|
157
|
-
int32_t = 5,
|
|
158
|
-
/**
|
|
159
|
-
* 32-bit signed integer
|
|
160
|
-
*
|
|
161
|
-
* Alias of {@link FFIType.int32_t}
|
|
162
|
-
*/
|
|
163
|
-
i32 = 5,
|
|
164
|
-
/**
|
|
165
|
-
* 32-bit signed integer
|
|
166
|
-
*
|
|
167
|
-
* The same as `int` in C
|
|
168
|
-
*
|
|
169
|
-
* ```c
|
|
170
|
-
* int
|
|
171
|
-
* ```
|
|
172
|
-
*/
|
|
173
|
-
int = 5,
|
|
174
|
-
/**
|
|
175
|
-
* 32-bit unsigned integer
|
|
176
|
-
*
|
|
177
|
-
* The same as `unsigned int` in C (on x64 & arm64)
|
|
178
|
-
*
|
|
179
|
-
* C:
|
|
180
|
-
* ```c
|
|
181
|
-
* unsigned int
|
|
182
|
-
* ```
|
|
183
|
-
* JavaScript:
|
|
184
|
-
* ```js
|
|
185
|
-
* ptr(new Uint32Array(1))
|
|
186
|
-
* ```
|
|
187
|
-
*/
|
|
188
|
-
uint32_t = 6,
|
|
189
|
-
/**
|
|
190
|
-
* 32-bit unsigned integer
|
|
191
|
-
*
|
|
192
|
-
* Alias of {@link FFIType.uint32_t}
|
|
193
|
-
*/
|
|
194
|
-
u32 = 6,
|
|
195
|
-
/**
|
|
196
|
-
* int64 is a 64-bit signed integer
|
|
197
|
-
*/
|
|
198
|
-
int64_t = 7,
|
|
199
|
-
/**
|
|
200
|
-
* i64 is a 64-bit signed integer
|
|
201
|
-
*/
|
|
202
|
-
i64 = 7,
|
|
203
|
-
/**
|
|
204
|
-
* 64-bit unsigned integer
|
|
205
|
-
*/
|
|
206
|
-
uint64_t = 8,
|
|
207
|
-
/**
|
|
208
|
-
* 64-bit unsigned integer
|
|
209
|
-
*/
|
|
210
|
-
u64 = 8,
|
|
211
|
-
/**
|
|
212
|
-
* IEEE-754 double precision float
|
|
213
|
-
*/
|
|
214
|
-
double = 9,
|
|
215
|
-
/**
|
|
216
|
-
* Alias of {@link FFIType.double}
|
|
217
|
-
*/
|
|
218
|
-
f64 = 9,
|
|
219
|
-
/**
|
|
220
|
-
* IEEE-754 single precision float
|
|
221
|
-
*/
|
|
222
|
-
float = 10,
|
|
223
|
-
/**
|
|
224
|
-
* Alias of {@link FFIType.float}
|
|
225
|
-
*/
|
|
226
|
-
f32 = 10,
|
|
227
|
-
/**
|
|
228
|
-
* Boolean value
|
|
229
|
-
*
|
|
230
|
-
* Must be `true` or `false`. `0` and `1` type coercion is not supported.
|
|
231
|
-
*
|
|
232
|
-
* In C, this corresponds to:
|
|
233
|
-
* ```c
|
|
234
|
-
* bool
|
|
235
|
-
* _Bool
|
|
236
|
-
* ```
|
|
237
|
-
*/
|
|
238
|
-
bool = 11,
|
|
239
|
-
/**
|
|
240
|
-
* Pointer value
|
|
241
|
-
*
|
|
242
|
-
* See {@link Bun.FFI.ptr} for more information
|
|
243
|
-
*
|
|
244
|
-
* In C:
|
|
245
|
-
* ```c
|
|
246
|
-
* void*
|
|
247
|
-
* ```
|
|
248
|
-
*
|
|
249
|
-
* In JavaScript:
|
|
250
|
-
* ```js
|
|
251
|
-
* ptr(new Uint8Array(1))
|
|
252
|
-
* ```
|
|
253
|
-
*/
|
|
254
|
-
ptr = 12,
|
|
255
|
-
/**
|
|
256
|
-
* Pointer value
|
|
257
|
-
*
|
|
258
|
-
* alias of {@link FFIType.ptr}
|
|
259
|
-
*/
|
|
260
|
-
pointer = 12,
|
|
261
|
-
/**
|
|
262
|
-
* void value
|
|
263
|
-
*
|
|
264
|
-
* void arguments are not supported
|
|
265
|
-
*
|
|
266
|
-
* void return type is the default return type
|
|
267
|
-
*
|
|
268
|
-
* In C:
|
|
269
|
-
* ```c
|
|
270
|
-
* void
|
|
271
|
-
* ```
|
|
272
|
-
*/
|
|
273
|
-
void = 13,
|
|
274
|
-
/**
|
|
275
|
-
* When used as a `returns`, this will automatically become a {@link CString}.
|
|
276
|
-
*
|
|
277
|
-
* When used in `args` it is equivalent to {@link FFIType.pointer}
|
|
278
|
-
*/
|
|
279
|
-
cstring = 14,
|
|
280
|
-
/**
|
|
281
|
-
* Attempt to coerce `BigInt` into a `Number` if it fits. This improves performance
|
|
282
|
-
* but means you might get a `BigInt` or you might get a `number`.
|
|
283
|
-
*
|
|
284
|
-
* In C, this always becomes `int64_t`
|
|
285
|
-
*
|
|
286
|
-
* In JavaScript, this could be number or it could be BigInt, depending on what
|
|
287
|
-
* value is passed in.
|
|
288
|
-
*/
|
|
289
|
-
i64_fast = 15,
|
|
290
|
-
/**
|
|
291
|
-
* Attempt to coerce `BigInt` into a `Number` if it fits. This improves performance
|
|
292
|
-
* but means you might get a `BigInt` or you might get a `number`.
|
|
293
|
-
*
|
|
294
|
-
* In C, this always becomes `uint64_t`
|
|
295
|
-
*
|
|
296
|
-
* In JavaScript, this could be number or it could be BigInt, depending on what
|
|
297
|
-
* value is passed in.
|
|
298
|
-
*/
|
|
299
|
-
u64_fast = 16,
|
|
300
|
-
function = 17,
|
|
301
|
-
napi_env = 18,
|
|
302
|
-
napi_value = 19,
|
|
303
|
-
buffer = 20
|
|
304
|
-
}
|
package/compat/Worker.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Worker: typeof globalThis.Worker;
|
package/compat/ffi.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { FFIType } from "./FFIType.js";
|
|
2
|
-
export { FFIType };
|
|
3
|
-
export type Pointer = number & {
|
|
4
|
-
__pointer__: null;
|
|
5
|
-
};
|
|
6
|
-
interface FFITypeStringToType {
|
|
7
|
-
["char"]: FFIType.char;
|
|
8
|
-
["int8_t"]: FFIType.int8_t;
|
|
9
|
-
["i8"]: FFIType.i8;
|
|
10
|
-
["uint8_t"]: FFIType.uint8_t;
|
|
11
|
-
["u8"]: FFIType.u8;
|
|
12
|
-
["int16_t"]: FFIType.int16_t;
|
|
13
|
-
["i16"]: FFIType.i16;
|
|
14
|
-
["uint16_t"]: FFIType.uint16_t;
|
|
15
|
-
["u16"]: FFIType.u16;
|
|
16
|
-
["int32_t"]: FFIType.int32_t;
|
|
17
|
-
["i32"]: FFIType.i32;
|
|
18
|
-
["int"]: FFIType.int;
|
|
19
|
-
["uint32_t"]: FFIType.uint32_t;
|
|
20
|
-
["u32"]: FFIType.u32;
|
|
21
|
-
["int64_t"]: FFIType.int64_t;
|
|
22
|
-
["i64"]: FFIType.i64;
|
|
23
|
-
["uint64_t"]: FFIType.uint64_t;
|
|
24
|
-
["u64"]: FFIType.u64;
|
|
25
|
-
["double"]: FFIType.double;
|
|
26
|
-
["f64"]: FFIType.f64;
|
|
27
|
-
["float"]: FFIType.float;
|
|
28
|
-
["f32"]: FFIType.f32;
|
|
29
|
-
["bool"]: FFIType.bool;
|
|
30
|
-
["ptr"]: FFIType.ptr;
|
|
31
|
-
["pointer"]: FFIType.pointer;
|
|
32
|
-
["void"]: FFIType.void;
|
|
33
|
-
["cstring"]: FFIType.cstring;
|
|
34
|
-
["function"]: FFIType.function;
|
|
35
|
-
["usize"]: FFIType.uint64_t;
|
|
36
|
-
["callback"]: FFIType.function;
|
|
37
|
-
["napi_env"]: FFIType.napi_env;
|
|
38
|
-
["napi_value"]: FFIType.napi_value;
|
|
39
|
-
["buffer"]: FFIType.buffer;
|
|
40
|
-
}
|
|
41
|
-
export type FFITypeOrString = FFIType | keyof FFITypeStringToType;
|
|
42
|
-
export interface FFIFunction {
|
|
43
|
-
readonly args?: readonly FFITypeOrString[];
|
|
44
|
-
readonly returns?: FFITypeOrString;
|
|
45
|
-
readonly ptr?: Pointer | bigint;
|
|
46
|
-
readonly threadsafe?: boolean;
|
|
47
|
-
}
|
|
48
|
-
type Symbols = Readonly<Record<string, FFIFunction>>;
|
|
49
|
-
type ToFFIType<T extends FFITypeOrString> = T extends FFIType ? T : T extends keyof FFITypeStringToType ? FFITypeStringToType[T] : never;
|
|
50
|
-
type NumericFFIType = FFIType.char | FFIType.int8_t | FFIType.i8 | FFIType.uint8_t | FFIType.u8 | FFIType.int16_t | FFIType.i16 | FFIType.uint16_t | FFIType.u16 | FFIType.int32_t | FFIType.i32 | FFIType.int | FFIType.uint32_t | FFIType.u32 | FFIType.double | FFIType.f64 | FFIType.float | FFIType.f32;
|
|
51
|
-
type BigIntArgFFIType = FFIType.int64_t | FFIType.i64 | FFIType.uint64_t | FFIType.u64 | FFIType.i64_fast | FFIType.u64_fast;
|
|
52
|
-
type BigIntReturnFFIType = FFIType.int64_t | FFIType.i64 | FFIType.uint64_t | FFIType.u64;
|
|
53
|
-
type PointerLike = NodeJS.TypedArray | DataView | Pointer | null;
|
|
54
|
-
type BufferLike = NodeJS.TypedArray | DataView;
|
|
55
|
-
type FFIArgValue<T extends FFIType> = T extends NumericFFIType ? number : T extends BigIntArgFFIType ? number | bigint : T extends FFIType.bool ? boolean : T extends FFIType.ptr | FFIType.pointer | FFIType.cstring ? PointerLike : T extends FFIType.void ? undefined : T extends FFIType.function ? Pointer | JSCallback : T extends FFIType.napi_env | FFIType.napi_value ? unknown : T extends FFIType.buffer ? BufferLike : never;
|
|
56
|
-
type FFIReturnValue<T extends FFIType> = T extends NumericFFIType ? number : T extends BigIntReturnFFIType ? bigint : T extends FFIType.i64_fast | FFIType.u64_fast ? number | bigint : T extends FFIType.bool ? boolean : T extends FFIType.ptr | FFIType.pointer | FFIType.cstring | FFIType.function ? Pointer | null : T extends FFIType.void ? undefined : T extends FFIType.napi_env | FFIType.napi_value ? unknown : T extends FFIType.buffer ? BufferLike : never;
|
|
57
|
-
declare const FFIFunctionCallableSymbol: unique symbol;
|
|
58
|
-
export type ConvertFns<Fns extends Symbols> = {
|
|
59
|
-
[K in keyof Fns]: {
|
|
60
|
-
(...args: Fns[K]["args"] extends infer A extends readonly FFITypeOrString[] ? {
|
|
61
|
-
[L in keyof A]: FFIArgValue<ToFFIType<A[L]>>;
|
|
62
|
-
} : [unknown] extends [Fns[K]["args"]] ? [] : never): [unknown] extends [Fns[K]["returns"]] ? undefined : FFIReturnValue<ToFFIType<NonNullable<Fns[K]["returns"]>>>;
|
|
63
|
-
__ffi_function_callable: typeof FFIFunctionCallableSymbol;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
export interface Library<Fns extends Symbols> {
|
|
67
|
-
symbols: ConvertFns<Fns>;
|
|
68
|
-
close(): void;
|
|
69
|
-
}
|
|
70
|
-
export interface JSCallback {
|
|
71
|
-
readonly ptr: Pointer | null;
|
|
72
|
-
readonly threadsafe: boolean;
|
|
73
|
-
close(): void;
|
|
74
|
-
}
|
|
75
|
-
export interface JSCallbackConstructor {
|
|
76
|
-
new (callback: (...args: any[]) => any, definition: FFIFunction): JSCallback;
|
|
77
|
-
}
|
|
78
|
-
export type DlopenFunction = <Fns extends Record<string, FFIFunction>>(name: string | URL, symbols: Fns) => Library<Fns>;
|
|
79
|
-
export type PtrFunction = (value: ArrayBufferLike | ArrayBufferView) => Pointer;
|
|
80
|
-
export type ToArrayBufferFunction = (pointer: Pointer, offset: number | undefined, length: number) => ArrayBuffer;
|
|
81
|
-
export declare const JSCallback: JSCallbackConstructor;
|
|
82
|
-
export declare const dlopen: DlopenFunction;
|
|
83
|
-
export declare const ptr: PtrFunction;
|
|
84
|
-
export declare const suffix: string;
|
|
85
|
-
export declare const toArrayBuffer: ToArrayBufferFunction;
|
|
86
|
-
export declare const __url: string;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Worker as NodeWorker } from "node:worker_threads";
|
|
2
|
-
type MessageEventLike<T = unknown> = {
|
|
3
|
-
data: T;
|
|
4
|
-
};
|
|
5
|
-
type ErrorEventLike = {
|
|
6
|
-
message: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function resolveWorkerTarget(url: string | URL): string;
|
|
9
|
-
export declare function resolveWorkerEntrypoint(url: string | URL): string | URL;
|
|
10
|
-
export declare function resolveImportArg(url: string | URL): string;
|
|
11
|
-
export declare class Worker extends NodeWorker {
|
|
12
|
-
onmessage: ((event: MessageEventLike) => void) | null;
|
|
13
|
-
onerror: ((event: ErrorEventLike) => void) | null;
|
|
14
|
-
constructor(url: string | URL);
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export var pointerSize: number;
|
|
2
|
-
export function packObjectArray(val: any): DataView<ArrayBuffer>;
|
|
3
|
-
export function objectPtr(): {
|
|
4
|
-
__type: string;
|
|
5
|
-
};
|
|
6
|
-
export function defineStruct(fields: any, structDefOptions: any): {
|
|
7
|
-
__type: string;
|
|
8
|
-
size: number;
|
|
9
|
-
align: number;
|
|
10
|
-
hasMapValue: boolean;
|
|
11
|
-
layoutByName: Map<any, {
|
|
12
|
-
name: any;
|
|
13
|
-
offset: number;
|
|
14
|
-
size: number;
|
|
15
|
-
align: number;
|
|
16
|
-
optional: boolean;
|
|
17
|
-
type: any;
|
|
18
|
-
lengthOf: any;
|
|
19
|
-
}>;
|
|
20
|
-
arrayFields: Map<string, any>;
|
|
21
|
-
pack(obj: any, options: any): ArrayBuffer;
|
|
22
|
-
packInto(obj: any, view: any, offset2: any, options: any): void;
|
|
23
|
-
unpack(buf: any): any;
|
|
24
|
-
packList(objects: any, options: any): ArrayBuffer;
|
|
25
|
-
unpackList(buf: any, count: any): any[];
|
|
26
|
-
describe(): {
|
|
27
|
-
name: any;
|
|
28
|
-
offset: number;
|
|
29
|
-
size: number;
|
|
30
|
-
align: number;
|
|
31
|
-
optional: boolean;
|
|
32
|
-
type: any;
|
|
33
|
-
lengthOf: any;
|
|
34
|
-
}[];
|
|
35
|
-
};
|
|
36
|
-
export function defineEnum(mapping: any, base?: string): {
|
|
37
|
-
__type: string;
|
|
38
|
-
type: string;
|
|
39
|
-
to(value: any): any;
|
|
40
|
-
from(value: any): any;
|
|
41
|
-
enum: any;
|
|
42
|
-
};
|
|
43
|
-
export function allocStruct(structDef: any, options: any): {
|
|
44
|
-
buffer: ArrayBuffer;
|
|
45
|
-
view: DataView<ArrayBuffer>;
|
|
46
|
-
};
|
package/compat/nodejs/ffi.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { DlopenFunction, FFIFunction, JSCallback as IJSCallback, Pointer, PtrFunction, ToArrayBufferFunction } from "../ffi.js";
|
|
2
|
-
import { FFIType } from "../FFIType.js";
|
|
3
|
-
export { FFIType };
|
|
4
|
-
export declare class JSCallback implements IJSCallback {
|
|
5
|
-
#private;
|
|
6
|
-
constructor(callback: (...args: any[]) => any, definition: FFIFunction);
|
|
7
|
-
get ptr(): Pointer | null;
|
|
8
|
-
get threadsafe(): boolean;
|
|
9
|
-
close(): void;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Get Pointer address of a TypedArray or ArrayBuffer
|
|
13
|
-
*/
|
|
14
|
-
export declare const ptr: PtrFunction;
|
|
15
|
-
/**
|
|
16
|
-
* Get an ArrayBuffer aliasing the memory at the given Pointer number
|
|
17
|
-
*/
|
|
18
|
-
export declare const toArrayBuffer: ToArrayBufferFunction;
|
|
19
|
-
export declare const suffix: string;
|
|
20
|
-
export declare const dlopen: DlopenFunction;
|
|
21
|
-
export declare const __url: string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import stringWidthLib from "string-width";
|
|
2
|
-
import stripAnsiLib from "strip-ansi";
|
|
3
|
-
import type { WriteFileOptions } from "../runtime.js";
|
|
4
|
-
export declare function sleep(msOrDate: number | Date): Promise<void>;
|
|
5
|
-
export declare const stringWidth: typeof stringWidthLib;
|
|
6
|
-
export declare const stripANSI: typeof stripAnsiLib;
|
|
7
|
-
export declare function writeFile(destination: string | URL, data: string | ArrayBufferView, options?: WriteFileOptions): Promise<number>;
|
package/compat/nodejs/test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/compat/test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./nodejs/test.js";
|
package/compat/testHelpers.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface SpawnSyncOptions {
|
|
2
|
-
cwd?: string;
|
|
3
|
-
env?: NodeJS.ProcessEnv;
|
|
4
|
-
stderr?: "ignore" | "pipe";
|
|
5
|
-
stdin?: "ignore" | "pipe";
|
|
6
|
-
stdout?: "ignore" | "pipe";
|
|
7
|
-
timeout?: number;
|
|
8
|
-
maxBuffer?: number;
|
|
9
|
-
}
|
|
10
|
-
export interface SpawnSyncResult {
|
|
11
|
-
stdout: Uint8Array;
|
|
12
|
-
stderr: Uint8Array;
|
|
13
|
-
exitCode: number;
|
|
14
|
-
success: boolean;
|
|
15
|
-
pid: number;
|
|
16
|
-
signalCode?: NodeJS.Signals | number;
|
|
17
|
-
}
|
|
18
|
-
export declare function spawnSync(cmd: string[], options?: SpawnSyncOptions): SpawnSyncResult;
|
package/ffi-x3zvcksd.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
JSCallback,
|
|
4
|
-
__url,
|
|
5
|
-
dlopen,
|
|
6
|
-
ptr,
|
|
7
|
-
suffix,
|
|
8
|
-
toArrayBuffer
|
|
9
|
-
} from "./index-5yqvbmcz.js";
|
|
10
|
-
import {
|
|
11
|
-
FFIType
|
|
12
|
-
} from "./index-cbvybypy.js";
|
|
13
|
-
import"./index-re3ntm60.js";
|
|
14
|
-
export {
|
|
15
|
-
toArrayBuffer,
|
|
16
|
-
suffix,
|
|
17
|
-
ptr,
|
|
18
|
-
dlopen,
|
|
19
|
-
__url,
|
|
20
|
-
JSCallback,
|
|
21
|
-
FFIType
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
//# debugId=DDBA855A1CE9F93664756E2164756E21
|
|
25
|
-
//# sourceMappingURL=ffi-x3zvcksd.js.map
|