From 95050eb4011af3203eb78edde3358d8df17cc7a4 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Sat, 24 Oct 2020 04:23:12 -0700 Subject: [PATCH] Speeds up project reference build and doesnt store the result in memory (#1202) * Output files are on disk so dont store their text in memory * Get rid of version from output * remove time * Since the files are on disk, dont read them unless needed. * add to CHANGELOG Co-authored-by: John Reilly --- CHANGELOG.md | 3 + package.json | 2 +- src/index.ts | 51 +- src/instances.ts | 24 +- src/interfaces.ts | 32 +- src/servicesHost.ts | 655 +++++++----------- src/utils.ts | 16 - src/watch-run.ts | 11 +- .../patch3/app/bundle.js | 137 ---- .../patch3/output.txt | 4 +- .../patch4/app/bundle.js | 137 ---- .../patch4/output.txt | 2 +- .../patch5/app/bundle.js | 137 ---- .../patch5/output.txt | 4 +- .../patch6/app/bundle.js | 137 ---- .../patch6/output.txt | 2 +- .../patch2/bundle.js | 113 --- .../patch2/output.txt | 8 +- .../patch2/bundle.js | 113 --- .../patch2/output.txt | 8 +- .../patch2/bundle.js | 113 --- .../patch2/output.txt | 8 +- 22 files changed, 306 insertions(+), 1411 deletions(-) delete mode 100644 test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch3/app/bundle.js delete mode 100644 test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch4/app/bundle.js delete mode 100644 test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch5/app/bundle.js delete mode 100644 test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch6/app/bundle.js delete mode 100644 test/comparison-tests/projectReferencesWatch/expectedOutput-transpile-4.0/patch2/bundle.js delete mode 100644 test/comparison-tests/projectReferencesWatch_Composite_WatchApi/expectedOutput-transpile-4.0/patch2/bundle.js delete mode 100644 test/comparison-tests/projectReferencesWatch_WatchApi/expectedOutput-transpile-4.0/patch2/bundle.js diff --git a/CHANGELOG.md b/CHANGELOG.md index d803cb168..5eead78f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## v8.0.7 +* [Speeds up project reference build and doesnt store the result in memory](https://github.com/TypeStrong/ts-loader/pull/1202) - thanks @sheetalkamat + ## v8.0.6 * [Fixed further deprecation warning on webpack@5](https://github.com/TypeStrong/ts-loader/issues/1196) - thanks @appzuka diff --git a/package.json b/package.json index 96cfa1195..f9ffda999 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ts-loader", - "version": "8.0.6", + "version": "8.0.7", "description": "TypeScript loader for webpack", "main": "index.js", "types": "dist", diff --git a/src/index.ts b/src/index.ts index 8282e9d21..37af8a480 100644 --- a/src/index.ts +++ b/src/index.ts @@ -329,27 +329,18 @@ function updateFileInCache( instance.changedFilesList = true; } } else { - if ( - instance.watchHost !== undefined || - instance.solutionBuilderHost !== undefined - ) { + if (instance.watchHost !== undefined) { fileWatcherEventKind = instance.compiler.FileWatcherEventKind.Created; } file = { fileName: filePath, version: 0 }; if (!isReferencedFile(instance, filePath)) { instance.files.set(key, file); instance.changedFilesList = true; - } else { - instance.otherFiles.set(key, file); } } } - if ( - (instance.watchHost !== undefined || - instance.solutionBuilderHost !== undefined) && - contents === undefined - ) { + if (instance.watchHost !== undefined && contents === undefined) { fileWatcherEventKind = instance.compiler.FileWatcherEventKind.Deleted; } @@ -376,8 +367,7 @@ function updateFileInCache( file.modifiedTime = new Date(); instance.version++; if ( - (instance.watchHost !== undefined || - instance.solutionBuilderHost !== undefined) && + instance.watchHost !== undefined && fileWatcherEventKind === undefined ) { fileWatcherEventKind = instance.compiler.FileWatcherEventKind.Changed; @@ -395,16 +385,6 @@ function updateFileInCache( instance.hasUnaccountedModifiedFiles; } - if ( - instance.solutionBuilderHost !== undefined && - fileWatcherEventKind !== undefined - ) { - instance.solutionBuilderHost.invokeFileWatcher( - filePath, - fileWatcherEventKind - ); - } - // push this file to modified files hash. if (!instance.modifiedFiles) { instance.modifiedFiles = new Map(); @@ -438,10 +418,9 @@ function getEmit( defFilePath.match(constants.dtsDtsxOrDtsDtsxMapRegex) && // Remove the project reference d.ts as we are adding dependency for .ts later // This removed extra build pass (resulting in new stats object in initial build) - (!instance.solutionBuilderHost || - !instance.solutionBuilderHost.getOutputFileKeyFromReferencedProject( - defFilePath - )) + !instance.solutionBuilderHost?.getOutputFileKeyFromReferencedProject( + defFilePath + ) ) { addDependency(defFilePath); } @@ -469,12 +448,18 @@ function getEmit( defFilePath => path.relative(loaderContext.rootContext, defFilePath) + '@' + - ( - instance.files.get(instance.filePathKeyMapper(defFilePath)) || - instance.otherFiles.get(instance.filePathKeyMapper(defFilePath)) || { - version: '?', - } - ).version + (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); diff --git a/src/instances.ts b/src/instances.ts index 769e023f3..0078a5aaa 100644 --- a/src/instances.ts +++ b/src/instances.ts @@ -507,7 +507,7 @@ export function buildSolutionReferences( { verbose: true } ); solutionBuilder.build(); - ensureAllReferences(instance); + instance.solutionBuilderHost.ensureAllReferenceTimestamps(); instancesBySolutionBuilderConfigs.set( instance.filePathKeyMapper(instance.configFilePath!), instance @@ -517,28 +517,6 @@ export function buildSolutionReferences( } } -function ensureAllReferences(instance: TSInstance) { - // Return result from the json without errors so that the extra errors from config are digested here - for (const configInfo of instance.solutionBuilderHost!.configFileInfo.values()) { - if (!configInfo.config) { - continue; - } - // Load all the input files - configInfo.config.fileNames.forEach(file => { - const resolvedFileName = instance.filePathKeyMapper(file); - const existing = instance.otherFiles.get(resolvedFileName); - if (!existing) { - instance.otherFiles.set(resolvedFileName, { - fileName: path.resolve(file), - version: 1, - text: instance.compiler.sys.readFile(file), - modifiedTime: instance.compiler.sys.getModifiedTime!(file), - }); - } - }); - } -} - export function forEachResolvedProjectReference( resolvedProjectReferences: | readonly (typescript.ResolvedProjectReference | undefined)[] diff --git a/src/interfaces.ts b/src/interfaces.ts index 20e2887c9..53c48423f 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -42,10 +42,11 @@ export type ResolveSync = ( moduleName: string ) => string; -export type Action = () => void; - export interface HostMayBeCacheable { - clearCache?: Action; + clearCache?(): void; + fileExistsCache?: Map; + directoryExistsCache?: Map; + realpathCache?: Map; } export interface CacheableHost extends HostMayBeCacheable { @@ -130,39 +131,40 @@ export interface SolutionBuilderWithWatchHost >, WatchFactory { diagnostics: SolutionDiagnostics; - writtenFiles: OutputFile[]; + writtenFiles: typescript.OutputFile[]; configFileInfo: Map; outputAffectingInstanceVersion: Map; + getInputFileStamp(fileName: string): Date; + updateSolutionBuilderInputFile(fileName: string): void; getOutputFileKeyFromReferencedProject( outputFileName: string ): FilePathKey | undefined; - getOutputFileFromReferencedProject( - outputFileName: string - ): OutputFile | false | undefined; getOutputFileAndKeyFromReferencedProject( oututFileName: string - ): { key: FilePathKey; outputFile: OutputFile | false } | undefined; + ): { key: FilePathKey; outputFile: string | false } | undefined; + getOutputFileTextAndKeyFromReferencedProject( + oututFileName: string + ): { key: FilePathKey; text: string | undefined } | undefined; getInputFileNameFromOutput(outputFileName: string): string | undefined; - getOutputFilesFromReferencedProjectInput(inputFileName: string): OutputFile[]; + 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: FilePathKey[] } + { inputFileName: string; outputNames: string[] } >; tsbuildInfoFile?: string; dtsFiles?: string[]; } -export interface OutputFile extends typescript.OutputFile { - time: Date; - version: number; -} - export interface TSInstance { compiler: typeof typescript; compilerOptions: typescript.CompilerOptions; diff --git a/src/servicesHost.ts b/src/servicesHost.ts index 9ecf3a6dd..a2bc008b9 100644 --- a/src/servicesHost.ts +++ b/src/servicesHost.ts @@ -5,20 +5,17 @@ import { getParsedCommandLine } from './config'; import * as constants from './constants'; import { getOutputFileNames } from './instances'; import { - Action, CacheableHost, ConfigFileInfo, CustomResolveModuleName, CustomResolveTypeReferenceDirective, FilePathKey, ModuleResolutionHostMayBeCacheable, - OutputFile, ResolvedModule, ResolveSync, ServiceHostWhichMayBeCacheable, SolutionBuilderWithWatchHost, SolutionDiagnostics, - TSFile, TSInstance, WatchCallbacks, WatchFactory, @@ -27,7 +24,6 @@ import { } from './interfaces'; import { makeResolver } from './resolver'; import { - ensureTrailingDirectorySeparator, formatErrors, fsReadFile, populateDependencyGraph, @@ -35,11 +31,11 @@ import { useCaseSensitiveFileNames, } from './utils'; -function makeResolversHandlingProjectReferences( +function makeResolversAndModuleResolutionHost( scriptRegex: RegExp, loader: webpack.loader.LoaderContext, instance: TSInstance, - originalFileExists: (fileName: string) => boolean, + fileExists: (fileName: string) => boolean, enableFileCaching: boolean ) { const { @@ -97,26 +93,10 @@ function makeResolversHandlingProjectReferences( instance ); - function fileExists(filePathToCheck: string) { - const outputFile = instance.solutionBuilderHost?.getOutputFileFromReferencedProject( - filePathToCheck - ); - if (outputFile !== undefined) { - return !!outputFile; - } - return originalFileExists(filePathToCheck); - } - function readFile( filePath: string, encoding?: string | undefined ): string | undefined { - const outputFile = instance.solutionBuilderHost?.getOutputFileFromReferencedProject( - filePath - ); - if (outputFile !== undefined) { - return outputFile ? outputFile.text : undefined; - } return ( instance.compiler.sys.readFile(filePath, encoding) || fsReadFile(filePath, encoding) @@ -124,21 +104,15 @@ function makeResolversHandlingProjectReferences( } function directoryExists(directoryName: string) { - return instance.solutionBuilderHost - ? instance.solutionBuilderHost.directoryExists!(directoryName) - : compiler.sys.directoryExists(directoryName); + return compiler.sys.directoryExists(directoryName); } function realpath(path: string) { - return instance.solutionBuilderHost - ? instance.solutionBuilderHost.realpath!(path) - : compiler.sys.realpath!(path); + return compiler.sys.realpath!(path); } function getDirectories(path: string) { - return instance.solutionBuilderHost - ? instance.solutionBuilderHost.getDirectories!(path) - : compiler.sys.getDirectories(path); + return compiler.sys.getDirectories(path); } function readDirectory( @@ -148,15 +122,13 @@ function makeResolversHandlingProjectReferences( include?: readonly string[], depth?: number ) { - return instance.solutionBuilderHost - ? instance.solutionBuilderHost.readDirectory!( - path, - extensions, - exclude, - include, - depth - ) - : compiler.sys.readDirectory(path, extensions, exclude, include, depth); + return compiler.sys.readDirectory( + path, + extensions, + exclude, + include, + depth + ); } } @@ -172,23 +144,10 @@ export function makeServicesHost( const { compiler, compilerOptions, files, filePathKeyMapper } = instance; const { - moduleResolutionHost: { - fileExists, - readFile, - trace, - directoryExists, - realpath, - getCurrentDirectory, - getDirectories, - clearCache, - useCaseSensitiveFileNames, - getNewLine, - getDefaultLibFileName, - readDirectory, - }, + moduleResolutionHost, resolveModuleNames, resolveTypeReferenceDirectives, - } = makeResolversHandlingProjectReferences( + } = makeResolversAndModuleResolutionHost( scriptRegex, loader, instance, @@ -215,11 +174,10 @@ export function makeServicesHost( if (file) { return file.version.toString(); } - const outputFileAndKey = - instance.solutionBuilderHost && - instance.solutionBuilderHost.getOutputFileAndKeyFromReferencedProject( - fileName - ); + + const outputFileAndKey = instance.solutionBuilderHost?.getOutputFileAndKeyFromReferencedProject( + fileName + ); if (outputFileAndKey !== undefined) { instance.solutionBuilderHost!.outputAffectingInstanceVersion.set( outputFileAndKey.key, @@ -227,7 +185,7 @@ export function makeServicesHost( ); } return outputFileAndKey && outputFileAndKey.outputFile - ? outputFileAndKey.outputFile.version.toString() + ? outputFileAndKey.outputFile : ''; }, @@ -240,7 +198,7 @@ export function makeServicesHost( if (file === undefined) { if (instance.solutionBuilderHost) { - const outputFileAndKey = instance.solutionBuilderHost.getOutputFileAndKeyFromReferencedProject( + const outputFileAndKey = instance.solutionBuilderHost.getOutputFileTextAndKeyFromReferencedProject( fileName ); if (outputFileAndKey !== undefined) { @@ -248,15 +206,13 @@ export function makeServicesHost( outputFileAndKey.key, true ); - return outputFileAndKey && outputFileAndKey.outputFile - ? compiler.ScriptSnapshot.fromString( - outputFileAndKey.outputFile.text - ) + return outputFileAndKey && outputFileAndKey.text !== undefined + ? compiler.ScriptSnapshot.fromString(outputFileAndKey.text) : undefined; } } - const text = readFile(fileName); + const text = moduleResolutionHost.readFile(fileName); if (text === undefined) { return undefined; } @@ -267,42 +223,15 @@ export function makeServicesHost( return compiler.ScriptSnapshot.fromString(file.text!); }, - - /** - * getDirectories is also required for full import and type reference completions. - * Without it defined, certain completions will not be provided - */ - getDirectories, - - /** - * For @types expansion, these two functions are needed. - */ - directoryExists, - - useCaseSensitiveFileNames, - - realpath, - - // The following three methods are necessary for @types resolution from TS 2.4.1 onwards see: https://github.com/Microsoft/TypeScript/issues/16772 - fileExists, - readFile, - readDirectory, - - getCurrentDirectory, - + ...moduleResolutionHost, getCompilationSettings: () => compilerOptions, - getDefaultLibFileName, - getNewLine, - trace, - log: trace, + log: moduleResolutionHost.trace, // used for (/// ) see https://github.com/Realytics/fork-ts-checker-webpack-plugin/pull/250#issuecomment-485061329 resolveTypeReferenceDirectives, - resolveModuleNames, getCustomTransformers: () => instance.transformers, - clearCache, }; return servicesHost; @@ -528,12 +457,6 @@ export function updateFileWithText( instance.compiler.FileWatcherEventKind.Changed ); } - if (instance.solutionBuilderHost !== undefined) { - instance.solutionBuilderHost.invokeFileWatcher( - nFilePath, - instance.compiler.FileWatcherEventKind.Changed - ); - } } } } @@ -560,29 +483,16 @@ export function makeWatchHost( compiler ); const { - moduleResolutionHost: { - fileExists, - readFile, - trace, - directoryExists, - realpath, - getCurrentDirectory, - getDirectories, - useCaseSensitiveFileNames, - getNewLine, - getDefaultLibFileName, - readDirectory, - }, + moduleResolutionHost, resolveModuleNames, resolveTypeReferenceDirectives, - } = makeResolversHandlingProjectReferences( + } = makeResolversAndModuleResolutionHost( scriptRegex, loader, instance, - (fileName: string) => { - const filePath = filePathKeyMapper(fileName); - return files.has(filePath) || compiler.sys.fileExists(filePath); - }, + fileName => + files.has(filePathKeyMapper(fileName)) || + compiler.sys.fileExists(fileName), /*enabledCaching*/ false ); @@ -590,40 +500,25 @@ export function makeWatchHost( rootFiles: getRootFileNames(), options: compilerOptions, - useCaseSensitiveFileNames, - getNewLine, - getCurrentDirectory, - getDefaultLibFileName, - - fileExists, + ...moduleResolutionHost, readFile: readFileWithCachingText, - directoryExists, - getDirectories, - readDirectory, - realpath, - trace, watchFile: (fileName, callback, pollingInterval, options) => { - const outputFileAndKey = instance.solutionBuilderHost?.getOutputFileAndKeyFromReferencedProject( + const outputFileKey = instance.solutionBuilderHost?.getOutputFileKeyFromReferencedProject( fileName ); - if ( - !outputFileAndKey || - outputFileAndKey.key === filePathKeyMapper(fileName) - ) { + if (!outputFileKey || outputFileKey === filePathKeyMapper(fileName)) { return watchFile(fileName, callback, pollingInterval, options); } // Handle symlink to outputFile const outputFileName = instance.solutionBuilderHost!.realpath!(fileName); - const watcher = watchFile( + return watchFile( outputFileName, (_fileName, eventKind) => callback(fileName, eventKind), pollingInterval, options ); - - return { close: () => watcher.close() }; }, watchDirectory, @@ -662,7 +557,7 @@ export function makeWatchHost( if (file !== undefined) { return file.text; } - const text = readFile(fileName, encoding); + const text = moduleResolutionHost.readFile(fileName, encoding); if (text === undefined) { return undefined; } @@ -704,9 +599,7 @@ export function makeWatchHost( } } -function normalizeSlashes(file: T): T { - return file.replace(/\\/g, '/') as T; -} +const missingFileModifiedTime = new Date(0); /** * Create the TypeScript Watch host @@ -718,18 +611,11 @@ export function makeSolutionBuilderHost( ): SolutionBuilderWithWatchHost { const { compiler, - compilerOptions, - appendTsTsxSuffixesIfRequired, - loaderOptions: { - resolveModuleName: customResolveModuleName, - resolveTypeReferenceDirective: customResolveTypeReferenceDirective, - transpileOnly, - }, + 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 getCurrentDirectory = () => loader.context; const formatDiagnosticHost: typescript.FormatDiagnosticsHost = { getCurrentDirectory: compiler.sys.getCurrentDirectory, getCanonicalFileName: useCaseSensitiveFileNames( @@ -783,64 +669,60 @@ export function makeSolutionBuilderHost( compiler.sys.newLine )}${newLine + newLine}` ); - const outputFiles = new Map(); - const writtenFiles: OutputFile[] = []; + const outputFiles = new Map(); + const inputFiles = new Map(); + const writtenFiles: typescript.OutputFile[] = []; const outputAffectingInstanceVersion = new Map(); let timeoutId: [(...args: any[]) => void, any[]] | undefined; - const symlinkedDirectories = new Map(); - const symlinkedFiles = new Map(); - const cachedSys: CacheableHost = { - fileExists: fileName => compiler.sys.fileExists(fileName), - directoryExists: directory => compiler.sys.directoryExists(directory), - realpath: compiler.sys.realpath && (path => compiler.sys.realpath!(path)), - }; - addCache(cachedSys); + const { + resolveModuleNames, + resolveTypeReferenceDirectives, + moduleResolutionHost, + } = makeResolversAndModuleResolutionHost( + scriptRegex, + loader, + instance, + fileName => + !!instance.files.has(filePathKeyMapper(fileName)) || + !!instance.otherFiles.get(filePathKeyMapper(fileName)) || + compiler.sys.fileExists(fileName), + /*enableFileCaching*/ true + ); const configFileInfo = new Map(); + const allWatches: typescript.FileWatcher[] = []; + const sysHost = compiler.createSolutionBuilderWithWatchHost( + compiler.sys, + compiler.createEmitAndSemanticDiagnosticsBuilderProgram, + reportDiagnostic, + reportSolutionBuilderStatus, + reportWatchStatus + ); const solutionBuilderHost: SolutionBuilderWithWatchHost = { - ...compiler.createSolutionBuilderWithWatchHost( - compiler.sys, - compiler.createEmitAndSemanticDiagnosticsBuilderProgram, - reportDiagnostic, - reportSolutionBuilderStatus, - reportWatchStatus - ), - useCaseSensitiveFileNames: () => - useCaseSensitiveFileNames(compiler, instance.loaderOptions), + ...sysHost, + ...moduleResolutionHost, + resolveModuleNames, + resolveTypeReferenceDirectives, diagnostics, ...createWatchFactory(filePathKeyMapper, compiler), // Overrides - getCurrentDirectory, - // behave as if there is no tsbuild info on disk since we want to generate all outputs in memory and only use those - readFile: (fileName, encoding) => { - const outputFile = ensureOutputFile(fileName); - return outputFile !== undefined - ? outputFile - ? outputFile.text - : undefined - : readInputFile(fileName, encoding).text; - }, writeFile: (name, text, writeByteOrderMark) => { const key = filePathKeyMapper(name); updateFileWithText(instance, key, name, () => text); - const existing = outputFiles.get(key); - const newOutputFile: OutputFile = { + const existing = ensureOutputFile(name); + const hash = hashOutputText(text); + outputFiles.set(key, hash); + writtenFiles.push({ name, text, writeByteOrderMark: !!writeByteOrderMark, - time: new Date(), - version: existing - ? existing.text !== text - ? existing.version + 1 - : existing.version - : 0, - }; - outputFiles.set(key, newOutputFile); - writtenFiles.push(newOutputFile); + }); + compiler.sys.writeFile(name, text, writeByteOrderMark); + moduleResolutionHost.fileExistsCache?.delete(name); if ( outputAffectingInstanceVersion.has(key) && - (!existing || existing.text !== text) + (!existing || existing !== hash) ) { instance.version++; } @@ -856,7 +738,7 @@ export function makeSolutionBuilderHost( name, compiler.FileWatcherEventKind.Created ) || instance.hasUnaccountedModifiedFiles; - } else if (existing.version !== newOutputFile.version) { + } else if (existing !== hash) { instance.hasUnaccountedModifiedFiles = instance.watchHost.invokeFileWatcher( name, @@ -864,74 +746,13 @@ export function makeSolutionBuilderHost( ) || instance.hasUnaccountedModifiedFiles; } } - compiler.sys.writeFile(name, text, writeByteOrderMark); - }, - getModifiedTime: fileName => { - const outputFile = ensureOutputFile(fileName); - if (outputFile !== undefined) { - return outputFile ? outputFile.time : undefined; - } - const key = filePathKeyMapper(fileName); - const existing = instance.files.get(key) || instance.otherFiles.get(key); - return existing - ? existing.modifiedTime - : compiler.sys.getModifiedTime!(fileName); - }, - setModifiedTime: (fileName, time) => { - const outputFile = ensureOutputFile(fileName); - if (outputFile !== undefined) { - if (outputFile) { - outputFile.time = time; - } - } - compiler.sys.setModifiedTime!(fileName, time); - const key = filePathKeyMapper(fileName); - const existing = instance.files.get(key) || instance.otherFiles.get(key); - if (existing) { - existing.modifiedTime = time; - } }, - fileExists: fileName => { - const outputFile = ensureOutputFile(fileName); - if (outputFile !== undefined) { - return !!outputFile; - } - const key = filePathKeyMapper(fileName); - const existing = instance.files.get(key) || instance.otherFiles.get(key); - return existing - ? existing.text !== undefined - : cachedSys.fileExists(fileName); - }, - directoryExists: directory => { - if (cachedSys.directoryExists(directory)) { - return true; - } - const resolvedDirectory = trailingDirectorySeparatorPathKey(directory); - for (const outputFile of outputFiles.keys()) { - if (normalizeSlashes(outputFile).startsWith(resolvedDirectory)) { - return true; - } - } - - // see if this is symlink to in memory files's directory - const ancestor = findExistingAncestor(directory); - const ancestorRealpath = getRealpathOfExistingDirectory(ancestor); - - return ancestorRealpath - ? solutionBuilderHost.directoryExists!( - path.resolve(ancestorRealpath, path.relative(ancestor, directory)) - ) - : false; - }, - getDirectories: directory => - cachedSys.directoryExists(directory) - ? compiler.sys.getDirectories(directory) - : [], // Fake for non present directories, - readDirectory: (path, extensions, exclude, include, depth) => - cachedSys.directoryExists(path) - ? compiler.sys.readDirectory(path, extensions, exclude, include, depth) - : [], // Fake for non present directories, - realpath: cachedSys.realpath && (file => getRealpathOfFile(file) || file), + createDirectory: + sysHost.createDirectory && + (directory => { + sysHost.createDirectory!(directory); + moduleResolutionHost.directoryExistsCache?.delete(directory); + }), afterProgramEmitAndDiagnostics: transpileOnly ? undefined : storeDtsFiles, setTimeout: (callback, _time, ...args) => { timeoutId = [callback, args]; @@ -940,120 +761,49 @@ export function makeSolutionBuilderHost( clearTimeout: _timeoutId => { timeoutId = undefined; }, + getParsedCommandLine: file => { + const config = getParsedCommandLine( + compiler, + instance.loaderOptions, + file + ); + configFileInfo.set(filePathKeyMapper(file), { config }); + return config; + }, writtenFiles, configFileInfo, outputAffectingInstanceVersion, + getInputFileStamp, + updateSolutionBuilderInputFile, getOutputFileKeyFromReferencedProject, - getOutputFileFromReferencedProject, getOutputFileAndKeyFromReferencedProject, + getOutputFileTextAndKeyFromReferencedProject, getInputFileNameFromOutput: fileName => { const result = getInputFileNameFromOutput(fileName); return typeof result === 'string' ? result : undefined; }, getOutputFilesFromReferencedProjectInput, buildReferences, + ensureAllReferenceTimestamps, clearCache, - }; - solutionBuilderHost.trace = logData => instance.log.logInfo(logData); - solutionBuilderHost.getParsedCommandLine = file => { - const config = getParsedCommandLine(compiler, instance.loaderOptions, file); - configFileInfo.set(filePathKeyMapper(file), { config }); - return config; + close, }; - // make a (sync) resolver that follows webpack's rules - const resolveSync = makeResolver(loader._compiler.options); - const resolvers = makeResolvers( - compiler, - compilerOptions, - solutionBuilderHost, - customResolveTypeReferenceDirective, - customResolveModuleName, - resolveSync, - appendTsTsxSuffixesIfRequired, - scriptRegex, - instance - ); - // used for (/// ) see https://github.com/Realytics/fork-ts-checker-webpack-plugin/pull/250#issuecomment-485061329 - solutionBuilderHost.resolveTypeReferenceDirectives = - resolvers.resolveTypeReferenceDirectives; - solutionBuilderHost.resolveModuleNames = resolvers.resolveModuleNames; - return solutionBuilderHost; - function trailingDirectorySeparatorPathKey(directory: string) { - return ensureTrailingDirectorySeparator( - normalizeSlashes(filePathKeyMapper(directory)) - ); + function close() { + allWatches.slice().forEach(w => w.close()); } function clearCache() { - cachedSys.clearCache!(); - symlinkedDirectories.clear(); - symlinkedFiles.clear(); - } - - function findExistingAncestor(fileOrDirectory: string) { - let ancestor = path.dirname(fileOrDirectory); - while (ancestor !== path.dirname(ancestor)) { - if (cachedSys.directoryExists(ancestor)) return ancestor; - ancestor = path.dirname(ancestor); - } - // Root should always be present - return ancestor; - } - - function getRealpathOfExistingDirectory( - directory: string - ): string | undefined { - return getRealpath(directory, symlinkedDirectories, () => - cachedSys.realpath!(directory) - ); - } - - function getRealpathOfFile(file: string): string | undefined { - return getRealpath(file, symlinkedFiles, () => { - if (cachedSys.fileExists(file)) return cachedSys.realpath!(file); - - // see if this is symlink to in memory file - const ancestor = findExistingAncestor(file); - const ancestorRealpath = getRealpathOfExistingDirectory(ancestor); - if (!ancestorRealpath) return file; - - const newFile = path.resolve( - ancestorRealpath, - path.relative(ancestor, file) - ); - return getRealpathOfFile(newFile) || newFile; - }); - } - - function getRealpath( - fileOrDirectory: string, - symlinked: Map, - realpath: () => string - ): string | undefined { - if (!cachedSys.realpath) return undefined; - const fileOrDirectoryKey = filePathKeyMapper(fileOrDirectory); - const existing = symlinked.get(fileOrDirectoryKey); - if (existing !== undefined) return existing || undefined; - - const real = realpath(); - if ( - real === fileOrDirectory || - filePathKeyMapper(real) === fileOrDirectoryKey - ) { - // not symlinked - symlinked.set(fileOrDirectoryKey, false); - return undefined; - } - - symlinked.set(fileOrDirectoryKey, real); - return real; + moduleResolutionHost.clearCache!(); + outputFiles.clear(); + inputFiles.clear(); } function buildReferences() { if (!timeoutId) { + ensureAllReferenceTimestamps(); return; } diagnostics.global.length = 0; @@ -1065,6 +815,17 @@ export function makeSolutionBuilderHost( 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( @@ -1099,7 +860,11 @@ export function makeSolutionBuilderHost( inputFileName, outputNames, } of configInfo.outputFileNames.values()) { - if (outputNames.indexOf(resolvedFileName) !== -1) { + if ( + outputNames.some( + outputName => resolvedFileName === filePathKeyMapper(outputName) + ) + ) { return inputFileName; } } @@ -1112,9 +877,9 @@ export function makeSolutionBuilderHost( } } - const symlinkedOutputFileName = getRealpathOfFile(outputFileName); - return symlinkedOutputFileName - ? getInputFileNameFromOutput(symlinkedOutputFileName) + const realPath = solutionBuilderHost.realpath!(outputFileName); + return filePathKeyMapper(realPath) !== resolvedFileName + ? getInputFileNameFromOutput(realPath) : undefined; } @@ -1130,7 +895,7 @@ export function makeSolutionBuilderHost( instance, configInfo.config!, inputFile - ).map(filePathKeyMapper), + ), }) ); @@ -1147,62 +912,102 @@ export function makeSolutionBuilderHost( function getOutputFileAndKeyFromReferencedProject( outputFileName: string - ): { key: FilePathKey; outputFile: OutputFile | false } | undefined { - const key = getOutputFileKeyFromReferencedProject(outputFileName); - return key && { key, outputFile: outputFiles.get(key)! }; + ): { key: FilePathKey; outputFile: string | false } | undefined { + const outputFile = ensureOutputFile(outputFileName); + return outputFile !== undefined + ? { + key: getOutputFileKeyFromReferencedProject(outputFileName)!, + outputFile, + } + : undefined; } - function getOutputFileFromReferencedProject( + function getOutputFileTextAndKeyFromReferencedProject( outputFileName: string - ): OutputFile | false | undefined { + ): { key: FilePathKey; text: string | undefined } | undefined { const key = getOutputFileKeyFromReferencedProject(outputFileName); - return key && outputFiles.get(key); + 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: string ): FilePathKey | undefined { const key = filePathKeyMapper(outputFileName); - const result = outputFiles.has(key); - if (result) return key; + if (outputFiles.has(key)) return key; - const symlinkedOutputFileName = getRealpathOfFile(outputFileName); - return symlinkedOutputFileName - ? getOutputFileKeyFromReferencedProject(symlinkedOutputFileName) - : undefined; + const realKey = filePathKeyMapper( + solutionBuilderHost.realpath!(outputFileName) + ); + if (realKey !== key && outputFiles.has(realKey)) return realKey; + + return getInputFileNameFromOutput(outputFileName) ? realKey : undefined; + } + + function hashOutputText(text: string) { + return compiler.sys.createHash ? compiler.sys.createHash(text) : text; } function ensureOutputFile( - outputFileName: string, - encoding?: string - ): OutputFile | false | undefined { - const outputFile = getOutputFileFromReferencedProject(outputFileName); + outputFileName: string + ): string | false | undefined { + const key = getOutputFileKeyFromReferencedProject(outputFileName); + if (!key) { + return undefined; + } + const outputFile = outputFiles.get(key); if (outputFile !== undefined) { return outputFile; } + if (!getInputFileNameFromOutput(outputFileName)) { return undefined; } - outputFileName = getRealpathOfFile(outputFileName) || outputFileName; + const text = compiler.sys.readFile(outputFileName); + const hash = text === undefined ? false : hashOutputText(text); + outputFiles.set(key, hash); + return hash; + } + + function getTypeScriptOutputFile( + outputFileName: string + ): typescript.OutputFile | undefined { const key = filePathKeyMapper(outputFileName); - const text = compiler.sys.readFile(outputFileName, encoding); - if (text === undefined) { - outputFiles.set(key, false); - return false; - } - const newOutputFile: OutputFile = { - name: outputFileName, - text, - writeByteOrderMark: false, - time: compiler.sys.getModifiedTime!(outputFileName)!, - version: 0, - }; - outputFiles.set(key, newOutputFile); - return newOutputFile; + 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: string) { + function getOutputFilesFromReferencedProjectInput( + inputFileName: string + ): typescript.OutputFile[] { const resolvedFileName = filePathKeyMapper(inputFileName); for (const configInfo of configFileInfo.values()) { ensureInputOutputInfo(configInfo); @@ -1210,29 +1015,41 @@ export function makeSolutionBuilderHost( const result = configInfo.outputFileNames.get(resolvedFileName); if (result) { return result.outputNames - .map(outputFile => outputFiles.get(outputFile)!) - .filter(output => !!output) as OutputFile[]; + .map(getTypeScriptOutputFile) + .filter(output => !!output) as typescript.OutputFile[]; } } } return []; } - function readInputFile(inputFileName: string, encoding: string | undefined) { - const resolvedFileName = filePathKeyMapper(inputFileName); - const existing = instance.otherFiles.get(resolvedFileName); - if (existing) { + function getInputFileStamp(fileName: string) { + const key = filePathKeyMapper(fileName); + const existing = inputFiles.get(key); + if (existing !== undefined) { return existing; } - inputFileName = path.resolve(inputFileName); - const tsFile: TSFile = { - fileName: inputFileName, - version: 1, - text: compiler.sys.readFile(inputFileName, encoding), - modifiedTime: compiler.sys.getModifiedTime!(inputFileName), - }; - instance.otherFiles.set(resolvedFileName, tsFile); - return tsFile; + const time = + compiler.sys.getModifiedTime!(fileName) || missingFileModifiedTime; + inputFiles.set(key, time); + return time; + } + + function updateSolutionBuilderInputFile(fileName: string) { + const key = filePathKeyMapper(fileName); + const existing = inputFiles.get(key) || missingFileModifiedTime; + const newTime = + compiler.sys.getModifiedTime!(fileName) || missingFileModifiedTime; + if (existing === newTime) { + return; + } + const eventKind = + existing == missingFileModifiedTime + ? compiler.FileWatcherEventKind.Created + : newTime === missingFileModifiedTime + ? compiler.FileWatcherEventKind.Deleted + : compiler.FileWatcherEventKind.Changed; + solutionBuilderHost.invokeFileWatcher(fileName, eventKind); } } @@ -1382,15 +1199,23 @@ function makeResolveModuleName( } function addCache(host: CacheableHost): void { - const clearCacheFunctions: Action[] = []; - host.fileExists = createCache(host.fileExists); - host.directoryExists = createCache(host.directoryExists); - host.realpath = host.realpath && createCache(host.realpath); - host.clearCache = () => clearCacheFunctions.forEach(clear => clear()); - - function createCache(originalFunction: (arg: string) => TOut) { - const cache = new Map(); - clearCacheFunctions.push(() => cache.clear()); + 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: (arg: string) => TOut, + cache: Map + ) { return function getCached(arg: string) { let res = cache.get(arg); if (res !== undefined) { @@ -1402,4 +1227,10 @@ function addCache(host: CacheableHost): void { return res; }; } + + function clearCache() { + host.fileExistsCache?.clear(); + host.directoryExistsCache?.clear(); + host.realpathCache?.clear(); + } } diff --git a/src/utils.ts b/src/utils.ts index 0387b8ab1..c1da3e0a2 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -249,22 +249,6 @@ export function arrify(val: T | T[]) { return Array.isArray(val) ? val : [val]; } -export function ensureTrailingDirectorySeparator(dir: T): T { - return hasTrailingDirectorySeparator(dir) ? dir : ((dir + '/') as T); -} - -function isAnyDirectorySeparator(charCode: number): boolean { - return ( - charCode === 0x2f || charCode === 0x5c // / - ); // \ -} - -function hasTrailingDirectorySeparator(dir: string) { - return ( - dir.length > 0 && isAnyDirectorySeparator(dir.charCodeAt(dir.length - 1)) - ); -} - export function ensureProgram(instance: TSInstance) { if (instance && instance.watchHost) { if (instance.hasUnaccountedModifiedFiles) { diff --git a/src/watch-run.ts b/src/watch-run.ts index 40cc61b71..69b9e0c6d 100644 --- a/src/watch-run.ts +++ b/src/watch-run.ts @@ -22,7 +22,6 @@ export function makeWatchRun( return (compiler: webpack.Compiler, callback: (err?: Error) => void) => { instance.servicesHost?.clearCache?.(); - instance.solutionBuilderHost?.clearCache(); const promises = []; if (instance.loaderOptions.transpileOnly) { instance.reportTranspileErrors = true; @@ -57,12 +56,12 @@ export function makeWatchRun( // Update all the watched files from solution builder if (instance.solutionBuilderHost) { - for (const [ - key, - { fileName }, - ] of instance.solutionBuilderHost.watchedFiles.entries()) { - promises.push(updateFile(instance, key, fileName, loader, loaderIndex)); + for (const { + fileName, + } of instance.solutionBuilderHost.watchedFiles.values()) { + instance.solutionBuilderHost!.updateSolutionBuilderInputFile(fileName); } + instance.solutionBuilderHost.clearCache(); } Promise.all(promises) diff --git a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch3/app/bundle.js b/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch3/app/bundle.js deleted file mode 100644 index 488ec7463..000000000 --- a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch3/app/bundle.js +++ /dev/null @@ -1,137 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./app.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "../common/index.ts": -/*!**************************!*\ - !*** ../common/index.ts ***! - \**************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.common = void 0;\nfunction common() {\n return 35;\n}\nexports.common = common;\n\n\n//# sourceURL=webpack:///../common/index.ts?"); - -/***/ }), - -/***/ "../lib/index.ts": -/*!***********************!*\ - !*** ../lib/index.ts ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.lib = void 0;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3\n};\n\n\n//# sourceURL=webpack:///../lib/index.ts?"); - -/***/ }), - -/***/ "../utils/index.ts": -/*!*************************!*\ - !*** ../utils/index.ts ***! - \*************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.utils2 = exports.utils = void 0;\nvar common_1 = __webpack_require__(/*! ../common */ \"../common/index.ts\");\nfunction utils() {\n common_1.common();\n}\nexports.utils = utils;\nfunction utils2() { return \"hello\"; }\nexports.utils2 = utils2;\n\n\n//# sourceURL=webpack:///../utils/index.ts?"); - -/***/ }), - -/***/ "./app.ts": -/*!****************!*\ - !*** ./app.ts ***! - \****************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar lib_1 = __webpack_require__(/*! ../lib */ \"../lib/index.ts\");\nvar utils_1 = __webpack_require__(/*! ../utils */ \"../utils/index.ts\");\nconsole.log(lib_1.lib.one, lib_1.lib.two, lib_1.lib.three);\nutils_1.utils();\nutils_1.utils2();\n\n\n//# sourceURL=webpack:///./app.ts?"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch3/output.txt b/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch3/output.txt index 4ab09263e..21020ebbd 100644 --- a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch3/output.txt +++ b/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch3/output.txt @@ -1,11 +1,11 @@ Asset Size Chunks Chunk Names ../common/tsconfig.tsbuildinfo 2.68 KiB [emitted] - bundle.js 5.43 KiB main [emitted] main + bundle.js 5.43 KiB main main Entrypoint main = bundle.js [../common/index.ts] 128 bytes {main} [built] [../lib/index.ts] 119 bytes {main} [../utils/index.ts] 249 bytes {main} [built] [./app.ts] 238 bytes {main} [built] [1 error] -ERROR in [tsl] ERROR in common/index.ts(2,3) +ERROR in [tsl] ERROR in common\index.ts(2,3)  TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch4/app/bundle.js b/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch4/app/bundle.js deleted file mode 100644 index 488ec7463..000000000 --- a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch4/app/bundle.js +++ /dev/null @@ -1,137 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./app.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "../common/index.ts": -/*!**************************!*\ - !*** ../common/index.ts ***! - \**************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.common = void 0;\nfunction common() {\n return 35;\n}\nexports.common = common;\n\n\n//# sourceURL=webpack:///../common/index.ts?"); - -/***/ }), - -/***/ "../lib/index.ts": -/*!***********************!*\ - !*** ../lib/index.ts ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.lib = void 0;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3\n};\n\n\n//# sourceURL=webpack:///../lib/index.ts?"); - -/***/ }), - -/***/ "../utils/index.ts": -/*!*************************!*\ - !*** ../utils/index.ts ***! - \*************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.utils2 = exports.utils = void 0;\nvar common_1 = __webpack_require__(/*! ../common */ \"../common/index.ts\");\nfunction utils() {\n common_1.common();\n}\nexports.utils = utils;\nfunction utils2() { return \"hello\"; }\nexports.utils2 = utils2;\n\n\n//# sourceURL=webpack:///../utils/index.ts?"); - -/***/ }), - -/***/ "./app.ts": -/*!****************!*\ - !*** ./app.ts ***! - \****************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar lib_1 = __webpack_require__(/*! ../lib */ \"../lib/index.ts\");\nvar utils_1 = __webpack_require__(/*! ../utils */ \"../utils/index.ts\");\nconsole.log(lib_1.lib.one, lib_1.lib.two, lib_1.lib.three);\nutils_1.utils();\nutils_1.utils2();\n\n\n//# sourceURL=webpack:///./app.ts?"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch4/output.txt b/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch4/output.txt index 92c7c2484..2f2035592 100644 --- a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch4/output.txt +++ b/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch4/output.txt @@ -2,7 +2,7 @@ ../common/index.d.ts 42 bytes [emitted] ../common/index.js 128 bytes [emitted] ../common/tsconfig.tsbuildinfo 2.32 KiB [emitted] - bundle.js 5.43 KiB main [emitted] main + bundle.js 5.43 KiB main main Entrypoint main = bundle.js [../common/index.ts] 128 bytes {main} [built] [../lib/index.ts] 119 bytes {main} diff --git a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch5/app/bundle.js b/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch5/app/bundle.js deleted file mode 100644 index 488ec7463..000000000 --- a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch5/app/bundle.js +++ /dev/null @@ -1,137 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./app.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "../common/index.ts": -/*!**************************!*\ - !*** ../common/index.ts ***! - \**************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.common = void 0;\nfunction common() {\n return 35;\n}\nexports.common = common;\n\n\n//# sourceURL=webpack:///../common/index.ts?"); - -/***/ }), - -/***/ "../lib/index.ts": -/*!***********************!*\ - !*** ../lib/index.ts ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.lib = void 0;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3\n};\n\n\n//# sourceURL=webpack:///../lib/index.ts?"); - -/***/ }), - -/***/ "../utils/index.ts": -/*!*************************!*\ - !*** ../utils/index.ts ***! - \*************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.utils2 = exports.utils = void 0;\nvar common_1 = __webpack_require__(/*! ../common */ \"../common/index.ts\");\nfunction utils() {\n common_1.common();\n}\nexports.utils = utils;\nfunction utils2() { return \"hello\"; }\nexports.utils2 = utils2;\n\n\n//# sourceURL=webpack:///../utils/index.ts?"); - -/***/ }), - -/***/ "./app.ts": -/*!****************!*\ - !*** ./app.ts ***! - \****************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar lib_1 = __webpack_require__(/*! ../lib */ \"../lib/index.ts\");\nvar utils_1 = __webpack_require__(/*! ../utils */ \"../utils/index.ts\");\nconsole.log(lib_1.lib.one, lib_1.lib.two, lib_1.lib.three);\nutils_1.utils();\nutils_1.utils2();\n\n\n//# sourceURL=webpack:///./app.ts?"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch5/output.txt b/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch5/output.txt index 2c60e9657..8a1487699 100644 --- a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch5/output.txt +++ b/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch5/output.txt @@ -1,11 +1,11 @@ Asset Size Chunks Chunk Names ../utils/tsconfig.tsbuildinfo 3.02 KiB [emitted] - bundle.js 5.43 KiB main [emitted] main + bundle.js 5.43 KiB main main Entrypoint main = bundle.js [../common/index.ts] 128 bytes {main} [../lib/index.ts] 119 bytes {main} [../utils/index.ts] 249 bytes {main} [built] [./app.ts] 238 bytes {main} [built] [1 error] -ERROR in [tsl] ERROR in utils/index.ts(5,36) +ERROR in [tsl] ERROR in utils\index.ts(5,36)  TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch6/app/bundle.js b/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch6/app/bundle.js deleted file mode 100644 index 488ec7463..000000000 --- a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch6/app/bundle.js +++ /dev/null @@ -1,137 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./app.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "../common/index.ts": -/*!**************************!*\ - !*** ../common/index.ts ***! - \**************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.common = void 0;\nfunction common() {\n return 35;\n}\nexports.common = common;\n\n\n//# sourceURL=webpack:///../common/index.ts?"); - -/***/ }), - -/***/ "../lib/index.ts": -/*!***********************!*\ - !*** ../lib/index.ts ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.lib = void 0;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3\n};\n\n\n//# sourceURL=webpack:///../lib/index.ts?"); - -/***/ }), - -/***/ "../utils/index.ts": -/*!*************************!*\ - !*** ../utils/index.ts ***! - \*************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.utils2 = exports.utils = void 0;\nvar common_1 = __webpack_require__(/*! ../common */ \"../common/index.ts\");\nfunction utils() {\n common_1.common();\n}\nexports.utils = utils;\nfunction utils2() { return \"hello\"; }\nexports.utils2 = utils2;\n\n\n//# sourceURL=webpack:///../utils/index.ts?"); - -/***/ }), - -/***/ "./app.ts": -/*!****************!*\ - !*** ./app.ts ***! - \****************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar lib_1 = __webpack_require__(/*! ../lib */ \"../lib/index.ts\");\nvar utils_1 = __webpack_require__(/*! ../utils */ \"../utils/index.ts\");\nconsole.log(lib_1.lib.one, lib_1.lib.two, lib_1.lib.three);\nutils_1.utils();\nutils_1.utils2();\n\n\n//# sourceURL=webpack:///./app.ts?"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch6/output.txt b/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch6/output.txt index 13a346cbc..8c6c39dca 100644 --- a/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch6/output.txt +++ b/test/comparison-tests/projectReferencesMultipleDifferentInstance/expectedOutput-transpile-4.0/patch6/output.txt @@ -2,7 +2,7 @@ ../utils/index.d.ts 81 bytes [emitted] ../utils/index.js 249 bytes [emitted] ../utils/tsconfig.tsbuildinfo 2.66 KiB [emitted] - bundle.js 5.43 KiB main [emitted] main + bundle.js 5.43 KiB main main Entrypoint main = bundle.js [../common/index.ts] 128 bytes {main} [../lib/index.ts] 119 bytes {main} diff --git a/test/comparison-tests/projectReferencesWatch/expectedOutput-transpile-4.0/patch2/bundle.js b/test/comparison-tests/projectReferencesWatch/expectedOutput-transpile-4.0/patch2/bundle.js deleted file mode 100644 index 78ed26c6a..000000000 --- a/test/comparison-tests/projectReferencesWatch/expectedOutput-transpile-4.0/patch2/bundle.js +++ /dev/null @@ -1,113 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./app.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./app.ts": -/*!****************!*\ - !*** ./app.ts ***! - \****************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar lib_1 = __webpack_require__(/*! ./lib */ \"./lib/index.ts\");\nconsole.log(lib_1.lib.one, lib_1.lib.two, lib_1.lib.three, lib_1.lib.four); // consume new number\n\n\n//# sourceURL=webpack:///./app.ts?"); - -/***/ }), - -/***/ "./lib/index.ts": -/*!**********************!*\ - !*** ./lib/index.ts ***! - \**********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.lib = void 0;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3,\n four: 4 // Add new number\n};\n\n\n//# sourceURL=webpack:///./lib/index.ts?"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/comparison-tests/projectReferencesWatch/expectedOutput-transpile-4.0/patch2/output.txt b/test/comparison-tests/projectReferencesWatch/expectedOutput-transpile-4.0/patch2/output.txt index fb141bbb0..6b7869bd6 100644 --- a/test/comparison-tests/projectReferencesWatch/expectedOutput-transpile-4.0/patch2/output.txt +++ b/test/comparison-tests/projectReferencesWatch/expectedOutput-transpile-4.0/patch2/output.txt @@ -1,11 +1,11 @@ - Asset Size Chunks Chunk Names -bundle.js 4.41 KiB main [emitted] main + Asset Size Chunks Chunk Names +bundle.js 4.41 KiB main main Entrypoint main = bundle.js [./app.ts] 205 bytes {main} [built] [2 errors] [./lib/index.ts] 150 bytes {main} [built] -ERROR in [tsl] ERROR in lib/index.ts(6,3) +ERROR in [tsl] ERROR in lib\index.ts(6,3)  TS1136: Property assignment expected. -ERROR in [tsl] ERROR in lib/index.ts(7,1) +ERROR in [tsl] ERROR in lib\index.ts(7,1)  TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/test/comparison-tests/projectReferencesWatch_Composite_WatchApi/expectedOutput-transpile-4.0/patch2/bundle.js b/test/comparison-tests/projectReferencesWatch_Composite_WatchApi/expectedOutput-transpile-4.0/patch2/bundle.js deleted file mode 100644 index 78ed26c6a..000000000 --- a/test/comparison-tests/projectReferencesWatch_Composite_WatchApi/expectedOutput-transpile-4.0/patch2/bundle.js +++ /dev/null @@ -1,113 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./app.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./app.ts": -/*!****************!*\ - !*** ./app.ts ***! - \****************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar lib_1 = __webpack_require__(/*! ./lib */ \"./lib/index.ts\");\nconsole.log(lib_1.lib.one, lib_1.lib.two, lib_1.lib.three, lib_1.lib.four); // consume new number\n\n\n//# sourceURL=webpack:///./app.ts?"); - -/***/ }), - -/***/ "./lib/index.ts": -/*!**********************!*\ - !*** ./lib/index.ts ***! - \**********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.lib = void 0;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3,\n four: 4 // Add new number\n};\n\n\n//# sourceURL=webpack:///./lib/index.ts?"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/comparison-tests/projectReferencesWatch_Composite_WatchApi/expectedOutput-transpile-4.0/patch2/output.txt b/test/comparison-tests/projectReferencesWatch_Composite_WatchApi/expectedOutput-transpile-4.0/patch2/output.txt index fb141bbb0..6b7869bd6 100644 --- a/test/comparison-tests/projectReferencesWatch_Composite_WatchApi/expectedOutput-transpile-4.0/patch2/output.txt +++ b/test/comparison-tests/projectReferencesWatch_Composite_WatchApi/expectedOutput-transpile-4.0/patch2/output.txt @@ -1,11 +1,11 @@ - Asset Size Chunks Chunk Names -bundle.js 4.41 KiB main [emitted] main + Asset Size Chunks Chunk Names +bundle.js 4.41 KiB main main Entrypoint main = bundle.js [./app.ts] 205 bytes {main} [built] [2 errors] [./lib/index.ts] 150 bytes {main} [built] -ERROR in [tsl] ERROR in lib/index.ts(6,3) +ERROR in [tsl] ERROR in lib\index.ts(6,3)  TS1136: Property assignment expected. -ERROR in [tsl] ERROR in lib/index.ts(7,1) +ERROR in [tsl] ERROR in lib\index.ts(7,1)  TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/test/comparison-tests/projectReferencesWatch_WatchApi/expectedOutput-transpile-4.0/patch2/bundle.js b/test/comparison-tests/projectReferencesWatch_WatchApi/expectedOutput-transpile-4.0/patch2/bundle.js deleted file mode 100644 index 78ed26c6a..000000000 --- a/test/comparison-tests/projectReferencesWatch_WatchApi/expectedOutput-transpile-4.0/patch2/bundle.js +++ /dev/null @@ -1,113 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./app.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./app.ts": -/*!****************!*\ - !*** ./app.ts ***! - \****************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar lib_1 = __webpack_require__(/*! ./lib */ \"./lib/index.ts\");\nconsole.log(lib_1.lib.one, lib_1.lib.two, lib_1.lib.three, lib_1.lib.four); // consume new number\n\n\n//# sourceURL=webpack:///./app.ts?"); - -/***/ }), - -/***/ "./lib/index.ts": -/*!**********************!*\ - !*** ./lib/index.ts ***! - \**********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\nexports.__esModule = true;\nexports.lib = void 0;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3,\n four: 4 // Add new number\n};\n\n\n//# sourceURL=webpack:///./lib/index.ts?"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/comparison-tests/projectReferencesWatch_WatchApi/expectedOutput-transpile-4.0/patch2/output.txt b/test/comparison-tests/projectReferencesWatch_WatchApi/expectedOutput-transpile-4.0/patch2/output.txt index fb141bbb0..6b7869bd6 100644 --- a/test/comparison-tests/projectReferencesWatch_WatchApi/expectedOutput-transpile-4.0/patch2/output.txt +++ b/test/comparison-tests/projectReferencesWatch_WatchApi/expectedOutput-transpile-4.0/patch2/output.txt @@ -1,11 +1,11 @@ - Asset Size Chunks Chunk Names -bundle.js 4.41 KiB main [emitted] main + Asset Size Chunks Chunk Names +bundle.js 4.41 KiB main main Entrypoint main = bundle.js [./app.ts] 205 bytes {main} [built] [2 errors] [./lib/index.ts] 150 bytes {main} [built] -ERROR in [tsl] ERROR in lib/index.ts(6,3) +ERROR in [tsl] ERROR in lib\index.ts(6,3)  TS1136: Property assignment expected. -ERROR in [tsl] ERROR in lib/index.ts(7,1) +ERROR in [tsl] ERROR in lib\index.ts(7,1)  TS1128: Declaration or statement expected. \ No newline at end of file