build: update webpack and babel (#1793)

This commit is contained in:
Niklas von Hertzen 2019-04-07 14:24:17 -07:00 committed by GitHub
parent 7ebef72e92
commit 44f3d79f68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 5590 additions and 3840 deletions

View File

@ -1,4 +1,13 @@
{ {
"plugins": ["transform-object-rest-spread"], "presets": [[
"presets": ["es2015", "flow"] "@babel/preset-env",
{
"targets": {
"ie": "9"
}
}
], "@babel/preset-flow"],
"plugins": [
"add-module-exports"
]
} }

View File

@ -1,5 +1,6 @@
[ignore] [ignore]
.*/www/.* .*/www/.*
.*/node_modules/@webassemblyjs/.*
[include] [include]
[libs] [libs]
./flow-typed ./flow-typed

9352
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
"main": "dist/npm/index.js", "main": "dist/npm/index.js",
"module": "dist/html2canvas.js", "module": "dist/html2canvas.js",
"browser": "dist/html2canvas.js", "browser": "dist/html2canvas.js",
"version": "1.0.0-alpha.13", "version": "1.0.0-alpha.12",
"author": { "author": {
"name": "Niklas von Hertzen", "name": "Niklas von Hertzen",
"email": "niklasvh@gmail.com", "email": "niklasvh@gmail.com",
@ -22,22 +22,20 @@
"url": "https://github.com/niklasvh/html2canvas/issues" "url": "https://github.com/niklasvh/html2canvas/issues"
}, },
"devDependencies": { "devDependencies": {
"babel-cli": "6.24.1", "@babel/cli": "^7.4.3",
"babel-core": "6.25.0", "@babel/core": "^7.4.3",
"babel-eslint": "7.2.3", "@babel/preset-env": "^7.4.3",
"babel-loader": "7.1.1", "@babel/preset-flow": "^7.0.0",
"babel-plugin-dev-expression": "0.2.1", "babel-eslint": "^10.0.1",
"babel-plugin-external-helpers": "^6.22.0", "babel-loader": "^8.0.5",
"babel-plugin-transform-es2015-modules-commonjs": "6.26.0", "babel-plugin-add-module-exports": "^1.0.0",
"babel-plugin-transform-object-rest-spread": "6.23.0", "babel-plugin-dev-expression": "^0.2.1",
"babel-preset-es2015": "6.24.1",
"babel-preset-flow": "6.23.0",
"base64-arraybuffer": "0.1.5", "base64-arraybuffer": "0.1.5",
"body-parser": "^1.18.3", "body-parser": "^1.18.3",
"chai": "4.1.1", "chai": "4.1.1",
"chromeless": "^1.5.2", "chromeless": "^1.5.2",
"cors": "2.8.4", "cors": "2.8.4",
"eslint": "4.2.0", "eslint": "^5.16.0",
"eslint-plugin-flowtype": "2.35.0", "eslint-plugin-flowtype": "2.35.0",
"eslint-plugin-prettier": "2.1.2", "eslint-plugin-prettier": "2.1.2",
"express": "^4.16.4", "express": "^4.16.4",
@ -56,26 +54,22 @@
"karma-mocha": "^1.3.0", "karma-mocha": "^1.3.0",
"karma-safari-launcher": "^1.0.0", "karma-safari-launcher": "^1.0.0",
"karma-sauce-launcher": "^2.0.2", "karma-sauce-launcher": "^2.0.2",
"mocha": "^6.0.2", "mocha": "^6.1.0",
"platform": "1.3.4", "platform": "1.3.4",
"prettier": "1.5.3", "prettier": "1.5.3",
"promise-polyfill": "6.0.2", "promise-polyfill": "6.0.2",
"replace-in-file": "^3.0.0", "replace-in-file": "^3.0.0",
"rimraf": "2.6.1", "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", "serve-index": "^1.9.1",
"slash": "1.0.0", "slash": "1.0.0",
"standard-version": "^5.0.2", "standard-version": "^5.0.2",
"uglifyjs-webpack-plugin": "^1.1.2", "uglifyjs-webpack-plugin": "^1.1.2",
"webpack": "3.4.1" "webpack": "^4.29.6",
"webpack-cli": "^3.3.0"
}, },
"scripts": { "scripts": {
"build": "rimraf dist/ && node scripts/create-reftest-list && npm run build:npm && npm run build:browser", "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", "build:browser": "webpack",
"release": "standard-version", "release": "standard-version",
"rollup": "rollup -c", "rollup": "rollup -c",

View File

@ -79,5 +79,4 @@ const html2canvas = (element: HTMLElement, conf: ?Options): Promise<*> => {
}; };
html2canvas.CanvasRenderer = CanvasRenderer; html2canvas.CanvasRenderer = CanvasRenderer;
export default html2canvas;
module.exports = html2canvas;

View File

@ -24,7 +24,7 @@ import type {TextBounds} from '../TextBounds';
import {TEXT_DECORATION_STYLE, TEXT_DECORATION_LINE} from '../parsing/textDecoration'; import {TEXT_DECORATION_STYLE, TEXT_DECORATION_LINE} from '../parsing/textDecoration';
import {PATH} from '../drawing/Path'; import {PATH} from '../drawing/Path';
class RefTestRenderer implements RenderTarget<string> { export default class RefTestRenderer implements RenderTarget<string> {
options: RenderOptions; options: RenderOptions;
indent: number; indent: number;
lines: Array<string>; lines: Array<string>;
@ -268,5 +268,3 @@ class RefTestRenderer implements RenderTarget<string> {
this.lines.push(`${new Array(this.indent + 1).join(' ')}${text}`); this.lines.push(`${new Array(this.indent + 1).join(' ')}${text}`);
} }
} }
module.exports = RefTestRenderer;

View File

@ -21,7 +21,7 @@ var REFTEST = window.location.search.indexOf('reftest') !== -1;
.concat([ .concat([
'/node_modules/jquery/dist/jquery.min', '/node_modules/jquery/dist/jquery.min',
'/dist/html2canvas', '/dist/html2canvas',
'/dist/RefTestRenderer' '/build/RefTestRenderer'
]) ])
.forEach(appendScript); .forEach(appendScript);

View File

@ -18,7 +18,7 @@ const plugins = [
]; ];
const modules = { const modules = {
loaders: [{ rules: [{
test: /\.js$/, test: /\.js$/,
exclude: /node_modules/, exclude: /node_modules/,
loader: 'babel-loader' loader: 'babel-loader'
@ -27,20 +27,26 @@ const modules = {
module.exports = [ module.exports = [
{ {
mode: 'development',
entry: './src/index.js', entry: './src/index.js',
output: { output: {
filename: './dist/html2canvas.js', path: path.resolve(__dirname, 'dist'),
filename: 'html2canvas.js',
library: 'html2canvas', library: 'html2canvas',
libraryExport: 'default',
libraryTarget: 'umd' libraryTarget: 'umd'
}, },
module: modules, module: modules,
plugins plugins
}, },
{ {
mode: 'production',
entry: './src/index.js', entry: './src/index.js',
output: { output: {
filename: './dist/html2canvas.min.js', path: path.resolve(__dirname, 'dist'),
filename: 'html2canvas.min.js',
library: 'html2canvas', library: 'html2canvas',
libraryExport: 'default',
libraryTarget: 'umd' libraryTarget: 'umd'
}, },
module: modules, module: modules,
@ -54,19 +60,24 @@ module.exports = [
] ]
}, },
{ {
mode: 'production',
entry: './src/renderer/RefTestRenderer.js', entry: './src/renderer/RefTestRenderer.js',
output: { output: {
filename: './dist/RefTestRenderer.js', path: path.resolve(__dirname, 'build'),
filename: 'RefTestRenderer.js',
library: 'RefTestRenderer', library: 'RefTestRenderer',
libraryExport: 'default',
libraryTarget: 'umd' libraryTarget: 'umd'
}, },
module: modules, module: modules,
plugins plugins
}, },
{ {
mode: 'production',
entry: './tests/testrunner.js', entry: './tests/testrunner.js',
output: { output: {
filename: './build/testrunner.js', path: path.resolve(__dirname, 'build'),
filename: 'testrunner.js',
library: 'testrunner', library: 'testrunner',
libraryTarget: 'umd' libraryTarget: 'umd'
}, },