@aiderdesk/aiderdesk 0.76.0 → 0.78.0
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/out/cli.js +124 -17
- package/out/renderer/assets/{AgentSettings-Dc8h1zSI.js → AgentSettings-mSGpRs0A.js} +1228 -4469
- package/out/renderer/assets/{InfoIcon-BuABw5oZ.js → InfoIcon-Dllba1sv.js} +1 -1
- package/out/renderer/assets/{Onboarding-lX23sGcW.js → Onboarding-D_AT4vxY.js} +4 -4
- package/out/renderer/assets/{ProviderHeader-s7JSikLR.js → ProviderHeader-DAchpkUt.js} +8 -20
- package/out/renderer/assets/{SettingsPage-CcsH6kmE.js → SettingsPage-DPaPSR-0.js} +5649 -299
- package/out/renderer/assets/{UsageDashboard-oAQNYvYh.js → UsageDashboard-CfP-txzz.js} +3 -3
- package/out/renderer/assets/abnfDiagram-N423BO3Z-tqPb0OUs.js +118 -0
- package/out/renderer/assets/{arc-BiaIwS79.js → arc-lUzj6CoE.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-3BPJPVTR-d7fu6X13.js → architectureDiagram-T3A2C74G-CuNUo8J6.js} +242 -133
- package/out/renderer/assets/{blockDiagram-GPEHLZMM-CWD8GVpw.js → blockDiagram-VBNYF7ZC-CIiOkZ_D.js} +76 -77
- package/out/renderer/assets/{c4Diagram-AAUBKEIU-b5nYOm14.js → c4Diagram-5PPSVZJV-DcgBNVnI.js} +2 -2
- package/out/renderer/assets/{channel-B99g0IUF.js → channel-PMBABQAa.js} +1 -1
- package/out/renderer/assets/{chunk-ND2GUHAM-BkVCmcvx.js → chunk-2GRJ4B5K-CJI-utiZ.js} +4 -4
- package/out/renderer/assets/{chunk-QZHKN3VN-DwLbWeqf.js → chunk-2Q5K7J3B-D8LOcAuY.js} +1 -1
- package/out/renderer/assets/{chunk-AQP2D5EJ-m8ArTZfD.js → chunk-5RXB4S5H-dp0xqMbI.js} +67 -32
- package/out/renderer/assets/{chunk-FMBD7UC4-yWO_9Kky.js → chunk-5VM5RSS4-D731WvT8.js} +1 -1
- package/out/renderer/assets/chunk-6Q2QTUOP-BjzdFhNB.js +860 -0
- package/out/renderer/assets/{chunk-727SXJPM-CVxcBF7D.js → chunk-GF5L2VYU-Ct3zh1DW.js} +18 -8
- package/out/renderer/assets/{chunk-4BX2VUAB-4Soxfj2i.js → chunk-JWPE2WC7-OPg0X7jU.js} +1 -1
- package/out/renderer/assets/{chunk-2J33WTMH-DmrXuNY-.js → chunk-KBJHAD2P-qbM4OnIO.js} +1 -1
- package/out/renderer/assets/{dagre-BM42HDAG-D_Val_ih.js → chunk-RYQCIY6F-DQI4Jds6.js} +85 -316
- package/out/renderer/assets/{chunk-55IACEB6-BtS727h4.js → chunk-XXDRQBXY-D_LC4QkV.js} +1 -1
- package/out/renderer/assets/{classDiagram-4FO5ZUOK-B3t9RWJZ.js → classDiagram-JCYQIIEL-D4e_9tkA.js} +6 -6
- package/out/renderer/assets/{classDiagram-v2-Q7XG4LA2-B3t9RWJZ.js → classDiagram-v2-OCEON4UE-D4e_9tkA.js} +6 -6
- package/out/renderer/assets/{cose-bilkent-S5V4N54A-W70GNPEp.js → cose-bilkent-JH36ORCC-tRlBuEjd.js} +2 -2
- package/out/renderer/assets/{wardley-L42UT6IY-Dnx4ZTc4.js → cynefin-VYW2F7L2-BiEI2vQb.js} +1527 -120
- package/out/renderer/assets/cynefinDiagram-MW4NZA55-DBSV1HcE.js +453 -0
- package/out/renderer/assets/{cytoscape.esm-BNSvh83I.js → cytoscape.esm-Bx_1tVW-.js} +160 -67
- package/out/renderer/assets/dagre-VZM6K2ZE-DRrMrSSw.js +522 -0
- package/out/renderer/assets/diagram-7IWD3JNH-CreTV9nH.js +488 -0
- package/out/renderer/assets/{diagram-KO2AKTUF-CGi0HZww.js → diagram-B4RE2ZJO-3tlgxoIb.js} +3 -3
- package/out/renderer/assets/{diagram-LMA3HP47-bdoVxL2p.js → diagram-LBJQPF4R-BFO2qTLJ.js} +3 -3
- package/out/renderer/assets/{diagram-OG6HWLK6-2K829auL.js → diagram-Q27KOJAE-BDgXUH9Q.js} +30 -24
- package/out/renderer/assets/{diagram-2AECGRRQ-Z7UeOtJN.js → diagram-UB23O5K3-Qw-ipaCG.js} +18 -8
- package/out/renderer/assets/ebnfDiagram-BXEA7PRR-izS1zYs0.js +138 -0
- package/out/renderer/assets/{erDiagram-TEJ5UH35-D4sO1GH8.js → erDiagram-JOGREHBK-ld9lNh2F.js} +88 -77
- package/out/renderer/assets/{flowDiagram-I6XJVG4X-DQNz4Jg_.js → flowDiagram-UKHOOZJN-g11KS_zg.js} +112 -96
- package/out/renderer/assets/{ganttDiagram-6RSMTGT7-B3dUFX1p.js → ganttDiagram-PKOTCBZU-CMsbJWqv.js} +31 -19
- package/out/renderer/assets/{gitGraphDiagram-PVQCEYII-B95Lrq_7.js → gitGraphDiagram-DS77QQ5N-CKiYKjBJ.js} +4 -4
- package/out/renderer/assets/{graph-7kCtdoo_.js → graph--1WSNErU.js} +10 -10
- package/out/renderer/assets/{index-58fbbmhI.js → index-BJGP-Ed0.js} +1 -1
- package/out/renderer/assets/{index-Bihcg0ql.js → index-BSQTFZZV.js} +1 -1
- package/out/renderer/assets/{index-GRVDmgjb.js → index-BSRjTKaQ.js} +1 -1
- package/out/renderer/assets/{index-CNgsMipO.js → index-BahRAP01.js} +7200 -3741
- package/out/renderer/assets/{index-BoogYopJ.js → index-BbYkC4ZX.js} +1 -1
- package/out/renderer/assets/{index-BHaWBJe9.js → index-BktqS5iT.js} +1 -1
- package/out/renderer/assets/{index-BnFS7uhp.js → index-DJfxm3SJ.js} +3 -3
- package/out/renderer/assets/{index-DcD881Q1.css → index-DVEVSdXO.css} +21 -0
- package/out/renderer/assets/{index-B2TL7Kll.js → index-DqZ8FyZG.js} +1 -1
- package/out/renderer/assets/{index-CRfveI6m.js → index-r15oFU5X.js} +1 -1
- package/out/renderer/assets/{index-pvhejocY.js → index-xC4jIIdf.js} +1 -1
- package/out/renderer/assets/{infoDiagram-5YYISTIA-C0OH2to7.js → infoDiagram-6WML65LV-CZoJK8b2.js} +3 -3
- package/out/renderer/assets/{ishikawaDiagram-YF4QCWOH-DsgR-cKp.js → ishikawaDiagram-WSZJBQD7-BrUuSNZ-.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-JHISSGLW-Bg6okgzG.js → journeyDiagram-NVQOT4AX-w91U6vB5.js} +4 -4
- package/out/renderer/assets/{jsx-dev-runtime-DLJNe6VM.js → jsx-dev-runtime-Bu2_G2cv.js} +1 -1
- package/out/renderer/assets/{kanban-definition-UN3LZRKU-1UvLCrWk.js → kanban-definition-27J2QSJJ-DVuGbAnS.js} +2 -2
- package/out/renderer/assets/{katex-Co8xHYNH.js → katex-oVG3DVWa.js} +4039 -4063
- package/out/renderer/assets/{layout-9w0fH2nL.js → layout-BA4uCGdL.js} +36 -320
- package/out/renderer/assets/{linear-WTE7GZY2.js → linear-CWQmShZV.js} +1 -1
- package/out/renderer/assets/map-DSwlVIuN.js +299 -0
- package/out/renderer/assets/{mindmap-definition-RKZ34NQL-BlxjYw-a.js → mindmap-definition-FAOFIHXS-CbswsknG.js} +3 -3
- package/out/renderer/assets/pegDiagram-VL7TDLO6-CCqeWB6l.js +126 -0
- package/out/renderer/assets/{pieDiagram-4H26LBE5-C4jZuzAH.js → pieDiagram-7S7Q4E2Y-Chd5qh8F.js} +89 -19
- package/out/renderer/assets/pierre-dark-BL-l9r39.js +4 -0
- package/out/renderer/assets/pierre-dark-protanopia-deuteranopia-BBjGuJQU.js +4 -0
- package/out/renderer/assets/pierre-dark-soft-B6TBhICr.js +4 -0
- package/out/renderer/assets/pierre-dark-tritanopia-f-j_EX9A.js +4 -0
- package/out/renderer/assets/pierre-dark-vibrant-yElMGqZN.js +4 -0
- package/out/renderer/assets/pierre-light-BUzWTcjO.js +4 -0
- package/out/renderer/assets/pierre-light-protanopia-deuteranopia-DlvVSCaI.js +4 -0
- package/out/renderer/assets/pierre-light-soft-CCMU-Zh0.js +4 -0
- package/out/renderer/assets/pierre-light-tritanopia-v4xacE1C.js +4 -0
- package/out/renderer/assets/pierre-light-vibrant-BRUbQnMc.js +4 -0
- package/out/renderer/assets/{quadrantDiagram-W4KKPZXB-BLG4PrcM.js → quadrantDiagram-CIZ2JOQS-CzmUVvXi.js} +8 -9
- package/out/renderer/assets/railroadDiagram-AXF67PYL-CXY83yzR.js +92 -0
- package/out/renderer/assets/{requirementDiagram-4Y6WPE33-CTTFFDvR.js → requirementDiagram-LRYGKXZP-DToxgkKr.js} +3 -3
- package/out/renderer/assets/{sankeyDiagram-5OEKKPKP-CjDlOfXf.js → sankeyDiagram-W5VNT64P-CRs67mfK.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-3UESZ5HK-6PJo_0SQ.js → sequenceDiagram-SI44F4Z6-CzmgqSt2.js} +11 -11
- package/out/renderer/assets/sizeCapture-X5ZJPWSS-mheyKWG9.js +62 -0
- package/out/renderer/assets/{stateDiagram-AJRCARHV-Cnhm9mmx.js → stateDiagram-OKZ733FA-DGyuxXU_.js} +8 -6
- package/out/renderer/assets/{stateDiagram-v2-BHNVJYJU-BxKTEg-3.js → stateDiagram-v2-UEYNNEHI-TldVLbtJ.js} +5 -4
- package/out/renderer/assets/swimlanes-SLNWSIFB-B3lFy2HE.js +8557 -0
- package/out/renderer/assets/swimlanesDiagram-ULZ7WXOC-BxN-HDA3.js +20 -0
- package/out/renderer/assets/{time-YGhgEMYh.js → time-DcFzC-ob.js} +1 -1
- package/out/renderer/assets/{timeline-definition-PNZ67QCA-ooi5Tti4.js → timeline-definition-Z64GVDOM-DQ7vCcJR.js} +2 -2
- package/out/renderer/assets/{vennDiagram-CIIHVFJN-B_kwCHhU.js → vennDiagram-T6HMQDX7-MrgLWWY3.js} +32 -3
- package/out/renderer/assets/{wardleyDiagram-YWT4CUSO-cqZcXF7R.js → wardleyDiagram-T6FBY63Y-BCA6xyJ2.js} +3 -3
- package/out/renderer/assets/{worker-BdXuKH1Q.js → worker-CdcPcIJG.js} +322 -102
- package/out/renderer/assets/{xychartDiagram-2RQKCTM6-BBUpFNY4.js → xychartDiagram-ELKLHX3M-BZmPte5b.js} +125 -57
- package/out/renderer/index.html +2 -2
- package/out/renderer/sw.js +4 -0
- package/out/resources/connector/connector.py +3 -1
- package/out/resources/prompts/init-project.hbs +16 -42
- package/out/resources/prompts/system-prompt.hbs +25 -60
- package/out/resources/prompts/workflow.hbs +17 -52
- package/out/resources/skills/extension-creator/SKILL.md +1 -0
- package/out/resources/skills/extension-creator/references/event-types.md +13 -1
- package/out/resources/skills/extension-creator/references/extension-interface.md +3 -0
- package/out/runner.js +5735 -3379
- package/package.json +5 -4
- package/out/renderer/assets/diagram-5GNKFQAL-DY9Yifty.js +0 -169
- package/out/renderer/assets/pierre-dark-C-Drv5KU.js +0 -4
- package/out/renderer/assets/pierre-dark-soft-Cd74uQaL.js +0 -4
- package/out/renderer/assets/pierre-light-CfQnmt6J.js +0 -4
- package/out/renderer/assets/pierre-light-soft-DMVdU74b.js +0 -4
|
@@ -10273,7 +10273,7 @@ class JavaScriptScanner {
|
|
|
10273
10273
|
this.options = options;
|
|
10274
10274
|
const {
|
|
10275
10275
|
forgiving = false,
|
|
10276
|
-
cache,
|
|
10276
|
+
cache: cache2,
|
|
10277
10277
|
regexConstructor
|
|
10278
10278
|
} = options;
|
|
10279
10279
|
if (!regexConstructor) {
|
|
@@ -10283,7 +10283,7 @@ class JavaScriptScanner {
|
|
|
10283
10283
|
if (typeof p2 !== "string") {
|
|
10284
10284
|
return p2;
|
|
10285
10285
|
}
|
|
10286
|
-
const cached =
|
|
10286
|
+
const cached = cache2?.get(p2);
|
|
10287
10287
|
if (cached) {
|
|
10288
10288
|
if (cached instanceof RegExp) {
|
|
10289
10289
|
return cached;
|
|
@@ -10294,10 +10294,10 @@ class JavaScriptScanner {
|
|
|
10294
10294
|
}
|
|
10295
10295
|
try {
|
|
10296
10296
|
const regex = regexConstructor(p2);
|
|
10297
|
-
|
|
10297
|
+
cache2?.set(p2, regex);
|
|
10298
10298
|
return regex;
|
|
10299
10299
|
} catch (e) {
|
|
10300
|
-
|
|
10300
|
+
cache2?.set(p2, e);
|
|
10301
10301
|
if (forgiving)
|
|
10302
10302
|
return null;
|
|
10303
10303
|
throw e;
|
|
@@ -10839,6 +10839,118 @@ async function createOnigurumaEngine(options) {
|
|
|
10839
10839
|
}
|
|
10840
10840
|
};
|
|
10841
10841
|
}
|
|
10842
|
+
function unwrapDefault(value) {
|
|
10843
|
+
return value !== null && typeof value === "object" && "default" in value ? value.default : value;
|
|
10844
|
+
}
|
|
10845
|
+
var DuplicateThemeError = class extends Error {
|
|
10846
|
+
constructor(name) {
|
|
10847
|
+
super(`Theme "${name}" is already registered`);
|
|
10848
|
+
this.name = "DuplicateThemeError";
|
|
10849
|
+
}
|
|
10850
|
+
};
|
|
10851
|
+
var UnregisteredThemeError = class extends Error {
|
|
10852
|
+
constructor(name) {
|
|
10853
|
+
super(`No loader registered for theme "${name}"`);
|
|
10854
|
+
this.name = "UnregisteredThemeError";
|
|
10855
|
+
}
|
|
10856
|
+
};
|
|
10857
|
+
var UnresolvedThemeError = class extends Error {
|
|
10858
|
+
constructor(name) {
|
|
10859
|
+
super(`Theme "${name}" has not been resolved`);
|
|
10860
|
+
this.name = "UnresolvedThemeError";
|
|
10861
|
+
}
|
|
10862
|
+
};
|
|
10863
|
+
function createThemeResolver() {
|
|
10864
|
+
const loaders = /* @__PURE__ */ new Map();
|
|
10865
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
10866
|
+
const inflight = /* @__PURE__ */ new Map();
|
|
10867
|
+
let cacheGeneration = 0;
|
|
10868
|
+
function registerTheme(name, loader) {
|
|
10869
|
+
if (loaders.has(name)) throw new DuplicateThemeError(name);
|
|
10870
|
+
loaders.set(name, loader);
|
|
10871
|
+
}
|
|
10872
|
+
function registerThemeIfAbsent(name, loader) {
|
|
10873
|
+
if (loaders.has(name)) return false;
|
|
10874
|
+
loaders.set(name, loader);
|
|
10875
|
+
return true;
|
|
10876
|
+
}
|
|
10877
|
+
function hasRegisteredTheme(name) {
|
|
10878
|
+
return loaders.has(name);
|
|
10879
|
+
}
|
|
10880
|
+
function resolveTheme(name) {
|
|
10881
|
+
const cached = resolved.get(name);
|
|
10882
|
+
if (cached !== void 0) return Promise.resolve(cached);
|
|
10883
|
+
const existing = inflight.get(name);
|
|
10884
|
+
if (existing !== void 0) return existing;
|
|
10885
|
+
const loader = loaders.get(name);
|
|
10886
|
+
if (loader === void 0) return Promise.reject(new UnregisteredThemeError(name));
|
|
10887
|
+
const generation = cacheGeneration;
|
|
10888
|
+
const promise = loader().then((result) => {
|
|
10889
|
+
const theme = unwrapDefault(result);
|
|
10890
|
+
if (generation === cacheGeneration) resolved.set(name, theme);
|
|
10891
|
+
if (inflight.get(name) === promise) inflight.delete(name);
|
|
10892
|
+
return theme;
|
|
10893
|
+
}).catch((err) => {
|
|
10894
|
+
if (inflight.get(name) === promise) inflight.delete(name);
|
|
10895
|
+
throw err;
|
|
10896
|
+
});
|
|
10897
|
+
inflight.set(name, promise);
|
|
10898
|
+
return promise;
|
|
10899
|
+
}
|
|
10900
|
+
function resolveThemes2(names) {
|
|
10901
|
+
return Promise.all(names.map((name) => resolveTheme(name)));
|
|
10902
|
+
}
|
|
10903
|
+
function seedResolvedTheme(name, theme) {
|
|
10904
|
+
resolved.set(name, theme);
|
|
10905
|
+
}
|
|
10906
|
+
function seedResolvedThemes(entries) {
|
|
10907
|
+
for (const [name, theme] of entries) seedResolvedTheme(name, theme);
|
|
10908
|
+
}
|
|
10909
|
+
function getResolvedTheme(name) {
|
|
10910
|
+
return resolved.get(name);
|
|
10911
|
+
}
|
|
10912
|
+
function getResolvedThemes(names) {
|
|
10913
|
+
const themes = [];
|
|
10914
|
+
for (const name of names) {
|
|
10915
|
+
const theme = resolved.get(name);
|
|
10916
|
+
if (theme === void 0) throw new UnresolvedThemeError(name);
|
|
10917
|
+
themes.push(theme);
|
|
10918
|
+
}
|
|
10919
|
+
return themes;
|
|
10920
|
+
}
|
|
10921
|
+
function hasResolvedTheme(name) {
|
|
10922
|
+
return resolved.has(name);
|
|
10923
|
+
}
|
|
10924
|
+
function hasResolvedThemes(names) {
|
|
10925
|
+
for (const name of names) if (!resolved.has(name)) return false;
|
|
10926
|
+
return true;
|
|
10927
|
+
}
|
|
10928
|
+
function getResolvedOrResolveTheme(name) {
|
|
10929
|
+
const cached = resolved.get(name);
|
|
10930
|
+
if (cached !== void 0) return cached;
|
|
10931
|
+
return resolveTheme(name);
|
|
10932
|
+
}
|
|
10933
|
+
function clearResolvedThemes() {
|
|
10934
|
+
cacheGeneration++;
|
|
10935
|
+
resolved.clear();
|
|
10936
|
+
inflight.clear();
|
|
10937
|
+
}
|
|
10938
|
+
return {
|
|
10939
|
+
clearResolvedThemes,
|
|
10940
|
+
getResolvedOrResolveTheme,
|
|
10941
|
+
getResolvedTheme,
|
|
10942
|
+
getResolvedThemes,
|
|
10943
|
+
hasRegisteredTheme,
|
|
10944
|
+
hasResolvedTheme,
|
|
10945
|
+
hasResolvedThemes,
|
|
10946
|
+
registerTheme,
|
|
10947
|
+
registerThemeIfAbsent,
|
|
10948
|
+
resolveTheme,
|
|
10949
|
+
resolveThemes: resolveThemes2,
|
|
10950
|
+
seedResolvedTheme,
|
|
10951
|
+
seedResolvedThemes
|
|
10952
|
+
};
|
|
10953
|
+
}
|
|
10842
10954
|
class Diff {
|
|
10843
10955
|
diff(oldStr, newStr, options = {}) {
|
|
10844
10956
|
let callback;
|
|
@@ -11131,6 +11243,108 @@ function cyrb53(str, seed = 0) {
|
|
|
11131
11243
|
h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
11132
11244
|
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(36).slice(0, 6);
|
|
11133
11245
|
}
|
|
11246
|
+
const HEX_TRANSPARENT_RE = /^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i;
|
|
11247
|
+
const ALPHA_ZERO_RE = /^0(?:\.0+)?%?$/;
|
|
11248
|
+
function getFunctionalAlpha(color) {
|
|
11249
|
+
const openParen = color.indexOf("(");
|
|
11250
|
+
if (openParen <= 0 || !color.endsWith(")")) return;
|
|
11251
|
+
const fn = color.slice(0, openParen).trim();
|
|
11252
|
+
if (!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(fn)) return;
|
|
11253
|
+
const inner = color.slice(openParen + 1, -1).trim();
|
|
11254
|
+
if (inner.length === 0) return;
|
|
11255
|
+
const slashIndex = inner.lastIndexOf("/");
|
|
11256
|
+
if (slashIndex !== -1) return inner.slice(slashIndex + 1).trim();
|
|
11257
|
+
if (/^(?:rgba|hsla)$/i.test(fn)) {
|
|
11258
|
+
const parts = inner.split(",");
|
|
11259
|
+
if (parts.length === 4) return parts[3]?.trim();
|
|
11260
|
+
}
|
|
11261
|
+
}
|
|
11262
|
+
function parseHexRgba(color) {
|
|
11263
|
+
const match = /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(color.trim());
|
|
11264
|
+
if (match == null) return null;
|
|
11265
|
+
const hex = match[1];
|
|
11266
|
+
let expanded;
|
|
11267
|
+
let alpha = 1;
|
|
11268
|
+
if (hex.length === 3) expanded = hex.split("").map((c) => c + c).join("");
|
|
11269
|
+
else if (hex.length === 6) expanded = hex;
|
|
11270
|
+
else {
|
|
11271
|
+
expanded = hex.slice(0, 6);
|
|
11272
|
+
alpha = parseInt(hex.slice(6, 8), 16) / 255;
|
|
11273
|
+
}
|
|
11274
|
+
return [
|
|
11275
|
+
parseInt(expanded.slice(0, 2), 16),
|
|
11276
|
+
parseInt(expanded.slice(2, 4), 16),
|
|
11277
|
+
parseInt(expanded.slice(4, 6), 16),
|
|
11278
|
+
alpha
|
|
11279
|
+
];
|
|
11280
|
+
}
|
|
11281
|
+
function relativeLuminance(color) {
|
|
11282
|
+
if (color == null) return null;
|
|
11283
|
+
const rgba = parseHexRgba(color);
|
|
11284
|
+
if (rgba == null) return null;
|
|
11285
|
+
const r2 = rgba[0] / 255;
|
|
11286
|
+
const g = rgba[1] / 255;
|
|
11287
|
+
const b2 = rgba[2] / 255;
|
|
11288
|
+
const channel = (v2) => v2 <= 0.03928 ? v2 / 12.92 : ((v2 + 0.055) / 1.055) ** 2.4;
|
|
11289
|
+
return 0.2126 * channel(r2) + 0.7152 * channel(g) + 0.0722 * channel(b2);
|
|
11290
|
+
}
|
|
11291
|
+
function isFullyTransparent(color) {
|
|
11292
|
+
if (color == null) return false;
|
|
11293
|
+
const normalized = color.trim().toLowerCase();
|
|
11294
|
+
if (normalized === "transparent") return true;
|
|
11295
|
+
if (HEX_TRANSPARENT_RE.test(normalized)) return true;
|
|
11296
|
+
const alpha = getFunctionalAlpha(normalized);
|
|
11297
|
+
return alpha != null && ALPHA_ZERO_RE.test(alpha);
|
|
11298
|
+
}
|
|
11299
|
+
function hoverWouldEraseText(hover, bg, fg) {
|
|
11300
|
+
if (bg == null || fg == null) return false;
|
|
11301
|
+
const hoverL = relativeLuminance(hover);
|
|
11302
|
+
const bgL = relativeLuminance(bg);
|
|
11303
|
+
const fgL = relativeLuminance(fg);
|
|
11304
|
+
if (hoverL == null || bgL == null || fgL == null) return false;
|
|
11305
|
+
return Math.abs(hoverL - fgL) < Math.abs(hoverL - bgL);
|
|
11306
|
+
}
|
|
11307
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
11308
|
+
function normalizeThemeColors(theme) {
|
|
11309
|
+
const cached = cache.get(theme);
|
|
11310
|
+
if (cached != null) return cached;
|
|
11311
|
+
const originalColors = theme.colors ?? {};
|
|
11312
|
+
const colors = { ...originalColors };
|
|
11313
|
+
const editorBackground = originalColors["editor.background"] ?? theme.bg;
|
|
11314
|
+
const editorForeground = originalColors["editor.foreground"] ?? theme.fg;
|
|
11315
|
+
const sidebarBackground = originalColors["sideBar.background"] ?? editorBackground;
|
|
11316
|
+
const sidebarForeground = originalColors["sideBar.foreground"] ?? editorForeground;
|
|
11317
|
+
fill(colors, "editor.background", editorBackground);
|
|
11318
|
+
fill(colors, "editor.foreground", editorForeground);
|
|
11319
|
+
fill(colors, "sideBar.background", sidebarBackground);
|
|
11320
|
+
fill(colors, "sideBar.foreground", sidebarForeground);
|
|
11321
|
+
fill(colors, "input.background", originalColors["input.background"] ?? sidebarBackground);
|
|
11322
|
+
fill(colors, "sideBarSectionHeader.foreground", originalColors["sideBarSectionHeader.foreground"] ?? sidebarForeground);
|
|
11323
|
+
fill(colors, "list.activeSelectionForeground", originalColors["list.activeSelectionForeground"] ?? sidebarForeground);
|
|
11324
|
+
fill(colors, "gitDecoration.addedResourceForeground", firstColor(originalColors["gitDecoration.addedResourceForeground"], originalColors["terminal.ansiGreen"], originalColors["editorGutter.addedBackground"]));
|
|
11325
|
+
fill(colors, "gitDecoration.modifiedResourceForeground", firstColor(originalColors["gitDecoration.modifiedResourceForeground"], originalColors["terminal.ansiBlue"], originalColors["editorGutter.modifiedBackground"]));
|
|
11326
|
+
fill(colors, "gitDecoration.deletedResourceForeground", firstColor(originalColors["gitDecoration.deletedResourceForeground"], originalColors["terminal.ansiRed"], originalColors["editorGutter.deletedBackground"]));
|
|
11327
|
+
const focusRing = (isFullyTransparent(originalColors["list.focusOutline"]) ? void 0 : originalColors["list.focusOutline"]) ?? (isFullyTransparent(originalColors["focusBorder"]) ? void 0 : originalColors["focusBorder"]);
|
|
11328
|
+
if (focusRing != null) colors["list.focusOutline"] = focusRing;
|
|
11329
|
+
else delete colors["list.focusOutline"];
|
|
11330
|
+
const hover = originalColors["list.hoverBackground"];
|
|
11331
|
+
if (hover != null && (matchesSurface(hover, sidebarBackground) || hoverWouldEraseText(hover, sidebarBackground, sidebarForeground))) delete colors["list.hoverBackground"];
|
|
11332
|
+
const result = Object.freeze({
|
|
11333
|
+
...theme,
|
|
11334
|
+
colors: Object.freeze(colors)
|
|
11335
|
+
});
|
|
11336
|
+
cache.set(theme, result);
|
|
11337
|
+
return result;
|
|
11338
|
+
}
|
|
11339
|
+
function fill(colors, key2, value) {
|
|
11340
|
+
if (value != null && value !== "") colors[key2] = value;
|
|
11341
|
+
}
|
|
11342
|
+
function firstColor(...candidates) {
|
|
11343
|
+
for (const candidate of candidates) if (candidate != null && candidate !== "") return candidate;
|
|
11344
|
+
}
|
|
11345
|
+
function matchesSurface(color, surface) {
|
|
11346
|
+
return surface != null && color.toLowerCase() === surface.toLowerCase();
|
|
11347
|
+
}
|
|
11134
11348
|
(() => {
|
|
11135
11349
|
try {
|
|
11136
11350
|
return false;
|
|
@@ -11143,10 +11357,9 @@ const DEFAULT_THEMES = {
|
|
|
11143
11357
|
dark: "pierre-dark",
|
|
11144
11358
|
light: "pierre-light"
|
|
11145
11359
|
};
|
|
11146
|
-
const DEFAULT_COLLAPSED_CONTEXT_THRESHOLD = 1;
|
|
11147
11360
|
const ResolvedLanguages = /* @__PURE__ */ new Map();
|
|
11148
11361
|
const AttachedLanguages = /* @__PURE__ */ new Set();
|
|
11149
|
-
function attachResolvedLanguages(resolvedLanguages,
|
|
11362
|
+
function attachResolvedLanguages(resolvedLanguages, highlighter2) {
|
|
11150
11363
|
resolvedLanguages = Array.isArray(resolvedLanguages) ? resolvedLanguages : [resolvedLanguages];
|
|
11151
11364
|
for (const resolvedLang of resolvedLanguages) {
|
|
11152
11365
|
if (AttachedLanguages.has(resolvedLang.name)) continue;
|
|
@@ -11156,26 +11369,26 @@ function attachResolvedLanguages(resolvedLanguages, highlighter$1) {
|
|
|
11156
11369
|
ResolvedLanguages.set(resolvedLang.name, lang);
|
|
11157
11370
|
}
|
|
11158
11371
|
AttachedLanguages.add(lang.name);
|
|
11159
|
-
|
|
11372
|
+
highlighter2.loadLanguageSync(lang.data);
|
|
11160
11373
|
}
|
|
11161
11374
|
}
|
|
11162
|
-
const ResolvedThemes = /* @__PURE__ */ new Map();
|
|
11163
11375
|
const AttachedThemes = /* @__PURE__ */ new Set();
|
|
11164
|
-
|
|
11376
|
+
const themeResolver = createThemeResolver();
|
|
11377
|
+
function attachResolvedThemes(themes, highlighter2) {
|
|
11165
11378
|
themes = Array.isArray(themes) ? themes : [themes];
|
|
11166
11379
|
for (let themeRef of themes) {
|
|
11167
11380
|
let resolvedTheme;
|
|
11168
11381
|
if (typeof themeRef === "string") {
|
|
11169
|
-
resolvedTheme =
|
|
11382
|
+
resolvedTheme = themeResolver.getResolvedTheme(themeRef);
|
|
11170
11383
|
if (resolvedTheme == null) throw new Error(`loadResolvedThemes: ${themeRef} is not resolved, you must resolve it before calling loadResolvedThemes`);
|
|
11171
11384
|
} else {
|
|
11172
11385
|
resolvedTheme = themeRef;
|
|
11173
11386
|
themeRef = themeRef.name;
|
|
11174
|
-
if (
|
|
11387
|
+
if (themeResolver.getResolvedTheme(themeRef) == null) themeResolver.seedResolvedTheme(themeRef, resolvedTheme);
|
|
11175
11388
|
}
|
|
11176
11389
|
if (AttachedThemes.has(themeRef)) continue;
|
|
11177
11390
|
AttachedThemes.add(themeRef);
|
|
11178
|
-
|
|
11391
|
+
highlighter2.loadThemeSync(resolvedTheme);
|
|
11179
11392
|
}
|
|
11180
11393
|
}
|
|
11181
11394
|
const CUSTOM_EXTENSION_TO_FILE_FORMAT = /* @__PURE__ */ new Map();
|
|
@@ -11740,28 +11953,31 @@ const tokenStyleNormalizer = {
|
|
|
11740
11953
|
function formatCSSVariablePrefix(type) {
|
|
11741
11954
|
return `--${type === "token" ? "diffs-token" : "diffs"}-`;
|
|
11742
11955
|
}
|
|
11743
|
-
function getHighlighterThemeStyles({ theme = DEFAULT_THEMES, highlighter:
|
|
11956
|
+
function getHighlighterThemeStyles({ theme = DEFAULT_THEMES, highlighter: highlighter2, prefix }) {
|
|
11744
11957
|
let styles = "";
|
|
11745
11958
|
if (typeof theme === "string") {
|
|
11746
|
-
const themeData =
|
|
11747
|
-
|
|
11748
|
-
styles += `
|
|
11749
|
-
styles +=
|
|
11750
|
-
styles += `${formatCSSVariablePrefix("global")}
|
|
11751
|
-
styles +=
|
|
11959
|
+
const themeData = highlighter2.getTheme(theme);
|
|
11960
|
+
const normalized = normalizeThemeColors(themeData);
|
|
11961
|
+
styles += `color:${normalized.fg};`;
|
|
11962
|
+
styles += `background-color:${normalized.bg};`;
|
|
11963
|
+
styles += `${formatCSSVariablePrefix("global")}fg:${normalized.fg};`;
|
|
11964
|
+
styles += `${formatCSSVariablePrefix("global")}bg:${normalized.bg};`;
|
|
11965
|
+
styles += getGitVariables(themeData, prefix);
|
|
11752
11966
|
} else {
|
|
11753
|
-
let themeData =
|
|
11754
|
-
|
|
11755
|
-
styles += `${formatCSSVariablePrefix("global")}dark
|
|
11756
|
-
styles +=
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
styles +=
|
|
11967
|
+
let themeData = highlighter2.getTheme(theme.dark);
|
|
11968
|
+
let normalized = normalizeThemeColors(themeData);
|
|
11969
|
+
styles += `${formatCSSVariablePrefix("global")}dark:${normalized.fg};`;
|
|
11970
|
+
styles += `${formatCSSVariablePrefix("global")}dark-bg:${normalized.bg};`;
|
|
11971
|
+
styles += getGitVariables(themeData, "dark");
|
|
11972
|
+
themeData = highlighter2.getTheme(theme.light);
|
|
11973
|
+
normalized = normalizeThemeColors(themeData);
|
|
11974
|
+
styles += `${formatCSSVariablePrefix("global")}light:${normalized.fg};`;
|
|
11975
|
+
styles += `${formatCSSVariablePrefix("global")}light-bg:${normalized.bg};`;
|
|
11976
|
+
styles += getGitVariables(themeData, "light");
|
|
11761
11977
|
}
|
|
11762
11978
|
return styles;
|
|
11763
11979
|
}
|
|
11764
|
-
function
|
|
11980
|
+
function getGitVariables(themeData, modePrefix) {
|
|
11765
11981
|
modePrefix = modePrefix != null ? `${modePrefix}-` : "";
|
|
11766
11982
|
let styles = "";
|
|
11767
11983
|
const additionGreen = themeData.colors?.["gitDecoration.addedResourceForeground"] ?? themeData.colors?.["terminal.ansiGreen"];
|
|
@@ -11844,7 +12060,7 @@ function getTrailingExpandedRegion({ fileDiff, hunkIndex, expandedHunks, collaps
|
|
|
11844
12060
|
renderAll: fromStart >= trailingRangeSize
|
|
11845
12061
|
};
|
|
11846
12062
|
}
|
|
11847
|
-
function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infinity, expandedHunks, collapsedContextThreshold =
|
|
12063
|
+
function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infinity, expandedHunks, collapsedContextThreshold = 1, callback }) {
|
|
11848
12064
|
const iterationStart = getIterationStartState({
|
|
11849
12065
|
diff,
|
|
11850
12066
|
diffStyle,
|
|
@@ -11893,9 +12109,9 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
11893
12109
|
}
|
|
11894
12110
|
};
|
|
11895
12111
|
hunkIterator: for (let hunkIndex = iterationStart.hunkIndex; hunkIndex < diff.hunks.length; hunkIndex++) {
|
|
11896
|
-
let getTrailingCollapsedAfter = function(
|
|
12112
|
+
let getTrailingCollapsedAfter = function(unifiedLineIndex2, splitLineIndex2) {
|
|
11897
12113
|
if (trailingRegion == null || trailingRegion.collapsedLines <= 0 || trailingRegion.fromStart + trailingRegion.fromEnd > 0) return 0;
|
|
11898
|
-
return
|
|
12114
|
+
return splitLineIndex2 === hunk.splitLineStart + hunk.splitLineCount - 1 ? trailingRegion.collapsedLines : 0;
|
|
11899
12115
|
}, consumePendingCollapsed = function() {
|
|
11900
12116
|
if (consumedCollapsed) return 0;
|
|
11901
12117
|
consumedCollapsed = true;
|
|
@@ -11921,12 +12137,12 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
11921
12137
|
const expandedLineCount = leadingRegion.fromStart + leadingRegion.fromEnd;
|
|
11922
12138
|
let consumedCollapsed = leadingRegion.collapsedLines === 0;
|
|
11923
12139
|
if (!state.shouldSkip(expandedLineCount, expandedLineCount)) {
|
|
11924
|
-
let
|
|
11925
|
-
let
|
|
11926
|
-
let
|
|
11927
|
-
let
|
|
11928
|
-
let
|
|
11929
|
-
let
|
|
12140
|
+
let unifiedLineIndex2 = hunk.unifiedLineStart - leadingRegion.rangeSize;
|
|
12141
|
+
let splitLineIndex2 = hunk.splitLineStart - leadingRegion.rangeSize;
|
|
12142
|
+
let deletionLineIndex2 = hunk.deletionLineIndex - leadingRegion.rangeSize;
|
|
12143
|
+
let additionLineIndex2 = hunk.additionLineIndex - leadingRegion.rangeSize;
|
|
12144
|
+
let deletionLineNumber2 = hunk.deletionStart - leadingRegion.rangeSize;
|
|
12145
|
+
let additionLineNumber2 = hunk.additionStart - leadingRegion.rangeSize;
|
|
11930
12146
|
if (walkContextLines(state, leadingRegion.fromStart, diffStyle, (index) => {
|
|
11931
12147
|
return state.emit({
|
|
11932
12148
|
hunkIndex,
|
|
@@ -11935,27 +12151,27 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
11935
12151
|
collapsedAfter: 0,
|
|
11936
12152
|
type: "context-expanded",
|
|
11937
12153
|
deletionLine: {
|
|
11938
|
-
lineNumber:
|
|
11939
|
-
lineIndex:
|
|
12154
|
+
lineNumber: deletionLineNumber2 + index,
|
|
12155
|
+
lineIndex: deletionLineIndex2 + index,
|
|
11940
12156
|
noEOFCR: false,
|
|
11941
|
-
unifiedLineIndex:
|
|
11942
|
-
splitLineIndex:
|
|
12157
|
+
unifiedLineIndex: unifiedLineIndex2 + index,
|
|
12158
|
+
splitLineIndex: splitLineIndex2 + index
|
|
11943
12159
|
},
|
|
11944
12160
|
additionLine: {
|
|
11945
|
-
unifiedLineIndex:
|
|
11946
|
-
splitLineIndex:
|
|
11947
|
-
lineIndex:
|
|
11948
|
-
lineNumber:
|
|
12161
|
+
unifiedLineIndex: unifiedLineIndex2 + index,
|
|
12162
|
+
splitLineIndex: splitLineIndex2 + index,
|
|
12163
|
+
lineIndex: additionLineIndex2 + index,
|
|
12164
|
+
lineNumber: additionLineNumber2 + index,
|
|
11949
12165
|
noEOFCR: false
|
|
11950
12166
|
}
|
|
11951
12167
|
});
|
|
11952
12168
|
})) break hunkIterator;
|
|
11953
|
-
|
|
11954
|
-
|
|
11955
|
-
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
|
|
12169
|
+
unifiedLineIndex2 = hunk.unifiedLineStart - leadingRegion.fromEnd;
|
|
12170
|
+
splitLineIndex2 = hunk.splitLineStart - leadingRegion.fromEnd;
|
|
12171
|
+
deletionLineIndex2 = hunk.deletionLineIndex - leadingRegion.fromEnd;
|
|
12172
|
+
additionLineIndex2 = hunk.additionLineIndex - leadingRegion.fromEnd;
|
|
12173
|
+
deletionLineNumber2 = hunk.deletionStart - leadingRegion.fromEnd;
|
|
12174
|
+
additionLineNumber2 = hunk.additionStart - leadingRegion.fromEnd;
|
|
11959
12175
|
if (walkContextLines(state, leadingRegion.fromEnd, diffStyle, (index) => {
|
|
11960
12176
|
return state.emit({
|
|
11961
12177
|
hunkIndex,
|
|
@@ -11964,17 +12180,17 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
11964
12180
|
collapsedAfter: 0,
|
|
11965
12181
|
type: "context-expanded",
|
|
11966
12182
|
deletionLine: {
|
|
11967
|
-
lineNumber:
|
|
11968
|
-
lineIndex:
|
|
12183
|
+
lineNumber: deletionLineNumber2 + index,
|
|
12184
|
+
lineIndex: deletionLineIndex2 + index,
|
|
11969
12185
|
noEOFCR: false,
|
|
11970
|
-
unifiedLineIndex:
|
|
11971
|
-
splitLineIndex:
|
|
12186
|
+
unifiedLineIndex: unifiedLineIndex2 + index,
|
|
12187
|
+
splitLineIndex: splitLineIndex2 + index
|
|
11972
12188
|
},
|
|
11973
12189
|
additionLine: {
|
|
11974
|
-
unifiedLineIndex:
|
|
11975
|
-
splitLineIndex:
|
|
11976
|
-
lineIndex:
|
|
11977
|
-
lineNumber:
|
|
12190
|
+
unifiedLineIndex: unifiedLineIndex2 + index,
|
|
12191
|
+
splitLineIndex: splitLineIndex2 + index,
|
|
12192
|
+
lineIndex: additionLineIndex2 + index,
|
|
12193
|
+
lineNumber: additionLineNumber2 + index,
|
|
11978
12194
|
noEOFCR: false
|
|
11979
12195
|
}
|
|
11980
12196
|
});
|
|
@@ -12114,9 +12330,9 @@ function getContextLineIterationBounds(state, count, diffStyle) {
|
|
|
12114
12330
|
if (!state.isWindowedHighlight || count <= 0) return [0, count];
|
|
12115
12331
|
const ranges = [];
|
|
12116
12332
|
function pushRange(currentCount) {
|
|
12117
|
-
const
|
|
12118
|
-
const
|
|
12119
|
-
if (
|
|
12333
|
+
const start2 = Math.max(0, state.viewportStart - currentCount);
|
|
12334
|
+
const end2 = Math.min(count, state.viewportEnd - currentCount);
|
|
12335
|
+
if (end2 > start2) ranges.push([start2, end2]);
|
|
12120
12336
|
}
|
|
12121
12337
|
pushRange(state.unifiedCount);
|
|
12122
12338
|
pushRange(state.splitCount);
|
|
@@ -12266,7 +12482,7 @@ function pushOrJoinSpan({ item, arr, enableJoin, isNeutral = false, isLastItem =
|
|
|
12266
12482
|
arr.push([isNeutral ? 0 : 1, item.value]);
|
|
12267
12483
|
}
|
|
12268
12484
|
const DEFAULT_PLAIN_TEXT_OPTIONS$1 = { forcePlainText: false };
|
|
12269
|
-
function renderDiffWithHighlighter(diff,
|
|
12485
|
+
function renderDiffWithHighlighter(diff, highlighter2, options, { forcePlainText, startingLine, totalLines, expandedHunks, collapsedContextThreshold = 1 } = DEFAULT_PLAIN_TEXT_OPTIONS$1) {
|
|
12270
12486
|
if (forcePlainText) {
|
|
12271
12487
|
startingLine ??= 0;
|
|
12272
12488
|
totalLines ??= Infinity;
|
|
@@ -12275,10 +12491,10 @@ function renderDiffWithHighlighter(diff, highlighter$1, options, { forcePlainTex
|
|
|
12275
12491
|
totalLines = Infinity;
|
|
12276
12492
|
}
|
|
12277
12493
|
const isWindowedHighlight = startingLine > 0 || totalLines < Infinity;
|
|
12278
|
-
const baseThemeType = typeof options.theme === "string" ?
|
|
12494
|
+
const baseThemeType = typeof options.theme === "string" ? highlighter2.getTheme(options.theme).type : void 0;
|
|
12279
12495
|
const themeStyles = getHighlighterThemeStyles({
|
|
12280
12496
|
theme: options.theme,
|
|
12281
|
-
highlighter:
|
|
12497
|
+
highlighter: highlighter2
|
|
12282
12498
|
});
|
|
12283
12499
|
const lineDiffType = forcePlainText && !isWindowedHighlight && (diff.unifiedLineCount > 1e3 || diff.splitLineCount > 1e3) ? "none" : options.lineDiffType;
|
|
12284
12500
|
const code = {
|
|
@@ -12367,7 +12583,7 @@ function renderDiffWithHighlighter(diff, highlighter$1, options, { forcePlainTex
|
|
|
12367
12583
|
additionFile,
|
|
12368
12584
|
additionInfo: bucket.additionInfo,
|
|
12369
12585
|
additionDecorations: bucket.additionDecorations,
|
|
12370
|
-
highlighter:
|
|
12586
|
+
highlighter: highlighter2,
|
|
12371
12587
|
options,
|
|
12372
12588
|
languageOverride: forcePlainText ? "text" : diff.lang
|
|
12373
12589
|
});
|
|
@@ -12472,7 +12688,7 @@ function createBucket() {
|
|
|
12472
12688
|
additionSegments: []
|
|
12473
12689
|
};
|
|
12474
12690
|
}
|
|
12475
|
-
function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo, highlighter:
|
|
12691
|
+
function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo, highlighter: highlighter2, deletionDecorations, additionDecorations, languageOverride, options: { theme: themeOrThemes = DEFAULT_THEMES, ...options } }) {
|
|
12476
12692
|
const deletionLang = languageOverride ?? getFiletypeFromFileName(deletionFile.name);
|
|
12477
12693
|
const additionLang = languageOverride ?? getFiletypeFromFileName(additionFile.name);
|
|
12478
12694
|
const { state, transformers } = createTransformerWithState(options.useTokenTransformer);
|
|
@@ -12484,7 +12700,8 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
|
|
|
12484
12700
|
transformers,
|
|
12485
12701
|
decorations: void 0,
|
|
12486
12702
|
defaultColor: false,
|
|
12487
|
-
cssVariablePrefix: formatCSSVariablePrefix("token")
|
|
12703
|
+
cssVariablePrefix: formatCSSVariablePrefix("token"),
|
|
12704
|
+
tokenizeTimeLimit: 0
|
|
12488
12705
|
} : {
|
|
12489
12706
|
...options,
|
|
12490
12707
|
lang: "text",
|
|
@@ -12492,7 +12709,8 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
|
|
|
12492
12709
|
transformers,
|
|
12493
12710
|
decorations: void 0,
|
|
12494
12711
|
defaultColor: false,
|
|
12495
|
-
cssVariablePrefix: formatCSSVariablePrefix("token")
|
|
12712
|
+
cssVariablePrefix: formatCSSVariablePrefix("token"),
|
|
12713
|
+
tokenizeTimeLimit: 0
|
|
12496
12714
|
};
|
|
12497
12715
|
})();
|
|
12498
12716
|
return {
|
|
@@ -12501,14 +12719,14 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
|
|
|
12501
12719
|
hastConfig.lang = deletionLang;
|
|
12502
12720
|
state.lineInfo = deletionInfo;
|
|
12503
12721
|
hastConfig.decorations = deletionDecorations;
|
|
12504
|
-
return getLineNodes(
|
|
12722
|
+
return getLineNodes(highlighter2.codeToHast(cleanLastNewline(deletionFile.contents), hastConfig));
|
|
12505
12723
|
})(),
|
|
12506
12724
|
additionLines: (() => {
|
|
12507
12725
|
if (additionFile.contents === "") return [];
|
|
12508
12726
|
hastConfig.lang = additionLang;
|
|
12509
12727
|
hastConfig.decorations = additionDecorations;
|
|
12510
12728
|
state.lineInfo = additionInfo;
|
|
12511
|
-
return getLineNodes(
|
|
12729
|
+
return getLineNodes(highlighter2.codeToHast(cleanLastNewline(additionFile.contents), hastConfig));
|
|
12512
12730
|
})()
|
|
12513
12731
|
};
|
|
12514
12732
|
}
|
|
@@ -12533,7 +12751,7 @@ function splitFileContents(contents) {
|
|
|
12533
12751
|
return contents !== "" ? contents.split(SPLIT_WITH_NEWLINES) : [];
|
|
12534
12752
|
}
|
|
12535
12753
|
const DEFAULT_PLAIN_TEXT_OPTIONS = { forcePlainText: false };
|
|
12536
|
-
function renderFileWithHighlighter(file,
|
|
12754
|
+
function renderFileWithHighlighter(file, highlighter2, { theme = DEFAULT_THEMES, tokenizeMaxLineLength, useTokenTransformer }, { forcePlainText, startingLine, totalLines, lines } = DEFAULT_PLAIN_TEXT_OPTIONS) {
|
|
12537
12755
|
if (forcePlainText) {
|
|
12538
12756
|
startingLine ??= 0;
|
|
12539
12757
|
totalLines ??= Infinity;
|
|
@@ -12544,10 +12762,10 @@ function renderFileWithHighlighter(file, highlighter$1, { theme = DEFAULT_THEMES
|
|
|
12544
12762
|
const isWindowedHighlight = startingLine > 0 || totalLines < Infinity;
|
|
12545
12763
|
const { state, transformers } = createTransformerWithState(useTokenTransformer);
|
|
12546
12764
|
const lang = forcePlainText ? "text" : file.lang ?? getFiletypeFromFileName(file.name);
|
|
12547
|
-
const baseThemeType = typeof theme === "string" ?
|
|
12765
|
+
const baseThemeType = typeof theme === "string" ? highlighter2.getTheme(theme).type : void 0;
|
|
12548
12766
|
const themeStyles = getHighlighterThemeStyles({
|
|
12549
12767
|
theme,
|
|
12550
|
-
highlighter:
|
|
12768
|
+
highlighter: highlighter2
|
|
12551
12769
|
});
|
|
12552
12770
|
state.lineInfo = (shikiLineNumber) => ({
|
|
12553
12771
|
type: "context",
|
|
@@ -12561,7 +12779,8 @@ function renderFileWithHighlighter(file, highlighter$1, { theme = DEFAULT_THEMES
|
|
|
12561
12779
|
transformers,
|
|
12562
12780
|
defaultColor: false,
|
|
12563
12781
|
cssVariablePrefix: formatCSSVariablePrefix("token"),
|
|
12564
|
-
tokenizeMaxLineLength
|
|
12782
|
+
tokenizeMaxLineLength,
|
|
12783
|
+
tokenizeTimeLimit: 0
|
|
12565
12784
|
};
|
|
12566
12785
|
return {
|
|
12567
12786
|
lang,
|
|
@@ -12569,10 +12788,11 @@ function renderFileWithHighlighter(file, highlighter$1, { theme = DEFAULT_THEMES
|
|
|
12569
12788
|
transformers,
|
|
12570
12789
|
defaultColor: false,
|
|
12571
12790
|
cssVariablePrefix: formatCSSVariablePrefix("token"),
|
|
12572
|
-
tokenizeMaxLineLength
|
|
12791
|
+
tokenizeMaxLineLength,
|
|
12792
|
+
tokenizeTimeLimit: 0
|
|
12573
12793
|
};
|
|
12574
12794
|
})();
|
|
12575
|
-
const highlightedLines = getLineNodes(
|
|
12795
|
+
const highlightedLines = getLineNodes(highlighter2.codeToHast(isWindowedHighlight ? extractWindowedFileContent(lines ?? splitFileContents(file.contents), startingLine, totalLines) : cleanLastNewline(file.contents), hastConfig));
|
|
12576
12796
|
const code = isWindowedHighlight ? new Array(startingLine) : highlightedLines;
|
|
12577
12797
|
if (isWindowedHighlight) code.push(...highlightedLines);
|
|
12578
12798
|
return {
|
|
@@ -12631,15 +12851,15 @@ async function handleMessage(request) {
|
|
|
12631
12851
|
} finally {
|
|
12632
12852
|
}
|
|
12633
12853
|
}
|
|
12634
|
-
async function handleInitialize({ id, renderOptions: options, preferredHighlighter, resolvedThemes, resolvedLanguages, customExtensionsVersion:
|
|
12635
|
-
let
|
|
12636
|
-
if ("then" in
|
|
12854
|
+
async function handleInitialize({ id, renderOptions: options, preferredHighlighter, resolvedThemes, resolvedLanguages, customExtensionsVersion: customExtensionsVersion2, customExtensionMap }) {
|
|
12855
|
+
let highlighter2 = getHighlighter(preferredHighlighter);
|
|
12856
|
+
if ("then" in highlighter2) highlighter2 = await highlighter2;
|
|
12637
12857
|
syncCustomExtensionsFromRequest({
|
|
12638
|
-
customExtensionsVersion:
|
|
12858
|
+
customExtensionsVersion: customExtensionsVersion2,
|
|
12639
12859
|
customExtensionMap
|
|
12640
12860
|
});
|
|
12641
|
-
attachResolvedThemes(resolvedThemes,
|
|
12642
|
-
if (resolvedLanguages != null) attachResolvedLanguages(resolvedLanguages,
|
|
12861
|
+
attachResolvedThemes(resolvedThemes, highlighter2);
|
|
12862
|
+
if (resolvedLanguages != null) attachResolvedLanguages(resolvedLanguages, highlighter2);
|
|
12643
12863
|
renderOptions = options;
|
|
12644
12864
|
postMessage({
|
|
12645
12865
|
type: "success",
|
|
@@ -12649,9 +12869,9 @@ async function handleInitialize({ id, renderOptions: options, preferredHighlight
|
|
|
12649
12869
|
});
|
|
12650
12870
|
}
|
|
12651
12871
|
async function handleSetRenderOptions({ id, renderOptions: options, resolvedThemes }) {
|
|
12652
|
-
let
|
|
12653
|
-
if ("then" in
|
|
12654
|
-
attachResolvedThemes(resolvedThemes,
|
|
12872
|
+
let highlighter2 = getHighlighter();
|
|
12873
|
+
if ("then" in highlighter2) highlighter2 = await highlighter2;
|
|
12874
|
+
attachResolvedThemes(resolvedThemes, highlighter2);
|
|
12655
12875
|
renderOptions = options;
|
|
12656
12876
|
postMessage({
|
|
12657
12877
|
type: "success",
|
|
@@ -12660,30 +12880,30 @@ async function handleSetRenderOptions({ id, renderOptions: options, resolvedThem
|
|
|
12660
12880
|
sentAt: Date.now()
|
|
12661
12881
|
});
|
|
12662
12882
|
}
|
|
12663
|
-
async function handleRenderFile({ id, file, resolvedLanguages, customExtensionsVersion:
|
|
12664
|
-
let
|
|
12665
|
-
if ("then" in
|
|
12883
|
+
async function handleRenderFile({ id, file, resolvedLanguages, customExtensionsVersion: customExtensionsVersion2, customExtensionMap }) {
|
|
12884
|
+
let highlighter2 = getHighlighter();
|
|
12885
|
+
if ("then" in highlighter2) highlighter2 = await highlighter2;
|
|
12666
12886
|
syncCustomExtensionsFromRequest({
|
|
12667
|
-
customExtensionsVersion:
|
|
12887
|
+
customExtensionsVersion: customExtensionsVersion2,
|
|
12668
12888
|
customExtensionMap
|
|
12669
12889
|
});
|
|
12670
|
-
if (resolvedLanguages != null) attachResolvedLanguages(resolvedLanguages,
|
|
12890
|
+
if (resolvedLanguages != null) attachResolvedLanguages(resolvedLanguages, highlighter2);
|
|
12671
12891
|
const fileOptions = {
|
|
12672
12892
|
theme: renderOptions.theme,
|
|
12673
12893
|
useTokenTransformer: renderOptions.useTokenTransformer,
|
|
12674
12894
|
tokenizeMaxLineLength: renderOptions.tokenizeMaxLineLength
|
|
12675
12895
|
};
|
|
12676
|
-
sendFileSuccess(id, renderFileWithHighlighter(file,
|
|
12896
|
+
sendFileSuccess(id, renderFileWithHighlighter(file, highlighter2, fileOptions), fileOptions);
|
|
12677
12897
|
}
|
|
12678
|
-
async function handleRenderDiff({ id, diff, resolvedLanguages, customExtensionsVersion:
|
|
12679
|
-
let
|
|
12680
|
-
if ("then" in
|
|
12898
|
+
async function handleRenderDiff({ id, diff, resolvedLanguages, customExtensionsVersion: customExtensionsVersion2, customExtensionMap }) {
|
|
12899
|
+
let highlighter2 = getHighlighter();
|
|
12900
|
+
if ("then" in highlighter2) highlighter2 = await highlighter2;
|
|
12681
12901
|
syncCustomExtensionsFromRequest({
|
|
12682
|
-
customExtensionsVersion:
|
|
12902
|
+
customExtensionsVersion: customExtensionsVersion2,
|
|
12683
12903
|
customExtensionMap
|
|
12684
12904
|
});
|
|
12685
|
-
if (resolvedLanguages != null) attachResolvedLanguages(resolvedLanguages,
|
|
12686
|
-
sendDiffSuccess(id, renderDiffWithHighlighter(diff,
|
|
12905
|
+
if (resolvedLanguages != null) attachResolvedLanguages(resolvedLanguages, highlighter2);
|
|
12906
|
+
sendDiffSuccess(id, renderDiffWithHighlighter(diff, highlighter2, renderOptions), renderOptions);
|
|
12687
12907
|
}
|
|
12688
12908
|
function getHighlighter(preferredHighlighter = "shiki-js") {
|
|
12689
12909
|
highlighter ??= createHighlighterCore({
|
|
@@ -12693,10 +12913,10 @@ function getHighlighter(preferredHighlighter = "shiki-js") {
|
|
|
12693
12913
|
});
|
|
12694
12914
|
return highlighter;
|
|
12695
12915
|
}
|
|
12696
|
-
function syncCustomExtensionsFromRequest({ customExtensionsVersion:
|
|
12697
|
-
if (
|
|
12698
|
-
if (
|
|
12699
|
-
replaceCustomExtensions(
|
|
12916
|
+
function syncCustomExtensionsFromRequest({ customExtensionsVersion: customExtensionsVersion2, customExtensionMap }) {
|
|
12917
|
+
if (customExtensionsVersion2 == null && customExtensionMap == null) return;
|
|
12918
|
+
if (customExtensionsVersion2 == null || customExtensionMap == null) throw new Error("Worker request must include both customExtensionsVersion and customExtensionMap");
|
|
12919
|
+
replaceCustomExtensions(customExtensionsVersion2, customExtensionMap);
|
|
12700
12920
|
}
|
|
12701
12921
|
function sendFileSuccess(id, result, options) {
|
|
12702
12922
|
postMessage({
|