Socket
Socket
Sign inDemoInstall

tsconfig-paths

Package Overview
Dependencies
5
Maintainers
6
Versions
50
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.6.0 to 3.7.0

8

CHANGELOG.md

@@ -10,2 +10,8 @@ # Change Log

## [3.7.0] - 2018-11-11
### Added
- Allow cleanup of register(). See PR [#64](https://github.com/dividab/tsconfig-paths/pull/64) and issue [63](https://github.com/dividab/tsconfig-paths/issues/63). Thanks to [@TylorS](https://github.com/TylorS) for this addition!
## [3.6.0] - 2018-09-10

@@ -15,3 +21,3 @@

- Prefer Node's core modules over file modules. See PR [#60](https://github.com/dividab/tsconfig-paths/pull/60) and issue [56](https://github.com/dividab/tsconfig-paths/issues/56). Thanks to @ljani for this addition! (#60)
- Prefer Node's core modules over file modules. See PR [#60](https://github.com/dividab/tsconfig-paths/pull/60) and issue [56](https://github.com/dividab/tsconfig-paths/issues/56). Thanks to @ljani for this addition!

@@ -18,0 +24,0 @@ ## [3.5.0] - 2018-07-28

3

lib/register.d.ts
import { ExplicitParams } from "./config-loader";
/**
* Installs a custom module load function that can adhere to paths in tsconfig.
* Returns a function to undo paths registration.
*/
export declare function register(explicitParams: ExplicitParams): void;
export declare function register(explicitParams: ExplicitParams): () => void;

@@ -6,2 +6,3 @@ "use strict";

var options_1 = require("./options");
var noOp = function () { return void 0; };
function getCoreModules(builtinModules) {

@@ -46,2 +47,3 @@ builtinModules = builtinModules || [

* Installs a custom module load function that can adhere to paths in tsconfig.
* Returns a function to undo paths registration.
*/

@@ -55,3 +57,3 @@ function register(explicitParams) {

console.warn(configLoaderResult.message + ". tsconfig-paths will be skipped");
return;
return noOp;
}

@@ -78,3 +80,7 @@ var matchPath = match_path_sync_1.createMatchPath(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths);

};
return function () {
// Return node's module loading to original state.
Module._resolveFilename = originalResolveFilename;
};
}
exports.register = register;
{
"name": "tsconfig-paths",
"version": "3.6.0",
"version": "3.7.0",
"description": "Load node modules according to tsconfig paths, in run-time or via API.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -64,6 +64,9 @@ # tsconfig-paths

const baseUrl = "./"; // Either absolute or relative path. If relative it's resolved to current working directory.
tsConfigPaths.register({
const cleanup = tsConfigPaths.register({
baseUrl,
paths: tsConfig.compilerOptions.paths
});
// When path registration is no longer needed
cleanup()
```

@@ -115,6 +118,7 @@

*/
export function register(explicitParams: ExplicitParams): void;
export function register(explicitParams: ExplicitParams): () => void;
```
This function will patch the node's module loading so it will look for modules in paths specified by tsconfig.json.
A function is returned for you to reinstate Node's original module loading.

@@ -121,0 +125,0 @@ ### loadConfig

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