Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
exports-test-wintercg
Advanced tools
Module exposing a number of different `exports` fields, for testing which one your bundler/environment ends up using
Just a silly package that implements a whole lot of different exports
entries in package.json
, along with non-standard but often used root-level fields such as module
, browser
etc.
All the exports expose a single named export: getUsedField()
, which returns a string representing which field was used.
This can be useful if you are authoring or consuming packages and want to understand how your environment (node/deno/bundler/cloud) resolves which file to use.
In addition, there is a second path you can import: exports-test/env
, which exposes a getEnvironmentDetails()
method. This returns an object of the following shape:
{
// Globals
process: true,
window: false,
global: true,
globalThis: true,
document: false,
// APIs/methods
require: true,
XMLHttpRequest: false,
EventSource: false,
WebSocket: false,
fetch: true,
setImmediate: true,
URL: true,
URLSearchParams: true,
ReadableStream: true,
WritableStream: true,
Headers: true,
subtleCrypto: true, // crypto.subtle
// Node.js (and similar)
processTitle: 'node', // `process.title`
processVersion: 'v18.0.0', // `process.version`
}
The keys represent the API/global we are checking for, and the value represents whether or not the API is available. It does not do any deep checks, however - this is merely a typeof
check - as long as it is not undefined
, it is treated as being present.
$ npm install exports-test
// ESM / TypeScript
import {getUsedField} from 'exports-test'
import {getEnvironmentDetails} from 'exports-test/env'
// CommonJS
const {getUsedField} = require('exports-test')
const {getEnvironmentDetails} = require('exports-test/env')
getUsedField() // 'exports.node'
getEnvironmentDetails() // {...}
MIT-licensed. See LICENSE.
FAQs
Module exposing a number of different `exports` fields, for testing which one your bundler/environment ends up using
We found that exports-test-wintercg demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.