@react-grab/cli 0.0.87 → 0.0.89

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.
Files changed (3) hide show
  1. package/dist/cli.cjs +95 -56
  2. package/dist/cli.js +95 -56
  3. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -503,18 +503,18 @@ var NEXT_APP_ROUTER_SCRIPT = `{process.env.NODE_ENV === "development" && (
503
503
  )}`;
504
504
  var NEXT_APP_ROUTER_SCRIPT_WITH_AGENT = (agent) => {
505
505
  if (agent === "none") return NEXT_APP_ROUTER_SCRIPT;
506
- const agentScript = `<Script
507
- src="//unpkg.com/@react-grab/${agent}/dist/client.global.js"
508
- strategy="lazyOnload"
509
- />`;
510
506
  return `{process.env.NODE_ENV === "development" && (
511
- <>
512
- <Script
513
- src="//unpkg.com/react-grab/dist/index.global.js"
514
- strategy="beforeInteractive"
515
- />
516
- ${agentScript}
517
- </>
507
+ <Script
508
+ src="//unpkg.com/react-grab/dist/index.global.js"
509
+ crossOrigin="anonymous"
510
+ strategy="beforeInteractive"
511
+ />
512
+ )}
513
+ {process.env.NODE_ENV === "development" && (
514
+ <Script
515
+ src="//unpkg.com/@react-grab/${agent}/dist/client.global.js"
516
+ strategy="lazyOnload"
517
+ />
518
518
  )}`;
519
519
  };
520
520
  var NEXT_PAGES_ROUTER_SCRIPT = `{process.env.NODE_ENV === "development" && (
@@ -526,18 +526,18 @@ var NEXT_PAGES_ROUTER_SCRIPT = `{process.env.NODE_ENV === "development" && (
526
526
  )}`;
527
527
  var NEXT_PAGES_ROUTER_SCRIPT_WITH_AGENT = (agent) => {
528
528
  if (agent === "none") return NEXT_PAGES_ROUTER_SCRIPT;
529
- const agentScript = `<Script
530
- src="//unpkg.com/@react-grab/${agent}/dist/client.global.js"
531
- strategy="lazyOnload"
532
- />`;
533
529
  return `{process.env.NODE_ENV === "development" && (
534
- <>
535
- <Script
536
- src="//unpkg.com/react-grab/dist/index.global.js"
537
- strategy="beforeInteractive"
538
- />
539
- ${agentScript}
540
- </>
530
+ <Script
531
+ src="//unpkg.com/react-grab/dist/index.global.js"
532
+ crossOrigin="anonymous"
533
+ strategy="beforeInteractive"
534
+ />
535
+ )}
536
+ {process.env.NODE_ENV === "development" && (
537
+ <Script
538
+ src="//unpkg.com/@react-grab/${agent}/dist/client.global.js"
539
+ strategy="lazyOnload"
540
+ />
541
541
  )}`;
542
542
  };
543
543
  var VITE_SCRIPT = `<script type="module">
@@ -1081,31 +1081,41 @@ var previewPackageJsonTransform = (projectRoot, agent, installedAgents) => {
1081
1081
  }
