diff --git a/package.json b/package.json index 01c8309..03265d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bnc-notify", - "version": "1.2.4", + "version": "1.3.0", "description": "Show web3 users realtime transaction notifications", "keywords": [ "ethereum", @@ -9,8 +9,8 @@ "notifications" ], "main": "dist/notify.umd.js", - "module": "dist/notify.esm.js", - "typings": "dist/src/notify.d.ts", + "module": "dist/notify.js", + "typings": "dist/types/notify.d.ts", "files": [ "dist" ], @@ -25,24 +25,28 @@ "@babel/core": "^7.5.5", "@babel/preset-env": "^7.5.5", "@pyoner/svelte-ts-preprocess": "^1.2.1", + "@rollup/plugin-commonjs": "^12.0.0", "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "@tsconfig/svelte": "^1.0.4", "@types/lodash.debounce": "^4.0.6", "@types/uuid": "^3.4.5", "@typescript-eslint/eslint-plugin": "^2.30.0", "@typescript-eslint/parser": "^2.30.0", + "@wessberg/rollup-plugin-ts": "^1.2.34", "babel-plugin-external-helpers": "^6.18.0", "eslint": "^6.8.0", "eslint-config-prettier": "^6.11.0", "eslint-plugin-prettier": "^3.1.3", "prettier": "^2.0.5", - "rollup": "^1.12.0", - "rollup-plugin-commonjs": "^10.0.0", - "rollup-plugin-node-resolve": "^5.2.0", + "rollup": "^2.3.4", "rollup-plugin-svelte": "^5.0.3", - "rollup-plugin-typescript2": "0.21.0", "svelte": "^3.12.1", + "svelte-check": "^1.0.0", "svelte-i18n": "^1.1.2-beta", - "typescript": "^3.4.5" + "svelte-preprocess": "^4.0.0", + "tslib": "^2.0.0", + "typescript": "^3.9.3" }, "dependencies": { "bignumber.js": "^9.0.0", @@ -52,8 +56,9 @@ "uuid": "^3.3.3" }, "scripts": { - "build": "rollup -c && babel dist/notify.esm.js --out-file dist/notify.esm.js && babel dist/notify.umd.js --out-file dist/notify.umd.js --minified", + "build": "npm run validate && rollup -c && babel dist/notify.umd.js --out-file dist/notify.umd.js --minified", "test": "echo \"TBD\" && exit 0", - "prepare": "npm run build" + "prepare": "npm run build", + "validate": "svelte-check" } } diff --git a/rollup.config.js b/rollup.config.js index b0a2b2c..0b122aa 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,24 +1,9 @@ import svelte from 'rollup-plugin-svelte' -import resolve from 'rollup-plugin-node-resolve' +import resolve from '@rollup/plugin-node-resolve' +import commonjs from '@rollup/plugin-commonjs' +import sveltePreprocess from 'svelte-preprocess' +import typescript from '@wessberg/rollup-plugin-ts' import json from '@rollup/plugin-json' -import commonjs from 'rollup-plugin-commonjs' -import typescript from 'rollup-plugin-typescript2' - -import { - preprocess, - createEnv, - readConfigFile, -} from '@pyoner/svelte-ts-preprocess' - -const env = createEnv() -const compilerOptions = readConfigFile(env) -const opts = { - env, - compilerOptions: { - ...compilerOptions, - allowNonTsExtensions: true, - }, -} export default [ { @@ -27,6 +12,7 @@ export default [ format: 'umd', name: 'notify', file: 'dist/notify.umd.js', + sourcemap: 'inline' }, onwarn: (warning, warn) => { if (warning.code === 'THIS_IS_UNDEFINED') { @@ -38,23 +24,24 @@ export default [ plugins: [ json(), svelte({ - preprocess: preprocess(opts), + preprocess: sveltePreprocess() }), resolve({ browser: true, - dedupe: (importee) => - importee === 'svelte' || importee.startsWith('svelte/'), + dedupe: ['svelte'] }), commonjs(), - typescript(), - ], + typescript({ + tsconfig: resolvedConfig => ({ ...resolvedConfig, declaration: false }) + }) + ] }, { input: 'src/notify.ts', output: { - sourcemap: true, format: 'es', - file: 'dist/notify.esm.js', + file: 'dist/notify.js', + sourcemap: 'inline' }, onwarn: (warning, warn) => { if (warning.code === 'THIS_IS_UNDEFINED') { @@ -66,22 +53,21 @@ export default [ plugins: [ json(), svelte({ - preprocess: preprocess(opts), + preprocess: sveltePreprocess() }), resolve({ browser: true, - dedupe: (importee) => - importee === 'svelte' || importee.startsWith('svelte/'), + dedupe: ['svelte'] }), commonjs(), - typescript(), + typescript() ], external: [ 'bignumber.js', 'bnc-sdk', 'lodash.debounce', 'uuid/v4', - 'regenerator-runtime/runtime', - ], - }, + 'regenerator-runtime/runtime' + ] + } ] diff --git a/src/components/NotificationContent.svelte b/src/components/NotificationContent.svelte index 64d44bd..e50bc57 100644 --- a/src/components/NotificationContent.svelte +++ b/src/components/NotificationContent.svelte @@ -1,11 +1,33 @@