Skip to content

Commit

Permalink
fix(replace): The preventAssignment option is treated as a value to…
Browse files Browse the repository at this point in the history
… replace (#1768)

* Fix `preventAssignment` option treated as a value to replace

* Test the change

* Test the change

* Test the change

* Update the test snapshot

* chore: update snapshots

* chore: use pnpm lock from upstream

---------

Co-authored-by: shellscape <[email protected]>
  • Loading branch information
Finesse and shellscape authored Sep 23, 2024
1 parent d823443 commit 0a31668
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/replace/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function getReplacements(options) {
delete values.sourcemap;
delete values.sourceMap;
delete values.objectGuards;
delete values.preventAssignment;
return values;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
sourcemap: true,
sourceMap: true,
include: '**/input.js',
exclude: 'node_modules/**'
exclude: 'node_modules/**',
preventAssignment: false
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ console.log(`
sourceMap
include
exclude
preventAssignment
`);
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ console.log(`
sourceMap
include
exclude
preventAssignment
`);
1 change: 1 addition & 0 deletions packages/replace/test/snapshots/form.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Generated by [AVA](https://avajs.dev).
sourceMap␊
include␊
exclude␊
preventAssignment␊
\`);`

## process-check: Handles process type guards in replacements
Expand Down
Binary file modified packages/replace/test/snapshots/form.js.snap
Binary file not shown.
Binary file modified packages/replace/test/snapshots/misc.js.snap
Binary file not shown.
Binary file modified packages/replace/test/snapshots/sourcemaps.js.snap
Binary file not shown.

0 comments on commit 0a31668

Please sign in to comment.