resuxjs 0.3.11 → 0.4.0-beta.2
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 +23 -1
- package/dist/bin.d.ts +1 -2
- package/dist/bin.js +4 -0
- package/dist/bin.js.map +1 -1
- package/dist/build/index.d.ts +28 -0
- package/dist/build/index.js +51 -0
- package/dist/build/index.js.map +1 -0
- package/dist/cli.d.ts +15 -5
- package/dist/cli.js +2648 -3671
- package/dist/cli.js.map +1 -1
- package/dist/compiler/adapter.d.ts +14 -11
- package/dist/compiler/adapter.js +68 -93
- package/dist/compiler/adapter.js.map +1 -1
- package/dist/compiler/dev-warnings.d.ts +8 -5
- package/dist/compiler/dev-warnings.js +248 -321
- package/dist/compiler/dev-warnings.js.map +1 -1
- package/dist/compiler/directives.d.ts +3 -0
- package/dist/compiler/directives.js +124 -150
- package/dist/compiler/directives.js.map +1 -1
- package/dist/compiler/implementation.d.ts +96 -93
- package/dist/compiler/implementation.js +2967 -3430
- package/dist/compiler/index.d.ts +14 -11
- package/dist/compiler/index.js +68 -93
- package/dist/compiler/index.js.map +1 -1
- package/dist/core/config.d.ts +12 -5
- package/dist/core/config.js +42 -25
- package/dist/core/config.js.map +1 -1
- package/dist/core/hooks.d.ts +127 -126
- package/dist/core/hooks.js +45 -55
- package/dist/core/hooks.js.map +1 -1
- package/dist/core/index.d.ts +5 -4
- package/dist/core/index.js +5 -5
- package/dist/core/module-container.d.ts +76 -74
- package/dist/core/module-container.js +181 -186
- package/dist/core/module-container.js.map +1 -1
- package/dist/core/resux.d.ts +15 -12
- package/dist/core/resux.js +17 -13
- package/dist/core/resux.js.map +1 -1
- package/dist/create-bin.d.ts +1 -2
- package/dist/create-bin.js +4 -0
- package/dist/create-bin.js.map +1 -1
- package/dist/create.d.ts +3 -0
- package/dist/create.js +499 -638
- package/dist/create.js.map +1 -1
- package/dist/deploy/cloudflare.d.ts +4 -1
- package/dist/deploy/cloudflare.js +30 -34
- package/dist/deploy/cloudflare.js.map +1 -1
- package/dist/deploy/common.d.ts +6 -4
- package/dist/deploy/common.js +118 -188
- package/dist/deploy/common.js.map +1 -1
- package/dist/deploy/framework-runtime.d.ts +3 -0
- package/dist/deploy/framework-runtime.js +43 -48
- package/dist/deploy/framework-runtime.js.map +1 -1
- package/dist/deploy/index.d.ts +4 -1
- package/dist/deploy/index.js +58 -80
- package/dist/deploy/index.js.map +1 -1
- package/dist/deploy/netlify.d.ts +4 -1
- package/dist/deploy/netlify.js +40 -41
- package/dist/deploy/netlify.js.map +1 -1
- package/dist/deploy/node.d.ts +4 -1
- package/dist/deploy/node.js +24 -19
- package/dist/deploy/node.js.map +1 -1
- package/dist/deploy/production-report.d.ts +3 -0
- package/dist/deploy/production-report.js +14 -14
- package/dist/deploy/production-report.js.map +1 -1
- package/dist/deploy/runtime-dependencies.d.ts +3 -0
- package/dist/deploy/runtime-dependencies.js +158 -220
- package/dist/deploy/runtime-dependencies.js.map +1 -1
- package/dist/deploy/static.d.ts +4 -1
- package/dist/deploy/static.js +16 -14
- package/dist/deploy/static.js.map +1 -1
- package/dist/deploy/types.d.ts +25 -22
- package/dist/deploy/types.js +0 -1
- package/dist/deploy/vercel.d.ts +4 -1
- package/dist/deploy/vercel.js +137 -188
- package/dist/deploy/vercel.js.map +1 -1
- package/dist/fonts/index.d.ts +15 -11
- package/dist/fonts/index.js +114 -134
- package/dist/fonts/index.js.map +1 -1
- package/dist/globals.d.ts +79 -78
- package/dist/globals.js +0 -1
- package/dist/halal-core/ai/classifyProject.d.ts +4 -1
- package/dist/halal-core/ai/classifyProject.js +81 -95
- package/dist/halal-core/ai/classifyProject.js.map +1 -1
- package/dist/halal-core/ai/classifyRuntimeContent.d.ts +5 -2
- package/dist/halal-core/ai/classifyRuntimeContent.js +77 -95
- package/dist/halal-core/ai/classifyRuntimeContent.js.map +1 -1
- package/dist/halal-core/ai/createProjectSummary.d.ts +38 -35
- package/dist/halal-core/ai/createProjectSummary.js +38 -39
- package/dist/halal-core/ai/createProjectSummary.js.map +1 -1
- package/dist/halal-core/ai/halalClassifierPrompt.d.ts +3 -0
- package/dist/halal-core/ai/halalClassifierPrompt.js +5 -1
- package/dist/halal-core/ai/halalClassifierPrompt.js.map +1 -1
- package/dist/halal-core/ai/redactSensitiveData.d.ts +3 -0
- package/dist/halal-core/ai/redactSensitiveData.js +82 -110
- package/dist/halal-core/ai/redactSensitiveData.js.map +1 -1
- package/dist/halal-core/ai/validateAiResponse.d.ts +4 -1
- package/dist/halal-core/ai/validateAiResponse.js +58 -85
- package/dist/halal-core/ai/validateAiResponse.js.map +1 -1
- package/dist/halal-core/cli/check.d.ts +3 -0
- package/dist/halal-core/cli/check.js +28 -30
- package/dist/halal-core/cli/check.js.map +1 -1
- package/dist/halal-core/cli/explain.d.ts +3 -0
- package/dist/halal-core/cli/explain.js +27 -31
- package/dist/halal-core/cli/explain.js.map +1 -1
- package/dist/halal-core/cli/report.d.ts +3 -0
- package/dist/halal-core/cli/report.js +14 -10
- package/dist/halal-core/cli/report.js.map +1 -1
- package/dist/halal-core/cli/submitReview.d.ts +3 -0
- package/dist/halal-core/cli/submitReview.js +13 -9
- package/dist/halal-core/cli/submitReview.js.map +1 -1
- package/dist/halal-core/cli/verifyReview.d.ts +3 -0
- package/dist/halal-core/cli/verifyReview.js +18 -15
- package/dist/halal-core/cli/verifyReview.js.map +1 -1
- package/dist/halal-core/config.d.ts +30 -27
- package/dist/halal-core/config.js +76 -118
- package/dist/halal-core/config.js.map +1 -1
- package/dist/halal-core/crypto/integrity.d.ts +6 -3
- package/dist/halal-core/crypto/integrity.js +64 -87
- package/dist/halal-core/crypto/integrity.js.map +1 -1
- package/dist/halal-core/enforce.d.ts +3 -0
- package/dist/halal-core/enforce.js +92 -105
- package/dist/halal-core/enforce.js.map +1 -1
- package/dist/halal-core/index.d.ts +20 -16
- package/dist/halal-core/index.js +18 -19
- package/dist/halal-core/lifecycle.d.ts +3 -0
- package/dist/halal-core/lifecycle.js +15 -13
- package/dist/halal-core/lifecycle.js.map +1 -1
- package/dist/halal-core/policy.d.ts +4 -1
- package/dist/halal-core/policy.js +6 -2
- package/dist/halal-core/policy.js.map +1 -1
- package/dist/halal-core/report/formatBrowserOverlay.d.ts +4 -1
- package/dist/halal-core/report/formatBrowserOverlay.js +10 -8
- package/dist/halal-core/report/formatBrowserOverlay.js.map +1 -1
- package/dist/halal-core/report/formatTerminalReport.d.ts +4 -1
- package/dist/halal-core/report/formatTerminalReport.js +27 -37
- package/dist/halal-core/report/formatTerminalReport.js.map +1 -1
- package/dist/halal-core/report/generateHalalReport.d.ts +7 -4
- package/dist/halal-core/report/generateHalalReport.js +26 -26
- package/dist/halal-core/report/generateHalalReport.js.map +1 -1
- package/dist/halal-core/report/signReport.d.ts +4 -1
- package/dist/halal-core/report/signReport.js +16 -12
- package/dist/halal-core/report/signReport.js.map +1 -1
- package/dist/halal-core/report/verifyReport.d.ts +9 -6
- package/dist/halal-core/report/verifyReport.js +51 -41
- package/dist/halal-core/report/verifyReport.js.map +1 -1
- package/dist/halal-core/review/createReviewRequest.d.ts +4 -1
- package/dist/halal-core/review/createReviewRequest.js +21 -17
- package/dist/halal-core/review/createReviewRequest.js.map +1 -1
- package/dist/halal-core/review/reviewPolicy.d.ts +3 -0
- package/dist/halal-core/review/reviewPolicy.js +19 -17
- package/dist/halal-core/review/reviewPolicy.js.map +1 -1
- package/dist/halal-core/review/signedReviewFile.d.ts +11 -8
- package/dist/halal-core/review/signedReviewFile.js +24 -22
- package/dist/halal-core/review/signedReviewFile.js.map +1 -1
- package/dist/halal-core/review/verifyReviewApproval.d.ts +9 -6
- package/dist/halal-core/review/verifyReviewApproval.js +68 -62
- package/dist/halal-core/review/verifyReviewApproval.js.map +1 -1
- package/dist/halal-core/rules/adultContentRules.d.ts +3 -0
- package/dist/halal-core/rules/adultContentRules.js +23 -23
- package/dist/halal-core/rules/adultContentRules.js.map +1 -1
- package/dist/halal-core/rules/alcoholDrugVapeRules.d.ts +3 -0
- package/dist/halal-core/rules/alcoholDrugVapeRules.js +22 -22
- package/dist/halal-core/rules/alcoholDrugVapeRules.js.map +1 -1
- package/dist/halal-core/rules/childSafetyRules.d.ts +3 -0
- package/dist/halal-core/rules/childSafetyRules.js +19 -19
- package/dist/halal-core/rules/childSafetyRules.js.map +1 -1
- package/dist/halal-core/rules/coreCategories.d.ts +7 -4
- package/dist/halal-core/rules/coreCategories.js +237 -110
- package/dist/halal-core/rules/coreCategories.js.map +1 -1
- package/dist/halal-core/rules/cyberAbuseRules.d.ts +3 -0
- package/dist/halal-core/rules/cyberAbuseRules.js +27 -27
- package/dist/halal-core/rules/cyberAbuseRules.js.map +1 -1
- package/dist/halal-core/rules/defaultBlockedRules.d.ts +21 -18
- package/dist/halal-core/rules/defaultBlockedRules.js +158 -199
- package/dist/halal-core/rules/defaultBlockedRules.js.map +1 -1
- package/dist/halal-core/rules/dependencyRules.d.ts +8 -5
- package/dist/halal-core/rules/dependencyRules.js +50 -56
- package/dist/halal-core/rules/dependencyRules.js.map +1 -1
- package/dist/halal-core/rules/endpointRules.d.ts +6 -3
- package/dist/halal-core/rules/endpointRules.js +21 -23
- package/dist/halal-core/rules/endpointRules.js.map +1 -1
- package/dist/halal-core/rules/environmentalHarmRules.d.ts +3 -0
- package/dist/halal-core/rules/environmentalHarmRules.js +17 -17
- package/dist/halal-core/rules/environmentalHarmRules.js.map +1 -1
- package/dist/halal-core/rules/financeRibaRules.d.ts +3 -0
- package/dist/halal-core/rules/financeRibaRules.js +20 -20
- package/dist/halal-core/rules/financeRibaRules.js.map +1 -1
- package/dist/halal-core/rules/gamblingRules.d.ts +3 -0
- package/dist/halal-core/rules/gamblingRules.js +22 -22
- package/dist/halal-core/rules/gamblingRules.js.map +1 -1
- package/dist/halal-core/rules/generalHarmRules.d.ts +3 -0
- package/dist/halal-core/rules/generalHarmRules.js +15 -15
- package/dist/halal-core/rules/generalHarmRules.js.map +1 -1
- package/dist/halal-core/rules/healthHarmRules.d.ts +3 -0
- package/dist/halal-core/rules/healthHarmRules.js +19 -19
- package/dist/halal-core/rules/healthHarmRules.js.map +1 -1
- package/dist/halal-core/rules/keywordRules.d.ts +11 -8
- package/dist/halal-core/rules/keywordRules.js +90 -39
- package/dist/halal-core/rules/keywordRules.js.map +1 -1
- package/dist/halal-core/rules/privacyAbuseRules.d.ts +3 -0
- package/dist/halal-core/rules/privacyAbuseRules.js +21 -21
- package/dist/halal-core/rules/privacyAbuseRules.js.map +1 -1
- package/dist/halal-core/rules/scamFraudRules.d.ts +3 -0
- package/dist/halal-core/rules/scamFraudRules.js +29 -29
- package/dist/halal-core/rules/scamFraudRules.js.map +1 -1
- package/dist/halal-core/rules/selfHarmRules.d.ts +3 -0
- package/dist/halal-core/rules/selfHarmRules.js +17 -17
- package/dist/halal-core/rules/selfHarmRules.js.map +1 -1
- package/dist/halal-core/rules/violenceExtremismRules.d.ts +3 -0
- package/dist/halal-core/rules/violenceExtremismRules.js +30 -30
- package/dist/halal-core/rules/violenceExtremismRules.js.map +1 -1
- package/dist/halal-core/runtime/guard.d.ts +17 -14
- package/dist/halal-core/runtime/guard.js +162 -183
- package/dist/halal-core/runtime/guard.js.map +1 -1
- package/dist/halal-core/runtime/index.d.ts +5 -4
- package/dist/halal-core/runtime/index.js +4 -5
- package/dist/halal-core/runtime/reviewedMemory.d.ts +4 -1
- package/dist/halal-core/runtime/reviewedMemory.js +74 -110
- package/dist/halal-core/runtime/reviewedMemory.js.map +1 -1
- package/dist/halal-core/runtime/serializeRuntimeContent.d.ts +10 -7
- package/dist/halal-core/runtime/serializeRuntimeContent.js +132 -156
- package/dist/halal-core/runtime/serializeRuntimeContent.js.map +1 -1
- package/dist/halal-core/runtime/types.d.ts +44 -41
- package/dist/halal-core/runtime/types.js +0 -1
- package/dist/halal-core/scanner/scanApiRoutes.d.ts +3 -0
- package/dist/halal-core/scanner/scanApiRoutes.js +32 -36
- package/dist/halal-core/scanner/scanApiRoutes.js.map +1 -1
- package/dist/halal-core/scanner/scanComponents.d.ts +3 -0
- package/dist/halal-core/scanner/scanComponents.js +12 -13
- package/dist/halal-core/scanner/scanComponents.js.map +1 -1
- package/dist/halal-core/scanner/scanContent.d.ts +5 -2
- package/dist/halal-core/scanner/scanContent.js +193 -263
- package/dist/halal-core/scanner/scanContent.js.map +1 -1
- package/dist/halal-core/scanner/scanDependencies.d.ts +3 -0
- package/dist/halal-core/scanner/scanDependencies.js +16 -15
- package/dist/halal-core/scanner/scanDependencies.js.map +1 -1
- package/dist/halal-core/scanner/scanDomains.d.ts +5 -2
- package/dist/halal-core/scanner/scanDomains.js +12 -12
- package/dist/halal-core/scanner/scanDomains.js.map +1 -1
- package/dist/halal-core/scanner/scanEnvNames.d.ts +3 -0
- package/dist/halal-core/scanner/scanEnvNames.js +23 -26
- package/dist/halal-core/scanner/scanEnvNames.js.map +1 -1
- package/dist/halal-core/scanner/scanMetadata.d.ts +6 -3
- package/dist/halal-core/scanner/scanMetadata.js +20 -29
- package/dist/halal-core/scanner/scanMetadata.js.map +1 -1
- package/dist/halal-core/scanner/scanPages.d.ts +3 -0
- package/dist/halal-core/scanner/scanPages.js +12 -15
- package/dist/halal-core/scanner/scanPages.js.map +1 -1
- package/dist/halal-core/scanner/scanProject.d.ts +15 -10
- package/dist/halal-core/scanner/scanProject.js +43 -49
- package/dist/halal-core/scanner/scanProject.js.map +1 -1
- package/dist/halal-core/scanner/scanRoutes.d.ts +3 -0
- package/dist/halal-core/scanner/scanRoutes.js +32 -39
- package/dist/halal-core/scanner/scanRoutes.js.map +1 -1
- package/dist/halal-core/scanner/scanTranslations.d.ts +3 -0
- package/dist/halal-core/scanner/scanTranslations.js +21 -29
- package/dist/halal-core/scanner/scanTranslations.js.map +1 -1
- package/dist/halal-core/status.d.ts +14 -11
- package/dist/halal-core/status.js +0 -1
- package/dist/halal-core/tamper/verifyCoreIntegrity.d.ts +3 -0
- package/dist/halal-core/tamper/verifyCoreIntegrity.js +26 -24
- package/dist/halal-core/tamper/verifyCoreIntegrity.js.map +1 -1
- package/dist/halal-core/tamper/verifyLifecycleHooks.d.ts +3 -0
- package/dist/halal-core/tamper/verifyLifecycleHooks.js +13 -12
- package/dist/halal-core/tamper/verifyLifecycleHooks.js.map +1 -1
- package/dist/halal-core/tamper/verifyReportSignature.d.ts +6 -3
- package/dist/halal-core/tamper/verifyReportSignature.js +20 -14
- package/dist/halal-core/tamper/verifyReportSignature.js.map +1 -1
- package/dist/halal.d.ts +20 -1
- package/dist/halal.js +18 -2
- package/dist/i18n/index.d.ts +34 -31
- package/dist/i18n/index.js +219 -288
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/shared.d.ts +18 -15
- package/dist/i18n/shared.js +204 -266
- package/dist/i18n/shared.js.map +1 -1
- package/dist/icons/index.d.ts +143 -139
- package/dist/icons/index.js +322 -273
- package/dist/icons/index.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +7 -2
- package/dist/kit/index.d.ts +9 -6
- package/dist/kit/index.js +45 -43
- package/dist/kit/index.js.map +1 -1
- package/dist/nitro-server/index.d.ts +7 -4
- package/dist/nitro-server/index.js +6 -2
- package/dist/nitro-server/index.js.map +1 -1
- package/dist/node.d.ts +6 -3
- package/dist/node.js +88 -116
- package/dist/node.js.map +1 -1
- package/dist/reactivity/computed.d.ts +6 -3
- package/dist/reactivity/computed.js +46 -53
- package/dist/reactivity/computed.js.map +1 -1
- package/dist/reactivity/effect.d.ts +8 -5
- package/dist/reactivity/effect.js +105 -146
- package/dist/reactivity/effect.js.map +1 -1
- package/dist/reactivity/index.d.ts +8 -8
- package/dist/reactivity/index.js +7 -8
- package/dist/reactivity/reactive.d.ts +3 -0
- package/dist/reactivity/reactive.js +93 -133
- package/dist/reactivity/reactive.js.map +1 -1
- package/dist/reactivity/readonly.d.ts +2 -1
- package/dist/reactivity/readonly.js +2 -2
- package/dist/reactivity/ref.d.ts +15 -15
- package/dist/reactivity/ref.js +73 -81
- package/dist/reactivity/ref.js.map +1 -1
- package/dist/reactivity/scheduler.d.ts +3 -1
- package/dist/reactivity/scheduler.js +67 -69
- package/dist/reactivity/scheduler.js.map +1 -1
- package/dist/reactivity/types.d.ts +17 -14
- package/dist/reactivity/types.js +0 -1
- package/dist/reactivity/utils.d.ts +7 -4
- package/dist/reactivity/utils.js +25 -24
- package/dist/reactivity/utils.js.map +1 -1
- package/dist/reactivity/watch.d.ts +4 -2
- package/dist/reactivity/watch.js +75 -103
- package/dist/reactivity/watch.js.map +1 -1
- package/dist/runtime/core.d.ts +31 -0
- package/dist/runtime/core.js +156 -0
- package/dist/runtime/core.js.map +1 -0
- package/dist/runtime/index.d.ts +487 -461
- package/dist/runtime/index.js +4129 -5254
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/reactivity.d.ts +7 -0
- package/dist/runtime/reactivity.js +6 -0
- package/dist/runtime/resume.d.ts +79 -0
- package/dist/runtime/resume.js +482 -0
- package/dist/runtime/resume.js.map +1 -0
- package/dist/runtime/router.d.ts +20 -0
- package/dist/runtime/router.js +60 -0
- package/dist/runtime/router.js.map +1 -0
- package/dist/runtime/streaming.d.ts +24 -0
- package/dist/runtime/streaming.js +200 -0
- package/dist/runtime/streaming.js.map +1 -0
- package/dist/security/media-fetch.d.ts +32 -0
- package/dist/security/media-fetch.js +301 -0
- package/dist/security/media-fetch.js.map +1 -0
- package/dist/security/path-boundary.d.ts +7 -0
- package/dist/security/path-boundary.js +70 -0
- package/dist/security/path-boundary.js.map +1 -0
- package/dist/ui/index.d.ts +1580 -1576
- package/dist/ui/index.js +975 -674
- package/dist/ui/index.js.map +1 -1
- package/dist/vite-builder/index.d.ts +6 -3
- package/dist/vite-builder/index.js +6 -2
- package/dist/vite-builder/index.js.map +1 -1
- package/package.json +46 -86
- package/dist/compiler/implementation.js.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/deploy/types.js.map +0 -1
- package/dist/globals.js.map +0 -1
- package/dist/halal-core/index.js.map +0 -1
- package/dist/halal-core/runtime/index.js.map +0 -1
- package/dist/halal-core/runtime/types.js.map +0 -1
- package/dist/halal-core/status.js.map +0 -1
- package/dist/halal.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/reactivity/index.js.map +0 -1
- package/dist/reactivity/readonly.js.map +0 -1
- package/dist/reactivity/types.js.map +0 -1
|
@@ -1,104 +1,106 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ResuxHookName, ResuxHookPayloads, ResuxHooks } from "./hooks.js";
|
|
2
|
+
//#region src/core/module-container.d.ts
|
|
2
3
|
export type ResuxSupportMode = "all" | "server" | "client";
|
|
3
4
|
export declare const RESUX_RUNTIME_CLIENT_PATH = "/__resux/runtime-client.mjs";
|
|
4
5
|
export declare const RESUX_HANDLER_MODULES_PATH = "/__resux/handlers/**";
|
|
5
6
|
export declare const RESUX_VUE_ISLAND_MODULES_PATH = "/__resux/vue-islands/**";
|
|
6
7
|
export declare const RESUX_RUNTIME_CLIENT_CACHE_CONTROL = "no-cache, no-store, must-revalidate";
|
|
7
8
|
export interface ResuxTemplateInput {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
export interface ResuxTypeTemplateInput extends ResuxTemplateInput {
|
|
9
|
+
filename: string;
|
|
10
|
+
getContents: () => string | Promise<string>;
|
|
11
|
+
write?: boolean;
|
|
13
12
|
}
|
|
13
|
+
export interface ResuxTypeTemplateInput extends ResuxTemplateInput {}
|
|
14
14
|
export interface ResuxComponentInput {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
file: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
global?: boolean;
|
|
18
|
+
mode?: ResuxSupportMode;
|
|
19
|
+
lazy?: boolean;
|
|
20
20
|
}
|
|
21
21
|
export interface ResuxComponentsDirInput {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
path: string;
|
|
23
|
+
global?: boolean;
|
|
24
|
+
mode?: ResuxSupportMode;
|
|
25
|
+
pathPrefix?: boolean;
|
|
26
26
|
}
|
|
27
27
|
export interface ResuxImportInput {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
from: string;
|
|
29
|
+
name: string;
|
|
30
|
+
as?: string;
|
|
31
31
|
}
|
|
32
32
|
export interface ResuxPluginInput {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
src: string;
|
|
34
|
+
mode?: ResuxSupportMode;
|
|
35
35
|
}
|
|
36
36
|
export interface ResuxRouteMiddlewareInput {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
name: string;
|
|
38
|
+
src: string;
|
|
39
|
+
global?: boolean;
|
|
40
|
+
mode?: ResuxSupportMode;
|
|
41
41
|
}
|
|
42
42
|
export interface ResuxServerHandlerInput {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
route: string;
|
|
44
|
+
handler: string;
|
|
45
|
+
middleware?: boolean;
|
|
46
|
+
method?: string;
|
|
47
47
|
}
|
|
48
48
|
export interface ResuxPrerenderRouteInput {
|
|
49
|
-
|
|
49
|
+
route: string;
|
|
50
50
|
}
|
|
51
51
|
export type PagesExtender = (pages: Array<Record<string, unknown>>) => void | Promise<void>;
|
|
52
52
|
export type ViteConfigExtender = (config: Record<string, unknown>) => void | Promise<void>;
|
|
53
53
|
export type NitroConfigExtender = (config: Record<string, unknown>) => void | Promise<void>;
|
|
54
54
|
export interface ResuxModuleContributions {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
55
|
+
components: ResuxComponentInput[];
|
|
56
|
+
componentDirs: ResuxComponentsDirInput[];
|
|
57
|
+
imports: ResuxImportInput[];
|
|
58
|
+
importDirs: string[];
|
|
59
|
+
plugins: ResuxPluginInput[];
|
|
60
|
+
middleware: ResuxRouteMiddlewareInput[];
|
|
61
|
+
serverHandlers: ResuxServerHandlerInput[];
|
|
62
|
+
serverPlugins: string[];
|
|
63
|
+
templates: ResuxTemplateInput[];
|
|
64
|
+
typeTemplates: ResuxTypeTemplateInput[];
|
|
65
|
+
pagesExtenders: PagesExtender[];
|
|
66
|
+
runtimeConfigExtends: Record<string, unknown>[];
|
|
67
|
+
viteConfigExtenders: ViteConfigExtender[];
|
|
68
|
+
nitroConfigExtenders: NitroConfigExtender[];
|
|
69
|
+
vitePlugins: unknown[];
|
|
70
|
+
routeRules: Array<{
|
|
71
|
+
path: string;
|
|
72
|
+
rule: Record<string, unknown>;
|
|
73
|
+
}>;
|
|
74
|
+
prerenderRoutes: ResuxPrerenderRouteInput[];
|
|
75
75
|
}
|
|
76
76
|
export interface ResuxModuleContext {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
77
|
+
rootDir: string;
|
|
78
|
+
buildDir: string;
|
|
79
|
+
options: Record<string, unknown>;
|
|
80
|
+
addCss(href: string): void;
|
|
81
|
+
addHead(head: Record<string, unknown>): void;
|
|
82
|
+
addRouteRule(path: string, rule: Record<string, unknown>): void;
|
|
83
|
+
extendRuntimeConfig(config: Record<string, unknown>): void;
|
|
84
|
+
hook<K extends ResuxHookName>(name: K, handler: (payload: ResuxHookPayloads[K]) => void | Promise<void>): () => void;
|
|
85
|
+
addComponent(component: ResuxComponentInput | string): void;
|
|
86
|
+
addComponentsDir(dir: ResuxComponentsDirInput | string): void;
|
|
87
|
+
addImports(imports: ResuxImportInput | ResuxImportInput[]): void;
|
|
88
|
+
addImportsDir(dir: string): void;
|
|
89
|
+
addPlugin(plugin: ResuxPluginInput | string): void;
|
|
90
|
+
addRouteMiddleware(middleware: ResuxRouteMiddlewareInput): void;
|
|
91
|
+
addServerHandler(handler: ResuxServerHandlerInput): void;
|
|
92
|
+
addServerPlugin(plugin: string): void;
|
|
93
|
+
addTemplate(template: ResuxTemplateInput): void;
|
|
94
|
+
addTypeTemplate(template: ResuxTypeTemplateInput): void;
|
|
95
|
+
extendPages(extender: PagesExtender): void;
|
|
96
|
+
extendViteConfig(extender: ViteConfigExtender): void;
|
|
97
|
+
extendNitroConfig(extender: NitroConfigExtender): void;
|
|
98
|
+
addVitePlugin(plugin: unknown): void;
|
|
99
|
+
addPrerenderRoutes(route: string | string[]): void;
|
|
100
100
|
}
|
|
101
101
|
export declare class ResuxModuleContainer {
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
readonly contributions: ResuxModuleContributions;
|
|
103
|
+
createContext(config: Record<string, unknown>, rootDir: string, buildDir: string, hooks: ResuxHooks): ResuxModuleContext;
|
|
104
104
|
}
|
|
105
|
+
//#endregion
|
|
106
|
+
//# sourceMappingURL=module-container.d.ts.map
|
|
@@ -1,198 +1,193 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
//#region src/core/module-container.ts
|
|
2
|
+
const RESUX_RUNTIME_CLIENT_PATH = "/__resux/runtime-client.mjs";
|
|
3
|
+
const RESUX_HANDLER_MODULES_PATH = "/__resux/handlers/**";
|
|
4
|
+
const RESUX_VUE_ISLAND_MODULES_PATH = "/__resux/vue-islands/**";
|
|
5
|
+
const RESUX_RUNTIME_CLIENT_CACHE_CONTROL = "no-cache, no-store, must-revalidate";
|
|
6
|
+
const RESUX_STABLE_RESUMABILITY_ASSET_PATHS = /* @__PURE__ */ new Set([
|
|
7
|
+
RESUX_RUNTIME_CLIENT_PATH,
|
|
8
|
+
RESUX_HANDLER_MODULES_PATH,
|
|
9
|
+
RESUX_VUE_ISLAND_MODULES_PATH
|
|
9
10
|
]);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
11
|
+
var ResuxModuleContainer = class {
|
|
12
|
+
contributions = {
|
|
13
|
+
components: [],
|
|
14
|
+
componentDirs: [],
|
|
15
|
+
imports: [],
|
|
16
|
+
importDirs: [],
|
|
17
|
+
plugins: [],
|
|
18
|
+
middleware: [],
|
|
19
|
+
serverHandlers: [],
|
|
20
|
+
serverPlugins: [],
|
|
21
|
+
templates: [],
|
|
22
|
+
typeTemplates: [],
|
|
23
|
+
pagesExtenders: [],
|
|
24
|
+
runtimeConfigExtends: [],
|
|
25
|
+
viteConfigExtenders: [],
|
|
26
|
+
nitroConfigExtenders: [],
|
|
27
|
+
vitePlugins: [],
|
|
28
|
+
routeRules: [],
|
|
29
|
+
prerenderRoutes: []
|
|
30
|
+
};
|
|
31
|
+
createContext(config, rootDir, buildDir, hooks) {
|
|
32
|
+
return {
|
|
33
|
+
rootDir,
|
|
34
|
+
buildDir,
|
|
35
|
+
options: config,
|
|
36
|
+
addCss: (href) => {
|
|
37
|
+
const css = Array.isArray(config.css) ? config.css : [];
|
|
38
|
+
if (!css.includes(href)) css.push(href);
|
|
39
|
+
config.css = css;
|
|
40
|
+
},
|
|
41
|
+
addHead: (head) => {
|
|
42
|
+
const app = isObject(config.app) ? config.app : {};
|
|
43
|
+
app.head = mergeHead(isObject(app.head) ? app.head : {}, head);
|
|
44
|
+
config.app = app;
|
|
45
|
+
},
|
|
46
|
+
addRouteRule: (path, rule) => {
|
|
47
|
+
if (!path.startsWith("/")) throw new Error(`Route rules need an absolute path. Received "${path}".`);
|
|
48
|
+
const routeRules = isObject(config.routeRules) ? config.routeRules : {};
|
|
49
|
+
const merged = mergeRouteRule(path, isObject(routeRules[path]) ? routeRules[path] : {}, rule);
|
|
50
|
+
routeRules[path] = merged;
|
|
51
|
+
config.routeRules = routeRules;
|
|
52
|
+
this.contributions.routeRules.push({
|
|
53
|
+
path,
|
|
54
|
+
rule: merged
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
extendRuntimeConfig: (runtimeConfig) => {
|
|
58
|
+
this.contributions.runtimeConfigExtends.push(runtimeConfig);
|
|
59
|
+
config.runtimeConfig = deepMergeObjects(isObject(config.runtimeConfig) ? config.runtimeConfig : {}, runtimeConfig);
|
|
60
|
+
},
|
|
61
|
+
hook: (name, handler) => hooks.hook(name, handler),
|
|
62
|
+
addComponent: (component) => {
|
|
63
|
+
if (typeof component === "string") {
|
|
64
|
+
this.contributions.components.push({ file: component });
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this.contributions.components.push(component);
|
|
68
|
+
},
|
|
69
|
+
addComponentsDir: (dir) => {
|
|
70
|
+
if (typeof dir === "string") {
|
|
71
|
+
this.contributions.componentDirs.push({ path: dir });
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this.contributions.componentDirs.push(dir);
|
|
75
|
+
},
|
|
76
|
+
addImports: (imports) => {
|
|
77
|
+
const list = Array.isArray(imports) ? imports : [imports];
|
|
78
|
+
this.contributions.imports.push(...list);
|
|
79
|
+
},
|
|
80
|
+
addImportsDir: (dir) => {
|
|
81
|
+
this.contributions.importDirs.push(dir);
|
|
82
|
+
},
|
|
83
|
+
addPlugin: (plugin) => {
|
|
84
|
+
if (typeof plugin === "string") {
|
|
85
|
+
this.contributions.plugins.push({
|
|
86
|
+
src: plugin,
|
|
87
|
+
mode: "all"
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
this.contributions.plugins.push({
|
|
92
|
+
mode: "all",
|
|
93
|
+
...plugin
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
addRouteMiddleware: (middleware) => {
|
|
97
|
+
this.contributions.middleware.push(middleware);
|
|
98
|
+
},
|
|
99
|
+
addServerHandler: (handler) => {
|
|
100
|
+
this.contributions.serverHandlers.push(handler);
|
|
101
|
+
},
|
|
102
|
+
addServerPlugin: (plugin) => {
|
|
103
|
+
this.contributions.serverPlugins.push(plugin);
|
|
104
|
+
},
|
|
105
|
+
addTemplate: (template) => {
|
|
106
|
+
this.contributions.templates.push(template);
|
|
107
|
+
},
|
|
108
|
+
addTypeTemplate: (template) => {
|
|
109
|
+
this.contributions.typeTemplates.push(template);
|
|
110
|
+
},
|
|
111
|
+
extendPages: (extender) => {
|
|
112
|
+
this.contributions.pagesExtenders.push(extender);
|
|
113
|
+
},
|
|
114
|
+
extendViteConfig: (extender) => {
|
|
115
|
+
this.contributions.viteConfigExtenders.push(extender);
|
|
116
|
+
},
|
|
117
|
+
extendNitroConfig: (extender) => {
|
|
118
|
+
this.contributions.nitroConfigExtenders.push(extender);
|
|
119
|
+
},
|
|
120
|
+
addVitePlugin: (plugin) => {
|
|
121
|
+
this.contributions.vitePlugins.push(plugin);
|
|
122
|
+
},
|
|
123
|
+
addPrerenderRoutes: (route) => {
|
|
124
|
+
const list = Array.isArray(route) ? route : [route];
|
|
125
|
+
for (const item of list) this.contributions.prerenderRoutes.push({ route: item });
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
};
|
|
129
130
|
function mergeRouteRule(routePath, current, next) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
...current,
|
|
150
|
-
...next,
|
|
151
|
-
headers,
|
|
152
|
-
};
|
|
131
|
+
const headers = {
|
|
132
|
+
...isObject(current.headers) ? current.headers : {},
|
|
133
|
+
...isObject(next.headers) ? next.headers : {}
|
|
134
|
+
};
|
|
135
|
+
if (RESUX_STABLE_RESUMABILITY_ASSET_PATHS.has(routePath)) {
|
|
136
|
+
for (const key of Object.keys(headers)) if (key.toLowerCase() === "cache-control") delete headers[key];
|
|
137
|
+
headers["cache-control"] = RESUX_RUNTIME_CLIENT_CACHE_CONTROL;
|
|
138
|
+
return {
|
|
139
|
+
...current,
|
|
140
|
+
...next,
|
|
141
|
+
cache: false,
|
|
142
|
+
headers
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
...current,
|
|
147
|
+
...next,
|
|
148
|
+
headers
|
|
149
|
+
};
|
|
153
150
|
}
|
|
154
151
|
function mergeHead(current, next) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
152
|
+
return {
|
|
153
|
+
...current,
|
|
154
|
+
...next,
|
|
155
|
+
meta: mergeHeadArray(current.meta, next.meta),
|
|
156
|
+
link: mergeHeadArray(current.link, next.link),
|
|
157
|
+
style: mergeHeadArray(current.style, next.style),
|
|
158
|
+
script: mergeHeadArray(current.script, next.script),
|
|
159
|
+
noscript: mergeHeadArray(current.noscript, next.noscript),
|
|
160
|
+
htmlAttrs: {
|
|
161
|
+
...isObject(current.htmlAttrs) ? current.htmlAttrs : {},
|
|
162
|
+
...isObject(next.htmlAttrs) ? next.htmlAttrs : {}
|
|
163
|
+
},
|
|
164
|
+
bodyAttrs: {
|
|
165
|
+
...isObject(current.bodyAttrs) ? current.bodyAttrs : {},
|
|
166
|
+
...isObject(next.bodyAttrs) ? next.bodyAttrs : {}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
172
169
|
}
|
|
173
170
|
function mergeHeadArray(current, next) {
|
|
174
|
-
|
|
175
|
-
...(Array.isArray(current) ? current : []),
|
|
176
|
-
...(Array.isArray(next) ? next : []),
|
|
177
|
-
];
|
|
171
|
+
return [...Array.isArray(current) ? current : [], ...Array.isArray(next) ? next : []];
|
|
178
172
|
}
|
|
179
173
|
function isObject(value) {
|
|
180
|
-
|
|
174
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
181
175
|
}
|
|
182
|
-
const FORBIDDEN_OBJECT_KEYS = new Set([
|
|
176
|
+
const FORBIDDEN_OBJECT_KEYS = /* @__PURE__ */ new Set([
|
|
177
|
+
"__proto__",
|
|
178
|
+
"prototype",
|
|
179
|
+
"constructor"
|
|
180
|
+
]);
|
|
183
181
|
function deepMergeObjects(base, next) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
: undefined;
|
|
192
|
-
output[key] = isObject(current) && isObject(value)
|
|
193
|
-
? deepMergeObjects(current, value)
|
|
194
|
-
: value;
|
|
195
|
-
}
|
|
196
|
-
return output;
|
|
182
|
+
const output = { ...base };
|
|
183
|
+
for (const [key, value] of Object.entries(next)) {
|
|
184
|
+
if (FORBIDDEN_OBJECT_KEYS.has(key)) throw new Error(`Runtime config contains unsafe key "${key}".`);
|
|
185
|
+
const current = Object.hasOwn(output, key) ? output[key] : void 0;
|
|
186
|
+
output[key] = isObject(current) && isObject(value) ? deepMergeObjects(current, value) : value;
|
|
187
|
+
}
|
|
188
|
+
return output;
|
|
197
189
|
}
|
|
190
|
+
//#endregion
|
|
191
|
+
export { RESUX_HANDLER_MODULES_PATH, RESUX_RUNTIME_CLIENT_CACHE_CONTROL, RESUX_RUNTIME_CLIENT_PATH, RESUX_VUE_ISLAND_MODULES_PATH, ResuxModuleContainer };
|
|
192
|
+
|
|
198
193
|
//# sourceMappingURL=module-container.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-container.js","sourceRoot":"","sources":["../../src/core/module-container.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,yBAAyB,GAAG,6BAA6B,CAAC;AACvE,MAAM,CAAC,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AACjE,MAAM,CAAC,MAAM,6BAA6B,GAAG,yBAAyB,CAAC;AACvE,MAAM,CAAC,MAAM,kCAAkC,GAAG,qCAAqC,CAAC;AAExF,MAAM,qCAAqC,GAAG,IAAI,GAAG,CAAC;IACpD,yBAAyB;IACzB,0BAA0B;IAC1B,6BAA6B;CAC9B,CAAC,CAAC;AAwGH,MAAM,OAAO,oBAAoB;IACtB,aAAa,GAA6B;QACjD,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,EAAE;QACjB,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,EAAE;QACd,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,EAAE;QACd,cAAc,EAAE,EAAE;QAClB,aAAa,EAAE,EAAE;QACjB,SAAS,EAAE,EAAE;QACb,aAAa,EAAE,EAAE;QACjB,cAAc,EAAE,EAAE;QAClB,oBAAoB,EAAE,EAAE;QACxB,mBAAmB,EAAE,EAAE;QACvB,oBAAoB,EAAE,EAAE;QACxB,WAAW,EAAE,EAAE;QACf,UAAU,EAAE,EAAE;QACd,eAAe,EAAE,EAAE;KACpB,CAAC;IAEF,aAAa,CACX,MAA+B,EAC/B,OAAe,EACf,QAAgB,EAChB,KAAiB;QAEjB,OAAO;YACL,OAAO;YACP,QAAQ;YACR,OAAO,EAAE,MAAM;YACf,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACf,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CA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CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,IAAI,qBAAqB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,uCAAuC,GAAG,IAAI,CAAC,CAAC;QAClE,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;YACxC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;YACb,CAAC,CAAC,SAAS,CAAC;QACd,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC;YAChD,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC;YAClC,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"module-container.js","names":[],"sources":["../../src/core/module-container.ts"],"sourcesContent":["import type { ResuxHooks, ResuxHookName, ResuxHookPayloads } from \"./hooks.js\";\n\nexport type ResuxSupportMode = \"all\" | \"server\" | \"client\";\n\nexport const RESUX_RUNTIME_CLIENT_PATH = \"/__resux/runtime-client.mjs\";\nexport const RESUX_HANDLER_MODULES_PATH = \"/__resux/handlers/**\";\nexport const RESUX_VUE_ISLAND_MODULES_PATH = \"/__resux/vue-islands/**\";\nexport const RESUX_RUNTIME_CLIENT_CACHE_CONTROL = \"no-cache, no-store, must-revalidate\";\n\nconst RESUX_STABLE_RESUMABILITY_ASSET_PATHS = new Set([\n RESUX_RUNTIME_CLIENT_PATH,\n RESUX_HANDLER_MODULES_PATH,\n RESUX_VUE_ISLAND_MODULES_PATH,\n]);\n\nexport interface ResuxTemplateInput {\n filename: string;\n getContents: () => string | Promise<string>;\n write?: boolean;\n}\n\nexport interface ResuxTypeTemplateInput extends ResuxTemplateInput {}\n\nexport interface ResuxComponentInput {\n file: string;\n name?: string;\n global?: boolean;\n mode?: ResuxSupportMode;\n lazy?: boolean;\n}\n\nexport interface ResuxComponentsDirInput {\n path: string;\n global?: boolean;\n mode?: ResuxSupportMode;\n pathPrefix?: boolean;\n}\n\nexport interface ResuxImportInput {\n from: string;\n name: string;\n as?: string;\n}\n\nexport interface ResuxPluginInput {\n src: string;\n mode?: ResuxSupportMode;\n}\n\nexport interface ResuxRouteMiddlewareInput {\n name: string;\n src: string;\n global?: boolean;\n mode?: ResuxSupportMode;\n}\n\nexport interface ResuxServerHandlerInput {\n route: string;\n handler: string;\n middleware?: boolean;\n method?: string;\n}\n\nexport interface ResuxPrerenderRouteInput {\n route: string;\n}\n\nexport type PagesExtender = (pages: Array<Record<string, unknown>>) => void | Promise<void>;\nexport type ViteConfigExtender = (config: Record<string, unknown>) => void | Promise<void>;\nexport type NitroConfigExtender = (config: Record<string, unknown>) => void | Promise<void>;\n\nexport interface ResuxModuleContributions {\n components: ResuxComponentInput[];\n componentDirs: ResuxComponentsDirInput[];\n imports: ResuxImportInput[];\n importDirs: string[];\n plugins: ResuxPluginInput[];\n middleware: ResuxRouteMiddlewareInput[];\n serverHandlers: ResuxServerHandlerInput[];\n serverPlugins: string[];\n templates: ResuxTemplateInput[];\n typeTemplates: ResuxTypeTemplateInput[];\n pagesExtenders: PagesExtender[];\n runtimeConfigExtends: Record<string, unknown>[];\n viteConfigExtenders: ViteConfigExtender[];\n nitroConfigExtenders: NitroConfigExtender[];\n vitePlugins: unknown[];\n routeRules: Array<{ path: string; rule: Record<string, unknown> }>;\n prerenderRoutes: ResuxPrerenderRouteInput[];\n}\n\nexport interface ResuxModuleContext {\n rootDir: string;\n buildDir: string;\n options: Record<string, unknown>;\n addCss(href: string): void;\n addHead(head: Record<string, unknown>): void;\n addRouteRule(path: string, rule: Record<string, unknown>): void;\n extendRuntimeConfig(config: Record<string, unknown>): void;\n hook<K extends ResuxHookName>(name: K, handler: (payload: ResuxHookPayloads[K]) => void | Promise<void>): () => void;\n addComponent(component: ResuxComponentInput | string): void;\n addComponentsDir(dir: ResuxComponentsDirInput | string): void;\n addImports(imports: ResuxImportInput | ResuxImportInput[]): void;\n addImportsDir(dir: string): void;\n addPlugin(plugin: ResuxPluginInput | string): void;\n addRouteMiddleware(middleware: ResuxRouteMiddlewareInput): void;\n addServerHandler(handler: ResuxServerHandlerInput): void;\n addServerPlugin(plugin: string): void;\n addTemplate(template: ResuxTemplateInput): void;\n addTypeTemplate(template: ResuxTypeTemplateInput): void;\n extendPages(extender: PagesExtender): void;\n extendViteConfig(extender: ViteConfigExtender): void;\n extendNitroConfig(extender: NitroConfigExtender): void;\n addVitePlugin(plugin: unknown): void;\n addPrerenderRoutes(route: string | string[]): void;\n}\n\nexport class ResuxModuleContainer {\n readonly contributions: ResuxModuleContributions = {\n components: [],\n componentDirs: [],\n imports: [],\n importDirs: [],\n plugins: [],\n middleware: [],\n serverHandlers: [],\n serverPlugins: [],\n templates: [],\n typeTemplates: [],\n pagesExtenders: [],\n runtimeConfigExtends: [],\n viteConfigExtenders: [],\n nitroConfigExtenders: [],\n vitePlugins: [],\n routeRules: [],\n prerenderRoutes: []\n };\n\n createContext(\n config: Record<string, unknown>,\n rootDir: string,\n buildDir: string,\n hooks: ResuxHooks\n ): ResuxModuleContext {\n return {\n rootDir,\n buildDir,\n options: config,\n addCss: (href) => {\n const css = Array.isArray(config.css) ? config.css : [];\n if (!css.includes(href)) {\n css.push(href);\n }\n config.css = css;\n },\n addHead: (head) => {\n const app = isObject(config.app) ? config.app : {};\n const current = isObject(app.head) ? app.head : {};\n app.head = mergeHead(current, head);\n config.app = app;\n },\n addRouteRule: (path, rule) => {\n if (!path.startsWith(\"/\")) {\n throw new Error(`Route rules need an absolute path. Received \"${path}\".`);\n }\n const routeRules = isObject(config.routeRules) ? config.routeRules : {};\n const current = isObject(routeRules[path]) ? routeRules[path] : {};\n const merged = mergeRouteRule(path, current, rule);\n routeRules[path] = merged;\n config.routeRules = routeRules;\n this.contributions.routeRules.push({ path, rule: merged });\n },\n extendRuntimeConfig: (runtimeConfig) => {\n this.contributions.runtimeConfigExtends.push(runtimeConfig);\n const current = isObject(config.runtimeConfig) ? config.runtimeConfig : {};\n config.runtimeConfig = deepMergeObjects(current, runtimeConfig);\n },\n hook: (name, handler) => hooks.hook(name, handler),\n addComponent: (component) => {\n if (typeof component === \"string\") {\n this.contributions.components.push({ file: component });\n return;\n }\n this.contributions.components.push(component);\n },\n addComponentsDir: (dir) => {\n if (typeof dir === \"string\") {\n this.contributions.componentDirs.push({ path: dir });\n return;\n }\n this.contributions.componentDirs.push(dir);\n },\n addImports: (imports) => {\n const list = Array.isArray(imports) ? imports : [imports];\n this.contributions.imports.push(...list);\n },\n addImportsDir: (dir) => {\n this.contributions.importDirs.push(dir);\n },\n addPlugin: (plugin) => {\n if (typeof plugin === \"string\") {\n this.contributions.plugins.push({ src: plugin, mode: \"all\" });\n return;\n }\n this.contributions.plugins.push({ mode: \"all\", ...plugin });\n },\n addRouteMiddleware: (middleware) => {\n this.contributions.middleware.push(middleware);\n },\n addServerHandler: (handler) => {\n this.contributions.serverHandlers.push(handler);\n },\n addServerPlugin: (plugin) => {\n this.contributions.serverPlugins.push(plugin);\n },\n addTemplate: (template) => {\n this.contributions.templates.push(template);\n },\n addTypeTemplate: (template) => {\n this.contributions.typeTemplates.push(template);\n },\n extendPages: (extender) => {\n this.contributions.pagesExtenders.push(extender);\n },\n extendViteConfig: (extender) => {\n this.contributions.viteConfigExtenders.push(extender);\n },\n extendNitroConfig: (extender) => {\n this.contributions.nitroConfigExtenders.push(extender);\n },\n addVitePlugin: (plugin) => {\n this.contributions.vitePlugins.push(plugin);\n },\n addPrerenderRoutes: (route) => {\n const list = Array.isArray(route) ? route : [route];\n for (const item of list) {\n this.contributions.prerenderRoutes.push({ route: item });\n }\n }\n };\n }\n}\n\nfunction mergeRouteRule(\n routePath: string,\n current: Record<string, unknown>,\n next: Record<string, unknown>,\n): Record<string, unknown> {\n const headers: Record<string, unknown> = {\n ...(isObject(current.headers) ? current.headers : {}),\n ...(isObject(next.headers) ? next.headers : {}),\n };\n\n if (RESUX_STABLE_RESUMABILITY_ASSET_PATHS.has(routePath)) {\n for (const key of Object.keys(headers)) {\n if (key.toLowerCase() === \"cache-control\") {\n delete headers[key];\n }\n }\n headers[\"cache-control\"] = RESUX_RUNTIME_CLIENT_CACHE_CONTROL;\n return {\n ...current,\n ...next,\n cache: false,\n headers,\n };\n }\n\n return {\n ...current,\n ...next,\n headers,\n };\n}\n\nfunction mergeHead(current: Record<string, unknown>, next: Record<string, unknown>): Record<string, unknown> {\n return {\n ...current,\n ...next,\n meta: mergeHeadArray(current.meta, next.meta),\n link: mergeHeadArray(current.link, next.link),\n style: mergeHeadArray(current.style, next.style),\n script: mergeHeadArray(current.script, next.script),\n noscript: mergeHeadArray(current.noscript, next.noscript),\n htmlAttrs: {\n ...(isObject(current.htmlAttrs) ? current.htmlAttrs : {}),\n ...(isObject(next.htmlAttrs) ? next.htmlAttrs : {}),\n },\n bodyAttrs: {\n ...(isObject(current.bodyAttrs) ? current.bodyAttrs : {}),\n ...(isObject(next.bodyAttrs) ? next.bodyAttrs : {}),\n },\n };\n}\n\nfunction mergeHeadArray(current: unknown, next: unknown): unknown[] {\n return [\n ...(Array.isArray(current) ? current : []),\n ...(Array.isArray(next) ? next : []),\n ];\n}\n\nfunction isObject(value: unknown): value is Record<string, any> {\n return Boolean(value && typeof value === \"object\" && !Array.isArray(value));\n}\n\nconst FORBIDDEN_OBJECT_KEYS = new Set([\"__proto__\", \"prototype\", \"constructor\"]);\n\nfunction deepMergeObjects(base: Record<string, unknown>, next: Record<string, unknown>): Record<string, unknown> {\n const output: Record<string, unknown> = { ...base };\n for (const [key, value] of Object.entries(next)) {\n if (FORBIDDEN_OBJECT_KEYS.has(key)) {\n throw new Error(`Runtime config contains unsafe key \"${key}\".`);\n }\n const current = Object.hasOwn(output, key)\n ? output[key]\n : undefined;\n output[key] = isObject(current) && isObject(value)\n ? deepMergeObjects(current, value)\n : value;\n }\n return output;\n}\n"],"mappings":";AAIA,MA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