Skip to content

Commit 5a40501

Browse files
committed
refactor(http): move http files to top-level module
Closes angular#2680 Closes angular#3417
1 parent 2374e16 commit 5a40501

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+280
-156
lines changed

docs/public-docs-package/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = new Package('angular-v2-public-docs', [basePackage])
1010
'angular2/core.ts',
1111
'angular2/di.ts',
1212
'angular2/directives.ts',
13-
'angular2/http.ts',
13+
'http/http.ts',
1414
'angular2/forms.ts',
1515
'angular2/router.ts',
1616
'angular2/test.ts',

docs/typescript-definition-package/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage,
3939
readFilesProcessor.basePath = path.resolve(__dirname, '../..');
4040
readTypeScriptModules.sourceFiles = [
4141
'angular2/angular2.ts',
42-
'angular2/router.ts'
42+
'angular2/router.ts',
43+
'http/http.ts'
4344
];
4445
readTypeScriptModules.basePath = path.resolve(path.resolve(__dirname, '../../modules'));
4546

@@ -59,6 +60,13 @@ module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage,
5960
modules: {
6061
'angular2/router': 'angular2/router'
6162
}
63+
},
64+
{
65+
id: 'http/http',
66+
namespace: 'ngHttp',
67+
modules: {
68+
'http/http':'http/http'
69+
}
6270
}
6371
];
6472
})

gulpfile.js

