sunpeak 0.20.53 → 0.20.56

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 (42) hide show
  1. package/bin/commands/inspect.mjs +43 -7
  2. package/bin/lib/sandbox-server.mjs +34 -5
  3. package/bin/lib/test/base-config.mjs +8 -1
  4. package/dist/chatgpt/index.cjs +1 -1
  5. package/dist/chatgpt/index.js +1 -1
  6. package/dist/claude/index.cjs +1 -1
  7. package/dist/claude/index.js +1 -1
  8. package/dist/embed.css +2 -2
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/inspector/index.cjs +1 -1
  12. package/dist/inspector/index.js +1 -1
  13. package/dist/{inspector-CEmRtVwc.js → inspector-BYuRWH6c.js} +35 -6
  14. package/dist/inspector-BYuRWH6c.js.map +1 -0
  15. package/dist/{inspector-BtYInER9.cjs → inspector-CoBJOqh4.cjs} +35 -6
  16. package/dist/inspector-CoBJOqh4.cjs.map +1 -0
  17. package/dist/sandbox-proxy.html +34 -5
  18. package/dist/style.css +27 -27
  19. package/package.json +17 -17
  20. package/template/dist/albums/albums.html +1 -1
  21. package/template/dist/albums/albums.json +1 -1
  22. package/template/dist/carousel/carousel.html +1 -1
  23. package/template/dist/carousel/carousel.json +1 -1
  24. package/template/dist/map/map.html +536 -492
  25. package/template/dist/map/map.json +1 -1
  26. package/template/dist/review/review.html +1 -1
  27. package/template/dist/review/review.json +1 -1
  28. package/template/node_modules/.bin/vite +2 -2
  29. package/template/node_modules/.bin/vitest +2 -2
  30. package/template/node_modules/.vite/deps/_metadata.json +4 -4
  31. package/template/node_modules/.vite-mcp/deps/_metadata.json +22 -22
  32. package/template/node_modules/.vite-mcp/deps/mapbox-gl.js +32928 -31943
  33. package/template/node_modules/.vite-mcp/deps/mapbox-gl.js.map +1 -1
  34. package/template/node_modules/.vite-mcp/deps/vitest.js +21 -21
  35. package/template/node_modules/.vite-mcp/deps/vitest.js.map +1 -1
  36. package/template/package.json +7 -7
  37. package/template/tests/e2e/albums.spec.ts +0 -26
  38. package/template/tests/e2e/carousel.spec.ts +7 -63
  39. package/template/tests/e2e/map.spec.ts +0 -28
  40. package/template/tests/e2e/review.spec.ts +8 -45
  41. package/dist/inspector-BtYInER9.cjs.map +0 -1
  42. package/dist/inspector-CEmRtVwc.js.map +0 -1
@@ -5693,6 +5693,15 @@ iframe { border: none; width: 100%; height: 100%; display: block; }
5693
5693
  var innerFrame = null;
5694
5694
  var innerWindow = null;
5695
5695
  var platformScript = ${escapedPlatformScript};
5696
+ var DEFAULT_INNER_SANDBOX =
5697
+ 'allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox';
5698
+ var ALLOWED_INNER_SANDBOX_TOKENS = {
5699
+ 'allow-scripts': true,
5700
+ 'allow-same-origin': true,
5701
+ 'allow-forms': true,
5702
+ 'allow-popups': true,
5703
+ 'allow-popups-to-escape-sandbox': true
5704
+ };
5696
5705
 
5697
5706
  // Relay messages between parent (host) and inner iframe (app)
5698
5707
  window.addEventListener('message', function(event) {
@@ -5771,8 +5780,7 @@ iframe { border: none; width: 100%; height: 100%; display: block; }
5771
5780
  if (innerFrame) innerFrame.remove();
5772
5781
 
5773
5782
  innerFrame = document.createElement('iframe');
5774
- innerFrame.sandbox = params.sandbox ||
5775
- 'allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox';
5783
+ innerFrame.sandbox = sanitizeInnerSandbox(params.sandbox);
5776
5784
  if (params.allow) innerFrame.allow = params.allow;
5777
5785
  document.body.appendChild(innerFrame);
5778
5786
  innerWindow = innerFrame.contentWindow;
@@ -5787,14 +5795,15 @@ iframe { border: none; width: 100%; height: 100%; display: block; }
5787
5795
  }
5788
5796
 
5789
5797
  function createInnerFrameWithSrc(params) {
5798
+ var safeSrc = normalizeInnerSrc(params && params.src);
5799
+ if (!safeSrc) return;
5790
5800
  clearInterval(readyInterval);
5791
5801
  if (innerFrame) innerFrame.remove();
5792
5802
 
5793
5803
  innerFrame = document.createElement('iframe');
5794
- innerFrame.sandbox =
5795
- 'allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox';
5804
+ innerFrame.sandbox = DEFAULT_INNER_SANDBOX;
5796
5805
  if (params.allow) innerFrame.allow = params.allow;
5797
- innerFrame.src = params.src;
5806
+ innerFrame.src = safeSrc;
5798
5807
  innerFrame.style.height = '100%';
5799
5808
 
5800
5809
  // Set color-scheme on the inner iframe to match the host theme.
@@ -5856,6 +5865,26 @@ iframe { border: none; width: 100%; height: 100%; display: block; }
5856
5865
  innerWindow = innerFrame.contentWindow;
5857
5866
  }
5858
5867
 
5868
+ function sanitizeInnerSandbox(value) {
5869
+ if (typeof value !== 'string' || !value.trim()) return DEFAULT_INNER_SANDBOX;
5870
+ var tokens = value.trim().split(/\\s+/);
5871
+ for (var i = 0; i < tokens.length; i++) {
5872
+ if (!ALLOWED_INNER_SANDBOX_TOKENS[tokens[i]]) return DEFAULT_INNER_SANDBOX;
5873
+ }
5874
+ return tokens.join(' ');
5875
+ }
5876
+
5877
+ function normalizeInnerSrc(value) {
5878
+ if (typeof value !== 'string') return null;
5879
+ try {
5880
+ var url = new URL(value, window.location.href);
5881
+ if (url.protocol !== 'http:' && url.protocol !== 'https:') return null;
5882
+ return url.toString();
5883
+ } catch(e) {
5884
+ return null;
5885
+ }
5886
+ }
5887
+
5859
5888
  // Paint fence responder — same as in iframe-resource.ts
5860
5889
  var PAINT_FENCE_SCRIPT = 'window.addEventListener("message",function(e){' +
5861
5890
  'if(e.data&&e.data.method==="sunpeak/fence"){' +
@@ -9787,4 +9816,4 @@ Object.defineProperty(exports, "useThemeContext", {
9787
9816
  }
9788
9817
  });
9789
9818
 
9790
- //# sourceMappingURL=inspector-BtYInER9.cjs.map
9819
+ //# sourceMappingURL=inspector-CoBJOqh4.cjs.map