@effect/language-service 0.29.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -24
- package/cli.js +377 -2
- package/cli.js.map +1 -1
- package/index.js +412 -37
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +377 -2
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -2339,6 +2339,36 @@ function make3(ts, tsUtils, typeChecker) {
|
|
|
2339
2339
|
"TypeParser.effectSubtype",
|
|
2340
2340
|
(type) => type
|
|
2341
2341
|
);
|
|
2342
|
+
const importedSchemaModule = cachedBy(
|
|
2343
|
+
fn("TypeParser.importedSchemaModule")(function* (node) {
|
|
2344
|
+
const type = typeChecker.getTypeAtLocation(node);
|
|
2345
|
+
const propertySymbol = typeChecker.getPropertyOfType(type, "Class");
|
|
2346
|
+
if (!propertySymbol) {
|
|
2347
|
+
return yield* typeParserIssue("Type has no 'Class' property", type, node);
|
|
2348
|
+
}
|
|
2349
|
+
if (!ts.isExpression(node)) {
|
|
2350
|
+
return yield* typeParserIssue("Node is not an expression", type, node);
|
|
2351
|
+
}
|
|
2352
|
+
return node;
|
|
2353
|
+
}),
|
|
2354
|
+
"TypeParser.importedSchemaModule",
|
|
2355
|
+
(node) => node
|
|
2356
|
+
);
|
|
2357
|
+
const importedContextModule = cachedBy(
|
|
2358
|
+
fn("TypeParser.importedContextModule")(function* (node) {
|
|
2359
|
+
const type = typeChecker.getTypeAtLocation(node);
|
|
2360
|
+
const propertySymbol = typeChecker.getPropertyOfType(type, "Tag");
|
|
2361
|
+
if (!propertySymbol) {
|
|
2362
|
+
return yield* typeParserIssue("Type has no 'Tag' property", type, node);
|
|
2363
|
+
}
|
|
2364
|
+
if (!ts.isExpression(node)) {
|
|
2365
|
+
return yield* typeParserIssue("Node is not an expression", type, node);
|
|
2366
|
+
}
|
|
2367
|
+
return node;
|
|
2368
|
+
}),
|
|
2369
|
+
"TypeParser.importedContextModule",
|
|
2370
|
+
(node) => node
|
|
2371
|
+
);
|
|
2342
2372
|
const importedEffectModule = cachedBy(
|
|
2343
2373
|
fn("TypeParser.importedEffectModule")(function* (node) {
|
|
2344
2374
|
const type = typeChecker.getTypeAtLocation(node);
|
|
@@ -2695,6 +2725,226 @@ function make3(ts, tsUtils, typeChecker) {
|
|
|
2695
2725
|
"TypeParser.promiseLike",
|
|
2696
2726
|
(type) => type
|
|
2697
2727
|
);
|
|
2728
|
+
const extendsSchemaClass = cachedBy(
|
|
2729
|
+
fn("TypeParser.extendsSchemaClass")(function* (atLocation) {
|
|
2730
|
+
if (!atLocation.name) {
|
|
2731
|
+
return yield* typeParserIssue("Class has no name", void 0, atLocation);
|
|
2732
|
+
}
|
|
2733
|
+
const heritageClauses = atLocation.heritageClauses;
|
|
2734
|
+
if (!heritageClauses) {
|
|
2735
|
+
return yield* typeParserIssue("Class has no heritage clauses", void 0, atLocation);
|
|
2736
|
+
}
|
|
2737
|
+
for (const heritageClause of heritageClauses) {
|
|
2738
|
+
for (const typeX of heritageClause.types) {
|
|
2739
|
+
if (ts.isExpressionWithTypeArguments(typeX)) {
|
|
2740
|
+
const expression = typeX.expression;
|
|
2741
|
+
if (ts.isCallExpression(expression)) {
|
|
2742
|
+
const schemaCall = expression.expression;
|
|
2743
|
+
if (ts.isCallExpression(schemaCall) && schemaCall.typeArguments && schemaCall.typeArguments.length > 0) {
|
|
2744
|
+
const selfTypeNode = schemaCall.typeArguments[0];
|
|
2745
|
+
const schemaIdentifier = schemaCall.expression;
|
|
2746
|
+
if (ts.isPropertyAccessExpression(schemaIdentifier) && ts.isIdentifier(schemaIdentifier.name) && schemaIdentifier.name.text === "Class") {
|
|
2747
|
+
const parsedSchemaModule = yield* pipe(
|
|
2748
|
+
importedSchemaModule(schemaIdentifier.expression),
|
|
2749
|
+
option
|
|
2750
|
+
);
|
|
2751
|
+
if (isSome2(parsedSchemaModule)) {
|
|
2752
|
+
return {
|
|
2753
|
+
className: atLocation.name,
|
|
2754
|
+
selfTypeNode,
|
|
2755
|
+
Schema: parsedSchemaModule.value
|
|
2756
|
+
};
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
return yield* typeParserIssue("Class does not extend Schema.Class", void 0, atLocation);
|
|
2765
|
+
}),
|
|
2766
|
+
"TypeParser.extendsSchemaClass",
|
|
2767
|
+
(atLocation) => atLocation
|
|
2768
|
+
);
|
|
2769
|
+
const extendsSchemaTaggedClass = cachedBy(
|
|
2770
|
+
fn("TypeParser.extendsSchemaTaggedClass")(function* (atLocation) {
|
|
2771
|
+
if (!atLocation.name) {
|
|
2772
|
+
return yield* typeParserIssue("Class has no name", void 0, atLocation);
|
|
2773
|
+
}
|
|
2774
|
+
const heritageClauses = atLocation.heritageClauses;
|
|
2775
|
+
if (!heritageClauses) {
|
|
2776
|
+
return yield* typeParserIssue("Class has no heritage clauses", void 0, atLocation);
|
|
2777
|
+
}
|
|
2778
|
+
for (const heritageClause of heritageClauses) {
|
|
2779
|
+
for (const typeX of heritageClause.types) {
|
|
2780
|
+
if (ts.isExpressionWithTypeArguments(typeX)) {
|
|
2781
|
+
const expression = typeX.expression;
|
|
2782
|
+
if (ts.isCallExpression(expression)) {
|
|
2783
|
+
const tagCall = expression.expression;
|
|
2784
|
+
if (ts.isCallExpression(tagCall)) {
|
|
2785
|
+
const schemaCall = tagCall.expression;
|
|
2786
|
+
if (ts.isCallExpression(schemaCall) && schemaCall.typeArguments && schemaCall.typeArguments.length > 0) {
|
|
2787
|
+
const selfTypeNode = schemaCall.typeArguments[0];
|
|
2788
|
+
const schemaIdentifier = schemaCall.expression;
|
|
2789
|
+
if (ts.isPropertyAccessExpression(schemaIdentifier) && ts.isIdentifier(schemaIdentifier.name) && schemaIdentifier.name.text === "TaggedClass") {
|
|
2790
|
+
const parsedSchemaModule = yield* pipe(
|
|
2791
|
+
importedSchemaModule(schemaIdentifier.expression),
|
|
2792
|
+
option
|
|
2793
|
+
);
|
|
2794
|
+
if (isSome2(parsedSchemaModule)) {
|
|
2795
|
+
return {
|
|
2796
|
+
className: atLocation.name,
|
|
2797
|
+
selfTypeNode,
|
|
2798
|
+
Schema: parsedSchemaModule.value
|
|
2799
|
+
};
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
return yield* typeParserIssue("Class does not extend Schema.TaggedClass", void 0, atLocation);
|
|
2809
|
+
}),
|
|
2810
|
+
"TypeParser.extendsSchemaTaggedClass",
|
|
2811
|
+
(atLocation) => atLocation
|
|
2812
|
+
);
|
|
2813
|
+
const extendsSchemaTaggedError = cachedBy(
|
|
2814
|
+
fn("TypeParser.extendsSchemaTaggedError")(function* (atLocation) {
|
|
2815
|
+
if (!atLocation.name) {
|
|
2816
|
+
return yield* typeParserIssue("Class has no name", void 0, atLocation);
|
|
2817
|
+
}
|
|
2818
|
+
const heritageClauses = atLocation.heritageClauses;
|
|
2819
|
+
if (!heritageClauses) {
|
|
2820
|
+
return yield* typeParserIssue("Class has no heritage clauses", void 0, atLocation);
|
|
2821
|
+
}
|
|
2822
|
+
for (const heritageClause of heritageClauses) {
|
|
2823
|
+
for (const typeX of heritageClause.types) {
|
|
2824
|
+
if (ts.isExpressionWithTypeArguments(typeX)) {
|
|
2825
|
+
const expression = typeX.expression;
|
|
2826
|
+
if (ts.isCallExpression(expression)) {
|
|
2827
|
+
const tagCall = expression.expression;
|
|
2828
|
+
if (ts.isCallExpression(tagCall)) {
|
|
2829
|
+
const schemaCall = tagCall.expression;
|
|
2830
|
+
if (ts.isCallExpression(schemaCall) && schemaCall.typeArguments && schemaCall.typeArguments.length > 0) {
|
|
2831
|
+
const selfTypeNode = schemaCall.typeArguments[0];
|
|
2832
|
+
const schemaIdentifier = schemaCall.expression;
|
|
2833
|
+
if (ts.isPropertyAccessExpression(schemaIdentifier) && ts.isIdentifier(schemaIdentifier.name) && schemaIdentifier.name.text === "TaggedError") {
|
|
2834
|
+
const parsedSchemaModule = yield* pipe(
|
|
2835
|
+
importedSchemaModule(schemaIdentifier.expression),
|
|
2836
|
+
option
|
|
2837
|
+
);
|
|
2838
|
+
if (isSome2(parsedSchemaModule)) {
|
|
2839
|
+
return {
|
|
2840
|
+
className: atLocation.name,
|
|
2841
|
+
selfTypeNode,
|
|
2842
|
+
Schema: parsedSchemaModule.value
|
|
2843
|
+
};
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
return yield* typeParserIssue("Class does not extend Schema.TaggedError", void 0, atLocation);
|
|
2853
|
+
}),
|
|
2854
|
+
"TypeParser.extendsSchemaTaggedError",
|
|
2855
|
+
(atLocation) => atLocation
|
|
2856
|
+
);
|
|
2857
|
+
const extendsSchemaTaggedRequest = cachedBy(
|
|
2858
|
+
fn("TypeParser.extendsSchemaTaggedRequest")(function* (atLocation) {
|
|
2859
|
+
if (!atLocation.name) {
|
|
2860
|
+
return yield* typeParserIssue("Class has no name", void 0, atLocation);
|
|
2861
|
+
}
|
|
2862
|
+
const heritageClauses = atLocation.heritageClauses;
|
|
2863
|
+
if (!heritageClauses) {
|
|
2864
|
+
return yield* typeParserIssue("Class has no heritage clauses", void 0, atLocation);
|
|
2865
|
+
}
|
|
2866
|
+
for (const heritageClause of heritageClauses) {
|
|
2867
|
+
for (const typeX of heritageClause.types) {
|
|
2868
|
+
if (ts.isExpressionWithTypeArguments(typeX)) {
|
|
2869
|
+
const expression = typeX.expression;
|
|
2870
|
+
if (ts.isCallExpression(expression)) {
|
|
2871
|
+
const tagCall = expression.expression;
|
|
2872
|
+
if (ts.isCallExpression(tagCall)) {
|
|
2873
|
+
const schemaCall = tagCall.expression;
|
|
2874
|
+
if (ts.isCallExpression(schemaCall) && schemaCall.typeArguments && schemaCall.typeArguments.length > 0) {
|
|
2875
|
+
const selfTypeNode = schemaCall.typeArguments[0];
|
|
2876
|
+
const schemaIdentifier = schemaCall.expression;
|
|
2877
|
+
if (ts.isPropertyAccessExpression(schemaIdentifier) && ts.isIdentifier(schemaIdentifier.name) && schemaIdentifier.name.text === "TaggedRequest") {
|
|
2878
|
+
const parsedSchemaModule = yield* pipe(
|
|
2879
|
+
importedSchemaModule(schemaIdentifier.expression),
|
|
2880
|
+
option
|
|
2881
|
+
);
|
|
2882
|
+
if (isSome2(parsedSchemaModule)) {
|
|
2883
|
+
return {
|
|
2884
|
+
className: atLocation.name,
|
|
2885
|
+
selfTypeNode,
|
|
2886
|
+
Schema: parsedSchemaModule.value
|
|
2887
|
+
};
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
return yield* typeParserIssue("Class does not extend Schema.TaggedRequest", void 0, atLocation);
|
|
2897
|
+
}),
|
|
2898
|
+
"TypeParser.extendsSchemaTaggedRequest",
|
|
2899
|
+
(atLocation) => atLocation
|
|
2900
|
+
);
|
|
2901
|
+
const extendsContextTag = cachedBy(
|
|
2902
|
+
fn("TypeParser.extendsContextTag")(function* (atLocation) {
|
|
2903
|
+
if (!atLocation.name) {
|
|
2904
|
+
return yield* typeParserIssue("Class has no name", void 0, atLocation);
|
|
2905
|
+
}
|
|
2906
|
+
const classSym = typeChecker.getSymbolAtLocation(atLocation.name);
|
|
2907
|
+
if (!classSym) return yield* typeParserIssue("Class has no symbol", void 0, atLocation);
|
|
2908
|
+
const type = typeChecker.getTypeOfSymbol(classSym);
|
|
2909
|
+
const heritageClauses = atLocation.heritageClauses;
|
|
2910
|
+
if (!heritageClauses) {
|
|
2911
|
+
return yield* typeParserIssue("Class has no heritage clauses", void 0, atLocation);
|
|
2912
|
+
}
|
|
2913
|
+
for (const heritageClause of heritageClauses) {
|
|
2914
|
+
for (const typeX of heritageClause.types) {
|
|
2915
|
+
if (ts.isExpressionWithTypeArguments(typeX)) {
|
|
2916
|
+
const wholeCall = typeX.expression;
|
|
2917
|
+
if (ts.isCallExpression(wholeCall)) {
|
|
2918
|
+
const contextTagCall = wholeCall.expression;
|
|
2919
|
+
if (ts.isCallExpression(contextTagCall) && wholeCall.typeArguments && wholeCall.typeArguments.length > 0) {
|
|
2920
|
+
const contextTagIdentifier = contextTagCall.expression;
|
|
2921
|
+
const selfTypeNode = wholeCall.typeArguments[0];
|
|
2922
|
+
if (ts.isPropertyAccessExpression(contextTagIdentifier) && ts.isIdentifier(contextTagIdentifier.name) && contextTagIdentifier.name.text === "Tag") {
|
|
2923
|
+
const parsedContextModule = yield* pipe(
|
|
2924
|
+
importedContextModule(contextTagIdentifier.expression),
|
|
2925
|
+
option
|
|
2926
|
+
);
|
|
2927
|
+
if (isSome2(parsedContextModule)) {
|
|
2928
|
+
const tagType = yield* contextTag(type, atLocation);
|
|
2929
|
+
return {
|
|
2930
|
+
className: atLocation.name,
|
|
2931
|
+
selfTypeNode,
|
|
2932
|
+
args: contextTagCall.arguments,
|
|
2933
|
+
Identifier: tagType.Identifier,
|
|
2934
|
+
Tag: parsedContextModule.value
|
|
2935
|
+
};
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
return yield* typeParserIssue("Class does not extend Context.Tag", void 0, atLocation);
|
|
2944
|
+
}),
|
|
2945
|
+
"TypeParser.extendsContextTag",
|
|
2946
|
+
(atLocation) => atLocation
|
|
2947
|
+
);
|
|
2698
2948
|
const extendsEffectService = cachedBy(
|
|
2699
2949
|
fn("TypeParser.extendsEffectService")(function* (atLocation) {
|
|
2700
2950
|
if (!atLocation.name) {
|
|
@@ -2770,7 +3020,12 @@ function make3(ts, tsUtils, typeChecker) {
|
|
|
2770
3020
|
pipeCall,
|
|
2771
3021
|
scopeType,
|
|
2772
3022
|
promiseLike,
|
|
2773
|
-
extendsEffectService
|
|
3023
|
+
extendsEffectService,
|
|
3024
|
+
extendsContextTag,
|
|
3025
|
+
extendsSchemaClass,
|
|
3026
|
+
extendsSchemaTaggedClass,
|
|
3027
|
+
extendsSchemaTaggedError,
|
|
3028
|
+
extendsSchemaTaggedRequest
|
|
2774
3029
|
};
|
|
2775
3030
|
}
|
|
2776
3031
|
|
|
@@ -3109,6 +3364,104 @@ var effectDataClasses = createCompletion({
|
|
|
3109
3364
|
})
|
|
3110
3365
|
});
|
|
3111
3366
|
|
|
3367
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/encoding/common.js
|
|
3368
|
+
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
3369
|
+
|
|
3370
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/encoding/base64.js
|
|
3371
|
+
var encode = (bytes) => {
|
|
3372
|
+
const length = bytes.length;
|
|
3373
|
+
let result = "";
|
|
3374
|
+
let i;
|
|
3375
|
+
for (i = 2; i < length; i += 3) {
|
|
3376
|
+
result += base64abc[bytes[i - 2] >> 2];
|
|
3377
|
+
result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
3378
|
+
result += base64abc[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];
|
|
3379
|
+
result += base64abc[bytes[i] & 63];
|
|
3380
|
+
}
|
|
3381
|
+
if (i === length + 1) {
|
|
3382
|
+
result += base64abc[bytes[i - 2] >> 2];
|
|
3383
|
+
result += base64abc[(bytes[i - 2] & 3) << 4];
|
|
3384
|
+
result += "==";
|
|
3385
|
+
}
|
|
3386
|
+
if (i === length) {
|
|
3387
|
+
result += base64abc[bytes[i - 2] >> 2];
|
|
3388
|
+
result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
3389
|
+
result += base64abc[(bytes[i - 1] & 15) << 2];
|
|
3390
|
+
result += "=";
|
|
3391
|
+
}
|
|
3392
|
+
return result;
|
|
3393
|
+
};
|
|
3394
|
+
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", "+", "/"];
|
|
3395
|
+
|
|
3396
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/encoding/base64Url.js
|
|
3397
|
+
var encode2 = (data) => encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
3398
|
+
|
|
3399
|
+
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Encoding.js
|
|
3400
|
+
var encodeBase64Url = (input) => typeof input === "string" ? encode2(encoder.encode(input)) : encode2(input);
|
|
3401
|
+
|
|
3402
|
+
// src/diagnostics/classSelfMismatch.ts
|
|
3403
|
+
var classSelfMismatch = createDiagnostic({
|
|
3404
|
+
name: "classSelfMismatch",
|
|
3405
|
+
code: 20,
|
|
3406
|
+
severity: "error",
|
|
3407
|
+
apply: fn("classSelfMismatch.apply")(function* (sourceFile, report) {
|
|
3408
|
+
const ts = yield* service(TypeScriptApi);
|
|
3409
|
+
const typeParser = yield* service(TypeParser);
|
|
3410
|
+
const nodeToVisit = [];
|
|
3411
|
+
const appendNodeToVisit = (node) => {
|
|
3412
|
+
nodeToVisit.push(node);
|
|
3413
|
+
return void 0;
|
|
3414
|
+
};
|
|
3415
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
3416
|
+
while (nodeToVisit.length > 0) {
|
|
3417
|
+
const node = nodeToVisit.shift();
|
|
3418
|
+
if (ts.isClassDeclaration(node) && node.name && node.heritageClauses) {
|
|
3419
|
+
const result = yield* pipe(
|
|
3420
|
+
typeParser.extendsEffectService(node),
|
|
3421
|
+
orElse2(() => typeParser.extendsContextTag(node)),
|
|
3422
|
+
orElse2(() => typeParser.extendsSchemaClass(node)),
|
|
3423
|
+
orElse2(() => typeParser.extendsSchemaTaggedClass(node)),
|
|
3424
|
+
orElse2(() => typeParser.extendsSchemaTaggedError(node)),
|
|
3425
|
+
orElse2(() => typeParser.extendsSchemaTaggedRequest(node)),
|
|
3426
|
+
orElse2(() => void_)
|
|
3427
|
+
);
|
|
3428
|
+
if (result) {
|
|
3429
|
+
const { className, selfTypeNode } = result;
|
|
3430
|
+
let actualName = "";
|
|
3431
|
+
if (ts.isTypeReferenceNode(selfTypeNode)) {
|
|
3432
|
+
if (ts.isIdentifier(selfTypeNode.typeName)) {
|
|
3433
|
+
actualName = selfTypeNode.typeName.text;
|
|
3434
|
+
} else if (ts.isQualifiedName(selfTypeNode.typeName)) {
|
|
3435
|
+
actualName = selfTypeNode.typeName.right.text;
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
const expectedName = className.text;
|
|
3439
|
+
if (actualName !== expectedName) {
|
|
3440
|
+
report({
|
|
3441
|
+
location: selfTypeNode,
|
|
3442
|
+
messageText: `Self type parameter should be '${expectedName}'`,
|
|
3443
|
+
fixes: [{
|
|
3444
|
+
fixName: "classSelfMismatch_fix",
|
|
3445
|
+
description: `Replace '${actualName}' with '${expectedName}'`,
|
|
3446
|
+
apply: gen(function* () {
|
|
3447
|
+
const changeTracker = yield* service(ChangeTracker);
|
|
3448
|
+
const typeArgs = ts.isTypeReferenceNode(selfTypeNode) ? selfTypeNode.typeArguments : void 0;
|
|
3449
|
+
const newTypeReference = ts.factory.createTypeReferenceNode(
|
|
3450
|
+
ts.factory.createIdentifier(expectedName),
|
|
3451
|
+
typeArgs
|
|
3452
|
+
);
|
|
3453
|
+
changeTracker.replaceNode(sourceFile, selfTypeNode, newTypeReference);
|
|
3454
|
+
})
|
|
3455
|
+
}]
|
|
3456
|
+
});
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3460
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
3461
|
+
}
|
|
3462
|
+
})
|
|
3463
|
+
});
|
|
3464
|
+
|
|
3112
3465
|
// src/diagnostics/duplicatePackage.ts
|
|
3113
3466
|
var checkedPackagesCache = /* @__PURE__ */ new Map();
|
|
3114
3467
|
var programResolvedCacheSize = /* @__PURE__ */ new Map();
|
|
@@ -4447,8 +4800,64 @@ var unnecessaryPipeChain = createDiagnostic({
|
|
|
4447
4800
|
})
|
|
4448
4801
|
});
|
|
4449
4802
|
|
|
4803
|
+
// src/diagnostics/unsupportedServiceAccessors.ts
|
|
4804
|
+
var unsupportedServiceAccessors = createDiagnostic({
|
|
4805
|
+
name: "unsupportedServiceAccessors",
|
|
4806
|
+
code: 21,
|
|
4807
|
+
severity: "warning",
|
|
4808
|
+
apply: fn("unsupportedServiceAccessors.apply")(function* (sourceFile, report) {
|
|
4809
|
+
const ts = yield* service(TypeScriptApi);
|
|
4810
|
+
const nodeToVisit = [];
|
|
4811
|
+
const appendNodeToVisit = (node) => {
|
|
4812
|
+
nodeToVisit.push(node);
|
|
4813
|
+
return void 0;
|
|
4814
|
+
};
|
|
4815
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
4816
|
+
while (nodeToVisit.length > 0) {
|
|
4817
|
+
const node = nodeToVisit.shift();
|
|
4818
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
4819
|
+
if (ts.isClassDeclaration(node)) {
|
|
4820
|
+
const parseResult = yield* pipe(
|
|
4821
|
+
parse2(node),
|
|
4822
|
+
orElse2(() => succeed(null))
|
|
4823
|
+
);
|
|
4824
|
+
if (parseResult && parseResult.involvedMembers.length > 0) {
|
|
4825
|
+
const existingStaticMembers = /* @__PURE__ */ new Set();
|
|
4826
|
+
node.members?.forEach((member) => {
|
|
4827
|
+
if (ts.isPropertyDeclaration(member) && member.modifiers?.some((mod) => mod.kind === ts.SyntaxKind.StaticKeyword)) {
|
|
4828
|
+
if (member.name && ts.isIdentifier(member.name)) {
|
|
4829
|
+
existingStaticMembers.add(member.name.text);
|
|
4830
|
+
}
|
|
4831
|
+
}
|
|
4832
|
+
});
|
|
4833
|
+
const missingMembers = parseResult.involvedMembers.filter(
|
|
4834
|
+
({ property }) => !existingStaticMembers.has(property.getName())
|
|
4835
|
+
);
|
|
4836
|
+
if (missingMembers.length > 0) {
|
|
4837
|
+
const memberNames = missingMembers.map(({ property }) => `'${property.getName()}'`).join(", ");
|
|
4838
|
+
report({
|
|
4839
|
+
location: parseResult.className,
|
|
4840
|
+
messageText: `Even if accessors are enabled, accessors for ${memberNames} won't be available because the signature have generic type parameters or multiple call signatures.`,
|
|
4841
|
+
fixes: [{
|
|
4842
|
+
fixName: "unsupportedServiceAccessors_enableCodegen",
|
|
4843
|
+
description: "Enable accessors codegen",
|
|
4844
|
+
apply: gen(function* () {
|
|
4845
|
+
const changeTracker = yield* service(ChangeTracker);
|
|
4846
|
+
const comment = "// @effect-codegens accessors\n";
|
|
4847
|
+
changeTracker.insertText(sourceFile, node.getStart(sourceFile), comment);
|
|
4848
|
+
})
|
|
4849
|
+
}]
|
|
4850
|
+
});
|
|
4851
|
+
}
|
|
4852
|
+
}
|
|
4853
|
+
}
|
|
4854
|
+
}
|
|
4855
|
+
})
|
|
4856
|
+
});
|
|
4857
|
+
|
|
4450
4858
|
// src/diagnostics.ts
|
|
4451
4859
|
var diagnostics = [
|
|
4860
|
+
classSelfMismatch,
|
|
4452
4861
|
duplicatePackage,
|
|
4453
4862
|
missingEffectContext,
|
|
4454
4863
|
missingEffectError,
|
|
@@ -4467,7 +4876,8 @@ var diagnostics = [
|
|
|
4467
4876
|
unnecessaryPipeChain,
|
|
4468
4877
|
strictBooleanExpressions,
|
|
4469
4878
|
multipleEffectProvide,
|
|
4470
|
-
outdatedEffectCodegen
|
|
4879
|
+
outdatedEffectCodegen,
|
|
4880
|
+
unsupportedServiceAccessors
|
|
4471
4881
|
];
|
|
4472
4882
|
|
|
4473
4883
|
// src/completions/effectDiagnosticsComment.ts
|
|
@@ -5504,41 +5914,6 @@ function effectTypeArgs(sourceFile, position, quickInfo2) {
|
|
|
5504
5914
|
);
|
|
5505
5915
|
}
|
|
5506
5916
|
|
|
5507
|
-
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/encoding/common.js
|
|
5508
|
-
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
5509
|
-
|
|
5510
|
-
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/encoding/base64.js
|
|
5511
|
-
var encode = (bytes) => {
|
|
5512
|
-
const length = bytes.length;
|
|
5513
|
-
let result = "";
|
|
5514
|
-
let i;
|
|
5515
|
-
for (i = 2; i < length; i += 3) {
|
|
5516
|
-
result += base64abc[bytes[i - 2] >> 2];
|
|
5517
|
-
result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
5518
|
-
result += base64abc[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];
|
|
5519
|
-
result += base64abc[bytes[i] & 63];
|
|
5520
|
-
}
|
|
5521
|
-
if (i === length + 1) {
|
|
5522
|
-
result += base64abc[bytes[i - 2] >> 2];
|
|
5523
|
-
result += base64abc[(bytes[i - 2] & 3) << 4];
|
|
5524
|
-
result += "==";
|
|
5525
|
-
}
|
|
5526
|
-
if (i === length) {
|
|
5527
|
-
result += base64abc[bytes[i - 2] >> 2];
|
|
5528
|
-
result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
5529
|
-
result += base64abc[(bytes[i - 1] & 15) << 2];
|
|
5530
|
-
result += "=";
|
|
5531
|
-
}
|
|
5532
|
-
return result;
|
|
5533
|
-
};
|
|
5534
|
-
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", "+", "/"];
|
|
5535
|
-
|
|
5536
|
-
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/encoding/base64Url.js
|
|
5537
|
-
var encode2 = (data) => encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
5538
|
-
|
|
5539
|
-
// node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Encoding.js
|
|
5540
|
-
var encodeBase64Url = (input) => typeof input === "string" ? encode2(encoder.encode(input)) : encode2(input);
|
|
5541
|
-
|
|
5542
5917
|
// node_modules/.pnpm/pako@2.1.0/node_modules/pako/dist/pako.esm.mjs
|
|
5543
5918
|
var Z_FIXED$1 = 4;
|
|
5544
5919
|
var Z_BINARY = 0;
|