1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-28 02:43:04 +01:00

revert ts webpack since it breaks watching

This commit is contained in:
Kyle Spearrin 2018-04-06 23:20:53 -04:00
parent df4e7f030d
commit 02d299023c
4 changed files with 41 additions and 243 deletions

196
package-lock.json generated
View File

@ -178,40 +178,6 @@
"@types/filesystem": "0.0.28"
}
},
"@types/clean-css": {
"version": "3.4.30",
"resolved": "https://registry.npmjs.org/@types/clean-css/-/clean-css-3.4.30.tgz",
"integrity": "sha1-AFLBNvUkgAJCjjY4s33ko5gYZB0=",
"dev": true
},
"@types/clean-webpack-plugin": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/@types/clean-webpack-plugin/-/clean-webpack-plugin-0.1.2.tgz",
"integrity": "sha1-88nZfdOXqduGumubJFyg7t+I87I=",
"dev": true,
"requires": {
"@types/webpack": "3.8.11"
}
},
"@types/copy-webpack-plugin": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/@types/copy-webpack-plugin/-/copy-webpack-plugin-4.4.1.tgz",
"integrity": "sha1-sfzC1PnhP6xdQwvSpKVDEOAZ04Q=",
"dev": true,
"requires": {
"@types/minimatch": "3.0.3",
"@types/webpack": "3.8.11"
}
},
"@types/extract-text-webpack-plugin": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/extract-text-webpack-plugin/-/extract-text-webpack-plugin-3.0.2.tgz",
"integrity": "sha1-4+ypMIahy0LjmKS1rCjNYJ9vLzQ=",
"dev": true,
"requires": {
"@types/webpack": "3.8.11"
}
},
"@types/filesystem": {
"version": "0.0.28",
"resolved": "https://registry.npmjs.org/@types/filesystem/-/filesystem-0.0.28.tgz",
@ -227,27 +193,6 @@
"integrity": "sha1-wFTor02d11205jq8dviFFocU1LM=",
"dev": true
},
"@types/html-minifier": {
"version": "3.5.2",
"resolved": "https://registry.npmjs.org/@types/html-minifier/-/html-minifier-3.5.2.tgz",
"integrity": "sha1-+JehPYR6d06bb9kUl+mw4OrXHDU=",
"dev": true,
"requires": {
"@types/clean-css": "3.4.30",
"@types/relateurl": "0.2.28",
"@types/uglify-js": "3.0.1"
}
},
"@types/html-webpack-plugin": {
"version": "2.30.3",
"resolved": "https://registry.npmjs.org/@types/html-webpack-plugin/-/html-webpack-plugin-2.30.3.tgz",
"integrity": "sha1-hIurqONQEMbvbTawQXSCC52IRYM=",
"dev": true,
"requires": {
"@types/html-minifier": "3.5.2",
"@types/webpack": "3.8.11"
}
},
"@types/jasmine": {
"version": "2.8.6",
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.8.6.tgz",
@ -266,12 +211,6 @@
"integrity": "sha512-esk3CG25hRtHsVHm+LOjiSFYdw8be3uIY653WUwR43Bro914HSimPgPpqgajkhTJ0awK3RQfaIxP7zvbtCpcyg==",
"dev": true
},
"@types/minimatch": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
"integrity": "sha1-PcoOPzOyAPx9ETnAzZbBJoyt/Z0=",
"dev": true
},
"@types/node": {
"version": "8.0.19",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.19.tgz",
@ -290,12 +229,6 @@
"integrity": "sha512-8+d1hk3GgF+NJ6mMZZ5zKimqIOc+8OTzpLw4RQ8wnS1NkJh/dMH3NEhSud4Ituq2SGXJjOG6wIczCBAKsSsBdQ==",
"dev": true
},
"@types/relateurl": {
"version": "0.2.28",
"resolved": "https://registry.npmjs.org/@types/relateurl/-/relateurl-0.2.28.tgz",
"integrity": "sha1-a9p9uGU/piZD9e5p6facEaOS46Y=",
"dev": true
},
"@types/safari-extension": {
"version": "0.0.27",
"resolved": "https://registry.npmjs.org/@types/safari-extension/-/safari-extension-0.0.27.tgz",
@ -308,61 +241,18 @@
"integrity": "sha1-Y44W0a0ML8jFjj8ikT5hZxwU9BQ=",
"dev": true
},
"@types/tapable": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/@types/tapable/-/tapable-0.2.5.tgz",
"integrity": "sha512-dEoVvo/I9QFomyhY+4Q6Qk+I+dhG59TYceZgC6Q0mCifVPErx6Y83PNTKGDS5e9h9Eti6q0S2mm16BU6iQK+3w==",
"dev": true
},
"@types/tldjs": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/@types/tldjs/-/tldjs-1.7.1.tgz",
"integrity": "sha1-BdPvPLbgPPOt8eSgQ8FHDPIOF5k=",
"dev": true
},
"@types/uglify-js": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.0.1.tgz",
"integrity": "sha1-Z6xsaN6WO8FUDw8ZHoe2fYV0L9g=",
"dev": true,
"requires": {
"source-map": "0.6.1"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
}
},
"@types/webcrypto": {
"version": "0.0.28",
"resolved": "https://registry.npmjs.org/@types/webcrypto/-/webcrypto-0.0.28.tgz",
"integrity": "sha512-jzAoSUvqA+183nJO/Sc73CREQJsv+p77WJdn532GqA3YXQzlwRwHhClVa7U4O8iB2sJSR7G3v6f1mJFNkwA9YQ==",
"dev": true
},
"@types/webpack": {
"version": "3.8.11",
"resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-3.8.11.tgz",
"integrity": "sha512-6a+XQjFMAJekCE7IxkDavoX8cGCEmTE+MrKeUK4CL0Q7SL9w4c5TdrYrUEzcJx3GX3I0fTIC79x0C07Pi5VmlA==",
"dev": true,
"requires": {
"@types/node": "8.0.19",
"@types/tapable": "0.2.5",
"@types/uglify-js": "3.0.1",
"source-map": "0.6.1"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
}
},
"@uirouter/angularjs": {
"version": "1.0.15",
"resolved": "https://registry.npmjs.org/@uirouter/angularjs/-/angularjs-1.0.15.tgz",
@ -8834,12 +8724,6 @@
"pify": "3.0.0"
}
},
"make-error": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz",
"integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g==",
"dev": true
},
"make-iterator": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.0.tgz",
@ -13548,80 +13432,6 @@
}
}
},
"ts-node": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-5.0.1.tgz",
"integrity": "sha512-XK7QmDcNHVmZkVtkiwNDWiERRHPyU8nBqZB1+iv2UhOG0q3RQ9HsZ2CMqISlFbxjrYFGfG2mX7bW4dAyxBVzUw==",
"dev": true,
"requires": {
"arrify": "1.0.1",
"chalk": "2.3.2",
"diff": "3.4.0",
"make-error": "1.3.4",
"minimist": "1.2.0",
"mkdirp": "0.5.1",
"source-map-support": "0.5.4",
"yn": "2.0.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.3.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz",
"integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==",
"dev": true,
"requires": {
"ansi-styles": "3.2.1",
"escape-string-regexp": "1.0.5",
"supports-color": "5.3.0"
}
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
},
"source-map-support": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.4.tgz",
"integrity": "sha512-PETSPG6BjY1AHs2t64vS2aqAgu6dMIMXJULWFBGbh2Gr8nVLbCFDo6i/RMMvviIQ2h1Z8+5gQhVKSn2je9nmdg==",
"dev": true,
"requires": {
"source-map": "0.6.1"
}
},
"supports-color": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz",
"integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==",
"dev": true,
"requires": {
"has-flag": "3.0.0"
}
}
}
},
"tsickle": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.26.0.tgz",
@ -15099,12 +14909,6 @@
"integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=",
"dev": true
},
"yn": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz",
"integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=",
"dev": true
},
"zip-dir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/zip-dir/-/zip-dir-1.0.2.tgz",

