@kasoa/vite-plus-config 0.1.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +211 -89
- package/dist/compose-Cichpffs.d.mts +14 -0
- package/dist/compose-Cichpffs.d.mts.map +1 -0
- package/dist/constants-D2PDomKY.mjs +33 -0
- package/dist/constants-D2PDomKY.mjs.map +1 -0
- package/dist/src/cloudflare-workers/index.d.mts +6 -10
- package/dist/src/cloudflare-workers/index.d.mts.map +1 -1
- package/dist/src/cloudflare-workers/index.mjs +10 -8
- package/dist/src/cloudflare-workers/index.mjs.map +1 -1
- package/dist/src/index.d.mts +47 -0
- package/dist/src/index.d.mts.map +1 -0
- package/dist/src/index.mjs +745 -0
- package/dist/src/index.mjs.map +1 -0
- package/package.json +20 -35
- package/dist/base-5dFXSLDA.mjs +0 -288
- package/dist/base-5dFXSLDA.mjs.map +0 -1
- package/dist/config-Cxe-N0iS.d.mts +0 -16
- package/dist/config-Cxe-N0iS.d.mts.map +0 -1
- package/dist/src/base/index.d.mts +0 -7
- package/dist/src/base/index.d.mts.map +0 -1
- package/dist/src/base/index.mjs +0 -2
- package/dist/src/library/index.d.mts +0 -7
- package/dist/src/library/index.d.mts.map +0 -1
- package/dist/src/library/index.mjs +0 -15
- package/dist/src/library/index.mjs.map +0 -1
- package/dist/src/monorepo/index.d.mts +0 -7
- package/dist/src/monorepo/index.d.mts.map +0 -1
- package/dist/src/monorepo/index.mjs +0 -16
- package/dist/src/monorepo/index.mjs.map +0 -1
- package/dist/src/node/index.d.mts +0 -7
- package/dist/src/node/index.d.mts.map +0 -1
- package/dist/src/node/index.mjs +0 -10
- package/dist/src/node/index.mjs.map +0 -1
- package/dist/src/react/index.d.mts +0 -7
- package/dist/src/react/index.d.mts.map +0 -1
- package/dist/src/react/index.mjs +0 -13
- package/dist/src/react/index.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,152 +1,274 @@
|
|
|
1
1
|
# @kasoa/vite-plus-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Strict, composable Vite+ configuration fragments. Requires Node.js 24.11 or newer, Vite+ 0.2.8 or newer, and TypeScript 7.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
Install Vite+ and the shared config:
|
|
8
|
-
|
|
9
7
|
```bash
|
|
10
8
|
pnpm add -D @kasoa/vite-plus-config vite-plus typescript@^7
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
Create a local `vite.config.ts` and call the shared preset factory that matches the project.
|
|
11
|
+
The `*Config` exports are plain Vite+ configuration fragments; lint profiles, file patterns, and pack defaults are plain data. `composeConfig()` applies Vite's `mergeConfig()` from left to right and calls `defineConfig()` once. Arrays therefore retain Vite's normal concatenation behavior. Use it once at the final config boundary rather than nesting composed results. The separate Cloudflare export contains the only other function because its test plugin requires consumer options.
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
## Node
|
|
20
14
|
|
|
21
15
|
```ts
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
import {
|
|
17
|
+
baseToolingConfig,
|
|
18
|
+
composeConfig,
|
|
19
|
+
nodeRuntimeConfig,
|
|
20
|
+
nodeTestLintConfig,
|
|
21
|
+
} from "@kasoa/vite-plus-config";
|
|
22
|
+
|
|
23
|
+
export default composeConfig(baseToolingConfig, nodeRuntimeConfig, nodeTestLintConfig);
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
## React web
|
|
28
27
|
|
|
29
28
|
```ts
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
import {
|
|
30
|
+
baseToolingConfig,
|
|
31
|
+
browserRuntimeConfig,
|
|
32
|
+
composeConfig,
|
|
33
|
+
nodeTestLintConfig,
|
|
34
|
+
reactCoreConfig,
|
|
35
|
+
reactDomConfig,
|
|
36
|
+
} from "@kasoa/vite-plus-config";
|
|
37
|
+
|
|
38
|
+
export default composeConfig(
|
|
39
|
+
baseToolingConfig,
|
|
40
|
+
browserRuntimeConfig,
|
|
41
|
+
reactCoreConfig,
|
|
42
|
+
reactDomConfig,
|
|
43
|
+
nodeTestLintConfig,
|
|
44
|
+
);
|
|
33
45
|
```
|
|
34
46
|
|
|
35
|
-
The
|
|
47
|
+
The source runtime and test runtime are independent. The example uses Vitest's default Node runtime. For DOM-emulated tests, compose `browserTestLintConfig` instead and configure the matching Vitest environment explicitly. Test discovery uses Vite+/Vitest defaults; set `test.include` in a final fragment when a project needs a narrower scope.
|
|
36
48
|
|
|
37
|
-
|
|
49
|
+
## React Native and Expo
|
|
38
50
|
|
|
39
51
|
```ts
|
|
40
|
-
import {
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
import {
|
|
53
|
+
baseToolingConfig,
|
|
54
|
+
composeConfig,
|
|
55
|
+
nodeTestLintConfig,
|
|
56
|
+
reactCoreConfig,
|
|
57
|
+
reactNativeGeneratedConfig,
|
|
58
|
+
reactNativeRuntimeConfig,
|
|
59
|
+
} from "@kasoa/vite-plus-config";
|
|
60
|
+
|
|
61
|
+
export default composeConfig(
|
|
62
|
+
baseToolingConfig,
|
|
63
|
+
reactCoreConfig,
|
|
64
|
+
reactNativeRuntimeConfig,
|
|
65
|
+
reactNativeGeneratedConfig,
|
|
66
|
+
nodeTestLintConfig,
|
|
67
|
+
);
|
|
43
68
|
```
|
|
44
69
|
|
|
45
|
-
|
|
70
|
+
The native fragment permits React Native's `__DEV__` and Expo's statically replaced `process.env`, rejects DOM and Worker globals, excludes DOM accessibility rules, and ignores `.expo` output.
|
|
46
71
|
|
|
47
|
-
|
|
48
|
-
|
|
72
|
+
## Libraries and workspaces
|
|
73
|
+
|
|
74
|
+
Packaging and workspace behavior are independent fragments:
|
|
49
75
|
|
|
50
|
-
|
|
76
|
+
```ts
|
|
77
|
+
import {
|
|
78
|
+
baseToolingConfig,
|
|
79
|
+
composeConfig,
|
|
80
|
+
libraryPackConfig,
|
|
81
|
+
nodeRuntimeConfig,
|
|
82
|
+
nodeTestLintConfig,
|
|
83
|
+
} from "@kasoa/vite-plus-config";
|
|
84
|
+
|
|
85
|
+
export default composeConfig(
|
|
86
|
+
baseToolingConfig,
|
|
87
|
+
nodeRuntimeConfig,
|
|
88
|
+
nodeTestLintConfig,
|
|
89
|
+
libraryPackConfig,
|
|
90
|
+
{
|
|
91
|
+
pack: {
|
|
92
|
+
entry: {
|
|
93
|
+
"src/index": "./src/index.ts",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
);
|
|
51
98
|
```
|
|
52
99
|
|
|
53
|
-
|
|
100
|
+
Use `workspaceRunConfig` at a workspace root. Vite+ applies the root lint configuration to workspace-wide checks, so model package runtimes with the exported lint profiles in root `lint.overrides`:
|
|
54
101
|
|
|
55
102
|
```ts
|
|
56
|
-
import {
|
|
57
|
-
|
|
58
|
-
|
|
103
|
+
import {
|
|
104
|
+
RUNTIME_OVERRIDE_EXCLUDE_FILES,
|
|
105
|
+
baseToolingConfig,
|
|
106
|
+
cloudflareWorkerGeneratedConfig,
|
|
107
|
+
cloudflareWorkerLint,
|
|
108
|
+
composeConfig,
|
|
109
|
+
nodeTestLintConfig,
|
|
110
|
+
reactNativeGeneratedConfig,
|
|
111
|
+
reactNativeLint,
|
|
112
|
+
reactWebLint,
|
|
113
|
+
workspaceRunConfig,
|
|
114
|
+
} from "@kasoa/vite-plus-config";
|
|
115
|
+
|
|
116
|
+
export default composeConfig(
|
|
117
|
+
baseToolingConfig,
|
|
118
|
+
reactNativeGeneratedConfig,
|
|
119
|
+
cloudflareWorkerGeneratedConfig,
|
|
120
|
+
nodeTestLintConfig,
|
|
121
|
+
workspaceRunConfig,
|
|
122
|
+
{
|
|
123
|
+
lint: {
|
|
124
|
+
overrides: [
|
|
125
|
+
{
|
|
126
|
+
files: ["apps/mobile/**"],
|
|
127
|
+
excludeFiles: [...RUNTIME_OVERRIDE_EXCLUDE_FILES],
|
|
128
|
+
...reactNativeLint,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
files: ["apps/server/**"],
|
|
132
|
+
excludeFiles: [...RUNTIME_OVERRIDE_EXCLUDE_FILES],
|
|
133
|
+
...cloudflareWorkerLint,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
files: ["packages/web/**"],
|
|
137
|
+
excludeFiles: [...RUNTIME_OVERRIDE_EXCLUDE_FILES],
|
|
138
|
+
...reactWebLint,
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
);
|
|
59
144
|
```
|
|
60
145
|
|
|
61
|
-
|
|
146
|
+
`reactWebLint` and `reactNativeLint` are complete, plain Oxlint profiles for the common single-override case. Their lower-level runtime and React profiles remain available when a workspace needs separate scopes. Package configs still own local test, build, and pack wiring. For multiple pack operations, spread `libraryPackDefaults` into each entry instead of composing `libraryPackConfig` with a pack array.
|
|
62
147
|
|
|
63
|
-
|
|
148
|
+
## Mixed runtimes
|
|
64
149
|
|
|
65
|
-
|
|
66
|
-
import { createConfig } from "@kasoa/vite-plus-config/react";
|
|
150
|
+
The exported lint profiles are ordinary Oxlint override objects:
|
|
67
151
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
152
|
+
```ts
|
|
153
|
+
import {
|
|
154
|
+
baseToolingConfig,
|
|
155
|
+
cloudflareWorkerGeneratedConfig,
|
|
156
|
+
cloudflareWorkerRuntimeConfig,
|
|
157
|
+
composeConfig,
|
|
158
|
+
nodeLint,
|
|
159
|
+
} from "@kasoa/vite-plus-config";
|
|
160
|
+
|
|
161
|
+
export default composeConfig(
|
|
162
|
+
baseToolingConfig,
|
|
163
|
+
cloudflareWorkerRuntimeConfig,
|
|
164
|
+
cloudflareWorkerGeneratedConfig,
|
|
165
|
+
{
|
|
166
|
+
lint: {
|
|
167
|
+
overrides: [
|
|
168
|
+
{
|
|
169
|
+
files: ["scripts/**", "evals/**"],
|
|
170
|
+
...nodeLint,
|
|
171
|
+
},
|
|
172
|
+
],
|
|
77
173
|
},
|
|
78
174
|
},
|
|
79
|
-
|
|
175
|
+
);
|
|
80
176
|
```
|
|
81
177
|
|
|
82
|
-
|
|
178
|
+
Configuration and CommonJS files receive the Node profile from `baseToolingConfig` automatically. A broad workspace override should use `RUNTIME_OVERRIDE_EXCLUDE_FILES` so those files and tests remain under their narrower execution boundaries.
|
|
179
|
+
|
|
180
|
+
## Cloudflare Workers tests
|
|
83
181
|
|
|
84
|
-
|
|
182
|
+
Install the optional peers:
|
|
85
183
|
|
|
86
184
|
```bash
|
|
87
185
|
pnpm add -D @cloudflare/vitest-pool-workers wrangler
|
|
88
186
|
```
|
|
89
187
|
|
|
90
188
|
```ts
|
|
91
|
-
import {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
189
|
+
import {
|
|
190
|
+
baseToolingConfig,
|
|
191
|
+
cloudflareWorkerGeneratedConfig,
|
|
192
|
+
cloudflareWorkerRuntimeConfig,
|
|
193
|
+
cloudflareWorkerTestLintConfig,
|
|
194
|
+
composeConfig,
|
|
195
|
+
} from "@kasoa/vite-plus-config";
|
|
196
|
+
import { createCloudflareTestConfig } from "@kasoa/vite-plus-config/cloudflare-workers";
|
|
197
|
+
|
|
198
|
+
export default composeConfig(
|
|
199
|
+
baseToolingConfig,
|
|
200
|
+
cloudflareWorkerRuntimeConfig,
|
|
201
|
+
cloudflareWorkerGeneratedConfig,
|
|
202
|
+
cloudflareWorkerTestLintConfig,
|
|
203
|
+
createCloudflareTestConfig({
|
|
204
|
+
miniflare: {
|
|
205
|
+
bindings: {
|
|
206
|
+
CORS_ALLOWED_ORIGINS: "",
|
|
207
|
+
},
|
|
97
208
|
},
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
209
|
+
}),
|
|
210
|
+
{
|
|
211
|
+
test: {
|
|
212
|
+
provide: {
|
|
213
|
+
d1Migrations: [],
|
|
214
|
+
},
|
|
102
215
|
},
|
|
103
216
|
},
|
|
104
|
-
|
|
217
|
+
);
|
|
105
218
|
```
|
|
106
219
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
"scripts": {
|
|
112
|
-
"dev": "wrangler dev",
|
|
113
|
-
"build": "wrangler deploy --dry-run",
|
|
114
|
-
"check": "vp check",
|
|
115
|
-
"test": "vp test"
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
```
|
|
220
|
+
Wrangler owns Worker development, builds, type generation, and deployment. Vite+ owns checks and workerd tests.
|
|
221
|
+
|
|
222
|
+
## Overrides
|
|
119
223
|
|
|
120
|
-
|
|
224
|
+
Preset rules are inherited through Oxlint, so an ordinary final rule replaces a preset tuple atomically:
|
|
121
225
|
|
|
122
|
-
|
|
226
|
+
```ts
|
|
227
|
+
import { baseToolingConfig, composeConfig, nodeRuntimeConfig } from "@kasoa/vite-plus-config";
|
|
123
228
|
|
|
124
|
-
|
|
125
|
-
{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
229
|
+
export default composeConfig(baseToolingConfig, nodeRuntimeConfig, {
|
|
230
|
+
lint: {
|
|
231
|
+
rules: {
|
|
232
|
+
complexity: "off",
|
|
233
|
+
"max-params": ["warn", { max: 5 }],
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
});
|
|
131
237
|
```
|
|
132
238
|
|
|
133
|
-
|
|
239
|
+
To change a scoped test rule, construct that test fragment directly instead of composing the default one:
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
import type { ConfigFragment } from "@kasoa/vite-plus-config";
|
|
243
|
+
import { TEST_FILES, nodeTestLint } from "@kasoa/vite-plus-config";
|
|
134
244
|
|
|
135
|
-
|
|
245
|
+
const testLintConfig = {
|
|
246
|
+
lint: {
|
|
247
|
+
overrides: [
|
|
248
|
+
{
|
|
249
|
+
files: [...TEST_FILES],
|
|
250
|
+
...nodeTestLint,
|
|
251
|
+
rules: {
|
|
252
|
+
...nodeTestLint.rules,
|
|
253
|
+
"vitest/padding-around-test-blocks": "off",
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
},
|
|
258
|
+
} satisfies ConfigFragment;
|
|
259
|
+
```
|
|
136
260
|
|
|
137
|
-
|
|
261
|
+
React fragments report React Compiler violations but do not install or enable compiler transforms.
|
|
138
262
|
|
|
139
|
-
|
|
140
|
-
- **`react`**: `base` plus browser globals, React lint rules, and Tailwind-aware formatting. React Native or Expo projects that want to reject DOM globals can override `lint.env.browser` to `false`.
|
|
141
|
-
- **`node`**: `base` plus Node-oriented lint rules.
|
|
142
|
-
- **`library`**: `base` plus ESM-only packaging defaults for `vp pack`.
|
|
143
|
-
- **`monorepo`**: `base` plus root-only `run` defaults for workspace caching.
|
|
144
|
-
- **`cloudflare-workers`**: `node` plus Cloudflare Worker test wiring.
|
|
263
|
+
## Commands
|
|
145
264
|
|
|
146
|
-
|
|
265
|
+
```bash
|
|
266
|
+
vp check
|
|
267
|
+
vp check --fix
|
|
268
|
+
vp test
|
|
269
|
+
```
|
|
147
270
|
|
|
148
|
-
|
|
149
|
-
https://github.com/emmanuelchucks
|
|
271
|
+
Import Vitest APIs from `vite-plus/test`. Use `vp config` to generate commit hooks from the staged-check fragment.
|
|
150
272
|
|
|
151
273
|
## License
|
|
152
274
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UserConfig } from "vite-plus";
|
|
2
|
+
//#region src/compose.d.ts
|
|
3
|
+
interface NamedPlugin {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
}
|
|
6
|
+
type PluginValue = NamedPlugin | false | null | undefined;
|
|
7
|
+
type PluginInput = PluginValue | readonly PluginValue[];
|
|
8
|
+
type ConfigFragment = Omit<UserConfig, "plugins"> & {
|
|
9
|
+
readonly plugins?: readonly PluginInput[];
|
|
10
|
+
};
|
|
11
|
+
declare function composeConfig(...fragments: readonly ConfigFragment[]): UserConfig;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { PluginInput as n, composeConfig as r, ConfigFragment as t };
|
|
14
|
+
//# sourceMappingURL=compose-Cichpffs.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-Cichpffs.d.mts","names":[],"sources":["../src/compose.ts"],"mappings":";;UAGU;WACC;;KAGN,cAAc;KAEP,cAAc,uBAAuB;KAErC,iBAAiB,KAAK;WACvB,mBAAmB;;iBAQd,iBAAiB,oBAAoB,mBAAmB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/constants.ts
|
|
2
|
+
const CODE_FILES = ["**/*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}"];
|
|
3
|
+
const COMMONJS_FILES = ["**/*.{cjs,cts}"];
|
|
4
|
+
const CONFIG_FILES = ["**/*.config.{js,jsx,ts,tsx,mjs,cjs,mts,cts}"];
|
|
5
|
+
const TEST_FILES = [
|
|
6
|
+
"**/test/**",
|
|
7
|
+
"**/tests/**",
|
|
8
|
+
"**/__tests__/**",
|
|
9
|
+
"**/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts}"
|
|
10
|
+
];
|
|
11
|
+
const RUNTIME_OVERRIDE_EXCLUDE_FILES = [
|
|
12
|
+
...COMMONJS_FILES,
|
|
13
|
+
...CONFIG_FILES,
|
|
14
|
+
...TEST_FILES
|
|
15
|
+
];
|
|
16
|
+
const DEFAULT_IGNORE_PATTERNS = [
|
|
17
|
+
"node_modules/**",
|
|
18
|
+
"dist/**",
|
|
19
|
+
"dist-ssr/**",
|
|
20
|
+
"**/.wrangler/**",
|
|
21
|
+
"**/migrations/**",
|
|
22
|
+
"**/drizzle/migrations.js",
|
|
23
|
+
"**/drizzle/meta/*.json"
|
|
24
|
+
];
|
|
25
|
+
const CLOUDFLARE_WORKER_IGNORE_PATTERNS = ["**/worker-configuration.d.ts"];
|
|
26
|
+
const REACT_NATIVE_IGNORE_PATTERNS = ["**/.expo/**"];
|
|
27
|
+
const DEFAULT_STAGED_CHECK_GLOB = "*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}";
|
|
28
|
+
const DEFAULT_STAGED_CHECK_COMMAND = "vp check --fix";
|
|
29
|
+
const DEFAULT_WRANGLER_CONFIG_PATH = "./wrangler.jsonc";
|
|
30
|
+
//#endregion
|
|
31
|
+
export { DEFAULT_IGNORE_PATTERNS as a, DEFAULT_WRANGLER_CONFIG_PATH as c, TEST_FILES as d, CONFIG_FILES as i, REACT_NATIVE_IGNORE_PATTERNS as l, CODE_FILES as n, DEFAULT_STAGED_CHECK_COMMAND as o, COMMONJS_FILES as r, DEFAULT_STAGED_CHECK_GLOB as s, CLOUDFLARE_WORKER_IGNORE_PATTERNS as t, RUNTIME_OVERRIDE_EXCLUDE_FILES as u };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=constants-D2PDomKY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-D2PDomKY.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const CODE_FILES = [\"**/*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}\"] as const;\nexport const COMMONJS_FILES = [\"**/*.{cjs,cts}\"] as const;\nexport const CONFIG_FILES = [\"**/*.config.{js,jsx,ts,tsx,mjs,cjs,mts,cts}\"] as const;\nexport const TEST_FILES = [\n \"**/test/**\",\n \"**/tests/**\",\n \"**/__tests__/**\",\n \"**/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts}\",\n] as const;\nexport const RUNTIME_OVERRIDE_EXCLUDE_FILES: readonly string[] = [\n ...COMMONJS_FILES,\n ...CONFIG_FILES,\n ...TEST_FILES,\n] as const;\n\nexport const DEFAULT_IGNORE_PATTERNS = [\n \"node_modules/**\",\n \"dist/**\",\n \"dist-ssr/**\",\n \"**/.wrangler/**\",\n \"**/migrations/**\",\n \"**/drizzle/migrations.js\",\n \"**/drizzle/meta/*.json\",\n] as const;\nexport const CLOUDFLARE_WORKER_IGNORE_PATTERNS = [\"**/worker-configuration.d.ts\"] as const;\nexport const REACT_NATIVE_IGNORE_PATTERNS = [\"**/.expo/**\"] as const;\n\nexport const DEFAULT_STAGED_CHECK_GLOB = \"*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}\";\nexport const DEFAULT_STAGED_CHECK_COMMAND = \"vp check --fix\";\nexport const DEFAULT_WRANGLER_CONFIG_PATH = \"./wrangler.jsonc\";\n"],"mappings":";AAAA,MAAa,aAAa,CAAC,sCAAsC;AACjE,MAAa,iBAAiB,CAAC,gBAAgB;AAC/C,MAAa,eAAe,CAAC,6CAA6C;AAC1E,MAAa,aAAa;CACxB;CACA;CACA;CACA;AACF;AACA,MAAa,iCAAoD;CAC/D,GAAG;CACH,GAAG;CACH,GAAG;AACL;AAEA,MAAa,0BAA0B;CACrC;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAa,oCAAoC,CAAC,8BAA8B;AAChF,MAAa,+BAA+B,CAAC,aAAa;AAE1D,MAAa,4BAA4B;AACzC,MAAa,+BAA+B;AAC5C,MAAa,+BAA+B"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { UserConfig } from "vite-plus";
|
|
1
|
+
import { t as ConfigFragment } from "../../compose-Cichpffs.mjs";
|
|
3
2
|
import { cloudflareTest } from "@cloudflare/vitest-pool-workers";
|
|
4
3
|
//#region src/cloudflare-workers/index.d.ts
|
|
5
|
-
type
|
|
6
|
-
interface
|
|
7
|
-
readonly
|
|
8
|
-
readonly include?: readonly string[];
|
|
9
|
-
readonly test?: UserConfig["test"];
|
|
10
|
-
readonly wrangler?: CloudflareWorkersPluginOptions["wrangler"];
|
|
4
|
+
type CloudflareTestOptions = Exclude<NonNullable<Parameters<typeof cloudflareTest>[0]>, (...args: readonly never[]) => unknown>;
|
|
5
|
+
interface CloudflareTestConfigOptions extends Omit<CloudflareTestOptions, "wrangler"> {
|
|
6
|
+
readonly wrangler?: CloudflareTestOptions["wrangler"];
|
|
11
7
|
}
|
|
12
|
-
declare function
|
|
8
|
+
declare function createCloudflareTestConfig(options?: CloudflareTestConfigOptions): ConfigFragment;
|
|
13
9
|
//#endregion
|
|
14
|
-
export {
|
|
10
|
+
export { CloudflareTestConfigOptions, createCloudflareTestConfig };
|
|
15
11
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/cloudflare-workers/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/cloudflare-workers/index.ts"],"mappings":";;;KAOK,wBAAwB,QAC3B,YAAY,kBAAkB,yBAC1B;UAGW,oCAAoC,KAAK;WAC/C,WAAW;;iBAUN,2BACd,UAAS,8BACR"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createConfig as createNodeConfig } from "../node/index.mjs";
|
|
1
|
+
import { c as DEFAULT_WRANGLER_CONFIG_PATH } from "../../constants-D2PDomKY.mjs";
|
|
3
2
|
import { lazyPlugins } from "vite-plus";
|
|
4
3
|
import { cloudflareTest } from "@cloudflare/vitest-pool-workers";
|
|
5
4
|
//#region src/cloudflare-workers/index.ts
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
function createLazyPluginInputs(factory) {
|
|
6
|
+
return lazyPlugins(factory);
|
|
7
|
+
}
|
|
8
|
+
function createCloudflareTestConfig(options = {}) {
|
|
9
|
+
const { wrangler, ...pluginOptions } = options;
|
|
10
|
+
return { plugins: createLazyPluginInputs(() => [cloudflareTest({
|
|
11
|
+
...pluginOptions,
|
|
10
12
|
wrangler: {
|
|
11
13
|
configPath: DEFAULT_WRANGLER_CONFIG_PATH,
|
|
12
14
|
...wrangler
|
|
13
15
|
}
|
|
14
|
-
})]) }
|
|
16
|
+
})]) };
|
|
15
17
|
}
|
|
16
18
|
//#endregion
|
|
17
|
-
export {
|
|
19
|
+
export { createCloudflareTestConfig };
|
|
18
20
|
|
|
19
21
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/cloudflare-workers/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/cloudflare-workers/index.ts"],"sourcesContent":["import { cloudflareTest } from \"@cloudflare/vitest-pool-workers\";\nimport { lazyPlugins } from \"vite-plus\";\nimport type { ConfigFragment } from \"../compose.ts\";\nimport { DEFAULT_WRANGLER_CONFIG_PATH } from \"../constants.ts\";\n\ntype LazyPluginInput = object | readonly object[] | false | null | undefined;\n\ntype CloudflareTestOptions = Exclude<\n NonNullable<Parameters<typeof cloudflareTest>[0]>,\n (...args: readonly never[]) => unknown\n>;\n\nexport interface CloudflareTestConfigOptions extends Omit<CloudflareTestOptions, \"wrangler\"> {\n readonly wrangler?: CloudflareTestOptions[\"wrangler\"];\n}\n\nfunction createLazyPluginInputs(\n factory: () => readonly LazyPluginInput[],\n): ConfigFragment[\"plugins\"] {\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- Vite 8 plugin types recurse beyond TypeScript's comparison limit; lazyPlugins returns the named Vite plugins represented by this shallow boundary.\n return lazyPlugins(factory as never) as ConfigFragment[\"plugins\"];\n}\n\nexport function createCloudflareTestConfig(\n options: CloudflareTestConfigOptions = {},\n): ConfigFragment {\n const { wrangler, ...pluginOptions } = options;\n\n return {\n plugins: createLazyPluginInputs(() => [\n cloudflareTest({\n ...pluginOptions,\n wrangler: {\n configPath: DEFAULT_WRANGLER_CONFIG_PATH,\n ...wrangler,\n },\n }),\n ]),\n };\n}\n"],"mappings":";;;;AAgBA,SAAS,uBACP,SAC2B;CAE3B,OAAO,YAAY,OAAgB;AACrC;AAEA,SAAgB,2BACd,UAAuC,CAAC,GACxB;CAChB,MAAM,EAAE,UAAU,GAAG,kBAAkB;CAEvC,OAAO,EACL,SAAS,6BAA6B,CACpC,eAAe;EACb,GAAG;EACH,UAAU;GACR,YAAY;GACZ,GAAG;EACL;CACF,CAAC,CACH,CAAC,EACH;AACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { n as PluginInput, r as composeConfig, t as ConfigFragment } from "../compose-Cichpffs.mjs";
|
|
2
|
+
import { UserConfig } from "vite-plus";
|
|
3
|
+
//#region src/constants.d.ts
|
|
4
|
+
declare const CODE_FILES: readonly ["**/*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}"];
|
|
5
|
+
declare const COMMONJS_FILES: readonly ["**/*.{cjs,cts}"];
|
|
6
|
+
declare const CONFIG_FILES: readonly ["**/*.config.{js,jsx,ts,tsx,mjs,cjs,mts,cts}"];
|
|
7
|
+
declare const TEST_FILES: readonly ["**/test/**", "**/tests/**", "**/__tests__/**", "**/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts}"];
|
|
8
|
+
declare const RUNTIME_OVERRIDE_EXCLUDE_FILES: readonly string[];
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/fragments.d.ts
|
|
11
|
+
type PackConfig = Exclude<UserConfig["pack"], readonly unknown[] | undefined>;
|
|
12
|
+
declare const baseToolingConfig: ConfigFragment;
|
|
13
|
+
declare const nodeRuntimeConfig: ConfigFragment;
|
|
14
|
+
declare const browserRuntimeConfig: ConfigFragment;
|
|
15
|
+
declare const reactCoreConfig: ConfigFragment;
|
|
16
|
+
declare const reactDomConfig: ConfigFragment;
|
|
17
|
+
declare const reactNativeRuntimeConfig: ConfigFragment;
|
|
18
|
+
declare const reactNativeGeneratedConfig: ConfigFragment;
|
|
19
|
+
declare const cloudflareWorkerRuntimeConfig: ConfigFragment;
|
|
20
|
+
declare const cloudflareWorkerGeneratedConfig: ConfigFragment;
|
|
21
|
+
declare const nodeTestLintConfig: ConfigFragment;
|
|
22
|
+
declare const browserTestLintConfig: ConfigFragment;
|
|
23
|
+
declare const cloudflareWorkerTestLintConfig: ConfigFragment;
|
|
24
|
+
declare const libraryPackDefaults: PackConfig;
|
|
25
|
+
declare const libraryPackConfig: ConfigFragment;
|
|
26
|
+
declare const workspaceRunConfig: ConfigFragment;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/lint/types.d.ts
|
|
29
|
+
type LintConfig = NonNullable<UserConfig["lint"]>;
|
|
30
|
+
type LintOverride = NonNullable<LintConfig["overrides"]>[number];
|
|
31
|
+
type LintProfile = Omit<LintOverride, "excludeFiles" | "files">;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/lint/profiles.d.ts
|
|
34
|
+
declare const nodeLint: LintProfile;
|
|
35
|
+
declare const browserLint: LintProfile;
|
|
36
|
+
declare const reactCoreLint: LintProfile;
|
|
37
|
+
declare const reactDomLint: LintProfile;
|
|
38
|
+
declare const reactNativeRuntimeLint: LintProfile;
|
|
39
|
+
declare const reactWebLint: LintProfile;
|
|
40
|
+
declare const reactNativeLint: LintProfile;
|
|
41
|
+
declare const cloudflareWorkerLint: LintProfile;
|
|
42
|
+
declare const nodeTestLint: LintProfile;
|
|
43
|
+
declare const browserTestLint: LintProfile;
|
|
44
|
+
declare const cloudflareWorkerTestLint: LintProfile;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { CODE_FILES, COMMONJS_FILES, CONFIG_FILES, type ConfigFragment, type PluginInput, RUNTIME_OVERRIDE_EXCLUDE_FILES, TEST_FILES, baseToolingConfig, browserLint, browserRuntimeConfig, browserTestLint, browserTestLintConfig, cloudflareWorkerGeneratedConfig, cloudflareWorkerLint, cloudflareWorkerRuntimeConfig, cloudflareWorkerTestLint, cloudflareWorkerTestLintConfig, composeConfig, libraryPackConfig, libraryPackDefaults, nodeLint, nodeRuntimeConfig, nodeTestLint, nodeTestLintConfig, reactCoreConfig, reactCoreLint, reactDomConfig, reactDomLint, reactNativeGeneratedConfig, reactNativeLint, reactNativeRuntimeConfig, reactNativeRuntimeLint, reactWebLint, workspaceRunConfig };
|
|
47
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/constants.ts","../../src/fragments.ts","../../src/lint/types.ts","../../src/lint/profiles.ts"],"mappings":";;;cAAa;cACA;cACA;cACA;cAMA;;;KCeR,aAAa,QAAQ;cAEb,mBAAmB;cAQnB,mBAAmB;cAInB,sBAAsB;cAItB,iBAAiB;cAKjB,gBAAgB;cAIhB,0BAA0B;cAI1B,4BAA4B;cAK5B,+BAA+B;cAI/B,iCAAiC;cAKjC,oBAAoB;cAIpB,uBAAuB;cAIvB,gCAAgC;cAIhC,qBAAqB;cAOrB,mBAAmB;cAInB,oBAAoB;;;KC1FrB,aAAa,YAAY;KACzB,eAAe,YAAY;KAC3B,cAAc,KAAK;;;cCoElB,UAAU;cAOV,aAAa;cAOb,eAAe;cAKf,cAAc;cAiDd,wBAAwB;cAOxB,cAAc;cAWd,iBAAiB;cAUjB,sBAAsB;cAMtB,cAAc;cASd,iBAAiB;cASjB,0BAA0B"}
|