1082
1082
  try {
1083
1083
  const packageJson = JSON.parse(originalContent);
1084
+ let targetScriptKey = "dev";
1084
1085
  if (!packageJson.scripts?.dev) {
1085
- return {
1086
- success: false,
1087
- filePath: packageJsonPath,
1088
- message: 'No "dev" script found in package.json'
1089
- };
1086
+ const devScriptKeys = Object.keys(packageJson.scripts || {}).filter(
1087
+ (key) => key.startsWith("dev")
1088
+ );
1089
+ if (devScriptKeys.length > 0) {
1090
+ targetScriptKey = devScriptKeys[0];
1091
+ } else {
1092
+ return {
1093
+ success: true,
1094
+ filePath: packageJsonPath,
1095
+ message: "No dev script found in package.json",
1096
+ noChanges: true,
1097
+ warning: `No dev script found. Run: ${agentPrefix} <your dev command>`
1098
+ };
1099
+ }
1090
1100
  }
1091
- const currentDevScript = packageJson.scripts.dev;
1101
+ const currentDevScript = packageJson.scripts[targetScriptKey];
1092
1102
  for (const installedAgent of installedAgents) {
1093
1103
  const existingPrefix = AGENT_PREFIXES[installedAgent];
1094
1104
  if (existingPrefix && currentDevScript.includes(existingPrefix)) {
1095
1105
  return {
1096
1106
  success: true,
1097
1107
  filePath: packageJsonPath,
1098
- message: `Agent ${installedAgent} is already in dev script`,
1108
+ message: `Agent ${installedAgent} is already in ${targetScriptKey} script`,
1099
1109
  noChanges: true
1100
1110
  };
1101
1111
  }
1102
1112
  }
1103
- packageJson.scripts.dev = `${agentPrefix} ${currentDevScript}`;
1113
+ packageJson.scripts[targetScriptKey] = `${agentPrefix} ${currentDevScript}`;
1104
1114
  const newContent = JSON.stringify(packageJson, null, 2) + "\n";
1105
1115
  return {
1106
1116
  success: true,
1107
1117
  filePath: packageJsonPath,
1108
- message: `Add ${agent} server to dev script`,
1118
+ message: `Add ${agent} server to ${targetScriptKey} script`,
1109
1119
  originalContent,
1110
1120
  newContent
1111
1121
  };
@@ -1171,7 +1181,8 @@ var formatOptionsAsJson = (options) => {
1171
1181
  const cleanOptions = {};
1172
1182
  if (options.activationKey) {
1173
1183
  const activationKey = {};
1174
- if (options.activationKey.key) activationKey.key = options.activationKey.key;
1184
+ if (options.activationKey.key)
1185
+ activationKey.key = options.activationKey.key;
1175
1186
  if (options.activationKey.metaKey) activationKey.metaKey = true;
1176
1187
  if (options.activationKey.ctrlKey) activationKey.ctrlKey = true;
1177
1188
  if (options.activationKey.shiftKey) activationKey.shiftKey = true;
@@ -1231,7 +1242,10 @@ var addOptionsToNextScript = (originalContent, options, filePath) => {
1231
1242
  )}`;
1232
1243
  let newScriptTag;
1233
1244
  if (existingDataOptionsMatch) {
1234
- newScriptTag = scriptTag.replace(existingDataOptionsMatch[0], dataOptionsAttr);
1245
+ newScriptTag = scriptTag.replace(
1246
+ existingDataOptionsMatch[0],
1247
+ dataOptionsAttr
1248
+ );
1235
1249
  } else {
1236
1250
  newScriptTag = `${scriptOpening}
1237
1251
  ${dataOptionsAttr}
@@ -1259,7 +1273,10 @@ var addOptionsToViteScript = (originalContent, options, filePath) => {
1259
1273
  }
1260
1274
  const optionsJson = formatOptionsAsJson(options);
1261
1275
  const newImport = `import("react-grab").then((m) => m.init(${optionsJson}))`;
1262
- const newContent = originalContent.replace(reactGrabImportMatch[0], newImport);
1276
+ const newContent = originalContent.replace(
1277
+ reactGrabImportMatch[0],
1278
+ newImport
1279
+ );
1263
1280
  return {
1264
1281
  success: true,
1265
1282
  filePath,
@@ -1281,7 +1298,10 @@ var addOptionsToWebpackImport = (originalContent, options, filePath) => {
1281
1298
  }
1282
1299
  const optionsJson = formatOptionsAsJson(options);
1283
1300
  const newImport = `import("react-grab").then((m) => m.init(${optionsJson}))`;
1284
- const newContent = originalContent.replace(reactGrabImportMatch[0], newImport);
1301
+ const newContent = originalContent.replace(
1302
+ reactGrabImportMatch[0],
1303
+ newImport
1304
+ );
1285
1305
  return {
1286
1306
  success: true,
1287
1307
  filePath,
@@ -1327,7 +1347,7 @@ var applyOptionsTransform = (result) => {
1327
1347
  };
1328
1348
 
1329
1349
  // src/commands/add.ts
1330
- var VERSION = "0.0.87";
1350
+ var VERSION = "0.0.89";
1331
1351
  var AGENT_NAMES = {
1332
1352
  "claude-code": "Claude Code",
1333
1353
  cursor: "Cursor",
@@ -1536,13 +1556,17 @@ var add = new commander.Command().name("add").description("add an agent integrat
1536
1556
  logger.log(
1537
1557
  `${highlighter.success("Success!")} ${AGENT_NAMES[agentIntegration]} has been added.`
1538
1558
  );
1539
- logger.log("Make sure to start the agent server before using it.");
1559
+ if (packageJsonResult.warning) {
1560
+ logger.warn(packageJsonResult.warning);
1561
+ } else {
1562
+ logger.log("Make sure to start the agent server before using it.");
1563
+ }
1540
1564
  logger.break();
1541
1565
  } catch (error) {
1542
1566
  handleError(error);
1543
1567
  }
1544
1568
  });
1545
- var VERSION2 = "0.0.87";
1569
+ var VERSION2 = "0.0.89";
1546
1570
  var MODIFIER_KEY_NAMES = {
1547
1571
  metaKey: process.platform === "darwin" ? "\u2318 Command" : "\u229E Windows",
1548
1572
  ctrlKey: "Ctrl",
@@ -1552,10 +1576,12 @@ var MODIFIER_KEY_NAMES = {
1552
1576
  var formatActivationKey = (activationKey) => {
1553
1577
  if (!activationKey) return "Default (Option/Alt)";
1554
1578
  const parts = [];
1555
- if (activationKey.metaKey) parts.push(process.platform === "darwin" ? "\u2318" : "Win");
1579
+ if (activationKey.metaKey)
1580
+ parts.push(process.platform === "darwin" ? "\u2318" : "Win");
1556
1581
  if (activationKey.ctrlKey) parts.push("Ctrl");
1557
1582
  if (activationKey.shiftKey) parts.push("Shift");
1558
- if (activationKey.altKey) parts.push(process.platform === "darwin" ? "\u2325" : "Alt");
1583
+ if (activationKey.altKey)
1584
+ parts.push(process.platform === "darwin" ? "\u2325" : "Alt");
1559
1585
  if (activationKey.key) parts.push(activationKey.key.toUpperCase());
1560
1586
  return parts.length > 0 ? parts.join(" + ") : "Default (Option/Alt)";
1561
1587
  };
@@ -1623,7 +1649,11 @@ var configure = new commander.Command().name("configure").alias("config").descri
1623
1649
  { title: MODIFIER_KEY_NAMES.metaKey, value: "metaKey" },
1624
1650
  { title: MODIFIER_KEY_NAMES.ctrlKey, value: "ctrlKey" },
1625
1651
  { title: MODIFIER_KEY_NAMES.shiftKey, value: "shiftKey" },
1626
- { title: MODIFIER_KEY_NAMES.altKey, value: "altKey", selected: true }
1652
+ {
1653
+ title: MODIFIER_KEY_NAMES.altKey,
1654
+ value: "altKey",
1655
+ selected: true
1656
+ }
1627
1657
  ],
1628
1658
  hint: "- Space to select, Enter to confirm"
1629
1659
  });
@@ -1750,7 +1780,7 @@ var configure = new commander.Command().name("configure").alias("config").descri
1750
1780
  handleError(error);
1751
1781
  }
1752
1782
  });
