@flatjs/evolve 2.3.2-next.5 → 3.0.0-next.6

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.
Files changed (91) hide show
  1. package/dist/build-server/base-compiler-watching.js +1 -1
  2. package/dist/build-server/compiler-server-manager.js +1 -1
  3. package/dist/build-server/compiler-server.js +1 -1
  4. package/dist/build-server/create-global-compiler-watching.js +1 -1
  5. package/dist/compiler/create-build-server-global-compiler.js +1 -1
  6. package/dist/constants.d.ts +2 -1
  7. package/dist/constants.js +1 -1
  8. package/dist/core/rspack/dev-serve/add-rspack-compiler-to-dev-server.js +1 -1
  9. package/dist/core/rspack/dev-serve/create-rspack-compiler-task.js +1 -1
  10. package/dist/core/rspack/load-rspack-watch-options.js +1 -1
  11. package/dist/core/rspack/start-rspack-build.js +1 -1
  12. package/dist/core/webpack/dev-serve/add-webpack-compiler-to-dev-server.js +1 -1
  13. package/dist/core/webpack/dev-serve/create-webpack-compiler-task.js +1 -1
  14. package/dist/core/webpack/load-watch-options.js +1 -1
  15. package/dist/core/webpack/start-webpack-build.js +1 -1
  16. package/dist/default-options.js +1 -1
  17. package/dist/dev-server/create-dev-server.js +1 -1
  18. package/dist/dev-server/middlewares/create-page-middleware.js +1 -1
  19. package/dist/dev-server/middlewares/create-public-assets-middleware.js +1 -1
  20. package/dist/dev-server/middlewares/error-module-parser.d.ts +12 -0
  21. package/dist/dev-server/middlewares/error-module-parser.js +1 -0
  22. package/dist/dev-server/middlewares/get-page-main-html.js +1 -1
  23. package/dist/dev-server/middlewares/get-page-module-html.js +1 -1
  24. package/dist/dev-server/middlewares/main-module-parser.d.ts +15 -0
  25. package/dist/dev-server/middlewares/main-module-parser.js +1 -0
  26. package/dist/helpers/assert-group-entry-item.js +1 -1
  27. package/dist/helpers/chunk-entry-map.js +1 -1
  28. package/dist/helpers/custom-listr-renderer.js +1 -1
  29. package/dist/helpers/custom-message-channel.js +1 -1
  30. package/dist/helpers/delete-object-keys.js +1 -1
  31. package/dist/helpers/filter-actived-entries.js +1 -1
  32. package/dist/helpers/flat-entry-map.js +1 -1
  33. package/dist/helpers/format-spinner-text.js +1 -1
  34. package/dist/helpers/get-html-plugin-config.js +1 -1
  35. package/dist/helpers/is-deep-equal.js +1 -1
  36. package/dist/helpers/is-vue-entry-item.js +1 -1
  37. package/dist/helpers/json-serializer.js +1 -1
  38. package/dist/helpers/merge-babel-options.js +1 -1
  39. package/dist/helpers/merge-inspector-evolve-config.js +1 -1
  40. package/dist/helpers/normalize-group-name.js +1 -1
  41. package/dist/helpers/normalize-template-inject-tokens.d.ts +8 -5
  42. package/dist/helpers/normalize-template-inject-tokens.js +1 -1
  43. package/dist/helpers/resolve-entry-map-input-files.js +1 -1
  44. package/dist/helpers/split-to-entry-group.js +1 -1
  45. package/dist/helpers/verify-group-entry-options.js +1 -1
  46. package/dist/main/prepare-analyzer.js +1 -1
  47. package/dist/main/prepare-serve.js +1 -1
  48. package/dist/main/start-build-dynamic.js +1 -1
  49. package/dist/main/start-build-worker.js +1 -1
  50. package/dist/minimizer/rspack/image-minimizer.js +1 -1
  51. package/dist/minimizer/webpack/image-minimizer.js +1 -1
  52. package/dist/plugins/rspack/module-federation/external-template-remotes-rspack-plugin.js +1 -1
  53. package/dist/plugins/rspack/module-federation/index.js +1 -1
  54. package/dist/plugins/rspack/multi-html/multi-html-cdn-rspack-plugin.js +1 -1
  55. package/dist/plugins/rspack/multi-html/multi-html-modify-rspack-plugin.js +1 -0
  56. package/dist/plugins/rspack/multi-html/multi-html-rspack-plugin.js +1 -1
  57. package/dist/plugins/rspack/progress-plugin/index.js +1 -1
  58. package/dist/plugins/rspack/progress-plugin/progress-handler.js +1 -1
  59. package/dist/plugins/rspack/progress-plugin/progress-worker.js +1 -1
  60. package/dist/plugins/webpack/circular-dependency/circular-dependency-webpack-plugin.js +1 -1
  61. package/dist/plugins/webpack/clean-webpack/clean-webpack-plugin.js +1 -1
  62. package/dist/plugins/webpack/clean-webpack/index.js +1 -1
  63. package/dist/plugins/webpack/html-inject-scripts/html-inject-script-webpack-plugin.js +1 -1
  64. package/dist/plugins/webpack/html-inject-scripts/html-inline-script-webpack-plugin.js +1 -1
  65. package/dist/plugins/webpack/module-federation/external-template-remotes-webpack-plugin.js +1 -1
  66. package/dist/plugins/webpack/module-federation/index.js +1 -1
  67. package/dist/plugins/webpack/multi-html/multi-html-cdn-webpack-plugin.js +1 -1
  68. package/dist/plugins/webpack/multi-html/multi-html-modify-webpack-plugin.js +1 -1
  69. package/dist/plugins/webpack/multi-html/multi-html-webpack-plugins.js +1 -1
  70. package/dist/plugins/webpack/stats-webpack/helper-write-stats.js +1 -1
  71. package/dist/plugins/webpack/stats-webpack/stats-webpack-plugin.js +1 -1
  72. package/dist/rules/rule-utils.js +1 -1
  73. package/dist/types/types-entry-map.d.ts +0 -7
  74. package/dist/types/types-multi-html.d.ts +30 -28
  75. package/dist/types/types-webpack.d.ts +4 -8
  76. package/package.json +31 -33
  77. package/templates/html-plugin/index-dev.html +11 -48
  78. package/templates/html-plugin/index-inte.html +11 -48
  79. package/templates/html-plugin/index-inte2.html +11 -48
  80. package/templates/html-plugin/index-inte3.html +11 -48
  81. package/templates/html-plugin/index-inte4.html +11 -48
  82. package/templates/html-plugin/index-me.html +11 -48
  83. package/templates/html-plugin/index-ntv.html +11 -48
  84. package/templates/html-plugin/index-prod.html +11 -48
  85. package/templates/html-plugin/index-rc.html +11 -48
  86. package/templates/html-plugin/index-uat.html +11 -48
  87. package/templates/main.html +11 -28
  88. package/templates/module-404.html +11 -22
  89. package/templates/module.html +11 -69
  90. package/dist/plugins/rspack/multi-html/multi-html-modify--rspack-plugin.js +0 -1
  91. /package/dist/plugins/rspack/multi-html/{multi-html-modify--rspack-plugin.d.ts → multi-html-modify-rspack-plugin.d.ts} +0 -0
