mirror of
https://github.com/denoland/deno.git
synced 2024-12-25 00:29:09 -05:00
fix(cli): upgrade to Typescript 5.0.4 (#19090)
This commit is contained in:
parent
14bf8dc506
commit
ba7fd57616
3 changed files with 29 additions and 20 deletions
|
@ -467,7 +467,7 @@ fn main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
let ts_version = ts::version();
|
let ts_version = ts::version();
|
||||||
debug_assert_eq!(ts_version, "5.0.3"); // bump this assertion when it changes
|
debug_assert_eq!(ts_version, "5.0.4"); // bump this assertion when it changes
|
||||||
println!("cargo:rustc-env=TS_VERSION={}", ts_version);
|
println!("cargo:rustc-env=TS_VERSION={}", ts_version);
|
||||||
println!("cargo:rerun-if-env-changed=TS_VERSION");
|
println!("cargo:rerun-if-env-changed=TS_VERSION");
|
||||||
|
|
||||||
|
|
|
@ -6,5 +6,5 @@ Deno.test(function version() {
|
||||||
const pattern = /^\d+\.\d+\.\d+/;
|
const pattern = /^\d+\.\d+\.\d+/;
|
||||||
assert(pattern.test(Deno.version.deno));
|
assert(pattern.test(Deno.version.deno));
|
||||||
assert(pattern.test(Deno.version.v8));
|
assert(pattern.test(Deno.version.v8));
|
||||||
assertEquals(Deno.version.typescript, "5.0.3");
|
assertEquals(Deno.version.typescript, "5.0.4");
|
||||||
});
|
});
|
||||||
|
|
45
cli/tsc/00_typescript.js
vendored
45
cli/tsc/00_typescript.js
vendored
|
@ -35,7 +35,7 @@ var ts = (() => {
|
||||||
"src/compiler/corePublic.ts"() {
|
"src/compiler/corePublic.ts"() {
|
||||||
"use strict";
|
"use strict";
|
||||||
versionMajorMinor = "5.0";
|
versionMajorMinor = "5.0";
|
||||||
version = "5.0.3";
|
version = "5.0.4";
|
||||||
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
||||||
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
||||||
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
||||||
|
@ -17997,6 +17997,9 @@ ${lanes.join("\n")}
|
||||||
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
||||||
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
||||||
}
|
}
|
||||||
|
function shouldResolveJsRequire(compilerOptions) {
|
||||||
|
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
|
||||||
|
}
|
||||||
function getResolvePackageJsonExports(compilerOptions) {
|
function getResolvePackageJsonExports(compilerOptions) {
|
||||||
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
||||||
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
||||||
|
@ -31698,6 +31701,12 @@ ${lanes.join("\n")}
|
||||||
if (languageVariant === 1 /* JSX */) {
|
if (languageVariant === 1 /* JSX */) {
|
||||||
return parseJsxElementOrSelfClosingElementOrFragment(
|
return parseJsxElementOrSelfClosingElementOrFragment(
|
||||||
/*inExpressionContext*/
|
/*inExpressionContext*/
|
||||||
|
true,
|
||||||
|
/*topInvalidNodePosition*/
|
||||||
|
void 0,
|
||||||
|
/*openingTag*/
|
||||||
|
void 0,
|
||||||
|
/*mustBeUnary*/
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -31802,7 +31811,7 @@ ${lanes.join("\n")}
|
||||||
true
|
true
|
||||||
)), pos);
|
)), pos);
|
||||||
}
|
}
|
||||||
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
|
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag, mustBeUnary = false) {
|
||||||
const pos = getNodePos();
|
const pos = getNodePos();
|
||||||
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
|
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
|
||||||
let result;
|
let result;
|
||||||
|
@ -31840,7 +31849,7 @@ ${lanes.join("\n")}
|
||||||
Debug.assert(opening.kind === 282 /* JsxSelfClosingElement */);
|
Debug.assert(opening.kind === 282 /* JsxSelfClosingElement */);
|
||||||
result = opening;
|
result = opening;
|
||||||
}
|
}
|
||||||
if (inExpressionContext && token() === 29 /* LessThanToken */) {
|
if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) {
|
||||||
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
|
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
|
||||||
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
|
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
|
||||||
/*inExpressionContext*/
|
/*inExpressionContext*/
|
||||||
|
@ -38075,7 +38084,8 @@ ${lanes.join("\n")}
|
||||||
affectsBuildInfo: true,
|
affectsBuildInfo: true,
|
||||||
category: Diagnostics.Modules,
|
category: Diagnostics.Modules,
|
||||||
description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
|
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",
|
name: "resolvePackageJsonExports",
|
||||||
|
@ -43773,7 +43783,7 @@ ${lanes.join("\n")}
|
||||||
}
|
}
|
||||||
if (!isBindingPattern(node.name)) {
|
if (!isBindingPattern(node.name)) {
|
||||||
const possibleVariableDecl = node.kind === 257 /* VariableDeclaration */ ? node : node.parent.parent;
|
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 */);
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
||||||
} else if (isBlockOrCatchScoped(node)) {
|
} else if (isBlockOrCatchScoped(node)) {
|
||||||
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
||||||
|
@ -47284,7 +47294,7 @@ ${lanes.join("\n")}
|
||||||
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
||||||
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
||||||
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
||||||
if (hasExportAssignmentSymbol(moduleSymbol) && !(getAllowSyntheticDefaultImports(compilerOptions) || getESModuleInterop(compilerOptions))) {
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
||||||
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
||||||
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
||||||
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
||||||
|
@ -47452,7 +47462,7 @@ ${lanes.join("\n")}
|
||||||
if (!isIdentifier(name)) {
|
if (!isIdentifier(name)) {
|
||||||
return void 0;
|
return void 0;
|
||||||
}
|
}
|
||||||
const suppressInteropError = name.escapedText === "default" /* Default */ && !!(compilerOptions.allowSyntheticDefaultImports || getESModuleInterop(compilerOptions));
|
const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
|
||||||
const targetSymbol = resolveESModuleSymbol(
|
const targetSymbol = resolveESModuleSymbol(
|
||||||
moduleSymbol,
|
moduleSymbol,
|
||||||
moduleSpecifier,
|
moduleSpecifier,
|
||||||
|
@ -52116,7 +52126,7 @@ ${lanes.join("\n")}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let verbatimTargetName = isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || unescapeLeadingUnderscores(target.escapedName);
|
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 */;
|
verbatimTargetName = "default" /* Default */;
|
||||||
}
|
}
|
||||||
const targetName = getInternalSymbolName(target, verbatimTargetName);
|
const targetName = getInternalSymbolName(target, verbatimTargetName);
|
||||||
|
@ -73215,7 +73225,7 @@ ${lanes.join("\n")}
|
||||||
return anyType;
|
return anyType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */ && isCommonJsRequire(node)) {
|
if (isInJSFile(node) && shouldResolveJsRequire(compilerOptions) && isCommonJsRequire(node)) {
|
||||||
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
|
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
|
||||||
}
|
}
|
||||||
const returnType = getReturnTypeOfSignature(signature);
|
const returnType = getReturnTypeOfSignature(signature);
|
||||||
|
@ -92253,11 +92263,12 @@ ${lanes.join("\n")}
|
||||||
return visitEachChild(node, visitor, context);
|
return visitEachChild(node, visitor, context);
|
||||||
}
|
}
|
||||||
function visitArrayAssignmentElement(node) {
|
function visitArrayAssignmentElement(node) {
|
||||||
Debug.assertNode(node, isArrayBindingOrAssignmentElement);
|
if (isArrayBindingOrAssignmentElement(node)) {
|
||||||
if (isSpreadElement(node))
|
if (isSpreadElement(node))
|
||||||
return visitAssignmentRestElement(node);
|
return visitAssignmentRestElement(node);
|
||||||
if (!isOmittedExpression(node))
|
if (!isOmittedExpression(node))
|
||||||
return visitAssignmentElement(node);
|
return visitAssignmentElement(node);
|
||||||
|
}
|
||||||
return visitEachChild(node, visitor, context);
|
return visitEachChild(node, visitor, context);
|
||||||
}
|
}
|
||||||
function visitAssignmentProperty(node) {
|
function visitAssignmentProperty(node) {
|
||||||
|
@ -117468,7 +117479,7 @@ ${lanes.join("\n")}
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const shouldProcessRequires = isJavaScriptFile && getEmitModuleResolutionKind(options) !== 100 /* Bundler */;
|
const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options);
|
||||||
if (file.flags & 2097152 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
|
if (file.flags & 2097152 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
|
||||||
collectDynamicImportOrRequireCalls(file);
|
collectDynamicImportOrRequireCalls(file);
|
||||||
}
|
}
|
||||||
|
@ -118396,9 +118407,6 @@ ${lanes.join("\n")}
|
||||||
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
|
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");
|
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) {
|
if (options.preserveValueImports) {
|
||||||
createRedundantOptionDiagnostic("preserveValueImports", "verbatimModuleSyntax");
|
createRedundantOptionDiagnostic("preserveValueImports", "verbatimModuleSyntax");
|
||||||
}
|
}
|
||||||
|
@ -169808,6 +169816,7 @@ ${options.prefix}` : "\n" : options.prefix
|
||||||
setValueDeclaration: () => setValueDeclaration,
|
setValueDeclaration: () => setValueDeclaration,
|
||||||
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
||||||
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
||||||
|
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
||||||
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
||||||
showModuleSpecifier: () => showModuleSpecifier,
|
showModuleSpecifier: () => showModuleSpecifier,
|
||||||
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
||||||
|
|
Loading…
Reference in a new issue