@typescript-deploys/pr-build 4.9.0-pr-50293-2 → 4.9.0-pr-50306-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/typescript.js CHANGED
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = ts.versionMajorMinor + ".0-insiders.20220813";
102
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220815";
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -7020,7 +7020,6 @@ var ts;
7020
7020
  // not actually work.
7021
7021
  var byteOrderMarkIndicator = "\uFEFF";
7022
7022
  function getNodeSystem() {
7023
- var _a;
7024
7023
  var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
7025
7024
  var _fs = require("fs");
7026
7025
  var _path = require("path");
@@ -7030,7 +7029,7 @@ var ts;
7030
7029
  try {
7031
7030
  _crypto = require("crypto");
7032
7031
  }
7033
- catch (_b) {
7032
+ catch (_a) {
7034
7033
  _crypto = undefined;
7035
7034
  }
7036
7035
  var activeSession;
@@ -7041,10 +7040,10 @@ var ts;
7041
7040
  var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
7042
7041
  var platform = _os.platform();
7043
7042
  var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
7044
- var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync;
7043
+ var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
7045
7044
  var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
7046
7045
  var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
7047
- var _c = createSystemWatchFunctions({
7046
+ var _b = createSystemWatchFunctions({
7048
7047
  pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
7049
7048
  getModifiedTime: getModifiedTime,
7050
7049
  setTimeout: setTimeout,
@@ -7064,7 +7063,7 @@ var ts;
7064
7063
  defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
7065
7064
  inodeWatching: isLinuxOrMacOs,
7066
7065
  sysLog: sysLog,
7067
- }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
7066
+ }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory;
7068
7067
  var nodeSystem = {
7069
7068
  args: process.argv.slice(2),
7070
7069
  newLine: _os.EOL,
@@ -7457,9 +7456,12 @@ var ts;
7457
7456
  function getDirectories(path) {
7458
7457
  return getAccessibleFileSystemEntries(path).directories.slice();
7459
7458
  }
7459
+ function fsRealPathHandlingLongPath(path) {
7460
+ return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path);
7461
+ }
7460
7462
  function realpath(path) {
7461
7463
  try {
7462
- return realpathSync(path);
7464
+ return fsRealpath(path);
7463
7465
  }
7464
7466
  catch (_a) {
7465
7467
  return path;
@@ -27750,12 +27752,10 @@ var ts;
27750
27752
  node.helpers = ts.map(bundleFileInfo.sources && bundleFileInfo.sources.helpers, function (name) { return ts.getAllUnscopedEmitHelpers().get(name); });
27751
27753
  return node;
27752
27754
  }
27753
- function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPathOrHost, declarationPathOrOptions, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
27755
+ function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPath, declarationPath, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
27754
27756
  var node = ts.parseNodeFactory.createInputFiles();
27755
27757
  if (!ts.isString(javascriptTextOrReadFileText)) {
27756
27758
  var cache_1 = new ts.Map();
27757
- var host_1 = javascriptPathOrHost;
27758
- var options_1 = declarationPathOrOptions;
27759
27759
  var textGetter_1 = function (path) {
27760
27760
  if (path === undefined)
27761
27761
  return undefined;
@@ -27771,18 +27771,11 @@ var ts;
27771
27771
  return result !== undefined ? result : "/* Input file " + path + " was missing */\r\n";
27772
27772
  };
27773
27773
  var buildInfo_1;
27774
- var getAndCacheBuildInfo = function () {
27775
- var _a, _b, _c;
27776
- if (buildInfo_1 === undefined && declarationMapTextOrBuildInfoPath) {
27777
- if (host_1 === null || host_1 === void 0 ? void 0 : host_1.getBuildInfo) {
27778
- buildInfo_1 = (_a = host_1.getBuildInfo(declarationMapTextOrBuildInfoPath, options_1)) !== null && _a !== void 0 ? _a : false;
27779
- }
27780
- else {
27781
- var result = textGetter_1(declarationMapTextOrBuildInfoPath);
27782
- if (result)
27783
- (_b = host_1 === null || host_1 === void 0 ? void 0 : host_1.buildInfoCallbacks) === null || _b === void 0 ? void 0 : _b.onRead(result.length, options_1);
27784
- buildInfo_1 = result !== undefined ? (_c = ts.getBuildInfo(declarationMapTextOrBuildInfoPath, result)) !== null && _c !== void 0 ? _c : false : false;
27785
- }
27774
+ var getAndCacheBuildInfo_1 = function (getText) {
27775
+ var _a;
27776
+ if (buildInfo_1 === undefined) {
27777
+ var result = getText();
27778
+ buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false;
27786
27779
  }
27787
27780
  return buildInfo_1 || undefined;
27788
27781
  };
@@ -27796,7 +27789,7 @@ var ts;
27796
27789
  javascriptMapText: { get: function () { return textGetter_1(javascriptMapPath); } },
27797
27790
  declarationText: { get: function () { return definedTextGetter_1(ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath)); } },
27798
27791
  declarationMapText: { get: function () { return textGetter_1(declarationMapPath); } },
27799
- buildInfo: { get: getAndCacheBuildInfo },
27792
+ buildInfo: { get: function () { return getAndCacheBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
27800
27793
  });
27801
27794
  }
27802
27795
  else {
@@ -27806,8 +27799,8 @@ var ts;
27806
27799
  node.declarationText = declarationTextOrJavascriptPath;
27807
27800
  node.declarationMapPath = declarationMapPath;
27808
27801
  node.declarationMapText = declarationMapTextOrBuildInfoPath;
27809
- node.javascriptPath = javascriptPathOrHost;
27810
- node.declarationPath = declarationPathOrOptions;
27802
+ node.javascriptPath = javascriptPath;
27803
+ node.declarationPath = declarationPath;
27811
27804
  node.buildInfoPath = buildInfoPath;
27812
27805
  node.buildInfo = buildInfo;
27813
27806
  node.oldFileOfCurrentEmit = oldFileOfCurrentEmit;
@@ -41824,8 +41817,8 @@ var ts;
41824
41817
  entries.push({ value: "" });
41825
41818
  }
41826
41819
  entries.push({ value: "/* " + category + " */" });
41827
- for (var _i = 0, options_2 = options; _i < options_2.length; _i++) {
41828
- var option = options_2[_i];
41820
+ for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
41821
+ var option = options_1[_i];
41829
41822
  var optionName = void 0;
41830
41823
  if (compilerOptionsMap.has(option.name)) {
41831
41824
  optionName = "\"" + option.name + "\": " + JSON.stringify(compilerOptionsMap.get(option.name)) + ((seenKnownKeys += 1) === compilerOptionsMap.size ? "" : ",");
@@ -86881,9 +86874,9 @@ var ts;
86881
86874
  var paramTag = node.parent.parent;
86882
86875
  if (ts.isJSDocTypeExpression(node.parent) && ts.isJSDocParameterTag(paramTag)) {
86883
86876
  // Else we will add a diagnostic, see `checkJSDocVariadicType`.
86884
- var host_2 = ts.getHostSignatureFromJSDoc(paramTag);
86877
+ var host_1 = ts.getHostSignatureFromJSDoc(paramTag);
86885
86878
  var isCallbackTag = ts.isJSDocCallbackTag(paramTag.parent.parent);
86886
- if (host_2 || isCallbackTag) {
86879
+ if (host_1 || isCallbackTag) {
86887
86880
  /*
86888
86881
  Only return an array type if the corresponding parameter is marked as a rest parameter, or if there are no parameters.
86889
86882
  So in the following situation we will not create an array type:
@@ -86893,7 +86886,7 @@ var ts;
86893
86886
  */
86894
86887
  var lastParamDeclaration = isCallbackTag
86895
86888
  ? ts.lastOrUndefined(paramTag.parent.parent.typeExpression.parameters)
86896
- : ts.lastOrUndefined(host_2.parameters);
86889
+ : ts.lastOrUndefined(host_1.parameters);
86897
86890
  var symbol = ts.getParameterSymbolFromJSDoc(paramTag);
86898
86891
  if (!lastParamDeclaration ||
86899
86892
  symbol && lastParamDeclaration.symbol === symbol && ts.isRestParameter(lastParamDeclaration)) {
@@ -89678,9 +89671,9 @@ var ts;
89678
89671
  }
89679
89672
  var parent = ts.walkUpParenthesizedTypes(node.parent);
89680
89673
  if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) {
89681
- var host_3 = ts.getJSDocHost(parent);
89682
- if (host_3) {
89683
- parent = ts.getSingleVariableOfVariableStatement(host_3) || host_3;
89674
+ var host_2 = ts.getJSDocHost(parent);
89675
+ if (host_2) {
89676
+ parent = ts.getSingleVariableOfVariableStatement(host_2) || host_2;
89684
89677
  }
89685
89678
  }
89686
89679
  switch (parent.kind) {
@@ -111684,7 +111677,6 @@ var ts;
111684
111677
  }
111685
111678
  }
111686
111679
  function emitBuildInfo(bundle, buildInfoPath) {
111687
- var _a;
111688
111680
  // Write build information if applicable
111689
111681
  if (!buildInfoPath || targetSourceFile || emitSkipped)
111690
111682
  return;
@@ -111695,10 +111687,8 @@ var ts;
111695
111687
  }
111696
111688
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
111697
111689
  var buildInfo = { bundle: bundle, program: program, version: version };
111698
- var buildInfoText = getBuildInfoText(buildInfo);
111699
- (_a = host.buildInfoCallbacks) === null || _a === void 0 ? void 0 : _a.onWrite(buildInfoText.length);
111700
111690
  // Pass buildinfo as additional data to avoid having to reparse
111701
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, buildInfoText, /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
111691
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
111702
111692
  }
111703
111693
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
111704
111694
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -112005,20 +111995,19 @@ var ts;
112005
111995
  }
112006
111996
  /*@internal*/
112007
111997
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
112008
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emitUsingBuildInfo", {}, /*separateBeginAndEnd*/ true);
112009
- ts.performance.mark("beforeEmit");
112010
- var result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
112011
- ts.performance.mark("afterEmit");
112012
- ts.performance.measure("Emit", "beforeEmit", "afterEmit");
112013
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
112014
- return result;
112015
- }
112016
- ts.emitUsingBuildInfo = emitUsingBuildInfo;
112017
- function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers) {
112018
111998
  var createHash = ts.maybeBind(host, host.createHash);
112019
111999
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
112020
- // If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo
112021
- var buildInfo = host.getBuildInfo(buildInfoPath, config.options);
112000
+ var buildInfo;
112001
+ if (host.getBuildInfo) {
112002
+ // If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo
112003
+ buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
112004
+ }
112005
+ else {
112006
+ var buildInfoText = host.readFile(buildInfoPath);
112007
+ if (!buildInfoText)
112008
+ return buildInfoPath;
112009
+ buildInfo = getBuildInfo(buildInfoPath, buildInfoText);
112010
+ }
112022
112011
  if (!buildInfo)
112023
112012
  return buildInfoPath;
112024
112013
  if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
@@ -112051,7 +112040,7 @@ var ts;
112051
112040
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
112052
112041
  /*onlyOwnText*/ true);
112053
112042
  var outputFiles = [];
112054
- var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); }, host);
112043
+ var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
112055
112044
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
112056
112045
  var changedDtsText;
112057
112046
  var changedDtsData;
@@ -112094,8 +112083,7 @@ var ts;
112094
112083
  newBuildInfo.bundle.dts.sources = dts.sources;
112095
112084
  }
112096
112085
  newBuildInfo.bundle.sourceFiles = sourceFiles;
112097
- var newBuildInfoText = getBuildInfoText(newBuildInfo);
112098
- outputFiles.push({ name: name, text: newBuildInfoText, writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
112086
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
112099
112087
  return;
112100
112088
  case declarationFilePath:
112101
112089
  if (declarationText === text)
@@ -112121,12 +112109,12 @@ var ts;
112121
112109
  redirectTargetsMap: ts.createMultiMap(),
112122
112110
  getFileIncludeReasons: ts.notImplemented,
112123
112111
  createHash: createHash,
112124
- buildInfoCallbacks: host.buildInfoCallbacks,
112125
112112
  };
112126
112113
  emitFiles(ts.notImplementedResolver, emitHost,
112127
112114
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
112128
112115
  return outputFiles;
112129
112116
  }
112117
+ ts.emitUsingBuildInfo = emitUsingBuildInfo;
112130
112118
  var PipelinePhase;
112131
112119
  (function (PipelinePhase) {
112132
112120
  PipelinePhase[PipelinePhase["Notification"] = 0] = "Notification";
@@ -117241,12 +117229,15 @@ var ts;
117241
117229
  }
117242
117230
  ts.createCompilerHost = createCompilerHost;
117243
117231
  /*@internal*/
117244
- function createGetSourceFile(readFile, getCompilerOptions, setParentNodes) {
117245
- return function (fileName, languageVersionOrOptions, onError) {
117232
+ function createCompilerHostWorker(options, setParentNodes, system) {
117233
+ if (system === void 0) { system = ts.sys; }
117234
+ var existingDirectories = new ts.Map();
117235
+ var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
117236
+ function getSourceFile(fileName, languageVersionOrOptions, onError) {
117246
117237
  var text;
117247
117238
  try {
117248
117239
  ts.performance.mark("beforeIORead");
117249
- text = readFile(fileName, getCompilerOptions().charset);
117240
+ text = compilerHost.readFile(fileName);
117250
117241
  ts.performance.mark("afterIORead");
117251
117242
  ts.performance.measure("I/O Read", "beforeIORead", "afterIORead");
117252
117243
  }
@@ -117257,18 +117248,24 @@ var ts;
117257
117248
  text = "";
117258
117249
  }
117259
117250
  return text !== undefined ? ts.createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes) : undefined;
117260
- };
117261
- }
117262
- ts.createGetSourceFile = createGetSourceFile;
117263
- /*@internal*/
117264
- function createWriteFile(writeFile, createDirectory, directoryExists) {
117265
- return function (fileName, data, writeByteOrderMark, onError) {
117251
+ }
117252
+ function directoryExists(directoryPath) {
117253
+ if (existingDirectories.has(directoryPath)) {
117254
+ return true;
117255
+ }
117256
+ if ((compilerHost.directoryExists || system.directoryExists)(directoryPath)) {
117257
+ existingDirectories.set(directoryPath, true);
117258
+ return true;
117259
+ }
117260
+ return false;
117261
+ }
117262
+ function writeFile(fileName, data, writeByteOrderMark, onError) {
117266
117263
  try {
117267
117264
  ts.performance.mark("beforeIOWrite");
117268
117265
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
117269
117266
  // the system.writeFile will do its own directory creation and
117270
117267
  // the ensureDirectoriesExist call will always be redundant.
117271
- ts.writeFileEnsuringDirectories(fileName, data, writeByteOrderMark, writeFile, createDirectory, directoryExists);
117268
+ ts.writeFileEnsuringDirectories(fileName, data, writeByteOrderMark, function (path, data, writeByteOrderMark) { return system.writeFile(path, data, writeByteOrderMark); }, function (path) { return (compilerHost.createDirectory || system.createDirectory)(path); }, function (path) { return directoryExists(path); });
117272
117269
  ts.performance.mark("afterIOWrite");
117273
117270
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
117274
117271
  }
@@ -117277,23 +117274,6 @@ var ts;
117277
117274
  onError(e.message);
117278
117275
  }
117279
117276
  }
117280
- };
117281
- }
117282
- ts.createWriteFile = createWriteFile;
117283
- /*@internal*/
117284
- function createCompilerHostWorker(options, setParentNodes, system) {
117285
- if (system === void 0) { system = ts.sys; }
117286
- var existingDirectories = new ts.Map();
117287
- var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
117288
- function directoryExists(directoryPath) {
117289
- if (existingDirectories.has(directoryPath)) {
117290
- return true;
117291
- }
117292
- if ((compilerHost.directoryExists || system.directoryExists)(directoryPath)) {
117293
- existingDirectories.set(directoryPath, true);
117294
- return true;
117295
- }
117296
- return false;
117297
117277
  }
117298
117278
  function getDefaultLibLocation() {
117299
117279
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
@@ -117301,10 +117281,10 @@ var ts;
117301
117281
  var newLine = ts.getNewLineCharacter(options, function () { return system.newLine; });
117302
117282
  var realpath = system.realpath && (function (path) { return system.realpath(path); });
117303
117283
  var compilerHost = {
117304
- getSourceFile: createGetSourceFile(function (fileName) { return compilerHost.readFile(fileName); }, function () { return options; }, setParentNodes),
117284
+ getSourceFile: getSourceFile,
117305
117285
  getDefaultLibLocation: getDefaultLibLocation,
117306
117286
  getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); },
117307
- writeFile: createWriteFile(function (path, data, writeByteOrderMark) { return system.writeFile(path, data, writeByteOrderMark); }, function (path) { return (compilerHost.createDirectory || system.createDirectory)(path); }, function (path) { return directoryExists(path); }),
117287
+ writeFile: writeFile,
117308
117288
  getCurrentDirectory: ts.memoize(function () { return system.getCurrentDirectory(); }),
117309
117289
  useCaseSensitiveFileNames: function () { return system.useCaseSensitiveFileNames; },
117310
117290
  getCanonicalFileName: getCanonicalFileName,
@@ -118915,7 +118895,6 @@ var ts;
118915
118895
  redirectTargetsMap: redirectTargetsMap,
118916
118896
  getFileIncludeReasons: program.getFileIncludeReasons,
118917
118897
  createHash: ts.maybeBind(host, host.createHash),
118918
- buildInfoCallbacks: host.buildInfoCallbacks,
118919
118898
  };
118920
118899
  }
118921
118900
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -118946,7 +118925,7 @@ var ts;
118946
118925
  var path = toPath(fileName);
118947
118926
  var sourceFile = getSourceFileByPath(path);
118948
118927
  return sourceFile ? sourceFile.text : filesByName.has(path) ? undefined : host.readFile(path);
118949
- }, host);
118928
+ });
118950
118929
  }
