@spotlightjs/spotlight 2.6.3 → 2.8.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/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.6.3",
4
+ "version": "2.8.0",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "files": [
@@ -32,15 +32,17 @@
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
+ "@sentry/node": "^8.42.0",
35
36
  "import-meta-resolve": "^4.1.0",
36
37
  "macho-unsign": "^2.0.6",
37
38
  "portable-executable-signature": "^2.0.6",
38
39
  "postject": "1.0.0-alpha.6",
39
- "@spotlightjs/overlay": "2.7.1",
40
- "@spotlightjs/sidecar": "1.9.1"
40
+ "@spotlightjs/overlay": "2.8.1",
41
+ "@spotlightjs/sidecar": "1.9.3"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@types/node": "^18.19.55",
45
+ "esbuild": "^0.24.0",
44
46
  "typescript": "^5.6.2",
45
47
  "vite": "^5.4.11",
46
48
  "@spotlightjs/tsconfig": "1.0.1"
@@ -54,7 +56,7 @@
54
56
  "scripts": {
55
57
  "start": "./bin/run.js",
56
58
  "dev": "vite build --watch",
57
- "build": "vite build && vite build --config vite.overlay.config.ts && vite build --config vite.binary.config.ts && ./bin/build.js && tsc",
59
+ "build": "vite build && vite build --config vite.overlay.config.ts && ./build.js && tsc",
58
60
  "build:watch": "vite build --watch",
59
61
  "yalc:publish": "yalc publish --push --sig --private",
60
62
  "clean": "rimraf dist"
package/bin/build.js DELETED
@@ -1,144 +0,0 @@
1
- #!/usr/bin/env node
2
- import { execFile as execFileCb } from 'node:child_process';
3
- import { createWriteStream } from 'node:fs';
4
- import { copyFile, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
5
- import { tmpdir } from 'node:os';
6
- import { join } from 'node:path';
7
- import { Readable } from 'node:stream';
8
- import { finished } from 'node:stream/promises';
9
- import { promisify } from 'node:util';
10
-
11
- import { unsign } from 'macho-unsign';
12
- import { signatureSet } from 'portable-executable-signature';
13
- import { inject } from 'postject';
14
-
15
- const execFile = promisify(execFileCb);
16
-
17
- const DIST_DIR = './dist';
18
- const ASSETS_DIR = join(DIST_DIR, 'overlay');
19
- const MANIFEST_NAME = 'manifest.json';
20
- const MANIFEST_PATH = join(ASSETS_DIR, MANIFEST_NAME);
21
- const ENTRY_POINT_NAME = 'src/index.html';
22
- const SEA_CONFIG_PATH = join(DIST_DIR, 'sea-config.json');
23
- const SPOTLIGHT_BLOB_PATH = join(DIST_DIR, 'spotlight.blob');
24
- const NODE_VERSION = '22.11.0';
25
- const PLATFORMS = (process.env.BUILD_PLATFORMS || `${process.platform}-${process.arch}`).split(',').map(p => p.trim());
26
- const manifest = JSON.parse(await readFile(MANIFEST_PATH));
27
- const seaConfig = {
28
- main: join(DIST_DIR, 'spotlight.cjs'),
29
- output: SPOTLIGHT_BLOB_PATH,
30
- disableExperimentalSEAWarning: true,
31
- useSnapshot: false,
32
- useCodeCache: false, // We do cross-compiling so disable this
33
- assets: {
34
- [MANIFEST_NAME]: MANIFEST_PATH,
35
- [ENTRY_POINT_NAME]: join(ASSETS_DIR, ENTRY_POINT_NAME),
36
- ...Object.fromEntries(Object.values(manifest).map(entry => [entry.file, join(ASSETS_DIR, entry.file)])),
37
- },
38
- };
39
-
40
- async function run(cmd, ...args) {
41
- let output;
42
- try {
43
- output = await execFile(cmd, args, { encoding: 'utf8' });
44
- } catch (err) {
45
- console.error(`Failed to \`run ${cmd} ${args.join(' ')}\``);
46
- console.error(err.stdout);
47
- console.error(err.stderr);
48
- process.exit(err.code);
49
- }
50
- if (output.stdout.trim()) {
51
- console.log(output.stdout);
52
- } else {
53
- console.log(`> ${[cmd, ...args].join(' ')}`);
54
- }
55
- return output.stdout;
56
- }
57
-
58
- async function getNodeBinary(platform, targetPath = DIST_DIR) {
59
- const suffix = platform.startsWith('win') ? 'zip' : 'tar.xz';
60
- const remoteArchiveName = `node-v${NODE_VERSION}-${platform}.${suffix}`;
61
- const url = `https://nodejs.org/dist/v${NODE_VERSION}/${remoteArchiveName}`;
62
- const resp = await fetch(url);
63
- if (!resp.ok) throw new Error(`Failed to fetch ${url}`);
64
- const tmpDir = await mkdtemp(join(tmpdir(), remoteArchiveName));
65
- const stream = createWriteStream(join(tmpDir, remoteArchiveName));
66
- await finished(Readable.fromWeb(resp.body).pipe(stream));
67
- let sourceFile;
68
- let targetFile;
69
- if (platform.startsWith('win')) {
70
- await run('unzip', '-qq', stream.path, '-d', tmpDir);
71
- sourceFile = join(tmpDir, `node-v${NODE_VERSION}-${platform}`, 'node.exe');
72
- targetFile = join(targetPath, `spotlight-${platform}.exe`);
73
- const data = await readFile(sourceFile);
74
- const unsigned = signatureSet(data, null);
75
- await writeFile(targetFile, Buffer.from(unsigned));
76
- console.log('Signature removed from Win PE binary', targetFile);
77
- } else {
78
- await run('tar', '-xf', stream.path, '-C', tmpDir);
79
- sourceFile = join(tmpDir, `node-v${NODE_VERSION}-${platform}`, 'bin', 'node');
80
- targetFile = join(targetPath, `spotlight-${platform}`);
81
- }
82
-
83
- if (platform.startsWith('darwin')) {
84
- const unsigned = unsign(await readFile(sourceFile));
85
- await writeFile(targetFile, Buffer.from(unsigned));
86
- console.log('Signature removed from macOS binary', targetFile);
87
- } else {
88
- await copyFile(sourceFile, targetFile);
89
- }
90
-
91
- await rm(tmpDir, { recursive: true });
92
- return targetFile;
93
- }
94
-
95
- await writeFile(SEA_CONFIG_PATH, JSON.stringify(seaConfig));
96
- await run(process.execPath, '--experimental-sea-config', SEA_CONFIG_PATH);
97
- await Promise.all(
98
- PLATFORMS.map(async platform => {
99
- const nodeBinary = await getNodeBinary(platform);
100
- console.log('Injecting spotlight blob into node executable...');
101
- await inject(nodeBinary, 'NODE_SEA_BLOB', await readFile(SPOTLIGHT_BLOB_PATH), {
102
- sentinelFuse: 'NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2',
103
- machoSegmentName: platform.startsWith('darwin') ? 'NODE_SEA' : undefined,
104
- });
105
- console.log('Created executable', nodeBinary);
106
- await run('chmod', '+x', nodeBinary);
107
- if (platform.startsWith('darwin')) {
108
- const { APPLE_TEAM_ID, APPLE_CERT_PATH, APPLE_CERT_PASSWORD, APPLE_API_KEY_PATH } = process.env;
109
- if (!APPLE_TEAM_ID || !APPLE_CERT_PATH || !APPLE_CERT_PASSWORD) {
110
- console.warn(
111
- "Missing required environment variables for macOS signing, you won't be able to use this binary until you sign it yourself.",
112
- );
113
- console.info({ APPLE_TEAM_ID, APPLE_CERT_PATH, APPLE_CERT_PASSWORD });
114
- return;
115
- }
116
- console.log(`Signing ${nodeBinary}...`);
117
- await run(
118
- 'rcodesign',
119
- 'sign',
120
- '--team-name',
121
- APPLE_TEAM_ID,
122
- '--p12-file',
123
- APPLE_CERT_PATH,
124
- '--p12-password',
125
- APPLE_CERT_PASSWORD,
126
- '--for-notarization',
127
- '-e',
128
- join(import.meta.dirname, 'entitlements.plist'),
129
- nodeBinary,
130
- );
131
- if (!APPLE_API_KEY_PATH) {
132
- console.warn(
133
- "Missing required environment variable for macOS notarization, you won't be able to notarize this binary which will annoy people trying to run it.",
134
- );
135
- console.info({ APPLE_API_KEY_PATH });
136
- return;
137
- }
138
- const zipFile = `${nodeBinary}.zip`;
139
- await run('zip', zipFile, nodeBinary);
140
- await run('rcodesign', 'notary-submit', '--api-key-file', APPLE_API_KEY_PATH, '--wait', zipFile);
141
- await rm(zipFile);
142
- }
143
- }),
144
- );
@@ -1,19 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <!-- This file should be the same as https://github.com/nodejs/node/blob/main/tools/osx-entitlements.plist -->
4
- <plist version="1.0">
5
- <dict>
6
- <key>com.apple.security.cs.allow-jit</key>
7
- <true/>
8
- <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
9
- <true/>
10
- <key>com.apple.security.cs.disable-executable-page-protection</key>
11
- <true/>
12
- <key>com.apple.security.cs.allow-dyld-environment-variables</key>
13
- <true/>
14
- <key>com.apple.security.cs.disable-library-validation</key>
15
- <true/>
16
- <key>com.apple.security.get-task-allow</key>
17
- <true/>
18
- </dict>
19
- </plist>
@@ -1 +0,0 @@
1
- {"main":"dist/spotlight.cjs","output":"dist/spotlight.blob","disableExperimentalSEAWarning":true,"useSnapshot":false,"useCodeCache":false,"assets":{"manifest.json":"dist/overlay/manifest.json","src/index.html":"dist/overlay/src/index.html","assets/main.js":"dist/overlay/assets/main.js"}}
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file