Skip to content

Commit

Permalink
remove rollup plugin node globals and builtins
Browse files Browse the repository at this point in the history
add better maintained node polyfill library
add custom crypto polyfill
use user id instead of displayName in sharing dialogue e2e tests
  • Loading branch information
fschade committed Jan 20, 2022
1 parent 58e9be2 commit c1fa6d1
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 791 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@
"@cucumber/cucumber": "^7.3.1",
"@cucumber/messages": "^17.1.1",
"@cucumber/pretty-formatter": "^1.0.0-alpha.1",
"@erquhart/rollup-plugin-node-builtins": "^2.1.5",
"@noble/hashes": "^1.0.0",
"@playwright/test": "^1.17.2",
"@rollup/plugin-alias": "^3.1.9",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-html": "^0.2.0",
"@rollup/plugin-inject": "^4.0.4",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-typescript": "^8.2.5",
"@testing-library/dom": "^8.11.0",
Expand Down Expand Up @@ -107,8 +109,8 @@
"rollup-plugin-gzip": "^2.5.0",
"rollup-plugin-livereload": "^2.0.5",
"rollup-plugin-modify": "^3.0.0",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-polyfill-node": "^0.8.0",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-progress": "^1.1.2",
"rollup-plugin-serve": "^1.1.0",
Expand Down
6 changes: 6 additions & 0 deletions polyfills/crypto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { pbkdf2 } from '@noble/hashes/pbkdf2'
import { sha512 } from '@noble/hashes/sha512'

export const pbkdf2Sync = (password, salt, c, dkLen) => {
return Buffer.from(pbkdf2(sha512, password, salt, { c, dkLen }))
}
22 changes: 14 additions & 8 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import resolve from 'rollup-plugin-node-resolve'
import json from '@rollup/plugin-json'
import commonjs from '@rollup/plugin-commonjs'
import babel from 'rollup-plugin-babel'
import builtins from '@erquhart/rollup-plugin-node-builtins'
import copy from 'rollup-plugin-copy-watch'
import modify from 'rollup-plugin-modify'
import { terser } from 'rollup-plugin-terser'
Expand All @@ -18,8 +17,10 @@ import postcss from 'rollup-plugin-postcss'
import serve from 'rollup-plugin-serve'
import livereload from 'rollup-plugin-livereload'
import html from '@rollup/plugin-html'
import globals from 'rollup-plugin-node-globals'
import ts from 'rollup-plugin-ts'
import nodePolyfills from 'rollup-plugin-polyfill-node'
import alias from '@rollup/plugin-alias'
import inject from '@rollup/plugin-inject'

const production = !process.env.ROLLUP_WATCH
const sourcemap = process.env.SOURCE_MAP === 'true'
Expand All @@ -37,19 +38,25 @@ const plugins = [
sourceMap: sourcemap,
config: false
}),
alias({
entries: [{ find: 'crypto', replacement: 'polyfills/crypto.js' }]
}),
commonjs({
include: 'node_modules/**'
}),
vue({
css: false
}),
builtins({ crypto: true }),
nodePolyfills(),
inject({
Buffer: ['buffer', 'Buffer']
}),
resolve({
include: 'node_modules/**',
dedupe: ['@vue/composition-api'],
browser: true,
preferBuiltins: false
}),
commonjs({
include: 'node_modules/**'
}),
babel({
exclude: 'node_modules/**'
}),
Expand All @@ -64,7 +71,6 @@ const plugins = [
ts({
browserslist: false
}),
globals(),
json(),
copy({
watch: !production && ['./config', './packages/web-runtime/themes'],
Expand Down Expand Up @@ -219,4 +225,4 @@ export default {
},
preserveSymlinks: true,
plugins
}
}
2 changes: 1 addition & 1 deletion tests/e2e/support/page/files/allFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class AllFilesPage {
const shareInputLocator = page.locator('#files-share-invite-input')
await Promise.all([
page.waitForResponse((resp) => resp.url().includes('sharees') && resp.status() === 200),
shareInputLocator.fill(user.displayName)
shareInputLocator.fill(user.id)
])
await shareInputLocator.focus()
await page.waitForSelector('.vs--open')
Expand Down
Loading

0 comments on commit c1fa6d1

Please sign in to comment.