118951
118930
  function isSourceFileFromExternalLibrary(file) {
118952
118931
  return !!sourceFilesFoundSearchingNodeModules.get(file.path);
@@ -120929,7 +120908,7 @@ var ts;
120929
120908
  }
120930
120909
  ts.parseConfigHostFromCompilerHostLike = parseConfigHostFromCompilerHostLike;
120931
120910
  /* @internal */
120932
- function createPrependNodes(projectReferences, getCommandLine, readFile, host) {
120911
+ function createPrependNodes(projectReferences, getCommandLine, readFile) {
120933
120912
  if (!projectReferences)
120934
120913
  return ts.emptyArray;
120935
120914
  var nodes;
@@ -120942,7 +120921,7 @@ var ts;
120942
120921
  if (!out)
120943
120922
  continue;
120944
120923
  var _a = ts.getOutputPathsForBundle(resolvedRefOpts.options, /*forceDtsPaths*/ true), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
120945
- var node = ts.createInputFiles(readFile, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath, host, resolvedRefOpts.options);
120924
+ var node = ts.createInputFiles(readFile, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath);
120946
120925
  (nodes || (nodes = [])).push(node);
120947
120926
  }
120948
120927
  }
@@ -121759,10 +121738,10 @@ var ts;
121759
121738
  if (!state.cleanedDiagnosticsOfLibFiles) {
121760
121739
  state.cleanedDiagnosticsOfLibFiles = true;
121761
121740
  var program_1 = ts.Debug.checkDefined(state.program);
121762
- var options_3 = program_1.getCompilerOptions();
121741
+ var options_2 = program_1.getCompilerOptions();
121763
121742
  ts.forEach(program_1.getSourceFiles(), function (f) {
121764
121743
  return program_1.isSourceFileDefaultLibrary(f) &&
121765
- !ts.skipTypeChecking(f, options_3, program_1) &&
121744
+ !ts.skipTypeChecking(f, options_2, program_1) &&
121766
121745
  removeSemanticDiagnosticsOf(state, f.resolvedPath);
121767
121746
  });
121768
121747
  }
