Visitar URL original
chore: fix lint · unplugin/unplugin-replace@45bb5c1 · GitHub
Skip to content

Commit 45bb5c1

Browse files
committed
chore: fix lint
1 parent 1984344 commit 45bb5c1

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎package.json‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22
"name": "unplugin-replace",
33
"type": "module",
44
"version": "0.9.0",
5-
"devEngines": {
6-
"packageManager": {
7-
"name": "pnpm",
8-
"version": "12.11.2",
9-
"onFail": "download"
10-
}
11-
},
125
"description": "A universal bundler plugin which replaces targeted strings in files.",
136
"author": "Kevin Deng <sxzz@sxzz.moe>",
147
"license": "MIT",
@@ -49,9 +42,17 @@
4942
"engines": {
5043
"node": "^22.18.0 || >=24.0.0"
5144
},
45+
"devEngines": {
46+
"packageManager": {
47+
"name": "pnpm",
48+
"version": "12.11.2",
49+
"onFail": "download"
50+
}
51+
},
5252
"scripts": {
5353
"lint": "eslint --cache .",
5454
"lint:fix": "pnpm run lint --fix",
55+
"format": "prettier --write .",
5556
"build": "tsdown",
5657
"dev": "tsdown --watch",
5758
"test": "vitest",

‎src/core/options.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type { FilterPattern } from 'unplugin'
22

33
export type Replacement =
4-
| string
5-
| ((id: string, match: RegExpExecArray) => string)
4+
string | ((id: string, match: RegExpExecArray) => string)
65
export type ReplaceItem<F = string | RegExp> = {
76
find: F
87
replacement: Replacement

‎src/index.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const plugin: UnpluginInstance<Options | undefined, false> = createUnplugin<
105105
vite: {
106106
configResolved(config) {
107107
options.sourceMap =
108-
config.command === 'build' ? !!config.build.sourcemap : true
108+
config.command !== 'build' || !!config.build.sourcemap
109109
},
110110
},
111111
}
@@ -148,7 +148,7 @@ function longest(a: string, b: string) {
148148
}
149149

150150
const objKeyRegEx =
151-
/^([$A-Z_\u00A0-\uFFFF][\w$\u00A0-\uFFFF]*)(\.([$A-Z_\u00A0-\uFFFF][\w$\u00A0-\uFFFF]*))+$/i
151+
/^([$A-Z_\u{A0}-\u{10FFFF}][\w$\u{A0}-\u{10FFFF}]*)(\.([$A-Z_\u{A0}-\u{10FFFF}][\w$\u{A0}-\u{10FFFF}]*))+$/iu
152152
function expandTypeofReplacements(values: ReplaceItem<string>[]) {
153153
values.forEach(({ find }) => {
154154
const objMatch = find.match(objKeyRegEx)

0 commit comments

Comments
 (0)