Skip to content

Commit d91ac6e

Browse files
committed
WIP: adding umd bundles via rollup
1 parent db78a08 commit d91ac6e

File tree

21 files changed

+379
-70
lines changed

21 files changed

+379
-70
lines changed

build.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -e -o pipefail
4+
35
cd `dirname $0`
46

57
rm -rf ./dist/packages-dist
@@ -18,13 +20,36 @@ for PACKAGE in \
1820
do
1921
SRCDIR=./modules/@angular/${PACKAGE}
2022
DESTDIR=./dist/packages-dist/${PACKAGE}
23+
UMDES6PATH=${DESTDIR}/esm/${PACKAGE}.umd.js
24+
UMDES5PATH=${DESTDIR}/${PACKAGE}.umd.js
25+
2126

2227
echo "====== COMPILING: \$(npm bin)/tsc -p ${SRCDIR}/tsconfig.json ====="
2328
$(npm bin)/tsc -p ${SRCDIR}/tsconfig.json
2429
cp ${SRCDIR}/package.json ${DESTDIR}/
2530

2631
echo "====== (esm)COMPILING: \$(npm bin)/tsc -p ${SRCDIR}/tsconfig-es2015.json ====="
2732
$(npm bin)/tsc -p ${SRCDIR}/tsconfig-es2015.json
33+
34+
echo "====== BUNDLING: ${SRCDIR} ====="
35+
(
36+
cd ${SRCDIR}
37+
echo "..." # here just to have grep match something and not exit with 1
38+
../../rollup-test/node_modules/.bin/rollup -c rollup.config.js
39+
) 2>&1 | grep -v "as external dependency"
40+
41+
# workaround for https://github.com/rollup/rollup/issues/626
42+
sed -i '' "s/ class exports\./ class /g" ${DESTDIR}/esm/${PACKAGE}.umd.js
43+
44+
$(npm bin)/tsc \
45+
--out ${UMDES5PATH} \
46+
--target es5 \
47+
--allowJs \
48+
${UMDES6PATH} \
49+
modules/\@angular/manual_typings/globals.d.ts \
50+
modules/\@angular/typings/es6-collections/es6-collections.d.ts \
51+
modules/\@angular/typings/es6-promise/es6-promise.d.ts
52+
rm ${UMDES6PATH}
2853
done
2954

3055
TSCONFIG=./modules/@angular/tsconfig.json
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
export default {
3+
entry: '../../../dist/packages-dist/common/esm/common.js',
4+
dest: '../../../dist/packages-dist/common/esm/common.umd.js',
5+
sourceMap: true,
6+
format: 'umd',
7+
moduleName: 'ng.common',
8+
globals: {
9+
'@angular/facade': 'ng.facade',
10+
'@angular/core': 'ng.core'
11+
},
12+
plugins: [
13+
// nodeResolve({ jsnext: true, main: true }),
14+
]
15+
}
Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
import {__core_private__} from '@angular/core';
1+
import {__core_private__ as r, __core_private_types__ as t} from '@angular/core';
22