@@ -124947,11 +124926,25 @@ var ts;
124947
124926
  var useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
124948
124927
  var hostGetNewLine = ts.memoize(function () { return host.getNewLine(); });
124949
124928
  return {
124950
- getSourceFile: ts.createGetSourceFile(function (fileName, encoding) { return host.readFile(fileName, encoding); }, getCompilerOptions,
124951
- /*setParentNodes*/ undefined),
124929
+ getSourceFile: function (fileName, languageVersionOrOptions, onError) {
124930
+ var text;
124931
+ try {
124932
+ ts.performance.mark("beforeIORead");
124933
+ text = host.readFile(fileName, getCompilerOptions().charset);
124934
+ ts.performance.mark("afterIORead");
124935
+ ts.performance.measure("I/O Read", "beforeIORead", "afterIORead");
124936
+ }
124937
+ catch (e) {
124938
+ if (onError) {
124939
+ onError(e.message);
124940
+ }
124941
+ text = "";
124942
+ }
124943
+ return text !== undefined ? ts.createSourceFile(fileName, text, languageVersionOrOptions) : undefined;
124944
+ },
124952
124945
  getDefaultLibLocation: ts.maybeBind(host, host.getDefaultLibLocation),
124953
124946
  getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
124954
- writeFile: ts.createWriteFile(function (path, data, writeByteOrderMark) { return host.writeFile(path, data, writeByteOrderMark); }, function (path) { return host.createDirectory(path); }, function (path) { return host.directoryExists(path); }),
124947
+ writeFile: writeFile,
124955
124948
  getCurrentDirectory: ts.memoize(function () { return host.getCurrentDirectory(); }),
124956
124949
  useCaseSensitiveFileNames: function () { return useCaseSensitiveFileNames; },
124957
124950
  getCanonicalFileName: ts.createGetCanonicalFileName(useCaseSensitiveFileNames),
@@ -124967,8 +124960,23 @@ var ts;
124967
124960
  readDirectory: ts.maybeBind(host, host.readDirectory),
124968
124961
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
124969
124962
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
124970
- buildInfoCallbacks: host.buildInfoCallbacks,
124971
124963
  };
