diff --git a/src/BundleTransformer.TypeScript/BundleTransformer.TypeScript.csproj b/src/BundleTransformer.TypeScript/BundleTransformer.TypeScript.csproj index 368bff4a..9c0cb329 100644 --- a/src/BundleTransformer.TypeScript/BundleTransformer.TypeScript.csproj +++ b/src/BundleTransformer.TypeScript/BundleTransformer.TypeScript.csproj @@ -8,14 +8,14 @@ true $(NoWarn);CS1591;NU5125 true - BundleTransformer.TypeScript contains one translator-adapter - `TypeScriptTranslator` (supports the TypeScript (http://www.typescriptlang.org) version 4.0 RTM). This adapter makes translation of TypeScript code to JS code. Also contains the `TypeScriptAssetHandler` debugging HTTP handler, which is responsible for text output of translated TypeScript asset. + BundleTransformer.TypeScript contains one translator-adapter - `TypeScriptTranslator` (supports the TypeScript (http://www.typescriptlang.org) version 4.0.5). This adapter makes translation of TypeScript code to JS code. Also contains the `TypeScriptAssetHandler` debugging HTTP handler, which is responsible for text output of translated TypeScript asset. BundleTransformer.TypeScript does not support external modules (CommonJS, AMD, SystemJS, UMD and ES6 modules). As a JS engine is used the JavaScript Engine Switcher library (https://github.com/Taritsyn/JavaScriptEngineSwitcher). For correct working of this module, you need to install one of the following NuGet packages: JavaScriptEngineSwitcher.Msie (only in the Chakra “Edge” JsRT mode), JavaScriptEngineSwitcher.V8 or JavaScriptEngineSwitcher.ChakraCore. https://raw.githubusercontent.com/Taritsyn/BundleTransformer/master/images/icons/128/BundleTransformer_TypeScript_Logo_128x128.png BundleTransformer;System.Web.Optimization;IBundleTransform;ASP.NET;JavaScript;JS;Bundling;TypeScript;Translation;Translator;Compilation;Compiler - Added support of the TypeScript version 4.0 RTM (please note: The 4.0 RTM release is also called '4.0.2'). + Added support of the TypeScript version 4.0.5. diff --git a/src/BundleTransformer.TypeScript/Resources/typescript-combined.js b/src/BundleTransformer.TypeScript/Resources/typescript-combined.js index 2b7e167c..e382f2d2 100644 --- a/src/BundleTransformer.TypeScript/Resources/typescript-combined.js +++ b/src/BundleTransformer.TypeScript/Resources/typescript-combined.js @@ -67,7 +67,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { var ts; (function (ts) { ts.versionMajorMinor = "4.0"; - ts.version = "4.0.2"; + ts.version = "4.0.5"; var NativeCollections; (function (NativeCollections) { function tryGetNativeMap() { @@ -55293,13 +55293,10 @@ var ts; function checkTupleType(node) { var elementTypes = node.elements; var seenOptionalElement = false; - var seenNamedElement = false; + var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var i = 0; i < elementTypes.length; i++) { var e = elementTypes[i]; - if (e.kind === 191) { - seenNamedElement = true; - } - else if (seenNamedElement) { + if (e.kind !== 191 && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -69855,6 +69852,8 @@ var ts; switch (node.kind) { case 213: return visitBinaryExpression(node); + case 332: + return visitCommaListExpression(node); case 214: return visitConditionalExpression(node); case 216: @@ -70046,20 +70045,6 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitLogicalBinaryExpression(node) { - var resultLabel = defineLabel(); - var resultLocal = declareLocal(); - emitAssignment(resultLocal, ts.visitNode(node.left, visitor, ts.isExpression), node.left); - if (node.operatorToken.kind === 55) { - emitBreakWhenFalse(resultLabel, resultLocal, node.left); - } - else { - emitBreakWhenTrue(resultLabel, resultLocal, node.left); - } - emitAssignment(resultLocal, ts.visitNode(node.right, visitor, ts.isExpression), node.right); - markLabel(resultLabel); - return resultLocal; - } function visitCommaExpression(node) { var pendingExpressions = []; visit(node.left); @@ -70079,6 +70064,37 @@ var ts; } } } + function visitCommaListExpression(node) { + var pendingExpressions = []; + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var elem = _a[_i]; + if (ts.isBinaryExpression(elem) && elem.operatorToken.kind === 27) { + pendingExpressions.push(visitCommaExpression(elem)); + } + else { + if (containsYield(elem) && pendingExpressions.length > 0) { + emitWorker(1, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts.visitNode(elem, visitor, ts.isExpression)); + } + } + return factory.inlineExpressions(pendingExpressions); + } + function visitLogicalBinaryExpression(node) { + var resultLabel = defineLabel(); + var resultLocal = declareLocal(); + emitAssignment(resultLocal, ts.visitNode(node.left, visitor, ts.isExpression), node.left); + if (node.operatorToken.kind === 55) { + emitBreakWhenFalse(resultLabel, resultLocal, node.left); + } + else { + emitBreakWhenTrue(resultLabel, resultLocal, node.left); + } + emitAssignment(resultLocal, ts.visitNode(node.right, visitor, ts.isExpression), node.right); + markLabel(resultLabel); + return resultLocal; + } function visitConditionalExpression(node) { if (containsYield(node.whenTrue) || containsYield(node.whenFalse)) { var whenFalseLabel = defineLabel(); @@ -80481,6 +80497,7 @@ var ts; getOptionsDiagnostics: getOptionsDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, + getCachedSemanticDiagnostics: getCachedSemanticDiagnostics, getSuggestionDiagnostics: getSuggestionDiagnostics, getDeclarationDiagnostics: getDeclarationDiagnostics, getBindAndCheckDiagnostics: getBindAndCheckDiagnostics, @@ -80995,6 +81012,11 @@ var ts; function getSemanticDiagnostics(sourceFile, cancellationToken) { return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); } + function getCachedSemanticDiagnostics(sourceFile) { + var _a; + return sourceFile + ? (_a = cachedBindAndCheckDiagnosticsForFile.perFile) === null || _a === void 0 ? void 0 : _a.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics; + } function getBindAndCheckDiagnostics(sourceFile, cancellationToken) { return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken); } @@ -83589,30 +83611,49 @@ var ts; return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0, customTransformers), affected, emitKind, isPendingEmitFile); } function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) { + var restorePendingEmitOnHandlingNoEmitSuccess = false; + var savedAffectedFilesPendingEmit; + var savedAffectedFilesPendingEmitKind; + var savedAffectedFilesPendingEmitIndex; + if (kind !== BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram && + !targetSourceFile && + !ts.outFile(state.compilerOptions) && + !state.compilerOptions.noEmit && + state.compilerOptions.noEmitOnError) { + restorePendingEmitOnHandlingNoEmitSuccess = true; + savedAffectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(); + savedAffectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind); + savedAffectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex; + } if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) { assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile); - var result = ts.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken); - if (result) - return result; - if (!targetSourceFile) { - var sourceMaps = []; - var emitSkipped = false; - var diagnostics = void 0; - var emittedFiles = []; - var affectedEmitResult = void 0; - while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) { - emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped; - diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics); - emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles); - sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps); - } - return { - emitSkipped: emitSkipped, - diagnostics: diagnostics || ts.emptyArray, - emittedFiles: emittedFiles, - sourceMaps: sourceMaps - }; + } + var result = ts.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken); + if (result) + return result; + if (restorePendingEmitOnHandlingNoEmitSuccess) { + state.affectedFilesPendingEmit = savedAffectedFilesPendingEmit; + state.affectedFilesPendingEmitKind = savedAffectedFilesPendingEmitKind; + state.affectedFilesPendingEmitIndex = savedAffectedFilesPendingEmitIndex; + } + if (!targetSourceFile && kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) { + var sourceMaps = []; + var emitSkipped = false; + var diagnostics = void 0; + var emittedFiles = []; + var affectedEmitResult = void 0; + while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) { + emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped; + diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics); + emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles); + sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps); } + return { + emitSkipped: emitSkipped, + diagnostics: diagnostics || ts.emptyArray, + emittedFiles: emittedFiles, + sourceMaps: sourceMaps + }; } return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers); } @@ -83625,7 +83666,7 @@ var ts; else if (affected === state.program) { return toAffectedFileResult(state, state.program.getSemanticDiagnostics(undefined, cancellationToken), affected); } - if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) { + if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram || state.compilerOptions.noEmit || state.compilerOptions.noEmitOnError) { addToAffectedFilesPendingEmit(state, affected.resolvedPath, 1); } if (ignoreSourceFile && ignoreSourceFile(affected)) { diff --git a/src/BundleTransformer.TypeScript/readme.txt b/src/BundleTransformer.TypeScript/readme.txt index 037e4bb3..100abc80 100644 --- a/src/BundleTransformer.TypeScript/readme.txt +++ b/src/BundleTransformer.TypeScript/readme.txt @@ -13,7 +13,7 @@ =========== BundleTransformer.TypeScript contains one translator-adapter - `TypeScriptTranslator` (supports the TypeScript (http://www.typescriptlang.org) - version 4.0 RTM). This adapter makes translation of TypeScript code to JS code. + version 4.0.5). This adapter makes translation of TypeScript code to JS code. Also contains the `TypeScriptAssetHandler` debugging HTTP handler, which is responsible for text output of translated TypeScript asset. @@ -26,8 +26,7 @@ ============= RELEASE NOTES ============= - Added support of the TypeScript version 4.0 RTM (please note: The 4.0 RTM - release is also called '4.0.2'). + Added support of the TypeScript version 4.0.5. ==================== POST-INSTALL ACTIONS