jwt-decode
Advanced tools
Comparing version 4.0.0-beta.2 to 4.0.0-beta.3
{ | ||
"name": "jwt-decode", | ||
"version": "4.0.0-beta.2", | ||
"version": "4.0.0-beta.3", | ||
"description": "Decode JWT tokens, mostly useful for browser applications.", | ||
"type": "module", | ||
"main": "build/cjs/jwt-decode.cjs", | ||
"module": "build/esm/jwt-decode.js", | ||
"types": "build/cjs/jwt-decode.d.cts", | ||
"main": "build/cjs/index.js", | ||
"module": "build/esm/index.js", | ||
"types": "build/cjs/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": { | ||
"default": "./build/esm/jwt-decode.js", | ||
"types": "./build/esm/jwt-decode.d.ts" | ||
"default": "./build/esm/index.js", | ||
"types": "./build/esm/index.d.ts" | ||
}, | ||
"require": { | ||
"default": "./build/cjs/jwt-decode.cjs", | ||
"types": "./build/cjs/jwt-decode.d.cts" | ||
"default": "./build/cjs/index.js", | ||
"types": "./build/cjs/index.d.ts" | ||
} | ||
@@ -32,7 +32,4 @@ } | ||
"scripts": { | ||
"dev": "rollup --sourcemap --config --configPlugin typescript", | ||
"build": "rimraf build && rollup --sourcemap --config --configPlugin typescript --environment NODE_ENV:production && npm run generate-types", | ||
"generate-types": "npm run generate-types:es && npm run generate-types:cjs", | ||
"generate-types:es": "tsup --entry.jwt-decode lib/index.ts --out-dir build/esm --dts-only --format esm", | ||
"generate-types:cjs": "tsup --entry.jwt-decode lib/index.ts --out-dir build/cjs --dts-only --format cjs", | ||
"prebuild": "rimraf build", | ||
"build": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json && echo '{\"type\": \"commonjs\"}'> build/cjs/package.json", | ||
"test": "npm run test:node && npm run test:browser", | ||
@@ -49,14 +46,8 @@ "test:node": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest --coverage", | ||
"devDependencies": { | ||
"@rollup/plugin-terser": "^0.4.3", | ||
"@rollup/plugin-typescript": "^11.1.2", | ||
"jest": "^29.6.1", | ||
"jest-environment-jsdom": "^29.6.1", | ||
"jest": "^29.6.2", | ||
"jest-environment-jsdom": "^29.6.2", | ||
"jest-junit": "^16.0.0", | ||
"rimraf": "^5.0.1", | ||
"rollup": "^3.26.3", | ||
"rollup-plugin-livereload": "^2.0.5", | ||
"rollup-plugin-serve": "^2.0.2", | ||
"ts-jest": "^29.1.1", | ||
"ts-node": "^10.9.1", | ||
"tsup": "^7.1.0", | ||
"typescript": "^5.1.6" | ||
@@ -63,0 +54,0 @@ }, |
@@ -95,22 +95,11 @@ ![Browser library that helps decoding JWT tokens which are Base64Url encoded](https://cdn.auth0.com/website/sdks/banners/jwt-decode-banner.png) | ||
Copy the file `jwt-decode.js` from the root of the `build/` folder to your project somewhere, then include it like so: | ||
Copy the file `jwt-decode.js` from the root of the `build/esm` folder to your project somewhere, then import `jwtDecode` from it inside a script tag that's marked with `type="module"`: | ||
```html | ||
<script src="jwt-decode.js"></script> | ||
``` | ||
<script type="module"> | ||
import { jwtDecode } from "/path/to/jwt-decode.js"; | ||
Once this script has loaded, the `jwt_decode` function will be exposed as a global: | ||
```javascript | ||
const token = "eyJhsw5c"; | ||
const decoded = jwt_decode(token); | ||
``` | ||
Alternatively, if you are using the [Asynchronous Module Definition (AMD) API](https://github.com/amdjs/amdjs-api/blob/master/AMD.md), you can load the same function as follows: | ||
```javascript | ||
define(["jwt_decode"], (jwtDecode) => { | ||
const token = "eyJhsw5c"; | ||
const decoded = jwtDecode(token); | ||
}); | ||
</script> | ||
``` | ||
@@ -117,0 +106,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7
165
13127
8
135
1