124964
+ function writeFile(fileName, text, writeByteOrderMark, onError) {
124965
+ try {
124966
+ ts.performance.mark("beforeIOWrite");
124967
+ // NOTE: If patchWriteFileEnsuringDirectory has been called,
124968
+ // the host.writeFile will do its own directory creation and
124969
+ // the ensureDirectoriesExist call will always be redundant.
124970
+ ts.writeFileEnsuringDirectories(fileName, text, writeByteOrderMark, function (path, data, writeByteOrderMark) { return host.writeFile(path, data, writeByteOrderMark); }, function (path) { return host.createDirectory(path); }, function (path) { return host.directoryExists(path); });
124971
+ ts.performance.mark("afterIOWrite");
124972
+ ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
124973
+ }
124974
+ catch (e) {
124975
+ if (onError) {
124976
+ onError(e.message);
124977
+ }
124978
+ }
124979
+ }
124972
124980
  }
124973
124981
  ts.createCompilerHostFromProgramHost = createCompilerHostFromProgramHost;
124974
124982
  function setGetSourceFileAsHashVersioned(compilerHost, host) {
@@ -125080,20 +125088,18 @@ var ts;
125080
125088
  var ts;
125081
125089
  (function (ts) {
125082
125090
  function readBuilderProgram(compilerOptions, host) {
125083
- var _a;
125084
125091
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
125085
125092
  if (!buildInfoPath)
125086
125093
  return undefined;
125087
125094
  var buildInfo;
125088
125095
  if (host.getBuildInfo) {
125089
125096
  // host provides buildinfo, get it from there. This allows host to cache it
125090
- buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions);
125097
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
125091
125098
  }
125092
125099
  else {
125093
125100
  var content = host.readFile(buildInfoPath);
125094
125101
  if (!content)
125095
125102
  return undefined;
125096
- (_a = host.buildInfoCallbacks) === null || _a === void 0 ? void 0 : _a.onRead(content.length, compilerOptions);
125097
125103
  buildInfo = ts.getBuildInfo(buildInfoPath, content);
125098
125104
  }
125099
125105
  if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program)
@@ -125336,7 +125342,7 @@ var ts;
125336
125342
  }
125337
125343
  reportFileChangeDetectedOnCreateProgram = false;
125338
125344
  if (host.afterProgramCreate && program !== builderProgram) {
125339
- host.afterProgramCreate(builderProgram, compilerHost);
125345
+ host.afterProgramCreate(builderProgram);
125340
125346
  }
125341
125347
  compilerHost.readFile = originalReadFile;
125342
125348
  compilerHost.fileExists = originalFileExists;
@@ -125974,7 +125980,7 @@ var ts;
125974
125980
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
125975
125981
  };
