@thi.ng/expose 1.1.12 → 1.1.14
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/CHANGELOG.md +9 -1
- package/README.md +4 -4
- package/index.d.ts +3 -3
- package/index.js +8 -13
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2022-10-
|
|
3
|
+
- **Last updated**: 2022-10-28T19:08:39Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,14 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [1.1.13](https://github.com/thi-ng/umbrella/tree/@thi.ng/expose@1.1.13) (2022-10-04)
|
|
13
|
+
|
|
14
|
+
#### 🩹 Bug fixes
|
|
15
|
+
|
|
16
|
+
- update expose switch logic ([9a98c3e](https://github.com/thi-ng/umbrella/commit/9a98c3e))
|
|
17
|
+
- remove support for obsolete (& broken) snowpack setup
|
|
18
|
+
- add support for Vite's env var handling
|
|
19
|
+
|
|
12
20
|
## [1.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/expose@1.1.0) (2021-11-17)
|
|
13
21
|
|
|
14
22
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -26,9 +26,9 @@ This package provides a single function
|
|
|
26
26
|
[`exposeGlobal()`](https://docs.thi.ng/umbrella/expose/modules.html#exposeGlobal)
|
|
27
27
|
to expose a variable in the global scope (e.g. for development/debugging
|
|
28
28
|
purposes). It's behavior is controled by the `UMBRELLA_GLOBALS` or
|
|
29
|
-
`
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
`VITE_UMBRELLA_GLOBALS` environment variables - if either is set (to a non-empty
|
|
30
|
+
string) the function will **always** be enabled. Otherwise (by default),
|
|
31
|
+
`exposeGlobal()` is **disabled for production builds**, i.e. if
|
|
32
32
|
`process.env.NODE_ENV === "production"`.
|
|
33
33
|
|
|
34
34
|
## Status
|
|
@@ -60,7 +60,7 @@ node --experimental-repl-await
|
|
|
60
60
|
> const expose = await import("@thi.ng/expose");
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
Package sizes (gzipped, pre-treeshake): ESM:
|
|
63
|
+
Package sizes (gzipped, pre-treeshake): ESM: 207 bytes
|
|
64
64
|
|
|
65
65
|
## Dependencies
|
|
66
66
|
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Exposes given `value` as `id` in global scope, iff `always = true`
|
|
3
|
-
*
|
|
4
|
-
* `UMBRELLA_GLOBALS` env var is set to 1.
|
|
2
|
+
* Exposes given `value` as `id` in global scope, iff `always = true` (default:
|
|
3
|
+
* false) or if `process.env.NODE_ENV != "production"` or if the
|
|
4
|
+
* `UMBRELLA_GLOBALS` or `VITE_UMBRELLA_GLOBALS` env var is set to 1.
|
|
5
5
|
*
|
|
6
6
|
* @param id -
|
|
7
7
|
* @param value -
|
package/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
// FIXME https://github.com/snowpackjs/snowpack/issues/3621#issuecomment-907731004
|
|
2
|
-
// FIXME https://github.com/snowpackjs/snowpack/issues/3768
|
|
3
|
-
/* imports meta.hot method */
|
|
4
1
|
/**
|
|
5
|
-
* Exposes given `value` as `id` in global scope, iff `always = true`
|
|
6
|
-
*
|
|
7
|
-
* `UMBRELLA_GLOBALS` env var is set to 1.
|
|
2
|
+
* Exposes given `value` as `id` in global scope, iff `always = true` (default:
|
|
3
|
+
* false) or if `process.env.NODE_ENV != "production"` or if the
|
|
4
|
+
* `UMBRELLA_GLOBALS` or `VITE_UMBRELLA_GLOBALS` env var is set to 1.
|
|
8
5
|
*
|
|
9
6
|
* @param id -
|
|
10
7
|
* @param value -
|
|
@@ -18,15 +15,13 @@ export const exposeGlobal = (id, value, always = false) => {
|
|
|
18
15
|
: undefined;
|
|
19
16
|
if (glob &&
|
|
20
17
|
(always ||
|
|
21
|
-
(
|
|
22
|
-
typeof process.env !== "undefined"
|
|
18
|
+
(typeof process !== "undefined"
|
|
23
19
|
? process.env.NODE_ENV !== "production" ||
|
|
24
20
|
!!process.env.UMBRELLA_GLOBALS
|
|
25
|
-
:
|
|
26
|
-
?
|
|
27
|
-
!!
|
|
28
|
-
|
|
29
|
-
: true)())) {
|
|
21
|
+
: import.meta.env
|
|
22
|
+
? import.meta.env.MODE !== "production" ||
|
|
23
|
+
!!import.meta.env.VITE_UMBRELLA_GLOBALS
|
|
24
|
+
: true))) {
|
|
30
25
|
glob[id] = value;
|
|
31
26
|
}
|
|
32
27
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/expose",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"description": "Conditional global variable exposition",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@microsoft/api-extractor": "^7.
|
|
38
|
-
"@thi.ng/testament": "^0.3.
|
|
39
|
-
"@types/node": "^18.7
|
|
37
|
+
"@microsoft/api-extractor": "^7.33.5",
|
|
38
|
+
"@thi.ng/testament": "^0.3.4",
|
|
39
|
+
"@types/node": "^18.11.7",
|
|
40
40
|
"rimraf": "^3.0.2",
|
|
41
41
|
"tools": "^0.0.1",
|
|
42
|
-
"typedoc": "^0.
|
|
43
|
-
"typescript": "^4.8.
|
|
42
|
+
"typedoc": "^0.23.18",
|
|
43
|
+
"typescript": "^4.8.4"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|
|
46
46
|
"global",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"thi.ng": {},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "41e59c7ad9bf24bb0230a5f60d05715e0fc1c1e6\n"
|
|
72
72
|
}
|