refactor(canvas): dedupe bundle hash inputs · openclaw/openclaw@5939ab4
vincentkoc
·
2026-06-19
·
via Recent Commits to openclaw:main
File tree
extensions/canvas/scripts
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | export declare function isBundleHashInputPath(filePath: string, repoRoot?: string): boolean; |
2 | 2 | export declare function getLocalRolldownCliCandidates(repoRoot?: string): string[]; |
3 | 3 | export declare function getBundleHashRepoInputPaths(repoRoot?: string): string[]; |
4 | | -export declare function getBundleHashInputPaths(repoRoot?: string): string[]; |
5 | 4 | export declare function compareNormalizedPaths(left: string, right: string): number; |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -18,9 +18,7 @@ const require = createRequire(import.meta.url);
|
18 | 18 | const hashFile = path.join(pluginDir, "src", "host", "a2ui", ".bundle.hash"); |
19 | 19 | const outputFile = path.join(pluginDir, "src", "host", "a2ui", "a2ui.bundle.js"); |
20 | 20 | const a2uiAppDir = path.join(pluginDir, "src", "host", "a2ui-app"); |
21 | | -const rootPackageFile = path.join(rootDir, "package.json"); |
22 | | -const lockFile = path.join(rootDir, "pnpm-lock.yaml"); |
23 | | -const repoInputPaths = [rootPackageFile, lockFile, a2uiAppDir]; |
| 21 | +const repoInputPaths = getBundleHashRepoInputPaths(rootDir); |
24 | 22 | const relativeRepoInputPaths = repoInputPaths.map((inputPath) => |
25 | 23 | normalizePath(path.relative(rootDir, inputPath)), |
26 | 24 | ); |
@@ -77,11 +75,6 @@ export function getBundleHashRepoInputPaths(repoRoot = rootDir) {
|
77 | 75 | ]; |
78 | 76 | } |
79 | 77 | |
80 | | -/** Returns A2UI bundle hash input paths. */ |
81 | | -export function getBundleHashInputPaths(repoRoot = rootDir) { |
82 | | -return getBundleHashRepoInputPaths(repoRoot); |
83 | | -} |
84 | | - |
85 | 78 | /** Compares paths after normalizing separators to POSIX slashes. */ |
86 | 79 | export function compareNormalizedPaths(left, right) { |
87 | 80 | const normalizedLeft = normalizePath(left); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,6 @@ import path from "node:path";
|
3 | 3 | import { describe, expect, it } from "vitest"; |
4 | 4 | import { |
5 | 5 | compareNormalizedPaths, |
6 | | -getBundleHashInputPaths, |
7 | 6 | getBundleHashRepoInputPaths, |
8 | 7 | getLocalRolldownCliCandidates, |
9 | 8 | isBundleHashInputPath, |
@@ -52,7 +51,7 @@ describe("scripts/bundle-a2ui.mjs", () => {
|
52 | 51 | |
53 | 52 | it("keeps local node_modules state out of bundle hash inputs", () => { |
54 | 53 | const repoRoot = process.cwd(); |
55 | | -const inputPaths = getBundleHashInputPaths(repoRoot); |
| 54 | +const inputPaths = getBundleHashRepoInputPaths(repoRoot); |
56 | 55 | |
57 | 56 | expect(inputPaths).not.toContain(path.join(repoRoot, "node_modules", "lit", "package.json")); |
58 | 57 | expect(inputPaths).not.toContain( |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。