@effect/language-service 0.52.0 → 0.52.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 +58 -24
- package/cli.js.map +1 -1
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -26990,6 +26990,7 @@ var getZshCompletions2 = (self, state = {
|
|
|
26990
26990
|
|
|
26991
26991
|
// node_modules/.pnpm/@effect+cli@0.71.0_@effect+platform@0.92.1_@effect+printer-ansi@0.46.0_@effect+printer@0.46.0_effect@3.18.4/node_modules/@effect/cli/dist/esm/Options.js
|
|
26992
26992
|
var all7 = all6;
|
|
26993
|
+
var boolean5 = boolean4;
|
|
26993
26994
|
var choice3 = choice2;
|
|
26994
26995
|
var directory2 = directory;
|
|
26995
26996
|
var file3 = file2;
|
|
@@ -30956,7 +30957,8 @@ var getModuleFilePath = fn("getModuleFilePath")(
|
|
|
30956
30957
|
var getTypeScriptApisUtils = fn("getTypeScriptApisFile")(
|
|
30957
30958
|
function* (dirPath4) {
|
|
30958
30959
|
const filePath = yield* getModuleFilePath(dirPath4, "typescript");
|
|
30959
|
-
const
|
|
30960
|
+
const sourceText = yield* getSourceFileText(filePath);
|
|
30961
|
+
const sourceFile = yield* getUnpatchedSourceFile(filePath, sourceText);
|
|
30960
30962
|
const bodyWithoutBundlerComment = yield* omitBundlerSourceFileComment(
|
|
30961
30963
|
sourceFile.text.split("\n").map((line4) => ` ${line4}`).join("\n")
|
|
30962
30964
|
);
|
|
@@ -31069,27 +31071,31 @@ var applyTextChanges = fn("applyTextChanges")(
|
|
|
31069
31071
|
return newSourceText;
|
|
31070
31072
|
}
|
|
31071
31073
|
);
|
|
31072
|
-
var
|
|
31074
|
+
var getSourceFileText = fn("getSourceFileText")(function* (filePath) {
|
|
31073
31075
|
const fs = yield* FileSystem;
|
|
31074
|
-
|
|
31075
|
-
const sourceText = yield* fs.readFileString(filePath);
|
|
31076
|
-
const sourceFile = ts.createSourceFile(
|
|
31077
|
-
filePath,
|
|
31078
|
-
sourceText,
|
|
31079
|
-
ts.ScriptTarget.ES2022,
|
|
31080
|
-
true
|
|
31081
|
-
);
|
|
31082
|
-
const { revertChanges } = yield* extractAppliedEffectLspPatches(sourceFile);
|
|
31083
|
-
if (revertChanges.length === 0) return sourceFile;
|
|
31084
|
-
const newSourceText = yield* applyTextChanges(sourceText, revertChanges);
|
|
31085
|
-
const newSourceFile = ts.createSourceFile(
|
|
31086
|
-
filePath,
|
|
31087
|
-
newSourceText,
|
|
31088
|
-
ts.ScriptTarget.ES2022,
|
|
31089
|
-
true
|
|
31090
|
-
);
|
|
31091
|
-
return newSourceFile;
|
|
31076
|
+
return yield* fs.readFileString(filePath);
|
|
31092
31077
|
});
|
|
31078
|
+
var getUnpatchedSourceFile = fn("getUnpatchedSourceFile")(
|
|
31079
|
+
function* (filePath, sourceText) {
|
|
31080
|
+
const ts = yield* getTypeScript;
|
|
31081
|
+
const sourceFile = ts.createSourceFile(
|
|
31082
|
+
filePath,
|
|
31083
|
+
sourceText,
|
|
31084
|
+
ts.ScriptTarget.ES2022,
|
|
31085
|
+
true
|
|
31086
|
+
);
|
|
31087
|
+
const { revertChanges } = yield* extractAppliedEffectLspPatches(sourceFile);
|
|
31088
|
+
if (revertChanges.length === 0) return sourceFile;
|
|
31089
|
+
const newSourceText = yield* applyTextChanges(sourceText, revertChanges);
|
|
31090
|
+
const newSourceFile = ts.createSourceFile(
|
|
31091
|
+
filePath,
|
|
31092
|
+
newSourceText,
|
|
31093
|
+
ts.ScriptTarget.ES2022,
|
|
31094
|
+
true
|
|
31095
|
+
);
|
|
31096
|
+
return newSourceFile;
|
|
31097
|
+
}
|
|
31098
|
+
);
|
|
31093
31099
|
var omitBundlerSourceFileComment = fn("omitBundlerSourceFileComment")(
|
|
31094
31100
|
function* (originalSourceText) {
|
|
31095
31101
|
const ts = yield* getTypeScript;
|
|
@@ -35665,6 +35671,13 @@ var moduleNames = choice3("module", [
|
|
|
35665
35671
|
repeated4,
|
|
35666
35672
|
withDescription3("The name of the module to patch.")
|
|
35667
35673
|
);
|
|
35674
|
+
var force = boolean5("force").pipe(
|
|
35675
|
+
withDefault3(false),
|
|
35676
|
+
withDescription3("Force patch even if already patched.")
|
|
35677
|
+
);
|
|
35678
|
+
var getPatchedMarker = (version) => {
|
|
35679
|
+
return `"use effect-lsp-patch-version ${version}";`;
|
|
35680
|
+
};
|
|
35668
35681
|
var getPatchesForModule = fn("getPatchesForModule")(
|
|
35669
35682
|
function* (moduleName, dirPath4, version, sourceFile) {
|
|
35670
35683
|
const ts = yield* getTypeScript;
|
|
@@ -35827,6 +35840,16 @@ var getPatchesForModule = fn("getPatchesForModule")(
|
|
|
35827
35840
|
version
|
|
35828
35841
|
)
|
|
35829
35842
|
);
|
|
35843
|
+
patches.push(
|
|
35844
|
+
yield* makeEffectLspPatchChange(
|
|
35845
|
+
sourceFile.text,
|
|
35846
|
+
insertCheckSourceFilePosition.value.position,
|
|
35847
|
+
insertCheckSourceFilePosition.value.position,
|
|
35848
|
+
getPatchedMarker(version) + "\n",
|
|
35849
|
+
"\n",
|
|
35850
|
+
version
|
|
35851
|
+
)
|
|
35852
|
+
);
|
|
35830
35853
|
return patches;
|
|
35831
35854
|
}
|
|
35832
35855
|
);
|
|
@@ -35850,8 +35873,8 @@ var printRememberPrepareScript = fn("printRememberPrepareScript")(function* () {
|
|
|
35850
35873
|
}, ignore2);
|
|
35851
35874
|
var patch9 = make58(
|
|
35852
35875
|
"patch",
|
|
35853
|
-
{ dirPath: dirPath2, moduleNames },
|
|
35854
|
-
fn("patch")(function* ({ dirPath: dirPath4, moduleNames: moduleNames3 }) {
|
|
35876
|
+
{ dirPath: dirPath2, moduleNames, force },
|
|
35877
|
+
fn("patch")(function* ({ dirPath: dirPath4, force: force2, moduleNames: moduleNames3 }) {
|
|
35855
35878
|
const fs = yield* FileSystem;
|
|
35856
35879
|
const { version: effectLspVersion } = yield* getPackageJsonData(__dirname);
|
|
35857
35880
|
yield* logDebug2(`Searching for typescript in ${dirPath4}...`);
|
|
@@ -35862,7 +35885,16 @@ var patch9 = make58(
|
|
|
35862
35885
|
yield* logDebug2(`Searching ${moduleName}...`);
|
|
35863
35886
|
const filePath = yield* getModuleFilePath(dirPath4, moduleName);
|
|
35864
35887
|
yield* logDebug2(`Reading ${moduleName} from ${filePath}...`);
|
|
35865
|
-
const
|
|
35888
|
+
const sourceText = yield* getSourceFileText(filePath);
|
|
35889
|
+
yield* logDebug2(
|
|
35890
|
+
`Checking if ${filePath} is already patched with marker ${getPatchedMarker(effectLspVersion)}...`
|
|
35891
|
+
);
|
|
35892
|
+
if (!force2 && sourceText.indexOf(getPatchedMarker(effectLspVersion)) !== -1) {
|
|
35893
|
+
yield* logInfo2(`${filePath} is already patched with version ${effectLspVersion}, skipped.`);
|
|
35894
|
+
continue;
|
|
35895
|
+
}
|
|
35896
|
+
yield* logDebug2(`Parsing ${moduleName}...`);
|
|
35897
|
+
const sourceFile = yield* getUnpatchedSourceFile(filePath, sourceText);
|
|
35866
35898
|
yield* logDebug2(`Collecting patches for ${moduleName}...`);
|
|
35867
35899
|
const patches = yield* getPatchesForModule(moduleName, dirPath4, effectLspVersion, sourceFile);
|
|
35868
35900
|
const newSourceText = yield* applyTextChanges(sourceFile.text, patches);
|
|
@@ -35896,8 +35928,10 @@ var unpatch = make58(
|
|
|
35896
35928
|
for (const moduleName of modulesToUnpatch) {
|
|
35897
35929
|
yield* logDebug2(`Resolving ${moduleName}...`);
|
|
35898
35930
|
const filePath = yield* getModuleFilePath(dirPath4, moduleName);
|
|
35931
|
+
yield* logDebug2(`Reading ${moduleName} from ${filePath}...`);
|
|
35932
|
+
const sourceText = yield* getSourceFileText(filePath);
|
|
35899
35933
|
yield* logDebug2(`Unpatching ${filePath}...`);
|
|
35900
|
-
const sourceFile = yield* getUnpatchedSourceFile(filePath);
|
|
35934
|
+
const sourceFile = yield* getUnpatchedSourceFile(filePath, sourceText);
|
|
35901
35935
|
yield* logDebug2(`Writing ${filePath}...`);
|
|
35902
35936
|
yield* fs.writeFileString(filePath, sourceFile.text);
|
|
35903
35937
|
yield* logInfo2(`${filePath} unpatched successfully.`);
|