Skip to content

Commit

Permalink
perf: move check to transformInclude
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Mar 3, 2024
1 parent 1d20c6b commit 3897a72
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,17 @@ export default createUnplugin<Options | undefined, false>((rawOptions = {}) => {
buildStart() {
if (![true, false].includes(preventAssignment)) {
console.warn({
message:
"unplugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.",
message: `${name}: 'preventAssignment' currently defaults to false. It is recommended to set this option to \`true\`, as the next major version will default this option to \`true\`.`,
})
}
},

transformInclude(id) {
if (keys.length === 0) return false
return filter(id)
},

transform(code, id) {
if (keys.length === 0) return null
if (!filter(id)) return null
return executeReplacement(code, id)
},

Expand Down

0 comments on commit 3897a72

Please sign in to comment.