@stacksjs/stx 0.1.16 → 0.2.3
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 +109 -5
- package/dist/analytics.d.ts +40 -0
- package/dist/animation.d.ts +91 -1
- package/dist/app.d.ts +51 -0
- package/dist/ast.d.ts +286 -0
- package/dist/async-components.d.ts +101 -0
- package/dist/auth.d.ts +1 -3
- package/dist/browser-composables.d.ts +314 -0
- package/dist/build-optimizer.d.ts +126 -0
- package/dist/build-views.d.ts +37 -0
- package/dist/bundle-analyzer/collector.d.ts +66 -0
- package/dist/bundle-analyzer/index.d.ts +60 -0
- package/dist/bundle-analyzer/report.d.ts +39 -0
- package/dist/bundle-analyzer/treemap.d.ts +19 -0
- package/dist/bundle-analyzer.js +499 -0
- package/dist/caching.d.ts +7 -0
- package/dist/cli.js +10885 -1203
- package/dist/client/directive.d.ts +10 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/router.d.ts +36 -0
- package/dist/client/stx-router.browser.d.ts +0 -0
- package/dist/client-script.d.ts +22 -0
- package/dist/component-hmr.d.ts +120 -0
- package/dist/components.d.ts +23 -1
- package/dist/composables/index.d.ts +277 -0
- package/dist/composables/use-battery.d.ts +46 -0
- package/dist/composables/use-broadcast-channel.d.ts +58 -0
- package/dist/composables/use-clipboard.d.ts +34 -0
- package/dist/composables/use-cookie.d.ts +70 -0
- package/dist/composables/use-device-orientation.d.ts +109 -0
- package/dist/composables/use-event-source.d.ts +77 -0
- package/dist/composables/use-eye-dropper.d.ts +107 -0
- package/dist/composables/use-fetch.d.ts +84 -0
- package/dist/composables/use-fullscreen.d.ts +47 -0
- package/dist/composables/use-geolocation.d.ts +62 -0
- package/dist/composables/use-idle.d.ts +84 -0
- package/dist/composables/use-intersection-observer.d.ts +81 -0
- package/dist/composables/use-keyboard.d.ts +100 -0
- package/dist/composables/use-media-query.d.ts +56 -0
- package/dist/composables/use-mouse.d.ts +64 -0
- package/dist/composables/use-mutation-observer.d.ts +101 -0
- package/dist/composables/use-network.d.ts +40 -0
- package/dist/composables/use-notification.d.ts +89 -0
- package/dist/composables/use-permissions.d.ts +109 -0
- package/dist/composables/use-resize-observer.d.ts +60 -0
- package/dist/composables/use-share.d.ts +70 -0
- package/dist/composables/use-speech.d.ts +117 -0
- package/dist/composables/use-storage.d.ts +64 -0
- package/dist/composables/use-text-selection.d.ts +97 -0
- package/dist/composables/use-wake-lock.d.ts +85 -0
- package/dist/composables/use-websocket.d.ts +69 -0
- package/dist/composables/use-window.d.ts +84 -0
- package/dist/composables.d.ts +268 -0
- package/dist/composition-api.d.ts +190 -0
- package/dist/computed.d.ts +137 -0
- package/dist/conditionals.d.ts +14 -2
- package/dist/config.d.ts +36 -3
- package/dist/craft-bridge.d.ts +319 -0
- package/dist/craft-compiler.d.ts +229 -0
- package/dist/craft-components.d.ts +411 -0
- package/dist/craft-entry.d.ts +5 -0
- package/dist/craft-ssr.d.ts +134 -0
- package/dist/craft.js +1553 -0
- package/dist/csp.d.ts +229 -0
- package/dist/database.d.ts +407 -0
- package/dist/database.js +5 -0
- package/dist/defer.d.ts +4 -0
- package/dist/deploy/config-generators.d.ts +75 -0
- package/dist/deploy/index.d.ts +84 -0
- package/dist/deploy/netlify.d.ts +109 -0
- package/dist/dev-server/crosswind.d.ts +54 -0
- package/dist/dev-server/index.d.ts +7 -0
- package/dist/dev-server/keyboard-shortcuts.d.ts +34 -0
- package/dist/dev-server/native-window.d.ts +40 -0
- package/dist/dev-server/port-utils.d.ts +27 -0
- package/dist/dev-server/terminal-colors.d.ts +60 -0
- package/dist/dev-server/theme-selector.d.ts +32 -0
- package/dist/dev-server/types.d.ts +92 -0
- package/dist/dev-server.d.ts +21 -0
- package/dist/devtools.d.ts +142 -0
- package/dist/directive-api.d.ts +111 -0
- package/dist/dynamic-components.d.ts +14 -0
- package/dist/edge-runtime.d.ts +200 -0
- package/dist/env.d.ts +9 -0
- package/dist/error-boundaries.d.ts +71 -0
- package/dist/error-handling.d.ts +1 -101
- package/dist/errors/codes.d.ts +99 -0
- package/dist/errors/formatter.d.ts +64 -0
- package/dist/errors/index.d.ts +56 -0
- package/dist/errors/logger.d.ts +74 -0
- package/dist/errors/sanitizer.d.ts +43 -0
- package/dist/errors/types.d.ts +79 -0
- package/dist/events.d.ts +106 -0
- package/dist/expressions.d.ts +86 -11
- package/dist/formatter.d.ts +4 -0
- package/dist/forms-validation.d.ts +173 -0
- package/dist/forms.d.ts +157 -8
- package/dist/head.d.ts +225 -0
- package/dist/heatmap.d.ts +125 -0
- package/dist/hot-reload.d.ts +87 -0
- package/dist/hydration-runtime.d.ts +47 -0
- package/dist/hydration.d.ts +161 -0
- package/dist/i18n.d.ts +240 -4
- package/dist/image-optimization/build-plugin.d.ts +53 -0
- package/dist/image-optimization/component.d.ts +46 -0
- package/dist/image-optimization/directive.d.ts +30 -0
- package/dist/image-optimization/index.d.ts +86 -0
- package/dist/image-optimization/processor.d.ts +112 -0
- package/dist/includes.d.ts +94 -9
- package/dist/index.d.ts +63 -3
- package/dist/index.js +11604 -1318
- package/dist/init.d.ts +32 -2
- package/dist/interactive.d.ts +14 -0
- package/dist/internal-markdown.d.ts +22 -0
- package/dist/jsx-runtime.d.ts +110 -0
- package/dist/keep-alive.d.ts +87 -0
- package/dist/lazy-loader.d.ts +122 -0
- package/dist/loading-indicator.d.ts +40 -0
- package/dist/loops.d.ts +22 -1
- package/dist/media/client/blur-up.d.ts +65 -0
- package/dist/media/client/index.d.ts +77 -0
- package/dist/media/client/lazy-load.d.ts +73 -0
- package/dist/media/client/upload-handler.d.ts +79 -0
- package/dist/media/image/component.d.ts +46 -0
- package/dist/media/image/directive.d.ts +9 -0
- package/dist/media/image/editing.d.ts +212 -0
- package/dist/media/image/index.d.ts +118 -0
- package/dist/media/image/placeholder.d.ts +78 -0
- package/dist/media/image/processor/cache.d.ts +32 -0
- package/dist/media/image/processor/index.d.ts +12 -0
- package/dist/media/image/processor/optimizer.d.ts +13 -0
- package/dist/media/image/processor/responsive.d.ts +17 -0
- package/dist/media/image/srcset.d.ts +158 -0
- package/dist/media/index.d.ts +295 -0
- package/dist/media/manager/embed.d.ts +25 -0
- package/dist/media/protected/component.d.ts +34 -0
- package/dist/media/protected/index.d.ts +34 -0
- package/dist/media/protected/signature.d.ts +72 -0
- package/dist/media/shared/cache.d.ts +54 -0
- package/dist/media/shared/hash.d.ts +24 -0
- package/dist/media/shared/index.d.ts +2 -0
- package/dist/media/types.d.ts +1051 -0
- package/dist/media/upload/component.d.ts +23 -0
- package/dist/media/upload/index.d.ts +1 -0
- package/dist/media/video/directive.d.ts +9 -0
- package/dist/media/video/index.d.ts +47 -0
- package/dist/media/video/processor/cache.d.ts +33 -0
- package/dist/media/video/processor/index.d.ts +21 -0
- package/dist/media/video/processor/streaming.d.ts +19 -0
- package/dist/media/video/processor/thumbnail.d.ts +28 -0
- package/dist/media/video/processor/transcoder.d.ts +9 -0
- package/dist/middleware.d.ts +42 -3
- package/dist/native-build.d.ts +74 -0
- package/dist/parser/directive-parser.d.ts +79 -0
- package/dist/parser/expression-parser.d.ts +59 -0
- package/dist/parser/index.d.ts +35 -0
- package/dist/parser/tokenizer.d.ts +81 -0
- package/dist/partial-hydration.d.ts +88 -0
- package/dist/performance-utils.d.ts +146 -3
- package/dist/plugin-system.d.ts +128 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/precompiler.d.ts +108 -0
- package/dist/production-build.d.ts +199 -0
- package/dist/props.d.ts +199 -0
- package/dist/pwa/audit.d.ts +42 -0
- package/dist/pwa/directives.d.ts +29 -0
- package/dist/pwa/icons.d.ts +39 -0
- package/dist/pwa/index.d.ts +59 -0
- package/dist/pwa/inject.d.ts +22 -0
- package/dist/pwa/manifest.d.ts +104 -0
- package/dist/pwa/offline.d.ts +8 -0
- package/dist/pwa/precache.d.ts +29 -0
- package/dist/pwa/service-worker.d.ts +21 -0
- package/dist/pwa/workbox-strategies.d.ts +100 -0
- package/dist/pwa/workbox.d.ts +52 -0
- package/dist/pwa.d.ts +51 -0
- package/dist/pwa.js +8124 -0
- package/dist/reactive-bindings.d.ts +24 -0
- package/dist/reactive.d.ts +100 -0
- package/dist/reactivity.d.ts +253 -0
- package/dist/route-middleware.d.ts +232 -0
- package/dist/router.d.ts +31 -0
- package/dist/routes.d.ts +0 -7
- package/dist/runtime.d.ts +140 -0
- package/dist/safe-evaluator.d.ts +117 -3
- package/dist/scaffolding.d.ts +113 -0
- package/dist/seo.d.ts +120 -7
- package/dist/server-components.d.ts +134 -0
- package/dist/signals.d.ts +501 -0
- package/dist/slots.d.ts +63 -0
- package/dist/source-maps.d.ts +117 -0
- package/dist/ssg.d.ts +157 -0
- package/dist/ssg.js +6831 -0
- package/dist/ssr.d.ts +107 -0
- package/dist/state-management.d.ts +324 -0
- package/dist/stores-client.d.ts +70 -0
- package/dist/story/addons.d.ts +123 -0
- package/dist/story/analytics.d.ts +92 -0
- package/dist/story/auto-stories.d.ts +38 -0
- package/dist/story/bookmarks.d.ts +53 -0
- package/dist/story/bun-test.d.ts +44 -0
- package/dist/story/cli.d.ts +34 -0
- package/dist/story/collect/analyzer.d.ts +33 -0
- package/dist/story/collect/index.d.ts +27 -0
- package/dist/story/collect/parser.d.ts +17 -0
- package/dist/story/collect/scanner.d.ts +13 -0
- package/dist/story/collect/tree.d.ts +17 -0
- package/dist/story/commands/build.d.ts +14 -0
- package/dist/story/commands/dev.d.ts +16 -0
- package/dist/story/commands/index.d.ts +6 -0
- package/dist/story/commands/preview.d.ts +15 -0
- package/dist/story/compiled-output.d.ts +26 -0
- package/dist/story/composition.d.ts +47 -0
- package/dist/story/config-watcher.d.ts +26 -0
- package/dist/story/config.d.ts +26 -0
- package/dist/story/context.d.ts +21 -0
- package/dist/story/controls/index.d.ts +54 -0
- package/dist/story/crosswind.d.ts +29 -0
- package/dist/story/desktop-preview.d.ts +34 -0
- package/dist/story/docs-generator.d.ts +30 -0
- package/dist/story/errors.d.ts +47 -0
- package/dist/story/figma-export.d.ts +169 -0
- package/dist/story/generator.d.ts +21 -0
- package/dist/story/hmr.d.ts +64 -0
- package/dist/story/hot-swap.d.ts +35 -0
- package/dist/story/index.d.ts +51 -0
- package/dist/story/interactions.d.ts +52 -0
- package/dist/story/keyboard-shortcuts.d.ts +34 -0
- package/dist/story/output.d.ts +85 -0
- package/dist/story/performance.d.ts +76 -0
- package/dist/story/presets.d.ts +62 -0
- package/dist/story/props-validation.d.ts +45 -0
- package/dist/story/renderer.d.ts +53 -0
- package/dist/story/search-index.d.ts +47 -0
- package/dist/story/search.d.ts +45 -0
- package/dist/story/server.d.ts +21 -0
- package/dist/story/setup.d.ts +47 -0
- package/dist/story/snapshots.d.ts +65 -0
- package/dist/story/testing.d.ts +58 -0
- package/dist/story/theme.d.ts +68 -0
- package/dist/story/types.d.ts +249 -0
- package/dist/story/ui/code-panel.d.ts +42 -0
- package/dist/story/ui/controls-panel.d.ts +25 -0
- package/dist/story/ui/index.d.ts +4 -0
- package/dist/story/ui/navigation.d.ts +55 -0
- package/dist/story/ui/preview.d.ts +46 -0
- package/dist/story/visual-testing.d.ts +45 -0
- package/dist/streaming.d.ts +82 -2
- package/dist/suspense.d.ts +83 -0
- package/dist/teleport.d.ts +9 -0
- package/dist/testing.d.ts +289 -0
- package/dist/transitions.d.ts +87 -0
- package/dist/type-checker.d.ts +109 -0
- package/dist/types/component-types.d.ts +129 -0
- package/dist/types/config-types.d.ts +336 -0
- package/dist/types/context-types.d.ts +99 -0
- package/dist/types/csp-types.d.ts +79 -0
- package/dist/types/directive-types.d.ts +259 -0
- package/dist/types/index.d.ts +98 -0
- package/dist/types/pwa-types.d.ts +218 -0
- package/dist/types.d.ts +1 -315
- package/dist/typescript-templates.d.ts +178 -0
- package/dist/utils.d.ts +52 -6
- package/dist/validator.d.ts +77 -0
- package/dist/variable-extractor.d.ts +39 -0
- package/dist/view-composers.d.ts +154 -9
- package/dist/virtual-scrolling.d.ts +103 -0
- package/dist/visual-editor.d.ts +209 -0
- package/dist/visual-testing.d.ts +109 -0
- package/dist/visual-testing.js +126 -0
- package/dist/vue-template.d.ts +16 -0
- package/dist/web-components/css-scoping.d.ts +54 -0
- package/dist/web-components/index.d.ts +20 -0
- package/dist/web-components/reactive-generator.d.ts +72 -0
- package/dist/web-components.d.ts +222 -2
- package/dist/x-element.d.ts +35 -0
- package/package.json +41 -10
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set the locale for error messages
|
|
3
|
+
*/
|
|
4
|
+
export declare function setErrorLocale(locale: string): void;
|
|
5
|
+
/**
|
|
6
|
+
* Get the current error message locale
|
|
7
|
+
*/
|
|
8
|
+
export declare function getErrorLocale(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Register custom error messages for a locale
|
|
11
|
+
* This allows overriding default messages or adding translations
|
|
12
|
+
*/
|
|
13
|
+
export declare function registerErrorMessages(messages: ErrorMessages): void;
|
|
14
|
+
/**
|
|
15
|
+
* Clear custom error messages
|
|
16
|
+
*/
|
|
17
|
+
export declare function clearErrorMessages(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Get an error message by code, with placeholder substitution
|
|
20
|
+
*/
|
|
21
|
+
export declare function getErrorMessage(code: number, params?: Record<string, string>): ErrorMessageTemplate;
|
|
22
|
+
/**
|
|
23
|
+
* Format an error with localized message
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatLocalizedError(code: number, params?: Record<string, string>): string;
|
|
26
|
+
/**
|
|
27
|
+
* Get error code name from numeric code
|
|
28
|
+
*/
|
|
29
|
+
export declare function getErrorCodeName(code: number): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Numeric error codes for programmatic error handling
|
|
32
|
+
*
|
|
33
|
+
* Error code ranges:
|
|
34
|
+
* - 1000-1099: Syntax errors
|
|
35
|
+
* - 1100-1199: Runtime errors
|
|
36
|
+
* - 1200-1299: Security errors
|
|
37
|
+
* - 1300-1399: File errors
|
|
38
|
+
* - 1400-1499: Configuration errors
|
|
39
|
+
* - 1500-1599: Component errors
|
|
40
|
+
* - 1600-1699: Expression errors
|
|
41
|
+
*/
|
|
42
|
+
export declare const ErrorCodes: {
|
|
43
|
+
// Syntax errors (1000-1099)
|
|
44
|
+
UNCLOSED_DIRECTIVE: 1001;
|
|
45
|
+
UNCLOSED_EXPRESSION: 1002;
|
|
46
|
+
INVALID_DIRECTIVE_SYNTAX: 1003;
|
|
47
|
+
MALFORMED_EXPRESSION: 1004;
|
|
48
|
+
UNEXPECTED_TOKEN: 1005;
|
|
49
|
+
// Runtime errors (1100-1199)
|
|
50
|
+
UNDEFINED_VARIABLE: 1101;
|
|
51
|
+
TYPE_ERROR: 1102;
|
|
52
|
+
EVALUATION_ERROR: 1103;
|
|
53
|
+
INFINITE_LOOP: 1104;
|
|
54
|
+
CIRCULAR_REFERENCE: 1105;
|
|
55
|
+
// Security errors (1200-1299)
|
|
56
|
+
UNSAFE_EXPRESSION: 1201;
|
|
57
|
+
PATH_TRAVERSAL: 1202;
|
|
58
|
+
XSS_ATTEMPT: 1203;
|
|
59
|
+
CODE_INJECTION: 1204;
|
|
60
|
+
DOM_API_VIOLATION: 1205;
|
|
61
|
+
// File errors (1300-1399)
|
|
62
|
+
FILE_NOT_FOUND: 1301;
|
|
63
|
+
FILE_READ_ERROR: 1302;
|
|
64
|
+
INVALID_FILE_PATH: 1303;
|
|
65
|
+
PERMISSION_DENIED: 1304;
|
|
66
|
+
// Configuration errors (1400-1499)
|
|
67
|
+
INVALID_CONFIG: 1401;
|
|
68
|
+
MISSING_REQUIRED_CONFIG: 1402;
|
|
69
|
+
DEPRECATED_CONFIG: 1403;
|
|
70
|
+
// Component errors (1500-1599)
|
|
71
|
+
COMPONENT_NOT_FOUND: 1501;
|
|
72
|
+
INVALID_PROPS: 1502;
|
|
73
|
+
COMPONENT_RENDER_ERROR: 1503;
|
|
74
|
+
// Expression errors (1600-1699)
|
|
75
|
+
FILTER_NOT_FOUND: 1601;
|
|
76
|
+
INVALID_FILTER_ARGS: 1602;
|
|
77
|
+
EXPRESSION_TIMEOUT: 1603
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Error Codes and Localized Messages
|
|
81
|
+
*
|
|
82
|
+
* Provides numeric error codes for programmatic error handling
|
|
83
|
+
* and localized error message templates.
|
|
84
|
+
*
|
|
85
|
+
* @module errors/codes
|
|
86
|
+
*/
|
|
87
|
+
/**
|
|
88
|
+
* Error message template with placeholder support
|
|
89
|
+
* Placeholders use {{name}} syntax
|
|
90
|
+
*/
|
|
91
|
+
export declare interface ErrorMessageTemplate {
|
|
92
|
+
message: string
|
|
93
|
+
help?: string
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Localized error messages by error code
|
|
97
|
+
*/
|
|
98
|
+
export type ErrorMessages = Record<number, ErrorMessageTemplate>
|
|
99
|
+
export type ErrorCode = typeof ErrorCodes[keyof typeof ErrorCodes]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ErrorCode } from './codes';
|
|
2
|
+
import type { ErrorContext } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Create a standardized error message in any format
|
|
5
|
+
*/
|
|
6
|
+
export declare function formatError(options: ErrorMessageOptions): StandardizedError;
|
|
7
|
+
/**
|
|
8
|
+
* Quick helper for creating inline error messages (for template output)
|
|
9
|
+
*/
|
|
10
|
+
export declare function inlineError(type: string, message: string, code?: ErrorCode): string;
|
|
11
|
+
/**
|
|
12
|
+
* Quick helper for creating console error messages
|
|
13
|
+
*/
|
|
14
|
+
export declare function consoleError(type: string, message: string, filePath?: string, line?: number, code?: ErrorCode): string;
|
|
15
|
+
/**
|
|
16
|
+
* Enhanced error reporting with better context
|
|
17
|
+
*/
|
|
18
|
+
export declare function createEnhancedError(type: string, message: string, context: ErrorContext): string;
|
|
19
|
+
/**
|
|
20
|
+
* Safe wrapper for potentially dangerous operations
|
|
21
|
+
*/
|
|
22
|
+
export declare function safeExecute<T>(operation: () => T, fallback: T, errorHandler?: (error: Error) => void): T;
|
|
23
|
+
/**
|
|
24
|
+
* Async version of safe wrapper
|
|
25
|
+
*/
|
|
26
|
+
export declare function safeExecuteAsync<T>(operation: () => Promise<T>, fallback: T, errorHandler?: (error: Error) => void): Promise<T>;
|
|
27
|
+
/**
|
|
28
|
+
* Standardized error message options
|
|
29
|
+
*/
|
|
30
|
+
export declare interface ErrorMessageOptions {
|
|
31
|
+
type: string
|
|
32
|
+
message: string
|
|
33
|
+
code?: ErrorCode
|
|
34
|
+
filePath?: string
|
|
35
|
+
line?: number
|
|
36
|
+
column?: number
|
|
37
|
+
template?: string
|
|
38
|
+
offset?: number
|
|
39
|
+
snippet?: string
|
|
40
|
+
suggestion?: string
|
|
41
|
+
format?: ErrorOutputFormat
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Standardized error message result
|
|
45
|
+
*/
|
|
46
|
+
export declare interface StandardizedError {
|
|
47
|
+
formatted: string
|
|
48
|
+
data: {
|
|
49
|
+
type: string
|
|
50
|
+
code: number | undefined
|
|
51
|
+
codeName: string | undefined
|
|
52
|
+
message: string
|
|
53
|
+
filePath: string | undefined
|
|
54
|
+
line: number | undefined
|
|
55
|
+
column: number | undefined
|
|
56
|
+
snippet: string | undefined
|
|
57
|
+
suggestion: string | undefined
|
|
58
|
+
timestamp: string
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Error output format options
|
|
63
|
+
*/
|
|
64
|
+
export type ErrorOutputFormat = 'html' | 'text' | 'json' | 'console'
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export {
|
|
2
|
+
clearErrorMessages,
|
|
3
|
+
type ErrorCode,
|
|
4
|
+
ErrorCodes,
|
|
5
|
+
type ErrorMessages,
|
|
6
|
+
type ErrorMessageTemplate,
|
|
7
|
+
formatLocalizedError,
|
|
8
|
+
getErrorCodeName,
|
|
9
|
+
getErrorLocale,
|
|
10
|
+
getErrorMessage,
|
|
11
|
+
registerErrorMessages,
|
|
12
|
+
setErrorLocale,
|
|
13
|
+
} from './codes';
|
|
14
|
+
export {
|
|
15
|
+
consoleError,
|
|
16
|
+
createEnhancedError,
|
|
17
|
+
type ErrorMessageOptions,
|
|
18
|
+
type ErrorOutputFormat,
|
|
19
|
+
formatError,
|
|
20
|
+
inlineError,
|
|
21
|
+
safeExecute,
|
|
22
|
+
safeExecuteAsync,
|
|
23
|
+
type StandardizedError,
|
|
24
|
+
} from './formatter';
|
|
25
|
+
export {
|
|
26
|
+
devHelpers,
|
|
27
|
+
type ErrorLogEntry,
|
|
28
|
+
ErrorLogger,
|
|
29
|
+
errorLogger,
|
|
30
|
+
type ErrorLoggerOptions,
|
|
31
|
+
errorRecovery,
|
|
32
|
+
} from './logger';
|
|
33
|
+
export {
|
|
34
|
+
sanitizeComponentProps,
|
|
35
|
+
sanitizeDirectiveParam,
|
|
36
|
+
sanitizeDirectiveParams,
|
|
37
|
+
type SanitizedParam,
|
|
38
|
+
sanitizeExpression,
|
|
39
|
+
sanitizeFilePath,
|
|
40
|
+
type SanitizeOptions,
|
|
41
|
+
validators,
|
|
42
|
+
} from './sanitizer';
|
|
43
|
+
export {
|
|
44
|
+
configureErrorHandling,
|
|
45
|
+
type ErrorConfig,
|
|
46
|
+
type ErrorContext,
|
|
47
|
+
formatFilePath,
|
|
48
|
+
getErrorConfig,
|
|
49
|
+
resetErrorConfig,
|
|
50
|
+
StxError,
|
|
51
|
+
StxFileError,
|
|
52
|
+
StxRuntimeError,
|
|
53
|
+
StxSecurityError,
|
|
54
|
+
StxSyntaxError,
|
|
55
|
+
StxValidationError,
|
|
56
|
+
} from './types';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { isDevelopment } from '../env';
|
|
2
|
+
export declare const errorRecovery: ErrorRecovery;
|
|
3
|
+
// Global error logger instance
|
|
4
|
+
export declare const errorLogger: ErrorLogger;
|
|
5
|
+
export declare const devHelpers: DevHelpers;
|
|
6
|
+
/**
|
|
7
|
+
* Error recovery strategies
|
|
8
|
+
*
|
|
9
|
+
* NOTE: Auto-recovery is opt-in via configuration.
|
|
10
|
+
* Use configureErrorHandling({ enableAutoRecovery: true }) to enable.
|
|
11
|
+
*/
|
|
12
|
+
export declare interface ErrorRecovery {
|
|
13
|
+
isEnabled(): boolean
|
|
14
|
+
fixCommonSyntaxErrors(template: string): { fixed: string, fixes: string[] }
|
|
15
|
+
createFallbackContent(sectionType: string, error: Error): string
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Error logger configuration options
|
|
19
|
+
*/
|
|
20
|
+
export declare interface ErrorLoggerOptions {
|
|
21
|
+
maxErrors?: number
|
|
22
|
+
enableFileLogging?: boolean
|
|
23
|
+
logFilePath?: string
|
|
24
|
+
logFormat?: 'json' | 'text'
|
|
25
|
+
maxFileSize?: number
|
|
26
|
+
maxLogFiles?: number
|
|
27
|
+
minLevel?: 'all' | 'error' | 'warning'
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Error log entry structure
|
|
31
|
+
*/
|
|
32
|
+
export declare interface ErrorLogEntry {
|
|
33
|
+
timestamp: Date
|
|
34
|
+
error: Error
|
|
35
|
+
context?: unknown
|
|
36
|
+
level?: 'error' | 'warning' | 'info'
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Development mode helpers
|
|
40
|
+
*/
|
|
41
|
+
export declare interface DevHelpers {
|
|
42
|
+
isDevelopment(): boolean
|
|
43
|
+
logDetailedError(error: Error, context?: unknown): void
|
|
44
|
+
createErrorReport(error: Error, context?: unknown): string
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Error logging and monitoring with optional file persistence
|
|
48
|
+
*/
|
|
49
|
+
export declare class ErrorLogger {
|
|
50
|
+
private errors: ErrorLogEntry[];
|
|
51
|
+
private maxErrors: number;
|
|
52
|
+
private enableFileLogging: boolean;
|
|
53
|
+
private logFilePath: string;
|
|
54
|
+
private logFormat: 'json' | 'text';
|
|
55
|
+
private maxFileSize: number;
|
|
56
|
+
private maxLogFiles: number;
|
|
57
|
+
private minLevel: 'all' | 'error' | 'warning';
|
|
58
|
+
private writeQueue: Promise<void>;
|
|
59
|
+
constructor(options?: ErrorLoggerOptions);
|
|
60
|
+
configure(options: ErrorLoggerOptions): void;
|
|
61
|
+
log(error: Error, context?: unknown, level?: 'error' | 'warning' | 'info'): void;
|
|
62
|
+
private shouldLog(level: 'error' | 'warning' | 'info'): boolean;
|
|
63
|
+
private formatEntry(entry: ErrorLogEntry): string;
|
|
64
|
+
private writeToFile(entry: ErrorLogEntry): void;
|
|
65
|
+
private rotateIfNeeded(fs: typeof import('node:fs')): Promise<void>;
|
|
66
|
+
getRecentErrors(limit?: any): ErrorLogEntry[];
|
|
67
|
+
getErrorsByType(errorType: string): ErrorLogEntry[];
|
|
68
|
+
getErrorsByLevel(level: 'error' | 'warning' | 'info'): ErrorLogEntry[];
|
|
69
|
+
clear(): void;
|
|
70
|
+
clearLogFile(): Promise<void>;
|
|
71
|
+
getStats(): { total: number, byType: Record<string, number>, byLevel: Record<string, number> };
|
|
72
|
+
exportToFile(filePath: string, format?: 'json' | 'text'): Promise<void>;
|
|
73
|
+
flush(): Promise<void>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sanitize a directive parameter value
|
|
3
|
+
*/
|
|
4
|
+
export declare function sanitizeDirectiveParam(param: string, options?: SanitizeOptions): SanitizedParam;
|
|
5
|
+
/**
|
|
6
|
+
* Sanitize a file path parameter
|
|
7
|
+
*/
|
|
8
|
+
export declare function sanitizeFilePath(filePath: string, baseDir?: string): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Sanitize an expression parameter (used in @if, @foreach, etc.)
|
|
11
|
+
*/
|
|
12
|
+
export declare function sanitizeExpression(expr: string): SanitizedParam;
|
|
13
|
+
/**
|
|
14
|
+
* Sanitize multiple directive parameters at once
|
|
15
|
+
*/
|
|
16
|
+
export declare function sanitizeDirectiveParams(params: string[], options?: SanitizeOptions): SanitizedParam[];
|
|
17
|
+
/**
|
|
18
|
+
* Validate and sanitize component props
|
|
19
|
+
*/
|
|
20
|
+
export declare function sanitizeComponentProps(props: Record<string, unknown>): Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Validation utilities
|
|
23
|
+
*/
|
|
24
|
+
export declare const validators: {
|
|
25
|
+
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Options for parameter sanitization
|
|
29
|
+
*/
|
|
30
|
+
export declare interface SanitizeOptions {
|
|
31
|
+
allowHtml?: boolean
|
|
32
|
+
maxLength?: number
|
|
33
|
+
allowSpecialChars?: boolean
|
|
34
|
+
customSanitizer?: (value: string) => string
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Result of parameter sanitization
|
|
38
|
+
*/
|
|
39
|
+
export declare interface SanitizedParam {
|
|
40
|
+
value: string
|
|
41
|
+
modified: boolean
|
|
42
|
+
warnings: string[]
|
|
43
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { ErrorCode } from './codes';
|
|
2
|
+
/**
|
|
3
|
+
* Configure error handling behavior
|
|
4
|
+
*/
|
|
5
|
+
export declare function configureErrorHandling(config: Partial<ErrorConfig>): void;
|
|
6
|
+
/**
|
|
7
|
+
* Get current error configuration
|
|
8
|
+
*/
|
|
9
|
+
export declare function getErrorConfig(): ErrorConfig;
|
|
10
|
+
/**
|
|
11
|
+
* Reset error configuration to defaults
|
|
12
|
+
*/
|
|
13
|
+
export declare function resetErrorConfig(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Format file path based on configuration
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatFilePath(filePath: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Error handling configuration
|
|
20
|
+
*/
|
|
21
|
+
export declare interface ErrorConfig {
|
|
22
|
+
showRelativePaths: boolean
|
|
23
|
+
baseDir?: string
|
|
24
|
+
enableAutoRecovery: boolean
|
|
25
|
+
logRecoveryWarnings: boolean
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Error context information
|
|
29
|
+
*/
|
|
30
|
+
export declare interface ErrorContext {
|
|
31
|
+
filePath: string
|
|
32
|
+
template: string
|
|
33
|
+
offset: number
|
|
34
|
+
match: string
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Base STX error class
|
|
38
|
+
*/
|
|
39
|
+
export declare class StxError extends Error {
|
|
40
|
+
numericCode: ErrorCode;
|
|
41
|
+
public code: string;
|
|
42
|
+
public filePath?: string;
|
|
43
|
+
public line?: number;
|
|
44
|
+
public column?: number;
|
|
45
|
+
public context?: string;
|
|
46
|
+
constructor(message: string, code: string, filePath?: string, line?: number, column?: number, context?: string, numericCode?: ErrorCode);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Syntax error in template
|
|
50
|
+
*/
|
|
51
|
+
export declare class StxSyntaxError extends StxError {
|
|
52
|
+
constructor(message: string, filePath?: string, line?: number, column?: number, context?: string, numericCode?: ErrorCode);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Runtime error during template processing
|
|
56
|
+
*/
|
|
57
|
+
export declare class StxRuntimeError extends StxError {
|
|
58
|
+
constructor(message: string, filePath?: string, line?: number, column?: number, context?: string, numericCode?: ErrorCode);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Security-related error
|
|
62
|
+
*/
|
|
63
|
+
export declare class StxSecurityError extends StxError {
|
|
64
|
+
constructor(message: string, filePath?: string, line?: number, column?: number, context?: string, numericCode?: ErrorCode);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* File operation error
|
|
68
|
+
*/
|
|
69
|
+
export declare class StxFileError extends StxError {
|
|
70
|
+
constructor(message: string, filePath?: string, line?: number, column?: number, context?: string, numericCode?: ErrorCode);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validation error - these are ALWAYS fatal and cannot be recovered from.
|
|
74
|
+
* Used for enforcing coding standards like prohibited DOM API usage.
|
|
75
|
+
*/
|
|
76
|
+
export declare class StxValidationError extends StxError {
|
|
77
|
+
readonly isFatal: boolean;
|
|
78
|
+
constructor(message: string, filePath?: string, line?: number, column?: number, context?: string, numericCode?: ErrorCode);
|
|
79
|
+
}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract and process event attributes from a template without generating
|
|
3
|
+
* a standalone script. Returns the modified template (with @event attributes
|
|
4
|
+
* removed and IDs added) and the collected event bindings as data.
|
|
5
|
+
*
|
|
6
|
+
* Used by SFC processing to inject event bindings into the component's
|
|
7
|
+
* <script client> scope instead of a separate script block.
|
|
8
|
+
*
|
|
9
|
+
* @param template - The HTML template string
|
|
10
|
+
* @returns Object with processed template and collected bindings
|
|
11
|
+
*/
|
|
12
|
+
export declare function extractAndProcessEvents(template: string): {
|
|
13
|
+
template: string
|
|
14
|
+
bindings: ParsedEvent[]
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Process event directives in a template.
|
|
18
|
+
*
|
|
19
|
+
* Transforms `@click`, `@keydown.enter`, etc. attributes into
|
|
20
|
+
* client-side event listeners.
|
|
21
|
+
*
|
|
22
|
+
* In SFC mode (context.__stx_sfc_mode), event bindings are collected
|
|
23
|
+
* on context.__stx_event_bindings instead of generating a standalone script.
|
|
24
|
+
* This allows them to be injected into the component's <script client> scope.
|
|
25
|
+
*
|
|
26
|
+
* @param template - The HTML template string
|
|
27
|
+
* @param context - Template context
|
|
28
|
+
* @param filePath - Source file path for error messages
|
|
29
|
+
* @returns Processed template with event binding script (or just template in SFC mode)
|
|
30
|
+
*/
|
|
31
|
+
export declare function processEventDirectives(template: string, context: Record<string, unknown>, _filePath: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Check if a template contains event directives
|
|
34
|
+
*/
|
|
35
|
+
export declare function hasEventDirectives(template: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Event Directives Module
|
|
38
|
+
*
|
|
39
|
+
* Provides Alpine.js-style event handling for STX templates.
|
|
40
|
+
* Transforms `@click`, `@keydown.enter`, etc. into client-side event listeners.
|
|
41
|
+
*
|
|
42
|
+
* ## Supported Syntax
|
|
43
|
+
*
|
|
44
|
+
* ### Basic Events
|
|
45
|
+
* ```html
|
|
46
|
+
* <button @click="count++">Increment</button>
|
|
47
|
+
* <button @click="handleClick()">Click me</button>
|
|
48
|
+
* <form @submit="handleSubmit()">...</form>
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* ### Event Modifiers
|
|
52
|
+
* ```html
|
|
53
|
+
* <form @submit.prevent="handleSubmit()">...</form>
|
|
54
|
+
* <a @click.prevent.stop="navigate()">Link</a>
|
|
55
|
+
* <button @click.once="initialize()">Init</button>
|
|
56
|
+
* <div @click.self="onlyThis()">...</div>
|
|
57
|
+
* <input @keydown.capture="log()">
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* ### Key Modifiers
|
|
61
|
+
* ```html
|
|
62
|
+
* <input @keydown.enter="submit()">
|
|
63
|
+
* <input @keyup.escape="cancel()">
|
|
64
|
+
* <input @keydown.space="toggle()">
|
|
65
|
+
* <input @keydown.ctrl.s="save()">
|
|
66
|
+
* <input @keydown.meta.enter="send()">
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* ### Mouse Modifiers
|
|
70
|
+
* ```html
|
|
71
|
+
* <div @click.left="handleLeft()">
|
|
72
|
+
* <div @click.right="handleRight()">
|
|
73
|
+
* <div @click.middle="handleMiddle()">
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* ### Special Variables
|
|
77
|
+
* ```html
|
|
78
|
+
* <input @input="value = $event.target.value">
|
|
79
|
+
* <button @click="handleClick($el)">Uses element</button>
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @module events
|
|
83
|
+
*/
|
|
84
|
+
// =============================================================================
|
|
85
|
+
// Types
|
|
86
|
+
// =============================================================================
|
|
87
|
+
export declare interface ParsedEvent {
|
|
88
|
+
attribute: string
|
|
89
|
+
event: string
|
|
90
|
+
handler: string
|
|
91
|
+
modifiers: EventModifiers
|
|
92
|
+
elementId: string
|
|
93
|
+
}
|
|
94
|
+
export declare interface EventModifiers {
|
|
95
|
+
prevent: boolean
|
|
96
|
+
stop: boolean
|
|
97
|
+
once: boolean
|
|
98
|
+
capture: boolean
|
|
99
|
+
self: boolean
|
|
100
|
+
passive: boolean
|
|
101
|
+
keys: string[]
|
|
102
|
+
systemKeys: string[]
|
|
103
|
+
mouse: string | null
|
|
104
|
+
debounce: number | null
|
|
105
|
+
throttle: number | null
|
|
106
|
+
}
|
package/dist/expressions.d.ts
CHANGED
|
@@ -1,7 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Register a custom filter
|
|
3
|
+
*
|
|
4
|
+
* @param name - Filter name (used in templates as {{ value | filterName }})
|
|
5
|
+
* @param fn - Filter function
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Register a custom filter
|
|
10
|
+
* registerFilter('reverse', (value) => {
|
|
11
|
+
* return String(value).split('').reverse().join('')
|
|
12
|
+
* })
|
|
13
|
+
*
|
|
14
|
+
* // Use in template: {{ name | reverse }}
|
|
15
|
+
* ```
|
|
3
16
|
*/
|
|
4
|
-
export declare function
|
|
17
|
+
export declare function registerFilter(name: string, fn: FilterFunction): void;
|
|
18
|
+
/**
|
|
19
|
+
* Register multiple custom filters at once
|
|
20
|
+
*
|
|
21
|
+
* @param filters - Object mapping filter names to functions
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* registerFilters({
|
|
26
|
+
* reverse: (value) => String(value).split('').reverse().join(''),
|
|
27
|
+
* double: (value) => Number(value) * 2,
|
|
28
|
+
* })
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function registerFilters(filters: Record<string, FilterFunction>): void;
|
|
32
|
+
/**
|
|
33
|
+
* Get all available filters (built-in + custom)
|
|
34
|
+
*/
|
|
35
|
+
export declare function getAllFilters(): Record<string, FilterFunction>;
|
|
36
|
+
/**
|
|
37
|
+
* Clear all custom filters (useful for testing)
|
|
38
|
+
*/
|
|
39
|
+
export declare function clearCustomFilters(): void;
|
|
5
40
|
/**
|
|
6
41
|
* HTML escape function to prevent XSS
|
|
7
42
|
*/
|
|
@@ -26,23 +61,63 @@ export declare function evaluateExpression(expression: string, context: Record<s
|
|
|
26
61
|
* HTML unescape function to reverse escapeHtml
|
|
27
62
|
*/
|
|
28
63
|
export declare function unescapeHtml(html: string): string;
|
|
64
|
+
// =============================================================================
|
|
65
|
+
// Built-in Filters
|
|
66
|
+
// =============================================================================
|
|
29
67
|
export declare const defaultFilters: {
|
|
30
68
|
// String transformation filters
|
|
31
|
-
uppercase: (value: any) => unknown;
|
|
32
|
-
lowercase: (value: any) => unknown;
|
|
33
|
-
capitalize: (value: any) => unknown;
|
|
69
|
+
uppercase: (value: any, _context: Record<string, any>) => unknown;
|
|
70
|
+
lowercase: (value: any, _context: Record<string, any>) => unknown;
|
|
71
|
+
capitalize: (value: any, _context: Record<string, any>) => unknown;
|
|
34
72
|
// Number filters
|
|
35
|
-
number: (value: any, decimals: number?) => unknown;
|
|
73
|
+
number: (value: any, _context: Record<string, any>, decimals: number?) => unknown;
|
|
36
74
|
// Array filters
|
|
37
75
|
join: () => unknown;
|
|
38
76
|
// Safety filters
|
|
39
|
-
escape: (value: any) => unknown;
|
|
40
|
-
// Translation filter
|
|
41
|
-
translate: (value: any, params: Record<string, any> = {}) => unknown;
|
|
77
|
+
escape: (value: any, _context: Record<string, any>) => unknown;
|
|
78
|
+
// Translation filter - uses context parameter instead of global state
|
|
79
|
+
translate: (value: any, context: Record<string, any>, params: Record<string, any> = {}) => unknown;
|
|
42
80
|
// Short alias for translate
|
|
43
|
-
t: (value: any, params: Record<string, any> = {}) => unknown
|
|
81
|
+
t: (value: any, context: Record<string, any>, params: Record<string, any> = {}) => unknown;
|
|
82
|
+
// =========================================================================
|
|
83
|
+
// Additional Utility Filters
|
|
84
|
+
// =========================================================================
|
|
85
|
+
|
|
86
|
+
// Truncate string to specified length with ellipsis
|
|
87
|
+
truncate: (value: any, _context: Record<string, any>, length: number?, suffix: string?) => unknown;
|
|
88
|
+
// Format date using Intl.DateTimeFormat
|
|
89
|
+
date: (value: any, _context: Record<string, any>, format: string?, locale: string?) => unknown;
|
|
90
|
+
// Format number as currency
|
|
91
|
+
currency: (value: any, _context: Record<string, any>, currencyCode: string?, locale: string?) => unknown;
|
|
92
|
+
// Pluralize word based on count
|
|
93
|
+
pluralize: (value: any, _context: Record<string, any>, singular: string, plural?: string) => unknown;
|
|
94
|
+
// Get first item from array or first character from string
|
|
95
|
+
first: (value: any, _context: Record<string, any>) => unknown;
|
|
96
|
+
// Get last item from array or last character from string
|
|
97
|
+
last: (value: any, _context: Record<string, any>) => unknown;
|
|
98
|
+
// Get length of array or string
|
|
99
|
+
length: (value: any, _context: Record<string, any>) => unknown;
|
|
100
|
+
// Convert to JSON string
|
|
101
|
+
json: (value: any, _context: Record<string, any>, pretty: boolean?) => unknown;
|
|
102
|
+
// Default value if null/undefined
|
|
103
|
+
default: (value: any, _context: Record<string, any>, defaultValue: any?) => unknown;
|
|
104
|
+
// Reverse string or array
|
|
105
|
+
reverse: (value: any, _context: Record<string, any>) => unknown;
|
|
106
|
+
// Slice array or string
|
|
107
|
+
slice: (value: any, _context: Record<string, any>, start: number?, end?: number) => unknown;
|
|
108
|
+
// Replace text
|
|
109
|
+
replace: (value: any, _context: Record<string, any>, search: string, replacement: string?) => unknown;
|
|
110
|
+
// Strip HTML tags
|
|
111
|
+
stripTags: (value: any, _context: Record<string, any>) => unknown;
|
|
112
|
+
// URL encode
|
|
113
|
+
urlencode: (value: any, _context: Record<string, any>) => unknown;
|
|
114
|
+
// Absolute value
|
|
115
|
+
abs: (value: any, _context: Record<string, any>) => unknown;
|
|
116
|
+
// Round number
|
|
117
|
+
round: (value: any, _context: Record<string, any>, decimals: number?) => unknown
|
|
44
118
|
};
|
|
45
119
|
/**
|
|
46
120
|
* Add basic filter support to expressions
|
|
121
|
+
* Filter functions receive the value to transform, optional args, and the context object
|
|
47
122
|
*/
|
|
48
|
-
export type FilterFunction = (value: any, ...args: any[]) => any
|
|
123
|
+
export type FilterFunction = (value: any, context: Record<string, any>, ...args: any[]) => any
|
package/dist/formatter.d.ts
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* Format stx file content
|
|
3
3
|
*/
|
|
4
4
|
export declare function formatStxContent(content: string, options?: FormatterOptions): string;
|
|
5
|
+
/**
|
|
6
|
+
* Format markdown file content, processing stx code blocks
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatMarkdownContent(content: string, options?: FormatterOptions): string;
|
|
5
9
|
/**
|
|
6
10
|
* stx file formatter for automatically formatting .stx files
|
|
7
11
|
*/
|