@rpcbase/env 0.24.0 → 0.26.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.
@@ -1,8 +1,3 @@
1
- const cloneEnv = (source) => ({
2
- ...source ?? {}
3
- });
4
- const hasWindow = () => typeof globalThis === "object" && "window" in globalThis;
5
- const hasRbEnv = () => typeof globalThis.__rb_env__ !== "undefined" && globalThis.__rb_env__ !== null;
6
1
  const pickMode = (modeHint, isServer) => {
7
2
  if (typeof modeHint === "string" && modeHint.length > 0) {
8
3
  return modeHint;
@@ -34,8 +29,5 @@ const ensureDefaultEnvFlags = (env, hints) => {
34
29
  }
35
30
  };
36
31
  export {
37
- hasWindow as a,
38
- cloneEnv as c,
39
- ensureDefaultEnvFlags as e,
40
- hasRbEnv as h
32
+ ensureDefaultEnvFlags as e
41
33
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;AAE7D,QAAA,IAAI,GAAG,EAAE,SAAS,CAAA;AAalB,eAAe,GAAG,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;AAE7D,QAAA,IAAI,GAAG,EAAE,SAAS,CAAA;AAiBlB,eAAe,GAAG,CAAA"}
package/dist/index.js CHANGED
@@ -1,9 +1,13 @@
1
1
  import { l as loadProcessEnv } from "./loadProcessEnv-C2ldVaD0.js";
2
+ import { h as hasRbEnv } from "./polyfillShared-Cr5QEVF7.js";
2
3
  let env;
3
4
  const isServer = typeof window === "undefined" || typeof import.meta !== "undefined" && Boolean(false);
4
5
  if (isServer) {
5
6
  loadProcessEnv();
6
7
  env = process.env;
8
+ if (hasRbEnv()) {
9
+ Object.assign(env, globalThis.__rb_env__);
10
+ }
7
11
  } else {
8
12
  env = globalThis.__rb_env__ ?? {};
9
13
  }
package/dist/polyfill.js CHANGED
@@ -1,4 +1,5 @@
1
- import { h as hasRbEnv, e as ensureDefaultEnvFlags, c as cloneEnv, a as hasWindow } from "./ensureDefaultEnvFlags-dWUH3CzL.js";
1
+ import { h as hasRbEnv, c as cloneEnv, a as hasWindow } from "./polyfillShared-Cr5QEVF7.js";
2
+ import { e as ensureDefaultEnvFlags } from "./ensureDefaultEnvFlags-PHYYJEci.js";
2
3
  const __vite_import_meta_env__ = { "BASE_URL": "/", "DEV": false, "MODE": "production", "PROD": true, "SSR": false };
3
4
  const resolveViteEnv = () => {
4
5
  if (typeof __vite_env__ === "undefined") {
@@ -1,5 +1,6 @@
1
1
  import { l as loadProcessEnv } from "./loadProcessEnv-C2ldVaD0.js";
2
- import { h as hasRbEnv, e as ensureDefaultEnvFlags, c as cloneEnv } from "./ensureDefaultEnvFlags-dWUH3CzL.js";
2
+ import { h as hasRbEnv, c as cloneEnv } from "./polyfillShared-Cr5QEVF7.js";
3
+ import { e as ensureDefaultEnvFlags } from "./ensureDefaultEnvFlags-PHYYJEci.js";
3
4
  const resolveModeHint = () => {
4
5
  if (typeof process === "undefined") {
5
6
  return void 0;
@@ -0,0 +1,10 @@
1
+ const cloneEnv = (source) => ({
2
+ ...source ?? {}
3
+ });
4
+ const hasWindow = () => typeof globalThis === "object" && "window" in globalThis;
5
+ const hasRbEnv = () => typeof globalThis.__rb_env__ !== "undefined" && globalThis.__rb_env__ !== null;
6
+ export {
7
+ hasWindow as a,
8
+ cloneEnv as c,
9
+ hasRbEnv as h
10
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/env",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"