@spotlightjs/spotlight 2.10.2 → 2.11.0

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.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("node:crypto"),S=require("import-meta-resolve"),v=require("@spotlightjs/sidecar");var a=typeof document<"u"?document.currentScript:null;const y="@spotlightjs/spotlight",O=7;function c({server:t,module:r=y}={}){const e=S.resolve(r,typeof document>"u"?require("url").pathToFileURL(__filename).href:a&&a.tagName.toUpperCase()==="SCRIPT"&&a.src||new URL("vite-plugin.cjs",document.baseURI).href).slice(O).split("?",1)[0];return t&&t.config.server.fs.allow.push(e),e}const _=new Set(["importPath","integrationNames","port"]);function m(t){const r=Object.fromEntries(Object.entries(t).filter(([i])=>!i.startsWith("_")&&!_.has(i)));let e=JSON.stringify({...r,showTriggerButton:t.showTriggerButton!==!1,injectImmediately:t.injectImmediately!==!1});const n=JSON.stringify({openLastError:!0});return e=`{integrations: [${(t.integrationNames||["sentry"]).map(i=>`Spotlight.${i}(${n})`).join(", ")}], ${e.slice(1)}`,[`import * as Spotlight from ${JSON.stringify("/@fs"+(t.importPath||c()))};`,`Spotlight.init(${e});`,"window.createErrorOverlay=function createErrorOverlay(err) { Spotlight.openSpotlight(); };"].join(`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("node:crypto"),S=require("import-meta-resolve"),v=require("@spotlightjs/sidecar");var a=typeof document<"u"?document.currentScript:null;const y="@spotlightjs/spotlight",O=7;function c({server:t,module:r=y}={}){const e=S.resolve(r,typeof document>"u"?require("url").pathToFileURL(__filename).href:a&&a.tagName.toUpperCase()==="SCRIPT"&&a.src||new URL("vite-plugin.cjs",document.baseURI).href).slice(O).split("?",1)[0];return t&&t.config.server.fs.allow.push(e),e}const _=new Set(["importPath","integrationNames","port"]);function m(t){const r=Object.fromEntries(Object.entries(t).filter(([i])=>!i.startsWith("_")&&!_.has(i)));let e=JSON.stringify({...r,showTriggerButton:t.showTriggerButton!==!1,injectImmediately:t.injectImmediately!==!1});const n=JSON.stringify({openLastError:!0});return e=`{integrations: [${(t.integrationNames||["sentry"]).map(i=>`Spotlight.${i}(${n})`).join(", ")}], ${e.slice(1)}`,[`import * as Spotlight from ${JSON.stringify(`/@fs${t.importPath||c()}`)};`,`Spotlight.init(${e});`,"window.createErrorOverlay=function createErrorOverlay(err) { Spotlight.openSpotlight(); };"].join(`
2
2
  `)}async function w(t,r="http://localhost:8969/stream"){var u;if(!t.errors){console.log(t);return}const e=t.errors[0],n=(u=t.pluginCode)==null?void 0:u.split(`
3
3
  `),o=e.location.lineText,i=n==null?void 0:n.indexOf(o),s=h.randomBytes(16).toString("hex"),l=new Date,d=new URL(r);let p=r;d.pathname.endsWith("/stream")||(p=new URL("/stream",r).href);const f=[{event_id:s,sent_at:l.toISOString()},{type:"event"},{event_id:s,level:"error",platform:"javascript",environment:"development",tags:{runtime:"vite"},timestamp:l.getTime(),exception:{values:[{type:"Error",mechanism:{type:"instrument",handled:!1},value:e.text,stacktrace:{frames:[e?{filename:e.location.file,lineno:e.location.line,colno:e.location.column,context_line:o,pre_context:n==null?void 0:n.slice(0,i),post_context:i!=null&&i>-1?n==null?void 0:n.slice(i+1):void 0}:{filename:t.id}]}}]}}].map(g=>JSON.stringify(g)).join(`
4
4
  `);return await fetch(p,{method:"POST",body:f,headers:{"Content-Type":"application/x-sentry-envelope"}})}function T(t={}){let r;return{name:"spotlight",apply:"serve",transform(e,n){if(n.endsWith("vite/dist/client/client.mjs"))return`${m({...t,importPath:r})}${e}`},configureServer(e){return v.setupSidecar({port:t.port}),r=c({server:e}),()=>e.middlewares.use(async function(o,i,s,l){if(await w(o,t.sidecarUrl),s.headersSent)return l(o)})}}}exports.buildClientInit=m;exports.default=T;exports.getSpotlightClientModulePath=c;
@@ -21,7 +21,7 @@ function O(t) {
21
21
  });
22
22
  const n = JSON.stringify({ openLastError: !0 });
23
23
  return e = `{integrations: [${(t.integrationNames || ["sentry"]).map((i) => `Spotlight.${i}(${n})`).join(", ")}], ${e.slice(1)}`, [
24
- `import * as Spotlight from ${JSON.stringify("/@fs" + (t.importPath || p()))};`,
24
+ `import * as Spotlight from ${JSON.stringify(`/@fs${t.importPath || p()}`)};`,
25
25
  `Spotlight.init(${e});`,
26
26
  "window.createErrorOverlay=function createErrorOverlay(err) { Spotlight.openSpotlight(); };"
27
27
  ].join(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spotlightjs/spotlight",
3
3
  "description": "Spotlight - Sentry for development. Containing the overlay and the sidecar.",
4
- "version": "2.10.2",
4
+ "version": "2.11.0",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "files": [
@@ -32,20 +32,20 @@
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
- "@sentry/node": "^8.42.0",
35
+ "@sentry/node": "^8.49.0",
36
36
  "import-meta-resolve": "^4.1.0",
37
37
  "macho-unsign": "^2.0.6",
38
38
  "portable-executable-signature": "^2.0.6",
39
39
  "postject": "1.0.0-alpha.6",
40
- "@spotlightjs/overlay": "2.11.0",
41
- "@spotlightjs/sidecar": "1.11.1"
40
+ "@spotlightjs/overlay": "2.12.0",
41
+ "@spotlightjs/sidecar": "1.11.2"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^18.19.55",
45
- "esbuild": "^0.24.0",
45
+ "fossilize": "^0.4.1",
46
46
  "typescript": "^5.6.2",
47
- "vite": "^5.4.12",
48
- "@spotlightjs/tsconfig": "1.0.1"
47
+ "vite": "^5.4.14",
48
+ "@spotlightjs/tsconfig": "2.0.0"
49
49
  },
50
50
  "volta": {
51
51
  "extends": "../../package.json"
@@ -56,7 +56,8 @@
56
56
  "scripts": {
57
57
  "start": "./bin/run.js",
58
58
  "dev": "vite build --watch",
59
- "build": "vite build && vite build --config vite.overlay.config.ts && ./build.js && tsc",
59
+ "build:sea": "fossilize -m dist/overlay/manifest.json",
60
+ "build": "vite build && vite build --config vite.overlay.config.ts && npm run build:sea && tsc",
60
61
  "build:watch": "vite build --watch",
61
62
  "yalc:publish": "yalc publish --push --sig --private",
62
63
  "clean": "rimraf dist"