@noma.to/qwik-testing-library 1.2.0 → 1.3.1
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/README.md +4 -3
- package/lib/lib/mock.qwik.cjs +3 -3
- package/lib/lib/mock.qwik.mjs +1 -1
- package/lib/lib/qwik-testing-library.qwik.cjs +2 -2
- package/lib/lib/qwik-testing-library.qwik.mjs +3 -3
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.cjs +89 -0
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.mjs +89 -0
- package/lib/node_modules/.pnpm/{@vitest_expect@2.1.1 → @vitest_expect@3.0.5}/node_modules/@vitest/expect/dist/index.qwik.cjs +321 -97
- package/lib/node_modules/.pnpm/{@vitest_expect@2.1.1 → @vitest_expect@3.0.5}/node_modules/@vitest/expect/dist/index.qwik.mjs +318 -94
- package/lib/node_modules/.pnpm/{@vitest_pretty-format@2.1.1 → @vitest_pretty-format@3.0.5}/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +312 -15
- package/lib/node_modules/.pnpm/{@vitest_pretty-format@2.1.1 → @vitest_pretty-format@3.0.5}/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +317 -20
- package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +2 -2
- package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +2 -2
- package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/index.qwik.cjs +161 -69
- package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/index.qwik.mjs +158 -66
- package/lib/node_modules/.pnpm/{@vitest_snapshot@2.1.1 → @vitest_snapshot@3.0.5}/node_modules/@vitest/snapshot/dist/index.qwik.cjs +976 -538
- package/lib/node_modules/.pnpm/{@vitest_snapshot@2.1.1 → @vitest_snapshot@3.0.5}/node_modules/@vitest/snapshot/dist/index.qwik.mjs +976 -538
- package/lib/node_modules/.pnpm/{@vitest_spy@2.1.1 → @vitest_spy@3.0.5}/node_modules/@vitest/spy/dist/index.qwik.cjs +20 -3
- package/lib/node_modules/.pnpm/{@vitest_spy@2.1.1 → @vitest_spy@3.0.5}/node_modules/@vitest/spy/dist/index.qwik.mjs +20 -3
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.cjs → @vitest_utils@3.0.5/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.cjs} +7 -3
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.mjs → @vitest_utils@3.0.5/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.mjs} +7 -3
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/diff.qwik.cjs +491 -467
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/diff.qwik.mjs +491 -467
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/error.qwik.cjs +6 -6
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/error.qwik.mjs +3 -3
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.5/node_modules/@vitest/utils/dist/index.qwik.cjs +474 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.5/node_modules/@vitest/utils/dist/index.qwik.mjs +474 -0
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/source-map.qwik.cjs +20 -20
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/source-map.qwik.mjs +20 -20
- package/lib/node_modules/.pnpm/{chai@5.1.1 → chai@5.1.2}/node_modules/chai/chai.qwik.cjs +71 -39
- package/lib/node_modules/.pnpm/{chai@5.1.1 → chai@5.1.2}/node_modules/chai/chai.qwik.mjs +71 -39
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/error.qwik.cjs +7 -1
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/error.qwik.mjs +7 -1
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/index.qwik.mjs +6 -6
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/map.qwik.cjs +1 -3
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/map.qwik.mjs +1 -3
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/object.qwik.cjs +1 -1
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/object.qwik.mjs +1 -1
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/string.qwik.cjs +1 -2
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/string.qwik.mjs +1 -2
- package/lib/node_modules/.pnpm/{magic-string@0.30.11 → magic-string@0.30.17}/node_modules/magic-string/dist/magic-string.es.qwik.cjs +44 -33
- package/lib/node_modules/.pnpm/{magic-string@0.30.11 → magic-string@0.30.17}/node_modules/magic-string/dist/magic-string.es.qwik.mjs +44 -33
- package/lib/node_modules/.pnpm/{pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.cjs → pathe@2.0.2/node_modules/pathe/dist/shared/pathe.UZ-hd4nF.qwik.cjs} +2 -2
- package/lib/node_modules/.pnpm/{pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.mjs → pathe@2.0.2/node_modules/pathe/dist/shared/pathe.UZ-hd4nF.qwik.mjs} +2 -2
- package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +4 -0
- package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +5 -0
- package/lib/node_modules/.pnpm/vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.cjs +66 -0
- package/lib/node_modules/.pnpm/vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.mjs +66 -0
- package/lib/node_modules/.pnpm/vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.CjhMlMwf.qwik.cjs +2977 -0
- package/lib/node_modules/.pnpm/vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.CjhMlMwf.qwik.mjs +2977 -0
- package/package.json +13 -13
- package/lib/_virtual/_commonjsHelpers.qwik.cjs +0 -4
- package/lib/_virtual/_commonjsHelpers.qwik.mjs +0 -4
- package/lib/_virtual/sourcemap-codec.umd.qwik.cjs +0 -4
- package/lib/_virtual/sourcemap-codec.umd.qwik.mjs +0 -4
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.cjs +0 -425
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.mjs +0 -425
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.cjs +0 -81
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.mjs +0 -81
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +0 -7
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +0 -8
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.cjs +0 -6
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.mjs +0 -6
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.cjs +0 -16
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.mjs +0 -16
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.cjs +0 -2556
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.mjs +0 -2556
- /package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/helpers.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/helpers.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/arguments.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/arguments.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/array.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/array.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/bigint.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/bigint.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/class.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/class.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/date.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/date.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/function.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/function.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/helpers.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/helpers.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/html.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/html.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/index.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/number.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/number.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/promise.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/promise.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/regexp.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/regexp.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/set.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/set.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/symbol.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/symbol.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/typedarray.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/typedarray.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{tinyrainbow@1.2.0 → tinyrainbow@2.0.0}/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{tinyrainbow@1.2.0 → tinyrainbow@2.0.0}/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +0 -0
|
@@ -1,46 +1,11 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { format, plugins } from "../../../../../@vitest_pretty-format@
|
|
5
|
-
import
|
|
6
|
-
import { s as stringify } from "./chunk-
|
|
4
|
+
import { format, plugins } from "../../../../../@vitest_pretty-format@3.0.5/node_modules/@vitest/pretty-format/dist/index.qwik.mjs";
|
|
5
|
+
import s from "../../../../../tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.mjs";
|
|
6
|
+
import { s as stringify, g as getDefaultExportFromCjs } from "./chunk-_commonjsHelpers.qwik.mjs";
|
|
7
7
|
import { deepClone, getOwnProperties, getType as getType$1 } from "./helpers.qwik.mjs";
|
|
8
|
-
import "../../../../../loupe@3.1.
|
|
9
|
-
function getType(value) {
|
|
10
|
-
if (value === void 0) {
|
|
11
|
-
return "undefined";
|
|
12
|
-
} else if (value === null) {
|
|
13
|
-
return "null";
|
|
14
|
-
} else if (Array.isArray(value)) {
|
|
15
|
-
return "array";
|
|
16
|
-
} else if (typeof value === "boolean") {
|
|
17
|
-
return "boolean";
|
|
18
|
-
} else if (typeof value === "function") {
|
|
19
|
-
return "function";
|
|
20
|
-
} else if (typeof value === "number") {
|
|
21
|
-
return "number";
|
|
22
|
-
} else if (typeof value === "string") {
|
|
23
|
-
return "string";
|
|
24
|
-
} else if (typeof value === "bigint") {
|
|
25
|
-
return "bigint";
|
|
26
|
-
} else if (typeof value === "object") {
|
|
27
|
-
if (value != null) {
|
|
28
|
-
if (value.constructor === RegExp) {
|
|
29
|
-
return "regexp";
|
|
30
|
-
} else if (value.constructor === Map) {
|
|
31
|
-
return "map";
|
|
32
|
-
} else if (value.constructor === Set) {
|
|
33
|
-
return "set";
|
|
34
|
-
} else if (value.constructor === Date) {
|
|
35
|
-
return "date";
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return "object";
|
|
39
|
-
} else if (typeof value === "symbol") {
|
|
40
|
-
return "symbol";
|
|
41
|
-
}
|
|
42
|
-
throw new Error(`value of unknown type: ${value}`);
|
|
43
|
-
}
|
|
8
|
+
import "../../../../../loupe@3.1.3/node_modules/loupe/lib/index.qwik.mjs";
|
|
44
9
|
const DIFF_DELETE = -1;
|
|
45
10
|
const DIFF_INSERT = 1;
|
|
46
11
|
const DIFF_EQUAL = 0;
|
|
@@ -400,225 +365,154 @@ function diff_cleanupSemanticScore_(one, two) {
|
|
|
400
365
|
const NO_DIFF_MESSAGE = "Compared values have no visual difference.";
|
|
401
366
|
const SIMILAR_MESSAGE = "Compared values serialize to the same structure.\nPrinting internal object structure without calling `toJSON` instead.";
|
|
402
367
|
var build = {};
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
nCommon
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
let nCommon = 0;
|
|
420
|
-
while (aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)) {
|
|
421
|
-
aIndex -= 1;
|
|
422
|
-
bIndex -= 1;
|
|
423
|
-
nCommon += 1;
|
|
424
|
-
}
|
|
425
|
-
return nCommon;
|
|
426
|
-
};
|
|
427
|
-
const extendPathsF = (d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF) => {
|
|
428
|
-
let iF = 0;
|
|
429
|
-
let kF = -d;
|
|
430
|
-
let aFirst = aIndexesF[iF];
|
|
431
|
-
let aIndexPrev1 = aFirst;
|
|
432
|
-
aIndexesF[iF] += countCommonItemsF(
|
|
433
|
-
aFirst + 1,
|
|
434
|
-
aEnd,
|
|
435
|
-
bF + aFirst - kF + 1,
|
|
436
|
-
bEnd,
|
|
437
|
-
isCommon
|
|
438
|
-
);
|
|
439
|
-
const nF = d < iMaxF ? d : iMaxF;
|
|
440
|
-
for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) {
|
|
441
|
-
if (iF !== d && aIndexPrev1 < aIndexesF[iF]) {
|
|
442
|
-
aFirst = aIndexesF[iF];
|
|
443
|
-
} else {
|
|
444
|
-
aFirst = aIndexPrev1 + 1;
|
|
445
|
-
if (aEnd <= aFirst) {
|
|
446
|
-
return iF - 1;
|
|
447
|
-
}
|
|
368
|
+
var hasRequiredBuild;
|
|
369
|
+
function requireBuild() {
|
|
370
|
+
if (hasRequiredBuild) return build;
|
|
371
|
+
hasRequiredBuild = 1;
|
|
372
|
+
Object.defineProperty(build, "__esModule", {
|
|
373
|
+
value: true
|
|
374
|
+
});
|
|
375
|
+
build.default = diffSequence;
|
|
376
|
+
const pkg = "diff-sequences";
|
|
377
|
+
const NOT_YET_SET = 0;
|
|
378
|
+
const countCommonItemsF = (aIndex, aEnd, bIndex, bEnd, isCommon) => {
|
|
379
|
+
let nCommon = 0;
|
|
380
|
+
while (aIndex < aEnd && bIndex < bEnd && isCommon(aIndex, bIndex)) {
|
|
381
|
+
aIndex += 1;
|
|
382
|
+
bIndex += 1;
|
|
383
|
+
nCommon += 1;
|
|
448
384
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
let aFirst = aIndexesR[iR];
|
|
458
|
-
let aIndexPrev1 = aFirst;
|
|
459
|
-
aIndexesR[iR] -= countCommonItemsR(
|
|
460
|
-
aStart,
|
|
461
|
-
aFirst - 1,
|
|
462
|
-
bStart,
|
|
463
|
-
bR + aFirst - kR - 1,
|
|
464
|
-
isCommon
|
|
465
|
-
);
|
|
466
|
-
const nR = d < iMaxR ? d : iMaxR;
|
|
467
|
-
for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) {
|
|
468
|
-
if (iR !== d && aIndexesR[iR] < aIndexPrev1) {
|
|
469
|
-
aFirst = aIndexesR[iR];
|
|
470
|
-
} else {
|
|
471
|
-
aFirst = aIndexPrev1 - 1;
|
|
472
|
-
if (aFirst < aStart) {
|
|
473
|
-
return iR - 1;
|
|
474
|
-
}
|
|
385
|
+
return nCommon;
|
|
386
|
+
};
|
|
387
|
+
const countCommonItemsR = (aStart, aIndex, bStart, bIndex, isCommon) => {
|
|
388
|
+
let nCommon = 0;
|
|
389
|
+
while (aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)) {
|
|
390
|
+
aIndex -= 1;
|
|
391
|
+
bIndex -= 1;
|
|
392
|
+
nCommon += 1;
|
|
475
393
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
return iMaxR;
|
|
486
|
-
};
|
|
487
|
-
const extendOverlappablePathsF = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) => {
|
|
488
|
-
const bF = bStart - aStart;
|
|
489
|
-
const aLength = aEnd - aStart;
|
|
490
|
-
const bLength = bEnd - bStart;
|
|
491
|
-
const baDeltaLength = bLength - aLength;
|
|
492
|
-
const kMinOverlapF = -baDeltaLength - (d - 1);
|
|
493
|
-
const kMaxOverlapF = -baDeltaLength + (d - 1);
|
|
494
|
-
let aIndexPrev1 = NOT_YET_SET;
|
|
495
|
-
const nF = d < iMaxF ? d : iMaxF;
|
|
496
|
-
for (let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) {
|
|
497
|
-
const insert = iF === 0 || iF !== d && aIndexPrev1 < aIndexesF[iF];
|
|
498
|
-
const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1;
|
|
499
|
-
const aFirst = insert ? aLastPrev : aLastPrev + 1;
|
|
500
|
-
const bFirst = bF + aFirst - kF;
|
|
501
|
-
const nCommonF = countCommonItemsF(
|
|
394
|
+
return nCommon;
|
|
395
|
+
};
|
|
396
|
+
const extendPathsF = (d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF) => {
|
|
397
|
+
let iF = 0;
|
|
398
|
+
let kF = -d;
|
|
399
|
+
let aFirst = aIndexesF[iF];
|
|
400
|
+
let aIndexPrev1 = aFirst;
|
|
401
|
+
aIndexesF[iF] += countCommonItemsF(
|
|
502
402
|
aFirst + 1,
|
|
503
403
|
aEnd,
|
|
504
|
-
|
|
404
|
+
bF + aFirst - kF + 1,
|
|
505
405
|
bEnd,
|
|
506
406
|
isCommon
|
|
507
407
|
);
|
|
508
|
-
const
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
aStart,
|
|
517
|
-
aLastPrev,
|
|
518
|
-
bStart,
|
|
519
|
-
bLastPrev,
|
|
520
|
-
isCommon
|
|
521
|
-
);
|
|
522
|
-
const aIndexPrevFirst = aLastPrev - nCommonR;
|
|
523
|
-
const bIndexPrevFirst = bLastPrev - nCommonR;
|
|
524
|
-
const aEndPreceding = aIndexPrevFirst + 1;
|
|
525
|
-
const bEndPreceding = bIndexPrevFirst + 1;
|
|
526
|
-
division.nChangePreceding = d - 1;
|
|
527
|
-
if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) {
|
|
528
|
-
division.aEndPreceding = aStart;
|
|
529
|
-
division.bEndPreceding = bStart;
|
|
530
|
-
} else {
|
|
531
|
-
division.aEndPreceding = aEndPreceding;
|
|
532
|
-
division.bEndPreceding = bEndPreceding;
|
|
533
|
-
}
|
|
534
|
-
division.nCommonPreceding = nCommonR;
|
|
535
|
-
if (nCommonR !== 0) {
|
|
536
|
-
division.aCommonPreceding = aEndPreceding;
|
|
537
|
-
division.bCommonPreceding = bEndPreceding;
|
|
538
|
-
}
|
|
539
|
-
division.nCommonFollowing = nCommonF;
|
|
540
|
-
if (nCommonF !== 0) {
|
|
541
|
-
division.aCommonFollowing = aFirst + 1;
|
|
542
|
-
division.bCommonFollowing = bFirst + 1;
|
|
543
|
-
}
|
|
544
|
-
const aStartFollowing = aLast + 1;
|
|
545
|
-
const bStartFollowing = bFirst + nCommonF + 1;
|
|
546
|
-
division.nChangeFollowing = d - 1;
|
|
547
|
-
if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
|
|
548
|
-
division.aStartFollowing = aEnd;
|
|
549
|
-
division.bStartFollowing = bEnd;
|
|
550
|
-
} else {
|
|
551
|
-
division.aStartFollowing = aStartFollowing;
|
|
552
|
-
division.bStartFollowing = bStartFollowing;
|
|
408
|
+
const nF = d < iMaxF ? d : iMaxF;
|
|
409
|
+
for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) {
|
|
410
|
+
if (iF !== d && aIndexPrev1 < aIndexesF[iF]) {
|
|
411
|
+
aFirst = aIndexesF[iF];
|
|
412
|
+
} else {
|
|
413
|
+
aFirst = aIndexPrev1 + 1;
|
|
414
|
+
if (aEnd <= aFirst) {
|
|
415
|
+
return iF - 1;
|
|
553
416
|
}
|
|
554
|
-
return true;
|
|
555
417
|
}
|
|
418
|
+
aIndexPrev1 = aIndexesF[iF];
|
|
419
|
+
aIndexesF[iF] = aFirst + countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
|
|
556
420
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
const kMinOverlapR = baDeltaLength - d;
|
|
566
|
-
const kMaxOverlapR = baDeltaLength + d;
|
|
567
|
-
let aIndexPrev1 = NOT_YET_SET;
|
|
568
|
-
const nR = d < iMaxR ? d : iMaxR;
|
|
569
|
-
for (let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) {
|
|
570
|
-
const insert = iR === 0 || iR !== d && aIndexesR[iR] < aIndexPrev1;
|
|
571
|
-
const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1;
|
|
572
|
-
const aFirst = insert ? aLastPrev : aLastPrev - 1;
|
|
573
|
-
const bFirst = bR + aFirst - kR;
|
|
574
|
-
const nCommonR = countCommonItemsR(
|
|
421
|
+
return iMaxF;
|
|
422
|
+
};
|
|
423
|
+
const extendPathsR = (d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR) => {
|
|
424
|
+
let iR = 0;
|
|
425
|
+
let kR = d;
|
|
426
|
+
let aFirst = aIndexesR[iR];
|
|
427
|
+
let aIndexPrev1 = aFirst;
|
|
428
|
+
aIndexesR[iR] -= countCommonItemsR(
|
|
575
429
|
aStart,
|
|
576
430
|
aFirst - 1,
|
|
577
431
|
bStart,
|
|
578
|
-
|
|
432
|
+
bR + aFirst - kR - 1,
|
|
579
433
|
isCommon
|
|
580
434
|
);
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
if (d === aLast + bLast - aStart - bStart) {
|
|
590
|
-
division.aEndPreceding = aStart;
|
|
591
|
-
division.bEndPreceding = bStart;
|
|
592
|
-
} else {
|
|
593
|
-
division.aEndPreceding = aLast;
|
|
594
|
-
division.bEndPreceding = bLast;
|
|
595
|
-
}
|
|
596
|
-
division.nCommonPreceding = nCommonR;
|
|
597
|
-
if (nCommonR !== 0) {
|
|
598
|
-
division.aCommonPreceding = aLast;
|
|
599
|
-
division.bCommonPreceding = bLast;
|
|
435
|
+
const nR = d < iMaxR ? d : iMaxR;
|
|
436
|
+
for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) {
|
|
437
|
+
if (iR !== d && aIndexesR[iR] < aIndexPrev1) {
|
|
438
|
+
aFirst = aIndexesR[iR];
|
|
439
|
+
} else {
|
|
440
|
+
aFirst = aIndexPrev1 - 1;
|
|
441
|
+
if (aFirst < aStart) {
|
|
442
|
+
return iR - 1;
|
|
600
443
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
444
|
+
}
|
|
445
|
+
aIndexPrev1 = aIndexesR[iR];
|
|
446
|
+
aIndexesR[iR] = aFirst - countCommonItemsR(
|
|
447
|
+
aStart,
|
|
448
|
+
aFirst - 1,
|
|
449
|
+
bStart,
|
|
450
|
+
bR + aFirst - kR - 1,
|
|
451
|
+
isCommon
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
return iMaxR;
|
|
455
|
+
};
|
|
456
|
+
const extendOverlappablePathsF = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) => {
|
|
457
|
+
const bF = bStart - aStart;
|
|
458
|
+
const aLength = aEnd - aStart;
|
|
459
|
+
const bLength = bEnd - bStart;
|
|
460
|
+
const baDeltaLength = bLength - aLength;
|
|
461
|
+
const kMinOverlapF = -baDeltaLength - (d - 1);
|
|
462
|
+
const kMaxOverlapF = -baDeltaLength + (d - 1);
|
|
463
|
+
let aIndexPrev1 = NOT_YET_SET;
|
|
464
|
+
const nF = d < iMaxF ? d : iMaxF;
|
|
465
|
+
for (let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) {
|
|
466
|
+
const insert = iF === 0 || iF !== d && aIndexPrev1 < aIndexesF[iF];
|
|
467
|
+
const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1;
|
|
468
|
+
const aFirst = insert ? aLastPrev : aLastPrev + 1;
|
|
469
|
+
const bFirst = bF + aFirst - kF;
|
|
470
|
+
const nCommonF = countCommonItemsF(
|
|
471
|
+
aFirst + 1,
|
|
472
|
+
aEnd,
|
|
473
|
+
bFirst + 1,
|
|
474
|
+
bEnd,
|
|
475
|
+
isCommon
|
|
476
|
+
);
|
|
477
|
+
const aLast = aFirst + nCommonF;
|
|
478
|
+
aIndexPrev1 = aIndexesF[iF];
|
|
479
|
+
aIndexesF[iF] = aLast;
|
|
480
|
+
if (kMinOverlapF <= kF && kF <= kMaxOverlapF) {
|
|
481
|
+
const iR = (d - 1 - (kF + baDeltaLength)) / 2;
|
|
482
|
+
if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) {
|
|
483
|
+
const bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1);
|
|
484
|
+
const nCommonR = countCommonItemsR(
|
|
485
|
+
aStart,
|
|
609
486
|
aLastPrev,
|
|
610
|
-
|
|
487
|
+
bStart,
|
|
611
488
|
bLastPrev,
|
|
612
|
-
bEnd,
|
|
613
489
|
isCommon
|
|
614
490
|
);
|
|
491
|
+
const aIndexPrevFirst = aLastPrev - nCommonR;
|
|
492
|
+
const bIndexPrevFirst = bLastPrev - nCommonR;
|
|
493
|
+
const aEndPreceding = aIndexPrevFirst + 1;
|
|
494
|
+
const bEndPreceding = bIndexPrevFirst + 1;
|
|
495
|
+
division.nChangePreceding = d - 1;
|
|
496
|
+
if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) {
|
|
497
|
+
division.aEndPreceding = aStart;
|
|
498
|
+
division.bEndPreceding = bStart;
|
|
499
|
+
} else {
|
|
500
|
+
division.aEndPreceding = aEndPreceding;
|
|
501
|
+
division.bEndPreceding = bEndPreceding;
|
|
502
|
+
}
|
|
503
|
+
division.nCommonPreceding = nCommonR;
|
|
504
|
+
if (nCommonR !== 0) {
|
|
505
|
+
division.aCommonPreceding = aEndPreceding;
|
|
506
|
+
division.bCommonPreceding = bEndPreceding;
|
|
507
|
+
}
|
|
615
508
|
division.nCommonFollowing = nCommonF;
|
|
616
509
|
if (nCommonF !== 0) {
|
|
617
|
-
division.aCommonFollowing =
|
|
618
|
-
division.bCommonFollowing =
|
|
510
|
+
division.aCommonFollowing = aFirst + 1;
|
|
511
|
+
division.bCommonFollowing = bFirst + 1;
|
|
619
512
|
}
|
|
620
|
-
const aStartFollowing =
|
|
621
|
-
const bStartFollowing =
|
|
513
|
+
const aStartFollowing = aLast + 1;
|
|
514
|
+
const bStartFollowing = bFirst + nCommonF + 1;
|
|
515
|
+
division.nChangeFollowing = d - 1;
|
|
622
516
|
if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
|
|
623
517
|
division.aStartFollowing = aEnd;
|
|
624
518
|
division.bStartFollowing = bEnd;
|
|
@@ -626,241 +520,238 @@ const extendOverlappablePathsR = (d, aStart, aEnd, bStart, bEnd, isCommon, aInde
|
|
|
626
520
|
division.aStartFollowing = aStartFollowing;
|
|
627
521
|
division.bStartFollowing = bStartFollowing;
|
|
628
522
|
}
|
|
523
|
+
return true;
|
|
629
524
|
}
|
|
630
|
-
return true;
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
return false;
|
|
635
|
-
};
|
|
636
|
-
const divide = (nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division) => {
|
|
637
|
-
const bF = bStart - aStart;
|
|
638
|
-
const bR = bEnd - aEnd;
|
|
639
|
-
const aLength = aEnd - aStart;
|
|
640
|
-
const bLength = bEnd - bStart;
|
|
641
|
-
const baDeltaLength = bLength - aLength;
|
|
642
|
-
let iMaxF = aLength;
|
|
643
|
-
let iMaxR = aLength;
|
|
644
|
-
aIndexesF[0] = aStart - 1;
|
|
645
|
-
aIndexesR[0] = aEnd;
|
|
646
|
-
if (baDeltaLength % 2 === 0) {
|
|
647
|
-
const dMin = (nChange || baDeltaLength) / 2;
|
|
648
|
-
const dMax = (aLength + bLength) / 2;
|
|
649
|
-
for (let d = 1; d <= dMax; d += 1) {
|
|
650
|
-
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
|
|
651
|
-
if (d < dMin) {
|
|
652
|
-
iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
|
|
653
|
-
} else if (
|
|
654
|
-
// If a reverse path overlaps a forward path in the same diagonal,
|
|
655
|
-
// return a division of the index intervals at the middle change.
|
|
656
|
-
extendOverlappablePathsR(
|
|
657
|
-
d,
|
|
658
|
-
aStart,
|
|
659
|
-
aEnd,
|
|
660
|
-
bStart,
|
|
661
|
-
bEnd,
|
|
662
|
-
isCommon,
|
|
663
|
-
aIndexesF,
|
|
664
|
-
iMaxF,
|
|
665
|
-
aIndexesR,
|
|
666
|
-
iMaxR,
|
|
667
|
-
division
|
|
668
|
-
)
|
|
669
|
-
) {
|
|
670
|
-
return;
|
|
671
525
|
}
|
|
672
526
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
527
|
+
return false;
|
|
528
|
+
};
|
|
529
|
+
const extendOverlappablePathsR = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) => {
|
|
530
|
+
const bR = bEnd - aEnd;
|
|
531
|
+
const aLength = aEnd - aStart;
|
|
532
|
+
const bLength = bEnd - bStart;
|
|
533
|
+
const baDeltaLength = bLength - aLength;
|
|
534
|
+
const kMinOverlapR = baDeltaLength - d;
|
|
535
|
+
const kMaxOverlapR = baDeltaLength + d;
|
|
536
|
+
let aIndexPrev1 = NOT_YET_SET;
|
|
537
|
+
const nR = d < iMaxR ? d : iMaxR;
|
|
538
|
+
for (let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) {
|
|
539
|
+
const insert = iR === 0 || iR !== d && aIndexesR[iR] < aIndexPrev1;
|
|
540
|
+
const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1;
|
|
541
|
+
const aFirst = insert ? aLastPrev : aLastPrev - 1;
|
|
542
|
+
const bFirst = bR + aFirst - kR;
|
|
543
|
+
const nCommonR = countCommonItemsR(
|
|
681
544
|
aStart,
|
|
545
|
+
aFirst - 1,
|
|
682
546
|
bStart,
|
|
683
|
-
|
|
684
|
-
isCommon
|
|
685
|
-
aIndexesR,
|
|
686
|
-
iMaxR
|
|
547
|
+
bFirst - 1,
|
|
548
|
+
isCommon
|
|
687
549
|
);
|
|
688
|
-
|
|
550
|
+
const aLast = aFirst - nCommonR;
|
|
551
|
+
aIndexPrev1 = aIndexesR[iR];
|
|
552
|
+
aIndexesR[iR] = aLast;
|
|
553
|
+
if (kMinOverlapR <= kR && kR <= kMaxOverlapR) {
|
|
554
|
+
const iF = (d + (kR - baDeltaLength)) / 2;
|
|
555
|
+
if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) {
|
|
556
|
+
const bLast = bFirst - nCommonR;
|
|
557
|
+
division.nChangePreceding = d;
|
|
558
|
+
if (d === aLast + bLast - aStart - bStart) {
|
|
559
|
+
division.aEndPreceding = aStart;
|
|
560
|
+
division.bEndPreceding = bStart;
|
|
561
|
+
} else {
|
|
562
|
+
division.aEndPreceding = aLast;
|
|
563
|
+
division.bEndPreceding = bLast;
|
|
564
|
+
}
|
|
565
|
+
division.nCommonPreceding = nCommonR;
|
|
566
|
+
if (nCommonR !== 0) {
|
|
567
|
+
division.aCommonPreceding = aLast;
|
|
568
|
+
division.bCommonPreceding = bLast;
|
|
569
|
+
}
|
|
570
|
+
division.nChangeFollowing = d - 1;
|
|
571
|
+
if (d === 1) {
|
|
572
|
+
division.nCommonFollowing = 0;
|
|
573
|
+
division.aStartFollowing = aEnd;
|
|
574
|
+
division.bStartFollowing = bEnd;
|
|
575
|
+
} else {
|
|
576
|
+
const bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1);
|
|
577
|
+
const nCommonF = countCommonItemsF(
|
|
578
|
+
aLastPrev,
|
|
579
|
+
aEnd,
|
|
580
|
+
bLastPrev,
|
|
581
|
+
bEnd,
|
|
582
|
+
isCommon
|
|
583
|
+
);
|
|
584
|
+
division.nCommonFollowing = nCommonF;
|
|
585
|
+
if (nCommonF !== 0) {
|
|
586
|
+
division.aCommonFollowing = aLastPrev;
|
|
587
|
+
division.bCommonFollowing = bLastPrev;
|
|
588
|
+
}
|
|
589
|
+
const aStartFollowing = aLastPrev + nCommonF;
|
|
590
|
+
const bStartFollowing = bLastPrev + nCommonF;
|
|
591
|
+
if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
|
|
592
|
+
division.aStartFollowing = aEnd;
|
|
593
|
+
division.bStartFollowing = bEnd;
|
|
594
|
+
} else {
|
|
595
|
+
division.aStartFollowing = aStartFollowing;
|
|
596
|
+
division.bStartFollowing = bStartFollowing;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
return true;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return false;
|
|
604
|
+
};
|
|
605
|
+
const divide = (nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division) => {
|
|
606
|
+
const bF = bStart - aStart;
|
|
607
|
+
const bR = bEnd - aEnd;
|
|
608
|
+
const aLength = aEnd - aStart;
|
|
609
|
+
const bLength = bEnd - bStart;
|
|
610
|
+
const baDeltaLength = bLength - aLength;
|
|
611
|
+
let iMaxF = aLength;
|
|
612
|
+
let iMaxR = aLength;
|
|
613
|
+
aIndexesF[0] = aStart - 1;
|
|
614
|
+
aIndexesR[0] = aEnd;
|
|
615
|
+
if (baDeltaLength % 2 === 0) {
|
|
616
|
+
const dMin = (nChange || baDeltaLength) / 2;
|
|
617
|
+
const dMax = (aLength + bLength) / 2;
|
|
618
|
+
for (let d = 1; d <= dMax; d += 1) {
|
|
689
619
|
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
620
|
+
if (d < dMin) {
|
|
621
|
+
iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
|
|
622
|
+
} else if (
|
|
623
|
+
// If a reverse path overlaps a forward path in the same diagonal,
|
|
624
|
+
// return a division of the index intervals at the middle change.
|
|
625
|
+
extendOverlappablePathsR(
|
|
626
|
+
d,
|
|
627
|
+
aStart,
|
|
628
|
+
aEnd,
|
|
629
|
+
bStart,
|
|
630
|
+
bEnd,
|
|
631
|
+
isCommon,
|
|
632
|
+
aIndexesF,
|
|
633
|
+
iMaxF,
|
|
634
|
+
aIndexesR,
|
|
635
|
+
iMaxR,
|
|
636
|
+
division
|
|
637
|
+
)
|
|
638
|
+
) {
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
} else {
|
|
643
|
+
const dMin = ((nChange || baDeltaLength) + 1) / 2;
|
|
644
|
+
const dMax = (aLength + bLength + 1) / 2;
|
|
645
|
+
let d = 1;
|
|
646
|
+
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
|
|
647
|
+
for (d += 1; d <= dMax; d += 1) {
|
|
648
|
+
iMaxR = extendPathsR(
|
|
649
|
+
d - 1,
|
|
695
650
|
aStart,
|
|
696
|
-
aEnd,
|
|
697
651
|
bStart,
|
|
698
|
-
|
|
652
|
+
bR,
|
|
699
653
|
isCommon,
|
|
700
|
-
aIndexesF,
|
|
701
|
-
iMaxF,
|
|
702
654
|
aIndexesR,
|
|
703
|
-
iMaxR
|
|
704
|
-
|
|
705
|
-
)
|
|
706
|
-
|
|
707
|
-
|
|
655
|
+
iMaxR
|
|
656
|
+
);
|
|
657
|
+
if (d < dMin) {
|
|
658
|
+
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
|
|
659
|
+
} else if (
|
|
660
|
+
// If a forward path overlaps a reverse path in the same diagonal,
|
|
661
|
+
// return a division of the index intervals at the middle change.
|
|
662
|
+
extendOverlappablePathsF(
|
|
663
|
+
d,
|
|
664
|
+
aStart,
|
|
665
|
+
aEnd,
|
|
666
|
+
bStart,
|
|
667
|
+
bEnd,
|
|
668
|
+
isCommon,
|
|
669
|
+
aIndexesF,
|
|
670
|
+
iMaxF,
|
|
671
|
+
aIndexesR,
|
|
672
|
+
iMaxR,
|
|
673
|
+
division
|
|
674
|
+
)
|
|
675
|
+
) {
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
708
678
|
}
|
|
709
679
|
}
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
}
|
|
680
|
+
throw new Error(
|
|
681
|
+
`${pkg}: no overlap aStart=${aStart} aEnd=${aEnd} bStart=${bStart} bEnd=${bEnd}`
|
|
682
|
+
);
|
|
683
|
+
};
|
|
684
|
+
const findSubsequences = (nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division) => {
|
|
685
|
+
if (bEnd - bStart < aEnd - aStart) {
|
|
686
|
+
transposed = !transposed;
|
|
687
|
+
if (transposed && callbacks.length === 1) {
|
|
688
|
+
const { foundSubsequence: foundSubsequence2, isCommon: isCommon2 } = callbacks[0];
|
|
689
|
+
callbacks[1] = {
|
|
690
|
+
foundSubsequence: (nCommon, bCommon, aCommon) => {
|
|
691
|
+
foundSubsequence2(nCommon, aCommon, bCommon);
|
|
692
|
+
},
|
|
693
|
+
isCommon: (bIndex, aIndex) => isCommon2(aIndex, bIndex)
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
const tStart = aStart;
|
|
697
|
+
const tEnd = aEnd;
|
|
698
|
+
aStart = bStart;
|
|
699
|
+
aEnd = bEnd;
|
|
700
|
+
bStart = tStart;
|
|
701
|
+
bEnd = tEnd;
|
|
726
702
|
}
|
|
727
|
-
const
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
aEnd = bEnd;
|
|
731
|
-
bStart = tStart;
|
|
732
|
-
bEnd = tEnd;
|
|
733
|
-
}
|
|
734
|
-
const { foundSubsequence, isCommon } = callbacks[transposed ? 1 : 0];
|
|
735
|
-
divide(
|
|
736
|
-
nChange,
|
|
737
|
-
aStart,
|
|
738
|
-
aEnd,
|
|
739
|
-
bStart,
|
|
740
|
-
bEnd,
|
|
741
|
-
isCommon,
|
|
742
|
-
aIndexesF,
|
|
743
|
-
aIndexesR,
|
|
744
|
-
division
|
|
745
|
-
);
|
|
746
|
-
const {
|
|
747
|
-
nChangePreceding,
|
|
748
|
-
aEndPreceding,
|
|
749
|
-
bEndPreceding,
|
|
750
|
-
nCommonPreceding,
|
|
751
|
-
aCommonPreceding,
|
|
752
|
-
bCommonPreceding,
|
|
753
|
-
nCommonFollowing,
|
|
754
|
-
aCommonFollowing,
|
|
755
|
-
bCommonFollowing,
|
|
756
|
-
nChangeFollowing,
|
|
757
|
-
aStartFollowing,
|
|
758
|
-
bStartFollowing
|
|
759
|
-
} = division;
|
|
760
|
-
if (aStart < aEndPreceding && bStart < bEndPreceding) {
|
|
761
|
-
findSubsequences(
|
|
762
|
-
nChangePreceding,
|
|
703
|
+
const { foundSubsequence, isCommon } = callbacks[transposed ? 1 : 0];
|
|
704
|
+
divide(
|
|
705
|
+
nChange,
|
|
763
706
|
aStart,
|
|
764
|
-
|
|
707
|
+
aEnd,
|
|
765
708
|
bStart,
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
callbacks,
|
|
709
|
+
bEnd,
|
|
710
|
+
isCommon,
|
|
769
711
|
aIndexesF,
|
|
770
712
|
aIndexesR,
|
|
771
713
|
division
|
|
772
714
|
);
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
715
|
+
const {
|
|
716
|
+
nChangePreceding,
|
|
717
|
+
aEndPreceding,
|
|
718
|
+
bEndPreceding,
|
|
719
|
+
nCommonPreceding,
|
|
720
|
+
aCommonPreceding,
|
|
721
|
+
bCommonPreceding,
|
|
722
|
+
nCommonFollowing,
|
|
723
|
+
aCommonFollowing,
|
|
724
|
+
bCommonFollowing,
|
|
782
725
|
nChangeFollowing,
|
|
783
726
|
aStartFollowing,
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
transposed,
|
|
788
|
-
callbacks,
|
|
789
|
-
aIndexesF,
|
|
790
|
-
aIndexesR,
|
|
791
|
-
division
|
|
792
|
-
);
|
|
793
|
-
}
|
|
794
|
-
};
|
|
795
|
-
const validateLength = (name, arg) => {
|
|
796
|
-
if (typeof arg !== "number") {
|
|
797
|
-
throw new TypeError(`${pkg}: ${name} typeof ${typeof arg} is not a number`);
|
|
798
|
-
}
|
|
799
|
-
if (!Number.isSafeInteger(arg)) {
|
|
800
|
-
throw new RangeError(`${pkg}: ${name} value ${arg} is not a safe integer`);
|
|
801
|
-
}
|
|
802
|
-
if (arg < 0) {
|
|
803
|
-
throw new RangeError(`${pkg}: ${name} value ${arg} is a negative integer`);
|
|
804
|
-
}
|
|
805
|
-
};
|
|
806
|
-
const validateCallback = (name, arg) => {
|
|
807
|
-
const type = typeof arg;
|
|
808
|
-
if (type !== "function") {
|
|
809
|
-
throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`);
|
|
810
|
-
}
|
|
811
|
-
};
|
|
812
|
-
function diffSequence(aLength, bLength, isCommon, foundSubsequence) {
|
|
813
|
-
validateLength("aLength", aLength);
|
|
814
|
-
validateLength("bLength", bLength);
|
|
815
|
-
validateCallback("isCommon", isCommon);
|
|
816
|
-
validateCallback("foundSubsequence", foundSubsequence);
|
|
817
|
-
const nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon);
|
|
818
|
-
if (nCommonF !== 0) {
|
|
819
|
-
foundSubsequence(nCommonF, 0, 0);
|
|
820
|
-
}
|
|
821
|
-
if (aLength !== nCommonF || bLength !== nCommonF) {
|
|
822
|
-
const aStart = nCommonF;
|
|
823
|
-
const bStart = nCommonF;
|
|
824
|
-
const nCommonR = countCommonItemsR(
|
|
825
|
-
aStart,
|
|
826
|
-
aLength - 1,
|
|
827
|
-
bStart,
|
|
828
|
-
bLength - 1,
|
|
829
|
-
isCommon
|
|
830
|
-
);
|
|
831
|
-
const aEnd = aLength - nCommonR;
|
|
832
|
-
const bEnd = bLength - nCommonR;
|
|
833
|
-
const nCommonFR = nCommonF + nCommonR;
|
|
834
|
-
if (aLength !== nCommonFR && bLength !== nCommonFR) {
|
|
835
|
-
const nChange = 0;
|
|
836
|
-
const transposed = false;
|
|
837
|
-
const callbacks = [
|
|
838
|
-
{
|
|
839
|
-
foundSubsequence,
|
|
840
|
-
isCommon
|
|
841
|
-
}
|
|
842
|
-
];
|
|
843
|
-
const aIndexesF = [NOT_YET_SET];
|
|
844
|
-
const aIndexesR = [NOT_YET_SET];
|
|
845
|
-
const division = {
|
|
846
|
-
aCommonFollowing: NOT_YET_SET,
|
|
847
|
-
aCommonPreceding: NOT_YET_SET,
|
|
848
|
-
aEndPreceding: NOT_YET_SET,
|
|
849
|
-
aStartFollowing: NOT_YET_SET,
|
|
850
|
-
bCommonFollowing: NOT_YET_SET,
|
|
851
|
-
bCommonPreceding: NOT_YET_SET,
|
|
852
|
-
bEndPreceding: NOT_YET_SET,
|
|
853
|
-
bStartFollowing: NOT_YET_SET,
|
|
854
|
-
nChangeFollowing: NOT_YET_SET,
|
|
855
|
-
nChangePreceding: NOT_YET_SET,
|
|
856
|
-
nCommonFollowing: NOT_YET_SET,
|
|
857
|
-
nCommonPreceding: NOT_YET_SET
|
|
858
|
-
};
|
|
727
|
+
bStartFollowing
|
|
728
|
+
} = division;
|
|
729
|
+
if (aStart < aEndPreceding && bStart < bEndPreceding) {
|
|
859
730
|
findSubsequences(
|
|
860
|
-
|
|
731
|
+
nChangePreceding,
|
|
861
732
|
aStart,
|
|
862
|
-
|
|
733
|
+
aEndPreceding,
|
|
863
734
|
bStart,
|
|
735
|
+
bEndPreceding,
|
|
736
|
+
transposed,
|
|
737
|
+
callbacks,
|
|
738
|
+
aIndexesF,
|
|
739
|
+
aIndexesR,
|
|
740
|
+
division
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
if (nCommonPreceding !== 0) {
|
|
744
|
+
foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding);
|
|
745
|
+
}
|
|
746
|
+
if (nCommonFollowing !== 0) {
|
|
747
|
+
foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing);
|
|
748
|
+
}
|
|
749
|
+
if (aStartFollowing < aEnd && bStartFollowing < bEnd) {
|
|
750
|
+
findSubsequences(
|
|
751
|
+
nChangeFollowing,
|
|
752
|
+
aStartFollowing,
|
|
753
|
+
aEnd,
|
|
754
|
+
bStartFollowing,
|
|
864
755
|
bEnd,
|
|
865
756
|
transposed,
|
|
866
757
|
callbacks,
|
|
@@ -869,11 +760,93 @@ function diffSequence(aLength, bLength, isCommon, foundSubsequence) {
|
|
|
869
760
|
division
|
|
870
761
|
);
|
|
871
762
|
}
|
|
872
|
-
|
|
873
|
-
|
|
763
|
+
};
|
|
764
|
+
const validateLength = (name, arg) => {
|
|
765
|
+
if (typeof arg !== "number") {
|
|
766
|
+
throw new TypeError(`${pkg}: ${name} typeof ${typeof arg} is not a number`);
|
|
767
|
+
}
|
|
768
|
+
if (!Number.isSafeInteger(arg)) {
|
|
769
|
+
throw new RangeError(`${pkg}: ${name} value ${arg} is not a safe integer`);
|
|
770
|
+
}
|
|
771
|
+
if (arg < 0) {
|
|
772
|
+
throw new RangeError(`${pkg}: ${name} value ${arg} is a negative integer`);
|
|
773
|
+
}
|
|
774
|
+
};
|
|
775
|
+
const validateCallback = (name, arg) => {
|
|
776
|
+
const type = typeof arg;
|
|
777
|
+
if (type !== "function") {
|
|
778
|
+
throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`);
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
function diffSequence(aLength, bLength, isCommon, foundSubsequence) {
|
|
782
|
+
validateLength("aLength", aLength);
|
|
783
|
+
validateLength("bLength", bLength);
|
|
784
|
+
validateCallback("isCommon", isCommon);
|
|
785
|
+
validateCallback("foundSubsequence", foundSubsequence);
|
|
786
|
+
const nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon);
|
|
787
|
+
if (nCommonF !== 0) {
|
|
788
|
+
foundSubsequence(nCommonF, 0, 0);
|
|
789
|
+
}
|
|
790
|
+
if (aLength !== nCommonF || bLength !== nCommonF) {
|
|
791
|
+
const aStart = nCommonF;
|
|
792
|
+
const bStart = nCommonF;
|
|
793
|
+
const nCommonR = countCommonItemsR(
|
|
794
|
+
aStart,
|
|
795
|
+
aLength - 1,
|
|
796
|
+
bStart,
|
|
797
|
+
bLength - 1,
|
|
798
|
+
isCommon
|
|
799
|
+
);
|
|
800
|
+
const aEnd = aLength - nCommonR;
|
|
801
|
+
const bEnd = bLength - nCommonR;
|
|
802
|
+
const nCommonFR = nCommonF + nCommonR;
|
|
803
|
+
if (aLength !== nCommonFR && bLength !== nCommonFR) {
|
|
804
|
+
const nChange = 0;
|
|
805
|
+
const transposed = false;
|
|
806
|
+
const callbacks = [
|
|
807
|
+
{
|
|
808
|
+
foundSubsequence,
|
|
809
|
+
isCommon
|
|
810
|
+
}
|
|
811
|
+
];
|
|
812
|
+
const aIndexesF = [NOT_YET_SET];
|
|
813
|
+
const aIndexesR = [NOT_YET_SET];
|
|
814
|
+
const division = {
|
|
815
|
+
aCommonFollowing: NOT_YET_SET,
|
|
816
|
+
aCommonPreceding: NOT_YET_SET,
|
|
817
|
+
aEndPreceding: NOT_YET_SET,
|
|
818
|
+
aStartFollowing: NOT_YET_SET,
|
|
819
|
+
bCommonFollowing: NOT_YET_SET,
|
|
820
|
+
bCommonPreceding: NOT_YET_SET,
|
|
821
|
+
bEndPreceding: NOT_YET_SET,
|
|
822
|
+
bStartFollowing: NOT_YET_SET,
|
|
823
|
+
nChangeFollowing: NOT_YET_SET,
|
|
824
|
+
nChangePreceding: NOT_YET_SET,
|
|
825
|
+
nCommonFollowing: NOT_YET_SET,
|
|
826
|
+
nCommonPreceding: NOT_YET_SET
|
|
827
|
+
};
|
|
828
|
+
findSubsequences(
|
|
829
|
+
nChange,
|
|
830
|
+
aStart,
|
|
831
|
+
aEnd,
|
|
832
|
+
bStart,
|
|
833
|
+
bEnd,
|
|
834
|
+
transposed,
|
|
835
|
+
callbacks,
|
|
836
|
+
aIndexesF,
|
|
837
|
+
aIndexesR,
|
|
838
|
+
division
|
|
839
|
+
);
|
|
840
|
+
}
|
|
841
|
+
if (nCommonR !== 0) {
|
|
842
|
+
foundSubsequence(nCommonR, aEnd, bEnd);
|
|
843
|
+
}
|
|
874
844
|
}
|
|
875
845
|
}
|
|
846
|
+
return build;
|
|
876
847
|
}
|
|
848
|
+
var buildExports = requireBuild();
|
|
849
|
+
var diffSequences = /* @__PURE__ */ getDefaultExportFromCjs(buildExports);
|
|
877
850
|
function formatTrailingSpaces(line, trailingSpaceFormatter) {
|
|
878
851
|
return line.replace(/\s+$/, (match) => trailingSpaceFormatter(match));
|
|
879
852
|
}
|
|
@@ -1089,14 +1062,14 @@ const DIFF_TRUNCATE_THRESHOLD_DEFAULT = 0;
|
|
|
1089
1062
|
function getDefaultOptions() {
|
|
1090
1063
|
return {
|
|
1091
1064
|
aAnnotation: "Expected",
|
|
1092
|
-
aColor:
|
|
1065
|
+
aColor: s.green,
|
|
1093
1066
|
aIndicator: "-",
|
|
1094
1067
|
bAnnotation: "Received",
|
|
1095
|
-
bColor:
|
|
1068
|
+
bColor: s.red,
|
|
1096
1069
|
bIndicator: "+",
|
|
1097
|
-
changeColor:
|
|
1070
|
+
changeColor: s.inverse,
|
|
1098
1071
|
changeLineTrailingSpaceColor: noColor,
|
|
1099
|
-
commonColor:
|
|
1072
|
+
commonColor: s.dim,
|
|
1100
1073
|
commonIndicator: " ",
|
|
1101
1074
|
commonLineTrailingSpaceColor: noColor,
|
|
1102
1075
|
compareKeys: void 0,
|
|
@@ -1105,7 +1078,8 @@ function getDefaultOptions() {
|
|
|
1105
1078
|
expand: true,
|
|
1106
1079
|
includeChangeCounts: false,
|
|
1107
1080
|
omitAnnotationLines: false,
|
|
1108
|
-
patchColor:
|
|
1081
|
+
patchColor: s.yellow,
|
|
1082
|
+
printBasicPrototype: false,
|
|
1109
1083
|
truncateThreshold: DIFF_TRUNCATE_THRESHOLD_DEFAULT,
|
|
1110
1084
|
truncateAnnotation: "... Diff result is truncated",
|
|
1111
1085
|
truncateAnnotationColor: noColor
|
|
@@ -1251,7 +1225,7 @@ function diffLinesRaw(aLines, bLines, options) {
|
|
|
1251
1225
|
diffs.push(new Diff(DIFF_EQUAL, bLines[bIndex]));
|
|
1252
1226
|
}
|
|
1253
1227
|
};
|
|
1254
|
-
|
|
1228
|
+
diffSequences(aLength, bLength, isCommon, foundSubsequence);
|
|
1255
1229
|
for (; aIndex !== aLength; aIndex += 1) {
|
|
1256
1230
|
diffs.push(new Diff(DIFF_DELETE, aLines[aIndex]));
|
|
1257
1231
|
}
|
|
@@ -1260,6 +1234,41 @@ function diffLinesRaw(aLines, bLines, options) {
|
|
|
1260
1234
|
}
|
|
1261
1235
|
return [diffs, truncated];
|
|
1262
1236
|
}
|
|
1237
|
+
function getType(value) {
|
|
1238
|
+
if (value === void 0) {
|
|
1239
|
+
return "undefined";
|
|
1240
|
+
} else if (value === null) {
|
|
1241
|
+
return "null";
|
|
1242
|
+
} else if (Array.isArray(value)) {
|
|
1243
|
+
return "array";
|
|
1244
|
+
} else if (typeof value === "boolean") {
|
|
1245
|
+
return "boolean";
|
|
1246
|
+
} else if (typeof value === "function") {
|
|
1247
|
+
return "function";
|
|
1248
|
+
} else if (typeof value === "number") {
|
|
1249
|
+
return "number";
|
|
1250
|
+
} else if (typeof value === "string") {
|
|
1251
|
+
return "string";
|
|
1252
|
+
} else if (typeof value === "bigint") {
|
|
1253
|
+
return "bigint";
|
|
1254
|
+
} else if (typeof value === "object") {
|
|
1255
|
+
if (value != null) {
|
|
1256
|
+
if (value.constructor === RegExp) {
|
|
1257
|
+
return "regexp";
|
|
1258
|
+
} else if (value.constructor === Map) {
|
|
1259
|
+
return "map";
|
|
1260
|
+
} else if (value.constructor === Set) {
|
|
1261
|
+
return "set";
|
|
1262
|
+
} else if (value.constructor === Date) {
|
|
1263
|
+
return "date";
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
return "object";
|
|
1267
|
+
} else if (typeof value === "symbol") {
|
|
1268
|
+
return "symbol";
|
|
1269
|
+
}
|
|
1270
|
+
throw new Error(`value of unknown type: ${value}`);
|
|
1271
|
+
}
|
|
1263
1272
|
function getNewLineSymbol(string) {
|
|
1264
1273
|
return string.includes("\r\n") ? "\r\n" : "\n";
|
|
1265
1274
|
}
|
|
@@ -1299,7 +1308,7 @@ function diffStrings(a, b, options) {
|
|
|
1299
1308
|
bIndex = bCommon + nCommon;
|
|
1300
1309
|
diffs.push(new Diff(DIFF_EQUAL, b.slice(bCommon, bIndex)));
|
|
1301
1310
|
};
|
|
1302
|
-
|
|
1311
|
+
diffSequences(aLength, bLength, isCommon, foundSubsequence);
|
|
1303
1312
|
if (aIndex !== aLength) {
|
|
1304
1313
|
diffs.push(new Diff(DIFF_DELETE, a.slice(aIndex)));
|
|
1305
1314
|
}
|
|
@@ -1504,14 +1513,15 @@ const PLUGINS = [
|
|
|
1504
1513
|
DOMElement,
|
|
1505
1514
|
DOMCollection,
|
|
1506
1515
|
Immutable,
|
|
1507
|
-
AsymmetricMatcher
|
|
1516
|
+
AsymmetricMatcher,
|
|
1517
|
+
plugins.Error
|
|
1508
1518
|
];
|
|
1509
1519
|
const FORMAT_OPTIONS = {
|
|
1510
1520
|
plugins: PLUGINS
|
|
1511
1521
|
};
|
|
1512
1522
|
const FALLBACK_FORMAT_OPTIONS = {
|
|
1513
1523
|
callToJSON: false,
|
|
1514
|
-
maxDepth:
|
|
1524
|
+
maxDepth: 8,
|
|
1515
1525
|
plugins: PLUGINS
|
|
1516
1526
|
};
|
|
1517
1527
|
function diff(a, b, options) {
|
|
@@ -1532,10 +1542,16 @@ function diff(a, b, options) {
|
|
|
1532
1542
|
omitDifference = expectedType === "string";
|
|
1533
1543
|
}
|
|
1534
1544
|
if (expectedType !== getType(b)) {
|
|
1545
|
+
let truncate2 = function(s2) {
|
|
1546
|
+
return s2.length <= MAX_LENGTH ? s2 : `${s2.slice(0, MAX_LENGTH)}...`;
|
|
1547
|
+
};
|
|
1535
1548
|
const { aAnnotation, aColor, aIndicator, bAnnotation, bColor, bIndicator } = normalizeDiffOptions(options);
|
|
1536
1549
|
const formatOptions = getFormatOptions(FALLBACK_FORMAT_OPTIONS, options);
|
|
1537
|
-
|
|
1538
|
-
|
|
1550
|
+
let aDisplay = format(a, formatOptions);
|
|
1551
|
+
let bDisplay = format(b, formatOptions);
|
|
1552
|
+
const MAX_LENGTH = 1e5;
|
|
1553
|
+
aDisplay = truncate2(aDisplay);
|
|
1554
|
+
bDisplay = truncate2(bDisplay);
|
|
1539
1555
|
const aDiff = `${aColor(`${aIndicator} ${aAnnotation}:`)}
|
|
1540
1556
|
${aDisplay}`;
|
|
1541
1557
|
const bDiff = `${bColor(`${bIndicator} ${bAnnotation}:`)}
|
|
@@ -1597,10 +1613,11 @@ ${difference}`;
|
|
|
1597
1613
|
return difference;
|
|
1598
1614
|
}
|
|
1599
1615
|
function getFormatOptions(formatOptions, options) {
|
|
1600
|
-
const { compareKeys } = normalizeDiffOptions(options);
|
|
1616
|
+
const { compareKeys, printBasicPrototype } = normalizeDiffOptions(options);
|
|
1601
1617
|
return {
|
|
1602
1618
|
...formatOptions,
|
|
1603
|
-
compareKeys
|
|
1619
|
+
compareKeys,
|
|
1620
|
+
printBasicPrototype
|
|
1604
1621
|
};
|
|
1605
1622
|
}
|
|
1606
1623
|
function getObjectsDifference(a, b, formatOptions, options) {
|
|
@@ -1631,13 +1648,13 @@ function isReplaceable(obj1, obj2) {
|
|
|
1631
1648
|
const obj2Type = getType$1(obj2);
|
|
1632
1649
|
return obj1Type === obj2Type && (obj1Type === "Object" || obj1Type === "Array");
|
|
1633
1650
|
}
|
|
1634
|
-
function printDiffOrStringify(
|
|
1651
|
+
function printDiffOrStringify(received, expected, options) {
|
|
1635
1652
|
const { aAnnotation, bAnnotation } = normalizeDiffOptions(options);
|
|
1636
1653
|
if (typeof expected === "string" && typeof received === "string" && expected.length > 0 && received.length > 0 && expected.length <= MAX_DIFF_STRING_LENGTH && received.length <= MAX_DIFF_STRING_LENGTH && expected !== received) {
|
|
1637
1654
|
if (expected.includes("\n") || received.includes("\n")) {
|
|
1638
|
-
return diffStringsUnified(
|
|
1655
|
+
return diffStringsUnified(expected, received, options);
|
|
1639
1656
|
}
|
|
1640
|
-
const [diffs] = diffStringsRaw(
|
|
1657
|
+
const [diffs] = diffStringsRaw(expected, received);
|
|
1641
1658
|
const hasCommonDiff2 = diffs.some((diff2) => diff2[0] === DIFF_EQUAL);
|
|
1642
1659
|
const printLabel = getLabelPrinter(aAnnotation, bAnnotation);
|
|
1643
1660
|
const expectedLine = printLabel(aAnnotation) + printExpected(
|
|
@@ -1651,11 +1668,18 @@ ${receivedLine}`;
|
|
|
1651
1668
|
}
|
|
1652
1669
|
const clonedExpected = deepClone(expected, { forceWritable: true });
|
|
1653
1670
|
const clonedReceived = deepClone(received, { forceWritable: true });
|
|
1654
|
-
const { replacedExpected, replacedActual } = replaceAsymmetricMatcher(
|
|
1671
|
+
const { replacedExpected, replacedActual } = replaceAsymmetricMatcher(clonedReceived, clonedExpected);
|
|
1655
1672
|
const difference = diff(replacedExpected, replacedActual, options);
|
|
1656
1673
|
return difference;
|
|
1657
1674
|
}
|
|
1658
1675
|
function replaceAsymmetricMatcher(actual, expected, actualReplaced = /* @__PURE__ */ new WeakSet(), expectedReplaced = /* @__PURE__ */ new WeakSet()) {
|
|
1676
|
+
if (actual instanceof Error && expected instanceof Error && typeof actual.cause !== "undefined" && typeof expected.cause === "undefined") {
|
|
1677
|
+
delete actual.cause;
|
|
1678
|
+
return {
|
|
1679
|
+
replacedActual: actual,
|
|
1680
|
+
replacedExpected: expected
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1659
1683
|
if (!isReplaceable(actual, expected)) {
|
|
1660
1684
|
return { replacedActual: actual, replacedExpected: expected };
|
|
1661
1685
|
}
|
|
@@ -1703,14 +1727,14 @@ function replaceTrailingSpaces(text) {
|
|
|
1703
1727
|
return text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length));
|
|
1704
1728
|
}
|
|
1705
1729
|
function printReceived(object) {
|
|
1706
|
-
return
|
|
1730
|
+
return s.red(replaceTrailingSpaces(stringify(object)));
|
|
1707
1731
|
}
|
|
1708
1732
|
function printExpected(value) {
|
|
1709
|
-
return
|
|
1733
|
+
return s.green(replaceTrailingSpaces(stringify(value)));
|
|
1710
1734
|
}
|
|
1711
1735
|
function getCommonAndChangedSubstrings(diffs, op, hasCommonDiff2) {
|
|
1712
1736
|
return diffs.reduce(
|
|
1713
|
-
(reduced, diff2) => reduced + (diff2[0] === DIFF_EQUAL ? diff2[1] : diff2[0] === op ? hasCommonDiff2 ?
|
|
1737
|
+
(reduced, diff2) => reduced + (diff2[0] === DIFF_EQUAL ? diff2[1] : diff2[0] === op ? hasCommonDiff2 ? s.inverse(diff2[1]) : diff2[1] : ""),
|
|
1714
1738
|
""
|
|
1715
1739
|
);
|
|
1716
1740
|
}
|