rebuildjs 0.20.5 → 0.20.7
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/asset/index.d.ts +2 -2
- package/ctx/index.js +1 -1
- package/ctx/index.test.ts +30 -1
- package/package.json +1 -1
- package/tsconfig.json +1 -2
package/asset/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { ctx__be_T, ctx__get_T, ctx__set_T
|
|
1
|
+
import type { ctx__be_T, ctx__get_T, ctx__set_T } from 'ctx-core/be'
|
|
2
2
|
import type { lock_memosig_T } from 'ctx-core/rmemo'
|
|
3
|
+
import type { has_route_T } from '../ctx/index.js'
|
|
3
4
|
export declare function asset_path_(mod_promise:Promise<{ default:string }>):Promise<string>
|
|
4
5
|
export declare function asset_path_a_<
|
|
5
6
|
Tuple extends [...Promise<{ default:string }>[]]
|
|
@@ -18,4 +19,3 @@ export type assets_T = {
|
|
|
18
19
|
css_a:string[]
|
|
19
20
|
script_a:string[]
|
|
20
21
|
}
|
|
21
|
-
type has_route_T = Ctx_wide_T<'route'>
|
package/ctx/index.js
CHANGED
package/ctx/index.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type Ctx } from 'ctx-core/be'
|
|
1
|
+
import { be_, type Ctx } from 'ctx-core/be'
|
|
2
2
|
import type { Equal, Expect } from 'ctx-core/test'
|
|
3
3
|
import { test } from 'uvu'
|
|
4
|
+
import { equal } from 'uvu/assert'
|
|
4
5
|
import { app_ctx, middleware_ctx_, route_ctx_ } from './index.js'
|
|
5
6
|
test.after.each(()=>{
|
|
6
7
|
app_ctx.s.app.clear()
|
|
@@ -9,17 +10,45 @@ test('app_ctx', ()=>{
|
|
|
9
10
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
10
11
|
type test_app_ctx = Expect<Equal<typeof app_ctx, Ctx<'app'>>>
|
|
11
12
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
13
|
+
const ns_app_ = be_(()=>
|
|
14
|
+
'app',
|
|
15
|
+
{ ns: 'app' })
|
|
16
|
+
equal(ns_app_(app_ctx), 'app')
|
|
12
17
|
})
|
|
13
18
|
test('middleware_ctx_', ()=>{
|
|
14
19
|
const middleware_ctx = middleware_ctx_()
|
|
15
20
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
16
21
|
type test_middleware_ctx = Expect<Equal<typeof middleware_ctx, Ctx<'app'|'middleware'>>>
|
|
17
22
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
23
|
+
const ns_middleware_ = be_(()=>
|
|
24
|
+
'middleware',
|
|
25
|
+
{ ns: 'middleware' })
|
|
26
|
+
const ns_app_ = be_(()=>
|
|
27
|
+
'app',
|
|
28
|
+
{ ns: 'app' })
|
|
29
|
+
equal(ns_middleware_(middleware_ctx), 'middleware')
|
|
30
|
+
equal(ns_app_(middleware_ctx), 'app')
|
|
18
31
|
})
|
|
19
32
|
test('route_ctx_', ()=>{
|
|
20
33
|
const route_ctx = route_ctx_(middleware_ctx_())
|
|
21
34
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
22
35
|
type test_route_ctx = Expect<Equal<typeof route_ctx, Ctx<''|'app'|'middleware'|'route'>>>
|
|
23
36
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
37
|
+
const ns_blank_ = be_(()=>
|
|
38
|
+
'',
|
|
39
|
+
{ ns: '' })
|
|
40
|
+
const ns_route_ = be_(()=>
|
|
41
|
+
'route',
|
|
42
|
+
{ ns: 'route' })
|
|
43
|
+
const ns_middleware_ = be_(()=>
|
|
44
|
+
'middleware',
|
|
45
|
+
{ ns: 'middleware' })
|
|
46
|
+
const ns_app_ = be_(()=>
|
|
47
|
+
'app',
|
|
48
|
+
{ ns: 'app' })
|
|
49
|
+
equal(ns_blank_(route_ctx), '')
|
|
50
|
+
equal(ns_route_(route_ctx), 'route')
|
|
51
|
+
equal(ns_middleware_(route_ctx), 'middleware')
|
|
52
|
+
equal(ns_app_(route_ctx), 'app')
|
|
24
53
|
})
|
|
25
54
|
test.run()
|
package/package.json
CHANGED