Skip to content

Commit 2f56a61

Browse files
committed
Merge remote-tracking branch 'origin/main' into pnpm10
2 parents 51330df + f9e2e9c commit 2f56a61

File tree

73 files changed

+2925
-381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2925
-381
lines changed

.changeset/nasty-pugs-brake.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

.changeset/wicked-wolves-greet.md

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { describe, expect, it, vi } from 'vitest';
2+
import { setupTestDOM } from './test-setup.js';
3+
4+
describe('Customer List E2E', () => {
5+
it('should display the inserted customer "Fred" in the HTML list', async () => {
6+
// Set up the DOM structure for testing
7+
setupTestDOM();
8+
9+
// Import the main script which will execute and populate the DOM
10+
await import('../src/index.js');
11+
12+
// Trigger DOMContentLoaded if needed (script listens for this)
13+
if (document.readyState === 'complete' || document.readyState === 'interactive') {
14+
document.dispatchEvent(new Event('DOMContentLoaded'));
15+
}
16+
17+
// Wait for the customer list to appear and contain "Fred" using vi.waitFor
18+
await vi.waitFor(() => {
19+
const customersList = document.getElementById('customers-list');
20+
expect(customersList).not.toBeNull();
21+
22+
const listItems = customersList.querySelectorAll('li');
23+
const customerNames = Array.from(listItems).map((li) => li.textContent);
24+
expect(customerNames).toContain('Fred');
25+
});
26+
});
27+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Test setup: Creates the DOM structure needed for tests
3+
* This mimics the structure in index.html
4+
*/
5+
export function setupTestDOM() {
6+
// Set up the HTML structure to match index.html
7+
document.body.innerHTML = `
8+
<h1>Vite bundling test: Check the console to see it in action!</h1>
9+
<h2>Customers:</h2>
10+
<ul id="customers-list"></ul>
11+
`;
12+
}

demos/example-vite/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"build": "vite build",
99
"preview": "vite preview",
1010
"start": "pnpm build && pnpm preview",
11-
"test:build": "pnpm build"
11+
"prepare:isolated:test": "pnpm exec playwright install ",
12+
"test:build": "pnpm build && vitest run"
1213
},
1314
"dependencies": {
1415
"@powersync/web": "workspace:*"
@@ -17,6 +18,9 @@
1718
"@swc/core": "catalog:",
1819
"vite": "catalog:",
1920
"vite-plugin-top-level-await": "catalog:",
20-
"vite-plugin-wasm": "catalog:"
21+
"vite-plugin-wasm": "catalog:",
22+
"@vitest/browser": "catalog:",
23+
"playwright": "catalog:",
24+
"vitest": "catalog:"
2125
}
2226
}

demos/example-vite/src/index.html

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
<!doctype html>
22
<html>
3-
<head>
4-
<script type="module" src="./index.js"></script>
5-
</head>
6-
<body>
7-
Vite bundling test: Check the console to see it in action!
8-
</body>
9-
</html>
3+
4+
<head>
5+
<script type="module" src="./index.js"></script>
6+
</head>
7+
8+
<body>
9+
<h1>Vite bundling test: Check the console to see it in action!</h1>
10+
<h2>Customers:</h2>
11+
<ul id="customers-list"></ul>
12+
</body>
13+
14+
</html>

demos/example-vite/src/index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { column, Schema, Table, PowerSyncDatabase, createBaseLogger } from '@powersync/web';
1+
import { PowerSyncDatabase, Schema, Table, column, createBaseLogger } from '@powersync/web';
22

33
createBaseLogger().useDefaults();
44

@@ -38,6 +38,19 @@ const openDatabase = async () => {
3838
const result = await PowerSync.getAll('SELECT * FROM customers');
3939
console.log('contents of customers: ', result);
4040

41+
// Display customers in the HTML list
42+
const customersList = document.getElementById('customers-list');
43+
if (customersList) {
44+
// Clear existing list items
45+
customersList.textContent = '';
46+
// Create and append list items
47+
result.forEach((customer) => {
48+
const listItem = document.createElement('li');
49+
listItem.textContent = customer.name || 'Unknown';
50+
customersList.appendChild(listItem);
51+
});
52+
}
53+
4154
console.log(
4255
`Attempting to connect in order to verify web workers are correctly loaded.
4356
This doesn't use any actual network credentials.

demos/example-vite/vite.config.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import wasm from 'vite-plugin-wasm';
2-
import topLevelAwait from 'vite-plugin-top-level-await';
31
import { defineConfig } from 'vite';
2+
import topLevelAwait from 'vite-plugin-top-level-await';
3+
import wasm from 'vite-plugin-wasm';
44

55
// https://vitejs.dev/config/
66
export default defineConfig({
@@ -22,5 +22,21 @@ export default defineConfig({
2222
worker: {
2323
format: 'es',
2424
plugins: () => [wasm(), topLevelAwait()]
25+
},
26+
test: {
27+
globals: true,
28+
include: ['../e2e/**/*.test.js'],
29+
maxConcurrency: 1,
30+
browser: {
31+
enabled: true,
32+
isolate: true,
33+
provider: 'playwright',
34+
headless: true,
35+
instances: [
36+
{
37+
browser: 'chromium'
38+
}
39+
]
40+
}
2541
}
2642
});

demos/react-supabase-todolist-tanstackdb/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@mui/x-data-grid": "catalog:",
1818
"@powersync/react": "workspace:*",
1919
"@powersync/web": "workspace:*",
20+
"@powersync/common": "workspace:*",
2021
"@supabase/supabase-js": "catalog:",
2122
"@tanstack/db": "catalog:",
2223
"@tanstack/powersync-db-collection": "catalog:",

packages/adapter-sql-js/CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
# @powersync/adapter-sql-js
22

3+
## 0.0.13
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [9b82867]
8+
- @powersync/common@1.43.1
9+
10+
## 0.0.12
11+
12+
### Patch Changes
13+
14+
- Updated dependencies [507197f]
15+
- @powersync/common@1.43.0
16+
17+
## 0.0.11
18+
19+
### Patch Changes
20+
21+
- Updated dependencies [66218b2]
22+
- Updated dependencies [3af4a2c]
23+
- @powersync/common@1.42.0
24+
25+
## 0.0.10
26+
27+
### Patch Changes
28+
29+
- 3e4a25c: Don't minify releases, enable source maps.
30+
- Updated dependencies [3e4a25c]
31+
- @powersync/common@1.41.1
32+
333
## 0.0.9
434

535
### Patch Changes

0 commit comments

Comments
 (0)