@effect/language-service 0.28.1 → 0.28.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/cli.js +2395 -3563
- package/cli.js.map +1 -1
- package/index.js +493 -384
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +129 -24
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __export = (target, all3) => {
|
|
4
|
-
for (var name in all3)
|
|
5
|
-
__defProp(target, name, { get: all3[name], enumerable: true });
|
|
6
|
-
};
|
|
7
2
|
|
|
8
|
-
// node_modules/.pnpm/effect@3.
|
|
3
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Function.js
|
|
9
4
|
var isFunction = (input) => typeof input === "function";
|
|
10
5
|
var dual = function(arity, body) {
|
|
11
6
|
if (typeof arity === "function") {
|
|
@@ -101,7 +96,7 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
|
101
96
|
}
|
|
102
97
|
}
|
|
103
98
|
|
|
104
|
-
// node_modules/.pnpm/effect@3.
|
|
99
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Equivalence.js
|
|
105
100
|
var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
106
101
|
var array = (item) => make((self, that) => {
|
|
107
102
|
if (self.length !== that.length) {
|
|
@@ -116,12 +111,8 @@ var array = (item) => make((self, that) => {
|
|
|
116
111
|
return true;
|
|
117
112
|
});
|
|
118
113
|
|
|
119
|
-
// node_modules/.pnpm/effect@3.
|
|
120
|
-
var
|
|
121
|
-
var getCurrentVersion = () => moduleVersion;
|
|
122
|
-
|
|
123
|
-
// node_modules/.pnpm/effect@3.16.12/node_modules/effect/dist/esm/GlobalValue.js
|
|
124
|
-
var globalStoreId = `effect/GlobalValue/globalStoreId/${/* @__PURE__ */ getCurrentVersion()}`;
|
|
114
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/GlobalValue.js
|
|
115
|
+
var globalStoreId = `effect/GlobalValue`;
|
|
125
116
|
var globalStore;
|
|
126
117
|
var globalValue = (id, compute) => {
|
|
127
118
|
if (!globalStore) {
|
|
@@ -134,156 +125,20 @@ var globalValue = (id, compute) => {
|
|
|
134
125
|
return globalStore.get(id);
|
|
135
126
|
};
|
|
136
127
|
|
|
137
|
-
// node_modules/.pnpm/effect@3.
|
|
138
|
-
var Predicate_exports = {};
|
|
139
|
-
__export(Predicate_exports, {
|
|
140
|
-
all: () => all,
|
|
141
|
-
and: () => and,
|
|
142
|
-
compose: () => compose,
|
|
143
|
-
eqv: () => eqv,
|
|
144
|
-
every: () => every,
|
|
145
|
-
hasProperty: () => hasProperty,
|
|
146
|
-
implies: () => implies,
|
|
147
|
-
isBigInt: () => isBigInt,
|
|
148
|
-
isBoolean: () => isBoolean,
|
|
149
|
-
isDate: () => isDate,
|
|
150
|
-
isError: () => isError,
|
|
151
|
-
isFunction: () => isFunction2,
|
|
152
|
-
isIterable: () => isIterable,
|
|
153
|
-
isMap: () => isMap,
|
|
154
|
-
isNever: () => isNever,
|
|
155
|
-
isNotNull: () => isNotNull,
|
|
156
|
-
isNotNullable: () => isNotNullable,
|
|
157
|
-
isNotUndefined: () => isNotUndefined,
|
|
158
|
-
isNull: () => isNull,
|
|
159
|
-
isNullable: () => isNullable,
|
|
160
|
-
isNumber: () => isNumber,
|
|
161
|
-
isObject: () => isObject,
|
|
162
|
-
isPromise: () => isPromise,
|
|
163
|
-
isPromiseLike: () => isPromiseLike,
|
|
164
|
-
isPropertyKey: () => isPropertyKey,
|
|
165
|
-
isReadonlyRecord: () => isReadonlyRecord,
|
|
166
|
-
isRecord: () => isRecord,
|
|
167
|
-
isRecordOrArray: () => isRecordOrArray,
|
|
168
|
-
isRegExp: () => isRegExp,
|
|
169
|
-
isSet: () => isSet,
|
|
170
|
-
isString: () => isString,
|
|
171
|
-
isSymbol: () => isSymbol,
|
|
172
|
-
isTagged: () => isTagged,
|
|
173
|
-
isTruthy: () => isTruthy,
|
|
174
|
-
isTupleOf: () => isTupleOf,
|
|
175
|
-
isTupleOfAtLeast: () => isTupleOfAtLeast,
|
|
176
|
-
isUint8Array: () => isUint8Array,
|
|
177
|
-
isUndefined: () => isUndefined,
|
|
178
|
-
isUnknown: () => isUnknown,
|
|
179
|
-
mapInput: () => mapInput,
|
|
180
|
-
nand: () => nand,
|
|
181
|
-
nor: () => nor,
|
|
182
|
-
not: () => not,
|
|
183
|
-
or: () => or,
|
|
184
|
-
product: () => product,
|
|
185
|
-
productMany: () => productMany,
|
|
186
|
-
some: () => some,
|
|
187
|
-
struct: () => struct,
|
|
188
|
-
tuple: () => tuple,
|
|
189
|
-
xor: () => xor
|
|
190
|
-
});
|
|
191
|
-
var mapInput = /* @__PURE__ */ dual(2, (self, f) => (b) => self(f(b)));
|
|
192
|
-
var isTupleOf = /* @__PURE__ */ dual(2, (self, n) => self.length === n);
|
|
193
|
-
var isTupleOfAtLeast = /* @__PURE__ */ dual(2, (self, n) => self.length >= n);
|
|
194
|
-
var isTruthy = (input) => !!input;
|
|
195
|
-
var isSet = (input) => input instanceof Set;
|
|
196
|
-
var isMap = (input) => input instanceof Map;
|
|
128
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Predicate.js
|
|
197
129
|
var isString = (input) => typeof input === "string";
|
|
198
130
|
var isNumber = (input) => typeof input === "number";
|
|
199
131
|
var isBoolean = (input) => typeof input === "boolean";
|
|
200
|
-
var isBigInt = (input) => typeof input === "bigint";
|
|
201
|
-
var isSymbol = (input) => typeof input === "symbol";
|
|
202
|
-
var isPropertyKey = (u) => isString(u) || isNumber(u) || isSymbol(u);
|
|
203
132
|
var isFunction2 = isFunction;
|
|
204
|
-
var isUndefined = (input) => input === void 0;
|
|
205
|
-
var isNotUndefined = (input) => input !== void 0;
|
|
206
|
-
var isNull = (input) => input === null;
|
|
207
|
-
var isNotNull = (input) => input !== null;
|
|
208
|
-
var isNever = (_) => false;
|
|
209
|
-
var isUnknown = (_) => true;
|
|
210
133
|
var isRecordOrArray = (input) => typeof input === "object" && input !== null;
|
|
211
134
|
var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
|
|
212
135
|
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
|
|
213
|
-
var isTagged = /* @__PURE__ */ dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag);
|
|
214
|
-
var isNullable = (input) => input === null || input === void 0;
|
|
215
|
-
var isNotNullable = (input) => input !== null && input !== void 0;
|
|
216
|
-
var isError = (input) => input instanceof Error;
|
|
217
|
-
var isUint8Array = (input) => input instanceof Uint8Array;
|
|
218
|
-
var isDate = (input) => input instanceof Date;
|
|
219
|
-
var isIterable = (input) => hasProperty(input, Symbol.iterator);
|
|
220
136
|
var isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input);
|
|
221
|
-
var isReadonlyRecord = isRecord;
|
|
222
|
-
var isPromise = (input) => hasProperty(input, "then") && "catch" in input && isFunction2(input.then) && isFunction2(input.catch);
|
|
223
|
-
var isPromiseLike = (input) => hasProperty(input, "then") && isFunction2(input.then);
|
|
224
|
-
var isRegExp = (input) => input instanceof RegExp;
|
|
225
|
-
var compose = /* @__PURE__ */ dual(2, (ab, bc) => (a) => ab(a) && bc(a));
|
|
226
|
-
var product = (self, that) => ([a, b]) => self(a) && that(b);
|
|
227
|
-
var all = (collection) => {
|
|
228
|
-
return (as) => {
|
|
229
|
-
let collectionIndex = 0;
|
|
230
|
-
for (const p of collection) {
|
|
231
|
-
if (collectionIndex >= as.length) {
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
if (p(as[collectionIndex]) === false) {
|
|
235
|
-
return false;
|
|
236
|
-
}
|
|
237
|
-
collectionIndex++;
|
|
238
|
-
}
|
|
239
|
-
return true;
|
|
240
|
-
};
|
|
241
|
-
};
|
|
242
|
-
var productMany = (self, collection) => {
|
|
243
|
-
const rest = all(collection);
|
|
244
|
-
return ([head2, ...tail]) => self(head2) === false ? false : rest(tail);
|
|
245
|
-
};
|
|
246
|
-
var tuple = (...elements) => all(elements);
|
|
247
|
-
var struct = (fields) => {
|
|
248
|
-
const keys = Object.keys(fields);
|
|
249
|
-
return (a) => {
|
|
250
|
-
for (const key of keys) {
|
|
251
|
-
if (!fields[key](a[key])) {
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
return true;
|
|
256
|
-
};
|
|
257
|
-
};
|
|
258
|
-
var not = (self) => (a) => !self(a);
|
|
259
|
-
var or = /* @__PURE__ */ dual(2, (self, that) => (a) => self(a) || that(a));
|
|
260
|
-
var and = /* @__PURE__ */ dual(2, (self, that) => (a) => self(a) && that(a));
|
|
261
|
-
var xor = /* @__PURE__ */ dual(2, (self, that) => (a) => self(a) !== that(a));
|
|
262
|
-
var eqv = /* @__PURE__ */ dual(2, (self, that) => (a) => self(a) === that(a));
|
|
263
|
-
var implies = /* @__PURE__ */ dual(2, (antecedent, consequent) => (a) => antecedent(a) ? consequent(a) : true);
|
|
264
|
-
var nor = /* @__PURE__ */ dual(2, (self, that) => (a) => !(self(a) || that(a)));
|
|
265
|
-
var nand = /* @__PURE__ */ dual(2, (self, that) => (a) => !(self(a) && that(a)));
|
|
266
|
-
var every = (collection) => (a) => {
|
|
267
|
-
for (const p of collection) {
|
|
268
|
-
if (!p(a)) {
|
|
269
|
-
return false;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return true;
|
|
273
|
-
};
|
|
274
|
-
var some = (collection) => (a) => {
|
|
275
|
-
for (const p of collection) {
|
|
276
|
-
if (p(a)) {
|
|
277
|
-
return true;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return false;
|
|
281
|
-
};
|
|
282
137
|
|
|
283
|
-
// node_modules/.pnpm/effect@3.
|
|
138
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/errors.js
|
|
284
139
|
var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
|
|
285
140
|
|
|
286
|
-
// node_modules/.pnpm/effect@3.
|
|
141
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Utils.js
|
|
287
142
|
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
|
|
288
143
|
var GenKindImpl = class {
|
|
289
144
|
value;
|
|
@@ -411,7 +266,7 @@ var internalCall = isNotOptimizedAway ? standard.effect_internal_function : forc
|
|
|
411
266
|
var genConstructor = function* () {
|
|
412
267
|
}.constructor;
|
|
413
268
|
|
|
414
|
-
// node_modules/.pnpm/effect@3.
|
|
269
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Hash.js
|
|
415
270
|
var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
|
|
416
271
|
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
417
272
|
var hash = (self) => {
|
|
@@ -510,7 +365,7 @@ var cached = function() {
|
|
|
510
365
|
return hash2;
|
|
511
366
|
};
|
|
512
367
|
|
|
513
|
-
// node_modules/.pnpm/effect@3.
|
|
368
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Equal.js
|
|
514
369
|
var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
|
|
515
370
|
function equals() {
|
|
516
371
|
if (arguments.length === 1) {
|
|
@@ -564,7 +419,7 @@ function compareBoth(self, that) {
|
|
|
564
419
|
var isEqual = (u) => hasProperty(u, symbol2);
|
|
565
420
|
var equivalence = () => equals;
|
|
566
421
|
|
|
567
|
-
// node_modules/.pnpm/effect@3.
|
|
422
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Inspectable.js
|
|
568
423
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
569
424
|
var toJSON = (x) => {
|
|
570
425
|
try {
|
|
@@ -616,7 +471,7 @@ var redact = (u) => {
|
|
|
616
471
|
return u;
|
|
617
472
|
};
|
|
618
473
|
|
|
619
|
-
// node_modules/.pnpm/effect@3.
|
|
474
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Pipeable.js
|
|
620
475
|
var pipeArguments = (self, args2) => {
|
|
621
476
|
switch (args2.length) {
|
|
622
477
|
case 0:
|
|
@@ -649,10 +504,14 @@ var pipeArguments = (self, args2) => {
|
|
|
649
504
|
}
|
|
650
505
|
};
|
|
651
506
|
|
|
652
|
-
// node_modules/.pnpm/effect@3.
|
|
507
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/opCodes/effect.js
|
|
653
508
|
var OP_COMMIT = "Commit";
|
|
654
509
|
|
|
655
|
-
// node_modules/.pnpm/effect@3.
|
|
510
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/version.js
|
|
511
|
+
var moduleVersion = "3.17.1";
|
|
512
|
+
var getCurrentVersion = () => moduleVersion;
|
|
513
|
+
|
|
514
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/effectable.js
|
|
656
515
|
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
657
516
|
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
658
517
|
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
@@ -739,7 +598,7 @@ var StructuralCommitPrototype = {
|
|
|
739
598
|
...StructuralPrototype
|
|
740
599
|
};
|
|
741
600
|
|
|
742
|
-
// node_modules/.pnpm/effect@3.
|
|
601
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/option.js
|
|
743
602
|
var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
744
603
|
var CommonProto = {
|
|
745
604
|
...EffectPrototype,
|
|
@@ -791,13 +650,13 @@ var isOption = (input) => hasProperty(input, TypeId);
|
|
|
791
650
|
var isNone = (fa) => fa._tag === "None";
|
|
792
651
|
var isSome = (fa) => fa._tag === "Some";
|
|
793
652
|
var none = /* @__PURE__ */ Object.create(NoneProto);
|
|
794
|
-
var
|
|
653
|
+
var some = (value) => {
|
|
795
654
|
const a = Object.create(SomeProto);
|
|
796
655
|
a.value = value;
|
|
797
656
|
return a;
|
|
798
657
|
};
|
|
799
658
|
|
|
800
|
-
// node_modules/.pnpm/effect@3.
|
|
659
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/either.js
|
|
801
660
|
var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
|
|
802
661
|
var CommonProto2 = {
|
|
803
662
|
...EffectPrototype,
|
|
@@ -859,7 +718,7 @@ var right = (right3) => {
|
|
|
859
718
|
return a;
|
|
860
719
|
};
|
|
861
720
|
|
|
862
|
-
// node_modules/.pnpm/effect@3.
|
|
721
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Either.js
|
|
863
722
|
var right2 = right;
|
|
864
723
|
var left2 = left;
|
|
865
724
|
var isLeft2 = isLeft;
|
|
@@ -867,13 +726,13 @@ var isRight2 = isRight;
|
|
|
867
726
|
var map = /* @__PURE__ */ dual(2, (self, f) => isRight2(self) ? right2(f(self.right)) : left2(self.left));
|
|
868
727
|
var getOrElse = /* @__PURE__ */ dual(2, (self, onLeft) => isLeft2(self) ? onLeft(self.left) : self.right);
|
|
869
728
|
|
|
870
|
-
// node_modules/.pnpm/effect@3.
|
|
729
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Order.js
|
|
871
730
|
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
872
731
|
var string2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
|
|
873
732
|
|
|
874
|
-
// node_modules/.pnpm/effect@3.
|
|
733
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Option.js
|
|
875
734
|
var none2 = () => none;
|
|
876
|
-
var
|
|
735
|
+
var some2 = some;
|
|
877
736
|
var isNone2 = isNone;
|
|
878
737
|
var isSome2 = isSome;
|
|
879
738
|
var match = /* @__PURE__ */ dual(2, (self, {
|
|
@@ -882,14 +741,14 @@ var match = /* @__PURE__ */ dual(2, (self, {
|
|
|
882
741
|
}) => isNone2(self) ? onNone() : onSome(self.value));
|
|
883
742
|
var getOrElse2 = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
|
|
884
743
|
var orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
|
|
885
|
-
var fromNullable = (nullableValue) => nullableValue == null ? none2() :
|
|
744
|
+
var fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nullableValue);
|
|
886
745
|
var getOrUndefined = /* @__PURE__ */ getOrElse2(constUndefined);
|
|
887
|
-
var map2 = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() :
|
|
746
|
+
var map2 = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
|
|
888
747
|
|
|
889
|
-
// node_modules/.pnpm/effect@3.
|
|
748
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/array.js
|
|
890
749
|
var isNonEmptyArray = (self) => self.length > 0;
|
|
891
750
|
|
|
892
|
-
// node_modules/.pnpm/effect@3.
|
|
751
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Array.js
|
|
893
752
|
var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
|
|
894
753
|
var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
|
|
895
754
|
var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable(self).concat(fromIterable(that)));
|
|
@@ -900,7 +759,7 @@ var isNonEmptyReadonlyArray = isNonEmptyArray;
|
|
|
900
759
|
var isOutOfBounds = (i, as) => i < 0 || i >= as.length;
|
|
901
760
|
var get = /* @__PURE__ */ dual(2, (self, index) => {
|
|
902
761
|
const i = Math.floor(index);
|
|
903
|
-
return isOutOfBounds(i, self) ? none2() :
|
|
762
|
+
return isOutOfBounds(i, self) ? none2() : some2(self[i]);
|
|
904
763
|
});
|
|
905
764
|
var unsafeGet = /* @__PURE__ */ dual(2, (self, index) => {
|
|
906
765
|
const i = Math.floor(index);
|
|
@@ -957,7 +816,7 @@ var filter = /* @__PURE__ */ dual(2, (self, predicate) => {
|
|
|
957
816
|
}
|
|
958
817
|
return out;
|
|
959
818
|
});
|
|
960
|
-
var
|
|
819
|
+
var every = /* @__PURE__ */ dual(2, (self, refinement) => self.every(refinement));
|
|
961
820
|
var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
962
821
|
const input = fromIterable(self);
|
|
963
822
|
if (isNonEmptyReadonlyArray(input)) {
|
|
@@ -1226,7 +1085,7 @@ function cachedBy(fa, type, lookupKey) {
|
|
|
1226
1085
|
var option = (fa) => {
|
|
1227
1086
|
const nano = Object.create(MatchProto);
|
|
1228
1087
|
nano[args] = fa;
|
|
1229
|
-
nano[contA] = (_) => succeed(
|
|
1088
|
+
nano[contA] = (_) => succeed(some2(_));
|
|
1230
1089
|
nano[contE] = (_) => _ instanceof NanoDefectException ? fail(_) : succeed(none2());
|
|
1231
1090
|
return nano;
|
|
1232
1091
|
};
|
|
@@ -1237,7 +1096,7 @@ var ignore = (fa) => {
|
|
|
1237
1096
|
nano[contE] = (_) => _ instanceof NanoDefectException ? fail(_) : void_;
|
|
1238
1097
|
return nano;
|
|
1239
1098
|
};
|
|
1240
|
-
var
|
|
1099
|
+
var all = fn("all")(
|
|
1241
1100
|
function* (...args2) {
|
|
1242
1101
|
const results = [];
|
|
1243
1102
|
for (const fa of args2) {
|
|
@@ -1483,7 +1342,7 @@ var findImportedModuleIdentifier = fn("AST.findImportedModuleIdentifier")(
|
|
|
1483
1342
|
} else if (ts.isNamedImports(namedBindings)) {
|
|
1484
1343
|
for (const importSpecifier of namedBindings.elements) {
|
|
1485
1344
|
const importProperty = fromNullable(importSpecifier.propertyName).pipe(
|
|
1486
|
-
orElse(() =>
|
|
1345
|
+
orElse(() => some2(importSpecifier.name))
|
|
1487
1346
|
);
|
|
1488
1347
|
if (yield* test(importSpecifier.name, statement.moduleSpecifier, importProperty)) {
|
|
1489
1348
|
return importSpecifier.name;
|
|
@@ -1516,20 +1375,20 @@ var simplifyTypeNode = fn("AST.simplifyTypeNode")(function* (typeNode) {
|
|
|
1516
1375
|
function collectCallable(typeNode2) {
|
|
1517
1376
|
if (ts.isParenthesizedTypeNode(typeNode2)) return collectCallable(typeNode2.type);
|
|
1518
1377
|
if (ts.isFunctionTypeNode(typeNode2)) {
|
|
1519
|
-
return
|
|
1378
|
+
return some2([
|
|
1520
1379
|
ts.factory.createCallSignature(typeNode2.typeParameters, typeNode2.parameters, typeNode2.type)
|
|
1521
1380
|
]);
|
|
1522
1381
|
}
|
|
1523
1382
|
if (ts.isTypeLiteralNode(typeNode2)) {
|
|
1524
1383
|
const allCallSignatures = typeNode2.members.every(ts.isCallSignatureDeclaration);
|
|
1525
1384
|
if (allCallSignatures) {
|
|
1526
|
-
return
|
|
1385
|
+
return some2(typeNode2.members);
|
|
1527
1386
|
}
|
|
1528
1387
|
}
|
|
1529
1388
|
if (ts.isIntersectionTypeNode(typeNode2)) {
|
|
1530
1389
|
const members = typeNode2.types.map((node) => collectCallable(node));
|
|
1531
1390
|
if (members.every(isSome2)) {
|
|
1532
|
-
return
|
|
1391
|
+
return some2(members.map((_) => isSome2(_) ? _.value : []).flat());
|
|
1533
1392
|
}
|
|
1534
1393
|
}
|
|
1535
1394
|
return none2();
|
|
@@ -2445,7 +2304,7 @@ function make3(ts, typeChecker) {
|
|
|
2445
2304
|
return invariantTypeArgument(propertyType);
|
|
2446
2305
|
};
|
|
2447
2306
|
const effectVarianceStruct = (type, atLocation) => map4(
|
|
2448
|
-
|
|
2307
|
+
all(
|
|
2449
2308
|
varianceStructCovariantType(type, atLocation, "_A"),
|
|
2450
2309
|
varianceStructCovariantType(type, atLocation, "_E"),
|
|
2451
2310
|
varianceStructCovariantType(type, atLocation, "_R")
|
|
@@ -2453,7 +2312,7 @@ function make3(ts, typeChecker) {
|
|
|
2453
2312
|
([A, E, R]) => ({ A, E, R })
|
|
2454
2313
|
);
|
|
2455
2314
|
const layerVarianceStruct = (type, atLocation) => map4(
|
|
2456
|
-
|
|
2315
|
+
all(
|
|
2457
2316
|
varianceStructContravariantType(type, atLocation, "_ROut"),
|
|
2458
2317
|
varianceStructCovariantType(type, atLocation, "_E"),
|
|
2459
2318
|
varianceStructCovariantType(type, atLocation, "_RIn")
|
|
@@ -2761,7 +2620,7 @@ function make3(ts, typeChecker) {
|
|
|
2761
2620
|
(node) => node
|
|
2762
2621
|
);
|
|
2763
2622
|
const effectSchemaVarianceStruct = (type, atLocation) => map4(
|
|
2764
|
-
|
|
2623
|
+
all(
|
|
2765
2624
|
varianceStructInvariantType(type, atLocation, "_A"),
|
|
2766
2625
|
varianceStructInvariantType(type, atLocation, "_I"),
|
|
2767
2626
|
varianceStructCovariantType(type, atLocation, "_R")
|
|
@@ -2793,7 +2652,7 @@ function make3(ts, typeChecker) {
|
|
|
2793
2652
|
(type) => type
|
|
2794
2653
|
);
|
|
2795
2654
|
const contextTagVarianceStruct = (type, atLocation) => map4(
|
|
2796
|
-
|
|
2655
|
+
all(
|
|
2797
2656
|
varianceStructInvariantType(type, atLocation, "_Identifier"),
|
|
2798
2657
|
varianceStructInvariantType(type, atLocation, "_Service")
|
|
2799
2658
|
),
|
|
@@ -3071,7 +2930,7 @@ var importFromBarrel = createDiagnostic({
|
|
|
3071
2930
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
3072
2931
|
const program = yield* service(TypeScriptProgram);
|
|
3073
2932
|
const packageNamesToCheck = flatten(
|
|
3074
|
-
yield*
|
|
2933
|
+
yield* all(
|
|
3075
2934
|
...languageServicePluginOptions.namespaceImportPackages.map(
|
|
3076
2935
|
(packageName) => resolveModulePattern(sourceFile, packageName)
|
|
3077
2936
|
)
|
|
@@ -3323,7 +3182,7 @@ var missingEffectContext = createDiagnostic({
|
|
|
3323
3182
|
const typeParser = yield* service(TypeParser);
|
|
3324
3183
|
const typeOrder = yield* deterministicTypeOrder;
|
|
3325
3184
|
const checkForMissingContextTypes = (node, expectedType, valueNode, realType) => pipe(
|
|
3326
|
-
|
|
3185
|
+
all(
|
|
3327
3186
|
typeParser.effectType(expectedType, node),
|
|
3328
3187
|
typeParser.effectType(realType, valueNode)
|
|
3329
3188
|
),
|
|
@@ -3389,7 +3248,7 @@ var missingEffectError = createDiagnostic({
|
|
|
3389
3248
|
[ts.factory.createStringLiteral(message)]
|
|
3390
3249
|
);
|
|
3391
3250
|
const checkForMissingErrorTypes = (node, expectedType, valueNode, realType) => pipe(
|
|
3392
|
-
|
|
3251
|
+
all(
|
|
3393
3252
|
typeParser.effectType(expectedType, node),
|
|
3394
3253
|
typeParser.effectType(realType, valueNode)
|
|
3395
3254
|
),
|
|
@@ -3631,6 +3490,110 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
3631
3490
|
})
|
|
3632
3491
|
});
|
|
3633
3492
|
|
|
3493
|
+
// src/diagnostics/multipleEffectProvide.ts
|
|
3494
|
+
var multipleEffectProvide = createDiagnostic({
|
|
3495
|
+
name: "multipleEffectProvide",
|
|
3496
|
+
code: 18,
|
|
3497
|
+
severity: "warning",
|
|
3498
|
+
apply: fn("multipleEffectProvide.apply")(function* (sourceFile, report) {
|
|
3499
|
+
const ts = yield* service(TypeScriptApi);
|
|
3500
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
3501
|
+
const typeParser = yield* service(TypeParser);
|
|
3502
|
+
const effectModuleIdentifier = yield* pipe(
|
|
3503
|
+
findImportedModuleIdentifierByPackageAndNameOrBarrel(
|
|
3504
|
+
sourceFile,
|
|
3505
|
+
"effect",
|
|
3506
|
+
"Effect"
|
|
3507
|
+
),
|
|
3508
|
+
map4((_) => _.text),
|
|
3509
|
+
orElse2(() => succeed("Effect"))
|
|
3510
|
+
);
|
|
3511
|
+
const layerModuleIdentifier = yield* pipe(
|
|
3512
|
+
findImportedModuleIdentifierByPackageAndNameOrBarrel(
|
|
3513
|
+
sourceFile,
|
|
3514
|
+
"effect",
|
|
3515
|
+
"Layer"
|
|
3516
|
+
),
|
|
3517
|
+
map4((_) => _.text),
|
|
3518
|
+
orElse2(() => succeed("Layer"))
|
|
3519
|
+
);
|
|
3520
|
+
const parseEffectProvideLayer = (node) => {
|
|
3521
|
+
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && node.expression.name.text === "provide" && node.arguments.length > 0) {
|
|
3522
|
+
const layer = node.arguments[0];
|
|
3523
|
+
const type = typeChecker.getTypeAtLocation(layer);
|
|
3524
|
+
return pipe(
|
|
3525
|
+
typeParser.importedEffectModule(node.expression.expression),
|
|
3526
|
+
flatMap2(() => typeParser.layerType(type, layer)),
|
|
3527
|
+
map4(() => ({ layer, node })),
|
|
3528
|
+
orElse2(() => void_)
|
|
3529
|
+
);
|
|
3530
|
+
}
|
|
3531
|
+
return void_;
|
|
3532
|
+
};
|
|
3533
|
+
const parsePipeCall = (node) => gen(function* () {
|
|
3534
|
+
const { args: args2 } = yield* typeParser.pipeCall(node);
|
|
3535
|
+
let currentChunk = 0;
|
|
3536
|
+
const previousLayers = [[]];
|
|
3537
|
+
for (const pipeArg of args2) {
|
|
3538
|
+
const parsedProvide = yield* parseEffectProvideLayer(pipeArg);
|
|
3539
|
+
if (parsedProvide) {
|
|
3540
|
+
previousLayers[currentChunk].push(parsedProvide);
|
|
3541
|
+
} else {
|
|
3542
|
+
currentChunk++;
|
|
3543
|
+
previousLayers.push([]);
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3546
|
+
for (const chunk of previousLayers) {
|
|
3547
|
+
if (chunk.length < 2) continue;
|
|
3548
|
+
report({
|
|
3549
|
+
node: chunk[0].node,
|
|
3550
|
+
messageText: "Avoid chaining Effect.provide calls, as this can lead to service lifecycle issues. Instead, merge layers and provide them in a single call.",
|
|
3551
|
+
fixes: [{
|
|
3552
|
+
fixName: "multipleEffectProvide_fix",
|
|
3553
|
+
description: "Combine into a single provide",
|
|
3554
|
+
apply: gen(function* () {
|
|
3555
|
+
const changeTracker = yield* service(ChangeTracker);
|
|
3556
|
+
changeTracker.deleteRange(sourceFile, {
|
|
3557
|
+
pos: chunk[0].node.getStart(sourceFile),
|
|
3558
|
+
end: chunk[chunk.length - 1].node.getEnd()
|
|
3559
|
+
});
|
|
3560
|
+
const newNode = ts.factory.createCallExpression(
|
|
3561
|
+
ts.factory.createPropertyAccessExpression(
|
|
3562
|
+
ts.factory.createIdentifier(effectModuleIdentifier),
|
|
3563
|
+
ts.factory.createIdentifier("provide")
|
|
3564
|
+
),
|
|
3565
|
+
void 0,
|
|
3566
|
+
[ts.factory.createCallExpression(
|
|
3567
|
+
ts.factory.createPropertyAccessExpression(
|
|
3568
|
+
ts.factory.createIdentifier(layerModuleIdentifier),
|
|
3569
|
+
ts.factory.createIdentifier("mergeAll")
|
|
3570
|
+
),
|
|
3571
|
+
void 0,
|
|
3572
|
+
chunk.map((c) => c.layer)
|
|
3573
|
+
)]
|
|
3574
|
+
);
|
|
3575
|
+
changeTracker.insertNodeAt(sourceFile, chunk[0].node.getStart(sourceFile), newNode);
|
|
3576
|
+
})
|
|
3577
|
+
}]
|
|
3578
|
+
});
|
|
3579
|
+
}
|
|
3580
|
+
});
|
|
3581
|
+
const nodeToVisit = [];
|
|
3582
|
+
const appendNodeToVisit = (node) => {
|
|
3583
|
+
nodeToVisit.push(node);
|
|
3584
|
+
return void 0;
|
|
3585
|
+
};
|
|
3586
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
3587
|
+
while (nodeToVisit.length > 0) {
|
|
3588
|
+
const node = nodeToVisit.shift();
|
|
3589
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
3590
|
+
if (ts.isCallExpression(node)) {
|
|
3591
|
+
yield* pipe(parsePipeCall(node), ignore);
|
|
3592
|
+
}
|
|
3593
|
+
}
|
|
3594
|
+
})
|
|
3595
|
+
});
|
|
3596
|
+
|
|
3634
3597
|
// src/diagnostics/returnEffectInGen.ts
|
|
3635
3598
|
var returnEffectInGen = createDiagnostic({
|
|
3636
3599
|
name: "returnEffectInGen",
|
|
@@ -4092,7 +4055,8 @@ var diagnostics = [
|
|
|
4092
4055
|
scopeInLayerEffect,
|
|
4093
4056
|
effectInVoidSuccess,
|
|
4094
4057
|
unnecessaryPipeChain,
|
|
4095
|
-
strictBooleanExpressions
|
|
4058
|
+
strictBooleanExpressions,
|
|
4059
|
+
multipleEffectProvide
|
|
4096
4060
|
];
|
|
4097
4061
|
|
|
4098
4062
|
// src/completions/effectDiagnosticsComment.ts
|
|
@@ -4388,41 +4352,6 @@ var completions = [
|
|
|
4388
4352
|
schemaBrand
|
|
4389
4353
|
];
|
|
4390
4354
|
|
|
4391
|
-
// node_modules/.pnpm/effect@3.16.12/node_modules/effect/dist/esm/internal/encoding/common.js
|
|
4392
|
-
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
4393
|
-
|
|
4394
|
-
// node_modules/.pnpm/effect@3.16.12/node_modules/effect/dist/esm/internal/encoding/base64.js
|
|
4395
|
-
var encode = (bytes) => {
|
|
4396
|
-
const length = bytes.length;
|
|
4397
|
-
let result = "";
|
|
4398
|
-
let i;
|
|
4399
|
-
for (i = 2; i < length; i += 3) {
|
|
4400
|
-
result += base64abc[bytes[i - 2] >> 2];
|
|
4401
|
-
result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
4402
|
-
result += base64abc[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];
|
|
4403
|
-
result += base64abc[bytes[i] & 63];
|
|
4404
|
-
}
|
|
4405
|
-
if (i === length + 1) {
|
|
4406
|
-
result += base64abc[bytes[i - 2] >> 2];
|
|
4407
|
-
result += base64abc[(bytes[i - 2] & 3) << 4];
|
|
4408
|
-
result += "==";
|
|
4409
|
-
}
|
|
4410
|
-
if (i === length) {
|
|
4411
|
-
result += base64abc[bytes[i - 2] >> 2];
|
|
4412
|
-
result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
4413
|
-
result += base64abc[(bytes[i - 1] & 15) << 2];
|
|
4414
|
-
result += "=";
|
|
4415
|
-
}
|
|
4416
|
-
return result;
|
|
4417
|
-
};
|
|
4418
|
-
var base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"];
|
|
4419
|
-
|
|
4420
|
-
// node_modules/.pnpm/effect@3.16.12/node_modules/effect/dist/esm/internal/encoding/base64Url.js
|
|
4421
|
-
var encode2 = (data) => encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
4422
|
-
|
|
4423
|
-
// node_modules/.pnpm/effect@3.16.12/node_modules/effect/dist/esm/Encoding.js
|
|
4424
|
-
var encodeBase64Url = (input) => typeof input === "string" ? encode2(encoder.encode(input)) : encode2(input);
|
|
4425
|
-
|
|
4426
4355
|
// src/core/AutoImport.ts
|
|
4427
4356
|
var makeAutoImportProvider = fn("TypeScriptApi")(function* (fromSourceFile) {
|
|
4428
4357
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -4481,7 +4410,7 @@ var makeAutoImportProvider = fn("TypeScriptApi")(function* (fromSourceFile) {
|
|
|
4481
4410
|
);
|
|
4482
4411
|
if (!_entrypoints) return;
|
|
4483
4412
|
if (!isArray(_entrypoints)) return;
|
|
4484
|
-
if (!
|
|
4413
|
+
if (!every(isString)) return;
|
|
4485
4414
|
const entrypoints = _entrypoints.map((_) => String(_));
|
|
4486
4415
|
const info = parsePackageContentNameAndVersionFromScope({ packageJsonScope: packageJsonInfo });
|
|
4487
4416
|
if (!info) return { entrypoints, exportedKeys: [] };
|
|
@@ -4589,7 +4518,7 @@ var makeAutoImportProvider = fn("TypeScriptApi")(function* (fromSourceFile) {
|
|
|
4589
4518
|
if (!moduleSpecifier) return fileName;
|
|
4590
4519
|
return moduleSpecifier;
|
|
4591
4520
|
};
|
|
4592
|
-
|
|
4521
|
+
const resolve = (exportFileName, exportName) => {
|
|
4593
4522
|
const excludedExports = mapFilenameToExportExcludes.get(exportFileName);
|
|
4594
4523
|
if (excludedExports && excludedExports.includes(exportName)) return;
|
|
4595
4524
|
const mapToNamespace = mapFromBarrelToNamespace.get(exportFileName);
|
|
@@ -4629,10 +4558,166 @@ var makeAutoImportProvider = fn("TypeScriptApi")(function* (fromSourceFile) {
|
|
|
4629
4558
|
};
|
|
4630
4559
|
}
|
|
4631
4560
|
};
|
|
4561
|
+
const sortText = (exportFileName, exportName) => {
|
|
4562
|
+
const excludedExports = mapFilenameToExportExcludes.get(exportFileName);
|
|
4563
|
+
if (excludedExports && excludedExports.includes(exportName)) return;
|
|
4564
|
+
const mapToNamespace = mapFromBarrelToNamespace.get(exportFileName);
|
|
4565
|
+
if (mapToNamespace && exportName in mapToNamespace) return "99";
|
|
4566
|
+
};
|
|
4567
|
+
return { resolve, sortText };
|
|
4568
|
+
});
|
|
4569
|
+
var importProvidersCache = /* @__PURE__ */ new Map();
|
|
4570
|
+
var getOrMakeAutoImportProvider = fn("getOrMakeAutoImportProvider")(function* (sourceFile) {
|
|
4571
|
+
const autoImportProvider = importProvidersCache.get(sourceFile.fileName) || (yield* makeAutoImportProvider(sourceFile));
|
|
4572
|
+
importProvidersCache.set(sourceFile.fileName, autoImportProvider);
|
|
4573
|
+
return autoImportProvider;
|
|
4574
|
+
});
|
|
4575
|
+
var parseImportOnlyChanges = fn("parseImportOnlyChanges")(function* (sourceFile, changes) {
|
|
4576
|
+
const ts = yield* service(TypeScriptApi);
|
|
4577
|
+
const deletions = [];
|
|
4578
|
+
const imports = [];
|
|
4579
|
+
for (const change of changes) {
|
|
4580
|
+
if (change.newText.length === 0) {
|
|
4581
|
+
deletions.push(change);
|
|
4582
|
+
continue;
|
|
4583
|
+
}
|
|
4584
|
+
if (change.newText.trim().startsWith("import") && change.newText.trim().includes("from")) {
|
|
4585
|
+
try {
|
|
4586
|
+
const parsedImport = ts.createSourceFile("test.ts", change.newText, sourceFile.languageVersion, false);
|
|
4587
|
+
for (const statement of parsedImport.statements) {
|
|
4588
|
+
if (!ts.isImportDeclaration(statement)) return;
|
|
4589
|
+
const moduleSpecifier = statement.moduleSpecifier;
|
|
4590
|
+
if (!ts.isStringLiteral(moduleSpecifier)) return;
|
|
4591
|
+
const moduleName = moduleSpecifier.text;
|
|
4592
|
+
const importClause = statement.importClause;
|
|
4593
|
+
if (!importClause) return;
|
|
4594
|
+
const namedBindings = importClause.namedBindings;
|
|
4595
|
+
if (!namedBindings) return;
|
|
4596
|
+
if (ts.isNamedImports(namedBindings)) {
|
|
4597
|
+
for (const importSpecifier of namedBindings.elements) {
|
|
4598
|
+
if (!ts.isIdentifier(importSpecifier.name)) return;
|
|
4599
|
+
const exportName = importSpecifier.name.text;
|
|
4600
|
+
imports.push({ moduleName, exportName });
|
|
4601
|
+
continue;
|
|
4602
|
+
}
|
|
4603
|
+
} else if (ts.isNamespaceImport(namedBindings)) {
|
|
4604
|
+
imports.push({ moduleName, exportName: void 0 });
|
|
4605
|
+
continue;
|
|
4606
|
+
}
|
|
4607
|
+
}
|
|
4608
|
+
} catch (_) {
|
|
4609
|
+
return;
|
|
4610
|
+
}
|
|
4611
|
+
} else {
|
|
4612
|
+
const ancestorNodes = yield* getAncestorNodesInRange(sourceFile, {
|
|
4613
|
+
pos: change.span.start,
|
|
4614
|
+
end: change.span.start
|
|
4615
|
+
});
|
|
4616
|
+
const importNodes = ancestorNodes.filter((node) => ts.isImportDeclaration(node));
|
|
4617
|
+
const importNode = importNodes[0];
|
|
4618
|
+
if (!importNode) return;
|
|
4619
|
+
const moduleSpecifier = importNode.moduleSpecifier;
|
|
4620
|
+
if (!ts.isStringLiteral(moduleSpecifier)) return;
|
|
4621
|
+
const moduleName = moduleSpecifier.text;
|
|
4622
|
+
const exportName = change.newText.replace(/,/ig, "").trim();
|
|
4623
|
+
if (exportName.length === 0) return;
|
|
4624
|
+
imports.push({ moduleName, exportName });
|
|
4625
|
+
}
|
|
4626
|
+
}
|
|
4627
|
+
return { deletions, imports };
|
|
4632
4628
|
});
|
|
4629
|
+
var addImport = (ts, sourceFile, changeTracker, preferences, effectAutoImport) => {
|
|
4630
|
+
let description = "";
|
|
4631
|
+
switch (effectAutoImport._tag) {
|
|
4632
|
+
case "NamespaceImport": {
|
|
4633
|
+
const importModule = effectAutoImport.moduleName || effectAutoImport.fileName;
|
|
4634
|
+
description = `Import * as ${effectAutoImport.name} from "${importModule}"`;
|
|
4635
|
+
ts.insertImports(
|
|
4636
|
+
changeTracker,
|
|
4637
|
+
sourceFile,
|
|
4638
|
+
ts.factory.createImportDeclaration(
|
|
4639
|
+
void 0,
|
|
4640
|
+
ts.factory.createImportClause(
|
|
4641
|
+
false,
|
|
4642
|
+
void 0,
|
|
4643
|
+
ts.factory.createNamespaceImport(ts.factory.createIdentifier(effectAutoImport.name))
|
|
4644
|
+
),
|
|
4645
|
+
ts.factory.createStringLiteral(importModule)
|
|
4646
|
+
),
|
|
4647
|
+
true,
|
|
4648
|
+
preferences || {}
|
|
4649
|
+
);
|
|
4650
|
+
break;
|
|
4651
|
+
}
|
|
4652
|
+
case "NamedImport": {
|
|
4653
|
+
const importModule = effectAutoImport.moduleName || effectAutoImport.fileName;
|
|
4654
|
+
description = `Import { ${effectAutoImport.name} } from "${importModule}"`;
|
|
4655
|
+
let foundImportDeclaration = false;
|
|
4656
|
+
for (const statement of sourceFile.statements) {
|
|
4657
|
+
if (ts.isImportDeclaration(statement)) {
|
|
4658
|
+
const moduleSpecifier = statement.moduleSpecifier;
|
|
4659
|
+
if (moduleSpecifier && ts.isStringLiteral(moduleSpecifier) && moduleSpecifier.text === importModule) {
|
|
4660
|
+
const importClause = statement.importClause;
|
|
4661
|
+
if (importClause && importClause.namedBindings && ts.isNamedImports(importClause.namedBindings)) {
|
|
4662
|
+
const namedImports = importClause.namedBindings;
|
|
4663
|
+
const existingImportSpecifier = namedImports.elements.find(
|
|
4664
|
+
(element) => element.name.text === effectAutoImport.name
|
|
4665
|
+
);
|
|
4666
|
+
if (existingImportSpecifier) {
|
|
4667
|
+
foundImportDeclaration = true;
|
|
4668
|
+
break;
|
|
4669
|
+
}
|
|
4670
|
+
changeTracker.replaceNode(
|
|
4671
|
+
sourceFile,
|
|
4672
|
+
namedImports,
|
|
4673
|
+
ts.factory.createNamedImports(
|
|
4674
|
+
namedImports.elements.concat([
|
|
4675
|
+
ts.factory.createImportSpecifier(
|
|
4676
|
+
false,
|
|
4677
|
+
void 0,
|
|
4678
|
+
ts.factory.createIdentifier(effectAutoImport.name)
|
|
4679
|
+
)
|
|
4680
|
+
])
|
|
4681
|
+
)
|
|
4682
|
+
);
|
|
4683
|
+
foundImportDeclaration = true;
|
|
4684
|
+
break;
|
|
4685
|
+
}
|
|
4686
|
+
}
|
|
4687
|
+
}
|
|
4688
|
+
}
|
|
4689
|
+
if (!foundImportDeclaration) {
|
|
4690
|
+
ts.insertImports(
|
|
4691
|
+
changeTracker,
|
|
4692
|
+
sourceFile,
|
|
4693
|
+
ts.factory.createImportDeclaration(
|
|
4694
|
+
void 0,
|
|
4695
|
+
ts.factory.createImportClause(
|
|
4696
|
+
false,
|
|
4697
|
+
void 0,
|
|
4698
|
+
ts.factory.createNamedImports(
|
|
4699
|
+
[
|
|
4700
|
+
ts.factory.createImportSpecifier(
|
|
4701
|
+
false,
|
|
4702
|
+
void 0,
|
|
4703
|
+
ts.factory.createIdentifier(effectAutoImport.name)
|
|
4704
|
+
)
|
|
4705
|
+
]
|
|
4706
|
+
)
|
|
4707
|
+
),
|
|
4708
|
+
ts.factory.createStringLiteral(importModule)
|
|
4709
|
+
),
|
|
4710
|
+
true,
|
|
4711
|
+
preferences || {}
|
|
4712
|
+
);
|
|
4713
|
+
}
|
|
4714
|
+
break;
|
|
4715
|
+
}
|
|
4716
|
+
}
|
|
4717
|
+
return { description };
|
|
4718
|
+
};
|
|
4633
4719
|
|
|
4634
4720
|
// src/completions/middlewareAutoImports.ts
|
|
4635
|
-
var importProvidersCache = /* @__PURE__ */ new Map();
|
|
4636
4721
|
var appendEffectCompletionEntryData = fn("appendEffectCompletionEntryData")(
|
|
4637
4722
|
function* (_sourceFile, applicableCompletions) {
|
|
4638
4723
|
const languageServicePluginOptions = yield* service(LanguageServicePluginOptions);
|
|
@@ -4656,7 +4741,6 @@ var appendEffectCompletionEntryData = fn("appendEffectCompletionEntryData")(
|
|
|
4656
4741
|
);
|
|
4657
4742
|
var isAutoImportOnlyCodeActions = fn("isAutoImportOnlyCodeActions")(
|
|
4658
4743
|
function* (sourceFile, codeActions, exportName) {
|
|
4659
|
-
const ts = yield* service(TypeScriptApi);
|
|
4660
4744
|
if (!codeActions) return;
|
|
4661
4745
|
if (codeActions.length !== 1) return;
|
|
4662
4746
|
const action = codeActions[0];
|
|
@@ -4665,25 +4749,12 @@ var isAutoImportOnlyCodeActions = fn("isAutoImportOnlyCodeActions")(
|
|
|
4665
4749
|
const fileTextChanges = action.changes[0];
|
|
4666
4750
|
if (fileTextChanges.fileName !== sourceFile.fileName) return;
|
|
4667
4751
|
const textChanges = fileTextChanges.textChanges;
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
if (
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
}
|
|
4675
|
-
if (change.newText.indexOf(exportName) > -1) {
|
|
4676
|
-
const ancestorNodes = yield* getAncestorNodesInRange(sourceFile, {
|
|
4677
|
-
pos: change.span.start,
|
|
4678
|
-
end: change.span.start
|
|
4679
|
-
});
|
|
4680
|
-
const importNodes = ancestorNodes.filter((node) => ts.isImportDeclaration(node));
|
|
4681
|
-
if (importNodes.length > 0) {
|
|
4682
|
-
return {
|
|
4683
|
-
type: "update"
|
|
4684
|
-
};
|
|
4685
|
-
}
|
|
4686
|
-
}
|
|
4752
|
+
const parsedImportChanges = yield* parseImportOnlyChanges(sourceFile, textChanges);
|
|
4753
|
+
if (!parsedImportChanges) return;
|
|
4754
|
+
if (parsedImportChanges.deletions.length !== 0) return;
|
|
4755
|
+
if (parsedImportChanges.imports.length !== 1) return;
|
|
4756
|
+
if (parsedImportChanges.imports[0].exportName !== exportName) return;
|
|
4757
|
+
return parsedImportChanges.imports[0];
|
|
4687
4758
|
}
|
|
4688
4759
|
);
|
|
4689
4760
|
var addImportCodeAction = fn("getImportFromNamespaceCodeActions")(function* (formatOptions, preferences, languageServiceHost, sourceFile, effectReplaceSpan, effectAutoImport) {
|
|
@@ -4707,92 +4778,13 @@ var addImportCodeAction = fn("getImportFromNamespaceCodeActions")(function* (for
|
|
|
4707
4778
|
effectAutoImport.introducedPrefix + "."
|
|
4708
4779
|
);
|
|
4709
4780
|
}
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
ts.factory.createImportDeclaration(
|
|
4718
|
-
void 0,
|
|
4719
|
-
ts.factory.createImportClause(
|
|
4720
|
-
false,
|
|
4721
|
-
void 0,
|
|
4722
|
-
ts.factory.createNamespaceImport(ts.factory.createIdentifier(effectAutoImport.name))
|
|
4723
|
-
),
|
|
4724
|
-
ts.factory.createStringLiteral(importModule)
|
|
4725
|
-
),
|
|
4726
|
-
true,
|
|
4727
|
-
preferences || {}
|
|
4728
|
-
);
|
|
4729
|
-
break;
|
|
4730
|
-
}
|
|
4731
|
-
case "NamedImport": {
|
|
4732
|
-
const importModule = effectAutoImport.moduleName || effectAutoImport.fileName;
|
|
4733
|
-
description = `Import { ${effectAutoImport.name} } from "${importModule}"`;
|
|
4734
|
-
let foundImportDeclaration = false;
|
|
4735
|
-
for (const statement of sourceFile.statements) {
|
|
4736
|
-
if (ts.isImportDeclaration(statement)) {
|
|
4737
|
-
const moduleSpecifier = statement.moduleSpecifier;
|
|
4738
|
-
if (moduleSpecifier && ts.isStringLiteral(moduleSpecifier) && moduleSpecifier.text === importModule) {
|
|
4739
|
-
const importClause = statement.importClause;
|
|
4740
|
-
if (importClause && importClause.namedBindings && ts.isNamedImports(importClause.namedBindings)) {
|
|
4741
|
-
const namedImports = importClause.namedBindings;
|
|
4742
|
-
const existingImportSpecifier = namedImports.elements.find(
|
|
4743
|
-
(element) => element.name.text === effectAutoImport.name
|
|
4744
|
-
);
|
|
4745
|
-
if (existingImportSpecifier) {
|
|
4746
|
-
foundImportDeclaration = true;
|
|
4747
|
-
break;
|
|
4748
|
-
}
|
|
4749
|
-
changeTracker.replaceNode(
|
|
4750
|
-
sourceFile,
|
|
4751
|
-
namedImports,
|
|
4752
|
-
ts.factory.createNamedImports(
|
|
4753
|
-
namedImports.elements.concat([
|
|
4754
|
-
ts.factory.createImportSpecifier(
|
|
4755
|
-
false,
|
|
4756
|
-
void 0,
|
|
4757
|
-
ts.factory.createIdentifier(effectAutoImport.name)
|
|
4758
|
-
)
|
|
4759
|
-
])
|
|
4760
|
-
)
|
|
4761
|
-
);
|
|
4762
|
-
foundImportDeclaration = true;
|
|
4763
|
-
break;
|
|
4764
|
-
}
|
|
4765
|
-
}
|
|
4766
|
-
}
|
|
4767
|
-
}
|
|
4768
|
-
if (!foundImportDeclaration) {
|
|
4769
|
-
ts.insertImports(
|
|
4770
|
-
changeTracker,
|
|
4771
|
-
sourceFile,
|
|
4772
|
-
ts.factory.createImportDeclaration(
|
|
4773
|
-
void 0,
|
|
4774
|
-
ts.factory.createImportClause(
|
|
4775
|
-
false,
|
|
4776
|
-
void 0,
|
|
4777
|
-
ts.factory.createNamedImports(
|
|
4778
|
-
[
|
|
4779
|
-
ts.factory.createImportSpecifier(
|
|
4780
|
-
false,
|
|
4781
|
-
void 0,
|
|
4782
|
-
ts.factory.createIdentifier(effectAutoImport.name)
|
|
4783
|
-
)
|
|
4784
|
-
]
|
|
4785
|
-
)
|
|
4786
|
-
),
|
|
4787
|
-
ts.factory.createStringLiteral(importModule)
|
|
4788
|
-
),
|
|
4789
|
-
true,
|
|
4790
|
-
preferences || {}
|
|
4791
|
-
);
|
|
4792
|
-
}
|
|
4793
|
-
break;
|
|
4794
|
-
}
|
|
4795
|
-
}
|
|
4781
|
+
description = addImport(
|
|
4782
|
+
ts,
|
|
4783
|
+
sourceFile,
|
|
4784
|
+
changeTracker,
|
|
4785
|
+
preferences,
|
|
4786
|
+
effectAutoImport
|
|
4787
|
+
).description;
|
|
4796
4788
|
}
|
|
4797
4789
|
);
|
|
4798
4790
|
return [
|
|
@@ -4820,9 +4812,8 @@ var postprocessCompletionEntryDetails = fn("postprocessCompletionEntryDetails")(
|
|
|
4820
4812
|
exportName
|
|
4821
4813
|
);
|
|
4822
4814
|
if (!result) return applicableCompletionEntryDetails;
|
|
4823
|
-
const
|
|
4824
|
-
|
|
4825
|
-
const effectAutoImport = packagesMetadata(fileName, exportName);
|
|
4815
|
+
const autoImportProvider = yield* getOrMakeAutoImportProvider(sourceFile);
|
|
4816
|
+
const effectAutoImport = autoImportProvider.resolve(fileName, exportName);
|
|
4826
4817
|
if (!effectAutoImport) return applicableCompletionEntryDetails;
|
|
4827
4818
|
const codeActions = yield* addImportCodeAction(
|
|
4828
4819
|
formatOptions,
|
|
@@ -4839,6 +4830,74 @@ var postprocessCompletionEntryDetails = fn("postprocessCompletionEntryDetails")(
|
|
|
4839
4830
|
}
|
|
4840
4831
|
);
|
|
4841
4832
|
|
|
4833
|
+
// src/diagnostics/middlewareAutoImportQuickfixes.ts
|
|
4834
|
+
var middlewareAutoImportQuickfixes = fn("middlewareAutoImportQuickfixes")(function* (sourceFile, languageServiceHost, formatOptions, preferences, codeFixes) {
|
|
4835
|
+
const ts = yield* service(TypeScriptApi);
|
|
4836
|
+
const program = yield* service(TypeScriptProgram);
|
|
4837
|
+
const autoImportProvider = yield* getOrMakeAutoImportProvider(sourceFile);
|
|
4838
|
+
const changedCodeFixes = [];
|
|
4839
|
+
const createImportAllChanges = (imports) => gen(function* () {
|
|
4840
|
+
const newImports = [];
|
|
4841
|
+
for (const importToAdd of imports) {
|
|
4842
|
+
if (!importToAdd.exportName) return;
|
|
4843
|
+
const fileName = ts.resolveModuleName(
|
|
4844
|
+
importToAdd.moduleName,
|
|
4845
|
+
sourceFile.fileName,
|
|
4846
|
+
program.getCompilerOptions(),
|
|
4847
|
+
program
|
|
4848
|
+
);
|
|
4849
|
+
if (!fileName.resolvedModule) return;
|
|
4850
|
+
const importKind = autoImportProvider.resolve(fileName.resolvedModule.resolvedFileName, importToAdd.exportName);
|
|
4851
|
+
if (!importKind) return;
|
|
4852
|
+
if (importKind.introducedPrefix) return;
|
|
4853
|
+
newImports.push(importKind);
|
|
4854
|
+
}
|
|
4855
|
+
const formatContext = ts.formatting.getFormatContext(
|
|
4856
|
+
formatOptions,
|
|
4857
|
+
languageServiceHost
|
|
4858
|
+
);
|
|
4859
|
+
const edits = ts.textChanges.ChangeTracker.with(
|
|
4860
|
+
{
|
|
4861
|
+
formatContext,
|
|
4862
|
+
host: languageServiceHost,
|
|
4863
|
+
preferences: preferences || {}
|
|
4864
|
+
},
|
|
4865
|
+
(changeTracker) => newImports.forEach((_) => addImport(ts, sourceFile, changeTracker, preferences, _))
|
|
4866
|
+
);
|
|
4867
|
+
return edits;
|
|
4868
|
+
});
|
|
4869
|
+
for (const codeFix of codeFixes) {
|
|
4870
|
+
const textFileChanges = codeFix.changes;
|
|
4871
|
+
if (textFileChanges.length !== 1) {
|
|
4872
|
+
changedCodeFixes.push(codeFix);
|
|
4873
|
+
continue;
|
|
4874
|
+
}
|
|
4875
|
+
if (textFileChanges[0].fileName !== sourceFile.fileName) {
|
|
4876
|
+
changedCodeFixes.push(codeFix);
|
|
4877
|
+
continue;
|
|
4878
|
+
}
|
|
4879
|
+
const parsedChanges = yield* parseImportOnlyChanges(sourceFile, textFileChanges[0].textChanges);
|
|
4880
|
+
if (!parsedChanges) {
|
|
4881
|
+
changedCodeFixes.push(codeFix);
|
|
4882
|
+
continue;
|
|
4883
|
+
}
|
|
4884
|
+
if (parsedChanges.deletions.length !== 0) {
|
|
4885
|
+
changedCodeFixes.push(codeFix);
|
|
4886
|
+
continue;
|
|
4887
|
+
}
|
|
4888
|
+
const changes = yield* pipe(
|
|
4889
|
+
createImportAllChanges(parsedChanges.imports),
|
|
4890
|
+
orElse2(() => succeed(codeFix.changes))
|
|
4891
|
+
);
|
|
4892
|
+
if (changes) {
|
|
4893
|
+
changedCodeFixes.push({ ...codeFix, changes });
|
|
4894
|
+
} else {
|
|
4895
|
+
changedCodeFixes.push(codeFix);
|
|
4896
|
+
}
|
|
4897
|
+
}
|
|
4898
|
+
return changedCodeFixes;
|
|
4899
|
+
});
|
|
4900
|
+
|
|
4842
4901
|
// src/goto/effectRpcDefinition.ts
|
|
4843
4902
|
function effectRpcDefinition(applicableGotoDefinition, sourceFile, position) {
|
|
4844
4903
|
return gen(function* () {
|
|
@@ -5062,6 +5121,41 @@ function effectTypeArgs(sourceFile, position, quickInfo2) {
|
|
|
5062
5121
|
);
|
|
5063
5122
|
}
|
|
5064
5123
|
|
|
5124
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/encoding/common.js
|
|
5125
|
+
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
5126
|
+
|
|
5127
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/encoding/base64.js
|
|
5128
|
+
var encode = (bytes) => {
|
|
5129
|
+
const length = bytes.length;
|
|
5130
|
+
let result = "";
|
|
5131
|
+
let i;
|
|
5132
|
+
for (i = 2; i < length; i += 3) {
|
|
5133
|
+
result += base64abc[bytes[i - 2] >> 2];
|
|
5134
|
+
result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
5135
|
+
result += base64abc[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];
|
|
5136
|
+
result += base64abc[bytes[i] & 63];
|
|
5137
|
+
}
|
|
5138
|
+
if (i === length + 1) {
|
|
5139
|
+
result += base64abc[bytes[i - 2] >> 2];
|
|
5140
|
+
result += base64abc[(bytes[i - 2] & 3) << 4];
|
|
5141
|
+
result += "==";
|
|
5142
|
+
}
|
|
5143
|
+
if (i === length) {
|
|
5144
|
+
result += base64abc[bytes[i - 2] >> 2];
|
|
5145
|
+
result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
5146
|
+
result += base64abc[(bytes[i - 1] & 15) << 2];
|
|
5147
|
+
result += "=";
|
|
5148
|
+
}
|
|
5149
|
+
return result;
|
|
5150
|
+
};
|
|
5151
|
+
var base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"];
|
|
5152
|
+
|
|
5153
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/encoding/base64Url.js
|
|
5154
|
+
var encode2 = (data) => encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
5155
|
+
|
|
5156
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Encoding.js
|
|
5157
|
+
var encodeBase64Url = (input) => typeof input === "string" ? encode2(encoder.encode(input)) : encode2(input);
|
|
5158
|
+
|
|
5065
5159
|
// node_modules/.pnpm/pako@2.1.0/node_modules/pako/dist/pako.esm.mjs
|
|
5066
5160
|
var Z_FIXED$1 = 4;
|
|
5067
5161
|
var Z_BINARY = 0;
|
|
@@ -9282,7 +9376,7 @@ function processLayerGraphNode(ctx, node, pipedInGraphNode) {
|
|
|
9282
9376
|
const maybeLayer = yield* option(typeParser.layerType(type, node));
|
|
9283
9377
|
if (isSome2(maybeLayer)) {
|
|
9284
9378
|
const argNodes = yield* option(
|
|
9285
|
-
|
|
9379
|
+
all(...node.arguments.map((_) => processLayerGraphNode(ctx, _, void 0)))
|
|
9286
9380
|
);
|
|
9287
9381
|
if (isSome2(argNodes) && argNodes.value.length === node.arguments.length) {
|
|
9288
9382
|
const { allIndexes: outTypes } = yield* appendToUniqueTypesMap(
|
|
@@ -9326,7 +9420,7 @@ function processLayerGraphNode(ctx, node, pipedInGraphNode) {
|
|
|
9326
9420
|
);
|
|
9327
9421
|
if (ts.isCallExpression(node)) {
|
|
9328
9422
|
const argNodes = yield* option(
|
|
9329
|
-
|
|
9423
|
+
all(...node.arguments.map((_) => processLayerGraphNode(ctx, _, void 0)))
|
|
9330
9424
|
);
|
|
9331
9425
|
if (isSome2(argNodes) && argNodes.value.length === node.arguments.length) {
|
|
9332
9426
|
return new GraphNodeCompoundTransform(
|
|
@@ -9456,7 +9550,7 @@ function processNodeMermaid(graph, ctx, ctxL) {
|
|
|
9456
9550
|
return subgraphDefs;
|
|
9457
9551
|
}
|
|
9458
9552
|
case "GraphNodeCompoundTransform": {
|
|
9459
|
-
const childs = flatten(yield*
|
|
9553
|
+
const childs = flatten(yield* all(...graph.args.map((_) => processNodeMermaid(_, ctx, ctxL))));
|
|
9460
9554
|
let currentEdges = [];
|
|
9461
9555
|
const connectedNodes = /* @__PURE__ */ new Set();
|
|
9462
9556
|
for (const requiredServiceKey of graph.rin) {
|
|
@@ -10241,7 +10335,7 @@ var pipeableToDatafirst = createRefactor({
|
|
|
10241
10335
|
for (let i = 0; i < callSignatures.length; i++) {
|
|
10242
10336
|
const callSignature = callSignatures[i];
|
|
10243
10337
|
if (callSignature.parameters.length === node2.arguments.length + 1) {
|
|
10244
|
-
return
|
|
10338
|
+
return some2(
|
|
10245
10339
|
ts.factory.createCallExpression(
|
|
10246
10340
|
node2.expression,
|
|
10247
10341
|
[],
|
|
@@ -10283,7 +10377,7 @@ var pipeableToDatafirst = createRefactor({
|
|
|
10283
10377
|
}
|
|
10284
10378
|
}
|
|
10285
10379
|
}
|
|
10286
|
-
return didSomething ?
|
|
10380
|
+
return didSomething ? some2([node2, newNode2]) : none2();
|
|
10287
10381
|
}),
|
|
10288
10382
|
filter(isSome2),
|
|
10289
10383
|
map3((_) => _.value),
|
|
@@ -10611,17 +10705,17 @@ var makeSchemaGenContext = fn("SchemaGen.makeSchemaGenContext")(function* (sourc
|
|
|
10611
10705
|
case "Pick":
|
|
10612
10706
|
case "Omit":
|
|
10613
10707
|
case "Record":
|
|
10614
|
-
return
|
|
10708
|
+
return some2(name.text);
|
|
10615
10709
|
case "ReadonlyArray":
|
|
10616
10710
|
case "Array":
|
|
10617
|
-
return
|
|
10711
|
+
return some2("Array");
|
|
10618
10712
|
}
|
|
10619
10713
|
return none2();
|
|
10620
10714
|
}
|
|
10621
10715
|
if (!ts.isIdentifier(name.left)) return none2();
|
|
10622
10716
|
for (const moduleName in moduleToImportedName) {
|
|
10623
10717
|
if (name.left.text === moduleToImportedName[moduleName] && name.right.text === moduleName) {
|
|
10624
|
-
return
|
|
10718
|
+
return some2(moduleName);
|
|
10625
10719
|
}
|
|
10626
10720
|
}
|
|
10627
10721
|
return none2();
|
|
@@ -10660,7 +10754,7 @@ var parseAllLiterals = fn(
|
|
|
10660
10754
|
}
|
|
10661
10755
|
}
|
|
10662
10756
|
if (ts.isUnionTypeNode(node)) {
|
|
10663
|
-
return flatten(yield*
|
|
10757
|
+
return flatten(yield* all(...node.types.map((_) => parseAllLiterals(_))));
|
|
10664
10758
|
}
|
|
10665
10759
|
if (ts.isParenthesizedTypeNode(node)) {
|
|
10666
10760
|
return yield* parseAllLiterals(node.type);
|
|
@@ -10707,11 +10801,11 @@ var processNode = (node, isVirtualTypeNode) => gen(function* () {
|
|
|
10707
10801
|
if (ts.isUnionTypeNode(node)) {
|
|
10708
10802
|
const allLiterals = yield* option(parseAllLiterals(node));
|
|
10709
10803
|
if (isSome2(allLiterals)) return createApiCall("Literal", allLiterals.value);
|
|
10710
|
-
const members = yield*
|
|
10804
|
+
const members = yield* all(...node.types.map((_) => processNode(_, isVirtualTypeNode)));
|
|
10711
10805
|
return createApiCall("Union", members);
|
|
10712
10806
|
}
|
|
10713
10807
|
if (ts.isIntersectionTypeNode(node)) {
|
|
10714
|
-
const [firstSchema, ...otherSchemas] = yield*
|
|
10808
|
+
const [firstSchema, ...otherSchemas] = yield* all(
|
|
10715
10809
|
...node.types.map((_) => processNode(_, isVirtualTypeNode))
|
|
10716
10810
|
);
|
|
10717
10811
|
if (otherSchemas.length === 0) return firstSchema;
|
|
@@ -10767,13 +10861,13 @@ var processNode = (node, isVirtualTypeNode) => gen(function* () {
|
|
|
10767
10861
|
case "Option":
|
|
10768
10862
|
case "Chunk":
|
|
10769
10863
|
case "Array": {
|
|
10770
|
-
const elements = yield*
|
|
10864
|
+
const elements = yield* all(
|
|
10771
10865
|
...node.typeArguments ? node.typeArguments.map((_) => processNode(_, isVirtualTypeNode)) : []
|
|
10772
10866
|
);
|
|
10773
10867
|
return createApiCall(parsedName.value, elements);
|
|
10774
10868
|
}
|
|
10775
10869
|
case "Record": {
|
|
10776
|
-
const elements = yield*
|
|
10870
|
+
const elements = yield* all(
|
|
10777
10871
|
...node.typeArguments ? node.typeArguments.map((_) => processNode(_, isVirtualTypeNode)) : []
|
|
10778
10872
|
);
|
|
10779
10873
|
if (elements.length >= 2) {
|
|
@@ -10787,7 +10881,7 @@ var processNode = (node, isVirtualTypeNode) => gen(function* () {
|
|
|
10787
10881
|
return createUnsupportedNodeComment(ts, sourceFile, node);
|
|
10788
10882
|
}
|
|
10789
10883
|
case "Either": {
|
|
10790
|
-
const elements = yield*
|
|
10884
|
+
const elements = yield* all(
|
|
10791
10885
|
...node.typeArguments ? node.typeArguments.map((_) => processNode(_, isVirtualTypeNode)) : []
|
|
10792
10886
|
);
|
|
10793
10887
|
if (elements.length >= 2) {
|
|
@@ -11494,45 +11588,60 @@ var init = (modules) => {
|
|
|
11494
11588
|
preferences,
|
|
11495
11589
|
...args2
|
|
11496
11590
|
);
|
|
11497
|
-
|
|
11498
|
-
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
info.languageServiceHost
|
|
11510
|
-
);
|
|
11511
|
-
for (const applicableFix of applicableFixes) {
|
|
11512
|
-
const changes = modules.typescript.textChanges.ChangeTracker.with(
|
|
11513
|
-
{
|
|
11514
|
-
formatContext,
|
|
11515
|
-
host: info.languageServiceHost,
|
|
11516
|
-
preferences: preferences || {}
|
|
11517
|
-
},
|
|
11518
|
-
(changeTracker) => pipe(
|
|
11519
|
-
applicableFix.apply,
|
|
11520
|
-
provideService(ChangeTracker, changeTracker),
|
|
11521
|
-
run
|
|
11522
|
-
)
|
|
11591
|
+
const program = languageService.getProgram();
|
|
11592
|
+
if (languageServicePluginOptions.diagnostics && program) {
|
|
11593
|
+
const sourceFile = program.getSourceFile(fileName);
|
|
11594
|
+
if (sourceFile) {
|
|
11595
|
+
return pipe(
|
|
11596
|
+
sync(() => {
|
|
11597
|
+
const effectCodeFixes = [];
|
|
11598
|
+
if (!effectCodeFixesForFile.has(fileName)) {
|
|
11599
|
+
runDiagnosticsAndCacheCodeFixes(fileName);
|
|
11600
|
+
}
|
|
11601
|
+
const applicableFixes = (effectCodeFixesForFile.get(fileName) || []).filter(
|
|
11602
|
+
(_) => _.start === start && _.end === end && errorCodes.indexOf(_.code) > -1
|
|
11523
11603
|
);
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11604
|
+
const formatContext = modules.typescript.formatting.getFormatContext(
|
|
11605
|
+
formatOptions,
|
|
11606
|
+
info.languageServiceHost
|
|
11607
|
+
);
|
|
11608
|
+
for (const applicableFix of applicableFixes) {
|
|
11609
|
+
const changes = modules.typescript.textChanges.ChangeTracker.with(
|
|
11610
|
+
{
|
|
11611
|
+
formatContext,
|
|
11612
|
+
host: info.languageServiceHost,
|
|
11613
|
+
preferences: preferences || {}
|
|
11614
|
+
},
|
|
11615
|
+
(changeTracker) => pipe(
|
|
11616
|
+
applicableFix.apply,
|
|
11617
|
+
provideService(ChangeTracker, changeTracker),
|
|
11618
|
+
run
|
|
11619
|
+
)
|
|
11620
|
+
);
|
|
11621
|
+
effectCodeFixes.push({
|
|
11622
|
+
fixName: applicableFix.fixName,
|
|
11623
|
+
description: applicableFix.description,
|
|
11624
|
+
changes
|
|
11625
|
+
});
|
|
11626
|
+
}
|
|
11627
|
+
return effectCodeFixes;
|
|
11628
|
+
}),
|
|
11629
|
+
flatMap2(
|
|
11630
|
+
(effectCodeFixes) => pipe(
|
|
11631
|
+
middlewareAutoImportQuickfixes(
|
|
11632
|
+
sourceFile,
|
|
11633
|
+
info.languageServiceHost,
|
|
11634
|
+
formatOptions,
|
|
11635
|
+
preferences,
|
|
11636
|
+
applicableCodeFixes
|
|
11637
|
+
),
|
|
11638
|
+
map4((modifiedCodeFixes) => effectCodeFixes.concat(modifiedCodeFixes))
|
|
11639
|
+
)
|
|
11640
|
+
),
|
|
11641
|
+
runNano(program),
|
|
11642
|
+
getOrElse(() => applicableCodeFixes)
|
|
11643
|
+
);
|
|
11644
|
+
}
|
|
11536
11645
|
}
|
|
11537
11646
|
return applicableCodeFixes;
|
|
11538
11647
|
};
|