Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ulidx

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ulidx - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0-1

dist/browser/index.cjs

39

package.json
{
"name": "ulidx",
"version": "1.0.0",
"version": "2.0.0-1",
"description": "ULID generator for NodeJS and the browser",

@@ -9,12 +9,26 @@ "type": "module",

"types": "./dist/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.cjs"
"node": {
"import": "./dist/node/index.js",
"require": "./dist/node/index.cjs"
},
"browser": {
"import": "./dist/browser/index.js",
"require": "./dist/browser/index.cjs"
}
}
},
"main": "dist/cjs/index.cjs",
"main": "dist/node/index.cjs",
"module": "./dist/node/index.js",
"browser": {
"./dist/node/index.cjs": "./dist/browser/index.cjs",
"./dist/node/index.js": "./dist/browser/index.js"
},
"types": "dist/index.d.ts",
"scripts": {
"bench": "npm run build && node test/benchmark.js",
"build": "run-s clean build:bundle build:types",
"build:bundle": "rollup -c",
"build": "run-s clean build:node:cjs build:node:esm build:browser:cjs build:browser:esm build:types",
"build:browser:cjs": "FMT=cjs ENV=browser rollup -c --name ulidx",
"build:browser:esm": "FMT=esm ENV=browser rollup -c --name ulidx",
"build:node:cjs": "FMT=cjs ENV=node rollup -c",
"build:node:esm": "FMT=esm ENV=node rollup -c",
"build:types": "tsc -p tsconfig.dec.json --emitDeclarationOnly",

@@ -26,5 +40,6 @@ "clean": "rimraf dist",

"test:format": "prettier --check \"{source,test}/**/*.{js,ts}\"",
"test:specs": "run-s test:specs:esm test:specs:cjs",
"test:specs:cjs": "c8 --src ./dist/cjs --check-coverage --lines 60 --functions 60 --branches 65 --statements 60 mocha -t 10000 'test/cjs/**/*.spec.cjs'",
"test:specs:esm": "c8 --src ./dist/esm --check-coverage --lines 60 --functions 60 --branches 65 --statements 60 mocha -t 10000 'test/esm/**/*.spec.js'"
"test:specs": "run-s test:node:esm test:node:cjs test:browser:cjs",
"test:browser:cjs": "mochify ./test/browser-cjs/*.spec.cjs",
"test:node:cjs": "c8 --src ./dist/node/index.cjs --check-coverage --lines 60 --functions 60 --branches 65 --statements 60 mocha -t 10000 'test/node-cjs/**/*.spec.cjs'",
"test:node:esm": "c8 --src ./dist/node/index.js --check-coverage --lines 60 --functions 60 --branches 65 --statements 60 mocha -t 10000 'test/node-esm/**/*.spec.js'"
},

@@ -65,4 +80,5 @@ "files": [

"devDependencies": {
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-commonjs": "^24.1.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-typescript": "^11.1.0",

@@ -76,2 +92,3 @@ "@types/node": "^18.16.3",

"mocha": "^10.2.0",
"mochify": "^9.2.0",
"npm-run-all": "^4.1.5",

@@ -86,4 +103,4 @@ "prettier": "^1.19.1",

"dependencies": {
"layerr": "^0.1.2"
"layerr": "^2.0.0"
}
}

@@ -108,4 +108,25 @@ # ulidx

### Web
### Browser
`ulidx` is not currently bundled for web - you can do this yourself using a tool like Webpack or Rollup. You should absolutely disable polyfills for `crypto` in this case, as `ulidx` will use the built-in `crypto` global API rather than any polyfilled crypto anyway. Including a polyfill for crypto will just bloat your application.
`ulidx` provides browser bundles in both ESM and CommonJS varieties. Importing should be automatic, but you can import them directly:
* `dist/browser/index.js` - Browser ESM build
* `dist/browser/index.cjs` - Browser CommonJS build
Unlike version 1.x, these browser builds cannot simply be injected into the browser. They must be included in a build system of some kind, like Rollup or Webpack.
Note that you can use the Node-based builds in the browser if you use such an aforementioned tool, but you will need to stub `node:crypto` to do so. Consider the following example in Webpack using a plugin:
```javascript
{
// ...
plugins: [
new NormalModuleReplacementPlugin(/node:/, (resource) => {
resource.request = resource.request.replace(/^node:/, "");
})
]
// ...
}
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc