globables 1.0.1 → 2.0.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/README.md +12 -2
- package/dist/index.cjs +42 -37
- package/dist/index.cjs.map +4 -7
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -13
- package/dist/index.js.map +4 -7
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
<h1>
|
|
2
|
+
GlobAbles
|
|
3
|
+
<a href="https://mibecode.com">
|
|
4
|
+
<img align="right" title="≥95% Human Code" alt="≥95% Human Code" src="https://mibecode.com/badge.svg" />
|
|
5
|
+
</a>
|
|
6
|
+
|
|
7
|
+
<img align="right" alt="NPM Version" src="https://img.shields.io/npm/v/globables?color=white" />
|
|
8
|
+
|
|
9
|
+
<img align="right" alt="Node LTS" src="https://img.shields.io/node/v-lts/globables?color=%23962eff">
|
|
10
|
+
</h1>
|
|
11
|
+
|
|
2
12
|
|
|
3
13
|
CLI/ENV constants for Node.js-like runtimes, supports: [Node.js](https://nodejs.org/), [Deno](https://deno.com/), [Bun](https://bun.sh/), [QuickJS](https://bellard.org/quickjs/), and [QuickJS-NG](https://quickjs-ng.github.io/quickjs/)
|
|
4
14
|
|
|
@@ -11,7 +21,7 @@ import {
|
|
|
11
21
|
|
|
12
22
|
GLOBAL_THIS.console.log(`Shellin with ${ENV['SHELL']} and commandin ${ARGV.join(', ')}`);
|
|
13
23
|
```
|
|
14
|
-
> ╸`ARGV` - [command-line arguments](https://nodejs.org/api/process.html#processargv)<br/>
|
|
24
|
+
> ╸`ARGV` - [command-line arguments](https://nodejs.org/api/process.html#processargv) (includes an export alias of `ARGS`)<br/>
|
|
15
25
|
> ╸`ENV` - [process environment](https://nodejs.org/api/process.html#processenv) <br/>
|
|
16
26
|
> ╸`GLOBAL_THIS` - [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis) object; pollyfill'ed if missing, like prehistoric node <12<br/>
|
|
17
27
|
> ╸ All Runtimes/Globals Tested -> [./src/index.test.ts](https://github.com/fetchTe/globables/blob/master/src/index.test.ts)<br/>
|
package/dist/index.cjs
CHANGED
|
@@ -1,56 +1,61 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
6
|
-
var __toCommonJS = (from) => {
|
|
7
|
-
var entry = __moduleCache.get(from), desc;
|
|
8
|
-
if (entry)
|
|
9
|
-
return entry;
|
|
10
|
-
entry = __defProp({}, "__esModule", { value: true });
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
12
|
-
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
13
|
-
get: () => from[key],
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
}));
|
|
16
|
-
__moduleCache.set(from, entry);
|
|
17
|
-
return entry;
|
|
18
|
-
};
|
|
19
5
|
var __export = (target, all) => {
|
|
20
6
|
for (var name in all)
|
|
21
|
-
__defProp(target, name, {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
27
16
|
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
|
|
29
19
|
// src/index.ts
|
|
30
|
-
var
|
|
31
|
-
__export(
|
|
32
|
-
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
|
+
ARGS: () => ARGS,
|
|
23
|
+
ARGV: () => ARGV,
|
|
33
24
|
ENV: () => ENV,
|
|
34
|
-
|
|
25
|
+
GLOBAL_THIS: () => GLOBAL_THIS
|
|
35
26
|
});
|
|
36
|
-
module.exports = __toCommonJS(
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
37
28
|
var GLOBAL_THIS = /* @__PURE__ */ (() => typeof globalThis === "object" ? globalThis : (() => {
|
|
38
|
-
(function(Object2) {
|
|
29
|
+
!(function(Object2) {
|
|
39
30
|
function get() {
|
|
40
31
|
const e = this || self;
|
|
41
32
|
e.globalThis = e, delete Object2.prototype._T_;
|
|
42
33
|
}
|
|
43
|
-
typeof globalThis
|
|
34
|
+
"object" != typeof globalThis && (this ? get() : (Object2.defineProperty(Object2.prototype, "_T_", { configurable: true, get }), _T_));
|
|
44
35
|
})(Object);
|
|
45
36
|
return typeof globalThis === "object" ? globalThis : {};
|
|
46
37
|
})())();
|
|
47
|
-
var ARGV = /* @__PURE__ */ (() =>
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
38
|
+
var ARGV = /* @__PURE__ */ (() => {
|
|
39
|
+
var _a, _b, _c, _d;
|
|
40
|
+
return typeof process === "undefined" ? typeof scriptArgs !== "undefined" ? scriptArgs : [] : (_d = (GLOBAL_THIS == null ? void 0 : GLOBAL_THIS["Deno"]) ? (_c = (_a = GLOBAL_THIS == null ? void 0 : GLOBAL_THIS["Deno"]) == null ? void 0 : _a.args) != null ? _c : ((_b = process["args"]) == null ? void 0 : _b.length) ? process["args"] : process["argv"] : process["argv"]) != null ? _d : [];
|
|
41
|
+
})();
|
|
42
|
+
var ARGS = ARGV;
|
|
43
|
+
var ENV = /* @__PURE__ */ (() => {
|
|
44
|
+
var _a, _b, _c, _d;
|
|
45
|
+
return typeof process === "undefined" ? typeof ((_a = GLOBAL_THIS == null ? void 0 : GLOBAL_THIS["std"]) == null ? void 0 : _a.getenviron) === "function" ? (_d = (_c = (_b = GLOBAL_THIS["std"]).getenviron) == null ? void 0 : _c.call(_b)) != null ? _d : {} : {} : !(GLOBAL_THIS == null ? void 0 : GLOBAL_THIS["Deno"]) ? process["env"] : (() => {
|
|
46
|
+
var _a2, _b2, _c2, _d2, _e, _f;
|
|
47
|
+
try {
|
|
48
|
+
return (_f = (_c2 = (_b2 = (_a2 = GLOBAL_THIS == null ? void 0 : GLOBAL_THIS["Deno"]) == null ? void 0 : _a2.env) == null ? void 0 : _b2.toObject) == null ? void 0 : _c2.call(_b2)) != null ? _f : ((_d2 = process["env"]) == null ? void 0 : _d2.toObject) ? (_e = process["env"]) == null ? void 0 : _e.toObject() : process["env"];
|
|
49
|
+
} catch (_err) {
|
|
50
|
+
}
|
|
51
|
+
return {};
|
|
52
|
+
})();
|
|
53
|
+
})();
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
ARGS,
|
|
57
|
+
ARGV,
|
|
58
|
+
ENV,
|
|
59
|
+
GLOBAL_THIS
|
|
60
|
+
});
|
|
56
61
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
|
|
6
|
-
]
|
|
7
|
-
|
|
8
|
-
"debugId": "595C4701BDF3FE0964756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
|
4
|
+
"sourcesContent": ["export type GlobalThis = typeof globalThis;\nexport type ProcessArgv = NodeJS.Process['argv'];\nexport type ProcessEnv = NodeJS.ProcessEnv;\n\n\n/**\n * globalThis object - with pollyfil in case of prehistoric node <12\n * @see {@link https://tc39.es/ecma262/multipage/global-object.html#sec-globalthis|globalThis spec - ECMAScript }\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis|globalThis docs - MDN}\n */\nexport const GLOBAL_THIS = /* @__PURE__ */ (() =>\n typeof globalThis === 'object'\n ? globalThis\n /**\n * globalThis pollyfill\n * @see {@link https://mathiasbynens.be/notes/globalthis}\n * @see {@link https://github.com/ungap/global-this}\n */\n : (() => {\n // @ts-expect-error - globalThis pollyfill for prehistoric node envs\n // eslint-disable-next-line\n !(function (Object) {function get() {const e = this || self; e.globalThis = e, delete Object.prototype._T_;}'object' != typeof globalThis && (this ? get() : (Object.defineProperty(Object.prototype, '_T_', {configurable:!0, get:get}), _T_));}(Object));\n // just in case\n return typeof globalThis === 'object' ? globalThis : {};\n })()\n)() as GlobalThis;\n\n\n/**\n * command-line arguments (pure/iffe wrapped so we can shake the tree)\n * @see {@link https://nodejs.org/api/process.html#processargv|process.argv - Node.js}\n * @see {@link https://bellard.org/quickjs/quickjs.html#Global-objects|scriptArgs - QuickJS}\n * @see {@link https://quickjs-ng.github.io/quickjs/stdlib#scriptargs|scriptArgs - QuickJS-NG}\n * @see {@link https://docs.deno.com/api/node/process/~/Process#property_argv|process.argv - Deno}\n * @see {@link https://docs.deno.com/api/deno/~/Deno.CommandOptions#property_args|Deno.args - Deno}\n */\nexport const ARGV: NodeJS.Process['argv'] = /* @__PURE__ */ (() =>\n typeof process === 'undefined'\n /** quickJs {@link https://bellard.org/quickjs/quickjs.html#Global-objects} */\n ? typeof scriptArgs !== 'undefined'\n ? scriptArgs\n : []\n : ((GLOBAL_THIS as never)?.['Deno']\n // @NOTE: DENO.args does not require any perm requests\n // @NOTE: if --allow-all is used, no args (like --allow-env), use default\n // @ts-expect-error deno uses 'args' rather than 'argv'\n ? (GLOBAL_THIS as never)?.['Deno']?.args\n // @ts-expect-error deno uses 'args' rather than 'argv'\n ?? (process['args']?.length ? process['args'] : process['argv'])\n : process['argv']\n ) ?? []\n)();\nexport const ARGS = ARGV;\n\n/**\n * process environment (ENV) variables\n * @see {@link https://nodejs.org/api/process.html#processenv|process.env - Node.js}\n * @see {@link https://docs.deno.com/runtime/reference/env_variables/#built-in-deno.env|env - Deno}\n * @see {@link https://bellard.org/quickjs/quickjs.html#Global-objects|getenviron - QuickJS}\n * @see {@link https://quickjs-ng.github.io/quickjs/stdlib#getenviron|getenviron - QuickJS-NG}\n */\nexport const ENV = /* @__PURE__ */ (() => typeof process === 'undefined'\n // @ts-expect-error quickjs std\n ? typeof (GLOBAL_THIS as never)?.['std']?.getenviron === 'function'\n // @ts-expect-error quickjs std\n ? ((GLOBAL_THIS as never)['std'].getenviron?.() ?? {})\n : {}\n : (!(GLOBAL_THIS as never)?.['Deno']\n ? process['env']\n : (() => {\n try {\n // @NOTE: if --allow-all is used, no toObject (like --allow-env), use default\n // @NOTE: DENO.env.toObject only requires one perm request while process requires many\n // @ts-expect-error deno perms\n // eslint-disable-next-line @stylistic/max-len\n return (GLOBAL_THIS as never)?.['Deno']?.env?.toObject?.() ?? (process['env']?.toObject ? process['env']?.toObject() : process['env']);\n } catch (_err) { /* ignore */ }\n return {};\n })())\n)() as ProcessEnv;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,IAAM,cAA+B,uBAC1C,OAAO,eAAe,WAClB,cAMC,MAAM;AAGP,IAAE,SAAUA,SAAQ;AAAC,aA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@@ -16,6 +16,7 @@ export declare const GLOBAL_THIS: GlobalThis;
|
|
|
16
16
|
* @see {@link https://docs.deno.com/api/deno/~/Deno.CommandOptions#property_args|Deno.args - Deno}
|
|
17
17
|
*/
|
|
18
18
|
export declare const ARGV: NodeJS.Process['argv'];
|
|
19
|
+
export declare const ARGS: string[];
|
|
19
20
|
/**
|
|
20
21
|
* process environment (ENV) variables
|
|
21
22
|
* @see {@link https://nodejs.org/api/process.html#processenv|process.env - Node.js}
|
package/dist/index.d.mts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const GLOBAL_THIS: GlobalThis;
|
|
|
16
16
|
* @see {@link https://docs.deno.com/api/deno/~/Deno.CommandOptions#property_args|Deno.args - Deno}
|
|
17
17
|
*/
|
|
18
18
|
export declare const ARGV: NodeJS.Process['argv'];
|
|
19
|
+
export declare const ARGS: string[];
|
|
19
20
|
/**
|
|
20
21
|
* process environment (ENV) variables
|
|
21
22
|
* @see {@link https://nodejs.org/api/process.html#processenv|process.env - Node.js}
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const GLOBAL_THIS: GlobalThis;
|
|
|
16
16
|
* @see {@link https://docs.deno.com/api/deno/~/Deno.CommandOptions#property_args|Deno.args - Deno}
|
|
17
17
|
*/
|
|
18
18
|
export declare const ARGV: NodeJS.Process['argv'];
|
|
19
|
+
export declare const ARGS: string[];
|
|
19
20
|
/**
|
|
20
21
|
* process environment (ENV) variables
|
|
21
22
|
* @see {@link https://nodejs.org/api/process.html#processenv|process.env - Node.js}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC;AAC3C,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACjD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAG3C;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAejB,UAAU,CAAC;AAGlB;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAerC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC;AAC3C,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACjD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAG3C;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAejB,UAAU,CAAC;AAGlB;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAerC,CAAC;AACJ,eAAO,MAAM,IAAI,UAAO,CAAC;AAEzB;;;;;;GAMG;AACH,eAAO,MAAM,GAAG,EAkBT,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
var GLOBAL_THIS = /* @__PURE__ */ (() => typeof globalThis === "object" ? globalThis : (() => {
|
|
3
|
-
(function(Object2) {
|
|
3
|
+
!(function(Object2) {
|
|
4
4
|
function get() {
|
|
5
5
|
const e = this || self;
|
|
6
6
|
e.globalThis = e, delete Object2.prototype._T_;
|
|
7
7
|
}
|
|
8
|
-
typeof globalThis
|
|
8
|
+
"object" != typeof globalThis && (this ? get() : (Object2.defineProperty(Object2.prototype, "_T_", { configurable: true, get }), _T_));
|
|
9
9
|
})(Object);
|
|
10
10
|
return typeof globalThis === "object" ? globalThis : {};
|
|
11
11
|
})())();
|
|
12
|
-
var ARGV = /* @__PURE__ */ (() =>
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
var ARGV = /* @__PURE__ */ (() => {
|
|
13
|
+
var _a, _b, _c, _d;
|
|
14
|
+
return typeof process === "undefined" ? typeof scriptArgs !== "undefined" ? scriptArgs : [] : (_d = (GLOBAL_THIS == null ? void 0 : GLOBAL_THIS["Deno"]) ? (_c = (_a = GLOBAL_THIS == null ? void 0 : GLOBAL_THIS["Deno"]) == null ? void 0 : _a.args) != null ? _c : ((_b = process["args"]) == null ? void 0 : _b.length) ? process["args"] : process["argv"] : process["argv"]) != null ? _d : [];
|
|
15
|
+
})();
|
|
16
|
+
var ARGS = ARGV;
|
|
17
|
+
var ENV = /* @__PURE__ */ (() => {
|
|
18
|
+
var _a, _b, _c, _d;
|
|
19
|
+
return typeof process === "undefined" ? typeof ((_a = GLOBAL_THIS == null ? void 0 : GLOBAL_THIS["std"]) == null ? void 0 : _a.getenviron) === "function" ? (_d = (_c = (_b = GLOBAL_THIS["std"]).getenviron) == null ? void 0 : _c.call(_b)) != null ? _d : {} : {} : !(GLOBAL_THIS == null ? void 0 : GLOBAL_THIS["Deno"]) ? process["env"] : (() => {
|
|
20
|
+
var _a2, _b2, _c2, _d2, _e, _f;
|
|
21
|
+
try {
|
|
22
|
+
return (_f = (_c2 = (_b2 = (_a2 = GLOBAL_THIS == null ? void 0 : GLOBAL_THIS["Deno"]) == null ? void 0 : _a2.env) == null ? void 0 : _b2.toObject) == null ? void 0 : _c2.call(_b2)) != null ? _f : ((_d2 = process["env"]) == null ? void 0 : _d2.toObject) ? (_e = process["env"]) == null ? void 0 : _e.toObject() : process["env"];
|
|
23
|
+
} catch (_err) {
|
|
24
|
+
}
|
|
25
|
+
return {};
|
|
26
|
+
})();
|
|
27
|
+
})();
|
|
19
28
|
export {
|
|
20
|
-
|
|
29
|
+
ARGS,
|
|
30
|
+
ARGV,
|
|
21
31
|
ENV,
|
|
22
|
-
|
|
32
|
+
GLOBAL_THIS
|
|
23
33
|
};
|
|
24
|
-
|
|
25
|
-
//# debugId=3025BAE9C191ECCF64756E2164756E21
|
|
26
34
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
|
|
6
|
-
]
|
|
7
|
-
|
|
8
|
-
"debugId": "3025BAE9C191ECCF64756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
|
4
|
+
"sourcesContent": ["export type GlobalThis = typeof globalThis;\nexport type ProcessArgv = NodeJS.Process['argv'];\nexport type ProcessEnv = NodeJS.ProcessEnv;\n\n\n/**\n * globalThis object - with pollyfil in case of prehistoric node <12\n * @see {@link https://tc39.es/ecma262/multipage/global-object.html#sec-globalthis|globalThis spec - ECMAScript }\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis|globalThis docs - MDN}\n */\nexport const GLOBAL_THIS = /* @__PURE__ */ (() =>\n typeof globalThis === 'object'\n ? globalThis\n /**\n * globalThis pollyfill\n * @see {@link https://mathiasbynens.be/notes/globalthis}\n * @see {@link https://github.com/ungap/global-this}\n */\n : (() => {\n // @ts-expect-error - globalThis pollyfill for prehistoric node envs\n // eslint-disable-next-line\n !(function (Object) {function get() {const e = this || self; e.globalThis = e, delete Object.prototype._T_;}'object' != typeof globalThis && (this ? get() : (Object.defineProperty(Object.prototype, '_T_', {configurable:!0, get:get}), _T_));}(Object));\n // just in case\n return typeof globalThis === 'object' ? globalThis : {};\n })()\n)() as GlobalThis;\n\n\n/**\n * command-line arguments (pure/iffe wrapped so we can shake the tree)\n * @see {@link https://nodejs.org/api/process.html#processargv|process.argv - Node.js}\n * @see {@link https://bellard.org/quickjs/quickjs.html#Global-objects|scriptArgs - QuickJS}\n * @see {@link https://quickjs-ng.github.io/quickjs/stdlib#scriptargs|scriptArgs - QuickJS-NG}\n * @see {@link https://docs.deno.com/api/node/process/~/Process#property_argv|process.argv - Deno}\n * @see {@link https://docs.deno.com/api/deno/~/Deno.CommandOptions#property_args|Deno.args - Deno}\n */\nexport const ARGV: NodeJS.Process['argv'] = /* @__PURE__ */ (() =>\n typeof process === 'undefined'\n /** quickJs {@link https://bellard.org/quickjs/quickjs.html#Global-objects} */\n ? typeof scriptArgs !== 'undefined'\n ? scriptArgs\n : []\n : ((GLOBAL_THIS as never)?.['Deno']\n // @NOTE: DENO.args does not require any perm requests\n // @NOTE: if --allow-all is used, no args (like --allow-env), use default\n // @ts-expect-error deno uses 'args' rather than 'argv'\n ? (GLOBAL_THIS as never)?.['Deno']?.args\n // @ts-expect-error deno uses 'args' rather than 'argv'\n ?? (process['args']?.length ? process['args'] : process['argv'])\n : process['argv']\n ) ?? []\n)();\nexport const ARGS = ARGV;\n\n/**\n * process environment (ENV) variables\n * @see {@link https://nodejs.org/api/process.html#processenv|process.env - Node.js}\n * @see {@link https://docs.deno.com/runtime/reference/env_variables/#built-in-deno.env|env - Deno}\n * @see {@link https://bellard.org/quickjs/quickjs.html#Global-objects|getenviron - QuickJS}\n * @see {@link https://quickjs-ng.github.io/quickjs/stdlib#getenviron|getenviron - QuickJS-NG}\n */\nexport const ENV = /* @__PURE__ */ (() => typeof process === 'undefined'\n // @ts-expect-error quickjs std\n ? typeof (GLOBAL_THIS as never)?.['std']?.getenviron === 'function'\n // @ts-expect-error quickjs std\n ? ((GLOBAL_THIS as never)['std'].getenviron?.() ?? {})\n : {}\n : (!(GLOBAL_THIS as never)?.['Deno']\n ? process['env']\n : (() => {\n try {\n // @NOTE: if --allow-all is used, no toObject (like --allow-env), use default\n // @NOTE: DENO.env.toObject only requires one perm request while process requires many\n // @ts-expect-error deno perms\n // eslint-disable-next-line @stylistic/max-len\n return (GLOBAL_THIS as never)?.['Deno']?.env?.toObject?.() ?? (process['env']?.toObject ? process['env']?.toObject() : process['env']);\n } catch (_err) { /* ignore */ }\n return {};\n })())\n)() as ProcessEnv;\n"],
|
|
5
|
+
"mappings": ";AA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ACL;",
|
|
6
|
+
"names": ["Object", "_a", "_b", "_c", "_d"]
|
|
7
|
+
}
|
package/dist/index.min.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var c=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var d=(o,e)=>{for(var r in e)c(o,r,{get:e[r],enumerable:!0})},h=(o,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of b(e))!y.call(o,n)&&n!==r&&c(o,n,{get:()=>e[n],enumerable:!(t=f(e,n))||t.enumerable});return o};var u=o=>h(c({},"__esModule",{value:!0}),o);var j={};d(j,{ARGS:()=>x,ARGV:()=>v,ENV:()=>P,GLOBAL_THIS:()=>s});module.exports=u(j);var s=typeof globalThis=="object"?globalThis:((function(o){function e(){let r=this||self;r.globalThis=r,delete o.prototype._T_}typeof globalThis!="object"&&(this?e():(o.defineProperty(o.prototype,"_T_",{configurable:!0,get:e}),_T_))})(Object),typeof globalThis=="object"?globalThis:{}),v=(()=>{var o,e,r,t;return typeof process>"u"?typeof scriptArgs<"u"?scriptArgs:[]:(t=s!=null&&s.Deno?(r=(o=s==null?void 0:s.Deno)==null?void 0:o.args)!=null?r:(e=process.args)!=null&&e.length?process.args:process.argv:process.argv)!=null?t:[]})(),x=v,P=(()=>{var o,e,r,t;return typeof process>"u"?typeof((o=s==null?void 0:s.std)==null?void 0:o.getenviron)=="function"?(t=(r=(e=s.std).getenviron)==null?void 0:r.call(e))!=null?t:{}:{}:s!=null&&s.Deno?(()=>{var n,p,a,g,i,l;try{return(l=(a=(p=(n=s==null?void 0:s.Deno)==null?void 0:n.env)==null?void 0:p.toObject)==null?void 0:a.call(p))!=null?l:(g=process.env)!=null&&g.toObject?(i=process.env)==null?void 0:i.toObject():process.env}catch{}return{}})():process.env})();0&&(module.exports={ARGS,ARGV,ENV,GLOBAL_THIS});
|
package/dist/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var e=typeof globalThis=="object"?globalThis:((function(o){function s(){let r=this||self;r.globalThis=r,delete o.prototype._T_}typeof globalThis!="object"&&(this?s():(o.defineProperty(o.prototype,"_T_",{configurable:!0,get:s}),_T_))})(Object),typeof globalThis=="object"?globalThis:{}),l=(()=>{var o,s,r,t;return typeof process>"u"?typeof scriptArgs<"u"?scriptArgs:[]:(t=e!=null&&e.Deno?(r=(o=e==null?void 0:e.Deno)==null?void 0:o.args)!=null?r:(s=process.args)!=null&&s.length?process.args:process.argv:process.argv)!=null?t:[]})(),f=l,b=(()=>{var o,s,r,t;return typeof process>"u"?typeof((o=e==null?void 0:e.std)==null?void 0:o.getenviron)=="function"?(t=(r=(s=e.std).getenviron)==null?void 0:r.call(s))!=null?t:{}:{}:e!=null&&e.Deno?(()=>{var p,n,c,a,g,i;try{return(i=(c=(n=(p=e==null?void 0:e.Deno)==null?void 0:p.env)==null?void 0:n.toObject)==null?void 0:c.call(n))!=null?i:(a=process.env)!=null&&a.toObject?(g=process.env)==null?void 0:g.toObject():process.env}catch{}return{}})():process.env})();export{f as ARGS,l as ARGV,b as ENV,e as GLOBAL_THIS};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "globables",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "CLI/ENV constants for Node.js-like runtimes, supports: Node.js, Deno, Bun, QuickJS, and QuickJS-NG",
|
|
5
5
|
"homepage": "https://github.com/fetchTe/globables",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"@types/eslint": "9.6.1",
|
|
23
23
|
"@types/node": "24.3.3",
|
|
24
24
|
"@typescript-eslint/parser": "8.43.0",
|
|
25
|
+
"esbuild": "0.25.10",
|
|
25
26
|
"eslint": "9.35.0",
|
|
26
27
|
"typescript": "5.9.2",
|
|
27
28
|
"typescript-eslint": "8.43.0"
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
"url": "https://github.com/fetchTe/globables/issues"
|
|
59
60
|
},
|
|
60
61
|
"engines": {
|
|
61
|
-
"node": ">=
|
|
62
|
+
"node": ">=4.9.1"
|
|
62
63
|
},
|
|
63
64
|
"publishConfig": {
|
|
64
65
|
"access": "public"
|