cusotm tests, forbid umd

This commit is contained in:
Wesley Wigham 2015-10-02 17:43:58 -07:00
parent 145fa0cdf6
commit 03256e7c86
8 changed files with 74 additions and 8 deletions

View file

@ -2302,7 +2302,7 @@
"category": "Message",
"code": 6081
},
"Only 'amd', 'umd', and 'system' modules are supported alongside --{0}.": {
"Only 'amd' and 'system' modules are supported alongside --{0}.": {
"category": "Error",
"code": 6082
},

View file

@ -457,11 +457,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
};
let bundleEmitDelegates: Map<(node: SourceFile, startIndex: number, resolvePath?: boolean) => void> = {
[ModuleKind.ES6]() { },
[ModuleKind.ES6]() {},
[ModuleKind.AMD]: emitAMDModule,
[ModuleKind.System]: emitSystemModule,
[ModuleKind.UMD]: emitUMDModule,
[ModuleKind.CommonJS]() { },
[ModuleKind.UMD]() {},
[ModuleKind.CommonJS]() {},
};
if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) {
@ -6827,11 +6827,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
emitExportEquals(/*emitAsReturn*/ false);
}
function emitUMDModule(node: SourceFile, startIndex: number, resolvePath?: boolean) {
function emitUMDModule(node: SourceFile, startIndex: number) {
emitEmitHelpers(node);
collectExternalModuleInfo(node);
let dependencyNames = getAMDDependencyNames(node, /*includeNonAmdDependencies*/ false, resolvePath);
let dependencyNames = getAMDDependencyNames(node, /*includeNonAmdDependencies*/ false);
// Module is detected first to support Browserify users that load into a browser with an AMD loader
writeLines(`(function (factory) {

View file

@ -1064,8 +1064,8 @@ namespace ts {
}
// Cannot specify module gen that isn't amd, umd, or system with --out
if (outFile && options.module && options.module !== ModuleKind.AMD && options.module !== ModuleKind.UMD && options.module !== ModuleKind.System) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Only_amd_umd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile"));
if (outFile && options.module && options.module !== ModuleKind.AMD && options.module !== ModuleKind.System) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile"));
}
if (options.noEmit) {

View file

@ -0,0 +1,12 @@
// @target: ES5
// @sourcemap: true
// @declaration: true
// @module: amd
// @outFile: all.js
// @Filename: ref/a.ts
export class A { }
// @Filename: b.ts
import {A} from "./ref/a";
export class B extends A { }

View file

@ -0,0 +1,14 @@
// @target: ES5
// @sourcemap: true
// @declaration: true
// @module: commonjs
// @outFile: all.js
// This should be an error
// @Filename: ref/a.ts
export class A { }
// @Filename: b.ts
import {A} from "./ref/a";
export class B extends A { }

View file

@ -0,0 +1,14 @@
// @target: ES6
// @sourcemap: true
// @declaration: true
// @module: es6
// @outFile: all.js
// This should be an error
// @Filename: ref/a.ts
export class A { }
// @Filename: b.ts
import {A} from "./ref/a";
export class B extends A { }

View file

@ -0,0 +1,12 @@
// @target: ES5
// @sourcemap: true
// @declaration: true
// @module: system
// @outFile: all.js
// @Filename: ref/a.ts
export class A { }
// @Filename: b.ts
import {A} from "./ref/a";
export class B extends A { }

View file

@ -0,0 +1,14 @@
// @target: ES5
// @sourcemap: true
// @declaration: true
// @module: umd
// @outFile: all.js
// This should error
// @Filename: ref/a.ts
export class A { }
// @Filename: b.ts
import {A} from "./ref/a";
export class B extends A { }