3-
export var isDefaultChangeDetectionStrategy: typeof __core_private__.isDefaultChangeDetectionStrategy = __core_private__.isDefaultChangeDetectionStrategy;
4-
export type ChangeDetectorState = __core_private__.ChangeDetectorState;
5-
export var ChangeDetectorState: typeof __core_private__.ChangeDetectorState = __core_private__.ChangeDetectorState;
6-
export var CHANGE_DETECTION_STRATEGY_VALUES: typeof __core_private__.CHANGE_DETECTION_STRATEGY_VALUES = __core_private__.CHANGE_DETECTION_STRATEGY_VALUES;
7-
export var constructDependencies: typeof __core_private__.constructDependencies = __core_private__.constructDependencies;
8-
export type LifecycleHooks = __core_private__.LifecycleHooks;
9-
export var LifecycleHooks: typeof __core_private__.LifecycleHooks = __core_private__.LifecycleHooks;
10-
export var LIFECYCLE_HOOKS_VALUES: typeof __core_private__.LIFECYCLE_HOOKS_VALUES = __core_private__.LIFECYCLE_HOOKS_VALUES;
11-
export type ReflectorReader = __core_private__.ReflectorReader;
12-
export var ReflectorReader: typeof __core_private__.ReflectorReader = __core_private__.ReflectorReader;
13-
export var ReflectorComponentResolver: typeof __core_private__.ReflectorComponentResolver = __core_private__.ReflectorComponentResolver;
14-
export type AppElement = __core_private__.AppElement;
15-
export var AppElement: typeof __core_private__.AppElement = __core_private__.AppElement;
16-
export var AppView: typeof __core_private__.AppView = __core_private__.AppView;
17-
export type ViewType = __core_private__.ViewType;
18-
export var ViewType: typeof __core_private__.ViewType = __core_private__.ViewType;
19-
export var MAX_INTERPOLATION_VALUES: typeof __core_private__.MAX_INTERPOLATION_VALUES = __core_private__.MAX_INTERPOLATION_VALUES;
20-
export var checkBinding: typeof __core_private__.checkBinding = __core_private__.checkBinding;
21-
export var flattenNestedViewRenderNodes: typeof __core_private__.flattenNestedViewRenderNodes = __core_private__.flattenNestedViewRenderNodes;
22-
export var interpolate: typeof __core_private__.interpolate = __core_private__.interpolate;
23-
export var ViewUtils: typeof __core_private__.ViewUtils = __core_private__.ViewUtils;
24-
export var VIEW_ENCAPSULATION_VALUES: typeof __core_private__.VIEW_ENCAPSULATION_VALUES = __core_private__.VIEW_ENCAPSULATION_VALUES;
25-
export var DebugContext: typeof __core_private__.DebugContext = __core_private__.DebugContext;
26-
export var StaticNodeDebugInfo: typeof __core_private__.StaticNodeDebugInfo = __core_private__.StaticNodeDebugInfo;
27-
export var devModeEqual: typeof __core_private__.devModeEqual = __core_private__.devModeEqual;
28-
export var uninitialized: typeof __core_private__.uninitialized = __core_private__.uninitialized;
29-
export var ValueUnwrapper: typeof __core_private__.ValueUnwrapper = __core_private__.ValueUnwrapper;
30-
export var TemplateRef_: typeof __core_private__.TemplateRef_ = __core_private__.TemplateRef_;
31-
export type RenderDebugInfo = __core_private__.RenderDebugInfo;
32-
export var RenderDebugInfo: typeof __core_private__.RenderDebugInfo = __core_private__.RenderDebugInfo;
3+
export var isDefaultChangeDetectionStrategy: typeof t.isDefaultChangeDetectionStrategy = r.isDefaultChangeDetectionStrategy;
4+
export type ChangeDetectorState = t.ChangeDetectorState;
5+
export var ChangeDetectorState: typeof t.ChangeDetectorState = r.ChangeDetectorState;
6+
export var CHANGE_DETECTION_STRATEGY_VALUES: typeof t.CHANGE_DETECTION_STRATEGY_VALUES = r.CHANGE_DETECTION_STRATEGY_VALUES;
7+
export var constructDependencies: typeof t.constructDependencies = r.constructDependencies;
8+
export type LifecycleHooks = t.LifecycleHooks;
9+
export var LifecycleHooks: typeof t.LifecycleHooks = r.LifecycleHooks;
10+
export var LIFECYCLE_HOOKS_VALUES: typeof t.LIFECYCLE_HOOKS_VALUES = r.LIFECYCLE_HOOKS_VALUES;
11+
export type ReflectorReader = t.ReflectorReader;
12+
export var ReflectorReader: typeof t.ReflectorReader = r.ReflectorReader;
13+
export var ReflectorComponentResolver: typeof t.ReflectorComponentResolver = r.ReflectorComponentResolver;
14+
export type AppElement = t.AppElement;
15+
export var AppElement: typeof t.AppElement = r.AppElement;
16+
export var AppView: typeof t.AppView = r.AppView;
17+
export type ViewType = t.ViewType;
18+
export var ViewType: typeof t.ViewType = r.ViewType;
19+
export var MAX_INTERPOLATION_VALUES: typeof t.MAX_INTERPOLATION_VALUES = r.MAX_INTERPOLATION_VALUES;
20+
export var checkBinding: typeof t.checkBinding = r.checkBinding;
21+
export var flattenNestedViewRenderNodes: typeof t.flattenNestedViewRenderNodes = r.flattenNestedViewRenderNodes;
22+
export var interpolate: typeof t.interpolate = r.interpolate;
23+
export var ViewUtils: typeof t.ViewUtils = r.ViewUtils;
24+
export var VIEW_ENCAPSULATION_VALUES: typeof t.VIEW_ENCAPSULATION_VALUES = r.VIEW_ENCAPSULATION_VALUES;
25+
export var DebugContext: typeof t.DebugContext = r.DebugContext;
26+
export var StaticNodeDebugInfo: typeof t.StaticNodeDebugInfo = r.StaticNodeDebugInfo;
27+
export var devModeEqual: typeof t.devModeEqual = r.devModeEqual;
28+
export var uninitialized: typeof t.uninitialized = r.uninitialized;
29+
export var ValueUnwrapper: typeof t.ValueUnwrapper = r.ValueUnwrapper;
30+
export var TemplateRef_: typeof t.TemplateRef_ = r.TemplateRef_;
31+
export type RenderDebugInfo = t.RenderDebugInfo;
32+
export var RenderDebugInfo: typeof t.RenderDebugInfo = r.RenderDebugInfo;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
export default {
3+
entry: '../../../dist/packages-dist/compiler/esm/compiler.js',
4+
dest: '../../../dist/packages-dist/compiler/esm/compiler.umd.js',
5+
sourceMap: true,
6+
format: 'umd',
7+
moduleName: 'ng.compiler',
8+
globals: {
9+
'@angular/facade': 'ng.facade',
10+
'@angular/core': 'ng.core'
11+
},
12+
plugins: [
13+
// nodeResolve({ jsnext: true, main: true }),
14+
]
15+
}

