Commit 0dfbbcc
committed
refactor: stop cloning minimizer options on every asset
The per-asset shallow clone in `optimize()` only existed because
`minify.js` mutated `module`/`ecma` on the caller's options object, which
would have leaked across assets when a single options object was shared.
Move that overlay inside the `minify.js` loop and build it as a fresh
object via spread, so the same source options reference is safe to reuse.
`optimize()` no longer pre-expands a `minimizerOptionsList`: when the
configured options are an array, slice the matching subset (references,
not clones); otherwise pass the single object straight through. With a
shared options object and N minimizers across M assets that drops the
cloning from N×M to a single overlay per minimizer call.1 parent 12e271d commit 0dfbbcc
2 files changed
Lines changed: 24 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
387 | 386 | | |
388 | 387 | | |
389 | 388 | | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | 389 | | |
398 | 390 | | |
399 | 391 | | |
| |||
578 | 570 | | |
579 | 571 | | |
580 | 572 | | |
581 | | - | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
582 | 576 | | |
583 | 577 | | |
584 | 578 | | |
585 | | - | |
| 579 | + | |
| 580 | + | |
586 | 581 | | |
587 | 582 | | |
588 | | - | |
589 | | - | |
590 | | - | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
591 | 586 | | |
592 | 587 | | |
593 | 588 | | |
| |||
599 | 594 | | |
600 | 595 | | |
601 | 596 | | |
602 | | - | |
| 597 | + | |
603 | 598 | | |
604 | 599 | | |
605 | 600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
327 | | - | |
| 326 | + | |
| 327 | + | |
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
344 | 345 | | |
345 | 346 | | |
346 | 347 | | |
| |||
0 commit comments