resuxjs 0.2.43 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +991 -666
- package/dist/cli.js +1990 -355
- package/dist/cli.js.map +1 -1
- package/dist/compiler/adapter.d.ts +17 -0
- package/dist/compiler/adapter.js +106 -0
- package/dist/compiler/adapter.js.map +1 -0
- package/dist/compiler/dev-warnings.d.ts +11 -0
- package/dist/compiler/dev-warnings.js +360 -0
- package/dist/compiler/dev-warnings.js.map +1 -0
- package/dist/compiler/directives.d.ts +13 -0
- package/dist/compiler/directives.js +167 -0
- package/dist/compiler/directives.js.map +1 -0
- package/dist/compiler/implementation.d.ts +129 -0
- package/dist/compiler/implementation.js +3745 -0
- package/dist/compiler/implementation.js.map +1 -0
- package/dist/compiler/index.d.ts +9 -103
- package/dist/compiler/index.js +74 -1971
- package/dist/compiler/index.js.map +1 -1
- package/dist/core/config.d.ts +8 -0
- package/dist/core/config.js +21 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/hooks.d.ts +133 -0
- package/dist/core/hooks.js +54 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/module-container.d.ts +100 -0
- package/dist/core/module-container.js +171 -0
- package/dist/core/module-container.js.map +1 -0
- package/dist/core/resux.d.ts +18 -0
- package/dist/core/resux.js +18 -0
- package/dist/core/resux.js.map +1 -0
- package/dist/create.d.ts +1 -0
- package/dist/create.js +878 -22
- package/dist/create.js.map +1 -1
- package/dist/deploy/cloudflare.js +17 -3
- package/dist/deploy/cloudflare.js.map +1 -1
- package/dist/deploy/common.js +4 -3
- package/dist/deploy/common.js.map +1 -1
- package/dist/fonts/index.d.ts +16 -0
- package/dist/fonts/index.js +154 -0
- package/dist/fonts/index.js.map +1 -0
- package/dist/globals.d.ts +27 -2
- package/dist/halal-core/ai/classifyProject.d.ts +4 -0
- package/dist/halal-core/ai/classifyProject.js +104 -0
- package/dist/halal-core/ai/classifyProject.js.map +1 -0
- package/dist/halal-core/ai/createProjectSummary.d.ts +39 -0
- package/dist/halal-core/ai/createProjectSummary.js +42 -0
- package/dist/halal-core/ai/createProjectSummary.js.map +1 -0
- package/dist/halal-core/ai/halalClassifierPrompt.d.ts +1 -0
- package/dist/halal-core/ai/halalClassifierPrompt.js +20 -0
- package/dist/halal-core/ai/halalClassifierPrompt.js.map +1 -0
- package/dist/halal-core/ai/redactSensitiveData.d.ts +1 -0
- package/dist/halal-core/ai/redactSensitiveData.js +139 -0
- package/dist/halal-core/ai/redactSensitiveData.js.map +1 -0
- package/dist/halal-core/ai/validateAiResponse.d.ts +2 -0
- package/dist/halal-core/ai/validateAiResponse.js +97 -0
- package/dist/halal-core/ai/validateAiResponse.js.map +1 -0
- package/dist/halal-core/cli/check.d.ts +1 -0
- package/dist/halal-core/cli/check.js +36 -0
- package/dist/halal-core/cli/check.js.map +1 -0
- package/dist/halal-core/cli/explain.d.ts +1 -0
- package/dist/halal-core/cli/explain.js +35 -0
- package/dist/halal-core/cli/explain.js.map +1 -0
- package/dist/halal-core/cli/report.d.ts +1 -0
- package/dist/halal-core/cli/report.js +15 -0
- package/dist/halal-core/cli/report.js.map +1 -0
- package/dist/halal-core/cli/submitReview.d.ts +1 -0
- package/dist/halal-core/cli/submitReview.js +12 -0
- package/dist/halal-core/cli/submitReview.js.map +1 -0
- package/dist/halal-core/cli/verifyReview.d.ts +1 -0
- package/dist/halal-core/cli/verifyReview.js +19 -0
- package/dist/halal-core/cli/verifyReview.js.map +1 -0
- package/dist/halal-core/config.d.ts +40 -0
- package/dist/halal-core/config.js +128 -0
- package/dist/halal-core/config.js.map +1 -0
- package/dist/halal-core/crypto/integrity.d.ts +9 -0
- package/dist/halal-core/crypto/integrity.js +101 -0
- package/dist/halal-core/crypto/integrity.js.map +1 -0
- package/dist/halal-core/enforce.d.ts +5 -0
- package/dist/halal-core/enforce.js +119 -0
- package/dist/halal-core/enforce.js.map +1 -0
- package/dist/halal-core/index.d.ts +14 -0
- package/dist/halal-core/index.js +17 -0
- package/dist/halal-core/index.js.map +1 -0
- package/dist/halal-core/lifecycle.d.ts +1 -0
- package/dist/halal-core/lifecycle.js +15 -0
- package/dist/halal-core/lifecycle.js.map +1 -0
- package/dist/halal-core/policy.d.ts +2 -0
- package/dist/halal-core/policy.js +5 -0
- package/dist/halal-core/policy.js.map +1 -0
- package/dist/halal-core/report/formatBrowserOverlay.d.ts +2 -0
- package/dist/halal-core/report/formatBrowserOverlay.js +41 -0
- package/dist/halal-core/report/formatBrowserOverlay.js.map +1 -0
- package/dist/halal-core/report/formatTerminalReport.d.ts +2 -0
- package/dist/halal-core/report/formatTerminalReport.js +39 -0
- package/dist/halal-core/report/formatTerminalReport.js.map +1 -0
- package/dist/halal-core/report/generateHalalReport.d.ts +7 -0
- package/dist/halal-core/report/generateHalalReport.js +46 -0
- package/dist/halal-core/report/generateHalalReport.js.map +1 -0
- package/dist/halal-core/report/signReport.d.ts +3 -0
- package/dist/halal-core/report/signReport.js +17 -0
- package/dist/halal-core/report/signReport.js.map +1 -0
- package/dist/halal-core/report/verifyReport.d.ts +11 -0
- package/dist/halal-core/report/verifyReport.js +45 -0
- package/dist/halal-core/report/verifyReport.js.map +1 -0
- package/dist/halal-core/review/createReviewRequest.d.ts +2 -0
- package/dist/halal-core/review/createReviewRequest.js +21 -0
- package/dist/halal-core/review/createReviewRequest.js.map +1 -0
- package/dist/halal-core/review/reviewPolicy.d.ts +3 -0
- package/dist/halal-core/review/reviewPolicy.js +21 -0
- package/dist/halal-core/review/reviewPolicy.js.map +1 -0
- package/dist/halal-core/review/signedReviewFile.d.ts +13 -0
- package/dist/halal-core/review/signedReviewFile.js +28 -0
- package/dist/halal-core/review/signedReviewFile.js.map +1 -0
- package/dist/halal-core/review/verifyReviewApproval.d.ts +10 -0
- package/dist/halal-core/review/verifyReviewApproval.js +68 -0
- package/dist/halal-core/review/verifyReviewApproval.js.map +1 -0
- package/dist/halal-core/rules/adultContentRules.d.ts +2 -0
- package/dist/halal-core/rules/adultContentRules.js +26 -0
- package/dist/halal-core/rules/adultContentRules.js.map +1 -0
- package/dist/halal-core/rules/alcoholDrugVapeRules.d.ts +2 -0
- package/dist/halal-core/rules/alcoholDrugVapeRules.js +25 -0
- package/dist/halal-core/rules/alcoholDrugVapeRules.js.map +1 -0
- package/dist/halal-core/rules/childSafetyRules.d.ts +2 -0
- package/dist/halal-core/rules/childSafetyRules.js +22 -0
- package/dist/halal-core/rules/childSafetyRules.js.map +1 -0
- package/dist/halal-core/rules/coreCategories.d.ts +7 -0
- package/dist/halal-core/rules/coreCategories.js +112 -0
- package/dist/halal-core/rules/coreCategories.js.map +1 -0
- package/dist/halal-core/rules/cyberAbuseRules.d.ts +2 -0
- package/dist/halal-core/rules/cyberAbuseRules.js +30 -0
- package/dist/halal-core/rules/cyberAbuseRules.js.map +1 -0
- package/dist/halal-core/rules/defaultBlockedRules.d.ts +20 -0
- package/dist/halal-core/rules/defaultBlockedRules.js +216 -0
- package/dist/halal-core/rules/defaultBlockedRules.js.map +1 -0
- package/dist/halal-core/rules/dependencyRules.d.ts +9 -0
- package/dist/halal-core/rules/dependencyRules.js +59 -0
- package/dist/halal-core/rules/dependencyRules.js.map +1 -0
- package/dist/halal-core/rules/endpointRules.d.ts +6 -0
- package/dist/halal-core/rules/endpointRules.js +26 -0
- package/dist/halal-core/rules/endpointRules.js.map +1 -0
- package/dist/halal-core/rules/environmentalHarmRules.d.ts +2 -0
- package/dist/halal-core/rules/environmentalHarmRules.js +20 -0
- package/dist/halal-core/rules/environmentalHarmRules.js.map +1 -0
- package/dist/halal-core/rules/financeRibaRules.d.ts +2 -0
- package/dist/halal-core/rules/financeRibaRules.js +23 -0
- package/dist/halal-core/rules/financeRibaRules.js.map +1 -0
- package/dist/halal-core/rules/gamblingRules.d.ts +2 -0
- package/dist/halal-core/rules/gamblingRules.js +25 -0
- package/dist/halal-core/rules/gamblingRules.js.map +1 -0
- package/dist/halal-core/rules/generalHarmRules.d.ts +2 -0
- package/dist/halal-core/rules/generalHarmRules.js +18 -0
- package/dist/halal-core/rules/generalHarmRules.js.map +1 -0
- package/dist/halal-core/rules/healthHarmRules.d.ts +2 -0
- package/dist/halal-core/rules/healthHarmRules.js +22 -0
- package/dist/halal-core/rules/healthHarmRules.js.map +1 -0
- package/dist/halal-core/rules/keywordRules.d.ts +10 -0
- package/dist/halal-core/rules/keywordRules.js +41 -0
- package/dist/halal-core/rules/keywordRules.js.map +1 -0
- package/dist/halal-core/rules/privacyAbuseRules.d.ts +2 -0
- package/dist/halal-core/rules/privacyAbuseRules.js +24 -0
- package/dist/halal-core/rules/privacyAbuseRules.js.map +1 -0
- package/dist/halal-core/rules/scamFraudRules.d.ts +2 -0
- package/dist/halal-core/rules/scamFraudRules.js +32 -0
- package/dist/halal-core/rules/scamFraudRules.js.map +1 -0
- package/dist/halal-core/rules/selfHarmRules.d.ts +2 -0
- package/dist/halal-core/rules/selfHarmRules.js +20 -0
- package/dist/halal-core/rules/selfHarmRules.js.map +1 -0
- package/dist/halal-core/rules/violenceExtremismRules.d.ts +2 -0
- package/dist/halal-core/rules/violenceExtremismRules.js +33 -0
- package/dist/halal-core/rules/violenceExtremismRules.js.map +1 -0
- package/dist/halal-core/scanner/scanApiRoutes.d.ts +1 -0
- package/dist/halal-core/scanner/scanApiRoutes.js +40 -0
- package/dist/halal-core/scanner/scanApiRoutes.js.map +1 -0
- package/dist/halal-core/scanner/scanComponents.d.ts +1 -0
- package/dist/halal-core/scanner/scanComponents.js +17 -0
- package/dist/halal-core/scanner/scanComponents.js.map +1 -0
- package/dist/halal-core/scanner/scanContent.d.ts +5 -0
- package/dist/halal-core/scanner/scanContent.js +302 -0
- package/dist/halal-core/scanner/scanContent.js.map +1 -0
- package/dist/halal-core/scanner/scanDependencies.d.ts +1 -0
- package/dist/halal-core/scanner/scanDependencies.js +19 -0
- package/dist/halal-core/scanner/scanDependencies.js.map +1 -0
- package/dist/halal-core/scanner/scanDomains.d.ts +4 -0
- package/dist/halal-core/scanner/scanDomains.js +14 -0
- package/dist/halal-core/scanner/scanDomains.js.map +1 -0
- package/dist/halal-core/scanner/scanEnvNames.d.ts +1 -0
- package/dist/halal-core/scanner/scanEnvNames.js +30 -0
- package/dist/halal-core/scanner/scanEnvNames.js.map +1 -0
- package/dist/halal-core/scanner/scanMetadata.d.ts +6 -0
- package/dist/halal-core/scanner/scanMetadata.js +33 -0
- package/dist/halal-core/scanner/scanMetadata.js.map +1 -0
- package/dist/halal-core/scanner/scanPages.d.ts +1 -0
- package/dist/halal-core/scanner/scanPages.js +19 -0
- package/dist/halal-core/scanner/scanPages.js.map +1 -0
- package/dist/halal-core/scanner/scanProject.d.ts +13 -0
- package/dist/halal-core/scanner/scanProject.js +62 -0
- package/dist/halal-core/scanner/scanProject.js.map +1 -0
- package/dist/halal-core/scanner/scanRoutes.d.ts +1 -0
- package/dist/halal-core/scanner/scanRoutes.js +43 -0
- package/dist/halal-core/scanner/scanRoutes.js.map +1 -0
- package/dist/halal-core/scanner/scanTranslations.d.ts +1 -0
- package/dist/halal-core/scanner/scanTranslations.js +32 -0
- package/dist/halal-core/scanner/scanTranslations.js.map +1 -0
- package/dist/halal-core/status.d.ts +14 -0
- package/dist/halal-core/status.js +2 -0
- package/dist/halal-core/status.js.map +1 -0
- package/dist/halal-core/tamper/verifyCoreIntegrity.d.ts +1 -0
- package/dist/halal-core/tamper/verifyCoreIntegrity.js +28 -0
- package/dist/halal-core/tamper/verifyCoreIntegrity.js.map +1 -0
- package/dist/halal-core/tamper/verifyLifecycleHooks.d.ts +1 -0
- package/dist/halal-core/tamper/verifyLifecycleHooks.js +14 -0
- package/dist/halal-core/tamper/verifyLifecycleHooks.js.map +1 -0
- package/dist/halal-core/tamper/verifyReportSignature.d.ts +5 -0
- package/dist/halal-core/tamper/verifyReportSignature.js +18 -0
- package/dist/halal-core/tamper/verifyReportSignature.js.map +1 -0
- package/dist/i18n/index.d.ts +45 -0
- package/dist/i18n/index.js +284 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/shared.d.ts +35 -0
- package/dist/i18n/shared.js +270 -0
- package/dist/i18n/shared.js.map +1 -0
- package/dist/icons/index.d.ts +159 -0
- package/dist/icons/index.js +286 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/kit/index.d.ts +29 -0
- package/dist/kit/index.js +72 -0
- package/dist/kit/index.js.map +1 -0
- package/dist/nitro-server/index.d.ts +7 -0
- package/dist/nitro-server/index.js +4 -0
- package/dist/nitro-server/index.js.map +1 -0
- package/dist/reactivity/computed.js +9 -4
- package/dist/reactivity/computed.js.map +1 -1
- package/dist/reactivity/effect.d.ts +3 -1
- package/dist/reactivity/effect.js +56 -6
- package/dist/reactivity/effect.js.map +1 -1
- package/dist/reactivity/reactive.js +64 -15
- package/dist/reactivity/reactive.js.map +1 -1
- package/dist/reactivity/ref.d.ts +1 -0
- package/dist/reactivity/ref.js +13 -6
- package/dist/reactivity/ref.js.map +1 -1
- package/dist/reactivity/scheduler.js +36 -4
- package/dist/reactivity/scheduler.js.map +1 -1
- package/dist/reactivity/watch.js +27 -5
- package/dist/reactivity/watch.js.map +1 -1
- package/dist/runtime/index.d.ts +226 -3
- package/dist/runtime/index.js +13344 -6395
- package/dist/runtime/index.js.map +1 -1
- package/dist/ui/index.d.ts +1828 -0
- package/dist/ui/index.js +938 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/vite-builder/index.d.ts +6 -0
- package/dist/vite-builder/index.js +4 -0
- package/dist/vite-builder/index.js.map +1 -0
- package/package.json +145 -105
- package/templates/default/.env.example +1 -0
- package/templates/default/README.md +18 -14
- package/templates/default/_gitignore +8 -5
- package/templates/default/assets/css/main.css +4 -0
- package/templates/default/nitro.config.ts +9 -5
- package/templates/default/pages/index.vue +102 -87
- package/templates/default/public/favicon.svg +4 -0
- package/templates/default/types/app.d.ts +3 -0
- package/templates/default/.resux-nitro/handler.ts +0 -21
package/dist/runtime/index.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ export interface AsyncDataError {
|
|
|
9
9
|
name: string;
|
|
10
10
|
message: string;
|
|
11
11
|
}
|
|
12
|
+
export interface ResuxError extends Error {
|
|
13
|
+
statusCode?: number;
|
|
14
|
+
fatal?: boolean;
|
|
15
|
+
data?: JsonValue;
|
|
16
|
+
}
|
|
12
17
|
export interface AsyncDataResource<T = unknown> {
|
|
13
18
|
data: Ref<T | undefined>;
|
|
14
19
|
value: Ref<T | undefined>;
|
|
@@ -30,6 +35,7 @@ export interface RouteContext {
|
|
|
30
35
|
params: Record<string, string>;
|
|
31
36
|
query: Record<string, string | string[]>;
|
|
32
37
|
origin?: string;
|
|
38
|
+
userAgent?: string;
|
|
33
39
|
}
|
|
34
40
|
export interface ResuxRouter {
|
|
35
41
|
push(to: string): Promise<void> | void;
|
|
@@ -41,7 +47,7 @@ export interface ResuxRouter {
|
|
|
41
47
|
export interface PageMeta {
|
|
42
48
|
layout?: string | false;
|
|
43
49
|
middleware?: string | string[];
|
|
44
|
-
title?: string
|
|
50
|
+
title?: string | Record<string, string>;
|
|
45
51
|
meta?: Array<Record<string, string>>;
|
|
46
52
|
}
|
|
47
53
|
export interface HeadEntry {
|
|
@@ -49,6 +55,7 @@ export interface HeadEntry {
|
|
|
49
55
|
meta?: Array<Record<string, string>>;
|
|
50
56
|
link?: Array<Record<string, string>>;
|
|
51
57
|
style?: ComponentStyle[];
|
|
58
|
+
htmlAttrs?: Record<string, string>;
|
|
52
59
|
}
|
|
53
60
|
export interface ComponentStyle {
|
|
54
61
|
id: string;
|
|
@@ -155,6 +162,7 @@ export interface ResuxAppLike {
|
|
|
155
162
|
provides: ResuxAppProvides;
|
|
156
163
|
provide<Key extends keyof ResuxAppInjections & string>(key: Key, value: ResuxAppInjections[Key]): void;
|
|
157
164
|
provide<Key extends string, Value>(key: Key, value: Value): void;
|
|
165
|
+
vueApp?: any;
|
|
158
166
|
}
|
|
159
167
|
export type ResuxPlugin = (resuxApp: ResuxAppLike) => unknown | Promise<unknown>;
|
|
160
168
|
export interface ResuxModuleContext {
|
|
@@ -165,8 +173,68 @@ export interface ResuxModuleContext {
|
|
|
165
173
|
addHead(head: Record<string, unknown>): void;
|
|
166
174
|
addRouteRule(path: string, rule: Record<string, unknown>): void;
|
|
167
175
|
extendRuntimeConfig(config: Record<string, unknown>): void;
|
|
176
|
+
hook(name: string, handler: (payload: unknown) => void | Promise<void>): () => void;
|
|
177
|
+
addComponent(component: string | {
|
|
178
|
+
file: string;
|
|
179
|
+
name?: string;
|
|
180
|
+
global?: boolean;
|
|
181
|
+
mode?: ResuxSupportMode;
|
|
182
|
+
lazy?: boolean;
|
|
183
|
+
}): void;
|
|
184
|
+
addComponentsDir(dir: string | {
|
|
185
|
+
path: string;
|
|
186
|
+
global?: boolean;
|
|
187
|
+
mode?: ResuxSupportMode;
|
|
188
|
+
pathPrefix?: boolean;
|
|
189
|
+
}): void;
|
|
190
|
+
addImports(imports: {
|
|
191
|
+
from: string;
|
|
192
|
+
name: string;
|
|
193
|
+
as?: string;
|
|
194
|
+
} | Array<{
|
|
195
|
+
from: string;
|
|
196
|
+
name: string;
|
|
197
|
+
as?: string;
|
|
198
|
+
}>): void;
|
|
199
|
+
addImportsDir(dir: string): void;
|
|
200
|
+
addPlugin(plugin: string | {
|
|
201
|
+
src: string;
|
|
202
|
+
mode?: ResuxSupportMode;
|
|
203
|
+
}): void;
|
|
204
|
+
addRouteMiddleware(middleware: {
|
|
205
|
+
name: string;
|
|
206
|
+
src: string;
|
|
207
|
+
global?: boolean;
|
|
208
|
+
mode?: ResuxSupportMode;
|
|
209
|
+
}): void;
|
|
210
|
+
addServerHandler(handler: {
|
|
211
|
+
route: string;
|
|
212
|
+
handler: string;
|
|
213
|
+
middleware?: boolean;
|
|
214
|
+
method?: string;
|
|
215
|
+
}): void;
|
|
216
|
+
addServerPlugin(plugin: string): void;
|
|
217
|
+
addTemplate(template: {
|
|
218
|
+
filename: string;
|
|
219
|
+
getContents: () => string | Promise<string>;
|
|
220
|
+
write?: boolean;
|
|
221
|
+
}): void;
|
|
222
|
+
addTypeTemplate(template: {
|
|
223
|
+
filename: string;
|
|
224
|
+
getContents: () => string | Promise<string>;
|
|
225
|
+
write?: boolean;
|
|
226
|
+
}): void;
|
|
227
|
+
extendPages(extender: (pages: Array<Record<string, unknown>>) => void | Promise<void>): void;
|
|
228
|
+
extendViteConfig(extender: (config: Record<string, unknown>) => void | Promise<void>): void;
|
|
229
|
+
extendNitroConfig(extender: (config: Record<string, unknown>) => void | Promise<void>): void;
|
|
230
|
+
addVitePlugin(plugin: unknown): void;
|
|
231
|
+
addPrerenderRoutes(route: string | string[]): void;
|
|
168
232
|
}
|
|
169
233
|
export type ResuxModule<TOptions = Record<string, unknown>> = ((options: TOptions, context: ResuxModuleContext) => unknown | Promise<unknown>) | {
|
|
234
|
+
meta?: {
|
|
235
|
+
name?: string;
|
|
236
|
+
configKey?: string;
|
|
237
|
+
};
|
|
170
238
|
defaults?: TOptions;
|
|
171
239
|
setup: (options: TOptions, context: ResuxModuleContext) => unknown | Promise<unknown>;
|
|
172
240
|
};
|
|
@@ -176,7 +244,82 @@ export interface ResuxDeployOptions {
|
|
|
176
244
|
nitroPreset?: string;
|
|
177
245
|
}
|
|
178
246
|
export interface ResuxConfigInput extends Record<string, unknown> {
|
|
247
|
+
builder?: string;
|
|
248
|
+
serverBuilder?: string;
|
|
249
|
+
buildDir?: string;
|
|
250
|
+
compatibilityDate?: string;
|
|
179
251
|
deploy?: ResuxDeployOptions;
|
|
252
|
+
i18n?: Record<string, unknown>;
|
|
253
|
+
packages?: ResuxPackagesConfig;
|
|
254
|
+
video?: Record<string, unknown>;
|
|
255
|
+
}
|
|
256
|
+
export interface ResuxPackageCssMap {
|
|
257
|
+
[packageName: string]: string[];
|
|
258
|
+
}
|
|
259
|
+
export type ResuxPackageMode = "ssr" | "clientOnly" | "serverOnly" | "progressive";
|
|
260
|
+
export interface ResuxPackageModeMap {
|
|
261
|
+
[packageName: string]: ResuxPackageMode;
|
|
262
|
+
}
|
|
263
|
+
export interface ResuxPackagesConfig {
|
|
264
|
+
lazy?: boolean | string[];
|
|
265
|
+
clientOnly?: string[];
|
|
266
|
+
serverOnly?: string[];
|
|
267
|
+
mode?: ResuxPackageModeMap;
|
|
268
|
+
external?: string[];
|
|
269
|
+
noExternal?: string[];
|
|
270
|
+
transpile?: string[];
|
|
271
|
+
optimizeDeps?: string[];
|
|
272
|
+
css?: string[] | ResuxPackageCssMap;
|
|
273
|
+
aliases?: Record<string, string>;
|
|
274
|
+
guards?: boolean;
|
|
275
|
+
diagnostics?: boolean;
|
|
276
|
+
}
|
|
277
|
+
export interface ResuxClientPackageImportRegistry {
|
|
278
|
+
importers?: string[];
|
|
279
|
+
css?: Record<string, string[]>;
|
|
280
|
+
declared?: string[];
|
|
281
|
+
}
|
|
282
|
+
export interface ClientRuntimeSourceOptions {
|
|
283
|
+
packageRegistry?: ResuxClientPackageImportRegistry;
|
|
284
|
+
}
|
|
285
|
+
export interface ResuxLazyPackageOptions {
|
|
286
|
+
clientOnly?: boolean;
|
|
287
|
+
mode?: ResuxPackageMode;
|
|
288
|
+
css?: string[];
|
|
289
|
+
exportName?: string;
|
|
290
|
+
preferDefault?: boolean;
|
|
291
|
+
}
|
|
292
|
+
export type ResuxLazyPackageLoader<T = unknown> = () => Promise<T>;
|
|
293
|
+
export type ClientEnhancementTrigger = "visible" | "interaction" | "idle" | "immediate" | "manual" | "page-load";
|
|
294
|
+
export interface ClientEnhancementContext {
|
|
295
|
+
trigger: ClientEnhancementTrigger;
|
|
296
|
+
options?: Record<string, unknown>;
|
|
297
|
+
__resux?: {
|
|
298
|
+
trigger: ClientEnhancementTrigger;
|
|
299
|
+
options?: Record<string, unknown>;
|
|
300
|
+
};
|
|
301
|
+
[key: string]: unknown;
|
|
302
|
+
}
|
|
303
|
+
export type ClientEnhancementSetup = (target: Element, context: ClientEnhancementContext) => void | (() => void | Promise<void>) | Promise<void | (() => void | Promise<void>)>;
|
|
304
|
+
export interface UseClientEnhancementOptions {
|
|
305
|
+
target?: Element | string;
|
|
306
|
+
trigger?: ClientEnhancementTrigger;
|
|
307
|
+
options?: Record<string, unknown>;
|
|
308
|
+
}
|
|
309
|
+
export interface PackageAdapterContext {
|
|
310
|
+
packageName: string;
|
|
311
|
+
mode: ResuxPackageMode;
|
|
312
|
+
modules: unknown[];
|
|
313
|
+
}
|
|
314
|
+
export interface PackageAdapterDefinition<TOptions extends Record<string, unknown> = Record<string, unknown>> {
|
|
315
|
+
name: string;
|
|
316
|
+
packageName?: string;
|
|
317
|
+
mode?: ResuxPackageMode;
|
|
318
|
+
imports?: string[];
|
|
319
|
+
css?: string[];
|
|
320
|
+
defaults?: TOptions;
|
|
321
|
+
validateOptions?: (options: TOptions) => void;
|
|
322
|
+
enhance: (target: Element, options: TOptions, context: PackageAdapterContext) => void | (() => void | Promise<void>) | Promise<void | (() => void | Promise<void>)>;
|
|
180
323
|
}
|
|
181
324
|
export type RouteMiddlewareResult = void | string | false | {
|
|
182
325
|
redirect: string | {
|
|
@@ -267,8 +410,15 @@ export interface SetupContext {
|
|
|
267
410
|
isReadonly: typeof isReadonly;
|
|
268
411
|
nextTick: typeof nextTick;
|
|
269
412
|
useState<T>(key: string, factory?: () => T): Ref<T>;
|
|
413
|
+
useGlobalState<T>(key: string, factory?: () => T): Ref<T>;
|
|
270
414
|
useAsyncData<T>(key: string, handler?: (context: AsyncDataHandlerContext) => T | Promise<T>): AsyncDataResource<T>;
|
|
271
415
|
defineProps<T extends Record<string, unknown> = Record<string, unknown>>(): T;
|
|
416
|
+
defineEmits<T = (...args: any[]) => void>(emits?: unknown): (...args: any[]) => void;
|
|
417
|
+
emit(...args: any[]): void;
|
|
418
|
+
defineExpose(exposed?: Record<string, any>): void;
|
|
419
|
+
defineSlots<T = Record<string, any>>(): T;
|
|
420
|
+
defineOptions(options?: Record<string, any>): void;
|
|
421
|
+
defineModel<T>(name?: string, options?: unknown): Ref<T>;
|
|
272
422
|
useRoute(): RouteContext;
|
|
273
423
|
useRouter(): ResuxRouter;
|
|
274
424
|
useHead(input: HeadEntry): void;
|
|
@@ -277,10 +427,39 @@ export interface SetupContext {
|
|
|
277
427
|
useResuxApp(): ResuxAppLike;
|
|
278
428
|
apiURL(path: string): string;
|
|
279
429
|
useResuxImage(): ResuxImageBuilder;
|
|
280
|
-
useFetch<T>(url: string, init?: RequestInit):
|
|
430
|
+
useFetch<T>(url: string, init?: RequestInit): AsyncDataResource<T>;
|
|
281
431
|
$fetch<T>(url: string, init?: RequestInit): Promise<T>;
|
|
432
|
+
useError(): Ref<ResuxError | null>;
|
|
433
|
+
clearError(): void;
|
|
434
|
+
showError(input: string | Partial<ResuxError>): never;
|
|
435
|
+
createError(input: string | Partial<ResuxError>): ResuxError;
|
|
436
|
+
useLazyPackage<T = unknown>(name: string, options?: ResuxLazyPackageOptions): Promise<T>;
|
|
437
|
+
useClientPackage<T = unknown>(name: string, options?: Omit<ResuxLazyPackageOptions, "clientOnly" | "mode">): Promise<T>;
|
|
438
|
+
usePackageReady(name: string): boolean;
|
|
439
|
+
defineLazyPackage<T = unknown>(name: string, options?: ResuxLazyPackageOptions): ResuxLazyPackageLoader<T>;
|
|
440
|
+
defineClientOnlyPackage<T = unknown>(name: string, options?: Omit<ResuxLazyPackageOptions, "clientOnly" | "mode">): ResuxLazyPackageLoader<T>;
|
|
441
|
+
definePackageAdapter<TOptions extends Record<string, unknown> = Record<string, unknown>>(definition: PackageAdapterDefinition<TOptions>): {
|
|
442
|
+
name: string;
|
|
443
|
+
setup: ClientEnhancementSetup;
|
|
444
|
+
};
|
|
445
|
+
defineClientEnhancement(name: string, setup: ClientEnhancementSetup): {
|
|
446
|
+
name: string;
|
|
447
|
+
setup: ClientEnhancementSetup;
|
|
448
|
+
};
|
|
449
|
+
useClientEnhancement(name: string, options?: UseClientEnhancementOptions): Promise<{
|
|
450
|
+
ready: boolean;
|
|
451
|
+
activate: () => Promise<void>;
|
|
452
|
+
dispose: () => Promise<void>;
|
|
453
|
+
}>;
|
|
282
454
|
onMounted(callback: () => unknown | Promise<unknown>): void;
|
|
283
455
|
definePageMeta(_meta: PageMeta): void;
|
|
456
|
+
useI18n(): any;
|
|
457
|
+
useLocalePath(): any;
|
|
458
|
+
useSwitchLocalePath(): any;
|
|
459
|
+
useDevice(): DeviceInfo;
|
|
460
|
+
$device: DeviceInfo;
|
|
461
|
+
$t(key: string, params?: Record<string, unknown>): string;
|
|
462
|
+
$tm(key: string): unknown;
|
|
284
463
|
}
|
|
285
464
|
export interface ComponentDefinition {
|
|
286
465
|
id: string;
|
|
@@ -298,6 +477,7 @@ export interface SerializedScope {
|
|
|
298
477
|
moduleId: string;
|
|
299
478
|
props?: Record<string, JsonValue>;
|
|
300
479
|
state: Record<string, JsonValue>;
|
|
480
|
+
globalStateKeys?: string[];
|
|
301
481
|
asyncData: Record<string, SerializedAsyncData>;
|
|
302
482
|
}
|
|
303
483
|
export interface SerializedAsyncData {
|
|
@@ -308,6 +488,7 @@ export interface SerializedAsyncData {
|
|
|
308
488
|
export interface ResuxPayload {
|
|
309
489
|
route: RouteContext;
|
|
310
490
|
scopes: Record<string, SerializedScope>;
|
|
491
|
+
globalState?: Record<string, JsonValue>;
|
|
311
492
|
modules: Record<string, string>;
|
|
312
493
|
vueIslands?: Record<string, string>;
|
|
313
494
|
config?: RuntimeConfig;
|
|
@@ -344,6 +525,7 @@ export interface RenderResult {
|
|
|
344
525
|
}
|
|
345
526
|
export interface RenderDocumentOptions {
|
|
346
527
|
devReload?: boolean;
|
|
528
|
+
isStatic?: boolean;
|
|
347
529
|
}
|
|
348
530
|
interface RenderTemplateContext {
|
|
349
531
|
scope: Record<string, unknown>;
|
|
@@ -367,6 +549,19 @@ export declare function defineResuxModule<TOptions = Record<string, unknown>>(mo
|
|
|
367
549
|
export declare function defineResuxPlugin(plugin: ResuxPlugin): ResuxPlugin;
|
|
368
550
|
export declare function defineResuxRouteMiddleware(middleware: ResuxRouteMiddleware): ResuxRouteMiddleware;
|
|
369
551
|
export declare function useResuxApp(): ResuxAppLike;
|
|
552
|
+
export interface DeviceInfo {
|
|
553
|
+
isMobile: boolean;
|
|
554
|
+
isTablet: boolean;
|
|
555
|
+
isDesktop: boolean;
|
|
556
|
+
isIos: boolean;
|
|
557
|
+
isAndroid: boolean;
|
|
558
|
+
[key: string]: boolean;
|
|
559
|
+
}
|
|
560
|
+
export declare function parseUserAgent(ua?: string): DeviceInfo;
|
|
561
|
+
export declare function useDevice(): DeviceInfo;
|
|
562
|
+
export declare function useRoute(): RouteContext;
|
|
563
|
+
export declare function useRouter(): ResuxRouter;
|
|
564
|
+
export declare function useRuntimeConfig(): RuntimeConfig;
|
|
370
565
|
export declare function useResuxImage(): ResuxImageBuilder;
|
|
371
566
|
export declare function navigateTo(to: string, options?: {
|
|
372
567
|
statusCode?: number;
|
|
@@ -374,6 +569,32 @@ export declare function navigateTo(to: string, options?: {
|
|
|
374
569
|
export declare function abortNavigation(message?: string, options?: {
|
|
375
570
|
statusCode?: number;
|
|
376
571
|
}): RouteMiddlewareResult;
|
|
572
|
+
export declare function createError(input: string | Partial<ResuxError>): ResuxError;
|
|
573
|
+
export declare function useError(): Ref<ResuxError | null>;
|
|
574
|
+
export declare function showError(input: string | Partial<ResuxError>): never;
|
|
575
|
+
export declare function clearError(): void;
|
|
576
|
+
export declare function useLazyPackage<T = unknown>(name: string, options?: ResuxLazyPackageOptions): Promise<T>;
|
|
577
|
+
export declare function useClientPackage<T = unknown>(name: string, options?: Omit<ResuxLazyPackageOptions, "clientOnly" | "mode">): Promise<T>;
|
|
578
|
+
export declare function usePackageReady(name: string): boolean;
|
|
579
|
+
export declare function defineLazyPackage<T = unknown>(name: string, options?: ResuxLazyPackageOptions): ResuxLazyPackageLoader<T>;
|
|
580
|
+
export declare function defineClientOnlyPackage<T = unknown>(name: string, options?: Omit<ResuxLazyPackageOptions, "clientOnly" | "mode">): ResuxLazyPackageLoader<T>;
|
|
581
|
+
export declare function definePackageAdapter<TOptions extends Record<string, unknown> = Record<string, unknown>>(definition: PackageAdapterDefinition<TOptions>): {
|
|
582
|
+
name: string;
|
|
583
|
+
setup: ClientEnhancementSetup;
|
|
584
|
+
};
|
|
585
|
+
export declare function defineClientEnhancement(name: string, setup: ClientEnhancementSetup): {
|
|
586
|
+
name: string;
|
|
587
|
+
setup: ClientEnhancementSetup;
|
|
588
|
+
};
|
|
589
|
+
export declare function useClientEnhancement(name: string, options?: UseClientEnhancementOptions): Promise<{
|
|
590
|
+
ready: boolean;
|
|
591
|
+
activate: () => Promise<void>;
|
|
592
|
+
dispose: () => Promise<void>;
|
|
593
|
+
}>;
|
|
594
|
+
export declare function disposeClientEnhancements(): Promise<void>;
|
|
595
|
+
export declare function hasClientEnhancement(name: string): boolean;
|
|
596
|
+
export declare function getClientEnhancement(name: string): ClientEnhancementSetup | undefined;
|
|
597
|
+
export declare function scanClientEnhancements(root?: ParentNode): Promise<void>;
|
|
377
598
|
export declare function defineEventHandler(handler: EventHandler): EventHandler;
|
|
378
599
|
export declare const eventHandler: typeof defineEventHandler;
|
|
379
600
|
export declare function defineServerMiddleware(middleware: ServerMiddleware): ServerMiddleware;
|
|
@@ -382,6 +603,7 @@ export declare function getQuery(event: EventHandlerEvent): Record<string, strin
|
|
|
382
603
|
export declare function setHeader(event: EventHandlerEvent, name: string, value: number | string | string[]): void;
|
|
383
604
|
export declare function renderApp(options: RenderAppOptions): Promise<RenderResult>;
|
|
384
605
|
export declare function renderDocument(result: RenderResult, title?: string, options?: RenderDocumentOptions): string;
|
|
606
|
+
export declare function createServerSetupContext(route: RouteContext, props: ComponentProps, stateRefs: Record<string, Ref<unknown>>, asyncDataRefs: Record<string, AsyncDataResource<unknown>>, headEntries: HeadEntry[], resuxApp: ResuxAppLike, runtimeConfig: RuntimeConfig, globalStateRefs?: Record<string, Ref<unknown>>, globalStateKeys?: Set<string>): SetupContext;
|
|
385
607
|
export declare function renderTemplateNodesAsync(nodes: TemplateNode[], context: RenderTemplateContext, renderComponent: (component: ComponentDefinition, props?: ComponentProps, renderSlot?: () => Promise<string>) => Promise<string>, locals?: Record<string, unknown>): Promise<string>;
|
|
386
608
|
export declare class AsyncResuxRenderer {
|
|
387
609
|
private readonly route;
|
|
@@ -393,6 +615,7 @@ export declare class AsyncResuxRenderer {
|
|
|
393
615
|
private readonly runtimeConfig;
|
|
394
616
|
private nextScopeId;
|
|
395
617
|
private readonly scopes;
|
|
618
|
+
private readonly globalStateRefs;
|
|
396
619
|
private readonly styleIds;
|
|
397
620
|
readonly headEntries: HeadEntry[];
|
|
398
621
|
readonly resuxApp: ResuxAppLike;
|
|
@@ -423,4 +646,4 @@ type ClientPatch = {
|
|
|
423
646
|
value: string;
|
|
424
647
|
};
|
|
425
648
|
export declare function renderClientPatches(template: TemplateNode[], scope: Record<string, unknown>, scopeId: string, styleScopeId?: string): ClientPatch[];
|
|
426
|
-
export declare function getClientRuntimeSource(): string;
|
|
649
|
+
export declare function getClientRuntimeSource(options?: ClientRuntimeSourceOptions): string;
|