fix(packages): use ES modules for primary build (#11120)
This commit is contained in:

committed by
Victor Berchet

parent
8cb1046ce9
commit
979657989b
@ -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<PlatformRef> {
|
||||
// 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.
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
};
|
@ -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'
|
||||
}
|
||||
}
|
@ -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 }),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<PlatformRef> {
|
||||
// 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 : [];
|
||||
}
|
@ -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';
|
||||
|
||||
|
@ -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
|
||||
};
|
@ -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;
|
@ -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';
|
||||
|
||||
|
||||
|
||||
|
1
modules/@angular/platform-browser-dynamic/testing/facade
Symbolic link
1
modules/@angular/platform-browser-dynamic/testing/facade
Symbolic link
@ -0,0 +1 @@
|
||||
../../facade/src
|
@ -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'
|
||||
|
@ -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
|
||||
};
|
@ -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;
|
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @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;
|
@ -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"
|
||||
]
|
@ -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"
|
||||
]
|
Reference in New Issue
Block a user