Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@iconify/vue": "^5.0.0",
"mermaid": "^11.13.0",
"mermaid": "^12.0.0",
"reka-ui": "^2.7.0",
"vitepress-plugin-group-icons": "^1.7.5",
"vitepress-plugin-llms": "^1.12.2",
Expand Down
135 changes: 100 additions & 35 deletions docs/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions ecosystem-ci/webdriverio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,60 @@ export async function prepareWebdriverioProject(
'{ timeout: 10000 }',
);

// Deleting client3 broadcasts a reconnect to client2 without awaiting it.
// Wait for client2 to recreate the OPFS file before checking its handle.
// Remove when upstream waits for the other client's asynchronous reconnect.
// Upstream test fixes: https://github.com/DallasHoff/sqlocal/pull/112
await replaceOnce(
join(root, 'test', 'delete-database-file.test.ts'),
`\t\t\t\tif (type === 'opfs') {
\t\t\t\t\tawait expect(opfs?.getFileHandle(path)).resolves.instanceOf(
\t\t\t\t\t\tFileSystemFileHandle
\t\t\t\t\t);
\t\t\t\t}

\t\t\t\tawait client2.destroy();`,
`\t\t\t\tif (type === 'opfs') {
\t\t\t\t\tawait vi.waitFor(async () => {
\t\t\t\t\t\tawait expect(opfs?.getFileHandle(path)).resolves.instanceOf(
\t\t\t\t\t\t\tFileSystemFileHandle
\t\t\t\t\t\t);
\t\t\t\t\t});
\t\t\t\t}

\t\t\t\tawait client2.destroy();`,
);

// This case exports two databases and overwrites one three times. Allow
// enough time for OPFS I/O instead of using the one-second suite default.
await replaceOnce(
join(root, 'test', 'overwrite-database-file.test.ts'),
"it('should replace the contents of a database', async () => {",
"it('should replace the contents of a database', { timeout: type === 'opfs' ? 5000 : undefined }, async () => {",
);

// A peer query can arrive after the close broadcast but before reconnect.
// Wait for the peer's overwrite notification before checking its onInit state.
// Remove these patches when upstream synchronizes the peer query.
await replaceOnce(
join(root, 'test', 'overwrite-database-file.test.ts'),
'const db2 = new SQLocal({ databasePath, onInit });',
`const onConnect = vi.fn();
\t\t\t\tconst db2 = new SQLocal({ databasePath, onInit, onConnect });`,
);
await replaceOnce(
join(root, 'test', 'overwrite-database-file.test.ts'),
`results.push(result3);
\t\t\t\tconst [{ foreign_keys: result4 }] = await db2.sql\`PRAGMA foreign_keys\`;`,
`results.push(result3);
\t\t\t\tif (type !== 'memory') {
\t\t\t\t\tawait vi.waitFor(() => {
\t\t\t\t\t\texpect(onConnect).toHaveBeenCalledWith('overwrite');
\t\t\t\t\t});
\t\t\t\t}
\t\t\t\tconst [{ foreign_keys: result4 }] = await db2.sql\`PRAGMA foreign_keys\`;`,
);

// Vitest 5's browser server does not run the SQLocal plugin's middleware.
// Keep the same isolation headers explicitly; OPFS tests assert isolation.
// Remove when the upstream plugin supports the separate browser server.
Expand Down
4 changes: 2 additions & 2 deletions packages/core/__tests__/build-artifacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ describe('build artifacts', () => {
});

it('bundles JavaScript Yuku packages and keeps the native parser external', async () => {
await init;
await init();
const tsdownDir = path.join(distDir, 'tsdown');
const imports = fs.readdirSync(tsdownDir).flatMap((file) => {
if (!file.endsWith('.js')) {
return [];
}
const [imports] = parse(fs.readFileSync(path.join(tsdownDir, file), 'utf8'));
return imports.map((entry) => entry.n);
return imports.map((entry) => entry.specifier);
});
expect(imports).toContain('yuku-parser');
expect(imports).not.toContain('yuku-ast');
Expand Down
3 changes: 1 addition & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@
"@tsdown/exe": "catalog:",
"@typescript/native-preview": "catalog:",
"@vitejs/devtools": "^0.7.6",
"es-module-lexer": "^1.7.0",
"es-module-lexer": "^3.0.0",
"hookable": "^6.0.1",
"magic-string": "^0.30.21",
"oxc-parser": "catalog:",
"oxfmt": "catalog:",
"picocolors": "catalog:",
Expand Down
Loading
Loading