Skip to content

Commit fe6a5d2

Browse files
clydindgp1130
authored andcommitted
refactor(@angular-devkit/core): remove usage of custom deepCopy and deprecate it (#33051)
The custom deepCopy function in @angular-devkit/core is no longer used internally in this package after replacing its usage in registry.ts with the native structuredClone. The function is now marked as deprecated to encourage consumers to migrate to structuredClone, which is supported in modern Node.js versions. PR Close #33051
1 parent ba7dd2f commit fe6a5d2

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

packages/angular_devkit/core/src/json/schema/registry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import * as https from 'node:https';
1313
import * as Url from 'node:url';
1414
import { Observable, from, isObservable, lastValueFrom } from 'rxjs';
1515
import { BaseException } from '../../exception';
16-
import { PartiallyOrderedSet, deepCopy } from '../../utils';
16+
import { PartiallyOrderedSet } from '../../utils';
1717
import { JsonArray, JsonObject, JsonValue, isJsonObject } from '../utils';
1818
import {
1919
JsonPointer,
@@ -257,7 +257,7 @@ export class CoreSchemaRegistry implements SchemaRegistry {
257257
}
258258
}
259259

260-
const schemaCopy = deepCopy(validate.schema as JsonObject);
260+
const schemaCopy = structuredClone(validate.schema as JsonObject);
261261
visitJsonSchema(schemaCopy, visitor);
262262

263263
return schemaCopy;

packages/angular_devkit/core/src/utils/object.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
const copySymbol = Symbol();
1010

11+
/**
12+
* @deprecated Use `structuredClone` instead.
13+
*/
1114
export function deepCopy<T>(value: T): T {
1215
if (Array.isArray(value)) {
1316
return value.map((o) => deepCopy(o)) as unknown as T;

0 commit comments

Comments
 (0)