@vezham/env 0.2.0-beta-v0xcli → 0.2.0-poc-env-1.0
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/index.d.ts +2 -1
- package/index.js +1 -1
- package/index.mjs +35 -9
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ export declare const __PRODUCTION__: boolean;
|
|
|
4
4
|
export declare const __PREVIEW__: boolean;
|
|
5
5
|
export declare const __DEBUG__: boolean;
|
|
6
6
|
export declare const IS_BETA: boolean;
|
|
7
|
-
export declare const APP_NAME:
|
|
7
|
+
export declare const APP_NAME: string;
|
|
8
8
|
type T_BASE_API_URL = 'api' | 'mock' | 'local';
|
|
9
9
|
export declare const BASE_API_URL: T_BASE_API_URL;
|
|
10
|
+
export declare const getApiServerEndPoint: () => string | undefined;
|
|
10
11
|
export {};
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var _=typeof document<"u"?document.currentScript:null;const n={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};try{console.log("V_APP_NAME: ",process.env.V_APP_NAME)}catch{console.log("isVite:",typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("index.js",document.baseURI).href}<"u"&&"env"in{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("index.js",document.baseURI).href}),console.log("V_APP_NAME:fb")}try{console.log("NODE_ENV: ",process.env.NODE_ENV)}catch{console.log("NODE_ENV:fb")}try{console.table({url:typeof document>"u"?require("url").pathToFileURL(__filename).href:_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("index.js",document.baseURI).href}),console.table(n)}catch{console.log("import:fb")}try{console.table(process.env)}catch{console.log("process:fb")}let e=process.env||{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("index.js",document.baseURI).href};const r=e.NODE_ENV!=="production",c=e.NODE_ENV==="test",s=e.NODE_ENV==="production",i=e.V_IS_PREVIEW==="true",l=e.V_IS_DEBUG==="true",a=e.V_IS_BETA==="true",u=e.V_APP_NAME||"v0xapp",t=e.V_BASE_API_URL||"api",E=()=>t==="local"?e.V_MOCK_LOCAL_API_URL:t==="mock"?e.V_MOCK_API_URL:config.domain_type===IAM.DomainType.SANDBOX?e.V_APP_SANDBOX_API_URL:config.domain_type===IAM.DomainType.DC?e.V_APP_DC_API_URL:e.V_APP_API_URL;exports.APP_NAME=u;exports.BASE_API_URL=t;exports.IS_BETA=a;exports.__DEBUG__=l;exports.__DEV__=r;exports.__PREVIEW__=i;exports.__PRODUCTION__=s;exports.__TEST__=c;exports.getApiServerEndPoint=E;
|
package/index.mjs
CHANGED
|
@@ -1,11 +1,37 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 };
|
|
2
|
+
try {
|
|
3
|
+
console.log("V_APP_NAME: ", process.env.V_APP_NAME);
|
|
4
|
+
} catch {
|
|
5
|
+
console.log(
|
|
6
|
+
"isVite:",
|
|
7
|
+
typeof import.meta < "u" && "env" in import.meta
|
|
8
|
+
), console.log("V_APP_NAME:fb");
|
|
9
|
+
}
|
|
10
|
+
try {
|
|
11
|
+
console.log("NODE_ENV: ", process.env.NODE_ENV);
|
|
12
|
+
} catch {
|
|
13
|
+
console.log("NODE_ENV:fb");
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
console.table(import.meta), console.table(t);
|
|
17
|
+
} catch {
|
|
18
|
+
console.log("import:fb");
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
console.table(process.env);
|
|
22
|
+
} catch {
|
|
23
|
+
console.log("process:fb");
|
|
24
|
+
}
|
|
25
|
+
let _ = process.env || import.meta || {};
|
|
26
|
+
const r = _.NODE_ENV !== "production", n = _.NODE_ENV === "test", c = _.NODE_ENV === "production", s = _.V_IS_PREVIEW === "true", E = _.V_IS_DEBUG === "true", A = _.V_IS_BETA === "true", l = _.V_APP_NAME || "v0xapp", e = _.V_BASE_API_URL || "api", P = () => e === "local" ? _.V_MOCK_LOCAL_API_URL : e === "mock" ? _.V_MOCK_API_URL : config.domain_type === IAM.DomainType.SANDBOX ? _.V_APP_SANDBOX_API_URL : config.domain_type === IAM.DomainType.DC ? _.V_APP_DC_API_URL : _.V_APP_API_URL;
|
|
2
27
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
n as __TEST__
|
|
28
|
+
l as APP_NAME,
|
|
29
|
+
e as BASE_API_URL,
|
|
30
|
+
A as IS_BETA,
|
|
31
|
+
E as __DEBUG__,
|
|
32
|
+
r as __DEV__,
|
|
33
|
+
s as __PREVIEW__,
|
|
34
|
+
c as __PRODUCTION__,
|
|
35
|
+
n as __TEST__,
|
|
36
|
+
P as getApiServerEndPoint
|
|
11
37
|
};
|