@cnv-vn/track 0.3.0-beta.1 → 0.3.0-beta.2
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.
- package/README.md +16 -16
- package/dist/cnv-track.esm.js +2 -2
- package/dist/cnv-track.min.js +2 -2
- package/dist/cnv-track.umd.cjs +2 -2
- package/dist/types/index.d.ts +35 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# cnv-track.js
|
|
2
2
|
|
|
3
|
-
> Lightweight, async-first web analytics tracker —
|
|
3
|
+
> Lightweight, async-first web analytics tracker — **41,7 KB gzipped** (trần 50 KB).
|
|
4
4
|
|
|
5
5
|
`cnv-track.js` là Web JS SDK của hệ thống tracking CNV, có vai trò tương đương
|
|
6
6
|
Google Analytics / Facebook Pixel: nhúng một dòng `<script>` vào website
|
|
@@ -98,13 +98,13 @@ Schema mirror nguyên `com.cnv.tracking.dto.SegmentMessage` Java DTO
|
|
|
98
98
|
|
|
99
99
|
Đầu ra cho mỗi lần `npm run build`:
|
|
100
100
|
|
|
101
|
-
| File | Format | Mục đích
|
|
102
|
-
| ------------------------ | :----: |
|
|
103
|
-
| `dist/cnv-track.js` | IIFE | Debug build, có sourcemap
|
|
104
|
-
| `dist/cnv-track.min.js` | IIFE | **CDN target** —
|
|
105
|
-
| `dist/cnv-track.esm.js` | ESM | Cho Webpack / Vite / Rollup consumers
|
|
106
|
-
| `dist/cnv-track.umd.cjs` | UMD | Legacy CommonJS / AMD / RequireJS
|
|
107
|
-
| `dist/types/index.d.ts` | .d.ts | Bundled type declarations
|
|
101
|
+
| File | Format | Mục đích |
|
|
102
|
+
| ------------------------ | :----: | --------------------------------------- |
|
|
103
|
+
| `dist/cnv-track.js` | IIFE | Debug build, có sourcemap |
|
|
104
|
+
| `dist/cnv-track.min.js` | IIFE | **CDN target** — 41,7 KB gz, trần 50 KB |
|
|
105
|
+
| `dist/cnv-track.esm.js` | ESM | Cho Webpack / Vite / Rollup consumers |
|
|
106
|
+
| `dist/cnv-track.umd.cjs` | UMD | Legacy CommonJS / AMD / RequireJS |
|
|
107
|
+
| `dist/types/index.d.ts` | .d.ts | Bundled type declarations |
|
|
108
108
|
|
|
109
109
|
**Tại sao multi-format?** Người dùng cuối có ba loại:
|
|
110
110
|
(a) chèn `<script>` trực tiếp → IIFE,
|
|
@@ -121,7 +121,7 @@ npm run build:analyze # Sinh dist/stats.html (rollup-plugin-visualizer)
|
|
|
121
121
|
npm run type-check # tsc --noEmit
|
|
122
122
|
npm run lint # ESLint + typescript-eslint
|
|
123
123
|
npm run format # Prettier
|
|
124
|
-
npm run size # size-limit — fail nếu vượt
|
|
124
|
+
npm run size # size-limit — fail nếu vượt 50KB
|
|
125
125
|
npm run verify # type-check + lint + format:check + build + size
|
|
126
126
|
```
|
|
127
127
|
|
|
@@ -260,13 +260,13 @@ cap 100 event, evict batch cũ nhất khi đầy; mọi thao tác storage đều
|
|
|
260
260
|
|
|
261
261
|
## QA & Performance (Task 5)
|
|
262
262
|
|
|
263
|
-
| Hạng mục | Kết quả
|
|
264
|
-
| ------------------------ |
|
|
265
|
-
| Unit test (Sub-task 5.1) | **
|
|
266
|
-
| Crash-proof (5.2) | Silent-fail xuyên suốt + `silentFail.test.ts` (môi trường thù địch)
|
|
267
|
-
| Bundle (5.3) | IIFE **
|
|
268
|
-
| Async load (5.3) | Snippet `async`+`defer`+`insertBefore` → zero-blocking, CLS = 0
|
|
269
|
-
| Cross-browser (5.3) | Chrome / Edge / Firefox / Safari (ITP) — đủ chuỗi fallback
|
|
263
|
+
| Hạng mục | Kết quả |
|
|
264
|
+
| ------------------------ | ------------------------------------------------------------------- |
|
|
265
|
+
| Unit test (Sub-task 5.1) | **600 test / 21 file** (Vitest) |
|
|
266
|
+
| Crash-proof (5.2) | Silent-fail xuyên suốt + `silentFail.test.ts` (môi trường thù địch) |
|
|
267
|
+
| Bundle (5.3) | IIFE **41,7 KB gzipped** / 50 KB budget (`size-limit` CI gate) |
|
|
268
|
+
| Async load (5.3) | Snippet `async`+`defer`+`insertBefore` → zero-blocking, CLS = 0 |
|
|
269
|
+
| Cross-browser (5.3) | Chrome / Edge / Firefox / Safari (ITP) — đủ chuỗi fallback |
|
|
270
270
|
|
|
271
271
|
Mock trong test tuân thủ **contract thật** (cap 64KB beacon/keepalive được mô
|
|
272
272
|
hình đúng) nên green chứng minh hành vi thật. Audit còn phát hiện + sửa một lỗi
|