commit node_modules and generated files

This commit is contained in:
Robert Brignull 2020-08-11 12:43:27 +01:00
parent 6d7a135fea
commit 34b372292b
3379 changed files with 449603 additions and 2029 deletions

3
node_modules/ts-loader/.eslintignore generated vendored Normal file
View file

@ -0,0 +1,3 @@
/.test/**
/dist/**
/test/**

37
node_modules/ts-loader/.eslintrc.js generated vendored Normal file
View file

@ -0,0 +1,37 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['plugin:node/recommended', 'plugin:prettier/recommended'],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
settings: {
node: {
tryExtensions: ['.js', '.json', '.ts', '.d.ts'],
},
},
rules: {
// 'no-process-exit': 'off', // to investigate if we should throw an error instead of process.exit()
// 'node/no-unsupported-features/es-builtins': 'off',
},
overrides: [
{
files: ['*.ts'],
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
rules: {
'node/no-unsupported-features/es-syntax': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
// '@typescript-eslint/explicit-function-return-type': 'off',
// '@typescript-eslint/no-namespace': 'off' // maybe we should consider enabling it in the future
},
},
],
};

1
node_modules/ts-loader/.prettierignore generated vendored Normal file
View file

@ -0,0 +1 @@
/test/**

8
node_modules/ts-loader/.prettierrc generated vendored Normal file
View file

@ -0,0 +1,8 @@
{
"arrowParens": "avoid",
"singleQuote": true,
"semi": true,
"tabWidth": 2,
"useTabs": false,
"printWidth": 80
}

580
node_modules/ts-loader/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,580 @@
# Changelog
## v8.0.2
* [Fix 2 issues with experimentalWatchApi](https://github.com/TypeStrong/ts-loader/pull/1159) - thanks @appzuka
## v8.0.1
* [Fix webpack deprecations](https://github.com/TypeStrong/ts-loader/pull/1135) - thanks @g-plane
## v8.0.0
* [Support for symlinks in project references](https://github.com/TypeStrong/ts-loader/pull/1136) - thanks @sheetalkamat!
* `ts-loader` now supports TypeScript 3.6 and greater **BREAKING CHANGE**
## v7.0.5
* [Add a delay before starting the comparison tests to avoid failures under WSL](https://github.com/TypeStrong/ts-loader/pull/1109) - thanks @appzuka
* [Apply other loaders when updating files in watch mode](https://github.com/TypeStrong/ts-loader/pull/1115) - thanks @iorate
## v7.0.4
* [Ensure a separate webpack instance is created for different loader options](https://github.com/TypeStrong/ts-loader/pull/1104) - thanks @appzuka
## v7.0.3
* [Ensure that JSON files are included in build module resolution](https://github.com/TypeStrong/ts-loader/pull/1101) - thanks @berickson1
## v7.0.2
* [Make content hash consistent across machines](https://github.com/TypeStrong/ts-loader/pull/1085) - thanks @elyalvarado
## v7.0.1
* [fix: watch-run](https://github.com/TypeStrong/ts-loader/pull/1083) - thanks @zn4rk
## v7.0.0
* [Project reference support enhancements](https://github.com/TypeStrong/ts-loader/pull/1076) - thanks @sheetalkamat!
* Following the end of life of Node 8, `ts-loader` no longer supports Node 8 **BREAKING CHANGE**
## v6.2.2
* [Enable typescript 3.8.3 support when using `webpack.config.ts` files](https://github.com/TypeStrong/ts-loader/issues/1072) - thanks @vladimiry!
## v6.2.1
* [Output types alongside JS files, enable declaration maps](https://github.com/TypeStrong/ts-loader/pull/1026) - thanks @meyer!
## v6.2.0
* [Emitting .tsbuildinfo when using watch api](https://github.com/TypeStrong/ts-loader/pull/1017) - thanks @sheetalkamat!
## v6.1.2
* [don't emit declaration files for a declaration file](https://github.com/TypeStrong/ts-loader/pull/1015) (#1014) - thanks @gvinaccia!
* [Consume typescript apis from typescript nightly](https://github.com/TypeStrong/ts-loader/pull/1016) - thanks @sheetalkamat!
## v6.1.1
* [Fix SolutionBuilder watches](https://github.com/TypeStrong/ts-loader/pull/1003) and [related fixes](https://github.com/TypeStrong/ts-loader/pull/1011) (#998) - thanks @sheetalkamat!
* [fix: no errors reported if flagged with @ts-check](https://github.com/TypeStrong/ts-loader/pull/1008) (#1004) - thanks @reinholdk!
## v6.1.0
* [Build upstream project references with SolutionBuilder](https://github.com/TypeStrong/ts-loader/pull/935) (#851, #913) - thanks @sheetalkamat!
## v6.0.4
* [Fix issue when handling files not included in tsconfig.json](https://github.com/TypeStrong/ts-loader/issues/943) (#934) - thanks @davazp!
## v6.0.3
* [Upgrade typescript version to 3.5.2](https://github.com/TypeStrong/ts-loader/pull/954) (#954) - thanks @fa93hws
## v6.0.2
* [Set configFilePath when reading config file](https://github.com/TypeStrong/ts-loader/pull/942) (#939) - thanks @konpikwastaken!
## v6.0.1
* [Fix issue with `resolveTypeReferenceDirective` causing errors like `Cannot find name 'it'` with Jest](https://github.com/TypeStrong/ts-loader/pull/936) (#934) (#919) - thanks @andrewbranch!
* [Fix TypeScript diagnostics not being printed to console when using project references](https://github.com/TypeStrong/ts-loader/pull/937) (#932) - thanks @andrewbranch!
## v6.0.0
* [Drop support for node < 8.6 related to micromatch upgrade to 4](https://github.com/TypeStrong/ts-loader/pull/930); see: https://github.com/TypeStrong/ts-loader/issues/929
* [Update dependencies](https://github.com/TypeStrong/ts-loader/pull/928) - thanks @johnnyreilly!
## v5.4.5
* [use @types/webpack for loader typings](https://github.com/TypeStrong/ts-loader/pull/927) - thanks @LukeSheard!
## v5.4.4
* [refactor: add common appendTsTsxSuffixesIfRequired function to instance](https://github.com/TypeStrong/ts-loader/pull/924) - thanks @johnnyreilly!
## v5.4.3
* [feat: resolveTypeReferenceDirective support for yarn PnP](https://github.com/TypeStrong/ts-loader/pull/921) - thanks @johnnyreilly!
* [fix: don't include anything apart from ts-loader in publish](https://github.com/TypeStrong/ts-loader/pull/923) - thanks @johnnyreilly!
## v5.3.3
* [fix: Pass ts.Program to getCustomTransformers](https://github.com/TypeStrong/ts-loader/pull/889) (#860) - thanks @andersekdahl!
## v5.3.2
* [feat: enable experimentalFileCaching by default](https://github.com/TypeStrong/ts-loader/pull/885) (#868) - thanks @timocov!
## v5.3.1
* [fix: projectReferences with rootDir](https://github.com/TypeStrong/ts-loader/pull/871) (#868) - thanks @andrewbranch!
## v5.3.0
* [feat: Exposes a `resolveNodeModule` option](https://github.com/TypeStrong/ts-loader/pull/862) - thanks @arcanis!
## v5.2.2
* [feat: Micro-optimizations](https://github.com/TypeStrong/ts-loader/pull/855) - thanks @johnnyreilly
## v5.2.1
* [feat: Lists typescript as a peer dependency](https://github.com/TypeStrong/ts-loader/pull/841) - thanks @arcanis!
## v5.2.0
* [feat: Initial support for project references - `projectReferences`](https://github.com/TypeStrong/ts-loader/pull/817) - thanks @andrewbranch!
## v5.1.1
* [fix(getTranspilationEmit): pass the raw path to transpileModule](https://github.com/TypeStrong/ts-loader/pull/835) - thanks @Brooooooklyn
## v5.1.0
* [feat: Added cache for some FS operations while compiling - `experimentalFileCaching`](https://github.com/TypeStrong/ts-loader/pull/829) - thanks @timocov!
## v5.0.0
* [feat: Fixed issue with incorrect output path for declaration files](https://github.com/TypeStrong/ts-loader/pull/822) - thanks @JonWallsten! **BREAKING CHANGE**
## v4.5.0
* [feat: Added support for TypeScript declaration map](https://github.com/TypeStrong/ts-loader/pull/821) - thanks @JonWallsten!
## v4.4.2
* [fix(loader): new Error to webpack when errors occured in the loader function](https://github.com/TypeStrong/ts-loader/pull/792) - thanks @linxiaowu66 and @systemmetaphor!
## v4.4.1
* [fix(types): expose public interfaces from root index.d.ts](https://github.com/TypeStrong/ts-loader/pull/790) - thanks @Hotell!
## v4.4.0
* [feat: generate ambient types from implementation](https://github.com/TypeStrong/ts-loader/pull/788) - thanks @Hotell!
* [error when not using webpack 4](https://github.com/TypeStrong/ts-loader/pull/786) - thanks @johnnyreilly
## v4.3.1
* [Fix options caching when ts-loader is used in multiple rules](https://github.com/TypeStrong/ts-loader/pull/782) - thanks @yyx990803!
Please note, this bug fix requires that vue-loader users still using v14 should either upgrade to v15 or explicitly pass the same ts-loader options via v14's loaders option. [See more details here](https://github.com/TypeStrong/ts-loader/pull/782#issuecomment-394406093)
## v4.3.0
* [Fix dependency resolution when using pnpm](https://github.com/TypeStrong/ts-loader/pull/774) - thanks @xbtsw and @zkochan!
* [Add `allowTsInNodeModules` option for importing .ts files from node_modules](https://github.com/TypeStrong/ts-loader/pull/773) - thanks @aelawson!
## v4.2.0
* [Pass `context' to error formatters](https://github.com/TypeStrong/ts-loader/pull/756) - thanks @gustavderdrache!
## v4.1.0
* [Fix slow `experimentalWatchApi`](https://github.com/TypeStrong/ts-loader/pull/747) (#746) - thanks @sheetalkamat and @MLoughry!
* [feat: `getCustomTransformers` support path string for a module](https://github.com/TypeStrong/ts-loader/pull/745) - thanks @vagusX and @s-panferov (upon whose work this is based I believe)
## v4.0.1
* [Fix name collision in experimentalWatchApi code](https://github.com/TypeStrong/ts-loader/pull/737) - thanks @MLoughry!
## v4.0.0
* Support webpack 4
* Drop support for webpack 2/3 **BREAKING CHANGE** - use ts-loader 3.x if you need webpack 2/3 support
* Minimum TypeScript version is now 2.4.1 **BREAKING CHANGE**
* Deprecated option `entryFileCannotBeJs` removed' **BREAKING CHANGE**
* Start using [prettier](https://prettier.io/) for the codebase
## v3.5.0
* [Add trace for traceResolution](https://github.com/TypeStrong/ts-loader/pull/721) - thanks @onigoetz!
## v3.4.0
* [local .d.ts files now marked as changed when watch is triggered](https://github.com/TypeStrong/ts-loader/pull/698) - thanks @KnisterPeter!
## v3.3.1
* [Fixes to support watch api for compiling - lib support etc](https://github.com/TypeStrong/ts-loader/pull/715) - thanks @sheetalkamat!
## v3.3.0
* [Report diagnostics only on certain files with `reportFiles` option](https://github.com/TypeStrong/ts-loader/pull/701) - thanks @freeman!
* [Replaced option `contextAsConfigBasePath` with `context` option.](https://github.com/TypeStrong/ts-loader/pull/688/) Strictly speaking a breaking change. However, given the original option was never able to fulfil its intended purpose I've decided to treat this as just a new feature; there seems no possibility that anyone can be using `contextAsConfigBasePath` - thanks @christiantinauer!
* [Added support for the new watch api of TypeScript compiler.](https://github.com/TypeStrong/ts-loader/pull/685) nb This feature has been placed behind a new `experimentalWatchApi` option until it has been thoroughly tested. All being well it is likely to become the default behaviour for ts-loader in future - thanks @sheetalkamat!
## v3.2.0
* [Add new loader option `contextAsConfigBasePath`](https://github.com/TypeStrong/ts-loader/pull/681) - thanks @christiantinauer
## v3.1.1
* [Fix error importing buildt ts files with allowJs](https://github.com/TypeStrong/ts-loader/pull/674) (#667) - thanks @Pajn!
## v3.1.0
* [Add `onlyCompileBundledFiles` option which modifies behaviour to load only those files that are actually bundled by webpack](https://github.com/TypeStrong/ts-loader/pull/671) #267 - thanks @maier49!
* [Chore release; upgraded chalk dependency in `package.json` to 2.3, as 2.3 is another breaking changes release (from a TypeScript perspective).](https://github.com/TypeStrong/ts-loader/issues/664), see [here](https://github.com/chalk/chalk/issues/215) for context - thanks @johnnyreilly
## v3.0.5
* [Chore release; upgraded chalk dependency in `package.json` to 2.2, as 2.2 appears to be a breaking changes release.](https://github.com/TypeStrong/ts-loader/issues/664) - thanks @lmk123 for reporting
## v3.0.4
* [Chore release; upgraded chalk dependency.](https://github.com/TypeStrong/ts-loader/pull/662) - thanks @johnnyreilly
## v3.0.3
* [Fix allowJs @types resolution error](https://github.com/TypeStrong/ts-loader/pull/658) (#657, #655) - thanks @johnnyreilly and @roddypratt + @ldrick for providing minimal repro repos which allowed me to fix this long standing bug!
This fix resolves the issue for TypeScript 2.4+ (which is likely 95% of users). For those people stuck on 2.3 or below and impacted by this issue, you should be able to workaround this by setting `entryFileCannotBeJs: true` in your ts-loader options. This option should be considered deprecated as of this release. The option will likely disappear with the next major version of ts-loader which will drop support for TypeScript 2.3 and below, thus removing the need for this option.
## v3.0.0
All changes were made with this [PR](https://github.com/TypeStrong/ts-loader/pull/643) - thanks @johnnyreilly
([Published to npm as v3.0.2 due to npm publishing issues](https://github.com/TypeStrong/ts-loader/issues/654)) thanks @mattlewis92 for noticing!
* drop support for typescript < 2.0 (no-one seems to be using it and we can simplify the code) **BREAKING CHANGE**
* remove `entryFileIsJs` option; it can be inferred from whether the `allowJs` TypeScript compiler option has been set.
* move to webpack 3.0 for test harness
* drop `configFileName` support [(replaced by `configFile`)](https://github.com/TypeStrong/ts-loader/pull/607) **BREAKING CHANGE**
* add support for a custom formatter for output - drop visual studio format (this can be added back if there's clamour for it and people can supply their own formatters in the interim) **BREAKING CHANGE**
* make loglevel warn by default (stop outputting typescript version number by default). Fixes [#488](https://github.com/TypeStrong/ts-loader/issues/488)
* fix [tsc has "module" default to "es2015"when targetting es2015+, but ts-loader does not](https://github.com/TypeStrong/ts-loader/issues/570) - thanks [@Venryx](https://github.com/Venryx) for the suggestion!
* [switch to build ts-loader / run tests with yarn](https://github.com/TypeStrong/ts-loader/issues/369) because of [this](https://stackoverflow.com/questions/45022048/why-does-npm-install-rewrite-package-lock-json/45566871#45566871)
* allow controlling whether the output can contain colours
## v2.3.7
* [Start validating the options supplied to the loader](https://github.com/TypeStrong/ts-loader/pull/630) (#629) - thanks @johnnyreilly!
## v2.3.6
* [Fix kills ts-loader dependant builds issue](https://github.com/TypeStrong/ts-loader/pull/627) (#626) - thanks @Loilo!
## v2.3.5
* [Add an additional check for js files before reusing isExternalLibaryImport](https://github.com/TypeStrong/ts-loader/pull/622) (#620) - thanks @WillMartin!
* [Make TypeScript `basePath` configurable](https://github.com/TypeStrong/ts-loader/pull/621) (#618) - thanks @Loilo!
* [Fix relative configFile path](https://github.com/TypeStrong/ts-loader/pull/618) (#617) - thanks @Loilo!
## v2.3.4
* [Add `configFile` option](https://github.com/TypeStrong/ts-loader/pull/607) - thanks @Loilo!
## v2.3.3
* [fix(tsconfig): stop passing rootDir option to TypeScript compiler](https://github.com/TypeStrong/ts-loader/pull/598) (#597) - thanks @Brooooooklyn
* [Fix findConfigFile in Windows](https://github.com/TypeStrong/ts-loader/pull/605) (#604) - thanks @mengxy
## v2.3.2
* [Move to use strictNullChecks](https://github.com/TypeStrong/ts-loader/pull/589) - thanks @johnnyreilly
* [`allowJs` supports importing types from external libraries](https://github.com/TypeStrong/ts-loader/pull/590) (#586, #577) - thanks @bsouthga!
## v2.3.1
* [Fix undefined watcher in watch-run causes error](https://github.com/TypeStrong/ts-loader/pull/587) (#585) - thanks @zinserjan and @sokra!
## v2.3.0
* [add appendTsxSuffixTo option to support using tsx with Vue](https://github.com/TypeStrong/ts-loader/pull/581) - lots of discussion went into this PR. Thanks to @vhqtvn (author) and @HerringtonDarkholme, @johnnyreilly, @jbrantly, @octref, @rhyek and others for helping us land on our final implementation.
* [refactor: Use chalk instead of colors](https://github.com/TypeStrong/ts-loader/pull/579) - thanks @develar!
## v2.2.2
* [Remove default of setting isolatedModules to true when in transpileOnly mode](https://github.com/TypeStrong/ts-loader/pull/569) - thanks @johnnyreilly and @donaldpipowitch
## v2.2.1
* [Report errors in JS(X) files when CheckJS is enabled](https://github.com/TypeStrong/ts-loader/pull/564) - thanks @schmuli!
* [Cater for change to @types acquisition strategy in TypeScript 2.4.1](https://github.com/TypeStrong/ts-loader/pull/566) - thanks @johnnyreilly
## v2.2.0
* [Support custom transformers for ts](https://github.com/TypeStrong/ts-loader/pull/535) - thanks @longlho and @Igorbek!
## v2.1.0
* [Add happypack compatibility mode](https://github.com/TypeStrong/ts-loader/pull/547) - thanks @aindlq!
## v2.0.3
* [Don't include appended TS extension in webpack dependencies](https://github.com/TypeStrong/ts-loader/pull/497) - thanks again @wearymonkey!
## v2.0.2
* [Fix performance regression related to using getTimes() by tracking timestamps](https://github.com/TypeStrong/ts-loader/pull/500) - thanks @wearymonkey
## v2.0.1
* [make watch resilient to no watcher / watcher.mtimes](https://github.com/TypeStrong/ts-loader/pull/482) - thanks @bancek and @mredbishop
* [move to using loader-utils 1.0](https://github.com/TypeStrong/ts-loader/pull/475)
## v2.0.0
* [Add support for IgnoringWatchFileSystem](https://github.com/TypeStrong/ts-loader/pull/444) - thanks @herschel666
* [Use native Object.assign()](https://github.com/TypeStrong/ts-loader/pull/418) - thanks @arusakov
Breaking changes:
* ts-loader now officially only supports webpack 2. ts-loader 2.x may work with webpack 1 but it is not supported. Related to that, all continuous integration tests now run against webpack 2.
* as webpack 2 does not support node 0.12 neither does ts-loader from now. node 4 at least is required.
## v1.3.3
* [Fix bug when "extend"ing a tsconfig that specifies "allowJs"](https://github.com/TypeStrong/ts-loader/pull/415) Thanks @cspotcode
* [Minor perf optimisations](https://github.com/TypeStrong/ts-loader/pull/412)
## v1.3.2
* [Upgrade enhanced-resolve to v3](https://github.com/TypeStrong/ts-loader/pull/411)
* [Remove arrify dependency](https://github.com/TypeStrong/ts-loader/pull/410)
## v1.3.1
* [Rolled back re-exported const enums no longer break emit in watch mode as performance cost was too high](https://github.com/TypeStrong/ts-loader/pull/406) resolves #393
## v1.3.0
* [Introduce meaningful error when importing TypeScript from `node_modules`](https://github.com/TypeStrong/ts-loader/pull/399)
* [Introduce `entryFileIsJs` loader option which allows having an entry file which is js.](https://github.com/TypeStrong/ts-loader/pull/399) resolves #388 and #401 - thanks @Wykks and @pqr.
NB Previously the `entryFileIsJs` option was on by default when `allowJs` was true. Now it has to be specified directly. Strictly speaking this is a breaking change; however given this is a rarely used option which exists for what is arguably an edge case this is being added without moving to 2.0. If this breaks people then we'll never do this again; I'd be surprised if anyone is relying on this though so we're taking a chance. Related tests have been suffixed "-entryFileIsJs" in the test name.
## v1.2.2
* [Re-exported const enums no longer break emit in watch mode](https://github.com/TypeStrong/ts-loader/pull/377) [#376] - thanks @smphhh
* [typescript.sys should be compiler.sys](https://github.com/TypeStrong/ts-loader/pull/380) [#379] - thanks @johnnyreilly and @jbrantly
## v1.2.1
* [Fix TS module resolution paths on Windows - watch mode becomes faster](https://github.com/TypeStrong/ts-loader/pull/373) [#372] - thanks @smphhh
## v1.2.0
* [Crash when adding/removing files in watch-mode](https://github.com/TypeStrong/ts-loader/pull/364) [#358] - thanks @jbbr for the suggested fix
* [Provided an option to produce Visual Studio compatible error output](https://github.com/TypeStrong/ts-loader/pull/356) [#355] - thanks @gamli
## v1.1.0
* [Added support for vuejs via `appendTsSuffixTo` option](https://github.com/TypeStrong/ts-loader/pull/354) [#270] - thanks @HerringtonDarkholme
## v1.0.0
* [General refactor of ts-loader; some performance improvements](https://github.com/TypeStrong/ts-loader/pull/343) [#335] - thanks @johnnyreilly
* [Make the loader resilient to watched declaration files being removed.](https://github.com/TypeStrong/ts-loader/pull/281) - thanks @opichals
## v0.9.5
* [Improve performance for watch mode / `after-compile` plugin](https://github.com/TypeStrong/ts-loader/pull/187) - thanks @Strate
## v0.9.4
* [Make logging to stderr or stdout configurable; introduce logging levels](https://github.com/TypeStrong/ts-loader/pull/313) [#214] - thanks @ThYpHo0n
* [Fix regression that broke hot module replacement](https://github.com/TypeStrong/ts-loader/pull/322) [#321] - thanks @dopare
## v0.9.3
* [Added support for allowJs](https://github.com/TypeStrong/ts-loader/pull/320) (#316) - thanks @dschnare
## v0.9.2
* [Added support for @types](https://github.com/TypeStrong/ts-loader/pull/318) (#247) -thanks @basarat for the ideas
## v0.9.1
* [Normalize dependency graph paths - Fix broken dependencies on Windows ](https://github.com/TypeStrong/ts-loader/pull/286) - thanks @pzavolinsky
* [Fixed the declaration issue](https://github.com/TypeStrong/ts-loader/pull/307) (#214 part deux) - thanks @dizel3d
## v0.9.0
* [Made ts-loader compatible with node v6](https://github.com/TypeStrong/ts-loader/commit/a4f835345e495f45b40365f025afce72d1817996) - thanks @Blechhirn
* [Fixed the declaration issue](https://github.com/TypeStrong/ts-loader/commit/3bb0fec73a2fab47953b51d256f0f5378f236ad1) (#214) - thanks @17cupsofcoffee
* [Declarations update independent of compiler.watchFileSystem](https://github.com/TypeStrong/ts-loader/pull/167/commits/ae824b2676b226bdd0c860a787754a4ae28e339c) (#155) - thanks @opichals
Now built using TypeScript v2.0
## v0.8.2
* Elided imports are now watched (#156, #169)
* Declaration files for `.d.ts` files are now emitted (thanks @rob-bateman) (#174, #175)
## v0.8.1
* Add better error messaging when a file in tsconfig.json can not be loaded (#117, #145)
* Fix incompatibility with html-webpack-plugin (#152, #154)
## v0.8.0
* Add support for emitting declaration files when `declaration: true` is set (#48, #128)
* Fix bug with specifying `target: es6` and `module: commonjs` at the same time when using
TS 1.7+ (#111, #132, #140).
* Fix bug with resolving dependencies which are linked using `npm link` (#134, #141)
## v0.7.2
* Fix regression with watching definition files (#109, #110)
## v0.7.1
* Fix regression with Windows that was introduced in v0.7.0 (#92)
## v0.7.0
* Fix bug with webpack resolution that could sometimes cause TypeScript to not find modules (#92, #102)
* Loader output is now written to stderr instead of stdout. (#95, #103)
## v0.6.1
* Improve initial build performance significantly for larger projects (#100)
* Fix issue with nightly (#96)
## v0.6.0
* Remove support for 1.5 and 1.6-beta. TypeScript 1.6 (stable) is the now the lowest version
supported.
* Fix issue when using source maps and Babel in certain situations (#81)
* Fix issue with nightly (#83)
## v0.5.6
* Add ignoreDiagnostics feature
* Fix issue with node resolution and `noEmitOnError` (#71)
## v0.5.5
* Fix issue with nightly (Microsoft/TypeScript#4738)
* Add support for the NoErrorsPlugin
## v0.5.4
* Fix issue with nightly (Microsoft/TypeScript#4497)
## v0.5.3
* Utilize TypeScript's new custom module resolution logic to integrate with webpack. This essentially
means that TypeScript will resolve files exactly the same as webpack does (supporting aliases, etc).
See the [aliasResolution test](test/aliasResolution) for an example. Only supported in TS 1.6 and
above.
* Rework error reporting to resolve certain edge cases with dependencies. In general errors should
be much more consistent now in watch mode.
* Fix issue with targeting ES6 and transpile mode (#36)
## v0.5.2
* Fix issue with TypeScript nightly and new node module resolution strategy (#34)
## v0.5.1
* Tweaked error message output to include error code (#32)
* Add helpful messages around the TypeScript dependency
* Suggest how to install TypeScript if it hasn't been installed
* Show TypeScript version when compiling
* Warn if TypeScript version is incompatible
## v0.5.0
* Add support for `transpileOnly` loader option. See README for more information.
* TypeScript is no longer a dependency of the loader and must be installed separately
* Loader options can now be set as a property in `webpack.config.js`
* TypeScript options can be set through the loader option `compilerOptions`
* Improved error reporting
* Errors from all files in the TypeScript application are now reported in watch mode instead of
from just those files that changed. This means that making a breaking change in a dependency
will now be correctly reported as an error in the dependent file.
* Errors with TypeScript options are now reported as webpack errors instead of logged to console
* Error output no longer contains the filename once from webpack and again in the error message.
Instead, the filename is only reported by webpack
* Fixed issue with latest version of webpack where filenames could be reported twice for the same
error in certain situations
* Using the `declaration` TypeScript option no longer results in errors
* Add support for the `newLine` TypeScript option
* Tests have been revamped to be full integration tests with nightly builds against the current stable
and nightly TypeScript. Many new tests have been added.
## v0.4.7
* Update TypeScript dependency to 1.5 release (1.5.3)
## v0.4.6
* Improve error reporting related to tsconfig.json
* Fix bug that reported the wrong errors
* Errors are now reported as webpack errors instead of logged to console
* Add support for latest TypeScript nightly (#24)
## v0.4.5
* Add `silent` flag (#22)
## v0.4.4
* Add support for "noLib" compiler option (#19)
* Make errors easier to parse programmatically (#20)
* Errors in declaration files are now added to the stats object instead of written to console
* Errors now include `file`, `rawMessage`, and `location` properties
* Make --watch option more robust
* Fix issue where changes to entry file were not detected
* Fix issue where changes to typing information only did not result in a rebuild (#21)
## v0.4.3
* Fix error locations to be 1-based instead of 0-based (#18)
## v0.4.2
* Rework the way dependencies are loaded (#14)
* Fix NPM dependency on TypeScript (#15, #16)
## v0.4.1
* Fix Windows issue with paths (#14)
## v0.4.0
* TypeScript 1.5 support! (#14)
* tsconfig.json support (#2, #9)
* ES6 target support
* Remove TS-related options in favor of specifying them in tsconfig.json
* Add `configFileName` option for custom tsconfig files
## v0.3.4
* Exclude TS 1.5 as a dependency since there are breaking changes
## v0.3.3
* Add support for reporting errors in declaration files (#10)
* Add support for watch mode for declaration files (#11)
* Fix issue with extra `sourceMappingURL` in output files (#12)
## v0.3.2
* Add support for manually adding files (#6)
* Add paths to source maps (#8)
## v0.3.1
* Add support for specifying a custom TypeScript compiler
## v0.3.0
* Change how modules are resolved. Imports and declaration file references are
now resolved through TypeScript instead of being resolved through webpack's
`resolve` API. This fixes a number of issues and better aligns the loader to
work as a replacement for the `tsc` command. (#3, #4, #5)
## v0.2.3
* Add noImplicitAny option (#2)
## v0.2.2
* Fix issue with source maps
## v0.2.1
* Add colors to error output
## v0.2.0
* Add new configuration options (#1)
* target, module, sourceMap, instance
* sourceMap default changed from `true` to `false`
* Workaround issue with TypeScript always emitting Windows-style new lines
* Add tests
## v0.1.0
* Initial version

7
node_modules/ts-loader/HISTORY.md generated vendored Normal file
View file

@ -0,0 +1,7 @@
# History
`ts-loader` was started by [James Brantly](http://www.jbrantly.com/) back in January 2015. He created the initial codebase, wrote the comparison testpack and merrily maintained it until it reached v0.8.2.
At that point [John Reilly](https://blog.johnnyreilly.com/) started maintaining ts-loader. [On October 16th 2016 to be exact](https://twitter.com/jbrantly/status/785931975064444928). The full story of how that came to be can be read here: https://blog.johnnyreilly.com/2016/11/but-you-cant-die-i-love-you-ts-loader.html
Since that time, John (who wrote this and finds it peculiar to refer to himself in the third person) has continued maintaining ts-loader. He appreciates any and all people that contribute. Who knows, maybe one day the mantle will be passed on again and someone else will step up and take ts-loader forwards. Who knows? It could be you ;-)

22
node_modules/ts-loader/LICENSE generated vendored Normal file
View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 TypeStrong
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.

738
node_modules/ts-loader/README.md generated vendored Normal file
View file

@ -0,0 +1,738 @@
# TypeScript loader for webpack
[![npm version](https://img.shields.io/npm/v/ts-loader.svg)](https://www.npmjs.com/package/ts-loader)
[![Linux Build Status](https://travis-ci.org/TypeStrong/ts-loader.svg?branch=master)](https://travis-ci.org/TypeStrong/ts-loader)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/bjh0r0d4ckspgkh9/branch/master?svg=true)](https://ci.appveyor.com/project/JohnReilly/ts-loader/branch/master)
[![Downloads](http://img.shields.io/npm/dm/ts-loader.svg)](https://npmjs.org/package/ts-loader)
[![node version](https://img.shields.io/node/v/ts-loader.svg)](https://www.npmjs.com/package/ts-loader)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![Join the chat at https://gitter.im/TypeStrong/ts-loader](https://img.shields.io/badge/gitter-join%20chat-brightgreen.svg)](https://gitter.im/TypeStrong/ts-loader)
<br />
<p align="center">
<h3 align="center">ts-loader</h3>
<p align="center">
This is the TypeScript loader for webpack.
<br />
<br />
<a href="https://github.com/TypeStrong/ts-loader/issues">Installation</a>
·
<a href="https://github.com/TypeStrong/ts-loader/issues">Report Bug</a>
·
<a href="https://github.com/TypeStrong/ts-loader/issues">Request Feature</a>
</p>
</p>
## Table of Contents
<!-- toc -->
- [Getting Started](#getting-started)
* [Installation](#installation)
* [Running](#running)
* [Examples](#examples)
* [Faster Builds](#faster-builds)
* [Yarn PlugnPlay](#yarn-plugnplay)
* [Babel](#babel)
* [Parallelising Builds](#parallelising-builds)
* [Compatibility](#compatibility)
* [Configuration](#configuration)
+ [`devtool` / sourcemaps](#devtool--sourcemaps)
* [Code Splitting and Loading Other Resources](#code-splitting-and-loading-other-resources)
* [Declarations (.d.ts)](#declarations-dts)
* [Failing the build on TypeScript compilation error](#failing-the-build-on-typescript-compilation-error)
* [`baseUrl` / `paths` module resolution](#baseurl--paths-module-resolution)
* [Options](#options)
* [Loader Options](#loader-options)
+ [transpileOnly](#transpileonly)
+ [happyPackMode](#happypackmode)
+ [resolveModuleName and resolveTypeReferenceDirective](#resolvemodulename-and-resolvetypereferencedirective)
+ [getCustomTransformers](#getcustomtransformers)
+ [logInfoToStdOut](#loginfotostdout)
+ [logLevel](#loglevel)
+ [silent](#silent)
+ [ignoreDiagnostics](#ignorediagnostics)
+ [reportFiles](#reportfiles)
+ [compiler](#compiler)
+ [configFile](#configfile)
+ [colors](#colors)
+ [errorFormatter](#errorformatter)
+ [compilerOptions](#compileroptions)
+ [instance](#instance)
+ [appendTsSuffixTo](#appendtssuffixto)
+ [appendTsxSuffixTo](#appendtsxsuffixto)
+ [onlyCompileBundledFiles](#onlycompilebundledfiles)
+ [allowTsInNodeModules](#allowtsinnodemodules)
+ [context](#context)
+ [experimentalFileCaching](#experimentalfilecaching)
+ [projectReferences](#projectreferences)
* [Usage with webpack watch](#usage-with-webpack-watch)
* [Hot Module replacement](#hot-module-replacement)
- [Contributing](#contributing)
- [License](#license)
<!-- tocstop -->
## Getting Started
### Installation
```
yarn add ts-loader --dev
```
or
```
npm install ts-loader --save-dev
```
You will also need to install TypeScript if you have not already.
```
yarn add typescript --dev
```
or
```
npm install typescript --save-dev
```
### Running
Use webpack like normal, including `webpack --watch` and `webpack-dev-server`, or through another
build system using the [Node.js API](http://webpack.github.io/docs/node.js-api.html).
### Examples
We have a number of example setups to accommodate different workflows. Our examples can be found [here](examples/).
We probably have more examples than we need. That said, here's a good way to get started:
- I want the simplest setup going. Use "[vanilla](examples/vanilla)" `ts-loader`
- I want the fastest compilation that's available. Use [fork-ts-checker-webpack-plugin](https://github.com/Realytics/fork-ts-checker-webpack-plugin). It performs type checking in a separate process with `ts-loader` just handling transpilation.
### Faster Builds
As your project becomes bigger, compilation time increases linearly. It's because typescript's semantic checker has to inspect all files on every rebuild. The simple solution is to disable it by using the `transpileOnly: true` option, but doing so leaves you without type checking and *will not output declaration files*.
You probably don't want to give up type checking; that's rather the point of TypeScript. So what you can do is use the [fork-ts-checker-webpack-plugin](https://github.com/Realytics/fork-ts-checker-webpack-plugin). It runs the type checker on a separate process, so your build remains fast thanks to `transpileOnly: true` but you still have the type checking. Also, the plugin has several optimizations to make incremental type checking faster (AST cache, multiple workers).
If you'd like to see a simple setup take a look at [our simple example](examples/fork-ts-checker-webpack-plugin/). For a more complex setup take a look at our [more involved example](examples/react-babel-karma-gulp).
### Yarn PlugnPlay
`ts-loader` supports [Yarn PlugnPlay](https://yarnpkg.com/en/docs/pnp). The recommended way to integrate is using the [pnp-webpack-plugin](https://github.com/arcanis/pnp-webpack-plugin#ts-loader-integration).
### Babel
`ts-loader` works very well in combination with [babel](https://babeljs.io/) and [babel-loader](https://github.com/babel/babel-loader). There is an [example](https://github.com/Microsoft/TypeScriptSamples/tree/master/react-flux-babel-karma) of this in the official [TypeScript Samples](https://github.com/Microsoft/TypeScriptSamples). Alternatively take a look at our own [example](examples/react-babel-karma-gulp).
### Parallelising Builds
It's possible to parallelise your builds. Historically this was useful from a performance perspective with webpack 2 / 3. [With webpack 4+ there appears to be significantly less benefit and perhaps even cost.](https://blog.johnnyreilly.com/2018/12/you-might-not-need-thread-loader.html)
But if that's what you want to do, there's two ways to achieve this: [happypack](https://github.com/amireh/happypack) and [thread-loader](https://github.com/webpack-contrib/thread-loader). Both should be used in combination with [fork-ts-checker-webpack-plugin](https://github.com/Realytics/fork-ts-checker-webpack-plugin) for typechecking.)
To read more, look at [this post](https://medium.com/webpack/typescript-webpack-super-pursuit-mode-83cc568dea79) by [@johnny_reilly](https://twitter.com/johnny_reilly) on the webpack publication channel.
If you'd like find out further ways to improve your build using the watch API then take a look at [this post](https://medium.com/@kenneth_chau/speeding-up-webpack-typescript-incremental-builds-by-7x-3912ba4c1d15) by [@kenneth_chau](https://twitter.com/kenneth_chau).
### Compatibility
* TypeScript: 2.4.1+
* webpack: 4.x+ (please use `ts-loader` 3.x if you need webpack 2 or 3 support)
* node: 6.11.5 minimum (aligned with webpack 4)
A full test suite runs each night (and on each pull request). It runs both on [Linux](https://travis-ci.org/TypeStrong/ts-loader) and [Windows](https://ci.appveyor.com/project/JohnReilly/ts-loader), testing `ts-loader` against major releases of TypeScript. The test suite also runs against TypeScript@next (because we want to use it as much as you do).
If you become aware of issues not caught by the test suite then please let us know. Better yet, write a test and submit it in a PR!
### Configuration
1. Create or update `webpack.config.js` like so:
```javascript
module.exports = {
mode: "development",
devtool: "inline-source-map",
entry: "./app.ts",
output: {
filename: "bundle.js"
},
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: [".ts", ".tsx", ".js"]
},
module: {
rules: [
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
{ test: /\.tsx?$/, loader: "ts-loader" }
]
}
};
```
2. Add a [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) file. (The one below is super simple; but you can tweak this to your hearts desire)
```json
{
"compilerOptions": {
"sourceMap": true
}
}
```
The [tsconfig.json](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) file controls
TypeScript-related options so that your IDE, the `tsc` command, and this loader all share the
same options.
#### `devtool` / sourcemaps
If you want to be able to debug your original source then you can thanks to the magic of sourcemaps. There are 2 steps to getting this set up with `ts-loader` and webpack.
First, for `ts-loader` to produce **sourcemaps**, you will need to set the [tsconfig.json](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) option as `"sourceMap": true`.
Second, you need to set the `devtool` option in your `webpack.config.js` to support the type of sourcemaps you want. To make your choice have a read of the [`devtool` webpack docs](https://webpack.js.org/configuration/devtool/). You may be somewhat daunted by the choice available. You may also want to vary the sourcemap strategy depending on your build environment. Here are some example strategies for different environments:
* `devtool: 'inline-source-map'` - Solid sourcemap support; the best "all-rounder". Works well with karma-webpack (not all strategies do)
* `devtool: 'cheap-module-eval-source-map'` - Best support for sourcemaps whilst debugging.
* `devtool: 'source-map'` - Approach that plays well with UglifyJsPlugin; typically you might use this in Production
### Code Splitting and Loading Other Resources
Loading css and other resources is possible but you will need to make sure that
you have defined the `require` function in a [declaration file](https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html).
```typescript
declare var require: {
<T>(path: string): T;
(paths: string[], callback: (...modules: any[]) => void): void;
ensure: (
paths: string[],
callback: (require: <T>(path: string) => T) => void
) => void;
};
```
Then you can simply require assets or chunks per the [webpack documentation](https://webpack.js.org/guides/code-splitting/).
```javascript
require("!style!css!./style.css");
```
The same basic process is required for code splitting. In this case, you `import` modules you need but you
don't directly use them. Instead you require them at [split points](http://webpack.github.io/docs/code-splitting.html#defining-a-split-point). See [this example](test/comparison-tests/codeSplitting) and [this example](test/comparison-tests/es6codeSplitting) for more details.
[TypeScript 2.4 provides support for ECMAScript's new `import()` calls. These calls import a module and return a promise to that module.](https://blogs.msdn.microsoft.com/typescript/2017/06/12/announcing-typescript-2-4-rc/) This is also supported in webpack - details on usage can be found [here](https://webpack.js.org/guides/code-splitting-async/#dynamic-import-import-). Happy code splitting!
### Declarations (.d.ts)
To output a built .d.ts file, you can set `"declaration": true` in your tsconfig, and use the [DeclarationBundlerPlugin](https://www.npmjs.com/package/declaration-bundler-webpack-plugin) in your webpack config.
### Failing the build on TypeScript compilation error
The build **should** fail on TypeScript compilation errors as of webpack 2. If for some reason it does not, you can use the [webpack-fail-plugin](https://www.npmjs.com/package/webpack-fail-plugin).
For more background have a read of [this issue](https://github.com/TypeStrong/ts-loader/issues/108).
### `baseUrl` / `paths` module resolution
If you want to resolve modules according to `baseUrl` and `paths` in your `tsconfig.json` then you can use the [tsconfig-paths-webpack-plugin](https://www.npmjs.com/package/tsconfig-paths-webpack-plugin) package. For details about this functionality, see the [module resolution documentation](https://www.typescriptlang.org/docs/handbook/module-resolution.html#base-url).
This feature requires webpack 2.1+ and TypeScript 2.0+. Use the config below or check the [package](https://github.com/dividab/tsconfig-paths-webpack-plugin/blob/master/README.md) for more information on usage.
```javascript
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
module.exports = {
...
resolve: {
plugins: [new TsconfigPathsPlugin({ configFile: "./path/to/tsconfig.json" })]
}
...
}
```
### Options
There are two types of options: TypeScript options (aka "compiler options") and loader options. TypeScript options should be set using a tsconfig.json file. Loader options can be specified through the `options` property in the webpack configuration:
```javascript
module.exports = {
...
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true
}
}
]
}
]
}
}
```
### Loader Options
#### transpileOnly
| Type | Default Value |
|------|--------------|
| `boolean` | `false`|
If you want to speed up compilation significantly you can set this flag.
However, many of the benefits you get from static type checking between
different dependencies in your application will be lost.
It's advisable to use `transpileOnly` alongside the [fork-ts-checker-webpack-plugin](https://github.com/Realytics/fork-ts-checker-webpack-plugin) to get full type checking again. To see what this looks like in practice then either take a look at [our simple example](examples/fork-ts-checker-webpack-plugin). For a more complex setup take a look at our [more involved example](examples/react-babel-karma-gulp).
If you enable this option, webpack 4 will give you "export not found" warnings any time you re-export a type:
```
WARNING in ./src/bar.ts
1:0-34 "export 'IFoo' was not found in './foo'
@ ./src/bar.ts
@ ./src/index.ts
```
The reason this happens is that when typescript doesn't do a full type check, it does not have enough information to determine whether an imported name is a type or not, so when the name is then exported, typescript has no choice but to emit the export. Fortunately, the extraneous export should not be harmful, so you can just suppress these warnings:
```javascript
module.exports = {
...
stats: {
warningsFilter: /export .* was not found in/
}
}
```
#### happyPackMode
| Type | Default Value |
|------|--------------|
| `boolean` | `false`|
If you're using [HappyPack](https://github.com/amireh/happypack) or [thread-loader](https://github.com/webpack-contrib/thread-loader) to parallise your builds then you'll need to set this to `true`. This implicitly sets `*transpileOnly*` to `true` and **WARNING!** stops registering **_all_** errors to webpack.
It's advisable to use this with the [fork-ts-checker-webpack-plugin](https://github.com/Realytics/fork-ts-checker-webpack-plugin) to get full type checking again. To see what this looks like in practice then either take a look at [our simple thread-loader example](examples/thread-loader). **_IMPORTANT_**: If you are using fork-ts-checker-webpack-plugin alongside HappyPack or thread-loader then ensure you set the `syntactic` diagnostic option like so:
```javascript
new ForkTsCheckerWebpackPlugin({
typescript: {
diagnosticOptions: {
semantic: true,
syntactic: true,
},
},
})
```
This will ensure that the plugin checks for both syntactic errors (eg `const array = [{} {}];`) and semantic errors (eg `const x: number = '1';`). By default the plugin only checks for semantic errors (as when used with `ts-loader` in `transpileOnly` mode, `ts-loader` will still report syntactic errors).
Also, if you are using `thread-loader` in watch mode, remember to set `poolTimeout: Infinity` so workers don't die.
#### resolveModuleName and resolveTypeReferenceDirective
These options should be functions which will be used to resolve the import statements and the `<reference types="...">` directives instead of the default TypeScript implementation. It's not intended that these will typically be used by a user of `ts-loader` - they exist to facilitate functionality such as [Yarn PlugnPlay](https://yarnpkg.com/en/docs/pnp).
#### getCustomTransformers
| Type |
|------|
| ` (program: Program) => { before?: TransformerFactory<SourceFile>[]; after?: TransformerFactory<SourceFile>[]; } ` |
Provide custom transformers - only compatible with TypeScript 2.3+ (and 2.4 if using `transpileOnly` mode). For example usage take a look at [typescript-plugin-styled-components](https://github.com/Igorbek/typescript-plugin-styled-components) or our [test](test/comparison-tests/customTransformer).
You can also pass a path string to locate a js module file which exports the function described above, this useful especially in `happyPackMode`. (Because forked processes cannot serialize functions see more at [related issue](https://github.com/Igorbek/typescript-plugin-styled-components/issues/6#issue-303387183))
#### logInfoToStdOut
| Type | Default Value |
|------|--------------|
| `boolean` | `false`|
This is important if you read from stdout or stderr and for proper error handling.
The default value ensures that you can read from stdout e.g. via pipes or you use webpack -j to generate json output.
#### logLevel
| Type | Default Value |
|------|--------------|
| `string` | `warn` |
Can be `info`, `warn` or `error` which limits the log output to the specified log level.
Beware of the fact that errors are written to stderr and everything else is written to stderr (or stdout if logInfoToStdOut is true).
#### silent
| Type | Default Value |
|------|--------------|
| `boolean` | `false`|
If `true`, no console.log messages will be emitted. Note that most error
messages are emitted via webpack which is not affected by this flag.
#### ignoreDiagnostics
| Type | Default Value |
|------|--------------|
| `number[]` | `[]`|
You can squelch certain TypeScript errors by specifying an array of diagnostic
codes to ignore.
#### reportFiles
| Type | Default Value |
|------|--------------|
| `string[]` | `[]`|
Only report errors on files matching these glob patterns.
```javascript
// in webpack.config.js
{
test: /\.ts$/,
loader: 'ts-loader',
options: { reportFiles: ['src/**/*.{ts,tsx}', '!src/skip.ts'] }
}
```
This can be useful when certain types definitions have errors that are not fatal to your application.
#### compiler
| Type | Default Value |
|------|--------------|
| `string` | `'typescript'`|
Allows use of TypeScript compilers other than the official one. Should be
set to the NPM name of the compiler, eg [`ntypescript`](https://github.com/basarat/ntypescript).
#### configFile
| Type | Default Value |
|------|--------------|
| `string` | `'tsconfig.json'`|
Allows you to specify where to find the TypeScript configuration file.
You may provide
* just a file name. The loader then will search for the config file of each entry point in the respective entry point's containing folder. If a config file cannot be found there, it will travel up the parent directory chain and look for the config file in those folders.
* a relative path to the configuration file. It will be resolved relative to the respective `.ts` entry file.
* an absolute path to the configuration file.
Please note, that if the configuration file is outside of your project directory, you might need to set the `context` option to avoid TypeScript issues (like TS18003).
In this case the `configFile` should point to the `tsconfig.json` and `context` to the project root.
#### colors
| Type | Default Value |
|------|--------------|
| `boolean` | `true`|
If `false`, disables built-in colors in logger messages.
#### errorFormatter
| Type | Default Value |
|------|--------------|
| `(message: ErrorInfo, colors: boolean) => string` | `undefined`|
By default `ts-loader` formats TypeScript compiler output for an error or a warning in the style:
```
[tsl] ERROR in myFile.ts(3,14)
TS4711: you did something very wrong
```
If that format is not to your taste you can supply your own formatter using the `errorFormatter` option. Below is a template for a custom error formatter. Please note that the `colors` parameter is an instance of [`chalk`](https://github.com/chalk/chalk) which you can use to color your output. (This instance will respect the `colors` option.)
```javascript
function customErrorFormatter(error, colors) {
const messageColor =
error.severity === "warning" ? colors.bold.yellow : colors.bold.red;
return (
"Does not compute.... " +
messageColor(Object.keys(error).map(key => `${key}: ${error[key]}`))
);
}
```
If the above formatter received an error like this:
```json
{
"code":2307,
"severity": "error",
"content": "Cannot find module 'components/myComponent2'.",
"file":"/.test/errorFormatter/app.ts",
"line":2,
"character":31
}
```
It would produce an error message that said:
```
Does not compute.... code: 2307,severity: error,content: Cannot find module 'components/myComponent2'.,file: /.test/errorFormatter/app.ts,line: 2,character: 31
```
And the bit after "Does not compute.... " would be red.
#### compilerOptions
| Type | Default Value |
|------|--------------|
| `object` | `{}`|
Allows overriding TypeScript options. Should be specified in the same format
as you would do for the `compilerOptions` property in tsconfig.json.
#### instance
| Type | Default Value |
|------|--------------|
| `string` | `TODO`|
Advanced option to force files to go through different instances of the
TypeScript compiler. Can be used to force segregation between different parts
of your code.
#### appendTsSuffixTo
| Type | Default Value |
|------|--------------|
| `RegExp[]` | `[]`|
#### appendTsxSuffixTo
| Type | Default Value |
|------|--------------|
| `RegExp[]` | `[]`|
A list of regular expressions to be matched against filename. If filename matches one of the regular expressions, a `.ts` or `.tsx` suffix will be appended to that filename.
This is useful for `*.vue` [file format](https://vuejs.org/v2/guide/single-file-components.html) for now. (Probably will benefit from the new single file format in the future.)
Example:
webpack.config.js:
```javascript
module.exports = {
entry: "./index.vue",
output: { filename: "bundle.js" },
resolve: {
extensions: [".ts", ".vue"]
},
module: {
rules: [
{ test: /\.vue$/, loader: "vue-loader" },
{
test: /\.ts$/,
loader: "ts-loader",
options: { appendTsSuffixTo: [/\.vue$/] }
}
]
}
};
```
index.vue
```vue
<template><p>hello {{msg}}</p></template>
<script lang="ts">
export default {
data(): Object {
return {
msg: "world"
};
}
};
</script>
```
We can handle `.tsx` by quite similar way:
webpack.config.js:
```javascript
module.exports = {
entry: './index.vue',
output: { filename: 'bundle.js' },
resolve: {
extensions: ['.ts', '.tsx', '.vue', '.vuex']
},
module: {
rules: [
{ test: /\.vue$/, loader: 'vue-loader',
options: {
loaders: {
ts: 'ts-loader',
tsx: 'babel-loader!ts-loader',
}
}
},
{ test: /\.ts$/, loader: 'ts-loader', options: { appendTsSuffixTo: [/TS\.vue$/] } }
{ test: /\.tsx$/, loader: 'babel-loader!ts-loader', options: { appendTsxSuffixTo: [/TSX\.vue$/] } }
]
}
}
```
tsconfig.json (set `jsx` option to `preserve` to let babel handle jsx)
```json
{
"compilerOptions": {
"jsx": "preserve"
}
}
```
index.vue
```vue
<script lang="tsx">
export default {
functional: true,
render(h, c) {
return (<div>Content</div>);
}
}
</script>
```
Or if you want to use only tsx, just use the `appendTsxSuffixTo` option only:
```javascript
{ test: /\.ts$/, loader: 'ts-loader' }
{ test: /\.tsx$/, loader: 'babel-loader!ts-loader', options: { appendTsxSuffixTo: [/\.vue$/] } }
```
#### onlyCompileBundledFiles
| Type | Default Value |
|------|--------------|
| `boolean` | `false`|
The default behavior of `ts-loader` is to act as a drop-in replacement for the `tsc` command,
so it respects the `include`, `files`, and `exclude` options in your `tsconfig.json`, loading
any files specified by those options. The `onlyCompileBundledFiles` option modifies this behavior,
loading only those files that are actually bundled by webpack, as well as any `.d.ts` files included
by the `tsconfig.json` settings. `.d.ts` files are still included because they may be needed for
compilation without being explicitly imported, and therefore not picked up by webpack.
#### allowTsInNodeModules
| Type | Default Value |
|------|--------------|
| `boolean` | `false`|
By default, `ts-loader` will not compile `.ts` files in `node_modules`.
You should not need to recompile `.ts` files there, but if you really want to, use this option.
Note that this option acts as a *whitelist* - any modules you desire to import must be included in
the `"files"` or `"include"` block of your project's `tsconfig.json`.
See: [https://github.com/Microsoft/TypeScript/issues/12358](https://github.com/Microsoft/TypeScript/issues/12358)
```javascript
// in webpack.config.js
{
test: /\.ts$/,
loader: 'ts-loader',
options: { allowTsInNodeModules: true }
}
```
And in your `tsconfig.json`:
```json
{
"include": [
"node_modules/whitelisted_module.ts"
],
"files": [
"node_modules/my_module/whitelisted_file.ts"
]
}
```
#### context
| Type | Default Value |
|------|--------------|
| `string` | `undefined`|
If set, will parse the TypeScript configuration file with given **absolute path** as base path.
Per default the directory of the configuration file is used as base path. Relative paths in the configuration
file are resolved with respect to the base path when parsed. Option `context` allows to set option
`configFile` to a path other than the project root (e.g. a NPM package), while the base path for `ts-loader`
can remain the project root.
Keep in mind that **not** having a `tsconfig.json` in your project root can cause different behaviour between `ts-loader` and `tsc`.
When using editors like `VS Code` it is advised to add a `tsconfig.json` file to the root of the project and extend the config file
referenced in option `configFile`. For more information please [read the PR](https://github.com/TypeStrong/ts-loader/pull/681) that
is the base and [read the PR](https://github.com/TypeStrong/ts-loader/pull/688) that contributed this option.
webpack:
```javascript
{
loader: require.resolve('ts-loader'),
options: {
context: __dirname,
configFile: require.resolve('ts-config-react-app')
}
}
```
Extending `tsconfig.json`:
```json
{ "extends": "./node_modules/ts-config-react-app/index" }
```
Note that changes in the extending file while not be respected by `ts-loader`. Its purpose is to satisfy the code editor.
#### experimentalFileCaching
| Type | Default Value |
|------|--------------|
| `boolean` | `true`|
By default whenever the TypeScript compiler needs to check that a file/directory exists or resolve symlinks it makes syscalls. It does not cache the result of these operations and this may result in many syscalls with the same arguments ([see comment](https://github.com/TypeStrong/ts-loader/issues/825#issue-354725524) with example).
In some cases it may produce performance degradation.
This flag enables caching for some FS-functions like `fileExists`, `realpath` and `directoryExists` for TypeScript compiler. Note that caches are cleared between compilations.
#### projectReferences
| Type | Default Value |
|------|--------------|
| `boolean` | `false`|
ts-loader has opt-in support for [project references](https://www.typescriptlang.org/docs/handbook/project-references.html). With this configuration option enabled, `ts-loader` will incrementally rebuild upstream projects the same way `tsc --build` does. Otherwise, source files in referenced projects will be treated as if theyre part of the root project.
### Usage with webpack watch
Because TS will generate .js and .d.ts files, you should ignore these files, otherwise watchers may go into an infinite watch loop. For example, when using webpack, you may wish to add this to your webpack.conf.js file:
```javascript
plugins: [
new webpack.WatchIgnorePlugin([
/\.js$/,
/\.d\.ts$/
])
],
```
It's worth noting that use of the `LoaderOptionsPlugin` is [only supposed to be a stopgap measure](https://webpack.js.org/plugins/loader-options-plugin/). You may want to look at removing it entirely.
### Hot Module replacement
We do not support HMR as we did not yet work out a reliable way how to set it up.
If you want to give `webpack-dev-server` HMR a try, follow the official [webpack HMR guide](https://webpack.js.org/guides/hot-module-replacement/), then tweak a few config options for `ts-loader`:
1. Set `transpileOnly` to `true` (see [transpileOnly](#transpileonly) for config details and recommendations above).
2. Inside your HMR acceptance callback function, maybe re-require the module that was replaced.
## Contributing
This is your TypeScript loader! We want you to help make it even better. Please feel free to contribute; see the [contributor's guide](CONTRIBUTING.md) to get started.
## License
MIT License

4
node_modules/ts-loader/dist/after-compile.d.ts generated vendored Normal file
View file

@ -0,0 +1,4 @@
import * as webpack from 'webpack';
import { TSInstance } from './interfaces';
export declare function makeAfterCompile(instance: TSInstance, configFilePath: string | undefined): (compilation: webpack.compilation.Compilation, callback: () => void) => void;
//# sourceMappingURL=after-compile.d.ts.map

1
node_modules/ts-loader/dist/after-compile.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"after-compile.d.ts","sourceRoot":"","sources":["../src/after-compile.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAInC,OAAO,EAGL,UAAU,EAGX,MAAM,cAAc,CAAC;AAStB,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,UAAU,EACpB,cAAc,EAAE,MAAM,GAAG,SAAS,4DAOtB,MAAM,IAAI,UAsDvB"}

280
node_modules/ts-loader/dist/after-compile.js generated vendored Normal file
View file

@ -0,0 +1,280 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeAfterCompile = void 0;
const path = require("path");
const constants = require("./constants");
const instances_1 = require("./instances");
const utils_1 = require("./utils");
function makeAfterCompile(instance, configFilePath) {
let getCompilerOptionDiagnostics = true;
let checkAllFilesForErrors = true;
return (compilation, callback) => {
// Don't add errors for child compilations
if (compilation.compiler.isChild()) {
callback();
return;
}
if (instance.loaderOptions.transpileOnly) {
provideAssetsFromSolutionBuilderHost(instance, compilation);
callback();
return;
}
removeCompilationTSLoaderErrors(compilation);
provideCompilerOptionDiagnosticErrorsToWebpack(getCompilerOptionDiagnostics, compilation, instance, configFilePath);
getCompilerOptionDiagnostics = false;
const modules = determineModules(compilation, instance);
const filesToCheckForErrors = determineFilesToCheckForErrors(checkAllFilesForErrors, instance);
checkAllFilesForErrors = false;
const filesWithErrors = new Map();
provideErrorsToWebpack(filesToCheckForErrors, filesWithErrors, compilation, modules, instance);
provideDeclarationFilesToWebpack(filesToCheckForErrors, instance, compilation);
provideTsBuildInfoFilesToWebpack(instance, compilation);
provideSolutionErrorsToWebpack(compilation, modules, instance);
provideAssetsFromSolutionBuilderHost(instance, compilation);
instance.filesWithErrors = filesWithErrors;
instance.modifiedFiles = undefined;
instance.projectsMissingSourceMaps = new Set();
callback();
};
}
exports.makeAfterCompile = makeAfterCompile;
/**
* handle compiler option errors after the first compile
*/
function provideCompilerOptionDiagnosticErrorsToWebpack(getCompilerOptionDiagnostics, compilation, instance, configFilePath) {
if (getCompilerOptionDiagnostics) {
const { languageService, loaderOptions, compiler, program } = instance;
const errors = utils_1.formatErrors(program === undefined
? languageService.getCompilerOptionsDiagnostics()
: program.getOptionsDiagnostics(), loaderOptions, instance.colors, compiler, { file: configFilePath || 'tsconfig.json' }, compilation.compiler.context);
compilation.errors.push(...errors);
}
}
/**
* build map of all modules based on normalized filename
* this is used for quick-lookup when trying to find modules
* based on filepath
*/
function determineModules(compilation, { filePathKeyMapper }) {
const modules = new Map();
compilation.modules.forEach(module => {
if (module.resource) {
const modulePath = filePathKeyMapper(module.resource);
const existingModules = modules.get(modulePath);
if (existingModules !== undefined) {
if (!existingModules.includes(module)) {
existingModules.push(module);
}
}
else {
modules.set(modulePath, [module]);
}
}
});
return modules;
}
function determineFilesToCheckForErrors(checkAllFilesForErrors, instance) {
const { files, modifiedFiles, filesWithErrors, otherFiles } = instance;
// calculate array of files to check
const filesToCheckForErrors = new Map();
if (checkAllFilesForErrors) {
// check all files on initial run
for (const [filePath, file] of files) {
addFileToCheckForErrors(filePath, file);
}
for (const [filePath, file] of otherFiles) {
addFileToCheckForErrors(filePath, file);
}
}
else if (modifiedFiles !== null &&
modifiedFiles !== undefined &&
modifiedFiles.size) {
const reverseDependencyGraph = utils_1.populateReverseDependencyGraph(instance);
// check all modified files, and all dependants
for (const modifiedFileName of modifiedFiles.keys()) {
for (const fileName of utils_1.collectAllDependants(reverseDependencyGraph, modifiedFileName).keys()) {
const fileToCheckForErrors = files.get(fileName) || otherFiles.get(fileName);
addFileToCheckForErrors(fileName, fileToCheckForErrors);
}
}
}
// re-check files with errors from previous build
if (filesWithErrors !== undefined) {
for (const [fileWithErrorName, fileWithErrors] of filesWithErrors) {
addFileToCheckForErrors(fileWithErrorName, fileWithErrors);
}
}
return filesToCheckForErrors;
function addFileToCheckForErrors(filePath, file) {
if (!utils_1.isReferencedFile(instance, filePath)) {
filesToCheckForErrors.set(filePath, file);
}
}
}
function provideErrorsToWebpack(filesToCheckForErrors, filesWithErrors, compilation, modules, instance) {
const { compiler, files, loaderOptions, compilerOptions, otherFiles, } = instance;
const filePathRegex = compilerOptions.allowJs === true
? constants.dtsTsTsxJsJsxRegex
: constants.dtsTsTsxRegex;
// Im pretty sure this will never be undefined here
const program = utils_1.ensureProgram(instance);
for (const [filePath, { fileName }] of filesToCheckForErrors.entries()) {
if (fileName.match(filePathRegex) === null) {
continue;
}
const sourceFile = program && program.getSourceFile(fileName);
const errors = [];
if (program && sourceFile) {
errors.push(...program.getSyntacticDiagnostics(sourceFile), ...program
.getSemanticDiagnostics(sourceFile)
// Output file has not been built from source file - this message is redundant with
// program.getOptionsDiagnostics() separately added in instances.ts
.filter(({ code }) => code !== 6305));
}
if (errors.length > 0) {
const fileWithError = files.get(filePath) || otherFiles.get(filePath);
filesWithErrors.set(filePath, fileWithError);
}
// if we have access to a webpack module, use that
const associatedModules = modules.get(instance.filePathKeyMapper(fileName));
if (associatedModules !== undefined) {
associatedModules.forEach(module => {
removeModuleTSLoaderError(module);
// append errors
const formattedErrors = utils_1.formatErrors(errors, loaderOptions, instance.colors, compiler, { module }, compilation.compiler.context);
formattedErrors.forEach(error => {
if (module.addError) {
module.addError(error);
}
else {
module.errors.push(error);
}
});
compilation.errors.push(...formattedErrors);
});
}
else {
// otherwise it's a more generic error
const formattedErrors = utils_1.formatErrors(errors, loaderOptions, instance.colors, compiler, { file: fileName }, compilation.compiler.context);
compilation.errors.push(...formattedErrors);
}
}
}
function provideSolutionErrorsToWebpack(compilation, modules, instance) {
if (!instance.solutionBuilderHost ||
!(instance.solutionBuilderHost.diagnostics.global.length ||
instance.solutionBuilderHost.diagnostics.perFile.size)) {
return;
}
const { compiler, loaderOptions, solutionBuilderHost: { diagnostics }, } = instance;
for (const [filePath, perFileDiagnostics] of diagnostics.perFile) {
// if we have access to a webpack module, use that
const associatedModules = modules.get(filePath);
if (associatedModules !== undefined) {
associatedModules.forEach(module => {
removeModuleTSLoaderError(module);
// append errors
const formattedErrors = utils_1.formatErrors(perFileDiagnostics, loaderOptions, instance.colors, compiler, { module }, compilation.compiler.context);
formattedErrors.forEach(error => {
if (module.addError) {
module.addError(error);
}
else {
module.errors.push(error);
}
});
compilation.errors.push(...formattedErrors);
});
}
else {
// otherwise it's a more generic error
const formattedErrors = utils_1.formatErrors(perFileDiagnostics, loaderOptions, instance.colors, compiler, { file: path.resolve(perFileDiagnostics[0].file.fileName) }, compilation.compiler.context);
compilation.errors.push(...formattedErrors);
}
}
// Add global solution errors
compilation.errors.push(...utils_1.formatErrors(diagnostics.global, instance.loaderOptions, instance.colors, instance.compiler, { file: 'tsconfig.json' }, compilation.compiler.context));
}
/**
* gather all declaration files from TypeScript and output them to webpack
*/
function provideDeclarationFilesToWebpack(filesToCheckForErrors, instance, compilation) {
for (const { fileName } of filesToCheckForErrors.values()) {
if (fileName.match(constants.tsTsxRegex) === null) {
continue;
}
addDeclarationFilesAsAsset(instances_1.getEmitOutput(instance, fileName), compilation);
}
}
function addDeclarationFilesAsAsset(outputFiles, compilation, skipOutputFile) {
outputFilesToAsset(outputFiles, compilation, outputFile => skipOutputFile && skipOutputFile(outputFile)
? true
: !outputFile.name.match(constants.dtsDtsxOrDtsDtsxMapRegex));
}
function outputFileToAsset(outputFile, compilation) {
const assetPath = path.relative(compilation.compiler.outputPath, outputFile.name);
compilation.assets[assetPath] = {
source: () => outputFile.text,
size: () => outputFile.text.length,
};
}
function outputFilesToAsset(outputFiles, compilation, skipOutputFile) {
for (const outputFile of outputFiles) {
if (!skipOutputFile || !skipOutputFile(outputFile)) {
outputFileToAsset(outputFile, compilation);
}
}
}
/**
* gather all .tsbuildinfo for the project
*/
function provideTsBuildInfoFilesToWebpack(instance, compilation) {
if (instance.watchHost) {
// Ensure emit is complete
instances_1.getEmitFromWatchHost(instance);
if (instance.watchHost.tsbuildinfo) {
outputFileToAsset(instance.watchHost.tsbuildinfo, compilation);
}
instance.watchHost.outputFiles.clear();
instance.watchHost.tsbuildinfo = undefined;
}
}
/**
* gather all solution builder assets
*/
function provideAssetsFromSolutionBuilderHost(instance, compilation) {
if (instance.solutionBuilderHost) {
// written files
outputFilesToAsset(instance.solutionBuilderHost.writtenFiles, compilation);
instance.solutionBuilderHost.writtenFiles.length = 0;
}
}
/**
* handle all other errors. The basic approach here to get accurate error
* reporting is to start with a "blank slate" each compilation and gather
* all errors from all files. Since webpack tracks errors in a module from
* compilation-to-compilation, and since not every module always runs through
* the loader, we need to detect and remove any pre-existing errors.
*/
function removeCompilationTSLoaderErrors(compilation) {
compilation.errors = compilation.errors.filter(error => error.loaderSource !== 'ts-loader');
}
function removeModuleTSLoaderError(module) {
/**
* Since webpack 5, the `errors` property is deprecated,
* so we can check if some methods for reporting errors exist.
*/
if (!!module.addError) {
const warnings = module.getWarnings();
const errors = module.getErrors();
module.clearWarningsAndErrors();
Array.from(warnings || []).forEach(warning => module.addWarning(warning));
Array.from(errors || [])
.filter((error) => error.loaderSource !== 'ts-loader')
.forEach(error => module.addError(error));
}
else {
module.errors = module.errors.filter(error => error.loaderSource !== 'ts-loader');
}
}
//# sourceMappingURL=after-compile.js.map

11
node_modules/ts-loader/dist/compilerSetup.d.ts generated vendored Normal file
View file

@ -0,0 +1,11 @@
import * as typescript from 'typescript';
import { LoaderOptions } from './interfaces';
import * as logger from './logger';
export declare function getCompiler(loaderOptions: LoaderOptions, log: logger.Logger): {
compiler: typeof typescript | undefined;
compilerCompatible: boolean;
compilerDetailsLogMessage: string | undefined;
errorMessage: string | undefined;
};
export declare function getCompilerOptions(configParseResult: typescript.ParsedCommandLine): typescript.CompilerOptions;
//# sourceMappingURL=compilerSetup.d.ts.map

1
node_modules/ts-loader/dist/compilerSetup.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"compilerSetup.d.ts","sourceRoot":"","sources":["../src/compilerSetup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,wBAAgB,WAAW,CAAC,aAAa,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM;;;;;EA6C3E;AAED,wBAAgB,kBAAkB,CAChC,iBAAiB,EAAE,UAAU,CAAC,iBAAiB,8BAyBhD"}

66
node_modules/ts-loader/dist/compilerSetup.js generated vendored Normal file
View file

@ -0,0 +1,66 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCompilerOptions = exports.getCompiler = void 0;
const semver = require("semver");
const typescript = require("typescript");
function getCompiler(loaderOptions, log) {
let compiler;
let errorMessage;
let compilerDetailsLogMessage;
let compilerCompatible = false;
try {
compiler = require(loaderOptions.compiler);
}
catch (e) {
errorMessage =
loaderOptions.compiler === 'typescript'
? 'Could not load TypeScript. Try installing with `yarn add typescript` or `npm install typescript`. If TypeScript is installed globally, try using `yarn link typescript` or `npm link typescript`.'
: `Could not load TypeScript compiler with NPM package name \`${loaderOptions.compiler}\`. Are you sure it is correctly installed?`;
}
if (errorMessage === undefined) {
compilerDetailsLogMessage = `ts-loader: Using ${loaderOptions.compiler}@${compiler.version}`;
compilerCompatible = false;
if (loaderOptions.compiler === 'typescript') {
if (compiler.version !== undefined &&
semver.gte(compiler.version, '3.6.3')) {
// don't log yet in this case, if a tsconfig.json exists we want to combine the message
compilerCompatible = true;
}
else {
log.logError(`${compilerDetailsLogMessage}. This version is incompatible with ts-loader. Please upgrade to the latest version of TypeScript.`);
}
}
else {
log.logWarning(`${compilerDetailsLogMessage}. This version may or may not be compatible with ts-loader.`);
}
}
return {
compiler,
compilerCompatible,
compilerDetailsLogMessage,
errorMessage,
};
}
exports.getCompiler = getCompiler;
function getCompilerOptions(configParseResult) {
const compilerOptions = Object.assign({}, configParseResult.options, {
skipLibCheck: true,
suppressOutputPathCheck: true,
});
// if `module` is not specified and not using ES6+ target, default to CJS module output
if (compilerOptions.module === undefined &&
compilerOptions.target !== undefined &&
compilerOptions.target < typescript.ScriptTarget.ES2015) {
compilerOptions.module = typescript.ModuleKind.CommonJS;
}
if (configParseResult.options.configFile) {
Object.defineProperty(compilerOptions, 'configFile', {
enumerable: false,
writable: false,
value: configParseResult.options.configFile,
});
}
return compilerOptions;
}
exports.getCompilerOptions = getCompilerOptions;
//# sourceMappingURL=compilerSetup.js.map

