@solongate/proxy 0.26.3 → 0.26.4
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/dist/create.js +2 -2
- package/dist/index.js +2321 -3032
- package/dist/inject.js +11 -11
- package/dist/lib.js +4885 -0
- package/package.json +5 -3
package/dist/inject.js
CHANGED
|
@@ -163,21 +163,21 @@ function installSdk() {
|
|
|
163
163
|
try {
|
|
164
164
|
const pkg = JSON.parse(readFileSync(resolve("package.json"), "utf-8"));
|
|
165
165
|
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
166
|
-
if (allDeps["@solongate/
|
|
167
|
-
log(" @solongate/
|
|
166
|
+
if (allDeps["@solongate/proxy"]) {
|
|
167
|
+
log(" @solongate/proxy already installed");
|
|
168
168
|
return true;
|
|
169
169
|
}
|
|
170
170
|
} catch {
|
|
171
171
|
}
|
|
172
172
|
const pm = detectPackageManager();
|
|
173
|
-
const cmd = pm === "yarn" ? "yarn add @solongate/
|
|
174
|
-
log(` Installing @solongate/
|
|
173
|
+
const cmd = pm === "yarn" ? "yarn add @solongate/proxy" : `${pm} install @solongate/proxy`;
|
|
174
|
+
log(` Installing @solongate/proxy via ${pm}...`);
|
|
175
175
|
try {
|
|
176
176
|
execSync(cmd, { stdio: "pipe", cwd: process.cwd() });
|
|
177
177
|
return true;
|
|
178
178
|
} catch (err) {
|
|
179
179
|
log(` Failed to install: ${err instanceof Error ? err.message : String(err)}`);
|
|
180
|
-
log(" You can install manually: npm install @solongate/
|
|
180
|
+
log(" You can install manually: npm install @solongate/proxy");
|
|
181
181
|
return false;
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -204,18 +204,18 @@ function injectTypeScript(filePath) {
|
|
|
204
204
|
if (importNames.length === 1 && importNames[0] === "McpServer") {
|
|
205
205
|
modified = modified.replace(
|
|
206
206
|
importLine,
|
|
207
|
-
`import { SecureMcpServer } from '@solongate/
|
|
207
|
+
`import { SecureMcpServer } from '@solongate/proxy'`
|
|
208
208
|
);
|
|
209
|
-
changes.push("Replaced McpServer import with SecureMcpServer from @solongate/
|
|
209
|
+
changes.push("Replaced McpServer import with SecureMcpServer from @solongate/proxy");
|
|
210
210
|
} else {
|
|
211
211
|
const otherImports = importNames.filter((n) => n !== "McpServer");
|
|
212
212
|
const fromModule = importLine.match(/from\s*['"]([^'"]+)['"]/)?.[1] ?? "";
|
|
213
213
|
modified = modified.replace(
|
|
214
214
|
importLine,
|
|
215
215
|
`import { ${otherImports.join(", ")} } from '${fromModule}';
|
|
216
|
-
import { SecureMcpServer } from '@solongate/
|
|
216
|
+
import { SecureMcpServer } from '@solongate/proxy'`
|
|
217
217
|
);
|
|
218
|
-
changes.push("Removed McpServer from existing import, added SecureMcpServer import from @solongate/
|
|
218
|
+
changes.push("Removed McpServer from existing import, added SecureMcpServer import from @solongate/proxy");
|
|
219
219
|
}
|
|
220
220
|
importReplaced = true;
|
|
221
221
|
break;
|
|
@@ -223,9 +223,9 @@ import { SecureMcpServer } from '@solongate/sdk'`
|
|
|
223
223
|
}
|
|
224
224
|
if (!importReplaced) {
|
|
225
225
|
const insertPos = findImportInsertPosition(modified);
|
|
226
|
-
modified = modified.slice(0, insertPos) + `import { SecureMcpServer } from '@solongate/
|
|
226
|
+
modified = modified.slice(0, insertPos) + `import { SecureMcpServer } from '@solongate/proxy';
|
|
227
227
|
` + modified.slice(insertPos);
|
|
228
|
-
changes.push("Added SecureMcpServer import from @solongate/
|
|
228
|
+
changes.push("Added SecureMcpServer import from @solongate/proxy");
|
|
229
229
|
}
|
|
230
230
|
const constructorPattern = /new\s+McpServer\s*\(/g;
|
|
231
231
|
const constructorCount = (modified.match(constructorPattern) || []).length;
|