Skip to content

Commit 5554d86

Browse files
authored
Merge pull request #36 from SQLoot/bun-first
PR: merge fixed bun-first to main
2 parents 0aab14d + ff10175 commit 5554d86

File tree

25 files changed

+383
-384
lines changed

25 files changed

+383
-384
lines changed

.changeset/array-module-refactor.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ if (isNonEmptyArray(mutableArr)) { ... }
3535
- **`sortArray`** — returns a new sorted array (wraps `toSorted`), preserving non-empty type
3636
- **`reverseArray`** — returns a new reversed array (wraps `toReversed`), preserving non-empty type
3737
- **`spliceArray`** — returns a new array with elements removed/replaced (wraps `toSpliced`)
38+
- **`zipArray`** — combines multiple arrays into an array of tuples, preserving non-empty type
3839

3940
### Migration
4041

.changeset/console-static-level-inheritance.md renamed to .changeset/console-improved.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Redesigned Console with structured logging and pluggable outputs
88

99
- Replaced `enabled` property with `ConsoleLevel` filtering (trace < debug < log < info < warn < error < silent)
1010
- Removed `enableLogging` config option - use `level` instead
11-
- Removed `createConsoleWithTime` - use `createConsoleEntryFormatter` with `formatEntry` option
11+
- Removed `createConsoleWithTime` - use `createConsoleFormatter` with `format` option
1212
- Removed `assert` method
1313
- Changed `TestConsole.getLogsSnapshot()` to `getEntriesSnapshot()` returning `ConsoleEntry` objects
1414
- Changed `TestConsole.clearLogs()` to `clearEntries()`
@@ -21,6 +21,9 @@ Redesigned Console with structured logging and pluggable outputs
2121
- `children: ReadonlySet<Console>` tracks child consoles for batch operations
2222
- `name` property identifies consoles
2323
- `getLevel()`, `setLevel(level | null)`, `hasOwnLevel()` for runtime level control
24-
- `createConsoleEntryFormatter` for timestamps (relative, absolute, iso) and path prefixes
24+
- `createConsoleFormatter` for timestamps (relative, absolute, iso) and path prefixes
2525
- `createNativeConsoleOutput` and `createConsoleArrayOutput` built-in outputs
2626
- Static level inheritance - children inherit parent's level at creation, then are independent
27+
- `createConsoleStoreOutput` — a `ConsoleOutput` that stores the latest entry in a `ReadonlyStore` for observing log entries (e.g., forwarding from workers to main thread)
28+
- `createMultiOutput` — fans out entries to multiple outputs (e.g., native console + store)
29+
- Simplified `testCreateConsole` to delegate to `createConsole` internally

.changeset/lovely-aliens-camp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"@evolu/common": minor
33
---
44

5-
Added `createObjectURL` helper for safe, disposable `URL.createObjectURL` usage using JS Resource Management so the URL is disposed automatically when the scope ends.
5+
Added `createObjectURL` helper for safe, disposable `URL.createObjectURL` usage using JS Resource management so the URL is disposed automatically when the scope ends.
66

77
Example:
88

.changeset/set-module.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Added Set module with type-safe helpers for immutable set operations.
1212

1313
- `emptySet` — singleton empty set to avoid allocations
1414

15-
**Type Guards:**
15+
**Type guards:**
1616

1717
- `isNonEmptySet` — narrows to branded `NonEmptyReadonlySet`
1818

.changeset/spotty-coats-sort.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"@evolu/common": minor
33
---
44

5-
Added Resource Management polyfills
5+
Added Resource management polyfills
66

77
Provides `Symbol.dispose`, `Symbol.asyncDispose`, `DisposableStack`, and `AsyncDisposableStack` for environments without native support (e.g., Safari). This enables the `using` and `await using` declarations for automatic resource cleanup.
88

.changeset/worker-abstraction-refactor.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
Refactored worker abstraction to support all platforms uniformly:
99

