Skip to content

Commit

Permalink
Bump version to 5.0.4 and LKG
Browse files Browse the repository at this point in the history
  • Loading branch information
typescript-bot committed Apr 5, 2023
1 parent dc7e5a7 commit 3b45f4d
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 79 deletions.
44 changes: 26 additions & 18 deletions lib/tsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var __export = (target, all) => {

// src/compiler/corePublic.ts
var versionMajorMinor = "5.0";
var version = "5.0.3";
var version = "5.0.4";

// src/compiler/core.ts
var emptyArray = [];
Expand Down Expand Up @@ -16192,6 +16192,9 @@ function getAllowSyntheticDefaultImports(compilerOptions) {
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
}
function shouldResolveJsRequire(compilerOptions) {
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
}
function getResolvePackageJsonExports(compilerOptions) {
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
Expand Down Expand Up @@ -29242,6 +29245,12 @@ var Parser;
if (languageVariant === 1 /* JSX */) {
return parseJsxElementOrSelfClosingElementOrFragment(
/*inExpressionContext*/
true,
/*topInvalidNodePosition*/
void 0,
/*openingTag*/
void 0,
/*mustBeUnary*/
true
);
}
Expand Down Expand Up @@ -29346,7 +29355,7 @@ var Parser;
true
)), pos);
}
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag, mustBeUnary = false) {
const pos = getNodePos();
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
let result;
Expand Down Expand Up @@ -29384,7 +29393,7 @@ var Parser;
Debug.assert(opening.kind === 282 /* JsxSelfClosingElement */);
result = opening;
}
if (inExpressionContext && token() === 29 /* LessThanToken */) {
if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) {
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
/*inExpressionContext*/
Expand Down Expand Up @@ -34074,7 +34083,8 @@ var commandOptionsWithoutBuild = [
affectsSemanticDiagnostics: true,
category: Diagnostics.Modules,
description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
defaultValueDescription: false
defaultValueDescription: false,
transpileOptionValue: void 0
},
{
name: "resolvePackageJsonExports",
Expand Down Expand Up @@ -41311,7 +41321,7 @@ function createBinder() {
}
if (!isBindingPattern(node.name)) {
const possibleVariableDecl = node.kind === 257 /* VariableDeclaration */ ? node : node.parent.parent;
if (isInJSFile(node) && getEmitModuleResolutionKind(options) !== 100 /* Bundler */ && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
} else if (isBlockOrCatchScoped(node)) {
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
Expand Down Expand Up @@ -44849,7 +44859,7 @@ function createTypeChecker(host) {
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
if (hasExportAssignmentSymbol(moduleSymbol) && !(getAllowSyntheticDefaultImports(compilerOptions) || getESModuleInterop(compilerOptions))) {
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
const exportAssignment = exportEqualsSymbol.valueDeclaration;
Expand Down Expand Up @@ -45017,7 +45027,7 @@ function createTypeChecker(host) {
if (!isIdentifier(name)) {
return void 0;
}
const suppressInteropError = name.escapedText === "default" /* Default */ && !!(compilerOptions.allowSyntheticDefaultImports || getESModuleInterop(compilerOptions));
const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
const targetSymbol = resolveESModuleSymbol(
moduleSymbol,
moduleSpecifier,
Expand Down Expand Up @@ -49646,7 +49656,7 @@ function createTypeChecker(host) {
return;
}
let verbatimTargetName = isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || unescapeLeadingUnderscores(target.escapedName);
if (verbatimTargetName === "export=" /* ExportEquals */ && (getESModuleInterop(compilerOptions) || compilerOptions.allowSyntheticDefaultImports)) {
if (verbatimTargetName === "export=" /* ExportEquals */ && allowSyntheticDefaultImports) {
verbatimTargetName = "default" /* Default */;
}
const targetName = getInternalSymbolName(target, verbatimTargetName);
Expand Down Expand Up @@ -70737,7 +70747,7 @@ function createTypeChecker(host) {
return anyType;
}
}
if (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */ && isCommonJsRequire(node)) {
if (isInJSFile(node) && shouldResolveJsRequire(compilerOptions) && isCommonJsRequire(node)) {
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
}
const returnType = getReturnTypeOfSignature(signature);
Expand Down Expand Up @@ -89240,11 +89250,12 @@ function transformClassFields(context) {
return visitEachChild(node, visitor, context);
}
function visitArrayAssignmentElement(node) {
Debug.assertNode(node, isArrayBindingOrAssignmentElement);
if (isSpreadElement(node))
return visitAssignmentRestElement(node);
if (!isOmittedExpression(node))
return visitAssignmentElement(node);
if (isArrayBindingOrAssignmentElement(node)) {
if (isSpreadElement(node))
return visitAssignmentRestElement(node);
if (!isOmittedExpression(node))
return visitAssignmentElement(node);
}
return visitEachChild(node, visitor, context);
}
function visitAssignmentProperty(node) {
Expand Down Expand Up @@ -114357,7 +114368,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
false
);
}
const shouldProcessRequires = isJavaScriptFile && getEmitModuleResolutionKind(options) !== 100 /* Bundler */;
const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options);
if (file.flags & 2097152 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
collectDynamicImportOrRequireCalls(file);
}
Expand Down Expand Up @@ -115285,9 +115296,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
}
if (options.isolatedModules) {
createRedundantOptionDiagnostic("isolatedModules", "verbatimModuleSyntax");
}
if (options.preserveValueImports) {
createRedundantOptionDiagnostic("preserveValueImports", "verbatimModuleSyntax");
}
Expand Down
47 changes: 29 additions & 18 deletions lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2070,6 +2070,7 @@ __export(server_exports, {
setValueDeclaration: () => setValueDeclaration,
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
shouldResolveJsRequire: () => shouldResolveJsRequire,
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
showModuleSpecifier: () => showModuleSpecifier,
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
Expand Down Expand Up @@ -2286,7 +2287,7 @@ module.exports = __toCommonJS(server_exports);

// src/compiler/corePublic.ts
var versionMajorMinor = "5.0";
var version = "5.0.3";
var version = "5.0.4";
var Comparison = /* @__PURE__ */ ((Comparison3) => {
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
Expand Down Expand Up @@ -20263,6 +20264,9 @@ function getAllowSyntheticDefaultImports(compilerOptions) {
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
}
function shouldResolveJsRequire(compilerOptions) {
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
}
function getResolvePackageJsonExports(compilerOptions) {
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
Expand Down Expand Up @@ -33580,6 +33584,12 @@ var Parser;
if (languageVariant === 1 /* JSX */) {
return parseJsxElementOrSelfClosingElementOrFragment(
/*inExpressionContext*/
true,
/*topInvalidNodePosition*/
void 0,
/*openingTag*/
void 0,
/*mustBeUnary*/
true
);
}
Expand Down Expand Up @@ -33684,7 +33694,7 @@ var Parser;
true
)), pos);
}
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag, mustBeUnary = false) {
const pos = getNodePos();
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
let result;
Expand Down Expand Up @@ -33722,7 +33732,7 @@ var Parser;
Debug.assert(opening.kind === 282 /* JsxSelfClosingElement */);
result = opening;
}
if (inExpressionContext && token() === 29 /* LessThanToken */) {
if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) {
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
/*inExpressionContext*/
Expand Down Expand Up @@ -38412,7 +38422,8 @@ var commandOptionsWithoutBuild = [
affectsSemanticDiagnostics: true,
category: Diagnostics.Modules,
description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
defaultValueDescription: false
defaultValueDescription: false,
transpileOptionValue: void 0
},
{
name: "resolvePackageJsonExports",
Expand Down Expand Up @@ -45862,7 +45873,7 @@ function createBinder() {
}
if (!isBindingPattern(node.name)) {
const possibleVariableDecl = node.kind === 257 /* VariableDeclaration */ ? node : node.parent.parent;
if (isInJSFile(node) && getEmitModuleResolutionKind(options) !== 100 /* Bundler */ && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
} else if (isBlockOrCatchScoped(node)) {
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
Expand Down Expand Up @@ -49448,7 +49459,7 @@ function createTypeChecker(host) {
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
if (hasExportAssignmentSymbol(moduleSymbol) && !(getAllowSyntheticDefaultImports(compilerOptions) || getESModuleInterop(compilerOptions))) {
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
const exportAssignment = exportEqualsSymbol.valueDeclaration;
Expand Down Expand Up @@ -49616,7 +49627,7 @@ function createTypeChecker(host) {
if (!isIdentifier(name)) {
return void 0;
}
const suppressInteropError = name.escapedText === "default" /* Default */ && !!(compilerOptions.allowSyntheticDefaultImports || getESModuleInterop(compilerOptions));
const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
const targetSymbol = resolveESModuleSymbol(
moduleSymbol,
moduleSpecifier,
Expand Down Expand Up @@ -54245,7 +54256,7 @@ function createTypeChecker(host) {
return;
}
let verbatimTargetName = isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || unescapeLeadingUnderscores(target.escapedName);
if (verbatimTargetName === "export=" /* ExportEquals */ && (getESModuleInterop(compilerOptions) || compilerOptions.allowSyntheticDefaultImports)) {
if (verbatimTargetName === "export=" /* ExportEquals */ && allowSyntheticDefaultImports) {
verbatimTargetName = "default" /* Default */;
}
const targetName = getInternalSymbolName(target, verbatimTargetName);
Expand Down Expand Up @@ -75336,7 +75347,7 @@ function createTypeChecker(host) {
return anyType;
}
}
if (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */ && isCommonJsRequire(node)) {
if (isInJSFile(node) && shouldResolveJsRequire(compilerOptions) && isCommonJsRequire(node)) {
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
}
const returnType = getReturnTypeOfSignature(signature);
Expand Down Expand Up @@ -94010,11 +94021,12 @@ function transformClassFields(context) {
return visitEachChild(node, visitor, context);
}
function visitArrayAssignmentElement(node) {
Debug.assertNode(node, isArrayBindingOrAssignmentElement);
if (isSpreadElement(node))
return visitAssignmentRestElement(node);
if (!isOmittedExpression(node))
return visitAssignmentElement(node);
if (isArrayBindingOrAssignmentElement(node)) {
if (isSpreadElement(node))
return visitAssignmentRestElement(node);
if (!isOmittedExpression(node))
return visitAssignmentElement(node);
}
return visitEachChild(node, visitor, context);
}
function visitAssignmentProperty(node) {
Expand Down Expand Up @@ -119192,7 +119204,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
false
);
}
const shouldProcessRequires = isJavaScriptFile && getEmitModuleResolutionKind(options) !== 100 /* Bundler */;
const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options);
if (file.flags & 2097152 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
collectDynamicImportOrRequireCalls(file);
}
Expand Down Expand Up @@ -120120,9 +120132,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
}
if (options.isolatedModules) {
createRedundantOptionDiagnostic("isolatedModules", "verbatimModuleSyntax");
}
if (options.preserveValueImports) {
createRedundantOptionDiagnostic("preserveValueImports", "verbatimModuleSyntax");
}
Expand Down Expand Up @@ -169780,6 +169789,7 @@ __export(ts_exports3, {
setValueDeclaration: () => setValueDeclaration,
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
shouldResolveJsRequire: () => shouldResolveJsRequire,
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
showModuleSpecifier: () => showModuleSpecifier,
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
Expand Down Expand Up @@ -183727,6 +183737,7 @@ start(initializeNodeSystem(), require("os").platform());
setValueDeclaration,
shouldAllowImportingTsExtension,
shouldPreserveConstEnums,
shouldResolveJsRequire,
shouldUseUriStyleNodeCoreModules,
showModuleSpecifier,
signatureHasLiteralTypes,
Expand Down
Loading

0 comments on commit 3b45f4d

Please sign in to comment.