Lines changed: 71 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ gulp.task('test.unit.dart', function (done) {
615615
return;
616616
}
617617

618-
watch('modules/angular2/**', { ignoreInitial: true }, [
618+
watch(['modules/angular2/**', 'modules/http/**'], { ignoreInitial: true }, [
619619
'!build/tree.dart',
620620
'!test.unit.dart/karma-run'
621621
]);
@@ -655,7 +655,7 @@ gulp.task('test.unit.dart/ci', function (done) {
655655

656656

657657
gulp.task('test.unit.cjs/ci', function(done) {
658-
runJasmineTests(['dist/js/cjs/{angular2,benchpress}/test/**/*_spec.js'], done);
658+
runJasmineTests(['dist/js/cjs/{angular2,benchpress,http}/test/**/*_spec.js'], done);
659659
});
660660

661661

@@ -761,7 +761,7 @@ gulp.task('!pre.test.typings', ['docs/typings'], function() {
761761

762762
// -----------------
763763
gulp.task('test.typings', ['!pre.test.typings'], function() {
764-
return gulp.src(['typing_spec/*.ts', 'dist/docs/typings/angular2/*.d.ts'])
764+
return gulp.src(['typing_spec/*.ts', 'dist/docs/typings/angular2/*.d.ts', 'dist/docs/typings/http.d.ts'])
765765
.pipe(tsc({target: 'ES5', module: 'commonjs',
766766
experimentalDecorators: true,
767767
noImplicitAny: true,
@@ -957,6 +957,16 @@ gulp.task('!bundle.js.prod', ['build.js.prod'], function() {
957957
'./dist/build/angular2.js',
958958
{
959959
sourceMaps: true
960+
}).
961+
then(function(){
962+
return bundler.bundle(
963+
bundleConfig,
964+
'http/http',
965+
'./dist/build/http.js',
966+
{
967+
sourceMaps: true
968+
}
969+
)
960970
});
961971
});
962972

@@ -969,6 +979,17 @@ gulp.task('!bundle.js.min', ['build.js.prod'], function() {
969979
{
970980
sourceMaps: true,
971981
minify: true
982+
}).
983+
then(function(){
984+
return bundler.bundle(
985+
bundleConfig,
986+
'http/http',
987+
'./dist/build/http.min.js',
988+
{
989+
sourceMaps: true,
990+
minify: true
991+
}
992+
)
972993
});
973994
});
974995

@@ -983,7 +1004,14 @@ gulp.task('!bundle.js.dev', ['build.js.dev'], function() {
9831004
devBundleConfig,
9841005
'angular2/angular2',
9851006
'./dist/build/angular2.dev.js',
986-
{ sourceMaps: true });
1007+
{ sourceMaps: true }).
1008+
then(function() {
1009+
return bundler.bundle(
1010+
devBundleConfig,
1011+
'http/http',
1012+
'./dist/build/http.dev.js',
1013+
{ sourceMaps: true });
1014+
});
9871015
});
9881016

9891017
gulp.task('!router.bundle.js.dev', ['build.js.dev'], function() {
@@ -1028,25 +1056,41 @@ gulp.task('!bundle.js.sfx.dev', ['build.js.dev'], function() {
10281056
'angular2/angular2_sfx',
10291057
'./dist/build/angular2.sfx.dev.js',
10301058
{ sourceMaps: true },
1031-
/* self-executing */ true);
1059+
/* self-executing */ true).
1060+
then(function() {
1061+
return bundler.bundle(
1062+
devBundleConfig,
1063+
'http/http_sfx',
1064+
'./dist/build/http.sfx.dev.js',
1065+
{ sourceMaps: true },
1066+
true)
1067+
});
10321068
});
10331069

10341070
gulp.task('!bundle.js.prod.deps', ['!bundle.js.prod'], function() {
1035-
return bundler.modify(
1071+
return merge2(bundler.modify(
10361072
['node_modules/zone.js/dist/zone-microtask.js', 'node_modules/reflect-metadata/Reflect.js',
10371073
'dist/build/angular2.js'],
10381074
'angular2.js'
1039-
).pipe(gulp.dest('dist/js/bundle'));
1075+
),
1076+
bundler.modify(
1077+
['node_modules/reflect-metadata/Reflect.js', 'node_modules/rx/dist/rx.lite.js', 'dist/build/http.js'],
1078+
'http.js'
1079+
)).pipe(gulp.dest('dist/js/bundle'));
10401080
});
10411081

10421082
gulp.task('!bundle.js.min.deps', ['!bundle.js.min'], function() {
1043-
return bundler.modify(
1083+
return merge2(bundler.modify(
10441084
['node_modules/zone.js/dist/zone-microtask.min.js',
10451085
'node_modules/reflect-metadata/Reflect.js', 'dist/build/angular2.min.js'],
10461086
'angular2.min.js'
1047-
)
1048-
.pipe(uglify())
1049-
.pipe(gulp.dest('dist/js/bundle'));
1087+
),
1088+
bundler.modify(
1089+
['node_modules/reflect-metadata/Reflect.js', 'node_modules/rx/dist/rx.lite.js','dist/build/http.min.js'],
1090+
'http.min.js'
1091+
))
1092+
.pipe(uglify())
1093+
.pipe(gulp.dest('dist/js/bundle'));
10501094
});
10511095

10521096
var JS_DEV_DEPS = [
@@ -1071,17 +1115,26 @@ function insertRXLicense(source) {
10711115
}
10721116

10731117
gulp.task('!bundle.js.dev.deps', ['!bundle.js.dev'], function() {
1074-
return bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.dev.js']), 'angular2.dev.js')
1075-
.pipe(insert.transform(insertRXLicense))
1076-
.pipe(insert.append('\nSystem.config({"paths":{"*":"*.js","angular2/*":"angular2/*"}});\n'))
1077-
.pipe(gulp.dest('dist/js/bundle'));
1118+
return merge2(
1119+
bundler.modify(
1120+
JS_DEV_DEPS.concat(['dist/build/angular2.dev.js']),
1121+
'angular2.dev.js')
1122+
.pipe(insert.transform(insertRXLicense))
1123+
.pipe(insert.append('\nSystem.config({"paths":{"*":"*.js","angular2/*":"angular2/*"}});\n'))
1124+
.pipe(gulp.dest('dist/js/bundle')),
1125+
bundler.modify(
1126+
['dist/build/http.dev.js'], 'http.dev.js')
1127+
.pipe(gulp.dest('dist/js/bundle')));
10781128
});
10791129

10801130
gulp.task('!bundle.js.sfx.dev.deps', ['!bundle.js.sfx.dev'], function() {
1081-
return bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.sfx.dev.js']),
1131+
return merge2(
1132+
bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.sfx.dev.js']),
10821133
'angular2.sfx.dev.js')
1083-
.pipe(insert.transform(insertRXLicense))
1084-
.pipe(gulp.dest('dist/js/bundle'));
1134+
.pipe(gulp.dest('dist/js/bundle')),
1135+
bundler.modify(['dist/build/http.sfx.dev.js'],
1136+
'http.sfx.dev.js')
1137+
.pipe(gulp.dest('dist/js/bundle')));
10851138
});
10861139

10871140
gulp.task('bundles.js', [

karma-dart.conf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ module.exports = function(config) {
4545

4646
// Local dependencies, transpiled from the source.
4747
'/packages/angular2': '/base/dist/dart/angular2/lib',
48+
'/packages/http': '/base/dist/dart/http/lib',
4849
'/packages/angular2_material': '/base/dist/dart/angular2_material/lib',
4950
'/packages/benchpress': '/base/dist/dart/benchpress/lib',
5051
'/packages/examples': '/base/dist/dart/examples/lib'

modules/angular2/angular2.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export * from './change_detection';
1212
export * from './core';
1313
export * from './di';
1414
export * from './directives';
15-
export * from './http';
1615
export * from './forms';
1716
export * from './render';
1817
export * from './profile';

modules/angular2/angular2_exports.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export * from './change_detection';
33
export * from './core';
44
export * from './di';
55
export * from './directives';
6-
export * from './http';
76
export * from './forms';
87
export * from './render';
98
export * from './profile';

modules/angular2/bootstrap.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ export * from './change_detection';
1212
export * from './core';
1313
export * from './di';
1414
export * from './directives';
15-
export * from './http';
1615
export * from './forms';
1716
export * from './render';

modules/angular2/http.ts

Lines changed: 0 additions & 80 deletions
This file was deleted.

modules/examples/pubspec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ environment:
44
dependencies:
55
angular2: '^<%= packageJson.version %>'
66
angular2_material: '^<%= packageJson.version %>'
7+
http: '^<%= packageJson.version %>'
78
browser: '^0.10.0'
89
dev_dependencies:
910
guinness: '^0.1.17'
@@ -14,6 +15,8 @@ dependency_overrides:
1415
path: ../angular2
1516
angular2_material:
1617
path: ../angular2_material
18+
http:
19+
path: ../http
1720
transformers:
1821
- angular2:
1922
$exclude:

modules/examples/src/http/http_comp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Component, View, NgFor} from 'angular2/angular2';
2-
import {Http, Response} from 'angular2/http';
2+
import {Http, Response} from 'http/http';
33
import {ObservableWrapper} from 'angular2/src/facade/async';
44

55
@Component({selector: 'http-app'})

0 commit comments

Comments
 (0)