Skip to content

Commit 6c913d5

Browse files
committed
fix(debug): remove incorrect NO_SIDE_EFFECTS annotations
Debug functions (debug, debugDir, debugLog, and *Ns variants) have side effects (logging, spinner manipulation) and were incorrectly marked as pure functions, causing bundlers to tree-shake them into no-ops.
1 parent 76c2bc1 commit 6c913d5

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.3.6](https://github.com/SocketDev/socket-lib/releases/tag/v1.3.6) - 2025-10-26
9+
10+
### Fixed
11+
12+
- Fixed `debug` module functions being incorrectly tree-shaken as no-ops in bundled output
13+
- Removed incorrect `/*@__NO_SIDE_EFFECTS__*/` annotations from `debug()`, `debugDir()`, `debugLog()`, and their `*Ns` variants
14+
- These functions have side effects (logging output, spinner manipulation) and should not be removed by bundlers
15+
- Fixes issue where `debugLog()` and `debugDir()` were compiled to empty no-op functions
16+
817
## [1.3.5](https://github.com/SocketDev/socket-lib/releases/tag/v1.3.5) - 2025-10-26
918

1019
### Added

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@socketsecurity/lib",
3-
"version": "1.3.5",
3+
"version": "1.3.6",
44
"license": "MIT",
55
"description": "Core utilities and infrastructure for Socket.dev security tools",
66
"keywords": [

src/debug.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ function isEnabled(namespaces: string | undefined) {
197197
/**
198198
* Debug output for object inspection with caller info.
199199
*/
200-
/*@__NO_SIDE_EFFECTS__*/
201200
function debugDirNs(
202201
namespacesOrOpts: NamespacesOrOptions,
203202
obj: unknown,
@@ -245,7 +244,6 @@ let pointingTriangle: string | undefined
245244
/**
246245
* Debug output with caller info.
247246
*/
248-
/*@__NO_SIDE_EFFECTS__*/
249247
function debugNs(namespacesOrOpts: NamespacesOrOptions, ...args: unknown[]) {
250248
const options = extractOptions(namespacesOrOpts)
251249
const { namespaces } = options
@@ -281,7 +279,6 @@ function debugNs(namespacesOrOpts: NamespacesOrOptions, ...args: unknown[]) {
281279
/**
282280
* Debug logging function with caller info.
283281
*/
284-
/*@__NO_SIDE_EFFECTS__*/
285282
function debugLogNs(namespacesOrOpts: NamespacesOrOptions, ...args: unknown[]) {
286283
const options = extractOptions(namespacesOrOpts)
287284
const { namespaces } = options
@@ -323,7 +320,6 @@ function debugLogNs(namespacesOrOpts: NamespacesOrOptions, ...args: unknown[]) {
323320
* Second argument is the cache key or message.
324321
* Optional third argument is metadata object.
325322
*/
326-
/*@__NO_SIDE_EFFECTS__*/
327323
function debugCacheNs(
328324
namespacesOrOpts: NamespacesOrOptions,
329325
operation: string,
@@ -391,15 +387,13 @@ function isDebugNs(namespaces: string | undefined): boolean {
391387
/**
392388
* Debug output with caller info (wrapper for debugNs with default namespace).
393389
*/
394-
/*@__NO_SIDE_EFFECTS__*/
395390
function debug(...args: unknown[]): void {
396391
debugNs('*', ...args)
397392
}
398393

399394
/**
400395
* Debug output for object inspection (wrapper for debugDirNs with default namespace).
401396
*/
402-
/*@__NO_SIDE_EFFECTS__*/
403397
function debugDir(
404398
obj: unknown,
405399
inspectOpts?: InspectOptions | undefined,
@@ -410,7 +404,6 @@ function debugDir(
410404
/**
411405
* Debug logging function (wrapper for debugLogNs with default namespace).
412406
*/
413-
/*@__NO_SIDE_EFFECTS__*/
414407
function debugLog(...args: unknown[]): void {
415408
debugLogNs('*', ...args)
416409
}

0 commit comments

Comments
 (0)