Skip to content

Commit 6f068a0

Browse files
committed
Fix to deep clone preset settings
1 parent f3e71a8 commit 6f068a0

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

lib/index.js

+4-9
Original file line numberDiff line numberDiff line change
@@ -1124,8 +1124,6 @@ export class Processor extends CallableInstance {
11241124
use(value, ...parameters) {
11251125
const attachers = this.attachers
11261126
const namespace = this.namespace
1127-
/** @type {Record<string, unknown> | undefined} */
1128-
let settings
11291127

11301128
assertUnfrozen('use', this.frozen)
11311129

@@ -1143,11 +1141,6 @@ export class Processor extends CallableInstance {
11431141
throw new TypeError('Expected usable value, not `' + value + '`')
11441142
}
11451143

1146-
if (settings) {
1147-
// To do: structured clone?
1148-
namespace.settings = Object.assign(namespace.settings || {}, settings)
1149-
}
1150-
11511144
return this
11521145

11531146
/**
@@ -1184,8 +1177,10 @@ export class Processor extends CallableInstance {
11841177
addList(result.plugins)
11851178

11861179
if (result.settings) {
1187-
// To do: structured clone?
1188-
settings = Object.assign(settings || {}, result.settings)
1180+
namespace.settings = {
1181+
...namespace.settings,
1182+
...structuredClone(result.settings)
1183+
}
11891184
}
11901185
}
11911186

0 commit comments

Comments
 (0)