yap2app 1.1.2 → 1.1.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/bridge.js CHANGED
@@ -215,6 +215,7 @@ export function startBridge(port = PORT) {
215
215
  }
216
216
 
217
217
  // Direct execution
218
- if (import.meta.url === `file://${process.argv[1]}` || process.argv[1]?.endsWith('bridge.js')) {
218
+ const isDirectRun = Boolean(typeof process !== 'undefined' && process.argv && process.argv[1] && (process.argv[1].endsWith('bridge.js') || process.argv[1].endsWith('bridge')));
219
+ if (isDirectRun) {
219
220
  startBridge();
220
221
  }
package/mcp.js CHANGED
@@ -158,7 +158,8 @@ export async function runMcpServer() {
158
158
  console.error("⚡ Yap2App MCP Server running on stdio");
159
159
  }
160
160
 
161
- if (import.meta.url === `file://${process.argv[1]}` || process.argv[1]?.endsWith('mcp.js')) {
161
+ const isDirectRun = Boolean(typeof process !== 'undefined' && process.argv && process.argv[1] && (process.argv[1].endsWith('mcp.js') || process.argv[1].endsWith('mcp')));
162
+ if (isDirectRun) {
162
163
  runMcpServer().catch(err => {
163
164
  console.error("MCP Server Error:", err);
164
165
  process.exit(1);
package/package.json CHANGED
@@ -1,16 +1,19 @@
1
1
  {
2
2
  "name": "yap2app",
3
- "version": "1.1.2",
4
- "type": "module",
3
+ "version": "1.1.3",
5
4
  "description": "Autonomous Vibe-to-Prod Localhost Bridge & Model Context Protocol (MCP) Server",
6
5
  "main": "bin/cli.bundle.js",
7
6
  "bin": {
8
7
  "yap2app": "./bin/cli.js"
9
8
  },
9
+ "engines": {
10
+ "node": ">=10.0.0"
11
+ },
10
12
  "files": [
11
13
  "bin",
12
14
  "bridge.js",
13
15
  "mcp.js",
16
+ "polyfills.js",
14
17
  "scanner.js",
15
18
  "v2p.js",
16
19
  "README.md"
package/polyfills.js ADDED
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Universal Node.js Polyfills for Yap2App CLI
3
+ * Enables full backwards compatibility across all NVM Node versions (Node 10.x to 23.x+)
4
+ */
5
+
6
+ // 1. globalThis polyfill (Node <12)
7
+ if (typeof globalThis === 'undefined') {
8
+ if (typeof global !== 'undefined') {
9
+ global.globalThis = global;
10
+ } else if (typeof window !== 'undefined') {
11
+ window.globalThis = window;
12
+ } else if (typeof self !== 'undefined') {
13
+ self.globalThis = self;
14
+ }
15
+ }
16
+
17
+ // 2. Object.fromEntries polyfill (Node <12.0)
18
+ if (typeof Object.fromEntries === 'undefined') {
19
+ Object.fromEntries = function (entries) {
20
+ if (!entries) return {};
21
+ var obj = {};
22
+ for (var i = 0; i < entries.length; i++) {
23
+ var pair = entries[i];
24
+ if (pair && pair.length >= 2) {
25
+ obj[pair[0]] = pair[1];
26
+ }
27
+ }
28
+ return obj;
29
+ };
30
+ }
31
+
32
+ // 3. Object.hasOwn polyfill (Node <16.9)
33
+ if (typeof Object.hasOwn === 'undefined') {
34
+ Object.hasOwn = function (obj, prop) {
35
+ return obj != null && Object.prototype.hasOwnProperty.call(obj, prop);
36
+ };
37
+ }
38
+
39
+ // 4. Array.prototype.flat polyfill (Node <11.0)
40
+ if (!Array.prototype.flat) {
41
+ Array.prototype.flat = function (depth) {
42
+ var flattend = [];
43
+ var d = typeof depth === 'number' ? depth : 1;
44
+ (function flat(array, currentDepth) {
45
+ for (var i = 0; i < array.length; i++) {
46
+ if (Array.isArray(array[i]) && currentDepth > 0) {
47
+ flat(array[i], currentDepth - 1);
48
+ } else {
49
+ flattend.push(array[i]);
50
+ }
51
+ }
52
+ })(this, d);
53
+ return flattend;
54
+ };
55
+ }
56
+
57
+ // 5. String.prototype.replaceAll polyfill (Node <15.0)
58
+ if (!String.prototype.replaceAll) {
59
+ String.prototype.replaceAll = function (search, replacement) {
60
+ if (search instanceof RegExp) {
61
+ return this.replace(search, replacement);
62
+ }
63
+ return this.split(search).join(replacement);
64
+ };
65
+ }
66
+
67
+ // 6. Promise.allSettled polyfill (Node <12.9)
68
+ if (!Promise.allSettled) {
69
+ Promise.allSettled = function (promises) {
70
+ return Promise.all(
71
+ Array.from(promises).map(function (p) {
72
+ return Promise.resolve(p).then(
73
+ function (value) {
74
+ return { status: 'fulfilled', value: value };
75
+ },
76
+ function (reason) {
77
+ return { status: 'rejected', reason: reason };
78
+ }
79
+ );
80
+ })
81
+ );
82
+ };
83
+ }