@jay-framework/typescript-bridge 0.16.3 → 0.16.4
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/dist/index.d.ts +13 -9
- package/dist/index.js +27 -13
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import * as typescript from 'typescript';
|
|
2
|
-
export { typescript as TypeScript };
|
|
3
|
-
|
|
1
|
+
import type * as typescript from 'typescript';
|
|
4
2
|
declare const tsModule: typeof typescript;
|
|
5
3
|
/**
|
|
6
4
|
* Re-export the TypeScript module to avoid ESM/CommonJS compatibility issues
|
|
7
5
|
* This allows importing TypeScript in a consistent way across the project
|
|
8
6
|
*/
|
|
9
|
-
declare const ts: typeof typescript;
|
|
10
|
-
|
|
7
|
+
export declare const ts: typeof typescript;
|
|
8
|
+
/**
|
|
9
|
+
* Re-export the TypeScript types for use in type annotations
|
|
10
|
+
*/
|
|
11
|
+
export type { typescript as TypeScript };
|
|
11
12
|
/**
|
|
12
13
|
* Create a proxy that forwards all property access to the TypeScript module
|
|
13
14
|
* This allows accessing any TypeScript utility without explicitly listing them
|
|
14
15
|
*/
|
|
15
|
-
declare const tsBridge: typeof typescript;
|
|
16
|
+
export declare const tsBridge: typeof typescript;
|
|
16
17
|
/**
|
|
17
18
|
* Alternative approach: Create a function that returns any TypeScript utility
|
|
18
19
|
* Usage: getTs('isIdentifier')(node)
|
|
19
20
|
*/
|
|
20
|
-
declare function getTs<T extends keyof typeof tsModule>(utilName: T): (typeof tsModule)[T];
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
export declare function getTs<T extends keyof typeof tsModule>(utilName: T): (typeof tsModule)[T];
|
|
22
|
+
/**
|
|
23
|
+
* Default export for easy importing and destructuring
|
|
24
|
+
* Usage: import tsBridge, { ts } from '@jay-framework/typescript-bridge'
|
|
25
|
+
*/
|
|
26
|
+
export default tsBridge;
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
|
-
import { createRequire
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
const tsModule = require('typescript');
|
|
4
|
+
/**
|
|
5
|
+
* Re-export the TypeScript module to avoid ESM/CommonJS compatibility issues
|
|
6
|
+
* This allows importing TypeScript in a consistent way across the project
|
|
7
|
+
*/
|
|
8
|
+
export const ts = tsModule;
|
|
9
|
+
/**
|
|
10
|
+
* Create a proxy that forwards all property access to the TypeScript module
|
|
11
|
+
* This allows accessing any TypeScript utility without explicitly listing them
|
|
12
|
+
*/
|
|
13
|
+
export const tsBridge = new Proxy(tsModule, {
|
|
14
|
+
get(target, prop) {
|
|
15
|
+
return target[prop];
|
|
16
|
+
},
|
|
6
17
|
});
|
|
7
|
-
|
|
8
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Alternative approach: Create a function that returns any TypeScript utility
|
|
20
|
+
* Usage: getTs('isIdentifier')(node)
|
|
21
|
+
*/
|
|
22
|
+
export function getTs(utilName) {
|
|
23
|
+
return tsModule[utilName];
|
|
9
24
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
25
|
+
/**
|
|
26
|
+
* Default export for easy importing and destructuring
|
|
27
|
+
* Usage: import tsBridge, { ts } from '@jay-framework/typescript-bridge'
|
|
28
|
+
*/
|
|
29
|
+
export default tsBridge;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/typescript-bridge",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TypeScript CommonJS to ESM bridge for seamless TypeScript utility access",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"typescript": "^5.3.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@jay-framework/dev-environment": "^0.16.
|
|
30
|
+
"@jay-framework/dev-environment": "^0.16.4",
|
|
31
31
|
"@types/node": "^20.11.5",
|
|
32
32
|
"rimraf": "^5.0.5",
|
|
33
33
|
"tsup": "^8.0.1",
|