pdfmake 0.1.70 → 0.1.71
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/LICENSE +2 -1
- package/build/pdfmake.js +5341 -4404
- 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/package.json +74 -74
- package/src/layoutBuilder.js +14 -14
- package/src/printer.js +685 -685
- package/.idea/modules.xml +0 -8
- package/.idea/pdfmake.iml +0 -11
- package/.idea/vcs.xml +0 -6
- package/gulpfile.js +0 -110
- package/webpack-standardfonts.config.js +0 -7
- package/webpack.config.js +0 -134
package/.idea/modules.xml
DELETED
package/.idea/pdfmake.iml
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
|
6
|
-
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
|
7
|
-
</content>
|
|
8
|
-
<orderEntry type="inheritedJdk" />
|
|
9
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
-
</component>
|
|
11
|
-
</module>
|
package/.idea/vcs.xml
DELETED
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
|
-
};
|