@cruxjs/base 0.0.3 → 0.0.5
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 +117 -18
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
</div>
|
|
9
9
|
|
|
10
10
|
<div align="center">
|
|
11
|
-
<img src="https://img.shields.io/badge/v-0.0.
|
|
11
|
+
<img src="https://img.shields.io/badge/v-0.0.5-black"/>
|
|
12
12
|
<img src="https://img.shields.io/badge/🔥-@cruxjs-black"/>
|
|
13
13
|
<br>
|
|
14
14
|
<img src="https://img.shields.io/github/issues/cruxjs-org/base?style=flat" alt="Github Repo Issues" />
|
|
@@ -103,26 +103,105 @@
|
|
|
103
103
|
|
|
104
104
|
// App Configuration
|
|
105
105
|
export interface AppConfig {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
// Server
|
|
107
|
+
server? : {
|
|
108
|
+
port? : number
|
|
109
|
+
host? : string
|
|
110
|
+
logging? : boolean | {
|
|
111
|
+
level? : 'debug' | 'info' | 'warn' | 'error'
|
|
112
|
+
pretty? : boolean
|
|
113
|
+
}
|
|
110
114
|
}
|
|
115
|
+
|
|
116
|
+
// Client (auto-build)
|
|
111
117
|
client?: {
|
|
112
|
-
entry
|
|
113
|
-
output
|
|
114
|
-
minify?
|
|
115
|
-
sourcemap?
|
|
118
|
+
entry : string
|
|
119
|
+
output : string
|
|
120
|
+
minify? : boolean
|
|
121
|
+
sourcemap? : boolean
|
|
122
|
+
target? : 'browser' | 'bun'
|
|
123
|
+
external? : string[]
|
|
116
124
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
|
|
126
|
+
// UI Library (auto-install)
|
|
127
|
+
ui?: {
|
|
128
|
+
package : string
|
|
129
|
+
output : string
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Style Build (auto-compile)
|
|
133
|
+
style?: {
|
|
134
|
+
entry : string
|
|
135
|
+
output : string
|
|
136
|
+
minify? : boolean
|
|
137
|
+
sourcemap? : boolean | 'inline' | 'external' | 'none'
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Database
|
|
141
|
+
database?: {
|
|
142
|
+
connection : string
|
|
143
|
+
schema? : string
|
|
144
|
+
name? : string
|
|
145
|
+
timeout? : number
|
|
146
|
+
} | {
|
|
147
|
+
connection : string
|
|
148
|
+
schema? : string
|
|
149
|
+
name? : string
|
|
150
|
+
timeout? : number
|
|
151
|
+
}[]
|
|
152
|
+
|
|
153
|
+
// i18n
|
|
154
|
+
i18n?: {
|
|
155
|
+
defaultLanguage : string
|
|
156
|
+
supportedLanguages : string[]
|
|
157
|
+
basePath : string
|
|
158
|
+
fileExtension? : string
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Static files
|
|
162
|
+
static?: {
|
|
163
|
+
path : string
|
|
164
|
+
directory : string
|
|
165
|
+
maxAge? : number
|
|
166
|
+
index? : string[]
|
|
167
|
+
} | {
|
|
168
|
+
path : string
|
|
169
|
+
directory : string
|
|
170
|
+
maxAge? : number
|
|
171
|
+
index? : string[]
|
|
172
|
+
}[]
|
|
173
|
+
|
|
174
|
+
// API routes
|
|
175
|
+
api?: {
|
|
176
|
+
path : string
|
|
177
|
+
directory : string
|
|
178
|
+
autoLoad? : boolean
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Security
|
|
182
|
+
security?: {
|
|
183
|
+
cors? : boolean | {
|
|
184
|
+
origin? : string | string[]
|
|
185
|
+
credentials? : boolean
|
|
186
|
+
maxAge? : number
|
|
187
|
+
}
|
|
188
|
+
rateLimit?: boolean | {
|
|
189
|
+
windowMs? : number
|
|
190
|
+
max? : number
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// User-defined routes
|
|
195
|
+
routes? : RouteDefinition[]
|
|
196
|
+
|
|
197
|
+
// Middlewares
|
|
198
|
+
middlewares? : AppMiddleware[]
|
|
199
|
+
|
|
200
|
+
// Plugins
|
|
201
|
+
plugins? : CruxPlugin[]
|
|
202
|
+
|
|
203
|
+
// Debug
|
|
204
|
+
debug? : boolean
|
|
126
205
|
}
|
|
127
206
|
|
|
128
207
|
// Route Definition
|
|
@@ -132,6 +211,26 @@
|
|
|
132
211
|
handler : (c: AppContext) => any
|
|
133
212
|
middlewares? : AppMiddleware[]
|
|
134
213
|
}
|
|
214
|
+
|
|
215
|
+
// Life Cycle
|
|
216
|
+
export interface LifecycleContext {
|
|
217
|
+
config : AppConfig
|
|
218
|
+
databases : Map<string, DB>
|
|
219
|
+
plugins : CruxPlugin[]
|
|
220
|
+
server? : any
|
|
221
|
+
clientBuild?: {
|
|
222
|
+
success : boolean
|
|
223
|
+
outputs : string[]
|
|
224
|
+
}
|
|
225
|
+
uiBuild?: {
|
|
226
|
+
success : boolean
|
|
227
|
+
output : string
|
|
228
|
+
} | null
|
|
229
|
+
styleBuild?: {
|
|
230
|
+
success : boolean
|
|
231
|
+
output : string
|
|
232
|
+
} | null
|
|
233
|
+
}
|
|
135
234
|
```
|
|
136
235
|
|
|
137
236
|
<div align="center"> <img src="./assets/img/line.png" alt="line" style="display: block; margin-top:20px;margin-bottom:20px;width:500px;"/> <br> </div>
|
package/dist/index.d.cts
CHANGED
|
@@ -38,6 +38,16 @@ interface AppConfig {
|
|
|
38
38
|
target?: 'browser' | 'bun';
|
|
39
39
|
external?: string[];
|
|
40
40
|
};
|
|
41
|
+
ui?: {
|
|
42
|
+
package: string;
|
|
43
|
+
output: string;
|
|
44
|
+
};
|
|
45
|
+
style?: {
|
|
46
|
+
entry: string;
|
|
47
|
+
output: string;
|
|
48
|
+
minify?: boolean;
|
|
49
|
+
sourcemap?: boolean | 'inline' | 'external' | 'none';
|
|
50
|
+
};
|
|
41
51
|
database?: {
|
|
42
52
|
connection: string;
|
|
43
53
|
schema?: string;
|
|
@@ -108,6 +118,14 @@ interface LifecycleContext {
|
|
|
108
118
|
success: boolean;
|
|
109
119
|
outputs: string[];
|
|
110
120
|
};
|
|
121
|
+
uiBuild?: {
|
|
122
|
+
success: boolean;
|
|
123
|
+
output: string;
|
|
124
|
+
} | null;
|
|
125
|
+
styleBuild?: {
|
|
126
|
+
success: boolean;
|
|
127
|
+
output: string;
|
|
128
|
+
} | null;
|
|
111
129
|
}
|
|
112
130
|
interface LifecycleHooks {
|
|
113
131
|
onConfig?: (config: AppConfig) => AppConfig | Promise<AppConfig>;
|
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,16 @@ interface AppConfig {
|
|
|
38
38
|
target?: 'browser' | 'bun';
|
|
39
39
|
external?: string[];
|
|
40
40
|
};
|
|
41
|
+
ui?: {
|
|
42
|
+
package: string;
|
|
43
|
+
output: string;
|
|
44
|
+
};
|
|
45
|
+
style?: {
|
|
46
|
+
entry: string;
|
|
47
|
+
output: string;
|
|
48
|
+
minify?: boolean;
|
|
49
|
+
sourcemap?: boolean | 'inline' | 'external' | 'none';
|
|
50
|
+
};
|
|
41
51
|
database?: {
|
|
42
52
|
connection: string;
|
|
43
53
|
schema?: string;
|
|
@@ -108,6 +118,14 @@ interface LifecycleContext {
|
|
|
108
118
|
success: boolean;
|
|
109
119
|
outputs: string[];
|
|
110
120
|
};
|
|
121
|
+
uiBuild?: {
|
|
122
|
+
success: boolean;
|
|
123
|
+
output: string;
|
|
124
|
+
} | null;
|
|
125
|
+
styleBuild?: {
|
|
126
|
+
success: boolean;
|
|
127
|
+
output: string;
|
|
128
|
+
} | null;
|
|
111
129
|
}
|
|
112
130
|
interface LifecycleHooks {
|
|
113
131
|
onConfig?: (config: AppConfig) => AppConfig | Promise<AppConfig>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cruxjs/base",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Core types and utilities for building CruxJS applications and plugins. A shared foundation for @cruxjs/app and plugin packages.",
|
|
5
5
|
"keywords": ["cruxjs", "base", "types"],
|
|
6
6
|
"license": "MIT",
|