View File

@ -9,8 +9,8 @@
"start:firefox": "web-ext run --source-dir ./dist/",
"dev": "gulp build && webpack --config webpack.dev.js",
"dev:watch": "gulp build && webpack --config webpack.dev.js --watch",
"dev2": "gulp build2 && env TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' webpack --config webpack.config.ts",
"dev2:watch": "gulp build2 && env TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' webpack --config webpack.config.ts --watch",
"dev2": "gulp build2 && webpack --config webpack.config.js",
"dev2:watch": "gulp build2 && webpack --config webpack.config.js --watch",
"prod": "gulp build && webpack --config webpack.prod.js",
"dist": "npm run prod && gulp dist",
"dist:firefox": "npm run prod && gulp dist:firefox",
@ -26,10 +26,6 @@
"@ngtools/webpack": "1.10.2",
"@types/angular": "^1.6.34",
"@types/chrome": "0.0.51",
"@types/clean-webpack-plugin": "^0.1.2",
"@types/copy-webpack-plugin": "^4.4.1",
"@types/extract-text-webpack-plugin": "^3.0.2",
"@types/html-webpack-plugin": "^2.30.3",
"@types/jasmine": "^2.8.2",
"@types/jquery": "^3.2.16",
"@types/lunr": "2.1.5",
@ -40,7 +36,6 @@
"@types/safari-extension-content": "^0.0.14",
"@types/tldjs": "1.7.1",
"@types/webcrypto": "^0.0.28",
"@types/webpack": "^3.8.11",
"angular": "1.6.9",
"angular-animate": "1.6.9",
"angular-sweetalert": "1.1.2",
@ -88,7 +83,6 @@
"sweetalert": "1.1.3",
"tldjs": "2.0.0",
"ts-loader": "^3.5.0",
"ts-node": "5.0.1",
"tslint": "^5.9.1",
"tslint-loader": "^3.5.3",
"typescript": "^2.7.1",

