This package, `supports-preserve-symlinks-flag`, is a focused, lightweight utility designed to programmatically determine whether the currently executing Node.js environment supports the `--preserve-symlinks` command-line flag. Currently at version 1.0.0, this package is highly stable and is likely in a maintenance-only mode, with new releases being infrequent unless Node.js introduces significant changes to its symlink resolution mechanisms or CLI flag behavior. Its core differentiation lies in its single-purpose simplicity, providing a direct boolean value (or `null` when executed in a browser environment) indicating support, without relying on any external dependencies. This functionality is crucial for developers needing to adapt application behavior or build processes based on the specific symlink resolution capabilities of the Node.js runtime, especially when deploying across diverse environments that might include older Node.js versions (specifically those prior to v6.2) where this flag was not available. It serves as a reliable check for ensuring compatibility and correct operation of file system-dependent logic.
npm install supports-preserve-symlinks-flagVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to import and use the package to determine `--preserve-symlinks` flag support, showing expected values for different environments.
Check for `null` explicitly: `if (supportsPreserveSymlinks === null) { /* browser-specific logic */ } else if (supportsPreserveSymlinks) { /* Node.js supported */ } else { /* Node.js not supported */ }`For ESM, consider dynamic import: `const { default: supportsPreserveSymlinks } = await import('node-supports-preserve-symlinks-flag');` or use a bundler that handles CJS interop.Use dynamic import: `const { default: supportsPreserveSymlinks } = await import('node-supports-preserve-symlinks-flag');` or convert your file to CommonJS (`.cjs` or remove `"type": "module"` from `package.json`).The package exports a direct boolean (or null) value, not a function. Use it as a variable: `if (supportsPreserveSymlinks) { ... }`.Use the default import syntax for CJS interop, typically `import supportsPreserveSymlinks from 'node-supports-preserve-symlinks-flag';` or dynamic import to access `default`.
No dependency data recorded yet.