🎯 MapView v2.0 - Global Deployment Ready

 MAJOR FEATURES:
• Auto-zoom intelligence với smart bounds fitting
• Enhanced 3D GPS markers với pulsing effects
• Professional route display với 6-layer rendering
• Status-based parking icons với availability indicators
• Production-ready build optimizations

🗺️ AUTO-ZOOM FEATURES:
• Smart bounds fitting cho GPS + selected parking
• Adaptive padding (50px) cho visual balance
• Max zoom control (level 16) để tránh quá gần
• Dynamic centering khi không có selection

🎨 ENHANCED VISUALS:
• 3D GPS marker với multi-layer pulse effects
• Advanced parking icons với status colors
• Selection highlighting với animation
• Dimming system cho non-selected items

🛣️ ROUTE SYSTEM:
• OpenRouteService API integration
• Multi-layer route rendering (glow, shadow, main, animated)
• Real-time distance & duration calculation
• Visual route info trong popup

📱 PRODUCTION READY:
• SSR safe với dynamic imports
• Build errors resolved
• Global deployment via Vercel
• Optimized performance

🌍 DEPLOYMENT:
• Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app
• Bundle size: 22.8 kB optimized
• Global CDN distribution
• HTTPS enabled

💾 VERSION CONTROL:
• MapView-v2.0.tsx backup created
• MAPVIEW_VERSIONS.md documentation
• Full version history tracking
This commit is contained in:
2025-07-20 19:52:16 +07:00
parent 3203463a6a
commit c65cc97a33
64624 changed files with 7199453 additions and 6462 deletions

10
backend/node_modules/ts-loader/dist/after-compile.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import * as webpack from 'webpack';
import type { TSInstance } from './interfaces';
/**
* This returns a function that has options to add assets and also to provide errors to webpack
* In webpack 4 we can do both during the afterCompile hook
* In webpack 5 only errors should be provided during aftercompile. Assets should be
* emitted during the afterProcessAssets hook
*/
export declare function makeAfterCompile(instance: TSInstance, configFilePath: string | undefined): (compilation: webpack.Compilation, callback: () => void) => void;
//# sourceMappingURL=after-compile.d.ts.map

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,KAAK,EAIV,UAAU,EAEX,MAAM,cAAc,CAAC;AAUtB;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,UAAU,EACpB,cAAc,EAAE,MAAM,GAAG,SAAS,iBAKb,OAAO,CAAC,WAAW,YAAY,MAAM,IAAI,UAoD/D"}

284
backend/node_modules/ts-loader/dist/after-compile.js generated vendored Normal file
View File