125976
125982
  }
125977
- compilerHost.getBuildInfo = function (fileName, options) { return getBuildInfo(state, fileName, options, toResolvedConfigFilePath(state, options.configFilePath), /*modifiedTime*/ undefined); };
125983
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
125978
125984
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
125979
125985
  var state = {
125980
125986
  host: host,
@@ -126426,7 +126432,7 @@ var ts;
126426
126432
  }
126427
126433
  function emit(writeFileCallback, cancellationToken, customTransformers) {
126428
126434
  var _a;
126429
- var _b, _c, _d, _e, _f;
126435
+ var _b, _c, _d;
126430
126436
  ts.Debug.assertIsDefined(program);
126431
126437
  ts.Debug.assert(step === BuildStep.Emit);
126432
126438
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
@@ -126441,8 +126447,6 @@ var ts;
126441
126447
  // Don't emit .d.ts if there are decl file errors
126442
126448
  if (declDiagnostics) {
126443
126449
  program.restoreEmitState(saved);
126444
- // Revert buildInfo write size
126445
- (_d = state.compilerHost.buildInfoCallbacks) === null || _d === void 0 ? void 0 : _d.revertLastWrite();
126446
126450
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
126447
126451
  return {
126448
126452
  emitSkipped: true,
@@ -126451,8 +126455,7 @@ var ts;
126451
126455
  }
126452
126456
  // Actual Emit
126453
126457
  var host = state.host, compilerHost = state.compilerHost;
126454
- (_e = compilerHost.buildInfoCallbacks) === null || _e === void 0 ? void 0 : _e.clearLastWrite();
126455
- var resultFlags = ((_f = program.hasChangedEmitSignature) === null || _f === void 0 ? void 0 : _f.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged;
126458
+ var resultFlags = ((_d = program.hasChangedEmitSignature) === null || _d === void 0 ? void 0 : _d.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged;
126456
126459
  var emitterDiagnostics = ts.createDiagnosticCollection();
126457
126460
  var emittedOutputs = new ts.Map();
126458
126461
  var options = program.getCompilerOptions();
@@ -126519,7 +126522,7 @@ var ts;
126519
126522
  return emitDiagnostics;
126520
126523
  }
126521
126524
  function emitBundle(writeFileCallback, customTransformers) {
126522
- var _a, _b, _c, _d;
126525
+ var _a, _b;
126523
126526
  ts.Debug.assert(kind === InvalidatedProjectKind.UpdateBundle);
126524
126527
  if (state.options.dry) {
126525
126528
  reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_output_of_project_0, project);
@@ -126532,11 +126535,10 @@ var ts;
126532
126535
  // Update js, and source map
126533
126536
  var compilerHost = state.compilerHost;
126534
126537
  state.projectCompilerOptions = config.options;
126535
- (_b = (_a = state.host).beforeEmitBundle) === null || _b === void 0 ? void 0 : _b.call(_a, config, compilerHost);
126536
126538
  var outputFiles = ts.emitUsingBuildInfo(config, compilerHost, function (ref) {
126537
126539
  var refName = resolveProjectName(state, ref.path);
126538
126540
  return parseConfigFile(state, refName, toResolvedConfigFilePath(state, refName));
126539
- }, customTransformers || ((_d = (_c = state.host).getCustomTransformers) === null || _d === void 0 ? void 0 : _d.call(_c, project)));
126541
+ }, customTransformers || ((_b = (_a = state.host).getCustomTransformers) === null || _b === void 0 ? void 0 : _b.call(_a, project)));
126540
126542
  if (ts.isString(outputFiles)) {
126541
126543
  reportStatus(state, ts.Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, project, relName(state, outputFiles));
126542
126544
  step = BuildStep.BuildInvalidatedProjectOfBundle;
@@ -126734,12 +126736,12 @@ var ts;
126734
126736
  if (state.write)
126735
126737
  ts.listFiles(program, state.write);
126736
126738
  if (state.host.afterProgramEmitAndDiagnostics) {
126737
- state.host.afterProgramEmitAndDiagnostics(program, state.compilerHost);
126739
+ state.host.afterProgramEmitAndDiagnostics(program);
126738
126740
  }
126739
126741
  program.releaseProgram();
126740
126742
  }
126741
126743
  else if (state.host.afterEmitBundle) {
126742
- state.host.afterEmitBundle(config, state.compilerHost);
126744
+ state.host.afterEmitBundle(config);
126743
126745
  }
126744
126746
  state.projectCompilerOptions = state.baseCompilerOptions;
126745
126747
  }
@@ -126839,16 +126841,13 @@ var ts;
126839
126841
  var existing = state.buildInfoCache.get(resolvedConfigPath);
126840
126842
  return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
126841
126843
  }
