Skip to content

Commit c9349d1

Browse files
fix(build): make tsdown configs self-contained (#100499)
Co-authored-by: Peter Steinberger <[email protected]>
1 parent 5d8293c commit c9349d1

4 files changed

Lines changed: 20 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Docs: https://docs.openclaw.ai
1818

1919
### Fixes
2020

21+
- **Source build portability:** keep tsdown configuration self-contained so builds do not depend on resolving the tsdown package from unrun's temporary module directory.
2122
- **Diffs rendering:** render viewer and image output from one SSR preload, preserve language-pack highlighting through hydration, normalize language hints case-insensitively, skip identical before/after inputs with an explicit `changed` result, report truthful file-render and input errors, cache hash-pinned viewer runtimes, and prefer canonical file settings over stale aliases. (#100487)
2223
- **Remote browser reliability:** bound persistent Playwright tab enumeration by the existing remote CDP timeout budget and retire timed-out connection attempts so late completions cannot restore a stuck connection. (#80147, #58968) Thanks @HemantSudarshan and @KeaneYan.
2324
- **MCP OAuth response bounds:** reject body-less foreign error bodies without calling their inherently unbounded `text()` fallback, while preserving HTTP status and headers for safe SDK diagnostics. (#98143) Thanks @Pick-cat.

test/scripts/tsdown-config.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Tsdown config tests protect package artifact build contracts.
2+
import fs from "node:fs";
23
import { describe, expect, it } from "vitest";
34
import config from "../../tsdown.config.ts";
45

@@ -8,6 +9,14 @@ type TsdownConfig = (typeof configs)[number];
89
type OutExtensions = NonNullable<TsdownConfig["outExtensions"]>;
910

1011
describe("tsdown config", () => {
12+
it.each(["tsdown.config.ts", "tsdown.ai.config.ts"])(
13+
"keeps %s free of runtime imports from tsdown",
14+
(configPath) => {
15+
const source = fs.readFileSync(configPath, "utf8");
16+
expect(source).not.toMatch(/^import(?!\s+type\b).*from ["']tsdown["'];?$/mu);
17+
},
18+
);
19+
1120
it("enables declaration output explicitly for package artifact builds", () => {
1221
expect(configs).not.toHaveLength(0);
1322
expect(configs.map((entry) => entry.dts)).toEqual(configs.map(() => true));

tsdown.ai.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Builds the reusable AI package separately to keep provider bundling out of
22
// the already-parallel main package graph.
3-
import { defineConfig } from "tsdown";
3+
import type { UserConfig } from "tsdown";
44

55
const externalDependencies = [
66
"@anthropic-ai/sdk",
@@ -10,7 +10,7 @@ const externalDependencies = [
1010
"typebox",
1111
] as const;
1212

13-
export default defineConfig({
13+
const config = {
1414
clean: true,
1515
dts: process.env.OPENCLAW_RUN_NODE_SKIP_DTS_BUILD === "1" ? false : true,
1616
entry: {
@@ -36,4 +36,6 @@ export default defineConfig({
3636
);
3737
},
3838
},
39-
});
39+
} satisfies UserConfig;
40+
41+
export default config;

tsdown.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// tsdown config defines package build entrypoints and output options.
22
import fs from "node:fs";
33
import path from "node:path";
4-
import { defineConfig, type UserConfig } from "tsdown";
4+
import type { UserConfig } from "tsdown";
55
import {
66
collectBundledPluginBuildEntries,
77
NON_PACKAGED_BUNDLED_PLUGIN_DIRS,
@@ -664,7 +664,7 @@ function buildUnifiedDistEntries(): Record<string, string> {
664664
};
665665
}
666666

667-
export default defineConfig([
667+
const configs = [
668668
nodeBuildConfig({
669669
clean: true,
670670
dts: TSDOWN_DECLARATIONS,
@@ -792,4 +792,6 @@ export default defineConfig([
792792
dts: { neverBundle: shouldNeverBundleDependency },
793793
},
794794
}),
795-
]);
795+
] satisfies UserConfig[];
796+
797+
export default configs;

0 commit comments

Comments
 (0)