@flatjs/evolve 3.0.2 → 3.0.4

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.
@@ -42,4 +42,4 @@ export declare const buildProgressSpinnerFrames: string[];
42
42
  /**
43
43
  * The default domain regex for code checker
44
44
  */
45
- export declare const defaultExtractionRule = "https?://[a-zA-Z0-9\\.-]+";
45
+ export declare const defaultExtractionRule: string[];
package/dist/constants.js CHANGED
@@ -1 +1 @@
1
- import process from"node:process";export const moduleName="@flatjs/evolve";export const configFileName="flatjs-evolve";export const viewportScripts='(function(d){var j;var b=1;var i=1;var h=750;var c=100;function e(s,o){var q=d.document;var l=q.documentElement;var k=navigator.userAgent;var m=k.toLowerCase().indexOf("android")>-1;i=d.devicePixelRatio||1;if(i>3){i=3}if(m){i=1}console.log("current devicePixelRatio:",i);l.setAttribute("data-dpr",i.toString());var p=q.querySelector(\'meta[name="viewport"]\');if(!p){b=1/i;p=q.createElement("meta");p.setAttribute("name","viewport");q.head.appendChild(p);p.setAttribute(["content","width=device-width,user-scalable=no,initial-scale=",b,",maximum-scale=",b,",minimum-scale=",b].join(""))}function n(){var t=document.documentElement.clientWidth;j=t/o*(s/i)*i;q.documentElement.style.fontSize=String(j)+"px"}var r;d.addEventListener("resize",function(){clearTimeout(r);r=setTimeout(n,300)},false);d.addEventListener("onload",n,false);n()}e(c,h);window.fabricViewport={currRem:j,currDpr:i,currScale:b,dpiPX2px:function f(k){return parseFloat(k.toString())/j*100+"px"},px2DPIpx:function a(k){return parseFloat(k.toString())/100*j+"px"},px2rem:function g(k){return parseFloat(k.toString())/100+"rem"}}})(window);';export const polyfill=[{id:"polyfill.io/v3/polyfill.min.js",src:"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",position:"end",order:-1}];export const devReactFastRefresh={runtime:"reactRefreshRuntime",reactRefreshSetup:"reactRefreshSetup"};export const ignoreEntryOptionKeys=["title"];export const webpackStatsDir=".cache/stats";export const buildProgressSpinnerFrames="win32"===process.platform?["-","\\","|","/"]:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];export const defaultExtractionRule="https?://[a-zA-Z0-9\\.-]+";
1
+ import process from"node:process";export const moduleName="@flatjs/evolve";export const configFileName="flatjs-evolve";export const viewportScripts='(function(d){var j;var b=1;var i=1;var h=750;var c=100;function e(s,o){var q=d.document;var l=q.documentElement;var k=navigator.userAgent;var m=k.toLowerCase().indexOf("android")>-1;i=d.devicePixelRatio||1;if(i>3){i=3}if(m){i=1}console.log("current devicePixelRatio:",i);l.setAttribute("data-dpr",i.toString());var p=q.querySelector(\'meta[name="viewport"]\');if(!p){b=1/i;p=q.createElement("meta");p.setAttribute("name","viewport");q.head.appendChild(p);p.setAttribute(["content","width=device-width,user-scalable=no,initial-scale=",b,",maximum-scale=",b,",minimum-scale=",b].join(""))}function n(){var t=document.documentElement.clientWidth;j=t/o*(s/i)*i;q.documentElement.style.fontSize=String(j)+"px"}var r;d.addEventListener("resize",function(){clearTimeout(r);r=setTimeout(n,300)},false);d.addEventListener("onload",n,false);n()}e(c,h);window.fabricViewport={currRem:j,currDpr:i,currScale:b,dpiPX2px:function f(k){return parseFloat(k.toString())/j*100+"px"},px2DPIpx:function a(k){return parseFloat(k.toString())/100*j+"px"},px2rem:function g(k){return parseFloat(k.toString())/100+"rem"}}})(window);';export const polyfill=[{id:"polyfill.io/v3/polyfill.min.js",src:"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",position:"end",order:-1}];export const devReactFastRefresh={runtime:"reactRefreshRuntime",reactRefreshSetup:"reactRefreshSetup"};export const ignoreEntryOptionKeys=["title"];export const webpackStatsDir=".cache/stats";export const buildProgressSpinnerFrames="win32"===process.platform?["-","\\","|","/"]:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];export const defaultExtractionRule=["(?:https?:)?\\/\\/(?:[\\w-]+@)?(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,}(?::\\d+)?","(?:https?:)?\\/\\/\\d{1,3}(?:\\.\\d{1,3}){3}(?::\\d+)?"];
@@ -1,4 +1,13 @@
1
1
  import type { Plugin as RspackPlugin } from '@rspack/core';
