File: allow_amaro_external_builtin.patch

package info (click to toggle)
nodejs 22.21.1%2Bdfsg%2B~cs22.19.0-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 251,932 kB
  • sloc: cpp: 1,542,927; javascript: 597,777; ansic: 114,330; python: 60,784; sh: 4,155; makefile: 2,917; asm: 1,750; pascal: 1,565; perl: 248; lisp: 222; xml: 42
file content (31 lines) | stat: -rw-r--r-- 954 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Description: process.versions.amaro is empty when loading it from external builtin
 So just try to load it to know if it's loadable.
Forwarded: not-needed
Last-Update: 2025-03-19
Author: Jérémy Lal <kapouer@melix.org>
--- a/lib/internal/modules/typescript.js
+++ b/lib/internal/modules/typescript.js
@@ -15,6 +15,7 @@
         isUnderNodeModules,
         kEmptyObject } = require('internal/util');
 const {
+	ERR_NO_TYPESCRIPT,
   ERR_INVALID_TYPESCRIPT_SYNTAX,
   ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING,
   ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX,
@@ -38,9 +39,12 @@
  * @returns {Function} The TypeScript parser function.
  */
 const loadTypeScriptParser = getLazy(() => {
-  assertTypeScript();
-  const amaro = require('internal/deps/amaro/dist/index');
-  return amaro.transformSync;
+	try {
+  	const amaro = require('internal/deps/amaro/dist/index');
+  	return amaro.transformSync;
+	} catch {
+		throw new ERR_NO_TYPESCRIPT();
+	}
 });
 
 /**