126842
- function getBuildInfo(state, buildInfoPath, options, resolvedConfigPath, modifiedTime) {
126843
- var _a;
126844
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
126844
126845
  var path = toPath(state, buildInfoPath);
126845
126846
  var existing = state.buildInfoCache.get(resolvedConfigPath);
126846
126847
  if (existing !== undefined && existing.path === path) {
126847
126848
  return existing.buildInfo || undefined;
126848
126849
  }
126849
126850
  var value = state.readFileWithCache(buildInfoPath);
126850
- if (value)
126851
- (_a = (modifiedTime ? state.host : state.compilerHost).buildInfoCallbacks) === null || _a === void 0 ? void 0 : _a.onRead(value.length, options);
126852
126851
  var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined;
126853
126852
  state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
126854
126853
  return buildInfo;
@@ -126934,7 +126933,7 @@ var ts;
126934
126933
  missingOutputFileName: buildInfoPath
126935
126934
  };
126936
126935
  }
126937
- var buildInfo = getBuildInfo(state, buildInfoPath, project.options, resolvedPath, buildInfoTime);
126936
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime);
126938
126937
  if (!buildInfo) {
126939
126938
  // Error reading buildInfo
126940
126939
  return {
@@ -5430,7 +5430,7 @@ declare namespace ts {
5430
5430
  /** If provided, use this method to get parsed command lines for referenced projects */
5431
5431
  getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
5432
5432
  /** If provided, callback to invoke after every new program creation */
5433
- afterProgramCreate?(program: T, host?: CompilerHost): void;
5433
+ afterProgramCreate?(program: T): void;
5434
5434
  }
5435
5435
  /**
5436
5436
  * Host to create watch with root files and options
@@ -5521,7 +5521,7 @@ declare namespace ts {
5521
5521
  getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
5522
5522
  reportDiagnostic: DiagnosticReporter;
5523
5523
  reportSolutionBuilderStatus: DiagnosticReporter;
5524
- afterProgramEmitAndDiagnostics?(program: T, host?: CompilerHost): void;
5524
+ afterProgramEmitAndDiagnostics?(program: T): void;
5525
5525
  }
5526
5526
  interface SolutionBuilderHost<T extends BuilderProgram> extends SolutionBuilderHostBase<T> {
5527
5527
  reportErrorSummary?: ReportEmitErrorSummary;