Skip to content

Commit 3b7d9be

Browse files
committed
chore: add tsconfigPaths plugin
1 parent 9d8969c commit 3b7d9be

File tree

10 files changed

+81
-40
lines changed

10 files changed

+81
-40
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"scripts": {
1515
"build": "pnpm run -r build",
1616
"dev": "pnpm -r run dev",
17-
"test": "vitest run --coverage.enabled",
18-
"test:dev": "vitest --coverage.enabled",
17+
"test": "vitest run",
18+
"test:dev": "vitest",
1919
"lint": "eslint packages/**/*.ts --fix",
2020
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
2121
"preinstall": "npx only-allow pnpm",
@@ -58,6 +58,7 @@
5858
"unbuild": "^2.0.0",
5959
"unplugin": "^1.11.0",
6060
"unplugin-tailwindcss-mangle": "workspace:*",
61+
"vite-tsconfig-paths": "^4.3.2",
6162
"vitest": "^2.0.1"
6263
}
6364
}

packages/config/package.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,8 @@
1919
"utils"
2020
],
2121
"exports": {
22-
".": {
23-
"types": "./dist/index.d.ts",
24-
"import": "./dist/index.mjs",
25-
"require": "./dist/index.cjs"
26-
}
22+
".": "./src/index.ts"
2723
},
28-
"main": "./dist/index.cjs",
29-
"module": "./dist/index.mjs",
30-
"types": "./dist/index.d.ts",
3124
"typesVersions": {
3225
"*": {
3326
"*": [
@@ -47,7 +40,17 @@
4740
},
4841
"publishConfig": {
4942
"access": "public",
50-
"registry": "https://registry.npmjs.org/"
43+
"registry": "https://registry.npmjs.org/",
44+
"exports": {
45+
".": {
46+
"types": "./dist/index.d.ts",
47+
"import": "./dist/index.mjs",
48+
"require": "./dist/index.cjs"
49+
}
50+
},
51+
"main": "./dist/index.cjs",
52+
"module": "./dist/index.mjs",
53+
"types": "./dist/index.d.ts"
5154
},
5255
"dependencies": {
5356
"@tailwindcss-mangle/shared": "workspace:^",

packages/core/package.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,8 @@
1919
"mangle"
2020
],
2121
"exports": {
22-
".": {
23-
"types": "./dist/index.d.ts",
24-
"import": "./dist/index.mjs",
25-
"require": "./dist/index.cjs"
26-
}
22+
".": "./src/index.ts"
2723
},
28-
"main": "./dist/index.cjs",
29-
"module": "./dist/index.mjs",
30-
"types": "./dist/index.d.ts",
3124
"typesVersions": {
3225
"*": {
3326
"*": [
@@ -48,7 +41,17 @@
4841
},
4942
"publishConfig": {
5043
"access": "public",
51-
"registry": "https://registry.npmjs.org/"
44+
"registry": "https://registry.npmjs.org/",
45+
"exports": {
46+
".": {
47+
"types": "./dist/index.d.ts",
48+
"import": "./dist/index.mjs",
49+
"require": "./dist/index.cjs"
50+
}
51+
},
52+
"main": "./dist/index.cjs",
53+
"module": "./dist/index.mjs",
54+
"types": "./dist/index.d.ts"
5255
},
5356
"dependencies": {
5457
"@ast-core/escape": "^1.0.1",

packages/core/src/html/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Parser } from 'htmlparser2'
22
import MagicString from 'magic-string'
3-
import { makeRegex, splitCode } from '@/shared'
4-
import type { IHandlerTransformResult, IHtmlHandlerOptions } from '@/types'
3+
import { makeRegex, splitCode } from '../shared'
4+
import type { IHandlerTransformResult, IHtmlHandlerOptions } from '../types'
55

66
export function htmlHandler(raw: string | MagicString, options: IHtmlHandlerOptions): IHandlerTransformResult {
77
const { ctx, id } = options

packages/core/src/js/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import type { StringLiteral, TemplateElement } from '@babel/types'
22
import MagicString from 'magic-string'
33
import { jsStringEscape } from '@ast-core/escape'
44
import { sort } from 'fast-sort'
5-
import type { IHandlerTransformResult, IJsHandlerOptions } from '@/types'
6-
import { makeRegex, splitCode } from '@/shared'
7-
import { parse, traverse } from '@/babel'
5+
import type { IHandlerTransformResult, IJsHandlerOptions } from '../types'
6+
import { makeRegex, splitCode } from '../shared'
7+
import { parse, traverse } from '../babel'
88

99
export function handleValue(raw: string, node: StringLiteral | TemplateElement, options: IJsHandlerOptions, ms: MagicString, offset: number, escape: boolean) {
1010
const { ctx, splitQuote = true, id } = options

packages/core/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
"src",
1313
"test"
1414
]
15-
}
15+
}

packages/shared/package.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,8 @@
1818
"utils"
1919
],
2020
"exports": {
21-
".": {
22-
"types": "./dist/index.d.ts",
23-
"import": "./dist/index.mjs",
24-
"require": "./dist/index.cjs"
25-
}
21+
".": "./src/index.ts"
2622
},
27-
"main": "./dist/index.cjs",
28-
"module": "./dist/index.mjs",
29-
"types": "./dist/index.d.ts",
3023
"typesVersions": {
3124
"*": {
3225
"*": [
@@ -46,7 +39,17 @@
4639
},
4740
"publishConfig": {
4841
"access": "public",
49-
"registry": "https://registry.npmjs.org/"
42+
"registry": "https://registry.npmjs.org/",
43+
"exports": {
44+
".": {
45+
"types": "./dist/index.d.ts",
46+
"import": "./dist/index.mjs",
47+
"require": "./dist/index.cjs"
48+
}
49+
},
50+
"main": "./dist/index.cjs",
51+
"module": "./dist/index.mjs",
52+
"types": "./dist/index.d.ts"
5053
},
5154
"dependencies": {},
5255
"devDependencies": {}

packages/unplugin-tailwindcss-mangle/vitest.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import path from 'node:path'
22
import { defineProject } from 'vitest/config'
3+
import tsconfigPaths from 'vite-tsconfig-paths'
34

45
export default defineProject({
6+
plugins: [tsconfigPaths()],
57
test: {
68
alias: [
79
{

pnpm-lock.yaml

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsconfig.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"compilerOptions": {
33
"target": "ESNext",
44
"module": "ESNext",
5-
"moduleResolution": "Node",
6-
"esModuleInterop": true,
7-
"strict": true,
5+
"moduleResolution": "Bundler",
86
"types": [
97
"vitest/globals"
10-
]
8+
],
9+
"strict": true,
10+
"esModuleInterop": true
1111
}
12-
}
12+
}

0 commit comments

Comments
 (0)