mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 10:41:56 -05:00
Add flag to emit modules in loose mode
This commit is contained in:
@@ -294,6 +294,11 @@ namespace ts {
|
||||
name: "allowJs",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Allow_javascript_files_to_be_compiled
|
||||
},
|
||||
{
|
||||
name: "emitModulesInLooseMode",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Do_not_emit_use_strict_directives_in_module_output
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
{
|
||||
"Unterminated string literal.": {
|
||||
"category": "Error",
|
||||
"code": 1002
|
||||
@@ -2171,6 +2171,7 @@
|
||||
"category": "Error",
|
||||
"code": 5059
|
||||
},
|
||||
|
||||
|
||||
"Concatenate and emit output to single file.": {
|
||||
"category": "Message",
|
||||
@@ -2216,10 +2217,10 @@
|
||||
"category": "Message",
|
||||
"code": 6011
|
||||
},
|
||||
"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)": {
|
||||
"category": "Message",
|
||||
"code": 6015
|
||||
},
|
||||
"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)": {
|
||||
"category": "Message",
|
||||
"code": 6015
|
||||
},
|
||||
"Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'": {
|
||||
"category": "Message",
|
||||
"code": 6016
|
||||
@@ -2445,6 +2446,10 @@
|
||||
"category": "Message",
|
||||
"code": 6084
|
||||
},
|
||||
"Do not emit 'use strict' directives in module output.": {
|
||||
"category": "Message",
|
||||
"code": 6112
|
||||
},
|
||||
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
@@ -2632,23 +2637,23 @@
|
||||
"code": 17004
|
||||
},
|
||||
"A constructor cannot contain a 'super' call when its class extends 'null'": {
|
||||
"category": "Error",
|
||||
"code": 17005
|
||||
"category": "Error",
|
||||
"code": 17005
|
||||
},
|
||||
"An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": {
|
||||
"category": "Error",
|
||||
"code": 17006
|
||||
"category": "Error",
|
||||
"code": 17006
|
||||
},
|
||||
"A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": {
|
||||
"category": "Error",
|
||||
"code": 17007
|
||||
"category": "Error",
|
||||
"code": 17007
|
||||
},
|
||||
"JSX element '{0}' has no corresponding closing tag.": {
|
||||
"category": "Error",
|
||||
"code": 17008
|
||||
"category": "Error",
|
||||
"code": 17008
|
||||
},
|
||||
"'super' must be called before accessing 'this' in the constructor of a derived class.": {
|
||||
"category": "Error",
|
||||
"code": 17009
|
||||
"category": "Error",
|
||||
"code": 17009
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7268,7 +7268,7 @@ const _super = (function (geti, seti) {
|
||||
write(`], function(${exportFunctionForFile}, ${contextObjectForFile}) {`);
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.emitModulesInLooseMode);
|
||||
writeLine();
|
||||
write(`var __moduleName = ${contextObjectForFile} && ${contextObjectForFile}.id;`);
|
||||
writeLine();
|
||||
@@ -7374,7 +7374,7 @@ const _super = (function (geti, seti) {
|
||||
writeModuleName(node, emitRelativePathAsModuleName);
|
||||
emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, emitRelativePathAsModuleName);
|
||||
increaseIndent();
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/!compilerOptions.emitModulesInLooseMode);
|
||||
emitExportStarHelper();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitLinesStartingAt(node.statements, startIndex);
|
||||
@@ -7386,7 +7386,7 @@ const _super = (function (geti, seti) {
|
||||
}
|
||||
|
||||
function emitCommonJSModule(node: SourceFile) {
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false, /*ensureUseStrict*/ true);
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false, /*ensureUseStrict*/ !compilerOptions.emitModulesInLooseMode);
|
||||
emitEmitHelpers(node);
|
||||
collectExternalModuleInfo(node);
|
||||
emitExportStarHelper();
|
||||
@@ -7415,7 +7415,7 @@ const _super = (function (geti, seti) {
|
||||
})(`);
|
||||
emitAMDFactoryHeader(dependencyNames);
|
||||
increaseIndent();
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ true);
|
||||
const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.emitModulesInLooseMode);
|
||||
emitExportStarHelper();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitLinesStartingAt(node.statements, startIndex);
|
||||
|
||||
@@ -2435,6 +2435,7 @@ namespace ts {
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
allowSyntheticDefaultImports?: boolean;
|
||||
allowJs?: boolean;
|
||||
emitModulesInLooseMode?: boolean;
|
||||
/* @internal */ stripInternal?: boolean;
|
||||
|
||||
// Skip checking lib.d.ts to help speed up tests.
|
||||
|
||||
Reference in New Issue
Block a user