@loggerjs/browser 0.5.0 → 0.5.1
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/dist/broadcast-channel-transport.cjs +115 -0
- package/dist/broadcast-channel-transport.cjs.map +1 -0
- package/dist/broadcast-channel-transport.js +114 -0
- package/dist/broadcast-channel-transport.js.map +1 -0
- package/dist/console-integration.cjs +98 -0
- package/dist/console-integration.cjs.map +1 -0
- package/dist/console-integration.js +97 -0
- package/dist/console-integration.js.map +1 -0
- package/dist/context-propagation-integration.cjs +78 -0
- package/dist/context-propagation-integration.cjs.map +1 -0
- package/dist/context-propagation-integration.js +77 -0
- package/dist/context-propagation-integration.js.map +1 -0
- package/dist/error-integration.cjs +128 -0
- package/dist/error-integration.cjs.map +1 -0
- package/dist/error-integration.js +127 -0
- package/dist/error-integration.js.map +1 -0
- package/dist/fetch-integration.cjs +120 -0
- package/dist/fetch-integration.cjs.map +1 -0
- package/dist/fetch-integration.js +119 -0
- package/dist/fetch-integration.js.map +1 -0
- package/dist/framework-error-integration.cjs +102 -0
- package/dist/framework-error-integration.cjs.map +1 -0
- package/dist/framework-error-integration.js +101 -0
- package/dist/framework-error-integration.js.map +1 -0
- package/dist/framework-router-integrations.cjs +88 -0
- package/dist/framework-router-integrations.cjs.map +1 -0
- package/dist/framework-router-integrations.js +84 -0
- package/dist/framework-router-integrations.js.map +1 -0
- package/dist/http-transport.cjs +301 -0
- package/dist/http-transport.cjs.map +1 -0
- package/dist/http-transport.js +299 -0
- package/dist/http-transport.js.map +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-offline-queue.cjs +105 -0
- package/dist/indexeddb-offline-queue.cjs.map +1 -0
- package/dist/indexeddb-offline-queue.js +104 -0
- package/dist/indexeddb-offline-queue.js.map +1 -0
- package/dist/indexeddb-transport.cjs +531 -0
- package/dist/indexeddb-transport.cjs.map +1 -0
- package/dist/indexeddb-transport.js +530 -0
- package/dist/indexeddb-transport.js.map +1 -0
- package/dist/offline-first-transport.cjs +675 -0
- package/dist/offline-first-transport.cjs.map +1 -0
- package/dist/offline-first-transport.js +674 -0
- package/dist/offline-first-transport.js.map +1 -0
- package/dist/page-lifecycle.cjs +39 -0
- package/dist/page-lifecycle.cjs.map +1 -0
- package/dist/page-lifecycle.js +38 -0
- package/dist/page-lifecycle.js.map +1 -0
- package/dist/payload-transforms.cjs +30 -0
- package/dist/payload-transforms.cjs.map +1 -0
- package/dist/payload-transforms.js +29 -0
- package/dist/payload-transforms.js.map +1 -0
- package/dist/performance-integration.cjs +135 -0
- package/dist/performance-integration.cjs.map +1 -0
- package/dist/performance-integration.js +133 -0
- package/dist/performance-integration.js.map +1 -0
- package/dist/reporting-integration.cjs +110 -0
- package/dist/reporting-integration.cjs.map +1 -0
- package/dist/reporting-integration.js +109 -0
- package/dist/reporting-integration.js.map +1 -0
- package/dist/router-integration.cjs +97 -0
- package/dist/router-integration.cjs.map +1 -0
- package/dist/router-integration.js +96 -0
- package/dist/router-integration.js.map +1 -0
- package/dist/runtime-host-integration.cjs +181 -0
- package/dist/runtime-host-integration.cjs.map +1 -0
- package/dist/runtime-host-integration.js +180 -0
- package/dist/runtime-host-integration.js.map +1 -0
- package/dist/service-worker-integration.cjs +109 -0
- package/dist/service-worker-integration.cjs.map +1 -0
- package/dist/service-worker-integration.js +108 -0
- package/dist/service-worker-integration.js.map +1 -0
- package/dist/service-worker-transport.cjs +184 -0
- package/dist/service-worker-transport.cjs.map +1 -0
- package/dist/service-worker-transport.js +183 -0
- package/dist/service-worker-transport.js.map +1 -0
- package/dist/user-action-integration.cjs +100 -0
- package/dist/user-action-integration.cjs.map +1 -0
- package/dist/user-action-integration.js +99 -0
- package/dist/user-action-integration.js.map +1 -0
- package/dist/web-vitals-integration.cjs +157 -0
- package/dist/web-vitals-integration.cjs.map +1 -0
- package/dist/web-vitals-integration.js +156 -0
- package/dist/web-vitals-integration.js.map +1 -0
- package/dist/websocket-integration.cjs +158 -0
- package/dist/websocket-integration.cjs.map +1 -0
- package/dist/websocket-integration.js +157 -0
- package/dist/websocket-integration.js.map +1 -0
- package/dist/websocket-transport.cjs +187 -0
- package/dist/websocket-transport.cjs.map +1 -0
- package/dist/websocket-transport.js +186 -0
- package/dist/websocket-transport.js.map +1 -0
- package/dist/xhr-integration.cjs +107 -0
- package/dist/xhr-integration.cjs.map +1 -0
- package/dist/xhr-integration.js +106 -0
- package/dist/xhr-integration.js.map +1 -0
- package/dist/zip-export.cjs +241 -0
- package/dist/zip-export.cjs.map +1 -0
- package/dist/zip-export.js +238 -0
- package/dist/zip-export.js.map +1 -0
- package/package.json +104 -77
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { safeJsonStringify } from "@loggerjs/core";
|
|
2
|
+
//#region src/zip-export.ts
|
|
3
|
+
const ZIP_UTF8_FLAG = 2048;
|
|
4
|
+
const ZIP_STORE_METHOD = 0;
|
|
5
|
+
const ZIP_VERSION = 20;
|
|
6
|
+
const ZIP_MAX_UINT16 = 65535;
|
|
7
|
+
const ZIP_MAX_UINT32 = 4294967295;
|
|
8
|
+
const LOCAL_FILE_HEADER_SIGNATURE = 67324752;
|
|
9
|
+
const CENTRAL_DIRECTORY_SIGNATURE = 33639248;
|
|
10
|
+
const END_OF_CENTRAL_DIRECTORY_SIGNATURE = 101010256;
|
|
11
|
+
let crc32Table;
|
|
12
|
+
function getCrc32Table() {
|
|
13
|
+
if (crc32Table) return crc32Table;
|
|
14
|
+
const table = new Uint32Array(256);
|
|
15
|
+
for (let index = 0; index < table.length; index += 1) {
|
|
16
|
+
let crc = index;
|
|
17
|
+
for (let bit = 0; bit < 8; bit += 1) crc = crc & 1 ? 3988292384 ^ crc >>> 1 : crc >>> 1;
|
|
18
|
+
table[index] = crc >>> 0;
|
|
19
|
+
}
|
|
20
|
+
crc32Table = table;
|
|
21
|
+
return table;
|
|
22
|
+
}
|
|
23
|
+
function crc32(bytes) {
|
|
24
|
+
const table = getCrc32Table();
|
|
25
|
+
let crc = 4294967295;
|
|
26
|
+
for (const byte of bytes) crc = crc >>> 8 ^ (table[(crc ^ byte) & 255] ?? 0);
|
|
27
|
+
return (crc ^ 4294967295) >>> 0;
|
|
28
|
+
}
|
|
29
|
+
function encodeText(value) {
|
|
30
|
+
return new TextEncoder().encode(value);
|
|
31
|
+
}
|
|
32
|
+
function normalizeFileContent(content) {
|
|
33
|
+
if (typeof content === "string") return encodeText(content);
|
|
34
|
+
if (content instanceof Uint8Array) return content;
|
|
35
|
+
return new Uint8Array(content);
|
|
36
|
+
}
|
|
37
|
+
function normalizeZipFileName(name) {
|
|
38
|
+
const normalized = name.replace(/\\/g, "/").split("/").filter((part) => part.length > 0 && part !== "." && part !== "..").join("/");
|
|
39
|
+
if (!normalized) throw new Error("ZIP file name cannot be empty");
|
|
40
|
+
return normalized;
|
|
41
|
+
}
|
|
42
|
+
function toDosDateTime(timestamp) {
|
|
43
|
+
const date = new Date(Number.isFinite(timestamp) ? timestamp : Date.now());
|
|
44
|
+
const year = Math.min(2107, Math.max(1980, date.getFullYear()));
|
|
45
|
+
return {
|
|
46
|
+
time: date.getHours() << 11 | date.getMinutes() << 5 | Math.floor(date.getSeconds() / 2),
|
|
47
|
+
date: year - 1980 << 9 | date.getMonth() + 1 << 5 | date.getDate()
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function assertZipUint16(value, label) {
|
|
51
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > ZIP_MAX_UINT16) throw new Error(`${label} exceeds ZIP32 limit`);
|
|
52
|
+
}
|
|
53
|
+
function assertZipUint32(value, label) {
|
|
54
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > ZIP_MAX_UINT32) throw new Error(`${label} exceeds ZIP32 limit`);
|
|
55
|
+
}
|
|
56
|
+
function createLocalFileHeader(file) {
|
|
57
|
+
const header = new Uint8Array(30);
|
|
58
|
+
const view = new DataView(header.buffer);
|
|
59
|
+
view.setUint32(0, LOCAL_FILE_HEADER_SIGNATURE, true);
|
|
60
|
+
view.setUint16(4, ZIP_VERSION, true);
|
|
61
|
+
view.setUint16(6, ZIP_UTF8_FLAG, true);
|
|
62
|
+
view.setUint16(8, ZIP_STORE_METHOD, true);
|
|
63
|
+
view.setUint16(10, file.modifiedTime, true);
|
|
64
|
+
view.setUint16(12, file.modifiedDate, true);
|
|
65
|
+
view.setUint32(14, file.crc32, true);
|
|
66
|
+
view.setUint32(18, file.contentBytes.byteLength, true);
|
|
67
|
+
view.setUint32(22, file.contentBytes.byteLength, true);
|
|
68
|
+
view.setUint16(26, file.nameBytes.byteLength, true);
|
|
69
|
+
view.setUint16(28, 0, true);
|
|
70
|
+
return header;
|
|
71
|
+
}
|
|
72
|
+
function createCentralDirectoryHeader(file) {
|
|
73
|
+
const header = new Uint8Array(46);
|
|
74
|
+
const view = new DataView(header.buffer);
|
|
75
|
+
view.setUint32(0, CENTRAL_DIRECTORY_SIGNATURE, true);
|
|
76
|
+
view.setUint16(4, ZIP_VERSION, true);
|
|
77
|
+
view.setUint16(6, ZIP_VERSION, true);
|
|
78
|
+
view.setUint16(8, ZIP_UTF8_FLAG, true);
|
|
79
|
+
view.setUint16(10, ZIP_STORE_METHOD, true);
|
|
80
|
+
view.setUint16(12, file.modifiedTime, true);
|
|
81
|
+
view.setUint16(14, file.modifiedDate, true);
|
|
82
|
+
view.setUint32(16, file.crc32, true);
|
|
83
|
+
view.setUint32(20, file.contentBytes.byteLength, true);
|
|
84
|
+
view.setUint32(24, file.contentBytes.byteLength, true);
|
|
85
|
+
view.setUint16(28, file.nameBytes.byteLength, true);
|
|
86
|
+
view.setUint16(30, 0, true);
|
|
87
|
+
view.setUint16(32, 0, true);
|
|
88
|
+
view.setUint16(34, 0, true);
|
|
89
|
+
view.setUint16(36, 0, true);
|
|
90
|
+
view.setUint32(38, 0, true);
|
|
91
|
+
view.setUint32(42, file.localHeaderOffset, true);
|
|
92
|
+
return header;
|
|
93
|
+
}
|
|
94
|
+
function createEndOfCentralDirectory(fileCount, centralDirectorySize, centralDirectoryOffset) {
|
|
95
|
+
assertZipUint16(fileCount, "ZIP file count");
|
|
96
|
+
assertZipUint32(centralDirectorySize, "ZIP central directory size");
|
|
97
|
+
assertZipUint32(centralDirectoryOffset, "ZIP central directory offset");
|
|
98
|
+
const footer = new Uint8Array(22);
|
|
99
|
+
const view = new DataView(footer.buffer);
|
|
100
|
+
view.setUint32(0, END_OF_CENTRAL_DIRECTORY_SIGNATURE, true);
|
|
101
|
+
view.setUint16(4, 0, true);
|
|
102
|
+
view.setUint16(6, 0, true);
|
|
103
|
+
view.setUint16(8, fileCount, true);
|
|
104
|
+
view.setUint16(10, fileCount, true);
|
|
105
|
+
view.setUint32(12, centralDirectorySize, true);
|
|
106
|
+
view.setUint32(16, centralDirectoryOffset, true);
|
|
107
|
+
view.setUint16(20, 0, true);
|
|
108
|
+
return footer;
|
|
109
|
+
}
|
|
110
|
+
function createNormalizedZipFiles(files, options) {
|
|
111
|
+
const names = /* @__PURE__ */ new Set();
|
|
112
|
+
let offset = 0;
|
|
113
|
+
return files.map((file) => {
|
|
114
|
+
const name = normalizeZipFileName(file.name);
|
|
115
|
+
if (names.has(name)) throw new Error(`Duplicate ZIP file name: ${name}`);
|
|
116
|
+
names.add(name);
|
|
117
|
+
const nameBytes = encodeText(name);
|
|
118
|
+
const contentBytes = normalizeFileContent(file.content);
|
|
119
|
+
assertZipUint16(nameBytes.byteLength, `ZIP file name ${name}`);
|
|
120
|
+
assertZipUint32(contentBytes.byteLength, `ZIP file ${name}`);
|
|
121
|
+
assertZipUint32(offset, "ZIP local header offset");
|
|
122
|
+
const modified = toDosDateTime(file.lastModified ?? options.lastModified ?? Date.now());
|
|
123
|
+
const normalized = {
|
|
124
|
+
name,
|
|
125
|
+
nameBytes,
|
|
126
|
+
contentBytes,
|
|
127
|
+
crc32: crc32(contentBytes),
|
|
128
|
+
modifiedTime: modified.time,
|
|
129
|
+
modifiedDate: modified.date,
|
|
130
|
+
localHeaderOffset: offset
|
|
131
|
+
};
|
|
132
|
+
offset += 30 + nameBytes.byteLength + contentBytes.byteLength;
|
|
133
|
+
assertZipUint32(offset, "ZIP local data size");
|
|
134
|
+
return normalized;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function isQuerySource(source) {
|
|
138
|
+
return "query" in source && typeof source.query === "function";
|
|
139
|
+
}
|
|
140
|
+
function resolveSource(source, query) {
|
|
141
|
+
if (isQuerySource(source)) return source.query(query);
|
|
142
|
+
if (query) throw new Error("Log ZIP export query options require a source with query()");
|
|
143
|
+
return source;
|
|
144
|
+
}
|
|
145
|
+
function normalizeMaxEvents(value) {
|
|
146
|
+
if (value === void 0) return void 0;
|
|
147
|
+
if (!Number.isFinite(value)) return void 0;
|
|
148
|
+
return Math.max(0, Math.floor(value));
|
|
149
|
+
}
|
|
150
|
+
function createLogZipBlob(files, options = {}) {
|
|
151
|
+
const normalizedFiles = createNormalizedZipFiles(files, options);
|
|
152
|
+
const parts = [];
|
|
153
|
+
let centralDirectoryOffset = 0;
|
|
154
|
+
for (const file of normalizedFiles) {
|
|
155
|
+
parts.push(createLocalFileHeader(file), file.nameBytes, file.contentBytes);
|
|
156
|
+
centralDirectoryOffset += 30 + file.nameBytes.byteLength + file.contentBytes.byteLength;
|
|
157
|
+
}
|
|
158
|
+
let centralDirectorySize = 0;
|
|
159
|
+
for (const file of normalizedFiles) {
|
|
160
|
+
const header = createCentralDirectoryHeader(file);
|
|
161
|
+
parts.push(header, file.nameBytes);
|
|
162
|
+
centralDirectorySize += header.byteLength + file.nameBytes.byteLength;
|
|
163
|
+
}
|
|
164
|
+
parts.push(createEndOfCentralDirectory(normalizedFiles.length, centralDirectorySize, centralDirectoryOffset));
|
|
165
|
+
return new Blob(parts, { type: options.type ?? "application/zip" });
|
|
166
|
+
}
|
|
167
|
+
async function exportLogsToZip(source, options = {}) {
|
|
168
|
+
const format = options.format ?? "ndjson";
|
|
169
|
+
const createdAt = options.createdAt ?? Date.now();
|
|
170
|
+
const logFileName = options.logFileName ?? (format === "json" ? "logs.json" : "logs.ndjson");
|
|
171
|
+
const maxEvents = normalizeMaxEvents(options.maxEvents);
|
|
172
|
+
const serialize = options.serializeEvent ?? ((event) => safeJsonStringify(event, options.stringify ?? {}));
|
|
173
|
+
const lines = [];
|
|
174
|
+
let skippedCount = 0;
|
|
175
|
+
let from;
|
|
176
|
+
let to;
|
|
177
|
+
for await (const event of resolveSource(source, options.query)) {
|
|
178
|
+
if (maxEvents !== void 0 && lines.length >= maxEvents) break;
|
|
179
|
+
const mapped = options.mapEvent ? options.mapEvent(event) : event;
|
|
180
|
+
if (!mapped) {
|
|
181
|
+
skippedCount += 1;
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
lines.push(serialize(mapped));
|
|
185
|
+
from = from === void 0 ? mapped.time : Math.min(from, mapped.time);
|
|
186
|
+
to = to === void 0 ? mapped.time : Math.max(to, mapped.time);
|
|
187
|
+
}
|
|
188
|
+
const files = [{
|
|
189
|
+
name: logFileName,
|
|
190
|
+
content: format === "json" ? `[${lines.join(",")}]` : lines.length > 0 ? `${lines.join("\n")}\n` : "",
|
|
191
|
+
lastModified: createdAt
|
|
192
|
+
}];
|
|
193
|
+
if (options.includeManifest ?? true) {
|
|
194
|
+
const manifest = {
|
|
195
|
+
schema: "loggerjs.log-export.v1",
|
|
196
|
+
createdAt: new Date(createdAt).toISOString(),
|
|
197
|
+
source: options.source,
|
|
198
|
+
format,
|
|
199
|
+
logFileName: normalizeZipFileName(logFileName),
|
|
200
|
+
logCount: lines.length,
|
|
201
|
+
skippedCount,
|
|
202
|
+
query: options.query,
|
|
203
|
+
timeRange: from === void 0 || to === void 0 ? void 0 : {
|
|
204
|
+
from,
|
|
205
|
+
to
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
files.push({
|
|
209
|
+
name: options.manifestFileName ?? "manifest.json",
|
|
210
|
+
content: `${safeJsonStringify(manifest, { space: 2 })}\n`,
|
|
211
|
+
lastModified: createdAt
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return createLogZipBlob(files, { lastModified: createdAt });
|
|
215
|
+
}
|
|
216
|
+
function downloadBlob(blob, filenameOrOptions = {}) {
|
|
217
|
+
const options = typeof filenameOrOptions === "string" ? { filename: filenameOrOptions } : filenameOrOptions;
|
|
218
|
+
const documentRef = options.document ?? globalThis.document;
|
|
219
|
+
const urlRef = options.url ?? globalThis.URL;
|
|
220
|
+
if (!documentRef?.body || !urlRef?.createObjectURL || !urlRef.revokeObjectURL) throw new Error("downloadBlob requires document and URL.createObjectURL");
|
|
221
|
+
const href = urlRef.createObjectURL(blob);
|
|
222
|
+
const anchor = documentRef.createElement("a");
|
|
223
|
+
anchor.href = href;
|
|
224
|
+
anchor.download = options.filename ?? "loggerjs-logs.zip";
|
|
225
|
+
anchor.style.display = "none";
|
|
226
|
+
documentRef.body.appendChild(anchor);
|
|
227
|
+
anchor.click();
|
|
228
|
+
anchor.remove();
|
|
229
|
+
const revoke = () => urlRef.revokeObjectURL(href);
|
|
230
|
+
const revokeDelayMs = options.revokeDelayMs ?? 1e3;
|
|
231
|
+
if (revokeDelayMs <= 0) revoke();
|
|
232
|
+
else setTimeout(revoke, revokeDelayMs);
|
|
233
|
+
return href;
|
|
234
|
+
}
|
|
235
|
+
//#endregion
|
|
236
|
+
export { createLogZipBlob, downloadBlob, exportLogsToZip };
|
|
237
|
+
|
|
238
|
+
//# sourceMappingURL=zip-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip-export.js","names":[],"sources":["../src/zip-export.ts"],"sourcesContent":["import { safeJsonStringify, type LogEvent, type SafeStringifyOptions } from \"@loggerjs/core\";\nimport type { IndexedDbTransportQueryOptions } from \"./indexeddb-transport\";\n\nexport type LogZipExportFormat = \"ndjson\" | \"json\";\n\nexport interface ZipExportFile {\n name: string;\n content: string | Uint8Array | ArrayBuffer;\n lastModified?: number;\n}\n\nexport interface LogZipBlobOptions {\n lastModified?: number;\n type?: string;\n}\n\nexport interface LogZipExportQuerySource {\n query: (options?: IndexedDbTransportQueryOptions) => AsyncIterable<LogEvent>;\n}\n\nexport type LogZipExportSource = AsyncIterable<LogEvent> | LogZipExportQuerySource;\n\nexport interface LogZipExportManifest {\n schema: \"loggerjs.log-export.v1\";\n createdAt: string;\n source?: string;\n format: LogZipExportFormat;\n logFileName: string;\n logCount: number;\n skippedCount: number;\n query?: IndexedDbTransportQueryOptions;\n timeRange?: {\n from: number;\n to: number;\n };\n}\n\nexport interface LogZipExportOptions {\n query?: IndexedDbTransportQueryOptions;\n format?: LogZipExportFormat;\n logFileName?: string;\n includeManifest?: boolean;\n manifestFileName?: string;\n source?: string;\n createdAt?: number;\n maxEvents?: number;\n stringify?: SafeStringifyOptions;\n serializeEvent?: (event: LogEvent) => string;\n mapEvent?: (event: LogEvent) => LogEvent | false | null | undefined;\n}\n\nexport interface DownloadBlobOptions {\n filename?: string;\n document?: Document;\n url?: Pick<typeof URL, \"createObjectURL\" | \"revokeObjectURL\">;\n revokeDelayMs?: number;\n}\n\ninterface NormalizedZipFile {\n name: string;\n nameBytes: Uint8Array;\n contentBytes: Uint8Array;\n crc32: number;\n modifiedTime: number;\n modifiedDate: number;\n localHeaderOffset: number;\n}\n\nconst ZIP_UTF8_FLAG = 0x0800;\nconst ZIP_STORE_METHOD = 0;\nconst ZIP_VERSION = 20;\nconst ZIP_MAX_UINT16 = 0xffff;\nconst ZIP_MAX_UINT32 = 0xffffffff;\nconst LOCAL_FILE_HEADER_SIGNATURE = 0x04034b50;\nconst CENTRAL_DIRECTORY_SIGNATURE = 0x02014b50;\nconst END_OF_CENTRAL_DIRECTORY_SIGNATURE = 0x06054b50;\n\nlet crc32Table: Uint32Array | undefined;\n\nfunction getCrc32Table(): Uint32Array {\n if (crc32Table) return crc32Table;\n const table = new Uint32Array(256);\n for (let index = 0; index < table.length; index += 1) {\n let crc = index;\n for (let bit = 0; bit < 8; bit += 1) {\n crc = crc & 1 ? 0xedb88320 ^ (crc >>> 1) : crc >>> 1;\n }\n table[index] = crc >>> 0;\n }\n crc32Table = table;\n return table;\n}\n\nfunction crc32(bytes: Uint8Array): number {\n const table = getCrc32Table();\n let crc = 0xffffffff;\n for (const byte of bytes) {\n crc = (crc >>> 8) ^ (table[(crc ^ byte) & 0xff] ?? 0);\n }\n return (crc ^ 0xffffffff) >>> 0;\n}\n\nfunction encodeText(value: string): Uint8Array {\n return new TextEncoder().encode(value);\n}\n\nfunction normalizeFileContent(content: ZipExportFile[\"content\"]): Uint8Array {\n if (typeof content === \"string\") return encodeText(content);\n if (content instanceof Uint8Array) return content;\n return new Uint8Array(content);\n}\n\nfunction normalizeZipFileName(name: string): string {\n const normalized = name\n .replace(/\\\\/g, \"/\")\n .split(\"/\")\n .filter((part) => part.length > 0 && part !== \".\" && part !== \"..\")\n .join(\"/\");\n if (!normalized) throw new Error(\"ZIP file name cannot be empty\");\n return normalized;\n}\n\nfunction toDosDateTime(timestamp: number): { time: number; date: number } {\n const date = new Date(Number.isFinite(timestamp) ? timestamp : Date.now());\n const year = Math.min(2107, Math.max(1980, date.getFullYear()));\n return {\n time: (date.getHours() << 11) | (date.getMinutes() << 5) | Math.floor(date.getSeconds() / 2),\n date: ((year - 1980) << 9) | ((date.getMonth() + 1) << 5) | date.getDate(),\n };\n}\n\nfunction assertZipUint16(value: number, label: string) {\n if (!Number.isSafeInteger(value) || value < 0 || value > ZIP_MAX_UINT16) {\n throw new Error(`${label} exceeds ZIP32 limit`);\n }\n}\n\nfunction assertZipUint32(value: number, label: string) {\n if (!Number.isSafeInteger(value) || value < 0 || value > ZIP_MAX_UINT32) {\n throw new Error(`${label} exceeds ZIP32 limit`);\n }\n}\n\nfunction createLocalFileHeader(file: NormalizedZipFile): Uint8Array {\n const header = new Uint8Array(30);\n const view = new DataView(header.buffer);\n view.setUint32(0, LOCAL_FILE_HEADER_SIGNATURE, true);\n view.setUint16(4, ZIP_VERSION, true);\n view.setUint16(6, ZIP_UTF8_FLAG, true);\n view.setUint16(8, ZIP_STORE_METHOD, true);\n view.setUint16(10, file.modifiedTime, true);\n view.setUint16(12, file.modifiedDate, true);\n view.setUint32(14, file.crc32, true);\n view.setUint32(18, file.contentBytes.byteLength, true);\n view.setUint32(22, file.contentBytes.byteLength, true);\n view.setUint16(26, file.nameBytes.byteLength, true);\n view.setUint16(28, 0, true);\n return header;\n}\n\nfunction createCentralDirectoryHeader(file: NormalizedZipFile): Uint8Array {\n const header = new Uint8Array(46);\n const view = new DataView(header.buffer);\n view.setUint32(0, CENTRAL_DIRECTORY_SIGNATURE, true);\n view.setUint16(4, ZIP_VERSION, true);\n view.setUint16(6, ZIP_VERSION, true);\n view.setUint16(8, ZIP_UTF8_FLAG, true);\n view.setUint16(10, ZIP_STORE_METHOD, true);\n view.setUint16(12, file.modifiedTime, true);\n view.setUint16(14, file.modifiedDate, true);\n view.setUint32(16, file.crc32, true);\n view.setUint32(20, file.contentBytes.byteLength, true);\n view.setUint32(24, file.contentBytes.byteLength, true);\n view.setUint16(28, file.nameBytes.byteLength, true);\n view.setUint16(30, 0, true);\n view.setUint16(32, 0, true);\n view.setUint16(34, 0, true);\n view.setUint16(36, 0, true);\n view.setUint32(38, 0, true);\n view.setUint32(42, file.localHeaderOffset, true);\n return header;\n}\n\nfunction createEndOfCentralDirectory(\n fileCount: number,\n centralDirectorySize: number,\n centralDirectoryOffset: number,\n): Uint8Array {\n assertZipUint16(fileCount, \"ZIP file count\");\n assertZipUint32(centralDirectorySize, \"ZIP central directory size\");\n assertZipUint32(centralDirectoryOffset, \"ZIP central directory offset\");\n\n const footer = new Uint8Array(22);\n const view = new DataView(footer.buffer);\n view.setUint32(0, END_OF_CENTRAL_DIRECTORY_SIGNATURE, true);\n view.setUint16(4, 0, true);\n view.setUint16(6, 0, true);\n view.setUint16(8, fileCount, true);\n view.setUint16(10, fileCount, true);\n view.setUint32(12, centralDirectorySize, true);\n view.setUint32(16, centralDirectoryOffset, true);\n view.setUint16(20, 0, true);\n return footer;\n}\n\nfunction createNormalizedZipFiles(\n files: readonly ZipExportFile[],\n options: LogZipBlobOptions,\n): NormalizedZipFile[] {\n const names = new Set<string>();\n let offset = 0;\n return files.map((file) => {\n const name = normalizeZipFileName(file.name);\n if (names.has(name)) throw new Error(`Duplicate ZIP file name: ${name}`);\n names.add(name);\n\n const nameBytes = encodeText(name);\n const contentBytes = normalizeFileContent(file.content);\n assertZipUint16(nameBytes.byteLength, `ZIP file name ${name}`);\n assertZipUint32(contentBytes.byteLength, `ZIP file ${name}`);\n assertZipUint32(offset, \"ZIP local header offset\");\n\n const modified = toDosDateTime(file.lastModified ?? options.lastModified ?? Date.now());\n const normalized: NormalizedZipFile = {\n name,\n nameBytes,\n contentBytes,\n crc32: crc32(contentBytes),\n modifiedTime: modified.time,\n modifiedDate: modified.date,\n localHeaderOffset: offset,\n };\n offset += 30 + nameBytes.byteLength + contentBytes.byteLength;\n assertZipUint32(offset, \"ZIP local data size\");\n return normalized;\n });\n}\n\nfunction isQuerySource(source: LogZipExportSource): source is LogZipExportQuerySource {\n return \"query\" in source && typeof source.query === \"function\";\n}\n\nfunction resolveSource(\n source: LogZipExportSource,\n query: IndexedDbTransportQueryOptions | undefined,\n): AsyncIterable<LogEvent> {\n if (isQuerySource(source)) return source.query(query);\n if (query) throw new Error(\"Log ZIP export query options require a source with query()\");\n return source;\n}\n\nfunction normalizeMaxEvents(value: number | undefined): number | undefined {\n if (value === undefined) return undefined;\n if (!Number.isFinite(value)) return undefined;\n return Math.max(0, Math.floor(value));\n}\n\nexport function createLogZipBlob(\n files: readonly ZipExportFile[],\n options: LogZipBlobOptions = {},\n): Blob {\n const normalizedFiles = createNormalizedZipFiles(files, options);\n const parts: Uint8Array[] = [];\n let centralDirectoryOffset = 0;\n for (const file of normalizedFiles) {\n parts.push(createLocalFileHeader(file), file.nameBytes, file.contentBytes);\n centralDirectoryOffset += 30 + file.nameBytes.byteLength + file.contentBytes.byteLength;\n }\n\n let centralDirectorySize = 0;\n for (const file of normalizedFiles) {\n const header = createCentralDirectoryHeader(file);\n parts.push(header, file.nameBytes);\n centralDirectorySize += header.byteLength + file.nameBytes.byteLength;\n }\n parts.push(\n createEndOfCentralDirectory(\n normalizedFiles.length,\n centralDirectorySize,\n centralDirectoryOffset,\n ),\n );\n\n return new Blob(parts as unknown as BlobPart[], { type: options.type ?? \"application/zip\" });\n}\n\nexport async function exportLogsToZip(\n source: LogZipExportSource,\n options: LogZipExportOptions = {},\n): Promise<Blob> {\n const format = options.format ?? \"ndjson\";\n const createdAt = options.createdAt ?? Date.now();\n const logFileName = options.logFileName ?? (format === \"json\" ? \"logs.json\" : \"logs.ndjson\");\n const maxEvents = normalizeMaxEvents(options.maxEvents);\n const serialize =\n options.serializeEvent ??\n ((event: LogEvent) => safeJsonStringify(event, options.stringify ?? {}));\n const lines: string[] = [];\n let skippedCount = 0;\n let from: number | undefined;\n let to: number | undefined;\n\n for await (const event of resolveSource(source, options.query)) {\n if (maxEvents !== undefined && lines.length >= maxEvents) break;\n const mapped = options.mapEvent ? options.mapEvent(event) : event;\n if (!mapped) {\n skippedCount += 1;\n continue;\n }\n lines.push(serialize(mapped));\n from = from === undefined ? mapped.time : Math.min(from, mapped.time);\n to = to === undefined ? mapped.time : Math.max(to, mapped.time);\n }\n\n const logContent =\n format === \"json\" ? `[${lines.join(\",\")}]` : lines.length > 0 ? `${lines.join(\"\\n\")}\\n` : \"\";\n\n const files: ZipExportFile[] = [\n {\n name: logFileName,\n content: logContent,\n lastModified: createdAt,\n },\n ];\n\n if (options.includeManifest ?? true) {\n const manifest: LogZipExportManifest = {\n schema: \"loggerjs.log-export.v1\",\n createdAt: new Date(createdAt).toISOString(),\n source: options.source,\n format,\n logFileName: normalizeZipFileName(logFileName),\n logCount: lines.length,\n skippedCount,\n query: options.query,\n timeRange: from === undefined || to === undefined ? undefined : { from, to },\n };\n files.push({\n name: options.manifestFileName ?? \"manifest.json\",\n content: `${safeJsonStringify(manifest, { space: 2 })}\\n`,\n lastModified: createdAt,\n });\n }\n\n return createLogZipBlob(files, { lastModified: createdAt });\n}\n\nexport function downloadBlob(\n blob: Blob,\n filenameOrOptions: string | DownloadBlobOptions = {},\n): string {\n const options =\n typeof filenameOrOptions === \"string\" ? { filename: filenameOrOptions } : filenameOrOptions;\n const documentRef = options.document ?? globalThis.document;\n const urlRef = options.url ?? globalThis.URL;\n if (!documentRef?.body || !urlRef?.createObjectURL || !urlRef.revokeObjectURL) {\n throw new Error(\"downloadBlob requires document and URL.createObjectURL\");\n }\n\n const href = urlRef.createObjectURL(blob);\n const anchor = documentRef.createElement(\"a\");\n anchor.href = href;\n anchor.download = options.filename ?? \"loggerjs-logs.zip\";\n anchor.style.display = \"none\";\n documentRef.body.appendChild(anchor);\n anchor.click();\n anchor.remove();\n\n const revoke = () => urlRef.revokeObjectURL(href);\n const revokeDelayMs = options.revokeDelayMs ?? 1000;\n if (revokeDelayMs <= 0) {\n revoke();\n } else {\n setTimeout(revoke, revokeDelayMs);\n }\n\n return href;\n}\n"],"mappings":";;AAoEA,MAAM,gBAAgB;AACtB,MAAM,mBAAmB;AACzB,MAAM,cAAc;AACpB,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AACvB,MAAM,8BAA8B;AACpC,MAAM,8BAA8B;AACpC,MAAM,qCAAqC;AAE3C,IAAI;AAEJ,SAAS,gBAA6B;CACpC,IAAI,YAAY,OAAO;CACvB,MAAM,QAAQ,IAAI,YAAY,GAAG;CACjC,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;EACpD,IAAI,MAAM;EACV,KAAK,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO,GAChC,MAAM,MAAM,IAAI,aAAc,QAAQ,IAAK,QAAQ;EAErD,MAAM,SAAS,QAAQ;CACzB;CACA,aAAa;CACb,OAAO;AACT;AAEA,SAAS,MAAM,OAA2B;CACxC,MAAM,QAAQ,cAAc;CAC5B,IAAI,MAAM;CACV,KAAK,MAAM,QAAQ,OACjB,MAAO,QAAQ,KAAM,OAAO,MAA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EAChB,CAAC;CACH;CAEA,OAAO,iBAAiB,OAAO,EAAE,cAAc,UAAU,CAAC;AAC5D;AAEA,SAAgB,aACd,MACA,oBAAkD,CAAC,GAC3C;CACR,MAAM,UACJ,OAAO,sBAAsB,WAAW,EAAE,UAAU,kBAAkB,IAAI;CAC5E,MAAM,cAAc,QAAQ,YAAY,WAAW;CACnD,MAAM,SAAS,QAAQ,OAAO,WAAW;CACzC,IAAI,CAAC,aAAa,QAAQ,CAAC,QAAQ,mBAAmB,CAAC,OAAO,iBAC5D,MAAM,IAAI,MAAM,wDAAwD;CAG1E,MAAM,OAAO,OAAO,gBAAgB,IAAI;CACxC,MAAM,SAAS,YAAY,cAAc,GAAG;CAC5C,OAAO,OAAO;CACd,OAAO,WAAW,QAAQ,YAAY;CACtC,OAAO,MAAM,UAAU;CACvB,YAAY,KAAK,YAAY,MAAM;CACnC,OAAO,MAAM;CACb,OAAO,OAAO;CAEd,MAAM,eAAe,OAAO,gBAAgB,IAAI;CAChD,MAAM,gBAAgB,QAAQ,iBAAiB;CAC/C,IAAI,iBAAiB,GACnB,OAAO;MAEP,WAAW,QAAQ,aAAa;CAGlC,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loggerjs/browser",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Browser transports and integrations for loggerjs.",
|
|
5
5
|
"homepage": "https://github.com/jskits/loggerjs/tree/main/packages/browser#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -29,129 +29,129 @@
|
|
|
29
29
|
"require": "./dist/index.cjs"
|
|
30
30
|
},
|
|
31
31
|
"./transport-http": {
|
|
32
|
-
"types": "./dist/
|
|
33
|
-
"import": "./dist/
|
|
34
|
-
"require": "./dist/
|
|
32
|
+
"types": "./dist/http-transport.d.ts",
|
|
33
|
+
"import": "./dist/http-transport.js",
|
|
34
|
+
"require": "./dist/http-transport.cjs"
|
|
35
35
|
},
|
|
36
36
|
"./payload-transforms": {
|
|
37
|
-
"types": "./dist/
|
|
38
|
-
"import": "./dist/
|
|
39
|
-
"require": "./dist/
|
|
37
|
+
"types": "./dist/payload-transforms.d.ts",
|
|
38
|
+
"import": "./dist/payload-transforms.js",
|
|
39
|
+
"require": "./dist/payload-transforms.cjs"
|
|
40
40
|
},
|
|
41
41
|
"./transport-broadcast-channel": {
|
|
42
|
-
"types": "./dist/
|
|
43
|
-
"import": "./dist/
|
|
44
|
-
"require": "./dist/
|
|
42
|
+
"types": "./dist/broadcast-channel-transport.d.ts",
|
|
43
|
+
"import": "./dist/broadcast-channel-transport.js",
|
|
44
|
+
"require": "./dist/broadcast-channel-transport.cjs"
|
|
45
45
|
},
|
|
46
46
|
"./transport-service-worker": {
|
|
47
|
-
"types": "./dist/
|
|
48
|
-
"import": "./dist/
|
|
49
|
-
"require": "./dist/
|
|
47
|
+
"types": "./dist/service-worker-transport.d.ts",
|
|
48
|
+
"import": "./dist/service-worker-transport.js",
|
|
49
|
+
"require": "./dist/service-worker-transport.cjs"
|
|
50
50
|
},
|
|
51
51
|
"./transport-websocket": {
|
|
52
|
-
"types": "./dist/
|
|
53
|
-
"import": "./dist/
|
|
54
|
-
"require": "./dist/
|
|
52
|
+
"types": "./dist/websocket-transport.d.ts",
|
|
53
|
+
"import": "./dist/websocket-transport.js",
|
|
54
|
+
"require": "./dist/websocket-transport.cjs"
|
|
55
55
|
},
|
|
56
56
|
"./offline-indexeddb": {
|
|
57
|
-
"types": "./dist/
|
|
58
|
-
"import": "./dist/
|
|
59
|
-
"require": "./dist/
|
|
57
|
+
"types": "./dist/indexeddb-offline-queue.d.ts",
|
|
58
|
+
"import": "./dist/indexeddb-offline-queue.js",
|
|
59
|
+
"require": "./dist/indexeddb-offline-queue.cjs"
|
|
60
60
|
},
|
|
61
61
|
"./transport-indexeddb": {
|
|
62
|
-
"types": "./dist/
|
|
63
|
-
"import": "./dist/
|
|
64
|
-
"require": "./dist/
|
|
62
|
+
"types": "./dist/indexeddb-transport.d.ts",
|
|
63
|
+
"import": "./dist/indexeddb-transport.js",
|
|
64
|
+
"require": "./dist/indexeddb-transport.cjs"
|
|
65
65
|
},
|
|
66
66
|
"./offline-first-transport": {
|
|
67
|
-
"types": "./dist/
|
|
68
|
-
"import": "./dist/
|
|
69
|
-
"require": "./dist/
|
|
67
|
+
"types": "./dist/offline-first-transport.d.ts",
|
|
68
|
+
"import": "./dist/offline-first-transport.js",
|
|
69
|
+
"require": "./dist/offline-first-transport.cjs"
|
|
70
70
|
},
|
|
71
71
|
"./export-zip": {
|
|
72
|
-
"types": "./dist/
|
|
73
|
-
"import": "./dist/
|
|
74
|
-
"require": "./dist/
|
|
72
|
+
"types": "./dist/zip-export.d.ts",
|
|
73
|
+
"import": "./dist/zip-export.js",
|
|
74
|
+
"require": "./dist/zip-export.cjs"
|
|
75
75
|
},
|
|
76
76
|
"./integration-console": {
|
|
77
|
-
"types": "./dist/
|
|
78
|
-
"import": "./dist/
|
|
79
|
-
"require": "./dist/
|
|
77
|
+
"types": "./dist/console-integration.d.ts",
|
|
78
|
+
"import": "./dist/console-integration.js",
|
|
79
|
+
"require": "./dist/console-integration.cjs"
|
|
80
80
|
},
|
|
81
81
|
"./integration-context": {
|
|
82
|
-
"types": "./dist/
|
|
83
|
-
"import": "./dist/
|
|
84
|
-
"require": "./dist/
|
|
82
|
+
"types": "./dist/context-propagation-integration.d.ts",
|
|
83
|
+
"import": "./dist/context-propagation-integration.js",
|
|
84
|
+
"require": "./dist/context-propagation-integration.cjs"
|
|
85
85
|
},
|
|
86
86
|
"./integration-errors": {
|
|
87
|
-
"types": "./dist/
|
|
88
|
-
"import": "./dist/
|
|
89
|
-
"require": "./dist/
|
|
87
|
+
"types": "./dist/error-integration.d.ts",
|
|
88
|
+
"import": "./dist/error-integration.js",
|
|
89
|
+
"require": "./dist/error-integration.cjs"
|
|
90
90
|
},
|
|
91
91
|
"./integration-fetch": {
|
|
92
|
-
"types": "./dist/
|
|
93
|
-
"import": "./dist/
|
|
94
|
-
"require": "./dist/
|
|
92
|
+
"types": "./dist/fetch-integration.d.ts",
|
|
93
|
+
"import": "./dist/fetch-integration.js",
|
|
94
|
+
"require": "./dist/fetch-integration.cjs"
|
|
95
95
|
},
|
|
96
96
|
"./integration-xhr": {
|
|
97
|
-
"types": "./dist/
|
|
98
|
-
"import": "./dist/
|
|
99
|
-
"require": "./dist/
|
|
97
|
+
"types": "./dist/xhr-integration.d.ts",
|
|
98
|
+
"import": "./dist/xhr-integration.js",
|
|
99
|
+
"require": "./dist/xhr-integration.cjs"
|
|
100
100
|
},
|
|
101
101
|
"./integration-framework-errors": {
|
|
102
|
-
"types": "./dist/
|
|
103
|
-
"import": "./dist/
|
|
104
|
-
"require": "./dist/
|
|
102
|
+
"types": "./dist/framework-error-integration.d.ts",
|
|
103
|
+
"import": "./dist/framework-error-integration.js",
|
|
104
|
+
"require": "./dist/framework-error-integration.cjs"
|
|
105
105
|
},
|
|
106
106
|
"./integration-framework-routers": {
|
|
107
|
-
"types": "./dist/
|
|
108
|
-
"import": "./dist/
|
|
109
|
-
"require": "./dist/
|
|
107
|
+
"types": "./dist/framework-router-integrations.d.ts",
|
|
108
|
+
"import": "./dist/framework-router-integrations.js",
|
|
109
|
+
"require": "./dist/framework-router-integrations.cjs"
|
|
110
110
|
},
|
|
111
111
|
"./integration-reporting": {
|
|
112
|
-
"types": "./dist/
|
|
113
|
-
"import": "./dist/
|
|
114
|
-
"require": "./dist/
|
|
112
|
+
"types": "./dist/reporting-integration.d.ts",
|
|
113
|
+
"import": "./dist/reporting-integration.js",
|
|
114
|
+
"require": "./dist/reporting-integration.cjs"
|
|
115
115
|
},
|
|
116
116
|
"./integration-router": {
|
|
117
|
-
"types": "./dist/
|
|
118
|
-
"import": "./dist/
|
|
119
|
-
"require": "./dist/
|
|
117
|
+
"types": "./dist/router-integration.d.ts",
|
|
118
|
+
"import": "./dist/router-integration.js",
|
|
119
|
+
"require": "./dist/router-integration.cjs"
|
|
120
120
|
},
|
|
121
121
|
"./integration-runtime-host": {
|
|
122
|
-
"types": "./dist/
|
|
123
|
-
"import": "./dist/
|
|
124
|
-
"require": "./dist/
|
|
122
|
+
"types": "./dist/runtime-host-integration.d.ts",
|
|
123
|
+
"import": "./dist/runtime-host-integration.js",
|
|
124
|
+
"require": "./dist/runtime-host-integration.cjs"
|
|
125
125
|
},
|
|
126
126
|
"./integration-service-worker": {
|
|
127
|
-
"types": "./dist/
|
|
128
|
-
"import": "./dist/
|
|
129
|
-
"require": "./dist/
|
|
127
|
+
"types": "./dist/service-worker-integration.d.ts",
|
|
128
|
+
"import": "./dist/service-worker-integration.js",
|
|
129
|
+
"require": "./dist/service-worker-integration.cjs"
|
|
130
130
|
},
|
|
131
131
|
"./integration-user-actions": {
|
|
132
|
-
"types": "./dist/
|
|
133
|
-
"import": "./dist/
|
|
134
|
-
"require": "./dist/
|
|
132
|
+
"types": "./dist/user-action-integration.d.ts",
|
|
133
|
+
"import": "./dist/user-action-integration.js",
|
|
134
|
+
"require": "./dist/user-action-integration.cjs"
|
|
135
135
|
},
|
|
136
136
|
"./integration-websocket": {
|
|
137
|
-
"types": "./dist/
|
|
138
|
-
"import": "./dist/
|
|
139
|
-
"require": "./dist/
|
|
137
|
+
"types": "./dist/websocket-integration.d.ts",
|
|
138
|
+
"import": "./dist/websocket-integration.js",
|
|
139
|
+
"require": "./dist/websocket-integration.cjs"
|
|
140
140
|
},
|
|
141
141
|
"./integration-web-vitals": {
|
|
142
|
-
"types": "./dist/
|
|
143
|
-
"import": "./dist/
|
|
144
|
-
"require": "./dist/
|
|
142
|
+
"types": "./dist/web-vitals-integration.d.ts",
|
|
143
|
+
"import": "./dist/web-vitals-integration.js",
|
|
144
|
+
"require": "./dist/web-vitals-integration.cjs"
|
|
145
145
|
},
|
|
146
146
|
"./integration-performance": {
|
|
147
|
-
"types": "./dist/
|
|
148
|
-
"import": "./dist/
|
|
149
|
-
"require": "./dist/
|
|
147
|
+
"types": "./dist/performance-integration.d.ts",
|
|
148
|
+
"import": "./dist/performance-integration.js",
|
|
149
|
+
"require": "./dist/performance-integration.cjs"
|
|
150
150
|
},
|
|
151
151
|
"./integration-page-lifecycle": {
|
|
152
|
-
"types": "./dist/
|
|
153
|
-
"import": "./dist/
|
|
154
|
-
"require": "./dist/
|
|
152
|
+
"types": "./dist/page-lifecycle.d.ts",
|
|
153
|
+
"import": "./dist/page-lifecycle.js",
|
|
154
|
+
"require": "./dist/page-lifecycle.cjs"
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
157
|
"publishConfig": {
|
|
@@ -159,7 +159,34 @@
|
|
|
159
159
|
"provenance": true
|
|
160
160
|
},
|
|
161
161
|
"dependencies": {
|
|
162
|
-
"@loggerjs/core": "0.5.
|
|
162
|
+
"@loggerjs/core": "0.5.1"
|
|
163
|
+
},
|
|
164
|
+
"loggerjsSubpathEntries": {
|
|
165
|
+
"http-transport": "src/http-transport.ts",
|
|
166
|
+
"payload-transforms": "src/payload-transforms.ts",
|
|
167
|
+
"broadcast-channel-transport": "src/broadcast-channel-transport.ts",
|
|
168
|
+
"service-worker-transport": "src/service-worker-transport.ts",
|
|
169
|
+
"websocket-transport": "src/websocket-transport.ts",
|
|
170
|
+
"indexeddb-offline-queue": "src/indexeddb-offline-queue.ts",
|
|
171
|
+
"indexeddb-transport": "src/indexeddb-transport.ts",
|
|
172
|
+
"offline-first-transport": "src/offline-first-transport.ts",
|
|
173
|
+
"zip-export": "src/zip-export.ts",
|
|
174
|
+
"console-integration": "src/console-integration.ts",
|
|
175
|
+
"context-propagation-integration": "src/context-propagation-integration.ts",
|
|
176
|
+
"error-integration": "src/error-integration.ts",
|
|
177
|
+
"fetch-integration": "src/fetch-integration.ts",
|
|
178
|
+
"xhr-integration": "src/xhr-integration.ts",
|
|
179
|
+
"framework-error-integration": "src/framework-error-integration.ts",
|
|
180
|
+
"framework-router-integrations": "src/framework-router-integrations.ts",
|
|
181
|
+
"reporting-integration": "src/reporting-integration.ts",
|
|
182
|
+
"router-integration": "src/router-integration.ts",
|
|
183
|
+
"runtime-host-integration": "src/runtime-host-integration.ts",
|
|
184
|
+
"service-worker-integration": "src/service-worker-integration.ts",
|
|
185
|
+
"user-action-integration": "src/user-action-integration.ts",
|
|
186
|
+
"websocket-integration": "src/websocket-integration.ts",
|
|
187
|
+
"web-vitals-integration": "src/web-vitals-integration.ts",
|
|
188
|
+
"performance-integration": "src/performance-integration.ts",
|
|
189
|
+
"page-lifecycle": "src/page-lifecycle.ts"
|
|
163
190
|
},
|
|
164
191
|
"scripts": {
|
|
165
192
|
"build": "pnpm run clean && pnpm run build:js && pnpm run build:types",
|