File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -73,9 +73,27 @@ async function build() {
7373 console . log ( '📂 Copying WASM files for tree-sitter...' )
7474 await copyWasmFiles ( )
7575
76+ console . log ( '📝 Creating colocated declaration files...' )
77+ await createColocatedDeclarations ( )
78+
7679 console . log ( '✅ Build complete!' )
7780}
7881
82+ /**
83+ * Create colocated declaration files for better TypeScript compatibility
84+ */
85+ async function createColocatedDeclarations ( ) {
86+ // Create colocated ESM declaration file
87+ const esmDeclaration = 'export * from "./sdk/src/index";\n'
88+ await Bun . write ( 'dist/esm/index.d.ts' , esmDeclaration )
89+ console . log ( ' ✓ Created dist/esm/index.d.ts' )
90+
91+ // Create colocated CJS declaration file for extra compatibility
92+ const cjsDeclaration = 'export * from "../esm/index";\n'
93+ await Bun . write ( 'dist/cjs/index.d.ts' , cjsDeclaration )
94+ console . log ( ' ✓ Created dist/cjs/index.d.ts' )
95+ }
96+
7997/**
8098 * Copy WASM files from @vscode/tree-sitter-wasm to shared dist/wasm directory
8199 */
Original file line number Diff line number Diff line change 88 "type" : " module" ,
99 "main" : " ./dist/cjs/index.js" ,
1010 "module" : " ./dist/esm/index.js" ,
11- "types" : " ./dist/esm/sdk/src/index.d.ts" ,
11+ "types" : " ./dist/esm/index.d.ts" ,
12+ "typings" : " ./dist/esm/index.d.ts" ,
1213 "exports" : {
1314 "." : {
14- "types" : " ./dist/esm/sdk/src/ index.d.ts" ,
15+ "types" : " ./dist/esm/index.d.ts" ,
1516 "import" : " ./dist/esm/index.js" ,
1617 "require" : " ./dist/cjs/index.js" ,
1718 "default" : " ./dist/esm/index.js"
You can’t perform that action at this time.
0 commit comments