@@ -1 +1 @@
1
- export const progressHandler=(s,t)=>{const e=t[0],[r,a]=e,o=a?.groupName||"",n=t.map((([s])=>s));return(t,e)=>{const r={status:t>0&&t<1?"start":"end",data:{groupName:o,entryKeys:n}};s.postMessage(r)}};
1
+ export const progressHandler=(s,t)=>{const e=t[0],[r,a]=e,o=a?.groupName||"",n=t.map(([s])=>s);return(t,e)=>{const r={status:t>0&&t<1?"start":"end",data:{groupName:o,entryKeys:n}};s.postMessage(r)}};
@@ -1 +1 @@
1
- import logUpdate from"log-update";import{parentPort}from"worker_threads";import{chalk}from"@flatjs/common";import{buildProgressSpinnerFrames}from"../../../constants.js";import{formatSpinnerText}from"../../../helpers/format-spinner-text.js";let startIndex=0;class ProgressWorker{constructor(){this.intervalId=null}start(r,e){this.intervalId||(this.intervalId=setInterval((()=>{startIndex=++startIndex%buildProgressSpinnerFrames.length;const t=buildProgressSpinnerFrames[startIndex],n=`Group ${chalk(["magenta"])(r)} compiling...`;logUpdate(`${chalk(["cyan"])(t)} ${n} \n${formatSpinnerText(e)}`)}),100))}end(r,e){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null);const t=`Group ${chalk(["magenta"])(r)} ${chalk(["green"])("done")}`;logUpdate(`${chalk(["green"])("✔")} ${t} \n${formatSpinnerText(e,"✔","green")}`),logUpdate.done()}}const progressWorker=new ProgressWorker;parentPort?.on("message",(({status:r,data:e})=>{const{groupName:t,entryKeys:n}=e;"start"===r?progressWorker.start(t,n):"end"===r&&progressWorker.end(t,n)}));
1
+ import logUpdate from"log-update";import{parentPort}from"worker_threads";import{chalk}from"@flatjs/common";import{buildProgressSpinnerFrames}from"../../../constants.js";import{formatSpinnerText}from"../../../helpers/format-spinner-text.js";let startIndex=0;class ProgressWorker{constructor(){this.intervalId=null}start(r,e){this.intervalId||(this.intervalId=setInterval(()=>{startIndex=++startIndex%buildProgressSpinnerFrames.length;const t=buildProgressSpinnerFrames[startIndex],n=`Group ${chalk(["magenta"])(r)} compiling...`;logUpdate(`${chalk(["cyan"])(t)} ${n} \n${formatSpinnerText(e)}`)},100))}end(r,e){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null);const t=`Group ${chalk(["magenta"])(r)} ${chalk(["green"])("done")}`;logUpdate(`${chalk(["green"])("✔")} ${t} \n${formatSpinnerText(e,"✔","green")}`),logUpdate.done()}}const progressWorker=new ProgressWorker;parentPort?.on("message",({status:r,data:e})=>{const{groupName:t,entryKeys:n}=e;"start"===r?progressWorker.start(t,n):"end"===r&&progressWorker.end(t,n)});
@@ -1 +1 @@
1
- import{relative}from"node:path";import Graph from"tarjan-graph";import webpack from"webpack";import{mergeOptions}from"@flatjs/common";const BASE_ERROR="Circular dependency detected:\r\n",PLUGIN_TITLE="CircularDependencyWebpackPlugin";export class CircularDependencyWebpackPlugin{constructor(o={}){this.options=mergeOptions({exclude:/node_modules/,include:/.*/,failOnError:!1,allowAsyncCycles:!1,projectCwd:process.cwd()},o)}apply(o){const e=this.options.projectCwd;o.hooks.compilation.tap(PLUGIN_TITLE,(o=>{o.hooks.optimizeModules.tap(PLUGIN_TITLE,(t=>{this.options.onStart&&this.options.onStart({compilation:o});const n=new(Graph.default||Graph);for(const e of t){const t=[];for(const n of e.dependencies){if(n.constructor&&"CommonJsSelfReferenceDependency"===n.constructor.name)continue;let r=null;r=o.moduleGraph?o.moduleGraph.getModule(n):n.module,r&&(r instanceof webpack.NormalModule&&r.resource&&(this.options.allowAsyncCycles&&n.weak||e!==r&&t.push(r.identifier())))}n.add(e.identifier(),t)}const r=n.getCycles();this.isCyclic(r,o,e),this.options.onEnd&&this.options.onEnd({compilation:o})}))}))}isCyclic(o,e,t){o.forEach((o=>{const n=o.slice().reverse().map((o=>{const t=e.findModule(o.name);return t instanceof webpack.NormalModule&&t.resource||null}));if(n.every((o=>!o||this.options.exclude.test(o)||!this.options.include.test(o))))return;const r=n.map((o=>relative(t,o)));if(this.options.onDetected){try{this.options.onDetected({paths:r.concat([r[0]]),compilation:e})}catch(o){e.errors.push(o)}return}const s=new Error(BASE_ERROR.concat(r.concat([r[0]]).join(" -> ")));this.options.failOnError?e.errors.push(s):e.warnings.push(s)}))}}
1
+ import{relative}from"node:path";import Graph from"tarjan-graph";import webpack from"webpack";import{mergeOptions}from"@flatjs/common";const BASE_ERROR="Circular dependency detected:\r\n",PLUGIN_TITLE="CircularDependencyWebpackPlugin";export class CircularDependencyWebpackPlugin{constructor(o={}){this.options=mergeOptions({exclude:/node_modules/,include:/.*/,failOnError:!1,allowAsyncCycles:!1,projectCwd:process.cwd()},o)}apply(o){const e=this.options.projectCwd;o.hooks.compilation.tap(PLUGIN_TITLE,o=>{o.hooks.optimizeModules.tap(PLUGIN_TITLE,t=>{this.options.onStart&&this.options.onStart({compilation:o});const n=new(Graph.default||Graph);for(const e of t){const t=[];for(const n of e.dependencies){if(n.constructor&&"CommonJsSelfReferenceDependency"===n.constructor.name)continue;let r=null;r=o.moduleGraph?o.moduleGraph.getModule(n):n.module,r&&(r instanceof webpack.NormalModule&&r.resource&&(this.options.allowAsyncCycles&&n.weak||e!==r&&t.push(r.identifier())))}n.add(e.identifier(),t)}const r=n.getCycles();this.isCyclic(r,o,e),this.options.onEnd&&this.options.onEnd({compilation:o})})})}isCyclic(o,e,t){o.forEach(o=>{const n=o.slice().reverse().map(o=>{const t=e.findModule(o.name);return t instanceof webpack.NormalModule&&t.resource||null});if(n.every(o=>!o||this.options.exclude.test(o)||!this.options.include.test(o)))return;const r=n.map(o=>relative(t,o));if(this.options.onDetected){try{this.options.onDetected({paths:r.concat([r[0]]),compilation:e})}catch(o){e.errors.push(o)}return}const s=new Error(BASE_ERROR.concat(r.concat([r[0]]).join(" -> ")));this.options.failOnError?e.errors.push(s):e.warnings.push(s)})}}
@@ -1 +1 @@
1
- import{rmSync}from"node:fs";import{relative}from"node:path";import{fileWalkSync}from"@armit/file-utility";import{logger}from"@flatjs/common";import{moduleName}from"../../../constants.js";export class CleanWebpackPlugin{constructor(e={}){this.verbose=!0===e.verbose||!1,this.projectCwd=e.projectCwd||process.cwd(),this.cleanStaleWebpackAssets=!0!==e.cleanStaleWebpackAssets&&!1!==e.cleanStaleWebpackAssets||e.cleanStaleWebpackAssets,this.protectWebpackAssets=!0!==e.protectWebpackAssets&&!1!==e.protectWebpackAssets||e.protectWebpackAssets,this.cleanAfterEveryBuildPatterns=Array.isArray(e.cleanAfterEveryBuildPatterns)?e.cleanAfterEveryBuildPatterns:[],this.cleanOnceBeforeBuildPatterns=Array.isArray(e.cleanOnceBeforeBuildPatterns)?e.cleanOnceBeforeBuildPatterns:["**/*"],this.currentAssets=[],this.initialClean=!1,this.outputPath="",this.apply=this.apply.bind(this),this.handleInitial=this.handleInitial.bind(this),this.handleDone=this.handleDone.bind(this),this.removeFiles=this.removeFiles.bind(this)}apply(e){if(!e.options.output||!e.options.output.path)return void logger.warn("clean-webpack-plugin: options.output.path not defined. Plugin disabled...",moduleName);this.outputPath=e.options.output.path;const t=e.hooks;0!==this.cleanOnceBeforeBuildPatterns.length&&t.emit.tap("clean-webpack-plugin",(e=>{this.handleInitial(e)})),t.done.tap("clean-webpack-plugin",(e=>{logger.info("start clean cache..."),this.handleDone(e)}))}handleInitial(e){if(this.initialClean)return;e.getStats().hasErrors()||(this.initialClean=!0,this.removeFiles(this.cleanOnceBeforeBuildPatterns))}handleDone(e){if(e.hasErrors())return void(this.verbose&&logger.warn("clean-webpack-plugin: pausing due to webpack errors",moduleName));const t=(e.toJson({assets:!0}).assets||[]).map((e=>e.name)),s=this.currentAssets.filter((e=>!1===t.includes(e)));this.currentAssets=t.sort();const i=[];!0===this.cleanStaleWebpackAssets&&0!==s.length&&i.push(...s),0!==this.cleanAfterEveryBuildPatterns.length&&i.push(...this.cleanAfterEveryBuildPatterns),0!==i.length&&this.removeFiles(i)}removeFiles(e){try{const t=fileWalkSync(e,{absolute:!0,unique:!0,cwd:this.outputPath,dot:!0,ignore:this.protectWebpackAssets?this.currentAssets:[]});for(const e of t)rmSync(e,{force:!0,recursive:!0});this.verbose&&t.forEach((e=>{const t=relative(this.projectCwd,e);logger.debug(`clean-webpack-plugin: removed ${t}`,moduleName)}))}catch(e){if(/Cannot delete files\/folders outside the current working directory\./.test(e.message)){throw new Error("clean-webpack-plugin: Cannot delete files/folders outside the current working directory. Can be overridden with the `dangerouslyAllowCleanPatternsOutsideProject` option.")}throw e}}}
1
+ import{rmSync}from"node:fs";import{relative}from"node:path";import{fileWalkSync}from"@armit/file-utility";import{logger}from"@flatjs/common";import{moduleName}from"../../../constants.js";export class CleanWebpackPlugin{constructor(e={}){this.verbose=!0===e.verbose||!1,this.projectCwd=e.projectCwd||process.cwd(),this.cleanStaleWebpackAssets=!0!==e.cleanStaleWebpackAssets&&!1!==e.cleanStaleWebpackAssets||e.cleanStaleWebpackAssets,this.protectWebpackAssets=!0!==e.protectWebpackAssets&&!1!==e.protectWebpackAssets||e.protectWebpackAssets,this.cleanAfterEveryBuildPatterns=Array.isArray(e.cleanAfterEveryBuildPatterns)?e.cleanAfterEveryBuildPatterns:[],this.cleanOnceBeforeBuildPatterns=Array.isArray(e.cleanOnceBeforeBuildPatterns)?e.cleanOnceBeforeBuildPatterns:["**/*"],this.currentAssets=[],this.initialClean=!1,this.outputPath="",this.apply=this.apply.bind(this),this.handleInitial=this.handleInitial.bind(this),this.handleDone=this.handleDone.bind(this),this.removeFiles=this.removeFiles.bind(this)}apply(e){if(!e.options.output||!e.options.output.path)return void logger.warn("clean-webpack-plugin: options.output.path not defined. Plugin disabled...",moduleName);this.outputPath=e.options.output.path;const t=e.hooks;0!==this.cleanOnceBeforeBuildPatterns.length&&t.emit.tap("clean-webpack-plugin",e=>{this.handleInitial(e)}),t.done.tap("clean-webpack-plugin",e=>{logger.info("start clean cache..."),this.handleDone(e)})}handleInitial(e){if(this.initialClean)return;e.getStats().hasErrors()||(this.initialClean=!0,this.removeFiles(this.cleanOnceBeforeBuildPatterns))}handleDone(e){if(e.hasErrors())return void(this.verbose&&logger.warn("clean-webpack-plugin: pausing due to webpack errors",moduleName));const t=(e.toJson({assets:!0}).assets||[]).map(e=>e.name),s=this.currentAssets.filter(e=>!1===t.includes(e));this.currentAssets=t.sort();const i=[];!0===this.cleanStaleWebpackAssets&&0!==s.length&&i.push(...s),0!==this.cleanAfterEveryBuildPatterns.length&&i.push(...this.cleanAfterEveryBuildPatterns),0!==i.length&&this.removeFiles(i)}removeFiles(e){try{const t=fileWalkSync(e,{absolute:!0,unique:!0,cwd:this.outputPath,dot:!0,ignore:this.protectWebpackAssets?this.currentAssets:[]});for(const e of t)rmSync(e,{force:!0,recursive:!0});this.verbose&&t.forEach(e=>{const t=relative(this.projectCwd,e);logger.debug(`clean-webpack-plugin: removed ${t}`,moduleName)})}catch(e){if(/Cannot delete files\/folders outside the current working directory\./.test(e.message)){throw new Error("clean-webpack-plugin: Cannot delete files/folders outside the current working directory. Can be overridden with the `dangerouslyAllowCleanPatternsOutsideProject` option.")}throw e}}}
@@ -1 +1 @@
1
- import{posix}from"node:path";import{ensureSlash}from"@flatjs/common";import{CleanWebpackPlugin}from"./clean-webpack-plugin.js";export const createCleanWebpackPlugins=(e,n,o)=>e?[]:[new CleanWebpackPlugin({verbose:!0,projectCwd:o.projectCwd,cleanOnceBeforeBuildPatterns:n.map((e=>`${posix.join(ensureSlash(e[0],!0),"**/*")}`))})];
1
+ import{posix}from"node:path";import{ensureSlash}from"@flatjs/common";import{CleanWebpackPlugin}from"./clean-webpack-plugin.js";export const createCleanWebpackPlugins=(e,n,o)=>e?[]:[new CleanWebpackPlugin({verbose:!0,projectCwd:o.projectCwd,cleanOnceBeforeBuildPatterns:n.map(e=>`${posix.join(ensureSlash(e[0],!0),"**/*")}`)})];
@@ -1 +1 @@
1
- import htmlWebpackPlugin from"html-webpack-plugin";const PLUGIN_PREFIX="HtmlInjectScriptWebpackPlugin";export class HtmlInjectScriptWebpackPlugin{constructor(t){this.scripts=t||[]}processScripts(){return this.scripts.filter(Boolean).map((t=>({tagName:"script",innerHTML:t,voidTag:!1,attributes:{},meta:{plugin:"html-inject-script-webpack-plugin"}})))}apply(t){t.hooks.compilation.tap(`${PLUGIN_PREFIX}_compilation`,(t=>{htmlWebpackPlugin.getHooks(t).alterAssetTags.tap(`${PLUGIN_PREFIX}_alterAssetTags`,(t=>(t.assetTags.scripts.unshift(...this.processScripts()),t)))}))}}
1
+ import htmlWebpackPlugin from"html-webpack-plugin";const PLUGIN_PREFIX="HtmlInjectScriptWebpackPlugin";export class HtmlInjectScriptWebpackPlugin{constructor(t){this.scripts=t||[]}processScripts(){return this.scripts.filter(Boolean).map(t=>({tagName:"script",innerHTML:t,voidTag:!1,attributes:{},meta:{plugin:"html-inject-script-webpack-plugin"}}))}apply(t){t.hooks.compilation.tap(`${PLUGIN_PREFIX}_compilation`,t=>{htmlWebpackPlugin.getHooks(t).alterAssetTags.tap(`${PLUGIN_PREFIX}_alterAssetTags`,t=>(t.assetTags.scripts.unshift(...this.processScripts()),t))})}}
@@ -1 +1 @@
1
- import htmlWebpackPlugin from"html-webpack-plugin";import webpack from"webpack";const{Compilation:Compilation}=webpack,PLUGIN_PREFIX="HtmlInlineScriptWebpackPlugin";export class HtmlInlineScriptWebpackPlugin{constructor(t){this.tests=t||[/.+\.js$/]}isFileNeedsToBeInlined(t){return this.tests.some((e=>e.exec(t)))}processScriptTag(t,e,s){if("script"!==s.tagName||!s.attributes?.src)return s;const i=s.attributes.src.replace(t,"");if(!this.isFileNeedsToBeInlined(i))return s;const a=e[i];if(!s)return s;const{src:p,...r}=s.attributes;return{tagName:"script",innerHTML:a.source(),voidTag:!1,attributes:r,meta:{plugin:"html-inline-script-webpack-plugin"}}}apply(t){let e=t.options?.output?.publicPath||"";e&&!e.endsWith("/")&&(e+="/"),t.hooks.compilation.tap(`${PLUGIN_PREFIX}_compilation`,(t=>{htmlWebpackPlugin.getHooks(t).alterAssetTags.tap(`${PLUGIN_PREFIX}_alterAssetTags`,(s=>(s.assetTags.scripts=s.assetTags.scripts.map((s=>this.processScriptTag(e,t.assets,s))),s))),t.hooks.processAssets.tap({name:`${PLUGIN_PREFIX}_PROCESS_ASSETS_STAGE_SUMMARIZE`,stage:Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},(t=>{Object.keys(t).forEach((e=>{this.isFileNeedsToBeInlined(e)&&delete t[e]}))}))}))}}
1
+ import htmlWebpackPlugin from"html-webpack-plugin";import webpack from"webpack";const{Compilation:Compilation}=webpack,PLUGIN_PREFIX="HtmlInlineScriptWebpackPlugin";export class HtmlInlineScriptWebpackPlugin{constructor(t){this.tests=t||[/.+\.js$/]}isFileNeedsToBeInlined(t){return this.tests.some(e=>e.exec(t))}processScriptTag(t,e,s){if("script"!==s.tagName||!s.attributes?.src)return s;const i=s.attributes.src.replace(t,"");if(!this.isFileNeedsToBeInlined(i))return s;const a=e[i];if(!s)return s;const{src:p,...r}=s.attributes;return{tagName:"script",innerHTML:a.source(),voidTag:!1,attributes:r,meta:{plugin:"html-inline-script-webpack-plugin"}}}apply(t){let e=t.options?.output?.publicPath||"";e&&!e.endsWith("/")&&(e+="/"),t.hooks.compilation.tap(`${PLUGIN_PREFIX}_compilation`,t=>{htmlWebpackPlugin.getHooks(t).alterAssetTags.tap(`${PLUGIN_PREFIX}_alterAssetTags`,s=>(s.assetTags.scripts=s.assetTags.scripts.map(s=>this.processScriptTag(e,t.assets,s)),s)),t.hooks.processAssets.tap({name:`${PLUGIN_PREFIX}_PROCESS_ASSETS_STAGE_SUMMARIZE`,stage:Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},t=>{Object.keys(t).forEach(e=>{this.isFileNeedsToBeInlined(e)&&delete t[e]})})})}}
@@ -1 +1 @@
1
- import webpackSources from"webpack-sources";const PLUGIN_NAME="ExternalTemplateRemotesWebpackPlugin",isExternalModule=e=>"ExternalModule"===e.constructor.name;function extractUrlAndGlobal(e){const t=e.indexOf("@");if(t<=0||t===e.length-1)throw new Error(`Invalid request "${e}"`);return[e.substring(t+1),e.substring(0,t)]}export class ExternalTemplateRemotesWebpackPlugin{apply(e){e.hooks.make.tap(PLUGIN_NAME,(e=>{const t=[];e.hooks.buildModule.tap(PLUGIN_NAME,(e=>{isExternalModule(e)&&"script"===e.externalType&&t.push(e)})),e.hooks.afterCodeGeneration.tap(PLUGIN_NAME,(()=>{t.forEach((t=>{const o=extractUrlAndGlobal(t.request)[0],n=toExpression(o),r=e.codeGenerationResults.get(t,void 0).sources,s=r.get("javascript");if(s){const e=new webpackSources.RawSource(s.source().toString().replace(`"${o}"`,n));r.set("javascript",e)}}))}))}))}}function toExpression(e){const t=[],o=[];let n=!1,r=!1;for(const s of e)if("["===s){if(n){r=!0;break}n=!0,o.length&&(t.push(`"${o.join("")}"`),o.length=0)}else if("]"===s){if(!n){r=!0;break}n=!1,o.length&&(t.push(`${o.join("")}`),o.length=0),o.length=0}else o.push(s);if(n||r)throw new Error(`Invalid template URL "${e}"`);return o.length&&t.push(`"${o.join("")}"`),t.join(" + ")}
1
+ import webpackSources from"webpack-sources";const PLUGIN_NAME="ExternalTemplateRemotesWebpackPlugin",isExternalModule=e=>"ExternalModule"===e.constructor.name;function extractUrlAndGlobal(e){const t=e.indexOf("@");if(t<=0||t===e.length-1)throw new Error(`Invalid request "${e}"`);return[e.substring(t+1),e.substring(0,t)]}export class ExternalTemplateRemotesWebpackPlugin{apply(e){e.hooks.make.tap(PLUGIN_NAME,e=>{const t=[];e.hooks.buildModule.tap(PLUGIN_NAME,e=>{isExternalModule(e)&&"script"===e.externalType&&t.push(e)}),e.hooks.afterCodeGeneration.tap(PLUGIN_NAME,()=>{t.forEach(t=>{const o=extractUrlAndGlobal(t.request)[0],n=toExpression(o),r=e.codeGenerationResults.get(t,void 0).sources,s=r.get("javascript");if(s){const e=new webpackSources.RawSource(s.source().toString().replace(`"${o}"`,n));r.set("javascript",e)}})})})}}function toExpression(e){const t=[],o=[];let n=!1,r=!1;for(const s of e)if("["===s){if(n){r=!0;break}n=!0,o.length&&(t.push(`"${o.join("")}"`),o.length=0)}else if("]"===s){if(!n){r=!0;break}n=!1,o.length&&(t.push(`${o.join("")}`),o.length=0),o.length=0}else o.push(s);if(n||r)throw new Error(`Invalid template URL "${e}"`);return o.length&&t.push(`"${o.join("")}"`),t.join(" + ")}
@@ -1 +1 @@
1
- import{join}from"node:path";import webpack from"webpack";import{ensureSlash}from"@flatjs/common";import{normalizeEvolveEntryName}from"../../../helpers/normalize-entry-map.js";import{injectFederationScripts}from"../../../helpers/script-injects.js";import{HtmlInjectScriptWebpackPlugin}from"../html-inject-scripts/index.js";import{ExternalTemplateRemotesWebpackPlugin}from"./external-template-remotes-webpack-plugin.js";const normalizeWidgetName=(e="")=>e.replace(/[/-]/g,"_").toLowerCase(),remoteFileName=e=>join(e,"micro-remote-module.js");export const createModuleFederationWebpackPlugins=(e,t,o)=>{const r=o.projectVirtualPath,n=o.multiHtmlCdn,i=o.multiHtmlCdnEnvResolver,m=[];for(const o of t){const[t,a]=o,l=a.options?.moduleFederation;if(l){const{remotes:o,exposes:a,...s}=l,p=remoteFileName(t),c=normalizeWidgetName(t),u=(a?Array.isArray(a)?a:[a]:[]).map((e=>{const o={};for(const[r,n]of Object.entries(e))o[r]={...n,name:join(t,n.name.replace(/^\//,""))};return o})),d=(o||[]).map((({name:e,endpoint:t})=>{const o=normalizeEvolveEntryName(e,r),n=normalizeWidgetName(o),i=remoteFileName(o),m=t?ensureSlash(t(e,o),!1):"[window.evolveFetchMicroWidgets()]";return{[n]:`${n}@${m}/${i}`}}));m.push(new webpack.container.ModuleFederationPlugin({...s,name:c,filename:p,remotes:d,exposes:u}),new ExternalTemplateRemotesWebpackPlugin),e||m.unshift(new HtmlInjectScriptWebpackPlugin([injectFederationScripts(n,i)]))}}return m};
1
+ import{join}from"node:path";import webpack from"webpack";import{ensureSlash}from"@flatjs/common";import{normalizeEvolveEntryName}from"../../../helpers/normalize-entry-map.js";import{injectFederationScripts}from"../../../helpers/script-injects.js";import{HtmlInjectScriptWebpackPlugin}from"../html-inject-scripts/index.js";import{ExternalTemplateRemotesWebpackPlugin}from"./external-template-remotes-webpack-plugin.js";const normalizeWidgetName=(e="")=>e.replace(/[/-]/g,"_").toLowerCase(),remoteFileName=e=>join(e,"micro-remote-module.js");export const createModuleFederationWebpackPlugins=(e,t,o)=>{const r=o.projectVirtualPath,n=o.multiHtmlCdn,i=o.multiHtmlCdnEnvResolver,m=[];for(const o of t){const[t,a]=o,l=a.options?.moduleFederation;if(l){const{remotes:o,exposes:a,...s}=l,p=remoteFileName(t),c=normalizeWidgetName(t),u=(a?Array.isArray(a)?a:[a]:[]).map(e=>{const o={};for(const[r,n]of Object.entries(e))o[r]={...n,name:join(t,n.name.replace(/^\//,""))};return o}),d=(o||[]).map(({name:e,endpoint:t})=>{const o=normalizeEvolveEntryName(e,r),n=normalizeWidgetName(o),i=remoteFileName(o),m=t?ensureSlash(t(e,o),!1):"[window.evolveFetchMicroWidgets()]";return{[n]:`${n}@${m}/${i}`}});m.push(new webpack.container.ModuleFederationPlugin({...s,name:c,filename:p,remotes:d,exposes:u}),new ExternalTemplateRemotesWebpackPlugin),e||m.unshift(new HtmlInjectScriptWebpackPlugin([injectFederationScripts(n,i)]))}}return m};
@@ -1 +1 @@
1
- import HtmlWebpackPlugin from"html-webpack-plugin";import{basename}from"node:path";import webpack from"webpack";import{ensureSlash}from"@flatjs/common";import{getRuntimeCDNBase}from"../../../helpers/get-runtime-cdn-base.js";import{findEnvCdn,httpUrlJoin}from"../../../helpers/script-injects.js";export class FlatEvolveMultiCdnWebpackPlugin{constructor(e){if(this.pluginName="FlatEvolveMultiCdnWebpackPlugin",this.requireFn=webpack.RuntimeGlobals.publicPath,this.config=e.multiHtmlCdn,this.cdnResolver=e.multiHtmlCdnEnvResolver||function cdnResolver(){},!this.config?.prod)throw new Error("We must setup `prod` for each CDN config node!")}apply(e){e.hooks.thisCompilation.tap(this.pluginName,(e=>{e.mainTemplate.hooks.requireExtensions.tap(this.pluginName,((t,n)=>{const s=[];s.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const i=e.chunkGraph?.getTreeRuntimeRequirements(n);return i&&i.has(webpack.RuntimeGlobals.requireScope)&&s.push(webpack.Template.indent(getRuntimeCDNBase(this.config,this.cdnResolver,this.requireFn))),webpack.Template.asString(s)}))})),e.hooks.compilation.tap(this.pluginName,(e=>{HtmlWebpackPlugin.getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,(e=>{const{assets:t,plugin:n,outputName:s}=e,i=n?.options?.chunks||[],r=Array.isArray(i)?i.find((e=>s.includes(ensureSlash(e,!0)))):i,{userOptions:a}=e.plugin;if(!r)throw new Error("We must have current chunk!");const o=t.js.filter((e=>e.includes(ensureSlash(r,!0)))),l=t.css.filter((e=>e.includes(ensureSlash(r,!0)))),p=a.multiCdn,u=t.publicPath,c=o.map((e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))})),m=l.map((e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))}));return e.assets.js=c,e.assets.css=m,e}))}))}}
1
+ import HtmlWebpackPlugin from"html-webpack-plugin";import{basename}from"node:path";import webpack from"webpack";import{ensureSlash}from"@flatjs/common";import{getRuntimeCDNBase}from"../../../helpers/get-runtime-cdn-base.js";import{findEnvCdn,httpUrlJoin}from"../../../helpers/script-injects.js";export class FlatEvolveMultiCdnWebpackPlugin{constructor(e){if(this.pluginName="FlatEvolveMultiCdnWebpackPlugin",this.requireFn=webpack.RuntimeGlobals.publicPath,this.config=e.multiHtmlCdn,this.cdnResolver=e.multiHtmlCdnEnvResolver||function cdnResolver(){},!this.config?.prod)throw new Error("We must setup `prod` for each CDN config node!")}apply(e){e.hooks.thisCompilation.tap(this.pluginName,e=>{e.mainTemplate.hooks.requireExtensions.tap(this.pluginName,(t,n)=>{const s=[];s.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const i=e.chunkGraph?.getTreeRuntimeRequirements(n);return i&&i.has(webpack.RuntimeGlobals.requireScope)&&s.push(webpack.Template.indent(getRuntimeCDNBase(this.config,this.cdnResolver,this.requireFn))),webpack.Template.asString(s)})}),e.hooks.compilation.tap(this.pluginName,e=>{HtmlWebpackPlugin.getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,e=>{const{assets:t,plugin:n,outputName:s}=e,i=n?.options?.chunks||[],r=Array.isArray(i)?i.find(e=>s.includes(ensureSlash(e,!0))):i,{userOptions:a}=e.plugin;if(!r)throw new Error("We must have current chunk!");const o=t.js.filter(e=>e.includes(ensureSlash(r,!0))),l=t.css.filter(e=>e.includes(ensureSlash(r,!0))),p=a.multiCdn,u=t.publicPath,c=o.map(e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))}),m=l.map(e=>{if(p.disabled)return basename(e);const t=findEnvCdn(this.config,p.env);return httpUrlJoin(t,e.replace(u,""))});return e.assets.js=c,e.assets.css=m,e})})}}
@@ -1 +1 @@
1
- import HtmlWebpackPlugin from"html-webpack-plugin";import{ensureSlash}from"@flatjs/common";const getCurrentEntryOptions=(t=[],e)=>{const i=t.find((t=>e.includes(ensureSlash(t[0],!0))));return i?i[1]?.options:void 0};export class MultiHtmlModifyWebpackPlugin{constructor(t){this.pluginName="MultiHtmlModifyWebpackPlugin",this.entryMapItemList=t}apply(t){t.hooks.compilation.tap(this.pluginName,(t=>{HtmlWebpackPlugin.getHooks(t).beforeEmit.tapAsync(this.pluginName,((t,e)=>{const i=getCurrentEntryOptions(this.entryMapItemList,t.outputName);/<%= title %>/.test(t.html)&&(t.html=t.html.replace(/<%= title %>/g,i?.title||"")),e(null,t)}))}))}}
1
+ import HtmlWebpackPlugin from"html-webpack-plugin";import{ensureSlash}from"@flatjs/common";import{parseTemplate}from"@hyperse/html-webpack-plugin-loader";const getCurrentEntryOptions=(t=[],e)=>{const i=t.find(t=>e.includes(ensureSlash(t[0],!0)));return i?i[1]?.options:void 0};export class MultiHtmlModifyWebpackPlugin{constructor(t){this.pluginName="MultiHtmlModifyWebpackPlugin",this.entryMapItemList=t}apply(t){t.hooks.compilation.tap(this.pluginName,t=>{HtmlWebpackPlugin.getHooks(t).beforeEmit.tapAsync(this.pluginName,(t,e)=>{const i=getCurrentEntryOptions(this.entryMapItemList,t.outputName),l=parseTemplate(t.html,{title:i?.title||""});e(null,{...t,html:l.serialize()})})})}}
@@ -1 +1 @@
1
- import HtmlWebpackPlugin from"html-webpack-plugin";import{existsSync}from"node:fs";import{logger}from"@flatjs/common";import{allowPx2remForModule}from"../../../helpers/allow-px2rem-for-module.js";import{getHtmlPluginConfig}from"../../../helpers/get-html-plugin-config.js";import{normalizeTemplateInjectTokens}from"../../../helpers/normalize-template-inject-tokens.js";import{findEnvCdn}from"../../../helpers/script-injects.js";import{MultiHtmlModifyWebpackPlugin}from"./multi-html-modify-webpack-plugin.js";const minifyOpts={minifyJS:!0,removeComments:!0,collapseWhitespace:!0,collapseBooleanAttributes:!1};export const createMultiHtmlWebpackPlugins=(e,t,l,i)=>{const n=l[0],[,o]=n,m=[new MultiHtmlModifyWebpackPlugin(l)],{options:p}=o,r=e?"development":"production",s=l.map((e=>e[0]));for(const e of i){const l={mode:r,envCdn:findEnvCdn(t.multiHtmlCdn,e)},i=normalizeTemplateInjectTokens(l,p);let o=getHtmlPluginConfig("templatePath",l,p?.templatePath).replace("{0}",e.trim());existsSync(o)||(logger.warn(`The template file ${o} is not exists, use \`prod\` instead!`),o=getHtmlPluginConfig("templatePath",l,p?.templatePath).replace("{0}","prod")),m.push(new HtmlWebpackPlugin({inject:"body",title:getHtmlPluginConfig("title",l,p?.title),chunks:s,minify:!1!==p?.htmlMinify&&!["me","dev"].includes(e)&&minifyOpts,filename:t=>`${t}/index${"prod"===e?"":`-${e}`}.html`,template:o,templateParameters:{title:"<%= title %>",favicon:getHtmlPluginConfig("favicon",l,p?.favicon),viewport:allowPx2remForModule(n,t)?getHtmlPluginConfig("viewport",l,p?.viewport):"",...i},multiCdn:{env:e,disabled:(p?.excludeCdnEnvs||["me","dev","ntv"]).includes(e)}}))}return m};
1
+ import HtmlWebpackPlugin from"html-webpack-plugin";import{existsSync}from"node:fs";import{logger,requireResolve}from"@flatjs/common";import{allowPx2remForModule}from"../../../helpers/allow-px2rem-for-module.js";import{getHtmlPluginConfig}from"../../../helpers/get-html-plugin-config.js";import{normalizeTemplateInjectTokens}from"../../../helpers/normalize-template-inject-tokens.js";import{findEnvCdn}from"../../../helpers/script-injects.js";import{MultiHtmlModifyWebpackPlugin}from"./multi-html-modify-webpack-plugin.js";const minifyOpts={minifyJS:!0,removeComments:!0,collapseWhitespace:!0,collapseBooleanAttributes:!1};export const createMultiHtmlWebpackPlugins=(e,t,l,i)=>{const n=l[0],[,o]=n,m=[new MultiHtmlModifyWebpackPlugin(l)],{options:r}=o,p=e?"development":"production",s=l.map(e=>e[0]);for(const e of i){const l={mode:p,envCdn:findEnvCdn(t.multiHtmlCdn,e)},i=normalizeTemplateInjectTokens(l,r),o=i?.headInlineScripts||[];if(allowPx2remForModule(n,t)){const e=getHtmlPluginConfig("viewport",l,r?.viewport);o.unshift({id:"viewport",content:e,position:"end"})}let a=getHtmlPluginConfig("templatePath",l,r?.templatePath).replace("{0}",e.trim());existsSync(a)||(logger.warn(`The template file ${a} is not exists, use \`prod\` instead!`),a=getHtmlPluginConfig("templatePath",l,r?.templatePath).replace("{0}","prod"));a=`${requireResolve(import.meta.url,"@hyperse/html-webpack-plugin-loader/loader")}!${a}`,m.push(new HtmlWebpackPlugin({inject:"body",title:getHtmlPluginConfig("title",l,r?.title),chunks:s,minify:!1!==r?.htmlMinify&&!["me","dev"].includes(e)&&minifyOpts,filename:t=>`${t}/index${"prod"===e?"":`-${e}`}.html`,template:a,templateParameters:{title:"",...i,headInlineScripts:o},multiCdn:{env:e,disabled:(r?.excludeCdnEnvs||["me","dev","ntv"]).includes(e)}}))}return m};
@@ -1 +1 @@
1
- import{createWriteStream}from"node:fs";import{Readable}from"node:stream";export class StatsSerializeStream extends Readable{constructor(e){super(),this.indentLevel=0,this.stringifier=this._stringify(e)}get indent(){return" ".repeat(this.indentLevel)}_read(){let e=!0;for(;e;){const{value:t,done:i}=this.stringifier.next();i?(this.push(null),e=!1):e=this.push(t)}}*_stringify(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e||null===e)yield JSON.stringify(e);else if(Array.isArray(e)){yield"[",this.indentLevel++;let t=!0;for(let i of e)void 0===i&&(i=null),yield`${t?"":","}\n${this.indent}`,yield*this._stringify(i),t=!1;this.indentLevel--,yield e.length?`\n${this.indent}]`:"]"}else{yield"{",this.indentLevel++;let t=!0;const i=Object.entries(e);for(const[e,n]of i)void 0!==n&&(yield`${t?"":","}\n${this.indent}${JSON.stringify(e)}: `,yield*this._stringify(n),t=!1);this.indentLevel--,yield i.length?`\n${this.indent}}`:"}"}}}export const writeStats=(e,t)=>new Promise(((i,n)=>{new StatsSerializeStream(e).on("end",i).on("error",n).pipe(createWriteStream(t))}));
1
+ import{createWriteStream}from"node:fs";import{Readable}from"node:stream";export class StatsSerializeStream extends Readable{constructor(e){super(),this.indentLevel=0,this.stringifier=this._stringify(e)}get indent(){return" ".repeat(this.indentLevel)}_read(){let e=!0;for(;e;){const{value:t,done:i}=this.stringifier.next();i?(this.push(null),e=!1):e=this.push(t)}}*_stringify(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e||null===e)yield JSON.stringify(e);else if(Array.isArray(e)){yield"[",this.indentLevel++;let t=!0;for(let i of e)void 0===i&&(i=null),yield`${t?"":","}\n${this.indent}`,yield*this._stringify(i),t=!1;this.indentLevel--,yield e.length?`\n${this.indent}]`:"]"}else{yield"{",this.indentLevel++;let t=!0;const i=Object.entries(e);for(const[e,n]of i)void 0!==n&&(yield`${t?"":","}\n${this.indent}${JSON.stringify(e)}: `,yield*this._stringify(n),t=!1);this.indentLevel--,yield i.length?`\n${this.indent}}`:"}"}}}export const writeStats=(e,t)=>new Promise((i,n)=>{new StatsSerializeStream(e).on("end",i).on("error",n).pipe(createWriteStream(t))});
@@ -1 +1 @@
1
- import{rmSync}from"node:fs";import{mkdir}from"node:fs/promises";import{dirname,join,resolve}from"node:path";import{logger}from"@flatjs/common";import{webpackStatsDir}from"../../../constants.js";import{getStatsFileName}from"../../../helpers/get-stats-file-name.js";import{writeStats}from"./helper-write-stats.js";export class StatsWebpackPlugin{constructor(t={}){this.verbose=!0===t.verbose||!1,this.projectCwd=t.projectCwd||process.cwd(),this.outputPath=join(this.projectCwd,webpackStatsDir)}apply(t){this.handleBeforeClean();t.hooks.done.tapAsync("stats-webpack-plugin",((t,e)=>{this.statsFilename=getStatsFileName(t),this.handleDone(t,e)}))}handleBeforeClean(){rmSync(this.outputPath,{force:!0,recursive:!0})}async handleDone(t,e){try{await this.generateStatsFile(t.toJson()),e()}catch(t){e(t)}}async generateStatsFile(t){const e=resolve(this.outputPath,this.statsFilename);await mkdir(dirname(e),{recursive:!0});try{await writeStats(t,e),this.verbose&&logger.debug(`stats-webpack-plugin: saved stats file to ${e}`)}catch(t){this.verbose&&logger.error(`stats-webpack-plugin: error saving stats file to ${e}: ${t}`)}}}
1
+ import{rmSync}from"node:fs";import{mkdir}from"node:fs/promises";import{dirname,join,resolve}from"node:path";import{logger}from"@flatjs/common";import{webpackStatsDir}from"../../../constants.js";import{getStatsFileName}from"../../../helpers/get-stats-file-name.js";import{writeStats}from"./helper-write-stats.js";export class StatsWebpackPlugin{constructor(t={}){this.verbose=!0===t.verbose||!1,this.projectCwd=t.projectCwd||process.cwd(),this.outputPath=join(this.projectCwd,webpackStatsDir)}apply(t){this.handleBeforeClean();t.hooks.done.tapAsync("stats-webpack-plugin",(t,e)=>{this.statsFilename=getStatsFileName(t),this.handleDone(t,e)})}handleBeforeClean(){rmSync(this.outputPath,{force:!0,recursive:!0})}async handleDone(t,e){try{await this.generateStatsFile(t.toJson()),e()}catch(t){e(t)}}async generateStatsFile(t){const e=resolve(this.outputPath,this.statsFilename);await mkdir(dirname(e),{recursive:!0});try{await writeStats(t,e),this.verbose&&logger.debug(`stats-webpack-plugin: saved stats file to ${e}`)}catch(t){this.verbose&&logger.error(`stats-webpack-plugin: error saving stats file to ${e}: ${t}`)}}}
@@ -1 +1 @@
1
- import{dirname,join,relative,resolve}from"node:path";import{ensureSlash,normalizePlatformPath}from"@flatjs/common";import{ICON_PATH_REGEX}from"./constants.js";export const isIconSvg=t=>ICON_PATH_REGEX.test(t)&&t.endsWith(".svg");export const getEntryAssetFileName=(t,e,r)=>{const{projectCwd:o,projectVirtualPath:n}=r;let s=dirname(join(n,t.replace(/^src/,"")));const a=[];for(const[t,r]of e)for(const e of r.entry)a.push({entryName:t,entry:e});a.sort(((t,e)=>e.entry.length-t.entry.length));for(const e of a){const{entryName:r,entry:n}=e,a=dirname(join(o,n)),i=resolve(o,t);if(i.startsWith(ensureSlash(a,!0,!0))){s=dirname(join(r,relative(a,i)));break}}return`${normalizePlatformPath(s)}/[name]-[contenthash:8][ext]`};
1
+ import{dirname,join,relative,resolve}from"node:path";import{ensureSlash,normalizePlatformPath}from"@flatjs/common";import{ICON_PATH_REGEX}from"./constants.js";export const isIconSvg=t=>ICON_PATH_REGEX.test(t)&&t.endsWith(".svg");export const getEntryAssetFileName=(t,e,r)=>{const{projectCwd:o,projectVirtualPath:n}=r;let s=dirname(join(n,t.replace(/^src/,"")));const a=[];for(const[t,r]of e)for(const e of r.entry)a.push({entryName:t,entry:e});a.sort((t,e)=>e.entry.length-t.entry.length);for(const e of a){const{entryName:r,entry:n}=e,a=dirname(join(o,n)),i=resolve(o,t);if(i.startsWith(ensureSlash(a,!0,!0))){s=dirname(join(r,relative(a,i)));break}}return`${normalizePlatformPath(s)}/[name]-[contenthash:8][ext]`};
@@ -29,13 +29,6 @@ export interface EvolveEntryItemOption extends MultiHtmlCDNEntryItem {
29
29
  hostUri: string;
30
30
  virtualPath: string;
31
31
  }) => string;
32
- /**
33
- * For `serve`
34
- * Customized module template to proxy the modules template.
35
- * If providered, it must be an absolute path. path.join(__dirname, `templates/module.html`)
36
- * Normally it will find file `${projectCwd}/templates/module.html` automatically
37
- */
38
- serveModuleTemplate?: string;
39
32
  /**
40
33
  * For `serve`
41
34
  * Attach fixed global data for specificed entry.
@@ -1,3 +1,4 @@
1
+ import type { TemplateOptions } from '@hyperse/html-webpack-plugin-loader';
1
2
  import { type HtmlPluginConfigTokenType } from '../helpers/get-html-plugin-config.js';
2
3
  export declare type EvolveMultiCdnEnvType = 'me' | 'dev' | 'uat' | 'inte' | 'inte2' | 'inte3' | 'inte4' | 'rc' | 'prod' | 'ntv';
3
4
  export type EvolveMultiCDNConfig = {
@@ -11,16 +12,6 @@ export type EvolveMultiCDNEnvResolver = (url: string) => EvolveMultiCdnEnvType |
11
12
  * The html plugin configuration for each entry item
12
13
  */
13
14
  export type MultiHtmlCDNEntryItem = {
14
- /**
15
- * The title to use for the generated HTML document
16
- * @default ''
17
- */
18
- title?: string;
19
- /**
20
- * The favicon url to use for the generated HTML document
21
- * Should be an path of (32 x 32).png
22
- */
23
- favicon?: string;
24
15
  /**
25
16
  * webpack relative or absolute path to the template.
26
17
  * It must be an absolute path. `path.join(__dirname, `templates/index-{0}.html`)`
@@ -35,40 +26,51 @@ export type MultiHtmlCDNEntryItem = {
35
26
  /**
36
27
  * Support inject viewport scripts in each modules
37
28
  * It only available while `allowPx2rem` = true
29
+ *
30
+ * This script will be injected into headInlineScripts of the html file, position is 'beginning'.
38
31
  * @default ''
39
32
  */
40
33
  viewport?: string;
41
34
  /**
42
- * Allow us customized inline scripts into compiled html template.
35
+ * The title to use for the generated HTML document
36
+ * @default ''
37
+ */
38
+ title?: string;
39
+ /**
40
+ * The favicon url to use for the generated HTML document
41
+ * Should be an path of (32 x 32).png
42
+ */
43
+ favicon?: HtmlPluginConfigTokenType<TemplateOptions['favicon']>;
44
+ /**
45
+ * Allow us customized head meta tags into compiled html template.
43
46
  * @default []
44
47
  */
45
- inlineScripts?: HtmlPluginConfigTokenType<string[]>;
48
+ headMetaTags?: HtmlPluginConfigTokenType<TemplateOptions['headMetaTags']>;
46
49
  /**
47
- * The customized html tags should be inject to `<header />`
50
+ * The head styles of the page
51
+ * @default []
48
52
  */
49
- headBeforeHtmlTags?: HtmlPluginConfigTokenType<string[]>;
53
+ headStyles?: HtmlPluginConfigTokenType<TemplateOptions['headStyles']>;
50
54
  /**
51
- * The ordered styles will be injected start of html head.
55
+ * The head scripts of the page
52
56
  * @default []
53
57
  */
54
- headBeforeStyles?: HtmlPluginConfigTokenType<string[]>;
58
+ headScripts?: HtmlPluginConfigTokenType<TemplateOptions['headScripts']>;
55
59
  /**
56
- * The ordered scripts will be injected before html head.
57
- * Note in `serve` mode we will auto remove `react`,`react-dom`('react.development.js', 'react-dom.development.js') from CDN, and use internal inject to enable `HMR`
58
- * Or you must use `react devTool` chrome extension.
59
- * @default [
60
- * `https://polyfill.io/v3/polyfill.min.js?features=Array.from%2CArray.isArray%2CArray.of%2CArray.prototype.entries%2CArray.prototype.every%2CArray.prototype.fill%2CArray.prototype.filter%2CArray.prototype.find%2CArray.prototype.findIndex%2CArray.prototype.flat%2CArray.prototype.forEach%2CArray.prototype.flatMap%2CArray.prototype.keys%2CArray.prototype.indexOf%2CArray.prototype.includes%2CArray.prototype.lastIndexOf%2CArray.prototype.map%2CArray.prototype.reduce%2CArray.prototype.reduceRight%2CArray.prototype.some%2CArray.prototype.sort%2CArray.prototype.values%2CArrayBuffer%2CBlob%2CDataView%2CDate.now%2CObject.assign%2CObject.create%2CObject.defineProperties%2CObject.defineProperty%2CObject.entries%2CObject.freeze%2CObject.fromEntries%2CObject.getOwnPropertySymbols%2CObject.getOwnPropertyNames%2CObject.getOwnPropertyDescriptors%2CObject.getOwnPropertyDescriptor%2CObject.getPrototypeOf%2CObject.is%2CObject.isExtensible%2CObject.isFrozen%2CObject.isSealed%2CObject.keys%2CObject.values%2CObject.setPrototypeOf%2CPromise%2CPromise.prototype.finally%2CReflect%2CReflect.apply%2CReflect.construct%2CReflect.defineProperty%2CReflect.deleteProperty%2CReflect.getPrototypeOf%2CReflect.getOwnPropertyDescriptor%2CReflect.get%2CReflect.ownKeys%2CReflect.isExtensible%2CReflect.has%2CReflect.preventExtensions%2CReflect.set%2CReflect.setPrototypeOf%2CSet%2CString.prototype.trimStart%2CString.prototype.trimEnd%2CString.prototype.trim%2CString.prototype.startsWith%2CString.prototype.repeat%2CString.prototype.replaceAll%2CString.prototype.padStart%2CString.prototype.padEnd%2CMap%2CObject.seal%2Cconsole.groupEnd%2Cconsole.group`,
61
- * `https://unpkg.com/react@17.0.2/umd/react.production.min.js`,
62
- * `https://unpkg.com/react-dom@17.0.2/umd/react-dom.production.min.js`,
63
- * `https://unpkg.com/react-router-dom@5.2.0/umd/react-router-dom.min.js`
64
- * ]
60
+ * The body scripts of the page
61
+ * @default []
62
+ */
63
+ bodyScripts?: HtmlPluginConfigTokenType<TemplateOptions['bodyScripts']>;
64
+ /**
65
+ * The head inline scripts of the page
66
+ * @default []
65
67
  */
66
- headBeforeScripts?: HtmlPluginConfigTokenType<string[]>;
68
+ headInlineScripts?: HtmlPluginConfigTokenType<TemplateOptions['headInlineScripts']>;
67
69
  /**
68
- * The ordered scripts will be injected end of html body.
70
+ * The head inline styles of the page
69
71
  * @default []
70
72
  */
71
- bodyAfterScripts?: HtmlPluginConfigTokenType<string[]>;
73
+ headInlineStyles?: HtmlPluginConfigTokenType<TemplateOptions['headInlineStyles']>;
72
74
  /**
73
75
  * Give `env` list to exclude from `multi-cdn` plugin.
74
76
  * Normally for `me`, `dev`,`uat`, `ntv` env we should use relative assets path instead cdn.
@@ -72,17 +72,11 @@ export interface FlatEvolveWebpackOptions extends Pick<Configuration, 'infrastru
72
72
  */
73
73
  externalsType?: Configuration['externalsType'];
74
74
  /**
75
- * @default
76
- * ```json
77
- * {
78
- * vue: 'Vue',
79
- * react: 'React',
80
- * 'react-dom': 'ReactDOM',
81
- * }
82
- * ```
75
+ * @default {}
83
76
  *
84
77
  * @example
85
78
  * ```ts
79
+ * // For React 18 support, manually add:
86
80
  * externals: () => ({
87
81
  * vue: 'Vue',
88
82
  * react: 'React',
@@ -91,6 +85,8 @@ export interface FlatEvolveWebpackOptions extends Pick<Configuration, 'infrastru
91
85
  * ```
92
86
  *
93
87
  * If use function, it will be override default externals.
88
+ * Note: React 19 is supported by default, no need to configure externals for React.
89
+ * For React 18 support, you need to manually add the externals configuration.
94
90
  */
95
91
  externals?: Record<string, string> | (() => Record<string, string>);
96
92
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "2.3.2-next.5",
3
+ "version": "3.0.0-next.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -42,12 +42,12 @@
42
42
  "typecheck": "tsc --project ./tsconfig.json --noEmit"
43
43
  },
44
44
  "dependencies": {
45
- "@armit/babel-merge": "^0.2.11",
46
- "@armit/file-utility": "^0.2.11",
47
- "@armit/git": "^0.2.11",
48
- "@armit/package": "^0.2.15",
49
- "@babel/core": "^7.26.10",
50
- "@clack/prompts": "^0.10.1",
45
+ "@armit/babel-merge": "^0.3.0",
46
+ "@armit/file-utility": "^0.3.0",
47
+ "@armit/git": "^0.3.0",
48
+ "@armit/package": "^0.3.0",
49
+ "@babel/core": "^7.27.4",
50
+ "@clack/prompts": "^0.11.0",
51
51
  "@discoveryjs/json-ext": "0.6.3",
52
52
  "@flatjs/babel-plugin-import": "2.2.9-next.4",
53
53
  "@flatjs/common": "2.2.4-next.1",
@@ -58,15 +58,16 @@
58
58
  "@flatjs/mock": "2.4.1-next.4",
59
59
  "@flatjs/swc-plugin-import": "1.0.0-next.4",
60
60
  "@hyperse/config-loader": "^1.0.5",
61
- "@hyperse/inspector": "^1.1.6",
62
- "@hyperse/inspector-babel-plugin": "^1.1.5",
61
+ "@hyperse/html-webpack-plugin-loader": "^1.0.6",
62
+ "@hyperse/inspector": "^1.1.8",
63
+ "@hyperse/inspector-babel-plugin": "^1.1.6",
63
64
  "@hyperse/inspector-common": "^1.1.3",
64
- "@hyperse/inspector-middleware": "^1.1.5",
65
+ "@hyperse/inspector-middleware": "^1.1.6",
65
66
  "@hyperse/inspector-swc-plugin": "^1.1.7",
66
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.16",
67
- "@rsdoctor/rspack-plugin": "^1.1.2",
68
- "@rspack/core": "^1.3.13",
69
- "@rspack/dev-server": "^1.1.2",
67
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.6.0",
68
+ "@rsdoctor/rspack-plugin": "^1.1.3",
69
+ "@rspack/core": "^1.3.15",
70
+ "@rspack/dev-server": "^1.1.3",
70
71
  "@rspack/plugin-react-refresh": "^1.4.3",
71
72
  "@swc/helpers": "^0.5.17",
72
73
  "@types/babel__core": "^7.20.5",
@@ -76,45 +77,42 @@
76
77
  "chokidar": "^4.0.3",
77
78
  "ci-info": "^4.2.0",
78
79
  "css-loader": "^7.1.2",
79
- "cssnano": "^7.0.6",
80
+ "cssnano": "^7.0.7",
80
81
  "express": "^5.1.0",
81
82
  "fast-glob": "^3.3.3",
82
- "happy-dom": "^17.4.4",
83
+ "happy-dom": "^18.0.1",
83
84
  "html-webpack-plugin": "^5.6.3",
84
85
  "image-minimizer-webpack-plugin": "^4.1.3",
85
86
  "less": "^4.3.0",
86
- "less-loader": "^12.2.0",
87
+ "less-loader": "^12.3.0",
87
88
  "listr": "^0.14.3",
88
89
  "lodash": "^4.17.21",
89
90
  "log-update": "^6.1.0",
90
91
  "mini-css-extract-plugin": "^2.9.2",
91
- "postcss": "^8.5.3",
92
+ "postcss": "^8.5.6",
92
93
  "postcss-loader": "^8.1.1",
93
94
  "react-refresh": "^0.17.0",
94
95
  "svgo": "^3.3.2",
95
96
  "tarjan-graph": "^3.0.0",
96
97
  "terser-webpack-plugin": "^5.3.14",
97
- "tinypool": "^1.0.2",
98
+ "tinypool": "^1.1.1",
98
99
  "tsconfig-paths-webpack-plugin": "^4.2.0",
99
- "type-fest": "^4.40.0",
100
+ "type-fest": "^4.41.0",
100
101
  "typescript": "^5.8.3",
101
- "webpack": "^5.99.6",
102
+ "webpack": "^5.99.9",
102
103
  "webpack-bundle-analyzer": "^4.10.2",
103
- "webpack-dev-server": "^5.2.1",
104
- "webpack-sources": "^3.2.3"
104
+ "webpack-dev-server": "^5.2.2",
105
+ "webpack-sources": "^3.3.2"
105
106
  },
106
107
  "devDependencies": {
107
- "@dimjs/lang": "2.1.1",
108
- "@dimjs/model": "2.1.1",
109
- "@dimjs/model-react": "2.1.1",
110
- "@dimjs/utils": "2.1.2",
111
108
  "@flatjs/testing": "2.2.4-next.1",
112
- "@hyperse/eslint-config-hyperse": "^1.4.1",
113
- "@swc/core": "1.11.21",
114
- "@types/express": "5.0.1",
109
+ "@hyperse/eslint-config-hyperse": "^1.4.5",
110
+ "@swc/core": "1.12.1",
111
+ "@types/express": "5.0.3",
115
112
  "@types/listr": "0.14.9",
116
- "@types/node": "22.14.1",
117
- "eslint": "^9.25.1",
113
+ "@types/node": "24.0.3",
114
+ "@types/react": "19.1.8",
115
+ "eslint": "^9.29.0",
118
116
  "imagemin-gifsicle": "7.0.0",
119
117
  "imagemin-jpegtran": "8.0.0",
120
118
  "imagemin-pngquant": "10.0.0",
@@ -123,7 +121,7 @@
123
121
  "react": "19.1.0",
124
122
  "rimraf": "6.0.1",
125
123
  "vite-tsconfig-paths": "5.1.4",
126
- "vitest": "3.2.2",
124
+ "vitest": "3.2.4",
127
125
  "vue-loader": "17.4.2"
128
126
  },
129
127
  "peerDependencies": {
@@ -1,60 +1,23 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <meta charset="utf-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
6
- <meta http-equiv="Expires" content="0" />
7
- <meta http-equiv="Pragma" content="no-cache" />
8
- <meta http-equiv="Cache-control" content="no-cache" />
9
- <meta http-equiv="Cache" content="no-cache" />
10
- <meta name="format-detection" content="telephone=no,email=no" />
11
- <meta name="mobile-web-app-capable" content="yes" />
12
- <meta name="apple-touch-fullscreen" content="yes" />
13
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+ <meta http-equiv="Expires" content="0">
7
+ <meta http-equiv="Pragma" content="no-cache">
8
+ <meta http-equiv="Cache-control" content="no-cache">
9
+ <meta http-equiv="Cache" content="no-cache">
10
+ <meta name="format-detection" content="telephone=no,email=no">
11
+ <meta name="mobile-web-app-capable" content="yes">
12
+ <meta name="apple-touch-fullscreen" content="yes">
13
+ <meta name="apple-mobile-web-app-status-bar-style" content="black">
14
14
  <meta
15
15
  name="viewport"
16
16
  content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover"
17
- />
18
- <title><%= title %></title>
19
-
20
- <% if (headBeforeHtmlTags) { %>
21
- <% for (let index = 0; index < headBeforeHtmlTags.length; index++) { %>
22
- <%= headBeforeHtmlTags[index] %>
23
- <% } %>
24
- <% } %>
25
- <% if (inlineScripts) { %>
26
- <script>
27
- <% for (let index = 0; index < inlineScripts.length; index++) { %>
28
- <%= inlineScripts[index] %>
29
- <% } %>
30
- </script>
31
- <% } %>
32
- <% if (viewport) { %>
33
- <script>
34
- <%= viewport %>
35
- </script>
36
- <% } %>
37
- <% if (favicon) { %>
38
- <link rel="icon" type="image/png" sizes="32x32" href="<%= favicon %>" />
39
- <% } %>
40
- <% if (headBeforeStyles) { %>
41
- <% for (let index = 0; index < headBeforeStyles.length; index++) { %>
42
- <link href="<%= headBeforeStyles[index] %>" rel="stylesheet" />
43
- <% } %>
44
- <% } %>
45
- <% if (headBeforeScripts) { %>
46
- <% for (let index = 0; index < headBeforeScripts.length; index++) { %>
47
- <script src="<%= headBeforeScripts[index]%>"></script>
48
- <% } %>
49
- <% } %>
17
+ >
50
18
  </head>
51
19
 
52
20
  <body>
53
21
  <div id="app"></div>
54
- <% if (bodyAfterScripts) { %>
55
- <% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
56
- <script src="<%= bodyAfterScripts[index]%>"></script>
57
- <% } %>
58
- <% } %>
59
22
  </body>
60
23
  </html>
@@ -1,60 +1,23 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <meta charset="utf-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
6
- <meta http-equiv="Expires" content="0" />
7
- <meta http-equiv="Pragma" content="no-cache" />
8
- <meta http-equiv="Cache-control" content="no-cache" />
9
- <meta http-equiv="Cache" content="no-cache" />
10
- <meta name="format-detection" content="telephone=no,email=no" />
11
- <meta name="mobile-web-app-capable" content="yes" />
12
- <meta name="apple-touch-fullscreen" content="yes" />
13
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+ <meta http-equiv="Expires" content="0">
7
+ <meta http-equiv="Pragma" content="no-cache">
8
+ <meta http-equiv="Cache-control" content="no-cache">
9
+ <meta http-equiv="Cache" content="no-cache">
10
+ <meta name="format-detection" content="telephone=no,email=no">
11
+ <meta name="mobile-web-app-capable" content="yes">
12
+ <meta name="apple-touch-fullscreen" content="yes">
13
+ <meta name="apple-mobile-web-app-status-bar-style" content="black">
14
14
  <meta
15
15
  name="viewport"
16
16
  content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover"
17
- />
18
- <title><%= title %></title>
19
-
20
- <% if (headBeforeHtmlTags) { %>
21
- <% for (let index = 0; index < headBeforeHtmlTags.length; index++) { %>
22
- <%= headBeforeHtmlTags[index] %>
23
- <% } %>
24
- <% } %>
25
- <% if (inlineScripts) { %>
26
- <script>
27
- <% for (let index = 0; index < inlineScripts.length; index++) { %>
28
- <%= inlineScripts[index] %>
29
- <% } %>
30
- </script>
31
- <% } %>
32
- <% if (viewport) { %>
33
- <script>
34
- <%= viewport %>
35
- </script>
36
- <% } %>
37
- <% if (favicon) { %>
38
- <link rel="icon" type="image/png" sizes="32x32" href="<%= favicon %>" />
39
- <% } %>
40
- <% if (headBeforeStyles) { %>
41
- <% for (let index = 0; index < headBeforeStyles.length; index++) { %>
42
- <link href="<%= headBeforeStyles[index] %>" rel="stylesheet" />
43
- <% } %>
44
- <% } %>
45
- <% if (headBeforeScripts) { %>
46
- <% for (let index = 0; index < headBeforeScripts.length; index++) { %>
47
- <script src="<%= headBeforeScripts[index]%>"></script>
48
- <% } %>
49
- <% } %>
17
+ >
50
18
  </head>
51
19
 
52
20
  <body>
53
21
  <div id="app"></div>
54
- <% if (bodyAfterScripts) { %>
55
- <% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
56
- <script src="<%= bodyAfterScripts[index]%>"></script>
57
- <% } %>
58
- <% } %>
59
22
  </body>
60
23
  </html>
@@ -1,60 +1,23 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <meta charset="utf-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
6
- <meta http-equiv="Expires" content="0" />
7
- <meta http-equiv="Pragma" content="no-cache" />
8
- <meta http-equiv="Cache-control" content="no-cache" />
9
- <meta http-equiv="Cache" content="no-cache" />
10
- <meta name="format-detection" content="telephone=no,email=no" />
11
- <meta name="mobile-web-app-capable" content="yes" />
12
- <meta name="apple-touch-fullscreen" content="yes" />
13
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+ <meta http-equiv="Expires" content="0">
7
+ <meta http-equiv="Pragma" content="no-cache">
8
+ <meta http-equiv="Cache-control" content="no-cache">
9
+ <meta http-equiv="Cache" content="no-cache">
10
+ <meta name="format-detection" content="telephone=no,email=no">
11
+ <meta name="mobile-web-app-capable" content="yes">
12
+ <meta name="apple-touch-fullscreen" content="yes">
13
+ <meta name="apple-mobile-web-app-status-bar-style" content="black">
14
14
  <meta
15
15
  name="viewport"
16
16
  content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover"
17
- />
18
- <title><%= title %></title>
19
-
20
- <% if (headBeforeHtmlTags) { %>
21
- <% for (let index = 0; index < headBeforeHtmlTags.length; index++) { %>
22
- <%= headBeforeHtmlTags[index] %>
23
- <% } %>
24
- <% } %>
25
- <% if (inlineScripts) { %>
26
- <script>
27
- <% for (let index = 0; index < inlineScripts.length; index++) { %>
28
- <%= inlineScripts[index] %>
29
- <% } %>
30
- </script>
31
- <% } %>
32
- <% if (viewport) { %>
33
- <script>
34
- <%= viewport %>
35
- </script>
36
- <% } %>
37
- <% if (favicon) { %>
38
- <link rel="icon" type="image/png" sizes="32x32" href="<%= favicon %>" />
39
- <% } %>
40
- <% if (headBeforeStyles) { %>
41
- <% for (let index = 0; index < headBeforeStyles.length; index++) { %>
42
- <link href="<%= headBeforeStyles[index] %>" rel="stylesheet" />
43
- <% } %>
44
- <% } %>
45
- <% if (headBeforeScripts) { %>
46
- <% for (let index = 0; index < headBeforeScripts.length; index++) { %>
47
- <script src="<%= headBeforeScripts[index]%>"></script>
48
- <% } %>
49
- <% } %>
17
+ >
50
18
  </head>
51
19
 
52
20
  <body>
53
21
  <div id="app"></div>
54
- <% if (bodyAfterScripts) { %>
55
- <% for (let index = 0; index < bodyAfterScripts.length; index++) { %>
56
- <script src="<%= bodyAfterScripts[index]%>"></script>
57
- <% } %>
58
- <% } %>
59
22
  </body>
60
23
  </html>