1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 05:13:29 +00:00

[PM-3587] create @bitwarden/vault lib (#6083)

* add libs/vault

* update configs

* update package lock

* fix typo
This commit is contained in:
Will Martin
2023-08-22 10:02:48 -04:00
committed by GitHub
parent 019d4c2932
commit 5c576fd19e
20 changed files with 107 additions and 6 deletions

View File

@@ -3,12 +3,13 @@
"compilerOptions": {
"paths": {
"@bitwarden/angular/*": ["../angular/src/*"],
"@bitwarden/auth": ["../auth/src/*"],
"@bitwarden/auth": ["../auth/src"],
"@bitwarden/common/*": ["../common/src/*"],
"@bitwarden/components": ["../components/src"],
"@bitwarden/exporter/*": ["../exporter/src/*"],
"@bitwarden/importer": ["../importer/src"],
"@bitwarden/node/*": ["../node/src/*"]
"@bitwarden/node/*": ["../node/src/*"],
"@bitwarden/vault": ["../vault/src"]
}
}
}

3
libs/vault/README.md Normal file
View File

@@ -0,0 +1,3 @@
# Vault
This lib represents the public API of the Vault team at Bitwarden. Modules are imported using `@bitwarden/vault`.

16
libs/vault/jest.config.js Normal file
View File

@@ -0,0 +1,16 @@
const { pathsToModuleNameMapper } = require("ts-jest");
const { compilerOptions } = require("../shared/tsconfig.libs");
const sharedConfig = require("../../libs/shared/jest.config.angular");
/** @type {import('jest').Config} */
module.exports = {
...sharedConfig,
displayName: "libs/vault tests",
preset: "jest-preset-angular",
setupFilesAfterEnv: ["<rootDir>/test.setup.ts"],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, {
prefix: "<rootDir>/",
}),
};

20
libs/vault/package.json Normal file
View File

@@ -0,0 +1,20 @@
{
"name": "@bitwarden/vault",
"version": "0.0.0",
"description": "Common code used across Bitwarden JavaScript projects.",
"keywords": [
"bitwarden"
],
"author": "Bitwarden Inc.",
"homepage": "https://bitwarden.com",
"repository": {
"type": "git",
"url": "https://github.com/bitwarden/clients"
},
"license": "GPL-3.0",
"scripts": {
"clean": "rimraf dist",
"build": "npm run clean && tsc",
"build:watch": "npm run clean && tsc -watch"
}
}

0
libs/vault/src/index.ts Normal file
View File

28
libs/vault/test.setup.ts Normal file
View File

@@ -0,0 +1,28 @@
import { webcrypto } from "crypto";
import "jest-preset-angular/setup-jest";
Object.defineProperty(window, "CSS", { value: null });
Object.defineProperty(window, "getComputedStyle", {
value: () => {
return {
display: "none",
appearance: ["-webkit-appearance"],
};
},
});
Object.defineProperty(document, "doctype", {
value: "<!DOCTYPE html>",
});
Object.defineProperty(document.body.style, "transform", {
value: () => {
return {
enumerable: true,
configurable: true,
};
},
});
Object.defineProperty(window, "crypto", {
value: webcrypto,
});

5
libs/vault/tsconfig.json Normal file
View File

@@ -0,0 +1,5 @@
{
"extends": "../shared/tsconfig.libs",
"include": ["src", "spec"],
"exclude": ["node_modules", "dist"]
}

View File

@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"files": ["./test.setup.ts"]
}