@effect/language-service 0.31.2 → 0.32.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 -1
- package/cli.js +6 -3
- package/cli.js.map +1 -1
- package/index.js +48 -11
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +6 -3
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -1528,7 +1528,8 @@ function parse(config) {
|
|
|
1528
1528
|
goto: isObject(config) && hasProperty(config, "goto") && isBoolean(config.goto) ? config.goto : true,
|
|
1529
1529
|
allowedDuplicatedPackages: isObject(config) && hasProperty(config, "allowedDuplicatedPackages") && isArray(config.allowedDuplicatedPackages) && config.allowedDuplicatedPackages.every(isString) ? config.allowedDuplicatedPackages.map((_) => _.toLowerCase()) : [],
|
|
1530
1530
|
namespaceImportPackages: isObject(config) && hasProperty(config, "namespaceImportPackages") && isArray(config.namespaceImportPackages) && config.namespaceImportPackages.every(isString) ? config.namespaceImportPackages.map((_) => _.toLowerCase()) : [],
|
|
1531
|
-
barrelImportPackages: isObject(config) && hasProperty(config, "barrelImportPackages") && isArray(config.barrelImportPackages) && config.barrelImportPackages.every(isString) ? config.barrelImportPackages.map((_) => _.toLowerCase()) : []
|
|
1531
|
+
barrelImportPackages: isObject(config) && hasProperty(config, "barrelImportPackages") && isArray(config.barrelImportPackages) && config.barrelImportPackages.every(isString) ? config.barrelImportPackages.map((_) => _.toLowerCase()) : [],
|
|
1532
|
+
topLevelNamedReexports: isObject(config) && hasProperty(config, "topLevelNamedReexports") && isString(config.topLevelNamedReexports) && (config.topLevelNamedReexports.toLowerCase() === "ignore" || config.topLevelNamedReexports.toLowerCase() === "follow") ? config.topLevelNamedReexports.toLowerCase() : "ignore"
|
|
1532
1533
|
};
|
|
1533
1534
|
}
|
|
1534
1535
|
|
|
@@ -3599,9 +3600,11 @@ var floatingEffect = createDiagnostic({
|
|
|
3599
3600
|
option
|
|
3600
3601
|
);
|
|
3601
3602
|
if (isNone2(allowedFloatingEffects)) {
|
|
3603
|
+
const isStrictEffect = yield* option(typeParser.strictEffectType(type, node.expression));
|
|
3604
|
+
const name = isSome2(isStrictEffect) ? "Effect" : "Effect-able " + typeChecker.typeToString(type);
|
|
3602
3605
|
report({
|
|
3603
3606
|
location: node,
|
|
3604
|
-
messageText:
|
|
3607
|
+
messageText: `${name} must be yielded or assigned to a variable.`,
|
|
3605
3608
|
fixes: []
|
|
3606
3609
|
});
|
|
3607
3610
|
}
|
|
@@ -4228,7 +4231,7 @@ var missingReturnYieldStar = createDiagnostic({
|
|
|
4228
4231
|
}] : [];
|
|
4229
4232
|
report({
|
|
4230
4233
|
location: node,
|
|
4231
|
-
messageText: `
|
|
4234
|
+
messageText: `It is recommended to use return yield* for Effects that never succeed to signal a definitive exit point for type narrowing and tooling support.`,
|
|
4232
4235
|
fixes: fix
|
|
4233
4236
|
});
|
|
4234
4237
|
}
|
|
@@ -5307,6 +5310,7 @@ var makeAutoImportProvider = fn("TypeScriptApi")(function* (fromSourceFile) {
|
|
|
5307
5310
|
}
|
|
5308
5311
|
}
|
|
5309
5312
|
const mapFromBarrelToNamespace = /* @__PURE__ */ new Map();
|
|
5313
|
+
const mapFromBarrelToBarrel = /* @__PURE__ */ new Map();
|
|
5310
5314
|
const mapFromNamespaceToBarrel = /* @__PURE__ */ new Map();
|
|
5311
5315
|
const mapFilenameToModuleAlias = /* @__PURE__ */ new Map();
|
|
5312
5316
|
const mapFilenameToExportExcludes = /* @__PURE__ */ new Map();
|
|
@@ -5327,7 +5331,7 @@ var makeAutoImportProvider = fn("TypeScriptApi")(function* (fromSourceFile) {
|
|
|
5327
5331
|
mapFilenameToModuleName.set(realPath, absoluteName);
|
|
5328
5332
|
};
|
|
5329
5333
|
const collectImportCache = fn("TypeScriptApi")(
|
|
5330
|
-
function* (packagePatterns, kind) {
|
|
5334
|
+
function* (packagePatterns, kind, topLevelNamedReexports) {
|
|
5331
5335
|
for (const packagePattern of packagePatterns) {
|
|
5332
5336
|
const packageNames = tsUtils.resolveModulePattern(fromSourceFile, packagePattern);
|
|
5333
5337
|
for (const packageName of packageNames) {
|
|
@@ -5377,11 +5381,28 @@ var makeAutoImportProvider = fn("TypeScriptApi")(function* (fromSourceFile) {
|
|
|
5377
5381
|
}
|
|
5378
5382
|
if (isPackageRoot) {
|
|
5379
5383
|
for (const namedExport of reExports.namedExports) {
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5384
|
+
if (topLevelNamedReexports === "ignore") {
|
|
5385
|
+
mapFilenameToExportExcludes.set(barrelSourceFile.fileName, [
|
|
5386
|
+
...mapFilenameToExportExcludes.get(barrelSourceFile.fileName) || [],
|
|
5387
|
+
namedExport.name
|
|
5388
|
+
]);
|
|
5389
|
+
} else if (topLevelNamedReexports === "follow") {
|
|
5390
|
+
const reexportedFile = ts.resolveModuleName(
|
|
5391
|
+
namedExport.moduleSpecifier.text,
|
|
5392
|
+
barrelSourceFile.fileName,
|
|
5393
|
+
program.getCompilerOptions(),
|
|
5394
|
+
host
|
|
5395
|
+
);
|
|
5396
|
+
if (!reexportedFile) continue;
|
|
5397
|
+
if (!reexportedFile.resolvedModule) continue;
|
|
5398
|
+
mapFromBarrelToBarrel.set(barrelSourceFile.fileName, {
|
|
5399
|
+
...mapFromBarrelToBarrel.get(barrelSourceFile.fileName) || {},
|
|
5400
|
+
[namedExport.name]: {
|
|
5401
|
+
fileName: reexportedFile.resolvedModule.resolvedFileName,
|
|
5402
|
+
exportName: namedExport.name
|
|
5403
|
+
}
|
|
5404
|
+
});
|
|
5405
|
+
}
|
|
5385
5406
|
}
|
|
5386
5407
|
}
|
|
5387
5408
|
}
|
|
@@ -5389,8 +5410,12 @@ var makeAutoImportProvider = fn("TypeScriptApi")(function* (fromSourceFile) {
|
|
|
5389
5410
|
}
|
|
5390
5411
|
}
|
|
5391
5412
|
);
|
|
5392
|
-
yield* collectImportCache(
|
|
5393
|
-
|
|
5413
|
+
yield* collectImportCache(
|
|
5414
|
+
languageServicePluginOptions.namespaceImportPackages,
|
|
5415
|
+
"namespace",
|
|
5416
|
+
languageServicePluginOptions.topLevelNamedReexports
|
|
5417
|
+
);
|
|
5418
|
+
yield* collectImportCache(languageServicePluginOptions.barrelImportPackages, "barrel", "ignore");
|
|
5394
5419
|
const resolveModuleName = (fileName) => {
|
|
5395
5420
|
const fixedModuleName = mapFilenameToModuleName.get(fileName);
|
|
5396
5421
|
if (fixedModuleName) return fixedModuleName;
|
|
@@ -5408,6 +5433,18 @@ var makeAutoImportProvider = fn("TypeScriptApi")(function* (fromSourceFile) {
|
|
|
5408
5433
|
const resolve = (exportFileName, exportName) => {
|
|
5409
5434
|
const excludedExports = mapFilenameToExportExcludes.get(exportFileName);
|
|
5410
5435
|
if (excludedExports && excludedExports.includes(exportName)) return;
|
|
5436
|
+
const mapToBarrelRewritten = mapFromBarrelToBarrel.get(exportFileName);
|
|
5437
|
+
if (mapToBarrelRewritten && exportName in mapToBarrelRewritten) {
|
|
5438
|
+
const reexportedFile = mapToBarrelRewritten[exportName];
|
|
5439
|
+
if (reexportedFile) {
|
|
5440
|
+
return {
|
|
5441
|
+
_tag: "NamedImport",
|
|
5442
|
+
fileName: reexportedFile.fileName,
|
|
5443
|
+
moduleName: resolveModuleName(reexportedFile.fileName),
|
|
5444
|
+
name: exportName
|
|
5445
|
+
};
|
|
5446
|
+
}
|
|
5447
|
+
}
|
|
5411
5448
|
const mapToNamespace = mapFromBarrelToNamespace.get(exportFileName);
|
|
5412
5449
|
if (mapToNamespace && exportName in mapToNamespace) {
|
|
5413
5450
|
const namespacedFileName = mapToNamespace[exportName];
|