webspresso 0.0.96 → 0.0.98
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/.agents/ADMIN.md +153 -5
- package/.agents/ARCHITECTURE.md +10 -0
- package/.agents/CLI.md +195 -1
- package/.agents/PLUGINS.md +153 -9
- package/.agents/QUEUE.md +43 -0
- package/.agents/skills/webspresso-admin-and-plugins/SKILL.md +122 -0
- package/.agents/skills/webspresso-framework/SKILL.md +56 -0
- package/.agents/skills/webspresso-orm-and-database/SKILL.md +119 -0
- package/.agents/skills/webspresso-routing-and-api/SKILL.md +114 -0
- package/.agents/skills/webspresso-services/SKILL.md +101 -0
- package/bin/commands/add-esbuild.js +80 -0
- package/bin/commands/add-tailwind.js +76 -31
- package/bin/commands/admin-password.js +2 -1
- package/bin/commands/admin-setup.js +1 -1
- package/bin/commands/agents-init.js +51 -11
- package/bin/commands/analytics-prune.js +57 -0
- package/bin/commands/api.js +207 -15
- package/bin/commands/audit-prune.js +1 -1
- package/bin/commands/build.js +99 -0
- package/bin/commands/dev.js +64 -35
- package/bin/commands/doctor.js +26 -0
- package/bin/commands/email-prune.js +47 -0
- package/bin/commands/favicon-generate.js +1 -1
- package/bin/commands/make-job.js +86 -0
- package/bin/commands/make-model.js +250 -0
- package/bin/commands/new.js +45 -28
- package/bin/commands/openapi.js +102 -0
- package/bin/commands/orm-map.js +5 -4
- package/bin/commands/page.js +6 -3
- package/bin/commands/polar-migrate.js +1 -1
- package/bin/commands/queue-prune.js +59 -0
- package/bin/commands/routes.js +52 -0
- package/bin/commands/seed.js +1 -1
- package/bin/commands/service.js +6 -3
- package/bin/commands/typegen.js +106 -0
- package/bin/commands/upload-prune.js +79 -0
- package/bin/webspresso.js +22 -0
- package/core/applySchema.js +13 -6
- package/core/auth/hash.js +31 -17
- package/core/compression/middleware.js +23 -17
- package/core/openapi/build-from-api-routes.js +160 -29
- package/core/orm/cache/fingerprint.js +15 -1
- package/core/orm/cache/memory-provider.js +27 -2
- package/core/orm/index.js +12 -7
- package/core/orm/model.js +49 -7
- package/core/queue/adapters/database.js +94 -0
- package/core/queue/adapters/memory.js +62 -0
- package/core/queue/adapters/redis.js +80 -0
- package/core/queue/manager.js +123 -0
- package/core/ssr/stream.js +11 -0
- package/index.d.ts +660 -10
- package/index.js +44 -96
- package/package.json +32 -12
- package/plugins/admin-panel/api.js +279 -17
- package/plugins/admin-panel/app.js +124 -31
- package/plugins/admin-panel/client/parts/01-state-api-breadcrumb.js +314 -9
- package/plugins/admin-panel/client/parts/04-field-renderers.js +264 -67
- package/plugins/admin-panel/client/parts/05-rich-text-file-helpers.js +10 -5
- package/plugins/admin-panel/client/parts/06-login-setup-forms.js +119 -28
- package/plugins/admin-panel/client/parts/07-model-list.js +49 -8
- package/plugins/admin-panel/client/parts/08-record-list.js +243 -23
- package/plugins/admin-panel/client/parts/09-record-form.js +59 -12
- package/plugins/admin-panel/client/parts/10-export-registry.js +23 -0
- package/plugins/admin-panel/core/admin-module.js +13 -7
- package/plugins/admin-panel/core/api-extensions.js +34 -2
- package/plugins/admin-panel/core/registry.js +96 -16
- package/plugins/admin-panel/index.js +96 -0
- package/plugins/admin-panel/lib/login-rate-limiter.js +119 -0
- package/plugins/admin-panel/modules/admin-users.js +16 -1
- package/plugins/admin-panel/modules/bulk-actions.js +13 -5
- package/plugins/admin-panel/modules/custom-pages.js +492 -3
- package/plugins/admin-panel/modules/dashboard.js +283 -0
- package/plugins/admin-panel/modules/menu.js +56 -18
- package/plugins/admin-panel/modules/user-management.js +24 -6
- package/plugins/audit-log/admin-component.js +11 -0
- package/plugins/audit-log/api-handlers.js +34 -0
- package/plugins/audit-log/index.js +129 -3
- package/plugins/audit-log/purge.js +60 -10
- package/plugins/basic-auth/index.js +3 -1
- package/plugins/content/client/inline-edit.js +12 -12
- package/plugins/cors.js +6 -7
- package/plugins/dashboard/app.js +152 -27
- package/plugins/dashboard/index.js +143 -39
- package/plugins/dashboard/styles.js +78 -0
- package/plugins/data-exchange/export-xlsx.js +9 -2
- package/plugins/data-exchange/import.js +9 -2
- package/plugins/data-exchange/index.js +6 -3
- package/plugins/email/index.js +132 -2
- package/plugins/email/purge.js +60 -10
- package/plugins/file-manager/core.js +1 -1
- package/plugins/file-manager/security.js +33 -23
- package/plugins/index.js +49 -87
- package/plugins/mcp/transports/sse.js +4 -2
- package/plugins/orm-cache-admin/index.js +4 -2
- package/plugins/queue/index.js +11 -0
- package/plugins/schema-explorer/admin-component.js +714 -0
- package/plugins/schema-explorer/relations-graph.js +205 -0
- package/plugins/schema-explorer.js +248 -69
- package/plugins/site-analytics/admin-component.js +30 -8
- package/plugins/site-analytics/api-handlers.js +42 -0
- package/plugins/site-analytics/index.js +147 -2
- package/plugins/site-analytics/purge.js +168 -0
- package/plugins/swagger.js +261 -13
- package/plugins/upload/index.js +26 -0
- package/plugins/upload/orphan-pruner.js +292 -0
- package/src/api/api-loader.js +3 -1
- package/src/bundle/index.js +517 -0
- package/src/bundle/manifest.js +165 -0
- package/src/dev/banner.js +296 -0
- package/src/dev/colors.js +70 -0
- package/src/dev/index.js +62 -0
- package/src/dev/profiler.js +354 -0
- package/src/dev/typegen.js +497 -0
- package/src/dev-reload/index.js +611 -0
- package/src/file-router.js +213 -63
- package/src/helpers.js +958 -98
- package/src/njk-frontmatter.js +12 -0
- package/src/pages/page-loader.js +61 -11
- package/src/server.js +629 -63
- package/src/services/discovery.js +6 -1
- package/src/services/index.js +6 -13
package/index.js
CHANGED
|
@@ -64,49 +64,8 @@ const { mountDiscoveredRoutes } = require('./src/routing/mount-discovered-routes
|
|
|
64
64
|
// ORM exports (lazy loaded)
|
|
65
65
|
const orm = require('./core/orm');
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
// Built-in plugins
|
|
71
|
-
const {
|
|
72
|
-
schemaExplorerPlugin,
|
|
73
|
-
adminPanelPlugin,
|
|
74
|
-
siteAnalyticsPlugin,
|
|
75
|
-
auditLogPlugin,
|
|
76
|
-
recaptchaPlugin,
|
|
77
|
-
swaggerPlugin,
|
|
78
|
-
healthCheckPlugin,
|
|
79
|
-
restResourcePlugin,
|
|
80
|
-
ormCacheAdminPlugin,
|
|
81
|
-
uploadPlugin,
|
|
82
|
-
createLocalFileProvider,
|
|
83
|
-
dataExchangePlugin,
|
|
84
|
-
redirectPlugin,
|
|
85
|
-
rateLimitPlugin,
|
|
86
|
-
contentPlugin,
|
|
87
|
-
csrfPlugin,
|
|
88
|
-
corsPlugin,
|
|
89
|
-
emailPlugin,
|
|
90
|
-
basicAuthPlugin,
|
|
91
|
-
realtimePlugin,
|
|
92
|
-
realtime,
|
|
93
|
-
createRealtime,
|
|
94
|
-
websocket,
|
|
95
|
-
sse,
|
|
96
|
-
socketIo,
|
|
97
|
-
redis,
|
|
98
|
-
createRedisAdapter,
|
|
99
|
-
mcpPlugin,
|
|
100
|
-
createMcpServer,
|
|
101
|
-
McpServer,
|
|
102
|
-
fileManagerPlugin,
|
|
103
|
-
xlsxPlugin,
|
|
104
|
-
xlsx,
|
|
105
|
-
csvPlugin,
|
|
106
|
-
csv,
|
|
107
|
-
} = require('./plugins');
|
|
108
|
-
|
|
109
|
-
const content = require('./core/content');
|
|
67
|
+
// Lazy-loaded built-in plugins
|
|
68
|
+
const plugins = require('./plugins');
|
|
110
69
|
|
|
111
70
|
module.exports = {
|
|
112
71
|
// Main API
|
|
@@ -198,11 +157,6 @@ module.exports = {
|
|
|
198
157
|
createHelpers,
|
|
199
158
|
utils,
|
|
200
159
|
|
|
201
|
-
// SSR Streaming
|
|
202
|
-
ssr: require('./core/ssr'),
|
|
203
|
-
renderStream: require('./core/ssr').renderStream,
|
|
204
|
-
createHtmlStream: require('./core/ssr').createHtmlStream,
|
|
205
|
-
|
|
206
160
|
// Asset management
|
|
207
161
|
AssetManager,
|
|
208
162
|
configureAssets,
|
|
@@ -217,53 +171,8 @@ module.exports = {
|
|
|
217
171
|
// ORM
|
|
218
172
|
...orm,
|
|
219
173
|
|
|
220
|
-
|
|
221
|
-
kernel,
|
|
222
|
-
|
|
223
|
-
// Direct zdb & z export (for convenience)
|
|
174
|
+
// Direct zdb export (for convenience)
|
|
224
175
|
zdb: orm.zdb,
|
|
225
|
-
z: require('./core/validation').z,
|
|
226
|
-
|
|
227
|
-
// Plugins
|
|
228
|
-
schemaExplorerPlugin,
|
|
229
|
-
adminPanelPlugin,
|
|
230
|
-
siteAnalyticsPlugin,
|
|
231
|
-
auditLogPlugin,
|
|
232
|
-
recaptchaPlugin,
|
|
233
|
-
swaggerPlugin,
|
|
234
|
-
healthCheckPlugin,
|
|
235
|
-
restResourcePlugin,
|
|
236
|
-
ormCacheAdminPlugin,
|
|
237
|
-
uploadPlugin,
|
|
238
|
-
createLocalFileProvider,
|
|
239
|
-
dataExchangePlugin,
|
|
240
|
-
redirectPlugin,
|
|
241
|
-
rateLimitPlugin,
|
|
242
|
-
contentPlugin,
|
|
243
|
-
csrfPlugin,
|
|
244
|
-
corsPlugin,
|
|
245
|
-
emailPlugin,
|
|
246
|
-
basicAuthPlugin,
|
|
247
|
-
realtimePlugin,
|
|
248
|
-
realtime,
|
|
249
|
-
createRealtime,
|
|
250
|
-
websocket,
|
|
251
|
-
sse,
|
|
252
|
-
socketIo,
|
|
253
|
-
redis,
|
|
254
|
-
createRedisAdapter,
|
|
255
|
-
queuePlugin: require('./plugins/queue'),
|
|
256
|
-
queue: require('./core/queue'),
|
|
257
|
-
createQueueManager: require('./core/queue').createQueueManager,
|
|
258
|
-
QueueManager: require('./core/queue').QueueManager,
|
|
259
|
-
mcpPlugin,
|
|
260
|
-
createMcpServer,
|
|
261
|
-
McpServer,
|
|
262
|
-
fileManagerPlugin,
|
|
263
|
-
xlsxPlugin,
|
|
264
|
-
xlsx,
|
|
265
|
-
csvPlugin,
|
|
266
|
-
csv,
|
|
267
176
|
|
|
268
177
|
// Discovery, Pages, API, Modules & Routing primitives
|
|
269
178
|
definePage,
|
|
@@ -277,8 +186,47 @@ module.exports = {
|
|
|
277
186
|
compileRouteTable,
|
|
278
187
|
RouteTable,
|
|
279
188
|
mountDiscoveredRoutes,
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
// Define lazy getters for plugins and heavy core subsystems
|
|
192
|
+
Object.defineProperties(module.exports, {
|
|
193
|
+
...Object.getOwnPropertyDescriptors(plugins),
|
|
194
|
+
|
|
195
|
+
// SSR Streaming
|
|
196
|
+
ssr: { get: () => require('./core/ssr'), enumerable: true, configurable: true },
|
|
197
|
+
renderStream: { get: () => require('./core/ssr').renderStream, enumerable: true, configurable: true },
|
|
198
|
+
createHtmlStream: { get: () => require('./core/ssr').createHtmlStream, enumerable: true, configurable: true },
|
|
199
|
+
|
|
200
|
+
/** Event bus / plugin shell / view resolver / flows (`kernel.createApp` is distinct from SSR `createApp`) */
|
|
201
|
+
kernel: { get: () => require('./core/kernel'), enumerable: true, configurable: true },
|
|
202
|
+
|
|
203
|
+
// Validation
|
|
204
|
+
z: { get: () => require('./core/validation').z, enumerable: true, configurable: true },
|
|
205
|
+
|
|
206
|
+
// Background jobs & queue
|
|
207
|
+
queue: { get: () => require('./core/queue'), enumerable: true, configurable: true },
|
|
208
|
+
createQueueManager: { get: () => require('./core/queue').createQueueManager, enumerable: true, configurable: true },
|
|
209
|
+
QueueManager: { get: () => require('./core/queue').QueueManager, enumerable: true, configurable: true },
|
|
280
210
|
|
|
281
211
|
// Schema-driven CMS core (framework-agnostic)
|
|
282
|
-
content,
|
|
283
|
-
|
|
212
|
+
content: { get: () => require('./core/content'), enumerable: true, configurable: true },
|
|
213
|
+
|
|
214
|
+
// Dev live reload & bundler
|
|
215
|
+
createDevReloadHub: { get: () => require('./src/dev-reload').createDevReloadHub, enumerable: true, configurable: true },
|
|
216
|
+
createDevBundler: { get: () => require('./src/bundle').createDevBundler, enumerable: true, configurable: true },
|
|
217
|
+
buildBundle: { get: () => require('./src/bundle').buildBundle, enumerable: true, configurable: true },
|
|
218
|
+
generateManifest: { get: () => require('./src/bundle').generateManifest, enumerable: true, configurable: true },
|
|
219
|
+
createManifestPlugin: { get: () => require('./src/bundle').createManifestPlugin, enumerable: true, configurable: true },
|
|
220
|
+
findDefaultEntryPoints: { get: () => require('./src/bundle').findDefaultEntryPoints, enumerable: true, configurable: true },
|
|
221
|
+
findPageEntryPoints: { get: () => require('./src/bundle').findPageEntryPoints, enumerable: true, configurable: true },
|
|
222
|
+
|
|
223
|
+
// Dev & DX Tooling
|
|
224
|
+
dev: { get: () => require('./src/dev'), enumerable: true, configurable: true },
|
|
225
|
+
formatDevBanner: { get: () => require('./src/dev').formatDevBanner, enumerable: true, configurable: true },
|
|
226
|
+
printDevBanner: { get: () => require('./src/dev').printDevBanner, enumerable: true, configurable: true },
|
|
227
|
+
formatRouteTable: { get: () => require('./src/dev').formatRouteTable, enumerable: true, configurable: true },
|
|
228
|
+
createDevProfilerMiddleware: { get: () => require('./src/dev').createDevProfilerMiddleware, enumerable: true, configurable: true },
|
|
229
|
+
generateTypes: { get: () => require('./src/dev/typegen').generateTypes, enumerable: true, configurable: true },
|
|
230
|
+
typegen: { get: () => require('./src/dev/typegen'), enumerable: true, configurable: true },
|
|
231
|
+
});
|
|
284
232
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webspresso",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.98",
|
|
4
4
|
"description": "Minimal, production-ready SSR framework for Node.js with file-based routing, Nunjucks templating, built-in i18n, and CLI tooling",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -38,10 +38,27 @@
|
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"test": "vitest run",
|
|
41
|
+
"test:unit": "vitest run tests/unit/",
|
|
42
|
+
"test:integration": "vitest run tests/integration/",
|
|
41
43
|
"test:security": "vitest run tests/security/",
|
|
42
|
-
"
|
|
44
|
+
"test:orm": "vitest run tests/**/orm* tests/**/database*",
|
|
45
|
+
"test:auth": "vitest run tests/**/auth* tests/unit/server-auth-branches.test.js",
|
|
46
|
+
"test:admin": "vitest run tests/**/admin*",
|
|
47
|
+
"test:services": "vitest run tests/**/service*",
|
|
48
|
+
"test:plugins": "vitest run tests/**/plugin* tests/unit/*plugin*.test.js",
|
|
49
|
+
"test:core": "vitest run tests/unit/core* tests/unit/server* tests/unit/routing* tests/unit/template*",
|
|
50
|
+
"test:branches": "vitest run tests/unit/*branches.test.js",
|
|
51
|
+
"test:fast": "vitest run tests/unit/*branches.test.js tests/unit/auth.test.js tests/unit/services.test.js tests/unit/server.test.js",
|
|
43
52
|
"test:watch": "vitest",
|
|
44
53
|
"test:coverage": "vitest run --coverage",
|
|
54
|
+
"test:coverage:branches": "vitest run tests/unit/*branches.test.js --coverage",
|
|
55
|
+
"test:coverage:unit": "vitest run tests/unit/ --coverage",
|
|
56
|
+
"test:coverage:core": "vitest run tests/unit/core* tests/unit/server* tests/unit/routing* tests/unit/template* --coverage",
|
|
57
|
+
"test:coverage:auth": "vitest run tests/**/auth* tests/unit/server-auth-branches.test.js --coverage",
|
|
58
|
+
"test:coverage:orm": "vitest run tests/**/orm* tests/**/database* --coverage",
|
|
59
|
+
"test:coverage:services": "vitest run tests/**/service* --coverage",
|
|
60
|
+
"test:coverage:plugins": "vitest run tests/**/plugin* tests/unit/*plugin*.test.js --coverage",
|
|
61
|
+
"test:coverage:fast": "vitest run tests/unit/*branches.test.js tests/unit/auth.test.js tests/unit/services.test.js tests/unit/server.test.js --coverage",
|
|
45
62
|
"test:e2e": "playwright test",
|
|
46
63
|
"test:e2e:ui": "playwright test --ui",
|
|
47
64
|
"test:e2e:debug": "playwright test --debug",
|
|
@@ -96,7 +113,7 @@
|
|
|
96
113
|
"commander": "^11.1.0",
|
|
97
114
|
"connect-timeout": "^1.9.1",
|
|
98
115
|
"cookie-parser": "^1.4.7",
|
|
99
|
-
"csv-parse": "^
|
|
116
|
+
"csv-parse": "^7.0.2",
|
|
100
117
|
"dayjs": "^1.11.19",
|
|
101
118
|
"exceljs": "^4.4.0",
|
|
102
119
|
"express": "^5.2.1",
|
|
@@ -105,11 +122,11 @@
|
|
|
105
122
|
"inquirer": "^8.2.6",
|
|
106
123
|
"knex": "^3.1.0",
|
|
107
124
|
"mjml": "^5.4.0",
|
|
108
|
-
"multer": "^2.
|
|
109
|
-
"nodemailer": "^
|
|
125
|
+
"multer": "^2.4.0",
|
|
126
|
+
"nodemailer": "^10.0.10",
|
|
110
127
|
"nunjucks": "^3.2.4",
|
|
111
|
-
"sanitize-html": "^2.17.
|
|
112
|
-
"sharp": "^0.35.
|
|
128
|
+
"sanitize-html": "^2.17.7",
|
|
129
|
+
"sharp": "^0.35.4",
|
|
113
130
|
"swup": "^4.8.3",
|
|
114
131
|
"yaml": "^2.8.3",
|
|
115
132
|
"zod": "^3.23.0",
|
|
@@ -144,11 +161,11 @@
|
|
|
144
161
|
}
|
|
145
162
|
},
|
|
146
163
|
"devDependencies": {
|
|
147
|
-
"@faker-js/faker": "^
|
|
164
|
+
"@faker-js/faker": "^10.6.0",
|
|
148
165
|
"@playwright/test": "^1.48.0",
|
|
149
166
|
"@types/express": "^4.17.21",
|
|
150
167
|
"@types/node": "^20.14.0",
|
|
151
|
-
"@vitest/coverage-v8": "^
|
|
168
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
152
169
|
"better-sqlite3": "^11.10.0",
|
|
153
170
|
"chokidar": "^3.5.3",
|
|
154
171
|
"docboot": "^0.3.0",
|
|
@@ -157,16 +174,19 @@
|
|
|
157
174
|
"release-it": "^20.2.1",
|
|
158
175
|
"supertest": "^6.3.4",
|
|
159
176
|
"typescript": "~5.6.3",
|
|
160
|
-
"vitest": "^
|
|
177
|
+
"vitest": "^4.1.11",
|
|
178
|
+
"vitest-doctor": "^0.3.0"
|
|
161
179
|
},
|
|
162
180
|
"engines": {
|
|
163
|
-
"node": ">=
|
|
181
|
+
"node": ">=20.0.0"
|
|
164
182
|
},
|
|
165
183
|
"overrides": {
|
|
166
184
|
"basic-ftp": "^5.3.0",
|
|
167
185
|
"tar": "^7.5.11",
|
|
168
186
|
"undici": "^6.24.0",
|
|
169
|
-
"uuid": "^11.1.1"
|
|
187
|
+
"uuid": "^11.1.1",
|
|
188
|
+
"js-yaml": "^5.4.2",
|
|
189
|
+
"qs": "^6.16.0"
|
|
170
190
|
},
|
|
171
191
|
"allowScripts": {
|
|
172
192
|
"better-sqlite3@11.10.0": true
|