GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lib: fix TypeScript support check in jitless mode · nodejs/node@f55a5fe

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • errors.md
  • lib/internal
    • errors.js
    • util.js
  • test/es-module
    • test-typescript.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/errors.md‎

Copy file name to clipboardExpand all lines: doc/api/errors.md
+8Lines changed: 8 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -3350,6 +3350,14 @@ The WASI instance has already started.
33503350

33513351
The WASI instance has not been started.
33523352

3353+
<a id="ERR_WEBASSEMBLY_NOT_SUPPORTED"></a>
3354+
3355+
### `ERR_WEBASSEMBLY_NOT_SUPPORTED`
3356+
3357+
A feature requiring WebAssembly was used, but WebAssembly is not supported or
3358+
has been disabled in the current environment (for example, when running with
3359+
`--jitless`). The error message specifies which feature requires WebAssembly.
3360+
33533361
<a id="ERR_WEBASSEMBLY_RESPONSE"></a>
33543362

33553363
### `ERR_WEBASSEMBLY_RESPONSE`
Collapse file

‎lib/internal/errors.js‎

Copy file name to clipboardExpand all lines: lib/internal/errors.js
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,6 +1905,9 @@ E('ERR_VM_MODULE_NOT_MODULE',
19051905
'Provided module is not an instance of Module', Error);
19061906
E('ERR_VM_MODULE_STATUS', 'Module status %s', Error);
19071907
E('ERR_WASI_ALREADY_STARTED', 'WASI instance has already started', Error);
1908+
E('ERR_WEBASSEMBLY_NOT_SUPPORTED',
1909+
'WebAssembly is not supported in this environment, but is required for %s',
1910+
Error);
19081911
E('ERR_WEBASSEMBLY_RESPONSE', 'WebAssembly response %s', TypeError);
19091912
E('ERR_WORKER_INIT_FAILED', 'Worker initialization failure: %s', Error);
19101913
E('ERR_WORKER_INVALID_EXEC_ARGV', (errors, msg = 'invalid execArgv flags') =>
Collapse file

‎lib/internal/util.js‎

Copy file name to clipboardExpand all lines: lib/internal/util.js
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ const {
4646
SymbolPrototypeGetDescription,
4747
SymbolReplace,
4848
SymbolSplit,
49+
globalThis,
4950
} = primordials;
5051

5152
const {
5253
codes: {
5354
ERR_NO_CRYPTO,
5455
ERR_NO_TYPESCRIPT,
5556
ERR_UNKNOWN_SIGNAL,
57+
ERR_WEBASSEMBLY_NOT_SUPPORTED,
5658
},
5759
isErrorStackTraceLimitWritable,
5860
overrideStackTrace,
@@ -244,6 +246,8 @@ function assertCrypto() {
244246
function assertTypeScript() {
245247
if (noTypeScript)
246248
throw new ERR_NO_TYPESCRIPT();
249+
if (globalThis.WebAssembly === undefined)
250+
throw new ERR_WEBASSEMBLY_NOT_SUPPORTED('TypeScript');
247251
}
248252

249253
/**
Collapse file

‎test/es-module/test-typescript.mjs‎

Copy file name to clipboardExpand all lines: test/es-module/test-typescript.mjs
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,14 @@ test('check transform types warning', async () => {
342342
assert.match(result.stdout, /Hello, TypeScript!/);
343343
assert.strictEqual(result.code, 0);
344344
});
345+
346+
test('expect error when executing a TypeScript file with --jitless', async () => {
347+
const result = await spawnPromisified(process.execPath, [
348+
'--jitless',
349+
fixtures.path('typescript/ts/test-typescript.ts'),
350+
]);
351+
352+
assert.match(result.stderr, /ERR_WEBASSEMBLY_NOT_SUPPORTED/);
353+
assert.match(result.stderr, /WebAssembly is not supported in this environment, but is required for TypeScript/);
354+
assert.strictEqual(result.code, 1);
355+
});

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.