mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-25569] Expose commercial sdk service to web clients (#16899)
* feat: enable commercial SDK usage on web * feat: enable commercial SDK usage in cli * feat: enable commercial SDK usage in browser * feat: add lint to restrict commercial sdk imports
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
"../../apps/browser/src/vault/content/*.ts",
|
||||
|
||||
"../../libs/common/src/autofill/constants",
|
||||
"../../libs/common/custom-matchers.d.ts"
|
||||
"../../libs/common/custom-matchers.d.ts",
|
||||
|
||||
"../../bitwarden_license/bit-common/src/platform/sdk/sdk-alias.d.ts"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
{
|
||||
"extends": "../../apps/cli/tsconfig"
|
||||
"extends": "../../apps/cli/tsconfig",
|
||||
"files": [
|
||||
"../../bitwarden_license/bit-common/src/platform/sdk/sdk-alias.d.ts",
|
||||
"../../bitwarden_license/bit-cli/src/bw.ts"
|
||||
]
|
||||
}
|
||||
|
||||
7
bitwarden_license/bit-common/src/platform/sdk/sdk-alias.d.ts
vendored
Normal file
7
bitwarden_license/bit-common/src/platform/sdk/sdk-alias.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
declare module "@bitwarden/sdk-internal" {
|
||||
// In `bit-*` clients the commercial sdk replaces the regular internal sdk,
|
||||
// this file creates an alias so that typescript understands that.
|
||||
// The actual replacement is done in the build system via webpack's resolve.alias.
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
export * from "@bitwarden/commercial-sdk-internal";
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"extends": "./tsconfig",
|
||||
"files": [
|
||||
"../../bitwarden_license/bit-common/src/platform/sdk/sdk-alias.d.ts",
|
||||
|
||||
"../../apps/web/src/polyfills.ts",
|
||||
"../../apps/web/src/main.ts",
|
||||
"../../apps/web/src/theme.ts",
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"extends": "../../apps/web/tsconfig",
|
||||
"files": [
|
||||
"../../bitwarden_license/bit-common/src/platform/sdk/sdk-alias.d.ts",
|
||||
|
||||
"../../apps/web/src/polyfills.ts",
|
||||
"../../apps/web/src/main.ts",
|
||||
"../../apps/web/src/theme.ts",
|
||||
|
||||
@@ -160,6 +160,11 @@ export default tseslint.config(
|
||||
// allow module index import
|
||||
except: ["**/state/index.ts"],
|
||||
},
|
||||
{
|
||||
target: ["libs/**/*"],
|
||||
from: ["apps/**/*"],
|
||||
message: "Libs should not import app-specific code.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
@@ -688,6 +693,12 @@ function buildNoRestrictedImports(additionalForbiddenPatterns = [], skipPlatform
|
||||
return [
|
||||
"error",
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
name: "@bitwarden/commercial-sdk-internal",
|
||||
message: "Use @bitwarden/sdk-internal instead.",
|
||||
},
|
||||
],
|
||||
patterns: [
|
||||
...(skipPlatform ? [] : ["**/platform/**/internal", "**/platform/messaging/**"]),
|
||||
"**/src/**/*", // Prevent relative imports across libs.
|
||||
|
||||
Reference in New Issue
Block a user