-
Notifications
You must be signed in to change notification settings - Fork 58
React native web support via webpack #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
cb6dd00
wip
dylanvorster 86142ce
minor changes to get rn-sb-todo working.
Chriztiaan 3b3534f
Passing sourcemap flag to tsc instead of webpack. Added changesets en…
Chriztiaan c7f4088
Dev release of support packages.
Chriztiaan 77589b8
Multiplatform prompt support for creating lists and todos.
Chriztiaan e1b254b
Multiplatform alert/confirm support.
Chriztiaan c463e3b
Introduced multi platform alert and prompt implementations. Got stora…
Chriztiaan b5d0383
PoC with public path workers. Using separate webpack files.
Chriztiaan c9788f6
Nuked public dir
Chriztiaan 8335bd6
Moved workers back to their original dirs.
Chriztiaan 5e65431
Minor documentation for react-native-web. Cleaned up worker bundling …
Chriztiaan 8765494
Changed worker path flag to workers object that allows independent pa…
Chriztiaan 5ae3377
Using SqlOpenOptions instead of web-sql-flags to configure custom wor…
Chriztiaan 118a5a5
Merge branch 'main' into react-native-web-christiaan
Chriztiaan e4ee2b9
Changeset message.
Chriztiaan fa806be
Lock file.
Chriztiaan e3c76c3
Moved sharedSyncWorker config to a sync option on the web PowerSyncDa…
Chriztiaan e295b30
Merged shared and dedicated db worker into one worker file.
Chriztiaan 81ce61d
Fixed bson issue that was breaking single tab mode.
Chriztiaan 01ca78f
Passing flag options to worker factory method. Renamed webpack worker…
Chriztiaan e4f430f
WIP prod builds
Chriztiaan 835a19e
Updated copy-files script to target `public/@powersync`. Webpack now …
Chriztiaan cf0e1c7
Merge branch 'main' into react-native-web-christiaan
Chriztiaan a8073a7
Update changeset entry.
Chriztiaan a85856d
Git ignore rule for public/@powersync
Chriztiaan d06b14a
Dropped node copy script in favour of a bash copy command.
Chriztiaan 95a3562
Changed worker factory signature to return Worker or SharedWorker, in…
Chriztiaan de10a56
Updated /web package.json.
Chriztiaan cf56889
wip
Chriztiaan 2b74ae3
Worker factory method now takes in a wider set of options instead of …
Chriztiaan 927ac56
Updated readme to indicate use of options over flags in worker factor…
Chriztiaan dad54b3
Updated readme entry regarding environment setup.
Chriztiaan 4fb9087
E2E instructions to run the RN web demo
benitav 6d47461
Some light readme restructuring and polish
benitav 79ec0ac
fix heading hierarchy
benitav fee3d43
Wording polish of UMD target
benitav 322d37f
Moved away from Partial options for the worker factory method.
Chriztiaan 05bdacb
Merge branch 'react-native-web-christiaan' of github.com:powersync-ja…
Chriztiaan 537ab8f
Renamed "Require" interfaces to "Resolved.
Chriztiaan 0c4da76
Readme polish
benitav 97c285a
Simplify readme - migrate config instructions to docs
benitav ccc9a5c
Merge branch 'main' into react-native-web-christiaan
Chriztiaan 0b2b177
Using ResolvedWebSQLFlags instead of WebSQLFlags for ResolvedWebSQLOp…
Chriztiaan 22d6e66
Merge branch 'react-native-web-christiaan' of github.com:powersync-ja…
Chriztiaan 78f01a9
Add RN web demo to main Readme
benitav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'@powersync/attachments': patch | ||
'@powersync/common': patch | ||
'@powersync/kysely-driver': patch | ||
'@powersync/react': patch | ||
'@powersync/react-native': patch | ||
--- | ||
|
||
Added react-native-web support. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@powersync/web': patch | ||
--- | ||
|
||
Added react-native-web support. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const sourceDir = path.join(__dirname, 'node_modules', '@powersync', 'web', 'dist'); | ||
const destDir = path.join(__dirname, 'public'); | ||
|
||
function copyRecursiveSync(src, dest) { | ||
if (fs.existsSync(src) && fs.statSync(src).isDirectory()) { | ||
// Create the destination directory if it doesn't exist | ||
if (!fs.existsSync(dest)) { | ||
fs.mkdirSync(dest, { recursive: true }); | ||
} | ||
const files = fs.readdirSync(src); | ||
// Copy each file/directory | ||
files.forEach((file) => { | ||
const srcFile = path.join(src, file); | ||
const destFile = path.join(dest, file); | ||
if (fs.statSync(srcFile).isDirectory()) { | ||
copyRecursiveSync(srcFile, destFile); | ||
} else { | ||
fs.copyFileSync(srcFile, destFile); | ||
} | ||
}); | ||
} else { | ||
console.error(`Source directory ${src} does not exist or is not a directory.`); | ||
} | ||
} | ||
|
||
copyRecursiveSync(sourceDir, destDir); | ||
console.log(`Files copied from ${sourceDir} to ${destDir} successfully.`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
demos/react-native-supabase-todolist/library/powersync/AppSchema.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
demos/react-native-supabase-todolist/library/storage/FileSystem.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as ExpoFileSystem from 'expo-file-system'; | ||
import { Platform } from 'react-native'; | ||
|
||
class WebFileSystem { | ||
static documentDirectory = ''; | ||
|
||
static async getInfoAsync(...args: any[]): Promise<ExpoFileSystem.FileInfo> { | ||
return { | ||
exists: false, | ||
isDirectory: false, | ||
uri: '' | ||
}; | ||
} | ||
|
||
static async writeAsStringAsync(...args: any[]): Promise<void> { | ||
// No operation, mock implementation | ||
} | ||
|
||
static async readAsStringAsync(...args: any[]): Promise<string> { | ||
return ''; // Return an empty string as mock data | ||
} | ||
|
||
static async deleteAsync(...args: any[]): Promise<void> { | ||
// No operation, mock implementation | ||
} | ||
|
||
static async makeDirectoryAsync(...args: any[]): Promise<void> { | ||
// No operation, mock implementation | ||
} | ||
|
||
static async copyAsync(...args: any[]): Promise<void> { | ||
// No operation, mock implementation | ||
} | ||
} | ||
|
||
const isWeb = Platform.OS === 'web'; | ||
export const FileSystem = isWeb ? WebFileSystem : ExpoFileSystem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
demos/react-native-supabase-todolist/library/supabase/SupabaseConnector.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.