Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@spotlightjs/spotlight

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spotlightjs/spotlight - npm Package Compare versions

Comparing version 2.5.0 to 2.6.0

bin/build.js

81

bin/run.js
#!/usr/bin/env node
const { setupSidecar } = await import('../dist/sidecar.js');
import { setupSidecar } from '@spotlightjs/sidecar';
import { inflateRawSync } from 'node:zlib';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import * as sea from 'node:sea';
import { fileURLToPath } from 'node:url';
if (process.stdout.isTTY) {
const data = Uint8Array.from(
inflateRawSync(
Buffer.from(
'bY7LCgMxFEK9L5MwDDSL9P//1DJMKGXowoUcUaFZOk8dU2Op9+qZVkYQoFsaEqA6PZxxma1AoMG+TiONTgcfAd741YxxVf8gCzCgWcYB7OSj9sjW7t2/eKxKAxkIYv8NqL3FpVY25CmjrBSuDw==',
'base64',
),
),
);
const E = '\x1b[';
const C = `${E}38;5;`;
const M_COL = `${C}96m`;
const F_COL = `${C}61m`;
const BOLD = `${E}1m`;
const RESET = `${E}0m`;
const NL = `${RESET}\n`;
let factor = 0.22;
let c = 0;
let col = 0;
let line = 0;
let lim = 26;
let r = 0;
for (let p of data) {
if (p === 255) {
process.stdout.write(NL);
c = col = 0;
if (line++ === 5) {
factor = factor / -3;
}
lim = Math.round(lim * (1 + factor));
r = Math.round(Math.random() * 18);
} else {
while (p-- >= 0) {
if (col < lim - 1) {
process.stdout.write(M_COL);
} else if (col === lim - 1) {
process.stdout.write(F_COL);
} else if (col === lim + r) {
process.stdout.write(`${RESET}${BOLD}`);
}
process.stdout.write(c ? (col >= 35 ? '#' : 's') : ' ');
col++;
}
c = !c;
}
}
process.stdout.write(NL);
}
const readAsset = sea.isSea()
? name => Buffer.from(sea.getRawAsset(name))
: (() => {
const ASSET_DIR = join(fileURLToPath(import.meta.url), '../../dist/overlay/');
return name => readFileSync(join(ASSET_DIR, name));
})();
const port = process.argv.length >= 3 ? Number(process.argv[2]) : undefined;
import { join } from 'path';
import { fileURLToPath } from 'url';
setupSidecar({ port, basePath: join(fileURLToPath(import.meta.url), '../../dist/overlay/') });
const MANIFEST_NAME = 'manifest.json';
const ENTRY_POINT_NAME = 'src/index.html';
const basePath = process.cwd();
const filesToServe = Object.create(null);
// Following the guide here: https://vite.dev/guide/backend-integration.html
const manifest = JSON.parse(readAsset(MANIFEST_NAME));
filesToServe[ENTRY_POINT_NAME] = readAsset(ENTRY_POINT_NAME);
const entries = Object.values(manifest);
for (const entry of entries) {
filesToServe[entry.file] = readAsset(entry.file);
}
setupSidecar({ port, basePath, filesToServe });

63

dist/vite-plugin.js

@@ -1,16 +0,16 @@

