refactor: remove bundled public surface runtime shim · openclaw/openclaw@9045a7c
steipete
·
2026-05-02
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -192,7 +192,6 @@ function loadGeneratedBundledChannelModule(params: {
|
192 | 192 | rootScope: BundledChannelRootScope; |
193 | 193 | metadata: BundledChannelPluginMetadata; |
194 | 194 | entry: BundledChannelPluginMetadata["source"] | BundledChannelPluginMetadata["setupSource"]; |
195 | | -installRuntimeDeps?: boolean; |
196 | 195 | }): unknown { |
197 | 196 | let modulePath = resolveGeneratedBundledChannelModulePath(params); |
198 | 197 | if (!modulePath) { |
@@ -224,7 +223,6 @@ function loadGeneratedBundledChannelEntry(params: {
|
224 | 223 | rootScope: params.rootScope, |
225 | 224 | metadata: params.metadata, |
226 | 225 | entry: params.metadata.source, |
227 | | -installRuntimeDeps: false, |
228 | 226 | }), |
229 | 227 | ); |
230 | 228 | if (!entry) { |
@@ -257,7 +255,6 @@ function loadGeneratedBundledChannelSetupEntry(params: {
|
257 | 255 | rootScope: params.rootScope, |
258 | 256 | metadata: params.metadata, |
259 | 257 | entry: params.metadata.setupSource, |
260 | | -installRuntimeDeps: false, |
261 | 258 | }), |
262 | 259 | ); |
263 | 260 | if (!setupEntry) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -54,7 +54,6 @@ describe("channel doctor contract api fast path", () => {
|
54 | 54 | expect(loadBundledPluginPublicArtifactModuleSyncMock).toHaveBeenCalledWith({ |
55 | 55 | dirName: "discord", |
56 | 56 | artifactBasename: "doctor-contract-api.js", |
57 | | -installRuntimeDeps: false, |
58 | 57 | }); |
59 | 58 | }); |
60 | 59 | |
@@ -65,12 +64,10 @@ describe("channel doctor contract api fast path", () => {
|
65 | 64 | expect(loadBundledPluginPublicArtifactModuleSyncMock).toHaveBeenCalledWith({ |
66 | 65 | dirName: "whatsapp", |
67 | 66 | artifactBasename: "doctor-contract-api.js", |
68 | | -installRuntimeDeps: false, |
69 | 67 | }); |
70 | 68 | expect(loadBundledPluginPublicArtifactModuleSyncMock).not.toHaveBeenCalledWith({ |
71 | 69 | dirName: "whatsapp", |
72 | 70 | artifactBasename: "contract-api.js", |
73 | | -installRuntimeDeps: false, |
74 | 71 | }); |
75 | 72 | }); |
76 | 73 | |
@@ -86,12 +83,10 @@ describe("channel doctor contract api fast path", () => {
|
86 | 83 | expect(loadBundledPluginPublicArtifactModuleSyncMock).toHaveBeenCalledWith({ |
87 | 84 | dirName: "telegram", |
88 | 85 | artifactBasename: "doctor-contract-api.js", |
89 | | -installRuntimeDeps: false, |
90 | 86 | }); |
91 | 87 | expect(loadBundledPluginPublicArtifactModuleSyncMock).not.toHaveBeenCalledWith({ |
92 | 88 | dirName: "telegram", |
93 | 89 | artifactBasename: "contract-api.js", |
94 | | -installRuntimeDeps: false, |
95 | 90 | }); |
96 | 91 | }); |
97 | 92 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -23,7 +23,6 @@ function loadBundledChannelPublicArtifact(
|
23 | 23 | return loadBundledPluginPublicArtifactModuleSync<BundledChannelDoctorContractApi>({ |
24 | 24 | dirName: channelId, |
25 | 25 | artifactBasename, |
26 | | -installRuntimeDeps: false, |
27 | 26 | }); |
28 | 27 | } catch (error) { |
29 | 28 | if ( |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4,7 +4,6 @@ import path from "node:path";
|
4 | 4 | import { fileURLToPath, pathToFileURL } from "node:url"; |
5 | 5 | import { openBoundaryFileSync } from "../infra/boundary-file-read.js"; |
6 | 6 | import { resolveBundledPluginsDir } from "../plugins/bundled-dir.js"; |
7 | | -import { prepareBuiltBundledPluginPublicSurfaceLocation } from "../plugins/bundled-public-surface-runtime-root.js"; |
8 | 7 | import { |
9 | 8 | getCachedPluginJitiLoader, |
10 | 9 | type PluginJitiLoaderCache, |
@@ -212,19 +211,14 @@ export async function loadBundledPluginPublicSurfaceModule<T extends object>(par
|
212 | 211 | dirName: string; |
213 | 212 | artifactBasename: string; |
214 | 213 | trackedPluginId?: string | (() => string); |
215 | | -env?: NodeJS.ProcessEnv; |
216 | 214 | }): Promise<T> { |
217 | 215 | const location = resolveFacadeModuleLocation(params); |
218 | 216 | if (!location) { |
219 | 217 | throw new Error( |
220 | 218 | `Unable to resolve bundled plugin public surface ${params.dirName}/${params.artifactBasename}`, |
221 | 219 | ); |
222 | 220 | } |
223 | | -const preparedLocation = prepareBuiltBundledPluginPublicSurfaceLocation({ |
224 | | - location, |
225 | | -pluginId: params.dirName, |
226 | | - ...(params.env ? { env: params.env } : {}), |
227 | | -}); |
| 221 | +const preparedLocation = location; |
228 | 222 | const cached = loadedFacadeModules.get(preparedLocation.modulePath); |
229 | 223 | if (cached) { |
230 | 224 | return cached as T; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -68,7 +68,6 @@ describe("provider public artifacts", () => {
|
68 | 68 | expect(loadBundledPluginPublicArtifactModuleSync).toHaveBeenCalledWith({ |
69 | 69 | dirName: "openai", |
70 | 70 | artifactBasename: "provider-policy-api.js", |
71 | | -installRuntimeDeps: false, |
72 | 71 | }); |
73 | 72 | expect( |
74 | 73 | surface |
@@ -109,7 +108,6 @@ describe("provider public artifacts", () => {
|
109 | 108 | expect(loadBundledPluginPublicArtifactModuleSync).toHaveBeenCalledWith({ |
110 | 109 | dirName: "openai", |
111 | 110 | artifactBasename: "provider-policy-api.js", |
112 | | -installRuntimeDeps: false, |
113 | 111 | }); |
114 | 112 | }); |
115 | 113 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -48,7 +48,6 @@ function tryLoadBundledProviderPolicySurface(
|
48 | 48 | const mod = loadBundledPluginPublicArtifactModuleSync<Record<string, unknown>>({ |
49 | 49 | dirName: pluginId, |
50 | 50 | artifactBasename, |
51 | | -installRuntimeDeps: false, |
52 | 51 | }); |
53 | 52 | if (hasProviderPolicyHook(mod)) { |
54 | 53 | return mod; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,6 @@ import { fileURLToPath } from "node:url";
|
5 | 5 | import { openBoundaryFileSync } from "../infra/boundary-file-read.js"; |
6 | 6 | import { sameFileIdentity } from "../infra/file-identity.js"; |
7 | 7 | import { resolveBundledPluginsDir } from "./bundled-dir.js"; |
8 | | -import { prepareBuiltBundledPluginPublicSurfaceLocation } from "./bundled-public-surface-runtime-root.js"; |
9 | 8 | import { getCachedPluginJitiLoader, type PluginJitiLoaderCache } from "./jiti-loader-cache.js"; |
10 | 9 | import { tryNativeRequireJavaScriptModule } from "./native-module-require.js"; |
11 | 10 | import { resolveBundledPluginPublicSurfacePath } from "./public-surface-runtime.js"; |
@@ -151,19 +150,14 @@ function getSharedBundledPublicSurfaceJiti(modulePath: string, tryNative: boolea
|
151 | 150 | export function loadBundledPluginPublicArtifactModuleSync<T extends object>(params: { |
152 | 151 | dirName: string; |
153 | 152 | artifactBasename: string; |
154 | | -installRuntimeDeps?: boolean; |
155 | 153 | }): T { |
156 | 154 | const location = resolvePublicSurfaceLocation(params); |
157 | 155 | if (!location) { |
158 | 156 | throw new Error( |
159 | 157 | `Unable to resolve bundled plugin public surface ${params.dirName}/${params.artifactBasename}`, |
160 | 158 | ); |
161 | 159 | } |
162 | | -const preparedLocation = prepareBuiltBundledPluginPublicSurfaceLocation({ |
163 | | - location, |
164 | | -pluginId: params.dirName, |
165 | | -installRuntimeDeps: params.installRuntimeDeps, |
166 | | -}); |
| 160 | +const preparedLocation = location; |
167 | 161 | const cached = |
168 | 162 | loadedPublicSurfaceModules.get(location.modulePath) ?? |
169 | 163 | loadedPublicSurfaceModules.get(preparedLocation.modulePath); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -58,7 +58,6 @@ describe("channel contract api explicit fast path", () => {
|
58 | 58 | expect(loadBundledPluginPublicArtifactModuleSyncMock).toHaveBeenCalledWith({ |
59 | 59 | dirName: "bluebubbles", |
60 | 60 | artifactBasename: "secret-contract-api.js", |
61 | | -installRuntimeDeps: false, |
62 | 61 | }); |
63 | 62 | expect(api?.secretTargetRegistryEntries).toEqual( |
64 | 63 | expect.arrayContaining([ |
@@ -80,7 +79,6 @@ describe("channel contract api explicit fast path", () => {
|
80 | 79 | expect(loadBundledPluginPublicArtifactModuleSyncMock).toHaveBeenCalledWith({ |
81 | 80 | dirName: "whatsapp", |
82 | 81 | artifactBasename: "security-contract-api.js", |
83 | | -installRuntimeDeps: false, |
84 | 82 | }); |
85 | 83 | expect(loadPluginManifestRegistryMock).not.toHaveBeenCalled(); |
86 | 84 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -30,7 +30,6 @@ function loadBundledChannelPublicArtifact(
|
30 | 30 | return loadBundledPluginPublicArtifactModuleSync<BundledChannelContractApi>({ |
31 | 31 | dirName: channelId, |
32 | 32 | artifactBasename, |
33 | | -installRuntimeDeps: false, |
34 | 33 | }); |
35 | 34 | } catch (error) { |
36 | 35 | if ( |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。