Skip to content

Commit cd01d5b

Browse files
committed
bump quickjs to 0.15.0
1 parent d544463 commit cd01d5b

6 files changed

Lines changed: 86 additions & 37 deletions

File tree

meta/generated-docs/os.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
- ["quickjs:os".StructuredClonable (exported type)](#quickjsosstructuredclonable-exported-type)
120120
- ["quickjs:os".Worker (exported class)](#quickjsosworker-exported-class)
121121
- [Worker (constructor)](#worker-constructor)
122+
- [Worker (constructor)](#worker-constructor-1)
122123
- [Worker.parent (static Worker property)](#workerparent-static-worker-property)
123124
- [Worker.prototype.postMessage (method)](#workerprototypepostmessage-method)
124125
- [Worker.prototype.terminate (method)](#workerprototypeterminate-method)
@@ -339,6 +340,7 @@ declare module "quickjs:os" {
339340
};
340341
export class Worker {
341342
constructor(moduleFilename: string);
343+
constructor(fakeModuleFilename: string, overrideCode: string);
342344
static parent: Worker;
343345
postMessage(msg: StructuredClonable): void;
344346
terminate(): void;
@@ -1234,6 +1236,7 @@ type StructuredClonable =
12341236
```ts
12351237
class Worker {
12361238
constructor(moduleFilename: string);
1239+
constructor(fakeModuleFilename: string, overrideCode: string);
12371240
static parent: Worker;
12381241
postMessage(msg: StructuredClonable): void;
12391242
terminate(): void;
@@ -1251,10 +1254,23 @@ class Worker {
12511254

12521255
### Worker (constructor)
12531256

1257+
Create a Worker which runs the module at `moduleFilename`.
1258+
12541259
```ts
12551260
constructor(moduleFilename: string);
12561261
```
12571262

1263+
### Worker (constructor)
1264+
1265+
Create a Worker which runs a synthetic module with filename
1266+
`fakeModuleFilename` and source code `overrideCode` (JS source code
1267+
string). `fakeModuleFilename` is not read from disk and is only used as
1268+
the module's assigned filename for import.meta, module resolution, etc.
1269+
1270+
```ts
1271+
constructor(fakeModuleFilename: string, overrideCode: string);
1272+
```
1273+
12581274
### Worker.parent (static Worker property)
12591275

12601276
```ts

meta/ninja/dts.ninja.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ includeFiles.forEach((match) => {
1111
const includePaths = [
1212
...dtsFolderPaths,
1313
"src/templates",
14-
"node_modules/@suchipi/quickjs/build/dts",
14+
// I accidentally forgot to deduplicate the dts files with the 0.15.0 publish.
15+
// It doesn't matter which platform's dts files we use; they're all the same.
16+
"node_modules/@suchipi/quickjs/build/aarch64-apple-darwin/dts",
1517
];
1618

17-
const quickjsDtsFiles = glob("node_modules/@suchipi/quickjs/build/dts/*");
19+
const quickjsDtsFiles = glob(
20+
"node_modules/@suchipi/quickjs/build/aarch64-apple-darwin/dts/*",
21+
);
1822

1923
const dtsRaw = build({
2024
rule: "macaroni",

meta/ninja/generated-docs.ninja.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,30 @@ for (const dtsFile of dtsIncFiles) {
4949
}
5050

5151
const quickjsDtsFilesMap = {
52-
inspect: "node_modules/@suchipi/quickjs/build/dts/quickjs-inspect.d.ts",
53-
timers: "node_modules/@suchipi/quickjs/build/dts/quickjs-timers.d.ts",
54-
bytecode: "node_modules/@suchipi/quickjs/build/dts/quickjs-bytecode.d.ts",
55-
std: "node_modules/@suchipi/quickjs/build/dts/quickjs-std.d.ts",
56-
os: "node_modules/@suchipi/quickjs/build/dts/quickjs-os.d.ts",
57-
cmdline: "node_modules/@suchipi/quickjs/build/dts/quickjs-cmdline.d.ts",
58-
encoding: "node_modules/@suchipi/quickjs/build/dts/quickjs-encoding.d.ts",
59-
engine: "node_modules/@suchipi/quickjs/build/dts/quickjs-engine.d.ts",
60-
context: "node_modules/@suchipi/quickjs/build/dts/quickjs-context.d.ts",
52+
// I accidentally forgot to deduplicate the dts files with the 0.15.0 publish.
53+
// It doesn't matter which platform's dts files we use; they're all the same.
54+
inspect:
55+
"node_modules/@suchipi/quickjs/build/aarch64-apple-darwin/dts/quickjs-inspect.d.ts",
56+
timers:
57+
"node_modules/@suchipi/quickjs/build/aarch64-apple-darwin/dts/quickjs-timers.d.ts",
58+
bytecode:
59+
"node_modules/@suchipi/quickjs/build/aarch64-apple-darwin/dts/quickjs-bytecode.d.ts",
60+
std: "node_modules/@suchipi/quickjs/build/aarch64-apple-darwin/dts/quickjs-std.d.ts",
61+
os: "node_modules/@suchipi/quickjs/build/aarch64-apple-darwin/dts/quickjs-os.d.ts",
62+
cmdline:
63+
"node_modules/@suchipi/quickjs/build/aarch64-apple-darwin/dts/quickjs-cmdline.d.ts",
64+
encoding:
65+
"node_modules/@suchipi/quickjs/build/aarch64-apple-darwin/dts/quickjs-encoding.d.ts",
66+
engine:
67+
"node_modules/@suchipi/quickjs/build/aarch64-apple-darwin/dts/quickjs-engine.d.ts",
68+
context:
69+
"node_modules/@suchipi/quickjs/build/aarch64-apple-darwin/dts/quickjs-context.d.ts",
6170
// skipping pointer
62-
modulesys: "node_modules/@suchipi/quickjs/build/dts/quickjs-modulesys.d.ts",
71+
modulesys:
72+
"node_modules/@suchipi/quickjs/build/aarch64-apple-darwin/dts/quickjs-modulesys.d.ts",
6373
// skipping print as we redefine it
64-
"quickjs-extensions": "node_modules/@suchipi/quickjs/build/dts/quickjs.d.ts",
74+
"quickjs-extensions":
75+
"node_modules/@suchipi/quickjs/build/aarch64-apple-darwin/dts/quickjs.d.ts",
6576
};
6677

6778
for (const [outputName, quickjsDtsPath] of Object.entries(quickjsDtsFilesMap)) {

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@suchipi/dtsmd": "^1.4.0",
1111
"@suchipi/macaroni": "^0.3.0",
1212
"@suchipi/print": "^2.5.0",
13-
"@suchipi/quickjs": "^0.14.0",
13+
"@suchipi/quickjs": "^0.15.0",
1414
"@suchipi/shinobi": "^2.0.0",
1515
"@types/coffeescript": "^2.5.7",
1616
"@types/minimatch": "^5.1.2",

yavascript.d.ts

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4598,7 +4598,6 @@ interface BigIntConstructor {
45984598
ctz(a: bigint): bigint;
45994599
}
46004600

4601-
46024601
/** npm: @suchipi/print@2.5.0. License: ISC */
46034602
/* (with some QuickJS-specific modifications) */
46044603

@@ -4750,10 +4749,7 @@ declare module "quickjs:timers" {
47504749
export type Timer = { [Symbol.toStringTag]: "Timer" };
47514750

47524751
/** Call the function func after delay ms. Return a handle to the timer. */
4753-
export function setTimeout(
4754-
func: (...args: any) => any,
4755-
delay: number
4756-
): Timer;
4752+
export function setTimeout(func: (...args: any) => any, delay: number): Timer;
47574753

47584754
/** Cancel a timer. */
47594755
export function clearTimeout(handle: Timer): void;
@@ -5125,7 +5121,10 @@ declare module "quickjs:std" {
51255121
* - `responseHeaders`: headers separated by CRLF (string)
51265122
* - `status`: status code (number)
51275123
*/
5128-
(url: string, options: { full: true }): {
5124+
(
5125+
url: string,
5126+
options: { full: true }
5127+
): {
51295128
status: number;
51305129
response: string;
51315130
responseHeaders: string;
@@ -5140,7 +5139,10 @@ declare module "quickjs:std" {
51405139
* - `responseHeaders`: headers separated by CRLF (string)
51415140
* - `status`: status code (number)
51425141
*/
5143-
(url: string, options: { full: true; binary: false }): {
5142+
(
5143+
url: string,
5144+
options: { full: true; binary: false }
5145+
): {
51445146
status: number;
51455147
response: string;
51465148
responseHeaders: string;
@@ -5155,7 +5157,10 @@ declare module "quickjs:std" {
51555157
* - `responseHeaders`: headers separated by CRLF (string)
51565158
* - `status`: status code (number)
51575159
*/
5158-
(url: string, options: { full: true; binary: true }): {
5160+
(
5161+
url: string,
5162+
options: { full: true; binary: true }
5163+
): {
51595164
status: number;
51605165
response: ArrayBuffer;
51615166
responseHeaders: string;
@@ -5420,7 +5425,17 @@ declare module "quickjs:os" {
54205425
| { [key: string | number]: StructuredClonable };
54215426

54225427
export class Worker {
5428+
/**
5429+
* Create a Worker which runs the module at `moduleFilename`.
5430+
*/
54235431
constructor(moduleFilename: string);
5432+
/**
5433+
* Create a Worker which runs a synthetic module with filename
5434+
* `fakeModuleFilename` and source code `overrideCode` (JS source code
5435+
* string). `fakeModuleFilename` is not read from disk and is only used as
5436+
* the module's assigned filename for import.meta, module resolution, etc.
5437+
*/
5438+
constructor(fakeModuleFilename: string, overrideCode: string);
54245439
static parent: Worker;
54255440
postMessage(msg: StructuredClonable): void;
54265441
/**
@@ -5465,12 +5480,14 @@ declare module "quickjs:os" {
54655480
* fallback. When `onerror` is unset, errors print to stderr in the
54665481
* same format as an uncaught exception would.
54675482
*/
5468-
onerror: null | ((event: {
5469-
message: string;
5470-
filename: string;
5471-
lineno: number;
5472-
error: Error | null;
5473-
}) => void);
5483+
onerror:
5484+
| null
5485+
| ((event: {
5486+
message: string;
5487+
filename: string;
5488+
lineno: number;
5489+
error: Error | null;
5490+
}) => void);
54745491
}
54755492

54765493
/**
@@ -5837,10 +5854,7 @@ interface ModuleDelegate {
58375854
* own implementation. Note that you must handle `ModuleDelegate.compilers`
58385855
* yourself in your replacement implementation.
58395856
*/
5840-
read(
5841-
modulePath: string,
5842-
attributes?: Record<string, string>
5843-
): string;
5857+
read(modulePath: string, attributes?: Record<string, string>): string;
58445858
}
58455859

58465860
interface RequireFunction {
@@ -5984,7 +5998,11 @@ declare module "quickjs:engine" {
59845998
*/
59855999
export function evalScript(
59866000
code: string,
5987-
options?: { backtraceBarrier?: boolean; filename?: string; async?: boolean }
6001+
options?: {
6002+
backtraceBarrier?: boolean;
6003+
filename?: string;
6004+
async?: boolean;
6005+
}
59886006
): any;
59896007

59906008
/**

0 commit comments

Comments
 (0)