@suchipi/quickjs 0.3.0 → 0.4.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/build/aarch64-apple-darwin/bin/file-to-bytecode.js +27 -0
- package/build/aarch64-apple-darwin/bin/qjs +0 -0
- package/build/aarch64-apple-darwin/bin/qjsbootstrap +0 -0
- package/build/aarch64-apple-darwin/bin/qjsbootstrap-bytecode +0 -0
- package/build/aarch64-apple-darwin/bin/qjsc +0 -0
- package/build/aarch64-apple-darwin/bin/quickjs-run +0 -0
- package/build/aarch64-apple-darwin/extras/is-stdin-a-tty +0 -0
- package/build/aarch64-apple-darwin/extras/run-test262 +0 -0
- package/build/aarch64-apple-darwin/extras/sample-program/sum +0 -0
- package/build/aarch64-apple-darwin/extras/stack-limit-test +0 -0
- package/build/aarch64-apple-darwin/lib/quickjs-core.a +0 -0
- package/build/aarch64-apple-darwin/lib/quickjs-full.a +0 -0
- package/build/aarch64-unknown-linux-gnu/bin/file-to-bytecode.js +27 -0
- package/build/aarch64-unknown-linux-gnu/bin/qjs +0 -0
- package/build/aarch64-unknown-linux-gnu/bin/qjsbootstrap +0 -0
- package/build/aarch64-unknown-linux-gnu/bin/qjsbootstrap-bytecode +0 -0
- package/build/aarch64-unknown-linux-gnu/bin/qjsc +0 -0
- package/build/aarch64-unknown-linux-gnu/bin/quickjs-run +0 -0
- package/build/aarch64-unknown-linux-gnu/extras/fib.so +0 -0
- package/build/aarch64-unknown-linux-gnu/extras/is-stdin-a-tty +0 -0
- package/build/aarch64-unknown-linux-gnu/extras/log-argv +0 -0
- package/build/aarch64-unknown-linux-gnu/extras/point.so +0 -0
- package/build/aarch64-unknown-linux-gnu/extras/run-test262 +0 -0
- package/build/aarch64-unknown-linux-gnu/extras/sample-program/sum +0 -0
- package/build/aarch64-unknown-linux-gnu/extras/stack-limit-test +0 -0
- package/build/aarch64-unknown-linux-gnu/lib/quickjs-core.a +0 -0
- package/build/aarch64-unknown-linux-gnu/lib/quickjs-full.a +0 -0
- package/build/aarch64-unknown-linux-musl/bin/file-to-bytecode.js +27 -0
- package/build/aarch64-unknown-linux-musl/bin/qjs +0 -0
- package/build/aarch64-unknown-linux-musl/bin/qjsbootstrap +0 -0
- package/build/aarch64-unknown-linux-musl/bin/qjsbootstrap-bytecode +0 -0
- package/build/aarch64-unknown-linux-musl/bin/qjsc +0 -0
- package/build/aarch64-unknown-linux-musl/bin/quickjs-run +0 -0
- package/build/aarch64-unknown-linux-musl/extras/is-stdin-a-tty +0 -0
- package/build/aarch64-unknown-linux-musl/extras/run-test262 +0 -0
- package/build/aarch64-unknown-linux-musl/extras/sample-program/sum +0 -0
- package/build/aarch64-unknown-linux-musl/extras/stack-limit-test +0 -0
- package/build/aarch64-unknown-linux-musl/lib/quickjs-core.a +0 -0
- package/build/aarch64-unknown-linux-musl/lib/quickjs-full.a +0 -0
- package/build/aarch64-unknown-linux-static/bin/file-to-bytecode.js +27 -0
- package/build/aarch64-unknown-linux-static/bin/qjs +0 -0
- package/build/aarch64-unknown-linux-static/bin/qjsbootstrap +0 -0
- package/build/aarch64-unknown-linux-static/bin/qjsbootstrap-bytecode +0 -0
- package/build/aarch64-unknown-linux-static/bin/qjsc +0 -0
- package/build/aarch64-unknown-linux-static/bin/quickjs-run +0 -0
- package/build/aarch64-unknown-linux-static/extras/is-stdin-a-tty +0 -0
- package/build/aarch64-unknown-linux-static/extras/run-test262 +0 -0
- package/build/aarch64-unknown-linux-static/extras/sample-program/sum +0 -0
- package/build/aarch64-unknown-linux-static/extras/stack-limit-test +0 -0
- package/build/aarch64-unknown-linux-static/lib/quickjs-core.a +0 -0
- package/build/aarch64-unknown-linux-static/lib/quickjs-full.a +0 -0
- package/build/dts/inspect.d.ts +22 -1
- package/build/x86_64-apple-darwin/bin/file-to-bytecode.js +27 -0
- package/build/x86_64-apple-darwin/bin/qjs +0 -0
- package/build/x86_64-apple-darwin/bin/qjsbootstrap +0 -0
- package/build/x86_64-apple-darwin/bin/qjsbootstrap-bytecode +0 -0
- package/build/x86_64-apple-darwin/bin/qjsc +0 -0
- package/build/x86_64-apple-darwin/bin/quickjs-run +0 -0
- package/build/x86_64-apple-darwin/extras/is-stdin-a-tty +0 -0
- package/build/x86_64-apple-darwin/extras/run-test262 +0 -0
- package/build/x86_64-apple-darwin/extras/sample-program/sum +0 -0
- package/build/x86_64-apple-darwin/extras/stack-limit-test +0 -0
- package/build/x86_64-apple-darwin/lib/quickjs-core.a +0 -0
- package/build/x86_64-apple-darwin/lib/quickjs-full.a +0 -0
- package/build/x86_64-pc-windows-static/bin/file-to-bytecode.js +27 -0
- package/build/x86_64-pc-windows-static/bin/qjs.exe +0 -0
- package/build/x86_64-pc-windows-static/bin/qjsbootstrap-bytecode.exe +0 -0
- package/build/x86_64-pc-windows-static/bin/qjsbootstrap.exe +0 -0
- package/build/x86_64-pc-windows-static/bin/qjsc.exe +0 -0
- package/build/x86_64-pc-windows-static/bin/quickjs-run.exe +0 -0
- package/build/x86_64-pc-windows-static/extras/is-stdin-a-tty.exe +0 -0
- package/build/x86_64-pc-windows-static/extras/log-argv.exe +0 -0
- package/build/x86_64-pc-windows-static/extras/run-test262.exe +0 -0
- package/build/x86_64-pc-windows-static/extras/sample-program/sum.exe +0 -0
- package/build/x86_64-pc-windows-static/extras/stack-limit-test.exe +0 -0
- package/build/x86_64-pc-windows-static/lib/quickjs-core.a +0 -0
- package/build/x86_64-pc-windows-static/lib/quickjs-full.a +0 -0
- package/build/x86_64-unknown-linux-gnu/bin/file-to-bytecode.js +27 -0
- package/build/x86_64-unknown-linux-gnu/bin/qjs +0 -0
- package/build/x86_64-unknown-linux-gnu/bin/qjsbootstrap +0 -0
- package/build/x86_64-unknown-linux-gnu/bin/qjsbootstrap-bytecode +0 -0
- package/build/x86_64-unknown-linux-gnu/bin/qjsc +0 -0
- package/build/x86_64-unknown-linux-gnu/bin/quickjs-run +0 -0
- package/build/x86_64-unknown-linux-gnu/extras/fib.so +0 -0
- package/build/x86_64-unknown-linux-gnu/extras/is-stdin-a-tty +0 -0
- package/build/x86_64-unknown-linux-gnu/extras/log-argv +0 -0
- package/build/x86_64-unknown-linux-gnu/extras/point.so +0 -0
- package/build/x86_64-unknown-linux-gnu/extras/run-test262 +0 -0
- package/build/x86_64-unknown-linux-gnu/extras/sample-program/sum +0 -0
- package/build/x86_64-unknown-linux-gnu/extras/stack-limit-test +0 -0
- package/build/x86_64-unknown-linux-gnu/lib/quickjs-core.a +0 -0
- package/build/x86_64-unknown-linux-gnu/lib/quickjs-full.a +0 -0
- package/build/x86_64-unknown-linux-musl/bin/file-to-bytecode.js +27 -0
- package/build/x86_64-unknown-linux-musl/bin/qjs +0 -0
- package/build/x86_64-unknown-linux-musl/bin/qjsbootstrap +0 -0
- package/build/x86_64-unknown-linux-musl/bin/qjsbootstrap-bytecode +0 -0
- package/build/x86_64-unknown-linux-musl/bin/qjsc +0 -0
- package/build/x86_64-unknown-linux-musl/bin/quickjs-run +0 -0
- package/build/x86_64-unknown-linux-musl/extras/is-stdin-a-tty +0 -0
- package/build/x86_64-unknown-linux-musl/extras/run-test262 +0 -0
- package/build/x86_64-unknown-linux-musl/extras/sample-program/sum +0 -0
- package/build/x86_64-unknown-linux-musl/extras/stack-limit-test +0 -0
- package/build/x86_64-unknown-linux-musl/lib/quickjs-core.a +0 -0
- package/build/x86_64-unknown-linux-musl/lib/quickjs-full.a +0 -0
- package/build/x86_64-unknown-linux-static/bin/file-to-bytecode.js +27 -0
- package/build/x86_64-unknown-linux-static/bin/qjs +0 -0
- package/build/x86_64-unknown-linux-static/bin/qjsbootstrap +0 -0
- package/build/x86_64-unknown-linux-static/bin/qjsbootstrap-bytecode +0 -0
- package/build/x86_64-unknown-linux-static/bin/qjsc +0 -0
- package/build/x86_64-unknown-linux-static/bin/quickjs-run +0 -0
- package/build/x86_64-unknown-linux-static/extras/is-stdin-a-tty +0 -0
- package/build/x86_64-unknown-linux-static/extras/run-test262 +0 -0
- package/build/x86_64-unknown-linux-static/extras/sample-program/sum +0 -0
- package/build/x86_64-unknown-linux-static/extras/stack-limit-test +0 -0
- package/build/x86_64-unknown-linux-static/lib/quickjs-core.a +0 -0
- package/build/x86_64-unknown-linux-static/lib/quickjs-full.a +0 -0
- package/npm/cli/qjs.js +1 -1
- package/npm/cli/qjsc.js +1 -1
- package/npm/cli/quickjs-run.js +1 -1
- package/npm/index.js +21 -47
- package/npm/platforms.json +65 -0
- package/npm/{cli/run-binary.js → run-binary.js} +8 -5
- package/package.json +9 -5
- package/tsconfig.json +2 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env quickjs-run
|
|
2
|
+
|
|
3
|
+
// Simple script which reads in a file, converts it to bytecode, and writes out
|
|
4
|
+
// the bytecode to a new file.
|
|
5
|
+
|
|
6
|
+
/// <reference path="../quickjs/quickjs.d.ts" />
|
|
7
|
+
/// <reference path="../quickjs-libc/quickjs-libc.d.ts" />
|
|
8
|
+
/// <reference path="../quickjs-libbytecode/quickjs-libbytecode.d.ts" />
|
|
9
|
+
|
|
10
|
+
import * as std from "quickjs:std";
|
|
11
|
+
import * as Bytecode from "quickjs:bytecode";
|
|
12
|
+
|
|
13
|
+
function main() {
|
|
14
|
+
const [_quickjsRun, _thisScript, inputFile, outputFile] = scriptArgs;
|
|
15
|
+
|
|
16
|
+
if (!(inputFile && outputFile)) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"You must pass two positional arguments to this script: the input file path (js) and the output file path (bytecode binary)."
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const bytecode = Bytecode.fromFile(inputFile);
|
|
23
|
+
const out = std.open(outputFile, "wb");
|
|
24
|
+
out.write(bytecode, 0, bytecode.byteLength);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
main();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env quickjs-run
|
|
2
|
+
|
|
3
|
+
// Simple script which reads in a file, converts it to bytecode, and writes out
|
|
4
|
+
// the bytecode to a new file.
|
|
5
|
+
|
|
6
|
+
/// <reference path="../quickjs/quickjs.d.ts" />
|
|
7
|
+
/// <reference path="../quickjs-libc/quickjs-libc.d.ts" />
|
|
8
|
+
/// <reference path="../quickjs-libbytecode/quickjs-libbytecode.d.ts" />
|
|
9
|
+
|
|
10
|
+
import * as std from "quickjs:std";
|
|
11
|
+
import * as Bytecode from "quickjs:bytecode";
|
|
12
|
+
|
|
13
|
+
function main() {
|
|
14
|
+
const [_quickjsRun, _thisScript, inputFile, outputFile] = scriptArgs;
|
|
15
|
+
|
|
16
|
+
if (!(inputFile && outputFile)) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"You must pass two positional arguments to this script: the input file path (js) and the output file path (bytecode binary)."
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const bytecode = Bytecode.fromFile(inputFile);
|
|
23
|
+
const out = std.open(outputFile, "wb");
|
|
24
|
+
out.write(bytecode, 0, bytecode.byteLength);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
main();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env quickjs-run
|
|
2
|
+
|
|
3
|
+
// Simple script which reads in a file, converts it to bytecode, and writes out
|
|
4
|
+
// the bytecode to a new file.
|
|
5
|
+
|
|
6
|
+
/// <reference path="../quickjs/quickjs.d.ts" />
|
|
7
|
+
/// <reference path="../quickjs-libc/quickjs-libc.d.ts" />
|
|
8
|
+
/// <reference path="../quickjs-libbytecode/quickjs-libbytecode.d.ts" />
|
|
9
|
+
|
|
10
|
+
import * as std from "quickjs:std";
|
|
11
|
+
import * as Bytecode from "quickjs:bytecode";
|
|
12
|
+
|
|
13
|
+
function main() {
|
|
14
|
+
const [_quickjsRun, _thisScript, inputFile, outputFile] = scriptArgs;
|
|
15
|
+
|
|
16
|
+
if (!(inputFile && outputFile)) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"You must pass two positional arguments to this script: the input file path (js) and the output file path (bytecode binary)."
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const bytecode = Bytecode.fromFile(inputFile);
|
|
23
|
+
const out = std.open(outputFile, "wb");
|
|
24
|
+
out.write(bytecode, 0, bytecode.byteLength);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
main();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env quickjs-run
|
|
2
|
+
|
|
3
|
+
// Simple script which reads in a file, converts it to bytecode, and writes out
|
|
4
|
+
// the bytecode to a new file.
|
|
5
|
+
|
|
6
|
+
/// <reference path="../quickjs/quickjs.d.ts" />
|
|
7
|
+
/// <reference path="../quickjs-libc/quickjs-libc.d.ts" />
|
|
8
|
+
/// <reference path="../quickjs-libbytecode/quickjs-libbytecode.d.ts" />
|
|
9
|
+
|
|
10
|
+
import * as std from "quickjs:std";
|
|
11
|
+
import * as Bytecode from "quickjs:bytecode";
|
|
12
|
+
|
|
13
|
+
function main() {
|
|
14
|
+
const [_quickjsRun, _thisScript, inputFile, outputFile] = scriptArgs;
|
|
15
|
+
|
|
16
|
+
if (!(inputFile && outputFile)) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"You must pass two positional arguments to this script: the input file path (js) and the output file path (bytecode binary)."
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const bytecode = Bytecode.fromFile(inputFile);
|
|
23
|
+
const out = std.open(outputFile, "wb");
|
|
24
|
+
out.write(bytecode, 0, bytecode.byteLength);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
main();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/build/dts/inspect.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/** npm: @suchipi/print@2.
|
|
1
|
+
/** npm: @suchipi/print@2.5.0. License: ISC */
|
|
2
|
+
/* (with some QuickJS-specific modifications) */
|
|
2
3
|
|
|
3
4
|
/*
|
|
4
5
|
Copyright (c) 2016-2022, John Gardner
|
|
@@ -110,6 +111,11 @@ declare interface InspectFunction {
|
|
|
110
111
|
* @returns A string representation of `value`.
|
|
111
112
|
*/
|
|
112
113
|
(value: any, key?: string | symbol, options?: InspectOptions): string;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* A symbol which can be used to customize how an object gets printed.
|
|
117
|
+
*/
|
|
118
|
+
custom: symbol;
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
/**
|
|
@@ -121,3 +127,18 @@ declare interface InspectFunction {
|
|
|
121
127
|
* @returns A string representation of `value`.
|
|
122
128
|
*/
|
|
123
129
|
declare var inspect: InspectFunction;
|
|
130
|
+
|
|
131
|
+
declare interface InspectCustomInputs {
|
|
132
|
+
key: string | symbol;
|
|
133
|
+
type: string;
|
|
134
|
+
brackets: [string, string];
|
|
135
|
+
oneLine: boolean;
|
|
136
|
+
linesBefore: Array<string>;
|
|
137
|
+
linesAfter: Array<string>;
|
|
138
|
+
propLines: Array<string>;
|
|
139
|
+
readonly tooDeep: boolean;
|
|
140
|
+
indent: string;
|
|
141
|
+
typeSuffix: string;
|
|
142
|
+
opts: InspectOptions;
|
|
143
|
+
colours: { [Key in keyof Required<InspectColours>]: string };
|
|
144
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env quickjs-run
|
|
2
|
+
|
|
3
|
+
// Simple script which reads in a file, converts it to bytecode, and writes out
|
|
4
|
+
// the bytecode to a new file.
|
|
5
|
+
|
|
6
|
+
/// <reference path="../quickjs/quickjs.d.ts" />
|
|
7
|
+
/// <reference path="../quickjs-libc/quickjs-libc.d.ts" />
|
|
8
|
+
/// <reference path="../quickjs-libbytecode/quickjs-libbytecode.d.ts" />
|
|
9
|
+
|
|
10
|
+
import * as std from "quickjs:std";
|
|
11
|
+
import * as Bytecode from "quickjs:bytecode";
|
|
12
|
+
|
|
13
|
+
function main() {
|
|
14
|
+
const [_quickjsRun, _thisScript, inputFile, outputFile] = scriptArgs;
|
|
15
|
+
|
|
16
|
+
if (!(inputFile && outputFile)) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"You must pass two positional arguments to this script: the input file path (js) and the output file path (bytecode binary)."
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const bytecode = Bytecode.fromFile(inputFile);
|
|
23
|
+
const out = std.open(outputFile, "wb");
|
|
24
|
+
out.write(bytecode, 0, bytecode.byteLength);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
main();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env quickjs-run
|
|
2
|
+
|
|
3
|
+
// Simple script which reads in a file, converts it to bytecode, and writes out
|
|
4
|
+
// the bytecode to a new file.
|
|
5
|
+
|
|
6
|
+
/// <reference path="../quickjs/quickjs.d.ts" />
|
|
7
|
+
/// <reference path="../quickjs-libc/quickjs-libc.d.ts" />
|
|
8
|
+
/// <reference path="../quickjs-libbytecode/quickjs-libbytecode.d.ts" />
|
|
9
|
+
|
|
10
|
+
import * as std from "quickjs:std";
|
|
11
|
+
import * as Bytecode from "quickjs:bytecode";
|
|
12
|
+
|
|
13
|
+
function main() {
|
|
14
|
+
const [_quickjsRun, _thisScript, inputFile, outputFile] = scriptArgs;
|
|
15
|
+
|
|
16
|
+
if (!(inputFile && outputFile)) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"You must pass two positional arguments to this script: the input file path (js) and the output file path (bytecode binary)."
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const bytecode = Bytecode.fromFile(inputFile);
|
|
23
|
+
const out = std.open(outputFile, "wb");
|
|
24
|
+
out.write(bytecode, 0, bytecode.byteLength);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
main();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env quickjs-run
|
|
2
|
+
|
|
3
|
+
// Simple script which reads in a file, converts it to bytecode, and writes out
|
|
4
|
+
// the bytecode to a new file.
|
|
5
|
+
|
|
6
|
+
/// <reference path="../quickjs/quickjs.d.ts" />
|
|
7
|
+
/// <reference path="../quickjs-libc/quickjs-libc.d.ts" />
|
|
8
|
+
/// <reference path="../quickjs-libbytecode/quickjs-libbytecode.d.ts" />
|
|
9
|
+
|
|
10
|
+
import * as std from "quickjs:std";
|
|
11
|
+
import * as Bytecode from "quickjs:bytecode";
|
|
12
|
+
|
|
13
|
+
function main() {
|
|
14
|
+
const [_quickjsRun, _thisScript, inputFile, outputFile] = scriptArgs;
|
|
15
|
+
|
|
16
|
+
if (!(inputFile && outputFile)) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"You must pass two positional arguments to this script: the input file path (js) and the output file path (bytecode binary)."
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const bytecode = Bytecode.fromFile(inputFile);
|
|
23
|
+
const out = std.open(outputFile, "wb");
|
|
24
|
+
out.write(bytecode, 0, bytecode.byteLength);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
main();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env quickjs-run
|
|
2
|
+
|
|
3
|
+
// Simple script which reads in a file, converts it to bytecode, and writes out
|
|
4
|
+
// the bytecode to a new file.
|
|
5
|
+
|
|
6
|
+
/// <reference path="../quickjs/quickjs.d.ts" />
|
|
7
|
+
/// <reference path="../quickjs-libc/quickjs-libc.d.ts" />
|
|
8
|
+
/// <reference path="../quickjs-libbytecode/quickjs-libbytecode.d.ts" />
|
|
9
|
+
|
|
10
|
+
import * as std from "quickjs:std";
|
|
11
|
+
import * as Bytecode from "quickjs:bytecode";
|
|
12
|
+
|
|
13
|
+
function main() {
|
|
14
|
+
const [_quickjsRun, _thisScript, inputFile, outputFile] = scriptArgs;
|
|
15
|
+
|
|
16
|
+
if (!(inputFile && outputFile)) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"You must pass two positional arguments to this script: the input file path (js) and the output file path (bytecode binary)."
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const bytecode = Bytecode.fromFile(inputFile);
|
|
23
|
+
const out = std.open(outputFile, "wb");
|
|
24
|
+
out.write(bytecode, 0, bytecode.byteLength);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
main();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env quickjs-run
|
|
2
|
+
|
|
3
|
+
// Simple script which reads in a file, converts it to bytecode, and writes out
|
|
4
|
+
// the bytecode to a new file.
|
|
5
|
+
|
|
6
|
+
/// <reference path="../quickjs/quickjs.d.ts" />
|
|
7
|
+
/// <reference path="../quickjs-libc/quickjs-libc.d.ts" />
|
|
8
|
+
/// <reference path="../quickjs-libbytecode/quickjs-libbytecode.d.ts" />
|
|
9
|
+
|
|
10
|
+
import * as std from "quickjs:std";
|
|
11
|
+
import * as Bytecode from "quickjs:bytecode";
|
|
12
|
+
|
|
13
|
+
function main() {
|
|
14
|
+
const [_quickjsRun, _thisScript, inputFile, outputFile] = scriptArgs;
|
|
15
|
+
|
|
16
|
+
if (!(inputFile && outputFile)) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"You must pass two positional arguments to this script: the input file path (js) and the output file path (bytecode binary)."
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const bytecode = Bytecode.fromFile(inputFile);
|
|
23
|
+
const out = std.open(outputFile, "wb");
|
|
24
|
+
out.write(bytecode, 0, bytecode.byteLength);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
main();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/npm/cli/qjs.js
CHANGED
package/npm/cli/qjsc.js
CHANGED
package/npm/cli/quickjs-run.js
CHANGED
package/npm/index.js
CHANGED
|
@@ -1,54 +1,28 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
1
2
|
const path = require("path");
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
function buildArtifactsLocation() {
|
|
4
5
|
return path.resolve(__dirname, "..", "build");
|
|
5
|
-
}
|
|
6
|
+
}
|
|
7
|
+
exports.buildArtifactsLocation = buildArtifactsLocation;
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
switch (platform) {
|
|
10
|
-
case "darwin":
|
|
11
|
-
case "linux":
|
|
12
|
-
case "win32": {
|
|
13
|
-
break;
|
|
14
|
-
}
|
|
15
|
-
default: {
|
|
16
|
-
throw new Error(`Unsupported platform: ${platform}`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
9
|
+
const platforms = require("./platforms.json");
|
|
10
|
+
exports.platforms = platforms;
|
|
19
11
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
arch
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
case "x64": {
|
|
28
|
-
arch = "x86_64";
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
default: {
|
|
32
|
-
throw new Error(`Unsupported processor architecture: ${arch}`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
12
|
+
function identifyCurrentPlatform() {
|
|
13
|
+
const matchingPlatform = platforms.find((platform) => {
|
|
14
|
+
return (
|
|
15
|
+
platform.os === process.platform &&
|
|
16
|
+
platform.architectures.includes(process.arch)
|
|
17
|
+
);
|
|
18
|
+
});
|
|
35
19
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
throw new Error(`Architecture is not supported on Windows: ${arch}`);
|
|
43
|
-
}
|
|
44
|
-
return `${arch}-pc-windows-static`;
|
|
45
|
-
}
|
|
46
|
-
case "linux": {
|
|
47
|
-
return `${arch}-unknown-linux-static`;
|
|
48
|
-
}
|
|
49
|
-
default: {
|
|
50
|
-
// should be unreachable
|
|
51
|
-
throw new Error(`Unsupported platform: ${platform}`);
|
|
52
|
-
}
|
|
20
|
+
if (matchingPlatform) {
|
|
21
|
+
return matchingPlatform;
|
|
22
|
+
} else {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`Unsupported platform: ${process.platform}/${process.arch}`
|
|
25
|
+
);
|
|
53
26
|
}
|
|
54
|
-
}
|
|
27
|
+
}
|
|
28
|
+
exports.identifyCurrentPlatform = identifyCurrentPlatform;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "aarch64-apple-darwin",
|
|
4
|
+
"architectures": ["aarch64", "arm64"],
|
|
5
|
+
"os": "darwin",
|
|
6
|
+
"abi": "",
|
|
7
|
+
"programSuffix": ""
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"name": "aarch64-unknown-linux-gnu",
|
|
11
|
+
"architectures": ["aarch64", "arm64"],
|
|
12
|
+
"os": "linux",
|
|
13
|
+
"abi": "gnu",
|
|
14
|
+
"programSuffix": ""
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "aarch64-unknown-linux-musl",
|
|
18
|
+
"architectures": ["aarch64", "arm64"],
|
|
19
|
+
"os": "linux",
|
|
20
|
+
"abi": "musl",
|
|
21
|
+
"programSuffix": ""
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "aarch64-unknown-linux-static",
|
|
25
|
+
"architectures": ["aarch64", "arm64"],
|
|
26
|
+
"os": "linux",
|
|
27
|
+
"abi": "static",
|
|
28
|
+
"programSuffix": ""
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "x86_64-apple-darwin",
|
|
32
|
+
"architectures": ["x86_64", "amd64", "x64"],
|
|
33
|
+
"os": "darwin",
|
|
34
|
+
"abi": "",
|
|
35
|
+
"programSuffix": ""
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "x86_64-pc-windows-static",
|
|
39
|
+
"architectures": ["x86_64", "amd64", "x64"],
|
|
40
|
+
"os": "windows",
|
|
41
|
+
"abi": "",
|
|
42
|
+
"programSuffix": ".exe"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "x86_64-unknown-linux-gnu",
|
|
46
|
+
"architectures": ["x86_64", "amd64", "x64"],
|
|
47
|
+
"os": "linux",
|
|
48
|
+
"abi": "gnu",
|
|
49
|
+
"programSuffix": ""
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "x86_64-unknown-linux-musl",
|
|
53
|
+
"architectures": ["x86_64", "amd64", "x64"],
|
|
54
|
+
"os": "linux",
|
|
55
|
+
"abi": "musl",
|
|
56
|
+
"programSuffix": ""
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "x86_64-unknown-linux-static",
|
|
60
|
+
"architectures": ["x86_64", "amd64", "x64"],
|
|
61
|
+
"os": "linux",
|
|
62
|
+
"abi": "static",
|
|
63
|
+
"programSuffix": ""
|
|
64
|
+
}
|
|
65
|
+
]
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const child_process = require("child_process");
|
|
4
|
-
const { identifyCurrentPlatform } = require("
|
|
4
|
+
const { identifyCurrentPlatform, buildArtifactsLocation } = require(".");
|
|
5
5
|
|
|
6
6
|
module.exports = function runBinary(name) {
|
|
7
|
+
const buildDir = buildArtifactsLocation();
|
|
7
8
|
const platform = identifyCurrentPlatform();
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const bin = path.resolve(
|
|
11
|
+
buildDir,
|
|
12
|
+
platform.name,
|
|
13
|
+
"bin",
|
|
14
|
+
name + platform.programSuffix
|
|
15
|
+
);
|
|
13
16
|
|
|
14
17
|
const argv = process.argv.slice(2);
|
|
15
18
|
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suchipi/quickjs",
|
|
3
3
|
"description": "Suchipi's QuickJS Fork",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"main": "./npm/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"qjs": "
|
|
8
|
-
"qjsc": "
|
|
9
|
-
"quickjs-run": "
|
|
7
|
+
"qjs": "npm/cli/qjs.js",
|
|
8
|
+
"qjsc": "npm/cli/qjsc.js",
|
|
9
|
+
"quickjs-run": "npm/cli/quickjs-run.js"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@babel/core": "^7.20.5",
|
|
13
13
|
"@babel/preset-env": "^7.20.2",
|
|
14
14
|
"@babel/preset-typescript": "^7.18.6",
|
|
15
|
+
"@suchipi/print": "^2.5.0",
|
|
15
16
|
"@suchipi/shinobi": "^0.2.0",
|
|
16
17
|
"@types/jest": "^29.2.4",
|
|
17
18
|
"@types/node": "^18.11.9",
|
|
@@ -28,7 +29,10 @@
|
|
|
28
29
|
},
|
|
29
30
|
"prettier": {},
|
|
30
31
|
"license": "MIT",
|
|
31
|
-
"repository":
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/suchipi/quickjs.git"
|
|
35
|
+
},
|
|
32
36
|
"publishConfig": {
|
|
33
37
|
"access": "public"
|
|
34
38
|
}
|