@ctx-core/env 17.4.61 → 17.4.65
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 +1 -8
- package/index.js +1 -8
- package/package.json +3 -12
- package/CACHE_VERSION/index.d.ts +0 -10
- package/CACHE_VERSION/index.js +0 -14
- package/NODE_ENV/index.d.ts +0 -10
- package/NODE_ENV/index.js +0 -14
- package/VERSION/index.d.ts +0 -7
- package/VERSION/index.js +0 -14
- package/import_meta_env/index.d.ts +0 -10
- package/import_meta_env/index.js +0 -18
- package/is_development/index.d.ts +0 -6
- package/is_development/index.js +0 -9
- package/is_production/index.d.ts +0 -10
- package/is_production/index.js +0 -12
- package/is_staging/index.d.ts +0 -9
- package/is_staging/index.js +0 -12
- package/missing_env__throw/index.d.ts +0 -8
- package/missing_env__throw/index.js +0 -19
package/index.d.ts
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
export * from './import_meta_env/index.js'
|
|
3
|
-
export * from './is_development/index.js'
|
|
4
|
-
export * from './is_production/index.js'
|
|
5
|
-
export * from './is_staging/index.js'
|
|
6
|
-
export * from './missing_env__throw/index.js'
|
|
7
|
-
export * from './NODE_ENV/index.js'
|
|
8
|
-
export * from './VERSION/index.js'
|
|
1
|
+
export * from 'ctx-core/env'
|
package/index.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
export * from './import_meta_env/index.js'
|
|
3
|
-
export * from './is_development/index.js'
|
|
4
|
-
export * from './is_production/index.js'
|
|
5
|
-
export * from './is_staging/index.js'
|
|
6
|
-
export * from './missing_env__throw/index.js'
|
|
7
|
-
export * from './NODE_ENV/index.js'
|
|
8
|
-
export * from './VERSION/index.js'
|
|
1
|
+
export * from 'ctx-core/env'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/env",
|
|
3
|
-
"version": "17.4.
|
|
3
|
+
"version": "17.4.65",
|
|
4
4
|
"description": "ctx-core env",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -20,15 +20,7 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"*.d.ts",
|
|
22
22
|
"*.js",
|
|
23
|
-
"*.json"
|
|
24
|
-
"./CACHE_VERSION",
|
|
25
|
-
"./import_meta_env",
|
|
26
|
-
"./is_development",
|
|
27
|
-
"./is_production",
|
|
28
|
-
"./is_staging",
|
|
29
|
-
"./missing_env__throw",
|
|
30
|
-
"./NODE_ENV",
|
|
31
|
-
"./VERSION"
|
|
23
|
+
"*.json"
|
|
32
24
|
],
|
|
33
25
|
"types": "./index.d.ts",
|
|
34
26
|
"exports": {
|
|
@@ -36,8 +28,7 @@
|
|
|
36
28
|
"./package.json": "./package.json"
|
|
37
29
|
},
|
|
38
30
|
"dependencies": {
|
|
39
|
-
"
|
|
40
|
-
"ctx-core": "^5.1.0"
|
|
31
|
+
"ctx-core": "^5.2.3"
|
|
41
32
|
},
|
|
42
33
|
"devDependencies": {
|
|
43
34
|
"c8": "^8.0.1",
|
package/CACHE_VERSION/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { be_atom_triple_T, WritableAtom_ } from '@ctx-core/nanostores'
|
|
2
|
-
export declare const [
|
|
3
|
-
CACHE_VERSION$_,
|
|
4
|
-
CACHE_VERSION_,
|
|
5
|
-
CACHE_VERSION__set,
|
|
6
|
-
]:be_atom_triple_T<false|string>
|
|
7
|
-
export {
|
|
8
|
-
CACHE_VERSION$_ as CACHE_VERSION__,
|
|
9
|
-
CACHE_VERSION$_ as b__CACHE_VERSION,
|
|
10
|
-
}
|
package/CACHE_VERSION/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { be_atom_triple_ } from '@ctx-core/nanostores'
|
|
2
|
-
import { import_meta_env_ } from '../import_meta_env/index.js'
|
|
3
|
-
/** @typedef {import('@ctx-core/nanostores').be_atom_triple_T} */
|
|
4
|
-
export const [
|
|
5
|
-
CACHE_VERSION$_,
|
|
6
|
-
CACHE_VERSION_,
|
|
7
|
-
CACHE_VERSION__set,
|
|
8
|
-
] = /** @type {be_atom_triple_T<false|string>} */ be_atom_triple_(()=>
|
|
9
|
-
typeof process === 'object' && import_meta_env_().CACHE_VERSION,
|
|
10
|
-
{ id: 'CACHE_VERSION' })
|
|
11
|
-
export {
|
|
12
|
-
CACHE_VERSION$_ as CACHE_VERSION__,
|
|
13
|
-
CACHE_VERSION$_ as b__CACHE_VERSION,
|
|
14
|
-
}
|
package/NODE_ENV/index.d.ts
DELETED
package/NODE_ENV/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { be_atom_triple_ } from '@ctx-core/nanostores'
|
|
2
|
-
import { import_meta_env_ } from '../import_meta_env/index.js'
|
|
3
|
-
/** @typedef {import('@ctx-core/nanostores').be_atom_triple_T} */
|
|
4
|
-
export const [
|
|
5
|
-
NODE_ENV$_,
|
|
6
|
-
NODE_ENV_,
|
|
7
|
-
NODE_ENV__set,
|
|
8
|
-
] = /** @type {be_atom_triple_T<string>} */be_atom_triple_(()=>
|
|
9
|
-
import_meta_env_().NODE_ENV,
|
|
10
|
-
{ id: 'NODE_ENV' })
|
|
11
|
-
export {
|
|
12
|
-
NODE_ENV$_ as NODE_ENV__,
|
|
13
|
-
NODE_ENV$_ as b__NODE_ENV,
|
|
14
|
-
}
|
package/VERSION/index.d.ts
DELETED
package/VERSION/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { be_atom_triple_ } from '@ctx-core/nanostores'
|
|
2
|
-
import { import_meta_env_ } from '../import_meta_env/index.js'
|
|
3
|
-
/** @typedef {import('@ctx-core/nanostores').be_atom_triple_T} */
|
|
4
|
-
export const [
|
|
5
|
-
VERSION$_,
|
|
6
|
-
VERSION_,
|
|
7
|
-
VERSION__set,
|
|
8
|
-
] = /** @type {be_atom_triple_T<string>} */be_atom_triple_(()=>
|
|
9
|
-
typeof process === 'object' && (
|
|
10
|
-
import_meta_env_().VERSION || import_meta_env_().HEROKU_SLUG_COMMIT
|
|
11
|
-
)
|
|
12
|
-
|| Math.random().toString(),
|
|
13
|
-
{ id: 'VERSION' })
|
|
14
|
-
export { VERSION$_ as VERSION__ }
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function import_meta_env_<R extends ImportMetaEnv>():R
|
|
2
|
-
export function import_meta_env__ensure<R extends ImportMetaEnv>():R
|
|
3
|
-
declare global {
|
|
4
|
-
interface ImportMeta {
|
|
5
|
-
readonly env:ImportMetaEnv
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
interface ImportMetaEnv {
|
|
9
|
-
[key:string]:string
|
|
10
|
-
}
|
package/import_meta_env/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export function import_meta_env_() {
|
|
2
|
-
return import_meta_env__ensure()
|
|
3
|
-
}
|
|
4
|
-
export function import_meta_env__ensure() {
|
|
5
|
-
if (!import.meta.env) {
|
|
6
|
-
Object.assign(import.meta, {
|
|
7
|
-
env: new Proxy(process.env, {
|
|
8
|
-
get(target, prop, receiver) {
|
|
9
|
-
return Reflect.get(target, prop, receiver)
|
|
10
|
-
},
|
|
11
|
-
set(target, prop, value) {
|
|
12
|
-
return Reflect.get(target, prop, value)
|
|
13
|
-
}
|
|
14
|
-
})
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
return import.meta.env
|
|
18
|
-
}
|
package/is_development/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { be_computed_pair_ } from '@ctx-core/nanostores'
|
|
2
|
-
import { NODE_ENV$_ } from '../NODE_ENV/index.js'
|
|
3
|
-
export const [
|
|
4
|
-
is_development$_,
|
|
5
|
-
is_development_,
|
|
6
|
-
] = be_computed_pair_(ctx=>NODE_ENV$_(ctx),
|
|
7
|
-
NODE_ENV=>NODE_ENV === 'dev' || NODE_ENV === 'development',
|
|
8
|
-
{ id: 'is_development' })
|
|
9
|
-
export { is_development$_ as is_development__ }
|
package/is_production/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { be_computed_pair_T, ReadableAtom_ } from '@ctx-core/nanostores'
|
|
2
|
-
export declare const [
|
|
3
|
-
is_production$_,
|
|
4
|
-
is_production_,
|
|
5
|
-
]:be_computed_pair_T<is_production__T>
|
|
6
|
-
export {
|
|
7
|
-
is_production$_ as is_production__,
|
|
8
|
-
is_production$_ as b__is__production,
|
|
9
|
-
}
|
|
10
|
-
export declare type is_production__T = ReadableAtom_<boolean>
|
package/is_production/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { be_computed_pair_ } from '@ctx-core/nanostores'
|
|
2
|
-
import { NODE_ENV$_ } from '../NODE_ENV/index.js'
|
|
3
|
-
export const [
|
|
4
|
-
is_production$_,
|
|
5
|
-
is_production_,
|
|
6
|
-
] = be_computed_pair_(ctx=>NODE_ENV$_(ctx),
|
|
7
|
-
NODE_ENV=>NODE_ENV === 'prod' || NODE_ENV === 'production',
|
|
8
|
-
{ id: 'is_production' })
|
|
9
|
-
export {
|
|
10
|
-
is_production$_ as is_production__,
|
|
11
|
-
is_production$_ as b__is__production,
|
|
12
|
-
}
|
package/is_staging/index.d.ts
DELETED
package/is_staging/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { be_computed_pair_ } from '@ctx-core/nanostores'
|
|
2
|
-
import { NODE_ENV$_ } from '../NODE_ENV/index.js'
|
|
3
|
-
export const [
|
|
4
|
-
is_staging$_,
|
|
5
|
-
is_staging_,
|
|
6
|
-
] = be_computed_pair_(ctx=>NODE_ENV$_(ctx),
|
|
7
|
-
NODE_ENV=>NODE_ENV === 'staging',
|
|
8
|
-
{ id: 'is_staging' })
|
|
9
|
-
export {
|
|
10
|
-
is_staging$_ as is_staging__,
|
|
11
|
-
is_staging$_ as b__is__staging,
|
|
12
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { error_o__throw } from 'ctx-core/error'
|
|
2
|
-
/**
|
|
3
|
-
* Throws an error for a missing env variable
|
|
4
|
-
* @param {string}env_name
|
|
5
|
-
*/
|
|
6
|
-
export function missing_env__throw(env_name) {
|
|
7
|
-
const error_message = `
|
|
8
|
-
${env_name} environment variable not set.
|
|
9
|
-
dev: make sure ${env_name} is set in your .env file
|
|
10
|
-
heroku: make sure ${env_name} is set using \`heroku config:set\`
|
|
11
|
-
`.trim()
|
|
12
|
-
error_o__throw(error_message, {
|
|
13
|
-
type: 'missing_env',
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
missing_env__throw as throw_missing_env,
|
|
18
|
-
missing_env__throw as throw__missing__env,
|
|
19
|
-
}
|