18
node_modules/ts-loader/dist/config.d.ts generated vendored Normal file
View file

@ -0,0 +1,18 @@
import { Chalk } from 'chalk';
import * as typescript from 'typescript';
import * as webpack from 'webpack';
import { LoaderOptions, WebpackError } from './interfaces';
import * as logger from './logger';
interface ConfigFile {
config?: any;
error?: typescript.Diagnostic;
}
export declare function getConfigFile(compiler: typeof typescript, colors: Chalk, loader: webpack.loader.LoaderContext, loaderOptions: LoaderOptions, compilerCompatible: boolean, log: logger.Logger, compilerDetailsLogMessage: string): {
configFilePath: string | undefined;
configFile: ConfigFile;
configFileError: WebpackError | undefined;
};
export declare function getConfigParseResult(compiler: typeof typescript, configFile: ConfigFile, basePath: string, configFilePath: string | undefined, loaderOptions: LoaderOptions): typescript.ParsedCommandLine;
export declare function getParsedCommandLine(compiler: typeof typescript, loaderOptions: LoaderOptions, configFilePath: string): typescript.ParsedCommandLine | undefined;
export {};
//# sourceMappingURL=config.d.ts.map

1
node_modules/ts-loader/dist/config.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAGnC,UAAU,UAAU;IAClB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC;CAC/B;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,OAAO,UAAU,EAC3B,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EACpC,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,OAAO,EAC3B,GAAG,EAAE,MAAM,CAAC,MAAM,EAClB,yBAAyB,EAAE,MAAM;;;;EAsDlC;AAgDD,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,OAAO,UAAU,EAC3B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,aAAa,EAAE,aAAa,gCA8B7B;AAKD,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,OAAO,UAAU,EAC3B,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,MAAM,GACrB,UAAU,CAAC,iBAAiB,GAAG,SAAS,CAwB1C"}

