nuxt-ai-ready 2.5.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -12
- package/dist/chunks/agent-skills.mjs +35 -12
- package/dist/chunks/prerender.mjs +35 -24
- package/dist/cli.mjs +5 -2
- package/dist/module.d.mts +4 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +8 -4
- package/dist/runtime/app/index.d.ts +3 -0
- package/dist/runtime/app/index.js +2 -0
- package/dist/runtime/cache-control.d.ts +2 -0
- package/dist/runtime/cache-control.js +11 -0
- package/dist/runtime/llms-txt-utils.js +1 -1
- package/dist/runtime/server/db/context.d.ts +13 -0
- package/dist/runtime/server/db/drizzle/client.d.ts +6 -7
- package/dist/runtime/server/db/drizzle/client.js +13 -2
- package/dist/runtime/server/db/drizzle/providers/bun.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/bun.js +2 -2
- package/dist/runtime/server/db/drizzle/providers/d1.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/d1.js +3 -2
- package/dist/runtime/server/db/drizzle/providers/libsql.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/libsql.js +2 -2
- package/dist/runtime/server/db/drizzle/providers/neon.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/neon.js +2 -2
- package/dist/runtime/server/db/drizzle/providers/node-sqlite.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/node-sqlite.js +2 -2
- package/dist/runtime/server/db/drizzle/providers/postgres.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/postgres.js +2 -2
- package/dist/runtime/server/db/drizzle/queries.d.ts +27 -27
- package/dist/runtime/server/db/drizzle/queries.js +6 -5
- package/dist/runtime/server/db/drizzle/raw.d.ts +2 -6
- package/dist/runtime/server/db/index.d.ts +1 -1
- package/dist/runtime/server/db/index.js +1 -1
- package/dist/runtime/server/db/queries.d.ts +36 -36
- package/dist/runtime/server/db/queries.js +8 -9
- package/dist/runtime/server/db/seed.d.ts +2 -2
- package/dist/runtime/server/db/seed.js +4 -3
- package/dist/runtime/server/db/shared.d.ts +8 -0
- package/dist/runtime/server/db/shared.js +8 -2
- package/dist/runtime/server/index.d.ts +2 -0
- package/dist/runtime/server/index.js +17 -0
- package/dist/runtime/server/mcp/tools/get-page-markdown.js +1 -1
- package/dist/runtime/server/mcp/tools/list-pages.js +1 -1
- package/dist/runtime/server/mcp/tools/search-pages.js +1 -1
- package/dist/runtime/server/middleware/markdown.js +3 -3
- package/dist/runtime/server/middleware/markdown.prerender.js +1 -1
- package/dist/runtime/server/plugins/db-lifecycle-nitro3.d.ts +2 -0
- package/dist/runtime/server/plugins/db-lifecycle-nitro3.js +16 -0
- package/dist/runtime/server/plugins/html-capture.prerender.js +6 -4
- package/dist/runtime/server/plugins/link-header-nitro3.d.ts +2 -0
- package/dist/runtime/server/plugins/link-header-nitro3.js +20 -0
- package/dist/runtime/server/plugins/link-header.d.ts +6 -0
- package/dist/runtime/server/plugins/link-header.js +7 -11
- package/dist/runtime/server/plugins/markdown-negotiation.js +8 -1
- package/dist/runtime/server/plugins/sitemap-seeder.js +3 -3
- package/dist/runtime/server/routes/agent-skills-artifact.d.ts +1 -1
- package/dist/runtime/server/routes/agent-skills-artifact.js +10 -10
- package/dist/runtime/server/routes/agent-skills-index.d.ts +1 -1
- package/dist/runtime/server/routes/agent-skills-index.js +7 -6
- package/dist/runtime/server/routes/ai-catalog.d.ts +2 -1
- package/dist/runtime/server/routes/ai-catalog.js +7 -8
- package/dist/runtime/server/routes/api-catalog.d.ts +3 -1
- package/dist/runtime/server/routes/api-catalog.js +12 -12
- package/dist/runtime/server/routes/llms-full.txt.get.js +1 -1
- package/dist/runtime/server/routes/mcp-server-card.d.ts +1 -1
- package/dist/runtime/server/routes/mcp-server-card.js +7 -8
- package/dist/runtime/server/utils/checkStale.d.ts +2 -2
- package/dist/runtime/server/utils/cloudflare-prerendered.d.ts +3 -0
- package/dist/runtime/server/utils/cloudflare-prerendered.js +23 -0
- package/dist/runtime/server/utils/cloudflare.d.ts +5 -5
- package/dist/runtime/server/utils/cloudflare.js +31 -7
- package/dist/runtime/server/utils/content-negotiation.d.ts +5 -3
- package/dist/runtime/server/utils/content-negotiation.js +8 -7
- package/dist/runtime/server/utils/context.d.ts +3 -3
- package/dist/runtime/server/utils/context.js +1 -1
- package/dist/runtime/server/utils/discovery-response.d.ts +2 -0
- package/dist/runtime/server/utils/link-header.d.ts +5 -3
- package/dist/runtime/server/utils/link-header.js +26 -2
- package/dist/runtime/server/utils/markdown-request.d.ts +4 -3
- package/dist/runtime/server/utils/markdown-request.js +15 -13
- package/dist/runtime/server/utils/negotiation-decision.d.ts +4 -0
- package/dist/runtime/server/utils/negotiation-decision.js +6 -5
- package/dist/runtime/server/utils/negotiation-response.d.ts +1 -1
- package/dist/runtime/server/utils/negotiation-response.js +63 -23
- package/dist/runtime/server/utils/prerender-html.d.ts +2 -1
- package/dist/runtime/server/utils/prerender-html.js +3 -1
- package/dist/runtime/types.d.ts +15 -7
- package/dist/shared/nuxt-ai-ready.B3hAuOLQ.mjs +29 -0
- package/dist/shared/{nuxt-ai-ready.CLSWou20.mjs → nuxt-ai-ready.C34F0LJo.mjs} +560 -219
- package/package.json +85 -20
- package/skills/nuxt-ai-ready/SKILL.md +26 -12
- package/skills/nuxt-ai-ready/references/runtime-indexing.md +7 -6
- package/dist/runtime/server/db/drizzle/providers/sqlite.d.ts +0 -8
- package/dist/runtime/server/db/drizzle/providers/sqlite.js +0 -15
- package/node_modules/@mdream/js/LICENSE.md +0 -9
- package/node_modules/@mdream/js/README.md +0 -792
- package/node_modules/@mdream/js/bin/mdream.mjs +0 -2
- package/node_modules/@mdream/js/dist/_chunks/const.mjs +0 -134
- package/node_modules/@mdream/js/dist/_chunks/index.d.mts +0 -9
- package/node_modules/@mdream/js/dist/_chunks/markdown-processor.mjs +0 -1968
- package/node_modules/@mdream/js/dist/_chunks/minimal.d.mts +0 -6
- package/node_modules/@mdream/js/dist/_chunks/parse.mjs +0 -2756
- package/node_modules/@mdream/js/dist/_chunks/plugins.mjs +0 -725
- package/node_modules/@mdream/js/dist/_chunks/resolve-plugins.mjs +0 -44
- package/node_modules/@mdream/js/dist/_chunks/stream.mjs +0 -37
- package/node_modules/@mdream/js/dist/_chunks/types.d.mts +0 -473
- package/node_modules/@mdream/js/dist/cli.d.mts +0 -1
- package/node_modules/@mdream/js/dist/cli.mjs +0 -32
- package/node_modules/@mdream/js/dist/core.d.mts +0 -15
- package/node_modules/@mdream/js/dist/core.mjs +0 -28
- package/node_modules/@mdream/js/dist/index.d.mts +0 -4
- package/node_modules/@mdream/js/dist/index.mjs +0 -58
- package/node_modules/@mdream/js/dist/llms-txt.d.mts +0 -86
- package/node_modules/@mdream/js/dist/llms-txt.mjs +0 -308
- package/node_modules/@mdream/js/dist/negotiate.d.mts +0 -35
- package/node_modules/@mdream/js/dist/negotiate.mjs +0 -121
- package/node_modules/@mdream/js/dist/parse.d.mts +0 -90
- package/node_modules/@mdream/js/dist/parse.mjs +0 -2
- package/node_modules/@mdream/js/dist/plugins.d.mts +0 -85
- package/node_modules/@mdream/js/dist/plugins.mjs +0 -2
- package/node_modules/@mdream/js/dist/preset/minimal.d.mts +0 -2
- package/node_modules/@mdream/js/dist/preset/minimal.mjs +0 -33
- package/node_modules/@mdream/js/dist/splitter.d.mts +0 -18
- package/node_modules/@mdream/js/dist/splitter.mjs +0 -194
- package/node_modules/@mdream/js/package.json +0 -103
- package/node_modules/cac/LICENSE +0 -21
- package/node_modules/cac/README.md +0 -492
- package/node_modules/cac/dist/index.d.ts +0 -196
- package/node_modules/cac/dist/index.js +0 -638
- package/node_modules/cac/package.json +0 -72
- package/node_modules/mdream/LICENSE.md +0 -9
- package/node_modules/mdream/README.md +0 -1091
- package/node_modules/mdream/bin/mdream.mjs +0 -46
- package/node_modules/mdream/dist/browser.d.mts +0 -105
- package/node_modules/mdream/dist/browser.mjs +0 -262
- package/node_modules/mdream/dist/edge.d.mts +0 -100
- package/node_modules/mdream/dist/edge.mjs +0 -250
- package/node_modules/mdream/dist/iife.js +0 -605
- package/node_modules/mdream/dist/index.d.mts +0 -89
- package/node_modules/mdream/dist/index.mjs +0 -184
- package/node_modules/mdream/dist/wasm.d.mts +0 -100
- package/node_modules/mdream/dist/wasm.mjs +0 -140
- package/node_modules/mdream/dist/worker.d.mts +0 -101
- package/node_modules/mdream/dist/worker.mjs +0 -217
- package/node_modules/mdream/napi/index.d.mts +0 -127
- package/node_modules/mdream/napi/index.d.ts +0 -127
- package/node_modules/mdream/napi/index.mjs +0 -725
- package/node_modules/mdream/napi/rust.android-arm-eabi.node +0 -0
- package/node_modules/mdream/napi/rust.android-arm64.node +0 -0
- package/node_modules/mdream/napi/rust.darwin-arm64.node +0 -0
- package/node_modules/mdream/napi/rust.darwin-x64.node +0 -0
- package/node_modules/mdream/napi/rust.freebsd-x64.node +0 -0
- package/node_modules/mdream/napi/rust.linux-arm-gnueabihf.node +0 -0
- package/node_modules/mdream/napi/rust.linux-arm64-gnu.node +0 -0
- package/node_modules/mdream/napi/rust.linux-arm64-musl.node +0 -0
- package/node_modules/mdream/napi/rust.linux-x64-gnu.node +0 -0
- package/node_modules/mdream/napi/rust.linux-x64-musl.node +0 -0
- package/node_modules/mdream/napi/rust.wasi.cjs +0 -2144
- package/node_modules/mdream/napi/rust.wasm32-wasi.wasm +0 -0
- package/node_modules/mdream/napi/rust.win32-arm64-msvc.node +0 -0
- package/node_modules/mdream/napi/rust.win32-x64-msvc.node +0 -0
- package/node_modules/mdream/node_modules/@emnapi/core/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@emnapi/core/README.md +0 -1
- package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.d.ts +0 -392
- package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.d.ts +0 -392
- package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.js +0 -8351
- package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.js +0 -7268
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.d.ts +0 -5
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.js +0 -843
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.d.ts +0 -4
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.js +0 -3
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.d.ts +0 -5
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.js +0 -1010
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.d.ts +0 -5
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.js +0 -1446
- package/node_modules/mdream/node_modules/@emnapi/core/package.json +0 -39
- package/node_modules/mdream/node_modules/@emnapi/core/rollup.config.js +0 -60
- package/node_modules/mdream/node_modules/@emnapi/runtime/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@emnapi/runtime/README.md +0 -1
- package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.d.ts +0 -833
- package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js +0 -2306
- package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js.map +0 -1
- package/node_modules/mdream/node_modules/@emnapi/runtime/index.cjs +0 -63
- package/node_modules/mdream/node_modules/@emnapi/runtime/package.json +0 -39
- package/node_modules/mdream/node_modules/@emnapi/runtime/rollup.config.js +0 -25
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/README.md +0 -203
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -236
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +0 -1086
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/package.json +0 -35
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/rollup.config.js +0 -6
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.cjs +0 -1472
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.js +0 -1470
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +0 -237
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs.js +0 -18260
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +0 -317
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/package.json +0 -67
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.cjs +0 -39
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.js +0 -36
- package/node_modules/mdream/node_modules/@tybys/wasm-util/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@tybys/wasm-util/README.md +0 -193
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/tsdoc-metadata.json +0 -11
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +0 -423
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +0 -2932
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +0 -2932
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +0 -1
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.js +0 -2954
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +0 -1
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/asyncify.js +0 -158
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/index.js +0 -13
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/jspi.js +0 -46
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/load.js +0 -97
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/memory.js +0 -35
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/error.js +0 -103
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fd.js +0 -268
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fs.js +0 -3
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +0 -192
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/path.js +0 -316
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +0 -1599
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/rights.js +0 -141
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/types.js +0 -220
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/util.js +0 -128
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/webassembly.js +0 -13
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/asyncify.mjs +0 -153
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/index.mjs +0 -9
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/jspi.mjs +0 -39
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/load.mjs +0 -89
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/memory.mjs +0 -28
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/error.mjs +0 -97
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fd.mjs +0 -256
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fs.mjs +0 -1
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +0 -186
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/path.mjs +0 -310
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +0 -1593
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs +0 -135
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs +0 -216
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs +0 -113
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs +0 -9
- package/node_modules/mdream/node_modules/@tybys/wasm-util/package.json +0 -58
- package/node_modules/mdream/node_modules/tslib/CopyrightNotice.txt +0 -15
- package/node_modules/mdream/node_modules/tslib/LICENSE.txt +0 -12
- package/node_modules/mdream/node_modules/tslib/README.md +0 -164
- package/node_modules/mdream/node_modules/tslib/SECURITY.md +0 -41
- package/node_modules/mdream/node_modules/tslib/modules/index.d.ts +0 -38
- package/node_modules/mdream/node_modules/tslib/modules/index.js +0 -70
- package/node_modules/mdream/node_modules/tslib/modules/package.json +0 -3
- package/node_modules/mdream/node_modules/tslib/package.json +0 -47
- package/node_modules/mdream/node_modules/tslib/tslib.d.ts +0 -460
- package/node_modules/mdream/node_modules/tslib/tslib.es6.html +0 -1
- package/node_modules/mdream/node_modules/tslib/tslib.es6.js +0 -402
- package/node_modules/mdream/node_modules/tslib/tslib.es6.mjs +0 -401
- package/node_modules/mdream/node_modules/tslib/tslib.html +0 -1
- package/node_modules/mdream/node_modules/tslib/tslib.js +0 -484
- package/node_modules/mdream/package.json +0 -110
- package/node_modules/mdream/skills/mdream/SKILL.md +0 -124
- package/node_modules/mdream/skills/mdream/references/runtimes.md +0 -49
- package/node_modules/mdream/wasm/mdream_edge.d.ts +0 -90
- package/node_modules/mdream/wasm/mdream_edge.js +0 -517
- package/node_modules/mdream/wasm/mdream_edge_bg.wasm +0 -0
- package/node_modules/mdream/wasm/mdream_edge_bg.wasm.d.ts +0 -20
- package/node_modules/mdream/wasm/package.json +0 -17
- package/node_modules/mdream/wasm-bundler/mdream_edge.d.ts +0 -45
- package/node_modules/mdream/wasm-bundler/mdream_edge.js +0 -13
- package/node_modules/mdream/wasm-bundler/mdream_edge_bg.js +0 -413
- package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm +0 -0
- package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm.d.ts +0 -20
- package/node_modules/mdream/wasm-bundler/package.json +0 -19
- package/node_modules/pathe/LICENSE +0 -70
- package/node_modules/pathe/README.md +0 -73
- package/node_modules/pathe/dist/index.cjs +0 -39
- package/node_modules/pathe/dist/index.d.cts +0 -47
- package/node_modules/pathe/dist/index.d.mts +0 -47
- package/node_modules/pathe/dist/index.d.ts +0 -47
- package/node_modules/pathe/dist/index.mjs +0 -19
- package/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs +0 -266
- package/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -249
- package/node_modules/pathe/dist/utils.cjs +0 -82
- package/node_modules/pathe/dist/utils.d.cts +0 -32
- package/node_modules/pathe/dist/utils.d.mts +0 -32
- package/node_modules/pathe/dist/utils.d.ts +0 -32
- package/node_modules/pathe/dist/utils.mjs +0 -77
- package/node_modules/pathe/package.json +0 -61
- package/node_modules/pathe/utils.d.ts +0 -1
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRights = exports.TTY_INHERITING = exports.TTY_BASE = exports.SOCKET_INHERITING = exports.SOCKET_BASE = exports.DIRECTORY_INHERITING = exports.DIRECTORY_BASE = exports.REGULAR_FILE_INHERITING = exports.REGULAR_FILE_BASE = exports.CHARACTER_DEVICE_INHERITING = exports.CHARACTER_DEVICE_BASE = exports.BLOCK_DEVICE_INHERITING = exports.BLOCK_DEVICE_BASE = exports.RIGHTS_ALL = void 0;
|
|
4
|
-
/* eslint-disable spaced-comment */
|
|
5
|
-
const error_1 = require("./error");
|
|
6
|
-
const types_1 = require("./types");
|
|
7
|
-
exports.RIGHTS_ALL = types_1.WasiRights.FD_DATASYNC |
|
|
8
|
-
types_1.WasiRights.FD_READ |
|
|
9
|
-
types_1.WasiRights.FD_SEEK |
|
|
10
|
-
types_1.WasiRights.FD_FDSTAT_SET_FLAGS |
|
|
11
|
-
types_1.WasiRights.FD_SYNC |
|
|
12
|
-
types_1.WasiRights.FD_TELL |
|
|
13
|
-
types_1.WasiRights.FD_WRITE |
|
|
14
|
-
types_1.WasiRights.FD_ADVISE |
|
|
15
|
-
types_1.WasiRights.FD_ALLOCATE |
|
|
16
|
-
types_1.WasiRights.PATH_CREATE_DIRECTORY |
|
|
17
|
-
types_1.WasiRights.PATH_CREATE_FILE |
|
|
18
|
-
types_1.WasiRights.PATH_LINK_SOURCE |
|
|
19
|
-
types_1.WasiRights.PATH_LINK_TARGET |
|
|
20
|
-
types_1.WasiRights.PATH_OPEN |
|
|
21
|
-
types_1.WasiRights.FD_READDIR |
|
|
22
|
-
types_1.WasiRights.PATH_READLINK |
|
|
23
|
-
types_1.WasiRights.PATH_RENAME_SOURCE |
|
|
24
|
-
types_1.WasiRights.PATH_RENAME_TARGET |
|
|
25
|
-
types_1.WasiRights.PATH_FILESTAT_GET |
|
|
26
|
-
types_1.WasiRights.PATH_FILESTAT_SET_SIZE |
|
|
27
|
-
types_1.WasiRights.PATH_FILESTAT_SET_TIMES |
|
|
28
|
-
types_1.WasiRights.FD_FILESTAT_GET |
|
|
29
|
-
types_1.WasiRights.FD_FILESTAT_SET_TIMES |
|
|
30
|
-
types_1.WasiRights.FD_FILESTAT_SET_SIZE |
|
|
31
|
-
types_1.WasiRights.PATH_SYMLINK |
|
|
32
|
-
types_1.WasiRights.PATH_UNLINK_FILE |
|
|
33
|
-
types_1.WasiRights.PATH_REMOVE_DIRECTORY |
|
|
34
|
-
types_1.WasiRights.POLL_FD_READWRITE |
|
|
35
|
-
types_1.WasiRights.SOCK_SHUTDOWN |
|
|
36
|
-
types_1.WasiRights.SOCK_ACCEPT;
|
|
37
|
-
exports.BLOCK_DEVICE_BASE = exports.RIGHTS_ALL;
|
|
38
|
-
exports.BLOCK_DEVICE_INHERITING = exports.RIGHTS_ALL;
|
|
39
|
-
exports.CHARACTER_DEVICE_BASE = exports.RIGHTS_ALL;
|
|
40
|
-
exports.CHARACTER_DEVICE_INHERITING = exports.RIGHTS_ALL;
|
|
41
|
-
exports.REGULAR_FILE_BASE = types_1.WasiRights.FD_DATASYNC |
|
|
42
|
-
types_1.WasiRights.FD_READ |
|
|
43
|
-
types_1.WasiRights.FD_SEEK |
|
|
44
|
-
types_1.WasiRights.FD_FDSTAT_SET_FLAGS |
|
|
45
|
-
types_1.WasiRights.FD_SYNC |
|
|
46
|
-
types_1.WasiRights.FD_TELL |
|
|
47
|
-
types_1.WasiRights.FD_WRITE |
|
|
48
|
-
types_1.WasiRights.FD_ADVISE |
|
|
49
|
-
types_1.WasiRights.FD_ALLOCATE |
|
|
50
|
-
types_1.WasiRights.FD_FILESTAT_GET |
|
|
51
|
-
types_1.WasiRights.FD_FILESTAT_SET_SIZE |
|
|
52
|
-
types_1.WasiRights.FD_FILESTAT_SET_TIMES |
|
|
53
|
-
types_1.WasiRights.POLL_FD_READWRITE;
|
|
54
|
-
exports.REGULAR_FILE_INHERITING = BigInt(0);
|
|
55
|
-
exports.DIRECTORY_BASE = types_1.WasiRights.FD_FDSTAT_SET_FLAGS |
|
|
56
|
-
types_1.WasiRights.FD_SYNC |
|
|
57
|
-
types_1.WasiRights.FD_ADVISE |
|
|
58
|
-
types_1.WasiRights.PATH_CREATE_DIRECTORY |
|
|
59
|
-
types_1.WasiRights.PATH_CREATE_FILE |
|
|
60
|
-
types_1.WasiRights.PATH_LINK_SOURCE |
|
|
61
|
-
types_1.WasiRights.PATH_LINK_TARGET |
|
|
62
|
-
types_1.WasiRights.PATH_OPEN |
|
|
63
|
-
types_1.WasiRights.FD_READDIR |
|
|
64
|
-
types_1.WasiRights.PATH_READLINK |
|
|
65
|
-
types_1.WasiRights.PATH_RENAME_SOURCE |
|
|
66
|
-
types_1.WasiRights.PATH_RENAME_TARGET |
|
|
67
|
-
types_1.WasiRights.PATH_FILESTAT_GET |
|
|
68
|
-
types_1.WasiRights.PATH_FILESTAT_SET_SIZE |
|
|
69
|
-
types_1.WasiRights.PATH_FILESTAT_SET_TIMES |
|
|
70
|
-
types_1.WasiRights.FD_FILESTAT_GET |
|
|
71
|
-
types_1.WasiRights.FD_FILESTAT_SET_TIMES |
|
|
72
|
-
types_1.WasiRights.PATH_SYMLINK |
|
|
73
|
-
types_1.WasiRights.PATH_UNLINK_FILE |
|
|
74
|
-
types_1.WasiRights.PATH_REMOVE_DIRECTORY |
|
|
75
|
-
types_1.WasiRights.POLL_FD_READWRITE;
|
|
76
|
-
exports.DIRECTORY_INHERITING = exports.DIRECTORY_BASE | exports.REGULAR_FILE_BASE;
|
|
77
|
-
exports.SOCKET_BASE = (types_1.WasiRights.FD_READ |
|
|
78
|
-
types_1.WasiRights.FD_FDSTAT_SET_FLAGS |
|
|
79
|
-
types_1.WasiRights.FD_WRITE |
|
|
80
|
-
types_1.WasiRights.FD_FILESTAT_GET |
|
|
81
|
-
types_1.WasiRights.POLL_FD_READWRITE |
|
|
82
|
-
types_1.WasiRights.SOCK_SHUTDOWN);
|
|
83
|
-
exports.SOCKET_INHERITING = exports.RIGHTS_ALL;
|
|
84
|
-
exports.TTY_BASE = types_1.WasiRights.FD_READ |
|
|
85
|
-
types_1.WasiRights.FD_FDSTAT_SET_FLAGS |
|
|
86
|
-
types_1.WasiRights.FD_WRITE |
|
|
87
|
-
types_1.WasiRights.FD_FILESTAT_GET |
|
|
88
|
-
types_1.WasiRights.POLL_FD_READWRITE;
|
|
89
|
-
exports.TTY_INHERITING = BigInt(0);
|
|
90
|
-
function getRights(stdio, fd, flags, type) {
|
|
91
|
-
const ret = {
|
|
92
|
-
base: BigInt(0),
|
|
93
|
-
inheriting: BigInt(0)
|
|
94
|
-
};
|
|
95
|
-
if (type === types_1.WasiFileType.UNKNOWN) {
|
|
96
|
-
throw new error_1.WasiError('Unknown file type', types_1.WasiErrno.EINVAL);
|
|
97
|
-
}
|
|
98
|
-
switch (type) {
|
|
99
|
-
case types_1.WasiFileType.REGULAR_FILE:
|
|
100
|
-
ret.base = exports.REGULAR_FILE_BASE;
|
|
101
|
-
ret.inheriting = exports.REGULAR_FILE_INHERITING;
|
|
102
|
-
break;
|
|
103
|
-
case types_1.WasiFileType.DIRECTORY:
|
|
104
|
-
ret.base = exports.DIRECTORY_BASE;
|
|
105
|
-
ret.inheriting = exports.DIRECTORY_INHERITING;
|
|
106
|
-
break;
|
|
107
|
-
case types_1.WasiFileType.SOCKET_STREAM:
|
|
108
|
-
case types_1.WasiFileType.SOCKET_DGRAM:
|
|
109
|
-
ret.base = exports.SOCKET_BASE;
|
|
110
|
-
ret.inheriting = exports.SOCKET_INHERITING;
|
|
111
|
-
break;
|
|
112
|
-
case types_1.WasiFileType.CHARACTER_DEVICE:
|
|
113
|
-
if (stdio.indexOf(fd) !== -1) {
|
|
114
|
-
ret.base = exports.TTY_BASE;
|
|
115
|
-
ret.inheriting = exports.TTY_INHERITING;
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
ret.base = exports.CHARACTER_DEVICE_BASE;
|
|
119
|
-
ret.inheriting = exports.CHARACTER_DEVICE_INHERITING;
|
|
120
|
-
}
|
|
121
|
-
break;
|
|
122
|
-
case types_1.WasiFileType.BLOCK_DEVICE:
|
|
123
|
-
ret.base = exports.BLOCK_DEVICE_BASE;
|
|
124
|
-
ret.inheriting = exports.BLOCK_DEVICE_INHERITING;
|
|
125
|
-
break;
|
|
126
|
-
default:
|
|
127
|
-
ret.base = BigInt(0);
|
|
128
|
-
ret.inheriting = BigInt(0);
|
|
129
|
-
}
|
|
130
|
-
/* Disable read/write bits depending on access mode. */
|
|
131
|
-
const read_or_write_only = flags & (0 | 1 | 2);
|
|
132
|
-
if (read_or_write_only === 0) {
|
|
133
|
-
ret.base &= ~types_1.WasiRights.FD_WRITE;
|
|
134
|
-
}
|
|
135
|
-
else if (read_or_write_only === 1) {
|
|
136
|
-
ret.base &= ~types_1.WasiRights.FD_READ;
|
|
137
|
-
}
|
|
138
|
-
return ret;
|
|
139
|
-
}
|
|
140
|
-
exports.getRights = getRights;
|
|
141
|
-
//# sourceMappingURL=rights.js.map
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WasiSubclockflags = exports.WasiEventType = exports.WasiFstFlag = exports.WasiClockid = exports.WasiFdFlag = exports.WasiFileControlFlag = exports.FileControlFlag = exports.WasiWhence = exports.WasiRights = exports.WasiFileType = exports.WasiErrno = void 0;
|
|
4
|
-
/* eslint-disable spaced-comment */
|
|
5
|
-
var WasiErrno;
|
|
6
|
-
(function (WasiErrno) {
|
|
7
|
-
WasiErrno[WasiErrno["ESUCCESS"] = 0] = "ESUCCESS";
|
|
8
|
-
WasiErrno[WasiErrno["E2BIG"] = 1] = "E2BIG";
|
|
9
|
-
WasiErrno[WasiErrno["EACCES"] = 2] = "EACCES";
|
|
10
|
-
WasiErrno[WasiErrno["EADDRINUSE"] = 3] = "EADDRINUSE";
|
|
11
|
-
WasiErrno[WasiErrno["EADDRNOTAVAIL"] = 4] = "EADDRNOTAVAIL";
|
|
12
|
-
WasiErrno[WasiErrno["EAFNOSUPPORT"] = 5] = "EAFNOSUPPORT";
|
|
13
|
-
WasiErrno[WasiErrno["EAGAIN"] = 6] = "EAGAIN";
|
|
14
|
-
WasiErrno[WasiErrno["EALREADY"] = 7] = "EALREADY";
|
|
15
|
-
WasiErrno[WasiErrno["EBADF"] = 8] = "EBADF";
|
|
16
|
-
WasiErrno[WasiErrno["EBADMSG"] = 9] = "EBADMSG";
|
|
17
|
-
WasiErrno[WasiErrno["EBUSY"] = 10] = "EBUSY";
|
|
18
|
-
WasiErrno[WasiErrno["ECANCELED"] = 11] = "ECANCELED";
|
|
19
|
-
WasiErrno[WasiErrno["ECHILD"] = 12] = "ECHILD";
|
|
20
|
-
WasiErrno[WasiErrno["ECONNABORTED"] = 13] = "ECONNABORTED";
|
|
21
|
-
WasiErrno[WasiErrno["ECONNREFUSED"] = 14] = "ECONNREFUSED";
|
|
22
|
-
WasiErrno[WasiErrno["ECONNRESET"] = 15] = "ECONNRESET";
|
|
23
|
-
WasiErrno[WasiErrno["EDEADLK"] = 16] = "EDEADLK";
|
|
24
|
-
WasiErrno[WasiErrno["EDESTADDRREQ"] = 17] = "EDESTADDRREQ";
|
|
25
|
-
WasiErrno[WasiErrno["EDOM"] = 18] = "EDOM";
|
|
26
|
-
WasiErrno[WasiErrno["EDQUOT"] = 19] = "EDQUOT";
|
|
27
|
-
WasiErrno[WasiErrno["EEXIST"] = 20] = "EEXIST";
|
|
28
|
-
WasiErrno[WasiErrno["EFAULT"] = 21] = "EFAULT";
|
|
29
|
-
WasiErrno[WasiErrno["EFBIG"] = 22] = "EFBIG";
|
|
30
|
-
WasiErrno[WasiErrno["EHOSTUNREACH"] = 23] = "EHOSTUNREACH";
|
|
31
|
-
WasiErrno[WasiErrno["EIDRM"] = 24] = "EIDRM";
|
|
32
|
-
WasiErrno[WasiErrno["EILSEQ"] = 25] = "EILSEQ";
|
|
33
|
-
WasiErrno[WasiErrno["EINPROGRESS"] = 26] = "EINPROGRESS";
|
|
34
|
-
WasiErrno[WasiErrno["EINTR"] = 27] = "EINTR";
|
|
35
|
-
WasiErrno[WasiErrno["EINVAL"] = 28] = "EINVAL";
|
|
36
|
-
WasiErrno[WasiErrno["EIO"] = 29] = "EIO";
|
|
37
|
-
WasiErrno[WasiErrno["EISCONN"] = 30] = "EISCONN";
|
|
38
|
-
WasiErrno[WasiErrno["EISDIR"] = 31] = "EISDIR";
|
|
39
|
-
WasiErrno[WasiErrno["ELOOP"] = 32] = "ELOOP";
|
|
40
|
-
WasiErrno[WasiErrno["EMFILE"] = 33] = "EMFILE";
|
|
41
|
-
WasiErrno[WasiErrno["EMLINK"] = 34] = "EMLINK";
|
|
42
|
-
WasiErrno[WasiErrno["EMSGSIZE"] = 35] = "EMSGSIZE";
|
|
43
|
-
WasiErrno[WasiErrno["EMULTIHOP"] = 36] = "EMULTIHOP";
|
|
44
|
-
WasiErrno[WasiErrno["ENAMETOOLONG"] = 37] = "ENAMETOOLONG";
|
|
45
|
-
WasiErrno[WasiErrno["ENETDOWN"] = 38] = "ENETDOWN";
|
|
46
|
-
WasiErrno[WasiErrno["ENETRESET"] = 39] = "ENETRESET";
|
|
47
|
-
WasiErrno[WasiErrno["ENETUNREACH"] = 40] = "ENETUNREACH";
|
|
48
|
-
WasiErrno[WasiErrno["ENFILE"] = 41] = "ENFILE";
|
|
49
|
-
WasiErrno[WasiErrno["ENOBUFS"] = 42] = "ENOBUFS";
|
|
50
|
-
WasiErrno[WasiErrno["ENODEV"] = 43] = "ENODEV";
|
|
51
|
-
WasiErrno[WasiErrno["ENOENT"] = 44] = "ENOENT";
|
|
52
|
-
WasiErrno[WasiErrno["ENOEXEC"] = 45] = "ENOEXEC";
|
|
53
|
-
WasiErrno[WasiErrno["ENOLCK"] = 46] = "ENOLCK";
|
|
54
|
-
WasiErrno[WasiErrno["ENOLINK"] = 47] = "ENOLINK";
|
|
55
|
-
WasiErrno[WasiErrno["ENOMEM"] = 48] = "ENOMEM";
|
|
56
|
-
WasiErrno[WasiErrno["ENOMSG"] = 49] = "ENOMSG";
|
|
57
|
-
WasiErrno[WasiErrno["ENOPROTOOPT"] = 50] = "ENOPROTOOPT";
|
|
58
|
-
WasiErrno[WasiErrno["ENOSPC"] = 51] = "ENOSPC";
|
|
59
|
-
WasiErrno[WasiErrno["ENOSYS"] = 52] = "ENOSYS";
|
|
60
|
-
WasiErrno[WasiErrno["ENOTCONN"] = 53] = "ENOTCONN";
|
|
61
|
-
WasiErrno[WasiErrno["ENOTDIR"] = 54] = "ENOTDIR";
|
|
62
|
-
WasiErrno[WasiErrno["ENOTEMPTY"] = 55] = "ENOTEMPTY";
|
|
63
|
-
WasiErrno[WasiErrno["ENOTRECOVERABLE"] = 56] = "ENOTRECOVERABLE";
|
|
64
|
-
WasiErrno[WasiErrno["ENOTSOCK"] = 57] = "ENOTSOCK";
|
|
65
|
-
WasiErrno[WasiErrno["ENOTSUP"] = 58] = "ENOTSUP";
|
|
66
|
-
WasiErrno[WasiErrno["ENOTTY"] = 59] = "ENOTTY";
|
|
67
|
-
WasiErrno[WasiErrno["ENXIO"] = 60] = "ENXIO";
|
|
68
|
-
WasiErrno[WasiErrno["EOVERFLOW"] = 61] = "EOVERFLOW";
|
|
69
|
-
WasiErrno[WasiErrno["EOWNERDEAD"] = 62] = "EOWNERDEAD";
|
|
70
|
-
WasiErrno[WasiErrno["EPERM"] = 63] = "EPERM";
|
|
71
|
-
WasiErrno[WasiErrno["EPIPE"] = 64] = "EPIPE";
|
|
72
|
-
WasiErrno[WasiErrno["EPROTO"] = 65] = "EPROTO";
|
|
73
|
-
WasiErrno[WasiErrno["EPROTONOSUPPORT"] = 66] = "EPROTONOSUPPORT";
|
|
74
|
-
WasiErrno[WasiErrno["EPROTOTYPE"] = 67] = "EPROTOTYPE";
|
|
75
|
-
WasiErrno[WasiErrno["ERANGE"] = 68] = "ERANGE";
|
|
76
|
-
WasiErrno[WasiErrno["EROFS"] = 69] = "EROFS";
|
|
77
|
-
WasiErrno[WasiErrno["ESPIPE"] = 70] = "ESPIPE";
|
|
78
|
-
WasiErrno[WasiErrno["ESRCH"] = 71] = "ESRCH";
|
|
79
|
-
WasiErrno[WasiErrno["ESTALE"] = 72] = "ESTALE";
|
|
80
|
-
WasiErrno[WasiErrno["ETIMEDOUT"] = 73] = "ETIMEDOUT";
|
|
81
|
-
WasiErrno[WasiErrno["ETXTBSY"] = 74] = "ETXTBSY";
|
|
82
|
-
WasiErrno[WasiErrno["EXDEV"] = 75] = "EXDEV";
|
|
83
|
-
WasiErrno[WasiErrno["ENOTCAPABLE"] = 76] = "ENOTCAPABLE";
|
|
84
|
-
})(WasiErrno = exports.WasiErrno || (exports.WasiErrno = {}));
|
|
85
|
-
var WasiFileType;
|
|
86
|
-
(function (WasiFileType) {
|
|
87
|
-
WasiFileType[WasiFileType["UNKNOWN"] = 0] = "UNKNOWN";
|
|
88
|
-
WasiFileType[WasiFileType["BLOCK_DEVICE"] = 1] = "BLOCK_DEVICE";
|
|
89
|
-
WasiFileType[WasiFileType["CHARACTER_DEVICE"] = 2] = "CHARACTER_DEVICE";
|
|
90
|
-
WasiFileType[WasiFileType["DIRECTORY"] = 3] = "DIRECTORY";
|
|
91
|
-
WasiFileType[WasiFileType["REGULAR_FILE"] = 4] = "REGULAR_FILE";
|
|
92
|
-
WasiFileType[WasiFileType["SOCKET_DGRAM"] = 5] = "SOCKET_DGRAM";
|
|
93
|
-
WasiFileType[WasiFileType["SOCKET_STREAM"] = 6] = "SOCKET_STREAM";
|
|
94
|
-
WasiFileType[WasiFileType["SYMBOLIC_LINK"] = 7] = "SYMBOLIC_LINK";
|
|
95
|
-
})(WasiFileType = exports.WasiFileType || (exports.WasiFileType = {}));
|
|
96
|
-
const FD_DATASYNC = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(0));
|
|
97
|
-
const FD_READ = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(1));
|
|
98
|
-
const FD_SEEK = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(2));
|
|
99
|
-
const FD_FDSTAT_SET_FLAGS = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(3));
|
|
100
|
-
const FD_SYNC = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(4));
|
|
101
|
-
const FD_TELL = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(5));
|
|
102
|
-
const FD_WRITE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(6));
|
|
103
|
-
const FD_ADVISE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(7));
|
|
104
|
-
const FD_ALLOCATE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(8));
|
|
105
|
-
const PATH_CREATE_DIRECTORY = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(9));
|
|
106
|
-
const PATH_CREATE_FILE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(10));
|
|
107
|
-
const PATH_LINK_SOURCE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(11));
|
|
108
|
-
const PATH_LINK_TARGET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(12));
|
|
109
|
-
const PATH_OPEN = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(13));
|
|
110
|
-
const FD_READDIR = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(14));
|
|
111
|
-
const PATH_READLINK = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(15));
|
|
112
|
-
const PATH_RENAME_SOURCE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(16));
|
|
113
|
-
const PATH_RENAME_TARGET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(17));
|
|
114
|
-
const PATH_FILESTAT_GET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(18));
|
|
115
|
-
const PATH_FILESTAT_SET_SIZE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(19));
|
|
116
|
-
const PATH_FILESTAT_SET_TIMES = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(20));
|
|
117
|
-
const FD_FILESTAT_GET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(21));
|
|
118
|
-
const FD_FILESTAT_SET_SIZE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(22));
|
|
119
|
-
const FD_FILESTAT_SET_TIMES = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(23));
|
|
120
|
-
const PATH_SYMLINK = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(24));
|
|
121
|
-
const PATH_REMOVE_DIRECTORY = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(25));
|
|
122
|
-
const PATH_UNLINK_FILE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(26));
|
|
123
|
-
const POLL_FD_READWRITE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(27));
|
|
124
|
-
const SOCK_SHUTDOWN = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(28));
|
|
125
|
-
const SOCK_ACCEPT = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(29));
|
|
126
|
-
exports.WasiRights = {
|
|
127
|
-
FD_DATASYNC,
|
|
128
|
-
FD_READ,
|
|
129
|
-
FD_SEEK,
|
|
130
|
-
FD_FDSTAT_SET_FLAGS,
|
|
131
|
-
FD_SYNC,
|
|
132
|
-
FD_TELL,
|
|
133
|
-
FD_WRITE,
|
|
134
|
-
FD_ADVISE,
|
|
135
|
-
FD_ALLOCATE,
|
|
136
|
-
PATH_CREATE_DIRECTORY,
|
|
137
|
-
PATH_CREATE_FILE,
|
|
138
|
-
PATH_LINK_SOURCE,
|
|
139
|
-
PATH_LINK_TARGET,
|
|
140
|
-
PATH_OPEN,
|
|
141
|
-
FD_READDIR,
|
|
142
|
-
PATH_READLINK,
|
|
143
|
-
PATH_RENAME_SOURCE,
|
|
144
|
-
PATH_RENAME_TARGET,
|
|
145
|
-
PATH_FILESTAT_GET,
|
|
146
|
-
PATH_FILESTAT_SET_SIZE,
|
|
147
|
-
PATH_FILESTAT_SET_TIMES,
|
|
148
|
-
FD_FILESTAT_GET,
|
|
149
|
-
FD_FILESTAT_SET_SIZE,
|
|
150
|
-
FD_FILESTAT_SET_TIMES,
|
|
151
|
-
PATH_SYMLINK,
|
|
152
|
-
PATH_REMOVE_DIRECTORY,
|
|
153
|
-
PATH_UNLINK_FILE,
|
|
154
|
-
POLL_FD_READWRITE,
|
|
155
|
-
SOCK_SHUTDOWN,
|
|
156
|
-
SOCK_ACCEPT
|
|
157
|
-
};
|
|
158
|
-
var WasiWhence;
|
|
159
|
-
(function (WasiWhence) {
|
|
160
|
-
WasiWhence[WasiWhence["SET"] = 0] = "SET";
|
|
161
|
-
WasiWhence[WasiWhence["CUR"] = 1] = "CUR";
|
|
162
|
-
WasiWhence[WasiWhence["END"] = 2] = "END";
|
|
163
|
-
})(WasiWhence = exports.WasiWhence || (exports.WasiWhence = {}));
|
|
164
|
-
var FileControlFlag;
|
|
165
|
-
(function (FileControlFlag) {
|
|
166
|
-
FileControlFlag[FileControlFlag["O_RDONLY"] = 0] = "O_RDONLY";
|
|
167
|
-
FileControlFlag[FileControlFlag["O_WRONLY"] = 1] = "O_WRONLY";
|
|
168
|
-
FileControlFlag[FileControlFlag["O_RDWR"] = 2] = "O_RDWR";
|
|
169
|
-
FileControlFlag[FileControlFlag["O_CREAT"] = 64] = "O_CREAT";
|
|
170
|
-
FileControlFlag[FileControlFlag["O_EXCL"] = 128] = "O_EXCL";
|
|
171
|
-
FileControlFlag[FileControlFlag["O_NOCTTY"] = 256] = "O_NOCTTY";
|
|
172
|
-
FileControlFlag[FileControlFlag["O_TRUNC"] = 512] = "O_TRUNC";
|
|
173
|
-
FileControlFlag[FileControlFlag["O_APPEND"] = 1024] = "O_APPEND";
|
|
174
|
-
FileControlFlag[FileControlFlag["O_DIRECTORY"] = 65536] = "O_DIRECTORY";
|
|
175
|
-
FileControlFlag[FileControlFlag["O_NOATIME"] = 262144] = "O_NOATIME";
|
|
176
|
-
FileControlFlag[FileControlFlag["O_NOFOLLOW"] = 131072] = "O_NOFOLLOW";
|
|
177
|
-
FileControlFlag[FileControlFlag["O_SYNC"] = 1052672] = "O_SYNC";
|
|
178
|
-
FileControlFlag[FileControlFlag["O_DIRECT"] = 16384] = "O_DIRECT";
|
|
179
|
-
FileControlFlag[FileControlFlag["O_NONBLOCK"] = 2048] = "O_NONBLOCK";
|
|
180
|
-
})(FileControlFlag = exports.FileControlFlag || (exports.FileControlFlag = {}));
|
|
181
|
-
var WasiFileControlFlag;
|
|
182
|
-
(function (WasiFileControlFlag) {
|
|
183
|
-
WasiFileControlFlag[WasiFileControlFlag["O_CREAT"] = 1] = "O_CREAT";
|
|
184
|
-
WasiFileControlFlag[WasiFileControlFlag["O_DIRECTORY"] = 2] = "O_DIRECTORY";
|
|
185
|
-
WasiFileControlFlag[WasiFileControlFlag["O_EXCL"] = 4] = "O_EXCL";
|
|
186
|
-
WasiFileControlFlag[WasiFileControlFlag["O_TRUNC"] = 8] = "O_TRUNC";
|
|
187
|
-
})(WasiFileControlFlag = exports.WasiFileControlFlag || (exports.WasiFileControlFlag = {}));
|
|
188
|
-
var WasiFdFlag;
|
|
189
|
-
(function (WasiFdFlag) {
|
|
190
|
-
WasiFdFlag[WasiFdFlag["APPEND"] = 1] = "APPEND";
|
|
191
|
-
WasiFdFlag[WasiFdFlag["DSYNC"] = 2] = "DSYNC";
|
|
192
|
-
WasiFdFlag[WasiFdFlag["NONBLOCK"] = 4] = "NONBLOCK";
|
|
193
|
-
WasiFdFlag[WasiFdFlag["RSYNC"] = 8] = "RSYNC";
|
|
194
|
-
WasiFdFlag[WasiFdFlag["SYNC"] = 16] = "SYNC";
|
|
195
|
-
})(WasiFdFlag = exports.WasiFdFlag || (exports.WasiFdFlag = {}));
|
|
196
|
-
var WasiClockid;
|
|
197
|
-
(function (WasiClockid) {
|
|
198
|
-
WasiClockid[WasiClockid["REALTIME"] = 0] = "REALTIME";
|
|
199
|
-
WasiClockid[WasiClockid["MONOTONIC"] = 1] = "MONOTONIC";
|
|
200
|
-
WasiClockid[WasiClockid["PROCESS_CPUTIME_ID"] = 2] = "PROCESS_CPUTIME_ID";
|
|
201
|
-
WasiClockid[WasiClockid["THREAD_CPUTIME_ID"] = 3] = "THREAD_CPUTIME_ID";
|
|
202
|
-
})(WasiClockid = exports.WasiClockid || (exports.WasiClockid = {}));
|
|
203
|
-
var WasiFstFlag;
|
|
204
|
-
(function (WasiFstFlag) {
|
|
205
|
-
WasiFstFlag[WasiFstFlag["SET_ATIM"] = 1] = "SET_ATIM";
|
|
206
|
-
WasiFstFlag[WasiFstFlag["SET_ATIM_NOW"] = 2] = "SET_ATIM_NOW";
|
|
207
|
-
WasiFstFlag[WasiFstFlag["SET_MTIM"] = 4] = "SET_MTIM";
|
|
208
|
-
WasiFstFlag[WasiFstFlag["SET_MTIM_NOW"] = 8] = "SET_MTIM_NOW";
|
|
209
|
-
})(WasiFstFlag = exports.WasiFstFlag || (exports.WasiFstFlag = {}));
|
|
210
|
-
var WasiEventType;
|
|
211
|
-
(function (WasiEventType) {
|
|
212
|
-
WasiEventType[WasiEventType["CLOCK"] = 0] = "CLOCK";
|
|
213
|
-
WasiEventType[WasiEventType["FD_READ"] = 1] = "FD_READ";
|
|
214
|
-
WasiEventType[WasiEventType["FD_WRITE"] = 2] = "FD_WRITE";
|
|
215
|
-
})(WasiEventType = exports.WasiEventType || (exports.WasiEventType = {}));
|
|
216
|
-
var WasiSubclockflags;
|
|
217
|
-
(function (WasiSubclockflags) {
|
|
218
|
-
WasiSubclockflags[WasiSubclockflags["ABSTIME"] = 1] = "ABSTIME";
|
|
219
|
-
})(WasiSubclockflags = exports.WasiSubclockflags || (exports.WasiSubclockflags = {}));
|
|
220
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unsharedSlice = exports.sleepBreakIf = exports.postMsg = exports.isMainThread = exports.wrapInstanceExports = exports.isPromiseLike = exports.validateInt32 = exports.validateUndefined = exports.validateFunction = exports.validateString = exports.validateBoolean = exports.validateArray = exports.validateObject = void 0;
|
|
4
|
-
/* eslint-disable spaced-comment */
|
|
5
|
-
function validateObject(value, name) {
|
|
6
|
-
if (value === null || typeof value !== 'object') {
|
|
7
|
-
throw new TypeError(`${name} must be an object. Received ${value === null ? 'null' : typeof value}`);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.validateObject = validateObject;
|
|
11
|
-
function validateArray(value, name) {
|
|
12
|
-
if (!Array.isArray(value)) {
|
|
13
|
-
throw new TypeError(`${name} must be an array. Received ${value === null ? 'null' : typeof value}`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.validateArray = validateArray;
|
|
17
|
-
function validateBoolean(value, name) {
|
|
18
|
-
if (typeof value !== 'boolean') {
|
|
19
|
-
throw new TypeError(`${name} must be a boolean. Received ${value === null ? 'null' : typeof value}`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.validateBoolean = validateBoolean;
|
|
23
|
-
function validateString(value, name) {
|
|
24
|
-
if (typeof value !== 'string') {
|
|
25
|
-
throw new TypeError(`${name} must be a string. Received ${value === null ? 'null' : typeof value}`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.validateString = validateString;
|
|
29
|
-
function validateFunction(value, name) {
|
|
30
|
-
if (typeof value !== 'function') {
|
|
31
|
-
throw new TypeError(`${name} must be a function. Received ${value === null ? 'null' : typeof value}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.validateFunction = validateFunction;
|
|
35
|
-
function validateUndefined(value, name) {
|
|
36
|
-
if (value !== undefined) {
|
|
37
|
-
throw new TypeError(`${name} must be undefined. Received ${value === null ? 'null' : typeof value}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.validateUndefined = validateUndefined;
|
|
41
|
-
function validateInt32(value, name, min = -2147483648, max = 2147483647) {
|
|
42
|
-
if (typeof value !== 'number') {
|
|
43
|
-
throw new TypeError(`${name} must be a number. Received ${value === null ? 'null' : typeof value}`);
|
|
44
|
-
}
|
|
45
|
-
if (!Number.isInteger(value)) {
|
|
46
|
-
throw new RangeError(`${name} must be a integer.`);
|
|
47
|
-
}
|
|
48
|
-
if (value < min || value > max) {
|
|
49
|
-
throw new RangeError(`${name} must be >= ${min} && <= ${max}. Received ${value}`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.validateInt32 = validateInt32;
|
|
53
|
-
function isPromiseLike(obj) {
|
|
54
|
-
return !!(obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function');
|
|
55
|
-
}
|
|
56
|
-
exports.isPromiseLike = isPromiseLike;
|
|
57
|
-
function wrapInstanceExports(exports, mapFn) {
|
|
58
|
-
const newExports = Object.create(null);
|
|
59
|
-
Object.keys(exports).forEach(name => {
|
|
60
|
-
const exportValue = exports[name];
|
|
61
|
-
Object.defineProperty(newExports, name, {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
value: mapFn(exportValue, name)
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
return newExports;
|
|
67
|
-
}
|
|
68
|
-
exports.wrapInstanceExports = wrapInstanceExports;
|
|
69
|
-
const _require = /*#__PURE__*/ (function () {
|
|
70
|
-
let nativeRequire;
|
|
71
|
-
if (typeof __webpack_public_path__ !== 'undefined') {
|
|
72
|
-
nativeRequire = (function () {
|
|
73
|
-
return typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined;
|
|
74
|
-
})();
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
nativeRequire = (function () {
|
|
78
|
-
return typeof __webpack_public_path__ !== 'undefined' ? (typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined) : (typeof require !== 'undefined' ? require : undefined);
|
|
79
|
-
})();
|
|
80
|
-
}
|
|
81
|
-
return nativeRequire;
|
|
82
|
-
})();
|
|
83
|
-
exports.isMainThread = (function () {
|
|
84
|
-
let worker_threads;
|
|
85
|
-
try {
|
|
86
|
-
worker_threads = _require('worker_threads');
|
|
87
|
-
}
|
|
88
|
-
catch (_) { }
|
|
89
|
-
if (!worker_threads) {
|
|
90
|
-
return typeof importScripts === 'undefined';
|
|
91
|
-
}
|
|
92
|
-
return worker_threads.isMainThread;
|
|
93
|
-
})();
|
|
94
|
-
exports.postMsg = exports.isMainThread
|
|
95
|
-
? () => { }
|
|
96
|
-
: /*#__PURE__*/ (function () {
|
|
97
|
-
let worker_threads;
|
|
98
|
-
try {
|
|
99
|
-
worker_threads = _require('worker_threads');
|
|
100
|
-
}
|
|
101
|
-
catch (_) { }
|
|
102
|
-
if (!worker_threads) {
|
|
103
|
-
return postMessage;
|
|
104
|
-
}
|
|
105
|
-
return function postMessage(data) {
|
|
106
|
-
worker_threads.parentPort.postMessage({ data });
|
|
107
|
-
};
|
|
108
|
-
})();
|
|
109
|
-
function sleepBreakIf(delay, breakIf) {
|
|
110
|
-
const start = Date.now();
|
|
111
|
-
const end = start + delay;
|
|
112
|
-
let ret = false;
|
|
113
|
-
while (Date.now() < end) {
|
|
114
|
-
if (breakIf()) {
|
|
115
|
-
ret = true;
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return ret;
|
|
120
|
-
}
|
|
121
|
-
exports.sleepBreakIf = sleepBreakIf;
|
|
122
|
-
function unsharedSlice(view, start, end) {
|
|
123
|
-
return ((typeof SharedArrayBuffer === 'function' && view.buffer instanceof SharedArrayBuffer) || (Object.prototype.toString.call(view.buffer.constructor) === '[object SharedArrayBuffer]'))
|
|
124
|
-
? view.slice(start, end)
|
|
125
|
-
: view.subarray(start, end);
|
|
126
|
-
}
|
|
127
|
-
exports.unsharedSlice = unsharedSlice;
|
|
128
|
-
//# sourceMappingURL=util.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._WebAssembly = void 0;
|
|
4
|
-
const _WebAssembly = typeof WebAssembly !== 'undefined'
|
|
5
|
-
? WebAssembly
|
|
6
|
-
: typeof WXWebAssembly !== 'undefined'
|
|
7
|
-
? WXWebAssembly
|
|
8
|
-
: undefined;
|
|
9
|
-
exports._WebAssembly = _WebAssembly;
|
|
10
|
-
if (!_WebAssembly) {
|
|
11
|
-
throw new Error('WebAssembly is not supported in this environment');
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=webassembly.js.map
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { _WebAssembly } from "./webassembly.mjs";
|
|
2
|
-
import { isPromiseLike, wrapInstanceExports } from "./wasi/util.mjs";
|
|
3
|
-
const ignoreNames = [
|
|
4
|
-
'asyncify_get_state',
|
|
5
|
-
'asyncify_start_rewind',
|
|
6
|
-
'asyncify_start_unwind',
|
|
7
|
-
'asyncify_stop_rewind',
|
|
8
|
-
'asyncify_stop_unwind'
|
|
9
|
-
];
|
|
10
|
-
// const wrappedExports = new WeakMap<WebAssembly.Exports, WebAssembly.Exports>()
|
|
11
|
-
var AsyncifyState;
|
|
12
|
-
(function (AsyncifyState) {
|
|
13
|
-
AsyncifyState[AsyncifyState["NONE"] = 0] = "NONE";
|
|
14
|
-
AsyncifyState[AsyncifyState["UNWINDING"] = 1] = "UNWINDING";
|
|
15
|
-
AsyncifyState[AsyncifyState["REWINDING"] = 2] = "REWINDING";
|
|
16
|
-
})(AsyncifyState || (AsyncifyState = {}));
|
|
17
|
-
function tryAllocate(instance, wasm64, size, mallocName) {
|
|
18
|
-
if (typeof instance.exports[mallocName] !== 'function' || size <= 0) {
|
|
19
|
-
return {
|
|
20
|
-
wasm64,
|
|
21
|
-
dataPtr: 16,
|
|
22
|
-
start: wasm64 ? 32 : 24,
|
|
23
|
-
end: 1024
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const malloc = instance.exports[mallocName];
|
|
27
|
-
const dataPtr = wasm64 ? Number(malloc(BigInt(16) + BigInt(size))) : malloc(8 + size);
|
|
28
|
-
if (dataPtr === 0) {
|
|
29
|
-
throw new Error('Allocate asyncify data failed');
|
|
30
|
-
}
|
|
31
|
-
return wasm64
|
|
32
|
-
? { wasm64, dataPtr, start: dataPtr + 16, end: dataPtr + 16 + size }
|
|
33
|
-
: { wasm64, dataPtr, start: dataPtr + 8, end: dataPtr + 8 + size };
|
|
34
|
-
}
|
|
35
|
-
/** @public */
|
|
36
|
-
export class Asyncify {
|
|
37
|
-
constructor() {
|
|
38
|
-
this.value = undefined;
|
|
39
|
-
this.exports = undefined;
|
|
40
|
-
this.dataPtr = 0;
|
|
41
|
-
}
|
|
42
|
-
init(memory, instance, options) {
|
|
43
|
-
var _a, _b;
|
|
44
|
-
if (this.exports) {
|
|
45
|
-
throw new Error('Asyncify has been initialized');
|
|
46
|
-
}
|
|
47
|
-
if (!(memory instanceof _WebAssembly.Memory)) {
|
|
48
|
-
throw new TypeError('Require WebAssembly.Memory object');
|
|
49
|
-
}
|
|
50
|
-
const exports = instance.exports;
|
|
51
|
-
for (let i = 0; i < ignoreNames.length; ++i) {
|
|
52
|
-
if (typeof exports[ignoreNames[i]] !== 'function') {
|
|
53
|
-
throw new TypeError('Invalid asyncify wasm');
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
let address;
|
|
57
|
-
const wasm64 = Boolean(options.wasm64);
|
|
58
|
-
if (!options.tryAllocate) {
|
|
59
|
-
address = {
|
|
60
|
-
wasm64,
|
|
61
|
-
dataPtr: 16,
|
|
62
|
-
start: wasm64 ? 32 : 24,
|
|
63
|
-
end: 1024
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
if (options.tryAllocate === true) {
|
|
68
|
-
address = tryAllocate(instance, wasm64, 4096, 'malloc');
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
address = tryAllocate(instance, wasm64, (_a = options.tryAllocate.size) !== null && _a !== void 0 ? _a : 4096, (_b = options.tryAllocate.name) !== null && _b !== void 0 ? _b : 'malloc');
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
this.dataPtr = address.dataPtr;
|
|
75
|
-
if (wasm64) {
|
|
76
|
-
new BigInt64Array(memory.buffer, this.dataPtr).set([BigInt(address.start), BigInt(address.end)]);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
new Int32Array(memory.buffer, this.dataPtr).set([address.start, address.end]);
|
|
80
|
-
}
|
|
81
|
-
this.exports = this.wrapExports(exports, options.wrapExports);
|
|
82
|
-
const asyncifiedInstance = Object.create(_WebAssembly.Instance.prototype);
|
|
83
|
-
Object.defineProperty(asyncifiedInstance, 'exports', { value: this.exports });
|
|
84
|
-
// Object.setPrototypeOf(instance, Instance.prototype)
|
|
85
|
-
return asyncifiedInstance;
|
|
86
|
-
}
|
|
87
|
-
assertState() {
|
|
88
|
-
if (this.exports.asyncify_get_state() !== AsyncifyState.NONE) {
|
|
89
|
-
throw new Error('Asyncify state error');
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
wrapImportFunction(f) {
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
94
|
-
const _this = this;
|
|
95
|
-
return (function () {
|
|
96
|
-
// eslint-disable-next-line no-unreachable-loop
|
|
97
|
-
while (_this.exports.asyncify_get_state() === AsyncifyState.REWINDING) {
|
|
98
|
-
_this.exports.asyncify_stop_rewind();
|
|
99
|
-
return _this.value;
|
|
100
|
-
}
|
|
101
|
-
_this.assertState();
|
|
102
|
-
const v = f.apply(this, arguments);
|
|
103
|
-
if (!isPromiseLike(v))
|
|
104
|
-
return v;
|
|
105
|
-
_this.exports.asyncify_start_unwind(_this.dataPtr);
|
|
106
|
-
_this.value = v;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
wrapImports(imports) {
|
|
110
|
-
const importObject = {};
|
|
111
|
-
Object.keys(imports).forEach(k => {
|
|
112
|
-
const mod = imports[k];
|
|
113
|
-
const newModule = {};
|
|
114
|
-
Object.keys(mod).forEach(name => {
|
|
115
|
-
const importValue = mod[name];
|
|
116
|
-
if (typeof importValue === 'function') {
|
|
117
|
-
newModule[name] = this.wrapImportFunction(importValue);
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
newModule[name] = importValue;
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
importObject[k] = newModule;
|
|
124
|
-
});
|
|
125
|
-
return importObject;
|
|
126
|
-
}
|
|
127
|
-
wrapExportFunction(f) {
|
|
128
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
129
|
-
const _this = this;
|
|
130
|
-
return (async function () {
|
|
131
|
-
_this.assertState();
|
|
132
|
-
let ret = f.apply(this, arguments);
|
|
133
|
-
while (_this.exports.asyncify_get_state() === AsyncifyState.UNWINDING) {
|
|
134
|
-
_this.exports.asyncify_stop_unwind();
|
|
135
|
-
_this.value = await _this.value;
|
|
136
|
-
_this.assertState();
|
|
137
|
-
_this.exports.asyncify_start_rewind(_this.dataPtr);
|
|
138
|
-
ret = f.call(this);
|
|
139
|
-
}
|
|
140
|
-
_this.assertState();
|
|
141
|
-
return ret;
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
wrapExports(exports, needWrap) {
|
|
145
|
-
return wrapInstanceExports(exports, (exportValue, name) => {
|
|
146
|
-
let ignore = ignoreNames.indexOf(name) !== -1 || typeof exportValue !== 'function';
|
|
147
|
-
if (Array.isArray(needWrap)) {
|
|
148
|
-
ignore = ignore || (needWrap.indexOf(name) === -1);
|
|
149
|
-
}
|
|
150
|
-
return ignore ? exportValue : this.wrapExportFunction(exportValue);
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|