diff --git a/README.md b/README.md index 99ef3b58..20fad1b1 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ compiled to WebAssembly. - Create and manipulate values inside the QuickJS runtime ([more][values]). - Expose host functions to the QuickJS runtime ([more][functions]). - Execute synchronous code that uses asynchronous functions, with [asyncify][asyncify]. -- Supports browsers, NodeJS, Deno, Bun, Cloudflare Workers, QuickJS (QuickJS in QuickJS). +- Supports browsers, NodeJS, Deno, Bun, Cloudflare Workers, QuickJS (via [quickjs-for-quickjs][]). [Github] | [NPM] | [API Documentation][api] | [Variants][core] | [Examples][tests] @@ -44,6 +44,7 @@ main() [values]: #interfacing-with-the-interpreter [asyncify]: #asyncify [functions]: #exposing-apis +[quickjs-for-quickjs]: https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-for-quickjs - [quickjs-emscripten](#quickjs-emscripten) - [Usage](#usage) diff --git a/doc/@jitl/quickjs-asmjs-mjs-release-sync/README.md b/doc/@jitl/quickjs-asmjs-mjs-release-sync/README.md index 79d41fe6..ece9ca34 100644 --- a/doc/@jitl/quickjs-asmjs-mjs-release-sync/README.md +++ b/doc/@jitl/quickjs-asmjs-mjs-release-sync/README.md @@ -80,7 +80,8 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s WASM=0", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s STACK_SIZE=32MB" ] ``` diff --git a/doc/@jitl/quickjs-ng-wasmfile-debug-asyncify/README.md b/doc/@jitl/quickjs-ng-wasmfile-debug-asyncify/README.md index 4623ca4d..1c128bbc 100644 --- a/doc/@jitl/quickjs-ng-wasmfile-debug-asyncify/README.md +++ b/doc/@jitl/quickjs-ng-wasmfile-debug-asyncify/README.md @@ -101,6 +101,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-sourceMapJson.js", "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s 5MB", "-O3" ] ``` diff --git a/doc/@jitl/quickjs-ng-wasmfile-debug-sync/README.md b/doc/@jitl/quickjs-ng-wasmfile-debug-sync/README.md index beeca5e2..dd47a4b7 100644 --- a/doc/@jitl/quickjs-ng-wasmfile-debug-sync/README.md +++ b/doc/@jitl/quickjs-ng-wasmfile-debug-sync/README.md @@ -94,6 +94,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-sourceMapJson.js", "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s 5MB", "-DQTS_SANITIZE_LEAK", "-fsanitize=leak", "-g2" diff --git a/doc/@jitl/quickjs-ng-wasmfile-release-asyncify/README.md b/doc/@jitl/quickjs-ng-wasmfile-release-asyncify/README.md index 1384d2cc..34ca85a1 100644 --- a/doc/@jitl/quickjs-ng-wasmfile-release-asyncify/README.md +++ b/doc/@jitl/quickjs-ng-wasmfile-release-asyncify/README.md @@ -97,7 +97,8 @@ Variant-specific Emscripten build flags: "--closure 1", "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", - "--pre-js $(TEMPLATES)/pre-wasmMemory.js" + "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s 5MB" ] ``` diff --git a/doc/@jitl/quickjs-ng-wasmfile-release-sync/README.md b/doc/@jitl/quickjs-ng-wasmfile-release-sync/README.md index f274ae8f..174b1e5f 100644 --- a/doc/@jitl/quickjs-ng-wasmfile-release-sync/README.md +++ b/doc/@jitl/quickjs-ng-wasmfile-release-sync/README.md @@ -90,7 +90,8 @@ Variant-specific Emscripten build flags: "--closure 1", "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", - "--pre-js $(TEMPLATES)/pre-wasmMemory.js" + "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s 5MB" ] ``` diff --git a/doc/@jitl/quickjs-singlefile-browser-debug-asyncify/README.md b/doc/@jitl/quickjs-singlefile-browser-debug-asyncify/README.md index ebee4f29..c5970af0 100644 --- a/doc/@jitl/quickjs-singlefile-browser-debug-asyncify/README.md +++ b/doc/@jitl/quickjs-singlefile-browser-debug-asyncify/README.md @@ -90,6 +90,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s SINGLE_FILE=1", + "-s 5MB", "-O3" ] ``` diff --git a/doc/@jitl/quickjs-singlefile-browser-debug-sync/README.md b/doc/@jitl/quickjs-singlefile-browser-debug-sync/README.md index 01563189..e589e840 100644 --- a/doc/@jitl/quickjs-singlefile-browser-debug-sync/README.md +++ b/doc/@jitl/quickjs-singlefile-browser-debug-sync/README.md @@ -83,6 +83,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s SINGLE_FILE=1", + "-s 5MB", "-DQTS_SANITIZE_LEAK", "-fsanitize=leak", "-g2" diff --git a/doc/@jitl/quickjs-singlefile-browser-release-asyncify/README.md b/doc/@jitl/quickjs-singlefile-browser-release-asyncify/README.md index 36cd5931..232af59d 100644 --- a/doc/@jitl/quickjs-singlefile-browser-release-asyncify/README.md +++ b/doc/@jitl/quickjs-singlefile-browser-release-asyncify/README.md @@ -86,7 +86,8 @@ Variant-specific Emscripten build flags: "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s 5MB" ] ``` diff --git a/doc/@jitl/quickjs-singlefile-browser-release-sync/README.md b/doc/@jitl/quickjs-singlefile-browser-release-sync/README.md index 63480bc7..8945458b 100644 --- a/doc/@jitl/quickjs-singlefile-browser-release-sync/README.md +++ b/doc/@jitl/quickjs-singlefile-browser-release-sync/README.md @@ -79,7 +79,8 @@ Variant-specific Emscripten build flags: "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s 5MB" ] ``` diff --git a/doc/@jitl/quickjs-singlefile-cjs-debug-asyncify/README.md b/doc/@jitl/quickjs-singlefile-cjs-debug-asyncify/README.md index 0b243d0d..2526d1c5 100644 --- a/doc/@jitl/quickjs-singlefile-cjs-debug-asyncify/README.md +++ b/doc/@jitl/quickjs-singlefile-cjs-debug-asyncify/README.md @@ -90,6 +90,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s SINGLE_FILE=1", + "-s 5MB", "-O3" ] ``` diff --git a/doc/@jitl/quickjs-singlefile-cjs-debug-sync/README.md b/doc/@jitl/quickjs-singlefile-cjs-debug-sync/README.md index 2f70a692..82581951 100644 --- a/doc/@jitl/quickjs-singlefile-cjs-debug-sync/README.md +++ b/doc/@jitl/quickjs-singlefile-cjs-debug-sync/README.md @@ -83,6 +83,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s SINGLE_FILE=1", + "-s 5MB", "-DQTS_SANITIZE_LEAK", "-fsanitize=leak", "-g2" diff --git a/doc/@jitl/quickjs-singlefile-cjs-release-asyncify/README.md b/doc/@jitl/quickjs-singlefile-cjs-release-asyncify/README.md index 46778d06..c750703e 100644 --- a/doc/@jitl/quickjs-singlefile-cjs-release-asyncify/README.md +++ b/doc/@jitl/quickjs-singlefile-cjs-release-asyncify/README.md @@ -86,7 +86,8 @@ Variant-specific Emscripten build flags: "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s 5MB" ] ``` diff --git a/doc/@jitl/quickjs-singlefile-cjs-release-sync/README.md b/doc/@jitl/quickjs-singlefile-cjs-release-sync/README.md index 830ed202..8bcf43ea 100644 --- a/doc/@jitl/quickjs-singlefile-cjs-release-sync/README.md +++ b/doc/@jitl/quickjs-singlefile-cjs-release-sync/README.md @@ -79,7 +79,8 @@ Variant-specific Emscripten build flags: "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s 5MB" ] ``` diff --git a/doc/@jitl/quickjs-singlefile-mjs-debug-asyncify/README.md b/doc/@jitl/quickjs-singlefile-mjs-debug-asyncify/README.md index 52805212..e7f0fdc2 100644 --- a/doc/@jitl/quickjs-singlefile-mjs-debug-asyncify/README.md +++ b/doc/@jitl/quickjs-singlefile-mjs-debug-asyncify/README.md @@ -90,6 +90,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s SINGLE_FILE=1", + "-s 5MB", "-O3" ] ``` diff --git a/doc/@jitl/quickjs-singlefile-mjs-debug-sync/README.md b/doc/@jitl/quickjs-singlefile-mjs-debug-sync/README.md index 7cb244b7..0d50ab6d 100644 --- a/doc/@jitl/quickjs-singlefile-mjs-debug-sync/README.md +++ b/doc/@jitl/quickjs-singlefile-mjs-debug-sync/README.md @@ -83,6 +83,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s SINGLE_FILE=1", + "-s 5MB", "-DQTS_SANITIZE_LEAK", "-fsanitize=leak", "-g2" diff --git a/doc/@jitl/quickjs-singlefile-mjs-release-asyncify/README.md b/doc/@jitl/quickjs-singlefile-mjs-release-asyncify/README.md index 4e8e77f0..af6798e9 100644 --- a/doc/@jitl/quickjs-singlefile-mjs-release-asyncify/README.md +++ b/doc/@jitl/quickjs-singlefile-mjs-release-asyncify/README.md @@ -86,7 +86,8 @@ Variant-specific Emscripten build flags: "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s 5MB" ] ``` diff --git a/doc/@jitl/quickjs-singlefile-mjs-release-sync/README.md b/doc/@jitl/quickjs-singlefile-mjs-release-sync/README.md index c1f99406..7793c0f1 100644 --- a/doc/@jitl/quickjs-singlefile-mjs-release-sync/README.md +++ b/doc/@jitl/quickjs-singlefile-mjs-release-sync/README.md @@ -79,7 +79,8 @@ Variant-specific Emscripten build flags: "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s 5MB" ] ``` diff --git a/doc/@jitl/quickjs-wasmfile-debug-asyncify/README.md b/doc/@jitl/quickjs-wasmfile-debug-asyncify/README.md index f6f33a94..b8d3399d 100644 --- a/doc/@jitl/quickjs-wasmfile-debug-asyncify/README.md +++ b/doc/@jitl/quickjs-wasmfile-debug-asyncify/README.md @@ -101,6 +101,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-sourceMapJson.js", "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s 5MB", "-O3" ] ``` diff --git a/doc/@jitl/quickjs-wasmfile-debug-sync/README.md b/doc/@jitl/quickjs-wasmfile-debug-sync/README.md index b54dfe0e..2869189e 100644 --- a/doc/@jitl/quickjs-wasmfile-debug-sync/README.md +++ b/doc/@jitl/quickjs-wasmfile-debug-sync/README.md @@ -94,6 +94,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-sourceMapJson.js", "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s 5MB", "-DQTS_SANITIZE_LEAK", "-fsanitize=leak", "-g2" diff --git a/doc/@jitl/quickjs-wasmfile-release-asyncify/README.md b/doc/@jitl/quickjs-wasmfile-release-asyncify/README.md index 3e85eec7..91ecd840 100644 --- a/doc/@jitl/quickjs-wasmfile-release-asyncify/README.md +++ b/doc/@jitl/quickjs-wasmfile-release-asyncify/README.md @@ -97,7 +97,8 @@ Variant-specific Emscripten build flags: "--closure 1", "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", - "--pre-js $(TEMPLATES)/pre-wasmMemory.js" + "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s 5MB" ] ``` diff --git a/doc/@jitl/quickjs-wasmfile-release-sync/README.md b/doc/@jitl/quickjs-wasmfile-release-sync/README.md index 0f5cb10b..179daca1 100644 --- a/doc/@jitl/quickjs-wasmfile-release-sync/README.md +++ b/doc/@jitl/quickjs-wasmfile-release-sync/README.md @@ -90,7 +90,8 @@ Variant-specific Emscripten build flags: "--closure 1", "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", - "--pre-js $(TEMPLATES)/pre-wasmMemory.js" + "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s 5MB" ] ``` diff --git a/doc/README.md b/doc/README.md index 95a382a3..73d24aa6 100644 --- a/doc/README.md +++ b/doc/README.md @@ -11,6 +11,7 @@ compiled to WebAssembly. - Create and manipulate values inside the QuickJS runtime ([more][values]). - Expose host functions to the QuickJS runtime ([more][functions]). - Execute synchronous code that uses asynchronous functions, with [asyncify][asyncify]. +- Supports browsers, NodeJS, Deno, Bun, Cloudflare Workers, QuickJS (via [quickjs-for-quickjs][]). [Github] | [NPM] | [API Documentation][api] | [Variants][core] | [Examples][tests] @@ -47,6 +48,7 @@ main() [values]: #interfacing-with-the-interpreter [asyncify]: #asyncify [functions]: #exposing-apis +[quickjs-for-quickjs]: https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-for-quickjs - [quickjs-emscripten](#quickjs-emscripten) - [Usage](#usage) diff --git a/doc/quickjs-emscripten-core/classes/DisposableFail.md b/doc/quickjs-emscripten-core/classes/DisposableFail.md index 3a615c2c..b1cef224 100644 --- a/doc/quickjs-emscripten-core/classes/DisposableFail.md +++ b/doc/quickjs-emscripten-core/classes/DisposableFail.md @@ -55,7 +55,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:426](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L426) +[packages/quickjs-emscripten-core/src/lifetime.ts:451](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L451) ## Properties @@ -65,7 +65,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:427](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L427) +[packages/quickjs-emscripten-core/src/lifetime.ts:452](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L452) ## Accessors @@ -79,7 +79,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:433](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L433) +[packages/quickjs-emscripten-core/src/lifetime.ts:458](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L458) ## Methods @@ -117,7 +117,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:437](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L437) +[packages/quickjs-emscripten-core/src/lifetime.ts:462](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L462) *** @@ -131,7 +131,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:443](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L443) +[packages/quickjs-emscripten-core/src/lifetime.ts:468](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L468) *** @@ -153,7 +153,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:448](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L448) +[packages/quickjs-emscripten-core/src/lifetime.ts:473](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L473) *** @@ -183,7 +183,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:384](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L384) +[packages/quickjs-emscripten-core/src/lifetime.ts:409](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L409) *** @@ -211,7 +211,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:391](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L391) +[packages/quickjs-emscripten-core/src/lifetime.ts:416](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L416) *** @@ -239,7 +239,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:380](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L380) +[packages/quickjs-emscripten-core/src/lifetime.ts:405](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L405) *** diff --git a/doc/quickjs-emscripten-core/classes/DisposableSuccess.md b/doc/quickjs-emscripten-core/classes/DisposableSuccess.md index ff6d43a1..70b6aaeb 100644 --- a/doc/quickjs-emscripten-core/classes/DisposableSuccess.md +++ b/doc/quickjs-emscripten-core/classes/DisposableSuccess.md @@ -54,7 +54,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:402](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L402) +[packages/quickjs-emscripten-core/src/lifetime.ts:427](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L427) ## Properties @@ -64,7 +64,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:400](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L400) +[packages/quickjs-emscripten-core/src/lifetime.ts:425](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L425) *** @@ -74,7 +74,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:402](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L402) +[packages/quickjs-emscripten-core/src/lifetime.ts:427](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L427) ## Accessors @@ -88,7 +88,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:406](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L406) +[packages/quickjs-emscripten-core/src/lifetime.ts:431](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L431) ## Methods @@ -126,7 +126,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:410](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L410) +[packages/quickjs-emscripten-core/src/lifetime.ts:435](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L435) *** @@ -140,7 +140,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:416](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L416) +[packages/quickjs-emscripten-core/src/lifetime.ts:441](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L441) *** @@ -162,7 +162,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:420](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L420) +[packages/quickjs-emscripten-core/src/lifetime.ts:445](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L445) *** @@ -192,7 +192,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:384](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L384) +[packages/quickjs-emscripten-core/src/lifetime.ts:409](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L409) *** @@ -220,7 +220,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:391](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L391) +[packages/quickjs-emscripten-core/src/lifetime.ts:416](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L416) *** @@ -248,7 +248,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:380](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L380) +[packages/quickjs-emscripten-core/src/lifetime.ts:405](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L405) *** diff --git a/doc/quickjs-emscripten-core/classes/Lifetime.md b/doc/quickjs-emscripten-core/classes/Lifetime.md index e7143477..c88e8f5a 100644 --- a/doc/quickjs-emscripten-core/classes/Lifetime.md +++ b/doc/quickjs-emscripten-core/classes/Lifetime.md @@ -35,6 +35,8 @@ Typically, quickjs-emscripten uses Lifetimes to protect C memory pointers. - [consume()](Lifetime.md#consume) - [dispose()](Lifetime.md#dispose) - [dup()](Lifetime.md#dup) + - [map()](Lifetime.md#map) + - [tap()](Lifetime.md#tap) ## Extends @@ -324,7 +326,7 @@ Dispose of [value](Lifetime.md#value-1) and perform cleanup. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:149](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L149) +[packages/quickjs-emscripten-core/src/lifetime.ts:174](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L174) *** @@ -344,4 +346,95 @@ Create a new handle pointing to the same [value](Lifetime.md#value-1). *** +### map() + +#### map(map) + +> **map**\<`O`\>(`map`): `O` + +Call `map` with this lifetime, returning the result. +Does not dispose the lifetime. + +##### Type parameters + +• **O** + +##### Parameters + +• **map**: (`lifetime`) => `O` + +##### Returns + +`O` + +the result of `map(this)`. + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:151](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L151) + +#### map(map) + +> **map**\<`O`\>(`map`): `O` + +##### Type parameters + +• **O** + +##### Parameters + +• **map**: (`lifetime`) => `O` + +##### Returns + +`O` + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:152](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L152) + +*** + +### tap() + +#### tap(fn) + +> **tap**(`fn`): [`Lifetime`](Lifetime.md)\<`T`, `TCopy`, `Owner`\> + +Call `fn` with this lifetime, then return `this`. Does not dispose the +lifetime. Useful for imperative operations within an expression, like when +you're building up objects, or to add logging in the middle of a call chain. + +##### Parameters + +• **fn**: (`lifetime`) => `void` + +##### Returns + +[`Lifetime`](Lifetime.md)\<`T`, `TCopy`, `Owner`\> + +this + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:164](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L164) + +#### tap(fn) + +> **tap**(`fn`): [`QuickJSHandle`](../exports.md#quickjshandle) + +##### Parameters + +• **fn**: (`lifetime`) => `void` + +##### Returns + +[`QuickJSHandle`](../exports.md#quickjshandle) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:165](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L165) + +*** + Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/doc/quickjs-emscripten-core/classes/Scope.md b/doc/quickjs-emscripten-core/classes/Scope.md index 682fafd8..34f5312a 100644 --- a/doc/quickjs-emscripten-core/classes/Scope.md +++ b/doc/quickjs-emscripten-core/classes/Scope.md @@ -63,7 +63,7 @@ false after the object has been [dispose](Scope.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:308](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L308) +[packages/quickjs-emscripten-core/src/lifetime.ts:333](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L333) ## Methods @@ -111,7 +111,7 @@ Dispose of the underlying resources used by this object. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:312](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L312) +[packages/quickjs-emscripten-core/src/lifetime.ts:337](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L337) *** @@ -135,7 +135,7 @@ Track `lifetime` so that it is disposed when this scope is disposed. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:303](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L303) +[packages/quickjs-emscripten-core/src/lifetime.ts:328](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L328) *** @@ -165,7 +165,7 @@ Do not use with async functions. Instead, use [withScopeAsync](Scope.md#withscop #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:248](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L248) +[packages/quickjs-emscripten-core/src/lifetime.ts:273](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L273) *** @@ -192,7 +192,7 @@ block returns. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:285](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L285) +[packages/quickjs-emscripten-core/src/lifetime.ts:310](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L310) *** @@ -220,7 +220,7 @@ block returns. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:261](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L261) +[packages/quickjs-emscripten-core/src/lifetime.ts:286](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L286) *** diff --git a/doc/quickjs-emscripten-core/classes/StaticLifetime.md b/doc/quickjs-emscripten-core/classes/StaticLifetime.md index 6b93e251..97d17214 100644 --- a/doc/quickjs-emscripten-core/classes/StaticLifetime.md +++ b/doc/quickjs-emscripten-core/classes/StaticLifetime.md @@ -31,6 +31,8 @@ A Lifetime that lives forever. Used for constants. - [consume()](StaticLifetime.md#consume) - [dispose()](StaticLifetime.md#dispose) - [dup()](StaticLifetime.md#dup) + - [map()](StaticLifetime.md#map) + - [tap()](StaticLifetime.md#tap) ## Extends @@ -64,7 +66,7 @@ A Lifetime that lives forever. Used for constants. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:173](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L173) +[packages/quickjs-emscripten-core/src/lifetime.ts:198](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L198) ## Properties @@ -196,7 +198,7 @@ false after the object has been [dispose](StaticLifetime.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:178](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L178) +[packages/quickjs-emscripten-core/src/lifetime.ts:203](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L203) *** @@ -327,7 +329,7 @@ Dispose of [value](StaticLifetime.md#value-1) and perform cleanup. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:188](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L188) +[packages/quickjs-emscripten-core/src/lifetime.ts:213](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L213) *** @@ -347,7 +349,114 @@ Create a new handle pointing to the same [value](StaticLifetime.md#value-1). #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:183](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L183) +[packages/quickjs-emscripten-core/src/lifetime.ts:208](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L208) + +*** + +### map() + +#### map(map) + +> **map**\<`O`\>(`map`): `O` + +Call `map` with this lifetime, returning the result. +Does not dispose the lifetime. + +##### Type parameters + +• **O** + +##### Parameters + +• **map**: (`lifetime`) => `O` + +##### Returns + +`O` + +the result of `map(this)`. + +##### Inherited from + +[`quickjs-emscripten-core.Lifetime.map`](Lifetime.md#map) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:151](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L151) + +#### map(map) + +> **map**\<`O`\>(`map`): `O` + +##### Type parameters + +• **O** + +##### Parameters + +• **map**: (`lifetime`) => `O` + +##### Returns + +`O` + +##### Inherited from + +[`quickjs-emscripten-core.Lifetime.map`](Lifetime.md#map) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:152](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L152) + +*** + +### tap() + +#### tap(fn) + +> **tap**(`fn`): [`StaticLifetime`](StaticLifetime.md)\<`T`, `Owner`\> + +Call `fn` with this lifetime, then return `this`. Does not dispose the +lifetime. Useful for imperative operations within an expression, like when +you're building up objects, or to add logging in the middle of a call chain. + +##### Parameters + +• **fn**: (`lifetime`) => `void` + +##### Returns + +[`StaticLifetime`](StaticLifetime.md)\<`T`, `Owner`\> + +this + +##### Inherited from + +[`quickjs-emscripten-core.Lifetime.tap`](Lifetime.md#tap) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:164](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L164) + +#### tap(fn) + +> **tap**(`fn`): [`QuickJSHandle`](../exports.md#quickjshandle) + +##### Parameters + +• **fn**: (`lifetime`) => `void` + +##### Returns + +[`QuickJSHandle`](../exports.md#quickjshandle) + +##### Inherited from + +[`quickjs-emscripten-core.Lifetime.tap`](Lifetime.md#tap) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:165](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L165) *** diff --git a/doc/quickjs-emscripten-core/classes/WeakLifetime.md b/doc/quickjs-emscripten-core/classes/WeakLifetime.md index c3e9d495..089cf48f 100644 --- a/doc/quickjs-emscripten-core/classes/WeakLifetime.md +++ b/doc/quickjs-emscripten-core/classes/WeakLifetime.md @@ -35,6 +35,8 @@ Used for function arguments. - [consume()](WeakLifetime.md#consume) - [dispose()](WeakLifetime.md#dispose) - [dup()](WeakLifetime.md#dup) + - [map()](WeakLifetime.md#map) + - [tap()](WeakLifetime.md#tap) ## Extends @@ -74,7 +76,7 @@ Used for function arguments. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:199](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L199) +[packages/quickjs-emscripten-core/src/lifetime.ts:224](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L224) ## Properties @@ -337,7 +339,7 @@ Dispose of [value](WeakLifetime.md#value-1) and perform cleanup. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:209](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L209) +[packages/quickjs-emscripten-core/src/lifetime.ts:234](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L234) *** @@ -361,4 +363,111 @@ Create a new handle pointing to the same [value](WeakLifetime.md#value-1). *** +### map() + +#### map(map) + +> **map**\<`O`\>(`map`): `O` + +Call `map` with this lifetime, returning the result. +Does not dispose the lifetime. + +##### Type parameters + +• **O** + +##### Parameters + +• **map**: (`lifetime`) => `O` + +##### Returns + +`O` + +the result of `map(this)`. + +##### Inherited from + +[`quickjs-emscripten-core.Lifetime.map`](Lifetime.md#map) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:151](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L151) + +#### map(map) + +> **map**\<`O`\>(`map`): `O` + +##### Type parameters + +• **O** + +##### Parameters + +• **map**: (`lifetime`) => `O` + +##### Returns + +`O` + +##### Inherited from + +[`quickjs-emscripten-core.Lifetime.map`](Lifetime.md#map) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:152](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L152) + +*** + +### tap() + +#### tap(fn) + +> **tap**(`fn`): [`WeakLifetime`](WeakLifetime.md)\<`T`, `TCopy`, `Owner`\> + +Call `fn` with this lifetime, then return `this`. Does not dispose the +lifetime. Useful for imperative operations within an expression, like when +you're building up objects, or to add logging in the middle of a call chain. + +##### Parameters + +• **fn**: (`lifetime`) => `void` + +##### Returns + +[`WeakLifetime`](WeakLifetime.md)\<`T`, `TCopy`, `Owner`\> + +this + +##### Inherited from + +[`quickjs-emscripten-core.Lifetime.tap`](Lifetime.md#tap) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:164](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L164) + +#### tap(fn) + +> **tap**(`fn`): [`QuickJSHandle`](../exports.md#quickjshandle) + +##### Parameters + +• **fn**: (`lifetime`) => `void` + +##### Returns + +[`QuickJSHandle`](../exports.md#quickjshandle) + +##### Inherited from + +[`quickjs-emscripten-core.Lifetime.tap`](Lifetime.md#tap) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:165](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L165) + +*** + Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/doc/quickjs-emscripten-core/exports.md b/doc/quickjs-emscripten-core/exports.md index c0da3274..c328efd2 100644 --- a/doc/quickjs-emscripten-core/exports.md +++ b/doc/quickjs-emscripten-core/exports.md @@ -179,7 +179,7 @@ An `Array` that also implements [Disposable](interfaces/Disposable.md): #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:329](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L329) +[packages/quickjs-emscripten-core/src/lifetime.ts:354](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L354) *** @@ -195,7 +195,7 @@ An `Array` that also implements [Disposable](interfaces/Disposable.md): #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:453](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L453) +[packages/quickjs-emscripten-core/src/lifetime.ts:478](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L478) *** @@ -905,7 +905,7 @@ The default [Intrinsics](exports.md#intrinsics) language features enabled in a Q #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:453](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L453) +[packages/quickjs-emscripten-core/src/lifetime.ts:478](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L478) *** @@ -1198,7 +1198,7 @@ Create an array that also implements [Disposable](interfaces/Disposable.md). #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:334](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L334) +[packages/quickjs-emscripten-core/src/lifetime.ts:359](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L359) *** diff --git a/doc/quickjs-emscripten/README.md b/doc/quickjs-emscripten/README.md index 025b8e45..1f70bb38 100644 --- a/doc/quickjs-emscripten/README.md +++ b/doc/quickjs-emscripten/README.md @@ -11,6 +11,7 @@ compiled to WebAssembly. - Create and manipulate values inside the QuickJS runtime ([more][values]). - Expose host functions to the QuickJS runtime ([more][functions]). - Execute synchronous code that uses asynchronous functions, with [asyncify][asyncify]. +- Supports browsers, NodeJS, Deno, Bun, Cloudflare Workers, QuickJS (via [quickjs-for-quickjs][]). [Github] | [NPM] | [API Documentation][api] | [Variants][core] | [Examples][tests] @@ -47,6 +48,7 @@ main() [values]: #interfacing-with-the-interpreter [asyncify]: #asyncify [functions]: #exposing-apis +[quickjs-for-quickjs]: https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-for-quickjs - [quickjs-emscripten](#quickjs-emscripten) - [Usage](#usage) diff --git a/doc/quickjs-emscripten/classes/DisposableFail.md b/doc/quickjs-emscripten/classes/DisposableFail.md index e10ede00..af081e63 100644 --- a/doc/quickjs-emscripten/classes/DisposableFail.md +++ b/doc/quickjs-emscripten/classes/DisposableFail.md @@ -55,7 +55,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:426](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L426) +[packages/quickjs-emscripten-core/src/lifetime.ts:451](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L451) ## Properties @@ -65,7 +65,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:427](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L427) +[packages/quickjs-emscripten-core/src/lifetime.ts:452](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L452) ## Accessors @@ -79,7 +79,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:433](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L433) +[packages/quickjs-emscripten-core/src/lifetime.ts:458](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L458) ## Methods @@ -117,7 +117,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:437](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L437) +[packages/quickjs-emscripten-core/src/lifetime.ts:462](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L462) *** @@ -131,7 +131,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:443](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L443) +[packages/quickjs-emscripten-core/src/lifetime.ts:468](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L468) *** @@ -153,7 +153,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:448](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L448) +[packages/quickjs-emscripten-core/src/lifetime.ts:473](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L473) *** @@ -183,7 +183,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:384](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L384) +[packages/quickjs-emscripten-core/src/lifetime.ts:409](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L409) *** @@ -211,7 +211,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:391](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L391) +[packages/quickjs-emscripten-core/src/lifetime.ts:416](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L416) *** @@ -239,7 +239,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:380](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L380) +[packages/quickjs-emscripten-core/src/lifetime.ts:405](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L405) *** diff --git a/doc/quickjs-emscripten/classes/DisposableSuccess.md b/doc/quickjs-emscripten/classes/DisposableSuccess.md index fad44ca8..c4dce084 100644 --- a/doc/quickjs-emscripten/classes/DisposableSuccess.md +++ b/doc/quickjs-emscripten/classes/DisposableSuccess.md @@ -54,7 +54,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:402](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L402) +[packages/quickjs-emscripten-core/src/lifetime.ts:427](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L427) ## Properties @@ -64,7 +64,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:400](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L400) +[packages/quickjs-emscripten-core/src/lifetime.ts:425](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L425) *** @@ -74,7 +74,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:402](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L402) +[packages/quickjs-emscripten-core/src/lifetime.ts:427](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L427) ## Accessors @@ -88,7 +88,7 @@ #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:406](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L406) +[packages/quickjs-emscripten-core/src/lifetime.ts:431](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L431) ## Methods @@ -126,7 +126,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:410](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L410) +[packages/quickjs-emscripten-core/src/lifetime.ts:435](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L435) *** @@ -140,7 +140,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:416](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L416) +[packages/quickjs-emscripten-core/src/lifetime.ts:441](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L441) *** @@ -162,7 +162,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:420](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L420) +[packages/quickjs-emscripten-core/src/lifetime.ts:445](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L445) *** @@ -192,7 +192,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:384](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L384) +[packages/quickjs-emscripten-core/src/lifetime.ts:409](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L409) *** @@ -220,7 +220,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:391](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L391) +[packages/quickjs-emscripten-core/src/lifetime.ts:416](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L416) *** @@ -248,7 +248,7 @@ Just calls the standard .dispose() method of this class. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:380](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L380) +[packages/quickjs-emscripten-core/src/lifetime.ts:405](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L405) *** diff --git a/doc/quickjs-emscripten/classes/Lifetime.md b/doc/quickjs-emscripten/classes/Lifetime.md index 3fbcd4b1..62ec48a9 100644 --- a/doc/quickjs-emscripten/classes/Lifetime.md +++ b/doc/quickjs-emscripten/classes/Lifetime.md @@ -35,6 +35,8 @@ Typically, quickjs-emscripten uses Lifetimes to protect C memory pointers. - [consume()](Lifetime.md#consume) - [dispose()](Lifetime.md#dispose) - [dup()](Lifetime.md#dup) + - [map()](Lifetime.md#map) + - [tap()](Lifetime.md#tap) ## Extends @@ -324,7 +326,7 @@ Dispose of [value](Lifetime.md#value-1) and perform cleanup. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:149](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L149) +[packages/quickjs-emscripten-core/src/lifetime.ts:174](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L174) *** @@ -344,4 +346,95 @@ Create a new handle pointing to the same [value](Lifetime.md#value-1). *** +### map() + +#### map(map) + +> **map**\<`O`\>(`map`): `O` + +Call `map` with this lifetime, returning the result. +Does not dispose the lifetime. + +##### Type parameters + +• **O** + +##### Parameters + +• **map**: (`lifetime`) => `O` + +##### Returns + +`O` + +the result of `map(this)`. + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:151](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L151) + +#### map(map) + +> **map**\<`O`\>(`map`): `O` + +##### Type parameters + +• **O** + +##### Parameters + +• **map**: (`lifetime`) => `O` + +##### Returns + +`O` + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:152](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L152) + +*** + +### tap() + +#### tap(fn) + +> **tap**(`fn`): [`Lifetime`](Lifetime.md)\<`T`, `TCopy`, `Owner`\> + +Call `fn` with this lifetime, then return `this`. Does not dispose the +lifetime. Useful for imperative operations within an expression, like when +you're building up objects, or to add logging in the middle of a call chain. + +##### Parameters + +• **fn**: (`lifetime`) => `void` + +##### Returns + +[`Lifetime`](Lifetime.md)\<`T`, `TCopy`, `Owner`\> + +this + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:164](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L164) + +#### tap(fn) + +> **tap**(`fn`): [`QuickJSHandle`](../exports.md#quickjshandle) + +##### Parameters + +• **fn**: (`lifetime`) => `void` + +##### Returns + +[`QuickJSHandle`](../exports.md#quickjshandle) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:165](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L165) + +*** + Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/doc/quickjs-emscripten/classes/Scope.md b/doc/quickjs-emscripten/classes/Scope.md index 038058ef..b231f37f 100644 --- a/doc/quickjs-emscripten/classes/Scope.md +++ b/doc/quickjs-emscripten/classes/Scope.md @@ -63,7 +63,7 @@ false after the object has been [dispose](Scope.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:308](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L308) +[packages/quickjs-emscripten-core/src/lifetime.ts:333](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L333) ## Methods @@ -111,7 +111,7 @@ Dispose of the underlying resources used by this object. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:312](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L312) +[packages/quickjs-emscripten-core/src/lifetime.ts:337](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L337) *** @@ -135,7 +135,7 @@ Track `lifetime` so that it is disposed when this scope is disposed. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:303](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L303) +[packages/quickjs-emscripten-core/src/lifetime.ts:328](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L328) *** @@ -165,7 +165,7 @@ Do not use with async functions. Instead, use [withScopeAsync](Scope.md#withscop #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:248](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L248) +[packages/quickjs-emscripten-core/src/lifetime.ts:273](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L273) *** @@ -192,7 +192,7 @@ block returns. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:285](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L285) +[packages/quickjs-emscripten-core/src/lifetime.ts:310](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L310) *** @@ -220,7 +220,7 @@ block returns. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:261](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L261) +[packages/quickjs-emscripten-core/src/lifetime.ts:286](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L286) *** diff --git a/doc/quickjs-emscripten/classes/StaticLifetime.md b/doc/quickjs-emscripten/classes/StaticLifetime.md index 43563372..d8ce4a69 100644 --- a/doc/quickjs-emscripten/classes/StaticLifetime.md +++ b/doc/quickjs-emscripten/classes/StaticLifetime.md @@ -31,6 +31,8 @@ A Lifetime that lives forever. Used for constants. - [consume()](StaticLifetime.md#consume) - [dispose()](StaticLifetime.md#dispose) - [dup()](StaticLifetime.md#dup) + - [map()](StaticLifetime.md#map) + - [tap()](StaticLifetime.md#tap) ## Extends @@ -64,7 +66,7 @@ A Lifetime that lives forever. Used for constants. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:173](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L173) +[packages/quickjs-emscripten-core/src/lifetime.ts:198](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L198) ## Properties @@ -196,7 +198,7 @@ false after the object has been [dispose](StaticLifetime.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:178](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L178) +[packages/quickjs-emscripten-core/src/lifetime.ts:203](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L203) *** @@ -327,7 +329,7 @@ Dispose of [value](StaticLifetime.md#value-1) and perform cleanup. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:188](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L188) +[packages/quickjs-emscripten-core/src/lifetime.ts:213](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L213) *** @@ -347,7 +349,114 @@ Create a new handle pointing to the same [value](StaticLifetime.md#value-1). #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:183](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L183) +[packages/quickjs-emscripten-core/src/lifetime.ts:208](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L208) + +*** + +### map() + +#### map(map) + +> **map**\<`O`\>(`map`): `O` + +Call `map` with this lifetime, returning the result. +Does not dispose the lifetime. + +##### Type parameters + +• **O** + +##### Parameters + +• **map**: (`lifetime`) => `O` + +##### Returns + +`O` + +the result of `map(this)`. + +##### Inherited from + +[`quickjs-emscripten.Lifetime.map`](Lifetime.md#map) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:151](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L151) + +#### map(map) + +> **map**\<`O`\>(`map`): `O` + +##### Type parameters + +• **O** + +##### Parameters + +• **map**: (`lifetime`) => `O` + +##### Returns + +`O` + +##### Inherited from + +[`quickjs-emscripten.Lifetime.map`](Lifetime.md#map) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:152](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L152) + +*** + +### tap() + +#### tap(fn) + +> **tap**(`fn`): [`StaticLifetime`](StaticLifetime.md)\<`T`, `Owner`\> + +Call `fn` with this lifetime, then return `this`. Does not dispose the +lifetime. Useful for imperative operations within an expression, like when +you're building up objects, or to add logging in the middle of a call chain. + +##### Parameters + +• **fn**: (`lifetime`) => `void` + +##### Returns + +[`StaticLifetime`](StaticLifetime.md)\<`T`, `Owner`\> + +this + +##### Inherited from + +[`quickjs-emscripten.Lifetime.tap`](Lifetime.md#tap) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:164](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L164) + +#### tap(fn) + +> **tap**(`fn`): [`QuickJSHandle`](../exports.md#quickjshandle) + +##### Parameters + +• **fn**: (`lifetime`) => `void` + +##### Returns + +[`QuickJSHandle`](../exports.md#quickjshandle) + +##### Inherited from + +[`quickjs-emscripten.Lifetime.tap`](Lifetime.md#tap) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:165](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L165) *** diff --git a/doc/quickjs-emscripten/classes/WeakLifetime.md b/doc/quickjs-emscripten/classes/WeakLifetime.md index 41173dc4..eedbf4cd 100644 --- a/doc/quickjs-emscripten/classes/WeakLifetime.md +++ b/doc/quickjs-emscripten/classes/WeakLifetime.md @@ -35,6 +35,8 @@ Used for function arguments. - [consume()](WeakLifetime.md#consume) - [dispose()](WeakLifetime.md#dispose) - [dup()](WeakLifetime.md#dup) + - [map()](WeakLifetime.md#map) + - [tap()](WeakLifetime.md#tap) ## Extends @@ -74,7 +76,7 @@ Used for function arguments. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:199](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L199) +[packages/quickjs-emscripten-core/src/lifetime.ts:224](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L224) ## Properties @@ -337,7 +339,7 @@ Dispose of [value](WeakLifetime.md#value-1) and perform cleanup. #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:209](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L209) +[packages/quickjs-emscripten-core/src/lifetime.ts:234](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L234) *** @@ -361,4 +363,111 @@ Create a new handle pointing to the same [value](WeakLifetime.md#value-1). *** +### map() + +#### map(map) + +> **map**\<`O`\>(`map`): `O` + +Call `map` with this lifetime, returning the result. +Does not dispose the lifetime. + +##### Type parameters + +• **O** + +##### Parameters + +• **map**: (`lifetime`) => `O` + +##### Returns + +`O` + +the result of `map(this)`. + +##### Inherited from + +[`quickjs-emscripten.Lifetime.map`](Lifetime.md#map) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:151](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L151) + +#### map(map) + +> **map**\<`O`\>(`map`): `O` + +##### Type parameters + +• **O** + +##### Parameters + +• **map**: (`lifetime`) => `O` + +##### Returns + +`O` + +##### Inherited from + +[`quickjs-emscripten.Lifetime.map`](Lifetime.md#map) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:152](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L152) + +*** + +### tap() + +#### tap(fn) + +> **tap**(`fn`): [`WeakLifetime`](WeakLifetime.md)\<`T`, `TCopy`, `Owner`\> + +Call `fn` with this lifetime, then return `this`. Does not dispose the +lifetime. Useful for imperative operations within an expression, like when +you're building up objects, or to add logging in the middle of a call chain. + +##### Parameters + +• **fn**: (`lifetime`) => `void` + +##### Returns + +[`WeakLifetime`](WeakLifetime.md)\<`T`, `TCopy`, `Owner`\> + +this + +##### Inherited from + +[`quickjs-emscripten.Lifetime.tap`](Lifetime.md#tap) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:164](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L164) + +#### tap(fn) + +> **tap**(`fn`): [`QuickJSHandle`](../exports.md#quickjshandle) + +##### Parameters + +• **fn**: (`lifetime`) => `void` + +##### Returns + +[`QuickJSHandle`](../exports.md#quickjshandle) + +##### Inherited from + +[`quickjs-emscripten.Lifetime.tap`](Lifetime.md#tap) + +##### Source + +[packages/quickjs-emscripten-core/src/lifetime.ts:165](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L165) + +*** + Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/doc/quickjs-emscripten/exports.md b/doc/quickjs-emscripten/exports.md index 88fbae13..ad64d4e4 100644 --- a/doc/quickjs-emscripten/exports.md +++ b/doc/quickjs-emscripten/exports.md @@ -193,7 +193,7 @@ An `Array` that also implements [Disposable](interfaces/Disposable.md): #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:329](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L329) +[packages/quickjs-emscripten-core/src/lifetime.ts:354](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L354) *** @@ -209,7 +209,7 @@ An `Array` that also implements [Disposable](interfaces/Disposable.md): #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:453](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L453) +[packages/quickjs-emscripten-core/src/lifetime.ts:478](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L478) *** @@ -965,7 +965,7 @@ The default [Intrinsics](exports.md#intrinsics) language features enabled in a Q #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:453](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L453) +[packages/quickjs-emscripten-core/src/lifetime.ts:478](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L478) *** @@ -1304,7 +1304,7 @@ Create an array that also implements [Disposable](interfaces/Disposable.md). #### Source -[packages/quickjs-emscripten-core/src/lifetime.ts:334](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L334) +[packages/quickjs-emscripten-core/src/lifetime.ts:359](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/lifetime.ts#L359) *** diff --git a/package.json b/package.json index 12398479..aa509146 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "all:publish:stable": "yarn run check:packages && yarn for-each-publishable-package npm publish --access public", "all:publish:next": "yarn run check:packages && yarn for-each-publishable-package npm publish --access public --tag next", "all:version": "./scripts/set-version.ts", - "for-each-package-cmd": "yarn workspaces foreach --from 'packages/*' -Rpti", + "for-each-package-cmd": "yarn workspaces foreach --from 'packages/*' --topological-dev -Rpti", "for-each-publishable-package": "yarn for-each-package-cmd --exclude 'packages/internal-*'", "for-each-package": "yarn for-each-package-cmd run" }, diff --git a/packages/internal-tsconfig/tsconfig.json b/packages/internal-tsconfig/tsconfig.json index 6bc2677d..6b65072f 100644 --- a/packages/internal-tsconfig/tsconfig.json +++ b/packages/internal-tsconfig/tsconfig.json @@ -35,7 +35,7 @@ "noEmitOnError": true, // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + "isolatedModules": true /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */, // "emitDeclarationOnly": true, /* Strict Type-Checking Options */ diff --git a/packages/internal-tsconfig/tsup.base.config.ts b/packages/internal-tsconfig/tsup.base.config.ts index ea915700..d6ec6a88 100644 --- a/packages/internal-tsconfig/tsup.base.config.ts +++ b/packages/internal-tsconfig/tsup.base.config.ts @@ -3,11 +3,12 @@ import { defineConfig } from "tsup" const baseConfig = defineConfig((options) => ({ entry: ["src/index.ts"], - minify: !options.watch, sourcemap: true, dts: true, clean: true, format: ["cjs", "esm"], + minifySyntax: true, + minifyWhitespace: true, })) as (options: Options) => Options export function extendConfig(options: Options = {}) { diff --git a/packages/quickjs-emscripten-core/src/context.ts b/packages/quickjs-emscripten-core/src/context.ts index df50f3f5..413f39ff 100644 --- a/packages/quickjs-emscripten-core/src/context.ts +++ b/packages/quickjs-emscripten-core/src/context.ts @@ -1276,8 +1276,8 @@ export class QuickJSContext */ unwrapResult(result: SuccessOrFail): T { if (result.error) { - const context: QuickJSContext = - "context" in result.error ? (result.error as { context: QuickJSContext }).context : this + // const context: QuickJSContext = + // "context" in result.error ? (result.error as { context: QuickJSContext }).context : this const cause = result.error.consume((error) => this.dump(error)) if (cause && typeof cause === "object" && typeof cause.message === "string") { @@ -1298,12 +1298,20 @@ export class QuickJSContext throw exception } - throw new QuickJSUnwrapError(cause, context) + throw new QuickJSUnwrapError(cause) } return result.value } + /** @private */ + [Symbol.for("nodejs.util.inspect.custom")]() { + if (!this.alive) { + return `${this.constructor.name} { disposed }` + } + return `${this.constructor.name} { ctx: ${this.ctx.value} rt: ${this.rt.value} }` + } + /** @private */ protected fnNextId = -32768 // min value of signed 16bit int used by Quickjs /** @private */ diff --git a/packages/quickjs-emscripten-core/src/errors.ts b/packages/quickjs-emscripten-core/src/errors.ts index a2711f6f..bac45263 100644 --- a/packages/quickjs-emscripten-core/src/errors.ts +++ b/packages/quickjs-emscripten-core/src/errors.ts @@ -7,7 +7,7 @@ export class QuickJSUnwrapError extends Error { name = "QuickJSUnwrapError" constructor( public cause: unknown, - public context?: QuickJSContext, + // public context?: QuickJSContext, ) { super(String(cause)) } diff --git a/packages/quickjs-emscripten-core/src/index.ts b/packages/quickjs-emscripten-core/src/index.ts index 8583c07a..4f62a7b7 100644 --- a/packages/quickjs-emscripten-core/src/index.ts +++ b/packages/quickjs-emscripten-core/src/index.ts @@ -3,12 +3,14 @@ export * from "@jitl/quickjs-ffi-types" // Sync classes export { QuickJSWASMModule } from "./module" export { QuickJSContext } from "./context" -export { QuickJSRuntime, InterruptHandler, ExecutePendingJobsResult } from "./runtime" +export { QuickJSRuntime } from "./runtime" +export type { InterruptHandler, ExecutePendingJobsResult } from "./runtime" // Async classes export { QuickJSAsyncWASMModule } from "./module-asyncify" export { QuickJSAsyncRuntime } from "./runtime-asyncify" -export { QuickJSAsyncContext, AsyncFunctionImplementation } from "./context-asyncify" +export { QuickJSAsyncContext } from "./context-asyncify" +export type { AsyncFunctionImplementation } from "./context-asyncify" // Build variants export * from "./from-variant" @@ -45,5 +47,5 @@ export type { } from "./types" export { DefaultIntrinsics } from "./types" export type { ModuleEvalOptions } from "./module" -export { QuickJSPropertyKey } from "./context" +export type { QuickJSPropertyKey } from "./context" export { debugLog, setDebugMode } from "./debug" diff --git a/packages/quickjs-emscripten-core/src/lifetime.ts b/packages/quickjs-emscripten-core/src/lifetime.ts index 1442e2af..5b97e43b 100644 --- a/packages/quickjs-emscripten-core/src/lifetime.ts +++ b/packages/quickjs-emscripten-core/src/lifetime.ts @@ -143,6 +143,31 @@ export class Lifetime return result } + /** + * Call `map` with this lifetime, returning the result. + * Does not dispose the lifetime. + * @return the result of `map(this)`. + */ + map(map: (lifetime: this) => O): O + map(map: (lifetime: QuickJSHandle) => O): O + map(map: (lifetime: any) => O): O { + this.assertAlive() + return map(this) + } + + /** + * Call `fn` with this lifetime, then return `this`. Does not dispose the + * lifetime. Useful for imperative operations within an expression, like when + * you're building up objects, or to add logging in the middle of a call chain. + * @returns this + */ + tap(fn: (lifetime: this) => void): this + tap(fn: (lifetime: QuickJSHandle) => void): QuickJSHandle + tap(fn: (lifetime: any) => void): any { + fn(this) + return this + } + /** * Dispose of {@link value} and perform cleanup. */ diff --git a/packages/quickjs-emscripten-core/src/runtime.ts b/packages/quickjs-emscripten-core/src/runtime.ts index adf77513..fd98b406 100644 --- a/packages/quickjs-emscripten-core/src/runtime.ts +++ b/packages/quickjs-emscripten-core/src/runtime.ts @@ -24,7 +24,7 @@ import { intrinsicsToFlags } from "./types" * @returns `true` to interrupt JS execution inside the VM. * @returns `false` or `undefined` to continue JS execution inside the VM. */ -export type InterruptHandler = (runtime: QuickJSRuntime) => boolean | undefined +export type InterruptHandler = (runtime: QuickJSRuntime) => boolean | undefined | void /** * Used as an optional for the results of executing pendingJobs. @@ -366,6 +366,14 @@ export class QuickJSRuntime extends UsingDisposable implements Disposable { } } + /** @private */ + [Symbol.for("nodejs.util.inspect.custom")]() { + if (!this.alive) { + return `${this.constructor.name} { disposed }` + } + return `${this.constructor.name} { rt: ${this.rt.value} }` + } + private getSystemContext() { if (!this.context) { // We own this context and should dispose of it. diff --git a/packages/quickjs-emscripten/package.json b/packages/quickjs-emscripten/package.json index 70b84bdf..857a1932 100644 --- a/packages/quickjs-emscripten/package.json +++ b/packages/quickjs-emscripten/package.json @@ -33,7 +33,7 @@ "clean": "git clean -fx dist .output", "tsc": "npx tsc -p . --noEmit", "test:vi": "VITEST=1 npx vitest run", - "test:node": "npx tsc -p tsconfig.build.json && ./makeTestPackageJson.ts && node -r source-map-support/register --test ./.output/*node-test*.*js", + "test:node": "npx tsc -p tsconfig.build.json && ./makeTestPackageJson.ts && node --experimental-import-meta-resolve -r source-map-support/register --test ./.output/*node-test*.*js", "test": "npm run test:vi && npm run test:node" }, "types": "./dist/index.d.ts", diff --git a/packages/quickjs-for-quickjs/README.md b/packages/quickjs-for-quickjs/README.md index bec5044b..dc47e377 100644 --- a/packages/quickjs-for-quickjs/README.md +++ b/packages/quickjs-for-quickjs/README.md @@ -1,3 +1,64 @@ # quickjs-for-quickjs This package is a build of [quickjs-emscripten](https://github.com/justjake/quickjs-emscripten) that can run inside QuickJS or any other JavaScript runtime without WebAssembly support. The QuickJS C library is compiled to Asm.js, and then bundled together with the quickjs-emscripten JavaScript wrapper into a single standalone file with no external dependencies. + +`quickjs-in-quickjs` has been tested in the following configurations: + +- ✅ NodeJS -> quickjs-for-quickjs +- ✅ NodeJS -> quickjs-emscripten RELEASE_SYNC -> quickjs-for-quickjs +- ❌ NodeJS -> quickjs-emscripten RELEASE_SYNC -> quickjs-for-quickjs -> quickjs-for-quickjs (This hits stack overflow in QuickJS. It could work with a larger stack size for the outer QuickJS instance) + +## Usage + +For a more detailed example, see [the "example" directory][example] in the repo. + +[example]: https://github.com/justjake/quickjs-emscripte/tree/main/packages/quickjs-for-quickjs/example + +```javascript +// nodejs-host.mjs +import fs from "node:fs/promises" +import module from "node:module" +import { getQuickJS, setUpContext } from "quickjs-for-quickjs" + +// get quickjs source code +const require = module.createRequire(import.meta.url) +const quickjsSource = await fs.readFile(require.resolve("quickjs-for-quickjs"), "utf8") + +// create the host QuickJS context +const QuickJS = await getQuickJS() +const context = QuickJS.createContext() + +// inject console.log, which is required for quickjs-for-quickjs to work +setUpContext(context) + +// allow the host QuickJS to import quickjs-for-quickjs module +context.runtime.setModuleLoader(name => { + if (name === "quickjs-for-quickjs") { + return quickjsSource + } + throw new Error(`Module not found: ${name}`) +}) + +const quickjsHost = ` +// import and create inner QuickJS guest context +import { getQuickJS } from "quickjs-for-quickjs" +const context = await getQuickJS().then(mod => mod.createContext()) + +// eval some code in the inner context +const innerResult = context.evalCode('1 + 2', "quickjs-guest.mjs").unwrap() + +// export the result +export const result = innerResult.consume(context.dump) +` + +// eval the quickjs host +const handle = context + .evalCode(quickjsHost, "quickjs-host.mjs") + .unwrap() + +// get the result +context.runtime.executePendingJob() +const result = context.unwrapResult(context.getPromiseState(handle)) + +console.log(result.consume(context.dump)) +``` diff --git a/packages/quickjs-for-quickjs/example/node-host.mjs b/packages/quickjs-for-quickjs/example/node-host.mjs index d14c96c4..5ea39a1f 100644 --- a/packages/quickjs-for-quickjs/example/node-host.mjs +++ b/packages/quickjs-for-quickjs/example/node-host.mjs @@ -1,16 +1,20 @@ import fs from "node:fs/promises" import module from "node:module" +import { getQuickJS, setUpContext } from "quickjs-for-quickjs" const require = module.createRequire(import.meta.url) +console.log("hello") + const quickjsSource = await fs.readFile(require.resolve("quickjs-for-quickjs"), "utf8") const exportQuickjsSource = `export default ${JSON.stringify(quickjsSource)}` const exampleQuickjsHostSource = await fs.readFile(require.resolve("./quickjs-host.mjs"), "utf8") const exportExampleQuickjsHostSource = `export default ${JSON.stringify(exampleQuickjsHostSource)}` -const QuickJS = await import("quickjs-emscripten").then((mod) => mod.getQuickJS()) -const context = QuickJS.newContext() +const QuickJS = await getQuickJS() +const context = setUpContext(QuickJS.newContext()) context.runtime.setModuleLoader((name) => { + console.log(`0: import ${name}`) if (name === "quickjs-for-quickjs") { return quickjsSource } @@ -22,11 +26,26 @@ context.runtime.setModuleLoader((name) => { } return { error: new Error("not found") } }) + +let nestingLimit = 2 context.setProp( context.global, - "random", - context.newFunction("random", () => context.newNumber(Math.random())), + "done", + context.newFunction("done", () => context.newNumber(--nestingLimit <= 0 ? 1 : 0)), ) -const promise = context.resolvePromise(context.evalCode(exampleQuickjsHostSource).unwrap()) +const handle = context + .evalCode(exampleQuickjsHostSource, "quickjs-host.mjs", { + type: "module", + }) + .unwrap() + +const promise = context.resolvePromise(handle) context.runtime.executePendingJobs() -console.log("result:", context.dump(await promise)) + +const result = (await promise).unwrap() + +console.log({ + result: context.dump(context.getProp(result, "result")), +}) + +console.log("result:", context.dump(context.getProp(await promise, "result"))) diff --git a/packages/quickjs-for-quickjs/example/quickjs-host.mjs b/packages/quickjs-for-quickjs/example/quickjs-host.mjs index 18166bb4..a82df11f 100644 --- a/packages/quickjs-for-quickjs/example/quickjs-host.mjs +++ b/packages/quickjs-for-quickjs/example/quickjs-host.mjs @@ -1,11 +1,18 @@ +import { getQuickJS, setUpContext } from "quickjs-for-quickjs" import quickjsSource from "quickjs-for-quickjs-source" import exampleQuickjsHostSource from "example-quickjs-host-source" -const QuickJS = await import("quickjs-for-quickjs").then((mod) => mod.getQuickJS()) + +console.log(`${console.depth}: started`) +const QuickJS = await getQuickJS() + const exportQuickjsSource = `export default ${JSON.stringify(quickjsSource)}` const exportExampleQuickjsHostSource = `export default ${JSON.stringify(exampleQuickjsHostSource)}` -const context = QuickJS.newContext() +console.log(`${console.depth}: imported`) + +const context = setUpContext(QuickJS.newContext()) context.runtime.setModuleLoader((name) => { + console.log(`${console.depth}: import ${name}`) if (name === "quickjs-for-quickjs") { return quickjsSource } @@ -19,12 +26,24 @@ context.runtime.setModuleLoader((name) => { }) context.setProp( context.global, - "random", - context.newFunction("random", () => context.newNumber(random())), + "done", + context.newFunction("random", () => context.newNumber(done())), ) -const codeToEval = - random() > 0.5 ? `export const result = ['hello', 'world'].join(' ')` : exampleQuickjsHostSource +console.log(`${console.depth}: evaluating`) + +const codeToEval = done() + ? `export const result = ['hello', 'world', console.depth].join(' ')` + : exampleQuickjsHostSource const promise = context.resolvePromise(context.evalCode(codeToEval).unwrap()) + +console.log(`${console.depth}: executing pending jobs`) context.runtime.executePendingJobs() -export const result = "hello " + context.dump(await promise) + +console.log("awaiting") +const promised = (await promise).unwrap() +console.log(`${console.depth}:`, { promised, type: context.typeof(promised) }) + +export const result = "hello " + context.dump(context.getProp(promised, "result")) + +console.log(`${console.depth}: done`) diff --git a/packages/quickjs-for-quickjs/package.json b/packages/quickjs-for-quickjs/package.json index d37ccee6..d8685283 100644 --- a/packages/quickjs-for-quickjs/package.json +++ b/packages/quickjs-for-quickjs/package.json @@ -17,7 +17,7 @@ }, "files": [ "LICENSE", - "example/**", + "example/**/*", "dist/**/*" ], "types": "dist/index.d.mts", @@ -32,8 +32,8 @@ } }, "devDependencies": { - "quickjs-emscripten-core": "workspace:*", "@jitl/quickjs-asmjs-mjs-release-sync": "workspace:*", - "@jitl/tsconfig": "workspace:*" + "@jitl/tsconfig": "workspace:*", + "quickjs-emscripten-core": "workspace:*" } } diff --git a/packages/quickjs-for-quickjs/src/index.mts b/packages/quickjs-for-quickjs/src/index.mts index 4ca9c583..6a7d3a09 100644 --- a/packages/quickjs-for-quickjs/src/index.mts +++ b/packages/quickjs-for-quickjs/src/index.mts @@ -1,9 +1,7 @@ -import type { QuickJSWASMModule } from "quickjs-emscripten-core" +import type { QuickJSWASMModule, QuickJSContext } from "quickjs-emscripten-core" import { newQuickJSWASMModuleFromVariant } from "quickjs-emscripten-core" import RELEASE_SYNC from "@jitl/quickjs-asmjs-mjs-release-sync" -export * from "quickjs-emscripten-core" - let promise: Promise | undefined export function getQuickJS(): Promise { @@ -15,4 +13,40 @@ export function newQuickJSWASMModule(): Promise { return newQuickJSWASMModuleFromVariant(RELEASE_SYNC as any) } +export function setUpContext( + context: QuickJSContext, + options: { + log?: (...args: unknown[]) => void + } = {}, +) { + const { log } = options + const depth: number = (console as any)["depth"] ?? 0 + using consoleHandle = context.newObject() + using logHandle = context.newFunction("console.log", (...args) => { + const message = args.map(context.dump) + if (log) { + log(...message) + } else { + console.log(...message) + } + }) + using depthHandle = context.newNumber(1 + depth) + + context.setProp(consoleHandle, "log", logHandle) + context.setProp(consoleHandle, "error", logHandle) + context.setProp(consoleHandle, "depth", depthHandle) + + context.setProp(context.global, "console", consoleHandle) + + context.runtime.setMaxStackSize(0) + context.runtime.setMemoryLimit(0) + let interruptCount = 0 + context.runtime.setInterruptHandler(() => { + console.log(`${depth}: ...eval... (${++interruptCount})`) + return undefined + }) + + return context +} + export { RELEASE_SYNC } diff --git a/packages/quickjs-for-quickjs/tsup.config.ts b/packages/quickjs-for-quickjs/tsup.config.ts index 0fd61cb6..38953e77 100644 --- a/packages/quickjs-for-quickjs/tsup.config.ts +++ b/packages/quickjs-for-quickjs/tsup.config.ts @@ -1,8 +1,10 @@ -import { extendConfig } from "@jitl/tsconfig/tsup.base.config.js" +import {extendConfig} from "@jitl/tsconfig/tsup.base.config.js" export default extendConfig({ entry: ["src/index.mts"], format: ["esm"], external: [], clean: true, + splitting: false, + sourcemap: false, }) diff --git a/packages/variant-quickjs-asmjs-mjs-release-sync/Makefile b/packages/variant-quickjs-asmjs-mjs-release-sync/Makefile index c2c747b1..27beabdd 100644 --- a/packages/variant-quickjs-asmjs-mjs-release-sync/Makefile +++ b/packages/variant-quickjs-asmjs-mjs-release-sync/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -80,6 +79,8 @@ CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js CFLAGS_WASM+=-s WASM=0 CFLAGS_WASM+=-s SINGLE_FILE=1 +CFLAGS_WASM+=-s STACK_SIZE=32MB +CFLAGS_WASM+=-s INITIAL_MEMORY=64MB CFLAGS_MJS+=-s ENVIRONMENT=web,worker,node diff --git a/packages/variant-quickjs-asmjs-mjs-release-sync/README.md b/packages/variant-quickjs-asmjs-mjs-release-sync/README.md index 8e0c6aac..2111b488 100644 --- a/packages/variant-quickjs-asmjs-mjs-release-sync/README.md +++ b/packages/variant-quickjs-asmjs-mjs-release-sync/README.md @@ -67,6 +67,8 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s WASM=0", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s STACK_SIZE=32MB", + "-s INITIAL_MEMORY=64MB" ] ``` diff --git a/packages/variant-quickjs-ng-wasmfile-debug-asyncify/Makefile b/packages/variant-quickjs-ng-wasmfile-debug-asyncify/Makefile index ea48ca33..866b4597 100644 --- a/packages/variant-quickjs-ng-wasmfile-debug-asyncify/Makefile +++ b/packages/variant-quickjs-ng-wasmfile-debug-asyncify/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -88,6 +87,7 @@ CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-sourceMapJson.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_WASM+=-O3 CFLAGS_CJS+=-s ENVIRONMENT=node CFLAGS_MJS+=-s ENVIRONMENT=node diff --git a/packages/variant-quickjs-ng-wasmfile-debug-asyncify/README.md b/packages/variant-quickjs-ng-wasmfile-debug-asyncify/README.md index 5a194c53..2e1d11ca 100644 --- a/packages/variant-quickjs-ng-wasmfile-debug-asyncify/README.md +++ b/packages/variant-quickjs-ng-wasmfile-debug-asyncify/README.md @@ -88,6 +88,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-sourceMapJson.js", "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s STACK_SIZE=5MB", "-O3" ] ``` diff --git a/packages/variant-quickjs-ng-wasmfile-debug-sync/Makefile b/packages/variant-quickjs-ng-wasmfile-debug-sync/Makefile index 36067ae0..97612ae0 100644 --- a/packages/variant-quickjs-ng-wasmfile-debug-sync/Makefile +++ b/packages/variant-quickjs-ng-wasmfile-debug-sync/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -81,6 +80,7 @@ CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-sourceMapJson.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_WASM+=-DQTS_SANITIZE_LEAK CFLAGS_WASM+=-fsanitize=leak CFLAGS_WASM+=-g2 diff --git a/packages/variant-quickjs-ng-wasmfile-debug-sync/README.md b/packages/variant-quickjs-ng-wasmfile-debug-sync/README.md index c3e762f9..d4823759 100644 --- a/packages/variant-quickjs-ng-wasmfile-debug-sync/README.md +++ b/packages/variant-quickjs-ng-wasmfile-debug-sync/README.md @@ -81,6 +81,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-sourceMapJson.js", "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s STACK_SIZE=5MB", "-DQTS_SANITIZE_LEAK", "-fsanitize=leak", "-g2" diff --git a/packages/variant-quickjs-ng-wasmfile-release-asyncify/Makefile b/packages/variant-quickjs-ng-wasmfile-release-asyncify/Makefile index 185af7f9..9ba254ba 100644 --- a/packages/variant-quickjs-ng-wasmfile-release-asyncify/Makefile +++ b/packages/variant-quickjs-ng-wasmfile-release-asyncify/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -85,6 +84,7 @@ CFLAGS_WASM+=--closure 1 CFLAGS_WASM+=-s FILESYSTEM=0 CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_CJS+=-s ENVIRONMENT=node CFLAGS_MJS+=-s ENVIRONMENT=node CFLAGS_BROWSER+=-s ENVIRONMENT=web,worker diff --git a/packages/variant-quickjs-ng-wasmfile-release-asyncify/README.md b/packages/variant-quickjs-ng-wasmfile-release-asyncify/README.md index 6624c67a..fac26c00 100644 --- a/packages/variant-quickjs-ng-wasmfile-release-asyncify/README.md +++ b/packages/variant-quickjs-ng-wasmfile-release-asyncify/README.md @@ -84,6 +84,7 @@ Variant-specific Emscripten build flags: "--closure 1", "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", - "--pre-js $(TEMPLATES)/pre-wasmMemory.js" + "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s STACK_SIZE=5MB" ] ``` diff --git a/packages/variant-quickjs-ng-wasmfile-release-sync/Makefile b/packages/variant-quickjs-ng-wasmfile-release-sync/Makefile index 90b76bb5..820ffaca 100644 --- a/packages/variant-quickjs-ng-wasmfile-release-sync/Makefile +++ b/packages/variant-quickjs-ng-wasmfile-release-sync/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -78,6 +77,7 @@ CFLAGS_WASM+=--closure 1 CFLAGS_WASM+=-s FILESYSTEM=0 CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_CJS+=-s ENVIRONMENT=node CFLAGS_MJS+=-s ENVIRONMENT=node CFLAGS_BROWSER+=-s ENVIRONMENT=web,worker diff --git a/packages/variant-quickjs-ng-wasmfile-release-sync/README.md b/packages/variant-quickjs-ng-wasmfile-release-sync/README.md index cb980f8b..6152549b 100644 --- a/packages/variant-quickjs-ng-wasmfile-release-sync/README.md +++ b/packages/variant-quickjs-ng-wasmfile-release-sync/README.md @@ -77,6 +77,7 @@ Variant-specific Emscripten build flags: "--closure 1", "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", - "--pre-js $(TEMPLATES)/pre-wasmMemory.js" + "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s STACK_SIZE=5MB" ] ``` diff --git a/packages/variant-quickjs-singlefile-browser-debug-asyncify/Makefile b/packages/variant-quickjs-singlefile-browser-debug-asyncify/Makefile index 1af33311..28db52c7 100644 --- a/packages/variant-quickjs-singlefile-browser-debug-asyncify/Makefile +++ b/packages/variant-quickjs-singlefile-browser-debug-asyncify/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -89,6 +88,7 @@ CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-sourceMapJson.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js CFLAGS_WASM+=-s SINGLE_FILE=1 +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_WASM+=-O3 diff --git a/packages/variant-quickjs-singlefile-browser-debug-asyncify/README.md b/packages/variant-quickjs-singlefile-browser-debug-asyncify/README.md index 38304e33..cd112c4c 100644 --- a/packages/variant-quickjs-singlefile-browser-debug-asyncify/README.md +++ b/packages/variant-quickjs-singlefile-browser-debug-asyncify/README.md @@ -77,6 +77,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s SINGLE_FILE=1", + "-s STACK_SIZE=5MB", "-O3" ] ``` diff --git a/packages/variant-quickjs-singlefile-browser-debug-sync/Makefile b/packages/variant-quickjs-singlefile-browser-debug-sync/Makefile index 2a6c54fa..7c519dab 100644 --- a/packages/variant-quickjs-singlefile-browser-debug-sync/Makefile +++ b/packages/variant-quickjs-singlefile-browser-debug-sync/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -82,6 +81,7 @@ CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-sourceMapJson.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js CFLAGS_WASM+=-s SINGLE_FILE=1 +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_WASM+=-DQTS_SANITIZE_LEAK CFLAGS_WASM+=-fsanitize=leak CFLAGS_WASM+=-g2 diff --git a/packages/variant-quickjs-singlefile-browser-debug-sync/README.md b/packages/variant-quickjs-singlefile-browser-debug-sync/README.md index 47cabbbc..f4038c68 100644 --- a/packages/variant-quickjs-singlefile-browser-debug-sync/README.md +++ b/packages/variant-quickjs-singlefile-browser-debug-sync/README.md @@ -70,6 +70,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s SINGLE_FILE=1", + "-s STACK_SIZE=5MB", "-DQTS_SANITIZE_LEAK", "-fsanitize=leak", "-g2" diff --git a/packages/variant-quickjs-singlefile-browser-release-asyncify/Makefile b/packages/variant-quickjs-singlefile-browser-release-asyncify/Makefile index f53e8146..a2ec0c4e 100644 --- a/packages/variant-quickjs-singlefile-browser-release-asyncify/Makefile +++ b/packages/variant-quickjs-singlefile-browser-release-asyncify/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -86,6 +85,7 @@ CFLAGS_WASM+=-s FILESYSTEM=0 CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js CFLAGS_WASM+=-s SINGLE_FILE=1 +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_BROWSER+=-s ENVIRONMENT=web,worker diff --git a/packages/variant-quickjs-singlefile-browser-release-asyncify/README.md b/packages/variant-quickjs-singlefile-browser-release-asyncify/README.md index 18e25022..a8286b9b 100644 --- a/packages/variant-quickjs-singlefile-browser-release-asyncify/README.md +++ b/packages/variant-quickjs-singlefile-browser-release-asyncify/README.md @@ -73,6 +73,7 @@ Variant-specific Emscripten build flags: "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s STACK_SIZE=5MB" ] ``` diff --git a/packages/variant-quickjs-singlefile-browser-release-sync/Makefile b/packages/variant-quickjs-singlefile-browser-release-sync/Makefile index 1146faf5..a2945c15 100644 --- a/packages/variant-quickjs-singlefile-browser-release-sync/Makefile +++ b/packages/variant-quickjs-singlefile-browser-release-sync/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -79,6 +78,7 @@ CFLAGS_WASM+=-s FILESYSTEM=0 CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js CFLAGS_WASM+=-s SINGLE_FILE=1 +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_BROWSER+=-s ENVIRONMENT=web,worker diff --git a/packages/variant-quickjs-singlefile-browser-release-sync/README.md b/packages/variant-quickjs-singlefile-browser-release-sync/README.md index 1c708546..6092d13b 100644 --- a/packages/variant-quickjs-singlefile-browser-release-sync/README.md +++ b/packages/variant-quickjs-singlefile-browser-release-sync/README.md @@ -66,6 +66,7 @@ Variant-specific Emscripten build flags: "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s STACK_SIZE=5MB" ] ``` diff --git a/packages/variant-quickjs-singlefile-cjs-debug-asyncify/Makefile b/packages/variant-quickjs-singlefile-cjs-debug-asyncify/Makefile index 87928077..2d4a2e5d 100644 --- a/packages/variant-quickjs-singlefile-cjs-debug-asyncify/Makefile +++ b/packages/variant-quickjs-singlefile-cjs-debug-asyncify/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -89,6 +88,7 @@ CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-sourceMapJson.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js CFLAGS_WASM+=-s SINGLE_FILE=1 +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_WASM+=-O3 CFLAGS_CJS+=-s ENVIRONMENT=web,worker,node diff --git a/packages/variant-quickjs-singlefile-cjs-debug-asyncify/README.md b/packages/variant-quickjs-singlefile-cjs-debug-asyncify/README.md index b99a07f5..b44c5714 100644 --- a/packages/variant-quickjs-singlefile-cjs-debug-asyncify/README.md +++ b/packages/variant-quickjs-singlefile-cjs-debug-asyncify/README.md @@ -77,6 +77,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s SINGLE_FILE=1", + "-s STACK_SIZE=5MB", "-O3" ] ``` diff --git a/packages/variant-quickjs-singlefile-cjs-debug-sync/Makefile b/packages/variant-quickjs-singlefile-cjs-debug-sync/Makefile index 3b4463c7..898fe3dc 100644 --- a/packages/variant-quickjs-singlefile-cjs-debug-sync/Makefile +++ b/packages/variant-quickjs-singlefile-cjs-debug-sync/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -82,6 +81,7 @@ CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-sourceMapJson.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js CFLAGS_WASM+=-s SINGLE_FILE=1 +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_WASM+=-DQTS_SANITIZE_LEAK CFLAGS_WASM+=-fsanitize=leak CFLAGS_WASM+=-g2 diff --git a/packages/variant-quickjs-singlefile-cjs-debug-sync/README.md b/packages/variant-quickjs-singlefile-cjs-debug-sync/README.md index ffc735a7..d48fb303 100644 --- a/packages/variant-quickjs-singlefile-cjs-debug-sync/README.md +++ b/packages/variant-quickjs-singlefile-cjs-debug-sync/README.md @@ -70,6 +70,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s SINGLE_FILE=1", + "-s STACK_SIZE=5MB", "-DQTS_SANITIZE_LEAK", "-fsanitize=leak", "-g2" diff --git a/packages/variant-quickjs-singlefile-cjs-release-asyncify/Makefile b/packages/variant-quickjs-singlefile-cjs-release-asyncify/Makefile index 02db7231..a4e0522b 100644 --- a/packages/variant-quickjs-singlefile-cjs-release-asyncify/Makefile +++ b/packages/variant-quickjs-singlefile-cjs-release-asyncify/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -86,6 +85,7 @@ CFLAGS_WASM+=-s FILESYSTEM=0 CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js CFLAGS_WASM+=-s SINGLE_FILE=1 +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_CJS+=-s ENVIRONMENT=web,worker,node diff --git a/packages/variant-quickjs-singlefile-cjs-release-asyncify/README.md b/packages/variant-quickjs-singlefile-cjs-release-asyncify/README.md index 532103c9..c6733518 100644 --- a/packages/variant-quickjs-singlefile-cjs-release-asyncify/README.md +++ b/packages/variant-quickjs-singlefile-cjs-release-asyncify/README.md @@ -73,6 +73,7 @@ Variant-specific Emscripten build flags: "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s STACK_SIZE=5MB" ] ``` diff --git a/packages/variant-quickjs-singlefile-cjs-release-sync/Makefile b/packages/variant-quickjs-singlefile-cjs-release-sync/Makefile index 6544dc2a..eb5eff28 100644 --- a/packages/variant-quickjs-singlefile-cjs-release-sync/Makefile +++ b/packages/variant-quickjs-singlefile-cjs-release-sync/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -79,6 +78,7 @@ CFLAGS_WASM+=-s FILESYSTEM=0 CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js CFLAGS_WASM+=-s SINGLE_FILE=1 +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_CJS+=-s ENVIRONMENT=web,worker,node diff --git a/packages/variant-quickjs-singlefile-cjs-release-sync/README.md b/packages/variant-quickjs-singlefile-cjs-release-sync/README.md index e85c6210..f2b9c3e1 100644 --- a/packages/variant-quickjs-singlefile-cjs-release-sync/README.md +++ b/packages/variant-quickjs-singlefile-cjs-release-sync/README.md @@ -66,6 +66,7 @@ Variant-specific Emscripten build flags: "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s STACK_SIZE=5MB" ] ``` diff --git a/packages/variant-quickjs-singlefile-mjs-debug-asyncify/Makefile b/packages/variant-quickjs-singlefile-mjs-debug-asyncify/Makefile index 484eb232..2a9142f3 100644 --- a/packages/variant-quickjs-singlefile-mjs-debug-asyncify/Makefile +++ b/packages/variant-quickjs-singlefile-mjs-debug-asyncify/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -89,6 +88,7 @@ CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-sourceMapJson.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js CFLAGS_WASM+=-s SINGLE_FILE=1 +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_WASM+=-O3 CFLAGS_MJS+=-s ENVIRONMENT=node diff --git a/packages/variant-quickjs-singlefile-mjs-debug-asyncify/README.md b/packages/variant-quickjs-singlefile-mjs-debug-asyncify/README.md index 5d8e35e2..d9aefe7b 100644 --- a/packages/variant-quickjs-singlefile-mjs-debug-asyncify/README.md +++ b/packages/variant-quickjs-singlefile-mjs-debug-asyncify/README.md @@ -77,6 +77,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s SINGLE_FILE=1", + "-s STACK_SIZE=5MB", "-O3" ] ``` diff --git a/packages/variant-quickjs-singlefile-mjs-debug-sync/Makefile b/packages/variant-quickjs-singlefile-mjs-debug-sync/Makefile index d860f1b1..5fa52d50 100644 --- a/packages/variant-quickjs-singlefile-mjs-debug-sync/Makefile +++ b/packages/variant-quickjs-singlefile-mjs-debug-sync/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -82,6 +81,7 @@ CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-sourceMapJson.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js CFLAGS_WASM+=-s SINGLE_FILE=1 +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_WASM+=-DQTS_SANITIZE_LEAK CFLAGS_WASM+=-fsanitize=leak CFLAGS_WASM+=-g2 diff --git a/packages/variant-quickjs-singlefile-mjs-debug-sync/README.md b/packages/variant-quickjs-singlefile-mjs-debug-sync/README.md index a8380376..6c39525d 100644 --- a/packages/variant-quickjs-singlefile-mjs-debug-sync/README.md +++ b/packages/variant-quickjs-singlefile-mjs-debug-sync/README.md @@ -70,6 +70,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", "-s SINGLE_FILE=1", + "-s STACK_SIZE=5MB", "-DQTS_SANITIZE_LEAK", "-fsanitize=leak", "-g2" diff --git a/packages/variant-quickjs-singlefile-mjs-release-asyncify/Makefile b/packages/variant-quickjs-singlefile-mjs-release-asyncify/Makefile index 933420fc..df264ef4 100644 --- a/packages/variant-quickjs-singlefile-mjs-release-asyncify/Makefile +++ b/packages/variant-quickjs-singlefile-mjs-release-asyncify/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -86,6 +85,7 @@ CFLAGS_WASM+=-s FILESYSTEM=0 CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js CFLAGS_WASM+=-s SINGLE_FILE=1 +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_MJS+=-s ENVIRONMENT=node diff --git a/packages/variant-quickjs-singlefile-mjs-release-asyncify/README.md b/packages/variant-quickjs-singlefile-mjs-release-asyncify/README.md index d6b327d4..c1d8cb44 100644 --- a/packages/variant-quickjs-singlefile-mjs-release-asyncify/README.md +++ b/packages/variant-quickjs-singlefile-mjs-release-asyncify/README.md @@ -73,6 +73,7 @@ Variant-specific Emscripten build flags: "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s STACK_SIZE=5MB" ] ``` diff --git a/packages/variant-quickjs-singlefile-mjs-release-sync/Makefile b/packages/variant-quickjs-singlefile-mjs-release-sync/Makefile index bdb38fba..486066ae 100644 --- a/packages/variant-quickjs-singlefile-mjs-release-sync/Makefile +++ b/packages/variant-quickjs-singlefile-mjs-release-sync/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -79,6 +78,7 @@ CFLAGS_WASM+=-s FILESYSTEM=0 CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js CFLAGS_WASM+=-s SINGLE_FILE=1 +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_MJS+=-s ENVIRONMENT=node diff --git a/packages/variant-quickjs-singlefile-mjs-release-sync/README.md b/packages/variant-quickjs-singlefile-mjs-release-sync/README.md index 1a1801c2..02025285 100644 --- a/packages/variant-quickjs-singlefile-mjs-release-sync/README.md +++ b/packages/variant-quickjs-singlefile-mjs-release-sync/README.md @@ -66,6 +66,7 @@ Variant-specific Emscripten build flags: "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", - "-s SINGLE_FILE=1" + "-s SINGLE_FILE=1", + "-s STACK_SIZE=5MB" ] ``` diff --git a/packages/variant-quickjs-wasmfile-debug-asyncify/Makefile b/packages/variant-quickjs-wasmfile-debug-asyncify/Makefile index 8439dc44..6b75427e 100644 --- a/packages/variant-quickjs-wasmfile-debug-asyncify/Makefile +++ b/packages/variant-quickjs-wasmfile-debug-asyncify/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -88,6 +87,7 @@ CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-sourceMapJson.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_WASM+=-O3 CFLAGS_CJS+=-s ENVIRONMENT=node CFLAGS_MJS+=-s ENVIRONMENT=node diff --git a/packages/variant-quickjs-wasmfile-debug-asyncify/README.md b/packages/variant-quickjs-wasmfile-debug-asyncify/README.md index 2a559f55..fbbb8520 100644 --- a/packages/variant-quickjs-wasmfile-debug-asyncify/README.md +++ b/packages/variant-quickjs-wasmfile-debug-asyncify/README.md @@ -88,6 +88,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-sourceMapJson.js", "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s STACK_SIZE=5MB", "-O3" ] ``` diff --git a/packages/variant-quickjs-wasmfile-debug-sync/Makefile b/packages/variant-quickjs-wasmfile-debug-sync/Makefile index 43aa0e01..23c353c6 100644 --- a/packages/variant-quickjs-wasmfile-debug-sync/Makefile +++ b/packages/variant-quickjs-wasmfile-debug-sync/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -81,6 +80,7 @@ CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-sourceMapJson.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_WASM+=-DQTS_SANITIZE_LEAK CFLAGS_WASM+=-fsanitize=leak CFLAGS_WASM+=-g2 diff --git a/packages/variant-quickjs-wasmfile-debug-sync/README.md b/packages/variant-quickjs-wasmfile-debug-sync/README.md index 57a672a7..15b114be 100644 --- a/packages/variant-quickjs-wasmfile-debug-sync/README.md +++ b/packages/variant-quickjs-wasmfile-debug-sync/README.md @@ -81,6 +81,7 @@ Variant-specific Emscripten build flags: "--pre-js $(TEMPLATES)/pre-sourceMapJson.js", "--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js", "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s STACK_SIZE=5MB", "-DQTS_SANITIZE_LEAK", "-fsanitize=leak", "-g2" diff --git a/packages/variant-quickjs-wasmfile-release-asyncify/Makefile b/packages/variant-quickjs-wasmfile-release-asyncify/Makefile index aa201af7..bce631db 100644 --- a/packages/variant-quickjs-wasmfile-release-asyncify/Makefile +++ b/packages/variant-quickjs-wasmfile-release-asyncify/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -85,6 +84,7 @@ CFLAGS_WASM+=--closure 1 CFLAGS_WASM+=-s FILESYSTEM=0 CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_CJS+=-s ENVIRONMENT=node CFLAGS_MJS+=-s ENVIRONMENT=node CFLAGS_BROWSER+=-s ENVIRONMENT=web,worker diff --git a/packages/variant-quickjs-wasmfile-release-asyncify/README.md b/packages/variant-quickjs-wasmfile-release-asyncify/README.md index 0f41e6cf..0383ff66 100644 --- a/packages/variant-quickjs-wasmfile-release-asyncify/README.md +++ b/packages/variant-quickjs-wasmfile-release-asyncify/README.md @@ -84,6 +84,7 @@ Variant-specific Emscripten build flags: "--closure 1", "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", - "--pre-js $(TEMPLATES)/pre-wasmMemory.js" + "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s STACK_SIZE=5MB" ] ``` diff --git a/packages/variant-quickjs-wasmfile-release-sync/Makefile b/packages/variant-quickjs-wasmfile-release-sync/Makefile index 9e550759..3903fa6d 100644 --- a/packages/variant-quickjs-wasmfile-release-sync/Makefile +++ b/packages/variant-quickjs-wasmfile-release-sync/Makefile @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 @@ -78,6 +77,7 @@ CFLAGS_WASM+=--closure 1 CFLAGS_WASM+=-s FILESYSTEM=0 CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-extension.js CFLAGS_WASM+=--pre-js $(TEMPLATES)/pre-wasmMemory.js +CFLAGS_WASM+=-s STACK_SIZE=5MB CFLAGS_CJS+=-s ENVIRONMENT=node CFLAGS_MJS+=-s ENVIRONMENT=node CFLAGS_BROWSER+=-s ENVIRONMENT=web,worker diff --git a/packages/variant-quickjs-wasmfile-release-sync/README.md b/packages/variant-quickjs-wasmfile-release-sync/README.md index a95a36fb..3ca74479 100644 --- a/packages/variant-quickjs-wasmfile-release-sync/README.md +++ b/packages/variant-quickjs-wasmfile-release-sync/README.md @@ -77,6 +77,7 @@ Variant-specific Emscripten build flags: "--closure 1", "-s FILESYSTEM=0", "--pre-js $(TEMPLATES)/pre-extension.js", - "--pre-js $(TEMPLATES)/pre-wasmMemory.js" + "--pre-js $(TEMPLATES)/pre-wasmMemory.js", + "-s STACK_SIZE=5MB" ] ``` diff --git a/templates/Variant.mk b/templates/Variant.mk index 10251cf5..482134df 100644 --- a/templates/Variant.mk +++ b/templates/Variant.mk @@ -45,7 +45,6 @@ CFLAGS_WASM+=-s EXPORT_NAME=QuickJSRaw CFLAGS_WASM+=-s INVOKE_RUN=0 CFLAGS_WASM+=-s ALLOW_MEMORY_GROWTH=1 CFLAGS_WASM+=-s ALLOW_TABLE_GROWTH=1 -CFLAGS_WASM+=-s STACK_SIZE=5MB # CFLAGS_WASM+=-s MINIMAL_RUNTIME=1 # Appears to break MODULARIZE CFLAGS_WASM+=-s SUPPORT_ERRNO=0 diff --git a/yarn.lock b/yarn.lock index 67f78a5a..11477327 100644 --- a/yarn.lock +++ b/yarn.lock @@ -613,7 +613,7 @@ __metadata: languageName: node linkType: hard -"@jitl/quickjs-asmjs-mjs-release-sync@workspace:packages/variant-quickjs-asmjs-mjs-release-sync": +"@jitl/quickjs-asmjs-mjs-release-sync@workspace:*, @jitl/quickjs-asmjs-mjs-release-sync@workspace:packages/variant-quickjs-asmjs-mjs-release-sync": version: 0.0.0-use.local resolution: "@jitl/quickjs-asmjs-mjs-release-sync@workspace:packages/variant-quickjs-asmjs-mjs-release-sync" dependencies: @@ -5573,6 +5573,16 @@ __metadata: languageName: unknown linkType: soft +"quickjs-for-quickjs@workspace:packages/quickjs-for-quickjs": + version: 0.0.0-use.local + resolution: "quickjs-for-quickjs@workspace:packages/quickjs-for-quickjs" + dependencies: + "@jitl/quickjs-asmjs-mjs-release-sync": "workspace:*" + "@jitl/tsconfig": "workspace:*" + quickjs-emscripten-core: "workspace:*" + languageName: unknown + linkType: soft + "range-parser@npm:~1.2.1": version: 1.2.1 resolution: "range-parser@npm:1.2.1"