unplugin-utils
Advanced tools
+3
-9
| import { isAbsolute, join, resolve } from "pathe"; | ||
| import pm from "picomatch"; | ||
| //#region src/path.ts | ||
@@ -11,3 +10,2 @@ /** | ||
| } | ||
| //#endregion | ||
@@ -21,3 +19,2 @@ //#region src/utils.ts | ||
| } | ||
| //#endregion | ||
@@ -28,4 +25,3 @@ //#region src/filter.ts | ||
| if (resolutionBase === false || isAbsolute(id) || id.startsWith("**")) return normalizePath(id); | ||
| const basePath = normalizePath(resolve(resolutionBase || "")).replaceAll(/[-^$*+?.()|[\]{}]/g, `${escapeMark}$&`); | ||
| return join(basePath, normalizePath(id)).replaceAll(escapeMark, "\\"); | ||
| return join(normalizePath(resolve(resolutionBase || "")).replaceAll(/[-^$*+?.()|[\]{}]/g, `${escapeMark}$&`), normalizePath(id)).replaceAll(escapeMark, "\\"); | ||
| } | ||
@@ -47,4 +43,3 @@ /** | ||
| const getMatcher = (id) => id instanceof RegExp ? id : { test: (what) => { | ||
| const pattern = getMatcherString(id, resolutionBase); | ||
| return pm(pattern, { dot: true })(what); | ||
| return pm(getMatcherString(id, resolutionBase), { dot: true })(what); | ||
| } }; | ||
@@ -69,4 +64,3 @@ const includeMatchers = toArray(include).map(getMatcher); | ||
| } | ||
| //#endregion | ||
| export { createFilter, normalizePath, toArray }; | ||
| export { createFilter, normalizePath, toArray }; |
+29
-35
| { | ||
| "name": "unplugin-utils", | ||
| "version": "0.3.1", | ||
| "type": "module", | ||
| "version": "0.3.2", | ||
| "description": "A set of utility functions commonly used by unplugins.", | ||
| "type": "module", | ||
| "author": "Kevin Deng <sxzz@sxzz.moe>", | ||
| "license": "MIT", | ||
| "funding": "https://github.com/sponsors/sxzz", | ||
| "homepage": "https://github.com/sxzz/unplugin-utils#readme", | ||
| "bugs": { | ||
| "url": "https://github.com/sxzz/unplugin-utils/issues" | ||
| }, | ||
| "repository": { | ||
@@ -15,10 +14,5 @@ "type": "git", | ||
| }, | ||
| "author": "Kevin Deng <sxzz@sxzz.moe>", | ||
| "funding": "https://github.com/sponsors/sxzz", | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "main": "./dist/index.js", | ||
| "module": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "bugs": { | ||
| "url": "https://github.com/sxzz/unplugin-utils/issues" | ||
| }, | ||
| "exports": { | ||
@@ -28,32 +22,32 @@ ".": "./dist/index.js", | ||
| }, | ||
| "types": "./dist/index.d.ts", | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "engines": { | ||
| "node": ">=20.19.0" | ||
| }, | ||
| "dependencies": { | ||
| "pathe": "^2.0.3", | ||
| "picomatch": "^4.0.3" | ||
| "picomatch": "^4.0.4" | ||
| }, | ||
| "devDependencies": { | ||
| "@sxzz/eslint-config": "^7.2.7", | ||
| "@sxzz/prettier-config": "^2.2.4", | ||
| "@types/node": "^24.7.0", | ||
| "@types/picomatch": "^4.0.2", | ||
| "@vitest/coverage-v8": "3.2.4", | ||
| "bumpp": "^10.3.1", | ||
| "eslint": "^9.37.0", | ||
| "oxc-transform": "^0.94.0", | ||
| "prettier": "^3.6.2", | ||
| "tsdown": "^0.15.6", | ||
| "tsx": "^4.20.6", | ||
| "typescript": "^5.9.3", | ||
| "vitest": "^3.2.4" | ||
| "@sxzz/eslint-config": "^8.2.1", | ||
| "@sxzz/prettier-config": "^2.3.1", | ||
| "@types/node": "^26.0.1", | ||
| "@types/picomatch": "^4.0.3", | ||
| "@typescript/native-preview": "7.0.0-dev.20260629.1", | ||
| "@vitest/coverage-v8": "4.1.9", | ||
| "bumpp": "^11.1.0", | ||
| "eslint": "^10.6.0", | ||
| "prettier": "^3.9.3", | ||
| "tsdown": "^0.22.3", | ||
| "tsdown-preset-sxzz": "^0.6.0", | ||
| "typescript": "^6.0.3", | ||
| "vitest": "^4.1.9" | ||
| }, | ||
| "engines": { | ||
| "node": ">=20.19.0" | ||
| }, | ||
| "prettier": "@sxzz/prettier-config", | ||
| "tsdown": { | ||
| "platform": "neutral", | ||
| "exports": true | ||
| }, | ||
| "scripts": { | ||
@@ -65,3 +59,3 @@ "lint": "eslint --cache .", | ||
| "test": "vitest", | ||
| "typecheck": "tsc --noEmit", | ||
| "typecheck": "tsgo --noEmit", | ||
| "format": "prettier --cache --write .", | ||
@@ -68,0 +62,0 @@ "release": "bumpp" |
9902
-1.42%91
-1.09%Updated