toiljs 0.0.74 → 0.0.76
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 +19 -0
- package/TYPESCRIPT_LAW.md +1 -3
- package/build/client/.tsbuildinfo +1 -1
- package/build/client/components/Image.js +11 -14
- package/build/compiler/.tsbuildinfo +1 -1
- package/build/compiler/generate.js +9 -0
- package/build/compiler/template-build.d.ts +4 -0
- package/build/compiler/template-build.js +11 -1
- package/build/devserver/.tsbuildinfo +1 -1
- package/build/devserver/runtime/module.js +2 -0
- package/build/devserver/stream/index.d.ts +2 -1
- package/build/devserver/stream/index.js +3 -11
- package/build/devserver/stream/manager.d.ts +2 -0
- package/build/devserver/stream/manager.js +7 -6
- package/build/devserver/stream/ws.js +4 -0
- package/package.json +2 -9
- package/src/client/components/Image.tsx +18 -13
- package/src/compiler/generate.ts +16 -0
- package/src/compiler/template-build.ts +32 -1
- package/src/devserver/runtime/module.ts +3 -0
- package/src/devserver/stream/index.ts +8 -19
- package/src/devserver/stream/manager.ts +15 -11
- package/src/devserver/stream/ws.ts +2 -0
- package/test/assembly/aspect-shim.ts +33 -0
- package/test/assembly/cookie.spec.ts +1 -0
- package/test/assembly/example.spec.ts +1 -0
- package/test/assembly/ssr.spec.ts +1 -0
- package/test/assembly.test.ts +59 -0
- package/test/dom/Image.test.tsx +25 -2
- package/test/fixtures/stream-gate.ts +19 -15
- package/test/ssr-template.test.tsx +54 -0
- package/test/stream-emulation.test.ts +56 -10
- package/vitest.config.ts +2 -1
- package/as-pect.asconfig.json +0 -34
- package/as-pect.config.js +0 -71
package/vitest.config.ts
CHANGED
|
@@ -10,7 +10,8 @@ export default defineConfig({
|
|
|
10
10
|
// docs.ts) before the suite, so a fresh checkout can test without a build.
|
|
11
11
|
globalSetup: ['./test/global-setup.ts'],
|
|
12
12
|
include: ['test/**/*.test.ts', 'test/**/*.test.tsx', 'test/**/*.spec.ts'],
|
|
13
|
-
// test/assembly
|
|
13
|
+
// test/assembly/*.spec.ts are AssemblyScript specs, compiled + run via toilscript by
|
|
14
|
+
// test/assembly.test.ts (not executed by vitest directly).
|
|
14
15
|
exclude: [...configDefaults.exclude, 'test/assembly/**'],
|
|
15
16
|
coverage: {
|
|
16
17
|
provider: 'v8',
|
package/as-pect.asconfig.json
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"targets": {
|
|
3
|
-
"coverage": {
|
|
4
|
-
"lib": [
|
|
5
|
-
"./node_modules/@btc-vision/as-covers-assembly/index.ts"
|
|
6
|
-
],
|
|
7
|
-
"transform": [
|
|
8
|
-
"@btc-vision/as-covers-transform",
|
|
9
|
-
"@btc-vision/as-pect-transform"
|
|
10
|
-
]
|
|
11
|
-
},
|
|
12
|
-
"noCoverage": {
|
|
13
|
-
"transform": [
|
|
14
|
-
"@btc-vision/as-pect-transform"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"options": {
|
|
19
|
-
"outFile": "output.wasm",
|
|
20
|
-
"textFile": "output.wat",
|
|
21
|
-
"debug": true,
|
|
22
|
-
"bindings": "raw",
|
|
23
|
-
"exportStart": "_start",
|
|
24
|
-
"exportMemory": true,
|
|
25
|
-
"exportRuntime": true,
|
|
26
|
-
"exportTable": true,
|
|
27
|
-
"use": [
|
|
28
|
-
"RTRACE=1"
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
"entries": [
|
|
32
|
-
"./node_modules/@btc-vision/as-pect-assembly/assembly/index.ts"
|
|
33
|
-
]
|
|
34
|
-
}
|
package/as-pect.config.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
function __liftString(pointer, memory) {
|
|
2
|
-
if (!pointer) return null;
|
|
3
|
-
const end = (pointer + new Uint32Array(memory.buffer)[(pointer - 4) >>> 2]) >>> 1,
|
|
4
|
-
memoryU16 = new Uint16Array(memory.buffer);
|
|
5
|
-
let start = pointer >>> 1,
|
|
6
|
-
string = '';
|
|
7
|
-
while (end - start > 1024) {
|
|
8
|
-
const a = memoryU16.subarray(start, (start += 1024));
|
|
9
|
-
string += String.fromCharCode(...a);
|
|
10
|
-
}
|
|
11
|
-
return string + String.fromCharCode(...memoryU16.subarray(start, end));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function log(text, memory) {
|
|
15
|
-
text = __liftString(text >>> 0, memory);
|
|
16
|
-
console.log(`CONTRACT LOG: ${text}`);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
/**
|
|
21
|
-
* A set of globs passed to the glob package that qualify typescript files for testing.
|
|
22
|
-
*/
|
|
23
|
-
entries: ['test/assembly/**/*.spec.ts'],
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* A set of globs passed to the glob package that quality files to be added to each test.
|
|
27
|
-
*/
|
|
28
|
-
include: ['test/assembly/**/*.include.ts'],
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* A set of regexp that will disclude source files from testing.
|
|
32
|
-
*/
|
|
33
|
-
disclude: [/node_modules/],
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Add your required toilscript imports here.
|
|
37
|
-
*/
|
|
38
|
-
async instantiate(memory, createImports, instantiate, binary) {
|
|
39
|
-
let memory2;
|
|
40
|
-
const resp = instantiate(
|
|
41
|
-
binary,
|
|
42
|
-
createImports({
|
|
43
|
-
env: {
|
|
44
|
-
memory,
|
|
45
|
-
'console.log': (data) => {
|
|
46
|
-
log(data, memory2);
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
}),
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
const { exports } = await resp;
|
|
53
|
-
memory2 = exports.memory || memory;
|
|
54
|
-
|
|
55
|
-
return resp;
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Enable code coverage. `securecookies.ts` is excluded: it depends on the
|
|
60
|
-
* toilscript crypto std (`crypto` / `data` / `bindings/webcrypto`), which the
|
|
61
|
-
* as-pect compiler does not ship, so it cannot
|
|
62
|
-
* compile here. It is covered end-to-end against the real wasm in
|
|
63
|
-
* `test/devserver.test.ts`.
|
|
64
|
-
*/
|
|
65
|
-
coverage: ['server/**/*.ts', 'server/*.ts', '!server/runtime/http/securecookies.ts'],
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Specify if the binary wasm file should be written to the file system.
|
|
69
|
-
*/
|
|
70
|
-
outputBinary: false,
|
|
71
|
-
};
|