refactor(http): move http files to top-level module

Closes #2680
Closes #3417
This commit is contained in:
Jeff Cross 2015-07-28 13:10:25 -07:00
parent 2374e16104
commit 5a405011de
53 changed files with 280 additions and 156 deletions

View File

@ -10,7 +10,7 @@ module.exports = new Package('angular-v2-public-docs', [basePackage])
'angular2/core.ts', 'angular2/core.ts',
'angular2/di.ts', 'angular2/di.ts',
'angular2/directives.ts', 'angular2/directives.ts',
'angular2/http.ts', 'http/http.ts',
'angular2/forms.ts', 'angular2/forms.ts',
'angular2/router.ts', 'angular2/router.ts',
'angular2/test.ts', 'angular2/test.ts',

View File

@ -39,7 +39,8 @@ module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage,
readFilesProcessor.basePath = path.resolve(__dirname, '../..'); readFilesProcessor.basePath = path.resolve(__dirname, '../..');
readTypeScriptModules.sourceFiles = [ readTypeScriptModules.sourceFiles = [
'angular2/angular2.ts', 'angular2/angular2.ts',
'angular2/router.ts' 'angular2/router.ts',
'http/http.ts'
]; ];
readTypeScriptModules.basePath = path.resolve(path.resolve(__dirname, '../../modules')); readTypeScriptModules.basePath = path.resolve(path.resolve(__dirname, '../../modules'));
@ -59,6 +60,13 @@ module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage,
modules: { modules: {
'angular2/router': 'angular2/router' 'angular2/router': 'angular2/router'
} }
},
{
id: 'http/http',
namespace: 'ngHttp',
modules: {
'http/http':'http/http'
}
} }
]; ];
}) })

View File

