warpo 2.3.0 → 2.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/asconfig.schema.json +25 -3
- package/create/index.ts +4 -1
- package/package.json +1 -1
- package/tsconfig-warpo.json +2 -3
- package/{assemblyscript/std/assembly → types/std}/index.d.ts +18 -79
- package/types/std/package.json +3 -0
- package/types/std/tsconfig.json +4 -0
- package/types/tsconfig-base.json +15 -0
- package/types/tsconfig-std.json +13 -0
- package/types/warpo/index.d.ts +1 -1
- package/types/wasi_snapshot_preview1/index.d.ts +52 -0
- package/types/wasi_snapshot_preview1/package.json +3 -0
- package/types/wasi_snapshot_preview1/tsconfig.json +4 -0
package/asconfig.schema.json
CHANGED
|
@@ -58,6 +58,11 @@
|
|
|
58
58
|
"description": "Type of runtime to use, either 'incremental' or 'radical'.",
|
|
59
59
|
"enum": ["incremental", "radical"]
|
|
60
60
|
},
|
|
61
|
+
"host": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"description": "Host API selection for imports.",
|
|
64
|
+
"enum": ["none", "wasi_snapshot_preview1"]
|
|
65
|
+
},
|
|
61
66
|
"stats": {
|
|
62
67
|
"type": "boolean",
|
|
63
68
|
"description": "Whether to output compilation statistics."
|
|
@@ -96,15 +101,32 @@
|
|
|
96
101
|
"maximum": 2
|
|
97
102
|
},
|
|
98
103
|
"use": {
|
|
104
|
+
"$ref": "#/$defs/UseSchema"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"additionalProperties": false
|
|
108
|
+
},
|
|
109
|
+
"UseSchema": {
|
|
110
|
+
"description": "AssemblyScript --use options. Either an object map (name -> value) or an array of strings in A=B form.",
|
|
111
|
+
"oneOf": [
|
|
112
|
+
{
|
|
99
113
|
"type": "object",
|
|
100
|
-
"description": "
|
|
114
|
+
"description": "Map form: { \"NAME\": \"VALUE\" }",
|
|
101
115
|
"additionalProperties": {
|
|
102
116
|
"type": "string",
|
|
103
117
|
"description": "Value for the use option."
|
|
104
118
|
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"type": "array",
|
|
122
|
+
"description": "Array form: [\"NAME=VALUE\", ...] (same format as CLI --use)",
|
|
123
|
+
"items": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"description": "A single use entry in NAME=VALUE form.",
|
|
126
|
+
"pattern": "^\\s*[^=\\s]+\\s*=.*$"
|
|
127
|
+
}
|
|
105
128
|
}
|
|
106
|
-
|
|
107
|
-
"additionalProperties": false
|
|
129
|
+
]
|
|
108
130
|
}
|
|
109
131
|
}
|
|
110
132
|
}
|
package/create/index.ts
CHANGED
package/package.json
CHANGED
package/tsconfig-warpo.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "./
|
|
2
|
+
"extends": "./types/tsconfig-base.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"target": "esnext",
|
|
5
5
|
"module": "commonjs",
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
"allowJs": false,
|
|
9
9
|
"typeRoots": ["types"],
|
|
10
10
|
"types": ["warpo"],
|
|
11
|
-
"baseUrl": "."
|
|
12
|
-
"paths": { "*": ["./assembly/*"] }
|
|
11
|
+
"baseUrl": "."
|
|
13
12
|
}
|
|
14
13
|
}
|
|
@@ -82,10 +82,12 @@ declare type stringview_iter = ref_stringview_iter | null;
|
|
|
82
82
|
|
|
83
83
|
// Compiler hints
|
|
84
84
|
|
|
85
|
-
/** Compiler target. 0 = JS, 1 = WASM32
|
|
85
|
+
/** Compiler target. 0 = JS, 1 = WASM32. */
|
|
86
86
|
declare const ASC_TARGET: i32;
|
|
87
87
|
/** Runtime type. 0 = Stub, 1 = Radical, 2 = Incremental. */
|
|
88
88
|
declare const ASC_RUNTIME: i32;
|
|
89
|
+
/** Host selection. 0 = None, 1 = WASI Snapshot Preview 1. */
|
|
90
|
+
declare const ASC_HOST: i32;
|
|
89
91
|
/** Provided noAssert option. */
|
|
90
92
|
declare const ASC_NO_ASSERT: bool;
|
|
91
93
|
/** Provided memoryBase option. */
|
|
@@ -612,8 +614,8 @@ declare namespace i64 {
|
|
|
612
614
|
}
|
|
613
615
|
}
|
|
614
616
|
}
|
|
615
|
-
/** Converts any other numeric value to a 32-bit
|
|
616
|
-
declare let isize: typeof i32
|
|
617
|
+
/** Converts any other numeric value to a 32-bit signed integer. */
|
|
618
|
+
declare let isize: typeof i32;
|
|
617
619
|
/** Converts any other numeric value to an 8-bit unsigned integer. */
|
|
618
620
|
declare function u8(value: any): u8;
|
|
619
621
|
declare namespace u8 {
|
|
@@ -654,8 +656,8 @@ declare namespace u64 {
|
|
|
654
656
|
/** Parses a string as an u64. */
|
|
655
657
|
export function parse(value: string, radix?: i32): u64;
|
|
656
658
|
}
|
|
657
|
-
/** Converts any other numeric value to a 32-bit
|
|
658
|
-
declare let usize: typeof u32
|
|
659
|
+
/** Converts any other numeric value to a 32-bit unsigned integer. */
|
|
660
|
+
declare let usize: typeof u32;
|
|
659
661
|
/** Converts any other numeric value to a 1-bit unsigned integer. */
|
|
660
662
|
declare function bool(value: any): bool;
|
|
661
663
|
declare namespace bool {
|
|
@@ -2025,7 +2027,7 @@ interface ArrayBufferView {
|
|
|
2025
2027
|
}
|
|
2026
2028
|
|
|
2027
2029
|
/** @internal */
|
|
2028
|
-
declare abstract class TypedArray<T> implements ArrayBufferView {
|
|
2030
|
+
declare abstract class TypedArray<T> implements ArrayBufferView, Iterable<T> {
|
|
2029
2031
|
[key: number]: T;
|
|
2030
2032
|
/** Number of bytes per element. */
|
|
2031
2033
|
static readonly BYTES_PER_ELEMENT: usize;
|
|
@@ -2085,6 +2087,9 @@ declare abstract class TypedArray<T> implements ArrayBufferView {
|
|
|
2085
2087
|
set<U extends ArrayLike<number>>(source: U, offset?: i32): void;
|
|
2086
2088
|
/** The toString() method returns a string representing the specified array and its elements. This method has the same algorithm as Array.prototype.toString() */
|
|
2087
2089
|
toString(): string;
|
|
2090
|
+
|
|
2091
|
+
/** Returns an iterator over the typed array's values. */
|
|
2092
|
+
[Symbol.iterator](): Iterator<T>;
|
|
2088
2093
|
}
|
|
2089
2094
|
|
|
2090
2095
|
/** An array of twos-complement 8-bit signed integers. */
|
|
@@ -2234,7 +2239,7 @@ declare class StaticArray<T> {
|
|
|
2234
2239
|
}
|
|
2235
2240
|
|
|
2236
2241
|
/** Class representing a sequence of characters. */
|
|
2237
|
-
declare class String {
|
|
2242
|
+
declare class String implements Iterable<string> {
|
|
2238
2243
|
[key: i32]: string;
|
|
2239
2244
|
static fromCharCode(ls: i32, hs?: i32): string;
|
|
2240
2245
|
static fromCharCodes(arr: i32[]): string;
|
|
@@ -2242,6 +2247,7 @@ declare class String {
|
|
|
2242
2247
|
static fromCodePoints(arr: i32[]): string;
|
|
2243
2248
|
static raw(parts: TemplateStringsArray, ...args: any[]): string;
|
|
2244
2249
|
readonly length: i32;
|
|
2250
|
+
[Symbol.iterator](): Iterator<string>;
|
|
2245
2251
|
at(index: i32): string;
|
|
2246
2252
|
charAt(index: i32): string;
|
|
2247
2253
|
charCodeAt(index: i32): i32;
|
|
@@ -2319,16 +2325,9 @@ declare class Object {
|
|
|
2319
2325
|
static is<T>(value1: T, value2: T): bool;
|
|
2320
2326
|
}
|
|
2321
2327
|
|
|
2322
|
-
declare namespace performance {
|
|
2323
|
-
/** Gets a high resolution timestamp measured in milliseconds. */
|
|
2324
|
-
export function now(): f64;
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
2328
|
declare class Date {
|
|
2328
2329
|
/** Returns the UTC timestamp in milliseconds of the specified date. */
|
|
2329
|
-
static UTC(year: i32, month
|
|
2330
|
-
/** Returns the current UTC timestamp in milliseconds. */
|
|
2331
|
-
static now(): i64;
|
|
2330
|
+
static UTC(year: i32, month?: i32, day?: i32, hour?: i32, minute?: i32, second?: i32, millisecond?: i32): i64;
|
|
2332
2331
|
/** Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC. */
|
|
2333
2332
|
static parse(dateString: string): Date;
|
|
2334
2333
|
static fromString(dateString: string): Date;
|
|
@@ -2511,6 +2510,7 @@ declare class Map<K, V> {
|
|
|
2511
2510
|
keys(): K[]; // preliminary
|
|
2512
2511
|
values(): V[]; // preliminary
|
|
2513
2512
|
toString(): string;
|
|
2513
|
+
[Symbol.iterator](): Iterator<[K, V]>;
|
|
2514
2514
|
}
|
|
2515
2515
|
|
|
2516
2516
|
declare class Set<K> {
|
|
@@ -2665,15 +2665,13 @@ interface INativeMath<T> extends IMath<T> {
|
|
|
2665
2665
|
exp2(x: T): T;
|
|
2666
2666
|
}
|
|
2667
2667
|
|
|
2668
|
-
/** Double precision math imported from JavaScript. */
|
|
2669
|
-
declare const JSMath: IMath<f64>;
|
|
2670
2668
|
/** Double precision math implemented natively. */
|
|
2671
2669
|
declare const NativeMath: INativeMath<f64>;
|
|
2672
2670
|
/** Single precision math implemented natively. */
|
|
2673
2671
|
declare const NativeMathf: INativeMath<f32>;
|
|
2674
|
-
/** Alias of {@link NativeMath}
|
|
2672
|
+
/** Alias of {@link NativeMath}. */
|
|
2675
2673
|
declare const Math: IMath<f64>;
|
|
2676
|
-
/** Alias of {@link NativeMathf}
|
|
2674
|
+
/** Alias of {@link NativeMathf}. */
|
|
2677
2675
|
declare const Mathf: IMath<f32>;
|
|
2678
2676
|
|
|
2679
2677
|
/** Environmental abort function. */
|
|
@@ -2685,69 +2683,10 @@ declare function seed(): f64;
|
|
|
2685
2683
|
|
|
2686
2684
|
/** Node-like process. */
|
|
2687
2685
|
declare namespace process {
|
|
2688
|
-
/** String representing the CPU architecture for which the binary was compiled.
|
|
2686
|
+
/** String representing the CPU architecture for which the binary was compiled. Always `wasm32`. */
|
|
2689
2687
|
export const arch: string;
|
|
2690
2688
|
/** String representing the operating system platform for which the binary was compiled. Always `wasm`. */
|
|
2691
2689
|
export const platform: string;
|
|
2692
|
-
/** Array of command line arguments passed to the binary upon instantiation. */
|
|
2693
|
-
export const argv: string[];
|
|
2694
|
-
/** Map of variables in the binary's user environment. */
|
|
2695
|
-
export const env: Map<string, string>;
|
|
2696
|
-
/** Terminates the process with either the given exit code, or `process.exitCode` if omitted. */
|
|
2697
|
-
export function exit(code?: i32): void;
|
|
2698
|
-
/** `exit()`’s default value. Defaults to `0`. */
|
|
2699
|
-
export let exitCode: i32;
|
|
2700
|
-
/** Stream connected to `stdin` (fd `0`). */
|
|
2701
|
-
export const stdin: ReadableStream;
|
|
2702
|
-
/** Stream connected to `stdout` (fd `1`). */
|
|
2703
|
-
export const stdout: WritableStream;
|
|
2704
|
-
/** Stream connected to `stderr` (fd `2`). */
|
|
2705
|
-
export const stderr: WritableStream;
|
|
2706
|
-
/** Obtains the system's current time of day, in milliseconds since Unix epoch. */
|
|
2707
|
-
export function time(): i64;
|
|
2708
|
-
/** Obtains the system's monotonic high resolution time, in nanoseconds since an arbitrary time in the past. */
|
|
2709
|
-
export function hrtime(): u64;
|
|
2710
|
-
|
|
2711
|
-
interface Stream {
|
|
2712
|
-
/** Closes the stream. Throws if already closed or if the stream cannot be closed. */
|
|
2713
|
-
close(): void;
|
|
2714
|
-
}
|
|
2715
|
-
interface ReadableStream extends Stream {
|
|
2716
|
-
/** Reads available data from the stream, into `buffer` at offset `offset`, returning the number of bytes read. */
|
|
2717
|
-
read(buffer: ArrayBuffer, offset?: isize): i32;
|
|
2718
|
-
}
|
|
2719
|
-
interface WritableStream extends Stream {
|
|
2720
|
-
/** Writes string or buffer to the stream. */
|
|
2721
|
-
write<T extends string | ArrayBuffer>(data: T): void;
|
|
2722
|
-
}
|
|
2723
|
-
}
|
|
2724
|
-
|
|
2725
|
-
/** Browser-like console. */
|
|
2726
|
-
declare namespace console {
|
|
2727
|
-
/** Logs `message` to console if `assertion` is false-ish. */
|
|
2728
|
-
export function assert<T>(assertion: T, message?: string): void;
|
|
2729
|
-
/** Outputs `message` to the console. */
|
|
2730
|
-
export function log(message?: string): void;
|
|
2731
|
-
/** Outputs `message` to the console, prefixed with "Debug:". */
|
|
2732
|
-
export function debug(message?: string): void;
|
|
2733
|
-
/** Outputs `message` to the console, prefixed with "Info:". */
|
|
2734
|
-
export function info(message?: string): void;
|
|
2735
|
-
/** Outputs `message` to the console, prefixed with "Warning:". */
|
|
2736
|
-
export function warn(message?: string): void;
|
|
2737
|
-
/** Outputs `message` to the console, prefixed with "Error:". */
|
|
2738
|
-
export function error(message?: string): void;
|
|
2739
|
-
/** Starts a new timer using the specified `label`. */
|
|
2740
|
-
export function time(label?: string): void;
|
|
2741
|
-
/** Logs the current value of a timer previously started with `console.time`. */
|
|
2742
|
-
export function timeLog(label?: string): void;
|
|
2743
|
-
/** Logs the current value of a timer previously started with `console.time` and discards the timer. */
|
|
2744
|
-
export function timeEnd(label?: string): void;
|
|
2745
|
-
}
|
|
2746
|
-
|
|
2747
|
-
/** Browser-like crypto utilities. */
|
|
2748
|
-
declare namespace crypto {
|
|
2749
|
-
/** Fills `array` with cryptographically strong random values. */
|
|
2750
|
-
export function getRandomValues(array: Uint8Array): void;
|
|
2751
2690
|
}
|
|
2752
2691
|
|
|
2753
2692
|
// Decorators
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"allowJs": false,
|
|
5
|
+
"alwaysStrict": true,
|
|
6
|
+
"noImplicitAny": true,
|
|
7
|
+
"noImplicitReturns": true,
|
|
8
|
+
"noImplicitThis": true,
|
|
9
|
+
"noEmitOnError": true,
|
|
10
|
+
"strictNullChecks": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"preserveConstEnums": false,
|
|
13
|
+
"downlevelIteration": true
|
|
14
|
+
}
|
|
15
|
+
}
|
package/types/warpo/index.d.ts
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference path="../warpo/index.d.ts" />
|
|
2
|
+
|
|
3
|
+
declare namespace console {
|
|
4
|
+
function assert<T>(condition: T, message?: string): void;
|
|
5
|
+
function log(message?: string): void;
|
|
6
|
+
function debug(message?: string): void;
|
|
7
|
+
function info(message?: string): void;
|
|
8
|
+
function warn(message?: string): void;
|
|
9
|
+
function error(message?: string): void;
|
|
10
|
+
function time(label?: string): void;
|
|
11
|
+
function timeLog(label?: string): void;
|
|
12
|
+
function timeEnd(label?: string): void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare namespace crypto {
|
|
16
|
+
function getRandomValues(array: Uint8Array): void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare namespace Date {
|
|
20
|
+
function now(): i64;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare namespace performance {
|
|
24
|
+
function now(): f64;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare namespace process {
|
|
28
|
+
const argv: string[];
|
|
29
|
+
const env: Map<string, string>;
|
|
30
|
+
let exitCode: i32;
|
|
31
|
+
|
|
32
|
+
function exit(code?: i32): void;
|
|
33
|
+
|
|
34
|
+
const stdin: ReadableStream;
|
|
35
|
+
const stdout: WritableStream;
|
|
36
|
+
const stderr: WritableStream;
|
|
37
|
+
|
|
38
|
+
function time(): i64;
|
|
39
|
+
function hrtime(): u64;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare abstract class Stream {
|
|
43
|
+
close(): void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare abstract class WritableStream extends Stream {
|
|
47
|
+
write<T>(data: T): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare abstract class ReadableStream extends Stream {
|
|
51
|
+
read(buffer: ArrayBuffer, offset?: isize): i32;
|
|
52
|
+
}
|