webspresso 0.0.109 → 0.0.111
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/core/client/adapter/datastar.js +248 -51
- package/core/client/api.js +328 -22
- package/core/client/controller.js +921 -38
- package/core/client/debug.js +12 -12
- package/core/client/devtool.js +1239 -0
- package/core/client/forms.js +184 -21
- package/core/client/fragments.js +566 -72
- package/core/client/host.js +365 -0
- package/core/client/index.d.ts +37 -0
- package/core/client/index.js +190 -15
- package/core/client/lite.js +112 -4
- package/core/client/server-fragments.js +111 -24
- package/core/client/services.js +588 -0
- package/core/client/storage.js +339 -0
- package/core/client/utils.js +324 -1
- package/core/index.js +4 -0
- package/index.d.ts +523 -39
- package/index.js +7 -0
- package/package.json +7 -8
- package/src/bundle/index.js +175 -14
- package/src/client-runtime/bootstrap-swup.js +9 -0
- package/src/client-runtime/mount.js +6 -18
- package/src/client-runtime/resolve.js +3 -2
- package/src/dev/banner.js +4 -1
- package/src/dev-reload/index.js +29 -1
- package/src/file-router.js +12 -8
- package/src/routing/mount-discovered-routes.js +9 -2
- package/src/server.js +42 -24
- package/views/partials/webspresso-client-runtime.njk +1 -9
- package/src/client-runtime/bootstrap-alpine-swup.js +0 -34
package/core/client/debug.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* and lifecycle cleanup errors without logging raw form values or sensitive payloads.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const { NOOP_DEBUGGER } = require('./utils');
|
|
11
|
+
const { isArray, isNumber, NOOP_DEBUGGER, uid } = require('./utils');
|
|
12
12
|
|
|
13
13
|
const SENSITIVE_KEY_PATTERN = /password|passwd|secret|token|authorization|cookie|credit|card|cvv|ssn|api[-_]?key/i;
|
|
14
14
|
|
|
@@ -32,7 +32,7 @@ function summarizePayloadSafely(payload, includeSafePrimitives = false) {
|
|
|
32
32
|
if (typeof Blob !== 'undefined' && payload instanceof Blob) {
|
|
33
33
|
return { type: 'Blob', size: payload.size, mimeType: payload.type || 'application/octet-stream' };
|
|
34
34
|
}
|
|
35
|
-
if (
|
|
35
|
+
if (isArray(payload)) {
|
|
36
36
|
return { type: 'Array', length: payload.length };
|
|
37
37
|
}
|
|
38
38
|
if (typeof payload === 'object') {
|
|
@@ -58,7 +58,7 @@ function summarizePayloadSafely(payload, includeSafePrimitives = false) {
|
|
|
58
58
|
*/
|
|
59
59
|
function createActiveDebugger(options = {}) {
|
|
60
60
|
let enabled = Boolean(options.enabled);
|
|
61
|
-
const maxEvents =
|
|
61
|
+
const maxEvents = isNumber(options.maxEvents) && options.maxEvents > 0 ? options.maxEvents : 200;
|
|
62
62
|
const customLogger = typeof options.logger === 'function' ? options.logger : null;
|
|
63
63
|
|
|
64
64
|
const events = [];
|
|
@@ -73,7 +73,7 @@ function createActiveDebugger(options = {}) {
|
|
|
73
73
|
|
|
74
74
|
function pushEvent(type, detail = {}) {
|
|
75
75
|
const entry = {
|
|
76
|
-
id:
|
|
76
|
+
id: uid('evt'),
|
|
77
77
|
type,
|
|
78
78
|
timestamp: Date.now(),
|
|
79
79
|
...detail,
|
|
@@ -192,7 +192,7 @@ function createActiveDebugger(options = {}) {
|
|
|
192
192
|
completedAt: Date.now(),
|
|
193
193
|
},
|
|
194
194
|
invalidation: {
|
|
195
|
-
tags:
|
|
195
|
+
tags: isArray(tags) ? [...tags] : [],
|
|
196
196
|
triggeredAt: Date.now(),
|
|
197
197
|
},
|
|
198
198
|
refresh: null,
|
|
@@ -215,11 +215,11 @@ function createActiveDebugger(options = {}) {
|
|
|
215
215
|
recordChainRefresh(chainId, { fragmentIds, status, loadMs, renderMs, totalServerMs, error }) {
|
|
216
216
|
const chain = chainId ? causalChains.get(chainId) : null;
|
|
217
217
|
const refreshData = {
|
|
218
|
-
fragmentIds:
|
|
218
|
+
fragmentIds: isArray(fragmentIds) ? [...fragmentIds] : [],
|
|
219
219
|
status: status || 'ok',
|
|
220
|
-
loadMs:
|
|
221
|
-
renderMs:
|
|
222
|
-
totalServerMs:
|
|
220
|
+
loadMs: isNumber(loadMs) ? loadMs : null,
|
|
221
|
+
renderMs: isNumber(renderMs) ? renderMs : null,
|
|
222
|
+
totalServerMs: isNumber(totalServerMs) ? totalServerMs : null,
|
|
223
223
|
error: error ? String(error.message || error) : null,
|
|
224
224
|
completedAt: Date.now(),
|
|
225
225
|
};
|
|
@@ -234,9 +234,9 @@ function createActiveDebugger(options = {}) {
|
|
|
234
234
|
const patchData = {
|
|
235
235
|
instanceId,
|
|
236
236
|
fragmentName: fragmentName || null,
|
|
237
|
-
patchMs:
|
|
238
|
-
loadMs:
|
|
239
|
-
renderMs:
|
|
237
|
+
patchMs: isNumber(patchMs) ? patchMs : 0,
|
|
238
|
+
loadMs: isNumber(loadMs) ? loadMs : null,
|
|
239
|
+
renderMs: isNumber(renderMs) ? renderMs : null,
|
|
240
240
|
completedAt: Date.now(),
|
|
241
241
|
};
|
|
242
242
|
if (chain) {
|