@b9g/shovel 0.2.2 → 0.2.3
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
CHANGED
|
@@ -2,215 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to Shovel will be documented in this file.
|
|
4
4
|
|
|
5
|
-
## [0.2.
|
|
6
|
-
|
|
7
|
-
### Bug Fixes
|
|
8
|
-
|
|
9
|
-
- **Fix asset manifest invalidation in dev mode** - Assets with new content hashes after client bundle changes no longer return 404. The root cause was build-time manifest resolution reading stale data from disk during rebuilds. ([#36](https://github.com/bikeshaving/shovel/pull/36), fixes [#35](https://github.com/bikeshaving/shovel/issues/35))
|
|
10
|
-
|
|
11
|
-
## [0.2.0-beta.12] - 2026-01-14
|
|
12
|
-
|
|
13
|
-
### Breaking Changes
|
|
14
|
-
|
|
15
|
-
- **`shovel activate` command removed** - Use `shovel build --lifecycle` instead
|
|
16
|
-
- **`loadServiceWorker()` removed** - Use `platform.serviceWorker.register()` instead
|
|
17
|
-
- **`getEntryWrapper()` removed** - Use `getProductionEntryPoints()` instead
|
|
5
|
+
## [0.2.3] - 2026-02-02
|
|
18
6
|
|
|
19
|
-
###
|
|
7
|
+
### Features
|
|
20
8
|
|
|
21
|
-
|
|
9
|
+
- **Enable code splitting for client-side bundles** - Dynamic imports in client scripts now create separate chunks instead of being inlined, allowing heavy dependencies to be lazy-loaded. ([#39](https://github.com/bikeshaving/shovel/pull/39), fixes [#38](https://github.com/bikeshaving/shovel/issues/38))
|
|
22
10
|
|
|
23
|
-
|
|
24
|
-
- **Platform-driven entry points** - Platforms define their output structure via `getProductionEntryPoints()`:
|
|
25
|
-
- Node/Bun: `{ index: "<supervisor>", worker: "<worker>" }` - two files
|
|
26
|
-
- Cloudflare: `{ worker: "<code>" }` - single file
|
|
27
|
-
- **Deleted `activate` command** - Replaced with `shovel build --lifecycle` flag
|
|
28
|
-
- `--lifecycle` - runs activate stage (default)
|
|
29
|
-
- `--lifecycle install` - runs install stage only
|
|
30
|
-
|
|
31
|
-
### API Changes
|
|
32
|
-
|
|
33
|
-
- **New `platform.serviceWorker.register()` API** - Mirrors browser's `navigator.serviceWorker.register()`
|
|
34
|
-
- **Deleted `loadServiceWorker()`** - Use `serviceWorker.register()` instead
|
|
35
|
-
- **New `platform.listen()` / `close()`** - Server lifecycle management
|
|
36
|
-
- **New `runLifecycle()` and `dispatchRequest()`** - Public runtime utilities
|
|
11
|
+
### Bug Fixes
|
|
37
12
|
|
|
38
|
-
|
|
13
|
+
- **Use unique manifest keys for chunks** - Chunk files are now keyed by URL to avoid collisions when the same chunk appears in different assetBase directories.
|
|
39
14
|
|
|
40
|
-
|
|
41
|
-
- Added JSDoc to platform `create*` methods documenting defaults
|
|
42
|
-
- Standardized import organization (node builtins → external → @b9g/* → relative)
|
|
43
|
-
- Renamed `isDynamicCode` → `containsRuntimeExpressions` for clarity
|
|
15
|
+
## [0.2.2] - 2026-01-30
|
|
44
16
|
|
|
45
|
-
###
|
|
17
|
+
### Bug Fixes
|
|
46
18
|
|
|
47
|
-
-
|
|
48
|
-
- `@b9g/platform-node` → 0.1.14-beta.0
|
|
49
|
-
- `@b9g/platform-bun` → 0.1.12-beta.0
|
|
50
|
-
- `@b9g/platform-cloudflare` → 0.1.12-beta.0
|
|
19
|
+
- **Fix asset manifest invalidation in dev mode** - Assets with new content hashes after client bundle changes no longer return 404. The root cause was build-time manifest resolution reading stale data from disk during rebuilds. ([#36](https://github.com/bikeshaving/shovel/pull/36), fixes [#35](https://github.com/bikeshaving/shovel/issues/35))
|
|
51
20
|
|
|
52
|
-
|
|
21
|
+
## [0.2.1] - 2026-01-28
|
|
53
22
|
|
|
54
|
-
|
|
55
|
-
- `src/utils/watcher.ts` - Merged into `ServerBundler`
|
|
56
|
-
- `src/plugins/shovel.ts` - Split into `config.ts` + `entry.ts`
|
|
57
|
-
- `packages/platform/test/single-threaded.test.ts`
|
|
58
|
-
- `SingleThreadedRuntime` class - All platforms now use `ServiceWorkerPool`
|
|
23
|
+
### Improvements
|
|
59
24
|
|
|
60
|
-
|
|
25
|
+
- **Improved create-shovel UX** - Better templates and user experience for project scaffolding
|
|
61
26
|
|
|
62
|
-
## [0.2.0
|
|
27
|
+
## [0.2.0] - 2026-01-28
|
|
63
28
|
|
|
64
|
-
|
|
65
|
-
- **ESBuild configuration support (#18)** - Custom esbuild options in shovel.json
|
|
66
|
-
- **Config expression syntax** - `$PORT || 3000`, `$DATABASE_URL ?? null`
|
|
67
|
-
- **Null fallback fix** - Allow intentional null fallbacks in config expressions
|
|
68
|
-
- **DatabaseStorage API redesign** - New open/get pattern with IndexedDB-style migrations
|
|
69
|
-
- **Migrated from Drizzle to @b9g/zen** - Simpler, more portable database layer
|
|
70
|
-
- **Logging DX improvements** - Better defaults, consolidated categories
|
|
71
|
-
- **`impl` key unification** - Simplified resource configuration
|
|
72
|
-
- **CI/lint enforcement** - ESLint and Prettier standardized
|
|
73
|
-
- **Documentation** - Comprehensive docs for all APIs
|
|
29
|
+
This is a major release that establishes Shovel as a complete ServiceWorker-based meta-framework with locked-down APIs for core packages, a unified configuration system, and comprehensive platform support.
|
|
74
30
|
|
|
75
|
-
###
|
|
76
|
-
- `@b9g/router` → 0.2.0-beta.1 (CORS middleware, trailingSlash moved)
|
|
77
|
-
- `@b9g/node-webworker` → 0.2.0-beta.1 (CloseEvent, onclose, env option)
|
|
78
|
-
- `@b9g/cache-redis` → 0.2.0-beta.1 (logger category fix)
|
|
79
|
-
- `@b9g/assets` → 0.2.0-beta.0
|
|
80
|
-
- `@b9g/async-context` → 0.2.0-beta.0
|
|
81
|
-
- `@b9g/cache` → 0.2.0-beta.0
|
|
82
|
-
- `@b9g/http-errors` → 0.2.0-beta.0
|
|
83
|
-
- `@b9g/match-pattern` → 0.2.0-beta.0
|
|
31
|
+
### Highlights
|
|
84
32
|
|
|
85
|
-
|
|
33
|
+
- **Consistent Worker Execution Model** - ServiceWorker code always runs in a worker thread
|
|
34
|
+
- **ESBuild Configuration Support** - Custom esbuild options in shovel.json
|
|
35
|
+
- **Config Expression Syntax** - `$PORT || 3000`, `$DATABASE_URL ?? null`
|
|
36
|
+
- **Comprehensive Logging System** - Built-in LogTape integration
|
|
37
|
+
- **Database Storage API** - IndexedDB-style migrations with `self.databases`
|
|
38
|
+
- **CORS Middleware** - New middleware in `@b9g/router/middleware`
|
|
39
|
+
- **Unified Build System** - New `ServerBundler` class, platform-driven entry points
|
|
86
40
|
|
|
87
|
-
|
|
41
|
+
### Breaking Changes
|
|
88
42
|
|
|
89
|
-
|
|
43
|
+
- `self.buckets` renamed to `self.directories`
|
|
44
|
+
- `shovel activate` command removed - Use `shovel build --lifecycle` instead
|
|
45
|
+
- `loadServiceWorker()` removed - Use `platform.serviceWorker.register()` instead
|
|
46
|
+
- `@b9g/router` trailingSlash middleware moved to `@b9g/router/middleware`
|
|
47
|
+
- `self.loggers.get()` now takes an array: `self.loggers.get(["app", "db"])`
|
|
90
48
|
|
|
91
|
-
###
|
|
49
|
+
### CLI
|
|
92
50
|
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
- **`self.loggers.get()` signature changed** - Now takes an array: `self.loggers.get(["app", "db"])` instead of dot notation
|
|
96
|
-
- **Config `module`/`export` unified to `impl`** - Resource configurations now use a single `impl` key for reified implementations
|
|
97
|
-
|
|
98
|
-
### New Features
|
|
99
|
-
|
|
100
|
-
#### Consistent Worker Execution Model (#17)
|
|
101
|
-
ServiceWorker code now ALWAYS runs in a worker thread, never the main thread. This ensures:
|
|
102
|
-
- Same globals/environment in dev and prod (eliminates mode-only bugs)
|
|
103
|
-
- Worker isolation preserved
|
|
104
|
-
- Simplified mental model
|
|
105
|
-
|
|
106
|
-
#### ESBuild Configuration Support (#18)
|
|
107
|
-
Custom ESBuild options can now be specified in `shovel.json`:
|
|
108
|
-
```json
|
|
109
|
-
{
|
|
110
|
-
"esbuild": {
|
|
111
|
-
"external": ["lightningcss"],
|
|
112
|
-
"define": { "DEBUG": "true" }
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
#### Config Expression Syntax
|
|
118
|
-
Environment variables and expressions in `shovel.json`:
|
|
119
|
-
```json
|
|
120
|
-
{
|
|
121
|
-
"port": "$PORT || 3000",
|
|
122
|
-
"databases": {
|
|
123
|
-
"main": {
|
|
124
|
-
"url": "$DATABASE_URL"
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
#### Comprehensive Logging System
|
|
131
|
-
- Built-in LogTape integration with console sink by default
|
|
132
|
-
- Configurable sinks (file, OpenTelemetry, Sentry, etc.)
|
|
133
|
-
- Category-based log levels
|
|
134
|
-
- `shovel` category logs at `info` level by default
|
|
135
|
-
|
|
136
|
-
#### Database Storage API
|
|
137
|
-
New `self.databases` API with IndexedDB-style migrations:
|
|
138
|
-
```typescript
|
|
139
|
-
self.addEventListener("activate", (event) => {
|
|
140
|
-
event.waitUntil(
|
|
141
|
-
databases.open("main", 2, (e) => {
|
|
142
|
-
e.waitUntil(e.db.exec`CREATE TABLE users (...)`);
|
|
143
|
-
})
|
|
144
|
-
);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
// In fetch handlers
|
|
148
|
-
const db = databases.get("main");
|
|
149
|
-
const users = await db.all`SELECT * FROM users`;
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
#### CORS Middleware
|
|
153
|
-
New CORS middleware in `@b9g/router/middleware`:
|
|
154
|
-
```typescript
|
|
155
|
-
import { cors } from "@b9g/router/middleware";
|
|
156
|
-
router.use(cors({ origin: "https://example.com" }));
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### Package Updates
|
|
160
|
-
|
|
161
|
-
#### Locked at 0.2.0-beta.0 (API stable)
|
|
162
|
-
- `@b9g/async-context` - AsyncContext polyfill
|
|
163
|
-
- `@b9g/match-pattern` - URLPattern implementation
|
|
164
|
-
- `@b9g/assets` - Static asset pipeline with content hashing
|
|
165
|
-
- `@b9g/cache` - Cache API implementation (memory, postmessage)
|
|
166
|
-
- `@b9g/http-errors` - HTTP error classes
|
|
167
|
-
|
|
168
|
-
#### Updated to 0.2.0-beta.1
|
|
169
|
-
- `@b9g/router` - Added CORS middleware, moved trailingSlash to /middleware
|
|
170
|
-
- `@b9g/node-webworker` - Added CloseEvent, onclose handler, env option
|
|
171
|
-
- `@b9g/cache-redis` - Logger category updates
|
|
172
|
-
|
|
173
|
-
#### Still Evolving (0.1.x)
|
|
174
|
-
- `@b9g/platform` - Core runtime and platform abstraction
|
|
175
|
-
- `@b9g/platform-bun` - Bun platform adapter
|
|
176
|
-
- `@b9g/platform-node` - Node.js platform adapter
|
|
177
|
-
- `@b9g/platform-cloudflare` - Cloudflare Workers adapter
|
|
178
|
-
- `@b9g/filesystem` - File System Access API implementation
|
|
179
|
-
- `@b9g/filesystem-s3` - S3 filesystem adapter
|
|
180
|
-
|
|
181
|
-
### CLI Changes
|
|
182
|
-
|
|
183
|
-
- `shovel develop` - Development server with hot reload (note: `dev` alias removed)
|
|
184
|
-
- `shovel build` - Production build (use `--lifecycle` flag to run lifecycle events)
|
|
185
|
-
- Removed `--verbose` flags (use logging config instead)
|
|
186
|
-
|
|
187
|
-
### Infrastructure
|
|
188
|
-
|
|
189
|
-
- Migrated from Drizzle ORM to `@b9g/zen` for database operations
|
|
190
|
-
- Added GitHub Actions CI with parallel test execution
|
|
191
|
-
- ESLint and Prettier configuration standardized
|
|
192
|
-
- Comprehensive test suites with `bun:test`
|
|
193
|
-
|
|
194
|
-
### Documentation
|
|
195
|
-
|
|
196
|
-
New documentation pages:
|
|
197
|
-
- Getting Started guide
|
|
198
|
-
- CLI reference
|
|
199
|
-
- Configuration (shovel.json) reference
|
|
200
|
-
- Deployment guide
|
|
201
|
-
- ServiceWorker lifecycle
|
|
202
|
-
- Routing and middleware
|
|
203
|
-
- Storage APIs (databases, caches, directories)
|
|
204
|
-
- Cookies and AsyncContext
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
## [0.1.x] - Previous Releases
|
|
209
|
-
|
|
210
|
-
Initial development releases establishing core architecture:
|
|
211
|
-
- ServiceWorker-based request handling
|
|
212
|
-
- Platform abstraction layer
|
|
213
|
-
- Router with generator-based middleware
|
|
214
|
-
- Cache API implementations
|
|
215
|
-
- File System Access API
|
|
216
|
-
- Hot reload in development
|
|
51
|
+
- `shovel develop` - Development server with hot reload
|
|
52
|
+
- `shovel build` - Production build with `--lifecycle` flag for lifecycle events
|
package/bin/cli.js
CHANGED
|
@@ -75,7 +75,7 @@ program.command("develop <entrypoint>").description("Start development server wi
|
|
|
75
75
|
DEFAULTS.WORKERS
|
|
76
76
|
).option("--platform <name>", "Runtime platform (node, cloudflare, bun)").action(async (entrypoint, options) => {
|
|
77
77
|
checkPlatformReexec(options);
|
|
78
|
-
const { developCommand } = await import("../src/_chunks/develop-
|
|
78
|
+
const { developCommand } = await import("../src/_chunks/develop-6DPQE5H4.js");
|
|
79
79
|
await developCommand(entrypoint, options, config);
|
|
80
80
|
});
|
|
81
81
|
program.command("build <entrypoint>").description("Build app for production").option("--platform <name>", "Runtime platform (node, cloudflare, bun)").option(
|
|
@@ -83,7 +83,7 @@ program.command("build <entrypoint>").description("Build app for production").op
|
|
|
83
83
|
"Run ServiceWorker lifecycle after build (install or activate, default: activate)"
|
|
84
84
|
).action(async (entrypoint, options) => {
|
|
85
85
|
checkPlatformReexec(options);
|
|
86
|
-
const { buildCommand } = await import("../src/_chunks/build-
|
|
86
|
+
const { buildCommand } = await import("../src/_chunks/build-BM4A74RI.js");
|
|
87
87
|
await buildCommand(entrypoint, options, config);
|
|
88
88
|
process.exit(0);
|
|
89
89
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b9g/shovel",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "ServiceWorker-first universal deployment platform. Write ServiceWorker apps once, deploy anywhere (Node/Bun/Cloudflare). Registry-based multi-app orchestration.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -98,6 +98,7 @@ function assetsPlugin(options = {}) {
|
|
|
98
98
|
let content;
|
|
99
99
|
let outputExt = ext;
|
|
100
100
|
let mimeType;
|
|
101
|
+
let chunkFiles = [];
|
|
101
102
|
if (needsTranspilation) {
|
|
102
103
|
const defaultPlugins = [
|
|
103
104
|
NodeModulesPolyfillPlugin(),
|
|
@@ -111,11 +112,12 @@ function assetsPlugin(options = {}) {
|
|
|
111
112
|
entryPoints: [args.path],
|
|
112
113
|
bundle: true,
|
|
113
114
|
format: "esm",
|
|
115
|
+
splitting: true,
|
|
114
116
|
target: ["es2022", "chrome90"],
|
|
115
117
|
platform: "browser",
|
|
116
118
|
write: false,
|
|
117
119
|
minify: true,
|
|
118
|
-
// outdir is required for esbuild to know where to put extracted CSS
|
|
120
|
+
// outdir is required for esbuild to know where to put extracted CSS and chunks
|
|
119
121
|
outdir: outDir,
|
|
120
122
|
// Apply polyfills and user-provided build options
|
|
121
123
|
plugins,
|
|
@@ -152,10 +154,10 @@ function assetsPlugin(options = {}) {
|
|
|
152
154
|
outputExt = ".css";
|
|
153
155
|
mimeType = "text/css";
|
|
154
156
|
} else {
|
|
155
|
-
const
|
|
157
|
+
const jsOutputFiles = result.outputFiles.filter(
|
|
156
158
|
(f) => f.path.endsWith(".js")
|
|
157
159
|
);
|
|
158
|
-
if (
|
|
160
|
+
if (jsOutputFiles.length === 0) {
|
|
159
161
|
return {
|
|
160
162
|
errors: [
|
|
161
163
|
{
|
|
@@ -164,9 +166,30 @@ function assetsPlugin(options = {}) {
|
|
|
164
166
|
]
|
|
165
167
|
};
|
|
166
168
|
}
|
|
167
|
-
|
|
169
|
+
const entryBaseName = name + ".js";
|
|
170
|
+
const entryFile = jsOutputFiles.find(
|
|
171
|
+
(f) => basename(f.path) === entryBaseName
|
|
172
|
+
);
|
|
173
|
+
if (!entryFile) {
|
|
174
|
+
return {
|
|
175
|
+
errors: [
|
|
176
|
+
{
|
|
177
|
+
text: `Could not find entry file ${entryBaseName} in output`
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
content = Buffer.from(entryFile.text);
|
|
168
183
|
outputExt = ".js";
|
|
169
184
|
mimeType = "application/javascript";
|
|
185
|
+
for (const file of jsOutputFiles) {
|
|
186
|
+
if (file === entryFile)
|
|
187
|
+
continue;
|
|
188
|
+
chunkFiles.push({
|
|
189
|
+
filename: basename(file.path),
|
|
190
|
+
content: Buffer.from(file.text)
|
|
191
|
+
});
|
|
192
|
+
}
|
|
170
193
|
}
|
|
171
194
|
} else if (needsCSSBundling) {
|
|
172
195
|
const entryPath = args.path;
|
|
@@ -274,6 +297,23 @@ function assetsPlugin(options = {}) {
|
|
|
274
297
|
}
|
|
275
298
|
const outputPath = join(outputDir, filename);
|
|
276
299
|
writeFileSync(outputPath, content);
|
|
300
|
+
for (const chunk of chunkFiles) {
|
|
301
|
+
const chunkPath = join(outputDir, chunk.filename);
|
|
302
|
+
writeFileSync(chunkPath, chunk.content);
|
|
303
|
+
const chunkUrl = `${basePath}${chunk.filename}`;
|
|
304
|
+
const chunkHash = createHash("sha256").update(chunk.content).digest("hex").slice(0, HASH_LENGTH);
|
|
305
|
+
manifest.assets[chunkUrl] = {
|
|
306
|
+
source: chunk.filename,
|
|
307
|
+
output: chunk.filename,
|
|
308
|
+
url: chunkUrl,
|
|
309
|
+
hash: chunkHash,
|
|
310
|
+
size: chunk.content.length,
|
|
311
|
+
type: "application/javascript"
|
|
312
|
+
};
|
|
313
|
+
if (sharedManifest) {
|
|
314
|
+
sharedManifest.assets[chunkUrl] = manifest.assets[chunkUrl];
|
|
315
|
+
}
|
|
316
|
+
}
|
|
277
317
|
const sourcePath = relative(process.cwd(), args.path);
|
|
278
318
|
const manifestEntry = {
|
|
279
319
|
source: sourcePath,
|