mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
The `through2` dependency got introduced over four years ago in #11325 to replace the unmaintained `gulp-transform` dependency. However, sadly the same holds for `through2` since the last release was also four years ago. Fortunately the `through2` dependency can trivially be replaced with the built-in Node.js `stream.Transform` API nowadays. In fact, the `through2` dependency mentions themselves in their README already that they are "a tiny wrapper around Node.js streams.Transform". The `stream.Transform` API is available in all Node.js versions we support, and in Node.js 6 already the simplified constructor approach for `stream.Transform` got introduced to simplify creating custom stream transformers; see https://nodejs.org/docs/latest-v6.x/api/stream.html#stream_new_stream_transform_options. This commit therefore replaces `through2` by switching to the `stream.Transform` API directly so we don't need any wrappers anymore. Note that for our case the only change we have to make is to enable object mode, see https://nodejs.org/api/stream.html#object-mode, because we pass in `VinylFile` objects instead of e.g. regular `Buffer` objects. I have confirmed in two ways that this is indeed a drop-in replacement: - Running the Gulp targets that call the `transform` function and diffing the resulting `build` folder before/after this patch, with `diff -r build-old/ build-new/`, to ensure that there are no unexpected changes in the output. - Changing the Gulpfile to, instead of UTF-8, transform the files to ASCII, and diffing the resulting `build` folder to confirm that the transformation logic works and produces different results, such as: ``` diff build/lib/core/standard_fonts.js build-ascii/lib/core/standard_fonts.js 284c284 < t["Trinité"] = true; --- > t["Trinit�"] = true; ```
74 lines
2.1 KiB
JSON
74 lines
2.1 KiB
JSON
{
|
|
"name": "pdf.js",
|
|
"type": "module",
|
|
"devDependencies": {
|
|
"@babel/core": "^7.24.5",
|
|
"@babel/preset-env": "^7.24.5",
|
|
"@babel/runtime": "^7.24.5",
|
|
"@fluent/bundle": "^0.18.0",
|
|
"@fluent/dom": "^0.9.0",
|
|
"@jazzer.js/core": "^2.1.0",
|
|
"autoprefixer": "^10.4.19",
|
|
"babel-loader": "^9.1.3",
|
|
"caniuse-lite": "^1.0.30001618",
|
|
"canvas": "^2.11.2",
|
|
"core-js": "^3.37.1",
|
|
"cross-env": "^7.0.3",
|
|
"eslint": "^8.57.0",
|
|
"eslint-config-prettier": "^9.1.0",
|
|
"eslint-plugin-fetch-options": "^0.0.5",
|
|
"eslint-plugin-html": "^8.1.1",
|
|
"eslint-plugin-import": "^2.29.1",
|
|
"eslint-plugin-jasmine": "^4.1.3",
|
|
"eslint-plugin-json": "^3.1.0",
|
|
"eslint-plugin-mozilla": "^3.7.3",
|
|
"eslint-plugin-no-unsanitized": "^4.0.2",
|
|
"eslint-plugin-prettier": "^5.1.3",
|
|
"eslint-plugin-sort-exports": "^0.9.1",
|
|
"eslint-plugin-unicorn": "^53.0.0",
|
|
"globals": "^15.2.0",
|
|
"gulp": "^4.0.2",
|
|
"gulp-cli": "^3.0.0",
|
|
"gulp-postcss": "^10.0.0",
|
|
"gulp-rename": "^2.0.0",
|
|
"gulp-replace": "^1.1.4",
|
|
"gulp-zip": "^6.0.0",
|
|
"jasmine": "^5.1.0",
|
|
"jsdoc": "^4.0.3",
|
|
"jstransformer-markdown-it": "^3.0.0",
|
|
"merge-stream": "^2.0.0",
|
|
"path2d": "^0.2.0",
|
|
"pngjs": "^7.0.0",
|
|
"postcss": "^8.4.38",
|
|
"postcss-dark-theme-class": "^1.3.0",
|
|
"postcss-dir-pseudo-class": "^8.0.1",
|
|
"postcss-discard-comments": "^7.0.0",
|
|
"postcss-nesting": "^12.1.4",
|
|
"prettier": "^3.2.5",
|
|
"puppeteer": "^22.8.1",
|
|
"streamqueue": "^1.1.2",
|
|
"stylelint": "^16.5.0",
|
|
"stylelint-prettier": "^5.0.0",
|
|
"terser-webpack-plugin": "^5.3.10",
|
|
"tsc-alias": "^1.8.10",
|
|
"ttest": "^4.0.0",
|
|
"typescript": "^5.4.5",
|
|
"typogr": "^0.6.8",
|
|
"vinyl": "^3.0.0",
|
|
"webpack": "^5.91.0",
|
|
"webpack-stream": "^7.0.0",
|
|
"wintersmith": "^2.5.0",
|
|
"yargs": "^17.7.2"
|
|
},
|
|
"scripts": {
|
|
"postinstall": "cross-env PUPPETEER_PRODUCT=firefox node node_modules/puppeteer/install.mjs"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git://github.com/mozilla/pdf.js.git"
|
|
},
|
|
"engines": {
|
|
"node": ">=18"
|
|
},
|
|
"license": "Apache-2.0"
|
|
}
|