@ -615,7 +615,7 @@ gulp.task('test.unit.dart', function (done) {
return; return;
} }
watch('modules/angular2/**', { ignoreInitial: true }, [ watch(['modules/angular2/**', 'modules/http/**'], { ignoreInitial: true }, [
'!build/tree.dart', '!build/tree.dart',
'!test.unit.dart/karma-run' '!test.unit.dart/karma-run'
]); ]);
@ -655,7 +655,7 @@ gulp.task('test.unit.dart/ci', function (done) {
gulp.task('test.unit.cjs/ci', function(done) { gulp.task('test.unit.cjs/ci', function(done) {
runJasmineTests(['dist/js/cjs/{angular2,benchpress}/test/**/*_spec.js'], done); runJasmineTests(['dist/js/cjs/{angular2,benchpress,http}/test/**/*_spec.js'], done);
}); });
@ -761,7 +761,7 @@ gulp.task('!pre.test.typings', ['docs/typings'], function() {
// ----------------- // -----------------
gulp.task('test.typings', ['!pre.test.typings'], function() { gulp.task('test.typings', ['!pre.test.typings'], function() {
return gulp.src(['typing_spec/*.ts', 'dist/docs/typings/angular2/*.d.ts']) return gulp.src(['typing_spec/*.ts', 'dist/docs/typings/angular2/*.d.ts', 'dist/docs/typings/http.d.ts'])
.pipe(tsc({target: 'ES5', module: 'commonjs', .pipe(tsc({target: 'ES5', module: 'commonjs',
experimentalDecorators: true, experimentalDecorators: true,
noImplicitAny: true, noImplicitAny: true,
@ -957,6 +957,16 @@ gulp.task('!bundle.js.prod', ['build.js.prod'], function() {
'./dist/build/angular2.js', './dist/build/angular2.js',
{ {
sourceMaps: true sourceMaps: true
}).
then(function(){
return bundler.bundle(
bundleConfig,
'http/http',
'./dist/build/http.js',
{
sourceMaps: true
}
)
}); });
}); });
@ -969,6 +979,17 @@ gulp.task('!bundle.js.min', ['build.js.prod'], function() {
{ {
sourceMaps: true, sourceMaps: true,
minify: true minify: true
}).
then(function(){
return bundler.bundle(
bundleConfig,
'http/http',
'./dist/build/http.min.js',
{
sourceMaps: true,
minify: true
}
)
}); });
}); });
@ -983,7 +1004,14 @@ gulp.task('!bundle.js.dev', ['build.js.dev'], function() {
devBundleConfig, devBundleConfig,
'angular2/angular2', 'angular2/angular2',
'./dist/build/angular2.dev.js', './dist/build/angular2.dev.js',
{ sourceMaps: true }); { sourceMaps: true }).
then(function() {
return bundler.bundle(
devBundleConfig,
'http/http',
'./dist/build/http.dev.js',
{ sourceMaps: true });
});
}); });
gulp.task('!router.bundle.js.dev', ['build.js.dev'], function() { gulp.task('!router.bundle.js.dev', ['build.js.dev'], function() {
@ -1028,25 +1056,41 @@ gulp.task('!bundle.js.sfx.dev', ['build.js.dev'], function() {
'angular2/angular2_sfx', 'angular2/angular2_sfx',
'./dist/build/angular2.sfx.dev.js', './dist/build/angular2.sfx.dev.js',
{ sourceMaps: true }, { sourceMaps: true },
/* self-executing */ true); /* self-executing */ true).
then(function() {
return bundler.bundle(
devBundleConfig,
'http/http_sfx',
'./dist/build/http.sfx.dev.js',
{ sourceMaps: true },
true)
});
}); });
gulp.task('!bundle.js.prod.deps', ['!bundle.js.prod'], function() { gulp.task('!bundle.js.prod.deps', ['!bundle.js.prod'], function() {
return bundler.modify( return merge2(bundler.modify(
['node_modules/zone.js/dist/zone-microtask.js', 'node_modules/reflect-metadata/Reflect.js', ['node_modules/zone.js/dist/zone-microtask.js', 'node_modules/reflect-metadata/Reflect.js',
'dist/build/angular2.js'], 'dist/build/angular2.js'],
'angular2.js' 'angular2.js'
).pipe(gulp.dest('dist/js/bundle')); ),
bundler.modify(
['node_modules/reflect-metadata/Reflect.js', 'node_modules/rx/dist/rx.lite.js', 'dist/build/http.js'],
'http.js'
)).pipe(gulp.dest('dist/js/bundle'));
}); });
gulp.task('!bundle.js.min.deps', ['!bundle.js.min'], function() { gulp.task('!bundle.js.min.deps', ['!bundle.js.min'], function() {
return bundler.modify( return merge2(bundler.modify(
['node_modules/zone.js/dist/zone-microtask.min.js', ['node_modules/zone.js/dist/zone-microtask.min.js',
'node_modules/reflect-metadata/Reflect.js', 'dist/build/angular2.min.js'], 'node_modules/reflect-metadata/Reflect.js', 'dist/build/angular2.min.js'],
'angular2.min.js' 'angular2.min.js'
) ),
.pipe(uglify()) bundler.modify(
.pipe(gulp.dest('dist/js/bundle')); ['node_modules/reflect-metadata/Reflect.js', 'node_modules/rx/dist/rx.lite.js','dist/build/http.min.js'],
'http.min.js'
))
.pipe(uglify())
.pipe(gulp.dest('dist/js/bundle'));
}); });
var JS_DEV_DEPS = [ var JS_DEV_DEPS = [
@ -1071,17 +1115,26 @@ function insertRXLicense(source) {
} }
gulp.task('!bundle.js.dev.deps', ['!bundle.js.dev'], function() { gulp.task('!bundle.js.dev.deps', ['!bundle.js.dev'], function() {
return bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.dev.js']), 'angular2.dev.js') return merge2(
.pipe(insert.transform(insertRXLicense)) bundler.modify(
.pipe(insert.append('\nSystem.config({"paths":{"*":"*.js","angular2/*":"angular2/*"}});\n')) JS_DEV_DEPS.concat(['dist/build/angular2.dev.js']),
.pipe(gulp.dest('dist/js/bundle')); 'angular2.dev.js')
.pipe(insert.transform(insertRXLicense))
.pipe(insert.append('\nSystem.config({"paths":{"*":"*.js","angular2/*":"angular2/*"}});\n'))
.pipe(gulp.dest('dist/js/bundle')),
bundler.modify(
['dist/build/http.dev.js'], 'http.dev.js')
.pipe(gulp.dest('dist/js/bundle')));
}); });
gulp.task('!bundle.js.sfx.dev.deps', ['!bundle.js.sfx.dev'], function() { gulp.task('!bundle.js.sfx.dev.deps', ['!bundle.js.sfx.dev'], function() {
return bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.sfx.dev.js']), return merge2(
bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.sfx.dev.js']),
'angular2.sfx.dev.js') 'angular2.sfx.dev.js')
.pipe(insert.transform(insertRXLicense)) .pipe(gulp.dest('dist/js/bundle')),
.pipe(gulp.dest('dist/js/bundle')); bundler.modify(['dist/build/http.sfx.dev.js'],
'http.sfx.dev.js')
.pipe(gulp.dest('dist/js/bundle')));
}); });
gulp.task('bundles.js', [ gulp.task('bundles.js', [

View File

@ -45,6 +45,7 @@ module.exports = function(config) {
// Local dependencies, transpiled from the source. // Local dependencies, transpiled from the source.
'/packages/angular2': '/base/dist/dart/angular2/lib', '/packages/angular2': '/base/dist/dart/angular2/lib',
'/packages/http': '/base/dist/dart/http/lib',
'/packages/angular2_material': '/base/dist/dart/angular2_material/lib', '/packages/angular2_material': '/base/dist/dart/angular2_material/lib',
'/packages/benchpress': '/base/dist/dart/benchpress/lib', '/packages/benchpress': '/base/dist/dart/benchpress/lib',
'/packages/examples': '/base/dist/dart/examples/lib' '/packages/examples': '/base/dist/dart/examples/lib'

View File

@ -12,7 +12,6 @@ export * from './change_detection';
export * from './core'; export * from './core';
export * from './di'; export * from './di';
export * from './directives'; export * from './directives';
export * from './http';
export * from './forms'; export * from './forms';
export * from './render'; export * from './render';
export * from './profile'; export * from './profile';

View File

@ -3,7 +3,6 @@ export * from './change_detection';
export * from './core'; export * from './core';
export * from './di'; export * from './di';
export * from './directives'; export * from './directives';
export * from './http';
export * from './forms'; export * from './forms';
export * from './render'; export * from './render';
export * from './profile'; export * from './profile';

View File

@ -12,6 +12,5 @@ export * from './change_detection';
export * from './core'; export * from './core';
export * from './di'; export * from './di';
export * from './directives'; export * from './directives';
export * from './http';
export * from './forms'; export * from './forms';
export * from './render'; export * from './render';

View File

@ -1,80 +0,0 @@
/**
* @module
* @description
* The http module provides services to perform http requests. To get started, see the {@link Http}
* class.
*/
import {bind, Binding} from 'angular2/di';
import {Http, Jsonp} from 'angular2/src/http/http';
import {XHRBackend, XHRConnection} from 'angular2/src/http/backends/xhr_backend';
import {JSONPBackend, JSONPConnection} from 'angular2/src/http/backends/jsonp_backend';
import {BrowserXhr} from 'angular2/src/http/backends/browser_xhr';
import {BrowserJsonp} from 'angular2/src/http/backends/browser_jsonp';
import {BaseRequestOptions, RequestOptions} from 'angular2/src/http/base_request_options';
import {ConnectionBackend} from 'angular2/src/http/interfaces';
import {BaseResponseOptions, ResponseOptions} from 'angular2/src/http/base_response_options';
export {MockConnection, MockBackend} from 'angular2/src/http/backends/mock_backend';
export {Request} from 'angular2/src/http/static_request';
export {Response} from 'angular2/src/http/static_response';
export {
IRequestOptions,
IResponseOptions,
Connection,
ConnectionBackend
} from 'angular2/src/http/interfaces';
export {BrowserXhr} from 'angular2/src/http/backends/browser_xhr';
export {BaseRequestOptions, RequestOptions} from 'angular2/src/http/base_request_options';
export {BaseResponseOptions, ResponseOptions} from 'angular2/src/http/base_response_options';
export {XHRBackend, XHRConnection} from 'angular2/src/http/backends/xhr_backend';
export {JSONPBackend, JSONPConnection} from 'angular2/src/http/backends/jsonp_backend';
export {Http, Jsonp} from 'angular2/src/http/http';
export {Headers} from 'angular2/src/http/headers';
export {
ResponseTypes,
ReadyStates,
RequestMethods,
RequestCredentialsOpts,
RequestCacheOpts,
RequestModesOpts
} from 'angular2/src/http/enums';
export {URLSearchParams} from 'angular2/src/http/url_search_params';
/**
* Provides a basic set of injectables to use the {@link Http} service in any application.
*
* #Example
*
* ```
* import {httpInjectables, Http} from 'angular2/http';
* @Component({selector: 'http-app', viewBindings: [httpInjectables]})
* @View({template: '{{data}}'})
* class MyApp {
* constructor(http:Http) {
* http.request('data.txt').subscribe(res => this.data = res.text());
* }
* }
* ```
*
*/
export var httpInjectables: List<any> = [
bind(ConnectionBackend)
.toClass(XHRBackend),
BrowserXhr,
bind(RequestOptions).toClass(BaseRequestOptions),
bind(ResponseOptions).toClass(BaseResponseOptions),
Http
];
export var jsonpInjectables: List<any> = [
bind(ConnectionBackend)
.toClass(JSONPBackend),
BrowserJsonp,
bind(RequestOptions).toClass(BaseRequestOptions),
bind(ResponseOptions).toClass(BaseResponseOptions),
Jsonp
];

View File

@ -4,6 +4,7 @@ environment:
dependencies: dependencies:
angular2: '^<%= packageJson.version %>' angular2: '^<%= packageJson.version %>'
angular2_material: '^<%= packageJson.version %>' angular2_material: '^<%= packageJson.version %>'
http: '^<%= packageJson.version %>'
browser: '^0.10.0' browser: '^0.10.0'
dev_dependencies: dev_dependencies:
guinness: '^0.1.17' guinness: '^0.1.17'
@ -14,6 +15,8 @@ dependency_overrides:
path: ../angular2 path: ../angular2
angular2_material: angular2_material:
path: ../angular2_material path: ../angular2_material
http:
path: ../http
transformers: transformers:
- angular2: - angular2:
$exclude: $exclude:

View File

@ -1,5 +1,5 @@
import {Component, View, NgFor} from 'angular2/angular2'; import {Component, View, NgFor} from 'angular2/angular2';
import {Http, Response} from 'angular2/http'; import {Http, Response} from 'http/http';
import {ObservableWrapper} from 'angular2/src/facade/async'; import {ObservableWrapper} from 'angular2/src/facade/async';
@Component({selector: 'http-app'}) @Component({selector: 'http-app'})

View File

@ -1,7 +1,7 @@
/// <reference path="../../../angular2/typings/rx/rx.d.ts" /> /// <reference path="../../../angular2/typings/rx/rx.d.ts" />
import {bootstrap} from 'angular2/bootstrap'; import {bootstrap} from 'angular2/bootstrap';
import {httpInjectables} from 'angular2/http'; import {httpInjectables} from 'http/http';
import {HttpCmp} from './http_comp'; import {HttpCmp} from './http_comp';
export function main() { export function main() {

View File

@ -1,6 +1,6 @@
import {HttpCmp} from './http_comp'; import {HttpCmp} from './http_comp';
import {bootstrap} from 'angular2/bootstrap'; import {bootstrap} from 'angular2/bootstrap';
import {httpInjectables} from 'angular2/http'; import {httpInjectables} from 'http/http';
export function main() { export function main() {
// This entry point is not transformed and exists for testing dynamic mode. // This entry point is not transformed and exists for testing dynamic mode.

View File

@ -1,7 +1,7 @@
/// <reference path="../../../angular2/typings/rx/rx.d.ts" /> /// <reference path="../../../angular2/typings/rx/rx.d.ts" />
import {bootstrap} from 'angular2/bootstrap'; import {bootstrap} from 'angular2/bootstrap';
import {jsonpInjectables} from 'angular2/http'; import {jsonpInjectables} from 'http/http';
import {JsonpCmp} from './jsonp_comp'; import {JsonpCmp} from './jsonp_comp';
export function main() { export function main() {

View File

@ -1,6 +1,6 @@
import {JsonpCmp} from './jsonp_comp'; import {JsonpCmp} from './jsonp_comp';
import {bootstrap} from 'angular2/bootstrap'; import {bootstrap} from 'angular2/bootstrap';
import {jsonpInjectables} from 'angular2/http'; import {jsonpInjectables} from 'http/http';
export function main() { export function main() {
bootstrap(JsonpCmp, [jsonpInjectables]); bootstrap(JsonpCmp, [jsonpInjectables]);

View File

@ -1,7 +1,7 @@
library examples.src.jsonp.jsonp_comp; library examples.src.jsonp.jsonp_comp;
import "package:angular2/angular2.dart" show Component, View, NgFor; import "package:angular2/angular2.dart" show Component, View, NgFor;
import "package:angular2/http.dart" show Jsonp; import "package:http/http.dart" show Jsonp;
import "package:angular2/src/facade/async.dart" show ObservableWrapper; import "package:angular2/src/facade/async.dart" show ObservableWrapper;
@Component(selector: "jsonp-app") @Component(selector: "jsonp-app")

View File

@ -1,5 +1,5 @@
import {Component, View, NgFor} from 'angular2/angular2'; import {Component, View, NgFor} from 'angular2/angular2';
import {Jsonp, Response} from 'angular2/http'; import {Jsonp, Response} from 'http/http';
import {ObservableWrapper} from 'angular2/src/facade/async'; import {ObservableWrapper} from 'angular2/src/facade/async';
@Component({selector: 'jsonp-app'}) @Component({selector: 'jsonp-app'})

View File

@ -8,7 +8,7 @@ import {
Location, Location,
RouteParams RouteParams
} from 'angular2/router'; } from 'angular2/router';
import {Http, Response} from 'angular2/http'; import {Http, Response} from 'http/http';
import {ObservableWrapper, PromiseWrapper} from 'angular2/src/facade/async'; import {ObservableWrapper, PromiseWrapper} from 'angular2/src/facade/async';
import {ListWrapper} from 'angular2/src/facade/collection'; import {ListWrapper} from 'angular2/src/facade/collection';
import {isPresent} from 'angular2/src/facade/lang'; import {isPresent} from 'angular2/src/facade/lang';

View File

@ -2,7 +2,7 @@ import {InboxApp} from './inbox-app';
import {bind} from 'angular2/angular2'; import {bind} from 'angular2/angular2';
import {bootstrap} from 'angular2/bootstrap'; import {bootstrap} from 'angular2/bootstrap';
import {routerInjectables, HashLocationStrategy, LocationStrategy} from 'angular2/router'; import {routerInjectables, HashLocationStrategy, LocationStrategy} from 'angular2/router';
import {httpInjectables} from 'angular2/http'; import {httpInjectables} from 'http/http';
import {reflector} from 'angular2/src/reflection/reflection'; import {reflector} from 'angular2/src/reflection/reflection';
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities'; import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';

80
modules/http/http.ts Normal file
View File

@ -0,0 +1,80 @@
/**
* @module
* @description
* The http module provides services to perform http requests. To get started, see the {@link Http}
* class.
*/
import {bind, Binding} from 'angular2/di';
import {Http, Jsonp} from 'http/src/http';
import {XHRBackend, XHRConnection} from 'http/src/backends/xhr_backend';
import {JSONPBackend, JSONPConnection} from 'http/src/backends/jsonp_backend';
import {BrowserXhr} from 'http/src/backends/browser_xhr';
import {BrowserJsonp} from 'http/src/backends/browser_jsonp';
import {BaseRequestOptions, RequestOptions} from 'http/src/base_request_options';
import {ConnectionBackend} from 'http/src/interfaces';
import {BaseResponseOptions, ResponseOptions} from 'http/src/base_response_options';
export {MockConnection, MockBackend} from 'http/src/backends/mock_backend';
export {Request} from 'http/src/static_request';
export {Response} from 'http/src/static_response';
export {
IRequestOptions,
IResponseOptions,
Connection,
ConnectionBackend
} from 'http/src/interfaces';
export {BrowserXhr} from 'http/src/backends/browser_xhr';
export {BaseRequestOptions, RequestOptions} from 'http/src/base_request_options';
export {BaseResponseOptions, ResponseOptions} from 'http/src/base_response_options';
export {XHRBackend, XHRConnection} from 'http/src/backends/xhr_backend';
export {JSONPBackend, JSONPConnection} from 'http/src/backends/jsonp_backend';
export {Http, Jsonp} from 'http/src/http';
export {Headers} from 'http/src/headers';
export {
ResponseTypes,
ReadyStates,
RequestMethods,
RequestCredentialsOpts,
RequestCacheOpts,
RequestModesOpts
} from 'http/src/enums';
export {URLSearchParams} from 'http/src/url_search_params';
/**
* Provides a basic set of injectables to use the {@link Http} service in any application.
*
* #Example
*
* ```
* import {httpInjectables, Http} from 'http/http';
* @Component({selector: 'http-app', viewBindings: [httpInjectables]})
* @View({template: '{{data}}'})
* class MyApp {
* constructor(http:Http) {
* http.request('data.txt').subscribe(res => this.data = res.text());
* }
* }
* ```
*
*/
export var httpInjectables: List<any> = [
bind(ConnectionBackend)
.toClass(XHRBackend),
BrowserXhr,
bind(RequestOptions).toClass(BaseRequestOptions),
bind(ResponseOptions).toClass(BaseResponseOptions),
Http
];
export var jsonpInjectables: List<any> = [
bind(ConnectionBackend)
.toClass(JSONPBackend),
BrowserJsonp,
bind(RequestOptions).toClass(BaseRequestOptions),
bind(ResponseOptions).toClass(BaseResponseOptions),
Jsonp
];

View File

@ -0,0 +1,3 @@
library http.sfx;
// empty as we don't have a version for Dart

3
modules/http/http_sfx.ts Normal file
View File

@ -0,0 +1,3 @@
import * as ngHttp from './http';
(<any>window).ngHttp = ngHttp;

3
modules/http/index.dart Normal file
View File

@ -0,0 +1,3 @@
library http.index;
//no dart implementation

12
modules/http/index.ts Normal file
View File

@ -0,0 +1,12 @@
require('reflect-metadata');
require('traceur-runtime');
import {httpInjectables, jsonpInjectables, Http, Jsonp} from './http';
import {Injector} from 'angular2/angular2';
export * from './http';
/**
* TODO(jeffbcross): export each as their own top-level file, to require as:
* require('http/http'); require('http/jsonp');
*/
export var http = Injector.resolveAndCreate([httpInjectables]).get(Http);
export var jsonp = Injector.resolveAndCreate([jsonpInjectables]).get(Jsonp);

16
modules/http/package.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "ngHttp",
"version": "<%= packageJson.version %>",
"description": "Http module for Angular 2",
"homepage": "<%= packageJson.homepage %>",
"bugs": "<%= packageJson.bugs %>",
"contributors": <%= JSON.stringify(packageJson.contributors) %>,
"license": "<%= packageJson.license %>",
"dependencies": {
"angular2": "<%= packageJson.version %>",
"rx": "<%= packageJson.dependencies['rx'] %>",
"reflect-metadata": "<%= packageJson.dependencies['reflect-metadata'] %>",
"traceur": "<%= packageJson.dependencies['traceur'] %>"
},
"devDependencies": <%= JSON.stringify(packageJson.defaultDevDependencies) %>
}

19
modules/http/pubspec.yaml Normal file
View File

@ -0,0 +1,19 @@
name: http
version: <%= packageJson.version %>
authors:
<%= Object.keys(packageJson.contributors).map(function(name) {
return '- '+name+' <'+packageJson.contributors[name]+'>';
}).join('\n') %>
description: Angular 2 Http Module
homepage: <%= packageJson.homepage %>
environment:
sdk: '>=1.10.0 <2.0.0'
dependencies:
angular2: '^<%= packageJson.version %>'
dev_dependencies:
guinness: '^0.1.17'
dependency_overrides:
angular2:
path: ../angular2
transformers:
- angular2

View File

@ -1,4 +1,4 @@
library angular2.src.http.backends.browser_jsonp; library angular2_http.src.backends.browser_jsonp;
import 'package:angular2/di.dart'; import 'package:angular2/di.dart';
import 'dart:html' show document; import 'dart:html' show document;

View File

@ -1,4 +1,4 @@
library angular2.src.http.backends.browser_xhr; library angular2_http.src.backends.browser_xhr;
import 'dart:html' show HttpRequest; import 'dart:html' show HttpRequest;
import 'package:angular2/di.dart'; import 'package:angular2/di.dart';

View File

@ -1,8 +1,8 @@
import {Injectable} from 'angular2/di'; import {Injectable} from 'angular2/di';
import {Request} from 'angular2/src/http/static_request'; import {Request} from '../static_request';
import {Response} from 'angular2/src/http/static_response'; import {Response} from '../static_response';
import {ReadyStates} from 'angular2/src/http/enums'; import {ReadyStates} from '../enums';
import {Connection, ConnectionBackend} from 'angular2/src/http/interfaces'; import {Connection, ConnectionBackend} from '../interfaces';
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async'; import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
import {isPresent} from 'angular2/src/facade/lang'; import {isPresent} from 'angular2/src/facade/lang';
import {IMPLEMENTS, BaseException} from 'angular2/src/facade/lang'; import {IMPLEMENTS, BaseException} from 'angular2/src/facade/lang';
@ -107,7 +107,7 @@ export class MockConnection {
* #Example * #Example
* *
* ``` * ```
* import {MockBackend, DefaultOptions, Http} from 'angular2/http'; * import {MockBackend, DefaultOptions, Http} from 'http/http';
* it('should get some data', inject([AsyncTestCompleter], (async) => { * it('should get some data', inject([AsyncTestCompleter], (async) => {
* var connection; * var connection;
* var injector = Injector.resolveAndCreate([ * var injector = Injector.resolveAndCreate([
@ -140,7 +140,7 @@ export class MockBackend {
* #Example * #Example
* *
* ``` * ```
* import {MockBackend, Http, BaseRequestOptions} from 'angular2/http'; * import {MockBackend, Http, BaseRequestOptions} from 'http/http';
* import {Injector} from 'angular2/di'; * import {Injector} from 'angular2/di';
* *
* it('should get a response', () => { * it('should get a response', () => {

View File

@ -84,7 +84,8 @@ export class XHRConnection implements Connection {
* #Example * #Example
* *
* ``` * ```
* import {Http, MyNodeBackend, httpInjectables, BaseRequestOptions} from 'angular2/http'; * import {Http, MyNodeBackend, httpInjectables, BaseRequestOptions} from
*'angular2/http';
* @Component({ * @Component({
* viewBindings: [ * viewBindings: [
* httpInjectables, * httpInjectables,

View File

@ -1,4 +1,4 @@
library angular2.src.http.http_utils; library angular2_http.src.http_utils;
import 'dart:js' show JsObject; import 'dart:js' show JsObject;
import 'dart:collection' show LinkedHashMap, LinkedHashSet; import 'dart:collection' show LinkedHashMap, LinkedHashSet;

View File

@ -1,4 +1,4 @@
/// <reference path="../../typings/rx/rx.d.ts" /> /// <reference path="../../angular2/typings/rx/rx.d.ts" />
import { import {
ReadyStates, ReadyStates,

View File

@ -12,17 +12,17 @@ import {
SpyObject SpyObject
} from 'angular2/test_lib'; } from 'angular2/test_lib';
import {ObservableWrapper} from 'angular2/src/facade/async'; import {ObservableWrapper} from 'angular2/src/facade/async';
import {BrowserJsonp} from 'angular2/src/http/backends/browser_jsonp'; import {BrowserJsonp} from 'http/src/backends/browser_jsonp';
import {JSONPConnection, JSONPBackend} from 'angular2/src/http/backends/jsonp_backend'; import {JSONPConnection, JSONPBackend} from 'http/src/backends/jsonp_backend';
import {bind, Injector} from 'angular2/di'; import {bind, Injector} from 'angular2/di';
import {isPresent, StringWrapper} from 'angular2/src/facade/lang'; import {isPresent, StringWrapper} from 'angular2/src/facade/lang';
import {TimerWrapper} from 'angular2/src/facade/async'; import {TimerWrapper} from 'angular2/src/facade/async';
import {Request} from 'angular2/src/http/static_request'; import {Request} from 'http/src/static_request';
import {Response} from 'angular2/src/http/static_response'; import {Response} from 'http/src/static_response';
import {Map} from 'angular2/src/facade/collection'; import {Map} from 'angular2/src/facade/collection';
import {RequestOptions, BaseRequestOptions} from 'angular2/src/http/base_request_options'; import {RequestOptions, BaseRequestOptions} from 'http/src/base_request_options';
import {BaseResponseOptions, ResponseOptions} from 'angular2/src/http/base_response_options'; import {BaseResponseOptions, ResponseOptions} from 'http/src/base_response_options';
import {ResponseTypes, ReadyStates, RequestMethods} from 'angular2/src/http/enums'; import {ResponseTypes, ReadyStates, RequestMethods} from 'http/src/enums';
var addEventListenerSpy; var addEventListenerSpy;
var existingScripts = []; var existingScripts = [];

View File

@ -12,16 +12,16 @@ import {
SpyObject SpyObject
} from 'angular2/test_lib'; } from 'angular2/test_lib';
import {ObservableWrapper} from 'angular2/src/facade/async'; import {ObservableWrapper} from 'angular2/src/facade/async';
import {BrowserXhr} from 'angular2/src/http/backends/browser_xhr'; import {BrowserXhr} from 'http/src/backends/browser_xhr';
import {XHRConnection, XHRBackend} from 'angular2/src/http/backends/xhr_backend'; import {XHRConnection, XHRBackend} from 'http/src/backends/xhr_backend';
import {bind, Injector} from 'angular2/di'; import {bind, Injector} from 'angular2/di';
import {Request} from 'angular2/src/http/static_request'; import {Request} from 'http/src/static_request';
import {Response} from 'angular2/src/http/static_response'; import {Response} from 'http/src/static_response';
import {Headers} from 'angular2/src/http/headers'; import {Headers} from 'http/src/headers';
import {Map} from 'angular2/src/facade/collection'; import {Map} from 'angular2/src/facade/collection';
import {RequestOptions, BaseRequestOptions} from 'angular2/src/http/base_request_options'; import {RequestOptions, BaseRequestOptions} from 'http/src/base_request_options';
import {BaseResponseOptions, ResponseOptions} from 'angular2/src/http/base_response_options'; import {BaseResponseOptions, ResponseOptions} from 'http/src/base_response_options';
import {ResponseTypes} from 'angular2/src/http/enums'; import {ResponseTypes} from 'http/src/enums';
var abortSpy; var abortSpy;
var sendSpy; var sendSpy;

View File

@ -9,8 +9,8 @@ import {
it, it,
xit xit
} from 'angular2/test_lib'; } from 'angular2/test_lib';
import {BaseRequestOptions, RequestOptions} from 'angular2/src/http/base_request_options'; import {BaseRequestOptions, RequestOptions} from 'http/src/base_request_options';
import {RequestMethods, RequestModesOpts} from 'angular2/src/http/enums'; import {RequestMethods, RequestModesOpts} from 'http/src/enums';
export function main() { export function main() {
describe('BaseRequestOptions', () => { describe('BaseRequestOptions', () => {

View File

@ -1,4 +1,4 @@
import {Headers} from 'angular2/src/http/headers'; import {Headers} from 'http/src/headers';
import {Map, StringMapWrapper} from 'angular2/src/facade/collection'; import {Map, StringMapWrapper} from 'angular2/src/facade/collection';
import { import {
AsyncTestCompleter, AsyncTestCompleter,

View File

@ -11,17 +11,20 @@ import {
xit, xit,
SpyObject SpyObject
} from 'angular2/test_lib'; } from 'angular2/test_lib';
import {Http} from 'angular2/src/http/http';
import {Injector, bind} from 'angular2/di'; import {Injector, bind} from 'angular2/di';
import {MockBackend, MockConnection} from 'angular2/src/http/backends/mock_backend'; import {MockBackend, MockConnection} from 'http/src/backends/mock_backend';
import {Response} from 'angular2/src/http/static_response';
import {RequestMethods} from 'angular2/src/http/enums';
import {BaseRequestOptions, RequestOptions} from 'angular2/src/http/base_request_options';
import {ResponseOptions} from 'angular2/src/http/base_response_options';
import {Request} from 'angular2/src/http/static_request';
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async'; import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
import {ConnectionBackend} from 'angular2/src/http/interfaces'; import {
import {URLSearchParams} from 'angular2/src/http/url_search_params'; BaseRequestOptions,
ConnectionBackend,
Http,
Request,
RequestMethods,
RequestOptions,
Response,
ResponseOptions,
URLSearchParams
} from 'http/http';
class SpyObserver extends SpyObject { class SpyObserver extends SpyObject {
onNext: Function; onNext: Function;

View File

@ -9,7 +9,7 @@ import {
it, it,
xit xit
} from 'angular2/test_lib'; } from 'angular2/test_lib';
import {URLSearchParams} from 'angular2/src/http/url_search_params'; import {URLSearchParams} from 'http/src/url_search_params';
export function main() { export function main() {
describe('URLSearchParams', () => { describe('URLSearchParams', () => {

View File

@ -53,3 +53,4 @@ function publishModule {
publishRttsAssert publishRttsAssert
publishModule angular2 publishModule angular2
publishModule benchpress publishModule benchpress
publishModule http

View File

@ -33,9 +33,9 @@ function publishModule {
node scripts/publish/pubspec_cleaner.js --pubspec-file=$PUBLISH_DIR/pubspec.yaml node scripts/publish/pubspec_cleaner.js --pubspec-file=$PUBLISH_DIR/pubspec.yaml
if [[ "$DRY_RUN" == "false" ]]; then #if [[ "$DRY_RUN" == "false" ]]; then
(cd $PUBLISH_DIR && pub publish -f) # (cd $PUBLISH_DIR && pub publish -f)
fi; #fi;
} }
publishModule angular2 publishModule angular2

View File

@ -19,6 +19,7 @@ System.paths = {
'*': './*.js', '*': './*.js',
'benchpress/*': 'dist/js/dev/es5/benchpress/*.js', 'benchpress/*': 'dist/js/dev/es5/benchpress/*.js',
'angular2/*': 'dist/js/dev/es5/angular2/*.js', 'angular2/*': 'dist/js/dev/es5/angular2/*.js',
'http/*': 'dist/js/dev/es5/http/*.js',
'rtts_assert/*': 'dist/js/dev/es5/rtts_assert/*.js', 'rtts_assert/*': 'dist/js/dev/es5/rtts_assert/*.js',
'rx': 'node_modules/rx/dist/rx.js' 'rx': 'node_modules/rx/dist/rx.js'
}; };

View File

@ -14,10 +14,10 @@ var projectRootDir = path.normalize(path.join(__dirname, '..', '..', '..', '..')
module.exports = function makeNodeTree(destinationPath) { module.exports = function makeNodeTree(destinationPath) {
// list of npm packages that this build will create // list of npm packages that this build will create
var outputPackages = ['angular2', 'benchpress', 'rtts_assert']; var outputPackages = ['angular2', 'http', 'benchpress', 'rtts_assert'];
var modulesTree = new Funnel('modules', { var modulesTree = new Funnel('modules', {
include: ['angular2/**', 'benchpress/**', 'rtts_assert/**', '**/e2e_test/**'], include: ['angular2/**', 'http/**', 'benchpress/**', 'rtts_assert/**', '**/e2e_test/**'],
exclude: [ exclude: [
// the following code and tests are not compatible with CJS/node environment // the following code and tests are not compatible with CJS/node environment
'angular2/test/core/zone/**', 'angular2/test/core/zone/**',