-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix compiling errors; ditch webpack for vite
- Loading branch information
Showing
12 changed files
with
723 additions
and
119 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 |
---|---|---|
@@ -1,26 +1,41 @@ | ||
// @ts-ignore | ||
import { GSet, gset_create, gset_add, gset_merge } from "@topology-foundation/crdt/src/index.asc"; | ||
// if it can't compile, append src/index.asc to the import path on runtime | ||
import { GSet, gset_create, gset_add, gset_merge } from "@topology-foundation/crdt"; | ||
|
||
export class Chat { | ||
// store messages as strings in the format (timestamp, message, peerId) | ||
messages: GSet<string>; | ||
constructor() { | ||
this.messages = gset_create<string>(); | ||
} | ||
|
||
addMessage(timestamp: string, message: string, node_id: string): void { | ||
this.messages.add(`(${timestamp}, ${message}, ${node_id})`) | ||
} | ||
|
||
getMessages(): GSet<string> { | ||
return this.messages; | ||
} | ||
|
||
merge(other: Chat): void { | ||
this.messages.merge(other.messages); | ||
} | ||
} | ||
|
||
export function createChat(): Chat { | ||
return new Chat(); | ||
} | ||
|
||
// @ts-ignore | ||
export function addMessage(chat: Chat, timestamp: string, message: string, node_id: string): void { | ||
gset_add(chat.messages, `(${timestamp}, ${message}, ${node_id})`) | ||
} | ||
|
||
// @ts-ignore | ||
export function getMessages(chat: Chat): GSet<string> { | ||
return chat.messages; | ||
} | ||
|
||
// @ts-ignore | ||
export function merge(chat: Chat, other: Chat): void { | ||
gset_merge(chat.messages, other.messages); | ||
} |
This file contains 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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es6", | ||
"module": "ESNEXT", | ||
"rootDir": ".", | ||
"strict": true, | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"allowJs": true, | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"forceConsistentCasingInFileNames": true | ||
} | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"rootDir": ".", | ||
"strict": true, | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"allowJs": true, | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"forceConsistentCasingInFileNames": true | ||
} | ||
} |
This file contains 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,16 @@ | ||
import { defineConfig } from 'vite' | ||
import { nodePolyfills } from 'vite-plugin-node-polyfills' | ||
|
||
export default defineConfig({ | ||
build: { | ||
target: 'esnext', | ||
}, | ||
plugins: [ | ||
nodePolyfills(), | ||
], | ||
optimizeDeps: { | ||
esbuildOptions: { | ||
target: 'esnext' | ||
} | ||
}, | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains 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 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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
/* GSet with support for state and op changes */ | ||
|
||
export class GSet<T> { | ||
set: Set<T>; | ||
|
||
|
This file contains 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.