1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-22 11:45:59 +01:00

convert to ngtools/webpack for aot compilation

This commit is contained in:
Kyle Spearrin 2018-04-06 12:25:22 -04:00
parent 86226990ee
commit e27b2a7a53
28 changed files with 185 additions and 69 deletions

2
jslib

@ -1 +1 @@
Subproject commit db83cab552296c609bc3dc6841070ec7fa231818
Subproject commit 69afd7923ba13cd1248425ae142fad69437167cb

156
package-lock.json generated
View File

@ -60,6 +60,26 @@
"tslib": "1.8.1"
}
},
"@angular/compiler-cli": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-5.2.0.tgz",
"integrity": "sha512-+Kef4NjuHwLj2hRPdVo4yAtPmv+kn0Nu/ShmKfaEK4mt9aaQMFxKNt6beUuDK5iUPMB5nuTCZ4bqEFpqd+EtxQ==",
"dev": true,
"requires": {
"chokidar": "1.7.0",
"minimist": "1.2.0",
"reflect-metadata": "0.1.12",
"tsickle": "0.26.0"
},
"dependencies": {
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true
}
}
},
"@angular/core": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/@angular/core/-/core-5.2.0.tgz",
@ -116,6 +136,70 @@
"tslib": "1.8.1"
}
},
"@ngtools/webpack": {
"version": "1.10.2",
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-1.10.2.tgz",
"integrity": "sha512-3u2zg2rarG3qNLSukBClGADWuq/iNn5SQtlSeAbfKzwBeyLGbF0gN1z1tVx1Bcr8YwFzR6NdRePQmJGcoqq1fg==",
"dev": true,
"requires": {
"chalk": "2.2.2",
"enhanced-resolve": "3.4.1",
"loader-utils": "1.1.0",
"magic-string": "0.22.5",
"semver": "5.5.0",
"source-map": "0.5.7",
"tree-kill": "1.2.0",
"webpack-sources": "1.1.0"
},
"dependencies": {
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": {
"color-convert": "1.9.1"
}
},
"chalk": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.2.2.tgz",
"integrity": "sha512-LvixLAQ4MYhbf7hgL4o5PeK32gJKvVzDRiSNIApDofQvyhl8adgG2lJVXn4+ekQoK7HL9RF8lqxwerpe0x2pCw==",
"dev": true,
"requires": {
"ansi-styles": "3.2.1",
"escape-string-regexp": "1.0.5",
"supports-color": "4.5.0"
}
},
"has-flag": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
"integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
"dev": true
},
"loader-utils": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz",
"integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=",
"dev": true,
"requires": {
"big.js": "3.2.0",
"emojis-list": "2.1.0",
"json5": "0.5.1"
}
},
"supports-color": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
"integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
"dev": true,
"requires": {
"has-flag": "2.0.0"
}
}
}
},
"@types/keytar": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/keytar/-/keytar-4.0.1.tgz",
@ -129,9 +213,9 @@
"dev": true
},
"@types/node": {
"version": "8.9.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.9.0.tgz",
"integrity": "sha512-LVPrm5uzrma9ThwNiCgXWtsiXgPgUyEBzJJUJ8zcY0z/Dfdwa1mZ6PR51/mTKourRKnpEx/gwDHYUiY0Z/Juzg==",
"version": "8.0.19",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.19.tgz",
"integrity": "sha512-VRQB+Q0L3YZWs45uRdpN9oWr82meL/8TrJ6faoKT5tp0uub2l/aRMhtm5fo68h7kjYKH60f9/bay1nF7ZpTW5g==",
"dev": true
},
"@types/node-forge": {
@ -2326,9 +2410,17 @@
"integrity": "sha512-0TV5Hy92g8ACnPn+PVol6a/2uk+khzmRtWxhah/FcKs6StCytm5hD14QqOdZxEdJN8HljXIVCayN/wJX+0wDiQ==",
"dev": true,
"requires": {
"@types/node": "8.9.0",
"@types/node": "8.10.2",
"electron-download": "3.3.0",
"extract-zip": "1.6.6"
},
"dependencies": {
"@types/node": {
"version": "8.10.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.2.tgz",
"integrity": "sha512-A6Uv1anbsCvrRDtaUXS2xZ5tlzD+Kg7yMRlSLFDy3z0r7KlGXDzL14vELXIAgpk2aJbU3XeZZQRcEkLkowT92g==",
"dev": true
}
}
},
"electron-builder": {
@ -5880,6 +5972,15 @@
"integrity": "sha1-WQTcU3w57G2+/q6QIycTX6hRHxI=",
"dev": true
},
"magic-string": {
"version": "0.22.5",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.22.5.tgz",
"integrity": "sha512-oreip9rJZkzvA8Qzk9HFs8fZGF/u7H/gtrE8EN6RjKJ9kh2HlC+yQ2QezifqTZfGyiuAV0dRv5a+y/8gBb1m9w==",
"dev": true,
"requires": {
"vlq": "0.2.3"
}
},
"make-dir": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.1.0.tgz",
@ -8201,6 +8302,12 @@
}
}
},
"reflect-metadata": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.12.tgz",
"integrity": "sha512-n+IyV+nGz3+0q3/Yf1ra12KpCyi001bi4XFxSjbiWWjfqb52iTTtpGXmCCAOWWIAn9KEuFZKGqBERHmrtScZ3A==",
"dev": true
},
"regenerate": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.3.tgz",
@ -9439,6 +9546,12 @@
"punycode": "1.4.1"
}
},
"tree-kill": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.0.tgz",
"integrity": "sha512-DlX6dR0lOIRDFxI0mjL9IYg6OTncLm/Zt+JiBhE5OlFcAR8yc9S7FFXU9so0oda47frdM/JFsk7UjNt9vscKcg==",
"dev": true
},
"trim-newlines": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz",
@ -9736,6 +9849,35 @@
}
}
},
"tsickle": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.26.0.tgz",
"integrity": "sha512-eWJ2CUfttGK0LqF9iJ/Avnxbj4M+fCyJ50Zag3wm73Fut1hsasPRHKxKdrMWVj4BMHnQNx7TO+DdNmLmJTSuNw==",
"dev": true,
"requires": {
"minimist": "1.2.0",
"mkdirp": "0.5.1",
"source-map": "0.5.7",
"source-map-support": "0.4.18"
},
"dependencies": {
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true
},
"source-map-support": {
"version": "0.4.18",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz",
"integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==",
"dev": true,
"requires": {
"source-map": "0.5.7"
}
}
}
},
"tslib": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.1.tgz",
@ -10337,6 +10479,12 @@
"extsprintf": "1.3.0"
}
},
"vlq": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz",
"integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==",
"dev": true
},
"vm-browserify": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz",

