chore: disable dart for HTTP package

BREAKING CHANGE

Stop supporting http module in Dart. This is because Dart has a
well developed http package which should be used by Dart
customers instead.
This commit is contained in:
Misko Hevery 2015-08-12 13:03:28 -07:00
parent 38945955ab
commit 284dc67076
15 changed files with 2137 additions and 1968 deletions

View File

@ -621,7 +621,7 @@ gulp.task('test.unit.dart', function (done) {
return;
}
watch(['modules/angular2/**', 'modules/http/**'], { ignoreInitial: true }, [
watch(['modules/angular2/**'], { ignoreInitial: true }, [
'!build/tree.dart',
'!test.unit.dart/karma-run'
]);

View File

@ -4,7 +4,6 @@ environment:
dependencies:
angular2: '^<%= packageJson.version %>'
angular2_material: '^<%= packageJson.version %>'
http: '^<%= packageJson.version %>'
browser: '^0.10.0'
dev_dependencies:
guinness: '^0.1.17'
@ -15,8 +14,6 @@ dependency_overrides:
path: ../angular2
angular2_material:
path: ../angular2_material
http:
path: ../http
transformers:
- angular2:
$exclude:
@ -29,7 +26,6 @@ transformers:
entry_points:
- web/src/gestures/index.dart
- web/src/hello_world/index.dart
- web/src/http/index.dart
- web/src/key_events/index.dart
- web/src/sourcemap/index.dart
- web/src/todo/index.dart
@ -53,7 +49,6 @@ transformers:
reflection_entry_points:
- web/src/gestures/index.dart
- web/src/hello_world/index.dart
- web/src/http/index.dart
- web/src/key_events/index.dart
- web/src/sourcemap/index.dart
- web/src/todo/index.dart

View File

@ -1,25 +0,0 @@
library examples.src.jsonp.jsonp_comp;
import "package:angular2/angular2.dart" show Component, View, NgFor;
import "package:http/http.dart" show Jsonp;
import "package:angular2/src/facade/async.dart" show ObservableWrapper;
@Component(selector: "jsonp-app")
@View(
directives: const [NgFor],
template: '''
<h1>people</h1>
<ul class="people">
<li *ng-for="#person of people">
hello, {{person[\'name\']}}
</li>
</ul>
''')
class JsonpCmp {
Object people;
JsonpCmp(Jsonp jsonp) {
ObservableWrapper.subscribe(
jsonp.get("./people.json?callback=JSONP_CALLBACK"),
(res) => this.people = res.json().toList());
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ import {
Location,
RouteParams
} from 'angular2/router';
import {Http, Response} from 'http/http';
import * as db from './data';
import {ObservableWrapper, PromiseWrapper} from 'angular2/src/facade/async';
import {ListWrapper} from 'angular2/src/facade/collection';
import {isPresent} from 'angular2/src/facade/lang';
@ -59,12 +59,9 @@ class InboxRecord {
@Injectable()
class DbService {
constructor(public http: Http) {}
getData() {
var p = PromiseWrapper.completer();
ObservableWrapper.subscribe<Response>(this.http.get('./db.json'),
(resp) => { p.resolve(resp.json()); });
p.resolve(db.data);
return p.promise;
}

View File

@ -2,14 +2,11 @@ import {InboxApp} from './inbox-app';
import {bind} from 'angular2/angular2';
import {bootstrap} from 'angular2/bootstrap';
import {routerInjectables, HashLocationStrategy, LocationStrategy} from 'angular2/router';
import {HTTP_BINDINGS} from 'http/http';
import {reflector} from 'angular2/src/reflection/reflection';
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
export function main() {
reflector.reflectionCapabilities = new ReflectionCapabilities();
bootstrap(
InboxApp,
[routerInjectables, HTTP_BINDINGS, bind(LocationStrategy).toClass(HashLocationStrategy)]);
bootstrap(InboxApp, [routerInjectables, bind(LocationStrategy).toClass(HashLocationStrategy)]);
}

View File

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

View File

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

View File

@ -1,19 +0,0 @@
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,62 +0,0 @@
library angular2_http.src.backends.browser_jsonp;
import 'package:angular2/di.dart';
import 'dart:html' show document;
import 'dart:js' show context, JsObject, JsArray;
int _nextRequestId = 0;
const JSONP_HOME = '__ng_jsonp__';
var _jsonpConnections = null;
JsObject _getJsonpConnections() {
if (_jsonpConnections == null) {
_jsonpConnections = context[JSONP_HOME] = new JsObject(context['Object']);
}
return _jsonpConnections;
}
// Make sure not to evaluate this in a non-browser environment!
@Injectable()
class BrowserJsonp {
// Construct a <script> element with the specified URL
dynamic build(String url) {
var node = document.createElement('script');
node.src = url;
return node;
}
nextRequestID() {
return "__req${_nextRequestId++}";
}
requestCallback(String id) {
return """${JSONP_HOME}.${id}.finished""";
}
exposeConnection(String id, dynamic connection) {
var connections = _getJsonpConnections();
var wrapper = new JsObject(context['Object']);
wrapper['_id'] = id;
wrapper['__dart__'] = connection;
wrapper['finished'] = ([dynamic data]) => connection.finished(data);
connections[id] = wrapper;
}
removeConnection(String id) {
var connections = _getJsonpConnections();
connections[id] = null;
}
// Attach the <script> element to the DOM
send(dynamic node) {
document.body.append(node);
}
// Remove <script> element from the DOM
cleanup(dynamic node) {
node.remove();
}
}

View File

@ -1,11 +0,0 @@
library angular2_http.src.backends.browser_xhr;
import 'dart:html' show HttpRequest;
import 'package:angular2/di.dart';
@Injectable()
class BrowserXhr {
HttpRequest build() {
return new HttpRequest();
}
}

View File

@ -1,8 +0,0 @@
library angular2_http.src.http_utils;
import 'dart:js' show JsObject;
import 'dart:collection' show LinkedHashMap, LinkedHashSet;
bool isJsObject(o) {
return o is JsObject || o is LinkedHashMap || o is LinkedHashSet;
}

View File

@ -5,11 +5,13 @@ config.baseUrl = 'http://localhost:8002/';
config.exclude.push(
'dist/js/cjs/examples/e2e_test/sourcemap/sourcemap_spec.js',
'dist/js/cjs/examples/e2e_test/http/http_spec.js',
'dist/js/cjs/examples/e2e_test/jsonp/jsonp_spec.js',
// TODO: remove this line when largetable dart has been added
'dist/js/cjs/benchmarks_external/e2e_test/largetable_perf.js',
'dist/js/cjs/benchmarks_external/e2e_test/polymer_tree_perf.js',
'dist/js/cjs/benchmarks_external/e2e_test/react_tree_perf.js'
);
data.createBenchpressRunner({ lang: 'dart' });

View File

@ -13,11 +13,23 @@ import ts2dart from '../broccoli-ts2dart';
import dartfmt from '../broccoli-dartfmt';
import replace from '../broccoli-replace';
var global_excludes = [
'rtts_assert/**/*',
'http/**/*',
'examples/src/http/**/*',
'examples/test/http/**/*',
'examples/src/jsonp/**/*',
'examples/test/jsonp/**/*'
];
/**
* A funnel starting at modules, including the given filters, and moving into the root.
* @param include Include glob filters.
*/
function modulesFunnel(include: string[], exclude?: string[]) {
exclude = exclude || [];
exclude = exclude.concat(global_excludes);
return new Funnel('modules', {include, destDir: '/', exclude});
}
@ -44,7 +56,7 @@ function stripModulePrefix(relativePath: string): string {
function getSourceTree() {
// Transpile everything in 'modules' except for rtts_assertions.
var tsInputTree = modulesFunnel(['**/*.js', '**/*.ts', '**/*.dart'], ['rtts_assert/**/*']);
var tsInputTree = modulesFunnel(['**/*.js', '**/*.ts', '**/*.dart']);
var transpiled = ts2dart(tsInputTree, {
generateLibraryName: true,
generateSourceMap: false,
@ -135,7 +147,7 @@ function getDocsTree() {
var licenses = new MultiCopy('', {
srcPath: 'LICENSE',
targetPatterns: ['modules/*'],
exclude: ['*/rtts_assert'], // Not in dart.
exclude: ['*/rtts_assert', '*/http', '*/upgrade'], // Not in dart.
});
licenses = stew.rename(licenses, stripModulePrefix);