fix(release): keep legacy memory chunk stub · openclaw/openclaw@f7aebf8
steipete
·
2026-04-29
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,6 +10,12 @@ import { writeOfficialChannelCatalog } from "./write-official-channel-catalog.mj
|
10 | 10 | |
11 | 11 | const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); |
12 | 12 | const ROOT_RUNTIME_ALIAS_PATTERN = /^(?<base>.+\.(?:runtime|contract))-[A-Za-z0-9_-]+\.js$/u; |
| 13 | +export const LEGACY_CLI_EXIT_COMPAT_CHUNKS = [ |
| 14 | +{ |
| 15 | +dest: "dist/memory-state-CcqRgDZU.js", |
| 16 | +contents: "export function hasMemoryRuntime() {\n return false;\n}\n", |
| 17 | +}, |
| 18 | +]; |
13 | 19 | |
14 | 20 | /** |
15 | 21 | * Copy static (non-transpiled) runtime assets that are referenced by their |
@@ -81,13 +87,22 @@ export function writeStableRootRuntimeAliases(params = {}) {
|
81 | 87 | } |
82 | 88 | } |
83 | 89 | |
| 90 | +export function writeLegacyCliExitCompatChunks(params = {}) { |
| 91 | +const rootDir = params.rootDir ?? ROOT; |
| 92 | +const chunks = params.chunks ?? LEGACY_CLI_EXIT_COMPAT_CHUNKS; |
| 93 | +for (const { dest, contents } of chunks) { |
| 94 | +writeTextFileIfChanged(path.join(rootDir, dest), contents); |
| 95 | +} |
| 96 | +} |
| 97 | + |
84 | 98 | export function runRuntimePostBuild(params = {}) { |
85 | 99 | copyPluginSdkRootAlias(params); |
86 | 100 | copyBundledPluginMetadata(params); |
87 | 101 | writeOfficialChannelCatalog(params); |
88 | 102 | stageBundledPluginRuntimeDeps(params); |
89 | 103 | stageBundledPluginRuntime(params); |
90 | 104 | writeStableRootRuntimeAliases(params); |
| 105 | +writeLegacyCliExitCompatChunks(params); |
91 | 106 | copyStaticExtensionAssets(params); |
92 | 107 | } |
93 | 108 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4,6 +4,7 @@ import { describe, expect, it, vi } from "vitest";
|
4 | 4 | import { |
5 | 5 | copyStaticExtensionAssets, |
6 | 6 | listStaticExtensionAssetOutputs, |
| 7 | +writeLegacyCliExitCompatChunks, |
7 | 8 | writeStableRootRuntimeAliases, |
8 | 9 | } from "../../scripts/runtime-postbuild.mjs"; |
9 | 10 | import { createScriptTestHarness } from "./test-helpers.js"; |
@@ -79,4 +80,14 @@ describe("runtime postbuild static assets", () => {
|
79 | 80 | ); |
80 | 81 | await expect(fs.stat(path.join(distDir, "library.js"))).rejects.toThrow(); |
81 | 82 | }); |
| 83 | + |
| 84 | +it("writes legacy CLI exit compatibility chunks", async () => { |
| 85 | +const rootDir = createTempDir("openclaw-runtime-postbuild-"); |
| 86 | + |
| 87 | +writeLegacyCliExitCompatChunks({ rootDir }); |
| 88 | + |
| 89 | +await expect( |
| 90 | +fs.readFile(path.join(rootDir, "dist", "memory-state-CcqRgDZU.js"), "utf8"), |
| 91 | +).resolves.toContain("function hasMemoryRuntime()"); |
| 92 | +}); |
82 | 93 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。