@b9g/shovel 0.2.0-beta.2 โ 0.2.0-beta.21
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/CHANGELOG.md +184 -172
- package/README.md +313 -54
- package/bin/cli.d.ts +0 -1
- package/bin/cli.js +62 -786
- package/bin/create.js +79 -37
- package/package.json +33 -37
- package/src/_chunks/build-IWPEM2EW.js +160 -0
- package/src/_chunks/chunk-PTLNYIRW.js +1158 -0
- package/src/_chunks/chunk-VWH6D26D.js +1062 -0
- package/src/_chunks/develop-VHR5FLGQ.js +85 -0
- package/src/_chunks/info-TDUY3FZN.js +13 -0
- package/src/worker-entry.d.ts +0 -7
- package/src/worker-entry.js +0 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,198 +1,210 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes to
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [0.2.0-beta] - 2025-11-05
|
|
9
|
-
|
|
10
|
-
### Added
|
|
11
|
-
|
|
12
|
-
#### ๐ Directly Executable Production Builds
|
|
13
|
-
- **Self-contained deployment**: `shovel build` now creates directly executable production builds that don't require `shovel serve`
|
|
14
|
-
- **2-file output**: Production builds generate only `server.js` (executable) and `package.json` (dependencies)
|
|
15
|
-
- **Platform bootstrapping**: Automatic platform detection and ServiceWorker environment setup
|
|
16
|
-
- **Zero-config deployment**: Run `chmod +x server.js && ./server.js` after `npm install` in the dist directory
|
|
17
|
-
|
|
18
|
-
#### ๐ Complete ServiceWorker API Implementation
|
|
19
|
-
- **Full ServiceWorker globals**: Implemented `self`, `addEventListener`, `removeEventListener`, `dispatchEvent`
|
|
20
|
-
- **ServiceWorker lifecycle**: Proper `install` and `activate` event handling
|
|
21
|
-
- **ServiceWorker APIs**: Implemented `self.skipWaiting()` and `self.clients` with environment-aware behavior
|
|
22
|
-
- **Web standards compliance**: All APIs follow web platform standards, not runtime-specific implementations
|
|
23
|
-
|
|
24
|
-
#### ๐๏ธ New Bucket Architecture
|
|
25
|
-
- **`self.buckets` API**: Replaced `self.dirs` with standardized bucket interface for filesystem access
|
|
26
|
-
- **Factory pattern**: Dynamic adapter loading for different storage backends (memory, local, S3, R2)
|
|
27
|
-
- **Unified interface**: All storage adapters implement the same `Bucket` interface
|
|
28
|
-
- **`getDirectoryHandle(name)` API**: Standardized directory access following File System Access API patterns
|
|
29
|
-
|
|
30
|
-
#### ๐ฆ Asset Import Improvements
|
|
31
|
-
- **`assetBase` import attribute**: New syntax for asset imports with base path resolution
|
|
32
|
-
- **Automatic asset processing**: Assets are automatically copied and processed during build
|
|
33
|
-
- **Import transformation**: `import './style.css' with { assetBase: true }` generates proper asset URLs
|
|
34
|
-
- **Manifest generation**: Asset manifests track all processed assets with metadata
|
|
35
|
-
|
|
36
|
-
#### ๐งช Enhanced Cache System
|
|
37
|
-
- **Redis cache adapter**: Full Redis support with connection pooling and error handling
|
|
38
|
-
- **Multi-threaded coordination**: PostMessage-based cache coordination for worker environments
|
|
39
|
-
- **Platform-agnostic types**: Separated web standard types from platform-specific implementations
|
|
40
|
-
- **Factory pattern**: Dynamic cache adapter loading matching filesystem patterns
|
|
41
|
-
|
|
42
|
-
#### ๐ง Type System Improvements
|
|
43
|
-
- **Separated type imports**: Platform-specific types only in platform packages, web standard types in shared packages
|
|
44
|
-
- **TypeScript configuration**: Fixed Headers iteration and other compatibility issues with proper lib configuration
|
|
45
|
-
- **Comprehensive type checking**: All packages now pass strict TypeScript compilation
|
|
46
|
-
- **Web standard prioritization**: Chose webworker types over runtime-specific types for compatibility
|
|
47
|
-
|
|
48
|
-
#### โก Performance & Production Features
|
|
49
|
-
- **TechEmpower Framework Benchmarks**: Official implementation and testing completed
|
|
50
|
-
- **Production scaling**: Multi-worker support with proper resource coordination
|
|
51
|
-
- **Docker deployment**: Complete containerization support with optimized builds
|
|
52
|
-
- **Cloudflare Workers**: Enhanced support with proper ES module bundling
|
|
53
|
-
|
|
54
|
-
### Changed
|
|
55
|
-
|
|
56
|
-
#### ๐ฅ Breaking Changes
|
|
57
|
-
- **BREAKING**: Replaced `self.dirs` with `self.buckets` API
|
|
58
|
-
- **BREAKING**: Changed `getBucket()` to `getDirectoryHandle(name: string)` for standardization
|
|
59
|
-
- **BREAKING**: Asset imports now require explicit `assetBase` attribute for base path resolution
|
|
60
|
-
- **BREAKING**: Updated all filesystem adapters to implement new `Bucket` interface
|
|
61
|
-
|
|
62
|
-
#### ๐๏ธ Build System Overhaul
|
|
63
|
-
- **Simplified output**: Moved from complex templating to clean esbuild banner approach
|
|
64
|
-
- **Self-contained bundling**: Framework dependencies bundled, app dependencies preserved
|
|
65
|
-
- **Platform detection**: Automatic runtime detection and appropriate adapter loading
|
|
66
|
-
- **Production runtime**: Uses proven development patterns for production consistency
|
|
67
|
-
|
|
68
|
-
#### ๐ Architecture Improvements
|
|
69
|
-
- **Clean separation**: Platform-specific code isolated from shared/core packages
|
|
70
|
-
- **Consistent interfaces**: All adapters follow same patterns (cache, filesystem, platform)
|
|
71
|
-
- **Dynamic loading**: Runtime adapter detection and loading
|
|
72
|
-
- **Environment awareness**: Proper detection of worker vs main thread contexts
|
|
73
|
-
|
|
74
|
-
### Fixed
|
|
75
|
-
|
|
76
|
-
- **TypeScript compilation**: Resolved Headers.entries() iteration issues with DOM.Iterable configuration
|
|
77
|
-
- **Cache exports**: Fixed missing factory functions in multi-threaded cache coordination
|
|
78
|
-
- **Platform contamination**: Removed Node.js-specific imports from platform-agnostic packages
|
|
79
|
-
- **Build loops**: Fixed infinite loading where worker.js was trying to load itself
|
|
80
|
-
- **Worker globals**: Proper ServiceWorker environment setup in all execution contexts
|
|
81
|
-
- **Dependency resolution**: Fixed workspace dependency resolution and external bundling
|
|
82
|
-
|
|
83
|
-
### Technical Details
|
|
84
|
-
|
|
85
|
-
#### ServiceWorker Implementation
|
|
86
|
-
The ServiceWorker implementation provides full web platform compatibility:
|
|
3
|
+
All notable changes to Shovel will be documented in this file.
|
|
87
4
|
|
|
88
|
-
|
|
89
|
-
// Environment-aware skipWaiting implementation
|
|
90
|
-
const skipWaiting = async (): Promise<void> => {
|
|
91
|
-
if (options.isDevelopment && options.hotReload) {
|
|
92
|
-
console.info('[ServiceWorker] skipWaiting() - triggering hot reload');
|
|
93
|
-
await options.hotReload();
|
|
94
|
-
} else if (!options.isDevelopment) {
|
|
95
|
-
console.info('[ServiceWorker] skipWaiting() - production graceful restart not implemented');
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
```
|
|
5
|
+
## [0.2.0-beta.12] - 2026-01-14
|
|
99
6
|
|
|
100
|
-
|
|
101
|
-
The new build system uses esbuild banners for clean, self-contained executables:
|
|
102
|
-
|
|
103
|
-
```javascript
|
|
104
|
-
// Production bootstrap injected via esbuild banner
|
|
105
|
-
buildConfig.banner = {
|
|
106
|
-
js: `#!/usr/bin/env node
|
|
107
|
-
import { ServiceWorkerRuntime, createServiceWorkerGlobals, createBucketStorage } from '@b9g/platform';
|
|
108
|
-
|
|
109
|
-
if (import.meta.url === \`file://\${process.argv[1]}\`) {
|
|
110
|
-
const runtime = new ServiceWorkerRuntime();
|
|
111
|
-
const buckets = createBucketStorage(process.cwd());
|
|
112
|
-
|
|
113
|
-
createServiceWorkerGlobals(runtime, { buckets });
|
|
114
|
-
// ... HTTP server setup using proven patterns
|
|
115
|
-
}
|
|
116
|
-
// User's ServiceWorker code follows...`
|
|
117
|
-
};
|
|
118
|
-
```
|
|
7
|
+
### Breaking Changes
|
|
119
8
|
|
|
120
|
-
|
|
121
|
-
|
|
9
|
+
- **`shovel activate` command removed** - Use `shovel build --lifecycle` instead
|
|
10
|
+
- **`loadServiceWorker()` removed** - Use `platform.serviceWorker.register()` instead
|
|
11
|
+
- **`getEntryWrapper()` removed** - Use `getProductionEntryPoints()` instead
|
|
122
12
|
|
|
123
|
-
|
|
124
|
-
// Platform-agnostic cache using web standards
|
|
125
|
-
interface WorkerLike {
|
|
126
|
-
postMessage(value: any): void;
|
|
127
|
-
on(event: string, listener: (data: any) => void): void;
|
|
128
|
-
}
|
|
13
|
+
### Build System Unification
|
|
129
14
|
|
|
130
|
-
|
|
131
|
-
body: btoa(String.fromCharCode(...new Uint8Array(body))),
|
|
132
|
-
totalSize += new TextEncoder().encode(value).length;
|
|
133
|
-
```
|
|
15
|
+
Major refactor of the build system to be platform-driven and unified across all commands.
|
|
134
16
|
|
|
135
|
-
|
|
17
|
+
- **New `ServerBundler` class** - Unified bundler replacing separate build/watch logic
|
|
18
|
+
- **Platform-driven entry points** - Platforms define their output structure via `getProductionEntryPoints()`:
|
|
19
|
+
- Node/Bun: `{ index: "<supervisor>", worker: "<worker>" }` - two files
|
|
20
|
+
- Cloudflare: `{ worker: "<code>" }` - single file
|
|
21
|
+
- **Deleted `activate` command** - Replaced with `shovel build --lifecycle` flag
|
|
22
|
+
- `--lifecycle` - runs activate stage (default)
|
|
23
|
+
- `--lifecycle install` - runs install stage only
|
|
136
24
|
|
|
137
|
-
|
|
138
|
-
```typescript
|
|
139
|
-
// Before
|
|
140
|
-
const distDir = await self.dirs.getBucket();
|
|
25
|
+
### API Changes
|
|
141
26
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
27
|
+
- **New `platform.serviceWorker.register()` API** - Mirrors browser's `navigator.serviceWorker.register()`
|
|
28
|
+
- **Deleted `loadServiceWorker()`** - Use `serviceWorker.register()` instead
|
|
29
|
+
- **New `platform.listen()` / `close()`** - Server lifecycle management
|
|
30
|
+
- **New `runLifecycle()` and `dispatchRequest()`** - Public runtime utilities
|
|
145
31
|
|
|
146
|
-
|
|
147
|
-
```typescript
|
|
148
|
-
// Before
|
|
149
|
-
import './style.css' with { url: true };
|
|
32
|
+
### Code Quality
|
|
150
33
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
34
|
+
- Extracted `mergeConfigWithDefaults()` helper to reduce duplication
|
|
35
|
+
- Added JSDoc to platform `create*` methods documenting defaults
|
|
36
|
+
- Standardized import organization (node builtins โ external โ @b9g/* โ relative)
|
|
37
|
+
- Renamed `isDynamicCode` โ `containsRuntimeExpressions` for clarity
|
|
154
38
|
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
# Before
|
|
158
|
-
shovel build
|
|
159
|
-
shovel serve dist/
|
|
39
|
+
### Package Updates
|
|
160
40
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
```
|
|
41
|
+
- `@b9g/platform` โ 0.1.14-beta.0
|
|
42
|
+
- `@b9g/platform-node` โ 0.1.14-beta.0
|
|
43
|
+
- `@b9g/platform-bun` โ 0.1.12-beta.0
|
|
44
|
+
- `@b9g/platform-cloudflare` โ 0.1.12-beta.0
|
|
166
45
|
|
|
167
|
-
###
|
|
46
|
+
### Deleted Files
|
|
168
47
|
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
-
|
|
48
|
+
- `src/commands/activate.ts` - Replaced by `build --lifecycle`
|
|
49
|
+
- `src/utils/watcher.ts` - Merged into `ServerBundler`
|
|
50
|
+
- `src/plugins/shovel.ts` - Split into `config.ts` + `entry.ts`
|
|
51
|
+
- `packages/platform/test/single-threaded.test.ts`
|
|
52
|
+
- `SingleThreadedRuntime` class - All platforms now use `ServiceWorkerPool`
|
|
173
53
|
|
|
174
|
-
|
|
54
|
+
---
|
|
175
55
|
|
|
176
|
-
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
- **
|
|
56
|
+
## [0.2.0-beta.11] - 2026-01-10
|
|
57
|
+
|
|
58
|
+
### Changes since beta.10
|
|
59
|
+
- **ESBuild configuration support (#18)** - Custom esbuild options in shovel.json
|
|
60
|
+
- **Config expression syntax** - `$PORT || 3000`, `$DATABASE_URL ?? null`
|
|
61
|
+
- **Null fallback fix** - Allow intentional null fallbacks in config expressions
|
|
62
|
+
- **DatabaseStorage API redesign** - New open/get pattern with IndexedDB-style migrations
|
|
63
|
+
- **Migrated from Drizzle to @b9g/zen** - Simpler, more portable database layer
|
|
64
|
+
- **Logging DX improvements** - Better defaults, consolidated categories
|
|
65
|
+
- **`impl` key unification** - Simplified resource configuration
|
|
66
|
+
- **CI/lint enforcement** - ESLint and Prettier standardized
|
|
67
|
+
- **Documentation** - Comprehensive docs for all APIs
|
|
68
|
+
|
|
69
|
+
### Package Updates
|
|
70
|
+
- `@b9g/router` โ 0.2.0-beta.1 (CORS middleware, trailingSlash moved)
|
|
71
|
+
- `@b9g/node-webworker` โ 0.2.0-beta.1 (CloseEvent, onclose, env option)
|
|
72
|
+
- `@b9g/cache-redis` โ 0.2.0-beta.1 (logger category fix)
|
|
73
|
+
- `@b9g/assets` โ 0.2.0-beta.0
|
|
74
|
+
- `@b9g/async-context` โ 0.2.0-beta.0
|
|
75
|
+
- `@b9g/cache` โ 0.2.0-beta.0
|
|
76
|
+
- `@b9g/http-errors` โ 0.2.0-beta.0
|
|
77
|
+
- `@b9g/match-pattern` โ 0.2.0-beta.0
|
|
180
78
|
|
|
181
79
|
---
|
|
182
80
|
|
|
183
|
-
## [0.
|
|
81
|
+
## [0.2.0-beta.10] - Previous Beta
|
|
82
|
+
|
|
83
|
+
This is a major release that establishes Shovel as a complete ServiceWorker-based meta-framework. The 0.2.0 beta introduces locked-down APIs for core packages, a unified configuration system, and comprehensive platform support.
|
|
84
|
+
|
|
85
|
+
### Breaking Changes
|
|
86
|
+
|
|
87
|
+
- **`self.buckets` renamed to `self.directories`** - The file system API now uses `directories` to align with web standards terminology
|
|
88
|
+
- **`@b9g/router` middleware moved** - `trailingSlash` middleware moved from main export to `@b9g/router/middleware`
|
|
89
|
+
- **`self.loggers.get()` signature changed** - Now takes an array: `self.loggers.get(["app", "db"])` instead of dot notation
|
|
90
|
+
- **Config `module`/`export` unified to `impl`** - Resource configurations now use a single `impl` key for reified implementations
|
|
184
91
|
|
|
185
|
-
###
|
|
186
|
-
- Initial CLI implementation
|
|
187
|
-
- Basic platform abstraction
|
|
188
|
-
- Development server functionality
|
|
189
|
-
- Asset processing pipeline
|
|
92
|
+
### New Features
|
|
190
93
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
94
|
+
#### Consistent Worker Execution Model (#17)
|
|
95
|
+
ServiceWorker code now ALWAYS runs in a worker thread, never the main thread. This ensures:
|
|
96
|
+
- Same globals/environment in dev and prod (eliminates mode-only bugs)
|
|
97
|
+
- Worker isolation preserved
|
|
98
|
+
- Simplified mental model
|
|
99
|
+
|
|
100
|
+
#### ESBuild Configuration Support (#18)
|
|
101
|
+
Custom ESBuild options can now be specified in `shovel.json`:
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"esbuild": {
|
|
105
|
+
"external": ["lightningcss"],
|
|
106
|
+
"define": { "DEBUG": "true" }
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### Config Expression Syntax
|
|
112
|
+
Environment variables and expressions in `shovel.json`:
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"port": "$PORT || 3000",
|
|
116
|
+
"databases": {
|
|
117
|
+
"main": {
|
|
118
|
+
"url": "$DATABASE_URL"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### Comprehensive Logging System
|
|
125
|
+
- Built-in LogTape integration with console sink by default
|
|
126
|
+
- Configurable sinks (file, OpenTelemetry, Sentry, etc.)
|
|
127
|
+
- Category-based log levels
|
|
128
|
+
- `shovel` category logs at `info` level by default
|
|
129
|
+
|
|
130
|
+
#### Database Storage API
|
|
131
|
+
New `self.databases` API with IndexedDB-style migrations:
|
|
132
|
+
```typescript
|
|
133
|
+
self.addEventListener("activate", (event) => {
|
|
134
|
+
event.waitUntil(
|
|
135
|
+
databases.open("main", 2, (e) => {
|
|
136
|
+
e.waitUntil(e.db.exec`CREATE TABLE users (...)`);
|
|
137
|
+
})
|
|
138
|
+
);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// In fetch handlers
|
|
142
|
+
const db = databases.get("main");
|
|
143
|
+
const users = await db.all`SELECT * FROM users`;
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### CORS Middleware
|
|
147
|
+
New CORS middleware in `@b9g/router/middleware`:
|
|
148
|
+
```typescript
|
|
149
|
+
import { cors } from "@b9g/router/middleware";
|
|
150
|
+
router.use(cors({ origin: "https://example.com" }));
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Package Updates
|
|
154
|
+
|
|
155
|
+
#### Locked at 0.2.0-beta.0 (API stable)
|
|
156
|
+
- `@b9g/async-context` - AsyncContext polyfill
|
|
157
|
+
- `@b9g/match-pattern` - URLPattern implementation
|
|
158
|
+
- `@b9g/assets` - Static asset pipeline with content hashing
|
|
159
|
+
- `@b9g/cache` - Cache API implementation (memory, postmessage)
|
|
160
|
+
- `@b9g/http-errors` - HTTP error classes
|
|
161
|
+
|
|
162
|
+
#### Updated to 0.2.0-beta.1
|
|
163
|
+
- `@b9g/router` - Added CORS middleware, moved trailingSlash to /middleware
|
|
164
|
+
- `@b9g/node-webworker` - Added CloseEvent, onclose handler, env option
|
|
165
|
+
- `@b9g/cache-redis` - Logger category updates
|
|
166
|
+
|
|
167
|
+
#### Still Evolving (0.1.x)
|
|
168
|
+
- `@b9g/platform` - Core runtime and platform abstraction
|
|
169
|
+
- `@b9g/platform-bun` - Bun platform adapter
|
|
170
|
+
- `@b9g/platform-node` - Node.js platform adapter
|
|
171
|
+
- `@b9g/platform-cloudflare` - Cloudflare Workers adapter
|
|
172
|
+
- `@b9g/filesystem` - File System Access API implementation
|
|
173
|
+
- `@b9g/filesystem-s3` - S3 filesystem adapter
|
|
174
|
+
|
|
175
|
+
### CLI Changes
|
|
176
|
+
|
|
177
|
+
- `shovel develop` - Development server with hot reload (note: `dev` alias removed)
|
|
178
|
+
- `shovel build` - Production build (use `--lifecycle` flag to run lifecycle events)
|
|
179
|
+
- Removed `--verbose` flags (use logging config instead)
|
|
180
|
+
|
|
181
|
+
### Infrastructure
|
|
182
|
+
|
|
183
|
+
- Migrated from Drizzle ORM to `@b9g/zen` for database operations
|
|
184
|
+
- Added GitHub Actions CI with parallel test execution
|
|
185
|
+
- ESLint and Prettier configuration standardized
|
|
186
|
+
- Comprehensive test suites with `bun:test`
|
|
187
|
+
|
|
188
|
+
### Documentation
|
|
189
|
+
|
|
190
|
+
New documentation pages:
|
|
191
|
+
- Getting Started guide
|
|
192
|
+
- CLI reference
|
|
193
|
+
- Configuration (shovel.json) reference
|
|
194
|
+
- Deployment guide
|
|
195
|
+
- ServiceWorker lifecycle
|
|
196
|
+
- Routing and middleware
|
|
197
|
+
- Storage APIs (databases, caches, directories)
|
|
198
|
+
- Cookies and AsyncContext
|
|
195
199
|
|
|
196
200
|
---
|
|
197
201
|
|
|
198
|
-
|
|
202
|
+
## [0.1.x] - Previous Releases
|
|
203
|
+
|
|
204
|
+
Initial development releases establishing core architecture:
|
|
205
|
+
- ServiceWorker-based request handling
|
|
206
|
+
- Platform abstraction layer
|
|
207
|
+
- Router with generator-based middleware
|
|
208
|
+
- Cache API implementations
|
|
209
|
+
- File System Access API
|
|
210
|
+
- Hot reload in development
|