@stacksjs/stx 0.2.155 → 0.2.157
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/a11y.d.ts +87 -46
- package/dist/animation.d.ts +96 -42
- package/dist/appearance-bootstrap.d.ts +49 -15
- package/dist/asset-roots.d.ts +32 -0
- package/dist/asset-roots.js +7 -0
- package/dist/assets.d.ts +9 -7
- package/dist/async-components.d.ts +78 -56
- package/dist/auth.d.ts +3 -0
- package/dist/build-externalize.d.ts +40 -0
- package/dist/build-externalize.js +63 -0
- package/dist/build-id.d.ts +22 -22
- package/dist/build-message.d.ts +73 -2
- package/dist/build-message.js +47 -8
- package/dist/builtins/attrs.d.ts +14 -0
- package/dist/builtins/drawer.d.ts +22 -0
- package/dist/builtins/icon.d.ts +16 -2
- package/dist/builtins/index.d.ts +5 -15
- package/dist/builtins/modal.d.ts +24 -0
- package/dist/builtins/safe-image.d.ts +42 -0
- package/dist/builtins/stx-image.d.ts +27 -0
- package/dist/builtins/stx-link.d.ts +9 -0
- package/dist/builtins/stx-loading-indicator.d.ts +11 -0
- package/dist/builtins/suspense.d.ts +28 -0
- package/dist/builtins/toast.d.ts +17 -0
- package/dist/builtins/transition-group.d.ts +25 -0
- package/dist/caching.d.ts +12 -15
- package/dist/cli.js +1798 -908
- package/dist/client/directive.d.ts +7 -0
- package/dist/client/index.d.ts +0 -1
- package/dist/client-script-bundler.d.ts +63 -5
- package/dist/client-script-bundler.js +30 -2
- package/dist/client-script.d.ts +102 -47
- package/dist/client-script.js +15 -3
- package/dist/codemod.d.ts +56 -0
- package/dist/codemod.js +192 -0
- package/dist/color-mode-boot.d.ts +83 -65
- package/dist/component-client-factories.d.ts +1 -6
- package/dist/component-processing.d.ts +58 -49
- package/dist/component-processing.js +1 -1
- package/dist/component-registry.d.ts +94 -31
- package/dist/component-renderer.d.ts +18 -0
- package/dist/composable-loader.d.ts +24 -0
- package/dist/composable-loader.js +12 -9
- package/dist/composables/index.d.ts +7 -0
- package/dist/composables/index.js +1 -0
- package/dist/composables/use-fetch.js +30 -2
- package/dist/composables/use-form.d.ts +91 -0
- package/dist/composables/use-form.js +112 -0
- package/dist/composables.d.ts +64 -60
- package/dist/computed.d.ts +86 -92
- package/dist/conditionals.d.ts +24 -8
- package/dist/conditionals.js +16 -0
- package/dist/config.d.ts +34 -21
- package/dist/config.js +35 -14
- package/dist/craft.js +1476 -768
- package/dist/crosswind-config.d.ts +58 -0
- package/dist/crosswind-config.js +40 -0
- package/dist/csp.d.ts +107 -41
- package/dist/defer.d.ts +24 -0
- package/dist/dev-server/crosswind.d.ts +35 -26
- package/dist/dev-server/crosswind.js +2 -18
- package/dist/dev-server/serve-app.js +4 -3
- package/dist/dev-server/terminal-colors.d.ts +32 -32
- package/dist/directive-api.d.ts +86 -43
- package/dist/document-shell.d.ts +54 -41
- package/dist/dynamic-components.d.ts +9 -0
- package/dist/error-boundaries.d.ts +47 -41
- package/dist/error-handling.d.ts +1 -1
- package/dist/errors/codes.d.ts +51 -43
- package/dist/errors/formatter.d.ts +58 -38
- package/dist/errors/index.d.ts +5 -61
- package/dist/errors/logger.d.ts +114 -40
- package/dist/errors/sanitizer.d.ts +53 -23
- package/dist/errors/types.d.ts +44 -31
- package/dist/events.d.ts +86 -25
- package/dist/expressions.d.ts +50 -42
- package/dist/forms-validation.d.ts +138 -123
- package/dist/forms-validation.js +1 -90
- package/dist/forms.d.ts +120 -66
- package/dist/forms.js +31 -11
- package/dist/fragment-container.d.ts +57 -0
- package/dist/fragment-container.js +109 -0
- package/dist/framework-composables.d.ts +32 -0
- package/dist/head.d.ts +156 -114
- package/dist/heatmap.d.ts +152 -72
- package/dist/html-masking.d.ts +40 -34
- package/dist/hydration-runtime.d.ts +20 -24
- package/dist/i18n.d.ts +93 -32
- package/dist/image-optimization/auto-sibling.d.ts +32 -4
- package/dist/includes.d.ts +69 -7
- package/dist/index.d.ts +66 -0
- package/dist/index.js +23 -0
- package/dist/internal-markdown.d.ts +12 -8
- package/dist/island-chunking.d.ts +30 -13
- package/dist/keep-alive.d.ts +72 -52
- package/dist/layout-types.d.ts +45 -0
- package/dist/layout-types.js +56 -0
- package/dist/lazy-module.d.ts +10 -0
- package/dist/loops.d.ts +66 -0
- package/dist/loops.js +47 -6
- package/dist/markdown.d.ts +0 -1
- package/dist/media/image/component.d.ts +25 -9
- package/dist/media/image/directive.d.ts +15 -1
- package/dist/media/image/placeholder.d.ts +20 -9
- package/dist/media/image/processor/cache.d.ts +40 -18
- package/dist/media/image/processor/index.d.ts +1 -10
- package/dist/media/image/processor/optimizer.d.ts +12 -1
- package/dist/media/image/processor/responsive.d.ts +16 -6
- package/dist/media/image/srcset.d.ts +47 -50
- package/dist/media/shared/cache.d.ts +51 -31
- package/dist/media/shared/hash.d.ts +7 -0
- package/dist/media/types.d.ts +1235 -754
- package/dist/media/video/directive.d.ts +15 -1
- package/dist/media/video/index.d.ts +39 -17
- package/dist/media/video/processor/cache.d.ts +42 -19
- package/dist/media/video/processor/index.d.ts +1 -18
- package/dist/media/video/processor/streaming.d.ts +17 -10
- package/dist/media/video/processor/thumbnail.d.ts +21 -15
- package/dist/media/video/processor/transcoder.d.ts +11 -1
- package/dist/method-spoofing.d.ts +7 -0
- package/dist/middleware.d.ts +60 -0
- package/dist/owned-routes.d.ts +42 -0
- package/dist/owned-routes.js +26 -0
- package/dist/page-meta.d.ts +38 -0
- package/dist/page-meta.js +16 -0
- package/dist/parser/directive-parser.d.ts +57 -45
- package/dist/parser/expression-parser.d.ts +33 -35
- package/dist/parser/index.d.ts +4 -39
- package/dist/parser/tokenizer.d.ts +61 -49
- package/dist/partial-hydration.d.ts +82 -50
- package/dist/performance-utils.d.ts +217 -124
- package/dist/placeholder.d.ts +18 -9
- package/dist/plugin-system.d.ts +264 -115
- package/dist/process.d.ts +11 -6
- package/dist/process.js +21 -4
- package/dist/production-builder.js +7 -0
- package/dist/prop-sentinels.d.ts +11 -11
- package/dist/public-env.d.ts +14 -0
- package/dist/pwa/directives.d.ts +12 -3
- package/dist/pwa/inject.d.ts +10 -0
- package/dist/pwa/precache.d.ts +22 -16
- package/dist/pwa/service-worker.d.ts +12 -0
- package/dist/pwa.js +1318 -610
- package/dist/reactive-bindings.d.ts +34 -11
- package/dist/reactive.d.ts +58 -30
- package/dist/reactive.js +56 -31
- package/dist/render.d.ts +0 -14
- package/dist/render.js +17 -0
- package/dist/route-middleware.d.ts +2 -35
- package/dist/route-types.d.ts +134 -0
- package/dist/route-types.js +24 -0
- package/dist/router.d.ts +5 -7
- package/dist/routes.d.ts +1 -3
- package/dist/runtime-globals.d.ts +147 -24
- package/dist/runtime-globals.js +16 -1
- package/dist/runtime-injection.d.ts +8 -0
- package/dist/runtime-injection.js +33 -24
- package/dist/script-emit.d.ts +30 -0
- package/dist/script-json.d.ts +36 -0
- package/dist/script-json.js +6 -0
- package/dist/script-validation.d.ts +21 -4
- package/dist/seo.d.ts +118 -47
- package/dist/server-bindings.d.ts +21 -0
- package/dist/sfc-template.d.ts +8 -8
- package/dist/signal-processing.d.ts +35 -15
- package/dist/signals-api.d.ts +117 -58
- package/dist/signals-api.js +7 -4
- package/dist/signals.d.ts +24 -17
- package/dist/signals.js +765 -60
- package/dist/site-builder/build.js +8 -0
- package/dist/site-url.d.ts +46 -0
- package/dist/site-url.js +70 -0
- package/dist/slots.d.ts +86 -20
- package/dist/source-signature.d.ts +45 -0
- package/dist/source-signature.js +20 -0
- package/dist/ssg.d.ts +285 -142
- package/dist/ssg.js +1268 -556
- package/dist/state-dir.d.ts +4 -4
- package/dist/state-management.d.ts +0 -12
- package/dist/state-management.js +8 -25
- package/dist/store-imports.d.ts +23 -0
- package/dist/store-imports.js +3 -0
- package/dist/store-loader.d.ts +10 -0
- package/dist/store-loader.js +10 -9
- package/dist/story/analytics.d.ts +138 -60
- package/dist/story/bookmarks.d.ts +87 -34
- package/dist/story/cli.d.ts +123 -69
- package/dist/story/collect/scanner.d.ts +4 -0
- package/dist/story/collect/tree.d.ts +8 -1
- package/dist/story/commands/build.d.ts +11 -6
- package/dist/story/commands/dev.d.ts +15 -8
- package/dist/story/commands/preview.d.ts +13 -7
- package/dist/story/config-watcher.d.ts +20 -13
- package/dist/story/config.d.ts +11 -8
- package/dist/story/context.d.ts +14 -8
- package/dist/story/hmr.d.ts +24 -26
- package/dist/story/hot-swap.d.ts +34 -23
- package/dist/story/keyboard-shortcuts.d.ts +23 -18
- package/dist/story/output.d.ts +46 -44
- package/dist/story/performance.d.ts +107 -45
- package/dist/story/presets.d.ts +107 -41
- package/dist/story/renderer.d.ts +41 -27
- package/dist/story/search.d.ts +23 -12
- package/dist/story/server.d.ts +21 -11
- package/dist/story/setup.d.ts +23 -15
- package/dist/story/testing.d.ts +65 -40
- package/dist/story/types.d.ts +262 -160
- package/dist/streaming.d.ts +119 -57
- package/dist/stx-virtual-ts.d.ts +165 -0
- package/dist/stx-virtual-ts.js +372 -0
- package/dist/stx.d.ts +78 -1
- package/dist/style-scoping.d.ts +17 -4
- package/dist/suspense.d.ts +67 -52
- package/dist/teleport.d.ts +22 -0
- package/dist/template-tag-balance.d.ts +22 -6
- package/dist/transitions.d.ts +66 -55
- package/dist/typecheck.d.ts +77 -0
- package/dist/typecheck.js +156 -0
- package/dist/types/component-types.d.ts +187 -122
- package/dist/types/config-types.d.ts +758 -297
- package/dist/types/context-types.d.ts +46 -24
- package/dist/types/csp-types.d.ts +70 -66
- package/dist/types/directive-types.d.ts +211 -155
- package/dist/types/index.d.ts +6 -109
- package/dist/types/pwa-types.d.ts +273 -148
- package/dist/types.d.ts +0 -1
- package/dist/typescript-templates.d.ts +11 -0
- package/dist/unresolved-identifiers.d.ts +24 -22
- package/dist/unresolved-identifiers.js +2 -0
- package/dist/utils.d.ts +24 -21
- package/dist/validator.d.ts +28 -26
- package/dist/variable-extractor.d.ts +48 -13
- package/dist/variable-extractor.js +27 -4
- package/dist/view-composers.d.ts +80 -81
- package/dist/virtual-scrolling.d.ts +101 -81
- package/dist/vue-template.d.ts +23 -0
- package/dist/web-components/css-scoping.d.ts +21 -11
- package/dist/web-components.d.ts +81 -58
- package/dist/x-element.d.ts +0 -1
- package/package.json +5 -5
- package/stx.d.ts +78 -1
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performance optimization utilities for stx
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Generic LRU (Least Recently Used) cache implementation
|
|
6
|
+
* Automatically evicts least recently used items when capacity is reached
|
|
7
|
+
*/
|
|
8
|
+
export declare class LRUCache<K, V> {
|
|
9
|
+
private cache;
|
|
10
|
+
private readonly maxSize;
|
|
11
|
+
constructor(maxSize?: number);
|
|
12
|
+
/**
|
|
13
|
+
* Get a value from the cache, moving it to most recently used
|
|
14
|
+
*/
|
|
15
|
+
get(key: K): V | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Set a value in the cache
|
|
18
|
+
*/
|
|
19
|
+
set(key: K, value: V): void;
|
|
20
|
+
/**
|
|
21
|
+
* Check if key exists in cache
|
|
22
|
+
*/
|
|
23
|
+
has(key: K): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Delete a key from the cache
|
|
26
|
+
*/
|
|
27
|
+
delete(key: K): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Clear all entries from the cache
|
|
30
|
+
*/
|
|
31
|
+
clear(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Get the current size of the cache
|
|
34
|
+
*/
|
|
35
|
+
get size(): number;
|
|
36
|
+
/**
|
|
37
|
+
* Get all keys in the cache (oldest to newest)
|
|
38
|
+
*/
|
|
39
|
+
keys(): IterableIterator<K>;
|
|
40
|
+
/**
|
|
41
|
+
* Get all values in the cache (oldest to newest)
|
|
42
|
+
*/
|
|
43
|
+
values(): IterableIterator<V>;
|
|
44
|
+
}
|
|
1
45
|
/**
|
|
2
46
|
* Get a cached regex pattern or compile and cache it.
|
|
3
47
|
*
|
|
@@ -23,6 +67,39 @@ export declare function getCachedRegex(pattern: string, flags?: string): RegExp;
|
|
|
23
67
|
* Clear the regex cache (useful for testing)
|
|
24
68
|
*/
|
|
25
69
|
export declare function clearRegexCache(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Cache for template processing results
|
|
72
|
+
*/
|
|
73
|
+
export declare class TemplateCache {
|
|
74
|
+
private cache;
|
|
75
|
+
private maxSize;
|
|
76
|
+
private ttl;
|
|
77
|
+
constructor(maxSize?: number, ttl?: number);
|
|
78
|
+
/**
|
|
79
|
+
* Get cached result if available and not expired
|
|
80
|
+
*/
|
|
81
|
+
get(key: string): string | null;
|
|
82
|
+
/**
|
|
83
|
+
* Store result in cache
|
|
84
|
+
*/
|
|
85
|
+
set(key: string, result: string, dependencies?: Set<string>): void;
|
|
86
|
+
/**
|
|
87
|
+
* Invalidate cache entries that depend on a specific file
|
|
88
|
+
*/
|
|
89
|
+
invalidateDependency(filePath: string): number;
|
|
90
|
+
/**
|
|
91
|
+
* Clear all cached entries
|
|
92
|
+
*/
|
|
93
|
+
clear(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Get cache statistics
|
|
96
|
+
*/
|
|
97
|
+
getStats(): {
|
|
98
|
+
size: number;
|
|
99
|
+
maxSize: number;
|
|
100
|
+
hitRate?: number;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
26
103
|
/**
|
|
27
104
|
* Debounce function calls to avoid excessive processing
|
|
28
105
|
*/
|
|
@@ -40,151 +117,167 @@ export declare function memoize<T extends (...args: any[]) => any>(func: T, maxC
|
|
|
40
117
|
*/
|
|
41
118
|
export declare function optimizedReplace(text: string, pattern: string | RegExp, replacement: string | ((match: string, ...args: any[]) => string), flags?: string): string;
|
|
42
119
|
/**
|
|
43
|
-
*
|
|
44
|
-
* This avoids instantiating the monitor until it's actually needed
|
|
45
|
-
*/
|
|
46
|
-
export declare function getPerformanceMonitor(): PerformanceMonitor;
|
|
47
|
-
/**
|
|
48
|
-
* Apply default performance budgets to the monitor
|
|
49
|
-
*/
|
|
50
|
-
export declare function applyDefaultBudgets(monitor?: PerformanceMonitor): void;
|
|
51
|
-
/**
|
|
52
|
-
* Reset the performance monitor instance (useful for testing)
|
|
53
|
-
*/
|
|
54
|
-
export declare function resetPerformanceMonitor(): void;
|
|
55
|
-
// Global expression evaluator pool
|
|
56
|
-
export declare const expressionEvaluatorPool: ExpressionEvaluatorPool;
|
|
57
|
-
/**
|
|
58
|
-
* Default performance budgets for common operations
|
|
120
|
+
* Pool of worker contexts to avoid creating new Function instances
|
|
59
121
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
maxTime: 200;
|
|
68
|
-
warnThreshold: 0.8;
|
|
69
|
-
action: 'warn'
|
|
70
|
-
};
|
|
71
|
-
processIncludes: {
|
|
72
|
-
maxTime: 100;
|
|
73
|
-
warnThreshold: 0.8;
|
|
74
|
-
action: 'warn'
|
|
75
|
-
};
|
|
76
|
-
processLoops: {
|
|
77
|
-
maxTime: 50;
|
|
78
|
-
warnThreshold: 0.8;
|
|
79
|
-
action: 'warn'
|
|
80
|
-
};
|
|
81
|
-
processConditionals: {
|
|
82
|
-
maxTime: 50;
|
|
83
|
-
warnThreshold: 0.8;
|
|
84
|
-
action: 'warn'
|
|
85
|
-
};
|
|
86
|
-
processExpressions: {
|
|
87
|
-
maxTime: 100;
|
|
88
|
-
warnThreshold: 0.8;
|
|
89
|
-
action: 'warn'
|
|
90
|
-
};
|
|
91
|
-
renderComponent: {
|
|
92
|
-
maxTime: 150;
|
|
93
|
-
warnThreshold: 0.8;
|
|
94
|
-
action: 'warn'
|
|
95
|
-
};
|
|
96
|
-
buildWebComponents: {
|
|
97
|
-
maxTime: 1000;
|
|
98
|
-
warnThreshold: 0.8;
|
|
99
|
-
action: 'warn'
|
|
122
|
+
declare class ExpressionEvaluatorPool {
|
|
123
|
+
private pool;
|
|
124
|
+
private maxPoolSize;
|
|
125
|
+
private fnCache;
|
|
126
|
+
private fnCacheMaxSize;
|
|
127
|
+
getEvaluator(contextKeys: string[]): (...args: any[]) => any;
|
|
128
|
+
clear(): void;
|
|
100
129
|
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Global performance monitor instance
|
|
104
|
-
* @deprecated Use getPerformanceMonitor() for lazy loading
|
|
105
|
-
*/
|
|
106
|
-
export declare const performanceMonitor: PerformanceMonitor;
|
|
130
|
+
export declare const expressionEvaluatorPool: ExpressionEvaluatorPool;
|
|
107
131
|
/**
|
|
108
132
|
* Performance budget configuration
|
|
109
133
|
*/
|
|
110
|
-
export
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
134
|
+
export interface PerformanceBudget {
|
|
135
|
+
/** Maximum allowed time in milliseconds */
|
|
136
|
+
maxTime: number;
|
|
137
|
+
/** Warning threshold (percentage of maxTime, e.g., 0.8 = 80%) */
|
|
138
|
+
warnThreshold?: number;
|
|
139
|
+
/** Action to take on budget violation: 'log', 'warn', 'error', 'throw' */
|
|
140
|
+
action?: 'log' | 'warn' | 'error' | 'throw';
|
|
114
141
|
}
|
|
115
142
|
/**
|
|
116
143
|
* Performance budget violation event
|
|
117
144
|
*/
|
|
118
|
-
export
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
145
|
+
export interface BudgetViolation {
|
|
146
|
+
label: string;
|
|
147
|
+
actualTime: number;
|
|
148
|
+
budgetTime: number;
|
|
149
|
+
exceedancePercent: number;
|
|
150
|
+
timestamp: Date;
|
|
151
|
+
isWarning: boolean;
|
|
125
152
|
}
|
|
126
153
|
/**
|
|
127
154
|
* Performance budget violation handler type
|
|
128
155
|
*/
|
|
129
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
130
156
|
export type BudgetViolationHandler = (violation: BudgetViolation) => void;
|
|
131
|
-
/* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group, pickier/no-unused-vars */
|
|
132
157
|
/**
|
|
133
|
-
* Performance
|
|
158
|
+
* Performance monitor for tracking processing times with budget support
|
|
134
159
|
*/
|
|
160
|
+
export declare class PerformanceMonitor {
|
|
161
|
+
private metrics;
|
|
162
|
+
private budgets;
|
|
163
|
+
private violations;
|
|
164
|
+
private maxViolations;
|
|
165
|
+
private violationHandlers;
|
|
166
|
+
private enabled;
|
|
167
|
+
/**
|
|
168
|
+
* Enable or disable performance monitoring
|
|
169
|
+
*/
|
|
170
|
+
setEnabled(enabled: boolean): void;
|
|
171
|
+
/**
|
|
172
|
+
* Check if monitoring is enabled
|
|
173
|
+
*/
|
|
174
|
+
isEnabled(): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Set a performance budget for a specific operation
|
|
177
|
+
*
|
|
178
|
+
* @param label - Operation label
|
|
179
|
+
* @param budget - Budget configuration
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* performanceMonitor.setBudget('processDirectives', {
|
|
184
|
+
* maxTime: 100, // 100ms max
|
|
185
|
+
* warnThreshold: 0.8, // warn at 80ms
|
|
186
|
+
* action: 'warn'
|
|
187
|
+
* })
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
setBudget(label: string, budget: PerformanceBudget): void;
|
|
191
|
+
/**
|
|
192
|
+
* Set multiple performance budgets at once
|
|
193
|
+
*/
|
|
194
|
+
setBudgets(budgets: Record<string, PerformanceBudget>): void;
|
|
195
|
+
/**
|
|
196
|
+
* Remove a performance budget
|
|
197
|
+
*/
|
|
198
|
+
removeBudget(label: string): void;
|
|
199
|
+
/**
|
|
200
|
+
* Get all configured budgets
|
|
201
|
+
*/
|
|
202
|
+
getBudgets(): Record<string, PerformanceBudget>;
|
|
203
|
+
/**
|
|
204
|
+
* Add a handler for budget violations
|
|
205
|
+
*/
|
|
206
|
+
onViolation(handler: BudgetViolationHandler): void;
|
|
207
|
+
/**
|
|
208
|
+
* Remove a violation handler
|
|
209
|
+
*/
|
|
210
|
+
offViolation(handler: BudgetViolationHandler): void;
|
|
211
|
+
/**
|
|
212
|
+
* Time a function execution
|
|
213
|
+
*/
|
|
214
|
+
time<T>(label: string, fn: () => T): T;
|
|
215
|
+
/**
|
|
216
|
+
* Time an async function execution
|
|
217
|
+
*/
|
|
218
|
+
timeAsync<T>(label: string, fn: () => Promise<T>): Promise<T>;
|
|
219
|
+
/**
|
|
220
|
+
* Check if a duration violates the budget
|
|
221
|
+
*/
|
|
222
|
+
private checkBudget;
|
|
223
|
+
/**
|
|
224
|
+
* Record a timing measurement
|
|
225
|
+
*/
|
|
226
|
+
recordTime(label: string, duration: number): void;
|
|
227
|
+
/**
|
|
228
|
+
* Get performance statistics
|
|
229
|
+
*/
|
|
230
|
+
getStats(label?: string): Record<string, any>;
|
|
231
|
+
/**
|
|
232
|
+
* Get all budget violations
|
|
233
|
+
*/
|
|
234
|
+
getViolations(label?: string): BudgetViolation[];
|
|
235
|
+
/**
|
|
236
|
+
* Get violation statistics
|
|
237
|
+
*/
|
|
238
|
+
getViolationStats(): {
|
|
239
|
+
total: number;
|
|
240
|
+
byLabel: Record<string, number>;
|
|
241
|
+
warnings: number;
|
|
242
|
+
errors: number;
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Clear all metrics
|
|
246
|
+
*/
|
|
247
|
+
clear(): void;
|
|
248
|
+
/**
|
|
249
|
+
* Clear all violations
|
|
250
|
+
*/
|
|
251
|
+
clearViolations(): void;
|
|
252
|
+
/**
|
|
253
|
+
* Clear budgets
|
|
254
|
+
*/
|
|
255
|
+
clearBudgets(): void;
|
|
256
|
+
/**
|
|
257
|
+
* Reset everything (metrics, violations, budgets)
|
|
258
|
+
*/
|
|
259
|
+
reset(): void;
|
|
260
|
+
}
|
|
135
261
|
/**
|
|
136
|
-
*
|
|
137
|
-
* Automatically evicts least recently used items when capacity is reached
|
|
262
|
+
* Default performance budgets for common operations
|
|
138
263
|
*/
|
|
139
|
-
export declare
|
|
140
|
-
constructor(maxSize?: number);
|
|
141
|
-
get(key: K): V | undefined;
|
|
142
|
-
set(key: K, value: V): void;
|
|
143
|
-
has(key: K): boolean;
|
|
144
|
-
delete(key: K): boolean;
|
|
145
|
-
clear(): void;
|
|
146
|
-
get size(): number;
|
|
147
|
-
keys(): IterableIterator<K>;
|
|
148
|
-
values(): IterableIterator<V>;
|
|
149
|
-
}
|
|
264
|
+
export declare const defaultPerformanceBudgets: Record<string, PerformanceBudget>;
|
|
150
265
|
/**
|
|
151
|
-
*
|
|
266
|
+
* Get the global performance monitor instance (lazy-loaded)
|
|
267
|
+
* This avoids instantiating the monitor until it's actually needed
|
|
152
268
|
*/
|
|
153
|
-
export declare
|
|
154
|
-
constructor(maxSize?: number, ttl?: number);
|
|
155
|
-
get(key: string): string | null;
|
|
156
|
-
set(key: string, result: string, dependencies?: Set<string>): void;
|
|
157
|
-
invalidateDependency(filePath: string): number;
|
|
158
|
-
clear(): void;
|
|
159
|
-
getStats(): { size: number, maxSize: number, hitRate?: number };
|
|
160
|
-
}
|
|
269
|
+
export declare function getPerformanceMonitor(): PerformanceMonitor;
|
|
161
270
|
/**
|
|
162
|
-
*
|
|
271
|
+
* Global performance monitor instance
|
|
272
|
+
* @deprecated Use getPerformanceMonitor() for lazy loading
|
|
163
273
|
*/
|
|
164
|
-
declare
|
|
165
|
-
getEvaluator(contextKeys: string[]): (...args: any[]) => any;
|
|
166
|
-
clear(): void;
|
|
167
|
-
}
|
|
274
|
+
export declare const performanceMonitor: PerformanceMonitor;
|
|
168
275
|
/**
|
|
169
|
-
*
|
|
276
|
+
* Apply default performance budgets to the monitor
|
|
170
277
|
*/
|
|
171
|
-
export declare
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
getBudgets(): Record<string, PerformanceBudget>;
|
|
178
|
-
onViolation(handler: BudgetViolationHandler): void;
|
|
179
|
-
offViolation(handler: BudgetViolationHandler): void;
|
|
180
|
-
time<T>(label: string, fn: () => T): T;
|
|
181
|
-
timeAsync<T>(label: string, fn: () => Promise<T>): Promise<T>;
|
|
182
|
-
recordTime(label: string, duration: number): void;
|
|
183
|
-
getStats(label?: string): Record<string, any>;
|
|
184
|
-
getViolations(label?: string): BudgetViolation[];
|
|
185
|
-
getViolationStats(): { total: number, byLabel: Record<string, number>, warnings: number, errors: number };
|
|
186
|
-
clear(): void;
|
|
187
|
-
clearViolations(): void;
|
|
188
|
-
clearBudgets(): void;
|
|
189
|
-
reset(): void;
|
|
190
|
-
}
|
|
278
|
+
export declare function applyDefaultBudgets(monitor?: PerformanceMonitor): void;
|
|
279
|
+
/**
|
|
280
|
+
* Reset the performance monitor instance (useful for testing)
|
|
281
|
+
*/
|
|
282
|
+
export declare function resetPerformanceMonitor(): void;
|
|
283
|
+
export {};
|
package/dist/placeholder.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Placeholder Token System
|
|
3
|
+
*
|
|
4
|
+
* Generates and resolves placeholder tokens for the template pre-compilation pipeline.
|
|
5
|
+
* During build mode, dynamic expressions are replaced with placeholder tokens.
|
|
6
|
+
* At serve time, only the placeholders are resolved with request-time data.
|
|
7
|
+
*
|
|
8
|
+
* @module placeholder
|
|
9
|
+
*/
|
|
1
10
|
/**
|
|
2
11
|
* Reset the placeholder counter and registry (for testing / between builds).
|
|
3
12
|
*/
|
|
@@ -15,6 +24,15 @@ export declare function createPlaceholder(type: 'expr' | 'cond' | 'raw', expr: s
|
|
|
15
24
|
* Used by the template compiler to build the CompiledTemplate.placeholders field.
|
|
16
25
|
*/
|
|
17
26
|
export declare function getPlaceholderRegistry(): PlaceholderMap;
|
|
27
|
+
/**
|
|
28
|
+
* A map of placeholder tokens to their original expressions.
|
|
29
|
+
*/
|
|
30
|
+
export interface PlaceholderMap {
|
|
31
|
+
[token: string]: {
|
|
32
|
+
type: 'expr' | 'cond' | 'raw';
|
|
33
|
+
expression: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
18
36
|
/**
|
|
19
37
|
* Extract all placeholder tokens from compiled HTML.
|
|
20
38
|
*
|
|
@@ -34,12 +52,3 @@ export declare function replacePlaceholders(html: string, values: Map<string, st
|
|
|
34
52
|
* Check if HTML contains any placeholder tokens.
|
|
35
53
|
*/
|
|
36
54
|
export declare function hasPlaceholders(html: string): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* A map of placeholder tokens to their original expressions.
|
|
39
|
-
*/
|
|
40
|
-
export declare interface PlaceholderMap {
|
|
41
|
-
[token: string]: {
|
|
42
|
-
type: 'expr' | 'cond' | 'raw'
|
|
43
|
-
expression: string
|
|
44
|
-
}
|
|
45
|
-
}
|