@pierre/diffs 1.5.0 → 1.5.2

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.
Files changed (64) hide show
  1. package/dist/components/CodeView.d.ts +2 -1
  2. package/dist/components/CodeView.d.ts.map +1 -1
  3. package/dist/components/CodeView.js +21 -11
  4. package/dist/components/CodeView.js.map +1 -1
  5. package/dist/components/File.d.ts.map +1 -1
  6. package/dist/components/File.js +3 -1
  7. package/dist/components/File.js.map +1 -1
  8. package/dist/components/FileDiff.d.ts +7 -4
  9. package/dist/components/FileDiff.d.ts.map +1 -1
  10. package/dist/components/FileDiff.js +4 -2
  11. package/dist/components/FileDiff.js.map +1 -1
  12. package/dist/components/VirtualizedFile.d.ts.map +1 -1
  13. package/dist/components/VirtualizedFile.js +10 -5
  14. package/dist/components/VirtualizedFile.js.map +1 -1
  15. package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
  16. package/dist/components/VirtualizedFileDiff.js +3 -4
  17. package/dist/components/VirtualizedFileDiff.js.map +1 -1
  18. package/dist/editor/editor.d.ts.map +1 -1
  19. package/dist/editor/editor.js +7 -4
  20. package/dist/editor/editor.js.map +1 -1
  21. package/dist/editor/editor2.js +1 -1
  22. package/dist/editor/getChangedDocumentLines.d.ts +6 -0
  23. package/dist/editor/getChangedDocumentLines.d.ts.map +1 -0
  24. package/dist/editor/getChangedDocumentLines.js +35 -0
  25. package/dist/editor/getChangedDocumentLines.js.map +1 -0
  26. package/dist/renderers/DiffHunksRenderer.d.ts +1 -1
  27. package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
  28. package/dist/renderers/DiffHunksRenderer.js +19 -2
  29. package/dist/renderers/DiffHunksRenderer.js.map +1 -1
  30. package/dist/style.js +1 -1
  31. package/dist/types.d.ts +4 -3
  32. package/dist/types.d.ts.map +1 -1
  33. package/dist/utils/computeVirtualFileMetrics.d.ts +2 -1
  34. package/dist/utils/computeVirtualFileMetrics.d.ts.map +1 -1
  35. package/dist/utils/computeVirtualFileMetrics.js +5 -3
  36. package/dist/utils/computeVirtualFileMetrics.js.map +1 -1
  37. package/dist/utils/getDiffHunksRendererOptions.js +1 -0
  38. package/dist/utils/getDiffHunksRendererOptions.js.map +1 -1
  39. package/dist/utils/getFiletypeFromFileName.d.ts.map +1 -1
  40. package/dist/utils/getFiletypeFromFileName.js +21 -3
  41. package/dist/utils/getFiletypeFromFileName.js.map +1 -1
  42. package/dist/utils/platform.d.ts +2 -1
  43. package/dist/utils/platform.d.ts.map +1 -1
  44. package/dist/utils/platform.js +6 -1
  45. package/dist/utils/platform.js.map +1 -1
  46. package/dist/utils/renderDiffWithHighlighter.js +39 -0
  47. package/dist/utils/renderDiffWithHighlighter.js.map +1 -1
  48. package/dist/worker/WorkerPoolManager.d.ts +8 -0
  49. package/dist/worker/WorkerPoolManager.d.ts.map +1 -1
  50. package/dist/worker/WorkerPoolManager.js +29 -14
  51. package/dist/worker/WorkerPoolManager.js.map +1 -1
  52. package/dist/worker/errors.d.ts +35 -0
  53. package/dist/worker/errors.d.ts.map +1 -0
  54. package/dist/worker/errors.js +52 -0
  55. package/dist/worker/errors.js.map +1 -0
  56. package/dist/worker/index.d.ts +2 -1
  57. package/dist/worker/index.js +2 -1
  58. package/dist/worker/types.d.ts +13 -0
  59. package/dist/worker/types.d.ts.map +1 -1
  60. package/dist/worker/worker-portable.js +60 -3
  61. package/dist/worker/worker-portable.js.map +1 -1
  62. package/dist/worker/worker.js +60 -3
  63. package/dist/worker/worker.js.map +1 -1
  64. package/package.json +1 -1
