@spotlightjs/spotlight 2.13.2 → 3.0.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.
package/bin/instrument.js CHANGED
@@ -1,8 +1,8 @@
1
- import { init } from '@sentry/node';
1
+ import { init } from "@sentry/node";
2
2
 
3
3
  init({
4
- dsn: 'https://51bcd92dba1128934afd1c5726c84442@o1.ingest.us.sentry.io/4508404727283713',
5
- environment: process.env.NODE_ENV || 'development',
4
+ dsn: "https://51bcd92dba1128934afd1c5726c84442@o1.ingest.us.sentry.io/4508404727283713",
5
+ environment: process.env.NODE_ENV || "development",
6
6
  release: `spotlight@${process.env.npm_package_version}`,
7
7
  debug: Boolean(process.env.SENTRY_DEBUG),
8
8
 
@@ -29,7 +29,7 @@ init({
29
29
  }
30
30
 
31
31
  const homeDir = process.env.HOME || process.env.USERPROFILE;
32
- frame.filename = frame.filename?.replace(homeDir, '~');
32
+ frame.filename = frame.filename?.replace(homeDir, "~");
33
33
  }
34
34
  }
35
35
 
package/bin/run.js CHANGED
@@ -1,27 +1,27 @@
1
1
  #!/usr/bin/env node
2
- import { setContext, startSpan } from '@sentry/node';
3
- import { setupSidecar } from '@spotlightjs/sidecar';
4
- import { readFileSync } from 'node:fs';
5
- import Module from 'node:module';
6
- import { join } from 'node:path';
7
- import { fileURLToPath } from 'node:url';
8
- import { inflateRawSync } from 'node:zlib';
9
- import './instrument.js';
2
+ import { readFileSync } from "node:fs";
3
+ import Module from "node:module";
4
+ import { join } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { inflateRawSync } from "node:zlib";
7
+ import { setContext, startSpan } from "@sentry/node";
8
+ import { setupSidecar } from "@spotlightjs/sidecar";
9
+ import "./instrument.js";
10
10
  const require = Module.createRequire(import.meta.url);
11
11
  let sea = null;
12
12
  try {
13
13
  // This is to maintain compatibility with Node 20.11- as
14
14
  // the `node:sea` module is added in Node 20.12+
15
- sea = require('node:sea');
15
+ sea = require("node:sea");
16
16
  } catch {
17
17
  sea = { isSea: () => false };
18
18
  }
19
19
 
20
20
  const homeDir = process.env.HOME || process.env.USERPROFILE;
21
- setContext('CLI', {
21
+ setContext("CLI", {
22
22
  sea: sea.isSea(),
23
23
  // TODO: Be less naive with path obscuring
24
- argv: process.argv.map(arg => arg.replace(homeDir, '~')),
24
+ argv: process.argv.map(arg => arg.replace(homeDir, "~")),
25
25
  });
26
26
 
27
27
  const withTracing =
@@ -33,30 +33,30 @@ const readAsset = withTracing(
33
33
  sea.isSea()
34
34
  ? name => Buffer.from(sea.getRawAsset(name))
35
35
  : (() => {
36
- const ASSET_DIR = join(fileURLToPath(import.meta.url), '../../dist/overlay/');
36
+ const ASSET_DIR = join(fileURLToPath(import.meta.url), "../../dist/overlay/");
37
37
 
38
38
  return name => readFileSync(join(ASSET_DIR, name));
39
39
  })(),
40
- { name: 'readAsset', op: 'cli.asset.read' },
40
+ { name: "readAsset", op: "cli.asset.read" },
41
41
  );
42
42
 
43
- startSpan({ name: 'Spotlight CLI', op: 'cli' }, () => {
44
- startSpan({ name: 'ASCII Art', op: 'cli.art.ascii' }, () => {
43
+ startSpan({ name: "Spotlight CLI", op: "cli" }, () => {
44
+ startSpan({ name: "ASCII Art", op: "cli.art.ascii" }, () => {
45
45
  const MAX_COLS = process.stdout.columns;
46
46
  if (!process.stdout.isTTY || MAX_COLS < 35) return;
47
- let stdoutBuffer = '';
47
+ let stdoutBuffer = "";
48
48
 
49
- const data = startSpan({ name: 'Inflate ASCII Art Data', op: 'cli.art.ascii.inflate' }, () =>
49
+ const data = startSpan({ name: "Inflate ASCII Art Data", op: "cli.art.ascii.inflate" }, () =>
50
50
  Uint8Array.from(
51
51
  inflateRawSync(
52
52
  Buffer.from(
53
- 'bY7LCgMxFEK9L5MwDDSL9P//1DJMKGXowoUcUaFZOk8dU2Op9+qZVkYQoFsaEqA6PZxxma1AoMG+TiONTgcfAd741YxxVf8gCzCgWcYB7OSj9sjW7t2/eKxKAxkIYv8NqL3FpVY25CmjrBSuDw==',
54
- 'base64',
53
+ "bY7LCgMxFEK9L5MwDDSL9P//1DJMKGXowoUcUaFZOk8dU2Op9+qZVkYQoFsaEqA6PZxxma1AoMG+TiONTgcfAd741YxxVf8gCzCgWcYB7OSj9sjW7t2/eKxKAxkIYv8NqL3FpVY25CmjrBSuDw==",
54
+ "base64",
55
55
  ),
56
56
  ),
57
57
  ),
58
58
  );
59
- const E = '\x1b[';
59
+ const E = "\x1b[";
60
60
  const C = `${E}38;5;`;
61
61
  const M_COL = `${C}96m`;
62
62
  const F_COL = `${C}61m`;
@@ -87,7 +87,7 @@ startSpan({ name: 'Spotlight CLI', op: 'cli' }, () => {
87
87
  } else if (col === lim + r) {
88
88
  stdoutBuffer += `${RESET}${BOLD}`;
89
89
  }
90
- stdoutBuffer += c ? (col >= 35 ? '#' : 's') : ' ';
90
+ stdoutBuffer += c ? (col >= 35 ? "#" : "s") : " ";
91
91
  col++;
92
92
  }
93
93
  c = !c;
@@ -97,14 +97,14 @@ startSpan({ name: 'Spotlight CLI', op: 'cli' }, () => {
97
97
  process.stdout.write(stdoutBuffer);
98
98
  });
99
99
 
100
- startSpan({ name: 'Setup Sidecar', op: 'cli.setup.sidecar' }, () => {
100
+ startSpan({ name: "Setup Sidecar", op: "cli.setup.sidecar" }, () => {
101
101
  const port = process.argv.length >= 3 ? Number(process.argv[2]) : undefined;
102
- const MANIFEST_NAME = 'manifest.json';
103
- const ENTRY_POINT_NAME = 'src/index.html';
102
+ const MANIFEST_NAME = "manifest.json";
103
+ const ENTRY_POINT_NAME = "src/index.html";
104
104
  const basePath = process.cwd();
105
105
  const filesToServe = Object.create(null);
106
106
 
107
- startSpan({ name: 'Setup Server Assets', op: 'cli.setup.sidecar.assets' }, () => {
107
+ startSpan({ name: "Setup Server Assets", op: "cli.setup.sidecar.assets" }, () => {
108
108
  // Following the guide here: https://vite.dev/guide/backend-integration.html
109
109
  const manifest = JSON.parse(readAsset(MANIFEST_NAME));
110
110
  filesToServe[ENTRY_POINT_NAME] = readAsset(ENTRY_POINT_NAME);