109
node_modules/ts-loader/dist/config.js generated vendored Normal file
View file

@ -0,0 +1,109 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getParsedCommandLine = exports.getConfigParseResult = exports.getConfigFile = void 0;
const path = require("path");
const compilerSetup_1 = require("./compilerSetup");
const utils_1 = require("./utils");
function getConfigFile(compiler, colors, loader, loaderOptions, compilerCompatible, log, compilerDetailsLogMessage) {
const configFilePath = findConfigFile(compiler, path.dirname(loader.resourcePath), loaderOptions.configFile);
let configFileError;
let configFile;
if (configFilePath !== undefined) {
if (compilerCompatible) {
log.logInfo(`${compilerDetailsLogMessage} and ${configFilePath}`);
}
else {
log.logInfo(`ts-loader: Using config file at ${configFilePath}`);
}
configFile = compiler.readConfigFile(configFilePath, compiler.sys.readFile);
if (configFile.error !== undefined) {
configFileError = utils_1.formatErrors([configFile.error], loaderOptions, colors, compiler, { file: configFilePath }, loader.context)[0];
}
}
else {
if (compilerCompatible) {
log.logInfo(compilerDetailsLogMessage);
}
configFile = {
config: {
compilerOptions: {},
files: [],
},
};
}
if (configFileError === undefined) {
configFile.config.compilerOptions = Object.assign({}, configFile.config.compilerOptions);
}
return {
configFilePath,
configFile,
configFileError,
};
}
exports.getConfigFile = getConfigFile;
/**
* Find a tsconfig file by name or by path.
* By name, the tsconfig.json is found using the same method as `tsc`, starting in the current
* directory and continuing up the parent directory chain.
* By path, the file will be found by resolving the given path relative to the requesting entry file.
*
* @param compiler The TypeScript compiler instance
* @param requestDirPath The directory in which the entry point requesting the tsconfig.json lies
* @param configFile The tsconfig file name to look for or a path to that file
* @return The absolute path to the tsconfig file, undefined if none was found.
*/
function findConfigFile(compiler, requestDirPath, configFile) {
// If `configFile` is an absolute path, return it right away
if (path.isAbsolute(configFile)) {
return compiler.sys.fileExists(configFile) ? configFile : undefined;
}
// If `configFile` is a relative path, resolve it.
// We define a relative path as: starts with
// one or two dots + a common directory delimiter
if (configFile.match(/^\.\.?(\/|\\)/) !== null) {
const resolvedPath = path.resolve(requestDirPath, configFile);
return compiler.sys.fileExists(resolvedPath) ? resolvedPath : undefined;
// If `configFile` is a file name, find it in the directory tree
}
else {
while (true) {
const fileName = path.join(requestDirPath, configFile);
if (compiler.sys.fileExists(fileName)) {
return fileName;
}
const parentPath = path.dirname(requestDirPath);
if (parentPath === requestDirPath) {
break;
}
requestDirPath = parentPath;
}
return undefined;
}
}
function getConfigParseResult(compiler, configFile, basePath, configFilePath, loaderOptions) {
const configParseResult = compiler.parseJsonConfigFileContent(configFile.config, Object.assign(Object.assign({}, compiler.sys), { useCaseSensitiveFileNames: utils_1.useCaseSensitiveFileNames(compiler, loaderOptions) }), basePath, getCompilerOptionsToExtend(compiler, loaderOptions, basePath, configFilePath || 'tsconfig.json'));
if (!loaderOptions.projectReferences) {
configParseResult.projectReferences = undefined;
}
// set internal options.configFilePath flag on options to denote that we read this from a file
configParseResult.options = Object.assign({}, configParseResult.options, {
configFilePath,
});
return configParseResult;
}
exports.getConfigParseResult = getConfigParseResult;
const extendedConfigCache = new Map();
function getParsedCommandLine(compiler, loaderOptions, configFilePath) {
const result = compiler.getParsedCommandLineOfConfigFile(configFilePath, getCompilerOptionsToExtend(compiler, loaderOptions, path.dirname(configFilePath), configFilePath), Object.assign(Object.assign({}, compiler.sys), { useCaseSensitiveFileNames: utils_1.useCaseSensitiveFileNames(compiler, loaderOptions),
// eslint-disable-next-line @typescript-eslint/no-empty-function
onUnRecoverableConfigFileDiagnostic: () => { } }), extendedConfigCache);
if (result) {
result.options = compilerSetup_1.getCompilerOptions(result);
}
return result;
}
exports.getParsedCommandLine = getParsedCommandLine;
function getCompilerOptionsToExtend(compiler, loaderOptions, basePath, configFileName) {
return compiler.convertCompilerOptionsFromJson(loaderOptions.compilerOptions, basePath, configFileName).options;
}
//# sourceMappingURL=config.js.map

17
node_modules/ts-loader/dist/constants.d.ts generated vendored Normal file
View file

@ -0,0 +1,17 @@
export declare const EOL: string;
export declare const CarriageReturnLineFeed = "\r\n";
export declare const LineFeed = "\n";
export declare const CarriageReturnLineFeedCode = 0;
export declare const LineFeedCode = 1;
export declare const extensionRegex: RegExp;
export declare const tsxRegex: RegExp;
export declare const tsTsxRegex: RegExp;
export declare const dtsDtsxOrDtsDtsxMapRegex: RegExp;
export declare const dtsTsTsxRegex: RegExp;
export declare const dtsTsTsxJsJsxRegex: RegExp;
export declare const tsTsxJsJsxRegex: RegExp;
export declare const jsJsx: RegExp;
export declare const jsJsxMap: RegExp;
export declare const jsonRegex: RegExp;
export declare const nodeModules: RegExp;
//# sourceMappingURL=constants.d.ts.map

1
node_modules/ts-loader/dist/constants.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG,QAAS,CAAC;AAC1B,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAC7C,eAAO,MAAM,QAAQ,OAAO,CAAC;AAE7B,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAC5C,eAAO,MAAM,YAAY,IAAI,CAAC;AAE9B,eAAO,MAAM,cAAc,QAAa,CAAC;AACzC,eAAO,MAAM,QAAQ,QAAY,CAAC;AAClC,eAAO,MAAM,UAAU,QAAe,CAAC;AACvC,eAAO,MAAM,wBAAwB,QAA0B,CAAC;AAChE,eAAO,MAAM,aAAa,QAAqB,CAAC;AAChD,eAAO,MAAM,kBAAkB,QAA8B,CAAC;AAC9D,eAAO,MAAM,eAAe,QAAqB,CAAC;AAClD,eAAO,MAAM,KAAK,QAAe,CAAC;AAClC,eAAO,MAAM,QAAQ,QAAoB,CAAC;AAC1C,eAAO,MAAM,SAAS,QAAa,CAAC;AACpC,eAAO,MAAM,WAAW,QAAkB,CAAC"}

21
node_modules/ts-loader/dist/constants.js generated vendored Normal file
View file

@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.nodeModules = exports.jsonRegex = exports.jsJsxMap = exports.jsJsx = exports.tsTsxJsJsxRegex = exports.dtsTsTsxJsJsxRegex = exports.dtsTsTsxRegex = exports.dtsDtsxOrDtsDtsxMapRegex = exports.tsTsxRegex = exports.tsxRegex = exports.extensionRegex = exports.LineFeedCode = exports.CarriageReturnLineFeedCode = exports.LineFeed = exports.CarriageReturnLineFeed = exports.EOL = void 0;
const os = require("os");
exports.EOL = os.EOL;
exports.CarriageReturnLineFeed = '\r\n';
exports.LineFeed = '\n';
exports.CarriageReturnLineFeedCode = 0;
exports.LineFeedCode = 1;
exports.extensionRegex = /\.[^.]+$/;
exports.tsxRegex = /\.tsx$/i;
exports.tsTsxRegex = /\.ts(x?)$/i;
exports.dtsDtsxOrDtsDtsxMapRegex = /\.d\.ts(x?)(\.map)?$/i;
exports.dtsTsTsxRegex = /(\.d)?\.ts(x?)$/i;
exports.dtsTsTsxJsJsxRegex = /((\.d)?\.ts(x?)|js(x?))$/i;
exports.tsTsxJsJsxRegex = /\.tsx?$|\.jsx?$/i;
exports.jsJsx = /\.js(x?)$/i;
exports.jsJsxMap = /\.js(x?)\.map$/i;
exports.jsonRegex = /\.json$/i;
exports.nodeModules = /node_modules/i;
//# sourceMappingURL=constants.js.map

15
node_modules/ts-loader/dist/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,15 @@
import * as webpack from 'webpack';
import { LoaderOptions } from './interfaces';
/**
* The entry point for ts-loader
*/
declare function loader(this: webpack.loader.LoaderContext, contents: string): void;
export = loader;
/**
* expose public types via declaration merging
*/
declare namespace loader {
interface Options extends LoaderOptions {
}
}
//# sourceMappingURL=index.d.ts.map

1
node_modules/ts-loader/dist/index.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAWnC,OAAO,EAEL,aAAa,EAId,MAAM,cAAc,CAAC;AAWtB;;GAEG;AACH,iBAAS,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,QAAQ,EAAE,MAAM,QAanE;AAonBD,SAAS,MAAM,CAAC;AAEhB;;GAEG;AAEH,kBAAU,MAAM,CAAC;IAEf,UAAiB,OAAQ,SAAQ,aAAa;KAAG;CAClD"}

432
node_modules/ts-loader/dist/index.js generated vendored Normal file
View file

@ -0,0 +1,432 @@
"use strict";
const crypto = require("crypto");
const loaderUtils = require("loader-utils");
const path = require("path");
const constants = require("./constants");
const instances_1 = require("./instances");
const utils_1 = require("./utils");
const webpackInstances = [];
const loaderOptionsCache = {};
/**
* The entry point for ts-loader
*/
function loader(contents) {
this.cacheable && this.cacheable();
const callback = this.async();
const options = getLoaderOptions(this);
const instanceOrError = instances_1.getTypeScriptInstance(options, this);
if (instanceOrError.error !== undefined) {
callback(new Error(instanceOrError.error.message));
return;
}
const instance = instanceOrError.instance;
instances_1.buildSolutionReferences(instance, this);
successLoader(this, contents, callback, instance);
}
function successLoader(loaderContext, contents, callback, instance) {
instances_1.initializeInstance(loaderContext, instance);
instances_1.reportTranspileErrors(instance, loaderContext);
const rawFilePath = path.normalize(loaderContext.resourcePath);
const filePath = instance.loaderOptions.appendTsSuffixTo.length > 0 ||
instance.loaderOptions.appendTsxSuffixTo.length > 0
? utils_1.appendSuffixesIfMatch({
'.ts': instance.loaderOptions.appendTsSuffixTo,
'.tsx': instance.loaderOptions.appendTsxSuffixTo,
}, rawFilePath)
: rawFilePath;
const fileVersion = updateFileInCache(instance.loaderOptions, filePath, contents, instance);
const { outputText, sourceMapText } = instance.loaderOptions.transpileOnly
? getTranspilationEmit(filePath, contents, instance, loaderContext)
: getEmit(rawFilePath, filePath, instance, loaderContext);
makeSourceMapAndFinish(sourceMapText, outputText, filePath, contents, loaderContext, fileVersion, callback, instance);
}
function makeSourceMapAndFinish(sourceMapText, outputText, filePath, contents, loaderContext, fileVersion, callback, instance) {
if (outputText === null || outputText === undefined) {
setModuleMeta(loaderContext, instance, fileVersion);
const additionalGuidance = utils_1.isReferencedFile(instance, filePath)
? ' The most common cause for this is having errors when building referenced projects.'
: !instance.loaderOptions.allowTsInNodeModules &&
filePath.indexOf('node_modules') !== -1
? ' By default, ts-loader will not compile .ts files in node_modules.\n' +
'You should not need to recompile .ts files there, but if you really want to, use the allowTsInNodeModules option.\n' +
'See: https://github.com/Microsoft/TypeScript/issues/12358'
: '';
callback(new Error(`TypeScript emitted no output for ${filePath}.${additionalGuidance}`), outputText, undefined);
return;
}
const { sourceMap, output } = makeSourceMap(sourceMapText, outputText, filePath, contents, loaderContext);
setModuleMeta(loaderContext, instance, fileVersion);
callback(null, output, sourceMap);
}
function setModuleMeta(loaderContext, instance, fileVersion) {
// _module.meta is not available inside happypack
if (!instance.loaderOptions.happyPackMode &&
loaderContext._module.buildMeta !== undefined) {
// Make sure webpack is aware that even though the emitted JavaScript may be the same as
// a previously cached version the TypeScript may be different and therefore should be
// treated as new
loaderContext._module.buildMeta.tsLoaderFileVersion = fileVersion;
}
}
/**
* Get a unique hash based on the contents of the options
* Hash is created from the values converted to strings
* Values which are functions (such as getCustomTransformers) are
* converted to strings by this code, which JSON.stringify would not do.
*/
function getOptionsHash(loaderOptions) {
const hash = crypto.createHash('sha256');
Object.values(loaderOptions).map((v) => {
if (v) {
hash.update(v.toString());
}
});
return hash.digest('hex').substring(0, 16);
}
/**
* either retrieves loader options from the cache
* or creates them, adds them to the cache and returns
*/
function getLoaderOptions(loaderContext) {
// differentiate the TypeScript instance based on the webpack instance
let webpackIndex = webpackInstances.indexOf(loaderContext._compiler);
if (webpackIndex === -1) {
webpackIndex = webpackInstances.push(loaderContext._compiler) - 1;
}
const loaderOptions = loaderUtils.getOptions(loaderContext) ||
{};
// If no instance name is given in the options, use the hash of the loader options
// In this way, if different options are given the instances will be different
const instanceName = webpackIndex +
'_' +
(loaderOptions.instance || 'default_' + getOptionsHash(loaderOptions));
if (!loaderOptionsCache.hasOwnProperty(instanceName)) {
loaderOptionsCache[instanceName] = new WeakMap();
}
const cache = loaderOptionsCache[instanceName];
if (cache.has(loaderOptions)) {
return cache.get(loaderOptions);
}
validateLoaderOptions(loaderOptions);
const options = makeLoaderOptions(instanceName, loaderOptions);
cache.set(loaderOptions, options);
return options;
}
const validLoaderOptions = [
'silent',
'logLevel',
'logInfoToStdOut',
'instance',
'compiler',
'context',
'configFile',
'transpileOnly',
'ignoreDiagnostics',
'errorFormatter',
'colors',
'compilerOptions',
'appendTsSuffixTo',
'appendTsxSuffixTo',
'onlyCompileBundledFiles',
'happyPackMode',
'getCustomTransformers',
'reportFiles',
'experimentalWatchApi',
'allowTsInNodeModules',
'experimentalFileCaching',
'projectReferences',
'resolveModuleName',
'resolveTypeReferenceDirective',
'useCaseSensitiveFileNames',
];
/**
* Validate the supplied loader options.
* At present this validates the option names only; in future we may look at validating the values too
* @param loaderOptions
*/
function validateLoaderOptions(loaderOptions) {
const loaderOptionKeys = Object.keys(loaderOptions);
for (let i = 0; i < loaderOptionKeys.length; i++) {
const option = loaderOptionKeys[i];
const isUnexpectedOption = validLoaderOptions.indexOf(option) === -1;
if (isUnexpectedOption) {
throw new Error(`ts-loader was supplied with an unexpected loader option: ${option}
Please take a look at the options you are supplying; the following are valid options:
${validLoaderOptions.join(' / ')}
`);
}
}
if (loaderOptions.context !== undefined &&
!path.isAbsolute(loaderOptions.context)) {
throw new Error(`Option 'context' has to be an absolute path. Given '${loaderOptions.context}'.`);
}
}
function makeLoaderOptions(instanceName, loaderOptions) {
const options = Object.assign({}, {
silent: false,
logLevel: 'WARN',
logInfoToStdOut: false,
compiler: 'typescript',
configFile: 'tsconfig.json',
context: undefined,
transpileOnly: false,
compilerOptions: {},
appendTsSuffixTo: [],
appendTsxSuffixTo: [],
transformers: {},
happyPackMode: false,
colors: true,
onlyCompileBundledFiles: false,
reportFiles: [],
// When the watch API usage stabilises look to remove this option and make watch usage the default behaviour when available
experimentalWatchApi: false,
allowTsInNodeModules: false,
experimentalFileCaching: true,
}, loaderOptions);
options.ignoreDiagnostics = utils_1.arrify(options.ignoreDiagnostics).map(Number);
options.logLevel = options.logLevel.toUpperCase();
options.instance = instanceName;
// happypack can be used only together with transpileOnly mode
options.transpileOnly = options.happyPackMode ? true : options.transpileOnly;
return options;
}
/**
* Either add file to the overall files cache or update it in the cache when the file contents have changed
* Also add the file to the modified files
*/
function updateFileInCache(options, filePath, contents, instance) {
let fileWatcherEventKind;
// Update file contents
const key = instance.filePathKeyMapper(filePath);
let file = instance.files.get(key);
if (file === undefined) {
file = instance.otherFiles.get(key);
if (file !== undefined) {
if (!utils_1.isReferencedFile(instance, filePath)) {
instance.otherFiles.delete(key);
instance.files.set(key, file);
instance.changedFilesList = true;
}
}
else {
if (instance.watchHost !== undefined ||
instance.solutionBuilderHost !== undefined) {
fileWatcherEventKind = instance.compiler.FileWatcherEventKind.Created;
}
file = { fileName: filePath, version: 0 };
if (!utils_1.isReferencedFile(instance, filePath)) {
instance.files.set(key, file);
instance.changedFilesList = true;
}
else {
instance.otherFiles.set(key, file);
}
}
}
if ((instance.watchHost !== undefined ||
instance.solutionBuilderHost !== undefined) &&
contents === undefined) {
fileWatcherEventKind = instance.compiler.FileWatcherEventKind.Deleted;
}
// filePath is a root file as it was passed to the loader. But it
// could have been found earlier as a dependency of another file. If
// that is the case, compiling this file changes the structure of
// the program and we need to increase the instance version.
//
// See https://github.com/TypeStrong/ts-loader/issues/943
if (!utils_1.isReferencedFile(instance, filePath) &&
!instance.rootFileNames.has(filePath) &&
// however, be careful not to add files from node_modules unless
// it is allowed by the options.
(options.allowTsInNodeModules || filePath.indexOf('node_modules') === -1)) {
instance.version++;
instance.rootFileNames.add(filePath);
}
if (file.text !== contents) {
file.version++;
file.text = contents;
file.modifiedTime = new Date();
instance.version++;
if ((instance.watchHost !== undefined ||
instance.solutionBuilderHost !== undefined) &&
fileWatcherEventKind === undefined) {
fileWatcherEventKind = instance.compiler.FileWatcherEventKind.Changed;
}
}
// Added in case the files were already updated by the watch API
if (instance.modifiedFiles && instance.modifiedFiles.get(key)) {
fileWatcherEventKind = instance.compiler.FileWatcherEventKind.Changed;
}
if (instance.watchHost !== undefined && fileWatcherEventKind !== undefined) {
instance.hasUnaccountedModifiedFiles =
instance.watchHost.invokeFileWatcher(filePath, fileWatcherEventKind) ||
instance.hasUnaccountedModifiedFiles;
}
if (instance.solutionBuilderHost !== undefined &&
fileWatcherEventKind !== undefined) {
instance.solutionBuilderHost.invokeFileWatcher(filePath, fileWatcherEventKind);
}
// push this file to modified files hash.
if (!instance.modifiedFiles) {
instance.modifiedFiles = new Map();
}
instance.modifiedFiles.set(key, true);
return file.version;
}
function getEmit(rawFilePath, filePath, instance, loaderContext) {
const outputFiles = instances_1.getEmitOutput(instance, filePath);
loaderContext.clearDependencies();
loaderContext.addDependency(rawFilePath);
const dependencies = [];
const addDependency = (file) => {
file = path.resolve(file);
loaderContext.addDependency(file);
dependencies.push(file);
};
// Make this file dependent on *all* definition files in the program
if (!utils_1.isReferencedFile(instance, filePath)) {
for (const { fileName: defFilePath } of instance.files.values()) {
if (defFilePath.match(constants.dtsDtsxOrDtsDtsxMapRegex) &&
// Remove the project reference d.ts as we are adding dependency for .ts later
// This removed extra build pass (resulting in new stats object in initial build)
(!instance.solutionBuilderHost ||
!instance.solutionBuilderHost.getOutputFileKeyFromReferencedProject(defFilePath))) {
addDependency(defFilePath);
}
}
}
// Additionally make this file dependent on all imported files
const fileDependencies = instance.dependencyGraph.get(instance.filePathKeyMapper(filePath));
if (fileDependencies) {
for (const { resolvedFileName, originalFileName } of fileDependencies) {
// In the case of dependencies that are part of a project reference,
// the real dependency that webpack should watch is the JS output file.
addDependency(instances_1.getInputFileNameFromOutput(instance, path.resolve(resolvedFileName)) ||
originalFileName);
}
}
addDependenciesFromSolutionBuilder(instance, filePath, addDependency);
loaderContext._module.buildMeta.tsLoaderDefinitionFileVersions = dependencies.map(defFilePath => path.relative(loaderContext.rootContext, defFilePath) +
'@' +
(instance.files.get(instance.filePathKeyMapper(defFilePath)) ||
instance.otherFiles.get(instance.filePathKeyMapper(defFilePath)) || {
version: '?',
}).version);
return getOutputAndSourceMapFromOutputFiles(outputFiles);
}
function getOutputAndSourceMapFromOutputFiles(outputFiles) {
const outputFile = outputFiles
.filter(file => file.name.match(constants.jsJsx))
.pop();
const outputText = outputFile === undefined ? undefined : outputFile.text;
const sourceMapFile = outputFiles
.filter(file => file.name.match(constants.jsJsxMap))
.pop();
const sourceMapText = sourceMapFile === undefined ? undefined : sourceMapFile.text;
return { outputText, sourceMapText };
}
function addDependenciesFromSolutionBuilder(instance, filePath, addDependency) {
if (!instance.solutionBuilderHost) {
return;
}
// Add all the input files from the references as
const resolvedFilePath = instance.filePathKeyMapper(filePath);
if (!utils_1.isReferencedFile(instance, filePath)) {
if (instance.configParseResult.fileNames.some(f => instance.filePathKeyMapper(f) === resolvedFilePath)) {
addDependenciesFromProjectReferences(instance, instance.configFilePath, instance.configParseResult.projectReferences, addDependency);
}
return;
}
// Referenced file find the config for it
for (const [configFile, configInfo,] of instance.solutionBuilderHost.configFileInfo.entries()) {
if (!configInfo.config ||
!configInfo.config.projectReferences ||
!configInfo.config.projectReferences.length) {
continue;
}
if (configInfo.outputFileNames) {
if (!configInfo.outputFileNames.has(resolvedFilePath)) {
continue;
}
}
else if (!configInfo.config.fileNames.some(f => instance.filePathKeyMapper(f) === resolvedFilePath)) {
continue;
}
// Depend on all the dts files from the program
if (configInfo.dtsFiles) {
configInfo.dtsFiles.forEach(addDependency);
}
addDependenciesFromProjectReferences(instance, configFile, configInfo.config.projectReferences, addDependency);
break;
}
}
function addDependenciesFromProjectReferences(instance, configFile, projectReferences, addDependency) {
if (!projectReferences || !projectReferences.length) {
return;
}
// This is the config for the input file
const seenMap = new Map();
seenMap.set(instance.filePathKeyMapper(configFile), true);
// Add dependencies to all the input files from the project reference files since building them
const queue = projectReferences.slice();
while (true) {
const currentRef = queue.pop();
if (!currentRef) {
break;
}
const refConfigFile = instance.filePathKeyMapper(instance.compiler.resolveProjectReferencePath(currentRef));
if (seenMap.has(refConfigFile)) {
continue;
}
const refConfigInfo = instance.solutionBuilderHost.configFileInfo.get(refConfigFile);
if (!refConfigInfo) {
continue;
}
seenMap.set(refConfigFile, true);
if (refConfigInfo.config) {
refConfigInfo.config.fileNames.forEach(addDependency);
if (refConfigInfo.config.projectReferences) {
queue.push(...refConfigInfo.config.projectReferences);
}
}
}
}
/**
* Transpile file
*/
function getTranspilationEmit(fileName, contents, instance, loaderContext) {
if (utils_1.isReferencedFile(instance, fileName)) {
const outputFiles = instance.solutionBuilderHost.getOutputFilesFromReferencedProjectInput(fileName);
addDependenciesFromSolutionBuilder(instance, fileName, file => loaderContext.addDependency(path.resolve(file)));
return getOutputAndSourceMapFromOutputFiles(outputFiles);
}
const { outputText, sourceMapText, diagnostics, } = instance.compiler.transpileModule(contents, {
compilerOptions: Object.assign(Object.assign({}, instance.compilerOptions), { rootDir: undefined }),
transformers: instance.transformers,
reportDiagnostics: true,
fileName,
});
addDependenciesFromSolutionBuilder(instance, fileName, file => loaderContext.addDependency(path.resolve(file)));
// _module.errors is not available inside happypack - see https://github.com/TypeStrong/ts-loader/issues/336
if (!instance.loaderOptions.happyPackMode) {
const errors = utils_1.formatErrors(diagnostics, instance.loaderOptions, instance.colors, instance.compiler, { module: loaderContext._module }, loaderContext.context);
loaderContext._module.errors.push(...errors);
}
return { outputText, sourceMapText };
}
function makeSourceMap(sourceMapText, outputText, filePath, contents, loaderContext) {
if (sourceMapText === undefined) {
return { output: outputText, sourceMap: undefined };
}
return {
output: outputText.replace(/^\/\/# sourceMappingURL=[^\r\n]*/gm, ''),
sourceMap: Object.assign(JSON.parse(sourceMapText), {
sources: [loaderUtils.getRemainingRequest(loaderContext)],
file: filePath,
sourcesContent: [contents],
}),
};
}
module.exports = loader;
//# sourceMappingURL=index.js.map

23
node_modules/ts-loader/dist/instances.d.ts generated vendored Normal file
View file

@ -0,0 +1,23 @@
import * as typescript from 'typescript';
import * as webpack from 'webpack';
import { LoaderOptions, TSInstance, WebpackError } from './interfaces';
/**
* The loader is executed once for each file seen by webpack. However, we need to keep
* a persistent instance of TypeScript that contains all of the files in the program
* along with definition files and options. This function either creates an instance
* or returns the existing one. Multiple instances are possible by using the
* `instance` property.
*/
export declare function getTypeScriptInstance(loaderOptions: LoaderOptions, loader: webpack.loader.LoaderContext): {
instance?: TSInstance;
error?: WebpackError;
};
export declare function initializeInstance(loader: webpack.loader.LoaderContext, instance: TSInstance): void;
export declare function reportTranspileErrors(instance: TSInstance, loader: webpack.loader.LoaderContext): void;
export declare function buildSolutionReferences(instance: TSInstance, loader: webpack.loader.LoaderContext): void;
export declare function forEachResolvedProjectReference<T>(resolvedProjectReferences: readonly (typescript.ResolvedProjectReference | undefined)[] | undefined, cb: (resolvedProjectReference: typescript.ResolvedProjectReference) => T | undefined): T | undefined;
export declare function getOutputFileNames(instance: TSInstance, configFile: typescript.ParsedCommandLine, inputFileName: string): string[];
export declare function getInputFileNameFromOutput(instance: TSInstance, filePath: string): string | undefined;
export declare function getEmitFromWatchHost(instance: TSInstance, filePath?: string): typescript.OutputFile[] | undefined;
export declare function getEmitOutput(instance: TSInstance, filePath: string): typescript.OutputFile[];
//# sourceMappingURL=instances.d.ts.map

1
node_modules/ts-loader/dist/instances.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"instances.d.ts","sourceRoot":"","sources":["../src/instances.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAMnC,OAAO,EAEL,aAAa,EAEb,UAAU,EAEV,YAAY,EACb,MAAM,cAAc,CAAC;AAqBtB;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,GACnC;IAAE,QAAQ,CAAC,EAAE,UAAU,CAAC;IAAC,KAAK,CAAC,EAAE,YAAY,CAAA;CAAE,CA0BjD;AAsLD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EACpC,QAAQ,EAAE,UAAU,QA0GrB;AAgBD,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,QAuBrC;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,QAwBrC;AAwBD,wBAAgB,+BAA+B,CAAC,CAAC,EAC/C,yBAAyB,EACrB,SAAS,CAAC,UAAU,CAAC,wBAAwB,GAAG,SAAS,CAAC,EAAE,GAC5D,SAAS,EACb,EAAE,EAAE,CACF,wBAAwB,EAAE,UAAU,CAAC,wBAAwB,KAC1D,CAAC,GAAG,SAAS,GACjB,CAAC,GAAG,SAAS,CA8Bf;AA0ED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,UAAU,EACpB,UAAU,EAAE,UAAU,CAAC,iBAAiB,EACxC,aAAa,EAAE,MAAM,GACpB,MAAM,EAAE,CA2CV;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,MAAM,GACf,MAAM,GAAG,SAAS,CA2BpB;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,uCAyD3E;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,2BAqCnE"}

453
node_modules/ts-loader/dist/instances.js generated vendored Normal file
View file

@ -0,0 +1,453 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEmitOutput = exports.getEmitFromWatchHost = exports.getInputFileNameFromOutput = exports.getOutputFileNames = exports.forEachResolvedProjectReference = exports.buildSolutionReferences = exports.reportTranspileErrors = exports.initializeInstance = exports.getTypeScriptInstance = void 0;
const chalk_1 = require("chalk");
const fs = require("fs");
const path = require("path");
const after_compile_1 = require("./after-compile");
const compilerSetup_1 = require("./compilerSetup");
const config_1 = require("./config");
const constants_1 = require("./constants");
const logger = require("./logger");
const servicesHost_1 = require("./servicesHost");
const utils_1 = require("./utils");
const watch_run_1 = require("./watch-run");
const instances = {};
/**
* The loader is executed once for each file seen by webpack. However, we need to keep
* a persistent instance of TypeScript that contains all of the files in the program
* along with definition files and options. This function either creates an instance
* or returns the existing one. Multiple instances are possible by using the
* `instance` property.
*/
function getTypeScriptInstance(loaderOptions, loader) {
if (instances.hasOwnProperty(loaderOptions.instance)) {
const instance = instances[loaderOptions.instance];
if (!instance.initialSetupPending) {
utils_1.ensureProgram(instance);
}
return { instance: instances[loaderOptions.instance] };
}
const colors = new chalk_1.default.constructor({ enabled: loaderOptions.colors });
const log = logger.makeLogger(loaderOptions, colors);
const compiler = compilerSetup_1.getCompiler(loaderOptions, log);
if (compiler.errorMessage !== undefined) {
return { error: utils_1.makeError(colors.red(compiler.errorMessage), undefined) };
}
return successfulTypeScriptInstance(loaderOptions, loader, log, colors, compiler.compiler, compiler.compilerCompatible, compiler.compilerDetailsLogMessage);
}
exports.getTypeScriptInstance = getTypeScriptInstance;
function createFilePathKeyMapper(compiler, loaderOptions) {
// FileName lowercasing copied from typescript
const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
return utils_1.useCaseSensitiveFileNames(compiler, loaderOptions)
? pathResolve
: toFileNameLowerCase;
function pathResolve(x) {
return path.resolve(x);
}
function toFileNameLowerCase(x) {
const filePathKey = pathResolve(x);
return fileNameLowerCaseRegExp.test(filePathKey)
? filePathKey.replace(fileNameLowerCaseRegExp, ch => ch.toLowerCase())
: filePathKey;
}
}
function successfulTypeScriptInstance(loaderOptions, loader, log, colors, compiler, compilerCompatible, compilerDetailsLogMessage) {
const configFileAndPath = config_1.getConfigFile(compiler, colors, loader, loaderOptions, compilerCompatible, log, compilerDetailsLogMessage);
if (configFileAndPath.configFileError !== undefined) {
const { message, file } = configFileAndPath.configFileError;
return {
error: utils_1.makeError(colors.red('error while reading tsconfig.json:' + constants_1.EOL + message), file),
};
}
const { configFilePath, configFile } = configFileAndPath;
const basePath = loaderOptions.context || path.dirname(configFilePath || '');
const configParseResult = config_1.getConfigParseResult(compiler, configFile, basePath, configFilePath, loaderOptions);
if (configParseResult.errors.length > 0 && !loaderOptions.happyPackMode) {
const errors = utils_1.formatErrors(configParseResult.errors, loaderOptions, colors, compiler, { file: configFilePath }, loader.context);
loader._module.errors.push(...errors);
return {
error: utils_1.makeError(colors.red('error while parsing tsconfig.json'), configFilePath),
};
}
const compilerOptions = compilerSetup_1.getCompilerOptions(configParseResult);
const rootFileNames = new Set();
const files = new Map();
const otherFiles = new Map();
const appendTsTsxSuffixesIfRequired = loaderOptions.appendTsSuffixTo.length > 0 ||
loaderOptions.appendTsxSuffixTo.length > 0
? (filePath) => utils_1.appendSuffixesIfMatch({
'.ts': loaderOptions.appendTsSuffixTo,
'.tsx': loaderOptions.appendTsxSuffixTo,
}, filePath)
: (filePath) => filePath;
const filePathKeyMapper = createFilePathKeyMapper(compiler, loaderOptions);
if (loaderOptions.transpileOnly) {
// quick return for transpiling
// we do need to check for any issues with TS options though
const transpileInstance = (instances[loaderOptions.instance] = {
compiler,
compilerOptions,
appendTsTsxSuffixesIfRequired,
loaderOptions,
rootFileNames,
files,
otherFiles,
version: 0,
program: undefined,
dependencyGraph: new Map(),
transformers: {},
colors,
initialSetupPending: true,
reportTranspileErrors: true,
configFilePath,
configParseResult,
log,
filePathKeyMapper,
});
return { instance: transpileInstance };
}
// Load initial files (core lib files, any files specified in tsconfig.json)
let normalizedFilePath;
try {
const filesToLoad = loaderOptions.onlyCompileBundledFiles
? configParseResult.fileNames.filter(fileName => constants_1.dtsDtsxOrDtsDtsxMapRegex.test(fileName))
: configParseResult.fileNames;
filesToLoad.forEach(filePath => {
normalizedFilePath = path.normalize(filePath);
files.set(filePathKeyMapper(normalizedFilePath), {
fileName: normalizedFilePath,
text: fs.readFileSync(normalizedFilePath, 'utf-8'),
version: 0,
});
rootFileNames.add(normalizedFilePath);
});
}
catch (exc) {
return {
error: utils_1.makeError(colors.red(`A file specified in tsconfig.json could not be found: ${normalizedFilePath}`), normalizedFilePath),
};
}
const instance = (instances[loaderOptions.instance] = {
compiler,
compilerOptions,
appendTsTsxSuffixesIfRequired,
loaderOptions,
rootFileNames,
files,
otherFiles,
languageService: null,
version: 0,
transformers: {},
dependencyGraph: new Map(),
colors,
initialSetupPending: true,
configFilePath,
configParseResult,
log,
filePathKeyMapper,
});
return { instance };
}
function initializeInstance(loader, instance) {
if (!instance.initialSetupPending) {
return;
}
instance.initialSetupPending = false;
// same strategy as https://github.com/s-panferov/awesome-typescript-loader/pull/531/files
let { getCustomTransformers: customerTransformers } = instance.loaderOptions;
let getCustomTransformers = Function.prototype;
if (typeof customerTransformers === 'function') {
getCustomTransformers = customerTransformers;
}
else if (typeof customerTransformers === 'string') {
try {
customerTransformers = require(customerTransformers);
}
catch (err) {
throw new Error(`Failed to load customTransformers from "${instance.loaderOptions.getCustomTransformers}": ${err.message}`);
}
if (typeof customerTransformers !== 'function') {
throw new Error(`Custom transformers in "${instance.loaderOptions.getCustomTransformers}" should export a function, got ${typeof getCustomTransformers}`);
}
getCustomTransformers = customerTransformers;
}
if (instance.loaderOptions.transpileOnly) {
const program = (instance.program =
instance.configParseResult.projectReferences !== undefined
? instance.compiler.createProgram({
rootNames: instance.configParseResult.fileNames,
options: instance.configParseResult.options,
projectReferences: instance.configParseResult.projectReferences,
})
: instance.compiler.createProgram([], instance.compilerOptions));
instance.transformers = getCustomTransformers(program);
// Setup watch run for solution building
if (instance.solutionBuilderHost) {
loader._compiler.hooks.afterCompile.tapAsync('ts-loader', after_compile_1.makeAfterCompile(instance, instance.configFilePath));
loader._compiler.hooks.watchRun.tapAsync('ts-loader', watch_run_1.makeWatchRun(instance, loader));
}
}
else {
if (!loader._compiler.hooks) {
throw new Error("You may be using an old version of webpack; please check you're using at least version 4");
}
if (instance.loaderOptions.experimentalWatchApi) {
instance.log.logInfo('Using watch api');
// If there is api available for watch, use it instead of language service
instance.watchHost = servicesHost_1.makeWatchHost(getScriptRegexp(instance), loader, instance, instance.configParseResult.projectReferences);
instance.watchOfFilesAndCompilerOptions = instance.compiler.createWatchProgram(instance.watchHost);
instance.builderProgram = instance.watchOfFilesAndCompilerOptions.getProgram();
instance.program = instance.builderProgram.getProgram();
instance.transformers = getCustomTransformers(instance.program);
}
else {
instance.servicesHost = servicesHost_1.makeServicesHost(getScriptRegexp(instance), loader, instance, instance.configParseResult.projectReferences);
instance.languageService = instance.compiler.createLanguageService(instance.servicesHost, instance.compiler.createDocumentRegistry());
instance.transformers = getCustomTransformers(instance.languageService.getProgram());
}
loader._compiler.hooks.afterCompile.tapAsync('ts-loader', after_compile_1.makeAfterCompile(instance, instance.configFilePath));
loader._compiler.hooks.watchRun.tapAsync('ts-loader', watch_run_1.makeWatchRun(instance, loader));
}
}
exports.initializeInstance = initializeInstance;
function getScriptRegexp(instance) {
// If resolveJsonModules is set, we should accept json files
if (instance.configParseResult.options.resolveJsonModule) {
// if allowJs is set then we should accept js(x) files
return instance.configParseResult.options.allowJs === true
? /\.tsx?$|\.json$|\.jsx?$/i
: /\.tsx?$|\.json$/i;
}
// if allowJs is set then we should accept js(x) files
return instance.configParseResult.options.allowJs === true
? /\.tsx?$|\.jsx?$/i
: /\.tsx?$/i;
}
function reportTranspileErrors(instance, loader) {
if (!instance.reportTranspileErrors) {
return;
}
instance.reportTranspileErrors = false;
// happypack does not have _module.errors - see https://github.com/TypeStrong/ts-loader/issues/336
if (!instance.loaderOptions.happyPackMode) {
const solutionErrors = servicesHost_1.getSolutionErrors(instance, loader.context);
const diagnostics = instance.program.getOptionsDiagnostics();
const errors = utils_1.formatErrors(diagnostics, instance.loaderOptions, instance.colors, instance.compiler, { file: instance.configFilePath || 'tsconfig.json' }, loader.context);
loader._module.errors.push(...solutionErrors, ...errors);
}
}
exports.reportTranspileErrors = reportTranspileErrors;
function buildSolutionReferences(instance, loader) {
if (!utils_1.supportsSolutionBuild(instance)) {
return;
}
if (!instance.solutionBuilderHost) {
// Use solution builder
instance.log.logInfo('Using SolutionBuilder api');
const scriptRegex = getScriptRegexp(instance);
instance.solutionBuilderHost = servicesHost_1.makeSolutionBuilderHost(scriptRegex, loader, instance);
instance.solutionBuilder = instance.compiler.createSolutionBuilderWithWatch(instance.solutionBuilderHost, instance.configParseResult.projectReferences.map(ref => ref.path), { verbose: true });
instance.solutionBuilder.build();
ensureAllReferences(instance);
}
else {
instance.solutionBuilderHost.buildReferences();
}
}
exports.buildSolutionReferences = buildSolutionReferences;
function ensureAllReferences(instance) {
// Return result from the json without errors so that the extra errors from config are digested here
for (const configInfo of instance.solutionBuilderHost.configFileInfo.values()) {
if (!configInfo.config) {
continue;
}
// Load all the input files
configInfo.config.fileNames.forEach(file => {
const resolvedFileName = instance.filePathKeyMapper(file);
const existing = instance.otherFiles.get(resolvedFileName);
if (!existing) {
instance.otherFiles.set(resolvedFileName, {
fileName: path.resolve(file),
version: 1,
text: instance.compiler.sys.readFile(file),
modifiedTime: instance.compiler.sys.getModifiedTime(file),
});
}
});
}
}
function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
let seenResolvedRefs;
return worker(resolvedProjectReferences);
function worker(resolvedRefs) {
if (resolvedRefs) {
for (const resolvedRef of resolvedRefs) {
if (!resolvedRef) {
continue;
}
if (seenResolvedRefs &&
seenResolvedRefs.some(seenRef => seenRef === resolvedRef)) {
// ignore recursives
continue;
}
(seenResolvedRefs || (seenResolvedRefs = [])).push(resolvedRef);
const result = cb(resolvedRef) || worker(resolvedRef.references);
if (result) {
return result;
}
}
}
return undefined;
}
}
exports.forEachResolvedProjectReference = forEachResolvedProjectReference;
// This code is here as a temporary holder
function fileExtensionIs(fileName, ext) {
return fileName.endsWith(ext);
}
function rootDirOfOptions(instance, configFile) {
return (configFile.options.rootDir ||
instance.compiler.getDirectoryPath(configFile.options.configFilePath));
}
function getOutputPathWithoutChangingExt(instance, inputFileName, configFile, ignoreCase, outputDir) {
return outputDir
? instance.compiler.resolvePath(outputDir, instance.compiler.getRelativePathFromDirectory(rootDirOfOptions(instance, configFile), inputFileName, ignoreCase))
: inputFileName;
}
function getOutputJSFileName(instance, inputFileName, configFile, ignoreCase) {
if (configFile.options.emitDeclarationOnly) {
return undefined;
}
const isJsonFile = fileExtensionIs(inputFileName, '.json');
const outputFileName = instance.compiler.changeExtension(getOutputPathWithoutChangingExt(instance, inputFileName, configFile, ignoreCase, configFile.options.outDir), isJsonFile
? '.json'
: fileExtensionIs(inputFileName, '.tsx') &&
configFile.options.jsx === instance.compiler.JsxEmit.Preserve
? '.jsx'
: '.js');
return !isJsonFile ||
instance.compiler.comparePaths(inputFileName, outputFileName, configFile.options.configFilePath, ignoreCase) !== instance.compiler.Comparison.EqualTo
? outputFileName
: undefined;
}
function getOutputFileNames(instance, configFile, inputFileName) {
const ignoreCase = !utils_1.useCaseSensitiveFileNames(instance.compiler, instance.loaderOptions);
if (instance.compiler.getOutputFileNames) {
return instance.compiler.getOutputFileNames(configFile, inputFileName, ignoreCase);
}
const outputs = [];
const addOutput = (fileName) => fileName && outputs.push(fileName);
const js = getOutputJSFileName(instance, inputFileName, configFile, ignoreCase);
addOutput(js);
if (!fileExtensionIs(inputFileName, '.json')) {
if (js && configFile.options.sourceMap) {
addOutput(`${js}.map`);
}
if ((configFile.options.declaration || configFile.options.composite) &&
instance.compiler.hasTSFileExtension(inputFileName)) {
const dts = instance.compiler.getOutputDeclarationFileName(inputFileName, configFile, ignoreCase);
addOutput(dts);
if (configFile.options.declarationMap) {
addOutput(`${dts}.map`);
}
}
}
return outputs;
}
exports.getOutputFileNames = getOutputFileNames;
function getInputFileNameFromOutput(instance, filePath) {
if (filePath.match(constants_1.tsTsxRegex) && !fileExtensionIs(filePath, '.d.ts')) {
return undefined;
}
if (instance.solutionBuilderHost) {
return instance.solutionBuilderHost.getInputFileNameFromOutput(filePath);
}
const program = utils_1.ensureProgram(instance);
return (program &&
program.getResolvedProjectReferences &&
forEachResolvedProjectReference(program.getResolvedProjectReferences(), ({ commandLine }) => {
const { options, fileNames } = commandLine;
if (!options.outFile && !options.out) {
const input = fileNames.find(file => getOutputFileNames(instance, commandLine, file).find(name => path.resolve(name) === filePath));
return input && path.resolve(input);
}
return undefined;
}));
}
exports.getInputFileNameFromOutput = getInputFileNameFromOutput;
function getEmitFromWatchHost(instance, filePath) {
const program = utils_1.ensureProgram(instance);
const builderProgram = instance.builderProgram;
if (builderProgram && program) {
if (filePath) {
const existing = instance.watchHost.outputFiles.get(instance.filePathKeyMapper(filePath));
if (existing) {
return existing;
}
}
const outputFiles = [];
const writeFile = (fileName, text, writeByteOrderMark) => {
if (fileName.endsWith('.tsbuildinfo')) {
instance.watchHost.tsbuildinfo = {
name: fileName,
writeByteOrderMark,
text,
};
}
else {
outputFiles.push({ name: fileName, writeByteOrderMark, text });
}
};
const sourceFile = filePath ? program.getSourceFile(filePath) : undefined;
// Try emit Next file
while (true) {
const result = builderProgram.emitNextAffectedFile(writeFile,
/*cancellationToken*/ undefined,
/*emitOnlyDtsFiles*/ false, instance.transformers);
if (!result) {
break;
}
// Only put the output file in the cache if the source came from webpack and
// was processed by the loaders
if (result.affected === sourceFile) {
instance.watchHost.outputFiles.set(instance.filePathKeyMapper(result.affected.fileName), outputFiles.slice());
return outputFiles;
}
}
}
return undefined;
}
exports.getEmitFromWatchHost = getEmitFromWatchHost;
function getEmitOutput(instance, filePath) {
if (fileExtensionIs(filePath, instance.compiler.Extension.Dts)) {
return [];
}
if (utils_1.isReferencedFile(instance, filePath)) {
return instance.solutionBuilderHost.getOutputFilesFromReferencedProjectInput(filePath);
}
const program = utils_1.ensureProgram(instance);
if (program !== undefined) {
const sourceFile = program.getSourceFile(filePath);
const outputFiles = [];
const writeFile = (fileName, text, writeByteOrderMark) => outputFiles.push({ name: fileName, writeByteOrderMark, text });
const outputFilesFromWatch = getEmitFromWatchHost(instance, filePath);
if (outputFilesFromWatch) {
return outputFilesFromWatch;
}
program.emit(sourceFile, writeFile,
/*cancellationToken*/ undefined,
/*emitOnlyDtsFiles*/ false, instance.transformers);
return outputFiles;
}
else {
// Emit Javascript
return instance.languageService.getProgram().getSourceFile(filePath) ===
undefined
? []
: instance.languageService.getEmitOutput(filePath).outputFiles;
}
}
exports.getEmitOutput = getEmitOutput;
//# sourceMappingURL=instances.js.map

