ctx-core 6.1.2 → 6.2.1
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/all/be_/index.js
CHANGED
|
@@ -13,22 +13,26 @@ let _undefined
|
|
|
13
13
|
export function be_(val__new, config) {
|
|
14
14
|
let be = ctx=>{
|
|
15
15
|
let be_map = ctx.s[be.ns]
|
|
16
|
+
// @formatter:off
|
|
16
17
|
/* @if DEBUG **
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
// ~ 30 B
|
|
19
|
+
if (!be_map) throw Error('ctx_no_ns: \'' + be.ns + '\'')
|
|
20
|
+
/* @endif */
|
|
20
21
|
// config is not used anymore so reusing to reduce bundle size
|
|
22
|
+
// @formatter:on
|
|
21
23
|
config = be_map.get(be.id)
|
|
22
24
|
if (config) return config[0]
|
|
25
|
+
// @formatter:off
|
|
23
26
|
/* @if DEBUG **
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
// 5-11 B
|
|
28
|
+
// circular dependency state
|
|
29
|
+
// if val__new calls this be before returning, 'cir' will be the value of this be
|
|
30
|
+
// 'cir' is used instead of 'circular' to reduce the payload by a few bytes
|
|
31
|
+
config = ['cir', ctx, be]
|
|
32
|
+
be_map.set(be.id, config)
|
|
33
|
+
config[0] = val__new(ctx, be)
|
|
34
|
+
/* @endif */
|
|
35
|
+
// @formatter:on
|
|
32
36
|
/* @if !DEBUG */
|
|
33
37
|
config = [val__new(ctx, be), ctx, be]
|
|
34
38
|
be_map.set(be.id, config)
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
export function import_meta_env_() {
|
|
2
|
-
return import_meta_env__ensure()
|
|
3
|
-
}
|
|
4
|
-
export function import_meta_env__ensure() {
|
|
5
2
|
if (!import.meta.env) {
|
|
6
3
|
import.meta.env = new Proxy(globalThis.process?.env ?? {}, {
|
|
7
4
|
get(target, prop, receiver) {
|
|
@@ -14,3 +11,4 @@ export function import_meta_env__ensure() {
|
|
|
14
11
|
}
|
|
15
12
|
return import.meta.env
|
|
16
13
|
}
|
|
14
|
+
export { import_meta_env_ as import_meta_env__ensure }
|
package/all/queue/index.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ export interface queue_T {
|
|
|
16
16
|
get item_count():number
|
|
17
17
|
}
|
|
18
18
|
export interface queue_waiting_T {
|
|
19
|
-
fn:()=>Promise<
|
|
20
|
-
fulfil:(v:
|
|
21
|
-
reject:(err:
|
|
19
|
+
fn:()=>Promise<unknown>
|
|
20
|
+
fulfil:(v:unknown)=>void
|
|
21
|
+
reject:(err:unknown)=>void
|
|
22
22
|
}
|
|
23
23
|
export type queue_item_T = queue_waiting_T
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Timeout } from '../timeout/index.js'
|
|
2
2
|
/**
|
|
3
3
|
* @param {(()=>Promise<unknown>)|Promise<unknown>}promise
|
|
4
|
-
* @param {number}ms
|
|
4
|
+
* @param {number|Infinity}ms
|
|
5
5
|
* @param {Error}[error]
|
|
6
6
|
* @returns {cancel_Promise}
|
|
7
7
|
*/
|
|
@@ -12,11 +12,16 @@ export function timeout_promise(
|
|
|
12
12
|
) {
|
|
13
13
|
error ??= new Timeout(ms)
|
|
14
14
|
let id
|
|
15
|
-
let timeout =
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
let timeout =
|
|
16
|
+
ms !== Infinity
|
|
17
|
+
? new Promise((_resolve, reject)=>{
|
|
18
|
+
id = setTimeout(()=>reject(error), ms)
|
|
19
|
+
})
|
|
20
|
+
: undefined
|
|
18
21
|
let cancel_promise__resolve
|
|
19
|
-
let cancel_promise =
|
|
22
|
+
let cancel_promise =
|
|
23
|
+
new Promise(resolve=>
|
|
24
|
+
cancel_promise__resolve = resolve)
|
|
20
25
|
/** @type {cancel_Promise} */
|
|
21
26
|
let ret_promise = Promise.race([
|
|
22
27
|
typeof promise === 'function' ? promise() : promise,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ctx-core",
|
|
3
|
-
"version": "6.1
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"description": "ctx-core core library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -292,7 +292,7 @@
|
|
|
292
292
|
"./package.json": "./package.json"
|
|
293
293
|
},
|
|
294
294
|
"devDependencies": {
|
|
295
|
-
"@arethetypeswrong/cli": "^0.13.
|
|
295
|
+
"@arethetypeswrong/cli": "^0.13.9",
|
|
296
296
|
"@ctx-core/preprocess": "^0.1.2",
|
|
297
297
|
"@size-limit/preset-small-lib": "^11.0.2",
|
|
298
298
|
"@types/jsdom": "^21.1.6",
|