diff --git a/build.sh b/build.sh index 373c5aa6c6..6ac5fcfa31 100755 --- a/build.sh +++ b/build.sh @@ -51,6 +51,7 @@ TSCONFIG=./modules/tsconfig.json echo "====== (all)COMPILING: \$(npm bin)/tsc -p ${TSCONFIG} =====" # compile ts code TSC="node --max-old-space-size=3000 dist/tools/@angular/tsc-wrapped/src/main" +UGLIFYJS=`pwd`/node_modules/.bin/uglifyjs $TSC -p modules/tsconfig.json rm -rf ./dist/packages-dist @@ -68,56 +69,61 @@ for PACKAGE in \ upgrade \ compiler-cli do - SRCDIR=./modules/@angular/${PACKAGE} - DESTDIR=./dist/packages-dist/${PACKAGE} - UMD_ES6_PATH=${DESTDIR}/esm/${PACKAGE}.umd.js + PWD=`pwd` + SRCDIR=${PWD}/modules/@angular/${PACKAGE} + DESTDIR=${PWD}/dist/packages-dist/${PACKAGE} UMD_ES5_PATH=${DESTDIR}/bundles/${PACKAGE}.umd.js + UMD_TESTING_ES5_PATH=${DESTDIR}/bundles/${PACKAGE}-testing.umd.js UMD_ES5_MIN_PATH=${DESTDIR}/bundles/${PACKAGE}.umd.min.js + LICENSE_BANNER=${PWD}/modules/@angular/license-banner.txt - echo "====== COMPILING: ${TSC} -p ${SRCDIR}/tsconfig-es5.json =====" - $TSC -p ${SRCDIR}/tsconfig-es5.json + echo "====== COMPILING: ${TSC} -p ${SRCDIR}/tsconfig.json =====" + $TSC -p ${SRCDIR}/tsconfig.json cp ${SRCDIR}/package.json ${DESTDIR}/ + if [[ -e ${SRCDIR}/tsconfig-testing.json ]]; then + echo "====== COMPILING TESTING: ${TSC} -p ${SRCDIR}/tsconfig-testing.json" + $TSC -p ${SRCDIR}/tsconfig-testing.json + fi echo "====== TSC 1.8 d.ts compat for ${DESTDIR} =====" # safely strips 'readonly' specifier from d.ts files to make them compatible with tsc 1.8 if [ "$(uname)" == "Darwin" ]; then - find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i '' -e 's/\(^ *(static |private )*\)*readonly */\1/g' - find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i '' -E 's/^( +)abstract ([[:alnum:]]+\:)/\1\2/g' + find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i '' -e 's/\(^ *(static |private )*\)*readonly */\1/g' + find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i '' -e 's/\/\/\/ //g' + find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i '' -E 's/^( +)abstract ([[:alnum:]]+\:)/\1\2/g' else find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i -e 's/\(^ *(static |private )*\)*readonly */\1/g' + find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i -e 's/\/\/\/ //g' find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i -E 's/^( +)abstract ([[:alnum:]]+\:)/\1\2/g' fi if [[ ${PACKAGE} != compiler-cli ]]; then - echo "====== (esm)COMPILING: $TSC -p ${SRCDIR}/tsconfig-es2015.json =====" - $TSC -p ${SRCDIR}/tsconfig-es2015.json - echo "====== BUNDLING: ${SRCDIR} =====" mkdir ${DESTDIR}/bundles ( cd ${SRCDIR} - echo "..." # here just to have grep match something and not exit with 1 + echo "====== Rollup ${PACKAGE} index" ../../../node_modules/.bin/rollup -c rollup.config.js + cat ${LICENSE_BANNER} > ${UMD_ES5_PATH}.tmp + cat ${UMD_ES5_PATH} >> ${UMD_ES5_PATH}.tmp + mv ${UMD_ES5_PATH}.tmp ${UMD_ES5_PATH} + $UGLIFYJS -c --screw-ie8 --comments -o ${UMD_ES5_MIN_PATH} ${UMD_ES5_PATH} + + + if [[ -e rollup-testing.config.js ]]; then + echo "====== Rollup ${PACKAGE} testing" + ../../../node_modules/.bin/rollup -c rollup-testing.config.js + echo "{\"main\": \"../bundles/${PACKAGE}-testing.umd.js\"}" > ${DESTDIR}/testing/package.json + cat ${LICENSE_BANNER} > ${UMD_TESTING_ES5_PATH}.tmp + cat ${UMD_TESTING_ES5_PATH} >> ${UMD_TESTING_ES5_PATH}.tmp + mv ${UMD_TESTING_ES5_PATH}.tmp ${UMD_TESTING_ES5_PATH} + fi ) 2>&1 | grep -v "as external dependency" - $(npm bin)/tsc \ - --out ${UMD_ES5_PATH} \ - --target es5 \ - --lib "es6,dom" \ - --allowJs \ - ${UMD_ES6_PATH} - - rm ${UMD_ES6_PATH} - - cat ./modules/@angular/license-banner.txt > ${UMD_ES5_PATH}.tmp - cat ${UMD_ES5_PATH} >> ${UMD_ES5_PATH}.tmp - mv ${UMD_ES5_PATH}.tmp ${UMD_ES5_PATH} - - $(npm bin)/uglifyjs -c --screw-ie8 -o ${UMD_ES5_MIN_PATH} ${UMD_ES5_PATH} fi done diff --git a/gulpfile.js b/gulpfile.js index 6bce3ae496..cec7181c79 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -30,22 +30,22 @@ gulp.task('format', () => { const entrypoints = [ 'dist/packages-dist/core/index.d.ts', - 'dist/packages-dist/core/testing.d.ts', + 'dist/packages-dist/core/testing/index.d.ts', 'dist/packages-dist/common/index.d.ts', - 'dist/packages-dist/common/testing.d.ts', + 'dist/packages-dist/common/testing/index.d.ts', // The API surface of the compiler is currently unstable - all of the important APIs are exposed // via @angular/core, @angular/platform-browser or @angular/platform-browser-dynamic instead. //'dist/packages-dist/compiler/index.d.ts', //'dist/packages-dist/compiler/testing.d.ts', 'dist/packages-dist/upgrade/index.d.ts', 'dist/packages-dist/platform-browser/index.d.ts', - 'dist/packages-dist/platform-browser/testing.d.ts', + 'dist/packages-dist/platform-browser/testing/index.d.ts', 'dist/packages-dist/platform-browser-dynamic/index.d.ts', - 'dist/packages-dist/platform-browser-dynamic/testing.d.ts', + 'dist/packages-dist/platform-browser-dynamic/testing/index.d.ts', 'dist/packages-dist/platform-server/index.d.ts', - 'dist/packages-dist/platform-server/testing.d.ts', + 'dist/packages-dist/platform-server/testing/index.d.ts', 'dist/packages-dist/http/index.d.ts', - 'dist/packages-dist/http/testing.d.ts', + 'dist/packages-dist/http/testing/index.d.ts', 'dist/packages-dist/forms/index.d.ts', 'dist/packages-dist/router/index.d.ts' ]; @@ -102,9 +102,10 @@ gulp.task('lint', ['format:enforce', 'tools:build'], () => { .pipe(tslint({ tslint: require('tslint').default, configuration: tslintConfig, - rulesDirectory: 'dist/tools/tslint' + rulesDirectory: 'dist/tools/tslint', + formatter: 'prose' })) - .pipe(tslint.report('prose', {emitError: true})); + .pipe(tslint.report({emitError: true})); }); gulp.task('tools:build', (done) => { tsc('tools/', done); }); diff --git a/modules/@angular/common/index.ts b/modules/@angular/common/index.ts index 2681ca47c3..a55ca93ed3 100644 --- a/modules/@angular/common/index.ts +++ b/modules/@angular/common/index.ts @@ -6,8 +6,11 @@ * found in the LICENSE file at https://angular.io/license */ -export * from './src/pipes'; -export * from './src/directives'; -export * from './src/location'; -export {NgLocalization} from './src/localization'; -export {CommonModule} from './src/common_module'; +/** + * @module + * @description + * Entry point for all public APIs of the common package. + */ +export * from './src/common'; + +// This file only reexports content of the `src` folder. Keep it that way. diff --git a/modules/@angular/common/package.json b/modules/@angular/common/package.json index 4f6eea2566..34bd07dfcf 100644 --- a/modules/@angular/common/package.json +++ b/modules/@angular/common/package.json @@ -2,8 +2,8 @@ "name": "@angular/common", "version": "0.0.0-PLACEHOLDER", "description": "", - "main": "index.js", - "jsnext:main": "esm/index.js", + "main": "bundles/common.umd.js", + "module": "index.js", "typings": "index.d.ts", "author": "angular", "license": "MIT", diff --git a/modules/@angular/common/rollup-testing.config.js b/modules/@angular/common/rollup-testing.config.js new file mode 100644 index 0000000000..69423c4132 --- /dev/null +++ b/modules/@angular/common/rollup-testing.config.js @@ -0,0 +1,15 @@ + +export default { + entry: '../../../dist/packages-dist/common/testing/index.js', + dest: '../../../dist/packages-dist/common/bundles/common-testing.umd.js', + format: 'umd', + moduleName: 'ng.common.testing', + globals: { + '@angular/core': 'ng.core', + '@angular/common': 'ng.common', + 'rxjs/Subject': 'Rx', + 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. + 'rxjs/operator/toPromise': 'Rx.Observable.prototype', + 'rxjs/Observable': 'Rx' + } +} diff --git a/modules/@angular/common/rollup.config.js b/modules/@angular/common/rollup.config.js index a93f909224..8ad150cfec 100644 --- a/modules/@angular/common/rollup.config.js +++ b/modules/@angular/common/rollup.config.js @@ -1,7 +1,7 @@ export default { - entry: '../../../dist/packages-dist/common/esm/index.js', - dest: '../../../dist/packages-dist/common/esm/common.umd.js', + entry: '../../../dist/packages-dist/common/index.js', + dest: '../../../dist/packages-dist/common/bundles/common.umd.js', format: 'umd', moduleName: 'ng.common', globals: { @@ -10,8 +10,5 @@ export default { 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. 'rxjs/operator/toPromise': 'Rx.Observable.prototype', 'rxjs/Observable': 'Rx' - }, - plugins: [ -// nodeResolve({ jsnext: true, main: true }), - ] + } } diff --git a/modules/@angular/common/src/common.ts b/modules/@angular/common/src/common.ts new file mode 100644 index 0000000000..68fdb094ce --- /dev/null +++ b/modules/@angular/common/src/common.ts @@ -0,0 +1,13 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +export * from './pipes'; +export * from './directives'; +export * from './location'; +export {NgLocalization} from './localization'; +export {CommonModule} from './common_module'; diff --git a/modules/@angular/common/testing/facade b/modules/@angular/common/testing/facade new file mode 120000 index 0000000000..e084c803c6 --- /dev/null +++ b/modules/@angular/common/testing/facade @@ -0,0 +1 @@ +../../facade/src \ No newline at end of file diff --git a/modules/@angular/common/testing/index.ts b/modules/@angular/common/testing/index.ts new file mode 100644 index 0000000000..c5f4cf9e20 --- /dev/null +++ b/modules/@angular/common/testing/index.ts @@ -0,0 +1,15 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +/** + * @module + * @description + * Entry point for all public APIs of the common/testing package. + */ +export {SpyLocation} from './location_mock'; +export {MockLocationStrategy} from './mock_location_strategy'; diff --git a/modules/@angular/common/testing/location_mock.ts b/modules/@angular/common/testing/location_mock.ts index 24baad5943..7b448bf442 100644 --- a/modules/@angular/common/testing/location_mock.ts +++ b/modules/@angular/common/testing/location_mock.ts @@ -6,11 +6,9 @@ * found in the LICENSE file at https://angular.io/license */ +import {Location, LocationStrategy} from '@angular/common'; import {EventEmitter, Injectable} from '@angular/core'; -import {Location} from '../index'; -import {LocationStrategy} from '../src/location/location_strategy'; - /** * A spy for {@link Location} that allows tests to fire simulated location events. diff --git a/modules/@angular/common/testing/mock_location_strategy.ts b/modules/@angular/common/testing/mock_location_strategy.ts index 38189a229b..fd923818f0 100644 --- a/modules/@angular/common/testing/mock_location_strategy.ts +++ b/modules/@angular/common/testing/mock_location_strategy.ts @@ -6,10 +6,8 @@ * found in the LICENSE file at https://angular.io/license */ -import {Injectable} from '@angular/core'; - -import {LocationStrategy} from '../index'; -import {EventEmitter} from '../src/facade/async'; +import {LocationStrategy} from '@angular/common'; +import {EventEmitter, Injectable} from '@angular/core'; diff --git a/modules/@angular/common/tsconfig-es5.json b/modules/@angular/common/tsconfig-testing.json similarity index 68% rename from modules/@angular/common/tsconfig-es5.json rename to modules/@angular/common/tsconfig-testing.json index eb441a3b19..67dbcf0eaa 100644 --- a/modules/@angular/common/tsconfig-es5.json +++ b/modules/@angular/common/tsconfig-testing.json @@ -4,21 +4,22 @@ "declaration": true, "stripInternal": true, "experimentalDecorators": true, - "module": "commonjs", + "module": "es2015", "moduleResolution": "node", "outDir": "../../../dist/packages-dist/common/", "paths": { - "@angular/core": ["../../../dist/packages-dist/core/"] + "@angular/core": ["../../../dist/packages-dist/core/"], + "@angular/common": ["../../../dist/packages-dist/common"] }, "rootDir": ".", "sourceMap": true, "inlineSources": true, "lib": ["es6", "dom"], - "target": "es5" + "target": "es5", + "skipLibCheck": true }, "files": [ - "index.ts", - "testing.ts", + "testing/index.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts" ], "angularCompilerOptions": { diff --git a/modules/@angular/common/tsconfig-es2015.json b/modules/@angular/common/tsconfig.json similarity index 79% rename from modules/@angular/common/tsconfig-es2015.json rename to modules/@angular/common/tsconfig.json index 6404ded7a9..6b2104683f 100644 --- a/modules/@angular/common/tsconfig-es2015.json +++ b/modules/@angular/common/tsconfig.json @@ -6,18 +6,19 @@ "experimentalDecorators": true, "module": "es2015", "moduleResolution": "node", - "outDir": "../../../dist/packages-dist/common/esm", + "outDir": "../../../dist/packages-dist/common", "paths": { "@angular/core": ["../../../dist/packages-dist/core"] }, "rootDir": ".", "sourceMap": true, "inlineSources": true, - "target": "es2015" + "target": "es5", + "skipLibCheck": true, + "lib": [ "es2015", "dom" ] }, "files": [ "index.ts", - "testing.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts" ], "angularCompilerOptions": { diff --git a/modules/@angular/compiler-cli/integrationtest/test/all_spec.ts b/modules/@angular/compiler-cli/integrationtest/test/all_spec.ts new file mode 100644 index 0000000000..cf9d214269 --- /dev/null +++ b/modules/@angular/compiler-cli/integrationtest/test/all_spec.ts @@ -0,0 +1,16 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import './init'; +import './animate_spec'; +import './basic_spec'; +import './entry_components_spec'; +import './i18n_spec'; +import './ng_module_spec'; +import './projection_spec'; +import './query_spec'; diff --git a/modules/@angular/compiler-cli/integrationtest/webpack.config.js b/modules/@angular/compiler-cli/integrationtest/webpack.config.js new file mode 100644 index 0000000000..5478a9431c --- /dev/null +++ b/modules/@angular/compiler-cli/integrationtest/webpack.config.js @@ -0,0 +1,10 @@ +module.exports = { + target: 'node', + entry: './test/all_spec.js', + output: { + filename: './all_spec.js' + }, + resolve: { + extensions: ['.js'] + }, +}; diff --git a/modules/@angular/compiler-cli/src/codegen.ts b/modules/@angular/compiler-cli/src/codegen.ts index 10a5340110..c48e51cf1c 100644 --- a/modules/@angular/compiler-cli/src/codegen.ts +++ b/modules/@angular/compiler-cli/src/codegen.ts @@ -16,9 +16,9 @@ import {AngularCompilerOptions, NgcCliOptions} from '@angular/tsc-wrapped'; import * as path from 'path'; import * as ts from 'typescript'; -import {CompileMetadataResolver, DirectiveNormalizer, DomElementSchemaRegistry, HtmlParser, Lexer, NgModuleCompiler, Parser, StyleCompiler, TemplateParser, TypeScriptEmitter, ViewCompiler} from './compiler_private'; -import {Console} from './core_private'; import {PathMappedReflectorHost} from './path_mapped_reflector_host'; +import {CompileMetadataResolver, DirectiveNormalizer, DomElementSchemaRegistry, HtmlParser, Lexer, NgModuleCompiler, Parser, StyleCompiler, TemplateParser, TypeScriptEmitter, ViewCompiler} from './private_import_compiler'; +import {Console} from './private_import_core'; import {ReflectorHost, ReflectorHostContext} from './reflector_host'; import {StaticAndDynamicReflectionCapabilities} from './static_reflection_capabilities'; import {StaticReflector, StaticSymbol} from './static_reflector'; @@ -159,7 +159,7 @@ export class CodeGenerator { const staticReflector = new StaticReflector(reflectorHost); StaticAndDynamicReflectionCapabilities.install(staticReflector); const htmlParser = - new compiler.i18n.HtmlParser(new HtmlParser(), transContent, cliOptions.i18nFormat); + new compiler.I18NHtmlParser(new HtmlParser(), transContent, cliOptions.i18nFormat); const config = new compiler.CompilerConfig({ genDebugInfo: options.debug === true, defaultEncapsulation: ViewEncapsulation.Emulated, diff --git a/modules/@angular/compiler-cli/src/compiler_private.ts b/modules/@angular/compiler-cli/src/compiler_private.ts deleted file mode 100644 index ea7e235238..0000000000 --- a/modules/@angular/compiler-cli/src/compiler_private.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {__compiler_private__ as _c} from '@angular/compiler'; - -export type AssetUrl = _c.AssetUrl; -export var AssetUrl: typeof _c.AssetUrl = _c.AssetUrl; - -export type ImportGenerator = _c.ImportGenerator; -export var ImportGenerator: typeof _c.ImportGenerator = _c.ImportGenerator; - -export type CompileMetadataResolver = _c.CompileMetadataResolver; -export var CompileMetadataResolver: typeof _c.CompileMetadataResolver = _c.CompileMetadataResolver; - -export type HtmlParser = _c.HtmlParser; -export var HtmlParser: typeof _c.HtmlParser = _c.HtmlParser; - -export type ParseError = _c.ParseError; -export var ParseError: typeof _c.ParseError = _c.ParseError; - -export type InterpolationConfig = _c.InterpolationConfig; -export var InterpolationConfig: typeof _c.InterpolationConfig = _c.InterpolationConfig; - -export type DirectiveNormalizer = _c.DirectiveNormalizer; -export var DirectiveNormalizer: typeof _c.DirectiveNormalizer = _c.DirectiveNormalizer; - -export type Lexer = _c.Lexer; -export var Lexer: typeof _c.Lexer = _c.Lexer; - -export type Parser = _c.Parser; -export var Parser: typeof _c.Parser = _c.Parser; - -export type TemplateParser = _c.TemplateParser; -export var TemplateParser: typeof _c.TemplateParser = _c.TemplateParser; - -export type DomElementSchemaRegistry = _c.DomElementSchemaRegistry; -export var DomElementSchemaRegistry: typeof _c.DomElementSchemaRegistry = - _c.DomElementSchemaRegistry; - -export type StyleCompiler = _c.StyleCompiler; -export var StyleCompiler: typeof _c.StyleCompiler = _c.StyleCompiler; - -export type ViewCompiler = _c.ViewCompiler; -export var ViewCompiler: typeof _c.ViewCompiler = _c.ViewCompiler; - -export type NgModuleCompiler = _c.NgModuleCompiler; -export var NgModuleCompiler: typeof _c.NgModuleCompiler = _c.NgModuleCompiler; - -export type TypeScriptEmitter = _c.TypeScriptEmitter; -export var TypeScriptEmitter: typeof _c.TypeScriptEmitter = _c.TypeScriptEmitter; diff --git a/modules/@angular/compiler-cli/src/extract_i18n.ts b/modules/@angular/compiler-cli/src/extract_i18n.ts index ec8caab37b..9693912826 100644 --- a/modules/@angular/compiler-cli/src/extract_i18n.ts +++ b/modules/@angular/compiler-cli/src/extract_i18n.ts @@ -21,8 +21,8 @@ import {ComponentMetadata, NgModuleMetadata, ViewEncapsulation} from '@angular/c import * as path from 'path'; import * as ts from 'typescript'; import * as tsc from '@angular/tsc-wrapped'; -import {CompileMetadataResolver, DirectiveNormalizer, DomElementSchemaRegistry, HtmlParser, Lexer, NgModuleCompiler, Parser, StyleCompiler, TemplateParser, TypeScriptEmitter, ViewCompiler, ParseError} from './compiler_private'; -import {Console} from './core_private'; +import {CompileMetadataResolver, DirectiveNormalizer, DomElementSchemaRegistry, HtmlParser, Lexer, NgModuleCompiler, Parser, StyleCompiler, TemplateParser, TypeScriptEmitter, ViewCompiler, ParseError} from './private_import_compiler'; +import {Console} from './private_import_core'; import {ReflectorHost, ReflectorHostContext} from './reflector_host'; import {StaticAndDynamicReflectionCapabilities} from './static_reflection_capabilities'; import {StaticReflector, StaticSymbol} from './static_reflector'; @@ -30,25 +30,25 @@ import {StaticReflector, StaticSymbol} from './static_reflector'; function extract( ngOptions: tsc.AngularCompilerOptions, cliOptions: tsc.I18nExtractionCliOptions, program: ts.Program, host: ts.CompilerHost) { - const htmlParser = new compiler.i18n.HtmlParser(new HtmlParser()); + const htmlParser = new compiler.I18NHtmlParser(new HtmlParser()); const extractor = Extractor.create(ngOptions, cliOptions.i18nFormat, program, host, htmlParser); - const bundlePromise: Promise = extractor.extract(); + const bundlePromise: Promise = extractor.extract(); return (bundlePromise).then(messageBundle => { let ext: string; - let serializer: compiler.i18n.Serializer; + let serializer: compiler.Serializer; const format = (cliOptions.i18nFormat || 'xlf').toLowerCase(); switch (format) { case 'xmb': ext = 'xmb'; - serializer = new compiler.i18n.Xmb(); + serializer = new compiler.Xmb(); break; case 'xliff': case 'xlf': default: ext = 'xlf'; - serializer = new compiler.i18n.Xliff(htmlParser, compiler.DEFAULT_INTERPOLATION_CONFIG); + serializer = new compiler.Xliff(htmlParser, compiler.DEFAULT_INTERPOLATION_CONFIG); break; } @@ -62,7 +62,7 @@ const GENERATED_FILES = /\.ngfactory\.ts$|\.css\.ts$|\.css\.shim\.ts$/; export class Extractor { constructor( private program: ts.Program, public host: ts.CompilerHost, - private staticReflector: StaticReflector, private messageBundle: compiler.i18n.MessageBundle, + private staticReflector: StaticReflector, private messageBundle: compiler.MessageBundle, private reflectorHost: ReflectorHost, private metadataResolver: CompileMetadataResolver, private directiveNormalizer: DirectiveNormalizer, private compiler: compiler.OfflineCompiler) {} @@ -97,7 +97,7 @@ export class Extractor { return result; } - extract(): Promise { + extract(): Promise { const filePaths = this.program.getSourceFiles().map(sf => sf.fileName).filter(f => !GENERATED_FILES.test(f)); const fileMetas = filePaths.map((filePath) => this.readFileMetadata(filePath)); @@ -145,7 +145,7 @@ export class Extractor { static create( options: tsc.AngularCompilerOptions, translationsFormat: string, program: ts.Program, - compilerHost: ts.CompilerHost, htmlParser: compiler.i18n.HtmlParser, + compilerHost: ts.CompilerHost, htmlParser: compiler.I18NHtmlParser, reflectorHostContext?: ReflectorHostContext): Extractor { const resourceLoader: compiler.ResourceLoader = { get: (s: string) => { @@ -184,7 +184,7 @@ export class Extractor { new NgModuleCompiler(), new TypeScriptEmitter(reflectorHost), null, null); // TODO(vicb): implicit tags & attributes - let messageBundle = new compiler.i18n.MessageBundle(htmlParser, [], {}); + let messageBundle = new compiler.MessageBundle(htmlParser, [], {}); return new Extractor( program, compilerHost, staticReflector, messageBundle, reflectorHost, resolver, normalizer, diff --git a/modules/@angular/compiler-cli/src/private_import_compiler.ts b/modules/@angular/compiler-cli/src/private_import_compiler.ts new file mode 100644 index 0000000000..07b39806f4 --- /dev/null +++ b/modules/@angular/compiler-cli/src/private_import_compiler.ts @@ -0,0 +1,54 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {__compiler_private__ as _} from '@angular/compiler'; + +export type AssetUrl = typeof _._AssetUrl; +export var AssetUrl: typeof _.AssetUrl = _.AssetUrl; + +export type ImportGenerator = typeof _._ImportGenerator; +export var ImportGenerator: typeof _.ImportGenerator = _.ImportGenerator; + +export type CompileMetadataResolver = typeof _._CompileMetadataResolver; +export var CompileMetadataResolver: typeof _.CompileMetadataResolver = _.CompileMetadataResolver; + +export type HtmlParser = typeof _._HtmlParser; +export var HtmlParser: typeof _.HtmlParser = _.HtmlParser; + +export type ParseError = typeof _._ParseError; +export var ParseError: typeof _.ParseError = _.ParseError; + +export type InterpolationConfig = typeof _._InterpolationConfig; +export var InterpolationConfig: typeof _.InterpolationConfig = _.InterpolationConfig; + +export type DirectiveNormalizer = typeof _._DirectiveNormalizer; +export var DirectiveNormalizer: typeof _.DirectiveNormalizer = _.DirectiveNormalizer; + +export type Lexer = typeof _._Lexer; +export var Lexer: typeof _.Lexer = _.Lexer; + +export type Parser = typeof _._Parser; +export var Parser: typeof _.Parser = _.Parser; + +export type TemplateParser = typeof _._TemplateParser; +export var TemplateParser: typeof _.TemplateParser = _.TemplateParser; + +export type DomElementSchemaRegistry = typeof _._DomElementSchemaRegistry; +export var DomElementSchemaRegistry: typeof _.DomElementSchemaRegistry = _.DomElementSchemaRegistry; + +export type StyleCompiler = typeof _._StyleCompiler; +export var StyleCompiler: typeof _.StyleCompiler = _.StyleCompiler; + +export type ViewCompiler = typeof _._ViewCompiler; +export var ViewCompiler: typeof _.ViewCompiler = _.ViewCompiler; + +export type NgModuleCompiler = typeof _._NgModuleCompiler; +export var NgModuleCompiler: typeof _.NgModuleCompiler = _.NgModuleCompiler; + +export type TypeScriptEmitter = typeof _._TypeScriptEmitter; +export var TypeScriptEmitter: typeof _.TypeScriptEmitter = _.TypeScriptEmitter; diff --git a/modules/@angular/compiler-cli/src/core_private.ts b/modules/@angular/compiler-cli/src/private_import_core.ts similarity index 54% rename from modules/@angular/compiler-cli/src/core_private.ts rename to modules/@angular/compiler-cli/src/private_import_core.ts index d70deb659a..5030d3d23f 100644 --- a/modules/@angular/compiler-cli/src/core_private.ts +++ b/modules/@angular/compiler-cli/src/private_import_core.ts @@ -6,17 +6,19 @@ * found in the LICENSE file at https://angular.io/license */ -import {__core_private__ as r, __core_private_types__ as types} from '@angular/core'; +import {__core_private__ as r} from '@angular/core'; -export declare let _compiler_cli_core_private_types: types; - -export type ReflectorReader = typeof _compiler_cli_core_private_types.ReflectorReader; +export type ReflectorReader = typeof r._ReflectorReader; export var ReflectorReader: typeof r.ReflectorReader = r.ReflectorReader; -export type ReflectionCapabilities = typeof _compiler_cli_core_private_types.ReflectionCapabilities; +export type ReflectionCapabilities = typeof r._ReflectionCapabilities; export var ReflectionCapabilities: typeof r.ReflectionCapabilities = r.ReflectionCapabilities; -export type Console = typeof _compiler_cli_core_private_types.Console; +export type Console = typeof r._Console; export var Console: typeof r.Console = r.Console; export var reflector: typeof r.reflector = r.reflector; + +export type SetterFn = typeof r._SetterFn; +export type GetterFn = typeof r._GetterFn; +export type MethodFn = typeof r._MethodFn; diff --git a/modules/@angular/compiler-cli/src/reflector_host.ts b/modules/@angular/compiler-cli/src/reflector_host.ts index 6baa2f5454..0b97f3700a 100644 --- a/modules/@angular/compiler-cli/src/reflector_host.ts +++ b/modules/@angular/compiler-cli/src/reflector_host.ts @@ -11,7 +11,7 @@ import * as fs from 'fs'; import * as path from 'path'; import * as ts from 'typescript'; -import {AssetUrl, ImportGenerator} from './compiler_private'; +import {AssetUrl, ImportGenerator} from './private_import_compiler'; import {StaticReflectorHost, StaticSymbol} from './static_reflector'; const EXT = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/; @@ -59,6 +59,7 @@ export class ReflectorHost implements StaticReflectorHost, ImportGenerator { getCanonicalFileName(fileName: string): string { return fileName; } protected resolve(m: string, containingFile: string) { + m = m.replace(EXT, ''); const resolved = ts.resolveModuleName(m, containingFile.replace(/\\/g, '/'), this.options, this.context) .resolvedModule; diff --git a/modules/@angular/compiler-cli/src/static_reflection_capabilities.ts b/modules/@angular/compiler-cli/src/static_reflection_capabilities.ts index 59f3b60189..52853c48fd 100644 --- a/modules/@angular/compiler-cli/src/static_reflection_capabilities.ts +++ b/modules/@angular/compiler-cli/src/static_reflection_capabilities.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {ReflectionCapabilities, reflector} from './core_private'; +import {GetterFn, MethodFn, ReflectionCapabilities, SetterFn, reflector} from './private_import_core'; import {StaticReflector} from './static_reflector'; export class StaticAndDynamicReflectionCapabilities { @@ -38,9 +38,9 @@ export class StaticAndDynamicReflectionCapabilities { return isStaticType(typeOrFunc) ? this.staticDelegate.propMetadata(typeOrFunc) : this.dynamicDelegate.propMetadata(typeOrFunc); } - getter(name: string) { return this.dynamicDelegate.getter(name); } - setter(name: string) { return this.dynamicDelegate.setter(name); } - method(name: string) { return this.dynamicDelegate.method(name); } + getter(name: string): GetterFn { return this.dynamicDelegate.getter(name); } + setter(name: string): SetterFn { return this.dynamicDelegate.setter(name); } + method(name: string): MethodFn { return this.dynamicDelegate.method(name); } importUri(type: any): string { return this.staticDelegate.importUri(type); } resolveIdentifier(name: string, moduleUrl: string, runtime: any) { return this.staticDelegate.resolveIdentifier(name, moduleUrl, runtime); diff --git a/modules/@angular/compiler-cli/src/static_reflector.ts b/modules/@angular/compiler-cli/src/static_reflector.ts index 22a2aae1be..1150b1dbc1 100644 --- a/modules/@angular/compiler-cli/src/static_reflector.ts +++ b/modules/@angular/compiler-cli/src/static_reflector.ts @@ -8,7 +8,7 @@ import {AttributeMetadata, ComponentMetadata, ContentChildMetadata, ContentChildrenMetadata, DirectiveMetadata, HostBindingMetadata, HostListenerMetadata, HostMetadata, InjectMetadata, InjectableMetadata, InputMetadata, NgModuleMetadata, OptionalMetadata, OutputMetadata, PipeMetadata, QueryMetadata, SelfMetadata, SkipSelfMetadata, ViewChildMetadata, ViewChildrenMetadata, ViewQueryMetadata, animate, group, keyframes, sequence, state, style, transition, trigger} from '@angular/core'; -import {ReflectorReader} from './core_private'; +import {ReflectorReader} from './private_import_core'; const SUPPORTED_SCHEMA_VERSION = 1; diff --git a/modules/@angular/compiler-cli/test/mocks.ts b/modules/@angular/compiler-cli/test/mocks.ts index 49f9d87630..86adb1f830 100644 --- a/modules/@angular/compiler-cli/test/mocks.ts +++ b/modules/@angular/compiler-cli/test/mocks.ts @@ -6,10 +6,9 @@ * found in the LICENSE file at https://angular.io/license */ +import {ReflectorHostContext} from '@angular/compiler-cli/src/reflector_host'; import * as ts from 'typescript'; -import {ReflectorHostContext} from '../src/reflector_host'; - export type Entry = string | Directory; export interface Directory { [name: string]: Entry; } @@ -61,6 +60,15 @@ export class MockContext implements ReflectorHostContext { } return current; } + + getDirectories(path: string): string[] { + const dir = this.getEntry(path); + if (typeof dir !== 'object') { + return []; + } else { + return Object.keys(dir).filter(key => typeof dir[key] === 'object'); + } + } } function normalize(parts: string[]): string[] { @@ -117,4 +125,6 @@ export class MockCompilerHost implements ts.CompilerHost { useCaseSensitiveFileNames(): boolean { return false; } getNewLine(): string { return '\n'; } + + getDirectories(path: string): string[] { return this.context.getDirectories(path); } } diff --git a/modules/@angular/compiler-cli/test/static_reflector_spec.ts b/modules/@angular/compiler-cli/test/static_reflector_spec.ts index bf82870649..a1d0fa0f7b 100644 --- a/modules/@angular/compiler-cli/test/static_reflector_spec.ts +++ b/modules/@angular/compiler-cli/test/static_reflector_spec.ts @@ -176,28 +176,28 @@ describe('StaticReflector', () => { expect(simplify(noContext, ({__symbolic: 'binop', operator: '==', left: 0x22, right: 0x22}))) .toBe(0x22 == 0x22); expect(simplify(noContext, ({__symbolic: 'binop', operator: '==', left: 0x22, right: 0xF0}))) - .toBe(0x22 == 0xF0); + .toBe(0x22 as any == 0xF0); }); it('should simplify !=', () => { expect(simplify(noContext, ({__symbolic: 'binop', operator: '!=', left: 0x22, right: 0x22}))) .toBe(0x22 != 0x22); expect(simplify(noContext, ({__symbolic: 'binop', operator: '!=', left: 0x22, right: 0xF0}))) - .toBe(0x22 != 0xF0); + .toBe(0x22 as any != 0xF0); }); it('should simplify ===', () => { expect(simplify(noContext, ({__symbolic: 'binop', operator: '===', left: 0x22, right: 0x22}))) .toBe(0x22 === 0x22); expect(simplify(noContext, ({__symbolic: 'binop', operator: '===', left: 0x22, right: 0xF0}))) - .toBe(0x22 === 0xF0); + .toBe(0x22 as any === 0xF0); }); it('should simplify !==', () => { expect(simplify(noContext, ({__symbolic: 'binop', operator: '!==', left: 0x22, right: 0x22}))) .toBe(0x22 !== 0x22); expect(simplify(noContext, ({__symbolic: 'binop', operator: '!==', left: 0x22, right: 0xF0}))) - .toBe(0x22 !== 0xF0); + .toBe(0x22 as any !== 0xF0); }); it('should simplify >', () => { diff --git a/modules/@angular/compiler-cli/tsconfig-es5.json b/modules/@angular/compiler-cli/tsconfig.json similarity index 95% rename from modules/@angular/compiler-cli/tsconfig-es5.json rename to modules/@angular/compiler-cli/tsconfig.json index ee6b249db3..7c89c050db 100644 --- a/modules/@angular/compiler-cli/tsconfig-es5.json +++ b/modules/@angular/compiler-cli/tsconfig.json @@ -18,7 +18,8 @@ "rootDir": ".", "sourceRoot": ".", "outDir": "../../../dist/packages-dist/compiler-cli", - "declaration": true + "declaration": true, + "skipLibCheck": true }, "exclude": ["integrationtest"], "files": [ diff --git a/modules/@angular/compiler/core_private.ts b/modules/@angular/compiler/core_private.ts deleted file mode 100644 index b6e3b5de39..0000000000 --- a/modules/@angular/compiler/core_private.ts +++ /dev/null @@ -1,103 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {__core_private_DebugAppView__, __core_private_TemplateRef__, __core_private__ as r, __core_private_types__ as types} from '@angular/core'; - -export declare let _compiler_core_private_types: types; - -export var isDefaultChangeDetectionStrategy: typeof r.isDefaultChangeDetectionStrategy = - r.isDefaultChangeDetectionStrategy; -export type ChangeDetectorStatus = typeof _compiler_core_private_types.ChangeDetectorStatus; -export var ChangeDetectorStatus: typeof r.ChangeDetectorStatus = r.ChangeDetectorStatus; -export var CHANGE_DETECTION_STRATEGY_VALUES: typeof r.CHANGE_DETECTION_STRATEGY_VALUES = - r.CHANGE_DETECTION_STRATEGY_VALUES; -export var constructDependencies: typeof r.constructDependencies = r.constructDependencies; -export type LifecycleHooks = typeof _compiler_core_private_types.LifecycleHooks; -export var LifecycleHooks: typeof r.LifecycleHooks = r.LifecycleHooks; -export var LIFECYCLE_HOOKS_VALUES: typeof r.LIFECYCLE_HOOKS_VALUES = r.LIFECYCLE_HOOKS_VALUES; -export type ReflectorReader = typeof _compiler_core_private_types.ReflectorReader; -export var ReflectorReader: typeof r.ReflectorReader = r.ReflectorReader; -export type AppElement = typeof _compiler_core_private_types.AppElement; -export var AppElement: typeof r.AppElement = r.AppElement; -export var CodegenComponentFactoryResolver: typeof r.CodegenComponentFactoryResolver = - r.CodegenComponentFactoryResolver; -export var AppView: typeof r.AppView = r.AppView; -export type DebugAppView = __core_private_DebugAppView__; -export var DebugAppView: typeof r.DebugAppView = r.DebugAppView; -export var NgModuleInjector: typeof r.NgModuleInjector = r.NgModuleInjector; -export type ViewType = typeof _compiler_core_private_types.ViewType; -export var ViewType: typeof r.ViewType = r.ViewType; -export var MAX_INTERPOLATION_VALUES: typeof r.MAX_INTERPOLATION_VALUES = r.MAX_INTERPOLATION_VALUES; -export var checkBinding: typeof r.checkBinding = r.checkBinding; -export var flattenNestedViewRenderNodes: typeof r.flattenNestedViewRenderNodes = - r.flattenNestedViewRenderNodes; -export var interpolate: typeof r.interpolate = r.interpolate; -export var ViewUtils: typeof r.ViewUtils = r.ViewUtils; -export var VIEW_ENCAPSULATION_VALUES: typeof r.VIEW_ENCAPSULATION_VALUES = - r.VIEW_ENCAPSULATION_VALUES; -export var DebugContext: typeof r.DebugContext = r.DebugContext; -export var StaticNodeDebugInfo: typeof r.StaticNodeDebugInfo = r.StaticNodeDebugInfo; -export var devModeEqual: typeof r.devModeEqual = r.devModeEqual; -export var UNINITIALIZED: typeof r.UNINITIALIZED = r.UNINITIALIZED; -export var ValueUnwrapper: typeof _compiler_core_private_types.ValueUnwrapper = r.ValueUnwrapper; -export type TemplateRef_ = __core_private_TemplateRef__; -export var TemplateRef_: typeof r.TemplateRef_ = r.TemplateRef_; -export type RenderDebugInfo = typeof _compiler_core_private_types.RenderDebugInfo; -export var RenderDebugInfo: typeof r.RenderDebugInfo = r.RenderDebugInfo; -export var EMPTY_ARRAY: typeof r.EMPTY_ARRAY = r.EMPTY_ARRAY; -export var EMPTY_MAP: typeof r.EMPTY_MAP = r.EMPTY_MAP; -export var pureProxy1: typeof r.pureProxy1 = r.pureProxy1; -export var pureProxy2: typeof r.pureProxy2 = r.pureProxy2; -export var pureProxy3: typeof r.pureProxy3 = r.pureProxy3; -export var pureProxy4: typeof r.pureProxy4 = r.pureProxy4; -export var pureProxy5: typeof r.pureProxy5 = r.pureProxy5; -export var pureProxy6: typeof r.pureProxy6 = r.pureProxy6; -export var pureProxy7: typeof r.pureProxy7 = r.pureProxy7; -export var pureProxy8: typeof r.pureProxy8 = r.pureProxy8; -export var pureProxy9: typeof r.pureProxy9 = r.pureProxy9; -export var pureProxy10: typeof r.pureProxy10 = r.pureProxy10; -export var castByValue: typeof r.castByValue = r.castByValue; -export type Console = typeof _compiler_core_private_types.Console; -export var Console: typeof r.Console = r.Console; -export var reflector: typeof _compiler_core_private_types.Reflector = r.reflector; -export var Reflector: typeof r.Reflector = r.Reflector; -export type Reflector = typeof _compiler_core_private_types.Reflector; -export type ReflectionCapabilities = typeof _compiler_core_private_types.ReflectionCapabilities; -export var ReflectionCapabilities: typeof r.ReflectionCapabilities = r.ReflectionCapabilities; -export type NoOpAnimationPlayer = typeof _compiler_core_private_types.NoOpAnimationPlayer; -export var NoOpAnimationPlayer: typeof r.NoOpAnimationPlayer = r.NoOpAnimationPlayer; -export type AnimationPlayer = typeof _compiler_core_private_types.AnimationPlayer; -export var AnimationPlayer: typeof r.AnimationPlayer = r.AnimationPlayer; -export type AnimationSequencePlayer = typeof _compiler_core_private_types.AnimationSequencePlayer; -export var AnimationSequencePlayer: typeof r.AnimationSequencePlayer = r.AnimationSequencePlayer; -export type AnimationGroupPlayer = typeof _compiler_core_private_types.AnimationGroupPlayer; -export var AnimationGroupPlayer: typeof r.AnimationGroupPlayer = r.AnimationGroupPlayer; -export type AnimationKeyframe = typeof _compiler_core_private_types.AnimationKeyframe; -export var AnimationKeyframe: typeof r.AnimationKeyframe = r.AnimationKeyframe; -export type AnimationStyles = typeof _compiler_core_private_types.AnimationStyles; -export var AnimationStyles: typeof r.AnimationStyles = r.AnimationStyles; -export type AnimationOutput = typeof _compiler_core_private_types.AnimationOutput; -export var AnimationOutput: typeof r.AnimationOutput = r.AnimationOutput; -export var ANY_STATE = r.ANY_STATE; -export var DEFAULT_STATE = r.DEFAULT_STATE; -export var EMPTY_STATE = r.EMPTY_STATE; -export var FILL_STYLE_FLAG = r.FILL_STYLE_FLAG; -export var prepareFinalAnimationStyles: typeof r.prepareFinalAnimationStyles = - r.prepareFinalAnimationStyles; -export var balanceAnimationKeyframes: typeof r.balanceAnimationKeyframes = - r.balanceAnimationKeyframes; -export var flattenStyles: typeof r.flattenStyles = r.flattenStyles; -export var clearStyles: typeof r.clearStyles = r.clearStyles; -export var collectAndResolveStyles: typeof r.collectAndResolveStyles = r.collectAndResolveStyles; -export var renderStyles: typeof r.renderStyles = r.renderStyles; -export type ViewMetadata = typeof _compiler_core_private_types.ViewMetadata; -export var ViewMetadata: typeof r.ViewMetadata = r.ViewMetadata; -export type ComponentStillLoadingError = - typeof _compiler_core_private_types.ComponentStillLoadingError; -export var ComponentStillLoadingError: typeof r.ComponentStillLoadingError = - r.ComponentStillLoadingError; diff --git a/modules/@angular/compiler/core_private_testing.ts b/modules/@angular/compiler/core_private_testing.ts deleted file mode 100644 index ec976f1f2f..0000000000 --- a/modules/@angular/compiler/core_private_testing.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {__core_private_testing__ as r, __core_private_testing_types__ as types} from '@angular/core/testing'; - -export declare let _compiler_core_testing_types: types; - -export type TestingCompiler = typeof _compiler_core_testing_types.TestingCompiler; -export var TestingCompiler: typeof r.TestingCompiler = r.TestingCompiler; - -export type TestingCompilerFactory = typeof _compiler_core_testing_types.TestingCompilerFactory; -export var TestingCompilerFactory: typeof r.TestingCompilerFactory = r.TestingCompilerFactory; diff --git a/modules/@angular/compiler/index.ts b/modules/@angular/compiler/index.ts index 13959624d3..36281d2e74 100644 --- a/modules/@angular/compiler/index.ts +++ b/modules/@angular/compiler/index.ts @@ -9,14 +9,18 @@ /** * @module * @description - * Starting point to import all compiler APIs. + * Entry point for all APIs of the compiler package. + * + *
+ *
Unstable APIs
+ *

