Skip to content

Commit 8266080

Browse files
Merge remote-tracking branch 'origin/main' into node-download-extension
2 parents 326f33d + 688265f commit 8266080

Some content is hidden

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

59 files changed

+1009
-510
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@powersync/node': minor
3+
---
4+
5+
Experimental support for integrating with node:sqlite.

.changeset/khaki-years-design.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@powersync/node': minor
3+
---
4+
5+
Support custom better-sqlite3 forks (see an example for encryption in the README).

.changeset/ninety-bears-own.md

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

.changeset/sharp-pans-sniff.md

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

.changeset/wet-cooks-dress.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@powersync/node': minor
3+
---
4+
5+
Use upstream better-sqlite3 dependency instead of the PowerSync fork.
6+
7+
After upgrading:
8+
9+
1. Ensure you no longer depend on the `@powersync/better-sqlite3` package: `npm uninstall @powersync/better-sqlite3`.
10+
2. Unlike in older versions, the upstream `better-sqlite3` dependency is marked as optional since custom forks
11+
are supported too.
12+
Use `npm install better-sqlite3` to install it.

demos/angular-supabase-todolist/extra-webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = (config, options, targetOptions) => {
1818
...config.plugins,
1919
new webpack.DefinePlugin({
2020
// Embed environment variables starting with `WEBPACK_PUBLIC_`
21-
'process.env': JSON.stringify(
21+
env: JSON.stringify(
2222
Object.fromEntries(Object.entries(process.env).filter(([key]) => key.startsWith('WEBPACK_PUBLIC_')))
2323
)
2424
})

demos/angular-supabase-todolist/src/env.d.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const environment = {
2-
supabaseUrl: process.env.WEBPACK_PUBLIC_SUPABASE_URL,
3-
supabaseKey: process.env.WEBPACK_PUBLIC_SUPABASE_ANON_KEY,
4-
powersyncUrl: process.env.WEBPACK_PUBLIC_POWERSYNC_URL
2+
supabaseUrl: env.WEBPACK_PUBLIC_SUPABASE_URL,
3+
supabaseKey: env.WEBPACK_PUBLIC_SUPABASE_ANON_KEY,
4+
powersyncUrl: env.WEBPACK_PUBLIC_POWERSYNC_URL
55
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Ambient declarations for webpack-injected environment variables.
2+
// webpack's DefinePlugin injects `env` at build time.
3+
4+
declare global {
5+
const env: {
6+
WEBPACK_PUBLIC_SUPABASE_URL: string;
7+
WEBPACK_PUBLIC_SUPABASE_ANON_KEY: string;
8+
WEBPACK_PUBLIC_POWERSYNC_URL: string;
9+
};
10+
}
11+
12+
export {};

demos/example-electron-node/config.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import OS from 'node:os';
22
import path from 'node:path';
3-
import { createRequire } from 'node:module';
43

54
import type { ForgeConfig } from '@electron-forge/shared-types';
65
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
@@ -14,7 +13,7 @@ import * as dotenv from 'dotenv';
1413
import type IForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
1514
import type ICopyPlugin from 'copy-webpack-plugin';
1615

17-
dotenv.config({path: '.env.local'});
16+
dotenv.config({ path: '.env.local' });
1817

1918
const ForkTsCheckerWebpackPlugin: typeof IForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
2019
const CopyPlugin: typeof ICopyPlugin = require('copy-webpack-plugin');
@@ -78,25 +77,27 @@ const mainConfig: Configuration = {
7877
entry: './src/main/index.ts',
7978
// Put your normal webpack config below here
8079
module: {
81-
rules: defaultWebpackRules(),
80+
rules: defaultWebpackRules()
8281
},
8382
plugins: [
8483
...webpackPlugins,
8584
new CopyPlugin({
86-
patterns: [{
87-
from: path.resolve(require.resolve('@powersync/node/package.json'), `../lib/${extensionPath}`),
88-
to: path.join('powersync', extensionPath),
89-
}],
85+
patterns: [
86+
{
87+
from: path.resolve(require.resolve('@powersync/node/package.json'), `../lib/${extensionPath}`),
88+
to: path.join('powersync', extensionPath)
89+
}
90+
]
9091
}),
9192
new DefinePluginImpl({
9293
POWERSYNC_URL: JSON.stringify(process.env.POWERSYNC_URL),
93-
POWERSYNC_TOKEN: JSON.stringify(process.env.POWERSYNC_TOKEN),
94-
}),
94+
POWERSYNC_TOKEN: JSON.stringify(process.env.POWERSYNC_TOKEN)
95+
})
9596
],
9697
resolve: {
9798
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.json']
9899
},
99-
target: "electron-main",
100+
target: 'electron-main'
100101
};
101102

102103
const rendererConfig: Configuration = {
@@ -107,7 +108,7 @@ const rendererConfig: Configuration = {
107108
test: /\.css$/,
108109
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }]
109110
}
110-
],
111+
]
111112
},
112113
plugins: webpackPlugins,
113114
resolve: {
@@ -119,10 +120,10 @@ const config: ForgeConfig = {
119120
packagerConfig: {
120121
asar: {
121122
unpack: '**/{.**,**}/**/powersync/*'
122-
},
123+
}
123124
},
124125
rebuildConfig: {
125-
force: true,
126+
force: true
126127
},
127128
makers: [
128129
new MakerSquirrel(),
@@ -142,7 +143,7 @@ const config: ForgeConfig = {
142143
html: './src/render/index.html',
143144
js: './src/render/main.ts',
144145
preload: {
145-
js: './src/render/preload.ts',
146+
js: './src/render/preload.ts'
146147
}
147148
}
148149
]

0 commit comments

Comments
 (0)