resuxjs 0.2.43 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +991 -666
- package/dist/cli.js +1990 -355
- package/dist/cli.js.map +1 -1
- package/dist/compiler/adapter.d.ts +17 -0
- package/dist/compiler/adapter.js +106 -0
- package/dist/compiler/adapter.js.map +1 -0
- package/dist/compiler/dev-warnings.d.ts +11 -0
- package/dist/compiler/dev-warnings.js +360 -0
- package/dist/compiler/dev-warnings.js.map +1 -0
- package/dist/compiler/directives.d.ts +13 -0
- package/dist/compiler/directives.js +167 -0
- package/dist/compiler/directives.js.map +1 -0
- package/dist/compiler/implementation.d.ts +129 -0
- package/dist/compiler/implementation.js +3745 -0
- package/dist/compiler/implementation.js.map +1 -0
- package/dist/compiler/index.d.ts +9 -103
- package/dist/compiler/index.js +74 -1971
- package/dist/compiler/index.js.map +1 -1
- package/dist/core/config.d.ts +8 -0
- package/dist/core/config.js +21 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/hooks.d.ts +133 -0
- package/dist/core/hooks.js +54 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/module-container.d.ts +100 -0
- package/dist/core/module-container.js +171 -0
- package/dist/core/module-container.js.map +1 -0
- package/dist/core/resux.d.ts +18 -0
- package/dist/core/resux.js +18 -0
- package/dist/core/resux.js.map +1 -0
- package/dist/create.d.ts +1 -0
- package/dist/create.js +878 -22
- package/dist/create.js.map +1 -1
- package/dist/deploy/cloudflare.js +17 -3
- package/dist/deploy/cloudflare.js.map +1 -1
- package/dist/deploy/common.js +4 -3
- package/dist/deploy/common.js.map +1 -1
- package/dist/fonts/index.d.ts +16 -0
- package/dist/fonts/index.js +154 -0
- package/dist/fonts/index.js.map +1 -0
- package/dist/globals.d.ts +27 -2
- package/dist/halal-core/ai/classifyProject.d.ts +4 -0
- package/dist/halal-core/ai/classifyProject.js +104 -0
- package/dist/halal-core/ai/classifyProject.js.map +1 -0
- package/dist/halal-core/ai/createProjectSummary.d.ts +39 -0
- package/dist/halal-core/ai/createProjectSummary.js +42 -0
- package/dist/halal-core/ai/createProjectSummary.js.map +1 -0
- package/dist/halal-core/ai/halalClassifierPrompt.d.ts +1 -0
- package/dist/halal-core/ai/halalClassifierPrompt.js +20 -0
- package/dist/halal-core/ai/halalClassifierPrompt.js.map +1 -0
- package/dist/halal-core/ai/redactSensitiveData.d.ts +1 -0
- package/dist/halal-core/ai/redactSensitiveData.js +139 -0
- package/dist/halal-core/ai/redactSensitiveData.js.map +1 -0
- package/dist/halal-core/ai/validateAiResponse.d.ts +2 -0
- package/dist/halal-core/ai/validateAiResponse.js +97 -0
- package/dist/halal-core/ai/validateAiResponse.js.map +1 -0
- package/dist/halal-core/cli/check.d.ts +1 -0
- package/dist/halal-core/cli/check.js +36 -0
- package/dist/halal-core/cli/check.js.map +1 -0
- package/dist/halal-core/cli/explain.d.ts +1 -0
- package/dist/halal-core/cli/explain.js +35 -0
- package/dist/halal-core/cli/explain.js.map +1 -0
- package/dist/halal-core/cli/report.d.ts +1 -0
- package/dist/halal-core/cli/report.js +15 -0
- package/dist/halal-core/cli/report.js.map +1 -0
- package/dist/halal-core/cli/submitReview.d.ts +1 -0
- package/dist/halal-core/cli/submitReview.js +12 -0
- package/dist/halal-core/cli/submitReview.js.map +1 -0
- package/dist/halal-core/cli/verifyReview.d.ts +1 -0
- package/dist/halal-core/cli/verifyReview.js +19 -0
- package/dist/halal-core/cli/verifyReview.js.map +1 -0
- package/dist/halal-core/config.d.ts +40 -0
- package/dist/halal-core/config.js +128 -0
- package/dist/halal-core/config.js.map +1 -0
- package/dist/halal-core/crypto/integrity.d.ts +9 -0
- package/dist/halal-core/crypto/integrity.js +101 -0
- package/dist/halal-core/crypto/integrity.js.map +1 -0
- package/dist/halal-core/enforce.d.ts +5 -0
- package/dist/halal-core/enforce.js +119 -0
- package/dist/halal-core/enforce.js.map +1 -0
- package/dist/halal-core/index.d.ts +14 -0
- package/dist/halal-core/index.js +17 -0
- package/dist/halal-core/index.js.map +1 -0
- package/dist/halal-core/lifecycle.d.ts +1 -0
- package/dist/halal-core/lifecycle.js +15 -0
- package/dist/halal-core/lifecycle.js.map +1 -0
- package/dist/halal-core/policy.d.ts +2 -0
- package/dist/halal-core/policy.js +5 -0
- package/dist/halal-core/policy.js.map +1 -0
- package/dist/halal-core/report/formatBrowserOverlay.d.ts +2 -0
- package/dist/halal-core/report/formatBrowserOverlay.js +41 -0
- package/dist/halal-core/report/formatBrowserOverlay.js.map +1 -0
- package/dist/halal-core/report/formatTerminalReport.d.ts +2 -0
- package/dist/halal-core/report/formatTerminalReport.js +39 -0
- package/dist/halal-core/report/formatTerminalReport.js.map +1 -0
- package/dist/halal-core/report/generateHalalReport.d.ts +7 -0
- package/dist/halal-core/report/generateHalalReport.js +46 -0
- package/dist/halal-core/report/generateHalalReport.js.map +1 -0
- package/dist/halal-core/report/signReport.d.ts +3 -0
- package/dist/halal-core/report/signReport.js +17 -0
- package/dist/halal-core/report/signReport.js.map +1 -0
- package/dist/halal-core/report/verifyReport.d.ts +11 -0
- package/dist/halal-core/report/verifyReport.js +45 -0
- package/dist/halal-core/report/verifyReport.js.map +1 -0
- package/dist/halal-core/review/createReviewRequest.d.ts +2 -0
- package/dist/halal-core/review/createReviewRequest.js +21 -0
- package/dist/halal-core/review/createReviewRequest.js.map +1 -0
- package/dist/halal-core/review/reviewPolicy.d.ts +3 -0
- package/dist/halal-core/review/reviewPolicy.js +21 -0
- package/dist/halal-core/review/reviewPolicy.js.map +1 -0
- package/dist/halal-core/review/signedReviewFile.d.ts +13 -0
- package/dist/halal-core/review/signedReviewFile.js +28 -0
- package/dist/halal-core/review/signedReviewFile.js.map +1 -0
- package/dist/halal-core/review/verifyReviewApproval.d.ts +10 -0
- package/dist/halal-core/review/verifyReviewApproval.js +68 -0
- package/dist/halal-core/review/verifyReviewApproval.js.map +1 -0
- package/dist/halal-core/rules/adultContentRules.d.ts +2 -0
- package/dist/halal-core/rules/adultContentRules.js +26 -0
- package/dist/halal-core/rules/adultContentRules.js.map +1 -0
- package/dist/halal-core/rules/alcoholDrugVapeRules.d.ts +2 -0
- package/dist/halal-core/rules/alcoholDrugVapeRules.js +25 -0
- package/dist/halal-core/rules/alcoholDrugVapeRules.js.map +1 -0
- package/dist/halal-core/rules/childSafetyRules.d.ts +2 -0
- package/dist/halal-core/rules/childSafetyRules.js +22 -0
- package/dist/halal-core/rules/childSafetyRules.js.map +1 -0
- package/dist/halal-core/rules/coreCategories.d.ts +7 -0
- package/dist/halal-core/rules/coreCategories.js +112 -0
- package/dist/halal-core/rules/coreCategories.js.map +1 -0
- package/dist/halal-core/rules/cyberAbuseRules.d.ts +2 -0
- package/dist/halal-core/rules/cyberAbuseRules.js +30 -0
- package/dist/halal-core/rules/cyberAbuseRules.js.map +1 -0
- package/dist/halal-core/rules/defaultBlockedRules.d.ts +20 -0
- package/dist/halal-core/rules/defaultBlockedRules.js +216 -0
- package/dist/halal-core/rules/defaultBlockedRules.js.map +1 -0
- package/dist/halal-core/rules/dependencyRules.d.ts +9 -0
- package/dist/halal-core/rules/dependencyRules.js +59 -0
- package/dist/halal-core/rules/dependencyRules.js.map +1 -0
- package/dist/halal-core/rules/endpointRules.d.ts +6 -0
- package/dist/halal-core/rules/endpointRules.js +26 -0
- package/dist/halal-core/rules/endpointRules.js.map +1 -0
- package/dist/halal-core/rules/environmentalHarmRules.d.ts +2 -0
- package/dist/halal-core/rules/environmentalHarmRules.js +20 -0
- package/dist/halal-core/rules/environmentalHarmRules.js.map +1 -0
- package/dist/halal-core/rules/financeRibaRules.d.ts +2 -0
- package/dist/halal-core/rules/financeRibaRules.js +23 -0
- package/dist/halal-core/rules/financeRibaRules.js.map +1 -0
- package/dist/halal-core/rules/gamblingRules.d.ts +2 -0
- package/dist/halal-core/rules/gamblingRules.js +25 -0
- package/dist/halal-core/rules/gamblingRules.js.map +1 -0
- package/dist/halal-core/rules/generalHarmRules.d.ts +2 -0
- package/dist/halal-core/rules/generalHarmRules.js +18 -0
- package/dist/halal-core/rules/generalHarmRules.js.map +1 -0
- package/dist/halal-core/rules/healthHarmRules.d.ts +2 -0
- package/dist/halal-core/rules/healthHarmRules.js +22 -0
- package/dist/halal-core/rules/healthHarmRules.js.map +1 -0
- package/dist/halal-core/rules/keywordRules.d.ts +10 -0
- package/dist/halal-core/rules/keywordRules.js +41 -0
- package/dist/halal-core/rules/keywordRules.js.map +1 -0
- package/dist/halal-core/rules/privacyAbuseRules.d.ts +2 -0
- package/dist/halal-core/rules/privacyAbuseRules.js +24 -0
- package/dist/halal-core/rules/privacyAbuseRules.js.map +1 -0
- package/dist/halal-core/rules/scamFraudRules.d.ts +2 -0
- package/dist/halal-core/rules/scamFraudRules.js +32 -0
- package/dist/halal-core/rules/scamFraudRules.js.map +1 -0
- package/dist/halal-core/rules/selfHarmRules.d.ts +2 -0
- package/dist/halal-core/rules/selfHarmRules.js +20 -0
- package/dist/halal-core/rules/selfHarmRules.js.map +1 -0
- package/dist/halal-core/rules/violenceExtremismRules.d.ts +2 -0
- package/dist/halal-core/rules/violenceExtremismRules.js +33 -0
- package/dist/halal-core/rules/violenceExtremismRules.js.map +1 -0
- package/dist/halal-core/scanner/scanApiRoutes.d.ts +1 -0
- package/dist/halal-core/scanner/scanApiRoutes.js +40 -0
- package/dist/halal-core/scanner/scanApiRoutes.js.map +1 -0
- package/dist/halal-core/scanner/scanComponents.d.ts +1 -0
- package/dist/halal-core/scanner/scanComponents.js +17 -0
- package/dist/halal-core/scanner/scanComponents.js.map +1 -0
- package/dist/halal-core/scanner/scanContent.d.ts +5 -0
- package/dist/halal-core/scanner/scanContent.js +302 -0
- package/dist/halal-core/scanner/scanContent.js.map +1 -0
- package/dist/halal-core/scanner/scanDependencies.d.ts +1 -0
- package/dist/halal-core/scanner/scanDependencies.js +19 -0
- package/dist/halal-core/scanner/scanDependencies.js.map +1 -0
- package/dist/halal-core/scanner/scanDomains.d.ts +4 -0
- package/dist/halal-core/scanner/scanDomains.js +14 -0
- package/dist/halal-core/scanner/scanDomains.js.map +1 -0
- package/dist/halal-core/scanner/scanEnvNames.d.ts +1 -0
- package/dist/halal-core/scanner/scanEnvNames.js +30 -0
- package/dist/halal-core/scanner/scanEnvNames.js.map +1 -0
- package/dist/halal-core/scanner/scanMetadata.d.ts +6 -0
- package/dist/halal-core/scanner/scanMetadata.js +33 -0
- package/dist/halal-core/scanner/scanMetadata.js.map +1 -0
- package/dist/halal-core/scanner/scanPages.d.ts +1 -0
- package/dist/halal-core/scanner/scanPages.js +19 -0
- package/dist/halal-core/scanner/scanPages.js.map +1 -0
- package/dist/halal-core/scanner/scanProject.d.ts +13 -0
- package/dist/halal-core/scanner/scanProject.js +62 -0
- package/dist/halal-core/scanner/scanProject.js.map +1 -0
- package/dist/halal-core/scanner/scanRoutes.d.ts +1 -0
- package/dist/halal-core/scanner/scanRoutes.js +43 -0
- package/dist/halal-core/scanner/scanRoutes.js.map +1 -0
- package/dist/halal-core/scanner/scanTranslations.d.ts +1 -0
- package/dist/halal-core/scanner/scanTranslations.js +32 -0
- package/dist/halal-core/scanner/scanTranslations.js.map +1 -0
- package/dist/halal-core/status.d.ts +14 -0
- package/dist/halal-core/status.js +2 -0
- package/dist/halal-core/status.js.map +1 -0
- package/dist/halal-core/tamper/verifyCoreIntegrity.d.ts +1 -0
- package/dist/halal-core/tamper/verifyCoreIntegrity.js +28 -0
- package/dist/halal-core/tamper/verifyCoreIntegrity.js.map +1 -0
- package/dist/halal-core/tamper/verifyLifecycleHooks.d.ts +1 -0
- package/dist/halal-core/tamper/verifyLifecycleHooks.js +14 -0
- package/dist/halal-core/tamper/verifyLifecycleHooks.js.map +1 -0
- package/dist/halal-core/tamper/verifyReportSignature.d.ts +5 -0
- package/dist/halal-core/tamper/verifyReportSignature.js +18 -0
- package/dist/halal-core/tamper/verifyReportSignature.js.map +1 -0
- package/dist/i18n/index.d.ts +45 -0
- package/dist/i18n/index.js +284 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/shared.d.ts +35 -0
- package/dist/i18n/shared.js +270 -0
- package/dist/i18n/shared.js.map +1 -0
- package/dist/icons/index.d.ts +159 -0
- package/dist/icons/index.js +286 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/kit/index.d.ts +29 -0
- package/dist/kit/index.js +72 -0
- package/dist/kit/index.js.map +1 -0
- package/dist/nitro-server/index.d.ts +7 -0
- package/dist/nitro-server/index.js +4 -0
- package/dist/nitro-server/index.js.map +1 -0
- package/dist/reactivity/computed.js +9 -4
- package/dist/reactivity/computed.js.map +1 -1
- package/dist/reactivity/effect.d.ts +3 -1
- package/dist/reactivity/effect.js +56 -6
- package/dist/reactivity/effect.js.map +1 -1
- package/dist/reactivity/reactive.js +64 -15
- package/dist/reactivity/reactive.js.map +1 -1
- package/dist/reactivity/ref.d.ts +1 -0
- package/dist/reactivity/ref.js +13 -6
- package/dist/reactivity/ref.js.map +1 -1
- package/dist/reactivity/scheduler.js +36 -4
- package/dist/reactivity/scheduler.js.map +1 -1
- package/dist/reactivity/watch.js +27 -5
- package/dist/reactivity/watch.js.map +1 -1
- package/dist/runtime/index.d.ts +226 -3
- package/dist/runtime/index.js +13344 -6395
- package/dist/runtime/index.js.map +1 -1
- package/dist/ui/index.d.ts +1828 -0
- package/dist/ui/index.js +938 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/vite-builder/index.d.ts +6 -0
- package/dist/vite-builder/index.js +4 -0
- package/dist/vite-builder/index.js.map +1 -0
- package/package.json +145 -105
- package/templates/default/.env.example +1 -0
- package/templates/default/README.md +18 -14
- package/templates/default/_gitignore +8 -5
- package/templates/default/assets/css/main.css +4 -0
- package/templates/default/nitro.config.ts +9 -5
- package/templates/default/pages/index.vue +102 -87
- package/templates/default/public/favicon.svg +4 -0
- package/templates/default/types/app.d.ts +3 -0
- package/templates/default/.resux-nitro/handler.ts +0 -21
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export interface ResuxHookPayloads {
|
|
2
|
+
"config:resolved": {
|
|
3
|
+
rootDir: string;
|
|
4
|
+
buildDir: string;
|
|
5
|
+
config: Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
"app:resolve": {
|
|
8
|
+
appRoot: string;
|
|
9
|
+
outDir: string;
|
|
10
|
+
};
|
|
11
|
+
"app:templates": {
|
|
12
|
+
outDir: string;
|
|
13
|
+
templatesDir: string;
|
|
14
|
+
};
|
|
15
|
+
"app:templatesGenerated": {
|
|
16
|
+
outDir: string;
|
|
17
|
+
files: string[];
|
|
18
|
+
};
|
|
19
|
+
"pages:extend": {
|
|
20
|
+
pages: Array<Record<string, unknown>>;
|
|
21
|
+
};
|
|
22
|
+
"pages:resolved": {
|
|
23
|
+
pages: Array<Record<string, unknown>>;
|
|
24
|
+
};
|
|
25
|
+
"imports:dirs": {
|
|
26
|
+
dirs: string[];
|
|
27
|
+
};
|
|
28
|
+
"imports:extend": {
|
|
29
|
+
imports: Array<Record<string, unknown>>;
|
|
30
|
+
};
|
|
31
|
+
"components:dirs": {
|
|
32
|
+
dirs: string[];
|
|
33
|
+
};
|
|
34
|
+
"components:extend": {
|
|
35
|
+
components: Array<Record<string, unknown>>;
|
|
36
|
+
};
|
|
37
|
+
"plugins:dirs": {
|
|
38
|
+
dirs: string[];
|
|
39
|
+
};
|
|
40
|
+
"plugins:extend": {
|
|
41
|
+
plugins: Array<Record<string, unknown>>;
|
|
42
|
+
};
|
|
43
|
+
"middleware:dirs": {
|
|
44
|
+
dirs: string[];
|
|
45
|
+
};
|
|
46
|
+
"middleware:extend": {
|
|
47
|
+
middleware: Array<Record<string, unknown>>;
|
|
48
|
+
};
|
|
49
|
+
"vite:extendConfig": {
|
|
50
|
+
config: Record<string, unknown>;
|
|
51
|
+
dev: boolean;
|
|
52
|
+
};
|
|
53
|
+
"vite:serverCreated": {
|
|
54
|
+
server: unknown;
|
|
55
|
+
};
|
|
56
|
+
"vite:compiled": {
|
|
57
|
+
outDir: string;
|
|
58
|
+
dev: boolean;
|
|
59
|
+
};
|
|
60
|
+
"build:before": {
|
|
61
|
+
appRoot: string;
|
|
62
|
+
outDir: string;
|
|
63
|
+
mode: "dev" | "build";
|
|
64
|
+
};
|
|
65
|
+
"build:manifest": {
|
|
66
|
+
manifest: Record<string, unknown>;
|
|
67
|
+
outDir: string;
|
|
68
|
+
};
|
|
69
|
+
"build:done": {
|
|
70
|
+
appRoot: string;
|
|
71
|
+
outDir: string;
|
|
72
|
+
mode: "dev" | "build";
|
|
73
|
+
};
|
|
74
|
+
"build:error": {
|
|
75
|
+
appRoot: string;
|
|
76
|
+
outDir: string;
|
|
77
|
+
mode: "dev" | "build";
|
|
78
|
+
error: unknown;
|
|
79
|
+
};
|
|
80
|
+
"nitro:config": {
|
|
81
|
+
config: Record<string, unknown>;
|
|
82
|
+
};
|
|
83
|
+
"nitro:init": {
|
|
84
|
+
appRoot: string;
|
|
85
|
+
};
|
|
86
|
+
"nitro:build:before": {
|
|
87
|
+
appRoot: string;
|
|
88
|
+
preset?: string;
|
|
89
|
+
};
|
|
90
|
+
"nitro:build:public-assets": {
|
|
91
|
+
appRoot: string;
|
|
92
|
+
publicDir: string;
|
|
93
|
+
};
|
|
94
|
+
"prepare:types": {
|
|
95
|
+
outDir: string;
|
|
96
|
+
files: string[];
|
|
97
|
+
};
|
|
98
|
+
"dev:reload": {
|
|
99
|
+
appRoot: string;
|
|
100
|
+
changedPath: string;
|
|
101
|
+
};
|
|
102
|
+
"dev:error": {
|
|
103
|
+
appRoot: string;
|
|
104
|
+
error: unknown;
|
|
105
|
+
};
|
|
106
|
+
"page:loading:start": {
|
|
107
|
+
path?: string;
|
|
108
|
+
};
|
|
109
|
+
"page:loading:end": {
|
|
110
|
+
path?: string;
|
|
111
|
+
};
|
|
112
|
+
"page:finish": {
|
|
113
|
+
path?: string;
|
|
114
|
+
};
|
|
115
|
+
"app:error": {
|
|
116
|
+
error: unknown;
|
|
117
|
+
};
|
|
118
|
+
"app:error:cleared": {
|
|
119
|
+
path?: string;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export type ResuxHookName = keyof ResuxHookPayloads;
|
|
123
|
+
export type ResuxHookHandler<T = unknown> = (payload: T) => void | Promise<void>;
|
|
124
|
+
export declare class ResuxHooks {
|
|
125
|
+
private readonly map;
|
|
126
|
+
hook<K extends ResuxHookName>(name: K, handler: ResuxHookHandler<ResuxHookPayloads[K]>): () => void;
|
|
127
|
+
addHooks(handlers: Partial<{
|
|
128
|
+
[K in ResuxHookName]: ResuxHookHandler<ResuxHookPayloads[K]> | ResuxHookHandler<ResuxHookPayloads[K]>[];
|
|
129
|
+
}>): void;
|
|
130
|
+
callHook<K extends ResuxHookName>(name: K, payload: ResuxHookPayloads[K]): Promise<void>;
|
|
131
|
+
private remove;
|
|
132
|
+
}
|
|
133
|
+
export declare function createResuxHooks(): ResuxHooks;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export class ResuxHooks {
|
|
2
|
+
map = {};
|
|
3
|
+
hook(name, handler) {
|
|
4
|
+
const handlers = (this.map[name] ?? []);
|
|
5
|
+
handlers.push(handler);
|
|
6
|
+
this.map[name] = handlers;
|
|
7
|
+
return () => this.remove(name, handler);
|
|
8
|
+
}
|
|
9
|
+
addHooks(handlers) {
|
|
10
|
+
for (const [key, value] of Object.entries(handlers)) {
|
|
11
|
+
if (!value) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(value)) {
|
|
15
|
+
for (const item of value) {
|
|
16
|
+
this.hook(key, item);
|
|
17
|
+
}
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
this.hook(key, value);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async callHook(name, payload) {
|
|
24
|
+
const handlers = this.map[name];
|
|
25
|
+
if (!handlers || handlers.length === 0) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
for (const handler of handlers) {
|
|
29
|
+
try {
|
|
30
|
+
await handler(payload);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
34
|
+
throw new Error(`Resux hook "${name}" failed: ${message}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
remove(name, target) {
|
|
39
|
+
const handlers = this.map[name];
|
|
40
|
+
if (!handlers?.length) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const next = handlers.filter((handler) => handler !== target);
|
|
44
|
+
if (next.length === 0) {
|
|
45
|
+
delete this.map[name];
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.map[name] = next;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export function createResuxHooks() {
|
|
52
|
+
return new ResuxHooks();
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/core/hooks.ts"],"names":[],"mappings":"AAwCA,MAAM,OAAO,UAAU;IACJ,GAAG,GAAY,EAAE,CAAC;IAEnC,IAAI,CAA0B,IAAO,EAAE,OAA+C;QACpF,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAA6C,CAAC;QACpF,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,QAAsB,CAAC;QACxC,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,QAAQ,CAAC,QAA8H;QACrI,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAoC,EAAE,CAAC;YACvF,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX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KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACtB,OAAO;QACT,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAkB,CAAC;IACtC,CAAC;CACF;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,UAAU,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { ResuxHooks, ResuxHookName, ResuxHookPayloads } from "./hooks.js";
|
|
2
|
+
export type ResuxSupportMode = "all" | "server" | "client";
|
|
3
|
+
export interface ResuxTemplateInput {
|
|
4
|
+
filename: string;
|
|
5
|
+
getContents: () => string | Promise<string>;
|
|
6
|
+
write?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ResuxTypeTemplateInput extends ResuxTemplateInput {
|
|
9
|
+
}
|
|
10
|
+
export interface ResuxComponentInput {
|
|
11
|
+
file: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
global?: boolean;
|
|
14
|
+
mode?: ResuxSupportMode;
|
|
15
|
+
lazy?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ResuxComponentsDirInput {
|
|
18
|
+
path: string;
|
|
19
|
+
global?: boolean;
|
|
20
|
+
mode?: ResuxSupportMode;
|
|
21
|
+
pathPrefix?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface ResuxImportInput {
|
|
24
|
+
from: string;
|
|
25
|
+
name: string;
|
|
26
|
+
as?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ResuxPluginInput {
|
|
29
|
+
src: string;
|
|
30
|
+
mode?: ResuxSupportMode;
|
|
31
|
+
}
|
|
32
|
+
export interface ResuxRouteMiddlewareInput {
|
|
33
|
+
name: string;
|
|
34
|
+
src: string;
|
|
35
|
+
global?: boolean;
|
|
36
|
+
mode?: ResuxSupportMode;
|
|
37
|
+
}
|
|
38
|
+
export interface ResuxServerHandlerInput {
|
|
39
|
+
route: string;
|
|
40
|
+
handler: string;
|
|
41
|
+
middleware?: boolean;
|
|
42
|
+
method?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ResuxPrerenderRouteInput {
|
|
45
|
+
route: string;
|
|
46
|
+
}
|
|
47
|
+
export type PagesExtender = (pages: Array<Record<string, unknown>>) => void | Promise<void>;
|
|
48
|
+
export type ViteConfigExtender = (config: Record<string, unknown>) => void | Promise<void>;
|
|
49
|
+
export type NitroConfigExtender = (config: Record<string, unknown>) => void | Promise<void>;
|
|
50
|
+
export interface ResuxModuleContributions {
|
|
51
|
+
components: ResuxComponentInput[];
|
|
52
|
+
componentDirs: ResuxComponentsDirInput[];
|
|
53
|
+
imports: ResuxImportInput[];
|
|
54
|
+
importDirs: string[];
|
|
55
|
+
plugins: ResuxPluginInput[];
|
|
56
|
+
middleware: ResuxRouteMiddlewareInput[];
|
|
57
|
+
serverHandlers: ResuxServerHandlerInput[];
|
|
58
|
+
serverPlugins: string[];
|
|
59
|
+
templates: ResuxTemplateInput[];
|
|
60
|
+
typeTemplates: ResuxTypeTemplateInput[];
|
|
61
|
+
pagesExtenders: PagesExtender[];
|
|
62
|
+
runtimeConfigExtends: Record<string, unknown>[];
|
|
63
|
+
viteConfigExtenders: ViteConfigExtender[];
|
|
64
|
+
nitroConfigExtenders: NitroConfigExtender[];
|
|
65
|
+
vitePlugins: unknown[];
|
|
66
|
+
routeRules: Array<{
|
|
67
|
+
path: string;
|
|
68
|
+
rule: Record<string, unknown>;
|
|
69
|
+
}>;
|
|
70
|
+
prerenderRoutes: ResuxPrerenderRouteInput[];
|
|
71
|
+
}
|
|
72
|
+
export interface ResuxModuleContext {
|
|
73
|
+
rootDir: string;
|
|
74
|
+
buildDir: string;
|
|
75
|
+
options: Record<string, unknown>;
|
|
76
|
+
addCss(href: string): void;
|
|
77
|
+
addHead(head: Record<string, unknown>): void;
|
|
78
|
+
addRouteRule(path: string, rule: Record<string, unknown>): void;
|
|
79
|
+
extendRuntimeConfig(config: Record<string, unknown>): void;
|
|
80
|
+
hook<K extends ResuxHookName>(name: K, handler: (payload: ResuxHookPayloads[K]) => void | Promise<void>): () => void;
|
|
81
|
+
addComponent(component: ResuxComponentInput | string): void;
|
|
82
|
+
addComponentsDir(dir: ResuxComponentsDirInput | string): void;
|
|
83
|
+
addImports(imports: ResuxImportInput | ResuxImportInput[]): void;
|
|
84
|
+
addImportsDir(dir: string): void;
|
|
85
|
+
addPlugin(plugin: ResuxPluginInput | string): void;
|
|
86
|
+
addRouteMiddleware(middleware: ResuxRouteMiddlewareInput): void;
|
|
87
|
+
addServerHandler(handler: ResuxServerHandlerInput): void;
|
|
88
|
+
addServerPlugin(plugin: string): void;
|
|
89
|
+
addTemplate(template: ResuxTemplateInput): void;
|
|
90
|
+
addTypeTemplate(template: ResuxTypeTemplateInput): void;
|
|
91
|
+
extendPages(extender: PagesExtender): void;
|
|
92
|
+
extendViteConfig(extender: ViteConfigExtender): void;
|
|
93
|
+
extendNitroConfig(extender: NitroConfigExtender): void;
|
|
94
|
+
addVitePlugin(plugin: unknown): void;
|
|
95
|
+
addPrerenderRoutes(route: string | string[]): void;
|
|
96
|
+
}
|
|
97
|
+
export declare class ResuxModuleContainer {
|
|
98
|
+
readonly contributions: ResuxModuleContributions;
|
|
99
|
+
createContext(config: Record<string, unknown>, rootDir: string, buildDir: string, hooks: ResuxHooks): ResuxModuleContext;
|
|
100
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
export class ResuxModuleContainer {
|
|
2
|
+
contributions = {
|
|
3
|
+
components: [],
|
|
4
|
+
componentDirs: [],
|
|
5
|
+
imports: [],
|
|
6
|
+
importDirs: [],
|
|
7
|
+
plugins: [],
|
|
8
|
+
middleware: [],
|
|
9
|
+
serverHandlers: [],
|
|
10
|
+
serverPlugins: [],
|
|
11
|
+
templates: [],
|
|
12
|
+
typeTemplates: [],
|
|
13
|
+
pagesExtenders: [],
|
|
14
|
+
runtimeConfigExtends: [],
|
|
15
|
+
viteConfigExtenders: [],
|
|
16
|
+
nitroConfigExtenders: [],
|
|
17
|
+
vitePlugins: [],
|
|
18
|
+
routeRules: [],
|
|
19
|
+
prerenderRoutes: []
|
|
20
|
+
};
|
|
21
|
+
createContext(config, rootDir, buildDir, hooks) {
|
|
22
|
+
return {
|
|
23
|
+
rootDir,
|
|
24
|
+
buildDir,
|
|
25
|
+
options: config,
|
|
26
|
+
addCss: (href) => {
|
|
27
|
+
const css = Array.isArray(config.css) ? config.css : [];
|
|
28
|
+
if (!css.includes(href)) {
|
|
29
|
+
css.push(href);
|
|
30
|
+
}
|
|
31
|
+
config.css = css;
|
|
32
|
+
},
|
|
33
|
+
addHead: (head) => {
|
|
34
|
+
const app = isObject(config.app) ? config.app : {};
|
|
35
|
+
const current = isObject(app.head) ? app.head : {};
|
|
36
|
+
app.head = mergeHead(current, head);
|
|
37
|
+
config.app = app;
|
|
38
|
+
},
|
|
39
|
+
addRouteRule: (path, rule) => {
|
|
40
|
+
if (!path.startsWith("/")) {
|
|
41
|
+
throw new Error(`Route rules need an absolute path. Received "${path}".`);
|
|
42
|
+
}
|
|
43
|
+
const routeRules = isObject(config.routeRules) ? config.routeRules : {};
|
|
44
|
+
const current = isObject(routeRules[path]) ? routeRules[path] : {};
|
|
45
|
+
const merged = {
|
|
46
|
+
...current,
|
|
47
|
+
...rule,
|
|
48
|
+
headers: {
|
|
49
|
+
...(isObject(current.headers) ? current.headers : {}),
|
|
50
|
+
...(isObject(rule.headers) ? rule.headers : {})
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
routeRules[path] = merged;
|
|
54
|
+
config.routeRules = routeRules;
|
|
55
|
+
this.contributions.routeRules.push({ path, rule: merged });
|
|
56
|
+
},
|
|
57
|
+
extendRuntimeConfig: (runtimeConfig) => {
|
|
58
|
+
this.contributions.runtimeConfigExtends.push(runtimeConfig);
|
|
59
|
+
const current = isObject(config.runtimeConfig) ? config.runtimeConfig : {};
|
|
60
|
+
config.runtimeConfig = deepMergeObjects(current, runtimeConfig);
|
|
61
|
+
},
|
|
62
|
+
hook: (name, handler) => hooks.hook(name, handler),
|
|
63
|
+
addComponent: (component) => {
|
|
64
|
+
if (typeof component === "string") {
|
|
65
|
+
this.contributions.components.push({ file: component });
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.contributions.components.push(component);
|
|
69
|
+
},
|
|
70
|
+
addComponentsDir: (dir) => {
|
|
71
|
+
if (typeof dir === "string") {
|
|
72
|
+
this.contributions.componentDirs.push({ path: dir });
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.contributions.componentDirs.push(dir);
|
|
76
|
+
},
|
|
77
|
+
addImports: (imports) => {
|
|
78
|
+
const list = Array.isArray(imports) ? imports : [imports];
|
|
79
|
+
this.contributions.imports.push(...list);
|
|
80
|
+
},
|
|
81
|
+
addImportsDir: (dir) => {
|
|
82
|
+
this.contributions.importDirs.push(dir);
|
|
83
|
+
},
|
|
84
|
+
addPlugin: (plugin) => {
|
|
85
|
+
if (typeof plugin === "string") {
|
|
86
|
+
this.contributions.plugins.push({ src: plugin, mode: "all" });
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.contributions.plugins.push({ mode: "all", ...plugin });
|
|
90
|
+
},
|
|
91
|
+
addRouteMiddleware: (middleware) => {
|
|
92
|
+
this.contributions.middleware.push(middleware);
|
|
93
|
+
},
|
|
94
|
+
addServerHandler: (handler) => {
|
|
95
|
+
this.contributions.serverHandlers.push(handler);
|
|
96
|
+
},
|
|
97
|
+
addServerPlugin: (plugin) => {
|
|
98
|
+
this.contributions.serverPlugins.push(plugin);
|
|
99
|
+
},
|
|
100
|
+
addTemplate: (template) => {
|
|
101
|
+
this.contributions.templates.push(template);
|
|
102
|
+
},
|
|
103
|
+
addTypeTemplate: (template) => {
|
|
104
|
+
this.contributions.typeTemplates.push(template);
|
|
105
|
+
},
|
|
106
|
+
extendPages: (extender) => {
|
|
107
|
+
this.contributions.pagesExtenders.push(extender);
|
|
108
|
+
},
|
|
109
|
+
extendViteConfig: (extender) => {
|
|
110
|
+
this.contributions.viteConfigExtenders.push(extender);
|
|
111
|
+
},
|
|
112
|
+
extendNitroConfig: (extender) => {
|
|
113
|
+
this.contributions.nitroConfigExtenders.push(extender);
|
|
114
|
+
},
|
|
115
|
+
addVitePlugin: (plugin) => {
|
|
116
|
+
this.contributions.vitePlugins.push(plugin);
|
|
117
|
+
},
|
|
118
|
+
addPrerenderRoutes: (route) => {
|
|
119
|
+
const list = Array.isArray(route) ? route : [route];
|
|
120
|
+
for (const item of list) {
|
|
121
|
+
this.contributions.prerenderRoutes.push({ route: item });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function mergeHead(current, next) {
|
|
128
|
+
return {
|
|
129
|
+
...current,
|
|
130
|
+
...next,
|
|
131
|
+
meta: mergeHeadArray(current.meta, next.meta),
|
|
132
|
+
link: mergeHeadArray(current.link, next.link),
|
|
133
|
+
style: mergeHeadArray(current.style, next.style),
|
|
134
|
+
script: mergeHeadArray(current.script, next.script),
|
|
135
|
+
noscript: mergeHeadArray(current.noscript, next.noscript),
|
|
136
|
+
htmlAttrs: {
|
|
137
|
+
...(isObject(current.htmlAttrs) ? current.htmlAttrs : {}),
|
|
138
|
+
...(isObject(next.htmlAttrs) ? next.htmlAttrs : {}),
|
|
139
|
+
},
|
|
140
|
+
bodyAttrs: {
|
|
141
|
+
...(isObject(current.bodyAttrs) ? current.bodyAttrs : {}),
|
|
142
|
+
...(isObject(next.bodyAttrs) ? next.bodyAttrs : {}),
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function mergeHeadArray(current, next) {
|
|
147
|
+
return [
|
|
148
|
+
...(Array.isArray(current) ? current : []),
|
|
149
|
+
...(Array.isArray(next) ? next : []),
|
|
150
|
+
];
|
|
151
|
+
}
|
|
152
|
+
function isObject(value) {
|
|
153
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
154
|
+
}
|
|
155
|
+
const FORBIDDEN_OBJECT_KEYS = new Set(["__proto__", "prototype", "constructor"]);
|
|
156
|
+
function deepMergeObjects(base, next) {
|
|
157
|
+
const output = { ...base };
|
|
158
|
+
for (const [key, value] of Object.entries(next)) {
|
|
159
|
+
if (FORBIDDEN_OBJECT_KEYS.has(key)) {
|
|
160
|
+
throw new Error(`Runtime config contains unsafe key "${key}".`);
|
|
161
|
+
}
|
|
162
|
+
const current = Object.hasOwn(output, key)
|
|
163
|
+
? output[key]
|
|
164
|
+
: undefined;
|
|
165
|
+
output[key] = isObject(current) && isObject(value)
|
|
166
|
+
? deepMergeObjects(current, value)
|
|
167
|
+
: value;
|
|
168
|
+
}
|
|
169
|
+
return output;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=module-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-container.js","sourceRoot":"","sources":["../../src/core/module-container.ts"],"names":[],"mappings":"AA0GA,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;QAC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G,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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ResuxResolvedConfig } from "./config.js";
|
|
2
|
+
import { type ResuxHooks } from "./hooks.js";
|
|
3
|
+
import { ResuxModuleContainer } from "./module-container.js";
|
|
4
|
+
export interface ResuxCoreOptions {
|
|
5
|
+
rootDir: string;
|
|
6
|
+
buildDir: string;
|
|
7
|
+
config: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface ResuxCoreApp {
|
|
10
|
+
rootDir: string;
|
|
11
|
+
buildDir: string;
|
|
12
|
+
options: ResuxResolvedConfig;
|
|
13
|
+
hooks: ResuxHooks;
|
|
14
|
+
hook: ResuxHooks["hook"];
|
|
15
|
+
callHook: ResuxHooks["callHook"];
|
|
16
|
+
modules: ResuxModuleContainer;
|
|
17
|
+
}
|
|
18
|
+
export declare function createResux(options: ResuxCoreOptions): ResuxCoreApp;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolveResuxConfig } from "./config.js";
|
|
2
|
+
import { createResuxHooks } from "./hooks.js";
|
|
3
|
+
import { ResuxModuleContainer } from "./module-container.js";
|
|
4
|
+
export function createResux(options) {
|
|
5
|
+
const hooks = createResuxHooks();
|
|
6
|
+
const resolved = resolveResuxConfig(options.config);
|
|
7
|
+
const modules = new ResuxModuleContainer();
|
|
8
|
+
return {
|
|
9
|
+
rootDir: options.rootDir,
|
|
10
|
+
buildDir: options.buildDir,
|
|
11
|
+
options: resolved,
|
|
12
|
+
hooks,
|
|
13
|
+
hook: hooks.hook.bind(hooks),
|
|
14
|
+
callHook: hooks.callHook.bind(hooks),
|
|
15
|
+
modules
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=resux.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resux.js","sourceRoot":"","sources":["../../src/core/resux.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA4B,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAmB,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAkB7D,MAAM,UAAU,WAAW,CAAC,OAAyB;IACnD,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,OAAO,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC3C,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,QAAQ;QACjB,KAAK;QACL,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;QAC5B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;QACpC,OAAO;KACR,CAAC;AACJ,CAAC"}
|
package/dist/create.d.ts
CHANGED