modules/@angular/core/core.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ export * from './src/metadata';
77
export * from './src/util';
88
export * from './src/prod_mode';
99
export * from './src/di';
10-
export * from '@angular/facade';
11-
export {enableProdMode} from '@angular/facade';
1210
export {
1311
createPlatform,
1412
assertPlatform,
@@ -39,7 +37,17 @@ export * from './src/application_common_providers';
3937
export * from './src/reflection/reflection';
4038
export * from './instrumentation';
4139

42-
export {ConcreteType, Type, EventEmitter, WrappedException, ExceptionHandler} from '@angular/facade';
4340

41+
// reexport a few things from facades under core
42+
import * as facade from '@angular/facade';
43+
export type Type = facade.Type;
44+
export var Type: typeof facade.Type = facade.Type;
45+
export type EventEmitter<T> = facade.EventEmitter<T>;
46+
export var EventEmitter: typeof facade.EventEmitter = facade.EventEmitter;
47+
export type WrappedException = facade.WrappedException;
48+
export var WrappedException: typeof facade.WrappedException = facade.WrappedException;
49+
export type ExceptionHandler = facade.ExceptionHandler;
50+
export var ExceptionHandler: typeof facade.ExceptionHandler = facade.ExceptionHandler;
51+
export var enableProdMode: typeof facade.enableProdMode = facade.enableProdMode;
4452

4553
export * from './private_export';

modules/@angular/core/private_export.ts

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,68 @@ import * as wtf_init from './src/profile/wtf_init';
1616
import * as reflection_capabilities from './src/reflection/reflection_capabilities';
1717
import * as decorators from './src/util/decorators';
1818

19-
export namespace __core_private__ {
20-
export var isDefaultChangeDetectionStrategy = constants.isDefaultChangeDetectionStrategy;
19+
export declare namespace __core_private_types__ {
20+
export var isDefaultChangeDetectionStrategy: typeof constants.isDefaultChangeDetectionStrategy;
2121
export type ChangeDetectorState = constants.ChangeDetectorState;
22-
export var ChangeDetectorState = constants.ChangeDetectorState;
23-
export var CHANGE_DETECTION_STRATEGY_VALUES = constants.CHANGE_DETECTION_STRATEGY_VALUES;
24-
export var constructDependencies = reflective_provider.constructDependencies;
22+
export var ChangeDetectorState: typeof constants.ChangeDetectorState;
23+
export var CHANGE_DETECTION_STRATEGY_VALUES: typeof constants.CHANGE_DETECTION_STRATEGY_VALUES;
24+
export var constructDependencies: typeof reflective_provider.constructDependencies;
2525
export type LifecycleHooks = lifecycle_hooks.LifecycleHooks;
26-
export var LifecycleHooks = lifecycle_hooks.LifecycleHooks;
27-
export var LIFECYCLE_HOOKS_VALUES = lifecycle_hooks.LIFECYCLE_HOOKS_VALUES;
26+
export var LifecycleHooks: typeof lifecycle_hooks.LifecycleHooks;
27+
export var LIFECYCLE_HOOKS_VALUES: typeof lifecycle_hooks.LIFECYCLE_HOOKS_VALUES;
2828
export type ReflectorReader = reflector_reader.ReflectorReader;
29-
export var ReflectorReader = reflector_reader.ReflectorReader;
30-
export var ReflectorComponentResolver = component_resolver.ReflectorComponentResolver;
29+
export var ReflectorReader: typeof reflector_reader.ReflectorReader;
30+
export var ReflectorComponentResolver: typeof component_resolver.ReflectorComponentResolver;
3131
export type AppElement = element.AppElement;
32-
export var AppElement = element.AppElement;
33-
export var AppView = view.AppView;
32+
export var AppElement: typeof element.AppElement;
33+
export var AppView: typeof view.AppView;
3434
export type ViewType = view_type.ViewType;
35-
export var ViewType = view_type.ViewType;
36-
export var MAX_INTERPOLATION_VALUES = view_utils.MAX_INTERPOLATION_VALUES;
37-
export var checkBinding = view_utils.checkBinding;
38-
export var flattenNestedViewRenderNodes = view_utils.flattenNestedViewRenderNodes;
39-
export var interpolate = view_utils.interpolate;
40-
export var ViewUtils = view_utils.ViewUtils;
41-
export var VIEW_ENCAPSULATION_VALUES = metadata_view.VIEW_ENCAPSULATION_VALUES;
42-
export var DebugContext = debug_context.DebugContext;
43-
export var StaticNodeDebugInfo = debug_context.StaticNodeDebugInfo;
44-
export var devModeEqual = change_detection_util.devModeEqual;
45-
export var uninitialized = change_detection_util.uninitialized;
46-
export var ValueUnwrapper = change_detection_util.ValueUnwrapper;
35+
export var ViewType: typeof view_type.ViewType;
36+
export var MAX_INTERPOLATION_VALUES: typeof view_utils.MAX_INTERPOLATION_VALUES;
37+
export var checkBinding: typeof view_utils.checkBinding;
38+
export var flattenNestedViewRenderNodes: typeof view_utils.flattenNestedViewRenderNodes;
39+
export var interpolate: typeof view_utils.interpolate;
40+
export var ViewUtils: typeof view_utils.ViewUtils;
41+
export var VIEW_ENCAPSULATION_VALUES: typeof metadata_view.VIEW_ENCAPSULATION_VALUES;
42+
export var DebugContext: typeof debug_context.DebugContext;
43+
export var StaticNodeDebugInfo: typeof debug_context.StaticNodeDebugInfo;
44+
export var devModeEqual: typeof change_detection_util.devModeEqual;
45+
export var uninitialized: typeof change_detection_util.uninitialized;
46+
export var ValueUnwrapper: typeof change_detection_util.ValueUnwrapper;
4747
export type RenderDebugInfo = api.RenderDebugInfo;
48-
export var RenderDebugInfo = api.RenderDebugInfo;
49-
export var TemplateRef_ = template_ref.TemplateRef_;
50-
export var wtfInit = wtf_init.wtfInit;
51-
export var ReflectionCapabilities = reflection_capabilities.ReflectionCapabilities;
52-
export var makeDecorator = decorators.makeDecorator;
48+
export var RenderDebugInfo: typeof api.RenderDebugInfo;
49+
export var TemplateRef_: typeof template_ref.TemplateRef_;
50+
export var wtfInit: typeof wtf_init.wtfInit;
51+
export var ReflectionCapabilities: typeof reflection_capabilities.ReflectionCapabilities;
52+
export var makeDecorator: typeof decorators.makeDecorator;
5353
}
54+
55+
export var __core_private__ = {
56+
isDefaultChangeDetectionStrategy: constants.isDefaultChangeDetectionStrategy,
57+
ChangeDetectorState: constants.ChangeDetectorState,
58+
CHANGE_DETECTION_STRATEGY_VALUES: constants.CHANGE_DETECTION_STRATEGY_VALUES,
59+
constructDependencies: reflective_provider.constructDependencies,
60+
LifecycleHooks: lifecycle_hooks.LifecycleHooks,
61+
LIFECYCLE_HOOKS_VALUES: lifecycle_hooks.LIFECYCLE_HOOKS_VALUES,
62+
ReflectorReader: reflector_reader.ReflectorReader,
63+
ReflectorComponentResolver: component_resolver.ReflectorComponentResolver,
64+
AppElement: element.AppElement,
65+
AppView: view.AppView,
66+
ViewType: view_type.ViewType,
67+
MAX_INTERPOLATION_VALUES: view_utils.MAX_INTERPOLATION_VALUES,
68+
checkBinding: view_utils.checkBinding,
69+
flattenNestedViewRenderNodes: view_utils.flattenNestedViewRenderNodes,
70+
interpolate: view_utils.interpolate,
71+
ViewUtils: view_utils.ViewUtils,
72+
VIEW_ENCAPSULATION_VALUES: metadata_view.VIEW_ENCAPSULATION_VALUES,
73+
DebugContext: debug_context.DebugContext,
74+
StaticNodeDebugInfo: debug_context.StaticNodeDebugInfo,
75+
devModeEqual: change_detection_util.devModeEqual,
76+
uninitialized: change_detection_util.uninitialized,
77+
ValueUnwrapper: change_detection_util.ValueUnwrapper,
78+
RenderDebugInfo: api.RenderDebugInfo,
79+
TemplateRef_: template_ref.TemplateRef_,
80+
wtfInit: wtf_init.wtfInit,
81+
ReflectionCapabilities: reflection_capabilities.ReflectionCapabilities,
82+
makeDecorator: decorators.makeDecorator
83+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
export default {
3+
entry: '../../../dist/packages-dist/core/esm/core.js',
4+
dest: '../../../dist/packages-dist/core/esm/core.umd.js',
5+
sourceMap: true,
6+
format: 'umd',
7+
moduleName: 'ng.core',
8+
globals: {
9+
'@angular/facade': 'ng.facade'
10+
},
11+
plugins: [
12+
// nodeResolve({ jsnext: true, main: true }),
13+
]
14+
}
15+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
export default {
3+
entry: '../../../dist/packages-dist/facade/esm/facade.js',
4+
dest: '../../../dist/packages-dist/facade/esm/facade.umd.js',
5+
sourceMap: true,
6+
format: 'umd',
7+
moduleName: 'ng.facade',
8+
globals: {
9+
'rxjs/Subject': 'Rx',
10+
'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.
11+
'rxjs/operator/toPromise': 'Rx.Observable.prototype',
12+
'rxjs/Observable': 'Rx'
13+
},
14+
plugins: [
15+
// nodeResolve({ jsnext: true, main: true }),
16+
]
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
export default {
3+
entry: '../../../dist/packages-dist/http/esm/http.js',
4+
dest: '../../../dist/packages-dist/http/esm/http.umd.js',
5+
sourceMap: true,
6+
format: 'umd',
7+
moduleName: 'ng.http',
8+
globals: {
9+
'@angular/facade': 'ng.facade',
10+
'@angular/core': 'ng.core',
11+
'@angular/compiler': 'ng.compiler',
12+
'@angular/platform-browser': 'ng.platformBrowser',
13+
'rxjs/Observable': 'Rx.Observable'
14+
},
15+
plugins: [
16+
// nodeResolve({ jsnext: true, main: true }),
17+
]
18+
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {__core_private__ as _} from '@angular/core';
1+
import {__core_private__ as r, __core_private_types__ as t} from '@angular/core';
22

3-
export type RenderDebugInfo = _.RenderDebugInfo;
4-
export var RenderDebugInfo: typeof _.RenderDebugInfo = _.RenderDebugInfo;
5-
export var wtfInit: typeof _.wtfInit = _.wtfInit;
6-
export var ReflectionCapabilities: typeof _.ReflectionCapabilities = _.ReflectionCapabilities;
7-
export var VIEW_ENCAPSULATION_VALUES: typeof _.VIEW_ENCAPSULATION_VALUES = _.VIEW_ENCAPSULATION_VALUES;
3+
export type RenderDebugInfo = t.RenderDebugInfo;
4+
export var RenderDebugInfo: typeof t.RenderDebugInfo = r.RenderDebugInfo;
5+
export var wtfInit: typeof t.wtfInit = r.wtfInit;
6+
export var ReflectionCapabilities: typeof t.ReflectionCapabilities = r.ReflectionCapabilities;
7+
export var VIEW_ENCAPSULATION_VALUES: typeof t.VIEW_ENCAPSULATION_VALUES = r.VIEW_ENCAPSULATION_VALUES;

0 commit comments

Comments
 (0)