Skip to content

Commit

Permalink
Fix to deep clone preset settings
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 14, 2023
1 parent f3e71a8 commit 6f068a0
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1124,8 +1124,6 @@ export class Processor extends CallableInstance {
use(value, ...parameters) {
const attachers = this.attachers
const namespace = this.namespace
/** @type {Record<string, unknown> | undefined} */
let settings

assertUnfrozen('use', this.frozen)

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

if (settings) {
// To do: structured clone?
namespace.settings = Object.assign(namespace.settings || {}, settings)
}

return this

/**
Expand Down Expand Up @@ -1184,8 +1177,10 @@ export class Processor extends CallableInstance {
addList(result.plugins)

if (result.settings) {
// To do: structured clone?
settings = Object.assign(settings || {}, result.settings)
namespace.settings = {
...namespace.settings,
...structuredClone(result.settings)
}
}
}

Expand Down

0 comments on commit 6f068a0

Please sign in to comment.