pdfmake 0.1.69 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/LICENSE +2 -1
- package/README.md +6 -6
- package/build/pdfmake.js +68193 -66840
- package/build/pdfmake.js.map +1 -1
- package/build/pdfmake.min.js +2 -2
- package/build/pdfmake.min.js.map +1 -1
- package/build/vfs_fonts.js +4 -4
- package/build-vfs.js +44 -0
- package/package.json +33 -23
- package/src/browser-extensions/pdfMake.js +10 -0
- package/src/layoutBuilder.js +14 -14
- package/src/pdfKitEngine.js +1 -1
- package/src/printer.js +1 -1
- package/src/textTools.js +1 -1
- package/gulpfile.js +0 -110
- package/webpack-standardfonts.config.js +0 -7
- package/webpack.config.js +0 -134
package/build-vfs.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
const vfsBefore = "this.pdfMake = this.pdfMake || {}; this.pdfMake.vfs = ";
|
|
4
|
+
const vfsAfter = ";";
|
|
5
|
+
const sourcePath = process.argv[2];
|
|
6
|
+
const vfsFilename = process.argv[3] ? process.argv[2] : './build/vfs_fonts.js';
|
|
7
|
+
|
|
8
|
+
var vfs = {};
|
|
9
|
+
|
|
10
|
+
if (sourcePath === undefined) {
|
|
11
|
+
console.error('Usage: node build-vfs.js path [filename]');
|
|
12
|
+
console.log('');
|
|
13
|
+
console.log('Parameters:');
|
|
14
|
+
console.log(' path Source path with fonts.');
|
|
15
|
+
console.log(' filename Optional. Output vfs file. Default: ./build/vfs_fonts.js');
|
|
16
|
+
console.log('');
|
|
17
|
+
console.log('Examples:');
|
|
18
|
+
console.log(' node build-vfs.js "examples/fonts"');
|
|
19
|
+
console.log(' node build-vfs.js "examples/fonts" "./build/vfs_fonts.js"');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!fs.existsSync(sourcePath)) {
|
|
24
|
+
console.error('Source path "' + sourcePath + '" not found.');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
console.log('Source path:', sourcePath);
|
|
29
|
+
console.log('');
|
|
30
|
+
|
|
31
|
+
var files = fs.readdirSync(sourcePath);
|
|
32
|
+
|
|
33
|
+
files.forEach(function (file) {
|
|
34
|
+
var fileBase64 = fs.readFileSync(sourcePath + '/' + file).toString('base64');
|
|
35
|
+
console.log('FILE:', file);
|
|
36
|
+
|
|
37
|
+
vfs[file] = fileBase64;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const vfsFileContent = vfsBefore + JSON.stringify(vfs, null, 2) + vfsAfter;
|
|
41
|
+
fs.writeFileSync(vfsFilename, vfsFileContent);
|
|
42
|
+
|
|
43
|
+
console.log('');
|
|
44
|
+
console.log('Builded ' + files.length + ' files to ' + vfsFilename + '.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdfmake",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Client/server side PDF printing in pure JavaScript",
|
|
5
5
|
"main": "src/printer.js",
|
|
6
6
|
"browser": "build/pdfmake.js",
|
|
@@ -8,42 +8,52 @@
|
|
|
8
8
|
"test": "tests"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
11
|
+
"@foliojs-fork/linebreak": "^1.1.0",
|
|
12
|
+
"@foliojs-fork/pdfkit": "^0.12.1",
|
|
13
|
+
"iconv-lite": "^0.6.3",
|
|
14
14
|
"svg-to-pdfkit": "^0.1.8",
|
|
15
15
|
"xmldoc": "^1.1.2"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@babel/
|
|
19
|
-
"@babel/
|
|
20
|
-
"@babel/
|
|
18
|
+
"@babel/cli": "^7.14.5",
|
|
19
|
+
"@babel/core": "^7.14.6",
|
|
20
|
+
"@babel/plugin-transform-modules-commonjs": "^7.14.5",
|
|
21
|
+
"@babel/preset-env": "^7.14.7",
|
|
22
|
+
"assert": "^2.0.0",
|
|
21
23
|
"babel-loader": "^8.2.2",
|
|
22
24
|
"brfs": "^2.0.2",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
25
|
+
"browserify-zlib": "^0.2.0",
|
|
26
|
+
"buffer": "^6.0.3",
|
|
27
|
+
"core-js": "^3.15.2",
|
|
28
|
+
"eslint": "^7.29.0",
|
|
29
|
+
"eslint-plugin-jsdoc": "^35.4.1",
|
|
30
|
+
"expose-loader": "^3.0.0",
|
|
27
31
|
"file-saver": "^2.0.5",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"gulp-file-contents-to-json": "^0.2.2",
|
|
32
|
-
"gulp-spawn-mocha": "^6.0.0",
|
|
33
|
-
"mocha": "7.2.0",
|
|
32
|
+
"mocha": "^9.0.1",
|
|
33
|
+
"npm-run-all": "^4.1.5",
|
|
34
|
+
"process": "^0.11.10",
|
|
34
35
|
"rewire": "^5.0.0",
|
|
35
|
-
"sinon": "^
|
|
36
|
+
"sinon": "^11.1.1",
|
|
37
|
+
"stream-browserify": "^3.0.0",
|
|
36
38
|
"string-replace-webpack-plugin": "^0.1.3",
|
|
37
|
-
"terser-webpack-plugin": "
|
|
39
|
+
"terser-webpack-plugin": "^5.1.4",
|
|
38
40
|
"transform-loader": "^0.2.4",
|
|
39
|
-
"
|
|
41
|
+
"util": "^0.12.4",
|
|
42
|
+
"webpack": "^5.42.0",
|
|
43
|
+
"webpack-cli": "^4.7.2"
|
|
40
44
|
},
|
|
41
45
|
"engines": {
|
|
42
|
-
"node": ">=
|
|
46
|
+
"node": ">=12"
|
|
43
47
|
},
|
|
44
48
|
"scripts": {
|
|
45
|
-
"
|
|
46
|
-
"
|
|
49
|
+
"test": "run-s build mocha",
|
|
50
|
+
"build": "run-s build:browser",
|
|
51
|
+
"build:browser": "webpack",
|
|
52
|
+
"build:browser-standard-fonts": "webpack --config webpack-standardfonts.config.js",
|
|
53
|
+
"build:vfs": "node build-vfs.js \"./examples/fonts\"",
|
|
54
|
+
"build:examples": "node build-examples.js",
|
|
55
|
+
"lint": "eslint \"./src/**/*.js\" \"./tests/**/*.js\" \"./examples/**/*.js\"",
|
|
56
|
+
"mocha": "mocha --reporter spec \"./tests/**/*.js\"",
|
|
47
57
|
"playground": "node dev-playground/server.js"
|
|
48
58
|
},
|
|
49
59
|
"repository": {
|
|
@@ -24,6 +24,16 @@ function Document(docDefinition, tableLayouts, fonts, vfs) {
|
|
|
24
24
|
|
|
25
25
|
function canCreatePdf() {
|
|
26
26
|
// Ensure the browser provides the level of support needed
|
|
27
|
+
try {
|
|
28
|
+
var arr = new Uint8Array(1)
|
|
29
|
+
var proto = { foo: function () { return 42 } }
|
|
30
|
+
Object.setPrototypeOf(proto, Uint8Array.prototype)
|
|
31
|
+
Object.setPrototypeOf(arr, proto)
|
|
32
|
+
return arr.foo() === 42
|
|
33
|
+
} catch (e) {
|
|
34
|
+
return false
|
|
35
|
+
}
|
|
36
|
+
|
|
27
37
|
if (!Object.keys || typeof Uint16Array === 'undefined') {
|
|
28
38
|
return false;
|
|
29
39
|
}
|
package/src/layoutBuilder.js
CHANGED
|
@@ -81,11 +81,7 @@ LayoutBuilder.prototype.layoutDocument = function (docStructure, fontProvider, s
|
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
nodeInfo.startPosition = node.positions[0];
|
|
84
|
-
nodeInfo.pageNumbers = node.positions.map(function (node) {
|
|
85
|
-
return node.pageNumber;
|
|
86
|
-
}).filter(function (element, position, array) {
|
|
87
|
-
return array.indexOf(element) === position;
|
|
88
|
-
});
|
|
84
|
+
nodeInfo.pageNumbers = Array.from(new Set(node.positions.map(function (node) { return node.pageNumber; })));
|
|
89
85
|
nodeInfo.pages = pages.length;
|
|
90
86
|
nodeInfo.stack = isArray(node.stack);
|
|
91
87
|
|
|
@@ -100,17 +96,21 @@ LayoutBuilder.prototype.layoutDocument = function (docStructure, fontProvider, s
|
|
|
100
96
|
var followingNodesOnPage = [];
|
|
101
97
|
var nodesOnNextPage = [];
|
|
102
98
|
var previousNodesOnPage = [];
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
99
|
+
if (pageBreakBeforeFct.length > 1) {
|
|
100
|
+
for (var ii = index + 1, l = linearNodeList.length; ii < l; ii++) {
|
|
101
|
+
if (linearNodeList[ii].nodeInfo.pageNumbers.indexOf(pageNumber) > -1) {
|
|
102
|
+
followingNodesOnPage.push(linearNodeList[ii].nodeInfo);
|
|
103
|
+
}
|
|
104
|
+
if (pageBreakBeforeFct.length > 2 && linearNodeList[ii].nodeInfo.pageNumbers.indexOf(pageNumber + 1) > -1) {
|
|
105
|
+
nodesOnNextPage.push(linearNodeList[ii].nodeInfo);
|
|
106
|
+
}
|
|
109
107
|
}
|
|
110
108
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
if (pageBreakBeforeFct.length > 3) {
|
|
110
|
+
for (var ii = 0; ii < index; ii++) {
|
|
111
|
+
if (linearNodeList[ii].nodeInfo.pageNumbers.indexOf(pageNumber) > -1) {
|
|
112
|
+
previousNodesOnPage.push(linearNodeList[ii].nodeInfo);
|
|
113
|
+
}
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
if (pageBreakBeforeFct(node.nodeInfo, followingNodesOnPage, nodesOnNextPage, previousNodesOnPage)) {
|
package/src/pdfKitEngine.js
CHANGED
|
@@ -4,7 +4,7 @@ function _interopDefault(ex) {
|
|
|
4
4
|
return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
var PdfKit = _interopDefault(require('pdfkit'));
|
|
7
|
+
var PdfKit = _interopDefault(require('@foliojs-fork/pdfkit'));
|
|
8
8
|
|
|
9
9
|
function getEngineInstance() {
|
|
10
10
|
return PdfKit;
|
package/src/printer.js
CHANGED
|
@@ -637,7 +637,7 @@ function renderImage(image, x, y, pdfKitDoc) {
|
|
|
637
637
|
var height = image.cover.height ? image.cover.height : image.height;
|
|
638
638
|
pdfKitDoc.save();
|
|
639
639
|
pdfKitDoc.rect(image.x, image.y, width, height).clip();
|
|
640
|
-
pdfKitDoc.image(image.image, image.x, image.y, { cover: [width, height], align, valign });
|
|
640
|
+
pdfKitDoc.image(image.image, image.x, image.y, { cover: [width, height], align: align, valign: valign });
|
|
641
641
|
pdfKitDoc.restore();
|
|
642
642
|
} else {
|
|
643
643
|
pdfKitDoc.image(image.image, image.x, image.y, { width: image._width, height: image._height });
|
package/src/textTools.js
CHANGED
|
@@ -5,7 +5,7 @@ var isNumber = require('./helpers').isNumber;
|
|
|
5
5
|
var isObject = require('./helpers').isObject;
|
|
6
6
|
var isArray = require('./helpers').isArray;
|
|
7
7
|
var isUndefined = require('./helpers').isUndefined;
|
|
8
|
-
var LineBreaker = require('linebreak');
|
|
8
|
+
var LineBreaker = require('@foliojs-fork/linebreak');
|
|
9
9
|
|
|
10
10
|
var LEADING = /^(\s)+/g;
|
|
11
11
|
var TRAILING = /(\s)+$/g;
|
package/gulpfile.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
var gulp = require('gulp');
|
|
2
|
-
var webpack = require('webpack');
|
|
3
|
-
var mocha = require('gulp-spawn-mocha');
|
|
4
|
-
var eslint = require('gulp-eslint');
|
|
5
|
-
var each = require('gulp-each');
|
|
6
|
-
var fc2json = require('gulp-file-contents-to-json');
|
|
7
|
-
var log = require('fancy-log');
|
|
8
|
-
var exec = require('child_process').exec;
|
|
9
|
-
const fs = require('fs');
|
|
10
|
-
|
|
11
|
-
var DEBUG = process.env.NODE_ENV === 'debug';
|
|
12
|
-
var CI = process.env.CI === 'true';
|
|
13
|
-
|
|
14
|
-
var vfsBefore = "this.pdfMake = this.pdfMake || {}; this.pdfMake.vfs = ";
|
|
15
|
-
var vfsAfter = ";";
|
|
16
|
-
|
|
17
|
-
gulp.task('build', function (callback) {
|
|
18
|
-
webpack(require('./webpack.config.js'), function (err, stats) {
|
|
19
|
-
if (err) {
|
|
20
|
-
callback(err);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
log("[webpack]", stats.toString({}));
|
|
24
|
-
if (stats.compilation.errors && stats.compilation.errors.length) {
|
|
25
|
-
callback(stats.compilation.errors);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
callback();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
gulp.task('buildWithStandardFonts', function (callback) {
|
|
33
|
-
webpack(require('./webpack-standardfonts.config.js'), function (err, stats) {
|
|
34
|
-
if (err) {
|
|
35
|
-
callback(err);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
log("[webpack]", stats.toString({}));
|
|
39
|
-
if (stats.compilation.errors && stats.compilation.errors.length) {
|
|
40
|
-
callback(stats.compilation.errors);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
callback();
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
gulp.task('test', function () {
|
|
48
|
-
return gulp.src(['./tests/**/*.js'])
|
|
49
|
-
.pipe(mocha({
|
|
50
|
-
debugBrk: DEBUG,
|
|
51
|
-
R: CI ? 'spec' : 'nyan'
|
|
52
|
-
}));
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
gulp.task('lint', function () {
|
|
56
|
-
return gulp.src(['./src/**/*.js'])
|
|
57
|
-
.pipe(eslint())
|
|
58
|
-
.pipe(eslint.format())
|
|
59
|
-
.pipe(eslint.failAfterError());
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
gulp.task('buildFonts', function () {
|
|
63
|
-
return gulp.src(['./examples/fonts/*.*'])
|
|
64
|
-
.pipe(each(function (content, file, callback) {
|
|
65
|
-
var newContent = Buffer.from(content).toString('base64');
|
|
66
|
-
callback(null, newContent);
|
|
67
|
-
}, 'buffer'))
|
|
68
|
-
.pipe(fc2json('vfs_fonts.js', { flat: true }))
|
|
69
|
-
.pipe(each(function (content, file, callback) {
|
|
70
|
-
var newContent = vfsBefore + content + vfsAfter;
|
|
71
|
-
callback(null, newContent);
|
|
72
|
-
}, 'buffer'))
|
|
73
|
-
.pipe(gulp.dest('build'));
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
gulp.task('watch', function () {
|
|
77
|
-
gulp.watch('./src/**', ['test', 'build']);
|
|
78
|
-
gulp.watch('./tests/**', ['test']);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
gulp.task('generateExamples', function (cb) {
|
|
82
|
-
var errCount = 0;
|
|
83
|
-
var position = 0;
|
|
84
|
-
process.chdir('examples');
|
|
85
|
-
|
|
86
|
-
const items = fs.readdirSync('.');
|
|
87
|
-
const files = items.filter(file => file.substring(file.length - 3, file.length) === '.js');
|
|
88
|
-
|
|
89
|
-
files.forEach(function (file) {
|
|
90
|
-
exec(`node ${file}`, function (err, stdout, stderr) {
|
|
91
|
-
position++;
|
|
92
|
-
log('FILE: ', file, ` (${position}/${files.length})`);
|
|
93
|
-
log(stdout);
|
|
94
|
-
|
|
95
|
-
if (err) {
|
|
96
|
-
errCount++;
|
|
97
|
-
log(stderr);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (position === files.length) {
|
|
101
|
-
if (errCount) {
|
|
102
|
-
log('Errors count: ', errCount);
|
|
103
|
-
}
|
|
104
|
-
cb();
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
gulp.task('default', gulp.series(/*'lint',*/ 'test', 'build', 'buildFonts'));
|
package/webpack.config.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
var path = require('path');
|
|
2
|
-
var TerserPlugin = require('terser-webpack-plugin');
|
|
3
|
-
var StringReplacePlugin = require("string-replace-webpack-plugin");
|
|
4
|
-
var webpack = require('webpack');
|
|
5
|
-
var pkg = require('./package.json');
|
|
6
|
-
|
|
7
|
-
var banner = '/*! ' + pkg.name + ' v' + pkg.version + ', @license ' + pkg.license + ', @link ' + pkg.homepage + ' */';
|
|
8
|
-
|
|
9
|
-
module.exports = {
|
|
10
|
-
mode: 'production',
|
|
11
|
-
entry: {
|
|
12
|
-
'pdfmake': './src/browser-extensions/pdfMake.js',
|
|
13
|
-
'pdfmake.min': './src/browser-extensions/pdfMake.js'
|
|
14
|
-
},
|
|
15
|
-
output: {
|
|
16
|
-
path: path.join(__dirname, './build'),
|
|
17
|
-
filename: '[name].js',
|
|
18
|
-
libraryTarget: 'umd',
|
|
19
|
-
// Workaround https://github.com/webpack/webpack/issues/6642 until https://github.com/webpack/webpack/issues/6525 lands.
|
|
20
|
-
globalObject: `typeof self !== 'undefined' ? self : this`
|
|
21
|
-
},
|
|
22
|
-
resolve: {
|
|
23
|
-
alias: {
|
|
24
|
-
fs: path.join(__dirname, './src/browser-extensions/virtual-fs.js')
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
node: {
|
|
28
|
-
// Prevent webpack from injecting setImmediate polyfill, which includes a "new Function" through a global polyfill - which cannot be used in a CSP environment with sane defaults
|
|
29
|
-
setImmediate: false
|
|
30
|
-
},
|
|
31
|
-
module: {
|
|
32
|
-
rules: [
|
|
33
|
-
// for fs don't use babel _interopDefault command
|
|
34
|
-
{
|
|
35
|
-
enforce: 'pre',
|
|
36
|
-
test: /pdfkit[/\\]js[/\\]/,
|
|
37
|
-
loader: StringReplacePlugin.replace({
|
|
38
|
-
replacements: [
|
|
39
|
-
{
|
|
40
|
-
pattern: "import fs from 'fs';",
|
|
41
|
-
replacement: function () {
|
|
42
|
-
return "var fs = require('fs');";
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
})
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
test: /\.js$/,
|
|
50
|
-
include: /(pdfkit|saslprep|unicode-trie|unicode-properties|dfa|linebreak|png-js)/,
|
|
51
|
-
use: {
|
|
52
|
-
loader: 'babel-loader',
|
|
53
|
-
options: {
|
|
54
|
-
presets: [
|
|
55
|
-
[
|
|
56
|
-
"@babel/preset-env",
|
|
57
|
-
{
|
|
58
|
-
targets: {
|
|
59
|
-
"ie": "10"
|
|
60
|
-
},
|
|
61
|
-
modules: false,
|
|
62
|
-
useBuiltIns: 'usage',
|
|
63
|
-
// TODO: after fix in babel remove corejs version and remove core-js dependency in package.json
|
|
64
|
-
corejs: "3.0.0",
|
|
65
|
-
loose: true
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
],
|
|
69
|
-
plugins: ["@babel/plugin-transform-modules-commonjs"]
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
test: /pdfMake.js$/,
|
|
75
|
-
loader: 'expose-loader',
|
|
76
|
-
options: {
|
|
77
|
-
exposes: 'pdfMake',
|
|
78
|
-
},
|
|
79
|
-
include: [path.join(__dirname, './src/browser-extensions')]
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
/* temporary bugfix for FileSaver: added hack for mobile device support, see https://github.com/bpampuch/pdfmake/issues/1664 */
|
|
83
|
-
/* waiting to merge and release PR https://github.com/eligrey/FileSaver.js/pull/533 */
|
|
84
|
-
{
|
|
85
|
-
test: /FileSaver.min.js$/, loader: StringReplacePlugin.replace({
|
|
86
|
-
replacements: [
|
|
87
|
-
{
|
|
88
|
-
pattern: '"download"in HTMLAnchorElement.prototype',
|
|
89
|
-
replacement: function () {
|
|
90
|
-
return '(typeof HTMLAnchorElement !== "undefined" && "download" in HTMLAnchorElement.prototype)';
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
]
|
|
94
|
-
})
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
{ enforce: 'post', test: /fontkit[/\\]index.js$/, loader: "transform-loader?brfs" },
|
|
98
|
-
{ enforce: 'post', test: /unicode-properties[/\\]index.js$/, loader: "transform-loader?brfs" },
|
|
99
|
-
{ enforce: 'post', test: /linebreak[/\\]src[/\\]linebreaker.js/, loader: "transform-loader?brfs" }
|
|
100
|
-
]
|
|
101
|
-
},
|
|
102
|
-
optimization: {
|
|
103
|
-
minimizer: [
|
|
104
|
-
new TerserPlugin({
|
|
105
|
-
include: /\.min\.js$/,
|
|
106
|
-
sourceMap: true,
|
|
107
|
-
extractComments: false,
|
|
108
|
-
terserOptions: {
|
|
109
|
-
format: {
|
|
110
|
-
preamble: banner,
|
|
111
|
-
comments: false,
|
|
112
|
-
},
|
|
113
|
-
output: {
|
|
114
|
-
preamble: banner,
|
|
115
|
-
comments: false,
|
|
116
|
-
},
|
|
117
|
-
compress: {
|
|
118
|
-
drop_console: true
|
|
119
|
-
},
|
|
120
|
-
keep_classnames: true,
|
|
121
|
-
keep_fnames: true
|
|
122
|
-
}
|
|
123
|
-
})
|
|
124
|
-
]
|
|
125
|
-
},
|
|
126
|
-
plugins: [
|
|
127
|
-
new StringReplacePlugin(),
|
|
128
|
-
new webpack.BannerPlugin({
|
|
129
|
-
banner: banner,
|
|
130
|
-
raw: true
|
|
131
|
-
})
|
|
132
|
-
],
|
|
133
|
-
devtool: 'source-map'
|
|
134
|
-
};
|