+ * All compiler apis are currently considered experimental and private! + *

+ *

+ * We expect the APIs in this package to keep on changing. Do not rely on them. + *

+ *
*/ -import * as i18n from './src/i18n/index'; +export * from './src/index'; -export {COMPILER_PROVIDERS, CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileFactoryMetadata, CompileIdentifierMetadata, CompileMetadataWithIdentifier, CompilePipeMetadata, CompileProviderMetadata, CompileQueryMetadata, CompileTemplateMetadata, CompileTokenMetadata, CompileTypeMetadata, CompilerConfig, DEFAULT_PACKAGE_URL_PROVIDER, DirectiveResolver, NgModuleResolver, OfflineCompiler, PipeResolver, RenderTypes, ResourceLoader, RuntimeCompiler, SourceModule, TEMPLATE_TRANSFORMS, UrlResolver, createOfflineCompileUrlResolver, platformCoreDynamic} from './src/compiler'; -export {DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig} from './src/ml_parser/interpolation_config'; -export {ElementSchemaRegistry} from './src/schema/element_schema_registry'; -export {i18n}; - -export * from './src/template_parser/template_ast'; -export * from './private_export'; +// This file only reexports content of the `src` folder. Keep it that way. diff --git a/modules/@angular/compiler/package.json b/modules/@angular/compiler/package.json index 3c5e0d7c29..bac67479de 100644 --- a/modules/@angular/compiler/package.json +++ b/modules/@angular/compiler/package.json @@ -1,9 +1,9 @@ { "name": "@angular/compiler", "version": "0.0.0-PLACEHOLDER", - "description": "", - "main": "index.js", - "jsnext:main": "esm/index.js", + "description": "Angular2 - compiler", + "main": "bundles/compiler.umd.js", + "module": "index.js", "typings": "index.d.ts", "author": "angular", "license": "MIT", diff --git a/modules/@angular/compiler/private_export.ts b/modules/@angular/compiler/private_export.ts deleted file mode 100644 index 4c30248771..0000000000 --- a/modules/@angular/compiler/private_export.ts +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import * as directive_normalizer from './src/directive_normalizer'; -import * as lexer from './src/expression_parser/lexer'; -import * as parser from './src/expression_parser/parser'; -import * as metadata_resolver from './src/metadata_resolver'; -import * as html_parser from './src/ml_parser/html_parser'; -import * as interpolation_config from './src/ml_parser/interpolation_config'; -import * as ng_module_compiler from './src/ng_module_compiler'; -import * as path_util from './src/output/path_util'; -import * as ts_emitter from './src/output/ts_emitter'; -import * as parse_util from './src/parse_util'; -import * as dom_element_schema_registry from './src/schema/dom_element_schema_registry'; -import * as selector from './src/selector'; -import * as style_compiler from './src/style_compiler'; -import * as template_parser from './src/template_parser/template_parser'; -import * as view_compiler from './src/view_compiler/view_compiler'; - -export namespace __compiler_private__ { -export type SelectorMatcher = selector.SelectorMatcher; -export var SelectorMatcher = selector.SelectorMatcher; - -export type CssSelector = selector.CssSelector; -export var CssSelector = selector.CssSelector; - -export type AssetUrl = path_util.AssetUrl; -export var AssetUrl = path_util.AssetUrl; - -export type ImportGenerator = path_util.ImportGenerator; -export var ImportGenerator = path_util.ImportGenerator; - -export type CompileMetadataResolver = metadata_resolver.CompileMetadataResolver; -export var CompileMetadataResolver = metadata_resolver.CompileMetadataResolver; - -export type HtmlParser = html_parser.HtmlParser; -export var HtmlParser = html_parser.HtmlParser; - -export type InterpolationConfig = interpolation_config.InterpolationConfig; -export var InterpolationConfig = interpolation_config.InterpolationConfig; - -export type DirectiveNormalizer = directive_normalizer.DirectiveNormalizer; -export var DirectiveNormalizer = directive_normalizer.DirectiveNormalizer; - -export type Lexer = lexer.Lexer; -export var Lexer = lexer.Lexer; - -export type Parser = parser.Parser; -export var Parser = parser.Parser; - -export type ParseLocation = parse_util.ParseLocation; -export var ParseLocation = parse_util.ParseLocation; - -export type ParseError = parse_util.ParseError; -export var ParseError = parse_util.ParseError; - -export type ParseErrorLevel = parse_util.ParseErrorLevel; -export var ParseErrorLevel = parse_util.ParseErrorLevel; - -export type ParseSourceFile = parse_util.ParseSourceFile; -export var ParseSourceFile = parse_util.ParseSourceFile; - -export type ParseSourceSpan = parse_util.ParseSourceSpan; -export var ParseSourceSpan = parse_util.ParseSourceSpan; - -export type TemplateParser = template_parser.TemplateParser; -export var TemplateParser = template_parser.TemplateParser; - -export type TemplateParseResult = template_parser.TemplateParseResult; - -export type DomElementSchemaRegistry = dom_element_schema_registry.DomElementSchemaRegistry; -export var DomElementSchemaRegistry = dom_element_schema_registry.DomElementSchemaRegistry; - -export type StyleCompiler = style_compiler.StyleCompiler; -export var StyleCompiler = style_compiler.StyleCompiler; - -export type ViewCompiler = view_compiler.ViewCompiler; -export var ViewCompiler = view_compiler.ViewCompiler; - -export type NgModuleCompiler = ng_module_compiler.NgModuleCompiler; -export var NgModuleCompiler = ng_module_compiler.NgModuleCompiler; - -export type TypeScriptEmitter = ts_emitter.TypeScriptEmitter; -export var TypeScriptEmitter = ts_emitter.TypeScriptEmitter; -} diff --git a/modules/@angular/compiler/rollup-testing.config.js b/modules/@angular/compiler/rollup-testing.config.js new file mode 100644 index 0000000000..69d0730748 --- /dev/null +++ b/modules/@angular/compiler/rollup-testing.config.js @@ -0,0 +1,16 @@ + +export default { + entry: '../../../dist/packages-dist/compiler/testing/index.js', + dest: '../../../dist/packages-dist/compiler/bundles/compiler-testing.umd.js', + format: 'umd', + moduleName: 'ng.compiler.testing', + globals: { + '@angular/core': 'ng.core', + '@angular/core/testing': 'ng.core.testing', + '@angular/compiler': 'ng.compiler', + 'rxjs/Subject': 'Rx', + 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. + 'rxjs/operator/toPromise': 'Rx.Observable.prototype', + 'rxjs/Observable': 'Rx' + } +} diff --git a/modules/@angular/compiler/rollup.config.js b/modules/@angular/compiler/rollup.config.js index e50c66e9eb..11b0aa2ca9 100644 --- a/modules/@angular/compiler/rollup.config.js +++ b/modules/@angular/compiler/rollup.config.js @@ -1,7 +1,7 @@ export default { - entry: '../../../dist/packages-dist/compiler/esm/index.js', - dest: '../../../dist/packages-dist/compiler/esm/compiler.umd.js', + entry: '../../../dist/packages-dist/compiler/index.js', + dest: '../../../dist/packages-dist/compiler/bundles/compiler.umd.js', format: 'umd', moduleName: 'ng.compiler', globals: { diff --git a/modules/@angular/compiler/src/animation/animation_compiler.ts b/modules/@angular/compiler/src/animation/animation_compiler.ts index 08877ff689..8454dd8db2 100644 --- a/modules/@angular/compiler/src/animation/animation_compiler.ts +++ b/modules/@angular/compiler/src/animation/animation_compiler.ts @@ -6,12 +6,12 @@ * found in the LICENSE file at https://angular.io/license */ -import {ANY_STATE, AnimationOutput, DEFAULT_STATE, EMPTY_STATE} from '../../core_private'; import {CompileDirectiveMetadata} from '../compile_metadata'; import {StringMapWrapper} from '../facade/collection'; import {isBlank, isPresent} from '../facade/lang'; import {Identifiers, resolveIdentifier} from '../identifiers'; import * as o from '../output/output_ast'; +import {ANY_STATE, AnimationOutput, DEFAULT_STATE, EMPTY_STATE} from '../private_import_core'; import * as t from '../template_parser/template_ast'; import {AnimationAst, AnimationAstVisitor, AnimationEntryAst, AnimationGroupAst, AnimationKeyframeAst, AnimationSequenceAst, AnimationStateAst, AnimationStateDeclarationAst, AnimationStateTransitionAst, AnimationStepAst, AnimationStylesAst} from './animation_ast'; diff --git a/modules/@angular/compiler/src/animation/animation_parser.ts b/modules/@angular/compiler/src/animation/animation_parser.ts index 88ed61c8af..72769c7b68 100644 --- a/modules/@angular/compiler/src/animation/animation_parser.ts +++ b/modules/@angular/compiler/src/animation/animation_parser.ts @@ -6,13 +6,13 @@ * found in the LICENSE file at https://angular.io/license */ -import {ANY_STATE, AnimationOutput, FILL_STYLE_FLAG} from '../../core_private'; import {CompileAnimationAnimateMetadata, CompileAnimationEntryMetadata, CompileAnimationGroupMetadata, CompileAnimationKeyframesSequenceMetadata, CompileAnimationMetadata, CompileAnimationSequenceMetadata, CompileAnimationStateDeclarationMetadata, CompileAnimationStateTransitionMetadata, CompileAnimationStyleMetadata, CompileAnimationWithStepsMetadata} from '../compile_metadata'; import {ListWrapper, StringMapWrapper} from '../facade/collection'; import {NumberWrapper, isArray, isBlank, isPresent, isString, isStringMap} from '../facade/lang'; import {Math} from '../facade/math'; import {ParseError} from '../parse_util'; +import {ANY_STATE, AnimationOutput, FILL_STYLE_FLAG} from '../private_import_core'; import {AnimationAst, AnimationEntryAst, AnimationGroupAst, AnimationKeyframeAst, AnimationSequenceAst, AnimationStateDeclarationAst, AnimationStateTransitionAst, AnimationStateTransitionExpression, AnimationStepAst, AnimationStylesAst, AnimationWithStepsAst} from './animation_ast'; import {StylesCollection} from './styles_collection'; diff --git a/modules/@angular/compiler/src/compile_metadata.ts b/modules/@angular/compiler/src/compile_metadata.ts index 3146f209ad..25311ae3a2 100644 --- a/modules/@angular/compiler/src/compile_metadata.ts +++ b/modules/@angular/compiler/src/compile_metadata.ts @@ -8,10 +8,9 @@ import {ChangeDetectionStrategy, SchemaMetadata, Type, ViewEncapsulation} from '@angular/core'; -import {LifecycleHooks, reflector} from '../core_private'; - import {ListWrapper, MapWrapper, StringMapWrapper} from './facade/collection'; import {isBlank, isPresent, isStringMap, normalizeBlank, normalizeBool} from './facade/lang'; +import {LifecycleHooks, reflector} from './private_import_core'; import {CssSelector} from './selector'; import {getUrlScheme} from './url_resolver'; import {sanitizeIdentifier, splitAtColon} from './util'; diff --git a/modules/@angular/compiler/src/compiler.ts b/modules/@angular/compiler/src/compiler.ts index 307b980196..15802d0244 100644 --- a/modules/@angular/compiler/src/compiler.ts +++ b/modules/@angular/compiler/src/compiler.ts @@ -38,7 +38,7 @@ import {Lexer} from './expression_parser/lexer'; import {DirectiveResolver} from './directive_resolver'; import {PipeResolver} from './pipe_resolver'; import {NgModuleResolver} from './ng_module_resolver'; -import {Console, Reflector, reflector, ReflectorReader, ReflectionCapabilities} from '../core_private'; +import {Console, Reflector, reflector, ReflectorReader, ReflectionCapabilities} from './private_import_core'; import {ResourceLoader} from './resource_loader'; import * as i18n from './i18n/index'; @@ -61,9 +61,9 @@ export const COMPILER_PROVIDERS: Array|{[k: string]: any}|any[]> = Parser, HtmlParser, { - provide: i18n.HtmlParser, + provide: i18n.I18NHtmlParser, useFactory: (parser: HtmlParser, translations: string, format: string) => - new i18n.HtmlParser(parser, translations, format), + new i18n.I18NHtmlParser(parser, translations, format), deps: [ HtmlParser, [new OptionalMetadata(), new Inject(TRANSLATIONS)], diff --git a/modules/@angular/compiler/src/directive_resolver.ts b/modules/@angular/compiler/src/directive_resolver.ts index 3ea69a17db..28c502fc5f 100644 --- a/modules/@angular/compiler/src/directive_resolver.ts +++ b/modules/@angular/compiler/src/directive_resolver.ts @@ -7,9 +7,10 @@ */ import {ComponentMetadata, DirectiveMetadata, HostBindingMetadata, HostListenerMetadata, Injectable, InputMetadata, OutputMetadata, QueryMetadata, Type, resolveForwardRef} from '@angular/core'; -import {ReflectorReader, reflector} from '../core_private'; + import {StringMapWrapper} from './facade/collection'; import {isPresent, stringify} from './facade/lang'; +import {ReflectorReader, reflector} from './private_import_core'; import {splitAtColon} from './util'; function _isDirectiveMetadata(type: any): type is DirectiveMetadata { diff --git a/modules/@angular/compiler/src/i18n/html_parser.ts b/modules/@angular/compiler/src/i18n/i18n_html_parser.ts similarity index 92% rename from modules/@angular/compiler/src/i18n/html_parser.ts rename to modules/@angular/compiler/src/i18n/i18n_html_parser.ts index 2a436aa630..16cfb06304 100644 --- a/modules/@angular/compiler/src/i18n/html_parser.ts +++ b/modules/@angular/compiler/src/i18n/i18n_html_parser.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {HtmlParser as BaseHtmlParser} from '../ml_parser/html_parser'; +import {HtmlParser} from '../ml_parser/html_parser'; import {DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig} from '../ml_parser/interpolation_config'; import {ParseTreeResult} from '../ml_parser/parser'; @@ -18,7 +18,7 @@ import {Xmb} from './serializers/xmb'; import {Xtb} from './serializers/xtb'; import {TranslationBundle} from './translation_bundle'; -export class HtmlParser implements BaseHtmlParser { +export class I18NHtmlParser implements HtmlParser { // @override getTagDefinition: any; @@ -26,7 +26,7 @@ export class HtmlParser implements BaseHtmlParser { // interpolationConfig) // TODO(vicb): remove the interpolationConfig from the Xtb serializer constructor( - private _htmlParser: BaseHtmlParser, private _translations?: string, + private _htmlParser: HtmlParser, private _translations?: string, private _translationsFormat?: string) {} parse( @@ -69,4 +69,4 @@ export class HtmlParser implements BaseHtmlParser { return new Xliff(this._htmlParser, interpolationConfig); } } -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/src/i18n/index.ts b/modules/@angular/compiler/src/i18n/index.ts index b7e136de49..67b61a891f 100644 --- a/modules/@angular/compiler/src/i18n/index.ts +++ b/modules/@angular/compiler/src/i18n/index.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -export {HtmlParser} from './html_parser'; +export {I18NHtmlParser} from './i18n_html_parser'; export {MessageBundle} from './message_bundle'; export {Serializer} from './serializers/serializer'; export {Xliff} from './serializers/xliff'; diff --git a/modules/@angular/compiler/src/identifiers.ts b/modules/@angular/compiler/src/identifiers.ts index cd545d1e69..90ec332da1 100644 --- a/modules/@angular/compiler/src/identifiers.ts +++ b/modules/@angular/compiler/src/identifiers.ts @@ -8,9 +8,8 @@ import {ANALYZE_FOR_ENTRY_COMPONENTS, ChangeDetectionStrategy, ChangeDetectorRef, ComponentFactory, ComponentFactoryResolver, ElementRef, Injector, LOCALE_ID as LOCALE_ID_, NgModuleFactory, QueryList, RenderComponentType, Renderer, SecurityContext, SimpleChange, TRANSLATIONS_FORMAT as TRANSLATIONS_FORMAT_, TemplateRef, ViewContainerRef, ViewEncapsulation} from '@angular/core'; -import {AnimationGroupPlayer, AnimationKeyframe, AnimationOutput, AnimationSequencePlayer, AnimationStyles, AppElement, AppView, ChangeDetectorStatus, CodegenComponentFactoryResolver, DebugAppView, DebugContext, EMPTY_ARRAY, EMPTY_MAP, NgModuleInjector, NoOpAnimationPlayer, StaticNodeDebugInfo, TemplateRef_, UNINITIALIZED, ValueUnwrapper, ViewType, ViewUtils, balanceAnimationKeyframes, castByValue, checkBinding, clearStyles, collectAndResolveStyles, devModeEqual, flattenNestedViewRenderNodes, interpolate, prepareFinalAnimationStyles, pureProxy1, pureProxy10, pureProxy2, pureProxy3, pureProxy4, pureProxy5, pureProxy6, pureProxy7, pureProxy8, pureProxy9, reflector, renderStyles} from '../core_private'; - import {CompileIdentifierMetadata, CompileTokenMetadata} from './compile_metadata'; +import {AnimationGroupPlayer, AnimationKeyframe, AnimationOutput, AnimationSequencePlayer, AnimationStyles, AppElement, AppView, ChangeDetectorStatus, CodegenComponentFactoryResolver, DebugAppView, DebugContext, EMPTY_ARRAY, EMPTY_MAP, NgModuleInjector, NoOpAnimationPlayer, StaticNodeDebugInfo, TemplateRef_, UNINITIALIZED, ValueUnwrapper, ViewType, ViewUtils, balanceAnimationKeyframes, castByValue, checkBinding, clearStyles, collectAndResolveStyles, devModeEqual, flattenNestedViewRenderNodes, interpolate, prepareFinalAnimationStyles, pureProxy1, pureProxy10, pureProxy2, pureProxy3, pureProxy4, pureProxy5, pureProxy6, pureProxy7, pureProxy8, pureProxy9, reflector, renderStyles} from './private_import_core'; import {assetUrl} from './util'; var APP_VIEW_MODULE_URL = assetUrl('core', 'linker/view'); @@ -291,4 +290,4 @@ export function resolveEnumIdentifier( const resolvedEnum = reflector.resolveEnum(enumType.reference, name); return new CompileIdentifierMetadata( {name: `${enumType.name}.${name}`, moduleUrl: enumType.moduleUrl, reference: resolvedEnum}); -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/src/index.ts b/modules/@angular/compiler/src/index.ts new file mode 100644 index 0000000000..bc49bb5898 --- /dev/null +++ b/modules/@angular/compiler/src/index.ts @@ -0,0 +1,20 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +/** + * @module + * @description + * Starting point to import all compiler APIs. + */ + +export {COMPILER_PROVIDERS, CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileFactoryMetadata, CompileIdentifierMetadata, CompileMetadataWithIdentifier, CompilePipeMetadata, CompileProviderMetadata, CompileQueryMetadata, CompileTemplateMetadata, CompileTokenMetadata, CompileTypeMetadata, CompilerConfig, DEFAULT_PACKAGE_URL_PROVIDER, DirectiveResolver, NgModuleResolver, OfflineCompiler, PipeResolver, RenderTypes, ResourceLoader, RuntimeCompiler, SourceModule, TEMPLATE_TRANSFORMS, UrlResolver, createOfflineCompileUrlResolver, platformCoreDynamic} from './compiler'; +export {DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig} from './ml_parser/interpolation_config'; +export {ElementSchemaRegistry} from './schema/element_schema_registry'; +export * from './i18n/index'; +export * from './template_parser/template_ast'; +export * from './private_export'; diff --git a/modules/@angular/compiler/src/lifecycle_reflector.ts b/modules/@angular/compiler/src/lifecycle_reflector.ts index 5c1a6dfa2c..d6205b2fb1 100644 --- a/modules/@angular/compiler/src/lifecycle_reflector.ts +++ b/modules/@angular/compiler/src/lifecycle_reflector.ts @@ -8,9 +8,8 @@ import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, DoCheck, OnChanges, OnDestroy, OnInit, Type} from '@angular/core'; -import {LifecycleHooks, reflector} from '../core_private'; - import {MapWrapper} from './facade/collection'; +import {LifecycleHooks, reflector} from './private_import_core'; const LIFECYCLE_INTERFACES: Map> = MapWrapper.createFromPairs([ [LifecycleHooks.OnInit, OnInit], diff --git a/modules/@angular/compiler/src/metadata_resolver.ts b/modules/@angular/compiler/src/metadata_resolver.ts index b278139309..9f9bdc0b96 100644 --- a/modules/@angular/compiler/src/metadata_resolver.ts +++ b/modules/@angular/compiler/src/metadata_resolver.ts @@ -8,7 +8,6 @@ import {AnimationAnimateMetadata, AnimationEntryMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadata, AnimationStateDeclarationMetadata, AnimationStateMetadata, AnimationStateTransitionMetadata, AnimationStyleMetadata, AnimationWithStepsMetadata, AttributeMetadata, ChangeDetectionStrategy, ComponentMetadata, HostMetadata, InjectMetadata, Injectable, ModuleWithProviders, OptionalMetadata, Provider, QueryMetadata, SchemaMetadata, SelfMetadata, SkipSelfMetadata, Type, ViewQueryMetadata, resolveForwardRef} from '@angular/core'; -import {LIFECYCLE_HOOKS_VALUES, ReflectorReader, reflector} from '../core_private'; import {StringMapWrapper} from '../src/facade/collection'; import {assertArrayOfStrings, assertInterpolationSymbols} from './assertions'; @@ -19,6 +18,7 @@ import {Identifiers, resolveIdentifierToken} from './identifiers'; import {hasLifecycleHook} from './lifecycle_reflector'; import {NgModuleResolver} from './ng_module_resolver'; import {PipeResolver} from './pipe_resolver'; +import {LIFECYCLE_HOOKS_VALUES, ReflectorReader, reflector} from './private_import_core'; import {ElementSchemaRegistry} from './schema/element_schema_registry'; import {getUrlScheme} from './url_resolver'; import {MODULE_SUFFIX, ValueTransformer, sanitizeIdentifier, visitValue} from './util'; diff --git a/modules/@angular/compiler/src/ng_module_compiler.ts b/modules/@angular/compiler/src/ng_module_compiler.ts index 2b8d4c076d..9ca32b71b6 100644 --- a/modules/@angular/compiler/src/ng_module_compiler.ts +++ b/modules/@angular/compiler/src/ng_module_compiler.ts @@ -8,14 +8,13 @@ import {Injectable} from '@angular/core'; -import {LifecycleHooks} from '../core_private'; - import {CompileDiDependencyMetadata, CompileIdentifierMetadata, CompileNgModuleMetadata, CompileProviderMetadata, CompileTokenMetadata} from './compile_metadata'; import {isBlank, isPresent} from './facade/lang'; import {Identifiers, identifierToken, resolveIdentifier, resolveIdentifierToken} from './identifiers'; import * as o from './output/output_ast'; import {convertValueToOutputAst} from './output/value_util'; import {ParseLocation, ParseSourceFile, ParseSourceSpan} from './parse_util'; +import {LifecycleHooks} from './private_import_core'; import {NgModuleProviderAnalyzer} from './provider_analyzer'; import {ProviderAst} from './template_parser/template_ast'; import {createDiTokenExpression} from './util'; diff --git a/modules/@angular/compiler/src/ng_module_resolver.ts b/modules/@angular/compiler/src/ng_module_resolver.ts index c4d7f77cfd..4d4e0dc5e7 100644 --- a/modules/@angular/compiler/src/ng_module_resolver.ts +++ b/modules/@angular/compiler/src/ng_module_resolver.ts @@ -8,8 +8,8 @@ import {Injectable, NgModuleMetadata, Type} from '@angular/core'; -import {ReflectorReader, reflector} from '../core_private'; import {isPresent, stringify} from './facade/lang'; +import {ReflectorReader, reflector} from './private_import_core'; function _isNgModuleMetadata(obj: any): obj is NgModuleMetadata { return obj instanceof NgModuleMetadata; diff --git a/modules/@angular/compiler/src/pipe_resolver.ts b/modules/@angular/compiler/src/pipe_resolver.ts index 36fcff447f..17e07de446 100644 --- a/modules/@angular/compiler/src/pipe_resolver.ts +++ b/modules/@angular/compiler/src/pipe_resolver.ts @@ -8,9 +8,8 @@ import {Injectable, PipeMetadata, Type, resolveForwardRef} from '@angular/core'; -import {ReflectorReader, reflector} from '../core_private'; - import {isPresent, stringify} from './facade/lang'; +import {ReflectorReader, reflector} from './private_import_core'; function _isPipeMetadata(type: any): boolean { return type instanceof PipeMetadata; diff --git a/modules/@angular/compiler/src/private_export.ts b/modules/@angular/compiler/src/private_export.ts new file mode 100644 index 0000000000..6e1287f65f --- /dev/null +++ b/modules/@angular/compiler/src/private_export.ts @@ -0,0 +1,112 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import * as directive_normalizer from './directive_normalizer'; +import * as lexer from './expression_parser/lexer'; +import * as parser from './expression_parser/parser'; +import * as metadata_resolver from './metadata_resolver'; +import * as html_parser from './ml_parser/html_parser'; +import * as interpolation_config from './ml_parser/interpolation_config'; +import * as ng_module_compiler from './ng_module_compiler'; +import * as path_util from './output/path_util'; +import * as ts_emitter from './output/ts_emitter'; +import * as parse_util from './parse_util'; +import * as dom_element_schema_registry from './schema/dom_element_schema_registry'; +import * as selector from './selector'; +import * as style_compiler from './style_compiler'; +import * as template_parser from './template_parser/template_parser'; +import * as view_compiler from './view_compiler/view_compiler'; + +export const __compiler_private__: { + _SelectorMatcher?: selector.SelectorMatcher; SelectorMatcher: typeof selector.SelectorMatcher; + + _CssSelector?: selector.CssSelector; + CssSelector: typeof selector.CssSelector; + + _AssetUrl?: path_util.AssetUrl; + AssetUrl: typeof path_util.AssetUrl; + + _ImportGenerator?: path_util.ImportGenerator; + ImportGenerator: typeof path_util.ImportGenerator; + + _CompileMetadataResolver?: metadata_resolver.CompileMetadataResolver; + CompileMetadataResolver: typeof metadata_resolver.CompileMetadataResolver; + + _HtmlParser?: html_parser.HtmlParser; + HtmlParser: typeof html_parser.HtmlParser; + + _InterpolationConfig?: interpolation_config.InterpolationConfig; + InterpolationConfig: typeof interpolation_config.InterpolationConfig; + + _DirectiveNormalizer?: directive_normalizer.DirectiveNormalizer; + DirectiveNormalizer: typeof directive_normalizer.DirectiveNormalizer; + + _Lexer?: lexer.Lexer; + Lexer: typeof lexer.Lexer; + + _Parser?: parser.Parser; + Parser: typeof parser.Parser; + + _ParseLocation?: parse_util.ParseLocation; + ParseLocation: typeof parse_util.ParseLocation; + + _ParseError?: parse_util.ParseError; + ParseError: typeof parse_util.ParseError; + + _ParseErrorLevel?: parse_util.ParseErrorLevel; + ParseErrorLevel: typeof parse_util.ParseErrorLevel; + + _ParseSourceFile?: parse_util.ParseSourceFile; + ParseSourceFile: typeof parse_util.ParseSourceFile; + + _ParseSourceSpan?: parse_util.ParseSourceSpan; + ParseSourceSpan: typeof parse_util.ParseSourceSpan; + + _TemplateParser?: template_parser.TemplateParser; + TemplateParser: typeof template_parser.TemplateParser; + + _TemplateParseResult?: template_parser.TemplateParseResult; + + _DomElementSchemaRegistry?: dom_element_schema_registry.DomElementSchemaRegistry; + DomElementSchemaRegistry: typeof dom_element_schema_registry.DomElementSchemaRegistry; + + _StyleCompiler?: style_compiler.StyleCompiler; + StyleCompiler: typeof style_compiler.StyleCompiler; + + _ViewCompiler?: view_compiler.ViewCompiler; + ViewCompiler: typeof view_compiler.ViewCompiler; + + _NgModuleCompiler?: ng_module_compiler.NgModuleCompiler; + NgModuleCompiler: typeof ng_module_compiler.NgModuleCompiler; + + _TypeScriptEmitter?: ts_emitter.TypeScriptEmitter; + TypeScriptEmitter: typeof ts_emitter.TypeScriptEmitter; + +} = { + SelectorMatcher: selector.SelectorMatcher, + CssSelector: selector.CssSelector, + AssetUrl: path_util.AssetUrl, + ImportGenerator: path_util.ImportGenerator, + CompileMetadataResolver: metadata_resolver.CompileMetadataResolver, + HtmlParser: html_parser.HtmlParser, + InterpolationConfig: interpolation_config.InterpolationConfig, + DirectiveNormalizer: directive_normalizer.DirectiveNormalizer, + Lexer: lexer.Lexer, + Parser: parser.Parser, + ParseLocation: parse_util.ParseLocation, + ParseError: parse_util.ParseError, + ParseErrorLevel: parse_util.ParseErrorLevel, + ParseSourceFile: parse_util.ParseSourceFile, + ParseSourceSpan: parse_util.ParseSourceSpan, + TemplateParser: template_parser.TemplateParser, + DomElementSchemaRegistry: dom_element_schema_registry.DomElementSchemaRegistry, + StyleCompiler: style_compiler.StyleCompiler, + ViewCompiler: view_compiler.ViewCompiler, + NgModuleCompiler: ng_module_compiler.NgModuleCompiler, + TypeScriptEmitter: ts_emitter.TypeScriptEmitter +}; diff --git a/modules/@angular/compiler/src/private_import_core.ts b/modules/@angular/compiler/src/private_import_core.ts new file mode 100644 index 0000000000..cca7cca9df --- /dev/null +++ b/modules/@angular/compiler/src/private_import_core.ts @@ -0,0 +1,94 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {__core_private__ as r} from '@angular/core'; + +export const isDefaultChangeDetectionStrategy: typeof r.isDefaultChangeDetectionStrategy = + r.isDefaultChangeDetectionStrategy; +export type ChangeDetectorStatus = typeof r._ChangeDetectorStatus; +export const ChangeDetectorStatus: typeof r.ChangeDetectorStatus = r.ChangeDetectorStatus; +r.CHANGE_DETECTION_STRATEGY_VALUES; +export type LifecycleHooks = typeof r._LifecycleHooks; +export const LifecycleHooks: typeof r.LifecycleHooks = r.LifecycleHooks; +export const LIFECYCLE_HOOKS_VALUES: typeof r.LIFECYCLE_HOOKS_VALUES = r.LIFECYCLE_HOOKS_VALUES; +export type ReflectorReader = typeof r._ReflectorReader; +export const ReflectorReader: typeof r.ReflectorReader = r.ReflectorReader; +export type AppElement = typeof r._AppElement; +export const AppElement: typeof r.AppElement = r.AppElement; +export const CodegenComponentFactoryResolver: typeof r.CodegenComponentFactoryResolver = + r.CodegenComponentFactoryResolver; +export const AppView: typeof r.AppView = r.AppView; +export const DebugAppView: typeof r.DebugAppView = r.DebugAppView; +export const NgModuleInjector: typeof r.NgModuleInjector = r.NgModuleInjector; +export type ViewType = typeof r._ViewType; +export const ViewType: typeof r.ViewType = r.ViewType; +export const MAX_INTERPOLATION_VALUES: typeof r.MAX_INTERPOLATION_VALUES = + r.MAX_INTERPOLATION_VALUES; +export const checkBinding: typeof r.checkBinding = r.checkBinding; +export const flattenNestedViewRenderNodes: typeof r.flattenNestedViewRenderNodes = + r.flattenNestedViewRenderNodes; +export const interpolate: typeof r.interpolate = r.interpolate; +export const ViewUtils: typeof r.ViewUtils = r.ViewUtils; +export const DebugContext: typeof r.DebugContext = r.DebugContext; +export const StaticNodeDebugInfo: typeof r.StaticNodeDebugInfo = r.StaticNodeDebugInfo; +export const devModeEqual: typeof r.devModeEqual = r.devModeEqual; +export const UNINITIALIZED: typeof r.UNINITIALIZED = r.UNINITIALIZED; +export const ValueUnwrapper: typeof r.ValueUnwrapper = r.ValueUnwrapper; +export const TemplateRef_: typeof r.TemplateRef_ = r.TemplateRef_; +export type RenderDebugInfo = typeof r._RenderDebugInfo; +export const RenderDebugInfo: typeof r.RenderDebugInfo = r.RenderDebugInfo; +export const EMPTY_ARRAY: typeof r.EMPTY_ARRAY = r.EMPTY_ARRAY; +export const EMPTY_MAP: typeof r.EMPTY_MAP = r.EMPTY_MAP; +export const pureProxy1: typeof r.pureProxy1 = r.pureProxy1; +export const pureProxy2: typeof r.pureProxy2 = r.pureProxy2; +export const pureProxy3: typeof r.pureProxy3 = r.pureProxy3; +export const pureProxy4: typeof r.pureProxy4 = r.pureProxy4; +export const pureProxy5: typeof r.pureProxy5 = r.pureProxy5; +export const pureProxy6: typeof r.pureProxy6 = r.pureProxy6; +export const pureProxy7: typeof r.pureProxy7 = r.pureProxy7; +export const pureProxy8: typeof r.pureProxy8 = r.pureProxy8; +export const pureProxy9: typeof r.pureProxy9 = r.pureProxy9; +export const pureProxy10: typeof r.pureProxy10 = r.pureProxy10; +export const castByValue: typeof r.castByValue = r.castByValue; +export type Console = typeof r._Console; +export const Console: typeof r.Console = r.Console; +export const reflector: typeof r.reflector = r.reflector; +export const Reflector: typeof r.Reflector = r.Reflector; +export type Reflector = typeof r._Reflector; +export type ReflectionCapabilities = typeof r._ReflectionCapabilities; +export const ReflectionCapabilities: typeof r.ReflectionCapabilities = r.ReflectionCapabilities; +export type NoOpAnimationPlayer = typeof r._NoOpAnimationPlayer; +export const NoOpAnimationPlayer: typeof r.NoOpAnimationPlayer = r.NoOpAnimationPlayer; +export type AnimationPlayer = typeof r._AnimationPlayer; +export const AnimationPlayer: typeof r.AnimationPlayer = r.AnimationPlayer; +export type AnimationSequencePlayer = typeof r._AnimationSequencePlayer; +export const AnimationSequencePlayer: typeof r.AnimationSequencePlayer = r.AnimationSequencePlayer; +export type AnimationGroupPlayer = typeof r._AnimationGroupPlayer; +export const AnimationGroupPlayer: typeof r.AnimationGroupPlayer = r.AnimationGroupPlayer; +export type AnimationKeyframe = typeof r._AnimationKeyframe; +export const AnimationKeyframe: typeof r.AnimationKeyframe = r.AnimationKeyframe; +export type AnimationStyles = typeof r._AnimationStyles; +export const AnimationStyles: typeof r.AnimationStyles = r.AnimationStyles; +export type AnimationOutput = typeof r._AnimationOutput; +export const AnimationOutput: typeof r.AnimationOutput = r.AnimationOutput; +export const ANY_STATE = r.ANY_STATE; +export const DEFAULT_STATE = r.DEFAULT_STATE; +export const EMPTY_STATE = r.EMPTY_STATE; +export const FILL_STYLE_FLAG = r.FILL_STYLE_FLAG; +export const prepareFinalAnimationStyles: typeof r.prepareFinalAnimationStyles = + r.prepareFinalAnimationStyles; +export const balanceAnimationKeyframes: typeof r.balanceAnimationKeyframes = + r.balanceAnimationKeyframes; +export const clearStyles: typeof r.clearStyles = r.clearStyles; +export const collectAndResolveStyles: typeof r.collectAndResolveStyles = r.collectAndResolveStyles; +export const renderStyles: typeof r.renderStyles = r.renderStyles; +export type ViewMetadata = typeof r._ViewMetadata; +export const ViewMetadata: typeof r.ViewMetadata = r.ViewMetadata; +export type ComponentStillLoadingError = typeof r._ComponentStillLoadingError; +export const ComponentStillLoadingError: typeof r.ComponentStillLoadingError = + r.ComponentStillLoadingError; diff --git a/modules/@angular/compiler/src/runtime_compiler.ts b/modules/@angular/compiler/src/runtime_compiler.ts index cc4b46b7b8..abedb6ab89 100644 --- a/modules/@angular/compiler/src/runtime_compiler.ts +++ b/modules/@angular/compiler/src/runtime_compiler.ts @@ -7,7 +7,7 @@ */ import {Compiler, ComponentFactory, Injectable, Injector, ModuleWithComponentFactories, NgModuleFactory, OptionalMetadata, Provider, SchemaMetadata, SkipSelfMetadata, Type} from '@angular/core'; -import {ComponentStillLoadingError} from '../core_private'; + import {CompileDirectiveMetadata, CompileIdentifierMetadata, CompileNgModuleMetadata, CompilePipeMetadata, ProviderMeta, createHostComponentMeta} from './compile_metadata'; import {CompilerConfig} from './config'; import {DirectiveNormalizer} from './directive_normalizer'; @@ -17,6 +17,7 @@ import {NgModuleCompiler} from './ng_module_compiler'; import * as ir from './output/output_ast'; import {interpretStatements} from './output/output_interpreter'; import {jitStatements} from './output/output_jit'; +import {ComponentStillLoadingError} from './private_import_core'; import {CompiledStylesheet, StyleCompiler} from './style_compiler'; import {TemplateParser} from './template_parser/template_parser'; import {SyncAsyncResult} from './util'; diff --git a/modules/@angular/compiler/src/template_parser/template_ast.ts b/modules/@angular/compiler/src/template_parser/template_ast.ts index aad1d61d84..11f57a0e43 100644 --- a/modules/@angular/compiler/src/template_parser/template_ast.ts +++ b/modules/@angular/compiler/src/template_parser/template_ast.ts @@ -8,12 +8,14 @@ import {SecurityContext} from '@angular/core'; -import {LifecycleHooks} from '../../core_private'; import {CompileDirectiveMetadata, CompileProviderMetadata, CompileTokenMetadata} from '../compile_metadata'; import {AST} from '../expression_parser/ast'; import {isPresent} from '../facade/lang'; import {ParseSourceSpan} from '../parse_util'; +import {LifecycleHooks} from '../private_import_core'; + + /** * An Abstract Syntax Tree node representing part of a parsed Angular template. diff --git a/modules/@angular/compiler/src/template_parser/template_parser.ts b/modules/@angular/compiler/src/template_parser/template_parser.ts index fc9b9ff17a..1c5d9a3b82 100644 --- a/modules/@angular/compiler/src/template_parser/template_parser.ts +++ b/modules/@angular/compiler/src/template_parser/template_parser.ts @@ -8,13 +8,12 @@ import {Inject, Injectable, OpaqueToken, Optional, SchemaMetadata, SecurityContext} from '@angular/core'; -import {Console, MAX_INTERPOLATION_VALUES} from '../../core_private'; import {CompileDirectiveMetadata, CompilePipeMetadata, CompileTokenMetadata, removeIdentifierDuplicates} from '../compile_metadata'; import {AST, ASTWithSource, BindingPipe, EmptyExpr, Interpolation, ParserError, RecursiveAstVisitor, TemplateBinding} from '../expression_parser/ast'; import {Parser} from '../expression_parser/parser'; import {ListWrapper, SetWrapper, StringMapWrapper} from '../facade/collection'; import {isBlank, isPresent, isString} from '../facade/lang'; -import {HtmlParser} from '../i18n/html_parser'; +import {I18NHtmlParser} from '../i18n/i18n_html_parser'; import {Identifiers, identifierToken, resolveIdentifierToken} from '../identifiers'; import * as html from '../ml_parser/ast'; import {ParseTreeResult} from '../ml_parser/html_parser'; @@ -22,6 +21,7 @@ import {expandNodes} from '../ml_parser/icu_ast_expander'; import {InterpolationConfig} from '../ml_parser/interpolation_config'; import {mergeNsAndName, splitNsName} from '../ml_parser/tags'; import {ParseError, ParseErrorLevel, ParseSourceSpan} from '../parse_util'; +import {Console, MAX_INTERPOLATION_VALUES} from '../private_import_core'; import {ProviderElementContext, ProviderViewContext} from '../provider_analyzer'; import {ElementSchemaRegistry} from '../schema/element_schema_registry'; import {CssSelector, SelectorMatcher} from '../selector'; @@ -93,7 +93,7 @@ export class TemplateParseResult { export class TemplateParser { constructor( private _exprParser: Parser, private _schemaRegistry: ElementSchemaRegistry, - private _htmlParser: HtmlParser, private _console: Console, + private _htmlParser: I18NHtmlParser, private _console: Console, @Optional() @Inject(TEMPLATE_TRANSFORMS) public transforms: TemplateAstVisitor[]) {} parse( diff --git a/modules/@angular/compiler/src/view_compiler/compile_view.ts b/modules/@angular/compiler/src/view_compiler/compile_view.ts index 5a7be81b0d..fd35c397dd 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_view.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_view.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {ViewType} from '../../core_private'; import {CompiledAnimationTriggerResult} from '../animation/animation_compiler'; import {CompileDirectiveMetadata, CompileIdentifierMetadata, CompilePipeMetadata, CompileTokenMetadata} from '../compile_metadata'; import {CompilerConfig} from '../config'; @@ -14,6 +13,7 @@ import {ListWrapper, MapWrapper} from '../facade/collection'; import {isBlank, isPresent} from '../facade/lang'; import {Identifiers, resolveIdentifier} from '../identifiers'; import * as o from '../output/output_ast'; +import {ViewType} from '../private_import_core'; import {createDiTokenExpression} from '../util'; import {CompileBinding} from './compile_binding'; diff --git a/modules/@angular/compiler/src/view_compiler/constants.ts b/modules/@angular/compiler/src/view_compiler/constants.ts index 5211a0aa3f..b6dc075f14 100644 --- a/modules/@angular/compiler/src/view_compiler/constants.ts +++ b/modules/@angular/compiler/src/view_compiler/constants.ts @@ -8,12 +8,13 @@ import {ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; -import {ChangeDetectorStatus, ViewType} from '../../core_private'; import {CompileIdentifierMetadata} from '../compile_metadata'; import {isBlank} from '../facade/lang'; import {Identifiers, resolveEnumIdentifier, resolveIdentifier} from '../identifiers'; import * as o from '../output/output_ast'; +import {ChangeDetectorStatus, ViewType} from '../private_import_core'; + function _enumExpression(classIdentifier: CompileIdentifierMetadata, name: string): o.Expression { return o.importExpr(resolveEnumIdentifier(classIdentifier, name)); } diff --git a/modules/@angular/compiler/src/view_compiler/event_binder.ts b/modules/@angular/compiler/src/view_compiler/event_binder.ts index 8ad88156c3..947e6241f4 100644 --- a/modules/@angular/compiler/src/view_compiler/event_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/event_binder.ts @@ -6,12 +6,12 @@ * found in the LICENSE file at https://angular.io/license */ -import {AnimationOutput} from '../../core_private'; import {CompileDirectiveMetadata} from '../compile_metadata'; import {ListWrapper, StringMapWrapper} from '../facade/collection'; import {StringWrapper, isBlank, isPresent} from '../facade/lang'; import {Identifiers, identifierToken, resolveIdentifier} from '../identifiers'; import * as o from '../output/output_ast'; +import {AnimationOutput} from '../private_import_core'; import {BoundEventAst, DirectiveAst} from '../template_parser/template_ast'; import {CompileBinding} from './compile_binding'; diff --git a/modules/@angular/compiler/src/view_compiler/lifecycle_binder.ts b/modules/@angular/compiler/src/view_compiler/lifecycle_binder.ts index 2b59655f17..e926047250 100644 --- a/modules/@angular/compiler/src/view_compiler/lifecycle_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/lifecycle_binder.ts @@ -6,9 +6,9 @@ * found in the LICENSE file at https://angular.io/license */ -import {LifecycleHooks} from '../../core_private'; import {CompileDirectiveMetadata, CompilePipeMetadata} from '../compile_metadata'; import * as o from '../output/output_ast'; +import {LifecycleHooks} from '../private_import_core'; import {DirectiveAst, ProviderAst} from '../template_parser/template_ast'; import {CompileElement} from './compile_element'; diff --git a/modules/@angular/compiler/src/view_compiler/property_binder.ts b/modules/@angular/compiler/src/view_compiler/property_binder.ts index d2856a60ef..73645b5b61 100644 --- a/modules/@angular/compiler/src/view_compiler/property_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/property_binder.ts @@ -8,11 +8,11 @@ import {SecurityContext} from '@angular/core'; -import {EMPTY_STATE as EMPTY_ANIMATION_STATE, LifecycleHooks, isDefaultChangeDetectionStrategy} from '../../core_private'; import * as cdAst from '../expression_parser/ast'; import {isBlank, isPresent} from '../facade/lang'; import {Identifiers, resolveIdentifier} from '../identifiers'; import * as o from '../output/output_ast'; +import {EMPTY_STATE as EMPTY_ANIMATION_STATE, LifecycleHooks, isDefaultChangeDetectionStrategy} from '../private_import_core'; import {BoundElementPropertyAst, BoundTextAst, DirectiveAst, PropertyBindingType} from '../template_parser/template_ast'; import {camelCaseToDashCase} from '../util'; diff --git a/modules/@angular/compiler/src/view_compiler/view_binder.ts b/modules/@angular/compiler/src/view_compiler/view_binder.ts index 2bd389f557..bc7e720de7 100644 --- a/modules/@angular/compiler/src/view_compiler/view_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/view_binder.ts @@ -5,9 +5,9 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import {AnimationOutput} from '../../core_private'; import {ListWrapper} from '../facade/collection'; import {identifierToken} from '../identifiers'; +import {AnimationOutput} from '../private_import_core'; import {AttrAst, BoundDirectivePropertyAst, BoundElementPropertyAst, BoundEventAst, BoundTextAst, DirectiveAst, ElementAst, EmbeddedTemplateAst, NgContentAst, ReferenceAst, TemplateAst, TemplateAstVisitor, TextAst, VariableAst, templateVisitAll} from '../template_parser/template_ast'; import {CompileElement, CompileNode} from './compile_element'; diff --git a/modules/@angular/compiler/src/view_compiler/view_builder.ts b/modules/@angular/compiler/src/view_compiler/view_builder.ts index ebf0bdf5fb..1f2a3de81e 100644 --- a/modules/@angular/compiler/src/view_compiler/view_builder.ts +++ b/modules/@angular/compiler/src/view_compiler/view_builder.ts @@ -8,13 +8,13 @@ import {ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; -import {ChangeDetectorStatus, ViewType, isDefaultChangeDetectionStrategy} from '../../core_private'; import {AnimationCompiler} from '../animation/animation_compiler'; import {CompileDirectiveMetadata, CompileIdentifierMetadata, CompileTokenMetadata, CompileTypeMetadata} from '../compile_metadata'; import {ListWrapper, SetWrapper, StringMapWrapper} from '../facade/collection'; import {StringWrapper, isPresent} from '../facade/lang'; import {Identifiers, identifierToken, resolveIdentifier, resolveIdentifierToken} from '../identifiers'; import * as o from '../output/output_ast'; +import {ChangeDetectorStatus, ViewType, isDefaultChangeDetectionStrategy} from '../private_import_core'; import {AttrAst, BoundDirectivePropertyAst, BoundElementPropertyAst, BoundEventAst, BoundTextAst, DirectiveAst, ElementAst, EmbeddedTemplateAst, NgContentAst, ProviderAst, ReferenceAst, TemplateAst, TemplateAstVisitor, TextAst, VariableAst, templateVisitAll} from '../template_parser/template_ast'; import {createDiTokenExpression} from '../util'; diff --git a/modules/@angular/compiler/test/animation/animation_parser_spec.ts b/modules/@angular/compiler/test/animation/animation_parser_spec.ts index a138028eb3..b568871520 100644 --- a/modules/@angular/compiler/test/animation/animation_parser_spec.ts +++ b/modules/@angular/compiler/test/animation/animation_parser_spec.ts @@ -10,11 +10,11 @@ import {AnimationAnimateMetadata, AnimationGroupMetadata, AnimationMetadata, Ani import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; import {expect} from '@angular/platform-browser/testing/matchers'; -import {FILL_STYLE_FLAG, flattenStyles} from '../../core_private'; import {AnimationAst, AnimationEntryAst, AnimationGroupAst, AnimationKeyframeAst, AnimationSequenceAst, AnimationStateTransitionAst, AnimationStepAst, AnimationStylesAst} from '../../src/animation/animation_ast'; import {parseAnimationEntry} from '../../src/animation/animation_parser'; import {StringMapWrapper} from '../../src/facade/collection'; import {CompileMetadataResolver} from '../../src/metadata_resolver'; +import {FILL_STYLE_FLAG, flattenStyles} from '../private_import_core'; export function main() { describe('parseAnimationEntry', () => { diff --git a/modules/@angular/compiler/test/directive_resolver_mock_spec.ts b/modules/@angular/compiler/test/directive_resolver_mock_spec.ts index 9855ee4f97..4b304c5e94 100644 --- a/modules/@angular/compiler/test/directive_resolver_mock_spec.ts +++ b/modules/@angular/compiler/test/directive_resolver_mock_spec.ts @@ -9,8 +9,9 @@ import {Component, ComponentMetadata, Directive, Injector} from '@angular/core'; import {TestBed, inject} from '@angular/core/testing'; -import {ViewMetadata} from '../core_private'; -import {MockDirectiveResolver} from '../testing'; +import {MockDirectiveResolver} from '../testing/index'; + +import {ViewMetadata} from './private_import_core'; export function main() { describe('MockDirectiveResolver', () => { diff --git a/modules/@angular/compiler/test/expression_parser/validator.ts b/modules/@angular/compiler/test/expression_parser/validator.ts index e6e916db6b..f386352bf5 100644 --- a/modules/@angular/compiler/test/expression_parser/validator.ts +++ b/modules/@angular/compiler/test/expression_parser/validator.ts @@ -20,8 +20,13 @@ class ASTValidator extends RecursiveAstVisitor { validate(ast: AST, cb: () => void): void { if (!inSpan(ast.span, this.parentSpan)) { - throw Error( - `Invalid AST span [expected (${ast.span.start}, ${ast.span.end}) to be in (${this.parentSpan.start}, ${this.parentSpan.end}) for ${unparse(ast)}`); + if (this.parentSpan) { + let parentSpan = this.parentSpan as ParseSpan; + throw Error( + `Invalid AST span [expected (${ast.span.start}, ${ast.span.end}) to be in (${parentSpan.start}, ${parentSpan.end}) for ${unparse(ast)}`); + } else { + throw Error(`Invalid root AST span for ${unparse(ast)}`); + } } const oldParent = this.parentSpan; this.parentSpan = ast.span; diff --git a/modules/@angular/compiler/test/i18n/integration_spec.ts b/modules/@angular/compiler/test/i18n/integration_spec.ts index 945b466bb4..b8000491c8 100644 --- a/modules/@angular/compiler/test/i18n/integration_spec.ts +++ b/modules/@angular/compiler/test/i18n/integration_spec.ts @@ -7,7 +7,7 @@ */ import {NgLocalization} from '@angular/common'; -import {ResourceLoader, i18n} from '@angular/compiler'; +import {ResourceLoader} from '@angular/compiler'; import {Component, DebugElement, TRANSLATIONS, TRANSLATIONS_FORMAT} from '@angular/core'; import {TestBed, async} from '@angular/core/testing'; import {By} from '@angular/platform-browser/src/dom/debug/by'; diff --git a/modules/@angular/compiler/test/ng_module_resolver_mock_spec.ts b/modules/@angular/compiler/test/ng_module_resolver_mock_spec.ts index 3929a28bd7..1227d5c2b1 100644 --- a/modules/@angular/compiler/test/ng_module_resolver_mock_spec.ts +++ b/modules/@angular/compiler/test/ng_module_resolver_mock_spec.ts @@ -10,7 +10,7 @@ import {Injector, NgModule, NgModuleMetadata} from '@angular/core'; import {beforeEach, ddescribe, describe, expect, iit, inject, it} from '@angular/core/testing/testing_internal'; import {isBlank, stringify} from '../src/facade/lang'; -import {MockNgModuleResolver} from '../testing'; +import {MockNgModuleResolver} from '../testing/index'; export function main() { describe('MockNgModuleResolver', () => { diff --git a/modules/@angular/compiler/test/pipe_resolver_mock_spec.ts b/modules/@angular/compiler/test/pipe_resolver_mock_spec.ts index 03104cdd61..5cba291603 100644 --- a/modules/@angular/compiler/test/pipe_resolver_mock_spec.ts +++ b/modules/@angular/compiler/test/pipe_resolver_mock_spec.ts @@ -10,7 +10,7 @@ import {Injector, Pipe, PipeMetadata} from '@angular/core'; import {beforeEach, ddescribe, describe, expect, iit, inject, it} from '@angular/core/testing/testing_internal'; import {isBlank, stringify} from '../src/facade/lang'; -import {MockPipeResolver} from '../testing'; +import {MockPipeResolver} from '../testing/index'; export function main() { describe('MockPipeResolver', () => { diff --git a/modules/@angular/compiler/test/private_import_core.ts b/modules/@angular/compiler/test/private_import_core.ts new file mode 100644 index 0000000000..e78ac704bb --- /dev/null +++ b/modules/@angular/compiler/test/private_import_core.ts @@ -0,0 +1,15 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {__core_private__ as _} from '../../core/index'; + +export type ViewMetadata = typeof _._ViewMetadata; +export const ViewMetadata: typeof _.ViewMetadata = _.ViewMetadata; + +export const FILL_STYLE_FLAG = _.FILL_STYLE_FLAG; +export const flattenStyles: typeof _.flattenStyles = _.flattenStyles; diff --git a/modules/@angular/compiler/test/runtime_compiler_spec.ts b/modules/@angular/compiler/test/runtime_compiler_spec.ts index d48e09bb99..fc6bfe60e2 100644 --- a/modules/@angular/compiler/test/runtime_compiler_spec.ts +++ b/modules/@angular/compiler/test/runtime_compiler_spec.ts @@ -7,15 +7,15 @@ */ import {DirectiveResolver, ResourceLoader} from '@angular/compiler'; -import {MockDirectiveResolver} from '@angular/compiler/testing'; import {Compiler, Component, ComponentFactory, Injectable, Injector, Input, NgModule, NgModuleFactory, Type} from '@angular/core'; import {ComponentFixture, TestBed, async, fakeAsync, getTestBed, tick} from '@angular/core/testing'; import {beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; import {expect} from '@angular/platform-browser/testing/matchers'; -import {ViewMetadata} from '../core_private'; import {stringify} from '../src/facade/lang'; +import {MockDirectiveResolver} from '../testing/index'; +import {ViewMetadata} from './private_import_core'; import {SpyResourceLoader} from './spies'; @Component({selector: 'child-cmp'}) diff --git a/modules/@angular/compiler/test/template_parser/template_parser_spec.ts b/modules/@angular/compiler/test/template_parser/template_parser_spec.ts index 987ee50032..f4ecdb77b9 100644 --- a/modules/@angular/compiler/test/template_parser/template_parser_spec.ts +++ b/modules/@angular/compiler/test/template_parser/template_parser_spec.ts @@ -11,7 +11,6 @@ import {DomElementSchemaRegistry} from '@angular/compiler/src/schema/dom_element import {ElementSchemaRegistry} from '@angular/compiler/src/schema/element_schema_registry'; import {AttrAst, BoundDirectivePropertyAst, BoundElementPropertyAst, BoundEventAst, BoundTextAst, DirectiveAst, ElementAst, EmbeddedTemplateAst, NgContentAst, PropertyBindingType, ProviderAstType, ReferenceAst, TemplateAst, TemplateAstVisitor, TextAst, VariableAst, templateVisitAll} from '@angular/compiler/src/template_parser/template_ast'; import {TEMPLATE_TRANSFORMS, TemplateParser, splitClasses} from '@angular/compiler/src/template_parser/template_parser'; -import {MockSchemaRegistry} from '@angular/compiler/testing'; import {TEST_COMPILER_PROVIDERS} from '@angular/compiler/testing/test_bindings'; import {SchemaMetadata, SecurityContext, Type} from '@angular/core'; import {Console} from '@angular/core/src/console'; @@ -20,6 +19,7 @@ import {afterEach, beforeEach, beforeEachProviders, ddescribe, describe, expect, import {Identifiers, identifierToken, resolveIdentifierToken} from '../../src/identifiers'; import {DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig} from '../../src/ml_parser/interpolation_config'; +import {MockSchemaRegistry} from '../../testing/index'; import {unparse} from '../expression_parser/unparser'; var someModuleUrl = 'package:someModule'; diff --git a/modules/@angular/compiler/testing/directive_resolver_mock.ts b/modules/@angular/compiler/testing/directive_resolver_mock.ts index 1d8204a39a..f103d84f3f 100644 --- a/modules/@angular/compiler/testing/directive_resolver_mock.ts +++ b/modules/@angular/compiler/testing/directive_resolver_mock.ts @@ -5,13 +5,12 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ - +import {DirectiveResolver} from '@angular/compiler'; import {AnimationEntryMetadata, Compiler, ComponentMetadata, DirectiveMetadata, Injectable, Injector, Provider, Type, resolveForwardRef} from '@angular/core'; -import {ViewMetadata} from '../core_private'; -import {DirectiveResolver} from '../src/directive_resolver'; -import {Map} from '../src/facade/collection'; -import {isArray, isPresent} from '../src/facade/lang'; +import {Map} from './facade/collection'; +import {isArray, isPresent} from './facade/lang'; +import {ViewMetadata} from './private_import_core'; diff --git a/modules/@angular/compiler/testing/facade b/modules/@angular/compiler/testing/facade new file mode 120000 index 0000000000..e084c803c6 --- /dev/null +++ b/modules/@angular/compiler/testing/facade @@ -0,0 +1 @@ +../../facade/src \ No newline at end of file diff --git a/modules/@angular/compiler/testing.ts b/modules/@angular/compiler/testing/index.ts similarity index 82% rename from modules/@angular/compiler/testing.ts rename to modules/@angular/compiler/testing/index.ts index 236b6de5e1..ea151d9f2e 100644 --- a/modules/@angular/compiler/testing.ts +++ b/modules/@angular/compiler/testing/index.ts @@ -6,19 +6,34 @@ * found in the LICENSE file at https://angular.io/license */ -export * from './testing/schema_registry_mock'; -export * from './testing/directive_resolver_mock'; -export * from './testing/ng_module_resolver_mock'; -export * from './testing/pipe_resolver_mock'; +/** + * @module + * @description + * Entry point for all APIs of the compiler package. + * + *
+ *
Unstable APIs
+ *

