- Introduces `CompilerFactory` which can be part of a `PlatformRef`. - Introduces `WorkerAppModule`, `WorkerUiModule`, `ServerModule` - Introduces `serverDynamicPlatform` for applications using runtime compilation on the server. - Changes browser bootstrap for runtime and offline compilation (see below for an example). * introduces `bootstrapModule` and `bootstrapModuleFactory` in `@angular/core` * introduces new `browserDynamicPlatform` in `@angular/platform-browser-dynamic - Changes `initTestEnvironment` (which used to be `setBaseTestProviders`) to not take a compiler factory any more (see below for an example). BREAKING CHANGE: ## Migration from `setBaseTestProviders` to `initTestEnvironment`: - For the browser platform: BEFORE: ``` import {setBaseTestProviders} from ‘@angular/core/testing’; import {TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS} from ‘@angular/platform-browser-dynamic/testing’; setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS); ``` AFTER: ``` import {initTestEnvironment} from ‘@angular/core/testing’; import {browserDynamicTestPlatform, BrowserDynamicTestModule} from ‘@angular/platform-browser-dynamic/testing’; initTestEnvironment( BrowserDynamicTestModule, browserDynamicTestPlatform()); ``` - For the server platform: BEFORE: ``` import {setBaseTestProviders} from ‘@angular/core/testing’; import {TEST_SERVER_PLATFORM_PROVIDERS, TEST_SERVER_APPLICATION_PROVIDERS} from ‘@angular/platform-server/testing/server’; setBaseTestProviders(TEST_SERVER_PLATFORM_PROVIDERS, TEST_SERVER_APPLICATION_PROVIDERS); ``` AFTER: ``` import {initTestEnvironment} from ‘@angular/core/testing’; import {serverTestPlatform, ServerTestModule} from ‘@angular/platform-browser-dynamic/testing’; initTestEnvironment( ServerTestModule, serverTestPlatform()); ``` ## Bootstrap changes ``` @AppModule({ modules: [BrowserModule], precompile: [MainComponent], providers: […], // additional providers directives: […], // additional platform directives pipes: […] // additional platform pipes }) class MyModule { constructor(appRef: ApplicationRef) { appRef.bootstrap(MainComponent); } } // offline compile import {browserPlatform} from ‘@angular/platform-browser’; import {bootstrapModuleFactory} from ‘@angular/core’; bootstrapModuleFactory(MyModuleNgFactory, browserPlatform()); // runtime compile long form import {browserDynamicPlatform} from ‘@angular/platform-browser-dynamic’; import {bootstrapModule} from ‘@angular/core’; bootstrapModule(MyModule, browserDynamicPlatform()); ``` Closes #9922 Part of #9726
47 lines
1.2 KiB
Bash
Executable File
47 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -ex -o pipefail
|
|
|
|
# These ones can be `npm link`ed for fast development
|
|
LINKABLE_PKGS=(
|
|
$(pwd)/dist/packages-dist/{common,core,compiler,compiler-cli,platform-{browser,server},platform-browser-dynamic}
|
|
$(pwd)/dist/tools/@angular/tsc-wrapped
|
|
)
|
|
PKGS=(
|
|
reflect-metadata
|
|
typescript@next
|
|
zone.js
|
|
rxjs
|
|
@types/{node,jasmine}
|
|
jasmine
|
|
)
|
|
|
|
TMPDIR=${TMPDIR:-.}
|
|
readonly TMP=$TMPDIR/e2e_test.$(date +%s)
|
|
mkdir -p $TMP
|
|
cp -R -v modules/@angular/compiler-cli/integrationtest/* $TMP
|
|
# Try to use the same versions as angular, in particular, this will
|
|
# cause us to install the same rxjs version.
|
|
cp -v package.json $TMP
|
|
|
|
# run in subshell to avoid polluting cwd
|
|
(
|
|
cd $TMP
|
|
set -ex -o pipefail
|
|
npm install ${PKGS[*]}
|
|
# TODO(alexeagle): allow this to be npm link instead
|
|
npm install ${LINKABLE_PKGS[*]}
|
|
|
|
./node_modules/.bin/tsc --version
|
|
# Compile the compiler-cli integration tests
|
|
./node_modules/.bin/ngc
|
|
./node_modules/.bin/ng-xi18n
|
|
|
|
./node_modules/.bin/jasmine init
|
|
# Run compiler-cli integration tests in node
|
|
./node_modules/.bin/jasmine test/*_spec.js
|
|
|
|
# Compile again with a differently named tsconfig file
|
|
mv tsconfig.json othername.json
|
|
./node_modules/.bin/ngc -p othername.json
|
|
)
|