@eslint-react/jsx 1.5.3 → 1.5.4-next.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/dist/index.js +1366 -1228
- package/dist/index.mjs +1363 -1229
- package/package.json +7 -7
- package/dist/index.cjs +0 -1656
package/dist/index.js
CHANGED
|
@@ -5,71 +5,50 @@ var shared = require('@eslint-react/shared');
|
|
|
5
5
|
var memo = require('micro-memoize');
|
|
6
6
|
var _var = require('@eslint-react/var');
|
|
7
7
|
var types = require('@typescript-eslint/types');
|
|
8
|
+
require('@typescript-eslint/utils');
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* // Exampe using arity to determine data-first or data-last style
|
|
46
|
-
* const sum: {
|
|
47
|
-
* (that: number): (self: number) => number
|
|
48
|
-
* (self: number, that: number): number
|
|
49
|
-
* } = dual(2, (self: number, that: number): number => self + that)
|
|
50
|
-
*
|
|
51
|
-
* assert.deepStrictEqual(sum(2, 3), 5)
|
|
52
|
-
* assert.deepStrictEqual(pipe(2, sum(3)), 5)
|
|
53
|
-
*
|
|
54
|
-
* // Example using a predicate to determine data-first or data-last style
|
|
55
|
-
* const sum2: {
|
|
56
|
-
* (that: number): (self: number) => number
|
|
57
|
-
* (self: number, that: number): number
|
|
58
|
-
* } = dual((args) => args.length === 1, (self: number, that: number): number => self + that)
|
|
59
|
-
*
|
|
60
|
-
* assert.deepStrictEqual(sum(2, 3), 5)
|
|
61
|
-
* assert.deepStrictEqual(pipe(2, sum(3)), 5)
|
|
62
|
-
*
|
|
63
|
-
* @since 2.0.0
|
|
64
|
-
*/
|
|
65
|
-
const dual = function (arity, body) {
|
|
10
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
var memo__default = /*#__PURE__*/_interopDefault(memo);
|
|
13
|
+
|
|
14
|
+
var __defProp = Object.defineProperty;
|
|
15
|
+
var __export = (target, all3) => {
|
|
16
|
+
for (var name in all3)
|
|
17
|
+
__defProp(target, name, { get: all3[name], enumerable: true });
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Function.js
|
|
21
|
+
var Function_exports = {};
|
|
22
|
+
__export(Function_exports, {
|
|
23
|
+
SK: () => SK,
|
|
24
|
+
absurd: () => absurd,
|
|
25
|
+
apply: () => apply,
|
|
26
|
+
compose: () => compose,
|
|
27
|
+
constFalse: () => constFalse,
|
|
28
|
+
constNull: () => constNull,
|
|
29
|
+
constTrue: () => constTrue,
|
|
30
|
+
constUndefined: () => constUndefined,
|
|
31
|
+
constVoid: () => constVoid,
|
|
32
|
+
constant: () => constant,
|
|
33
|
+
dual: () => dual,
|
|
34
|
+
flip: () => flip,
|
|
35
|
+
flow: () => flow,
|
|
36
|
+
hole: () => hole,
|
|
37
|
+
identity: () => identity,
|
|
38
|
+
isFunction: () => isFunction,
|
|
39
|
+
pipe: () => pipe,
|
|
40
|
+
tupled: () => tupled,
|
|
41
|
+
unsafeCoerce: () => unsafeCoerce,
|
|
42
|
+
untupled: () => untupled
|
|
43
|
+
});
|
|
44
|
+
var isFunction = (input) => typeof input === "function";
|
|
45
|
+
var dual = function(arity, body) {
|
|
66
46
|
if (typeof arity === "function") {
|
|
67
|
-
return function
|
|
47
|
+
return function() {
|
|
68
48
|
if (arity(arguments)) {
|
|
69
|
-
// @ts-expect-error
|
|
70
49
|
return body.apply(this, arguments);
|
|
71
50
|
}
|
|
72
|
-
return self => body(self, ...arguments);
|
|
51
|
+
return (self) => body(self, ...arguments);
|
|
73
52
|
};
|
|
74
53
|
}
|
|
75
54
|
switch (arity) {
|
|
@@ -77,251 +56,388 @@ const dual = function (arity, body) {
|
|
|
77
56
|
case 1:
|
|
78
57
|
throw new RangeError(`Invalid arity ${arity}`);
|
|
79
58
|
case 2:
|
|
80
|
-
return function
|
|
59
|
+
return function(a2, b2) {
|
|
81
60
|
if (arguments.length >= 2) {
|
|
82
|
-
return body(
|
|
61
|
+
return body(a2, b2);
|
|
83
62
|
}
|
|
84
|
-
return function
|
|
85
|
-
return body(self,
|
|
63
|
+
return function(self) {
|
|
64
|
+
return body(self, a2);
|
|
86
65
|
};
|
|
87
66
|
};
|
|
88
67
|
case 3:
|
|
89
|
-
return function
|
|
68
|
+
return function(a2, b2, c2) {
|
|
90
69
|
if (arguments.length >= 3) {
|
|
91
|
-
return body(
|
|
70
|
+
return body(a2, b2, c2);
|
|
92
71
|
}
|
|
93
|
-
return function
|
|
94
|
-
return body(self,
|
|
72
|
+
return function(self) {
|
|
73
|
+
return body(self, a2, b2);
|
|
95
74
|
};
|
|
96
75
|
};
|
|
97
76
|
case 4:
|
|
98
|
-
return function
|
|
77
|
+
return function(a2, b2, c2, d2) {
|
|
99
78
|
if (arguments.length >= 4) {
|
|
100
|
-
return body(
|
|
79
|
+
return body(a2, b2, c2, d2);
|
|
101
80
|
}
|
|
102
|
-
return function
|
|
103
|
-
return body(self,
|
|
81
|
+
return function(self) {
|
|
82
|
+
return body(self, a2, b2, c2);
|
|
104
83
|
};
|
|
105
84
|
};
|
|
106
85
|
case 5:
|
|
107
|
-
return function
|
|
86
|
+
return function(a2, b2, c2, d2, e2) {
|
|
108
87
|
if (arguments.length >= 5) {
|
|
109
|
-
return body(
|
|
88
|
+
return body(a2, b2, c2, d2, e2);
|
|
110
89
|
}
|
|
111
|
-
return function
|
|
112
|
-
return body(self,
|
|
90
|
+
return function(self) {
|
|
91
|
+
return body(self, a2, b2, c2, d2);
|
|
113
92
|
};
|
|
114
93
|
};
|
|
115
94
|
default:
|
|
116
|
-
return function
|
|
95
|
+
return function() {
|
|
117
96
|
if (arguments.length >= arity) {
|
|
118
|
-
// @ts-expect-error
|
|
119
97
|
return body.apply(this, arguments);
|
|
120
98
|
}
|
|
121
99
|
const args = arguments;
|
|
122
|
-
return function
|
|
100
|
+
return function(self) {
|
|
123
101
|
return body(self, ...args);
|
|
124
102
|
};
|
|
125
103
|
};
|
|
126
104
|
}
|
|
127
105
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
*/
|
|
146
|
-
const constant = value => () => value;
|
|
147
|
-
/**
|
|
148
|
-
* A thunk that returns always `true`.
|
|
149
|
-
*
|
|
150
|
-
* @example
|
|
151
|
-
* import { constTrue } from "effect/Function"
|
|
152
|
-
*
|
|
153
|
-
* assert.deepStrictEqual(constTrue(), true)
|
|
154
|
-
*
|
|
155
|
-
* @since 2.0.0
|
|
156
|
-
*/
|
|
157
|
-
const constTrue = /*#__PURE__*/constant(true);
|
|
158
|
-
/**
|
|
159
|
-
* A thunk that returns always `false`.
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* import { constFalse } from "effect/Function"
|
|
163
|
-
*
|
|
164
|
-
* assert.deepStrictEqual(constFalse(), false)
|
|
165
|
-
*
|
|
166
|
-
* @since 2.0.0
|
|
167
|
-
*/
|
|
168
|
-
const constFalse = /*#__PURE__*/constant(false);
|
|
169
|
-
function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
106
|
+
var apply = (a2) => (self) => self(a2);
|
|
107
|
+
var identity = (a2) => a2;
|
|
108
|
+
var unsafeCoerce = identity;
|
|
109
|
+
var constant = (value) => () => value;
|
|
110
|
+
var constTrue = /* @__PURE__ */ constant(true);
|
|
111
|
+
var constFalse = /* @__PURE__ */ constant(false);
|
|
112
|
+
var constNull = /* @__PURE__ */ constant(null);
|
|
113
|
+
var constUndefined = /* @__PURE__ */ constant(void 0);
|
|
114
|
+
var constVoid = constUndefined;
|
|
115
|
+
var flip = (f2) => (...b2) => (...a2) => f2(...a2)(...b2);
|
|
116
|
+
var compose = /* @__PURE__ */ dual(2, (ab, bc) => (a2) => bc(ab(a2)));
|
|
117
|
+
var absurd = (_2) => {
|
|
118
|
+
throw new Error("Called `absurd` function which should be uncallable");
|
|
119
|
+
};
|
|
120
|
+
var tupled = (f2) => (a2) => f2(...a2);
|
|
121
|
+
var untupled = (f2) => (...a2) => f2(a2);
|
|
122
|
+
function pipe(a2, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
170
123
|
switch (arguments.length) {
|
|
171
124
|
case 1:
|
|
172
|
-
return
|
|
125
|
+
return a2;
|
|
173
126
|
case 2:
|
|
174
|
-
return ab(
|
|
127
|
+
return ab(a2);
|
|
175
128
|
case 3:
|
|
176
|
-
return bc(ab(
|
|
129
|
+
return bc(ab(a2));
|
|
177
130
|
case 4:
|
|
178
|
-
return cd(bc(ab(
|
|
131
|
+
return cd(bc(ab(a2)));
|
|
179
132
|
case 5:
|
|
180
|
-
return de(cd(bc(ab(
|
|
133
|
+
return de(cd(bc(ab(a2))));
|
|
181
134
|
case 6:
|
|
182
|
-
return ef(de(cd(bc(ab(
|
|
135
|
+
return ef(de(cd(bc(ab(a2)))));
|
|
183
136
|
case 7:
|
|
184
|
-
return fg(ef(de(cd(bc(ab(
|
|
137
|
+
return fg(ef(de(cd(bc(ab(a2))))));
|
|
185
138
|
case 8:
|
|
186
|
-
return gh(fg(ef(de(cd(bc(ab(
|
|
139
|
+
return gh(fg(ef(de(cd(bc(ab(a2)))))));
|
|
187
140
|
case 9:
|
|
188
|
-
return hi(gh(fg(ef(de(cd(bc(ab(
|
|
189
|
-
default:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
ret = arguments[i](ret);
|
|
194
|
-
}
|
|
195
|
-
return ret;
|
|
141
|
+
return hi(gh(fg(ef(de(cd(bc(ab(a2))))))));
|
|
142
|
+
default: {
|
|
143
|
+
let ret = arguments[0];
|
|
144
|
+
for (let i2 = 1; i2 < arguments.length; i2++) {
|
|
145
|
+
ret = arguments[i2](ret);
|
|
196
146
|
}
|
|
147
|
+
return ret;
|
|
148
|
+
}
|
|
197
149
|
}
|
|
198
150
|
}
|
|
151
|
+
function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
|
|
152
|
+
switch (arguments.length) {
|
|
153
|
+
case 1:
|
|
154
|
+
return ab;
|
|
155
|
+
case 2:
|
|
156
|
+
return function() {
|
|
157
|
+
return bc(ab.apply(this, arguments));
|
|
158
|
+
};
|
|
159
|
+
case 3:
|
|
160
|
+
return function() {
|
|
161
|
+
return cd(bc(ab.apply(this, arguments)));
|
|
162
|
+
};
|
|
163
|
+
case 4:
|
|
164
|
+
return function() {
|
|
165
|
+
return de(cd(bc(ab.apply(this, arguments))));
|
|
166
|
+
};
|
|
167
|
+
case 5:
|
|
168
|
+
return function() {
|
|
169
|
+
return ef(de(cd(bc(ab.apply(this, arguments)))));
|
|
170
|
+
};
|
|
171
|
+
case 6:
|
|
172
|
+
return function() {
|
|
173
|
+
return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
|
|
174
|
+
};
|
|
175
|
+
case 7:
|
|
176
|
+
return function() {
|
|
177
|
+
return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
|
|
178
|
+
};
|
|
179
|
+
case 8:
|
|
180
|
+
return function() {
|
|
181
|
+
return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
|
|
182
|
+
};
|
|
183
|
+
case 9:
|
|
184
|
+
return function() {
|
|
185
|
+
return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
var hole = /* @__PURE__ */ unsafeCoerce(absurd);
|
|
191
|
+
var SK = (_2, b2) => b2;
|
|
199
192
|
|
|
200
|
-
|
|
193
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/internal/version.js
|
|
194
|
+
var moduleVersion = "2.3.1";
|
|
201
195
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
*/
|
|
205
|
-
const globalStoreId = /*#__PURE__*/Symbol.for(`effect/GlobalValue/globalStoreId/${moduleVersion}`);
|
|
196
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/GlobalValue.js
|
|
197
|
+
var globalStoreId = /* @__PURE__ */ Symbol.for(`effect/GlobalValue/globalStoreId/${moduleVersion}`);
|
|
206
198
|
if (!(globalStoreId in globalThis)) {
|
|
207
|
-
globalThis[globalStoreId] =
|
|
199
|
+
globalThis[globalStoreId] = /* @__PURE__ */ new Map();
|
|
208
200
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
* @since 2.0.0
|
|
212
|
-
*/
|
|
213
|
-
const globalValue = (id, compute) => {
|
|
201
|
+
var globalStore = globalThis[globalStoreId];
|
|
202
|
+
var globalValue = (id, compute) => {
|
|
214
203
|
if (!globalStore.has(id)) {
|
|
215
204
|
globalStore.set(id, compute());
|
|
216
205
|
}
|
|
217
206
|
return globalStore.get(id);
|
|
218
207
|
};
|
|
219
208
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
209
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Predicate.js
|
|
210
|
+
var Predicate_exports = {};
|
|
211
|
+
__export(Predicate_exports, {
|
|
212
|
+
all: () => all,
|
|
213
|
+
and: () => and,
|
|
214
|
+
compose: () => compose2,
|
|
215
|
+
eqv: () => eqv,
|
|
216
|
+
every: () => every,
|
|
217
|
+
hasProperty: () => hasProperty,
|
|
218
|
+
implies: () => implies,
|
|
219
|
+
isBigInt: () => isBigInt,
|
|
220
|
+
isBoolean: () => isBoolean,
|
|
221
|
+
isDate: () => isDate,
|
|
222
|
+
isError: () => isError,
|
|
223
|
+
isFunction: () => isFunction2,
|
|
224
|
+
isIterable: () => isIterable,
|
|
225
|
+
isNever: () => isNever,
|
|
226
|
+
isNotNull: () => isNotNull,
|
|
227
|
+
isNotNullable: () => isNotNullable,
|
|
228
|
+
isNotUndefined: () => isNotUndefined,
|
|
229
|
+
isNull: () => isNull,
|
|
230
|
+
isNullable: () => isNullable,
|
|
231
|
+
isNumber: () => isNumber,
|
|
232
|
+
isObject: () => isObject,
|
|
233
|
+
isPromise: () => isPromise,
|
|
234
|
+
isReadonlyRecord: () => isReadonlyRecord,
|
|
235
|
+
isRecord: () => isRecord,
|
|
236
|
+
isString: () => isString,
|
|
237
|
+
isSymbol: () => isSymbol,
|
|
238
|
+
isTagged: () => isTagged,
|
|
239
|
+
isUint8Array: () => isUint8Array,
|
|
240
|
+
isUndefined: () => isUndefined,
|
|
241
|
+
isUnknown: () => isUnknown,
|
|
242
|
+
mapInput: () => mapInput,
|
|
243
|
+
nand: () => nand,
|
|
244
|
+
nor: () => nor,
|
|
245
|
+
not: () => not,
|
|
246
|
+
or: () => or,
|
|
247
|
+
product: () => product,
|
|
248
|
+
productMany: () => productMany,
|
|
249
|
+
some: () => some,
|
|
250
|
+
struct: () => struct,
|
|
251
|
+
tuple: () => tuple,
|
|
252
|
+
xor: () => xor
|
|
253
|
+
});
|
|
254
|
+
var mapInput = /* @__PURE__ */ dual(2, (self, f2) => (b2) => self(f2(b2)));
|
|
255
|
+
var isString = (input) => typeof input === "string";
|
|
256
|
+
var isNumber = (input) => typeof input === "number";
|
|
257
|
+
var isBoolean = (input) => typeof input === "boolean";
|
|
258
|
+
var isBigInt = (input) => typeof input === "bigint";
|
|
259
|
+
var isSymbol = (input) => typeof input === "symbol";
|
|
260
|
+
var isFunction2 = isFunction;
|
|
261
|
+
var isUndefined = (input) => input === void 0;
|
|
262
|
+
var isNotUndefined = (input) => input !== void 0;
|
|
263
|
+
var isNull = (input) => input === null;
|
|
264
|
+
var isNotNull = (input) => input !== null;
|
|
265
|
+
var isNever = (_2) => false;
|
|
266
|
+
var isUnknown = (_2) => true;
|
|
267
|
+
var isRecordOrArray = (input) => typeof input === "object" && input !== null;
|
|
268
|
+
var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
|
|
269
|
+
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
|
|
270
|
+
var isTagged = /* @__PURE__ */ dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag);
|
|
271
|
+
var isNullable = (input) => input === null || input === void 0;
|
|
272
|
+
var isNotNullable = (input) => input !== null && input !== void 0;
|
|
273
|
+
var isError = (input) => input instanceof Error;
|
|
274
|
+
var isUint8Array = (input) => input instanceof Uint8Array;
|
|
275
|
+
var isDate = (input) => input instanceof Date;
|
|
276
|
+
var isIterable = (input) => hasProperty(input, Symbol.iterator);
|
|
277
|
+
var isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input);
|
|
278
|
+
var isReadonlyRecord = isRecord;
|
|
279
|
+
var isPromise = (input) => hasProperty(input, "then") && "catch" in input && isFunction2(input.then) && isFunction2(input.catch);
|
|
280
|
+
var compose2 = /* @__PURE__ */ dual(2, (ab, bc) => (a2) => ab(a2) && bc(a2));
|
|
281
|
+
var product = (self, that) => ([a2, b2]) => self(a2) && that(b2);
|
|
282
|
+
var all = (collection) => {
|
|
283
|
+
return (as2) => {
|
|
284
|
+
let collectionIndex = 0;
|
|
285
|
+
for (const p2 of collection) {
|
|
286
|
+
if (collectionIndex >= as2.length) {
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
if (p2(as2[collectionIndex]) === false) {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
collectionIndex++;
|
|
293
|
+
}
|
|
294
|
+
return true;
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
var productMany = (self, collection) => {
|
|
298
|
+
const rest = all(collection);
|
|
299
|
+
return ([head, ...tail]) => self(head) === false ? false : rest(tail);
|
|
300
|
+
};
|
|
301
|
+
var tuple = (...elements) => all(elements);
|
|
302
|
+
var struct = (fields) => {
|
|
303
|
+
const keys = Object.keys(fields);
|
|
304
|
+
return (a2) => {
|
|
305
|
+
for (const key of keys) {
|
|
306
|
+
if (!fields[key](a2[key])) {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return true;
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
var not = (self) => (a2) => !self(a2);
|
|
314
|
+
var or = /* @__PURE__ */ dual(2, (self, that) => (a2) => self(a2) || that(a2));
|
|
315
|
+
var and = /* @__PURE__ */ dual(2, (self, that) => (a2) => self(a2) && that(a2));
|
|
316
|
+
var xor = /* @__PURE__ */ dual(2, (self, that) => (a2) => self(a2) !== that(a2));
|
|
317
|
+
var eqv = /* @__PURE__ */ dual(2, (self, that) => (a2) => self(a2) === that(a2));
|
|
318
|
+
var implies = /* @__PURE__ */ dual(2, (self, that) => (a2) => self(a2) ? that(a2) : true);
|
|
319
|
+
var nor = /* @__PURE__ */ dual(2, (self, that) => (a2) => !(self(a2) || that(a2)));
|
|
320
|
+
var nand = /* @__PURE__ */ dual(2, (self, that) => (a2) => !(self(a2) && that(a2)));
|
|
321
|
+
var every = (collection) => (a2) => {
|
|
322
|
+
for (const p2 of collection) {
|
|
323
|
+
if (!p2(a2)) {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return true;
|
|
328
|
+
};
|
|
329
|
+
var some = (collection) => (a2) => {
|
|
330
|
+
for (const p2 of collection) {
|
|
331
|
+
if (p2(a2)) {
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return false;
|
|
336
|
+
};
|
|
302
337
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
338
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Utils.js
|
|
339
|
+
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
|
|
340
|
+
var GenKindImpl = class {
|
|
341
|
+
value;
|
|
342
|
+
constructor(value) {
|
|
343
|
+
this.value = value;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* @since 2.0.0
|
|
347
|
+
*/
|
|
348
|
+
get _F() {
|
|
349
|
+
return identity;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* @since 2.0.0
|
|
353
|
+
*/
|
|
354
|
+
get _R() {
|
|
355
|
+
return (_2) => _2;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* @since 2.0.0
|
|
359
|
+
*/
|
|
360
|
+
get _O() {
|
|
361
|
+
return (_2) => _2;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* @since 2.0.0
|
|
365
|
+
*/
|
|
366
|
+
get _E() {
|
|
367
|
+
return (_2) => _2;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* @since 2.0.0
|
|
371
|
+
*/
|
|
372
|
+
[GenKindTypeId] = GenKindTypeId;
|
|
373
|
+
/**
|
|
374
|
+
* @since 2.0.0
|
|
375
|
+
*/
|
|
376
|
+
[Symbol.iterator]() {
|
|
377
|
+
return new SingleShotGen(this);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
var SingleShotGen = class _SingleShotGen {
|
|
381
|
+
self;
|
|
382
|
+
called = false;
|
|
383
|
+
constructor(self) {
|
|
384
|
+
this.self = self;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* @since 2.0.0
|
|
388
|
+
*/
|
|
389
|
+
next(a2) {
|
|
390
|
+
return this.called ? {
|
|
391
|
+
value: a2,
|
|
392
|
+
done: true
|
|
393
|
+
} : (this.called = true, {
|
|
394
|
+
value: this.self,
|
|
395
|
+
done: false
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* @since 2.0.0
|
|
400
|
+
*/
|
|
401
|
+
return(a2) {
|
|
402
|
+
return {
|
|
403
|
+
value: a2,
|
|
404
|
+
done: true
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* @since 2.0.0
|
|
409
|
+
*/
|
|
410
|
+
throw(e2) {
|
|
411
|
+
throw e2;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* @since 2.0.0
|
|
415
|
+
*/
|
|
416
|
+
[Symbol.iterator]() {
|
|
417
|
+
return new _SingleShotGen(this.self);
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
var adapter = () => (
|
|
421
|
+
// @ts-expect-error
|
|
422
|
+
function() {
|
|
423
|
+
let x2 = arguments[0];
|
|
424
|
+
for (let i2 = 1; i2 < arguments.length; i2++) {
|
|
425
|
+
x2 = arguments[i2](x2);
|
|
426
|
+
}
|
|
427
|
+
return new GenKindImpl(x2);
|
|
428
|
+
}
|
|
429
|
+
);
|
|
430
|
+
var defaultIncHi = 335903614;
|
|
431
|
+
var defaultIncLo = 4150755663;
|
|
432
|
+
var MUL_HI = 1481765933 >>> 0;
|
|
433
|
+
var MUL_LO = 1284865837 >>> 0;
|
|
434
|
+
var BIT_53 = 9007199254740992;
|
|
435
|
+
var BIT_27 = 134217728;
|
|
436
|
+
var PCGRandom = class {
|
|
321
437
|
_state;
|
|
322
438
|
constructor(seedHi, seedLo, incHi, incLo) {
|
|
323
439
|
if (isNullable(seedLo) && isNullable(seedHi)) {
|
|
324
|
-
seedLo = Math.random() *
|
|
440
|
+
seedLo = Math.random() * 4294967295 >>> 0;
|
|
325
441
|
seedHi = 0;
|
|
326
442
|
} else if (isNullable(seedLo)) {
|
|
327
443
|
seedLo = seedHi;
|
|
@@ -373,13 +489,11 @@ class PCGRandom {
|
|
|
373
489
|
}
|
|
374
490
|
max = max >>> 0;
|
|
375
491
|
if ((max & max - 1) === 0) {
|
|
376
|
-
return this._next() & max - 1;
|
|
492
|
+
return this._next() & max - 1;
|
|
377
493
|
}
|
|
378
494
|
let num = 0;
|
|
379
495
|
const skew = (-max >>> 0) % max >>> 0;
|
|
380
496
|
for (num = this._next(); num < skew; num = this._next()) {
|
|
381
|
-
// this loop will rarely execute more than twice,
|
|
382
|
-
// and is intentionally empty
|
|
383
497
|
}
|
|
384
498
|
return num % max;
|
|
385
499
|
}
|
|
@@ -391,35 +505,30 @@ class PCGRandom {
|
|
|
391
505
|
* @since 2.0.0
|
|
392
506
|
*/
|
|
393
507
|
number() {
|
|
394
|
-
const hi = (this._next() &
|
|
395
|
-
const lo = (this._next() &
|
|
508
|
+
const hi = (this._next() & 67108863) * 1;
|
|
509
|
+
const lo = (this._next() & 134217727) * 1;
|
|
396
510
|
return (hi * BIT_27 + lo) / BIT_53;
|
|
397
511
|
}
|
|
398
512
|
/** @internal */
|
|
399
513
|
_next() {
|
|
400
|
-
// save current state (what we'll use for this number)
|
|
401
514
|
const oldHi = this._state[0] >>> 0;
|
|
402
515
|
const oldLo = this._state[1] >>> 0;
|
|
403
|
-
// churn LCG.
|
|
404
516
|
mul64(this._state, oldHi, oldLo, MUL_HI, MUL_LO);
|
|
405
517
|
add64(this._state, this._state[0], this._state[1], this._state[2], this._state[3]);
|
|
406
|
-
// get least sig. 32 bits of ((oldstate >> 18) ^ oldstate) >> 27
|
|
407
518
|
let xsHi = oldHi >>> 18;
|
|
408
519
|
let xsLo = (oldLo >>> 18 | oldHi << 14) >>> 0;
|
|
409
520
|
xsHi = (xsHi ^ oldHi) >>> 0;
|
|
410
521
|
xsLo = (xsLo ^ oldLo) >>> 0;
|
|
411
522
|
const xorshifted = (xsLo >>> 27 | xsHi << 5) >>> 0;
|
|
412
|
-
// rotate xorshifted right a random amount, based on the most sig. 5 bits
|
|
413
|
-
// bits of the old state.
|
|
414
523
|
const rot = oldHi >>> 27;
|
|
415
524
|
const rot2 = (-rot >>> 0 & 31) >>> 0;
|
|
416
525
|
return (xorshifted >>> rot | xorshifted << rot2) >>> 0;
|
|
417
526
|
}
|
|
418
|
-
}
|
|
527
|
+
};
|
|
419
528
|
function mul64(out, aHi, aLo, bHi, bLo) {
|
|
420
|
-
let c1 = (aLo >>> 16) * (bLo &
|
|
421
|
-
let c0 = (aLo &
|
|
422
|
-
let lo = (aLo &
|
|
529
|
+
let c1 = (aLo >>> 16) * (bLo & 65535) >>> 0;
|
|
530
|
+
let c0 = (aLo & 65535) * (bLo >>> 16) >>> 0;
|
|
531
|
+
let lo = (aLo & 65535) * (bLo & 65535) >>> 0;
|
|
423
532
|
let hi = (aLo >>> 16) * (bLo >>> 16) + ((c0 >>> 16) + (c1 >>> 16)) >>> 0;
|
|
424
533
|
c0 = c0 << 16 >>> 0;
|
|
425
534
|
lo = lo + c0 >>> 0;
|
|
@@ -436,7 +545,6 @@ function mul64(out, aHi, aLo, bHi, bLo) {
|
|
|
436
545
|
out[0] = hi;
|
|
437
546
|
out[1] = lo;
|
|
438
547
|
}
|
|
439
|
-
// add two 64 bit numbers (given in parts), and store the result in `out`.
|
|
440
548
|
function add64(out, aHi, aLo, bHi, bLo) {
|
|
441
549
|
let hi = aHi + bHi >>> 0;
|
|
442
550
|
const lo = aLo + bLo >>> 0;
|
|
@@ -447,23 +555,11 @@ function add64(out, aHi, aLo, bHi, bLo) {
|
|
|
447
555
|
out[1] = lo;
|
|
448
556
|
}
|
|
449
557
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
*/
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
/** @internal */
|
|
456
|
-
const pcgr = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
|
|
457
|
-
/**
|
|
458
|
-
* @since 2.0.0
|
|
459
|
-
* @category symbols
|
|
460
|
-
*/
|
|
461
|
-
const symbol$1 = /*#__PURE__*/Symbol.for("effect/Hash");
|
|
462
|
-
/**
|
|
463
|
-
* @since 2.0.0
|
|
464
|
-
* @category hashing
|
|
465
|
-
*/
|
|
466
|
-
const hash = self => {
|
|
558
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Hash.js
|
|
559
|
+
var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
|
|
560
|
+
var pcgr = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
|
|
561
|
+
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
562
|
+
var hash = (self) => {
|
|
467
563
|
switch (typeof self) {
|
|
468
564
|
case "number":
|
|
469
565
|
return number(self);
|
|
@@ -478,84 +574,55 @@ const hash = self => {
|
|
|
478
574
|
case "undefined":
|
|
479
575
|
return string("undefined");
|
|
480
576
|
case "function":
|
|
481
|
-
case "object":
|
|
482
|
-
{
|
|
483
|
-
|
|
484
|
-
return string("null");
|
|
485
|
-
}
|
|
486
|
-
if (isHash(self)) {
|
|
487
|
-
return self[symbol$1]();
|
|
488
|
-
} else {
|
|
489
|
-
return random(self);
|
|
490
|
-
}
|
|
577
|
+
case "object": {
|
|
578
|
+
if (self === null) {
|
|
579
|
+
return string("null");
|
|
491
580
|
}
|
|
581
|
+
if (isHash(self)) {
|
|
582
|
+
return self[symbol]();
|
|
583
|
+
} else {
|
|
584
|
+
return random(self);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
492
587
|
default:
|
|
493
588
|
throw new Error(`BUG: unhandled typeof ${typeof self} - please report an issue at https://github.com/Effect-TS/effect/issues`);
|
|
494
589
|
}
|
|
495
590
|
};
|
|
496
|
-
|
|
497
|
-
* @since 2.0.0
|
|
498
|
-
* @category hashing
|
|
499
|
-
*/
|
|
500
|
-
const random = self => {
|
|
591
|
+
var random = (self) => {
|
|
501
592
|
if (!randomHashCache.has(self)) {
|
|
502
593
|
randomHashCache.set(self, number(pcgr.integer(Number.MAX_SAFE_INTEGER)));
|
|
503
594
|
}
|
|
504
595
|
return randomHashCache.get(self);
|
|
505
596
|
};
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* @since 2.0.0
|
|
513
|
-
* @category hashing
|
|
514
|
-
*/
|
|
515
|
-
const optimize = n => n & 0xbfffffff | n >>> 1 & 0x40000000;
|
|
516
|
-
/**
|
|
517
|
-
* @since 2.0.0
|
|
518
|
-
* @category guards
|
|
519
|
-
*/
|
|
520
|
-
const isHash = u => hasProperty(u, symbol$1);
|
|
521
|
-
/**
|
|
522
|
-
* @since 2.0.0
|
|
523
|
-
* @category hashing
|
|
524
|
-
*/
|
|
525
|
-
const number = n => {
|
|
526
|
-
if (n !== n || n === Infinity) {
|
|
597
|
+
var combine = (b2) => (self) => self * 53 ^ b2;
|
|
598
|
+
var optimize = (n2) => n2 & 3221225471 | n2 >>> 1 & 1073741824;
|
|
599
|
+
var isHash = (u2) => hasProperty(u2, symbol);
|
|
600
|
+
var number = (n2) => {
|
|
601
|
+
if (n2 !== n2 || n2 === Infinity) {
|
|
527
602
|
return 0;
|
|
528
603
|
}
|
|
529
|
-
let
|
|
530
|
-
if (
|
|
531
|
-
|
|
604
|
+
let h2 = n2 | 0;
|
|
605
|
+
if (h2 !== n2) {
|
|
606
|
+
h2 ^= n2 * 4294967295;
|
|
532
607
|
}
|
|
533
|
-
while (
|
|
534
|
-
|
|
608
|
+
while (n2 > 4294967295) {
|
|
609
|
+
h2 ^= n2 /= 4294967295;
|
|
535
610
|
}
|
|
536
|
-
return optimize(
|
|
611
|
+
return optimize(n2);
|
|
537
612
|
};
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
i = str.length;
|
|
545
|
-
while (i) {
|
|
546
|
-
h = h * 33 ^ str.charCodeAt(--i);
|
|
547
|
-
}
|
|
548
|
-
return optimize(h);
|
|
613
|
+
var string = (str) => {
|
|
614
|
+
let h2 = 5381, i2 = str.length;
|
|
615
|
+
while (i2) {
|
|
616
|
+
h2 = h2 * 33 ^ str.charCodeAt(--i2);
|
|
617
|
+
}
|
|
618
|
+
return optimize(h2);
|
|
549
619
|
};
|
|
550
620
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
* @category symbols
|
|
554
|
-
*/
|
|
555
|
-
const symbol = /*#__PURE__*/Symbol.for("effect/Equal");
|
|
621
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Equal.js
|
|
622
|
+
var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
|
|
556
623
|
function equals() {
|
|
557
624
|
if (arguments.length === 1) {
|
|
558
|
-
return self => compareBoth(self, arguments[0]);
|
|
625
|
+
return (self) => compareBoth(self, arguments[0]);
|
|
559
626
|
}
|
|
560
627
|
return compareBoth(arguments[0], arguments[1]);
|
|
561
628
|
}
|
|
@@ -569,48 +636,93 @@ function compareBoth(self, that) {
|
|
|
569
636
|
}
|
|
570
637
|
if ((selfType === "object" || selfType === "function") && self !== null && that !== null) {
|
|
571
638
|
if (isEqual(self) && isEqual(that)) {
|
|
572
|
-
return hash(self) === hash(that) && self[
|
|
639
|
+
return hash(self) === hash(that) && self[symbol2](that);
|
|
573
640
|
}
|
|
574
641
|
}
|
|
575
642
|
return false;
|
|
576
643
|
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
* @category guards
|
|
580
|
-
*/
|
|
581
|
-
const isEqual = u => hasProperty(u, symbol);
|
|
644
|
+
var isEqual = (u2) => hasProperty(u2, symbol2);
|
|
645
|
+
var equivalence = () => (self, that) => equals(self, that);
|
|
582
646
|
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
if (hasProperty(x, "toJSON") && isFunction(x["toJSON"]) && x["toJSON"].length === 0) {
|
|
596
|
-
return x.toJSON();
|
|
597
|
-
} else if (Array.isArray(x)) {
|
|
598
|
-
return x.map(toJSON);
|
|
599
|
-
}
|
|
600
|
-
return x;
|
|
647
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Equivalence.js
|
|
648
|
+
var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
649
|
+
|
|
650
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Inspectable.js
|
|
651
|
+
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
652
|
+
var toJSON = (x2) => {
|
|
653
|
+
if (hasProperty(x2, "toJSON") && isFunction2(x2["toJSON"]) && x2["toJSON"].length === 0) {
|
|
654
|
+
return x2.toJSON();
|
|
655
|
+
} else if (Array.isArray(x2)) {
|
|
656
|
+
return x2.map(toJSON);
|
|
657
|
+
}
|
|
658
|
+
return x2;
|
|
601
659
|
};
|
|
602
|
-
|
|
603
|
-
* @since 2.0.0
|
|
604
|
-
*/
|
|
605
|
-
const format = x => JSON.stringify(x, null, 2);
|
|
660
|
+
var format = (x2) => JSON.stringify(x2, null, 2);
|
|
606
661
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
662
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Option.js
|
|
663
|
+
var Option_exports = {};
|
|
664
|
+
__export(Option_exports, {
|
|
665
|
+
Do: () => Do,
|
|
666
|
+
TypeId: () => TypeId3,
|
|
667
|
+
all: () => all2,
|
|
668
|
+
andThen: () => andThen,
|
|
669
|
+
ap: () => ap,
|
|
670
|
+
as: () => as,
|
|
671
|
+
asUnit: () => asUnit,
|
|
672
|
+
bind: () => bind,
|
|
673
|
+
bindTo: () => bindTo,
|
|
674
|
+
composeK: () => composeK,
|
|
675
|
+
contains: () => contains,
|
|
676
|
+
containsWith: () => containsWith,
|
|
677
|
+
exists: () => exists,
|
|
678
|
+
filter: () => filter,
|
|
679
|
+
filterMap: () => filterMap,
|
|
680
|
+
firstSomeOf: () => firstSomeOf,
|
|
681
|
+
flatMap: () => flatMap,
|
|
682
|
+
flatMapNullable: () => flatMapNullable,
|
|
683
|
+
flatten: () => flatten,
|
|
684
|
+
fromIterable: () => fromIterable,
|
|
685
|
+
fromNullable: () => fromNullable,
|
|
686
|
+
gen: () => gen,
|
|
687
|
+
getEquivalence: () => getEquivalence,
|
|
688
|
+
getLeft: () => getLeft2,
|
|
689
|
+
getOrElse: () => getOrElse,
|
|
690
|
+
getOrNull: () => getOrNull,
|
|
691
|
+
getOrThrow: () => getOrThrow,
|
|
692
|
+
getOrThrowWith: () => getOrThrowWith,
|
|
693
|
+
getOrUndefined: () => getOrUndefined,
|
|
694
|
+
getOrder: () => getOrder,
|
|
695
|
+
getRight: () => getRight2,
|
|
696
|
+
isNone: () => isNone2,
|
|
697
|
+
isOption: () => isOption2,
|
|
698
|
+
isSome: () => isSome2,
|
|
699
|
+
let: () => let_,
|
|
700
|
+
lift2: () => lift2,
|
|
701
|
+
liftNullable: () => liftNullable,
|
|
702
|
+
liftPredicate: () => liftPredicate,
|
|
703
|
+
liftThrowable: () => liftThrowable,
|
|
704
|
+
map: () => map,
|
|
705
|
+
match: () => match,
|
|
706
|
+
none: () => none2,
|
|
707
|
+
orElse: () => orElse,
|
|
708
|
+
orElseEither: () => orElseEither,
|
|
709
|
+
orElseSome: () => orElseSome,
|
|
710
|
+
partitionMap: () => partitionMap,
|
|
711
|
+
product: () => product2,
|
|
712
|
+
productMany: () => productMany2,
|
|
713
|
+
reduceCompact: () => reduceCompact,
|
|
714
|
+
some: () => some3,
|
|
715
|
+
tap: () => tap,
|
|
716
|
+
toArray: () => toArray,
|
|
717
|
+
toRefinement: () => toRefinement,
|
|
718
|
+
unit: () => unit,
|
|
719
|
+
zipLeft: () => zipLeft,
|
|
720
|
+
zipRight: () => zipRight,
|
|
721
|
+
zipWith: () => zipWith
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Pipeable.js
|
|
725
|
+
var pipeArguments = (self, args) => {
|
|
614
726
|
switch (args.length) {
|
|
615
727
|
case 1:
|
|
616
728
|
return args[0](self);
|
|
@@ -630,73 +742,67 @@ const pipeArguments = (self, args) => {
|
|
|
630
742
|
return args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self))))))));
|
|
631
743
|
case 9:
|
|
632
744
|
return args[8](args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))))));
|
|
633
|
-
default:
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
ret = args[i](ret);
|
|
638
|
-
}
|
|
639
|
-
return ret;
|
|
745
|
+
default: {
|
|
746
|
+
let ret = self;
|
|
747
|
+
for (let i2 = 0, len = args.length; i2 < len; i2++) {
|
|
748
|
+
ret = args[i2](ret);
|
|
640
749
|
}
|
|
750
|
+
return ret;
|
|
751
|
+
}
|
|
641
752
|
}
|
|
642
753
|
};
|
|
643
754
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
/** @internal */
|
|
651
|
-
const ChannelTypeId = /*#__PURE__*/Symbol.for("effect/Channel");
|
|
652
|
-
/** @internal */
|
|
653
|
-
const effectVariance = {
|
|
755
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/internal/effectable.js
|
|
756
|
+
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
757
|
+
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
758
|
+
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
759
|
+
var ChannelTypeId = /* @__PURE__ */ Symbol.for("effect/Channel");
|
|
760
|
+
var effectVariance = {
|
|
654
761
|
/* c8 ignore next */
|
|
655
|
-
_R:
|
|
762
|
+
_R: (_2) => _2,
|
|
656
763
|
/* c8 ignore next */
|
|
657
|
-
_E:
|
|
764
|
+
_E: (_2) => _2,
|
|
658
765
|
/* c8 ignore next */
|
|
659
|
-
_A:
|
|
766
|
+
_A: (_2) => _2,
|
|
660
767
|
_V: moduleVersion
|
|
661
768
|
};
|
|
662
|
-
|
|
769
|
+
var sinkVariance = {
|
|
663
770
|
/* c8 ignore next */
|
|
664
|
-
_A:
|
|
771
|
+
_A: (_2) => _2,
|
|
665
772
|
/* c8 ignore next */
|
|
666
|
-
_In:
|
|
773
|
+
_In: (_2) => _2,
|
|
667
774
|
/* c8 ignore next */
|
|
668
|
-
_L:
|
|
775
|
+
_L: (_2) => _2,
|
|
669
776
|
/* c8 ignore next */
|
|
670
|
-
_E:
|
|
777
|
+
_E: (_2) => _2,
|
|
671
778
|
/* c8 ignore next */
|
|
672
|
-
_R:
|
|
779
|
+
_R: (_2) => _2
|
|
673
780
|
};
|
|
674
|
-
|
|
781
|
+
var channelVariance = {
|
|
675
782
|
/* c8 ignore next */
|
|
676
|
-
_Env:
|
|
783
|
+
_Env: (_2) => _2,
|
|
677
784
|
/* c8 ignore next */
|
|
678
|
-
_InErr:
|
|
785
|
+
_InErr: (_2) => _2,
|
|
679
786
|
/* c8 ignore next */
|
|
680
|
-
_InElem:
|
|
787
|
+
_InElem: (_2) => _2,
|
|
681
788
|
/* c8 ignore next */
|
|
682
|
-
_InDone:
|
|
789
|
+
_InDone: (_2) => _2,
|
|
683
790
|
/* c8 ignore next */
|
|
684
|
-
_OutErr:
|
|
791
|
+
_OutErr: (_2) => _2,
|
|
685
792
|
/* c8 ignore next */
|
|
686
|
-
_OutElem:
|
|
793
|
+
_OutElem: (_2) => _2,
|
|
687
794
|
/* c8 ignore next */
|
|
688
|
-
_OutDone:
|
|
795
|
+
_OutDone: (_2) => _2
|
|
689
796
|
};
|
|
690
|
-
|
|
691
|
-
const EffectPrototype = {
|
|
797
|
+
var EffectPrototype = {
|
|
692
798
|
[EffectTypeId]: effectVariance,
|
|
693
799
|
[StreamTypeId]: effectVariance,
|
|
694
800
|
[SinkTypeId]: sinkVariance,
|
|
695
801
|
[ChannelTypeId]: channelVariance,
|
|
696
|
-
[
|
|
802
|
+
[symbol2](that) {
|
|
697
803
|
return this === that;
|
|
698
804
|
},
|
|
699
|
-
[symbol
|
|
805
|
+
[symbol]() {
|
|
700
806
|
return random(this);
|
|
701
807
|
},
|
|
702
808
|
pipe() {
|
|
@@ -704,14 +810,12 @@ const EffectPrototype = {
|
|
|
704
810
|
}
|
|
705
811
|
};
|
|
706
812
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
const TypeId = /*#__PURE__*/Symbol.for("effect/Option");
|
|
711
|
-
const CommonProto = {
|
|
813
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/internal/option.js
|
|
814
|
+
var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
815
|
+
var CommonProto = {
|
|
712
816
|
...EffectPrototype,
|
|
713
817
|
[TypeId]: {
|
|
714
|
-
_A:
|
|
818
|
+
_A: (_2) => _2
|
|
715
819
|
},
|
|
716
820
|
[NodeInspectSymbol]() {
|
|
717
821
|
return this.toJSON();
|
|
@@ -720,13 +824,13 @@ const CommonProto = {
|
|
|
720
824
|
return format(this.toJSON());
|
|
721
825
|
}
|
|
722
826
|
};
|
|
723
|
-
|
|
827
|
+
var SomeProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {
|
|
724
828
|
_tag: "Some",
|
|
725
829
|
_op: "Some",
|
|
726
|
-
[
|
|
727
|
-
return isOption(that) && isSome
|
|
830
|
+
[symbol2](that) {
|
|
831
|
+
return isOption(that) && isSome(that) && equals(that.value, this.value);
|
|
728
832
|
},
|
|
729
|
-
[symbol
|
|
833
|
+
[symbol]() {
|
|
730
834
|
return combine(hash(this._tag))(hash(this.value));
|
|
731
835
|
},
|
|
732
836
|
toJSON() {
|
|
@@ -737,13 +841,13 @@ const SomeProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonP
|
|
|
737
841
|
};
|
|
738
842
|
}
|
|
739
843
|
});
|
|
740
|
-
|
|
844
|
+
var NoneProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {
|
|
741
845
|
_tag: "None",
|
|
742
846
|
_op: "None",
|
|
743
|
-
[
|
|
744
|
-
return isOption(that) && isNone
|
|
847
|
+
[symbol2](that) {
|
|
848
|
+
return isOption(that) && isNone(that);
|
|
745
849
|
},
|
|
746
|
-
[symbol
|
|
850
|
+
[symbol]() {
|
|
747
851
|
return combine(hash(this._tag));
|
|
748
852
|
},
|
|
749
853
|
toJSON() {
|
|
@@ -753,865 +857,899 @@ const NoneProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonP
|
|
|
753
857
|
};
|
|
754
858
|
}
|
|
755
859
|
});
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
const
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
/** @internal */
|
|
765
|
-
const some$1 = value => {
|
|
766
|
-
const a = Object.create(SomeProto);
|
|
767
|
-
a.value = value;
|
|
768
|
-
return a;
|
|
860
|
+
var isOption = (input) => hasProperty(input, TypeId);
|
|
861
|
+
var isNone = (fa) => fa._tag === "None";
|
|
862
|
+
var isSome = (fa) => fa._tag === "Some";
|
|
863
|
+
var none = /* @__PURE__ */ Object.create(NoneProto);
|
|
864
|
+
var some2 = (value) => {
|
|
865
|
+
const a2 = Object.create(SomeProto);
|
|
866
|
+
a2.value = value;
|
|
867
|
+
return a2;
|
|
769
868
|
};
|
|
770
869
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
*/
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
/**
|
|
835
|
-
* Returns the provided `Option` `that` if `self` is `None`, otherwise returns `self`.
|
|
836
|
-
*
|
|
837
|
-
* @param self - The first `Option` to be checked.
|
|
838
|
-
* @param that - The `Option` to return if `self` is `None`.
|
|
839
|
-
*
|
|
840
|
-
* @example
|
|
841
|
-
* import * as O from "effect/Option"
|
|
842
|
-
* import { pipe } from "effect/Function"
|
|
843
|
-
*
|
|
844
|
-
* assert.deepStrictEqual(
|
|
845
|
-
* pipe(
|
|
846
|
-
* O.none(),
|
|
847
|
-
* O.orElse(() => O.none())
|
|
848
|
-
* ),
|
|
849
|
-
* O.none()
|
|
850
|
-
* )
|
|
851
|
-
* assert.deepStrictEqual(
|
|
852
|
-
* pipe(
|
|
853
|
-
* O.some('a'),
|
|
854
|
-
* O.orElse(() => O.none())
|
|
855
|
-
* ),
|
|
856
|
-
* O.some('a')
|
|
857
|
-
* )
|
|
858
|
-
* assert.deepStrictEqual(
|
|
859
|
-
* pipe(
|
|
860
|
-
* O.none(),
|
|
861
|
-
* O.orElse(() => O.some('b'))
|
|
862
|
-
* ),
|
|
863
|
-
* O.some('b')
|
|
864
|
-
* )
|
|
865
|
-
* assert.deepStrictEqual(
|
|
866
|
-
* pipe(
|
|
867
|
-
* O.some('a'),
|
|
868
|
-
* O.orElse(() => O.some('b'))
|
|
869
|
-
* ),
|
|
870
|
-
* O.some('a')
|
|
871
|
-
* )
|
|
872
|
-
*
|
|
873
|
-
* @category error handling
|
|
874
|
-
* @since 2.0.0
|
|
875
|
-
*/
|
|
876
|
-
const orElse = /*#__PURE__*/dual(2, (self, that) => isNone(self) ? that() : self);
|
|
877
|
-
/**
|
|
878
|
-
* Constructs a new `Option` from a nullable type. If the value is `null` or `undefined`, returns `None`, otherwise
|
|
879
|
-
* returns the value wrapped in a `Some`.
|
|
880
|
-
*
|
|
881
|
-
* @param nullableValue - The nullable value to be converted to an `Option`.
|
|
882
|
-
*
|
|
883
|
-
* @example
|
|
884
|
-
* import * as O from "effect/Option"
|
|
885
|
-
*
|
|
886
|
-
* assert.deepStrictEqual(O.fromNullable(undefined), O.none())
|
|
887
|
-
* assert.deepStrictEqual(O.fromNullable(null), O.none())
|
|
888
|
-
* assert.deepStrictEqual(O.fromNullable(1), O.some(1))
|
|
889
|
-
*
|
|
890
|
-
* @category conversions
|
|
891
|
-
* @since 2.0.0
|
|
892
|
-
*/
|
|
893
|
-
const fromNullable = nullableValue => nullableValue == null ? none() : some(nullableValue);
|
|
894
|
-
/**
|
|
895
|
-
* Maps the `Some` side of an `Option` value to a new `Option` value.
|
|
896
|
-
*
|
|
897
|
-
* @param self - An `Option` to map
|
|
898
|
-
* @param f - The function to map over the value of the `Option`
|
|
899
|
-
*
|
|
900
|
-
* @category mapping
|
|
901
|
-
* @since 2.0.0
|
|
902
|
-
*/
|
|
903
|
-
const map = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : some(f(self.value)));
|
|
904
|
-
/**
|
|
905
|
-
* Applies a function to the value of an `Option` and flattens the result, if the input is `Some`.
|
|
906
|
-
*
|
|
907
|
-
* @category sequencing
|
|
908
|
-
* @since 2.0.0
|
|
909
|
-
*/
|
|
910
|
-
const flatMap = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : f(self.value));
|
|
911
|
-
/**
|
|
912
|
-
* This is `flatMap` + `fromNullable`, useful when working with optional values.
|
|
913
|
-
*
|
|
914
|
-
* @example
|
|
915
|
-
* import { some, none, flatMapNullable } from 'effect/Option'
|
|
916
|
-
* import { pipe } from "effect/Function"
|
|
917
|
-
*
|
|
918
|
-
* interface Employee {
|
|
919
|
-
* company?: {
|
|
920
|
-
* address?: {
|
|
921
|
-
* street?: {
|
|
922
|
-
* name?: string
|
|
923
|
-
* }
|
|
924
|
-
* }
|
|
925
|
-
* }
|
|
926
|
-
* }
|
|
927
|
-
*
|
|
928
|
-
* const employee1: Employee = { company: { address: { street: { name: 'high street' } } } }
|
|
929
|
-
*
|
|
930
|
-
* assert.deepStrictEqual(
|
|
931
|
-
* pipe(
|
|
932
|
-
* some(employee1),
|
|
933
|
-
* flatMapNullable(employee => employee.company?.address?.street?.name),
|
|
934
|
-
* ),
|
|
935
|
-
* some('high street')
|
|
936
|
-
* )
|
|
937
|
-
*
|
|
938
|
-
* const employee2: Employee = { company: { address: { street: {} } } }
|
|
939
|
-
*
|
|
940
|
-
* assert.deepStrictEqual(
|
|
941
|
-
* pipe(
|
|
942
|
-
* some(employee2),
|
|
943
|
-
* flatMapNullable(employee => employee.company?.address?.street?.name),
|
|
944
|
-
* ),
|
|
945
|
-
* none()
|
|
946
|
-
* )
|
|
947
|
-
*
|
|
948
|
-
* @category sequencing
|
|
949
|
-
* @since 2.0.0
|
|
950
|
-
*/
|
|
951
|
-
const flatMapNullable = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : fromNullable(f(self.value)));
|
|
952
|
-
/**
|
|
953
|
-
* @category combining
|
|
954
|
-
* @since 2.0.0
|
|
955
|
-
*/
|
|
956
|
-
const product = (self, that) => isSome(self) && isSome(that) ? some([self.value, that.value]) : none();
|
|
957
|
-
/**
|
|
958
|
-
* Zips two `Option` values together using a provided function, returning a new `Option` of the result.
|
|
959
|
-
*
|
|
960
|
-
* @param self - The left-hand side of the zip operation
|
|
961
|
-
* @param that - The right-hand side of the zip operation
|
|
962
|
-
* @param f - The function used to combine the values of the two `Option`s
|
|
963
|
-
*
|
|
964
|
-
* @example
|
|
965
|
-
* import * as O from "effect/Option"
|
|
966
|
-
*
|
|
967
|
-
* type Complex = [real: number, imaginary: number]
|
|
968
|
-
*
|
|
969
|
-
* const complex = (real: number, imaginary: number): Complex => [real, imaginary]
|
|
970
|
-
*
|
|
971
|
-
* assert.deepStrictEqual(O.zipWith(O.none(), O.none(), complex), O.none())
|
|
972
|
-
* assert.deepStrictEqual(O.zipWith(O.some(1), O.none(), complex), O.none())
|
|
973
|
-
* assert.deepStrictEqual(O.zipWith(O.none(), O.some(1), complex), O.none())
|
|
974
|
-
* assert.deepStrictEqual(O.zipWith(O.some(1), O.some(2), complex), O.some([1, 2]))
|
|
975
|
-
*
|
|
976
|
-
* assert.deepStrictEqual(O.zipWith(O.some(1), complex)(O.some(2)), O.some([2, 1]))
|
|
977
|
-
*
|
|
978
|
-
* @category zipping
|
|
979
|
-
* @since 2.0.0
|
|
980
|
-
*/
|
|
981
|
-
const zipWith = /*#__PURE__*/dual(3, (self, that, f) => map(product(self, that), ([a, b]) => f(a, b)));
|
|
982
|
-
/**
|
|
983
|
-
* Maps over the value of an `Option` and filters out `None`s.
|
|
984
|
-
*
|
|
985
|
-
* Useful when in addition to filtering you also want to change the type of the `Option`.
|
|
986
|
-
*
|
|
987
|
-
* @param self - The `Option` to map over.
|
|
988
|
-
* @param f - A function to apply to the value of the `Option`.
|
|
989
|
-
*
|
|
990
|
-
* @example
|
|
991
|
-
* import * as O from "effect/Option"
|
|
992
|
-
*
|
|
993
|
-
* const evenNumber = (n: number) => n % 2 === 0 ? O.some(n) : O.none()
|
|
994
|
-
*
|
|
995
|
-
* assert.deepStrictEqual(O.filterMap(O.none(), evenNumber), O.none())
|
|
996
|
-
* assert.deepStrictEqual(O.filterMap(O.some(3), evenNumber), O.none())
|
|
997
|
-
* assert.deepStrictEqual(O.filterMap(O.some(2), evenNumber), O.some(2))
|
|
998
|
-
*
|
|
999
|
-
* @category filtering
|
|
1000
|
-
* @since 2.0.0
|
|
1001
|
-
*/
|
|
1002
|
-
const filterMap = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : f(self.value));
|
|
1003
|
-
/**
|
|
1004
|
-
* Filters an `Option` using a predicate. If the predicate is not satisfied or the `Option` is `None` returns `None`.
|
|
1005
|
-
*
|
|
1006
|
-
* If you need to change the type of the `Option` in addition to filtering, see `filterMap`.
|
|
1007
|
-
*
|
|
1008
|
-
* @param predicate - A predicate function to apply to the `Option` value.
|
|
1009
|
-
* @param fb - The `Option` to filter.
|
|
1010
|
-
*
|
|
1011
|
-
* @example
|
|
1012
|
-
* import * as O from "effect/Option"
|
|
1013
|
-
*
|
|
1014
|
-
* // predicate
|
|
1015
|
-
* const isEven = (n: number) => n % 2 === 0
|
|
1016
|
-
*
|
|
1017
|
-
* assert.deepStrictEqual(O.filter(O.none(), isEven), O.none())
|
|
1018
|
-
* assert.deepStrictEqual(O.filter(O.some(3), isEven), O.none())
|
|
1019
|
-
* assert.deepStrictEqual(O.filter(O.some(2), isEven), O.some(2))
|
|
1020
|
-
*
|
|
1021
|
-
* // refinement
|
|
1022
|
-
* const isNumber = (v: unknown): v is number => typeof v === "number"
|
|
1023
|
-
*
|
|
1024
|
-
* assert.deepStrictEqual(O.filter(O.none(), isNumber), O.none())
|
|
1025
|
-
* assert.deepStrictEqual(O.filter(O.some('hello'), isNumber), O.none())
|
|
1026
|
-
* assert.deepStrictEqual(O.filter(O.some(2), isNumber), O.some(2))
|
|
1027
|
-
*
|
|
1028
|
-
* @category filtering
|
|
1029
|
-
* @since 2.0.0
|
|
1030
|
-
*/
|
|
1031
|
-
const filter = /*#__PURE__*/dual(2, (self, predicate) => filterMap(self, b => predicate(b) ? some$1(b) : none$1));
|
|
1032
|
-
/**
|
|
1033
|
-
* Transforms a `Predicate` function into a `Some` of the input value if the predicate returns `true` or `None`
|
|
1034
|
-
* if the predicate returns `false`.
|
|
1035
|
-
*
|
|
1036
|
-
* @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean.
|
|
1037
|
-
*
|
|
1038
|
-
* @example
|
|
1039
|
-
* import * as O from "effect/Option"
|
|
1040
|
-
*
|
|
1041
|
-
* const getOption = O.liftPredicate((n: number) => n >= 0)
|
|
1042
|
-
*
|
|
1043
|
-
* assert.deepStrictEqual(getOption(-1), O.none())
|
|
1044
|
-
* assert.deepStrictEqual(getOption(1), O.some(1))
|
|
1045
|
-
*
|
|
1046
|
-
* @category lifting
|
|
1047
|
-
* @since 2.0.0
|
|
1048
|
-
*/
|
|
1049
|
-
const liftPredicate = predicate => b => predicate(b) ? some(b) : none();
|
|
1050
|
-
/**
|
|
1051
|
-
* Check if a value in an `Option` type meets a certain predicate.
|
|
1052
|
-
*
|
|
1053
|
-
* @param self - The `Option` to check.
|
|
1054
|
-
* @param predicate - The condition to check.
|
|
1055
|
-
*
|
|
1056
|
-
* @example
|
|
1057
|
-
* import { some, none, exists } from 'effect/Option'
|
|
1058
|
-
* import { pipe } from "effect/Function"
|
|
1059
|
-
*
|
|
1060
|
-
* const isEven = (n: number) => n % 2 === 0
|
|
1061
|
-
*
|
|
1062
|
-
* assert.deepStrictEqual(pipe(some(2), exists(isEven)), true)
|
|
1063
|
-
* assert.deepStrictEqual(pipe(some(1), exists(isEven)), false)
|
|
1064
|
-
* assert.deepStrictEqual(pipe(none(), exists(isEven)), false)
|
|
1065
|
-
*
|
|
1066
|
-
* @since 2.0.0
|
|
1067
|
-
*/
|
|
1068
|
-
const exists = /*#__PURE__*/dual(2, (self, refinement) => isNone(self) ? false : refinement(self.value));
|
|
870
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/internal/either.js
|
|
871
|
+
var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
|
|
872
|
+
var CommonProto2 = {
|
|
873
|
+
...EffectPrototype,
|
|
874
|
+
[TypeId2]: {
|
|
875
|
+
_A: (_2) => _2
|
|
876
|
+
},
|
|
877
|
+
[NodeInspectSymbol]() {
|
|
878
|
+
return this.toJSON();
|
|
879
|
+
},
|
|
880
|
+
toString() {
|
|
881
|
+
return format(this.toJSON());
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
var RightProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
|
|
885
|
+
_tag: "Right",
|
|
886
|
+
_op: "Right",
|
|
887
|
+
[symbol2](that) {
|
|
888
|
+
return isEither(that) && isRight(that) && equals(that.right, this.right);
|
|
889
|
+
},
|
|
890
|
+
[symbol]() {
|
|
891
|
+
return combine(hash(this._tag))(hash(this.right));
|
|
892
|
+
},
|
|
893
|
+
toJSON() {
|
|
894
|
+
return {
|
|
895
|
+
_id: "Either",
|
|
896
|
+
_tag: this._tag,
|
|
897
|
+
right: toJSON(this.right)
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
var LeftProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
|
|
902
|
+
_tag: "Left",
|
|
903
|
+
_op: "Left",
|
|
904
|
+
[symbol2](that) {
|
|
905
|
+
return isEither(that) && isLeft(that) && equals(that.left, this.left);
|
|
906
|
+
},
|
|
907
|
+
[symbol]() {
|
|
908
|
+
return combine(hash(this._tag))(hash(this.left));
|
|
909
|
+
},
|
|
910
|
+
toJSON() {
|
|
911
|
+
return {
|
|
912
|
+
_id: "Either",
|
|
913
|
+
_tag: this._tag,
|
|
914
|
+
left: toJSON(this.left)
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
var isEither = (input) => hasProperty(input, TypeId2);
|
|
919
|
+
var isLeft = (ma) => ma._tag === "Left";
|
|
920
|
+
var isRight = (ma) => ma._tag === "Right";
|
|
921
|
+
var left = (left2) => {
|
|
922
|
+
const a2 = Object.create(LeftProto);
|
|
923
|
+
a2.left = left2;
|
|
924
|
+
return a2;
|
|
925
|
+
};
|
|
926
|
+
var right = (right2) => {
|
|
927
|
+
const a2 = Object.create(RightProto);
|
|
928
|
+
a2.right = right2;
|
|
929
|
+
return a2;
|
|
930
|
+
};
|
|
931
|
+
var getLeft = (self) => isRight(self) ? none : some2(self.left);
|
|
932
|
+
var getRight = (self) => isLeft(self) ? none : some2(self.right);
|
|
1069
933
|
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
*
|
|
1073
|
-
* @see https://github.com/oven-sh/bun/issues/3333
|
|
1074
|
-
*/
|
|
1075
|
-
/** @internal */
|
|
1076
|
-
typeof process === "undefined" ? false : !!process?.isBun;
|
|
934
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Order.js
|
|
935
|
+
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
1077
936
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
937
|
+
// ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Option.js
|
|
938
|
+
var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
939
|
+
var none2 = () => none;
|
|
940
|
+
var some3 = some2;
|
|
941
|
+
var isOption2 = isOption;
|
|
942
|
+
var isNone2 = isNone;
|
|
943
|
+
var isSome2 = isSome;
|
|
944
|
+
var match = /* @__PURE__ */ dual(2, (self, {
|
|
945
|
+
onNone,
|
|
946
|
+
onSome
|
|
947
|
+
}) => isNone2(self) ? onNone() : onSome(self.value));
|
|
948
|
+
var toRefinement = (f2) => (a2) => isSome2(f2(a2));
|
|
949
|
+
var fromIterable = (collection) => {
|
|
950
|
+
for (const a2 of collection) {
|
|
951
|
+
return some3(a2);
|
|
952
|
+
}
|
|
953
|
+
return none2();
|
|
954
|
+
};
|
|
955
|
+
var getRight2 = getRight;
|
|
956
|
+
var getLeft2 = getLeft;
|
|
957
|
+
var getOrElse = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
|
|
958
|
+
var orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
|
|
959
|
+
var orElseSome = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? some3(onNone()) : self);
|
|
960
|
+
var orElseEither = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? map(that(), right) : map(self, left));
|
|
961
|
+
var firstSomeOf = (collection) => {
|
|
962
|
+
let out = none2();
|
|
963
|
+
for (out of collection) {
|
|
964
|
+
if (isSome2(out)) {
|
|
965
|
+
return out;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
return out;
|
|
969
|
+
};
|
|
970
|
+
var fromNullable = (nullableValue) => nullableValue == null ? none2() : some3(nullableValue);
|
|
971
|
+
var liftNullable = (f2) => (...a2) => fromNullable(f2(...a2));
|
|
972
|
+
var getOrNull = /* @__PURE__ */ getOrElse(constNull);
|
|
973
|
+
var getOrUndefined = /* @__PURE__ */ getOrElse(constUndefined);
|
|
974
|
+
var liftThrowable = (f2) => (...a2) => {
|
|
975
|
+
try {
|
|
976
|
+
return some3(f2(...a2));
|
|
977
|
+
} catch (e2) {
|
|
978
|
+
return none2();
|
|
979
|
+
}
|
|
980
|
+
};
|
|
981
|
+
var getOrThrowWith = /* @__PURE__ */ dual(2, (self, onNone) => {
|
|
982
|
+
if (isSome2(self)) {
|
|
983
|
+
return self.value;
|
|
984
|
+
}
|
|
985
|
+
throw onNone();
|
|
986
|
+
});
|
|
987
|
+
var getOrThrow = /* @__PURE__ */ getOrThrowWith(() => new Error("getOrThrow called on a None"));
|
|
988
|
+
var map = /* @__PURE__ */ dual(2, (self, f2) => isNone2(self) ? none2() : some3(f2(self.value)));
|
|
989
|
+
var as = /* @__PURE__ */ dual(2, (self, b2) => map(self, () => b2));
|
|
990
|
+
var asUnit = /* @__PURE__ */ as(void 0);
|
|
991
|
+
var unit = /* @__PURE__ */ some3(void 0);
|
|
992
|
+
var flatMap = /* @__PURE__ */ dual(2, (self, f2) => isNone2(self) ? none2() : f2(self.value));
|
|
993
|
+
var andThen = /* @__PURE__ */ dual(2, (self, f2) => isFunction(f2) ? flatMap(self, f2) : flatMap(self, () => f2));
|
|
994
|
+
var flatMapNullable = /* @__PURE__ */ dual(2, (self, f2) => isNone2(self) ? none2() : fromNullable(f2(self.value)));
|
|
995
|
+
var flatten = /* @__PURE__ */ flatMap(identity);
|
|
996
|
+
var zipRight = /* @__PURE__ */ dual(2, (self, that) => flatMap(self, () => that));
|
|
997
|
+
var composeK = /* @__PURE__ */ dual(2, (afb, bfc) => (a2) => flatMap(afb(a2), bfc));
|
|
998
|
+
var zipLeft = /* @__PURE__ */ dual(2, (self, that) => tap(self, () => that));
|
|
999
|
+
var tap = /* @__PURE__ */ dual(2, (self, f2) => flatMap(self, (a2) => map(f2(a2), () => a2)));
|
|
1000
|
+
var product2 = (self, that) => isSome2(self) && isSome2(that) ? some3([self.value, that.value]) : none2();
|
|
1001
|
+
var productMany2 = (self, collection) => {
|
|
1002
|
+
if (isNone2(self)) {
|
|
1003
|
+
return none2();
|
|
1004
|
+
}
|
|
1005
|
+
const out = [self.value];
|
|
1006
|
+
for (const o2 of collection) {
|
|
1007
|
+
if (isNone2(o2)) {
|
|
1008
|
+
return none2();
|
|
1009
|
+
}
|
|
1010
|
+
out.push(o2.value);
|
|
1011
|
+
}
|
|
1012
|
+
return some3(out);
|
|
1013
|
+
};
|
|
1014
|
+
var all2 = (input) => {
|
|
1015
|
+
if (Symbol.iterator in input) {
|
|
1016
|
+
const out2 = [];
|
|
1017
|
+
for (const o2 of input) {
|
|
1018
|
+
if (isNone2(o2)) {
|
|
1019
|
+
return none2();
|
|
1020
|
+
}
|
|
1021
|
+
out2.push(o2.value);
|
|
1022
|
+
}
|
|
1023
|
+
return some3(out2);
|
|
1024
|
+
}
|
|
1025
|
+
const out = {};
|
|
1026
|
+
for (const key of Object.keys(input)) {
|
|
1027
|
+
const o2 = input[key];
|
|
1028
|
+
if (isNone2(o2)) {
|
|
1029
|
+
return none2();
|
|
1030
|
+
}
|
|
1031
|
+
out[key] = o2.value;
|
|
1032
|
+
}
|
|
1033
|
+
return some3(out);
|
|
1034
|
+
};
|
|
1035
|
+
var zipWith = /* @__PURE__ */ dual(3, (self, that, f2) => map(product2(self, that), ([a2, b2]) => f2(a2, b2)));
|
|
1036
|
+
var ap = /* @__PURE__ */ dual(2, (self, that) => zipWith(self, that, (f2, a2) => f2(a2)));
|
|
1037
|
+
var reduceCompact = /* @__PURE__ */ dual(3, (self, b2, f2) => {
|
|
1038
|
+
let out = b2;
|
|
1039
|
+
for (const oa of self) {
|
|
1040
|
+
if (isSome2(oa)) {
|
|
1041
|
+
out = f2(out, oa.value);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
return out;
|
|
1045
|
+
});
|
|
1046
|
+
var toArray = (self) => isNone2(self) ? [] : [self.value];
|
|
1047
|
+
var partitionMap = /* @__PURE__ */ dual(2, (self, f2) => {
|
|
1048
|
+
if (isNone2(self)) {
|
|
1049
|
+
return [none2(), none2()];
|
|
1050
|
+
}
|
|
1051
|
+
const e2 = f2(self.value);
|
|
1052
|
+
return isLeft(e2) ? [some3(e2.left), none2()] : [none2(), some3(e2.right)];
|
|
1053
|
+
});
|
|
1054
|
+
var filterMap = /* @__PURE__ */ dual(2, (self, f2) => isNone2(self) ? none2() : f2(self.value));
|
|
1055
|
+
var filter = /* @__PURE__ */ dual(2, (self, predicate) => filterMap(self, (b2) => predicate(b2) ? some2(b2) : none));
|
|
1056
|
+
var getEquivalence = (isEquivalent) => make((x2, y2) => x2 === y2 || (isNone2(x2) ? isNone2(y2) : isNone2(y2) ? false : isEquivalent(x2.value, y2.value)));
|
|
1057
|
+
var getOrder = (O2) => make2((self, that) => isSome2(self) ? isSome2(that) ? O2(self.value, that.value) : 1 : -1);
|
|
1058
|
+
var lift2 = (f2) => dual(2, (self, that) => zipWith(self, that, f2));
|
|
1059
|
+
var liftPredicate = (predicate) => (b2) => predicate(b2) ? some3(b2) : none2();
|
|
1060
|
+
var containsWith = (isEquivalent) => dual(2, (self, a2) => isNone2(self) ? false : isEquivalent(self.value, a2));
|
|
1061
|
+
var _equivalence = /* @__PURE__ */ equivalence();
|
|
1062
|
+
var contains = /* @__PURE__ */ containsWith(_equivalence);
|
|
1063
|
+
var exists = /* @__PURE__ */ dual(2, (self, refinement) => isNone2(self) ? false : refinement(self.value));
|
|
1064
|
+
var bindTo = /* @__PURE__ */ dual(2, (self, name) => map(self, (a2) => ({
|
|
1065
|
+
[name]: a2
|
|
1066
|
+
})));
|
|
1067
|
+
var let_ = /* @__PURE__ */ dual(3, (self, name, f2) => map(self, (a2) => Object.assign({}, a2, {
|
|
1068
|
+
[name]: f2(a2)
|
|
1069
|
+
})));
|
|
1070
|
+
var bind = /* @__PURE__ */ dual(3, (self, name, f2) => flatMap(self, (a2) => map(f2(a2), (b2) => Object.assign({}, a2, {
|
|
1071
|
+
[name]: b2
|
|
1072
|
+
}))));
|
|
1073
|
+
var Do = /* @__PURE__ */ some3({});
|
|
1074
|
+
var adapter2 = /* @__PURE__ */ adapter();
|
|
1075
|
+
var gen = (f2) => {
|
|
1076
|
+
const iterator = f2(adapter2);
|
|
1077
|
+
let state = iterator.next();
|
|
1078
|
+
if (state.done) {
|
|
1079
|
+
return some3(state.value);
|
|
1080
|
+
} else {
|
|
1081
|
+
let current = state.value.value;
|
|
1082
|
+
if (isNone2(current)) {
|
|
1083
|
+
return current;
|
|
1084
|
+
}
|
|
1085
|
+
while (!state.done) {
|
|
1086
|
+
state = iterator.next(current.value);
|
|
1087
|
+
if (!state.done) {
|
|
1088
|
+
current = state.value.value;
|
|
1089
|
+
if (isNone2(current)) {
|
|
1090
|
+
return current;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
return some3(state.value);
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
var RE_JSX_ANNOTATION_REGEX = /@jsx\s+(\S+)/u;
|
|
1098
|
+
var RE_JS_IDENTIFIER_REGEX = /^[$A-Z_a-z][\w$]*$/u;
|
|
1081
1099
|
function getFragmentFromContext(context) {
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
return
|
|
1100
|
+
const settings = shared.parseSchema(shared.ESLintSettingsSchema, context.settings);
|
|
1101
|
+
const fragment = settings.reactOptions?.jsxPragmaFrag;
|
|
1102
|
+
if (Predicate_exports.isString(fragment) && RE_JS_IDENTIFIER_REGEX.test(fragment))
|
|
1103
|
+
return fragment;
|
|
1104
|
+
return "Fragment";
|
|
1086
1105
|
}
|
|
1087
|
-
|
|
1106
|
+
var getPragmaFromContext = memo__default.default(
|
|
1107
|
+
(context) => {
|
|
1088
1108
|
const settings = shared.parseSchema(shared.ESLintSettingsSchema, context.settings);
|
|
1089
1109
|
const pragma = settings.reactOptions?.jsxPragma;
|
|
1090
1110
|
const { sourceCode } = context;
|
|
1091
|
-
const pragmaNode = sourceCode.getAllComments().find((node)=>RE_JSX_ANNOTATION_REGEX.test(node.value));
|
|
1092
|
-
return pipe(
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1111
|
+
const pragmaNode = sourceCode.getAllComments().find((node) => RE_JSX_ANNOTATION_REGEX.test(node.value));
|
|
1112
|
+
return Function_exports.pipe(
|
|
1113
|
+
Option_exports.orElse(Option_exports.fromNullable(pragma), () => Function_exports.pipe(
|
|
1114
|
+
Option_exports.fromNullable(pragmaNode),
|
|
1115
|
+
Option_exports.map(({ value }) => RE_JSX_ANNOTATION_REGEX.exec(value)),
|
|
1116
|
+
Option_exports.flatMapNullable((matches) => matches?.[1]?.split(".")[0])
|
|
1117
|
+
)),
|
|
1118
|
+
Option_exports.flatMap(Option_exports.liftPredicate((x2) => RE_JS_IDENTIFIER_REGEX.test(x2))),
|
|
1119
|
+
Option_exports.getOrElse(Function_exports.constant("React"))
|
|
1120
|
+
);
|
|
1121
|
+
}
|
|
1122
|
+
);
|
|
1096
1123
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
type: ast.NodeType.CallExpression,
|
|
1129
|
-
callee: {
|
|
1130
|
-
type: ast.NodeType.Identifier,
|
|
1131
|
-
name: "require"
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
}, ({ object })=>some(object)).otherwise(none);
|
|
1135
|
-
if (isNone(maybeRequireExpression)) return false;
|
|
1136
|
-
const requireExpression = maybeRequireExpression.value;
|
|
1137
|
-
const [firstArg] = requireExpression.arguments;
|
|
1138
|
-
if (firstArg?.type !== ast.NodeType.Literal) return false;
|
|
1139
|
-
return firstArg.value === pragma.toLowerCase();
|
|
1124
|
+
// ../../../node_modules/.pnpm/ts-pattern@5.0.6/node_modules/ts-pattern/dist/index.js
|
|
1125
|
+
var t = Symbol.for("@ts-pattern/matcher");
|
|
1126
|
+
var e = Symbol.for("@ts-pattern/isVariadic");
|
|
1127
|
+
var n = "@ts-pattern/anonymous-select-key";
|
|
1128
|
+
var r = (t2) => Boolean(t2 && "object" == typeof t2);
|
|
1129
|
+
var i = (e2) => e2 && !!e2[t];
|
|
1130
|
+
var s = (n2, o2, c2) => {
|
|
1131
|
+
if (i(n2)) {
|
|
1132
|
+
const e2 = n2[t](), { matched: r2, selections: i2 } = e2.match(o2);
|
|
1133
|
+
return r2 && i2 && Object.keys(i2).forEach((t2) => c2(t2, i2[t2])), r2;
|
|
1134
|
+
}
|
|
1135
|
+
if (r(n2)) {
|
|
1136
|
+
if (!r(o2))
|
|
1137
|
+
return false;
|
|
1138
|
+
if (Array.isArray(n2)) {
|
|
1139
|
+
if (!Array.isArray(o2))
|
|
1140
|
+
return false;
|
|
1141
|
+
let t2 = [], r2 = [], a2 = [];
|
|
1142
|
+
for (const s2 of n2.keys()) {
|
|
1143
|
+
const o3 = n2[s2];
|
|
1144
|
+
i(o3) && o3[e] ? a2.push(o3) : a2.length ? r2.push(o3) : t2.push(o3);
|
|
1145
|
+
}
|
|
1146
|
+
if (a2.length) {
|
|
1147
|
+
if (a2.length > 1)
|
|
1148
|
+
throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
|
|
1149
|
+
if (o2.length < t2.length + r2.length)
|
|
1150
|
+
return false;
|
|
1151
|
+
const e2 = o2.slice(0, t2.length), n3 = 0 === r2.length ? [] : o2.slice(-r2.length), i2 = o2.slice(t2.length, 0 === r2.length ? Infinity : -r2.length);
|
|
1152
|
+
return t2.every((t3, n4) => s(t3, e2[n4], c2)) && r2.every((t3, e3) => s(t3, n3[e3], c2)) && (0 === a2.length || s(a2[0], i2, c2));
|
|
1153
|
+
}
|
|
1154
|
+
return n2.length === o2.length && n2.every((t3, e2) => s(t3, o2[e2], c2));
|
|
1140
1155
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
}
|
|
1156
|
+
return Object.keys(n2).every((e2) => {
|
|
1157
|
+
const r2 = n2[e2];
|
|
1158
|
+
return (e2 in o2 || i(a2 = r2) && "optional" === a2[t]().matcherType) && s(r2, o2[e2], c2);
|
|
1159
|
+
var a2;
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
return Object.is(o2, n2);
|
|
1163
|
+
};
|
|
1164
|
+
var o = (e2) => {
|
|
1165
|
+
var n2, s2, a2;
|
|
1166
|
+
return r(e2) ? i(e2) ? null != (n2 = null == (s2 = (a2 = e2[t]()).getSelectionKeys) ? void 0 : s2.call(a2)) ? n2 : [] : Array.isArray(e2) ? c(e2, o) : c(Object.values(e2), o) : [];
|
|
1167
|
+
};
|
|
1168
|
+
var c = (t2, e2) => t2.reduce((t3, n2) => t3.concat(e2(n2)), []);
|
|
1169
|
+
function a(...t2) {
|
|
1170
|
+
if (1 === t2.length) {
|
|
1171
|
+
const [e2] = t2;
|
|
1172
|
+
return (t3) => s(e2, t3, () => {
|
|
1159
1173
|
});
|
|
1160
|
-
|
|
1174
|
+
}
|
|
1175
|
+
if (2 === t2.length) {
|
|
1176
|
+
const [e2, n2] = t2;
|
|
1177
|
+
return s(e2, n2, () => {
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t2.length}.`);
|
|
1161
1181
|
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1182
|
+
function u(t2) {
|
|
1183
|
+
return Object.assign(t2, { optional: () => l(t2), and: (e2) => m(t2, e2), or: (e2) => y(t2, e2), select: (e2) => void 0 === e2 ? p(t2) : p(e2, t2) });
|
|
1184
|
+
}
|
|
1185
|
+
function h(t2) {
|
|
1186
|
+
return Object.assign(((t3) => Object.assign(t3, { *[Symbol.iterator]() {
|
|
1187
|
+
yield Object.assign(t3, { [e]: true });
|
|
1188
|
+
} }))(t2), { optional: () => h(l(t2)), select: (e2) => h(void 0 === e2 ? p(t2) : p(e2, t2)) });
|
|
1189
|
+
}
|
|
1190
|
+
function l(e2) {
|
|
1191
|
+
return u({ [t]: () => ({ match: (t2) => {
|
|
1192
|
+
let n2 = {};
|
|
1193
|
+
const r2 = (t3, e3) => {
|
|
1194
|
+
n2[t3] = e3;
|
|
1172
1195
|
};
|
|
1196
|
+
return void 0 === t2 ? (o(e2).forEach((t3) => r2(t3, void 0)), { matched: true, selections: n2 }) : { matched: s(e2, t2, r2), selections: n2 };
|
|
1197
|
+
}, getSelectionKeys: () => o(e2), matcherType: "optional" }) });
|
|
1173
1198
|
}
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1199
|
+
var f = (t2, e2) => {
|
|
1200
|
+
for (const n2 of t2)
|
|
1201
|
+
if (!e2(n2))
|
|
1202
|
+
return false;
|
|
1203
|
+
return true;
|
|
1204
|
+
};
|
|
1205
|
+
var g = (t2, e2) => {
|
|
1206
|
+
for (const [n2, r2] of t2.entries())
|
|
1207
|
+
if (!e2(r2, n2))
|
|
1208
|
+
return false;
|
|
1209
|
+
return true;
|
|
1210
|
+
};
|
|
1211
|
+
function m(...e2) {
|
|
1212
|
+
return u({ [t]: () => ({ match: (t2) => {
|
|
1213
|
+
let n2 = {};
|
|
1214
|
+
const r2 = (t3, e3) => {
|
|
1215
|
+
n2[t3] = e3;
|
|
1190
1216
|
};
|
|
1217
|
+
return { matched: e2.every((e3) => s(e3, t2, r2)), selections: n2 };
|
|
1218
|
+
}, getSelectionKeys: () => c(e2, o), matcherType: "and" }) });
|
|
1191
1219
|
}
|
|
1192
|
-
function
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
])(node.callee)) return false;
|
|
1198
|
-
return isFromPragma(name)(node.callee, context);
|
|
1220
|
+
function y(...e2) {
|
|
1221
|
+
return u({ [t]: () => ({ match: (t2) => {
|
|
1222
|
+
let n2 = {};
|
|
1223
|
+
const r2 = (t3, e3) => {
|
|
1224
|
+
n2[t3] = e3;
|
|
1199
1225
|
};
|
|
1226
|
+
return c(e2, o).forEach((t3) => r2(t3, void 0)), { matched: e2.some((e3) => s(e3, t2, r2)), selections: n2 };
|
|
1227
|
+
}, getSelectionKeys: () => c(e2, o), matcherType: "or" }) });
|
|
1200
1228
|
}
|
|
1201
|
-
function
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1229
|
+
function d(e2) {
|
|
1230
|
+
return { [t]: () => ({ match: (t2) => ({ matched: Boolean(e2(t2)) }) }) };
|
|
1231
|
+
}
|
|
1232
|
+
function p(...e2) {
|
|
1233
|
+
const r2 = "string" == typeof e2[0] ? e2[0] : void 0, i2 = 2 === e2.length ? e2[1] : "string" == typeof e2[0] ? void 0 : e2[0];
|
|
1234
|
+
return u({ [t]: () => ({ match: (t2) => {
|
|
1235
|
+
let e3 = { [null != r2 ? r2 : n]: t2 };
|
|
1236
|
+
return { matched: void 0 === i2 || s(i2, t2, (t3, n2) => {
|
|
1237
|
+
e3[t3] = n2;
|
|
1238
|
+
}), selections: e3 };
|
|
1239
|
+
}, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] : o(i2)) }) });
|
|
1240
|
+
}
|
|
1241
|
+
function v(t2) {
|
|
1242
|
+
return "number" == typeof t2;
|
|
1243
|
+
}
|
|
1244
|
+
function b(t2) {
|
|
1245
|
+
return "string" == typeof t2;
|
|
1246
|
+
}
|
|
1247
|
+
function w(t2) {
|
|
1248
|
+
return "bigint" == typeof t2;
|
|
1249
|
+
}
|
|
1250
|
+
var S = u(d(function(t2) {
|
|
1251
|
+
return true;
|
|
1252
|
+
}));
|
|
1253
|
+
var O = S;
|
|
1254
|
+
var j = (t2) => Object.assign(u(t2), { startsWith: (e2) => {
|
|
1255
|
+
return j(m(t2, (n2 = e2, d((t3) => b(t3) && t3.startsWith(n2)))));
|
|
1256
|
+
var n2;
|
|
1257
|
+
}, endsWith: (e2) => {
|
|
1258
|
+
return j(m(t2, (n2 = e2, d((t3) => b(t3) && t3.endsWith(n2)))));
|
|
1259
|
+
var n2;
|
|
1260
|
+
}, minLength: (e2) => j(m(t2, ((t3) => d((e3) => b(e3) && e3.length >= t3))(e2))), maxLength: (e2) => j(m(t2, ((t3) => d((e3) => b(e3) && e3.length <= t3))(e2))), includes: (e2) => {
|
|
1261
|
+
return j(m(t2, (n2 = e2, d((t3) => b(t3) && t3.includes(n2)))));
|
|
1262
|
+
var n2;
|
|
1263
|
+
}, regex: (e2) => {
|
|
1264
|
+
return j(m(t2, (n2 = e2, d((t3) => b(t3) && Boolean(t3.match(n2))))));
|
|
1265
|
+
var n2;
|
|
1266
|
+
} });
|
|
1267
|
+
var E = j(d(b));
|
|
1268
|
+
var K = (t2) => Object.assign(u(t2), { between: (e2, n2) => K(m(t2, ((t3, e3) => d((n3) => v(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => K(m(t2, ((t3) => d((e3) => v(e3) && e3 < t3))(e2))), gt: (e2) => K(m(t2, ((t3) => d((e3) => v(e3) && e3 > t3))(e2))), lte: (e2) => K(m(t2, ((t3) => d((e3) => v(e3) && e3 <= t3))(e2))), gte: (e2) => K(m(t2, ((t3) => d((e3) => v(e3) && e3 >= t3))(e2))), int: () => K(m(t2, d((t3) => v(t3) && Number.isInteger(t3)))), finite: () => K(m(t2, d((t3) => v(t3) && Number.isFinite(t3)))), positive: () => K(m(t2, d((t3) => v(t3) && t3 > 0))), negative: () => K(m(t2, d((t3) => v(t3) && t3 < 0))) });
|
|
1269
|
+
var A = K(d(v));
|
|
1270
|
+
var x = (t2) => Object.assign(u(t2), { between: (e2, n2) => x(m(t2, ((t3, e3) => d((n3) => w(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => x(m(t2, ((t3) => d((e3) => w(e3) && e3 < t3))(e2))), gt: (e2) => x(m(t2, ((t3) => d((e3) => w(e3) && e3 > t3))(e2))), lte: (e2) => x(m(t2, ((t3) => d((e3) => w(e3) && e3 <= t3))(e2))), gte: (e2) => x(m(t2, ((t3) => d((e3) => w(e3) && e3 >= t3))(e2))), positive: () => x(m(t2, d((t3) => w(t3) && t3 > 0))), negative: () => x(m(t2, d((t3) => w(t3) && t3 < 0))) });
|
|
1271
|
+
var P = x(d(w));
|
|
1272
|
+
var T = u(d(function(t2) {
|
|
1273
|
+
return "boolean" == typeof t2;
|
|
1274
|
+
}));
|
|
1275
|
+
var k = u(d(function(t2) {
|
|
1276
|
+
return "symbol" == typeof t2;
|
|
1277
|
+
}));
|
|
1278
|
+
var B = u(d(function(t2) {
|
|
1279
|
+
return null == t2;
|
|
1280
|
+
}));
|
|
1281
|
+
var _ = { __proto__: null, matcher: t, optional: l, array: function(...e2) {
|
|
1282
|
+
return h({ [t]: () => ({ match: (t2) => {
|
|
1283
|
+
if (!Array.isArray(t2))
|
|
1284
|
+
return { matched: false };
|
|
1285
|
+
if (0 === e2.length)
|
|
1286
|
+
return { matched: true };
|
|
1287
|
+
const n2 = e2[0];
|
|
1288
|
+
let r2 = {};
|
|
1289
|
+
if (0 === t2.length)
|
|
1290
|
+
return o(n2).forEach((t3) => {
|
|
1291
|
+
r2[t3] = [];
|
|
1292
|
+
}), { matched: true, selections: r2 };
|
|
1293
|
+
const i2 = (t3, e3) => {
|
|
1294
|
+
r2[t3] = (r2[t3] || []).concat([e3]);
|
|
1205
1295
|
};
|
|
1296
|
+
return { matched: t2.every((t3) => s(n2, t3, i2)), selections: r2 };
|
|
1297
|
+
}, getSelectionKeys: () => 0 === e2.length ? [] : o(e2[0]) }) });
|
|
1298
|
+
}, set: function(...e2) {
|
|
1299
|
+
return u({ [t]: () => ({ match: (t2) => {
|
|
1300
|
+
if (!(t2 instanceof Set))
|
|
1301
|
+
return { matched: false };
|
|
1302
|
+
let n2 = {};
|
|
1303
|
+
if (0 === t2.size)
|
|
1304
|
+
return { matched: true, selections: n2 };
|
|
1305
|
+
if (0 === e2.length)
|
|
1306
|
+
return { matched: true };
|
|
1307
|
+
const r2 = (t3, e3) => {
|
|
1308
|
+
n2[t3] = (n2[t3] || []).concat([e3]);
|
|
1309
|
+
}, i2 = e2[0];
|
|
1310
|
+
return { matched: f(t2, (t3) => s(i2, t3, r2)), selections: n2 };
|
|
1311
|
+
}, getSelectionKeys: () => 0 === e2.length ? [] : o(e2[0]) }) });
|
|
1312
|
+
}, map: function(...e2) {
|
|
1313
|
+
return u({ [t]: () => ({ match: (t2) => {
|
|
1314
|
+
if (!(t2 instanceof Map))
|
|
1315
|
+
return { matched: false };
|
|
1316
|
+
let n2 = {};
|
|
1317
|
+
if (0 === t2.size)
|
|
1318
|
+
return { matched: true, selections: n2 };
|
|
1319
|
+
const r2 = (t3, e3) => {
|
|
1320
|
+
n2[t3] = (n2[t3] || []).concat([e3]);
|
|
1321
|
+
};
|
|
1322
|
+
if (0 === e2.length)
|
|
1323
|
+
return { matched: true };
|
|
1324
|
+
var i2;
|
|
1325
|
+
if (1 === e2.length)
|
|
1326
|
+
throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${null == (i2 = e2[0]) ? void 0 : i2.toString()}`);
|
|
1327
|
+
const [o2, c2] = e2;
|
|
1328
|
+
return { matched: g(t2, (t3, e3) => {
|
|
1329
|
+
const n3 = s(o2, e3, r2), i3 = s(c2, t3, r2);
|
|
1330
|
+
return n3 && i3;
|
|
1331
|
+
}), selections: n2 };
|
|
1332
|
+
}, getSelectionKeys: () => 0 === e2.length ? [] : [...o(e2[0]), ...o(e2[1])] }) });
|
|
1333
|
+
}, intersection: m, union: y, not: function(e2) {
|
|
1334
|
+
return u({ [t]: () => ({ match: (t2) => ({ matched: !s(e2, t2, () => {
|
|
1335
|
+
}) }), getSelectionKeys: () => [], matcherType: "not" }) });
|
|
1336
|
+
}, when: d, select: p, any: S, _: O, string: E, number: A, bigint: P, boolean: T, symbol: k, nullish: B, instanceOf: function(t2) {
|
|
1337
|
+
return u(d(/* @__PURE__ */ function(t3) {
|
|
1338
|
+
return (e2) => e2 instanceof t3;
|
|
1339
|
+
}(t2)));
|
|
1340
|
+
}, shape: function(t2) {
|
|
1341
|
+
return u(d(a(t2)));
|
|
1342
|
+
} };
|
|
1343
|
+
var W = { matched: false, value: void 0 };
|
|
1344
|
+
function N(t2) {
|
|
1345
|
+
return new $(t2, W);
|
|
1206
1346
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1347
|
+
var $ = class _$ {
|
|
1348
|
+
constructor(t2, e2) {
|
|
1349
|
+
this.input = void 0, this.state = void 0, this.input = t2, this.state = e2;
|
|
1350
|
+
}
|
|
1351
|
+
with(...t2) {
|
|
1352
|
+
if (this.state.matched)
|
|
1353
|
+
return this;
|
|
1354
|
+
const e2 = t2[t2.length - 1], r2 = [t2[0]];
|
|
1355
|
+
let i2;
|
|
1356
|
+
3 === t2.length && "function" == typeof t2[1] ? i2 = t2[1] : t2.length > 2 && r2.push(...t2.slice(1, t2.length - 1));
|
|
1357
|
+
let o2 = false, c2 = {};
|
|
1358
|
+
const a2 = (t3, e3) => {
|
|
1359
|
+
o2 = true, c2[t3] = e3;
|
|
1360
|
+
}, u2 = !r2.some((t3) => s(t3, this.input, a2)) || i2 && !Boolean(i2(this.input)) ? W : { matched: true, value: e2(o2 ? n in c2 ? c2[n] : c2 : this.input, this.input) };
|
|
1361
|
+
return new _$(this.input, u2);
|
|
1362
|
+
}
|
|
1363
|
+
when(t2, e2) {
|
|
1364
|
+
if (this.state.matched)
|
|
1365
|
+
return this;
|
|
1366
|
+
const n2 = Boolean(t2(this.input));
|
|
1367
|
+
return new _$(this.input, n2 ? { matched: true, value: e2(this.input, this.input) } : W);
|
|
1368
|
+
}
|
|
1369
|
+
otherwise(t2) {
|
|
1370
|
+
return this.state.matched ? this.state.value : t2(this.input);
|
|
1371
|
+
}
|
|
1372
|
+
exhaustive() {
|
|
1373
|
+
if (this.state.matched)
|
|
1374
|
+
return this.state.value;
|
|
1375
|
+
let t2;
|
|
1376
|
+
try {
|
|
1377
|
+
t2 = JSON.stringify(this.input);
|
|
1378
|
+
} catch (e2) {
|
|
1379
|
+
t2 = this.input;
|
|
1380
|
+
}
|
|
1381
|
+
throw new Error(`Pattern matching error: no pattern matches value ${t2}`);
|
|
1382
|
+
}
|
|
1383
|
+
run() {
|
|
1384
|
+
return this.exhaustive();
|
|
1385
|
+
}
|
|
1386
|
+
returnType() {
|
|
1387
|
+
return this;
|
|
1388
|
+
}
|
|
1223
1389
|
};
|
|
1224
1390
|
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1391
|
+
// src/pragma/is-from-pragma.ts
|
|
1392
|
+
function isInitializedFromPragma(variableName, context, initialScope, pragma = getPragmaFromContext(context)) {
|
|
1393
|
+
const maybeVariable = _var.findVariable(variableName, initialScope);
|
|
1394
|
+
const maybeLatestDef = Option_exports.flatMapNullable(maybeVariable, (variable) => variable.defs.at(-1));
|
|
1395
|
+
if (Option_exports.isNone(maybeLatestDef))
|
|
1396
|
+
return false;
|
|
1397
|
+
const latestDef = maybeLatestDef.value;
|
|
1398
|
+
const { node, parent } = latestDef;
|
|
1399
|
+
if (node.type === ast.NodeType.VariableDeclarator && node.init) {
|
|
1400
|
+
const { init } = node;
|
|
1401
|
+
if (a({ type: "MemberExpression", object: { type: "Identifier", name: pragma } }, init))
|
|
1402
|
+
return true;
|
|
1403
|
+
if (a({ type: "Identifier", name: pragma }, init))
|
|
1404
|
+
return true;
|
|
1405
|
+
const maybeRequireExpression = N(init).with({
|
|
1406
|
+
type: ast.NodeType.CallExpression,
|
|
1407
|
+
callee: { type: ast.NodeType.Identifier, name: "require" }
|
|
1408
|
+
}, (exp) => Option_exports.some(exp)).with(
|
|
1409
|
+
{
|
|
1410
|
+
type: ast.NodeType.MemberExpression,
|
|
1411
|
+
object: {
|
|
1412
|
+
type: ast.NodeType.CallExpression,
|
|
1413
|
+
callee: { type: ast.NodeType.Identifier, name: "require" }
|
|
1414
|
+
}
|
|
1415
|
+
},
|
|
1416
|
+
({ object }) => Option_exports.some(object)
|
|
1417
|
+
).otherwise(Option_exports.none);
|
|
1418
|
+
if (Option_exports.isNone(maybeRequireExpression))
|
|
1419
|
+
return false;
|
|
1420
|
+
const requireExpression = maybeRequireExpression.value;
|
|
1421
|
+
const [firstArg] = requireExpression.arguments;
|
|
1422
|
+
if (firstArg?.type !== ast.NodeType.Literal)
|
|
1423
|
+
return false;
|
|
1424
|
+
return firstArg.value === pragma.toLowerCase();
|
|
1425
|
+
}
|
|
1426
|
+
return a({ type: "ImportDeclaration", source: { value: pragma.toLowerCase() } }, parent);
|
|
1233
1427
|
}
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1428
|
+
function isPropertyOfPragma(name, context, pragma = getPragmaFromContext(context)) {
|
|
1429
|
+
const isMatch = a({
|
|
1430
|
+
type: ast.NodeType.MemberExpression,
|
|
1431
|
+
object: {
|
|
1432
|
+
type: ast.NodeType.Identifier,
|
|
1433
|
+
name: pragma
|
|
1434
|
+
},
|
|
1435
|
+
property: {
|
|
1436
|
+
name
|
|
1241
1437
|
}
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1438
|
+
});
|
|
1439
|
+
return isMatch;
|
|
1440
|
+
}
|
|
1441
|
+
function isFromPragma(name) {
|
|
1442
|
+
return (node, context) => {
|
|
1443
|
+
const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
|
|
1444
|
+
if (node.type === ast.NodeType.MemberExpression)
|
|
1445
|
+
return isPropertyOfPragma(name, context)(node);
|
|
1446
|
+
if (node.name === name)
|
|
1447
|
+
return isInitializedFromPragma(name, context, initialScope);
|
|
1448
|
+
return false;
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
function isFromPragmaMember(pragmaMemberName, name) {
|
|
1452
|
+
return (node, context, pragma = getPragmaFromContext(context)) => {
|
|
1453
|
+
const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
|
|
1454
|
+
if (node.property.type !== ast.NodeType.Identifier || node.property.name !== name)
|
|
1455
|
+
return false;
|
|
1456
|
+
if (node.object.type === ast.NodeType.Identifier && node.object.name === pragmaMemberName) {
|
|
1457
|
+
return isInitializedFromPragma(node.object.name, context, initialScope, pragma);
|
|
1246
1458
|
}
|
|
1247
|
-
if (name.type ===
|
|
1248
|
-
|
|
1459
|
+
if (node.object.type === ast.NodeType.MemberExpression && node.object.object.type === ast.NodeType.Identifier && node.object.object.name === pragma && node.object.property.type === ast.NodeType.Identifier) {
|
|
1460
|
+
return node.object.property.name === pragmaMemberName;
|
|
1249
1461
|
}
|
|
1250
|
-
return
|
|
1462
|
+
return false;
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
function isCallFromPragma(name) {
|
|
1466
|
+
return (node, context) => {
|
|
1467
|
+
if (!ast.isOneOf([ast.NodeType.Identifier, ast.NodeType.MemberExpression])(node.callee))
|
|
1468
|
+
return false;
|
|
1469
|
+
return isFromPragma(name)(node.callee, context);
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
function isCallFromPragmaMember(pragmaMemberName, name) {
|
|
1473
|
+
return (node, context) => {
|
|
1474
|
+
if (!ast.is(ast.NodeType.MemberExpression)(node.callee))
|
|
1475
|
+
return false;
|
|
1476
|
+
return isFromPragmaMember(pragmaMemberName, name)(node.callee, context);
|
|
1477
|
+
};
|
|
1251
1478
|
}
|
|
1252
1479
|
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1480
|
+
// src/element/api.ts
|
|
1481
|
+
var isCreateElement = isFromPragma("createElement");
|
|
1482
|
+
var isCreateElementCall = (node, context) => {
|
|
1483
|
+
if (!ast.isOneOf([ast.NodeType.Identifier, ast.NodeType.MemberExpression])(node.callee))
|
|
1484
|
+
return false;
|
|
1485
|
+
return isCreateElement(node.callee, context);
|
|
1486
|
+
};
|
|
1487
|
+
var isCloneElement = isFromPragma("cloneElement");
|
|
1488
|
+
var isCloneElementCall = (node, context) => {
|
|
1489
|
+
if (!ast.isOneOf([ast.NodeType.Identifier, ast.NodeType.MemberExpression])(node.callee))
|
|
1490
|
+
return false;
|
|
1491
|
+
return isCloneElement(node.callee, context);
|
|
1492
|
+
};
|
|
1493
|
+
function resolveMemberExpressions(object, property) {
|
|
1494
|
+
if (object.type === types.AST_NODE_TYPES.JSXMemberExpression) {
|
|
1495
|
+
return `${resolveMemberExpressions(object.object, object.property)}.${property.name}`;
|
|
1496
|
+
}
|
|
1497
|
+
if (object.type === types.AST_NODE_TYPES.JSXNamespacedName) {
|
|
1498
|
+
return `${object.namespace.name}:${object.name.name}.${property.name}`;
|
|
1499
|
+
}
|
|
1500
|
+
return `${object.name}.${property.name}`;
|
|
1501
|
+
}
|
|
1502
|
+
function elementType(node) {
|
|
1503
|
+
if (node.type === types.AST_NODE_TYPES.JSXOpeningFragment) {
|
|
1504
|
+
return "<>";
|
|
1505
|
+
}
|
|
1506
|
+
const { name } = node;
|
|
1507
|
+
if (name.type === types.AST_NODE_TYPES.JSXMemberExpression) {
|
|
1508
|
+
const { object, property } = name;
|
|
1509
|
+
return resolveMemberExpressions(object, property);
|
|
1510
|
+
}
|
|
1511
|
+
if (name.type === types.AST_NODE_TYPES.JSXNamespacedName) {
|
|
1512
|
+
return `${name.namespace.name}:${name.name.name}`;
|
|
1513
|
+
}
|
|
1514
|
+
return name.name;
|
|
1515
|
+
}
|
|
1516
|
+
function isInsideCreateElementProps(node, context) {
|
|
1517
|
+
return Function_exports.pipe(
|
|
1518
|
+
ast.traverseUp(node, (n2) => ast.is(ast.NodeType.CallExpression)(n2) && isCreateElementCall(n2, context)),
|
|
1519
|
+
Option_exports.filter(ast.is(ast.NodeType.CallExpression)),
|
|
1520
|
+
Option_exports.flatMapNullable((c2) => c2.arguments.at(1)),
|
|
1521
|
+
Option_exports.filter(ast.is(ast.NodeType.ObjectExpression)),
|
|
1522
|
+
Option_exports.zipWith(ast.traverseUp(node, ast.is(ast.NodeType.ObjectExpression)), (a2, b2) => a2 === b2),
|
|
1523
|
+
Option_exports.getOrElse(Function_exports.constFalse)
|
|
1524
|
+
);
|
|
1260
1525
|
}
|
|
1261
1526
|
function isChildrenOfCreateElement(node, context) {
|
|
1262
|
-
|
|
1527
|
+
return Function_exports.pipe(
|
|
1528
|
+
Option_exports.fromNullable(node.parent),
|
|
1529
|
+
Option_exports.filter(ast.is(ast.NodeType.CallExpression)),
|
|
1530
|
+
Option_exports.filter((n2) => isCreateElementCall(n2, context)),
|
|
1531
|
+
Option_exports.exists(
|
|
1532
|
+
(n2) => n2.arguments.slice(2).some((arg) => arg === node)
|
|
1533
|
+
)
|
|
1534
|
+
);
|
|
1263
1535
|
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
* @returns `true` if the node has children
|
|
1269
|
-
*/ function hasChildren(node, predicate) {
|
|
1270
|
-
if (isFunction(predicate)) return node.children.some(predicate);
|
|
1271
|
-
return node.children.length > 0;
|
|
1536
|
+
function hasChildren(node, predicate) {
|
|
1537
|
+
if (Predicate_exports.isFunction(predicate))
|
|
1538
|
+
return node.children.some(predicate);
|
|
1539
|
+
return node.children.length > 0;
|
|
1272
1540
|
}
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
* @param node The AST node to check
|
|
1276
|
-
* @returns `true` if the node is a child of a `JSXElement`
|
|
1277
|
-
*/ function isChildOfJSXElement(node) {
|
|
1278
|
-
return node.parent?.type === ast.NodeType.JSXElement && node.parent.children.some((child)=>child === node);
|
|
1541
|
+
function isChildOfJSXElement(node) {
|
|
1542
|
+
return node.parent?.type === ast.NodeType.JSXElement && node.parent.children.some((child) => child === node);
|
|
1279
1543
|
}
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
* Check if a node is a `JSXElement` of `User-Defined Component` type
|
|
1283
|
-
* @param node The AST node to check
|
|
1284
|
-
* @returns `true` if the node is a `JSXElement` of `User-Defined Component` type
|
|
1285
|
-
*/ function isJSXElementOfUserDefinedComponent(node) {
|
|
1286
|
-
return node.openingElement.name.type === ast.NodeType.JSXIdentifier && /^[A-Z]/u.test(node.openingElement.name.name);
|
|
1544
|
+
function isJSXElementOfUserDefinedComponent(node) {
|
|
1545
|
+
return node.openingElement.name.type === ast.NodeType.JSXIdentifier && /^[A-Z]/u.test(node.openingElement.name.name);
|
|
1287
1546
|
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
* @param node The AST node to check
|
|
1291
|
-
* @returns `true` if the node is a `JSXFragment` of `Built-in Component` type
|
|
1292
|
-
*/ function isJSXElementOfBuiltinComponent(node) {
|
|
1293
|
-
return node.openingElement.name.type === ast.NodeType.JSXIdentifier && node.openingElement.name.name.toLowerCase() === node.openingElement.name.name && /^[a-z]/u.test(node.openingElement.name.name);
|
|
1547
|
+
function isJSXElementOfBuiltinComponent(node) {
|
|
1548
|
+
return node.openingElement.name.type === ast.NodeType.JSXIdentifier && node.openingElement.name.name.toLowerCase() === node.openingElement.name.name && /^[a-z]/u.test(node.openingElement.name.name);
|
|
1294
1549
|
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
ast.NodeType.JSXFragment
|
|
1300
|
-
])(node)) return false;
|
|
1301
|
-
return isFragmentSyntax(node) || isFragmentElement(node, pragma, fragment);
|
|
1550
|
+
var isFragment = (node, pragma, fragment) => {
|
|
1551
|
+
if (!ast.isOneOf([ast.NodeType.JSXElement, ast.NodeType.JSXFragment])(node))
|
|
1552
|
+
return false;
|
|
1553
|
+
return isFragmentSyntax(node) || isFragmentElement(node, pragma, fragment);
|
|
1302
1554
|
};
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
* @param pragma
|
|
1310
|
-
* @param fragment
|
|
1311
|
-
*/ function isFragmentElement(node, pragma, fragment) {
|
|
1312
|
-
const { name } = node.openingElement;
|
|
1313
|
-
// <Fragment>
|
|
1314
|
-
if (name.type === ast.NodeType.JSXIdentifier && name.name === fragment) return true;
|
|
1315
|
-
// <Pragma.Fragment>
|
|
1316
|
-
return name.type === ast.NodeType.JSXMemberExpression && name.object.type === ast.NodeType.JSXIdentifier && name.object.name === pragma && name.property.name === fragment;
|
|
1555
|
+
var isFragmentSyntax = ast.is(ast.NodeType.JSXFragment);
|
|
1556
|
+
function isFragmentElement(node, pragma, fragment) {
|
|
1557
|
+
const { name } = node.openingElement;
|
|
1558
|
+
if (name.type === ast.NodeType.JSXIdentifier && name.name === fragment)
|
|
1559
|
+
return true;
|
|
1560
|
+
return name.type === ast.NodeType.JSXMemberExpression && name.object.type === ast.NodeType.JSXIdentifier && name.object.name === pragma && name.property.name === fragment;
|
|
1317
1561
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
// keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES
|
|
1330
|
-
// ];
|
|
1331
|
-
/* eslint-disable perfectionist/sort-objects */ const JSXValueHint = {
|
|
1332
|
-
None: 0n,
|
|
1333
|
-
SkipNullLiteral: 1n << 0n,
|
|
1334
|
-
SkipUndefinedLiteral: 1n << 1n,
|
|
1335
|
-
SkipBooleanLiteral: 1n << 2n,
|
|
1336
|
-
SkipStringLiteral: 1n << 3n,
|
|
1337
|
-
SkipNumberLiteral: 1n << 4n,
|
|
1338
|
-
SkipCreateElement: 1n << 5n,
|
|
1339
|
-
StrictArray: 1n << 6n,
|
|
1340
|
-
StrictLogical: 1n << 7n,
|
|
1341
|
-
StrictConditional: 1n << 8n
|
|
1562
|
+
var JSXValueHint = {
|
|
1563
|
+
None: 0n,
|
|
1564
|
+
SkipNullLiteral: 1n << 0n,
|
|
1565
|
+
SkipUndefinedLiteral: 1n << 1n,
|
|
1566
|
+
SkipBooleanLiteral: 1n << 2n,
|
|
1567
|
+
SkipStringLiteral: 1n << 3n,
|
|
1568
|
+
SkipNumberLiteral: 1n << 4n,
|
|
1569
|
+
SkipCreateElement: 1n << 5n,
|
|
1570
|
+
StrictArray: 1n << 6n,
|
|
1571
|
+
StrictLogical: 1n << 7n,
|
|
1572
|
+
StrictConditional: 1n << 8n
|
|
1342
1573
|
};
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
return
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
}, constTrue).with({
|
|
1359
|
-
type: ast.NodeType.JSXNamespacedName
|
|
1360
|
-
}, constTrue).with({
|
|
1361
|
-
type: ast.NodeType.Literal
|
|
1362
|
-
}, (node)=>{
|
|
1363
|
-
return N(node.value).with(null, ()=>!(hint & JSXValueHint.SkipNullLiteral)).with(_.boolean, ()=>!(hint & JSXValueHint.SkipBooleanLiteral)).with(_.string, ()=>!(hint & JSXValueHint.SkipStringLiteral)).with(_.number, ()=>!(hint & JSXValueHint.SkipNumberLiteral)).otherwise(constFalse);
|
|
1364
|
-
}).with({
|
|
1365
|
-
type: ast.NodeType.TemplateLiteral
|
|
1366
|
-
}, ()=>!(hint & JSXValueHint.SkipStringLiteral)).with({
|
|
1367
|
-
type: ast.NodeType.ArrayExpression
|
|
1368
|
-
}, (node)=>{
|
|
1369
|
-
if (hint & JSXValueHint.StrictArray) return node.elements.every((n)=>isJSXValue(n, context, hint));
|
|
1370
|
-
return node.elements.some((n)=>isJSXValue(n, context, hint));
|
|
1371
|
-
}).with({
|
|
1372
|
-
type: ast.NodeType.ConditionalExpression
|
|
1373
|
-
}, (node)=>{
|
|
1374
|
-
function leftHasJSX(node) {
|
|
1375
|
-
if (Array.isArray(node.consequent)) {
|
|
1376
|
-
if (hint & JSXValueHint.StrictArray) {
|
|
1377
|
-
return node.consequent.every((n)=>isJSXValue(n, context, hint));
|
|
1378
|
-
}
|
|
1379
|
-
return node.consequent.some((n)=>isJSXValue(n, context, hint));
|
|
1380
|
-
}
|
|
1381
|
-
return isJSXValue(node.consequent, context, hint);
|
|
1382
|
-
}
|
|
1383
|
-
function rightHasJSX(node) {
|
|
1384
|
-
return isJSXValue(node.alternate, context, hint);
|
|
1385
|
-
}
|
|
1386
|
-
if (hint & JSXValueHint.StrictConditional) {
|
|
1387
|
-
return leftHasJSX(node) && rightHasJSX(node);
|
|
1574
|
+
var DEFAULT_JSX_VALUE_HINT = JSXValueHint.SkipUndefinedLiteral | JSXValueHint.SkipBooleanLiteral;
|
|
1575
|
+
function isJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
|
|
1576
|
+
if (!node)
|
|
1577
|
+
return false;
|
|
1578
|
+
return N(node).with({ type: ast.NodeType.JSXElement }, Function_exports.constTrue).with({ type: ast.NodeType.JSXFragment }, Function_exports.constTrue).with({ type: ast.NodeType.JSXMemberExpression }, Function_exports.constTrue).with({ type: ast.NodeType.JSXNamespacedName }, Function_exports.constTrue).with({ type: ast.NodeType.Literal }, (node2) => {
|
|
1579
|
+
return N(node2.value).with(null, () => !(hint & JSXValueHint.SkipNullLiteral)).with(_.boolean, () => !(hint & JSXValueHint.SkipBooleanLiteral)).with(_.string, () => !(hint & JSXValueHint.SkipStringLiteral)).with(_.number, () => !(hint & JSXValueHint.SkipNumberLiteral)).otherwise(Function_exports.constFalse);
|
|
1580
|
+
}).with({ type: ast.NodeType.TemplateLiteral }, () => !(hint & JSXValueHint.SkipStringLiteral)).with({ type: ast.NodeType.ArrayExpression }, (node2) => {
|
|
1581
|
+
if (hint & JSXValueHint.StrictArray)
|
|
1582
|
+
return node2.elements.every((n2) => isJSXValue(n2, context, hint));
|
|
1583
|
+
return node2.elements.some((n2) => isJSXValue(n2, context, hint));
|
|
1584
|
+
}).with({ type: ast.NodeType.ConditionalExpression }, (node2) => {
|
|
1585
|
+
function leftHasJSX(node3) {
|
|
1586
|
+
if (Array.isArray(node3.consequent)) {
|
|
1587
|
+
if (hint & JSXValueHint.StrictArray) {
|
|
1588
|
+
return node3.consequent.every((n2) => isJSXValue(n2, context, hint));
|
|
1388
1589
|
}
|
|
1389
|
-
return
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
type: ast.NodeType.SequenceExpression
|
|
1396
|
-
}, (node)=>{
|
|
1397
|
-
const exp = node.expressions.at(-1);
|
|
1398
|
-
return isJSXValue(exp, context, hint);
|
|
1399
|
-
}).with({
|
|
1400
|
-
type: ast.NodeType.CallExpression
|
|
1401
|
-
}, (node)=>{
|
|
1402
|
-
if (hint & JSXValueHint.SkipCreateElement) return false;
|
|
1403
|
-
return isCreateElementCall(node, context);
|
|
1404
|
-
}).with({
|
|
1405
|
-
type: ast.NodeType.Identifier
|
|
1406
|
-
}, (node)=>{
|
|
1407
|
-
const { name } = node;
|
|
1408
|
-
if (name === "undefined") return !(hint & JSXValueHint.SkipUndefinedLiteral);
|
|
1409
|
-
if (ast.isJSXTagNameExpression(node)) return true;
|
|
1410
|
-
const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
|
|
1411
|
-
const maybeVariable = _var.findVariable(name, initialScope);
|
|
1412
|
-
return pipe(maybeVariable, flatMap(_var.getVariableInit(0)), exists((n)=>isJSXValue(n, context, hint)));
|
|
1413
|
-
}).otherwise(constFalse);
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1416
|
-
/**
|
|
1417
|
-
* Check if function is returning JSX
|
|
1418
|
-
* @param node The return statement node to check
|
|
1419
|
-
* @param context The rule context
|
|
1420
|
-
* @param hint The `JSXValueHint` to use
|
|
1421
|
-
* @returns boolean
|
|
1422
|
-
*/ function isFunctionReturningJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
|
|
1423
|
-
if (node.body.type !== ast.NodeType.BlockStatement) {
|
|
1424
|
-
return isJSXValue(node.body, context, hint);
|
|
1590
|
+
return node3.consequent.some((n2) => isJSXValue(n2, context, hint));
|
|
1591
|
+
}
|
|
1592
|
+
return isJSXValue(node3.consequent, context, hint);
|
|
1593
|
+
}
|
|
1594
|
+
function rightHasJSX(node3) {
|
|
1595
|
+
return isJSXValue(node3.alternate, context, hint);
|
|
1425
1596
|
}
|
|
1426
|
-
|
|
1427
|
-
|
|
1597
|
+
if (hint & JSXValueHint.StrictConditional) {
|
|
1598
|
+
return leftHasJSX(node2) && rightHasJSX(node2);
|
|
1599
|
+
}
|
|
1600
|
+
return leftHasJSX(node2) || rightHasJSX(node2);
|
|
1601
|
+
}).with({ type: ast.NodeType.LogicalExpression }, (node2) => {
|
|
1602
|
+
return isJSXValue(node2.left, context, hint) || isJSXValue(node2.right, context, hint);
|
|
1603
|
+
}).with({ type: ast.NodeType.SequenceExpression }, (node2) => {
|
|
1604
|
+
const exp = node2.expressions.at(-1);
|
|
1605
|
+
return isJSXValue(exp, context, hint);
|
|
1606
|
+
}).with({ type: ast.NodeType.CallExpression }, (node2) => {
|
|
1607
|
+
if (hint & JSXValueHint.SkipCreateElement)
|
|
1608
|
+
return false;
|
|
1609
|
+
return isCreateElementCall(node2, context);
|
|
1610
|
+
}).with({ type: ast.NodeType.Identifier }, (node2) => {
|
|
1611
|
+
const { name } = node2;
|
|
1612
|
+
if (name === "undefined")
|
|
1613
|
+
return !(hint & JSXValueHint.SkipUndefinedLiteral);
|
|
1614
|
+
if (ast.isJSXTagNameExpression(node2))
|
|
1615
|
+
return true;
|
|
1616
|
+
const initialScope = context.sourceCode.getScope?.(node2) ?? context.getScope();
|
|
1617
|
+
const maybeVariable = _var.findVariable(name, initialScope);
|
|
1618
|
+
return Function_exports.pipe(
|
|
1619
|
+
maybeVariable,
|
|
1620
|
+
Option_exports.flatMap(_var.getVariableInit(0)),
|
|
1621
|
+
Option_exports.exists((n2) => isJSXValue(n2, context, hint))
|
|
1622
|
+
);
|
|
1623
|
+
}).otherwise(Function_exports.constFalse);
|
|
1428
1624
|
}
|
|
1429
1625
|
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1626
|
+
// src/misc.ts
|
|
1627
|
+
function isFunctionReturningJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
|
|
1628
|
+
if (node.body.type !== ast.NodeType.BlockStatement) {
|
|
1629
|
+
return isJSXValue(node.body, context, hint);
|
|
1630
|
+
}
|
|
1631
|
+
const statements = ast.getNestedReturnStatements(node.body);
|
|
1632
|
+
return statements.some((statement) => isJSXValue(statement.argument, context, hint));
|
|
1633
|
+
}
|
|
1634
|
+
var { getStaticValue } = ast.ESLintCommunityESLintUtils;
|
|
1635
|
+
function getPropName(node) {
|
|
1636
|
+
return N(node.name).when(ast.is(ast.NodeType.JSXIdentifier), (n2) => n2.name).when(ast.is(ast.NodeType.JSXNamespacedName), (n2) => `${n2.namespace.name}:${n2.name.name}`).exhaustive();
|
|
1437
1637
|
}
|
|
1438
1638
|
function getProp(props, propName, context, initialScope) {
|
|
1439
|
-
|
|
1639
|
+
return findPropInAttributes(props, context, initialScope)(propName);
|
|
1440
1640
|
}
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
const { argument } = attribute;
|
|
1456
|
-
return some(getStaticValue(argument, initialScope));
|
|
1641
|
+
function getPropValue(attribute, context) {
|
|
1642
|
+
const initialScope = context.sourceCode.getScope?.(attribute) ?? context.getScope();
|
|
1643
|
+
if (attribute.type === ast.NodeType.JSXAttribute && "value" in attribute) {
|
|
1644
|
+
const { value } = attribute;
|
|
1645
|
+
if (value === null)
|
|
1646
|
+
return Option_exports.none();
|
|
1647
|
+
if (value.type === ast.NodeType.Literal)
|
|
1648
|
+
return Option_exports.some(getStaticValue(value, initialScope));
|
|
1649
|
+
if (value.type === ast.NodeType.JSXExpressionContainer)
|
|
1650
|
+
return Option_exports.some(getStaticValue(value.expression, initialScope));
|
|
1651
|
+
return Option_exports.none();
|
|
1652
|
+
}
|
|
1653
|
+
const { argument } = attribute;
|
|
1654
|
+
return Option_exports.some(getStaticValue(argument, initialScope));
|
|
1457
1655
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
}).when(ast.is(ast.NodeType.RestElement), ()=>{
|
|
1493
|
-
// Not implemented
|
|
1494
|
-
return false;
|
|
1495
|
-
}).otherwise(constFalse);
|
|
1496
|
-
}));
|
|
1497
|
-
};
|
|
1656
|
+
function findPropInProperties(properties, context, initialScope, seenProps = []) {
|
|
1657
|
+
return (propName) => {
|
|
1658
|
+
return Option_exports.fromNullable(
|
|
1659
|
+
properties.find((prop) => {
|
|
1660
|
+
return N(prop).when(ast.is(ast.NodeType.Property), (prop2) => {
|
|
1661
|
+
return "name" in prop2.key && prop2.key.name === propName;
|
|
1662
|
+
}).when(ast.is(ast.NodeType.SpreadElement), (prop2) => {
|
|
1663
|
+
return N(prop2.argument).when(ast.is(ast.NodeType.Identifier), (argument) => {
|
|
1664
|
+
const { name } = argument;
|
|
1665
|
+
const maybeInit = Option_exports.flatMap(
|
|
1666
|
+
_var.findVariable(name, initialScope),
|
|
1667
|
+
_var.getVariableInit(0)
|
|
1668
|
+
);
|
|
1669
|
+
if (Option_exports.isNone(maybeInit))
|
|
1670
|
+
return false;
|
|
1671
|
+
const init = maybeInit.value;
|
|
1672
|
+
if (init.type !== ast.NodeType.ObjectExpression)
|
|
1673
|
+
return false;
|
|
1674
|
+
if (seenProps.includes(name))
|
|
1675
|
+
return false;
|
|
1676
|
+
return Option_exports.isSome(
|
|
1677
|
+
findPropInProperties(init.properties, context, initialScope, [...seenProps, name])(propName)
|
|
1678
|
+
);
|
|
1679
|
+
}).when(ast.is(ast.NodeType.ObjectExpression), (argument) => {
|
|
1680
|
+
return Option_exports.isSome(findPropInProperties(argument.properties, context, initialScope, seenProps)(propName));
|
|
1681
|
+
}).when(ast.is(ast.NodeType.MemberExpression), () => {
|
|
1682
|
+
}).when(ast.is(ast.NodeType.CallExpression), () => {
|
|
1683
|
+
}).otherwise(Function_exports.constFalse);
|
|
1684
|
+
}).when(ast.is(ast.NodeType.RestElement), () => {
|
|
1685
|
+
return false;
|
|
1686
|
+
}).otherwise(Function_exports.constFalse);
|
|
1687
|
+
})
|
|
1688
|
+
);
|
|
1689
|
+
};
|
|
1498
1690
|
}
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
// Not implemented
|
|
1528
|
-
return false;
|
|
1529
|
-
}).otherwise(constFalse);
|
|
1530
|
-
}).otherwise(constFalse);
|
|
1531
|
-
}));
|
|
1532
|
-
};
|
|
1691
|
+
function findPropInAttributes(attributes, context, initialScope) {
|
|
1692
|
+
return (propName) => {
|
|
1693
|
+
return Option_exports.fromNullable(
|
|
1694
|
+
attributes.find((attr) => {
|
|
1695
|
+
return N(attr).when(ast.is(ast.NodeType.JSXAttribute), (attr2) => getPropName(attr2) === propName).when(ast.is(ast.NodeType.JSXSpreadAttribute), (attr2) => {
|
|
1696
|
+
return N(attr2.argument).with({ type: ast.NodeType.Identifier }, (argument) => {
|
|
1697
|
+
const { name } = argument;
|
|
1698
|
+
const maybeInit = Option_exports.flatMap(
|
|
1699
|
+
_var.findVariable(name, initialScope),
|
|
1700
|
+
_var.getVariableInit(0)
|
|
1701
|
+
);
|
|
1702
|
+
if (Option_exports.isNone(maybeInit))
|
|
1703
|
+
return false;
|
|
1704
|
+
const init = maybeInit.value;
|
|
1705
|
+
if (!("properties" in init))
|
|
1706
|
+
return false;
|
|
1707
|
+
return Option_exports.isSome(findPropInProperties(init.properties, context, initialScope)(propName));
|
|
1708
|
+
}).when(ast.is(ast.NodeType.ObjectExpression), (argument) => {
|
|
1709
|
+
return Option_exports.isSome(findPropInProperties(argument.properties, context, initialScope)(propName));
|
|
1710
|
+
}).when(ast.is(ast.NodeType.MemberExpression), () => {
|
|
1711
|
+
return false;
|
|
1712
|
+
}).when(ast.is(ast.NodeType.CallExpression), () => {
|
|
1713
|
+
return false;
|
|
1714
|
+
}).otherwise(Function_exports.constFalse);
|
|
1715
|
+
}).otherwise(Function_exports.constFalse);
|
|
1716
|
+
})
|
|
1717
|
+
);
|
|
1718
|
+
};
|
|
1533
1719
|
}
|
|
1534
1720
|
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
* @param propName The prop name to search for
|
|
1539
|
-
* @param context The rule context
|
|
1540
|
-
* @param initialScope
|
|
1541
|
-
* @returns `true` if the given prop name is present in the given properties
|
|
1542
|
-
*/ function hasProp(attributes, propName, context, initialScope) {
|
|
1543
|
-
return isSome(findPropInAttributes(attributes, context, initialScope)(propName));
|
|
1721
|
+
// src/prop/has-prop.ts
|
|
1722
|
+
function hasProp(attributes, propName, context, initialScope) {
|
|
1723
|
+
return Option_exports.isSome(findPropInAttributes(attributes, context, initialScope)(propName));
|
|
1544
1724
|
}
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
* @param attributes The attributes to search in
|
|
1548
|
-
* @param propNames The prop names to search for
|
|
1549
|
-
* @param context The rule context
|
|
1550
|
-
* @param initialScope
|
|
1551
|
-
* @returns `true` if any of the given prop names are present in the given attributes
|
|
1552
|
-
*/ function hasAnyProp(attributes, propNames, context, initialScope) {
|
|
1553
|
-
return propNames.some((propName)=>hasProp(attributes, propName, context, initialScope));
|
|
1725
|
+
function hasAnyProp(attributes, propNames, context, initialScope) {
|
|
1726
|
+
return propNames.some((propName) => hasProp(attributes, propName, context, initialScope));
|
|
1554
1727
|
}
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
* @param attributes The attributes to search in
|
|
1558
|
-
* @param propNames The prop names to search for
|
|
1559
|
-
* @param context The rule context
|
|
1560
|
-
* @param initialScope
|
|
1561
|
-
* @returns `true` if all of the given prop names are present in the given attributes
|
|
1562
|
-
*/ function hasEveryProp(attributes, propNames, context, initialScope) {
|
|
1563
|
-
return propNames.every((propName)=>hasProp(attributes, propName, context, initialScope));
|
|
1728
|
+
function hasEveryProp(attributes, propNames, context, initialScope) {
|
|
1729
|
+
return propNames.every((propName) => hasProp(attributes, propName, context, initialScope));
|
|
1564
1730
|
}
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
* @returns prop node if found
|
|
1571
|
-
*/ function traverseUpProp(node, predicate = constTrue) {
|
|
1572
|
-
const guard = (node)=>{
|
|
1573
|
-
return node.type === ast.NodeType.JSXAttribute && predicate(node);
|
|
1574
|
-
};
|
|
1575
|
-
return ast.traverseUpGuard(node, guard);
|
|
1731
|
+
function traverseUpProp(node, predicate = Function_exports.constTrue) {
|
|
1732
|
+
const guard = (node2) => {
|
|
1733
|
+
return node2.type === ast.NodeType.JSXAttribute && predicate(node2);
|
|
1734
|
+
};
|
|
1735
|
+
return ast.traverseUpGuard(node, guard);
|
|
1576
1736
|
}
|
|
1577
1737
|
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
if (ast.isStringLiteral(node)) return node.parent.type === ast.NodeType.JSXAttribute;
|
|
1584
|
-
return isSome(traverseUpProp(node, (n)=>n.value?.type === ast.NodeType.JSXExpressionContainer));
|
|
1738
|
+
// src/prop/misc.ts
|
|
1739
|
+
function isInsidePropValue(node) {
|
|
1740
|
+
if (ast.isStringLiteral(node))
|
|
1741
|
+
return node.parent.type === ast.NodeType.JSXAttribute;
|
|
1742
|
+
return Option_exports.isSome(traverseUpProp(node, (n2) => n2.value?.type === ast.NodeType.JSXExpressionContainer));
|
|
1585
1743
|
}
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
* @param node The AST node to check
|
|
1590
|
-
* @returns boolean `true` if the node is a Literal or JSXText
|
|
1591
|
-
*/ const isLiteral = ast.isOneOf([
|
|
1592
|
-
ast.NodeType.Literal,
|
|
1593
|
-
ast.NodeType.JSXText
|
|
1594
|
-
]);
|
|
1595
|
-
/**
|
|
1596
|
-
* Check if a Literal or JSXText node is whitespace
|
|
1597
|
-
* @param node The AST node to check
|
|
1598
|
-
* @returns boolean `true` if the node is whitespace
|
|
1599
|
-
*/ function isWhiteSpace(node) {
|
|
1600
|
-
return isString(node.value) && node.value.trim() === "";
|
|
1744
|
+
var isLiteral = ast.isOneOf([ast.NodeType.Literal, ast.NodeType.JSXText]);
|
|
1745
|
+
function isWhiteSpace(node) {
|
|
1746
|
+
return Predicate_exports.isString(node.value) && node.value.trim() === "";
|
|
1601
1747
|
}
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
* @param node The AST node to check
|
|
1605
|
-
* @returns boolean
|
|
1606
|
-
*/ function isLineBreak(node) {
|
|
1607
|
-
return isLiteral(node) && isWhiteSpace(node) && ast.isMultiLine(node);
|
|
1748
|
+
function isLineBreak(node) {
|
|
1749
|
+
return isLiteral(node) && isWhiteSpace(node) && ast.isMultiLine(node);
|
|
1608
1750
|
}
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
* @param node The AST node to check
|
|
1612
|
-
* @returns boolean
|
|
1613
|
-
*/ function isPaddingSpaces(node) {
|
|
1614
|
-
return isLiteral(node) && isWhiteSpace(node) && node.raw.includes("\n");
|
|
1751
|
+
function isPaddingSpaces(node) {
|
|
1752
|
+
return isLiteral(node) && isWhiteSpace(node) && node.raw.includes("\n");
|
|
1615
1753
|
}
|
|
1616
1754
|
|
|
1617
1755
|
exports.DEFAULT_JSX_VALUE_HINT = DEFAULT_JSX_VALUE_HINT;
|