@@ -0,0 +1,52 @@
1
+ //#region src/worker/errors.ts
2
+ /** The pool was terminated while the operation was pending. */
3
+ var WorkerPoolTerminatedError = class extends Error {
4
+ constructor() {
5
+ super("WorkerPoolManager: operation canceled because the pool terminated");
6
+ this.name = "WorkerPoolTerminatedError";
7
+ }
8
+ };
9
+ /** The task was replaced or removed before it completed. */
10
+ var WorkerPoolTaskCanceledError = class extends Error {
11
+ constructor() {
12
+ super("WorkerPoolManager: operation canceled before the task completed");
13
+ this.name = "WorkerPoolTaskCanceledError";
14
+ }
15
+ };
16
+ /**
17
+ * A worker failed during initialization. The pool rejects initialization and
18
+ * pending highlight requests with this error. Components then highlight on
19
+ * the main thread.
20
+ */
21
+ var WorkerPoolWorkerError = class extends Error {
22
+ constructor(message, options) {
23
+ super(message, options);
24
+ this.name = "WorkerPoolWorkerError";
25
+ }
26
+ };
27
+ const reportedWorkerErrors = /* @__PURE__ */ new WeakSet();
28
+ /**
29
+ * Mark a worker error as reported so the pool and its consumers do not log it
30
+ * again. Used internally by the pool; not exported from the package entry.
31
+ */
32
+ function markWorkerErrorReported(error) {
33
+ reportedWorkerErrors.add(error);
34
+ }
35
+ /**
36
+ * Returns true when an operation was canceled because the pool was terminated
37
+ * or the task was replaced or removed before completion.
38
+ */
39
+ function isWorkerPoolCancellation(error) {
40
+ return error instanceof WorkerPoolTerminatedError || error instanceof WorkerPoolTaskCanceledError;
41
+ }
42
+ /**
43
+ * Returns true for cancellations and worker errors passed to onWorkerError.
44
+ * Callers use this to skip cancellation logs and duplicate error reports.
45
+ */
46
+ function isHandledWorkerPoolError(error) {
47
+ return isWorkerPoolCancellation(error) || error instanceof WorkerPoolWorkerError && reportedWorkerErrors.has(error);
48
+ }
49
+ //#endregion
50
+ export { WorkerPoolTaskCanceledError, WorkerPoolTerminatedError, WorkerPoolWorkerError, isHandledWorkerPoolError, isWorkerPoolCancellation, markWorkerErrorReported };
51
+
52
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","names":[],"sources":["../../src/worker/errors.ts"],"sourcesContent":["// Error types shared by the worker pool and its consumers. Keep this module\n// free of imports so components can handle pool errors without loading the\n// pool implementation and its dependencies.\n\n/** The pool was terminated while the operation was pending. */\nexport class WorkerPoolTerminatedError extends Error {\n constructor() {\n super('WorkerPoolManager: operation canceled because the pool terminated');\n this.name = 'WorkerPoolTerminatedError';\n }\n}\n\n/** The task was replaced or removed before it completed. */\nexport class WorkerPoolTaskCanceledError extends Error {\n constructor() {\n super('WorkerPoolManager: operation canceled before the task completed');\n this.name = 'WorkerPoolTaskCanceledError';\n }\n}\n\n/**\n * A worker failed during initialization. The pool rejects initialization and\n * pending highlight requests with this error. Components then highlight on\n * the main thread.\n */\nexport class WorkerPoolWorkerError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'WorkerPoolWorkerError';\n }\n}\n\n// Track errors passed to onWorkerError without adding fields to the errors.\nconst reportedWorkerErrors = new WeakSet<WorkerPoolWorkerError>();\n\n/**\n * Mark a worker error as reported so the pool and its consumers do not log it\n * again. Used internally by the pool; not exported from the package entry.\n */\nexport function markWorkerErrorReported(error: WorkerPoolWorkerError): void {\n reportedWorkerErrors.add(error);\n}\n\n/**\n * Returns true when an operation was canceled because the pool was terminated\n * or the task was replaced or removed before completion.\n */\nexport function isWorkerPoolCancellation(\n error: unknown\n): error is WorkerPoolTerminatedError | WorkerPoolTaskCanceledError {\n return (\n error instanceof WorkerPoolTerminatedError ||\n error instanceof WorkerPoolTaskCanceledError\n );\n}\n\n/**\n * Returns true for cancellations and worker errors passed to onWorkerError.\n * Callers use this to skip cancellation logs and duplicate error reports.\n */\nexport function isHandledWorkerPoolError(error: unknown): boolean {\n return (\n isWorkerPoolCancellation(error) ||\n (error instanceof WorkerPoolWorkerError && reportedWorkerErrors.has(error))\n );\n}\n"],"mappings":";;AAKA,IAAa,4BAAb,cAA+C,MAAM;CACnD,cAAc;EACZ,MAAM,mEAAmE;EACzE,KAAK,OAAO;CACd;AACF;;AAGA,IAAa,8BAAb,cAAiD,MAAM;CACrD,cAAc;EACZ,MAAM,iEAAiE;EACvE,KAAK,OAAO;CACd;AACF;;;;;;AAOA,IAAa,wBAAb,cAA2C,MAAM;CAC/C,YAAY,SAAiB,SAAwB;EACnD,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;CACd;AACF;AAGA,MAAM,uCAAuB,IAAI,QAA+B;;;;;AAMhE,SAAgB,wBAAwB,OAAoC;CAC1E,qBAAqB,IAAI,KAAK;AAChC;;;;;AAMA,SAAgB,yBACd,OACkE;CAClE,OACE,iBAAiB,6BACjB,iBAAiB;AAErB;;;;;AAMA,SAAgB,yBAAyB,OAAyB;CAChE,OACE,yBAAyB,KAAK,KAC7B,iBAAiB,yBAAyB,qBAAqB,IAAI,KAAK;AAE7E"}
@@ -1,4 +1,5 @@
1
+ import { WorkerPoolTaskCanceledError, WorkerPoolTerminatedError, WorkerPoolWorkerError, isHandledWorkerPoolError, isWorkerPoolCancellation } from "./errors.js";
1
2
  import { AllWorkerTasks, DiffRendererInstance, FileRendererInstance, InitializeSuccessResponse, InitializeWorkerRequest, InitializeWorkerTask, RegisterThemeSuccessResponse, RenderDiffRequest, RenderDiffSuccessResponse, RenderDiffTask, RenderErrorResponse, RenderFileRequest, RenderFileSuccessResponse, RenderFileTask, RenderSuccessResponse, RenderTaskCallbacks, ResolvedLanguage, SetRenderOptionsWorkerRequest, SetRenderOptionsWorkerTask, SubmitRequest, WorkerInitializationRenderOptions, WorkerPoolOptions, WorkerRenderingOptions, WorkerRequest, WorkerRequestId, WorkerResponse, WorkerStats } from "./types.js";
