pdfkit 0.14.0 → 0.15.1

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/js/virtual-fs.js CHANGED
@@ -1,68 +1,51 @@
1
1
  'use strict';
2
2
 
3
- var VirtualFileSystem = /*#__PURE__*/function () {
4
- function VirtualFileSystem() {
3
+ class VirtualFileSystem {
4
+ constructor() {
5
5
  this.fileData = {};
6
6
  }
7
-
8
- var _proto = VirtualFileSystem.prototype;
9
-
10
- _proto.readFileSync = function readFileSync(fileName, options) {
7
+ readFileSync(fileName, options) {
11
8
  if (options === void 0) {
12
9
  options = {};
13
10
  }
14
-
15
- var encoding = typeof options === 'string' ? options : options.encoding;
16
- var virtualFileName = normalizeFilename(fileName);
17
- var data = this.fileData[virtualFileName];
18
-
11
+ const encoding = typeof options === 'string' ? options : options.encoding;
12
+ const virtualFileName = normalizeFilename(fileName);
13
+ const data = this.fileData[virtualFileName];
19
14
  if (data == null) {
20
- throw new Error("File '" + virtualFileName + "' not found in virtual file system");
15
+ throw new Error(`File '${virtualFileName}' not found in virtual file system`);
21
16
  }
22
-
23
17
  if (encoding) {
24
18
  // return a string
25
19
  return typeof data === 'string' ? data : data.toString(encoding);
26
20
  }
27
-
28
21
  return Buffer.from(data, typeof data === 'string' ? 'base64' : undefined);
29
- };
30
-
31
- _proto.writeFileSync = function writeFileSync(fileName, content) {
22
+ }
23
+ writeFileSync(fileName, content) {
32
24
  this.fileData[normalizeFilename(fileName)] = content;
33
- };
34
-
35
- _proto.bindFileData = function bindFileData(data, options) {
25
+ }
26
+ bindFileData(data, options) {
36
27
  if (data === void 0) {
37
28
  data = {};
38
29
  }
39
-
40
30
  if (options === void 0) {
41
31
  options = {};
42
32
  }
43
-
44
33
  if (options.reset) {
45
34
  this.fileData = data;
46
35
  } else {
47
36
  Object.assign(this.fileData, data);
48
37
  }
49
- };
50
-
51
- return VirtualFileSystem;
52
- }();
53
-
38
+ }
39
+ }
54
40
  function normalizeFilename(fileName) {
55
41
  if (fileName.indexOf(__dirname) === 0) {
56
42
  fileName = fileName.substring(__dirname.length);
57
43
  }
58
-
59
44
  if (fileName.indexOf('/') === 0) {
60
45
  fileName = fileName.substring(1);
61
46
  }
62
-
63
47
  return fileName;
64
48
  }
65
-
66
49
  var virtualFs = new VirtualFileSystem();
67
50
 
68
51
  module.exports = virtualFs;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "document",
10
10
  "vector"
11
11
  ],
12
- "version": "0.14.0",
12
+ "version": "0.15.1",
13
13
  "homepage": "http://pdfkit.org/",
14
14
  "author": {
15
15
  "name": "Devon Govett",
@@ -31,7 +31,7 @@
31
31
  "brace": "^0.11.1",
32
32
  "brfs": "~2.0.2",
33
33
  "browserify": "^16.5.0",
34
- "canvas": "^2.11.0",
34
+ "canvas": "^2.11.2",
35
35
  "codemirror": "~5.49.2",
36
36
  "eslint": "^7.8.1",
37
37
  "gh-pages": "^3.1.0",
@@ -50,12 +50,14 @@
50
50
  "dependencies": {
51
51
  "crypto-js": "^4.2.0",
52
52
  "fontkit": "^1.8.1",
53
+ "jpeg-exif": "^1.1.4",
53
54
  "linebreak": "^1.0.2",
54
55
  "png-js": "^1.0.0"
55
56
  },
56
57
  "scripts": {
57
58
  "prepublishOnly": "npm run build",
58
- "build": "rollup -c && browserify --standalone PDFDocument --ignore crypto --ignore iconv-lite js/pdfkit.js > js/pdfkit.standalone.js",
59
+ "build": "rollup -c && npm run build-standalone",
60
+ "build-standalone": "browserify --standalone PDFDocument --ignore crypto --ignore iconv-lite js/pdfkit.js > js/pdfkit.standalone.js",
59
61
  "browserify-example": "browserify examples/browserify/browser.js > examples/browserify/bundle.js",
60
62
  "pdf-guide": "node docs/generate.js",
61
63
  "website": "node docs/generate_website.js",
@@ -68,15 +70,14 @@
68
70
  "test:unit": "jest unit/"
69
71
  },
70
72
  "main": "js/pdfkit.js",
71
- "module": "js/pdfkit.es5.js",
72
- "esnext": "js/pdfkit.esnext.js",
73
+ "module": "js/pdfkit.es.js",
73
74
  "browserify": {
74
75
  "transform": [
75
76
  "brfs"
76
77
  ]
77
78
  },
78
79
  "engine": [
79
- "node >= v6.0.0"
80
+ "node >= v18.0.0"
80
81
  ],
81
82
  "jest": {
82
83
  "testEnvironment": "jest-environment-jsdom",
@@ -88,4 +89,4 @@
88
89
  "<rootDir>/tests/unit/setupTests.js"
89
90
  ]
90
91
  }
91
- }
92
+ }