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