@effect/language-service 0.38.2 → 0.38.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/cli.js +15 -4
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +16 -5
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +17 -6
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +16 -5
- package/transform.js.map +1 -1
|
@@ -1224,10 +1224,10 @@ function makeTypeScriptUtils(ts) {
|
|
|
1224
1224
|
if (!hasProperty(packageJsonScope.contents, "packageJsonContent")) return;
|
|
1225
1225
|
const packageJsonContent = packageJsonScope.contents.packageJsonContent;
|
|
1226
1226
|
if (!hasProperty(packageJsonContent, "name")) return;
|
|
1227
|
-
if (!hasProperty(packageJsonContent, "version")) return;
|
|
1228
1227
|
if (!hasProperty(packageJsonScope, "packageDirectory")) return;
|
|
1229
1228
|
if (!isString(packageJsonScope.packageDirectory)) return;
|
|
1230
|
-
const { name
|
|
1229
|
+
const { name } = packageJsonContent;
|
|
1230
|
+
const version = hasProperty(packageJsonScope, "version") ? packageJsonScope.version : "";
|
|
1231
1231
|
if (!isString(name)) return;
|
|
1232
1232
|
if (!isString(version)) return;
|
|
1233
1233
|
const hasEffectInPeerDependencies = hasProperty(packageJsonContent, "peerDependencies") && isObject(packageJsonContent.peerDependencies) && hasProperty(packageJsonContent.peerDependencies, "effect");
|
|
@@ -1249,9 +1249,20 @@ function makeTypeScriptUtils(ts) {
|
|
|
1249
1249
|
exportsKeys
|
|
1250
1250
|
};
|
|
1251
1251
|
}
|
|
1252
|
-
function resolveModulePattern(sourceFile, pattern) {
|
|
1252
|
+
function resolveModulePattern(program, sourceFile, pattern) {
|
|
1253
1253
|
if (pattern.indexOf("*") === -1) return [pattern.toLowerCase()];
|
|
1254
|
-
|
|
1254
|
+
let packageJsonScope = parsePackageContentNameAndVersionFromScope(sourceFile);
|
|
1255
|
+
if (!packageJsonScope && hasProperty(ts, "getPackageScopeForPath") && isFunction2(ts.getPackageScopeForPath) && hasProperty(ts, "getTemporaryModuleResolutionState") && isFunction2(ts.getTemporaryModuleResolutionState) && hasProperty(ts, "getPackageScopeForPath") && isFunction2(ts.getPackageScopeForPath)) {
|
|
1256
|
+
const temporaryModuleResolutionState = ts.getTemporaryModuleResolutionState(
|
|
1257
|
+
void 0,
|
|
1258
|
+
program,
|
|
1259
|
+
program.getCompilerOptions()
|
|
1260
|
+
);
|
|
1261
|
+
packageJsonScope = parsePackageContentNameAndVersionFromScope({
|
|
1262
|
+
...sourceFile,
|
|
1263
|
+
packageJsonScope: ts.getPackageScopeForPath(sourceFile.fileName, temporaryModuleResolutionState)
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1255
1266
|
const referencedPackages = [];
|
|
1256
1267
|
for (const statement of sourceFile.statements) {
|
|
1257
1268
|
if (ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier)) {
|
|
@@ -3554,7 +3565,7 @@ var importFromBarrel = createDiagnostic({
|
|
|
3554
3565
|
const program = yield* service(TypeScriptProgram);
|
|
3555
3566
|
const packageNamesToCheck = flatten(
|
|
3556
3567
|
languageServicePluginOptions.namespaceImportPackages.map(
|
|
3557
|
-
(packageName) => tsUtils.resolveModulePattern(sourceFile, packageName)
|
|
3568
|
+
(packageName) => tsUtils.resolveModulePattern(program, sourceFile, packageName)
|
|
3558
3569
|
)
|
|
3559
3570
|
);
|
|
3560
3571
|
const isImportedFromBarrelExport = (element) => {
|