Set up comprehensive frontend testing infrastructure
- Install Jest for unit testing with React Testing Library - Install Playwright for end-to-end testing - Configure Jest with proper TypeScript support and module mapping - Create test setup files and utilities for both unit and e2e tests Components: * Jest configuration with coverage thresholds * Playwright configuration with browser automation * Unit tests for LoginForm, AuthContext, and useSocketIO hook * E2E tests for authentication, dashboard, and agents workflows * GitHub Actions workflow for automated testing * Mock data and API utilities for consistent testing * Test documentation with best practices Testing features: - Unit tests with 70% coverage threshold - E2E tests with API mocking and user journey testing - CI/CD integration for automated test runs - Cross-browser testing support with Playwright - Authentication system testing end-to-end 🚀 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
4
frontend/node_modules/ts-jest/.lintstagedrc
generated
vendored
Normal file
4
frontend/node_modules/ts-jest/.lintstagedrc
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"*.{js,cjs,mjs,jsx,ts,tsx}": ["eslint --fix"],
|
||||
"*.{yml,yaml,md}": ["prettier --write"]
|
||||
}
|
||||
1
frontend/node_modules/ts-jest/.ts-jest-digest
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/.ts-jest-digest
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
f80537ea4534af72d55ea38f700d980529562be2
|
||||
1971
frontend/node_modules/ts-jest/CHANGELOG.md
generated
vendored
Normal file
1971
frontend/node_modules/ts-jest/CHANGELOG.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
121
frontend/node_modules/ts-jest/CONTRIBUTING.md
generated
vendored
Normal file
121
frontend/node_modules/ts-jest/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
# Contributing
|
||||
|
||||
When contributing to this repository, please first discuss the change you wish to make via
|
||||
[discussion](https://github.com/kulshekhar/ts-jest/discussions) 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.
|
||||
|
||||
## Workflow and Pull Requests
|
||||
|
||||
The team will monitor pull requests. We'll do our best to provide updates and feedback throughout the process.
|
||||
|
||||
_Before_ submitting a pull request, please make sure the following is done…
|
||||
|
||||
1. Fork the repo and create your branch from `main`. A guide on how to fork a repository: https://help.github.com/articles/fork-a-repo/
|
||||
|
||||
Open terminal (e.g. Terminal, iTerm, Git Bash or Git Shell) and type:
|
||||
|
||||
```sh-session
|
||||
$ git clone https://github.com/<your_username>/ts-jest
|
||||
$ cd ts-jest
|
||||
$ git checkout -b my_branch
|
||||
```
|
||||
|
||||
Note: Replace `<your_username>` with your GitHub username
|
||||
|
||||
2. `ts-jest` uses `npm` for running development scripts. If you haven't already done so, please [install npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).
|
||||
|
||||
3. Make sure you have a compatible version of `node` installed (As of April 14th 2021, `v14.x` is recommended).
|
||||
|
||||
```sh
|
||||
node -v
|
||||
```
|
||||
|
||||
4. Run `npm ci`. `ts-jest` will automatically build source files into `dist/` after installing dependencies.
|
||||
|
||||
5. Ensure the test suite passes via `npm run test`.
|
||||
|
||||
### Testing
|
||||
|
||||
Code that is written needs to be tested to ensure that it achieves the desired behaviour. Tests either fall into a unit
|
||||
test or an integration test.
|
||||
|
||||
##### Unit tests
|
||||
|
||||
The unit test files are associated with source files which are in `src/`. If the scope of your work only requires a unit test,
|
||||
this is where you will write it in. Tests here usually don't require much if any setup.
|
||||
|
||||
##### Integration tests
|
||||
|
||||
There will be situations however where the work you have done cannot be tested alone using unit tests. In situations like this,
|
||||
you should write an integration test for your code. The integration tests reside within the `e2e` directory.
|
||||
Within this directory, there is a `__tests__` directory. This is where you will write the integration test itself.
|
||||
The tests within this directory execute jest itself using `run-jest.ts` and assertions are usually made on one if not all
|
||||
the output of the following `status`, `stdout` and `stderr`. The other subdirectories within the `e2e` directory are
|
||||
where you will write the files that jest will run for your integration tests. Feel free to take a look at any of the tests
|
||||
in the `__tests__` directory within `e2e` to have a better sense of how it is currently being done.
|
||||
|
||||
It is possible to run the integration test itself manually to inspect that the new behaviour is indeed correct.
|
||||
Here is a small code snippet of how to do just that. This is useful when debugging a failing test.
|
||||
|
||||
```bash
|
||||
$ cd e2e/test-utils
|
||||
$ node ../../node_modules/jest/bin/jest.js # It is possible to use node --inspect or ndb
|
||||
PASS __tests__/test-utils.spec.ts
|
||||
✓ stub (3ms)
|
||||
|
||||
Test Suites: 1 passed, 1 total
|
||||
Tests: 1 passed, 1 total
|
||||
Snapshots: 0 total
|
||||
Time: 0.232 s, estimated 1 s
|
||||
Ran all test suites.
|
||||
```
|
||||
|
||||
### Additional Workflow for any changes made to website or docs
|
||||
|
||||
If you are making changes to the website or documentation, test the `website` folder and run the server to check if your
|
||||
changes are being displayed accurately.
|
||||
|
||||
1. Locate to the `website` directory and install any website specific dependencies by typing in `npm ci`.
|
||||
2. Following steps are to be followed for this purpose from the root directory.
|
||||
```sh-session
|
||||
$ cd website # Only needed if you are not already in the website directory
|
||||
$ npm ci
|
||||
$ npm run lint-prettier # Please format markdown files
|
||||
$ npm run start
|
||||
```
|
||||
3. You can run a development server to check if the changes you made are being displayed accurately by running `npm run start` in the website directory.
|
||||
|
||||
The `ts-jest` website also offers documentation for older versions of `ts-jest`, which you can edit in `website/versioned_docs`.
|
||||
After making changes to the current documentation in `docs`, please check if any older versions of the documentation
|
||||
have a copy of the file where the change is also relevant and apply the changes to the `versioned_docs` as well.
|
||||
|
||||
## Bugs
|
||||
|
||||
### Where to Find Known Issues
|
||||
|
||||
We will be using GitHub Issues for our public bugs. We will keep a close eye on this and try to make it clear when we
|
||||
have an internal fix in progress. Before filing a new issue, try to make sure your problem doesn't already exist.
|
||||
|
||||
### Reporting New Issues
|
||||
|
||||
The best way to get your bug fixed is to provide a reduced test case. Please provide a public repository with a runnable example.
|
||||
|
||||
## How to Get in Touch
|
||||
|
||||
[`#testing` on Reactiflux](https://discord.gg/j6FKKQQrW9) or [our GitHub discussion](https://github.com/kulshekhar/ts-jest/discussions)
|
||||
|
||||
## Code Conventions
|
||||
|
||||
- 2 spaces for indentation (no tabs).
|
||||
- 120 character line length strongly preferred.
|
||||
- Prefer `'` over `"`.
|
||||
- ES6 syntax when possible.
|
||||
- Use [TypeScript](https://www.typescriptlang.org/).
|
||||
- No semicolon (`;`) required
|
||||
- Trailing commas,
|
||||
|
||||
## License
|
||||
|
||||
By contributing to `ts-jest`, you agree that your contributions will be licensed under its MIT license.
|
||||
21
frontend/node_modules/ts-jest/LICENSE.md
generated
vendored
Normal file
21
frontend/node_modules/ts-jest/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016-2025
|
||||
|
||||
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
frontend/node_modules/ts-jest/README.md
generated
vendored
Normal file
74
frontend/node_modules/ts-jest/README.md
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<h1 align="center">ts-jest</h1>
|
||||
|
||||
<p align="center">A Jest transformer with source map support 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=main"><img src="https://coveralls.io/repos/github/kulshekhar/ts-jest/badge.svg?branch=main" alt="Coverage status"/> </a>
|
||||
<a href="https://actions-badge.atrox.dev/kulshekhar/ts-jest/goto?ref=main"><img alt="GitHub actions" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fkulshekhar%2Fts-jest%2Fbadge%3Fref%3Dmain&style=flat-square" /> </a>
|
||||
<a href="https://github.com/kulshekhar/ts-jest/blob/main/LICENSE.md"><img src="https://img.shields.io/npm/l/ts-jest.svg?style=flat-square" alt="GitHub license"/> </a>
|
||||
<a href="https://gurubase.io/g/ts-jest"><img src="https://img.shields.io/badge/Gurubase-Ask%20ts--jest%20Guru-006BFF?style=flat-square" alt="Gurubase"/> </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/docs/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="./website/static/img/documentation.png" align="left" height="24"> View the online documentation (usage & technical)](https://kulshekhar.github.io/ts-jest)
|
||||
|
||||
[<img src="./website/static/img/discord.svg" align="left" height="24"> Ask for some help in the `Jest` Discord community](https://discord.gg/j6FKKQQrW9) or [`ts-jest` GitHub Discussion](https://github.com/kulshekhar/ts-jest/discussions)
|
||||
|
||||
[<img src="./website/static/img/troubleshooting.png" align="left" height="24"> Before reporting any issues, be sure to check the troubleshooting page](TROUBLESHOOTING.md)
|
||||
|
||||
[<img src="./website/static/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 test` 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 [transformer](https://jestjs.io/docs/next/code-transformation#writing-custom-transformers) 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](https://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 a [license for open source] (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
|
||||
3
frontend/node_modules/ts-jest/TROUBLESHOOTING.md
generated
vendored
Normal file
3
frontend/node_modules/ts-jest/TROUBLESHOOTING.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Troubleshooting
|
||||
|
||||
Troubleshooting guide have been moved to https://kulshekhar.github.io/ts-jest/docs/guides/troubleshooting
|
||||
3
frontend/node_modules/ts-jest/cli.js
generated
vendored
Executable file
3
frontend/node_modules/ts-jest/cli.js
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require('./dist/cli').processArgv()
|
||||
6
frontend/node_modules/ts-jest/dist/cli/config/init.d.ts
generated
vendored
Normal file
6
frontend/node_modules/ts-jest/dist/cli/config/init.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* This has been written quickly. While trying to improve I realised it'd be better to have it in Jest...
|
||||
* ...and I saw a merged PR with `jest --init` tool!
|
||||
* TODO: see what's the best path for this
|
||||
*/
|
||||
export {};
|
||||
138
frontend/node_modules/ts-jest/dist/cli/config/init.js
generated
vendored
Normal file
138
frontend/node_modules/ts-jest/dist/cli/config/init.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
"use strict";
|
||||
/**
|
||||
* This has been written quickly. While trying to improve I realised it'd be better to have it in Jest...
|
||||
* ...and I saw a merged PR with `jest --init` tool!
|
||||
* TODO: see what's the best path for this
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.help = exports.run = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const path_1 = require("path");
|
||||
const ejs_1 = __importDefault(require("ejs"));
|
||||
const json5_1 = require("json5");
|
||||
const create_jest_preset_1 = require("../../presets/create-jest-preset");
|
||||
const JEST_CONFIG_EJS_TEMPLATE = `const { <%= presetCreatorFn %> } = require("ts-jest");
|
||||
|
||||
const tsJestTransformCfg = <%= presetCreatorFn %>(<%- transformOpts %>).transform;
|
||||
|
||||
/** @type {import("jest").Config} **/
|
||||
<%= exportKind %> {
|
||||
testEnvironment: "<%= testEnvironment %>",
|
||||
transform: {
|
||||
...tsJestTransformCfg,
|
||||
},
|
||||
};`;
|
||||
const ensureOnlyUsingDoubleQuotes = (str) => {
|
||||
return str
|
||||
.replace(/"'(.*?)'"/g, '"$1"')
|
||||
.replace(/'ts-jest'/g, '"ts-jest"')
|
||||
.replace(/'babel-jest'/g, '"babel-jest"');
|
||||
};
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const run = async (args /* , logger: Logger */) => {
|
||||
const { tsconfig: askedTsconfig, force, jsdom, js: jsFilesProcessor, babel: shouldPostProcessWithBabel } = args;
|
||||
const file = args._[0]?.toString() ?? 'jest.config.js';
|
||||
const filePath = (0, path_1.join)(process.cwd(), file);
|
||||
const name = (0, path_1.basename)(file);
|
||||
const isPackageJsonConfig = name === 'package.json';
|
||||
const isJestConfigFileExisted = (0, fs_1.existsSync)(filePath);
|
||||
const pkgFile = isPackageJsonConfig ? filePath : (0, path_1.join)(process.cwd(), 'package.json');
|
||||
const isPackageJsonExisted = isPackageJsonConfig || (0, fs_1.existsSync)(pkgFile);
|
||||
const tsconfig = askedTsconfig === 'tsconfig.json' ? undefined : askedTsconfig;
|
||||
const pkgJsonContent = isPackageJsonExisted ? JSON.parse((0, fs_1.readFileSync)(pkgFile, 'utf8')) : {};
|
||||
if (shouldPostProcessWithBabel) {
|
||||
console.warn(`The option --babel is deprecated and will be removed in the next major version.` +
|
||||
` Please specify 'js' option value (see more with npx ts-jest help) if you wish 'ts-jest' to process 'js' with TypeScript API or Babel.`);
|
||||
}
|
||||
if (isPackageJsonConfig && !isJestConfigFileExisted) {
|
||||
throw new Error(`File ${file} does not exists.`);
|
||||
}
|
||||
else if (!isPackageJsonConfig && isJestConfigFileExisted && !force) {
|
||||
throw new Error(`Configuration file ${file} already exists.`);
|
||||
}
|
||||
if (!isPackageJsonConfig && !name.endsWith('.js')) {
|
||||
throw new TypeError(`Configuration file ${file} must be a .js file or the package.json.`);
|
||||
}
|
||||
if (isPackageJsonExisted && pkgJsonContent.jest) {
|
||||
if (force && !isPackageJsonConfig) {
|
||||
delete pkgJsonContent.jest;
|
||||
(0, fs_1.writeFileSync)(pkgFile, JSON.stringify(pkgJsonContent, undefined, ' '));
|
||||
}
|
||||
else if (!force) {
|
||||
throw new Error(`A Jest configuration is already set in ${pkgFile}.`);
|
||||
}
|
||||
}
|
||||
let body;
|
||||
const transformOpts = tsconfig
|
||||
? { tsconfig: `${(0, json5_1.stringify)(tsconfig)}` }
|
||||
: undefined;
|
||||
let transformConfig;
|
||||
if (isPackageJsonConfig) {
|
||||
if (jsFilesProcessor === 'babel' || shouldPostProcessWithBabel) {
|
||||
transformConfig = (0, create_jest_preset_1.createJsWithBabelPreset)(transformOpts);
|
||||
}
|
||||
else if (jsFilesProcessor === 'ts') {
|
||||
transformConfig = (0, create_jest_preset_1.createJsWithTsPreset)(transformOpts);
|
||||
}
|
||||
else {
|
||||
transformConfig = (0, create_jest_preset_1.createDefaultPreset)(transformOpts);
|
||||
}
|
||||
body = ensureOnlyUsingDoubleQuotes(JSON.stringify({
|
||||
...pkgJsonContent,
|
||||
jest: transformConfig,
|
||||
}, undefined, ' '));
|
||||
}
|
||||
else {
|
||||
let presetCreatorFn;
|
||||
if (jsFilesProcessor === 'babel' || shouldPostProcessWithBabel) {
|
||||
presetCreatorFn = 'createJsWithBabelPreset';
|
||||
}
|
||||
else if (jsFilesProcessor === 'ts') {
|
||||
presetCreatorFn = 'createJsWithTsPreset';
|
||||
}
|
||||
else {
|
||||
presetCreatorFn = 'createDefaultPreset';
|
||||
}
|
||||
body = ejs_1.default.render(JEST_CONFIG_EJS_TEMPLATE, {
|
||||
exportKind: pkgJsonContent.type === 'module' ? 'export default' : 'module.exports =',
|
||||
testEnvironment: jsdom ? 'jsdom' : 'node',
|
||||
presetCreatorFn,
|
||||
transformOpts: transformOpts ? ensureOnlyUsingDoubleQuotes(JSON.stringify(transformOpts, null, 2)) : undefined,
|
||||
});
|
||||
}
|
||||
(0, fs_1.writeFileSync)(filePath, body);
|
||||
process.stderr.write(`
|
||||
Jest configuration written to "${filePath}".
|
||||
`);
|
||||
};
|
||||
exports.run = run;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const help = async () => {
|
||||
process.stdout.write(`
|
||||
Usage:
|
||||
ts-jest config:init [options] [<config-file>]
|
||||
|
||||
Arguments:
|
||||
<config-file> Can be a js or json Jest config file. If it is a
|
||||
package.json file, the configuration will be read from
|
||||
the "jest" property.
|
||||
Default: jest.config.js
|
||||
|
||||
Options:
|
||||
--force Discard any existing Jest config
|
||||
--js ts|babel Process '.js' files with ts-jest if 'ts' or with
|
||||
babel-jest if 'babel'
|
||||
--no-jest-preset Disable the use of Jest presets
|
||||
--tsconfig <file> Path to the tsconfig.json file
|
||||
--babel Enable using Babel to process 'js' resulted content from 'ts-jest' processing
|
||||
--jsdom Use 'jsdom' as test environment instead of 'node'
|
||||
`);
|
||||
};
|
||||
exports.help = help;
|
||||
1
frontend/node_modules/ts-jest/dist/cli/config/migrate.d.ts
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/dist/cli/config/migrate.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
174
frontend/node_modules/ts-jest/dist/cli/config/migrate.js
generated
vendored
Normal file
174
frontend/node_modules/ts-jest/dist/cli/config/migrate.js
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.help = exports.run = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const path_1 = require("path");
|
||||
const bs_logger_1 = require("bs-logger");
|
||||
const fast_json_stable_stringify_1 = __importDefault(require("fast-json-stable-stringify"));
|
||||
const json5_1 = require("json5");
|
||||
const create_jest_preset_1 = require("../../presets/create-jest-preset");
|
||||
const backports_1 = require("../../utils/backports");
|
||||
const presets_1 = require("../helpers/presets");
|
||||
const migrateGlobalConfigToTransformConfig = (transformConfig, globalsTsJestConfig) => {
|
||||
if (transformConfig) {
|
||||
return Object.entries(transformConfig).reduce((previousValue, currentValue) => {
|
||||
const [key, transformOptions] = currentValue;
|
||||
if (typeof transformOptions === 'string' && transformOptions.includes('ts-jest')) {
|
||||
return {
|
||||
...previousValue,
|
||||
[key]: globalsTsJestConfig ? ['ts-jest', globalsTsJestConfig] : 'ts-jest',
|
||||
};
|
||||
}
|
||||
return {
|
||||
...previousValue,
|
||||
[key]: transformOptions,
|
||||
};
|
||||
}, {});
|
||||
}
|
||||
return {};
|
||||
};
|
||||
const migratePresetToTransformConfig = (transformConfig, preset, globalsTsJestConfig) => {
|
||||
if (preset) {
|
||||
const transformConfigFromPreset = preset.name === "ts-jest/presets/js-with-ts" /* JestPresetNames.jsWithTs */
|
||||
? (0, create_jest_preset_1.createJsWithTsPreset)(globalsTsJestConfig)
|
||||
: preset.name === "ts-jest/presets/js-with-babel" /* JestPresetNames.jsWIthBabel */
|
||||
? (0, create_jest_preset_1.createJsWithBabelPreset)(globalsTsJestConfig)
|
||||
: (0, create_jest_preset_1.createDefaultPreset)(globalsTsJestConfig);
|
||||
return {
|
||||
...transformConfig,
|
||||
...transformConfigFromPreset.transform,
|
||||
};
|
||||
}
|
||||
return transformConfig;
|
||||
};
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const run = async (args /* , logger: Logger*/) => {
|
||||
const nullLogger = (0, bs_logger_1.createLogger)({ targets: [] });
|
||||
const file = args._[0]?.toString();
|
||||
const filePath = (0, path_1.resolve)(process.cwd(), file);
|
||||
if (!(0, fs_1.existsSync)(filePath)) {
|
||||
throw new Error(`Configuration file ${file} does not exists.`);
|
||||
}
|
||||
const name = (0, path_1.basename)(file);
|
||||
const isPackage = name === 'package.json';
|
||||
if (!/\.(js|json)$/.test(name)) {
|
||||
throw new TypeError(`Configuration file ${file} must be a JavaScript or JSON file.`);
|
||||
}
|
||||
let actualConfig = require(filePath);
|
||||
if (isPackage) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
actualConfig = actualConfig.jest;
|
||||
}
|
||||
if (!actualConfig)
|
||||
actualConfig = {};
|
||||
// migrate
|
||||
// first we backport our options
|
||||
const migratedConfig = (0, backports_1.backportJestConfig)(nullLogger, actualConfig);
|
||||
let preset;
|
||||
if (migratedConfig.preset) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
preset = presets_1.allPresets[migratedConfig.preset] ?? presets_1.allPresets["ts-jest/presets/default" /* JestPresetNames.default */];
|
||||
}
|
||||
else {
|
||||
if (args.js) {
|
||||
preset = args.js === 'babel' ? presets_1.allPresets["ts-jest/presets/js-with-babel" /* JestPresetNames.jsWIthBabel */] : presets_1.allPresets["ts-jest/presets/js-with-ts" /* JestPresetNames.jsWithTs */];
|
||||
}
|
||||
else {
|
||||
preset = presets_1.allPresets["ts-jest/presets/default" /* JestPresetNames.default */];
|
||||
}
|
||||
}
|
||||
// check the extensions
|
||||
if (migratedConfig.moduleFileExtensions?.length && preset) {
|
||||
const presetValue = dedupSort(preset.value.moduleFileExtensions ?? []).join('::');
|
||||
const migratedValue = dedupSort(migratedConfig.moduleFileExtensions).join('::');
|
||||
if (presetValue === migratedValue) {
|
||||
delete migratedConfig.moduleFileExtensions;
|
||||
}
|
||||
}
|
||||
// there is a testRegex, remove our testMatch
|
||||
if (typeof migratedConfig.testRegex === 'string' || migratedConfig.testRegex?.length) {
|
||||
delete migratedConfig.testMatch;
|
||||
}
|
||||
// check the testMatch
|
||||
else if (migratedConfig.testMatch?.length && preset) {
|
||||
const presetValue = dedupSort(preset.value.testMatch ?? []).join('::');
|
||||
const migratedValue = dedupSort(migratedConfig.testMatch).join('::');
|
||||
if (presetValue === migratedValue) {
|
||||
delete migratedConfig.testMatch;
|
||||
}
|
||||
}
|
||||
const globalsTsJestConfig = migratedConfig.globals?.['ts-jest'];
|
||||
migratedConfig.transform = migrateGlobalConfigToTransformConfig(migratedConfig.transform, globalsTsJestConfig);
|
||||
migratedConfig.transform = migratePresetToTransformConfig(migratedConfig.transform, preset, globalsTsJestConfig);
|
||||
cleanupConfig(actualConfig);
|
||||
cleanupConfig(migratedConfig);
|
||||
const before = (0, fast_json_stable_stringify_1.default)(actualConfig);
|
||||
const after = (0, fast_json_stable_stringify_1.default)(migratedConfig);
|
||||
if (after === before) {
|
||||
process.stderr.write(`
|
||||
No migration needed for given Jest configuration
|
||||
`);
|
||||
return;
|
||||
}
|
||||
const stringify = file.endsWith('.json') ? JSON.stringify : json5_1.stringify;
|
||||
const prefix = file.endsWith('.json') ? '"jest": ' : 'module.exports = ';
|
||||
// output new config
|
||||
process.stderr.write(`
|
||||
Migrated Jest configuration:
|
||||
`);
|
||||
process.stdout.write(`${prefix}${stringify(migratedConfig, undefined, ' ')}\n`);
|
||||
};
|
||||
exports.run = run;
|
||||
function cleanupConfig(config) {
|
||||
if (config.globals) {
|
||||
delete config.globals['ts-jest'];
|
||||
if (!Object.keys(config.globals).length) {
|
||||
delete config.globals;
|
||||
}
|
||||
}
|
||||
if (config.transform && !Object.keys(config.transform).length) {
|
||||
delete config.transform;
|
||||
}
|
||||
if (config.moduleFileExtensions) {
|
||||
config.moduleFileExtensions = dedupSort(config.moduleFileExtensions);
|
||||
if (!config.moduleFileExtensions.length)
|
||||
delete config.moduleFileExtensions;
|
||||
}
|
||||
if (config.testMatch) {
|
||||
config.testMatch = dedupSort(config.testMatch);
|
||||
if (!config.testMatch.length)
|
||||
delete config.testMatch;
|
||||
}
|
||||
delete config.preset;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function dedupSort(arr) {
|
||||
return arr
|
||||
.filter((s, i, a) => a.findIndex((e) => s.toString() === e.toString()) === i)
|
||||
.sort((a, b) => (a.toString() > b.toString() ? 1 : a.toString() < b.toString() ? -1 : 0));
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const help = async () => {
|
||||
process.stdout.write(`
|
||||
Usage:
|
||||
ts-jest config:migrate [options] <config-file>
|
||||
|
||||
Arguments:
|
||||
<config-file> Can be a js or json Jest config file. If it is a
|
||||
package.json file, the configuration will be read from
|
||||
the "jest" property.
|
||||
|
||||
Options:
|
||||
--js ts|babel Process .js files with ts-jest if 'ts' or with
|
||||
babel-jest if 'babel'
|
||||
--no-jest-preset Disable the use of Jest presets
|
||||
`);
|
||||
};
|
||||
exports.help = help;
|
||||
1
frontend/node_modules/ts-jest/dist/cli/help.d.ts
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/dist/cli/help.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
25
frontend/node_modules/ts-jest/dist/cli/help.js
generated
vendored
Normal file
25
frontend/node_modules/ts-jest/dist/cli/help.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.help = exports.run = void 0;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const run = async (_) => {
|
||||
process.stdout.write(`
|
||||
Usage:
|
||||
ts-jest command [options] [...args]
|
||||
|
||||
Commands:
|
||||
config:init Creates initial Jest configuration
|
||||
config:migrate Migrates a given Jest configuration
|
||||
help [command] Show this help, or help about a command
|
||||
|
||||
Example:
|
||||
ts-jest help config:migrate
|
||||
`);
|
||||
};
|
||||
exports.run = run;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
exports.help = exports.run;
|
||||
1
frontend/node_modules/ts-jest/dist/cli/helpers/presets.d.ts
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/dist/cli/helpers/presets.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
41
frontend/node_modules/ts-jest/dist/cli/helpers/presets.js
generated
vendored
Normal file
41
frontend/node_modules/ts-jest/dist/cli/helpers/presets.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.jsWIthBabel = exports.jsWithTs = exports.defaults = exports.allPresets = void 0;
|
||||
const definePreset = (fullName) => ({
|
||||
fullName,
|
||||
get name() {
|
||||
return this.isDefault ? 'ts-jest' : fullName;
|
||||
},
|
||||
get label() {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
return fullName.split('/').pop();
|
||||
},
|
||||
get jsVarName() {
|
||||
return this.isDefault
|
||||
? 'defaults'
|
||||
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
fullName
|
||||
.split('/')
|
||||
.pop()
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
.replace(/\-([a-z])/g, (_, l) => l.toUpperCase());
|
||||
},
|
||||
get value() {
|
||||
return require(`../../../${fullName.replace(/^ts-jest\//, '')}/jest-preset`);
|
||||
},
|
||||
jsImport(varName = 'tsjPreset') {
|
||||
return `const { ${this.jsVarName}: ${varName} } = require('ts-jest/presets')`;
|
||||
},
|
||||
get isDefault() {
|
||||
return fullName === "ts-jest/presets/default" /* JestPresetNames.default */;
|
||||
},
|
||||
});
|
||||
/** @internal */
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
exports.allPresets = {};
|
||||
/** @internal */
|
||||
exports.defaults = (exports.allPresets["ts-jest/presets/default" /* JestPresetNames.default */] = definePreset("ts-jest/presets/default" /* JestPresetNames.default */));
|
||||
/** @internal */
|
||||
exports.jsWithTs = (exports.allPresets["ts-jest/presets/js-with-ts" /* JestPresetNames.jsWithTs */] = definePreset("ts-jest/presets/js-with-ts" /* JestPresetNames.jsWithTs */));
|
||||
/** @internal */
|
||||
exports.jsWIthBabel = (exports.allPresets["ts-jest/presets/js-with-babel" /* JestPresetNames.jsWIthBabel */] = definePreset("ts-jest/presets/js-with-babel" /* JestPresetNames.jsWIthBabel */));
|
||||
1
frontend/node_modules/ts-jest/dist/cli/index.d.ts
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/dist/cli/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
63
frontend/node_modules/ts-jest/dist/cli/index.js
generated
vendored
Normal file
63
frontend/node_modules/ts-jest/dist/cli/index.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.processArgv = processArgv;
|
||||
const bs_logger_1 = require("bs-logger");
|
||||
const yargs_parser_1 = __importDefault(require("yargs-parser"));
|
||||
const utils_1 = require("../utils");
|
||||
const VALID_COMMANDS = ['help', 'config:migrate', 'config:init'];
|
||||
const logger = utils_1.rootLogger.child({ [bs_logger_1.LogContexts.namespace]: 'cli', [bs_logger_1.LogContexts.application]: 'ts-jest' });
|
||||
async function cli(args) {
|
||||
const parsedArgv = (0, 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(val) {
|
||||
const res = val.trim().toLowerCase();
|
||||
if (!['babel', 'ts'].includes(res))
|
||||
throw new Error(`The 'js' option must be 'babel' or 'ts', given: '${val}'.`);
|
||||
return res;
|
||||
},
|
||||
},
|
||||
});
|
||||
// deprecated
|
||||
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;
|
||||
}
|
||||
let command = parsedArgv._.shift();
|
||||
const isHelp = command === 'help';
|
||||
if (isHelp)
|
||||
command = parsedArgv._.shift();
|
||||
if (!VALID_COMMANDS.includes(command))
|
||||
command = 'help';
|
||||
const { run, help } = require(`./${command.replace(/:/g, '/')}`);
|
||||
const cmd = isHelp && command !== 'help' ? help : run;
|
||||
return cmd(parsedArgv, logger);
|
||||
}
|
||||
const errorHasMessage = (err) => {
|
||||
if (typeof err !== 'object' || err === null)
|
||||
return false;
|
||||
return 'message' in err;
|
||||
};
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
async function processArgv() {
|
||||
try {
|
||||
await cli(process.argv.slice(2));
|
||||
process.exit(0);
|
||||
}
|
||||
catch (err) {
|
||||
if (errorHasMessage(err)) {
|
||||
logger.fatal(err.message);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
frontend/node_modules/ts-jest/dist/config/index.d.ts
generated
vendored
Normal file
2
frontend/node_modules/ts-jest/dist/config/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './paths-to-module-name-mapper';
|
||||
export * from './types';
|
||||
18
frontend/node_modules/ts-jest/dist/config/index.js
generated
vendored
Normal file
18
frontend/node_modules/ts-jest/dist/config/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./paths-to-module-name-mapper"), exports);
|
||||
__exportStar(require("./types"), exports);
|
||||
9
frontend/node_modules/ts-jest/dist/config/paths-to-module-name-mapper.d.ts
generated
vendored
Normal file
9
frontend/node_modules/ts-jest/dist/config/paths-to-module-name-mapper.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { Config } from '@jest/types';
|
||||
import type { CompilerOptions } from 'typescript';
|
||||
type TsPathMapping = Exclude<CompilerOptions['paths'], undefined>;
|
||||
type JestPathMapping = Config.InitialOptions['moduleNameMapper'];
|
||||
export declare const pathsToModuleNameMapper: (mapping: TsPathMapping, { prefix, useESM }?: {
|
||||
prefix?: string;
|
||||
useESM?: boolean;
|
||||
}) => JestPathMapping;
|
||||
export {};
|
||||
52
frontend/node_modules/ts-jest/dist/config/paths-to-module-name-mapper.js
generated
vendored
Normal file
52
frontend/node_modules/ts-jest/dist/config/paths-to-module-name-mapper.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pathsToModuleNameMapper = void 0;
|
||||
const bs_logger_1 = require("bs-logger");
|
||||
const utils_1 = require("../utils");
|
||||
const messages_1 = require("../utils/messages");
|
||||
// we don't need to escape all chars, so commented out is the real one
|
||||
// const escapeRegex = (str: string) => str.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
|
||||
const escapeRegex = (str) => str.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
const logger = utils_1.rootLogger.child({ [bs_logger_1.LogContexts.namespace]: 'path-mapper' });
|
||||
const pathsToModuleNameMapper = (mapping, { prefix = '', useESM = false } = {}) => {
|
||||
const jestMap = {};
|
||||
for (const fromPath of Object.keys(mapping)) {
|
||||
const toPaths = mapping[fromPath];
|
||||
// check that we have only one target path
|
||||
if (toPaths.length === 0) {
|
||||
logger.warn((0, messages_1.interpolate)("Not mapping \"{{path}}\" because it has no target." /* Errors.NotMappingPathWithEmptyMap */, { path: fromPath }));
|
||||
continue;
|
||||
}
|
||||
// split with '*'
|
||||
const segments = fromPath.split(/\*/g);
|
||||
if (segments.length === 1) {
|
||||
const paths = toPaths.map((target) => {
|
||||
const enrichedPrefix = prefix !== '' && !prefix.endsWith('/') ? `${prefix}/` : prefix;
|
||||
return `${enrichedPrefix}${target}`;
|
||||
});
|
||||
const cjsPattern = `^${escapeRegex(fromPath)}$`;
|
||||
jestMap[cjsPattern] = paths.length === 1 ? paths[0] : paths;
|
||||
}
|
||||
else if (segments.length === 2) {
|
||||
const paths = toPaths.map((target) => {
|
||||
const enrichedTarget = target.startsWith('./') && prefix !== '' ? target.substring(target.indexOf('/') + 1) : target;
|
||||
const enrichedPrefix = prefix !== '' && !prefix.endsWith('/') ? `${prefix}/` : prefix;
|
||||
return `${enrichedPrefix}${enrichedTarget.replace(/\*/g, '$1')}`;
|
||||
});
|
||||
if (useESM) {
|
||||
const esmPattern = `^${escapeRegex(segments[0])}(.*)${escapeRegex(segments[1])}\\.js$`;
|
||||
jestMap[esmPattern] = paths.length === 1 ? paths[0] : paths;
|
||||
}
|
||||
const cjsPattern = `^${escapeRegex(segments[0])}(.*)${escapeRegex(segments[1])}$`;
|
||||
jestMap[cjsPattern] = paths.length === 1 ? paths[0] : paths;
|
||||
}
|
||||
else {
|
||||
logger.warn((0, messages_1.interpolate)("Not mapping \"{{path}}\" because it has more than one star (`*`)." /* Errors.NotMappingMultiStarPath */, { path: fromPath }));
|
||||
}
|
||||
}
|
||||
if (useESM) {
|
||||
jestMap['^(\\.{1,2}/.*)\\.js$'] = '$1';
|
||||
}
|
||||
return jestMap;
|
||||
};
|
||||
exports.pathsToModuleNameMapper = pathsToModuleNameMapper;
|
||||
2
frontend/node_modules/ts-jest/dist/config/types.d.ts
generated
vendored
Normal file
2
frontend/node_modules/ts-jest/dist/config/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { TsConfigJson } from 'type-fest';
|
||||
export type TsConfigCompilerOptionsJson = TsConfigJson.CompilerOptions;
|
||||
2
frontend/node_modules/ts-jest/dist/config/types.js
generated
vendored
Normal file
2
frontend/node_modules/ts-jest/dist/config/types.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
13
frontend/node_modules/ts-jest/dist/constants.d.ts
generated
vendored
Normal file
13
frontend/node_modules/ts-jest/dist/constants.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
export declare const LINE_FEED = "\n";
|
||||
export declare const DECLARATION_TYPE_EXT = ".d.ts";
|
||||
export declare const JS_JSX_EXTENSIONS: string[];
|
||||
export declare const TS_TSX_REGEX: RegExp;
|
||||
export declare const JS_JSX_REGEX: RegExp;
|
||||
export declare const TS_TRANSFORM_PATTERN = "^.+\\.tsx?$";
|
||||
export declare const ESM_TS_TRANSFORM_PATTERN = "^.+\\.m?tsx?$";
|
||||
export declare const TS_JS_TRANSFORM_PATTERN = "^.+\\.[tj]sx?$";
|
||||
export declare const ESM_TS_JS_TRANSFORM_PATTERN = "^.+\\.m?[tj]sx?$";
|
||||
export declare const JS_TRANSFORM_PATTERN = "^.+\\.jsx?$";
|
||||
export declare const ESM_JS_TRANSFORM_PATTERN = "^.+\\.m?jsx?$";
|
||||
export declare const TS_EXT_TO_TREAT_AS_ESM: string[];
|
||||
export declare const JS_EXT_TO_TREAT_AS_ESM: string[];
|
||||
22
frontend/node_modules/ts-jest/dist/constants.js
generated
vendored
Normal file
22
frontend/node_modules/ts-jest/dist/constants.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DEFAULT_JEST_TEST_MATCH = exports.JS_EXT_TO_TREAT_AS_ESM = exports.TS_EXT_TO_TREAT_AS_ESM = exports.ESM_JS_TRANSFORM_PATTERN = exports.JS_TRANSFORM_PATTERN = exports.ESM_TS_JS_TRANSFORM_PATTERN = exports.TS_JS_TRANSFORM_PATTERN = exports.ESM_TS_TRANSFORM_PATTERN = exports.TS_TRANSFORM_PATTERN = exports.JS_JSX_REGEX = exports.TS_TSX_REGEX = exports.JS_JSX_EXTENSIONS = exports.DECLARATION_TYPE_EXT = exports.LINE_FEED = void 0;
|
||||
exports.LINE_FEED = '\n';
|
||||
exports.DECLARATION_TYPE_EXT = '.d.ts';
|
||||
exports.JS_JSX_EXTENSIONS = ['.js', '.jsx'];
|
||||
exports.TS_TSX_REGEX = /\.[cm]?tsx?$/;
|
||||
exports.JS_JSX_REGEX = /\.[cm]?jsx?$/;
|
||||
exports.TS_TRANSFORM_PATTERN = '^.+\\.tsx?$';
|
||||
exports.ESM_TS_TRANSFORM_PATTERN = '^.+\\.m?tsx?$';
|
||||
exports.TS_JS_TRANSFORM_PATTERN = '^.+\\.[tj]sx?$';
|
||||
exports.ESM_TS_JS_TRANSFORM_PATTERN = '^.+\\.m?[tj]sx?$';
|
||||
exports.JS_TRANSFORM_PATTERN = '^.+\\.jsx?$';
|
||||
exports.ESM_JS_TRANSFORM_PATTERN = '^.+\\.m?jsx?$';
|
||||
// `extensionsToTreatAsEsm` will throw error with `.mjs`
|
||||
exports.TS_EXT_TO_TREAT_AS_ESM = ['.ts', '.tsx', '.mts'];
|
||||
exports.JS_EXT_TO_TREAT_AS_ESM = ['.jsx'];
|
||||
/**
|
||||
* @internal
|
||||
* See https://jestjs.io/docs/en/configuration#testmatch-arraystring
|
||||
*/
|
||||
exports.DEFAULT_JEST_TEST_MATCH = ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'];
|
||||
15
frontend/node_modules/ts-jest/dist/index.d.ts
generated
vendored
Normal file
15
frontend/node_modules/ts-jest/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { TsJestTransformer } from './legacy/ts-jest-transformer';
|
||||
import type { TsJestTransformerOptions } from './types';
|
||||
export * from './config';
|
||||
export * from './constants';
|
||||
export * from './legacy/compiler';
|
||||
export * from './legacy/ts-jest-transformer';
|
||||
export * from './legacy/config/config-set';
|
||||
export * from './presets/create-jest-preset';
|
||||
export * from './raw-compiler-options';
|
||||
export * from './utils';
|
||||
export * from './types';
|
||||
declare const _default: {
|
||||
createTransformer(tsJestConfig?: TsJestTransformerOptions): TsJestTransformer;
|
||||
};
|
||||
export default _default;
|
||||
31
frontend/node_modules/ts-jest/dist/index.js
generated
vendored
Normal file
31
frontend/node_modules/ts-jest/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ts_jest_transformer_1 = require("./legacy/ts-jest-transformer");
|
||||
__exportStar(require("./config"), exports);
|
||||
__exportStar(require("./constants"), exports);
|
||||
__exportStar(require("./legacy/compiler"), exports);
|
||||
__exportStar(require("./legacy/ts-jest-transformer"), exports);
|
||||
__exportStar(require("./legacy/config/config-set"), exports);
|
||||
__exportStar(require("./presets/create-jest-preset"), exports);
|
||||
__exportStar(require("./raw-compiler-options"), exports);
|
||||
__exportStar(require("./utils"), exports);
|
||||
__exportStar(require("./types"), exports);
|
||||
exports.default = {
|
||||
createTransformer(tsJestConfig) {
|
||||
return new ts_jest_transformer_1.TsJestTransformer(tsJestConfig);
|
||||
},
|
||||
};
|
||||
8
frontend/node_modules/ts-jest/dist/legacy/compiler/compiler-utils.d.ts
generated
vendored
Normal file
8
frontend/node_modules/ts-jest/dist/legacy/compiler/compiler-utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Rely on TypeScript compiled output generation which contains this prefix to point to sourcemap location.
|
||||
*/
|
||||
export declare const SOURCE_MAPPING_PREFIX = "sourceMappingURL=";
|
||||
/**
|
||||
* Update the output remapping the source map.
|
||||
*/
|
||||
export declare function updateOutput(outputText: string, normalizedFileName: string, sourceMap?: string): string;
|
||||
32
frontend/node_modules/ts-jest/dist/legacy/compiler/compiler-utils.js
generated
vendored
Normal file
32
frontend/node_modules/ts-jest/dist/legacy/compiler/compiler-utils.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SOURCE_MAPPING_PREFIX = void 0;
|
||||
exports.updateOutput = updateOutput;
|
||||
const utils_1 = require("../../utils");
|
||||
/**
|
||||
* Rely on TypeScript compiled output generation which contains this prefix to point to sourcemap location.
|
||||
*/
|
||||
exports.SOURCE_MAPPING_PREFIX = 'sourceMappingURL=';
|
||||
/**
|
||||
* Update the output remapping the source map.
|
||||
*/
|
||||
function updateOutput(outputText, normalizedFileName, sourceMap) {
|
||||
if (sourceMap) {
|
||||
const base64Map = Buffer.from(updateSourceMap(sourceMap, normalizedFileName), 'utf8').toString('base64');
|
||||
const sourceMapContent = `data:application/json;charset=utf-8;base64,${base64Map}`;
|
||||
// sourceMappingURL= prefix is always at the end of compiledOutput, using lastIndexOf should be the safest way to substring
|
||||
return (outputText.slice(0, outputText.lastIndexOf(exports.SOURCE_MAPPING_PREFIX) + exports.SOURCE_MAPPING_PREFIX.length) +
|
||||
sourceMapContent);
|
||||
}
|
||||
return outputText;
|
||||
}
|
||||
/**
|
||||
* Update the source map contents for improved output.
|
||||
*/
|
||||
const updateSourceMap = (sourceMapText, normalizedFileName) => {
|
||||
const sourceMap = JSON.parse(sourceMapText);
|
||||
sourceMap.file = normalizedFileName;
|
||||
sourceMap.sources = [normalizedFileName];
|
||||
delete sourceMap.sourceRoot;
|
||||
return (0, utils_1.stringify)(sourceMap);
|
||||
};
|
||||
2
frontend/node_modules/ts-jest/dist/legacy/compiler/index.d.ts
generated
vendored
Normal file
2
frontend/node_modules/ts-jest/dist/legacy/compiler/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './ts-compiler';
|
||||
export * from './ts-jest-compiler';
|
||||
18
frontend/node_modules/ts-jest/dist/legacy/compiler/index.js
generated
vendored
Normal file
18
frontend/node_modules/ts-jest/dist/legacy/compiler/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./ts-compiler"), exports);
|
||||
__exportStar(require("./ts-jest-compiler"), exports);
|
||||
27
frontend/node_modules/ts-jest/dist/legacy/compiler/ts-compiler.d.ts
generated
vendored
Normal file
27
frontend/node_modules/ts-jest/dist/legacy/compiler/ts-compiler.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Logger } from 'bs-logger';
|
||||
import { CompilerOptions, CustomTransformers, Program, TranspileOutput } from 'typescript';
|
||||
import type { StringMap, TsCompilerInstance, TsJestAstTransformer, TsJestCompileOptions, TTypeScript, CompiledOutput } from '../../types';
|
||||
import type { ConfigSet } from '../config/config-set';
|
||||
export declare class TsCompiler implements TsCompilerInstance {
|
||||
readonly configSet: ConfigSet;
|
||||
readonly runtimeCacheFS: StringMap;
|
||||
protected readonly _logger: Logger;
|
||||
protected readonly _ts: TTypeScript;
|
||||
protected readonly _initialCompilerOptions: CompilerOptions;
|
||||
protected _compilerOptions: CompilerOptions;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private _runtimeCacheFS;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private _fileContentCache;
|
||||
program: Program | undefined;
|
||||
constructor(configSet: ConfigSet, runtimeCacheFS: StringMap);
|
||||
getResolvedModules(fileContent: string, fileName: string, runtimeCacheFS: StringMap): string[];
|
||||
private fixupCompilerOptionsForModuleKind;
|
||||
getCompiledOutput(fileContent: string, fileName: string, options: TsJestCompileOptions): CompiledOutput;
|
||||
protected _transpileOutput(fileContent: string, fileName: string): TranspileOutput;
|
||||
protected _makeTransformers(customTransformers: TsJestAstTransformer): CustomTransformers;
|
||||
}
|
||||
425
frontend/node_modules/ts-jest/dist/legacy/compiler/ts-compiler.js
generated
vendored
Normal file
425
frontend/node_modules/ts-jest/dist/legacy/compiler/ts-compiler.js
generated
vendored
Normal file
@@ -0,0 +1,425 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TsCompiler = void 0;
|
||||
const path_1 = require("path");
|
||||
const bs_logger_1 = require("bs-logger");
|
||||
const lodash_memoize_1 = __importDefault(require("lodash.memoize"));
|
||||
const typescript_1 = __importDefault(require("typescript"));
|
||||
const constants_1 = require("../../constants");
|
||||
const transpile_module_1 = require("../../transpilers/typescript/transpile-module");
|
||||
const utils_1 = require("../../utils");
|
||||
const messages_1 = require("../../utils/messages");
|
||||
const compiler_utils_1 = require("./compiler-utils");
|
||||
const assertCompilerOptionsWithJestTransformMode = (compilerOptions, isEsmMode, logger) => {
|
||||
if (isEsmMode && compilerOptions.module === typescript_1.default.ModuleKind.CommonJS) {
|
||||
logger.error("The current compiler option \"module\" value is not suitable for Jest ESM mode. Please either use ES module kinds or Node16/NodeNext module kinds with \"type: module\" in package.json" /* Errors.InvalidModuleKindForEsm */);
|
||||
}
|
||||
};
|
||||
class TsCompiler {
|
||||
configSet;
|
||||
runtimeCacheFS;
|
||||
_logger;
|
||||
_ts;
|
||||
_initialCompilerOptions;
|
||||
_compilerOptions;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_runtimeCacheFS;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_fileContentCache;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_parsedTsConfig;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_fileVersionCache;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_cachedReadFile;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_projectVersion = 1;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_languageService;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_moduleResolutionHost;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_moduleResolutionCache;
|
||||
program;
|
||||
constructor(configSet, runtimeCacheFS) {
|
||||
this.configSet = configSet;
|
||||
this.runtimeCacheFS = runtimeCacheFS;
|
||||
this._ts = configSet.compilerModule;
|
||||
this._logger = utils_1.rootLogger.child({ namespace: 'ts-compiler' });
|
||||
this._parsedTsConfig = this.configSet.parsedTsConfig;
|
||||
this._initialCompilerOptions = { ...this._parsedTsConfig.options };
|
||||
this._compilerOptions = { ...this._initialCompilerOptions };
|
||||
this._runtimeCacheFS = runtimeCacheFS;
|
||||
if (!this.configSet.isolatedModules) {
|
||||
this._fileContentCache = new Map();
|
||||
this._fileVersionCache = new Map();
|
||||
this._cachedReadFile = this._logger.wrap({
|
||||
namespace: 'ts:serviceHost',
|
||||
call: null,
|
||||
[bs_logger_1.LogContexts.logLevel]: bs_logger_1.LogLevels.trace,
|
||||
}, 'readFile', (0, lodash_memoize_1.default)(this._ts.sys.readFile));
|
||||
/* istanbul ignore next */
|
||||
this._moduleResolutionHost = {
|
||||
fileExists: (0, lodash_memoize_1.default)(this._ts.sys.fileExists),
|
||||
readFile: this._cachedReadFile,
|
||||
directoryExists: (0, lodash_memoize_1.default)(this._ts.sys.directoryExists),
|
||||
getCurrentDirectory: () => this.configSet.cwd,
|
||||
realpath: this._ts.sys.realpath && (0, lodash_memoize_1.default)(this._ts.sys.realpath),
|
||||
getDirectories: (0, lodash_memoize_1.default)(this._ts.sys.getDirectories),
|
||||
useCaseSensitiveFileNames: () => this._ts.sys.useCaseSensitiveFileNames,
|
||||
};
|
||||
this._moduleResolutionCache = this._ts.createModuleResolutionCache(this.configSet.cwd, this._ts.sys.useCaseSensitiveFileNames ? (x) => x : (x) => x.toLowerCase(), this._compilerOptions);
|
||||
this._createLanguageService();
|
||||
}
|
||||
}
|
||||
getResolvedModules(fileContent, fileName, runtimeCacheFS) {
|
||||
// In watch mode, it is possible that the initial cacheFS becomes empty
|
||||
if (!this.runtimeCacheFS.size) {
|
||||
this._runtimeCacheFS = runtimeCacheFS;
|
||||
}
|
||||
this._logger.debug({ fileName }, 'getResolvedModules(): resolve direct imported module paths');
|
||||
const importedModulePaths = Array.from(new Set(this._getImportedModulePaths(fileContent, fileName)));
|
||||
this._logger.debug({ fileName }, 'getResolvedModules(): resolve nested imported module paths from directed imported module paths');
|
||||
importedModulePaths.forEach((importedModulePath) => {
|
||||
const resolvedFileContent = this._getFileContentFromCache(importedModulePath);
|
||||
importedModulePaths.push(...this._getImportedModulePaths(resolvedFileContent, importedModulePath).filter((modulePath) => !importedModulePaths.includes(modulePath)));
|
||||
});
|
||||
return importedModulePaths;
|
||||
}
|
||||
fixupCompilerOptionsForModuleKind(compilerOptions, isEsm) {
|
||||
const moduleResolution = this._ts.ModuleResolutionKind.Node10 ?? this._ts.ModuleResolutionKind.NodeJs;
|
||||
if (!isEsm) {
|
||||
return {
|
||||
...compilerOptions,
|
||||
module: this._ts.ModuleKind.CommonJS,
|
||||
moduleResolution,
|
||||
/**
|
||||
* This option is only supported in `Node16`/`NodeNext` and `Bundler` module, see https://www.typescriptlang.org/tsconfig/#customConditions
|
||||
*/
|
||||
customConditions: undefined,
|
||||
};
|
||||
}
|
||||
let moduleKind = compilerOptions.module ?? this._ts.ModuleKind.ESNext;
|
||||
let esModuleInterop = compilerOptions.esModuleInterop;
|
||||
if ((0, transpile_module_1.isModernNodeModuleKind)(moduleKind)) {
|
||||
esModuleInterop = true;
|
||||
moduleKind = this._ts.ModuleKind.ESNext;
|
||||
}
|
||||
return {
|
||||
...compilerOptions,
|
||||
module: moduleKind,
|
||||
esModuleInterop,
|
||||
moduleResolution,
|
||||
/**
|
||||
* This option is only supported in `Node16`/`NodeNext` and `Bundler` module, see https://www.typescriptlang.org/tsconfig/#customConditions
|
||||
*/
|
||||
customConditions: undefined,
|
||||
};
|
||||
}
|
||||
getCompiledOutput(fileContent, fileName, options) {
|
||||
const isEsmMode = this.configSet.useESM && options.supportsStaticESM;
|
||||
this._compilerOptions = this.fixupCompilerOptionsForModuleKind(this._initialCompilerOptions, isEsmMode);
|
||||
if (!this._initialCompilerOptions.isolatedModules && (0, transpile_module_1.isModernNodeModuleKind)(this._initialCompilerOptions.module)) {
|
||||
this._logger.warn("Using hybrid module kind (Node16/18/Next) is only supported in \"isolatedModules: true\". Please set \"isolatedModules: true\" in your tsconfig.json." /* Helps.UsingModernNodeResolution */);
|
||||
}
|
||||
const moduleKind = this._initialCompilerOptions.module;
|
||||
const currentModuleKind = this._compilerOptions.module;
|
||||
if (this._languageService) {
|
||||
if (constants_1.JS_JSX_REGEX.test(fileName) && !this._compilerOptions.allowJs) {
|
||||
this._logger.warn({ fileName: fileName }, (0, 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" /* Errors.GotJsFileButAllowJsFalse */, { path: fileName }));
|
||||
return {
|
||||
code: fileContent,
|
||||
};
|
||||
}
|
||||
this._logger.debug({ fileName }, 'getCompiledOutput(): compiling using language service');
|
||||
// Must set memory cache before attempting to compile
|
||||
this._updateMemoryCache(fileContent, fileName, currentModuleKind === moduleKind);
|
||||
const output = this._languageService.getEmitOutput(fileName);
|
||||
const diagnostics = this.getDiagnostics(fileName);
|
||||
if (!isEsmMode && diagnostics.length) {
|
||||
this.configSet.raiseDiagnostics(diagnostics, fileName, this._logger);
|
||||
if (options.watchMode) {
|
||||
this._logger.debug({ fileName }, '_doTypeChecking(): starting watch mode computing diagnostics');
|
||||
for (const entry of options.depGraphs.entries()) {
|
||||
const normalizedModuleNames = entry[1].resolvedModuleNames.map((moduleName) => (0, path_1.normalize)(moduleName));
|
||||
const fileToReTypeCheck = entry[0];
|
||||
if (normalizedModuleNames.includes(fileName) && this.configSet.shouldReportDiagnostics(fileToReTypeCheck)) {
|
||||
this._logger.debug({ fileToReTypeCheck }, '_doTypeChecking(): computing diagnostics using language service');
|
||||
this._updateMemoryCache(this._getFileContentFromCache(fileToReTypeCheck), fileToReTypeCheck);
|
||||
const importedModulesDiagnostics = [
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
...this._languageService.getSemanticDiagnostics(fileToReTypeCheck),
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
...this._languageService.getSyntacticDiagnostics(fileToReTypeCheck),
|
||||
];
|
||||
// will raise or just warn diagnostics depending on config
|
||||
this.configSet.raiseDiagnostics(importedModulesDiagnostics, fileName, this._logger);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (output.emitSkipped) {
|
||||
if (constants_1.TS_TSX_REGEX.test(fileName)) {
|
||||
throw new Error((0, 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}}" /* Errors.CannotProcessFile */, { file: fileName }));
|
||||
}
|
||||
else {
|
||||
this._logger.warn((0, 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 `'.'`" /* Errors.CannotProcessFileReturnOriginal */, { file: fileName }));
|
||||
return {
|
||||
code: fileContent,
|
||||
};
|
||||
}
|
||||
}
|
||||
// Throw an error when requiring `.d.ts` files.
|
||||
if (!output.outputFiles.length) {
|
||||
throw new TypeError((0, 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}}`." /* Errors.UnableToRequireDefinitionFile */, {
|
||||
file: (0, path_1.basename)(fileName),
|
||||
}));
|
||||
}
|
||||
const { outputFiles } = output;
|
||||
return this._compilerOptions.sourceMap
|
||||
? {
|
||||
code: (0, compiler_utils_1.updateOutput)(outputFiles[1].text, fileName, outputFiles[0].text),
|
||||
diagnostics,
|
||||
}
|
||||
: {
|
||||
code: (0, compiler_utils_1.updateOutput)(outputFiles[0].text, fileName),
|
||||
diagnostics,
|
||||
};
|
||||
}
|
||||
else {
|
||||
this._logger.debug({ fileName }, 'getCompiledOutput(): compiling as isolated module');
|
||||
assertCompilerOptionsWithJestTransformMode(this._initialCompilerOptions, isEsmMode, this._logger);
|
||||
const result = this._transpileOutput(fileContent, fileName);
|
||||
if (result.diagnostics && this.configSet.shouldReportDiagnostics(fileName)) {
|
||||
this.configSet.raiseDiagnostics(result.diagnostics, fileName, this._logger);
|
||||
}
|
||||
return {
|
||||
code: (0, compiler_utils_1.updateOutput)(result.outputText, fileName, result.sourceMapText),
|
||||
};
|
||||
}
|
||||
}
|
||||
_transpileOutput(fileContent, fileName) {
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* This code path should be removed in the next major version to benefit from checking on compiler options
|
||||
*/
|
||||
if (!(0, transpile_module_1.isModernNodeModuleKind)(this._initialCompilerOptions.module)) {
|
||||
return this._ts.transpileModule(fileContent, {
|
||||
fileName,
|
||||
transformers: this._makeTransformers(this.configSet.resolvedTransformers),
|
||||
compilerOptions: this._compilerOptions,
|
||||
reportDiagnostics: this.configSet.shouldReportDiagnostics(fileName),
|
||||
});
|
||||
}
|
||||
return (0, transpile_module_1.tsTranspileModule)(fileContent, {
|
||||
fileName,
|
||||
transformers: (program) => {
|
||||
this.program = program;
|
||||
return this._makeTransformers(this.configSet.resolvedTransformers);
|
||||
},
|
||||
compilerOptions: this._initialCompilerOptions,
|
||||
reportDiagnostics: fileName ? this.configSet.shouldReportDiagnostics(fileName) : false,
|
||||
});
|
||||
}
|
||||
_makeTransformers(customTransformers) {
|
||||
return {
|
||||
before: customTransformers.before.map((beforeTransformer) => beforeTransformer.factory(this, beforeTransformer.options)),
|
||||
after: customTransformers.after.map((afterTransformer) => afterTransformer.factory(this, afterTransformer.options)),
|
||||
afterDeclarations: customTransformers.afterDeclarations.map((afterDeclarations) => afterDeclarations.factory(this, afterDeclarations.options)),
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_createLanguageService() {
|
||||
// Initialize memory cache for typescript compiler
|
||||
this._parsedTsConfig.fileNames
|
||||
.filter((fileName) => constants_1.TS_TSX_REGEX.test(fileName) && !this.configSet.isTestFile(fileName))
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
.forEach((fileName) => this._fileVersionCache.set(fileName, 0));
|
||||
/* istanbul ignore next */
|
||||
const serviceHost = {
|
||||
useCaseSensitiveFileNames: () => this._ts.sys.useCaseSensitiveFileNames,
|
||||
getProjectVersion: () => String(this._projectVersion),
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
getScriptFileNames: () => [...this._fileVersionCache.keys()],
|
||||
getScriptVersion: (fileName) => {
|
||||
const normalizedFileName = (0, path_1.normalize)(fileName);
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const version = this._fileVersionCache.get(normalizedFileName);
|
||||
// We need to return `undefined` and not a string here because TypeScript will use
|
||||
// `getScriptVersion` and compare against their own version - which can be `undefined`.
|
||||
// If we don't return `undefined` it results in `undefined === "undefined"` and run
|
||||
// `createProgram` again (which is very slow). Using a `string` assertion here to avoid
|
||||
// TypeScript errors from the function signature (expects `(x: string) => string`).
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return version === undefined ? undefined : String(version);
|
||||
},
|
||||
getScriptSnapshot: (fileName) => {
|
||||
const normalizedFileName = (0, path_1.normalize)(fileName);
|
||||
const hit = this._isFileInCache(normalizedFileName);
|
||||
this._logger.trace({ normalizedFileName, cacheHit: hit }, 'getScriptSnapshot():', 'cache', hit ? 'hit' : 'miss');
|
||||
// Read file content from either memory cache or Jest runtime cache or fallback to file system read
|
||||
if (!hit) {
|
||||
const fileContent =
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
this._fileContentCache.get(normalizedFileName) ??
|
||||
this._runtimeCacheFS.get(normalizedFileName) ??
|
||||
this._cachedReadFile?.(normalizedFileName) ??
|
||||
undefined;
|
||||
if (fileContent !== undefined) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
this._fileContentCache.set(normalizedFileName, fileContent);
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
this._fileVersionCache.set(normalizedFileName, 1);
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const contents = this._fileContentCache.get(normalizedFileName);
|
||||
if (contents === undefined)
|
||||
return;
|
||||
return this._ts.ScriptSnapshot.fromString(contents);
|
||||
},
|
||||
fileExists: (0, lodash_memoize_1.default)(this._ts.sys.fileExists),
|
||||
readFile: this._cachedReadFile ?? this._ts.sys.readFile,
|
||||
readDirectory: (0, lodash_memoize_1.default)(this._ts.sys.readDirectory),
|
||||
getDirectories: (0, lodash_memoize_1.default)(this._ts.sys.getDirectories),
|
||||
directoryExists: (0, lodash_memoize_1.default)(this._ts.sys.directoryExists),
|
||||
realpath: this._ts.sys.realpath && (0, lodash_memoize_1.default)(this._ts.sys.realpath),
|
||||
getNewLine: () => constants_1.LINE_FEED,
|
||||
getCurrentDirectory: () => this.configSet.cwd,
|
||||
getCompilationSettings: () => this._compilerOptions,
|
||||
getDefaultLibFileName: () => this._ts.getDefaultLibFilePath(this._compilerOptions),
|
||||
getCustomTransformers: () => this._makeTransformers(this.configSet.resolvedTransformers),
|
||||
resolveModuleNames: (moduleNames, containingFile) => moduleNames.map((moduleName) => this._resolveModuleName(moduleName, containingFile).resolvedModule),
|
||||
};
|
||||
this._logger.debug('created language service');
|
||||
this._languageService = this._ts.createLanguageService(serviceHost, this._ts.createDocumentRegistry(this._ts.sys.useCaseSensitiveFileNames, this.configSet.cwd));
|
||||
this.program = this._languageService.getProgram();
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_getFileContentFromCache(filePath) {
|
||||
const normalizedFilePath = (0, path_1.normalize)(filePath);
|
||||
let resolvedFileContent = this._runtimeCacheFS.get(normalizedFilePath);
|
||||
if (!resolvedFileContent) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
resolvedFileContent = this._moduleResolutionHost.readFile(normalizedFilePath);
|
||||
this._runtimeCacheFS.set(normalizedFilePath, resolvedFileContent);
|
||||
}
|
||||
return resolvedFileContent;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_getImportedModulePaths(resolvedFileContent, containingFile) {
|
||||
return this._ts
|
||||
.preProcessFile(resolvedFileContent, true, true)
|
||||
.importedFiles.map((importedFile) => {
|
||||
const { resolvedModule } = this._resolveModuleName(importedFile.fileName, containingFile);
|
||||
/* istanbul ignore next already covered */
|
||||
const resolvedFileName = resolvedModule?.resolvedFileName;
|
||||
/* istanbul ignore next already covered */
|
||||
return resolvedFileName && !resolvedModule?.isExternalLibraryImport ? resolvedFileName : '';
|
||||
})
|
||||
.filter((resolveFileName) => !!resolveFileName);
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_resolveModuleName(moduleNameToResolve, containingFile) {
|
||||
return this._ts.resolveModuleName(moduleNameToResolve, containingFile, this._compilerOptions,
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
this._moduleResolutionHost,
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
this._moduleResolutionCache);
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_isFileInCache(fileName) {
|
||||
return (
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
this._fileContentCache.has(fileName) &&
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
this._fileVersionCache.has(fileName) &&
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
this._fileVersionCache.get(fileName) !== 0);
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_updateMemoryCache(contents, fileName, isModuleKindTheSame = true) {
|
||||
this._logger.debug({ fileName }, 'updateMemoryCache: update memory cache for language service');
|
||||
let shouldIncrementProjectVersion = false;
|
||||
const hit = this._isFileInCache(fileName);
|
||||
if (!hit) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
this._fileVersionCache.set(fileName, 1);
|
||||
shouldIncrementProjectVersion = true;
|
||||
}
|
||||
else {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const prevVersion = this._fileVersionCache.get(fileName);
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const previousContents = this._fileContentCache.get(fileName);
|
||||
// Avoid incrementing cache when nothing has changed.
|
||||
if (previousContents !== contents) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
this._fileVersionCache.set(fileName, prevVersion + 1);
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
this._fileContentCache.set(fileName, contents);
|
||||
shouldIncrementProjectVersion = true;
|
||||
}
|
||||
/**
|
||||
* When a file is from node_modules or referenced to a referenced project and jest wants to transform it, we need
|
||||
* to make sure that the Program is updated with this information
|
||||
*/
|
||||
if (!this._parsedTsConfig.fileNames.includes(fileName) || !isModuleKindTheSame) {
|
||||
shouldIncrementProjectVersion = true;
|
||||
}
|
||||
}
|
||||
if (shouldIncrementProjectVersion)
|
||||
this._projectVersion++;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
getDiagnostics(fileName) {
|
||||
const diagnostics = [];
|
||||
if (this.configSet.shouldReportDiagnostics(fileName)) {
|
||||
this._logger.debug({ fileName }, '_doTypeChecking(): computing diagnostics using language service');
|
||||
// Get the relevant diagnostics - this is 3x faster than `getPreEmitDiagnostics`.
|
||||
diagnostics.push(
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
...this._languageService.getSemanticDiagnostics(fileName),
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
...this._languageService.getSyntacticDiagnostics(fileName));
|
||||
}
|
||||
return diagnostics;
|
||||
}
|
||||
}
|
||||
exports.TsCompiler = TsCompiler;
|
||||
8
frontend/node_modules/ts-jest/dist/legacy/compiler/ts-jest-compiler.d.ts
generated
vendored
Normal file
8
frontend/node_modules/ts-jest/dist/legacy/compiler/ts-jest-compiler.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { CompilerInstance, CompiledOutput, StringMap, TsJestCompileOptions } from '../../types';
|
||||
import type { ConfigSet } from '../config/config-set';
|
||||
export declare class TsJestCompiler implements CompilerInstance {
|
||||
private readonly _compilerInstance;
|
||||
constructor(configSet: ConfigSet, runtimeCacheFS: StringMap);
|
||||
getResolvedModules(fileContent: string, fileName: string, runtimeCacheFS: StringMap): string[];
|
||||
getCompiledOutput(fileContent: string, fileName: string, options: TsJestCompileOptions): CompiledOutput;
|
||||
}
|
||||
18
frontend/node_modules/ts-jest/dist/legacy/compiler/ts-jest-compiler.js
generated
vendored
Normal file
18
frontend/node_modules/ts-jest/dist/legacy/compiler/ts-jest-compiler.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TsJestCompiler = void 0;
|
||||
const ts_compiler_1 = require("./ts-compiler");
|
||||
class TsJestCompiler {
|
||||
_compilerInstance;
|
||||
constructor(configSet, runtimeCacheFS) {
|
||||
// Later we can add swc/esbuild or other typescript compiler instance here
|
||||
this._compilerInstance = new ts_compiler_1.TsCompiler(configSet, runtimeCacheFS);
|
||||
}
|
||||
getResolvedModules(fileContent, fileName, runtimeCacheFS) {
|
||||
return this._compilerInstance.getResolvedModules(fileContent, fileName, runtimeCacheFS);
|
||||
}
|
||||
getCompiledOutput(fileContent, fileName, options) {
|
||||
return this._compilerInstance.getCompiledOutput(fileContent, fileName, options);
|
||||
}
|
||||
}
|
||||
exports.TsJestCompiler = TsJestCompiler;
|
||||
36
frontend/node_modules/ts-jest/dist/legacy/config/config-set.d.ts
generated
vendored
Normal file
36
frontend/node_modules/ts-jest/dist/legacy/config/config-set.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Logger } from 'bs-logger';
|
||||
import type * as ts from 'typescript';
|
||||
import type { TsConfigCompilerOptionsJson } from '../../config/types';
|
||||
import type { RawCompilerOptions } from '../../raw-compiler-options';
|
||||
import type { TsJestAstTransformer, TsJestTransformOptions, TTypeScript } from '../../types';
|
||||
export declare class ConfigSet {
|
||||
readonly parentLogger?: Logger | undefined;
|
||||
/**
|
||||
* Use by e2e, don't mark as internal
|
||||
*/
|
||||
readonly tsJestDigest: string;
|
||||
readonly logger: Logger;
|
||||
readonly compilerModule: TTypeScript;
|
||||
readonly isolatedModules: boolean;
|
||||
readonly cwd: string;
|
||||
readonly rootDir: string;
|
||||
cacheSuffix: string;
|
||||
tsCacheDir: string | undefined;
|
||||
parsedTsConfig: ts.ParsedCommandLine | Record<string, any>;
|
||||
resolvedTransformers: TsJestAstTransformer;
|
||||
useESM: boolean;
|
||||
constructor(jestConfig: TsJestTransformOptions['config'] | undefined, parentLogger?: Logger | undefined);
|
||||
/**
|
||||
* Load TypeScript configuration. Returns the parsed TypeScript config and any `tsconfig` options specified in ts-jest
|
||||
* Subclasses which extend `ConfigSet` can override the default behavior
|
||||
*/
|
||||
protected _resolveTsConfig(compilerOptions?: RawCompilerOptions | TsConfigCompilerOptionsJson, resolvedConfigFile?: string): Record<string, any>;
|
||||
isTestFile(fileName: string): boolean;
|
||||
shouldStringifyContent(filePath: string): boolean;
|
||||
raiseDiagnostics(diagnostics: ts.Diagnostic[], filePath?: string, logger?: Logger): void;
|
||||
shouldReportDiagnostics(filePath: string): boolean;
|
||||
resolvePath(inputPath: string, { throwIfMissing, nodeResolve }?: {
|
||||
throwIfMissing?: boolean;
|
||||
nodeResolve?: boolean;
|
||||
}): string;
|
||||
}
|
||||
622
frontend/node_modules/ts-jest/dist/legacy/config/config-set.js
generated
vendored
Normal file
622
frontend/node_modules/ts-jest/dist/legacy/config/config-set.js
generated
vendored
Normal file
@@ -0,0 +1,622 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (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 () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ConfigSet = exports.TS_JEST_OUT_DIR = exports.IGNORE_DIAGNOSTIC_CODES = exports.MY_DIGEST = void 0;
|
||||
/**
|
||||
* This is the core of settings and so ts-jest.
|
||||
* Since configuration are used to create a good cache key, everything
|
||||
* depending on it is here. Fast jest relies on correct cache keys
|
||||
* depending on all settings that could affect the generated output.
|
||||
*
|
||||
* The big issue is that jest calls first `getCacheKey()` with stringified
|
||||
* version of the `jest.ProjectConfig`, and then later it calls `process()`
|
||||
* with the complete, object version of it.
|
||||
*/
|
||||
const fs_1 = require("fs");
|
||||
const module_1 = __importDefault(require("module"));
|
||||
const path_1 = require("path");
|
||||
const bs_logger_1 = require("bs-logger");
|
||||
const jest_util_1 = require("jest-util");
|
||||
const json5_1 = __importDefault(require("json5"));
|
||||
const constants_1 = require("../../constants");
|
||||
const hoistJestTransformer = __importStar(require("../../transformers/hoist-jest"));
|
||||
const utils_1 = require("../../utils");
|
||||
const backports_1 = require("../../utils/backports");
|
||||
const importer_1 = require("../../utils/importer");
|
||||
const messages_1 = require("../../utils/messages");
|
||||
const normalize_slashes_1 = require("../../utils/normalize-slashes");
|
||||
const sha1_1 = require("../../utils/sha1");
|
||||
const ts_error_1 = require("../../utils/ts-error");
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
exports.MY_DIGEST = (0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '../../../.ts-jest-digest'), 'utf8');
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
exports.IGNORE_DIAGNOSTIC_CODES = [
|
||||
6059, // "'rootDir' is expected to contain all source files."
|
||||
18002, // "The 'files' list in config file is empty."
|
||||
18003, // "No inputs were found in config file."
|
||||
];
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
exports.TS_JEST_OUT_DIR = '$$ts-jest$$';
|
||||
const normalizeRegex = (pattern) => pattern ? (typeof pattern === 'string' ? pattern : pattern.source) : undefined;
|
||||
const toDiagnosticCode = (code) => code ? parseInt(`${code}`.trim().replace(/^TS/, ''), 10) ?? undefined : undefined;
|
||||
const toDiagnosticCodeList = (items, into = []) => {
|
||||
for (let item of items) {
|
||||
if (typeof item === 'string') {
|
||||
const children = item.trim().split(/\s*,\s*/g);
|
||||
if (children.length > 1) {
|
||||
toDiagnosticCodeList(children, into);
|
||||
continue;
|
||||
}
|
||||
item = children[0];
|
||||
}
|
||||
if (!item)
|
||||
continue;
|
||||
const code = toDiagnosticCode(item);
|
||||
if (code && !into.includes(code))
|
||||
into.push(code);
|
||||
}
|
||||
return into;
|
||||
};
|
||||
const requireFromString = (code, fileName) => {
|
||||
// @ts-expect-error `_nodeModulePaths` is not exposed in typing
|
||||
const paths = module_1.default._nodeModulePaths((0, path_1.dirname)(fileName));
|
||||
const parent = module.parent;
|
||||
const m = new module_1.default(fileName, parent);
|
||||
m.filename = fileName;
|
||||
m.paths = [].concat(paths);
|
||||
// @ts-expect-error `_compile` is not exposed in typing
|
||||
m._compile(code, fileName);
|
||||
const exports = m.exports;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
||||
parent && parent.children && parent.children.splice(parent.children.indexOf(m), 1);
|
||||
return exports;
|
||||
};
|
||||
class ConfigSet {
|
||||
parentLogger;
|
||||
/**
|
||||
* Use by e2e, don't mark as internal
|
||||
*/
|
||||
tsJestDigest = exports.MY_DIGEST;
|
||||
logger;
|
||||
compilerModule;
|
||||
isolatedModules;
|
||||
cwd;
|
||||
rootDir;
|
||||
cacheSuffix;
|
||||
tsCacheDir;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
parsedTsConfig;
|
||||
resolvedTransformers = {
|
||||
before: [],
|
||||
after: [],
|
||||
afterDeclarations: [],
|
||||
};
|
||||
useESM = false;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
babelConfig;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
babelJestTransformer;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_jestCfg;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_diagnostics;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_stringifyContentRegExp;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_matchablePatterns;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_matchTestFilePath;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_shouldIgnoreDiagnosticsForFile;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_overriddenCompilerOptions = {
|
||||
inlineSourceMap: false,
|
||||
declaration: false, // we don't want to create declaration files
|
||||
isolatedDeclarations: false, // we don't want to create declaration files
|
||||
noEmit: false, // set to true will make compiler API not emit any compiled results.
|
||||
// else istanbul related will be dropped
|
||||
removeComments: false,
|
||||
// to clear out else it's buggy
|
||||
out: undefined,
|
||||
outFile: undefined,
|
||||
composite: undefined, // see https://github.com/TypeStrong/ts-node/pull/657/files
|
||||
declarationDir: undefined,
|
||||
declarationMap: undefined,
|
||||
emitDeclarationOnly: undefined,
|
||||
sourceRoot: undefined,
|
||||
tsBuildInfoFile: undefined,
|
||||
rewriteRelativeImportExtensions: false,
|
||||
};
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
tsconfigFilePath;
|
||||
constructor(jestConfig, parentLogger) {
|
||||
this.parentLogger = parentLogger;
|
||||
this.logger = this.parentLogger
|
||||
? this.parentLogger.child({ [bs_logger_1.LogContexts.namespace]: 'config' })
|
||||
: utils_1.rootLogger.child({ namespace: 'config' });
|
||||
this._backportJestCfg(jestConfig ?? Object.create(null));
|
||||
this.cwd = (0, path_1.normalize)(this._jestCfg.cwd ?? process.cwd());
|
||||
this.rootDir = (0, path_1.normalize)(this._jestCfg.rootDir ?? this.cwd);
|
||||
const tsJestCfg = this._jestCfg.globals && this._jestCfg.globals['ts-jest'];
|
||||
const options = tsJestCfg ?? Object.create(null);
|
||||
// compiler module
|
||||
this.compilerModule = importer_1.importer.typescript("Using \"ts-jest\" requires this package to be installed." /* ImportReasons.TsJest */, options.compiler ?? 'typescript');
|
||||
this.logger.debug({ compilerModule: this.compilerModule }, 'normalized compiler module config via ts-jest option');
|
||||
this._setupConfigSet(options);
|
||||
this._matchablePatterns = [...this._jestCfg.testMatch, ...this._jestCfg.testRegex].filter((pattern) =>
|
||||
/**
|
||||
* jest config testRegex doesn't always deliver the correct RegExp object
|
||||
* See https://github.com/facebook/jest/issues/9778
|
||||
*/
|
||||
pattern instanceof RegExp || typeof pattern === 'string');
|
||||
if (!this._matchablePatterns.length) {
|
||||
this._matchablePatterns.push(...constants_1.DEFAULT_JEST_TEST_MATCH);
|
||||
}
|
||||
this._matchTestFilePath = (0, jest_util_1.globsToMatcher)(this._matchablePatterns.filter((pattern) => typeof pattern === 'string'));
|
||||
// isolatedModules
|
||||
if (options.isolatedModules) {
|
||||
this.parsedTsConfig.options.isolatedModules = true;
|
||||
if (this.tsconfigFilePath) {
|
||||
this.logger.warn((0, messages_1.interpolate)("\n The \"ts-jest\" config option \"isolatedModules\" is deprecated and will be removed in v30.0.0. Please use \"isolatedModules: true\" in {{tsconfigFilePath}} instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules\n " /* Deprecations.IsolatedModulesWithTsconfigPath */, {
|
||||
tsconfigFilePath: this.tsconfigFilePath,
|
||||
}));
|
||||
}
|
||||
else {
|
||||
this.logger.warn("\n The \"ts-jest\" config option \"isolatedModules\" is deprecated and will be removed in v30.0.0. Please use \"isolatedModules: true\", see https://www.typescriptlang.org/tsconfig/#isolatedModules\n " /* Deprecations.IsolatedModulesWithoutTsconfigPath */);
|
||||
}
|
||||
}
|
||||
this.isolatedModules = this.parsedTsConfig.options.isolatedModules ?? false;
|
||||
this._resolveTsCacheDir();
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_backportJestCfg(jestCfg) {
|
||||
const config = (0, backports_1.backportJestConfig)(this.logger, jestCfg);
|
||||
this.logger.debug({ jestConfig: config }, 'normalized jest config');
|
||||
this._jestCfg = {
|
||||
...config,
|
||||
testMatch: config.testMatch ?? constants_1.DEFAULT_JEST_TEST_MATCH,
|
||||
testRegex: config.testRegex ?? [],
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_setupConfigSet(options) {
|
||||
// useESM
|
||||
this.useESM = options.useESM ?? false;
|
||||
// babel config (for babel-jest) default is undefined so we don't need to have fallback like tsConfig
|
||||
if (!options.babelConfig) {
|
||||
this.logger.debug('babel is disabled');
|
||||
}
|
||||
else {
|
||||
const baseBabelCfg = { cwd: this.cwd };
|
||||
if (typeof options.babelConfig === 'string') {
|
||||
const babelCfgPath = this.resolvePath(options.babelConfig);
|
||||
const babelFileExtName = (0, path_1.extname)(options.babelConfig);
|
||||
if (babelFileExtName === '.js' || babelFileExtName === '.cjs') {
|
||||
this.babelConfig = {
|
||||
...baseBabelCfg,
|
||||
...require(babelCfgPath),
|
||||
};
|
||||
}
|
||||
else {
|
||||
this.babelConfig = {
|
||||
...baseBabelCfg,
|
||||
...json5_1.default.parse((0, fs_1.readFileSync)(babelCfgPath, 'utf-8')),
|
||||
};
|
||||
}
|
||||
}
|
||||
else if (typeof options.babelConfig === 'object') {
|
||||
this.babelConfig = {
|
||||
...baseBabelCfg,
|
||||
...options.babelConfig,
|
||||
};
|
||||
}
|
||||
else {
|
||||
this.babelConfig = baseBabelCfg;
|
||||
}
|
||||
this.logger.debug({ babelConfig: this.babelConfig }, 'normalized babel config via ts-jest option');
|
||||
this.babelJestTransformer = importer_1.importer
|
||||
.babelJest("Using \"babel-jest\" requires this package to be installed." /* ImportReasons.BabelJest */)
|
||||
.createTransformer(this.babelConfig);
|
||||
this.logger.debug('created babel-jest transformer');
|
||||
}
|
||||
// diagnostics
|
||||
const diagnosticsOpt = options.diagnostics ?? true;
|
||||
const ignoreList = [...exports.IGNORE_DIAGNOSTIC_CODES];
|
||||
if (typeof diagnosticsOpt === 'object') {
|
||||
const { ignoreCodes } = diagnosticsOpt;
|
||||
if (ignoreCodes) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
||||
Array.isArray(ignoreCodes) ? ignoreList.push(...ignoreCodes) : ignoreList.push(ignoreCodes);
|
||||
}
|
||||
this._diagnostics = {
|
||||
pretty: diagnosticsOpt.pretty ?? true,
|
||||
exclude: diagnosticsOpt.exclude ?? [],
|
||||
ignoreCodes: toDiagnosticCodeList(ignoreList),
|
||||
throws: !diagnosticsOpt.warnOnly,
|
||||
};
|
||||
}
|
||||
else {
|
||||
this._diagnostics = {
|
||||
ignoreCodes: diagnosticsOpt ? toDiagnosticCodeList(ignoreList) : [],
|
||||
exclude: [],
|
||||
pretty: true,
|
||||
throws: diagnosticsOpt,
|
||||
};
|
||||
}
|
||||
if (diagnosticsOpt) {
|
||||
this._shouldIgnoreDiagnosticsForFile = this._diagnostics.exclude.length
|
||||
? (0, jest_util_1.globsToMatcher)(this._diagnostics.exclude)
|
||||
: () => false;
|
||||
}
|
||||
else {
|
||||
this._shouldIgnoreDiagnosticsForFile = () => true;
|
||||
}
|
||||
this.logger.debug({ diagnostics: this._diagnostics }, 'normalized diagnostics config via ts-jest option');
|
||||
// tsconfig
|
||||
const tsconfigOpt = options.tsconfig;
|
||||
const configFilePath = typeof tsconfigOpt === 'string' ? this.resolvePath(tsconfigOpt) : undefined;
|
||||
this.parsedTsConfig = this._getAndResolveTsConfig(typeof tsconfigOpt === 'object' ? tsconfigOpt : undefined, configFilePath);
|
||||
// throw errors if any matching wanted diagnostics
|
||||
this.raiseDiagnostics(this.parsedTsConfig.errors, configFilePath);
|
||||
this.logger.debug({ tsconfig: this.parsedTsConfig }, 'normalized typescript config via ts-jest option');
|
||||
// transformers
|
||||
this.resolvedTransformers.before = [
|
||||
{
|
||||
factory: hoistJestTransformer.factory,
|
||||
name: hoistJestTransformer.name,
|
||||
version: hoistJestTransformer.version,
|
||||
},
|
||||
];
|
||||
const { astTransformers } = options;
|
||||
if (astTransformers) {
|
||||
const resolveTransformerFunc = (transformerPath) => {
|
||||
let transformerFunc;
|
||||
if ((0, path_1.extname)(transformerPath) === '.ts') {
|
||||
const compiledTransformer = importer_1.importer
|
||||
.esBuild("Using \"esbuild\" requires this package to be installed." /* ImportReasons.EsBuild */)
|
||||
.transformSync((0, fs_1.readFileSync)(transformerPath, 'utf-8'), {
|
||||
loader: 'ts',
|
||||
format: 'cjs',
|
||||
target: 'es2015',
|
||||
}).code;
|
||||
transformerFunc = requireFromString(compiledTransformer, transformerPath.replace('.ts', '.js'));
|
||||
}
|
||||
else {
|
||||
transformerFunc = require(transformerPath);
|
||||
}
|
||||
if (!transformerFunc.version) {
|
||||
this.logger.warn("The AST transformer {{file}} must have an `export const version = <your_transformer_version>`" /* Errors.MissingTransformerVersion */, { file: transformerPath });
|
||||
}
|
||||
if (!transformerFunc.name) {
|
||||
this.logger.warn("The AST transformer {{file}} must have an `export const name = <your_transformer_name>`" /* Errors.MissingTransformerName */, { file: transformerPath });
|
||||
}
|
||||
return transformerFunc;
|
||||
};
|
||||
const resolveTransformers = (transformers) => transformers.map((transformer) => {
|
||||
if (typeof transformer === 'string') {
|
||||
return resolveTransformerFunc(this.resolvePath(transformer, { nodeResolve: true }));
|
||||
}
|
||||
else {
|
||||
return {
|
||||
...resolveTransformerFunc(this.resolvePath(transformer.path, { nodeResolve: true })),
|
||||
options: transformer.options,
|
||||
};
|
||||
}
|
||||
});
|
||||
if (astTransformers.before) {
|
||||
/* istanbul ignore next (already covered in unit test) */
|
||||
this.resolvedTransformers.before?.push(...resolveTransformers(astTransformers.before));
|
||||
}
|
||||
if (astTransformers.after) {
|
||||
this.resolvedTransformers = {
|
||||
...this.resolvedTransformers,
|
||||
after: resolveTransformers(astTransformers.after),
|
||||
};
|
||||
}
|
||||
if (astTransformers.afterDeclarations) {
|
||||
this.resolvedTransformers = {
|
||||
...this.resolvedTransformers,
|
||||
afterDeclarations: resolveTransformers(astTransformers.afterDeclarations),
|
||||
};
|
||||
}
|
||||
}
|
||||
this.logger.debug({ customTransformers: this.resolvedTransformers }, 'normalized custom AST transformers via ts-jest option');
|
||||
// stringifyContentPathRegex
|
||||
if (options.stringifyContentPathRegex) {
|
||||
this._stringifyContentRegExp =
|
||||
typeof options.stringifyContentPathRegex === 'string'
|
||||
? new RegExp(normalizeRegex(options.stringifyContentPathRegex)) // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
||||
: options.stringifyContentPathRegex;
|
||||
this.logger.debug({ stringifyContentPathRegex: this._stringifyContentRegExp }, 'normalized stringifyContentPathRegex config via ts-jest option');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_resolveTsCacheDir() {
|
||||
this.cacheSuffix = (0, sha1_1.sha1)((0, utils_1.stringify)({
|
||||
version: this.compilerModule.version,
|
||||
digest: this.tsJestDigest,
|
||||
babelConfig: this.babelConfig,
|
||||
tsconfig: {
|
||||
options: this.parsedTsConfig.options,
|
||||
raw: this.parsedTsConfig.raw,
|
||||
},
|
||||
isolatedModules: this.isolatedModules,
|
||||
diagnostics: this._diagnostics,
|
||||
transformers: Object.values(this.resolvedTransformers)
|
||||
.reduce((prevVal, currentVal) => [...prevVal, currentVal])
|
||||
.map((transformer) => `${transformer.name}-${transformer.version}`),
|
||||
}));
|
||||
if (!this._jestCfg.cache) {
|
||||
this.logger.debug('file caching disabled');
|
||||
}
|
||||
else {
|
||||
const res = (0, path_1.join)(this._jestCfg.cacheDirectory, 'ts-jest', this.cacheSuffix.substr(0, 2), this.cacheSuffix.substr(2));
|
||||
this.logger.debug({ cacheDirectory: res }, 'will use file caching');
|
||||
this.tsCacheDir = res;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_getAndResolveTsConfig(compilerOptions, resolvedConfigFile) {
|
||||
const result = this._resolveTsConfig(compilerOptions, resolvedConfigFile);
|
||||
const { _overriddenCompilerOptions: forcedOptions } = this;
|
||||
const finalOptions = result.options;
|
||||
// Target ES2015 output by default (instead of ES3).
|
||||
if (finalOptions.target === undefined) {
|
||||
finalOptions.target = this.compilerModule.ScriptTarget.ES2015;
|
||||
}
|
||||
// check the module interoperability
|
||||
const target = finalOptions.target;
|
||||
// compute the default if not set
|
||||
const defaultModule = [this.compilerModule.ScriptTarget.ES3, this.compilerModule.ScriptTarget.ES5].includes(target)
|
||||
? this.compilerModule.ModuleKind.CommonJS
|
||||
: this.compilerModule.ModuleKind.ESNext;
|
||||
const moduleValue = finalOptions.module ?? defaultModule;
|
||||
const warningModulesForEsmInterop = [
|
||||
this.compilerModule.ModuleKind.CommonJS,
|
||||
this.compilerModule.ModuleKind.Node16,
|
||||
this.compilerModule.ModuleKind.NodeNext,
|
||||
];
|
||||
if (!this.babelConfig &&
|
||||
!warningModulesForEsmInterop.includes(moduleValue) &&
|
||||
!(finalOptions.esModuleInterop || finalOptions.allowSyntheticDefaultImports)) {
|
||||
result.errors.push({
|
||||
code: messages_1.TsJestDiagnosticCodes.ConfigModuleOption,
|
||||
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." /* Errors.ConfigNoModuleInterop */,
|
||||
category: this.compilerModule.DiagnosticCategory.Message,
|
||||
file: undefined,
|
||||
start: undefined,
|
||||
length: undefined,
|
||||
});
|
||||
}
|
||||
// Make sure when allowJs is enabled, outDir is required to have when using allowJs: true
|
||||
if (finalOptions.allowJs && !finalOptions.outDir) {
|
||||
finalOptions.outDir = exports.TS_JEST_OUT_DIR;
|
||||
}
|
||||
// ensure undefined are removed and other values are overridden
|
||||
for (const key of Object.keys(forcedOptions)) {
|
||||
const val = forcedOptions[key];
|
||||
if (val === undefined) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete finalOptions[key];
|
||||
}
|
||||
else {
|
||||
finalOptions[key] = val;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* See https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping
|
||||
* Every time this page is updated, we also need to update here. Here we only show warning message for Node LTS versions
|
||||
*/
|
||||
const nodeJsVer = process.version;
|
||||
const compilationTarget = result.options.target;
|
||||
const TARGET_TO_VERSION_MAPPING = {
|
||||
[this.compilerModule.ScriptTarget.ES2018]: 'es2018',
|
||||
[this.compilerModule.ScriptTarget.ES2019]: 'es2019',
|
||||
[this.compilerModule.ScriptTarget.ES2020]: 'es2020',
|
||||
[this.compilerModule.ScriptTarget.ESNext]: 'ESNext',
|
||||
};
|
||||
/* istanbul ignore next (cover by e2e) */
|
||||
if (compilationTarget &&
|
||||
!this.babelConfig &&
|
||||
nodeJsVer.startsWith('v12') &&
|
||||
compilationTarget > this.compilerModule.ScriptTarget.ES2019) {
|
||||
const message = (0, 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" /* Errors.MismatchNodeTargetMapping */, {
|
||||
nodeJsVer: process.version,
|
||||
compilationTarget: TARGET_TO_VERSION_MAPPING[compilationTarget],
|
||||
});
|
||||
this.logger.warn(message);
|
||||
}
|
||||
const resultOptions = result.options;
|
||||
const sourceMap = resultOptions.sourceMap ?? true;
|
||||
return {
|
||||
...result,
|
||||
options: {
|
||||
...resultOptions,
|
||||
sourceMap,
|
||||
inlineSources: sourceMap,
|
||||
module: resultOptions.module ?? this.compilerModule.ModuleKind.CommonJS,
|
||||
},
|
||||
};
|
||||
}
|
||||
_resolveTsConfig(compilerOptions, resolvedConfigFile) {
|
||||
let config = { compilerOptions: Object.create(null) };
|
||||
let basePath = (0, normalize_slashes_1.normalizeSlashes)(this.rootDir);
|
||||
const ts = this.compilerModule;
|
||||
// Read project configuration when available.
|
||||
this.tsconfigFilePath = resolvedConfigFile
|
||||
? (0, normalize_slashes_1.normalizeSlashes)(resolvedConfigFile)
|
||||
: ts.findConfigFile((0, normalize_slashes_1.normalizeSlashes)(this.rootDir), ts.sys.fileExists);
|
||||
if (this.tsconfigFilePath) {
|
||||
this.logger.debug({ tsConfigFileName: this.tsconfigFilePath }, 'readTsConfig(): reading', this.tsconfigFilePath);
|
||||
const result = ts.readConfigFile(this.tsconfigFilePath, ts.sys.readFile);
|
||||
// Return diagnostics.
|
||||
if (result.error) {
|
||||
return { errors: [result.error], fileNames: [], options: {} };
|
||||
}
|
||||
config = result.config;
|
||||
basePath = (0, normalize_slashes_1.normalizeSlashes)((0, path_1.dirname)(this.tsconfigFilePath));
|
||||
}
|
||||
// Override default configuration options `ts-jest` requires.
|
||||
config.compilerOptions = {
|
||||
...config.compilerOptions,
|
||||
...compilerOptions,
|
||||
};
|
||||
// parse json, merge config extending others, ...
|
||||
return ts.parseJsonConfigFileContent(config, ts.sys, basePath, undefined, this.tsconfigFilePath);
|
||||
}
|
||||
isTestFile(fileName) {
|
||||
return this._matchablePatterns.some((pattern) => typeof pattern === 'string' ? this._matchTestFilePath(fileName) : pattern.test(fileName));
|
||||
}
|
||||
shouldStringifyContent(filePath) {
|
||||
return this._stringifyContentRegExp ? this._stringifyContentRegExp.test(filePath) : false;
|
||||
}
|
||||
raiseDiagnostics(diagnostics, filePath, logger = this.logger) {
|
||||
const { ignoreCodes } = this._diagnostics;
|
||||
const { DiagnosticCategory } = this.compilerModule;
|
||||
const filteredDiagnostics = filePath && !this.shouldReportDiagnostics(filePath)
|
||||
? []
|
||||
: diagnostics.filter((diagnostic) => {
|
||||
if (diagnostic.file?.fileName && !this.shouldReportDiagnostics(diagnostic.file.fileName)) {
|
||||
return false;
|
||||
}
|
||||
return !ignoreCodes.includes(diagnostic.code);
|
||||
});
|
||||
if (!filteredDiagnostics.length)
|
||||
return;
|
||||
const error = this.createTsError(filteredDiagnostics);
|
||||
// only throw if `warnOnly` and it is a warning or error
|
||||
const importantCategories = [DiagnosticCategory.Warning, DiagnosticCategory.Error];
|
||||
if (this._diagnostics.throws && filteredDiagnostics.some((d) => importantCategories.includes(d.category))) {
|
||||
throw error;
|
||||
}
|
||||
logger.warn({ error }, error.message);
|
||||
}
|
||||
shouldReportDiagnostics(filePath) {
|
||||
const fileExtension = (0, path_1.extname)(filePath);
|
||||
return constants_1.JS_JSX_EXTENSIONS.includes(fileExtension)
|
||||
? this.parsedTsConfig.options.checkJs && !this._shouldIgnoreDiagnosticsForFile(filePath)
|
||||
: !this._shouldIgnoreDiagnosticsForFile(filePath);
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
createTsError(diagnostics) {
|
||||
const formatDiagnostics = this._diagnostics.pretty
|
||||
? this.compilerModule.formatDiagnosticsWithColorAndContext
|
||||
: this.compilerModule.formatDiagnostics;
|
||||
/* istanbul ignore next (not possible to cover) */
|
||||
const diagnosticHost = {
|
||||
getNewLine: () => '\n',
|
||||
getCurrentDirectory: () => this.cwd,
|
||||
getCanonicalFileName: (path) => path,
|
||||
};
|
||||
const diagnosticText = formatDiagnostics(diagnostics, diagnosticHost);
|
||||
const diagnosticCodes = diagnostics.map((x) => x.code);
|
||||
return new ts_error_1.TSError(diagnosticText, diagnosticCodes);
|
||||
}
|
||||
resolvePath(inputPath, { throwIfMissing = true, nodeResolve = false } = {}) {
|
||||
let path = inputPath;
|
||||
let nodeResolved = false;
|
||||
if (path.startsWith('<rootDir>')) {
|
||||
path = (0, path_1.resolve)((0, path_1.join)(this.rootDir, path.substr(9)));
|
||||
}
|
||||
else if (!(0, path_1.isAbsolute)(path)) {
|
||||
if (!path.startsWith('.') && nodeResolve) {
|
||||
try {
|
||||
path = require.resolve(path);
|
||||
nodeResolved = true;
|
||||
}
|
||||
catch {
|
||||
this.logger.debug({ path }, 'failed to resolve path', path);
|
||||
}
|
||||
}
|
||||
if (!nodeResolved) {
|
||||
path = (0, path_1.resolve)(this.cwd, path);
|
||||
}
|
||||
}
|
||||
if (!nodeResolved && nodeResolve) {
|
||||
try {
|
||||
path = require.resolve(path);
|
||||
nodeResolved = true;
|
||||
}
|
||||
catch {
|
||||
this.logger.debug({ path }, 'failed to resolve path', path);
|
||||
}
|
||||
}
|
||||
if (throwIfMissing && !(0, fs_1.existsSync)(path)) {
|
||||
throw new Error((0, messages_1.interpolate)("File not found: {{inputPath}} (resolved as: {{resolvedPath}})" /* Errors.FileNotFound */, { inputPath, resolvedPath: path }));
|
||||
}
|
||||
this.logger.debug({ fromPath: inputPath, toPath: path }, 'resolved path from', inputPath, 'to', path);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
exports.ConfigSet = ConfigSet;
|
||||
6
frontend/node_modules/ts-jest/dist/legacy/index.d.ts
generated
vendored
Normal file
6
frontend/node_modules/ts-jest/dist/legacy/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { TsJestTransformerOptions } from '../types';
|
||||
import { TsJestTransformer } from './ts-jest-transformer';
|
||||
declare const _default: {
|
||||
createTransformer: (tsJestConfig?: TsJestTransformerOptions) => TsJestTransformer;
|
||||
};
|
||||
export default _default;
|
||||
6
frontend/node_modules/ts-jest/dist/legacy/index.js
generated
vendored
Normal file
6
frontend/node_modules/ts-jest/dist/legacy/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ts_jest_transformer_1 = require("./ts-jest-transformer");
|
||||
exports.default = {
|
||||
createTransformer: (tsJestConfig) => new ts_jest_transformer_1.TsJestTransformer(tsJestConfig),
|
||||
};
|
||||
28
frontend/node_modules/ts-jest/dist/legacy/ts-jest-transformer.d.ts
generated
vendored
Normal file
28
frontend/node_modules/ts-jest/dist/legacy/ts-jest-transformer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { SyncTransformer, TransformedSource } from '@jest/transform';
|
||||
import type { CompilerInstance, TsJestTransformerOptions, TsJestTransformOptions } from '../types';
|
||||
import { ConfigSet } from './config/config-set';
|
||||
export declare class TsJestTransformer implements SyncTransformer<TsJestTransformerOptions> {
|
||||
private readonly transformerOptions?;
|
||||
private readonly _logger;
|
||||
protected _compiler: CompilerInstance;
|
||||
private _transformCfgStr;
|
||||
private _depGraphs;
|
||||
private _watchMode;
|
||||
constructor(transformerOptions?: TsJestTransformerOptions | undefined);
|
||||
private _configsFor;
|
||||
protected _createConfigSet(config: TsJestTransformOptions['config'] | undefined): ConfigSet;
|
||||
protected _createCompiler(configSet: ConfigSet, cacheFS: Map<string, string>): void;
|
||||
process(sourceText: string, sourcePath: string, transformOptions: TsJestTransformOptions): TransformedSource;
|
||||
processAsync(sourceText: string, sourcePath: string, transformOptions: TsJestTransformOptions): Promise<TransformedSource>;
|
||||
private processWithTs;
|
||||
private runTsJestHook;
|
||||
/**
|
||||
* Jest uses this to cache the compiled version of a file
|
||||
*
|
||||
* @see https://github.com/facebook/jest/blob/v23.5.0/packages/jest-runtime/src/script_transformer.js#L61-L90
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
getCacheKey(fileContent: string, filePath: string, transformOptions: TsJestTransformOptions): string;
|
||||
getCacheKeyAsync(sourceText: string, sourcePath: string, transformOptions: TsJestTransformOptions): Promise<string>;
|
||||
}
|
||||
293
frontend/node_modules/ts-jest/dist/legacy/ts-jest-transformer.js
generated
vendored
Normal file
293
frontend/node_modules/ts-jest/dist/legacy/ts-jest-transformer.js
generated
vendored
Normal file
@@ -0,0 +1,293 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TsJestTransformer = exports.CACHE_KEY_EL_SEPARATOR = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const typescript_1 = __importDefault(require("typescript"));
|
||||
const constants_1 = require("../constants");
|
||||
const utils_1 = require("../utils");
|
||||
const importer_1 = require("../utils/importer");
|
||||
const messages_1 = require("../utils/messages");
|
||||
const sha1_1 = require("../utils/sha1");
|
||||
const compiler_1 = require("./compiler");
|
||||
const compiler_utils_1 = require("./compiler/compiler-utils");
|
||||
const config_set_1 = require("./config/config-set");
|
||||
const isNodeModule = (filePath) => {
|
||||
return path_1.default.normalize(filePath).split(path_1.default.sep).includes('node_modules');
|
||||
};
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
exports.CACHE_KEY_EL_SEPARATOR = '\x00';
|
||||
class TsJestTransformer {
|
||||
transformerOptions;
|
||||
/**
|
||||
* cache ConfigSet between test runs
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
static _cachedConfigSets = [];
|
||||
_logger;
|
||||
_compiler;
|
||||
_transformCfgStr;
|
||||
_depGraphs = new Map();
|
||||
_watchMode = false;
|
||||
constructor(transformerOptions) {
|
||||
this.transformerOptions = transformerOptions;
|
||||
this._logger = utils_1.rootLogger.child({ namespace: 'ts-jest-transformer' });
|
||||
/**
|
||||
* For some unknown reasons, `this` is undefined in `getCacheKey` and `process`
|
||||
* when running Jest in ESM mode
|
||||
*/
|
||||
this.getCacheKey = this.getCacheKey.bind(this);
|
||||
this.getCacheKeyAsync = this.getCacheKeyAsync.bind(this);
|
||||
this.process = this.process.bind(this);
|
||||
this.processAsync = this.processAsync.bind(this);
|
||||
this._logger.debug('created new transformer');
|
||||
process.env.TS_JEST = '1';
|
||||
}
|
||||
_configsFor(transformOptions) {
|
||||
const { config, cacheFS } = transformOptions;
|
||||
const ccs = TsJestTransformer._cachedConfigSets.find((cs) => cs.jestConfig.value === config);
|
||||
let configSet;
|
||||
if (ccs) {
|
||||
this._transformCfgStr = ccs.transformerCfgStr;
|
||||
this._compiler = ccs.compiler;
|
||||
this._depGraphs = ccs.depGraphs;
|
||||
this._watchMode = ccs.watchMode;
|
||||
configSet = ccs.configSet;
|
||||
}
|
||||
else {
|
||||
// try to look-it up by stringified version
|
||||
const serializedJestCfg = (0, utils_1.stringify)(config);
|
||||
const serializedCcs = TsJestTransformer._cachedConfigSets.find((cs) => cs.jestConfig.serialized === serializedJestCfg);
|
||||
if (serializedCcs) {
|
||||
// update the object so that we can find it later
|
||||
// this happens because jest first calls getCacheKey with stringified version of
|
||||
// the config, and then it calls the transformer with the proper object
|
||||
serializedCcs.jestConfig.value = config;
|
||||
this._transformCfgStr = serializedCcs.transformerCfgStr;
|
||||
this._compiler = serializedCcs.compiler;
|
||||
this._depGraphs = serializedCcs.depGraphs;
|
||||
this._watchMode = serializedCcs.watchMode;
|
||||
configSet = serializedCcs.configSet;
|
||||
}
|
||||
else {
|
||||
// create the new record in the index
|
||||
this._logger.info('no matching config-set found, creating a new one');
|
||||
if (config.globals?.['ts-jest']) {
|
||||
this._logger.warn("Define `ts-jest` config under `globals` is deprecated. Please do\ntransform: {\n <transform_regex>: ['ts-jest', { /* ts-jest config goes here in Jest */ }],\n},\nSee more at https://kulshekhar.github.io/ts-jest/docs/getting-started/presets#advanced" /* Deprecations.GlobalsTsJestConfigOption */);
|
||||
}
|
||||
const jestGlobalsConfig = config.globals ?? {};
|
||||
const tsJestGlobalsConfig = jestGlobalsConfig['ts-jest'] ?? {};
|
||||
const migratedConfig = this.transformerOptions
|
||||
? {
|
||||
...config,
|
||||
globals: {
|
||||
...jestGlobalsConfig,
|
||||
'ts-jest': {
|
||||
...tsJestGlobalsConfig,
|
||||
...this.transformerOptions,
|
||||
},
|
||||
},
|
||||
}
|
||||
: config;
|
||||
configSet = this._createConfigSet(migratedConfig);
|
||||
const jest = { ...migratedConfig };
|
||||
// we need to remove some stuff from jest config
|
||||
// this which does not depend on config
|
||||
jest.cacheDirectory = undefined; // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
this._transformCfgStr = `${new utils_1.JsonableValue(jest).serialized}${configSet.cacheSuffix}`;
|
||||
this._createCompiler(configSet, cacheFS);
|
||||
this._watchMode = process.argv.includes('--watch');
|
||||
TsJestTransformer._cachedConfigSets.push({
|
||||
jestConfig: new utils_1.JsonableValue(config),
|
||||
configSet,
|
||||
transformerCfgStr: this._transformCfgStr,
|
||||
compiler: this._compiler,
|
||||
depGraphs: this._depGraphs,
|
||||
watchMode: this._watchMode,
|
||||
});
|
||||
}
|
||||
}
|
||||
return configSet;
|
||||
}
|
||||
_createConfigSet(config) {
|
||||
return new config_set_1.ConfigSet(config);
|
||||
}
|
||||
_createCompiler(configSet, cacheFS) {
|
||||
this._compiler = new compiler_1.TsJestCompiler(configSet, cacheFS);
|
||||
}
|
||||
process(sourceText, sourcePath, transformOptions) {
|
||||
this._logger.debug({ fileName: sourcePath, transformOptions }, 'processing', sourcePath);
|
||||
const configs = this._configsFor(transformOptions);
|
||||
const shouldStringifyContent = configs.shouldStringifyContent(sourcePath);
|
||||
const babelJest = shouldStringifyContent ? undefined : configs.babelJestTransformer;
|
||||
let result = {
|
||||
code: this.processWithTs(sourceText, sourcePath, transformOptions).code,
|
||||
};
|
||||
if (babelJest) {
|
||||
this._logger.debug({ fileName: sourcePath }, 'calling babel-jest processor');
|
||||
// do not instrument here, jest will do it anyway afterwards
|
||||
result = babelJest.process(result.code, sourcePath, {
|
||||
...transformOptions,
|
||||
instrument: false,
|
||||
});
|
||||
}
|
||||
result = this.runTsJestHook(sourcePath, sourceText, transformOptions, result);
|
||||
return result;
|
||||
}
|
||||
async processAsync(sourceText, sourcePath, transformOptions) {
|
||||
this._logger.debug({ fileName: sourcePath, transformOptions }, 'processing', sourcePath);
|
||||
const configs = this._configsFor(transformOptions);
|
||||
const shouldStringifyContent = configs.shouldStringifyContent(sourcePath);
|
||||
const babelJest = shouldStringifyContent ? undefined : configs.babelJestTransformer;
|
||||
let result;
|
||||
const processWithTsResult = this.processWithTs(sourceText, sourcePath, transformOptions);
|
||||
result = {
|
||||
code: processWithTsResult.code,
|
||||
};
|
||||
if (processWithTsResult.diagnostics?.length) {
|
||||
throw configs.createTsError(processWithTsResult.diagnostics);
|
||||
}
|
||||
if (babelJest) {
|
||||
this._logger.debug({ fileName: sourcePath }, 'calling babel-jest processor');
|
||||
// do not instrument here, jest will do it anyway afterwards
|
||||
result = await babelJest.processAsync(result.code, sourcePath, {
|
||||
...transformOptions,
|
||||
instrument: false,
|
||||
});
|
||||
}
|
||||
result = this.runTsJestHook(sourcePath, sourceText, transformOptions, result);
|
||||
return result;
|
||||
}
|
||||
processWithTs(sourceText, sourcePath, transformOptions) {
|
||||
let result;
|
||||
const configs = this._configsFor(transformOptions);
|
||||
const shouldStringifyContent = configs.shouldStringifyContent(sourcePath);
|
||||
const babelJest = shouldStringifyContent ? undefined : configs.babelJestTransformer;
|
||||
const isDefinitionFile = sourcePath.endsWith(constants_1.DECLARATION_TYPE_EXT);
|
||||
const isJsFile = constants_1.JS_JSX_REGEX.test(sourcePath);
|
||||
const isTsFile = !isDefinitionFile && constants_1.TS_TSX_REGEX.test(sourcePath);
|
||||
if (shouldStringifyContent) {
|
||||
// handles here what we should simply stringify
|
||||
result = {
|
||||
code: `module.exports=${(0, utils_1.stringify)(sourceText)}`,
|
||||
};
|
||||
}
|
||||
else if (isDefinitionFile) {
|
||||
// do not try to compile declaration files
|
||||
result = {
|
||||
code: '',
|
||||
};
|
||||
}
|
||||
else if (isJsFile || isTsFile) {
|
||||
if (isJsFile && isNodeModule(sourcePath)) {
|
||||
const transpiledResult = typescript_1.default.transpileModule(sourceText, {
|
||||
compilerOptions: {
|
||||
...configs.parsedTsConfig.options,
|
||||
module: transformOptions.supportsStaticESM && transformOptions.transformerConfig.useESM
|
||||
? typescript_1.default.ModuleKind.ESNext
|
||||
: typescript_1.default.ModuleKind.CommonJS,
|
||||
},
|
||||
fileName: sourcePath,
|
||||
});
|
||||
result = {
|
||||
code: (0, compiler_utils_1.updateOutput)(transpiledResult.outputText, sourcePath, transpiledResult.sourceMapText),
|
||||
};
|
||||
}
|
||||
else {
|
||||
// transpile TS code (source maps are included)
|
||||
result = this._compiler.getCompiledOutput(sourceText, sourcePath, {
|
||||
depGraphs: this._depGraphs,
|
||||
supportsStaticESM: transformOptions.supportsStaticESM,
|
||||
watchMode: this._watchMode,
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
// we should not get called for files with other extension than js[x], ts[x] and d.ts,
|
||||
// TypeScript will bail if we try to compile, and if it was to call babel, users can
|
||||
// define the transform value with `babel-jest` for this extension instead
|
||||
const 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." /* Errors.GotUnknownFileTypeWithBabel */ : "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." /* Errors.GotUnknownFileTypeWithoutBabel */;
|
||||
this._logger.warn({ fileName: sourcePath }, (0, messages_1.interpolate)(message, { path: sourcePath }));
|
||||
result = {
|
||||
code: sourceText,
|
||||
};
|
||||
}
|
||||
return result;
|
||||
}
|
||||
runTsJestHook(sourcePath, sourceText, transformOptions, compiledOutput) {
|
||||
let hooksFile = process.env.TS_JEST_HOOKS;
|
||||
let hooks;
|
||||
/* istanbul ignore next (cover by e2e) */
|
||||
if (hooksFile) {
|
||||
hooksFile = path_1.default.resolve(this._configsFor(transformOptions).cwd, hooksFile);
|
||||
hooks = importer_1.importer.tryTheseOr(hooksFile, {});
|
||||
}
|
||||
// This is not supposed to be a public API but we keep it as some people use it
|
||||
if (hooks?.afterProcess) {
|
||||
this._logger.debug({ fileName: sourcePath, hookName: 'afterProcess' }, 'calling afterProcess hook');
|
||||
const newResult = hooks.afterProcess([sourceText, sourcePath, transformOptions.config, transformOptions], compiledOutput);
|
||||
if (newResult) {
|
||||
return newResult;
|
||||
}
|
||||
}
|
||||
return compiledOutput;
|
||||
}
|
||||
/**
|
||||
* Jest uses this to cache the compiled version of a file
|
||||
*
|
||||
* @see https://github.com/facebook/jest/blob/v23.5.0/packages/jest-runtime/src/script_transformer.js#L61-L90
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
getCacheKey(fileContent, filePath, transformOptions) {
|
||||
const configs = this._configsFor(transformOptions);
|
||||
this._logger.debug({ fileName: filePath, transformOptions }, 'computing cache key for', filePath);
|
||||
// we do not instrument, ensure it is false all the time
|
||||
const { supportsStaticESM, instrument = false } = transformOptions;
|
||||
const constructingCacheKeyElements = [
|
||||
this._transformCfgStr,
|
||||
exports.CACHE_KEY_EL_SEPARATOR,
|
||||
configs.rootDir,
|
||||
exports.CACHE_KEY_EL_SEPARATOR,
|
||||
`instrument:${instrument ? 'on' : 'off'}`,
|
||||
exports.CACHE_KEY_EL_SEPARATOR,
|
||||
`supportsStaticESM:${supportsStaticESM ? 'on' : 'off'}`,
|
||||
exports.CACHE_KEY_EL_SEPARATOR,
|
||||
fileContent,
|
||||
exports.CACHE_KEY_EL_SEPARATOR,
|
||||
filePath,
|
||||
];
|
||||
if (!configs.isolatedModules && configs.tsCacheDir) {
|
||||
let resolvedModuleNames;
|
||||
if (this._depGraphs.get(filePath)?.fileContent === fileContent) {
|
||||
this._logger.debug({ fileName: filePath, transformOptions }, 'getting resolved modules from disk caching or memory caching for', filePath);
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
resolvedModuleNames = this._depGraphs
|
||||
.get(filePath)
|
||||
.resolvedModuleNames.filter((moduleName) => (0, fs_1.existsSync)(moduleName));
|
||||
}
|
||||
else {
|
||||
this._logger.debug({ fileName: filePath, transformOptions }, 'getting resolved modules from TypeScript API for', filePath);
|
||||
resolvedModuleNames = this._compiler.getResolvedModules(fileContent, filePath, transformOptions.cacheFS);
|
||||
this._depGraphs.set(filePath, {
|
||||
fileContent,
|
||||
resolvedModuleNames,
|
||||
});
|
||||
}
|
||||
resolvedModuleNames.forEach((moduleName) => {
|
||||
constructingCacheKeyElements.push(exports.CACHE_KEY_EL_SEPARATOR, moduleName, exports.CACHE_KEY_EL_SEPARATOR, (0, fs_1.statSync)(moduleName).mtimeMs.toString());
|
||||
});
|
||||
}
|
||||
return (0, sha1_1.sha1)(...constructingCacheKeyElements);
|
||||
}
|
||||
async getCacheKeyAsync(sourceText, sourcePath, transformOptions) {
|
||||
return Promise.resolve(this.getCacheKey(sourceText, sourcePath, transformOptions));
|
||||
}
|
||||
}
|
||||
exports.TsJestTransformer = TsJestTransformer;
|
||||
15
frontend/node_modules/ts-jest/dist/presets/all-presets.d.ts
generated
vendored
Normal file
15
frontend/node_modules/ts-jest/dist/presets/all-presets.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
declare const allPresets: {
|
||||
readonly defaults: import("..").DefaultPreset;
|
||||
readonly defaultsLegacy: import("..").DefaultLegacyPreset;
|
||||
readonly defaultsESM: import("..").DefaultEsmPreset;
|
||||
readonly defaultsESMLegacy: import("..").DefaultEsmLegacyPreset;
|
||||
readonly jsWithTs: import("..").JsWithTsPreset;
|
||||
readonly jsWithTsLegacy: import("..").JsWithTsLegacyPreset;
|
||||
readonly jsWithTsESM: import("..").JsWithTsEsmPreset;
|
||||
readonly jsWithTsESMLegacy: import("..").JsWithTsEsmLegacyPreset;
|
||||
readonly jsWithBabel: import("..").JsWithBabelPreset;
|
||||
readonly jsWithBabelLegacy: import("..").JsWithBabelLegacyPreset;
|
||||
readonly jsWithBabelESM: import("..").JsWithBabelEsmPreset;
|
||||
readonly jsWithBabelESMLegacy: import("..").JsWithBabelEsmLegacyPreset;
|
||||
};
|
||||
export default allPresets;
|
||||
42
frontend/node_modules/ts-jest/dist/presets/all-presets.js
generated
vendored
Normal file
42
frontend/node_modules/ts-jest/dist/presets/all-presets.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const create_jest_preset_1 = require("./create-jest-preset");
|
||||
const allPresets = {
|
||||
get defaults() {
|
||||
return (0, create_jest_preset_1.createDefaultPreset)();
|
||||
},
|
||||
get defaultsLegacy() {
|
||||
return (0, create_jest_preset_1.createDefaultLegacyPreset)();
|
||||
},
|
||||
get defaultsESM() {
|
||||
return (0, create_jest_preset_1.createDefaultEsmPreset)();
|
||||
},
|
||||
get defaultsESMLegacy() {
|
||||
return (0, create_jest_preset_1.createDefaultEsmLegacyPreset)();
|
||||
},
|
||||
get jsWithTs() {
|
||||
return (0, create_jest_preset_1.createJsWithTsPreset)();
|
||||
},
|
||||
get jsWithTsLegacy() {
|
||||
return (0, create_jest_preset_1.createJsWithTsLegacyPreset)();
|
||||
},
|
||||
get jsWithTsESM() {
|
||||
return (0, create_jest_preset_1.createJsWithTsEsmPreset)();
|
||||
},
|
||||
get jsWithTsESMLegacy() {
|
||||
return (0, create_jest_preset_1.createJsWithTsEsmLegacyPreset)();
|
||||
},
|
||||
get jsWithBabel() {
|
||||
return (0, create_jest_preset_1.createJsWithBabelPreset)();
|
||||
},
|
||||
get jsWithBabelLegacy() {
|
||||
return (0, create_jest_preset_1.createJsWithBabelLegacyPreset)();
|
||||
},
|
||||
get jsWithBabelESM() {
|
||||
return (0, create_jest_preset_1.createJsWithBabelEsmPreset)();
|
||||
},
|
||||
get jsWithBabelESMLegacy() {
|
||||
return (0, create_jest_preset_1.createJsWithBabelEsmLegacyPreset)();
|
||||
},
|
||||
};
|
||||
exports.default = allPresets;
|
||||
18
frontend/node_modules/ts-jest/dist/presets/create-jest-preset.d.ts
generated
vendored
Normal file
18
frontend/node_modules/ts-jest/dist/presets/create-jest-preset.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { Config } from '@jest/types';
|
||||
import { DefaultEsmLegacyPreset, DefaultEsmPreset, DefaultEsmTransformOptions, DefaultLegacyPreset, DefaultPreset, DefaultTransformOptions, JsWithBabelEsmLegacyPreset, JsWithBabelEsmPreset, JsWithBabelEsmTransformOptions, JsWithBabelLegacyPreset, JsWithBabelPreset, JsWithBabelTransformerOptions, JsWithTsEsmLegacyPreset, JsWithTsEsmPreset, JsWithTsEsmTransformOptions, JsWithTsLegacyPreset, JsWithTsPreset, JsWithTsTransformOptions, TsJestPresets } from '../types';
|
||||
/**
|
||||
* @deprecated use other functions below instead
|
||||
*/
|
||||
export declare function createJestPreset(legacy?: boolean, allowJs?: boolean, extraOptions?: Config.InitialOptions): TsJestPresets;
|
||||
export declare function createDefaultPreset(tsJestTransformOptions?: DefaultTransformOptions): DefaultPreset;
|
||||
export declare function createDefaultLegacyPreset(tsJestTransformOptions?: DefaultTransformOptions): DefaultLegacyPreset;
|
||||
export declare function createJsWithTsPreset(tsJestTransformOptions?: JsWithTsTransformOptions): JsWithTsPreset;
|
||||
export declare function createJsWithTsLegacyPreset(tsJestTransformOptions?: JsWithTsTransformOptions): JsWithTsLegacyPreset;
|
||||
export declare function createJsWithBabelPreset(tsJestTransformOptions?: JsWithBabelTransformerOptions): JsWithBabelPreset;
|
||||
export declare function createJsWithBabelLegacyPreset(tsJestTransformOptions?: JsWithBabelTransformerOptions): JsWithBabelLegacyPreset;
|
||||
export declare function createDefaultEsmPreset(tsJestTransformOptions?: DefaultEsmTransformOptions): DefaultEsmPreset;
|
||||
export declare function createDefaultEsmLegacyPreset(tsJestTransformOptions?: DefaultEsmTransformOptions): DefaultEsmLegacyPreset;
|
||||
export declare function createJsWithTsEsmPreset(tsJestTransformOptions?: JsWithTsEsmTransformOptions): JsWithTsEsmPreset;
|
||||
export declare function createJsWithTsEsmLegacyPreset(tsJestTransformOptions?: JsWithTsEsmTransformOptions): JsWithTsEsmLegacyPreset;
|
||||
export declare function createJsWithBabelEsmPreset(tsJestTransformOptions?: JsWithBabelEsmTransformOptions): JsWithBabelEsmPreset;
|
||||
export declare function createJsWithBabelEsmLegacyPreset(tsJestTransformOptions?: JsWithBabelEsmTransformOptions): JsWithBabelEsmLegacyPreset;
|
||||
180
frontend/node_modules/ts-jest/dist/presets/create-jest-preset.js
generated
vendored
Normal file
180
frontend/node_modules/ts-jest/dist/presets/create-jest-preset.js
generated
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createJestPreset = createJestPreset;
|
||||
exports.createDefaultPreset = createDefaultPreset;
|
||||
exports.createDefaultLegacyPreset = createDefaultLegacyPreset;
|
||||
exports.createJsWithTsPreset = createJsWithTsPreset;
|
||||
exports.createJsWithTsLegacyPreset = createJsWithTsLegacyPreset;
|
||||
exports.createJsWithBabelPreset = createJsWithBabelPreset;
|
||||
exports.createJsWithBabelLegacyPreset = createJsWithBabelLegacyPreset;
|
||||
exports.createDefaultEsmPreset = createDefaultEsmPreset;
|
||||
exports.createDefaultEsmLegacyPreset = createDefaultEsmLegacyPreset;
|
||||
exports.createJsWithTsEsmPreset = createJsWithTsEsmPreset;
|
||||
exports.createJsWithTsEsmLegacyPreset = createJsWithTsEsmLegacyPreset;
|
||||
exports.createJsWithBabelEsmPreset = createJsWithBabelEsmPreset;
|
||||
exports.createJsWithBabelEsmLegacyPreset = createJsWithBabelEsmLegacyPreset;
|
||||
const constants_1 = require("../constants");
|
||||
const utils_1 = require("../utils");
|
||||
const logger = utils_1.rootLogger.child({ namespace: 'jest-preset' });
|
||||
/**
|
||||
* @deprecated use other functions below instead
|
||||
*/
|
||||
function createJestPreset(legacy = false, allowJs = false, extraOptions = {}) {
|
||||
logger.debug({ allowJs }, 'creating jest presets', allowJs ? 'handling' : 'not handling', 'JavaScript files');
|
||||
const { extensionsToTreatAsEsm, moduleFileExtensions, testMatch } = extraOptions;
|
||||
const supportESM = extensionsToTreatAsEsm?.length;
|
||||
const tsJestTransformOptions = supportESM ? { useESM: true } : {};
|
||||
return {
|
||||
...(extensionsToTreatAsEsm ? { extensionsToTreatAsEsm } : undefined),
|
||||
...(moduleFileExtensions ? { moduleFileExtensions } : undefined),
|
||||
...(testMatch ? { testMatch } : undefined),
|
||||
transform: {
|
||||
...extraOptions.transform,
|
||||
[allowJs ? (supportESM ? '^.+\\.m?[tj]sx?$' : '^.+\\.[tj]sx?$') : '^.+\\.tsx?$']: legacy
|
||||
? ['ts-jest/legacy', tsJestTransformOptions]
|
||||
: ['ts-jest', tsJestTransformOptions],
|
||||
},
|
||||
};
|
||||
}
|
||||
function createDefaultPreset(tsJestTransformOptions = {}) {
|
||||
logger.debug('creating default CJS Jest preset');
|
||||
return {
|
||||
transform: {
|
||||
[constants_1.TS_TRANSFORM_PATTERN]: ['ts-jest', tsJestTransformOptions],
|
||||
},
|
||||
};
|
||||
}
|
||||
function createDefaultLegacyPreset(tsJestTransformOptions = {}) {
|
||||
logger.debug('creating default CJS Jest preset');
|
||||
return {
|
||||
transform: {
|
||||
[constants_1.TS_TRANSFORM_PATTERN]: ['ts-jest/legacy', tsJestTransformOptions],
|
||||
},
|
||||
};
|
||||
}
|
||||
function createJsWithTsPreset(tsJestTransformOptions = {}) {
|
||||
logger.debug('creating Js with Ts CJS Jest preset');
|
||||
return {
|
||||
transform: {
|
||||
[constants_1.TS_JS_TRANSFORM_PATTERN]: ['ts-jest', tsJestTransformOptions],
|
||||
},
|
||||
};
|
||||
}
|
||||
function createJsWithTsLegacyPreset(tsJestTransformOptions = {}) {
|
||||
logger.debug('creating Js with Ts CJS Jest preset');
|
||||
return {
|
||||
transform: {
|
||||
[constants_1.TS_JS_TRANSFORM_PATTERN]: ['ts-jest/legacy', tsJestTransformOptions],
|
||||
},
|
||||
};
|
||||
}
|
||||
function createJsWithBabelPreset(tsJestTransformOptions = {}) {
|
||||
logger.debug('creating JS with Babel CJS Jest preset');
|
||||
return {
|
||||
transform: {
|
||||
[constants_1.JS_TRANSFORM_PATTERN]: 'babel-jest',
|
||||
[constants_1.TS_TRANSFORM_PATTERN]: ['ts-jest', tsJestTransformOptions],
|
||||
},
|
||||
};
|
||||
}
|
||||
function createJsWithBabelLegacyPreset(tsJestTransformOptions = {}) {
|
||||
logger.debug('creating JS with Babel CJS Jest preset');
|
||||
return {
|
||||
transform: {
|
||||
[constants_1.JS_TRANSFORM_PATTERN]: 'babel-jest',
|
||||
[constants_1.TS_TRANSFORM_PATTERN]: ['ts-jest/legacy', tsJestTransformOptions],
|
||||
},
|
||||
};
|
||||
}
|
||||
function createDefaultEsmPreset(tsJestTransformOptions = {}) {
|
||||
logger.debug('creating default ESM Jest preset');
|
||||
return {
|
||||
extensionsToTreatAsEsm: [...constants_1.TS_EXT_TO_TREAT_AS_ESM],
|
||||
transform: {
|
||||
[constants_1.ESM_TS_TRANSFORM_PATTERN]: [
|
||||
'ts-jest',
|
||||
{
|
||||
...tsJestTransformOptions,
|
||||
useESM: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
function createDefaultEsmLegacyPreset(tsJestTransformOptions = {}) {
|
||||
logger.debug('creating default ESM Jest preset');
|
||||
return {
|
||||
extensionsToTreatAsEsm: [...constants_1.TS_EXT_TO_TREAT_AS_ESM],
|
||||
transform: {
|
||||
[constants_1.ESM_TS_TRANSFORM_PATTERN]: [
|
||||
'ts-jest/legacy',
|
||||
{
|
||||
...tsJestTransformOptions,
|
||||
useESM: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
function createJsWithTsEsmPreset(tsJestTransformOptions = {}) {
|
||||
logger.debug('creating Js with Ts ESM Jest preset');
|
||||
return {
|
||||
extensionsToTreatAsEsm: [...constants_1.JS_EXT_TO_TREAT_AS_ESM, ...constants_1.TS_EXT_TO_TREAT_AS_ESM],
|
||||
transform: {
|
||||
[constants_1.ESM_TS_JS_TRANSFORM_PATTERN]: [
|
||||
'ts-jest',
|
||||
{
|
||||
...tsJestTransformOptions,
|
||||
useESM: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
function createJsWithTsEsmLegacyPreset(tsJestTransformOptions = {}) {
|
||||
logger.debug('creating Js with Ts ESM Jest preset');
|
||||
return {
|
||||
extensionsToTreatAsEsm: [...constants_1.JS_EXT_TO_TREAT_AS_ESM, ...constants_1.TS_EXT_TO_TREAT_AS_ESM],
|
||||
transform: {
|
||||
[constants_1.ESM_TS_JS_TRANSFORM_PATTERN]: [
|
||||
'ts-jest/legacy',
|
||||
{
|
||||
...tsJestTransformOptions,
|
||||
useESM: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
function createJsWithBabelEsmPreset(tsJestTransformOptions = {}) {
|
||||
logger.debug('creating JS with Babel ESM Jest preset');
|
||||
return {
|
||||
extensionsToTreatAsEsm: [...constants_1.JS_EXT_TO_TREAT_AS_ESM, ...constants_1.TS_EXT_TO_TREAT_AS_ESM],
|
||||
transform: {
|
||||
[constants_1.ESM_JS_TRANSFORM_PATTERN]: 'babel-jest',
|
||||
[constants_1.ESM_TS_TRANSFORM_PATTERN]: [
|
||||
'ts-jest',
|
||||
{
|
||||
...tsJestTransformOptions,
|
||||
useESM: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
function createJsWithBabelEsmLegacyPreset(tsJestTransformOptions = {}) {
|
||||
logger.debug('creating JS with Babel ESM Jest preset');
|
||||
return {
|
||||
extensionsToTreatAsEsm: [...constants_1.JS_EXT_TO_TREAT_AS_ESM, ...constants_1.TS_EXT_TO_TREAT_AS_ESM],
|
||||
transform: {
|
||||
[constants_1.ESM_JS_TRANSFORM_PATTERN]: 'babel-jest',
|
||||
[constants_1.ESM_TS_TRANSFORM_PATTERN]: [
|
||||
'ts-jest/legacy',
|
||||
{
|
||||
...tsJestTransformOptions,
|
||||
useESM: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
556
frontend/node_modules/ts-jest/dist/raw-compiler-options.d.ts
generated
vendored
Normal file
556
frontend/node_modules/ts-jest/dist/raw-compiler-options.d.ts
generated
vendored
Normal file
@@ -0,0 +1,556 @@
|
||||
/**
|
||||
* @deprecated This interface will be replaced with {@link TsConfigJson.CompilerOptions} in the next major release.
|
||||
*/
|
||||
export interface RawCompilerOptions {
|
||||
/**
|
||||
* Enable importing files with any extension, provided a declaration file is present.
|
||||
*/
|
||||
allowArbitraryExtensions?: boolean | null;
|
||||
/**
|
||||
* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.
|
||||
*/
|
||||
allowImportingTsExtensions?: boolean | null;
|
||||
/**
|
||||
* No longer supported. In early versions, manually set the text encoding for reading files.
|
||||
*/
|
||||
charset?: string | null;
|
||||
/**
|
||||
* Enable constraints that allow a TypeScript project to be used with project references.
|
||||
*/
|
||||
composite?: boolean | null;
|
||||
/**
|
||||
* Conditions to set in addition to the resolver-specific defaults when resolving imports.
|
||||
*/
|
||||
customConditions?: Array<string | null> | null;
|
||||
/**
|
||||
* Generate .d.ts files from TypeScript and JavaScript files in your project.
|
||||
*/
|
||||
declaration?: boolean | null;
|
||||
/**
|
||||
* Specify the output directory for generated declaration files.
|
||||
*/
|
||||
declarationDir?: string | null;
|
||||
/**
|
||||
* Output compiler performance information after building.
|
||||
*/
|
||||
diagnostics?: boolean | null;
|
||||
/**
|
||||
* Reduce the number of projects loaded automatically by TypeScript.
|
||||
*/
|
||||
disableReferencedProjectLoad?: boolean | null;
|
||||
/**
|
||||
* Enforces using indexed accessors for keys declared using an indexed type
|
||||
*/
|
||||
noPropertyAccessFromIndexSignature?: boolean | null;
|
||||
/**
|
||||
* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.
|
||||
*/
|
||||
emitBOM?: boolean | null;
|
||||
/**
|
||||
* Only output d.ts files and not JavaScript files.
|
||||
*/
|
||||
emitDeclarationOnly?: boolean | null;
|
||||
/**
|
||||
* Differentiate between undefined and not present when type checking
|
||||
*/
|
||||
exactOptionalPropertyTypes?: boolean | null;
|
||||
/**
|
||||
* Enable incremental compilation. Requires TypeScript version 3.4 or later.
|
||||
*/
|
||||
incremental?: boolean | null;
|
||||
/**
|
||||
* Specify the folder for .tsbuildinfo incremental compilation files.
|
||||
*/
|
||||
tsBuildInfoFile?: string | null;
|
||||
/**
|
||||
* Include sourcemap files inside the emitted JavaScript.
|
||||
*/
|
||||
inlineSourceMap?: boolean | null;
|
||||
/**
|
||||
* Include source code in the sourcemaps inside the emitted JavaScript.
|
||||
*/
|
||||
inlineSources?: boolean | null;
|
||||
/**
|
||||
* Specify what JSX code is generated.
|
||||
*/
|
||||
jsx?: 'preserve' | 'react' | 'react-jsx' | 'react-jsxdev' | 'react-native';
|
||||
/**
|
||||
* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit.
|
||||
*/
|
||||
reactNamespace?: string | null;
|
||||
/**
|
||||
* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'
|
||||
*/
|
||||
jsxFactory?: string | null;
|
||||
/**
|
||||
* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.
|
||||
*/
|
||||
jsxFragmentFactory?: string | null;
|
||||
/**
|
||||
* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx`.
|
||||
*/
|
||||
jsxImportSource?: string | null;
|
||||
/**
|
||||
* Print all of the files read during the compilation.
|
||||
*/
|
||||
listFiles?: boolean | null;
|
||||
/**
|
||||
* Specify the location where debugger should locate map files instead of generated locations.
|
||||
*/
|
||||
mapRoot?: string | null;
|
||||
/**
|
||||
* Specify what module code is generated.
|
||||
*/
|
||||
module?: ('CommonJS' | 'AMD' | 'System' | 'UMD' | 'ES6' | 'ES2015' | 'ES2020' | 'ESNext' | 'None' | 'ES2022' | 'Node16' | 'NodeNext' | 'Preserve') & (((('CommonJS' | 'AMD' | 'System' | 'UMD' | 'ES6' | 'ES2015' | 'ES2020' | 'ESNext' | 'None' | 'ES2022' | 'Node16' | 'NodeNext' | 'Preserve') | {
|
||||
[k: string]: unknown;
|
||||
}) & string) | ((('CommonJS' | 'AMD' | 'System' | 'UMD' | 'ES6' | 'ES2015' | 'ES2020' | 'ESNext' | 'None' | 'ES2022' | 'Node16' | 'NodeNext' | 'Preserve') | {
|
||||
[k: string]: unknown;
|
||||
}) & null));
|
||||
/**
|
||||
* Specify how TypeScript looks up a file from a given module specifier.
|
||||
*/
|
||||
moduleResolution?: ('Classic' | 'Node' | 'Node10' | 'Node16' | 'NodeNext' | 'Bundler') & (((('Classic' | 'Node' | 'Node10' | 'Node16' | 'NodeNext' | 'Bundler') | {
|
||||
[k: string]: unknown;
|
||||
}) & string) | ((('Classic' | 'Node' | 'Node10' | 'Node16' | 'NodeNext' | 'Bundler') | {
|
||||
[k: string]: unknown;
|
||||
}) & null));
|
||||
/**
|
||||
* Set the newline character for emitting files.
|
||||
*/
|
||||
newLine?: ('crlf' | 'lf') & (((('crlf' | 'lf') | {
|
||||
[k: string]: unknown;
|
||||
}) & string) | ((('crlf' | 'lf') | {
|
||||
[k: string]: unknown;
|
||||
}) & null));
|
||||
/**
|
||||
* Disable emitting file from a compilation.
|
||||
*/
|
||||
noEmit?: boolean | null;
|
||||
/**
|
||||
* Disable generating custom helper functions like `__extends` in compiled output.
|
||||
*/
|
||||
noEmitHelpers?: boolean | null;
|
||||
/**
|
||||
* Disable emitting files if any type checking errors are reported.
|
||||
*/
|
||||
noEmitOnError?: boolean | null;
|
||||
/**
|
||||
* Enable error reporting for expressions and declarations with an implied `any` type..
|
||||
*/
|
||||
noImplicitAny?: boolean | null;
|
||||
/**
|
||||
* Enable error reporting when `this` is given the type `any`.
|
||||
*/
|
||||
noImplicitThis?: boolean | null;
|
||||
/**
|
||||
* Enable error reporting when a local variables aren't read.
|
||||
*/
|
||||
noUnusedLocals?: boolean | null;
|
||||
/**
|
||||
* Raise an error when a function parameter isn't read
|
||||
*/
|
||||
noUnusedParameters?: boolean | null;
|
||||
/**
|
||||
* Disable including any library files, including the default lib.d.ts.
|
||||
*/
|
||||
noLib?: boolean | null;
|
||||
/**
|
||||
* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project.
|
||||
*/
|
||||
noResolve?: boolean | null;
|
||||
/**
|
||||
* Disable strict checking of generic signatures in function types.
|
||||
*/
|
||||
noStrictGenericChecks?: boolean | null;
|
||||
/**
|
||||
* Skip type checking .d.ts files that are included with TypeScript.
|
||||
*/
|
||||
skipDefaultLibCheck?: boolean | null;
|
||||
/**
|
||||
* Skip type checking all .d.ts files.
|
||||
*/
|
||||
skipLibCheck?: boolean | null;
|
||||
/**
|
||||
* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output.
|
||||
*/
|
||||
outFile?: string | null;
|
||||
/**
|
||||
* Specify an output folder for all emitted files.
|
||||
*/
|
||||
outDir?: string | null;
|
||||
/**
|
||||
* Disable erasing `const enum` declarations in generated code.
|
||||
*/
|
||||
preserveConstEnums?: boolean | null;
|
||||
/**
|
||||
* Disable resolving symlinks to their realpath. This correlates to the same flag in node.
|
||||
*/
|
||||
preserveSymlinks?: boolean | null;
|
||||
/**
|
||||
* Preserve unused imported values in the JavaScript output that would otherwise be removed
|
||||
*/
|
||||
preserveValueImports?: boolean | null;
|
||||
/**
|
||||
* Disable wiping the console in watch mode
|
||||
*/
|
||||
preserveWatchOutput?: boolean | null;
|
||||
/**
|
||||
* Enable color and formatting in output to make compiler errors easier to read
|
||||
*/
|
||||
pretty?: boolean | null;
|
||||
/**
|
||||
* Disable emitting comments.
|
||||
*/
|
||||
removeComments?: boolean | null;
|
||||
/**
|
||||
* Specify the root folder within your source files.
|
||||
*/
|
||||
rootDir?: string | null;
|
||||
/**
|
||||
* Ensure that each file can be safely transpiled without relying on other imports.
|
||||
*/
|
||||
isolatedModules?: boolean | null;
|
||||
/**
|
||||
* Create source map files for emitted JavaScript files.
|
||||
*/
|
||||
sourceMap?: boolean | null;
|
||||
/**
|
||||
* Specify the root path for debuggers to find the reference source code.
|
||||
*/
|
||||
sourceRoot?: string | null;
|
||||
/**
|
||||
* Disable reporting of excess property errors during the creation of object literals.
|
||||
*/
|
||||
suppressExcessPropertyErrors?: boolean | null;
|
||||
/**
|
||||
* Suppress `noImplicitAny` errors when indexing objects that lack index signatures.
|
||||
*/
|
||||
suppressImplicitAnyIndexErrors?: boolean | null;
|
||||
/**
|
||||
* Set the JavaScript language version for emitted JavaScript and include compatible library declarations.
|
||||
*/
|
||||
target?: ('ES3' | 'ES5' | 'ES6' | 'ES2015' | 'ES2016' | 'ES2017' | 'ES2018' | 'ES2019' | 'ES2020' | 'ES2021' | 'ES2022' | 'ES2023' | 'ESNext') & (((('ES3' | 'ES5' | 'ES6' | 'ES2015' | 'ES2016' | 'ES2017' | 'ES2018' | 'ES2019' | 'ES2020' | 'ES2021' | 'ES2022' | 'ES2023' | 'ESNext') | {
|
||||
[k: string]: unknown;
|
||||
}) & string) | ((('ES3' | 'ES5' | 'ES6' | 'ES2015' | 'ES2016' | 'ES2017' | 'ES2018' | 'ES2019' | 'ES2020' | 'ES2021' | 'ES2022' | 'ES2023' | 'ESNext') | {
|
||||
[k: string]: unknown;
|
||||
}) & null));
|
||||
/**
|
||||
* Default catch clause variables as `unknown` instead of `any`.
|
||||
*/
|
||||
useUnknownInCatchVariables?: boolean | null;
|
||||
/**
|
||||
* Watch input files.
|
||||
*/
|
||||
watch?: boolean | null;
|
||||
/**
|
||||
* Specify the polling strategy to use when the system runs out of or doesn't support native file watchers. Requires TypeScript version 3.8 or later.
|
||||
*/
|
||||
fallbackPolling?: 'fixedPollingInterval' | 'priorityPollingInterval' | 'dynamicPriorityPolling' | 'fixedInterval' | 'priorityInterval' | 'dynamicPriority' | 'fixedChunkSize';
|
||||
/**
|
||||
* Specify the strategy for watching directories under systems that lack recursive file-watching functionality. Requires TypeScript version 3.8 or later.
|
||||
*/
|
||||
watchDirectory?: 'useFsEvents' | 'fixedPollingInterval' | 'dynamicPriorityPolling' | 'fixedChunkSizePolling';
|
||||
/**
|
||||
* Specify the strategy for watching individual files. Requires TypeScript version 3.8 or later.
|
||||
*/
|
||||
watchFile?: 'fixedPollingInterval' | 'priorityPollingInterval' | 'dynamicPriorityPolling' | 'useFsEvents' | 'useFsEventsOnParentDirectory' | 'fixedChunkSizePolling';
|
||||
/**
|
||||
* Enable experimental support for TC39 stage 2 draft decorators.
|
||||
*/
|
||||
experimentalDecorators?: boolean | null;
|
||||
/**
|
||||
* Emit design-type metadata for decorated declarations in source files.
|
||||
*/
|
||||
emitDecoratorMetadata?: boolean | null;
|
||||
/**
|
||||
* Disable error reporting for unused labels.
|
||||
*/
|
||||
allowUnusedLabels?: boolean | null;
|
||||
/**
|
||||
* Enable error reporting for codepaths that do not explicitly return in a function.
|
||||
*/
|
||||
noImplicitReturns?: boolean | null;
|
||||
/**
|
||||
* Add `undefined` to a type when accessed using an index.
|
||||
*/
|
||||
noUncheckedIndexedAccess?: boolean | null;
|
||||
/**
|
||||
* Enable error reporting for fallthrough cases in switch statements.
|
||||
*/
|
||||
noFallthroughCasesInSwitch?: boolean | null;
|
||||
/**
|
||||
* Ensure overriding members in derived classes are marked with an override modifier.
|
||||
*/
|
||||
noImplicitOverride?: boolean | null;
|
||||
/**
|
||||
* Disable error reporting for unreachable code.
|
||||
*/
|
||||
allowUnreachableCode?: boolean | null;
|
||||
/**
|
||||
* Ensure that casing is correct in imports.
|
||||
*/
|
||||
forceConsistentCasingInFileNames?: boolean | null;
|
||||
/**
|
||||
* Emit a v8 CPU profile of the compiler run for debugging.
|
||||
*/
|
||||
generateCpuProfile?: string | null;
|
||||
/**
|
||||
* Specify the base directory to resolve non-relative module names.
|
||||
*/
|
||||
baseUrl?: string | null;
|
||||
/**
|
||||
* Specify a set of entries that re-map imports to additional lookup locations.
|
||||
*/
|
||||
paths?: {
|
||||
[k: string]: Array<string | null> | null;
|
||||
} | null;
|
||||
/**
|
||||
* Specify a list of language service plugins to include.
|
||||
*/
|
||||
plugins?: Array<{
|
||||
/**
|
||||
* Plugin name.
|
||||
*/
|
||||
name?: string | null;
|
||||
[k: string]: unknown;
|
||||
} | null> | null;
|
||||
/**
|
||||
* Allow multiple folders to be treated as one when resolving modules.
|
||||
*/
|
||||
rootDirs?: Array<string | null> | null;
|
||||
/**
|
||||
* Specify multiple folders that act like `./node_modules/@types`.
|
||||
*/
|
||||
typeRoots?: Array<string | null> | null;
|
||||
/**
|
||||
* Specify type package names to be included without being referenced in a source file.
|
||||
*/
|
||||
types?: Array<string | null> | null;
|
||||
/**
|
||||
* Enable tracing of the name resolution process. Requires TypeScript version 2.0 or later.
|
||||
*/
|
||||
traceResolution?: boolean | null;
|
||||
/**
|
||||
* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.
|
||||
*/
|
||||
allowJs?: boolean | null;
|
||||
/**
|
||||
* Disable truncating types in error messages.
|
||||
*/
|
||||
noErrorTruncation?: boolean | null;
|
||||
/**
|
||||
* Allow 'import x from y' when a module doesn't have a default export.
|
||||
*/
|
||||
allowSyntheticDefaultImports?: boolean | null;
|
||||
/**
|
||||
* Disable adding 'use strict' directives in emitted JavaScript files.
|
||||
*/
|
||||
noImplicitUseStrict?: boolean | null;
|
||||
/**
|
||||
* Print the names of emitted files after a compilation.
|
||||
*/
|
||||
listEmittedFiles?: boolean | null;
|
||||
/**
|
||||
* Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.
|
||||
*/
|
||||
disableSizeLimit?: boolean | null;
|
||||
/**
|
||||
* Specify a set of bundled library declaration files that describe the target runtime environment.
|
||||
*/
|
||||
lib?: Array<(('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.Intl' | '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.AsyncIterable' | 'DOM.Iterable' | 'ScriptHost' | 'WebWorker' | 'WebWorker.AsyncIterable' | 'WebWorker.ImportScripts' | 'Webworker.Iterable' | 'ES7' | 'ES2021' | 'ES2020.SharedMemory' | 'ES2020.Intl' | 'ES2020.Date' | 'ES2020.Number' | 'ES2021.Promise' | 'ES2021.String' | 'ES2021.WeakRef' | 'ESNext.WeakRef' | 'ES2021.Intl' | 'ES2022' | 'ES2022.Array' | 'ES2022.Error' | 'ES2022.Intl' | 'ES2022.Object' | 'ES2022.String' | 'ES2022.SharedMemory' | 'ES2022.RegExp' | 'ES2023' | 'ES2023.Array' | 'Decorators' | 'Decorators.Legacy' | 'ES2017.Date' | 'ES2023.Collection' | 'ESNext.Decorators' | 'ESNext.Disposable') | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
}) & (((('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.Intl' | '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.AsyncIterable' | 'DOM.Iterable' | 'ScriptHost' | 'WebWorker' | 'WebWorker.AsyncIterable' | 'WebWorker.ImportScripts' | 'Webworker.Iterable' | 'ES7' | 'ES2021' | 'ES2020.SharedMemory' | 'ES2020.Intl' | 'ES2020.Date' | 'ES2020.Number' | 'ES2021.Promise' | 'ES2021.String' | 'ES2021.WeakRef' | 'ESNext.WeakRef' | 'ES2021.Intl' | 'ES2022' | 'ES2022.Array' | 'ES2022.Error' | 'ES2022.Intl' | 'ES2022.Object' | 'ES2022.String' | 'ES2022.SharedMemory' | 'ES2022.RegExp' | 'ES2023' | 'ES2023.Array' | 'Decorators' | 'Decorators.Legacy' | 'ES2017.Date' | 'ES2023.Collection' | 'ESNext.Decorators' | 'ESNext.Disposable') | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
}) & string) | ((('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.Intl' | '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.AsyncIterable' | 'DOM.Iterable' | 'ScriptHost' | 'WebWorker' | 'WebWorker.AsyncIterable' | 'WebWorker.ImportScripts' | 'Webworker.Iterable' | 'ES7' | 'ES2021' | 'ES2020.SharedMemory' | 'ES2020.Intl' | 'ES2020.Date' | 'ES2020.Number' | 'ES2021.Promise' | 'ES2021.String' | 'ES2021.WeakRef' | 'ESNext.WeakRef' | 'ES2021.Intl' | 'ES2022' | 'ES2022.Array' | 'ES2022.Error' | 'ES2022.Intl' | 'ES2022.Object' | 'ES2022.String' | 'ES2022.SharedMemory' | 'ES2022.RegExp' | 'ES2023' | 'ES2023.Array' | 'Decorators' | 'Decorators.Legacy' | 'ES2017.Date' | 'ES2023.Collection' | 'ESNext.Decorators' | 'ESNext.Disposable') | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
} | {
|
||||
[k: string]: unknown;
|
||||
}) & null))> | null;
|
||||
/**
|
||||
* Specify how TypeScript determine a file as module.
|
||||
*/
|
||||
moduleDetection?: 'auto' | 'legacy' | 'force';
|
||||
/**
|
||||
* When type checking, take into account `null` and `undefined`.
|
||||
*/
|
||||
strictNullChecks?: boolean | null;
|
||||
/**
|
||||
* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`.
|
||||
*/
|
||||
maxNodeModuleJsDepth?: number | null;
|
||||
/**
|
||||
* Allow importing helper functions from tslib once per project, instead of including them per-file.
|
||||
*/
|
||||
importHelpers?: boolean | null;
|
||||
/**
|
||||
* Specify emit/checking behavior for imports that are only used for types.
|
||||
*/
|
||||
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error';
|
||||
/**
|
||||
* Ensure 'use strict' is always emitted.
|
||||
*/
|
||||
alwaysStrict?: boolean | null;
|
||||
/**
|
||||
* Enable all strict type checking options.
|
||||
*/
|
||||
strict?: boolean | null;
|
||||
/**
|
||||
* Check that the arguments for `bind`, `call`, and `apply` methods match the original function.
|
||||
*/
|
||||
strictBindCallApply?: boolean | null;
|
||||
/**
|
||||
* Emit more compliant, but verbose and less performant JavaScript for iteration.
|
||||
*/
|
||||
downlevelIteration?: boolean | null;
|
||||
/**
|
||||
* Enable error reporting in type-checked JavaScript files.
|
||||
*/
|
||||
checkJs?: boolean | null;
|
||||
/**
|
||||
* When assigning functions, check to ensure parameters and the return values are subtype-compatible.
|
||||
*/
|
||||
strictFunctionTypes?: boolean | null;
|
||||
/**
|
||||
* Check for class properties that are declared but not set in the constructor.
|
||||
*/
|
||||
strictPropertyInitialization?: boolean | null;
|
||||
/**
|
||||
* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility.
|
||||
*/
|
||||
esModuleInterop?: boolean | null;
|
||||
/**
|
||||
* Allow accessing UMD globals from modules.
|
||||
*/
|
||||
allowUmdGlobalAccess?: boolean | null;
|
||||
/**
|
||||
* Make keyof only return strings instead of string, numbers or symbols. Legacy option.
|
||||
*/
|
||||
keyofStringsOnly?: boolean | null;
|
||||
/**
|
||||
* Emit ECMAScript-standard-compliant class fields.
|
||||
*/
|
||||
useDefineForClassFields?: boolean | null;
|
||||
/**
|
||||
* Create sourcemaps for d.ts files.
|
||||
*/
|
||||
declarationMap?: boolean | null;
|
||||
/**
|
||||
* Enable importing .json files
|
||||
*/
|
||||
resolveJsonModule?: boolean | null;
|
||||
/**
|
||||
* Use the package.json 'exports' field when resolving package imports.
|
||||
*/
|
||||
resolvePackageJsonExports?: boolean | null;
|
||||
/**
|
||||
* Use the package.json 'imports' field when resolving imports.
|
||||
*/
|
||||
resolvePackageJsonImports?: boolean | null;
|
||||
/**
|
||||
* Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it. Requires TypeScript version 3.8 or later.
|
||||
*/
|
||||
assumeChangesOnlyAffectDirectDependencies?: boolean | null;
|
||||
/**
|
||||
* Output more detailed compiler performance information after building.
|
||||
*/
|
||||
extendedDiagnostics?: boolean | null;
|
||||
/**
|
||||
* Print names of files that are part of the compilation and then stop processing.
|
||||
*/
|
||||
listFilesOnly?: boolean | null;
|
||||
/**
|
||||
* Disable preferring source files instead of declaration files when referencing composite projects
|
||||
*/
|
||||
disableSourceOfProjectReferenceRedirect?: boolean | null;
|
||||
/**
|
||||
* Opt a project out of multi-project reference checking when editing.
|
||||
*/
|
||||
disableSolutionSearching?: boolean | null;
|
||||
/**
|
||||
* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting.
|
||||
*/
|
||||
verbatimModuleSyntax?: boolean | null;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
2
frontend/node_modules/ts-jest/dist/raw-compiler-options.js
generated
vendored
Normal file
2
frontend/node_modules/ts-jest/dist/raw-compiler-options.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
9
frontend/node_modules/ts-jest/dist/transformers/hoist-jest.d.ts
generated
vendored
Normal file
9
frontend/node_modules/ts-jest/dist/transformers/hoist-jest.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type _ts from 'typescript';
|
||||
import type { TsCompilerInstance } from '../types';
|
||||
/**
|
||||
* Remember to increase the version whenever transformer's content is changed. This is to inform Jest to not reuse
|
||||
* the previous cache which contains old transformer's content
|
||||
*/
|
||||
export declare const version = 4;
|
||||
export declare const name = "hoist-jest";
|
||||
export declare function factory({ configSet }: TsCompilerInstance): (ctx: _ts.TransformationContext) => _ts.Transformer<_ts.SourceFile>;
|
||||
111
frontend/node_modules/ts-jest/dist/transformers/hoist-jest.js
generated
vendored
Normal file
111
frontend/node_modules/ts-jest/dist/transformers/hoist-jest.js
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.name = exports.version = void 0;
|
||||
exports.factory = factory;
|
||||
const bs_logger_1 = require("bs-logger");
|
||||
/**
|
||||
* Remember to increase the version whenever transformer's content is changed. This is to inform Jest to not reuse
|
||||
* the previous cache which contains old transformer's content
|
||||
*/
|
||||
exports.version = 4;
|
||||
// Used for constructing cache key
|
||||
exports.name = 'hoist-jest';
|
||||
const HOIST_METHODS = ['mock', 'unmock', 'enableAutomock', 'disableAutomock', 'deepUnmock'];
|
||||
const JEST_GLOBALS_MODULE_NAME = '@jest/globals';
|
||||
const JEST_GLOBAL_NAME = 'jest';
|
||||
function factory({ configSet }) {
|
||||
const logger = configSet.logger.child({ namespace: exports.name });
|
||||
const ts = configSet.compilerModule;
|
||||
const importNamesOfJestObj = [];
|
||||
const isJestGlobalImport = (node) => {
|
||||
return (ts.isImportDeclaration(node) &&
|
||||
ts.isStringLiteral(node.moduleSpecifier) &&
|
||||
node.moduleSpecifier.text === JEST_GLOBALS_MODULE_NAME);
|
||||
};
|
||||
const shouldHoistExpression = (node) => {
|
||||
if (ts.isCallExpression(node) &&
|
||||
ts.isPropertyAccessExpression(node.expression) &&
|
||||
HOIST_METHODS.includes(node.expression.name.text)) {
|
||||
if (importNamesOfJestObj.length) {
|
||||
// @jest/globals is in used
|
||||
return ((ts.isIdentifier(node.expression.expression) &&
|
||||
importNamesOfJestObj.includes(node.expression.expression.text)) ||
|
||||
(ts.isPropertyAccessExpression(node.expression.expression) &&
|
||||
ts.isIdentifier(node.expression.expression.expression) &&
|
||||
importNamesOfJestObj.includes(node.expression.expression.expression.text)) ||
|
||||
shouldHoistExpression(node.expression.expression));
|
||||
}
|
||||
else {
|
||||
// @jest/globals is not in used
|
||||
return ((ts.isIdentifier(node.expression.expression) && node.expression.expression.text === JEST_GLOBAL_NAME) ||
|
||||
shouldHoistExpression(node.expression.expression));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Checks whether given node is a statement that we need to hoist
|
||||
*/
|
||||
const isHoistableStatement = (node) => {
|
||||
return ts.isExpressionStatement(node) && shouldHoistExpression(node.expression);
|
||||
};
|
||||
const canHoistInBlockScope = (node) => !!node.statements.find((stmt) => ts.isVariableStatement(stmt) &&
|
||||
stmt.declarationList.declarations.find((decl) => ts.isIdentifier(decl.name) && decl.name.text !== JEST_GLOBAL_NAME) &&
|
||||
node.statements.find((stmt) => isHoistableStatement(stmt)));
|
||||
/**
|
||||
* Sort statements according to priority
|
||||
* - Import Jest object from `@jest/globals`
|
||||
* - Hoistable methods
|
||||
* - Non-hoistable methods
|
||||
*/
|
||||
const sortStatements = (statements) => {
|
||||
if (statements.length <= 1) {
|
||||
return statements;
|
||||
}
|
||||
return statements.sort((stmtA, stmtB) => isJestGlobalImport(stmtA) ||
|
||||
(isHoistableStatement(stmtA) && !isHoistableStatement(stmtB) && !isJestGlobalImport(stmtB))
|
||||
? -1
|
||||
: 1);
|
||||
};
|
||||
const createVisitor = (ctx, _) => {
|
||||
const visitor = (node) => {
|
||||
const resultNode = ts.visitEachChild(node, visitor, ctx);
|
||||
// Since we use `visitEachChild`, we go upwards tree so all children node elements are checked first
|
||||
if (ts.isBlock(resultNode) && canHoistInBlockScope(resultNode)) {
|
||||
const newNodeArrayStatements = ts.factory.createNodeArray(sortStatements(resultNode.statements));
|
||||
return ts.factory.updateBlock(resultNode, newNodeArrayStatements);
|
||||
}
|
||||
else {
|
||||
if (ts.isSourceFile(resultNode)) {
|
||||
resultNode.statements.forEach((stmt) => {
|
||||
/**
|
||||
* Gather all possible import names, from different types of import syntax including:
|
||||
* - named import, e.g. `import { jest } from '@jest/globals'`
|
||||
* - aliased named import, e.g. `import {jest as aliasedJest} from '@jest/globals'`
|
||||
* - namespace import, e.g `import * as JestGlobals from '@jest/globals'`
|
||||
*/
|
||||
if (isJestGlobalImport(stmt) &&
|
||||
stmt.importClause?.namedBindings &&
|
||||
(ts.isNamespaceImport(stmt.importClause.namedBindings) ||
|
||||
ts.isNamedImports(stmt.importClause.namedBindings))) {
|
||||
const { namedBindings } = stmt.importClause;
|
||||
const jestImportName = ts.isNamespaceImport(namedBindings)
|
||||
? namedBindings.name.text
|
||||
: namedBindings.elements.find((element) => element.name.text === JEST_GLOBAL_NAME || element.propertyName?.text === JEST_GLOBAL_NAME)?.name.text;
|
||||
if (jestImportName) {
|
||||
importNamesOfJestObj.push(jestImportName);
|
||||
}
|
||||
}
|
||||
});
|
||||
const newNodeArrayStatements = ts.factory.createNodeArray(sortStatements(resultNode.statements));
|
||||
importNamesOfJestObj.length = 0;
|
||||
return ts.factory.updateSourceFile(resultNode, newNodeArrayStatements, resultNode.isDeclarationFile, resultNode.referencedFiles, resultNode.typeReferenceDirectives, resultNode.hasNoDefaultLib, resultNode.libReferenceDirectives);
|
||||
}
|
||||
return resultNode;
|
||||
}
|
||||
};
|
||||
return visitor;
|
||||
};
|
||||
// returns the transformer factory
|
||||
return (ctx) => logger.wrap({ [bs_logger_1.LogContexts.logLevel]: bs_logger_1.LogLevels.debug, call: null }, 'visitSourceFileNode(): hoist jest', (sf) => ts.visitNode(sf, createVisitor(ctx, sf)));
|
||||
}
|
||||
8
frontend/node_modules/ts-jest/dist/transpilers/typescript/transpile-module.d.ts
generated
vendored
Normal file
8
frontend/node_modules/ts-jest/dist/transpilers/typescript/transpile-module.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import ts from 'typescript';
|
||||
type ExtendedTranspileOptions = Omit<ts.TranspileOptions, 'transformers'> & {
|
||||
transformers?: (program: ts.Program) => ts.CustomTransformers;
|
||||
};
|
||||
type ExtendedTsTranspileModuleFn = (fileContent: string, transpileOptions: ExtendedTranspileOptions) => ts.TranspileOutput;
|
||||
export declare const isModernNodeModuleKind: (module: ts.ModuleKind | undefined) => boolean;
|
||||
export declare const tsTranspileModule: ExtendedTsTranspileModuleFn;
|
||||
export {};
|
||||
170
frontend/node_modules/ts-jest/dist/transpilers/typescript/transpile-module.js
generated
vendored
Normal file
170
frontend/node_modules/ts-jest/dist/transpilers/typescript/transpile-module.js
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.tsTranspileModule = exports.isModernNodeModuleKind = void 0;
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const typescript_1 = __importDefault(require("typescript"));
|
||||
const messages_1 = require("../../utils/messages");
|
||||
const barebonesLibContent = `/// <reference no-default-lib="true"/>
|
||||
interface Boolean {}
|
||||
interface Function {}
|
||||
interface CallableFunction {}
|
||||
interface NewableFunction {}
|
||||
interface IArguments {}
|
||||
interface Number {}
|
||||
interface Object {}
|
||||
interface RegExp {}
|
||||
interface String {}
|
||||
interface Array<T> { length: number; [n: number]: T; }
|
||||
interface SymbolConstructor {
|
||||
(desc?: string | number): symbol;
|
||||
for(name: string): symbol;
|
||||
readonly toStringTag: symbol;
|
||||
}
|
||||
declare var Symbol: SymbolConstructor;
|
||||
interface Symbol {
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
}`;
|
||||
const barebonesLibName = 'lib.d.ts';
|
||||
let barebonesLibSourceFile;
|
||||
const carriageReturnLineFeed = '\r\n';
|
||||
const lineFeed = '\n';
|
||||
function getNewLineCharacter(options) {
|
||||
switch (options.newLine) {
|
||||
case typescript_1.default.NewLineKind.CarriageReturnLineFeed:
|
||||
return carriageReturnLineFeed;
|
||||
case typescript_1.default.NewLineKind.LineFeed:
|
||||
default:
|
||||
return lineFeed;
|
||||
}
|
||||
}
|
||||
const isModernNodeModuleKind = (module) => {
|
||||
return module ? [typescript_1.default.ModuleKind.Node16, /* ModuleKind.Node18 */ 101, typescript_1.default.ModuleKind.NodeNext].includes(module) : false;
|
||||
};
|
||||
exports.isModernNodeModuleKind = isModernNodeModuleKind;
|
||||
const shouldCheckProjectPkgJsonContent = (fileName, moduleKind) => {
|
||||
return fileName.endsWith('package.json') && (0, exports.isModernNodeModuleKind)(moduleKind);
|
||||
};
|
||||
/**
|
||||
* Copy source code of {@link ts.transpileModule} from {@link https://github.com/microsoft/TypeScript/blob/main/src/services/transpile.ts}
|
||||
* with extra modifications:
|
||||
* - Remove generation of declaration files
|
||||
* - Allow using custom AST transformers with the internal created {@link Program}
|
||||
*/
|
||||
const transpileWorker = (input, transpileOptions) => {
|
||||
barebonesLibSourceFile ??= typescript_1.default.createSourceFile(barebonesLibName, barebonesLibContent, {
|
||||
languageVersion: typescript_1.default.ScriptTarget.Latest,
|
||||
});
|
||||
const diagnostics = [];
|
||||
const options = transpileOptions.compilerOptions
|
||||
? // @ts-expect-error internal TypeScript API
|
||||
typescript_1.default.fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics)
|
||||
: {};
|
||||
// mix in default options
|
||||
const defaultOptions = typescript_1.default.getDefaultCompilerOptions();
|
||||
for (const key in defaultOptions) {
|
||||
if (Object.hasOwn(defaultOptions, key) && options[key] === undefined) {
|
||||
options[key] = defaultOptions[key];
|
||||
}
|
||||
}
|
||||
// @ts-expect-error internal TypeScript API
|
||||
for (const option of typescript_1.default.transpileOptionValueCompilerOptions) {
|
||||
// Do not set redundant config options if `verbatimModuleSyntax` was supplied.
|
||||
if (options.verbatimModuleSyntax && new Set(['isolatedModules']).has(option.name)) {
|
||||
continue;
|
||||
}
|
||||
options[option.name] = option.transpileOptionValue;
|
||||
}
|
||||
// transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.
|
||||
options.suppressOutputPathCheck = true;
|
||||
// Filename can be non-ts file.
|
||||
options.allowNonTsExtensions = true;
|
||||
options.declaration = false;
|
||||
options.declarationMap = false;
|
||||
const newLine = getNewLineCharacter(options);
|
||||
// if jsx is specified then treat file as .tsx
|
||||
const inputFileName = transpileOptions.fileName ?? (transpileOptions.compilerOptions?.jsx ? 'module.tsx' : 'module.ts');
|
||||
// Create a compilerHost object to allow the compiler to read and write files
|
||||
const compilerHost = {
|
||||
getSourceFile: (fileName) => {
|
||||
// @ts-expect-error internal TypeScript API
|
||||
if (fileName === typescript_1.default.normalizePath(inputFileName)) {
|
||||
return sourceFile;
|
||||
}
|
||||
// @ts-expect-error internal TypeScript API
|
||||
return fileName === typescript_1.default.normalizePath(barebonesLibName) ? barebonesLibSourceFile : undefined;
|
||||
},
|
||||
writeFile: (name, text) => {
|
||||
if (node_path_1.default.extname(name) === '.map') {
|
||||
sourceMapText = text;
|
||||
}
|
||||
else {
|
||||
outputText = text;
|
||||
}
|
||||
},
|
||||
getDefaultLibFileName: () => barebonesLibName,
|
||||
useCaseSensitiveFileNames: () => false,
|
||||
getCanonicalFileName: (fileName) => fileName,
|
||||
getCurrentDirectory: () => '',
|
||||
getNewLine: () => newLine,
|
||||
fileExists: (fileName) => {
|
||||
if (shouldCheckProjectPkgJsonContent(fileName, options.module)) {
|
||||
return typescript_1.default.sys.fileExists(fileName);
|
||||
}
|
||||
return fileName === inputFileName;
|
||||
},
|
||||
readFile: (fileName) => {
|
||||
if (shouldCheckProjectPkgJsonContent(fileName, options.module)) {
|
||||
return typescript_1.default.sys.readFile(fileName);
|
||||
}
|
||||
return '';
|
||||
},
|
||||
directoryExists: () => true,
|
||||
getDirectories: () => [],
|
||||
};
|
||||
const sourceFile = typescript_1.default.createSourceFile(inputFileName, input, {
|
||||
languageVersion: options.target ?? typescript_1.default.ScriptTarget.ESNext,
|
||||
impliedNodeFormat: typescript_1.default.getImpliedNodeFormatForFile(inputFileName,
|
||||
/*packageJsonInfoCache*/ undefined, compilerHost, options),
|
||||
// @ts-expect-error internal TypeScript API
|
||||
setExternalModuleIndicator: typescript_1.default.getSetExternalModuleIndicator(options),
|
||||
jsDocParsingMode: transpileOptions.jsDocParsingMode ?? typescript_1.default.JSDocParsingMode.ParseAll,
|
||||
});
|
||||
if (transpileOptions.moduleName) {
|
||||
sourceFile.moduleName = transpileOptions.moduleName;
|
||||
}
|
||||
if (transpileOptions.renamedDependencies) {
|
||||
// @ts-expect-error internal TypeScript API
|
||||
sourceFile.renamedDependencies = new Map(Object.entries(transpileOptions.renamedDependencies));
|
||||
}
|
||||
// Output
|
||||
let outputText;
|
||||
let sourceMapText;
|
||||
const inputs = [inputFileName];
|
||||
const program = typescript_1.default.createProgram(inputs, options, compilerHost);
|
||||
if (transpileOptions.reportDiagnostics) {
|
||||
diagnostics.push(...program.getSyntacticDiagnostics(sourceFile));
|
||||
}
|
||||
diagnostics.push(...program.getOptionsDiagnostics());
|
||||
// Emit
|
||||
const result = program.emit(
|
||||
/*targetSourceFile*/ undefined,
|
||||
/*writeFile*/ undefined,
|
||||
/*cancellationToken*/ undefined,
|
||||
/*emitOnlyDtsFiles*/ undefined, transpileOptions.transformers?.(program));
|
||||
diagnostics.push(...result.diagnostics);
|
||||
if (outputText === undefined) {
|
||||
diagnostics.push({
|
||||
category: typescript_1.default.DiagnosticCategory.Error,
|
||||
code: messages_1.TsJestDiagnosticCodes.Generic,
|
||||
messageText: 'No output generated',
|
||||
file: sourceFile,
|
||||
start: 0,
|
||||
length: 0,
|
||||
});
|
||||
}
|
||||
return { outputText: outputText ?? '', diagnostics, sourceMapText };
|
||||
};
|
||||
exports.tsTranspileModule = transpileWorker;
|
||||
282
frontend/node_modules/ts-jest/dist/types.d.ts
generated
vendored
Normal file
282
frontend/node_modules/ts-jest/dist/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,282 @@
|
||||
import type { TransformedSource, TransformOptions } from '@jest/transform';
|
||||
import type { Config } from '@jest/types';
|
||||
import type * as _babel from 'babel__core';
|
||||
import type * as _ts from 'typescript';
|
||||
import type { TsConfigCompilerOptionsJson } from './config/types';
|
||||
import { ESM_JS_TRANSFORM_PATTERN, ESM_TS_JS_TRANSFORM_PATTERN, ESM_TS_TRANSFORM_PATTERN, JS_TRANSFORM_PATTERN, TS_JS_TRANSFORM_PATTERN, TS_TRANSFORM_PATTERN } from './constants';
|
||||
import type { ConfigSet } from './legacy/config/config-set';
|
||||
import type { RawCompilerOptions } from './raw-compiler-options';
|
||||
export type TTypeScript = typeof _ts;
|
||||
/**
|
||||
* Don't mark as internal because it is used in TsJestGlobalOptions which is an exposed type
|
||||
*/
|
||||
export type BabelConfig = _babel.TransformOptions;
|
||||
export interface AstTransformer<T = Record<string, unknown>> {
|
||||
path: string;
|
||||
options?: T;
|
||||
}
|
||||
export interface ConfigCustomTransformer {
|
||||
before?: Array<string | AstTransformer>;
|
||||
after?: Array<string | AstTransformer>;
|
||||
afterDeclarations?: Array<string | AstTransformer>;
|
||||
}
|
||||
/**
|
||||
* @deprecated use {@link TsJestTransformerOptions} instead
|
||||
*/
|
||||
export type TsJestGlobalOptions = Config.TransformerConfig[1] & {
|
||||
/**
|
||||
* Compiler options. It can be:
|
||||
* - `true` (or `undefined`, it's the default): use default tsconfig file
|
||||
* - `false`: do NOT use default config file
|
||||
* - `path/to/tsconfig.json`: path to a specific tsconfig file (<rootDir> can be used)
|
||||
* - `{...}`: an object with inline compiler options
|
||||
*
|
||||
* @default `undefined` (the default config file will be used if it exists)
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* {@link RawCompilerOptions} will be replaced with {@link TsConfigCompilerOptionsJson} in the next major release
|
||||
*/
|
||||
tsconfig?: boolean | string | RawCompilerOptions | TsConfigCompilerOptionsJson;
|
||||
/**
|
||||
* @deprecated use {@link TsConfigCompilerOptionsJson.isolatedModules} instead
|
||||
*
|
||||
* Compiles files as isolated modules (disables some features)
|
||||
*
|
||||
* @default `undefined` (disables transpiling files with {@link _ts.transpileModule})
|
||||
*/
|
||||
isolatedModules?: boolean;
|
||||
/**
|
||||
* Compiler to use
|
||||
*
|
||||
* @default `typescript`
|
||||
*/
|
||||
compiler?: 'typescript' | 'ttypescript' | string;
|
||||
/**
|
||||
* Custom transformers (mostly used by jest presets)
|
||||
*/
|
||||
astTransformers?: ConfigCustomTransformer;
|
||||
/**
|
||||
* TS diagnostics - less to be reported if `isolatedModules` is `true`. It can be:
|
||||
* - `true` (or `undefined`, it's the default): show all diagnostics
|
||||
* - `false`: hide diagnostics of all files (kind of useless)
|
||||
* - `{...}`: an inline object with fine grained settings
|
||||
*
|
||||
* @default `undefined`
|
||||
*/
|
||||
diagnostics?: boolean | {
|
||||
/**
|
||||
* Enables colorful and pretty output of errors
|
||||
*
|
||||
* @default `undefined` (enables formatting errors)
|
||||
*/
|
||||
pretty?: boolean;
|
||||
/**
|
||||
* List of TypeScript diagnostic error codes to ignore
|
||||
* [here](https://github.com/Microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json).
|
||||
*
|
||||
* @see https://github.com/Microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json
|
||||
* @default `[6059,18002,18003]`
|
||||
*/
|
||||
ignoreCodes?: number | string | Array<number | string>;
|
||||
/**
|
||||
* If specified, diagnostics of source files which path **matches** will be ignored
|
||||
*/
|
||||
exclude?: string[];
|
||||
/**
|
||||
* Logs TypeScript errors to stderr instead of throwing exceptions
|
||||
*
|
||||
* @default `undefined` (TypeScript errors will be thrown as exceptions)
|
||||
*/
|
||||
warnOnly?: boolean;
|
||||
};
|
||||
/**
|
||||
* Babel config. It can be:
|
||||
* - `false` (or `undefined`, it's the default): do NOT use babel
|
||||
* - `true`: use babel using default babelrc file
|
||||
* - `path/to/.babelrc`: path to a babelrc file (<rootDir> can be used)
|
||||
* - `{...}`: an object with inline babel options
|
||||
*
|
||||
* @default `undefined` (not using `Babel`)
|
||||
*/
|
||||
babelConfig?: boolean | string | BabelConfig;
|
||||
/**
|
||||
* Kept for backward compatibility to handle __TRANSFORM_HTML__
|
||||
* Any file which will match this regex will be transpiled as a module
|
||||
* exporting the content of the file as a string
|
||||
*/
|
||||
stringifyContentPathRegex?: string | RegExp;
|
||||
/**
|
||||
* Tell `ts-jest` to transform codes to ESM format. This only works in combination with `jest-runtime` ESM option
|
||||
* `supportsStaticESM` true which is passed into Jest transformer
|
||||
*/
|
||||
useESM?: boolean;
|
||||
};
|
||||
/**
|
||||
* For transformers which extends `ts-jest`
|
||||
* @deprecated use `JestConfigWithTsJest` instead
|
||||
*/
|
||||
export interface ProjectConfigTsJest extends Config.ProjectConfig {
|
||||
globals: GlobalConfigTsJest;
|
||||
}
|
||||
/**
|
||||
* @deprecated use `JestConfigWithTsJest` instead
|
||||
*/
|
||||
export interface TransformOptionsTsJest<TransformerConfig = unknown> extends TransformOptions<TransformerConfig> {
|
||||
config: Config.ProjectConfig;
|
||||
}
|
||||
/**
|
||||
* For typings in `jest.config.ts`
|
||||
* @deprecated use `JestConfigWithTsJest` instead
|
||||
*/
|
||||
export interface GlobalConfigTsJest extends Config.ConfigGlobals {
|
||||
'ts-jest'?: TsJestGlobalOptions;
|
||||
}
|
||||
/**
|
||||
* @deprecated use `JestConfigWithTsJest` instead
|
||||
*/
|
||||
export interface InitialOptionsTsJest extends Config.InitialOptions {
|
||||
globals?: GlobalConfigTsJest;
|
||||
}
|
||||
export type TsJestTransformerOptions = TsJestGlobalOptions;
|
||||
export type TsJestTransformOptions = TransformOptions<TsJestTransformerOptions>;
|
||||
export interface JestConfigWithTsJest extends Omit<Config.InitialOptions, 'transform'> {
|
||||
transform?: {
|
||||
[regex: string]: 'ts-jest' | 'ts-jest/legacy' | ['ts-jest', TsJestTransformerOptions] | ['ts-jest/legacy', TsJestTransformerOptions];
|
||||
} | Config.InitialOptions['transform'];
|
||||
}
|
||||
export type StringMap = Map<string, string>;
|
||||
export interface DepGraphInfo {
|
||||
fileContent: string;
|
||||
resolvedModuleNames: string[];
|
||||
}
|
||||
export interface TsJestCompileOptions {
|
||||
depGraphs: Map<string, DepGraphInfo>;
|
||||
watchMode: boolean;
|
||||
supportsStaticESM: boolean;
|
||||
}
|
||||
export interface CompiledOutput extends TransformedSource {
|
||||
diagnostics?: _ts.Diagnostic[];
|
||||
}
|
||||
export interface CompilerInstance {
|
||||
getResolvedModules(fileContent: string, fileName: string, runtimeCacheFS: StringMap): string[];
|
||||
getCompiledOutput(fileContent: string, fileName: string, options: TsJestCompileOptions): CompiledOutput;
|
||||
}
|
||||
export interface TsCompilerInstance extends CompilerInstance {
|
||||
configSet: ConfigSet;
|
||||
program: _ts.Program | undefined;
|
||||
}
|
||||
export interface AstTransformerDesc<T = Record<string, unknown>> {
|
||||
name: string;
|
||||
version: number;
|
||||
factory(tsCompiler: TsCompilerInstance, opts?: T): _ts.TransformerFactory<_ts.SourceFile> | _ts.TransformerFactory<_ts.Bundle | _ts.SourceFile>;
|
||||
options?: T;
|
||||
}
|
||||
export interface TsJestAstTransformer {
|
||||
before: AstTransformerDesc[];
|
||||
after: AstTransformerDesc[];
|
||||
afterDeclarations: AstTransformerDesc[];
|
||||
}
|
||||
/**
|
||||
* @deprecated use other preset types below instead
|
||||
*/
|
||||
export type TsJestPresets = Pick<JestConfigWithTsJest, 'extensionsToTreatAsEsm' | 'moduleFileExtensions' | 'transform' | 'testMatch'>;
|
||||
export type DefaultTransformOptions = Omit<TsJestTransformerOptions, 'useESM'>;
|
||||
export type DefaultPreset = {
|
||||
transform: {
|
||||
[TS_TRANSFORM_PATTERN]: ['ts-jest', DefaultTransformOptions];
|
||||
};
|
||||
};
|
||||
export type DefaultLegacyPreset = {
|
||||
transform: {
|
||||
[TS_TRANSFORM_PATTERN]: ['ts-jest/legacy', DefaultTransformOptions];
|
||||
};
|
||||
};
|
||||
export type DefaultEsmTransformOptions = Omit<TsJestTransformerOptions, 'useESM'>;
|
||||
export type DefaultEsmPreset = {
|
||||
extensionsToTreatAsEsm: string[];
|
||||
transform: {
|
||||
[ESM_TS_TRANSFORM_PATTERN]: ['ts-jest', {
|
||||
useESM: true;
|
||||
} & DefaultEsmTransformOptions];
|
||||
};
|
||||
};
|
||||
export type DefaultEsmLegacyPreset = {
|
||||
extensionsToTreatAsEsm: string[];
|
||||
transform: {
|
||||
[ESM_TS_TRANSFORM_PATTERN]: ['ts-jest/legacy', {
|
||||
useESM: true;
|
||||
} & DefaultEsmTransformOptions];
|
||||
};
|
||||
};
|
||||
export type JsWithTsTransformOptions = Omit<TsJestTransformerOptions, 'useESM'>;
|
||||
export type JsWithTsPreset = {
|
||||
transform: {
|
||||
[TS_JS_TRANSFORM_PATTERN]: ['ts-jest', JsWithTsTransformOptions];
|
||||
};
|
||||
};
|
||||
export type JsWithTsLegacyPreset = {
|
||||
transform: {
|
||||
[TS_JS_TRANSFORM_PATTERN]: ['ts-jest/legacy', JsWithTsTransformOptions];
|
||||
};
|
||||
};
|
||||
export type JsWithTsEsmTransformOptions = Omit<TsJestTransformerOptions, 'useESM'>;
|
||||
export type JsWithTsEsmPreset = {
|
||||
extensionsToTreatAsEsm: string[];
|
||||
transform: {
|
||||
[ESM_TS_JS_TRANSFORM_PATTERN]: ['ts-jest', {
|
||||
useESM: true;
|
||||
} & JsWithTsEsmTransformOptions];
|
||||
};
|
||||
};
|
||||
export type JsWithTsEsmLegacyPreset = {
|
||||
extensionsToTreatAsEsm: string[];
|
||||
transform: {
|
||||
[ESM_TS_JS_TRANSFORM_PATTERN]: ['ts-jest/legacy', {
|
||||
useESM: true;
|
||||
} & JsWithTsEsmTransformOptions];
|
||||
};
|
||||
};
|
||||
export type JsWithBabelTransformerOptions = Omit<TsJestTransformerOptions, 'useESM'>;
|
||||
export type JsWithBabelPreset = {
|
||||
transform: {
|
||||
[JS_TRANSFORM_PATTERN]: 'babel-jest';
|
||||
[TS_TRANSFORM_PATTERN]: ['ts-jest', JsWithBabelTransformerOptions];
|
||||
};
|
||||
};
|
||||
export type JsWithBabelLegacyPreset = {
|
||||
transform: {
|
||||
[JS_TRANSFORM_PATTERN]: 'babel-jest';
|
||||
[TS_TRANSFORM_PATTERN]: ['ts-jest/legacy', JsWithBabelTransformerOptions];
|
||||
};
|
||||
};
|
||||
export type JsWithBabelEsmTransformOptions = Omit<TsJestTransformerOptions, 'useESM'>;
|
||||
export type JsWithBabelEsmPreset = {
|
||||
extensionsToTreatAsEsm: string[];
|
||||
transform: {
|
||||
[ESM_JS_TRANSFORM_PATTERN]: 'babel-jest';
|
||||
[ESM_TS_TRANSFORM_PATTERN]: ['ts-jest', {
|
||||
useESM: true;
|
||||
} & JsWithBabelEsmTransformOptions];
|
||||
};
|
||||
};
|
||||
export type JsWithBabelEsmLegacyPreset = {
|
||||
extensionsToTreatAsEsm: string[];
|
||||
transform: {
|
||||
[ESM_JS_TRANSFORM_PATTERN]: 'babel-jest';
|
||||
[ESM_TS_TRANSFORM_PATTERN]: ['ts-jest/legacy', {
|
||||
useESM: true;
|
||||
} & JsWithBabelEsmTransformOptions];
|
||||
};
|
||||
};
|
||||
declare module '@jest/types' {
|
||||
namespace Config {
|
||||
interface ConfigGlobals {
|
||||
/**
|
||||
* strangely `@ts-expect-error` doesn't work in this case when running
|
||||
* `npm run build` vs `npm run pretest`
|
||||
*/
|
||||
'ts-jest'?: TsJestTransformerOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
frontend/node_modules/ts-jest/dist/types.js
generated
vendored
Normal file
3
frontend/node_modules/ts-jest/dist/types.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("./constants");
|
||||
1
frontend/node_modules/ts-jest/dist/utils/backports.d.ts
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/dist/utils/backports.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
118
frontend/node_modules/ts-jest/dist/utils/backports.js
generated
vendored
Normal file
118
frontend/node_modules/ts-jest/dist/utils/backports.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.backportTsJestDebugEnvVar = exports.backportJestConfig = void 0;
|
||||
const bs_logger_1 = require("bs-logger");
|
||||
const messages_1 = require("./messages");
|
||||
const context = { [bs_logger_1.LogContexts.namespace]: 'backports' };
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const backportJestConfig = (logger, config) => {
|
||||
logger.debug({ ...context, config }, 'backporting config');
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const { globals = {} } = (config || {});
|
||||
const { 'ts-jest': tsJest = {} } = globals;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const mergeTsJest = {};
|
||||
let hadWarnings = false;
|
||||
const warnConfig = (oldPath, newPath, note) => {
|
||||
hadWarnings = true;
|
||||
logger.warn(context, (0, messages_1.interpolate)(note ? "\"[jest-config].{{oldPath}}\" is deprecated, use \"[jest-config].{{newPath}}\" instead.\n \u21B3 {{note}}" /* Deprecations.ConfigOptionWithNote */ : "\"[jest-config].{{oldPath}}\" is deprecated, use \"[jest-config].{{newPath}}\" instead." /* Deprecations.ConfigOption */, {
|
||||
oldPath,
|
||||
newPath,
|
||||
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 ('tsConfig' in tsJest) {
|
||||
warnConfig('globals.ts-jest.tsConfig', 'globals.ts-jest.tsconfig');
|
||||
if (tsJest.tsConfig) {
|
||||
mergeTsJest.tsconfig = tsJest.tsConfig;
|
||||
}
|
||||
delete tsJest.tsConfig;
|
||||
}
|
||||
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.exclude = [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" /* Deprecations.ConfigOptionUseBabelRcNote */);
|
||||
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 we had some warnings we can inform the user about the CLI tool
|
||||
if (hadWarnings) {
|
||||
logger.warn(context, "Your Jest configuration is outdated. Use the CLI to help migrating it: ts-jest config:migrate <config-file>." /* Helps.MigrateConfigUsingCLI */);
|
||||
}
|
||||
return {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
...config,
|
||||
globals: {
|
||||
...globals,
|
||||
'ts-jest': {
|
||||
...mergeTsJest,
|
||||
...tsJest,
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.backportJestConfig = backportJestConfig;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const backportTsJestDebugEnvVar = (logger) => {
|
||||
if ('TS_JEST_DEBUG' in process.env) {
|
||||
const 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, (0, messages_1.interpolate)("Using env. var \"{{old}}\" is deprecated, use \"{{new}}\" instead." /* Deprecations.EnvVar */, {
|
||||
old: 'TS_JEST_DEBUG',
|
||||
new: 'TS_JEST_LOG',
|
||||
}));
|
||||
}
|
||||
};
|
||||
exports.backportTsJestDebugEnvVar = backportTsJestDebugEnvVar;
|
||||
1
frontend/node_modules/ts-jest/dist/utils/get-package-version.d.ts
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/dist/utils/get-package-version.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
14
frontend/node_modules/ts-jest/dist/utils/get-package-version.js
generated
vendored
Normal file
14
frontend/node_modules/ts-jest/dist/utils/get-package-version.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getPackageVersion = getPackageVersion;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function getPackageVersion(moduleName) {
|
||||
try {
|
||||
return require(`${moduleName}/package.json`).version;
|
||||
}
|
||||
catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
1
frontend/node_modules/ts-jest/dist/utils/importer.d.ts
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/dist/utils/importer.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
146
frontend/node_modules/ts-jest/dist/utils/importer.js
generated
vendored
Normal file
146
frontend/node_modules/ts-jest/dist/utils/importer.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
"use strict";
|
||||
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;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.importer = exports.Importer = void 0;
|
||||
exports.__requireModule = __requireModule;
|
||||
const logger_1 = require("./logger");
|
||||
const memoize_1 = require("./memoize");
|
||||
const messages_1 = require("./messages");
|
||||
const logger = logger_1.rootLogger.child({ namespace: 'Importer' });
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class Importer {
|
||||
static get instance() {
|
||||
logger.debug('creating Importer singleton');
|
||||
return new Importer();
|
||||
}
|
||||
babelJest(why) {
|
||||
return this._import(why, 'babel-jest');
|
||||
}
|
||||
babelCore(why) {
|
||||
return this._import(why, '@babel/core');
|
||||
}
|
||||
typescript(why, which) {
|
||||
return this._import(why, which);
|
||||
}
|
||||
esBuild(why) {
|
||||
return this._import(why, 'esbuild');
|
||||
}
|
||||
tryThese(moduleName, ...fallbacks) {
|
||||
let name;
|
||||
let loaded;
|
||||
const tries = [moduleName, ...fallbacks];
|
||||
while ((name = tries.shift()) !== undefined) {
|
||||
const req = requireWrapper(name);
|
||||
// remove exports from what we're going to log
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const contextReq = { ...req };
|
||||
delete contextReq.exports;
|
||||
if (req.exists) {
|
||||
// module exists
|
||||
loaded = req;
|
||||
if (req.error) {
|
||||
logger.error({ requireResult: contextReq }, `failed loading module '${name}'`, req.error.message);
|
||||
}
|
||||
else {
|
||||
logger.debug({ requireResult: contextReq }, 'loaded module', name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// module does not exists in the path
|
||||
logger.debug({ requireResult: contextReq }, `module '${name}' not found`);
|
||||
}
|
||||
}
|
||||
// return the loaded one, could be one that has been loaded, or one which has failed during load
|
||||
// but not one which does not exists
|
||||
return loaded;
|
||||
}
|
||||
tryTheseOr(moduleNames, missingResult, allowLoadError = false) {
|
||||
const args = Array.isArray(moduleNames) ? moduleNames : [moduleNames];
|
||||
const result = this.tryThese(...args);
|
||||
if (!result)
|
||||
return missingResult;
|
||||
if (!result.error)
|
||||
return result.exports;
|
||||
if (allowLoadError)
|
||||
return missingResult;
|
||||
throw result.error;
|
||||
}
|
||||
_import(why, moduleName, { alternatives = [], installTip = moduleName } = {}) {
|
||||
// try to load any of the alternative after trying main one
|
||||
const res = this.tryThese(moduleName, ...alternatives);
|
||||
// if we could load one, return it
|
||||
if (res?.exists) {
|
||||
if (!res.error)
|
||||
return res.exports;
|
||||
// it could not load because of a failure while importing, but it exists
|
||||
throw new Error((0, messages_1.interpolate)("Loading module {{module}} failed with error: {{error}}" /* Errors.LoadingModuleFailed */, { module: res.given, error: res.error.message }));
|
||||
}
|
||||
// if it couldn't load, build a nice error message so the user can fix it by himself
|
||||
const msg = alternatives.length ? "Unable to load any of these modules: {{module}}. {{reason}}. To fix it:\n{{fix}}" /* Errors.UnableToLoadAnyModule */ : "Unable to load the module {{module}}. {{reason}} To fix it:\n{{fix}}" /* Errors.UnableToLoadOneModule */;
|
||||
const loadModule = [moduleName, ...alternatives].map((m) => `"${m}"`).join(', ');
|
||||
if (typeof installTip === 'string') {
|
||||
installTip = [{ module: installTip, label: `install "${installTip}"` }];
|
||||
}
|
||||
const fix = installTip
|
||||
.map((tip) => ` ${installTip.length === 1 ? '↳' : '•'} ${(0, messages_1.interpolate)("{{label}}: `npm i -D {{module}}` (or `yarn add --dev {{module}}`)" /* Helps.FixMissingModule */, tip)}`)
|
||||
.join('\n');
|
||||
throw new Error((0, messages_1.interpolate)(msg, {
|
||||
module: loadModule,
|
||||
reason: why,
|
||||
fix,
|
||||
}));
|
||||
}
|
||||
}
|
||||
exports.Importer = Importer;
|
||||
__decorate([
|
||||
(0, memoize_1.Memoize)((...args) => args.join(':'))
|
||||
], Importer.prototype, "tryThese", null);
|
||||
__decorate([
|
||||
(0, memoize_1.Memoize)()
|
||||
], Importer, "instance", null);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
exports.importer = Importer.instance;
|
||||
function requireWrapper(moduleName) {
|
||||
let path;
|
||||
let exists = false;
|
||||
try {
|
||||
path = resolveModule(moduleName);
|
||||
exists = true;
|
||||
}
|
||||
catch (error) {
|
||||
return { error: error, exists, given: moduleName };
|
||||
}
|
||||
const result = { exists, path, given: moduleName };
|
||||
try {
|
||||
result.exports = requireModule(path);
|
||||
}
|
||||
catch {
|
||||
try {
|
||||
result.exports = requireModule(moduleName);
|
||||
}
|
||||
catch (error) {
|
||||
result.error = error;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
let requireModule = (mod) => require(mod);
|
||||
let resolveModule = (mod) => require.resolve(mod, { paths: [process.cwd(), __dirname] });
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
// so that we can test easier
|
||||
function __requireModule(localRequire, localResolve) {
|
||||
requireModule = localRequire;
|
||||
resolveModule = localResolve;
|
||||
}
|
||||
3
frontend/node_modules/ts-jest/dist/utils/index.d.ts
generated
vendored
Normal file
3
frontend/node_modules/ts-jest/dist/utils/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './json';
|
||||
export * from './jsonable-value';
|
||||
export * from './logger';
|
||||
19
frontend/node_modules/ts-jest/dist/utils/index.js
generated
vendored
Normal file
19
frontend/node_modules/ts-jest/dist/utils/index.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./json"), exports);
|
||||
__exportStar(require("./jsonable-value"), exports);
|
||||
__exportStar(require("./logger"), exports);
|
||||
2
frontend/node_modules/ts-jest/dist/utils/json.d.ts
generated
vendored
Normal file
2
frontend/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;
|
||||
16
frontend/node_modules/ts-jest/dist/utils/json.js
generated
vendored
Normal file
16
frontend/node_modules/ts-jest/dist/utils/json.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stringify = stringify;
|
||||
exports.parse = parse;
|
||||
const fast_json_stable_stringify_1 = __importDefault(require("fast-json-stable-stringify"));
|
||||
const UNDEFINED = 'undefined';
|
||||
function stringify(input) {
|
||||
return input === undefined ? UNDEFINED : (0, fast_json_stable_stringify_1.default)(input);
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function parse(input) {
|
||||
return input === UNDEFINED ? undefined : JSON.parse(input);
|
||||
}
|
||||
10
frontend/node_modules/ts-jest/dist/utils/jsonable-value.d.ts
generated
vendored
Normal file
10
frontend/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;
|
||||
}
|
||||
29
frontend/node_modules/ts-jest/dist/utils/jsonable-value.js
generated
vendored
Normal file
29
frontend/node_modules/ts-jest/dist/utils/jsonable-value.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.JsonableValue = void 0;
|
||||
const json_1 = require("./json");
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
class JsonableValue {
|
||||
_serialized;
|
||||
_value;
|
||||
constructor(value) {
|
||||
this.value = value;
|
||||
}
|
||||
set value(value) {
|
||||
this._value = value;
|
||||
this._serialized = (0, json_1.stringify)(value);
|
||||
}
|
||||
get value() {
|
||||
return this._value;
|
||||
}
|
||||
get serialized() {
|
||||
return this._serialized;
|
||||
}
|
||||
valueOf() {
|
||||
return this._value;
|
||||
}
|
||||
toString() {
|
||||
return this._serialized;
|
||||
}
|
||||
}
|
||||
exports.JsonableValue = JsonableValue;
|
||||
1
frontend/node_modules/ts-jest/dist/utils/logger.d.ts
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/dist/utils/logger.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare let rootLogger: import("bs-logger").Logger;
|
||||
20
frontend/node_modules/ts-jest/dist/utils/logger.js
generated
vendored
Normal file
20
frontend/node_modules/ts-jest/dist/utils/logger.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.rootLogger = void 0;
|
||||
const bs_logger_1 = require("bs-logger");
|
||||
const backports_1 = require("./backports");
|
||||
const original = process.env.TS_JEST_LOG;
|
||||
const buildOptions = () => ({
|
||||
context: {
|
||||
[bs_logger_1.LogContexts.package]: 'ts-jest',
|
||||
[bs_logger_1.LogContexts.logLevel]: bs_logger_1.LogLevels.trace,
|
||||
version: require('../../package.json').version,
|
||||
},
|
||||
targets: process.env.TS_JEST_LOG ?? undefined,
|
||||
});
|
||||
exports.rootLogger = (0, bs_logger_1.createLogger)(buildOptions());
|
||||
(0, backports_1.backportTsJestDebugEnvVar)(exports.rootLogger);
|
||||
// re-create the logger if the env var has been backported
|
||||
if (original !== process.env.TS_JEST_LOG) {
|
||||
exports.rootLogger = (0, bs_logger_1.createLogger)(buildOptions());
|
||||
}
|
||||
1
frontend/node_modules/ts-jest/dist/utils/memoize.d.ts
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/dist/utils/memoize.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
60
frontend/node_modules/ts-jest/dist/utils/memoize.js
generated
vendored
Normal file
60
frontend/node_modules/ts-jest/dist/utils/memoize.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Memoize = Memoize;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const cacheProp = Symbol.for('[memoize]');
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function Memoize(keyBuilder) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return (_, propertyKey, descriptor) => {
|
||||
if (descriptor.value != null) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
descriptor.value = memoize(propertyKey, descriptor.value, keyBuilder || ((v) => v));
|
||||
}
|
||||
else if (descriptor.get != null) {
|
||||
descriptor.get = memoize(propertyKey, descriptor.get, keyBuilder || (() => propertyKey));
|
||||
}
|
||||
};
|
||||
}
|
||||
// See https://github.com/microsoft/TypeScript/issues/1863#issuecomment-579541944
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function ensureCache(target, reset = false) {
|
||||
if (reset || !target[cacheProp]) {
|
||||
Object.defineProperty(target, cacheProp, {
|
||||
value: Object.create(null),
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
return target[cacheProp];
|
||||
}
|
||||
// See https://github.com/microsoft/TypeScript/issues/1863#issuecomment-579541944
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function ensureChildCache(target, key, reset = false) {
|
||||
const dict = ensureCache(target);
|
||||
if (reset || !dict[key]) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
dict[key] = new Map();
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return dict[key];
|
||||
}
|
||||
function memoize(namespace,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
func,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
keyBuilder) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return function (...args) {
|
||||
const cache = ensureChildCache(this, namespace);
|
||||
const key = keyBuilder.apply(this, args);
|
||||
if (cache.has(key))
|
||||
return cache.get(key);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const res = func.apply(this, args);
|
||||
cache.set(key, res);
|
||||
return res;
|
||||
};
|
||||
}
|
||||
4
frontend/node_modules/ts-jest/dist/utils/messages.d.ts
generated
vendored
Normal file
4
frontend/node_modules/ts-jest/dist/utils/messages.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export declare const TsJestDiagnosticCodes: {
|
||||
readonly Generic: 151000;
|
||||
readonly ConfigModuleOption: 151001;
|
||||
};
|
||||
16
frontend/node_modules/ts-jest/dist/utils/messages.js
generated
vendored
Normal file
16
frontend/node_modules/ts-jest/dist/utils/messages.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TsJestDiagnosticCodes = void 0;
|
||||
exports.interpolate = interpolate;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function interpolate(msg, vars = {}) {
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
return msg.replace(/\{\{([^\}]+)\}\}/g, (_, key) => (key in vars ? vars[key] : _));
|
||||
}
|
||||
exports.TsJestDiagnosticCodes = {
|
||||
Generic: 151000,
|
||||
ConfigModuleOption: 151001,
|
||||
};
|
||||
1
frontend/node_modules/ts-jest/dist/utils/normalize-slashes.d.ts
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/dist/utils/normalize-slashes.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
9
frontend/node_modules/ts-jest/dist/utils/normalize-slashes.js
generated
vendored
Normal file
9
frontend/node_modules/ts-jest/dist/utils/normalize-slashes.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.normalizeSlashes = normalizeSlashes;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function normalizeSlashes(value) {
|
||||
return value.replace(/\\/g, '/');
|
||||
}
|
||||
1
frontend/node_modules/ts-jest/dist/utils/sha1.d.ts
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/dist/utils/sha1.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
38
frontend/node_modules/ts-jest/dist/utils/sha1.js
generated
vendored
Normal file
38
frontend/node_modules/ts-jest/dist/utils/sha1.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.cache = void 0;
|
||||
exports.sha1 = sha1;
|
||||
const crypto_1 = require("crypto");
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
// stores hashes made out of only one argument being a string
|
||||
exports.cache = Object.create(null);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function sha1(...data) {
|
||||
const canCache = data.length === 1 && typeof data[0] === 'string';
|
||||
// caching
|
||||
let cacheKey;
|
||||
if (canCache) {
|
||||
cacheKey = data[0];
|
||||
if (cacheKey in exports.cache) {
|
||||
return exports.cache[cacheKey];
|
||||
}
|
||||
}
|
||||
// we use SHA1 because it's the fastest provided by node
|
||||
// and we are not concerned about security here
|
||||
const hash = (0, crypto_1.createHash)('sha1');
|
||||
data.forEach((item) => {
|
||||
if (typeof item === 'string')
|
||||
hash.update(item, 'utf8');
|
||||
else
|
||||
hash.update(item);
|
||||
});
|
||||
const res = hash.digest('hex').toString();
|
||||
if (canCache) {
|
||||
exports.cache[cacheKey] = res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
1
frontend/node_modules/ts-jest/dist/utils/ts-error.d.ts
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/dist/utils/ts-error.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
37
frontend/node_modules/ts-jest/dist/utils/ts-error.js
generated
vendored
Normal file
37
frontend/node_modules/ts-jest/dist/utils/ts-error.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TSError = exports.INSPECT_CUSTOM = void 0;
|
||||
const util_1 = require("util");
|
||||
const make_error_1 = require("make-error");
|
||||
const logger_1 = require("./logger");
|
||||
const messages_1 = require("./messages");
|
||||
const logger = logger_1.rootLogger.child({ namespace: 'TSError' });
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
exports.INSPECT_CUSTOM = util_1.inspect.custom || 'inspect';
|
||||
/**
|
||||
* TypeScript diagnostics error.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class TSError extends make_error_1.BaseError {
|
||||
diagnosticText;
|
||||
diagnosticCodes;
|
||||
name = 'TSError';
|
||||
constructor(diagnosticText, diagnosticCodes) {
|
||||
super((0, messages_1.interpolate)("{{diagnostics}}" /* Errors.UnableToCompileTypeScript */, {
|
||||
diagnostics: diagnosticText.trim(),
|
||||
}));
|
||||
this.diagnosticText = diagnosticText;
|
||||
this.diagnosticCodes = diagnosticCodes;
|
||||
logger.debug({ diagnosticCodes, diagnosticText }, 'created new TSError');
|
||||
// ensure we blacklist any of our code
|
||||
Object.defineProperty(this, 'stack', { value: '' });
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
[exports.INSPECT_CUSTOM]() {
|
||||
return this.diagnosticText;
|
||||
}
|
||||
}
|
||||
exports.TSError = TSError;
|
||||
1
frontend/node_modules/ts-jest/jest-preset.js
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/jest-preset.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./presets').defaults
|
||||
1
frontend/node_modules/ts-jest/legacy.js
generated
vendored
Normal file
1
frontend/node_modules/ts-jest/legacy.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./dist/legacy')
|
||||
178
frontend/node_modules/ts-jest/node_modules/type-fest/index.d.ts
generated
vendored
Normal file
178
frontend/node_modules/ts-jest/node_modules/type-fest/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
// Basic
|
||||
export * from './source/primitive';
|
||||
export * from './source/typed-array';
|
||||
export * from './source/basic';
|
||||
export * from './source/observable-like';
|
||||
|
||||
// Utilities
|
||||
export type {KeysOfUnion} from './source/keys-of-union';
|
||||
export type {DistributedOmit} from './source/distributed-omit';
|
||||
export type {DistributedPick} from './source/distributed-pick';
|
||||
export type {EmptyObject, IsEmptyObject} from './source/empty-object';
|
||||
export type {IfEmptyObject} from './source/if-empty-object';
|
||||
export type {NonEmptyObject} from './source/non-empty-object';
|
||||
export type {NonEmptyString} from './source/non-empty-string';
|
||||
export type {UnknownRecord} from './source/unknown-record';
|
||||
export type {UnknownArray} from './source/unknown-array';
|
||||
export type {UnknownSet} from './source/unknown-set';
|
||||
export type {UnknownMap} from './source/unknown-map';
|
||||
export type {Except} from './source/except';
|
||||
export type {TaggedUnion} from './source/tagged-union';
|
||||
export type {Writable} from './source/writable';
|
||||
export type {WritableDeep} from './source/writable-deep';
|
||||
export type {Merge} from './source/merge';
|
||||
export type {MergeDeep, MergeDeepOptions} from './source/merge-deep';
|
||||
export type {MergeExclusive} from './source/merge-exclusive';
|
||||
export type {RequireAtLeastOne} from './source/require-at-least-one';
|
||||
export type {RequireExactlyOne} from './source/require-exactly-one';
|
||||
export type {RequireAllOrNone} from './source/require-all-or-none';
|
||||
export type {RequireOneOrNone} from './source/require-one-or-none';
|
||||
export type {SingleKeyObject} from './source/single-key-object';
|
||||
export type {OmitIndexSignature} from './source/omit-index-signature';
|
||||
export type {PickIndexSignature} from './source/pick-index-signature';
|
||||
export type {PartialDeep, PartialDeepOptions} from './source/partial-deep';
|
||||
export type {RequiredDeep} from './source/required-deep';
|
||||
export type {PickDeep} from './source/pick-deep';
|
||||
export type {OmitDeep} from './source/omit-deep';
|
||||
export type {PartialOnUndefinedDeep, PartialOnUndefinedDeepOptions} from './source/partial-on-undefined-deep';
|
||||
export type {UndefinedOnPartialDeep} from './source/undefined-on-partial-deep';
|
||||
export type {ReadonlyDeep} from './source/readonly-deep';
|
||||
export type {LiteralUnion} from './source/literal-union';
|
||||
export type {Promisable} from './source/promisable';
|
||||
export type {Arrayable} from './source/arrayable';
|
||||
export type {Opaque, UnwrapOpaque, Tagged, GetTagMetadata, UnwrapTagged} from './source/tagged';
|
||||
export type {InvariantOf} from './source/invariant-of';
|
||||
export type {SetOptional} from './source/set-optional';
|
||||
export type {SetReadonly} from './source/set-readonly';
|
||||
export type {SetRequired} from './source/set-required';
|
||||
export type {SetRequiredDeep} from './source/set-required-deep';
|
||||
export type {SetNonNullable} from './source/set-non-nullable';
|
||||
export type {SetNonNullableDeep} from './source/set-non-nullable-deep';
|
||||
export type {ValueOf} from './source/value-of';
|
||||
export type {AsyncReturnType} from './source/async-return-type';
|
||||
export type {ConditionalExcept} from './source/conditional-except';
|
||||
export type {ConditionalKeys} from './source/conditional-keys';
|
||||
export type {ConditionalPick} from './source/conditional-pick';
|
||||
export type {ConditionalPickDeep, ConditionalPickDeepOptions} from './source/conditional-pick-deep';
|
||||
export type {UnionToIntersection} from './source/union-to-intersection';
|
||||
export type {Stringified} from './source/stringified';
|
||||
export type {StringSlice} from './source/string-slice';
|
||||
export type {FixedLengthArray} from './source/fixed-length-array';
|
||||
export type {MultidimensionalArray} from './source/multidimensional-array';
|
||||
export type {MultidimensionalReadonlyArray} from './source/multidimensional-readonly-array';
|
||||
export type {IterableElement} from './source/iterable-element';
|
||||
export type {Entry} from './source/entry';
|
||||
export type {Entries} from './source/entries';
|
||||
export type {SetReturnType} from './source/set-return-type';
|
||||
export type {SetParameterType} from './source/set-parameter-type';
|
||||
export type {Asyncify} from './source/asyncify';
|
||||
export type {Simplify} from './source/simplify';
|
||||
export type {SimplifyDeep} from './source/simplify-deep';
|
||||
export type {Jsonify} from './source/jsonify';
|
||||
export type {Jsonifiable} from './source/jsonifiable';
|
||||
export type {StructuredCloneable} from './source/structured-cloneable';
|
||||
export type {Schema, SchemaOptions} from './source/schema';
|
||||
export type {LiteralToPrimitive} from './source/literal-to-primitive';
|
||||
export type {LiteralToPrimitiveDeep} from './source/literal-to-primitive-deep';
|
||||
export type {
|
||||
PositiveInfinity,
|
||||
NegativeInfinity,
|
||||
Finite,
|
||||
Integer,
|
||||
Float,
|
||||
NegativeFloat,
|
||||
Negative,
|
||||
NonNegative,
|
||||
NegativeInteger,
|
||||
NonNegativeInteger,
|
||||
IsNegative,
|
||||
} from './source/numeric';
|
||||
export type {GreaterThan} from './source/greater-than';
|
||||
export type {GreaterThanOrEqual} from './source/greater-than-or-equal';
|
||||
export type {LessThan} from './source/less-than';
|
||||
export type {LessThanOrEqual} from './source/less-than-or-equal';
|
||||
export type {Sum} from './source/sum';
|
||||
export type {Subtract} from './source/subtract';
|
||||
export type {StringKeyOf} from './source/string-key-of';
|
||||
export type {Exact} from './source/exact';
|
||||
export type {ReadonlyTuple} from './source/readonly-tuple';
|
||||
export type {OptionalKeysOf} from './source/optional-keys-of';
|
||||
export type {OverrideProperties} from './source/override-properties';
|
||||
export type {HasOptionalKeys} from './source/has-optional-keys';
|
||||
export type {RequiredKeysOf} from './source/required-keys-of';
|
||||
export type {HasRequiredKeys} from './source/has-required-keys';
|
||||
export type {ReadonlyKeysOf} from './source/readonly-keys-of';
|
||||
export type {HasReadonlyKeys} from './source/has-readonly-keys';
|
||||
export type {WritableKeysOf} from './source/writable-keys-of';
|
||||
export type {HasWritableKeys} from './source/has-writable-keys';
|
||||
export type {Spread} from './source/spread';
|
||||
export type {IsInteger} from './source/is-integer';
|
||||
export type {IsFloat} from './source/is-float';
|
||||
export type {TupleToObject} from './source/tuple-to-object';
|
||||
export type {TupleToUnion} from './source/tuple-to-union';
|
||||
export type {UnionToTuple} from './source/union-to-tuple';
|
||||
export type {IntRange} from './source/int-range';
|
||||
export type {IntClosedRange} from './source/int-closed-range';
|
||||
export type {IsEqual} from './source/is-equal';
|
||||
export type {
|
||||
IsLiteral,
|
||||
IsStringLiteral,
|
||||
IsNumericLiteral,
|
||||
IsBooleanLiteral,
|
||||
IsSymbolLiteral,
|
||||
} from './source/is-literal';
|
||||
export type {IsAny} from './source/is-any';
|
||||
export type {IfAny} from './source/if-any';
|
||||
export type {IsNever} from './source/is-never';
|
||||
export type {IfNever} from './source/if-never';
|
||||
export type {IsUnknown} from './source/is-unknown';
|
||||
export type {IfUnknown} from './source/if-unknown';
|
||||
export type {IsTuple} from './source/is-tuple';
|
||||
export type {ArrayIndices} from './source/array-indices';
|
||||
export type {ArrayValues} from './source/array-values';
|
||||
export type {ArraySlice} from './source/array-slice';
|
||||
export type {ArraySplice} from './source/array-splice';
|
||||
export type {ArrayTail} from './source/array-tail';
|
||||
export type {SetFieldType} from './source/set-field-type';
|
||||
export type {Paths} from './source/paths';
|
||||
export type {AllUnionFields} from './source/all-union-fields';
|
||||
export type {SharedUnionFields} from './source/shared-union-fields';
|
||||
export type {SharedUnionFieldsDeep} from './source/shared-union-fields-deep';
|
||||
export type {IsNull} from './source/is-null';
|
||||
export type {IfNull} from './source/if-null';
|
||||
export type {And} from './source/and';
|
||||
export type {Or} from './source/or';
|
||||
export type {NonEmptyTuple} from './source/non-empty-tuple';
|
||||
export type {FindGlobalInstanceType, FindGlobalType} from './source/find-global-type';
|
||||
|
||||
// Template literal types
|
||||
export type {CamelCase} from './source/camel-case';
|
||||
export type {CamelCasedProperties} from './source/camel-cased-properties';
|
||||
export type {CamelCasedPropertiesDeep} from './source/camel-cased-properties-deep';
|
||||
export type {KebabCase} from './source/kebab-case';
|
||||
export type {KebabCasedProperties} from './source/kebab-cased-properties';
|
||||
export type {KebabCasedPropertiesDeep} from './source/kebab-cased-properties-deep';
|
||||
export type {PascalCase} from './source/pascal-case';
|
||||
export type {PascalCasedProperties} from './source/pascal-cased-properties';
|
||||
export type {PascalCasedPropertiesDeep} from './source/pascal-cased-properties-deep';
|
||||
export type {SnakeCase} from './source/snake-case';
|
||||
export type {SnakeCasedProperties} from './source/snake-cased-properties';
|
||||
export type {SnakeCasedPropertiesDeep} from './source/snake-cased-properties-deep';
|
||||
export type {ScreamingSnakeCase} from './source/screaming-snake-case';
|
||||
export type {DelimiterCase} from './source/delimiter-case';
|
||||
export type {DelimiterCasedProperties} from './source/delimiter-cased-properties';
|
||||
export type {DelimiterCasedPropertiesDeep} from './source/delimiter-cased-properties-deep';
|
||||
export type {Join} from './source/join';
|
||||
export type {Split} from './source/split';
|
||||
export type {Words} from './source/words';
|
||||
export type {Trim} from './source/trim';
|
||||
export type {Replace} from './source/replace';
|
||||
export type {StringRepeat} from './source/string-repeat';
|
||||
export type {Includes} from './source/includes';
|
||||
export type {Get} from './source/get';
|
||||
export type {LastArrayElement} from './source/last-array-element';
|
||||
|
||||
// Miscellaneous
|
||||
export type {GlobalThis} from './source/global-this';
|
||||
export type {PackageJson} from './source/package-json';
|
||||
export type {TsConfigJson} from './source/tsconfig-json';
|
||||
121
frontend/node_modules/ts-jest/node_modules/type-fest/license-cc0
generated
vendored
Normal file
121
frontend/node_modules/ts-jest/node_modules/type-fest/license-cc0
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
||||
9
frontend/node_modules/ts-jest/node_modules/type-fest/license-mit
generated
vendored
Normal file
9
frontend/node_modules/ts-jest/node_modules/type-fest/license-mit
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
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.
|
||||
91
frontend/node_modules/ts-jest/node_modules/type-fest/package.json
generated
vendored
Normal file
91
frontend/node_modules/ts-jest/node_modules/type-fest/package.json
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"name": "type-fest",
|
||||
"version": "4.41.0",
|
||||
"description": "A collection of essential TypeScript types",
|
||||
"license": "(MIT OR CC0-1.0)",
|
||||
"repository": "sindresorhus/type-fest",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"types": "./index.d.ts",
|
||||
"sideEffects": false,
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
},
|
||||
"scripts": {
|
||||
"test:source-files-extension": "node script/test/source-files-extension.js",
|
||||
"test:tsc": "tsc",
|
||||
"test:tsd": "tsd",
|
||||
"test:xo": "xo",
|
||||
"test": "run-p test:*"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"source",
|
||||
"license-mit",
|
||||
"license-cc0"
|
||||
],
|
||||
"keywords": [
|
||||
"typescript",
|
||||
"ts",
|
||||
"types",
|
||||
"utility",
|
||||
"util",
|
||||
"utilities",
|
||||
"omit",
|
||||
"merge",
|
||||
"json",
|
||||
"generics"
|
||||
],
|
||||
"devDependencies": {
|
||||
"expect-type": "^1.1.0",
|
||||
"npm-run-all2": "^7.0.1",
|
||||
"tsd": "^0.32.0",
|
||||
"typescript": "~5.8.3",
|
||||
"xo": "^0.60.0"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"@typescript-eslint/no-extraneous-class": "off",
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/naming-convention": "off",
|
||||
"import/extensions": "off",
|
||||
"@typescript-eslint/no-redeclare": "off",
|
||||
"@typescript-eslint/no-confusing-void-expression": "off",
|
||||
"@typescript-eslint/no-unsafe-argument": "off",
|
||||
"n/file-extension-in-import": "off",
|
||||
"object-curly-newline": [
|
||||
"error",
|
||||
{
|
||||
"multiline": true,
|
||||
"consistent": true
|
||||
}
|
||||
],
|
||||
"import/consistent-type-specifier-style": [
|
||||
"error",
|
||||
"prefer-top-level"
|
||||
]
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": "**/*.d.ts",
|
||||
"rules": {
|
||||
"no-restricted-imports": [
|
||||
"error",
|
||||
"tsd",
|
||||
"expect-type"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tsd": {
|
||||
"compilerOptions": {
|
||||
"noUnusedLocals": false
|
||||
}
|
||||
}
|
||||
}
|
||||
1060
frontend/node_modules/ts-jest/node_modules/type-fest/readme.md
generated
vendored
Normal file
1060
frontend/node_modules/ts-jest/node_modules/type-fest/readme.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
88
frontend/node_modules/ts-jest/node_modules/type-fest/source/all-union-fields.d.ts
generated
vendored
Normal file
88
frontend/node_modules/ts-jest/node_modules/type-fest/source/all-union-fields.d.ts
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
import type {NonRecursiveType, ReadonlyKeysOfUnion, ValueOfUnion} from './internal';
|
||||
import type {KeysOfUnion} from './keys-of-union';
|
||||
import type {SharedUnionFields} from './shared-union-fields';
|
||||
import type {Simplify} from './simplify';
|
||||
import type {UnknownArray} from './unknown-array';
|
||||
|
||||
/**
|
||||
Create a type with all fields from a union of object types.
|
||||
|
||||
Use-cases:
|
||||
- You want a safe object type where each key exists in the union object.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {AllUnionFields} from 'type-fest';
|
||||
|
||||
type Cat = {
|
||||
name: string;
|
||||
type: 'cat';
|
||||
catType: string;
|
||||
};
|
||||
|
||||
type Dog = {
|
||||
name: string;
|
||||
type: 'dog';
|
||||
dogType: string;
|
||||
};
|
||||
|
||||
function displayPetInfo(petInfo: Cat | Dog) {
|
||||
// typeof petInfo =>
|
||||
// {
|
||||
// name: string;
|
||||
// type: 'cat';
|
||||
// catType: string;
|
||||
// } | {
|
||||
// name: string;
|
||||
// type: 'dog';
|
||||
// dogType: string;
|
||||
// }
|
||||
|
||||
console.log('name: ', petInfo.name);
|
||||
console.log('type: ', petInfo.type);
|
||||
|
||||
// TypeScript complains about `catType` and `dogType` not existing on type `Cat | Dog`.
|
||||
console.log('animal type: ', petInfo.catType ?? petInfo.dogType);
|
||||
}
|
||||
|
||||
function displayPetInfo(petInfo: AllUnionFields<Cat | Dog>) {
|
||||
// typeof petInfo =>
|
||||
// {
|
||||
// name: string;
|
||||
// type: 'cat' | 'dog';
|
||||
// catType?: string;
|
||||
// dogType?: string;
|
||||
// }
|
||||
|
||||
console.log('name: ', petInfo.name);
|
||||
console.log('type: ', petInfo.type);
|
||||
|
||||
// No TypeScript error.
|
||||
console.log('animal type: ', petInfo.catType ?? petInfo.dogType);
|
||||
}
|
||||
```
|
||||
|
||||
@see SharedUnionFields
|
||||
|
||||
@category Object
|
||||
@category Union
|
||||
*/
|
||||
export type AllUnionFields<Union> =
|
||||
Extract<Union, NonRecursiveType | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown> | UnknownArray> extends infer SkippedMembers
|
||||
? Exclude<Union, SkippedMembers> extends infer RelevantMembers
|
||||
?
|
||||
| SkippedMembers
|
||||
| Simplify<
|
||||
// Include fields that are common in all union members
|
||||
SharedUnionFields<RelevantMembers> &
|
||||
// Include readonly fields present in any union member
|
||||
{
|
||||
readonly [P in ReadonlyKeysOfUnion<RelevantMembers>]?: ValueOfUnion<RelevantMembers, P & KeysOfUnion<RelevantMembers>>
|
||||
} &
|
||||
// Include remaining fields that are neither common nor readonly
|
||||
{
|
||||
[P in Exclude<KeysOfUnion<RelevantMembers>, ReadonlyKeysOfUnion<RelevantMembers> | keyof RelevantMembers>]?: ValueOfUnion<RelevantMembers, P>
|
||||
}
|
||||
>
|
||||
: never
|
||||
: never;
|
||||
25
frontend/node_modules/ts-jest/node_modules/type-fest/source/and.d.ts
generated
vendored
Normal file
25
frontend/node_modules/ts-jest/node_modules/type-fest/source/and.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import type {IsEqual} from './is-equal';
|
||||
|
||||
/**
|
||||
Returns a boolean for whether two given types are both true.
|
||||
|
||||
Use-case: Constructing complex conditional types where multiple conditions must be satisfied.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {And} from 'type-fest';
|
||||
|
||||
And<true, true>;
|
||||
//=> true
|
||||
|
||||
And<true, false>;
|
||||
//=> false
|
||||
```
|
||||
|
||||
@see {@link Or}
|
||||
*/
|
||||
export type And<A extends boolean, B extends boolean> = [A, B][number] extends true
|
||||
? true
|
||||
: true extends [IsEqual<A, false>, IsEqual<B, false>][number]
|
||||
? false
|
||||
: never;
|
||||
23
frontend/node_modules/ts-jest/node_modules/type-fest/source/array-indices.d.ts
generated
vendored
Normal file
23
frontend/node_modules/ts-jest/node_modules/type-fest/source/array-indices.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
Provides valid indices for a constant array or tuple.
|
||||
|
||||
Use-case: This type is useful when working with constant arrays or tuples and you want to enforce type-safety for accessing elements by their indices.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {ArrayIndices, ArrayValues} from 'type-fest';
|
||||
|
||||
const weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] as const;
|
||||
|
||||
type Weekday = ArrayIndices<typeof weekdays>;
|
||||
type WeekdayName = ArrayValues<typeof weekdays>;
|
||||
|
||||
const getWeekdayName = (day: Weekday): WeekdayName => weekdays[day];
|
||||
```
|
||||
|
||||
@see {@link ArrayValues}
|
||||
|
||||
@category Array
|
||||
*/
|
||||
export type ArrayIndices<Element extends readonly unknown[]> =
|
||||
Exclude<Partial<Element>['length'], Element['length']>;
|
||||
109
frontend/node_modules/ts-jest/node_modules/type-fest/source/array-slice.d.ts
generated
vendored
Normal file
109
frontend/node_modules/ts-jest/node_modules/type-fest/source/array-slice.d.ts
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
import type {Sum} from './sum';
|
||||
import type {LessThanOrEqual} from './less-than-or-equal';
|
||||
import type {GreaterThanOrEqual} from './greater-than-or-equal';
|
||||
import type {GreaterThan} from './greater-than';
|
||||
import type {IsNegative} from './numeric';
|
||||
import type {Not, TupleMin} from './internal';
|
||||
import type {IsEqual} from './is-equal';
|
||||
import type {And} from './and';
|
||||
import type {ArraySplice} from './array-splice';
|
||||
|
||||
/**
|
||||
Returns an array slice of a given range, just like `Array#slice()`.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {ArraySlice} from 'type-fest';
|
||||
|
||||
type T0 = ArraySlice<[0, 1, 2, 3, 4]>;
|
||||
//=> [0, 1, 2, 3, 4]
|
||||
|
||||
type T1 = ArraySlice<[0, 1, 2, 3, 4], 0, -1>;
|
||||
//=> [0, 1, 2, 3]
|
||||
|
||||
type T2 = ArraySlice<[0, 1, 2, 3, 4], 1, -2>;
|
||||
//=> [1, 2]
|
||||
|
||||
type T3 = ArraySlice<[0, 1, 2, 3, 4], -2, 4>;
|
||||
//=> [3]
|
||||
|
||||
type T4 = ArraySlice<[0, 1, 2, 3, 4], -2, -1>;
|
||||
//=> [3]
|
||||
|
||||
type T5 = ArraySlice<[0, 1, 2, 3, 4], 0, -999>;
|
||||
//=> []
|
||||
|
||||
function arraySlice<
|
||||
const Array_ extends readonly unknown[],
|
||||
Start extends number = 0,
|
||||
End extends number = Array_['length'],
|
||||
>(array: Array_, start?: Start, end?: End) {
|
||||
return array.slice(start, end) as ArraySlice<Array_, Start, End>;
|
||||
}
|
||||
|
||||
const slice = arraySlice([1, '2', {a: 3}, [4, 5]], 0, -1);
|
||||
|
||||
typeof slice;
|
||||
//=> [1, '2', { readonly a: 3; }]
|
||||
|
||||
slice[2].a;
|
||||
//=> 3
|
||||
|
||||
// @ts-expect-error -- TS2493: Tuple type '[1, "2", {readonly a: 3}]' of length '3' has no element at index '3'.
|
||||
slice[3];
|
||||
```
|
||||
|
||||
@category Array
|
||||
*/
|
||||
export type ArraySlice<
|
||||
Array_ extends readonly unknown[],
|
||||
Start extends number = never,
|
||||
End extends number = never,
|
||||
> = Array_ extends unknown // To distributive type
|
||||
? And<IsEqual<Start, never>, IsEqual<End, never>> extends true
|
||||
? Array_
|
||||
: number extends Array_['length']
|
||||
? VariableLengthArraySliceHelper<Array_, Start, End>
|
||||
: ArraySliceHelper<Array_, IsEqual<Start, never> extends true ? 0 : Start, IsEqual<End, never> extends true ? Array_['length'] : End>
|
||||
: never; // Never happens
|
||||
|
||||
type VariableLengthArraySliceHelper<
|
||||
Array_ extends readonly unknown[],
|
||||
Start extends number,
|
||||
End extends number,
|
||||
> = And<Not<IsNegative<Start>>, IsEqual<End, never>> extends true
|
||||
? ArraySplice<Array_, 0, Start>
|
||||
: And<
|
||||
And<Not<IsNegative<Start>>, Not<IsNegative<End>>>,
|
||||
IsEqual<GreaterThan<End, Start>, true>
|
||||
> extends true
|
||||
? ArraySliceByPositiveIndex<Array_, Start, End>
|
||||
: [];
|
||||
|
||||
type ArraySliceHelper<
|
||||
Array_ extends readonly unknown[],
|
||||
Start extends number = 0,
|
||||
End extends number = Array_['length'],
|
||||
TraversedElement extends Array<Array_[number]> = [],
|
||||
Result extends Array<Array_[number]> = [],
|
||||
ArrayLength extends number = Array_['length'],
|
||||
PositiveS extends number = IsNegative<Start> extends true
|
||||
? Sum<ArrayLength, Start> extends infer AddResult extends number
|
||||
? number extends AddResult // (ArrayLength + Start) < 0
|
||||
? 0
|
||||
: GreaterThan<AddResult, 0> extends true ? AddResult : 0
|
||||
: never
|
||||
: Start,
|
||||
PositiveE extends number = IsNegative<End> extends true ? Sum<ArrayLength, End> : End,
|
||||
> = true extends [IsNegative<PositiveS>, LessThanOrEqual<PositiveE, PositiveS>, GreaterThanOrEqual<PositiveS, ArrayLength>][number]
|
||||
? []
|
||||
: ArraySliceByPositiveIndex<Array_, TupleMin<[PositiveS, ArrayLength]>, TupleMin<[PositiveE, ArrayLength]>>;
|
||||
|
||||
type ArraySliceByPositiveIndex<
|
||||
Array_ extends readonly unknown[],
|
||||
Start extends number,
|
||||
End extends number,
|
||||
Result extends Array<Array_[number]> = [],
|
||||
> = Start extends End
|
||||
? Result
|
||||
: ArraySliceByPositiveIndex<Array_, Sum<Start, 1>, End, [...Result, Array_[Start]]>;
|
||||
99
frontend/node_modules/ts-jest/node_modules/type-fest/source/array-splice.d.ts
generated
vendored
Normal file
99
frontend/node_modules/ts-jest/node_modules/type-fest/source/array-splice.d.ts
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
import type {BuildTuple, StaticPartOfArray, VariablePartOfArray} from './internal';
|
||||
import type {GreaterThanOrEqual} from './greater-than-or-equal';
|
||||
import type {Subtract} from './subtract';
|
||||
import type {UnknownArray} from './unknown-array';
|
||||
|
||||
/**
|
||||
The implementation of `SplitArrayByIndex` for fixed length arrays.
|
||||
*/
|
||||
type SplitFixedArrayByIndex<T extends UnknownArray, SplitIndex extends number> =
|
||||
SplitIndex extends 0
|
||||
? [[], T]
|
||||
: T extends readonly [...BuildTuple<SplitIndex>, ...infer V]
|
||||
? T extends readonly [...infer U, ...V]
|
||||
? [U, V]
|
||||
: [never, never]
|
||||
: [never, never];
|
||||
|
||||
/**
|
||||
The implementation of `SplitArrayByIndex` for variable length arrays.
|
||||
*/
|
||||
type SplitVariableArrayByIndex<T extends UnknownArray,
|
||||
SplitIndex extends number,
|
||||
T1 = Subtract<SplitIndex, StaticPartOfArray<T>['length']>,
|
||||
T2 = T1 extends number
|
||||
? BuildTuple<GreaterThanOrEqual<T1, 0> extends true ? T1 : number, VariablePartOfArray<T>[number]>
|
||||
: [],
|
||||
> =
|
||||
SplitIndex extends 0
|
||||
? [[], T]
|
||||
: GreaterThanOrEqual<StaticPartOfArray<T>['length'], SplitIndex> extends true
|
||||
? [
|
||||
SplitFixedArrayByIndex<StaticPartOfArray<T>, SplitIndex>[0],
|
||||
[
|
||||
...SplitFixedArrayByIndex<StaticPartOfArray<T>, SplitIndex>[1],
|
||||
...VariablePartOfArray<T>,
|
||||
],
|
||||
]
|
||||
: [
|
||||
[
|
||||
...StaticPartOfArray<T>,
|
||||
...(T2 extends UnknownArray ? T2 : []),
|
||||
],
|
||||
VariablePartOfArray<T>,
|
||||
];
|
||||
|
||||
/**
|
||||
Split the given array `T` by the given `SplitIndex`.
|
||||
|
||||
@example
|
||||
```
|
||||
type A = SplitArrayByIndex<[1, 2, 3, 4], 2>;
|
||||
// type A = [[1, 2], [3, 4]];
|
||||
|
||||
type B = SplitArrayByIndex<[1, 2, 3, 4], 0>;
|
||||
// type B = [[], [1, 2, 3, 4]];
|
||||
```
|
||||
*/
|
||||
type SplitArrayByIndex<T extends UnknownArray, SplitIndex extends number> =
|
||||
SplitIndex extends 0
|
||||
? [[], T]
|
||||
: number extends T['length']
|
||||
? SplitVariableArrayByIndex<T, SplitIndex>
|
||||
: SplitFixedArrayByIndex<T, SplitIndex>;
|
||||
|
||||
/**
|
||||
Creates a new array type by adding or removing elements at a specified index range in the original array.
|
||||
|
||||
Use-case: Replace or insert items in an array type.
|
||||
|
||||
Like [`Array#splice()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) but for types.
|
||||
|
||||
@example
|
||||
```
|
||||
type SomeMonths0 = ['January', 'April', 'June'];
|
||||
type Mouths0 = ArraySplice<SomeMonths0, 1, 0, ['Feb', 'March']>;
|
||||
//=> type Mouths0 = ['January', 'Feb', 'March', 'April', 'June'];
|
||||
|
||||
type SomeMonths1 = ['January', 'April', 'June'];
|
||||
type Mouths1 = ArraySplice<SomeMonths1, 1, 1>;
|
||||
//=> type Mouths1 = ['January', 'June'];
|
||||
|
||||
type SomeMonths2 = ['January', 'Foo', 'April'];
|
||||
type Mouths2 = ArraySplice<SomeMonths2, 1, 1, ['Feb', 'March']>;
|
||||
//=> type Mouths2 = ['January', 'Feb', 'March', 'April'];
|
||||
```
|
||||
|
||||
@category Array
|
||||
*/
|
||||
export type ArraySplice<
|
||||
T extends UnknownArray,
|
||||
Start extends number,
|
||||
DeleteCount extends number,
|
||||
Items extends UnknownArray = [],
|
||||
> =
|
||||
SplitArrayByIndex<T, Start> extends [infer U extends UnknownArray, infer V extends UnknownArray]
|
||||
? SplitArrayByIndex<V, DeleteCount> extends [infer _Deleted extends UnknownArray, infer X extends UnknownArray]
|
||||
? [...U, ...Items, ...X]
|
||||
: never // Should never happen
|
||||
: never; // Should never happen
|
||||
76
frontend/node_modules/ts-jest/node_modules/type-fest/source/array-tail.d.ts
generated
vendored
Normal file
76
frontend/node_modules/ts-jest/node_modules/type-fest/source/array-tail.d.ts
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
import type {ApplyDefaultOptions, IfArrayReadonly} from './internal';
|
||||
import type {UnknownArray} from './unknown-array';
|
||||
|
||||
/**
|
||||
@see {@link ArrayTail}
|
||||
*/
|
||||
type ArrayTailOptions = {
|
||||
/**
|
||||
Return a readonly array if the input array is readonly.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
import type {ArrayTail} from 'type-fest';
|
||||
|
||||
type Example1 = ArrayTail<readonly [string, number, boolean], {preserveReadonly: true}>;
|
||||
//=> readonly [number, boolean]
|
||||
|
||||
type Example2 = ArrayTail<[string, number, boolean], {preserveReadonly: true}>;
|
||||
//=> [number, boolean]
|
||||
|
||||
type Example3 = ArrayTail<readonly [string, number, boolean], {preserveReadonly: false}>;
|
||||
//=> [number, boolean]
|
||||
|
||||
type Example4 = ArrayTail<[string, number, boolean], {preserveReadonly: false}>;
|
||||
//=> [number, boolean]
|
||||
```
|
||||
*/
|
||||
preserveReadonly?: boolean;
|
||||
};
|
||||
|
||||
type DefaultArrayTailOptions = {
|
||||
preserveReadonly: false;
|
||||
};
|
||||
|
||||
/**
|
||||
Extracts the type of an array or tuple minus the first element.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {ArrayTail} from 'type-fest';
|
||||
|
||||
declare const curry: <Arguments extends unknown[], Return>(
|
||||
function_: (...arguments_: Arguments) => Return,
|
||||
...arguments_: ArrayTail<Arguments>
|
||||
) => (...arguments_: ArrayTail<Arguments>) => Return;
|
||||
|
||||
const add = (a: number, b: number) => a + b;
|
||||
|
||||
const add3 = curry(add, 3);
|
||||
|
||||
add3(4);
|
||||
//=> 7
|
||||
```
|
||||
|
||||
@see {@link ArrayTailOptions}
|
||||
|
||||
@category Array
|
||||
*/
|
||||
export type ArrayTail<TArray extends UnknownArray, Options extends ArrayTailOptions = {}> =
|
||||
ApplyDefaultOptions<ArrayTailOptions, DefaultArrayTailOptions, Options> extends infer ResolvedOptions extends Required<ArrayTailOptions>
|
||||
? TArray extends UnknownArray // For distributing `TArray`
|
||||
? _ArrayTail<TArray> extends infer Result
|
||||
? ResolvedOptions['preserveReadonly'] extends true
|
||||
? IfArrayReadonly<TArray, Readonly<Result>, Result>
|
||||
: Result
|
||||
: never // Should never happen
|
||||
: never // Should never happen
|
||||
: never; // Should never happen
|
||||
|
||||
type _ArrayTail<TArray extends UnknownArray> = TArray extends readonly [unknown?, ...infer Tail]
|
||||
? keyof TArray & `${number}` extends never
|
||||
? []
|
||||
: Tail
|
||||
: [];
|
||||
22
frontend/node_modules/ts-jest/node_modules/type-fest/source/array-values.d.ts
generated
vendored
Normal file
22
frontend/node_modules/ts-jest/node_modules/type-fest/source/array-values.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
Provides all values for a constant array or tuple.
|
||||
|
||||
Use-case: This type is useful when working with constant arrays or tuples and you want to enforce type-safety with their values.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {ArrayValues, ArrayIndices} from 'type-fest';
|
||||
|
||||
const weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] as const;
|
||||
|
||||
type WeekdayName = ArrayValues<typeof weekdays>;
|
||||
type Weekday = ArrayIndices<typeof weekdays>;
|
||||
|
||||
const getWeekdayName = (day: Weekday): WeekdayName => weekdays[day];
|
||||
```
|
||||
|
||||
@see {@link ArrayIndices}
|
||||
|
||||
@category Array
|
||||
*/
|
||||
export type ArrayValues<T extends readonly unknown[]> = T[number];
|
||||
29
frontend/node_modules/ts-jest/node_modules/type-fest/source/arrayable.d.ts
generated
vendored
Normal file
29
frontend/node_modules/ts-jest/node_modules/type-fest/source/arrayable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
Create a type that represents either the value or an array of the value.
|
||||
|
||||
@see Promisable
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Arrayable} from 'type-fest';
|
||||
|
||||
function bundle(input: string, output: Arrayable<string>) {
|
||||
const outputList = Array.isArray(output) ? output : [output];
|
||||
|
||||
// …
|
||||
|
||||
for (const output of outputList) {
|
||||
console.log(`write to: ${output}`);
|
||||
}
|
||||
}
|
||||
|
||||
bundle('src/index.js', 'dist/index.js');
|
||||
bundle('src/index.js', ['dist/index.cjs', 'dist/index.mjs']);
|
||||
```
|
||||
|
||||
@category Array
|
||||
*/
|
||||
export type Arrayable<T> =
|
||||
T
|
||||
// TODO: Use `readonly T[]` when this issue is resolved: https://github.com/microsoft/TypeScript/issues/17002
|
||||
| T[];
|
||||
23
frontend/node_modules/ts-jest/node_modules/type-fest/source/async-return-type.d.ts
generated
vendored
Normal file
23
frontend/node_modules/ts-jest/node_modules/type-fest/source/async-return-type.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
type AsyncFunction = (...arguments_: any[]) => PromiseLike<unknown>;
|
||||
|
||||
/**
|
||||
Unwrap the return type of a function that returns a `Promise`.
|
||||
|
||||
There has been [discussion](https://github.com/microsoft/TypeScript/pull/35998) about implementing this type in TypeScript.
|
||||
|
||||
@example
|
||||
```ts
|
||||
import type {AsyncReturnType} from 'type-fest';
|
||||
import {asyncFunction} from 'api';
|
||||
|
||||
// This type resolves to the unwrapped return type of `asyncFunction`.
|
||||
type Value = AsyncReturnType<typeof asyncFunction>;
|
||||
|
||||
async function doSomething(value: Value) {}
|
||||
|
||||
asyncFunction().then(value => doSomething(value));
|
||||
```
|
||||
|
||||
@category Async
|
||||
*/
|
||||
export type AsyncReturnType<Target extends AsyncFunction> = Awaited<ReturnType<Target>>;
|
||||
32
frontend/node_modules/ts-jest/node_modules/type-fest/source/asyncify.d.ts
generated
vendored
Normal file
32
frontend/node_modules/ts-jest/node_modules/type-fest/source/asyncify.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import type {SetReturnType} from './set-return-type';
|
||||
|
||||
/**
|
||||
Create an async version of the given function type, by boxing the return type in `Promise` while keeping the same parameter types.
|
||||
|
||||
Use-case: You have two functions, one synchronous and one asynchronous that do the same thing. Instead of having to duplicate the type definition, you can use `Asyncify` to reuse the synchronous type.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Asyncify} from 'type-fest';
|
||||
|
||||
// Synchronous function.
|
||||
function getFooSync(someArg: SomeType): Foo {
|
||||
// …
|
||||
}
|
||||
|
||||
type AsyncifiedFooGetter = Asyncify<typeof getFooSync>;
|
||||
//=> type AsyncifiedFooGetter = (someArg: SomeType) => Promise<Foo>;
|
||||
|
||||
// Same as `getFooSync` but asynchronous.
|
||||
const getFooAsync: AsyncifiedFooGetter = (someArg) => {
|
||||
// TypeScript now knows that `someArg` is `SomeType` automatically.
|
||||
// It also knows that this function must return `Promise<Foo>`.
|
||||
// If you have `@typescript-eslint/promise-function-async` linter rule enabled, it will even report that "Functions that return promises must be async.".
|
||||
|
||||
// …
|
||||
}
|
||||
```
|
||||
|
||||
@category Async
|
||||
*/
|
||||
export type Asyncify<Function_ extends (...arguments_: any[]) => any> = SetReturnType<Function_, Promise<Awaited<ReturnType<Function_>>>>;
|
||||
68
frontend/node_modules/ts-jest/node_modules/type-fest/source/basic.d.ts
generated
vendored
Normal file
68
frontend/node_modules/ts-jest/node_modules/type-fest/source/basic.d.ts
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
||||
|
||||
@category Class
|
||||
*/
|
||||
export type Class<T, Arguments extends unknown[] = any[]> = {
|
||||
prototype: Pick<T, keyof T>;
|
||||
new(...arguments_: Arguments): T;
|
||||
};
|
||||
|
||||
/**
|
||||
Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
||||
|
||||
@category Class
|
||||
*/
|
||||
export type Constructor<T, Arguments extends unknown[] = any[]> = new(...arguments_: Arguments) => T;
|
||||
|
||||
/**
|
||||
Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/classes.html#abstract-classes).
|
||||
|
||||
@category Class
|
||||
|
||||
@privateRemarks
|
||||
We cannot use a `type` here because TypeScript throws: 'abstract' modifier cannot appear on a type member. (1070)
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
||||
export interface AbstractClass<T, Arguments extends unknown[] = any[]> extends AbstractConstructor<T, Arguments> {
|
||||
prototype: Pick<T, keyof T>;
|
||||
}
|
||||
|
||||
/**
|
||||
Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#abstract-construct-signatures) constructor.
|
||||
|
||||
@category Class
|
||||
*/
|
||||
export type AbstractConstructor<T, Arguments extends unknown[] = any[]> = abstract new(...arguments_: Arguments) => T;
|
||||
|
||||
/**
|
||||
Matches a JSON object.
|
||||
|
||||
This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`.
|
||||
|
||||
@category JSON
|
||||
*/
|
||||
export type JsonObject = {[Key in string]: JsonValue} & {[Key in string]?: JsonValue | undefined};
|
||||
|
||||
/**
|
||||
Matches a JSON array.
|
||||
|
||||
@category JSON
|
||||
*/
|
||||
export type JsonArray = JsonValue[] | readonly JsonValue[];
|
||||
|
||||
/**
|
||||
Matches any valid JSON primitive value.
|
||||
|
||||
@category JSON
|
||||
*/
|
||||
export type JsonPrimitive = string | number | boolean | null;
|
||||
|
||||
/**
|
||||
Matches any valid JSON value.
|
||||
|
||||
@see `Jsonify` if you need to transform a type to one that is assignable to `JsonValue`.
|
||||
|
||||
@category JSON
|
||||
*/
|
||||
export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
||||
89
frontend/node_modules/ts-jest/node_modules/type-fest/source/camel-case.d.ts
generated
vendored
Normal file
89
frontend/node_modules/ts-jest/node_modules/type-fest/source/camel-case.d.ts
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
import type {ApplyDefaultOptions} from './internal';
|
||||
import type {Words} from './words';
|
||||
|
||||
/**
|
||||
CamelCase options.
|
||||
|
||||
@see {@link CamelCase}
|
||||
*/
|
||||
export type CamelCaseOptions = {
|
||||
/**
|
||||
Whether to preserved consecutive uppercase letter.
|
||||
|
||||
@default true
|
||||
*/
|
||||
preserveConsecutiveUppercase?: boolean;
|
||||
};
|
||||
|
||||
export type DefaultCamelCaseOptions = {
|
||||
preserveConsecutiveUppercase: true;
|
||||
};
|
||||
|
||||
/**
|
||||
Convert an array of words to camel-case.
|
||||
*/
|
||||
type CamelCaseFromArray<
|
||||
Words extends string[],
|
||||
Options extends Required<CamelCaseOptions>,
|
||||
OutputString extends string = '',
|
||||
> = Words extends [
|
||||
infer FirstWord extends string,
|
||||
...infer RemainingWords extends string[],
|
||||
]
|
||||
? Options['preserveConsecutiveUppercase'] extends true
|
||||
? `${Capitalize<FirstWord>}${CamelCaseFromArray<RemainingWords, Options>}`
|
||||
: `${Capitalize<Lowercase<FirstWord>>}${CamelCaseFromArray<RemainingWords, Options>}`
|
||||
: OutputString;
|
||||
|
||||
/**
|
||||
Convert a string literal to camel-case.
|
||||
|
||||
This can be useful when, for example, converting some kebab-cased command-line flags or a snake-cased database result.
|
||||
|
||||
By default, consecutive uppercase letter are preserved. See {@link CamelCaseOptions.preserveConsecutiveUppercase preserveConsecutiveUppercase} option to change this behaviour.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {CamelCase} from 'type-fest';
|
||||
|
||||
// Simple
|
||||
|
||||
const someVariable: CamelCase<'foo-bar'> = 'fooBar';
|
||||
const preserveConsecutiveUppercase: CamelCase<'foo-BAR-baz', {preserveConsecutiveUppercase: true}> = 'fooBARBaz';
|
||||
|
||||
// Advanced
|
||||
|
||||
type CamelCasedProperties<T> = {
|
||||
[K in keyof T as CamelCase<K>]: T[K]
|
||||
};
|
||||
|
||||
interface RawOptions {
|
||||
'dry-run': boolean;
|
||||
'full_family_name': string;
|
||||
foo: number;
|
||||
BAR: string;
|
||||
QUZ_QUX: number;
|
||||
'OTHER-FIELD': boolean;
|
||||
}
|
||||
|
||||
const dbResult: CamelCasedProperties<RawOptions> = {
|
||||
dryRun: true,
|
||||
fullFamilyName: 'bar.js',
|
||||
foo: 123,
|
||||
bar: 'foo',
|
||||
quzQux: 6,
|
||||
otherField: false
|
||||
};
|
||||
```
|
||||
|
||||
@category Change case
|
||||
@category Template literal
|
||||
*/
|
||||
export type CamelCase<Type, Options extends CamelCaseOptions = {}> = Type extends string
|
||||
? string extends Type
|
||||
? Type
|
||||
: Uncapitalize<CamelCaseFromArray<
|
||||
Words<Type extends Uppercase<Type> ? Lowercase<Type> : Type>,
|
||||
ApplyDefaultOptions<CamelCaseOptions, DefaultCamelCaseOptions, Options>
|
||||
>>
|
||||
: Type;
|
||||
97
frontend/node_modules/ts-jest/node_modules/type-fest/source/camel-cased-properties-deep.d.ts
generated
vendored
Normal file
97
frontend/node_modules/ts-jest/node_modules/type-fest/source/camel-cased-properties-deep.d.ts
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
import type {CamelCase, CamelCaseOptions, DefaultCamelCaseOptions} from './camel-case';
|
||||
import type {ApplyDefaultOptions, NonRecursiveType} from './internal';
|
||||
import type {UnknownArray} from './unknown-array';
|
||||
|
||||
/**
|
||||
Convert object properties to camel case recursively.
|
||||
|
||||
This can be useful when, for example, converting some API types from a different style.
|
||||
|
||||
@see CamelCasedProperties
|
||||
@see CamelCase
|
||||
|
||||
@example
|
||||
```
|
||||
import type {CamelCasedPropertiesDeep} from 'type-fest';
|
||||
|
||||
interface User {
|
||||
UserId: number;
|
||||
UserName: string;
|
||||
}
|
||||
|
||||
interface UserWithFriends {
|
||||
UserInfo: User;
|
||||
UserFriends: User[];
|
||||
}
|
||||
|
||||
const result: CamelCasedPropertiesDeep<UserWithFriends> = {
|
||||
userInfo: {
|
||||
userId: 1,
|
||||
userName: 'Tom',
|
||||
},
|
||||
userFriends: [
|
||||
{
|
||||
userId: 2,
|
||||
userName: 'Jerry',
|
||||
},
|
||||
{
|
||||
userId: 3,
|
||||
userName: 'Spike',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const preserveConsecutiveUppercase: CamelCasedPropertiesDeep<{fooBAR: { fooBARBiz: [{ fooBARBaz: string }] }}, {preserveConsecutiveUppercase: false}> = {
|
||||
fooBar: {
|
||||
fooBarBiz: [{
|
||||
fooBarBaz: 'string',
|
||||
}],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
@category Change case
|
||||
@category Template literal
|
||||
@category Object
|
||||
*/
|
||||
export type CamelCasedPropertiesDeep<
|
||||
Value,
|
||||
Options extends CamelCaseOptions = {},
|
||||
> = _CamelCasedPropertiesDeep<Value, ApplyDefaultOptions<CamelCaseOptions, DefaultCamelCaseOptions, Options>>;
|
||||
|
||||
type _CamelCasedPropertiesDeep<
|
||||
Value,
|
||||
Options extends Required<CamelCaseOptions>,
|
||||
> = Value extends NonRecursiveType
|
||||
? Value
|
||||
: Value extends UnknownArray
|
||||
? CamelCasedPropertiesArrayDeep<Value, Options>
|
||||
: Value extends Set<infer U>
|
||||
? Set<_CamelCasedPropertiesDeep<U, Options>>
|
||||
: Value extends object
|
||||
? {
|
||||
[K in keyof Value as CamelCase<K, Options>]: _CamelCasedPropertiesDeep<Value[K], Options>;
|
||||
}
|
||||
: Value;
|
||||
|
||||
// This is a copy of DelimiterCasedPropertiesArrayDeep (see: delimiter-cased-properties-deep.d.ts).
|
||||
// These types should be kept in sync.
|
||||
type CamelCasedPropertiesArrayDeep<
|
||||
Value extends UnknownArray,
|
||||
Options extends Required<CamelCaseOptions>,
|
||||
> = Value extends []
|
||||
? []
|
||||
// Trailing spread array
|
||||
: Value extends [infer U, ...infer V]
|
||||
? [_CamelCasedPropertiesDeep<U, Options>, ..._CamelCasedPropertiesDeep<V, Options>]
|
||||
: Value extends readonly [infer U, ...infer V]
|
||||
? readonly [_CamelCasedPropertiesDeep<U, Options>, ..._CamelCasedPropertiesDeep<V, Options>]
|
||||
: // Leading spread array
|
||||
Value extends readonly [...infer U, infer V]
|
||||
? [..._CamelCasedPropertiesDeep<U, Options>, _CamelCasedPropertiesDeep<V, Options>]
|
||||
: // Array
|
||||
Value extends Array<infer U>
|
||||
? Array<_CamelCasedPropertiesDeep<U, Options>>
|
||||
: Value extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<_CamelCasedPropertiesDeep<U, Options>>
|
||||
: never;
|
||||
43
frontend/node_modules/ts-jest/node_modules/type-fest/source/camel-cased-properties.d.ts
generated
vendored
Normal file
43
frontend/node_modules/ts-jest/node_modules/type-fest/source/camel-cased-properties.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import type {CamelCase, CamelCaseOptions, DefaultCamelCaseOptions} from './camel-case';
|
||||
import type {ApplyDefaultOptions} from './internal';
|
||||
|
||||
/**
|
||||
Convert object properties to camel case but not recursively.
|
||||
|
||||
This can be useful when, for example, converting some API types from a different style.
|
||||
|
||||
@see CamelCasedPropertiesDeep
|
||||
@see CamelCase
|
||||
|
||||
@example
|
||||
```
|
||||
import type {CamelCasedProperties} from 'type-fest';
|
||||
|
||||
interface User {
|
||||
UserId: number;
|
||||
UserName: string;
|
||||
}
|
||||
|
||||
const result: CamelCasedProperties<User> = {
|
||||
userId: 1,
|
||||
userName: 'Tom',
|
||||
};
|
||||
|
||||
const preserveConsecutiveUppercase: CamelCasedProperties<{fooBAR: string}, {preserveConsecutiveUppercase: false}> = {
|
||||
fooBar: 'string',
|
||||
};
|
||||
```
|
||||
|
||||
@category Change case
|
||||
@category Template literal
|
||||
@category Object
|
||||
*/
|
||||
export type CamelCasedProperties<Value, Options extends CamelCaseOptions = {}> = Value extends Function
|
||||
? Value
|
||||
: Value extends Array<infer U>
|
||||
? Value
|
||||
: {
|
||||
[K in keyof Value as
|
||||
CamelCase<K, ApplyDefaultOptions<CamelCaseOptions, DefaultCamelCaseOptions, Options>>
|
||||
]: Value[K];
|
||||
};
|
||||
45
frontend/node_modules/ts-jest/node_modules/type-fest/source/conditional-except.d.ts
generated
vendored
Normal file
45
frontend/node_modules/ts-jest/node_modules/type-fest/source/conditional-except.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import type {Except} from './except';
|
||||
import type {ConditionalKeys} from './conditional-keys';
|
||||
|
||||
/**
|
||||
Exclude keys from a shape that matches the given `Condition`.
|
||||
|
||||
This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Primitive, ConditionalExcept} from 'type-fest';
|
||||
|
||||
class Awesome {
|
||||
name: string;
|
||||
successes: number;
|
||||
failures: bigint;
|
||||
|
||||
run() {}
|
||||
}
|
||||
|
||||
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
||||
//=> {run: () => void}
|
||||
```
|
||||
|
||||
@example
|
||||
```
|
||||
import type {ConditionalExcept} from 'type-fest';
|
||||
|
||||
interface Example {
|
||||
a: string;
|
||||
b: string | number;
|
||||
c: () => void;
|
||||
d: {};
|
||||
}
|
||||
|
||||
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
||||
//=> {b: string | number; c: () => void; d: {}}
|
||||
```
|
||||
|
||||
@category Object
|
||||
*/
|
||||
export type ConditionalExcept<Base, Condition> = Except<
|
||||
Base,
|
||||
ConditionalKeys<Base, Condition>
|
||||
>;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user