Skip to content

Commit

Permalink
build: update webpack and babel (#1793)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasvh authored Apr 7, 2019
1 parent 7ebef72 commit 44f3d79
Show file tree
Hide file tree
Showing 8 changed files with 7,138 additions and 5,388 deletions.
13 changes: 11 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"plugins": ["transform-object-rest-spread"],
"presets": ["es2015", "flow"]
"presets": [[
"@babel/preset-env",
{
"targets": {
"ie": "9"
}
}
], "@babel/preset-flow"],
"plugins": [
"add-module-exports"
]
}
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[ignore]
.*/www/.*
.*/node_modules/@webassemblyjs/.*
[include]
[libs]
./flow-typed
Expand Down
12,448 changes: 7,093 additions & 5,355 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 14 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "dist/npm/index.js",
"module": "dist/html2canvas.js",
"browser": "dist/html2canvas.js",
"version": "1.0.0-alpha.13",
"version": "1.0.0-alpha.12",
"author": {
"name": "Niklas von Hertzen",
"email": "niklasvh@gmail.com",
Expand All @@ -22,22 +22,20 @@
"url": "https://github.com/niklasvh/html2canvas/issues"
},
"devDependencies": {
"babel-cli": "6.24.1",
"babel-core": "6.25.0",
"babel-eslint": "7.2.3",
"babel-loader": "7.1.1",
"babel-plugin-dev-expression": "0.2.1",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-es2015-modules-commonjs": "6.26.0",
"babel-plugin-transform-object-rest-spread": "6.23.0",
"babel-preset-es2015": "6.24.1",
"babel-preset-flow": "6.23.0",
"@babel/cli": "^7.4.3",
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@babel/preset-flow": "^7.0.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"babel-plugin-add-module-exports": "^1.0.0",
"babel-plugin-dev-expression": "^0.2.1",
"base64-arraybuffer": "0.1.5",
"body-parser": "^1.18.3",
"chai": "4.1.1",
"chromeless": "^1.5.2",
"cors": "2.8.4",
"eslint": "4.2.0",
"eslint": "^5.16.0",
"eslint-plugin-flowtype": "2.35.0",
"eslint-plugin-prettier": "2.1.2",
"express": "^4.16.4",
Expand All @@ -56,26 +54,22 @@
"karma-mocha": "^1.3.0",
"karma-safari-launcher": "^1.0.0",
"karma-sauce-launcher": "^2.0.2",
"mocha": "^6.0.2",
"mocha": "^6.1.0",
"platform": "1.3.4",
"prettier": "1.5.3",
"promise-polyfill": "6.0.2",
"replace-in-file": "^3.0.0",
"rimraf": "2.6.1",
"rollup": "0.57.1",
"rollup-plugin-babel": "^3.0.3",
"rollup-plugin-commonjs": "^9.1.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-uglify": "^3.0.0",
"serve-index": "^1.9.1",
"slash": "1.0.0",
"standard-version": "^5.0.2",
"uglifyjs-webpack-plugin": "^1.1.2",
"webpack": "3.4.1"
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0"
},
"scripts": {
"build": "rimraf dist/ && node scripts/create-reftest-list && npm run build:npm && npm run build:browser",
"build:npm": "babel src/ -d dist/npm/ --plugins=dev-expression,transform-es2015-modules-commonjs && replace-in-file __VERSION__ '\"$npm_package_version\"' dist/npm/index.js",
"build:npm": "babel src/ -d dist/npm/ --plugins=dev-expression && replace-in-file __VERSION__ '\"$npm_package_version\"' dist/npm/index.js",
"build:browser": "webpack",
"release": "standard-version",
"rollup": "rollup -c",
Expand Down
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,4 @@ const html2canvas = (element: HTMLElement, conf: ?Options): Promise<*> => {
};

html2canvas.CanvasRenderer = CanvasRenderer;

module.exports = html2canvas;
export default html2canvas;
4 changes: 1 addition & 3 deletions src/renderer/RefTestRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import type {TextBounds} from '../TextBounds';
import {TEXT_DECORATION_STYLE, TEXT_DECORATION_LINE} from '../parsing/textDecoration';
import {PATH} from '../drawing/Path';

class RefTestRenderer implements RenderTarget<string> {
export default class RefTestRenderer implements RenderTarget<string> {
options: RenderOptions;
indent: number;
lines: Array<string>;
Expand Down Expand Up @@ -268,5 +268,3 @@ class RefTestRenderer implements RenderTarget<string> {
this.lines.push(`${new Array(this.indent + 1).join(' ')}${text}`);
}
}

module.exports = RefTestRenderer;
2 changes: 1 addition & 1 deletion tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var REFTEST = window.location.search.indexOf('reftest') !== -1;
.concat([
'/node_modules/jquery/dist/jquery.min',
'/dist/html2canvas',
'/dist/RefTestRenderer'
'/build/RefTestRenderer'
])
.forEach(appendScript);

Expand Down
21 changes: 16 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const plugins = [
];

const modules = {
loaders: [{
rules: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
Expand All @@ -27,20 +27,26 @@ const modules = {

module.exports = [
{
mode: 'development',
entry: './src/index.js',
output: {
filename: './dist/html2canvas.js',
path: path.resolve(__dirname, 'dist'),
filename: 'html2canvas.js',
library: 'html2canvas',
libraryExport: 'default',
libraryTarget: 'umd'
},
module: modules,
plugins
},
{
mode: 'production',
entry: './src/index.js',
output: {
filename: './dist/html2canvas.min.js',
path: path.resolve(__dirname, 'dist'),
filename: 'html2canvas.min.js',
library: 'html2canvas',
libraryExport: 'default',
libraryTarget: 'umd'
},
module: modules,
Expand All @@ -54,19 +60,24 @@ module.exports = [
]
},
{
mode: 'production',
entry: './src/renderer/RefTestRenderer.js',
output: {
filename: './dist/RefTestRenderer.js',
path: path.resolve(__dirname, 'build'),
filename: 'RefTestRenderer.js',
library: 'RefTestRenderer',
libraryExport: 'default',
libraryTarget: 'umd'
},
module: modules,
plugins
},
{
mode: 'production',
entry: './tests/testrunner.js',
output: {
filename: './build/testrunner.js',
path: path.resolve(__dirname, 'build'),
filename: 'testrunner.js',
library: 'testrunner',
libraryTarget: 'umd'
},
Expand Down

0 comments on commit 44f3d79

Please sign in to comment.