2
2
  import { type EntryMapItem } from '../../../types/types-entry-map.js';
3
3
  import { type FlatEvolveOptions } from '../../../types/types-options.js';
4
+ /**
5
+ * Create `html-webpack-plugin` for this build, refer to best practices
6
+ *
7
+ * IF serveMode is true, not attach any plugins
8
+ * Otherwise, attach `html-webpack-plugin` and `@flatjs/evolve-plugin-multi-html-cdn`
9
+ *
10
+ * @param buildEntryItem the entries for this `build`
11
+ * @param allEnv
12
+ */
4
13
  export declare const createHtmlRspackPlugins: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => RspackPlugin[];
@@ -1 +1 @@
1
- import{FlatEvolveMultiCdnRspackPlugin}from"./multi-html-cdn-rspack-plugin.js";import{createMultiHtmlRspackPlugins}from"./multi-html-rspack-plugin.js";export const createHtmlRspackPlugins=(t,l,i)=>{const n=[new FlatEvolveMultiCdnRspackPlugin(i,l)],u=l[0];if(t||u[1]?.options?.output?.library)return n;const s=Object.keys(i.multiHtmlCdn);return n.unshift(...createMultiHtmlRspackPlugins(t,i,l,s)),n};
1
+ import{FlatEvolveMultiCdnRspackPlugin}from"./multi-html-cdn-rspack-plugin.js";import{createMultiHtmlRspackPlugins}from"./multi-html-rspack-plugin.js";export const createHtmlRspackPlugins=(t,l,s)=>{const u=[];if(t)return u;const i=Object.keys(s.multiHtmlCdn);return u.push(...createMultiHtmlRspackPlugins(t,s,l,i)),u.push(new FlatEvolveMultiCdnRspackPlugin(s,l)),u};
@@ -1 +1 @@
1
- import HtmlWebpackPlugin from"html-webpack-plugin";import{basename}from"node:path";import{ensureSlash}from"@flatjs/common";import rspack from"@rspack/core";import{getRuntimeCDNBase}from"../../../helpers/get-runtime-cdn-base.js";import{findEnvCdn,httpUrlJoin}from"../../../helpers/script-injects.js";export class FlatEvolveMultiCdnRspackPlugin{constructor(e,t){if(this.pluginName="FlatEvolveMultiCdnRspackPlugin",this.requireFn=rspack.RuntimeGlobals.publicPath,this.config=e.multiHtmlCdn,this.entryMapItemList=t,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.compilation.tap(this.pluginName,e=>{e.hooks.runtimeModule.tap(this.pluginName,(e,t)=>{const s=this.entryMapItemList.find(e=>e[0]===t.name);if("public_path"===e.name&&s){const t=[];t.push("\n"),t.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)"),t.push(getRuntimeCDNBase(this.config,this.cdnResolver,this.requireFn)),e.source.source=Buffer.from(t.join("\n"),"utf-8")}})}),e.hooks.compilation.tap(this.pluginName,e=>{HtmlWebpackPlugin.getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,e=>{const{assets:t,plugin:s,outputName:n}=e,i=s?.options?.chunks||[],r=Array.isArray(i)?i.find(e=>n.includes(ensureSlash(e,!0))):i,{userOptions:o}=e.plugin;if(!r)throw new Error("We must have current chunk!");const a=t.js.filter(e=>e.includes(ensureSlash(r,!0))),l=t.css.filter(e=>e.includes(ensureSlash(r,!0))),u=o.multiCdn,p=t.publicPath,c=a.map(e=>{if(u.disabled)return basename(e);const t=findEnvCdn(this.config,u.env);return httpUrlJoin(t,e.replace(p,""))}),m=l.map(e=>{if(u.disabled)return basename(e);const t=findEnvCdn(this.config,u.env);return httpUrlJoin(t,e.replace(p,""))});return e.assets.js=c,e.assets.css=m,e})})}}
1
+ import HtmlWebpackPlugin from"html-webpack-plugin";import{basename}from"node:path";import{ensureSlash}from"@flatjs/common";import rspack from"@rspack/core";import{getRuntimeCDNBase}from"../../../helpers/get-runtime-cdn-base.js";import{findEnvCdn,httpUrlJoin}from"../../../helpers/script-injects.js";export class FlatEvolveMultiCdnRspackPlugin{constructor(e,t){if(this.pluginName="FlatEvolveMultiCdnRspackPlugin",this.requireFn=rspack.RuntimeGlobals.publicPath,this.config=e.multiHtmlCdn,this.entryMapItemList=t,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.compilation.tap(this.pluginName,e=>{e.hooks.runtimeModule.tap(this.pluginName,(e,t)=>{const s=this.entryMapItemList.find(e=>e[0]===t.name);if("public_path"===e.name&&s){const t=[];t.push("\n"),t.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)"),t.push(getRuntimeCDNBase(this.config,this.cdnResolver,this.requireFn)),e.source.source=Buffer.from(t.join("\n"),"utf-8")}})}),e.hooks.compilation.tap(this.pluginName,t=>{HtmlWebpackPlugin.getHooks(t).beforeAssetTagGeneration.tap(this.pluginName,e=>{const{assets:t,plugin:s,outputName:n}=e,i=s?.options?.chunks||[],o=Array.isArray(i)?i.find(e=>n.includes(ensureSlash(e,!0))):i,{userOptions:r}=e.plugin;if(!o)throw new Error("We must have current chunk!");const a=t.js.filter(e=>e.includes(ensureSlash(o,!0))),l=t.css.filter(e=>e.includes(ensureSlash(o,!0))),p=r.multiCdn,u=t.publicPath,c=a.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}),t.hooks.processAssets.tap({name:this.pluginName,stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},s=>{if(e.options.output.library)for(const e of Object.keys(s))e.endsWith(".html")&&delete t.assets[e]})})}}
@@ -1 +1 @@
1
- import webpack from"webpack";import{defaultExtractionRule}from"../../../constants.js";import{CodeCheckerError}from"./code-checker-error.js";const PLUGIN_NAME="CodeCheckerWebpackPlugin";export class CodeCheckerWebpackPlugin{constructor(t={}){this.errors=[],this.blackList=[],this.whiteList=[],this.whitelistExtractionRule=[];const{blackList:e=[],whiteList:s=[],whitelistExtractionRule:o=[defaultExtractionRule]}=t;this.errors=[],this.blackList=e.map(t=>({input:t,reg:new RegExp(t)})),this.whiteList=s.map(t=>new RegExp(t)),this.whitelistExtractionRule=o.map(t=>new RegExp(t,"g"))}checkCode(t,e){const s=this.findUnallowedCode(t);for(const t of s)this.errors.push(`【 WhiteList 】${e} has unallowed code: ${t}`);for(const s of this.blackList)s.reg.test(t)&&this.errors.push(`【 BlackList 】${e} has unallowed code: ${s.input}`)}findUnallowedCode(t){const e=[],s=[];for(const e of this.whitelistExtractionRule)s.push(...t.match(e)??[]);if(s.length>0)for(const t of s){this.whiteList.findIndex(e=>e.test(t))<0&&e.push(t)}return e}apply(t){t.hooks.compilation.tap(PLUGIN_NAME,t=>{t.hooks.processAssets.tap({name:`${PLUGIN_NAME}PROCESS_ASSETS_STAGE_ANALYSE`,stage:webpack.Compilation.PROCESS_ASSETS_STAGE_ANALYSE},()=>{for(const[e,s]of Object.entries(t.assets))if(s.source){const t=s.source().toString();t&&t.length>0&&this.checkCode(t,e)}})}),t.hooks.done.tap({name:`${PLUGIN_NAME}_DONE`},()=>{if(this.errors.length>0)throw new CodeCheckerError(this.errors)})}}
1
+ import webpack from"webpack";import{defaultExtractionRule}from"../../../constants.js";import{CodeCheckerError}from"./code-checker-error.js";const PLUGIN_NAME="CodeCheckerWebpackPlugin";export class CodeCheckerWebpackPlugin{constructor(t={}){this.errors=[],this.blackList=[],this.whiteList=[],this.whitelistExtractionRule=[];const{blackList:e=[],whiteList:s=[],whitelistExtractionRule:o=defaultExtractionRule}=t;this.errors=[],this.blackList=e.map(t=>({input:t,reg:new RegExp(t)})),this.whiteList=s.map(t=>new RegExp(t)),this.whitelistExtractionRule=o.map(t=>new RegExp(t,"g"))}checkCode(t,e){const s=this.findUnallowedCode(t);for(const t of s)this.errors.push(`【 WhiteList 】${e} has unallowed code: ${t}`);for(const s of this.blackList)s.reg.test(t)&&this.errors.push(`【 BlackList 】${e} has unallowed code: ${s.input}`)}findUnallowedCode(t){const e=[],s=[];for(const e of this.whitelistExtractionRule)s.push(...t.match(e)??[]);if(s.length>0)for(const t of s){this.whiteList.findIndex(e=>e.test(t))<0&&e.push(t)}return e}apply(t){t.hooks.compilation.tap(PLUGIN_NAME,t=>{t.hooks.processAssets.tap({name:`${PLUGIN_NAME}PROCESS_ASSETS_STAGE_ANALYSE`,stage:webpack.Compilation.PROCESS_ASSETS_STAGE_ANALYSE},()=>{for(const[e,s]of Object.entries(t.assets)){if(!e.endsWith(".map")&&s.source){const t=s.source().toString();t&&t.length>0&&this.checkCode(t,e)}}})}),t.hooks.done.tap({name:`${PLUGIN_NAME}_DONE`},()=>{if(this.errors.length>0)throw new CodeCheckerError(this.errors)})}}
@@ -1,4 +1,13 @@
1
1
  import { type EntryMapItem } from '../../../types/types-entry-map.js';
2
2
  import { type FlatEvolveOptions } from '../../../types/types-options.js';
3
3
  import type { WebpackPlugin } from '../../../types/types-webpack.js';
4
+ /**
5
+ * Create `html-webpack-plugin` for this build, refer to best practices
6
+ *
7
+ * IF serveMode is true, not attach any plugins
8
+ * Otherwise, attach `html-webpack-plugin` and `@flatjs/evolve-plugin-multi-html-cdn`
9
+ *
10
+ * @param buildEntryItem the entries for this `build`
11
+ * @param allEnv
12
+ */
4
13
  export declare const createHtmlWebpackPlugins: (serveMode: boolean, entryMapItemList: EntryMapItem[], evolveOptions: FlatEvolveOptions) => WebpackPlugin[];
@@ -1 +1 @@
1
- import{FlatEvolveMultiCdnWebpackPlugin}from"./multi-html-cdn-webpack-plugin.js";import{createMultiHtmlWebpackPlugins}from"./multi-html-webpack-plugins.js";export const createHtmlWebpackPlugins=(t,l,e)=>{const i=[new FlatEvolveMultiCdnWebpackPlugin(e)],n=l[0];if(t||n[1]?.options?.output?.library)return i;const u=Object.keys(e.multiHtmlCdn);return i.unshift(...createMultiHtmlWebpackPlugins(t,e,l,u)),i};
1
+ import{FlatEvolveMultiCdnWebpackPlugin}from"./multi-html-cdn-webpack-plugin.js";import{createMultiHtmlWebpackPlugins}from"./multi-html-webpack-plugins.js";export const createHtmlWebpackPlugins=(t,l,e)=>{const u=[];if(t)return u;const i=Object.keys(e.multiHtmlCdn);return u.push(...createMultiHtmlWebpackPlugins(t,e,l,i)),u.push(new FlatEvolveMultiCdnWebpackPlugin(e)),u};
@@ -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,s)=>{const n=[];n.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const i=e.chunkGraph?.getTreeRuntimeRequirements(s);return i&&i.has(webpack.RuntimeGlobals.requireScope)&&n.push(webpack.Template.indent(getRuntimeCDNBase(this.config,this.cdnResolver,this.requireFn))),webpack.Template.asString(n)})}),e.hooks.compilation.tap(this.pluginName,t=>{HtmlWebpackPlugin.getHooks(t).beforeAssetTagGeneration.tap(this.pluginName,e=>{const{assets:t,plugin:s,outputName:n}=e,i=s?.options?.chunks||[],r=Array.isArray(i)?i.find(e=>n.includes(ensureSlash(e,!0))):i,{userOptions:o}=e.plugin;if(!r)throw new Error("We must have current chunk!");const a=t.js.filter(e=>e.includes(ensureSlash(r,!0))),l=t.css.filter(e=>e.includes(ensureSlash(r,!0))),p=o.multiCdn,u=t.publicPath,c=a.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}),t.hooks.processAssets.tap({name:this.pluginName,stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},s=>{if(e.options.output.library)for(const e of Object.keys(s))e.endsWith(".html")&&delete t.assets[e]})})}}
@@ -8,7 +8,7 @@ export type CodeCheckerPluginOptions = {
8
8
  *
9
9
  * @example
10
10
  * ```ts
11
- * riskyStringCheck: ['console.log', 'debugger']
11
+ * blackList: ['console.log', 'debugger']
12
12
  * ```
13
13
  */
14
14
  blackList?: string[];
@@ -21,7 +21,7 @@ export type CodeCheckerPluginOptions = {
21
21
  *
22
22
  * @example
23
23
  * ```ts
24
- * allowedDomainResources: ['http://test.example.com']
24
+ * whiteList: ['http://test.example.com']
25
25
  * ```
26
26
  */
27
27
  whiteList?: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {