resuxjs 0.4.0-beta.5 → 0.4.0-beta.7
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 +55 -13
- package/dist/bin.d.ts +1 -1
- package/dist/bin.js +2 -4
- package/dist/bin.js.map +1 -1
- package/dist/build/index.d.ts +8 -11
- package/dist/build/index.js +3 -4
- package/dist/build/index.js.map +1 -1
- package/dist/cli.d.ts +7 -8
- package/dist/cli.js +170 -135
- package/dist/cli.js.map +1 -1
- package/dist/compiler/adapter.d.ts +5 -8
- package/dist/compiler/adapter.js +2 -4
- package/dist/compiler/adapter.js.map +1 -1
- package/dist/compiler/dev-warnings.d.ts +5 -8
- package/dist/compiler/dev-warnings.js +7 -9
- package/dist/compiler/dev-warnings.js.map +1 -1
- package/dist/compiler/directives.d.ts +3 -6
- package/dist/compiler/directives.js +2 -4
- package/dist/compiler/directives.js.map +1 -1
- package/dist/compiler/implementation.d.ts +22 -24
- package/dist/compiler/implementation.js +302 -142
- package/dist/compiler/index.d.ts +5 -8
- package/dist/compiler/index.js +2 -4
- package/dist/compiler/index.js.map +1 -1
- package/dist/core/config.d.ts +5 -9
- package/dist/core/config.js +2 -3
- package/dist/core/config.js.map +1 -1
- package/dist/core/hooks.d.ts +6 -9
- package/dist/core/hooks.js +2 -3
- package/dist/core/hooks.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -2
- package/dist/core/module-container.d.ts +20 -24
- package/dist/core/module-container.js +4 -5
- package/dist/core/module-container.js.map +1 -1
- package/dist/core/resux.d.ts +4 -8
- package/dist/core/resux.js +2 -4
- package/dist/core/resux.js.map +1 -1
- package/dist/create-bin.d.ts +1 -1
- package/dist/create-bin.js +2 -4
- package/dist/create-bin.js.map +1 -1
- package/dist/create.d.ts +2 -5
- package/dist/create.js +15 -10
- package/dist/create.js.map +1 -1
- package/dist/deploy/cloudflare.d.ts +1 -5
- package/dist/deploy/cloudflare.js +2 -4
- package/dist/deploy/cloudflare.js.map +1 -1
- package/dist/deploy/common.d.ts +12 -15
- package/dist/deploy/common.js +2 -4
- package/dist/deploy/common.js.map +1 -1
- package/dist/deploy/framework-runtime.d.ts +1 -4
- package/dist/deploy/framework-runtime.js +2 -4
- package/dist/deploy/framework-runtime.js.map +1 -1
- package/dist/deploy/index.d.ts +2 -6
- package/dist/deploy/index.js +7 -6
- package/dist/deploy/index.js.map +1 -1
- package/dist/deploy/netlify.d.ts +1 -5
- package/dist/deploy/netlify.js +3 -5
- package/dist/deploy/netlify.js.map +1 -1
- package/dist/deploy/node.d.ts +1 -5
- package/dist/deploy/node.js +4 -5
- package/dist/deploy/node.js.map +1 -1
- package/dist/deploy/production-report.d.ts +1 -4
- package/dist/deploy/production-report.js +2 -4
- package/dist/deploy/production-report.js.map +1 -1
- package/dist/deploy/runtime-dependencies.d.ts +4 -7
- package/dist/deploy/runtime-dependencies.js +4 -5
- package/dist/deploy/runtime-dependencies.js.map +1 -1
- package/dist/deploy/static.d.ts +1 -5
- package/dist/deploy/static.js +2 -4
- package/dist/deploy/static.js.map +1 -1
- package/dist/deploy/types.d.ts +7 -10
- package/dist/deploy/types.js +1 -1
- package/dist/deploy/vercel.d.ts +2 -6
- package/dist/deploy/vercel.js +3 -5
- package/dist/deploy/vercel.js.map +1 -1
- package/dist/fonts/index.d.ts +60 -11
- package/dist/fonts/index.js +470 -72
- package/dist/fonts/index.js.map +1 -1
- package/dist/globals.d.ts +1 -3
- package/dist/globals.js +1 -1
- package/dist/halal-core/ai/classifyProject.d.ts +3 -7
- package/dist/halal-core/ai/classifyProject.js +2 -4
- package/dist/halal-core/ai/classifyProject.js.map +1 -1
- package/dist/halal-core/ai/classifyRuntimeContent.d.ts +1 -5
- package/dist/halal-core/ai/classifyRuntimeContent.js +3 -5
- package/dist/halal-core/ai/classifyRuntimeContent.js.map +1 -1
- package/dist/halal-core/ai/createProjectSummary.d.ts +1 -4
- package/dist/halal-core/ai/createProjectSummary.js +2 -4
- package/dist/halal-core/ai/createProjectSummary.js.map +1 -1
- package/dist/halal-core/ai/halalClassifierPrompt.d.ts +1 -4
- package/dist/halal-core/ai/halalClassifierPrompt.js +2 -3
- package/dist/halal-core/ai/redactSensitiveData.d.ts +1 -4
- package/dist/halal-core/ai/redactSensitiveData.js +2 -3
- package/dist/halal-core/ai/redactSensitiveData.js.map +1 -1
- package/dist/halal-core/ai/validateAiResponse.d.ts +1 -5
- package/dist/halal-core/ai/validateAiResponse.js +4 -5
- package/dist/halal-core/ai/validateAiResponse.js.map +1 -1
- package/dist/halal-core/cli/check.d.ts +1 -4
- package/dist/halal-core/cli/check.js +5 -6
- package/dist/halal-core/cli/check.js.map +1 -1
- package/dist/halal-core/cli/explain.d.ts +1 -4
- package/dist/halal-core/cli/explain.js +5 -6
- package/dist/halal-core/cli/explain.js.map +1 -1
- package/dist/halal-core/cli/report.d.ts +1 -4
- package/dist/halal-core/cli/report.js +5 -6
- package/dist/halal-core/cli/report.js.map +1 -1
- package/dist/halal-core/cli/submitReview.d.ts +1 -4
- package/dist/halal-core/cli/submitReview.js +5 -6
- package/dist/halal-core/cli/submitReview.js.map +1 -1
- package/dist/halal-core/cli/verifyReview.d.ts +1 -4
- package/dist/halal-core/cli/verifyReview.js +7 -7
- package/dist/halal-core/cli/verifyReview.js.map +1 -1
- package/dist/halal-core/config.d.ts +9 -11
- package/dist/halal-core/config.js +46 -11
- package/dist/halal-core/config.js.map +1 -1
- package/dist/halal-core/crypto/integrity.d.ts +5 -8
- package/dist/halal-core/crypto/integrity.js +2 -4
- package/dist/halal-core/crypto/integrity.js.map +1 -1
- package/dist/halal-core/enforce.d.ts +5 -8
- package/dist/halal-core/enforce.js +17 -16
- package/dist/halal-core/enforce.js.map +1 -1
- package/dist/halal-core/index.d.ts +6 -6
- package/dist/halal-core/index.js +8 -9
- package/dist/halal-core/lifecycle.d.ts +1 -4
- package/dist/halal-core/lifecycle.js +2 -4
- package/dist/halal-core/lifecycle.js.map +1 -1
- package/dist/halal-core/policy.d.ts +1 -5
- package/dist/halal-core/policy.js +2 -4
- package/dist/halal-core/policy.js.map +1 -1
- package/dist/halal-core/report/formatBrowserOverlay.d.ts +1 -5
- package/dist/halal-core/report/formatBrowserOverlay.js +2 -3
- package/dist/halal-core/report/formatBrowserOverlay.js.map +1 -1
- package/dist/halal-core/report/formatTerminalReport.d.ts +1 -5
- package/dist/halal-core/report/formatTerminalReport.js +2 -3
- package/dist/halal-core/report/formatTerminalReport.js.map +1 -1
- package/dist/halal-core/report/generateHalalReport.d.ts +2 -6
- package/dist/halal-core/report/generateHalalReport.js +8 -7
- package/dist/halal-core/report/generateHalalReport.js.map +1 -1
- package/dist/halal-core/report/signReport.d.ts +2 -6
- package/dist/halal-core/report/signReport.js +2 -4
- package/dist/halal-core/report/signReport.js.map +1 -1
- package/dist/halal-core/report/verifyReport.d.ts +3 -7
- package/dist/halal-core/report/verifyReport.js +4 -6
- package/dist/halal-core/report/verifyReport.js.map +1 -1
- package/dist/halal-core/review/createReviewRequest.d.ts +1 -5
- package/dist/halal-core/review/createReviewRequest.js +4 -5
- package/dist/halal-core/review/createReviewRequest.js.map +1 -1
- package/dist/halal-core/review/reviewPolicy.d.ts +3 -6
- package/dist/halal-core/review/reviewPolicy.js +2 -3
- package/dist/halal-core/review/reviewPolicy.js.map +1 -1
- package/dist/halal-core/review/signedReviewFile.d.ts +4 -8
- package/dist/halal-core/review/signedReviewFile.js +2 -4
- package/dist/halal-core/review/signedReviewFile.js.map +1 -1
- package/dist/halal-core/review/verifyReviewApproval.d.ts +2 -5
- package/dist/halal-core/review/verifyReviewApproval.js +2 -4
- package/dist/halal-core/review/verifyReviewApproval.js.map +1 -1
- package/dist/halal-core/rules/adultContentRules.d.ts +2 -5
- package/dist/halal-core/rules/adultContentRules.js +2 -3
- package/dist/halal-core/rules/adultContentRules.js.map +1 -1
- package/dist/halal-core/rules/alcoholDrugVapeRules.d.ts +2 -5
- package/dist/halal-core/rules/alcoholDrugVapeRules.js +2 -3
- package/dist/halal-core/rules/alcoholDrugVapeRules.js.map +1 -1
- package/dist/halal-core/rules/childSafetyRules.d.ts +2 -5
- package/dist/halal-core/rules/childSafetyRules.js +2 -3
- package/dist/halal-core/rules/childSafetyRules.js.map +1 -1
- package/dist/halal-core/rules/coreCategories.d.ts +2 -5
- package/dist/halal-core/rules/coreCategories.js +2 -3
- package/dist/halal-core/rules/coreCategories.js.map +1 -1
- package/dist/halal-core/rules/cyberAbuseRules.d.ts +2 -5
- package/dist/halal-core/rules/cyberAbuseRules.js +2 -3
- package/dist/halal-core/rules/cyberAbuseRules.js.map +1 -1
- package/dist/halal-core/rules/defaultBlockedRules.d.ts +1 -5
- package/dist/halal-core/rules/defaultBlockedRules.js +12 -11
- package/dist/halal-core/rules/defaultBlockedRules.js.map +1 -1
- package/dist/halal-core/rules/dependencyRules.d.ts +2 -5
- package/dist/halal-core/rules/dependencyRules.js +2 -3
- package/dist/halal-core/rules/dependencyRules.js.map +1 -1
- package/dist/halal-core/rules/endpointRules.d.ts +2 -5
- package/dist/halal-core/rules/endpointRules.js +2 -3
- package/dist/halal-core/rules/endpointRules.js.map +1 -1
- package/dist/halal-core/rules/environmentalHarmRules.d.ts +2 -5
- package/dist/halal-core/rules/environmentalHarmRules.js +2 -3
- package/dist/halal-core/rules/environmentalHarmRules.js.map +1 -1
- package/dist/halal-core/rules/financeRibaRules.d.ts +2 -5
- package/dist/halal-core/rules/financeRibaRules.js +2 -3
- package/dist/halal-core/rules/financeRibaRules.js.map +1 -1
- package/dist/halal-core/rules/gamblingRules.d.ts +2 -5
- package/dist/halal-core/rules/gamblingRules.js +2 -3
- package/dist/halal-core/rules/gamblingRules.js.map +1 -1
- package/dist/halal-core/rules/generalHarmRules.d.ts +2 -5
- package/dist/halal-core/rules/generalHarmRules.js +2 -3
- package/dist/halal-core/rules/generalHarmRules.js.map +1 -1
- package/dist/halal-core/rules/healthHarmRules.d.ts +2 -5
- package/dist/halal-core/rules/healthHarmRules.js +2 -3
- package/dist/halal-core/rules/healthHarmRules.js.map +1 -1
- package/dist/halal-core/rules/keywordRules.d.ts +1 -4
- package/dist/halal-core/rules/keywordRules.js +2 -3
- package/dist/halal-core/rules/keywordRules.js.map +1 -1
- package/dist/halal-core/rules/privacyAbuseRules.d.ts +2 -5
- package/dist/halal-core/rules/privacyAbuseRules.js +2 -3
- package/dist/halal-core/rules/privacyAbuseRules.js.map +1 -1
- package/dist/halal-core/rules/scamFraudRules.d.ts +2 -5
- package/dist/halal-core/rules/scamFraudRules.js +2 -3
- package/dist/halal-core/rules/scamFraudRules.js.map +1 -1
- package/dist/halal-core/rules/selfHarmRules.d.ts +2 -5
- package/dist/halal-core/rules/selfHarmRules.js +2 -3
- package/dist/halal-core/rules/selfHarmRules.js.map +1 -1
- package/dist/halal-core/rules/violenceExtremismRules.d.ts +2 -5
- package/dist/halal-core/rules/violenceExtremismRules.js +2 -3
- package/dist/halal-core/rules/violenceExtremismRules.js.map +1 -1
- package/dist/halal-core/runtime/guard.d.ts +3 -7
- package/dist/halal-core/runtime/guard.js +5 -7
- package/dist/halal-core/runtime/guard.js.map +1 -1
- package/dist/halal-core/runtime/index.js +1 -2
- package/dist/halal-core/runtime/reviewedMemory.d.ts +4 -8
- package/dist/halal-core/runtime/reviewedMemory.js +3 -5
- package/dist/halal-core/runtime/reviewedMemory.js.map +1 -1
- package/dist/halal-core/runtime/serializeRuntimeContent.d.ts +5 -9
- package/dist/halal-core/runtime/serializeRuntimeContent.js +4 -6
- package/dist/halal-core/runtime/serializeRuntimeContent.js.map +1 -1
- package/dist/halal-core/runtime/types.d.ts +9 -13
- package/dist/halal-core/runtime/types.js +1 -1
- package/dist/halal-core/scanner/scanApiRoutes.d.ts +1 -4
- package/dist/halal-core/scanner/scanApiRoutes.js +2 -4
- package/dist/halal-core/scanner/scanApiRoutes.js.map +1 -1
- package/dist/halal-core/scanner/scanComponents.d.ts +1 -4
- package/dist/halal-core/scanner/scanComponents.js +2 -4
- package/dist/halal-core/scanner/scanComponents.js.map +1 -1
- package/dist/halal-core/scanner/scanContent.d.ts +2 -5
- package/dist/halal-core/scanner/scanContent.js +4 -6
- package/dist/halal-core/scanner/scanContent.js.map +1 -1
- package/dist/halal-core/scanner/scanDependencies.d.ts +1 -4
- package/dist/halal-core/scanner/scanDependencies.js +2 -4
- package/dist/halal-core/scanner/scanDependencies.js.map +1 -1
- package/dist/halal-core/scanner/scanDomains.d.ts +1 -4
- package/dist/halal-core/scanner/scanDomains.js +2 -3
- package/dist/halal-core/scanner/scanDomains.js.map +1 -1
- package/dist/halal-core/scanner/scanEnvNames.d.ts +1 -4
- package/dist/halal-core/scanner/scanEnvNames.js +2 -4
- package/dist/halal-core/scanner/scanEnvNames.js.map +1 -1
- package/dist/halal-core/scanner/scanMetadata.d.ts +2 -5
- package/dist/halal-core/scanner/scanMetadata.js +2 -4
- package/dist/halal-core/scanner/scanMetadata.js.map +1 -1
- package/dist/halal-core/scanner/scanPages.d.ts +1 -4
- package/dist/halal-core/scanner/scanPages.js +2 -4
- package/dist/halal-core/scanner/scanPages.js.map +1 -1
- package/dist/halal-core/scanner/scanProject.d.ts +2 -6
- package/dist/halal-core/scanner/scanProject.js +2 -4
- package/dist/halal-core/scanner/scanProject.js.map +1 -1
- package/dist/halal-core/scanner/scanRoutes.d.ts +1 -4
- package/dist/halal-core/scanner/scanRoutes.js +2 -4
- package/dist/halal-core/scanner/scanRoutes.js.map +1 -1
- package/dist/halal-core/scanner/scanTranslations.d.ts +1 -4
- package/dist/halal-core/scanner/scanTranslations.js +2 -4
- package/dist/halal-core/scanner/scanTranslations.js.map +1 -1
- package/dist/halal-core/status.d.ts +2 -5
- package/dist/halal-core/status.js +1 -1
- package/dist/halal-core/tamper/verifyCoreIntegrity.d.ts +1 -4
- package/dist/halal-core/tamper/verifyCoreIntegrity.js +2 -4
- package/dist/halal-core/tamper/verifyCoreIntegrity.js.map +1 -1
- package/dist/halal-core/tamper/verifyLifecycleHooks.d.ts +1 -4
- package/dist/halal-core/tamper/verifyLifecycleHooks.js +2 -3
- package/dist/halal-core/tamper/verifyLifecycleHooks.js.map +1 -1
- package/dist/halal-core/tamper/verifyReportSignature.d.ts +1 -5
- package/dist/halal-core/tamper/verifyReportSignature.js +4 -5
- package/dist/halal-core/tamper/verifyReportSignature.js.map +1 -1
- package/dist/halal.d.ts +2 -2
- package/dist/halal.js +2 -3
- package/dist/i18n/index.d.ts +11 -14
- package/dist/i18n/index.js +9 -9
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/shared.d.ts +14 -17
- package/dist/i18n/shared.js +5 -6
- package/dist/i18n/shared.js.map +1 -1
- package/dist/icons/api-fetcher.d.ts +4 -0
- package/dist/icons/api-fetcher.js +77 -0
- package/dist/icons/api-fetcher.js.map +1 -0
- package/dist/icons/cache.d.ts +22 -0
- package/dist/icons/cache.js +74 -0
- package/dist/icons/cache.js.map +1 -0
- package/dist/icons/component.d.ts +157 -0
- package/dist/icons/component.js +139 -0
- package/dist/icons/component.js.map +1 -0
- package/dist/icons/constants.d.ts +14 -0
- package/dist/icons/constants.js +16 -0
- package/dist/icons/constants.js.map +1 -0
- package/dist/icons/css-mode.d.ts +7 -0
- package/dist/icons/css-mode.js +51 -0
- package/dist/icons/css-mode.js.map +1 -0
- package/dist/icons/index.d.ts +14 -162
- package/dist/icons/index.js +30 -315
- package/dist/icons/index.js.map +1 -1
- package/dist/icons/local-svg.d.ts +5 -0
- package/dist/icons/local-svg.js +53 -0
- package/dist/icons/local-svg.js.map +1 -0
- package/dist/icons/normalize.d.ts +5 -0
- package/dist/icons/normalize.js +63 -0
- package/dist/icons/normalize.js.map +1 -0
- package/dist/icons/offline-loader.d.ts +21 -0
- package/dist/icons/offline-loader.js +94 -0
- package/dist/icons/offline-loader.js.map +1 -0
- package/dist/icons/parser.d.ts +5 -0
- package/dist/icons/parser.js +89 -0
- package/dist/icons/parser.js.map +1 -0
- package/dist/icons/registry.d.ts +7 -0
- package/dist/icons/registry.js +91 -0
- package/dist/icons/registry.js.map +1 -0
- package/dist/icons/resolver.d.ts +4 -0
- package/dist/icons/resolver.js +45 -0
- package/dist/icons/resolver.js.map +1 -0
- package/dist/icons/svg-mode.d.ts +4 -0
- package/dist/icons/svg-mode.js +54 -0
- package/dist/icons/svg-mode.js.map +1 -0
- package/dist/icons/transform.d.ts +11 -0
- package/dist/icons/transform.js +68 -0
- package/dist/icons/transform.js.map +1 -0
- package/dist/icons/types.d.ts +49 -0
- package/dist/icons/types.js +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -2
- package/dist/kit/index.d.ts +21 -25
- package/dist/kit/index.js +2 -4
- package/dist/kit/index.js.map +1 -1
- package/dist/nitro-server/index.d.ts +2 -5
- package/dist/nitro-server/index.js +2 -3
- package/dist/nitro-server/index.js.map +1 -1
- package/dist/node.d.ts +2 -6
- package/dist/node.js +7 -9
- package/dist/node.js.map +1 -1
- package/dist/reactivity/computed.d.ts +3 -7
- package/dist/reactivity/computed.js +4 -5
- package/dist/reactivity/computed.js.map +1 -1
- package/dist/reactivity/effect.d.ts +13 -17
- package/dist/reactivity/effect.js +11 -11
- package/dist/reactivity/effect.js.map +1 -1
- package/dist/reactivity/index.d.ts +1 -1
- package/dist/reactivity/index.js +3 -4
- package/dist/reactivity/reactive.d.ts +5 -8
- package/dist/reactivity/reactive.js +5 -7
- package/dist/reactivity/reactive.js.map +1 -1
- package/dist/reactivity/readonly.js +1 -3
- package/dist/reactivity/ref.d.ts +9 -12
- package/dist/reactivity/ref.js +6 -5
- package/dist/reactivity/ref.js.map +1 -1
- package/dist/reactivity/scheduler.d.ts +5 -7
- package/dist/reactivity/scheduler.js +2 -3
- package/dist/reactivity/scheduler.js.map +1 -1
- package/dist/reactivity/types.d.ts +11 -14
- package/dist/reactivity/types.js +1 -1
- package/dist/reactivity/utils.d.ts +9 -12
- package/dist/reactivity/utils.js +2 -3
- package/dist/reactivity/utils.js.map +1 -1
- package/dist/reactivity/watch.d.ts +3 -6
- package/dist/reactivity/watch.js +7 -7
- package/dist/reactivity/watch.js.map +1 -1
- package/dist/runtime/core.d.ts +4 -20
- package/dist/runtime/core.js +11 -24
- package/dist/runtime/core.js.map +1 -1
- package/dist/runtime/index.d.ts +167 -157
- package/dist/runtime/index.js +2835 -1027
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/reactivity.d.ts +4 -4
- package/dist/runtime/reactivity.js +2 -3
- package/dist/runtime/resume.d.ts +14 -51
- package/dist/runtime/resume.js +4 -34
- package/dist/runtime/resume.js.map +1 -1
- package/dist/runtime/router.d.ts +5 -17
- package/dist/runtime/router.js +7 -17
- package/dist/runtime/router.js.map +1 -1
- package/dist/runtime/streaming.d.ts +6 -13
- package/dist/runtime/streaming.js +4 -9
- package/dist/runtime/streaming.js.map +1 -1
- package/dist/runtime/view-transitions/detect.d.ts +11 -0
- package/dist/runtime/view-transitions/detect.js +16 -0
- package/dist/runtime/view-transitions/detect.js.map +1 -0
- package/dist/runtime/view-transitions/index.d.ts +4 -0
- package/dist/runtime/view-transitions/index.js +3 -0
- package/dist/runtime/view-transitions/transition.d.ts +4 -0
- package/dist/runtime/view-transitions/transition.js +41 -0
- package/dist/runtime/view-transitions/transition.js.map +1 -0
- package/dist/runtime/view-transitions/types.d.ts +8 -0
- package/dist/runtime/view-transitions/types.js +1 -0
- package/dist/security/media-fetch.d.ts +10 -13
- package/dist/security/media-fetch.js +5 -7
- package/dist/security/media-fetch.js.map +1 -1
- package/dist/security/path-boundary.d.ts +4 -7
- package/dist/security/path-boundary.js +2 -4
- package/dist/security/path-boundary.js.map +1 -1
- package/dist/ui/index.d.ts +367 -217
- package/dist/ui/index.js +199 -152
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/verification-code.d.ts +134 -0
- package/dist/ui/verification-code.js +472 -0
- package/dist/ui/verification-code.js.map +1 -0
- package/dist/vite-builder/index.d.ts +2 -5
- package/dist/vite-builder/index.js +2 -3
- package/dist/vite-builder/index.js.map +1 -1
- package/package.json +5 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ResuxModuleContainer } from "../core/module-container.js";
|
|
2
1
|
import { createResux } from "../core/resux.js";
|
|
2
|
+
import { ResuxModuleContainer } from "../core/module-container.js";
|
|
3
3
|
import { buildLocalePath, normalizeI18nRuntimeConfig } from "../i18n/shared.js";
|
|
4
|
-
import { getClientRuntimeSource } from "../runtime/index.js";
|
|
5
4
|
import { withResuxKitContext } from "../kit/index.js";
|
|
5
|
+
import { getClientRuntimeSource } from "../runtime/index.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { existsSync, mkdirSync, statSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
@@ -14,8 +14,7 @@ import { NodeTypes, parse } from "@vue/compiler-dom";
|
|
|
14
14
|
import { compileStyle, parse as parse$1 } from "@vue/compiler-sfc";
|
|
15
15
|
import vuePlugin from "@vitejs/plugin-vue";
|
|
16
16
|
import { build } from "vite";
|
|
17
|
-
|
|
18
|
-
//#region src/compiler/index.ts
|
|
17
|
+
// src/compiler/index.ts
|
|
19
18
|
const require = createRequire(import.meta.url);
|
|
20
19
|
var ResuxCompileError = class extends Error {
|
|
21
20
|
location;
|
|
@@ -25,7 +24,7 @@ var ResuxCompileError = class extends Error {
|
|
|
25
24
|
this.location = location;
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
|
-
const RESUMABLE_HANDLER_ALLOWED_GLOBALS = new Set([
|
|
27
|
+
const RESUMABLE_HANDLER_ALLOWED_GLOBALS = /* @__PURE__ */ new Set([
|
|
29
28
|
"Math",
|
|
30
29
|
"Number",
|
|
31
30
|
"String",
|
|
@@ -358,8 +357,8 @@ async function buildProject(appRoot, outDir = path.join(appRoot, ".resux"), opti
|
|
|
358
357
|
const layouts = layoutFiles.map((file) => compiledByFile.get(file));
|
|
359
358
|
const plugins = unique(pluginFiles).sort((left, right) => normalizePath(left).localeCompare(normalizePath(right))).map((file, pluginIndex) => {
|
|
360
359
|
const compiled = compilePluginFile(file, pluginIndex);
|
|
361
|
-
const mode
|
|
362
|
-
if (mode
|
|
360
|
+
const mode = pluginModeByFile.get(file);
|
|
361
|
+
if (mode) compiled.mode = mode;
|
|
363
362
|
return compiled;
|
|
364
363
|
});
|
|
365
364
|
const clientEnhancements = plugins.filter((plugin) => plugin.mode !== "server" && clientEnhancementFileSet.has(normalizePath(path.resolve(plugin.file)))).map((plugin) => ({
|
|
@@ -509,7 +508,7 @@ async function buildProject(appRoot, outDir = path.join(appRoot, ".resux"), opti
|
|
|
509
508
|
manifest: runtimeArtifacts.manifest,
|
|
510
509
|
outDir: absoluteOut
|
|
511
510
|
});
|
|
512
|
-
await writeFile(path.join(absoluteOut, "server", "manifest.mjs"), createServerManifestSource(routes, components, layouts, plugins, middleware, serverMiddleware, serverHandlers, vueIslands, app, error, runtimeConfig, buildOptions), "utf8");
|
|
511
|
+
await writeFile(path.join(absoluteOut, "server", "manifest.mjs"), createServerManifestSource(routes, components, layouts, plugins, middleware, serverMiddleware, serverHandlers, vueIslands, app, error, runtimeConfig, buildOptions, absoluteRoot), "utf8");
|
|
513
512
|
await writeGeneratedArtifacts(absoluteOut, runtimeArtifacts, buildOptions.vite === "dev");
|
|
514
513
|
await hooks.callHook("prepare:types", {
|
|
515
514
|
outDir: absoluteOut,
|
|
@@ -539,6 +538,7 @@ async function buildProject(appRoot, outDir = path.join(appRoot, ".resux"), opti
|
|
|
539
538
|
serverHandlers,
|
|
540
539
|
vueIslands,
|
|
541
540
|
routeRules,
|
|
541
|
+
contributions,
|
|
542
542
|
app,
|
|
543
543
|
error
|
|
544
544
|
};
|
|
@@ -686,8 +686,7 @@ async function buildServerBundle(root, outDir) {
|
|
|
686
686
|
}
|
|
687
687
|
async function buildClientAssets(root, outDir, components, plugins, middleware, vueIslands, packageRegistry, hooks, contributions) {
|
|
688
688
|
const inputRoot = path.join(outDir, "vite-client");
|
|
689
|
-
const
|
|
690
|
-
const input = { "runtime-client": runtimeInput };
|
|
689
|
+
const input = { "runtime-client": await writeViteClientRuntime(outDir, packageRegistry) };
|
|
691
690
|
for (const component of components) input[`handlers/${component.id}`] = path.join(inputRoot, "handlers", `${component.id}.mjs`);
|
|
692
691
|
for (const plugin of plugins.filter((entry) => entry.mode !== "server")) input[`plugins/${plugin.id}`] = path.join(inputRoot, "plugins", `${plugin.id}.mjs`);
|
|
693
692
|
for (const entry of middleware.filter((candidate) => candidate.mode !== "server")) input[`middleware/${entry.id}`] = path.join(inputRoot, "middleware", `${entry.id}.mjs`);
|
|
@@ -961,30 +960,30 @@ function compileTemplateChildren(children, state) {
|
|
|
961
960
|
const conditionalDirective = resolveConditionalDirective(child, state);
|
|
962
961
|
if (!conditionalDirective) {
|
|
963
962
|
conditionalChainExpressions = null;
|
|
964
|
-
const compiledNode
|
|
965
|
-
if (compiledNode
|
|
963
|
+
const compiledNode = compileTemplateNode(child, state);
|
|
964
|
+
if (compiledNode) nodes.push(compiledNode);
|
|
966
965
|
continue;
|
|
967
966
|
}
|
|
968
967
|
if (conditionalDirective.kind === "if") {
|
|
969
968
|
const expressionResult = transformTemplateExpressionCode(conditionalDirective.expression, state.templateRefBindings, state.file, conditionalDirective.directive);
|
|
970
969
|
conditionalChainExpressions = [expressionResult.transformed];
|
|
971
|
-
const compiledNode
|
|
972
|
-
if (compiledNode
|
|
970
|
+
const compiledNode = compileTemplateNode(child, state, { ifExpressionOverride: expressionResult.transformed });
|
|
971
|
+
if (compiledNode) nodes.push(compiledNode);
|
|
973
972
|
continue;
|
|
974
973
|
}
|
|
975
974
|
if (!conditionalChainExpressions || conditionalChainExpressions.length === 0) throw new ResuxCompileError(`v-${conditionalDirective.kind} must follow a sibling with v-if or v-else-if.`, locationFromVueNode(state.file, conditionalDirective.directive));
|
|
976
975
|
if (conditionalDirective.kind === "else-if") {
|
|
977
976
|
const branchExpressionResult = transformTemplateExpressionCode(conditionalDirective.expression, state.templateRefBindings, state.file, conditionalDirective.directive);
|
|
978
|
-
const expression
|
|
977
|
+
const expression = `${buildConditionalChainGuard(conditionalChainExpressions)} && (${branchExpressionResult.transformed})`;
|
|
979
978
|
conditionalChainExpressions.push(branchExpressionResult.transformed);
|
|
980
|
-
const compiledNode
|
|
981
|
-
if (compiledNode
|
|
979
|
+
const compiledNode = compileTemplateNode(child, state, { ifExpressionOverride: expression });
|
|
980
|
+
if (compiledNode) nodes.push(compiledNode);
|
|
982
981
|
continue;
|
|
983
982
|
}
|
|
984
983
|
const expression = buildConditionalChainGuard(conditionalChainExpressions);
|
|
985
984
|
conditionalChainExpressions = null;
|
|
986
|
-
const compiledNode
|
|
987
|
-
if (compiledNode
|
|
985
|
+
const compiledNode = compileTemplateNode(child, state, { ifExpressionOverride: expression });
|
|
986
|
+
if (compiledNode) nodes.push(compiledNode);
|
|
988
987
|
continue;
|
|
989
988
|
}
|
|
990
989
|
if (child.type !== NodeTypes.TEXT || child.content.trim().length > 0) conditionalChainExpressions = null;
|
|
@@ -1077,27 +1076,27 @@ function compileTemplateNode(node, state, options = {}) {
|
|
|
1077
1076
|
if (prop.type !== NodeTypes.DIRECTIVE) continue;
|
|
1078
1077
|
if (prop.name === "bind") {
|
|
1079
1078
|
const arg = expressionContent(prop.arg);
|
|
1080
|
-
const expression
|
|
1081
|
-
if (!arg || !expression
|
|
1079
|
+
const expression = expressionContent(prop.exp);
|
|
1080
|
+
if (!arg || !expression) throw new ResuxCompileError("Dynamic bindings need an argument and expression.", locationFromVueNode(state.file, prop));
|
|
1082
1081
|
attrs.push({
|
|
1083
1082
|
kind: "dynamic",
|
|
1084
1083
|
name: arg,
|
|
1085
|
-
value: registerTemplateExpression(expression
|
|
1084
|
+
value: registerTemplateExpression(expression, state.templateRefBindings, state.file, prop, state),
|
|
1086
1085
|
bindingId: nextBindingId(state)
|
|
1087
1086
|
});
|
|
1088
1087
|
continue;
|
|
1089
1088
|
}
|
|
1090
1089
|
if (prop.name === "on") {
|
|
1091
1090
|
const arg = expressionContent(prop.arg);
|
|
1092
|
-
const expression
|
|
1091
|
+
const expression = expressionContent(prop.exp);
|
|
1093
1092
|
const modifiers = normalizeEventModifiers(prop.modifiers ?? [], state.file, prop);
|
|
1094
|
-
if (!arg || !expression
|
|
1095
|
-
const isSimpleIdentifier = /^[A-Za-z_$][\w$]*$/.test(expression
|
|
1096
|
-
if (isSimpleIdentifier && state.activeLocals.includes(expression
|
|
1097
|
-
const inlineHandler = !isSimpleIdentifier ? createInlineEventHandler(expression
|
|
1093
|
+
if (!arg || !expression) throw new ResuxCompileError("Events need an argument and expression.", locationFromVueNode(state.file, prop));
|
|
1094
|
+
const isSimpleIdentifier = /^[A-Za-z_$][\w$]*$/.test(expression);
|
|
1095
|
+
if (isSimpleIdentifier && state.activeLocals.includes(expression)) throw new ResuxCompileError(`Direct template-local event handler "${expression}" cannot be resumed because template locals are serialized by value. Call a top-level handler with serializable local data instead.`, locationFromVueNode(state.file, prop));
|
|
1096
|
+
const inlineHandler = !isSimpleIdentifier ? createInlineEventHandler(expression, state, prop) : null;
|
|
1098
1097
|
const event = {
|
|
1099
1098
|
name: arg,
|
|
1100
|
-
handler: inlineHandler?.name ?? expression
|
|
1099
|
+
handler: inlineHandler?.name ?? expression,
|
|
1101
1100
|
modifiers,
|
|
1102
1101
|
...inlineHandler?.locals.length ? { locals: inlineHandler.locals } : {}
|
|
1103
1102
|
};
|
|
@@ -1107,10 +1106,10 @@ function compileTemplateNode(node, state, options = {}) {
|
|
|
1107
1106
|
}
|
|
1108
1107
|
if (prop.name === "if") {
|
|
1109
1108
|
if (options.ifExpressionOverride) continue;
|
|
1110
|
-
const expression
|
|
1111
|
-
if (!expression
|
|
1109
|
+
const expression = expressionContent(prop.exp);
|
|
1110
|
+
if (!expression) throw new ResuxCompileError("v-if needs an expression.", locationFromVueNode(state.file, prop));
|
|
1112
1111
|
element.if = {
|
|
1113
|
-
expression: registerTemplateExpression(expression
|
|
1112
|
+
expression: registerTemplateExpression(expression, state.templateRefBindings, state.file, prop, state),
|
|
1114
1113
|
blockId: nextBindingId(state)
|
|
1115
1114
|
};
|
|
1116
1115
|
continue;
|
|
@@ -1120,50 +1119,50 @@ function compileTemplateNode(node, state, options = {}) {
|
|
|
1120
1119
|
throw new ResuxCompileError(`v-${prop.name} must follow a sibling with v-if or v-else-if.`, locationFromVueNode(state.file, prop));
|
|
1121
1120
|
}
|
|
1122
1121
|
if (prop.name === "for") {
|
|
1123
|
-
const expression
|
|
1124
|
-
if (!expression
|
|
1125
|
-
element.for = parseForExpression(expression
|
|
1122
|
+
const expression = expressionContent(prop.exp);
|
|
1123
|
+
if (!expression) throw new ResuxCompileError("v-for needs an expression.", locationFromVueNode(state.file, prop));
|
|
1124
|
+
element.for = parseForExpression(expression, state.file, prop, state);
|
|
1126
1125
|
element.for.source = registerTemplateExpression(element.for.source, state.templateRefBindings, state.file, prop, state);
|
|
1127
1126
|
continue;
|
|
1128
1127
|
}
|
|
1129
1128
|
if (prop.name === "show") {
|
|
1130
|
-
const expression
|
|
1131
|
-
if (!expression
|
|
1129
|
+
const expression = expressionContent(prop.exp);
|
|
1130
|
+
if (!expression) throw new ResuxCompileError("v-show needs an expression.", locationFromVueNode(state.file, prop));
|
|
1132
1131
|
attrs.push({
|
|
1133
1132
|
kind: "dynamic",
|
|
1134
1133
|
name: "hidden",
|
|
1135
|
-
value: registerRawTemplateExpression(`!(${transformTemplateExpressionCode(expression
|
|
1134
|
+
value: registerRawTemplateExpression(`!(${transformTemplateExpressionCode(expression, state.templateRefBindings, state.file, prop).transformed})`, expression, transformTemplateExpressionCode(expression, state.templateRefBindings, state.file, prop).identifiers, state),
|
|
1136
1135
|
bindingId: nextBindingId(state)
|
|
1137
1136
|
});
|
|
1138
1137
|
continue;
|
|
1139
1138
|
}
|
|
1140
1139
|
if (prop.name === "text") {
|
|
1141
|
-
const expression
|
|
1142
|
-
if (!expression
|
|
1140
|
+
const expression = expressionContent(prop.exp);
|
|
1141
|
+
if (!expression) throw new ResuxCompileError("v-text needs an expression.", locationFromVueNode(state.file, prop));
|
|
1143
1142
|
element.children = [{
|
|
1144
1143
|
type: "interpolation",
|
|
1145
|
-
expression: registerTemplateExpression(expression
|
|
1144
|
+
expression: registerTemplateExpression(expression, state.templateRefBindings, state.file, prop, state),
|
|
1146
1145
|
bindingId: nextBindingId(state)
|
|
1147
1146
|
}];
|
|
1148
1147
|
continue;
|
|
1149
1148
|
}
|
|
1150
1149
|
if (prop.name === "html") {
|
|
1151
|
-
const expression
|
|
1152
|
-
if (!expression
|
|
1150
|
+
const expression = expressionContent(prop.exp);
|
|
1151
|
+
if (!expression) throw new ResuxCompileError("v-html needs an expression.", locationFromVueNode(state.file, prop));
|
|
1153
1152
|
element.html = {
|
|
1154
|
-
expression: registerTemplateExpression(expression
|
|
1153
|
+
expression: registerTemplateExpression(expression, state.templateRefBindings, state.file, prop, state),
|
|
1155
1154
|
bindingId: nextBindingId(state)
|
|
1156
1155
|
};
|
|
1157
1156
|
element.children = [];
|
|
1158
1157
|
continue;
|
|
1159
1158
|
}
|
|
1160
1159
|
if (prop.name === "model") {
|
|
1161
|
-
const expression
|
|
1162
|
-
if (!expression
|
|
1163
|
-
if (!isAssignableExpression(expression
|
|
1164
|
-
const assignmentRoot = assignableExpressionRoot(expression
|
|
1160
|
+
const expression = expressionContent(prop.exp);
|
|
1161
|
+
if (!expression) throw new ResuxCompileError("v-model needs an expression.", locationFromVueNode(state.file, prop));
|
|
1162
|
+
if (!isAssignableExpression(expression)) throw new ResuxCompileError("v-model needs an assignable expression like \"message.value\".", locationFromVueNode(state.file, prop));
|
|
1163
|
+
const assignmentRoot = assignableExpressionRoot(expression);
|
|
1165
1164
|
if (assignmentRoot && state.activeLocals.includes(assignmentRoot)) throw new ResuxCompileError(`v-model cannot assign through template-local binding "${assignmentRoot}" because resumed event locals are serialized by value. Bind v-model to resumable component state instead.`, locationFromVueNode(state.file, prop));
|
|
1166
|
-
const model = createModelBinding(node.tag, node.props, expression
|
|
1165
|
+
const model = createModelBinding(node.tag, node.props, expression, state, prop);
|
|
1167
1166
|
attrs.push({
|
|
1168
1167
|
kind: "dynamic",
|
|
1169
1168
|
name: model.attribute,
|
|
@@ -1336,7 +1335,7 @@ function assignableExpressionRoot(expression) {
|
|
|
1336
1335
|
}
|
|
1337
1336
|
function normalizeEventModifiers(modifiers, file, node) {
|
|
1338
1337
|
const modifierNames = modifiers.map((modifier) => String(modifier.content));
|
|
1339
|
-
const supported = new Set([
|
|
1338
|
+
const supported = /* @__PURE__ */ new Set([
|
|
1340
1339
|
"prevent",
|
|
1341
1340
|
"stop",
|
|
1342
1341
|
"self",
|
|
@@ -1430,7 +1429,7 @@ function findProjectRoot(startFile) {
|
|
|
1430
1429
|
}
|
|
1431
1430
|
return path.dirname(startFile);
|
|
1432
1431
|
}
|
|
1433
|
-
const IMAGE_VIDEO_FONT_EXTENSIONS = new Set([
|
|
1432
|
+
const IMAGE_VIDEO_FONT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
1434
1433
|
".webp",
|
|
1435
1434
|
".png",
|
|
1436
1435
|
".jpg",
|
|
@@ -1448,7 +1447,7 @@ const IMAGE_VIDEO_FONT_EXTENSIONS = new Set([
|
|
|
1448
1447
|
".ttf",
|
|
1449
1448
|
".eot"
|
|
1450
1449
|
]);
|
|
1451
|
-
const STYLESHEET_EXTENSIONS = new Set([
|
|
1450
|
+
const STYLESHEET_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
1452
1451
|
".css",
|
|
1453
1452
|
".scss",
|
|
1454
1453
|
".sass",
|
|
@@ -1481,11 +1480,11 @@ function ensureCompiledUserModule(resolvedFile, projectRoot, outDir, compiledSet
|
|
|
1481
1480
|
if (ext === ".ts" || ext === ".tsx" || ext === ".js" || ext === ".jsx") {
|
|
1482
1481
|
const compiledTarget = ensureCompiledUserModule(resolvedImported, projectRoot, outDir, compiledSet);
|
|
1483
1482
|
const relativeToCompiled = path.relative(path.dirname(targetJsFile), compiledTarget);
|
|
1484
|
-
const relativeImportPath
|
|
1483
|
+
const relativeImportPath = relativeToCompiled.startsWith(".") ? relativeToCompiled.replace(/\\/g, "/") : "./" + relativeToCompiled.replace(/\\/g, "/");
|
|
1485
1484
|
replacements.push({
|
|
1486
1485
|
start: specifier.getStart(sourceFile),
|
|
1487
1486
|
end: specifier.getEnd(),
|
|
1488
|
-
replacement: JSON.stringify(relativeImportPath
|
|
1487
|
+
replacement: JSON.stringify(relativeImportPath)
|
|
1489
1488
|
});
|
|
1490
1489
|
}
|
|
1491
1490
|
}
|
|
@@ -1517,41 +1516,45 @@ function processImportDeclaration(statement, sourceFile, file, client, outDir) {
|
|
|
1517
1516
|
const isRelative = importPath.startsWith(".");
|
|
1518
1517
|
const isAlias = importPath.startsWith("@/") || importPath.startsWith("~/");
|
|
1519
1518
|
const ext = path.extname(importPath).toLowerCase();
|
|
1520
|
-
if (IMAGE_VIDEO_FONT_EXTENSIONS.has(ext) || STYLESHEET_EXTENSIONS.has(ext))
|
|
1521
|
-
if (
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1519
|
+
if (IMAGE_VIDEO_FONT_EXTENSIONS.has(ext) || STYLESHEET_EXTENSIONS.has(ext)) {
|
|
1520
|
+
if (client) {
|
|
1521
|
+
if (isRelative) {
|
|
1522
|
+
const normalized = fileUrl(path.resolve(path.dirname(file), importPath));
|
|
1523
|
+
const fullText = statement.getFullText(sourceFile);
|
|
1524
|
+
const start = specifier.getStart(sourceFile) - statement.getFullStart();
|
|
1525
|
+
const end = specifier.getEnd() - statement.getFullStart();
|
|
1526
|
+
return fullText.slice(0, start) + JSON.stringify(normalized) + fullText.slice(end);
|
|
1527
|
+
}
|
|
1528
|
+
if (isAlias) {
|
|
1529
|
+
const projectRoot = findProjectRoot(file);
|
|
1530
|
+
const normalized = fileUrl(path.resolve(projectRoot, importPath.slice(2)));
|
|
1531
|
+
const fullText = statement.getFullText(sourceFile);
|
|
1532
|
+
const start = specifier.getStart(sourceFile) - statement.getFullStart();
|
|
1533
|
+
const end = specifier.getEnd() - statement.getFullStart();
|
|
1534
|
+
return fullText.slice(0, start) + JSON.stringify(normalized) + fullText.slice(end);
|
|
1535
|
+
}
|
|
1536
|
+
return statement.getFullText(sourceFile);
|
|
1537
|
+
} else {
|
|
1538
|
+
if (STYLESHEET_EXTENSIONS.has(ext)) return "";
|
|
1529
1539
|
const projectRoot = findProjectRoot(file);
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1540
|
+
let absolutePath = "";
|
|
1541
|
+
if (isAlias) absolutePath = path.resolve(projectRoot, importPath.slice(2));
|
|
1542
|
+
else if (isRelative) absolutePath = path.resolve(path.dirname(file), importPath);
|
|
1543
|
+
else absolutePath = importPath;
|
|
1544
|
+
let webPath = importPath;
|
|
1545
|
+
const relativeToRoot = path.relative(projectRoot, absolutePath);
|
|
1546
|
+
if (relativeToRoot === "" || relativeToRoot !== ".." && !relativeToRoot.startsWith(`..${path.sep}`) && !path.isAbsolute(relativeToRoot)) webPath = "/" + relativeToRoot.replace(/\\/g, "/");
|
|
1547
|
+
const clause = statement.importClause;
|
|
1548
|
+
if (!clause) return "";
|
|
1549
|
+
const bindings = [];
|
|
1550
|
+
if (clause.name) bindings.push(clause.name.text);
|
|
1551
|
+
if (clause.namedBindings) {
|
|
1552
|
+
if (ts.isNamespaceImport(clause.namedBindings)) bindings.push(clause.namedBindings.name.text);
|
|
1553
|
+
else for (const element of clause.namedBindings.elements) bindings.push(element.name.text);
|
|
1554
|
+
}
|
|
1555
|
+
if (bindings.length === 0) return "";
|
|
1556
|
+
return bindings.map((name) => `const ${name} = ${JSON.stringify(webPath)};`).join("\n");
|
|
1535
1557
|
}
|
|
1536
|
-
return statement.getFullText(sourceFile);
|
|
1537
|
-
} else {
|
|
1538
|
-
if (STYLESHEET_EXTENSIONS.has(ext)) return "";
|
|
1539
|
-
const projectRoot = findProjectRoot(file);
|
|
1540
|
-
let absolutePath = "";
|
|
1541
|
-
if (isAlias) absolutePath = path.resolve(projectRoot, importPath.slice(2));
|
|
1542
|
-
else if (isRelative) absolutePath = path.resolve(path.dirname(file), importPath);
|
|
1543
|
-
else absolutePath = importPath;
|
|
1544
|
-
let webPath = importPath;
|
|
1545
|
-
const relativeToRoot = path.relative(projectRoot, absolutePath);
|
|
1546
|
-
if (relativeToRoot === "" || relativeToRoot !== ".." && !relativeToRoot.startsWith(`..${path.sep}`) && !path.isAbsolute(relativeToRoot)) webPath = "/" + relativeToRoot.replace(/\\/g, "/");
|
|
1547
|
-
const clause = statement.importClause;
|
|
1548
|
-
if (!clause) return "";
|
|
1549
|
-
const bindings = [];
|
|
1550
|
-
if (clause.name) bindings.push(clause.name.text);
|
|
1551
|
-
if (clause.namedBindings) if (ts.isNamespaceImport(clause.namedBindings)) bindings.push(clause.namedBindings.name.text);
|
|
1552
|
-
else for (const element of clause.namedBindings.elements) bindings.push(element.name.text);
|
|
1553
|
-
if (bindings.length === 0) return "";
|
|
1554
|
-
return bindings.map((name) => `const ${name} = ${JSON.stringify(webPath)};`).join("\n");
|
|
1555
1558
|
}
|
|
1556
1559
|
if (isRelative) {
|
|
1557
1560
|
const resolvedPath = resolveFileExtension(path.resolve(path.dirname(file), importPath));
|
|
@@ -1584,35 +1587,37 @@ function processImportDeclaration(statement, sourceFile, file, client, outDir) {
|
|
|
1584
1587
|
const isRelative = importPath.startsWith(".");
|
|
1585
1588
|
const isAlias = importPath.startsWith("@/") || importPath.startsWith("~/");
|
|
1586
1589
|
const ext = path.extname(importPath).toLowerCase();
|
|
1587
|
-
if (IMAGE_VIDEO_FONT_EXTENSIONS.has(ext) || STYLESHEET_EXTENSIONS.has(ext))
|
|
1588
|
-
if (
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1590
|
+
if (IMAGE_VIDEO_FONT_EXTENSIONS.has(ext) || STYLESHEET_EXTENSIONS.has(ext)) {
|
|
1591
|
+
if (client) {
|
|
1592
|
+
if (isRelative) {
|
|
1593
|
+
const normalized = fileUrl(path.resolve(path.dirname(file), importPath));
|
|
1594
|
+
const fullText = statement.getFullText(sourceFile);
|
|
1595
|
+
const start = specifier.getStart(sourceFile) - statement.getFullStart();
|
|
1596
|
+
const end = specifier.getEnd() - statement.getFullStart();
|
|
1597
|
+
return fullText.slice(0, start) + JSON.stringify(normalized) + fullText.slice(end);
|
|
1598
|
+
}
|
|
1599
|
+
if (isAlias) {
|
|
1600
|
+
const projectRoot = findProjectRoot(file);
|
|
1601
|
+
const normalized = fileUrl(path.resolve(projectRoot, importPath.slice(2)));
|
|
1602
|
+
const fullText = statement.getFullText(sourceFile);
|
|
1603
|
+
const start = specifier.getStart(sourceFile) - statement.getFullStart();
|
|
1604
|
+
const end = specifier.getEnd() - statement.getFullStart();
|
|
1605
|
+
return fullText.slice(0, start) + JSON.stringify(normalized) + fullText.slice(end);
|
|
1606
|
+
}
|
|
1607
|
+
return statement.getFullText(sourceFile);
|
|
1608
|
+
} else {
|
|
1609
|
+
if (STYLESHEET_EXTENSIONS.has(ext)) return "";
|
|
1596
1610
|
const projectRoot = findProjectRoot(file);
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1611
|
+
let absolutePath = "";
|
|
1612
|
+
if (isAlias) absolutePath = path.resolve(projectRoot, importPath.slice(2));
|
|
1613
|
+
else if (isRelative) absolutePath = path.resolve(path.dirname(file), importPath);
|
|
1614
|
+
else absolutePath = importPath;
|
|
1615
|
+
let webPath = importPath;
|
|
1616
|
+
const relativeToRoot = path.relative(projectRoot, absolutePath);
|
|
1617
|
+
if (relativeToRoot === "" || relativeToRoot !== ".." && !relativeToRoot.startsWith(`..${path.sep}`) && !path.isAbsolute(relativeToRoot)) webPath = "/" + relativeToRoot.replace(/\\/g, "/");
|
|
1618
|
+
if (!statement.name) return "";
|
|
1619
|
+
return `const ${statement.name.text} = ${JSON.stringify(webPath)};`;
|
|
1602
1620
|
}
|
|
1603
|
-
return statement.getFullText(sourceFile);
|
|
1604
|
-
} else {
|
|
1605
|
-
if (STYLESHEET_EXTENSIONS.has(ext)) return "";
|
|
1606
|
-
const projectRoot = findProjectRoot(file);
|
|
1607
|
-
let absolutePath = "";
|
|
1608
|
-
if (isAlias) absolutePath = path.resolve(projectRoot, importPath.slice(2));
|
|
1609
|
-
else if (isRelative) absolutePath = path.resolve(path.dirname(file), importPath);
|
|
1610
|
-
else absolutePath = importPath;
|
|
1611
|
-
let webPath = importPath;
|
|
1612
|
-
const relativeToRoot = path.relative(projectRoot, absolutePath);
|
|
1613
|
-
if (relativeToRoot === "" || relativeToRoot !== ".." && !relativeToRoot.startsWith(`..${path.sep}`) && !path.isAbsolute(relativeToRoot)) webPath = "/" + relativeToRoot.replace(/\\/g, "/");
|
|
1614
|
-
if (!statement.name) return "";
|
|
1615
|
-
return `const ${statement.name.text} = ${JSON.stringify(webPath)};`;
|
|
1616
1621
|
}
|
|
1617
1622
|
if (isRelative) {
|
|
1618
1623
|
const resolvedPath = resolveFileExtension(path.resolve(path.dirname(file), importPath));
|
|
@@ -1667,12 +1672,14 @@ function analyzeScript(script, file, inlineHandlers = []) {
|
|
|
1667
1672
|
bindings.add(clause.name.text);
|
|
1668
1673
|
importedBindings.add(clause.name.text);
|
|
1669
1674
|
}
|
|
1670
|
-
if (clause.namedBindings)
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1675
|
+
if (clause.namedBindings) {
|
|
1676
|
+
if (ts.isNamespaceImport(clause.namedBindings)) {
|
|
1677
|
+
bindings.add(clause.namedBindings.name.text);
|
|
1678
|
+
importedBindings.add(clause.namedBindings.name.text);
|
|
1679
|
+
} else for (const element of clause.namedBindings.elements) {
|
|
1680
|
+
bindings.add(element.name.text);
|
|
1681
|
+
importedBindings.add(element.name.text);
|
|
1682
|
+
}
|
|
1676
1683
|
}
|
|
1677
1684
|
}
|
|
1678
1685
|
} else if (ts.isImportEqualsDeclaration(statement) && statement.name) {
|
|
@@ -1813,7 +1820,7 @@ function readPropertyName(name, sourceFile, file) {
|
|
|
1813
1820
|
throw new ResuxCompileError("Only simple property names are supported here.", locationFromTsNode(file, sourceFile, name));
|
|
1814
1821
|
}
|
|
1815
1822
|
function validateTemplateHandlers(events, analysis, file, fullSource, templateLocals = []) {
|
|
1816
|
-
const allowedHandlers = new Set([...analysis.handlerNames, ...templateLocals]);
|
|
1823
|
+
const allowedHandlers = /* @__PURE__ */ new Set([...analysis.handlerNames, ...templateLocals]);
|
|
1817
1824
|
for (const event of events) {
|
|
1818
1825
|
if (!allowedHandlers.has(event.handler)) throw new ResuxCompileError(`Handler "${event.handler}" must be a top-level function or arrow function.`, locationFromOffset(file, fullSource, 0));
|
|
1819
1826
|
const handlerNode = analysis.handlers.get(event.handler);
|
|
@@ -1824,12 +1831,12 @@ function validateTemplateHandlers(events, analysis, file, fullSource, templateLo
|
|
|
1824
1831
|
}
|
|
1825
1832
|
}
|
|
1826
1833
|
function findUnsupportedCapture(node, handlerName, analysis, templateLocals = []) {
|
|
1827
|
-
const locals = new Set([
|
|
1834
|
+
const locals = /* @__PURE__ */ new Set([
|
|
1828
1835
|
handlerName,
|
|
1829
1836
|
"event",
|
|
1830
1837
|
...templateLocals
|
|
1831
1838
|
]);
|
|
1832
|
-
const allowedTopLevel = new Set([
|
|
1839
|
+
const allowedTopLevel = /* @__PURE__ */ new Set([
|
|
1833
1840
|
...analysis.resumableBindings,
|
|
1834
1841
|
...analysis.handlerNames,
|
|
1835
1842
|
...analysis.importedBindings
|
|
@@ -1989,7 +1996,7 @@ function relativeImportPath(fromDir, file) {
|
|
|
1989
1996
|
const relative = normalizePath(path.relative(fromDir, file));
|
|
1990
1997
|
return relative.startsWith(".") ? relative : `./${relative}`;
|
|
1991
1998
|
}
|
|
1992
|
-
function createServerManifestSource(routes, components, layouts, plugins, middleware, serverMiddleware, serverHandlers, vueIslands, app, error, runtimeConfig = {}, buildOptions = {}) {
|
|
1999
|
+
function createServerManifestSource(routes, components, layouts, plugins, middleware, serverMiddleware, serverHandlers, vueIslands, app, error, runtimeConfig = {}, buildOptions = {}, appRoot = process.cwd()) {
|
|
1993
2000
|
const importSuffix = buildOptions.vite === "dev" ? `?t=${Date.now()}` : "";
|
|
1994
2001
|
const serverPlugins = plugins.filter((entry) => entry.mode !== "client");
|
|
1995
2002
|
const clientPlugins = plugins.filter((entry) => entry.mode !== "server");
|
|
@@ -2052,7 +2059,7 @@ function createServerManifestSource(routes, components, layouts, plugins, middle
|
|
|
2052
2059
|
match: createMatcher(${JSON.stringify(route.path)})
|
|
2053
2060
|
}`;
|
|
2054
2061
|
}).join(",\n");
|
|
2055
|
-
const appHead = createAppHead(runtimeConfig);
|
|
2062
|
+
const appHead = createAppHead(runtimeConfig, appRoot, buildOptions.vite !== "dev");
|
|
2056
2063
|
const appRuntimeConfig = createRuntimeConfig(runtimeConfig);
|
|
2057
2064
|
const routeRules = createRouteRules(runtimeConfig);
|
|
2058
2065
|
return `${imports}
|
|
@@ -2139,18 +2146,153 @@ function createMatcher(pattern) {
|
|
|
2139
2146
|
}
|
|
2140
2147
|
`;
|
|
2141
2148
|
}
|
|
2142
|
-
function createAppHead(runtimeConfig) {
|
|
2149
|
+
function createAppHead(runtimeConfig, appRoot, optimizeCss) {
|
|
2143
2150
|
const config = runtimeConfig;
|
|
2144
2151
|
const head = typeof config.app === "object" && config.app && "head" in config.app ? config.app.head : {};
|
|
2145
|
-
const
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2152
|
+
const headObject = typeof head === "object" && head ? head : {};
|
|
2153
|
+
const performanceConfig = readPerformanceRuntimeConfig(config);
|
|
2154
|
+
const csp = readSecurityContentSecurityPolicy(config, headObject);
|
|
2155
|
+
const inlineCss = optimizeCss && performanceConfig !== null && performanceConfig.inlineCss !== false && allowsInlineStyleForCsp(csp);
|
|
2156
|
+
const inlineCssMaxBytes = performanceConfig && Number.isFinite(performanceConfig.inlineCssMaxBytes) ? Math.max(0, Math.floor(performanceConfig.inlineCssMaxBytes)) : 65536;
|
|
2157
|
+
const { links: cssLinks, styles: criticalStyles } = splitCssEntriesPreservingOrder(collectConfiguredCssEntries(config.css, appRoot, inlineCss ? inlineCssMaxBytes : 0));
|
|
2158
|
+
const configuredLinks = Array.isArray(headObject.link) ? headObject.link : [];
|
|
2159
|
+
const configuredScripts = Array.isArray(headObject.script) ? headObject.script : [];
|
|
2160
|
+
const inlineScriptAttributeAllowed = allowsInlineScriptAttributeForCsp(csp);
|
|
2161
|
+
const inlineScriptElementAllowed = allowsInlineScriptElementForCsp(csp);
|
|
2149
2162
|
return {
|
|
2150
|
-
...
|
|
2151
|
-
link: [...
|
|
2163
|
+
...headObject,
|
|
2164
|
+
link: [...normalizeFontLinksForCsp(configuredLinks, inlineScriptAttributeAllowed, inlineScriptElementAllowed), ...cssLinks],
|
|
2165
|
+
style: [...criticalStyles, ...Array.isArray(headObject.style) ? headObject.style : []],
|
|
2166
|
+
script: inlineScriptElementAllowed ? configuredScripts : configuredScripts.filter((entry) => !isResuxFontLoaderScript(entry))
|
|
2152
2167
|
};
|
|
2153
2168
|
}
|
|
2169
|
+
function collectConfiguredCssEntries(cssConfig, appRoot, inlineCssMaxBytes) {
|
|
2170
|
+
if (!Array.isArray(cssConfig)) return [];
|
|
2171
|
+
return cssConfig.map((cssEntry) => String(cssEntry ?? "").trim()).filter(Boolean).map((href) => ({
|
|
2172
|
+
href,
|
|
2173
|
+
css: inlineCssMaxBytes > 0 ? readInlinePublicCss(appRoot, href, inlineCssMaxBytes) : null
|
|
2174
|
+
}));
|
|
2175
|
+
}
|
|
2176
|
+
function splitCssEntriesPreservingOrder(entries) {
|
|
2177
|
+
const lastLinkedCssIndex = entries.reduce((lastIndex, entry, index) => entry.css === null ? index : lastIndex, -1);
|
|
2178
|
+
const links = [];
|
|
2179
|
+
const styles = [];
|
|
2180
|
+
entries.forEach((entry, index) => {
|
|
2181
|
+
if (entry.css !== null && index > lastLinkedCssIndex) {
|
|
2182
|
+
styles.push({
|
|
2183
|
+
id: `resux-critical-${createHash("sha256").update(entry.href).digest("hex").slice(0, 12)}`,
|
|
2184
|
+
css: entry.css
|
|
2185
|
+
});
|
|
2186
|
+
return;
|
|
2187
|
+
}
|
|
2188
|
+
links.push({
|
|
2189
|
+
rel: "stylesheet",
|
|
2190
|
+
href: entry.href
|
|
2191
|
+
});
|
|
2192
|
+
});
|
|
2193
|
+
return {
|
|
2194
|
+
links,
|
|
2195
|
+
styles
|
|
2196
|
+
};
|
|
2197
|
+
}
|
|
2198
|
+
function readPerformanceRuntimeConfig(config) {
|
|
2199
|
+
const runtime = isPlainObject(config.runtimeConfig) ? config.runtimeConfig : {};
|
|
2200
|
+
const publicConfig = isPlainObject(runtime.public) ? runtime.public : {};
|
|
2201
|
+
return isPlainObject(publicConfig.performanceModule) ? publicConfig.performanceModule : null;
|
|
2202
|
+
}
|
|
2203
|
+
function readSecurityContentSecurityPolicy(config, head) {
|
|
2204
|
+
const runtime = isPlainObject(config.runtimeConfig) ? config.runtimeConfig : {};
|
|
2205
|
+
const configured = firstString((isPlainObject(runtime.resuxSecurity) ? runtime.resuxSecurity : {}).contentSecurityPolicy);
|
|
2206
|
+
if (configured) return configured;
|
|
2207
|
+
const meta = Array.isArray(head.meta) ? head.meta : [];
|
|
2208
|
+
for (const entry of meta) {
|
|
2209
|
+
if (!isPlainObject(entry)) continue;
|
|
2210
|
+
if (String(entry["http-equiv"] ?? entry.httpEquiv ?? "").trim().toLowerCase() !== "content-security-policy") continue;
|
|
2211
|
+
const content = firstString(entry.content);
|
|
2212
|
+
if (content) return content;
|
|
2213
|
+
}
|
|
2214
|
+
return "";
|
|
2215
|
+
}
|
|
2216
|
+
function cspDirectiveSources(csp, names) {
|
|
2217
|
+
if (!csp.trim()) return null;
|
|
2218
|
+
const directives = /* @__PURE__ */ new Map();
|
|
2219
|
+
for (const rawDirective of csp.split(";")) {
|
|
2220
|
+
const tokens = rawDirective.trim().split(/\s+/).filter(Boolean);
|
|
2221
|
+
if (!tokens.length) continue;
|
|
2222
|
+
directives.set(tokens[0].toLowerCase(), tokens.slice(1));
|
|
2223
|
+
}
|
|
2224
|
+
for (const name of names) {
|
|
2225
|
+
const sources = directives.get(name);
|
|
2226
|
+
if (sources) return sources;
|
|
2227
|
+
}
|
|
2228
|
+
return null;
|
|
2229
|
+
}
|
|
2230
|
+
function allowsInlineStyleForCsp(csp) {
|
|
2231
|
+
const sources = cspDirectiveSources(csp, [
|
|
2232
|
+
"style-src-elem",
|
|
2233
|
+
"style-src",
|
|
2234
|
+
"default-src"
|
|
2235
|
+
]);
|
|
2236
|
+
return sources === null || sources.includes("'unsafe-inline'");
|
|
2237
|
+
}
|
|
2238
|
+
function allowsInlineScriptAttributeForCsp(csp) {
|
|
2239
|
+
const sources = cspDirectiveSources(csp, [
|
|
2240
|
+
"script-src-attr",
|
|
2241
|
+
"script-src",
|
|
2242
|
+
"default-src"
|
|
2243
|
+
]);
|
|
2244
|
+
return sources === null || sources.includes("'unsafe-inline'");
|
|
2245
|
+
}
|
|
2246
|
+
function allowsInlineScriptElementForCsp(csp) {
|
|
2247
|
+
const sources = cspDirectiveSources(csp, [
|
|
2248
|
+
"script-src-elem",
|
|
2249
|
+
"script-src",
|
|
2250
|
+
"default-src"
|
|
2251
|
+
]);
|
|
2252
|
+
return sources === null || sources.includes("'unsafe-inline'");
|
|
2253
|
+
}
|
|
2254
|
+
function normalizeFontLinksForCsp(links, inlineScriptAttributeAllowed, inlineScriptElementAllowed) {
|
|
2255
|
+
return links.map((link) => {
|
|
2256
|
+
const next = { ...link };
|
|
2257
|
+
const needsInlineAttribute = next["data-resux-font-async"] === "true";
|
|
2258
|
+
const needsInlineScript = next["data-resux-font-lazy"] === "true";
|
|
2259
|
+
if (needsInlineAttribute && !inlineScriptAttributeAllowed || needsInlineScript && !inlineScriptElementAllowed) {
|
|
2260
|
+
delete next.media;
|
|
2261
|
+
delete next.onload;
|
|
2262
|
+
delete next["data-resux-font-async"];
|
|
2263
|
+
delete next["data-resux-font-lazy"];
|
|
2264
|
+
}
|
|
2265
|
+
return next;
|
|
2266
|
+
});
|
|
2267
|
+
}
|
|
2268
|
+
function isResuxFontLoaderScript(entry) {
|
|
2269
|
+
return entry["data-resux-font-loader"] === "true";
|
|
2270
|
+
}
|
|
2271
|
+
function readInlinePublicCss(appRoot, href, maxBytes) {
|
|
2272
|
+
if (maxBytes <= 0 || !href.startsWith("/") || href.startsWith("//") || href.includes("..") || /^[a-z][a-z0-9+.-]*:/i.test(href)) return null;
|
|
2273
|
+
const pathname = href.split(/[?#]/, 1)[0];
|
|
2274
|
+
if (!pathname.toLowerCase().endsWith(".css")) return null;
|
|
2275
|
+
const publicRoot = path.resolve(appRoot, "public");
|
|
2276
|
+
const staticRoot = path.resolve(appRoot, "static");
|
|
2277
|
+
const relativePath = pathname.replace(/^\/+/, "");
|
|
2278
|
+
const candidates = [path.resolve(publicRoot, relativePath), path.resolve(staticRoot, relativePath)];
|
|
2279
|
+
for (const candidate of candidates) {
|
|
2280
|
+
if (!(candidate.startsWith(publicRoot + path.sep) ? publicRoot : candidate.startsWith(staticRoot + path.sep) ? staticRoot : null) || !existsSync(candidate)) continue;
|
|
2281
|
+
const css = ts.sys.readFile(candidate);
|
|
2282
|
+
if (typeof css !== "string" || Buffer.byteLength(css, "utf8") > maxBytes || hasRelativeCssReferences(css)) continue;
|
|
2283
|
+
return css;
|
|
2284
|
+
}
|
|
2285
|
+
return null;
|
|
2286
|
+
}
|
|
2287
|
+
function hasRelativeCssReferences(css) {
|
|
2288
|
+
for (const match of css.matchAll(/url\(\s*(?:"([^"]*)"|'([^']*)'|([^)"']+))\s*\)/gi)) if (isRelativeCssReference(String(match[1] ?? match[2] ?? match[3] ?? "").trim())) return true;
|
|
2289
|
+
for (const match of css.matchAll(/@import\s+(?:url\(\s*)?(?:"([^"]*)"|'([^']*)'|([^\s;)]+))/gi)) if (isRelativeCssReference(String(match[1] ?? match[2] ?? match[3] ?? "").trim())) return true;
|
|
2290
|
+
return false;
|
|
2291
|
+
}
|
|
2292
|
+
function isRelativeCssReference(value) {
|
|
2293
|
+
if (!value || value.startsWith("/") || value.startsWith("#") || value.startsWith("//")) return false;
|
|
2294
|
+
return !/^(?:data|blob|https?):/i.test(value);
|
|
2295
|
+
}
|
|
2154
2296
|
function scanRuntimeConfigForSecrets(config, halalConfig) {
|
|
2155
2297
|
const publicConfig = config.public;
|
|
2156
2298
|
if (!publicConfig || typeof publicConfig !== "object") return;
|
|
@@ -2191,13 +2333,15 @@ function createRuntimeConfig(config) {
|
|
|
2191
2333
|
const runtimeConfig = config.runtimeConfig;
|
|
2192
2334
|
const packagesConfig = isPlainObject(config.packages) ? config.packages : null;
|
|
2193
2335
|
const videoConfig = isPlainObject(config.video) ? config.video : null;
|
|
2336
|
+
const routerConfig = isPlainObject(config.router) ? config.router : null;
|
|
2194
2337
|
const publicConfig = runtimeConfig?.public && typeof runtimeConfig.public === "object" && !Array.isArray(runtimeConfig.public) ? runtimeConfig.public : {};
|
|
2195
2338
|
const appRuntimeConfig = {
|
|
2196
2339
|
...runtimeConfig ?? {},
|
|
2197
2340
|
public: {
|
|
2198
2341
|
...publicConfig,
|
|
2199
2342
|
...packagesConfig ? { packages: packagesConfig } : {},
|
|
2200
|
-
...videoConfig ? { video: videoConfig } : {}
|
|
2343
|
+
...videoConfig ? { video: videoConfig } : {},
|
|
2344
|
+
...routerConfig ? { router: routerConfig } : {}
|
|
2201
2345
|
}
|
|
2202
2346
|
};
|
|
2203
2347
|
const halalConfig = config.halalAI;
|
|
@@ -2355,7 +2499,7 @@ function createSupportModuleAutoImportPrefix(file, source, autoImports) {
|
|
|
2355
2499
|
for (const name of entry.names) {
|
|
2356
2500
|
if (seen.has(name) || declared.has(name)) continue;
|
|
2357
2501
|
seen.add(name);
|
|
2358
|
-
if (!
|
|
2502
|
+
if (!new RegExp(`\\b${name}\\b`).test(source)) continue;
|
|
2359
2503
|
names.push(name);
|
|
2360
2504
|
}
|
|
2361
2505
|
if (names.length > 0) lines.push(`import { ${names.join(", ")} } from ${JSON.stringify(entry.from)};`);
|
|
@@ -2371,8 +2515,10 @@ function collectSupportModuleTopLevelBindings(file, source) {
|
|
|
2371
2515
|
const clause = statement.importClause;
|
|
2372
2516
|
if (!clause) continue;
|
|
2373
2517
|
if (clause.name) bindings.add(clause.name.text);
|
|
2374
|
-
if (clause.namedBindings)
|
|
2375
|
-
|
|
2518
|
+
if (clause.namedBindings) {
|
|
2519
|
+
if (ts.isNamespaceImport(clause.namedBindings)) bindings.add(clause.namedBindings.name.text);
|
|
2520
|
+
else for (const element of clause.namedBindings.elements) bindings.add(element.name.text);
|
|
2521
|
+
}
|
|
2376
2522
|
continue;
|
|
2377
2523
|
}
|
|
2378
2524
|
if (ts.isVariableStatement(statement)) {
|
|
@@ -2486,7 +2632,8 @@ function createModuleOptions(module, options) {
|
|
|
2486
2632
|
return options;
|
|
2487
2633
|
}
|
|
2488
2634
|
function resolveBuiltinModule(specifier) {
|
|
2489
|
-
|
|
2635
|
+
const normalized = specifier.startsWith("resux:") ? specifier.slice(6) : specifier;
|
|
2636
|
+
return builtinModules$1[normalized] ?? null;
|
|
2490
2637
|
}
|
|
2491
2638
|
const i18nBuiltinModule = { async setup(options, resux) {
|
|
2492
2639
|
const imported = await import("../i18n/index.js");
|
|
@@ -2515,17 +2662,27 @@ const builtinModules$1 = {
|
|
|
2515
2662
|
const csp = firstString(input.contentSecurityPolicy);
|
|
2516
2663
|
if (csp) headers["content-security-policy"] = csp;
|
|
2517
2664
|
resux.addRouteRule(routePath, { headers });
|
|
2518
|
-
resux.extendRuntimeConfig({
|
|
2665
|
+
resux.extendRuntimeConfig({
|
|
2666
|
+
public: { securityHeaders: true },
|
|
2667
|
+
resuxSecurity: {
|
|
2668
|
+
contentSecurityPolicy: csp ?? "",
|
|
2669
|
+
route: routePath
|
|
2670
|
+
}
|
|
2671
|
+
});
|
|
2519
2672
|
}
|
|
2520
2673
|
},
|
|
2521
2674
|
performance: {
|
|
2522
2675
|
defaults: {
|
|
2523
2676
|
assetMaxAge: 31536e3,
|
|
2524
|
-
routePayloadNoStore: true
|
|
2677
|
+
routePayloadNoStore: true,
|
|
2678
|
+
inlineCss: true,
|
|
2679
|
+
inlineCssMaxBytes: 65536
|
|
2525
2680
|
},
|
|
2526
2681
|
setup(options, resux) {
|
|
2527
2682
|
const input = isPlainObject(options) ? options : {};
|
|
2528
2683
|
const maxAge = Number.isFinite(input.assetMaxAge) ? Math.max(0, Math.floor(input.assetMaxAge)) : 31536e3;
|
|
2684
|
+
const inlineCss = input.inlineCss !== false;
|
|
2685
|
+
const inlineCssMaxBytes = Number.isFinite(input.inlineCssMaxBytes) ? Math.max(0, Math.floor(input.inlineCssMaxBytes)) : 65536;
|
|
2529
2686
|
const assetCache = { maxAge };
|
|
2530
2687
|
resux.addRouteRule("/__resux/runtime-client.mjs", { cache: assetCache });
|
|
2531
2688
|
resux.addRouteRule("/__resux/handlers/**", { cache: assetCache });
|
|
@@ -2533,7 +2690,11 @@ const builtinModules$1 = {
|
|
|
2533
2690
|
resux.addRouteRule("/__resux/image", { cache: assetCache });
|
|
2534
2691
|
resux.addRouteRule("/__resux/video", { cache: assetCache });
|
|
2535
2692
|
if (input.routePayloadNoStore !== false) resux.addRouteRule("/__resux/route", { cache: false });
|
|
2536
|
-
resux.extendRuntimeConfig({ public: { performanceModule: {
|
|
2693
|
+
resux.extendRuntimeConfig({ public: { performanceModule: {
|
|
2694
|
+
assetMaxAge: maxAge,
|
|
2695
|
+
inlineCss,
|
|
2696
|
+
inlineCssMaxBytes
|
|
2697
|
+
} } });
|
|
2537
2698
|
}
|
|
2538
2699
|
}
|
|
2539
2700
|
};
|
|
@@ -3158,7 +3319,7 @@ function resolveConfiguredPackageMode(packageName, config) {
|
|
|
3158
3319
|
async function analyzePackageUsage(appRoot, sources, runtimeConfig) {
|
|
3159
3320
|
const configuredPackages = readConfiguredPackages(runtimeConfig);
|
|
3160
3321
|
const map = /* @__PURE__ */ new Map();
|
|
3161
|
-
const ignoredPackages = new Set([
|
|
3322
|
+
const ignoredPackages = /* @__PURE__ */ new Set([
|
|
3162
3323
|
"resuxjs",
|
|
3163
3324
|
"vue",
|
|
3164
3325
|
"h3",
|
|
@@ -3385,7 +3546,6 @@ function resolveFileExtension(filePath) {
|
|
|
3385
3546
|
function fileUrl(file) {
|
|
3386
3547
|
return pathToFileURL(file).href;
|
|
3387
3548
|
}
|
|
3388
|
-
|
|
3389
|
-
//#endregion
|
|
3390
3549
|
export { ResuxCompileError, buildProject, compileVueFile, compileVueSource, createRouteManifest, fileUrl, resolveFileExtension };
|
|
3550
|
+
|
|
3391
3551
|
//# sourceMappingURL=index.js.map
|