@swc-node/register
Advanced tools
Comparing version 1.10.7 to 1.10.8
import * as ts from 'typescript'; | ||
export declare const AVAILABLE_TS_EXTENSION_PATTERN: RegExp; | ||
export declare const AVAILABLE_EXTENSION_PATTERN: RegExp; | ||
export declare function compile(sourcecode: string | undefined, filename: string, options: ts.CompilerOptions & { | ||
@@ -5,0 +3,0 @@ fallbackToTs?: (filename: string) => boolean; |
@@ -26,3 +26,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AVAILABLE_EXTENSION_PATTERN = exports.AVAILABLE_TS_EXTENSION_PATTERN = void 0; | ||
exports.compile = compile; | ||
@@ -35,3 +34,3 @@ exports.register = register; | ||
const read_default_tsconfig_1 = require("./read-default-tsconfig"); | ||
const DEFAULT_EXTENSIONS = [ | ||
const DEFAULT_EXTENSIONS = new Set([ | ||
ts.Extension.Js, | ||
@@ -47,5 +46,3 @@ ts.Extension.Ts, | ||
'.es', | ||
]; | ||
exports.AVAILABLE_TS_EXTENSION_PATTERN = new RegExp(`((?<!\\.d)(${[ts.Extension.Ts, ts.Extension.Tsx, ts.Extension.Mts, ts.Extension.Cts].map((ext) => ext.replace(/^\./, '\\.')).join('|')}))$`, 'i'); | ||
exports.AVAILABLE_EXTENSION_PATTERN = new RegExp(`((?<!\\.d)(${DEFAULT_EXTENSIONS.map((ext) => ext.replace(/^\./, '\\.')).join('|')}))$`, 'i'); | ||
]); | ||
const injectInlineSourceMap = ({ filename, code, map, }) => { | ||
@@ -61,6 +58,4 @@ if (map) { | ||
function compile(sourcecode, filename, options, async = false) { | ||
if (typeof sourcecode === 'undefined' || | ||
(filename.includes('node_modules') && !exports.AVAILABLE_TS_EXTENSION_PATTERN.test(filename)) || | ||
!exports.AVAILABLE_EXTENSION_PATTERN.test(filename)) { | ||
return sourcecode; | ||
if (sourcecode == null) { | ||
return; | ||
} | ||
@@ -104,3 +99,3 @@ if (options && typeof options.fallbackToTs === 'function' && options.fallbackToTs(filename)) { | ||
return (0, pirates_1.addHook)((code, filename) => compile(code, filename, options), { | ||
exts: DEFAULT_EXTENSIONS, | ||
exts: Array.from(DEFAULT_EXTENSIONS), | ||
...hookOpts, | ||
@@ -107,0 +102,0 @@ }); |
{ | ||
"name": "@swc-node/register", | ||
"version": "1.10.7", | ||
"version": "1.10.8", | ||
"description": "SWC node register", | ||
@@ -47,3 +47,3 @@ "keywords": [ | ||
"debug": "^4.3.5", | ||
"oxc-resolver": "^1.10.0", | ||
"oxc-resolver": "^1.10.2", | ||
"pirates": "^4.0.6", | ||
@@ -50,0 +50,0 @@ "tslib": "^2.6.3" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118158
768
Updatedoxc-resolver@^1.10.2