fix(packages): use ES modules for primary build (#11120)
This commit is contained in:
committed by
Victor Berchet
parent
8cb1046ce9
commit
979657989b
@@ -6,16 +6,11 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
export {HttpModule, JsonpModule} from './http';
|
||||
export {BrowserXhr} from './src/backends/browser_xhr';
|
||||
export {JSONPBackend, JSONPConnection} from './src/backends/jsonp_backend';
|
||||
export {CookieXSRFStrategy, XHRBackend, XHRConnection} from './src/backends/xhr_backend';
|
||||
export {BaseRequestOptions, RequestOptions} from './src/base_request_options';
|
||||
export {BaseResponseOptions, ResponseOptions} from './src/base_response_options';
|
||||
export {ReadyState, RequestMethod, ResponseContentType, ResponseType} from './src/enums';
|
||||
export {Headers} from './src/headers';
|
||||
export {Http, Jsonp} from './src/http';
|
||||
export {Connection, ConnectionBackend, RequestOptionsArgs, ResponseOptionsArgs, XSRFStrategy} from './src/interfaces';
|
||||
export {Request} from './src/static_request';
|
||||
export {Response} from './src/static_response';
|
||||
export {QueryEncoder, URLSearchParams} from './src/url_search_params';
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Entry point for all public APIs of the http package.
|
||||
*/
|
||||
export * from './src/index';
|
||||
|
||||
// This file only reexports content of the `src` folder. Keep it that way.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "@angular/http",
|
||||
"version": "0.0.0-PLACEHOLDER",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"jsnext:main": "esm/index.js",
|
||||
"description": "Angular 2 http",
|
||||
"main": "bundles/http.umd.js",
|
||||
"module": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
"author": "angular",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
export default {
|
||||
entry: '../../../dist/packages-dist/http/testing/index.js',
|
||||
dest: '../../../dist/packages-dist/http/bundles/http-testing.umd.js',
|
||||
format: 'umd',
|
||||
moduleName: 'ng.http.testing',
|
||||
globals: {
|
||||
'@angular/core': 'ng.core',
|
||||
'@angular/compiler': 'ng.compiler',
|
||||
'@angular/platform-browser': 'ng.platformBrowser',
|
||||
'@angular/http': 'ng.http',
|
||||
'rxjs/Subject': 'Rx',
|
||||
'rxjs/ReplaySubject': 'Rx',
|
||||
'rxjs/Observable': 'Rx',
|
||||
'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.
|
||||
'rxjs/operator/toPromise': 'Rx.Observable.prototype',
|
||||
'rxjs/operator/take': 'Rx.Observable.prototype',
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
export default {
|
||||
entry: '../../../dist/packages-dist/http/esm/index.js',
|
||||
dest: '../../../dist/packages-dist/http/esm/http.umd.js',
|
||||
entry: '../../../dist/packages-dist/http/index.js',
|
||||
dest: '../../../dist/packages-dist/http/bundles/http.umd.js',
|
||||
format: 'umd',
|
||||
moduleName: 'ng.http',
|
||||
globals: {
|
||||
@@ -12,8 +12,5 @@ export default {
|
||||
'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.
|
||||
'rxjs/operator/toPromise': 'Rx.Observable.prototype',
|
||||
'rxjs/Observable': 'Rx'
|
||||
},
|
||||
plugins: [
|
||||
// nodeResolve({ jsnext: true, main: true }),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
*/
|
||||
import {NgModule} from '@angular/core';
|
||||
|
||||
import {BrowserJsonp} from './src/backends/browser_jsonp';
|
||||
import {BrowserXhr} from './src/backends/browser_xhr';
|
||||
import {JSONPBackend, JSONPBackend_} from './src/backends/jsonp_backend';
|
||||
import {CookieXSRFStrategy, XHRBackend} from './src/backends/xhr_backend';
|
||||
import {BaseRequestOptions, RequestOptions} from './src/base_request_options';
|
||||
import {BaseResponseOptions, ResponseOptions} from './src/base_response_options';
|
||||
import {Http, Jsonp} from './src/http';
|
||||
import {XSRFStrategy} from './src/interfaces';
|
||||
import {BrowserJsonp} from './backends/browser_jsonp';
|
||||
import {BrowserXhr} from './backends/browser_xhr';
|
||||
import {JSONPBackend, JSONPBackend_} from './backends/jsonp_backend';
|
||||
import {CookieXSRFStrategy, XHRBackend} from './backends/xhr_backend';
|
||||
import {BaseRequestOptions, RequestOptions} from './base_request_options';
|
||||
import {BaseResponseOptions, ResponseOptions} from './base_response_options';
|
||||
import {Http, Jsonp} from './http';
|
||||
import {XSRFStrategy} from './interfaces';
|
||||
|
||||
|
||||
export function _createDefaultCookieXSRFStrategy() {
|
||||
@@ -17,7 +17,7 @@ export function normalizeMethodName(method: string | RequestMethod): RequestMeth
|
||||
.replace(
|
||||
/(\w)(\w*)/g,
|
||||
(g0: string, g1: string, g2: string) => g1.toUpperCase() + g2.toLowerCase());
|
||||
method = <number>(<{[key: string]: any}>RequestMethod)[method];
|
||||
method = <RequestMethod>(<{[key: string]: any}>RequestMethod)[method];
|
||||
if (typeof method !== 'number')
|
||||
throw new Error(`Invalid request method. The method "${originalMethod}" is not supported.`);
|
||||
}
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
// Index to be used if Http is ever configured as a standalone npm package.
|
||||
// require('reflect-metadata');
|
||||
// require('core-js');
|
||||
// import {HTTP_PROVIDERS, JSONP_PROVIDERS, Http, Jsonp} from './http';
|
||||
// import {Injector} from '@angular/core';
|
||||
// export * from './http';
|
||||
|
||||
// /**
|
||||
// * TODO(jeffbcross): export each as their own top-level file, to require as:
|
||||
// * require('@angular/http'); require('http/jsonp');
|
||||
// */
|
||||
// export var http = Injector.resolveAndCreate([HTTP_PROVIDERS]).get(Http);
|
||||
// export var jsonp = Injector.resolveAndCreate([JSONP_PROVIDERS]).get(Jsonp);
|
||||
export {BrowserXhr} from './backends/browser_xhr';
|
||||
export {JSONPBackend, JSONPConnection} from './backends/jsonp_backend';
|
||||
export {CookieXSRFStrategy, XHRBackend, XHRConnection} from './backends/xhr_backend';
|
||||
export {BaseRequestOptions, RequestOptions} from './base_request_options';
|
||||
export {BaseResponseOptions, ResponseOptions} from './base_response_options';
|
||||
export {ReadyState, RequestMethod, ResponseContentType, ResponseType} from './enums';
|
||||
export {Headers} from './headers';
|
||||
export {Http, Jsonp} from './http';
|
||||
export {HttpModule, JsonpModule} from './http_module';
|
||||
export {Connection, ConnectionBackend, RequestOptionsArgs, ResponseOptionsArgs, XSRFStrategy} from './interfaces';
|
||||
export {Request} from './static_request';
|
||||
export {Response} from './static_response';
|
||||
export {QueryEncoder, URLSearchParams} from './url_search_params';
|
||||
|
||||
@@ -71,4 +71,4 @@ export type ResponseOptionsArgs = {
|
||||
headers?: Headers;
|
||||
type?: ResponseType;
|
||||
url?: string;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,4 +6,9 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
export * from './testing/mock_backend';
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Entry point for all public APIs of the platform-server/testing package.
|
||||
*/
|
||||
export * from './mock_backend';
|
||||
@@ -7,17 +7,11 @@
|
||||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Connection, ConnectionBackend, ReadyState, Request, Response} from '@angular/http';
|
||||
import {ReplaySubject} from 'rxjs/ReplaySubject';
|
||||
import {Subject} from 'rxjs/Subject';
|
||||
import {take} from 'rxjs/operator/take';
|
||||
|
||||
import {ReadyState} from '../src/enums';
|
||||
import {isPresent} from '../src/facade/lang';
|
||||
import {Connection, ConnectionBackend} from '../src/interfaces';
|
||||
import {Request} from '../src/static_request';
|
||||
import {Response} from '../src/static_response';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -232,7 +226,7 @@ export class MockBackend implements ConnectionBackend {
|
||||
* against the framework itself, not by end-users.
|
||||
*/
|
||||
createConnection(req: Request): MockConnection {
|
||||
if (!isPresent(req) || !(req instanceof Request)) {
|
||||
if (!req || !(req instanceof Request)) {
|
||||
throw new Error(`createConnection requires an instance of Request, got ${req}`);
|
||||
}
|
||||
let connection = new MockConnection(req);
|
||||
|
||||
+7
-8
@@ -4,24 +4,23 @@
|
||||
"declaration": true,
|
||||
"stripInternal": true,
|
||||
"experimentalDecorators": true,
|
||||
"module": "commonjs",
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../../dist/packages-dist/http/",
|
||||
"outDir": "../../../dist/packages-dist/http",
|
||||
"paths": {
|
||||
"@angular/core": ["../../../dist/packages-dist/core"],
|
||||
"@angular/common": ["../../../dist/packages-dist/common"],
|
||||
"@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"]
|
||||
"@angular/http": ["../../../dist/packages-dist/http"],
|
||||
"rxjs/*": ["../../../node_modules/rxjs/*"]
|
||||
},
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
"lib": ["es6", "dom"],
|
||||
"target": "es5"
|
||||
"target": "es5",
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"files": [
|
||||
"index.ts",
|
||||
"testing.ts",
|
||||
"../../../node_modules/zone.js/dist/zone.js.d.ts"
|
||||
"testing/index.ts"
|
||||
],
|
||||
"angularCompilerOptions": {
|
||||
"strictMetadataEmit": true
|
||||
@@ -6,7 +6,7 @@
|
||||
"experimentalDecorators": true,
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../../dist/packages-dist/http/esm",
|
||||
"outDir": "../../../dist/packages-dist/http",
|
||||
"paths": {
|
||||
"@angular/core": ["../../../dist/packages-dist/core"],
|
||||
"@angular/common": ["../../../dist/packages-dist/common"],
|
||||
@@ -15,11 +15,12 @@
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
"target": "es2015"
|
||||
"target": "es5",
|
||||
"skipLibCheck": true,
|
||||
"lib": ["es2015", "dom"]
|
||||
},
|
||||
"files": [
|
||||
"index.ts",
|
||||
"testing.ts",
|
||||
"../../../node_modules/zone.js/dist/zone.js.d.ts"
|
||||
],
|
||||
"angularCompilerOptions": {
|
||||
Reference in New Issue
Block a user