+ * All compiler apis are currently considered experimental and private! + *

+ *

+ * We expect the APIs in this package to keep on changing. Do not rely on them. + *

+ *
+ */ +export * from './schema_registry_mock'; +export * from './directive_resolver_mock'; +export * from './ng_module_resolver_mock'; +export * from './pipe_resolver_mock'; import {createPlatformFactory, ModuleWithComponentFactories, Injectable, CompilerOptions, COMPILER_OPTIONS, CompilerFactory, ComponentFactory, NgModuleFactory, Injector, NgModuleMetadata, NgModuleMetadataType, ComponentMetadata, ComponentMetadataType, DirectiveMetadata, DirectiveMetadataType, PipeMetadata, PipeMetadataType, Type, PlatformRef} from '@angular/core'; import {MetadataOverride} from '@angular/core/testing'; -import {TestingCompilerFactory, TestingCompiler} from './core_private_testing'; -import {platformCoreDynamic, RuntimeCompiler, DirectiveResolver, NgModuleResolver, PipeResolver} from './index'; -import {MockDirectiveResolver} from './testing/directive_resolver_mock'; -import {MockNgModuleResolver} from './testing/ng_module_resolver_mock'; -import {MockPipeResolver} from './testing/pipe_resolver_mock'; -import {MetadataOverrider} from './testing/metadata_overrider'; +import {TestingCompilerFactory, TestingCompiler} from './private_import_core'; +import {platformCoreDynamic, RuntimeCompiler, DirectiveResolver, NgModuleResolver, PipeResolver} from '@angular/compiler'; +import {MockDirectiveResolver} from './directive_resolver_mock'; +import {MockNgModuleResolver} from './ng_module_resolver_mock'; +import {MockPipeResolver} from './pipe_resolver_mock'; +import {MetadataOverrider} from './metadata_overrider'; @Injectable() export class TestingCompilerFactoryImpl implements TestingCompilerFactory { diff --git a/modules/@angular/compiler/testing/metadata_overrider.ts b/modules/@angular/compiler/testing/metadata_overrider.ts index b6d90a9c30..f5c909da11 100644 --- a/modules/@angular/compiler/testing/metadata_overrider.ts +++ b/modules/@angular/compiler/testing/metadata_overrider.ts @@ -7,7 +7,7 @@ */ import {MetadataOverride} from '@angular/core/testing'; -import {stringify} from '../src/facade/lang'; +import {stringify} from './facade/lang'; type StringMap = { [key: string]: any diff --git a/modules/@angular/compiler/testing/ng_module_resolver_mock.ts b/modules/@angular/compiler/testing/ng_module_resolver_mock.ts index 4767630972..3a5f8d3a87 100644 --- a/modules/@angular/compiler/testing/ng_module_resolver_mock.ts +++ b/modules/@angular/compiler/testing/ng_module_resolver_mock.ts @@ -6,10 +6,10 @@ * found in the LICENSE file at https://angular.io/license */ +import {NgModuleResolver} from '@angular/compiler'; import {Compiler, Injectable, Injector, NgModuleMetadata, Type} from '@angular/core'; -import {NgModuleResolver} from '../index'; -import {Map} from '../src/facade/collection'; +import {Map} from './facade/collection'; @Injectable() export class MockNgModuleResolver extends NgModuleResolver { diff --git a/modules/@angular/compiler/testing/pipe_resolver_mock.ts b/modules/@angular/compiler/testing/pipe_resolver_mock.ts index 0588a60d9d..9e44f43f21 100644 --- a/modules/@angular/compiler/testing/pipe_resolver_mock.ts +++ b/modules/@angular/compiler/testing/pipe_resolver_mock.ts @@ -6,10 +6,10 @@ * found in the LICENSE file at https://angular.io/license */ +import {PipeResolver} from '@angular/compiler'; import {Compiler, Injectable, Injector, PipeMetadata, Type} from '@angular/core'; -import {PipeResolver} from '../index'; -import {Map} from '../src/facade/collection'; +import {Map} from './facade/collection'; @Injectable() export class MockPipeResolver extends PipeResolver { diff --git a/modules/@angular/compiler/testing/private_import_core.ts b/modules/@angular/compiler/testing/private_import_core.ts new file mode 100644 index 0000000000..186bd2c553 --- /dev/null +++ b/modules/@angular/compiler/testing/private_import_core.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + + +import {__core_private__ as r} from '@angular/core'; + +export type ViewMetadata = typeof r._ViewMetadata; +export var ViewMetadata: typeof r.ViewMetadata = r.ViewMetadata; + + + +import {__core_private_testing__ as r2} from '@angular/core/testing'; + +export type TestingCompiler = typeof r2._TestingCompiler; +export var TestingCompiler: typeof r2.TestingCompiler = r2.TestingCompiler; + +export type TestingCompilerFactory = typeof r2._TestingCompilerFactory; +export var TestingCompilerFactory: typeof r2.TestingCompilerFactory = r2.TestingCompilerFactory; diff --git a/modules/@angular/compiler/testing/resource_loader_mock.ts b/modules/@angular/compiler/testing/resource_loader_mock.ts index 60b1da4b85..419a6b9946 100644 --- a/modules/@angular/compiler/testing/resource_loader_mock.ts +++ b/modules/@angular/compiler/testing/resource_loader_mock.ts @@ -6,10 +6,10 @@ * found in the LICENSE file at https://angular.io/license */ +import {ResourceLoader} from '@angular/compiler'; +import {ListWrapper, Map} from './facade/collection'; +import {isBlank, normalizeBlank} from './facade/lang'; -import {ResourceLoader} from '../index'; -import {ListWrapper, Map} from '../src/facade/collection'; -import {isBlank, normalizeBlank} from '../src/facade/lang'; /** diff --git a/modules/@angular/compiler/testing/schema_registry_mock.ts b/modules/@angular/compiler/testing/schema_registry_mock.ts index 2f0210fc52..7d20e90887 100644 --- a/modules/@angular/compiler/testing/schema_registry_mock.ts +++ b/modules/@angular/compiler/testing/schema_registry_mock.ts @@ -6,10 +6,10 @@ * found in the LICENSE file at https://angular.io/license */ +import {ElementSchemaRegistry} from '@angular/compiler'; import {SchemaMetadata, SecurityContext} from '@angular/core'; -import {ElementSchemaRegistry} from '../index'; -import {isPresent} from '../src/facade/lang'; +import {isPresent} from './facade/lang'; export class MockSchemaRegistry implements ElementSchemaRegistry { constructor( diff --git a/modules/@angular/compiler/testing/test_bindings.ts b/modules/@angular/compiler/testing/test_bindings.ts index f87fd5327b..33b79ee2b9 100644 --- a/modules/@angular/compiler/testing/test_bindings.ts +++ b/modules/@angular/compiler/testing/test_bindings.ts @@ -7,11 +7,13 @@ */ import {ElementSchemaRegistry, ResourceLoader, UrlResolver} from '@angular/compiler'; -import {createUrlResolverWithoutPackagePrefix} from '@angular/compiler/src/url_resolver'; -import {MockSchemaRegistry} from '@angular/compiler/testing'; -import {MockResourceLoader} from '@angular/compiler/testing/resource_loader_mock'; import {Provider} from '@angular/core'; +import {MockResourceLoader} from './resource_loader_mock'; +import {MockSchemaRegistry} from './schema_registry_mock'; +export function createUrlResolverWithoutPackagePrefix(): UrlResolver { + return new UrlResolver(); +} // This provider is put here just so that we can access it from multiple // internal test packages. diff --git a/modules/@angular/compiler/tsconfig-es5.json b/modules/@angular/compiler/tsconfig-testing.json similarity index 75% rename from modules/@angular/compiler/tsconfig-es5.json rename to modules/@angular/compiler/tsconfig-testing.json index 2a9f278580..5ccab8de0d 100644 --- a/modules/@angular/compiler/tsconfig-es5.json +++ b/modules/@angular/compiler/tsconfig-testing.json @@ -4,22 +4,23 @@ "declaration": true, "stripInternal": true, "experimentalDecorators": true, - "module": "commonjs", + "module": "es2015", "moduleResolution": "node", "outDir": "../../../dist/packages-dist/compiler/", "paths": { "@angular/core": ["../../../dist/packages-dist/core"], - "@angular/core/testing": ["../../../dist/packages-dist/core/testing"] + "@angular/core/testing": ["../../../dist/packages-dist/core/testing"], + "@angular/compiler": ["../../../dist/packages-dist/compiler"] }, "rootDir": ".", "sourceMap": true, "inlineSources": true, "lib": ["es6", "dom"], - "target": "es5" + "target": "es5", + "skipLibCheck": true }, "files": [ - "index.ts", - "testing.ts", + "testing/index.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts" ] } diff --git a/modules/@angular/compiler/tsconfig-es2015.json b/modules/@angular/compiler/tsconfig.json similarity index 80% rename from modules/@angular/compiler/tsconfig-es2015.json rename to modules/@angular/compiler/tsconfig.json index c37d439b74..b8182ae6a4 100644 --- a/modules/@angular/compiler/tsconfig-es2015.json +++ b/modules/@angular/compiler/tsconfig.json @@ -7,7 +7,7 @@ "experimentalDecorators": true, "module": "es2015", "moduleResolution": "node", - "outDir": "../../../dist/packages-dist/compiler/esm", + "outDir": "../../../dist/packages-dist/compiler", "paths": { "@angular/core": ["../../../dist/packages-dist/core"], "@angular/core/testing": ["../../../dist/packages-dist/core/testing"] @@ -15,11 +15,12 @@ "rootDir": ".", "sourceMap": true, "inlineSources": true, - "target": "es2015" + "target": "es5", + "skipLibCheck": true, + "lib": ["es2015", "dom"] }, "files": [ "index.ts", - "testing.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts" ] } diff --git a/modules/@angular/core/index.ts b/modules/@angular/core/index.ts index 882f5dda6a..ede0762054 100644 --- a/modules/@angular/core/index.ts +++ b/modules/@angular/core/index.ts @@ -9,32 +9,8 @@ /** * @module * @description - * Entry point from which you should import all public core APIs. + * Entry point for all public APIs of the core package. */ -export * from './src/metadata'; -export * from './src/util'; -export * from './src/di'; -export {createPlatform, assertPlatform, destroyPlatform, getPlatform, PlatformRef, ApplicationRef, enableProdMode, isDevMode, createPlatformFactory} from './src/application_ref'; -export {APP_ID, PACKAGE_ROOT_URL, PLATFORM_INITIALIZER, APP_BOOTSTRAP_LISTENER} from './src/application_tokens'; -export {APP_INITIALIZER, ApplicationInitStatus} from './src/application_init'; -export * from './src/zone'; -export * from './src/render'; -export * from './src/linker'; -export {DebugElement, DebugNode, asNativeElements, getDebugNode} from './src/debug/debug_node'; -export {GetTestability, Testability, TestabilityRegistry, setTestabilityGetter} from './src/testability/testability'; -export * from './src/change_detection'; -export * from './src/platform_core_providers'; -export {TRANSLATIONS, TRANSLATIONS_FORMAT, LOCALE_ID} from './src/i18n/tokens'; -export {ApplicationModule} from './src/application_module'; -export {wtfCreateScope, wtfLeave, wtfStartTimeRange, wtfEndTimeRange, WtfScopeFn} from './src/profile/profile'; +export * from './src/core'; -export {Type} from './src/type'; -export {EventEmitter} from './src/facade/async'; -export {ErrorHandler} from './src/error_handler'; -export * from './private_export'; - -export * from './src/animation/metadata'; -export {AnimationTransitionEvent} from './src/animation/animation_transition_event'; -export {AnimationPlayer} from './src/animation/animation_player'; - -export {Sanitizer, SecurityContext} from './src/security'; +// This file only reexports content of the `src` folder. Keep it that way. diff --git a/modules/@angular/core/package.json b/modules/@angular/core/package.json index 21f9e8afb0..c29fdfdeba 100644 --- a/modules/@angular/core/package.json +++ b/modules/@angular/core/package.json @@ -1,15 +1,15 @@ { "name": "@angular/core", "version": "0.0.0-PLACEHOLDER", - "description": "", - "main": "index.js", - "jsnext:main": "esm/index.js", + "description": "Angular 2 core", + "main": "bundles/core.umd.js", + "module": "index.js", "typings": "index.d.ts", "author": "angular", "license": "MIT", "peerDependencies": { "rxjs": "5.0.0-beta.11", - "zone.js": "^0.6.6" + "zone.js": "^0.6.17" }, "repository": { "type": "git", diff --git a/modules/@angular/core/private_export.ts b/modules/@angular/core/private_export.ts deleted file mode 100644 index db844f5edc..0000000000 --- a/modules/@angular/core/private_export.ts +++ /dev/null @@ -1,184 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {ANY_STATE as ANY_STATE_, DEFAULT_STATE as DEFAULT_STATE_, EMPTY_STATE as EMPTY_STATE_, FILL_STYLE_FLAG as FILL_STYLE_FLAG_} from './src/animation/animation_constants'; -import {AnimationGroupPlayer as AnimationGroupPlayer_} from './src/animation/animation_group_player'; -import {AnimationKeyframe as AnimationKeyframe_} from './src/animation/animation_keyframe'; -import {AnimationOutput as AnimationOutput_} from './src/animation/animation_output'; -import {AnimationPlayer as AnimationPlayer_, NoOpAnimationPlayer as NoOpAnimationPlayer_} from './src/animation/animation_player'; -import {AnimationSequencePlayer as AnimationSequencePlayer_} from './src/animation/animation_sequence_player'; -import * as animationUtils from './src/animation/animation_style_util'; -import {AnimationStyles as AnimationStyles_} from './src/animation/animation_styles'; -import * as change_detection_util from './src/change_detection/change_detection_util'; -import * as constants from './src/change_detection/constants'; -import * as console from './src/console'; -import * as debug from './src/debug/debug_renderer'; -import * as provider from './src/di/provider'; -import * as reflective_provider from './src/di/reflective_provider'; -import {ComponentStillLoadingError} from './src/linker/compiler'; -import * as component_factory_resolver from './src/linker/component_factory_resolver'; -import * as debug_context from './src/linker/debug_context'; -import * as element from './src/linker/element'; -import * as ng_module_factory from './src/linker/ng_module_factory'; -import * as template_ref from './src/linker/template_ref'; -import * as view from './src/linker/view'; -import * as view_type from './src/linker/view_type'; -import * as view_utils from './src/linker/view_utils'; -import * as lifecycle_hooks from './src/metadata/lifecycle_hooks'; -import * as metadata_view from './src/metadata/view'; -import * as wtf_init from './src/profile/wtf_init'; -import * as reflection from './src/reflection/reflection'; -// We need to import this name separately from the above wildcard, because this symbol is exposed. -import {Reflector} from './src/reflection/reflection'; // tslint:disable-line -import * as reflection_capabilities from './src/reflection/reflection_capabilities'; -import * as reflector_reader from './src/reflection/reflector_reader'; -import * as api from './src/render/api'; -import * as security from './src/security'; -import * as decorators from './src/util/decorators'; - - -// These generic types can't be exported within the __core_private_types__ -// interface because the generic type info will be lost. So just exporting -// them separately. -export type __core_private_DebugAppView__ = view.DebugAppView; -export type __core_private_TemplateRef__ = template_ref.TemplateRef_; - -export interface __core_private_types__ { - isDefaultChangeDetectionStrategy: typeof constants.isDefaultChangeDetectionStrategy; - ChangeDetectorStatus: constants.ChangeDetectorStatus; - CHANGE_DETECTION_STRATEGY_VALUES: typeof constants.CHANGE_DETECTION_STRATEGY_VALUES; - constructDependencies: typeof reflective_provider.constructDependencies; - LifecycleHooks: lifecycle_hooks.LifecycleHooks; - LIFECYCLE_HOOKS_VALUES: typeof lifecycle_hooks.LIFECYCLE_HOOKS_VALUES; - ReflectorReader: reflector_reader.ReflectorReader; - CodegenComponentFactoryResolver: - typeof component_factory_resolver.CodegenComponentFactoryResolver; - AppElement: element.AppElement; - AppView: typeof view.AppView; - NgModuleInjector: typeof ng_module_factory.NgModuleInjector; - ViewType: view_type.ViewType; - MAX_INTERPOLATION_VALUES: typeof view_utils.MAX_INTERPOLATION_VALUES; - checkBinding: typeof view_utils.checkBinding; - flattenNestedViewRenderNodes: typeof view_utils.flattenNestedViewRenderNodes; - interpolate: typeof view_utils.interpolate; - ViewUtils: typeof view_utils.ViewUtils; - VIEW_ENCAPSULATION_VALUES: typeof metadata_view.VIEW_ENCAPSULATION_VALUES; - ViewMetadata: metadata_view.ViewMetadata; - DebugContext: typeof debug_context.DebugContext; - StaticNodeDebugInfo: typeof debug_context.StaticNodeDebugInfo; - devModeEqual: typeof change_detection_util.devModeEqual; - UNINITIALIZED: typeof change_detection_util.UNINITIALIZED; - ValueUnwrapper: typeof change_detection_util.ValueUnwrapper; - RenderDebugInfo: api.RenderDebugInfo; - wtfInit: typeof wtf_init.wtfInit; - ReflectionCapabilities: reflection_capabilities.ReflectionCapabilities; - makeDecorator: typeof decorators.makeDecorator; - DebugDomRootRenderer: debug.DebugDomRootRenderer; - EMPTY_ARRAY: typeof view_utils.EMPTY_ARRAY; - EMPTY_MAP: typeof view_utils.EMPTY_MAP; - pureProxy1: typeof view_utils.pureProxy1; - pureProxy2: typeof view_utils.pureProxy2; - pureProxy3: typeof view_utils.pureProxy3; - pureProxy4: typeof view_utils.pureProxy4; - pureProxy5: typeof view_utils.pureProxy5; - pureProxy6: typeof view_utils.pureProxy6; - pureProxy7: typeof view_utils.pureProxy7; - pureProxy8: typeof view_utils.pureProxy8; - pureProxy9: typeof view_utils.pureProxy9; - pureProxy10: typeof view_utils.pureProxy10; - castByValue: typeof view_utils.castByValue; - Console: console.Console; - reflector: typeof reflection.reflector; - Reflector: reflection.Reflector; - NoOpAnimationPlayer: NoOpAnimationPlayer_; - AnimationPlayer: AnimationPlayer_; - AnimationSequencePlayer: AnimationSequencePlayer_; - AnimationGroupPlayer: AnimationGroupPlayer_; - AnimationKeyframe: AnimationKeyframe_; - prepareFinalAnimationStyles: typeof animationUtils.prepareFinalAnimationStyles; - balanceAnimationKeyframes: typeof animationUtils.balanceAnimationKeyframes; - flattenStyles: typeof animationUtils.flattenStyles; - clearStyles: typeof animationUtils.clearStyles; - renderStyles: typeof animationUtils.renderStyles; - collectAndResolveStyles: typeof animationUtils.collectAndResolveStyles; - AnimationStyles: AnimationStyles_; - AnimationOutput: AnimationOutput_; - ANY_STATE: typeof ANY_STATE_; - DEFAULT_STATE: typeof DEFAULT_STATE_; - EMPTY_STATE: typeof EMPTY_STATE_; - FILL_STYLE_FLAG: typeof FILL_STYLE_FLAG_; - ComponentStillLoadingError: typeof ComponentStillLoadingError; -} - -export var __core_private__ = { - isDefaultChangeDetectionStrategy: constants.isDefaultChangeDetectionStrategy, - ChangeDetectorStatus: constants.ChangeDetectorStatus, - CHANGE_DETECTION_STRATEGY_VALUES: constants.CHANGE_DETECTION_STRATEGY_VALUES, - constructDependencies: reflective_provider.constructDependencies, - LifecycleHooks: lifecycle_hooks.LifecycleHooks, - LIFECYCLE_HOOKS_VALUES: lifecycle_hooks.LIFECYCLE_HOOKS_VALUES, - ReflectorReader: reflector_reader.ReflectorReader, - CodegenComponentFactoryResolver: component_factory_resolver.CodegenComponentFactoryResolver, - AppElement: element.AppElement, - AppView: view.AppView, - DebugAppView: view.DebugAppView, - NgModuleInjector: ng_module_factory.NgModuleInjector, - ViewType: view_type.ViewType, - MAX_INTERPOLATION_VALUES: view_utils.MAX_INTERPOLATION_VALUES, - checkBinding: view_utils.checkBinding, - flattenNestedViewRenderNodes: view_utils.flattenNestedViewRenderNodes, - interpolate: view_utils.interpolate, - ViewUtils: view_utils.ViewUtils, - VIEW_ENCAPSULATION_VALUES: metadata_view.VIEW_ENCAPSULATION_VALUES, - ViewMetadata: metadata_view.ViewMetadata, - DebugContext: debug_context.DebugContext, - StaticNodeDebugInfo: debug_context.StaticNodeDebugInfo, - devModeEqual: change_detection_util.devModeEqual, - UNINITIALIZED: change_detection_util.UNINITIALIZED, - ValueUnwrapper: change_detection_util.ValueUnwrapper, - RenderDebugInfo: api.RenderDebugInfo, - TemplateRef_: template_ref.TemplateRef_, - wtfInit: wtf_init.wtfInit, - ReflectionCapabilities: reflection_capabilities.ReflectionCapabilities, - makeDecorator: decorators.makeDecorator, - DebugDomRootRenderer: debug.DebugDomRootRenderer, - EMPTY_ARRAY: view_utils.EMPTY_ARRAY, - EMPTY_MAP: view_utils.EMPTY_MAP, - pureProxy1: view_utils.pureProxy1, - pureProxy2: view_utils.pureProxy2, - pureProxy3: view_utils.pureProxy3, - pureProxy4: view_utils.pureProxy4, - pureProxy5: view_utils.pureProxy5, - pureProxy6: view_utils.pureProxy6, - pureProxy7: view_utils.pureProxy7, - pureProxy8: view_utils.pureProxy8, - pureProxy9: view_utils.pureProxy9, - pureProxy10: view_utils.pureProxy10, - castByValue: view_utils.castByValue, - Console: console.Console, - reflector: reflection.reflector, - Reflector: reflection.Reflector, - NoOpAnimationPlayer: NoOpAnimationPlayer_, - AnimationPlayer: AnimationPlayer_, - AnimationSequencePlayer: AnimationSequencePlayer_, - AnimationGroupPlayer: AnimationGroupPlayer_, - AnimationKeyframe: AnimationKeyframe_, - prepareFinalAnimationStyles: animationUtils.prepareFinalAnimationStyles, - balanceAnimationKeyframes: animationUtils.balanceAnimationKeyframes, - flattenStyles: animationUtils.flattenStyles, - clearStyles: animationUtils.clearStyles, - renderStyles: animationUtils.renderStyles, - collectAndResolveStyles: animationUtils.collectAndResolveStyles, - AnimationStyles: AnimationStyles_, - AnimationOutput: AnimationOutput_, - ANY_STATE: ANY_STATE_, - DEFAULT_STATE: DEFAULT_STATE_, - EMPTY_STATE: EMPTY_STATE_, - FILL_STYLE_FLAG: FILL_STYLE_FLAG_, - ComponentStillLoadingError: ComponentStillLoadingError -}; diff --git a/modules/@angular/core/private_export_testing.ts b/modules/@angular/core/private_export_testing.ts deleted file mode 100644 index 31990693d8..0000000000 --- a/modules/@angular/core/private_export_testing.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import * as test_compiler from './testing/test_compiler'; - -export interface __core_private_testing_types__ { - TestingCompiler: test_compiler.TestingCompiler; - TestingCompilerFactory: test_compiler.TestingCompilerFactory; -} - -export var __core_private_testing__ = { - TestingCompiler: test_compiler.TestingCompiler, - TestingCompilerFactory: test_compiler.TestingCompilerFactory, -}; diff --git a/modules/@angular/core/rollup-testing.config.js b/modules/@angular/core/rollup-testing.config.js new file mode 100644 index 0000000000..33ddb63e8f --- /dev/null +++ b/modules/@angular/core/rollup-testing.config.js @@ -0,0 +1,15 @@ + +export default { + entry: '../../../dist/packages-dist/core/testing/index.js', + dest: '../../../dist/packages-dist/core/bundles/core-testing.umd.js', + format: 'umd', + moduleName: 'ng.core.testing', + globals: { + '@angular/core': 'ng.core', + 'rxjs/Subject': 'Rx', + 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. + 'rxjs/operator/toPromise': 'Rx.Observable.prototype', + 'rxjs/Observable': 'Rx' + } +} + diff --git a/modules/@angular/core/rollup.config.js b/modules/@angular/core/rollup.config.js index 89e8bf9408..745d563672 100644 --- a/modules/@angular/core/rollup.config.js +++ b/modules/@angular/core/rollup.config.js @@ -1,7 +1,7 @@ export default { - entry: '../../../dist/packages-dist/core/esm/index.js', - dest: '../../../dist/packages-dist/core/esm/core.umd.js', + entry: '../../../dist/packages-dist/core/index.js', + dest: '../../../dist/packages-dist/core/bundles/core.umd.js', format: 'umd', moduleName: 'ng.core', globals: { @@ -9,9 +9,6 @@ export default { 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. 'rxjs/operator/toPromise': 'Rx.Observable.prototype', 'rxjs/Observable': 'Rx' - }, - plugins: [ -// nodeResolve({ jsnext: true, main: true }), - ] + } } diff --git a/modules/@angular/core/src/application_ref.ts b/modules/@angular/core/src/application_ref.ts index 30473a2e4e..5fd20a7fb9 100644 --- a/modules/@angular/core/src/application_ref.ts +++ b/modules/@angular/core/src/application_ref.ts @@ -76,21 +76,14 @@ export function createPlatform(injector: Injector): PlatformRef { return _platform; } -/** - * Factory for a platform. - * - * @experimental - */ -export type PlatformFactory = (extraProviders?: Provider[]) => PlatformRef; - /** * Creates a factory for a platform * * @experimental APIs related to application bootstrap are currently under review. */ export function createPlatformFactory( - parentPlaformFactory: PlatformFactory, name: string, - providers: Provider[] = []): PlatformFactory { + parentPlaformFactory: (extraProviders?: Provider[]) => PlatformRef, name: string, + providers: Provider[] = []): (extraProviders?: Provider[]) => PlatformRef { const marker = new OpaqueToken(`Platform: ${name}`); return (extraProviders: Provider[] = []) => { if (!getPlatform()) { @@ -221,7 +214,7 @@ export abstract class PlatformRef { get destroyed(): boolean { throw unimplemented(); } } -function _callAndReportToExceptionHandler(errorHandler: ErrorHandler, callback: () => any): any { +function _callAndReportToErrorHandler(errorHandler: ErrorHandler, callback: () => any): any { try { const result = callback(); if (isPromise(result)) { @@ -283,11 +276,11 @@ export class PlatformRef_ extends PlatformRef { const moduleRef = >moduleFactory.create(ngZoneInjector); const exceptionHandler: ErrorHandler = moduleRef.injector.get(ErrorHandler, null); if (!exceptionHandler) { - throw new Error('No ExceptionHandler. Is platform module (BrowserModule) included?'); + throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?'); } moduleRef.onDestroy(() => ListWrapper.remove(this._modules, moduleRef)); ngZone.onError.subscribe({next: (error: any) => { exceptionHandler.handleError(error); }}); - return _callAndReportToExceptionHandler(exceptionHandler, () => { + return _callAndReportToErrorHandler(exceptionHandler, () => { const initStatus: ApplicationInitStatus = moduleRef.injector.get(ApplicationInitStatus); return initStatus.donePromise.then(() => { this._moduleDoBootstrap(moduleRef); diff --git a/modules/@angular/core/src/core.ts b/modules/@angular/core/src/core.ts new file mode 100644 index 0000000000..2c618cf471 --- /dev/null +++ b/modules/@angular/core/src/core.ts @@ -0,0 +1,37 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +/** + * @module + * @description + * Entry point from which you should import all public core APIs. + */ +export * from './metadata'; +export * from './util'; +export * from './di'; +export {createPlatform, assertPlatform, destroyPlatform, getPlatform, PlatformRef, ApplicationRef, enableProdMode, isDevMode, createPlatformFactory} from './application_ref'; +export {APP_ID, PACKAGE_ROOT_URL, PLATFORM_INITIALIZER, APP_BOOTSTRAP_LISTENER} from './application_tokens'; +export {APP_INITIALIZER, ApplicationInitStatus} from './application_init'; +export * from './zone'; +export * from './render'; +export * from './linker'; +export {DebugElement, DebugNode, asNativeElements, getDebugNode} from './debug/debug_node'; +export {GetTestability, Testability, TestabilityRegistry, setTestabilityGetter} from './testability/testability'; +export * from './change_detection'; +export * from './platform_core_providers'; +export {TRANSLATIONS, TRANSLATIONS_FORMAT, LOCALE_ID} from './i18n/tokens'; +export {ApplicationModule} from './application_module'; +export {wtfCreateScope, wtfLeave, wtfStartTimeRange, wtfEndTimeRange, WtfScopeFn} from './profile/profile'; +export {Type} from './type'; +export {EventEmitter} from './facade/async'; +export {ErrorHandler} from './error_handler'; +export * from './core_private_export'; +export * from './animation/metadata'; +export {AnimationTransitionEvent} from './animation/animation_transition_event'; +export {AnimationPlayer} from './animation/animation_player'; +export {Sanitizer, SecurityContext} from './security'; diff --git a/modules/@angular/core/src/core_private_export.ts b/modules/@angular/core/src/core_private_export.ts new file mode 100644 index 0000000000..bc491b6350 --- /dev/null +++ b/modules/@angular/core/src/core_private_export.ts @@ -0,0 +1,186 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {ANY_STATE as ANY_STATE_, DEFAULT_STATE as DEFAULT_STATE_, EMPTY_STATE as EMPTY_STATE_, FILL_STYLE_FLAG as FILL_STYLE_FLAG_} from './animation/animation_constants'; +import {AnimationGroupPlayer as AnimationGroupPlayer_} from './animation/animation_group_player'; +import {AnimationKeyframe as AnimationKeyframe_} from './animation/animation_keyframe'; +import {AnimationOutput as AnimationOutput_} from './animation/animation_output'; +import {AnimationPlayer as AnimationPlayer_, NoOpAnimationPlayer as NoOpAnimationPlayer_} from './animation/animation_player'; +import {AnimationSequencePlayer as AnimationSequencePlayer_} from './animation/animation_sequence_player'; +import * as animationUtils from './animation/animation_style_util'; +import {AnimationStyles as AnimationStyles_} from './animation/animation_styles'; +import * as change_detection_util from './change_detection/change_detection_util'; +import * as constants from './change_detection/constants'; +import * as console from './console'; +import * as debug from './debug/debug_renderer'; +import * as reflective_provider from './di/reflective_provider'; +import {ComponentStillLoadingError} from './linker/compiler'; +import * as component_factory_resolver from './linker/component_factory_resolver'; +import * as debug_context from './linker/debug_context'; +import * as element from './linker/element'; +import * as ng_module_factory from './linker/ng_module_factory'; +import * as template_ref from './linker/template_ref'; +import * as view from './linker/view'; +import * as view_type from './linker/view_type'; +import * as view_utils from './linker/view_utils'; +import * as lifecycle_hooks from './metadata/lifecycle_hooks'; +import * as metadata_view from './metadata/view'; +import * as reflection from './reflection/reflection'; +// We need to import this name separately from the above wildcard, because this symbol is exposed. +import {Reflector} from './reflection/reflection'; // tslint:disable-line +import * as reflection_capabilities from './reflection/reflection_capabilities'; +import * as reflector_reader from './reflection/reflector_reader'; +import * as reflection_types from './reflection/types'; +import * as api from './render/api'; +import * as decorators from './util/decorators'; + +export var __core_private__: { + isDefaultChangeDetectionStrategy: typeof constants.isDefaultChangeDetectionStrategy, + ChangeDetectorStatus: typeof constants.ChangeDetectorStatus, + _ChangeDetectorStatus?: constants.ChangeDetectorStatus, + CHANGE_DETECTION_STRATEGY_VALUES: typeof constants.CHANGE_DETECTION_STRATEGY_VALUES, + constructDependencies: typeof reflective_provider.constructDependencies, + LifecycleHooks: typeof lifecycle_hooks.LifecycleHooks, + _LifecycleHooks?: lifecycle_hooks.LifecycleHooks, + LIFECYCLE_HOOKS_VALUES: typeof lifecycle_hooks.LIFECYCLE_HOOKS_VALUES, + ReflectorReader: typeof reflector_reader.ReflectorReader, + _ReflectorReader?: reflector_reader.ReflectorReader, + _SetterFn?: reflection_types.SetterFn; + _GetterFn?: reflection_types.GetterFn; + _MethodFn?: reflection_types.MethodFn; + CodegenComponentFactoryResolver: + typeof component_factory_resolver.CodegenComponentFactoryResolver, + _CodegenComponentFactoryResolver?: component_factory_resolver.CodegenComponentFactoryResolver, + AppElement: typeof element.AppElement, _AppElement?: element.AppElement, + AppView: typeof view.AppView, _AppView?: view.AppView, + DebugAppView: typeof view.DebugAppView, _DebugAppView?: view.DebugAppView, + NgModuleInjector: typeof ng_module_factory.NgModuleInjector, + _NgModuleInjector?: ng_module_factory.NgModuleInjector, + ViewType: typeof view_type.ViewType, _ViewType?: view_type.ViewType, + MAX_INTERPOLATION_VALUES: typeof view_utils.MAX_INTERPOLATION_VALUES, + checkBinding: typeof view_utils.checkBinding, + flattenNestedViewRenderNodes: typeof view_utils.flattenNestedViewRenderNodes, + interpolate: typeof view_utils.interpolate, + ViewUtils: typeof view_utils.ViewUtils, _ViewUtils?: view_utils.ViewUtils, + VIEW_ENCAPSULATION_VALUES: typeof metadata_view.VIEW_ENCAPSULATION_VALUES, + ViewMetadata: typeof metadata_view.ViewMetadata, _ViewMetadata?: metadata_view.ViewMetadata, + DebugContext: typeof debug_context.DebugContext, _DebugContext?: debug_context.DebugContext, + StaticNodeDebugInfo: typeof debug_context.StaticNodeDebugInfo, + _StaticNodeDebugInfo?: debug_context.StaticNodeDebugInfo, + devModeEqual: typeof change_detection_util.devModeEqual, + UNINITIALIZED: typeof change_detection_util.UNINITIALIZED, + ValueUnwrapper: typeof change_detection_util.ValueUnwrapper, + _ValueUnwrapper?: change_detection_util.ValueUnwrapper, + RenderDebugInfo: typeof api.RenderDebugInfo, _RenderDebugInfo?: api.RenderDebugInfo, + TemplateRef_: typeof template_ref.TemplateRef_, _TemplateRef_?: template_ref.TemplateRef_, + ReflectionCapabilities: typeof reflection_capabilities.ReflectionCapabilities, + _ReflectionCapabilities?: reflection_capabilities.ReflectionCapabilities, + makeDecorator: typeof decorators.makeDecorator, + DebugDomRootRenderer: typeof debug.DebugDomRootRenderer, + _DebugDomRootRenderer?: debug.DebugDomRootRenderer, + EMPTY_ARRAY: typeof view_utils.EMPTY_ARRAY, + EMPTY_MAP: typeof view_utils.EMPTY_MAP, + pureProxy1: typeof view_utils.pureProxy1, + pureProxy2: typeof view_utils.pureProxy2, + pureProxy3: typeof view_utils.pureProxy3, + pureProxy4: typeof view_utils.pureProxy4, + pureProxy5: typeof view_utils.pureProxy5, + pureProxy6: typeof view_utils.pureProxy6, + pureProxy7: typeof view_utils.pureProxy7, + pureProxy8: typeof view_utils.pureProxy8, + pureProxy9: typeof view_utils.pureProxy9, + pureProxy10: typeof view_utils.pureProxy10, + castByValue: typeof view_utils.castByValue, + Console: typeof console.Console, _Console?: console.Console, + reflector: typeof reflection.reflector, + Reflector: typeof reflection.Reflector, _Reflector?: reflection.Reflector, + NoOpAnimationPlayer: typeof NoOpAnimationPlayer_, _NoOpAnimationPlayer?: NoOpAnimationPlayer_, + AnimationPlayer: typeof AnimationPlayer_, _AnimationPlayer?: AnimationPlayer_, + AnimationSequencePlayer: typeof AnimationSequencePlayer_, + _AnimationSequencePlayer?: AnimationSequencePlayer_, + AnimationGroupPlayer: typeof AnimationGroupPlayer_, _AnimationGroupPlayer?: AnimationGroupPlayer_, + AnimationKeyframe: typeof AnimationKeyframe_, _AnimationKeyframe?: AnimationKeyframe_, + prepareFinalAnimationStyles: typeof animationUtils.prepareFinalAnimationStyles, + balanceAnimationKeyframes: typeof animationUtils.balanceAnimationKeyframes, + flattenStyles: typeof animationUtils.flattenStyles, + clearStyles: typeof animationUtils.clearStyles, + renderStyles: typeof animationUtils.renderStyles, + collectAndResolveStyles: typeof animationUtils.collectAndResolveStyles, + AnimationStyles: typeof AnimationStyles_, _AnimationStyles?: AnimationStyles_, + AnimationOutput: typeof AnimationOutput_, _AnimationOutput?: AnimationOutput_, + ANY_STATE: typeof ANY_STATE_, + DEFAULT_STATE: typeof DEFAULT_STATE_, + EMPTY_STATE: typeof EMPTY_STATE_, + FILL_STYLE_FLAG: typeof FILL_STYLE_FLAG_, _ComponentStillLoadingError?: ComponentStillLoadingError + ComponentStillLoadingError: typeof ComponentStillLoadingError + } = { + isDefaultChangeDetectionStrategy: constants.isDefaultChangeDetectionStrategy, + ChangeDetectorStatus: constants.ChangeDetectorStatus, + CHANGE_DETECTION_STRATEGY_VALUES: constants.CHANGE_DETECTION_STRATEGY_VALUES, + constructDependencies: reflective_provider.constructDependencies, + LifecycleHooks: lifecycle_hooks.LifecycleHooks, + LIFECYCLE_HOOKS_VALUES: lifecycle_hooks.LIFECYCLE_HOOKS_VALUES, + ReflectorReader: reflector_reader.ReflectorReader, + CodegenComponentFactoryResolver: component_factory_resolver.CodegenComponentFactoryResolver, + AppElement: element.AppElement, + AppView: view.AppView, + DebugAppView: view.DebugAppView, + NgModuleInjector: ng_module_factory.NgModuleInjector, + ViewType: view_type.ViewType, + MAX_INTERPOLATION_VALUES: view_utils.MAX_INTERPOLATION_VALUES, + checkBinding: view_utils.checkBinding, + flattenNestedViewRenderNodes: view_utils.flattenNestedViewRenderNodes, + interpolate: view_utils.interpolate, + ViewUtils: view_utils.ViewUtils, + VIEW_ENCAPSULATION_VALUES: metadata_view.VIEW_ENCAPSULATION_VALUES, + ViewMetadata: metadata_view.ViewMetadata, + DebugContext: debug_context.DebugContext, + StaticNodeDebugInfo: debug_context.StaticNodeDebugInfo, + devModeEqual: change_detection_util.devModeEqual, + UNINITIALIZED: change_detection_util.UNINITIALIZED, + ValueUnwrapper: change_detection_util.ValueUnwrapper, + RenderDebugInfo: api.RenderDebugInfo, + TemplateRef_: template_ref.TemplateRef_, + ReflectionCapabilities: reflection_capabilities.ReflectionCapabilities, + makeDecorator: decorators.makeDecorator, + DebugDomRootRenderer: debug.DebugDomRootRenderer, + EMPTY_ARRAY: view_utils.EMPTY_ARRAY, + EMPTY_MAP: view_utils.EMPTY_MAP, + pureProxy1: view_utils.pureProxy1, + pureProxy2: view_utils.pureProxy2, + pureProxy3: view_utils.pureProxy3, + pureProxy4: view_utils.pureProxy4, + pureProxy5: view_utils.pureProxy5, + pureProxy6: view_utils.pureProxy6, + pureProxy7: view_utils.pureProxy7, + pureProxy8: view_utils.pureProxy8, + pureProxy9: view_utils.pureProxy9, + pureProxy10: view_utils.pureProxy10, + castByValue: view_utils.castByValue, + Console: console.Console, + reflector: reflection.reflector, + Reflector: reflection.Reflector, + NoOpAnimationPlayer: NoOpAnimationPlayer_, + AnimationPlayer: AnimationPlayer_, + AnimationSequencePlayer: AnimationSequencePlayer_, + AnimationGroupPlayer: AnimationGroupPlayer_, + AnimationKeyframe: AnimationKeyframe_, + prepareFinalAnimationStyles: animationUtils.prepareFinalAnimationStyles, + balanceAnimationKeyframes: animationUtils.balanceAnimationKeyframes, + flattenStyles: animationUtils.flattenStyles, + clearStyles: animationUtils.clearStyles, + renderStyles: animationUtils.renderStyles, + collectAndResolveStyles: animationUtils.collectAndResolveStyles, + AnimationStyles: AnimationStyles_, + AnimationOutput: AnimationOutput_, + ANY_STATE: ANY_STATE_, + DEFAULT_STATE: DEFAULT_STATE_, + EMPTY_STATE: EMPTY_STATE_, + FILL_STYLE_FLAG: FILL_STYLE_FLAG_, + ComponentStillLoadingError: ComponentStillLoadingError +}; diff --git a/modules/@angular/core/src/error_handler.ts b/modules/@angular/core/src/error_handler.ts index e723065445..f9c3228d92 100644 --- a/modules/@angular/core/src/error_handler.ts +++ b/modules/@angular/core/src/error_handler.ts @@ -19,7 +19,7 @@ import {WrappedError} from './facade/errors'; * * ```javascript * - * class MyExceptionHandler implements ErrorHandler { + * class MyErrorHandler implements ErrorHandler { * call(error, stackTrace = null, reason = null) { * // do something with the exception * } diff --git a/modules/@angular/core/test/application_ref_spec.ts b/modules/@angular/core/test/application_ref_spec.ts index bdee2aa41c..29253647a4 100644 --- a/modules/@angular/core/test/application_ref_spec.ts +++ b/modules/@angular/core/test/application_ref_spec.ts @@ -176,7 +176,7 @@ export function main() { return defaultPlatform.bootstrapModule(EmptyModule) .then(() => fail('expecting error'), (error) => { expect(error.message) - .toEqual('No ExceptionHandler. Is platform module (BrowserModule) included?'); + .toEqual('No ErrorHandler. Is platform module (BrowserModule) included?'); }); })); diff --git a/modules/@angular/core/test/linker/change_detection_integration_spec.ts b/modules/@angular/core/test/linker/change_detection_integration_spec.ts index c8fb952d67..f5e7ec8519 100644 --- a/modules/@angular/core/test/linker/change_detection_integration_spec.ts +++ b/modules/@angular/core/test/linker/change_detection_integration_spec.ts @@ -7,7 +7,6 @@ */ import {ElementSchemaRegistry} from '@angular/compiler/src/schema/element_schema_registry'; -import {MockSchemaRegistry} from '@angular/compiler/testing'; import {TEST_COMPILER_PROVIDERS} from '@angular/compiler/testing/test_bindings'; import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ComponentMetadata, DebugElement, Directive, DoCheck, Injectable, Input, OnChanges, OnDestroy, OnInit, Output, Pipe, PipeTransform, RenderComponentType, Renderer, RootRenderer, SimpleChange, SimpleChanges, TemplateRef, Type, ViewContainerRef, WrappedValue, forwardRef} from '@angular/core'; import {DebugDomRenderer} from '@angular/core/src/debug/debug_renderer'; @@ -16,6 +15,7 @@ import {By} from '@angular/platform-browser/src/dom/debug/by'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {DomRootRenderer} from '@angular/platform-browser/src/dom/dom_renderer'; +import {MockSchemaRegistry} from '../../../compiler/testing/index'; import {EventEmitter} from '../../src/facade/async'; import {StringMapWrapper} from '../../src/facade/collection'; import {NumberWrapper, isBlank} from '../../src/facade/lang'; diff --git a/modules/@angular/core/testing.ts b/modules/@angular/core/testing.ts deleted file mode 100644 index d094d8fbc4..0000000000 --- a/modules/@angular/core/testing.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -export * from './testing/async'; -export * from './testing/component_fixture'; -export * from './testing/fake_async'; -export * from './testing/test_bed'; -export * from './testing/testing'; -export * from './testing/metadata_override'; - -export * from './private_export_testing'; diff --git a/modules/@angular/core/testing/component_fixture.ts b/modules/@angular/core/testing/component_fixture.ts index 4af17ad703..49df10bb0b 100644 --- a/modules/@angular/core/testing/component_fixture.ts +++ b/modules/@angular/core/testing/component_fixture.ts @@ -6,10 +6,8 @@ * found in the LICENSE file at https://angular.io/license */ -import {ChangeDetectorRef, ComponentRef, DebugElement, ElementRef, NgZone, getDebugNode} from '../index'; -import {scheduleMicroTask} from '../src/facade/lang'; - -import {tick} from './fake_async'; +import {ChangeDetectorRef, ComponentRef, DebugElement, ElementRef, NgZone, getDebugNode} from '@angular/core'; +import {scheduleMicroTask} from './facade/lang'; /** diff --git a/modules/@angular/core/testing/facade b/modules/@angular/core/testing/facade new file mode 120000 index 0000000000..e084c803c6 --- /dev/null +++ b/modules/@angular/core/testing/facade @@ -0,0 +1 @@ +../../facade/src \ No newline at end of file diff --git a/modules/@angular/core/testing/fake_async.ts b/modules/@angular/core/testing/fake_async.ts index 673e6f3d80..09dd7e62c1 100644 --- a/modules/@angular/core/testing/fake_async.ts +++ b/modules/@angular/core/testing/fake_async.ts @@ -7,7 +7,6 @@ */ - const FakeAsyncTestZoneSpec = (Zone as any)['FakeAsyncTestZoneSpec']; type ProxyZoneSpec = { setDelegate(delegateSpec: ZoneSpec): void; getDelegate(): ZoneSpec; resetDelegate(): void; @@ -87,6 +86,7 @@ export function fakeAsync(fn: Function): (...args: any[]) => any { return res; } finally { _inFakeAsyncCall = false; + resetFakeAsyncZone(); } }; } diff --git a/modules/@angular/core/testing/index.ts b/modules/@angular/core/testing/index.ts index 93ac9caddc..f913cb0202 100644 --- a/modules/@angular/core/testing/index.ts +++ b/modules/@angular/core/testing/index.ts @@ -6,11 +6,16 @@ * found in the LICENSE file at https://angular.io/license */ +/** + * @module + * @description + * Entry point for all public APIs of the core/testing package. + */ + export * from './async'; export * from './component_fixture'; export * from './fake_async'; export * from './test_bed'; export * from './testing'; export * from './metadata_override'; - -export * from '../private_export_testing'; +export * from './private_export_testing'; diff --git a/modules/@angular/core/testing/logger.ts b/modules/@angular/core/testing/logger.ts index 2674a4c866..a0d3b9c58a 100644 --- a/modules/@angular/core/testing/logger.ts +++ b/modules/@angular/core/testing/logger.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Injectable} from '../index'; +import {Injectable} from '@angular/core'; @Injectable() export class Log { diff --git a/modules/@angular/core/testing/mock_animation_player.ts b/modules/@angular/core/testing/mock_animation_player.ts index 2e7e51f334..65b1bff4ce 100644 --- a/modules/@angular/core/testing/mock_animation_player.ts +++ b/modules/@angular/core/testing/mock_animation_player.ts @@ -6,8 +6,8 @@ * found in the LICENSE file at https://angular.io/license */ -import {AnimationPlayer} from '../src/animation/animation_player'; -import {isPresent} from '../src/facade/lang'; +import {AnimationPlayer} from '@angular/core'; +import {isPresent} from './facade/lang'; export class MockAnimationPlayer implements AnimationPlayer { private _onDoneFns: Function[] = []; diff --git a/modules/@angular/core/testing/ng_zone_mock.ts b/modules/@angular/core/testing/ng_zone_mock.ts index 7bf82c60d4..dffa0296e7 100644 --- a/modules/@angular/core/testing/ng_zone_mock.ts +++ b/modules/@angular/core/testing/ng_zone_mock.ts @@ -6,8 +6,8 @@ * found in the LICENSE file at https://angular.io/license */ -import {Injectable, NgZone} from '../index'; -import {EventEmitter} from '../src/facade/async'; +import {Injectable, NgZone} from '@angular/core'; +import {EventEmitter} from './facade/async'; /** * A mock implementation of {@link NgZone}. diff --git a/modules/@angular/core/testing/private_export_testing.ts b/modules/@angular/core/testing/private_export_testing.ts new file mode 100644 index 0000000000..6dbb28541f --- /dev/null +++ b/modules/@angular/core/testing/private_export_testing.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import * as mock_animation_player from './mock_animation_player'; +import * as test_compiler from './test_compiler'; + +export var __core_private_testing__: { + TestingCompiler: typeof test_compiler.TestingCompiler, + _TestingCompiler?: test_compiler.TestingCompiler, + TestingCompilerFactory: typeof test_compiler.TestingCompilerFactory, + _TestingCompilerFactory?: test_compiler.TestingCompilerFactory, + MockAnimationPlayer: typeof mock_animation_player.MockAnimationPlayer + _MockAnimationPlayer?: mock_animation_player.MockAnimationPlayer +} = { + TestingCompiler: test_compiler.TestingCompiler, + TestingCompilerFactory: test_compiler.TestingCompilerFactory, + MockAnimationPlayer: mock_animation_player.MockAnimationPlayer +}; diff --git a/modules/@angular/core/testing/test_bed.ts b/modules/@angular/core/testing/test_bed.ts index 3e873d583e..2f178c1457 100644 --- a/modules/@angular/core/testing/test_bed.ts +++ b/modules/@angular/core/testing/test_bed.ts @@ -6,13 +6,11 @@ * found in the LICENSE file at https://angular.io/license */ -import {CompilerOptions, ComponentMetadataType, DirectiveMetadataType, Injector, ModuleWithComponentFactories, NgModule, NgModuleFactory, NgModuleMetadataType, NgModuleRef, NgZone, OpaqueToken, PipeMetadataType, PlatformRef, Provider, SchemaMetadata} from '../index'; -import {ListWrapper} from '../src/facade/collection'; -import {FunctionWrapper, stringify} from '../src/facade/lang'; -import {Type} from '../src/type'; - +import {CompilerOptions, ComponentMetadataType, DirectiveMetadataType, Injector, ModuleWithComponentFactories, NgModule, NgModuleFactory, NgModuleMetadataType, NgModuleRef, NgZone, OpaqueToken, PipeMetadataType, PlatformRef, Provider, SchemaMetadata, Type} from '@angular/core'; import {AsyncTestCompleter} from './async_test_completer'; import {ComponentFixture} from './component_fixture'; +import {ListWrapper} from './facade/collection'; +import {FunctionWrapper, stringify} from './facade/lang'; import {MetadataOverride} from './metadata_override'; import {TestingCompiler, TestingCompilerFactory} from './test_compiler'; @@ -44,7 +42,7 @@ export var ComponentFixtureNoNgZone = new OpaqueToken('ComponentFixtureNoNgZone' */ export type TestModuleMetadata = { providers?: any[]; declarations?: any[]; imports?: any[]; schemas?: Array; -} +}; /** * @experimental diff --git a/modules/@angular/core/testing/test_compiler.ts b/modules/@angular/core/testing/test_compiler.ts index 58f166c93c..ba26c6a014 100644 --- a/modules/@angular/core/testing/test_compiler.ts +++ b/modules/@angular/core/testing/test_compiler.ts @@ -6,11 +6,12 @@ * found in the LICENSE file at https://angular.io/license */ -import {Compiler, CompilerOptions, ComponentMetadataType, DirectiveMetadataType, Injector, NgModuleMetadataType, PipeMetadataType} from '../index'; -import {unimplemented} from '../src/facade/errors'; -import {Type} from '../src/type'; +import {Compiler, CompilerOptions, ComponentMetadataType, DirectiveMetadataType, Injector, NgModuleMetadataType, PipeMetadataType, Type} from '@angular/core'; + +import {unimplemented} from './facade/errors'; import {MetadataOverride} from './metadata_override'; + /** * Special interface to the compiler only used by testing * diff --git a/modules/@angular/core/testing/testing_internal.ts b/modules/@angular/core/testing/testing_internal.ts index 87d55477bc..2dbcea90c9 100644 --- a/modules/@angular/core/testing/testing_internal.ts +++ b/modules/@angular/core/testing/testing_internal.ts @@ -6,15 +6,15 @@ * found in the LICENSE file at https://angular.io/license */ -import {StringMapWrapper} from '../src/facade/collection'; -import {Math, global, isPromise} from '../src/facade/lang'; - import {AsyncTestCompleter} from './async_test_completer'; +import {StringMapWrapper} from './facade/collection'; +import {Math, global, isPromise} from './facade/lang'; import {TestBed, getTestBed, inject} from './test_bed'; export {AsyncTestCompleter} from './async_test_completer'; export {MockAnimationPlayer} from './mock_animation_player'; export {inject} from './test_bed'; + export * from './logger'; export * from './ng_zone_mock'; diff --git a/modules/@angular/core/tsconfig-es5.json b/modules/@angular/core/tsconfig-testing.json similarity index 64% rename from modules/@angular/core/tsconfig-es5.json rename to modules/@angular/core/tsconfig-testing.json index fbe48be900..3d7613bacd 100644 --- a/modules/@angular/core/tsconfig-es5.json +++ b/modules/@angular/core/tsconfig-testing.json @@ -4,21 +4,22 @@ "declaration": true, "stripInternal": true, "experimentalDecorators": true, - "module": "commonjs", + "module": "es2015", "moduleResolution": "node", - "outDir": "../../../dist/packages-dist/core/", + "outDir": "../../../dist/packages-dist/core", "paths": { - "rxjs/*": ["../../../node_modules/rxjs/*"] + "rxjs/*": ["../../../node_modules/rxjs/*"], + "@angular/core": ["../../../dist/packages-dist/core"] }, "rootDir": ".", "sourceMap": true, "inlineSources": true, "lib": ["es6", "dom"], - "target": "es5" + "target": "es5", + "skipLibCheck": true }, "files": [ - "index.ts", - "testing.ts", + "testing/index.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts", "../../system.d.ts" ], diff --git a/modules/@angular/core/tsconfig-es2015.json b/modules/@angular/core/tsconfig.json similarity index 80% rename from modules/@angular/core/tsconfig-es2015.json rename to modules/@angular/core/tsconfig.json index a383c0c4b9..e907ff7037 100644 --- a/modules/@angular/core/tsconfig-es2015.json +++ b/modules/@angular/core/tsconfig.json @@ -6,18 +6,19 @@ "experimentalDecorators": true, "module": "es2015", "moduleResolution": "node", - "outDir": "../../../dist/packages-dist/core/esm", + "outDir": "../../../dist/packages-dist/core", "paths": { "rxjs/*": ["../../../node_modules/rxjs/*"] }, "rootDir": ".", "sourceMap": true, "inlineSources": true, - "target": "es2015" + "target": "es5", + "lib": ["es2015", "dom"], + "skipLibCheck": true }, "files": [ "index.ts", - "testing.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts", "../../system.d.ts" ], diff --git a/modules/@angular/facade/src/async.ts b/modules/@angular/facade/src/async.ts index 0591bbdb26..ac98efe207 100644 --- a/modules/@angular/facade/src/async.ts +++ b/modules/@angular/facade/src/async.ts @@ -8,8 +8,6 @@ import {Subject} from 'rxjs/Subject'; -import {global, noop} from './lang'; - export {Observable} from 'rxjs/Observable'; export {Subject} from 'rxjs/Subject'; diff --git a/modules/@angular/facade/src/lang.ts b/modules/@angular/facade/src/lang.ts index dbf29ec6f0..b54d0544d6 100644 --- a/modules/@angular/facade/src/lang.ts +++ b/modules/@angular/facade/src/lang.ts @@ -6,8 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {BaseError} from './errors'; - export interface BrowserNodeGlobal { Object: typeof Object; Array: typeof Array; @@ -94,7 +92,7 @@ export function isNumber(obj: any): boolean { return typeof obj === 'number'; } -export function isString(obj: any): obj is String { +export function isString(obj: any): obj is string { return typeof obj === 'string'; } diff --git a/modules/@angular/forms/index.ts b/modules/@angular/forms/index.ts index b64d7b5c78..31f3a88598 100644 --- a/modules/@angular/forms/index.ts +++ b/modules/@angular/forms/index.ts @@ -6,4 +6,11 @@ * found in the LICENSE file at https://angular.io/license */ +/** + * @module + * @description + * Entry point for all public APIs of the forms package. + */ export * from './src/forms'; + +// This file only reexports content of the `src` folder. Keep it that way. diff --git a/modules/@angular/forms/package.json b/modules/@angular/forms/package.json index 2448d234fd..1be8e01144 100644 --- a/modules/@angular/forms/package.json +++ b/modules/@angular/forms/package.json @@ -1,16 +1,15 @@ { "name": "@angular/forms", "version": "0.0.0-PLACEHOLDER", - "description": "", - "main": "index.js", - "jsnext:main": "esm/index.js", + "description": "Angular 2 forms", + "main": "bundles/forms.umd.js", + "module": "index.js", "typings": "index.d.ts", "author": "angular", "license": "MIT", "peerDependencies": { "@angular/core": "0.0.0-PLACEHOLDER", - "@angular/common": "0.0.0-PLACEHOLDER", - "@angular/compiler": "0.0.0-PLACEHOLDER" + "@angular/common": "0.0.0-PLACEHOLDER" }, "repository": { "type": "git", diff --git a/modules/@angular/forms/rollup.config.js b/modules/@angular/forms/rollup.config.js index 2e44f38fa5..a2dde36bda 100644 --- a/modules/@angular/forms/rollup.config.js +++ b/modules/@angular/forms/rollup.config.js @@ -1,7 +1,7 @@ export default { - entry: '../../../dist/packages-dist/forms/esm/index.js', - dest: '../../../dist/packages-dist/forms/esm/forms.umd.js', + entry: '../../../dist/packages-dist/forms/index.js', + dest: '../../../dist/packages-dist/forms/bundles/forms.umd.js', format: 'umd', moduleName: 'ng.forms', globals: { @@ -12,8 +12,5 @@ export default { 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. 'rxjs/operator/toPromise': 'Rx.Observable.prototype', 'rxjs/Observable': 'Rx' - }, - plugins: [ -// nodeResolve({ jsnext: true, main: true }), - ] + } } diff --git a/modules/@angular/forms/tsconfig-es5.json b/modules/@angular/forms/tsconfig-es5.json deleted file mode 100644 index a3d73aacd9..0000000000 --- a/modules/@angular/forms/tsconfig-es5.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": ".", - "declaration": true, - "stripInternal": true, - "experimentalDecorators": true, - "module": "commonjs", - "moduleResolution": "node", - "outDir": "../../../dist/packages-dist/forms/", - "paths": { - "@angular/core": ["../../../dist/packages-dist/core/"], - "@angular/core/testing": ["../../../dist/packages-dist/core/testing"], - "@angular/common": ["../../../dist/packages-dist/common"], - "@angular/common/testing": ["../../../dist/packages-dist/common/testing"], - "@angular/compiler": ["../../../dist/packages-dist/compiler"], - "@angular/compiler/testing": ["../../../dist/packages-dist/compiler/testing"] - }, - "rootDir": ".", - "sourceMap": true, - "inlineSources": true, - "lib": ["es6", "dom"], - "target": "es5" - }, - "files": [ - "index.ts", - "../../../node_modules/zone.js/dist/zone.js.d.ts" - ], - "angularCompilerOptions": { - "strictMetadataEmit": true - } -} diff --git a/modules/@angular/forms/tsconfig-es2015.json b/modules/@angular/forms/tsconfig.json similarity index 87% rename from modules/@angular/forms/tsconfig-es2015.json rename to modules/@angular/forms/tsconfig.json index 4e78598a70..fbe6581076 100644 --- a/modules/@angular/forms/tsconfig-es2015.json +++ b/modules/@angular/forms/tsconfig.json @@ -6,7 +6,7 @@ "experimentalDecorators": true, "module": "es2015", "moduleResolution": "node", - "outDir": "../../../dist/packages-dist/forms/esm", + "outDir": "../../../dist/packages-dist/forms", "paths": { "@angular/core": ["../../../dist/packages-dist/core"], "@angular/core/testing": ["../../../dist/packages-dist/core/testing"], @@ -18,7 +18,9 @@ "rootDir": ".", "sourceMap": true, "inlineSources": true, - "target": "es2015" + "target": "es5", + "skipLibCheck": true, + "lib": ["es2015", "dom"] }, "files": [ "index.ts", diff --git a/modules/@angular/http/index.ts b/modules/@angular/http/index.ts index 21456844e7..80106781e7 100644 --- a/modules/@angular/http/index.ts +++ b/modules/@angular/http/index.ts @@ -6,16 +6,11 @@ * found in the LICENSE file at https://angular.io/license */ -export {HttpModule, JsonpModule} from './http'; -export {BrowserXhr} from './src/backends/browser_xhr'; -export {JSONPBackend, JSONPConnection} from './src/backends/jsonp_backend'; -export {CookieXSRFStrategy, XHRBackend, XHRConnection} from './src/backends/xhr_backend'; -export {BaseRequestOptions, RequestOptions} from './src/base_request_options'; -export {BaseResponseOptions, ResponseOptions} from './src/base_response_options'; -export {ReadyState, RequestMethod, ResponseContentType, ResponseType} from './src/enums'; -export {Headers} from './src/headers'; -export {Http, Jsonp} from './src/http'; -export {Connection, ConnectionBackend, RequestOptionsArgs, ResponseOptionsArgs, XSRFStrategy} from './src/interfaces'; -export {Request} from './src/static_request'; -export {Response} from './src/static_response'; -export {QueryEncoder, URLSearchParams} from './src/url_search_params'; +/** + * @module + * @description + * Entry point for all public APIs of the http package. + */ +export * from './src/index'; + +// This file only reexports content of the `src` folder. Keep it that way. diff --git a/modules/@angular/http/package.json b/modules/@angular/http/package.json index af130eb548..27cc4a8fc9 100644 --- a/modules/@angular/http/package.json +++ b/modules/@angular/http/package.json @@ -1,9 +1,9 @@ { "name": "@angular/http", "version": "0.0.0-PLACEHOLDER", - "description": "", - "main": "index.js", - "jsnext:main": "esm/index.js", + "description": "Angular 2 http", + "main": "bundles/http.umd.js", + "module": "index.js", "typings": "index.d.ts", "author": "angular", "license": "MIT", diff --git a/modules/@angular/http/rollup-testing.config.js b/modules/@angular/http/rollup-testing.config.js new file mode 100644 index 0000000000..c4c6e6862b --- /dev/null +++ b/modules/@angular/http/rollup-testing.config.js @@ -0,0 +1,19 @@ + +export default { + entry: '../../../dist/packages-dist/http/testing/index.js', + dest: '../../../dist/packages-dist/http/bundles/http-testing.umd.js', + format: 'umd', + moduleName: 'ng.http.testing', + globals: { + '@angular/core': 'ng.core', + '@angular/compiler': 'ng.compiler', + '@angular/platform-browser': 'ng.platformBrowser', + '@angular/http': 'ng.http', + 'rxjs/Subject': 'Rx', + 'rxjs/ReplaySubject': 'Rx', + 'rxjs/Observable': 'Rx', + 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. + 'rxjs/operator/toPromise': 'Rx.Observable.prototype', + 'rxjs/operator/take': 'Rx.Observable.prototype', + } +} diff --git a/modules/@angular/http/rollup.config.js b/modules/@angular/http/rollup.config.js index de556e2ddd..bda3d9b701 100644 --- a/modules/@angular/http/rollup.config.js +++ b/modules/@angular/http/rollup.config.js @@ -1,7 +1,7 @@ export default { - entry: '../../../dist/packages-dist/http/esm/index.js', - dest: '../../../dist/packages-dist/http/esm/http.umd.js', + entry: '../../../dist/packages-dist/http/index.js', + dest: '../../../dist/packages-dist/http/bundles/http.umd.js', format: 'umd', moduleName: 'ng.http', globals: { @@ -12,8 +12,5 @@ export default { 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. 'rxjs/operator/toPromise': 'Rx.Observable.prototype', 'rxjs/Observable': 'Rx' - }, - plugins: [ -// nodeResolve({ jsnext: true, main: true }), - ] + } } diff --git a/modules/@angular/http/http.ts b/modules/@angular/http/src/http_module.ts similarity index 78% rename from modules/@angular/http/http.ts rename to modules/@angular/http/src/http_module.ts index e283859ac7..08eca599e8 100644 --- a/modules/@angular/http/http.ts +++ b/modules/@angular/http/src/http_module.ts @@ -14,14 +14,14 @@ */ import {NgModule} from '@angular/core'; -import {BrowserJsonp} from './src/backends/browser_jsonp'; -import {BrowserXhr} from './src/backends/browser_xhr'; -import {JSONPBackend, JSONPBackend_} from './src/backends/jsonp_backend'; -import {CookieXSRFStrategy, XHRBackend} from './src/backends/xhr_backend'; -import {BaseRequestOptions, RequestOptions} from './src/base_request_options'; -import {BaseResponseOptions, ResponseOptions} from './src/base_response_options'; -import {Http, Jsonp} from './src/http'; -import {XSRFStrategy} from './src/interfaces'; +import {BrowserJsonp} from './backends/browser_jsonp'; +import {BrowserXhr} from './backends/browser_xhr'; +import {JSONPBackend, JSONPBackend_} from './backends/jsonp_backend'; +import {CookieXSRFStrategy, XHRBackend} from './backends/xhr_backend'; +import {BaseRequestOptions, RequestOptions} from './base_request_options'; +import {BaseResponseOptions, ResponseOptions} from './base_response_options'; +import {Http, Jsonp} from './http'; +import {XSRFStrategy} from './interfaces'; export function _createDefaultCookieXSRFStrategy() { diff --git a/modules/@angular/http/src/http_utils.ts b/modules/@angular/http/src/http_utils.ts index d5d00366cf..06e115d150 100644 --- a/modules/@angular/http/src/http_utils.ts +++ b/modules/@angular/http/src/http_utils.ts @@ -17,7 +17,7 @@ export function normalizeMethodName(method: string | RequestMethod): RequestMeth .replace( /(\w)(\w*)/g, (g0: string, g1: string, g2: string) => g1.toUpperCase() + g2.toLowerCase()); - method = (<{[key: string]: any}>RequestMethod)[method]; + method = (<{[key: string]: any}>RequestMethod)[method]; if (typeof method !== 'number') throw new Error(`Invalid request method. The method "${originalMethod}" is not supported.`); } diff --git a/modules/@angular/http/src/index.ts b/modules/@angular/http/src/index.ts index 027a8e753e..7d10b18249 100644 --- a/modules/@angular/http/src/index.ts +++ b/modules/@angular/http/src/index.ts @@ -6,16 +6,16 @@ * found in the LICENSE file at https://angular.io/license */ -// Index to be used if Http is ever configured as a standalone npm package. -// require('reflect-metadata'); -// require('core-js'); -// import {HTTP_PROVIDERS, JSONP_PROVIDERS, Http, Jsonp} from './http'; -// import {Injector} from '@angular/core'; -// export * from './http'; - -// /** -// * TODO(jeffbcross): export each as their own top-level file, to require as: -// * require('@angular/http'); require('http/jsonp'); -// */ -// export var http = Injector.resolveAndCreate([HTTP_PROVIDERS]).get(Http); -// export var jsonp = Injector.resolveAndCreate([JSONP_PROVIDERS]).get(Jsonp); +export {BrowserXhr} from './backends/browser_xhr'; +export {JSONPBackend, JSONPConnection} from './backends/jsonp_backend'; +export {CookieXSRFStrategy, XHRBackend, XHRConnection} from './backends/xhr_backend'; +export {BaseRequestOptions, RequestOptions} from './base_request_options'; +export {BaseResponseOptions, ResponseOptions} from './base_response_options'; +export {ReadyState, RequestMethod, ResponseContentType, ResponseType} from './enums'; +export {Headers} from './headers'; +export {Http, Jsonp} from './http'; +export {HttpModule, JsonpModule} from './http_module'; +export {Connection, ConnectionBackend, RequestOptionsArgs, ResponseOptionsArgs, XSRFStrategy} from './interfaces'; +export {Request} from './static_request'; +export {Response} from './static_response'; +export {QueryEncoder, URLSearchParams} from './url_search_params'; diff --git a/modules/@angular/http/src/interfaces.ts b/modules/@angular/http/src/interfaces.ts index 89a9eb7f8a..c123265f6b 100644 --- a/modules/@angular/http/src/interfaces.ts +++ b/modules/@angular/http/src/interfaces.ts @@ -71,4 +71,4 @@ export type ResponseOptionsArgs = { headers?: Headers; type?: ResponseType; url?: string; -} +}; diff --git a/modules/@angular/http/testing.ts b/modules/@angular/http/testing/index.ts similarity index 58% rename from modules/@angular/http/testing.ts rename to modules/@angular/http/testing/index.ts index 07ff42c35a..e54b3f9018 100644 --- a/modules/@angular/http/testing.ts +++ b/modules/@angular/http/testing/index.ts @@ -6,4 +6,9 @@ * found in the LICENSE file at https://angular.io/license */ -export * from './testing/mock_backend'; +/** + * @module + * @description + * Entry point for all public APIs of the platform-server/testing package. + */ +export * from './mock_backend'; diff --git a/modules/@angular/http/testing/mock_backend.ts b/modules/@angular/http/testing/mock_backend.ts index 88678281a6..ffbd6a48e0 100644 --- a/modules/@angular/http/testing/mock_backend.ts +++ b/modules/@angular/http/testing/mock_backend.ts @@ -7,17 +7,11 @@ */ import {Injectable} from '@angular/core'; +import {Connection, ConnectionBackend, ReadyState, Request, Response} from '@angular/http'; import {ReplaySubject} from 'rxjs/ReplaySubject'; import {Subject} from 'rxjs/Subject'; import {take} from 'rxjs/operator/take'; -import {ReadyState} from '../src/enums'; -import {isPresent} from '../src/facade/lang'; -import {Connection, ConnectionBackend} from '../src/interfaces'; -import {Request} from '../src/static_request'; -import {Response} from '../src/static_response'; - - /** * @@ -232,7 +226,7 @@ export class MockBackend implements ConnectionBackend { * against the framework itself, not by end-users. */ createConnection(req: Request): MockConnection { - if (!isPresent(req) || !(req instanceof Request)) { + if (!req || !(req instanceof Request)) { throw new Error(`createConnection requires an instance of Request, got ${req}`); } let connection = new MockConnection(req); diff --git a/modules/@angular/http/tsconfig-testing.json b/modules/@angular/http/tsconfig-testing.json new file mode 100644 index 0000000000..3abad28775 --- /dev/null +++ b/modules/@angular/http/tsconfig-testing.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "stripInternal": true, + "experimentalDecorators": true, + "module": "es2015", + "moduleResolution": "node", + "outDir": "../../../dist/packages-dist/http", + "paths": { + "@angular/core": ["../../../dist/packages-dist/core"], + "@angular/http": ["../../../dist/packages-dist/http"], + "rxjs/*": ["../../../node_modules/rxjs/*"] + }, + "rootDir": ".", + "sourceMap": true, + "inlineSources": true, + "lib": ["es6", "dom"], + "target": "es5", + "skipLibCheck": true + }, + "files": [ + "testing/index.ts" + ], + "angularCompilerOptions": { + "strictMetadataEmit": true + } +} diff --git a/modules/@angular/http/tsconfig-es2015.json b/modules/@angular/http/tsconfig.json similarity index 83% rename from modules/@angular/http/tsconfig-es2015.json rename to modules/@angular/http/tsconfig.json index 6f7742cb74..d53404141d 100644 --- a/modules/@angular/http/tsconfig-es2015.json +++ b/modules/@angular/http/tsconfig.json @@ -6,7 +6,7 @@ "experimentalDecorators": true, "module": "es2015", "moduleResolution": "node", - "outDir": "../../../dist/packages-dist/http/esm", + "outDir": "../../../dist/packages-dist/http", "paths": { "@angular/core": ["../../../dist/packages-dist/core"], "@angular/common": ["../../../dist/packages-dist/common"], @@ -15,11 +15,12 @@ "rootDir": ".", "sourceMap": true, "inlineSources": true, - "target": "es2015" + "target": "es5", + "skipLibCheck": true, + "lib": ["es2015", "dom"] }, "files": [ "index.ts", - "testing.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts" ], "angularCompilerOptions": { diff --git a/modules/@angular/platform-browser-dynamic/index.ts b/modules/@angular/platform-browser-dynamic/index.ts index 0283ba4832..ced57d28bf 100644 --- a/modules/@angular/platform-browser-dynamic/index.ts +++ b/modules/@angular/platform-browser-dynamic/index.ts @@ -6,53 +6,11 @@ * found in the LICENSE file at https://angular.io/license */ -import {ResourceLoader, platformCoreDynamic} from '@angular/compiler'; -import {COMPILER_OPTIONS, ClassProvider, ExistingProvider, FactoryProvider, PlatformRef, Provider, TypeProvider, ValueProvider, createPlatformFactory} from '@angular/core'; -import {WORKER_SCRIPT, platformWorkerUi} from '@angular/platform-browser'; - -import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './src/platform_providers'; -import {CachedResourceLoader} from './src/resource_loader/resource_loader_cache'; -import {ResourceLoaderImpl} from './src/resource_loader/resource_loader_impl'; - - - /** - * @experimental + * @module + * @description + * Entry point for all public APIs of the platform-browser-dynamic package. */ -export const RESOURCE_CACHE_PROVIDER: Provider[] = - [{provide: ResourceLoader, useClass: CachedResourceLoader}]; +export * from './src/platform-browser-dynamic'; -/** - * @stable - */ -export const platformBrowserDynamic = createPlatformFactory( - platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS); - -/** - * Bootstraps the worker ui. - * - * @experimental WebWorker support is currently experimental - */ -export function bootstrapWorkerUi( - workerScriptUri: string, customProviders: Provider[] = []): Promise { - // For now, just creates the worker ui platform... - return Promise.resolve(platformWorkerUi(([{ - provide: WORKER_SCRIPT, - useValue: workerScriptUri, - }] as Provider[]) - .concat(customProviders))); -} - -/** - * @experimental WebWorker support is currently experimental - */ -export const platformWorkerAppDynamic = createPlatformFactory( - platformCoreDynamic, 'workerAppDynamic', [{ - provide: COMPILER_OPTIONS, - useValue: {providers: [{provide: ResourceLoader, useClass: ResourceLoaderImpl}]}, - multi: true - }]); - -function normalizeArray(arr: any[]): any[] { - return arr ? arr : []; -} +// This file only reexports content of the `src` folder. Keep it that way. diff --git a/modules/@angular/platform-browser-dynamic/package.json b/modules/@angular/platform-browser-dynamic/package.json index 971328804c..eebeb82e4f 100644 --- a/modules/@angular/platform-browser-dynamic/package.json +++ b/modules/@angular/platform-browser-dynamic/package.json @@ -1,9 +1,9 @@ { "name": "@angular/platform-browser-dynamic", "version": "0.0.0-PLACEHOLDER", - "description": "", - "main": "index.js", - "jsnext:main": "esm/index.js", + "description": "Angular 2 platform-browser-dynamic", + "main": "bundles/platform-browser-dynamic.umd.js", + "module": "index.js", "typings": "index.d.ts", "author": "angular", "license": "MIT", diff --git a/modules/@angular/platform-browser-dynamic/private_export_testing.ts b/modules/@angular/platform-browser-dynamic/private_export_testing.ts deleted file mode 100644 index eecee77e58..0000000000 --- a/modules/@angular/platform-browser-dynamic/private_export_testing.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import * as testing from './testing/dom_test_component_renderer'; - -export interface __platform_browser_dynamic_private_types__ { - DOMTestComponentRenderer: testing.DOMTestComponentRenderer; -} - -export var __platform_browser_dynamic_private__ = { - DOMTestComponentRenderer: testing.DOMTestComponentRenderer -}; diff --git a/modules/@angular/platform-browser-dynamic/rollup-testing.config.js b/modules/@angular/platform-browser-dynamic/rollup-testing.config.js new file mode 100644 index 0000000000..911f61cef2 --- /dev/null +++ b/modules/@angular/platform-browser-dynamic/rollup-testing.config.js @@ -0,0 +1,20 @@ +export default { + entry: '../../../dist/packages-dist/platform-browser-dynamic/testing/index.js', + dest: '../../../dist/packages-dist/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js', + format: 'umd', + moduleName: 'ng.platformBrowserDynamic.testing', + globals: { + '@angular/core': 'ng.core', + '@angular/core/testing': 'ng.core.testing', + '@angular/common': 'ng.common', + '@angular/compiler': 'ng.compiler', + '@angular/compiler/testing': 'ng.compiler.testing', + '@angular/platform-browser': 'ng.platformBrowser', + '@angular/platform-browser/testing': 'ng.platformBrowser.testing', + '@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic', + 'rxjs/Subject': 'Rx', + 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. + 'rxjs/operator/toPromise': 'Rx.Observable.prototype', + 'rxjs/Observable': 'Rx' + } +} diff --git a/modules/@angular/platform-browser-dynamic/rollup.config.js b/modules/@angular/platform-browser-dynamic/rollup.config.js index cc027f89f0..03f0429b78 100644 --- a/modules/@angular/platform-browser-dynamic/rollup.config.js +++ b/modules/@angular/platform-browser-dynamic/rollup.config.js @@ -1,6 +1,6 @@ export default { - entry: '../../../dist/packages-dist/platform-browser-dynamic/esm/index.js', - dest: '../../../dist/packages-dist/platform-browser-dynamic/esm/platform-browser-dynamic.umd.js', + entry: '../../../dist/packages-dist/platform-browser-dynamic/index.js', + dest: '../../../dist/packages-dist/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', format: 'umd', moduleName: 'ng.platformBrowserDynamic', globals: { @@ -12,8 +12,5 @@ export default { 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. 'rxjs/operator/toPromise': 'Rx.Observable.prototype', 'rxjs/Observable': 'Rx' - }, - plugins: [ -// nodeResolve({ jsnext: true, main: true }), - ] -} \ No newline at end of file + } +} diff --git a/modules/@angular/platform-browser-dynamic/src/platform-browser-dynamic.ts b/modules/@angular/platform-browser-dynamic/src/platform-browser-dynamic.ts new file mode 100644 index 0000000000..9a882c9d54 --- /dev/null +++ b/modules/@angular/platform-browser-dynamic/src/platform-browser-dynamic.ts @@ -0,0 +1,59 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {ResourceLoader, platformCoreDynamic} from '@angular/compiler'; +import {ApplicationRef, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, ClassProvider, CompilerFactory, CompilerOptions, ComponentRef, ExistingProvider, FactoryProvider, NgModule, PlatformRef, Provider, Type, TypeProvider, ValueProvider, createPlatformFactory} from '@angular/core'; +import {BrowserModule, WORKER_SCRIPT, WorkerAppModule, platformWorkerUi} from '@angular/platform-browser'; + +import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './platform_providers'; +import {Console} from './private_import_core'; +import {CachedResourceLoader} from './resource_loader/resource_loader_cache'; +import {ResourceLoaderImpl} from './resource_loader/resource_loader_impl'; + +export * from './private_export'; + +/** + * @experimental + */ +export const RESOURCE_CACHE_PROVIDER: Provider[] = + [{provide: ResourceLoader, useClass: CachedResourceLoader}]; + +/** + * @experimental API related to bootstrapping are still under review. + */ +export const platformBrowserDynamic = createPlatformFactory( + platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS); + +/** + * Bootstraps the worker ui. + * + * @experimental + */ +export function bootstrapWorkerUi( + workerScriptUri: string, customProviders: Provider[] = []): Promise { + // For now, just creates the worker ui platform... + return Promise.resolve(platformWorkerUi(([{ + provide: WORKER_SCRIPT, + useValue: workerScriptUri, + }] as Provider[]) + .concat(customProviders))); +} + +/** + * @experimental API related to bootstrapping are still under review. + */ +export const platformWorkerAppDynamic = createPlatformFactory( + platformCoreDynamic, 'workerAppDynamic', [{ + provide: COMPILER_OPTIONS, + useValue: {providers: [{provide: ResourceLoader, useClass: ResourceLoaderImpl}]}, + multi: true + }]); + +function normalizeArray(arr: any[]): any[] { + return arr ? arr : []; +} diff --git a/modules/@angular/platform-browser-dynamic/src/platform_providers.ts b/modules/@angular/platform-browser-dynamic/src/platform_providers.ts index 48a91af357..9bc1fb27d1 100644 --- a/modules/@angular/platform-browser-dynamic/src/platform_providers.ts +++ b/modules/@angular/platform-browser-dynamic/src/platform_providers.ts @@ -9,7 +9,7 @@ import {ResourceLoader} from '@angular/compiler'; import {COMPILER_OPTIONS, Provider} from '@angular/core'; -import {INTERNAL_BROWSER_PLATFORM_PROVIDERS} from '../platform_browser_private'; +import {INTERNAL_BROWSER_PLATFORM_PROVIDERS} from './private_import_platform-browser'; import {ResourceLoaderImpl} from './resource_loader/resource_loader_impl'; diff --git a/modules/@angular/platform-browser-dynamic/src/private_export.ts b/modules/@angular/platform-browser-dynamic/src/private_export.ts new file mode 100644 index 0000000000..561e481536 --- /dev/null +++ b/modules/@angular/platform-browser-dynamic/src/private_export.ts @@ -0,0 +1,15 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import {ClassProvider, ExistingProvider, FactoryProvider, Provider, TypeProvider, ValueProvider} from '@angular/core'; +import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './platform_providers'; + +export var __platform_browser_dynamic_private__: { + INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS: typeof INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS; +} = { + INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS: INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS +}; diff --git a/modules/@angular/platform-browser-dynamic/core_private.ts b/modules/@angular/platform-browser-dynamic/src/private_import_core.ts similarity index 100% rename from modules/@angular/platform-browser-dynamic/core_private.ts rename to modules/@angular/platform-browser-dynamic/src/private_import_core.ts diff --git a/modules/@angular/platform-browser-dynamic/platform_browser_private.ts b/modules/@angular/platform-browser-dynamic/src/private_import_platform-browser.ts similarity index 53% rename from modules/@angular/platform-browser-dynamic/platform_browser_private.ts rename to modules/@angular/platform-browser-dynamic/src/private_import_platform-browser.ts index c18ea498eb..3a1c7a5265 100644 --- a/modules/@angular/platform-browser-dynamic/platform_browser_private.ts +++ b/modules/@angular/platform-browser-dynamic/src/private_import_platform-browser.ts @@ -6,8 +6,8 @@ * found in the LICENSE file at https://angular.io/license */ -import {__platform_browser_private__ as r} from '@angular/platform-browser'; +import {__platform_browser_private__ as _} from '@angular/platform-browser'; -export var INTERNAL_BROWSER_PLATFORM_PROVIDERS: typeof r.INTERNAL_BROWSER_PLATFORM_PROVIDERS = - r.INTERNAL_BROWSER_PLATFORM_PROVIDERS; -export var getDOM: typeof r.getDOM = r.getDOM; +export var INTERNAL_BROWSER_PLATFORM_PROVIDERS: typeof _.INTERNAL_BROWSER_PLATFORM_PROVIDERS = + _.INTERNAL_BROWSER_PLATFORM_PROVIDERS; +export var getDOM: typeof _.getDOM = _.getDOM; diff --git a/modules/@angular/platform-browser-dynamic/testing/dom_test_component_renderer.ts b/modules/@angular/platform-browser-dynamic/testing/dom_test_component_renderer.ts index 6ffc3188d6..ae9a89a942 100644 --- a/modules/@angular/platform-browser-dynamic/testing/dom_test_component_renderer.ts +++ b/modules/@angular/platform-browser-dynamic/testing/dom_test_component_renderer.ts @@ -9,8 +9,7 @@ import {Inject, Injectable} from '@angular/core'; import {TestComponentRenderer} from '@angular/core/testing'; import {DOCUMENT} from '@angular/platform-browser'; - -import {getDOM} from '../platform_browser_private'; +import {getDOM} from './private_import_platform-browser'; diff --git a/modules/@angular/platform-browser-dynamic/testing/facade b/modules/@angular/platform-browser-dynamic/testing/facade new file mode 120000 index 0000000000..e084c803c6 --- /dev/null +++ b/modules/@angular/platform-browser-dynamic/testing/facade @@ -0,0 +1 @@ +../../facade/src \ No newline at end of file diff --git a/modules/@angular/platform-browser-dynamic/testing.ts b/modules/@angular/platform-browser-dynamic/testing/index.ts similarity index 77% rename from modules/@angular/platform-browser-dynamic/testing.ts rename to modules/@angular/platform-browser-dynamic/testing/index.ts index 0a38b0e0e8..c4ed5f9459 100644 --- a/modules/@angular/platform-browser-dynamic/testing.ts +++ b/modules/@angular/platform-browser-dynamic/testing/index.ts @@ -7,12 +7,12 @@ */ import {platformCoreDynamicTesting} from '@angular/compiler/testing'; -import {ClassProvider, ExistingProvider, FactoryProvider, NgModule, PlatformRef, TypeProvider, ValueProvider, createPlatformFactory} from '@angular/core'; +import {ClassProvider, ExistingProvider, FactoryProvider, NgModule, PlatformRef, Provider, TypeProvider, ValueProvider, createPlatformFactory} from '@angular/core'; import {TestComponentRenderer} from '@angular/core/testing'; import {BrowserTestingModule} from '@angular/platform-browser/testing'; -import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './src/platform_providers'; -import {DOMTestComponentRenderer} from './testing/dom_test_component_renderer'; +import {DOMTestComponentRenderer} from './dom_test_component_renderer'; +import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './private_import_platform-browser-dynamic'; export * from './private_export_testing' diff --git a/modules/@angular/platform-browser-dynamic/testing/private_export_testing.ts b/modules/@angular/platform-browser-dynamic/testing/private_export_testing.ts new file mode 100644 index 0000000000..ca9e3d4cf8 --- /dev/null +++ b/modules/@angular/platform-browser-dynamic/testing/private_export_testing.ts @@ -0,0 +1,14 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import * as testing from './dom_test_component_renderer'; + +export var __platform_browser_dynamic_private__: + {DOMTestComponentRenderer: typeof testing.DOMTestComponentRenderer} = { + DOMTestComponentRenderer: testing.DOMTestComponentRenderer + }; diff --git a/modules/@angular/platform-browser-dynamic/testing/private_import_platform-browser-dynamic.ts b/modules/@angular/platform-browser-dynamic/testing/private_import_platform-browser-dynamic.ts new file mode 100644 index 0000000000..7c69c830ab --- /dev/null +++ b/modules/@angular/platform-browser-dynamic/testing/private_import_platform-browser-dynamic.ts @@ -0,0 +1,13 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {__platform_browser_dynamic_private__ as _} from '@angular/platform-browser-dynamic'; + +export var INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS: + typeof _.INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = + _.INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS; diff --git a/modules/@angular/common/testing.ts b/modules/@angular/platform-browser-dynamic/testing/private_import_platform-browser.ts similarity index 62% rename from modules/@angular/common/testing.ts rename to modules/@angular/platform-browser-dynamic/testing/private_import_platform-browser.ts index 1e1ae6ca46..da4ac4bc90 100644 --- a/modules/@angular/common/testing.ts +++ b/modules/@angular/platform-browser-dynamic/testing/private_import_platform-browser.ts @@ -6,5 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -export {SpyLocation} from './testing/location_mock'; -export {MockLocationStrategy} from './testing/mock_location_strategy'; \ No newline at end of file +import {__platform_browser_private__ as _} from '@angular/platform-browser'; + +export var getDOM: typeof _.getDOM = _.getDOM; diff --git a/modules/@angular/platform-browser-dynamic/tsconfig-es5.json b/modules/@angular/platform-browser-dynamic/tsconfig-testing.json similarity index 80% rename from modules/@angular/platform-browser-dynamic/tsconfig-es5.json rename to modules/@angular/platform-browser-dynamic/tsconfig-testing.json index e991da02cc..776e5dbc34 100644 --- a/modules/@angular/platform-browser-dynamic/tsconfig-es5.json +++ b/modules/@angular/platform-browser-dynamic/tsconfig-testing.json @@ -4,7 +4,7 @@ "declaration": true, "stripInternal": true, "experimentalDecorators": true, - "module": "commonjs", + "module": "es2015", "moduleResolution": "node", "outDir": "../../../dist/packages-dist/platform-browser-dynamic/", "paths": { @@ -15,17 +15,18 @@ "@angular/compiler": ["../../../dist/packages-dist/compiler"], "@angular/compiler/testing": ["../../../dist/packages-dist/compiler/testing"], "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"], - "@angular/platform-browser/testing": ["../../../dist/packages-dist/platform-browser/testing"] + "@angular/platform-browser/testing": ["../../../dist/packages-dist/platform-browser/testing"], + "@angular/platform-browser-dynamic": ["../../../dist/packages-dist/platform-browser-dynamic"] }, "rootDir": ".", "sourceMap": true, "inlineSources": true, - "lib": ["es6", "dom"], - "target": "es5" + "lib": ["es2015", "dom"], + "target": "es5", + "skipLibCheck": true }, "files": [ - "index.ts", - "testing.ts", + "testing/index.ts", "../../../node_modules/@types/jasmine/index.d.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts" ] diff --git a/modules/@angular/platform-browser-dynamic/tsconfig-es2015.json b/modules/@angular/platform-browser-dynamic/tsconfig.json similarity index 93% rename from modules/@angular/platform-browser-dynamic/tsconfig-es2015.json rename to modules/@angular/platform-browser-dynamic/tsconfig.json index fc2594407f..cf3eda7fef 100644 --- a/modules/@angular/platform-browser-dynamic/tsconfig-es2015.json +++ b/modules/@angular/platform-browser-dynamic/tsconfig.json @@ -6,7 +6,7 @@ "experimentalDecorators": true, "module": "es2015", "moduleResolution": "node", - "outDir": "../../../dist/packages-dist/platform-browser-dynamic/esm", + "outDir": "../../../dist/packages-dist/platform-browser-dynamic", "paths": { "@angular/core": ["../../../dist/packages-dist/core"], "@angular/core/testing": ["../../../dist/packages-dist/core/testing"], @@ -20,11 +20,12 @@ "rootDir": ".", "sourceMap": true, "inlineSources": true, - "target": "es2015" + "target": "es5", + "skipLibCheck": true, + "lib": ["es2015", "dom"] }, "files": [ "index.ts", - "testing.ts", "../../../node_modules/@types/jasmine/index.d.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts" ] diff --git a/modules/@angular/platform-browser/dynamic.ts b/modules/@angular/platform-browser/dynamic.ts deleted file mode 100644 index c91a05e544..0000000000 --- a/modules/@angular/platform-browser/dynamic.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ diff --git a/modules/@angular/platform-browser/index.ts b/modules/@angular/platform-browser/index.ts index c16e913893..216edd7af6 100644 --- a/modules/@angular/platform-browser/index.ts +++ b/modules/@angular/platform-browser/index.ts @@ -6,26 +6,11 @@ * found in the LICENSE file at https://angular.io/license */ -export {BrowserModule, platformBrowser} from './src/browser'; -export {BrowserPlatformLocation} from './src/browser/location/browser_platform_location'; -export {Title} from './src/browser/title'; -export {disableDebugTools, enableDebugTools} from './src/browser/tools/tools'; -export {AnimationDriver} from './src/dom/animation_driver'; -export {By} from './src/dom/debug/by'; -export {DOCUMENT} from './src/dom/dom_tokens'; -export {EVENT_MANAGER_PLUGINS, EventManager} from './src/dom/events/event_manager'; -export {HAMMER_GESTURE_CONFIG, HammerGestureConfig} from './src/dom/events/hammer_gestures'; -export {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from './src/security/dom_sanitization_service'; -// Web Workers -export {ClientMessageBroker, ClientMessageBrokerFactory, FnArg, UiArguments} from './src/web_workers/shared/client_message_broker'; -export {PRIMITIVE} from './src/web_workers/shared/serializer'; -export {ReceivedMessage, ServiceMessageBroker, ServiceMessageBrokerFactory} from './src/web_workers/shared/service_message_broker'; +/** + * @module + * @description + * Entry point for all public APIs of the platform-browser package. + */ +export * from './src/platform-browser'; -export * from './src/web_workers/shared/message_bus'; -export {WORKER_APP_LOCATION_PROVIDERS} from './src/web_workers/worker/location_providers'; -export {WORKER_UI_LOCATION_PROVIDERS} from './src/web_workers/ui/location_providers'; - -export {NgProbeToken} from './src/dom/debug/ng_probe'; -export {platformWorkerUi, WebWorkerInstance, WORKER_SCRIPT, WORKER_UI_STARTABLE_MESSAGING_SERVICE} from './src/worker_render'; -export {platformWorkerApp, WorkerAppModule} from './src/worker_app'; -export * from './private_export'; +// This file only reexports content of the `src` folder. Keep it that way. diff --git a/modules/@angular/platform-browser/package.json b/modules/@angular/platform-browser/package.json index 8c1089917d..87f2c29999 100644 --- a/modules/@angular/platform-browser/package.json +++ b/modules/@angular/platform-browser/package.json @@ -1,9 +1,9 @@ { "name": "@angular/platform-browser", "version": "0.0.0-PLACEHOLDER", - "description": "", - "main": "index.js", - "jsnext:main": "esm/index.js", + "description": "Angular 2 platform-browser", + "main": "bundles/platform-browser.umd.js", + "module": "index.js", "typings": "index.d.ts", "author": "angular", "license": "MIT", diff --git a/modules/@angular/platform-browser/private_export.ts b/modules/@angular/platform-browser/private_export.ts deleted file mode 100644 index dc9abb91b8..0000000000 --- a/modules/@angular/platform-browser/private_export.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {ClassProvider, ExistingProvider, FactoryProvider, TypeProvider, ValueProvider} from '@angular/core'; - -import * as browser from './src/browser'; -import * as ng_proble from './src/dom/debug/ng_probe'; -import * as dom_adapter from './src/dom/dom_adapter'; -import * as dom_renderer from './src/dom/dom_renderer'; -import * as dom_events from './src/dom/events/dom_events'; -import * as shared_styles_host from './src/dom/shared_styles_host'; - -export interface __platform_browser_private_types__ { - DomAdapter: dom_adapter.DomAdapter; - DomRootRenderer: dom_renderer.DomRootRenderer; - DomRootRenderer_: dom_renderer.DomRootRenderer_; - DomSharedStylesHost: shared_styles_host.DomSharedStylesHost; - SharedStylesHost: shared_styles_host.SharedStylesHost; - DomEventsPlugin: dom_events.DomEventsPlugin; -} - -export var __platform_browser_private__ = { - DomAdapter: dom_adapter.DomAdapter, - getDOM: dom_adapter.getDOM, - setRootDomAdapter: dom_adapter.setRootDomAdapter, - DomRootRenderer: dom_renderer.DomRootRenderer, - DomRootRenderer_: dom_renderer.DomRootRenderer_, - DomSharedStylesHost: shared_styles_host.DomSharedStylesHost, - SharedStylesHost: shared_styles_host.SharedStylesHost, - ELEMENT_PROBE_PROVIDERS: ng_proble.ELEMENT_PROBE_PROVIDERS, - DomEventsPlugin: dom_events.DomEventsPlugin, - initDomAdapter: browser.initDomAdapter, - INTERNAL_BROWSER_PLATFORM_PROVIDERS: browser.INTERNAL_BROWSER_PLATFORM_PROVIDERS -}; diff --git a/modules/@angular/platform-browser/rollup-testing.config.js b/modules/@angular/platform-browser/rollup-testing.config.js new file mode 100644 index 0000000000..267e10ddfd --- /dev/null +++ b/modules/@angular/platform-browser/rollup-testing.config.js @@ -0,0 +1,16 @@ + +export default { + entry: '../../../dist/packages-dist/platform-browser/testing/index.js', + dest: '../../../dist/packages-dist/platform-browser/bundles/platform-browser-testing.umd.js', + format: 'umd', + moduleName: 'ng.platformBrowser.testing', + globals: { + '@angular/core': 'ng.core', + '@angular/common': 'ng.common', + '@angular/platform-browser': 'ng.platformBrowser', + 'rxjs/Subject': 'Rx', + 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. + 'rxjs/operator/toPromise': 'Rx.Observable.prototype', + 'rxjs/Observable': 'Rx' + } +} diff --git a/modules/@angular/platform-browser/rollup.config.js b/modules/@angular/platform-browser/rollup.config.js index 4ac59434f0..c44d5d8b68 100644 --- a/modules/@angular/platform-browser/rollup.config.js +++ b/modules/@angular/platform-browser/rollup.config.js @@ -1,7 +1,7 @@ export default { - entry: '../../../dist/packages-dist/platform-browser/esm/index.js', - dest: '../../../dist/packages-dist/platform-browser/esm/platform-browser.umd.js', + entry: '../../../dist/packages-dist/platform-browser/index.js', + dest: '../../../dist/packages-dist/platform-browser/bundles/platform-browser.umd.js', format: 'umd', moduleName: 'ng.platformBrowser', globals: { @@ -11,8 +11,5 @@ export default { 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. 'rxjs/operator/toPromise': 'Rx.Observable.prototype', 'rxjs/Observable': 'Rx' - }, - plugins: [ -// nodeResolve({ jsnext: true, main: true }), - ] + } } diff --git a/modules/@angular/platform-browser/src/browser.ts b/modules/@angular/platform-browser/src/browser.ts index 9e3d41ba5f..348b039948 100644 --- a/modules/@angular/platform-browser/src/browser.ts +++ b/modules/@angular/platform-browser/src/browser.ts @@ -9,7 +9,6 @@ import {CommonModule, PlatformLocation} from '@angular/common'; import {ApplicationModule, ClassProvider, ErrorHandler, ExistingProvider, FactoryProvider, NgModule, Optional, PLATFORM_INITIALIZER, PlatformRef, Provider, RootRenderer, Sanitizer, SkipSelf, Testability, TypeProvider, ValueProvider, createPlatformFactory, platformCore} from '@angular/core'; -import {wtfInit} from '../core_private'; import {AnimationDriver} from '../src/dom/animation_driver'; import {WebAnimationsDriver} from '../src/dom/web_animations_driver'; @@ -51,7 +50,6 @@ export const platformBrowser = export function initDomAdapter() { BrowserDomAdapter.makeCurrent(); - wtfInit(); BrowserGetTestability.init(); } diff --git a/modules/@angular/platform-browser/src/browser/browser_adapter.ts b/modules/@angular/platform-browser/src/browser/browser_adapter.ts index 62a907777c..6d4f150d18 100644 --- a/modules/@angular/platform-browser/src/browser/browser_adapter.ts +++ b/modules/@angular/platform-browser/src/browser/browser_adapter.ts @@ -330,7 +330,7 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter { isCommentNode(node: Node): boolean { return node.nodeType === Node.COMMENT_NODE; } isElementNode(node: Node): boolean { return node.nodeType === Node.ELEMENT_NODE; } hasShadowRoot(node: any /** TODO #9100 */): boolean { - return node instanceof HTMLElement && isPresent(node.shadowRoot); + return isPresent(node.shadowRoot) && node instanceof HTMLElement; } isShadowRoot(node: any /** TODO #9100 */): boolean { return node instanceof DocumentFragment; } importIntoDoc(node: Node): any { diff --git a/modules/@angular/platform-browser/src/dom/animation_driver.ts b/modules/@angular/platform-browser/src/dom/animation_driver.ts index feb5040cda..915c9a884d 100644 --- a/modules/@angular/platform-browser/src/dom/animation_driver.ts +++ b/modules/@angular/platform-browser/src/dom/animation_driver.ts @@ -8,7 +8,7 @@ import {AnimationPlayer} from '@angular/core'; -import {AnimationKeyframe, AnimationStyles, NoOpAnimationPlayer} from '../../core_private'; +import {AnimationKeyframe, AnimationStyles, NoOpAnimationPlayer} from '../private_import_core'; class _NoOpAnimationDriver implements AnimationDriver { animate( diff --git a/modules/@angular/platform-browser/src/dom/debug/ng_probe.ts b/modules/@angular/platform-browser/src/dom/debug/ng_probe.ts index 5076f714e8..0bd57aa301 100644 --- a/modules/@angular/platform-browser/src/dom/debug/ng_probe.ts +++ b/modules/@angular/platform-browser/src/dom/debug/ng_probe.ts @@ -8,8 +8,8 @@ import {ApplicationRef, DebugNode, NgZone, Optional, Provider, RootRenderer, getDebugNode, isDevMode} from '@angular/core'; -import {DebugDomRootRenderer} from '../../../core_private'; import {StringMapWrapper} from '../../facade/collection'; +import {DebugDomRootRenderer} from '../../private_import_core'; import {getDOM} from '../dom_adapter'; import {DomRootRenderer} from '../dom_renderer'; diff --git a/modules/@angular/platform-browser/src/dom/dom_renderer.ts b/modules/@angular/platform-browser/src/dom/dom_renderer.ts index cdfe43cb56..9719da559c 100644 --- a/modules/@angular/platform-browser/src/dom/dom_renderer.ts +++ b/modules/@angular/platform-browser/src/dom/dom_renderer.ts @@ -8,9 +8,9 @@ import {Inject, Injectable, OpaqueToken, RenderComponentType, Renderer, RootRenderer, ViewEncapsulation} from '@angular/core'; -import {AnimationKeyframe, AnimationPlayer, AnimationStyles, RenderDebugInfo} from '../../core_private'; import {StringMapWrapper} from '../facade/collection'; import {Json, StringWrapper, isArray, isBlank, isPresent, isString, stringify} from '../facade/lang'; +import {AnimationKeyframe, AnimationPlayer, AnimationStyles, RenderDebugInfo} from '../private_import_core'; import {AnimationDriver} from './animation_driver'; import {getDOM} from './dom_adapter'; diff --git a/modules/@angular/platform-browser/src/dom/web_animations_driver.ts b/modules/@angular/platform-browser/src/dom/web_animations_driver.ts index db13b8ec4d..c17851f55e 100644 --- a/modules/@angular/platform-browser/src/dom/web_animations_driver.ts +++ b/modules/@angular/platform-browser/src/dom/web_animations_driver.ts @@ -8,9 +8,10 @@ import {AUTO_STYLE} from '@angular/core'; -import {AnimationKeyframe, AnimationPlayer, AnimationStyles, NoOpAnimationPlayer} from '../../core_private'; import {StringMapWrapper} from '../facade/collection'; import {StringWrapper, isNumber, isPresent} from '../facade/lang'; +import {AnimationKeyframe, AnimationPlayer, AnimationStyles, NoOpAnimationPlayer} from '../private_import_core'; + import {AnimationDriver} from './animation_driver'; import {DomAnimatePlayer} from './dom_animate_player'; import {dashCaseToCamelCase} from './util'; diff --git a/modules/@angular/platform-browser/src/dom/web_animations_player.ts b/modules/@angular/platform-browser/src/dom/web_animations_player.ts index fdb0b6f98b..79749d6fb4 100644 --- a/modules/@angular/platform-browser/src/dom/web_animations_player.ts +++ b/modules/@angular/platform-browser/src/dom/web_animations_player.ts @@ -8,9 +8,9 @@ import {AUTO_STYLE} from '@angular/core'; -import {AnimationPlayer} from '../../core_private'; import {StringMapWrapper} from '../facade/collection'; import {isPresent} from '../facade/lang'; +import {AnimationPlayer} from '../private_import_core'; import {getDOM} from './dom_adapter'; import {DomAnimatePlayer} from './dom_animate_player'; diff --git a/modules/@angular/platform-browser/src/platform-browser.ts b/modules/@angular/platform-browser/src/platform-browser.ts new file mode 100644 index 0000000000..752772f501 --- /dev/null +++ b/modules/@angular/platform-browser/src/platform-browser.ts @@ -0,0 +1,31 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +export {BrowserModule, platformBrowser} from './browser'; +export {BrowserPlatformLocation} from './browser/location/browser_platform_location'; +export {Title} from './browser/title'; +export {disableDebugTools, enableDebugTools} from './browser/tools/tools'; +export {AnimationDriver} from './dom/animation_driver'; +export {By} from './dom/debug/by'; +export {DOCUMENT} from './dom/dom_tokens'; +export {EVENT_MANAGER_PLUGINS, EventManager} from './dom/events/event_manager'; +export {HAMMER_GESTURE_CONFIG, HammerGestureConfig} from './dom/events/hammer_gestures'; +export {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from './security/dom_sanitization_service'; +// Web Workers +export {ClientMessageBroker, ClientMessageBrokerFactory, FnArg, UiArguments} from './web_workers/shared/client_message_broker'; +export {PRIMITIVE} from './web_workers/shared/serializer'; +export {ReceivedMessage, ServiceMessageBroker, ServiceMessageBrokerFactory} from './web_workers/shared/service_message_broker'; + +export * from './web_workers/shared/message_bus'; +export {WORKER_APP_LOCATION_PROVIDERS} from './web_workers/worker/location_providers'; +export {WORKER_UI_LOCATION_PROVIDERS} from './web_workers/ui/location_providers'; + +export {NgProbeToken} from './dom/debug/ng_probe'; +export {platformWorkerUi, WebWorkerInstance, WORKER_SCRIPT, WORKER_UI_STARTABLE_MESSAGING_SERVICE} from './worker_render'; +export {platformWorkerApp, WorkerAppModule} from './worker_app'; +export * from './private_export'; diff --git a/modules/@angular/platform-browser/src/private_export.ts b/modules/@angular/platform-browser/src/private_export.ts new file mode 100644 index 0000000000..e88073203e --- /dev/null +++ b/modules/@angular/platform-browser/src/private_export.ts @@ -0,0 +1,48 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import {ClassProvider, ExistingProvider, FactoryProvider, Provider, TypeProvider, ValueProvider} from '@angular/core'; + +import * as browser from './browser'; +import * as browserDomAdapter from './browser/browser_adapter'; +import * as ng_probe from './dom/debug/ng_probe'; +import * as dom_adapter from './dom/dom_adapter'; +import * as dom_renderer from './dom/dom_renderer'; +import * as dom_events from './dom/events/dom_events'; +import * as shared_styles_host from './dom/shared_styles_host'; + +export var __platform_browser_private__: { + _DomAdapter?: typeof dom_adapter.DomAdapter; DomAdapter: typeof dom_adapter.DomAdapter; + _BrowserDomAdapter?: typeof browserDomAdapter.BrowserDomAdapter; + BrowserDomAdapter: typeof browserDomAdapter.BrowserDomAdapter; + getDOM: typeof dom_adapter.getDOM; + setRootDomAdapter: typeof dom_adapter.setRootDomAdapter; + _DomRootRenderer_?: typeof dom_renderer.DomRootRenderer; + DomRootRenderer_: typeof dom_renderer.DomRootRenderer_; + _DomSharedStylesHost?: typeof shared_styles_host.DomSharedStylesHost; + DomSharedStylesHost: typeof shared_styles_host.DomSharedStylesHost; + _SharedStylesHost?: typeof shared_styles_host.SharedStylesHost; + SharedStylesHost: typeof shared_styles_host.SharedStylesHost; + ELEMENT_PROBE_PROVIDERS: typeof ng_probe.ELEMENT_PROBE_PROVIDERS; + _DomEventsPlugin?: typeof dom_events.DomEventsPlugin; + DomEventsPlugin: typeof dom_events.DomEventsPlugin; + _initDomAdapter?: typeof browser.initDomAdapter, + initDomAdapter: typeof browser.initDomAdapter, + INTERNAL_BROWSER_PLATFORM_PROVIDERS: typeof browser.INTERNAL_BROWSER_PLATFORM_PROVIDERS; +} = { + DomAdapter: dom_adapter.DomAdapter, + BrowserDomAdapter: browserDomAdapter.BrowserDomAdapter, + getDOM: dom_adapter.getDOM, + setRootDomAdapter: dom_adapter.setRootDomAdapter, + DomRootRenderer_: dom_renderer.DomRootRenderer_, + DomSharedStylesHost: shared_styles_host.DomSharedStylesHost, + SharedStylesHost: shared_styles_host.SharedStylesHost, + ELEMENT_PROBE_PROVIDERS: ng_probe.ELEMENT_PROBE_PROVIDERS, + DomEventsPlugin: dom_events.DomEventsPlugin, + initDomAdapter: browser.initDomAdapter, + INTERNAL_BROWSER_PLATFORM_PROVIDERS: browser.INTERNAL_BROWSER_PLATFORM_PROVIDERS +}; diff --git a/modules/@angular/platform-browser/core_private.ts b/modules/@angular/platform-browser/src/private_import_core.ts similarity index 61% rename from modules/@angular/platform-browser/core_private.ts rename to modules/@angular/platform-browser/src/private_import_core.ts index 8348494109..8bdf1e573e 100644 --- a/modules/@angular/platform-browser/core_private.ts +++ b/modules/@angular/platform-browser/src/private_import_core.ts @@ -6,36 +6,31 @@ * found in the LICENSE file at https://angular.io/license */ -import {__core_private__ as r, __core_private_types__ as types} from '@angular/core'; +import {__core_private__ as r} from '@angular/core'; -export declare let _browser_core_private_types: types; - -export type RenderDebugInfo = typeof _browser_core_private_types.RenderDebugInfo; +export type RenderDebugInfo = typeof r._RenderDebugInfo; export var RenderDebugInfo: typeof r.RenderDebugInfo = r.RenderDebugInfo; -export var wtfInit: typeof r.wtfInit = r.wtfInit; export var ReflectionCapabilities: typeof r.ReflectionCapabilities = r.ReflectionCapabilities; export var VIEW_ENCAPSULATION_VALUES: typeof r.VIEW_ENCAPSULATION_VALUES = r.VIEW_ENCAPSULATION_VALUES; -export type DebugDomRootRenderer = typeof _browser_core_private_types.DebugDomRootRenderer; +export type DebugDomRootRenderer = typeof r._DebugDomRootRenderer; export var DebugDomRootRenderer: typeof r.DebugDomRootRenderer = r.DebugDomRootRenderer; export var reflector: typeof r.reflector = r.reflector; - -export type NoOpAnimationPlayer = typeof _browser_core_private_types.NoOpAnimationPlayer; +export type NoOpAnimationPlayer = typeof r._NoOpAnimationPlayer; export var NoOpAnimationPlayer: typeof r.NoOpAnimationPlayer = r.NoOpAnimationPlayer; -export type AnimationPlayer = typeof _browser_core_private_types.AnimationPlayer; +export type AnimationPlayer = typeof r._AnimationPlayer; export var AnimationPlayer: typeof r.AnimationPlayer = r.AnimationPlayer; -export type AnimationSequencePlayer = typeof _browser_core_private_types.AnimationSequencePlayer; +export type AnimationSequencePlayer = typeof r._AnimationSequencePlayer; export var AnimationSequencePlayer: typeof r.AnimationSequencePlayer = r.AnimationSequencePlayer; -export type AnimationGroupPlayer = typeof _browser_core_private_types.AnimationGroupPlayer; +export type AnimationGroupPlayer = typeof r._AnimationGroupPlayer; export var AnimationGroupPlayer: typeof r.AnimationGroupPlayer = r.AnimationGroupPlayer; -export type AnimationKeyframe = typeof _browser_core_private_types.AnimationKeyframe; +export type AnimationKeyframe = typeof r._AnimationKeyframe; export var AnimationKeyframe: typeof r.AnimationKeyframe = r.AnimationKeyframe; -export type AnimationStyles = typeof _browser_core_private_types.AnimationStyles; +export type AnimationStyles = typeof r._AnimationStyles; export var AnimationStyles: typeof r.AnimationStyles = r.AnimationStyles; export var prepareFinalAnimationStyles: typeof r.prepareFinalAnimationStyles = r.prepareFinalAnimationStyles; export var balanceAnimationKeyframes: typeof r.balanceAnimationKeyframes = r.balanceAnimationKeyframes; -export var flattenStyles: typeof r.flattenStyles = r.flattenStyles; export var clearStyles: typeof r.clearStyles = r.clearStyles; export var collectAndResolveStyles: typeof r.collectAndResolveStyles = r.collectAndResolveStyles; diff --git a/modules/@angular/platform-browser/src/web_workers/shared/serializer.ts b/modules/@angular/platform-browser/src/web_workers/shared/serializer.ts index 9fd0f72882..a1a2227aeb 100644 --- a/modules/@angular/platform-browser/src/web_workers/shared/serializer.ts +++ b/modules/@angular/platform-browser/src/web_workers/shared/serializer.ts @@ -8,9 +8,10 @@ import {Injectable, RenderComponentType, Type, ViewEncapsulation} from '@angular/core'; -import {VIEW_ENCAPSULATION_VALUES} from '../../../core_private'; import {Map, MapWrapper, StringMapWrapper} from '../../facade/collection'; import {isArray, isPresent, serializeEnum} from '../../facade/lang'; +import {VIEW_ENCAPSULATION_VALUES} from '../../private_import_core'; + import {RenderStore} from './render_store'; import {LocationType} from './serialized_types'; diff --git a/modules/@angular/platform-browser/src/web_workers/worker/renderer.ts b/modules/@angular/platform-browser/src/web_workers/worker/renderer.ts index 2889d3293b..6a66e53970 100644 --- a/modules/@angular/platform-browser/src/web_workers/worker/renderer.ts +++ b/modules/@angular/platform-browser/src/web_workers/worker/renderer.ts @@ -8,9 +8,9 @@ import {Injectable, RenderComponentType, Renderer, RootRenderer, ViewEncapsulation} from '@angular/core'; -import {AnimationKeyframe, AnimationPlayer, AnimationStyles, RenderDebugInfo} from '../../../core_private'; import {ListWrapper} from '../../facade/collection'; import {isBlank, isPresent} from '../../facade/lang'; +import {AnimationKeyframe, AnimationPlayer, AnimationStyles, RenderDebugInfo} from '../../private_import_core'; import {ClientMessageBrokerFactory, FnArg, UiArguments} from '../shared/client_message_broker'; import {MessageBus} from '../shared/message_bus'; import {EVENT_CHANNEL, RENDERER_CHANNEL} from '../shared/messaging_api'; diff --git a/modules/@angular/platform-browser/src/worker_app.ts b/modules/@angular/platform-browser/src/worker_app.ts index 06116e0c24..30d5ab6291 100644 --- a/modules/@angular/platform-browser/src/worker_app.ts +++ b/modules/@angular/platform-browser/src/worker_app.ts @@ -7,7 +7,8 @@ */ import {CommonModule} from '@angular/common'; -import {APP_INITIALIZER, ApplicationModule, ClassProvider, ErrorHandler, ExistingProvider, FactoryProvider, NgModule, NgZone, OpaqueToken, PlatformRef, ReflectiveInjector, RootRenderer, TypeProvider, ValueProvider, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core'; +import {APP_INITIALIZER, ApplicationModule, ClassProvider, ErrorHandler, ExistingProvider, FactoryProvider, NgModule, NgZone, PlatformRef, Provider, RootRenderer, TypeProvider, ValueProvider, createPlatformFactory, platformCore} from '@angular/core'; + import {BROWSER_SANITIZATION_PROVIDERS} from './browser'; import {print} from './facade/lang'; import {ON_WEB_WORKER} from './web_workers/shared/api'; @@ -21,6 +22,7 @@ import {WebWorkerRootRenderer} from './web_workers/worker/renderer'; import {WorkerDomAdapter} from './web_workers/worker/worker_adapter'; + /** * @experimental */ diff --git a/modules/@angular/platform-browser/src/worker_render.ts b/modules/@angular/platform-browser/src/worker_render.ts index 0ae03a8343..bc1879284e 100644 --- a/modules/@angular/platform-browser/src/worker_render.ts +++ b/modules/@angular/platform-browser/src/worker_render.ts @@ -8,8 +8,6 @@ import {ClassProvider, ErrorHandler, ExistingProvider, FactoryProvider, Injectable, Injector, NgZone, OpaqueToken, PLATFORM_INITIALIZER, PlatformRef, Provider, RootRenderer, Testability, TypeProvider, ValueProvider, createPlatformFactory, isDevMode, platformCore} from '@angular/core'; -import {wtfInit} from '../core_private'; - import {BROWSER_SANITIZATION_PROVIDERS} from './browser'; import {BrowserDomAdapter} from './browser/browser_adapter'; import {BrowserGetTestability} from './browser/testability'; @@ -121,7 +119,6 @@ function messageBusFactory(instance: WebWorkerInstance): MessageBus { function initWebWorkerRenderPlatform(injector: Injector): () => void { return () => { BrowserDomAdapter.makeCurrent(); - wtfInit(); BrowserGetTestability.init(); var scriptUri: string; try { diff --git a/modules/@angular/platform-browser/test/dom/web_animations_driver_spec.ts b/modules/@angular/platform-browser/test/dom/web_animations_driver_spec.ts index 1edfb81e10..4431598649 100644 --- a/modules/@angular/platform-browser/test/dom/web_animations_driver_spec.ts +++ b/modules/@angular/platform-browser/test/dom/web_animations_driver_spec.ts @@ -9,11 +9,11 @@ import {beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; import {el} from '@angular/platform-browser/testing/browser_util'; -import {AnimationKeyframe, AnimationStyles} from '../../core_private'; import {DomAnimatePlayer} from '../../src/dom/dom_animate_player'; import {WebAnimationsDriver} from '../../src/dom/web_animations_driver'; import {WebAnimationsPlayer} from '../../src/dom/web_animations_player'; import {StringMapWrapper} from '../../src/facade/collection'; +import {AnimationKeyframe, AnimationStyles} from '../../src/private_import_core'; import {MockDomAnimatePlayer} from '../../testing/mock_dom_animate_player'; class ExtendedWebAnimationsDriver extends WebAnimationsDriver { diff --git a/modules/@angular/platform-browser/test/web_workers/worker/renderer_integration_spec.ts b/modules/@angular/platform-browser/test/web_workers/worker/renderer_integration_spec.ts index 9348648b1a..2aeb8515ae 100644 --- a/modules/@angular/platform-browser/test/web_workers/worker/renderer_integration_spec.ts +++ b/modules/@angular/platform-browser/test/web_workers/worker/renderer_integration_spec.ts @@ -10,7 +10,6 @@ import {Component, ComponentRef, Injectable, Injector} from '@angular/core'; import {DebugDomRootRenderer} from '@angular/core/src/debug/debug_renderer'; import {RootRenderer} from '@angular/core/src/render/api'; import {TestBed} from '@angular/core/testing'; -import {platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {DomRootRenderer, DomRootRenderer_} from '@angular/platform-browser/src/dom/dom_renderer'; import {ClientMessageBrokerFactory, ClientMessageBrokerFactory_} from '@angular/platform-browser/src/web_workers/shared/client_message_broker'; @@ -19,10 +18,11 @@ import {Serializer} from '@angular/platform-browser/src/web_workers/shared/seria import {ServiceMessageBrokerFactory_} from '@angular/platform-browser/src/web_workers/shared/service_message_broker'; import {MessageBasedRenderer} from '@angular/platform-browser/src/web_workers/ui/renderer'; import {WebWorkerRootRenderer} from '@angular/platform-browser/src/web_workers/worker/renderer'; -import {BrowserTestingModule} from '@angular/platform-browser/testing'; import {expect} from '@angular/platform-browser/testing/matchers'; +import {platformBrowserDynamicTesting} from '../../../../platform-browser-dynamic/testing'; import {dispatchEvent} from '../../../../platform-browser/testing/browser_util'; +import {BrowserTestingModule} from '../../../testing'; import {PairedMessageBuses, createPairedMessageBuses} from '../shared/web_worker_test_util'; export function main() { diff --git a/modules/@angular/platform-browser/testing/benchmark_util.ts b/modules/@angular/platform-browser/testing/benchmark_util.ts index e2ae77cd06..d111fb7b10 100644 --- a/modules/@angular/platform-browser/testing/benchmark_util.ts +++ b/modules/@angular/platform-browser/testing/benchmark_util.ts @@ -7,9 +7,9 @@ */ -import {BrowserDomAdapter} from '../src/browser/browser_adapter'; -import {document, window} from '../src/facade/browser'; -import {NumberWrapper, isBlank} from '../src/facade/lang'; +import {document, window} from './facade/browser'; +import {NumberWrapper, isBlank} from './facade/lang'; +import {BrowserDomAdapter} from './private_import_platform-browser'; var DOM = new BrowserDomAdapter(); diff --git a/modules/@angular/platform-browser/testing/browser.ts b/modules/@angular/platform-browser/testing/browser.ts index 16c5e44d75..d173a33efb 100644 --- a/modules/@angular/platform-browser/testing/browser.ts +++ b/modules/@angular/platform-browser/testing/browser.ts @@ -5,15 +5,11 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ - import {APP_ID, ClassProvider, ExistingProvider, FactoryProvider, NgModule, NgZone, PLATFORM_INITIALIZER, PlatformRef, Provider, TypeProvider, ValueProvider, createPlatformFactory, platformCore} from '@angular/core'; - -import {BrowserModule} from '../src/browser'; -import {BrowserDomAdapter} from '../src/browser/browser_adapter'; -import {AnimationDriver} from '../src/dom/animation_driver'; -import {ELEMENT_PROBE_PROVIDERS} from '../src/dom/debug/ng_probe'; +import {AnimationDriver, BrowserModule} from '@angular/platform-browser'; import {BrowserDetection, createNgZone} from './browser_util'; +import {BrowserDomAdapter, ELEMENT_PROBE_PROVIDERS} from './private_import_platform-browser'; function initBrowserTests() { BrowserDomAdapter.makeCurrent(); diff --git a/modules/@angular/platform-browser/testing/browser_util.ts b/modules/@angular/platform-browser/testing/browser_util.ts index eebd2088e7..982ade42da 100644 --- a/modules/@angular/platform-browser/testing/browser_util.ts +++ b/modules/@angular/platform-browser/testing/browser_util.ts @@ -7,9 +7,10 @@ */ import {NgZone} from '@angular/core'; -import {getDOM} from '../src/dom/dom_adapter'; -import {ListWrapper} from '../src/facade/collection'; -import {RegExp, StringWrapper, global, isPresent, isString} from '../src/facade/lang'; + +import {ListWrapper} from './facade/collection'; +import {RegExp, StringWrapper, global, isPresent, isString} from './facade/lang'; +import {getDOM} from './private_import_platform-browser'; export class BrowserDetection { private _overrideUa: string; diff --git a/modules/@angular/platform-browser/testing/facade b/modules/@angular/platform-browser/testing/facade new file mode 120000 index 0000000000..e084c803c6 --- /dev/null +++ b/modules/@angular/platform-browser/testing/facade @@ -0,0 +1 @@ +../../facade/src \ No newline at end of file diff --git a/modules/@angular/core/src/profile/wtf_init.ts b/modules/@angular/platform-browser/testing/index.ts similarity index 61% rename from modules/@angular/core/src/profile/wtf_init.ts rename to modules/@angular/platform-browser/testing/index.ts index 05c10c73bf..fd7ecd2707 100644 --- a/modules/@angular/core/src/profile/wtf_init.ts +++ b/modules/@angular/platform-browser/testing/index.ts @@ -7,6 +7,8 @@ */ /** - * This is here because DART requires it. It is noop in JS. + * @module + * @description + * Entry point for all public APIs of the platform-browser/testing package. */ -export function wtfInit() {} +export * from './browser'; diff --git a/modules/@angular/platform-browser/testing/matchers.ts b/modules/@angular/platform-browser/testing/matchers.ts index 50f58967de..b904f09189 100644 --- a/modules/@angular/platform-browser/testing/matchers.ts +++ b/modules/@angular/platform-browser/testing/matchers.ts @@ -6,9 +6,10 @@ * found in the LICENSE file at https://angular.io/license */ -import {getDOM} from '../src/dom/dom_adapter'; -import {StringMapWrapper} from '../src/facade/collection'; -import {global, isString} from '../src/facade/lang'; +import {StringMapWrapper} from './facade/collection'; +import {global, isString} from './facade/lang'; +import {getDOM} from './private_import_platform-browser'; + /** * Jasmine matchers that check Angular specific conditions. diff --git a/modules/@angular/platform-browser/testing/mock_animation_driver.ts b/modules/@angular/platform-browser/testing/mock_animation_driver.ts index 7924288011..1719a2b964 100644 --- a/modules/@angular/platform-browser/testing/mock_animation_driver.ts +++ b/modules/@angular/platform-browser/testing/mock_animation_driver.ts @@ -8,10 +8,10 @@ import {AnimationPlayer} from '@angular/core'; import {MockAnimationPlayer} from '@angular/core/testing/testing_internal'; +import {AnimationDriver} from '@angular/platform-browser'; -import {AnimationKeyframe, AnimationStyles} from '../core_private'; -import {AnimationDriver} from '../src/dom/animation_driver'; -import {StringMapWrapper} from '../src/facade/collection'; +import {StringMapWrapper} from './facade/collection'; +import {AnimationKeyframe, AnimationStyles} from './private_import_core'; export class MockAnimationDriver extends AnimationDriver { public log: {[key: string]: any}[] = []; @@ -39,8 +39,8 @@ function _serializeKeyframes(keyframes: AnimationKeyframe[]): any[] { function _serializeStyles(styles: AnimationStyles): {[key: string]: any} { var flatStyles: {[key: string]: any} = {}; - styles.styles.forEach(entry => StringMapWrapper.forEach(entry, (val: any, prop: string) => { - flatStyles[prop] = val; - })); + styles.styles.forEach((entry: {[key: string]: string | number;}) => { + StringMapWrapper.forEach(entry, (val: any, prop: string) => { flatStyles[prop] = val; }); + }); return flatStyles; } diff --git a/modules/@angular/platform-browser/testing/private_import_core.ts b/modules/@angular/platform-browser/testing/private_import_core.ts new file mode 100644 index 0000000000..33e12811d8 --- /dev/null +++ b/modules/@angular/platform-browser/testing/private_import_core.ts @@ -0,0 +1,33 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import {__core_private__ as r} from '@angular/core'; + + +export type RenderDebugInfo = typeof r._RenderDebugInfo; +export var RenderDebugInfo: typeof r.RenderDebugInfo = r.RenderDebugInfo; +export var ReflectionCapabilities: typeof r.ReflectionCapabilities = r.ReflectionCapabilities; +export var reflector: typeof r.reflector = r.reflector; + +export type NoOpAnimationPlayer = typeof r._NoOpAnimationPlayer; +export var NoOpAnimationPlayer: typeof r.NoOpAnimationPlayer = r.NoOpAnimationPlayer; +export type AnimationPlayer = typeof r._AnimationPlayer; +export var AnimationPlayer: typeof r.AnimationPlayer = r.AnimationPlayer; +export type AnimationSequencePlayer = typeof r._AnimationSequencePlayer; +export var AnimationSequencePlayer: typeof r.AnimationSequencePlayer = r.AnimationSequencePlayer; +export type AnimationGroupPlayer = typeof r._AnimationGroupPlayer; +export var AnimationGroupPlayer: typeof r.AnimationGroupPlayer = r.AnimationGroupPlayer; +export type AnimationKeyframe = typeof r._AnimationKeyframe; +export var AnimationKeyframe: typeof r.AnimationKeyframe = r.AnimationKeyframe; +export type AnimationStyles = typeof r._AnimationStyles; +export var AnimationStyles: typeof r.AnimationStyles = r.AnimationStyles; +export var prepareFinalAnimationStyles: typeof r.prepareFinalAnimationStyles = + r.prepareFinalAnimationStyles; +export var balanceAnimationKeyframes: typeof r.balanceAnimationKeyframes = + r.balanceAnimationKeyframes; +export var clearStyles: typeof r.clearStyles = r.clearStyles; +export var collectAndResolveStyles: typeof r.collectAndResolveStyles = r.collectAndResolveStyles; diff --git a/modules/@angular/platform-browser/testing/private_import_platform-browser.ts b/modules/@angular/platform-browser/testing/private_import_platform-browser.ts new file mode 100644 index 0000000000..f5ccc6a047 --- /dev/null +++ b/modules/@angular/platform-browser/testing/private_import_platform-browser.ts @@ -0,0 +1,13 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {__platform_browser_private__ as _} from '@angular/platform-browser'; + +export var getDOM: typeof _.getDOM = _.getDOM; +export var BrowserDomAdapter: typeof _.BrowserDomAdapter = _.BrowserDomAdapter; +export var ELEMENT_PROBE_PROVIDERS: typeof _.ELEMENT_PROBE_PROVIDERS = _.ELEMENT_PROBE_PROVIDERS; diff --git a/modules/@angular/platform-browser/tsconfig-es2015.json b/modules/@angular/platform-browser/tsconfig-es2015.json deleted file mode 100644 index 992c4bea76..0000000000 --- a/modules/@angular/platform-browser/tsconfig-es2015.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": ".", - "declaration": true, - "stripInternal": true, - "experimentalDecorators": true, - "module": "es2015", - "moduleResolution": "node", - "outDir": "../../../dist/packages-dist/platform-browser/esm", - "paths": { - "@angular/core": ["../../../dist/packages-dist/core"], - "@angular/core/testing": ["../../../dist/packages-dist/core/testing"], - "@angular/common": ["../../../dist/packages-dist/common"], - "@angular/common/testing": ["../../../dist/packages-dist/common/testing"], - - // workaround for https://github.com/Microsoft/TypeScript/issues/8723 - // we can get rid of this once we update to typescript 1.9.0-dev.20160525-1.0 or newer - "selenium-webdriver": ["../../../node_modules/@types/selenium-webdriver/index.d.ts"] - }, - "rootDir": ".", - "sourceMap": true, - "inlineSources": true, - "target": "es2015" - }, - "files": [ - "index.ts", - "testing.ts", - "../../../node_modules/@types/hammerjs/index.d.ts", - "../../../node_modules/@types/jasmine/index.d.ts", - "../../../node_modules/@types/protractor/index.d.ts", - "../../../node_modules/zone.js/dist/zone.js.d.ts" - ], - "angularCompilerOptions": { - "strictMetadataEmit": true - } -} diff --git a/modules/@angular/platform-browser/tsconfig-es5.json b/modules/@angular/platform-browser/tsconfig-testing.json similarity index 73% rename from modules/@angular/platform-browser/tsconfig-es5.json rename to modules/@angular/platform-browser/tsconfig-testing.json index 700f4f8874..2bf8969531 100644 --- a/modules/@angular/platform-browser/tsconfig-es5.json +++ b/modules/@angular/platform-browser/tsconfig-testing.json @@ -4,7 +4,7 @@ "declaration": true, "stripInternal": true, "experimentalDecorators": true, - "module": "commonjs", + "module": "es2015", "moduleResolution": "node", "outDir": "../../../dist/packages-dist/platform-browser/", "paths": { @@ -12,20 +12,17 @@ "@angular/core/testing": ["../../../dist/packages-dist/core/testing"], "@angular/common": ["../../../dist/packages-dist/common"], "@angular/common/testing": ["../../../dist/packages-dist/common/testing"], - - // workaround for https://github.com/Microsoft/TypeScript/issues/8723 - // we can get rid of this once we update to typescript 1.9.0-dev.20160525-1.0 or newer - "selenium-webdriver": ["../../../node_modules/@types/selenium-webdriver/index.d.ts"] + "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"] }, "rootDir": ".", "sourceMap": true, "inlineSources": true, "lib": ["es6", "dom"], - "target": "es5" + "target": "es5", + "skipLibCheck": true }, "files": [ - "index.ts", - "testing.ts", + "testing/index.ts", "../../../node_modules/@types/hammerjs/index.d.ts", "../../../node_modules/@types/jasmine/index.d.ts", "../../../node_modules/@types/protractor/index.d.ts", diff --git a/modules/@angular/http/tsconfig-es5.json b/modules/@angular/platform-browser/tsconfig.json similarity index 62% rename from modules/@angular/http/tsconfig-es5.json rename to modules/@angular/platform-browser/tsconfig.json index 30cda4be59..c76820f48e 100644 --- a/modules/@angular/http/tsconfig-es5.json +++ b/modules/@angular/platform-browser/tsconfig.json @@ -4,23 +4,23 @@ "declaration": true, "stripInternal": true, "experimentalDecorators": true, - "module": "commonjs", + "module": "es2015", "moduleResolution": "node", - "outDir": "../../../dist/packages-dist/http/", + "outDir": "../../../dist/packages-dist/platform-browser", "paths": { "@angular/core": ["../../../dist/packages-dist/core"], - "@angular/common": ["../../../dist/packages-dist/common"], - "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"] + "@angular/common": ["../../../dist/packages-dist/common"] }, "rootDir": ".", "sourceMap": true, "inlineSources": true, - "lib": ["es6", "dom"], - "target": "es5" + "target": "es5", + "skipLibCheck": true, + "lib": ["es2015", "dom"] }, "files": [ "index.ts", - "testing.ts", + "../../../node_modules/@types/hammerjs/index.d.ts", "../../../node_modules/zone.js/dist/zone.js.d.ts" ], "angularCompilerOptions": { diff --git a/modules/@angular/platform-server/index.ts b/modules/@angular/platform-server/index.ts index b5b90b4d74..405b49a6b5 100644 --- a/modules/@angular/platform-server/index.ts +++ b/modules/@angular/platform-server/index.ts @@ -6,4 +6,11 @@ * found in the LICENSE file at https://angular.io/license */ -export {ServerModule, platformDynamicServer, platformServer} from './src/server'; +/** + * @module + * @description + * Entry point for all public APIs of the platform-server package. + */ +export * from './src/platform-server'; + +// This file only reexports content of the `src` folder. Keep it that way. diff --git a/modules/@angular/platform-server/package.json b/modules/@angular/platform-server/package.json index 2e0d830f2d..529c3ec2c2 100644 --- a/modules/@angular/platform-server/package.json +++ b/modules/@angular/platform-server/package.json @@ -1,9 +1,9 @@ { "name": "@angular/platform-server", "version": "0.0.0-PLACEHOLDER", - "description": "", - "main": "index.js", - "jsnext:main": "esm/index.js", + "description": "Angular 2 platform-server", + "main": "bundles/platform-server.umd.js", + "module": "index.js", "typings": "index.d.ts", "author": "angular", "license": "MIT", diff --git a/modules/@angular/platform-server/platform_browser_dynamic_testing_private.ts b/modules/@angular/platform-server/platform_browser_dynamic_testing_private.ts deleted file mode 100644 index dda86a93e7..0000000000 --- a/modules/@angular/platform-server/platform_browser_dynamic_testing_private.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {__platform_browser_dynamic_private__ as r} from '@angular/platform-browser-dynamic/testing'; - -export var DOMTestComponentRenderer: typeof r.DOMTestComponentRenderer = r.DOMTestComponentRenderer; diff --git a/modules/@angular/platform-server/platform_browser_private.ts b/modules/@angular/platform-server/platform_browser_private.ts deleted file mode 100644 index 8656575dbd..0000000000 --- a/modules/@angular/platform-server/platform_browser_private.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {__platform_browser_private__ as r, __platform_browser_private_types__ as types} from '@angular/platform-browser'; - -export declare let _server_platform_browser_private_types: types; - -export type DomAdapter = typeof _server_platform_browser_private_types.DomAdapter; -export var DomAdapter: typeof r.DomAdapter = r.DomAdapter; -export var setRootDomAdapter: typeof r.setRootDomAdapter = r.setRootDomAdapter; -export var getDOM: typeof r.getDOM = r.getDOM; -export type DomRootRenderer = typeof _server_platform_browser_private_types.DomRootRenderer; -export var DomRootRenderer: typeof r.DomRootRenderer = r.DomRootRenderer; -export type DomRootRenderer_ = typeof _server_platform_browser_private_types.DomRootRenderer_; -export var DomRootRenderer_: typeof r.DomRootRenderer_ = r.DomRootRenderer_; -export type DomSharedStylesHost = typeof _server_platform_browser_private_types.DomSharedStylesHost; -export var DomSharedStylesHost: typeof r.DomSharedStylesHost = r.DomSharedStylesHost; -export type SharedStylesHost = typeof _server_platform_browser_private_types.SharedStylesHost; -export var SharedStylesHost: typeof r.SharedStylesHost = r.SharedStylesHost; -export var ELEMENT_PROBE_PROVIDERS: typeof r.ELEMENT_PROBE_PROVIDERS = r.ELEMENT_PROBE_PROVIDERS; -export type DomEventsPlugin = typeof _server_platform_browser_private_types.DomEventsPlugin; -export var DomEventsPlugin: typeof r.DomEventsPlugin = r.DomEventsPlugin; diff --git a/modules/@angular/platform-server/rollup-testing.config.js b/modules/@angular/platform-server/rollup-testing.config.js new file mode 100644 index 0000000000..db243a5262 --- /dev/null +++ b/modules/@angular/platform-server/rollup-testing.config.js @@ -0,0 +1,20 @@ + +export default { + entry: '../../../dist/packages-dist/platform-server/testing/index.js', + dest: '../../../dist/packages-dist/platform-server/bundles/platform-server-testing.umd.js', + format: 'umd', + moduleName: 'ng.platformServer.testing', + globals: { + '@angular/core': 'ng.core', + '@angular/common': 'ng.common', + '@angular/compiler': 'ng.compiler', + '@angular/compiler/testing': 'ng.compiler.testing', + '@angular/platform-browser': 'ng.platformBrowser', + '@angular/platform-server': 'ng.platformServer', + '@angular/platform-browser-dynamic/testing': 'ng.platformBrowserDynamic.testing', + 'rxjs/Subject': 'Rx', + 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. + 'rxjs/operator/toPromise': 'Rx.Observable.prototype', + 'rxjs/Observable': 'Rx' + } +} diff --git a/modules/@angular/platform-server/rollup.config.js b/modules/@angular/platform-server/rollup.config.js index 282441b574..68ec9b71dc 100644 --- a/modules/@angular/platform-server/rollup.config.js +++ b/modules/@angular/platform-server/rollup.config.js @@ -1,19 +1,17 @@ export default { - entry: '../../../dist/packages-dist/platform-server/esm/index.js', - dest: '../../../dist/packages-dist/platform-server/esm/platform-server.umd.js', + entry: '../../../dist/packages-dist/platform-server/index.js', + dest: '../../../dist/packages-dist/platform-server/bundles/platform-server.umd.js', format: 'umd', moduleName: 'ng.platformServer', globals: { '@angular/core': 'ng.core', + '@angular/common': 'ng.common', '@angular/compiler': 'ng.compiler', '@angular/platform-browser': 'ng.platformBrowser', 'rxjs/Subject': 'Rx', 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. 'rxjs/operator/toPromise': 'Rx.Observable.prototype', 'rxjs/Observable': 'Rx' - }, - plugins: [ -// nodeResolve({ jsnext: true, main: true }), - ] + } } diff --git a/modules/@angular/platform-server/src/parse5_adapter.ts b/modules/@angular/platform-server/src/parse5_adapter.ts index ad3f46fd69..8fdbbff98a 100644 --- a/modules/@angular/platform-server/src/parse5_adapter.ts +++ b/modules/@angular/platform-server/src/parse5_adapter.ts @@ -9,9 +9,9 @@ var parse5 = require('parse5/index'); import {ListWrapper, StringMapWrapper} from '../src/facade/collection'; -import {DomAdapter, setRootDomAdapter} from '../platform_browser_private'; +import {DomAdapter, setRootDomAdapter} from './private_import_platform-browser'; import {isPresent, isBlank, global, setValueOnPath, DateWrapper} from '../src/facade/lang'; -import {SelectorMatcher, CssSelector} from '../compiler_private'; +import {SelectorMatcher, CssSelector} from './private_import_compiler'; import {Type} from '@angular/core'; import {ResourceLoader} from '@angular/compiler'; diff --git a/modules/@angular/platform-browser/testing.ts b/modules/@angular/platform-server/src/platform-server.ts similarity index 64% rename from modules/@angular/platform-browser/testing.ts rename to modules/@angular/platform-server/src/platform-server.ts index d506a75e90..28faa83c03 100644 --- a/modules/@angular/platform-browser/testing.ts +++ b/modules/@angular/platform-server/src/platform-server.ts @@ -6,4 +6,5 @@ * found in the LICENSE file at https://angular.io/license */ -export * from './testing/browser'; +export {ServerModule, platformDynamicServer, platformServer} from './server'; +export * from './private_export'; diff --git a/modules/@angular/platform-server/src/private_export.ts b/modules/@angular/platform-server/src/private_export.ts new file mode 100644 index 0000000000..30c91b0601 --- /dev/null +++ b/modules/@angular/platform-server/src/private_export.ts @@ -0,0 +1,15 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {ClassProvider, ExistingProvider, FactoryProvider, Provider, TypeProvider, ValueProvider} from '@angular/core'; +import {INTERNAL_SERVER_PLATFORM_PROVIDERS} from './server'; + +export var __platform_server_private__: + {INTERNAL_SERVER_PLATFORM_PROVIDERS: typeof INTERNAL_SERVER_PLATFORM_PROVIDERS} = { + INTERNAL_SERVER_PLATFORM_PROVIDERS: INTERNAL_SERVER_PLATFORM_PROVIDERS + }; diff --git a/modules/@angular/platform-server/compiler_private.ts b/modules/@angular/platform-server/src/private_import_compiler.ts similarity index 100% rename from modules/@angular/platform-server/compiler_private.ts rename to modules/@angular/platform-server/src/private_import_compiler.ts diff --git a/modules/@angular/platform-server/core_private.ts b/modules/@angular/platform-server/src/private_import_core.ts similarity index 90% rename from modules/@angular/platform-server/core_private.ts rename to modules/@angular/platform-server/src/private_import_core.ts index 7bda5be195..1ee792590f 100644 --- a/modules/@angular/platform-server/core_private.ts +++ b/modules/@angular/platform-server/src/private_import_core.ts @@ -10,5 +10,4 @@ import {__core_private__ as r} from '@angular/core'; export var reflector: typeof r.reflector = r.reflector; export var ReflectionCapabilities: typeof r.ReflectionCapabilities = r.ReflectionCapabilities; -export var wtfInit: typeof r.wtfInit = r.wtfInit; export var Console: typeof r.Console = r.Console; diff --git a/modules/@angular/platform-server/src/private_import_platform-browser.ts b/modules/@angular/platform-server/src/private_import_platform-browser.ts new file mode 100644 index 0000000000..d15eed3397 --- /dev/null +++ b/modules/@angular/platform-server/src/private_import_platform-browser.ts @@ -0,0 +1,14 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {__platform_browser_private__ as _} from '@angular/platform-browser'; + +export type DomAdapter = typeof _._DomAdapter; +export var DomAdapter: typeof _.DomAdapter = _.DomAdapter; +export var setRootDomAdapter: typeof _.setRootDomAdapter = _.setRootDomAdapter; +export var getDOM: typeof _.getDOM = _.getDOM; diff --git a/modules/@angular/platform-server/src/server.ts b/modules/@angular/platform-server/src/server.ts index 01330458bb..12fea48505 100644 --- a/modules/@angular/platform-server/src/server.ts +++ b/modules/@angular/platform-server/src/server.ts @@ -8,11 +8,8 @@ import {PlatformLocation} from '@angular/common'; import {platformCoreDynamic} from '@angular/compiler'; -import {ClassProvider, ExistingProvider, FactoryProvider, NgModule, PLATFORM_INITIALIZER, PlatformRef, TypeProvider, ValueProvider, createPlatformFactory, platformCore} from '@angular/core'; +import {ClassProvider, ExistingProvider, FactoryProvider, NgModule, PLATFORM_INITIALIZER, PlatformRef, Provider, TypeProvider, ValueProvider, createPlatformFactory, platformCore} from '@angular/core'; import {BrowserModule} from '@angular/platform-browser'; - -import {wtfInit} from '../core_private'; - import {Parse5DomAdapter} from './parse5_adapter'; function notSupported(feature: string): Error { @@ -39,7 +36,6 @@ export const INTERNAL_SERVER_PLATFORM_PROVIDERS: Array offlineMode ? of (t) : fromPromise(this.compiler.compileModuleAsync(t))); } } -} \ No newline at end of file +} diff --git a/modules/@angular/router/testing.ts b/modules/@angular/router/testing.ts deleted file mode 100644 index c4ed344c93..0000000000 --- a/modules/@angular/router/testing.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -export * from './testing/router_testing_module'; \ No newline at end of file diff --git a/modules/@angular/router/testing/facade b/modules/@angular/router/testing/facade new file mode 120000 index 0000000000..e084c803c6 --- /dev/null +++ b/modules/@angular/router/testing/facade @@ -0,0 +1 @@ +../../facade/src \ No newline at end of file diff --git a/modules/@angular/router/testing/index.ts b/modules/@angular/router/testing/index.ts new file mode 100644 index 0000000000..13559e8b61 --- /dev/null +++ b/modules/@angular/router/testing/index.ts @@ -0,0 +1,14 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +/** + * @module + * @description + * Entry point for all public APIs of the router/testing package. + */ +export * from './router_testing_module'; diff --git a/modules/@angular/router/testing/private_import_router.ts b/modules/@angular/router/testing/private_import_router.ts new file mode 100644 index 0000000000..e671528ef4 --- /dev/null +++ b/modules/@angular/router/testing/private_import_router.ts @@ -0,0 +1,13 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {__router_private__ as _} from '@angular/router'; + +export var ROUTER_PROVIDERS: typeof _.ROUTER_PROVIDERS = _.ROUTER_PROVIDERS; +export var ROUTES: typeof _.ROUTES = _.ROUTES; +export var flatten: typeof _.flatten = _.flatten; diff --git a/modules/@angular/router/testing/router_testing_module.ts b/modules/@angular/router/testing/router_testing_module.ts index 9f37ddbbc4..bc2a74a415 100644 --- a/modules/@angular/router/testing/router_testing_module.ts +++ b/modules/@angular/router/testing/router_testing_module.ts @@ -9,14 +9,9 @@ import {Location, LocationStrategy} from '@angular/common'; import {MockLocationStrategy, SpyLocation} from '@angular/common/testing'; import {Compiler, Injectable, Injector, ModuleWithProviders, NgModule, NgModuleFactory, NgModuleFactoryLoader} from '@angular/core'; +import {Route, Router, RouterModule, RouterOutletMap, Routes, UrlSerializer, provideRoutes} from '@angular/router'; -import {Route, Router, RouterOutletMap, UrlSerializer} from '../index'; -import {Routes} from '../src/config'; -import {ROUTES} from '../src/router_config_loader'; -import {ROUTER_PROVIDERS, RouterModule, provideRoutes} from '../src/router_module'; -import {flatten} from '../src/utils/collection'; - - +import {ROUTER_PROVIDERS, ROUTES, flatten} from './private_import_router'; /** * A spy for {@link NgModuleFactoryLoader} that allows tests to simulate the loading of ng module diff --git a/modules/@angular/router/tsconfig-es2015.json b/modules/@angular/router/tsconfig-es2015.json deleted file mode 100644 index ee18acc791..0000000000 --- a/modules/@angular/router/tsconfig-es2015.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": ".", - "declaration": true, - "stripInternal": true, - "experimentalDecorators": true, - "module": "es2015", - "moduleResolution": "node", - "outDir": "../../../dist/packages-dist/router/esm", - "paths": { - "@angular/core": ["../../../dist/packages-dist/core"], - "@angular/common": ["../../../dist/packages-dist/common"], - "@angular/common/testing": ["../../../dist/packages-dist/common/testing"], - "@angular/compiler": ["../../../dist/packages-dist/compiler"], - "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"], - "@angular/platform-browser-dynamic": ["../../../dist/packages-dist/platform-browser-dynamic"] - }, - "rootDir": ".", - "sourceMap": true, - "inlineSources": true, - "lib": ["es6", "dom"], - "target": "es6" - }, - "files": [ - "index.ts", - "testing.ts" - ], - "angularCompilerOptions": { - "strictMetadataEmit": true - } -} \ No newline at end of file diff --git a/modules/@angular/router/tsconfig-es5.json b/modules/@angular/router/tsconfig-testing.json similarity index 72% rename from modules/@angular/router/tsconfig-es5.json rename to modules/@angular/router/tsconfig-testing.json index 08e863d47e..242fa3e099 100644 --- a/modules/@angular/router/tsconfig-es5.json +++ b/modules/@angular/router/tsconfig-testing.json @@ -3,27 +3,30 @@ "baseUrl": ".", "declaration": true, "stripInternal": true, + "emitDecoratorMetadata": true, "experimentalDecorators": true, - "module": "commonjs", + "module": "es2015", "moduleResolution": "node", + "noEmitOnError": false, + "noImplicitAny": true, + "noImplicitReturns": true, "outDir": "../../../dist/packages-dist/router/", "paths": { "@angular/core": ["../../../dist/packages-dist/core"], "@angular/common": ["../../../dist/packages-dist/common"], "@angular/common/testing": ["../../../dist/packages-dist/common/testing"], - "@angular/compiler": ["../../../dist/packages-dist/compiler"], "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"], - "@angular/platform-browser-dynamic": ["../../../dist/packages-dist/platform-browser-dynamic"] + "@angular/router": ["../../../dist/packages-dist/router"] }, "rootDir": ".", "sourceMap": true, "inlineSources": true, "lib": ["es6", "dom"], - "target": "es5" + "target": "es5", + "skipLibCheck": true }, "files": [ - "index.ts", - "testing.ts" + "testing/index.ts" ], "angularCompilerOptions": { "strictMetadataEmit": true diff --git a/modules/@angular/router/tsconfig.json b/modules/@angular/router/tsconfig.json index 1f3ee0da11..59c180ca0a 100644 --- a/modules/@angular/router/tsconfig.json +++ b/modules/@angular/router/tsconfig.json @@ -5,37 +5,28 @@ "stripInternal": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, - "module": "commonjs", + "module": "es2015", "moduleResolution": "node", "noEmitOnError": false, "noImplicitAny": true, "noImplicitReturns": true, - "outDir": "../../../dist/all/@angular/router/", + "outDir": "../../../dist/packages-dist/router", "paths": { - "@angular/*": ["../../../dist/all/@angular/*"] + "@angular/core": ["../../../dist/packages-dist/core"], + "@angular/common": ["../../../dist/packages-dist/common"], + "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"] }, "rootDir": ".", "sourceMap": true, "inlineSources": true, - "lib": ["es6", "dom"], - "target": "es5" + "lib": ["es2015", "dom"], + "target": "es5", + "skipLibCheck": true }, "files": [ - "index.ts", - "testing.ts", - "test/url_tree.spec.ts", - "test/utils/tree.spec.ts", - "test/url_serializer.spec.ts", - "test/apply_redirects.spec.ts", - "test/recognize.spec.ts", - "test/create_router_state.spec.ts", - "test/create_url_tree.spec.ts", - "test/config.spec.ts", - "test/router_state.spec.ts", - "test/router.spec.ts", - "test/integration.spec.ts", - "../../../node_modules/@types/jasmine/index.d.ts" - ] + "index.ts" + ], + "angularCompilerOptions": { + "strictMetadataEmit": true + } } - - diff --git a/modules/@angular/upgrade/index.ts b/modules/@angular/upgrade/index.ts index e75ef9dad8..a2c3215212 100644 --- a/modules/@angular/upgrade/index.ts +++ b/modules/@angular/upgrade/index.ts @@ -6,4 +6,11 @@ * found in the LICENSE file at https://angular.io/license */ -export * from './upgrade'; +/** + * @module + * @description + * Entry point for all public APIs of the upgrade package. + */ +export * from './src/upgrade'; + +// This file only reexports content of the `src` folder. Keep it that way. diff --git a/modules/@angular/upgrade/package.json b/modules/@angular/upgrade/package.json index 07bc88ac56..ccd12ee05e 100644 --- a/modules/@angular/upgrade/package.json +++ b/modules/@angular/upgrade/package.json @@ -2,8 +2,9 @@ "name": "@angular/upgrade", "version": "0.0.0-PLACEHOLDER", "description": "", - "main": "upgrade.js", - "jsnext:main": "esm/upgrade.js", + "main": "bundles/core.umd.js", + "module": "index.js", + "typings": "index.d.ts", "author": "angular", "license": "MIT", "peerDependencies": { diff --git a/modules/@angular/upgrade/rollup.config.js b/modules/@angular/upgrade/rollup.config.js index 0b23f0fd5b..b14fc3c2c1 100644 --- a/modules/@angular/upgrade/rollup.config.js +++ b/modules/@angular/upgrade/rollup.config.js @@ -1,7 +1,7 @@ export default { - entry: '../../../dist/packages-dist/upgrade/esm/index.js', - dest: '../../../dist/packages-dist/upgrade/esm/upgrade.umd.js', + entry: '../../../dist/packages-dist/upgrade/index.js', + dest: '../../../dist/packages-dist/upgrade/bundles/upgrade.umd.js', format: 'umd', moduleName: 'ng.upgrade', globals: { @@ -14,6 +14,5 @@ export default { 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. 'rxjs/operator/toPromise': 'Rx.Observable.prototype', 'rxjs/Observable': 'Rx' - }, - plugins: [] + } } diff --git a/modules/@angular/upgrade/upgrade.ts b/modules/@angular/upgrade/src/upgrade.ts similarity index 81% rename from modules/@angular/upgrade/upgrade.ts rename to modules/@angular/upgrade/src/upgrade.ts index d7bdfe0611..bbe55ed737 100644 --- a/modules/@angular/upgrade/upgrade.ts +++ b/modules/@angular/upgrade/src/upgrade.ts @@ -11,4 +11,4 @@ * @description * Adapter allowing AngularJS v1 and Angular v2 to run side by side in the same application. */ -export {UpgradeAdapter, UpgradeAdapterRef} from './src/upgrade_adapter'; +export {UpgradeAdapter, UpgradeAdapterRef} from './upgrade_adapter'; diff --git a/modules/@angular/upgrade/tsconfig-es2015.json b/modules/@angular/upgrade/tsconfig.json similarity index 86% rename from modules/@angular/upgrade/tsconfig-es2015.json rename to modules/@angular/upgrade/tsconfig.json index dc2556a986..7692373f4a 100644 --- a/modules/@angular/upgrade/tsconfig-es2015.json +++ b/modules/@angular/upgrade/tsconfig.json @@ -6,7 +6,7 @@ "experimentalDecorators": true, "module": "es2015", "moduleResolution": "node", - "outDir": "../../../dist/packages-dist/upgrade/esm", + "outDir": "../../../dist/packages-dist/upgrade", "paths": { "@angular/core": ["../../../dist/packages-dist/core"], "@angular/common": ["../../../dist/packages-dist/common"], @@ -17,7 +17,9 @@ "rootDir": ".", "sourceMap": true, "inlineSources": true, - "target": "es2015" + "target": "es5", + "skipLibCheck": true, + "lib": [ "es2015", "dom" ] }, "files": [ "index.ts", diff --git a/modules/tsconfig.json b/modules/tsconfig.json index fa0d16eeb6..0ca7b774c8 100644 --- a/modules/tsconfig.json +++ b/modules/tsconfig.json @@ -19,6 +19,7 @@ "inlineSourceMap": true, "lib": ["es5", "dom", "es2015.promise", "es2015.collection", "es2015.iterable"], "skipDefaultLibCheck": true, + "skipLibCheck": true, "target": "es5" }, "exclude": [ diff --git a/npm-shrinkwrap.clean.json b/npm-shrinkwrap.clean.json index ad49c79202..f568a87bab 100644 --- a/npm-shrinkwrap.clean.json +++ b/npm-shrinkwrap.clean.json @@ -208,7 +208,7 @@ "version": "1.0.2" }, "balanced-match": { - "version": "0.3.0" + "version": "0.4.2" }, "base62": { "version": "0.1.1" @@ -1427,7 +1427,7 @@ } }, "brace-expansion": { - "version": "1.1.2" + "version": "1.1.6" }, "braces": { "version": "1.8.3" @@ -1599,6 +1599,9 @@ "buffers": { "version": "0.1.1" }, + "bufferutil": { + "version": "1.2.1" + }, "builtin-modules": { "version": "1.1.1" }, @@ -2337,6 +2340,9 @@ "fs-tree-diff": { "version": "0.3.1" }, + "fs.realpath": { + "version": "1.0.0" + }, "fsevents": { "version": "1.0.6", "dependencies": { @@ -3101,7 +3107,7 @@ } }, "gulp-tslint": { - "version": "5.0.0" + "version": "6.1.1" }, "gulp-typescript": { "version": "2.10.0", @@ -5339,11 +5345,14 @@ "version": "0.1.32" } } + }, + "typescript": { + "version": "1.9.0-dev.20160409" } } }, "tsickle": { - "version": "0.1.6", + "version": "0.1.7", "dependencies": { "source-map": { "version": "0.4.4" @@ -5359,7 +5368,7 @@ } }, "tslint": { - "version": "3.10.0-dev.2", + "version": "3.15.0-dev.0", "dependencies": { "findup-sync": { "version": "0.3.0", @@ -5370,7 +5379,12 @@ } }, "glob": { - "version": "7.0.3" + "version": "7.0.6", + "dependencies": { + "minimatch": { + "version": "3.0.3" + } + } }, "resolve": { "version": "1.1.7" @@ -5404,7 +5418,7 @@ "version": "0.0.6" }, "typescript": { - "version": "1.9.0-dev.20160409" + "version": "2.1.0-dev.20160827" }, "ua-parser-js": { "version": "0.7.10" diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index a96e85f74a..320a50f829 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -340,9 +340,9 @@ "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz" }, "balanced-match": { - "version": "0.3.0", - "from": "balanced-match@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz" + "version": "0.4.2", + "from": "balanced-match@>=0.4.1 <0.5.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz" }, "base62": { "version": "0.1.1", @@ -2225,9 +2225,9 @@ } }, "brace-expansion": { - "version": "1.1.2", + "version": "1.1.6", "from": "brace-expansion@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz" + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz" }, "braces": { "version": "1.8.3", @@ -2499,6 +2499,11 @@ "from": "buffers@>=0.1.1 <0.2.0", "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz" }, + "bufferutil": { + "version": "1.2.1", + "from": "bufferutil@>=1.2.0 <1.3.0", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-1.2.1.tgz" + }, "builtin-modules": { "version": "1.1.1", "from": "builtin-modules@>=1.0.0 <2.0.0", @@ -2955,7 +2960,7 @@ }, "core-js": { "version": "2.4.1", - "from": "core-js@latest", + "from": "core-js@2.4.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz" }, "core-object": { @@ -3689,6 +3694,11 @@ "from": "fs-tree-diff@>=0.3.0 <0.4.0", "resolved": "https://registry.npmjs.org/fs-tree-diff/-/fs-tree-diff-0.3.1.tgz" }, + "fs.realpath": { + "version": "1.0.0", + "from": "fs.realpath@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" + }, "fsevents": { "version": "1.0.6", "from": "fsevents@>=1.0.0 <2.0.0", @@ -4911,9 +4921,9 @@ } }, "gulp-tslint": { - "version": "5.0.0", - "from": "gulp-tslint@5.0.0", - "resolved": "https://registry.npmjs.org/gulp-tslint/-/gulp-tslint-5.0.0.tgz" + "version": "6.1.1", + "from": "gulp-tslint@latest", + "resolved": "https://registry.npmjs.org/gulp-tslint/-/gulp-tslint-6.1.1.tgz" }, "gulp-typescript": { "version": "2.10.0", @@ -6464,7 +6474,7 @@ }, "minimist": { "version": "1.2.0", - "from": "minimist@1.2.0", + "from": "minimist@>=1.2.0 <2.0.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz" }, "mkdirp": { @@ -8517,13 +8527,18 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.32.tgz" } } + }, + "typescript": { + "version": "1.9.0-dev.20160409", + "from": "typescript@1.9.0-dev.20160409", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.9.0-dev.20160409.tgz" } } }, "tsickle": { - "version": "0.1.6", - "from": "tsickle@0.1.6", - "resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.1.6.tgz", + "version": "0.1.7", + "from": "tsickle@0.1.7", + "resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.1.7.tgz", "dependencies": { "source-map": { "version": "0.4.4", @@ -8545,9 +8560,9 @@ } }, "tslint": { - "version": "3.10.0-dev.2", - "from": "tslint@3.10.0-dev.2", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-3.10.0-dev.2.tgz", + "version": "3.15.0-dev.0", + "from": "tslint@next", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-3.15.0-dev.0.tgz", "dependencies": { "findup-sync": { "version": "0.3.0", @@ -8562,9 +8577,16 @@ } }, "glob": { - "version": "7.0.3", + "version": "7.0.6", "from": "glob@>=7.0.3 <8.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.0.3.tgz" + "resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz", + "dependencies": { + "minimatch": { + "version": "3.0.3", + "from": "minimatch@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz" + } + } }, "resolve": { "version": "1.1.7", @@ -8616,9 +8638,9 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" }, "typescript": { - "version": "1.9.0-dev.20160409", + "version": "2.1.0-dev.20160827", "from": "typescript@next", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.9.0-dev.20160409.tgz" + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.1.0-dev.20160827.tgz" }, "ua-parser-js": { "version": "0.7.10", diff --git a/package.json b/package.json index 7fbde5c023..ffe27c0a9c 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "gulp-sass": "^2.0.4", "gulp-shell": "^0.5.1", "gulp-sourcemaps": "^1.6.0", - "gulp-tslint": "^5.0.0", + "gulp-tslint": "^6.1.1", "gulp-typescript": "^2.10.0", "gulp-uglify": "^1.2.0", "hash-files": "^1.0.0", @@ -109,9 +109,9 @@ "through2": "^0.6.5", "ts-api-guardian": "0.1.4", "ts2dart": "^0.9.10", - "tsickle": "^0.1.4", - "tslint": "^3.10.0-dev.2", - "typescript": "^1.9.0-dev.20160409", + "tsickle": "^0.1.7", + "tslint": "^3.15.0-dev.0", + "typescript": "^2.1.0-dev.20160827", "universal-analytics": "^0.3.9", "webpack": "^1.12.6", "which": "~1", diff --git a/scripts/ci-lite/build.sh b/scripts/ci-lite/build.sh index 424e60ddbe..8ea2e96d89 100755 --- a/scripts/ci-lite/build.sh +++ b/scripts/ci-lite/build.sh @@ -13,6 +13,8 @@ $(npm bin)/tsc -v $(npm bin)/tsc -p tools cp tools/@angular/tsc-wrapped/package.json dist/tools/@angular/tsc-wrapped node dist/tools/@angular/tsc-wrapped/src/main -p modules +node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/core +node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/common node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/router $(npm bin)/tsc -p modules/benchpress diff --git a/scripts/ci-lite/offline_compiler_test.sh b/scripts/ci-lite/offline_compiler_test.sh index f6c81683bb..3c16d3355a 100755 --- a/scripts/ci-lite/offline_compiler_test.sh +++ b/scripts/ci-lite/offline_compiler_test.sh @@ -13,6 +13,7 @@ PKGS=( rxjs @types/{node,jasmine} jasmine + webpack@2.1.0-beta.21 @angular2-material/{core,button} ) @@ -42,7 +43,8 @@ cp -v package.json $TMP ./node_modules/.bin/jasmine init # Run compiler-cli integration tests in node - ./node_modules/.bin/jasmine test/*_spec.js + ./node_modules/.bin/webpack ./webpack.config.js + ./node_modules/.bin/jasmine ./all_spec.js # Compile again with a differently named tsconfig file mv tsconfig.json othername.json diff --git a/test-main.js b/test-main.js index 3db385b8f9..ca17387577 100644 --- a/test-main.js +++ b/test-main.js @@ -20,14 +20,26 @@ System.config({ 'angular2/src/alt_router/router_testing_providers': 'dist/all/angular2/src/alt_router/router_testing_providers.js' }, packages: { + '@angular/core/testing': { + main: 'index.js', + defaultExtension: 'js' + }, '@angular/core': { main: 'index.js', defaultExtension: 'js' }, + '@angular/compiler/testing': { + main: 'index.js', + defaultExtension: 'js' + }, '@angular/compiler': { main: 'index.js', defaultExtension: 'js' }, + '@angular/common/testing': { + main: 'index.js', + defaultExtension: 'js' + }, '@angular/common': { main: 'index.js', defaultExtension: 'js' @@ -41,10 +53,18 @@ System.config({ main: 'index.js', defaultExtension: 'js' }, + '@angular/router/testing': { + main: 'index.js', + defaultExtension: 'js' + }, '@angular/router': { main: 'index.js', defaultExtension: 'js' }, + '@angular/http/testing': { + main: 'index.js', + defaultExtension: 'js' + }, '@angular/http': { main: 'index.js', defaultExtension: 'js' @@ -53,14 +73,26 @@ System.config({ main: 'index.js', defaultExtension: 'js' }, + '@angular/platform-browser/testing': { + main: 'index.js', + defaultExtension: 'js' + }, '@angular/platform-browser': { main: 'index.js', defaultExtension: 'js' }, + '@angular/platform-browser-dynamic/testing': { + main: 'index.js', + defaultExtension: 'js' + }, '@angular/platform-browser-dynamic': { main: 'index.js', defaultExtension: 'js' }, + '@angular/platform-server/testing': { + main: 'index.js', + defaultExtension: 'js' + }, '@angular/platform-server': { main: 'index.js', defaultExtension: 'js' diff --git a/test.sh b/test.sh index c54b868b17..dd74b1ab00 100755 --- a/test.sh +++ b/test.sh @@ -6,7 +6,7 @@ if [ $# -eq 0 ] then echo "Angular test runner. (No platform specified)" echo - echo "./test.sh [node|browser|browserNoRouter|tools]" + echo "./test.sh [node|browser|browserNoRouter|router|tools]" echo else cd `dirname $0` diff --git a/tools/@angular/tsc-wrapped/src/main.ts b/tools/@angular/tsc-wrapped/src/main.ts index c1a1de777f..52f08443e2 100644 --- a/tools/@angular/tsc-wrapped/src/main.ts +++ b/tools/@angular/tsc-wrapped/src/main.ts @@ -28,6 +28,12 @@ export function main( ngOptions.basePath = basePath; const host = ts.createCompilerHost(parsed.options, true); + + // HACK: patch the realpath to solve symlink issue here: + // https://github.com/Microsoft/TypeScript/issues/9552 + // todo(misko): remove once facade symlinks are removed + host.realpath = (path) => path; + const program = ts.createProgram(parsed.fileNames, parsed.options, host); const errors = program.getOptionsDiagnostics(); check(errors); diff --git a/tools/@angular/tsc-wrapped/src/schema.ts b/tools/@angular/tsc-wrapped/src/schema.ts index 56ae62839d..4016c394e7 100644 --- a/tools/@angular/tsc-wrapped/src/schema.ts +++ b/tools/@angular/tsc-wrapped/src/schema.ts @@ -167,7 +167,7 @@ export interface MetadataGlobalReferenceExpression extends MetadataSymbolicExpre } export function isMetadataGlobalReferenceExpression(value: any): value is MetadataGlobalReferenceExpression { - return isMetadataSymbolicReferenceExpression(value) && value.name && !value.module; + return value && value.name && !value.module && isMetadataSymbolicReferenceExpression(value); } export interface MetadataModuleReferenceExpression extends MetadataSymbolicExpression { @@ -176,8 +176,8 @@ export interface MetadataModuleReferenceExpression extends MetadataSymbolicExpre } export function isMetadataModuleReferenceExpression(value: any): value is MetadataModuleReferenceExpression { - return isMetadataSymbolicReferenceExpression(value) && value.module && !value.name && - !value.default; + return value && value.module && !value.name && !value.default && + isMetadataSymbolicReferenceExpression(value); } export interface MetadataImportedSymbolReferenceExpression extends MetadataSymbolicExpression { @@ -188,7 +188,7 @@ export interface MetadataImportedSymbolReferenceExpression extends MetadataSymbo } export function isMetadataImportedSymbolReferenceExpression(value: any): value is MetadataImportedSymbolReferenceExpression { - return isMetadataSymbolicReferenceExpression(value) && value.module && !!value.name; + return value && value.module && !!value.name && isMetadataSymbolicReferenceExpression(value); } export interface MetadataImportedDefaultReferenceExpression extends MetadataSymbolicExpression { @@ -200,7 +200,7 @@ export interface MetadataImportedDefaultReferenceExpression extends MetadataSymb } export function isMetadataImportDefaultReference(value: any): value is MetadataImportedDefaultReferenceExpression { - return isMetadataSymbolicReferenceExpression(value) && value.module && value.default; + return value.module && value.default && isMetadataSymbolicReferenceExpression(value); } export type MetadataSymbolicReferenceExpression = MetadataGlobalReferenceExpression | @@ -259,4 +259,4 @@ export interface MetadataError { } export function isMetadataError(value: any): value is MetadataError { return value && value.__symbolic === 'error'; -} \ No newline at end of file +} diff --git a/tools/@angular/tsc-wrapped/src/tsc.ts b/tools/@angular/tsc-wrapped/src/tsc.ts index 57ff82c0bc..1ffb1831a2 100644 --- a/tools/@angular/tsc-wrapped/src/tsc.ts +++ b/tools/@angular/tsc-wrapped/src/tsc.ts @@ -1,3 +1,4 @@ +import {existsSync} from 'fs'; import * as path from 'path'; import * as ts from 'typescript'; @@ -66,8 +67,17 @@ export class Tsc implements CompilerInterface { const {config, error} = ts.readConfigFile(project, this.readFile); check([error]); - this.parsed = - ts.parseJsonConfigFileContent(config, {readDirectory: this.readDirectory}, basePath); + // Do not inline `host` into `parseJsonConfigFileContent` until after + // g3 is updated to the latest TypeScript. + // The issue is that old typescript only has `readDirectory` while + // the newer TypeScript has additional `useCaseSensitiveFileNames` and + // `fileExists`. Inlining will trigger an error of extra parameters. + let host = { + useCaseSensitiveFileNames: true, + fileExists: existsSync, + readDirectory: this.readDirectory + }; + this.parsed = ts.parseJsonConfigFileContent(config, host, basePath); check(this.parsed.errors); diff --git a/tools/@angular/tsc-wrapped/test/collector.spec.ts b/tools/@angular/tsc-wrapped/test/collector.spec.ts index 760fd1ea64..1364102ad0 100644 --- a/tools/@angular/tsc-wrapped/test/collector.spec.ts +++ b/tools/@angular/tsc-wrapped/test/collector.spec.ts @@ -397,7 +397,7 @@ describe('Collector', () => { __symbolic: 'call', expression: { __symbolic: 'select', - expression: {__symbolic: 'reference', module: './static-method.ts', name: 'MyModule'}, + expression: {__symbolic: 'reference', module: './static-method', name: 'MyModule'}, member: 'with' }, arguments: ['a'] @@ -429,7 +429,7 @@ describe('Collector', () => { provide: 'a', useValue: { __symbolic: 'select', - expression: {__symbolic: 'reference', module: './static-field.ts', name: 'MyModule'}, + expression: {__symbolic: 'reference', module: './static-field', name: 'MyModule'}, member: 'VALUE' } }] @@ -496,7 +496,7 @@ describe('Collector', () => { let metadata = collector.getMetadata(source); expect(metadata.exports).toEqual([ {from: './static-field', export: ['MyModule']}, - {from: './static-field-reference.ts', export: [{name: 'Foo', as: 'OtherModule'}]}, + {from: './static-field-reference', export: [{name: 'Foo', as: 'OtherModule'}]}, {from: 'angular2/core'} ]); }); @@ -852,7 +852,7 @@ const FILES: Directory = { `, 'static-method-call.ts': ` import {Component} from 'angular2/core'; - import {MyModule} from './static-method.ts'; + import {MyModule} from './static-method'; @Component({ providers: MyModule.with('a') @@ -869,7 +869,7 @@ const FILES: Directory = { `, 'static-field-reference.ts': ` import {Component} from 'angular2/core'; - import {MyModule} from './static-field.ts'; + import {MyModule} from './static-field'; @Component({ providers: [ { provide: 'a', useValue: MyModule.VALUE } ] @@ -891,7 +891,7 @@ const FILES: Directory = { `, 're-exports.ts': ` export {MyModule} from './static-field'; - export {Foo as OtherModule} from './static-field-reference.ts'; + export {Foo as OtherModule} from './static-field-reference'; export * from 'angular2/core'; `, 'local-symbol-ref.ts': ` diff --git a/tools/cjs-jasmine/tsconfig-output_emitter_codegen.json b/tools/cjs-jasmine/tsconfig-output_emitter_codegen.json index 8f942e1157..b3a16d2314 100644 --- a/tools/cjs-jasmine/tsconfig-output_emitter_codegen.json +++ b/tools/cjs-jasmine/tsconfig-output_emitter_codegen.json @@ -8,7 +8,7 @@ "moduleResolution": "node", "outDir": "../../dist/all/@angular", "paths": { - "@angular/core": ["../../dist/all/@angular/core/index.d.ts"], + "@angular/core": ["../../dist/all/@angular/core/index"], "@angular/core/*": ["../../dist/all/@angular/core/*"], "@angular/compiler/*": ["../../dist/all/@angular/compiler/*"] }, diff --git a/tools/public_api_guard/common/testing.d.ts b/tools/public_api_guard/common/testing/index.d.ts similarity index 100% rename from tools/public_api_guard/common/testing.d.ts rename to tools/public_api_guard/common/testing/index.d.ts diff --git a/tools/public_api_guard/compiler/testing.d.ts b/tools/public_api_guard/compiler/testing/index.d.ts similarity index 100% rename from tools/public_api_guard/compiler/testing.d.ts rename to tools/public_api_guard/compiler/testing/index.d.ts diff --git a/tools/public_api_guard/core/index.d.ts b/tools/public_api_guard/core/index.d.ts index ad12af67d3..c4198427fb 100644 --- a/tools/public_api_guard/core/index.d.ts +++ b/tools/public_api_guard/core/index.d.ts @@ -363,7 +363,7 @@ export interface ContentChildrenMetadataFactory { export declare function createPlatform(injector: Injector): PlatformRef; /** @experimental */ -export declare function createPlatformFactory(parentPlaformFactory: PlatformFactory, name: string, providers?: Provider[]): PlatformFactory; +export declare function createPlatformFactory(parentPlaformFactory: (extraProviders?: Provider[]) => PlatformRef, name: string, providers?: Provider[]): (extraProviders?: Provider[]) => PlatformRef; /** @stable */ export declare const CUSTOM_ELEMENTS_SCHEMA: SchemaMetadata; @@ -888,7 +888,7 @@ export interface PipeTransform { export declare const PLATFORM_INITIALIZER: any; /** @experimental */ -export declare const platformCore: (extraProviders?: (TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[])[]) => PlatformRef; +export declare const platformCore: (extraProviders?: Provider[]) => PlatformRef; /** @stable */ export declare abstract class PlatformRef { diff --git a/tools/public_api_guard/core/testing.d.ts b/tools/public_api_guard/core/testing/index.d.ts similarity index 100% rename from tools/public_api_guard/core/testing.d.ts rename to tools/public_api_guard/core/testing/index.d.ts diff --git a/tools/public_api_guard/http/testing.d.ts b/tools/public_api_guard/http/testing/index.d.ts similarity index 100% rename from tools/public_api_guard/http/testing.d.ts rename to tools/public_api_guard/http/testing/index.d.ts diff --git a/tools/public_api_guard/platform-browser-dynamic/index.d.ts b/tools/public_api_guard/platform-browser-dynamic/index.d.ts index c611777000..c3f0d5c890 100644 --- a/tools/public_api_guard/platform-browser-dynamic/index.d.ts +++ b/tools/public_api_guard/platform-browser-dynamic/index.d.ts @@ -1,11 +1,11 @@ /** @experimental */ export declare function bootstrapWorkerUi(workerScriptUri: string, customProviders?: Provider[]): Promise; -/** @stable */ -export declare const platformBrowserDynamic: (extraProviders?: (TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[])[]) => PlatformRef; +/** @experimental */ +export declare const platformBrowserDynamic: (extraProviders?: Provider[]) => PlatformRef; /** @experimental */ -export declare const platformWorkerAppDynamic: (extraProviders?: (TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[])[]) => PlatformRef; +export declare const platformWorkerAppDynamic: (extraProviders?: Provider[]) => PlatformRef; /** @experimental */ export declare const RESOURCE_CACHE_PROVIDER: Provider[]; diff --git a/tools/public_api_guard/platform-browser-dynamic/testing.d.ts b/tools/public_api_guard/platform-browser-dynamic/testing/index.d.ts similarity index 55% rename from tools/public_api_guard/platform-browser-dynamic/testing.d.ts rename to tools/public_api_guard/platform-browser-dynamic/testing/index.d.ts index 95cb78e2d1..8c197754e2 100644 --- a/tools/public_api_guard/platform-browser-dynamic/testing.d.ts +++ b/tools/public_api_guard/platform-browser-dynamic/testing/index.d.ts @@ -3,4 +3,4 @@ export declare class BrowserDynamicTestingModule { } /** @stable */ -export declare const platformBrowserDynamicTesting: (extraProviders?: (TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[])[]) => PlatformRef; +export declare const platformBrowserDynamicTesting: (extraProviders?: Provider[]) => PlatformRef; diff --git a/tools/public_api_guard/platform-browser/index.d.ts b/tools/public_api_guard/platform-browser/index.d.ts index 7ab864aa96..3e3744e8d7 100644 --- a/tools/public_api_guard/platform-browser/index.d.ts +++ b/tools/public_api_guard/platform-browser/index.d.ts @@ -118,13 +118,13 @@ export declare class NgProbeToken { } /** @stable */ -export declare const platformBrowser: (extraProviders?: (TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[])[]) => PlatformRef; +export declare const platformBrowser: (extraProviders?: Provider[]) => PlatformRef; /** @experimental */ -export declare const platformWorkerApp: (extraProviders?: (TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[])[]) => PlatformRef; +export declare const platformWorkerApp: (extraProviders?: Provider[]) => PlatformRef; /** @experimental */ -export declare const platformWorkerUi: (extraProviders?: (TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[])[]) => PlatformRef; +export declare const platformWorkerUi: (extraProviders?: Provider[]) => PlatformRef; /** @experimental */ export declare const PRIMITIVE: Type; @@ -204,7 +204,7 @@ export declare const WORKER_APP_LOCATION_PROVIDERS: ({ export declare const WORKER_SCRIPT: OpaqueToken; /** @experimental */ -export declare const WORKER_UI_LOCATION_PROVIDERS: (typeof MessageBasedPlatformLocation | typeof BrowserPlatformLocation | { +export declare const WORKER_UI_LOCATION_PROVIDERS: (typeof BrowserPlatformLocation | typeof MessageBasedPlatformLocation | { provide: any; useFactory: (injector: Injector) => () => void; multi: boolean; diff --git a/tools/public_api_guard/platform-browser/testing.d.ts b/tools/public_api_guard/platform-browser/testing.d.ts deleted file mode 100644 index 31f920accb..0000000000 --- a/tools/public_api_guard/platform-browser/testing.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** @stable */ -export declare class BrowserTestingModule { -} - -/** @stable */ -export declare const platformBrowserTesting: (extraProviders?: (TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[])[]) => PlatformRef; diff --git a/tools/public_api_guard/platform-browser/testing/index.d.ts b/tools/public_api_guard/platform-browser/testing/index.d.ts new file mode 100644 index 0000000000..fef729a433 --- /dev/null +++ b/tools/public_api_guard/platform-browser/testing/index.d.ts @@ -0,0 +1,6 @@ +/** @stable */ +export declare class BrowserTestingModule { +} + +/** @stable */ +export declare const platformBrowserTesting: (extraProviders?: Provider[]) => PlatformRef; diff --git a/tools/public_api_guard/platform-server/index.d.ts b/tools/public_api_guard/platform-server/index.d.ts index 30dd3a2fbd..1004136d28 100644 --- a/tools/public_api_guard/platform-server/index.d.ts +++ b/tools/public_api_guard/platform-server/index.d.ts @@ -1,8 +1,8 @@ /** @experimental */ -export declare const platformDynamicServer: (extraProviders?: (TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[])[]) => PlatformRef; +export declare const platformDynamicServer: (extraProviders?: Provider[]) => PlatformRef; /** @experimental */ -export declare const platformServer: (extraProviders?: (TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[])[]) => PlatformRef; +export declare const platformServer: (extraProviders?: Provider[]) => PlatformRef; /** @experimental */ export declare class ServerModule { diff --git a/tools/public_api_guard/platform-server/testing.d.ts b/tools/public_api_guard/platform-server/testing.d.ts deleted file mode 100644 index 8c9ba33c54..0000000000 --- a/tools/public_api_guard/platform-server/testing.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** @experimental */ -export declare const platformServerTesting: (extraProviders?: (TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[])[]) => PlatformRef; - -/** @experimental */ -export declare class ServerTestingModule { -} diff --git a/tools/public_api_guard/platform-server/testing/index.d.ts b/tools/public_api_guard/platform-server/testing/index.d.ts new file mode 100644 index 0000000000..ff45ba7395 --- /dev/null +++ b/tools/public_api_guard/platform-server/testing/index.d.ts @@ -0,0 +1,6 @@ +/** @experimental */ +export declare const platformServerTesting: (extraProviders?: Provider[]) => PlatformRef; + +/** @experimental */ +export declare class ServerTestingModule { +} diff --git a/tools/public_api_guard/router/index.d.ts b/tools/public_api_guard/router/index.d.ts index 0356fbd927..21923cee94 100644 --- a/tools/public_api_guard/router/index.d.ts +++ b/tools/public_api_guard/router/index.d.ts @@ -66,9 +66,6 @@ export declare class DefaultUrlSerializer implements UrlSerializer { serialize(tree: UrlTree): string; } -/** @stable */ -export declare type ErrorHandler = (error: any) => any; - /** @stable */ export declare type Event = NavigationStart | NavigationEnd | NavigationCancel | NavigationError | RoutesRecognized; diff --git a/tools/tsc-watch/index.ts b/tools/tsc-watch/index.ts index 0de20c606f..bb32dfaeae 100644 --- a/tools/tsc-watch/index.ts +++ b/tools/tsc-watch/index.ts @@ -97,6 +97,21 @@ if (platform == 'node') { ] }, BaseConfig)); +} else if (platform == 'router') { + tscWatch = new TscWatch(Object.assign( + { + tsconfig: 'modules/tsconfig.json', + onStartCmds: [ + [ + 'node', 'node_modules/karma/bin/karma', 'start', '--no-auto-watch', '--port=9877', + 'modules/@angular/router/karma.conf.js' + ], + ], + onChangeCmds: [ + ['node', 'node_modules/karma/bin/karma', 'run', '--port=9877'], + ] + }, + BaseConfig)); } else if (platform == 'browserNoRouter') { tscWatch = new TscWatch(Object.assign( { diff --git a/tools/tsconfig.json b/tools/tsconfig.json index 9b6b3613fe..8914ce783a 100644 --- a/tools/tsconfig.json +++ b/tools/tsconfig.json @@ -15,7 +15,8 @@ "sourceMap": true, "inlineSources": true, "lib": ["es6", "dom"], - "target": "es5" + "target": "es5", + "skipLibCheck": true }, "exclude": [ "node_modules",