import { randomBytes as f } from "node:crypto";
import { resolve as g } from "import-meta-resolve";
import { setupSidecar as h } from "@spotlightjs/sidecar";
const u = "@spotlightjs/spotlight", d = 7;
function c({
import { randomBytes as g } from "node:crypto";
import { resolve as u } from "import-meta-resolve";
import { setupSidecar as d } from "@spotlightjs/sidecar";
const S = "@spotlightjs/spotlight", v = 7;
function p({
server: t,
module: r = u
module: r = S
} = {}) {
const e = g(r, import.meta.url).slice(d).split("?", 1)[0];
const e = u(r, import.meta.url).slice(v).split("?", 1)[0];
return t && t.config.server.fs.allow.push(e), e;
}
const v = /* @__PURE__ */ new Set(["importPath", "integrationNames", "port"]);
function S(t) {
const y = /* @__PURE__ */ new Set(["importPath", "integrationNames", "port"]);
function O(t) {
const r = Object.fromEntries(
Object.entries(t).filter(([i, l]) => !i.startsWith("_") && !v.has(i))
Object.entries(t).filter(([i]) => !i.startsWith("_") && !y.has(i))
);

@@ -22,5 +22,5 @@ let e = JSON.stringify({

});
const n = JSON.stringify({ sidecarUrl: t.sidecarUrl, openLastError: !0 });
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()))};`,
`import * as Spotlight from ${JSON.stringify("/@fs" + (t.importPath || p()))};`,
`Spotlight.init(${e});`,

@@ -31,4 +31,4 @@ "window.createErrorOverlay=function createErrorOverlay(err) { Spotlight.openSpotlight(); };"

}
async function y(t, r = "http://localhost:8969/stream") {
var a;
async function w(t, r = "http://localhost:8969/stream") {
var c;
if (!t.errors) {

@@ -38,8 +38,11 @@ console.log(t);

}
const e = t.errors[0], n = (a = t.pluginCode) == null ? void 0 : a.split(`
`), o = e.location.lineText, i = n == null ? void 0 : n.indexOf(o), l = f(16).toString("hex"), s = /* @__PURE__ */ new Date(), p = [
{ event_id: l, sent_at: s.toISOString() },
const e = t.errors[0], n = (c = t.pluginCode) == null ? void 0 : c.split(`
`), o = e.location.lineText, i = n == null ? void 0 : n.indexOf(o), s = g(16).toString("hex"), a = /* @__PURE__ */ new Date(), m = new URL(r);
let l = r;
m.pathname.endsWith("/stream") || (l = new URL("/stream", r).href);
const f = [
{ event_id: s, sent_at: a.toISOString() },
{ type: "event" },
{
event_id: l,
event_id: s,
level: "error",

@@ -49,3 +52,3 @@ platform: "javascript",

tags: { runtime: "vite" },
timestamp: s.getTime(),
timestamp: a.getTime(),
exception: {

@@ -78,11 +81,11 @@ values: [

}
].map((m) => JSON.stringify(m)).join(`
].map((h) => JSON.stringify(h)).join(`
`);
return await fetch(r, {
return await fetch(l, {
method: "POST",
body: p,
body: f,
headers: { "Content-Type": "application/x-sentry-envelope" }
});
}
function w(t = {}) {
function _(t = {}) {
let r;

@@ -94,8 +97,8 @@ return {

if (n.endsWith("vite/dist/client/client.mjs"))
return `${S({ ...t, importPath: r })}${e}`;
return `${O({ ...t, importPath: r })}${e}`;
},
configureServer(e) {
return h({ port: t.port }), r = c({ server: e }), () => e.middlewares.use(async function(o, i, l, s) {
if (await y(o), l.headersSent)
return s(o);
return d({ port: t.port }), r = p({ server: e }), () => e.middlewares.use(async function(o, i, s, a) {
if (await w(o, t.sidecarUrl), s.headersSent)
return a(o);
});

@@ -106,5 +109,5 @@ }

export {
S as buildClientInit,
w as default,
c as getSpotlightClientModulePath
O as buildClientInit,
_ as default,
p as getSpotlightClientModulePath
};
{
"name": "@spotlightjs/spotlight",
"description": "Spotlight - Sentry for development. Containing the overlay and the sidecar.",
"version": "2.5.0",
"version": "2.6.0",
"license": "Apache-2.0",

@@ -36,9 +36,12 @@ "type": "module",

"import-meta-resolve": "^4.1.0",
"@spotlightjs/overlay": "2.6.0",
"@spotlightjs/sidecar": "1.8.0"
"macho-unsign": "^2.0.6",
"portable-executable-signature": "^2.0.6",
"postject": "1.0.0-alpha.6",
"@spotlightjs/overlay": "2.7.0",
"@spotlightjs/sidecar": "1.9.0"
},
"devDependencies": {
"@types/node": "^18",
"typescript": "^5.0.2",
"vite": "^4.5.3",
"@types/node": "^18.19.55",
"typescript": "^5.6.2",
"vite": "^5.4.11",
"@spotlightjs/tsconfig": "1.0.0"

@@ -55,3 +58,3 @@ },

"dev": "vite build --watch",
"build": "vite build && vite build --config vite.overlay.config.ts && tsc",
"build": "vite build && vite build --config vite.overlay.config.ts && vite build --config vite.binary.config.ts && ./bin/build.js && tsc",
"build:watch": "vite build --watch",

@@ -58,0 +61,0 @@ "yalc:publish": "yalc publish --push --sig --private",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc