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