@@ -0,0 +1,284 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeAfterCompile = makeAfterCompile;
const path = require("path");
const webpack = require("webpack");
const constants = require("./constants");
const instances_1 = require("./instances");
const utils_1 = require("./utils");
/**
* This returns a function that has options to add assets and also to provide errors to webpack
* In webpack 4 we can do both during the afterCompile hook
* In webpack 5 only errors should be provided during aftercompile. Assets should be
* emitted during the afterProcessAssets hook
*/
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, instance.loaderOptions);
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);
provideSolutionErrorsToWebpack(compilation, modules, instance);
provideDeclarationFilesToWebpack(filesToCheckForErrors, instance, compilation);
provideTsBuildInfoFilesToWebpack(instance, compilation);
provideAssetsFromSolutionBuilderHost(instance, compilation);
instance.filesWithErrors = filesWithErrors;
instance.modifiedFiles = undefined;
instance.projectsMissingSourceMaps = new Set();
callback();
};
}
/**
* handle compiler option errors after the first compile
*/
function provideCompilerOptionDiagnosticErrorsToWebpack(getCompilerOptionDiagnostics, compilation, instance, configFilePath) {
if (getCompilerOptionDiagnostics) {
const { languageService, loaderOptions, compiler, program } = instance;
const errors = (0, 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 instanceof webpack.NormalModule && 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 = (0, utils_1.populateReverseDependencyGraph)(instance);
// check all modified files, and all dependants
for (const modifiedFileName of modifiedFiles.keys()) {
for (const fileName of (0, utils_1.collectAllDependants)(reverseDependencyGraph, modifiedFileName).keys()) {
const fileToCheckForErrors = files.get(fileName) || otherFiles.get(fileName);
if (fileToCheckForErrors) { //file may have been removed
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 (file && !(0, 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 = (0, 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, loaderOptions);
// append errors
const formattedErrors = (0, 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 = (0, 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, loaderOptions);
// append errors
const formattedErrors = (0, 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 = (0, 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(...(0, 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.
* JavaScript declaration files are included if `allowJs` is set.
*/
function provideDeclarationFilesToWebpack(filesToCheckForErrors, instance, compilation) {
const filePathRegex = instance.compilerOptions.allowJs === true
? constants.dtsTsTsxJsJsxRegex
: constants.dtsTsTsxRegex;
for (const { fileName } of filesToCheckForErrors.values()) {
if (fileName.match(filePathRegex) === null) {
continue;
}
addDeclarationFilesAsAsset((0, 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)
// According to @alexander-akait (and @sokra) we should always '/' https://github.com/TypeStrong/ts-loader/pull/1251#issuecomment-799606985
.replace(/\\/g, '/');
// As suggested by @JonWallsten here: https://github.com/TypeStrong/ts-loader/pull/1251#issuecomment-800032753
compilation.emitAsset(assetPath, new webpack.sources.RawSource(outputFile.text));
}
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
(0, 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, loaderOptions) {
compilation.errors = compilation.errors.filter(error => error.details !== (0, utils_1.tsLoaderSource)(loaderOptions));
}
function removeModuleTSLoaderError(module, loaderOptions) {
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 !== (0, utils_1.tsLoaderSource)(loaderOptions))
.forEach(error => module.addError(error));
}
//# sourceMappingURL=after-compile.js.map

13
backend/node_modules/ts-loader/dist/compilerSetup.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import type * as typescript from 'typescript';
import type { LoaderOptions } from './interfaces';
import type * 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, compiler: typeof typescript): {
skipLibCheck: boolean;
} & typescript.CompilerOptions;
//# sourceMappingURL=compilerSetup.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"compilerSetup.d.ts","sourceRoot":"","sources":["../src/compilerSetup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,UAAU,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,MAAM,UAAU,CAAC;AAExC,wBAAgB,WAAW,CAAC,aAAa,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM;;;;;EA6C3E;AAED,wBAAgB,kBAAkB,CAChC,iBAAiB,EAAE,UAAU,CAAC,iBAAiB,EAC/C,QAAQ,EAAE,OAAO,UAAU;;+BA8B5B"}

64
backend/node_modules/ts-loader/dist/compilerSetup.js generated vendored Normal file
View File

@@ -0,0 +1,64 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCompiler = getCompiler;
exports.getCompilerOptions = getCompilerOptions;
const semver = require("semver");
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,
};
}
function getCompilerOptions(configParseResult, compiler) {
const defaultOptions = { skipLibCheck: true };
const compilerOptions = Object.assign(defaultOptions, configParseResult.options, {
suppressOutputPathCheck: true, // This is why: https://github.com/Microsoft/TypeScript/issues/7363
});
// if `module` is not specified and not using ES6+ target, default to CJS module output
if (compilerOptions.module === undefined &&
compilerOptions.target !== undefined &&
compilerOptions.target < compiler.ScriptTarget.ES2015) {
compilerOptions.module = compiler.ModuleKind.CommonJS;
}
if (configParseResult.options.configFile) {
Object.defineProperty(compilerOptions, 'configFile', {
enumerable: false,
writable: false,
value: configParseResult.options.configFile,
});
}
return compilerOptions;
}
//# sourceMappingURL=compilerSetup.js.map

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

@@ -0,0 +1,18 @@
import type { Chalk } from 'chalk';
import type * as typescript from 'typescript';
import type * as webpack from 'webpack';
import type { LoaderOptions } from './interfaces';
import type * as logger from './logger';
interface ConfigFile {
config?: any;
error?: typescript.Diagnostic;
}
export declare function getConfigFile(compiler: typeof typescript, colors: Chalk, loader: webpack.LoaderContext<LoaderOptions>, loaderOptions: LoaderOptions, compilerCompatible: boolean, log: logger.Logger, compilerDetailsLogMessage: string): {
configFilePath: string | undefined;
configFile: ConfigFile;
configFileError: webpack.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
backend/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,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,KAAK,KAAK,UAAU,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAGxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,MAAM,UAAU,CAAC;AAGxC,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,aAAa,CAAC,aAAa,CAAC,EAC5C,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;AAGD,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,OAAO,UAAU,EAC3B,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,MAAM,GACrB,UAAU,CAAC,iBAAiB,GAAG,SAAS,CAwB1C"}

114
backend/node_modules/ts-loader/dist/config.js generated vendored Normal file
View File

@@ -0,0 +1,114 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getConfigFile = getConfigFile;
exports.getConfigParseResult = getConfigParseResult;
exports.getParsedCommandLine = getParsedCommandLine;
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 = (0, 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,
};
}
/**
* 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, {
...compiler.sys,
useCaseSensitiveFileNames: (0, 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;
}
const extendedConfigCache = new Map();
function getParsedCommandLine(compiler, loaderOptions, configFilePath) {
const result = compiler.getParsedCommandLineOfConfigFile(configFilePath, getCompilerOptionsToExtend(compiler, loaderOptions, path.dirname(configFilePath), configFilePath), {
...compiler.sys,
useCaseSensitiveFileNames: (0, utils_1.useCaseSensitiveFileNames)(compiler, loaderOptions),
// eslint-disable-next-line @typescript-eslint/no-empty-function
onUnRecoverableConfigFileDiagnostic: () => { },
}, extendedConfigCache);
if (result) {
result.options = (0, compilerSetup_1.getCompilerOptions)(result, compiler);
}
return result;
}
function getCompilerOptionsToExtend(compiler, loaderOptions, basePath, configFileName) {
return compiler.convertCompilerOptionsFromJson(loaderOptions.compilerOptions, basePath, configFileName).options;
}
//# sourceMappingURL=config.js.map

18
backend/node_modules/ts-loader/dist/constants.d.ts generated vendored Normal file
View File

@@ -0,0 +1,18 @@
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 declarationRegex: 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

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,QAAsB,CAAC;AAC9C,eAAO,MAAM,gBAAgB,QAAyB,CAAC;AACvD,eAAO,MAAM,wBAAwB,QAAiC,CAAC;AACvE,eAAO,MAAM,aAAa,QAA4B,CAAC;AACvD,eAAO,MAAM,kBAAkB,QAAoC,CAAC;AACpE,eAAO,MAAM,eAAe,QAA4B,CAAC;AACzD,eAAO,MAAM,KAAK,QAAsB,CAAC;AACzC,eAAO,MAAM,QAAQ,QAA2B,CAAC;AACjD,eAAO,MAAM,SAAS,QAAa,CAAC;AACpC,eAAO,MAAM,WAAW,QAAkB,CAAC"}

22
backend/node_modules/ts-loader/dist/constants.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
"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.declarationRegex = 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 = /\.([cm]?ts|tsx)$/i;
exports.declarationRegex = /\.d\.([cm]?ts|tsx)$/i;
exports.dtsDtsxOrDtsDtsxMapRegex = /\.d\.([cm]?ts|tsx)(\.map)?$/i;
exports.dtsTsTsxRegex = /(\.d)?\.([cm]?ts|tsx)$/i;
exports.dtsTsTsxJsJsxRegex = /((\.d)?\.([cm]?[tj]s|[tj]sx))$/i;
exports.tsTsxJsJsxRegex = /\.([cm]?[tj]s|[tj]sx)$/i;
exports.jsJsx = /\.([cm]?js|jsx)$/i;
exports.jsJsxMap = /\.([cm]?js|jsx)\.map$/i;
exports.jsonRegex = /\.json$/i;
exports.nodeModules = /node_modules/i;
//# sourceMappingURL=constants.js.map

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

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

1
backend/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":"AAGA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAWxC,OAAO,KAAK,EAEV,aAAa,EAId,MAAM,cAAc,CAAC;AAYtB;;GAEG;AACH,iBAAS,MAAM,CACb,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,EAC1C,QAAQ,EAAE,MAAM,EAChB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAcrC;AAkrBD,SAAS,MAAM,CAAC;AAEhB;;GAEG;AAEH,kBAAU,MAAM,CAAC;IAEf,UAAiB,OAAQ,SAAQ,aAAa;KAAG;CAClD"}

484
backend/node_modules/ts-loader/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,484 @@
"use strict";
const crypto = require("crypto");
const path = require("path");
const constants = require("./constants");
const instances_1 = require("./instances");
const utils_1 = require("./utils");
const source_map_1 = require("source-map");
const loaderOptionsCache = {};
/**
* The entry point for ts-loader
*/
function loader(contents, inputSourceMap) {
this.cacheable && this.cacheable();
const callback = this.async();
const options = getLoaderOptions(this);
const instanceOrError = (0, instances_1.getTypeScriptInstance)(options, this);
if (instanceOrError.error !== undefined) {
callback(new Error(instanceOrError.error.message));
return;
}
const instance = instanceOrError.instance;
(0, instances_1.buildSolutionReferences)(instance, this);
successLoader(this, contents, callback, instance, inputSourceMap);
}
function successLoader(loaderContext, contents, callback, instance, inputSourceMap) {
(0, instances_1.initializeInstance)(loaderContext, instance);
(0, instances_1.reportTranspileErrors)(instance, loaderContext);
const rawFilePath = path.normalize(loaderContext.resourcePath);
const filePath = instance.loaderOptions.appendTsSuffixTo.length > 0 ||
instance.loaderOptions.appendTsxSuffixTo.length > 0
? (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);
// the following function is async, which means it will immediately return and run in the "background"
// Webpack will be notified when it's finished when the function calls the `callback` method
makeSourceMapAndFinish(sourceMapText, outputText, filePath, contents, loaderContext, fileVersion, callback, instance, inputSourceMap);
}
function makeSourceMapAndFinish(sourceMapText, outputText, filePath, contents, loaderContext, fileVersion, callback, instance, inputSourceMap) {
if (outputText === null || outputText === undefined) {
setModuleMeta(loaderContext, instance, fileVersion);
const additionalGuidance = (0, 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);
// there are two cases where we don't need to perform input source map mapping:
// - either the ts-compiler did not generate a source map (tsconfig had `sourceMap` set to false)
// - or we did not get an input source map
//
// in the first case, we simply return undefined.
// in the second case we only need to return the newly generated source map
// this avoids that we have to make a possibly expensive call to the source-map lib
if (sourceMap === undefined || !inputSourceMap) {
callback(null, output, sourceMap);
return;
}
// otherwise we have to make a mapping to the input source map which is asynchronous
mapToInputSourceMap(sourceMap, loaderContext, inputSourceMap)
.then(mappedSourceMap => {
callback(null, output, mappedSourceMap);
})
.catch((e) => {
callback(e);
});
}
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.keys(loaderOptions).forEach(key => {
const value = loaderOptions[key];
if (value !== undefined) {
const valueString = typeof value === 'function' ? value.toString() : JSON.stringify(value);
hash.update(key + valueString);
}
});
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) {
const loaderOptions = loaderContext.getOptions();
// 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 = 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, loaderContext);
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, loaderContext) {
var _a;
const hasForkTsCheckerWebpackPlugin = (_a = loaderContext._compiler) === null || _a === void 0 ? void 0 : _a.options.plugins.some(plugin => {
var _a;
return typeof plugin === 'object' &&
((_a = plugin.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'ForkTsCheckerWebpackPlugin';
});
const options = Object.assign({}, {
silent: false,
logLevel: 'WARN',
logInfoToStdOut: false,
compiler: 'typescript',
context: undefined,
// Set default transpileOnly to true if there is an instance of ForkTsCheckerWebpackPlugin
transpileOnly: hasForkTsCheckerWebpackPlugin,
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 = (0, utils_1.arrify)(options.ignoreDiagnostics).map(Number);
options.logLevel = options.logLevel.toUpperCase();
options.instance = instanceName;
options.configFile = options.configFile || 'tsconfig.json';
// 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 (!(0, utils_1.isReferencedFile)(instance, filePath)) {
instance.otherFiles.delete(key);
instance.files.set(key, file);
instance.changedFilesList = true;
}
}
else {
if (instance.watchHost !== undefined) {
fileWatcherEventKind = instance.compiler.FileWatcherEventKind.Created;
}
file = { fileName: filePath, version: 0 };
if (!(0, utils_1.isReferencedFile)(instance, filePath)) {
instance.files.set(key, file);
instance.changedFilesList = true;
}
}
}
if (instance.watchHost !== 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 (!(0, 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 &&
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;
}
// 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) {
var _a;
const outputFiles = (0, 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 (!(0, 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)
!((_a = instance.solutionBuilderHost) === null || _a === void 0 ? void 0 : _a.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((0, instances_1.getInputFileNameFromOutput)(instance, path.resolve(resolvedFileName)) ||
originalFileName);
}
}
addDependenciesFromSolutionBuilder(instance, filePath, addDependency);
loaderContext._module.buildMeta.tsLoaderDefinitionFileVersions =
dependencies.map(defFilePath => path.relative(loaderContext.rootContext, defFilePath) +
'@' +
((0, utils_1.isReferencedFile)(instance, defFilePath)
? instance
.solutionBuilderHost.getInputFileStamp(defFilePath)
.toString()
: (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 (!(0, 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 ((0, 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: { ...instance.compilerOptions, rootDir: undefined },
transformers: instance.transformers,
reportDiagnostics: true,
fileName,
});
const module = loaderContext._module;
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 = (0, utils_1.formatErrors)(diagnostics, instance.loaderOptions, instance.colors, instance.compiler, { module }, loaderContext.context);
errors.forEach(error => module.addError(error));
}
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: [loaderContext.remainingRequest],
file: filePath,
sourcesContent: [contents],
}),
};
}
/**
* This method maps the newly generated @param{sourceMap} to the input source map.
* This is required when ts-loader is not the first loader in the Webpack loader chain.
*/
function mapToInputSourceMap(sourceMap, loaderContext, inputSourceMap) {
return new Promise((resolve, reject) => {
const inMap = {
file: loaderContext.remainingRequest,
mappings: inputSourceMap.mappings,
names: inputSourceMap.names,
sources: inputSourceMap.sources,
sourceRoot: inputSourceMap.sourceRoot,
sourcesContent: inputSourceMap.sourcesContent,
version: inputSourceMap.version,
};
Promise.all([
new source_map_1.SourceMapConsumer(inMap),
new source_map_1.SourceMapConsumer(sourceMap),
])
.then(sourceMapConsumers => {
try {
const generator = source_map_1.SourceMapGenerator.fromSourceMap(sourceMapConsumers[1]);
generator.applySourceMap(sourceMapConsumers[0]);
const mappedSourceMap = generator.toJSON();
// before resolving, we free memory by calling destroy on the source map consumers
sourceMapConsumers.forEach(sourceMapConsumer => sourceMapConsumer.destroy());
resolve(mappedSourceMap);
}
catch (e) {
//before rejecting, we free memory by calling destroy on the source map consumers
sourceMapConsumers.forEach(sourceMapConsumer => sourceMapConsumer.destroy());
reject(e);
}
})
.catch(reject);
});
}
module.exports = loader;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,5 @@
import type * as webpack from 'webpack';
import type { TSInstance } from './interfaces';
export declare function getTSInstanceFromCache(key: webpack.Compiler, name: string): TSInstance | undefined;
export declare function setTSInstanceInCache(key: webpack.Compiler | undefined, name: string, instance: TSInstance): void;
//# sourceMappingURL=instance-cache.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"instance-cache.d.ts","sourceRoot":"","sources":["../src/instance-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAY/C,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,OAAO,CAAC,QAAQ,EACrB,IAAI,EAAE,MAAM,GACX,UAAU,GAAG,SAAS,CAUxB;AAED,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,OAAO,CAAC,QAAQ,GAAG,SAAS,EACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,UAAU,QAOrB"}

29
backend/node_modules/ts-loader/dist/instance-cache.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTSInstanceFromCache = getTSInstanceFromCache;
exports.setTSInstanceInCache = setTSInstanceInCache;
// Some loaders (e.g. thread-loader) will set the _compiler property to undefined.
// We can't use undefined as a WeakMap key as it will throw an error at runtime,
// thus we keep a dummy "marker" object to use as key in those situations.
const marker = {};
// Each TypeScript instance is cached based on the webpack instance (key of the WeakMap)
// and also the name that was generated or passed via the options (string key of the
// internal Map)
const cache = new WeakMap();
function getTSInstanceFromCache(key, name) {
const compiler = key !== null && key !== void 0 ? key : marker;
let instances = cache.get(compiler);
if (!instances) {
instances = new Map();
cache.set(compiler, instances);
}
return instances.get(name);
}
function setTSInstanceInCache(key, name, instance) {
var _a;
const compiler = key !== null && key !== void 0 ? key : marker;
const instances = (_a = cache.get(compiler)) !== null && _a !== void 0 ? _a : new Map();
instances.set(name, instance);
cache.set(compiler, instances);
}
//# sourceMappingURL=instance-cache.js.map

24
backend/node_modules/ts-loader/dist/instances.d.ts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import type * as typescript from 'typescript';
import * as webpack from 'webpack';
import type { LoaderOptions, TSInstance } 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.LoaderContext<LoaderOptions>): {
instance?: TSInstance;
error?: webpack.WebpackError;
};
export declare function initializeInstance(loader: webpack.LoaderContext<LoaderOptions>, instance: TSInstance): void;
export declare function getCustomTransformers(loaderOptions: LoaderOptions, program: typescript.Program | undefined, getProgram: (() => typescript.Program | undefined) | undefined): any;
export declare function reportTranspileErrors(instance: TSInstance, loader: webpack.LoaderContext<LoaderOptions>): void;
export declare function buildSolutionReferences(instance: TSInstance, loader: webpack.LoaderContext<LoaderOptions>): 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

View File

@@ -0,0 +1 @@
{"version":3,"file":"instances.d.ts","sourceRoot":"","sources":["../src/instances.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,UAAU,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAYnC,OAAO,KAAK,EAAe,aAAa,EAAW,UAAU,EAAE,MAAM,cAAc,CAAC;AAqBpF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,GAC3C;IAAE,QAAQ,CAAC,EAAE,UAAU,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,CAAA;CAAE,CAiCzD;AAwQD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,EAC5C,QAAQ,EAAE,UAAU,QAiFrB;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,UAAU,CAAC,OAAO,GAAG,SAAS,EACvC,UAAU,EAAE,CAAC,MAAM,UAAU,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,SAAS,OA8B/D;AAgBD,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,QAyB7C;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,QA4B7C;AAED,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"}

506
backend/node_modules/ts-loader/dist/instances.js generated vendored Normal file
View File

@@ -0,0 +1,506 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTypeScriptInstance = getTypeScriptInstance;
exports.initializeInstance = initializeInstance;
exports.getCustomTransformers = getCustomTransformers;
exports.reportTranspileErrors = reportTranspileErrors;
exports.buildSolutionReferences = buildSolutionReferences;
exports.forEachResolvedProjectReference = forEachResolvedProjectReference;
exports.getOutputFileNames = getOutputFileNames;
exports.getInputFileNameFromOutput = getInputFileNameFromOutput;
exports.getEmitFromWatchHost = getEmitFromWatchHost;
exports.getEmitOutput = getEmitOutput;
const chalk = require("chalk");
const fs = require("fs");
const path = require("path");
const webpack = require("webpack");
const after_compile_1 = require("./after-compile");
const compilerSetup_1 = require("./compilerSetup");
const config_1 = require("./config");
const constants_1 = require("./constants");
const instance_cache_1 = require("./instance-cache");
const logger = require("./logger");
const servicesHost_1 = require("./servicesHost");
const utils_1 = require("./utils");
const watch_run_1 = require("./watch-run");
const instancesBySolutionBuilderConfigs = new Map();
/**
* 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) {
const existing = (0, instance_cache_1.getTSInstanceFromCache)(loader._compiler, loaderOptions.instance);
if (existing) {
if (!existing.initialSetupPending) {
(0, utils_1.ensureProgram)(existing);
}
return { instance: existing };
}
const level = loaderOptions.colors && chalk.supportsColor ? chalk.supportsColor.level : 0;
const colors = new chalk.Instance({ level });
const log = logger.makeLogger(loaderOptions, colors);
const compiler = (0, compilerSetup_1.getCompiler)(loaderOptions, log);
if (compiler.errorMessage !== undefined) {
return {
error: (0, utils_1.makeError)(loaderOptions, colors.red(compiler.errorMessage), ''),
};
}
return successfulTypeScriptInstance(loaderOptions, loader, log, colors, compiler.compiler, compiler.compilerCompatible, compiler.compilerDetailsLogMessage);
}
function createFilePathKeyMapper(compiler, loaderOptions) {
// Cache file path key - a map lookup is much faster than filesystem/regex operations & the result will never change
const filePathMapperCache = new Map();
// FileName lowercasing copied from typescript
const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
return (0, utils_1.useCaseSensitiveFileNames)(compiler, loaderOptions)
? pathResolve
: toFileNameLowerCase;
function pathResolve(filePath) {
let cachedPath = filePathMapperCache.get(filePath);
if (!cachedPath) {
cachedPath = path.resolve(filePath);
filePathMapperCache.set(filePath, cachedPath);
}
return cachedPath;
}
function toFileNameLowerCase(filePath) {
let cachedPath = filePathMapperCache.get(filePath);
if (!cachedPath) {
const filePathKey = pathResolve(filePath);
cachedPath = fileNameLowerCaseRegExp.test(filePathKey)
? filePathKey.replace(fileNameLowerCaseRegExp, ch => ch.toLowerCase())
: filePathKey;
filePathMapperCache.set(filePath, cachedPath);
}
return cachedPath;
}
}
function successfulTypeScriptInstance(loaderOptions, loader, log, colors, compiler, compilerCompatible, compilerDetailsLogMessage) {
const configFileAndPath = (0, config_1.getConfigFile)(compiler, colors, loader, loaderOptions, compilerCompatible, log, compilerDetailsLogMessage);
if (configFileAndPath.configFileError !== undefined) {
const { message, file } = configFileAndPath.configFileError;
return {
error: (0, utils_1.makeError)(loaderOptions, colors.red('error while reading tsconfig.json:' + constants_1.EOL + message), file),
};
}
const { configFilePath, configFile } = configFileAndPath;
if (configFilePath) {
loader.addBuildDependency(configFilePath);
}
const filePathKeyMapper = createFilePathKeyMapper(compiler, loaderOptions);
if (configFilePath && loaderOptions.projectReferences) {
const configFileKey = filePathKeyMapper(configFilePath);
const existing = getExistingSolutionBuilderHost(configFileKey);
if (existing) {
// Reuse the instance if config file for project references is shared.
(0, instance_cache_1.setTSInstanceInCache)(loader._compiler, loaderOptions.instance, existing);
return { instance: existing };
}
}
const module = loader._module;
const basePath = loaderOptions.context || path.dirname(configFilePath || '');
const configParseResult = (0, config_1.getConfigParseResult)(compiler, configFile, basePath, configFilePath, loaderOptions);
if (configParseResult.errors.length > 0 && !loaderOptions.happyPackMode) {
const errors = (0, utils_1.formatErrors)(configParseResult.errors, loaderOptions, colors, compiler, { file: configFilePath }, loader.context);
errors.forEach(error => module.addError(error));
return {
error: (0, utils_1.makeError)(loaderOptions, colors.red('error while parsing tsconfig.json'), configFilePath || ''),
};
}
const compilerOptions = (0, compilerSetup_1.getCompilerOptions)(configParseResult, compiler);
const rootFileNames = new Set();
const files = new Map();
const otherFiles = new Map();
const appendTsTsxSuffixesIfRequired = loaderOptions.appendTsSuffixTo.length > 0 ||
loaderOptions.appendTsxSuffixTo.length > 0
? (filePath) => (0, utils_1.appendSuffixesIfMatch)({
'.ts': loaderOptions.appendTsSuffixTo,
'.tsx': loaderOptions.appendTsxSuffixTo,
}, filePath)
: (filePath) => filePath;
if (loaderOptions.transpileOnly) {
// quick return for transpiling
// we do need to check for any issues with TS options though
const transpileInstance = {
compiler,
compilerOptions,
appendTsTsxSuffixesIfRequired,
loaderOptions,
rootFileNames,
files,
otherFiles,
version: 0,
program: undefined, // temporary, to be set later
dependencyGraph: new Map(),
transformers: {}, // this is only set temporarily, custom transformers are created further down
colors,
initialSetupPending: true,
reportTranspileErrors: true,
configFilePath,
configParseResult,
log,
filePathKeyMapper,
};
(0, instance_cache_1.setTSInstanceInCache)(loader._compiler, loaderOptions.instance, transpileInstance);
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: (0, utils_1.makeError)(loaderOptions, colors.red(`A file specified in tsconfig.json could not be found: ${normalizedFilePath}`), normalizedFilePath),
};
}
const instance = {
compiler,
compilerOptions,
appendTsTsxSuffixesIfRequired,
loaderOptions,
rootFileNames,
files,
otherFiles,
languageService: null,
version: 0,
transformers: {}, // this is only set temporarily, custom transformers are created further down
dependencyGraph: new Map(),
colors,
initialSetupPending: true,
configFilePath,
configParseResult,
log,
filePathKeyMapper,
};
(0, instance_cache_1.setTSInstanceInCache)(loader._compiler, loaderOptions.instance, instance);
return { instance };
}
function getExistingSolutionBuilderHost(key) {
const existing = instancesBySolutionBuilderConfigs.get(key);
if (existing)
return existing;
for (const instance of instancesBySolutionBuilderConfigs.values()) {
if (instance.solutionBuilderHost.configFileInfo.has(key)) {
return instance;
}
}
return undefined;
}
function addAssetHooks(loader, instance) {
// makeAfterCompile is a closure. It returns a function which closes over the variable checkAllFilesForErrors
// We need to get the function once and then reuse it, otherwise it will be recreated each time
// and all files will always be checked.
const cachedMakeAfterCompile = (0, after_compile_1.makeAfterCompile)(instance, instance.configFilePath);
const makeAssetsCallback = (compilation) => {
compilation.hooks.processAssets.tap({
name: 'ts-loader',
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
}, () => {
cachedMakeAfterCompile(compilation, () => {
return null;
});
});
};
// We need to add the hook above for each run.
// For the first run, we just need to add the hook to loader._compilation
makeAssetsCallback(loader._compilation);
// For future calls in watch mode we need to watch for a new compilation and add the hook
loader._compiler.hooks.compilation.tap('ts-loader', makeAssetsCallback);
}
function initializeInstance(loader, instance) {
if (!instance.initialSetupPending) {
return;
}
instance.initialSetupPending = false;
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));
const getProgram = () => program;
instance.transformers = getCustomTransformers(instance.loaderOptions, program, getProgram);
// Setup watch run for solution building
if (instance.solutionBuilderHost) {
addAssetHooks(loader, instance);
loader._compiler.hooks.watchRun.tapAsync('ts-loader', (0, 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. Or you should set `transpileOnly` or `happyPackMode` to true when using with `thread-loader`.");
}
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 = (0, servicesHost_1.makeWatchHost)(getScriptRegexp(instance), loader, instance, instance.configParseResult.projectReferences);
instance.watchOfFilesAndCompilerOptions =
instance.compiler.createWatchProgram(instance.watchHost);
instance.builderProgram =
instance.watchOfFilesAndCompilerOptions.getProgram();
const getProgram = () => { var _a; return (_a = instance.builderProgram) === null || _a === void 0 ? void 0 : _a.getProgram(); };
instance.program = getProgram();
instance.transformers = getCustomTransformers(instance.loaderOptions, instance.program, getProgram);
}
else {
instance.servicesHost = (0, servicesHost_1.makeServicesHost)(getScriptRegexp(instance), loader, instance, instance.configParseResult.projectReferences);
instance.languageService = instance.compiler.createLanguageService(instance.servicesHost, instance.compiler.createDocumentRegistry());
const getProgram = () => instance.languageService.getProgram();
instance.transformers = getCustomTransformers(instance.loaderOptions, getProgram(), getProgram);
}
addAssetHooks(loader, instance);
loader._compiler.hooks.watchRun.tapAsync('ts-loader', (0, watch_run_1.makeWatchRun)(instance, loader));
}
}
function getCustomTransformers(loaderOptions, program, getProgram) {
// same strategy as https://github.com/s-panferov/awesome-typescript-loader/pull/531/files
let { getCustomTransformers: customerTransformers } = 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 "${loaderOptions.getCustomTransformers}": ${err instanceof Error ? err.message : 'unknown error'}`);
}
if (typeof customerTransformers !== 'function') {
throw new Error(`Custom transformers in "${loaderOptions.getCustomTransformers}" should export a function, got ${typeof customerTransformers}`);
}
getCustomTransformers = customerTransformers;
}
return getCustomTransformers(program, getProgram);
}
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
? /\.([cm]?[tj]s|[tj]sx|json)$/i
: /\.([cm]?ts|tsx|json)$/i;
}
// if allowJs is set then we should accept js(x) files
return instance.configParseResult.options.allowJs === true
? /\.([cm]?[tj]s|[tj]sx)$/i
: /\.([cm]?ts|tsx)$/i;
}
function reportTranspileErrors(instance, loader) {
if (!instance.reportTranspileErrors) {
return;
}
const module = loader._module;
instance.reportTranspileErrors = false;
// happypack does not have _module.errors - see https://github.com/TypeStrong/ts-loader/issues/336
if (!instance.loaderOptions.happyPackMode) {
const solutionErrors = (0, servicesHost_1.getSolutionErrors)(instance, loader.context);
const diagnostics = instance.program.getOptionsDiagnostics();
const errors = (0, utils_1.formatErrors)(diagnostics, instance.loaderOptions, instance.colors, instance.compiler, { file: instance.configFilePath || 'tsconfig.json' }, loader.context);
[...solutionErrors, ...errors].forEach(error => module.addError(error));
}
}
function buildSolutionReferences(instance, loader) {
if (!(0, utils_1.supportsSolutionBuild)(instance)) {
return;
}
if (!instance.solutionBuilderHost) {
// Use solution builder
instance.log.logInfo('Using SolutionBuilder api');
const scriptRegex = getScriptRegexp(instance);
instance.solutionBuilderHost = (0, servicesHost_1.makeSolutionBuilderHost)(scriptRegex, loader, instance);
const solutionBuilder = instance.compiler.createSolutionBuilderWithWatch(instance.solutionBuilderHost, instance.configParseResult.projectReferences.map(ref => ref.path), { verbose: true });
solutionBuilder.build();
instance.solutionBuilderHost.ensureAllReferenceTimestamps();
instancesBySolutionBuilderConfigs.set(instance.filePathKeyMapper(instance.configFilePath), instance);
}
else {
instance.solutionBuilderHost.buildReferences();
}
}
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;
}
}
// 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 = !(0, 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;
}
function getInputFileNameFromOutput(instance, filePath) {
if (filePath.match(constants_1.tsTsxRegex) && !constants_1.declarationRegex.test(filePath)) {
return undefined;
}
if (instance.solutionBuilderHost) {
return instance.solutionBuilderHost.getInputFileNameFromOutput(filePath);
}
const program = (0, 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;
}));
}
function getEmitFromWatchHost(instance, filePath) {
const program = (0, 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;
}
function getEmitOutput(instance, filePath) {
if (fileExtensionIs(filePath, instance.compiler.Extension.Dts)) {
return [];
}
if ((0, utils_1.isReferencedFile)(instance, filePath)) {
return instance.solutionBuilderHost.getOutputFilesFromReferencedProjectInput(filePath);
}
const program = (0, 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;
}
}
//# sourceMappingURL=instances.js.map

236
backend/node_modules/ts-loader/dist/interfaces.d.ts generated vendored Normal file
View File

@@ -0,0 +1,236 @@
import type * as typescript from 'typescript';
import type { Chalk } from 'chalk';
import type * as logger from './logger';
export interface ErrorInfo {
code: number;
severity: Severity;
content: string;
file: string;
line: number;
character: number;
context: string;
}
export type FileLocation = {
/** 1-based */
line: number;
/** 1-based */
character: number;
};
export interface HostMayBeCacheable {
clearCache?(): void;
fileExistsCache?: Map<string, boolean>;
directoryExistsCache?: Map<string, boolean>;
realpathCache?: Map<string, string>;
}
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>, HostMayBeCacheable {
invokeFileWatcher: WatchFactory['invokeFileWatcher'];
updateRootFileNames(): void;
outputFiles: Map<FilePathKey, typescript.OutputFile[]>;
tsbuildinfo?: typescript.OutputFile;
}
export 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 type FilePathKey = string & {
__filePathKeyBrand: any;
};
export interface SolutionBuilderWithWatchHost extends typescript.SolutionBuilderWithWatchHost<typescript.EmitAndSemanticDiagnosticsBuilderProgram>, WatchFactory {
diagnostics: SolutionDiagnostics;
writtenFiles: typescript.OutputFile[];
configFileInfo: Map<FilePathKey, ConfigFileInfo>;
outputAffectingInstanceVersion: Map<FilePathKey, true>;
getInputFileStamp(fileName: string): Date;
updateSolutionBuilderInputFile(fileName: string): void;
getOutputFileKeyFromReferencedProject(outputFileName: string): FilePathKey | undefined;
getOutputFileAndKeyFromReferencedProject(oututFileName: string): {
key: FilePathKey;
outputFile: string | false;
} | undefined;
getOutputFileTextAndKeyFromReferencedProject(oututFileName: string): {
key: FilePathKey;
text: string | undefined;
} | undefined;
getInputFileNameFromOutput(outputFileName: string): string | undefined;
getOutputFilesFromReferencedProjectInput(inputFileName: string): typescript.OutputFile[];
buildReferences(): void;
ensureAllReferenceTimestamps(): void;
clearCache(): void;
close(): void;
}
export interface ConfigFileInfo {
config: typescript.ParsedCommandLine | undefined;
outputFileNames?: Map<FilePathKey, {
inputFileName: string;
outputNames: string[];
}>;
tsbuildInfoFile?: string;
dtsFiles?: string[];
}
interface CacheWithRedirects<T> {
ownMap: Map<string, T>;
redirectsMap: Map<typescript.Path, Map<string, T>>;
getOrCreateMapOfCacheRedirects(redirectedReference: typescript.ResolvedProjectReference | undefined): Map<string, T>;
clear(): void;
setOwnOptions(newOptions: typescript.CompilerOptions): void;
setOwnMap(newOwnMap: Map<string, T>): void;
}
interface PerModuleNameCache {
get(directory: string): typescript.ResolvedModuleWithFailedLookupLocations | undefined;
set(directory: string, result: typescript.ResolvedModuleWithFailedLookupLocations): void;
}
export interface ModuleResolutionCache extends typescript.ModuleResolutionCache {
directoryToModuleNameMap: CacheWithRedirects<Map<string, typescript.ResolvedModuleWithFailedLookupLocations>>;
moduleNameToDirectoryMap: CacheWithRedirects<PerModuleNameCache>;
clear(): void;
update(compilerOptions: typescript.CompilerOptions): void;
}
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>;
moduleResolutionCache?: ModuleResolutionCache;
typeReferenceResolutionCache?: typescript.TypeReferenceDirectiveResolutionCache;
/**
* 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;
configFilePath: string | undefined;
filePathKeyMapper: (fileName: string) => FilePathKey;
initialSetupPending: boolean;
configParseResult: typescript.ParsedCommandLine;
log: logger.Logger;
}
export interface LoaderOptionsCache {
[name: string]: WeakMap<LoaderOptions, LoaderOptions>;
}
export type DependencyGraph = Map<FilePathKey, ResolvedModule[]>;
export type ReverseDependencyGraph = Map<FilePathKey, Map<FilePathKey, true>>;
export type LogLevel = 'INFO' | 'WARN' | 'ERROR';
export type ResolveModuleName = (moduleName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost) => typescript.ResolvedModuleWithFailedLookupLocations;
export type CustomResolveModuleName = (moduleName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost, parentResolver: ResolveModuleName) => typescript.ResolvedModuleWithFailedLookupLocations;
export 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 | string)[];
appendTsxSuffixTo: (RegExp | string)[];
happyPackMode: boolean;
getCustomTransformers: string | ((program: typescript.Program, getProgram: () => 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 type TSFiles = Map<FilePathKey, TSFile>;
export interface ResolvedModule {
originalFileName: string;
resolvedFileName: string;
resolvedModule?: ResolvedModule;
isExternalLibraryImport?: boolean;
}
export interface TSCommon {
resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: typescript.CompilerOptions, host: typescript.ModuleResolutionHost, redirectedReference?: typescript.ResolvedProjectReference, cache?: typescript.TypeReferenceDirectiveResolutionCache, resolutionMode?: typescript.SourceFile['impliedNodeFormat']): typescript.ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
}
/**
* Compiler APIs we use that are marked internal and not included in TypeScript's public API declarations
* @internal
*/
export interface TSInternal {
getModeForFileReference?: (ref: typescript.FileReference | string, containingFileMode: typescript.SourceFile['impliedNodeFormat']) => typescript.SourceFile['impliedNodeFormat'];
}
export type Severity = 'error' | 'warning';
export {};
//# sourceMappingURL=interfaces.d.ts.map

File diff suppressed because one or more lines are too long

3
backend/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
backend/node_modules/ts-loader/dist/logger.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import type { Chalk } from 'chalk';
import type { LoaderOptions } from './interfaces';
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
backend/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,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIlD,KAAK,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
backend/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.LogLevel = void 0;
exports.makeLogger = makeLogger;
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 = 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),
};
}
//# sourceMappingURL=logger.js.map

7
backend/node_modules/ts-loader/dist/resolver.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import type * as webpack from 'webpack';
export declare function makeResolver(_options: webpack.WebpackOptionsNormalized): ResolveSync;
export type ResolveSync = {
(context: any, path: string, moduleName: string): string | false;
(path: string, moduleName: string): string | false;
};
//# sourceMappingURL=resolver.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAIxC,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,OAAO,CAAC,wBAAwB,GACzC,WAAW,CAMb;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IACjE,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;CACpD,CAAC"}

11
backend/node_modules/ts-loader/dist/resolver.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeResolver = makeResolver;
function makeResolver(_options) {
/* Currently, `enhanced-resolve` does not work properly alongside `ts-loader`.
* This feature is disabled until a proper worflow has been worked out. */
return (_context, _path, _moduleName) => {
throw new Error();
};
}
//# sourceMappingURL=resolver.js.map

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

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

View File

@@ -0,0 +1 @@
{"version":3,"file":"servicesHost.d.ts","sourceRoot":"","sources":["../src/servicesHost.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,UAAU,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAIxC,OAAO,KAAK,EAKV,WAAW,EACX,aAAa,EAIb,8BAA8B,EAC9B,4BAA4B,EAG5B,UAAU,EAIV,SAAS,EACV,MAAM,cAAc,CAAC;AAgHtB;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,EAC5C,QAAQ,EAAE,UAAU,EACpB,iBAAiB,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAC7D,8BAA8B,CAiGhC;AAkND,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,QAuBpC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,EAC5C,QAAQ,EAAE,UAAU,EACpB,iBAAiB,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC,aA6H/D;AA0DD;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,EAC5C,QAAQ,EAAE,UAAU,GACnB,4BAA4B,CAqe9B;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,0BAqBtE"}

810
backend/node_modules/ts-loader/dist/servicesHost.js generated vendored Normal file
View File

@@ -0,0 +1,810 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeServicesHost = makeServicesHost;
exports.updateFileWithText = updateFileWithText;
exports.makeWatchHost = makeWatchHost;
exports.makeSolutionBuilderHost = makeSolutionBuilderHost;
exports.getSolutionErrors = getSolutionErrors;
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 makeResolversAndModuleResolutionHost(scriptRegex, loader, instance, fileExists, 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 = (0, 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: () => (0, 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 readFile(filePath, encoding) {
return (instance.compiler.sys.readFile(filePath, encoding) ||
(0, utils_1.fsReadFile)(filePath, encoding));
}
function directoryExists(directoryName) {
return compiler.sys.directoryExists(directoryName);
}
function realpath(path) {
return compiler.sys.realpath(path);
}
function getDirectories(path) {
return compiler.sys.getDirectories(path);
}
function readDirectory(path, extensions, exclude, include, depth) {
return 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, resolveModuleNames, resolveTypeReferenceDirectives, } = makeResolversAndModuleResolutionHost(scriptRegex, loader, instance, filePathToCheck => compiler.sys.fileExists(filePathToCheck) ||
(0, 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) => {
var _a;
fileName = path.normalize(fileName);
const key = filePathKeyMapper(fileName);
const file = files.get(key);
if (file) {
return file.version.toString();
}
const outputFileAndKey = (_a = instance.solutionBuilderHost) === null || _a === void 0 ? void 0 : _a.getOutputFileAndKeyFromReferencedProject(fileName);
if (outputFileAndKey !== undefined) {
instance.solutionBuilderHost.outputAffectingInstanceVersion.set(outputFileAndKey.key, true);
}
return outputFileAndKey && outputFileAndKey.outputFile
? outputFileAndKey.outputFile
: '';
},
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.getOutputFileTextAndKeyFromReferencedProject(fileName);
if (outputFileAndKey !== undefined) {
instance.solutionBuilderHost.outputAffectingInstanceVersion.set(outputFileAndKey.key, true);
return outputFileAndKey && outputFileAndKey.text !== undefined
? compiler.ScriptSnapshot.fromString(outputFileAndKey.text)
: undefined;
}
}
const text = moduleResolutionHost.readFile(fileName);
if (text === undefined) {
return undefined;
}
file = { fileName, version: 0, text };
files.set(key, file);
}
return compiler.ScriptSnapshot.fromString(file.text);
},
...moduleResolutionHost,
getCompilationSettings: () => compilerOptions,
log: moduleResolutionHost.trace,
// used for (/// <reference types="...">) see https://github.com/Realytics/fork-ts-checker-webpack-plugin/pull/250#issuecomment-485061329
resolveTypeReferenceDirectives,
resolveModuleNames,
getCustomTransformers: () => instance.transformers,
};
return servicesHost;
}
function makeResolvers(compiler, compilerOptions, moduleResolutionHost, customResolveTypeReferenceDirective, customResolveModuleName, resolveSync, appendTsTsxSuffixesIfRequired, scriptRegex, instance) {
const resolveModuleName = makeResolveModuleName(compiler, compilerOptions, moduleResolutionHost, customResolveModuleName, instance);
const resolveModuleNames = (moduleNames, containingFile, _reusedNames, redirectedReference, _, containingSourceFile) => {
const resolvedModules = moduleNames.map(moduleName => resolveModule(resolveSync, resolveModuleName, appendTsTsxSuffixesIfRequired, scriptRegex, moduleName, containingFile, redirectedReference, containingSourceFile));
(0, utils_1.populateDependencyGraph)(resolvedModules, instance, containingFile);
return resolvedModules;
};
const resolveTypeReferenceDirective = makeResolveTypeReferenceDirective(compiler, compilerOptions, moduleResolutionHost, customResolveTypeReferenceDirective, instance);
const resolveTypeReferenceDirectives = (typeDirectiveNames, containingFile, redirectedReference, options, containingFileMode // new impliedNodeFormat is accepted by compilerHost
) => typeDirectiveNames.map(directive => resolveTypeReferenceDirective(directive, containingFile, options, redirectedReference, containingFileMode).resolvedTypeReferenceDirective);
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) {
(0, 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);
}
}
}
}
/**
* 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, resolveModuleNames, resolveTypeReferenceDirectives, } = makeResolversAndModuleResolutionHost(scriptRegex, loader, instance, fileName => files.has(filePathKeyMapper(fileName)) ||
compiler.sys.fileExists(fileName), instance.loaderOptions.experimentalFileCaching);
const watchHost = {
rootFiles: getRootFileNames(),
options: compilerOptions,
...moduleResolutionHost,
readFile: readFileWithCachingText,
watchFile: (fileName, callback, pollingInterval, options) => {
var _a;
const outputFileKey = (_a = instance.solutionBuilderHost) === null || _a === void 0 ? void 0 : _a.getOutputFileKeyFromReferencedProject(fileName);
if (!outputFileKey || outputFileKey === filePathKeyMapper(fileName)) {
return watchFile(fileName, callback, pollingInterval, options);
}
// Handle symlink to outputFile
const outputFileName = instance.solutionBuilderHost.realpath(fileName);
return watchFile(outputFileName, (_fileName, eventKind) => callback(fileName, eventKind), pollingInterval, options);
},
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 = moduleResolutionHost.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);
}
}
const missingFileModifiedTime = new Date(0);
function identity(x) {
return x;
}
function toLowerCase(x) {
return x.toLowerCase();
}
const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
function toFileNameLowerCase(x) {
return fileNameLowerCaseRegExp.test(x)
? x.replace(fileNameLowerCaseRegExp, toLowerCase)
: x;
}
function createGetCanonicalFileName(instance) {
return (0, utils_1.useCaseSensitiveFileNames)(instance.compiler, instance.loaderOptions)
? identity
: toFileNameLowerCase;
}
function createModuleResolutionCache(instance, moduleResolutionHost) {
const cache = instance.compiler.createModuleResolutionCache(moduleResolutionHost.getCurrentDirectory(), createGetCanonicalFileName(instance), instance.compilerOptions);
// Add new API optional methods
if (!cache.clear) {
cache.clear = () => {
cache.directoryToModuleNameMap.clear();
cache.moduleNameToDirectoryMap.clear();
};
}
if (!cache.update) {
cache.update = options => {
if (!options.configFile)
return;
const ref = {
sourceFile: options.configFile,
commandLine: { options },
};
cache.directoryToModuleNameMap.setOwnMap(cache.directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
cache.moduleNameToDirectoryMap.setOwnMap(cache.moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
cache.directoryToModuleNameMap.setOwnOptions(options);
cache.moduleNameToDirectoryMap.setOwnOptions(options);
};
}
return cache;
}
/**
* Create the TypeScript Watch host
*/
function makeSolutionBuilderHost(scriptRegex, loader, instance) {
const { compiler, loaderOptions: { 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 formatDiagnosticHost = {
getCurrentDirectory: compiler.sys.getCurrentDirectory,
getCanonicalFileName: createGetCanonicalFileName(instance),
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 inputFiles = new Map();
const writtenFiles = [];
const outputAffectingInstanceVersion = new Map();
let timeoutId;
const { resolveModuleNames, resolveTypeReferenceDirectives, moduleResolutionHost, } = makeResolversAndModuleResolutionHost(scriptRegex, loader, instance, fileName => {
const filePathKey = filePathKeyMapper(fileName);
return (instance.files.has(filePathKey) ||
instance.otherFiles.has(filePathKey) ||
compiler.sys.fileExists(fileName));
},
/*enableFileCaching*/ true);
const configFileInfo = new Map();
const allWatches = [];
const sysHost = compiler.createSolutionBuilderWithWatchHost(compiler.sys, compiler.createEmitAndSemanticDiagnosticsBuilderProgram, reportDiagnostic, reportSolutionBuilderStatus, reportWatchStatus);
// Keeps track of the various `typescript.CustomTransformers` for each program that is created.
const customTransformers = new Map();
// let lastBuilderProgram: typescript.CreateProgram | undefined = undefined;
const solutionBuilderHost = {
...sysHost,
...moduleResolutionHost,
createProgram: (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) => {
var _a, _b, _c, _d;
(_a = instance.moduleResolutionCache) === null || _a === void 0 ? void 0 : _a.update(options || {});
(_b = instance.typeReferenceResolutionCache) === null || _b === void 0 ? void 0 : _b.update(options || {});
const result = sysHost.createProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences);
(_c = instance.typeReferenceResolutionCache) === null || _c === void 0 ? void 0 : _c.update(instance.compilerOptions);
(_d = instance.moduleResolutionCache) === null || _d === void 0 ? void 0 : _d.update(instance.compilerOptions);
if (options) {
// The `configFilePath` is the same value that is used as the `project` parameter of
// `getCustomtransformers` below.
const project = options.configFilePath;
if (typeof project === "string") {
// Custom transformers need a reference to the `typescript.Program`, that reference is
// unavailable during the the `getCustomTransformers` callback below.
const transformers = (0, instances_1.getCustomTransformers)(instance.loaderOptions, result.getProgram(), result.getProgram);
customTransformers.set(project, transformers);
}
}
return result;
},
resolveModuleNames,
resolveTypeReferenceDirectives,
diagnostics,
...createWatchFactory(filePathKeyMapper, compiler),
getCustomTransformers: function (project) {
return customTransformers.get(project);
},
// Overrides
writeFile: (name, text, writeByteOrderMark) => {
var _a;
const key = filePathKeyMapper(name);
updateFileWithText(instance, key, name, () => text);
const existing = ensureOutputFile(name);
const hash = hashOutputText(text);
outputFiles.set(key, hash);
writtenFiles.push({
name,
text,
writeByteOrderMark: !!writeByteOrderMark,
});
compiler.sys.writeFile(name, text, writeByteOrderMark);
(_a = moduleResolutionHost.fileExistsCache) === null || _a === void 0 ? void 0 : _a.delete(name);
if (outputAffectingInstanceVersion.has(key) &&
(!existing || existing !== hash)) {
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 !== hash) {
instance.hasUnaccountedModifiedFiles =
instance.watchHost.invokeFileWatcher(name, compiler.FileWatcherEventKind.Changed) || instance.hasUnaccountedModifiedFiles;
}
}
},
createDirectory: sysHost.createDirectory &&
(directory => {
var _a;
sysHost.createDirectory(directory);
(_a = moduleResolutionHost.directoryExistsCache) === null || _a === void 0 ? void 0 : _a.delete(directory);
}),
afterProgramEmitAndDiagnostics: transpileOnly ? undefined : storeDtsFiles,
setTimeout: (callback, _time, ...args) => {
timeoutId = [callback, args];
return timeoutId;
},
clearTimeout: _timeoutId => {
timeoutId = undefined;
},
getParsedCommandLine: file => {
const config = (0, config_1.getParsedCommandLine)(compiler, instance.loaderOptions, file);
configFileInfo.set(filePathKeyMapper(file), { config });
return config;
},
writtenFiles,
configFileInfo,
outputAffectingInstanceVersion,
getInputFileStamp,
updateSolutionBuilderInputFile,
getOutputFileKeyFromReferencedProject,
getOutputFileAndKeyFromReferencedProject,
getOutputFileTextAndKeyFromReferencedProject,
getInputFileNameFromOutput: fileName => {
const result = getInputFileNameFromOutput(fileName);
return typeof result === 'string' ? result : undefined;
},
getOutputFilesFromReferencedProjectInput,
buildReferences,
ensureAllReferenceTimestamps,
clearCache,
close,
};
return solutionBuilderHost;
function close() {
allWatches.slice().forEach(w => w.close());
}
function clearCache() {
moduleResolutionHost.clearCache();
outputFiles.clear();
inputFiles.clear();
}
function buildReferences() {
if (!timeoutId) {
ensureAllReferenceTimestamps();
return;
}
diagnostics.global.length = 0;
diagnostics.perFile.clear();
diagnostics.transpileErrors.length = 0;
while (timeoutId) {
const [callback, args] = timeoutId;
timeoutId = undefined;
callback(...args);
}
ensureAllReferenceTimestamps();
}
function ensureAllReferenceTimestamps() {
if (inputFiles.size !== solutionBuilderHost.watchedFiles.size) {
for (const { fileName, } of instance.solutionBuilderHost.watchedFiles.values()) {
instance.solutionBuilderHost.getInputFileStamp(fileName);
}
}
}
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.some(outputName => resolvedFileName === filePathKeyMapper(outputName))) {
return inputFileName;
}
}
}
if (configInfo.tsbuildInfoFile &&
filePathKeyMapper(configInfo.tsbuildInfoFile) === resolvedFileName) {
return true;
}
}
const realPath = solutionBuilderHost.realpath(outputFileName);
return filePathKeyMapper(realPath) !== resolvedFileName
? getInputFileNameFromOutput(realPath)
: 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: (0, instances_1.getOutputFileNames)(instance, configInfo.config, inputFile),
}));
configInfo.tsbuildInfoFile = instance.compiler
.getTsBuildInfoEmitOutputFilePath
? instance.compiler.getTsBuildInfoEmitOutputFilePath(configInfo.config.options)
: // before api
instance.compiler.getOutputPathForBuildInfo(configInfo.config.options);
}
function getOutputFileAndKeyFromReferencedProject(outputFileName) {
const outputFile = ensureOutputFile(outputFileName);
return outputFile !== undefined
? {
key: getOutputFileKeyFromReferencedProject(outputFileName),
outputFile,
}
: undefined;
}
function getOutputFileTextAndKeyFromReferencedProject(outputFileName) {
const key = getOutputFileKeyFromReferencedProject(outputFileName);
if (!key) {
return undefined;
}
const file = writtenFiles.find(w => filePathKeyMapper(w.name) === key);
if (file) {
return { key, text: file.text };
}
const outputFile = outputFiles.get(key);
return {
key,
text: outputFile !== false
? compiler.sys.readFile(outputFileName)
: undefined,
};
}
function getOutputFileKeyFromReferencedProject(outputFileName) {
const key = filePathKeyMapper(outputFileName);
if (outputFiles.has(key))
return key;
const realKey = filePathKeyMapper(solutionBuilderHost.realpath(outputFileName));
if (realKey !== key && outputFiles.has(realKey))
return realKey;
return getInputFileNameFromOutput(outputFileName) ? realKey : undefined;
}
function hashOutputText(text) {
return compiler.sys.createHash ? compiler.sys.createHash(text) : text;
}
function ensureOutputFile(outputFileName) {
const key = getOutputFileKeyFromReferencedProject(outputFileName);
if (!key) {
return undefined;
}
const outputFile = outputFiles.get(key);
if (outputFile !== undefined) {
return outputFile;
}
if (!getInputFileNameFromOutput(outputFileName)) {
return undefined;
}
const text = compiler.sys.readFile(outputFileName);
const hash = text === undefined ? false : hashOutputText(text);
outputFiles.set(key, hash);
return hash;
}
function getTypeScriptOutputFile(outputFileName) {
const key = filePathKeyMapper(outputFileName);
const writtenFile = writtenFiles.find(w => filePathKeyMapper(w.name) === key);
if (writtenFile)
return writtenFile;
// Read from sys
const text = compiler.sys.readFile(outputFileName);
return text !== undefined
? {
name: outputFileName,
text,
writeByteOrderMark: false,
}
: undefined;
}
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(getTypeScriptOutputFile)
.filter(output => !!output);
}
}
}
return [];
}
function getInputFileStamp(fileName) {
const key = filePathKeyMapper(fileName);
const existing = inputFiles.get(key);
if (existing !== undefined) {
return existing;
}
const time = compiler.sys.getModifiedTime(fileName) || missingFileModifiedTime;
inputFiles.set(key, time);
return time;
}
function updateSolutionBuilderInputFile(fileName) {
const key = filePathKeyMapper(fileName);
const existing = inputFiles.get(key) || missingFileModifiedTime;
const newTime = compiler.sys.getModifiedTime(fileName) || missingFileModifiedTime;
if (existing.getTime() === newTime.getTime()) {
return;
}
const eventKind = existing == missingFileModifiedTime
? compiler.FileWatcherEventKind.Created
: newTime === missingFileModifiedTime
? compiler.FileWatcherEventKind.Deleted
: compiler.FileWatcherEventKind.Changed;
solutionBuilderHost.invokeFileWatcher(fileName, eventKind);
}
}
function getSolutionErrors(instance, context) {
const solutionErrors = [];
if (instance.solutionBuilderHost &&
instance.solutionBuilderHost.diagnostics.transpileErrors.length) {
instance.solutionBuilderHost.diagnostics.transpileErrors.forEach(([filePath, errors]) => solutionErrors.push(...(0, utils_1.formatErrors)(errors, instance.loaderOptions, instance.colors, instance.compiler, { file: filePath ? undefined : 'tsconfig.json' }, context)));
}
return solutionErrors;
}
function makeResolveTypeReferenceDirective(compiler, compilerOptions, moduleResolutionHost, customResolveTypeReferenceDirective, instance) {
var _a, _b;
if (customResolveTypeReferenceDirective === undefined) {
// Until the api is published
if (compiler.createTypeReferenceDirectiveResolutionCache !== undefined &&
!instance.typeReferenceResolutionCache) {
instance.typeReferenceResolutionCache =
compiler.createTypeReferenceDirectiveResolutionCache(moduleResolutionHost.getCurrentDirectory(), createGetCanonicalFileName(instance), instance.compilerOptions, (_b = (_a = instance.moduleResolutionCache) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.call(_a));
}
return (typeDirectiveName, containingFile, options, redirectedReference, containingFileMode) => {
// Copy-pasted from https://github.com/TypeStrong/ts-node/blob/9f789d0d91c6eba30ac7f7aad45194a23b44f159/src/resolver-functions.ts#L139
const nameIsString = typeof typeDirectiveName === 'string';
const mode = nameIsString
? undefined
: compiler.getModeForFileReference(typeDirectiveName, containingFileMode);
const strName = nameIsString
? typeDirectiveName
: typeDirectiveName.fileName.toLowerCase();
return compiler.resolveTypeReferenceDirective(strName, containingFile, options, moduleResolutionHost, redirectedReference, undefined, mode);
};
}
return (directive, containingFile) => customResolveTypeReferenceDirective(directive, // unsure whether we should evolve this further
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, redirectedReference, containingSourceFile) {
let resolutionResult;
try {
const originalFileName = resolveSync(path.normalize(path.dirname(containingFile)), moduleName);
if (originalFileName) {
const resolvedFileName = appendTsTsxSuffixesIfRequired(originalFileName);
if (resolvedFileName.match(scriptRegex) !== null) {
resolutionResult = { resolvedFileName, originalFileName };
}
}
}
catch (e) { }
const tsResolution = resolveModuleName(moduleName, containingFile, redirectedReference, containingSourceFile);
if (tsResolution.resolvedModule !== undefined) {
const resolvedFileName = path.normalize(tsResolution.resolvedModule.resolvedFileName);
const tsResolutionResult = {
...tsResolution.resolvedModule,
originalFileName: resolvedFileName,
resolvedFileName,
};
return resolutionResult === undefined ||
resolutionResult.resolvedFileName ===
tsResolutionResult.resolvedFileName ||
isJsImplementationOfTypings(resolutionResult, tsResolutionResult)
? tsResolutionResult
: resolutionResult;
}
return resolutionResult;
}
function makeResolveModuleName(compiler, compilerOptions, moduleResolutionHost, customResolveModuleName, instance) {
if (customResolveModuleName === undefined) {
if (!instance.moduleResolutionCache) {
instance.moduleResolutionCache = createModuleResolutionCache(instance, moduleResolutionHost);
}
return (moduleName, containingFileName, redirectedReference, containingFile) => compiler.resolveModuleName(moduleName, containingFileName, compilerOptions, moduleResolutionHost, instance.moduleResolutionCache, redirectedReference, containingFile === null || containingFile === void 0 ? void 0 : containingFile.impliedNodeFormat);
}
return (moduleName, containingFile) => customResolveModuleName(moduleName, containingFile, compilerOptions, moduleResolutionHost, compiler.resolveModuleName);
}
function addCache(host) {
host.fileExists = createCache(host.fileExists, (host.fileExistsCache = new Map()));
host.directoryExists = createCache(host.directoryExists, (host.directoryExistsCache = new Map()));
host.realpath =
host.realpath &&
createCache(host.realpath, (host.realpathCache = new Map()));
host.clearCache = clearCache;
function createCache(originalFunction, cache) {
return function getCached(arg) {
let res = cache.get(arg);
if (res !== undefined) {
return res;
}
res = originalFunction(arg);
cache.set(arg, res);
return res;
};
}
function clearCache() {
var _a, _b, _c;
(_a = host.fileExistsCache) === null || _a === void 0 ? void 0 : _a.clear();
(_b = host.directoryExistsCache) === null || _b === void 0 ? void 0 : _b.clear();
(_c = host.realpathCache) === null || _c === void 0 ? void 0 : _c.clear();
}
}
//# sourceMappingURL=servicesHost.js.map

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":""}

View File

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

32
backend/node_modules/ts-loader/dist/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import type { Chalk } from 'chalk';
import * as webpack from 'webpack';
import type * as typescript from 'typescript';
import type { FileLocation, FilePathKey, LoaderOptions, ResolvedModule, ReverseDependencyGraph, TSInstance } 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?: webpack.Module;
}, context: string): webpack.WebpackError[];
export declare function fsReadFile(fileName: string, encoding?: BufferEncoding | undefined): string | undefined;
export declare function makeError(loaderOptions: LoaderOptions, message: string, file: string, location?: FileLocation, endLocation?: FileLocation): webpack.WebpackError;
export declare function tsLoaderSource(loaderOptions: LoaderOptions): string;
export declare function appendSuffixIfMatch(patterns: (RegExp | string)[], filePath: string, suffix: string): string;
export declare function appendSuffixesIfMatch(suffixDict: {
[suffix: string]: (RegExp | string)[];
}, 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 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
backend/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,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,KAAK,UAAU,MAAM,YAAY,CAAC;AAG9C,OAAO,KAAK,EAEV,YAAY,EACZ,WAAW,EACX,aAAa,EACb,cAAc,EACd,sBAAsB,EAEtB,UAAU,EACX,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,OAAO,CAAC,MAAM,CAAA;CAAE,EACjD,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,EAAE,CA8DxB;AAuBD,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,cAAc,GAAG,SAAkB,sBAQ9C;AAED,wBAAgB,SAAS,CACvB,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,YAAY,EACvB,WAAW,CAAC,EAAE,YAAY,GACzB,OAAO,CAAC,YAAY,CAoBtB;AAuBD,wBAAgB,cAAc,CAAC,aAAa,EAAE,aAAa,UAE1D;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAC7B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,MAAM,CASR;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;CAAE,EACrD,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,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"}

249
backend/node_modules/ts-loader/dist/utils.js generated vendored Normal file
View File

@@ -0,0 +1,249 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatErrors = formatErrors;
exports.fsReadFile = fsReadFile;
exports.makeError = makeError;
exports.tsLoaderSource = tsLoaderSource;
exports.appendSuffixIfMatch = appendSuffixIfMatch;
exports.appendSuffixesIfMatch = appendSuffixesIfMatch;
exports.unorderedRemoveItem = unorderedRemoveItem;
exports.populateDependencyGraph = populateDependencyGraph;
exports.populateReverseDependencyGraph = populateReverseDependencyGraph;
exports.collectAllDependants = collectAllDependants;
exports.arrify = arrify;
exports.ensureProgram = ensureProgram;
exports.supportsSolutionBuild = supportsSolutionBuild;
exports.isReferencedFile = isReferencedFile;
exports.useCaseSensitiveFileNames = useCaseSensitiveFileNames;
const fs = require("fs");
const micromatch = require("micromatch");
const path = require("path");
const webpack = require("webpack");
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 { start, end } = file === undefined || diagnostic.start === undefined
? { start: undefined, end: undefined }
: getFileLocations(file, diagnostic.start, diagnostic.length);
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: start === undefined ? 0 : start.line,
character: start === undefined ? 0 : start.character,
context,
};
const message = loaderOptions.errorFormatter === undefined
? defaultErrorFormatter(errorInfo, colors)
: loaderOptions.errorFormatter(errorInfo, colors);
const error = makeError(loaderOptions, message, merge.file === undefined ? errorInfo.file : merge.file, start, end);
return Object.assign(error, merge);
});
}
function getFileLocations(file, position, length = 0) {
const startLC = file.getLineAndCharacterOfPosition(position);
const start = {
line: startLC.line + 1,
character: startLC.character + 1,
};
const endLC = length > 0
? file.getLineAndCharacterOfPosition(position + length)
: undefined;
const end = endLC === undefined
? undefined
: { line: endLC.line + 1, character: endLC.character + 1 };
return { start, end };
}
function fsReadFile(fileName, encoding = 'utf8') {
fileName = path.normalize(fileName);
try {
return fs.readFileSync(fileName, encoding);
}
catch (e) {
return undefined;
}
}
function makeError(loaderOptions, message, file, location, endLocation) {
const error = new webpack.WebpackError(message);
error.file = file;
error.loc =
location === undefined
? { name: file }
: makeWebpackLocation(location, endLocation);
error.details = tsLoaderSource(loaderOptions);
return error;
// return {
// message,
// file,
// loc:
// location === undefined
// ? { name: file }
// : makeWebpackLocation(location, endLocation),
// details: tsLoaderSource(loaderOptions),
// };
}
function makeWebpackLocation(location, endLocation) {
const start = {
line: location.line,
column: location.character - 1,
};
const end = endLocation === undefined
? undefined
: { line: endLocation.line, column: endLocation.character - 1 };
return { start, end };
}
function tsLoaderSource(loaderOptions) {
return `ts-loader-${loaderOptions.instance}`;
}
function appendSuffixIfMatch(patterns, filePath, suffix) {
if (patterns.length > 0) {
for (const regexp of patterns) {
if (filePath.match(regexp) !== null) {
return filePath + suffix;
}
}
}
return filePath;
}
function appendSuffixesIfMatch(suffixDict, filePath) {
let amendedPath = filePath;
for (const suffix in suffixDict) {
amendedPath = appendSuffixIfMatch(suffixDict[suffix], amendedPath, suffix);
}
return amendedPath;
}
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;
}
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);
}
}
function populateReverseDependencyGraph(instance) {
const reverseDependencyGraph = new Map();
for (const [fileKey, resolvedModules] of instance.dependencyGraph.entries()) {
const inputFileName = instance.solutionBuilderHost &&
(0, instances_1.getInputFileNameFromOutput)(instance, fileKey);
const containingFileKey = inputFileName
? instance.filePathKeyMapper(inputFileName)
: fileKey;
resolvedModules.forEach(({ resolvedFileName }) => {
const key = instance.filePathKeyMapper(instance.solutionBuilderHost
? (0, 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;
}
/**
* 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;
}
function arrify(val) {
if (val === null || val === undefined) {
return [];
}
return Array.isArray(val) ? val : [val];
}
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;
}
function supportsSolutionBuild(instance) {
return (!!instance.configFilePath &&
!!instance.loaderOptions.projectReferences &&
!!instance.configParseResult.projectReferences &&
!!instance.configParseResult.projectReferences.length);
}
function isReferencedFile(instance, filePath) {
return (!!instance.solutionBuilderHost &&
!!instance.solutionBuilderHost.watchedFiles.get(instance.filePathKeyMapper(filePath)));
}
function useCaseSensitiveFileNames(compiler, loaderOptions) {
return loaderOptions.useCaseSensitiveFileNames !== undefined
? loaderOptions.useCaseSensitiveFileNames
: compiler.sys.useCaseSensitiveFileNames;
}
//# sourceMappingURL=utils.js.map

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

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

View File

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

93
backend/node_modules/ts-loader/dist/watch-run.js generated vendored Normal file
View File

@@ -0,0 +1,93 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeWatchRun = makeWatchRun;
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, _d, _e, _f;
(_b = (_a = instance.servicesHost) === null || _a === void 0 ? void 0 : _a.clearCache) === null || _b === void 0 ? void 0 : _b.call(_a);
(_d = (_c = instance.watchHost) === null || _c === void 0 ? void 0 : _c.clearCache) === null || _d === void 0 ? void 0 : _d.call(_c);
(_e = instance.moduleResolutionCache) === null || _e === void 0 ? void 0 : _e.clear();
(_f = instance.typeReferenceResolutionCache) === null || _f === void 0 ? void 0 : _f.clear();
const promises = [];
if (instance.loaderOptions.transpileOnly) {
instance.reportTranspileErrors = true;
}
else {
const times = compiler.fileTimestamps;
if (times) {
for (const [filePath, date] of times) {
const key = instance.filePathKeyMapper(filePath);
const lastTime = lastTimes.get(key) || startTime;
if (!date ||
date === 'ignore' ||
(date.timestamp || date.safeTime) <= lastTime) {
continue;
}
lastTimes.set(key, date.timestamp || date.safeTime);
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 { fileName, } of instance.solutionBuilderHost.watchedFiles.values()) {
instance.solutionBuilderHost.updateSolutionBuilderInputFile(fileName);
}
instance.solutionBuilderHost.clearCache();
}
Promise.all(promises)
.then(() => callback())
.catch(err => callback(err));
};
}
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);
(0, servicesHost_1.updateFileWithText)(instance, key, filePath, () => text);
resolve();
}
});
}
else {
(0, servicesHost_1.updateFileWithText)(instance, key, filePath, nFilePath => (0, utils_1.fsReadFile)(nFilePath) || '');
resolve();
}
});
}
//# sourceMappingURL=watch-run.js.map