2
3
  import { WorkerPoolManager } from "./WorkerPoolManager.js";
3
4
  import { SetupWorkerPoolProps, getOrCreateWorkerPoolSingleton, terminateWorkerPoolSingleton } from "./getOrCreateWorkerPoolSingleton.js";
4
- export { AllWorkerTasks, DiffRendererInstance, FileRendererInstance, InitializeSuccessResponse, InitializeWorkerRequest, InitializeWorkerTask, RegisterThemeSuccessResponse, RenderDiffRequest, RenderDiffSuccessResponse, RenderDiffTask, RenderErrorResponse, RenderFileRequest, RenderFileSuccessResponse, RenderFileTask, RenderSuccessResponse, RenderTaskCallbacks, ResolvedLanguage, SetRenderOptionsWorkerRequest, SetRenderOptionsWorkerTask, SetupWorkerPoolProps, SubmitRequest, WorkerInitializationRenderOptions, WorkerPoolManager, WorkerPoolOptions, WorkerRenderingOptions, WorkerRequest, WorkerRequestId, WorkerResponse, WorkerStats, getOrCreateWorkerPoolSingleton, terminateWorkerPoolSingleton };
5
+ export { AllWorkerTasks, DiffRendererInstance, FileRendererInstance, InitializeSuccessResponse, InitializeWorkerRequest, InitializeWorkerTask, RegisterThemeSuccessResponse, RenderDiffRequest, RenderDiffSuccessResponse, RenderDiffTask, RenderErrorResponse, RenderFileRequest, RenderFileSuccessResponse, RenderFileTask, RenderSuccessResponse, RenderTaskCallbacks, ResolvedLanguage, SetRenderOptionsWorkerRequest, SetRenderOptionsWorkerTask, SetupWorkerPoolProps, SubmitRequest, WorkerInitializationRenderOptions, WorkerPoolManager, WorkerPoolOptions, WorkerPoolTaskCanceledError, WorkerPoolTerminatedError, WorkerPoolWorkerError, WorkerRenderingOptions, WorkerRequest, WorkerRequestId, WorkerResponse, WorkerStats, getOrCreateWorkerPoolSingleton, isHandledWorkerPoolError, isWorkerPoolCancellation, terminateWorkerPoolSingleton };
@@ -1,3 +1,4 @@
1
+ import { WorkerPoolTaskCanceledError, WorkerPoolTerminatedError, WorkerPoolWorkerError, isHandledWorkerPoolError, isWorkerPoolCancellation } from "./errors.js";
1
2
  import { WorkerPoolManager } from "./WorkerPoolManager.js";
