Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

resolve-tspaths

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resolve-tspaths - npm Package Compare versions

Comparing version 0.8.18 to 0.8.19

6

dist/index.js

@@ -24,5 +24,5 @@ "use strict";

*/
function resolveTsPaths(options = {}) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
function resolveTsPaths() {
return __awaiter(this, arguments, void 0, function* (options = {}) {
var _a, _b;
const { project = "tsconfig.json", src = "src", ext = constants_1.DEFAULT_EXTENSIONS, out, } = options;

@@ -29,0 +29,0 @@ const tsConfig = (0, loadTSConfig_1.loadTSConfig)(project);

import type { Alias, Change, ProgramPaths, TextChange } from "../types";
export declare const IMPORT_EXPORT_REGEX: RegExp;
export declare const ESM_IMPORT_EXPORT_REGEX: RegExp;
export declare const COMMONJS_IMPORT_EXPORT_REGEX: RegExp;
export declare const MATCHERS: RegExp[];
/**

@@ -6,0 +4,0 @@ * Generate the alias path mapping changes to apply to the provide files.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.aliasToRelativePath = exports.replaceAliasPathsInFile = exports.generateChanges = exports.COMMONJS_IMPORT_EXPORT_REGEX = exports.ESM_IMPORT_EXPORT_REGEX = exports.IMPORT_EXPORT_REGEX = void 0;
exports.aliasToRelativePath = exports.replaceAliasPathsInFile = exports.generateChanges = exports.MATCHERS = void 0;
const fs_1 = require("fs");

@@ -8,5 +8,16 @@ const path_1 = require("path");

const path_2 = require("../utils/path");
exports.IMPORT_EXPORT_REGEX = /((?:require\(|require\.resolve\(|import\()|(?:import|export)\s+(?:[\s\S]*?from\s+)?)['"]([^'"]*)['"]\)?/g;
exports.ESM_IMPORT_EXPORT_REGEX = /(?:(?:import\()|(?:import|export)\s+(?:[\s\S]*?from\s+)?)['"]([^'"]*)['"]\)?/g;
exports.COMMONJS_IMPORT_EXPORT_REGEX = /(?:(?:require\(|require\.resolve\()\s+)['"]([^'"]*)['"]\)/g;
exports.MATCHERS = [
// require("package"), require.resolve("package"), import("package")
/((?:require|require\.resolve|import)\((?:"([^"]+)")\))/g,
/((?:require|require\.resolve|import)\((?:'([^']+)')\))/g,
// import "package"
/((?:import|export) (?:"([^"]+)"))/g,
/((?:import|export) (?:'([^']+)'))/g,
// import {} from "package", import * as name from "package"
/((?:import|export) .+ from (?:"([^"]+)"))/g,
/((?:import|export) .+ from (?:'([^']+)'))/g,
// multiline import/exports with {}
/((?:import|export) {\n[^}]+} from (?:"([^']+)"))/g,
/((?:import|export) {\n[^}]+} from (?:'([^']+)'))/g,
];
const MODULE_EXTS = [

@@ -53,3 +64,3 @@ ".js",

const changes = [];
const newText = originalText.replace(exports.IMPORT_EXPORT_REGEX, (original, importStatement, importSpecifier) => {
const newText = exports.MATCHERS.reduce((text, regex) => text.replace(regex, (original, importStatement, importSpecifier) => {
// The import is an esm import if it is inside a typescript (definition) file or if it uses `import` or `export`

@@ -70,3 +81,3 @@ const esmImport = !filePath.endsWith(".ts") &&

original.substring(index + importSpecifier.length));
});
}), originalText);
return { changed: originalText !== newText, text: newText, changes };

@@ -73,0 +84,0 @@ }

{
"version": "0.8.18"
"version": "0.8.19"
}
{
"name": "resolve-tspaths",
"version": "0.8.18",
"version": "0.8.19",
"description": "Transform path mappings in your compiled Typescript code",

@@ -35,4 +35,4 @@ "author": "Ben Yap <contact@benyap.com>",

"ansi-colors": "4.1.3",
"commander": "11.1.0",
"fast-glob": "3.3.1"
"commander": "12.0.0",
"fast-glob": "3.3.2"
},

@@ -42,15 +42,15 @@ "devDependencies": {

"@commitlint/config-conventional": "18.0.0",
"@release-it/bumper": "5.1.0",
"@release-it/conventional-changelog": "7.0.2",
"@types/node": "20.8.7",
"@release-it/bumper": "6.0.1",
"@release-it/conventional-changelog": "8.0.1",
"@types/node": "20.12.12",
"@vitest/coverage-c8": "0.33.0",
"husky": "8.0.3",
"prettier": "3.0.3",
"release-it": "16.2.1",
"rimraf": "5.0.5",
"ts-node": "10.9.1",
"husky": "9.0.11",
"prettier": "3.2.5",
"release-it": "17.2.1",
"rimraf": "5.0.7",
"ts-node": "10.9.2",
"tsconfig-paths": "4.2.0",
"typescript": "5.2.2",
"vite": "4.5.0",
"vitest": "0.34.6"
"typescript": "5.4.5",
"vite": "5.2.11",
"vitest": "1.6.0"
},

@@ -57,0 +57,0 @@ "scripts": {

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