js-style-kit 0.0.6 → 0.1.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 +292 -12
- package/dist/{chunk-4RAXUOL2.js → chunk-ATE34YNW.js} +36 -54
- package/dist/chunk-ATE34YNW.js.map +1 -0
- package/dist/{chunk-ODYLQTYI.js → chunk-NBIRBRD5.js} +8 -5
- package/dist/chunk-NBIRBRD5.js.map +1 -0
- package/dist/{chunk-DYUKLT7Y.js → chunk-XLCCYRR6.js} +9 -4
- package/dist/chunk-XLCCYRR6.js.map +1 -0
- package/dist/eslint/index.d.ts +2 -1
- package/dist/eslint/index.js +3 -3
- package/dist/eslint/index.test.js +128 -4
- package/dist/eslint/index.test.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/prettier/index.js +1 -1
- package/dist/prettier/index.test.js +71 -5
- package/dist/prettier/index.test.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-4RAXUOL2.js.map +0 -1
- package/dist/chunk-DYUKLT7Y.js.map +0 -1
- package/dist/chunk-ODYLQTYI.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,33 +1,313 @@
|
|
|
1
1
|
# `js-style-kit`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A zero-configuration style guide for ESLint and Prettier that provides sensible default settings and flexible configuration options.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- ✅ All dependencies included (ESLint, Prettier, plugins) - no need to install extras
|
|
8
|
+
- ✅ TypeScript support out of the box
|
|
9
|
+
- ✅ Optional React and React Compiler support
|
|
10
|
+
- ✅ JSDoc validation with configurable requirements
|
|
11
|
+
- ✅ Automatic import, prop, and object sorting with Perfectionist
|
|
12
|
+
- ✅ Tailwind CSS support for Prettier
|
|
13
|
+
- ✅ Modern ESM-only package
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
## Requirements
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
- Node.js v20.11.0 or higher
|
|
18
|
+
- TypeScript (for TypeScript projects, not bundled)
|
|
12
19
|
|
|
13
|
-
|
|
20
|
+
## Installation
|
|
14
21
|
|
|
15
|
-
|
|
22
|
+
```bash
|
|
23
|
+
npm install js-style-kit --save-dev
|
|
24
|
+
# or
|
|
25
|
+
yarn add js-style-kit --dev
|
|
26
|
+
# or
|
|
27
|
+
pnpm add js-style-kit --save-dev
|
|
28
|
+
# or
|
|
29
|
+
bun add js-style-kit --dev
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## ESLint Configuration
|
|
33
|
+
|
|
34
|
+
### Basic Usage
|
|
35
|
+
|
|
36
|
+
Create an `eslint.config.js` file in your project root:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
import { eslintConfig } from "js-style-kit";
|
|
40
|
+
|
|
41
|
+
export default eslintConfig();
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
> **Note:** If you're not using `"type": "module"` in your package.json, name your file `eslint.config.mjs` instead.
|
|
45
|
+
|
|
46
|
+
Setup your `package.json` commands:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"scripts": {
|
|
51
|
+
"lint": "eslint . --max-warnings 0",
|
|
52
|
+
"lint:fix": "eslint . --fix --max-warnings 0"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
> **Note:** The `--max-warnings 0` option is important because all rules are set to warning by default.
|
|
58
|
+
|
|
59
|
+
### Configuration Options
|
|
60
|
+
|
|
61
|
+
The `eslintConfig()` function accepts a configuration object with the following options:
|
|
16
62
|
|
|
17
63
|
```js
|
|
18
64
|
import { eslintConfig } from "js-style-kit";
|
|
19
65
|
|
|
20
|
-
export default eslintConfig({
|
|
66
|
+
export default eslintConfig({
|
|
67
|
+
// All options shown with their default values
|
|
68
|
+
functionStyle: "arrow", // Controls function style: "arrow", "declaration", "expression", or "off"
|
|
69
|
+
ignores: [], // Additional paths to ignore (node_modules and dist already excluded)
|
|
70
|
+
jsdoc: { requireJsdoc: false }, // JSDoc configuration or false to disable
|
|
71
|
+
react: false, // Whether to include React rules
|
|
72
|
+
reactCompiler: undefined, // When react is true, controls React compiler rules
|
|
73
|
+
sorting: true, // Whether to include sorting rules from Perfectionist
|
|
74
|
+
typescript: true, // Boolean or string path to tsconfig.json
|
|
75
|
+
});
|
|
21
76
|
```
|
|
22
77
|
|
|
23
|
-
|
|
78
|
+
#### Function Style Configuration
|
|
24
79
|
|
|
25
|
-
|
|
80
|
+
Controls how functions should be written:
|
|
26
81
|
|
|
27
|
-
|
|
82
|
+
```js
|
|
83
|
+
// Enforce arrow functions (default)
|
|
84
|
+
functionStyle: "arrow";
|
|
85
|
+
|
|
86
|
+
// Enforce function declarations
|
|
87
|
+
functionStyle: "declaration";
|
|
88
|
+
|
|
89
|
+
// Enforce function expressions
|
|
90
|
+
functionStyle: "expression";
|
|
91
|
+
|
|
92
|
+
// Disable function style enforcement
|
|
93
|
+
functionStyle: "off";
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### TypeScript Configuration
|
|
97
|
+
|
|
98
|
+
TypeScript support is enabled by default. You can:
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
// Enable with automatic project detection
|
|
102
|
+
typescript: true;
|
|
103
|
+
|
|
104
|
+
// Disable TypeScript rules
|
|
105
|
+
typescript: false;
|
|
106
|
+
|
|
107
|
+
// Specify path to your tsconfig.json
|
|
108
|
+
typescript: "./tsconfig.json";
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### React Configuration
|
|
112
|
+
|
|
113
|
+
React support is disabled by default:
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
// Enable React support
|
|
117
|
+
react: true
|
|
118
|
+
|
|
119
|
+
// With React enabled, React Compiler is automatically included
|
|
120
|
+
// Disable React Compiler explicitly:
|
|
121
|
+
react: true,
|
|
122
|
+
reactCompiler: false
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### JSDoc Configuration
|
|
126
|
+
|
|
127
|
+
JSDoc validation is enabled by default, but requirement rules are off:
|
|
128
|
+
|
|
129
|
+
```js
|
|
130
|
+
// Disable JSDoc validation completely
|
|
131
|
+
jsdoc: false;
|
|
132
|
+
|
|
133
|
+
// Enable JSDoc with requirement rules, ideal for libraries
|
|
134
|
+
jsdoc: {
|
|
135
|
+
requireJsdoc: true;
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### Perfectionist (Code Organization)
|
|
140
|
+
|
|
141
|
+
Sorting/organization rules from the Perfectionist plugin are enabled by default:
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
// Disable sorting rules
|
|
145
|
+
sorting: false;
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Adding Custom ESLint Configurations
|
|
149
|
+
|
|
150
|
+
You can extend the base configuration by providing additional ESLint config objects as rest parameters:
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
import { eslintConfig } from "js-style-kit";
|
|
154
|
+
|
|
155
|
+
export default eslintConfig(
|
|
156
|
+
{
|
|
157
|
+
// Base configuration options
|
|
158
|
+
typescript: "./tsconfig.json",
|
|
159
|
+
react: true,
|
|
160
|
+
},
|
|
161
|
+
// Additional custom ESLint configuration objects
|
|
162
|
+
{
|
|
163
|
+
name: "custom-globals",
|
|
164
|
+
languageOptions: {
|
|
165
|
+
globals: {
|
|
166
|
+
process: "readonly",
|
|
167
|
+
__dirname: "readonly",
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "custom-rules",
|
|
173
|
+
rules: {
|
|
174
|
+
// Override or add specific rules
|
|
175
|
+
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
176
|
+
"max-len": ["warn", { code: 100 }],
|
|
177
|
+
quotes: ["error", "single"],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
// Add as many additional configs as needed
|
|
181
|
+
);
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Prettier Configuration
|
|
185
|
+
|
|
186
|
+
### Basic Usage
|
|
187
|
+
|
|
188
|
+
Create a `prettier.config.js` file in your project root:
|
|
189
|
+
|
|
190
|
+
```js
|
|
191
|
+
import { prettierConfig } from "js-style-kit";
|
|
192
|
+
|
|
193
|
+
export default prettierConfig();
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
> **Note:** If you're not using `"type": "module"` in your package.json, name your file `prettier.config.mjs` instead.
|
|
197
|
+
|
|
198
|
+
### Configuration Options
|
|
199
|
+
|
|
200
|
+
The `prettierConfig()` function accepts a configuration object with the following options:
|
|
201
|
+
|
|
202
|
+
```js
|
|
203
|
+
import { prettierConfig } from "js-style-kit";
|
|
204
|
+
|
|
205
|
+
export default prettierConfig({
|
|
206
|
+
// All options shown with their default values
|
|
207
|
+
jsonSortPlugin: true, // Enable JSON sorting plugin
|
|
208
|
+
packageJsonPlugin: true, // Enable package.json sorting plugin
|
|
209
|
+
tailwindPlugin: false, // Enable Tailwind CSS plugin (boolean, string[], or options object)
|
|
210
|
+
|
|
211
|
+
// You can also pass any standard Prettier options
|
|
212
|
+
printWidth: 80,
|
|
213
|
+
tabWidth: 2,
|
|
214
|
+
// etc.
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
#### Tailwind CSS Support
|
|
219
|
+
|
|
220
|
+
Tailwind CSS formatting is disabled by default. You can enable it in different ways:
|
|
221
|
+
|
|
222
|
+
```js
|
|
223
|
+
// Enable Tailwind with default utility functions (clsx, cva, cn)
|
|
224
|
+
tailwindPlugin: true
|
|
225
|
+
|
|
226
|
+
// Enable Tailwind with custom utility functions
|
|
227
|
+
tailwindPlugin: ["clsx", "cva", "cn", "myCustomFunction"]
|
|
228
|
+
|
|
229
|
+
// Enable Tailwind with custom options
|
|
230
|
+
tailwindPlugin: {
|
|
231
|
+
tailwindFunctions: ["clsx", "cva", "myCustomFunction"],
|
|
232
|
+
tailwindAttributes: ["tw"]
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### JSON Sorting
|
|
237
|
+
|
|
238
|
+
The JSON sorting plugin is enabled by default. You can disable it or configure it:
|
|
239
|
+
|
|
240
|
+
```js
|
|
241
|
+
// Disable JSON sorting
|
|
242
|
+
jsonSortPlugin: false;
|
|
243
|
+
|
|
244
|
+
// Configure JSON sorting
|
|
245
|
+
jsonSortPlugin: {
|
|
246
|
+
jsonRecursiveSort: true;
|
|
247
|
+
// other plugin options...
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### Standard Prettier Options
|
|
252
|
+
|
|
253
|
+
You can pass any standard Prettier options directly:
|
|
28
254
|
|
|
29
255
|
```js
|
|
30
256
|
import { prettierConfig } from "js-style-kit";
|
|
31
257
|
|
|
32
|
-
export default prettierConfig({
|
|
258
|
+
export default prettierConfig({
|
|
259
|
+
// Enable Tailwind
|
|
260
|
+
tailwindPlugin: true,
|
|
261
|
+
|
|
262
|
+
// Standard Prettier options
|
|
263
|
+
printWidth: 100,
|
|
264
|
+
tabWidth: 2,
|
|
265
|
+
useTabs: false,
|
|
266
|
+
semi: true,
|
|
267
|
+
singleQuote: false,
|
|
268
|
+
trailingComma: "all",
|
|
269
|
+
bracketSpacing: true,
|
|
270
|
+
endOfLine: "lf",
|
|
271
|
+
});
|
|
33
272
|
```
|
|
273
|
+
|
|
274
|
+
## Complete Example
|
|
275
|
+
|
|
276
|
+
Here's a complete example with both ESLint and Prettier configurations:
|
|
277
|
+
|
|
278
|
+
### eslint.config.js
|
|
279
|
+
|
|
280
|
+
```js
|
|
281
|
+
import { eslintConfig } from "js-style-kit";
|
|
282
|
+
|
|
283
|
+
export default eslintConfig(
|
|
284
|
+
{
|
|
285
|
+
typescript: "./tsconfig.json",
|
|
286
|
+
react: true,
|
|
287
|
+
jsdoc: { requireJsdoc: true },
|
|
288
|
+
functionStyle: "arrow",
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
name: "project-specific-rules",
|
|
292
|
+
rules: {
|
|
293
|
+
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
);
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### prettier.config.js
|
|
300
|
+
|
|
301
|
+
```js
|
|
302
|
+
import { prettierConfig } from "js-style-kit";
|
|
303
|
+
|
|
304
|
+
export default prettierConfig({
|
|
305
|
+
tailwindPlugin: true,
|
|
306
|
+
printWidth: 100,
|
|
307
|
+
singleQuote: true,
|
|
308
|
+
});
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## License
|
|
312
|
+
|
|
313
|
+
MIT
|
|
@@ -216,7 +216,7 @@ import { isatty as s } from "tty";
|
|
|
216
216
|
var r = process.env.FORCE_TTY !== void 0 || s(1);
|
|
217
217
|
var u = p(r);
|
|
218
218
|
|
|
219
|
-
// ../../node_modules/.pnpm/@vitest+pretty-format@3.0.
|
|
219
|
+
// ../../node_modules/.pnpm/@vitest+pretty-format@3.0.7/node_modules/@vitest/pretty-format/dist/index.js
|
|
220
220
|
function _mergeNamespaces(n, m3) {
|
|
221
221
|
m3.forEach(function(e) {
|
|
222
222
|
e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k2) {
|
|
@@ -2241,7 +2241,7 @@ function inspect(value, opts = {}) {
|
|
|
2241
2241
|
return options.stylize(String(value), type3);
|
|
2242
2242
|
}
|
|
2243
2243
|
|
|
2244
|
-
// ../../node_modules/.pnpm/@vitest+utils@3.0.
|
|
2244
|
+
// ../../node_modules/.pnpm/@vitest+utils@3.0.7/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js
|
|
2245
2245
|
var {
|
|
2246
2246
|
AsymmetricMatcher,
|
|
2247
2247
|
DOMCollection,
|
|
@@ -2396,7 +2396,7 @@ function getDefaultExportFromCjs2(x2) {
|
|
|
2396
2396
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
2397
2397
|
}
|
|
2398
2398
|
|
|
2399
|
-
// ../../node_modules/.pnpm/@vitest+utils@3.0.
|
|
2399
|
+
// ../../node_modules/.pnpm/@vitest+utils@3.0.7/node_modules/@vitest/utils/dist/helpers.js
|
|
2400
2400
|
function createSimpleStackTrace(options) {
|
|
2401
2401
|
const { message = "$$stack trace error", stackTraceLimit = 1 } = options || {};
|
|
2402
2402
|
const limit = Error.stackTraceLimit;
|
|
@@ -2535,7 +2535,7 @@ function isNegativeNaN(val) {
|
|
|
2535
2535
|
return isNegative;
|
|
2536
2536
|
}
|
|
2537
2537
|
|
|
2538
|
-
// ../../node_modules/.pnpm/@vitest+utils@3.0.
|
|
2538
|
+
// ../../node_modules/.pnpm/@vitest+utils@3.0.7/node_modules/@vitest/utils/dist/index.js
|
|
2539
2539
|
var jsTokens_1;
|
|
2540
2540
|
var hasRequiredJsTokens;
|
|
2541
2541
|
function requireJsTokens() {
|
|
@@ -3006,7 +3006,7 @@ function getSafeTimers() {
|
|
|
3006
3006
|
};
|
|
3007
3007
|
}
|
|
3008
3008
|
|
|
3009
|
-
// ../../node_modules/.pnpm/@vitest+utils@3.0.
|
|
3009
|
+
// ../../node_modules/.pnpm/@vitest+utils@3.0.7/node_modules/@vitest/utils/dist/source-map.js
|
|
3010
3010
|
var comma = ",".charCodeAt(0);
|
|
3011
3011
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3012
3012
|
var intToChar = new Uint8Array(64);
|
|
@@ -3220,7 +3220,7 @@ function parseSingleV8Stack(raw) {
|
|
|
3220
3220
|
};
|
|
3221
3221
|
}
|
|
3222
3222
|
|
|
3223
|
-
// ../../node_modules/.pnpm/@vitest+utils@3.0.
|
|
3223
|
+
// ../../node_modules/.pnpm/@vitest+utils@3.0.7/node_modules/@vitest/utils/dist/diff.js
|
|
3224
3224
|
var DIFF_DELETE = -1;
|
|
3225
3225
|
var DIFF_INSERT = 1;
|
|
3226
3226
|
var DIFF_EQUAL = 0;
|
|
@@ -4954,7 +4954,7 @@ function getCommonAndChangedSubstrings(diffs, op, hasCommonDiff2) {
|
|
|
4954
4954
|
);
|
|
4955
4955
|
}
|
|
4956
4956
|
|
|
4957
|
-
// ../../node_modules/.pnpm/@vitest+utils@3.0.
|
|
4957
|
+
// ../../node_modules/.pnpm/@vitest+utils@3.0.7/node_modules/@vitest/utils/dist/error.js
|
|
4958
4958
|
var IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
|
|
4959
4959
|
var IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
4960
4960
|
function isImmutable(v) {
|
|
@@ -5181,7 +5181,7 @@ var isAbsolute2 = function(p3) {
|
|
|
5181
5181
|
return _IS_ABSOLUTE_RE2.test(p3);
|
|
5182
5182
|
};
|
|
5183
5183
|
|
|
5184
|
-
// ../../node_modules/.pnpm/@vitest+runner@3.0.
|
|
5184
|
+
// ../../node_modules/.pnpm/@vitest+runner@3.0.7/node_modules/@vitest/runner/dist/chunk-tasks.js
|
|
5185
5185
|
function createChainable(keys2, fn2) {
|
|
5186
5186
|
function create(context) {
|
|
5187
5187
|
const chain2 = function(...args) {
|
|
@@ -5226,7 +5226,7 @@ function getTestName(task, separator = " > ") {
|
|
|
5226
5226
|
return getNames(task).slice(1).join(separator);
|
|
5227
5227
|
}
|
|
5228
5228
|
|
|
5229
|
-
// ../../node_modules/.pnpm/@vitest+runner@3.0.
|
|
5229
|
+
// ../../node_modules/.pnpm/@vitest+runner@3.0.7/node_modules/@vitest/runner/dist/index.js
|
|
5230
5230
|
var PendingError = class extends Error {
|
|
5231
5231
|
constructor(message, task, note) {
|
|
5232
5232
|
super(message);
|
|
@@ -6124,31 +6124,17 @@ function C2(e, t, n) {
|
|
|
6124
6124
|
), x.add(i), i;
|
|
6125
6125
|
}
|
|
6126
6126
|
|
|
6127
|
-
// ../../node_modules/.pnpm/@vitest+spy@3.0.
|
|
6128
|
-
var vitestSpy = Symbol.for("vitest.spy");
|
|
6127
|
+
// ../../node_modules/.pnpm/@vitest+spy@3.0.7/node_modules/@vitest/spy/dist/index.js
|
|
6129
6128
|
var mocks = /* @__PURE__ */ new Set();
|
|
6130
6129
|
function isMockFunction(fn2) {
|
|
6131
6130
|
return typeof fn2 === "function" && "_isMockFunction" in fn2 && fn2._isMockFunction;
|
|
6132
6131
|
}
|
|
6133
|
-
function getSpy(obj, method, accessType) {
|
|
6134
|
-
const desc = Object.getOwnPropertyDescriptor(obj, method);
|
|
6135
|
-
if (desc) {
|
|
6136
|
-
const fn2 = desc[accessType ?? "value"];
|
|
6137
|
-
if (typeof fn2 === "function" && vitestSpy in fn2) {
|
|
6138
|
-
return fn2;
|
|
6139
|
-
}
|
|
6140
|
-
}
|
|
6141
|
-
}
|
|
6142
6132
|
function spyOn(obj, method, accessType) {
|
|
6143
6133
|
const dictionary = {
|
|
6144
6134
|
get: "getter",
|
|
6145
6135
|
set: "setter"
|
|
6146
6136
|
};
|
|
6147
6137
|
const objMethod = accessType ? { [dictionary[accessType]]: method } : method;
|
|
6148
|
-
const currentStub = getSpy(obj, method, accessType);
|
|
6149
|
-
if (currentStub) {
|
|
6150
|
-
return currentStub;
|
|
6151
|
-
}
|
|
6152
6138
|
const stub = C2(obj, objMethod);
|
|
6153
6139
|
return enhanceSpy(stub);
|
|
6154
6140
|
}
|
|
@@ -6200,10 +6186,6 @@ function enhanceSpy(spy) {
|
|
|
6200
6186
|
return impl.apply(this, args);
|
|
6201
6187
|
}
|
|
6202
6188
|
let name = stub.name;
|
|
6203
|
-
Object.defineProperty(stub, vitestSpy, {
|
|
6204
|
-
value: true,
|
|
6205
|
-
enumerable: false
|
|
6206
|
-
});
|
|
6207
6189
|
stub.getMockName = () => name || "vi.fn()";
|
|
6208
6190
|
stub.mockName = (n) => {
|
|
6209
6191
|
name = n;
|
|
@@ -10272,7 +10254,7 @@ function use(fn2) {
|
|
|
10272
10254
|
}
|
|
10273
10255
|
__name(use, "use");
|
|
10274
10256
|
|
|
10275
|
-
// ../../node_modules/.pnpm/@vitest+expect@3.0.
|
|
10257
|
+
// ../../node_modules/.pnpm/@vitest+expect@3.0.7/node_modules/@vitest/expect/dist/index.js
|
|
10276
10258
|
var MATCHERS_OBJECT = Symbol.for("matchers-object");
|
|
10277
10259
|
var JEST_MATCHERS_OBJECT = Symbol.for("$$jest-matchers-object");
|
|
10278
10260
|
var GLOBAL_EXPECT = Symbol.for("expect-global");
|
|
@@ -11678,12 +11660,12 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
11678
11660
|
);
|
|
11679
11661
|
}
|
|
11680
11662
|
}
|
|
11681
|
-
function
|
|
11663
|
+
function getSpy(assertion) {
|
|
11682
11664
|
assertIsMock(assertion);
|
|
11683
11665
|
return assertion._obj;
|
|
11684
11666
|
}
|
|
11685
11667
|
def(["toHaveBeenCalledTimes", "toBeCalledTimes"], function(number) {
|
|
11686
|
-
const spy =
|
|
11668
|
+
const spy = getSpy(this);
|
|
11687
11669
|
const spyName = spy.getMockName();
|
|
11688
11670
|
const callCount = spy.mock.calls.length;
|
|
11689
11671
|
return this.assert(
|
|
@@ -11696,7 +11678,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
11696
11678
|
);
|
|
11697
11679
|
});
|
|
11698
11680
|
def("toHaveBeenCalledOnce", function() {
|
|
11699
|
-
const spy =
|
|
11681
|
+
const spy = getSpy(this);
|
|
11700
11682
|
const spyName = spy.getMockName();
|
|
11701
11683
|
const callCount = spy.mock.calls.length;
|
|
11702
11684
|
return this.assert(
|
|
@@ -11709,7 +11691,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
11709
11691
|
);
|
|
11710
11692
|
});
|
|
11711
11693
|
def(["toHaveBeenCalled", "toBeCalled"], function() {
|
|
11712
|
-
const spy =
|
|
11694
|
+
const spy = getSpy(this);
|
|
11713
11695
|
const spyName = spy.getMockName();
|
|
11714
11696
|
const callCount = spy.mock.calls.length;
|
|
11715
11697
|
const called = callCount > 0;
|
|
@@ -11729,7 +11711,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
11729
11711
|
}
|
|
11730
11712
|
});
|
|
11731
11713
|
def(["toHaveBeenCalledWith", "toBeCalledWith"], function(...args) {
|
|
11732
|
-
const spy =
|
|
11714
|
+
const spy = getSpy(this);
|
|
11733
11715
|
const spyName = spy.getMockName();
|
|
11734
11716
|
const pass = spy.mock.calls.some(
|
|
11735
11717
|
(callArg) => equals(callArg, args, [...customTesters, iterableEquality])
|
|
@@ -11746,7 +11728,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
11746
11728
|
}
|
|
11747
11729
|
});
|
|
11748
11730
|
def("toHaveBeenCalledExactlyOnceWith", function(...args) {
|
|
11749
|
-
const spy =
|
|
11731
|
+
const spy = getSpy(this);
|
|
11750
11732
|
const spyName = spy.getMockName();
|
|
11751
11733
|
const callCount = spy.mock.calls.length;
|
|
11752
11734
|
const hasCallWithArgs = spy.mock.calls.some(
|
|
@@ -11767,7 +11749,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
11767
11749
|
def(
|
|
11768
11750
|
["toHaveBeenNthCalledWith", "nthCalledWith"],
|
|
11769
11751
|
function(times, ...args) {
|
|
11770
|
-
const spy =
|
|
11752
|
+
const spy = getSpy(this);
|
|
11771
11753
|
const spyName = spy.getMockName();
|
|
11772
11754
|
const nthCall = spy.mock.calls[times - 1];
|
|
11773
11755
|
const callCount = spy.mock.calls.length;
|
|
@@ -11789,7 +11771,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
11789
11771
|
def(
|
|
11790
11772
|
["toHaveBeenLastCalledWith", "lastCalledWith"],
|
|
11791
11773
|
function(...args) {
|
|
11792
|
-
const spy =
|
|
11774
|
+
const spy = getSpy(this);
|
|
11793
11775
|
const spyName = spy.getMockName();
|
|
11794
11776
|
const lastCall = spy.mock.calls[spy.mock.calls.length - 1];
|
|
11795
11777
|
this.assert(
|
|
@@ -11815,7 +11797,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
11815
11797
|
def(
|
|
11816
11798
|
["toHaveBeenCalledBefore"],
|
|
11817
11799
|
function(resultSpy, failIfNoFirstInvocation = true) {
|
|
11818
|
-
const expectSpy =
|
|
11800
|
+
const expectSpy = getSpy(this);
|
|
11819
11801
|
if (!isMockFunction(resultSpy)) {
|
|
11820
11802
|
throw new TypeError(
|
|
11821
11803
|
`${utils.inspect(resultSpy)} is not a spy or a call to a spy`
|
|
@@ -11837,7 +11819,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
11837
11819
|
def(
|
|
11838
11820
|
["toHaveBeenCalledAfter"],
|
|
11839
11821
|
function(resultSpy, failIfNoFirstInvocation = true) {
|
|
11840
|
-
const expectSpy =
|
|
11822
|
+
const expectSpy = getSpy(this);
|
|
11841
11823
|
if (!isMockFunction(resultSpy)) {
|
|
11842
11824
|
throw new TypeError(
|
|
11843
11825
|
`${utils.inspect(resultSpy)} is not a spy or a call to a spy`
|
|
@@ -11945,7 +11927,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
11945
11927
|
}
|
|
11946
11928
|
].forEach(({ name, condition, action }) => {
|
|
11947
11929
|
def(name, function() {
|
|
11948
|
-
const spy =
|
|
11930
|
+
const spy = getSpy(this);
|
|
11949
11931
|
const spyName = spy.getMockName();
|
|
11950
11932
|
const pass = condition(spy);
|
|
11951
11933
|
this.assert(
|
|
@@ -11977,7 +11959,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
11977
11959
|
}
|
|
11978
11960
|
].forEach(({ name, condition, action }) => {
|
|
11979
11961
|
def(name, function(times) {
|
|
11980
|
-
const spy =
|
|
11962
|
+
const spy = getSpy(this);
|
|
11981
11963
|
const spyName = spy.getMockName();
|
|
11982
11964
|
const pass = condition(spy, times);
|
|
11983
11965
|
this.assert(
|
|
@@ -12007,7 +11989,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
12007
11989
|
}
|
|
12008
11990
|
].forEach(({ name, condition, action }) => {
|
|
12009
11991
|
def(name, function(value) {
|
|
12010
|
-
const spy =
|
|
11992
|
+
const spy = getSpy(this);
|
|
12011
11993
|
const pass = condition(spy, value);
|
|
12012
11994
|
const isNot = utils.flag(this, "negate");
|
|
12013
11995
|
if (pass && isNot || !pass && !isNot) {
|
|
@@ -12042,7 +12024,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
12042
12024
|
}
|
|
12043
12025
|
].forEach(({ name, condition, action }) => {
|
|
12044
12026
|
def(name, function(value) {
|
|
12045
|
-
const spy =
|
|
12027
|
+
const spy = getSpy(this);
|
|
12046
12028
|
const results = action === "return" ? spy.mock.results : spy.mock.settledResults;
|
|
12047
12029
|
const result = results[results.length - 1];
|
|
12048
12030
|
const spyName = spy.getMockName();
|
|
@@ -12074,7 +12056,7 @@ var JestChaiExpect = (chai2, utils) => {
|
|
|
12074
12056
|
}
|
|
12075
12057
|
].forEach(({ name, condition, action }) => {
|
|
12076
12058
|
def(name, function(nthCall, value) {
|
|
12077
|
-
const spy =
|
|
12059
|
+
const spy = getSpy(this);
|
|
12078
12060
|
const spyName = spy.getMockName();
|
|
12079
12061
|
const results = action === "return" ? spy.mock.results : spy.mock.settledResults;
|
|
12080
12062
|
const result = results[nthCall - 1];
|
|
@@ -12420,7 +12402,7 @@ var JestExtend = (chai2, utils) => {
|
|
|
12420
12402
|
);
|
|
12421
12403
|
};
|
|
12422
12404
|
|
|
12423
|
-
// ../../node_modules/.pnpm/vitest@3.0.
|
|
12405
|
+
// ../../node_modules/.pnpm/vitest@3.0.7_@types+debug@4.1.12_@types+node@22.13.5_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.js
|
|
12424
12406
|
var NAME_WORKER_STATE = "__vitest_worker__";
|
|
12425
12407
|
function getWorkerState() {
|
|
12426
12408
|
const workerState = globalThis[NAME_WORKER_STATE];
|
|
@@ -12480,13 +12462,13 @@ async function waitForImportsToResolve() {
|
|
|
12480
12462
|
await waitForImportsToResolve();
|
|
12481
12463
|
}
|
|
12482
12464
|
|
|
12483
|
-
// ../../node_modules/.pnpm/vitest@3.0.
|
|
12465
|
+
// ../../node_modules/.pnpm/vitest@3.0.7_@types+debug@4.1.12_@types+node@22.13.5_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js
|
|
12484
12466
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
12485
12467
|
function getDefaultExportFromCjs3(x2) {
|
|
12486
12468
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
12487
12469
|
}
|
|
12488
12470
|
|
|
12489
|
-
// ../../node_modules/.pnpm/@vitest+snapshot@3.0.
|
|
12471
|
+
// ../../node_modules/.pnpm/@vitest+snapshot@3.0.7/node_modules/@vitest/snapshot/dist/index.js
|
|
12490
12472
|
var comma2 = ",".charCodeAt(0);
|
|
12491
12473
|
var chars2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
12492
12474
|
var intToChar2 = new Uint8Array(64);
|
|
@@ -14598,7 +14580,7 @@ var SnapshotClient = class {
|
|
|
14598
14580
|
}
|
|
14599
14581
|
};
|
|
14600
14582
|
|
|
14601
|
-
// ../../node_modules/.pnpm/vitest@3.0.
|
|
14583
|
+
// ../../node_modules/.pnpm/vitest@3.0.7_@types+debug@4.1.12_@types+node@22.13.5_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.js
|
|
14602
14584
|
var RealDate = Date;
|
|
14603
14585
|
var now2 = null;
|
|
14604
14586
|
var MockDate = class _MockDate extends RealDate {
|
|
@@ -14651,7 +14633,7 @@ function resetDate() {
|
|
|
14651
14633
|
globalThis.Date = RealDate;
|
|
14652
14634
|
}
|
|
14653
14635
|
|
|
14654
|
-
// ../../node_modules/.pnpm/vitest@3.0.
|
|
14636
|
+
// ../../node_modules/.pnpm/vitest@3.0.7_@types+debug@4.1.12_@types+node@22.13.5_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/chunks/vi.DT3m61kS.js
|
|
14655
14637
|
var unsupported = [
|
|
14656
14638
|
// .poll is meant to retry matchers until they succeed, and
|
|
14657
14639
|
// snapshots will always succeed as long as the poll method doesn't throw an error
|
|
@@ -17511,15 +17493,15 @@ function createVitest() {
|
|
|
17511
17493
|
return isMockFunction(fn2);
|
|
17512
17494
|
},
|
|
17513
17495
|
clearAllMocks() {
|
|
17514
|
-
mocks.forEach((spy) => spy.mockClear());
|
|
17496
|
+
[...mocks].reverse().forEach((spy) => spy.mockClear());
|
|
17515
17497
|
return utils;
|
|
17516
17498
|
},
|
|
17517
17499
|
resetAllMocks() {
|
|
17518
|
-
mocks.forEach((spy) => spy.mockReset());
|
|
17500
|
+
[...mocks].reverse().forEach((spy) => spy.mockReset());
|
|
17519
17501
|
return utils;
|
|
17520
17502
|
},
|
|
17521
17503
|
restoreAllMocks() {
|
|
17522
|
-
mocks.forEach((spy) => spy.mockRestore());
|
|
17504
|
+
[...mocks].reverse().forEach((spy) => spy.mockRestore());
|
|
17523
17505
|
return utils;
|
|
17524
17506
|
},
|
|
17525
17507
|
stubGlobal(name, value) {
|
|
@@ -17617,7 +17599,7 @@ function getImporter(name) {
|
|
|
17617
17599
|
return stack?.file || "";
|
|
17618
17600
|
}
|
|
17619
17601
|
|
|
17620
|
-
// ../../node_modules/.pnpm/vitest@3.0.
|
|
17602
|
+
// ../../node_modules/.pnpm/vitest@3.0.7_@types+debug@4.1.12_@types+node@22.13.5_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/index.js
|
|
17621
17603
|
var import_expect_type = __toESM(require_dist(), 1);
|
|
17622
17604
|
|
|
17623
17605
|
export {
|
|
@@ -17916,4 +17898,4 @@ chai/chai.js:
|
|
|
17916
17898
|
* @license MIT License
|
|
17917
17899
|
*)
|
|
17918
17900
|
*/
|
|
17919
|
-
//# sourceMappingURL=chunk-
|
|
17901
|
+
//# sourceMappingURL=chunk-ATE34YNW.js.map
|