2
3
  import { getOrCreateWorkerPoolSingleton, terminateWorkerPoolSingleton } from "./getOrCreateWorkerPoolSingleton.js";
3
- export { WorkerPoolManager, getOrCreateWorkerPoolSingleton, terminateWorkerPoolSingleton };
4
+ export { WorkerPoolManager, WorkerPoolTaskCanceledError, WorkerPoolTerminatedError, WorkerPoolWorkerError, getOrCreateWorkerPoolSingleton, isHandledWorkerPoolError, isWorkerPoolCancellation, terminateWorkerPoolSingleton };
@@ -108,6 +108,19 @@ interface WorkerPoolOptions {
108
108
  * @default 10000
109
109
  */
110
110
  workerInitializationTimeout?: number;
111
+ /**
112
+ * Called for each worker error instead of logging it with console.error.
113
+ * Call event.preventDefault() to prevent the browser from also reporting it
114
+ * as an uncaught error.
115
+ *
116
+ * Script load failures may provide a plain Event without message or error;
117
+ * uncaught exceptions provide an ErrorEvent. If initialization fails, the
118
+ * pool stops its workers and components highlight on the main thread.
119
+ *
120
+ * Several workers can report the same script load failure. Track errors in
121
+ * this callback if your application should report that failure only once.
122
+ */
123
+ onWorkerError?: (event: ErrorEvent | Event, worker: Worker) => void;
111
124
  totalASTLRUCacheSize?: number;
112
125
  }
