Merge pull request #17681 from Snuffleupagus/parseMinified-changes

Tweak the `parseMinified` handling slightly in the gulpfile
This commit is contained in:
Tim van der Meij 2024-02-17 15:08:30 +01:00 committed by GitHub
commit f1a225889b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1204,22 +1204,23 @@ async function parseMinified(dir) {
module: true, module: true,
}; };
fs.writeFileSync( await Promise.all([
dir + "build/pdf.min.mjs", minify(pdfFile, options).then(res => {
(await minify(pdfFile, options)).code fs.writeFileSync(dir + "build/pdf.min.mjs", res.code);
); }),
fs.writeFileSync( minify(pdfWorkerFile, options).then(res => {
dir + "build/pdf.worker.min.mjs", fs.writeFileSync(dir + "build/pdf.worker.min.mjs", res.code);
(await minify(pdfWorkerFile, options)).code }),
); minify(pdfSandboxFile, options).then(res => {
fs.writeFileSync( fs.writeFileSync(dir + "build/pdf.sandbox.min.mjs", res.code);
dir + "build/pdf.sandbox.min.mjs", }),
(await minify(pdfSandboxFile, options)).code minify(pdfImageDecodersFile, options).then(res => {
); fs.writeFileSync(
fs.writeFileSync( dir + "image_decoders/pdf.image_decoders.min.mjs",
dir + "image_decoders/pdf.image_decoders.min.mjs", res.code
(await minify(pdfImageDecodersFile, options)).code );
); }),
]);
console.log(); console.log();
console.log("### Cleaning js files"); console.log("### Cleaning js files");
@ -1227,17 +1228,7 @@ async function parseMinified(dir) {
fs.unlinkSync(dir + "build/pdf.mjs"); fs.unlinkSync(dir + "build/pdf.mjs");
fs.unlinkSync(dir + "build/pdf.worker.mjs"); fs.unlinkSync(dir + "build/pdf.worker.mjs");
fs.unlinkSync(dir + "build/pdf.sandbox.mjs"); fs.unlinkSync(dir + "build/pdf.sandbox.mjs");
fs.unlinkSync(dir + "image_decoders/pdf.image_decoders.mjs");
fs.renameSync(dir + "build/pdf.min.mjs", dir + "build/pdf.mjs");
fs.renameSync(dir + "build/pdf.worker.min.mjs", dir + "build/pdf.worker.mjs");
fs.renameSync(
dir + "build/pdf.sandbox.min.mjs",
dir + "build/pdf.sandbox.mjs"
);
fs.renameSync(
dir + "image_decoders/pdf.image_decoders.min.mjs",
dir + "image_decoders/pdf.image_decoders.mjs"
);
} }
gulp.task( gulp.task(
@ -2259,36 +2250,30 @@ gulp.task(
]) ])
.pipe(gulp.dest(DIST_DIR + "legacy/build/")), .pipe(gulp.dest(DIST_DIR + "legacy/build/")),
gulp gulp
.src(MINIFIED_DIR + "build/pdf.mjs") .src(MINIFIED_DIR + "build/pdf.min.mjs")
.pipe(rename("pdf.min.mjs"))
.pipe(gulp.dest(DIST_DIR + "build/")), .pipe(gulp.dest(DIST_DIR + "build/")),
gulp gulp
.src(MINIFIED_DIR + "build/pdf.worker.mjs") .src(MINIFIED_DIR + "build/pdf.worker.min.mjs")
.pipe(rename("pdf.worker.min.mjs"))
.pipe(gulp.dest(DIST_DIR + "build/")), .pipe(gulp.dest(DIST_DIR + "build/")),
gulp gulp
.src(MINIFIED_DIR + "build/pdf.sandbox.mjs") .src(MINIFIED_DIR + "build/pdf.sandbox.min.mjs")
.pipe(rename("pdf.sandbox.min.mjs"))
.pipe(gulp.dest(DIST_DIR + "build/")), .pipe(gulp.dest(DIST_DIR + "build/")),
gulp gulp
.src(MINIFIED_DIR + "image_decoders/pdf.image_decoders.mjs") .src(MINIFIED_DIR + "image_decoders/pdf.image_decoders.min.mjs")
.pipe(rename("pdf.image_decoders.min.mjs"))
.pipe(gulp.dest(DIST_DIR + "image_decoders/")), .pipe(gulp.dest(DIST_DIR + "image_decoders/")),
gulp gulp
.src(MINIFIED_LEGACY_DIR + "build/pdf.mjs") .src(MINIFIED_LEGACY_DIR + "build/pdf.min.mjs")
.pipe(rename("pdf.min.mjs"))
.pipe(gulp.dest(DIST_DIR + "legacy/build/")), .pipe(gulp.dest(DIST_DIR + "legacy/build/")),
gulp gulp
.src(MINIFIED_LEGACY_DIR + "build/pdf.worker.mjs") .src(MINIFIED_LEGACY_DIR + "build/pdf.worker.min.mjs")
.pipe(rename("pdf.worker.min.mjs"))
.pipe(gulp.dest(DIST_DIR + "legacy/build/")), .pipe(gulp.dest(DIST_DIR + "legacy/build/")),
gulp gulp
.src(MINIFIED_LEGACY_DIR + "build/pdf.sandbox.mjs") .src(MINIFIED_LEGACY_DIR + "build/pdf.sandbox.min.mjs")
.pipe(rename("pdf.sandbox.min.mjs"))
.pipe(gulp.dest(DIST_DIR + "legacy/build/")), .pipe(gulp.dest(DIST_DIR + "legacy/build/")),
gulp gulp
.src(MINIFIED_LEGACY_DIR + "image_decoders/pdf.image_decoders.mjs") .src(
.pipe(rename("pdf.image_decoders.min.mjs")) MINIFIED_LEGACY_DIR + "image_decoders/pdf.image_decoders.min.mjs"
)
.pipe(gulp.dest(DIST_DIR + "legacy/image_decoders/")), .pipe(gulp.dest(DIST_DIR + "legacy/image_decoders/")),
gulp gulp
.src(COMPONENTS_DIR + "**/*", { base: COMPONENTS_DIR }) .src(COMPONENTS_DIR + "**/*", { base: COMPONENTS_DIR })