Socket
Socket
Sign inDemoInstall

tsconfig-paths

Package Overview
Dependencies
4
Maintainers
8
Versions
50
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.8.0 to 3.9.0

1

lib/tsconfig-loader.d.ts

@@ -11,2 +11,3 @@ /**

};
strict?: boolean;
};

@@ -13,0 +14,0 @@ }

"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var path = require("path");
var fs = require("fs");
var deepmerge = require("deepmerge");
// tslint:disable:no-require-imports

@@ -86,3 +93,3 @@ var JSON5 = require("json5");

}
return deepmerge(base, config);
return __assign({}, base, config, { compilerOptions: __assign({}, base.compilerOptions, config.compilerOptions) });
}

@@ -89,0 +96,0 @@ return config;

8

package.json
{
"name": "tsconfig-paths",
"version": "3.8.0",
"version": "3.9.0",
"description": "Load node modules according to tsconfig paths, in run-time or via API.",

@@ -12,3 +12,2 @@ "main": "lib/index.js",

"@types/chai": "^4.1.4",
"@types/deepmerge": "^1.3.2",
"@types/minimist": "^1.2.0",

@@ -34,3 +33,2 @@ "@types/mocha": "^5.2.3",

"@types/json5": "^0.0.29",
"deepmerge": "^2.0.1",
"json5": "^1.0.1",

@@ -56,3 +54,5 @@ "minimist": "^1.2.0",

"publish:minor": "yarn build && node scripts/publish.js minor",
"publish:patch": "yarn build && node scripts/publish.js patch"
"publish:patch": "yarn build && node scripts/publish.js patch",
"preversion": "yarn verify",
"postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
},

@@ -59,0 +59,0 @@ "lint-staged": {

@@ -11,3 +11,3 @@ # tsconfig-paths

Typescript by default mimics the Node.js runtime resolution strategy of modules. But it also allows the use of [path mapping](https://www.typescriptlang.org/docs/handbook/module-resolution.html) which allows arbitrary module paths (that doesn't start with "/" or ".") to be specified and mapped to physical paths in the filesystem. The typescript compiler can resolve these paths from `tsconfig` so it will compile OK. But if you then try to exeute the compiled files with node (or ts-node), it will only look in the `node_modules` folders all the way up to the root of the filesystem and thus will not find the modules specified by `paths` in `tsconfig`.
Typescript by default mimics the Node.js runtime resolution strategy of modules. But it also allows the use of [path mapping](https://www.typescriptlang.org/docs/handbook/module-resolution.html) which allows arbitrary module paths (that doesn't start with "/" or ".") to be specified and mapped to physical paths in the filesystem. The typescript compiler can resolve these paths from `tsconfig` so it will compile OK. But if you then try to execute the compiled files with node (or ts-node), it will only look in the `node_modules` folders all the way up to the root of the filesystem and thus will not find the modules specified by `paths` in `tsconfig`.

@@ -147,3 +147,3 @@ If you require this package's `tsconfig-paths/register` module it will read the `paths` from `tsconfig.json` and convert node's module loading calls into to physcial file paths that node can load.

This function loads the tsconfig.json. It will start searching from the specified `cwd` directory.
This function loads the tsconfig.json. It will start searching from the specified `cwd` directory. Passing the tsconfig.json file directly instead of a directory also works.

@@ -216,2 +216,10 @@ ### createMatchPath

## How to publish
```
yarn version --patch
yarn version --minor
yarn version --major
```
[version-image]: https://img.shields.io/npm/v/tsconfig-paths.svg?style=flat

@@ -218,0 +226,0 @@ [version-url]: https://www.npmjs.com/package/tsconfig-paths

@@ -133,10 +133,14 @@ import { assert } from "chai";

it("It should load a config with extends and overwrite baseUrl", () => {
it("It should load a config with extends and overwrite all options", () => {
const firstConfig = {
extends: "../base-config.json",
compilerOptions: { baseUrl: "kalle" }
compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } }
};
const firstConfigPath = join("/root", "dir1", "tsconfig.json");
const baseConfig = {
compilerOptions: { baseUrl: "olle", paths: { foo: ["bar"] } }
compilerOptions: {
baseUrl: "olle",
paths: { foo: ["bar1"] },
strict: true
}
};

@@ -160,3 +164,7 @@ const baseConfigPath = join("/root", "base-config.json");

extends: "../base-config.json",
compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar"] } }
compilerOptions: {
baseUrl: "kalle",
paths: { foo: ["bar2"] },
strict: true
}
});

@@ -163,0 +171,0 @@ });

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc