diff --git a/.gitignore b/.gitignore index 6704566..77e9a86 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,6 @@ dist # TernJS port file .tern-port + +# examples yarn.lock +examples/*/yarn.lock diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..1e107f5 --- /dev/null +++ b/.npmignore @@ -0,0 +1 @@ +examples diff --git a/index.ts b/index.ts deleted file mode 100644 index 8420b10..0000000 --- a/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './src'; diff --git a/package.json b/package.json index fd38e6b..d80fa6b 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,9 @@ { "name": "data-transport", - "version": "0.0.1", + "version": "0.0.2", "description": "A common transporter", "main": "lib/index.js", "unpkg": "dist/index.umd.js", - "module": "dist/index.esm.js", "types": "dist/index.d.ts", "scripts": { "test": "jest", diff --git a/rollup.config.js b/rollup.config.js index cb5b35c..a74fd89 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -17,15 +17,12 @@ export default isProduction file: 'dist/index.cjs.js', sourcemap: true, }, - { - format: 'es', - exports: 'named', - file: pkg.module, - sourcemap: true, - }, { format: 'umd', - name: 'DataTransport', + name: pkg.name + .split('-') + .map(([s, ...rest]) => [s.toUpperCase(), ...rest].join('')) + .join(''), file: pkg.unpkg, sourcemap: true, }, diff --git a/src/transport.ts b/src/transport.ts index 7c65005..6920e15 100644 --- a/src/transport.ts +++ b/src/transport.ts @@ -1,4 +1,4 @@ -import * as uuid from 'uuid'; +import { v4 } from 'uuid'; import { listenKey, originalRespondsMapKey, @@ -108,7 +108,7 @@ export abstract class Transport { ): Promise> { const hasRespond = options.respond ?? true; const timeout = options.timeout ?? this[timeoutKey]; - const transportId = uuid.v4(); + const transportId = v4(); if (!hasRespond) { return new Promise((resolve) => { this[sendKey]({