summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packages/browser/README.md69
-rw-r--r--packages/browser/package.json14
-rw-r--r--packages/browser/rollup.config.js17
3 files changed, 10 insertions, 90 deletions
diff --git a/packages/browser/README.md b/packages/browser/README.md
index 01234ac..d94700b 100644
--- a/packages/browser/README.md
+++ b/packages/browser/README.md
@@ -12,11 +12,6 @@
- [ES5](#es5)
- [ES2018](#es2018)
- [Usage](#usage)
- - [Building for Production](#building-for-production)
- - [ES5](#es5-1)
- - [ES2018](#es2018-1)
- - [Webpack support](#webpack-support)
- - [Rollup support](#rollup-support)
## Installation
@@ -38,7 +33,7 @@ If you need to support WebAuthn feature detection in deprecated browsers like IE
```html
-<script src="https://unpkg.com/@simplewebauthn/browser/dist/es5/index.umd.min.js"></script>
+<script src="https://unpkg.com/@simplewebauthn/browser/dist/bundle/index.es5.umd.min.js"></script>
```
#### ES2018
@@ -47,69 +42,9 @@ If you only need to support modern browsers, include the `ES2018` version:
```html
-<script src="https://unpkg.com/@simplewebauthn/browser/dist/es2018/index.umd.min.js"></script>
+<script src="https://unpkg.com/@simplewebauthn/browser"></script>
```
## Usage
You can find in-depth documentation on this package here: https://simplewebauthn.dev/docs/packages/browser
-
-## Building for Production
-
-Two unbundled versions of this library are offered for your convenience, one targeting `ES5` and a second targeting `ES2018`.
-
-### ES5
-
-The `ES5` version is suitable for use when **deprecated browsers** like IE10+ or Edge Legacy need to be supported. This version is also the **default** version that gets pulled in as the `"main"` entry in **package.json**.
-
-TypeScript and JavaScript codebases alike can import and use this library without any special build configuration considerations.
-
-However, you will need to ensure that the `tslib` dependency gets pulled into your build artifact:
-
-- If you are authoring your application in TypeScript then this package will be **automatically** included so long as your **tsconfig.json** sets `"target": "ES5"`.
-- If your application is written in Javascript then you will need to install this package **manually** by adding it to `dependencies` in your project's **package. json**:
-
-```sh
-$> npm install tslib
-```
-
-### ES2018
-
-The `ES2018` version is suitable for use when only **modern browsers** need to be supported. TypeScript and JavaScript codebases alike can import and use this library. However, you will need to ensure that your bundler pulls in the ES2018 version of the library when building your application!
-
-See bundler instructions below.
-
-#### Webpack support
-
-No matter the `"target"` of your build you'll need to indicate additional files for webpack to resolve via the [`"resolve.mainFields"`](https://webpack.js.org/configuration/resolve/#resolvemainfields) property in your config. Resolve the `"main:es2018"` field defined in **package.json**:
-
-```js
-module.exports = {
- //...
- resolve: {
- mainFields: [ 'main:es2018', 'module', 'main' ],
- },
-};
-```
-
-`'main:es2018'` must come first in the list to ensure that the `ES2018` version of this library is bundled. Additional values can be added afterwards as needed.
-
-#### Rollup support
-
-Add the [`@rollup/plugin-node-resolve`](https://github.com/rollup/rollup-plugin-node-resolve#usage) plugin to your Rollup config to read in the `"main:es2018"` field from **package.json**:
-
-```js
-// rollup.config.js
-import resolve from 'rollup-plugin-node-resolve';
-
-export default {
- // input: ...
- // output: ...
- plugins: [
- //...
- resolve({ mainFields: [ 'main:es2018', 'module', 'main' ] }),
- ]
-}
-```
-
-`'main:es2018'` must come first in the list to ensure that the `ES2018` version of this library is bundled. Additional values can be added afterwards as needed.
diff --git a/packages/browser/package.json b/packages/browser/package.json
index 0bde931..1601d62 100644
--- a/packages/browser/package.json
+++ b/packages/browser/package.json
@@ -2,8 +2,8 @@
"name": "@simplewebauthn/browser",
"version": "3.0.0",
"description": "SimpleWebAuthn for Browsers",
- "main": "dist/es5/index.js",
- "main:es2018": "dist/es2018/index.js",
+ "main": "dist/bundle/index.js",
+ "unpkg": "dist/bundle/index.umd.min.js",
"types": "dist/types/index.d.ts",
"author": "Matthew Miller <matthew@millerti.me>",
"license": "MIT",
@@ -29,17 +29,13 @@
"fido",
"umd"
],
- "peerDependencies": {
- "tslib": "^2.2.0"
- },
"devDependencies": {
- "@rollup/plugin-node-resolve": "^11.2.1",
+ "@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-typescript": "^8.2.1",
"@simplewebauthn/typescript-types": "file:../typescript-types",
- "rollup": "^2.44.0",
+ "rollup": "^2.52.1",
"rollup-plugin-terser": "^7.0.2",
- "rollup-plugin-version-injector": "^1.3.3",
- "tslib": "^2.2.0"
+ "rollup-plugin-version-injector": "^1.3.3"
},
"gitHead": "33ccf8c6c9add811c87d3089e24156c2342b3498"
}
diff --git a/packages/browser/rollup.config.js b/packages/browser/rollup.config.js
index 571660a..0c5ab8d 100644
--- a/packages/browser/rollup.config.js
+++ b/packages/browser/rollup.config.js
@@ -52,14 +52,14 @@ export default [
{
dir: 'dist',
format: 'esm',
- entryFileNames: 'es2018/[name].js',
+ entryFileNames: 'bundle/[name].js',
preferConst: true,
},
{
dir: 'dist',
format: 'umd',
name: 'SimpleWebAuthnBrowser',
- entryFileNames: 'es2018/[name].umd.min.js',
+ entryFileNames: 'bundle/[name].umd.min.js',
plugins: [terser()],
},
],
@@ -69,20 +69,9 @@ export default [
input: 'src/index.ts',
output: {
dir: 'dist',
- format: 'cjs',
- entryFileNames: 'es5/[name].js',
- exports: 'auto',
- },
- plugins: [typescript({ tsconfig: './tsconfig.es5.json' }), nodeResolve(), swanVersionInjector],
- external: ['tslib'],
- },
- {
- input: 'src/index.ts',
- output: {
- dir: 'dist',
format: 'umd',
name: 'SimpleWebAuthnBrowser',
- entryFileNames: 'es5/[name].umd.min.js',
+ entryFileNames: 'bundle/[name].es5.umd.min.js',
plugins: [terser(), cleanTslibCommentInUMDBundleTargetingES5()],
},
plugins: [typescript({ tsconfig: './tsconfig.es5.json' }), nodeResolve(), swanVersionInjector],