View File

@ -177,8 +177,11 @@
}
},
"devDependencies": {
"@angular/compiler-cli": "5.2.0",
"@ngtools/webpack": "1.10.2",
"@types/keytar": "^4.0.1",
"@types/lunr": "2.1.5",
"@types/node": "8.0.19",
"@types/node-forge": "0.7.1",
"@types/webcrypto": "0.0.28",
"clean-webpack-plugin": "^0.1.17",

View File

@ -1,5 +1,3 @@
import * as template from './environment.component.html';
import { Component } from '@angular/core';
import { ToasterService } from 'angular2-toaster';
@ -12,7 +10,7 @@ import { EnvironmentComponent as BaseEnvironmentComponent } from 'jslib/angular/
@Component({
selector: 'app-environment',
template: template,
templateUrl: 'environment.component.html',
})
export class EnvironmentComponent extends BaseEnvironmentComponent {
constructor(analytics: Angulartics2, toasterService: ToasterService,

View File

@ -1,5 +1,3 @@
import * as template from './hint.component.html';
import { Component } from '@angular/core';
import { Router } from '@angular/router';
@ -13,7 +11,7 @@ import { HintComponent as BaseHintComponent } from 'jslib/angular/components/hin
@Component({
selector: 'app-hint',
template: template,
templateUrl: 'hint.component.html',
})
export class HintComponent extends BaseHintComponent {
constructor(router: Router, analytics: Angulartics2,

View File

@ -1,5 +1,3 @@
import * as template from './lock.component.html';
import { Component } from '@angular/core';
import { Router } from '@angular/router';
@ -16,7 +14,7 @@ import { LockComponent as BaseLockComponent } from 'jslib/angular/components/loc
@Component({
selector: 'app-lock',
template: template,
templateUrl: 'lock.component.html',
})
export class LockComponent extends BaseLockComponent {
constructor(router: Router, analytics: Angulartics2,

View File

@ -1,5 +1,3 @@
import * as template from './login.component.html';
import {
Component,
ComponentFactoryResolver,
@ -22,7 +20,7 @@ import { LoginComponent as BaseLoginComponent } from 'jslib/angular/components/l
@Component({
selector: 'app-login',
template: template,
templateUrl: 'login.component.html',
})
export class LoginComponent extends BaseLoginComponent {
@ViewChild('environment', { read: ViewContainerRef }) environmentModal: ViewContainerRef;

View File

@ -1,5 +1,3 @@
import * as template from './premium.component.html';
import {
Component,
OnInit,
@ -15,7 +13,7 @@ import { TokenService } from 'jslib/abstractions/token.service';
@Component({
selector: 'app-premium',
template: template,
templateUrl: 'premium.component.html',
})
export class PremiumComponent implements OnInit {
isPremium: boolean = false;

View File

@ -1,5 +1,3 @@
import * as template from './register.component.html';
import { Component } from '@angular/core';
import { Router } from '@angular/router';
@ -15,7 +13,7 @@ import { RegisterComponent as BaseRegisterComponent } from 'jslib/angular/compon
@Component({
selector: 'app-register',
template: template,
templateUrl: 'register.component.html',
})
export class RegisterComponent extends BaseRegisterComponent {
constructor(authService: AuthService, router: Router,

View File

@ -1,5 +1,3 @@
import * as template from './settings.component.html';
import {
Component,
OnInit,
@ -19,7 +17,7 @@ import { ConstantsService } from 'jslib/services/constants.service';
@Component({
selector: 'app-settings',
template: template,
templateUrl: 'settings.component.html',
})
export class SettingsComponent implements OnInit {
lockOptions: any[];

View File

@ -1,5 +1,3 @@
import * as template from './two-factor-options.component.html';
import { Component, } from '@angular/core';
import { Router } from '@angular/router';
@ -16,7 +14,7 @@ import {
@Component({
selector: 'app-two-factor-options',
template: template,
templateUrl: 'two-factor-options.component.html',
})
export class TwoFactorOptionsComponent extends BaseTwoFactorOptionsComponent {
constructor(authService: AuthService, router: Router,

View File

@ -1,5 +1,3 @@
import * as template from './two-factor.component.html';
import {
Component,
ComponentFactoryResolver,
@ -29,7 +27,7 @@ import { TwoFactorComponent as BaseTwoFactorComponent } from 'jslib/angular/comp
@Component({
selector: 'app-two-factor',
template: template,
templateUrl: 'two-factor.component.html',
})
export class TwoFactorComponent extends BaseTwoFactorComponent {
@ViewChild('twoFactorOptions', { read: ViewContainerRef }) twoFactorOptionsModal: ViewContainerRef;

1
src/app/app.d.ts vendored
View File

@ -1 +0,0 @@
declare module '*.html';

View File

@ -1,5 +1,3 @@
import * as template from './modal.component.html';
import {
Component,
ComponentFactoryResolver,

View File

@ -109,7 +109,7 @@ environmentService.setUrlsFromStorage().then(() => {
return syncService.fullSync(true);
});
function initFactory(): Function {
export function initFactory(): Function {
return async () => {
await i18nService.init();
await authService.init();

View File

@ -1,5 +1,3 @@
import * as template from './add-edit.component.html';
import {
Component,
OnChanges,
@ -18,7 +16,7 @@ import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/componen
@Component({
selector: 'app-vault-add-edit',
template: template,
templateUrl: 'add-edit.component.html',
})
export class AddEditComponent extends BaseAddEditComponent implements OnChanges {
constructor(cipherService: CipherService, folderService: FolderService,

View File

@ -1,5 +1,3 @@
import * as template from './attachments.component.html';
import { Component } from '@angular/core';
import { ToasterService } from 'angular2-toaster';
@ -15,7 +13,7 @@ import { AttachmentsComponent as BaseAttachmentsComponent } from 'jslib/angular/
@Component({
selector: 'app-vault-attachments',
template: template,
templateUrl: 'attachments.component.html',
})
export class AttachmentsComponent extends BaseAttachmentsComponent {
constructor(cipherService: CipherService, analytics: Angulartics2,

View File

@ -1,5 +1,3 @@
import * as template from './ciphers.component.html';
import { Component } from '@angular/core';
import { CipherService } from 'jslib/abstractions/cipher.service';
@ -8,7 +6,7 @@ import { CiphersComponent as BaseCiphersComponent } from 'jslib/angular/componen
@Component({
selector: 'app-vault-ciphers',
template: template,
templateUrl: 'ciphers.component.html',
})
export class CiphersComponent extends BaseCiphersComponent {
constructor(cipherService: CipherService) {

View File

@ -1,5 +1,3 @@
import * as template from './folder-add-edit.component.html';
import {
Component,
EventEmitter,
@ -19,7 +17,7 @@ import { FolderView } from 'jslib/models/view/folderView';
@Component({
selector: 'app-folder-add-edit',
template: template,
templateUrl: 'folder-add-edit.component.html',
})
export class FolderAddEditComponent implements OnInit {
@Input() folderId: string;

View File

@ -1,5 +1,3 @@
import * as template from './groupings.component.html';
import { Component } from '@angular/core';
import { CollectionService } from 'jslib/abstractions/collection.service';
@ -9,7 +7,7 @@ import { GroupingsComponent as BaseGroupingsComponent } from 'jslib/angular/comp
@Component({
selector: 'app-vault-groupings',
template: template,
templateUrl: 'groupings.component.html',
})
export class GroupingsComponent extends BaseGroupingsComponent {
constructor(collectionService: CollectionService, folderService: FolderService) {

View File

@ -1,5 +1,3 @@
import * as template from './password-generator-history.component.html';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
@ -15,7 +13,7 @@ import {
@Component({
selector: 'app-password-generator-history',
template: template,
templateUrl: 'password-generator-history.component.html',
})
export class PasswordGeneratorHistoryComponent extends BasePasswordGeneratorHistoryComponent {
constructor(passwordGenerationService: PasswordGenerationService, analytics: Angulartics2,

View File

@ -6,7 +6,7 @@
<div class="box">
<div class="box-content condensed">
<a class="box-content-row" href="#" appStopClick appBlurClick
(click)="regenerate(true)">
(click)="regenerate()">
<i class="fa fa-fw fa-refresh"></i> {{'regeneratePassword' | i18n}}
</a>
<a class="box-content-row" href="#" appStopClick appBlurClick

View File

@ -1,5 +1,3 @@
import * as template from './password-generator.component.html';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
@ -19,7 +17,7 @@ import {
@Component({
selector: 'app-password-generator',
template: template,
templateUrl: 'password-generator.component.html',
})
export class PasswordGeneratorComponent extends BasePasswordGeneratorComponent {
constructor(passwordGenerationService: PasswordGenerationService, analytics: Angulartics2,

View File

@ -13,7 +13,7 @@
(onCipherClicked)="viewCipher($event)"
(onCipherRightClicked)="viewCipherMenu($event)"
(onAddCipher)="addCipher($event)"
(onAddCipherOptions)="addCipherOptions($event)">
(onAddCipherOptions)="addCipherOptions()">
</app-vault-ciphers>
<app-vault-view id="details"
*ngIf="cipherId && action === 'view'"

View File

@ -1,5 +1,3 @@
import * as template from './vault.component.html';
import { remote } from 'electron';
import { Location } from '@angular/common';
@ -48,7 +46,7 @@ const BroadcasterSubscriptionId = 'VaultComponent';
@Component({
selector: 'app-vault',
template: template,
templateUrl: 'vault.component.html',
})
export class VaultComponent implements OnInit, OnDestroy {
@ViewChild(AddEditComponent) addEditComponent: AddEditComponent;

View File

@ -1,5 +1,3 @@
import * as template from './view.component.html';
import {
Component,
OnChanges,
@ -20,7 +18,7 @@ import { ViewComponent as BaseViewComponent } from 'jslib/angular/components/vie
@Component({
selector: 'app-vault-view',
template: template,
templateUrl: 'view.component.html',
})
export class ViewComponent extends BaseViewComponent implements OnChanges {
constructor(cipherService: CipherService, totpService: TotpService,

1
src/global.d.ts vendored
View File

@ -1,3 +1,2 @@
declare function require(s: string): any;
declare function escape(s: string): string;
declare function unescape(s: string): string;

View File

@ -4,6 +4,7 @@ const merge = require('webpack-merge');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const GoogleFontsPlugin = require("google-fonts-webpack-plugin");
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
const isVendorModule = (module) => {
if (!module.context) {
@ -30,9 +31,8 @@ const common = {
loader: 'tslint-loader'
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules\/(?!(@bitwarden)\/).*/
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
loader: '@ngtools/webpack'
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
@ -118,6 +118,11 @@ const renderer = {
path: 'fonts/',
filename: 'css/fonts.css'
}),
new AngularCompilerPlugin({
tsConfigPath: 'tsconfig.json',
entryModule: 'src/app/app.module#AppModule',
sourceMap: true
}),
// ref: https://github.com/angular/angular/issues/20357
new webpack.ContextReplacementPlugin(
/\@angular(\\|\/)core(\\|\/)esm5/,