multi-env-html-webpack-plugin
Advanced tools
Comparing version 1.0.0-beta.6 to 1.0.0-beta.7
@@ -1,1 +0,1 @@ | ||
define(["exports","fs","dotenv","dotenv-expand","cheerio","chalk"],(function(t,n,e,r,i,o){"use strict";function u(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var a=u(n),l=u(e),c=u(r),f=u(i),s=u(o);function v(t,n){for(var e=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),e++):e&&(t.splice(r,1),e--)}if(n)for(;e--;e)t.unshift("..");return t}var d=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,p=function(t){return d.exec(t).slice(1)};function h(){for(var t="",n=!1,e=arguments.length-1;e>=-1&&!n;e--){var r=e>=0?arguments[e]:"/";if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(t=r+"/"+t,n="/"===r.charAt(0))}return(n?"/":"")+(t=v(m(t.split("/"),(function(t){return!!t})),!n).join("/"))||"."}function g(t){var n=b(t),e="/"===j(t,-1);return(t=v(m(t.split("/"),(function(t){return!!t})),!n).join("/"))||n||(t="."),t&&e&&(t+="/"),(n?"/":"")+t}function b(t){return"/"===t.charAt(0)}var y={extname:function(t){return p(t)[3]},basename:function(t,n){var e=p(t)[2];return n&&e.substr(-1*n.length)===n&&(e=e.substr(0,e.length-n.length)),e},dirname:function(t){var n=p(t),e=n[0],r=n[1];return e||r?(r&&(r=r.substr(0,r.length-1)),e+r):"."},sep:"/",delimiter:":",relative:function(t,n){function e(t){for(var n=0;n<t.length&&""===t[n];n++);for(var e=t.length-1;e>=0&&""===t[e];e--);return n>e?[]:t.slice(n,e-n+1)}t=h(t).substr(1),n=h(n).substr(1);for(var r=e(t.split("/")),i=e(n.split("/")),o=Math.min(r.length,i.length),u=o,a=0;a<o;a++)if(r[a]!==i[a]){u=a;break}var l=[];for(a=u;a<r.length;a++)l.push("..");return(l=l.concat(i.slice(u))).join("/")},join:function(){var t=Array.prototype.slice.call(arguments,0);return g(m(t,(function(t,n){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},isAbsolute:b,normalize:g,resolve:h};function m(t,n){if(t.filter)return t.filter(n);for(var e=[],r=0;r<t.length;r++)n(t[r],r,t)&&e.push(t[r]);return e}var j="b"==="ab".substr(-1)?function(t,n,e){return t.substr(n,e)}:function(t,n,e){return n<0&&(n=t.length+n),t.substr(n,e)};function x(t,n,e){void 0===e&&(e=!1);for(var r=0,i=n;r<i.length;r++){var o=y.join(t,i[r]);if(a.default.existsSync(o)&&a.default.statSync(o).isFile())return e?o:a.default.readFileSync(o,"utf-8")}var u=y.dirname(t);if(u!==t)return x(u,n,e)}function w(t,n,e){return!(e&&0!==e.length&&(!e.some((function(t){return n.startsWith(t)}))||void 0!==t[n]))}function E(t,n,e){var r;void 0===n&&(n=process.cwd()),void 0===e&&(e=[]),r=e,e=Array.isArray(r)?r:[r];for(var i={},o=0,u=[".env.".concat(t,".local"),".env.".concat(t),".env.local",".env"];o<u.length;o++){var f=x(n,[u[o]],!0);if(f){var s=l.default.parse(a.default.readFileSync(f),{debug:!!process.env.DEBUG||void 0});c.default({parsed:s,ignoreProcessEnv:!0});for(var v=0,d=Object.entries(s);v<d.length;v++){var p=d[v],h=p[0],g=p[1];w(i,h,e)&&(i[h]=g)}}}return i}function S(t){return null==t||""===t}function A(t){t.forEach((function(t){if(a.default.existsSync(t.index)){var n=a.default.readFileSync(t.index,{encoding:"utf-8"}),e=f.default.load(n);!function(t,n,e){if(!S(t))for(var r,i=t.length,o=0;o<i;o++)if(r=t[o],!S(n)&&n.call(e,r,o,t))return}(t.outputs,(function(n){var r=e.root().clone(),i="";!function(t,n,e){if(S(t))console.error("遍历的obj对象为空");else for(var r=Object.keys(t),i=r.length,o=null,u=null,a=0;a<i;a++)if(u=t[o=r[a]],!S(n)&&n.call(e,u,o,t))return}(n.data,(function(t,n){i+="window['".concat(n,"']=").concat(JSON.stringify(t),";")})),r.find(t.parent||"body").prepend("<script>".concat(i,"<\/script>"));var o=r.html();a.default.writeFileSync(n.file,o||""),console.log(s.default.green("new file outputs :".concat(n.file)))}))}else console.error("\nthe file not exists :".concat(t.index," "))}))}var O=function(){function t(t){this.opts=[],this.opts=t}return t.prototype.apply=function(t){var n=this;t.hooks.afterEmit.tap("MultiEnvOutput",(function(){A(n.opts)}))},t}();t.MultiEnvHtmlWebpackPlugin=O,t.dealOptions=A,t.getEnv=function(t,n,e){return E(t,n,e)},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
define(["exports","path","fs","dotenv","dotenv-expand","cheerio","chalk"],(function(t,e,n,r,o,i,a){"use strict";function c(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var l=c(e),u=c(n),f=c(r),s=c(o),d=c(i),v=c(a);function p(t,e,n){void 0===n&&(n=!1);for(var r=0,o=e;r<o.length;r++){var i=l.default.join(t,o[r]);if(u.default.existsSync(i)&&u.default.statSync(i).isFile())return n?i:u.default.readFileSync(i,"utf-8")}var a=l.default.dirname(t);if(a!==t)return p(a,e,n)}function h(t,e,n){return!(n&&0!==n.length&&(!n.some((function(t){return e.startsWith(t)}))||void 0!==t[e]))}function y(t,e,n){var r;void 0===e&&(e=process.cwd()),void 0===n&&(n=[]),r=n,n=Array.isArray(r)?r:[r];for(var o={},i=0,a=[".env.".concat(t,".local"),".env.".concat(t),".env.local",".env"];i<a.length;i++){var c=p(e,[a[i]],!0);if(c){var l=f.default.parse(u.default.readFileSync(c),{debug:!!process.env.DEBUG||void 0});s.default({parsed:l,ignoreProcessEnv:!0});for(var d=0,v=Object.entries(l);d<v.length;d++){var y=v[d],g=y[0],b=y[1];h(o,g,n)&&(o[g]=b)}}}return o}function g(t){return null==t||""===t}function b(t){t.forEach((function(t){if(u.default.existsSync(t.index)){var e=u.default.readFileSync(t.index,{encoding:"utf-8"}),n=d.default.load(e);!function(t,e,n){if(!g(t))for(var r,o=t.length,i=0;i<o;i++)if(r=t[i],!g(e)&&e.call(n,r,i,t))return}(t.outputs,(function(e){var r=n.root().clone(),o="";!function(t,e,n){if(g(t))console.error("遍历的obj对象为空");else for(var r=Object.keys(t),o=r.length,i=null,a=null,c=0;c<o;c++)if(a=t[i=r[c]],!g(e)&&e.call(n,a,i,t))return}(e.data,(function(t,e){o+="window['".concat(e,"']=").concat(JSON.stringify(t),";")})),r.find(t.parent||"body").prepend("<script>".concat(o,"<\/script>"));var i=r.html();u.default.writeFileSync(e.file,i||""),console.log(v.default.green("new file outputs :".concat(e.file)))}))}else console.error("\nthe file not exists :".concat(t.index," "))}))}var x=function(){function t(t){this.opts=[],this.opts=t}return t.prototype.apply=function(t){var e=this;t.hooks.afterEmit.tap("MultiEnvOutput",(function(){b(e.opts)}))},t}();t.MultiEnvHtmlWebpackPlugin=x,t.dealOptions=b,t.getEnv=function(t,e,n){return y(t,e,n)},Object.defineProperty(t,"__esModule",{value:!0})})); |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("fs"),n=require("dotenv"),r=require("dotenv-expand"),e=require("cheerio"),i=require("chalk");function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=o(t),a=o(n),s=o(r),l=o(e),c=o(i);function f(t,n){for(var r=0,e=t.length-1;e>=0;e--){var i=t[e];"."===i?t.splice(e,1):".."===i?(t.splice(e,1),r++):r&&(t.splice(e,1),r--)}if(n)for(;r--;r)t.unshift("..");return t}var v=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,p=function(t){return v.exec(t).slice(1)};function d(){for(var t="",n=!1,r=arguments.length-1;r>=-1&&!n;r--){var e=r>=0?arguments[r]:"/";if("string"!=typeof e)throw new TypeError("Arguments to path.resolve must be strings");e&&(t=e+"/"+t,n="/"===e.charAt(0))}return(n?"/":"")+(t=f(y(t.split("/"),(function(t){return!!t})),!n).join("/"))||"."}function h(t){var n=g(t),r="/"===m(t,-1);return(t=f(y(t.split("/"),(function(t){return!!t})),!n).join("/"))||n||(t="."),t&&r&&(t+="/"),(n?"/":"")+t}function g(t){return"/"===t.charAt(0)}var b={extname:function(t){return p(t)[3]},basename:function(t,n){var r=p(t)[2];return n&&r.substr(-1*n.length)===n&&(r=r.substr(0,r.length-n.length)),r},dirname:function(t){var n=p(t),r=n[0],e=n[1];return r||e?(e&&(e=e.substr(0,e.length-1)),r+e):"."},sep:"/",delimiter:":",relative:function(t,n){function r(t){for(var n=0;n<t.length&&""===t[n];n++);for(var r=t.length-1;r>=0&&""===t[r];r--);return n>r?[]:t.slice(n,r-n+1)}t=d(t).substr(1),n=d(n).substr(1);for(var e=r(t.split("/")),i=r(n.split("/")),o=Math.min(e.length,i.length),u=o,a=0;a<o;a++)if(e[a]!==i[a]){u=a;break}var s=[];for(a=u;a<e.length;a++)s.push("..");return(s=s.concat(i.slice(u))).join("/")},join:function(){var t=Array.prototype.slice.call(arguments,0);return h(y(t,(function(t,n){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},isAbsolute:g,normalize:h,resolve:d};function y(t,n){if(t.filter)return t.filter(n);for(var r=[],e=0;e<t.length;e++)n(t[e],e,t)&&r.push(t[e]);return r}var m="b"==="ab".substr(-1)?function(t,n,r){return t.substr(n,r)}:function(t,n,r){return n<0&&(n=t.length+n),t.substr(n,r)};function x(t,n,r){void 0===r&&(r=!1);for(var e=0,i=n;e<i.length;e++){var o=b.join(t,i[e]);if(u.default.existsSync(o)&&u.default.statSync(o).isFile())return r?o:u.default.readFileSync(o,"utf-8")}var a=b.dirname(t);if(a!==t)return x(a,n,r)}function j(t,n,r){return!(r&&0!==r.length&&(!r.some((function(t){return n.startsWith(t)}))||void 0!==t[n]))}function w(t,n,r){var e;void 0===n&&(n=process.cwd()),void 0===r&&(r=[]),e=r,r=Array.isArray(e)?e:[e];for(var i={},o=0,l=[".env.".concat(t,".local"),".env.".concat(t),".env.local",".env"];o<l.length;o++){var c=x(n,[l[o]],!0);if(c){var f=a.default.parse(u.default.readFileSync(c),{debug:!!process.env.DEBUG||void 0});s.default({parsed:f,ignoreProcessEnv:!0});for(var v=0,p=Object.entries(f);v<p.length;v++){var d=p[v],h=d[0],g=d[1];j(i,h,r)&&(i[h]=g)}}}return i}function E(t){return null==t||""===t}function S(t){t.forEach((function(t){if(u.default.existsSync(t.index)){var n=u.default.readFileSync(t.index,{encoding:"utf-8"}),r=l.default.load(n);!function(t,n,r){if(!E(t))for(var e,i=t.length,o=0;o<i;o++)if(e=t[o],!E(n)&&n.call(r,e,o,t))return}(t.outputs,(function(n){var e=r.root().clone(),i="";!function(t,n,r){if(E(t))console.error("遍历的obj对象为空");else for(var e=Object.keys(t),i=e.length,o=null,u=null,a=0;a<i;a++)if(u=t[o=e[a]],!E(n)&&n.call(r,u,o,t))return}(n.data,(function(t,n){i+="window['".concat(n,"']=").concat(JSON.stringify(t),";")})),e.find(t.parent||"body").prepend("<script>".concat(i,"<\/script>"));var o=e.html();u.default.writeFileSync(n.file,o||""),console.log(c.default.green("new file outputs :".concat(n.file)))}))}else console.error("\nthe file not exists :".concat(t.index," "))}))}var A=function(){function t(t){this.opts=[],this.opts=t}return t.prototype.apply=function(t){var n=this;t.hooks.afterEmit.tap("MultiEnvOutput",(function(){S(n.opts)}))},t}();exports.MultiEnvHtmlWebpackPlugin=A,exports.dealOptions=S,exports.getEnv=function(t,n,r){return w(t,n,r)}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("path"),t=require("fs"),n=require("dotenv"),r=require("dotenv-expand"),o=require("cheerio"),i=require("chalk");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(e),c=a(t),l=a(n),f=a(r),s=a(o),d=a(i);function v(e,t,n){void 0===n&&(n=!1);for(var r=0,o=t;r<o.length;r++){var i=u.default.join(e,o[r]);if(c.default.existsSync(i)&&c.default.statSync(i).isFile())return n?i:c.default.readFileSync(i,"utf-8")}var a=u.default.dirname(e);if(a!==e)return v(a,t,n)}function p(e,t,n){return!(n&&0!==n.length&&(!n.some((function(e){return t.startsWith(e)}))||void 0!==e[t]))}function h(e,t,n){var r;void 0===t&&(t=process.cwd()),void 0===n&&(n=[]),r=n,n=Array.isArray(r)?r:[r];for(var o={},i=0,a=[".env.".concat(e,".local"),".env.".concat(e),".env.local",".env"];i<a.length;i++){var u=v(t,[a[i]],!0);if(u){var s=l.default.parse(c.default.readFileSync(u),{debug:!!process.env.DEBUG||void 0});f.default({parsed:s,ignoreProcessEnv:!0});for(var d=0,h=Object.entries(s);d<h.length;d++){var y=h[d],g=y[0],x=y[1];p(o,g,n)&&(o[g]=x)}}}return o}function y(e){return null==e||""===e}function g(e){e.forEach((function(e){if(c.default.existsSync(e.index)){var t=c.default.readFileSync(e.index,{encoding:"utf-8"}),n=s.default.load(t);!function(e,t,n){if(!y(e))for(var r,o=e.length,i=0;i<o;i++)if(r=e[i],!y(t)&&t.call(n,r,i,e))return}(e.outputs,(function(t){var r=n.root().clone(),o="";!function(e,t,n){if(y(e))console.error("遍历的obj对象为空");else for(var r=Object.keys(e),o=r.length,i=null,a=null,u=0;u<o;u++)if(a=e[i=r[u]],!y(t)&&t.call(n,a,i,e))return}(t.data,(function(e,t){o+="window['".concat(t,"']=").concat(JSON.stringify(e),";")})),r.find(e.parent||"body").prepend("<script>".concat(o,"<\/script>"));var i=r.html();c.default.writeFileSync(t.file,i||""),console.log(d.default.green("new file outputs :".concat(t.file)))}))}else console.error("\nthe file not exists :".concat(e.index," "))}))}var x=function(){function e(e){this.opts=[],this.opts=e}return e.prototype.apply=function(e){var t=this;e.hooks.afterEmit.tap("MultiEnvOutput",(function(){g(t.opts)}))},e}();exports.MultiEnvHtmlWebpackPlugin=x,exports.dealOptions=g,exports.getEnv=function(e,t,n){return h(e,t,n)}; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -1,1 +0,1 @@ | ||
import n from"fs";import r from"dotenv";import t from"dotenv-expand";import e from"cheerio";import o from"chalk";function i(n,r){for(var t=0,e=n.length-1;e>=0;e--){var o=n[e];"."===o?n.splice(e,1):".."===o?(n.splice(e,1),t++):t&&(n.splice(e,1),t--)}if(r)for(;t--;t)n.unshift("..");return n}var u=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,c=function(n){return u.exec(n).slice(1)};function s(){for(var n="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var e=t>=0?arguments[t]:"/";if("string"!=typeof e)throw new TypeError("Arguments to path.resolve must be strings");e&&(n=e+"/"+n,r="/"===e.charAt(0))}return(r?"/":"")+(n=i(v(n.split("/"),(function(n){return!!n})),!r).join("/"))||"."}function f(n){var r=a(n),t="/"===p(n,-1);return(n=i(v(n.split("/"),(function(n){return!!n})),!r).join("/"))||r||(n="."),n&&t&&(n+="/"),(r?"/":"")+n}function a(n){return"/"===n.charAt(0)}var l={extname:function(n){return c(n)[3]},basename:function(n,r){var t=c(n)[2];return r&&t.substr(-1*r.length)===r&&(t=t.substr(0,t.length-r.length)),t},dirname:function(n){var r=c(n),t=r[0],e=r[1];return t||e?(e&&(e=e.substr(0,e.length-1)),t+e):"."},sep:"/",delimiter:":",relative:function(n,r){function t(n){for(var r=0;r<n.length&&""===n[r];r++);for(var t=n.length-1;t>=0&&""===n[t];t--);return r>t?[]:n.slice(r,t-r+1)}n=s(n).substr(1),r=s(r).substr(1);for(var e=t(n.split("/")),o=t(r.split("/")),i=Math.min(e.length,o.length),u=i,c=0;c<i;c++)if(e[c]!==o[c]){u=c;break}var f=[];for(c=u;c<e.length;c++)f.push("..");return(f=f.concat(o.slice(u))).join("/")},join:function(){var n=Array.prototype.slice.call(arguments,0);return f(v(n,(function(n,r){if("string"!=typeof n)throw new TypeError("Arguments to path.join must be strings");return n})).join("/"))},isAbsolute:a,normalize:f,resolve:s};function v(n,r){if(n.filter)return n.filter(r);for(var t=[],e=0;e<n.length;e++)r(n[e],e,n)&&t.push(n[e]);return t}var p="b"==="ab".substr(-1)?function(n,r,t){return n.substr(r,t)}:function(n,r,t){return r<0&&(r=n.length+r),n.substr(r,t)};function h(r,t,e){void 0===e&&(e=!1);for(var o=0,i=t;o<i.length;o++){var u=l.join(r,i[o]);if(n.existsSync(u)&&n.statSync(u).isFile())return e?u:n.readFileSync(u,"utf-8")}var c=l.dirname(r);if(c!==r)return h(c,t,e)}function g(n,r,t){return!(t&&0!==t.length&&(!t.some((function(n){return r.startsWith(n)}))||void 0!==n[r]))}function d(e,o,i){var u;void 0===o&&(o=process.cwd()),void 0===i&&(i=[]),u=i,i=Array.isArray(u)?u:[u];for(var c={},s=0,f=[".env.".concat(e,".local"),".env.".concat(e),".env.local",".env"];s<f.length;s++){var a=h(o,[f[s]],!0);if(a){var l=r.parse(n.readFileSync(a),{debug:!!process.env.DEBUG||void 0});t({parsed:l,ignoreProcessEnv:!0});for(var v=0,p=Object.entries(l);v<p.length;v++){var d=p[v],m=d[0],b=d[1];g(c,m,i)&&(c[m]=b)}}}return c}function m(n){return null==n||""===n}function b(n,r,t){return d(n,r,t)}function y(r){r.forEach((function(r){if(n.existsSync(r.index)){var t=n.readFileSync(r.index,{encoding:"utf-8"}),i=e.load(t);!function(n,r,t){if(!m(n))for(var e,o=n.length,i=0;i<o;i++)if(e=n[i],!m(r)&&r.call(t,e,i,n))return}(r.outputs,(function(t){var e=i.root().clone(),u="";!function(n,r,t){if(m(n))console.error("遍历的obj对象为空");else for(var e=Object.keys(n),o=e.length,i=null,u=null,c=0;c<o;c++)if(u=n[i=e[c]],!m(r)&&r.call(t,u,i,n))return}(t.data,(function(n,r){u+="window['".concat(r,"']=").concat(JSON.stringify(n),";")})),e.find(r.parent||"body").prepend("<script>".concat(u,"<\/script>"));var c=e.html();n.writeFileSync(t.file,c||""),console.log(o.green("new file outputs :".concat(t.file)))}))}else console.error("\nthe file not exists :".concat(r.index," "))}))}var j=function(){function n(n){this.opts=[],this.opts=n}return n.prototype.apply=function(n){var r=this;n.hooks.afterEmit.tap("MultiEnvOutput",(function(){y(r.opts)}))},n}();export{j as MultiEnvHtmlWebpackPlugin,y as dealOptions,b as getEnv}; | ||
import n from"path";import t from"fs";import r from"dotenv";import o from"dotenv-expand";import e from"cheerio";import i from"chalk";function c(r,o,e){void 0===e&&(e=!1);for(var i=0,a=o;i<a.length;i++){var f=n.join(r,a[i]);if(t.existsSync(f)&&t.statSync(f).isFile())return e?f:t.readFileSync(f,"utf-8")}var l=n.dirname(r);if(l!==r)return c(l,o,e)}function a(n,t,r){return!(r&&0!==r.length&&(!r.some((function(n){return t.startsWith(n)}))||void 0!==n[t]))}function f(n,e,i){var f;void 0===e&&(e=process.cwd()),void 0===i&&(i=[]),f=i,i=Array.isArray(f)?f:[f];for(var l={},s=0,u=[".env.".concat(n,".local"),".env.".concat(n),".env.local",".env"];s<u.length;s++){var v=c(e,[u[s]],!0);if(v){var p=r.parse(t.readFileSync(v),{debug:!!process.env.DEBUG||void 0});o({parsed:p,ignoreProcessEnv:!0});for(var d=0,h=Object.entries(p);d<h.length;d++){var m=h[d],y=m[0],g=m[1];a(l,y,i)&&(l[y]=g)}}}return l}function l(n){return null==n||""===n}function s(n,t,r){return f(n,t,r)}function u(n){n.forEach((function(n){if(t.existsSync(n.index)){var r=t.readFileSync(n.index,{encoding:"utf-8"}),o=e.load(r);!function(n,t,r){if(!l(n))for(var o,e=n.length,i=0;i<e;i++)if(o=n[i],!l(t)&&t.call(r,o,i,n))return}(n.outputs,(function(r){var e=o.root().clone(),c="";!function(n,t,r){if(l(n))console.error("遍历的obj对象为空");else for(var o=Object.keys(n),e=o.length,i=null,c=null,a=0;a<e;a++)if(c=n[i=o[a]],!l(t)&&t.call(r,c,i,n))return}(r.data,(function(n,t){c+="window['".concat(t,"']=").concat(JSON.stringify(n),";")})),e.find(n.parent||"body").prepend("<script>".concat(c,"<\/script>"));var a=e.html();t.writeFileSync(r.file,a||""),console.log(i.green("new file outputs :".concat(r.file)))}))}else console.error("\nthe file not exists :".concat(n.index," "))}))}var v=function(){function n(n){this.opts=[],this.opts=n}return n.prototype.apply=function(n){var t=this;n.hooks.afterEmit.tap("MultiEnvOutput",(function(){u(t.opts)}))},n}();export{v as MultiEnvHtmlWebpackPlugin,u as dealOptions,s as getEnv}; |
@@ -1,1 +0,1 @@ | ||
var MultiEnvHtmlWebpackPlugin=function(t,n,r,e,i,o){"use strict";function u(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var a=u(n),l=u(r),c=u(e),f=u(i),s=u(o);function v(t,n){for(var r=0,e=t.length-1;e>=0;e--){var i=t[e];"."===i?t.splice(e,1):".."===i?(t.splice(e,1),r++):r&&(t.splice(e,1),r--)}if(n)for(;r--;r)t.unshift("..");return t}var p=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,d=function(t){return p.exec(t).slice(1)};function h(){for(var t="",n=!1,r=arguments.length-1;r>=-1&&!n;r--){var e=r>=0?arguments[r]:"/";if("string"!=typeof e)throw new TypeError("Arguments to path.resolve must be strings");e&&(t=e+"/"+t,n="/"===e.charAt(0))}return(n?"/":"")+(t=v(m(t.split("/"),(function(t){return!!t})),!n).join("/"))||"."}function g(t){var n=b(t),r="/"===j(t,-1);return(t=v(m(t.split("/"),(function(t){return!!t})),!n).join("/"))||n||(t="."),t&&r&&(t+="/"),(n?"/":"")+t}function b(t){return"/"===t.charAt(0)}var y={extname:function(t){return d(t)[3]},basename:function(t,n){var r=d(t)[2];return n&&r.substr(-1*n.length)===n&&(r=r.substr(0,r.length-n.length)),r},dirname:function(t){var n=d(t),r=n[0],e=n[1];return r||e?(e&&(e=e.substr(0,e.length-1)),r+e):"."},sep:"/",delimiter:":",relative:function(t,n){function r(t){for(var n=0;n<t.length&&""===t[n];n++);for(var r=t.length-1;r>=0&&""===t[r];r--);return n>r?[]:t.slice(n,r-n+1)}t=h(t).substr(1),n=h(n).substr(1);for(var e=r(t.split("/")),i=r(n.split("/")),o=Math.min(e.length,i.length),u=o,a=0;a<o;a++)if(e[a]!==i[a]){u=a;break}var l=[];for(a=u;a<e.length;a++)l.push("..");return(l=l.concat(i.slice(u))).join("/")},join:function(){var t=Array.prototype.slice.call(arguments,0);return g(m(t,(function(t,n){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},isAbsolute:b,normalize:g,resolve:h};function m(t,n){if(t.filter)return t.filter(n);for(var r=[],e=0;e<t.length;e++)n(t[e],e,t)&&r.push(t[e]);return r}var j="b"==="ab".substr(-1)?function(t,n,r){return t.substr(n,r)}:function(t,n,r){return n<0&&(n=t.length+n),t.substr(n,r)};function E(t,n,r){void 0===r&&(r=!1);for(var e=0,i=n;e<i.length;e++){var o=y.join(t,i[e]);if(a.default.existsSync(o)&&a.default.statSync(o).isFile())return r?o:a.default.readFileSync(o,"utf-8")}var u=y.dirname(t);if(u!==t)return E(u,n,r)}function w(t,n,r){return!(r&&0!==r.length&&(!r.some((function(t){return n.startsWith(t)}))||void 0!==t[n]))}function x(t,n,r){var e;void 0===n&&(n=process.cwd()),void 0===r&&(r=[]),e=r,r=Array.isArray(e)?e:[e];for(var i={},o=0,u=[".env.".concat(t,".local"),".env.".concat(t),".env.local",".env"];o<u.length;o++){var f=E(n,[u[o]],!0);if(f){var s=l.default.parse(a.default.readFileSync(f),{debug:!!process.env.DEBUG||void 0});c.default({parsed:s,ignoreProcessEnv:!0});for(var v=0,p=Object.entries(s);v<p.length;v++){var d=p[v],h=d[0],g=d[1];w(i,h,r)&&(i[h]=g)}}}return i}function S(t){return null==t||""===t}function A(t){t.forEach((function(t){if(a.default.existsSync(t.index)){var n=a.default.readFileSync(t.index,{encoding:"utf-8"}),r=f.default.load(n);!function(t,n,r){if(!S(t))for(var e,i=t.length,o=0;o<i;o++)if(e=t[o],!S(n)&&n.call(r,e,o,t))return}(t.outputs,(function(n){var e=r.root().clone(),i="";!function(t,n,r){if(S(t))console.error("遍历的obj对象为空");else for(var e=Object.keys(t),i=e.length,o=null,u=null,a=0;a<i;a++)if(u=t[o=e[a]],!S(n)&&n.call(r,u,o,t))return}(n.data,(function(t,n){i+="window['".concat(n,"']=").concat(JSON.stringify(t),";")})),e.find(t.parent||"body").prepend("<script>".concat(i,"<\/script>"));var o=e.html();a.default.writeFileSync(n.file,o||""),console.log(s.default.green("new file outputs :".concat(n.file)))}))}else console.error("\nthe file not exists :".concat(t.index," "))}))}var k=function(){function t(t){this.opts=[],this.opts=t}return t.prototype.apply=function(t){var n=this;t.hooks.afterEmit.tap("MultiEnvOutput",(function(){A(n.opts)}))},t}();return t.MultiEnvHtmlWebpackPlugin=k,t.dealOptions=A,t.getEnv=function(t,n,r){return x(t,n,r)},Object.defineProperty(t,"__esModule",{value:!0}),t}({},fs,dotenv,dotenvExpand,cheerio,chalk); | ||
var MultiEnvHtmlWebpackPlugin=function(t,n,e,r,o,i,a){"use strict";function l(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=l(n),c=l(e),f=l(r),s=l(o),d=l(i),v=l(a);function p(t,n,e){void 0===e&&(e=!1);for(var r=0,o=n;r<o.length;r++){var i=u.default.join(t,o[r]);if(c.default.existsSync(i)&&c.default.statSync(i).isFile())return e?i:c.default.readFileSync(i,"utf-8")}var a=u.default.dirname(t);if(a!==t)return p(a,n,e)}function h(t,n,e){return!(e&&0!==e.length&&(!e.some((function(t){return n.startsWith(t)}))||void 0!==t[n]))}function y(t,n,e){var r;void 0===n&&(n=process.cwd()),void 0===e&&(e=[]),r=e,e=Array.isArray(r)?r:[r];for(var o={},i=0,a=[".env.".concat(t,".local"),".env.".concat(t),".env.local",".env"];i<a.length;i++){var l=p(n,[a[i]],!0);if(l){var u=f.default.parse(c.default.readFileSync(l),{debug:!!process.env.DEBUG||void 0});s.default({parsed:u,ignoreProcessEnv:!0});for(var d=0,v=Object.entries(u);d<v.length;d++){var y=v[d],g=y[0],b=y[1];h(o,g,e)&&(o[g]=b)}}}return o}function g(t){return null==t||""===t}function b(t){t.forEach((function(t){if(c.default.existsSync(t.index)){var n=c.default.readFileSync(t.index,{encoding:"utf-8"}),e=d.default.load(n);!function(t,n,e){if(!g(t))for(var r,o=t.length,i=0;i<o;i++)if(r=t[i],!g(n)&&n.call(e,r,i,t))return}(t.outputs,(function(n){var r=e.root().clone(),o="";!function(t,n,e){if(g(t))console.error("遍历的obj对象为空");else for(var r=Object.keys(t),o=r.length,i=null,a=null,l=0;l<o;l++)if(a=t[i=r[l]],!g(n)&&n.call(e,a,i,t))return}(n.data,(function(t,n){o+="window['".concat(n,"']=").concat(JSON.stringify(t),";")})),r.find(t.parent||"body").prepend("<script>".concat(o,"<\/script>"));var i=r.html();c.default.writeFileSync(n.file,i||""),console.log(v.default.green("new file outputs :".concat(n.file)))}))}else console.error("\nthe file not exists :".concat(t.index," "))}))}var E=function(){function t(t){this.opts=[],this.opts=t}return t.prototype.apply=function(t){var n=this;t.hooks.afterEmit.tap("MultiEnvOutput",(function(){b(n.opts)}))},t}();return t.MultiEnvHtmlWebpackPlugin=E,t.dealOptions=b,t.getEnv=function(t,n,e){return y(t,n,e)},Object.defineProperty(t,"__esModule",{value:!0}),t}({},path,fs,dotenv,dotenvExpand,cheerio,chalk); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("fs"),require("dotenv"),require("dotenv-expand"),require("cheerio"),require("chalk")):"function"==typeof define&&define.amd?define(["exports","fs","dotenv","dotenv-expand","cheerio","chalk"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MultiEnvHtmlWebpackPlugin={},e.fs,e.dotenv,e.dotenvExpand,e.cheerio,e.chalk)}(this,(function(e,t,n,r,i,o){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=u(t),l=u(n),a=u(r),c=u(i),s=u(o);function d(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var v=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,p=function(e){return v.exec(e).slice(1)};function h(){for(var e="",t=!1,n=arguments.length-1;n>=-1&&!t;n--){var r=n>=0?arguments[n]:"/";if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(e=r+"/"+e,t="/"===r.charAt(0))}return(t?"/":"")+(e=d(m(e.split("/"),(function(e){return!!e})),!t).join("/"))||"."}function g(e){var t=b(e),n="/"===x(e,-1);return(e=d(m(e.split("/"),(function(e){return!!e})),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e}function b(e){return"/"===e.charAt(0)}var y={extname:function(e){return p(e)[3]},basename:function(e,t){var n=p(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},dirname:function(e){var t=p(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},sep:"/",delimiter:":",relative:function(e,t){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=h(e).substr(1),t=h(t).substr(1);for(var r=n(e.split("/")),i=n(t.split("/")),o=Math.min(r.length,i.length),u=o,f=0;f<o;f++)if(r[f]!==i[f]){u=f;break}var l=[];for(f=u;f<r.length;f++)l.push("..");return(l=l.concat(i.slice(u))).join("/")},join:function(){var e=Array.prototype.slice.call(arguments,0);return g(m(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},isAbsolute:b,normalize:g,resolve:h};function m(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var x="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)};function j(e,t,n){void 0===n&&(n=!1);for(var r=0,i=t;r<i.length;r++){var o=y.join(e,i[r]);if(f.default.existsSync(o)&&f.default.statSync(o).isFile())return n?o:f.default.readFileSync(o,"utf-8")}var u=y.dirname(e);if(u!==e)return j(u,t,n)}function E(e,t,n){return!(n&&0!==n.length&&(!n.some((function(e){return t.startsWith(e)}))||void 0!==e[t]))}function w(e,t,n){var r;void 0===t&&(t=process.cwd()),void 0===n&&(n=[]),r=n,n=Array.isArray(r)?r:[r];for(var i={},o=0,u=[".env.".concat(e,".local"),".env.".concat(e),".env.local",".env"];o<u.length;o++){var c=j(t,[u[o]],!0);if(c){var s=l.default.parse(f.default.readFileSync(c),{debug:!!process.env.DEBUG||void 0});a.default({parsed:s,ignoreProcessEnv:!0});for(var d=0,v=Object.entries(s);d<v.length;d++){var p=v[d],h=p[0],g=p[1];E(i,h,n)&&(i[h]=g)}}}return i}function S(e){return null==e||""===e}function k(e){e.forEach((function(e){if(f.default.existsSync(e.index)){var t=f.default.readFileSync(e.index,{encoding:"utf-8"}),n=c.default.load(t);!function(e,t,n){if(!S(e))for(var r,i=e.length,o=0;o<i;o++)if(r=e[o],!S(t)&&t.call(n,r,o,e))return}(e.outputs,(function(t){var r=n.root().clone(),i="";!function(e,t,n){if(S(e))console.error("遍历的obj对象为空");else for(var r=Object.keys(e),i=r.length,o=null,u=null,f=0;f<i;f++)if(u=e[o=r[f]],!S(t)&&t.call(n,u,o,e))return}(t.data,(function(e,t){i+="window['".concat(t,"']=").concat(JSON.stringify(e),";")})),r.find(e.parent||"body").prepend("<script>".concat(i,"<\/script>"));var o=r.html();f.default.writeFileSync(t.file,o||""),console.log(s.default.green("new file outputs :".concat(t.file)))}))}else console.error("\nthe file not exists :".concat(e.index," "))}))}var A=function(){function e(e){this.opts=[],this.opts=e}return e.prototype.apply=function(e){var t=this;e.hooks.afterEmit.tap("MultiEnvOutput",(function(){k(t.opts)}))},e}();e.MultiEnvHtmlWebpackPlugin=A,e.dealOptions=k,e.getEnv=function(e,t,n){return w(e,t,n)},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("path"),require("fs"),require("dotenv"),require("dotenv-expand"),require("cheerio"),require("chalk")):"function"==typeof define&&define.amd?define(["exports","path","fs","dotenv","dotenv-expand","cheerio","chalk"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MultiEnvHtmlWebpackPlugin={},e.path,e.fs,e.dotenv,e.dotenvExpand,e.cheerio,e.chalk)}(this,(function(e,t,n,o,r,i,a){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=u(t),l=u(n),c=u(o),d=u(r),s=u(i),v=u(a);function p(e,t,n){void 0===n&&(n=!1);for(var o=0,r=t;o<r.length;o++){var i=f.default.join(e,r[o]);if(l.default.existsSync(i)&&l.default.statSync(i).isFile())return n?i:l.default.readFileSync(i,"utf-8")}var a=f.default.dirname(e);if(a!==e)return p(a,t,n)}function h(e,t,n){return!(n&&0!==n.length&&(!n.some((function(e){return t.startsWith(e)}))||void 0!==e[t]))}function y(e,t,n){var o;void 0===t&&(t=process.cwd()),void 0===n&&(n=[]),o=n,n=Array.isArray(o)?o:[o];for(var r={},i=0,a=[".env.".concat(e,".local"),".env.".concat(e),".env.local",".env"];i<a.length;i++){var u=p(t,[a[i]],!0);if(u){var f=c.default.parse(l.default.readFileSync(u),{debug:!!process.env.DEBUG||void 0});d.default({parsed:f,ignoreProcessEnv:!0});for(var s=0,v=Object.entries(f);s<v.length;s++){var y=v[s],g=y[0],b=y[1];h(r,g,n)&&(r[g]=b)}}}return r}function g(e){return null==e||""===e}function b(e){e.forEach((function(e){if(l.default.existsSync(e.index)){var t=l.default.readFileSync(e.index,{encoding:"utf-8"}),n=s.default.load(t);!function(e,t,n){if(!g(e))for(var o,r=e.length,i=0;i<r;i++)if(o=e[i],!g(t)&&t.call(n,o,i,e))return}(e.outputs,(function(t){var o=n.root().clone(),r="";!function(e,t,n){if(g(e))console.error("遍历的obj对象为空");else for(var o=Object.keys(e),r=o.length,i=null,a=null,u=0;u<r;u++)if(a=e[i=o[u]],!g(t)&&t.call(n,a,i,e))return}(t.data,(function(e,t){r+="window['".concat(t,"']=").concat(JSON.stringify(e),";")})),o.find(e.parent||"body").prepend("<script>".concat(r,"<\/script>"));var i=o.html();l.default.writeFileSync(t.file,i||""),console.log(v.default.green("new file outputs :".concat(t.file)))}))}else console.error("\nthe file not exists :".concat(e.index," "))}))}var x=function(){function e(e){this.opts=[],this.opts=e}return e.prototype.apply=function(e){var t=this;e.hooks.afterEmit.tap("MultiEnvOutput",(function(){b(t.opts)}))},e}();e.MultiEnvHtmlWebpackPlugin=x,e.dealOptions=b,e.getEnv=function(e,t,n){return y(e,t,n)},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "multi-env-html-webpack-plugin", | ||
"version": "1.0.0-beta.6", | ||
"version": "1.0.0-beta.7", | ||
"description": "generate multiples indexs by environments", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.umd.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32507
63