fix: use tsc for clean .d.ts files instead of tsdown bundled types

tsdown's bundled .d.ts output uses namespace declarations that reference
forward-declared types, which breaks Monaco/ATA type acquisition.

Switch to:
- tsdown for JS bundles (ESM + CJS) with --no-dts
- tsc with emitDeclarationOnly for clean individual .d.ts files

This restores the type structure from 1.617.0 which worked correctly
with Monaco editor's automatic type acquisition.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-01-28 16:22:16 +00:00
co-authored by Claude Opus 4.5
parent a02938c80c
commit 0f625580f3
4 changed files with 17 additions and 31 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "windmill-client",
"version": "1.617.3",
"version": "1.618.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "windmill-client",
"version": "1.617.3",
"version": "1.618.3",
"license": "Apache 2.0",
"devDependencies": {
"@types/node": "^20.17.16",
+3 -10
View File
@@ -11,7 +11,7 @@
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.mts",
"types": "dist/index.d.ts",
"exports": {
".": {
"require": {
@@ -19,19 +19,12 @@
"default": "./dist/index.js"
},
"import": {
"types": "./dist/index.d.mts",
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
}
}
},
"typesVersions": {
"*": {
"*": [
"./dist/index.d.mts"
]
}
},
"prepublish": "tsdown --format esm --format cjs --dts",
"prepublish": "tsdown --format esm --format cjs --no-dts && tsc",
"files": [
"dist",
"LICENSE",
+5 -11
View File
@@ -11,18 +11,12 @@ rm "${script_dirpath}/client.ts"
rm "${script_dirpath}/s3Types.ts"
rm "${script_dirpath}/sqlUtils.ts"
npm install
npx tsdown --format esm --format cjs --dts
# Fix default export for TypeScript/Monaco compatibility
# tsdown generates "export { ..., client_d_exports as default, ... }" which doesn't work properly
# We need to replace it with a proper "export default" statement
for dts in "${script_dirpath}/dist/index.d.ts" "${script_dirpath}/dist/index.d.mts"; do
# Remove "client_d_exports as default, " from the export statement
sed -i 's/client_d_exports as default, //g' "$dts"
# Add proper default export at the end
echo "" >> "$dts"
echo "export default client_d_exports;" >> "$dts"
done
# Build JS bundles with tsdown (ESM + CJS, no dts)
npx tsdown --format esm --format cjs --no-dts
# Generate .d.ts files with tsc (clean output, no bundling)
npx tsc
cp "${script_dirpath}/src/client.ts" ${script_dirpath}
cp "${script_dirpath}/src/s3Types.ts" ${script_dirpath}
+7 -8
View File
@@ -2,16 +2,15 @@
"include": ["src/**/*"],
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist",
"rootDir": "src/",
"target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"lib": [
"ES2018",
"DOM"
] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
"module": "ESNext" /* Specify what module code is generated. */,
"strict": true /* Enable all strict type-checking options. */,
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
"target": "ESNext",
"lib": ["ES2018", "DOM"],
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}