chore(nx-dev): use structuredClone for cloning objects (#14698)
This commit is contained in:
parent
d5c5952386
commit
5bd087f553
@ -36,7 +36,7 @@ export class DocumentsApi {
|
||||
throw new Error('public document sources cannot be undefined');
|
||||
}
|
||||
|
||||
this.manifest = Object.assign({}, this.options.manifest);
|
||||
this.manifest = structuredClone(this.options.manifest);
|
||||
}
|
||||
private getManifestKey(path: string): string {
|
||||
return '/' + path;
|
||||
|
||||
@ -7,7 +7,7 @@ export class TagsApi {
|
||||
throw new Error('tags property cannot be undefined');
|
||||
}
|
||||
|
||||
this.manifest = Object.assign({}, this.tags);
|
||||
this.manifest = structuredClone(this.tags);
|
||||
}
|
||||
|
||||
getAssociatedItems(tag: string): RelatedDocument[] {
|
||||
|
||||
@ -38,7 +38,7 @@ export class PackagesApi {
|
||||
throw new Error('public document sources cannot be undefined');
|
||||
}
|
||||
|
||||
this.manifest = Object.assign({}, this.options.manifest);
|
||||
this.manifest = structuredClone(this.options.manifest);
|
||||
}
|
||||
|
||||
getFilePath(path: string): string {
|
||||
|
||||
@ -466,7 +466,7 @@ function generateJsonExampleForHelper(
|
||||
}
|
||||
|
||||
if (matchedType === 'object') {
|
||||
const example = Object.assign({}, ...examples);
|
||||
const example = structuredClone(examples);
|
||||
return Example.of(example);
|
||||
} else if (
|
||||
matchedType === 'string' ||
|
||||
|
||||
@ -393,7 +393,7 @@ function documentRecurseOperations(
|
||||
target: DocumentMetadata,
|
||||
parent: DocumentMetadata
|
||||
): DocumentMetadata {
|
||||
const document: DocumentMetadata = Object.assign({}, target);
|
||||
const document: DocumentMetadata = structuredClone(target);
|
||||
|
||||
/**
|
||||
* Calculate `path`
|
||||
|
||||
@ -72,7 +72,7 @@ export function schemaResolver(
|
||||
resolveExamplesFile: () => void;
|
||||
getSchema: () => NxSchema;
|
||||
} {
|
||||
const updatedSchema: NxSchema = Object.assign({}, schema);
|
||||
const updatedSchema: NxSchema = structuredClone(schema);
|
||||
return {
|
||||
resolveReferences: () => {
|
||||
traverseAndReplaceReferences(updatedSchema, '$ref', lookup);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user