diff --git a/package.json b/package.json index d7f77e53..c57c82df 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ "keywords": [ "rrweb" ], - "main": "lib/rrweb.js", - "module": "es/rrweb/src/index.js", + "main": "lib/rrweb-boost.js", + "module": "es/rrweb/src/boost.js", "unpkg": "dist/rrweb.js", "sideEffects": false, "typings": "typings/index.d.ts", diff --git a/rollup.config.js b/rollup.config.js index ece5193a..f44b3bb9 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -17,6 +17,16 @@ function toPackPath(path) { .replace('rrweb', 'rrweb-pack'); } +function toPackerPath(path) { + return path + .replace(/^([\w]+)\//, '$1/packer/') + .replace('rrweb', 'rrweb-packer'); +} + +function toBoostPath(path) { + return path.replace('rrweb', 'rrweb-boost'); +} + function toMinPath(path) { return path.replace(/\.js$/, '.min.js'); } @@ -28,21 +38,36 @@ const namedExports = { }; const baseConfigs = [ + // record only { input: './src/record/index.ts', name: 'rrwebRecord', pathFn: toRecordPath, }, + // pack only { input: './src/packer/pack.ts', name: 'rrwebPack', pathFn: toPackPath, }, + // packer only + { + input: './src/packer/index.ts', + name: 'rrwebPacker', + pathFn: toPackerPath, + }, + // record and replay { input: './src/index.ts', name: 'rrweb', pathFn: (p) => p, }, + // all in one + { + input: './src/boost.ts', + name: 'rrwebBoost', + pathFn: toBoostPath, + }, ]; let configs = []; diff --git a/src/boost.ts b/src/boost.ts new file mode 100644 index 00000000..52bd640b --- /dev/null +++ b/src/boost.ts @@ -0,0 +1,2 @@ +export * from './index'; +export * from './packer'; diff --git a/src/index.ts b/src/index.ts index 4baa55b7..2aa2e0ad 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,7 +8,6 @@ export { MouseInteractions, ReplayerEvents, } from './types'; -export { pack, unpack } from './packer'; const { addCustomEvent } = record;