@moq/net 0.3.4 → 0.3.5

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/util/log.js ADDED
@@ -0,0 +1,17 @@
1
+ /* @ts-self-types="./log.d.ts" */
2
+ /** Renders a relay URL without user credentials, query parameters, or fragment. */
3
+ export function redact(url) {
4
+ return `${url.origin}${url.pathname}`;
5
+ }
6
+ /** Whether the consumer environment enables development diagnostics. */
7
+ export function dev() {
8
+ // Bundlers expose a boolean DEV; Bun exposes environment variables as strings.
9
+ // @ts-ignore - Some environments don't recognize import.meta.env
10
+ const env = import.meta.env;
11
+ if (typeof env === "undefined")
12
+ return false;
13
+ if (typeof env.DEV === "boolean")
14
+ return env.DEV;
15
+ return env.NODE_ENV !== "production" && env.MODE !== "production";
16
+ }
17
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/util/log.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,UAAU,MAAM,CAAC,GAAQ;IAC9B,OAAO,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;AACvC,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,GAAG;IAClB,+EAA+E;IAC/E,iEAAiE;IACjE,MAAM,GAAG,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC;IAC5B,IAAI,OAAO,GAAG,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IAC7C,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC,GAAG,CAAC;IACjD,OAAO,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC;AACnE,CAAC","sourcesContent":["/** Renders a relay URL without user credentials, query parameters, or fragment. */\nexport function redact(url: URL): string {\n\treturn `${url.origin}${url.pathname}`;\n}\n\n/** Whether the consumer environment enables development diagnostics. */\nexport function dev(): boolean {\n\t// Bundlers expose a boolean DEV; Bun exposes environment variables as strings.\n\t// @ts-ignore - Some environments don't recognize import.meta.env\n\tconst env = import.meta.env;\n\tif (typeof env === \"undefined\") return false;\n\tif (typeof env.DEV === \"boolean\") return env.DEV;\n\treturn env.NODE_ENV !== \"production\" && env.MODE !== \"production\";\n}\n"]}