@openclaw/diffs 2026.9.6 → 2026.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/icon.png +0 -0
- package/dist/.setup/{browser.runtime-VjaO3wrj.mjs → browser.runtime-v15gbeC0.mjs} +1 -1
- package/dist/.setup/{viewer-assets-D3qrnaxI.mjs → viewer-assets-Bg9efLih.mjs} +24 -49
- package/dist/assets/viewer-runtime.js +2 -2
- package/dist/index.js +241 -201
- package/node_modules/@pierre/diffs/dist/components/File.d.ts +1 -0
- package/node_modules/@pierre/diffs/dist/components/File.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/File.js +4 -0
- package/node_modules/@pierre/diffs/dist/components/File.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/FileDiff.d.ts +1 -0
- package/node_modules/@pierre/diffs/dist/components/FileDiff.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/FileDiff.js +4 -0
- package/node_modules/@pierre/diffs/dist/components/FileDiff.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFile.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFile.js +8 -9
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFile.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFileDiff.js +8 -6
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFileDiff.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/editor.js +3 -5
- package/node_modules/@pierre/diffs/dist/editor/editor.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/textMeasure.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/textMeasure.js +27 -3
- package/node_modules/@pierre/diffs/dist/editor/textMeasure.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/attachResolvedLanguages.js +8 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/attachResolvedLanguages.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/registerCustomLanguage.d.ts +3 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/registerCustomLanguage.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/registerCustomLanguage.js +3 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/registerCustomLanguage.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/worker/WorkerPoolManager.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/worker/WorkerPoolManager.js +40 -38
- package/node_modules/@pierre/diffs/dist/worker/WorkerPoolManager.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/worker/worker-portable.js +8 -1
- package/node_modules/@pierre/diffs/dist/worker/worker-portable.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/worker/worker.js +8 -1
- package/node_modules/@pierre/diffs/dist/worker/worker.js.map +1 -1
- package/node_modules/@pierre/diffs/package.json +1 -1
- package/node_modules/typebox/build/compile/code.mjs +1 -2
- package/node_modules/typebox/build/compile/validator.mjs +5 -1
- package/node_modules/typebox/build/format/iri.mjs +16 -9
- package/node_modules/typebox/build/guard/emit.mjs +2 -2
- package/node_modules/typebox/build/guard/guard.d.mts +7 -5
- package/node_modules/typebox/build/guard/guard.mjs +14 -9
- package/node_modules/typebox/build/guard/index.mjs +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
- package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
- package/node_modules/typebox/build/schema/build.mjs +2 -3
- package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
- package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
- package/node_modules/typebox/build/schema/parse.mjs +3 -0
- package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
- package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
- package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
- package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
- package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
- package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
- package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
- package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
- package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
- package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +3 -1
- package/package.json +6 -6
- package/dist/api.js +0 -3
- package/dist/runtime-api.js +0 -2
- /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as getServedViewerAsset, r as VIEWER_RUNTIME_PATH } from "./.setup/viewer-assets-D3qrnaxI.mjs";
|
|
4
|
-
import { buildPluginConfigSchema } from "openclaw/plugin-sdk/plugin-entry";
|
|
1
|
+
import { a as getServedViewerAsset, r as VIEWER_RUNTIME_PATH } from "./.setup/viewer-assets-Bg9efLih.mjs";
|
|
2
|
+
import { buildPluginConfigSchema, definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
5
3
|
import { mapPluginConfigIssues } from "openclaw/plugin-sdk/extension-shared";
|
|
6
4
|
import { z } from "zod";
|
|
7
5
|
import { resolveGatewayPublicOrigin } from "openclaw/plugin-sdk/config-contracts";
|
|
8
|
-
import { resolveGatewayPort } from "openclaw/plugin-sdk/gateway-config-runtime";
|
|
9
6
|
import fs from "node:fs";
|
|
10
7
|
import path from "node:path";
|
|
11
8
|
import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
9
|
+
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
|
|
12
10
|
import { isLoopbackHost } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
13
11
|
import { asNonArrayRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
14
|
-
import { createAuthRateLimiter } from "openclaw/plugin-sdk/webhook-ingress";
|
|
12
|
+
import { createAuthRateLimiter, resolveRequestClientIp } from "openclaw/plugin-sdk/webhook-ingress";
|
|
15
13
|
import crypto from "node:crypto";
|
|
16
14
|
import fs$1 from "node:fs/promises";
|
|
15
|
+
import { promisify } from "node:util";
|
|
17
16
|
import { gunzip, gzip } from "node:zlib";
|
|
18
17
|
import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
|
|
19
18
|
import { MAX_DATE_TIMESTAMP_MS, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
@@ -26,6 +25,32 @@ import { Type } from "typebox";
|
|
|
26
25
|
import { parsePatchFiles, resolveLanguage } from "@pierre/diffs";
|
|
27
26
|
import { preloadDiffHTML } from "@pierre/diffs/ssr";
|
|
28
27
|
import { escapeHtml } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
28
|
+
//#region \0rolldown/runtime.js
|
|
29
|
+
var __defProp = Object.defineProperty;
|
|
30
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
31
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
32
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
33
|
+
var __exportAll = (all, no_symbols) => {
|
|
34
|
+
let target = {};
|
|
35
|
+
for (var name in all) __defProp(target, name, {
|
|
36
|
+
get: all[name],
|
|
37
|
+
enumerable: true
|
|
38
|
+
});
|
|
39
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
40
|
+
return target;
|
|
41
|
+
};
|
|
42
|
+
var __copyProps = (to, from, except, desc) => {
|
|
43
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
44
|
+
key = keys[i];
|
|
45
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
46
|
+
get: ((k) => from[k]).bind(null, key),
|
|
47
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return to;
|
|
51
|
+
};
|
|
52
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
53
|
+
//#endregion
|
|
29
54
|
//#region extensions/diffs/src/types.ts
|
|
30
55
|
const DIFF_LAYOUTS = ["unified", "split"];
|
|
31
56
|
const DIFF_MODES = [
|
|
@@ -49,6 +74,145 @@ const DIFF_OUTPUT_FORMATS = ["png", "pdf"];
|
|
|
49
74
|
const DIFF_ARTIFACT_ID_PATTERN = /^[0-9a-f]{20}$/;
|
|
50
75
|
const DIFF_ARTIFACT_TOKEN_PATTERN = /^[0-9a-f]{48}$/;
|
|
51
76
|
//#endregion
|
|
77
|
+
//#region src/gateway/gateway-http-route-contracts.ts
|
|
78
|
+
const GATEWAY_PROBE_ROUTES = /* @__PURE__ */ new Map([
|
|
79
|
+
["/health", "live"],
|
|
80
|
+
["/healthz", "live"],
|
|
81
|
+
["/ready", "ready"],
|
|
82
|
+
["/readyz", "ready"],
|
|
83
|
+
["/startup", "startup"],
|
|
84
|
+
["/startupz", "startup"]
|
|
85
|
+
]);
|
|
86
|
+
function classifyGatewayProbePath(pathname) {
|
|
87
|
+
for (const [root, status] of GATEWAY_PROBE_ROUTES) {
|
|
88
|
+
if (pathname === root) return status;
|
|
89
|
+
if (pathname.startsWith(`${root}/`)) return "namespace";
|
|
90
|
+
}
|
|
91
|
+
return "outside";
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region packages/normalization-core/src/string-coerce.ts
|
|
95
|
+
/** Trims string input and returns null for non-strings or empty strings. */
|
|
96
|
+
function normalizeNullableString(value) {
|
|
97
|
+
if (typeof value !== "string") return null;
|
|
98
|
+
const trimmed = value.trim();
|
|
99
|
+
return trimmed ? trimmed : null;
|
|
100
|
+
}
|
|
101
|
+
/** Trims string input and returns undefined for non-strings or empty strings. */
|
|
102
|
+
function normalizeOptionalString$1(value) {
|
|
103
|
+
return normalizeNullableString(value) ?? void 0;
|
|
104
|
+
}
|
|
105
|
+
/** Lowercases a normalized optional string. */
|
|
106
|
+
function normalizeOptionalLowercaseString(value) {
|
|
107
|
+
return normalizeOptionalString$1(value)?.toLowerCase();
|
|
108
|
+
}
|
|
109
|
+
/** Lowercases a normalized string or returns an empty string when absent. */
|
|
110
|
+
function normalizeLowercaseStringOrEmpty$1(value) {
|
|
111
|
+
return normalizeOptionalLowercaseString(value) ?? "";
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/plugins/http-path-prefix.ts
|
|
115
|
+
function prefixMatchPath(pathname, prefix) {
|
|
116
|
+
return pathname === prefix || pathname.startsWith(`${prefix}/`) || pathname.startsWith(`${prefix}%`);
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/gateway/security-path.ts
|
|
120
|
+
const MAX_PATH_DECODE_PASSES = 32;
|
|
121
|
+
function normalizePathSeparators(pathname) {
|
|
122
|
+
const collapsed = pathname.replace(/\/{2,}/g, "/");
|
|
123
|
+
if (collapsed.length <= 1) return collapsed;
|
|
124
|
+
return collapsed.replace(/\/+$/, "");
|
|
125
|
+
}
|
|
126
|
+
function resolveDotSegments(pathname) {
|
|
127
|
+
try {
|
|
128
|
+
return new URL(pathname, "http://localhost").pathname;
|
|
129
|
+
} catch {
|
|
130
|
+
return pathname;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function normalizePathForSecurity(pathname) {
|
|
134
|
+
return normalizePathSeparators(normalizeLowercaseStringOrEmpty$1(resolveDotSegments(pathname))) || "/";
|
|
135
|
+
}
|
|
136
|
+
function buildCanonicalPathCandidates(pathname, maxDecodePasses = MAX_PATH_DECODE_PASSES) {
|
|
137
|
+
const candidates = /* @__PURE__ */ new Set([normalizePathForSecurity(pathname)]);
|
|
138
|
+
let decoded = pathname;
|
|
139
|
+
let malformedEncoding = false;
|
|
140
|
+
let decodePasses = 0;
|
|
141
|
+
for (let pass = 0; pass < maxDecodePasses; pass++) {
|
|
142
|
+
let nextDecoded;
|
|
143
|
+
try {
|
|
144
|
+
nextDecoded = decodeURIComponent(decoded);
|
|
145
|
+
} catch {
|
|
146
|
+
malformedEncoding = true;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
if (nextDecoded === decoded) break;
|
|
150
|
+
decodePasses += 1;
|
|
151
|
+
decoded = nextDecoded;
|
|
152
|
+
candidates.add(normalizePathForSecurity(decoded));
|
|
153
|
+
}
|
|
154
|
+
let decodePassLimitReached = false;
|
|
155
|
+
if (!malformedEncoding) try {
|
|
156
|
+
decodePassLimitReached = decodeURIComponent(decoded) !== decoded;
|
|
157
|
+
} catch {
|
|
158
|
+
malformedEncoding = true;
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
candidates: [...candidates],
|
|
162
|
+
decodePasses,
|
|
163
|
+
decodePassLimitReached,
|
|
164
|
+
malformedEncoding
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function canonicalizePathForSecurity(pathname) {
|
|
168
|
+
const { candidates, decodePasses, decodePassLimitReached, malformedEncoding } = buildCanonicalPathCandidates(pathname);
|
|
169
|
+
return {
|
|
170
|
+
canonicalPath: candidates[candidates.length - 1] ?? "/",
|
|
171
|
+
candidates,
|
|
172
|
+
decodePasses,
|
|
173
|
+
decodePassLimitReached,
|
|
174
|
+
malformedEncoding,
|
|
175
|
+
rawNormalizedPath: normalizePathSeparators(normalizeLowercaseStringOrEmpty$1(pathname)) || "/"
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
const PROTECTED_PLUGIN_ROUTE_PREFIXES = ["/api/channels"];
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/gateway/server/plugins-http/path-context.ts
|
|
181
|
+
function normalizeProtectedPrefix(prefix) {
|
|
182
|
+
const collapsed = normalizeLowercaseStringOrEmpty$1(prefix).replace(/\/{2,}/g, "/");
|
|
183
|
+
if (collapsed.length <= 1) return collapsed || "/";
|
|
184
|
+
return collapsed.replace(/\/+$/, "");
|
|
185
|
+
}
|
|
186
|
+
const NORMALIZED_PROTECTED_PLUGIN_ROUTE_PREFIXES = PROTECTED_PLUGIN_ROUTE_PREFIXES.map(normalizeProtectedPrefix);
|
|
187
|
+
/** Returns true when any decoded path candidate targets a protected route. */
|
|
188
|
+
function isProtectedPluginRoutePathFromContext(context) {
|
|
189
|
+
if (context.candidates.some((candidate) => NORMALIZED_PROTECTED_PLUGIN_ROUTE_PREFIXES.some((prefix) => prefixMatchPath(candidate, prefix)))) return true;
|
|
190
|
+
if (context.decodePassLimitReached) return true;
|
|
191
|
+
if (!context.malformedEncoding) return false;
|
|
192
|
+
return NORMALIZED_PROTECTED_PLUGIN_ROUTE_PREFIXES.some((prefix) => prefixMatchPath(context.rawNormalizedPath, prefix));
|
|
193
|
+
}
|
|
194
|
+
/** Builds all security-relevant decoded path candidates for a request path. */
|
|
195
|
+
function resolvePluginRoutePathContext(pathname) {
|
|
196
|
+
const canonical = canonicalizePathForSecurity(pathname);
|
|
197
|
+
return {
|
|
198
|
+
pathname,
|
|
199
|
+
canonicalPath: canonical.canonicalPath,
|
|
200
|
+
candidates: canonical.candidates,
|
|
201
|
+
malformedEncoding: canonical.malformedEncoding,
|
|
202
|
+
decodePassLimitReached: canonical.decodePassLimitReached,
|
|
203
|
+
rawNormalizedPath: canonical.rawNormalizedPath
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region \0openclaw:bundled-sdk:openclaw/plugin-sdk/gateway-config-runtime
|
|
208
|
+
var gateway_config_runtime_exports = /* @__PURE__ */ __exportAll({
|
|
209
|
+
classifyGatewayProbePath: () => classifyGatewayProbePath,
|
|
210
|
+
isProtectedPluginRoutePathFromContext: () => isProtectedPluginRoutePathFromContext,
|
|
211
|
+
resolvePluginRoutePathContext: () => resolvePluginRoutePathContext
|
|
212
|
+
});
|
|
213
|
+
import * as import_openclaw_plugin_sdk_gateway_config_runtime from "openclaw/plugin-sdk/gateway-config-runtime";
|
|
214
|
+
__reExport(gateway_config_runtime_exports, import_openclaw_plugin_sdk_gateway_config_runtime);
|
|
215
|
+
//#endregion
|
|
52
216
|
//#region extensions/diffs/src/url.ts
|
|
53
217
|
function buildViewerUrl(params) {
|
|
54
218
|
const normalizedBase = normalizeViewerBaseUrl(params.baseUrl?.trim() || params.viewerBaseUrl?.trim() || resolveGatewayPublicOrigin(params.config) || resolveGatewayBaseUrl(params.config));
|
|
@@ -75,7 +239,7 @@ function normalizeViewerBaseUrl(raw, fieldName = "baseUrl") {
|
|
|
75
239
|
}
|
|
76
240
|
function resolveGatewayBaseUrl(config) {
|
|
77
241
|
const scheme = config.gateway?.tls?.enabled ? "https" : "http";
|
|
78
|
-
const port = resolveGatewayPort(config);
|
|
242
|
+
const port = (0, gateway_config_runtime_exports.resolveGatewayPort)(config);
|
|
79
243
|
const customHost = config.gateway?.customBindHost?.trim();
|
|
80
244
|
if (config.gateway?.bind === "custom" && customHost) return `${scheme}://${customHost}:${port}`;
|
|
81
245
|
return `${scheme}://127.0.0.1:${port}`;
|
|
@@ -183,10 +347,6 @@ const diffsPluginConfigSchema = {
|
|
|
183
347
|
}
|
|
184
348
|
}
|
|
185
349
|
};
|
|
186
|
-
function resolveConfiguredValue(options) {
|
|
187
|
-
const alias = options.aliases.find((value) => value !== void 0);
|
|
188
|
-
return options.primary ?? alias;
|
|
189
|
-
}
|
|
190
350
|
function buildDiffsPluginConfigShape(config) {
|
|
191
351
|
const viewerBaseUrl = resolveDiffsPluginViewerBaseUrl(config);
|
|
192
352
|
return {
|
|
@@ -199,23 +359,9 @@ function resolveDiffsPluginDefaults(config) {
|
|
|
199
359
|
if (!config || typeof config !== "object" || Array.isArray(config)) return { ...DEFAULT_DIFFS_TOOL_DEFAULTS };
|
|
200
360
|
const defaults = config.defaults;
|
|
201
361
|
if (!defaults || typeof defaults !== "object" || Array.isArray(defaults)) return { ...DEFAULT_DIFFS_TOOL_DEFAULTS };
|
|
202
|
-
const fileQuality = normalizeFileQuality$1(
|
|
203
|
-
primary: defaults.fileQuality,
|
|
204
|
-
aliases: [defaults.imageQuality]
|
|
205
|
-
}));
|
|
362
|
+
const fileQuality = normalizeFileQuality$1(defaults.fileQuality ?? defaults.imageQuality);
|
|
206
363
|
const profile = DEFAULT_IMAGE_QUALITY_PROFILES[fileQuality];
|
|
207
|
-
const fileFormat =
|
|
208
|
-
primary: defaults.fileFormat,
|
|
209
|
-
aliases: [defaults.imageFormat, defaults.format]
|
|
210
|
-
});
|
|
211
|
-
const fileScale = resolveConfiguredValue({
|
|
212
|
-
primary: defaults.fileScale,
|
|
213
|
-
aliases: [defaults.imageScale]
|
|
214
|
-
});
|
|
215
|
-
const fileMaxWidth = resolveConfiguredValue({
|
|
216
|
-
primary: defaults.fileMaxWidth,
|
|
217
|
-
aliases: [defaults.imageMaxWidth]
|
|
218
|
-
});
|
|
364
|
+
const fileFormat = defaults.fileFormat ?? (defaults.imageFormat !== void 0 ? defaults.imageFormat : defaults.format);
|
|
219
365
|
return {
|
|
220
366
|
fontFamily: normalizeFontFamily(defaults.fontFamily),
|
|
221
367
|
fontSize: normalizeDiffFontSize(defaults.fontSize),
|
|
@@ -228,8 +374,8 @@ function resolveDiffsPluginDefaults(config) {
|
|
|
228
374
|
theme: normalizeTheme$1(defaults.theme),
|
|
229
375
|
fileFormat: normalizeFileFormat(fileFormat),
|
|
230
376
|
fileQuality,
|
|
231
|
-
fileScale: normalizeFileScale(fileScale, profile.scale),
|
|
232
|
-
fileMaxWidth: normalizeFileMaxWidth(fileMaxWidth, profile.maxWidth),
|
|
377
|
+
fileScale: normalizeFileScale(defaults.fileScale ?? defaults.imageScale, profile.scale),
|
|
378
|
+
fileMaxWidth: normalizeFileMaxWidth(defaults.fileMaxWidth ?? defaults.imageMaxWidth, profile.maxWidth),
|
|
233
379
|
mode: normalizeMode$1(defaults.mode),
|
|
234
380
|
ttlSeconds: normalizeTtlSeconds(defaults.ttlSeconds)
|
|
235
381
|
};
|
|
@@ -439,9 +585,6 @@ function normalizeRemoteClientKey(remoteAddress) {
|
|
|
439
585
|
if (!normalized) return "unknown";
|
|
440
586
|
return normalized.startsWith("::ffff:") ? normalized.slice(7) : normalized;
|
|
441
587
|
}
|
|
442
|
-
function isLoopbackClientIp(clientIp) {
|
|
443
|
-
return isLoopbackHost(clientIp);
|
|
444
|
-
}
|
|
445
588
|
function hasProxyForwardingHints(req) {
|
|
446
589
|
const headers = req.headers ?? {};
|
|
447
590
|
return Boolean(headers["x-forwarded-for"] || headers["x-real-ip"] || headers.forwarded || headers["x-forwarded-host"] || headers["x-forwarded-proto"]);
|
|
@@ -452,7 +595,7 @@ function resolveViewerAccess(req, params) {
|
|
|
452
595
|
const remoteKey = normalizeRemoteClientKey(clientIp ?? req.socket?.remoteAddress);
|
|
453
596
|
return {
|
|
454
597
|
remoteKey,
|
|
455
|
-
localRequest: !proxyHintsPresent && typeof clientIp === "string" &&
|
|
598
|
+
localRequest: !proxyHintsPresent && typeof clientIp === "string" && isLoopbackHost(remoteKey)
|
|
456
599
|
};
|
|
457
600
|
}
|
|
458
601
|
function recordRemoteFailure(limiter, access) {
|
|
@@ -482,6 +625,8 @@ const MAX_DECODED_HTML_BYTES = 67108864;
|
|
|
482
625
|
const ARTIFACT_ID_ATTEMPTS = 8;
|
|
483
626
|
const VIEWER_PREFIX = "/plugins/diffs/view";
|
|
484
627
|
const EMPTY_BLOB = /* @__PURE__ */ new Uint8Array();
|
|
628
|
+
const gzipAsync = promisify(gzip);
|
|
629
|
+
const gunzipAsync = promisify(gunzip);
|
|
485
630
|
function isBlobLimitError(error) {
|
|
486
631
|
return typeof error === "object" && error !== null && "code" in error && error.code === "PLUGIN_BLOB_LIMIT_EXCEEDED";
|
|
487
632
|
}
|
|
@@ -528,7 +673,7 @@ var DiffArtifactStore = class {
|
|
|
528
673
|
if (!isViewerMetadata(entry.metadata)) return null;
|
|
529
674
|
const tokenHash = hashToken(token);
|
|
530
675
|
if (!safeEqualSecret(tokenHash, entry.metadata.tokenHash)) return null;
|
|
531
|
-
const html = await gunzipAsync(entry.bytes, MAX_DECODED_HTML_BYTES);
|
|
676
|
+
const html = await gunzipAsync(entry.bytes, { maxOutputLength: MAX_DECODED_HTML_BYTES });
|
|
532
677
|
if (html.byteLength !== entry.metadata.decodedBytes) throw new Error(`Diff artifact ${id} decoded size does not match its metadata.`);
|
|
533
678
|
return {
|
|
534
679
|
artifact: viewerEntryToMeta(entry, token),
|
|
@@ -595,9 +740,6 @@ var DiffArtifactStore = class {
|
|
|
595
740
|
force: true
|
|
596
741
|
}).catch(() => {});
|
|
597
742
|
}
|
|
598
|
-
scheduleCleanup() {
|
|
599
|
-
this.maybeCleanupExpired();
|
|
600
|
-
}
|
|
601
743
|
startCleanup() {
|
|
602
744
|
this.cleanupStopped = false;
|
|
603
745
|
}
|
|
@@ -663,7 +805,7 @@ var DiffArtifactStore = class {
|
|
|
663
805
|
force: true
|
|
664
806
|
}).catch(() => {});
|
|
665
807
|
}
|
|
666
|
-
|
|
808
|
+
scheduleCleanup() {
|
|
667
809
|
const now = Date.now();
|
|
668
810
|
if (this.cleanupStopped || this.cleanupInFlight || now < this.nextCleanupAt) return;
|
|
669
811
|
this.nextCleanupAt = now + this.cleanupIntervalMs;
|
|
@@ -725,28 +867,6 @@ function isArtifactContext(value) {
|
|
|
725
867
|
]);
|
|
726
868
|
return Object.entries(context).every(([key, entry]) => allowed.has(key) && (entry === void 0 || typeof entry === "string"));
|
|
727
869
|
}
|
|
728
|
-
async function gzipAsync(input) {
|
|
729
|
-
return await new Promise((resolve, reject) => {
|
|
730
|
-
gzip(input, (error, result) => {
|
|
731
|
-
if (error) {
|
|
732
|
-
reject(error);
|
|
733
|
-
return;
|
|
734
|
-
}
|
|
735
|
-
resolve(result);
|
|
736
|
-
});
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
async function gunzipAsync(input, maxOutputLength) {
|
|
740
|
-
return await new Promise((resolve, reject) => {
|
|
741
|
-
gunzip(input, { maxOutputLength }, (error, result) => {
|
|
742
|
-
if (error) {
|
|
743
|
-
reject(error);
|
|
744
|
-
return;
|
|
745
|
-
}
|
|
746
|
-
resolve(result);
|
|
747
|
-
});
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
870
|
function isFileExists(error) {
|
|
751
871
|
return error instanceof Error && "code" in error && error.code === "EEXIST";
|
|
752
872
|
}
|
|
@@ -1000,7 +1120,6 @@ async function normalizeSupportedLanguageHints(values, options) {
|
|
|
1000
1120
|
if (!normalized) continue;
|
|
1001
1121
|
supported.add(normalized);
|
|
1002
1122
|
}
|
|
1003
|
-
if (options.fallbackToText && supported.size === 0) supported.add("text");
|
|
1004
1123
|
return [...supported];
|
|
1005
1124
|
}
|
|
1006
1125
|
function collectDiffPayloadLanguageHints(payload) {
|
|
@@ -1015,13 +1134,9 @@ async function normalizeDiffPayloadFileLanguage(file, options) {
|
|
|
1015
1134
|
if (typeof file.lang !== "string") return file;
|
|
1016
1135
|
const normalized = await normalizeSupportedLanguageHint(file.lang, options);
|
|
1017
1136
|
if (file.lang === normalized) return file;
|
|
1018
|
-
if (!normalized) return {
|
|
1019
|
-
...file,
|
|
1020
|
-
lang: "text"
|
|
1021
|
-
};
|
|
1022
1137
|
return {
|
|
1023
1138
|
...file,
|
|
1024
|
-
lang: normalized
|
|
1139
|
+
lang: normalized ?? "text"
|
|
1025
1140
|
};
|
|
1026
1141
|
}
|
|
1027
1142
|
async function normalizeDiffViewerPayloadLanguages(payload, options = {}) {
|
|
@@ -1029,10 +1144,7 @@ async function normalizeDiffViewerPayloadLanguages(payload, options = {}) {
|
|
|
1029
1144
|
normalizeDiffPayloadFileLanguage(payload.fileDiff, options),
|
|
1030
1145
|
normalizeDiffPayloadFileLanguage(payload.oldFile, options),
|
|
1031
1146
|
normalizeDiffPayloadFileLanguage(payload.newFile, options),
|
|
1032
|
-
normalizeSupportedLanguageHints(payload.langs,
|
|
1033
|
-
fallbackToText: false,
|
|
1034
|
-
...options
|
|
1035
|
-
})
|
|
1147
|
+
normalizeSupportedLanguageHints(payload.langs, options)
|
|
1036
1148
|
]);
|
|
1037
1149
|
const langs = new Set(payloadLangs);
|
|
1038
1150
|
for (const lang of collectDiffPayloadLanguageHints({
|
|
@@ -1186,16 +1298,15 @@ function buildImageRenderOptions(options) {
|
|
|
1186
1298
|
}
|
|
1187
1299
|
};
|
|
1188
1300
|
}
|
|
1189
|
-
function
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
}
|
|
1195
|
-
function buildRenderVariants(params) {
|
|
1301
|
+
function buildRenderVariants(options, target) {
|
|
1302
|
+
const viewerOptions = target === "viewer" || target === "both" ? buildDiffOptions(options) : void 0;
|
|
1303
|
+
const imageOptions = target === "image" || target === "both" ? buildDiffOptions(buildImageRenderOptions(options)) : void 0;
|
|
1304
|
+
const preloadOptions = viewerOptions ?? imageOptions;
|
|
1305
|
+
if (!preloadOptions) throw new Error(`Unsupported diff render target: ${target}`);
|
|
1196
1306
|
return {
|
|
1197
|
-
|
|
1198
|
-
|
|
1307
|
+
viewerOptions,
|
|
1308
|
+
imageOptions,
|
|
1309
|
+
preloadOptions
|
|
1199
1310
|
};
|
|
1200
1311
|
}
|
|
1201
1312
|
function renderDiffCard(payload, anchorId) {
|
|
@@ -1441,14 +1552,26 @@ ${imageTypographyCss}
|
|
|
1441
1552
|
</body>
|
|
1442
1553
|
</html>`;
|
|
1443
1554
|
}
|
|
1444
|
-
function
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1555
|
+
async function renderSection(input, { viewerOptions, imageOptions, preloadOptions }, languagePackAvailable, anchorId) {
|
|
1556
|
+
const payload = await normalizeDiffViewerPayloadLanguages({
|
|
1557
|
+
prerenderedHTML: await preloadDiffHTMLWithFallback({
|
|
1558
|
+
...input,
|
|
1559
|
+
options: preloadOptions
|
|
1560
|
+
}),
|
|
1561
|
+
...input,
|
|
1562
|
+
options: preloadOptions,
|
|
1563
|
+
langs: collectDiffPayloadLanguageHints(input)
|
|
1564
|
+
}, { languagePackAvailable });
|
|
1448
1565
|
return {
|
|
1449
|
-
...
|
|
1450
|
-
|
|
1451
|
-
|
|
1566
|
+
...viewerOptions ? { viewer: renderDiffCard({
|
|
1567
|
+
...payload,
|
|
1568
|
+
options: viewerOptions
|
|
1569
|
+
}, anchorId) } : {},
|
|
1570
|
+
...imageOptions ? { image: renderDiffCard({
|
|
1571
|
+
...payload,
|
|
1572
|
+
options: imageOptions
|
|
1573
|
+
}, anchorId) } : {},
|
|
1574
|
+
usesLanguagePack: payload.langs.some((lang) => !isBaseDiffViewerLanguage(lang))
|
|
1452
1575
|
};
|
|
1453
1576
|
}
|
|
1454
1577
|
function buildRenderedBodies(sections, leadingHtml) {
|
|
@@ -1467,48 +1590,18 @@ async function renderBeforeAfterDiff(input, options, target) {
|
|
|
1467
1590
|
input,
|
|
1468
1591
|
lang
|
|
1469
1592
|
});
|
|
1470
|
-
const
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
target
|
|
1483
|
-
});
|
|
1484
|
-
const preloadOptions = viewerOptions ?? imageOptions;
|
|
1485
|
-
if (!preloadOptions) throw new Error(`Unsupported diff render target: ${target}`);
|
|
1486
|
-
const normalizedPayload = await normalizeDiffViewerPayloadLanguages({
|
|
1487
|
-
prerenderedHTML: await preloadDiffHTMLWithFallback({
|
|
1488
|
-
oldFile,
|
|
1489
|
-
newFile,
|
|
1490
|
-
options: preloadOptions
|
|
1491
|
-
}),
|
|
1492
|
-
oldFile,
|
|
1493
|
-
newFile,
|
|
1494
|
-
options: preloadOptions,
|
|
1495
|
-
langs: collectDiffPayloadLanguageHints({
|
|
1496
|
-
oldFile,
|
|
1497
|
-
newFile
|
|
1498
|
-
})
|
|
1499
|
-
}, { languagePackAvailable });
|
|
1500
|
-
const viewerPayload = viewerOptions ? {
|
|
1501
|
-
...normalizedPayload,
|
|
1502
|
-
options: viewerOptions
|
|
1503
|
-
} : void 0;
|
|
1504
|
-
const imagePayload = imageOptions ? {
|
|
1505
|
-
...normalizedPayload,
|
|
1506
|
-
options: imageOptions
|
|
1507
|
-
} : void 0;
|
|
1508
|
-
const section = buildRenderedSection({
|
|
1509
|
-
...viewerPayload ? { viewerPayload } : {},
|
|
1510
|
-
...imagePayload ? { imagePayload } : {}
|
|
1511
|
-
});
|
|
1593
|
+
const section = await renderSection({
|
|
1594
|
+
oldFile: {
|
|
1595
|
+
name: fileName,
|
|
1596
|
+
contents: input.before,
|
|
1597
|
+
...lang ? { lang } : {}
|
|
1598
|
+
},
|
|
1599
|
+
newFile: {
|
|
1600
|
+
name: fileName,
|
|
1601
|
+
contents: input.after,
|
|
1602
|
+
...lang ? { lang } : {}
|
|
1603
|
+
}
|
|
1604
|
+
}, buildRenderVariants(options, target), languagePackAvailable);
|
|
1512
1605
|
return {
|
|
1513
1606
|
...buildRenderedBodies([section]),
|
|
1514
1607
|
fileCount: 1,
|
|
@@ -1525,41 +1618,13 @@ async function renderPatchDiff(input, options, target) {
|
|
|
1525
1618
|
const unifiedLines = Number.isFinite(fileDiff.unifiedLineCount) ? fileDiff.unifiedLineCount : 0;
|
|
1526
1619
|
return sum + Math.max(splitLines, unifiedLines, 0);
|
|
1527
1620
|
}, 0) > MAX_PATCH_TOTAL_LINES) throw new DiffRenderInputError(`Patch input is too large to render (max ${MAX_PATCH_TOTAL_LINES} lines).`);
|
|
1528
|
-
const
|
|
1529
|
-
options,
|
|
1530
|
-
target
|
|
1531
|
-
});
|
|
1532
|
-
const preloadOptions = viewerOptions ?? imageOptions;
|
|
1533
|
-
if (!preloadOptions) throw new Error(`Unsupported diff render target: ${target}`);
|
|
1621
|
+
const variants = buildRenderVariants(options, target);
|
|
1534
1622
|
const navEntries = files.map((fileDiff, index) => ({
|
|
1535
1623
|
anchorId: `oc-diff-file-${index + 1}`,
|
|
1536
1624
|
fileDiff,
|
|
1537
1625
|
stats: computeFileDiffStats(fileDiff)
|
|
1538
1626
|
}));
|
|
1539
|
-
const sections = await Promise.all(files.map(
|
|
1540
|
-
const normalizedPayload = await normalizeDiffViewerPayloadLanguages({
|
|
1541
|
-
prerenderedHTML: await preloadDiffHTMLWithFallback({
|
|
1542
|
-
fileDiff,
|
|
1543
|
-
options: preloadOptions
|
|
1544
|
-
}),
|
|
1545
|
-
fileDiff,
|
|
1546
|
-
options: preloadOptions,
|
|
1547
|
-
langs: collectDiffPayloadLanguageHints({ fileDiff })
|
|
1548
|
-
}, { languagePackAvailable });
|
|
1549
|
-
const viewerPayload = viewerOptions ? {
|
|
1550
|
-
...normalizedPayload,
|
|
1551
|
-
options: viewerOptions
|
|
1552
|
-
} : void 0;
|
|
1553
|
-
const imagePayload = imageOptions ? {
|
|
1554
|
-
...normalizedPayload,
|
|
1555
|
-
options: imageOptions
|
|
1556
|
-
} : void 0;
|
|
1557
|
-
return buildRenderedSection({
|
|
1558
|
-
...viewerPayload ? { viewerPayload } : {},
|
|
1559
|
-
...imagePayload ? { imagePayload } : {},
|
|
1560
|
-
anchorId: navEntries[index]?.anchorId
|
|
1561
|
-
});
|
|
1562
|
-
}));
|
|
1627
|
+
const sections = await Promise.all(files.map((fileDiff, index) => renderSection({ fileDiff }, variants, languagePackAvailable, navEntries[index]?.anchorId)));
|
|
1563
1628
|
return {
|
|
1564
1629
|
...buildRenderedBodies(sections, files.length > 1 ? renderFileSummaryNav(navEntries) : void 0),
|
|
1565
1630
|
fileCount: files.length,
|
|
@@ -1623,7 +1688,7 @@ const MAX_TITLE_BYTES = 1024;
|
|
|
1623
1688
|
const MAX_PATH_BYTES = 2048;
|
|
1624
1689
|
const MAX_LANG_BYTES = 128;
|
|
1625
1690
|
const MAX_DIFF_ARTIFACT_TTL_SECONDS = 21600;
|
|
1626
|
-
const loadDiffsBrowserRuntime = createLazyRuntimeModule(() => import("./.setup/browser.runtime-
|
|
1691
|
+
const loadDiffsBrowserRuntime = createLazyRuntimeModule(() => import("./.setup/browser.runtime-v15gbeC0.mjs"));
|
|
1627
1692
|
const DiffsToolSchema = Type.Object({
|
|
1628
1693
|
before: Type.Optional(Type.String({ description: "Original text content." })),
|
|
1629
1694
|
after: Type.Optional(Type.String({ description: "Updated text content." })),
|
|
@@ -1718,41 +1783,7 @@ function createDiffsTool(params) {
|
|
|
1718
1783
|
if (error instanceof DiffRenderInputError) throw new PluginToolInputError(error.message);
|
|
1719
1784
|
throw error;
|
|
1720
1785
|
});
|
|
1721
|
-
|
|
1722
|
-
const artifactFile = await renderDiffArtifactFile({
|
|
1723
|
-
screenshotter: await loadScreenshotter(config),
|
|
1724
|
-
store: params.store,
|
|
1725
|
-
html: requireRenderedHtml(rendered.imageHtml, "image"),
|
|
1726
|
-
theme,
|
|
1727
|
-
image,
|
|
1728
|
-
ttlMs,
|
|
1729
|
-
context: artifactContext
|
|
1730
|
-
});
|
|
1731
|
-
return {
|
|
1732
|
-
content: [{
|
|
1733
|
-
type: "text",
|
|
1734
|
-
text: buildFileArtifactMessage({
|
|
1735
|
-
format: image.format,
|
|
1736
|
-
filePath: artifactFile.path
|
|
1737
|
-
})
|
|
1738
|
-
}],
|
|
1739
|
-
details: buildArtifactDetails({
|
|
1740
|
-
baseDetails: {
|
|
1741
|
-
changed: true,
|
|
1742
|
-
...artifactFile.artifactId ? { artifactId: artifactFile.artifactId } : {},
|
|
1743
|
-
...artifactFile.expiresAt ? { expiresAt: artifactFile.expiresAt } : {},
|
|
1744
|
-
title: rendered.title,
|
|
1745
|
-
inputKind: rendered.inputKind,
|
|
1746
|
-
fileCount: rendered.fileCount,
|
|
1747
|
-
mode,
|
|
1748
|
-
...artifactContext ? { context: artifactContext } : {}
|
|
1749
|
-
},
|
|
1750
|
-
artifactFile,
|
|
1751
|
-
image
|
|
1752
|
-
})
|
|
1753
|
-
};
|
|
1754
|
-
}
|
|
1755
|
-
const artifact = await params.store.createArtifact({
|
|
1786
|
+
const artifact = isArtifactOnlyMode(mode) ? void 0 : await params.store.createArtifact({
|
|
1756
1787
|
html: requireRenderedHtml(rendered.html, "viewer"),
|
|
1757
1788
|
title: rendered.title,
|
|
1758
1789
|
inputKind: rendered.inputKind,
|
|
@@ -1760,13 +1791,13 @@ function createDiffsTool(params) {
|
|
|
1760
1791
|
ttlMs,
|
|
1761
1792
|
context: artifactContext
|
|
1762
1793
|
});
|
|
1763
|
-
const viewerUrl = buildViewerUrl({
|
|
1794
|
+
const viewerUrl = artifact ? buildViewerUrl({
|
|
1764
1795
|
config,
|
|
1765
1796
|
viewerPath: artifact.viewerPath,
|
|
1766
1797
|
baseUrl: normalizeBaseUrl(toolParams.baseUrl),
|
|
1767
1798
|
viewerBaseUrl: params.viewerBaseUrl
|
|
1768
|
-
});
|
|
1769
|
-
const
|
|
1799
|
+
}) : void 0;
|
|
1800
|
+
const viewerDetails = artifact ? {
|
|
1770
1801
|
changed: true,
|
|
1771
1802
|
artifactId: artifact.id,
|
|
1772
1803
|
viewerUrl,
|
|
@@ -1777,13 +1808,13 @@ function createDiffsTool(params) {
|
|
|
1777
1808
|
fileCount: artifact.fileCount,
|
|
1778
1809
|
mode,
|
|
1779
1810
|
...artifactContext ? { context: artifactContext } : {}
|
|
1780
|
-
};
|
|
1811
|
+
} : void 0;
|
|
1781
1812
|
if (mode === "view") return {
|
|
1782
1813
|
content: [{
|
|
1783
1814
|
type: "text",
|
|
1784
1815
|
text: `Diff viewer ready.\n${viewerUrl}`
|
|
1785
1816
|
}],
|
|
1786
|
-
details:
|
|
1817
|
+
details: viewerDetails
|
|
1787
1818
|
};
|
|
1788
1819
|
try {
|
|
1789
1820
|
const artifactFile = await renderDiffArtifactFile({
|
|
@@ -1805,7 +1836,16 @@ function createDiffsTool(params) {
|
|
|
1805
1836
|
})
|
|
1806
1837
|
}],
|
|
1807
1838
|
details: buildArtifactDetails({
|
|
1808
|
-
baseDetails
|
|
1839
|
+
baseDetails: viewerDetails ?? {
|
|
1840
|
+
changed: true,
|
|
1841
|
+
...artifactFile.artifactId ? { artifactId: artifactFile.artifactId } : {},
|
|
1842
|
+
...artifactFile.expiresAt ? { expiresAt: artifactFile.expiresAt } : {},
|
|
1843
|
+
title: rendered.title,
|
|
1844
|
+
inputKind: rendered.inputKind,
|
|
1845
|
+
fileCount: rendered.fileCount,
|
|
1846
|
+
mode,
|
|
1847
|
+
...artifactContext ? { context: artifactContext } : {}
|
|
1848
|
+
},
|
|
1809
1849
|
artifactFile,
|
|
1810
1850
|
image
|
|
1811
1851
|
})
|
|
@@ -1819,7 +1859,7 @@ function createDiffsTool(params) {
|
|
|
1819
1859
|
text: `Diff viewer ready.\n${viewerUrl}\nFile rendering failed: ${errorMessage}`
|
|
1820
1860
|
}],
|
|
1821
1861
|
details: {
|
|
1822
|
-
...
|
|
1862
|
+
...viewerDetails,
|
|
1823
1863
|
fileError: errorMessage
|
|
1824
1864
|
}
|
|
1825
1865
|
};
|
|
@@ -188,6 +188,7 @@ declare class File<LAnnotation = undefined, Caret = undefined> {
|
|
|
188
188
|
private clearAuxiliaryNodes;
|
|
189
189
|
private canPartiallyRender;
|
|
190
190
|
renderPlaceholder(height: number): boolean;
|
|
191
|
+
protected setPlaceholderHeight(height: number): boolean;
|
|
191
192
|
primeHighlightCache(file?: FileContents | undefined): Promise<void>;
|
|
192
193
|
private cleanChildNodes;
|
|
193
194
|
private renderAnnotations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"File.d.ts","names":[],"sources":["../../src/components/File.ts"],"mappings":";;;;;;;;;;UA0FiB,gBAAgB;EAC/B,MAAM;EACN,gBAAgB;EAChB,mBAAmB;EACnB;EACA;EACA;EACA,kBAAkB,eAAe;EACjC,cAAc;;UAGC,iBAAiB,qBAAqB,KACrD,gBAAgB;EAGhB,eAAe;EACf;;KAGU,sBAAsB,aAAa,UAC7C,OAAO,0BAA0B,aAAa;;;;;;;;;KAWpC,wBAAwB,aAAa,UAC/C,OAAO,sBAAsB,aAAa,WACvC;UAEY,YAAY,aAAa,eAChC,iBAAiB;EACzB;EACA,qBAAqB;EACrB,6BAA6B;EAC7B,uBAAuB;EACvB,qBAAqB;;;;;;EAMrB;EACA,kBACE,YAAY,eAAe,eAC1B;EACH,qBACE,qBAAqB,2CACpB;EAEH,cACE,MAAM,aACN,UAAU,KAAK,aAAa,QAC5B,OAAO;;;;;;;EAST,eAAe,sBAAsB,aAAa;;;;;;;EAQlD,iBAAiB,wBAAwB,aAAa;;UAG9C,uBAAuB;EAC/B,SAAS;EACT,YAAY,eAAe;;U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CD,sBACL,QAAQ,eAAe,aAAa,QACpC;UAKM;EAyFD,oBACL,cAAc,qBAAqB,cACnC,qBAAqB,eAAe;EAe/B,kBACL,YAAY,YAAY,MAAM,oBAC9B,6BACA;IACE;;EAiBG,SACL,MACA,eACA,aACA,aACA,kBACA,eACA,iBACA,eACC,gBAAgB;YA+LT;UAEF;UA2BA;UAmBA;UAUA;EAWD,kBAAkB;YAkBf,qBAAqB;EAQlB,oBACX,OAAM,2BACL;UAyBK;UA0CA;UA4CA;UAqBA;UAiCA;UAqDA;YAeE;UAIF;UA6BA;UA6GA;UAcA;UA2BA;UA8CA;UASA;YAiDE;UAIF;UA4EA;UAYA;UAkBA;UAYA;YAME,6BACR,gBAAgB,aAChB,aAAa,cACZ;UAmCK;UAyBA;UAgBA;UAwBA;UAaA;UAqBA;UAqBA"}
|
|
@@ -634,6 +634,10 @@ var File = class {
|
|
|
634
634
|
this.placeHolder.dataset.placeholder = "";
|
|
635
635
|
shadowRoot.appendChild(this.placeHolder);
|
|
636
636
|
}
|
|
637
|
+
return this.setPlaceholderHeight(height);
|
|
638
|
+
}
|
|
639
|
+
setPlaceholderHeight(height) {
|
|
640
|
+
if (this.placeHolder == null) return false;
|
|
637
641
|
this.placeHolder.style.setProperty("height", `${height}px`);
|
|
638
642
|
return true;
|
|
639
643
|
}
|