|
|
@@ -70,7 +70,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
// PageProcessor
|
|
|
// -------------
|
|
|
const STAGES = [{
|
|
|
- sync: [
|
|
|
+ sequential: [
|
|
|
{ action: "removeUIElements" },
|
|
|
{ action: "replaceStyleContents" },
|
|
|
{ option: "removeSrcSet", action: "removeSrcSet" },
|
|
|
@@ -87,7 +87,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
{ action: "insertFonts" },
|
|
|
{ option: "removeHiddenElements", action: "removeHiddenElements" }
|
|
|
],
|
|
|
- async: [
|
|
|
+ parallel: [
|
|
|
{ action: "inlineStylesheets" },
|
|
|
{ action: "linkStylesheets" },
|
|
|
{ action: "attributeStyles" },
|
|
|
@@ -95,30 +95,30 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
{ option: "!removeImports", action: "htmlImports" }
|
|
|
]
|
|
|
}, {
|
|
|
- sync: [
|
|
|
+ sequential: [
|
|
|
{ option: "removeUnusedStyles", action: "removeUnusedStyles" },
|
|
|
{ option: "compressHTML", action: "compressHTML" },
|
|
|
{ option: "removeAlternativeFonts", action: "removeAlternativeFonts" },
|
|
|
{ option: "removeAlternativeMedias", action: "removeAlternativeMedias" }
|
|
|
],
|
|
|
- async: [
|
|
|
+ parallel: [
|
|
|
{ action: "inlineStylesheets" },
|
|
|
{ action: "attributeStyles" },
|
|
|
{ action: "pageResources" },
|
|
|
{ option: "!removeScripts", action: "scripts" }
|
|
|
]
|
|
|
}, {
|
|
|
- sync: [
|
|
|
+ sequential: [
|
|
|
{ option: "lazyLoadImages", action: "lazyLoadImages" },
|
|
|
{ option: "removeAlternativeFonts", action: "postRemoveAlternativeFonts" },
|
|
|
{ option: "compressCSS", action: "compressCSS" }
|
|
|
],
|
|
|
- async: [
|
|
|
+ parallel: [
|
|
|
{ option: "!removeFrames", action: "frames" },
|
|
|
{ option: "!removeImports", action: "htmlImports" },
|
|
|
]
|
|
|
}, {
|
|
|
- sync: [
|
|
|
+ sequential: [
|
|
|
{ option: "compressHTML", action: "postCompressHTML" },
|
|
|
{ option: "insertSingleFileComment", action: "insertSingleFileComment" },
|
|
|
{ action: "removeDefaultHeadTags" }
|
|
|
@@ -185,7 +185,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
if (DEBUG) {
|
|
|
console.log("-- STARTED STAGE", step, "--"); // eslint-disable-line no-console
|
|
|
}
|
|
|
- STAGES[step].sync.forEach(task => {
|
|
|
+ STAGES[step].sequential.forEach(task => {
|
|
|
let startTime;
|
|
|
if (DEBUG) {
|
|
|
startTime = Date.now();
|
|
|
@@ -196,8 +196,8 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
console.log("ENDED", task.action, Date.now() - startTime); // eslint-disable-line no-console
|
|
|
}
|
|
|
});
|
|
|
- if (STAGES[step].async) {
|
|
|
- return await Promise.all(STAGES[step].async.map(task => {
|
|
|
+ if (STAGES[step].parallel) {
|
|
|
+ return await Promise.all(STAGES[step].parallel.map(task => {
|
|
|
let startTime;
|
|
|
if (DEBUG) {
|
|
|
startTime = Date.now();
|