Skip to content

Commit 32025c1

Browse files
committed
chore: assemle bus api
1 parent ce004a7 commit 32025c1

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/vendor-core.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ import { default as _ps } from '@webpod/ps'
1818

1919
type TCallable = (...args: any[]) => any
2020
const store = new Map<string, any>()
21-
22-
export const override = store.set.bind(store)
23-
24-
export const wrap = <T extends object>(name: string, api: T): T => {
21+
const override = store.set.bind(store)
22+
const wrap = <T extends object>(name: string, api: T): T => {
2523
override(name, api)
2624
return new Proxy<T>(api, {
2725
get(_, key) {
@@ -32,6 +30,11 @@ export const wrap = <T extends object>(name: string, api: T): T => {
3230
},
3331
})
3432
}
33+
export const bus = {
34+
override,
35+
store,
36+
wrap,
37+
}
3538

3639
export {
3740
type TSpawnStore,

src/vendor.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import { wrap } from './vendor-core.js'
15+
import { bus } from './vendor-core.js'
1616
import {
1717
depseek as _depseek,
1818
dotenv as _dotenv,
@@ -27,6 +27,7 @@ import {
2727
export * from './vendor-core.js'
2828
export { createRequire } from './vendor-extra.js'
2929

30+
const { wrap } = bus
3031
export const depseek: typeof _depseek = wrap('depseek', _depseek)
3132
export const dotenv: typeof _dotenv = wrap('dotenv', _dotenv)
3233
export const fs: typeof _fs = wrap('fs', _fs)

0 commit comments

Comments
 (0)