1753
- var VERSION3 = "0.0.87";
1783
+ var VERSION3 = "0.0.89";
1754
1784
  var REPORT_URL = "https://react-grab.com/api/report-cli";
1755
1785
  var DOCS_URL = "https://github.com/aidenybai/react-grab";
1756
1786
  var reportToCli = async (type, config, error) => {
@@ -1810,7 +1840,7 @@ var init = new commander.Command().name("init").description("initialize React Gr
1810
1840
  logger.break();
1811
1841
  logger.warn("React Grab is already installed.");
1812
1842
  logger.log(
1813
- `Use ${highlighter.info("--force")} to reconfigure, or ${highlighter.info("react-grab add")} to add an agent.`
1843
+ `Use ${highlighter.info("--force")} to reconfigure, or ${highlighter.info("npx grab@latest add")} to add an agent.`
1814
1844
  );
1815
1845
  logger.break();
1816
1846
  process.exit(0);
@@ -2045,7 +2075,11 @@ var init = new commander.Command().name("init").description("initialize React Gr
2045
2075
  logger.log(
2046
2076
  `${highlighter.success("Success!")} React Grab has been installed.`
2047
2077
  );
2048
- logger.log("You may now start your development server.");
2078
+ if (packageJsonResult.warning) {
2079
+ logger.warn(packageJsonResult.warning);
2080
+ } else {
2081
+ logger.log("You may now start your development server.");
2082
+ }
2049
2083
  logger.break();
2050
2084
  await reportToCli("completed", {
2051
2085
  framework: finalFramework,
@@ -2059,10 +2093,10 @@ var init = new commander.Command().name("init").description("initialize React Gr
2059
2093
  await reportToCli("error", void 0, error);
2060
2094
  }
2061
2095
  });
2062
- var VERSION4 = "0.0.87";
2096
+ var VERSION4 = "0.0.89";
2063
2097
  var DEFAULT_PROXY_PORT = 2e3;
2064
- var REACT_GRAB_SCRIPT = '<script src="//unpkg.com/react-grab/dist/index.global.js"></script>';
2065
- var buildProviderScript = (provider) => `<script src="//unpkg.com/${provider}/dist/client.global.js"></script>`;
2098
+ var REACT_GRAB_SCRIPT = '<script src="https://unpkg.com/react-grab/dist/index.global.js"></script>';
2099
+ var buildProviderScript = (provider) => `<script src="https://unpkg.com/${provider}/dist/client.global.js"></script>`;
2066
2100
  var findAvailablePort = async (startingPort, hostname) => {
2067
2101
  return new Promise((resolve) => {
2068
2102
  const server = http.createServer();
@@ -2192,15 +2226,19 @@ var start = new commander.Command().name("start").alias("proxy").description("st
2192
2226
  proxyReq: (proxyRequest) => {
2193
2227
  proxyRequest.removeHeader("accept-encoding");
2194
2228
  },
2195
- proxyRes: httpProxyMiddleware.responseInterceptor(async (responseBuffer, proxyResponse) => {
2196
- const contentType = proxyResponse.headers["content-type"] || "";
2197
- const isHtml = contentType.includes("text/html");
2198
- if (!isHtml) {
2199
- return responseBuffer;
2229
+ proxyRes: httpProxyMiddleware.responseInterceptor(
2230
+ async (responseBuffer, proxyResponse, request, response) => {
2231
+ response.removeHeader("content-security-policy");
2232
+ response.removeHeader("content-security-policy-report-only");
2233
+ const contentType = proxyResponse.headers["content-type"] || "";
2234
+ const isHtml = contentType.includes("text/html");
2235
+ if (!isHtml) {
2236
+ return responseBuffer;
2237
+ }
2238
+ const html = responseBuffer.toString("utf-8");
2239
+ return injectScript(html);
2200
2240
  }
2201
- const html = responseBuffer.toString("utf-8");
2202
- return injectScript(html);
2203
- })
2241
+ )
2204
2242
  }
2205
2243
  });
2206
2244
  const server = http.createServer((request, response) => {
@@ -2284,7 +2322,8 @@ var start = new commander.Command().name("start").alias("proxy").description("st
2284
2322
  });
2285
2323
 
2286
2324
  // src/cli.ts
2287
- var VERSION5 = "0.0.87";
2325
+ process.noDeprecation = true;
2326
+ var VERSION5 = "0.0.89";
2288
2327
  var VERSION_API_URL = "https://www.react-grab.com/api/version";
2289
2328
  process.on("SIGINT", () => process.exit(0));
2290
2329
  process.on("SIGTERM", () => process.exit(0));
package/dist/cli.js CHANGED
@@ -495,18 +495,18 @@ var NEXT_APP_ROUTER_SCRIPT = `{process.env.NODE_ENV === "development" && (
495
495
  )}`;
496
496
  var NEXT_APP_ROUTER_SCRIPT_WITH_AGENT = (agent) => {
497
497
  if (agent === "none") return NEXT_APP_ROUTER_SCRIPT;
498
- const agentScript = `<Script
499
- src="//unpkg.com/@react-grab/${agent}/dist/client.global.js"
500
- strategy="lazyOnload"
501
- />`;
502
498
  return `{process.env.NODE_ENV === "development" && (
503
- <>
504
- <Script
505
- src="//unpkg.com/react-grab/dist/index.global.js"
506
- strategy="beforeInteractive"
507
- />
508
- ${agentScript}
509
- </>
499
+ <Script
500
+ src="//unpkg.com/react-grab/dist/index.global.js"
501
+ crossOrigin="anonymous"
502
+ strategy="beforeInteractive"
503
+ />
504
+ )}
505
+ {process.env.NODE_ENV === "development" && (
506
+ <Script
507
+ src="//unpkg.com/@react-grab/${agent}/dist/client.global.js"
508
+ strategy="lazyOnload"
509
+ />
510
510
  )}`;
511
511
  };
512
512
  var NEXT_PAGES_ROUTER_SCRIPT = `{process.env.NODE_ENV === "development" && (
@@ -518,18 +518,18 @@ var NEXT_PAGES_ROUTER_SCRIPT = `{process.env.NODE_ENV === "development" && (
518
518
  )}`;
519
519
  var NEXT_PAGES_ROUTER_SCRIPT_WITH_AGENT = (agent) => {
520
520
  if (agent === "none") return NEXT_PAGES_ROUTER_SCRIPT;
521
- const agentScript = `<Script
522
- src="//unpkg.com/@react-grab/${agent}/dist/client.global.js"
523
- strategy="lazyOnload"
524
- />`;
525
521
  return `{process.env.NODE_ENV === "development" && (
526
- <>
527
- <Script
528
- src="//unpkg.com/react-grab/dist/index.global.js"
529
- strategy="beforeInteractive"
530
- />
531
- ${agentScript}
532
- </>
522
+ <Script
523
+ src="//unpkg.com/react-grab/dist/index.global.js"
524
+ crossOrigin="anonymous"
525
+ strategy="beforeInteractive"
526
+ />
527
+ )}
528
+ {process.env.NODE_ENV === "development" && (
529
+ <Script
530
+ src="//unpkg.com/@react-grab/${agent}/dist/client.global.js"
531
+ strategy="lazyOnload"
532
+ />
533
533
  )}`;
534
534
  };
535
535
  var VITE_SCRIPT = `<script type="module">
@@ -1073,31 +1073,41 @@ var previewPackageJsonTransform = (projectRoot, agent, installedAgents) => {
1073
1073
  }
1074
1074
  try {
1075
1075
  const packageJson = JSON.parse(originalContent);
1076
+ let targetScriptKey = "dev";
1076
1077
  if (!packageJson.scripts?.dev) {
1077
- return {
1078
- success: false,
1079
- filePath: packageJsonPath,
1080
- message: 'No "dev" script found in package.json'
1081
- };
1078
+ const devScriptKeys = Object.keys(packageJson.scripts || {}).filter(
1079
+ (key) => key.startsWith("dev")
1080
+ );
1081
+ if (devScriptKeys.length > 0) {
1082
+ targetScriptKey = devScriptKeys[0];
1083
+ } else {
1084
+ return {
1085
+ success: true,
1086
+ filePath: packageJsonPath,
1087
+ message: "No dev script found in package.json",
1088
+ noChanges: true,
1089
+ warning: `No dev script found. Run: ${agentPrefix} <your dev command>`
1090
+ };
1091
+ }
1082
1092
  }
1083
- const currentDevScript = packageJson.scripts.dev;
1093
+ const currentDevScript = packageJson.scripts[targetScriptKey];
1084
1094
  for (const installedAgent of installedAgents) {
1085
1095
  const existingPrefix = AGENT_PREFIXES[installedAgent];
1086
1096
  if (existingPrefix && currentDevScript.includes(existingPrefix)) {
1087
1097
  return {
1088
1098
  success: true,
1089
1099
  filePath: packageJsonPath,
1090
- message: `Agent ${installedAgent} is already in dev script`,
1100
+ message: `Agent ${installedAgent} is already in ${targetScriptKey} script`,
1091
1101
  noChanges: true
1092
1102
  };
1093
1103
  }
1094
1104
  }
1095
- packageJson.scripts.dev = `${agentPrefix} ${currentDevScript}`;
1105
+ packageJson.scripts[targetScriptKey] = `${agentPrefix} ${currentDevScript}`;
1096
1106
  const newContent = JSON.stringify(packageJson, null, 2) + "\n";
1097
1107
  return {
1098
1108
  success: true,
1099
1109
  filePath: packageJsonPath,
1100
- message: `Add ${agent} server to dev script`,
1110
+ message: `Add ${agent} server to ${targetScriptKey} script`,
1101
1111
  originalContent,
1102
1112
  newContent
1103
1113
  };
@@ -1163,7 +1173,8 @@ var formatOptionsAsJson = (options) => {
1163
1173
  const cleanOptions = {};
1164
1174
  if (options.activationKey) {
1165
1175
  const activationKey = {};
1166
- if (options.activationKey.key) activationKey.key = options.activationKey.key;
1176
+ if (options.activationKey.key)
1177
+ activationKey.key = options.activationKey.key;
1167
1178
  if (options.activationKey.metaKey) activationKey.metaKey = true;
1168
1179
  if (options.activationKey.ctrlKey) activationKey.ctrlKey = true;
1169
1180
  if (options.activationKey.shiftKey) activationKey.shiftKey = true;
@@ -1223,7 +1234,10 @@ var addOptionsToNextScript = (originalContent, options, filePath) => {
1223
1234
  )}`;
1224
1235
  let newScriptTag;
1225
1236
  if (existingDataOptionsMatch) {
1226
- newScriptTag = scriptTag.replace(existingDataOptionsMatch[0], dataOptionsAttr);
1237
+ newScriptTag = scriptTag.replace(
1238
+ existingDataOptionsMatch[0],
1239
+ dataOptionsAttr
1240
+ );
1227
1241
  } else {
1228
1242
  newScriptTag = `${scriptOpening}
1229
1243
  ${dataOptionsAttr}
@@ -1251,7 +1265,10 @@ var addOptionsToViteScript = (originalContent, options, filePath) => {
1251
1265
  }
1252
1266
  const optionsJson = formatOptionsAsJson(options);
1253
1267
  const newImport = `import("react-grab").then((m) => m.init(${optionsJson}))`;
1254
- const newContent = originalContent.replace(reactGrabImportMatch[0], newImport);
1268
+ const newContent = originalContent.replace(
1269
+ reactGrabImportMatch[0],
1270
+ newImport
1271
+ );
1255
1272
  return {
1256
1273
  success: true,
1257
1274
  filePath,
@@ -1273,7 +1290,10 @@ var addOptionsToWebpackImport = (originalContent, options, filePath) => {
1273
1290
  }
1274
1291
  const optionsJson = formatOptionsAsJson(options);
1275
1292
  const newImport = `import("react-grab").then((m) => m.init(${optionsJson}))`;
1276
- const newContent = originalContent.replace(reactGrabImportMatch[0], newImport);
1293
+ const newContent = originalContent.replace(
1294
+ reactGrabImportMatch[0],
1295
+ newImport
1296
+ );
1277
1297
  return {
1278
1298
  success: true,
1279
1299
  filePath,
@@ -1319,7 +1339,7 @@ var applyOptionsTransform = (result) => {
1319
1339
  };
1320
1340
 
1321
1341
  // src/commands/add.ts
1322
- var VERSION = "0.0.87";
1342
+ var VERSION = "0.0.89";
1323
1343
  var AGENT_NAMES = {
1324
1344
  "claude-code": "Claude Code",
1325
1345
  cursor: "Cursor",
@@ -1528,13 +1548,17 @@ var add = new Command().name("add").description("add an agent integration").argu
1528
1548
  logger.log(
1529
1549
  `${highlighter.success("Success!")} ${AGENT_NAMES[agentIntegration]} has been added.`
1530
1550
  );
1531
- logger.log("Make sure to start the agent server before using it.");
1551
+ if (packageJsonResult.warning) {
1552
+ logger.warn(packageJsonResult.warning);
1553
+ } else {
1554
+ logger.log("Make sure to start the agent server before using it.");
1555
+ }
1532
1556
  logger.break();
1533
1557
  } catch (error) {
1534
1558
  handleError(error);
1535
1559
  }
1536
1560
  });
1537
- var VERSION2 = "0.0.87";
1561
+ var VERSION2 = "0.0.89";
1538
1562
  var MODIFIER_KEY_NAMES = {
1539
1563
  metaKey: process.platform === "darwin" ? "\u2318 Command" : "\u229E Windows",
1540
1564
  ctrlKey: "Ctrl",
@@ -1544,10 +1568,12 @@ var MODIFIER_KEY_NAMES = {
1544
1568
  var formatActivationKey = (activationKey) => {
1545
1569
  if (!activationKey) return "Default (Option/Alt)";
1546
1570
  const parts = [];
1547
- if (activationKey.metaKey) parts.push(process.platform === "darwin" ? "\u2318" : "Win");
1571
+ if (activationKey.metaKey)
1572
+ parts.push(process.platform === "darwin" ? "\u2318" : "Win");
1548
1573
  if (activationKey.ctrlKey) parts.push("Ctrl");
1549
1574
  if (activationKey.shiftKey) parts.push("Shift");
1550
- if (activationKey.altKey) parts.push(process.platform === "darwin" ? "\u2325" : "Alt");
1575
+ if (activationKey.altKey)
1576
+ parts.push(process.platform === "darwin" ? "\u2325" : "Alt");
1551
1577
  if (activationKey.key) parts.push(activationKey.key.toUpperCase());
1552
1578
  return parts.length > 0 ? parts.join(" + ") : "Default (Option/Alt)";
1553
1579
  };
@@ -1615,7 +1641,11 @@ var configure = new Command().name("configure").alias("config").description("con
1615
1641
  { title: MODIFIER_KEY_NAMES.metaKey, value: "metaKey" },
1616
1642
  { title: MODIFIER_KEY_NAMES.ctrlKey, value: "ctrlKey" },
1617
1643
  { title: MODIFIER_KEY_NAMES.shiftKey, value: "shiftKey" },
1618
- { title: MODIFIER_KEY_NAMES.altKey, value: "altKey", selected: true }
1644
+ {
1645
+ title: MODIFIER_KEY_NAMES.altKey,
1646
+ value: "altKey",
1647
+ selected: true
1648
+ }
1619
1649
  ],
1620
1650
  hint: "- Space to select, Enter to confirm"
1621
1651
  });
@@ -1742,7 +1772,7 @@ var configure = new Command().name("configure").alias("config").description("con
1742
1772
  handleError(error);
1743
1773
  }
1744
1774
  });
1745
- var VERSION3 = "0.0.87";
1775
+ var VERSION3 = "0.0.89";
1746
1776
  var REPORT_URL = "https://react-grab.com/api/report-cli";
1747
1777
  var DOCS_URL = "https://github.com/aidenybai/react-grab";
1748
1778
  var reportToCli = async (type, config, error) => {
@@ -1802,7 +1832,7 @@ var init = new Command().name("init").description("initialize React Grab in your
1802
1832
  logger.break();
1803
1833
  logger.warn("React Grab is already installed.");
1804
1834
  logger.log(
1805
- `Use ${highlighter.info("--force")} to reconfigure, or ${highlighter.info("react-grab add")} to add an agent.`
1835
+ `Use ${highlighter.info("--force")} to reconfigure, or ${highlighter.info("npx grab@latest add")} to add an agent.`
1806
1836
  );
1807
1837
  logger.break();
1808
1838
  process.exit(0);
@@ -2037,7 +2067,11 @@ var init = new Command().name("init").description("initialize React Grab in your
2037
2067
  logger.log(
2038
2068
  `${highlighter.success("Success!")} React Grab has been installed.`
2039
2069
  );
2040
- logger.log("You may now start your development server.");
2070
+ if (packageJsonResult.warning) {
2071
+ logger.warn(packageJsonResult.warning);
2072
+ } else {
2073
+ logger.log("You may now start your development server.");
2074
+ }
2041
2075
  logger.break();
2042
2076
  await reportToCli("completed", {
2043
2077
  framework: finalFramework,
@@ -2051,10 +2085,10 @@ var init = new Command().name("init").description("initialize React Grab in your
2051
2085
  await reportToCli("error", void 0, error);
2052
2086
  }
2053
2087
  });
2054
- var VERSION4 = "0.0.87";
2088
+ var VERSION4 = "0.0.89";
2055
2089
  var DEFAULT_PROXY_PORT = 2e3;
2056
- var REACT_GRAB_SCRIPT = '<script src="//unpkg.com/react-grab/dist/index.global.js"></script>';
2057
- var buildProviderScript = (provider) => `<script src="//unpkg.com/${provider}/dist/client.global.js"></script>`;
2090
+ var REACT_GRAB_SCRIPT = '<script src="https://unpkg.com/react-grab/dist/index.global.js"></script>';
2091
+ var buildProviderScript = (provider) => `<script src="https://unpkg.com/${provider}/dist/client.global.js"></script>`;
2058
2092
  var findAvailablePort = async (startingPort, hostname) => {
2059
2093
  return new Promise((resolve) => {
2060
2094
  const server = createServer();
@@ -2184,15 +2218,19 @@ var start = new Command().name("start").alias("proxy").description("start a prox
2184
2218
  proxyReq: (proxyRequest) => {
2185
2219
  proxyRequest.removeHeader("accept-encoding");
2186
2220
  },
2187
- proxyRes: responseInterceptor(async (responseBuffer, proxyResponse) => {
2188
- const contentType = proxyResponse.headers["content-type"] || "";
2189
- const isHtml = contentType.includes("text/html");
2190
- if (!isHtml) {
2191
- return responseBuffer;
2221
+ proxyRes: responseInterceptor(
2222
+ async (responseBuffer, proxyResponse, request, response) => {
2223
+ response.removeHeader("content-security-policy");
2224
+ response.removeHeader("content-security-policy-report-only");
2225
+ const contentType = proxyResponse.headers["content-type"] || "";
2226
+ const isHtml = contentType.includes("text/html");
2227
+ if (!isHtml) {
2228
+ return responseBuffer;
2229
+ }
2230
+ const html = responseBuffer.toString("utf-8");
2231
+ return injectScript(html);
2192
2232
  }
2193
- const html = responseBuffer.toString("utf-8");
2194
- return injectScript(html);
2195
- })
2233
+ )
2196
2234
  }
2197
2235
  });
2198
2236
  const server = createServer((request, response) => {
@@ -2276,7 +2314,8 @@ var start = new Command().name("start").alias("proxy").description("start a prox
2276
2314
  });
2277
2315
 
2278
2316
  // src/cli.ts
2279
- var VERSION5 = "0.0.87";
2317
+ process.noDeprecation = true;
2318
+ var VERSION5 = "0.0.89";
2280
2319
  var VERSION_API_URL = "https://www.react-grab.com/api/version";
2281
2320
  process.on("SIGINT", () => process.exit(0));
2282
2321
  process.on("SIGTERM", () => process.exit(0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-grab/cli",
3
- "version": "0.0.87",
3
+ "version": "0.0.89",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "react-grab": "./dist/cli.js"