223
node_modules/ts-loader/dist/interfaces.d.ts generated vendored Normal file
View file

@ -0,0 +1,223 @@
import * as typescript from 'typescript';
import { Chalk } from 'chalk';
import * as logger from './logger';
export interface ErrorInfo {
code: number;
severity: Severity;
content: string;
file: string;
line: number;
character: number;
context: string;
}
export declare type FileLocation = {
line: number;
character: number;
};
export interface WebpackError {
module?: any;
file?: string;
message: string;
location?: FileLocation;
loaderSource: string;
}
export interface WebpackModule {
resource: string;
errors: WebpackError[];
addWarning(warning: Error): void;
addError(error: WebpackError | Error): void;
getWarnings(): Iterable<Error> | undefined;
getErrors(): Iterable<WebpackError | Error> | undefined;
clearWarningsAndErrors(): void;
buildMeta: {
tsLoaderFileVersion: number;
tsLoaderDefinitionFileVersions: string[];
};
}
export declare type ResolveSync = (context: string | undefined, path: string, moduleName: string) => string;
export declare type Action = () => void;
export interface HostMayBeCacheable {
clearCache?: Action;
}
export interface CacheableHost extends HostMayBeCacheable {
fileExists: typescript.ModuleResolutionHost['fileExists'];
directoryExists: NonNullable<typescript.ModuleResolutionHost['directoryExists']>;
realpath?: typescript.ModuleResolutionHost['realpath'];
}
export interface ModuleResolutionHostMayBeCacheable extends typescript.ModuleResolutionHost, HostMayBeCacheable {
readFile(filePath: string, encoding?: string): string | undefined;
trace: NonNullable<typescript.ModuleResolutionHost['trace']>;
directoryExists: NonNullable<typescript.ModuleResolutionHost['directoryExists']>;
getCurrentDirectory: NonNullable<typescript.ModuleResolutionHost['getCurrentDirectory']>;
getDirectories: NonNullable<typescript.ModuleResolutionHost['getDirectories']>;
useCaseSensitiveFileNames: NonNullable<typescript.LanguageServiceHost['useCaseSensitiveFileNames']>;
getNewLine: NonNullable<typescript.LanguageServiceHost['getNewLine']>;
getDefaultLibFileName: NonNullable<typescript.LanguageServiceHost['getDefaultLibFileName']>;
readDirectory: NonNullable<typescript.LanguageServiceHost['readDirectory']>;
}
export interface ServiceHostWhichMayBeCacheable extends typescript.LanguageServiceHost, HostMayBeCacheable {
}
export interface WatchHost extends typescript.WatchCompilerHostOfFilesAndCompilerOptions<typescript.EmitAndSemanticDiagnosticsBuilderProgram> {
invokeFileWatcher: WatchFactory['invokeFileWatcher'];
updateRootFileNames(): void;
outputFiles: Map<FilePathKey, typescript.OutputFile[]>;
tsbuildinfo?: typescript.OutputFile;
}
export declare type WatchCallbacks<T> = Map<FilePathKey, {
fileName: string;
callbacks: T[];
}>;
export interface WatchFactory {
watchedFiles: WatchCallbacks<typescript.FileWatcherCallback>;
watchedDirectories: WatchCallbacks<typescript.DirectoryWatcherCallback>;
watchedDirectoriesRecursive: WatchCallbacks<typescript.DirectoryWatcherCallback>;
invokeFileWatcher(fileName: string, eventKind: typescript.FileWatcherEventKind): boolean;
/** Used to watch changes in source files, missing files needed to update the program or config file */
watchFile: typescript.WatchHost['watchFile'];
/** Used to watch resolved module's failed lookup locations, config file specs, type roots where auto type reference directives are added */
watchDirectory: typescript.WatchHost['watchDirectory'];
}
export interface SolutionDiagnostics {
global: typescript.Diagnostic[];
perFile: Map<FilePathKey, typescript.Diagnostic[]>;
transpileErrors: [FilePathKey | undefined, typescript.Diagnostic[]][];
}
export declare type FilePathKey = string & {
__filePathKeyBrand: any;
};
export interface SolutionBuilderWithWatchHost extends typescript.SolutionBuilderWithWatchHost<typescript.EmitAndSemanticDiagnosticsBuilderProgram>, WatchFactory {
diagnostics: SolutionDiagnostics;
writtenFiles: OutputFile[];
configFileInfo: Map<FilePathKey, ConfigFileInfo>;
outputAffectingInstanceVersion: Map<FilePathKey, true>;
getOutputFileKeyFromReferencedProject(outputFileName: string): FilePathKey | undefined;
getOutputFileFromReferencedProject(outputFileName: string): OutputFile | false | undefined;
getOutputFileAndKeyFromReferencedProject(oututFileName: string): {
key: FilePathKey;
outputFile: OutputFile | false;
} | undefined;
getInputFileNameFromOutput(outputFileName: string): string | undefined;
getOutputFilesFromReferencedProjectInput(inputFileName: string): OutputFile[];
buildReferences(): void;
clearCache(): void;
}
export interface ConfigFileInfo {
config: typescript.ParsedCommandLine | undefined;
outputFileNames?: Map<FilePathKey, {
inputFileName: string;
outputNames: FilePathKey[];
}>;
tsbuildInfoFile?: string;
dtsFiles?: string[];
}
export interface OutputFile extends typescript.OutputFile {
time: Date;
version: number;
}
export interface TSInstance {
compiler: typeof typescript;
compilerOptions: typescript.CompilerOptions;
/** Used for Vue for the most part */
appendTsTsxSuffixesIfRequired: (filePath: string) => string;
loaderOptions: LoaderOptions;
rootFileNames: Set<string>;
/**
* a cache of all the files
*/
files: TSFiles;
/**
* contains the modified files - cleared each time after-compile is called
*/
modifiedFiles?: Map<FilePathKey, true>;
/**
* Paths to project references that are missing source maps.
* Cleared each time after-compile is called. Used to dedupe
* warnings about source maps during a single compilation.
*/
projectsMissingSourceMaps?: Set<string>;
servicesHost?: ServiceHostWhichMayBeCacheable;
languageService?: typescript.LanguageService | null;
version: number;
dependencyGraph: DependencyGraph;
filesWithErrors?: TSFiles;
transformers: typescript.CustomTransformers;
colors: Chalk;
otherFiles: TSFiles;
watchHost?: WatchHost;
watchOfFilesAndCompilerOptions?: typescript.WatchOfFilesAndCompilerOptions<typescript.EmitAndSemanticDiagnosticsBuilderProgram>;
builderProgram?: typescript.EmitAndSemanticDiagnosticsBuilderProgram;
program?: typescript.Program;
hasUnaccountedModifiedFiles?: boolean;
changedFilesList?: boolean;
reportTranspileErrors?: boolean;
solutionBuilderHost?: SolutionBuilderWithWatchHost;
solutionBuilder?: typescript.SolutionBuilder<typescript.EmitAndSemanticDiagnosticsBuilderProgram>;
configFilePath: string | undefined;
filePathKeyMapper: (fileName: string) => FilePathKey;
initialSetupPending: boolean;
configParseResult: typescript.ParsedCommandLine;
log: logger.Logger;
}
export interface LoaderOptionsCache {
[name: string]: WeakMap<LoaderOptions, LoaderOptions>;
}
export interface TSInstances {
[name: string]: TSInstance;
}
export declare type DependencyGraph = Map<FilePathKey, ResolvedModule[]>;
export declare type ReverseDependencyGraph = Map<FilePathKey, Map<FilePathKey, true>>;
export declare type LogLevel = 'INFO' | 'WARN' | 'ERROR';
export declare type ResolveModuleName = (moduleName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost) => typescript.ResolvedModuleWithFailedLookupLocations;
export declare type CustomResolveModuleName = (moduleName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost, parentResolver: ResolveModuleName) => typescript.ResolvedModuleWithFailedLookupLocations;
export declare type CustomResolveTypeReferenceDirective = (typeDirectiveName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost, parentResolver: typeof typescript.resolveTypeReferenceDirective) => typescript.ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
export interface LoaderOptions {
silent: boolean;
logLevel: LogLevel;
logInfoToStdOut: boolean;
instance: string;
compiler: string;
configFile: string;
context: string;
transpileOnly: boolean;
ignoreDiagnostics: number[];
reportFiles: string[];
errorFormatter: (message: ErrorInfo, colors: Chalk) => string;
onlyCompileBundledFiles: boolean;
colors: boolean;
compilerOptions: typescript.CompilerOptions;
appendTsSuffixTo: RegExp[];
appendTsxSuffixTo: RegExp[];
happyPackMode: boolean;
getCustomTransformers: string | ((program: typescript.Program) => typescript.CustomTransformers | undefined);
experimentalWatchApi: boolean;
allowTsInNodeModules: boolean;
experimentalFileCaching: boolean;
projectReferences: boolean;
resolveModuleName: CustomResolveModuleName;
resolveTypeReferenceDirective: CustomResolveTypeReferenceDirective;
useCaseSensitiveFileNames?: boolean;
}
export interface TSFile {
fileName: string;
text?: string;
version: number;
modifiedTime?: Date;
projectReference?: {
/**
* Undefined here means weve already checked and confirmed there is no
* project reference for the file. Dont bother checking again.
*/
project?: typescript.ResolvedProjectReference;
outputFileName?: string;
};
}
/** where key is filepath */
export declare type TSFiles = Map<FilePathKey, TSFile>;
export interface ResolvedModule {
originalFileName: string;
resolvedFileName: string;
resolvedModule?: ResolvedModule;
isExternalLibraryImport?: boolean;
}
export declare type Severity = 'error' | 'warning';
//# sourceMappingURL=interfaces.d.ts.map

1
node_modules/ts-loader/dist/interfaces.d.ts.map generated vendored Normal file

File diff suppressed because one or more lines are too long

3
node_modules/ts-loader/dist/interfaces.js generated vendored Normal file
View file

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=interfaces.js.map

17
node_modules/ts-loader/dist/logger.d.ts generated vendored Normal file
View file

@ -0,0 +1,17 @@
import { Chalk } from 'chalk';
import { LoaderOptions } from './interfaces';
declare type LoggerFunc = (message: string) => void;
export interface Logger {
log: LoggerFunc;
logInfo: LoggerFunc;
logWarning: LoggerFunc;
logError: LoggerFunc;
}
export declare enum LogLevel {
INFO = 1,
WARN = 2,
ERROR = 3
}
export declare function makeLogger(loaderOptions: LoaderOptions, colors: Chalk): Logger;
export {};
//# sourceMappingURL=logger.d.ts.map

