@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
package/package.json
CHANGED
package/transform.js
CHANGED
|
@@ -1229,10 +1229,10 @@ function makeTypeScriptUtils(ts) {
|
|
|
1229
1229
|
if (!hasProperty(packageJsonScope.contents, "packageJsonContent")) return;
|
|
1230
1230
|
const packageJsonContent = packageJsonScope.contents.packageJsonContent;
|
|
1231
1231
|
if (!hasProperty(packageJsonContent, "name")) return;
|
|
1232
|
-
if (!hasProperty(packageJsonContent, "version")) return;
|
|
1233
1232
|
if (!hasProperty(packageJsonScope, "packageDirectory")) return;
|
|
1234
1233
|
if (!isString(packageJsonScope.packageDirectory)) return;
|
|
1235
|
-
const { name
|
|
1234
|
+
const { name } = packageJsonContent;
|
|
1235
|
+
const version = hasProperty(packageJsonScope, "version") ? packageJsonScope.version : "";
|
|
1236
1236
|
if (!isString(name)) return;
|
|
1237
1237
|
if (!isString(version)) return;
|
|
1238
1238
|
const hasEffectInPeerDependencies = hasProperty(packageJsonContent, "peerDependencies") && isObject(packageJsonContent.peerDependencies) && hasProperty(packageJsonContent.peerDependencies, "effect");
|
|
@@ -1254,9 +1254,20 @@ function makeTypeScriptUtils(ts) {
|
|
|
1254
1254
|
exportsKeys
|
|
1255
1255
|
};
|
|
1256
1256
|
}
|
|
1257
|
-
function resolveModulePattern(sourceFile, pattern) {
|
|
1257
|
+
function resolveModulePattern(program, sourceFile, pattern) {
|
|
1258
1258
|
if (pattern.indexOf("*") === -1) return [pattern.toLowerCase()];
|
|
1259
|
-
|
|
1259
|
+
let packageJsonScope = parsePackageContentNameAndVersionFromScope(sourceFile);
|
|
1260
|
+
if (!packageJsonScope && hasProperty(ts, "getPackageScopeForPath") && isFunction2(ts.getPackageScopeForPath) && hasProperty(ts, "getTemporaryModuleResolutionState") && isFunction2(ts.getTemporaryModuleResolutionState) && hasProperty(ts, "getPackageScopeForPath") && isFunction2(ts.getPackageScopeForPath)) {
|
|
1261
|
+
const temporaryModuleResolutionState = ts.getTemporaryModuleResolutionState(
|
|
1262
|
+
void 0,
|
|
1263
|
+
program,
|
|
1264
|
+
program.getCompilerOptions()
|
|
1265
|
+
);
|
|
1266
|
+
packageJsonScope = parsePackageContentNameAndVersionFromScope({
|
|
1267
|
+
...sourceFile,
|
|
1268
|
+
packageJsonScope: ts.getPackageScopeForPath(sourceFile.fileName, temporaryModuleResolutionState)
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1260
1271
|
const referencedPackages = [];
|
|
1261
1272
|
for (const statement of sourceFile.statements) {
|
|
1262
1273
|
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) => {
|