Skip to content

Commit

Permalink
Update rollup-plugin-web-worker-loader to 1.1.1 (#443)
Browse files Browse the repository at this point in the history
* Upgraded rollup-plugin-web-worker-loader to 1.1.1

This fixes an issue with Blob during Gatsby/SSR build

* Removed 'check' and other TS config

This is no longer needed now that the rollup plugin is fixed.

* Formatting

* Fixed playground string interp issue for IE11
  • Loading branch information
Steve Hobbs authored Apr 29, 2020
1 parent 3bad02a commit 0fc02ad
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 49 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-typescript2": "^0.27.0",
"rollup-plugin-visualizer": "^4.0.3",
"rollup-plugin-web-worker-loader": "0.9.1",
"rollup-plugin-web-worker-loader": "^1.1.1",
"serve": "^11.3.0",
"ts-jest": "^24.3.0",
"tslint": "^6.1.1",
Expand Down
52 changes: 23 additions & 29 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,31 @@ const EXPORT_NAME = 'createAuth0Client';

const isProduction = process.env.NODE_ENV === 'production';
const shouldGenerateStats = process.env.WITH_STATS === 'true';
const getPlugins = (shouldMinify) => {
const getPlugins = shouldMinify => {
return [
webWorkerLoader({
sourceMap: !isProduction,
preserveSource: !isProduction,
pattern: /^[^\/].+\.worker\.ts$/,
pattern: /^[^\/].+\.worker\.ts$/
}),
resolve({
browser: true,
browser: true
}),
commonjs(),
typescript({
check: false,
clean: true,
useTsconfigDeclarationDir: true,
include: [
'src/**/*.ts',
'src/**/*.js',
'node_modules/rollup-plugin-web-worker-loader/**/*',
],
tsconfigOverride: {
noEmit: false,
sourceMap: true,
compilerOptions: {
lib: ['dom', 'es6'],
},
},
lib: ['dom', 'es6']
}
}
}),
replace({ 'process.env.NODE_ENV': `'${process.env.NODE_ENV}'` }),
shouldMinify && terser(),
sourcemaps(),
sourcemaps()
];
};
const footer = `('Auth0Client' in this) && this.console && this.console.warn && this.console.warn('Auth0Client already declared on the global namespace');
Expand All @@ -59,22 +53,22 @@ let bundles = [
file: 'dist/auth0-spa-js.development.js',
footer,
format: 'umd',
sourcemap: true,
sourcemap: true
},
plugins: [
...getPlugins(false),
!isProduction &&
serve({
contentBase: ['dist', 'static'],
open: true,
port: 3000,
port: 3000
}),
!isProduction && livereload(),
!isProduction && livereload()
],
watch: {
clearScreen: false,
},
},
clearScreen: false
}
}
];

if (isProduction) {
Expand All @@ -86,35 +80,35 @@ if (isProduction) {
name: EXPORT_NAME,
file: 'dist/auth0-spa-js.production.js',
footer,
format: 'umd',
},
format: 'umd'
}
],
plugins: [
...getPlugins(isProduction),
shouldGenerateStats && visualizer(),
],
shouldGenerateStats && visualizer()
]
},
{
input: 'src/index.ts',
output: [
{
file: pkg.module,
format: 'esm',
},
format: 'esm'
}
],
plugins: getPlugins(isProduction),
plugins: getPlugins(isProduction)
},
{
input: 'src/index.cjs.ts',
output: [
{
name: EXPORT_NAME,
file: pkg.main,
format: 'cjs',
},
format: 'cjs'
}
],
plugins: getPlugins(false),
external: Object.keys(pkg.dependencies),
external: Object.keys(pkg.dependencies)
}
);
}
Expand Down
32 changes: 16 additions & 16 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h3>Last error</h3>
<ul v-for="token in access_tokens">
<li data-cy="access-token">
{{token}} (<a
:href="`https://jwt.io?token=${token}`"
:href="'https://jwt.io?token=' + token"
target="_blank"
>view</a
>)
Expand All @@ -121,7 +121,7 @@ <h3>Last error</h3>
</div>
<div class="card-body">
{{ id_token }} (<a
:href="`https://jwt.io?token=${id_token}`"
:href="'https://jwt.io?token=' + id_token"
target="_blank"
>view</a
>)
Expand Down Expand Up @@ -262,7 +262,7 @@ <h3>Last error</h3>
domain: data.domain || defaultDomain,
clientId: data.clientId || defaultClientId,
audience: data.audience || defaultAudience,
error: null,
error: null
};
},
created: function () {
Expand All @@ -283,7 +283,7 @@ <h3>Last error</h3>
useConstructor: function () {
this.initializeClient();
this.saveForm();
},
}
},
methods: {
initializeClient: function () {
Expand All @@ -310,7 +310,7 @@ <h3>Last error</h3>
? 'localstorage'
: 'memory',
useRefreshTokens: _self.useRefreshTokens,
audience: _self.audience,
audience: _self.audience
})
);
} else {
Expand All @@ -323,7 +323,7 @@ <h3>Last error</h3>
? 'localstorage'
: 'memory',
useRefreshTokens: _self.useRefreshTokens,
audience: _self.audience,
audience: _self.audience
}).then(_init);
}
},
Expand All @@ -337,7 +337,7 @@ <h3>Last error</h3>
useRefreshTokens: this.useRefreshTokens,
useConstructor: this.useConstructor,
useCache: this.useCache,
audience: this.audience,
audience: this.audience
})
);
},
Expand Down Expand Up @@ -372,7 +372,7 @@ <h3>Last error</h3>

_self.auth0
.loginWithPopup({
redirect_uri: 'http://localhost:3000/callback.html',
redirect_uri: 'http://localhost:3000/callback.html'
})
.then(function () {
auth0.isAuthenticated().then(function (isAuthenticated) {
Expand All @@ -383,7 +383,7 @@ <h3>Last error</h3>
},
loginRedirect: function () {
this.auth0.loginWithRedirect({
redirect_uri: 'http://localhost:3000/',
redirect_uri: 'http://localhost:3000/'
});
},
loginHandleRedirectCallback: function () {
Expand Down Expand Up @@ -430,7 +430,7 @@ <h3>Last error</h3>

Promise.all([
_self.auth0.getTokenSilently({ ignoreCache: true }),
_self.auth0.getTokenSilently({ ignoreCache: true }),
_self.auth0.getTokenSilently({ ignoreCache: true })
]).then(function (tokens) {
_self.access_tokens = [tokens[0], tokens[1]];
});
Expand All @@ -441,7 +441,7 @@ <h3>Last error</h3>
_self.auth0
.getTokenWithPopup({
audience: 'https://brucke.auth0.com/api/v2/',
scope: 'read:rules',
scope: 'read:rules'
})
.then(function (token) {
_self.access_tokens = [token];
Expand All @@ -454,7 +454,7 @@ <h3>Last error</h3>
audience: 'https://brucke.auth0.com/api/v2/',
scope: 'read:rules',
redirect_uri: 'http://localhost:3000/callback.html',
ignoreCache: !_self.useCache,
ignoreCache: !_self.useCache
};

_self.auth0
Expand All @@ -465,16 +465,16 @@ <h3>Last error</h3>
},
logout: function () {
this.auth0.logout({
returnTo: 'http://localhost:3000/',
returnTo: 'http://localhost:3000/'
});
},
logoutNoClient: function () {
this.auth0.logout({
client_id: null,
returnTo: 'http://localhost:3000/',
returnTo: 'http://localhost:3000/'
});
},
},
}
}
});
</script>
</body>
Expand Down

0 comments on commit 0fc02ad

Please sign in to comment.