1
node_modules/ts-loader/dist/logger.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,aAAK,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAE5C,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,UAAU,CAAC;IAChB,OAAO,EAAE,UAAU,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,UAAU,CAAC;CACtB;AAED,oBAAY,QAAQ;IAClB,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAqDD,wBAAgB,UAAU,CACxB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,KAAK,GACZ,MAAM,CAQR"}

37
node_modules/ts-loader/dist/logger.js generated vendored Normal file
View file

@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeLogger = exports.LogLevel = void 0;
const console_1 = require("console");
var LogLevel;
(function (LogLevel) {
LogLevel[LogLevel["INFO"] = 1] = "INFO";
LogLevel[LogLevel["WARN"] = 2] = "WARN";
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
const stderrConsole = new console_1.Console(process.stderr);
const stdoutConsole = new console_1.Console(process.stdout);
const doNothingLogger = (_message) => { };
const makeLoggerFunc = (loaderOptions) => loaderOptions.silent
? (_whereToLog, _message) => { }
: (whereToLog, message) => console.log.call(whereToLog, message);
const makeExternalLogger = (loaderOptions, logger) => (message) => logger(loaderOptions.logInfoToStdOut ? stdoutConsole : stderrConsole, message);
const makeLogInfo = (loaderOptions, logger, green) => LogLevel[loaderOptions.logLevel] <= LogLevel.INFO
? (message) => logger(loaderOptions.logInfoToStdOut ? stdoutConsole : stderrConsole, green(message))
: doNothingLogger;
const makeLogError = (loaderOptions, logger, red) => LogLevel[loaderOptions.logLevel] <= LogLevel.ERROR
? (message) => logger(stderrConsole, red(message))
: doNothingLogger;
const makeLogWarning = (loaderOptions, logger, yellow) => LogLevel[loaderOptions.logLevel] <= LogLevel.WARN
? (message) => logger(stderrConsole, yellow(message))
: doNothingLogger;
function makeLogger(loaderOptions, colors) {
const logger = makeLoggerFunc(loaderOptions);
return {
log: makeExternalLogger(loaderOptions, logger),
logInfo: makeLogInfo(loaderOptions, logger, colors.green),
logWarning: makeLogWarning(loaderOptions, logger, colors.yellow),
logError: makeLogError(loaderOptions, logger, colors.red),
};
}
exports.makeLogger = makeLogger;
//# sourceMappingURL=logger.js.map

4
node_modules/ts-loader/dist/resolver.d.ts generated vendored Normal file
View file

@ -0,0 +1,4 @@
import * as webpack from 'webpack';
import { ResolveSync } from './interfaces';
export declare function makeResolver(options: webpack.Configuration): ResolveSync;
//# sourceMappingURL=resolver.d.ts.map

1
node_modules/ts-loader/dist/resolver.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAK3C,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,GAAG,WAAW,CAExE"}

10
node_modules/ts-loader/dist/resolver.js generated vendored Normal file
View file

@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeResolver = void 0;
// eslint-disable-next-line @typescript-eslint/no-var-requires
const node = require('enhanced-resolve/lib/node');
function makeResolver(options) {
return node.create.sync(options.resolve);
}
exports.makeResolver = makeResolver;
//# sourceMappingURL=resolver.js.map

18
node_modules/ts-loader/dist/servicesHost.d.ts generated vendored Normal file
View file

@ -0,0 +1,18 @@
import * as typescript from 'typescript';
import * as webpack from 'webpack';
import { FilePathKey, ServiceHostWhichMayBeCacheable, SolutionBuilderWithWatchHost, TSInstance, WatchHost, WebpackError } from './interfaces';
/**
* Create the TypeScript language service
*/
export declare function makeServicesHost(scriptRegex: RegExp, loader: webpack.loader.LoaderContext, instance: TSInstance, projectReferences?: ReadonlyArray<typescript.ProjectReference>): ServiceHostWhichMayBeCacheable;
export declare function updateFileWithText(instance: TSInstance, key: FilePathKey, filePath: string, text: (nFilePath: string) => string): void;
/**
* Create the TypeScript Watch host
*/
export declare function makeWatchHost(scriptRegex: RegExp, loader: webpack.loader.LoaderContext, instance: TSInstance, projectReferences?: ReadonlyArray<typescript.ProjectReference>): WatchHost;
/**
* Create the TypeScript Watch host
*/
export declare function makeSolutionBuilderHost(scriptRegex: RegExp, loader: webpack.loader.LoaderContext, instance: TSInstance): SolutionBuilderWithWatchHost;
export declare function getSolutionErrors(instance: TSInstance, context: string): WebpackError[];
//# sourceMappingURL=servicesHost.d.ts.map

1
node_modules/ts-loader/dist/servicesHost.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"servicesHost.d.ts","sourceRoot":"","sources":["../src/servicesHost.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAInC,OAAO,EAML,WAAW,EAKX,8BAA8B,EAC9B,4BAA4B,EAG5B,UAAU,EAGV,SAAS,EACT,YAAY,EACb,MAAM,cAAc,CAAC;AAwItB;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EACpC,QAAQ,EAAE,UAAU,EACpB,iBAAiB,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAC7D,8BAA8B,CA0IhC;AAqMD,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,QA6BpC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EACpC,QAAQ,EAAE,UAAU,EACpB,iBAAiB,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC,aA6J/D;AAMD;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EACpC,QAAQ,EAAE,UAAU,GACnB,4BAA4B,CAugB9B;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAqBtE"}

825
node_modules/ts-loader/dist/servicesHost.js generated vendored Normal file
View file

@ -0,0 +1,825 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSolutionErrors = exports.makeSolutionBuilderHost = exports.makeWatchHost = exports.updateFileWithText = exports.makeServicesHost = void 0;
const path = require("path");
const config_1 = require("./config");
const constants = require("./constants");
const instances_1 = require("./instances");
const resolver_1 = require("./resolver");
const utils_1 = require("./utils");
function makeResolversHandlingProjectReferences(scriptRegex, loader, instance, originalFileExists, enableFileCaching) {
const { compiler, compilerOptions, appendTsTsxSuffixesIfRequired, loaderOptions: { resolveModuleName: customResolveModuleName, resolveTypeReferenceDirective: customResolveTypeReferenceDirective, }, } = instance;
const newLine = compilerOptions.newLine === constants.CarriageReturnLineFeedCode
? constants.CarriageReturnLineFeed
: compilerOptions.newLine === constants.LineFeedCode
? constants.LineFeed
: constants.EOL;
// loader.context seems to work fine on Linux / Mac regardless causes problems for @types resolution on Windows for TypeScript < 2.3
const getCurrentDirectory = () => loader.context;
// make a (sync) resolver that follows webpack's rules
const resolveSync = resolver_1.makeResolver(loader._compiler.options);
const moduleResolutionHost = {
trace: logData => instance.log.log(logData),
fileExists,
readFile,
realpath: compiler.sys.realpath && realpath,
directoryExists,
getCurrentDirectory,
getDirectories,
readDirectory,
useCaseSensitiveFileNames: () => utils_1.useCaseSensitiveFileNames(compiler, instance.loaderOptions),
getNewLine: () => newLine,
getDefaultLibFileName: options => compiler.getDefaultLibFilePath(options),
};
if (enableFileCaching) {
addCache(moduleResolutionHost);
}
return makeResolvers(compiler, compilerOptions, moduleResolutionHost, customResolveTypeReferenceDirective, customResolveModuleName, resolveSync, appendTsTsxSuffixesIfRequired, scriptRegex, instance);
function fileExists(filePathToCheck) {
var _a;
const outputFile = (_a = instance.solutionBuilderHost) === null || _a === void 0 ? void 0 : _a.getOutputFileFromReferencedProject(filePathToCheck);
if (outputFile !== undefined) {
return !!outputFile;
}
return originalFileExists(filePathToCheck);
}
function readFile(filePath, encoding) {
var _a;
const outputFile = (_a = instance.solutionBuilderHost) === null || _a === void 0 ? void 0 : _a.getOutputFileFromReferencedProject(filePath);
if (outputFile !== undefined) {
return outputFile ? outputFile.text : undefined;
}
return (instance.compiler.sys.readFile(filePath, encoding) ||
utils_1.fsReadFile(filePath, encoding));
}
function directoryExists(directoryName) {
return instance.solutionBuilderHost
? instance.solutionBuilderHost.directoryExists(directoryName)
: compiler.sys.directoryExists(directoryName);
}
function realpath(path) {
return instance.solutionBuilderHost
? instance.solutionBuilderHost.realpath(path)
: compiler.sys.realpath(path);
}
function getDirectories(path) {
return instance.solutionBuilderHost
? instance.solutionBuilderHost.getDirectories(path)
: compiler.sys.getDirectories(path);
}
function readDirectory(path, extensions, exclude, include, depth) {
return instance.solutionBuilderHost
? instance.solutionBuilderHost.readDirectory(path, extensions, exclude, include, depth)
: compiler.sys.readDirectory(path, extensions, exclude, include, depth);
}
}
/**
* Create the TypeScript language service
*/
function makeServicesHost(scriptRegex, loader, instance, projectReferences) {
const { compiler, compilerOptions, files, filePathKeyMapper } = instance;
const { moduleResolutionHost: { fileExists, readFile, trace, directoryExists, realpath, getCurrentDirectory, getDirectories, clearCache, useCaseSensitiveFileNames, getNewLine, getDefaultLibFileName, readDirectory, }, resolveModuleNames, resolveTypeReferenceDirectives, } = makeResolversHandlingProjectReferences(scriptRegex, loader, instance, filePathToCheck => compiler.sys.fileExists(filePathToCheck) ||
utils_1.fsReadFile(filePathToCheck) !== undefined, instance.loaderOptions.experimentalFileCaching);
const servicesHost = {
getProjectVersion: () => `${instance.version}`,
getProjectReferences: () => projectReferences,
getScriptFileNames: () => [...files.values()]
.map(({ fileName }) => fileName)
.filter(filePath => filePath.match(scriptRegex)),
getScriptVersion: (fileName) => {
fileName = path.normalize(fileName);
const key = filePathKeyMapper(fileName);
const file = files.get(key);
if (file) {
return file.version.toString();
}
const outputFileAndKey = instance.solutionBuilderHost &&
instance.solutionBuilderHost.getOutputFileAndKeyFromReferencedProject(fileName);
if (outputFileAndKey !== undefined) {
instance.solutionBuilderHost.outputAffectingInstanceVersion.set(outputFileAndKey.key, true);
}
return outputFileAndKey && outputFileAndKey.outputFile
? outputFileAndKey.outputFile.version.toString()
: '';
},
getScriptSnapshot: (fileName) => {
// This is called any time TypeScript needs a file's text
// We either load from memory or from disk
fileName = path.normalize(fileName);
const key = filePathKeyMapper(fileName);
let file = files.get(key);
if (file === undefined) {
if (instance.solutionBuilderHost) {
const outputFileAndKey = instance.solutionBuilderHost.getOutputFileAndKeyFromReferencedProject(fileName);
if (outputFileAndKey !== undefined) {
instance.solutionBuilderHost.outputAffectingInstanceVersion.set(outputFileAndKey.key, true);
return outputFileAndKey && outputFileAndKey.outputFile
? compiler.ScriptSnapshot.fromString(outputFileAndKey.outputFile.text)
: undefined;
}
}
const text = readFile(fileName);
if (text === undefined) {
return undefined;
}
file = { fileName, version: 0, text };
files.set(key, file);
}
return compiler.ScriptSnapshot.fromString(file.text);
},
/**
* getDirectories is also required for full import and type reference completions.
* Without it defined, certain completions will not be provided
*/
getDirectories,
/**
* For @types expansion, these two functions are needed.
*/
directoryExists,
useCaseSensitiveFileNames,
realpath,
// The following three methods are necessary for @types resolution from TS 2.4.1 onwards see: https://github.com/Microsoft/TypeScript/issues/16772
fileExists,
readFile,
readDirectory,
getCurrentDirectory,
getCompilationSettings: () => compilerOptions,
getDefaultLibFileName,
getNewLine,
trace,
log: trace,
// used for (/// <reference types="...">) see https://github.com/Realytics/fork-ts-checker-webpack-plugin/pull/250#issuecomment-485061329
resolveTypeReferenceDirectives,
resolveModuleNames,
getCustomTransformers: () => instance.transformers,
clearCache,
};
return servicesHost;
}
exports.makeServicesHost = makeServicesHost;
function makeResolvers(compiler, compilerOptions, moduleResolutionHost, customResolveTypeReferenceDirective, customResolveModuleName, resolveSync, appendTsTsxSuffixesIfRequired, scriptRegex, instance) {
const resolveTypeReferenceDirective = makeResolveTypeReferenceDirective(compiler, compilerOptions, moduleResolutionHost, customResolveTypeReferenceDirective);
const resolveTypeReferenceDirectives = (typeDirectiveNames, containingFile, _redirectedReference) => typeDirectiveNames.map(directive => resolveTypeReferenceDirective(directive, containingFile, _redirectedReference).resolvedTypeReferenceDirective);
const resolveModuleName = makeResolveModuleName(compiler, compilerOptions, moduleResolutionHost, customResolveModuleName);
const resolveModuleNames = (moduleNames, containingFile, _reusedNames, _redirectedReference) => {
const resolvedModules = moduleNames.map(moduleName => resolveModule(resolveSync, resolveModuleName, appendTsTsxSuffixesIfRequired, scriptRegex, moduleName, containingFile));
utils_1.populateDependencyGraph(resolvedModules, instance, containingFile);
return resolvedModules;
};
return {
resolveTypeReferenceDirectives,
resolveModuleNames,
moduleResolutionHost,
};
}
function createWatchFactory(filePathKeyMapper, compiler) {
const watchedFiles = new Map();
const watchedDirectories = new Map();
const watchedDirectoriesRecursive = new Map();
return {
watchedFiles,
watchedDirectories,
watchedDirectoriesRecursive,
invokeFileWatcher,
watchFile,
watchDirectory,
};
function invokeWatcherCallbacks(map, key, fileName, eventKind) {
var _a;
const callbacks = (_a = map.get(filePathKeyMapper(key))) === null || _a === void 0 ? void 0 : _a.callbacks;
if (callbacks !== undefined && callbacks.length) {
// The array copy is made to ensure that even if one of the callback removes the callbacks,
// we dont miss any callbacks following it
const cbs = callbacks.slice();
for (const cb of cbs) {
cb(fileName, eventKind);
}
return true;
}
return false;
}
function invokeFileWatcher(fileName, eventKind) {
fileName = path.normalize(fileName);
let result = invokeWatcherCallbacks(watchedFiles, fileName, fileName, eventKind);
if (eventKind !== compiler.FileWatcherEventKind.Changed) {
const directory = path.dirname(fileName);
result =
invokeWatcherCallbacks(watchedDirectories, directory, fileName) ||
result;
result = invokeRecursiveDirectoryWatcher(directory, fileName) || result;
}
return result;
}
``;
function invokeRecursiveDirectoryWatcher(directory, fileAddedOrRemoved) {
directory = path.normalize(directory);
let result = invokeWatcherCallbacks(watchedDirectoriesRecursive, directory, fileAddedOrRemoved);
const basePath = path.dirname(directory);
if (directory !== basePath) {
result =
invokeRecursiveDirectoryWatcher(basePath, fileAddedOrRemoved) || result;
}
return result;
}
function createWatcher(file, callbacks, callback) {
const key = filePathKeyMapper(file);
const existing = callbacks.get(key);
if (existing === undefined) {
callbacks.set(key, {
fileName: path.normalize(file),
callbacks: [callback],
});
}
else {
existing.callbacks.push(callback);
}
return {
close: () => {
const existing = callbacks.get(key);
if (existing !== undefined) {
utils_1.unorderedRemoveItem(existing.callbacks, callback);
if (!existing.callbacks.length) {
callbacks.delete(key);
}
}
},
};
}
function watchFile(fileName, callback, _pollingInterval) {
return createWatcher(fileName, watchedFiles, callback);
}
function watchDirectory(fileName, callback, recursive) {
return createWatcher(fileName, recursive === true ? watchedDirectoriesRecursive : watchedDirectories, callback);
}
}
function updateFileWithText(instance, key, filePath, text) {
const nFilePath = path.normalize(filePath);
const file = instance.files.get(key) || instance.otherFiles.get(key);
if (file !== undefined) {
const newText = text(nFilePath);
if (newText !== file.text) {
file.text = newText;
file.version++;
file.modifiedTime = new Date();
instance.version++;
if (!instance.modifiedFiles) {
instance.modifiedFiles = new Map();
}
instance.modifiedFiles.set(key, true);
if (instance.watchHost !== undefined) {
instance.watchHost.invokeFileWatcher(nFilePath, instance.compiler.FileWatcherEventKind.Changed);
}
if (instance.solutionBuilderHost !== undefined) {
instance.solutionBuilderHost.invokeFileWatcher(nFilePath, instance.compiler.FileWatcherEventKind.Changed);
}
}
}
}
exports.updateFileWithText = updateFileWithText;
/**
* Create the TypeScript Watch host
*/
function makeWatchHost(scriptRegex, loader, instance, projectReferences) {
const { compiler, compilerOptions, files, otherFiles, filePathKeyMapper, } = instance;
const { watchFile, watchDirectory, invokeFileWatcher } = createWatchFactory(filePathKeyMapper, compiler);
const { moduleResolutionHost: { fileExists, readFile, trace, directoryExists, realpath, getCurrentDirectory, getDirectories, useCaseSensitiveFileNames, getNewLine, getDefaultLibFileName, readDirectory, }, resolveModuleNames, resolveTypeReferenceDirectives, } = makeResolversHandlingProjectReferences(scriptRegex, loader, instance, (fileName) => {
const filePath = filePathKeyMapper(fileName);
return files.has(filePath) || compiler.sys.fileExists(filePath);
},
/*enabledCaching*/ false);
const watchHost = {
rootFiles: getRootFileNames(),
options: compilerOptions,
useCaseSensitiveFileNames,
getNewLine,
getCurrentDirectory,
getDefaultLibFileName,
fileExists,
readFile: readFileWithCachingText,
directoryExists,
getDirectories,
readDirectory,
realpath,
trace,
watchFile: (fileName, callback, pollingInterval, options) => {
var _a;
const outputFileAndKey = (_a = instance.solutionBuilderHost) === null || _a === void 0 ? void 0 : _a.getOutputFileAndKeyFromReferencedProject(fileName);
if (!outputFileAndKey ||
outputFileAndKey.key === filePathKeyMapper(fileName)) {
return watchFile(fileName, callback, pollingInterval, options);
}
// Handle symlink to outputFile
const outputFileName = instance.solutionBuilderHost.realpath(fileName);
const watcher = watchFile(outputFileName, (_fileName, eventKind) => callback(fileName, eventKind), pollingInterval, options);
return { close: () => watcher.close() };
},
watchDirectory,
// used for (/// <reference types="...">) see https://github.com/Realytics/fork-ts-checker-webpack-plugin/pull/250#issuecomment-485061329
resolveTypeReferenceDirectives,
resolveModuleNames,
invokeFileWatcher,
updateRootFileNames: () => {
instance.changedFilesList = false;
if (instance.watchOfFilesAndCompilerOptions !== undefined) {
instance.watchOfFilesAndCompilerOptions.updateRootFileNames(getRootFileNames());
}
},
createProgram: projectReferences === undefined
? compiler.createEmitAndSemanticDiagnosticsBuilderProgram
: createBuilderProgramWithReferences,
outputFiles: new Map(),
};
return watchHost;
function getRootFileNames() {
return [...files.values()]
.map(({ fileName }) => fileName)
.filter(filePath => filePath.match(scriptRegex));
}
function readFileWithCachingText(fileName, encoding) {
var _a;
fileName = path.normalize(fileName);
const key = filePathKeyMapper(fileName);
const file = files.get(key) || otherFiles.get(key);
if (file !== undefined) {
return file.text;
}
const text = readFile(fileName, encoding);
if (text === undefined) {
return undefined;
}
if (!((_a = instance.solutionBuilderHost) === null || _a === void 0 ? void 0 : _a.getOutputFileKeyFromReferencedProject(fileName))) {
otherFiles.set(key, { fileName, version: 0, text });
}
return text;
}
function createBuilderProgramWithReferences(rootNames, options, host, oldProgram, configFileParsingDiagnostics) {
const program = compiler.createProgram({
rootNames: rootNames,
options: options,
host,
oldProgram: oldProgram && oldProgram.getProgram(),
configFileParsingDiagnostics,
projectReferences,
});
const builderProgramHost = host;
return compiler.createEmitAndSemanticDiagnosticsBuilderProgram(program, builderProgramHost, oldProgram, configFileParsingDiagnostics);
}
}
exports.makeWatchHost = makeWatchHost;
function normalizeSlashes(file) {
return file.replace(/\\/g, '/');
}
/**
* Create the TypeScript Watch host
*/
function makeSolutionBuilderHost(scriptRegex, loader, instance) {
const { compiler, compilerOptions, appendTsTsxSuffixesIfRequired, loaderOptions: { resolveModuleName: customResolveModuleName, resolveTypeReferenceDirective: customResolveTypeReferenceDirective, transpileOnly, }, filePathKeyMapper, } = instance;
// loader.context seems to work fine on Linux / Mac regardless causes problems for @types resolution on Windows for TypeScript < 2.3
const getCurrentDirectory = () => loader.context;
const formatDiagnosticHost = {
getCurrentDirectory: compiler.sys.getCurrentDirectory,
getCanonicalFileName: utils_1.useCaseSensitiveFileNames(compiler, instance.loaderOptions)
? s => s
: s => s.toLowerCase(),
getNewLine: () => compiler.sys.newLine,
};
const diagnostics = {
global: [],
perFile: new Map(),
transpileErrors: [],
};
const reportDiagnostic = (d) => {
if (transpileOnly) {
const filePath = d.file ? filePathKeyMapper(d.file.fileName) : undefined;
const last = diagnostics.transpileErrors[diagnostics.transpileErrors.length - 1];
if (diagnostics.transpileErrors.length && last[0] === filePath) {
last[1].push(d);
}
else {
diagnostics.transpileErrors.push([filePath, [d]]);
}
}
else if (d.file) {
const filePath = filePathKeyMapper(d.file.fileName);
const existing = diagnostics.perFile.get(filePath);
if (existing) {
existing.push(d);
}
else {
diagnostics.perFile.set(filePath, [d]);
}
}
else {
diagnostics.global.push(d);
}
instance.log.logInfo(compiler.formatDiagnostic(d, formatDiagnosticHost));
};
const reportSolutionBuilderStatus = (d) => instance.log.logInfo(compiler.formatDiagnostic(d, formatDiagnosticHost));
const reportWatchStatus = (d, newLine, _options) => instance.log.logInfo(`${compiler.flattenDiagnosticMessageText(d.messageText, compiler.sys.newLine)}${newLine + newLine}`);
const outputFiles = new Map();
const writtenFiles = [];
const outputAffectingInstanceVersion = new Map();
let timeoutId;
const symlinkedDirectories = new Map();
const symlinkedFiles = new Map();
const cachedSys = {
fileExists: fileName => compiler.sys.fileExists(fileName),
directoryExists: directory => compiler.sys.directoryExists(directory),
realpath: compiler.sys.realpath && (path => compiler.sys.realpath(path)),
};
addCache(cachedSys);
const configFileInfo = new Map();
const solutionBuilderHost = Object.assign(Object.assign(Object.assign(Object.assign({}, compiler.createSolutionBuilderWithWatchHost(compiler.sys, compiler.createEmitAndSemanticDiagnosticsBuilderProgram, reportDiagnostic, reportSolutionBuilderStatus, reportWatchStatus)), { useCaseSensitiveFileNames: () => utils_1.useCaseSensitiveFileNames(compiler, instance.loaderOptions), diagnostics }), createWatchFactory(filePathKeyMapper, compiler)), {
// Overrides
getCurrentDirectory,
// behave as if there is no tsbuild info on disk since we want to generate all outputs in memory and only use those
readFile: (fileName, encoding) => {
const outputFile = ensureOutputFile(fileName);
return outputFile !== undefined
? outputFile
? outputFile.text
: undefined
: readInputFile(fileName, encoding).text;
}, writeFile: (name, text, writeByteOrderMark) => {
const key = filePathKeyMapper(name);
updateFileWithText(instance, key, name, () => text);
const existing = outputFiles.get(key);
const newOutputFile = {
name,
text,
writeByteOrderMark: !!writeByteOrderMark,
time: new Date(),
version: existing
? existing.text !== text
? existing.version + 1
: existing.version
: 0,
};
outputFiles.set(key, newOutputFile);
writtenFiles.push(newOutputFile);
if (outputAffectingInstanceVersion.has(key) &&
(!existing || existing.text !== text)) {
instance.version++;
}
if (instance.watchHost &&
!instance.files.has(key) &&
!instance.otherFiles.has(key)) {
// If file wasnt updated in files or other files of instance, let watch host know of the change
if (!existing) {
instance.hasUnaccountedModifiedFiles =
instance.watchHost.invokeFileWatcher(name, compiler.FileWatcherEventKind.Created) || instance.hasUnaccountedModifiedFiles;
}
else if (existing.version !== newOutputFile.version) {
instance.hasUnaccountedModifiedFiles =
instance.watchHost.invokeFileWatcher(name, compiler.FileWatcherEventKind.Changed) || instance.hasUnaccountedModifiedFiles;
}
}
compiler.sys.writeFile(name, text, writeByteOrderMark);
}, getModifiedTime: fileName => {
const outputFile = ensureOutputFile(fileName);
if (outputFile !== undefined) {
return outputFile ? outputFile.time : undefined;
}
const key = filePathKeyMapper(fileName);
const existing = instance.files.get(key) || instance.otherFiles.get(key);
return existing
? existing.modifiedTime
: compiler.sys.getModifiedTime(fileName);
}, setModifiedTime: (fileName, time) => {
const outputFile = ensureOutputFile(fileName);
if (outputFile !== undefined) {
if (outputFile) {
outputFile.time = time;
}
}
compiler.sys.setModifiedTime(fileName, time);
const key = filePathKeyMapper(fileName);
const existing = instance.files.get(key) || instance.otherFiles.get(key);
if (existing) {
existing.modifiedTime = time;
}
}, fileExists: fileName => {
const outputFile = ensureOutputFile(fileName);
if (outputFile !== undefined) {
return !!outputFile;
}
const key = filePathKeyMapper(fileName);
const existing = instance.files.get(key) || instance.otherFiles.get(key);
return existing
? existing.text !== undefined
: cachedSys.fileExists(fileName);
}, directoryExists: directory => {
if (cachedSys.directoryExists(directory)) {
return true;
}
const resolvedDirectory = trailingDirectorySeparatorPathKey(directory);
for (const outputFile of outputFiles.keys()) {
if (normalizeSlashes(outputFile).startsWith(resolvedDirectory)) {
return true;
}
}
// see if this is symlink to in memory files's directory
const ancestor = findExistingAncestor(directory);
const ancestorRealpath = getRealpathOfExistingDirectory(ancestor);
return ancestorRealpath
? solutionBuilderHost.directoryExists(path.resolve(ancestorRealpath, path.relative(ancestor, directory)))
: false;
}, getDirectories: directory => cachedSys.directoryExists(directory)
? compiler.sys.getDirectories(directory)
: [], readDirectory: (path, extensions, exclude, include, depth) => cachedSys.directoryExists(path)
? compiler.sys.readDirectory(path, extensions, exclude, include, depth)
: [], realpath: cachedSys.realpath && (file => getRealpathOfFile(file) || file), afterProgramEmitAndDiagnostics: transpileOnly ? undefined : storeDtsFiles, setTimeout: (callback, _time, ...args) => {
timeoutId = [callback, args];
return timeoutId;
}, clearTimeout: _timeoutId => {
timeoutId = undefined;
}, writtenFiles,
configFileInfo,
outputAffectingInstanceVersion,
getOutputFileKeyFromReferencedProject,
getOutputFileFromReferencedProject,
getOutputFileAndKeyFromReferencedProject, getInputFileNameFromOutput: fileName => {
const result = getInputFileNameFromOutput(fileName);
return typeof result === 'string' ? result : undefined;
}, getOutputFilesFromReferencedProjectInput,
buildReferences,
clearCache });
solutionBuilderHost.trace = logData => instance.log.logInfo(logData);
solutionBuilderHost.getParsedCommandLine = file => {
const config = config_1.getParsedCommandLine(compiler, instance.loaderOptions, file);
configFileInfo.set(filePathKeyMapper(file), { config });
return config;
};
// make a (sync) resolver that follows webpack's rules
const resolveSync = resolver_1.makeResolver(loader._compiler.options);
const resolvers = makeResolvers(compiler, compilerOptions, solutionBuilderHost, customResolveTypeReferenceDirective, customResolveModuleName, resolveSync, appendTsTsxSuffixesIfRequired, scriptRegex, instance);
// used for (/// <reference types="...">) see https://github.com/Realytics/fork-ts-checker-webpack-plugin/pull/250#issuecomment-485061329
solutionBuilderHost.resolveTypeReferenceDirectives =
resolvers.resolveTypeReferenceDirectives;
solutionBuilderHost.resolveModuleNames = resolvers.resolveModuleNames;
return solutionBuilderHost;
function trailingDirectorySeparatorPathKey(directory) {
return utils_1.ensureTrailingDirectorySeparator(normalizeSlashes(filePathKeyMapper(directory)));
}
function clearCache() {
cachedSys.clearCache();
symlinkedDirectories.clear();
symlinkedFiles.clear();
}
function findExistingAncestor(fileOrDirectory) {
let ancestor = path.dirname(fileOrDirectory);
while (ancestor !== path.dirname(ancestor)) {
if (cachedSys.directoryExists(ancestor))
return ancestor;
ancestor = path.dirname(ancestor);
}
// Root should always be present
return ancestor;
}
function getRealpathOfExistingDirectory(directory) {
return getRealpath(directory, symlinkedDirectories, () => cachedSys.realpath(directory));
}
function getRealpathOfFile(file) {
return getRealpath(file, symlinkedFiles, () => {
if (cachedSys.fileExists(file))
return cachedSys.realpath(file);
// see if this is symlink to in memory file
const ancestor = findExistingAncestor(file);
const ancestorRealpath = getRealpathOfExistingDirectory(ancestor);
if (!ancestorRealpath)
return file;
const newFile = path.resolve(ancestorRealpath, path.relative(ancestor, file));
return getRealpathOfFile(newFile) || newFile;
});
}
function getRealpath(fileOrDirectory, symlinked, realpath) {
if (!cachedSys.realpath)
return undefined;
const fileOrDirectoryKey = filePathKeyMapper(fileOrDirectory);
const existing = symlinked.get(fileOrDirectoryKey);
if (existing !== undefined)
return existing || undefined;
const real = realpath();
if (real === fileOrDirectory ||
filePathKeyMapper(real) === fileOrDirectoryKey) {
// not symlinked
symlinked.set(fileOrDirectoryKey, false);
return undefined;
}
symlinked.set(fileOrDirectoryKey, real);
return real;
}
function buildReferences() {
if (!timeoutId) {
return;
}
diagnostics.global.length = 0;
diagnostics.perFile.clear();
diagnostics.transpileErrors.length = 0;
while (timeoutId) {
const [callback, args] = timeoutId;
timeoutId = undefined;
callback(...args);
}
}
function storeDtsFiles(builderProgram) {
const program = builderProgram.getProgram();
for (const configInfo of configFileInfo.values()) {
if (!configInfo.config ||
program.getRootFileNames() !== configInfo.config.fileNames ||
program.getCompilerOptions() !== configInfo.config.options ||
program.getProjectReferences() !== configInfo.config.projectReferences) {
continue;
}
configInfo.dtsFiles = program
.getSourceFiles()
.map(file => path.resolve(file.fileName))
.filter(fileName => fileName.match(constants.dtsDtsxOrDtsDtsxMapRegex));
return;
}
}
function getInputFileNameFromOutput(outputFileName) {
const resolvedFileName = filePathKeyMapper(outputFileName);
for (const configInfo of configFileInfo.values()) {
ensureInputOutputInfo(configInfo);
if (configInfo.outputFileNames) {
for (const { inputFileName, outputNames, } of configInfo.outputFileNames.values()) {
if (outputNames.indexOf(resolvedFileName) !== -1) {
return inputFileName;
}
}
}
if (configInfo.tsbuildInfoFile &&
filePathKeyMapper(configInfo.tsbuildInfoFile) === resolvedFileName) {
return true;
}
}
const symlinkedOutputFileName = getRealpathOfFile(outputFileName);
return symlinkedOutputFileName
? getInputFileNameFromOutput(symlinkedOutputFileName)
: undefined;
}
function ensureInputOutputInfo(configInfo) {
if (configInfo.outputFileNames || !configInfo.config) {
return;
}
configInfo.outputFileNames = new Map();
configInfo.config.fileNames.forEach(inputFile => configInfo.outputFileNames.set(filePathKeyMapper(inputFile), {
inputFileName: path.resolve(inputFile),
outputNames: instances_1.getOutputFileNames(instance, configInfo.config, inputFile).map(filePathKeyMapper),
}));
configInfo.tsbuildInfoFile = instance.compiler
.getTsBuildInfoEmitOutputFilePath
? instance.compiler.getTsBuildInfoEmitOutputFilePath(configInfo.config.options)
: // before api
instance.compiler.getOutputPathForBuildInfo(configInfo.config.options);
}
function getOutputFileAndKeyFromReferencedProject(outputFileName) {
const key = getOutputFileKeyFromReferencedProject(outputFileName);
return key && { key, outputFile: outputFiles.get(key) };
}
function getOutputFileFromReferencedProject(outputFileName) {
const key = getOutputFileKeyFromReferencedProject(outputFileName);
return key && outputFiles.get(key);
}
function getOutputFileKeyFromReferencedProject(outputFileName) {
const key = filePathKeyMapper(outputFileName);
const result = outputFiles.has(key);
if (result)
return key;
const symlinkedOutputFileName = getRealpathOfFile(outputFileName);
return symlinkedOutputFileName
? getOutputFileKeyFromReferencedProject(symlinkedOutputFileName)
: undefined;
}
function ensureOutputFile(outputFileName, encoding) {
const outputFile = getOutputFileFromReferencedProject(outputFileName);
if (outputFile !== undefined) {
return outputFile;
}
if (!getInputFileNameFromOutput(outputFileName)) {
return undefined;
}
outputFileName = getRealpathOfFile(outputFileName) || outputFileName;
const key = filePathKeyMapper(outputFileName);
const text = compiler.sys.readFile(outputFileName, encoding);
if (text === undefined) {
outputFiles.set(key, false);
return false;
}
const newOutputFile = {
name: outputFileName,
text,
writeByteOrderMark: false,
time: compiler.sys.getModifiedTime(outputFileName),
version: 0,
};
outputFiles.set(key, newOutputFile);
return newOutputFile;
}
function getOutputFilesFromReferencedProjectInput(inputFileName) {
const resolvedFileName = filePathKeyMapper(inputFileName);
for (const configInfo of configFileInfo.values()) {
ensureInputOutputInfo(configInfo);
if (configInfo.outputFileNames) {
const result = configInfo.outputFileNames.get(resolvedFileName);
if (result) {
return result.outputNames
.map(outputFile => outputFiles.get(outputFile))
.filter(output => !!output);
}
}
}
return [];
}
function readInputFile(inputFileName, encoding) {
const resolvedFileName = filePathKeyMapper(inputFileName);
const existing = instance.otherFiles.get(resolvedFileName);
if (existing) {
return existing;
}
inputFileName = path.resolve(inputFileName);
const tsFile = {
fileName: inputFileName,
version: 1,
text: compiler.sys.readFile(inputFileName, encoding),
modifiedTime: compiler.sys.getModifiedTime(inputFileName),
};
instance.otherFiles.set(resolvedFileName, tsFile);
return tsFile;
}
}
exports.makeSolutionBuilderHost = makeSolutionBuilderHost;
function getSolutionErrors(instance, context) {
const solutionErrors = [];
if (instance.solutionBuilderHost &&
instance.solutionBuilderHost.diagnostics.transpileErrors.length) {
instance.solutionBuilderHost.diagnostics.transpileErrors.forEach(([filePath, errors]) => solutionErrors.push(...utils_1.formatErrors(errors, instance.loaderOptions, instance.colors, instance.compiler, { file: filePath ? undefined : 'tsconfig.json' }, context)));
}
return solutionErrors;
}
exports.getSolutionErrors = getSolutionErrors;
function makeResolveTypeReferenceDirective(compiler, compilerOptions, moduleResolutionHost, customResolveTypeReferenceDirective) {
if (customResolveTypeReferenceDirective === undefined) {
return (directive, containingFile, redirectedReference) => compiler.resolveTypeReferenceDirective(directive, containingFile, compilerOptions, moduleResolutionHost, redirectedReference);
}
return (directive, containingFile) => customResolveTypeReferenceDirective(directive, containingFile, compilerOptions, moduleResolutionHost, compiler.resolveTypeReferenceDirective);
}
function isJsImplementationOfTypings(resolvedModule, tsResolution) {
return (resolvedModule.resolvedFileName.endsWith('js') &&
/\.d\.ts$/.test(tsResolution.resolvedFileName));
}
function resolveModule(resolveSync, resolveModuleName, appendTsTsxSuffixesIfRequired, scriptRegex, moduleName, containingFile) {
let resolutionResult;
try {
const originalFileName = resolveSync(undefined, path.normalize(path.dirname(containingFile)), moduleName);
const resolvedFileName = appendTsTsxSuffixesIfRequired(originalFileName);
if (resolvedFileName.match(scriptRegex) !== null) {
resolutionResult = { resolvedFileName, originalFileName };
}
}
catch (e) { }
const tsResolution = resolveModuleName(moduleName, containingFile);
if (tsResolution.resolvedModule !== undefined) {
const resolvedFileName = path.normalize(tsResolution.resolvedModule.resolvedFileName);
const tsResolutionResult = {
originalFileName: resolvedFileName,
resolvedFileName,
isExternalLibraryImport: tsResolution.resolvedModule.isExternalLibraryImport,
};
return resolutionResult === undefined ||
resolutionResult.resolvedFileName ===
tsResolutionResult.resolvedFileName ||
isJsImplementationOfTypings(resolutionResult, tsResolutionResult)
? tsResolutionResult
: resolutionResult;
}
return resolutionResult;
}
function makeResolveModuleName(compiler, compilerOptions, moduleResolutionHost, customResolveModuleName) {
if (customResolveModuleName === undefined) {
return (moduleName, containingFile) => compiler.resolveModuleName(moduleName, containingFile, compilerOptions, moduleResolutionHost);
}
return (moduleName, containingFile) => customResolveModuleName(moduleName, containingFile, compilerOptions, moduleResolutionHost, compiler.resolveModuleName);
}
function addCache(host) {
const clearCacheFunctions = [];
host.fileExists = createCache(host.fileExists);
host.directoryExists = createCache(host.directoryExists);
host.realpath = host.realpath && createCache(host.realpath);
host.clearCache = () => clearCacheFunctions.forEach(clear => clear());
function createCache(originalFunction) {
const cache = new Map();
clearCacheFunctions.push(() => cache.clear());
return function getCached(arg) {
let res = cache.get(arg);
if (res !== undefined) {
return res;
}
res = originalFunction(arg);
cache.set(arg, res);
return res;
};
}
}
//# sourceMappingURL=servicesHost.js.map

1
node_modules/ts-loader/dist/stringify-loader.d.ts generated vendored Normal file
View file

@ -0,0 +1 @@
//# sourceMappingURL=stringify-loader.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"stringify-loader.d.ts","sourceRoot":"","sources":["../src/stringify-loader.ts"],"names":[],"mappings":""}

3
node_modules/ts-loader/dist/stringify-loader.js generated vendored Normal file
View file

@ -0,0 +1,3 @@
"use strict";
module.exports = (source) => JSON.stringify(source);
//# sourceMappingURL=stringify-loader.js.map

34
node_modules/ts-loader/dist/utils.d.ts generated vendored Normal file
View file

@ -0,0 +1,34 @@
import { Chalk } from 'chalk';
import * as typescript from 'typescript';
import { FilePathKey, LoaderOptions, ResolvedModule, ReverseDependencyGraph, TSInstance, WebpackError, WebpackModule } from './interfaces';
/**
* Take TypeScript errors, parse them and format to webpack errors
* Optionally adds a file name
*/
export declare function formatErrors(diagnostics: ReadonlyArray<typescript.Diagnostic> | undefined, loaderOptions: LoaderOptions, colors: Chalk, compiler: typeof typescript, merge: {
file?: string;
module?: WebpackModule;
}, context: string): WebpackError[];
export declare function fsReadFile(fileName: string, encoding?: string | undefined): string | undefined;
export declare function makeError(message: string, file: string | undefined, location?: {
line: number;
character: number;
}): WebpackError;
export declare function appendSuffixIfMatch(patterns: RegExp[], filePath: string, suffix: string): string;
export declare function appendSuffixesIfMatch(suffixDict: {
[suffix: string]: RegExp[];
}, filePath: string): string;
export declare function unorderedRemoveItem<T>(array: T[], item: T): boolean;
export declare function populateDependencyGraph(resolvedModules: ResolvedModule[], instance: TSInstance, containingFile: string): void;
export declare function populateReverseDependencyGraph(instance: TSInstance): ReverseDependencyGraph;
/**
* Recursively collect all possible dependants of passed file
*/
export declare function collectAllDependants(reverseDependencyGraph: ReverseDependencyGraph, fileName: FilePathKey, result?: Map<FilePathKey, true>): Map<FilePathKey, true>;
export declare function arrify<T>(val: T | T[]): T[];
export declare function ensureTrailingDirectorySeparator<T extends string>(dir: T): T;
export declare function ensureProgram(instance: TSInstance): typescript.Program | undefined;
export declare function supportsSolutionBuild(instance: TSInstance): boolean;
export declare function isReferencedFile(instance: TSInstance, filePath: string): boolean;
export declare function useCaseSensitiveFileNames(compiler: typeof typescript, loaderOptions: LoaderOptions): boolean;
//# sourceMappingURL=utils.d.ts.map

1
node_modules/ts-loader/dist/utils.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAI9B,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AAGzC,OAAO,EAEL,WAAW,EACX,aAAa,EACb,cAAc,EACd,sBAAsB,EAEtB,UAAU,EACV,YAAY,EACZ,aAAa,EACd,MAAM,cAAc,CAAC;AAqBtB;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,SAAS,EAC7D,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,KAAK,EACb,QAAQ,EAAE,OAAO,UAAU,EAC3B,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,aAAa,CAAA;CAAE,EAChD,OAAO,EAAE,MAAM,GACd,YAAY,EAAE,CA8DhB;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,MAAM,GAAG,SAAkB,sBAQtC;AAED,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,QAAQ,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC7C,YAAY,CAOd;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,MAAM,CASR;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,EAC1C,QAAQ,EAAE,MAAM,GACf,MAAM,CAMR;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAUnE;AAED,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,cAAc,EAAE,EACjC,QAAQ,EAAE,UAAU,EACpB,cAAc,EAAE,MAAM,QASvB;AAED,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,UAAU,0BAyBlE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,sBAAsB,EAAE,sBAAsB,EAC9C,QAAQ,EAAE,WAAW,EACrB,MAAM,GAAE,GAAG,CAAC,WAAW,EAAE,IAAI,CAAa,GACzC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAWxB;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,OAMrC;AAED,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAE5E;AAcD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,UAAU,kCAkBjD;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,UAAU,WAOzD;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAOtE;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,OAAO,UAAU,EAC3B,aAAa,EAAE,aAAa,WAK7B"}

223
node_modules/ts-loader/dist/utils.js generated vendored Normal file
View file

@ -0,0 +1,223 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useCaseSensitiveFileNames = exports.isReferencedFile = exports.supportsSolutionBuild = exports.ensureProgram = exports.ensureTrailingDirectorySeparator = exports.arrify = exports.collectAllDependants = exports.populateReverseDependencyGraph = exports.populateDependencyGraph = exports.unorderedRemoveItem = exports.appendSuffixesIfMatch = exports.appendSuffixIfMatch = exports.makeError = exports.fsReadFile = exports.formatErrors = void 0;
const fs = require("fs");
const micromatch = require("micromatch");
const path = require("path");
const constants = require("./constants");
const instances_1 = require("./instances");
/**
* The default error formatter.
*/
function defaultErrorFormatter(error, colors) {
const messageColor = error.severity === 'warning' ? colors.bold.yellow : colors.bold.red;
return (colors.grey('[tsl] ') +
messageColor(error.severity.toUpperCase()) +
(error.file === ''
? ''
: messageColor(' in ') +
colors.bold.cyan(`${error.file}(${error.line},${error.character})`)) +
constants.EOL +
messageColor(` TS${error.code}: ${error.content}`));
}
/**
* Take TypeScript errors, parse them and format to webpack errors
* Optionally adds a file name
*/
function formatErrors(diagnostics, loaderOptions, colors, compiler, merge, context) {
return diagnostics === undefined
? []
: diagnostics
.filter(diagnostic => {
if (loaderOptions.ignoreDiagnostics.indexOf(diagnostic.code) !== -1) {
return false;
}
if (loaderOptions.reportFiles.length > 0 &&
diagnostic.file !== undefined) {
const relativeFileName = path.relative(context, diagnostic.file.fileName);
const matchResult = micromatch([relativeFileName], loaderOptions.reportFiles);
if (matchResult.length === 0) {
return false;
}
}
return true;
})
.map(diagnostic => {
const file = diagnostic.file;
const position = file === undefined
? undefined
: file.getLineAndCharacterOfPosition(diagnostic.start);
const errorInfo = {
code: diagnostic.code,
severity: compiler.DiagnosticCategory[diagnostic.category].toLowerCase(),
content: compiler.flattenDiagnosticMessageText(diagnostic.messageText, constants.EOL),
file: file === undefined ? '' : path.normalize(file.fileName),
line: position === undefined ? 0 : position.line + 1,
character: position === undefined ? 0 : position.character + 1,
context,
};
const message = loaderOptions.errorFormatter === undefined
? defaultErrorFormatter(errorInfo, colors)
: loaderOptions.errorFormatter(errorInfo, colors);
const error = makeError(message, merge.file === undefined ? errorInfo.file : merge.file, position === undefined
? undefined
: { line: errorInfo.line, character: errorInfo.character });
return Object.assign(error, merge);
});
}
exports.formatErrors = formatErrors;
function fsReadFile(fileName, encoding = 'utf8') {
fileName = path.normalize(fileName);
try {
return fs.readFileSync(fileName, encoding);
}
catch (e) {
return undefined;
}
}
exports.fsReadFile = fsReadFile;
function makeError(message, file, location) {
return {
message,
location,
file,
loaderSource: 'ts-loader',
};
}
exports.makeError = makeError;
function appendSuffixIfMatch(patterns, filePath, suffix) {
if (patterns.length > 0) {
for (const regexp of patterns) {
if (filePath.match(regexp) !== null) {
return filePath + suffix;
}
}
}
return filePath;
}
exports.appendSuffixIfMatch = appendSuffixIfMatch;
function appendSuffixesIfMatch(suffixDict, filePath) {
let amendedPath = filePath;
for (const suffix in suffixDict) {
amendedPath = appendSuffixIfMatch(suffixDict[suffix], amendedPath, suffix);
}
return amendedPath;
}
exports.appendSuffixesIfMatch = appendSuffixesIfMatch;
function unorderedRemoveItem(array, item) {
for (let i = 0; i < array.length; i++) {
if (array[i] === item) {
// Fill in the "hole" left at `index`.
array[i] = array[array.length - 1];
array.pop();
return true;
}
}
return false;
}
exports.unorderedRemoveItem = unorderedRemoveItem;
function populateDependencyGraph(resolvedModules, instance, containingFile) {
resolvedModules = resolvedModules.filter(mod => mod !== null && mod !== undefined);
if (resolvedModules.length) {
const containingFileKey = instance.filePathKeyMapper(containingFile);
instance.dependencyGraph.set(containingFileKey, resolvedModules);
}
}
exports.populateDependencyGraph = populateDependencyGraph;
function populateReverseDependencyGraph(instance) {
const reverseDependencyGraph = new Map();
for (const [fileKey, resolvedModules] of instance.dependencyGraph.entries()) {
const inputFileName = instance.solutionBuilderHost &&
instances_1.getInputFileNameFromOutput(instance, fileKey);
const containingFileKey = inputFileName
? instance.filePathKeyMapper(inputFileName)
: fileKey;
resolvedModules.forEach(({ resolvedFileName }) => {
const key = instance.filePathKeyMapper(instance.solutionBuilderHost
? instances_1.getInputFileNameFromOutput(instance, resolvedFileName) ||
resolvedFileName
: resolvedFileName);
let map = reverseDependencyGraph.get(key);
if (!map) {
map = new Map();
reverseDependencyGraph.set(key, map);
}
map.set(containingFileKey, true);
});
}
return reverseDependencyGraph;
}
exports.populateReverseDependencyGraph = populateReverseDependencyGraph;
/**
* Recursively collect all possible dependants of passed file
*/
function collectAllDependants(reverseDependencyGraph, fileName, result = new Map()) {
result.set(fileName, true);
const dependants = reverseDependencyGraph.get(fileName);
if (dependants !== undefined) {
for (const dependantFileName of dependants.keys()) {
if (!result.has(dependantFileName)) {
collectAllDependants(reverseDependencyGraph, dependantFileName, result);
}
}
}
return result;
}
exports.collectAllDependants = collectAllDependants;
function arrify(val) {
if (val === null || val === undefined) {
return [];
}
return Array.isArray(val) ? val : [val];
}
exports.arrify = arrify;
function ensureTrailingDirectorySeparator(dir) {
return hasTrailingDirectorySeparator(dir) ? dir : (dir + '/');
}
exports.ensureTrailingDirectorySeparator = ensureTrailingDirectorySeparator;
function isAnyDirectorySeparator(charCode) {
return (charCode === 0x2f || charCode === 0x5c // /
); // \
}
function hasTrailingDirectorySeparator(dir) {
return (dir.length > 0 && isAnyDirectorySeparator(dir.charCodeAt(dir.length - 1)));
}
function ensureProgram(instance) {
if (instance && instance.watchHost) {
if (instance.hasUnaccountedModifiedFiles) {
if (instance.changedFilesList) {
instance.watchHost.updateRootFileNames();
}
if (instance.watchOfFilesAndCompilerOptions) {
instance.builderProgram = instance.watchOfFilesAndCompilerOptions.getProgram();
instance.program = instance.builderProgram.getProgram();
}
instance.hasUnaccountedModifiedFiles = false;
}
return instance.program;
}
if (instance.languageService) {
return instance.languageService.getProgram();
}
return instance.program;
}
exports.ensureProgram = ensureProgram;
function supportsSolutionBuild(instance) {
return (!!instance.configFilePath &&
!!instance.loaderOptions.projectReferences &&
!!instance.configParseResult.projectReferences &&
!!instance.configParseResult.projectReferences.length);
}
exports.supportsSolutionBuild = supportsSolutionBuild;
function isReferencedFile(instance, filePath) {
return (!!instance.solutionBuilderHost &&
!!instance.solutionBuilderHost.watchedFiles.get(instance.filePathKeyMapper(filePath)));
}
exports.isReferencedFile = isReferencedFile;
function useCaseSensitiveFileNames(compiler, loaderOptions) {
return loaderOptions.useCaseSensitiveFileNames !== undefined
? loaderOptions.useCaseSensitiveFileNames
: compiler.sys.useCaseSensitiveFileNames;
}
exports.useCaseSensitiveFileNames = useCaseSensitiveFileNames;
//# sourceMappingURL=utils.js.map

7
node_modules/ts-loader/dist/watch-run.d.ts generated vendored Normal file
View file

@ -0,0 +1,7 @@
import * as webpack from 'webpack';
import { TSInstance } from './interfaces';
/**
* Make function which will manually update changed files
*/
export declare function makeWatchRun(instance: TSInstance, loader: webpack.loader.LoaderContext): (compiler: webpack.Compiler, callback: (err?: Error | undefined) => void) => void;
//# sourceMappingURL=watch-run.d.ts.map

1
node_modules/ts-loader/dist/watch-run.d.ts.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"watch-run.d.ts","sourceRoot":"","sources":["../src/watch-run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAe,UAAU,EAAE,MAAM,cAAc,CAAC;AAIvD;;GAEG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,cASlB,OAAO,CAAC,QAAQ,yCAA6B,IAAI,UAiDpE"}

87
node_modules/ts-loader/dist/watch-run.js generated vendored Normal file
View file

@ -0,0 +1,87 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeWatchRun = void 0;
const path = require("path");
const constants = require("./constants");
const servicesHost_1 = require("./servicesHost");
const utils_1 = require("./utils");
/**
* Make function which will manually update changed files
*/
function makeWatchRun(instance, loader) {
// Called Before starting compilation after watch
const lastTimes = new Map();
const startTime = 0;
// Save the loader index.
const loaderIndex = loader.loaderIndex;
return (compiler, callback) => {
var _a, _b, _c;
(_b = (_a = instance.servicesHost) === null || _a === void 0 ? void 0 : _a.clearCache) === null || _b === void 0 ? void 0 : _b.call(_a);
(_c = instance.solutionBuilderHost) === null || _c === void 0 ? void 0 : _c.clearCache();
const promises = [];
if (instance.loaderOptions.transpileOnly) {
instance.reportTranspileErrors = true;
}
else {
const times = compiler.fileTimestamps;
for (const [filePath, date] of times) {
const key = instance.filePathKeyMapper(filePath);
const lastTime = lastTimes.get(key) || startTime;
if (date <= lastTime) {
continue;
}
lastTimes.set(key, date);
promises.push(updateFile(instance, key, filePath, loader, loaderIndex));
}
// On watch update add all known dts files expect the ones in node_modules
// (skip @types/* and modules with typings)
for (const [key, { fileName }] of instance.files.entries()) {
if (fileName.match(constants.dtsDtsxOrDtsDtsxMapRegex) !== null &&
fileName.match(constants.nodeModules) === null) {
promises.push(updateFile(instance, key, fileName, loader, loaderIndex));
}
}
}
// Update all the watched files from solution builder
if (instance.solutionBuilderHost) {
for (const [key, { fileName },] of instance.solutionBuilderHost.watchedFiles.entries()) {
promises.push(updateFile(instance, key, fileName, loader, loaderIndex));
}
}
Promise.all(promises)
.then(() => callback())
.catch(err => callback(err));
};
}
exports.makeWatchRun = makeWatchRun;
function updateFile(instance, key, filePath, loader, loaderIndex) {
return new Promise((resolve, reject) => {
// When other loaders are specified after ts-loader
// (e.g. `{ test: /\.ts$/, use: ['ts-loader', 'other-loader'] }`),
// manually apply them to TypeScript files.
// Otherwise, files not 'preprocessed' by them may cause complication errors (#1111).
if (loaderIndex + 1 < loader.loaders.length &&
instance.rootFileNames.has(path.normalize(filePath))) {
let request = `!!${path.resolve(__dirname, 'stringify-loader.js')}!`;
for (let i = loaderIndex + 1; i < loader.loaders.length; ++i) {
request += loader.loaders[i].request + '!';
}
request += filePath;
loader.loadModule(request, (err, source) => {
if (err) {
reject(err);
}
else {
const text = JSON.parse(source);
servicesHost_1.updateFileWithText(instance, key, filePath, () => text);
resolve();
}
});
}
else {
servicesHost_1.updateFileWithText(instance, key, filePath, nFilePath => utils_1.fsReadFile(nFilePath) || '');
resolve();
}
});
}
//# sourceMappingURL=watch-run.js.map

3
node_modules/ts-loader/index.js generated vendored Normal file
View file

@ -0,0 +1,3 @@
var loader = require('./dist');
module.exports = loader;

1
node_modules/ts-loader/node_modules/.bin/semver generated vendored Symbolic link
View file

@ -0,0 +1 @@
../semver/bin/semver.js

View file

@ -0,0 +1,70 @@
# changes log
## 6.2.0
* Coerce numbers to strings when passed to semver.coerce()
* Add `rtl` option to coerce from right to left
## 6.1.3
* Handle X-ranges properly in includePrerelease mode
## 6.1.2
* Do not throw when testing invalid version strings
## 6.1.1
* Add options support for semver.coerce()
* Handle undefined version passed to Range.test
## 6.1.0
* Add semver.compareBuild function
* Support `*` in semver.intersects
## 6.0
* Fix `intersects` logic.
This is technically a bug fix, but since it is also a change to behavior
that may require users updating their code, it is marked as a major
version increment.
## 5.7
* Add `minVersion` method
## 5.6
* Move boolean `loose` param to an options object, with
backwards-compatibility protection.
* Add ability to opt out of special prerelease version handling with
the `includePrerelease` option flag.
## 5.5
* Add version coercion capabilities
## 5.4
* Add intersection checking
## 5.3
* Add `minSatisfying` method
## 5.2
* Add `prerelease(v)` that returns prerelease components
## 5.1
* Add Backus-Naur for ranges
* Remove excessively cute inspection methods
## 5.0
* Remove AMD/Browserified build artifacts
* Fix ltr and gtr when using the `*` range
* Fix for range `*` with a prerelease identifier

15
node_modules/ts-loader/node_modules/semver/LICENSE generated vendored Normal file
View file

@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

443
node_modules/ts-loader/node_modules/semver/README.md generated vendored Normal file
View file

@ -0,0 +1,443 @@
semver(1) -- The semantic versioner for npm
===========================================
## Install
```bash
npm install semver
````
## Usage
As a node module:
```js
const semver = require('semver')
semver.valid('1.2.3') // '1.2.3'
semver.valid('a.b.c') // null
semver.clean(' =v1.2.3 ') // '1.2.3'
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
semver.gt('1.2.3', '9.8.7') // false
semver.lt('1.2.3', '9.8.7') // true
semver.minVersion('>=1.0.0') // '1.0.0'
semver.valid(semver.coerce('v2')) // '2.0.0'
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
```
As a command-line utility:
```
$ semver -h
A JavaScript implementation of the https://semver.org/ specification
Copyright Isaac Z. Schlueter
Usage: semver [options] <version> [<version> [...]]
Prints valid versions sorted by SemVer precedence
Options:
-r --range <range>
Print versions that match the specified range.
-i --increment [<level>]
Increment a version by the specified level. Level can
be one of: major, minor, patch, premajor, preminor,
prepatch, or prerelease. Default level is 'patch'.
Only one version may be specified.
--preid <identifier>
Identifier to be used to prefix premajor, preminor,
prepatch or prerelease version increments.
-l --loose
Interpret versions and ranges loosely
-p --include-prerelease
Always include prerelease versions in range matching
-c --coerce
Coerce a string into SemVer if possible
(does not imply --loose)
--rtl
Coerce version strings right to left
--ltr
Coerce version strings left to right (default)
Program exits successfully if any valid version satisfies
all supplied ranges, and prints all satisfying versions.
If no satisfying versions are found, then exits failure.
Versions are printed in ascending order, so supplying
multiple versions to the utility will just sort them.
```
## Versions
A "version" is described by the `v2.0.0` specification found at
<https://semver.org/>.
A leading `"="` or `"v"` character is stripped off and ignored.
## Ranges
A `version range` is a set of `comparators` which specify versions
that satisfy the range.
A `comparator` is composed of an `operator` and a `version`. The set
of primitive `operators` is:
* `<` Less than
* `<=` Less than or equal to
* `>` Greater than
* `>=` Greater than or equal to
* `=` Equal. If no operator is specified, then equality is assumed,
so this operator is optional, but MAY be included.
For example, the comparator `>=1.2.7` would match the versions
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
or `1.1.0`.
Comparators can be joined by whitespace to form a `comparator set`,
which is satisfied by the **intersection** of all of the comparators
it includes.
A range is composed of one or more comparator sets, joined by `||`. A
version matches a range if and only if every comparator in at least
one of the `||`-separated comparator sets is satisfied by the version.
For example, the range `>=1.2.7 <1.3.0` would match the versions
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
or `1.1.0`.
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
### Prerelease Tags
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
it will only be allowed to satisfy comparator sets if at least one
comparator with the same `[major, minor, patch]` tuple also has a
prerelease tag.
For example, the range `>1.2.3-alpha.3` would be allowed to match the
version `1.2.3-alpha.7`, but it would *not* be satisfied by
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
range only accepts prerelease tags on the `1.2.3` version. The
version `3.4.5` *would* satisfy the range, because it does not have a
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
The purpose for this behavior is twofold. First, prerelease versions
frequently are updated very quickly, and contain many breaking changes
that are (by the author's design) not yet fit for public consumption.
Therefore, by default, they are excluded from range matching
semantics.
Second, a user who has opted into using a prerelease version has
clearly indicated the intent to use *that specific* set of
alpha/beta/rc versions. By including a prerelease tag in the range,
the user is indicating that they are aware of the risk. However, it
is still not appropriate to assume that they have opted into taking a
similar risk on the *next* set of prerelease versions.
Note that this behavior can be suppressed (treating all prerelease
versions as if they were normal versions, for the purpose of range
matching) by setting the `includePrerelease` flag on the options
object to any
[functions](https://github.com/npm/node-semver#functions) that do
range matching.
#### Prerelease Identifiers
The method `.inc` takes an additional `identifier` string argument that
will append the value of the string as a prerelease identifier:
```javascript
semver.inc('1.2.3', 'prerelease', 'beta')
// '1.2.4-beta.0'
```
command-line example:
```bash
$ semver 1.2.3 -i prerelease --preid beta
1.2.4-beta.0
```
Which then can be used to increment further:
```bash
$ semver 1.2.4-beta.0 -i prerelease
1.2.4-beta.1
```
### Advanced Range Syntax
Advanced range syntax desugars to primitive comparators in
deterministic ways.
Advanced ranges may be combined in the same way as primitive
comparators using white space or `||`.
#### Hyphen Ranges `X.Y.Z - A.B.C`
Specifies an inclusive set.
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
If a partial version is provided as the first version in the inclusive
range, then the missing pieces are replaced with zeroes.
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
If a partial version is provided as the second version in the
inclusive range, then all versions that start with the supplied parts
of the tuple are accepted, but nothing that would be greater than the
provided tuple parts.
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
* `1.2.3 - 2` := `>=1.2.3 <3.0.0`
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
numeric values in the `[major, minor, patch]` tuple.
* `*` := `>=0.0.0` (Any version satisfies)
* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
A partial version range is treated as an X-Range, so the special
character is in fact optional.
* `""` (empty string) := `*` := `>=0.0.0`
* `1` := `1.x.x` := `>=1.0.0 <2.0.0`
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
Allows patch-level changes if a minor version is specified on the
comparator. Allows minor-level changes if not.
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in
the `1.2.3` version will be allowed, if they are greater than or
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
`1.2.4-beta.2` would not, because it is a prerelease of a
different `[major, minor, patch]` tuple.
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
Allows changes that do not modify the left-most non-zero element in the
`[major, minor, patch]` tuple. In other words, this allows patch and
minor updates for versions `1.0.0` and above, patch updates for
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
Many authors treat a `0.x` version as if the `x` were the major
"breaking-change" indicator.
Caret ranges are ideal when an author may make breaking changes
between `0.2.4` and `0.3.0` releases, which is a common practice.
However, it presumes that there will *not* be breaking changes between
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
additive (but non-breaking), according to commonly observed practices.
* `^1.2.3` := `>=1.2.3 <2.0.0`
* `^0.2.3` := `>=0.2.3 <0.3.0`
* `^0.0.3` := `>=0.0.3 <0.0.4`
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in
the `1.2.3` version will be allowed, if they are greater than or
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
`1.2.4-beta.2` would not, because it is a prerelease of a
different `[major, minor, patch]` tuple.
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the
`0.0.3` version *only* will be allowed, if they are greater than or
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
When parsing caret ranges, a missing `patch` value desugars to the
number `0`, but will allow flexibility within that value, even if the
major and minor versions are both `0`.
* `^1.2.x` := `>=1.2.0 <2.0.0`
* `^0.0.x` := `>=0.0.0 <0.1.0`
* `^0.0` := `>=0.0.0 <0.1.0`
A missing `minor` and `patch` values will desugar to zero, but also
allow flexibility within those values, even if the major version is
zero.
* `^1.x` := `>=1.0.0 <2.0.0`
* `^0.x` := `>=0.0.0 <1.0.0`
### Range Grammar
Putting all this together, here is a Backus-Naur grammar for ranges,
for the benefit of parser authors:
```bnf
range-set ::= range ( logical-or range ) *
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
range ::= hyphen | simple ( ' ' simple ) * | ''
hyphen ::= partial ' - ' partial
simple ::= primitive | partial | tilde | caret
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
xr ::= 'x' | 'X' | '*' | nr
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
tilde ::= '~' partial
caret ::= '^' partial
qualifier ::= ( '-' pre )? ( '+' build )?
pre ::= parts
build ::= parts
parts ::= part ( '.' part ) *
part ::= nr | [-0-9A-Za-z]+
```
## Functions
All methods and classes take a final `options` object argument. All
options in this object are `false` by default. The options supported
are:
- `loose` Be more forgiving about not-quite-valid semver strings.
(Any resulting output will always be 100% strict compliant, of
course.) For backwards compatibility reasons, if the `options`
argument is a boolean value instead of an object, it is interpreted
to be the `loose` param.
- `includePrerelease` Set to suppress the [default
behavior](https://github.com/npm/node-semver#prerelease-tags) of
excluding prerelease tagged versions from ranges unless they are
explicitly opted into.
Strict-mode Comparators and Ranges will be strict about the SemVer
strings that they parse.
* `valid(v)`: Return the parsed version, or null if it's not valid.
* `inc(v, release)`: Return the version incremented by the release
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
`prepatch`, or `prerelease`), or null if it's not valid
* `premajor` in one call will bump the version up to the next major
version and down to a prerelease of that major version.
`preminor`, and `prepatch` work the same way.
* If called from a non-prerelease version, the `prerelease` will work the
same as `prepatch`. It increments the patch version, then makes a
prerelease. If the input version is already a prerelease it simply
increments it.
* `prerelease(v)`: Returns an array of prerelease components, or null
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
* `major(v)`: Return the major version number.
* `minor(v)`: Return the minor version number.
* `patch(v)`: Return the patch version number.
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
or comparators intersect.
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
a `SemVer` object or `null`.
### Comparison
* `gt(v1, v2)`: `v1 > v2`
* `gte(v1, v2)`: `v1 >= v2`
* `lt(v1, v2)`: `v1 < v2`
* `lte(v1, v2)`: `v1 <= v2`
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
even if they're not the exact same string. You already know how to
compare strings.
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
the corresponding function above. `"==="` and `"!=="` do simple
string comparison, but are included for completeness. Throws if an
invalid comparison string is provided.
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions
in descending order when passed to `Array.sort()`.
* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions
are equal. Sorts in ascending order if passed to `Array.sort()`.
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
* `diff(v1, v2)`: Returns difference between two versions by the release type
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
or null if the versions are the same.
### Comparators
* `intersects(comparator)`: Return true if the comparators intersect
### Ranges
* `validRange(range)`: Return the valid range or null if it's not valid
* `satisfies(version, range)`: Return true if the version satisfies the
range.
* `maxSatisfying(versions, range)`: Return the highest version in the list
that satisfies the range, or `null` if none of them do.
* `minSatisfying(versions, range)`: Return the lowest version in the list
that satisfies the range, or `null` if none of them do.
* `minVersion(range)`: Return the lowest version that can possibly match
the given range.
* `gtr(version, range)`: Return `true` if version is greater than all the
versions possible in the range.
* `ltr(version, range)`: Return `true` if version is less than all the
versions possible in the range.
* `outside(version, range, hilo)`: Return true if the version is outside
the bounds of the range in either the high or low direction. The
`hilo` argument must be either the string `'>'` or `'<'`. (This is
the function called by `gtr` and `ltr`.)
* `intersects(range)`: Return true if any of the ranges comparators intersect
Note that, since ranges may be non-contiguous, a version might not be
greater than a range, less than a range, *or* satisfy a range! For
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
until `2.0.0`, so the version `1.2.10` would not be greater than the
range (because `2.0.1` satisfies, which is higher), nor less than the
range (since `1.2.8` satisfies, which is lower), and it also does not
satisfy the range.
If you want to know if a version satisfies or does not satisfy a
range, use the `satisfies(version, range)` function.
### Coercion
* `coerce(version, options)`: Coerces a string to semver if possible
This aims to provide a very forgiving translation of a non-semver string to
semver. It looks for the first digit in a string, and consumes all
remaining characters which satisfy at least a partial semver (e.g., `1`,
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
`3.4.0`). Only text which lacks digits will fail coercion (`version one`
is not valid). The maximum length for any semver component considered for
coercion is 16 characters; longer components will be ignored
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
components are invalid (`9999999999999999.4.7.4` is likely invalid).
If the `options.rtl` flag is set, then `coerce` will return the right-most
coercible tuple that does not share an ending index with a longer coercible
tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
any other overlapping SemVer tuple.
### Clean
* `clean(version)`: Clean a string to be a valid semver if possible
This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges.
ex.
* `s.clean(' = v 2.1.5foo')`: `null`
* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'`
* `s.clean(' = v 2.1.5-foo')`: `null`
* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'`
* `s.clean('=v2.1.5')`: `'2.1.5'`
* `s.clean(' =v2.1.5')`: `2.1.5`
* `s.clean(' 2.1.5 ')`: `'2.1.5'`
* `s.clean('~1.0.0')`: `null`

174
node_modules/ts-loader/node_modules/semver/bin/semver.js generated vendored Executable file
View file

@ -0,0 +1,174 @@
#!/usr/bin/env node
// Standalone semver comparison program.
// Exits successfully and prints matching version(s) if
// any supplied version is valid and passes all tests.
var argv = process.argv.slice(2)
var versions = []
var range = []
var inc = null
var version = require('../package.json').version
var loose = false
var includePrerelease = false
var coerce = false
var rtl = false
var identifier
var semver = require('../semver')
var reverse = false
var options = {}
main()
function main () {
if (!argv.length) return help()
while (argv.length) {
var a = argv.shift()
var indexOfEqualSign = a.indexOf('=')
if (indexOfEqualSign !== -1) {
a = a.slice(0, indexOfEqualSign)
argv.unshift(a.slice(indexOfEqualSign + 1))
}
switch (a) {
case '-rv': case '-rev': case '--rev': case '--reverse':
reverse = true
break
case '-l': case '--loose':
loose = true
break
case '-p': case '--include-prerelease':
includePrerelease = true
break
case '-v': case '--version':
versions.push(argv.shift())
break
case '-i': case '--inc': case '--increment':
switch (argv[0]) {
case 'major': case 'minor': case 'patch': case 'prerelease':
case 'premajor': case 'preminor': case 'prepatch':
inc = argv.shift()
break
default:
inc = 'patch'
break
}
break
case '--preid':
identifier = argv.shift()
break
case '-r': case '--range':
range.push(argv.shift())
break
case '-c': case '--coerce':
coerce = true
break
case '--rtl':
rtl = true
break
case '--ltr':
rtl = false
break
case '-h': case '--help': case '-?':
return help()
default:
versions.push(a)
break
}
}
var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl }
versions = versions.map(function (v) {
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
}).filter(function (v) {
return semver.valid(v)
})
if (!versions.length) return fail()
if (inc && (versions.length !== 1 || range.length)) { return failInc() }
for (var i = 0, l = range.length; i < l; i++) {
versions = versions.filter(function (v) {
return semver.satisfies(v, range[i], options)
})
if (!versions.length) return fail()
}
return success(versions)
}
function failInc () {
console.error('--inc can only be used on a single version with no range')
fail()
}
function fail () { process.exit(1) }
function success () {
var compare = reverse ? 'rcompare' : 'compare'
versions.sort(function (a, b) {
return semver[compare](a, b, options)
}).map(function (v) {
return semver.clean(v, options)
}).map(function (v) {
return inc ? semver.inc(v, inc, options, identifier) : v
}).forEach(function (v, i, _) { console.log(v) })
}
function help () {
console.log(['SemVer ' + version,
'',
'A JavaScript implementation of the https://semver.org/ specification',
'Copyright Isaac Z. Schlueter',
'',
'Usage: semver [options] <version> [<version> [...]]',
'Prints valid versions sorted by SemVer precedence',
'',
'Options:',
'-r --range <range>',
' Print versions that match the specified range.',
'',
'-i --increment [<level>]',
' Increment a version by the specified level. Level can',
' be one of: major, minor, patch, premajor, preminor,',
" prepatch, or prerelease. Default level is 'patch'.",
' Only one version may be specified.',
'',
'--preid <identifier>',
' Identifier to be used to prefix premajor, preminor,',
' prepatch or prerelease version increments.',
'',
'-l --loose',
' Interpret versions and ranges loosely',
'',
'-p --include-prerelease',
' Always include prerelease versions in range matching',
'',
'-c --coerce',
' Coerce a string into SemVer if possible',
' (does not imply --loose)',
'',
'--rtl',
' Coerce version strings right to left',
'',
'--ltr',
' Coerce version strings left to right (default)',
'',
'Program exits successfully if any valid version satisfies',
'all supplied ranges, and prints all satisfying versions.',
'',
'If no satisfying versions are found, then exits failure.',
'',
'Versions are printed in ascending order, so supplying',
'multiple versions to the utility will just sort them.'
].join('\n'))
}

View file

@ -0,0 +1,28 @@
{
"name": "semver",
"version": "6.3.0",
"description": "The semantic version parser used by npm.",
"main": "semver.js",
"scripts": {
"test": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --follow-tags"
},
"devDependencies": {
"tap": "^14.3.1"
},
"license": "ISC",
"repository": "https://github.com/npm/node-semver",
"bin": {
"semver": "./bin/semver.js"
},
"files": [
"bin",
"range.bnf",
"semver.js"
],
"tap": {
"check-coverage": true
}
}

16
node_modules/ts-loader/node_modules/semver/range.bnf generated vendored Normal file
View file

@ -0,0 +1,16 @@
range-set ::= range ( logical-or range ) *
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
range ::= hyphen | simple ( ' ' simple ) * | ''
hyphen ::= partial ' - ' partial
simple ::= primitive | partial | tilde | caret
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
xr ::= 'x' | 'X' | '*' | nr
nr ::= '0' | [1-9] ( [0-9] ) *
tilde ::= '~' partial
caret ::= '^' partial
qualifier ::= ( '-' pre )? ( '+' build )?
pre ::= parts
build ::= parts
parts ::= part ( '.' part ) *
part ::= nr | [-0-9A-Za-z]+

1596
node_modules/ts-loader/node_modules/semver/semver.js generated vendored Normal file

File diff suppressed because it is too large Load diff

106
node_modules/ts-loader/package.json generated vendored Normal file
View file

@ -0,0 +1,106 @@
{
"name": "ts-loader",
"version": "8.0.2",
"description": "TypeScript loader for webpack",
"main": "index.js",
"types": "dist",
"scripts": {
"build": "tsc --version && tsc --project \"./src\"",
"lint": "eslint -c .eslintrc.js --ext .ts ./src",
"comparison-tests": "git clean -xfd test/comparison-tests && npm link ./test/comparison-tests/testLib && node test/comparison-tests/run-tests.js",
"comparison-tests-generate": "git clean -xfd test/comparison-tests && node test/comparison-tests/stub-new-version.js",
"execution-tests": "git clean -xfd test/execution-tests && node test/execution-tests/run-tests.js",
"test": "git clean -xfd test/comparison-tests && git clean -xfd test/execution-tests && node test/run-tests.js",
"clean": "git clean -xfd test/comparison-tests && git clean -xfd test/execution-tests",
"docker:build": "docker build -t ts-loader .",
"postdocker:build": "docker run -it ts-loader yarn test",
"generate-toc": "markdown-toc -i ./README.md && git add README.md && git commit -m \"chore: update docs\""
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{ts,md}": [
"prettier --write",
"yarn lint",
"git add"
]
},
"repository": {
"type": "git",
"url": "https://github.com/TypeStrong/ts-loader.git"
},
"keywords": [
"ts-loader",
"typescript-loader",
"webpack",
"loader",
"typescript",
"ts"
],
"engines": {
"node": ">=10.0.0"
},
"author": "John Reilly <johnny_reilly@hotmail.com> (https://blog.johnnyreilly.com)",
"contributors": [
"John Reilly <johnny_reilly@hotmail.com> (https://blog.johnnyreilly.com)",
"James Brantly <james@jbrantly.com> (http://www.jbrantly.com/)"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/TypeStrong/ts-loader/issues"
},
"homepage": "https://github.com/TypeStrong/ts-loader",
"dependencies": {
"chalk": "^2.3.0",
"enhanced-resolve": "^4.0.0",
"loader-utils": "^1.0.2",
"micromatch": "^4.0.0",
"semver": "^6.0.0"
},
"devDependencies": {
"@types/micromatch": "^3.1.0",
"@types/node": "*",
"@types/semver": "^6.0.0",
"@types/webpack": "^4.4.30",
"@typescript-eslint/eslint-plugin": "^3.0.0",
"@typescript-eslint/parser": "^3.0.0",
"babel": "^6.0.0",
"babel-core": "^6.0.0",
"babel-loader": "^7.0.0",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.0.0",
"babel-preset-es2016": "^6.16.0",
"babel-preset-react": "^6.0.0",
"escape-string-regexp": "^2.0.0",
"eslint": "^7.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.3",
"fs-extra": "^7.0.0",
"glob": "^7.1.1",
"html-webpack-plugin": "^3.2.0",
"husky": "^2.0.0",
"jasmine-core": "^3.0.0",
"karma": "^4.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-jasmine": "^2.0.0",
"karma-mocha-reporter": "^2.0.0",
"karma-sourcemap-loader": "^0.3.6",
"karma-webpack": "^4.0.0-rc.5",
"lint-staged": "^8.0.0",
"markdown-toc": "^1.2.0",
"mkdirp": "^0.5.1",
"mocha": "^6.0.0",
"prettier": "^2.0.5",
"rimraf": "^2.6.2",
"typescript": "^3.6.2",
"webpack": "^4.5.0",
"webpack-cli": "^3.1.1"
},
"peerDependencies": {
"typescript": "*"
}
}