viewgate-wrapper 1.2.1 ā 1.3.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/package.json +1 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -74
- package/dist/components/ViewGateOverlay.d.ts +0 -4
- package/dist/components/ViewGateOverlay.d.ts.map +0 -1
- package/dist/components/ViewGateProvider.d.ts +0 -64
- package/dist/components/ViewGateProvider.d.ts.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/main.d.ts +0 -2
- package/dist/main.d.ts.map +0 -1
- package/dist/plugin/next-loader.d.ts +0 -2
- package/dist/plugin/next-loader.d.ts.map +0 -1
- package/dist/plugin/next-loader.js +0 -11
- package/dist/plugin/transform-logic.d.ts +0 -2
- package/dist/plugin/transform-logic.d.ts.map +0 -1
- package/dist/plugin/transform-logic.js +0 -20
- package/dist/plugin/vite-plugin-viewgate.d.ts +0 -9
- package/dist/plugin/vite-plugin-viewgate.d.ts.map +0 -1
- package/dist/plugin/vite-plugin-viewgate.js +0 -14
package/package.json
CHANGED
package/dist/cli.d.ts
DELETED
package/dist/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import os from 'os';
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
|
-
async function setup() {
|
|
9
|
-
console.log('š Setting up ViewGate MCP Server...');
|
|
10
|
-
// 1. Locate mcp_config.json
|
|
11
|
-
const configDir = path.join(os.homedir(), '.gemini', 'antigravity');
|
|
12
|
-
const configPath = path.join(configDir, 'mcp_config.json');
|
|
13
|
-
if (!fs.existsSync(configPath)) {
|
|
14
|
-
console.error(`ā Could not find mcp_config.json at ${configPath}`);
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
// 2. Determine the path to the MCP server
|
|
18
|
-
// In production (node_modules), we'll be in dist/cli.js, so mcp-server is at ../mcp-server
|
|
19
|
-
// During local dev, it might be different.
|
|
20
|
-
let mcpServerPath = '';
|
|
21
|
-
// Check if we are running from node_modules or local dev
|
|
22
|
-
const isLocalDev = __dirname.includes('view-gate-wrapper' + path.sep + 'src') || __dirname.includes('view-gate-wrapper' + path.sep + 'dist');
|
|
23
|
-
if (isLocalDev) {
|
|
24
|
-
// Find the root of the project
|
|
25
|
-
let root = __dirname;
|
|
26
|
-
while (root !== path.parse(root).root && !fs.existsSync(path.join(root, 'package.json'))) {
|
|
27
|
-
root = path.dirname(root);
|
|
28
|
-
}
|
|
29
|
-
mcpServerPath = path.join(root, 'mcp-server', 'dist', 'index.js');
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// In node_modules, we expect to be in something like node_modules/viewgate-wrapper/dist
|
|
33
|
-
mcpServerPath = path.join(__dirname, '..', 'mcp-server', 'dist', 'index.js');
|
|
34
|
-
}
|
|
35
|
-
// Normalize to forward slashes for the JSON config (cleaner on Windows)
|
|
36
|
-
const normalizedMcpPath = mcpServerPath.replace(/\\/g, '/');
|
|
37
|
-
if (!fs.existsSync(mcpServerPath)) {
|
|
38
|
-
console.error(`ā MCP Server not found at: ${mcpServerPath}`);
|
|
39
|
-
console.log('Please ensure you have built the project: npm run build');
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
// 3. Read and update mcp_config.json
|
|
43
|
-
try {
|
|
44
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
45
|
-
if (!config.mcpServers) {
|
|
46
|
-
config.mcpServers = {};
|
|
47
|
-
}
|
|
48
|
-
const currentServer = config.mcpServers.viewgate || {};
|
|
49
|
-
const env = currentServer.env || {};
|
|
50
|
-
// Default values if not present
|
|
51
|
-
const backendUrl = env.BACKEND_URL || 'https://view-gate.vercel.app';
|
|
52
|
-
const apiKey = env.API_KEY || 'YOUR_API_KEY_HERE';
|
|
53
|
-
config.mcpServers.viewgate = {
|
|
54
|
-
command: 'node',
|
|
55
|
-
args: [normalizedMcpPath],
|
|
56
|
-
env: {
|
|
57
|
-
BACKEND_URL: backendUrl,
|
|
58
|
-
API_KEY: apiKey
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
62
|
-
console.log(`ā
Updated mcp_config.json successfully!`);
|
|
63
|
-
console.log(`š MCP Path: ${normalizedMcpPath}`);
|
|
64
|
-
if (apiKey === 'YOUR_API_KEY_HERE') {
|
|
65
|
-
console.log('\nā ļø Remember to set your API_KEY in:');
|
|
66
|
-
console.log(` ${configPath}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
console.error(`ā Error updating configuration: ${error.message}`);
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
setup();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ViewGateOverlay.d.ts","sourceRoot":"","sources":["../../src/components/ViewGateOverlay.tsx"],"names":[],"mappings":"AACA,OAAO,EAAoC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAGlE,OAAO,wBAAwB,CAAC;AAqDhC,eAAO,MAAM,eAAe,EAAE,EA2S7B,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { type ReactNode, type FC } from 'react';
|
|
2
|
-
import '../styles/viewgate.css';
|
|
3
|
-
export type Language = 'en' | 'es';
|
|
4
|
-
declare const translations: {
|
|
5
|
-
en: {
|
|
6
|
-
enterMode: string;
|
|
7
|
-
exitMode: string;
|
|
8
|
-
feedbackHeader: string;
|
|
9
|
-
selectedElement: string;
|
|
10
|
-
line: string;
|
|
11
|
-
placeholder: string;
|
|
12
|
-
cancel: string;
|
|
13
|
-
send: string;
|
|
14
|
-
submitting: string;
|
|
15
|
-
success: string;
|
|
16
|
-
error: string;
|
|
17
|
-
successHeader: string;
|
|
18
|
-
errorHeader: string;
|
|
19
|
-
preview: string;
|
|
20
|
-
};
|
|
21
|
-
es: {
|
|
22
|
-
enterMode: string;
|
|
23
|
-
exitMode: string;
|
|
24
|
-
feedbackHeader: string;
|
|
25
|
-
selectedElement: string;
|
|
26
|
-
line: string;
|
|
27
|
-
placeholder: string;
|
|
28
|
-
cancel: string;
|
|
29
|
-
send: string;
|
|
30
|
-
submitting: string;
|
|
31
|
-
success: string;
|
|
32
|
-
error: string;
|
|
33
|
-
successHeader: string;
|
|
34
|
-
errorHeader: string;
|
|
35
|
-
preview: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
export interface SemanticReference {
|
|
39
|
-
tag: string;
|
|
40
|
-
id: string;
|
|
41
|
-
classes: string;
|
|
42
|
-
text: string;
|
|
43
|
-
selector: string;
|
|
44
|
-
outerHtml: string;
|
|
45
|
-
parentContext: string;
|
|
46
|
-
source?: string;
|
|
47
|
-
}
|
|
48
|
-
interface ViewGateContextType {
|
|
49
|
-
addToast: (message: string, type: 'success' | 'error') => void;
|
|
50
|
-
language: Language;
|
|
51
|
-
t: typeof translations.en;
|
|
52
|
-
apiKey: string;
|
|
53
|
-
baseUrl?: string;
|
|
54
|
-
}
|
|
55
|
-
export declare const useViewGate: () => ViewGateContextType;
|
|
56
|
-
interface ViewGateProps {
|
|
57
|
-
children: ReactNode;
|
|
58
|
-
language?: Language;
|
|
59
|
-
apiKey: string;
|
|
60
|
-
baseUrl?: string;
|
|
61
|
-
}
|
|
62
|
-
export declare const ViewGate: FC<ViewGateProps>;
|
|
63
|
-
export {};
|
|
64
|
-
//# sourceMappingURL=ViewGateProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ViewGateProvider.d.ts","sourceRoot":"","sources":["../../src/components/ViewGateProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAuC,KAAK,SAAS,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAErF,OAAO,wBAAwB,CAAC;AAEhC,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCjB,CAAC;AAQF,MAAM,WAAW,iBAAiB;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,mBAAmB;IACzB,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,KAAK,IAAI,CAAC;IAC/D,QAAQ,EAAE,QAAQ,CAAC;IACnB,CAAC,EAAE,OAAO,YAAY,CAAC,EAAE,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,eAAO,MAAM,WAAW,2BAIvB,CAAC;AAEF,UAAU,aAAa;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CA8BtC,CAAC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from './components/ViewGateOverlay.js';
|
|
2
|
-
export * from './components/ViewGateProvider.js';
|
|
3
|
-
export { default as viewgatePlugin } from './plugin/vite-plugin-viewgate.js';
|
|
4
|
-
export { default as viewgateNextLoader } from './plugin/next-loader.js';
|
|
5
|
-
export * from './plugin/transform-logic.js';
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACxE,cAAc,6BAA6B,CAAC"}
|
package/dist/main.d.ts
DELETED
package/dist/main.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"next-loader.d.ts","sourceRoot":"","sources":["../../src/plugin/next-loader.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,UAUnE"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { transformSourcePaths } from './transform-logic.js';
|
|
2
|
-
export default function viewgateNextLoader(source) {
|
|
3
|
-
const id = this.resourcePath;
|
|
4
|
-
if (!id)
|
|
5
|
-
return source;
|
|
6
|
-
// Debug log to ensure loader is running
|
|
7
|
-
if (process.env.NODE_ENV === 'development') {
|
|
8
|
-
// console.log(`[ViewGate] Transforming: ${id}`);
|
|
9
|
-
}
|
|
10
|
-
return transformSourcePaths(source, id, process.cwd());
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transform-logic.d.ts","sourceRoot":"","sources":["../../src/plugin/transform-logic.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAoBzE"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export function transformSourcePaths(code, id, cwd) {
|
|
2
|
-
if (!id.endsWith('.tsx') && !id.endsWith('.jsx'))
|
|
3
|
-
return code;
|
|
4
|
-
if (id.includes('node_modules'))
|
|
5
|
-
return code;
|
|
6
|
-
const normalizePath = (p) => p.replace(/\\/g, '/');
|
|
7
|
-
const relativePath = normalizePath(id).replace(normalizePath(cwd), '');
|
|
8
|
-
const lines = code.split('\n');
|
|
9
|
-
const transformedLines = lines.map((line, index) => {
|
|
10
|
-
const lineNumber = index + 1;
|
|
11
|
-
// Regex to find JSX tags and inject data-source-path (handles self-closing tags)
|
|
12
|
-
return line.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n\/\>])/g, (match, prefix, tagName) => {
|
|
13
|
-
if (match.includes('data-source-path') || tagName === 'Fragment' || tagName === 'React.Fragment') {
|
|
14
|
-
return match;
|
|
15
|
-
}
|
|
16
|
-
return `${prefix}<${tagName} data-source-path="${relativePath}:${lineNumber}"`;
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
return transformedLines.join('\n');
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-viewgate.d.ts","sourceRoot":"","sources":["../../src/plugin/vite-plugin-viewgate.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,cAAc;;;oBAId,MAAM,MAAM,MAAM;;;;EAQzC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { transformSourcePaths } from './transform-logic.js';
|
|
2
|
-
export default function viewgatePlugin() {
|
|
3
|
-
return {
|
|
4
|
-
name: 'vite-plugin-viewgate',
|
|
5
|
-
enforce: 'pre',
|
|
6
|
-
transform(code, id) {
|
|
7
|
-
const transformedCode = transformSourcePaths(code, id, process.cwd());
|
|
8
|
-
return {
|
|
9
|
-
code: transformedCode,
|
|
10
|
-
map: null
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|