* introduce pako and add general packer interface

* add tests for packer

* use function API instead of class API for better tree shaking support

* refcatoring the rollup bundle config
This commit is contained in:
yz-yu
2026-04-01 12:00:00 +08:00
committed by GitHub
parent f1adef4693
commit dcad6ff922
23 changed files with 316 additions and 218 deletions

10
src/packer/pack.ts Normal file
View File

@@ -0,0 +1,10 @@
import { deflate } from 'pako/dist/pako_deflate';
import { PackFn, MARK, eventWithTimeAndPacker } from './base';
export const pack: PackFn = (event) => {
const _e: eventWithTimeAndPacker = {
...event,
v: MARK,
};
return deflate(JSON.stringify(_e), { to: 'string' });
};