Skip to content

Commit 619a1c3

Browse files
committed
chore(deps): update vitest to 4.0.3 for consistency
Update vitest and @vitest/coverage-v8 from 3.2.4 to 4.0.3 to align with other Socket projects (socket-cli, socket-lib, socket-sdk-js, socket-registry). Also improves esbuild configuration to properly handle @socketsecurity/lib bundling when using local aliases. Part of project-wide dependency standardization effort.
1 parent c689415 commit 619a1c3

File tree

3 files changed

+102
-202
lines changed

3 files changed

+102
-202
lines changed

.config/esbuild.config.mjs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,16 @@ function createAliasPlugin() {
194194
return null
195195
}
196196

197+
// Packages that should always be bundled (even when using local aliases)
198+
const ALWAYS_BUNDLED = new Set(['@socketsecurity/lib'])
199+
197200
return {
198201
name: 'local-package-aliases',
199202
setup(build) {
200203
// Intercept imports for aliased packages (except @socketsecurity/lib which should be bundled)
201204
for (const [packageName, _aliasPath] of Object.entries(aliases)) {
202-
// Skip @socketsecurity/lib - it should be bundled, not externalized
203-
if (packageName === '@socketsecurity/lib') {
205+
// Skip packages that should always be bundled - let esbuild bundle them naturally
206+
if (ALWAYS_BUNDLED.has(packageName)) {
204207
continue
205208
}
206209

@@ -218,6 +221,19 @@ function createAliasPlugin() {
218221
}
219222
}
220223

224+
// Get local package aliases for bundled packages
225+
function getBundledPackageAliases() {
226+
const aliases = getLocalPackageAliases(rootPath)
227+
const bundledAliases = {}
228+
229+
// @socketsecurity/lib should always be bundled (not external)
230+
if (aliases['@socketsecurity/lib']) {
231+
bundledAliases['@socketsecurity/lib'] = aliases['@socketsecurity/lib']
232+
}
233+
234+
return bundledAliases
235+
}
236+
221237
// Build configuration for CommonJS output
222238
export const buildConfig = {
223239
entryPoints: [`${srcPath}/index.ts`],
@@ -238,6 +254,9 @@ export const buildConfig = {
238254
// Preserve module structure for better tree-shaking
239255
splitting: false,
240256

257+
// Alias local packages that should be bundled (not external)
258+
alias: getBundledPackageAliases(),
259+
241260
// Use plugins for local package aliases and path shortening
242261
plugins: [createPathShorteningPlugin(), createAliasPlugin()].filter(Boolean),
243262

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"@socketsecurity/registry": "1.5.3",
5757
"@types/node": "24.9.2",
5858
"@typescript/native-preview": "7.0.0-dev.20250926.1",
59-
"@vitest/coverage-v8": "3.2.4",
59+
"@vitest/coverage-v8": "4.0.3",
6060
"all-the-package-names": "2.0.0",
6161
"all-the-package-names-v1.3905.0": "npm:[email protected]",
6262
"del": "8.0.1",
@@ -79,7 +79,7 @@
7979
"typescript": "5.9.2",
8080
"typescript-eslint": "8.44.1",
8181
"validate-npm-package-name": "6.0.2",
82-
"vitest": "3.2.4",
82+
"vitest": "4.0.3",
8383
"yoctocolors-cjs": "2.1.3"
8484
},
8585
"engines": {

0 commit comments

Comments
 (0)