pdfmake 0.1.65 → 0.1.69
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/build/pdfmake.js +12257 -5176
- package/build/pdfmake.js.map +1 -1
- package/build/pdfmake.min.js +2 -37
- package/build/pdfmake.min.js.map +1 -1
- package/package.json +74 -69
- package/src/browser-extensions/URLBrowserResolver.js +88 -0
- package/src/browser-extensions/pdfMake.js +65 -12
- package/src/browser-extensions/virtual-fs.js +6 -0
- package/src/imageMeasure.js +6 -0
- package/src/printer.js +39 -5
- package/src/styleContextStack.js +3 -1
- package/src/svgMeasure.js +45 -81
- package/src/textTools.js +9 -0
- package/webpack.config.js +134 -114
package/webpack.config.js
CHANGED
|
@@ -1,114 +1,134 @@
|
|
|
1
|
-
var path = require('path');
|
|
2
|
-
var
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
+
};
|