diff --git a/package.json b/package.json index 4bd12345..b2d3fa57 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ "keywords": [ "rrweb" ], - "main": "lib/rrweb-boost.js", - "module": "es/rrweb/src/boost.js", + "main": "lib/rrweb-all.js", + "module": "es/rrweb/entries/all.js", "unpkg": "dist/rrweb.js", "sideEffects": false, "typings": "typings/index.d.ts", diff --git a/rollup.config.js b/rollup.config.js index df982d69..d2b49958 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -11,20 +11,26 @@ function toRecordPath(path) { .replace('rrweb', 'rrweb-record'); } -function toPackPath(path) { +function toRecordPackPath(path) { return path - .replace(/^([\w]+)\//, '$1/packer/') - .replace('rrweb', 'rrweb-pack'); + .replace(/^([\w]+)\//, '$1/record/') + .replace('rrweb', 'rrweb-record-pack'); } -function toPackerPath(path) { +function toReplayPath(path) { return path - .replace(/^([\w]+)\//, '$1/packer/') - .replace('rrweb', 'rrweb-packer'); + .replace(/^([\w]+)\//, '$1/replay/') + .replace('rrweb', 'rrweb-replay'); } -function toBoostPath(path) { - return path.replace('rrweb', 'rrweb-boost'); +function toReplayUnpackPath(path) { + return path + .replace(/^([\w]+)\//, '$1/replay/') + .replace('rrweb', 'rrweb-replay-unpack'); +} + +function toAllPath(path) { + return path.replace('rrweb', 'rrweb-all'); } function toMinPath(path) { @@ -44,17 +50,23 @@ const baseConfigs = [ name: 'rrwebRecord', pathFn: toRecordPath, }, - // pack only + // record and pack { - input: './src/packer/pack.ts', - name: 'rrwebPack', - pathFn: toPackPath, + input: './src/entries/record-pack.ts', + name: 'rrwebRecord', + pathFn: toRecordPackPath, }, - // packer only + // replay only { - input: './src/packer/index.ts', - name: 'rrwebPacker', - pathFn: toPackerPath, + input: './src/replay/index.ts', + name: 'rrwebReplay', + pathFn: toReplayPath, + }, + // replay and unpack + { + input: './src/entries/replay-unpack.ts', + name: 'rrwebReplay', + pathFn: toReplayUnpackPath, }, // record and replay { @@ -64,9 +76,9 @@ const baseConfigs = [ }, // all in one { - input: './src/boost.ts', - name: 'rrwebBoost', - pathFn: toBoostPath, + input: './src/entries/all.ts', + name: 'rrweb', + pathFn: toAllPath, }, ]; @@ -119,7 +131,7 @@ for (const c of baseConfigs) { output: [ { format: 'cjs', - file: c.pathFn(pkg.main), + file: c.pathFn('lib/rrweb.js'), }, ], }); diff --git a/src/boost.ts b/src/boost.ts deleted file mode 100644 index 52bd640b..00000000 --- a/src/boost.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './index'; -export * from './packer'; diff --git a/src/entries/all.ts b/src/entries/all.ts new file mode 100644 index 00000000..e5080d39 --- /dev/null +++ b/src/entries/all.ts @@ -0,0 +1,2 @@ +export * from '../index'; +export * from '../packer'; diff --git a/src/entries/record-pack.ts b/src/entries/record-pack.ts new file mode 100644 index 00000000..c0ea472f --- /dev/null +++ b/src/entries/record-pack.ts @@ -0,0 +1,2 @@ +export * from '../record/index'; +export * from '../packer/pack'; diff --git a/src/entries/replay-unpack.ts b/src/entries/replay-unpack.ts new file mode 100644 index 00000000..5789d902 --- /dev/null +++ b/src/entries/replay-unpack.ts @@ -0,0 +1,2 @@ +export * from '../replay'; +export * from '../packer/unpack';