-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create service to load sdk on application init * Eagerly load CLI SDK * Remove wasm logging to api * Fix imports * Eagerly load Desktop renderer SDK Note: If the main process ever requires an SDK, we'll need to load it there, too. In that event, it's probably a good idea to move to IPC for all SDK functions to avoid loading the SDK for every window. * init wasm module from sdk load service * Use default client factory * Fix type imports * Resolve jest module import errors A CLI sdk load service that async imports our wasm binary doesn't seem to be needed to run, but jest isn't dealing with the ESM import properly. * Fix linting * remove example code
- Loading branch information
Showing
19 changed files
with
151 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import * as sdk from "@bitwarden/sdk-internal"; | ||
import * as wasm from "@bitwarden/sdk-internal/bitwarden_wasm_internal_bg.wasm.js"; | ||
|
||
(globalThis as any).init_sdk = (...args: ConstructorParameters<typeof sdk.BitwardenClient>) => { | ||
(sdk as any).init(wasm); | ||
import { GlobalWithWasmInit } from "./browser-sdk-load.service"; | ||
|
||
return new sdk.BitwardenClient(...args); | ||
(globalThis as GlobalWithWasmInit).initSdk = () => { | ||
(sdk as any).init(wasm); | ||
}; |
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,8 +1,8 @@ | ||
import * as sdk from "@bitwarden/sdk-internal"; | ||
import * as wasm from "@bitwarden/sdk-internal/bitwarden_wasm_internal_bg.wasm"; | ||
|
||
(globalThis as any).init_sdk = (...args: ConstructorParameters<typeof sdk.BitwardenClient>) => { | ||
(sdk as any).init(wasm); | ||
import { GlobalWithWasmInit } from "./browser-sdk-load.service"; | ||
|
||
return new sdk.BitwardenClient(...args); | ||
(globalThis as GlobalWithWasmInit).initSdk = () => { | ||
(sdk as any).init(wasm); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { SdkLoadService } from "@bitwarden/common/platform/abstractions/sdk/sdk-load.service"; | ||
import * as sdk from "@bitwarden/sdk-internal"; | ||
|
||
export class CliSdkLoadService implements SdkLoadService { | ||
async load(): Promise<void> { | ||
const module = await import("@bitwarden/sdk-internal/bitwarden_wasm_internal_bg.wasm"); | ||
(sdk as any).init(module); | ||
} | ||
} |
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
Oops, something went wrong.