Skip to content

Commit 668d6ea

Browse files
committed
refactor(build): remove Socket dependencies from external array
Removed @socketsecurity/sdk, @socketsecurity/lib, @socketsecurity/packageurl-js, and @socketsecurity/registry from external array. With platform: 'node', esbuild automatically handles Node.js built-ins correctly without explicit externalization. Also added SDK mocking to repository-list-simplified test to prevent dynamic require errors in isolated test environments.
1 parent 43385e2 commit 668d6ea

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/cli/.config/esbuild.cli.build.mjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,6 @@ const config = {
191191
// (but doesn't hurt as extra safety).
192192
external: [
193193
'node-gyp', // Required for require.resolve('node-gyp/package.json')
194-
'@socketsecurity/registry', // Optional registry package (dev dependency only)
195-
'@socketsecurity/lib', // Referenced by socket-packageurl-js dist
196-
'@socketsecurity/packageurl-js', // Prevent re-bundling dist files
197-
'@socketsecurity/sdk', // Prevent re-bundling dist files
198194
],
199195

200196
// Suppress warnings for intentional CommonJS compatibility code.

packages/cli/src/commands/repository/cmd-repository-list-simplified.test.mts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
/** @fileoverview Tests for repository list command */
22

3-
import { describe, expect, it } from 'vitest'
3+
import { beforeEach, describe, expect, it, vi } from 'vitest'
4+
5+
beforeEach(() => {
6+
// Mock SDK to avoid dynamic require errors in isolated mode.
7+
vi.doMock('@socketsecurity/sdk', () => ({
8+
SocketSdk: class MockSocketSdk {},
9+
createUserAgentFromPkgJson: vi.fn(),
10+
}))
11+
})
412

513
describe('cmd-repository-list', () => {
614
it('should have a default export', async () => {

0 commit comments

Comments
 (0)