Add node modules and compiled JavaScript from main
This commit is contained in:
parent
8bccaeaf7c
commit
4181bfdf50
7465 changed files with 1775003 additions and 2 deletions
1
node_modules/ts-jest/.ts-jest-digest
generated
vendored
Normal file
1
node_modules/ts-jest/.ts-jest-digest
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
23a45c3c610603c5fb7b5956ee7a94657fb32b21
|
984
node_modules/ts-jest/CHANGELOG.md
generated
vendored
Normal file
984
node_modules/ts-jest/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,984 @@
|
|||
## [26.5.6](https://github.com/kulshekhar/ts-jest/compare/v26.5.5...v26.5.6) (2021-05-05)
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* refactor(config): show warning message for `sourceMap: false` ([#2557](https://github.com/kulshekhar/ts-jest/pull/2557)) ([cf60990](https://github.com/kulshekhar/ts-jest/commit/cf609900e2c5937755123bd08ca2c5f2ff5e0651)).
|
||||
|
||||
|
||||
|
||||
## [26.5.5](https://github.com/kulshekhar/ts-jest/compare/v26.5.4...v26.5.5) (2021-04-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** return file content on emitSkipped for non ts/tsx files ([#2515](https://github.com/kulshekhar/ts-jest/issues/2515)) ([0320fb3](https://github.com/kulshekhar/ts-jest/commit/0320fb3ac22056aafe4d7ae966eab84dbf23fda9)), closes [#2513](https://github.com/kulshekhar/ts-jest/issues/2513)
|
||||
|
||||
|
||||
|
||||
## [26.5.4](https://github.com/kulshekhar/ts-jest/compare/v26.5.3...v26.5.4) (2021-03-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** initialize compiler with `.ts`/`.tsx`/`.d.ts` files only ([#2457](https://github.com/kulshekhar/ts-jest/issues/2457)) ([1dc731a](https://github.com/kulshekhar/ts-jest/commit/1dc731a5faf7cda59db1cc642eb99fae973b1246)), closes [#2445](https://github.com/kulshekhar/ts-jest/issues/2445)
|
||||
|
||||
|
||||
|
||||
## [26.5.3](https://github.com/kulshekhar/ts-jest/compare/v26.5.2...v26.5.3) (2021-03-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **config:** create fallback jest config when jest config is undefined ([#2421](https://github.com/kulshekhar/ts-jest/issues/2421)) ([0fb6b45](https://github.com/kulshekhar/ts-jest/commit/0fb6b45e7dc3dd7588d27f09ac9a8849dff470cb)), closes [#2085](https://github.com/kulshekhar/ts-jest/issues/2085)
|
||||
* remove `@types/jest` from direct dep ([#2416](https://github.com/kulshekhar/ts-jest/issues/2416)) ([060302e](https://github.com/kulshekhar/ts-jest/commit/060302ed1eb8708df0acd7ab1d613ff06fc08cf3)), closes [#2406](https://github.com/kulshekhar/ts-jest/issues/2406) [#2411](https://github.com/kulshekhar/ts-jest/issues/2411)
|
||||
* **compiler:** return original file content on emit skip ([#2408](https://github.com/kulshekhar/ts-jest/issues/2408)) ([cfba8f4](https://github.com/kulshekhar/ts-jest/commit/cfba8f423dd59536d8b1e1374ef2b20bff2ed857)), closes [#2407](https://github.com/kulshekhar/ts-jest/issues/2407)
|
||||
|
||||
|
||||
|
||||
## [26.5.2](https://github.com/kulshekhar/ts-jest/compare/v26.5.1...v26.5.2) (2021-02-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** exclude files in `outDir` from compiler source files ([#2376](https://github.com/kulshekhar/ts-jest/issues/2376)) ([9034677](https://github.com/kulshekhar/ts-jest/commit/9034677f9ce0968339d3d942a70e888996fac532)), closes [#2350](https://github.com/kulshekhar/ts-jest/issues/2350) [#2374](https://github.com/kulshekhar/ts-jest/issues/2374)
|
||||
* **config:** define `matchTestFilePath` before `setupTsJestCfg` ([#2373](https://github.com/kulshekhar/ts-jest/issues/2373)) ([c427fea](https://github.com/kulshekhar/ts-jest/commit/c427fea48a24b5ce6e8b9260d3c322583b062a77)), closes [#2371](https://github.com/kulshekhar/ts-jest/issues/2371)
|
||||
* **config:** improve emit skipped error message and ensure `outDir` always `TS_JEST_OUT_DIR` ([#2357](https://github.com/kulshekhar/ts-jest/issues/2357)) ([f2808bb](https://github.com/kulshekhar/ts-jest/commit/f2808bb0b15231c67ccb9a97ed606741213c03e6))
|
||||
* **typings:** set correct typing for `tsconfig`/`tsConfig` option ([#2377](https://github.com/kulshekhar/ts-jest/issues/2377)) ([d4f6aff](https://github.com/kulshekhar/ts-jest/commit/d4f6aff3f181761bf25c64ff1a97dd19a69196f9)), closes [#2368](https://github.com/kulshekhar/ts-jest/issues/2368)
|
||||
|
||||
|
||||
|
||||
## [26.5.1](https://github.com/kulshekhar/ts-jest/compare/v26.5.0...v26.5.1) (2021-02-09)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **config:** support typed config options for jest config typescript ([#2336](https://github.com/kulshekhar/ts-jest/issues/2336)) ([f4f5d32](https://github.com/kulshekhar/ts-jest/commit/f4f5d3205d1c80e545a32c02c6a66e7e91386f7f))
|
||||
* **presets:** add typing for `presets` entry point ([#2341](https://github.com/kulshekhar/ts-jest/issues/2341)) ([e12b004](https://github.com/kulshekhar/ts-jest/commit/e12b004dcc5848d5ae0638e885147c54e11cc72b)), closes [#2325](https://github.com/kulshekhar/ts-jest/issues/2325)
|
||||
|
||||
|
||||
|
||||
# [26.5.0](https://github.com/kulshekhar/ts-jest/compare/v26.5.0...v26.4.4) (2021-01-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* reduce size of `node_modules` when adding `ts-jest` ([#2309](https://github.com/kulshekhar/ts-jest/issues/2309)) ([6bf2e8a](https://github.com/kulshekhar/ts-jest/commit/b8d5d2090567f23947d9efd87f5f869b16bf2e8a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* introduce `exclude` to exclude files from diagnostics ([#2308](https://github.com/kulshekhar/ts-jest/issues/2308)) ([cd82fd3](https://github.com/kulshekhar/ts-jest/commit/0c555c250774a7fd9e356cf20a3d8b693cd82fd3))
|
||||
|
||||
|
||||
### DEPRECATIONS
|
||||
|
||||
* **config**: deprecate `pathRegex` in favor of `exclude` ([#2308](https://github.com/kulshekhar/ts-jest/issues/2308)) ([cd82fd3](https://github.com/kulshekhar/ts-jest/commit/0c555c250774a7fd9e356cf20a3d8b693cd82fd3))
|
||||
|
||||
|
||||
|
||||
## [26.4.4](https://github.com/kulshekhar/ts-jest/compare/v26.4.3...v26.4.4) (2020-11-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* revert usage of `@jest/create-cache-key-function` ([#2108](https://github.com/kulshekhar/ts-jest/issues/2108)) ([dee8231](https://github.com/kulshekhar/ts-jest/commit/dee823172ce1e8eb9e0b2dd3aeed1ab4033bd0d9)), closes [#2080](https://github.com/kulshekhar/ts-jest/issues/2080) [#2090](https://github.com/kulshekhar/ts-jest/issues/2090) [#2104](https://github.com/kulshekhar/ts-jest/issues/2104)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **testing:** expose all types for util `mocked` ([#2096](https://github.com/kulshekhar/ts-jest/issues/2096)) ([b1d072b](https://github.com/kulshekhar/ts-jest/commit/b1d072b52b9a7665b3a6914b0895f84f6ee3f8c0)), closes [#2086](https://github.com/kulshekhar/ts-jest/issues/2086)
|
||||
|
||||
|
||||
|
||||
## [26.4.3](https://github.com/kulshekhar/ts-jest/compare/v26.4.2...v26.4.3) (2020-10-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** only exclude test files when initializing compiler ([#2062](https://github.com/kulshekhar/ts-jest/issues/2062)) ([7264c13](https://github.com/kulshekhar/ts-jest/commit/7264c137114b6dd895624e3476dd7ec57b64ee13)), closes [#2061](https://github.com/kulshekhar/ts-jest/issues/2061), [#2068](https://github.com/kulshekhar/ts-jest/issues/2068), [#2072](https://github.com/kulshekhar/ts-jest/issues/2072), [#2073](https://github.com/kulshekhar/ts-jest/issues/2073)
|
||||
* **config:** resolve `.babelrc` file path before attempting to read it ([#2071](https://github.com/kulshekhar/ts-jest/issues/2071)) ([681bfef](https://github.com/kulshekhar/ts-jest/commit/681bfef41744f09cd50b71072f4d001cb58da82e)), closes [#2064](https://github.com/kulshekhar/ts-jest/issues/2064)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **config:** allow to override resolve tsconfig behavior ([#2063](https://github.com/kulshekhar/ts-jest/issues/2063)) ([9f46ace](https://github.com/kulshekhar/ts-jest/commit/9f46acefceb1fa71ee2e8b3b3c172ceb0544b4c4))
|
||||
|
||||
|
||||
|
||||
## [26.4.2](https://github.com/kulshekhar/ts-jest/compare/v26.4.1...v26.4.2) (2020-10-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **config:** expose several typings as public apis ([#2054](https://github.com/kulshekhar/ts-jest/issues/2054)) ([3b6b705](https://github.com/kulshekhar/ts-jest/commit/3b6b7055e2b9c74e81fb91596c807ace02ab77a1))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **compiler:** speed up bootstrap time for `isolatedModules:false` ([#2055](https://github.com/kulshekhar/ts-jest/issues/2055)) ([230b5dd](https://github.com/kulshekhar/ts-jest/commit/230b5ddbee55357d25dd190cd45aa8a30d7f31e0))
|
||||
|
||||
|
||||
### DEPRECATIONS
|
||||
|
||||
* **config**: deprecate `tsConfig` in favor of `tsconfig` ([#1997](https://github.com/kulshekhar/ts-jest/pull/1997))
|
||||
* **config**: deprecate `packageJson` since internal codes don't use it anymore ([#2034](https://github.com/kulshekhar/ts-jest/pull/2034))
|
||||
|
||||
|
||||
|
||||
## [26.4.1](https://github.com/kulshekhar/ts-jest/compare/v26.4.0...v26.4.1) (2020-09-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **utils:** `MaybeMockedConstructor` returns T ([#1976](https://github.com/kulshekhar/ts-jest/issues/1976)) ([b7712b2](https://github.com/kulshekhar/ts-jest/commit/b7712b2055d8f32dd97999de1d94e8f3515d79e8))
|
||||
* **utils:** revert `path.join` and add check on prefix ends with `/` ([#1989](https://github.com/kulshekhar/ts-jest/issues/1989)) ([3d9035b](https://github.com/kulshekhar/ts-jest/commit/3d9035bd70dc087d4c5a943bb2fe2af2d0822875)), closes [#1982](https://github.com/kulshekhar/ts-jest/issues/1982)
|
||||
|
||||
|
||||
|
||||
# [26.4.0](https://github.com/kulshekhar/ts-jest/compare/v26.3.0...v26.4.0) (2020-09-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **utils:** `pathsToModuleNameMapper` resolve path mapping with `path.join` ([#1969](https://github.com/kulshekhar/ts-jest/issues/1969)) ([81fce4c](https://github.com/kulshekhar/ts-jest/commit/81fce4c090811a1cc071579a99dc193fb976b117)), closes [#1968](https://github.com/kulshekhar/ts-jest/issues/1968)
|
||||
* set minimum `jest-util` version at 26.1.0 ([#1914](https://github.com/kulshekhar/ts-jest/issues/1914)) ([f00414c](https://github.com/kulshekhar/ts-jest/commit/f00414c6fbf8fc5413fd33d0a271c4a164c50d45)), closes [#1913](https://github.com/kulshekhar/ts-jest/issues/1913)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **config:** allow custom options in custom transformers ([#1966](https://github.com/kulshekhar/ts-jest/issues/1966)) ([1452ce4](https://github.com/kulshekhar/ts-jest/commit/1452ce4afcd36049cddd0db0861f1ac26b66f8c1)), closes [#1942](https://github.com/kulshekhar/ts-jest/issues/1942)
|
||||
* **transformers:** support hoisting when using `@jest/globals` ([#1937](https://github.com/kulshekhar/ts-jest/issues/1937)) ([0e5be15](https://github.com/kulshekhar/ts-jest/commit/0e5be1597d755fed11869f67df05eeea54b3106f)), closes [#1593](https://github.com/kulshekhar/ts-jest/issues/1593)
|
||||
* **transformers:** add `path-mapping` custom AST transformer ([#1927](https://github.com/kulshekhar/ts-jest/issues/1927)) ([3325186](https://github.com/kulshekhar/ts-jest/commit/3325186b6e55f41eb9bf7d81e092a358fc402b13))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **compiler:** remove `createProgram` for `isolatedModules: true` to boost startup speed ([#1941](https://github.com/kulshekhar/ts-jest/issues/1941)) ([dd84534](https://github.com/kulshekhar/ts-jest/commit/dd8453401840862186f991e2d514e0d328a67987))
|
||||
|
||||
|
||||
|
||||
# [26.3.0](https://github.com/kulshekhar/ts-jest/compare/v26.2.0...v26.3.0) (2020-08-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **config:** compute cache key without reading `package.json` ([#1893](https://github.com/kulshekhar/ts-jest/issues/1893)) ([4875a58](https://github.com/kulshekhar/ts-jest/commit/4875a58345666e0407f9f5b3f95049ae2c9d056d)), closes [#1892](https://github.com/kulshekhar/ts-jest/issues/1892)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support TypeScript 4.0 ([#1889](https://github.com/kulshekhar/ts-jest/issues/1889)) ([f070e93](https://github.com/kulshekhar/ts-jest/commit/f070e9334a9cf31fa6f0d73b3f69d805be72601d))
|
||||
|
||||
|
||||
|
||||
# [26.2.0](https://github.com/kulshekhar/ts-jest/compare/v26.1.4...v26.2.0) (2020-08-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* move `@types/jest` to dependencies to work well with yarn 2 ([#1859](https://github.com/kulshekhar/ts-jest/issues/1859)) ([5eb1389](https://github.com/kulshekhar/ts-jest/commit/5eb1389caaa0431e49ae6ca26b18e290208e0a0a)), closes [#1857](https://github.com/kulshekhar/ts-jest/issues/1857)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **config:** support `after` and `afterDeclarations` AST transformers ([#1831](https://github.com/kulshekhar/ts-jest/issues/1831)) ([be20a7c](https://github.com/kulshekhar/ts-jest/commit/be20a7c78c97027b33aec178da0f533095790871))
|
||||
* allow opt-out version warning message by environment variable `TS_JEST_DISABLE_VER_CHECKER` ([#1821](https://github.com/kulshekhar/ts-jest/issues/1821)) ([e6b42fc](https://github.com/kulshekhar/ts-jest/commit/e6b42fcd7a75c7b14e636a45cda04de18a46908b)), closes [#1774](https://github.com/kulshekhar/ts-jest/issues/1774)
|
||||
|
||||
|
||||
|
||||
## [26.1.4](https://github.com/kulshekhar/ts-jest/compare/v26.1.3...v26.1.4) (2020-07-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** check if test file exists before doing type check ([#1827](https://github.com/kulshekhar/ts-jest/issues/1827)) ([cc89d5b](https://github.com/kulshekhar/ts-jest/commit/cc89d5b1f912975cd29114c5b3b0bf18426816da)), closes [#1506](https://github.com/kulshekhar/ts-jest/issues/1506)
|
||||
|
||||
|
||||
|
||||
## [26.1.3](https://github.com/kulshekhar/ts-jest/compare/v26.1.2...v26.1.3) (2020-07-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* revert [#1793](https://github.com/kulshekhar/ts-jest/issues/1793) ([#1804](https://github.com/kulshekhar/ts-jest/issues/1804)) ([5095525](https://github.com/kulshekhar/ts-jest/commit/5095525333c8579c9c5e7f3149294b31f28d6774))
|
||||
|
||||
|
||||
|
||||
## [26.1.2](https://github.com/kulshekhar/ts-jest/compare/v26.1.1...v26.1.2) (2020-07-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** use `resolveModuleNames` TypeScript API to get resolved modules for test files ([#1784](https://github.com/kulshekhar/ts-jest/issues/1784)) ([5f26054](https://github.com/kulshekhar/ts-jest/commit/5f2605457e94b548bd7b9b28fc968554f7eefa91)), closes [#1747](https://github.com/kulshekhar/ts-jest/issues/1747)
|
||||
* **config:** invalidate cache when other options in `tsconfig` change ([#1788](https://github.com/kulshekhar/ts-jest/issues/1788)) ([6948855](https://github.com/kulshekhar/ts-jest/commit/69488552eca2846f3fc6ba86ab49d7893caaf521))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **compiler:** cache module resolution for `isolatedModules: false` ([#1786](https://github.com/kulshekhar/ts-jest/issues/1786)) ([7f731ed](https://github.com/kulshekhar/ts-jest/commit/7f731ed8a02755aeb41ecb27df4eaf16db2ddd95))
|
||||
* **compiler:** use `globsToMatcher` from `jest-util` ([#1754](https://github.com/kulshekhar/ts-jest/issues/1754)) ([44f3913](https://github.com/kulshekhar/ts-jest/commit/44f3913c2a017734ed87346b1c5fbec639d02062))
|
||||
|
||||
|
||||
|
||||
<a name="26.1.1"></a>
|
||||
## [26.1.1](https://github.com/kulshekhar/ts-jest/compare/v26.1.0...v26.1.1) (2020-06-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** generate source map correctly when tsconfig `mapRoot` is set ([#1741](https://github.com/kulshekhar/ts-jest/issues/1741)) ([01ac417](https://github.com/kulshekhar/ts-jest/commit/01ac417)), closes [#1718](https://github.com/kulshekhar/ts-jest/issues/1718)
|
||||
* **config:** show version warning when using ts-jest without babel ([#1729](https://github.com/kulshekhar/ts-jest/issues/1729)) ([e512bc0](https://github.com/kulshekhar/ts-jest/commit/e512bc0)), fixes [#1678-issuecomment-641930332](https://github.com//github.com/kulshekhar/ts-jest/pull/1678/issues/issuecomment-641930332), [#1678-issuecomment-639528993](https://github.com//github.com/kulshekhar/ts-jest/pull/1678/issues/issuecomment-639528993)
|
||||
|
||||
|
||||
|
||||
<a name="26.1.0"></a>
|
||||
# [26.1.0](https://github.com/kulshekhar/ts-jest/compare/v26.0.0...v26.1.0) (2020-05-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **typing:** don't mark `BabelConfig` as internal type ([#1667](https://github.com/kulshekhar/ts-jest/issues/1667)) ([558c307](https://github.com/kulshekhar/ts-jest/commit/558c307)), closes [#1666](https://github.com/kulshekhar/ts-jest/issues/1666)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **config:** show a warning message when TypeScript `target` version doesn't match with recommended NodeJs version ([#1678](https://github.com/kulshekhar/ts-jest/issues/1678)) ([085bdf5](https://github.com/kulshekhar/ts-jest/commit/085bdf5))
|
||||
* **config:** support multiple paths for `pathsToModuleNameMapper` ([#1690](https://github.com/kulshekhar/ts-jest/issues/1690)) ([a727bd5](https://github.com/kulshekhar/ts-jest/commit/a727bd5))
|
||||
* support TypeScript 3.9 ([#1653](https://github.com/kulshekhar/ts-jest/issues/1653)) ([fc3d5ad](https://github.com/kulshekhar/ts-jest/commit/fc3d5ad))
|
||||
|
||||
|
||||
|
||||
<a name="26.0.0"></a>
|
||||
# [26.0.0](https://github.com/kulshekhar/ts-jest/compare/v25.5.1...v26.0.0) (2020-05-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** return `undefined` for `getScriptVersion` when a file doesn't exist in memory cache ([#1641](https://github.com/kulshekhar/ts-jest/issues/1641)) ([6851b8e](https://github.com/kulshekhar/ts-jest/commit/6851b8e))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support Jest v26 ([#1602](https://github.com/kulshekhar/ts-jest/issues/1602)) ([23b7741](https://github.com/kulshekhar/ts-jest/commit/23b7741))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Requires a minimum of TypeScript v3.8
|
||||
* Drop support for Node 8
|
||||
|
||||
|
||||
<a name="25.5.1"></a>
|
||||
## [25.5.1](https://github.com/kulshekhar/ts-jest/compare/v25.5.0...v25.5.1) (2020-05-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** don't resolve files from build folder for `projectReferences` ([#1614](https://github.com/kulshekhar/ts-jest/issues/1614)) ([74b92d3](https://github.com/kulshekhar/ts-jest/commit/74b92d3))
|
||||
* **config:** don't set `include` value of `tsconfig` to empty array ([#1606](https://github.com/kulshekhar/ts-jest/issues/1606)) ([8a29aaa](https://github.com/kulshekhar/ts-jest/commit/8a29aaa))
|
||||
|
||||
|
||||
|
||||
<a name="25.5.0"></a>
|
||||
# [25.5.0](https://github.com/kulshekhar/ts-jest/compare/v25.4.0...v25.5.0) (2020-05-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** make `projectReferences` work with `isolatedModules: false` ([#1541](https://github.com/kulshekhar/ts-jest/issues/1541)) ([3e8efbe](https://github.com/kulshekhar/ts-jest/commit/3e8efbe))
|
||||
* **compiler:** allow using `files` provided by `tsconfig` ([#1562](https://github.com/kulshekhar/ts-jest/issues/1562)) ([a9f02bd](https://github.com/kulshekhar/ts-jest/commit/a9f02bd))
|
||||
* **config:** verify `testMatchPatterns` contain RegExp instance or string type values ([#1569](https://github.com/kulshekhar/ts-jest/issues/1569)) ([7f85bab](https://github.com/kulshekhar/ts-jest/commit/7f85bab))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **config:** add `tsconfig` alias to `tsConfig` option ([#1565](https://github.com/kulshekhar/ts-jest/issues/1565)) ([c10eb6d](https://github.com/kulshekhar/ts-jest/commit/c10eb6d))
|
||||
* **config:** define 'ts-jest' on `ConfigGlobals` interface of `@jest/types` ([#1592](https://github.com/kulshekhar/ts-jest/issues/1592)) ([4526392](https://github.com/kulshekhar/ts-jest/commit/4526392))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **compiler:** don’t write compile output to file system but rely on jest cache ([#1561](https://github.com/kulshekhar/ts-jest/issues/1561)) ([d11a4ea](https://github.com/kulshekhar/ts-jest/commit/d11a4ea))
|
||||
* **compiler:** improve performance for `isolatedModules: false` ([#1558](https://github.com/kulshekhar/ts-jest/issues/1558)) ([85c09e3](https://github.com/kulshekhar/ts-jest/commit/85c09e3))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Any custom typing files or files which are needed to be compiled and intended to use with `jest` need to be defined in `files` option of `tsconfig`.
|
||||
|
||||
For example:
|
||||
```
|
||||
// tsconfig.json
|
||||
{
|
||||
// ...other configs
|
||||
"files": [
|
||||
"my-custom-typings.d.ts",
|
||||
"my-global-module.ts"
|
||||
]
|
||||
}
|
||||
```
|
||||
* **compiler:** `incremental` and `compilerHost` options are no longer available. Please remove it from your `ts-jest` config.
|
||||
|
||||
|
||||
|
||||
<a name="25.5.0-beta.0"></a>
|
||||
# [25.5.0-beta.0](https://github.com/kulshekhar/ts-jest/compare/v25.5.0-alpha.0...v25.5.0-beta.0) (2020-04-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** allow using `files` provided by `tsconfig` ([#1562](https://github.com/kulshekhar/ts-jest/issues/1562)) ([907a280](https://github.com/kulshekhar/ts-jest/commit/907a280))
|
||||
* **config:** verify `testMatchPatterns` contain `RegExp` instance or `string` type values ([#1569](https://github.com/kulshekhar/ts-jest/issues/1569)) ([7f85bab](https://github.com/kulshekhar/ts-jest/commit/7f85bab))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **config:** add `tsconfig` alias to `tsConfig` option ([#1565](https://github.com/kulshekhar/ts-jest/issues/1565)) ([c10eb6d](https://github.com/kulshekhar/ts-jest/commit/c10eb6d))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **compiler:** don’t write compile output to file system but rely on `jest` cache ([#1561](https://github.com/kulshekhar/ts-jest/issues/1561)) ([07b5f62](https://github.com/kulshekhar/ts-jest/commit/07b5f62))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Any custom typing files or files which are needed to be compiled and intended to use with `jest` need to be defined in `files` option of `tsconfig`.
|
||||
|
||||
For example
|
||||
```
|
||||
// tsconfig.json
|
||||
{
|
||||
// ...other configs
|
||||
"files": [
|
||||
"my-custom-typings.d.ts".
|
||||
"my-global-module.ts"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
<a name="25.5.0-alpha.0"></a>
|
||||
# [25.5.0-alpha.0](https://github.com/kulshekhar/ts-jest/compare/v25.4.0...v25.5.0-alpha.0) (2020-04-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** make `projectReferences` work with `isolatedModules: false` ([#1541](https://github.com/kulshekhar/ts-jest/issues/1541)) ([3e8efbe](https://github.com/kulshekhar/ts-jest/commit/3e8efbe))
|
||||
|
||||
### Performance
|
||||
|
||||
* **compiler:** improve performance for `isolatedModules: false` ([#1558](https://github.com/kulshekhar/ts-jest/issues/1558)) ([85c09e3](https://github.com/kulshekhar/ts-jest/commit/85c09e3))
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* **config:** `compilerHost` and `incremental` options are no longer available
|
||||
|
||||
|
||||
|
||||
<a name="25.4.0"></a>
|
||||
# [25.4.0](https://github.com/kulshekhar/ts-jest/compare/v25.3.1...v25.4.0) (2020-04-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** make `projectReferences` work with `isolatedModules: true` ([#1527](https://github.com/kulshekhar/ts-jest/issues/1527)) ([aa6b74c](https://github.com/kulshekhar/ts-jest/commit/aa6b74c))
|
||||
* **compiler:** make sure `LanguageService` updated with test file information before getting diagnostics for test file ([#1507](https://github.com/kulshekhar/ts-jest/issues/1507)) ([311eaeb](https://github.com/kulshekhar/ts-jest/commit/311eaeb))
|
||||
* **config:** set default `outDir` when `allowJs` is true and no `outDir` in `tsconfig` ([#1502](https://github.com/kulshekhar/ts-jest/issues/1502)) ([1a287ad](https://github.com/kulshekhar/ts-jest/commit/1a287ad))
|
||||
* **config:** use original jest config object instead of stringified config ([#1511](https://github.com/kulshekhar/ts-jest/issues/1511)) ([4f0bb33](https://github.com/kulshekhar/ts-jest/commit/4f0bb33))
|
||||
|
||||
|
||||
|
||||
<a name="25.3.1"></a>
|
||||
## [25.3.1](https://github.com/kulshekhar/ts-jest/compare/v25.3.0...v25.3.1) (2020-04-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* only do type checking while compiling file ([#1483](https://github.com/kulshekhar/ts-jest/issues/1483)) ([dbc0a08](https://github.com/kulshekhar/ts-jest/commit/dbc0a08))
|
||||
* **config:** set default outDir for enabled allowJs without outDir ([#1472](https://github.com/kulshekhar/ts-jest/issues/1472)) ([57c7af0](https://github.com/kulshekhar/ts-jest/commit/57c7af0))
|
||||
|
||||
|
||||
|
||||
<a name="25.3.0"></a>
|
||||
# [25.3.0](https://github.com/kulshekhar/ts-jest/compare/25.2.1...v25.3.0) (2020-03-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add `jest-config` to dependencies list ([6d9e0d8](https://github.com/kulshekhar/ts-jest/commit/6d9e0d8))
|
||||
* always do type check for all files provided to ts-jest transformer for non-watch mode ([#1450](https://github.com/kulshekhar/ts-jest/issues/1450)) ([107e062](https://github.com/kulshekhar/ts-jest/commit/107e062))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* **docs:** add `TROUBLESHOOTING` ([96cd9b3](https://github.com/kulshekhar/ts-jest/commit/b8ebf36))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **compiler:** expose internal ts `Program` via ConfigSet `TsCompiler` ([#1433](https://github.com/kulshekhar/ts-jest/issues/1433)) ([7153246](https://github.com/kulshekhar/ts-jest/commit/7153246))
|
||||
* **config:** add incremental option ([#1418](https://github.com/kulshekhar/ts-jest/issues/1418)) ([5a69bce](https://github.com/kulshekhar/ts-jest/commit/5a69bce))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* **config:** improve diagnostics message ([#1444](https://github.com/kulshekhar/ts-jest/issues/1444)) ([96cd9b3](https://github.com/kulshekhar/ts-jest/commit/96cd9b3)). This will affect to any snapshots or assertion against diagnostics messages
|
||||
|
||||
|
||||
|
||||
<a name="25.2.1"></a>
|
||||
# [25.2.1](https://github.com/kulshekhar/ts-jest/compare/25.2.0...25.2.1) (2020-02-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** allow transformation of typescript files in node_modules ([#1385](https://github.com/kulshekhar/ts-jest/issues/1385)) ([814405e](https://github.com/kulshekhar/ts-jest/commit/814405e))
|
||||
* **docs:** fixing slack link and some minor typos in documenation ([#1404](https://github.com/kulshekhar/ts-jest/issues/1404)) ([3e2e008](https://github.com/kulshekhar/ts-jest/commit/3e2e008))
|
||||
* **transformer:** add deepUnmock to hoist method list ([#1372](https://github.com/kulshekhar/ts-jest/issues/1372)) ([0fbbc00](https://github.com/kulshekhar/ts-jest/commit/0fbbc00))
|
||||
* **util:** use resolve package typescript package in yarn workspaces ([#1377](https://github.com/kulshekhar/ts-jest/issues/1377)) ([a63808c](https://github.com/kulshekhar/ts-jest/commit/a63808c))
|
||||
|
||||
|
||||
|
||||
<a name="25.2.0"></a>
|
||||
# [25.2.0](https://github.com/kulshekhar/ts-jest/compare/v25.1.0...v25.2.0) (2020-02-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **config:** let babel-jest handle loading babel config ([#1370](https://github.com/kulshekhar/ts-jest/issues/1370))
|
||||
|
||||
|
||||
|
||||
<a name="25.1.0"></a>
|
||||
# [25.1.0](https://github.com/kulshekhar/ts-jest/compare/v25.0.0...v25.1.0) (2020-01-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* jest 25 type definitions ([#1363](https://github.com/kulshekhar/ts-jest/issues/1363)) ([ba82a9e](https://github.com/kulshekhar/ts-jest/commit/ba82a9e))
|
||||
|
||||
|
||||
|
||||
<a name="25.0.0"></a>
|
||||
# [25.0.0](https://github.com/kulshekhar/ts-jest/compare/v24.3.0...v25.0.0) (2020-01-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support Jest 25 ([#1355](https://github.com/kulshekhar/ts-jest/issues/1355))
|
||||
|
||||
|
||||
|
||||
<a name="24.3.0"></a>
|
||||
# [24.3.0](https://github.com/kulshekhar/ts-jest/compare/v24.2.0...v24.3.0) (2020-01-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **config:** support babel config file path as string ([#1332](https://github.com/kulshekhar/ts-jest/issues/1332)) ([78a53c2](https://github.com/kulshekhar/ts-jest/commit/78a53c2))
|
||||
|
||||
|
||||
|
||||
<a name="24.2.0"></a>
|
||||
# [24.2.0](https://github.com/kulshekhar/ts-jest/compare/v24.1.0...v24.2.0) (2019-11-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** pass filename to sha function instead of file extension ([ac1ac97](https://github.com/kulshekhar/ts-jest/commit/ac1ac97))
|
||||
* **transformers:** hoist jest.enableAutomock and jest.disableAutomock ([ac50bc3](https://github.com/kulshekhar/ts-jest/commit/ac50bc3))
|
||||
* typescript serviceHost cache miss on Windows operating systems ([26ee731](https://github.com/kulshekhar/ts-jest/commit/26ee731))
|
||||
|
||||
|
||||
|
||||
<a name="24.1.0"></a>
|
||||
# [24.1.0](https://github.com/kulshekhar/ts-jest/compare/v24.0.2...v24.1.0) (2019-09-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **perf:** add cache for fs calls ([#908](https://github.com/kulshekhar/ts-jest/issues/908)) ([3dada81](https://github.com/kulshekhar/ts-jest/commit/3dada81))
|
||||
* [#825](https://github.com/kulshekhar/ts-jest/issues/825) handle symlinked modules (ala pnpm) correctly ([e190b23](https://github.com/kulshekhar/ts-jest/commit/e190b23))
|
||||
* handle tsBuildInfoFile option ([f9583e9](https://github.com/kulshekhar/ts-jest/commit/f9583e9)), closes [#1095](https://github.com/kulshekhar/ts-jest/issues/1095)
|
||||
* **types:** unforce esModuleInterop in tsconfig.json ([c2d39b6](https://github.com/kulshekhar/ts-jest/commit/c2d39b6))
|
||||
|
||||
|
||||
|
||||
<a name="24.0.2"></a>
|
||||
## [24.0.2](https://github.com/kulshekhar/ts-jest/compare/v24.0.1...v24.0.2) (2019-04-05)
|
||||
|
||||
|
||||
|
||||
<a name="24.0.1"></a>
|
||||
## [24.0.1](https://github.com/kulshekhar/ts-jest/compare/v24.0.0...v24.0.1) (2019-03-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update call to globIgnore ([#1002](https://github.com/kulshekhar/ts-jest/issues/1002)) ([#1003](https://github.com/kulshekhar/ts-jest/issues/1003)) ([05b63af](https://github.com/kulshekhar/ts-jest/commit/05b63af))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **config:** specify package.json location ([#823](https://github.com/kulshekhar/ts-jest/issues/823)) ([#1013](https://github.com/kulshekhar/ts-jest/issues/1013)) ([fb7dd55](https://github.com/kulshekhar/ts-jest/commit/fb7dd55))
|
||||
|
||||
|
||||
|
||||
<a name="24.0.0"></a>
|
||||
# [24.0.0](https://github.com/kulshekhar/ts-jest/compare/v23.10.5...v24.0.0) (2019-02-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* cli test ([1d67101](https://github.com/kulshekhar/ts-jest/commit/1d67101))
|
||||
* module tests and some snapshots ([999f889](https://github.com/kulshekhar/ts-jest/commit/999f889))
|
||||
* remove unused snapshots ([108b08b](https://github.com/kulshekhar/ts-jest/commit/108b08b))
|
||||
* some tests ([d0f2231](https://github.com/kulshekhar/ts-jest/commit/d0f2231))
|
||||
* test command ([8372b5e](https://github.com/kulshekhar/ts-jest/commit/8372b5e))
|
||||
* test path for windows (attempt 1) ([6824ac4](https://github.com/kulshekhar/ts-jest/commit/6824ac4))
|
||||
* test path for windows (attempt 2) ([eb2fc8a](https://github.com/kulshekhar/ts-jest/commit/eb2fc8a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **jest:** bump to 24 ([defcb77](https://github.com/kulshekhar/ts-jest/commit/defcb77))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.4"></a>
|
||||
## [23.10.4](https://github.com/kulshekhar/ts-jest/compare/v23.10.3...v23.10.4) (2018-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **cache:** adds project's dep versions to cache key ([6cacbea](https://github.com/kulshekhar/ts-jest/commit/6cacbea)), closes [#785](https://github.com/kulshekhar/ts-jest/issues/785)
|
||||
* **cli:** change options to better reflect the new presets ([68abcfb](https://github.com/kulshekhar/ts-jest/commit/68abcfb))
|
||||
* **helpers:** deprecate import from ts-jest, now ts-jest/utils ([33ff29f](https://github.com/kulshekhar/ts-jest/commit/33ff29f)), closes [#782](https://github.com/kulshekhar/ts-jest/issues/782)
|
||||
* **typings:** typo in presets definition file ([53767ab](https://github.com/kulshekhar/ts-jest/commit/53767ab))
|
||||
* **typings:** wrong import in preset typings + test ([94dc4e7](https://github.com/kulshekhar/ts-jest/commit/94dc4e7))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.3"></a>
|
||||
## [23.10.3](https://github.com/kulshekhar/ts-jest/compare/v23.10.2...v23.10.3) (2018-09-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** do not force module kind if piping babel ([acebc8c](https://github.com/kulshekhar/ts-jest/commit/acebc8c)), closes [#767](https://github.com/kulshekhar/ts-jest/issues/767)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **helpers:** adds a mocked test helper for mock typings ([f976135](https://github.com/kulshekhar/ts-jest/commit/f976135)), closes [#576](https://github.com/kulshekhar/ts-jest/issues/576)
|
||||
|
||||
|
||||
|
||||
<a name="23.10.2"></a>
|
||||
## [23.10.2](https://github.com/kulshekhar/ts-jest/compare/v23.10.1...v23.10.2) (2018-09-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **cache:** resolved tsconfig in cache key + pkg digest ([e891608](https://github.com/kulshekhar/ts-jest/commit/e891608)), closes [#749](https://github.com/kulshekhar/ts-jest/issues/749)
|
||||
* **cli:** resets testMatch if using testRegex option ([31ad0aa](https://github.com/kulshekhar/ts-jest/commit/31ad0aa)), closes [#756](https://github.com/kulshekhar/ts-jest/issues/756)
|
||||
* **diagnostics:** throws only for category warning and error ([bb28849](https://github.com/kulshekhar/ts-jest/commit/bb28849)), closes [#748](https://github.com/kulshekhar/ts-jest/issues/748)
|
||||
* **import:** wrong error message when a module exists but fails ([e0d6c57](https://github.com/kulshekhar/ts-jest/commit/e0d6c57))
|
||||
* **preset:** createJestPreset fails with base and no array ([3c325e8](https://github.com/kulshekhar/ts-jest/commit/3c325e8))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **cli:** CLI 'config:migrate' now detects best preset ([febd8d3](https://github.com/kulshekhar/ts-jest/commit/febd8d3))
|
||||
* **preset:** adds 2 presets along the default one ([9f3d759](https://github.com/kulshekhar/ts-jest/commit/9f3d759))
|
||||
* **preset:** adds presets typings and export all presets ([f55d895](https://github.com/kulshekhar/ts-jest/commit/f55d895))
|
||||
* **typings:** emit declaration files, filtering out internals ([4f10f7e](https://github.com/kulshekhar/ts-jest/commit/4f10f7e)), closes [#745](https://github.com/kulshekhar/ts-jest/issues/745)
|
||||
|
||||
|
||||
|
||||
<a name="23.10.1"></a>
|
||||
## [23.10.1](https://github.com/kulshekhar/ts-jest/compare/v23.10.0...v23.10.1) (2018-09-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compile:** js files were never transpiled thru TS ([374dca1](https://github.com/kulshekhar/ts-jest/commit/374dca1)), closes [#740](https://github.com/kulshekhar/ts-jest/issues/740)
|
||||
* **config:** warn instead of forcing ESM interoperability ([a2a4be2](https://github.com/kulshekhar/ts-jest/commit/a2a4be2))
|
||||
* **windows:** normalize paths ([c12dfff](https://github.com/kulshekhar/ts-jest/commit/c12dfff))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0"></a>
|
||||
# [23.10.0](https://github.com/kulshekhar/ts-jest/compare/v23.10.0-beta.6...v23.10.0) (2018-09-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **babel:** fixes the babel 6 hack ([c8d51cf](https://github.com/kulshekhar/ts-jest/commit/c8d51cf))
|
||||
* **config:** jsx should also be considered as js files ([6c32a93](https://github.com/kulshekhar/ts-jest/commit/6c32a93))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **hints:** warns if transform matches js without allowJs ([952cc87](https://github.com/kulshekhar/ts-jest/commit/952cc87))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0-beta.6"></a>
|
||||
# [23.10.0-beta.6](https://github.com/kulshekhar/ts-jest/compare/v23.10.0-beta.5...v23.10.0-beta.6) (2018-09-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **babel:** instrumentation was done twice when using babel ([659a7fb](https://github.com/kulshekhar/ts-jest/commit/659a7fb)), closes [#713](https://github.com/kulshekhar/ts-jest/issues/713)
|
||||
* **cache:** includes all parameters in cache key computing ([70e1867](https://github.com/kulshekhar/ts-jest/commit/70e1867))
|
||||
* **e2e:** fixes the eval tool (not used yet) ([939d13a](https://github.com/kulshekhar/ts-jest/commit/939d13a))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0-beta.5"></a>
|
||||
# [23.10.0-beta.5](https://github.com/kulshekhar/ts-jest/compare/v23.10.0-beta.4...v23.10.0-beta.5) (2018-09-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** fixes the outdated package-lock ([c5a5b7a](https://github.com/kulshekhar/ts-jest/commit/c5a5b7a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **diagnostics:** add option to enable/disable first-TS-error-throws ([2c840c2](https://github.com/kulshekhar/ts-jest/commit/2c840c2))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0-beta.4"></a>
|
||||
# [23.10.0-beta.4](https://github.com/kulshekhar/ts-jest/compare/v23.10.0-beta.3...v23.10.0-beta.4) (2018-09-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **config:** fixes a bug in the tsconfig file resolver ([3910f2c](https://github.com/kulshekhar/ts-jest/commit/3910f2c))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0-beta.3"></a>
|
||||
# [23.10.0-beta.3](https://github.com/kulshekhar/ts-jest/compare/v23.10.0-beta.2...v23.10.0-beta.3) (2018-09-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **config:** fixes a bug in path resolver ([ceb0424](https://github.com/kulshekhar/ts-jest/commit/ceb0424))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **cli:** adds a cli tool to migrate old config ([714f5f0](https://github.com/kulshekhar/ts-jest/commit/714f5f0))
|
||||
* **cli:** ads a simple config:init helper + tests ([6700522](https://github.com/kulshekhar/ts-jest/commit/6700522))
|
||||
* **config:** exposes custom transformers to config for presets ([885bc44](https://github.com/kulshekhar/ts-jest/commit/885bc44))
|
||||
* **logger:** adds ts-jest version in the logger's context ([bb0c06e](https://github.com/kulshekhar/ts-jest/commit/bb0c06e))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **bundle:** improves bundle size ([34eedc3](https://github.com/kulshekhar/ts-jest/commit/34eedc3))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0-beta.2"></a>
|
||||
# [23.10.0-beta.2](https://github.com/kulshekhar/ts-jest/compare/v23.10.0-beta.1...v23.10.0-beta.2) (2018-09-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **caching:** fixes a possible cache collision ([9c38694](https://github.com/kulshekhar/ts-jest/commit/9c38694))
|
||||
* **testing:** change logging level for some utility ([16f125a](https://github.com/kulshekhar/ts-jest/commit/16f125a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **config:** typeCheck default to true (langauge service) ([623b2f4](https://github.com/kulshekhar/ts-jest/commit/623b2f4))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* **config:** Language service will be used by default from now on
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0-beta.1"></a>
|
||||
# [23.10.0-beta.1](https://github.com/kulshekhar/ts-jest/compare/v23.1.4...v23.10.0-beta.1) (2018-09-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **ci:** can't use runInBand for e2e: cache collision ([db650f4](https://github.com/kulshekhar/ts-jest/commit/db650f4))
|
||||
* **ci:** do not run e2e sub-tests in band ([18ad865](https://github.com/kulshekhar/ts-jest/commit/18ad865))
|
||||
* **ci:** ensure npm is present with ci ([edb6eda](https://github.com/kulshekhar/ts-jest/commit/edb6eda))
|
||||
* **logger:** removes cyclic imports ([5ef980f](https://github.com/kulshekhar/ts-jest/commit/5ef980f))
|
||||
* babel-config + adds test ([12146c3](https://github.com/kulshekhar/ts-jest/commit/12146c3))
|
||||
* fixes js style to be node < 10 compatible ([83d7517](https://github.com/kulshekhar/ts-jest/commit/83d7517))
|
||||
* hoisting per level + memoize fix ([31847b0](https://github.com/kulshekhar/ts-jest/commit/31847b0))
|
||||
* jest 22 did not have default config ([cbaddc3](https://github.com/kulshekhar/ts-jest/commit/cbaddc3))
|
||||
* makes node 6 happy ([f6f82b8](https://github.com/kulshekhar/ts-jest/commit/f6f82b8))
|
||||
* makes node6 happy ([f170285](https://github.com/kulshekhar/ts-jest/commit/f170285))
|
||||
* makes window happy ([36fbebe](https://github.com/kulshekhar/ts-jest/commit/36fbebe))
|
||||
* node 6 unhappy again... ([703ad0b](https://github.com/kulshekhar/ts-jest/commit/703ad0b))
|
||||
* normalizes bundle hash on any node version ([ce7afaf](https://github.com/kulshekhar/ts-jest/commit/ce7afaf))
|
||||
* npm coming with node 6 doesn't talk `ci` ([b87198d](https://github.com/kulshekhar/ts-jest/commit/b87198d))
|
||||
* source maps ([89a30c9](https://github.com/kulshekhar/ts-jest/commit/89a30c9))
|
||||
* typos + node 6 compat ([0ed1587](https://github.com/kulshekhar/ts-jest/commit/0ed1587))
|
||||
* updates templates ([f2e1da2](https://github.com/kulshekhar/ts-jest/commit/f2e1da2))
|
||||
* uses cross-platform spawn + fix pkg versions ([ac1599c](https://github.com/kulshekhar/ts-jest/commit/ac1599c))
|
||||
* we are not writing files, use normalized EOL ([47fff43](https://github.com/kulshekhar/ts-jest/commit/47fff43))
|
||||
* **tests:** CI fixes ([34a41ea](https://github.com/kulshekhar/ts-jest/commit/34a41ea))
|
||||
* **tests:** detect npm version to use or not ci ([683a1e5](https://github.com/kulshekhar/ts-jest/commit/683a1e5))
|
||||
* **tests:** do not use babel in our tests + new API for simple ([3e4de3e](https://github.com/kulshekhar/ts-jest/commit/3e4de3e))
|
||||
* **tests:** more sanitizing for windows compat ([faae274](https://github.com/kulshekhar/ts-jest/commit/faae274))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **config:** adds a helper to build moduleNameMapper from paths ([7b8598e](https://github.com/kulshekhar/ts-jest/commit/7b8598e)), closes [#364](https://github.com/kulshekhar/ts-jest/issues/364)
|
||||
* **logging:** improves log messages + tests ([5d03c4d](https://github.com/kulshekhar/ts-jest/commit/5d03c4d))
|
||||
* adds logging + better hashing ([4322701](https://github.com/kulshekhar/ts-jest/commit/4322701))
|
||||
* allow env var to add diagnostic codes to ignore ([777edf5](https://github.com/kulshekhar/ts-jest/commit/777edf5))
|
||||
* cache key + tests ([bd55448](https://github.com/kulshekhar/ts-jest/commit/bd55448))
|
||||
* diagnostics, different compilers, ... ([f26ebf0](https://github.com/kulshekhar/ts-jest/commit/f26ebf0))
|
||||
* directly writes to stdio so jest does not swallow ([6a7f01f](https://github.com/kulshekhar/ts-jest/commit/6a7f01f))
|
||||
* handles stringifyContentPathRegex ([3fcb4bd](https://github.com/kulshekhar/ts-jest/commit/3fcb4bd))
|
||||
* hoisting + tests + many other things ([6186e84](https://github.com/kulshekhar/ts-jest/commit/6186e84))
|
||||
* io serializer + other test utils ([d03e0e7](https://github.com/kulshekhar/ts-jest/commit/d03e0e7))
|
||||
* jest preset ([beb50b5](https://github.com/kulshekhar/ts-jest/commit/beb50b5))
|
||||
* warn about unsupported versions ([1103071](https://github.com/kulshekhar/ts-jest/commit/1103071))
|
||||
* **test:** jest serializers ([dfa9c0f](https://github.com/kulshekhar/ts-jest/commit/dfa9c0f))
|
||||
* **tests:** more test tools + adds test related to debuggin issues ([8dcafca](https://github.com/kulshekhar/ts-jest/commit/8dcafca))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **babel:** uses babel-jest cache key as part of ours ([f51c4a7](https://github.com/kulshekhar/ts-jest/commit/f51c4a7))
|
||||
* **cache:** share config-sets for parallel test running ([090ca7b](https://github.com/kulshekhar/ts-jest/commit/090ca7b))
|
||||
* **tests:** run e2e tests in band ([b3e94ff](https://github.com/kulshekhar/ts-jest/commit/b3e94ff))
|
||||
* detects changes in templates and bundle ([2a3da21](https://github.com/kulshekhar/ts-jest/commit/2a3da21))
|
||||
* do not type check if fileName doesn't match ([cc45adc](https://github.com/kulshekhar/ts-jest/commit/cc45adc))
|
||||
* faster tests ([37a0187](https://github.com/kulshekhar/ts-jest/commit/37a0187))
|
||||
* improves speed of local test after 1st run ([cc04021](https://github.com/kulshekhar/ts-jest/commit/cc04021))
|
||||
* more cleaning ([c48f7b8](https://github.com/kulshekhar/ts-jest/commit/c48f7b8))
|
||||
* trying to improve travis-ci conf ([e4b4d95](https://github.com/kulshekhar/ts-jest/commit/e4b4d95))
|
||||
|
||||
|
||||
|
||||
<a name="23.1.3"></a>
|
||||
## [23.1.3](https://github.com/kulshekhar/ts-jest/compare/v23.1.2...v23.1.3) (2018-08-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* allow (but deprecate) use of old preprocessor.js ([a65079f](https://github.com/kulshekhar/ts-jest/commit/a65079f))
|
||||
* big refactor + fixes (mainly cache key + coverage) ([e46caae](https://github.com/kulshekhar/ts-jest/commit/e46caae))
|
||||
* fixes coverage and tests ([09500c2](https://github.com/kulshekhar/ts-jest/commit/09500c2))
|
||||
* gracefully load [@babel](https://github.com/babel)/core or babel-core ([98b2410](https://github.com/kulshekhar/ts-jest/commit/98b2410))
|
||||
* hack for babel < 6 so that breakpoints do work ([90c74ef](https://github.com/kulshekhar/ts-jest/commit/90c74ef)), closes [#627](https://github.com/kulshekhar/ts-jest/issues/627)
|
||||
* resolves correctly config file path (fix [#636](https://github.com/kulshekhar/ts-jest/issues/636)) ([5ab100c](https://github.com/kulshekhar/ts-jest/commit/5ab100c))
|
||||
* test rootDir to handle preset-angular ([8a6a8f7](https://github.com/kulshekhar/ts-jest/commit/8a6a8f7))
|
||||
* wrong error message ([c955083](https://github.com/kulshekhar/ts-jest/commit/c955083))
|
||||
* **html:** correctly transforms html source when needed ([9a2d74f](https://github.com/kulshekhar/ts-jest/commit/9a2d74f))
|
||||
* **lint:** fixes tslint script & lint issues ([60ab36e](https://github.com/kulshekhar/ts-jest/commit/60ab36e))
|
||||
* **package:** update fs-extra to version 6.0.1 ([7e73536](https://github.com/kulshekhar/ts-jest/commit/7e73536))
|
||||
* **package:** update pkg-dir to version 3.0.0 ([3fb8f9f](https://github.com/kulshekhar/ts-jest/commit/3fb8f9f))
|
||||
* **package:** update yargs to version 12.0.1 ([390ffcd](https://github.com/kulshekhar/ts-jest/commit/390ffcd))
|
||||
* **source-maps:** fix source maps options/calls ([76e27c1](https://github.com/kulshekhar/ts-jest/commit/76e27c1))
|
||||
* Typo in utils.ts ([#534](https://github.com/kulshekhar/ts-jest/issues/534)) ([a650260](https://github.com/kulshekhar/ts-jest/commit/a650260))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* do not hash cache key, jest does it underneath ([fbe4f1f](https://github.com/kulshekhar/ts-jest/commit/fbe4f1f))
|
||||
|
||||
|
||||
|
||||
<a name="22.4.5"></a>
|
||||
## [22.4.5](https://github.com/kulshekhar/ts-jest/compare/v22.4.4...v22.4.5) (2018-05-05)
|
||||
|
||||
|
||||
|
||||
<a name="22.4.1"></a>
|
||||
## [22.4.1](https://github.com/kulshekhar/ts-jest/compare/v22.4.0...v22.4.1) (2018-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** update source-map-support to version 0.5.0 ([f0aab12](https://github.com/kulshekhar/ts-jest/commit/f0aab12))
|
||||
* **package:** update yargs to version 10.0.3 ([5cdf969](https://github.com/kulshekhar/ts-jest/commit/5cdf969))
|
||||
* **package:** update yargs to version 11.0.0 ([7e9ce40](https://github.com/kulshekhar/ts-jest/commit/7e9ce40))
|
||||
* add startDir to if-clause ([eed5311](https://github.com/kulshekhar/ts-jest/commit/eed5311))
|
||||
* **package:** update yargs to version 9.0.1 ([#326](https://github.com/kulshekhar/ts-jest/issues/326)) ([8bf9924](https://github.com/kulshekhar/ts-jest/commit/8bf9924))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add option to run TypeScript diagnostics ([13b77d9](https://github.com/kulshekhar/ts-jest/commit/13b77d9))
|
||||
|
||||
|
||||
|
||||
<a name="21.0.1"></a>
|
||||
## [21.0.1](https://github.com/kulshekhar/ts-jest/compare/v21.0.0...v21.0.1) (2017-09-14)
|
||||
|
||||
|
||||
|
||||
<a name="21.0.0"></a>
|
||||
# [21.0.0](https://github.com/kulshekhar/ts-jest/compare/v20.0.14...v21.0.0) (2017-09-05)
|
||||
|
||||
|
||||
|
||||
<a name="20.0.14"></a>
|
||||
## [20.0.14](https://github.com/kulshekhar/ts-jest/compare/v20.0.13...v20.0.14) (2017-09-01)
|
||||
|
||||
|
||||
|
||||
<a name="20.0.13"></a>
|
||||
## [20.0.13](https://github.com/kulshekhar/ts-jest/compare/v20.0.12...v20.0.13) (2017-08-30)
|
||||
|
||||
|
||||
|
||||
<a name="20.0.12"></a>
|
||||
## [20.0.12](https://github.com/kulshekhar/ts-jest/compare/v20.0.11...v20.0.12) (2017-08-30)
|
||||
|
||||
|
||||
|
||||
<a name="20.0.11"></a>
|
||||
## [20.0.11](https://github.com/kulshekhar/ts-jest/compare/v20.0.9...v20.0.11) (2017-08-29)
|
||||
|
||||
|
||||
|
||||
<a name="20.0.9"></a>
|
||||
## [20.0.9](https://github.com/kulshekhar/ts-jest/compare/20.0.9...v20.0.9) (2017-08-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** update fs-extra to version 4.0.0 ([5be18fb](https://github.com/kulshekhar/ts-jest/commit/5be18fb))
|
||||
|
||||
|
||||
|
||||
<a name="20.0.7"></a>
|
||||
## [20.0.7](https://github.com/kulshekhar/ts-jest/compare/17.0.3...20.0.7) (2017-07-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* peer dependency against Typescript 2.x ([cb08128](https://github.com/kulshekhar/ts-jest/commit/cb08128))
|
||||
* remove outDir when collecting coverage ([c076956](https://github.com/kulshekhar/ts-jest/commit/c076956))
|
||||
* **package:** update fs-extra to version 3.0.0 ([906be12](https://github.com/kulshekhar/ts-jest/commit/906be12))
|
||||
* **package:** update yargs to version 8.0.1 ([0b2ea98](https://github.com/kulshekhar/ts-jest/commit/0b2ea98))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* export transpileIfTypescript ([6f835af](https://github.com/kulshekhar/ts-jest/commit/6f835af))
|
||||
|
||||
|
||||
|
||||
<a name="17.0.3"></a>
|
||||
## [17.0.3](https://github.com/kulshekhar/ts-jest/compare/17.0.2...17.0.3) (2016-12-01)
|
||||
|
||||
|
||||
|
||||
<a name="17.0.2"></a>
|
||||
## [17.0.2](https://github.com/kulshekhar/ts-jest/compare/17.0.1...17.0.2) (2016-12-01)
|
||||
|
||||
|
||||
|
||||
<a name="17.0.1"></a>
|
||||
## [17.0.1](https://github.com/kulshekhar/ts-jest/compare/17.0.0...17.0.1) (2016-11-30)
|
||||
|
||||
|
||||
|
||||
<a name="17.0.0"></a>
|
||||
# [17.0.0](https://github.com/kulshekhar/ts-jest/compare/0.1.13...17.0.0) (2016-11-09)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.13"></a>
|
||||
## [0.1.13](https://github.com/kulshekhar/ts-jest/compare/0.1.12...0.1.13) (2016-11-07)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.12"></a>
|
||||
## [0.1.12](https://github.com/kulshekhar/ts-jest/compare/0.1.11...0.1.12) (2016-11-03)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.11"></a>
|
||||
## [0.1.11](https://github.com/kulshekhar/ts-jest/compare/0.1.10...0.1.11) (2016-10-27)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.10"></a>
|
||||
## [0.1.10](https://github.com/kulshekhar/ts-jest/compare/0.1.9...0.1.10) (2016-10-26)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.9"></a>
|
||||
## [0.1.9](https://github.com/kulshekhar/ts-jest/compare/0.1.8...0.1.9) (2016-10-24)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.8"></a>
|
||||
## [0.1.8](https://github.com/kulshekhar/ts-jest/compare/0.1.7...0.1.8) (2016-10-14)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.7"></a>
|
||||
## [0.1.7](https://github.com/kulshekhar/ts-jest/compare/0.1.6...0.1.7) (2016-10-10)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.6"></a>
|
||||
## [0.1.6](https://github.com/kulshekhar/ts-jest/compare/0.1.5...0.1.6) (2016-10-08)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.5"></a>
|
||||
## [0.1.5](https://github.com/kulshekhar/ts-jest/compare/0.1.4...0.1.5) (2016-09-22)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.4"></a>
|
||||
## [0.1.4](https://github.com/kulshekhar/ts-jest/compare/0.1.3...0.1.4) (2016-09-16)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.3"></a>
|
||||
## [0.1.3](https://github.com/kulshekhar/ts-jest/compare/0.1.2...0.1.3) (2016-08-31)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.2"></a>
|
||||
## [0.1.2](https://github.com/kulshekhar/ts-jest/compare/0.1.1...0.1.2) (2016-08-31)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.1"></a>
|
||||
## [0.1.1](https://github.com/kulshekhar/ts-jest/compare/0.1.0...0.1.1) (2016-08-31)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.0"></a>
|
||||
# [0.1.0](https://github.com/kulshekhar/ts-jest/compare/0.0.1...0.1.0) (2016-08-31)
|
||||
|
||||
|
||||
|
||||
<a name="0.0.1"></a>
|
||||
## [0.0.1](https://github.com/kulshekhar/ts-jest/compare/0.0.0...0.0.1) (2016-08-30)
|
||||
|
||||
|
||||
|
||||
<a name="0.0.0"></a>
|
||||
# 0.0.0 (2016-08-30)
|
||||
|
||||
|
||||
|
67
node_modules/ts-jest/CONTRIBUTING.md
generated
vendored
Normal file
67
node_modules/ts-jest/CONTRIBUTING.md
generated
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
# Contributing
|
||||
|
||||
When contributing to this repository, please first discuss the change you wish to make via [slack](https://bit.ly/3bRHFPQ) or [issue](https://github.com/kulshekhar/ts-jest/issues) with the owners of this repository before making a change.
|
||||
|
||||
Please note we have a code of conduct, please follow it in all your interactions with the project.
|
||||
|
||||
## Pull Request Process
|
||||
|
||||
1. Ensure the tests are passing and that you have latest `master` branch merged in.
|
||||
2. Update the `docs/` with details of your changes if required.
|
||||
3. If possible, squash your commits. There must be only one commit in your PR (until a review). Then after each review requesting changes, DO NOT squash your commits with the one before the review, so that we can see intermediate modifications.
|
||||
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
### Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
### Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
### Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
### Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
### Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at kulshekhar@gmail.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
### Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
21
node_modules/ts-jest/LICENSE.md
generated
vendored
Normal file
21
node_modules/ts-jest/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2016-2018
|
||||
|
||||
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.
|
74
node_modules/ts-jest/README.md
generated
vendored
Normal file
74
node_modules/ts-jest/README.md
generated
vendored
Normal file
|
@ -0,0 +1,74 @@
|
|||
<h1 align="center">ts-jest</h1>
|
||||
|
||||
<p align="center">A TypeScript preprocessor with source map support for Jest that lets you use Jest to test projects written in TypeScript.</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/package/ts-jest"><img src="https://img.shields.io/npm/v/ts-jest/latest.svg?style=flat-square" alt="NPM version" /> </a>
|
||||
<a href="https://www.npmjs.com/package/ts-jest"><img src="https://img.shields.io/npm/dm/ts-jest.svg?style=flat-square" alt="NPM downloads"/> </a>
|
||||
<a href="https://snyk.io/test/github/kulshekhar/ts-jest"><img src="https://snyk.io/test/github/kulshekhar/ts-jest/badge.svg?style=flat-square" alt="Known vulnerabilities"/> </a>
|
||||
<a href="https://coveralls.io/github/kulshekhar/ts-jest?branch=master"><img src="https://coveralls.io/repos/github/kulshekhar/ts-jest/badge.svg?branch=master" alt="Coverage status"/> </a>
|
||||
<a href="https://travis-ci.com/kulshekhar/ts-jest"><img src="https://travis-ci.com/kulshekhar/ts-jest.svg?branch=master" alt="Build status"/> </a>
|
||||
<a href="https://actions-badge.atrox.dev/kulshekhar/ts-jest/goto?ref=master"><img alt="GitHub actions" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fkulshekhar%2Fts-jest%2Fbadge%3Fref%3Dmaster&style=flat-square" /> </a>
|
||||
<a href="https://github.com/kulshekhar/ts-jest/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/ts-jest.svg?style=flat-square" alt="GitHub license"/> </a>
|
||||
</p>
|
||||
|
||||
<img src="./icon.png" align="right" title="ts-jest Logo" width="128" height="128">
|
||||
|
||||
It supports all features of TypeScript including type-checking. [Read more about Babel7 + `preset-typescript` **vs** TypeScript (and `ts-jest`)](https://kulshekhar.github.io/ts-jest/user/babel7-or-ts).
|
||||
|
||||
---
|
||||
|
||||
| We are not doing semantic versioning and `23.10` is a re-write, run `npm i -D ts-jest@"<23.10.0"` to go back to the previous version |
|
||||
|---|
|
||||
|
||||
[<img src="./docs/assets/img/documentation.png" align="left" height="24"> View the online documentation (usage & technical)](https://kulshekhar.github.io/ts-jest)
|
||||
|
||||
[<img src="./docs/assets/img/slack.png" align="left" height="24"> Ask for some help in the `ts-jest` community of Slack](https://bit.ly/3bRHFPQ)
|
||||
|
||||
[<img src="./docs/assets/img/troubleshooting.png" align="left" height="24"> Before reporting any issue, be sure to check the troubleshooting page](TROUBLESHOOTING.md)
|
||||
|
||||
[<img src="./docs/assets/img/pull-request.png" align="left" height="24"> We're looking for collaborators! Want to help improve `ts-jest`?](https://github.com/kulshekhar/ts-jest/issues/223)
|
||||
|
||||
---
|
||||
|
||||
## Getting Started
|
||||
|
||||
These instructions will get you setup to use `ts-jest` in your project. For more detailed documentation, please check [online documentation](https://kulshekhar.github.io/ts-jest).
|
||||
|
||||
| | using npm | using yarn |
|
||||
|---:|---|---|
|
||||
| **Prerequisites** | `npm i -D jest typescript` | `yarn add --dev jest typescript` |
|
||||
| **Installing** | `npm i -D ts-jest @types/jest` | `yarn add --dev ts-jest @types/jest` |
|
||||
| **Creating config** | `npx ts-jest config:init` | `yarn ts-jest config:init` |
|
||||
| **Running tests** | `npm t` or `npx jest` | `yarn test` or `yarn jest` |
|
||||
|
||||
## Built With
|
||||
|
||||
* [TypeScript](https://www.typescriptlang.org/) - JavaScript that scales
|
||||
* [Jest](https://jestjs.io/) - Delightful JavaScript Testing
|
||||
* [`ts-jest`](https://kulshekhar.github.io/ts-jest) - Jest processor for TypeScript _(yes, `ts-jest` uses itself for its tests)_
|
||||
|
||||
## Contributing
|
||||
|
||||
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
|
||||
|
||||
## Versioning
|
||||
|
||||
We **DO NOT** use [SemVer](http://semver.org/) for versioning. Though you can think about SemVer when reading our version, except our major number follows the one of Jest. For the versions available, see the [tags on this repository](https://github.com/kulshekhar/ts-jest/tags).
|
||||
|
||||
## Authors/maintainers
|
||||
|
||||
* **Kulshekhar Kabra** - [kulshekhar](https://github.com/kulshekhar)
|
||||
* **Gustav Wengel** - [GeeWee](https://github.com/GeeWee)
|
||||
* **Ahn** - [ahnpnl](https://github.com/ahnpnl)
|
||||
* **Huafu Gandon** - [huafu](https://github.com/huafu)
|
||||
|
||||
See also the list of [contributors](https://github.com/kulshekhar/ts-jest/contributors) who participated in this project.
|
||||
|
||||
## Supporters
|
||||
|
||||
- [JetBrains](https://www.jetbrains.com/?from=ts-jest) has been kind enough to support ts-jest with an [open source license](https://www.jetbrains.com/community/opensource/?from=ts-jest).
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
41
node_modules/ts-jest/TROUBLESHOOTING.md
generated
vendored
Normal file
41
node_modules/ts-jest/TROUBLESHOOTING.md
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Troubleshooting
|
||||
|
||||
## Running ts-jest on CI tools
|
||||
|
||||
### PROBLEM
|
||||
|
||||
Cannot find module "" from ""
|
||||
|
||||
### SOLUTION
|
||||
|
||||
- Check if `rootDir` is referenced correctly. If not add this on your existing jest configuration.
|
||||
|
||||
```javascipt
|
||||
module.exports = {
|
||||
...
|
||||
roots: ["<rootDir>"]
|
||||
}
|
||||
```
|
||||
|
||||
- Check if module directories are included on your jest configuration. If not add this on your existing jest configuration.
|
||||
|
||||
```javascipt
|
||||
module.exports = {
|
||||
...
|
||||
moduleDirectories: ["node_modules","<module-directory>"],
|
||||
modulePaths: ["<path-of-module>"],
|
||||
}
|
||||
```
|
||||
|
||||
- Check if module name is properly mapped and can be referenced by jest. If not, you can define moduleNameMapper for your jest configuration.
|
||||
|
||||
```javascipt
|
||||
module.exports = {
|
||||
...
|
||||
moduleNameMapper: {
|
||||
"<import-path>": "<rootDir>/<real-physical-path>",
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
- Check github folder names if its identical to you local folder names. Sometimes github never updates your folder names even if you rename it locally. If this happens rename your folders via github or use this command `git mv <source> <destination>` and commit changes.
|
3
node_modules/ts-jest/cli.js
generated
vendored
Normal file
3
node_modules/ts-jest/cli.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
require('./dist/cli').processArgv()
|
1
node_modules/ts-jest/dist/cli/config/init.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/cli/config/init.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
154
node_modules/ts-jest/dist/cli/config/init.js
generated
vendored
Normal file
154
node_modules/ts-jest/dist/cli/config/init.js
generated
vendored
Normal file
|
@ -0,0 +1,154 @@
|
|||
"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);
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.help = exports.run = void 0;
|
||||
var fs_1 = require("fs");
|
||||
var json5_1 = require("json5");
|
||||
var path_1 = require("path");
|
||||
var presets_1 = require("../helpers/presets");
|
||||
exports.run = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var file, filePath, name, isPackage, exists, pkgFile, hasPackage, _a, jestPreset, askedTsconfig, force, jsdom, tsconfig, pkgJson, jsFilesProcessor, shouldPostProcessWithBabel, preset, body, base, tsJestConf, content;
|
||||
var _b, _c;
|
||||
return __generator(this, function (_d) {
|
||||
file = (_c = (_b = args._[0]) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : 'jest.config.js';
|
||||
filePath = path_1.join(process.cwd(), file);
|
||||
name = path_1.basename(file);
|
||||
isPackage = name === 'package.json';
|
||||
exists = fs_1.existsSync(filePath);
|
||||
pkgFile = isPackage ? filePath : path_1.join(process.cwd(), 'package.json');
|
||||
hasPackage = isPackage || fs_1.existsSync(pkgFile);
|
||||
_a = args.jestPreset, jestPreset = _a === void 0 ? true : _a, askedTsconfig = args.tsconfig, force = args.force, jsdom = args.jsdom;
|
||||
tsconfig = askedTsconfig === 'tsconfig.json' ? undefined : askedTsconfig;
|
||||
pkgJson = hasPackage ? JSON.parse(fs_1.readFileSync(pkgFile, 'utf8')) : {};
|
||||
jsFilesProcessor = args.js, shouldPostProcessWithBabel = args.babel;
|
||||
if (jsFilesProcessor == null) {
|
||||
jsFilesProcessor = shouldPostProcessWithBabel ? 'babel' : undefined;
|
||||
}
|
||||
else if (shouldPostProcessWithBabel == null) {
|
||||
shouldPostProcessWithBabel = jsFilesProcessor === 'babel';
|
||||
}
|
||||
if (jsFilesProcessor === 'babel') {
|
||||
preset = presets_1.jsWIthBabel;
|
||||
}
|
||||
else if (jsFilesProcessor === 'ts') {
|
||||
preset = presets_1.jsWithTs;
|
||||
}
|
||||
else {
|
||||
preset = presets_1.defaults;
|
||||
}
|
||||
if (isPackage && !exists) {
|
||||
throw new Error("File " + file + " does not exists.");
|
||||
}
|
||||
else if (!isPackage && exists && !force) {
|
||||
throw new Error("Configuration file " + file + " already exists.");
|
||||
}
|
||||
if (!isPackage && !name.endsWith('.js')) {
|
||||
throw new TypeError("Configuration file " + file + " must be a .js file or the package.json.");
|
||||
}
|
||||
if (hasPackage && pkgJson.jest) {
|
||||
if (force && !isPackage) {
|
||||
delete pkgJson.jest;
|
||||
fs_1.writeFileSync(pkgFile, JSON.stringify(pkgJson, undefined, ' '));
|
||||
}
|
||||
else if (!force) {
|
||||
throw new Error("A Jest configuration is already set in " + pkgFile + ".");
|
||||
}
|
||||
}
|
||||
if (isPackage) {
|
||||
base = jestPreset ? { preset: preset.name } : __assign({}, preset.value);
|
||||
if (!jsdom)
|
||||
base.testEnvironment = 'node';
|
||||
if (tsconfig || shouldPostProcessWithBabel) {
|
||||
tsJestConf = {};
|
||||
base.globals = { 'ts-jest': tsJestConf };
|
||||
if (tsconfig)
|
||||
tsJestConf.tsconfig = tsconfig;
|
||||
if (shouldPostProcessWithBabel)
|
||||
tsJestConf.babelConfig = true;
|
||||
}
|
||||
body = JSON.stringify(__assign(__assign({}, pkgJson), { jest: base }), undefined, ' ');
|
||||
}
|
||||
else {
|
||||
content = [];
|
||||
if (!jestPreset) {
|
||||
content.push(preset.jsImport('tsjPreset') + ";", '');
|
||||
}
|
||||
content.push('module.exports = {');
|
||||
if (jestPreset) {
|
||||
content.push(" preset: '" + preset.name + "',");
|
||||
}
|
||||
else {
|
||||
content.push(' ...tsjPreset,');
|
||||
}
|
||||
if (!jsdom)
|
||||
content.push(" testEnvironment: 'node',");
|
||||
if (tsconfig || shouldPostProcessWithBabel) {
|
||||
content.push(' globals: {');
|
||||
content.push(" 'ts-jest': {");
|
||||
if (tsconfig)
|
||||
content.push(" tsconfig: " + json5_1.stringify(tsconfig) + ",");
|
||||
if (shouldPostProcessWithBabel)
|
||||
content.push(' babelConfig: true,');
|
||||
content.push(' },');
|
||||
content.push(' },');
|
||||
}
|
||||
content.push('};');
|
||||
body = content.join('\n');
|
||||
}
|
||||
fs_1.writeFileSync(filePath, body);
|
||||
process.stderr.write("\nJest configuration written to \"" + filePath + "\".\n");
|
||||
return [2];
|
||||
});
|
||||
}); };
|
||||
exports.help = function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
process.stdout.write("\nUsage:\n ts-jest config:init [options] [<config-file>]\n\nArguments:\n <config-file> Can be a js or json Jest config file. If it is a\n package.json file, the configuration will be read from\n the \"jest\" property.\n Default: jest.config.js\n\nOptions:\n --force Discard any existing Jest config\n --js ts|babel Process .js files with ts-jest if 'ts' or with\n babel-jest if 'babel'\n --no-jest-preset Disable the use of Jest presets\n --tsconfig <file> Path to the tsconfig.json file\n --babel Pipe babel-jest after ts-jest\n --jsdom Use jsdom as test environment instead of node\n");
|
||||
return [2];
|
||||
});
|
||||
}); };
|
1
node_modules/ts-jest/dist/cli/config/migrate.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/cli/config/migrate.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
219
node_modules/ts-jest/dist/cli/config/migrate.js
generated
vendored
Normal file
219
node_modules/ts-jest/dist/cli/config/migrate.js
generated
vendored
Normal file
|
@ -0,0 +1,219 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spread = (this && this.__spread) || function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.help = exports.run = void 0;
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var stableStringify = require("fast-json-stable-stringify");
|
||||
var fs_1 = require("fs");
|
||||
var json5_1 = require("json5");
|
||||
var path_1 = require("path");
|
||||
var backports_1 = require("../../utils/backports");
|
||||
var presets_1 = require("../helpers/presets");
|
||||
exports.run = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var nullLogger, file, filePath, footNotes, name, isPackage, actualConfig, migratedConfig, presetName, preset, jsTransformers, jsWithTs, jsWithBabel, presetValue, migratedValue, presetValue, migratedValue, before, after, stringify, prefix;
|
||||
var _a;
|
||||
return __generator(this, function (_b) {
|
||||
nullLogger = bs_logger_1.createLogger({ targets: [] });
|
||||
file = (_a = args._[0]) === null || _a === void 0 ? void 0 : _a.toString();
|
||||
filePath = path_1.resolve(process.cwd(), file);
|
||||
footNotes = [];
|
||||
if (!fs_1.existsSync(filePath)) {
|
||||
throw new Error("Configuration file " + file + " does not exists.");
|
||||
}
|
||||
name = path_1.basename(file);
|
||||
isPackage = name === 'package.json';
|
||||
if (!/\.(js|json)$/.test(name)) {
|
||||
throw new TypeError("Configuration file " + file + " must be a JavaScript or JSON file.");
|
||||
}
|
||||
actualConfig = require(filePath);
|
||||
if (isPackage) {
|
||||
actualConfig = actualConfig.jest;
|
||||
}
|
||||
if (!actualConfig)
|
||||
actualConfig = {};
|
||||
migratedConfig = backports_1.backportJestConfig(nullLogger, actualConfig);
|
||||
if (!migratedConfig.preset && args.jestPreset) {
|
||||
if (args.js) {
|
||||
presetName = args.js === 'babel' ? "ts-jest/presets/js-with-babel" : "ts-jest/presets/js-with-ts";
|
||||
}
|
||||
else {
|
||||
jsTransformers = Object.keys(migratedConfig.transform || {}).reduce(function (list, pattern) {
|
||||
if (RegExp(pattern.replace(/^<rootDir>\/?/, '/dummy-project/')).test('/dummy-project/src/foo.js')) {
|
||||
var transformer = migratedConfig.transform[pattern];
|
||||
if (/\bbabel-jest\b/.test(transformer))
|
||||
transformer = 'babel-jest';
|
||||
else if (/\ts-jest\b/.test(transformer))
|
||||
transformer = 'ts-jest';
|
||||
return __spread(list, [transformer]);
|
||||
}
|
||||
return list;
|
||||
}, []);
|
||||
jsWithTs = jsTransformers.includes('ts-jest');
|
||||
jsWithBabel = jsTransformers.includes('babel-jest');
|
||||
if (jsWithBabel && !jsWithTs) {
|
||||
presetName = "ts-jest/presets/js-with-babel";
|
||||
}
|
||||
else if (jsWithTs && !jsWithBabel) {
|
||||
presetName = "ts-jest/presets/js-with-ts";
|
||||
}
|
||||
else {
|
||||
presetName = "ts-jest/presets/default";
|
||||
}
|
||||
}
|
||||
presetName = presetName || "ts-jest/presets/default";
|
||||
preset = presets_1.allPresets[presetName];
|
||||
footNotes.push("Detected preset '" + preset.label + "' as the best matching preset for your configuration.\nVisit https://kulshekhar.github.io/ts-jest/user/config/#jest-preset for more information about presets.\n");
|
||||
}
|
||||
else if (migratedConfig.preset && migratedConfig.preset.startsWith('ts-jest')) {
|
||||
if (args.jestPreset === false) {
|
||||
delete migratedConfig.preset;
|
||||
}
|
||||
else {
|
||||
preset = presets_1.allPresets[migratedConfig.preset] || presets_1.defaults;
|
||||
}
|
||||
}
|
||||
if (preset)
|
||||
migratedConfig.preset = preset.name;
|
||||
if (migratedConfig.moduleFileExtensions && migratedConfig.moduleFileExtensions.length && preset) {
|
||||
presetValue = dedupSort(preset.value.moduleFileExtensions || []).join('::');
|
||||
migratedValue = dedupSort(migratedConfig.moduleFileExtensions).join('::');
|
||||
if (presetValue === migratedValue) {
|
||||
delete migratedConfig.moduleFileExtensions;
|
||||
}
|
||||
}
|
||||
if (migratedConfig.testRegex && preset) {
|
||||
migratedConfig.testMatch = null;
|
||||
}
|
||||
else if (migratedConfig.testMatch && migratedConfig.testMatch.length && preset) {
|
||||
presetValue = dedupSort(preset.value.testMatch || []).join('::');
|
||||
migratedValue = dedupSort(migratedConfig.testMatch).join('::');
|
||||
if (presetValue === migratedValue) {
|
||||
delete migratedConfig.testMatch;
|
||||
}
|
||||
}
|
||||
if (migratedConfig.transform) {
|
||||
Object.keys(migratedConfig.transform).forEach(function (key) {
|
||||
var val = migratedConfig.transform[key];
|
||||
if (typeof val === 'string' && /\/?ts-jest(?:\/preprocessor\.js)?$/.test(val)) {
|
||||
;
|
||||
migratedConfig.transform[key] = 'ts-jest';
|
||||
}
|
||||
});
|
||||
}
|
||||
if (preset &&
|
||||
migratedConfig.transform &&
|
||||
stableStringify(migratedConfig.transform) === stableStringify(preset.value.transform)) {
|
||||
delete migratedConfig.transform;
|
||||
}
|
||||
cleanupConfig(actualConfig);
|
||||
cleanupConfig(migratedConfig);
|
||||
before = stableStringify(actualConfig);
|
||||
after = stableStringify(migratedConfig);
|
||||
if (after === before) {
|
||||
process.stderr.write("\nNo migration needed for given Jest configuration\n ");
|
||||
return [2];
|
||||
}
|
||||
stringify = file.endsWith('.json') ? JSON.stringify : json5_1.stringify;
|
||||
prefix = file.endsWith('.json') ? '"jest": ' : 'module.exports = ';
|
||||
if (preset && migratedConfig.transform) {
|
||||
footNotes.push("\nI couldn't check if your \"transform\" value is the same as mine which is: " + stringify(preset.value.transform, undefined, ' ') + "\nIf it is the case, you can safely remove the \"transform\" from what I've migrated.\n");
|
||||
}
|
||||
process.stderr.write("\nMigrated Jest configuration:\n");
|
||||
process.stdout.write("" + prefix + stringify(migratedConfig, undefined, ' ') + "\n");
|
||||
if (footNotes.length) {
|
||||
process.stderr.write("\n" + footNotes.join('\n') + "\n");
|
||||
}
|
||||
return [2];
|
||||
});
|
||||
}); };
|
||||
function cleanupConfig(config) {
|
||||
if (config.globals) {
|
||||
if (config.globals['ts-jest'] && Object.keys(config.globals['ts-jest']).length === 0) {
|
||||
delete config.globals['ts-jest'];
|
||||
}
|
||||
if (Object.keys(config.globals).length === 0) {
|
||||
delete config.globals;
|
||||
}
|
||||
}
|
||||
if (config.transform && Object.keys(config.transform).length === 0) {
|
||||
delete config.transform;
|
||||
}
|
||||
if (config.moduleFileExtensions) {
|
||||
config.moduleFileExtensions = dedupSort(config.moduleFileExtensions);
|
||||
if (config.moduleFileExtensions.length === 0)
|
||||
delete config.moduleFileExtensions;
|
||||
}
|
||||
if (config.testMatch) {
|
||||
config.testMatch = dedupSort(config.testMatch);
|
||||
if (config.testMatch.length === 0)
|
||||
delete config.testMatch;
|
||||
}
|
||||
if (config.preset === "ts-jest/presets/default")
|
||||
config.preset = presets_1.defaults.name;
|
||||
}
|
||||
function dedupSort(arr) {
|
||||
return arr
|
||||
.filter(function (s, i, a) { return a.findIndex(function (e) { return s.toString() === e.toString(); }) === i; })
|
||||
.sort(function (a, b) { return (a.toString() > b.toString() ? 1 : a.toString() < b.toString() ? -1 : 0); });
|
||||
}
|
||||
exports.help = function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
process.stdout.write("\nUsage:\n ts-jest config:migrate [options] <config-file>\n\nArguments:\n <config-file> Can be a js or json Jest config file. If it is a\n package.json file, the configuration will be read from\n the \"jest\" property.\n\nOptions:\n --js ts|babel Process .js files with ts-jest if 'ts' or with\n babel-jest if 'babel'\n --no-jest-preset Disable the use of Jest presets\n");
|
||||
return [2];
|
||||
});
|
||||
}); };
|
1
node_modules/ts-jest/dist/cli/help.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/cli/help.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
46
node_modules/ts-jest/dist/cli/help.js
generated
vendored
Normal file
46
node_modules/ts-jest/dist/cli/help.js
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.help = exports.run = void 0;
|
||||
exports.run = function (_) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
process.stdout.write("\nUsage:\n ts-jest command [options] [...args]\n\nCommands:\n config:init Creates initial Jest configuration\n config:migrate Migrates a given Jest configuration\n help [command] Show this help, or help about a command\n\nExample:\n ts-jest help config:migrate\n");
|
||||
return [2];
|
||||
});
|
||||
}); };
|
||||
exports.help = exports.run;
|
1
node_modules/ts-jest/dist/cli/helpers/presets.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/cli/helpers/presets.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
35
node_modules/ts-jest/dist/cli/helpers/presets.js
generated
vendored
Normal file
35
node_modules/ts-jest/dist/cli/helpers/presets.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.jsWIthBabel = exports.jsWithTs = exports.defaults = exports.allPresets = void 0;
|
||||
var definePreset = function (fullName) { return ({
|
||||
fullName: fullName,
|
||||
get name() {
|
||||
return this.isDefault ? 'ts-jest' : fullName;
|
||||
},
|
||||
get label() {
|
||||
return fullName.split('/').pop();
|
||||
},
|
||||
get jsVarName() {
|
||||
return this.isDefault
|
||||
? 'defaults'
|
||||
:
|
||||
fullName
|
||||
.split('/')
|
||||
.pop()
|
||||
.replace(/\-([a-z])/g, function (_, l) { return l.toUpperCase(); });
|
||||
},
|
||||
get value() {
|
||||
return require("../../../" + fullName.replace(/^ts-jest\//, '') + "/jest-preset");
|
||||
},
|
||||
jsImport: function (varName) {
|
||||
if (varName === void 0) { varName = 'tsjPreset'; }
|
||||
return "const { " + this.jsVarName + ": " + varName + " } = require('ts-jest/presets')";
|
||||
},
|
||||
get isDefault() {
|
||||
return fullName === "ts-jest/presets/default";
|
||||
},
|
||||
}); };
|
||||
exports.allPresets = {};
|
||||
exports.defaults = (exports.allPresets["ts-jest/presets/default"] = definePreset("ts-jest/presets/default"));
|
||||
exports.jsWithTs = (exports.allPresets["ts-jest/presets/js-with-ts"] = definePreset("ts-jest/presets/js-with-ts"));
|
||||
exports.jsWIthBabel = (exports.allPresets["ts-jest/presets/js-with-babel"] = definePreset("ts-jest/presets/js-with-babel"));
|
1
node_modules/ts-jest/dist/cli/index.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/cli/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
107
node_modules/ts-jest/dist/cli/index.js
generated
vendored
Normal file
107
node_modules/ts-jest/dist/cli/index.js
generated
vendored
Normal file
|
@ -0,0 +1,107 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.processArgv = void 0;
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var yargs_parser_1 = __importDefault(require("yargs-parser"));
|
||||
var logger_1 = require("../utils/logger");
|
||||
var VALID_COMMANDS = ['help', 'config:migrate', 'config:init'];
|
||||
var logger = logger_1.rootLogger.child((_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'cli', _a[bs_logger_1.LogContexts.application] = 'ts-jest', _a));
|
||||
function cli(args) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var parsedArgv, command, isHelp, _a, run, help, cmd;
|
||||
return __generator(this, function (_b) {
|
||||
parsedArgv = yargs_parser_1.default(args, {
|
||||
boolean: ['dry-run', 'jest-preset', 'allow-js', 'diff', 'babel', 'force', 'jsdom'],
|
||||
string: ['tsconfig', 'js'],
|
||||
count: ['verbose'],
|
||||
alias: { verbose: ['v'] },
|
||||
default: { jestPreset: true, verbose: 0 },
|
||||
coerce: {
|
||||
js: function (val) {
|
||||
var res = val.trim().toLowerCase();
|
||||
if (!['babel', 'ts'].includes(res))
|
||||
throw new Error("The 'js' option must be 'babel' or 'ts', given: '" + val + "'.");
|
||||
return res;
|
||||
},
|
||||
},
|
||||
});
|
||||
if (parsedArgv.allowJs != null) {
|
||||
if (parsedArgv.js)
|
||||
throw new Error("The 'allowJs' and 'js' options cannot be set together.");
|
||||
parsedArgv.js = parsedArgv.allowJs ? 'ts' : undefined;
|
||||
}
|
||||
command = parsedArgv._.shift();
|
||||
isHelp = command === 'help';
|
||||
if (isHelp)
|
||||
command = parsedArgv._.shift();
|
||||
if (!VALID_COMMANDS.includes(command))
|
||||
command = 'help';
|
||||
_a = require("./" + command.replace(/:/g, '/')), run = _a.run, help = _a.help;
|
||||
cmd = isHelp && command !== 'help' ? help : run;
|
||||
return [2, cmd(parsedArgv, logger)];
|
||||
});
|
||||
});
|
||||
}
|
||||
function processArgv() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var err_1;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
_a.trys.push([0, 2, , 3]);
|
||||
return [4, cli(process.argv.slice(2))];
|
||||
case 1:
|
||||
_a.sent();
|
||||
process.exit(0);
|
||||
return [3, 3];
|
||||
case 2:
|
||||
err_1 = _a.sent();
|
||||
logger.fatal(err_1.message);
|
||||
process.exit(1);
|
||||
return [3, 3];
|
||||
case 3: return [2];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.processArgv = processArgv;
|
2
node_modules/ts-jest/dist/compiler/instance.d.ts
generated
vendored
Normal file
2
node_modules/ts-jest/dist/compiler/instance.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export declare const SOURCE_MAPPING_PREFIX = "sourceMappingURL=";
|
||||
export declare function updateOutput(outputText: string, normalizedFileName: string, sourceMap: string): string;
|
55
node_modules/ts-jest/dist/compiler/instance.js
generated
vendored
Normal file
55
node_modules/ts-jest/dist/compiler/instance.js
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
"use strict";
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createCompilerInstance = exports.updateOutput = exports.SOURCE_MAPPING_PREFIX = void 0;
|
||||
var language_service_1 = require("./language-service");
|
||||
var transpiler_1 = require("./transpiler");
|
||||
var json_1 = require("../utils/json");
|
||||
exports.SOURCE_MAPPING_PREFIX = 'sourceMappingURL=';
|
||||
function updateOutput(outputText, normalizedFileName, sourceMap) {
|
||||
var base64Map = Buffer.from(updateSourceMap(sourceMap, normalizedFileName), 'utf8').toString('base64');
|
||||
var sourceMapContent = "data:application/json;charset=utf-8;base64," + base64Map;
|
||||
return (outputText.slice(0, outputText.lastIndexOf(exports.SOURCE_MAPPING_PREFIX) + exports.SOURCE_MAPPING_PREFIX.length) + sourceMapContent);
|
||||
}
|
||||
exports.updateOutput = updateOutput;
|
||||
var updateSourceMap = function (sourceMapText, normalizedFileName) {
|
||||
var sourceMap = JSON.parse(sourceMapText);
|
||||
sourceMap.file = normalizedFileName;
|
||||
sourceMap.sources = [normalizedFileName];
|
||||
delete sourceMap.sourceRoot;
|
||||
return json_1.stringify(sourceMap);
|
||||
};
|
||||
var compileAndUpdateOutput = function (compileFn, logger) { return function (code, fileName, lineOffset) {
|
||||
logger.debug({ fileName: fileName }, 'compileAndUpdateOutput(): get compile output');
|
||||
var _a = __read(compileFn(code, fileName, lineOffset), 2), value = _a[0], sourceMap = _a[1];
|
||||
return updateOutput(value, fileName, sourceMap);
|
||||
}; };
|
||||
exports.createCompilerInstance = function (configs) {
|
||||
var logger = configs.logger.child({ namespace: 'ts-compiler' });
|
||||
var compilerOptions = configs.parsedTsConfig.options;
|
||||
var extensions = ['.ts', '.tsx'];
|
||||
if (compilerOptions.allowJs) {
|
||||
extensions.push('.js');
|
||||
extensions.push('.jsx');
|
||||
}
|
||||
var compilerInstance = !configs.isolatedModules
|
||||
? language_service_1.initializeLanguageServiceInstance(configs, logger)
|
||||
: transpiler_1.initializeTranspilerInstance(configs, logger);
|
||||
var compile = compileAndUpdateOutput(compilerInstance.compileFn, logger);
|
||||
return { cwd: configs.cwd, compile: compile, program: compilerInstance.program };
|
||||
};
|
1
node_modules/ts-jest/dist/compiler/language-service.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/compiler/language-service.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
286
node_modules/ts-jest/dist/compiler/language-service.js
generated
vendored
Normal file
286
node_modules/ts-jest/dist/compiler/language-service.js
generated
vendored
Normal file
|
@ -0,0 +1,286 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spread = (this && this.__spread) || function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.initializeLanguageServiceInstance = void 0;
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var fs_1 = require("fs");
|
||||
var path_1 = require("path");
|
||||
var memoize = require("lodash/memoize");
|
||||
var mkdirp = require("mkdirp");
|
||||
var constants_1 = require("../constants");
|
||||
var messages_1 = require("../utils/messages");
|
||||
var json_1 = require("../utils/json");
|
||||
var sha1_1 = require("../utils/sha1");
|
||||
function doTypeChecking(configs, diagnosedFiles, fileName, service, logger) {
|
||||
if (configs.shouldReportDiagnostics(fileName)) {
|
||||
var diagnostics = service.getSemanticDiagnostics(fileName).concat(service.getSyntacticDiagnostics(fileName));
|
||||
diagnosedFiles.push(fileName);
|
||||
configs.raiseDiagnostics(diagnostics, fileName, logger);
|
||||
}
|
||||
}
|
||||
exports.initializeLanguageServiceInstance = function (configs, logger) {
|
||||
var _a;
|
||||
logger.debug('initializeLanguageServiceInstance(): create typescript compiler');
|
||||
var ts = configs.compilerModule;
|
||||
var cwd = configs.cwd;
|
||||
var cacheDir = configs.tsCacheDir;
|
||||
var _b = configs.parsedTsConfig, options = _b.options, fileNames = _b.fileNames;
|
||||
var diagnosedFiles = [];
|
||||
var serviceHostTraceCtx = (_a = {
|
||||
namespace: 'ts:serviceHost',
|
||||
call: null
|
||||
},
|
||||
_a[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.trace,
|
||||
_a);
|
||||
var memoryCache = {
|
||||
files: new Map(),
|
||||
resolvedModules: new Map(),
|
||||
};
|
||||
var tsResolvedModulesCachePath;
|
||||
if (cacheDir) {
|
||||
mkdirp.sync(cacheDir);
|
||||
tsResolvedModulesCachePath = path_1.join(cacheDir, sha1_1.sha1('ts-jest-resolved-modules', '\x00'));
|
||||
try {
|
||||
var cachedTSResolvedModules = fs_1.readFileSync(tsResolvedModulesCachePath, 'utf-8');
|
||||
memoryCache.resolvedModules = new Map(json_1.parse(cachedTSResolvedModules));
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
configs.parsedTsConfig.fileNames
|
||||
.filter(function (fileName) { return constants_1.TS_TSX_REGEX.test(path_1.extname(fileName)) && !configs.isTestFile(fileName); })
|
||||
.forEach(function (fileName) {
|
||||
memoryCache.files.set(fileName, {
|
||||
version: 0,
|
||||
});
|
||||
});
|
||||
function isFileInCache(fileName) {
|
||||
return memoryCache.files.has(fileName) && memoryCache.files.get(fileName).version !== 0;
|
||||
}
|
||||
var cacheReadFile = logger.wrap(serviceHostTraceCtx, 'readFile', memoize(ts.sys.readFile));
|
||||
var moduleResolutionHost = {
|
||||
fileExists: memoize(ts.sys.fileExists),
|
||||
readFile: cacheReadFile,
|
||||
directoryExists: memoize(ts.sys.directoryExists),
|
||||
getCurrentDirectory: function () { return cwd; },
|
||||
realpath: ts.sys.realpath && memoize(ts.sys.realpath),
|
||||
getDirectories: memoize(ts.sys.getDirectories),
|
||||
};
|
||||
var moduleResolutionCache = ts.createModuleResolutionCache(cwd, function (x) { return x; }, options);
|
||||
function resolveModuleNames(moduleNames, containingFile) {
|
||||
var _a;
|
||||
var normalizedContainingFile = path_1.normalize(containingFile);
|
||||
var currentResolvedModules = (_a = memoryCache.resolvedModules.get(normalizedContainingFile)) !== null && _a !== void 0 ? _a : [];
|
||||
return moduleNames.map(function (moduleName) {
|
||||
var resolveModuleName = ts.resolveModuleName(moduleName, containingFile, options, moduleResolutionHost, moduleResolutionCache);
|
||||
var resolvedModule = resolveModuleName.resolvedModule;
|
||||
if (configs.isTestFile(normalizedContainingFile) && resolvedModule) {
|
||||
var normalizedResolvedFileName = path_1.normalize(resolvedModule.resolvedFileName);
|
||||
if (!currentResolvedModules.includes(normalizedResolvedFileName)) {
|
||||
currentResolvedModules.push(normalizedResolvedFileName);
|
||||
memoryCache.resolvedModules.set(normalizedContainingFile, currentResolvedModules);
|
||||
}
|
||||
}
|
||||
return resolvedModule;
|
||||
});
|
||||
}
|
||||
var projectVersion = 1;
|
||||
var updateMemoryCache = function (contents, fileName) {
|
||||
logger.debug({ fileName: fileName }, 'updateMemoryCache(): update memory cache for language service');
|
||||
var shouldIncrementProjectVersion = false;
|
||||
var hit = isFileInCache(fileName);
|
||||
if (!hit) {
|
||||
memoryCache.files.set(fileName, {
|
||||
text: contents,
|
||||
version: 1,
|
||||
});
|
||||
shouldIncrementProjectVersion = true;
|
||||
}
|
||||
else {
|
||||
var previousContents = memoryCache.files.get(fileName).text;
|
||||
if (previousContents !== contents) {
|
||||
memoryCache.files.set(fileName, {
|
||||
text: contents,
|
||||
version: memoryCache.files.get(fileName).version + 1,
|
||||
});
|
||||
if (hit)
|
||||
shouldIncrementProjectVersion = true;
|
||||
}
|
||||
if (!fileNames.includes(fileName)) {
|
||||
shouldIncrementProjectVersion = true;
|
||||
}
|
||||
}
|
||||
if (shouldIncrementProjectVersion)
|
||||
projectVersion++;
|
||||
};
|
||||
var serviceHost = {
|
||||
getProjectVersion: function () { return String(projectVersion); },
|
||||
getScriptFileNames: function () { return __spread(memoryCache.files.keys()); },
|
||||
getScriptVersion: function (fileName) {
|
||||
var _a;
|
||||
var normalizedFileName = path_1.normalize(fileName);
|
||||
var version = (_a = memoryCache.files.get(normalizedFileName)) === null || _a === void 0 ? void 0 : _a.version;
|
||||
return version === undefined ? undefined : String(version);
|
||||
},
|
||||
getScriptSnapshot: function (fileName) {
|
||||
var _a;
|
||||
var normalizedFileName = path_1.normalize(fileName);
|
||||
var hit = isFileInCache(normalizedFileName);
|
||||
logger.trace({ normalizedFileName: normalizedFileName, cacheHit: hit }, 'getScriptSnapshot():', 'cache', hit ? 'hit' : 'miss');
|
||||
if (!hit) {
|
||||
memoryCache.files.set(normalizedFileName, {
|
||||
text: cacheReadFile(normalizedFileName),
|
||||
version: 1,
|
||||
});
|
||||
}
|
||||
var contents = (_a = memoryCache.files.get(normalizedFileName)) === null || _a === void 0 ? void 0 : _a.text;
|
||||
if (contents === undefined)
|
||||
return;
|
||||
return ts.ScriptSnapshot.fromString(contents);
|
||||
},
|
||||
fileExists: memoize(ts.sys.fileExists),
|
||||
readFile: cacheReadFile,
|
||||
readDirectory: memoize(ts.sys.readDirectory),
|
||||
getDirectories: memoize(ts.sys.getDirectories),
|
||||
directoryExists: memoize(ts.sys.directoryExists),
|
||||
realpath: ts.sys.realpath && memoize(ts.sys.realpath),
|
||||
getNewLine: function () { return constants_1.LINE_FEED; },
|
||||
getCurrentDirectory: function () { return cwd; },
|
||||
getCompilationSettings: function () { return options; },
|
||||
getDefaultLibFileName: function () { return ts.getDefaultLibFilePath(options); },
|
||||
getCustomTransformers: function () { return configs.customTransformers; },
|
||||
resolveModuleNames: resolveModuleNames,
|
||||
};
|
||||
logger.debug('initializeLanguageServiceInstance(): creating language service');
|
||||
var service = ts.createLanguageService(serviceHost, ts.createDocumentRegistry());
|
||||
return {
|
||||
compileFn: function (code, fileName) {
|
||||
var e_1, _a;
|
||||
var _b;
|
||||
logger.debug({ fileName: fileName }, 'compileFn(): compiling using language service');
|
||||
updateMemoryCache(code, fileName);
|
||||
var output = service.getEmitOutput(fileName);
|
||||
if (tsResolvedModulesCachePath) {
|
||||
void (function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4, fs_1.writeFile(tsResolvedModulesCachePath, json_1.stringify(__spread(memoryCache.resolvedModules)), function () { })];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2];
|
||||
}
|
||||
});
|
||||
}); })();
|
||||
}
|
||||
if (!diagnosedFiles.includes(fileName)) {
|
||||
logger.debug({ fileName: fileName }, 'compileFn(): computing diagnostics using language service');
|
||||
doTypeChecking(configs, diagnosedFiles, fileName, service, logger);
|
||||
}
|
||||
if (!configs.isTestFile(fileName)) {
|
||||
try {
|
||||
for (var _c = __values(memoryCache.resolvedModules.entries()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
||||
var _e = __read(_d.value, 2), testFileName = _e[0], resolvedModules = _e[1];
|
||||
if (resolvedModules.includes(fileName) &&
|
||||
!diagnosedFiles.includes(testFileName) &&
|
||||
fs_1.existsSync(testFileName)) {
|
||||
var testFileContent = (_b = memoryCache.files.get(testFileName)) === null || _b === void 0 ? void 0 : _b.text;
|
||||
if (!testFileContent) {
|
||||
updateMemoryCache(cacheReadFile(testFileName), testFileName);
|
||||
}
|
||||
logger.debug({ testFileName: testFileName }, 'compileFn(): computing diagnostics using language service for test file which uses the module');
|
||||
doTypeChecking(configs, diagnosedFiles, testFileName, service, logger);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
}
|
||||
if (output.emitSkipped) {
|
||||
if (constants_1.TS_TSX_REGEX.test(fileName)) {
|
||||
throw new Error(messages_1.interpolate("Unable to process '{{file}}', please make sure that `outDir` in your tsconfig is neither `''` or `'.'`. You can also configure Jest config option `transformIgnorePatterns` to inform `ts-jest` to transform {{file}}", { file: fileName }));
|
||||
}
|
||||
else {
|
||||
logger.warn(messages_1.interpolate("Unable to process '{{file}}', falling back to original file content. You can also configure Jest config option `transformIgnorePatterns` to ignore {{file}} from transformation or make sure that `outDir` in your tsconfig is neither `''` or `'.'`", { file: fileName }));
|
||||
return [code, '{}'];
|
||||
}
|
||||
}
|
||||
if (!output.outputFiles.length) {
|
||||
throw new TypeError(messages_1.interpolate("Unable to require `.d.ts` file for file: {{file}}.\nThis is usually the result of a faulty configuration or import. Make sure there is a `.js`, `.json` or another executable extension available alongside `{{file}}`.", {
|
||||
file: path_1.basename(fileName),
|
||||
}));
|
||||
}
|
||||
return [output.outputFiles[1].text, output.outputFiles[0].text];
|
||||
},
|
||||
program: service.getProgram(),
|
||||
};
|
||||
};
|
1
node_modules/ts-jest/dist/compiler/transpiler.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/compiler/transpiler.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
24
node_modules/ts-jest/dist/compiler/transpiler.js
generated
vendored
Normal file
24
node_modules/ts-jest/dist/compiler/transpiler.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.initializeTranspilerInstance = void 0;
|
||||
exports.initializeTranspilerInstance = function (configs, logger) {
|
||||
logger.debug('initializeTranspilerInstance(): create typescript compiler');
|
||||
var options = configs.parsedTsConfig.options;
|
||||
var ts = configs.compilerModule;
|
||||
return {
|
||||
compileFn: function (code, fileName) {
|
||||
logger.debug({ fileName: fileName }, 'compileFn(): compiling as isolated module');
|
||||
var result = ts.transpileModule(code, {
|
||||
fileName: fileName,
|
||||
transformers: configs.customTransformers,
|
||||
compilerOptions: options,
|
||||
reportDiagnostics: configs.shouldReportDiagnostics(fileName),
|
||||
});
|
||||
if (result.diagnostics && configs.shouldReportDiagnostics(fileName)) {
|
||||
configs.raiseDiagnostics(result.diagnostics, fileName, logger);
|
||||
}
|
||||
return [result.outputText, result.sourceMapText];
|
||||
},
|
||||
program: undefined,
|
||||
};
|
||||
};
|
28
node_modules/ts-jest/dist/config/config-set.d.ts
generated
vendored
Normal file
28
node_modules/ts-jest/dist/config/config-set.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
import type { Config } from '@jest/types';
|
||||
import { Logger } from 'bs-logger';
|
||||
import { CompilerOptions, CustomTransformers, Diagnostic, ParsedCommandLine } from 'typescript';
|
||||
import type { TTypeScript } from '../types';
|
||||
import type { RawCompilerOptions } from '../tsconfig-raw';
|
||||
export declare class ConfigSet {
|
||||
private readonly parentLogger?;
|
||||
readonly logger: Logger;
|
||||
readonly compilerModule: TTypeScript;
|
||||
readonly isolatedModules: boolean;
|
||||
readonly cwd: string;
|
||||
tsCacheDir: string | undefined;
|
||||
parsedTsConfig: ParsedCommandLine | Record<string, any>;
|
||||
customTransformers: CustomTransformers;
|
||||
readonly rootDir: string;
|
||||
protected _overriddenCompilerOptions: Partial<CompilerOptions>;
|
||||
constructor(jestConfig: Config.ProjectConfig | undefined, parentLogger?: Logger | undefined);
|
||||
protected _resolveTsConfig(compilerOptions?: RawCompilerOptions, resolvedConfigFile?: string): Record<string, any>;
|
||||
get tsJestDigest(): string;
|
||||
isTestFile(fileName: string): boolean;
|
||||
shouldStringifyContent(filePath: string): boolean;
|
||||
raiseDiagnostics(diagnostics: Diagnostic[], filePath?: string, logger?: Logger): void;
|
||||
shouldReportDiagnostics(filePath: string): boolean;
|
||||
resolvePath(inputPath: string, { throwIfMissing, nodeResolve }?: {
|
||||
throwIfMissing?: boolean;
|
||||
nodeResolve?: boolean;
|
||||
}): string;
|
||||
}
|
531
node_modules/ts-jest/dist/config/config-set.js
generated
vendored
Normal file
531
node_modules/ts-jest/dist/config/config-set.js
generated
vendored
Normal file
|
@ -0,0 +1,531 @@
|
|||
"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);
|
||||
};
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spread = (this && this.__spread) || function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ConfigSet = exports.TS_JEST_OUT_DIR = exports.IGNORE_DIAGNOSTIC_CODES = exports.MY_DIGEST = void 0;
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var fs_1 = require("fs");
|
||||
var jest_util_1 = require("jest-util");
|
||||
var json5 = require("json5");
|
||||
var path_1 = require("path");
|
||||
var typescript_1 = require("typescript");
|
||||
var instance_1 = require("../compiler/instance");
|
||||
var constants_1 = require("../constants");
|
||||
var hoist_jest_1 = require("../transformers/hoist-jest");
|
||||
var backports_1 = require("../utils/backports");
|
||||
var importer_1 = require("../utils/importer");
|
||||
var json_1 = require("../utils/json");
|
||||
var logger_1 = require("../utils/logger");
|
||||
var memoize_1 = require("../utils/memoize");
|
||||
var messages_1 = require("../utils/messages");
|
||||
var normalize_slashes_1 = require("../utils/normalize-slashes");
|
||||
var sha1_1 = require("../utils/sha1");
|
||||
var ts_error_1 = require("../utils/ts-error");
|
||||
exports.MY_DIGEST = fs_1.readFileSync(path_1.resolve(__dirname, '..', '..', '.ts-jest-digest'), 'utf8');
|
||||
exports.IGNORE_DIAGNOSTIC_CODES = [
|
||||
6059,
|
||||
18002,
|
||||
18003,
|
||||
];
|
||||
exports.TS_JEST_OUT_DIR = '$$ts-jest$$';
|
||||
var TARGET_TO_VERSION_MAPPING = (_a = {},
|
||||
_a[typescript_1.ScriptTarget.ES2018] = 'es2018',
|
||||
_a[typescript_1.ScriptTarget.ES2019] = 'es2019',
|
||||
_a[typescript_1.ScriptTarget.ES2020] = 'es2020',
|
||||
_a[typescript_1.ScriptTarget.ESNext] = 'ESNext',
|
||||
_a);
|
||||
var normalizeRegex = function (pattern) {
|
||||
return pattern ? (typeof pattern === 'string' ? pattern : pattern.source) : undefined;
|
||||
};
|
||||
var toDiagnosticCode = function (code) { var _a; return code ? (_a = parseInt(("" + code).trim().replace(/^TS/, ''), 10)) !== null && _a !== void 0 ? _a : undefined : undefined; };
|
||||
var toDiagnosticCodeList = function (items, into) {
|
||||
var e_1, _a;
|
||||
if (into === void 0) { into = []; }
|
||||
try {
|
||||
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
|
||||
var item = items_1_1.value;
|
||||
if (typeof item === 'string') {
|
||||
var children = item.trim().split(/\s*,\s*/g);
|
||||
if (children.length > 1) {
|
||||
toDiagnosticCodeList(children, into);
|
||||
continue;
|
||||
}
|
||||
item = children[0];
|
||||
}
|
||||
if (!item)
|
||||
continue;
|
||||
var code = toDiagnosticCode(item);
|
||||
if (code && !into.includes(code))
|
||||
into.push(code);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
return into;
|
||||
};
|
||||
var ConfigSet = (function () {
|
||||
function ConfigSet(jestConfig, parentLogger) {
|
||||
var _a, _b;
|
||||
var _c, _d, _e, _f;
|
||||
this.parentLogger = parentLogger;
|
||||
this.customTransformers = Object.create(null);
|
||||
this._overriddenCompilerOptions = {
|
||||
sourceMap: true,
|
||||
inlineSourceMap: false,
|
||||
inlineSources: true,
|
||||
declaration: false,
|
||||
noEmit: false,
|
||||
removeComments: false,
|
||||
out: undefined,
|
||||
outFile: undefined,
|
||||
composite: undefined,
|
||||
declarationDir: undefined,
|
||||
declarationMap: undefined,
|
||||
emitDeclarationOnly: undefined,
|
||||
sourceRoot: undefined,
|
||||
tsBuildInfoFile: undefined,
|
||||
};
|
||||
this.logger = this.parentLogger
|
||||
? this.parentLogger.child((_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'config', _a))
|
||||
: logger_1.rootLogger.child({ namespace: 'config' });
|
||||
this._backportJestCfg(jestConfig !== null && jestConfig !== void 0 ? jestConfig : Object.create(null));
|
||||
this.cwd = path_1.normalize((_c = this._jestCfg.cwd) !== null && _c !== void 0 ? _c : process.cwd());
|
||||
this.rootDir = path_1.normalize((_d = this._jestCfg.rootDir) !== null && _d !== void 0 ? _d : this.cwd);
|
||||
var tsJestCfg = this._jestCfg.globals && this._jestCfg.globals['ts-jest'];
|
||||
var options = tsJestCfg !== null && tsJestCfg !== void 0 ? tsJestCfg : Object.create(null);
|
||||
this.compilerModule = importer_1.importer.typescript("Using \"ts-jest\" requires this package to be installed.", (_e = options.compiler) !== null && _e !== void 0 ? _e : 'typescript');
|
||||
this.isolatedModules = (_f = options.isolatedModules) !== null && _f !== void 0 ? _f : false;
|
||||
this.logger.debug({ compilerModule: this.compilerModule }, 'normalized compiler module config via ts-jest option');
|
||||
this._matchablePatterns = __spread(this._jestCfg.testMatch, this._jestCfg.testRegex).filter(function (pattern) {
|
||||
return pattern instanceof RegExp || typeof pattern === 'string';
|
||||
});
|
||||
if (!this._matchablePatterns.length) {
|
||||
(_b = this._matchablePatterns).push.apply(_b, __spread(constants_1.DEFAULT_JEST_TEST_MATCH));
|
||||
}
|
||||
this._matchTestFilePath = jest_util_1.globsToMatcher(this._matchablePatterns.filter(function (pattern) { return typeof pattern === 'string'; }));
|
||||
this._setupTsJestCfg(options);
|
||||
this._resolveTsCacheDir();
|
||||
}
|
||||
ConfigSet.prototype._backportJestCfg = function (jestCfg) {
|
||||
var config = backports_1.backportJestConfig(this.logger, jestCfg);
|
||||
this.logger.debug({ jestConfig: config }, 'normalized jest config');
|
||||
this._jestCfg = config;
|
||||
};
|
||||
ConfigSet.prototype._setupTsJestCfg = function (options) {
|
||||
var _this = this;
|
||||
var _a, _b, _c, _d;
|
||||
if (options.packageJson) {
|
||||
this.logger.warn("The option `packageJson` is deprecated and will be removed in ts-jest 27. This option is not used by internal `ts-jest`");
|
||||
}
|
||||
if (!options.babelConfig) {
|
||||
this.logger.debug('babel is disabled');
|
||||
}
|
||||
else {
|
||||
var baseBabelCfg = { cwd: this.cwd };
|
||||
if (typeof options.babelConfig === 'string') {
|
||||
var babelCfgPath = this.resolvePath(options.babelConfig);
|
||||
if (path_1.extname(options.babelConfig) === '.js') {
|
||||
this._babelConfig = __assign(__assign({}, baseBabelCfg), require(babelCfgPath));
|
||||
}
|
||||
else {
|
||||
this._babelConfig = __assign(__assign({}, baseBabelCfg), json5.parse(fs_1.readFileSync(babelCfgPath, 'utf-8')));
|
||||
}
|
||||
}
|
||||
else if (typeof options.babelConfig === 'object') {
|
||||
this._babelConfig = __assign(__assign({}, baseBabelCfg), options.babelConfig);
|
||||
}
|
||||
else {
|
||||
this._babelConfig = baseBabelCfg;
|
||||
}
|
||||
this.logger.debug({ babelConfig: this._babelConfig }, 'normalized babel config via ts-jest option');
|
||||
}
|
||||
if (!this._babelConfig) {
|
||||
this._overriddenCompilerOptions.module = this.compilerModule.ModuleKind.CommonJS;
|
||||
}
|
||||
else {
|
||||
this._babelJestTransformers = importer_1.importer
|
||||
.babelJest("Using \"babel-jest\" requires this package to be installed.")
|
||||
.createTransformer(this._babelConfig);
|
||||
this.logger.debug('created babel-jest transformer');
|
||||
}
|
||||
var diagnosticsOpt = (_a = options.diagnostics) !== null && _a !== void 0 ? _a : true;
|
||||
var ignoreList = __spread(exports.IGNORE_DIAGNOSTIC_CODES);
|
||||
if (typeof diagnosticsOpt === 'object') {
|
||||
var ignoreCodes = diagnosticsOpt.ignoreCodes;
|
||||
if (ignoreCodes) {
|
||||
Array.isArray(ignoreCodes) ? ignoreList.push.apply(ignoreList, __spread(ignoreCodes)) : ignoreList.push(ignoreCodes);
|
||||
}
|
||||
this._diagnostics = {
|
||||
pretty: (_b = diagnosticsOpt.pretty) !== null && _b !== void 0 ? _b : true,
|
||||
exclude: (_c = diagnosticsOpt.exclude) !== null && _c !== void 0 ? _c : [],
|
||||
ignoreCodes: toDiagnosticCodeList(ignoreList),
|
||||
throws: !diagnosticsOpt.warnOnly,
|
||||
};
|
||||
if (diagnosticsOpt.pathRegex) {
|
||||
this.logger.warn("The option `pathRegex` is deprecated and will be removed in ts-jest 27, use `exclude` instead");
|
||||
this._diagnostics = __assign(__assign({}, this._diagnostics), { pathRegex: normalizeRegex(diagnosticsOpt.pathRegex) });
|
||||
}
|
||||
}
|
||||
else {
|
||||
this._diagnostics = {
|
||||
ignoreCodes: diagnosticsOpt ? toDiagnosticCodeList(ignoreList) : [],
|
||||
exclude: [],
|
||||
pretty: true,
|
||||
throws: diagnosticsOpt,
|
||||
};
|
||||
}
|
||||
if (this._diagnostics.pathRegex && !this._diagnostics.exclude.length) {
|
||||
this._shouldGetDiagnosticsForFile = new RegExp(this._diagnostics.pathRegex);
|
||||
}
|
||||
else {
|
||||
this._shouldGetDiagnosticsForFile = this._diagnostics.exclude.length
|
||||
? jest_util_1.globsToMatcher(this._diagnostics.exclude)
|
||||
: function () { return true; };
|
||||
}
|
||||
this.logger.debug({ diagnostics: this._diagnostics }, 'normalized diagnostics config via ts-jest option');
|
||||
if (options.tsConfig) {
|
||||
this.logger.warn("The option `tsConfig` is deprecated and will be removed in ts-jest 27, use `tsconfig` instead");
|
||||
}
|
||||
var tsconfigOpt = (_d = options.tsConfig) !== null && _d !== void 0 ? _d : options.tsconfig;
|
||||
var configFilePath = typeof tsconfigOpt === 'string' ? this.resolvePath(tsconfigOpt) : undefined;
|
||||
this.parsedTsConfig = this._resolveTsConfig(typeof tsconfigOpt === 'object' ? tsconfigOpt : undefined, configFilePath);
|
||||
this.raiseDiagnostics(this.parsedTsConfig.errors, configFilePath);
|
||||
this.logger.debug({ tsconfig: this.parsedTsConfig }, 'normalized typescript config via ts-jest option');
|
||||
var astTransformers = options.astTransformers;
|
||||
this.customTransformers = {
|
||||
before: [hoist_jest_1.factory(this)],
|
||||
};
|
||||
if (astTransformers) {
|
||||
if (Array.isArray(astTransformers)) {
|
||||
this.logger.warn("The configuration for astTransformers as string[] is deprecated and will be removed in ts-jest 27. Please define your custom AST transformers in a form of an object. More information you can check online documentation https://kulshekhar.github.io/ts-jest/user/config/astTransformers");
|
||||
this.customTransformers = {
|
||||
before: __spread(this.customTransformers.before, astTransformers.map(function (transformer) {
|
||||
var transformerPath = _this.resolvePath(transformer, { nodeResolve: true });
|
||||
return require(transformerPath).factory(_this);
|
||||
})),
|
||||
};
|
||||
}
|
||||
else {
|
||||
var resolveTransformers = function (transformers) {
|
||||
return transformers.map(function (transformer) {
|
||||
var transformerPath;
|
||||
if (typeof transformer === 'string') {
|
||||
transformerPath = _this.resolvePath(transformer, { nodeResolve: true });
|
||||
return require(transformerPath).factory(_this);
|
||||
}
|
||||
else {
|
||||
transformerPath = _this.resolvePath(transformer.path, { nodeResolve: true });
|
||||
return require(transformerPath).factory(_this, transformer.options);
|
||||
}
|
||||
});
|
||||
};
|
||||
if (astTransformers.before) {
|
||||
this.customTransformers = {
|
||||
before: __spread(this.customTransformers.before, resolveTransformers(astTransformers.before)),
|
||||
};
|
||||
}
|
||||
if (astTransformers.after) {
|
||||
this.customTransformers = __assign(__assign({}, this.customTransformers), { after: resolveTransformers(astTransformers.after) });
|
||||
}
|
||||
if (astTransformers.afterDeclarations) {
|
||||
this.customTransformers = __assign(__assign({}, this.customTransformers), { afterDeclarations: resolveTransformers(astTransformers.afterDeclarations) });
|
||||
}
|
||||
}
|
||||
}
|
||||
this.logger.debug({ customTransformers: this.customTransformers }, 'normalized custom AST transformers via ts-jest option');
|
||||
if (options.stringifyContentPathRegex) {
|
||||
this._stringifyContentRegExp =
|
||||
typeof options.stringifyContentPathRegex === 'string'
|
||||
? new RegExp(normalizeRegex(options.stringifyContentPathRegex))
|
||||
: options.stringifyContentPathRegex;
|
||||
this.logger.debug({ stringifyContentPathRegex: this._stringifyContentRegExp }, 'normalized stringifyContentPathRegex config via ts-jest option');
|
||||
}
|
||||
};
|
||||
ConfigSet.prototype._resolveTsCacheDir = function () {
|
||||
if (!this._jestCfg.cache) {
|
||||
this.logger.debug('file caching disabled');
|
||||
return undefined;
|
||||
}
|
||||
var cacheSuffix = sha1_1.sha1(json_1.stringify({
|
||||
version: this.compilerModule.version,
|
||||
digest: this.tsJestDigest,
|
||||
compilerModule: this.compilerModule,
|
||||
compilerOptions: this.parsedTsConfig.options,
|
||||
isolatedModules: this.isolatedModules,
|
||||
diagnostics: this._diagnostics,
|
||||
}));
|
||||
var res = path_1.join(this._jestCfg.cacheDirectory, 'ts-jest', cacheSuffix.substr(0, 2), cacheSuffix.substr(2));
|
||||
this.logger.debug({ cacheDirectory: res }, 'will use file caching');
|
||||
this.tsCacheDir = res;
|
||||
};
|
||||
ConfigSet.prototype._resolveTsConfig = function (compilerOptions, resolvedConfigFile) {
|
||||
var e_2, _a;
|
||||
var _b;
|
||||
var config = { compilerOptions: Object.create(null) };
|
||||
var basePath = normalize_slashes_1.normalizeSlashes(this.rootDir);
|
||||
var ts = this.compilerModule;
|
||||
var configFileName = resolvedConfigFile
|
||||
? normalize_slashes_1.normalizeSlashes(resolvedConfigFile)
|
||||
: ts.findConfigFile(normalize_slashes_1.normalizeSlashes(this.rootDir), ts.sys.fileExists);
|
||||
if (configFileName) {
|
||||
this.logger.debug({ tsConfigFileName: configFileName }, 'readTsConfig(): reading', configFileName);
|
||||
var result_1 = ts.readConfigFile(configFileName, ts.sys.readFile);
|
||||
if (result_1.error) {
|
||||
return { errors: [result_1.error], fileNames: [], options: {} };
|
||||
}
|
||||
config = result_1.config;
|
||||
basePath = normalize_slashes_1.normalizeSlashes(path_1.dirname(configFileName));
|
||||
}
|
||||
config.compilerOptions = __assign(__assign({}, config.compilerOptions), compilerOptions);
|
||||
var result = ts.parseJsonConfigFileContent(config, ts.sys, basePath, undefined, configFileName);
|
||||
if (result.options.sourceMap === false) {
|
||||
this.logger.warn(messages_1.interpolate("Got `sourceMap: false` from tsconfig file \"{{path}}\". This will disable source map support in ts-jest 27. Please set `sourceMap: true` in your tsconfig file \"{{path}}\" if you want to keep source map support on", {
|
||||
path: result.options.configFilePath,
|
||||
}));
|
||||
}
|
||||
var forcedOptions = this._overriddenCompilerOptions;
|
||||
var finalOptions = result.options;
|
||||
if (finalOptions.target === undefined) {
|
||||
finalOptions.target = ts.ScriptTarget.ES5;
|
||||
}
|
||||
var target = finalOptions.target;
|
||||
var defaultModule = [ts.ScriptTarget.ES3, ts.ScriptTarget.ES5].includes(target)
|
||||
? ts.ModuleKind.CommonJS
|
||||
: ts.ModuleKind.ESNext;
|
||||
var moduleValue = finalOptions.module == null ? defaultModule : finalOptions.module;
|
||||
if ('module' in forcedOptions &&
|
||||
moduleValue !== forcedOptions.module &&
|
||||
!(finalOptions.esModuleInterop || finalOptions.allowSyntheticDefaultImports)) {
|
||||
result.errors.push({
|
||||
code: 151001,
|
||||
messageText: "If you have issues related to imports, you should consider setting `esModuleInterop` to `true` in your TypeScript configuration file (usually `tsconfig.json`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.",
|
||||
category: ts.DiagnosticCategory.Message,
|
||||
file: undefined,
|
||||
start: undefined,
|
||||
length: undefined,
|
||||
});
|
||||
if (!('allowSyntheticDefaultImports' in config.compilerOptions)) {
|
||||
finalOptions.allowSyntheticDefaultImports = true;
|
||||
}
|
||||
}
|
||||
if (finalOptions.allowJs && !finalOptions.outDir) {
|
||||
finalOptions.outDir = exports.TS_JEST_OUT_DIR;
|
||||
}
|
||||
try {
|
||||
for (var _c = __values(Object.keys(forcedOptions)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
||||
var key = _d.value;
|
||||
var val = forcedOptions[key];
|
||||
if (val === undefined) {
|
||||
delete finalOptions[key];
|
||||
}
|
||||
else {
|
||||
finalOptions[key] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
||||
}
|
||||
finally { if (e_2) throw e_2.error; }
|
||||
}
|
||||
var nodeJsVer = process.version;
|
||||
var compilationTarget = result.options.target;
|
||||
if (!this._babelConfig &&
|
||||
((nodeJsVer.startsWith('v10') && compilationTarget > typescript_1.ScriptTarget.ES2018) ||
|
||||
(nodeJsVer.startsWith('v12') && compilationTarget > typescript_1.ScriptTarget.ES2019))) {
|
||||
var message = messages_1.interpolate("There is a mismatch between your NodeJs version {{nodeJsVer}} and your TypeScript target {{compilationTarget}}. This might lead to some unexpected errors when running tests with `ts-jest`. To fix this, you can check https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping", {
|
||||
nodeJsVer: process.version,
|
||||
compilationTarget: (_b = config.compilerOptions.target) !== null && _b !== void 0 ? _b : TARGET_TO_VERSION_MAPPING[compilationTarget],
|
||||
});
|
||||
this.logger.warn(message);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(ConfigSet.prototype, "tsCompiler", {
|
||||
get: function () {
|
||||
return instance_1.createCompilerInstance(this);
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "babelConfig", {
|
||||
get: function () {
|
||||
return this._babelConfig;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "babelJestTransformer", {
|
||||
get: function () {
|
||||
return this._babelJestTransformers;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "tsJestDigest", {
|
||||
get: function () {
|
||||
return exports.MY_DIGEST;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "hooks", {
|
||||
get: function () {
|
||||
var hooksFile = process.env.TS_JEST_HOOKS;
|
||||
if (hooksFile) {
|
||||
hooksFile = path_1.resolve(this.cwd, hooksFile);
|
||||
return importer_1.importer.tryTheseOr(hooksFile, {});
|
||||
}
|
||||
return {};
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
ConfigSet.prototype.isTestFile = function (fileName) {
|
||||
var _this = this;
|
||||
return this._matchablePatterns.some(function (pattern) {
|
||||
return typeof pattern === 'string' ? _this._matchTestFilePath(fileName) : pattern.test(fileName);
|
||||
});
|
||||
};
|
||||
ConfigSet.prototype.shouldStringifyContent = function (filePath) {
|
||||
return this._stringifyContentRegExp ? this._stringifyContentRegExp.test(filePath) : false;
|
||||
};
|
||||
ConfigSet.prototype.raiseDiagnostics = function (diagnostics, filePath, logger) {
|
||||
var _this = this;
|
||||
var ignoreCodes = this._diagnostics.ignoreCodes;
|
||||
var DiagnosticCategory = this.compilerModule.DiagnosticCategory;
|
||||
var filteredDiagnostics = filePath && !this.shouldReportDiagnostics(filePath)
|
||||
? []
|
||||
: diagnostics.filter(function (diagnostic) {
|
||||
var _a;
|
||||
if (((_a = diagnostic.file) === null || _a === void 0 ? void 0 : _a.fileName) && !_this.shouldReportDiagnostics(diagnostic.file.fileName)) {
|
||||
return false;
|
||||
}
|
||||
return !ignoreCodes.includes(diagnostic.code);
|
||||
});
|
||||
if (!filteredDiagnostics.length)
|
||||
return;
|
||||
var error = this._createTsError(filteredDiagnostics);
|
||||
var importantCategories = [DiagnosticCategory.Warning, DiagnosticCategory.Error];
|
||||
if (this._diagnostics.throws && filteredDiagnostics.some(function (d) { return importantCategories.includes(d.category); })) {
|
||||
throw error;
|
||||
}
|
||||
logger ? logger.warn({ error: error }, error.message) : this.logger.warn({ error: error }, error.message);
|
||||
};
|
||||
ConfigSet.prototype.shouldReportDiagnostics = function (filePath) {
|
||||
return this._shouldGetDiagnosticsForFile instanceof RegExp
|
||||
? this._shouldGetDiagnosticsForFile.test(filePath)
|
||||
: this._shouldGetDiagnosticsForFile(filePath);
|
||||
};
|
||||
ConfigSet.prototype._createTsError = function (diagnostics) {
|
||||
var _this = this;
|
||||
var formatDiagnostics = this._diagnostics.pretty
|
||||
? this.compilerModule.formatDiagnosticsWithColorAndContext
|
||||
: this.compilerModule.formatDiagnostics;
|
||||
var diagnosticHost = {
|
||||
getNewLine: function () { return '\n'; },
|
||||
getCurrentDirectory: function () { return _this.cwd; },
|
||||
getCanonicalFileName: function (path) { return path; },
|
||||
};
|
||||
var diagnosticText = formatDiagnostics(diagnostics, diagnosticHost);
|
||||
var diagnosticCodes = diagnostics.map(function (x) { return x.code; });
|
||||
return new ts_error_1.TSError(diagnosticText, diagnosticCodes);
|
||||
};
|
||||
ConfigSet.prototype.resolvePath = function (inputPath, _a) {
|
||||
var _b = _a === void 0 ? {} : _a, _c = _b.throwIfMissing, throwIfMissing = _c === void 0 ? true : _c, _d = _b.nodeResolve, nodeResolve = _d === void 0 ? false : _d;
|
||||
var path = inputPath;
|
||||
var nodeResolved = false;
|
||||
if (path.startsWith('<rootDir>')) {
|
||||
path = path_1.resolve(path_1.join(this.rootDir, path.substr(9)));
|
||||
}
|
||||
else if (!path_1.isAbsolute(path)) {
|
||||
if (!path.startsWith('.') && nodeResolve) {
|
||||
try {
|
||||
path = require.resolve(path);
|
||||
nodeResolved = true;
|
||||
}
|
||||
catch (_) { }
|
||||
}
|
||||
if (!nodeResolved) {
|
||||
path = path_1.resolve(this.cwd, path);
|
||||
}
|
||||
}
|
||||
if (!nodeResolved && nodeResolve) {
|
||||
try {
|
||||
path = require.resolve(path);
|
||||
nodeResolved = true;
|
||||
}
|
||||
catch (_) { }
|
||||
}
|
||||
if (throwIfMissing && !fs_1.existsSync(path)) {
|
||||
throw new Error(messages_1.interpolate("File not found: {{inputPath}} (resolved as: {{resolvedPath}})", { inputPath: inputPath, resolvedPath: path }));
|
||||
}
|
||||
this.logger.debug({ fromPath: inputPath, toPath: path }, 'resolved path from', inputPath, 'to', path);
|
||||
return path;
|
||||
};
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "tsCompiler", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "tsJestDigest", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "hooks", null);
|
||||
return ConfigSet;
|
||||
}());
|
||||
exports.ConfigSet = ConfigSet;
|
6
node_modules/ts-jest/dist/config/paths-to-module-name-mapper.d.ts
generated
vendored
Normal file
6
node_modules/ts-jest/dist/config/paths-to-module-name-mapper.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
import type { Config } from '@jest/types';
|
||||
declare type JestPathMapping = Config.InitialOptions['moduleNameMapper'];
|
||||
export declare const pathsToModuleNameMapper: (mapping: import("typescript").MapLike<string[]>, { prefix }?: {
|
||||
prefix: string;
|
||||
}) => JestPathMapping;
|
||||
export {};
|
64
node_modules/ts-jest/dist/config/paths-to-module-name-mapper.js
generated
vendored
Normal file
64
node_modules/ts-jest/dist/config/paths-to-module-name-mapper.js
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
"use strict";
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pathsToModuleNameMapper = void 0;
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var logger_1 = require("../utils/logger");
|
||||
var messages_1 = require("../utils/messages");
|
||||
var escapeRegex = function (str) { return str.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); };
|
||||
var logger = logger_1.rootLogger.child((_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'path-mapper', _a));
|
||||
exports.pathsToModuleNameMapper = function (mapping, _a) {
|
||||
var e_1, _b;
|
||||
var _c = (_a === void 0 ? Object.create(null) : _a).prefix, prefix = _c === void 0 ? '' : _c;
|
||||
var jestMap = {};
|
||||
try {
|
||||
for (var _d = __values(Object.keys(mapping)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
||||
var fromPath = _e.value;
|
||||
var pattern = void 0;
|
||||
var toPaths = mapping[fromPath];
|
||||
if (toPaths.length === 0) {
|
||||
logger.warn(messages_1.interpolate("Not mapping \"{{path}}\" because it has no target.", { path: fromPath }));
|
||||
continue;
|
||||
}
|
||||
var segments = fromPath.split(/\*/g);
|
||||
if (segments.length === 1) {
|
||||
var paths = toPaths.map(function (target) {
|
||||
var enrichedPrefix = prefix !== '' && !prefix.endsWith('/') ? prefix + "/" : prefix;
|
||||
return "" + enrichedPrefix + target;
|
||||
});
|
||||
pattern = "^" + escapeRegex(fromPath) + "$";
|
||||
jestMap[pattern] = paths.length === 1 ? paths[0] : paths;
|
||||
}
|
||||
else if (segments.length === 2) {
|
||||
var paths = toPaths.map(function (target) {
|
||||
var enrichedPrefix = prefix !== '' && !prefix.endsWith('/') ? prefix + "/" : prefix;
|
||||
return "" + enrichedPrefix + target.replace(/\*/g, '$1');
|
||||
});
|
||||
pattern = "^" + escapeRegex(segments[0]) + "(.*)" + escapeRegex(segments[1]) + "$";
|
||||
jestMap[pattern] = paths.length === 1 ? paths[0] : paths;
|
||||
}
|
||||
else {
|
||||
logger.warn(messages_1.interpolate("Not mapping \"{{path}}\" because it has more than one star (`*`).", { path: fromPath }));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
return jestMap;
|
||||
};
|
4
node_modules/ts-jest/dist/constants.d.ts
generated
vendored
Normal file
4
node_modules/ts-jest/dist/constants.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
export declare const LINE_FEED = "\n";
|
||||
export declare const TS_TSX_REGEX: RegExp;
|
||||
export declare const JS_JSX_REGEX: RegExp;
|
||||
export declare const DECLARATION_TYPE_EXT = ".d.ts";
|
8
node_modules/ts-jest/dist/constants.js
generated
vendored
Normal file
8
node_modules/ts-jest/dist/constants.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DEFAULT_JEST_TEST_MATCH = exports.DECLARATION_TYPE_EXT = exports.JS_JSX_REGEX = exports.TS_TSX_REGEX = exports.LINE_FEED = void 0;
|
||||
exports.LINE_FEED = '\n';
|
||||
exports.TS_TSX_REGEX = /\.tsx?$/;
|
||||
exports.JS_JSX_REGEX = /\.jsx?$/;
|
||||
exports.DECLARATION_TYPE_EXT = '.d.ts';
|
||||
exports.DEFAULT_JEST_TEST_MATCH = ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'];
|
19
node_modules/ts-jest/dist/index.d.ts
generated
vendored
Normal file
19
node_modules/ts-jest/dist/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
import { createJestPreset as createJestPresetCore } from './presets/create-jest-preset';
|
||||
import { TsJestTransformer } from './ts-jest-transformer';
|
||||
import type { TsJestGlobalOptions } from './types';
|
||||
import { mocked as mockedCore } from './utils/testing';
|
||||
declare module '@jest/types' {
|
||||
namespace Config {
|
||||
interface ConfigGlobals {
|
||||
'ts-jest': TsJestGlobalOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
export declare const mocked: typeof mockedCore;
|
||||
export declare const createJestPreset: typeof createJestPresetCore;
|
||||
export declare const pathsToModuleNameMapper: (mapping: import("typescript").MapLike<string[]>, { prefix }?: {
|
||||
prefix: string;
|
||||
}) => {
|
||||
[key: string]: string | string[];
|
||||
} | undefined;
|
||||
export declare function createTransformer(): TsJestTransformer;
|
24
node_modules/ts-jest/dist/index.js
generated
vendored
Normal file
24
node_modules/ts-jest/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createTransformer = exports.pathsToModuleNameMapper = exports.createJestPreset = exports.mocked = void 0;
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var create_jest_preset_1 = require("./presets/create-jest-preset");
|
||||
var paths_to_module_name_mapper_1 = require("./config/paths-to-module-name-mapper");
|
||||
var ts_jest_transformer_1 = require("./ts-jest-transformer");
|
||||
var logger_1 = require("./utils/logger");
|
||||
var messages_1 = require("./utils/messages");
|
||||
var testing_1 = require("./utils/testing");
|
||||
var version_checkers_1 = require("./utils/version-checkers");
|
||||
var warn = logger_1.rootLogger.child((_a = {}, _a[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.warn, _a));
|
||||
var helperMoved = function (name, helper) {
|
||||
return warn.wrap(messages_1.interpolate("The `{{helper}}` helper has been moved to `ts-jest/utils`. Use `import { {{helper}} } from 'ts-jest/utils'` instead.", { helper: name }), helper);
|
||||
};
|
||||
exports.mocked = helperMoved('mocked', testing_1.mocked);
|
||||
exports.createJestPreset = helperMoved('createJestPreset', create_jest_preset_1.createJestPreset);
|
||||
exports.pathsToModuleNameMapper = helperMoved('pathsToModuleNameMapper', paths_to_module_name_mapper_1.pathsToModuleNameMapper);
|
||||
function createTransformer() {
|
||||
version_checkers_1.VersionCheckers.jest.warn();
|
||||
return new ts_jest_transformer_1.TsJestTransformer();
|
||||
}
|
||||
exports.createTransformer = createTransformer;
|
7
node_modules/ts-jest/dist/presets/create-jest-preset.d.ts
generated
vendored
Normal file
7
node_modules/ts-jest/dist/presets/create-jest-preset.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
import type { Config } from '@jest/types';
|
||||
import type { TsJestPresets } from '../types';
|
||||
interface CreateJestPresetOptions {
|
||||
allowJs?: boolean;
|
||||
}
|
||||
export declare function createJestPreset({ allowJs }?: CreateJestPresetOptions, from?: Config.InitialOptions): TsJestPresets;
|
||||
export {};
|
24
node_modules/ts-jest/dist/presets/create-jest-preset.js
generated
vendored
Normal file
24
node_modules/ts-jest/dist/presets/create-jest-preset.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
"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.createJestPreset = void 0;
|
||||
var logger_1 = require("../utils/logger");
|
||||
var logger = logger_1.rootLogger.child({ namespace: 'jest-preset' });
|
||||
function createJestPreset(_a, from) {
|
||||
var _b;
|
||||
var _c = (_a === void 0 ? {} : _a).allowJs, allowJs = _c === void 0 ? false : _c;
|
||||
if (from === void 0) { from = {}; }
|
||||
logger.debug({ allowJs: allowJs }, 'creating jest presets', allowJs ? 'handling' : 'not handling', 'JavaScript files');
|
||||
return __assign(__assign({ transform: __assign(__assign({}, from.transform), (_b = {}, _b[allowJs ? '^.+\\.[tj]sx?$' : '^.+\\.tsx?$'] = 'ts-jest', _b)) }, (from.testMatch ? { testMatch: from.testMatch } : undefined)), (from.moduleFileExtensions ? { moduleFileExtensions: from.moduleFileExtensions } : undefined));
|
||||
}
|
||||
exports.createJestPreset = createJestPreset;
|
1
node_modules/ts-jest/dist/transformers/hoist-jest.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/transformers/hoist-jest.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
131
node_modules/ts-jest/dist/transformers/hoist-jest.js
generated
vendored
Normal file
131
node_modules/ts-jest/dist/transformers/hoist-jest.js
generated
vendored
Normal file
|
@ -0,0 +1,131 @@
|
|||
"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);
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spread = (this && this.__spread) || function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.factory = exports.version = exports.name = void 0;
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var HOIST_METHODS = ['mock', 'unmock', 'enableAutomock', 'disableAutomock', 'deepUnmock'];
|
||||
var JEST_GLOBALS_MODULE_NAME = '@jest/globals';
|
||||
var JEST_GLOBAL_NAME = 'jest';
|
||||
var ROOT_LEVEL_AST = 1;
|
||||
exports.name = 'hoisting-jest-mock';
|
||||
exports.version = 4;
|
||||
function factory(cs) {
|
||||
var logger = cs.logger.child({ namespace: 'ts-hoisting' });
|
||||
var ts = cs.compilerModule;
|
||||
var importNames = [];
|
||||
function shouldHoistExpression(node) {
|
||||
if (ts.isCallExpression(node) &&
|
||||
ts.isPropertyAccessExpression(node.expression) &&
|
||||
HOIST_METHODS.includes(node.expression.name.text)) {
|
||||
if (importNames.length) {
|
||||
return ((ts.isIdentifier(node.expression.expression) && importNames.includes(node.expression.expression.text)) ||
|
||||
(ts.isPropertyAccessExpression(node.expression.expression) &&
|
||||
ts.isIdentifier(node.expression.expression.expression) &&
|
||||
importNames.includes(node.expression.expression.expression.text)) ||
|
||||
shouldHoistExpression(node.expression.expression));
|
||||
}
|
||||
else {
|
||||
return ((ts.isIdentifier(node.expression.expression) && node.expression.expression.text === JEST_GLOBAL_NAME) ||
|
||||
shouldHoistExpression(node.expression.expression));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function shouldHoistNode(node) {
|
||||
return ts.isExpressionStatement(node) && shouldHoistExpression(node.expression);
|
||||
}
|
||||
function isJestGlobalImport(node) {
|
||||
return (ts.isImportDeclaration(node) &&
|
||||
ts.isStringLiteral(node.moduleSpecifier) &&
|
||||
node.moduleSpecifier.text === JEST_GLOBALS_MODULE_NAME);
|
||||
}
|
||||
function createVisitor(ctx, _) {
|
||||
var level = 0;
|
||||
var hoisted = [];
|
||||
var enter = function () {
|
||||
level++;
|
||||
if (hoisted[level]) {
|
||||
hoisted[level].splice(0, hoisted[level].length);
|
||||
}
|
||||
};
|
||||
var exit = function () { return level--; };
|
||||
var hoist = function (node) {
|
||||
if (hoisted[level]) {
|
||||
hoisted[level].push(node);
|
||||
}
|
||||
else {
|
||||
hoisted[level] = [node];
|
||||
}
|
||||
};
|
||||
var visitor = function (node) {
|
||||
var _a, _b;
|
||||
enter();
|
||||
var resultNode = ts.visitEachChild(node, visitor, ctx);
|
||||
if (isJestGlobalImport(resultNode) && ((_a = resultNode.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings) &&
|
||||
(ts.isNamespaceImport(resultNode.importClause.namedBindings) ||
|
||||
ts.isNamedImports(resultNode.importClause.namedBindings))) {
|
||||
var namedBindings = resultNode.importClause.namedBindings;
|
||||
var jestImportName = ts.isNamespaceImport(namedBindings)
|
||||
? namedBindings.name.text
|
||||
: (_b = namedBindings.elements.find(function (element) { var _a; return element.name.text === JEST_GLOBAL_NAME || ((_a = element.propertyName) === null || _a === void 0 ? void 0 : _a.text) === JEST_GLOBAL_NAME; })) === null || _b === void 0 ? void 0 : _b.name.text;
|
||||
if (jestImportName) {
|
||||
importNames.push(jestImportName);
|
||||
}
|
||||
}
|
||||
if (hoisted[level] && hoisted[level].length) {
|
||||
var hoistedStmts_1 = hoisted[level];
|
||||
var otherStmts = resultNode.statements.filter(function (s) { return !hoistedStmts_1.includes(s) && !isJestGlobalImport(s); });
|
||||
var newNode = ts.getMutableClone(resultNode);
|
||||
var newStatements = __spread(hoistedStmts_1, otherStmts);
|
||||
if (level === ROOT_LEVEL_AST) {
|
||||
var jestGlobalsImportStmts = resultNode.statements.filter(function (s) { return isJestGlobalImport(s); });
|
||||
resultNode = __assign(__assign({}, newNode), { statements: ts.createNodeArray(__spread(jestGlobalsImportStmts, newStatements)) });
|
||||
}
|
||||
else {
|
||||
resultNode = __assign(__assign({}, newNode), { statements: ts.createNodeArray(newStatements) });
|
||||
}
|
||||
}
|
||||
exit();
|
||||
if (shouldHoistNode(resultNode)) {
|
||||
hoist(resultNode);
|
||||
}
|
||||
return resultNode;
|
||||
};
|
||||
return visitor;
|
||||
}
|
||||
return function (ctx) {
|
||||
var _a;
|
||||
return logger.wrap((_a = {}, _a[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.debug, _a.call = null, _a), 'visitSourceFileNode(): hoisting', function (sf) { return ts.visitNode(sf, createVisitor(ctx, sf)); });
|
||||
};
|
||||
}
|
||||
exports.factory = factory;
|
1
node_modules/ts-jest/dist/transformers/index.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/transformers/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
24
node_modules/ts-jest/dist/transformers/index.js
generated
vendored
Normal file
24
node_modules/ts-jest/dist/transformers/index.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.internals = void 0;
|
||||
var hoisting = __importStar(require("./hoist-jest"));
|
||||
exports.internals = [hoisting];
|
3
node_modules/ts-jest/dist/transformers/path-mapping.d.ts
generated
vendored
Normal file
3
node_modules/ts-jest/dist/transformers/path-mapping.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
import type * as _ts from 'typescript';
|
||||
import type { ConfigSet } from '../config/config-set';
|
||||
export declare function factory(cs: ConfigSet): (ctx: _ts.TransformationContext) => _ts.Transformer<_ts.SourceFile>;
|
121
node_modules/ts-jest/dist/transformers/path-mapping.js
generated
vendored
Normal file
121
node_modules/ts-jest/dist/transformers/path-mapping.js
generated
vendored
Normal file
|
@ -0,0 +1,121 @@
|
|||
"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);
|
||||
};
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.factory = exports.version = exports.name = void 0;
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var path_1 = require("path");
|
||||
exports.name = 'path-mapping';
|
||||
exports.version = 1;
|
||||
var isBaseDir = function (base, dir) { var _a; return !((_a = path_1.relative(base, dir)) === null || _a === void 0 ? void 0 : _a.startsWith('.')); };
|
||||
function factory(cs) {
|
||||
var _a;
|
||||
var logger = cs.logger.child({ namespace: 'ts-path-mapping' });
|
||||
var ts = cs.compilerModule;
|
||||
var compilerOptions = cs.parsedTsConfig.options;
|
||||
var rootDirs = (_a = compilerOptions.rootDirs) === null || _a === void 0 ? void 0 : _a.filter(path_1.isAbsolute);
|
||||
var isDynamicImport = function (node) {
|
||||
return ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword;
|
||||
};
|
||||
var isRequire = function (node) {
|
||||
return ts.isCallExpression(node) &&
|
||||
ts.isIdentifier(node.expression) &&
|
||||
node.expression.text === 'require' &&
|
||||
ts.isStringLiteral(node.arguments[0]) &&
|
||||
node.arguments.length === 1;
|
||||
};
|
||||
var createVisitor = function (ctx, sf) {
|
||||
var fileName = sf.fileName;
|
||||
var fileDir = path_1.normalize(path_1.dirname(fileName));
|
||||
var rewritePath = function (importPath) {
|
||||
var e_1, _a;
|
||||
var p = importPath;
|
||||
var resolvedModule = ts.resolveModuleName(importPath, fileName, compilerOptions, ts.sys).resolvedModule;
|
||||
if (resolvedModule) {
|
||||
var resolvedFileName = resolvedModule.resolvedFileName;
|
||||
var filePath = fileDir;
|
||||
var modulePath = path_1.dirname(resolvedFileName);
|
||||
if (rootDirs) {
|
||||
var fileRootDir = '';
|
||||
var moduleRootDir = '';
|
||||
try {
|
||||
for (var rootDirs_1 = __values(rootDirs), rootDirs_1_1 = rootDirs_1.next(); !rootDirs_1_1.done; rootDirs_1_1 = rootDirs_1.next()) {
|
||||
var rootDir = rootDirs_1_1.value;
|
||||
if (isBaseDir(rootDir, resolvedFileName) && rootDir.length > moduleRootDir.length)
|
||||
moduleRootDir = rootDir;
|
||||
if (isBaseDir(rootDir, fileName) && rootDir.length > fileRootDir.length)
|
||||
fileRootDir = rootDir;
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (rootDirs_1_1 && !rootDirs_1_1.done && (_a = rootDirs_1.return)) _a.call(rootDirs_1);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
if (fileRootDir && moduleRootDir) {
|
||||
filePath = path_1.relative(fileRootDir, filePath);
|
||||
modulePath = path_1.relative(moduleRootDir, modulePath);
|
||||
}
|
||||
}
|
||||
p = path_1.normalize(path_1.join(path_1.relative(filePath, modulePath), path_1.basename(resolvedFileName)));
|
||||
p = p.startsWith('.') ? p : "./" + p;
|
||||
}
|
||||
return p;
|
||||
};
|
||||
var visitor = function (node) {
|
||||
var rewrittenPath;
|
||||
var newNode = ts.getMutableClone(node);
|
||||
if (isDynamicImport(node) || isRequire(node)) {
|
||||
rewrittenPath = rewritePath(node.arguments[0].text);
|
||||
return __assign(__assign({}, newNode), { arguments: ts.createNodeArray([ts.createStringLiteral(rewrittenPath)]) });
|
||||
}
|
||||
if (ts.isExternalModuleReference(node) && ts.isStringLiteral(node.expression)) {
|
||||
rewrittenPath = rewritePath(node.expression.text);
|
||||
return ts.updateExternalModuleReference(newNode, ts.createLiteral(rewrittenPath));
|
||||
}
|
||||
if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)) {
|
||||
rewrittenPath = rewritePath(node.moduleSpecifier.text);
|
||||
return __assign(__assign({}, newNode), { moduleSpecifier: ts.createLiteral(rewrittenPath) });
|
||||
}
|
||||
if (ts.isExportDeclaration(node) && node.moduleSpecifier && ts.isStringLiteral(node.moduleSpecifier)) {
|
||||
rewrittenPath = rewritePath(node.moduleSpecifier.text);
|
||||
return __assign(__assign({}, newNode), { moduleSpecifier: ts.createLiteral(rewrittenPath) });
|
||||
}
|
||||
if (ts.isImportTypeNode(node) &&
|
||||
ts.isLiteralTypeNode(node.argument) &&
|
||||
ts.isStringLiteral(node.argument.literal)) {
|
||||
rewrittenPath = rewritePath(node.argument.literal.text);
|
||||
return __assign(__assign({}, newNode), { argument: ts.createLiteralTypeNode(ts.createStringLiteral(rewrittenPath)) });
|
||||
}
|
||||
return ts.visitEachChild(node, visitor, ctx);
|
||||
};
|
||||
return visitor;
|
||||
};
|
||||
return function (ctx) {
|
||||
var _a;
|
||||
return logger.wrap((_a = {}, _a[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.debug, _a.call = null, _a), 'visitSourceFileNode(): path mapping', function (sf) { return ts.visitNode(sf, createVisitor(ctx, sf)); });
|
||||
};
|
||||
}
|
||||
exports.factory = factory;
|
12
node_modules/ts-jest/dist/ts-jest-transformer.d.ts
generated
vendored
Normal file
12
node_modules/ts-jest/dist/ts-jest-transformer.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
import type { CacheKeyOptions, TransformedSource, Transformer, TransformOptions } from '@jest/transform';
|
||||
import type { Config } from '@jest/types';
|
||||
import type { Logger } from 'bs-logger';
|
||||
import { ConfigSet } from './config/config-set';
|
||||
export declare class TsJestTransformer implements Transformer {
|
||||
protected readonly logger: Logger;
|
||||
protected _transformCfgStr: string;
|
||||
constructor();
|
||||
configsFor(jestConfig: Config.ProjectConfig): ConfigSet;
|
||||
process(input: string, filePath: Config.Path, jestConfig: Config.ProjectConfig, transformOptions?: TransformOptions): TransformedSource | string;
|
||||
getCacheKey(fileContent: string, filePath: string, _jestConfigStr: string, transformOptions: CacheKeyOptions): string;
|
||||
}
|
114
node_modules/ts-jest/dist/ts-jest-transformer.js
generated
vendored
Normal file
114
node_modules/ts-jest/dist/ts-jest-transformer.js
generated
vendored
Normal file
|
@ -0,0 +1,114 @@
|
|||
"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.TsJestTransformer = void 0;
|
||||
var config_set_1 = require("./config/config-set");
|
||||
var constants_1 = require("./constants");
|
||||
var json_1 = require("./utils/json");
|
||||
var jsonable_value_1 = require("./utils/jsonable-value");
|
||||
var logger_1 = require("./utils/logger");
|
||||
var messages_1 = require("./utils/messages");
|
||||
var sha1_1 = require("./utils/sha1");
|
||||
var TsJestTransformer = (function () {
|
||||
function TsJestTransformer() {
|
||||
this.logger = logger_1.rootLogger.child({ namespace: 'ts-jest-transformer' });
|
||||
this.logger.debug('created new transformer');
|
||||
}
|
||||
TsJestTransformer.prototype.configsFor = function (jestConfig) {
|
||||
var ccs = TsJestTransformer._cachedConfigSets.find(function (cs) { return cs.jestConfig.value === jestConfig; });
|
||||
var configSet;
|
||||
if (ccs) {
|
||||
this._transformCfgStr = ccs.transformerCfgStr;
|
||||
configSet = ccs.configSet;
|
||||
}
|
||||
else {
|
||||
var serializedJestCfg_1 = json_1.stringify(jestConfig);
|
||||
var serializedCcs = TsJestTransformer._cachedConfigSets.find(function (cs) { return cs.jestConfig.serialized === serializedJestCfg_1; });
|
||||
if (serializedCcs) {
|
||||
serializedCcs.jestConfig.value = jestConfig;
|
||||
this._transformCfgStr = serializedCcs.transformerCfgStr;
|
||||
configSet = serializedCcs.configSet;
|
||||
}
|
||||
else {
|
||||
this.logger.info('no matching config-set found, creating a new one');
|
||||
configSet = new config_set_1.ConfigSet(jestConfig);
|
||||
var jest_1 = __assign({}, jestConfig);
|
||||
var globals = (jest_1.globals = __assign({}, jest_1.globals));
|
||||
jest_1.name = undefined;
|
||||
jest_1.cacheDirectory = undefined;
|
||||
delete globals['ts-jest'];
|
||||
this._transformCfgStr = new jsonable_value_1.JsonableValue(__assign(__assign({ digest: configSet.tsJestDigest, babel: configSet.babelConfig }, jest_1), { tsconfig: {
|
||||
options: configSet.parsedTsConfig.options,
|
||||
raw: configSet.parsedTsConfig.raw,
|
||||
} })).serialized;
|
||||
TsJestTransformer._cachedConfigSets.push({
|
||||
jestConfig: new jsonable_value_1.JsonableValue(jestConfig),
|
||||
configSet: configSet,
|
||||
transformerCfgStr: this._transformCfgStr,
|
||||
});
|
||||
}
|
||||
}
|
||||
return configSet;
|
||||
};
|
||||
TsJestTransformer.prototype.process = function (input, filePath, jestConfig, transformOptions) {
|
||||
this.logger.debug({ fileName: filePath, transformOptions: transformOptions }, 'processing', filePath);
|
||||
var result;
|
||||
var source = input;
|
||||
var configs = this.configsFor(jestConfig);
|
||||
var hooks = configs.hooks;
|
||||
var shouldStringifyContent = configs.shouldStringifyContent(filePath);
|
||||
var babelJest = shouldStringifyContent ? undefined : configs.babelJestTransformer;
|
||||
var isDefinitionFile = filePath.endsWith(constants_1.DECLARATION_TYPE_EXT);
|
||||
var isJsFile = constants_1.JS_JSX_REGEX.test(filePath);
|
||||
var isTsFile = !isDefinitionFile && constants_1.TS_TSX_REGEX.test(filePath);
|
||||
if (shouldStringifyContent) {
|
||||
result = "module.exports=" + json_1.stringify(source);
|
||||
}
|
||||
else if (isDefinitionFile) {
|
||||
result = '';
|
||||
}
|
||||
else if (!configs.parsedTsConfig.options.allowJs && isJsFile) {
|
||||
this.logger.warn({ fileName: filePath }, messages_1.interpolate("Got a `.js` file to compile while `allowJs` option is not set to `true` (file: {{path}}). To fix this:\n - if you want TypeScript to process JS files, set `allowJs` to `true` in your TypeScript config (usually tsconfig.json)\n - if you do not want TypeScript to process your `.js` files, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match `.js` files anymore", { path: filePath }));
|
||||
result = source;
|
||||
}
|
||||
else if (isJsFile || isTsFile) {
|
||||
result = configs.tsCompiler.compile(source, filePath);
|
||||
}
|
||||
else {
|
||||
var message = babelJest ? "Got a unknown file type to compile (file: {{path}}). To fix this, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match this kind of files anymore. If you still want Babel to process it, add another entry to the `transform` option with value `babel-jest` which key matches this type of files." : "Got a unknown file type to compile (file: {{path}}). To fix this, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match this kind of files anymore.";
|
||||
this.logger.warn({ fileName: filePath }, messages_1.interpolate(message, { path: filePath }));
|
||||
result = source;
|
||||
}
|
||||
if (babelJest) {
|
||||
this.logger.debug({ fileName: filePath }, 'calling babel-jest processor');
|
||||
result = babelJest.process(result, filePath, jestConfig, __assign(__assign({}, transformOptions), { instrument: false }));
|
||||
}
|
||||
if (hooks.afterProcess) {
|
||||
this.logger.debug({ fileName: filePath, hookName: 'afterProcess' }, 'calling afterProcess hook');
|
||||
var newResult = hooks.afterProcess([input, filePath, jestConfig, transformOptions], result);
|
||||
if (newResult !== undefined) {
|
||||
return newResult;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
TsJestTransformer.prototype.getCacheKey = function (fileContent, filePath, _jestConfigStr, transformOptions) {
|
||||
var configs = this.configsFor(transformOptions.config);
|
||||
this.logger.debug({ fileName: filePath, transformOptions: transformOptions }, 'computing cache key for', filePath);
|
||||
var _a = transformOptions.instrument, instrument = _a === void 0 ? false : _a, _b = transformOptions.rootDir, rootDir = _b === void 0 ? configs.rootDir : _b;
|
||||
return sha1_1.sha1(this._transformCfgStr, '\x00', rootDir, '\x00', "instrument:" + (instrument ? 'on' : 'off'), '\x00', fileContent, '\x00', filePath);
|
||||
};
|
||||
TsJestTransformer._cachedConfigSets = [];
|
||||
return TsJestTransformer;
|
||||
}());
|
||||
exports.TsJestTransformer = TsJestTransformer;
|
105
node_modules/ts-jest/dist/tsconfig-raw.d.ts
generated
vendored
Normal file
105
node_modules/ts-jest/dist/tsconfig-raw.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,105 @@
|
|||
export interface RawCompilerOptions {
|
||||
charset?: string;
|
||||
composite?: boolean;
|
||||
declaration?: boolean;
|
||||
declarationDir?: string | null;
|
||||
diagnostics?: boolean;
|
||||
disableReferencedProjectLoad?: boolean;
|
||||
emitBOM?: boolean;
|
||||
emitDeclarationOnly?: boolean;
|
||||
incremental?: boolean;
|
||||
tsBuildInfoFile?: string;
|
||||
inlineSourceMap?: boolean;
|
||||
inlineSources?: boolean;
|
||||
jsx?: 'preserve' | 'react' | 'react-jsx' | 'react-jsxdev' | 'react-native';
|
||||
reactNamespace?: string;
|
||||
jsxFactory?: string;
|
||||
jsxFragmentFactory?: string;
|
||||
jsxImportSource?: string;
|
||||
listFiles?: boolean;
|
||||
mapRoot?: string;
|
||||
module?: 'CommonJS' | 'AMD' | 'System' | 'UMD' | 'ES6' | 'ES2015' | 'ES2020' | 'ESNext' | 'None' | string;
|
||||
moduleResolution?: 'Classic' | 'Node';
|
||||
newLine?: 'crlf' | 'lf';
|
||||
noEmit?: boolean;
|
||||
noEmitHelpers?: boolean;
|
||||
noEmitOnError?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
noImplicitThis?: boolean;
|
||||
noUnusedLocals?: boolean;
|
||||
noUnusedParameters?: boolean;
|
||||
noLib?: boolean;
|
||||
noResolve?: boolean;
|
||||
noStrictGenericChecks?: boolean;
|
||||
skipDefaultLibCheck?: boolean;
|
||||
skipLibCheck?: boolean;
|
||||
outFile?: string;
|
||||
outDir?: string;
|
||||
preserveConstEnums?: boolean;
|
||||
preserveSymlinks?: boolean;
|
||||
preserveWatchOutput?: boolean;
|
||||
pretty?: boolean;
|
||||
removeComments?: boolean;
|
||||
rootDir?: string;
|
||||
isolatedModules?: boolean;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
suppressExcessPropertyErrors?: boolean;
|
||||
suppressImplicitAnyIndexErrors?: boolean;
|
||||
target?: 'ES3' | 'ES5' | 'ES6' | 'ES2015' | 'ES2016' | 'ES2017' | 'ES2018' | 'ES2019' | 'ES2020' | 'ESNext' | string;
|
||||
watch?: boolean;
|
||||
fallbackPolling?: 'fixedPollingInterval' | 'priorityPollingInterval' | 'dynamicPriorityPolling';
|
||||
watchDirectory?: 'useFsEvents' | 'fixedPollingInterval' | 'dynamicPriorityPolling';
|
||||
watchFile?: 'fixedPollingInterval' | 'priorityPollingInterval' | 'dynamicPriorityPolling' | 'useFsEvents' | 'useFsEventsOnParentDirectory';
|
||||
experimentalDecorators?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
allowUnusedLabels?: boolean;
|
||||
noImplicitReturns?: boolean;
|
||||
noUncheckedIndexedAccess?: boolean;
|
||||
noFallthroughCasesInSwitch?: boolean;
|
||||
allowUnreachableCode?: boolean;
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
generateCpuProfile?: string;
|
||||
baseUrl?: string;
|
||||
paths?: {
|
||||
[k: string]: string[];
|
||||
};
|
||||
plugins?: {
|
||||
name?: string;
|
||||
[k: string]: unknown;
|
||||
}[];
|
||||
rootDirs?: string[];
|
||||
typeRoots?: string[];
|
||||
types?: string[];
|
||||
traceResolution?: boolean;
|
||||
allowJs?: boolean;
|
||||
noErrorTruncation?: boolean;
|
||||
allowSyntheticDefaultImports?: boolean;
|
||||
noImplicitUseStrict?: boolean;
|
||||
listEmittedFiles?: boolean;
|
||||
disableSizeLimit?: boolean;
|
||||
lib?: ('ES5' | 'ES6' | 'ES2015' | 'ES2015.Collection' | 'ES2015.Core' | 'ES2015.Generator' | 'ES2015.Iterable' | 'ES2015.Promise' | 'ES2015.Proxy' | 'ES2015.Reflect' | 'ES2015.Symbol.WellKnown' | 'ES2015.Symbol' | 'ES2016' | 'ES2016.Array.Include' | 'ES2017' | 'ES2017.Intl' | 'ES2017.Object' | 'ES2017.SharedMemory' | 'ES2017.String' | 'ES2017.TypedArrays' | 'ES2018' | 'ES2018.AsyncGenerator' | 'ES2018.AsyncIterable' | 'ES2018.Intl' | 'ES2018.Promise' | 'ES2018.Regexp' | 'ES2019' | 'ES2019.Array' | 'ES2019.Object' | 'ES2019.String' | 'ES2019.Symbol' | 'ES2020' | 'ES2020.BigInt' | 'ES2020.Promise' | 'ES2020.String' | 'ES2020.Symbol.WellKnown' | 'ESNext' | 'ESNext.Array' | 'ESNext.AsyncIterable' | 'ESNext.BigInt' | 'ESNext.Intl' | 'ESNext.Promise' | 'ESNext.String' | 'ESNext.Symbol' | 'DOM' | 'DOM.Iterable' | 'ScriptHost' | 'WebWorker' | 'WebWorker.ImportScripts')[];
|
||||
strictNullChecks?: boolean;
|
||||
maxNodeModuleJsDepth?: number;
|
||||
importHelpers?: boolean;
|
||||
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error';
|
||||
alwaysStrict?: boolean;
|
||||
strict?: boolean;
|
||||
strictBindCallApply?: boolean;
|
||||
downlevelIteration?: boolean;
|
||||
checkJs?: boolean;
|
||||
strictFunctionTypes?: boolean;
|
||||
strictPropertyInitialization?: boolean;
|
||||
esModuleInterop?: boolean;
|
||||
allowUmdGlobalAccess?: boolean;
|
||||
keyofStringsOnly?: boolean;
|
||||
useDefineForClassFields?: boolean;
|
||||
declarationMap?: boolean;
|
||||
resolveJsonModule?: boolean;
|
||||
assumeChangesOnlyAffectDirectDependencies?: boolean;
|
||||
extendedDiagnostics?: boolean;
|
||||
listFilesOnly?: boolean;
|
||||
disableSourceOfProjectReferenceRedirect?: boolean;
|
||||
disableSolutionSearching?: boolean;
|
||||
[k: string]: unknown;
|
||||
}
|
2
node_modules/ts-jest/dist/tsconfig-raw.js
generated
vendored
Normal file
2
node_modules/ts-jest/dist/tsconfig-raw.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
50
node_modules/ts-jest/dist/types.d.ts
generated
vendored
Normal file
50
node_modules/ts-jest/dist/types.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
import type { Config } from '@jest/types';
|
||||
import type * as _babel from 'babel__core';
|
||||
import type * as _ts from 'typescript';
|
||||
import type { RawCompilerOptions } from './tsconfig-raw';
|
||||
export declare type TTypeScript = typeof _ts;
|
||||
export declare type BabelConfig = _babel.TransformOptions;
|
||||
export interface AstTransformer<T = Record<string, unknown>> {
|
||||
path: string;
|
||||
options?: T;
|
||||
}
|
||||
export interface ConfigCustomTransformer {
|
||||
before?: (string | AstTransformer)[];
|
||||
after?: (string | AstTransformer)[];
|
||||
afterDeclarations?: (string | AstTransformer)[];
|
||||
}
|
||||
export interface TsJestGlobalOptions {
|
||||
tsConfig?: boolean | string | RawCompilerOptions;
|
||||
tsconfig?: boolean | string | RawCompilerOptions;
|
||||
packageJson?: boolean | string | Record<string, unknown>;
|
||||
isolatedModules?: boolean;
|
||||
compiler?: string;
|
||||
astTransformers?: string[] | ConfigCustomTransformer;
|
||||
diagnostics?: boolean | {
|
||||
pretty?: boolean;
|
||||
ignoreCodes?: number | string | (number | string)[];
|
||||
pathRegex?: RegExp | string;
|
||||
exclude?: Config.Glob[];
|
||||
warnOnly?: boolean;
|
||||
};
|
||||
babelConfig?: boolean | string | BabelConfig;
|
||||
stringifyContentPathRegex?: string | RegExp;
|
||||
}
|
||||
export interface GlobalConfigTsJest extends Config.ConfigGlobals {
|
||||
'ts-jest': TsJestGlobalOptions;
|
||||
}
|
||||
export interface InitialOptionsTsJest extends Config.InitialOptions {
|
||||
globals?: GlobalConfigTsJest;
|
||||
}
|
||||
export declare type TsJestPresets = Pick<Config.InitialOptions, 'moduleFileExtensions' | 'transform' | 'testMatch'>;
|
||||
export interface TsJestDiagnosticsCfg {
|
||||
pretty: boolean;
|
||||
ignoreCodes: number[];
|
||||
pathRegex?: string | undefined;
|
||||
exclude: Config.Glob[];
|
||||
throws: boolean;
|
||||
warnOnly?: boolean;
|
||||
}
|
||||
export interface TsCompiler {
|
||||
program: _ts.Program | undefined;
|
||||
}
|
2
node_modules/ts-jest/dist/types.js
generated
vendored
Normal file
2
node_modules/ts-jest/dist/types.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
1
node_modules/ts-jest/dist/utils/backports.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/utils/backports.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
104
node_modules/ts-jest/dist/utils/backports.js
generated
vendored
Normal file
104
node_modules/ts-jest/dist/utils/backports.js
generated
vendored
Normal file
|
@ -0,0 +1,104 @@
|
|||
"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);
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.backportTsJestDebugEnvVar = exports.backportJestConfig = void 0;
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var messages_1 = require("./messages");
|
||||
var constants_1 = require("../constants");
|
||||
var context = (_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'backports', _a);
|
||||
exports.backportJestConfig = function (logger, config) {
|
||||
var _a, _b;
|
||||
logger.debug(__assign(__assign({}, context), { config: config }), 'backporting config');
|
||||
var _c = (config || {}).globals, globals = _c === void 0 ? {} : _c;
|
||||
var _d = globals["ts-jest"], tsJest = _d === void 0 ? {} : _d;
|
||||
var mergeTsJest = {};
|
||||
var hadWarnings = false;
|
||||
var warnConfig = function (oldPath, newPath, note) {
|
||||
hadWarnings = true;
|
||||
logger.warn(context, messages_1.interpolate(note ? "\"[jest-config].{{oldPath}}\" is deprecated, use \"[jest-config].{{newPath}}\" instead.\n \u21B3 {{note}}" : "\"[jest-config].{{oldPath}}\" is deprecated, use \"[jest-config].{{newPath}}\" instead.", {
|
||||
oldPath: oldPath,
|
||||
newPath: newPath,
|
||||
note: note,
|
||||
}));
|
||||
};
|
||||
if ('__TS_CONFIG__' in globals) {
|
||||
warnConfig('globals.__TS_CONFIG__', 'globals.ts-jest.tsConfig');
|
||||
if (typeof globals.__TS_CONFIG__ === 'object') {
|
||||
mergeTsJest.tsConfig = globals.__TS_CONFIG__;
|
||||
}
|
||||
delete globals.__TS_CONFIG__;
|
||||
}
|
||||
if ('__TRANSFORM_HTML__' in globals) {
|
||||
warnConfig('globals.__TRANSFORM_HTML__', 'globals.ts-jest.stringifyContentPathRegex');
|
||||
if (globals.__TRANSFORM_HTML__) {
|
||||
mergeTsJest.stringifyContentPathRegex = '\\.html?$';
|
||||
}
|
||||
delete globals.__TRANSFORM_HTML__;
|
||||
}
|
||||
if ('typeCheck' in tsJest) {
|
||||
warnConfig('globals.ts-jest.typeCheck', 'globals.ts-jest.isolatedModules');
|
||||
mergeTsJest.isolatedModules = !tsJest.typeCheck;
|
||||
delete tsJest.typeCheck;
|
||||
}
|
||||
if ('tsConfigFile' in tsJest) {
|
||||
warnConfig('globals.ts-jest.tsConfigFile', 'globals.ts-jest.tsConfig');
|
||||
if (tsJest.tsConfigFile) {
|
||||
mergeTsJest.tsConfig = tsJest.tsConfigFile;
|
||||
}
|
||||
delete tsJest.tsConfigFile;
|
||||
}
|
||||
if ('enableTsDiagnostics' in tsJest) {
|
||||
warnConfig('globals.ts-jest.enableTsDiagnostics', 'globals.ts-jest.diagnostics');
|
||||
if (tsJest.enableTsDiagnostics) {
|
||||
mergeTsJest.diagnostics = { warnOnly: true };
|
||||
if (typeof tsJest.enableTsDiagnostics === 'string')
|
||||
mergeTsJest.diagnostics.pathRegex = tsJest.enableTsDiagnostics;
|
||||
}
|
||||
else {
|
||||
mergeTsJest.diagnostics = false;
|
||||
}
|
||||
delete tsJest.enableTsDiagnostics;
|
||||
}
|
||||
if ('useBabelrc' in tsJest) {
|
||||
warnConfig('globals.ts-jest.useBabelrc', 'globals.ts-jest.babelConfig', "See `babel-jest` related issue: https://github.com/facebook/jest/issues/3845");
|
||||
if (tsJest.useBabelrc != null) {
|
||||
mergeTsJest.babelConfig = tsJest.useBabelrc ? true : {};
|
||||
}
|
||||
delete tsJest.useBabelrc;
|
||||
}
|
||||
if ('skipBabel' in tsJest) {
|
||||
warnConfig('globals.ts-jest.skipBabel', 'globals.ts-jest.babelConfig');
|
||||
if (tsJest.skipBabel === false && !mergeTsJest.babelConfig) {
|
||||
mergeTsJest.babelConfig = true;
|
||||
}
|
||||
delete tsJest.skipBabel;
|
||||
}
|
||||
if (hadWarnings) {
|
||||
logger.warn(context, "Your Jest configuration is outdated. Use the CLI to help migrating it: ts-jest config:migrate <config-file>.");
|
||||
}
|
||||
return __assign(__assign({}, config), { testMatch: (_a = config.testMatch) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_JEST_TEST_MATCH, testRegex: (_b = config.testRegex) !== null && _b !== void 0 ? _b : [], globals: __assign(__assign({}, globals), { 'ts-jest': __assign(__assign({}, mergeTsJest), tsJest) }) });
|
||||
};
|
||||
exports.backportTsJestDebugEnvVar = function (logger) {
|
||||
if ('TS_JEST_DEBUG' in process.env) {
|
||||
var shouldLog = !/^\s*(?:0|f(?:alse)?|no?|disabled?|off|)\s*$/i.test(process.env.TS_JEST_DEBUG || '');
|
||||
delete process.env.TS_JEST_DEBUG;
|
||||
if (shouldLog) {
|
||||
process.env.TS_JEST_LOG = 'ts-jest.log,stderr:warn';
|
||||
}
|
||||
logger.warn(context, messages_1.interpolate("Using env. var \"{{old}}\" is deprecated, use \"{{new}}\" instead.", {
|
||||
old: 'TS_JEST_DEBUG',
|
||||
new: 'TS_JEST_LOG',
|
||||
}));
|
||||
}
|
||||
};
|
1
node_modules/ts-jest/dist/utils/get-package-version.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/utils/get-package-version.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
11
node_modules/ts-jest/dist/utils/get-package-version.js
generated
vendored
Normal file
11
node_modules/ts-jest/dist/utils/get-package-version.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getPackageVersion = void 0;
|
||||
function getPackageVersion(moduleName) {
|
||||
try {
|
||||
return require(moduleName + "/package.json").version;
|
||||
}
|
||||
catch (err) { }
|
||||
return;
|
||||
}
|
||||
exports.getPackageVersion = getPackageVersion;
|
1
node_modules/ts-jest/dist/utils/importer.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/utils/importer.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
197
node_modules/ts-jest/dist/utils/importer.js
generated
vendored
Normal file
197
node_modules/ts-jest/dist/utils/importer.js
generated
vendored
Normal file
|
@ -0,0 +1,197 @@
|
|||
"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);
|
||||
};
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spread = (this && this.__spread) || function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__requireModule = exports.importer = exports.Importer = void 0;
|
||||
var logger_1 = require("./logger");
|
||||
var memoize_1 = require("./memoize");
|
||||
var messages_1 = require("./messages");
|
||||
var version_checkers_1 = require("./version-checkers");
|
||||
var logger = logger_1.rootLogger.child({ namespace: 'Importer' });
|
||||
var passThru = function (action) { return function (input) {
|
||||
action();
|
||||
return input;
|
||||
}; };
|
||||
var Importer = (function () {
|
||||
function Importer(_patches) {
|
||||
if (_patches === void 0) { _patches = {}; }
|
||||
this._patches = _patches;
|
||||
}
|
||||
Object.defineProperty(Importer, "instance", {
|
||||
get: function () {
|
||||
logger.debug('creating Importer singleton');
|
||||
return new Importer({
|
||||
'@babel/core': [passThru(version_checkers_1.VersionCheckers.babelCore.warn)],
|
||||
'babel-jest': [passThru(version_checkers_1.VersionCheckers.babelJest.warn)],
|
||||
typescript: [passThru(version_checkers_1.VersionCheckers.typescript.warn)],
|
||||
jest: [passThru(version_checkers_1.VersionCheckers.jest.warn)],
|
||||
});
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Importer.prototype.babelJest = function (why) {
|
||||
return this._import(why, 'babel-jest');
|
||||
};
|
||||
Importer.prototype.babelCore = function (why) {
|
||||
return this._import(why, '@babel/core');
|
||||
};
|
||||
Importer.prototype.typescript = function (why, which) {
|
||||
return this._import(why, which);
|
||||
};
|
||||
Importer.prototype.tryThese = function (moduleName) {
|
||||
var fallbacks = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
fallbacks[_i - 1] = arguments[_i];
|
||||
}
|
||||
var name;
|
||||
var loaded;
|
||||
var tries = __spread([moduleName], fallbacks);
|
||||
while ((name = tries.shift()) !== undefined) {
|
||||
var req = requireWrapper(name);
|
||||
var contextReq = __assign({}, req);
|
||||
delete contextReq.exports;
|
||||
if (req.exists) {
|
||||
loaded = req;
|
||||
if (loaded.error) {
|
||||
logger.error({ requireResult: contextReq }, "failed loading module '" + name + "'", loaded.error.message);
|
||||
}
|
||||
else {
|
||||
logger.debug({ requireResult: contextReq }, 'loaded module', name);
|
||||
loaded.exports = this._patch(name, loaded.exports);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else {
|
||||
logger.debug({ requireResult: contextReq }, "module '" + name + "' not found");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return loaded;
|
||||
};
|
||||
Importer.prototype.tryTheseOr = function (moduleNames, missingResult, allowLoadError) {
|
||||
if (allowLoadError === void 0) { allowLoadError = false; }
|
||||
var args = Array.isArray(moduleNames) ? moduleNames : [moduleNames];
|
||||
var result = this.tryThese.apply(this, __spread(args));
|
||||
if (!result)
|
||||
return missingResult;
|
||||
if (!result.error)
|
||||
return result.exports;
|
||||
if (allowLoadError)
|
||||
return missingResult;
|
||||
throw result.error;
|
||||
};
|
||||
Importer.prototype._patch = function (name, unpatched) {
|
||||
if (name in this._patches) {
|
||||
logger.debug('patching', name);
|
||||
return this._patches[name].reduce(function (mod, patcher) { return patcher(mod); }, unpatched);
|
||||
}
|
||||
return unpatched;
|
||||
};
|
||||
Importer.prototype._import = function (why, moduleName, _a) {
|
||||
var _b = _a === void 0 ? {} : _a, _c = _b.alternatives, alternatives = _c === void 0 ? [] : _c, _d = _b.installTip, installTip = _d === void 0 ? moduleName : _d;
|
||||
var res = this.tryThese.apply(this, __spread([moduleName], alternatives));
|
||||
if (res && res.exists) {
|
||||
if (!res.error)
|
||||
return res.exports;
|
||||
throw new Error(messages_1.interpolate("Loading module {{module}} failed with error: {{error}}", { module: res.given, error: res.error.message }));
|
||||
}
|
||||
var msg = alternatives.length ? "Unable to load any of these modules: {{module}}. {{reason}}. To fix it:\n{{fix}}" : "Unable to load the module {{module}}. {{reason}} To fix it:\n{{fix}}";
|
||||
var loadModule = __spread([moduleName], alternatives).map(function (m) { return "\"" + m + "\""; }).join(', ');
|
||||
if (typeof installTip === 'string') {
|
||||
installTip = [{ module: installTip, label: "install \"" + installTip + "\"" }];
|
||||
}
|
||||
var fix = installTip
|
||||
.map(function (tip) { return " " + (installTip.length === 1 ? '↳' : '•') + " " + messages_1.interpolate("{{label}}: `npm i -D {{module}}` (or `yarn add --dev {{module}}`)", tip); })
|
||||
.join('\n');
|
||||
throw new Error(messages_1.interpolate(msg, {
|
||||
module: loadModule,
|
||||
reason: why,
|
||||
fix: fix,
|
||||
}));
|
||||
};
|
||||
__decorate([
|
||||
memoize_1.Memoize(function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return args.join(':');
|
||||
})
|
||||
], Importer.prototype, "tryThese", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize(function (name) { return name; })
|
||||
], Importer.prototype, "_patch", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], Importer, "instance", null);
|
||||
return Importer;
|
||||
}());
|
||||
exports.Importer = Importer;
|
||||
exports.importer = Importer.instance;
|
||||
function requireWrapper(moduleName) {
|
||||
var path;
|
||||
var exists = false;
|
||||
try {
|
||||
path = resolveModule(moduleName);
|
||||
exists = true;
|
||||
}
|
||||
catch (error) {
|
||||
return { error: error, exists: exists, given: moduleName };
|
||||
}
|
||||
var result = { exists: exists, path: path, given: moduleName };
|
||||
try {
|
||||
result.exports = requireModule(path);
|
||||
}
|
||||
catch (error) {
|
||||
try {
|
||||
result.exports = requireModule(moduleName);
|
||||
}
|
||||
catch (error) {
|
||||
result.error = error;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
var requireModule = function (mod) { return require(mod); };
|
||||
var resolveModule = function (mod) { return require.resolve(mod, { paths: [process.cwd(), __dirname] }); };
|
||||
function __requireModule(localRequire, localResolve) {
|
||||
requireModule = localRequire;
|
||||
resolveModule = localResolve;
|
||||
}
|
||||
exports.__requireModule = __requireModule;
|
2
node_modules/ts-jest/dist/utils/json.d.ts
generated
vendored
Normal file
2
node_modules/ts-jest/dist/utils/json.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export declare function stringify(input: unknown): string;
|
||||
export declare function parse(input: string): any;
|
32
node_modules/ts-jest/dist/utils/json.js
generated
vendored
Normal file
32
node_modules/ts-jest/dist/utils/json.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.normalize = exports.parse = exports.stringify = void 0;
|
||||
var stableStringify = require("fast-json-stable-stringify");
|
||||
var UNDEFINED = 'undefined';
|
||||
function stringify(input) {
|
||||
return input === undefined ? UNDEFINED : stableStringify(input);
|
||||
}
|
||||
exports.stringify = stringify;
|
||||
function parse(input) {
|
||||
return input === UNDEFINED ? undefined : JSON.parse(input);
|
||||
}
|
||||
exports.parse = parse;
|
||||
function normalize(input, _a) {
|
||||
var _b = (_a === void 0 ? {} : _a).parse, parser = _b === void 0 ? parse : _b;
|
||||
var result;
|
||||
if (normalize.cache.has(input)) {
|
||||
result = normalize.cache.get(input);
|
||||
}
|
||||
else {
|
||||
var data = parser(input);
|
||||
result = stringify(data);
|
||||
if (result === input)
|
||||
result = undefined;
|
||||
normalize.cache.set(input, result);
|
||||
}
|
||||
return result === undefined ? input : result;
|
||||
}
|
||||
exports.normalize = normalize;
|
||||
(function (normalize) {
|
||||
normalize.cache = new Map();
|
||||
})(normalize = exports.normalize || (exports.normalize = {}));
|
10
node_modules/ts-jest/dist/utils/jsonable-value.d.ts
generated
vendored
Normal file
10
node_modules/ts-jest/dist/utils/jsonable-value.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
export declare class JsonableValue<V = Record<string, any>> {
|
||||
private _serialized;
|
||||
private _value;
|
||||
constructor(value: V);
|
||||
set value(value: V);
|
||||
get value(): V;
|
||||
get serialized(): string;
|
||||
valueOf(): V;
|
||||
toString(): string;
|
||||
}
|
35
node_modules/ts-jest/dist/utils/jsonable-value.js
generated
vendored
Normal file
35
node_modules/ts-jest/dist/utils/jsonable-value.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.JsonableValue = void 0;
|
||||
var json_1 = require("./json");
|
||||
var JsonableValue = (function () {
|
||||
function JsonableValue(value) {
|
||||
this.value = value;
|
||||
}
|
||||
Object.defineProperty(JsonableValue.prototype, "value", {
|
||||
get: function () {
|
||||
return this._value;
|
||||
},
|
||||
set: function (value) {
|
||||
this._value = value;
|
||||
this._serialized = json_1.stringify(value);
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(JsonableValue.prototype, "serialized", {
|
||||
get: function () {
|
||||
return this._serialized;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
JsonableValue.prototype.valueOf = function () {
|
||||
return this._value;
|
||||
};
|
||||
JsonableValue.prototype.toString = function () {
|
||||
return this._serialized;
|
||||
};
|
||||
return JsonableValue;
|
||||
}());
|
||||
exports.JsonableValue = JsonableValue;
|
1
node_modules/ts-jest/dist/utils/logger.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/utils/logger.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export declare let rootLogger: import("bs-logger/dist/logger").Logger;
|
22
node_modules/ts-jest/dist/utils/logger.js
generated
vendored
Normal file
22
node_modules/ts-jest/dist/utils/logger.js
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.rootLogger = void 0;
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var backports_1 = require("./backports");
|
||||
var original = process.env.TS_JEST_LOG;
|
||||
var buildOptions = function () {
|
||||
var _a;
|
||||
return ({
|
||||
context: (_a = {},
|
||||
_a[bs_logger_1.LogContexts.package] = 'ts-jest',
|
||||
_a[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.trace,
|
||||
_a.version = require('../../package.json').version,
|
||||
_a),
|
||||
targets: process.env.TS_JEST_LOG || undefined,
|
||||
});
|
||||
};
|
||||
exports.rootLogger = bs_logger_1.createLogger(buildOptions());
|
||||
backports_1.backportTsJestDebugEnvVar(exports.rootLogger);
|
||||
if (original !== process.env.TS_JEST_LOG) {
|
||||
exports.rootLogger = bs_logger_1.createLogger(buildOptions());
|
||||
}
|
1
node_modules/ts-jest/dist/utils/memoize.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/utils/memoize.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
48
node_modules/ts-jest/dist/utils/memoize.js
generated
vendored
Normal file
48
node_modules/ts-jest/dist/utils/memoize.js
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Memoize = void 0;
|
||||
var cacheProp = Symbol.for('[memoize]');
|
||||
function Memoize(keyBuilder) {
|
||||
return function (_, propertyKey, descriptor) {
|
||||
if (descriptor.value != null) {
|
||||
descriptor.value = memoize(propertyKey, descriptor.value, keyBuilder || (function (v) { return v; }));
|
||||
}
|
||||
else if (descriptor.get != null) {
|
||||
descriptor.get = memoize(propertyKey, descriptor.get, keyBuilder || (function () { return propertyKey; }));
|
||||
}
|
||||
};
|
||||
}
|
||||
exports.Memoize = Memoize;
|
||||
function ensureCache(target, reset) {
|
||||
if (reset === void 0) { reset = false; }
|
||||
if (reset || !target[cacheProp]) {
|
||||
Object.defineProperty(target, cacheProp, {
|
||||
value: Object.create(null),
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
return target[cacheProp];
|
||||
}
|
||||
function ensureChildCache(target, key, reset) {
|
||||
if (reset === void 0) { reset = false; }
|
||||
var dict = ensureCache(target);
|
||||
if (reset || !dict[key]) {
|
||||
dict[key] = new Map();
|
||||
}
|
||||
return dict[key];
|
||||
}
|
||||
function memoize(namespace, func, keyBuilder) {
|
||||
return function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var cache = ensureChildCache(this, namespace);
|
||||
var key = keyBuilder.apply(this, args);
|
||||
if (cache.has(key))
|
||||
return cache.get(key);
|
||||
var res = func.apply(this, args);
|
||||
cache.set(key, res);
|
||||
return res;
|
||||
};
|
||||
}
|
1
node_modules/ts-jest/dist/utils/messages.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/utils/messages.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
8
node_modules/ts-jest/dist/utils/messages.js
generated
vendored
Normal file
8
node_modules/ts-jest/dist/utils/messages.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.interpolate = void 0;
|
||||
function interpolate(msg, vars) {
|
||||
if (vars === void 0) { vars = {}; }
|
||||
return msg.replace(/\{\{([^\}]+)\}\}/g, function (_, key) { return (key in vars ? vars[key] : _); });
|
||||
}
|
||||
exports.interpolate = interpolate;
|
1
node_modules/ts-jest/dist/utils/normalize-slashes.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/utils/normalize-slashes.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
7
node_modules/ts-jest/dist/utils/normalize-slashes.js
generated
vendored
Normal file
7
node_modules/ts-jest/dist/utils/normalize-slashes.js
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.normalizeSlashes = void 0;
|
||||
function normalizeSlashes(value) {
|
||||
return value.replace(/\\/g, '/');
|
||||
}
|
||||
exports.normalizeSlashes = normalizeSlashes;
|
1
node_modules/ts-jest/dist/utils/sha1.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/utils/sha1.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
32
node_modules/ts-jest/dist/utils/sha1.js
generated
vendored
Normal file
32
node_modules/ts-jest/dist/utils/sha1.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sha1 = exports.cache = void 0;
|
||||
var crypto_1 = require("crypto");
|
||||
exports.cache = Object.create(null);
|
||||
function sha1() {
|
||||
var data = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
data[_i] = arguments[_i];
|
||||
}
|
||||
var canCache = data.length === 1 && typeof data[0] === 'string';
|
||||
var cacheKey;
|
||||
if (canCache) {
|
||||
cacheKey = data[0];
|
||||
if (cacheKey in exports.cache) {
|
||||
return exports.cache[cacheKey];
|
||||
}
|
||||
}
|
||||
var hash = crypto_1.createHash('sha1');
|
||||
data.forEach(function (item) {
|
||||
if (typeof item === 'string')
|
||||
hash.update(item, 'utf8');
|
||||
else
|
||||
hash.update(item);
|
||||
});
|
||||
var res = hash.digest('hex').toString();
|
||||
if (canCache) {
|
||||
exports.cache[cacheKey] = res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
exports.sha1 = sha1;
|
33
node_modules/ts-jest/dist/utils/testing.d.ts
generated
vendored
Normal file
33
node_modules/ts-jest/dist/utils/testing.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
/// <reference types="jest" />
|
||||
export declare type MockableFunction = (...args: any[]) => any;
|
||||
export declare type MethodKeysOf<T> = {
|
||||
[K in keyof T]: T[K] extends MockableFunction ? K : never;
|
||||
}[keyof T];
|
||||
export declare type PropertyKeysOf<T> = {
|
||||
[K in keyof T]: T[K] extends MockableFunction ? never : K;
|
||||
}[keyof T];
|
||||
export declare type ArgumentsOf<T> = T extends (...args: infer A) => any ? A : never;
|
||||
export declare type ConstructorArgumentsOf<T> = T extends new (...args: infer A) => any ? A : never;
|
||||
export interface MockWithArgs<T extends MockableFunction> extends jest.MockInstance<ReturnType<T>, ArgumentsOf<T>> {
|
||||
new (...args: ConstructorArgumentsOf<T>): T;
|
||||
(...args: ArgumentsOf<T>): ReturnType<T>;
|
||||
}
|
||||
export declare type MaybeMockedConstructor<T> = T extends new (...args: any[]) => infer R ? jest.MockInstance<R, ConstructorArgumentsOf<T>> : T;
|
||||
export declare type MockedFunction<T extends MockableFunction> = MockWithArgs<T> & {
|
||||
[K in keyof T]: T[K];
|
||||
};
|
||||
export declare type MockedFunctionDeep<T extends MockableFunction> = MockWithArgs<T> & MockedObjectDeep<T>;
|
||||
export declare type MockedObject<T> = MaybeMockedConstructor<T> & {
|
||||
[K in MethodKeysOf<T>]: T[K] extends MockableFunction ? MockedFunction<T[K]> : T[K];
|
||||
} & {
|
||||
[K in PropertyKeysOf<T>]: T[K];
|
||||
};
|
||||
export declare type MockedObjectDeep<T> = MaybeMockedConstructor<T> & {
|
||||
[K in MethodKeysOf<T>]: T[K] extends MockableFunction ? MockedFunctionDeep<T[K]> : T[K];
|
||||
} & {
|
||||
[K in PropertyKeysOf<T>]: MaybeMockedDeep<T[K]>;
|
||||
};
|
||||
export declare type MaybeMockedDeep<T> = T extends MockableFunction ? MockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;
|
||||
export declare type MaybeMocked<T> = T extends MockableFunction ? MockedFunction<T> : T extends object ? MockedObject<T> : T;
|
||||
export declare function mocked<T>(item: T, deep?: false): MaybeMocked<T>;
|
||||
export declare function mocked<T>(item: T, deep: true): MaybeMockedDeep<T>;
|
8
node_modules/ts-jest/dist/utils/testing.js
generated
vendored
Normal file
8
node_modules/ts-jest/dist/utils/testing.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.mocked = void 0;
|
||||
function mocked(item, _deep) {
|
||||
if (_deep === void 0) { _deep = false; }
|
||||
return item;
|
||||
}
|
||||
exports.mocked = mocked;
|
1
node_modules/ts-jest/dist/utils/ts-error.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/utils/ts-error.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
41
node_modules/ts-jest/dist/utils/ts-error.js
generated
vendored
Normal file
41
node_modules/ts-jest/dist/utils/ts-error.js
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TSError = exports.INSPECT_CUSTOM = void 0;
|
||||
var make_error_1 = require("make-error");
|
||||
var util_1 = require("util");
|
||||
var logger_1 = require("./logger");
|
||||
var messages_1 = require("./messages");
|
||||
var logger = logger_1.rootLogger.child({ namespace: 'TSError' });
|
||||
exports.INSPECT_CUSTOM = util_1.inspect.custom || 'inspect';
|
||||
var TSError = (function (_super) {
|
||||
__extends(TSError, _super);
|
||||
function TSError(diagnosticText, diagnosticCodes) {
|
||||
var _this = _super.call(this, messages_1.interpolate("{{diagnostics}}", {
|
||||
diagnostics: diagnosticText.trim(),
|
||||
})) || this;
|
||||
_this.diagnosticText = diagnosticText;
|
||||
_this.diagnosticCodes = diagnosticCodes;
|
||||
_this.name = 'TSError';
|
||||
logger.debug({ diagnosticCodes: diagnosticCodes, diagnosticText: diagnosticText }, 'created new TSError');
|
||||
Object.defineProperty(_this, 'stack', { value: '' });
|
||||
return _this;
|
||||
}
|
||||
TSError.prototype[exports.INSPECT_CUSTOM] = function () {
|
||||
return this.diagnosticText;
|
||||
};
|
||||
return TSError;
|
||||
}(make_error_1.BaseError));
|
||||
exports.TSError = TSError;
|
1
node_modules/ts-jest/dist/utils/version-checkers.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/utils/version-checkers.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
60
node_modules/ts-jest/dist/utils/version-checkers.js
generated
vendored
Normal file
60
node_modules/ts-jest/dist/utils/version-checkers.js
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.VersionCheckers = void 0;
|
||||
var semver_1 = require("semver");
|
||||
var get_package_version_1 = require("./get-package-version");
|
||||
var logger_1 = require("./logger");
|
||||
var messages_1 = require("./messages");
|
||||
var logger = logger_1.rootLogger.child({ namespace: 'versions' });
|
||||
exports.VersionCheckers = {
|
||||
jest: createVersionChecker('jest', ">=26 <27"),
|
||||
typescript: createVersionChecker('typescript', ">=3.8 <5"),
|
||||
babelJest: createVersionChecker('babel-jest', ">=26 <27"),
|
||||
babelCore: createVersionChecker('@babel/core', ">=7.0.0-beta.0 <8"),
|
||||
};
|
||||
function checkVersion(name, expectedRange, action) {
|
||||
if (action === void 0) { action = 'warn'; }
|
||||
var success = true;
|
||||
if (!('TS_JEST_DISABLE_VER_CHECKER' in process.env)) {
|
||||
var version = get_package_version_1.getPackageVersion(name);
|
||||
success = !!version && semver_1.satisfies(version, expectedRange);
|
||||
logger.debug({
|
||||
actualVersion: version,
|
||||
expectedVersion: expectedRange,
|
||||
}, 'checking version of %s: %s', name, success ? 'OK' : 'NOT OK');
|
||||
if (!action || success)
|
||||
return success;
|
||||
var message = messages_1.interpolate(version ? "Version {{actualVersion}} of {{module}} installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version ({{expectedVersion}}). Please do not report issues in ts-jest if you are using unsupported versions." : "Module {{module}} is not installed. If you're experiencing issues, consider installing a supported version ({{expectedVersion}}).", {
|
||||
module: name,
|
||||
actualVersion: version || '??',
|
||||
expectedVersion: rangeToHumanString(expectedRange),
|
||||
});
|
||||
if (action === 'warn') {
|
||||
logger.warn(message);
|
||||
}
|
||||
else if (action === 'throw') {
|
||||
logger.fatal(message);
|
||||
throw new RangeError(message);
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
function rangeToHumanString(versionRange) {
|
||||
return new semver_1.Range(versionRange).toString();
|
||||
}
|
||||
function createVersionChecker(moduleName, expectedVersion) {
|
||||
var memo;
|
||||
var warn = function () {
|
||||
if (memo !== undefined)
|
||||
return memo;
|
||||
return (memo = checkVersion(moduleName, expectedVersion, 'warn'));
|
||||
};
|
||||
var raise = function () { return checkVersion(moduleName, expectedVersion, 'throw'); };
|
||||
return {
|
||||
raise: raise,
|
||||
warn: warn,
|
||||
forget: function () {
|
||||
memo = undefined;
|
||||
},
|
||||
};
|
||||
}
|
1
node_modules/ts-jest/jest-preset.js
generated
vendored
Normal file
1
node_modules/ts-jest/jest-preset.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('./presets').defaults
|
15
node_modules/ts-jest/node_modules/semver/LICENSE
generated
vendored
Normal file
15
node_modules/ts-jest/node_modules/semver/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
568
node_modules/ts-jest/node_modules/semver/README.md
generated
vendored
Normal file
568
node_modules/ts-jest/node_modules/semver/README.md
generated
vendored
Normal file
|
@ -0,0 +1,568 @@
|
|||
semver(1) -- The semantic versioner for npm
|
||||
===========================================
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install semver
|
||||
````
|
||||
|
||||
## Usage
|
||||
|
||||
As a node module:
|
||||
|
||||
```js
|
||||
const semver = require('semver')
|
||||
|
||||
semver.valid('1.2.3') // '1.2.3'
|
||||
semver.valid('a.b.c') // null
|
||||
semver.clean(' =v1.2.3 ') // '1.2.3'
|
||||
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
|
||||
semver.gt('1.2.3', '9.8.7') // false
|
||||
semver.lt('1.2.3', '9.8.7') // true
|
||||
semver.minVersion('>=1.0.0') // '1.0.0'
|
||||
semver.valid(semver.coerce('v2')) // '2.0.0'
|
||||
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
|
||||
```
|
||||
|
||||
You can also just load the module for the function that you care about, if
|
||||
you'd like to minimize your footprint.
|
||||
|
||||
```js
|
||||
// load the whole API at once in a single object
|
||||
const semver = require('semver')
|
||||
|
||||
// or just load the bits you need
|
||||
// all of them listed here, just pick and choose what you want
|
||||
|
||||
// classes
|
||||
const SemVer = require('semver/classes/semver')
|
||||
const Comparator = require('semver/classes/comparator')
|
||||
const Range = require('semver/classes/range')
|
||||
|
||||
// functions for working with versions
|
||||
const semverParse = require('semver/functions/parse')
|
||||
const semverValid = require('semver/functions/valid')
|
||||
const semverClean = require('semver/functions/clean')
|
||||
const semverInc = require('semver/functions/inc')
|
||||
const semverDiff = require('semver/functions/diff')
|
||||
const semverMajor = require('semver/functions/major')
|
||||
const semverMinor = require('semver/functions/minor')
|
||||
const semverPatch = require('semver/functions/patch')
|
||||
const semverPrerelease = require('semver/functions/prerelease')
|
||||
const semverCompare = require('semver/functions/compare')
|
||||
const semverRcompare = require('semver/functions/rcompare')
|
||||
const semverCompareLoose = require('semver/functions/compare-loose')
|
||||
const semverCompareBuild = require('semver/functions/compare-build')
|
||||
const semverSort = require('semver/functions/sort')
|
||||
const semverRsort = require('semver/functions/rsort')
|
||||
|
||||
// low-level comparators between versions
|
||||
const semverGt = require('semver/functions/gt')
|
||||
const semverLt = require('semver/functions/lt')
|
||||
const semverEq = require('semver/functions/eq')
|
||||
const semverNeq = require('semver/functions/neq')
|
||||
const semverGte = require('semver/functions/gte')
|
||||
const semverLte = require('semver/functions/lte')
|
||||
const semverCmp = require('semver/functions/cmp')
|
||||
const semverCoerce = require('semver/functions/coerce')
|
||||
|
||||
// working with ranges
|
||||
const semverSatisfies = require('semver/functions/satisfies')
|
||||
const semverMaxSatisfying = require('semver/ranges/max-satisfying')
|
||||
const semverMinSatisfying = require('semver/ranges/min-satisfying')
|
||||
const semverToComparators = require('semver/ranges/to-comparators')
|
||||
const semverMinVersion = require('semver/ranges/min-version')
|
||||
const semverValidRange = require('semver/ranges/valid')
|
||||
const semverOutside = require('semver/ranges/outside')
|
||||
const semverGtr = require('semver/ranges/gtr')
|
||||
const semverLtr = require('semver/ranges/ltr')
|
||||
const semverIntersects = require('semver/ranges/intersects')
|
||||
const simplifyRange = require('semver/ranges/simplify')
|
||||
const rangeSubset = require('semver/ranges/subset')
|
||||
```
|
||||
|
||||
As a command-line utility:
|
||||
|
||||
```
|
||||
$ semver -h
|
||||
|
||||
A JavaScript implementation of the https://semver.org/ specification
|
||||
Copyright Isaac Z. Schlueter
|
||||
|
||||
Usage: semver [options] <version> [<version> [...]]
|
||||
Prints valid versions sorted by SemVer precedence
|
||||
|
||||
Options:
|
||||
-r --range <range>
|
||||
Print versions that match the specified range.
|
||||
|
||||
-i --increment [<level>]
|
||||
Increment a version by the specified level. Level can
|
||||
be one of: major, minor, patch, premajor, preminor,
|
||||
prepatch, or prerelease. Default level is 'patch'.
|
||||
Only one version may be specified.
|
||||
|
||||
--preid <identifier>
|
||||
Identifier to be used to prefix premajor, preminor,
|
||||
prepatch or prerelease version increments.
|
||||
|
||||
-l --loose
|
||||
Interpret versions and ranges loosely
|
||||
|
||||
-p --include-prerelease
|
||||
Always include prerelease versions in range matching
|
||||
|
||||
-c --coerce
|
||||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
|
||||
--rtl
|
||||
Coerce version strings right to left
|
||||
|
||||
--ltr
|
||||
Coerce version strings left to right (default)
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
If no satisfying versions are found, then exits failure.
|
||||
|
||||
Versions are printed in ascending order, so supplying
|
||||
multiple versions to the utility will just sort them.
|
||||
```
|
||||
|
||||
## Versions
|
||||
|
||||
A "version" is described by the `v2.0.0` specification found at
|
||||
<https://semver.org/>.
|
||||
|
||||
A leading `"="` or `"v"` character is stripped off and ignored.
|
||||
|
||||
## Ranges
|
||||
|
||||
A `version range` is a set of `comparators` which specify versions
|
||||
that satisfy the range.
|
||||
|
||||
A `comparator` is composed of an `operator` and a `version`. The set
|
||||
of primitive `operators` is:
|
||||
|
||||
* `<` Less than
|
||||
* `<=` Less than or equal to
|
||||
* `>` Greater than
|
||||
* `>=` Greater than or equal to
|
||||
* `=` Equal. If no operator is specified, then equality is assumed,
|
||||
so this operator is optional, but MAY be included.
|
||||
|
||||
For example, the comparator `>=1.2.7` would match the versions
|
||||
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
|
||||
or `1.1.0`.
|
||||
|
||||
Comparators can be joined by whitespace to form a `comparator set`,
|
||||
which is satisfied by the **intersection** of all of the comparators
|
||||
it includes.
|
||||
|
||||
A range is composed of one or more comparator sets, joined by `||`. A
|
||||
version matches a range if and only if every comparator in at least
|
||||
one of the `||`-separated comparator sets is satisfied by the version.
|
||||
|
||||
For example, the range `>=1.2.7 <1.3.0` would match the versions
|
||||
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
|
||||
or `1.1.0`.
|
||||
|
||||
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
|
||||
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
|
||||
|
||||
### Prerelease Tags
|
||||
|
||||
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
|
||||
it will only be allowed to satisfy comparator sets if at least one
|
||||
comparator with the same `[major, minor, patch]` tuple also has a
|
||||
prerelease tag.
|
||||
|
||||
For example, the range `>1.2.3-alpha.3` would be allowed to match the
|
||||
version `1.2.3-alpha.7`, but it would *not* be satisfied by
|
||||
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
|
||||
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
|
||||
range only accepts prerelease tags on the `1.2.3` version. The
|
||||
version `3.4.5` *would* satisfy the range, because it does not have a
|
||||
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
|
||||
|
||||
The purpose for this behavior is twofold. First, prerelease versions
|
||||
frequently are updated very quickly, and contain many breaking changes
|
||||
that are (by the author's design) not yet fit for public consumption.
|
||||
Therefore, by default, they are excluded from range matching
|
||||
semantics.
|
||||
|
||||
Second, a user who has opted into using a prerelease version has
|
||||
clearly indicated the intent to use *that specific* set of
|
||||
alpha/beta/rc versions. By including a prerelease tag in the range,
|
||||
the user is indicating that they are aware of the risk. However, it
|
||||
is still not appropriate to assume that they have opted into taking a
|
||||
similar risk on the *next* set of prerelease versions.
|
||||
|
||||
Note that this behavior can be suppressed (treating all prerelease
|
||||
versions as if they were normal versions, for the purpose of range
|
||||
matching) by setting the `includePrerelease` flag on the options
|
||||
object to any
|
||||
[functions](https://github.com/npm/node-semver#functions) that do
|
||||
range matching.
|
||||
|
||||
#### Prerelease Identifiers
|
||||
|
||||
The method `.inc` takes an additional `identifier` string argument that
|
||||
will append the value of the string as a prerelease identifier:
|
||||
|
||||
```javascript
|
||||
semver.inc('1.2.3', 'prerelease', 'beta')
|
||||
// '1.2.4-beta.0'
|
||||
```
|
||||
|
||||
command-line example:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.3 -i prerelease --preid beta
|
||||
1.2.4-beta.0
|
||||
```
|
||||
|
||||
Which then can be used to increment further:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.4-beta.0 -i prerelease
|
||||
1.2.4-beta.1
|
||||
```
|
||||
|
||||
### Advanced Range Syntax
|
||||
|
||||
Advanced range syntax desugars to primitive comparators in
|
||||
deterministic ways.
|
||||
|
||||
Advanced ranges may be combined in the same way as primitive
|
||||
comparators using white space or `||`.
|
||||
|
||||
#### Hyphen Ranges `X.Y.Z - A.B.C`
|
||||
|
||||
Specifies an inclusive set.
|
||||
|
||||
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the first version in the inclusive
|
||||
range, then the missing pieces are replaced with zeroes.
|
||||
|
||||
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the second version in the
|
||||
inclusive range, then all versions that start with the supplied parts
|
||||
of the tuple are accepted, but nothing that would be greater than the
|
||||
provided tuple parts.
|
||||
|
||||
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0-0`
|
||||
* `1.2.3 - 2` := `>=1.2.3 <3.0.0-0`
|
||||
|
||||
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
|
||||
|
||||
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
|
||||
numeric values in the `[major, minor, patch]` tuple.
|
||||
|
||||
* `*` := `>=0.0.0` (Any non-prerelease version satisfies, unless
|
||||
`includePrerelease` is specified, in which case any version at all
|
||||
satisfies)
|
||||
* `1.x` := `>=1.0.0 <2.0.0-0` (Matching major version)
|
||||
* `1.2.x` := `>=1.2.0 <1.3.0-0` (Matching major and minor versions)
|
||||
|
||||
A partial version range is treated as an X-Range, so the special
|
||||
character is in fact optional.
|
||||
|
||||
* `""` (empty string) := `*` := `>=0.0.0`
|
||||
* `1` := `1.x.x` := `>=1.0.0 <2.0.0-0`
|
||||
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0-0`
|
||||
|
||||
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
|
||||
|
||||
Allows patch-level changes if a minor version is specified on the
|
||||
comparator. Allows minor-level changes if not.
|
||||
|
||||
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0-0`
|
||||
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0-0` (Same as `1.2.x`)
|
||||
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0-0` (Same as `1.x`)
|
||||
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0-0`
|
||||
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0-0` (Same as `0.2.x`)
|
||||
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0-0` (Same as `0.x`)
|
||||
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0-0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
|
||||
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
|
||||
|
||||
Allows changes that do not modify the left-most non-zero element in the
|
||||
`[major, minor, patch]` tuple. In other words, this allows patch and
|
||||
minor updates for versions `1.0.0` and above, patch updates for
|
||||
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
|
||||
|
||||
Many authors treat a `0.x` version as if the `x` were the major
|
||||
"breaking-change" indicator.
|
||||
|
||||
Caret ranges are ideal when an author may make breaking changes
|
||||
between `0.2.4` and `0.3.0` releases, which is a common practice.
|
||||
However, it presumes that there will *not* be breaking changes between
|
||||
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
|
||||
additive (but non-breaking), according to commonly observed practices.
|
||||
|
||||
* `^1.2.3` := `>=1.2.3 <2.0.0-0`
|
||||
* `^0.2.3` := `>=0.2.3 <0.3.0-0`
|
||||
* `^0.0.3` := `>=0.0.3 <0.0.4-0`
|
||||
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0-0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4-0` Note that prereleases in the
|
||||
`0.0.3` version *only* will be allowed, if they are greater than or
|
||||
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
|
||||
|
||||
When parsing caret ranges, a missing `patch` value desugars to the
|
||||
number `0`, but will allow flexibility within that value, even if the
|
||||
major and minor versions are both `0`.
|
||||
|
||||
* `^1.2.x` := `>=1.2.0 <2.0.0-0`
|
||||
* `^0.0.x` := `>=0.0.0 <0.1.0-0`
|
||||
* `^0.0` := `>=0.0.0 <0.1.0-0`
|
||||
|
||||
A missing `minor` and `patch` values will desugar to zero, but also
|
||||
allow flexibility within those values, even if the major version is
|
||||
zero.
|
||||
|
||||
* `^1.x` := `>=1.0.0 <2.0.0-0`
|
||||
* `^0.x` := `>=0.0.0 <1.0.0-0`
|
||||
|
||||
### Range Grammar
|
||||
|
||||
Putting all this together, here is a Backus-Naur grammar for ranges,
|
||||
for the benefit of parser authors:
|
||||
|
||||
```bnf
|
||||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
All methods and classes take a final `options` object argument. All
|
||||
options in this object are `false` by default. The options supported
|
||||
are:
|
||||
|
||||
- `loose` Be more forgiving about not-quite-valid semver strings.
|
||||
(Any resulting output will always be 100% strict compliant, of
|
||||
course.) For backwards compatibility reasons, if the `options`
|
||||
argument is a boolean value instead of an object, it is interpreted
|
||||
to be the `loose` param.
|
||||
- `includePrerelease` Set to suppress the [default
|
||||
behavior](https://github.com/npm/node-semver#prerelease-tags) of
|
||||
excluding prerelease tagged versions from ranges unless they are
|
||||
explicitly opted into.
|
||||
|
||||
Strict-mode Comparators and Ranges will be strict about the SemVer
|
||||
strings that they parse.
|
||||
|
||||
* `valid(v)`: Return the parsed version, or null if it's not valid.
|
||||
* `inc(v, release)`: Return the version incremented by the release
|
||||
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
|
||||
`prepatch`, or `prerelease`), or null if it's not valid
|
||||
* `premajor` in one call will bump the version up to the next major
|
||||
version and down to a prerelease of that major version.
|
||||
`preminor`, and `prepatch` work the same way.
|
||||
* If called from a non-prerelease version, the `prerelease` will work the
|
||||
same as `prepatch`. It increments the patch version, then makes a
|
||||
prerelease. If the input version is already a prerelease it simply
|
||||
increments it.
|
||||
* `prerelease(v)`: Returns an array of prerelease components, or null
|
||||
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
|
||||
* `major(v)`: Return the major version number.
|
||||
* `minor(v)`: Return the minor version number.
|
||||
* `patch(v)`: Return the patch version number.
|
||||
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
|
||||
or comparators intersect.
|
||||
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
|
||||
a `SemVer` object or `null`.
|
||||
|
||||
### Comparison
|
||||
|
||||
* `gt(v1, v2)`: `v1 > v2`
|
||||
* `gte(v1, v2)`: `v1 >= v2`
|
||||
* `lt(v1, v2)`: `v1 < v2`
|
||||
* `lte(v1, v2)`: `v1 <= v2`
|
||||
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
|
||||
even if they're not the exact same string. You already know how to
|
||||
compare strings.
|
||||
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
|
||||
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
|
||||
the corresponding function above. `"==="` and `"!=="` do simple
|
||||
string comparison, but are included for completeness. Throws if an
|
||||
invalid comparison string is provided.
|
||||
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
|
||||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions
|
||||
in descending order when passed to `Array.sort()`.
|
||||
* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions
|
||||
are equal. Sorts in ascending order if passed to `Array.sort()`.
|
||||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `diff(v1, v2)`: Returns difference between two versions by the release type
|
||||
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
|
||||
or null if the versions are the same.
|
||||
|
||||
### Comparators
|
||||
|
||||
* `intersects(comparator)`: Return true if the comparators intersect
|
||||
|
||||
### Ranges
|
||||
|
||||
* `validRange(range)`: Return the valid range or null if it's not valid
|
||||
* `satisfies(version, range)`: Return true if the version satisfies the
|
||||
range.
|
||||
* `maxSatisfying(versions, range)`: Return the highest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minSatisfying(versions, range)`: Return the lowest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minVersion(range)`: Return the lowest version that can possibly match
|
||||
the given range.
|
||||
* `gtr(version, range)`: Return `true` if version is greater than all the
|
||||
versions possible in the range.
|
||||
* `ltr(version, range)`: Return `true` if version is less than all the
|
||||
versions possible in the range.
|
||||
* `outside(version, range, hilo)`: Return true if the version is outside
|
||||
the bounds of the range in either the high or low direction. The
|
||||
`hilo` argument must be either the string `'>'` or `'<'`. (This is
|
||||
the function called by `gtr` and `ltr`.)
|
||||
* `intersects(range)`: Return true if any of the ranges comparators intersect
|
||||
* `simplifyRange(versions, range)`: Return a "simplified" range that
|
||||
matches the same items in `versions` list as the range specified. Note
|
||||
that it does *not* guarantee that it would match the same versions in all
|
||||
cases, only for the set of versions provided. This is useful when
|
||||
generating ranges by joining together multiple versions with `||`
|
||||
programmatically, to provide the user with something a bit more
|
||||
ergonomic. If the provided range is shorter in string-length than the
|
||||
generated range, then that is returned.
|
||||
* `subset(subRange, superRange)`: Return `true` if the `subRange` range is
|
||||
entirely contained by the `superRange` range.
|
||||
|
||||
Note that, since ranges may be non-contiguous, a version might not be
|
||||
greater than a range, less than a range, *or* satisfy a range! For
|
||||
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
|
||||
until `2.0.0`, so the version `1.2.10` would not be greater than the
|
||||
range (because `2.0.1` satisfies, which is higher), nor less than the
|
||||
range (since `1.2.8` satisfies, which is lower), and it also does not
|
||||
satisfy the range.
|
||||
|
||||
If you want to know if a version satisfies or does not satisfy a
|
||||
range, use the `satisfies(version, range)` function.
|
||||
|
||||
### Coercion
|
||||
|
||||
* `coerce(version, options)`: Coerces a string to semver if possible
|
||||
|
||||
This aims to provide a very forgiving translation of a non-semver string to
|
||||
semver. It looks for the first digit in a string, and consumes all
|
||||
remaining characters which satisfy at least a partial semver (e.g., `1`,
|
||||
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
|
||||
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
|
||||
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
|
||||
`3.4.0`). Only text which lacks digits will fail coercion (`version one`
|
||||
is not valid). The maximum length for any semver component considered for
|
||||
coercion is 16 characters; longer components will be ignored
|
||||
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
|
||||
semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
|
||||
components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
||||
|
||||
If the `options.rtl` flag is set, then `coerce` will return the right-most
|
||||
coercible tuple that does not share an ending index with a longer coercible
|
||||
tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
|
||||
`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
|
||||
any other overlapping SemVer tuple.
|
||||
|
||||
### Clean
|
||||
|
||||
* `clean(version)`: Clean a string to be a valid semver if possible
|
||||
|
||||
This will return a cleaned and trimmed semver version. If the provided
|
||||
version is not valid a null will be returned. This does not work for
|
||||
ranges.
|
||||
|
||||
ex.
|
||||
* `s.clean(' = v 2.1.5foo')`: `null`
|
||||
* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'`
|
||||
* `s.clean(' = v 2.1.5-foo')`: `null`
|
||||
* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'`
|
||||
* `s.clean('=v2.1.5')`: `'2.1.5'`
|
||||
* `s.clean(' =v2.1.5')`: `2.1.5`
|
||||
* `s.clean(' 2.1.5 ')`: `'2.1.5'`
|
||||
* `s.clean('~1.0.0')`: `null`
|
||||
|
||||
## Exported Modules
|
||||
|
||||
<!--
|
||||
TODO: Make sure that all of these items are documented (classes aren't,
|
||||
eg), and then pull the module name into the documentation for that specific
|
||||
thing.
|
||||
-->
|
||||
|
||||
You may pull in just the part of this semver utility that you need, if you
|
||||
are sensitive to packing and tree-shaking concerns. The main
|
||||
`require('semver')` export uses getter functions to lazily load the parts
|
||||
of the API that are used.
|
||||
|
||||
The following modules are available:
|
||||
|
||||
* `require('semver')`
|
||||
* `require('semver/classes')`
|
||||
* `require('semver/classes/comparator')`
|
||||
* `require('semver/classes/range')`
|
||||
* `require('semver/classes/semver')`
|
||||
* `require('semver/functions/clean')`
|
||||
* `require('semver/functions/cmp')`
|
||||
* `require('semver/functions/coerce')`
|
||||
* `require('semver/functions/compare')`
|
||||
* `require('semver/functions/compare-build')`
|
||||
* `require('semver/functions/compare-loose')`
|
||||
* `require('semver/functions/diff')`
|
||||
* `require('semver/functions/eq')`
|
||||
* `require('semver/functions/gt')`
|
||||
* `require('semver/functions/gte')`
|
||||
* `require('semver/functions/inc')`
|
||||
* `require('semver/functions/lt')`
|
||||
* `require('semver/functions/lte')`
|
||||
* `require('semver/functions/major')`
|
||||
* `require('semver/functions/minor')`
|
||||
* `require('semver/functions/neq')`
|
||||
* `require('semver/functions/parse')`
|
||||
* `require('semver/functions/patch')`
|
||||
* `require('semver/functions/prerelease')`
|
||||
* `require('semver/functions/rcompare')`
|
||||
* `require('semver/functions/rsort')`
|
||||
* `require('semver/functions/satisfies')`
|
||||
* `require('semver/functions/sort')`
|
||||
* `require('semver/functions/valid')`
|
||||
* `require('semver/ranges/gtr')`
|
||||
* `require('semver/ranges/intersects')`
|
||||
* `require('semver/ranges/ltr')`
|
||||
* `require('semver/ranges/max-satisfying')`
|
||||
* `require('semver/ranges/min-satisfying')`
|
||||
* `require('semver/ranges/min-version')`
|
||||
* `require('semver/ranges/outside')`
|
||||
* `require('semver/ranges/to-comparators')`
|
||||
* `require('semver/ranges/valid')`
|
136
node_modules/ts-jest/node_modules/semver/classes/comparator.js
generated
vendored
Normal file
136
node_modules/ts-jest/node_modules/semver/classes/comparator.js
generated
vendored
Normal file
|
@ -0,0 +1,136 @@
|
|||
const ANY = Symbol('SemVer ANY')
|
||||
// hoisted class for cyclic dependency
|
||||
class Comparator {
|
||||
static get ANY () {
|
||||
return ANY
|
||||
}
|
||||
|
||||
constructor (comp, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (comp instanceof Comparator) {
|
||||
if (comp.loose === !!options.loose) {
|
||||
return comp
|
||||
} else {
|
||||
comp = comp.value
|
||||
}
|
||||
}
|
||||
|
||||
debug('comparator', comp, options)
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
this.parse(comp)
|
||||
|
||||
if (this.semver === ANY) {
|
||||
this.value = ''
|
||||
} else {
|
||||
this.value = this.operator + this.semver.version
|
||||
}
|
||||
|
||||
debug('comp', this)
|
||||
}
|
||||
|
||||
parse (comp) {
|
||||
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
const m = comp.match(r)
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError(`Invalid comparator: ${comp}`)
|
||||
}
|
||||
|
||||
this.operator = m[1] !== undefined ? m[1] : ''
|
||||
if (this.operator === '=') {
|
||||
this.operator = ''
|
||||
}
|
||||
|
||||
// if it literally is just '>' or '' then allow anything.
|
||||
if (!m[2]) {
|
||||
this.semver = ANY
|
||||
} else {
|
||||
this.semver = new SemVer(m[2], this.options.loose)
|
||||
}
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.value
|
||||
}
|
||||
|
||||
test (version) {
|
||||
debug('Comparator.test', version, this.options.loose)
|
||||
|
||||
if (this.semver === ANY || version === ANY) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (typeof version === 'string') {
|
||||
try {
|
||||
version = new SemVer(version, this.options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return cmp(version, this.operator, this.semver, this.options)
|
||||
}
|
||||
|
||||
intersects (comp, options) {
|
||||
if (!(comp instanceof Comparator)) {
|
||||
throw new TypeError('a Comparator is required')
|
||||
}
|
||||
|
||||
if (!options || typeof options !== 'object') {
|
||||
options = {
|
||||
loose: !!options,
|
||||
includePrerelease: false,
|
||||
}
|
||||
}
|
||||
|
||||
if (this.operator === '') {
|
||||
if (this.value === '') {
|
||||
return true
|
||||
}
|
||||
return new Range(comp.value, options).test(this.value)
|
||||
} else if (comp.operator === '') {
|
||||
if (comp.value === '') {
|
||||
return true
|
||||
}
|
||||
return new Range(this.value, options).test(comp.semver)
|
||||
}
|
||||
|
||||
const sameDirectionIncreasing =
|
||||
(this.operator === '>=' || this.operator === '>') &&
|
||||
(comp.operator === '>=' || comp.operator === '>')
|
||||
const sameDirectionDecreasing =
|
||||
(this.operator === '<=' || this.operator === '<') &&
|
||||
(comp.operator === '<=' || comp.operator === '<')
|
||||
const sameSemVer = this.semver.version === comp.semver.version
|
||||
const differentDirectionsInclusive =
|
||||
(this.operator === '>=' || this.operator === '<=') &&
|
||||
(comp.operator === '>=' || comp.operator === '<=')
|
||||
const oppositeDirectionsLessThan =
|
||||
cmp(this.semver, '<', comp.semver, options) &&
|
||||
(this.operator === '>=' || this.operator === '>') &&
|
||||
(comp.operator === '<=' || comp.operator === '<')
|
||||
const oppositeDirectionsGreaterThan =
|
||||
cmp(this.semver, '>', comp.semver, options) &&
|
||||
(this.operator === '<=' || this.operator === '<') &&
|
||||
(comp.operator === '>=' || comp.operator === '>')
|
||||
|
||||
return (
|
||||
sameDirectionIncreasing ||
|
||||
sameDirectionDecreasing ||
|
||||
(sameSemVer && differentDirectionsInclusive) ||
|
||||
oppositeDirectionsLessThan ||
|
||||
oppositeDirectionsGreaterThan
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Comparator
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const { re, t } = require('../internal/re')
|
||||
const cmp = require('../functions/cmp')
|
||||
const debug = require('../internal/debug')
|
||||
const SemVer = require('./semver')
|
||||
const Range = require('./range')
|
5
node_modules/ts-jest/node_modules/semver/classes/index.js
generated
vendored
Normal file
5
node_modules/ts-jest/node_modules/semver/classes/index.js
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
SemVer: require('./semver.js'),
|
||||
Range: require('./range.js'),
|
||||
Comparator: require('./comparator.js'),
|
||||
}
|
519
node_modules/ts-jest/node_modules/semver/classes/range.js
generated
vendored
Normal file
519
node_modules/ts-jest/node_modules/semver/classes/range.js
generated
vendored
Normal file
|
@ -0,0 +1,519 @@
|
|||
// hoisted class for cyclic dependency
|
||||
class Range {
|
||||
constructor (range, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (range instanceof Range) {
|
||||
if (
|
||||
range.loose === !!options.loose &&
|
||||
range.includePrerelease === !!options.includePrerelease
|
||||
) {
|
||||
return range
|
||||
} else {
|
||||
return new Range(range.raw, options)
|
||||
}
|
||||
}
|
||||
|
||||
if (range instanceof Comparator) {
|
||||
// just put it in the set and return
|
||||
this.raw = range.value
|
||||
this.set = [[range]]
|
||||
this.format()
|
||||
return this
|
||||
}
|
||||
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
|
||||
// First, split based on boolean or ||
|
||||
this.raw = range
|
||||
this.set = range
|
||||
.split('||')
|
||||
// map the range to a 2d array of comparators
|
||||
.map(r => this.parseRange(r.trim()))
|
||||
// throw out any comparator lists that are empty
|
||||
// this generally means that it was not a valid range, which is allowed
|
||||
// in loose mode, but will still throw if the WHOLE range is invalid.
|
||||
.filter(c => c.length)
|
||||
|
||||
if (!this.set.length) {
|
||||
throw new TypeError(`Invalid SemVer Range: ${range}`)
|
||||
}
|
||||
|
||||
// if we have any that are not the null set, throw out null sets.
|
||||
if (this.set.length > 1) {
|
||||
// keep the first one, in case they're all null sets
|
||||
const first = this.set[0]
|
||||
this.set = this.set.filter(c => !isNullSet(c[0]))
|
||||
if (this.set.length === 0) {
|
||||
this.set = [first]
|
||||
} else if (this.set.length > 1) {
|
||||
// if we have any that are *, then the range is just *
|
||||
for (const c of this.set) {
|
||||
if (c.length === 1 && isAny(c[0])) {
|
||||
this.set = [c]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.format()
|
||||
}
|
||||
|
||||
format () {
|
||||
this.range = this.set
|
||||
.map((comps) => {
|
||||
return comps.join(' ').trim()
|
||||
})
|
||||
.join('||')
|
||||
.trim()
|
||||
return this.range
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.range
|
||||
}
|
||||
|
||||
parseRange (range) {
|
||||
range = range.trim()
|
||||
|
||||
// memoize range parsing for performance.
|
||||
// this is a very hot path, and fully deterministic.
|
||||
const memoOpts = Object.keys(this.options).join(',')
|
||||
const memoKey = `parseRange:${memoOpts}:${range}`
|
||||
const cached = cache.get(memoKey)
|
||||
if (cached) {
|
||||
return cached
|
||||
}
|
||||
|
||||
const loose = this.options.loose
|
||||
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
||||
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
|
||||
range = range.replace(hr, hyphenReplace(this.options.includePrerelease))
|
||||
debug('hyphen replace', range)
|
||||
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
||||
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range)
|
||||
|
||||
// `~ 1.2.3` => `~1.2.3`
|
||||
range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
|
||||
|
||||
// `^ 1.2.3` => `^1.2.3`
|
||||
range = range.replace(re[t.CARETTRIM], caretTrimReplace)
|
||||
|
||||
// normalize spaces
|
||||
range = range.split(/\s+/).join(' ')
|
||||
|
||||
// At this point, the range is completely trimmed and
|
||||
// ready to be split into comparators.
|
||||
|
||||
let rangeList = range
|
||||
.split(' ')
|
||||
.map(comp => parseComparator(comp, this.options))
|
||||
.join(' ')
|
||||
.split(/\s+/)
|
||||
// >=0.0.0 is equivalent to *
|
||||
.map(comp => replaceGTE0(comp, this.options))
|
||||
|
||||
if (loose) {
|
||||
// in loose mode, throw out any that are not valid comparators
|
||||
rangeList = rangeList.filter(comp => {
|
||||
debug('loose invalid filter', comp, this.options)
|
||||
return !!comp.match(re[t.COMPARATORLOOSE])
|
||||
})
|
||||
}
|
||||
debug('range list', rangeList)
|
||||
|
||||
// if any comparators are the null set, then replace with JUST null set
|
||||
// if more than one comparator, remove any * comparators
|
||||
// also, don't include the same comparator more than once
|
||||
const rangeMap = new Map()
|
||||
const comparators = rangeList.map(comp => new Comparator(comp, this.options))
|
||||
for (const comp of comparators) {
|
||||
if (isNullSet(comp)) {
|
||||
return [comp]
|
||||
}
|
||||
rangeMap.set(comp.value, comp)
|
||||
}
|
||||
if (rangeMap.size > 1 && rangeMap.has('')) {
|
||||
rangeMap.delete('')
|
||||
}
|
||||
|
||||
const result = [...rangeMap.values()]
|
||||
cache.set(memoKey, result)
|
||||
return result
|
||||
}
|
||||
|
||||
intersects (range, options) {
|
||||
if (!(range instanceof Range)) {
|
||||
throw new TypeError('a Range is required')
|
||||
}
|
||||
|
||||
return this.set.some((thisComparators) => {
|
||||
return (
|
||||
isSatisfiable(thisComparators, options) &&
|
||||
range.set.some((rangeComparators) => {
|
||||
return (
|
||||
isSatisfiable(rangeComparators, options) &&
|
||||
thisComparators.every((thisComparator) => {
|
||||
return rangeComparators.every((rangeComparator) => {
|
||||
return thisComparator.intersects(rangeComparator, options)
|
||||
})
|
||||
})
|
||||
)
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
// if ANY of the sets match ALL of its comparators, then pass
|
||||
test (version) {
|
||||
if (!version) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (typeof version === 'string') {
|
||||
try {
|
||||
version = new SemVer(version, this.options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.set.length; i++) {
|
||||
if (testSet(this.set[i], version, this.options)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
module.exports = Range
|
||||
|
||||
const LRU = require('lru-cache')
|
||||
const cache = new LRU({ max: 1000 })
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const Comparator = require('./comparator')
|
||||
const debug = require('../internal/debug')
|
||||
const SemVer = require('./semver')
|
||||
const {
|
||||
re,
|
||||
t,
|
||||
comparatorTrimReplace,
|
||||
tildeTrimReplace,
|
||||
caretTrimReplace,
|
||||
} = require('../internal/re')
|
||||
|
||||
const isNullSet = c => c.value === '<0.0.0-0'
|
||||
const isAny = c => c.value === ''
|
||||
|
||||
// take a set of comparators and determine whether there
|
||||
// exists a version which can satisfy it
|
||||
const isSatisfiable = (comparators, options) => {
|
||||
let result = true
|
||||
const remainingComparators = comparators.slice()
|
||||
let testComparator = remainingComparators.pop()
|
||||
|
||||
while (result && remainingComparators.length) {
|
||||
result = remainingComparators.every((otherComparator) => {
|
||||
return testComparator.intersects(otherComparator, options)
|
||||
})
|
||||
|
||||
testComparator = remainingComparators.pop()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
||||
// already replaced the hyphen ranges
|
||||
// turn into a set of JUST comparators.
|
||||
const parseComparator = (comp, options) => {
|
||||
debug('comp', comp, options)
|
||||
comp = replaceCarets(comp, options)
|
||||
debug('caret', comp)
|
||||
comp = replaceTildes(comp, options)
|
||||
debug('tildes', comp)
|
||||
comp = replaceXRanges(comp, options)
|
||||
debug('xrange', comp)
|
||||
comp = replaceStars(comp, options)
|
||||
debug('stars', comp)
|
||||
return comp
|
||||
}
|
||||
|
||||
const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
|
||||
|
||||
// ~, ~> --> * (any, kinda silly)
|
||||
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
|
||||
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
|
||||
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
|
||||
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
|
||||
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
|
||||
const replaceTildes = (comp, options) =>
|
||||
comp.trim().split(/\s+/).map((c) => {
|
||||
return replaceTilde(c, options)
|
||||
}).join(' ')
|
||||
|
||||
const replaceTilde = (comp, options) => {
|
||||
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
|
||||
return comp.replace(r, (_, M, m, p, pr) => {
|
||||
debug('tilde', comp, _, M, m, p, pr)
|
||||
let ret
|
||||
|
||||
if (isX(M)) {
|
||||
ret = ''
|
||||
} else if (isX(m)) {
|
||||
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
|
||||
} else if (isX(p)) {
|
||||
// ~1.2 == >=1.2.0 <1.3.0-0
|
||||
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
|
||||
} else if (pr) {
|
||||
debug('replaceTilde pr', pr)
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
} else {
|
||||
// ~1.2.3 == >=1.2.3 <1.3.0-0
|
||||
ret = `>=${M}.${m}.${p
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
|
||||
debug('tilde return', ret)
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
// ^ --> * (any, kinda silly)
|
||||
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
|
||||
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
|
||||
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
|
||||
// ^1.2.3 --> >=1.2.3 <2.0.0-0
|
||||
// ^1.2.0 --> >=1.2.0 <2.0.0-0
|
||||
const replaceCarets = (comp, options) =>
|
||||
comp.trim().split(/\s+/).map((c) => {
|
||||
return replaceCaret(c, options)
|
||||
}).join(' ')
|
||||
|
||||
const replaceCaret = (comp, options) => {
|
||||
debug('caret', comp, options)
|
||||
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
|
||||
const z = options.includePrerelease ? '-0' : ''
|
||||
return comp.replace(r, (_, M, m, p, pr) => {
|
||||
debug('caret', comp, _, M, m, p, pr)
|
||||
let ret
|
||||
|
||||
if (isX(M)) {
|
||||
ret = ''
|
||||
} else if (isX(m)) {
|
||||
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
|
||||
} else if (isX(p)) {
|
||||
if (M === '0') {
|
||||
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
|
||||
}
|
||||
} else if (pr) {
|
||||
debug('replaceCaret pr', pr)
|
||||
if (M === '0') {
|
||||
if (m === '0') {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${m}.${+p + 1}-0`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${+M + 1}.0.0-0`
|
||||
}
|
||||
} else {
|
||||
debug('no pr')
|
||||
if (M === '0') {
|
||||
if (m === '0') {
|
||||
ret = `>=${M}.${m}.${p
|
||||
}${z} <${M}.${m}.${+p + 1}-0`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p
|
||||
}${z} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p
|
||||
} <${+M + 1}.0.0-0`
|
||||
}
|
||||
}
|
||||
|
||||
debug('caret return', ret)
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
const replaceXRanges = (comp, options) => {
|
||||
debug('replaceXRanges', comp, options)
|
||||
return comp.split(/\s+/).map((c) => {
|
||||
return replaceXRange(c, options)
|
||||
}).join(' ')
|
||||
}
|
||||
|
||||
const replaceXRange = (comp, options) => {
|
||||
comp = comp.trim()
|
||||
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
|
||||
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
||||
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
||||
const xM = isX(M)
|
||||
const xm = xM || isX(m)
|
||||
const xp = xm || isX(p)
|
||||
const anyX = xp
|
||||
|
||||
if (gtlt === '=' && anyX) {
|
||||
gtlt = ''
|
||||
}
|
||||
|
||||
// if we're including prereleases in the match, then we need
|
||||
// to fix this to -0, the lowest possible prerelease value
|
||||
pr = options.includePrerelease ? '-0' : ''
|
||||
|
||||
if (xM) {
|
||||
if (gtlt === '>' || gtlt === '<') {
|
||||
// nothing is allowed
|
||||
ret = '<0.0.0-0'
|
||||
} else {
|
||||
// nothing is forbidden
|
||||
ret = '*'
|
||||
}
|
||||
} else if (gtlt && anyX) {
|
||||
// we know patch is an x, because we have any x at all.
|
||||
// replace X with 0
|
||||
if (xm) {
|
||||
m = 0
|
||||
}
|
||||
p = 0
|
||||
|
||||
if (gtlt === '>') {
|
||||
// >1 => >=2.0.0
|
||||
// >1.2 => >=1.3.0
|
||||
gtlt = '>='
|
||||
if (xm) {
|
||||
M = +M + 1
|
||||
m = 0
|
||||
p = 0
|
||||
} else {
|
||||
m = +m + 1
|
||||
p = 0
|
||||
}
|
||||
} else if (gtlt === '<=') {
|
||||
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
||||
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
||||
gtlt = '<'
|
||||
if (xm) {
|
||||
M = +M + 1
|
||||
} else {
|
||||
m = +m + 1
|
||||
}
|
||||
}
|
||||
|
||||
if (gtlt === '<') {
|
||||
pr = '-0'
|
||||
}
|
||||
|
||||
ret = `${gtlt + M}.${m}.${p}${pr}`
|
||||
} else if (xm) {
|
||||
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
|
||||
} else if (xp) {
|
||||
ret = `>=${M}.${m}.0${pr
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
|
||||
debug('xRange return', ret)
|
||||
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
// Because * is AND-ed with everything else in the comparator,
|
||||
// and '' means "any version", just remove the *s entirely.
|
||||
const replaceStars = (comp, options) => {
|
||||
debug('replaceStars', comp, options)
|
||||
// Looseness is ignored here. star is always as loose as it gets!
|
||||
return comp.trim().replace(re[t.STAR], '')
|
||||
}
|
||||
|
||||
const replaceGTE0 = (comp, options) => {
|
||||
debug('replaceGTE0', comp, options)
|
||||
return comp.trim()
|
||||
.replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
|
||||
}
|
||||
|
||||
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
||||
// M, m, patch, prerelease, build
|
||||
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
||||
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
|
||||
// 1.2 - 3.4 => >=1.2.0 <3.5.0-0
|
||||
const hyphenReplace = incPr => ($0,
|
||||
from, fM, fm, fp, fpr, fb,
|
||||
to, tM, tm, tp, tpr, tb) => {
|
||||
if (isX(fM)) {
|
||||
from = ''
|
||||
} else if (isX(fm)) {
|
||||
from = `>=${fM}.0.0${incPr ? '-0' : ''}`
|
||||
} else if (isX(fp)) {
|
||||
from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
|
||||
} else if (fpr) {
|
||||
from = `>=${from}`
|
||||
} else {
|
||||
from = `>=${from}${incPr ? '-0' : ''}`
|
||||
}
|
||||
|
||||
if (isX(tM)) {
|
||||
to = ''
|
||||
} else if (isX(tm)) {
|
||||
to = `<${+tM + 1}.0.0-0`
|
||||
} else if (isX(tp)) {
|
||||
to = `<${tM}.${+tm + 1}.0-0`
|
||||
} else if (tpr) {
|
||||
to = `<=${tM}.${tm}.${tp}-${tpr}`
|
||||
} else if (incPr) {
|
||||
to = `<${tM}.${tm}.${+tp + 1}-0`
|
||||
} else {
|
||||
to = `<=${to}`
|
||||
}
|
||||
|
||||
return (`${from} ${to}`).trim()
|
||||
}
|
||||
|
||||
const testSet = (set, version, options) => {
|
||||
for (let i = 0; i < set.length; i++) {
|
||||
if (!set[i].test(version)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (version.prerelease.length && !options.includePrerelease) {
|
||||
// Find the set of versions that are allowed to have prereleases
|
||||
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
||||
// That should allow `1.2.3-pr.2` to pass.
|
||||
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
||||
// even though it's within the range set by the comparators.
|
||||
for (let i = 0; i < set.length; i++) {
|
||||
debug(set[i].semver)
|
||||
if (set[i].semver === Comparator.ANY) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (set[i].semver.prerelease.length > 0) {
|
||||
const allowed = set[i].semver
|
||||
if (allowed.major === version.major &&
|
||||
allowed.minor === version.minor &&
|
||||
allowed.patch === version.patch) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Version has a -pre, but it's not one of the ones we like.
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
287
node_modules/ts-jest/node_modules/semver/classes/semver.js
generated
vendored
Normal file
287
node_modules/ts-jest/node_modules/semver/classes/semver.js
generated
vendored
Normal file
|
@ -0,0 +1,287 @@
|
|||
const debug = require('../internal/debug')
|
||||
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')
|
||||
const { re, t } = require('../internal/re')
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const { compareIdentifiers } = require('../internal/identifiers')
|
||||
class SemVer {
|
||||
constructor (version, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (version instanceof SemVer) {
|
||||
if (version.loose === !!options.loose &&
|
||||
version.includePrerelease === !!options.includePrerelease) {
|
||||
return version
|
||||
} else {
|
||||
version = version.version
|
||||
}
|
||||
} else if (typeof version !== 'string') {
|
||||
throw new TypeError(`Invalid Version: ${version}`)
|
||||
}
|
||||
|
||||
if (version.length > MAX_LENGTH) {
|
||||
throw new TypeError(
|
||||
`version is longer than ${MAX_LENGTH} characters`
|
||||
)
|
||||
}
|
||||
|
||||
debug('SemVer', version, options)
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
// this isn't actually relevant for versions, but keep it so that we
|
||||
// don't run into trouble passing this.options around.
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
|
||||
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError(`Invalid Version: ${version}`)
|
||||
}
|
||||
|
||||
this.raw = version
|
||||
|
||||
// these are actually numbers
|
||||
this.major = +m[1]
|
||||
this.minor = +m[2]
|
||||
this.patch = +m[3]
|
||||
|
||||
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
||||
throw new TypeError('Invalid major version')
|
||||
}
|
||||
|
||||
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
||||
throw new TypeError('Invalid minor version')
|
||||
}
|
||||
|
||||
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
||||
throw new TypeError('Invalid patch version')
|
||||
}
|
||||
|
||||
// numberify any prerelease numeric ids
|
||||
if (!m[4]) {
|
||||
this.prerelease = []
|
||||
} else {
|
||||
this.prerelease = m[4].split('.').map((id) => {
|
||||
if (/^[0-9]+$/.test(id)) {
|
||||
const num = +id
|
||||
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
||||
return num
|
||||
}
|
||||
}
|
||||
return id
|
||||
})
|
||||
}
|
||||
|
||||
this.build = m[5] ? m[5].split('.') : []
|
||||
this.format()
|
||||
}
|
||||
|
||||
format () {
|
||||
this.version = `${this.major}.${this.minor}.${this.patch}`
|
||||
if (this.prerelease.length) {
|
||||
this.version += `-${this.prerelease.join('.')}`
|
||||
}
|
||||
return this.version
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.version
|
||||
}
|
||||
|
||||
compare (other) {
|
||||
debug('SemVer.compare', this.version, this.options, other)
|
||||
if (!(other instanceof SemVer)) {
|
||||
if (typeof other === 'string' && other === this.version) {
|
||||
return 0
|
||||
}
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
if (other.version === this.version) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return this.compareMain(other) || this.comparePre(other)
|
||||
}
|
||||
|
||||
compareMain (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
return (
|
||||
compareIdentifiers(this.major, other.major) ||
|
||||
compareIdentifiers(this.minor, other.minor) ||
|
||||
compareIdentifiers(this.patch, other.patch)
|
||||
)
|
||||
}
|
||||
|
||||
comparePre (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
// NOT having a prerelease is > having one
|
||||
if (this.prerelease.length && !other.prerelease.length) {
|
||||
return -1
|
||||
} else if (!this.prerelease.length && other.prerelease.length) {
|
||||
return 1
|
||||
} else if (!this.prerelease.length && !other.prerelease.length) {
|
||||
return 0
|
||||
}
|
||||
|
||||
let i = 0
|
||||
do {
|
||||
const a = this.prerelease[i]
|
||||
const b = other.prerelease[i]
|
||||
debug('prerelease compare', i, a, b)
|
||||
if (a === undefined && b === undefined) {
|
||||
return 0
|
||||
} else if (b === undefined) {
|
||||
return 1
|
||||
} else if (a === undefined) {
|
||||
return -1
|
||||
} else if (a === b) {
|
||||
continue
|
||||
} else {
|
||||
return compareIdentifiers(a, b)
|
||||
}
|
||||
} while (++i)
|
||||
}
|
||||
|
||||
compareBuild (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
let i = 0
|
||||
do {
|
||||
const a = this.build[i]
|
||||
const b = other.build[i]
|
||||
debug('prerelease compare', i, a, b)
|
||||
if (a === undefined && b === undefined) {
|
||||
return 0
|
||||
} else if (b === undefined) {
|
||||
return 1
|
||||
} else if (a === undefined) {
|
||||
return -1
|
||||
} else if (a === b) {
|
||||
continue
|
||||
} else {
|
||||
return compareIdentifiers(a, b)
|
||||
}
|
||||
} while (++i)
|
||||
}
|
||||
|
||||
// preminor will bump the version up to the next minor release, and immediately
|
||||
// down to pre-release. premajor and prepatch work the same way.
|
||||
inc (release, identifier) {
|
||||
switch (release) {
|
||||
case 'premajor':
|
||||
this.prerelease.length = 0
|
||||
this.patch = 0
|
||||
this.minor = 0
|
||||
this.major++
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
case 'preminor':
|
||||
this.prerelease.length = 0
|
||||
this.patch = 0
|
||||
this.minor++
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
case 'prepatch':
|
||||
// If this is already a prerelease, it will bump to the next version
|
||||
// drop any prereleases that might already exist, since they are not
|
||||
// relevant at this point.
|
||||
this.prerelease.length = 0
|
||||
this.inc('patch', identifier)
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
// If the input is a non-prerelease version, this acts the same as
|
||||
// prepatch.
|
||||
case 'prerelease':
|
||||
if (this.prerelease.length === 0) {
|
||||
this.inc('patch', identifier)
|
||||
}
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
|
||||
case 'major':
|
||||
// If this is a pre-major version, bump up to the same major version.
|
||||
// Otherwise increment major.
|
||||
// 1.0.0-5 bumps to 1.0.0
|
||||
// 1.1.0 bumps to 2.0.0
|
||||
if (
|
||||
this.minor !== 0 ||
|
||||
this.patch !== 0 ||
|
||||
this.prerelease.length === 0
|
||||
) {
|
||||
this.major++
|
||||
}
|
||||
this.minor = 0
|
||||
this.patch = 0
|
||||
this.prerelease = []
|
||||
break
|
||||
case 'minor':
|
||||
// If this is a pre-minor version, bump up to the same minor version.
|
||||
// Otherwise increment minor.
|
||||
// 1.2.0-5 bumps to 1.2.0
|
||||
// 1.2.1 bumps to 1.3.0
|
||||
if (this.patch !== 0 || this.prerelease.length === 0) {
|
||||
this.minor++
|
||||
}
|
||||
this.patch = 0
|
||||
this.prerelease = []
|
||||
break
|
||||
case 'patch':
|
||||
// If this is not a pre-release version, it will increment the patch.
|
||||
// If it is a pre-release it will bump up to the same patch version.
|
||||
// 1.2.0-5 patches to 1.2.0
|
||||
// 1.2.0 patches to 1.2.1
|
||||
if (this.prerelease.length === 0) {
|
||||
this.patch++
|
||||
}
|
||||
this.prerelease = []
|
||||
break
|
||||
// This probably shouldn't be used publicly.
|
||||
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
||||
case 'pre':
|
||||
if (this.prerelease.length === 0) {
|
||||
this.prerelease = [0]
|
||||
} else {
|
||||
let i = this.prerelease.length
|
||||
while (--i >= 0) {
|
||||
if (typeof this.prerelease[i] === 'number') {
|
||||
this.prerelease[i]++
|
||||
i = -2
|
||||
}
|
||||
}
|
||||
if (i === -1) {
|
||||
// didn't increment anything
|
||||
this.prerelease.push(0)
|
||||
}
|
||||
}
|
||||
if (identifier) {
|
||||
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
||||
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
||||
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
||||
if (isNaN(this.prerelease[1])) {
|
||||
this.prerelease = [identifier, 0]
|
||||
}
|
||||
} else {
|
||||
this.prerelease = [identifier, 0]
|
||||
}
|
||||
}
|
||||
break
|
||||
|
||||
default:
|
||||
throw new Error(`invalid increment argument: ${release}`)
|
||||
}
|
||||
this.format()
|
||||
this.raw = this.version
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SemVer
|
6
node_modules/ts-jest/node_modules/semver/functions/clean.js
generated
vendored
Normal file
6
node_modules/ts-jest/node_modules/semver/functions/clean.js
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
const parse = require('./parse')
|
||||
const clean = (version, options) => {
|
||||
const s = parse(version.trim().replace(/^[=v]+/, ''), options)
|
||||
return s ? s.version : null
|
||||
}
|
||||
module.exports = clean
|
52
node_modules/ts-jest/node_modules/semver/functions/cmp.js
generated
vendored
Normal file
52
node_modules/ts-jest/node_modules/semver/functions/cmp.js
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
const eq = require('./eq')
|
||||
const neq = require('./neq')
|
||||
const gt = require('./gt')
|
||||
const gte = require('./gte')
|
||||
const lt = require('./lt')
|
||||
const lte = require('./lte')
|
||||
|
||||
const cmp = (a, op, b, loose) => {
|
||||
switch (op) {
|
||||
case '===':
|
||||
if (typeof a === 'object') {
|
||||
a = a.version
|
||||
}
|
||||
if (typeof b === 'object') {
|
||||
b = b.version
|
||||
}
|
||||
return a === b
|
||||
|
||||
case '!==':
|
||||
if (typeof a === 'object') {
|
||||
a = a.version
|
||||
}
|
||||
if (typeof b === 'object') {
|
||||
b = b.version
|
||||
}
|
||||
return a !== b
|
||||
|
||||
case '':
|
||||
case '=':
|
||||
case '==':
|
||||
return eq(a, b, loose)
|
||||
|
||||
case '!=':
|
||||
return neq(a, b, loose)
|
||||
|
||||
case '>':
|
||||
return gt(a, b, loose)
|
||||
|
||||
case '>=':
|
||||
return gte(a, b, loose)
|
||||
|
||||
case '<':
|
||||
return lt(a, b, loose)
|
||||
|
||||
case '<=':
|
||||
return lte(a, b, loose)
|
||||
|
||||
default:
|
||||
throw new TypeError(`Invalid operator: ${op}`)
|
||||
}
|
||||
}
|
||||
module.exports = cmp
|
52
node_modules/ts-jest/node_modules/semver/functions/coerce.js
generated
vendored
Normal file
52
node_modules/ts-jest/node_modules/semver/functions/coerce.js
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
const SemVer = require('../classes/semver')
|
||||
const parse = require('./parse')
|
||||
const { re, t } = require('../internal/re')
|
||||
|
||||
const coerce = (version, options) => {
|
||||
if (version instanceof SemVer) {
|
||||
return version
|
||||
}
|
||||
|
||||
if (typeof version === 'number') {
|
||||
version = String(version)
|
||||
}
|
||||
|
||||
if (typeof version !== 'string') {
|
||||
return null
|
||||
}
|
||||
|
||||
options = options || {}
|
||||
|
||||
let match = null
|
||||
if (!options.rtl) {
|
||||
match = version.match(re[t.COERCE])
|
||||
} else {
|
||||
// Find the right-most coercible string that does not share
|
||||
// a terminus with a more left-ward coercible string.
|
||||
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
|
||||
//
|
||||
// Walk through the string checking with a /g regexp
|
||||
// Manually set the index so as to pick up overlapping matches.
|
||||
// Stop when we get a match that ends at the string end, since no
|
||||
// coercible string can be more right-ward without the same terminus.
|
||||
let next
|
||||
while ((next = re[t.COERCERTL].exec(version)) &&
|
||||
(!match || match.index + match[0].length !== version.length)
|
||||
) {
|
||||
if (!match ||
|
||||
next.index + next[0].length !== match.index + match[0].length) {
|
||||
match = next
|
||||
}
|
||||
re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
|
||||
}
|
||||
// leave it in a clean state
|
||||
re[t.COERCERTL].lastIndex = -1
|
||||
}
|
||||
|
||||
if (match === null) {
|
||||
return null
|
||||
}
|
||||
|
||||
return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
|
||||
}
|
||||
module.exports = coerce
|
7
node_modules/ts-jest/node_modules/semver/functions/compare-build.js
generated
vendored
Normal file
7
node_modules/ts-jest/node_modules/semver/functions/compare-build.js
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
const SemVer = require('../classes/semver')
|
||||
const compareBuild = (a, b, loose) => {
|
||||
const versionA = new SemVer(a, loose)
|
||||
const versionB = new SemVer(b, loose)
|
||||
return versionA.compare(versionB) || versionA.compareBuild(versionB)
|
||||
}
|
||||
module.exports = compareBuild
|
3
node_modules/ts-jest/node_modules/semver/functions/compare-loose.js
generated
vendored
Normal file
3
node_modules/ts-jest/node_modules/semver/functions/compare-loose.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const compare = require('./compare')
|
||||
const compareLoose = (a, b) => compare(a, b, true)
|
||||
module.exports = compareLoose
|
5
node_modules/ts-jest/node_modules/semver/functions/compare.js
generated
vendored
Normal file
5
node_modules/ts-jest/node_modules/semver/functions/compare.js
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
const SemVer = require('../classes/semver')
|
||||
const compare = (a, b, loose) =>
|
||||
new SemVer(a, loose).compare(new SemVer(b, loose))
|
||||
|
||||
module.exports = compare
|
23
node_modules/ts-jest/node_modules/semver/functions/diff.js
generated
vendored
Normal file
23
node_modules/ts-jest/node_modules/semver/functions/diff.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
const parse = require('./parse')
|
||||
const eq = require('./eq')
|
||||
|
||||
const diff = (version1, version2) => {
|
||||
if (eq(version1, version2)) {
|
||||
return null
|
||||
} else {
|
||||
const v1 = parse(version1)
|
||||
const v2 = parse(version2)
|
||||
const hasPre = v1.prerelease.length || v2.prerelease.length
|
||||
const prefix = hasPre ? 'pre' : ''
|
||||
const defaultResult = hasPre ? 'prerelease' : ''
|
||||
for (const key in v1) {
|
||||
if (key === 'major' || key === 'minor' || key === 'patch') {
|
||||
if (v1[key] !== v2[key]) {
|
||||
return prefix + key
|
||||
}
|
||||
}
|
||||
}
|
||||
return defaultResult // may be undefined
|
||||
}
|
||||
}
|
||||
module.exports = diff
|
3
node_modules/ts-jest/node_modules/semver/functions/eq.js
generated
vendored
Normal file
3
node_modules/ts-jest/node_modules/semver/functions/eq.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const compare = require('./compare')
|
||||
const eq = (a, b, loose) => compare(a, b, loose) === 0
|
||||
module.exports = eq
|
3
node_modules/ts-jest/node_modules/semver/functions/gt.js
generated
vendored
Normal file
3
node_modules/ts-jest/node_modules/semver/functions/gt.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const compare = require('./compare')
|
||||
const gt = (a, b, loose) => compare(a, b, loose) > 0
|
||||
module.exports = gt
|
3
node_modules/ts-jest/node_modules/semver/functions/gte.js
generated
vendored
Normal file
3
node_modules/ts-jest/node_modules/semver/functions/gte.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const compare = require('./compare')
|
||||
const gte = (a, b, loose) => compare(a, b, loose) >= 0
|
||||
module.exports = gte
|
18
node_modules/ts-jest/node_modules/semver/functions/inc.js
generated
vendored
Normal file
18
node_modules/ts-jest/node_modules/semver/functions/inc.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
const SemVer = require('../classes/semver')
|
||||
|
||||
const inc = (version, release, options, identifier) => {
|
||||
if (typeof (options) === 'string') {
|
||||
identifier = options
|
||||
options = undefined
|
||||
}
|
||||
|
||||
try {
|
||||
return new SemVer(
|
||||
version instanceof SemVer ? version.version : version,
|
||||
options
|
||||
).inc(release, identifier).version
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
module.exports = inc
|
3
node_modules/ts-jest/node_modules/semver/functions/lt.js
generated
vendored
Normal file
3
node_modules/ts-jest/node_modules/semver/functions/lt.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const compare = require('./compare')
|
||||
const lt = (a, b, loose) => compare(a, b, loose) < 0
|
||||
module.exports = lt
|
3
node_modules/ts-jest/node_modules/semver/functions/lte.js
generated
vendored
Normal file
3
node_modules/ts-jest/node_modules/semver/functions/lte.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const compare = require('./compare')
|
||||
const lte = (a, b, loose) => compare(a, b, loose) <= 0
|
||||
module.exports = lte
|
3
node_modules/ts-jest/node_modules/semver/functions/major.js
generated
vendored
Normal file
3
node_modules/ts-jest/node_modules/semver/functions/major.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const SemVer = require('../classes/semver')
|
||||
const major = (a, loose) => new SemVer(a, loose).major
|
||||
module.exports = major
|
3
node_modules/ts-jest/node_modules/semver/functions/minor.js
generated
vendored
Normal file
3
node_modules/ts-jest/node_modules/semver/functions/minor.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const SemVer = require('../classes/semver')
|
||||
const minor = (a, loose) => new SemVer(a, loose).minor
|
||||
module.exports = minor
|
3
node_modules/ts-jest/node_modules/semver/functions/neq.js
generated
vendored
Normal file
3
node_modules/ts-jest/node_modules/semver/functions/neq.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const compare = require('./compare')
|
||||
const neq = (a, b, loose) => compare(a, b, loose) !== 0
|
||||
module.exports = neq
|
33
node_modules/ts-jest/node_modules/semver/functions/parse.js
generated
vendored
Normal file
33
node_modules/ts-jest/node_modules/semver/functions/parse.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
const { MAX_LENGTH } = require('../internal/constants')
|
||||
const { re, t } = require('../internal/re')
|
||||
const SemVer = require('../classes/semver')
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const parse = (version, options) => {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (version instanceof SemVer) {
|
||||
return version
|
||||
}
|
||||
|
||||
if (typeof version !== 'string') {
|
||||
return null
|
||||
}
|
||||
|
||||
if (version.length > MAX_LENGTH) {
|
||||
return null
|
||||
}
|
||||
|
||||
const r = options.loose ? re[t.LOOSE] : re[t.FULL]
|
||||
if (!r.test(version)) {
|
||||
return null
|
||||
}
|
||||
|
||||
try {
|
||||
return new SemVer(version, options)
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = parse
|
3
node_modules/ts-jest/node_modules/semver/functions/patch.js
generated
vendored
Normal file
3
node_modules/ts-jest/node_modules/semver/functions/patch.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const SemVer = require('../classes/semver')
|
||||
const patch = (a, loose) => new SemVer(a, loose).patch
|
||||
module.exports = patch
|
6
node_modules/ts-jest/node_modules/semver/functions/prerelease.js
generated
vendored
Normal file
6
node_modules/ts-jest/node_modules/semver/functions/prerelease.js
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
const parse = require('./parse')
|
||||
const prerelease = (version, options) => {
|
||||
const parsed = parse(version, options)
|
||||
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
|
||||
}
|
||||
module.exports = prerelease
|
3
node_modules/ts-jest/node_modules/semver/functions/rcompare.js
generated
vendored
Normal file
3
node_modules/ts-jest/node_modules/semver/functions/rcompare.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const compare = require('./compare')
|
||||
const rcompare = (a, b, loose) => compare(b, a, loose)
|
||||
module.exports = rcompare
|
3
node_modules/ts-jest/node_modules/semver/functions/rsort.js
generated
vendored
Normal file
3
node_modules/ts-jest/node_modules/semver/functions/rsort.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const compareBuild = require('./compare-build')
|
||||
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
|
||||
module.exports = rsort
|
10
node_modules/ts-jest/node_modules/semver/functions/satisfies.js
generated
vendored
Normal file
10
node_modules/ts-jest/node_modules/semver/functions/satisfies.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
const Range = require('../classes/range')
|
||||
const satisfies = (version, range, options) => {
|
||||
try {
|
||||
range = new Range(range, options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
return range.test(version)
|
||||
}
|
||||
module.exports = satisfies
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue