@driveflux/env 5.0.7 → 5.0.8
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.
- package/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +6 -0
- package/dist/init-env.js +2 -2
- package/dist/init-env.js.map +3 -3
- package/package.json +1 -1
- package/src/init-env.ts +7 -1
- package/tsconfig.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -6,8 +6,8 @@ $ bun run ./build.ts
|
|
|
6
6
|
Files processed: 4
|
|
7
7
|
Total exports found: 9
|
|
8
8
|
Duplicates removed: 0
|
|
9
|
-
Total processing time:
|
|
10
|
-
Average time per file:
|
|
9
|
+
Total processing time: 29.38ms
|
|
10
|
+
Average time per file: 7.35ms
|
|
11
11
|
|
|
12
12
|
✅ No duplicate exports found in any files
|
|
13
13
|
✅ Build successful
|
package/CHANGELOG.md
CHANGED
package/dist/init-env.js
CHANGED
|
@@ -25,8 +25,8 @@ ${k}`,m8.writeFileX(B,D),$.privateKeyAdded=!0,$.envKeysFilepath=this.envKeysFile
|
|
|
25
25
|
`;for(let Y of Q){let X=gX.resolve(this.directory,Y);if(!y8.existsSync(X)){let j=new LC({envFilepath:Y,filepath:X}).missingEnvFile();throw j.help=`? add it with [echo "HELLO=World" > ${Y}] and then run [dotenvx genexample]`,j}let Z=y8.readFileX(X),U=xX(Z);for(let j in U)J.add(j),Z=KC(Z,j,"");I+=`
|
|
26
26
|
${Z}`}if(!y8.existsSync(this.exampleFilepath))for(let Y of[...J])$.add(Y),q[Y]="";else{I=y8.readFileX(this.exampleFilepath);let Y=xX(I);for(let X of[...J])if(X in Y)G[X]=Y[X];else I+=`${X}=''
|
|
27
27
|
`,$.add(X),q[X]=""}return{envExampleFile:I,envFile:this.envFile,exampleFilepath:this.exampleFilepath,addedKeys:[...$],injected:q,preExisted:G}}_envFilepaths(){if(!Array.isArray(this.envFile))return[this.envFile];return this.envFile}}yX.exports=mX});var uX=A((RD,hX)=>{var AC=s("path"),v8=s("child_process"),{logger:_8}=vJ();class _X{constructor(){this.radarLib=null;try{this.radarLib=this._radarNpm(),_8.warn("[DEPRECATION NOTICE] dotenvx-radar is renamed dotenv-ops. [See https://dotenvx.com/docs/ops]"),_8.successv(`\uD83D\uDCE1 radar: ${this.radarLib.status}`)}catch(J){try{this.radarLib=this._radarCli(),_8.warn("[DEPRECATION NOTICE] dotenvx-radar is renamed dotenv-ops. [See https://dotenvx.com/docs/ops]"),_8.successv(`\uD83D\uDCE1 radar: ${this.radarLib.status}`)}catch($){}}}observe(J){if(this.radarLib&&this.radarLib.status!=="off"){let $=this.encode(J);this.radarLib.observe($)}}encode(J){return Buffer.from(JSON.stringify(J)).toString("base64")}_radarNpm(){let J=AC.resolve(process.cwd(),"node_modules/.bin/dotenvx-radar");return{status:v8.execSync(`${J} status`,{stdio:["pipe","pipe","ignore"]}).toString().trim(),observe:(Q)=>{try{v8.spawn(J,["observe",Q],{stdio:"ignore",detached:!0}).unref()}catch(q){}}}}_radarCli(){return{status:v8.execSync("dotenvx-radar status",{stdio:["pipe","pipe","ignore"]}).toString().trim(),observe:($)=>{try{v8.spawn("dotenvx-radar",["observe",$],{stdio:"ignore",detached:!0}).unref()}catch(Q){}}}}}hX.exports=_X});var iX=A((KD,lX)=>{var SC=s("path"),h8=s("child_process"),{logger:dX}=vJ();class cX{constructor(){this.opsLib=null;try{this.opsLib=this._opsNpm(),dX.successv(`\uD83D\uDCE1 radar: ${this.opsLib.status}`)}catch(J){try{this.opsLib=this._opsCli(),dX.successv(`\uD83D\uDCE1 radar: ${this.opsLib.status}`)}catch($){}}}observe(J){if(this.opsLib&&this.opsLib.status!=="off"){let $=this.encode(J);this.opsLib.observe($)}}encode(J){return Buffer.from(JSON.stringify(J)).toString("base64")}_opsNpm(){let J=SC.resolve(process.cwd(),"node_modules/.bin/dotenvx-ops");return{status:h8.execSync(`${J} status`,{stdio:["pipe","pipe","ignore"]}).toString().trim(),observe:(Q)=>{try{h8.spawn(J,["observe",Q],{stdio:"ignore",detached:!0}).unref()}catch(q){}}}}_opsCli(){return{status:h8.execSync("dotenvx-ops status",{stdio:["pipe","pipe","ignore"]}).toString().trim(),observe:($)=>{try{h8.spawn("dotenvx-ops",["observe",$],{stdio:"ignore",detached:!0}).unref()}catch(Q){}}}}}lX.exports=cX});var pX=A((AD,nX)=>{function fC(J){let $=process.env.DOTENV_ENV||"development";if(J==="nextjs"){let Q=["development","test","production"].includes($)&&$;return[Q&&{type:"envFile",value:`.env.${Q}.local`},Q!=="test"&&{type:"envFile",value:".env.local"},Q&&{type:"envFile",value:`.env.${Q}`},{type:"envFile",value:".env"}].filter(Boolean)}else if(J==="flow")return[{type:"envFile",value:`.env.${$}.local`},{type:"envFile",value:`.env.${$}`},{type:"envFile",value:".env.local"},{type:"envFile",value:".env"},{type:"envFile",value:".env.defaults"}];else throw Error(`INVALID_CONVENTION: '${J}'. permitted conventions: ['nextjs', 'flow']`)}nX.exports=fC});var oX=A((SD,rX)=>{var EC=s("os"),PC=s("path");function bC(J){if(J[0]==="~")return PC.join(EC.homedir(),J.slice(1));return J}rX.exports=bC});var tX=A((fD,sX)=>{var aX=oX();function kC(J){let $=[];if(J&&J.path)if(!Array.isArray(J.path))$=[aX(J.path)];else{$=[];for(let Q of J.path)$.push(aX(Q))}return $}sX.exports=kC});var $Z=A((ED,JZ)=>{var{logger:TQ}=vJ();class eX{constructor(J={}){this.DOTENV_KEY=J.DOTENV_KEY||process.env.DOTENV_KEY}dotenvKey(){if(this.DOTENV_KEY)TQ.warn("[DEPRECATION NOTICE] Setting DOTENV_KEY with .env.vault is deprecated."),TQ.warn("[DEPRECATION NOTICE] Run [dotenvx ext vault migrate] for instructions on converting your .env.vault file to encrypted .env files (using public key encryption algorithm secp256k1)"),TQ.warn("[DEPRECATION NOTICE] Read more at [https://github.com/dotenvx/dotenvx/blob/main/CHANGELOG.md#0380]")}}JZ.exports=eX});var GZ=A((PD,qZ)=>{var QZ=s("path"),FC=pX(),gC=tX(),xC=$Z();function mC(J,$=void 0){let Q=gC(J),q=[];if(J.convention)q=FC(J.convention).concat(q);new xC({DOTENV_KEY:$}).dotenvKey();for(let G of Q)if($)q.push({type:"envVaultFile",value:QZ.join(QZ.dirname(G),".env.vault")});else q.push({type:"envFile",value:G});return q}qZ.exports=mC});var VZ=A((bD,NZ)=>{function IZ(J){return Array.isArray(J)?J:[J]}var RQ="",YZ=" ",wQ="\\",yC=/^\s+$/,vC=/(?:[^\\]|^)\\$/,_C=/^\\!/,hC=/^\\#/,uC=/\r?\n/g,dC=/^\.*\/|^\.+$/,LQ="/",jZ="node-ignore";if(typeof Symbol<"u")jZ=Symbol.for("node-ignore");var XZ=jZ,cC=(J,$,Q)=>Object.defineProperty(J,$,{value:Q}),lC=/([0-z])-([0-z])/g,WZ=()=>!1,iC=(J)=>J.replace(lC,($,Q,q)=>Q.charCodeAt(0)<=q.charCodeAt(0)?$:RQ),nC=(J)=>{let{length:$}=J;return J.slice(0,$-$%2)},pC=[[/^\uFEFF/,()=>RQ],[/((?:\\\\)*?)(\\?\s+)$/,(J,$,Q)=>$+(Q.indexOf("\\")===0?YZ:RQ)],[/(\\+?)\s/g,(J,$)=>{let{length:Q}=$;return $.slice(0,Q-Q%2)+YZ}],[/[\\$.|*+(){^]/g,(J)=>`\\${J}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return!/\/(?!$)/.test(this)?"(?:^|\\/)":"^"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(J,$,Q)=>$+6<Q.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(J,$,Q)=>{let q=Q.replace(/\\\*/g,"[^\\/]*");return $+q}],[/\\\\\\(?=[$.|*+(){^])/g,()=>wQ],[/\\\\/g,()=>wQ],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(J,$,Q,q,G)=>$===wQ?`\\[${Q}${nC(q)}${G}`:G==="]"?q.length%2===0?`[${iC(Q)}${q}]`:"[]":"[]"],[/(?:[^*])$/,(J)=>/\/$/.test(J)?`${J}$`:`${J}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(J,$)=>{return`${$?`${$}[^/]+`:"[^/]*"}(?=$|\\/$)`}]],ZZ=Object.create(null),rC=(J,$)=>{let Q=ZZ[J];if(!Q)Q=pC.reduce((q,[G,I])=>q.replace(G,I.bind(J)),J),ZZ[J]=Q;return $?new RegExp(Q,"i"):new RegExp(Q)},KQ=(J)=>typeof J==="string",oC=(J)=>J&&KQ(J)&&!yC.test(J)&&!vC.test(J)&&J.indexOf("#")!==0,aC=(J)=>J.split(uC);class UZ{constructor(J,$,Q,q){this.origin=J,this.pattern=$,this.negative=Q,this.regex=q}}var sC=(J,$)=>{let Q=J,q=!1;if(J.indexOf("!")===0)q=!0,J=J.substr(1);J=J.replace(_C,"!").replace(hC,"#");let G=rC(J,$);return new UZ(Q,J,q,G)},tC=(J,$)=>{throw new $(J)},s0=(J,$,Q)=>{if(!KQ(J))return Q(`path must be a string, but got \`${$}\``,TypeError);if(!J)return Q("path must not be empty",TypeError);if(s0.isNotRelative(J))return Q(`path should be a \`path.relative()\`d string, but got "${$}"`,RangeError);return!0},zZ=(J)=>dC.test(J);s0.isNotRelative=zZ;s0.convert=(J)=>J;class MZ{constructor({ignorecase:J=!0,ignoreCase:$=J,allowRelativePaths:Q=!1}={}){cC(this,XZ,!0),this._rules=[],this._ignoreCase=$,this._allowRelativePaths=Q,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(J){if(J&&J[XZ]){this._rules=this._rules.concat(J._rules),this._added=!0;return}if(oC(J)){let $=sC(J,this._ignoreCase);this._added=!0,this._rules.push($)}}add(J){if(this._added=!1,IZ(KQ(J)?aC(J):J).forEach(this._addPattern,this),this._added)this._initCache();return this}addPattern(J){return this.add(J)}_testOne(J,$){let Q=!1,q=!1;return this._rules.forEach((G)=>{let{negative:I}=G;if(q===I&&Q!==q||I&&!Q&&!q&&!$)return;if(G.regex.test(J))Q=!I,q=I}),{ignored:Q,unignored:q}}_test(J,$,Q,q){let G=J&&s0.convert(J);return s0(G,J,this._allowRelativePaths?WZ:tC),this._t(G,$,Q,q)}_t(J,$,Q,q){if(J in $)return $[J];if(!q)q=J.split(LQ);if(q.pop(),!q.length)return $[J]=this._testOne(J,Q);let G=this._t(q.join(LQ)+LQ,$,Q,q);return $[J]=G.ignored?G:this._testOne(J,Q)}ignores(J){return this._test(J,this._ignoreCache,!1).ignored}createFilter(){return(J)=>!this.ignores(J)}filter(J){return IZ(J).filter(this.createFilter())}test(J){return this._test(J,this._testCache,!0)}}var u8=(J)=>new MZ(J),eC=(J)=>s0(J&&s0.convert(J),J,WZ);u8.isPathValid=eC;u8.default=u8;NZ.exports=u8;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let J=(Q)=>/^\\\\\?\\/.test(Q)||/["<>|\u0000-\u001F]+/u.test(Q)?Q:Q.replace(/\\/g,"/");s0.convert=J;let $=/^[a-z]:\//i;s0.isNotRelative=(Q)=>$.test(Q)||zZ(Q)}});var DZ=A((kD,BZ)=>{var CZ=h0(),J4=VZ();function $4(){if(!CZ.existsSync(".gitignore"))return!1;let J=CZ.readFileX(".gitignore");if(!J4(J).add(J).ignores(".env.keys"))return!1;return!0}BZ.exports=$4});var TZ=A((FD,HZ)=>{var AQ=s("path"),{setLogLevel:OZ,setLogName:Q4,setLogVersion:q4,logger:t}=vJ(),{getColor:G4,bold:I4}=d8(),Y4=Rq(),X4=OQ(),Z4=fX(),j4=bX(),W4=x8(),U4=vX(),z4=uX(),M4=iX(),SQ=GZ(),N4=WQ(),V4=h0(),C4=DZ(),B4=function(J={}){let $=process.env;if(J&&J.processEnv!=null)$=J.processEnv;let Q=J.overload||J.override,q=J.ignore||[],G=J.strict,I=J.envKeysFile,Y=process.env.DOTENV_KEY;if(J&&J.DOTENV_KEY)Y=J.DOTENV_KEY;let X=J.opsOff!==!0;if(J)OZ(J),Q4(J),q4(J);try{let Z=SQ(J,Y),{beforeEnv:U,afterEnv:j,processedEnvs:C,readableFilepaths:z,uniqueInjectedKeys:N}=new X4(Z,Q,Y,$,I,X).run();if(X){try{new z4().observe({beforeEnv:U,processedEnvs:C,afterEnv:j})}catch{}try{new M4().observe({beforeEnv:U,processedEnvs:C,afterEnv:j})}catch{}}let V,H={};for(let T of C){if(T.type==="envVaultFile")t.verbose(`loading env from encrypted ${T.filepath} (${AQ.resolve(T.filepath)})`),t.debug(`decrypting encrypted env from ${T.filepath} (${AQ.resolve(T.filepath)})`);if(T.type==="envFile")t.verbose(`loading env from ${T.filepath} (${AQ.resolve(T.filepath)})`);for(let D of T.errors||[]){if(q.includes(D.code)){t.verbose(`ignored: ${D.message}`);continue}if(G)throw D;if(V=D,D.code==="MISSING_ENV_FILE"){if(!J.convention){if(t.error(D.message),D.help)t.error(D.help)}}else if(t.error(D.message),D.help)t.error(D.help)}Object.assign(H,T.injected||{}),Object.assign(H,T.preExisted||{}),t.debug(T.parsed);for(let[D,K]of Object.entries(T.injected||{}))t.verbose(`${D} set`),t.debug(`${D} set to ${K}`);for(let[D,K]of Object.entries(T.preExisted||{}))t.verbose(`${D} pre-exists (protip: use --overload to override)`),t.debug(`${D} pre-exists as ${K} (protip: use --overload to override)`)}let B=`injecting env (${N.length})`;if(z.length>0)B+=` from ${z.join(", ")}`;if(t.successv(B),V)return{parsed:H,error:V};else return{parsed:H}}catch(Z){if(G)throw Z;if(t.error(Z.message),Z.help)t.help(Z.help);return{parsed:{},error:Z}}},D4=function(J,$={}){let Q=process.env;if($&&$.processEnv!=null)Q=$.processEnv;let q=$.privateKey||null,G=$.overload||$.override,{parsed:I,errors:Y}=new N4(J,q,Q,G).run();for(let X of Y)if(t.error(X.message),X.help)t.error(X.help);return I},O4=function(J,$,Q={}){let q=!0;if(Q.plain)q=!1;else if(Q.encrypt===!1)q=!1;let G=SQ(Q),I=Q.envKeysFile,{processedEnvs:Y,changedFilepaths:X,unchangedFilepaths:Z}=new Z4(J,$,G,q,I).run(),U="";if(q)U=" with encryption";for(let j of Y)if(t.verbose(`setting for ${j.envFilepath}`),j.error){if(j.error.code==="MISSING_ENV_FILE")t.warn(j.error.message),t.help(`? add one with [echo "HELLO=World" > ${j.envFilepath}] and re-run [dotenvx set]`);else if(t.warn(j.error.message),j.error.help)t.help(j.error.help)}else V4.writeFileX(j.filepath,j.envSrc),t.verbose(`${j.key} set${U} (${j.envFilepath})`),t.debug(`${j.key} set${U} to ${j.value} (${j.envFilepath})`);if(X.length>0)t.success(`✔ set ${J}${U} (${X.join(",")})`);else if(Z.length>0)t.info(`no changes (${Z})`);for(let j of Y)if(j.privateKeyAdded){if(t.success(`✔ key added to ${j.envKeysFilepath} (${j.privateKeyName})`),!C4())t.help("⮕ next run [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys");t.help(`⮕ next run [${j.privateKeyName}='${j.privateKey}' dotenvx get ${J}] to test decryption locally`)}return{processedEnvs:Y,changedFilepaths:X,unchangedFilepaths:Z}},H4=function(J,$={}){let Q=SQ($),q=$.ignore||[],{parsed:G,errors:I}=new j4(J,Q,$.overload,process.env.DOTENV_KEY,$.all,$.envKeysFile).run();for(let Y of I||[]){if(q.includes(Y.code))continue;if($.strict)throw Y;if(t.error(Y.message),Y.help)t.error(Y.help)}if(J){let Y=G[J];if(Y===void 0)return;else return Y}else if($.format==="eval"){let Y="";for(let[X,Z]of Object.entries(G))Y+=`${X}=${escape(Z)}
|
|
28
|
-
`;return Y=Y.trim(),Y}else if($.format==="shell"){let Y="";for(let[X,Z]of Object.entries(G))Y+=`${X}=${Z} `;return Y=Y.trim(),Y}else return G},T4=function(J,$,Q){return new Y4(J,$,Q).run()},w4=function(J,$){return new U4(J,$).run()},L4=function(J,$,Q=null){let q=new W4(J,Q).run();if($)return q[$];else return q};HZ.exports={config:B4,parse:D4,set:O4,get:H4,ls:T4,keypair:L4,genexample:w4,setLogLevel:OZ,logger:t,getColor:G4,bold:I4}});var fQ=Wq(TZ(),1);import R4 from"node:path";var mD=async(J)=>{if(!process.env.USE_ENV)process.env.USE_ENV="development";let $="development",Q={};if(fQ.default.config({convention:"nextjs",ignore:["MISSING_ENV_FILE"],path:wZ([`.env.${$}.local`,`.env.${$}`,".env.local",".env"],J),processEnv:Q,logLevel:"
|
|
28
|
+
`;return Y=Y.trim(),Y}else if($.format==="shell"){let Y="";for(let[X,Z]of Object.entries(G))Y+=`${X}=${Z} `;return Y=Y.trim(),Y}else return G},T4=function(J,$,Q){return new Y4(J,$,Q).run()},w4=function(J,$){return new U4(J,$).run()},L4=function(J,$,Q=null){let q=new W4(J,Q).run();if($)return q[$];else return q};HZ.exports={config:B4,parse:D4,set:O4,get:H4,ls:T4,keypair:L4,genexample:w4,setLogLevel:OZ,logger:t,getColor:G4,bold:I4}});var fQ=Wq(TZ(),1);import R4 from"node:path";var mD=async(J)=>{if(!process.env.USE_ENV)process.env.USE_ENV="development";let $="development",Q={};if(fQ.default.config({convention:"nextjs",ignore:["MISSING_ENV_FILE"],path:wZ([`.env.${$}.local`,`.env.${$}`,".env.local",".env"],J),processEnv:Q,logLevel:"info"}),process.env.USE_ENV!=="development"){let G={};fQ.default.config({ignore:["MISSING_ENV_FILE"],override:!0,path:wZ([`.env.${process.env.USE_ENV}`,`.env.${process.env.USE_ENV}.local`],J),logLevel:"info",processEnv:G});for(let[I,Y]of Object.entries(G)){if(!process.env[I])process.env[I]=Y;if(Q[I]!==Y)process.env[I]=Y}process.env.NODE_ENV="development"}else for(let[q,G]of Object.entries(Q))process.env[q]=G;LZ()},wZ=(J,$)=>{if(!$)return J;return J.map((Q)=>R4.join($,Q))};export{mD as initEnv};
|
|
29
29
|
export{mD as b};
|
|
30
30
|
|
|
31
|
-
//# debugId=
|
|
31
|
+
//# debugId=1F9F454E4D7DFFF064756E2164756E21
|
|
32
32
|
//# sourceMappingURL=init-env.js.map
|