Bump eslint-plugin-import to avoid vulnerability in dependency
This commit is contained in:
parent
10695e6a20
commit
ed9506bbaf
1660 changed files with 67726 additions and 27926 deletions
55
node_modules/tsconfig-paths/README.md
generated
vendored
55
node_modules/tsconfig-paths/README.md
generated
vendored
|
|
@ -1,7 +1,7 @@
|
|||
# tsconfig-paths
|
||||
|
||||
[![npm version][version-image]][version-url]
|
||||
[![travis build][travis-image]][travis-url]
|
||||
[![build][build-image]][build-url]
|
||||
[![Coverage Status][codecov-image]][codecov-url]
|
||||
[![MIT license][license-image]][license-url]
|
||||
[![code style: prettier][prettier-image]][prettier-url]
|
||||
|
|
@ -10,7 +10,7 @@ Use this to load modules whose location is specified in the `paths` section of `
|
|||
|
||||
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`.
|
||||
|
||||
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.
|
||||
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 physical file paths that node can load.
|
||||
|
||||
## How to install
|
||||
|
||||
|
|
@ -30,6 +30,10 @@ npm install --save-dev tsconfig-paths
|
|||
|
||||
`node -r tsconfig-paths/register main.js`
|
||||
|
||||
If `process.env.TS_NODE_BASEURL` is set it will override the value of `baseUrl` in tsconfig.json:
|
||||
|
||||
`TS_NODE_BASEURL=./dist node -r tsconfig-paths/register main.js`
|
||||
|
||||
### With ts-node
|
||||
|
||||
`ts-node -r tsconfig-paths/register main.ts`
|
||||
|
|
@ -52,10 +56,43 @@ mocha -r ts-node/register -r tsconfig-paths/register "test/**/*.ts"
|
|||
|
||||
As long as the command has something similar to a `--require` option that can load a module before it starts, tsconfig-paths should be able to work with it.
|
||||
|
||||
## Bootstraping with explicit params
|
||||
### With `ts-node` and VSCode
|
||||
|
||||
The following is an example configuration for the `.vscode/launch.json`.
|
||||
|
||||
```js
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug Functions",
|
||||
"request": "launch",
|
||||
"type": "node",
|
||||
"runtimeArgs": [
|
||||
"-r",
|
||||
"${workspaceFolder}/functions/node_modules/ts-node/register",
|
||||
"-r",
|
||||
"${workspaceFolder}/functions/node_modules/tsconfig-paths/register"
|
||||
],
|
||||
"args": ["${workspaceFolder}/functions/src/index.ts"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"protocol": "inspector",
|
||||
"env": {
|
||||
"NODE_ENV": "development",
|
||||
"TS_NODE_PROJECT": "${workspaceFolder}/functions/tsconfig.json"
|
||||
},
|
||||
"outFiles": ["${workspaceFolder}/functions/lib/**/*.js"]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Bootstrapping with explicit params
|
||||
|
||||
If you want more granular control over tsconfig-paths you can bootstrap it. This can be useful if you for instance have compiled with `tsc` to another directory where `tsconfig.json` doesn't exists.
|
||||
|
||||
For example, create a wrapper script called `tsconfig-paths-bootstrap.js` with the contents below:
|
||||
|
||||
```javascript
|
||||
const tsConfig = require("./tsconfig.json");
|
||||
const tsConfigPaths = require("tsconfig-paths");
|
||||
|
|
@ -63,7 +100,7 @@ const tsConfigPaths = require("tsconfig-paths");
|
|||
const baseUrl = "./"; // Either absolute or relative path. If relative it's resolved to current working directory.
|
||||
const cleanup = tsConfigPaths.register({
|
||||
baseUrl,
|
||||
paths: tsConfig.compilerOptions.paths
|
||||
paths: tsConfig.compilerOptions.paths,
|
||||
});
|
||||
|
||||
// When path registration is no longer needed
|
||||
|
|
@ -176,7 +213,7 @@ export function createMatchPath(
|
|||
): MatchPath {
|
||||
```
|
||||
|
||||
The `createMatchPath` function will create a function that can match paths. It accepts `baseUrl` and `paths` directly as they are specified in tsconfig and will handle resolving paths to absolute form. The created function has the signare specified by the type `MatchPath` above.
|
||||
The `createMatchPath` function will create a function that can match paths. It accepts `baseUrl` and `paths` directly as they are specified in tsconfig and will handle resolving paths to absolute form. The created function has the signature specified by the type `MatchPath` above.
|
||||
|
||||
### matchFromAbsolutePaths
|
||||
|
||||
|
|
@ -186,7 +223,7 @@ The `createMatchPath` function will create a function that can match paths. It a
|
|||
* @param absolutePathMappings The paths to try as specified in tsconfig but resolved to absolute form.
|
||||
* @param requestedModule The required module name.
|
||||
* @param readJson Function that can read json from a path (useful for testing).
|
||||
* @param fileExists Function that checks for existance of a file at a path (useful for testing).
|
||||
* @param fileExists Function that checks for existence of a file at a path (useful for testing).
|
||||
* @param extensions File extensions to probe for (useful for testing).
|
||||
* @param mainFields A list of package.json field names to try when resolving module files.
|
||||
* @returns the found path, or undefined if no path was found.
|
||||
|
|
@ -201,7 +238,7 @@ export function matchFromAbsolutePaths(
|
|||
): string | undefined {
|
||||
```
|
||||
|
||||
This function is lower level and requries that the paths as already been resolved to absolute form and sorted in correct order into an array.
|
||||
This function is lower level and requires that the paths as already been resolved to absolute form and sorted in correct order into an array.
|
||||
|
||||
### createMatchPathAsync
|
||||
|
||||
|
|
@ -221,8 +258,8 @@ yarn version --major
|
|||
|
||||
[version-image]: https://img.shields.io/npm/v/tsconfig-paths.svg?style=flat
|
||||
[version-url]: https://www.npmjs.com/package/tsconfig-paths
|
||||
[travis-image]: https://travis-ci.com/dividab/tsconfig-paths.svg?branch=master&style=flat
|
||||
[travis-url]: https://travis-ci.com/dividab/tsconfig-paths
|
||||
[build-image]: https://github.com/dividab/tsconfig-paths/workflows/CI/badge.svg
|
||||
[build-url]: https://github.com/dividab/tsconfig-paths/actions/workflows/ci.yml?query=branch%3Amaster
|
||||
[codecov-image]: https://codecov.io/gh/dividab/tsconfig-paths/branch/master/graph/badge.svg
|
||||
[codecov-url]: https://codecov.io/gh/dividab/tsconfig-paths
|
||||
[license-image]: https://img.shields.io/github/license/dividab/tsconfig-paths.svg?style=flat
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue