@betterbugs/packer 2.0.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +180 -0
  2. package/dist/base-B40z8PPs.cjs +686 -0
  3. package/dist/base-B40z8PPs.cjs.map +1 -0
  4. package/dist/base-B40z8PPs.umd.cjs +724 -0
  5. package/dist/base-B40z8PPs.umd.cjs.map +7 -0
  6. package/dist/base-B40z8PPs.umd.min.cjs +32 -0
  7. package/dist/base-B40z8PPs.umd.min.cjs.map +7 -0
  8. package/dist/base-BrE4jft0.js +687 -0
  9. package/dist/base-BrE4jft0.js.map +1 -0
  10. package/dist/pack.cjs +12 -0
  11. package/dist/pack.cjs.map +1 -0
  12. package/dist/pack.d.cts +5 -0
  13. package/dist/pack.d.ts +5 -0
  14. package/dist/pack.js +12 -0
  15. package/dist/pack.js.map +1 -0
  16. package/dist/pack.umd.cjs +60 -0
  17. package/dist/pack.umd.cjs.map +7 -0
  18. package/dist/pack.umd.min.cjs +32 -0
  19. package/dist/pack.umd.min.cjs.map +7 -0
  20. package/dist/packer.cjs +7 -0
  21. package/dist/packer.cjs.map +1 -0
  22. package/dist/packer.d.cts +8 -0
  23. package/dist/packer.d.ts +8 -0
  24. package/dist/packer.js +7 -0
  25. package/dist/packer.js.map +1 -0
  26. package/dist/packer.umd.cjs +37 -0
  27. package/dist/packer.umd.cjs.map +7 -0
  28. package/dist/packer.umd.min.cjs +32 -0
  29. package/dist/packer.umd.min.cjs.map +7 -0
  30. package/dist/unpack.cjs +31 -0
  31. package/dist/unpack.cjs.map +1 -0
  32. package/dist/unpack.d.cts +5 -0
  33. package/dist/unpack.d.ts +5 -0
  34. package/dist/unpack.js +31 -0
  35. package/dist/unpack.js.map +1 -0
  36. package/dist/unpack.umd.cjs +61 -0
  37. package/dist/unpack.umd.cjs.map +7 -0
  38. package/dist/unpack.umd.min.cjs +32 -0
  39. package/dist/unpack.umd.min.cjs.map +7 -0
  40. package/pack/package.json +4 -0
  41. package/package.json +87 -0
  42. package/unpack/package.json +4 -0
@@ -0,0 +1,61 @@
1
+ (function (g, f) {
2
+ if ("object" == typeof exports && "object" == typeof module) {
3
+ module.exports = f();
4
+ } else if ("function" == typeof define && define.amd) {
5
+ define("rrwebPacker", [], f);
6
+ } else if ("object" == typeof exports) {
7
+ exports["rrwebPacker"] = f();
8
+ } else {
9
+ g["rrwebPacker"] = f();
10
+ }
11
+ }(this, () => {
12
+ var exports = {};
13
+ var module = { exports };
14
+ "use strict";
15
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
16
+ const base = require("./base-B40z8PPs.cjs");
17
+ const unpack = (raw) => {
18
+ if (typeof raw !== "string") {
19
+ return raw;
20
+ }
21
+ try {
22
+ const e = JSON.parse(raw);
23
+ if (e.timestamp) {
24
+ return e;
25
+ }
26
+ } catch (error) {
27
+ }
28
+ try {
29
+ const e = JSON.parse(
30
+ base.strFromU8(base.unzlibSync(base.strToU8(raw, true)))
31
+ );
32
+ if (e.v === base.MARK) {
33
+ return e;
34
+ }
35
+ throw new Error(
36
+ `These events were packed with packer ${e.v} which is incompatible with current packer ${base.MARK}.`
37
+ );
38
+ } catch (error) {
39
+ console.error(error);
40
+ throw new Error("Unknown data format.");
41
+ }
42
+ };
43
+ exports.unpack = unpack;
44
+ if (typeof module.exports == "object" && typeof exports == "object") {
45
+ var __cp = (to, from, except, desc) => {
46
+ if ((from && typeof from === "object") || typeof from === "function") {
47
+ for (let key of Object.getOwnPropertyNames(from)) {
48
+ if (!Object.prototype.hasOwnProperty.call(to, key) && key !== except)
49
+ Object.defineProperty(to, key, {
50
+ get: () => from[key],
51
+ enumerable: !(desc = Object.getOwnPropertyDescriptor(from, key)) || desc.enumerable,
52
+ });
53
+ }
54
+ }
55
+ return to;
56
+ };
57
+ module.exports = __cp(module.exports, exports);
58
+ }
59
+ return module.exports;
60
+ }))
61
+ //# sourceMappingURL=unpack.umd.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/unpack.ts"],
4
+ "sourcesContent": ["import { strFromU8, strToU8, unzlibSync } from 'fflate';\nimport { type eventWithTimeAndPacker, MARK } from './base';\nimport type { UnpackFn, eventWithTime } from '@betterbugs/types';\n\nexport const unpack: UnpackFn = (raw: string) => {\n if (typeof raw !== 'string') {\n return raw;\n }\n try {\n const e: eventWithTime = JSON.parse(raw) as eventWithTime;\n if (e.timestamp) {\n return e;\n }\n } catch (error) {\n // ignore and continue\n }\n try {\n const e: eventWithTimeAndPacker = JSON.parse(\n strFromU8(unzlibSync(strToU8(raw, true))),\n ) as eventWithTimeAndPacker;\n if (e.v === MARK) {\n return e;\n }\n throw new Error(\n `These events were packed with packer ${e.v} which is incompatible with current packer ${MARK}.`,\n );\n } catch (error) {\n console.error(error);\n throw new Error('Unknown data format.');\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAIa,MAAA,SAAmB,CAAC,QAAgB;AAC3C,MAAA,OAAO,QAAQ,UAAU;AACpB,WAAA;EACT;AACI,MAAA;AACI,UAAA,IAAmB,KAAK,MAAM,GAAG;AACvC,QAAI,EAAE,WAAW;AACR,aAAA;IACT;EAAA,SACO,OAAO;EAEhB;AACI,MAAA;AACF,UAAM,IAA4B,KAAK;MACrCA,KAAAA,UAAUC,KAAAA,WAAWC,KAAAA,QAAQ,KAAK,IAAI,CAAC,CAAC;IAAA;AAEtC,QAAA,EAAE,MAAMC,KAAAA,MAAM;AACT,aAAA;IACT;AACA,UAAM,IAAI;MACR,wCAAwC,EAAE,CAAC,8CAA8CA,KAAAA,IAAI;IAAA;EAAA,SAExF,OAAO;AACd,YAAQ,MAAM,KAAK;AACb,UAAA,IAAI,MAAM,sBAAsB;EACxC;AACF;;",
6
+ "names": ["strFromU8", "unzlibSync", "strToU8", "MARK"]
7
+ }
@@ -0,0 +1,32 @@
1
+ (function (g, f) {
2
+ if ("object" == typeof exports && "object" == typeof module) {
3
+ module.exports = f();
4
+ } else if ("function" == typeof define && define.amd) {
5
+ define("rrwebPacker", [], f);
6
+ } else if ("object" == typeof exports) {
7
+ exports["rrwebPacker"] = f();
8
+ } else {
9
+ g["rrwebPacker"] = f();
10
+ }
11
+ }(this, () => {
12
+ var exports = {};
13
+ var module = { exports };
14
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./base-B40z8PPs.cjs"),n=t=>{if(typeof t!="string")return t;try{const r=JSON.parse(t);if(r.timestamp)return r}catch(r){}try{const r=JSON.parse(e.strFromU8(e.unzlibSync(e.strToU8(t,!0))));if(r.v===e.MARK)return r;throw new Error(`These events were packed with packer ${r.v} which is incompatible with current packer ${e.MARK}.`)}catch(r){throw console.error(r),new Error("Unknown data format.")}};exports.unpack=n;
15
+ if (typeof module.exports == "object" && typeof exports == "object") {
16
+ var __cp = (to, from, except, desc) => {
17
+ if ((from && typeof from === "object") || typeof from === "function") {
18
+ for (let key of Object.getOwnPropertyNames(from)) {
19
+ if (!Object.prototype.hasOwnProperty.call(to, key) && key !== except)
20
+ Object.defineProperty(to, key, {
21
+ get: () => from[key],
22
+ enumerable: !(desc = Object.getOwnPropertyDescriptor(from, key)) || desc.enumerable,
23
+ });
24
+ }
25
+ }
26
+ return to;
27
+ };
28
+ module.exports = __cp(module.exports, exports);
29
+ }
30
+ return module.exports;
31
+ }))
32
+ //# sourceMappingURL=unpack.umd.min.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/unpack.ts"],
4
+ "sourcesContent": ["import { strFromU8, strToU8, unzlibSync } from 'fflate';\nimport { type eventWithTimeAndPacker, MARK } from './base';\nimport type { UnpackFn, eventWithTime } from '@betterbugs/types';\n\nexport const unpack: UnpackFn = (raw: string) => {\n if (typeof raw !== 'string') {\n return raw;\n }\n try {\n const e: eventWithTime = JSON.parse(raw) as eventWithTime;\n if (e.timestamp) {\n return e;\n }\n } catch (error) {\n // ignore and continue\n }\n try {\n const e: eventWithTimeAndPacker = JSON.parse(\n strFromU8(unzlibSync(strToU8(raw, true))),\n ) as eventWithTimeAndPacker;\n if (e.v === MARK) {\n return e;\n }\n throw new Error(\n `These events were packed with packer ${e.v} which is incompatible with current packer ${MARK}.`,\n );\n } catch (error) {\n console.error(error);\n throw new Error('Unknown data format.');\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;uHAIaA,EAAoBC,GAAgB,CAC3C,GAAA,OAAOA,GAAQ,SACV,OAAAA,EAEL,GAAA,CACI,MAAAC,EAAmB,KAAK,MAAMD,CAAG,EACvC,GAAIC,EAAE,UACG,OAAAA,CACT,OACOC,EAAO,CAEhB,CACI,GAAA,CACF,MAAMD,EAA4B,KAAK,MACrCE,EAAAA,UAAUC,EAAAA,WAAWC,EAAAA,QAAQL,EAAK,EAAI,CAAC,CAAC,CAAA,EAEtC,GAAAC,EAAE,IAAMK,EAAAA,KACH,OAAAL,EAET,MAAM,IAAI,MACR,wCAAwCA,EAAE,CAAC,8CAA8CK,EAAAA,IAAI,GAAA,CAAA,OAExFJ,EAAO,CACd,cAAQ,MAAMA,CAAK,EACb,IAAI,MAAM,sBAAsB,CACxC,CACF",
6
+ "names": ["unpack", "raw", "e", "error", "strFromU8", "unzlibSync", "strToU8", "MARK"]
7
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "../dist/pack.cjs",
3
+ "types": "../dist/pack.d.ts"
4
+ }
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "@betterbugs/packer",
3
+ "version": "2.0.0-alpha.19",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "keywords": [
8
+ "rrweb",
9
+ "betterbugs",
10
+ "@betterbugs/packer"
11
+ ],
12
+ "scripts": {
13
+ "dev": "vite build --watch",
14
+ "build": "yarn turbo run prepublish",
15
+ "test": "vitest run",
16
+ "test:watch": "vitest watch",
17
+ "check-types": "tsc -noEmit",
18
+ "prepublish": "tsc -noEmit && vite build",
19
+ "lint": "yarn eslint src/**/*.ts"
20
+ },
21
+ "homepage": "https://github.com/BetterBugs-Team/rrweb/tree/main/packages/packer#readme",
22
+ "bugs": {
23
+ "url": "https://github.com/BetterBugs-Team/rrweb/issues"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/BetterBugs-Team/rrweb.git"
28
+ },
29
+ "license": "MIT",
30
+ "type": "module",
31
+ "main": "./dist/packer.cjs",
32
+ "module": "./dist/packer.js",
33
+ "unpkg": "./dist/packer.js",
34
+ "typings": "dist/packer.d.ts",
35
+ "exports": {
36
+ ".": {
37
+ "import": {
38
+ "types": "./dist/packer.d.ts",
39
+ "default": "./dist/packer.js"
40
+ },
41
+ "require": {
42
+ "types": "./dist/packer.d.cts",
43
+ "default": "./dist/packer.cjs"
44
+ }
45
+ },
46
+ "./pack": {
47
+ "import": {
48
+ "types": "./dist/pack.d.ts",
49
+ "default": "./dist/pack.js"
50
+ },
51
+ "require": {
52
+ "types": "./dist/pack.d.cts",
53
+ "default": "./dist/pack.cjs"
54
+ }
55
+ },
56
+ "./unpack": {
57
+ "import": {
58
+ "types": "./dist/unpack.d.ts",
59
+ "default": "./dist/unpack.js"
60
+ },
61
+ "require": {
62
+ "types": "./dist/unpack.d.cts",
63
+ "default": "./dist/unpack.cjs"
64
+ }
65
+ }
66
+ },
67
+ "files": [
68
+ "pack",
69
+ "unpack",
70
+ "build",
71
+ "dist",
72
+ "package.json"
73
+ ],
74
+ "devDependencies": {
75
+ "vite": "^5.3.1",
76
+ "vite-plugin-dts": "^3.9.1",
77
+ "vitest": "^1.4.0",
78
+ "typescript": "^5.4.5"
79
+ },
80
+ "dependencies": {
81
+ "fflate": "^0.4.4",
82
+ "@betterbugs/types": "^2.0.0-alpha.19"
83
+ },
84
+ "browserslist": [
85
+ "supports es6-class"
86
+ ]
87
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "../dist/unpack.cjs",
3
+ "types": "../dist/unpack.d.ts"
4
+ }