Save current BZZZ config-ui state before CHORUS branding update
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
371
install/config-ui/node_modules/tsconfig-paths/CHANGELOG.md
generated
vendored
Normal file
371
install/config-ui/node_modules/tsconfig-paths/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,371 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [3.15.0] - 2023-12-14
|
||||
|
||||
### Added
|
||||
|
||||
- Add support for extends as array of strings to v3 (backport of #245). See PR #260. Thanks to [@domdomegg](https://github.com/domdomegg) for this PR!
|
||||
|
||||
## [3.14.1] - 2022-03-22
|
||||
|
||||
### Fixed
|
||||
|
||||
- Use minimist 1.2.6 for all depencencies becuase of pollution vulnerability. See PR [#197](https://github.com/dividab/tsconfig-paths/pull/197). Thanks to [@gopijaganthan](https://github.com/gopijaganthan) for this fix!
|
||||
|
||||
## [3.14.0] - 2022-03-13
|
||||
|
||||
### Added
|
||||
|
||||
- Support for path mapping starting with `/`. See PR [#180](https://github.com/dividab/tsconfig-paths/pull/180), issue [#113](https://github.com/dividab/tsconfig-paths/issues/113), and issue [#128](https://github.com/dividab/tsconfig-paths/issues/128). Thanks to [@benevbright](https://github.com/benevbright) for this fix!
|
||||
|
||||
## [3.13.0] - 2022-03-03
|
||||
|
||||
### Added
|
||||
|
||||
- Include file extension in paths resolved from package.json "main" field. See PR [#135](https://github.com/dividab/tsconfig-paths/pull/135) and issue [#133](https://github.com/dividab/tsconfig-paths/issues/133). Thanks to [@katywings](https://github.com/katywings) for this fix!
|
||||
|
||||
## [3.12.0] - 2021-08-24
|
||||
|
||||
- Add support for baseUrl override using TS_NODE_BASEURL env var #185 and #114. Thanks to @ejhayes and @information-security for these PRs!
|
||||
|
||||
## [3.11.0] - 2021-08-24
|
||||
|
||||
- Reverted upgrade of json5 due to being a breaking change. See PR #173.
|
||||
|
||||
## [3.10.1] - 2021-07-06
|
||||
|
||||
### Fixed
|
||||
|
||||
- Add register.js to published files
|
||||
|
||||
## [3.10.0] - 2021-07-06
|
||||
|
||||
### Added
|
||||
|
||||
- feat(tsconfig-loader): extends config from node_modules (#106). Thanks to @zorji for this PR!
|
||||
|
||||
### Fixed
|
||||
|
||||
- Update CHANGELOG.md (#96). Thanks to @OliverJAsh for this PR!
|
||||
- Fix "bootstraping" typo (#111). Thanks to @KRMisha for this PR!
|
||||
- Update Readme fixes #116 (#123). Thanks to @benwinding for this PR!
|
||||
- Fixed typo (#144). Thanks to @mprinc for this PR!
|
||||
- [TYPO] src/mapping-entry.ts (#145). Thanks to @mprinc for this PR!
|
||||
- docs(README): fix typos (#156). Thanks to @PiDelport for this PR!
|
||||
- deps: bump json5 to use type definition provided officially (#158). Thanks to @koba04 for this PR!
|
||||
- Update tsconfig-loader.ts (#161). Thanks to @fecqs for this PR!
|
||||
- fix typo (#165). Thanks to @wonda-tea-coffee for this PR!
|
||||
- Add file extenstion to typings property value (#151). Thanks to @dangrussell for this PR!
|
||||
|
||||
## [3.9.0] - 2019-09-12
|
||||
|
||||
### Added
|
||||
|
||||
- Make extension config override instead of deep merge. See PR [#95](https://github.com/dividab/tsconfig-paths/pull/95) and issue [#94](https://github.com/dividab/tsconfig-paths/issues/94). Thanks to [@OliverJAsh](https://github.com/OliverJAsh) for this addition!
|
||||
|
||||
## [3.8.0] - 2019-02-05
|
||||
|
||||
### Added
|
||||
|
||||
- Add option to avoid adding a match-all rule. See PR [#73](https://github.com/dividab/tsconfig-paths/pull/73) and issue [72](https://github.com/dividab/tsconfig-paths/issues/72). Thanks to [@Swatinem](https://github.com/Swatinem) for this addition!
|
||||
|
||||
## [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
|
||||
|
||||
### Added
|
||||
|
||||
- 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!
|
||||
|
||||
## [3.5.0] - 2018-07-28
|
||||
|
||||
### Added
|
||||
|
||||
- Add support for trailing commas in tsconfig.json (use JSON5 to parse). See issue [#48](https://github.com/dividab/tsconfig-paths/issues/48), and PR [#58](https://github.com/dividab/tsconfig-paths/pull/58). Thanks to [@jshado1](https://github.com/jshado1) for this addition!
|
||||
|
||||
## [3.4.2] - 2018-06-30
|
||||
|
||||
### Fixed
|
||||
|
||||
- Do not resolve directories, only files, sse issue [#51](https://github.com/dividab/tsconfig-paths/issues/51).
|
||||
|
||||
## [3.4.1] - 2018-06-24
|
||||
|
||||
### Fixed
|
||||
|
||||
- Ignore field name mappings in package.json files that are not paths of existing files [#46](https://github.com/dividab/tsconfig-paths/pull/45). Thanks to [@christoffer](https://github.com/christoffer) for this fix!
|
||||
|
||||
## [3.4.0] - 2018-06-12
|
||||
|
||||
### Added
|
||||
|
||||
- Add support for providing a list of field names to try instead of just using "main", [#45](https://github.com/dividab/tsconfig-paths/pull/45). Thanks to [@christoffer-dropbox](https://github.com/christoffer-dropbox) for this addition!
|
||||
|
||||
## [3.3.2] - 2018-05-07
|
||||
|
||||
### Fixed
|
||||
|
||||
- Adding json file extension to extends property, [#40](https://github.com/dividab/tsconfig-paths/pull/40). Thanks to [@cwhite-connectfirst](https://github.com/cwhite-connectfirst) for this fixing this!
|
||||
|
||||
## [3.3.1] - 2018-04-17
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix project undefined error when calling register, [#37](https://github.com/dividab/tsconfig-paths/issues/37). Thanks to [@natedanner](https://github.com/natedanner) for this fixing this!
|
||||
|
||||
## [3.3.0] - 2018-04-14
|
||||
|
||||
### Added
|
||||
|
||||
- Add possibility to indicate explicitly tsconfig location, [#35](https://github.com/dividab/tsconfig-paths/issues/35). Thanks to [@procopenco](https://github.com/procopenco) for this adding this!
|
||||
|
||||
## [3.2.0] - 2018-03-31
|
||||
|
||||
### Added
|
||||
|
||||
- Added support for passing a filename as cwd, see issue [#31](https://github.com/dividab/tsconfig-paths/issues/31) and PR [#32](https://github.com/dividab/tsconfig-paths/pull/32). Thanks to [@amodm](https://github.com/amodm) for this adding this!
|
||||
|
||||
## [3.1.3] - 2018-03-14
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix async recursion, see [#30](https://github.com/dividab/tsconfig-paths/pull/30). Thanks to [@Nayni](https://github.com/Nayni) for this fix!
|
||||
|
||||
## [3.1.2] - 2018-03-13
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix a forgotten return when doneCallback is invoked, see [#29](https://github.com/dividab/tsconfig-paths/pull/29). Thanks to [@Nayni](https://github.com/Nayni) for this fix!
|
||||
|
||||
## [3.1.1] - 2018-01-13
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix read json async when it does not exist
|
||||
|
||||
## [3.1.0] - 2018-01-13
|
||||
|
||||
### Added
|
||||
|
||||
- Implement default async json reader function.
|
||||
|
||||
## [3.0.0] - 2018-01-13
|
||||
|
||||
### Changed
|
||||
|
||||
- Remove parameter `absoluteSourceFileName` from the `MatchPath` and `matchFromAbsolutePaths` functions. It was not used internally.
|
||||
- `matchFromAbsolutePaths` now accepts a pre-sorted array of `MappingEntry`s instead of a dictionary. This was done so the sorting could be done once which should give better performance.
|
||||
|
||||
### Added
|
||||
|
||||
- `createMatchPathAsync`, creates an async version of the `MatchPath` function. Can be used for example by webpack plugins.
|
||||
- `matchFromAbsolutePathsAsync`, async version of `matchFromAbsolutePaths`.
|
||||
|
||||
## [2.7.3]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Only resolve path if tsconfig present [#25](https://github.com/dividab/tsconfig-paths/pull/25). Thanks to @nicoschoenmaker for the PR.
|
||||
|
||||
## [2.7.2]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Return absolute path to tsconfig.json.
|
||||
|
||||
## [2.7.1]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Remove left over console.log.
|
||||
|
||||
## [2.7.0]
|
||||
|
||||
### Added
|
||||
|
||||
- Support `baseUrl` to exist in base tsconfig.json when using `extends`, see [#23](https://github.com/dividab/tsconfig-paths/issues/23).
|
||||
|
||||
## [2.6.0]
|
||||
|
||||
### Added
|
||||
|
||||
- Add `baseUrl` and `configFileAbsolutePath` to the result of `loadConfig`.
|
||||
|
||||
## [2.5.0]
|
||||
|
||||
### Added
|
||||
|
||||
- New function in Programmatic API `loadConfig`.
|
||||
|
||||
## [2.4.3]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Export MatchPth typing.
|
||||
|
||||
## [2.4.2]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Add missing types field in package.json.
|
||||
|
||||
## [2.4.1]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Include declaration files. Fixes [#22](https://github.com/dividab/tsconfig-paths/issues/22).
|
||||
|
||||
## [2.4.0]
|
||||
|
||||
### Changed
|
||||
|
||||
- Removed dependency for package `tsconfig`.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Support for config inheritance with `extends`. Fixes [#17](https://github.com/dividab/tsconfig-paths/issues/17).
|
||||
|
||||
## [2.2.0]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed issue [#7](https://github.com/dividab/tsconfig-paths/issues/7).
|
||||
|
||||
## [2.1.2]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed issue [#6](https://github.com/dividab/tsconfig-paths/issues/6).
|
||||
|
||||
## [2.1.1]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed issue [#4](https://github.com/dividab/tsconfig-paths/issues/4)
|
||||
|
||||
## [2.1.0]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed issue [#3](https://github.com/dividab/tsconfig-paths/issues/3)
|
||||
|
||||
## [2.0.0]
|
||||
|
||||
### Added
|
||||
|
||||
- We now look at `process.env.TS_NODE_PROJECT`
|
||||
- Functionality to bootstrap tsconfig-paths. Documentation in [README](https://github.com/dividab/tsconfig-paths/blob/master/README.md)
|
||||
|
||||
### Changed
|
||||
|
||||
- Changed signature for `createMatchPath`. Now only takes absoluteUrl and paths.
|
||||
|
||||
## [1.1.0]
|
||||
|
||||
### Added
|
||||
|
||||
- More explanation to readme.
|
||||
- Match all extensions in require.extensions.
|
||||
- Match longest pattern prefix first as typesript does.
|
||||
- Match file in main field of package.json.
|
||||
- Check for index files explicitly.
|
||||
|
||||
## [1.0.0] - 2016-12-30
|
||||
|
||||
- First stable release.
|
||||
|
||||
## [0.4.0] - 2016-12-30
|
||||
|
||||
### Changed
|
||||
|
||||
- Renamed project to `tsocnfig-paths`.
|
||||
|
||||
## [0.3.0] - 2016-12-30
|
||||
|
||||
### Added
|
||||
|
||||
- API documentation.
|
||||
- `createMatchPath` function.
|
||||
- `matchFromAbsolutePaths` function.
|
||||
|
||||
### Removed
|
||||
|
||||
- `findPath` function.
|
||||
|
||||
## [0.2.1] - 2016-12-29
|
||||
|
||||
### Fixed
|
||||
|
||||
- `tsconfig-paths/register` was not available.
|
||||
|
||||
## [0.2.0] - 2016-12-29
|
||||
|
||||
### Fixed
|
||||
|
||||
- Paths for files in sub-dirs.
|
||||
|
||||
### Added
|
||||
|
||||
- Programmatic use.
|
||||
|
||||
## [0.1.2] - 2016-12-28
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed wrong name of the package in README.
|
||||
- Add missing files on publish.
|
||||
|
||||
## [0.1.1] - 2016-12-28
|
||||
|
||||
### Added
|
||||
|
||||
- Loading of tsconfig.
|
||||
- Example.
|
||||
- Publish scripts.
|
||||
|
||||
## [0.1.0] - 2016-12-28
|
||||
|
||||
- Initial version.
|
||||
|
||||
[unreleased]: https://github.com/dividab/tsconfig-paths/compare/v3.9.0...master
|
||||
[3.9.0]: https://github.com/dividab/tsconfig-paths/compare/v3.8.0...v3.9.0
|
||||
[3.8.0]: https://github.com/dividab/tsconfig-paths/compare/3.7.0...3.8.0
|
||||
[3.7.0]: https://github.com/dividab/tsconfig-paths/compare/3.6.0...3.7.0
|
||||
[3.6.0]: https://github.com/dividab/tsconfig-paths/compare/3.5.0...3.6.0
|
||||
[3.5.0]: https://github.com/dividab/tsconfig-paths/compare/3.4.2...3.5.0
|
||||
[3.4.2]: https://github.com/dividab/tsconfig-paths/compare/3.4.1...3.4.2
|
||||
[3.4.1]: https://github.com/dividab/tsconfig-paths/compare/3.4.0...3.4.1
|
||||
[3.4.0]: https://github.com/dividab/tsconfig-paths/compare/3.3.2...3.4.0
|
||||
[3.3.2]: https://github.com/dividab/tsconfig-paths/compare/3.3.1...3.3.2
|
||||
[3.3.1]: https://github.com/dividab/tsconfig-paths/compare/3.3.0...3.3.1
|
||||
[3.3.0]: https://github.com/dividab/tsconfig-paths/compare/3.2.0...3.3.0
|
||||
[3.2.0]: https://github.com/dividab/tsconfig-paths/compare/3.1.3...3.2.0
|
||||
[3.1.3]: https://github.com/dividab/tsconfig-paths/compare/3.1.2...3.1.3
|
||||
[3.1.2]: https://github.com/dividab/tsconfig-paths/compare/3.1.1...3.1.2
|
||||
[3.1.1]: https://github.com/dividab/tsconfig-paths/compare/3.1.0...3.1.1
|
||||
[3.1.0]: https://github.com/dividab/tsconfig-paths/compare/3.0.0...3.1.0
|
||||
[3.0.0]: https://github.com/dividab/tsconfig-paths/compare/2.7.3...3.0.0
|
||||
[2.7.3]: https://github.com/dividab/tsconfig-paths/compare/2.7.2...2.7.3
|
||||
[2.7.2]: https://github.com/dividab/tsconfig-paths/compare/2.7.1...2.7.2
|
||||
[2.7.1]: https://github.com/dividab/tsconfig-paths/compare/2.7.0...2.7.1
|
||||
[2.7.0]: https://github.com/dividab/tsconfig-paths/compare/2.6.0...2.7.0
|
||||
[2.6.0]: https://github.com/dividab/tsconfig-paths/compare/2.5.0...2.6.0
|
||||
[2.5.0]: https://github.com/dividab/tsconfig-paths/compare/2.4.3...2.5.0
|
||||
[2.4.3]: https://github.com/dividab/tsconfig-paths/compare/2.4.2...2.4.3
|
||||
[2.4.2]: https://github.com/dividab/tsconfig-paths/compare/2.4.1...2.4.2
|
||||
[2.4.1]: https://github.com/dividab/tsconfig-paths/compare/2.4.0...2.4.1
|
||||
[2.4.0]: https://github.com/dividab/tsconfig-paths/compare/2.2.0...2.4.0
|
||||
[2.2.0]: https://github.com/dividab/tsconfig-paths/compare/2.1.2...2.2.0
|
||||
[2.1.2]: https://github.com/dividab/tsconfig-paths/compare/2.1.1...2.1.2
|
||||
[2.1.1]: https://github.com/dividab/tsconfig-paths/compare/2.1.0...2.1.1
|
||||
21
install/config-ui/node_modules/tsconfig-paths/LICENSE
generated
vendored
Normal file
21
install/config-ui/node_modules/tsconfig-paths/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Jonas Kello
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
268
install/config-ui/node_modules/tsconfig-paths/README.md
generated
vendored
Normal file
268
install/config-ui/node_modules/tsconfig-paths/README.md
generated
vendored
Normal file
@@ -0,0 +1,268 @@
|
||||
# tsconfig-paths
|
||||
|
||||
[![npm version][version-image]][version-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]
|
||||
|
||||
Use this to load modules whose location is specified in the `paths` section of `tsconfig.json`. Both loading at run-time and via API are supported.
|
||||
|
||||
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 physical file paths that node can load.
|
||||
|
||||
## How to install
|
||||
|
||||
```
|
||||
yarn add --dev tsconfig-paths
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
npm install --save-dev tsconfig-paths
|
||||
```
|
||||
|
||||
## How to use
|
||||
|
||||
### With node
|
||||
|
||||
`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`
|
||||
|
||||
If `process.env.TS_NODE_PROJECT` is set it will be used to resolved tsconfig.json
|
||||
|
||||
### With webpack
|
||||
|
||||
For webpack please use the [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin).
|
||||
|
||||
### With mocha and ts-node
|
||||
|
||||
As of Mocha >= 4.0.0 the `--compiler` was [deprecated](https://github.com/mochajs/mocha/wiki/compilers-deprecation). Instead `--require` should be used. You also have to specify a glob that includes `.ts` files because mocha looks after files with `.js` extension by default.
|
||||
|
||||
```bash
|
||||
mocha -r ts-node/register -r tsconfig-paths/register "test/**/*.ts"
|
||||
```
|
||||
|
||||
### With other commands
|
||||
|
||||
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.
|
||||
|
||||
### 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");
|
||||
|
||||
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,
|
||||
});
|
||||
|
||||
// When path registration is no longer needed
|
||||
cleanup();
|
||||
```
|
||||
|
||||
Then run with:
|
||||
|
||||
`node -r ./tsconfig-paths-bootstrap.js main.js`
|
||||
|
||||
## Configuration Options
|
||||
|
||||
You can set options by passing them before the script path, via programmatic usage or via environment variables.
|
||||
|
||||
```bash
|
||||
ts-node --project customLocation/tsconfig.json -r tsconfig-paths/register "test/**/*.ts"
|
||||
```
|
||||
|
||||
### CLI and Programmatic Options
|
||||
|
||||
_Environment variable denoted in parentheses._
|
||||
|
||||
- `-P, --project [path]` Path to TypeScript JSON project file (`TS_NODE_PROJECT`)
|
||||
|
||||
## Config loading process
|
||||
|
||||
1. Use explicit params passed to register
|
||||
2. Use `process.env.TS_NODE_PROJECT` to resolve tsConfig.json and the specified baseUrl and paths.
|
||||
3. Resolves tsconfig.json from current working directory and the specified baseUrl and paths.
|
||||
|
||||
## Programmatic use
|
||||
|
||||
The public API consists of these functions:
|
||||
|
||||
- [register](#register)
|
||||
- [loadConfig](#loadConfig)
|
||||
- [createMatchPath](#createMatchPath) / [createMatchPathAsync](#createMatchPathAsync)
|
||||
- [matchFromAbsolutePaths](#matchFromAbsolutePaths) / [matchFromAbsolutePathsAsync](#matchFromAbsolutePathsAsync)
|
||||
|
||||
### register
|
||||
|
||||
```typescript
|
||||
export interface ExplicitParams {
|
||||
baseUrl: string;
|
||||
paths: { [key: string]: Array<string> };
|
||||
mainFields?: Array<string>;
|
||||
addMatchAll?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs a custom module load function that can adhere to paths in tsconfig.
|
||||
*/
|
||||
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.
|
||||
|
||||
### loadConfig
|
||||
|
||||
```typescript
|
||||
export function loadConfig(cwd: string = process.cwd()): ConfigLoaderResult;
|
||||
|
||||
export type ConfigLoaderResult =
|
||||
| ConfigLoaderSuccessResult
|
||||
| ConfigLoaderFailResult;
|
||||
|
||||
export interface ConfigLoaderSuccessResult {
|
||||
resultType: "success";
|
||||
absoluteBaseUrl: string;
|
||||
paths: { [key: string]: Array<string> };
|
||||
}
|
||||
|
||||
export interface ConfigLoaderFailResult {
|
||||
resultType: "failed";
|
||||
message: string;
|
||||
}
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
### createMatchPath
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* Function that can match a path
|
||||
*/
|
||||
export interface MatchPath {
|
||||
(
|
||||
requestedModule: string,
|
||||
readJson?: Filesystem.ReadJsonSync,
|
||||
fileExists?: (name: string) => boolean,
|
||||
extensions?: ReadonlyArray<string>
|
||||
): string | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a function that can resolve paths according to tsconfig paths property.
|
||||
* @param absoluteBaseUrl Absolute version of baseUrl as specified in tsconfig.
|
||||
* @param paths The paths as specified in tsconfig.
|
||||
* @param mainFields A list of package.json field names to try when resolving module files.
|
||||
* @param addMatchAll Add a match-all "*" rule if none is present
|
||||
* @returns a function that can resolve paths.
|
||||
*/
|
||||
export function createMatchPath(
|
||||
absoluteBaseUrl: string,
|
||||
paths: { [key: string]: Array<string> },
|
||||
mainFields: string[] = ["main"],
|
||||
addMatchAll: boolean = true
|
||||
): 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 signature specified by the type `MatchPath` above.
|
||||
|
||||
### matchFromAbsolutePaths
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* Finds a path from tsconfig that matches a module load request.
|
||||
* @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 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.
|
||||
*/
|
||||
export function matchFromAbsolutePaths(
|
||||
absolutePathMappings: ReadonlyArray<MappingEntry.MappingEntry>,
|
||||
requestedModule: string,
|
||||
readJson: Filesystem.ReadJsonSync = Filesystem.readJsonFromDiskSync,
|
||||
fileExists: Filesystem.FileExistsSync = Filesystem.fileExistsSync,
|
||||
extensions: Array<string> = Object.keys(require.extensions),
|
||||
mainFields: string[] = ["main"]
|
||||
): string | undefined {
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
This is the async version of `createMatchPath`. It has the same signature but with a callback parameter for the result.
|
||||
|
||||
### matchFromAbsolutePathsAsync
|
||||
|
||||
This is the async version of `matchFromAbsolutePaths`. It has the same signature but with a callback parameter for the result.
|
||||
|
||||
## 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
|
||||
[version-url]: https://www.npmjs.com/package/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
|
||||
[license-url]: https://opensource.org/licenses/MIT
|
||||
[prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg
|
||||
[prettier-url]: https://github.com/prettier/prettier
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.d.ts
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
88
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.js
generated
vendored
Normal file
88
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var config_loader_1 = require("../config-loader");
|
||||
var path_1 = require("path");
|
||||
describe("config-loader", function () {
|
||||
it("should use explicitParams when set", function () {
|
||||
var result = (0, config_loader_1.configLoader)({
|
||||
explicitParams: {
|
||||
baseUrl: "/foo/bar",
|
||||
paths: {
|
||||
asd: ["asd"],
|
||||
},
|
||||
},
|
||||
cwd: "/baz",
|
||||
});
|
||||
var successResult = result;
|
||||
// assert.equal(successResult.resultType, "success");
|
||||
// assert.equal(successResult.absoluteBaseUrl, "/foo/bar");
|
||||
// assert.equal(successResult.paths["asd"][0], "asd");
|
||||
expect(successResult.resultType).toBe("success");
|
||||
expect(successResult.absoluteBaseUrl).toBe("/foo/bar");
|
||||
expect(successResult.paths["asd"][0]).toBe("asd");
|
||||
});
|
||||
it("should use explicitParams when set and add cwd when path is relative", function () {
|
||||
var result = (0, config_loader_1.configLoader)({
|
||||
explicitParams: {
|
||||
baseUrl: "bar/",
|
||||
paths: {
|
||||
asd: ["asd"],
|
||||
},
|
||||
},
|
||||
cwd: "/baz",
|
||||
});
|
||||
var successResult = result;
|
||||
// assert.equal(successResult.resultType, "success");
|
||||
// assert.equal(successResult.absoluteBaseUrl, join("/baz", "bar/"));
|
||||
expect(successResult.resultType).toBe("success");
|
||||
expect(successResult.absoluteBaseUrl).toBe((0, path_1.join)("/baz", "bar/"));
|
||||
});
|
||||
it("should fallback to tsConfigLoader when explicitParams is not set", function () {
|
||||
var result = (0, config_loader_1.configLoader)({
|
||||
explicitParams: undefined,
|
||||
cwd: "/baz",
|
||||
// tslint:disable-next-line:no-any
|
||||
tsConfigLoader: function (_) { return ({
|
||||
tsConfigPath: "/baz/tsconfig.json",
|
||||
baseUrl: "./src",
|
||||
paths: {},
|
||||
}); },
|
||||
});
|
||||
var successResult = result;
|
||||
// assert.equal(successResult.resultType, "success");
|
||||
// assert.equal(successResult.absoluteBaseUrl, join("/baz", "src"));
|
||||
expect(successResult.resultType).toBe("success");
|
||||
expect(successResult.absoluteBaseUrl).toBe((0, path_1.join)("/baz", "src"));
|
||||
});
|
||||
it("should show an error message when baseUrl is missing", function () {
|
||||
var result = (0, config_loader_1.configLoader)({
|
||||
explicitParams: undefined,
|
||||
cwd: "/baz",
|
||||
// tslint:disable-next-line:no-any
|
||||
tsConfigLoader: function (_) { return ({
|
||||
tsConfigPath: "/baz/tsconfig.json",
|
||||
baseUrl: undefined,
|
||||
paths: {},
|
||||
}); },
|
||||
});
|
||||
var failResult = result;
|
||||
// assert.equal(failResult.resultType, "failed");
|
||||
// assert.isTrue(failResult.message.indexOf("baseUrl") > -1);
|
||||
expect(failResult.resultType).toBe("failed");
|
||||
expect(failResult.message.indexOf("baseUrl") > -1).toBeTruthy();
|
||||
});
|
||||
it("should presume cwd to be a tsconfig file when loadConfig is called with absolute path to tsconfig.json", function () {
|
||||
// using tsconfig-named.json to ensure that future changes to fix
|
||||
// https://github.com/dividab/tsconfig-paths/issues/31
|
||||
// do not pass this test case just because of a directory walk looking
|
||||
// for tsconfig.json
|
||||
var configFile = (0, path_1.join)(__dirname, "tsconfig-named.json");
|
||||
var result = (0, config_loader_1.loadConfig)(configFile);
|
||||
var successResult = result;
|
||||
// assert.equal(successResult.resultType, "success");
|
||||
// assert.equal(successResult.configFileAbsolutePath, configFile);
|
||||
expect(successResult.resultType).toBe("success");
|
||||
expect(successResult.configFileAbsolutePath).toBe(configFile);
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=config-loader.test.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"config-loader.test.js","sourceRoot":"","sources":["../../src/__tests__/config-loader.test.ts"],"names":[],"mappings":";;AAAA,kDAK0B;AAC1B,6BAA4B;AAE5B,QAAQ,CAAC,eAAe,EAAE;IACxB,EAAE,CAAC,oCAAoC,EAAE;QACvC,IAAM,MAAM,GAAG,IAAA,4BAAY,EAAC;YAC1B,cAAc,EAAE;gBACd,OAAO,EAAE,UAAU;gBACnB,KAAK,EAAE;oBACL,GAAG,EAAE,CAAC,KAAK,CAAC;iBACb;aACF;YACD,GAAG,EAAE,MAAM;SACZ,CAAC,CAAC;QAEH,IAAM,aAAa,GAAG,MAAmC,CAAC;QAC1D,qDAAqD;QACrD,2DAA2D;QAC3D,sDAAsD;QACtD,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjD,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACvD,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sEAAsE,EAAE;QACzE,IAAM,MAAM,GAAG,IAAA,4BAAY,EAAC;YAC1B,cAAc,EAAE;gBACd,OAAO,EAAE,MAAM;gBACf,KAAK,EAAE;oBACL,GAAG,EAAE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,CAI1B;SACH,CAAC,CAAC;QAEH,IAAM,UAAU,GAAG,MAAgC,CAAC;QACpD,iDAAiD;QACjD,6DAA6D;QAC7D,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7C,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wGAAwG,EAAE;QAC3G,iEAAiE;QACjE,sDAAsD;QACtD,sEAAsE;QACtE,oBAAoB;QACpB,IAAM,UAAU,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;QAC1D,IAAM,MAAM,GAAG,IAAA,0BAAU,EAAC,UAAU,CAAC,CAAC;QAEtC,IAAM,aAAa,GAAG,MAAmC,CAAC;QAC1D,qDAAqD;QACrD,kEAAkE;QAClE,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjD,MAAM,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||
17
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.d.ts
generated
vendored
Normal file
17
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export interface OneTest {
|
||||
readonly name: string;
|
||||
readonly only?: boolean;
|
||||
readonly skip?: boolean;
|
||||
readonly absoluteBaseUrl: string;
|
||||
readonly paths: {
|
||||
[key: string]: Array<string>;
|
||||
};
|
||||
readonly mainFields?: string[];
|
||||
readonly addMatchAll?: boolean;
|
||||
readonly existingFiles: ReadonlyArray<string>;
|
||||
readonly requestedModule: string;
|
||||
readonly extensions: ReadonlyArray<string>;
|
||||
readonly packageJson?: {};
|
||||
readonly expectedPath: string | undefined;
|
||||
}
|
||||
export declare const tests: ReadonlyArray<OneTest>;
|
||||
205
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.js
generated
vendored
Normal file
205
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.js
generated
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.tests = void 0;
|
||||
var path_1 = require("path");
|
||||
var filesystem_1 = require("../../filesystem");
|
||||
var defaultExtensionsWhenRunningInTsNode = [
|
||||
".js",
|
||||
".json",
|
||||
".node",
|
||||
".ts",
|
||||
".tsx",
|
||||
];
|
||||
exports.tests = [
|
||||
{
|
||||
name: "should locate path that matches with star and exists",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {
|
||||
"lib/*": ["location/*"],
|
||||
},
|
||||
existingFiles: [(0, path_1.join)("/root", "location", "mylib", "index.ts")],
|
||||
requestedModule: "lib/mylib",
|
||||
expectedPath: (0, path_1.dirname)((0, path_1.join)("/root", "location", "mylib", "index.ts")),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should resolve to correct path when many are specified",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {
|
||||
"lib/*": ["foo1/*", "foo2/*", "location/*", "foo3/*"],
|
||||
},
|
||||
existingFiles: [(0, path_1.join)("/root", "location", "mylib", "index.ts")],
|
||||
requestedModule: "lib/mylib",
|
||||
extensions: [".ts"],
|
||||
expectedPath: (0, path_1.dirname)((0, path_1.join)("/root", "location", "mylib", "index.ts")),
|
||||
},
|
||||
{
|
||||
name: "should locate path that matches with star and prioritize pattern with longest prefix",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {
|
||||
"*": ["location/*"],
|
||||
"lib/*": ["location/*"],
|
||||
},
|
||||
existingFiles: [
|
||||
(0, path_1.join)("/root", "location", "lib", "mylib", "index.ts"),
|
||||
(0, path_1.join)("/root", "location", "mylib", "index.ts"),
|
||||
],
|
||||
requestedModule: "lib/mylib",
|
||||
expectedPath: (0, path_1.dirname)((0, path_1.join)("/root", "location", "mylib", "index.ts")),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should locate path that matches with star and exists with extension",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [(0, path_1.join)("/root", "location", "mylib.myext")],
|
||||
requestedModule: "lib/mylib",
|
||||
extensions: [".js", ".myext"],
|
||||
expectedPath: (0, filesystem_1.removeExtension)((0, path_1.join)("/root", "location", "mylib.myext")),
|
||||
},
|
||||
{
|
||||
name: "should resolve request with extension specified",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [(0, path_1.join)("/root", "location", "test.jpg")],
|
||||
requestedModule: "lib/test.jpg",
|
||||
expectedPath: (0, path_1.join)("/root", "location", "test.jpg"),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should locate path that matches without star and exists",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {
|
||||
"lib/foo": ["location/foo"],
|
||||
},
|
||||
existingFiles: [(0, path_1.join)("/root", "location", "foo.ts")],
|
||||
requestedModule: "lib/foo",
|
||||
expectedPath: (0, filesystem_1.removeExtension)((0, path_1.join)("/root", "location", "foo.ts")),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should resolve to parent folder when filename is in subfolder",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [(0, path_1.join)("/root", "location", "mylib", "index.ts")],
|
||||
requestedModule: "lib/mylib",
|
||||
expectedPath: (0, path_1.dirname)((0, path_1.join)("/root", "location", "mylib", "index.ts")),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should resolve from main field in package.json",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [(0, path_1.join)("/root", "location", "mylib", "kalle.ts")],
|
||||
packageJson: { main: "./kalle.ts" },
|
||||
requestedModule: "lib/mylib",
|
||||
expectedPath: (0, path_1.join)("/root", "location", "mylib", "kalle.ts"),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should resolve from main field in package.json (js)",
|
||||
absoluteBaseUrl: "/root",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [(0, path_1.join)("/root", "location", "mylib.js", "kalle.js")],
|
||||
packageJson: { main: "./kalle.js" },
|
||||
requestedModule: "lib/mylib.js",
|
||||
extensions: [".ts", ".js"],
|
||||
expectedPath: (0, path_1.join)("/root", "location", "mylib.js", "kalle.js"),
|
||||
},
|
||||
{
|
||||
name: "should resolve from list of fields by priority in package.json",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
mainFields: ["missing", "browser", "main"],
|
||||
packageJson: { main: "./main.js", browser: "./browser.js" },
|
||||
existingFiles: [
|
||||
(0, path_1.join)("/root", "location", "mylibjs", "main.js"),
|
||||
(0, path_1.join)("/root", "location", "mylibjs", "browser.js"), // browserFilePath
|
||||
],
|
||||
extensions: [".ts", ".js"],
|
||||
requestedModule: "lib/mylibjs",
|
||||
expectedPath: (0, path_1.join)("/root", "location", "mylibjs", "browser.js"),
|
||||
},
|
||||
{
|
||||
name: "should ignore field mappings to missing files in package.json",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
mainFields: ["browser", "main"],
|
||||
existingFiles: [(0, path_1.join)("/root", "location", "mylibjs", "kalle.js")],
|
||||
requestedModule: "lib/mylibjs",
|
||||
packageJson: {
|
||||
main: "./kalle.js",
|
||||
browser: "./nope.js",
|
||||
},
|
||||
extensions: [".ts", ".js"],
|
||||
expectedPath: (0, path_1.join)("/root", "location", "mylibjs", "kalle.js"),
|
||||
},
|
||||
{
|
||||
name: "should ignore advanced field mappings in package.json",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [
|
||||
(0, path_1.join)("/root", "location", "mylibjs", "kalle.js"),
|
||||
(0, path_1.join)("/root", "location", "mylibjs", "browser.js"),
|
||||
],
|
||||
requestedModule: "lib/mylibjs",
|
||||
packageJson: {
|
||||
main: "./kalle.js",
|
||||
browser: { mylibjs: "./browser.js", "./kalle.js": "./browser.js" },
|
||||
},
|
||||
extensions: [".ts", ".js"],
|
||||
expectedPath: (0, path_1.join)("/root", "location", "mylibjs", "kalle.js"),
|
||||
},
|
||||
{
|
||||
name: "should resolve to with the help of baseUrl when not explicitly set",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {},
|
||||
existingFiles: [(0, path_1.join)("/root", "mylib", "index.ts")],
|
||||
requestedModule: "mylib",
|
||||
expectedPath: (0, path_1.dirname)((0, path_1.join)("/root", "mylib", "index.ts")),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should not resolve with the help of baseUrl when asked not to",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {},
|
||||
addMatchAll: false,
|
||||
existingFiles: [(0, path_1.join)("/root", "mylib", "index.ts")],
|
||||
requestedModule: "mylib",
|
||||
expectedPath: undefined,
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should not locate path that does not match",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [(0, path_1.join)("root", "location", "mylib")],
|
||||
requestedModule: "mylib",
|
||||
expectedPath: undefined,
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should not resolve typings file (index.d.ts)",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {
|
||||
"lib/*": ["location/*"],
|
||||
},
|
||||
existingFiles: [(0, path_1.join)("/root", "location", "mylib", "index.d.ts")],
|
||||
requestedModule: "lib/mylib",
|
||||
expectedPath: undefined,
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should resolve main file with cjs file extension",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {},
|
||||
existingFiles: [(0, path_1.join)("/root", "mylib", "index.cjs")],
|
||||
packageJson: {
|
||||
main: "./index.cjs",
|
||||
},
|
||||
requestedModule: "mylib",
|
||||
expectedPath: (0, path_1.join)("/root", "mylib", "index.cjs"),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
];
|
||||
//# sourceMappingURL=match-path-data.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.d.ts
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
64
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.js
generated
vendored
Normal file
64
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Filesystem = require("../filesystem");
|
||||
var path = require("path");
|
||||
describe("filesystem", function () {
|
||||
var fileThatExists = path.join(__dirname, "../../package.json");
|
||||
var fileThatNotExists = path.join(__dirname, "../../package2.json");
|
||||
it("should find file that exists, sync", function () {
|
||||
var result = Filesystem.fileExistsSync(fileThatExists);
|
||||
// assert.equal(result, true);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
it("should not find file that not exists, sync", function () {
|
||||
var result = Filesystem.fileExistsSync(fileThatNotExists);
|
||||
// assert.equal(result, false);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
it("should find file that exists, async", function (done) {
|
||||
Filesystem.fileExistsAsync(fileThatExists, function (_err, result) {
|
||||
try {
|
||||
// assert.equal(result, true);
|
||||
expect(result).toBe(true);
|
||||
done();
|
||||
}
|
||||
catch (error) {
|
||||
done(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
it("should not find file that not exists, async", function (done) {
|
||||
Filesystem.fileExistsAsync(fileThatNotExists, function (_err, result) {
|
||||
try {
|
||||
// assert.equal(result, false);
|
||||
expect(result).toBe(false);
|
||||
done();
|
||||
}
|
||||
catch (error) {
|
||||
done(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
it("should load json, sync", function () {
|
||||
var result = Filesystem.readJsonFromDiskSync(fileThatExists);
|
||||
// assert.isOk(result);
|
||||
expect(result);
|
||||
// assert.equal(result.main, "lib/index.js");
|
||||
expect(result.main).toBe("lib/index.js");
|
||||
});
|
||||
it("should load json, async", function (done) {
|
||||
Filesystem.readJsonFromDiskAsync(fileThatExists, function (_err, result) {
|
||||
try {
|
||||
// assert.isOk(result); // Asserts that object is truthy.
|
||||
expect(result).toBeTruthy();
|
||||
// assert.equal(result.main, "lib/index.js");
|
||||
expect(result.main).toBe("lib/index.js");
|
||||
done();
|
||||
}
|
||||
catch (error) {
|
||||
done(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=filesystem.test.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"filesystem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AAI,CAAC,KAAK,CAAC,CAAC;gBAC3B,IAAI,EAAE,CAAC;aACR;YAAC,OAAO,KAAK,EAAE;gBACd,IAAI,CAAC,KAAK,CAAC,CAAC;aACb;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wBAAwB,EAAE;QAC3B,IAAM,MAAM,GAAG,UAAU,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;QAC/D,uBAAuB;QACvB,MAAM,CAAC,MAAM,CAAC,CAAC;QACf,6CAA6C;QAC7C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,UAAC,IAAI;QACjC,UAAU,CAAC,qBAAqB,CAAC,cAAc,EAAE,UAAC,IAAI,EAAE,MAAM;YAC5D,IAAI;gBACF,yDAAyD;gBACzD,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;gBAC5B,6CAA6C;gBAC7C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBACzC,IAAI,EAAE,CAAC;aACR;YAAC,OAAO,KAAK,EAAE;gBACd,IAAI,CAAC,KAAK,CAAC,CAAC;aACb;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.d.ts
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
66
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.js
generated
vendored
Normal file
66
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var mapping_entry_1 = require("../mapping-entry");
|
||||
var path_1 = require("path");
|
||||
describe("mapping-entry", function () {
|
||||
it("should change to absolute paths and sort in longest prefix order", function () {
|
||||
var result = (0, mapping_entry_1.getAbsoluteMappingEntries)("/absolute/base/url", {
|
||||
"*": ["/foo1", "/foo2"],
|
||||
"longest/pre/fix/*": ["/foo2/bar"],
|
||||
"pre/fix/*": ["/foo3"],
|
||||
}, true);
|
||||
// assert.deepEqual(result, [
|
||||
// {
|
||||
// pattern: "longest/pre/fix/*",
|
||||
// paths: [join("/absolute", "base", "url", "foo2", "bar")],
|
||||
// },
|
||||
// {
|
||||
// pattern: "pre/fix/*",
|
||||
// paths: [join("/absolute", "base", "url", "foo3")],
|
||||
// },
|
||||
// {
|
||||
// pattern: "*",
|
||||
// paths: [
|
||||
// join("/absolute", "base", "url", "foo1"),
|
||||
// join("/absolute", "base", "url", "foo2"),
|
||||
// ],
|
||||
// },
|
||||
// ]);
|
||||
expect(result).toEqual([
|
||||
{
|
||||
pattern: "longest/pre/fix/*",
|
||||
paths: [(0, path_1.join)("/absolute", "base", "url", "foo2", "bar")],
|
||||
},
|
||||
{
|
||||
pattern: "pre/fix/*",
|
||||
paths: [(0, path_1.join)("/absolute", "base", "url", "foo3")],
|
||||
},
|
||||
{
|
||||
pattern: "*",
|
||||
paths: [
|
||||
(0, path_1.join)("/absolute", "base", "url", "foo1"),
|
||||
(0, path_1.join)("/absolute", "base", "url", "foo2"),
|
||||
],
|
||||
},
|
||||
]);
|
||||
});
|
||||
it("should should add a match-all pattern when requested", function () {
|
||||
var result = (0, mapping_entry_1.getAbsoluteMappingEntries)("/absolute/base/url", {}, true);
|
||||
// assert.deepEqual(result, [
|
||||
// {
|
||||
// pattern: "*",
|
||||
// paths: [join("/absolute", "base", "url", "*")],
|
||||
// },
|
||||
// ]);
|
||||
expect(result).toEqual([
|
||||
{
|
||||
pattern: "*",
|
||||
paths: [(0, path_1.join)("/absolute", "base", "url", "*")],
|
||||
},
|
||||
]);
|
||||
result = (0, mapping_entry_1.getAbsoluteMappingEntries)("/absolute/base/url", {}, false);
|
||||
// assert.deepEqual(result, []);
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=mapping-entry.test.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mapping-entry.test.js","sourceRoot":"","sources":["../../src/__tests__/mapping-entry.test.ts"],"names":[],"mappings":";;AAAA,kDAA6D;AAC7D,6BAA4B;AAE5B,QAAQ,CAAC,eAAe,EAAE;IACxB,EAAE,CAAC,kEAAkE,EAAE;QACrE,IAAM,MAAM,GAAG,IAAA,yCAAyB,EACtC,oBAAoB,EACpB;YACE,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;YACvB,mBAAmB,EAAE,CAAC,WAAW,CAAC;YAClC,WAAW,EAAE,CAAC,OAAO,CAAC;SACvB,EACD,IAAI,CACL,CAAC;QACF,6BAA6B;QAC7B,MAAM;QACN,oCAAoC;QACpC,gEAAgE;QAChE,OAAO;QACP,MAAM;QACN,4BAA4B;QAC5B,yDAAyD;QACzD,OAAO;QACP,MAAM;QACN,oBAAoB;QACpB,eAAe;QACf,kDAAkD;QAClD,kDAAkD;QAClD,SAAS;QACT,OAAO;QACP,MAAM;QACN,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB;gBACE,OAAO,EAAE,mBAAmB;gBAC5B,KAAK,EAAE,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;aACzD;YACD;gBACE,OAAO,EAAE,WAAW;gBACpB,KAAK,EAAE,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;aAClD;YACD;gBACE,OAAO,EAAE,GAAG;gBACZ,KAAK,EAAE;oBACL,IAAA,WAAI,EAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;oBACxC,IAAA,WAAI,EAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;iBACzC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE;QACzD,IAAI,MAAM,GAAG,IAAA,yCAAyB,EAAC,oBAAoB,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;QACvE,6BAA6B;QAC7B,MAAM;QACN,oBAAoB;QACpB,sDAAsD;QACtD,OAAO;QACP,MAAM;QACN,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB;gBACE,OAAO,EAAE,GAAG;gBACZ,KAAK,EAAE,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;aAC/C;SACF,CAAC,CAAC;QAEH,MAAM,GAAG,IAAA,yCAAyB,EAAC,oBAAoB,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACpE,gCAAgC;QAChC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.d.ts
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
19
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.js
generated
vendored
Normal file
19
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var match_path_async_1 = require("../match-path-async");
|
||||
var Tests = require("./data/match-path-data");
|
||||
describe("match-path-async", function () {
|
||||
Tests.tests.forEach(function (t) {
|
||||
return it(t.name, function (done) {
|
||||
var matchPath = (0, match_path_async_1.createMatchPathAsync)(t.absoluteBaseUrl, t.paths, t.mainFields, t.addMatchAll);
|
||||
matchPath(t.requestedModule, function (_path, callback) { return callback(undefined, t.packageJson); }, function (path, callback) {
|
||||
return callback(undefined, t.existingFiles.indexOf(path) !== -1);
|
||||
}, t.extensions, function (_err, result) {
|
||||
// assert.equal(result, t.expectedPath);
|
||||
expect(result).toBe(t.expectedPath);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=match-path-async.test.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"match-path-async.test.js","sourceRoot":"","sources":["../../src/__tests__/match-path-async.test.ts"],"names":[],"mappings":";;AAAA,wDAA2D;AAC3D,8CAAgD;AAEhD,QAAQ,CAAC,kBAAkB,EAAE;IAC3B,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,UAAC,CAAC;QACpB,OAAA,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,UAAC,IAAI;YACd,IAAM,SAAS,GAAG,IAAA,uCAAoB,EACpC,CAAC,CAAC,eAAe,EACjB,CAAC,CAAC,KAAK,EACP,CAAC,CAAC,UAAU,EACZ,CAAC,CAAC,WAAW,CACd,CAAC;YACF,SAAS,CACP,CAAC,CAAC,eAAe,EACjB,UAAC,KAAK,EAAE,QAAQ,IAAK,OAAA,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,EAAlC,CAAkC,EACvD,UAAC,IAAI,EAAE,QAAQ;gBACb,OAAA,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAAzD,CAAyD,EAC3D,CAAC,CAAC,UAAU,EACZ,UAAC,IAAI,EAAE,MAAM;gBACX,wCAAwC;gBACxC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;gBACpC,IAAI,EAAE,CAAC;YACT,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;IAnBF,CAmBE,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.d.ts
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
15
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.js
generated
vendored
Normal file
15
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var match_path_sync_1 = require("../match-path-sync");
|
||||
var Tests = require("./data/match-path-data");
|
||||
describe("match-path-sync", function () {
|
||||
Tests.tests.forEach(function (t) {
|
||||
return it(t.name, function () {
|
||||
var matchPath = (0, match_path_sync_1.createMatchPath)(t.absoluteBaseUrl, t.paths, t.mainFields, t.addMatchAll);
|
||||
var result = matchPath(t.requestedModule, function (_) { return t.packageJson; }, function (name) { return t.existingFiles.indexOf(name) !== -1; }, t.extensions);
|
||||
// assert.equal(result, t.expectedPath);
|
||||
expect(result).toBe(t.expectedPath);
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=match-path-sync.test.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"match-path-sync.test.js","sourceRoot":"","sources":["../../src/__tests__/match-path-sync.test.ts"],"names":[],"mappings":";;AAAA,sDAAqD;AACrD,8CAAgD;AAEhD,QAAQ,CAAC,iBAAiB,EAAE;IAC1B,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,UAAC,CAAC;QACpB,OAAA,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;YACT,IAAM,SAAS,GAAG,IAAA,iCAAe,EAC/B,CAAC,CAAC,eAAe,EACjB,CAAC,CAAC,KAAK,EACP,CAAC,CAAC,UAAU,EACZ,CAAC,CAAC,WAAW,CACd,CAAC;YACF,IAAM,MAAM,GAAG,SAAS,CACtB,CAAC,CAAC,eAAe,EACjB,UAAC,CAAS,IAAK,OAAA,CAAC,CAAC,WAAW,EAAb,CAAa,EAC5B,UAAC,IAAY,IAAK,OAAA,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAApC,CAAoC,EACtD,CAAC,CAAC,UAAU,CACb,CAAC;YACF,wCAAwC;YACxC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;QACtC,CAAC,CAAC;IAfF,CAeE,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/try-path.test.d.ts
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/try-path.test.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
175
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/try-path.test.js
generated
vendored
Normal file
175
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/try-path.test.js
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var try_path_1 = require("../try-path");
|
||||
var path_1 = require("path");
|
||||
describe("mapping-entry", function () {
|
||||
var abosolutePathMappings = [
|
||||
{
|
||||
pattern: "longest/pre/fix/*",
|
||||
paths: [(0, path_1.join)("/absolute", "base", "url", "foo2", "bar")],
|
||||
},
|
||||
{ pattern: "pre/fix/*", paths: [(0, path_1.join)("/absolute", "base", "url", "foo3")] },
|
||||
{ pattern: "*", paths: [(0, path_1.join)("/absolute", "base", "url", "foo1")] },
|
||||
];
|
||||
var abosolutePathMappingsStarstWithSlash = [
|
||||
{
|
||||
pattern: "/opt/*",
|
||||
paths: [(0, path_1.join)("/absolute", "src", "aws-layer")],
|
||||
},
|
||||
{
|
||||
pattern: "*",
|
||||
paths: [(0, path_1.join)("/absolute", "src")],
|
||||
},
|
||||
];
|
||||
it("should return no paths for relative requested module", function () {
|
||||
var result = (0, try_path_1.getPathsToTry)([".ts", "tsx"], abosolutePathMappings, "./requested-module");
|
||||
// assert.deepEqual(result, undefined);
|
||||
expect(result).toBeUndefined();
|
||||
});
|
||||
it("should return no paths if no pattern match the requested module", function () {
|
||||
var result = (0, try_path_1.getPathsToTry)([".ts", "tsx"], [
|
||||
{
|
||||
pattern: "longest/pre/fix/*",
|
||||
paths: [(0, path_1.join)("/absolute", "base", "url", "foo2", "bar")],
|
||||
},
|
||||
{
|
||||
pattern: "pre/fix/*",
|
||||
paths: [(0, path_1.join)("/absolute", "base", "url", "foo3")],
|
||||
},
|
||||
], "requested-module");
|
||||
expect(result).toBeUndefined();
|
||||
});
|
||||
it("should get all paths that matches requested module", function () {
|
||||
var result = (0, try_path_1.getPathsToTry)([".ts", ".tsx"], abosolutePathMappings, "longest/pre/fix/requested-module");
|
||||
// assert.deepEqual(result, [
|
||||
// // "longest/pre/fix/*"
|
||||
// { type: "file", path: join("/absolute", "base", "url", "foo2", "bar") },
|
||||
// {
|
||||
// type: "extension",
|
||||
// path: join("/absolute", "base", "url", "foo2", "bar.ts"),
|
||||
// },
|
||||
// {
|
||||
// type: "extension",
|
||||
// path: join("/absolute", "base", "url", "foo2", "bar.tsx"),
|
||||
// },
|
||||
// {
|
||||
// type: "package",
|
||||
// path: join("/absolute", "base", "url", "foo2", "bar", "package.json"),
|
||||
// },
|
||||
// {
|
||||
// type: "index",
|
||||
// path: join("/absolute", "base", "url", "foo2", "bar", "index.ts"),
|
||||
// },
|
||||
// {
|
||||
// type: "index",
|
||||
// path: join("/absolute", "base", "url", "foo2", "bar", "index.tsx"),
|
||||
// },
|
||||
// // "*"
|
||||
// { type: "file", path: join("/absolute", "base", "url", "foo1") },
|
||||
// { type: "extension", path: join("/absolute", "base", "url", "foo1.ts") },
|
||||
// { type: "extension", path: join("/absolute", "base", "url", "foo1.tsx") },
|
||||
// {
|
||||
// type: "package",
|
||||
// path: join("/absolute", "base", "url", "foo1", "package.json"),
|
||||
// },
|
||||
// {
|
||||
// type: "index",
|
||||
// path: join("/absolute", "base", "url", "foo1", "index.ts"),
|
||||
// },
|
||||
// {
|
||||
// type: "index",
|
||||
// path: join("/absolute", "base", "url", "foo1", "index.tsx"),
|
||||
// },
|
||||
// ]);
|
||||
expect(result).toEqual([
|
||||
// "longest/pre/fix/*"
|
||||
{ type: "file", path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar") },
|
||||
{
|
||||
type: "extension",
|
||||
path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar.ts"),
|
||||
},
|
||||
{
|
||||
type: "extension",
|
||||
path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar.tsx"),
|
||||
},
|
||||
{
|
||||
type: "package",
|
||||
path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar", "package.json"),
|
||||
},
|
||||
{
|
||||
type: "index",
|
||||
path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar", "index.ts"),
|
||||
},
|
||||
{
|
||||
type: "index",
|
||||
path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar", "index.tsx"),
|
||||
},
|
||||
// "*"
|
||||
{ type: "file", path: (0, path_1.join)("/absolute", "base", "url", "foo1") },
|
||||
{ type: "extension", path: (0, path_1.join)("/absolute", "base", "url", "foo1.ts") },
|
||||
{ type: "extension", path: (0, path_1.join)("/absolute", "base", "url", "foo1.tsx") },
|
||||
{
|
||||
type: "package",
|
||||
path: (0, path_1.join)("/absolute", "base", "url", "foo1", "package.json"),
|
||||
},
|
||||
{
|
||||
type: "index",
|
||||
path: (0, path_1.join)("/absolute", "base", "url", "foo1", "index.ts"),
|
||||
},
|
||||
{
|
||||
type: "index",
|
||||
path: (0, path_1.join)("/absolute", "base", "url", "foo1", "index.tsx"),
|
||||
},
|
||||
]);
|
||||
});
|
||||
it("should resolve paths starting with a slash", function () {
|
||||
var result = (0, try_path_1.getPathsToTry)([".ts"], abosolutePathMappingsStarstWithSlash, "/opt/utils");
|
||||
expect(result).toEqual([
|
||||
// "opt/*"
|
||||
{
|
||||
path: (0, path_1.join)("/absolute", "src", "aws-layer"),
|
||||
type: "file",
|
||||
},
|
||||
{
|
||||
path: (0, path_1.join)("/absolute", "src", "aws-layer.ts"),
|
||||
type: "extension",
|
||||
},
|
||||
{
|
||||
path: (0, path_1.join)("/absolute", "src", "aws-layer", "package.json"),
|
||||
type: "package",
|
||||
},
|
||||
{
|
||||
path: (0, path_1.join)("/absolute", "src", "aws-layer", "index.ts"),
|
||||
type: "index",
|
||||
},
|
||||
// "*"
|
||||
{
|
||||
path: (0, path_1.join)("/absolute", "src"),
|
||||
type: "file",
|
||||
},
|
||||
{
|
||||
path: (0, path_1.join)("/absolute", "src.ts"),
|
||||
type: "extension",
|
||||
},
|
||||
{
|
||||
path: (0, path_1.join)("/absolute", "src", "package.json"),
|
||||
type: "package",
|
||||
},
|
||||
{
|
||||
path: (0, path_1.join)("/absolute", "src", "index.ts"),
|
||||
type: "index",
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
// describe("match-star", () => {
|
||||
// it("should match star in last position", () => {
|
||||
// const result = matchStar("lib/*", "lib/mylib");
|
||||
// assert.equal(result, "mylib");
|
||||
// });
|
||||
// it("should match star in first position", () => {
|
||||
// const result = matchStar("*/lib", "mylib/lib");
|
||||
// assert.equal(result, "mylib");
|
||||
// });
|
||||
// });
|
||||
//# sourceMappingURL=try-path.test.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/try-path.test.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/try-path.test.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"try-path.test.js","sourceRoot":"","sources":["../../src/__tests__/try-path.test.ts"],"names":[],"mappings":";;AAAA,wCAA4C;AAC5C,6BAA4B;AAE5B,QAAQ,CAAC,eAAe,EAAE;IACxB,IAAM,qBAAqB,GAAG;QAC5B;YACE,OAAO,EAAE,mBAAmB;YAC5B,KAAK,EAAE,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;SACzD;QACD,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE;QAC3E,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE;KACpE,CAAC;IACF,IAAM,oCAAoC,GAAG;QAC3C;YACE,OAAO,EAAE,QAAQ;YACjB,KAAK,EAAE,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;SAC/C;QACD;YACE,OAAO,EAAE,GAAG;YACZ,KAAK,EAAE,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,KAAK,CAAC,CAAC;S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,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,CAAC;gBACvD,IAAI,EAAE,OAAO;aACd;YACD,MAAM;YACN;gBACE,IAAI,EAAE,IAAA,WAAI,EAAC,WAAW,EAAE,KAAK,CAAC;gBAC9B,IAAI,EAAE,MAAM;aACb;YACD;gBACE,IAAI,EAAE,IAAA,WAAI,EAAC,WAAW,EAAE,QAAQ,CAAC;gBACjC,IAAI,EAAE,WAAW;aAClB;YACD;gBACE,IAAI,EAAE,IAAA,WAAI,EAAC,WAAW,EAAE,KAAK,EAAE,cAAc,CAAC;gBAC9C,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,IAAI,EAAE,IAAA,WAAI,EAAC,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC;gBAC1C,IAAI,EAAE,OAAO;aACd;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,iCAAiC;AACjC,qDAAqD;AACrD,sDAAsD;AACtD,qCAAqC;AACrC,QAAQ;AACR,sDAAsD;AACtD,sDAAsD;AACtD,qCAAqC;AACrC,QAAQ;AACR,MAAM"}
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.d.ts
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
328
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js
generated
vendored
Normal file
328
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js
generated
vendored
Normal file
@@ -0,0 +1,328 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tsconfig_loader_1 = require("../tsconfig-loader");
|
||||
var path_1 = require("path");
|
||||
describe("tsconfig-loader", function () {
|
||||
it("should find tsconfig in cwd", function () {
|
||||
var result = (0, tsconfig_loader_1.tsConfigLoader)({
|
||||
cwd: "/foo/bar",
|
||||
getEnv: function (_) { return undefined; },
|
||||
loadSync: function (cwd) {
|
||||
return {
|
||||
tsConfigPath: "".concat(cwd, "/tsconfig.json"),
|
||||
baseUrl: "./",
|
||||
paths: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
// assert.equal(result.tsConfigPath, "/foo/bar/tsconfig.json");
|
||||
expect(result.tsConfigPath).toBe("/foo/bar/tsconfig.json");
|
||||
});
|
||||
it("should return loaderResult.tsConfigPath as undefined when not found", function () {
|
||||
var result = (0, tsconfig_loader_1.tsConfigLoader)({
|
||||
cwd: "/foo/bar",
|
||||
getEnv: function (_) { return undefined; },
|
||||
loadSync: function (_) {
|
||||
return {
|
||||
tsConfigPath: undefined,
|
||||
baseUrl: "./",
|
||||
paths: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
// assert.isUndefined(result.tsConfigPath);
|
||||
expect(result.tsConfigPath).toBeUndefined();
|
||||
});
|
||||
it("should use TS_NODE_PROJECT env if exists", function () {
|
||||
var result = (0, tsconfig_loader_1.tsConfigLoader)({
|
||||
cwd: "/foo/bar",
|
||||
getEnv: function (key) {
|
||||
return key === "TS_NODE_PROJECT" ? "/foo/baz" : undefined;
|
||||
},
|
||||
loadSync: function (cwd, fileName) {
|
||||
if (cwd === "/foo/bar" && fileName === "/foo/baz") {
|
||||
return {
|
||||
tsConfigPath: "/foo/baz/tsconfig.json",
|
||||
baseUrl: "./",
|
||||
paths: {},
|
||||
};
|
||||
}
|
||||
return {
|
||||
tsConfigPath: undefined,
|
||||
baseUrl: "./",
|
||||
paths: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
// assert.equal(result.tsConfigPath, "/foo/baz/tsconfig.json");
|
||||
expect(result.tsConfigPath).toBe("/foo/baz/tsconfig.json");
|
||||
});
|
||||
it("should use TS_NODE_BASEURL env if exists", function () {
|
||||
var result = (0, tsconfig_loader_1.tsConfigLoader)({
|
||||
cwd: "/foo/bar",
|
||||
getEnv: function (key) {
|
||||
return key === "TS_NODE_BASEURL" ? "SOME_BASEURL" : undefined;
|
||||
},
|
||||
loadSync: function (_0, _1, baseUrl) {
|
||||
return {
|
||||
tsConfigPath: undefined,
|
||||
baseUrl: baseUrl,
|
||||
paths: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
// assert.equal(result.baseUrl, "SOME_BASEURL");
|
||||
expect(result.baseUrl).toBe("SOME_BASEURL");
|
||||
});
|
||||
it("should not use TS_NODE_BASEURL env if it does not exist", function () {
|
||||
var result = (0, tsconfig_loader_1.tsConfigLoader)({
|
||||
cwd: "/foo/bar",
|
||||
getEnv: function (_) {
|
||||
return undefined;
|
||||
},
|
||||
loadSync: function (_0, _1, baseUrl) {
|
||||
return {
|
||||
tsConfigPath: undefined,
|
||||
baseUrl: baseUrl,
|
||||
paths: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
// assert.equal(result.baseUrl, undefined);
|
||||
expect(result.baseUrl).toBeUndefined();
|
||||
});
|
||||
});
|
||||
describe("walkForTsConfig", function () {
|
||||
it("should find tsconfig in starting directory", function () {
|
||||
var pathToTsconfig = (0, path_1.join)("/root", "dir1", "tsconfig.json");
|
||||
var res = (0, tsconfig_loader_1.walkForTsConfig)((0, path_1.join)("/root", "dir1"), function (path) { return path === pathToTsconfig; });
|
||||
// assert.equal(res, pathToTsconfig);
|
||||
expect(res).toBe(pathToTsconfig);
|
||||
});
|
||||
it("should find tsconfig in parent directory", function () {
|
||||
var pathToTsconfig = (0, path_1.join)("/root", "tsconfig.json");
|
||||
var res = (0, tsconfig_loader_1.walkForTsConfig)((0, path_1.join)("/root", "dir1"), function (path) { return path === pathToTsconfig; });
|
||||
// assert.equal(res, pathToTsconfig);
|
||||
expect(res).toBe(pathToTsconfig);
|
||||
});
|
||||
it("should return undefined when reaching the top", function () {
|
||||
var res = (0, tsconfig_loader_1.walkForTsConfig)((0, path_1.join)("/root", "dir1", "kalle"), function () { return false; });
|
||||
// assert.equal(res, undefined);
|
||||
expect(res).toBeUndefined();
|
||||
});
|
||||
});
|
||||
describe("loadConfig", function () {
|
||||
it("should load a config", function () {
|
||||
var config = { compilerOptions: { baseUrl: "hej" } };
|
||||
var res = (0, tsconfig_loader_1.loadTsconfig)("/root/dir1/tsconfig.json", function (path) { return path === "/root/dir1/tsconfig.json"; }, function (_) { return JSON.stringify(config); });
|
||||
// assert.deepEqual(res, config);
|
||||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
it("should load a config with comments", function () {
|
||||
var config = { compilerOptions: { baseUrl: "hej" } };
|
||||
var res = (0, tsconfig_loader_1.loadTsconfig)("/root/dir1/tsconfig.json", function (path) { return path === "/root/dir1/tsconfig.json"; }, function (_) { return "{\n // my comment\n \"compilerOptions\": { \n \"baseUrl\": \"hej\"\n }\n }"; });
|
||||
// assert.deepEqual(res, config);
|
||||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
it("should load a config with trailing commas", function () {
|
||||
var config = { compilerOptions: { baseUrl: "hej" } };
|
||||
var res = (0, tsconfig_loader_1.loadTsconfig)("/root/dir1/tsconfig.json", function (path) { return path === "/root/dir1/tsconfig.json"; }, function (_) { return "{\n \"compilerOptions\": { \n \"baseUrl\": \"hej\",\n },\n }"; });
|
||||
// assert.deepEqual(res, config);
|
||||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
it("should throw an error including the file path when encountering invalid JSON5", function () {
|
||||
expect(function () {
|
||||
return (0, tsconfig_loader_1.loadTsconfig)("/root/dir1/tsconfig.json", function (path) { return path === "/root/dir1/tsconfig.json"; }, function (_) { return "{\n \"compilerOptions\": {\n }"; });
|
||||
}).toThrowError("/root/dir1/tsconfig.json is malformed JSON5: invalid end of input at 3:12");
|
||||
});
|
||||
it("should load a config with string extends and overwrite all options", function () {
|
||||
var firstConfig = {
|
||||
extends: "../base-config.json",
|
||||
compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } },
|
||||
};
|
||||
var firstConfigPath = (0, path_1.join)("/root", "dir1", "tsconfig.json");
|
||||
var baseConfig = {
|
||||
compilerOptions: {
|
||||
baseUrl: "olle",
|
||||
paths: { foo: ["bar1"] },
|
||||
strict: true,
|
||||
},
|
||||
};
|
||||
var baseConfigPath = (0, path_1.join)("/root", "base-config.json");
|
||||
var res = (0, tsconfig_loader_1.loadTsconfig)((0, path_1.join)("/root", "dir1", "tsconfig.json"), function (path) { return path === firstConfigPath || path === baseConfigPath; }, function (path) {
|
||||
if (path === firstConfigPath) {
|
||||
return JSON.stringify(firstConfig);
|
||||
}
|
||||
if (path === baseConfigPath) {
|
||||
return JSON.stringify(baseConfig);
|
||||
}
|
||||
return "";
|
||||
});
|
||||
// assert.deepEqual(res, {
|
||||
// extends: "../base-config.json",
|
||||
// compilerOptions: {
|
||||
// baseUrl: "kalle",
|
||||
// paths: { foo: ["bar2"] },
|
||||
// strict: true,
|
||||
// },
|
||||
// });
|
||||
expect(res).toEqual({
|
||||
extends: "../base-config.json",
|
||||
compilerOptions: {
|
||||
baseUrl: "kalle",
|
||||
paths: { foo: ["bar2"] },
|
||||
strict: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
it("should load a config with string extends from node_modules and overwrite all options", function () {
|
||||
var firstConfig = {
|
||||
extends: "my-package/base-config.json",
|
||||
compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } },
|
||||
};
|
||||
var firstConfigPath = (0, path_1.join)("/root", "dir1", "tsconfig.json");
|
||||
var baseConfig = {
|
||||
compilerOptions: {
|
||||
baseUrl: "olle",
|
||||
paths: { foo: ["bar1"] },
|
||||
strict: true,
|
||||
},
|
||||
};
|
||||
var baseConfigPath = (0, path_1.join)("/root", "dir1", "node_modules", "my-package", "base-config.json");
|
||||
var res = (0, tsconfig_loader_1.loadTsconfig)((0, path_1.join)("/root", "dir1", "tsconfig.json"), function (path) { return path === firstConfigPath || path === baseConfigPath; }, function (path) {
|
||||
if (path === firstConfigPath) {
|
||||
return JSON.stringify(firstConfig);
|
||||
}
|
||||
if (path === baseConfigPath) {
|
||||
return JSON.stringify(baseConfig);
|
||||
}
|
||||
return "";
|
||||
});
|
||||
// assert.deepEqual(res, {
|
||||
// extends: "my-package/base-config.json",
|
||||
// compilerOptions: {
|
||||
// baseUrl: "kalle",
|
||||
// paths: { foo: ["bar2"] },
|
||||
// strict: true,
|
||||
// },
|
||||
// });
|
||||
expect(res).toEqual({
|
||||
extends: "my-package/base-config.json",
|
||||
compilerOptions: {
|
||||
baseUrl: "kalle",
|
||||
paths: { foo: ["bar2"] },
|
||||
strict: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
it("should use baseUrl relative to location of extended tsconfig", function () {
|
||||
var firstConfig = { compilerOptions: { baseUrl: "." } };
|
||||
var firstConfigPath = (0, path_1.join)("/root", "first-config.json");
|
||||
var secondConfig = { extends: "../first-config.json" };
|
||||
var secondConfigPath = (0, path_1.join)("/root", "dir1", "second-config.json");
|
||||
var thirdConfig = { extends: "../second-config.json" };
|
||||
var thirdConfigPath = (0, path_1.join)("/root", "dir1", "dir2", "third-config.json");
|
||||
var res = (0, tsconfig_loader_1.loadTsconfig)((0, path_1.join)("/root", "dir1", "dir2", "third-config.json"), function (path) {
|
||||
return path === firstConfigPath ||
|
||||
path === secondConfigPath ||
|
||||
path === thirdConfigPath;
|
||||
}, function (path) {
|
||||
if (path === firstConfigPath) {
|
||||
return JSON.stringify(firstConfig);
|
||||
}
|
||||
if (path === secondConfigPath) {
|
||||
return JSON.stringify(secondConfig);
|
||||
}
|
||||
if (path === thirdConfigPath) {
|
||||
return JSON.stringify(thirdConfig);
|
||||
}
|
||||
return "";
|
||||
});
|
||||
// assert.deepEqual(res, {
|
||||
// extends: "../second-config.json",
|
||||
// compilerOptions: { baseUrl: join("..", "..") },
|
||||
// });
|
||||
expect(res).toEqual({
|
||||
extends: "../second-config.json",
|
||||
compilerOptions: { baseUrl: (0, path_1.join)("..", "..") },
|
||||
});
|
||||
});
|
||||
it("should load a config with array extends and overwrite all options", function () {
|
||||
var baseConfig1 = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar"] } },
|
||||
};
|
||||
var baseConfig1Path = (0, path_1.join)("/root", "base-config-1.json");
|
||||
var baseConfig2 = { compilerOptions: { baseUrl: "." } };
|
||||
var baseConfig2Path = (0, path_1.join)("/root", "dir1", "base-config-2.json");
|
||||
var baseConfig3 = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar2"] } },
|
||||
};
|
||||
var baseConfig3Path = (0, path_1.join)("/root", "dir1", "dir2", "base-config-3.json");
|
||||
var actualConfig = {
|
||||
extends: [
|
||||
"./base-config-1.json",
|
||||
"./dir1/base-config-2.json",
|
||||
"./dir1/dir2/base-config-3.json",
|
||||
],
|
||||
};
|
||||
var actualConfigPath = (0, path_1.join)("/root", "tsconfig.json");
|
||||
var res = (0, tsconfig_loader_1.loadTsconfig)((0, path_1.join)("/root", "tsconfig.json"), function (path) {
|
||||
return [
|
||||
baseConfig1Path,
|
||||
baseConfig2Path,
|
||||
baseConfig3Path,
|
||||
actualConfigPath,
|
||||
].indexOf(path) >= 0;
|
||||
}, function (path) {
|
||||
if (path === baseConfig1Path) {
|
||||
return JSON.stringify(baseConfig1);
|
||||
}
|
||||
if (path === baseConfig2Path) {
|
||||
return JSON.stringify(baseConfig2);
|
||||
}
|
||||
if (path === baseConfig3Path) {
|
||||
return JSON.stringify(baseConfig3);
|
||||
}
|
||||
if (path === actualConfigPath) {
|
||||
return JSON.stringify(actualConfig);
|
||||
}
|
||||
return "";
|
||||
});
|
||||
expect(res).toEqual({
|
||||
extends: [
|
||||
"./base-config-1.json",
|
||||
"./dir1/base-config-2.json",
|
||||
"./dir1/dir2/base-config-3.json",
|
||||
],
|
||||
compilerOptions: {
|
||||
baseUrl: (0, path_1.join)("dir1", "dir2"),
|
||||
paths: { foo: ["bar2"] },
|
||||
},
|
||||
});
|
||||
});
|
||||
it("should load a config with array extends without .json extension", function () {
|
||||
var baseConfig = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar"] } },
|
||||
};
|
||||
var baseConfigPath = (0, path_1.join)("/root", "base-config-1.json");
|
||||
var actualConfig = { extends: ["./base-config-1"] };
|
||||
var actualConfigPath = (0, path_1.join)("/root", "tsconfig.json");
|
||||
var res = (0, tsconfig_loader_1.loadTsconfig)((0, path_1.join)("/root", "tsconfig.json"), function (path) { return [baseConfigPath, actualConfigPath].indexOf(path) >= 0; }, function (path) {
|
||||
if (path === baseConfigPath) {
|
||||
return JSON.stringify(baseConfig);
|
||||
}
|
||||
if (path === actualConfigPath) {
|
||||
return JSON.stringify(actualConfig);
|
||||
}
|
||||
return "";
|
||||
});
|
||||
expect(res).toEqual({
|
||||
extends: ["./base-config-1"],
|
||||
compilerOptions: {
|
||||
baseUrl: ".",
|
||||
paths: { foo: ["bar"] },
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=tsconfig-loader.test.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
33
install/config-ui/node_modules/tsconfig-paths/lib/config-loader.d.ts
generated
vendored
Normal file
33
install/config-ui/node_modules/tsconfig-paths/lib/config-loader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import * as TsConfigLoader2 from "./tsconfig-loader";
|
||||
export interface ExplicitParams {
|
||||
baseUrl: string;
|
||||
paths: {
|
||||
[key: string]: Array<string>;
|
||||
};
|
||||
mainFields?: Array<string>;
|
||||
addMatchAll?: boolean;
|
||||
}
|
||||
export declare type TsConfigLoader = (params: TsConfigLoader2.TsConfigLoaderParams) => TsConfigLoader2.TsConfigLoaderResult;
|
||||
export interface ConfigLoaderParams {
|
||||
cwd: string;
|
||||
explicitParams?: ExplicitParams;
|
||||
tsConfigLoader?: TsConfigLoader;
|
||||
}
|
||||
export interface ConfigLoaderSuccessResult {
|
||||
resultType: "success";
|
||||
configFileAbsolutePath: string;
|
||||
baseUrl: string;
|
||||
absoluteBaseUrl: string;
|
||||
paths: {
|
||||
[key: string]: Array<string>;
|
||||
};
|
||||
mainFields?: Array<string>;
|
||||
addMatchAll?: boolean;
|
||||
}
|
||||
export interface ConfigLoaderFailResult {
|
||||
resultType: "failed";
|
||||
message: string;
|
||||
}
|
||||
export declare type ConfigLoaderResult = ConfigLoaderSuccessResult | ConfigLoaderFailResult;
|
||||
export declare function loadConfig(cwd?: string): ConfigLoaderResult;
|
||||
export declare function configLoader({ cwd, explicitParams, tsConfigLoader, }: ConfigLoaderParams): ConfigLoaderResult;
|
||||
57
install/config-ui/node_modules/tsconfig-paths/lib/config-loader.js
generated
vendored
Normal file
57
install/config-ui/node_modules/tsconfig-paths/lib/config-loader.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.configLoader = exports.loadConfig = void 0;
|
||||
var TsConfigLoader2 = require("./tsconfig-loader");
|
||||
var path = require("path");
|
||||
var options_1 = require("./options");
|
||||
function loadConfig(cwd) {
|
||||
if (cwd === void 0) { cwd = options_1.options.cwd; }
|
||||
return configLoader({ cwd: cwd });
|
||||
}
|
||||
exports.loadConfig = loadConfig;
|
||||
function configLoader(_a) {
|
||||
var cwd = _a.cwd, explicitParams = _a.explicitParams, _b = _a.tsConfigLoader, tsConfigLoader = _b === void 0 ? TsConfigLoader2.tsConfigLoader : _b;
|
||||
if (explicitParams) {
|
||||
// tslint:disable-next-line:no-shadowed-variable
|
||||
var absoluteBaseUrl_1 = path.isAbsolute(explicitParams.baseUrl)
|
||||
? explicitParams.baseUrl
|
||||
: path.join(cwd, explicitParams.baseUrl);
|
||||
return {
|
||||
resultType: "success",
|
||||
configFileAbsolutePath: "",
|
||||
baseUrl: explicitParams.baseUrl,
|
||||
absoluteBaseUrl: absoluteBaseUrl_1,
|
||||
paths: explicitParams.paths,
|
||||
mainFields: explicitParams.mainFields,
|
||||
addMatchAll: explicitParams.addMatchAll,
|
||||
};
|
||||
}
|
||||
// Load tsconfig and create path matching function
|
||||
var loadResult = tsConfigLoader({
|
||||
cwd: cwd,
|
||||
getEnv: function (key) { return process.env[key]; },
|
||||
});
|
||||
if (!loadResult.tsConfigPath) {
|
||||
return {
|
||||
resultType: "failed",
|
||||
message: "Couldn't find tsconfig.json",
|
||||
};
|
||||
}
|
||||
if (!loadResult.baseUrl) {
|
||||
return {
|
||||
resultType: "failed",
|
||||
message: "Missing baseUrl in compilerOptions",
|
||||
};
|
||||
}
|
||||
var tsConfigDir = path.dirname(loadResult.tsConfigPath);
|
||||
var absoluteBaseUrl = path.join(tsConfigDir, loadResult.baseUrl);
|
||||
return {
|
||||
resultType: "success",
|
||||
configFileAbsolutePath: loadResult.tsConfigPath,
|
||||
baseUrl: loadResult.baseUrl,
|
||||
absoluteBaseUrl: absoluteBaseUrl,
|
||||
paths: loadResult.paths || {},
|
||||
};
|
||||
}
|
||||
exports.configLoader = configLoader;
|
||||
//# sourceMappingURL=config-loader.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/config-loader.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/config-loader.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":";;;AAAA,mDAAqD;AACrD,2BAA6B;AAC7B,qCAAoC;AAsCpC,SAAgB,UAAU,CAAC,GAAyB;IAAzB,oBAAA,EAAA,MAAc,iBAAO,CAAC,GAAG;IAClD,OAAO,YAAY,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AACpC,CAAC;AAFD,gCAEC;AAED,SAAgB,YAAY,CAAC,EAIR;QAHnB,GAAG,SAAA,EACH,cAAc,oBAAA,EACd,sBAA+C,EAA/C,cAAc,mBAAG,eAAe,CAAC,cAAc,KAAA;IAE/C,IAAI,cAAc,EAAE;QAClB,gDAAg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CAAC;AApDD,oCAoDC"}
|
||||
33
install/config-ui/node_modules/tsconfig-paths/lib/filesystem.d.ts
generated
vendored
Normal file
33
install/config-ui/node_modules/tsconfig-paths/lib/filesystem.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Typing for the fields of package.json we care about
|
||||
*/
|
||||
export interface PackageJson {
|
||||
[key: string]: string;
|
||||
}
|
||||
/**
|
||||
* A function that json from a file
|
||||
*/
|
||||
export interface ReadJsonSync {
|
||||
(packageJsonPath: string): any | undefined;
|
||||
}
|
||||
export interface FileExistsSync {
|
||||
(name: string): boolean;
|
||||
}
|
||||
export interface FileExistsAsync {
|
||||
(path: string, callback: (err?: Error, exists?: boolean) => void): void;
|
||||
}
|
||||
export interface ReadJsonAsyncCallback {
|
||||
(err?: Error, content?: any): void;
|
||||
}
|
||||
export interface ReadJsonAsync {
|
||||
(path: string, callback: ReadJsonAsyncCallback): void;
|
||||
}
|
||||
export declare function fileExistsSync(path: string): boolean;
|
||||
/**
|
||||
* Reads package.json from disk
|
||||
* @param file Path to package.json
|
||||
*/
|
||||
export declare function readJsonFromDiskSync(packageJsonPath: string): any | undefined;
|
||||
export declare function readJsonFromDiskAsync(path: string, callback: (err?: Error, content?: any) => void): void;
|
||||
export declare function fileExistsAsync(path2: string, callback2: (err?: Error, exists?: boolean) => void): void;
|
||||
export declare function removeExtension(path: string): string;
|
||||
55
install/config-ui/node_modules/tsconfig-paths/lib/filesystem.js
generated
vendored
Normal file
55
install/config-ui/node_modules/tsconfig-paths/lib/filesystem.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.removeExtension = exports.fileExistsAsync = exports.readJsonFromDiskAsync = exports.readJsonFromDiskSync = exports.fileExistsSync = void 0;
|
||||
var fs = require("fs");
|
||||
function fileExistsSync(path) {
|
||||
try {
|
||||
var stats = fs.statSync(path);
|
||||
return stats.isFile();
|
||||
}
|
||||
catch (err) {
|
||||
// If error, assume file did not exist
|
||||
return false;
|
||||
}
|
||||
}
|
||||
exports.fileExistsSync = fileExistsSync;
|
||||
/**
|
||||
* Reads package.json from disk
|
||||
* @param file Path to package.json
|
||||
*/
|
||||
// tslint:disable-next-line:no-any
|
||||
function readJsonFromDiskSync(packageJsonPath) {
|
||||
if (!fs.existsSync(packageJsonPath)) {
|
||||
return undefined;
|
||||
}
|
||||
return require(packageJsonPath);
|
||||
}
|
||||
exports.readJsonFromDiskSync = readJsonFromDiskSync;
|
||||
function readJsonFromDiskAsync(path,
|
||||
// tslint:disable-next-line:no-any
|
||||
callback) {
|
||||
fs.readFile(path, "utf8", function (err, result) {
|
||||
// If error, assume file did not exist
|
||||
if (err || !result) {
|
||||
return callback();
|
||||
}
|
||||
var json = JSON.parse(result);
|
||||
return callback(undefined, json);
|
||||
});
|
||||
}
|
||||
exports.readJsonFromDiskAsync = readJsonFromDiskAsync;
|
||||
function fileExistsAsync(path2, callback2) {
|
||||
fs.stat(path2, function (err, stats) {
|
||||
if (err) {
|
||||
// If error assume file does not exist
|
||||
return callback2(undefined, false);
|
||||
}
|
||||
callback2(undefined, stats ? stats.isFile() : false);
|
||||
});
|
||||
}
|
||||
exports.fileExistsAsync = fileExistsAsync;
|
||||
function removeExtension(path) {
|
||||
return path.substring(0, path.lastIndexOf(".")) || path;
|
||||
}
|
||||
exports.removeExtension = removeExtension;
|
||||
//# sourceMappingURL=filesystem.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/filesystem.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/filesystem.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../src/filesystem.ts"],"names":[],"mappings":";;;AAAA,uBAAyB;AAkCzB,SAAgB,cAAc,CAAC,IAAY;IACzC,IAAI;QACF,IAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CA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W,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;AAC1D,CAAC;AAFD,0CAEC"}
|
||||
5
install/config-ui/node_modules/tsconfig-paths/lib/index.d.ts
generated
vendored
Normal file
5
install/config-ui/node_modules/tsconfig-paths/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export { createMatchPath, matchFromAbsolutePaths, MatchPath, } from "./match-path-sync";
|
||||
export { createMatchPathAsync, matchFromAbsolutePathsAsync, MatchPathAsync, } from "./match-path-async";
|
||||
export { register } from "./register";
|
||||
export { loadConfig, ConfigLoaderResult, ConfigLoaderSuccessResult, ConfigLoaderFailResult, } from "./config-loader";
|
||||
export { ReadJsonSync, ReadJsonAsync, FileExistsSync, FileExistsAsync, } from "./filesystem";
|
||||
15
install/config-ui/node_modules/tsconfig-paths/lib/index.js
generated
vendored
Normal file
15
install/config-ui/node_modules/tsconfig-paths/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.loadConfig = exports.register = exports.matchFromAbsolutePathsAsync = exports.createMatchPathAsync = exports.matchFromAbsolutePaths = exports.createMatchPath = void 0;
|
||||
// register is used from register.js in root dir
|
||||
var match_path_sync_1 = require("./match-path-sync");
|
||||
Object.defineProperty(exports, "createMatchPath", { enumerable: true, get: function () { return match_path_sync_1.createMatchPath; } });
|
||||
Object.defineProperty(exports, "matchFromAbsolutePaths", { enumerable: true, get: function () { return match_path_sync_1.matchFromAbsolutePaths; } });
|
||||
var match_path_async_1 = require("./match-path-async");
|
||||
Object.defineProperty(exports, "createMatchPathAsync", { enumerable: true, get: function () { return match_path_async_1.createMatchPathAsync; } });
|
||||
Object.defineProperty(exports, "matchFromAbsolutePathsAsync", { enumerable: true, get: function () { return match_path_async_1.matchFromAbsolutePathsAsync; } });
|
||||
var register_1 = require("./register");
|
||||
Object.defineProperty(exports, "register", { enumerable: true, get: function () { return register_1.register; } });
|
||||
var config_loader_1 = require("./config-loader");
|
||||
Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return config_loader_1.loadConfig; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/index.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,gDAAgD;AAChD,qDAI2B;AAHzB,kHAAA,eAAe,OAAA;AACf,yHAAA,sBAAsB,OAAA;AAGxB,uDAI4B;AAH1B,wHAAA,oBAAoB,OAAA;AACpB,+HAAA,2BAA2B,OAAA;AAG7B,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,iDAKyB;AAJvB,2GAAA,UAAU,OAAA"}
|
||||
17
install/config-ui/node_modules/tsconfig-paths/lib/mapping-entry.d.ts
generated
vendored
Normal file
17
install/config-ui/node_modules/tsconfig-paths/lib/mapping-entry.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export interface MappingEntry {
|
||||
readonly pattern: string;
|
||||
readonly paths: ReadonlyArray<string>;
|
||||
}
|
||||
export interface Paths {
|
||||
readonly [key: string]: ReadonlyArray<string>;
|
||||
}
|
||||
/**
|
||||
* Converts an absolute baseUrl and paths to an array of absolute mapping entries.
|
||||
* The array is sorted by longest prefix.
|
||||
* Having an array with entries allows us to keep a sorting order rather than
|
||||
* sort by keys each time we use the mappings.
|
||||
* @param absoluteBaseUrl
|
||||
* @param paths
|
||||
* @param addMatchAll
|
||||
*/
|
||||
export declare function getAbsoluteMappingEntries(absoluteBaseUrl: string, paths: Paths, addMatchAll: boolean): ReadonlyArray<MappingEntry>;
|
||||
53
install/config-ui/node_modules/tsconfig-paths/lib/mapping-entry.js
generated
vendored
Normal file
53
install/config-ui/node_modules/tsconfig-paths/lib/mapping-entry.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getAbsoluteMappingEntries = void 0;
|
||||
var path = require("path");
|
||||
/**
|
||||
* Converts an absolute baseUrl and paths to an array of absolute mapping entries.
|
||||
* The array is sorted by longest prefix.
|
||||
* Having an array with entries allows us to keep a sorting order rather than
|
||||
* sort by keys each time we use the mappings.
|
||||
* @param absoluteBaseUrl
|
||||
* @param paths
|
||||
* @param addMatchAll
|
||||
*/
|
||||
function getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll) {
|
||||
// Resolve all paths to absolute form once here, and sort them by
|
||||
// longest prefix once here, this saves time on each request later.
|
||||
// We need to put them in an array to preserve the sorting order.
|
||||
var sortedKeys = sortByLongestPrefix(Object.keys(paths));
|
||||
var absolutePaths = [];
|
||||
for (var _i = 0, sortedKeys_1 = sortedKeys; _i < sortedKeys_1.length; _i++) {
|
||||
var key = sortedKeys_1[_i];
|
||||
absolutePaths.push({
|
||||
pattern: key,
|
||||
paths: paths[key].map(function (pathToResolve) {
|
||||
return path.join(absoluteBaseUrl, pathToResolve);
|
||||
}),
|
||||
});
|
||||
}
|
||||
// If there is no match-all path specified in the paths section of tsconfig, then try to match
|
||||
// all paths relative to baseUrl, this is how typescript works.
|
||||
if (!paths["*"] && addMatchAll) {
|
||||
absolutePaths.push({
|
||||
pattern: "*",
|
||||
paths: ["".concat(absoluteBaseUrl.replace(/\/$/, ""), "/*")],
|
||||
});
|
||||
}
|
||||
return absolutePaths;
|
||||
}
|
||||
exports.getAbsoluteMappingEntries = getAbsoluteMappingEntries;
|
||||
/**
|
||||
* Sort path patterns.
|
||||
* If a module name can be matched with multiple patterns then pattern with the longest prefix will be picked.
|
||||
*/
|
||||
function sortByLongestPrefix(arr) {
|
||||
return arr
|
||||
.concat()
|
||||
.sort(function (a, b) { return getPrefixLength(b) - getPrefixLength(a); });
|
||||
}
|
||||
function getPrefixLength(pattern) {
|
||||
var prefixLength = pattern.indexOf("*");
|
||||
return pattern.substr(0, prefixLength).length;
|
||||
}
|
||||
//# sourceMappingURL=mapping-entry.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/mapping-entry.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/mapping-entry.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mapping-entry.js","sourceRoot":"","sources":["../src/mapping-entry.ts"],"names":[],"mappings":";;;AAAA,2BAA6B;AAW7B;;;;;;;;GAQG;AACH,SAAgB,yBAAyB,CACvC,eAAuB,EACvB,KAAY,EACZ,WAAoB;IAEpB,iEAAiE;IACjE,mEAAmE;IACnE,iEAAiE;IACjE,IAAM,UAAU,GAAG,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,IAAM,aAAa,GAAwB,EAAE,CAAC;IAC9C,KAAkB,UAAU,EAAV,yBAAU,EAAV,wBAAU,EAAV,IAAU,EAAE;QAAzB,IAAM,GAAG,mBAAA;QACZ,aAAa,CAAC,IAAI,CAAC;YACjB,OAAO,EAAE,GAAG;YACZ,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,UAAC,aAAa;gBAClC,OAAA,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC;YAAzC,CAAyC,CAC1C;SACF,CAAC,CAAC;KACJ;IACD,8FAA8F;IAC9F,+DAA+D;IAC/D,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,WAAW,EAAE;QAC9B,aAAa,CAAC,IAAI,CAAC;YACjB,OAAO,EAAE,GAAG;YACZ,KAAK,EAAE,CAAC,UAAG,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,OAAI,CAAC;SACnD,CAAC,CAAC;KACJ;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AA5BD,8DA4BC;AAED;;;GAGG;AACH,SAAS,mBAAmB,CAAC,GAAkB;IAC7C,OAAO,GAAG;SACP,MAAM,EAAE;SACR,IAAI,CAAC,UAAC,CAAS,EAAE,CAAS,IAAK,OAAA,eAAe,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,EAAvC,CAAuC,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,eAAe,CAAC,OAAe;IACtC,IAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1C,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,MAAM,CAAC;AAChD,CAAC"}
|
||||
21
install/config-ui/node_modules/tsconfig-paths/lib/match-path-async.d.ts
generated
vendored
Normal file
21
install/config-ui/node_modules/tsconfig-paths/lib/match-path-async.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as MappingEntry from "./mapping-entry";
|
||||
import * as Filesystem from "./filesystem";
|
||||
/**
|
||||
* Function that can match a path async
|
||||
*/
|
||||
export interface MatchPathAsync {
|
||||
(requestedModule: string, readJson: Filesystem.ReadJsonAsync | undefined, fileExists: Filesystem.FileExistsAsync | undefined, extensions: ReadonlyArray<string> | undefined, callback: MatchPathAsyncCallback): void;
|
||||
}
|
||||
export interface MatchPathAsyncCallback {
|
||||
(err?: Error, path?: string): void;
|
||||
}
|
||||
/**
|
||||
* See the sync version for docs.
|
||||
*/
|
||||
export declare function createMatchPathAsync(absoluteBaseUrl: string, paths: {
|
||||
[key: string]: Array<string>;
|
||||
}, mainFields?: string[], addMatchAll?: boolean): MatchPathAsync;
|
||||
/**
|
||||
* See the sync version for docs.
|
||||
*/
|
||||
export declare function matchFromAbsolutePathsAsync(absolutePathMappings: ReadonlyArray<MappingEntry.MappingEntry>, requestedModule: string, readJson: Filesystem.ReadJsonAsync | undefined, fileExists: Filesystem.FileExistsAsync | undefined, extensions: readonly string[] | undefined, callback: MatchPathAsyncCallback, mainFields?: string[]): void;
|
||||
113
install/config-ui/node_modules/tsconfig-paths/lib/match-path-async.js
generated
vendored
Normal file
113
install/config-ui/node_modules/tsconfig-paths/lib/match-path-async.js
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.matchFromAbsolutePathsAsync = exports.createMatchPathAsync = void 0;
|
||||
var path = require("path");
|
||||
var TryPath = require("./try-path");
|
||||
var MappingEntry = require("./mapping-entry");
|
||||
var Filesystem = require("./filesystem");
|
||||
/**
|
||||
* See the sync version for docs.
|
||||
*/
|
||||
function createMatchPathAsync(absoluteBaseUrl, paths, mainFields, addMatchAll) {
|
||||
if (mainFields === void 0) { mainFields = ["main"]; }
|
||||
if (addMatchAll === void 0) { addMatchAll = true; }
|
||||
var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
|
||||
return function (requestedModule, readJson, fileExists, extensions, callback) {
|
||||
return matchFromAbsolutePathsAsync(absolutePaths, requestedModule, readJson, fileExists, extensions, callback, mainFields);
|
||||
};
|
||||
}
|
||||
exports.createMatchPathAsync = createMatchPathAsync;
|
||||
/**
|
||||
* See the sync version for docs.
|
||||
*/
|
||||
function matchFromAbsolutePathsAsync(absolutePathMappings, requestedModule, readJson, fileExists, extensions, callback, mainFields) {
|
||||
if (readJson === void 0) { readJson = Filesystem.readJsonFromDiskAsync; }
|
||||
if (fileExists === void 0) { fileExists = Filesystem.fileExistsAsync; }
|
||||
if (extensions === void 0) { extensions = Object.keys(require.extensions); }
|
||||
if (mainFields === void 0) { mainFields = ["main"]; }
|
||||
var tryPaths = TryPath.getPathsToTry(extensions, absolutePathMappings, requestedModule);
|
||||
if (!tryPaths) {
|
||||
return callback();
|
||||
}
|
||||
findFirstExistingPath(tryPaths, readJson, fileExists, callback, 0, mainFields);
|
||||
}
|
||||
exports.matchFromAbsolutePathsAsync = matchFromAbsolutePathsAsync;
|
||||
function findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExistsAsync, doneCallback, index) {
|
||||
if (index === void 0) { index = 0; }
|
||||
if (index >= mainFields.length) {
|
||||
return doneCallback(undefined, undefined);
|
||||
}
|
||||
var tryNext = function () {
|
||||
return findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExistsAsync, doneCallback, index + 1);
|
||||
};
|
||||
var mainFieldMapping = packageJson[mainFields[index]];
|
||||
if (typeof mainFieldMapping !== "string") {
|
||||
// Skip mappings that are not pointers to replacement files
|
||||
return tryNext();
|
||||
}
|
||||
var mappedFilePath = path.join(path.dirname(packageJsonPath), mainFieldMapping);
|
||||
fileExistsAsync(mappedFilePath, function (err, exists) {
|
||||
if (err) {
|
||||
return doneCallback(err);
|
||||
}
|
||||
if (exists) {
|
||||
return doneCallback(undefined, mappedFilePath);
|
||||
}
|
||||
return tryNext();
|
||||
});
|
||||
}
|
||||
// Recursive loop to probe for physical files
|
||||
function findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index, mainFields) {
|
||||
if (index === void 0) { index = 0; }
|
||||
if (mainFields === void 0) { mainFields = ["main"]; }
|
||||
var tryPath = tryPaths[index];
|
||||
if (tryPath.type === "file" ||
|
||||
tryPath.type === "extension" ||
|
||||
tryPath.type === "index") {
|
||||
fileExists(tryPath.path, function (err, exists) {
|
||||
if (err) {
|
||||
return doneCallback(err);
|
||||
}
|
||||
if (exists) {
|
||||
return doneCallback(undefined, TryPath.getStrippedPath(tryPath));
|
||||
}
|
||||
if (index === tryPaths.length - 1) {
|
||||
return doneCallback();
|
||||
}
|
||||
// Continue with the next path
|
||||
return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields);
|
||||
});
|
||||
}
|
||||
else if (tryPath.type === "package") {
|
||||
readJson(tryPath.path, function (err, packageJson) {
|
||||
if (err) {
|
||||
return doneCallback(err);
|
||||
}
|
||||
if (packageJson) {
|
||||
return findFirstExistingMainFieldMappedFile(packageJson, mainFields, tryPath.path, fileExists, function (mainFieldErr, mainFieldMappedFile) {
|
||||
if (mainFieldErr) {
|
||||
return doneCallback(mainFieldErr);
|
||||
}
|
||||
if (mainFieldMappedFile) {
|
||||
return doneCallback(undefined, mainFieldMappedFile);
|
||||
}
|
||||
// No field in package json was a valid option. Continue with the next path.
|
||||
return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields);
|
||||
});
|
||||
}
|
||||
// This is async code, we need to return unconditionally, otherwise the code still falls
|
||||
// through and keeps recursing. While this might work in general, libraries that use neo-async
|
||||
// like Webpack will actually not allow you to call the same callback twice.
|
||||
//
|
||||
// An example of where this caused issues:
|
||||
// https://github.com/dividab/tsconfig-paths-webpack-plugin/issues/11
|
||||
//
|
||||
// Continue with the next path
|
||||
return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields);
|
||||
});
|
||||
}
|
||||
else {
|
||||
TryPath.exhaustiveTypeException(tryPath.type);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=match-path-async.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/match-path-async.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/match-path-async.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"match-path-async.js","sourceRoot":"","sources":["../src/match-path-async.ts"],"names":[],"mappings":";;;AAAA,2BAA6B;AAC7B,oCAAsC;AACtC,8CAAgD;AAChD,yCAA2C;AAmB3C;;GAEG;AACH,SAAgB,oBAAoB,CAClC,eAAuB,EACvB,KAAuC,EACvC,UAA+B,EAC/B,WAA2B;IAD3B,2BAAA,EAAA,cAAwB,MAAM,CAAC;IAC/B,4BAAA,EAAA,kBAA2B;IAE3B,IAAM,aAAa,GAAG,YAAY,CAAC,yBAAyB,CAC1D,eAAe,EACf,KAAK,EACL,WAAW,CACZ,CAAC;IAEF,OAAO,UACL,eAAuB,EACvB,QAA8C,EAC9C,UAAkD,EAClD,UAA6C,EAC7C,QAAgC;QAEhC,OAAA,2B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EACR,UAAU,EACV,YAAY,EACZ,KAAK,GAAG,CAAC,EACT,UAAU,CACX,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;SAAM,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;QACrC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,UAAC,GAAG,EAAE,WAAW;YACtC,IAAI,GAAG,EAAE;gBACP,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;aAC1B;YACD,IAAI,WAAW,EAAE;gBACf,OAAO,oCAAoC,CACzC,WAAW,EACX,UAAU,EACV,OAAO,CAAC,IAAI,EACZ,UAAU,EACV,UAAC,YAAoB,EAAE,mBAA4B;oBACjD,IAAI,YAAY,EAAE;wBAChB,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;qBACnC;oBACD,IAAI,mBAAmB,EAAE;wBACvB,OAAO,YAAY,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;qBACrD;oBAED,4EAA4E;oBAC5E,OAAO,qBAAqB,CAC1B,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,KAAK,GAAG,CAAC,EACT,UAAU,CACX,CAAC;gBACJ,CAAC,CACF,CAAC;aACH;YAED,wFAAwF;YACxF,8FAA8F;YAC9F,4EAA4E;YAC5E,EAAE;YACF,0CAA0C;YAC1C,qEAAqE;YACrE,EAAE;YACF,8BAA8B;YAC9B,OAAO,qBAAqB,CAC1B,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,KAAK,GAAG,CAAC,EACT,UAAU,CACX,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,CAAC,uBAAuB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KAC/C;AACH,CAAC"}
|
||||
30
install/config-ui/node_modules/tsconfig-paths/lib/match-path-sync.d.ts
generated
vendored
Normal file
30
install/config-ui/node_modules/tsconfig-paths/lib/match-path-sync.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import * as Filesystem from "./filesystem";
|
||||
import * as MappingEntry from "./mapping-entry";
|
||||
/**
|
||||
* Function that can match a path
|
||||
*/
|
||||
export interface MatchPath {
|
||||
(requestedModule: string, readJson?: Filesystem.ReadJsonSync, fileExists?: (name: string) => boolean, extensions?: ReadonlyArray<string>): string | undefined;
|
||||
}
|
||||
/**
|
||||
* Creates a function that can resolve paths according to tsconfig paths property.
|
||||
* @param absoluteBaseUrl Absolute version of baseUrl as specified in tsconfig.
|
||||
* @param paths The paths as specified in tsconfig.
|
||||
* @param mainFields A list of package.json field names to try when resolving module files.
|
||||
* @param addMatchAll Add a match-all "*" rule if none is present
|
||||
* @returns a function that can resolve paths.
|
||||
*/
|
||||
export declare function createMatchPath(absoluteBaseUrl: string, paths: {
|
||||
[key: string]: Array<string>;
|
||||
}, mainFields?: string[], addMatchAll?: boolean): MatchPath;
|
||||
/**
|
||||
* Finds a path from tsconfig that matches a module load request.
|
||||
* @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 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.
|
||||
*/
|
||||
export declare function matchFromAbsolutePaths(absolutePathMappings: ReadonlyArray<MappingEntry.MappingEntry>, requestedModule: string, readJson?: Filesystem.ReadJsonSync, fileExists?: Filesystem.FileExistsSync, extensions?: Array<string>, mainFields?: string[]): string | undefined;
|
||||
87
install/config-ui/node_modules/tsconfig-paths/lib/match-path-sync.js
generated
vendored
Normal file
87
install/config-ui/node_modules/tsconfig-paths/lib/match-path-sync.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.matchFromAbsolutePaths = exports.createMatchPath = void 0;
|
||||
var path = require("path");
|
||||
var Filesystem = require("./filesystem");
|
||||
var MappingEntry = require("./mapping-entry");
|
||||
var TryPath = require("./try-path");
|
||||
/**
|
||||
* Creates a function that can resolve paths according to tsconfig paths property.
|
||||
* @param absoluteBaseUrl Absolute version of baseUrl as specified in tsconfig.
|
||||
* @param paths The paths as specified in tsconfig.
|
||||
* @param mainFields A list of package.json field names to try when resolving module files.
|
||||
* @param addMatchAll Add a match-all "*" rule if none is present
|
||||
* @returns a function that can resolve paths.
|
||||
*/
|
||||
function createMatchPath(absoluteBaseUrl, paths, mainFields, addMatchAll) {
|
||||
if (mainFields === void 0) { mainFields = ["main"]; }
|
||||
if (addMatchAll === void 0) { addMatchAll = true; }
|
||||
var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
|
||||
return function (requestedModule, readJson, fileExists, extensions) {
|
||||
return matchFromAbsolutePaths(absolutePaths, requestedModule, readJson, fileExists, extensions, mainFields);
|
||||
};
|
||||
}
|
||||
exports.createMatchPath = createMatchPath;
|
||||
/**
|
||||
* Finds a path from tsconfig that matches a module load request.
|
||||
* @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 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.
|
||||
*/
|
||||
function matchFromAbsolutePaths(absolutePathMappings, requestedModule, readJson, fileExists, extensions, mainFields) {
|
||||
if (readJson === void 0) { readJson = Filesystem.readJsonFromDiskSync; }
|
||||
if (fileExists === void 0) { fileExists = Filesystem.fileExistsSync; }
|
||||
if (extensions === void 0) { extensions = Object.keys(require.extensions); }
|
||||
if (mainFields === void 0) { mainFields = ["main"]; }
|
||||
var tryPaths = TryPath.getPathsToTry(extensions, absolutePathMappings, requestedModule);
|
||||
if (!tryPaths) {
|
||||
return undefined;
|
||||
}
|
||||
return findFirstExistingPath(tryPaths, readJson, fileExists, mainFields);
|
||||
}
|
||||
exports.matchFromAbsolutePaths = matchFromAbsolutePaths;
|
||||
function findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExists) {
|
||||
for (var index = 0; index < mainFields.length; index++) {
|
||||
var mainFieldName = mainFields[index];
|
||||
var candidateMapping = packageJson[mainFieldName];
|
||||
if (candidateMapping && typeof candidateMapping === "string") {
|
||||
var candidateFilePath = path.join(path.dirname(packageJsonPath), candidateMapping);
|
||||
if (fileExists(candidateFilePath)) {
|
||||
return candidateFilePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function findFirstExistingPath(tryPaths, readJson, fileExists, mainFields) {
|
||||
if (readJson === void 0) { readJson = Filesystem.readJsonFromDiskSync; }
|
||||
if (mainFields === void 0) { mainFields = ["main"]; }
|
||||
for (var _i = 0, tryPaths_1 = tryPaths; _i < tryPaths_1.length; _i++) {
|
||||
var tryPath = tryPaths_1[_i];
|
||||
if (tryPath.type === "file" ||
|
||||
tryPath.type === "extension" ||
|
||||
tryPath.type === "index") {
|
||||
if (fileExists(tryPath.path)) {
|
||||
return TryPath.getStrippedPath(tryPath);
|
||||
}
|
||||
}
|
||||
else if (tryPath.type === "package") {
|
||||
var packageJson = readJson(tryPath.path);
|
||||
if (packageJson) {
|
||||
var mainFieldMappedFile = findFirstExistingMainFieldMappedFile(packageJson, mainFields, tryPath.path, fileExists);
|
||||
if (mainFieldMappedFile) {
|
||||
return mainFieldMappedFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
TryPath.exhaustiveTypeException(tryPath.type);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
//# sourceMappingURL=match-path-sync.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/match-path-sync.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/match-path-sync.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"match-path-sync.js","sourceRoot":"","sources":["../src/match-path-sync.ts"],"names":[],"mappings":";;;AAAA,2BAA6B;AAC7B,yCAA2C;AAC3C,8CAAgD;AAChD,oCAAsC;AActC;;;;;;;GAOG;AACH,SAAgB,eAAe,CAC7B,eAAuB,EACvB,KAAuC,EACvC,UAA+B,EAC/B,WAA2B;IAD3B,2BAAA,EAAA,cAAwB,MAAM,CAAC;IAC/B,4BAAA,EAAA,kBAA2B;IAE3B,IAAM,aAAa,GAAG,YAAY,CAAC,yBAAyB,CAC1D,eAAe,EACf,KAAK,EACL,WAAW,CACZ,CAAC;IAEF,OAAO,UACL,eAAuB,EACvB,QAAkC,EAClC,UAAsC,EACtC,UAA0B;QAE1B,OAAA,sBAAsB,CACpB,aAAa,EACb,eAAe,EACf,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,CACX;IAPD,CAOC,CAAC;AACN,CAAC;AA1BD,0CA0BC;AAED;;;;;;;;;GASG;AACH,SAAgB,sBAAsB,CACpC,oBAA8D,EAC9D,eAAuB,EACvB,QAAmE,EACnE,UAAiE,EACjE,UAA2D,EAC3D,UAA+B;IAH/B,yBAAA,EAAA,WAAoC,UAAU,CAAC,oBAAoB;IACnE,2BAAA,EAAA,aAAwC,UAAU,CAAC,cAAc;IACjE,2BAAA,EAAA,aAA4B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IAC3D,2BAAA,EAAA,cAAwB,MAAM,CAAC;IAE/B,IAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,CACpC,UAAU,EACV,oBAAoB,EACpB,eAAe,CAChB,CAAC;IAEF,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAC3E,CAAC;AAnBD,wDAm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,mBAAmB,GAAG,oCAAoC,CAC9D,WAAW,EACX,UAAU,EACV,OAAO,CAAC,IAAI,EACZ,UAAU,CACX,CAAC;gBACF,IAAI,mBAAmB,EAAE;oBACvB,OAAO,mBAAmB,CAAC;iBAC5B;aACF;SACF;aAAM;YACL,OAAO,CAAC,uBAAuB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC/C;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
||||
4
install/config-ui/node_modules/tsconfig-paths/lib/options.d.ts
generated
vendored
Normal file
4
install/config-ui/node_modules/tsconfig-paths/lib/options.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export interface Options {
|
||||
cwd: string;
|
||||
}
|
||||
export declare const options: Options;
|
||||
15
install/config-ui/node_modules/tsconfig-paths/lib/options.js
generated
vendored
Normal file
15
install/config-ui/node_modules/tsconfig-paths/lib/options.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.options = void 0;
|
||||
var minimist = require("minimist");
|
||||
var argv = minimist(process.argv.slice(2), {
|
||||
string: ["project"],
|
||||
alias: {
|
||||
project: ["P"],
|
||||
},
|
||||
});
|
||||
var project = argv && argv.project;
|
||||
exports.options = {
|
||||
cwd: project || process.cwd(),
|
||||
};
|
||||
//# sourceMappingURL=options.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/options.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/options.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AAErC,IAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IAC3C,MAAM,EAAE,CAAC,SAAS,CAAC;IACnB,KAAK,EAAE;QACL,OAAO,EAAE,CAAC,GAAG,CAAC;KACf;CACF,CAAC,CAAC;AAEH,IAAM,OAAO,GAAG,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC;AAMxB,QAAA,OAAO,GAAY;IAC9B,GAAG,EAAE,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE;CAC9B,CAAC"}
|
||||
6
install/config-ui/node_modules/tsconfig-paths/lib/register.d.ts
generated
vendored
Normal file
6
install/config-ui/node_modules/tsconfig-paths/lib/register.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
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;
|
||||
93
install/config-ui/node_modules/tsconfig-paths/lib/register.js
generated
vendored
Normal file
93
install/config-ui/node_modules/tsconfig-paths/lib/register.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.register = void 0;
|
||||
var match_path_sync_1 = require("./match-path-sync");
|
||||
var config_loader_1 = require("./config-loader");
|
||||
var options_1 = require("./options");
|
||||
var noOp = function () { return void 0; };
|
||||
function getCoreModules(builtinModules) {
|
||||
builtinModules = builtinModules || [
|
||||
"assert",
|
||||
"buffer",
|
||||
"child_process",
|
||||
"cluster",
|
||||
"crypto",
|
||||
"dgram",
|
||||
"dns",
|
||||
"domain",
|
||||
"events",
|
||||
"fs",
|
||||
"http",
|
||||
"https",
|
||||
"net",
|
||||
"os",
|
||||
"path",
|
||||
"punycode",
|
||||
"querystring",
|
||||
"readline",
|
||||
"stream",
|
||||
"string_decoder",
|
||||
"tls",
|
||||
"tty",
|
||||
"url",
|
||||
"util",
|
||||
"v8",
|
||||
"vm",
|
||||
"zlib",
|
||||
];
|
||||
var coreModules = {};
|
||||
for (var _i = 0, builtinModules_1 = builtinModules; _i < builtinModules_1.length; _i++) {
|
||||
var module_1 = builtinModules_1[_i];
|
||||
coreModules[module_1] = true;
|
||||
}
|
||||
return coreModules;
|
||||
}
|
||||
/**
|
||||
* Installs a custom module load function that can adhere to paths in tsconfig.
|
||||
* Returns a function to undo paths registration.
|
||||
*/
|
||||
function register(explicitParams) {
|
||||
var configLoaderResult = (0, config_loader_1.configLoader)({
|
||||
cwd: options_1.options.cwd,
|
||||
explicitParams: explicitParams,
|
||||
});
|
||||
if (configLoaderResult.resultType === "failed") {
|
||||
console.warn("".concat(configLoaderResult.message, ". tsconfig-paths will be skipped"));
|
||||
return noOp;
|
||||
}
|
||||
var matchPath = (0, match_path_sync_1.createMatchPath)(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths, configLoaderResult.mainFields, configLoaderResult.addMatchAll);
|
||||
// Patch node's module loading
|
||||
// tslint:disable-next-line:no-require-imports variable-name
|
||||
var Module = require("module");
|
||||
var originalResolveFilename = Module._resolveFilename;
|
||||
var coreModules = getCoreModules(Module.builtinModules);
|
||||
// tslint:disable-next-line:no-any
|
||||
Module._resolveFilename = function (request, _parent) {
|
||||
var isCoreModule = coreModules.hasOwnProperty(request);
|
||||
if (!isCoreModule) {
|
||||
var found = matchPath(request);
|
||||
if (found) {
|
||||
var modifiedArguments = __spreadArray([found], [].slice.call(arguments, 1), true); // Passes all arguments. Even those that is not specified above.
|
||||
// tslint:disable-next-line:no-invalid-this
|
||||
return originalResolveFilename.apply(this, modifiedArguments);
|
||||
}
|
||||
}
|
||||
// tslint:disable-next-line:no-invalid-this
|
||||
return originalResolveFilename.apply(this, arguments);
|
||||
};
|
||||
return function () {
|
||||
// Return node's module loading to original state.
|
||||
Module._resolveFilename = originalResolveFilename;
|
||||
};
|
||||
}
|
||||
exports.register = register;
|
||||
//# sourceMappingURL=register.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/register.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/register.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAoD;AACpD,iDAA+D;AAC/D,qCAAoC;AAEpC,IAAM,IAAI,GAAG,cAAY,OAAA,KAAK,CAAC,EAAN,CAAM,CAAC;AAEhC,SAAS,cAAc,CACrB,cAAoC;IAEpC,cAAc,GAAG,cAAc,IAAI;QACjC,QAAQ;QACR,QAAQ;QACR,eAAe;QACf,SAAS;QACT,QAAQ;QACR,OAAO;QACP,KAAK;QACL,QAAQ;QACR,QAAQ;QACR,IAAI;QACJ,MAAM;QACN,OAAO;QACP,KAAK;QACL,IAAI;QACJ,MAAM;QACN,UAAU;QACV,aAAa;QACb,UAAU;QACV,QAAQ;QACR,gBAAgB;QAChB,KAAK;QACL,KAAK;QACL,KAAK;QACL,MAAM;QACN,IAAI;QACJ,IAAI;QACJ,MAAM;KACP,CAAC;IAEF,IAAM,WAAW,GAA+B,EAAE,CAAC;IACnD,KAAmB,UAAc,EAAd,iCAAc,EAAd,4BAAc,EAAd,IAAc,EAAE;QAA9B,IAAI,QAAM,uBAAA;QACb,WAAW,CAAC,QAAM,CAAC,GAAG,IAAI,CAAC;KAC5B;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CAAC,cAA8B;IACrD,IAAM,kBAAkB,GAAG,IAAA,4BAAY,EAAC;QACtC,GAAG,EAAE,iBAAO,CAAC,GAAG;QAChB,cAAc,gBAAA;KACf,CAAC,CAAC;IAEH,IAAI,kBAAkB,CAAC,UA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.ts
generated
vendored
Normal file
15
install/config-ui/node_modules/tsconfig-paths/lib/try-path.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { MappingEntry } from "./mapping-entry";
|
||||
export interface TryPath {
|
||||
readonly type: "file" | "extension" | "index" | "package";
|
||||
readonly path: string;
|
||||
}
|
||||
/**
|
||||
* Builds a list of all physical paths to try by:
|
||||
* 1. Check for file named exactly as request.
|
||||
* 2. Check for files named as request ending in any of the extensions.
|
||||
* 3. Check for file specified in package.json's main property.
|
||||
* 4. Check for files named as request ending in "index" with any of the extensions.
|
||||
*/
|
||||
export declare function getPathsToTry(extensions: ReadonlyArray<string>, absolutePathMappings: ReadonlyArray<MappingEntry>, requestedModule: string): ReadonlyArray<TryPath> | undefined;
|
||||
export declare function getStrippedPath(tryPath: TryPath): string;
|
||||
export declare function exhaustiveTypeException(check: never): never;
|
||||
90
install/config-ui/node_modules/tsconfig-paths/lib/try-path.js
generated
vendored
Normal file
90
install/config-ui/node_modules/tsconfig-paths/lib/try-path.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.exhaustiveTypeException = exports.getStrippedPath = exports.getPathsToTry = void 0;
|
||||
var path = require("path");
|
||||
var path_1 = require("path");
|
||||
var filesystem_1 = require("./filesystem");
|
||||
/**
|
||||
* Builds a list of all physical paths to try by:
|
||||
* 1. Check for file named exactly as request.
|
||||
* 2. Check for files named as request ending in any of the extensions.
|
||||
* 3. Check for file specified in package.json's main property.
|
||||
* 4. Check for files named as request ending in "index" with any of the extensions.
|
||||
*/
|
||||
function getPathsToTry(extensions, absolutePathMappings, requestedModule) {
|
||||
if (!absolutePathMappings || !requestedModule || requestedModule[0] === ".") {
|
||||
return undefined;
|
||||
}
|
||||
var pathsToTry = [];
|
||||
for (var _i = 0, absolutePathMappings_1 = absolutePathMappings; _i < absolutePathMappings_1.length; _i++) {
|
||||
var entry = absolutePathMappings_1[_i];
|
||||
var starMatch = entry.pattern === requestedModule
|
||||
? ""
|
||||
: matchStar(entry.pattern, requestedModule);
|
||||
if (starMatch !== undefined) {
|
||||
var _loop_1 = function (physicalPathPattern) {
|
||||
var physicalPath = physicalPathPattern.replace("*", starMatch);
|
||||
pathsToTry.push({ type: "file", path: physicalPath });
|
||||
pathsToTry.push.apply(pathsToTry, extensions.map(function (e) { return ({ type: "extension", path: physicalPath + e }); }));
|
||||
pathsToTry.push({
|
||||
type: "package",
|
||||
path: path.join(physicalPath, "/package.json"),
|
||||
});
|
||||
var indexPath = path.join(physicalPath, "/index");
|
||||
pathsToTry.push.apply(pathsToTry, extensions.map(function (e) { return ({ type: "index", path: indexPath + e }); }));
|
||||
};
|
||||
for (var _a = 0, _b = entry.paths; _a < _b.length; _a++) {
|
||||
var physicalPathPattern = _b[_a];
|
||||
_loop_1(physicalPathPattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
return pathsToTry.length === 0 ? undefined : pathsToTry;
|
||||
}
|
||||
exports.getPathsToTry = getPathsToTry;
|
||||
// Not sure why we don't just return the full found path?
|
||||
function getStrippedPath(tryPath) {
|
||||
return tryPath.type === "index"
|
||||
? (0, path_1.dirname)(tryPath.path)
|
||||
: tryPath.type === "file"
|
||||
? tryPath.path
|
||||
: tryPath.type === "extension"
|
||||
? (0, filesystem_1.removeExtension)(tryPath.path)
|
||||
: tryPath.type === "package"
|
||||
? tryPath.path
|
||||
: exhaustiveTypeException(tryPath.type);
|
||||
}
|
||||
exports.getStrippedPath = getStrippedPath;
|
||||
function exhaustiveTypeException(check) {
|
||||
throw new Error("Unknown type ".concat(check));
|
||||
}
|
||||
exports.exhaustiveTypeException = exhaustiveTypeException;
|
||||
/**
|
||||
* Matches pattern with a single star against search.
|
||||
* Star must match at least one character to be considered a match.
|
||||
* @param patttern for example "foo*"
|
||||
* @param search for example "fooawesomebar"
|
||||
* @returns the part of search that * matches, or undefined if no match.
|
||||
*/
|
||||
function matchStar(pattern, search) {
|
||||
if (search.length < pattern.length) {
|
||||
return undefined;
|
||||
}
|
||||
if (pattern === "*") {
|
||||
return search;
|
||||
}
|
||||
var star = pattern.indexOf("*");
|
||||
if (star === -1) {
|
||||
return undefined;
|
||||
}
|
||||
var part1 = pattern.substring(0, star);
|
||||
var part2 = pattern.substring(star + 1);
|
||||
if (search.substr(0, star) !== part1) {
|
||||
return undefined;
|
||||
}
|
||||
if (search.substr(search.length - part2.length) !== part2) {
|
||||
return undefined;
|
||||
}
|
||||
return search.substr(star, search.length - part2.length);
|
||||
}
|
||||
//# sourceMappingURL=try-path.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/try-path.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/try-path.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"try-path.js","sourceRoot":"","sources":["../src/try-path.ts"],"names":[],"mappings":";;;AAAA,2BAA6B;AAE7B,6BAA+B;AAC/B,2CAA+C;AAO/C;;;;;;GAMG;AACH,SAAgB,aAAa,CAC3B,UAAiC,EACjC,oBAAiD,EACjD,eAAuB;IAEvB,IAAI,CAAC,oBAAoB,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QAC3E,OAAO,SAAS,CAAC;KAClB;IAED,IAAM,UAAU,GAAmB,EAAE,CAAC;IACtC,KAAoB,UAAoB,EAApB,6CAAoB,EAApB,kCAAoB,EAApB,IAAoB,EAAE;QAArC,IAAM,KAAK,6BAAA;QACd,IAAM,SAAS,GACb,KAAK,CAAC,OAAO,KAAK,eAAe;YAC/B,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAChD,IAAI,SAAS,KAAK,SAAS,EAAE;oCAChB,mBAAmB;gBAC5B,IAAM,YAAY,GAAG,mBAAmB,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;gBAC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AC"}
|
||||
28
install/config-ui/node_modules/tsconfig-paths/lib/tsconfig-loader.d.ts
generated
vendored
Normal file
28
install/config-ui/node_modules/tsconfig-paths/lib/tsconfig-loader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Typing for the parts of tsconfig that we care about
|
||||
*/
|
||||
export interface Tsconfig {
|
||||
extends?: string | string[];
|
||||
compilerOptions?: {
|
||||
baseUrl?: string;
|
||||
paths?: {
|
||||
[key: string]: Array<string>;
|
||||
};
|
||||
strict?: boolean;
|
||||
};
|
||||
}
|
||||
export interface TsConfigLoaderResult {
|
||||
tsConfigPath: string | undefined;
|
||||
baseUrl: string | undefined;
|
||||
paths: {
|
||||
[key: string]: Array<string>;
|
||||
} | undefined;
|
||||
}
|
||||
export interface TsConfigLoaderParams {
|
||||
getEnv: (key: string) => string | undefined;
|
||||
cwd: string;
|
||||
loadSync?(cwd: string, filename?: string, baseUrl?: string): TsConfigLoaderResult;
|
||||
}
|
||||
export declare function tsConfigLoader({ getEnv, cwd, loadSync, }: TsConfigLoaderParams): TsConfigLoaderResult;
|
||||
export declare function walkForTsConfig(directory: string, existsSync?: (path: string) => boolean): string | undefined;
|
||||
export declare function loadTsconfig(configFilePath: string, existsSync?: (path: string) => boolean, readFileSync?: (filename: string) => string): Tsconfig | undefined;
|
||||
141
install/config-ui/node_modules/tsconfig-paths/lib/tsconfig-loader.js
generated
vendored
Normal file
141
install/config-ui/node_modules/tsconfig-paths/lib/tsconfig-loader.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__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;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.loadTsconfig = exports.walkForTsConfig = exports.tsConfigLoader = void 0;
|
||||
var path = require("path");
|
||||
var fs = require("fs");
|
||||
// tslint:disable:no-require-imports
|
||||
var JSON5 = require("json5");
|
||||
var StripBom = require("strip-bom");
|
||||
function tsConfigLoader(_a) {
|
||||
var getEnv = _a.getEnv, cwd = _a.cwd, _b = _a.loadSync, loadSync = _b === void 0 ? loadSyncDefault : _b;
|
||||
var TS_NODE_PROJECT = getEnv("TS_NODE_PROJECT");
|
||||
var TS_NODE_BASEURL = getEnv("TS_NODE_BASEURL");
|
||||
// tsconfig.loadSync handles if TS_NODE_PROJECT is a file or directory
|
||||
// and also overrides baseURL if TS_NODE_BASEURL is available.
|
||||
var loadResult = loadSync(cwd, TS_NODE_PROJECT, TS_NODE_BASEURL);
|
||||
return loadResult;
|
||||
}
|
||||
exports.tsConfigLoader = tsConfigLoader;
|
||||
function loadSyncDefault(cwd, filename, baseUrl) {
|
||||
// Tsconfig.loadSync uses path.resolve. This is why we can use an absolute path as filename
|
||||
var configPath = resolveConfigPath(cwd, filename);
|
||||
if (!configPath) {
|
||||
return {
|
||||
tsConfigPath: undefined,
|
||||
baseUrl: undefined,
|
||||
paths: undefined,
|
||||
};
|
||||
}
|
||||
var config = loadTsconfig(configPath);
|
||||
return {
|
||||
tsConfigPath: configPath,
|
||||
baseUrl: baseUrl ||
|
||||
(config && config.compilerOptions && config.compilerOptions.baseUrl),
|
||||
paths: config && config.compilerOptions && config.compilerOptions.paths,
|
||||
};
|
||||
}
|
||||
function resolveConfigPath(cwd, filename) {
|
||||
if (filename) {
|
||||
var absolutePath = fs.lstatSync(filename).isDirectory()
|
||||
? path.resolve(filename, "./tsconfig.json")
|
||||
: path.resolve(cwd, filename);
|
||||
return absolutePath;
|
||||
}
|
||||
if (fs.statSync(cwd).isFile()) {
|
||||
return path.resolve(cwd);
|
||||
}
|
||||
var configAbsolutePath = walkForTsConfig(cwd);
|
||||
return configAbsolutePath ? path.resolve(configAbsolutePath) : undefined;
|
||||
}
|
||||
function walkForTsConfig(directory, existsSync) {
|
||||
if (existsSync === void 0) { existsSync = fs.existsSync; }
|
||||
var configPath = path.join(directory, "./tsconfig.json");
|
||||
if (existsSync(configPath)) {
|
||||
return configPath;
|
||||
}
|
||||
var parentDirectory = path.join(directory, "../");
|
||||
// If we reached the top
|
||||
if (directory === parentDirectory) {
|
||||
return undefined;
|
||||
}
|
||||
return walkForTsConfig(parentDirectory, existsSync);
|
||||
}
|
||||
exports.walkForTsConfig = walkForTsConfig;
|
||||
function loadTsconfig(configFilePath, existsSync, readFileSync) {
|
||||
if (existsSync === void 0) { existsSync = fs.existsSync; }
|
||||
if (readFileSync === void 0) { readFileSync = function (filename) {
|
||||
return fs.readFileSync(filename, "utf8");
|
||||
}; }
|
||||
if (!existsSync(configFilePath)) {
|
||||
return undefined;
|
||||
}
|
||||
var configString = readFileSync(configFilePath);
|
||||
var cleanedJson = StripBom(configString);
|
||||
var config;
|
||||
try {
|
||||
config = JSON5.parse(cleanedJson);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error("".concat(configFilePath, " is malformed ").concat(e.message));
|
||||
}
|
||||
var extendedConfig = config.extends;
|
||||
if (extendedConfig) {
|
||||
var base = void 0;
|
||||
if (Array.isArray(extendedConfig)) {
|
||||
base = extendedConfig.reduce(function (currBase, extendedConfigElement) {
|
||||
return mergeTsconfigs(currBase, loadTsconfigFromExtends(configFilePath, extendedConfigElement, existsSync, readFileSync));
|
||||
}, {});
|
||||
}
|
||||
else {
|
||||
base = loadTsconfigFromExtends(configFilePath, extendedConfig, existsSync, readFileSync);
|
||||
}
|
||||
return mergeTsconfigs(base, config);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
exports.loadTsconfig = loadTsconfig;
|
||||
/**
|
||||
* Intended to be called only from loadTsconfig.
|
||||
* Parameters don't have defaults because they should use the same as loadTsconfig.
|
||||
*/
|
||||
function loadTsconfigFromExtends(configFilePath, extendedConfigValue,
|
||||
// eslint-disable-next-line no-shadow
|
||||
existsSync, readFileSync) {
|
||||
var _a;
|
||||
if (typeof extendedConfigValue === "string" &&
|
||||
extendedConfigValue.indexOf(".json") === -1) {
|
||||
extendedConfigValue += ".json";
|
||||
}
|
||||
var currentDir = path.dirname(configFilePath);
|
||||
var extendedConfigPath = path.join(currentDir, extendedConfigValue);
|
||||
if (extendedConfigValue.indexOf("/") !== -1 &&
|
||||
extendedConfigValue.indexOf(".") !== -1 &&
|
||||
!existsSync(extendedConfigPath)) {
|
||||
extendedConfigPath = path.join(currentDir, "node_modules", extendedConfigValue);
|
||||
}
|
||||
var config = loadTsconfig(extendedConfigPath, existsSync, readFileSync) || {};
|
||||
// baseUrl should be interpreted as relative to extendedConfigPath,
|
||||
// but we need to update it so it is relative to the original tsconfig being loaded
|
||||
if ((_a = config.compilerOptions) === null || _a === void 0 ? void 0 : _a.baseUrl) {
|
||||
var extendsDir = path.dirname(extendedConfigValue);
|
||||
config.compilerOptions.baseUrl = path.join(extendsDir, config.compilerOptions.baseUrl);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
function mergeTsconfigs(base, config) {
|
||||
base = base || {};
|
||||
config = config || {};
|
||||
return __assign(__assign(__assign({}, base), config), { compilerOptions: __assign(__assign({}, base.compilerOptions), config.compilerOptions) });
|
||||
}
|
||||
//# sourceMappingURL=tsconfig-loader.js.map
|
||||
1
install/config-ui/node_modules/tsconfig-paths/lib/tsconfig-loader.js.map
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/lib/tsconfig-loader.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"tsconfig-loader.js","sourceRoot":"","sources":["../src/tsconfig-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2BAA6B;AAC7B,uBAAyB;AACzB,oCAAoC;AACpC,6BAAgC;AAChC,oCAAuC;AA+BvC,SAAgB,cAAc,CAAC,EAIR;QAHrB,MAAM,YAAA,EACN,GAAG,SAAA,EACH,g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AAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAC/B;QACA,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAC5B,UAAU,EACV,cAAc,EACd,mBAAmB,CACpB,CAAC;KACH;IAED,IAAM,MAAM,GACV,YAAY,CAAC,kBAAkB,EAAE,UAAU,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC;IAEnE,mEAAmE;IACnE,mFAAmF;IACnF,IAAI,MAAA,MAAM,CAAC,eAAe,0CAAE,OAAO,EAAE;QACnC,IAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACrD,MAAM,CAAC,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CACxC,UAAU,EACV,MAAM,CAAC,eAAe,CAAC,OAAO,CAC/B,CAAC;KACH;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,cAAc,CACrB,IAA0B,EAC1B,MAA4B;IAE5B,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IAClB,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;IAEtB,sCACK,IAAI,GACJ,MAAM,KACT,eAAe,wBACV,IAAI,CAAC,eAAe,GACpB,MAAM,CAAC,eAAe,KAE3B;AACJ,CAAC"}
|
||||
67
install/config-ui/node_modules/tsconfig-paths/package.json
generated
vendored
Normal file
67
install/config-ui/node_modules/tsconfig-paths/package.json
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"name": "tsconfig-paths",
|
||||
"version": "3.15.0",
|
||||
"description": "Load node modules according to tsconfig paths, in run-time or via API.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"author": "Jonas Kello",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/dividab/tsconfig-paths",
|
||||
"files": [
|
||||
"/src",
|
||||
"/lib",
|
||||
"register.js",
|
||||
"package.json",
|
||||
"CHANGELOG.md",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.0.3",
|
||||
"@types/minimist": "^1.2.2",
|
||||
"@types/node": "^6.0.54",
|
||||
"@types/strip-bom": "^3.0.0",
|
||||
"@types/strip-json-comments": "^0.0.30",
|
||||
"husky": "^4.2.5",
|
||||
"jest": "^27.3.1",
|
||||
"lint-staged": "^10.2.11",
|
||||
"prettier": "^2.0.5",
|
||||
"rimraf": "^2.6.2",
|
||||
"ts-jest": "^27.0.7",
|
||||
"ts-node": "^10.7.0",
|
||||
"tslint": "^5.8.0",
|
||||
"typescript": "^4.5.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/json5": "^0.0.29",
|
||||
"json5": "^1.0.2",
|
||||
"minimist": "^1.2.6",
|
||||
"strip-bom": "^3.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "cd src && ts-node index.ts",
|
||||
"example:node": "yarn build && cd ./example/node && ts-node -r ../register.js main.ts",
|
||||
"example:project": "yarn build && ts-node -r ./register.js -P ./example/project/tsconfig.json ./example/project/main.ts",
|
||||
"example:api": "cd example/api && ts-node main.ts",
|
||||
"example:perf": "cd example/perf && ts-node main.ts",
|
||||
"test": "jest",
|
||||
"test-coverage": "jest --coverage",
|
||||
"build": "rimraf lib && tsc -p .",
|
||||
"lint": "tslint './{src,tests}/**/*.ts{,x}'",
|
||||
"verify": "yarn build && yarn lint && yarn test-coverage",
|
||||
"preversion": "yarn verify",
|
||||
"postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{ts,tsx}": "tslint",
|
||||
"*.{ts,tsx,json,css}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
}
|
||||
}
|
||||
1
install/config-ui/node_modules/tsconfig-paths/register.js
generated
vendored
Normal file
1
install/config-ui/node_modules/tsconfig-paths/register.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
require("./").register();
|
||||
100
install/config-ui/node_modules/tsconfig-paths/src/__tests__/config-loader.test.ts
generated
vendored
Normal file
100
install/config-ui/node_modules/tsconfig-paths/src/__tests__/config-loader.test.ts
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
import {
|
||||
configLoader,
|
||||
loadConfig,
|
||||
ConfigLoaderFailResult,
|
||||
ConfigLoaderSuccessResult,
|
||||
} from "../config-loader";
|
||||
import { join } from "path";
|
||||
|
||||
describe("config-loader", (): void => {
|
||||
it("should use explicitParams when set", () => {
|
||||
const result = configLoader({
|
||||
explicitParams: {
|
||||
baseUrl: "/foo/bar",
|
||||
paths: {
|
||||
asd: ["asd"],
|
||||
},
|
||||
},
|
||||
cwd: "/baz",
|
||||
});
|
||||
|
||||
const successResult = result as ConfigLoaderSuccessResult;
|
||||
// assert.equal(successResult.resultType, "success");
|
||||
// assert.equal(successResult.absoluteBaseUrl, "/foo/bar");
|
||||
// assert.equal(successResult.paths["asd"][0], "asd");
|
||||
expect(successResult.resultType).toBe("success");
|
||||
expect(successResult.absoluteBaseUrl).toBe("/foo/bar");
|
||||
expect(successResult.paths["asd"][0]).toBe("asd");
|
||||
});
|
||||
|
||||
it("should use explicitParams when set and add cwd when path is relative", () => {
|
||||
const result = configLoader({
|
||||
explicitParams: {
|
||||
baseUrl: "bar/",
|
||||
paths: {
|
||||
asd: ["asd"],
|
||||
},
|
||||
},
|
||||
cwd: "/baz",
|
||||
});
|
||||
|
||||
const successResult = result as ConfigLoaderSuccessResult;
|
||||
// assert.equal(successResult.resultType, "success");
|
||||
// assert.equal(successResult.absoluteBaseUrl, join("/baz", "bar/"));
|
||||
expect(successResult.resultType).toBe("success");
|
||||
expect(successResult.absoluteBaseUrl).toBe(join("/baz", "bar/"));
|
||||
});
|
||||
|
||||
it("should fallback to tsConfigLoader when explicitParams is not set", () => {
|
||||
const result = configLoader({
|
||||
explicitParams: undefined,
|
||||
cwd: "/baz",
|
||||
// tslint:disable-next-line:no-any
|
||||
tsConfigLoader: (_: any) => ({
|
||||
tsConfigPath: "/baz/tsconfig.json",
|
||||
baseUrl: "./src",
|
||||
paths: {},
|
||||
}),
|
||||
});
|
||||
|
||||
const successResult = result as ConfigLoaderSuccessResult;
|
||||
// assert.equal(successResult.resultType, "success");
|
||||
// assert.equal(successResult.absoluteBaseUrl, join("/baz", "src"));
|
||||
expect(successResult.resultType).toBe("success");
|
||||
expect(successResult.absoluteBaseUrl).toBe(join("/baz", "src"));
|
||||
});
|
||||
|
||||
it("should show an error message when baseUrl is missing", () => {
|
||||
const result = configLoader({
|
||||
explicitParams: undefined,
|
||||
cwd: "/baz",
|
||||
// tslint:disable-next-line:no-any
|
||||
tsConfigLoader: (_: any) => ({
|
||||
tsConfigPath: "/baz/tsconfig.json",
|
||||
baseUrl: undefined,
|
||||
paths: {},
|
||||
}),
|
||||
});
|
||||
|
||||
const failResult = result as ConfigLoaderFailResult;
|
||||
// assert.equal(failResult.resultType, "failed");
|
||||
// assert.isTrue(failResult.message.indexOf("baseUrl") > -1);
|
||||
expect(failResult.resultType).toBe("failed");
|
||||
expect(failResult.message.indexOf("baseUrl") > -1).toBeTruthy();
|
||||
});
|
||||
|
||||
it("should presume cwd to be a tsconfig file when loadConfig is called with absolute path to tsconfig.json", () => {
|
||||
// using tsconfig-named.json to ensure that future changes to fix
|
||||
// https://github.com/dividab/tsconfig-paths/issues/31
|
||||
// do not pass this test case just because of a directory walk looking
|
||||
// for tsconfig.json
|
||||
const configFile = join(__dirname, "tsconfig-named.json");
|
||||
const result = loadConfig(configFile);
|
||||
|
||||
const successResult = result as ConfigLoaderSuccessResult;
|
||||
// assert.equal(successResult.resultType, "success");
|
||||
// assert.equal(successResult.configFileAbsolutePath, configFile);
|
||||
expect(successResult.resultType).toBe("success");
|
||||
expect(successResult.configFileAbsolutePath).toBe(configFile);
|
||||
});
|
||||
});
|
||||
219
install/config-ui/node_modules/tsconfig-paths/src/__tests__/data/match-path-data.ts
generated
vendored
Normal file
219
install/config-ui/node_modules/tsconfig-paths/src/__tests__/data/match-path-data.ts
generated
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
import { join, dirname } from "path";
|
||||
import { removeExtension } from "../../filesystem";
|
||||
|
||||
export interface OneTest {
|
||||
readonly name: string;
|
||||
readonly only?: boolean;
|
||||
readonly skip?: boolean;
|
||||
readonly absoluteBaseUrl: string;
|
||||
readonly paths: { [key: string]: Array<string> };
|
||||
readonly mainFields?: string[];
|
||||
readonly addMatchAll?: boolean;
|
||||
readonly existingFiles: ReadonlyArray<string>;
|
||||
readonly requestedModule: string;
|
||||
readonly extensions: ReadonlyArray<string>;
|
||||
readonly packageJson?: {};
|
||||
readonly expectedPath: string | undefined;
|
||||
}
|
||||
|
||||
const defaultExtensionsWhenRunningInTsNode = [
|
||||
".js",
|
||||
".json",
|
||||
".node",
|
||||
".ts",
|
||||
".tsx",
|
||||
];
|
||||
|
||||
export const tests: ReadonlyArray<OneTest> = [
|
||||
{
|
||||
name: "should locate path that matches with star and exists",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {
|
||||
"lib/*": ["location/*"],
|
||||
},
|
||||
existingFiles: [join("/root", "location", "mylib", "index.ts")],
|
||||
requestedModule: "lib/mylib",
|
||||
expectedPath: dirname(join("/root", "location", "mylib", "index.ts")),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should resolve to correct path when many are specified",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {
|
||||
"lib/*": ["foo1/*", "foo2/*", "location/*", "foo3/*"],
|
||||
},
|
||||
existingFiles: [join("/root", "location", "mylib", "index.ts")],
|
||||
requestedModule: "lib/mylib",
|
||||
extensions: [".ts"],
|
||||
expectedPath: dirname(join("/root", "location", "mylib", "index.ts")),
|
||||
},
|
||||
{
|
||||
name:
|
||||
"should locate path that matches with star and prioritize pattern with longest prefix",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {
|
||||
"*": ["location/*"],
|
||||
"lib/*": ["location/*"],
|
||||
},
|
||||
existingFiles: [
|
||||
join("/root", "location", "lib", "mylib", "index.ts"),
|
||||
join("/root", "location", "mylib", "index.ts"),
|
||||
],
|
||||
requestedModule: "lib/mylib",
|
||||
expectedPath: dirname(join("/root", "location", "mylib", "index.ts")),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should locate path that matches with star and exists with extension",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [join("/root", "location", "mylib.myext")],
|
||||
requestedModule: "lib/mylib",
|
||||
extensions: [".js", ".myext"],
|
||||
expectedPath: removeExtension(join("/root", "location", "mylib.myext")),
|
||||
},
|
||||
{
|
||||
name: "should resolve request with extension specified",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [join("/root", "location", "test.jpg")],
|
||||
requestedModule: "lib/test.jpg",
|
||||
expectedPath: join("/root", "location", "test.jpg"),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should locate path that matches without star and exists",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {
|
||||
"lib/foo": ["location/foo"],
|
||||
},
|
||||
existingFiles: [join("/root", "location", "foo.ts")],
|
||||
requestedModule: "lib/foo",
|
||||
expectedPath: removeExtension(join("/root", "location", "foo.ts")),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should resolve to parent folder when filename is in subfolder",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [join("/root", "location", "mylib", "index.ts")],
|
||||
requestedModule: "lib/mylib",
|
||||
expectedPath: dirname(join("/root", "location", "mylib", "index.ts")),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should resolve from main field in package.json",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [join("/root", "location", "mylib", "kalle.ts")],
|
||||
packageJson: { main: "./kalle.ts" },
|
||||
requestedModule: "lib/mylib",
|
||||
expectedPath: join("/root", "location", "mylib", "kalle.ts"),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should resolve from main field in package.json (js)",
|
||||
absoluteBaseUrl: "/root",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [join("/root", "location", "mylib.js", "kalle.js")],
|
||||
packageJson: { main: "./kalle.js" },
|
||||
requestedModule: "lib/mylib.js",
|
||||
extensions: [".ts", ".js"],
|
||||
expectedPath: join("/root", "location", "mylib.js", "kalle.js"),
|
||||
},
|
||||
{
|
||||
name: "should resolve from list of fields by priority in package.json",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
mainFields: ["missing", "browser", "main"],
|
||||
packageJson: { main: "./main.js", browser: "./browser.js" },
|
||||
existingFiles: [
|
||||
join("/root", "location", "mylibjs", "main.js"), // mainFilePath
|
||||
join("/root", "location", "mylibjs", "browser.js"), // browserFilePath
|
||||
],
|
||||
extensions: [".ts", ".js"],
|
||||
requestedModule: "lib/mylibjs",
|
||||
expectedPath: join("/root", "location", "mylibjs", "browser.js"),
|
||||
},
|
||||
{
|
||||
name: "should ignore field mappings to missing files in package.json",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
mainFields: ["browser", "main"],
|
||||
existingFiles: [join("/root", "location", "mylibjs", "kalle.js")],
|
||||
requestedModule: "lib/mylibjs",
|
||||
packageJson: {
|
||||
main: "./kalle.js",
|
||||
browser: "./nope.js",
|
||||
},
|
||||
extensions: [".ts", ".js"],
|
||||
expectedPath: join("/root", "location", "mylibjs", "kalle.js"),
|
||||
},
|
||||
{
|
||||
name: "should ignore advanced field mappings in package.json",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [
|
||||
join("/root", "location", "mylibjs", "kalle.js"),
|
||||
join("/root", "location", "mylibjs", "browser.js"),
|
||||
],
|
||||
requestedModule: "lib/mylibjs",
|
||||
packageJson: {
|
||||
main: "./kalle.js",
|
||||
browser: { mylibjs: "./browser.js", "./kalle.js": "./browser.js" },
|
||||
},
|
||||
extensions: [".ts", ".js"],
|
||||
expectedPath: join("/root", "location", "mylibjs", "kalle.js"),
|
||||
},
|
||||
{
|
||||
name: "should resolve to with the help of baseUrl when not explicitly set",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {},
|
||||
existingFiles: [join("/root", "mylib", "index.ts")],
|
||||
requestedModule: "mylib",
|
||||
expectedPath: dirname(join("/root", "mylib", "index.ts")),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should not resolve with the help of baseUrl when asked not to",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {},
|
||||
addMatchAll: false,
|
||||
existingFiles: [join("/root", "mylib", "index.ts")],
|
||||
requestedModule: "mylib",
|
||||
expectedPath: undefined,
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should not locate path that does not match",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: { "lib/*": ["location/*"] },
|
||||
existingFiles: [join("root", "location", "mylib")],
|
||||
requestedModule: "mylib",
|
||||
expectedPath: undefined,
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should not resolve typings file (index.d.ts)",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {
|
||||
"lib/*": ["location/*"],
|
||||
},
|
||||
existingFiles: [join("/root", "location", "mylib", "index.d.ts")],
|
||||
requestedModule: "lib/mylib",
|
||||
expectedPath: undefined,
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
{
|
||||
name: "should resolve main file with cjs file extension",
|
||||
absoluteBaseUrl: "/root/",
|
||||
paths: {},
|
||||
existingFiles: [join("/root", "mylib", "index.cjs")],
|
||||
packageJson: {
|
||||
main: "./index.cjs",
|
||||
},
|
||||
requestedModule: "mylib",
|
||||
expectedPath: join("/root", "mylib", "index.cjs"),
|
||||
extensions: defaultExtensionsWhenRunningInTsNode,
|
||||
},
|
||||
];
|
||||
65
install/config-ui/node_modules/tsconfig-paths/src/__tests__/filesystem.test.ts
generated
vendored
Normal file
65
install/config-ui/node_modules/tsconfig-paths/src/__tests__/filesystem.test.ts
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
import * as Filesystem from "../filesystem";
|
||||
import * as path from "path";
|
||||
|
||||
describe("filesystem", () => {
|
||||
const fileThatExists = path.join(__dirname, "../../package.json");
|
||||
const fileThatNotExists = path.join(__dirname, "../../package2.json");
|
||||
|
||||
it("should find file that exists, sync", () => {
|
||||
const result = Filesystem.fileExistsSync(fileThatExists);
|
||||
// assert.equal(result, true);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it("should not find file that not exists, sync", () => {
|
||||
const result = Filesystem.fileExistsSync(fileThatNotExists);
|
||||
// assert.equal(result, false);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
|
||||
it("should find file that exists, async", (done) => {
|
||||
Filesystem.fileExistsAsync(fileThatExists, (_err, result) => {
|
||||
try {
|
||||
// assert.equal(result, true);
|
||||
expect(result).toBe(true);
|
||||
done();
|
||||
} catch (error) {
|
||||
done(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("should not find file that not exists, async", (done) => {
|
||||
Filesystem.fileExistsAsync(fileThatNotExists, (_err, result) => {
|
||||
try {
|
||||
// assert.equal(result, false);
|
||||
expect(result).toBe(false);
|
||||
done();
|
||||
} catch (error) {
|
||||
done(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("should load json, sync", () => {
|
||||
const result = Filesystem.readJsonFromDiskSync(fileThatExists);
|
||||
// assert.isOk(result);
|
||||
expect(result);
|
||||
// assert.equal(result.main, "lib/index.js");
|
||||
expect(result.main).toBe("lib/index.js");
|
||||
});
|
||||
|
||||
it("should load json, async", (done) => {
|
||||
Filesystem.readJsonFromDiskAsync(fileThatExists, (_err, result) => {
|
||||
try {
|
||||
// assert.isOk(result); // Asserts that object is truthy.
|
||||
expect(result).toBeTruthy();
|
||||
// assert.equal(result.main, "lib/index.js");
|
||||
expect(result.main).toBe("lib/index.js");
|
||||
done();
|
||||
} catch (error) {
|
||||
done(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
70
install/config-ui/node_modules/tsconfig-paths/src/__tests__/mapping-entry.test.ts
generated
vendored
Normal file
70
install/config-ui/node_modules/tsconfig-paths/src/__tests__/mapping-entry.test.ts
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
import { getAbsoluteMappingEntries } from "../mapping-entry";
|
||||
import { join } from "path";
|
||||
|
||||
describe("mapping-entry", () => {
|
||||
it("should change to absolute paths and sort in longest prefix order", () => {
|
||||
const result = getAbsoluteMappingEntries(
|
||||
"/absolute/base/url",
|
||||
{
|
||||
"*": ["/foo1", "/foo2"],
|
||||
"longest/pre/fix/*": ["/foo2/bar"],
|
||||
"pre/fix/*": ["/foo3"],
|
||||
},
|
||||
true
|
||||
);
|
||||
// assert.deepEqual(result, [
|
||||
// {
|
||||
// pattern: "longest/pre/fix/*",
|
||||
// paths: [join("/absolute", "base", "url", "foo2", "bar")],
|
||||
// },
|
||||
// {
|
||||
// pattern: "pre/fix/*",
|
||||
// paths: [join("/absolute", "base", "url", "foo3")],
|
||||
// },
|
||||
// {
|
||||
// pattern: "*",
|
||||
// paths: [
|
||||
// join("/absolute", "base", "url", "foo1"),
|
||||
// join("/absolute", "base", "url", "foo2"),
|
||||
// ],
|
||||
// },
|
||||
// ]);
|
||||
expect(result).toEqual([
|
||||
{
|
||||
pattern: "longest/pre/fix/*",
|
||||
paths: [join("/absolute", "base", "url", "foo2", "bar")],
|
||||
},
|
||||
{
|
||||
pattern: "pre/fix/*",
|
||||
paths: [join("/absolute", "base", "url", "foo3")],
|
||||
},
|
||||
{
|
||||
pattern: "*",
|
||||
paths: [
|
||||
join("/absolute", "base", "url", "foo1"),
|
||||
join("/absolute", "base", "url", "foo2"),
|
||||
],
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("should should add a match-all pattern when requested", () => {
|
||||
let result = getAbsoluteMappingEntries("/absolute/base/url", {}, true);
|
||||
// assert.deepEqual(result, [
|
||||
// {
|
||||
// pattern: "*",
|
||||
// paths: [join("/absolute", "base", "url", "*")],
|
||||
// },
|
||||
// ]);
|
||||
expect(result).toEqual([
|
||||
{
|
||||
pattern: "*",
|
||||
paths: [join("/absolute", "base", "url", "*")],
|
||||
},
|
||||
]);
|
||||
|
||||
result = getAbsoluteMappingEntries("/absolute/base/url", {}, false);
|
||||
// assert.deepEqual(result, []);
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
27
install/config-ui/node_modules/tsconfig-paths/src/__tests__/match-path-async.test.ts
generated
vendored
Normal file
27
install/config-ui/node_modules/tsconfig-paths/src/__tests__/match-path-async.test.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { createMatchPathAsync } from "../match-path-async";
|
||||
import * as Tests from "./data/match-path-data";
|
||||
|
||||
describe("match-path-async", () => {
|
||||
Tests.tests.forEach((t) =>
|
||||
it(t.name, (done) => {
|
||||
const matchPath = createMatchPathAsync(
|
||||
t.absoluteBaseUrl,
|
||||
t.paths,
|
||||
t.mainFields,
|
||||
t.addMatchAll
|
||||
);
|
||||
matchPath(
|
||||
t.requestedModule,
|
||||
(_path, callback) => callback(undefined, t.packageJson),
|
||||
(path, callback) =>
|
||||
callback(undefined, t.existingFiles.indexOf(path) !== -1),
|
||||
t.extensions,
|
||||
(_err, result) => {
|
||||
// assert.equal(result, t.expectedPath);
|
||||
expect(result).toBe(t.expectedPath);
|
||||
done();
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
});
|
||||
23
install/config-ui/node_modules/tsconfig-paths/src/__tests__/match-path-sync.test.ts
generated
vendored
Normal file
23
install/config-ui/node_modules/tsconfig-paths/src/__tests__/match-path-sync.test.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { createMatchPath } from "../match-path-sync";
|
||||
import * as Tests from "./data/match-path-data";
|
||||
|
||||
describe("match-path-sync", () => {
|
||||
Tests.tests.forEach((t) =>
|
||||
it(t.name, () => {
|
||||
const matchPath = createMatchPath(
|
||||
t.absoluteBaseUrl,
|
||||
t.paths,
|
||||
t.mainFields,
|
||||
t.addMatchAll
|
||||
);
|
||||
const result = matchPath(
|
||||
t.requestedModule,
|
||||
(_: string) => t.packageJson,
|
||||
(name: string) => t.existingFiles.indexOf(name) !== -1,
|
||||
t.extensions
|
||||
);
|
||||
// assert.equal(result, t.expectedPath);
|
||||
expect(result).toBe(t.expectedPath);
|
||||
})
|
||||
);
|
||||
});
|
||||
193
install/config-ui/node_modules/tsconfig-paths/src/__tests__/try-path.test.ts
generated
vendored
Normal file
193
install/config-ui/node_modules/tsconfig-paths/src/__tests__/try-path.test.ts
generated
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
import { getPathsToTry } from "../try-path";
|
||||
import { join } from "path";
|
||||
|
||||
describe("mapping-entry", () => {
|
||||
const abosolutePathMappings = [
|
||||
{
|
||||
pattern: "longest/pre/fix/*",
|
||||
paths: [join("/absolute", "base", "url", "foo2", "bar")],
|
||||
},
|
||||
{ pattern: "pre/fix/*", paths: [join("/absolute", "base", "url", "foo3")] },
|
||||
{ pattern: "*", paths: [join("/absolute", "base", "url", "foo1")] },
|
||||
];
|
||||
const abosolutePathMappingsStarstWithSlash = [
|
||||
{
|
||||
pattern: "/opt/*",
|
||||
paths: [join("/absolute", "src", "aws-layer")],
|
||||
},
|
||||
{
|
||||
pattern: "*",
|
||||
paths: [join("/absolute", "src")],
|
||||
},
|
||||
];
|
||||
it("should return no paths for relative requested module", () => {
|
||||
const result = getPathsToTry(
|
||||
[".ts", "tsx"],
|
||||
abosolutePathMappings,
|
||||
"./requested-module"
|
||||
);
|
||||
// assert.deepEqual(result, undefined);
|
||||
expect(result).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should return no paths if no pattern match the requested module", () => {
|
||||
const result = getPathsToTry(
|
||||
[".ts", "tsx"],
|
||||
[
|
||||
{
|
||||
pattern: "longest/pre/fix/*",
|
||||
paths: [join("/absolute", "base", "url", "foo2", "bar")],
|
||||
},
|
||||
{
|
||||
pattern: "pre/fix/*",
|
||||
paths: [join("/absolute", "base", "url", "foo3")],
|
||||
},
|
||||
],
|
||||
"requested-module"
|
||||
);
|
||||
expect(result).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should get all paths that matches requested module", () => {
|
||||
const result = getPathsToTry(
|
||||
[".ts", ".tsx"],
|
||||
abosolutePathMappings,
|
||||
"longest/pre/fix/requested-module"
|
||||
);
|
||||
// assert.deepEqual(result, [
|
||||
// // "longest/pre/fix/*"
|
||||
// { type: "file", path: join("/absolute", "base", "url", "foo2", "bar") },
|
||||
// {
|
||||
// type: "extension",
|
||||
// path: join("/absolute", "base", "url", "foo2", "bar.ts"),
|
||||
// },
|
||||
// {
|
||||
// type: "extension",
|
||||
// path: join("/absolute", "base", "url", "foo2", "bar.tsx"),
|
||||
// },
|
||||
// {
|
||||
// type: "package",
|
||||
// path: join("/absolute", "base", "url", "foo2", "bar", "package.json"),
|
||||
// },
|
||||
// {
|
||||
// type: "index",
|
||||
// path: join("/absolute", "base", "url", "foo2", "bar", "index.ts"),
|
||||
// },
|
||||
// {
|
||||
// type: "index",
|
||||
// path: join("/absolute", "base", "url", "foo2", "bar", "index.tsx"),
|
||||
// },
|
||||
// // "*"
|
||||
// { type: "file", path: join("/absolute", "base", "url", "foo1") },
|
||||
// { type: "extension", path: join("/absolute", "base", "url", "foo1.ts") },
|
||||
// { type: "extension", path: join("/absolute", "base", "url", "foo1.tsx") },
|
||||
// {
|
||||
// type: "package",
|
||||
// path: join("/absolute", "base", "url", "foo1", "package.json"),
|
||||
// },
|
||||
// {
|
||||
// type: "index",
|
||||
// path: join("/absolute", "base", "url", "foo1", "index.ts"),
|
||||
// },
|
||||
// {
|
||||
// type: "index",
|
||||
// path: join("/absolute", "base", "url", "foo1", "index.tsx"),
|
||||
// },
|
||||
// ]);
|
||||
expect(result).toEqual([
|
||||
// "longest/pre/fix/*"
|
||||
{ type: "file", path: join("/absolute", "base", "url", "foo2", "bar") },
|
||||
{
|
||||
type: "extension",
|
||||
path: join("/absolute", "base", "url", "foo2", "bar.ts"),
|
||||
},
|
||||
{
|
||||
type: "extension",
|
||||
path: join("/absolute", "base", "url", "foo2", "bar.tsx"),
|
||||
},
|
||||
{
|
||||
type: "package",
|
||||
path: join("/absolute", "base", "url", "foo2", "bar", "package.json"),
|
||||
},
|
||||
{
|
||||
type: "index",
|
||||
path: join("/absolute", "base", "url", "foo2", "bar", "index.ts"),
|
||||
},
|
||||
{
|
||||
type: "index",
|
||||
path: join("/absolute", "base", "url", "foo2", "bar", "index.tsx"),
|
||||
},
|
||||
// "*"
|
||||
{ type: "file", path: join("/absolute", "base", "url", "foo1") },
|
||||
{ type: "extension", path: join("/absolute", "base", "url", "foo1.ts") },
|
||||
{ type: "extension", path: join("/absolute", "base", "url", "foo1.tsx") },
|
||||
{
|
||||
type: "package",
|
||||
path: join("/absolute", "base", "url", "foo1", "package.json"),
|
||||
},
|
||||
{
|
||||
type: "index",
|
||||
path: join("/absolute", "base", "url", "foo1", "index.ts"),
|
||||
},
|
||||
{
|
||||
type: "index",
|
||||
path: join("/absolute", "base", "url", "foo1", "index.tsx"),
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("should resolve paths starting with a slash", () => {
|
||||
const result = getPathsToTry(
|
||||
[".ts"],
|
||||
abosolutePathMappingsStarstWithSlash,
|
||||
"/opt/utils"
|
||||
);
|
||||
expect(result).toEqual([
|
||||
// "opt/*"
|
||||
{
|
||||
path: join("/absolute", "src", "aws-layer"),
|
||||
type: "file",
|
||||
},
|
||||
{
|
||||
path: join("/absolute", "src", "aws-layer.ts"),
|
||||
type: "extension",
|
||||
},
|
||||
{
|
||||
path: join("/absolute", "src", "aws-layer", "package.json"),
|
||||
type: "package",
|
||||
},
|
||||
{
|
||||
path: join("/absolute", "src", "aws-layer", "index.ts"),
|
||||
type: "index",
|
||||
},
|
||||
// "*"
|
||||
{
|
||||
path: join("/absolute", "src"),
|
||||
type: "file",
|
||||
},
|
||||
{
|
||||
path: join("/absolute", "src.ts"),
|
||||
type: "extension",
|
||||
},
|
||||
{
|
||||
path: join("/absolute", "src", "package.json"),
|
||||
type: "package",
|
||||
},
|
||||
{
|
||||
path: join("/absolute", "src", "index.ts"),
|
||||
type: "index",
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
// describe("match-star", () => {
|
||||
// it("should match star in last position", () => {
|
||||
// const result = matchStar("lib/*", "lib/mylib");
|
||||
// assert.equal(result, "mylib");
|
||||
// });
|
||||
// it("should match star in first position", () => {
|
||||
// const result = matchStar("*/lib", "mylib/lib");
|
||||
// assert.equal(result, "mylib");
|
||||
// });
|
||||
// });
|
||||
416
install/config-ui/node_modules/tsconfig-paths/src/__tests__/tsconfig-loader.test.ts
generated
vendored
Normal file
416
install/config-ui/node_modules/tsconfig-paths/src/__tests__/tsconfig-loader.test.ts
generated
vendored
Normal file
@@ -0,0 +1,416 @@
|
||||
import {
|
||||
loadTsconfig,
|
||||
tsConfigLoader,
|
||||
walkForTsConfig,
|
||||
} from "../tsconfig-loader";
|
||||
import { join } from "path";
|
||||
|
||||
describe("tsconfig-loader", () => {
|
||||
it("should find tsconfig in cwd", () => {
|
||||
const result = tsConfigLoader({
|
||||
cwd: "/foo/bar",
|
||||
getEnv: (_: string) => undefined,
|
||||
loadSync: (cwd: string) => {
|
||||
return {
|
||||
tsConfigPath: `${cwd}/tsconfig.json`,
|
||||
baseUrl: "./",
|
||||
paths: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
// assert.equal(result.tsConfigPath, "/foo/bar/tsconfig.json");
|
||||
expect(result.tsConfigPath).toBe("/foo/bar/tsconfig.json");
|
||||
});
|
||||
|
||||
it("should return loaderResult.tsConfigPath as undefined when not found", () => {
|
||||
const result = tsConfigLoader({
|
||||
cwd: "/foo/bar",
|
||||
getEnv: (_: string) => undefined,
|
||||
loadSync: (_: string) => {
|
||||
return {
|
||||
tsConfigPath: undefined,
|
||||
baseUrl: "./",
|
||||
paths: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
// assert.isUndefined(result.tsConfigPath);
|
||||
expect(result.tsConfigPath).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should use TS_NODE_PROJECT env if exists", () => {
|
||||
const result = tsConfigLoader({
|
||||
cwd: "/foo/bar",
|
||||
getEnv: (key: string) =>
|
||||
key === "TS_NODE_PROJECT" ? "/foo/baz" : undefined,
|
||||
loadSync: (cwd: string, fileName: string) => {
|
||||
if (cwd === "/foo/bar" && fileName === "/foo/baz") {
|
||||
return {
|
||||
tsConfigPath: "/foo/baz/tsconfig.json",
|
||||
baseUrl: "./",
|
||||
paths: {},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
tsConfigPath: undefined,
|
||||
baseUrl: "./",
|
||||
paths: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
// assert.equal(result.tsConfigPath, "/foo/baz/tsconfig.json");
|
||||
expect(result.tsConfigPath).toBe("/foo/baz/tsconfig.json");
|
||||
});
|
||||
|
||||
it("should use TS_NODE_BASEURL env if exists", () => {
|
||||
const result = tsConfigLoader({
|
||||
cwd: "/foo/bar",
|
||||
getEnv: (key: string) =>
|
||||
key === "TS_NODE_BASEURL" ? "SOME_BASEURL" : undefined,
|
||||
loadSync: (_0: string, _1: string, baseUrl: string) => {
|
||||
return {
|
||||
tsConfigPath: undefined,
|
||||
baseUrl,
|
||||
paths: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
// assert.equal(result.baseUrl, "SOME_BASEURL");
|
||||
expect(result.baseUrl).toBe("SOME_BASEURL");
|
||||
});
|
||||
|
||||
it("should not use TS_NODE_BASEURL env if it does not exist", () => {
|
||||
const result = tsConfigLoader({
|
||||
cwd: "/foo/bar",
|
||||
getEnv: (_: string) => {
|
||||
return undefined;
|
||||
},
|
||||
loadSync: (_0: string, _1: string, baseUrl: string) => {
|
||||
return {
|
||||
tsConfigPath: undefined,
|
||||
baseUrl,
|
||||
paths: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
// assert.equal(result.baseUrl, undefined);
|
||||
expect(result.baseUrl).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("walkForTsConfig", () => {
|
||||
it("should find tsconfig in starting directory", () => {
|
||||
const pathToTsconfig = join("/root", "dir1", "tsconfig.json");
|
||||
const res = walkForTsConfig(
|
||||
join("/root", "dir1"),
|
||||
(path) => path === pathToTsconfig
|
||||
);
|
||||
// assert.equal(res, pathToTsconfig);
|
||||
expect(res).toBe(pathToTsconfig);
|
||||
});
|
||||
|
||||
it("should find tsconfig in parent directory", () => {
|
||||
const pathToTsconfig = join("/root", "tsconfig.json");
|
||||
const res = walkForTsConfig(
|
||||
join("/root", "dir1"),
|
||||
(path) => path === pathToTsconfig
|
||||
);
|
||||
// assert.equal(res, pathToTsconfig);
|
||||
expect(res).toBe(pathToTsconfig);
|
||||
});
|
||||
|
||||
it("should return undefined when reaching the top", () => {
|
||||
const res = walkForTsConfig(join("/root", "dir1", "kalle"), () => false);
|
||||
// assert.equal(res, undefined);
|
||||
expect(res).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("loadConfig", () => {
|
||||
it("should load a config", () => {
|
||||
const config = { compilerOptions: { baseUrl: "hej" } };
|
||||
const res = loadTsconfig(
|
||||
"/root/dir1/tsconfig.json",
|
||||
(path) => path === "/root/dir1/tsconfig.json",
|
||||
(_) => JSON.stringify(config)
|
||||
);
|
||||
// assert.deepEqual(res, config);
|
||||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
|
||||
it("should load a config with comments", () => {
|
||||
const config = { compilerOptions: { baseUrl: "hej" } };
|
||||
const res = loadTsconfig(
|
||||
"/root/dir1/tsconfig.json",
|
||||
(path) => path === "/root/dir1/tsconfig.json",
|
||||
(_) => `{
|
||||
// my comment
|
||||
"compilerOptions": {
|
||||
"baseUrl": "hej"
|
||||
}
|
||||
}`
|
||||
);
|
||||
// assert.deepEqual(res, config);
|
||||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
|
||||
it("should load a config with trailing commas", () => {
|
||||
const config = { compilerOptions: { baseUrl: "hej" } };
|
||||
const res = loadTsconfig(
|
||||
"/root/dir1/tsconfig.json",
|
||||
(path) => path === "/root/dir1/tsconfig.json",
|
||||
(_) => `{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "hej",
|
||||
},
|
||||
}`
|
||||
);
|
||||
// assert.deepEqual(res, config);
|
||||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
|
||||
it("should throw an error including the file path when encountering invalid JSON5", () => {
|
||||
expect(() =>
|
||||
loadTsconfig(
|
||||
"/root/dir1/tsconfig.json",
|
||||
(path) => path === "/root/dir1/tsconfig.json",
|
||||
(_) => `{
|
||||
"compilerOptions": {
|
||||
}`
|
||||
)
|
||||
).toThrowError(
|
||||
"/root/dir1/tsconfig.json is malformed JSON5: invalid end of input at 3:12"
|
||||
);
|
||||
});
|
||||
|
||||
it("should load a config with string extends and overwrite all options", () => {
|
||||
const firstConfig = {
|
||||
extends: "../base-config.json",
|
||||
compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } },
|
||||
};
|
||||
const firstConfigPath = join("/root", "dir1", "tsconfig.json");
|
||||
const baseConfig = {
|
||||
compilerOptions: {
|
||||
baseUrl: "olle",
|
||||
paths: { foo: ["bar1"] },
|
||||
strict: true,
|
||||
},
|
||||
};
|
||||
const baseConfigPath = join("/root", "base-config.json");
|
||||
const res = loadTsconfig(
|
||||
join("/root", "dir1", "tsconfig.json"),
|
||||
(path) => path === firstConfigPath || path === baseConfigPath,
|
||||
(path) => {
|
||||
if (path === firstConfigPath) {
|
||||
return JSON.stringify(firstConfig);
|
||||
}
|
||||
if (path === baseConfigPath) {
|
||||
return JSON.stringify(baseConfig);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
);
|
||||
|
||||
// assert.deepEqual(res, {
|
||||
// extends: "../base-config.json",
|
||||
// compilerOptions: {
|
||||
// baseUrl: "kalle",
|
||||
// paths: { foo: ["bar2"] },
|
||||
// strict: true,
|
||||
// },
|
||||
// });
|
||||
expect(res).toEqual({
|
||||
extends: "../base-config.json",
|
||||
compilerOptions: {
|
||||
baseUrl: "kalle",
|
||||
paths: { foo: ["bar2"] },
|
||||
strict: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should load a config with string extends from node_modules and overwrite all options", () => {
|
||||
const firstConfig = {
|
||||
extends: "my-package/base-config.json",
|
||||
compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } },
|
||||
};
|
||||
const firstConfigPath = join("/root", "dir1", "tsconfig.json");
|
||||
const baseConfig = {
|
||||
compilerOptions: {
|
||||
baseUrl: "olle",
|
||||
paths: { foo: ["bar1"] },
|
||||
strict: true,
|
||||
},
|
||||
};
|
||||
const baseConfigPath = join(
|
||||
"/root",
|
||||
"dir1",
|
||||
"node_modules",
|
||||
"my-package",
|
||||
"base-config.json"
|
||||
);
|
||||
const res = loadTsconfig(
|
||||
join("/root", "dir1", "tsconfig.json"),
|
||||
(path) => path === firstConfigPath || path === baseConfigPath,
|
||||
(path) => {
|
||||
if (path === firstConfigPath) {
|
||||
return JSON.stringify(firstConfig);
|
||||
}
|
||||
if (path === baseConfigPath) {
|
||||
return JSON.stringify(baseConfig);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
);
|
||||
|
||||
// assert.deepEqual(res, {
|
||||
// extends: "my-package/base-config.json",
|
||||
// compilerOptions: {
|
||||
// baseUrl: "kalle",
|
||||
// paths: { foo: ["bar2"] },
|
||||
// strict: true,
|
||||
// },
|
||||
// });
|
||||
expect(res).toEqual({
|
||||
extends: "my-package/base-config.json",
|
||||
compilerOptions: {
|
||||
baseUrl: "kalle",
|
||||
paths: { foo: ["bar2"] },
|
||||
strict: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should use baseUrl relative to location of extended tsconfig", () => {
|
||||
const firstConfig = { compilerOptions: { baseUrl: "." } };
|
||||
const firstConfigPath = join("/root", "first-config.json");
|
||||
const secondConfig = { extends: "../first-config.json" };
|
||||
const secondConfigPath = join("/root", "dir1", "second-config.json");
|
||||
const thirdConfig = { extends: "../second-config.json" };
|
||||
const thirdConfigPath = join("/root", "dir1", "dir2", "third-config.json");
|
||||
const res = loadTsconfig(
|
||||
join("/root", "dir1", "dir2", "third-config.json"),
|
||||
(path) =>
|
||||
path === firstConfigPath ||
|
||||
path === secondConfigPath ||
|
||||
path === thirdConfigPath,
|
||||
(path) => {
|
||||
if (path === firstConfigPath) {
|
||||
return JSON.stringify(firstConfig);
|
||||
}
|
||||
if (path === secondConfigPath) {
|
||||
return JSON.stringify(secondConfig);
|
||||
}
|
||||
if (path === thirdConfigPath) {
|
||||
return JSON.stringify(thirdConfig);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
);
|
||||
|
||||
// assert.deepEqual(res, {
|
||||
// extends: "../second-config.json",
|
||||
// compilerOptions: { baseUrl: join("..", "..") },
|
||||
// });
|
||||
expect(res).toEqual({
|
||||
extends: "../second-config.json",
|
||||
compilerOptions: { baseUrl: join("..", "..") },
|
||||
});
|
||||
});
|
||||
|
||||
it("should load a config with array extends and overwrite all options", () => {
|
||||
const baseConfig1 = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar"] } },
|
||||
};
|
||||
const baseConfig1Path = join("/root", "base-config-1.json");
|
||||
const baseConfig2 = { compilerOptions: { baseUrl: "." } };
|
||||
const baseConfig2Path = join("/root", "dir1", "base-config-2.json");
|
||||
const baseConfig3 = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar2"] } },
|
||||
};
|
||||
const baseConfig3Path = join("/root", "dir1", "dir2", "base-config-3.json");
|
||||
const actualConfig = {
|
||||
extends: [
|
||||
"./base-config-1.json",
|
||||
"./dir1/base-config-2.json",
|
||||
"./dir1/dir2/base-config-3.json",
|
||||
],
|
||||
};
|
||||
const actualConfigPath = join("/root", "tsconfig.json");
|
||||
|
||||
const res = loadTsconfig(
|
||||
join("/root", "tsconfig.json"),
|
||||
(path) =>
|
||||
[
|
||||
baseConfig1Path,
|
||||
baseConfig2Path,
|
||||
baseConfig3Path,
|
||||
actualConfigPath,
|
||||
].indexOf(path) >= 0,
|
||||
(path) => {
|
||||
if (path === baseConfig1Path) {
|
||||
return JSON.stringify(baseConfig1);
|
||||
}
|
||||
if (path === baseConfig2Path) {
|
||||
return JSON.stringify(baseConfig2);
|
||||
}
|
||||
if (path === baseConfig3Path) {
|
||||
return JSON.stringify(baseConfig3);
|
||||
}
|
||||
if (path === actualConfigPath) {
|
||||
return JSON.stringify(actualConfig);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
);
|
||||
|
||||
expect(res).toEqual({
|
||||
extends: [
|
||||
"./base-config-1.json",
|
||||
"./dir1/base-config-2.json",
|
||||
"./dir1/dir2/base-config-3.json",
|
||||
],
|
||||
compilerOptions: {
|
||||
baseUrl: join("dir1", "dir2"),
|
||||
paths: { foo: ["bar2"] },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should load a config with array extends without .json extension", () => {
|
||||
const baseConfig = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar"] } },
|
||||
};
|
||||
const baseConfigPath = join("/root", "base-config-1.json");
|
||||
const actualConfig = { extends: ["./base-config-1"] };
|
||||
const actualConfigPath = join("/root", "tsconfig.json");
|
||||
|
||||
const res = loadTsconfig(
|
||||
join("/root", "tsconfig.json"),
|
||||
(path) => [baseConfigPath, actualConfigPath].indexOf(path) >= 0,
|
||||
(path) => {
|
||||
if (path === baseConfigPath) {
|
||||
return JSON.stringify(baseConfig);
|
||||
}
|
||||
if (path === actualConfigPath) {
|
||||
return JSON.stringify(actualConfig);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
);
|
||||
|
||||
expect(res).toEqual({
|
||||
extends: ["./base-config-1"],
|
||||
compilerOptions: {
|
||||
baseUrl: ".",
|
||||
paths: { foo: ["bar"] },
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
10
install/config-ui/node_modules/tsconfig-paths/src/__tests__/tsconfig-named.json
generated
vendored
Normal file
10
install/config-ui/node_modules/tsconfig-paths/src/__tests__/tsconfig-named.json
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../base-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"sourceMap": true,
|
||||
"outDir": "./js_out"
|
||||
}
|
||||
}
|
||||
97
install/config-ui/node_modules/tsconfig-paths/src/config-loader.ts
generated
vendored
Normal file
97
install/config-ui/node_modules/tsconfig-paths/src/config-loader.ts
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
import * as TsConfigLoader2 from "./tsconfig-loader";
|
||||
import * as path from "path";
|
||||
import { options } from "./options";
|
||||
|
||||
export interface ExplicitParams {
|
||||
baseUrl: string;
|
||||
paths: { [key: string]: Array<string> };
|
||||
mainFields?: Array<string>;
|
||||
addMatchAll?: boolean;
|
||||
}
|
||||
|
||||
export type TsConfigLoader = (
|
||||
params: TsConfigLoader2.TsConfigLoaderParams
|
||||
) => TsConfigLoader2.TsConfigLoaderResult;
|
||||
|
||||
export interface ConfigLoaderParams {
|
||||
cwd: string;
|
||||
explicitParams?: ExplicitParams;
|
||||
tsConfigLoader?: TsConfigLoader;
|
||||
}
|
||||
|
||||
export interface ConfigLoaderSuccessResult {
|
||||
resultType: "success";
|
||||
configFileAbsolutePath: string;
|
||||
baseUrl: string;
|
||||
absoluteBaseUrl: string;
|
||||
paths: { [key: string]: Array<string> };
|
||||
mainFields?: Array<string>;
|
||||
addMatchAll?: boolean;
|
||||
}
|
||||
|
||||
export interface ConfigLoaderFailResult {
|
||||
resultType: "failed";
|
||||
message: string;
|
||||
}
|
||||
|
||||
export type ConfigLoaderResult =
|
||||
| ConfigLoaderSuccessResult
|
||||
| ConfigLoaderFailResult;
|
||||
|
||||
export function loadConfig(cwd: string = options.cwd): ConfigLoaderResult {
|
||||
return configLoader({ cwd: cwd });
|
||||
}
|
||||
|
||||
export function configLoader({
|
||||
cwd,
|
||||
explicitParams,
|
||||
tsConfigLoader = TsConfigLoader2.tsConfigLoader,
|
||||
}: ConfigLoaderParams): ConfigLoaderResult {
|
||||
if (explicitParams) {
|
||||
// tslint:disable-next-line:no-shadowed-variable
|
||||
const absoluteBaseUrl = path.isAbsolute(explicitParams.baseUrl)
|
||||
? explicitParams.baseUrl
|
||||
: path.join(cwd, explicitParams.baseUrl);
|
||||
|
||||
return {
|
||||
resultType: "success",
|
||||
configFileAbsolutePath: "",
|
||||
baseUrl: explicitParams.baseUrl,
|
||||
absoluteBaseUrl,
|
||||
paths: explicitParams.paths,
|
||||
mainFields: explicitParams.mainFields,
|
||||
addMatchAll: explicitParams.addMatchAll,
|
||||
};
|
||||
}
|
||||
|
||||
// Load tsconfig and create path matching function
|
||||
const loadResult = tsConfigLoader({
|
||||
cwd,
|
||||
getEnv: (key: string) => process.env[key],
|
||||
});
|
||||
|
||||
if (!loadResult.tsConfigPath) {
|
||||
return {
|
||||
resultType: "failed",
|
||||
message: "Couldn't find tsconfig.json",
|
||||
};
|
||||
}
|
||||
|
||||
if (!loadResult.baseUrl) {
|
||||
return {
|
||||
resultType: "failed",
|
||||
message: "Missing baseUrl in compilerOptions",
|
||||
};
|
||||
}
|
||||
|
||||
const tsConfigDir = path.dirname(loadResult.tsConfigPath);
|
||||
const absoluteBaseUrl = path.join(tsConfigDir, loadResult.baseUrl);
|
||||
|
||||
return {
|
||||
resultType: "success",
|
||||
configFileAbsolutePath: loadResult.tsConfigPath,
|
||||
baseUrl: loadResult.baseUrl,
|
||||
absoluteBaseUrl,
|
||||
paths: loadResult.paths || {},
|
||||
};
|
||||
}
|
||||
87
install/config-ui/node_modules/tsconfig-paths/src/filesystem.ts
generated
vendored
Normal file
87
install/config-ui/node_modules/tsconfig-paths/src/filesystem.ts
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
import * as fs from "fs";
|
||||
|
||||
/**
|
||||
* Typing for the fields of package.json we care about
|
||||
*/
|
||||
export interface PackageJson {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that json from a file
|
||||
*/
|
||||
export interface ReadJsonSync {
|
||||
// tslint:disable-next-line:no-any
|
||||
(packageJsonPath: string): any | undefined;
|
||||
}
|
||||
|
||||
export interface FileExistsSync {
|
||||
(name: string): boolean;
|
||||
}
|
||||
|
||||
export interface FileExistsAsync {
|
||||
(path: string, callback: (err?: Error, exists?: boolean) => void): void;
|
||||
}
|
||||
|
||||
export interface ReadJsonAsyncCallback {
|
||||
// tslint:disable-next-line:no-any
|
||||
(err?: Error, content?: any): void;
|
||||
}
|
||||
|
||||
export interface ReadJsonAsync {
|
||||
(path: string, callback: ReadJsonAsyncCallback): void;
|
||||
}
|
||||
|
||||
export function fileExistsSync(path: string): boolean {
|
||||
try {
|
||||
const stats = fs.statSync(path);
|
||||
return stats.isFile();
|
||||
} catch (err) {
|
||||
// If error, assume file did not exist
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads package.json from disk
|
||||
* @param file Path to package.json
|
||||
*/
|
||||
// tslint:disable-next-line:no-any
|
||||
export function readJsonFromDiskSync(packageJsonPath: string): any | undefined {
|
||||
if (!fs.existsSync(packageJsonPath)) {
|
||||
return undefined;
|
||||
}
|
||||
return require(packageJsonPath);
|
||||
}
|
||||
|
||||
export function readJsonFromDiskAsync(
|
||||
path: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
callback: (err?: Error, content?: any) => void
|
||||
): void {
|
||||
fs.readFile(path, "utf8", (err, result) => {
|
||||
// If error, assume file did not exist
|
||||
if (err || !result) {
|
||||
return callback();
|
||||
}
|
||||
const json = JSON.parse(result);
|
||||
return callback(undefined, json);
|
||||
});
|
||||
}
|
||||
|
||||
export function fileExistsAsync(
|
||||
path2: string,
|
||||
callback2: (err?: Error, exists?: boolean) => void
|
||||
): void {
|
||||
fs.stat(path2, (err: Error, stats: fs.Stats) => {
|
||||
if (err) {
|
||||
// If error assume file does not exist
|
||||
return callback2(undefined, false);
|
||||
}
|
||||
callback2(undefined, stats ? stats.isFile() : false);
|
||||
});
|
||||
}
|
||||
|
||||
export function removeExtension(path: string): string {
|
||||
return path.substring(0, path.lastIndexOf(".")) || path;
|
||||
}
|
||||
24
install/config-ui/node_modules/tsconfig-paths/src/index.ts
generated
vendored
Normal file
24
install/config-ui/node_modules/tsconfig-paths/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// register is used from register.js in root dir
|
||||
export {
|
||||
createMatchPath,
|
||||
matchFromAbsolutePaths,
|
||||
MatchPath,
|
||||
} from "./match-path-sync";
|
||||
export {
|
||||
createMatchPathAsync,
|
||||
matchFromAbsolutePathsAsync,
|
||||
MatchPathAsync,
|
||||
} from "./match-path-async";
|
||||
export { register } from "./register";
|
||||
export {
|
||||
loadConfig,
|
||||
ConfigLoaderResult,
|
||||
ConfigLoaderSuccessResult,
|
||||
ConfigLoaderFailResult,
|
||||
} from "./config-loader";
|
||||
export {
|
||||
ReadJsonSync,
|
||||
ReadJsonAsync,
|
||||
FileExistsSync,
|
||||
FileExistsAsync,
|
||||
} from "./filesystem";
|
||||
64
install/config-ui/node_modules/tsconfig-paths/src/mapping-entry.ts
generated
vendored
Normal file
64
install/config-ui/node_modules/tsconfig-paths/src/mapping-entry.ts
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
import * as path from "path";
|
||||
|
||||
export interface MappingEntry {
|
||||
readonly pattern: string;
|
||||
readonly paths: ReadonlyArray<string>;
|
||||
}
|
||||
|
||||
export interface Paths {
|
||||
readonly [key: string]: ReadonlyArray<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an absolute baseUrl and paths to an array of absolute mapping entries.
|
||||
* The array is sorted by longest prefix.
|
||||
* Having an array with entries allows us to keep a sorting order rather than
|
||||
* sort by keys each time we use the mappings.
|
||||
* @param absoluteBaseUrl
|
||||
* @param paths
|
||||
* @param addMatchAll
|
||||
*/
|
||||
export function getAbsoluteMappingEntries(
|
||||
absoluteBaseUrl: string,
|
||||
paths: Paths,
|
||||
addMatchAll: boolean
|
||||
): ReadonlyArray<MappingEntry> {
|
||||
// Resolve all paths to absolute form once here, and sort them by
|
||||
// longest prefix once here, this saves time on each request later.
|
||||
// We need to put them in an array to preserve the sorting order.
|
||||
const sortedKeys = sortByLongestPrefix(Object.keys(paths));
|
||||
const absolutePaths: Array<MappingEntry> = [];
|
||||
for (const key of sortedKeys) {
|
||||
absolutePaths.push({
|
||||
pattern: key,
|
||||
paths: paths[key].map((pathToResolve) =>
|
||||
path.join(absoluteBaseUrl, pathToResolve)
|
||||
),
|
||||
});
|
||||
}
|
||||
// If there is no match-all path specified in the paths section of tsconfig, then try to match
|
||||
// all paths relative to baseUrl, this is how typescript works.
|
||||
if (!paths["*"] && addMatchAll) {
|
||||
absolutePaths.push({
|
||||
pattern: "*",
|
||||
paths: [`${absoluteBaseUrl.replace(/\/$/, "")}/*`],
|
||||
});
|
||||
}
|
||||
|
||||
return absolutePaths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort path patterns.
|
||||
* If a module name can be matched with multiple patterns then pattern with the longest prefix will be picked.
|
||||
*/
|
||||
function sortByLongestPrefix(arr: Array<string>): Array<string> {
|
||||
return arr
|
||||
.concat()
|
||||
.sort((a: string, b: string) => getPrefixLength(b) - getPrefixLength(a));
|
||||
}
|
||||
|
||||
function getPrefixLength(pattern: string): number {
|
||||
const prefixLength = pattern.indexOf("*");
|
||||
return pattern.substr(0, prefixLength).length;
|
||||
}
|
||||
218
install/config-ui/node_modules/tsconfig-paths/src/match-path-async.ts
generated
vendored
Normal file
218
install/config-ui/node_modules/tsconfig-paths/src/match-path-async.ts
generated
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
import * as path from "path";
|
||||
import * as TryPath from "./try-path";
|
||||
import * as MappingEntry from "./mapping-entry";
|
||||
import * as Filesystem from "./filesystem";
|
||||
|
||||
/**
|
||||
* Function that can match a path async
|
||||
*/
|
||||
export interface MatchPathAsync {
|
||||
(
|
||||
requestedModule: string,
|
||||
readJson: Filesystem.ReadJsonAsync | undefined,
|
||||
fileExists: Filesystem.FileExistsAsync | undefined,
|
||||
extensions: ReadonlyArray<string> | undefined,
|
||||
callback: MatchPathAsyncCallback
|
||||
): void;
|
||||
}
|
||||
|
||||
export interface MatchPathAsyncCallback {
|
||||
(err?: Error, path?: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* See the sync version for docs.
|
||||
*/
|
||||
export function createMatchPathAsync(
|
||||
absoluteBaseUrl: string,
|
||||
paths: { [key: string]: Array<string> },
|
||||
mainFields: string[] = ["main"],
|
||||
addMatchAll: boolean = true
|
||||
): MatchPathAsync {
|
||||
const absolutePaths = MappingEntry.getAbsoluteMappingEntries(
|
||||
absoluteBaseUrl,
|
||||
paths,
|
||||
addMatchAll
|
||||
);
|
||||
|
||||
return (
|
||||
requestedModule: string,
|
||||
readJson: Filesystem.ReadJsonAsync | undefined,
|
||||
fileExists: Filesystem.FileExistsAsync | undefined,
|
||||
extensions: ReadonlyArray<string> | undefined,
|
||||
callback: MatchPathAsyncCallback
|
||||
) =>
|
||||
matchFromAbsolutePathsAsync(
|
||||
absolutePaths,
|
||||
requestedModule,
|
||||
readJson,
|
||||
fileExists,
|
||||
extensions,
|
||||
callback,
|
||||
mainFields
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* See the sync version for docs.
|
||||
*/
|
||||
export function matchFromAbsolutePathsAsync(
|
||||
absolutePathMappings: ReadonlyArray<MappingEntry.MappingEntry>,
|
||||
requestedModule: string,
|
||||
readJson: Filesystem.ReadJsonAsync = Filesystem.readJsonFromDiskAsync,
|
||||
fileExists: Filesystem.FileExistsAsync = Filesystem.fileExistsAsync,
|
||||
extensions: ReadonlyArray<string> = Object.keys(require.extensions),
|
||||
callback: MatchPathAsyncCallback,
|
||||
mainFields: string[] = ["main"]
|
||||
): void {
|
||||
const tryPaths = TryPath.getPathsToTry(
|
||||
extensions,
|
||||
absolutePathMappings,
|
||||
requestedModule
|
||||
);
|
||||
|
||||
if (!tryPaths) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
findFirstExistingPath(
|
||||
tryPaths,
|
||||
readJson,
|
||||
fileExists,
|
||||
callback,
|
||||
0,
|
||||
mainFields
|
||||
);
|
||||
}
|
||||
|
||||
function findFirstExistingMainFieldMappedFile(
|
||||
packageJson: Filesystem.PackageJson,
|
||||
mainFields: string[],
|
||||
packageJsonPath: string,
|
||||
fileExistsAsync: Filesystem.FileExistsAsync,
|
||||
doneCallback: (err?: Error, filepath?: string) => void,
|
||||
index: number = 0
|
||||
): void {
|
||||
if (index >= mainFields.length) {
|
||||
return doneCallback(undefined, undefined);
|
||||
}
|
||||
|
||||
const tryNext = () =>
|
||||
findFirstExistingMainFieldMappedFile(
|
||||
packageJson,
|
||||
mainFields,
|
||||
packageJsonPath,
|
||||
fileExistsAsync,
|
||||
doneCallback,
|
||||
index + 1
|
||||
);
|
||||
|
||||
const mainFieldMapping = packageJson[mainFields[index]];
|
||||
if (typeof mainFieldMapping !== "string") {
|
||||
// Skip mappings that are not pointers to replacement files
|
||||
return tryNext();
|
||||
}
|
||||
|
||||
const mappedFilePath = path.join(
|
||||
path.dirname(packageJsonPath),
|
||||
mainFieldMapping
|
||||
);
|
||||
fileExistsAsync(mappedFilePath, (err?: Error, exists?: boolean) => {
|
||||
if (err) {
|
||||
return doneCallback(err);
|
||||
}
|
||||
if (exists) {
|
||||
return doneCallback(undefined, mappedFilePath);
|
||||
}
|
||||
return tryNext();
|
||||
});
|
||||
}
|
||||
|
||||
// Recursive loop to probe for physical files
|
||||
function findFirstExistingPath(
|
||||
tryPaths: ReadonlyArray<TryPath.TryPath>,
|
||||
readJson: Filesystem.ReadJsonAsync,
|
||||
fileExists: Filesystem.FileExistsAsync,
|
||||
doneCallback: MatchPathAsyncCallback,
|
||||
index: number = 0,
|
||||
mainFields: string[] = ["main"]
|
||||
): void {
|
||||
const tryPath = tryPaths[index];
|
||||
if (
|
||||
tryPath.type === "file" ||
|
||||
tryPath.type === "extension" ||
|
||||
tryPath.type === "index"
|
||||
) {
|
||||
fileExists(tryPath.path, (err: Error, exists: boolean) => {
|
||||
if (err) {
|
||||
return doneCallback(err);
|
||||
}
|
||||
if (exists) {
|
||||
return doneCallback(undefined, TryPath.getStrippedPath(tryPath));
|
||||
}
|
||||
if (index === tryPaths.length - 1) {
|
||||
return doneCallback();
|
||||
}
|
||||
// Continue with the next path
|
||||
return findFirstExistingPath(
|
||||
tryPaths,
|
||||
readJson,
|
||||
fileExists,
|
||||
doneCallback,
|
||||
index + 1,
|
||||
mainFields
|
||||
);
|
||||
});
|
||||
} else if (tryPath.type === "package") {
|
||||
readJson(tryPath.path, (err, packageJson) => {
|
||||
if (err) {
|
||||
return doneCallback(err);
|
||||
}
|
||||
if (packageJson) {
|
||||
return findFirstExistingMainFieldMappedFile(
|
||||
packageJson,
|
||||
mainFields,
|
||||
tryPath.path,
|
||||
fileExists,
|
||||
(mainFieldErr?: Error, mainFieldMappedFile?: string) => {
|
||||
if (mainFieldErr) {
|
||||
return doneCallback(mainFieldErr);
|
||||
}
|
||||
if (mainFieldMappedFile) {
|
||||
return doneCallback(undefined, mainFieldMappedFile);
|
||||
}
|
||||
|
||||
// No field in package json was a valid option. Continue with the next path.
|
||||
return findFirstExistingPath(
|
||||
tryPaths,
|
||||
readJson,
|
||||
fileExists,
|
||||
doneCallback,
|
||||
index + 1,
|
||||
mainFields
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// This is async code, we need to return unconditionally, otherwise the code still falls
|
||||
// through and keeps recursing. While this might work in general, libraries that use neo-async
|
||||
// like Webpack will actually not allow you to call the same callback twice.
|
||||
//
|
||||
// An example of where this caused issues:
|
||||
// https://github.com/dividab/tsconfig-paths-webpack-plugin/issues/11
|
||||
//
|
||||
// Continue with the next path
|
||||
return findFirstExistingPath(
|
||||
tryPaths,
|
||||
readJson,
|
||||
fileExists,
|
||||
doneCallback,
|
||||
index + 1,
|
||||
mainFields
|
||||
);
|
||||
});
|
||||
} else {
|
||||
TryPath.exhaustiveTypeException(tryPath.type);
|
||||
}
|
||||
}
|
||||
141
install/config-ui/node_modules/tsconfig-paths/src/match-path-sync.ts
generated
vendored
Normal file
141
install/config-ui/node_modules/tsconfig-paths/src/match-path-sync.ts
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
import * as path from "path";
|
||||
import * as Filesystem from "./filesystem";
|
||||
import * as MappingEntry from "./mapping-entry";
|
||||
import * as TryPath from "./try-path";
|
||||
|
||||
/**
|
||||
* Function that can match a path
|
||||
*/
|
||||
export interface MatchPath {
|
||||
(
|
||||
requestedModule: string,
|
||||
readJson?: Filesystem.ReadJsonSync,
|
||||
fileExists?: (name: string) => boolean,
|
||||
extensions?: ReadonlyArray<string>
|
||||
): string | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a function that can resolve paths according to tsconfig paths property.
|
||||
* @param absoluteBaseUrl Absolute version of baseUrl as specified in tsconfig.
|
||||
* @param paths The paths as specified in tsconfig.
|
||||
* @param mainFields A list of package.json field names to try when resolving module files.
|
||||
* @param addMatchAll Add a match-all "*" rule if none is present
|
||||
* @returns a function that can resolve paths.
|
||||
*/
|
||||
export function createMatchPath(
|
||||
absoluteBaseUrl: string,
|
||||
paths: { [key: string]: Array<string> },
|
||||
mainFields: string[] = ["main"],
|
||||
addMatchAll: boolean = true
|
||||
): MatchPath {
|
||||
const absolutePaths = MappingEntry.getAbsoluteMappingEntries(
|
||||
absoluteBaseUrl,
|
||||
paths,
|
||||
addMatchAll
|
||||
);
|
||||
|
||||
return (
|
||||
requestedModule: string,
|
||||
readJson?: Filesystem.ReadJsonSync,
|
||||
fileExists?: Filesystem.FileExistsSync,
|
||||
extensions?: Array<string>
|
||||
) =>
|
||||
matchFromAbsolutePaths(
|
||||
absolutePaths,
|
||||
requestedModule,
|
||||
readJson,
|
||||
fileExists,
|
||||
extensions,
|
||||
mainFields
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a path from tsconfig that matches a module load request.
|
||||
* @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 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.
|
||||
*/
|
||||
export function matchFromAbsolutePaths(
|
||||
absolutePathMappings: ReadonlyArray<MappingEntry.MappingEntry>,
|
||||
requestedModule: string,
|
||||
readJson: Filesystem.ReadJsonSync = Filesystem.readJsonFromDiskSync,
|
||||
fileExists: Filesystem.FileExistsSync = Filesystem.fileExistsSync,
|
||||
extensions: Array<string> = Object.keys(require.extensions),
|
||||
mainFields: string[] = ["main"]
|
||||
): string | undefined {
|
||||
const tryPaths = TryPath.getPathsToTry(
|
||||
extensions,
|
||||
absolutePathMappings,
|
||||
requestedModule
|
||||
);
|
||||
|
||||
if (!tryPaths) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return findFirstExistingPath(tryPaths, readJson, fileExists, mainFields);
|
||||
}
|
||||
|
||||
function findFirstExistingMainFieldMappedFile(
|
||||
packageJson: Filesystem.PackageJson,
|
||||
mainFields: string[],
|
||||
packageJsonPath: string,
|
||||
fileExists: Filesystem.FileExistsSync
|
||||
): string | undefined {
|
||||
for (let index = 0; index < mainFields.length; index++) {
|
||||
const mainFieldName = mainFields[index];
|
||||
const candidateMapping = packageJson[mainFieldName];
|
||||
if (candidateMapping && typeof candidateMapping === "string") {
|
||||
const candidateFilePath = path.join(
|
||||
path.dirname(packageJsonPath),
|
||||
candidateMapping
|
||||
);
|
||||
if (fileExists(candidateFilePath)) {
|
||||
return candidateFilePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function findFirstExistingPath(
|
||||
tryPaths: ReadonlyArray<TryPath.TryPath>,
|
||||
readJson: Filesystem.ReadJsonSync = Filesystem.readJsonFromDiskSync,
|
||||
fileExists: Filesystem.FileExistsSync,
|
||||
mainFields: string[] = ["main"]
|
||||
): string | undefined {
|
||||
for (const tryPath of tryPaths) {
|
||||
if (
|
||||
tryPath.type === "file" ||
|
||||
tryPath.type === "extension" ||
|
||||
tryPath.type === "index"
|
||||
) {
|
||||
if (fileExists(tryPath.path)) {
|
||||
return TryPath.getStrippedPath(tryPath);
|
||||
}
|
||||
} else if (tryPath.type === "package") {
|
||||
const packageJson: Filesystem.PackageJson = readJson(tryPath.path);
|
||||
if (packageJson) {
|
||||
const mainFieldMappedFile = findFirstExistingMainFieldMappedFile(
|
||||
packageJson,
|
||||
mainFields,
|
||||
tryPath.path,
|
||||
fileExists
|
||||
);
|
||||
if (mainFieldMappedFile) {
|
||||
return mainFieldMappedFile;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TryPath.exhaustiveTypeException(tryPath.type);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
18
install/config-ui/node_modules/tsconfig-paths/src/options.ts
generated
vendored
Normal file
18
install/config-ui/node_modules/tsconfig-paths/src/options.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import * as minimist from "minimist";
|
||||
|
||||
const argv = minimist(process.argv.slice(2), {
|
||||
string: ["project"],
|
||||
alias: {
|
||||
project: ["P"],
|
||||
},
|
||||
});
|
||||
|
||||
const project = argv && argv.project;
|
||||
|
||||
export interface Options {
|
||||
cwd: string;
|
||||
}
|
||||
|
||||
export const options: Options = {
|
||||
cwd: project || process.cwd(),
|
||||
};
|
||||
97
install/config-ui/node_modules/tsconfig-paths/src/register.ts
generated
vendored
Normal file
97
install/config-ui/node_modules/tsconfig-paths/src/register.ts
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
import { createMatchPath } from "./match-path-sync";
|
||||
import { configLoader, ExplicitParams } from "./config-loader";
|
||||
import { options } from "./options";
|
||||
|
||||
const noOp = (): void => void 0;
|
||||
|
||||
function getCoreModules(
|
||||
builtinModules: string[] | undefined
|
||||
): { [key: string]: boolean } {
|
||||
builtinModules = builtinModules || [
|
||||
"assert",
|
||||
"buffer",
|
||||
"child_process",
|
||||
"cluster",
|
||||
"crypto",
|
||||
"dgram",
|
||||
"dns",
|
||||
"domain",
|
||||
"events",
|
||||
"fs",
|
||||
"http",
|
||||
"https",
|
||||
"net",
|
||||
"os",
|
||||
"path",
|
||||
"punycode",
|
||||
"querystring",
|
||||
"readline",
|
||||
"stream",
|
||||
"string_decoder",
|
||||
"tls",
|
||||
"tty",
|
||||
"url",
|
||||
"util",
|
||||
"v8",
|
||||
"vm",
|
||||
"zlib",
|
||||
];
|
||||
|
||||
const coreModules: { [key: string]: boolean } = {};
|
||||
for (let module of builtinModules) {
|
||||
coreModules[module] = true;
|
||||
}
|
||||
|
||||
return coreModules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs a custom module load function that can adhere to paths in tsconfig.
|
||||
* Returns a function to undo paths registration.
|
||||
*/
|
||||
export function register(explicitParams: ExplicitParams): () => void {
|
||||
const configLoaderResult = configLoader({
|
||||
cwd: options.cwd,
|
||||
explicitParams,
|
||||
});
|
||||
|
||||
if (configLoaderResult.resultType === "failed") {
|
||||
console.warn(
|
||||
`${configLoaderResult.message}. tsconfig-paths will be skipped`
|
||||
);
|
||||
|
||||
return noOp;
|
||||
}
|
||||
|
||||
const matchPath = createMatchPath(
|
||||
configLoaderResult.absoluteBaseUrl,
|
||||
configLoaderResult.paths,
|
||||
configLoaderResult.mainFields,
|
||||
configLoaderResult.addMatchAll
|
||||
);
|
||||
|
||||
// Patch node's module loading
|
||||
// tslint:disable-next-line:no-require-imports variable-name
|
||||
const Module = require("module");
|
||||
const originalResolveFilename = Module._resolveFilename;
|
||||
const coreModules = getCoreModules(Module.builtinModules);
|
||||
// tslint:disable-next-line:no-any
|
||||
Module._resolveFilename = function (request: string, _parent: any): string {
|
||||
const isCoreModule = coreModules.hasOwnProperty(request);
|
||||
if (!isCoreModule) {
|
||||
const found = matchPath(request);
|
||||
if (found) {
|
||||
const modifiedArguments = [found, ...[].slice.call(arguments, 1)]; // Passes all arguments. Even those that is not specified above.
|
||||
// tslint:disable-next-line:no-invalid-this
|
||||
return originalResolveFilename.apply(this, modifiedArguments);
|
||||
}
|
||||
}
|
||||
// tslint:disable-next-line:no-invalid-this
|
||||
return originalResolveFilename.apply(this, arguments);
|
||||
};
|
||||
|
||||
return () => {
|
||||
// Return node's module loading to original state.
|
||||
Module._resolveFilename = originalResolveFilename;
|
||||
};
|
||||
}
|
||||
102
install/config-ui/node_modules/tsconfig-paths/src/try-path.ts
generated
vendored
Normal file
102
install/config-ui/node_modules/tsconfig-paths/src/try-path.ts
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
import * as path from "path";
|
||||
import { MappingEntry } from "./mapping-entry";
|
||||
import { dirname } from "path";
|
||||
import { removeExtension } from "./filesystem";
|
||||
|
||||
export interface TryPath {
|
||||
readonly type: "file" | "extension" | "index" | "package";
|
||||
readonly path: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a list of all physical paths to try by:
|
||||
* 1. Check for file named exactly as request.
|
||||
* 2. Check for files named as request ending in any of the extensions.
|
||||
* 3. Check for file specified in package.json's main property.
|
||||
* 4. Check for files named as request ending in "index" with any of the extensions.
|
||||
*/
|
||||
export function getPathsToTry(
|
||||
extensions: ReadonlyArray<string>,
|
||||
absolutePathMappings: ReadonlyArray<MappingEntry>,
|
||||
requestedModule: string
|
||||
): ReadonlyArray<TryPath> | undefined {
|
||||
if (!absolutePathMappings || !requestedModule || requestedModule[0] === ".") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const pathsToTry: Array<TryPath> = [];
|
||||
for (const entry of absolutePathMappings) {
|
||||
const starMatch =
|
||||
entry.pattern === requestedModule
|
||||
? ""
|
||||
: matchStar(entry.pattern, requestedModule);
|
||||
if (starMatch !== undefined) {
|
||||
for (const physicalPathPattern of entry.paths) {
|
||||
const physicalPath = physicalPathPattern.replace("*", starMatch);
|
||||
pathsToTry.push({ type: "file", path: physicalPath });
|
||||
pathsToTry.push(
|
||||
...extensions.map(
|
||||
(e) => ({ type: "extension", path: physicalPath + e } as TryPath)
|
||||
)
|
||||
);
|
||||
pathsToTry.push({
|
||||
type: "package",
|
||||
path: path.join(physicalPath, "/package.json"),
|
||||
});
|
||||
const indexPath = path.join(physicalPath, "/index");
|
||||
pathsToTry.push(
|
||||
...extensions.map(
|
||||
(e) => ({ type: "index", path: indexPath + e } as TryPath)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return pathsToTry.length === 0 ? undefined : pathsToTry;
|
||||
}
|
||||
|
||||
// Not sure why we don't just return the full found path?
|
||||
export function getStrippedPath(tryPath: TryPath): string {
|
||||
return tryPath.type === "index"
|
||||
? dirname(tryPath.path)
|
||||
: tryPath.type === "file"
|
||||
? tryPath.path
|
||||
: tryPath.type === "extension"
|
||||
? removeExtension(tryPath.path)
|
||||
: tryPath.type === "package"
|
||||
? tryPath.path
|
||||
: exhaustiveTypeException(tryPath.type);
|
||||
}
|
||||
|
||||
export function exhaustiveTypeException(check: never): never {
|
||||
throw new Error(`Unknown type ${check}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches pattern with a single star against search.
|
||||
* Star must match at least one character to be considered a match.
|
||||
* @param patttern for example "foo*"
|
||||
* @param search for example "fooawesomebar"
|
||||
* @returns the part of search that * matches, or undefined if no match.
|
||||
*/
|
||||
function matchStar(pattern: string, search: string): string | undefined {
|
||||
if (search.length < pattern.length) {
|
||||
return undefined;
|
||||
}
|
||||
if (pattern === "*") {
|
||||
return search;
|
||||
}
|
||||
const star = pattern.indexOf("*");
|
||||
if (star === -1) {
|
||||
return undefined;
|
||||
}
|
||||
const part1 = pattern.substring(0, star);
|
||||
const part2 = pattern.substring(star + 1);
|
||||
if (search.substr(0, star) !== part1) {
|
||||
return undefined;
|
||||
}
|
||||
if (search.substr(search.length - part2.length) !== part2) {
|
||||
return undefined;
|
||||
}
|
||||
return search.substr(star, search.length - part2.length);
|
||||
}
|
||||
226
install/config-ui/node_modules/tsconfig-paths/src/tsconfig-loader.ts
generated
vendored
Normal file
226
install/config-ui/node_modules/tsconfig-paths/src/tsconfig-loader.ts
generated
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
import * as path from "path";
|
||||
import * as fs from "fs";
|
||||
// tslint:disable:no-require-imports
|
||||
import JSON5 = require("json5");
|
||||
import StripBom = require("strip-bom");
|
||||
// tslint:enable:no-require-imports
|
||||
|
||||
/**
|
||||
* Typing for the parts of tsconfig that we care about
|
||||
*/
|
||||
export interface Tsconfig {
|
||||
extends?: string | string[];
|
||||
compilerOptions?: {
|
||||
baseUrl?: string;
|
||||
paths?: { [key: string]: Array<string> };
|
||||
strict?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface TsConfigLoaderResult {
|
||||
tsConfigPath: string | undefined;
|
||||
baseUrl: string | undefined;
|
||||
paths: { [key: string]: Array<string> } | undefined;
|
||||
}
|
||||
|
||||
export interface TsConfigLoaderParams {
|
||||
getEnv: (key: string) => string | undefined;
|
||||
cwd: string;
|
||||
loadSync?(
|
||||
cwd: string,
|
||||
filename?: string,
|
||||
baseUrl?: string
|
||||
): TsConfigLoaderResult;
|
||||
}
|
||||
|
||||
export function tsConfigLoader({
|
||||
getEnv,
|
||||
cwd,
|
||||
loadSync = loadSyncDefault,
|
||||
}: TsConfigLoaderParams): TsConfigLoaderResult {
|
||||
const TS_NODE_PROJECT = getEnv("TS_NODE_PROJECT");
|
||||
const TS_NODE_BASEURL = getEnv("TS_NODE_BASEURL");
|
||||
|
||||
// tsconfig.loadSync handles if TS_NODE_PROJECT is a file or directory
|
||||
// and also overrides baseURL if TS_NODE_BASEURL is available.
|
||||
const loadResult = loadSync(cwd, TS_NODE_PROJECT, TS_NODE_BASEURL);
|
||||
return loadResult;
|
||||
}
|
||||
|
||||
function loadSyncDefault(
|
||||
cwd: string,
|
||||
filename?: string,
|
||||
baseUrl?: string
|
||||
): TsConfigLoaderResult {
|
||||
// Tsconfig.loadSync uses path.resolve. This is why we can use an absolute path as filename
|
||||
|
||||
const configPath = resolveConfigPath(cwd, filename);
|
||||
|
||||
if (!configPath) {
|
||||
return {
|
||||
tsConfigPath: undefined,
|
||||
baseUrl: undefined,
|
||||
paths: undefined,
|
||||
};
|
||||
}
|
||||
const config = loadTsconfig(configPath);
|
||||
|
||||
return {
|
||||
tsConfigPath: configPath,
|
||||
baseUrl:
|
||||
baseUrl ||
|
||||
(config && config.compilerOptions && config.compilerOptions.baseUrl),
|
||||
paths: config && config.compilerOptions && config.compilerOptions.paths,
|
||||
};
|
||||
}
|
||||
|
||||
function resolveConfigPath(cwd: string, filename?: string): string | undefined {
|
||||
if (filename) {
|
||||
const absolutePath = fs.lstatSync(filename).isDirectory()
|
||||
? path.resolve(filename, "./tsconfig.json")
|
||||
: path.resolve(cwd, filename);
|
||||
|
||||
return absolutePath;
|
||||
}
|
||||
|
||||
if (fs.statSync(cwd).isFile()) {
|
||||
return path.resolve(cwd);
|
||||
}
|
||||
|
||||
const configAbsolutePath = walkForTsConfig(cwd);
|
||||
return configAbsolutePath ? path.resolve(configAbsolutePath) : undefined;
|
||||
}
|
||||
|
||||
export function walkForTsConfig(
|
||||
directory: string,
|
||||
existsSync: (path: string) => boolean = fs.existsSync
|
||||
): string | undefined {
|
||||
const configPath = path.join(directory, "./tsconfig.json");
|
||||
if (existsSync(configPath)) {
|
||||
return configPath;
|
||||
}
|
||||
|
||||
const parentDirectory = path.join(directory, "../");
|
||||
|
||||
// If we reached the top
|
||||
if (directory === parentDirectory) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return walkForTsConfig(parentDirectory, existsSync);
|
||||
}
|
||||
|
||||
export function loadTsconfig(
|
||||
configFilePath: string,
|
||||
existsSync: (path: string) => boolean = fs.existsSync,
|
||||
readFileSync: (filename: string) => string = (filename: string) =>
|
||||
fs.readFileSync(filename, "utf8")
|
||||
): Tsconfig | undefined {
|
||||
if (!existsSync(configFilePath)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const configString = readFileSync(configFilePath);
|
||||
const cleanedJson = StripBom(configString);
|
||||
let config: Tsconfig;
|
||||
try {
|
||||
config = JSON5.parse(cleanedJson);
|
||||
} catch (e) {
|
||||
throw new Error(`${configFilePath} is malformed ${e.message}`);
|
||||
}
|
||||
|
||||
let extendedConfig = config.extends;
|
||||
if (extendedConfig) {
|
||||
let base: Tsconfig;
|
||||
|
||||
if (Array.isArray(extendedConfig)) {
|
||||
base = extendedConfig.reduce(
|
||||
(currBase, extendedConfigElement) =>
|
||||
mergeTsconfigs(
|
||||
currBase,
|
||||
loadTsconfigFromExtends(
|
||||
configFilePath,
|
||||
extendedConfigElement,
|
||||
existsSync,
|
||||
readFileSync
|
||||
)
|
||||
),
|
||||
{}
|
||||
);
|
||||
} else {
|
||||
base = loadTsconfigFromExtends(
|
||||
configFilePath,
|
||||
extendedConfig,
|
||||
existsSync,
|
||||
readFileSync
|
||||
);
|
||||
}
|
||||
|
||||
return mergeTsconfigs(base, config);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intended to be called only from loadTsconfig.
|
||||
* Parameters don't have defaults because they should use the same as loadTsconfig.
|
||||
*/
|
||||
function loadTsconfigFromExtends(
|
||||
configFilePath: string,
|
||||
extendedConfigValue: string,
|
||||
// eslint-disable-next-line no-shadow
|
||||
existsSync: (path: string) => boolean,
|
||||
readFileSync: (filename: string) => string
|
||||
): Tsconfig {
|
||||
if (
|
||||
typeof extendedConfigValue === "string" &&
|
||||
extendedConfigValue.indexOf(".json") === -1
|
||||
) {
|
||||
extendedConfigValue += ".json";
|
||||
}
|
||||
const currentDir = path.dirname(configFilePath);
|
||||
let extendedConfigPath = path.join(currentDir, extendedConfigValue);
|
||||
if (
|
||||
extendedConfigValue.indexOf("/") !== -1 &&
|
||||
extendedConfigValue.indexOf(".") !== -1 &&
|
||||
!existsSync(extendedConfigPath)
|
||||
) {
|
||||
extendedConfigPath = path.join(
|
||||
currentDir,
|
||||
"node_modules",
|
||||
extendedConfigValue
|
||||
);
|
||||
}
|
||||
|
||||
const config =
|
||||
loadTsconfig(extendedConfigPath, existsSync, readFileSync) || {};
|
||||
|
||||
// baseUrl should be interpreted as relative to extendedConfigPath,
|
||||
// but we need to update it so it is relative to the original tsconfig being loaded
|
||||
if (config.compilerOptions?.baseUrl) {
|
||||
const extendsDir = path.dirname(extendedConfigValue);
|
||||
config.compilerOptions.baseUrl = path.join(
|
||||
extendsDir,
|
||||
config.compilerOptions.baseUrl
|
||||
);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
function mergeTsconfigs(
|
||||
base: Tsconfig | undefined,
|
||||
config: Tsconfig | undefined
|
||||
): Tsconfig {
|
||||
base = base || {};
|
||||
config = config || {};
|
||||
|
||||
return {
|
||||
...base,
|
||||
...config,
|
||||
compilerOptions: {
|
||||
...base.compilerOptions,
|
||||
...config.compilerOptions,
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user