113
126
  interface WorkerInitializationRenderOptions extends Partial<WorkerRenderingOptions> {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/worker/types.ts"],"mappings":";;KAiBY;UAEK;EACf,OAAO,kBAAkB;EACzB;EACA;EACA,cAAc;EACd;;UAGe;WACN;EACT,mBACE,MAAM,cACN,QAAQ,kBACR,SAAS;EAEX,iBAAiB;;UAGF;WACN;EACT,mBACE,MAAM,kBACN,QAAQ,kBACR,SAAS;EAEX,iBAAiB;;UAGF;EACf;EACA,IAAI;EACJ,MAAM;EACN,oBAAoB;EACpB;EACA,qBAAqB;;UAGN;EACf;EACA,IAAI;EACJ,MAAM;EACN,oBAAoB;EACpB;EACA,qBAAqB;;UAGN;EACf;EACA,IAAI;EACJ,eAAe;EACf,sBAAsB;EACtB,gBAAgB;EAChB,oBAAoB;EACpB;EACA,qBAAqB;;UAGN;EACf,MAAM,QAAQ;EACd,MAAM;;UAGS;EACf;EACA,IAAI;EACJ,eAAe;EACf,gBAAgB;;KAGN,gBACR,KAAK,2BACL,KAAK;KAEG,gBACR,oBACA,oBACA,0BACA;UAEa;EACf;EACA;EACA,IAAI;EACJ,QAAQ;EACR,SAAS;EACT;;UAGe;EACf;EACA;EACA,IAAI;EACJ,QAAQ;EACR,SAAS;EACT;;UAGe;EACf;EACA;EACA,IAAI;EACJ;;UAGe;EACf;EACA;EACA,IAAI;EACJ;;UAGe;EACf;EACA,IAAI;EACJ;EACA;;KAGU,wBACR,4BACA;KAEQ,iBACR,wBACA,sBACA,4BACA;UAEa;;;;;EAKf,qBAAqB;;;;;EAMrB;;;;;EAMA;EAEA;;UAGe,0CAA0C,QAAQ;EACjE,QAAQ;EACR,uBAAuB;;UAGR;EACf;EACA,IAAI;EACJ,SAAS;EACT,QAAQ;EACR,OAAO,OAAO;EACd;;UAGe;EACf;EACA,IAAI;EACJ,SAAS;EACT,QAAQ;EACR,OAAO,OAAO;EACd;;UAGe;EACf;EACA,OAAO,OAAO;;UAGC;EACf;EACA,IAAI;EACJ,SAAS;;EAET;EACA,WAAW,IAAI;EAGf;EACA;EACA,WAAW,IAAI;EACf;EACA;;UAGe;EACf;EACA,IAAI;EACJ,SAAS;;EAET;EACA,WAAW,IAAI;EAGf;EACA;EACA,WAAW,IAAI;EACf;EACA;;KAGU,iBACR,uBACA,6BACA,iBACA;UAEa;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/worker/types.ts"],"mappings":";;KAiBY;UAEK;EACf,OAAO,kBAAkB;EACzB;EACA;EACA,cAAc;EACd;;UAGe;WACN;EACT,mBACE,MAAM,cACN,QAAQ,kBACR,SAAS;EAEX,iBAAiB;;UAGF;WACN;EACT,mBACE,MAAM,kBACN,QAAQ,kBACR,SAAS;EAEX,iBAAiB;;UAGF;EACf;EACA,IAAI;EACJ,MAAM;EACN,oBAAoB;EACpB;EACA,qBAAqB;;UAGN;EACf;EACA,IAAI;EACJ,MAAM;EACN,oBAAoB;EACpB;EACA,qBAAqB;;UAGN;EACf;EACA,IAAI;EACJ,eAAe;EACf,sBAAsB;EACtB,gBAAgB;EAChB,oBAAoB;EACpB;EACA,qBAAqB;;UAGN;EACf,MAAM,QAAQ;EACd,MAAM;;UAGS;EACf;EACA,IAAI;EACJ,eAAe;EACf,gBAAgB;;KAGN,gBACR,KAAK,2BACL,KAAK;KAEG,gBACR,oBACA,oBACA,0BACA;UAEa;EACf;EACA;EACA,IAAI;EACJ,QAAQ;EACR,SAAS;EACT;;UAGe;EACf;EACA;EACA,IAAI;EACJ,QAAQ;EACR,SAAS;EACT;;UAGe;EACf;EACA;EACA,IAAI;EACJ;;UAGe;EACf;EACA;EACA,IAAI;EACJ;;UAGe;EACf;EACA,IAAI;EACJ;EACA;;KAGU,wBACR,4BACA;KAEQ,iBACR,wBACA,sBACA,4BACA;UAEa;;;;;EAKf,qBAAqB;;;;;EAMrB;;;;;EAMA;;;;;;;;;;;;;EAcA,iBAAiB,OAAO,aAAa,OAAO,QAAQ;EAEpD;;UAGe,0CAA0C,QAAQ;EACjE,QAAQ;EACR,uBAAuB;;UAGR;EACf;EACA,IAAI;EACJ,SAAS;EACT,QAAQ;EACR,OAAO,OAAO;EACd;;UAGe;EACf;EACA,IAAI;EACJ,SAAS;EACT,QAAQ;EACR,OAAO,OAAO;EACd;;UAGe;EACf;EACA,OAAO,OAAO;;UAGC;EACf;EACA,IAAI;EACJ,SAAS;;EAET;EACA,WAAW,IAAI;EAGf;EACA;EACA,WAAW,IAAI;EACf;EACA;;UAGe;EACf;EACA,IAAI;EACJ,SAAS;;EAET;EACA,WAAW,IAAI;EAGf;EACA;EACA,WAAW,IAAI;EACf;EACA;;KAGU,iBACR,uBACA,6BACA,iBACA;UAEa;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA"}
@@ -11136,6 +11136,7 @@ const EXTENSION_TO_FILE_FORMAT = {
11136
11136
  mli: "ocaml",
11137
11137
  mll: "ocaml",
11138
11138
  mly: "ocaml",
11139
+ odin: "odin",
11139
11140
  pas: "pascal",
11140
11141
  p: "pascal",
11141
11142
  pl: "prolog",
@@ -11168,6 +11169,17 @@ const EXTENSION_TO_FILE_FORMAT = {
11168
11169
  py: "python",
11169
11170
  pyw: "python",
11170
11171
  pyi: "python",
11172
+ BUCK: "python",
11173
+ BUILD: "python",
11174
+ PACKAGE: "python",
11175
+ WORKSPACE: "python",
11176
+ Tiltfile: "python",
11177
+ bazel: "python",
11178
+ bxl: "python",
11179
+ bzl: "python",
11180
+ bzlmod: "python",
11181
+ star: "python",
11182
+ sky: "python",
11171
11183
  qml: "qml",
11172
11184
  qmldir: "qmldir",
11173
11185
  qss: "qss",
@@ -11278,16 +11290,22 @@ const EXTENSION_TO_FILE_FORMAT = {
11278
11290
  sty: "tex"
11279
11291
  };
11280
11292
  function getFiletypeFromFileName(fileName) {
11293
+ const format = matchFiletypeFromName(fileName);
11294
+ if (format != null) return format;
11295
+ const baseName = fileName.split(/[/\\]/).pop() ?? fileName;
11296
+ return baseName === fileName ? "text" : matchFiletypeFromName(baseName) ?? "text";
11297
+ }
11298
+ function matchFiletypeFromName(fileName) {
11281
11299
  if (CUSTOM_EXTENSION_TO_FILE_FORMAT.has(fileName)) return CUSTOM_EXTENSION_TO_FILE_FORMAT.get(fileName) ?? "text";
11282
- if (EXTENSION_TO_FILE_FORMAT[fileName] != null) return EXTENSION_TO_FILE_FORMAT[fileName];
11300
+ if (Object.hasOwn(EXTENSION_TO_FILE_FORMAT, fileName)) return EXTENSION_TO_FILE_FORMAT[fileName] ?? null;
11283
11301
  const compoundMatch = fileName.match(/\.([^/\\]+\.[^/\\]+)$/);
11284
11302
  if (compoundMatch != null) {
11285
11303
  if (CUSTOM_EXTENSION_TO_FILE_FORMAT.has(compoundMatch[1])) return CUSTOM_EXTENSION_TO_FILE_FORMAT.get(compoundMatch[1]) ?? "text";
11286
- if (EXTENSION_TO_FILE_FORMAT[compoundMatch[1]] != null) return EXTENSION_TO_FILE_FORMAT[compoundMatch[1]] ?? "text";
11304
+ if (Object.hasOwn(EXTENSION_TO_FILE_FORMAT, compoundMatch[1])) return EXTENSION_TO_FILE_FORMAT[compoundMatch[1]] ?? "text";
11287
11305
  }
11288
11306
  const simpleMatch = fileName.match(/\.([^.]+)$/)?.[1] ?? "";
11289
11307
  if (CUSTOM_EXTENSION_TO_FILE_FORMAT.has(simpleMatch)) return CUSTOM_EXTENSION_TO_FILE_FORMAT.get(simpleMatch) ?? "text";
11290
- return EXTENSION_TO_FILE_FORMAT[simpleMatch] ?? "text";
11308
+ return Object.hasOwn(EXTENSION_TO_FILE_FORMAT, simpleMatch) ? EXTENSION_TO_FILE_FORMAT[simpleMatch] ?? "text" : null;
11291
11309
  }
11292
11310
  function replaceCustomExtensions(version, map) {
11293
11311
  if (version <= customExtensionsVersion) return false;
@@ -13017,12 +13035,51 @@ function renderDiffWithHighlighter(diff, highlighter, options, { forcePlainText,
13017
13035
  baseThemeType
13018
13036
  };
13019
13037
  }
13038
+ function pushWordLineDecorations(lineDiff, { deletionLineIndex, additionLineIndex, deletionDecorations, additionDecorations }) {
13039
+ let deletionOffset = 0;
13040
+ let additionOffset = 0;
13041
+ let deletionStart = -1;
13042
+ let deletionEnd = 0;
13043
+ let additionStart = -1;
13044
+ let additionEnd = 0;
13045
+ for (const { value, added, removed } of lineDiff) if (removed) {
13046
+ if (deletionStart === -1) deletionStart = deletionOffset;
13047
+ deletionOffset += value.length;
13048
+ deletionEnd = deletionOffset;
13049
+ } else if (added) {
13050
+ if (additionStart === -1) additionStart = additionOffset;
13051
+ additionOffset += value.length;
13052
+ additionEnd = additionOffset;
13053
+ } else {
13054
+ deletionOffset += value.length;
13055
+ additionOffset += value.length;
13056
+ }
13057
+ if (deletionStart !== -1) deletionDecorations.push(createDiffSpanDecoration({
13058
+ line: deletionLineIndex,
13059
+ spanStart: deletionStart,
13060
+ spanLength: deletionEnd - deletionStart
13061
+ }));
13062
+ if (additionStart !== -1) additionDecorations.push(createDiffSpanDecoration({
13063
+ line: additionLineIndex,
13064
+ spanStart: additionStart,
13065
+ spanLength: additionEnd - additionStart
13066
+ }));
13067
+ }
13020
13068
  function computeLineDiffDecorations({ deletionLine, additionLine, deletionLineIndex, additionLineIndex, deletionDecorations, additionDecorations, lineDiffType, maxLineDiffLength }) {
13021
13069
  if (deletionLine == null || additionLine == null || lineDiffType === "none") return;
13022
13070
  deletionLine = cleanLastNewline(deletionLine);
13023
13071
  additionLine = cleanLastNewline(additionLine);
13024
13072
  if (deletionLine.length > maxLineDiffLength || additionLine.length > maxLineDiffLength) return;
13025
13073
  const lineDiff = lineDiffType === "char" ? diffChars(deletionLine, additionLine) : diffWordsWithSpace(deletionLine, additionLine);
13074
+ if (lineDiffType === "word-line") {
13075
+ pushWordLineDecorations(lineDiff, {
13076
+ deletionLineIndex,
13077
+ additionLineIndex,
13078
+ deletionDecorations,
13079
+ additionDecorations
13080
+ });
13081
+ return;
13082
+ }
13026
13083
  const deletionSpans = [];
13027
13084
  const additionSpans = [];
13028
13085
  const enableJoin = lineDiffType === "word-alt";