1010
- Added platform-agnostic worker interfaces: `Worker<Input, Output>`, `SharedWorker<Input, Output>`, `MessagePort<Input, Output>`, `MessageChannel<Input, Output>`
11-
- Added worker-side interfaces: `WorkerScope<Input, Output>` and `SharedWorkerScope<Input, Output>` that extend `GlobalErrorScope` for unified error handling
11+
- Added worker-side interfaces: `WorkerSelf<Input, Output>` and `SharedWorkerSelf<Input, Output>` for typed worker `self` wrappers
1212
- Changed `onMessage` from a method to a property for consistency with Web APIs
1313
- Made all worker and message port interfaces `Disposable` for proper resource cleanup
1414
- Added default generic parameters (`Output = never`) for simpler one-way communication patterns
15-
- Added complete web platform implementations: `createWorker`, `createSharedWorker`, `createMessageChannel`, `createWorkerScope`, `createSharedWorkerScope`, `createMessagePort`
15+
- Added complete web platform implementations: `createWorker`, `createSharedWorker`, `createMessageChannel`, `createWorkerSelf`, `createSharedWorkerSelf`, `createMessagePort`
1616
- Added React Native polyfills for Workers and MessageChannel

apps/web/next.config.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,32 @@ const withMDX = nextMDX({
1717
const nextConfig = {
1818
reactStrictMode: true,
1919
pageExtensions: ["js", "jsx", "ts", "tsx", "mdx"],
20+
21+
// Resolve workspace @evolu/* packages to TypeScript source for live reload.
22+
// The "source" condition matches the export added to each package.json.
23+
// The extensionAlias maps .js imports to .ts since packages use NodeNext
24+
// module resolution with explicit .js extensions (required for npm publishing).
25+
transpilePackages: [
26+
"@evolu/common",
27+
"@evolu/web",
28+
"@evolu/react",
29+
"@evolu/react-web",
30+
],
31+
webpack(config) {
32+
config.resolve.conditionNames = [
33+
"source",
34+
"browser",
35+
"import",
36+
"module",
37+
"require",
38+
"default",
39+
];
40+
config.resolve.extensionAlias = {
41+
".js": [".ts", ".tsx", ".js"],
42+
};
43+
return config;
44+
},
45+
2046
outputFileTracingIncludes: {
2147
"/**/*": ["./src/app/**/*.mdx"],
2248
},

apps/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"dependencies": {
1919
"@algolia/autocomplete-core": "^1.19.4",
20+
"@emotion/is-prop-valid": "^1.4.0",
2021
"@evolu/common": "workspace:*",
2122
"@evolu/react": "workspace:*",
2223
"@evolu/react-web": "workspace:*",

apps/web/src/app/(docs)/docs/local-first/page.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ const Schema = {
9494
`createdAt`, `updatedAt`, `isDeleted`, and `ownerId`.
9595
</Note>
9696

97+
## Bun hot workflow (schema iteration)
98+
99+
If you run your app entrypoint directly with Bun, you can use hot mode while
100+
iterating on schema and mutations:
101+
102+
```bash
103+
bun --hot ./apps/relay/src/index.ts
104+
```
105+
106+
This keeps process startup fast during development and reloads on file changes.
107+
108+
<Note>
109+
Schema changes can invalidate existing local data during development. If you
110+
hit schema mismatch errors, reset local state (for example with
111+
`resetAppOwner({ reload: false })`) before retrying.
112+
</Note>
113+
97114
## Create Evolu
98115

99116
After defining the schema, create an Evolu instance for your environment.

apps/web/src/app/(playgrounds)/playgrounds/minimal/EvoluMinimalExample.tsx

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ const Schema = {
2727

2828
const deps = createEvoluDeps();
2929

30+
deps.evoluError.subscribe(() => {
31+
const error = deps.evoluError.get();
32+
if (!error) return;
33+
34+
alert("🚨 Evolu error occurred! Check the console.");
35+
// eslint-disable-next-line no-console
36+
console.error(error);
37+
});
38+
3039
// Create Evolu instance for the React web platform.
3140
const evolu = Evolu.createEvolu(deps)(Schema, {
3241
name: Evolu.SimpleName.orThrow("minimal-example"),
@@ -46,20 +55,6 @@ const evolu = Evolu.createEvolu(deps)(Schema, {
4655
// in tests via the EvoluProvider.
4756
const useEvolu = createUseEvolu(evolu);
4857

49-
/**
50-
* Subscribe to Evolu errors (database, network, sync issues). These should not
51-
* happen in normal operation, so always log them for debugging. Show users a
52-
* friendly error message instead of technical details.
53-
*/
54-
evolu.subscribeError(() => {
55-
const error = evolu.getError();
56-
if (!error) return;
57-
58-
alert("🚨 Evolu error occurred! Check the console.");
59-
// eslint-disable-next-line no-console
60-
console.error(error);
61-
});
62-
6358
export const EvoluMinimalExample: FC = () => (
6459
<div className="min-h-screen px-8 py-8">
6560
<div className="mx-auto max-w-md">

0 commit comments

Comments
 (0)