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