create-fluxstack 1.0.13 → 1.0.15
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/.env.example +29 -29
- package/app/client/README.md +69 -69
- package/app/client/index.html +14 -13
- package/app/client/src/App.tsx +157 -524
- package/app/client/src/components/ErrorBoundary.tsx +107 -0
- package/app/client/src/components/ErrorDisplay.css +365 -0
- package/app/client/src/components/ErrorDisplay.tsx +258 -0
- package/app/client/src/components/FluxStackConfig.tsx +1321 -0
- package/app/client/src/components/HybridLiveCounter.tsx +140 -0
- package/app/client/src/components/LiveClock.tsx +286 -0
- package/app/client/src/components/MainLayout.tsx +390 -0
- package/app/client/src/components/SidebarNavigation.tsx +391 -0
- package/app/client/src/components/StateDemo.tsx +178 -0
- package/app/client/src/components/SystemMonitor.tsx +1038 -0
- package/app/client/src/components/Teste.tsx +104 -0
- package/app/client/src/components/UserProfile.tsx +809 -0
- package/app/client/src/hooks/useAuth.ts +39 -0
- package/app/client/src/hooks/useNotifications.ts +56 -0
- package/app/client/src/lib/eden-api.ts +189 -53
- package/app/client/src/lib/errors.ts +340 -0
- package/app/client/src/lib/hooks/useErrorHandler.ts +258 -0
- package/app/client/src/lib/index.ts +45 -0
- package/app/client/src/main.tsx +3 -2
- package/app/client/src/pages/ApiDocs.tsx +182 -0
- package/app/client/src/pages/Demo.tsx +174 -0
- package/app/client/src/pages/HybridLive.tsx +263 -0
- package/app/client/src/pages/Overview.tsx +155 -0
- package/app/client/src/store/README.md +43 -0
- package/app/client/src/store/index.ts +16 -0
- package/app/client/src/store/slices/uiSlice.ts +151 -0
- package/app/client/src/store/slices/userSlice.ts +161 -0
- package/app/client/src/test/README.md +257 -0
- package/app/client/src/test/setup.ts +70 -0
- package/app/client/src/test/types.ts +12 -0
- package/app/client/src/vite-env.d.ts +1 -1
- package/app/client/tsconfig.app.json +44 -43
- package/app/client/tsconfig.json +7 -7
- package/app/client/tsconfig.node.json +25 -25
- package/app/client/zustand-setup.md +65 -0
- package/app/server/controllers/users.controller.ts +68 -68
- package/app/server/index.ts +9 -1
- package/app/server/live/CounterComponent.ts +191 -0
- package/app/server/live/FluxStackConfig.ts +529 -0
- package/app/server/live/LiveClockComponent.ts +214 -0
- package/app/server/live/SidebarNavigation.ts +156 -0
- package/app/server/live/SystemMonitor.ts +594 -0
- package/app/server/live/SystemMonitorIntegration.ts +151 -0
- package/app/server/live/TesteComponent.ts +87 -0
- package/app/server/live/UserProfileComponent.ts +135 -0
- package/app/server/live/register-components.ts +28 -0
- package/app/server/middleware/auth.ts +136 -0
- package/app/server/middleware/errorHandling.ts +250 -0
- package/app/server/middleware/index.ts +10 -0
- package/app/server/middleware/rateLimit.ts +193 -0
- package/app/server/middleware/requestLogging.ts +215 -0
- package/app/server/middleware/validation.ts +270 -0
- package/app/server/routes/index.ts +14 -2
- package/app/server/routes/upload.ts +92 -0
- package/app/server/routes/users.routes.ts +2 -9
- package/app/server/services/NotificationService.ts +302 -0
- package/app/server/services/UserService.ts +222 -0
- package/app/server/services/index.ts +46 -0
- package/core/cli/commands/plugin-deps.ts +263 -0
- package/core/cli/generators/README.md +339 -0
- package/core/cli/generators/component.ts +770 -0
- package/core/cli/generators/controller.ts +299 -0
- package/core/cli/generators/index.ts +144 -0
- package/core/cli/generators/interactive.ts +228 -0
- package/core/cli/generators/prompts.ts +83 -0
- package/core/cli/generators/route.ts +513 -0
- package/core/cli/generators/service.ts +465 -0
- package/core/cli/generators/template-engine.ts +154 -0
- package/core/cli/generators/types.ts +71 -0
- package/core/cli/generators/utils.ts +192 -0
- package/core/cli/index.ts +69 -0
- package/core/cli/plugin-discovery.ts +16 -85
- package/core/client/fluxstack.ts +17 -0
- package/core/client/hooks/index.ts +7 -0
- package/core/client/hooks/state-validator.ts +130 -0
- package/core/client/hooks/useAuth.ts +49 -0
- package/core/client/hooks/useChunkedUpload.ts +258 -0
- package/core/client/hooks/useHybridLiveComponent.ts +967 -0
- package/core/client/hooks/useWebSocket.ts +373 -0
- package/core/client/index.ts +47 -0
- package/core/client/state/createStore.ts +193 -0
- package/core/client/state/index.ts +15 -0
- package/core/config/env-dynamic.ts +1 -1
- package/core/config/env.ts +2 -1
- package/core/config/runtime-config.ts +3 -3
- package/core/config/schema.ts +84 -49
- package/core/framework/server.ts +30 -0
- package/core/index.ts +25 -0
- package/core/live/ComponentRegistry.ts +399 -0
- package/core/live/types.ts +164 -0
- package/core/plugins/built-in/live-components/commands/create-live-component.ts +1201 -0
- package/core/plugins/built-in/live-components/index.ts +27 -0
- package/core/plugins/built-in/logger/index.ts +1 -1
- package/core/plugins/built-in/monitoring/index.ts +1 -1
- package/core/plugins/built-in/static/index.ts +1 -1
- package/core/plugins/built-in/swagger/index.ts +1 -1
- package/core/plugins/built-in/vite/index.ts +1 -1
- package/core/plugins/dependency-manager.ts +384 -0
- package/core/plugins/index.ts +5 -1
- package/core/plugins/manager.ts +7 -3
- package/core/plugins/registry.ts +88 -10
- package/core/plugins/types.ts +11 -11
- package/core/server/framework.ts +43 -0
- package/core/server/index.ts +11 -1
- package/core/server/live/ComponentRegistry.ts +1017 -0
- package/core/server/live/FileUploadManager.ts +272 -0
- package/core/server/live/LiveComponentPerformanceMonitor.ts +930 -0
- package/core/server/live/SingleConnectionManager.ts +0 -0
- package/core/server/live/StateSignature.ts +644 -0
- package/core/server/live/WebSocketConnectionManager.ts +688 -0
- package/core/server/live/websocket-plugin.ts +435 -0
- package/core/server/middleware/errorHandling.ts +141 -0
- package/core/server/middleware/index.ts +16 -0
- package/core/server/plugins/static-files-plugin.ts +232 -0
- package/core/server/services/BaseService.ts +95 -0
- package/core/server/services/ServiceContainer.ts +144 -0
- package/core/server/services/index.ts +9 -0
- package/core/templates/create-project.ts +196 -33
- package/core/testing/index.ts +10 -0
- package/core/testing/setup.ts +74 -0
- package/core/types/build.ts +38 -14
- package/core/types/types.ts +319 -0
- package/core/utils/env-runtime.ts +7 -0
- package/core/utils/errors/handlers.ts +264 -39
- package/core/utils/errors/index.ts +528 -18
- package/core/utils/errors/middleware.ts +114 -0
- package/core/utils/logger/formatters.ts +222 -0
- package/core/utils/logger/index.ts +167 -48
- package/core/utils/logger/middleware.ts +253 -0
- package/core/utils/logger/performance.ts +384 -0
- package/core/utils/logger/transports.ts +365 -0
- package/create-fluxstack.ts +296 -296
- package/fluxstack.config.ts +17 -1
- package/package-template.json +66 -66
- package/package.json +31 -6
- package/public/README.md +16 -0
- package/vite.config.ts +29 -14
- package/.claude/settings.local.json +0 -74
- package/.github/workflows/ci-build-tests.yml +0 -480
- package/.github/workflows/dependency-management.yml +0 -324
- package/.github/workflows/release-validation.yml +0 -355
- package/.kiro/specs/fluxstack-architecture-optimization/design.md +0 -700
- package/.kiro/specs/fluxstack-architecture-optimization/requirements.md +0 -127
- package/.kiro/specs/fluxstack-architecture-optimization/tasks.md +0 -330
- package/CLAUDE.md +0 -200
- package/Dockerfile +0 -58
- package/Dockerfile.backend +0 -52
- package/Dockerfile.frontend +0 -54
- package/README-Docker.md +0 -85
- package/ai-context/00-QUICK-START.md +0 -86
- package/ai-context/README.md +0 -88
- package/ai-context/development/eden-treaty-guide.md +0 -362
- package/ai-context/development/patterns.md +0 -382
- package/ai-context/development/plugins-guide.md +0 -572
- package/ai-context/examples/crud-complete.md +0 -626
- package/ai-context/project/architecture.md +0 -399
- package/ai-context/project/overview.md +0 -213
- package/ai-context/recent-changes/eden-treaty-refactor.md +0 -281
- package/ai-context/recent-changes/type-inference-fix.md +0 -223
- package/ai-context/reference/environment-vars.md +0 -384
- package/ai-context/reference/troubleshooting.md +0 -407
- package/app/client/src/components/TestPage.tsx +0 -453
- package/bun.lock +0 -1063
- package/bunfig.toml +0 -16
- package/core/__tests__/integration.test.ts +0 -227
- package/core/build/index.ts +0 -186
- package/core/config/__tests__/config-loader.test.ts +0 -554
- package/core/config/__tests__/config-merger.test.ts +0 -657
- package/core/config/__tests__/env-converter.test.ts +0 -372
- package/core/config/__tests__/env-processor.test.ts +0 -431
- package/core/config/__tests__/env.test.ts +0 -452
- package/core/config/__tests__/integration.test.ts +0 -418
- package/core/config/__tests__/loader.test.ts +0 -331
- package/core/config/__tests__/schema.test.ts +0 -129
- package/core/config/__tests__/validator.test.ts +0 -318
- package/core/framework/__tests__/server.test.ts +0 -233
- package/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
- package/core/plugins/__tests__/manager.test.ts +0 -398
- package/core/plugins/__tests__/monitoring.test.ts +0 -401
- package/core/plugins/__tests__/registry.test.ts +0 -335
- package/core/utils/__tests__/errors.test.ts +0 -139
- package/core/utils/__tests__/helpers.test.ts +0 -297
- package/core/utils/__tests__/logger.test.ts +0 -141
- package/create-test-app.ts +0 -156
- package/docker-compose.microservices.yml +0 -75
- package/docker-compose.simple.yml +0 -57
- package/docker-compose.yml +0 -71
- package/eslint.config.js +0 -23
- package/flux-cli.ts +0 -214
- package/nginx-lb.conf +0 -37
- package/publish.sh +0 -63
- package/run-clean.ts +0 -26
- package/run-env-tests.ts +0 -313
- package/tailwind.config.js +0 -34
- package/tests/__mocks__/api.ts +0 -56
- package/tests/fixtures/users.ts +0 -69
- package/tests/integration/api/users.routes.test.ts +0 -221
- package/tests/setup.ts +0 -29
- package/tests/unit/app/client/App-simple.test.tsx +0 -56
- package/tests/unit/app/client/App.test.tsx.skip +0 -237
- package/tests/unit/app/client/eden-api.test.ts +0 -186
- package/tests/unit/app/client/simple.test.tsx +0 -23
- package/tests/unit/app/controllers/users.controller.test.ts +0 -150
- package/tests/unit/core/create-project.test.ts.skip +0 -95
- package/tests/unit/core/framework.test.ts +0 -144
- package/tests/unit/core/plugins/logger.test.ts.skip +0 -268
- package/tests/unit/core/plugins/vite.test.ts.disabled +0 -188
- package/tests/utils/test-helpers.ts +0 -61
- package/vitest.config.ts +0 -50
- package/workspace.json +0 -6
|
@@ -34,15 +34,15 @@ export class ProjectCreator {
|
|
|
34
34
|
// 3. Generate package.json
|
|
35
35
|
await this.generatePackageJson()
|
|
36
36
|
|
|
37
|
-
// 4. Generate config files
|
|
37
|
+
// 4. Generate config files (including .gitignore)
|
|
38
38
|
await this.generateConfigFiles()
|
|
39
39
|
|
|
40
|
-
// 5.
|
|
41
|
-
await this.installDependencies()
|
|
42
|
-
|
|
43
|
-
// 6. Initialize git
|
|
40
|
+
// 5. Initialize git (before installing dependencies)
|
|
44
41
|
await this.initGit()
|
|
45
42
|
|
|
43
|
+
// 6. Install dependencies (last step)
|
|
44
|
+
await this.installDependencies()
|
|
45
|
+
|
|
46
46
|
console.log()
|
|
47
47
|
console.log("🎉 Project created successfully!")
|
|
48
48
|
console.log()
|
|
@@ -93,8 +93,15 @@ export class ProjectCreator {
|
|
|
93
93
|
private async copyDirectory(src: string, dest: string, exclude: string[] = []) {
|
|
94
94
|
await mkdir(dest, { recursive: true })
|
|
95
95
|
|
|
96
|
-
const
|
|
97
|
-
|
|
96
|
+
const fs = await import("fs/promises")
|
|
97
|
+
let entries: any[] = []
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
entries = await fs.readdir(src, { withFileTypes: true })
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.warn(`Warning: Could not read directory ${src}`)
|
|
103
|
+
return
|
|
104
|
+
}
|
|
98
105
|
|
|
99
106
|
for (const entry of entries) {
|
|
100
107
|
if (exclude.includes(entry.name)) continue
|
|
@@ -155,6 +162,7 @@ export class ProjectCreator {
|
|
|
155
162
|
},
|
|
156
163
|
dependencies: {
|
|
157
164
|
"@elysiajs/eden": "^1.3.2",
|
|
165
|
+
"@sinclair/typebox": "^0.34.41",
|
|
158
166
|
"@vitejs/plugin-react": "^4.0.0",
|
|
159
167
|
elysia: "latest",
|
|
160
168
|
react: "^18.2.0",
|
|
@@ -227,6 +235,42 @@ lockfile = true
|
|
|
227
235
|
|
|
228
236
|
await Bun.write(join(this.targetDir, "bunfig.toml"), bunConfig)
|
|
229
237
|
|
|
238
|
+
// Vite config
|
|
239
|
+
const viteConfig = `import { defineConfig } from 'vite'
|
|
240
|
+
import react from '@vitejs/plugin-react'
|
|
241
|
+
import { resolve } from 'path'
|
|
242
|
+
|
|
243
|
+
export default defineConfig({
|
|
244
|
+
plugins: [react()],
|
|
245
|
+
resolve: {
|
|
246
|
+
alias: {
|
|
247
|
+
'@': resolve(__dirname, '.'),
|
|
248
|
+
'@/core': resolve(__dirname, './core'),
|
|
249
|
+
'@/app': resolve(__dirname, './app'),
|
|
250
|
+
'@/config': resolve(__dirname, './config'),
|
|
251
|
+
'@/shared': resolve(__dirname, './app/shared')
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
server: {
|
|
255
|
+
port: 5173,
|
|
256
|
+
host: 'localhost',
|
|
257
|
+
proxy: {
|
|
258
|
+
'/api': {
|
|
259
|
+
target: 'http://localhost:3000',
|
|
260
|
+
changeOrigin: true
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
build: {
|
|
265
|
+
outDir: 'dist/client',
|
|
266
|
+
emptyOutDir: true,
|
|
267
|
+
sourcemap: true
|
|
268
|
+
}
|
|
269
|
+
})
|
|
270
|
+
`
|
|
271
|
+
|
|
272
|
+
await Bun.write(join(this.targetDir, "vite.config.ts"), viteConfig)
|
|
273
|
+
|
|
230
274
|
// Environment file
|
|
231
275
|
const envContent = `# FluxStack Environment Variables
|
|
232
276
|
|
|
@@ -286,6 +330,124 @@ BUILD_OUTDIR=dist
|
|
|
286
330
|
|
|
287
331
|
await Bun.write(join(this.targetDir, ".env"), envContent)
|
|
288
332
|
|
|
333
|
+
// .gitignore
|
|
334
|
+
const gitignoreContent = `# Dependencies
|
|
335
|
+
node_modules/
|
|
336
|
+
.pnp
|
|
337
|
+
.pnp.js
|
|
338
|
+
|
|
339
|
+
# Production builds
|
|
340
|
+
/dist
|
|
341
|
+
/build
|
|
342
|
+
/.next/
|
|
343
|
+
/out/
|
|
344
|
+
|
|
345
|
+
# Environment variables
|
|
346
|
+
.env
|
|
347
|
+
.env.local
|
|
348
|
+
.env.development.local
|
|
349
|
+
.env.test.local
|
|
350
|
+
.env.production.local
|
|
351
|
+
|
|
352
|
+
# Logs
|
|
353
|
+
npm-debug.log*
|
|
354
|
+
yarn-debug.log*
|
|
355
|
+
yarn-error.log*
|
|
356
|
+
lerna-debug.log*
|
|
357
|
+
.pnpm-debug.log*
|
|
358
|
+
|
|
359
|
+
# Runtime data
|
|
360
|
+
pids
|
|
361
|
+
*.pid
|
|
362
|
+
*.seed
|
|
363
|
+
*.pid.lock
|
|
364
|
+
|
|
365
|
+
# Coverage directory used by tools like istanbul
|
|
366
|
+
coverage/
|
|
367
|
+
*.lcov
|
|
368
|
+
|
|
369
|
+
# nyc test coverage
|
|
370
|
+
.nyc_output
|
|
371
|
+
|
|
372
|
+
# Dependency directories
|
|
373
|
+
jspm_packages/
|
|
374
|
+
|
|
375
|
+
# TypeScript cache
|
|
376
|
+
*.tsbuildinfo
|
|
377
|
+
|
|
378
|
+
# Optional npm cache directory
|
|
379
|
+
.npm
|
|
380
|
+
|
|
381
|
+
# Optional eslint cache
|
|
382
|
+
.eslintcache
|
|
383
|
+
|
|
384
|
+
# Optional stylelint cache
|
|
385
|
+
.stylelintcache
|
|
386
|
+
|
|
387
|
+
# Microbundle cache
|
|
388
|
+
.rpt2_cache/
|
|
389
|
+
.rts2_cache_cjs/
|
|
390
|
+
.rts2_cache_es/
|
|
391
|
+
.rts2_cache_umd/
|
|
392
|
+
|
|
393
|
+
# Optional REPL history
|
|
394
|
+
.node_repl_history
|
|
395
|
+
|
|
396
|
+
# Output of 'npm pack'
|
|
397
|
+
*.tgz
|
|
398
|
+
|
|
399
|
+
# Yarn Integrity file
|
|
400
|
+
.yarn-integrity
|
|
401
|
+
|
|
402
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
403
|
+
.cache
|
|
404
|
+
.parcel-cache
|
|
405
|
+
|
|
406
|
+
# Next.js build output
|
|
407
|
+
.next
|
|
408
|
+
|
|
409
|
+
# Nuxt.js build / generate output
|
|
410
|
+
.nuxt
|
|
411
|
+
dist
|
|
412
|
+
|
|
413
|
+
# Storybook build outputs
|
|
414
|
+
.out
|
|
415
|
+
.storybook-out
|
|
416
|
+
|
|
417
|
+
# Temporary folders
|
|
418
|
+
tmp/
|
|
419
|
+
temp/
|
|
420
|
+
|
|
421
|
+
# Editor directories and files
|
|
422
|
+
.vscode/*
|
|
423
|
+
!.vscode/extensions.json
|
|
424
|
+
.idea
|
|
425
|
+
*.suo
|
|
426
|
+
*.ntvs*
|
|
427
|
+
*.njsproj
|
|
428
|
+
*.sln
|
|
429
|
+
*.sw?
|
|
430
|
+
|
|
431
|
+
# OS generated files
|
|
432
|
+
.DS_Store
|
|
433
|
+
.DS_Store?
|
|
434
|
+
._*
|
|
435
|
+
.Spotlight-V100
|
|
436
|
+
.Trashes
|
|
437
|
+
ehthumbs.db
|
|
438
|
+
Thumbs.db
|
|
439
|
+
|
|
440
|
+
# FluxStack specific
|
|
441
|
+
uploads/
|
|
442
|
+
public/uploads/
|
|
443
|
+
.fluxstack/
|
|
444
|
+
|
|
445
|
+
# Bun
|
|
446
|
+
bun.lockb
|
|
447
|
+
`
|
|
448
|
+
|
|
449
|
+
await Bun.write(join(this.targetDir, ".gitignore"), gitignoreContent)
|
|
450
|
+
|
|
289
451
|
// README
|
|
290
452
|
const readme = `# ${this.projectName}
|
|
291
453
|
|
|
@@ -425,31 +587,32 @@ bun.lockb
|
|
|
425
587
|
private async initGit() {
|
|
426
588
|
console.log("🔧 Initializing git repository...")
|
|
427
589
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
590
|
+
try {
|
|
591
|
+
// Initialize git repository
|
|
592
|
+
await spawn({
|
|
593
|
+
cmd: ["git", "init", "--quiet"],
|
|
594
|
+
cwd: this.targetDir,
|
|
595
|
+
stdout: "ignore",
|
|
596
|
+
stderr: "ignore"
|
|
597
|
+
}).exited
|
|
598
|
+
|
|
599
|
+
// Add all files
|
|
600
|
+
await spawn({
|
|
601
|
+
cmd: ["git", "add", "."],
|
|
602
|
+
cwd: this.targetDir,
|
|
603
|
+
stdout: "ignore",
|
|
604
|
+
stderr: "ignore"
|
|
605
|
+
}).exited
|
|
606
|
+
|
|
607
|
+
// Initial commit
|
|
608
|
+
await spawn({
|
|
609
|
+
cmd: ["git", "commit", "-m", "Initial commit - FluxStack project created", "--quiet"],
|
|
610
|
+
cwd: this.targetDir,
|
|
611
|
+
stdout: "ignore",
|
|
612
|
+
stderr: "ignore"
|
|
613
|
+
}).exited
|
|
614
|
+
} catch (error) {
|
|
615
|
+
console.warn("⚠️ Git initialization failed (git may not be installed)")
|
|
616
|
+
}
|
|
454
617
|
}
|
|
455
618
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FluxStack Testing Setup
|
|
3
|
+
* Core testing utilities and configuration
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { beforeEach, vi } from 'vitest'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Setup global test environment
|
|
10
|
+
*/
|
|
11
|
+
export function setupFluxStackTests() {
|
|
12
|
+
// Mock fetch globally
|
|
13
|
+
global.fetch = vi.fn()
|
|
14
|
+
|
|
15
|
+
// Mock localStorage
|
|
16
|
+
const localStorageMock = {
|
|
17
|
+
getItem: vi.fn(),
|
|
18
|
+
setItem: vi.fn(),
|
|
19
|
+
removeItem: vi.fn(),
|
|
20
|
+
clear: vi.fn(),
|
|
21
|
+
length: 0,
|
|
22
|
+
key: vi.fn()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(window, 'localStorage', {
|
|
26
|
+
value: localStorageMock
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
// Mock sessionStorage
|
|
30
|
+
Object.defineProperty(window, 'sessionStorage', {
|
|
31
|
+
value: localStorageMock
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
// Reset all mocks before each test
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
vi.clearAllMocks()
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Create mock logger for testing
|
|
42
|
+
*/
|
|
43
|
+
export function createMockLogger() {
|
|
44
|
+
return {
|
|
45
|
+
debug: vi.fn(),
|
|
46
|
+
info: vi.fn(),
|
|
47
|
+
warn: vi.fn(),
|
|
48
|
+
error: vi.fn(),
|
|
49
|
+
child: vi.fn().mockReturnValue({
|
|
50
|
+
debug: vi.fn(),
|
|
51
|
+
info: vi.fn(),
|
|
52
|
+
warn: vi.fn(),
|
|
53
|
+
error: vi.fn(),
|
|
54
|
+
child: vi.fn()
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Create mock service context for testing
|
|
61
|
+
*/
|
|
62
|
+
export function createMockServiceContext(overrides: any = {}) {
|
|
63
|
+
return {
|
|
64
|
+
config: {},
|
|
65
|
+
logger: createMockLogger(),
|
|
66
|
+
services: {
|
|
67
|
+
get: vi.fn(),
|
|
68
|
+
register: vi.fn(),
|
|
69
|
+
has: vi.fn(),
|
|
70
|
+
remove: vi.fn()
|
|
71
|
+
},
|
|
72
|
+
...overrides
|
|
73
|
+
}
|
|
74
|
+
}
|
package/core/types/build.ts
CHANGED
|
@@ -62,21 +62,27 @@ export interface BuildStats {
|
|
|
62
62
|
dependencies: string[]
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
entry: string | string[]
|
|
67
|
-
format: BundleFormat
|
|
68
|
-
external?: string[]
|
|
69
|
-
globals?: Record<string, string>
|
|
70
|
-
banner?: string
|
|
71
|
-
footer?: string
|
|
72
|
-
}
|
|
65
|
+
|
|
73
66
|
|
|
74
67
|
export interface BundleResult {
|
|
75
|
-
|
|
68
|
+
success: boolean
|
|
69
|
+
duration: number
|
|
70
|
+
outputPath?: string
|
|
71
|
+
entryPoint?: string
|
|
72
|
+
assets?: string[]
|
|
73
|
+
error?: string
|
|
74
|
+
code?: string
|
|
76
75
|
map?: string
|
|
77
|
-
imports
|
|
78
|
-
exports
|
|
79
|
-
warnings
|
|
76
|
+
imports?: string[]
|
|
77
|
+
exports?: string[]
|
|
78
|
+
warnings?: BuildWarning[]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface BundleOptions {
|
|
82
|
+
env?: Record<string, string>
|
|
83
|
+
external?: string[]
|
|
84
|
+
minify?: boolean
|
|
85
|
+
sourceMaps?: boolean
|
|
80
86
|
}
|
|
81
87
|
|
|
82
88
|
export interface OptimizationOptions {
|
|
@@ -89,11 +95,29 @@ export interface OptimizationOptions {
|
|
|
89
95
|
}
|
|
90
96
|
|
|
91
97
|
export interface OptimizationResult {
|
|
98
|
+
success: boolean
|
|
99
|
+
duration: number
|
|
92
100
|
originalSize: number
|
|
93
101
|
optimizedSize: number
|
|
94
102
|
compressionRatio: number
|
|
95
|
-
optimizations:
|
|
96
|
-
|
|
103
|
+
optimizations: OptimizationStep[]
|
|
104
|
+
error?: string
|
|
105
|
+
warnings?: BuildWarning[]
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface OptimizationStep {
|
|
109
|
+
type: string
|
|
110
|
+
description: string
|
|
111
|
+
sizeSaved: number
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface OptimizationConfig {
|
|
115
|
+
minify: boolean
|
|
116
|
+
treeshake: boolean
|
|
117
|
+
compress: boolean
|
|
118
|
+
removeUnusedCSS: boolean
|
|
119
|
+
optimizeImages: boolean
|
|
120
|
+
bundleAnalysis: boolean
|
|
97
121
|
}
|
|
98
122
|
|
|
99
123
|
export interface BuildManifest {
|