Skip to content

Commit fa30186

Browse files
committed
Remove unnecessary .default from require calls
The fix-commonjs-exports script transforms export default to module.exports, so .default accessors return undefined. Removed .default from WIN32 and spinner constant requires in bin.ts, path.ts, and debug.ts.
1 parent f499c4c commit fa30186

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

registry/src/lib/bin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export function findRealNpm(): string {
244244
* Find the real pnpm executable, bypassing any aliases and shadow bins.
245245
*/
246246
export function findRealPnpm(): string {
247-
const WIN32 = /*@__PURE__*/ require('./constants/WIN32.js').default
247+
const WIN32 = /*@__PURE__*/ require('./constants/WIN32.js')
248248
const path = getPath()
249249

250250
// Try common pnpm locations.
@@ -377,7 +377,7 @@ export function resolveBinPathSync(binPath: string): string {
377377
return voltaBinPath
378378
}
379379
}
380-
const WIN32 = /*@__PURE__*/ require('./constants/WIN32.js').default
380+
const WIN32 = /*@__PURE__*/ require('./constants/WIN32.js')
381381
if (WIN32) {
382382
const hasKnownExt =
383383
extLowered === '' ||

registry/src/lib/debug.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ function debugDirNs(namespacesOrOpts: any, obj: any, inspectOpts?: any) {
165165
const debugJs = getDebugJs()
166166
inspectOpts = debugJs.inspectOpts
167167
}
168-
const { spinner = /*@__PURE__*/ require('./constants/spinner.js').default } =
169-
options
168+
const { spinner = /*@__PURE__*/ require('./constants/spinner.js') } = options
170169
const wasSpinning = spinner.isSpinning
171170
spinner.stop()
172171
const { logger } = /*@__PURE__*/ require('./logger.js')
@@ -240,8 +239,7 @@ function debugFnNs(namespacesOrOpts: NamespacesOrOptions, ...args: any[]) {
240239
...args.slice(1),
241240
]
242241
: args
243-
const { spinner = /*@__PURE__*/ require('./constants/spinner.js').default } =
244-
options
242+
const { spinner = /*@__PURE__*/ require('./constants/spinner.js') } = options
245243
const wasSpinning = spinner.isSpinning
246244
spinner.stop()
247245
const { logger } = /*@__PURE__*/ require('./logger.js')
@@ -263,8 +261,7 @@ function debugLogNs(namespacesOrOpts: any, ...args: any[]) {
263261
if (!isEnabled(namespaces)) {
264262
return
265263
}
266-
const { spinner = /*@__PURE__*/ require('./constants/spinner.js').default } =
267-
options
264+
const { spinner = /*@__PURE__*/ require('./constants/spinner.js') } = options
268265
const wasSpinning = spinner.isSpinning
269266
spinner.stop()
270267
ReflectApply(customLog, undefined, args)

registry/src/lib/path.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ export function pathLikeToString(
384384
// On Windows, strip the leading slash only for malformed URLs that lack drive letters
385385
// (e.g., `/path` should be `path`, but `/C:/path` should be `C:/path`).
386386
// On Unix, keep the leading slash for absolute paths (e.g., `/home/user`).
387-
const WIN32 = /*@__PURE__*/ require('./constants/WIN32.js').default
387+
const WIN32 = /*@__PURE__*/ require('./constants/WIN32.js')
388388
if (WIN32 && pathname.startsWith('/')) {
389389
// Check for drive letter pattern following Node.js source: /[a-zA-Z]:/
390390
// Character at index 1 should be a letter, character at index 2 should be ':'

0 commit comments

Comments
 (0)