Comparing version 1.1.0 to 1.2.0-0
@@ -376,5 +376,37 @@ 'use strict'; | ||
function nextjsWebpackPlugin(_ref) { | ||
var browserEnv = _ref.browserEnv, | ||
webpack = _ref.webpack; | ||
var env = {}; | ||
for (var key in browserEnv) { | ||
if (key.startsWith('NEXT_PUBLIC_')) { | ||
env[key] = browserEnv[key]; | ||
} | ||
} | ||
return new webpack.DefinePlugin({ | ||
'process.browserEnv': JSON.stringify(env) | ||
}); | ||
} | ||
function craWebpackPlugin(_ref2) { | ||
var browserEnv = _ref2.browserEnv, | ||
webpack = _ref2.webpack; | ||
var env = {}; | ||
for (var key in browserEnv) { | ||
if (key.startsWith('REACT_APP_')) { | ||
env[key] = browserEnv[key]; | ||
} | ||
} | ||
return new webpack.DefinePlugin({ | ||
'process.browserEnv': JSON.stringify(env) | ||
}); | ||
} | ||
exports.InvalidEnvError = InvalidEnvError; | ||
exports.MissingEnvError = MissingEnvError; | ||
exports.bool = bool; | ||
exports.craWebpackPlugin = craWebpackPlugin; | ||
exports.defaultReporter = defaultReporter; | ||
@@ -388,2 +420,3 @@ exports.defaultReporterText = defaultReporterText; | ||
exports.makeValidator = makeValidator; | ||
exports.nextjsWebpackPlugin = nextjsWebpackPlugin; | ||
exports.num = num; | ||
@@ -390,0 +423,0 @@ exports.port = port; |
@@ -1,2 +0,2 @@ | ||
"use strict";function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function i(t,e,r){return(i=o()?Reflect.construct:function(t,e,r){var o=[null];o.push.apply(o,e);var i=new(Function.bind.apply(t,o));return r&&n(i,r.prototype),i}).apply(null,arguments)}function u(t){var e="function"==typeof Map?new Map:void 0;return(u=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,o)}function o(){return i(t,arguments,r(this).constructor)}return o.prototype=Object.create(t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),n(o,t)})(t)}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}Object.defineProperty(exports,"__esModule",{value:!0});var s=function(t){function r(e){var n;return n=t.call(this,e)||this,Object.setPrototypeOf(c(n),r.prototype),n}return e(r,t),r}(u(TypeError)),a=function(t,e){return new s("Invalid "+t+' input: "'+e+'"')},f=function(t){function r(e){var n;return n=t.call(this,e)||this,Object.setPrototypeOf(c(n),r.prototype),n}return e(r,t),r}(u(ReferenceError)),p=["length","inspect","hasOwnProperty","toJSON","asymmetricMatch","nodeType","$$typeof","constructor","@@__IMMUTABLE_ITERABLE__@@","@@__IMMUTABLE_RECORD__@@","_isMockFunction","then","__esModule"];function l(t,e){var r=Object.freeze?Object.freeze(t):t;return global.Proxy?new Proxy(r,{get:function(t,n){if("string"!=typeof n||p.includes(n))return r[n];if(!r.hasOwnProperty(n)){if(e.hasOwnProperty(n))throw new ReferenceError("[envsafe] Env var "+String(n)+" was accessed but not validated. This var is set in the environment; please add an envsafe validator for it.");throw new ReferenceError('[envsafe] Env var "'+String(n)+'" not found')}return r[n]}}):r}function v(t){for(var e=t.errors,r=[],n=[],o=0,i=Object.keys(e);o<i.length;o++){var u=i[o],c=e[u];c instanceof f?n.push(" "+u+": "+(c.message||"required")):r.push(" "+u+": "+(c.message||"invalid"))}return r.length&&r.unshift("❌ Invalid environment variables:"),n.length&&n.unshift("💨 Missing environment variables:"),["========================================"].concat(r,n,["========================================"]).join("\n")}function d(t){var e,r=v(t);throw console.error(r),"undefined"!=typeof window&&(null===(e=window)||void 0===e?void 0:e.alert)&&window.alert(r),new TypeError(r)}function h(t){var e,r=t.env,n=t.validator,o=null!==(e=n.input)&&void 0!==e?e:r[t.key];if(void 0===o&&"production"!==r.NODE_ENV&&void 0!==n.devDefault&&(o=n.devDefault),void 0===o&&void 0!==n.default&&(o=n.default),void 0===o)throw new f("Missing value");var i=n._parse(o);if(n.choices&&!n.choices.includes(i))throw new s('Value "'+i+'" not in choices ['+n.choices+"]");return i}var y=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function w(e){return function(r){return void 0===r&&(r={}),t({},r,{_parse:e})}}var O=w((function(t){switch(t){case!0:case"true":case"t":case"1":return!0;case!1:case"false":case"f":case"0":return!1;default:throw a("str",t)}})),b=w((function(t){if("string"!=typeof t)throw a("str",t);return t})),_=w((function(t){if(!y.test(t))throw a("email",t);return t})),g=w((function(t){var e=+t;if(Number.isNaN(e))throw a("num",t);return e})),x=w((function(t){var e=+t;if(Number.isNaN(e)||""+e!=""+t||e%1!=0||e<1||e>65535)throw a("port",t);return e})),E=w((function(t){try{return new URL(t),t}catch(e){throw a("url",t)}})),j=w((function(t){try{return"string"!=typeof t?t:JSON.parse(t)}catch(e){throw a("json",t)}}));exports.InvalidEnvError=s,exports.MissingEnvError=f,exports.bool=O,exports.defaultReporter=d,exports.defaultReporterText=v,exports.email=_,exports.envsafe=function(t,e){var r=void 0===e?{}:e,n=r.reporter,o=void 0===n?d:n,i=r.env,u=void 0===i?process.env:i,c=r.strict,s=void 0!==c&&c,a={},f={};for(var p in t){var v=t[p];try{var y=h({env:u,validator:v,key:p});f[p]=y}catch(t){a[p]=t}}return Object.keys(a).length&&o({errors:a,output:f,env:u}),s?l(f,u):f},exports.freezeObject=l,exports.invalidEnvError=a,exports.json=j,exports.makeValidator=w,exports.num=g,exports.port=x,exports.str=b,exports.url=E; | ||
"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function t(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function i(e,t,r){return(i=o()?Reflect.construct:function(e,t,r){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return r&&n(i,r.prototype),i}).apply(null,arguments)}function u(e){var t="function"==typeof Map?new Map:void 0;return(u=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return i(e,arguments,r(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),n(o,e)})(e)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}Object.defineProperty(exports,"__esModule",{value:!0});var c=function(e){function r(t){var n;return n=e.call(this,t)||this,Object.setPrototypeOf(s(n),r.prototype),n}return t(r,e),r}(u(TypeError)),a=function(e,t){return new c("Invalid "+e+' input: "'+t+'"')},f=function(e){function r(t){var n;return n=e.call(this,t)||this,Object.setPrototypeOf(s(n),r.prototype),n}return t(r,e),r}(u(ReferenceError)),p=["length","inspect","hasOwnProperty","toJSON","asymmetricMatch","nodeType","$$typeof","constructor","@@__IMMUTABLE_ITERABLE__@@","@@__IMMUTABLE_RECORD__@@","_isMockFunction","then","__esModule"];function l(e,t){var r=Object.freeze?Object.freeze(e):e;return global.Proxy?new Proxy(r,{get:function(e,n){if("string"!=typeof n||p.includes(n))return r[n];if(!r.hasOwnProperty(n)){if(t.hasOwnProperty(n))throw new ReferenceError("[envsafe] Env var "+String(n)+" was accessed but not validated. This var is set in the environment; please add an envsafe validator for it.");throw new ReferenceError('[envsafe] Env var "'+String(n)+'" not found')}return r[n]}}):r}function v(e){for(var t=e.errors,r=[],n=[],o=0,i=Object.keys(t);o<i.length;o++){var u=i[o],s=t[u];s instanceof f?n.push(" "+u+": "+(s.message||"required")):r.push(" "+u+": "+(s.message||"invalid"))}return r.length&&r.unshift("❌ Invalid environment variables:"),n.length&&n.unshift("💨 Missing environment variables:"),["========================================"].concat(r,n,["========================================"]).join("\n")}function d(e){var t,r=v(e);throw console.error(r),"undefined"!=typeof window&&(null===(t=window)||void 0===t?void 0:t.alert)&&window.alert(r),new TypeError(r)}function h(e){var t,r=e.env,n=e.validator,o=null!==(t=n.input)&&void 0!==t?t:r[e.key];if(void 0===o&&"production"!==r.NODE_ENV&&void 0!==n.devDefault&&(o=n.devDefault),void 0===o&&void 0!==n.default&&(o=n.default),void 0===o)throw new f("Missing value");var i=n._parse(o);if(n.choices&&!n.choices.includes(i))throw new c('Value "'+i+'" not in choices ['+n.choices+"]");return i}var y=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function w(t){return function(r){return void 0===r&&(r={}),e({},r,{_parse:t})}}var b=w((function(e){switch(e){case!0:case"true":case"t":case"1":return!0;case!1:case"false":case"f":case"0":return!1;default:throw a("str",e)}})),_=w((function(e){if("string"!=typeof e)throw a("str",e);return e})),O=w((function(e){if(!y.test(e))throw a("email",e);return e})),g=w((function(e){var t=+e;if(Number.isNaN(t))throw a("num",e);return t})),E=w((function(e){var t=+e;if(Number.isNaN(t)||""+t!=""+e||t%1!=0||t<1||t>65535)throw a("port",e);return t})),x=w((function(e){try{return new URL(e),e}catch(t){throw a("url",e)}})),P=w((function(e){try{return"string"!=typeof e?e:JSON.parse(e)}catch(t){throw a("json",e)}}));exports.InvalidEnvError=c,exports.MissingEnvError=f,exports.bool=b,exports.craWebpackPlugin=function(e){var t=e.browserEnv,r=e.webpack,n={};for(var o in t)o.startsWith("REACT_APP_")&&(n[o]=t[o]);return new r.DefinePlugin({"process.browserEnv":JSON.stringify(n)})},exports.defaultReporter=d,exports.defaultReporterText=v,exports.email=O,exports.envsafe=function(e,t){var r=void 0===t?{}:t,n=r.reporter,o=void 0===n?d:n,i=r.env,u=void 0===i?process.env:i,s=r.strict,c=void 0!==s&&s,a={},f={};for(var p in e){var v=e[p];try{var y=h({env:u,validator:v,key:p});f[p]=y}catch(e){a[p]=e}}return Object.keys(a).length&&o({errors:a,output:f,env:u}),c?l(f,u):f},exports.freezeObject=l,exports.invalidEnvError=a,exports.json=P,exports.makeValidator=w,exports.nextjsWebpackPlugin=function(e){var t=e.browserEnv,r=e.webpack,n={};for(var o in t)o.startsWith("NEXT_PUBLIC_")&&(n[o]=t[o]);return new r.DefinePlugin({"process.browserEnv":JSON.stringify(n)})},exports.num=g,exports.port=E,exports.str=_,exports.url=x; | ||
//# sourceMappingURL=envsafe.cjs.production.min.js.map |
@@ -372,3 +372,34 @@ function _extends() { | ||
export { InvalidEnvError, MissingEnvError, bool, defaultReporter, defaultReporterText, email, envsafe, freezeObject, invalidEnvError, json, makeValidator, num, port, str, url }; | ||
function nextjsWebpackPlugin(_ref) { | ||
var browserEnv = _ref.browserEnv, | ||
webpack = _ref.webpack; | ||
var env = {}; | ||
for (var key in browserEnv) { | ||
if (key.startsWith('NEXT_PUBLIC_')) { | ||
env[key] = browserEnv[key]; | ||
} | ||
} | ||
return new webpack.DefinePlugin({ | ||
'process.browserEnv': JSON.stringify(env) | ||
}); | ||
} | ||
function craWebpackPlugin(_ref2) { | ||
var browserEnv = _ref2.browserEnv, | ||
webpack = _ref2.webpack; | ||
var env = {}; | ||
for (var key in browserEnv) { | ||
if (key.startsWith('REACT_APP_')) { | ||
env[key] = browserEnv[key]; | ||
} | ||
} | ||
return new webpack.DefinePlugin({ | ||
'process.browserEnv': JSON.stringify(env) | ||
}); | ||
} | ||
export { InvalidEnvError, MissingEnvError, bool, craWebpackPlugin, defaultReporter, defaultReporterText, email, envsafe, freezeObject, invalidEnvError, json, makeValidator, nextjsWebpackPlugin, num, port, str, url }; | ||
//# sourceMappingURL=envsafe.esm.js.map |
@@ -7,1 +7,2 @@ export * from './envsafe'; | ||
export * from './freezeObject'; | ||
export * from './plugins/webpack'; |
{ | ||
"version": "1.1.0", | ||
"version": "1.2.0-0", | ||
"license": "MIT", | ||
@@ -37,2 +37,3 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@types/webpack": "^4.41.22", | ||
"husky": "4.3.0", | ||
@@ -39,0 +40,0 @@ "np": "*", |
@@ -7,1 +7,2 @@ export * from './envsafe'; | ||
export * from './freezeObject'; | ||
export * from './plugins/webpack'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
95352
26
1171
6
2