Socket
Socket
Sign inDemoInstall

@swc-node/register

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swc-node/register - npm Package Compare versions

Comparing version 1.10.7 to 1.10.8

2

lib/register.d.ts
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;

15

lib/register.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc