mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 19:27:35 -06:00
Merge pull request #2937 from Microsoft/emitModuleInSeparateCompilation
emit file as external module if separateCompilation flag is specified
This commit is contained in:
commit
cde3ed0e26
@ -5493,7 +5493,7 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
|
||||
paramEmitted = true;
|
||||
}
|
||||
|
||||
if (isExternalModule(node)) {
|
||||
if (isExternalModule(node) || compilerOptions.separateCompilation) {
|
||||
if (languageVersion >= ScriptTarget.ES6) {
|
||||
emitES6Module(node, startIndex);
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
tests/cases/compiler/separateCompilationPlainFile-AMD.ts(2,1): error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.
|
||||
|
||||
|
||||
==== tests/cases/compiler/separateCompilationPlainFile-AMD.ts (1 errors) ====
|
||||
|
||||
declare function run(a: number): void;
|
||||
~~~~~~~
|
||||
!!! error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.
|
||||
run(1);
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
//// [separateCompilationPlainFile-AMD.ts]
|
||||
|
||||
declare function run(a: number): void;
|
||||
run(1);
|
||||
|
||||
|
||||
//// [separateCompilationPlainFile-AMD.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
run(1);
|
||||
});
|
||||
@ -0,0 +1,10 @@
|
||||
tests/cases/compiler/separateCompilationPlainFile-CommonJS.ts(2,1): error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.
|
||||
|
||||
|
||||
==== tests/cases/compiler/separateCompilationPlainFile-CommonJS.ts (1 errors) ====
|
||||
|
||||
declare function run(a: number): void;
|
||||
~~~~~~~
|
||||
!!! error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.
|
||||
run(1);
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
//// [separateCompilationPlainFile-CommonJS.ts]
|
||||
|
||||
declare function run(a: number): void;
|
||||
run(1);
|
||||
|
||||
|
||||
//// [separateCompilationPlainFile-CommonJS.js]
|
||||
run(1);
|
||||
@ -0,0 +1,10 @@
|
||||
tests/cases/compiler/separateCompilationPlainFile-ES6.ts(2,1): error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.
|
||||
|
||||
|
||||
==== tests/cases/compiler/separateCompilationPlainFile-ES6.ts (1 errors) ====
|
||||
|
||||
declare function run(a: number): void;
|
||||
~~~~~~~
|
||||
!!! error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.
|
||||
run(1);
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
//// [separateCompilationPlainFile-ES6.ts]
|
||||
|
||||
declare function run(a: number): void;
|
||||
run(1);
|
||||
|
||||
|
||||
//// [separateCompilationPlainFile-ES6.js]
|
||||
run(1);
|
||||
@ -0,0 +1,10 @@
|
||||
tests/cases/compiler/separateCompilationPlainFile-System.ts(2,1): error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.
|
||||
|
||||
|
||||
==== tests/cases/compiler/separateCompilationPlainFile-System.ts (1 errors) ====
|
||||
|
||||
declare function run(a: number): void;
|
||||
~~~~~~~
|
||||
!!! error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.
|
||||
run(1);
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
//// [separateCompilationPlainFile-System.ts]
|
||||
|
||||
declare function run(a: number): void;
|
||||
run(1);
|
||||
|
||||
|
||||
//// [separateCompilationPlainFile-System.js]
|
||||
System.register([], function(exports_1) {
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
run(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,10 @@
|
||||
tests/cases/compiler/separateCompilationPlainFile-UMD.ts(2,1): error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.
|
||||
|
||||
|
||||
==== tests/cases/compiler/separateCompilationPlainFile-UMD.ts (1 errors) ====
|
||||
|
||||
declare function run(a: number): void;
|
||||
~~~~~~~
|
||||
!!! error TS1208: Cannot compile non-external modules when the '--separateCompilation' flag is provided.
|
||||
run(1);
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
//// [separateCompilationPlainFile-UMD.ts]
|
||||
|
||||
declare function run(a: number): void;
|
||||
run(1);
|
||||
|
||||
|
||||
//// [separateCompilationPlainFile-UMD.js]
|
||||
(function (deps, factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === 'function' && define.amd) {
|
||||
define(deps, factory);
|
||||
}
|
||||
})(["require", "exports"], function (require, exports) {
|
||||
run(1);
|
||||
});
|
||||
6
tests/cases/compiler/separateCompilationPlainFile-AMD.ts
Normal file
6
tests/cases/compiler/separateCompilationPlainFile-AMD.ts
Normal file
@ -0,0 +1,6 @@
|
||||
// @target: es5
|
||||
// @module: amd
|
||||
// @separateCompilation: true
|
||||
|
||||
declare function run(a: number): void;
|
||||
run(1);
|
||||
@ -0,0 +1,6 @@
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
// @separateCompilation: true
|
||||
|
||||
declare function run(a: number): void;
|
||||
run(1);
|
||||
5
tests/cases/compiler/separateCompilationPlainFile-ES6.ts
Normal file
5
tests/cases/compiler/separateCompilationPlainFile-ES6.ts
Normal file
@ -0,0 +1,5 @@
|
||||
// @target: es6
|
||||
// @separateCompilation: true
|
||||
|
||||
declare function run(a: number): void;
|
||||
run(1);
|
||||
@ -0,0 +1,6 @@
|
||||
// @target: es5
|
||||
// @module: system
|
||||
// @separateCompilation: true
|
||||
|
||||
declare function run(a: number): void;
|
||||
run(1);
|
||||
6
tests/cases/compiler/separateCompilationPlainFile-UMD.ts
Normal file
6
tests/cases/compiler/separateCompilationPlainFile-UMD.ts
Normal file
@ -0,0 +1,6 @@
|
||||
// @target: es5
|
||||
// @module: umd
|
||||
// @separateCompilation: true
|
||||
|
||||
declare function run(a: number): void;
|
||||
run(1);
|
||||
Loading…
x
Reference in New Issue
Block a user