@effect/language-service 0.45.0 → 0.45.1
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/cli.js +613 -558
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +73 -23
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +78 -28
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +73 -23
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm/effect@3.
|
|
3
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Function.js
|
|
4
4
|
var isFunction = (input) => typeof input === "function";
|
|
5
5
|
var dual = function(arity, body) {
|
|
6
6
|
if (typeof arity === "function") {
|
|
@@ -96,7 +96,7 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
// node_modules/.pnpm/effect@3.
|
|
99
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Equivalence.js
|
|
100
100
|
var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
101
101
|
var array = (item) => make((self, that) => {
|
|
102
102
|
if (self.length !== that.length) {
|
|
@@ -111,7 +111,7 @@ var array = (item) => make((self, that) => {
|
|
|
111
111
|
return true;
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
// node_modules/.pnpm/effect@3.
|
|
114
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/GlobalValue.js
|
|
115
115
|
var globalStoreId = `effect/GlobalValue`;
|
|
116
116
|
var globalStore;
|
|
117
117
|
var globalValue = (id, compute) => {
|
|
@@ -125,7 +125,7 @@ var globalValue = (id, compute) => {
|
|
|
125
125
|
return globalStore.get(id);
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
// node_modules/.pnpm/effect@3.
|
|
128
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Predicate.js
|
|
129
129
|
var isString = (input) => typeof input === "string";
|
|
130
130
|
var isNumber = (input) => typeof input === "number";
|
|
131
131
|
var isBoolean = (input) => typeof input === "boolean";
|
|
@@ -135,7 +135,7 @@ var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
|
|
|
135
135
|
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
|
|
136
136
|
var isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input);
|
|
137
137
|
|
|
138
|
-
// node_modules/.pnpm/effect@3.
|
|
138
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Utils.js
|
|
139
139
|
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
|
|
140
140
|
var GenKindImpl = class {
|
|
141
141
|
value;
|
|
@@ -257,7 +257,7 @@ var internalCall = isNotOptimizedAway ? standard.effect_internal_function : forc
|
|
|
257
257
|
var genConstructor = function* () {
|
|
258
258
|
}.constructor;
|
|
259
259
|
|
|
260
|
-
// node_modules/.pnpm/effect@3.
|
|
260
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Hash.js
|
|
261
261
|
var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
|
|
262
262
|
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
263
263
|
var hash = (self) => {
|
|
@@ -356,7 +356,7 @@ var cached = function() {
|
|
|
356
356
|
return hash2;
|
|
357
357
|
};
|
|
358
358
|
|
|
359
|
-
// node_modules/.pnpm/effect@3.
|
|
359
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Equal.js
|
|
360
360
|
var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
|
|
361
361
|
function equals() {
|
|
362
362
|
if (arguments.length === 1) {
|
|
@@ -410,7 +410,7 @@ function compareBoth(self, that) {
|
|
|
410
410
|
var isEqual = (u) => hasProperty(u, symbol2);
|
|
411
411
|
var equivalence = () => equals;
|
|
412
412
|
|
|
413
|
-
// node_modules/.pnpm/effect@3.
|
|
413
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Inspectable.js
|
|
414
414
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
415
415
|
var toJSON = (x) => {
|
|
416
416
|
try {
|
|
@@ -462,7 +462,7 @@ var redact = (u) => {
|
|
|
462
462
|
return u;
|
|
463
463
|
};
|
|
464
464
|
|
|
465
|
-
// node_modules/.pnpm/effect@3.
|
|
465
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Pipeable.js
|
|
466
466
|
var pipeArguments = (self, args2) => {
|
|
467
467
|
switch (args2.length) {
|
|
468
468
|
case 0:
|
|
@@ -495,14 +495,14 @@ var pipeArguments = (self, args2) => {
|
|
|
495
495
|
}
|
|
496
496
|
};
|
|
497
497
|
|
|
498
|
-
// node_modules/.pnpm/effect@3.
|
|
498
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/opCodes/effect.js
|
|
499
499
|
var OP_COMMIT = "Commit";
|
|
500
500
|
|
|
501
|
-
// node_modules/.pnpm/effect@3.
|
|
502
|
-
var moduleVersion = "3.
|
|
501
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/version.js
|
|
502
|
+
var moduleVersion = "3.18.4";
|
|
503
503
|
var getCurrentVersion = () => moduleVersion;
|
|
504
504
|
|
|
505
|
-
// node_modules/.pnpm/effect@3.
|
|
505
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/effectable.js
|
|
506
506
|
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
507
507
|
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
508
508
|
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
@@ -589,7 +589,7 @@ var StructuralCommitPrototype = {
|
|
|
589
589
|
...StructuralPrototype
|
|
590
590
|
};
|
|
591
591
|
|
|
592
|
-
// node_modules/.pnpm/effect@3.
|
|
592
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/option.js
|
|
593
593
|
var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
594
594
|
var CommonProto = {
|
|
595
595
|
...EffectPrototype,
|
|
@@ -647,7 +647,7 @@ var some = (value) => {
|
|
|
647
647
|
return a;
|
|
648
648
|
};
|
|
649
649
|
|
|
650
|
-
// node_modules/.pnpm/effect@3.
|
|
650
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/either.js
|
|
651
651
|
var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
|
|
652
652
|
var CommonProto2 = {
|
|
653
653
|
...EffectPrototype,
|
|
@@ -709,7 +709,7 @@ var right = (right3) => {
|
|
|
709
709
|
return a;
|
|
710
710
|
};
|
|
711
711
|
|
|
712
|
-
// node_modules/.pnpm/effect@3.
|
|
712
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Either.js
|
|
713
713
|
var right2 = right;
|
|
714
714
|
var left2 = left;
|
|
715
715
|
var isLeft2 = isLeft;
|
|
@@ -717,14 +717,14 @@ var isRight2 = isRight;
|
|
|
717
717
|
var map = /* @__PURE__ */ dual(2, (self, f) => isRight2(self) ? right2(f(self.right)) : left2(self.left));
|
|
718
718
|
var getOrElse = /* @__PURE__ */ dual(2, (self, onLeft) => isLeft2(self) ? onLeft(self.left) : self.right);
|
|
719
719
|
|
|
720
|
-
// node_modules/.pnpm/effect@3.
|
|
720
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/array.js
|
|
721
721
|
var isNonEmptyArray = (self) => self.length > 0;
|
|
722
722
|
|
|
723
|
-
// node_modules/.pnpm/effect@3.
|
|
723
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Order.js
|
|
724
724
|
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
725
725
|
var string2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
|
|
726
726
|
|
|
727
|
-
// node_modules/.pnpm/effect@3.
|
|
727
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Option.js
|
|
728
728
|
var none2 = () => none;
|
|
729
729
|
var some2 = some;
|
|
730
730
|
var isNone2 = isNone;
|
|
@@ -735,7 +735,7 @@ var fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nu
|
|
|
735
735
|
var getOrUndefined = /* @__PURE__ */ getOrElse2(constUndefined);
|
|
736
736
|
var map2 = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
|
|
737
737
|
|
|
738
|
-
// node_modules/.pnpm/effect@3.
|
|
738
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Record.js
|
|
739
739
|
var map3 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
740
740
|
const out = {
|
|
741
741
|
...self
|
|
@@ -747,7 +747,7 @@ var map3 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
747
747
|
});
|
|
748
748
|
var keys = (self) => Object.keys(self);
|
|
749
749
|
|
|
750
|
-
// node_modules/.pnpm/effect@3.
|
|
750
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Array.js
|
|
751
751
|
var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
|
|
752
752
|
var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
|
|
753
753
|
var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable(self).concat(fromIterable(that)));
|
|
@@ -3951,10 +3951,10 @@ var effectDataClasses = createCompletion({
|
|
|
3951
3951
|
})
|
|
3952
3952
|
});
|
|
3953
3953
|
|
|
3954
|
-
// node_modules/.pnpm/effect@3.
|
|
3954
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/encoding/common.js
|
|
3955
3955
|
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
3956
3956
|
|
|
3957
|
-
// node_modules/.pnpm/effect@3.
|
|
3957
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/encoding/base64.js
|
|
3958
3958
|
var encode = (bytes) => {
|
|
3959
3959
|
const length = bytes.length;
|
|
3960
3960
|
let result = "";
|
|
@@ -3980,10 +3980,10 @@ var encode = (bytes) => {
|
|
|
3980
3980
|
};
|
|
3981
3981
|
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", "+", "/"];
|
|
3982
3982
|
|
|
3983
|
-
// node_modules/.pnpm/effect@3.
|
|
3983
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/encoding/base64Url.js
|
|
3984
3984
|
var encode2 = (data) => encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
3985
3985
|
|
|
3986
|
-
// node_modules/.pnpm/effect@3.
|
|
3986
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Encoding.js
|
|
3987
3987
|
var encodeBase64Url = (input) => typeof input === "string" ? encode2(encoder.encode(input)) : encode2(input);
|
|
3988
3988
|
|
|
3989
3989
|
// src/diagnostics/classSelfMismatch.ts
|
|
@@ -5347,17 +5347,67 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
5347
5347
|
const members = node.members;
|
|
5348
5348
|
for (const member of members) {
|
|
5349
5349
|
if (ts.isConstructorDeclaration(member)) {
|
|
5350
|
+
const fixAsStaticNew = {
|
|
5351
|
+
fixName: "overriddenSchemaConstructor_static",
|
|
5352
|
+
description: "Rewrite using the static 'new' pattern",
|
|
5353
|
+
apply: gen(function* () {
|
|
5354
|
+
const changeTracker = yield* service(ChangeTracker);
|
|
5355
|
+
const visitor = (node2) => {
|
|
5356
|
+
if (ts.isExpressionStatement(node2) && ts.isCallExpression(node2.expression) && ts.isToken(node2.expression.expression) && node2.expression.expression.kind === ts.SyntaxKind.SuperKeyword) {
|
|
5357
|
+
const constructThis = ts.factory.createNewExpression(
|
|
5358
|
+
ts.factory.createIdentifier("this"),
|
|
5359
|
+
void 0,
|
|
5360
|
+
node2.expression.arguments
|
|
5361
|
+
);
|
|
5362
|
+
return ts.factory.createVariableStatement(
|
|
5363
|
+
void 0,
|
|
5364
|
+
ts.factory.createVariableDeclarationList(
|
|
5365
|
+
[ts.factory.createVariableDeclaration(
|
|
5366
|
+
"_this",
|
|
5367
|
+
void 0,
|
|
5368
|
+
void 0,
|
|
5369
|
+
constructThis
|
|
5370
|
+
)],
|
|
5371
|
+
ts.NodeFlags.Const
|
|
5372
|
+
)
|
|
5373
|
+
);
|
|
5374
|
+
}
|
|
5375
|
+
if (ts.isToken(node2) && node2.kind === ts.SyntaxKind.ThisKeyword) {
|
|
5376
|
+
return ts.factory.createIdentifier("_this");
|
|
5377
|
+
}
|
|
5378
|
+
return ts.visitEachChild(node2, visitor, ts.nullTransformationContext);
|
|
5379
|
+
};
|
|
5380
|
+
const newBody = visitor(member.body);
|
|
5381
|
+
const bodyWithReturn = ts.factory.updateBlock(
|
|
5382
|
+
newBody,
|
|
5383
|
+
newBody.statements.concat([
|
|
5384
|
+
ts.factory.createReturnStatement(ts.factory.createIdentifier("_this"))
|
|
5385
|
+
])
|
|
5386
|
+
);
|
|
5387
|
+
const newMethod = ts.factory.createMethodDeclaration(
|
|
5388
|
+
ts.factory.createModifiersFromModifierFlags(ts.ModifierFlags.Public | ts.ModifierFlags.Static),
|
|
5389
|
+
void 0,
|
|
5390
|
+
"new",
|
|
5391
|
+
void 0,
|
|
5392
|
+
member.typeParameters,
|
|
5393
|
+
member.parameters,
|
|
5394
|
+
member.type,
|
|
5395
|
+
bodyWithReturn
|
|
5396
|
+
);
|
|
5397
|
+
changeTracker.replaceNode(sourceFile, member, newMethod);
|
|
5398
|
+
})
|
|
5399
|
+
};
|
|
5350
5400
|
report({
|
|
5351
5401
|
location: member,
|
|
5352
|
-
messageText: "Classes extending Schema must not override the constructor",
|
|
5353
|
-
fixes: [{
|
|
5402
|
+
messageText: "Classes extending Schema must not override the constructor; this is because it silently breaks the schema decoding behaviour. If that's needed, we recommend instead to use a static 'new' method that constructs the instance.",
|
|
5403
|
+
fixes: (member.body ? [fixAsStaticNew] : []).concat([{
|
|
5354
5404
|
fixName: "overriddenSchemaConstructor_fix",
|
|
5355
5405
|
description: "Remove the constructor override",
|
|
5356
5406
|
apply: gen(function* () {
|
|
5357
5407
|
const changeTracker = yield* service(ChangeTracker);
|
|
5358
5408
|
changeTracker.delete(sourceFile, member);
|
|
5359
5409
|
})
|
|
5360
|
-
}]
|
|
5410
|
+
}])
|
|
5361
5411
|
});
|
|
5362
5412
|
break;
|
|
5363
5413
|
}
|