Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(common): temporarily re-export and deprecate XhrFactory #41393

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions aio/content/guide/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ v12 - v15
| ----------------------------- | --------------------------------------------------------------------------- | ----------------- |
| `@angular/common` | [`ReflectiveInjector`](#reflectiveinjector) | <!--v8--> v11 |
| `@angular/common` | [`CurrencyPipe` - `DEFAULT_CURRENCY_CODE`](api/common/CurrencyPipe#currency-code-deprecation) | <!--v9--> v11 |
| `@angular/common/http` | [`XhrFactory`](api/common/http/XhrFactory) | <!--v12--> v15 |
| `@angular/core` | [`DefaultIterableDiffer`](#core) | <!--v7--> v11 |
| `@angular/core` | [`ReflectiveKey`](#core) | <!--v8--> v11 |
| `@angular/core` | [`RenderComponentType`](#core) | <!--v7--> v11 |
Expand Down Expand Up @@ -82,6 +83,14 @@ Tip: In the [API reference section](api) of this doc site, deprecated APIs are i
| [`CurrencyPipe` - `DEFAULT_CURRENCY_CODE`](api/common/CurrencyPipe#currency-code-deprecation) | `{provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}` | v9 | From v11 the default code will be extracted from the locale data given by `LOCAL_ID`, rather than `USD`. |


{@a common-http}
### @angular/common/http

| API | Replacement | Deprecation announced | Notes |
| -------------------------------------------- | ------------------------------------ | --------------------- | ----- |
| [`XhrFactory`](api/common/http/XhrFactory) | `XhrFactory` in `@angular/common` | v12 | The `XhrFactory` has moved from `@angular/common/http` to `@angular/common`. |


{@a core}
### @angular/core

Expand Down
5 changes: 4 additions & 1 deletion goldens/public-api/common/http/http.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1930,7 +1930,7 @@ export declare interface HttpUserEvent<T> {
}

export declare class HttpXhrBackend implements HttpBackend {
constructor(xhrFactory: XhrFactory);
constructor(xhrFactory: XhrFactory_2);
handle(req: HttpRequest<any>): Observable<HttpEvent<any>>;
}

Expand All @@ -1947,3 +1947,6 @@ export declare class JsonpInterceptor {
constructor(jsonp: JsonpClientBackend);
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
}

/** @deprecated */
export declare type XhrFactory = XhrFactory_2;
21 changes: 21 additions & 0 deletions packages/common/http/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@
* found in the LICENSE file at https://angular.io/license
*/

import {XhrFactory as XhrFactory_fromAngularCommon} from '@angular/common';

/**
* A wrapper around the `XMLHttpRequest` constructor.
*
* @publicApi
* @see `XhrFactory`
* @deprecated
* `XhrFactory` has moved, please import `XhrFactory` from `@angular/common` instead.
*/
export type XhrFactory = XhrFactory_fromAngularCommon;
/**
* A wrapper around the `XMLHttpRequest` constructor.
*
* @publicApi
* @see `XhrFactory`
* @deprecated
* `XhrFactory` has moved, please import `XhrFactory` from `@angular/common` instead.
*/
export const XhrFactory = XhrFactory_fromAngularCommon;

export {HttpBackend, HttpHandler} from './src/backend';
export {HttpClient} from './src/client';
export {HttpContext, HttpContextToken} from './src/context';
Expand Down
6 changes: 6 additions & 0 deletions scripts/ci/publish-build-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ function publishPackages {

for dir in $PKGS_DIST/*/
do
if [[ ! -f "$dir/package.json" ]]; then
# Only publish directories that contain a `package.json` file.
echo "Skipping $dir, it does not contain a package to be published."
continue
fi

COMPONENT="$(basename ${dir})"

# Replace _ with - in component name.
Expand Down