View File

@ -1,4 +1,4 @@
<html>
<html>
<head>
<meta charset="UTF-8">
</head>

View File

@ -1,26 +1,28 @@
import { AngularCompilerPlugin } from '@ngtools/webpack';
import * as ExtractTextPlugin from 'extract-text-webpack-plugin';
import * as CleanWebpackPlugin from 'clean-webpack-plugin';
import * as CopyWebpackPlugin from 'copy-webpack-plugin';
import * as HtmlWebpackPlugin from 'html-webpack-plugin';
import * as path from 'path';
import * as webpack from 'webpack';
const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
const isVendorModule: webpack.optimize.CommonsChunkPlugin.MinChunksFn = (module: any, count: number) => {
const isVendorModule = (module) => {
if (!module.context) {
return false;
}
return module.context.indexOf('node_modules') !== -1;
const nodeModule = module.context.indexOf('node_modules') !== -1;
const bitwardenModule = module.context.indexOf('@bitwarden') !== -1;
return nodeModule && !bitwardenModule;
};
const extractCss = new ExtractTextPlugin({
filename: '[name].css',
disable: false,
allChunks: true,
allChunks: true
});
const config: webpack.Configuration = {
module.exports = {
entry: {
'popup/main': './src/popup2/main.ts',
'background': './src/background.ts',
@ -37,26 +39,26 @@ const config: webpack.Configuration = {
jslib: path.join(__dirname, 'jslib/src'),
},
symlinks: false,
modules: [path.resolve('node_modules')],
modules: [path.resolve('node_modules')]
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'build2'),
path: path.resolve(__dirname, 'build2')
},
module: {
rules: [
{
test: /\.ts$/,
enforce: 'pre',
loader: 'tslint-loader',
loader: 'tslint-loader'
},
{
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
loader: '@ngtools/webpack',
loader: '@ngtools/webpack'
},
{
test: /\.(html)$/,
loader: 'html-loader',
loader: 'html-loader'
},
{
test: /.(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
@ -67,8 +69,8 @@ const config: webpack.Configuration = {
name: '[name].[ext]',
outputPath: 'popup/fonts/',
publicPath: './fonts/'
},
}],
}
}]
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
@ -79,8 +81,8 @@ const config: webpack.Configuration = {
name: '[name].[ext]',
outputPath: 'popup/images/',
publicPath: './images/'
},
}],
}
}]
},
{
test: /\.scss$/,
@ -93,69 +95,67 @@ const config: webpack.Configuration = {
loader: 'sass-loader',
}
],
publicPath: '../',
}),
publicPath: '../'
})
},
],
]
},
plugins: [
new CleanWebpackPlugin([
path.resolve(__dirname, 'build2/*'),
path.resolve(__dirname, 'build2/*')
]),
new AngularCompilerPlugin({
tsConfigPath: 'tsconfig.json',
entryModule: 'src/popup2/app.module#AppModule',
sourceMap: true,
sourceMap: true
}),
// ref: https://github.com/angular/angular/issues/20357
new webpack.ContextReplacementPlugin(
/\@angular(\\|\/)core(\\|\/)esm5/,
path.resolve(__dirname, './src'),
path.resolve(__dirname, './src')
),
new webpack.optimize.CommonsChunkPlugin({
name: 'popup/vendor',
chunks: ['popup/main'],
minChunks: isVendorModule,
minChunks: isVendorModule
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
chunks: ['background'],
minChunks: isVendorModule,
minChunks: isVendorModule
}),
new HtmlWebpackPlugin({
template: './src/popup2/index.html',
filename: 'popup/index.html',
chunks: ['popup/vendor', 'popup/main'],
chunks: ['popup/vendor', 'popup/main']
}),
new HtmlWebpackPlugin({
template: './src/background.html',
filename: 'background.html',
chunks: ['vendor', 'background'],
chunks: ['vendor', 'background']
}),
new HtmlWebpackPlugin({
template: './src/downloader/index.html',
filename: 'downloader/index.html',
chunks: ['downloader/downloader'],
chunks: ['downloader/downloader']
}),
new HtmlWebpackPlugin({
template: './src/2fa/index.html',
filename: '2fa/index.html',
chunks: ['2fa/2fa'],
chunks: ['2fa/2fa']
}),
new CopyWebpackPlugin([
{ from: './src/manifest.json', to: 'manifest.json' },
'./src/manifest.json',
{ from: './src/_locales', to: '_locales' },
{ from: './src/edge', to: 'edge' },
{ from: './src/safari', to: 'safari' },
{ from: './src/images', to: 'images' },
{ from: './src/content/autofill.css', to: 'content' },
{ from: './src/content/autofill.css', to: 'content' }
]),
new webpack.SourceMapDevToolPlugin({
filename: '[name].js.map',
include: ['popup/main.js', 'background.js'],
include: ['popup/main.js', 'background.js']
}),
extractCss,
extractCss
],
};
export default config;