Skip to content

Commit 9f5fbcc

Browse files
committed
πŸ”€ ✨ move global methods to a separate export
1 parent f74cdbd commit 9f5fbcc

7 files changed

+18
-13
lines changed

β€Ž.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ yarn.lock
66

77
*.js
88
*.d.ts
9+
!typings.d.ts

β€Žglobal.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import './src/global/typings'
2+
export { default as addToGlobalScope } from "./src/global/addToGlobalScope";
3+
export { default as addNoopToGlobalScope } from "./src/global/addNoopToGlobalScope";

β€Žindex.ts

-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ export type { InspectInspect } from "./src/inspect/ii";
66
export { default as tt } from "./src/inspect/tt";
77
export type { TableTable } from "./src/inspect/tt";
88

9-
// global
10-
export { default as addToGlobalScope } from "./src/global/addToGlobalScope";
11-
export { default as addNoopToGlobalScope } from "./src/global/addNoopToGlobalScope";
12-
139
// inspect
1410
export { default as consoleInspect } from "./src/inspect/consoleInspect";
1511
export type { ConsoleInspectOptions } from "./src/inspect/consoleInspect";

β€Žpackage.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
"type": "module",
1919
"exports": {
2020
"types": "./index.d.ts",
21-
"default": "./index.js"
21+
"default": "./index.js",
22+
"global": {
23+
"types": "./global.d.ts",
24+
"default": "./global.js"
25+
}
2226
},
2327
"sideEffects": false,
2428
"engines": {

β€Žsrc/global/addToGlobalScope.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import iiFn from "../inspect/ii";
2-
import ttFn, { type TableTable } from "../inspect/tt";
3-
import type { InspectInspect } from "../inspect/ii";
4-
5-
declare global {
6-
const ii: InspectInspect;
7-
const tt: TableTable;
8-
}
2+
import ttFn from "../inspect/tt";
93

104
export default function addToGlobalScope(): void {
115
(global as any).ii = iiFn;

β€Žsrc/global/typings.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { InspectInspect } from "../inspect/ii";
2+
import type { TableTable } from "../inspect/tt";
3+
4+
declare global {
5+
const ii: InspectInspect;
6+
const tt: TableTable;
7+
}

β€Žtsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@
3434
"exactOptionalPropertyTypes": true,
3535
"forceConsistentCasingInFileNames": true
3636
},
37-
"include": ["index.ts", "./src/**/*.ts"],
37+
"include": ["index.ts", "global.ts", "./src/**/*.ts"],
3838
}

0 commit comments

Comments
Β (0)