@eggjs/mock 6.1.0-beta.8 → 7.0.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +1 -1
  2. package/README.zh_CN.md +1 -1
  3. package/dist/_virtual/rolldown_runtime.js +1 -24
  4. package/dist/inject_mocha.d.ts +1 -1
  5. package/dist/inject_mocha.js +2 -3
  6. package/dist/lib/context.js +1 -3
  7. package/package.json +9 -11
  8. package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +0 -142
  9. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js +0 -157
  10. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js +0 -97
  11. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js +0 -40
  12. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +0 -814
  13. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +0 -50
  14. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +0 -68
  15. package/dist/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +0 -752
  16. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js +0 -203
  17. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js +0 -209
  18. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js +0 -18
  19. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js +0 -215
  20. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/dmp.js +0 -24
  21. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/xml.js +0 -33
  22. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/array.js +0 -29
  23. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/base.js +0 -185
  24. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/character.js +0 -23
  25. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/css.js +0 -26
  26. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/json.js +0 -83
  27. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/line.js +0 -51
  28. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/sentence.js +0 -26
  29. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/word.js +0 -151
  30. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js +0 -178
  31. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js +0 -168
  32. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js +0 -301
  33. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js +0 -137
  34. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js +0 -367
  35. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js +0 -91
  36. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js +0 -99
  37. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/array.js +0 -23
  38. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/distance-iterator.js +0 -30
  39. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/params.js +0 -22
  40. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/string.js +0 -97
  41. package/dist/node_modules/.pnpm/escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js +0 -14
  42. package/dist/node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js +0 -16
  43. package/dist/node_modules/.pnpm/he@1.2.0/node_modules/he/he.js +0 -4093
  44. package/dist/node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js +0 -14
  45. package/dist/node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js +0 -27
  46. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/index.js +0 -12
  47. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/context.js +0 -83
  48. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/error-constants.js +0 -35
  49. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/errors.js +0 -392
  50. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/hook.js +0 -86
  51. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js +0 -104
  52. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js +0 -99
  53. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js +0 -65
  54. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js +0 -18
  55. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js +0 -95
  56. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js +0 -105
  57. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocha.js +0 -1037
  58. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocharc.js +0 -24
  59. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/buffered-worker-pool.js +0 -152
  60. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/esm-utils.js +0 -74
  61. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/file-unloader.js +0 -22
  62. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/parallel-buffered-runner.js +0 -329
  63. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/serializer.js +0 -314
  64. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/pending.js +0 -22
  65. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/base.js +0 -417
  66. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/doc.js +0 -79
  67. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/dot.js +0 -75
  68. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/html.js +0 -283
  69. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/index.js +0 -40
  70. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json-stream.js +0 -90
  71. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json.js +0 -145
  72. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/landing.js +0 -107
  73. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/list.js +0 -77
  74. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/markdown.js +0 -106
  75. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/min.js +0 -57
  76. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/nyan.js +0 -233
  77. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/progress.js +0 -92
  78. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/spec.js +0 -91
  79. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js +0 -261
  80. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js +0 -166
  81. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runnable.js +0 -346
  82. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runner.js +0 -922
  83. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/stats-collector.js +0 -72
  84. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/suite.js +0 -517
  85. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/test.js +0 -105
  86. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/utils.js +0 -505
  87. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/package.js +0 -225
  88. package/dist/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +0 -124
  89. package/dist/node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/index.js +0 -11
  90. package/dist/node_modules/.pnpm/serialize-javascript@6.0.2/node_modules/serialize-javascript/index.js +0 -114
  91. package/dist/node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js +0 -76
  92. package/dist/node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js +0 -89
  93. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Pool.js +0 -366
  94. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Promise.js +0 -248
  95. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/WorkerHandler.js +0 -419
  96. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/debug-port-allocator.js +0 -27
  97. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/environment.js +0 -18
  98. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/generated/embeddedWorker.js +0 -16
  99. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/index.js +0 -63
  100. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/transfer.js +0 -21
  101. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/validateOptions.js +0 -9
  102. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/worker.js +0 -277
@@ -1,137 +0,0 @@
1
- import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
-
3
- //#region ../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js
4
- var require_line_endings = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js": ((exports) => {
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isUnix = isUnix;
7
- exports.isWin = isWin;
8
- exports.unixToWin = unixToWin;
9
- exports.winToUnix = winToUnix;
10
- function _typeof(o) {
11
- "@babel/helpers - typeof";
12
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
13
- return typeof o$1;
14
- } : function(o$1) {
15
- return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
16
- }, _typeof(o);
17
- }
18
- function ownKeys(e, r) {
19
- var t = Object.keys(e);
20
- if (Object.getOwnPropertySymbols) {
21
- var o = Object.getOwnPropertySymbols(e);
22
- r && (o = o.filter(function(r$1) {
23
- return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
24
- })), t.push.apply(t, o);
25
- }
26
- return t;
27
- }
28
- function _objectSpread(e) {
29
- for (var r = 1; r < arguments.length; r++) {
30
- var t = null != arguments[r] ? arguments[r] : {};
31
- r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
32
- _defineProperty(e, r$1, t[r$1]);
33
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
34
- Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
35
- });
36
- }
37
- return e;
38
- }
39
- function _defineProperty(obj, key, value) {
40
- key = _toPropertyKey(key);
41
- if (key in obj) Object.defineProperty(obj, key, {
42
- value,
43
- enumerable: true,
44
- configurable: true,
45
- writable: true
46
- });
47
- else obj[key] = value;
48
- return obj;
49
- }
50
- function _toPropertyKey(t) {
51
- var i = _toPrimitive(t, "string");
52
- return "symbol" == _typeof(i) ? i : i + "";
53
- }
54
- function _toPrimitive(t, r) {
55
- if ("object" != _typeof(t) || !t) return t;
56
- var e = t[Symbol.toPrimitive];
57
- if (void 0 !== e) {
58
- var i = e.call(t, r || "default");
59
- if ("object" != _typeof(i)) return i;
60
- throw new TypeError("@@toPrimitive must return a primitive value.");
61
- }
62
- return ("string" === r ? String : Number)(t);
63
- }
64
- /*istanbul ignore end*/
65
- function unixToWin(patch) {
66
- if (Array.isArray(patch)) return patch.map(unixToWin);
67
- return _objectSpread(_objectSpread(
68
- {},
69
- /*istanbul ignore end*/
70
- patch
71
- ), {}, { hunks: patch.hunks.map(function(hunk) {
72
- return _objectSpread(_objectSpread(
73
- {},
74
- /*istanbul ignore end*/
75
- hunk
76
- ), {}, { lines: hunk.lines.map(function(line, i) {
77
- var _hunk$lines;
78
- return line.startsWith("\\") || line.endsWith("\r") || (_hunk$lines = hunk.lines[i + 1]) !== null && _hunk$lines !== void 0 && _hunk$lines.startsWith("\\") ? line : line + "\r";
79
- }) });
80
- }) });
81
- }
82
- function winToUnix(patch) {
83
- if (Array.isArray(patch)) return patch.map(winToUnix);
84
- return _objectSpread(_objectSpread(
85
- {},
86
- /*istanbul ignore end*/
87
- patch
88
- ), {}, { hunks: patch.hunks.map(function(hunk) {
89
- return _objectSpread(_objectSpread(
90
- {},
91
- /*istanbul ignore end*/
92
- hunk
93
- ), {}, { lines: hunk.lines.map(function(line) {
94
- return line.endsWith("\r") ? line.substring(0, line.length - 1) : line;
95
- }) });
96
- }) });
97
- }
98
- /**
99
- * Returns true if the patch consistently uses Unix line endings (or only involves one line and has
100
- * no line endings).
101
- */
102
- function isUnix(patch) {
103
- if (!Array.isArray(patch)) patch = [patch];
104
- return !patch.some(function(index) {
105
- return index.hunks.some(function(hunk) {
106
- return hunk.lines.some(function(line) {
107
- return !line.startsWith("\\") && line.endsWith("\r");
108
- });
109
- });
110
- });
111
- }
112
- /**
113
- * Returns true if the patch uses Windows line endings and only Windows line endings.
114
- */
115
- function isWin(patch) {
116
- if (!Array.isArray(patch)) patch = [patch];
117
- return patch.some(function(index) {
118
- return index.hunks.some(function(hunk) {
119
- return hunk.lines.some(function(line) {
120
- return line.endsWith("\r");
121
- });
122
- });
123
- }) && patch.every(function(index) {
124
- return index.hunks.every(function(hunk) {
125
- return hunk.lines.every(function(line, i) {
126
- var _hunk$lines2;
127
- return line.startsWith("\\") || line.endsWith("\r") || ((_hunk$lines2 = hunk.lines[i + 1]) === null || _hunk$lines2 === void 0 ? void 0 : _hunk$lines2.startsWith("\\"));
128
- });
129
- });
130
- });
131
- }
132
- }) });
133
-
134
- //#endregion
135
- export default require_line_endings();
136
-
137
- export { require_line_endings };
@@ -1,367 +0,0 @@
1
- import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
- import { require_parse } from "./parse.js";
3
- import { require_create } from "./create.js";
4
- import { require_array } from "../util/array.js";
5
-
6
- //#region ../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js
7
- var require_merge = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js": ((exports) => {
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.calcLineCount = calcLineCount;
10
- exports.merge = merge;
11
- /*istanbul ignore end*/
12
- var _create = require_create();
13
- var _parse = require_parse();
14
- var _array = require_array();
15
- /*istanbul ignore start*/ function _toConsumableArray(arr) {
16
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
17
- }
18
- function _nonIterableSpread() {
19
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
20
- }
21
- function _unsupportedIterableToArray(o, minLen) {
22
- if (!o) return;
23
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
24
- var n = Object.prototype.toString.call(o).slice(8, -1);
25
- if (n === "Object" && o.constructor) n = o.constructor.name;
26
- if (n === "Map" || n === "Set") return Array.from(o);
27
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
28
- }
29
- function _iterableToArray(iter) {
30
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
31
- }
32
- function _arrayWithoutHoles(arr) {
33
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
34
- }
35
- function _arrayLikeToArray(arr, len) {
36
- if (len == null || len > arr.length) len = arr.length;
37
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
38
- return arr2;
39
- }
40
- /*istanbul ignore end*/
41
- function calcLineCount(hunk) {
42
- var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines), oldLines = _calcOldNewLineCount.oldLines, newLines = _calcOldNewLineCount.newLines;
43
- if (oldLines !== void 0) hunk.oldLines = oldLines;
44
- else delete hunk.oldLines;
45
- if (newLines !== void 0) hunk.newLines = newLines;
46
- else delete hunk.newLines;
47
- }
48
- function merge(mine, theirs, base) {
49
- mine = loadPatch(mine, base);
50
- theirs = loadPatch(theirs, base);
51
- var ret = {};
52
- if (mine.index || theirs.index) ret.index = mine.index || theirs.index;
53
- if (mine.newFileName || theirs.newFileName) if (!fileNameChanged(mine)) {
54
- ret.oldFileName = theirs.oldFileName || mine.oldFileName;
55
- ret.newFileName = theirs.newFileName || mine.newFileName;
56
- ret.oldHeader = theirs.oldHeader || mine.oldHeader;
57
- ret.newHeader = theirs.newHeader || mine.newHeader;
58
- } else if (!fileNameChanged(theirs)) {
59
- ret.oldFileName = mine.oldFileName;
60
- ret.newFileName = mine.newFileName;
61
- ret.oldHeader = mine.oldHeader;
62
- ret.newHeader = mine.newHeader;
63
- } else {
64
- ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
65
- ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
66
- ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
67
- ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
68
- }
69
- ret.hunks = [];
70
- var mineIndex = 0, theirsIndex = 0, mineOffset = 0, theirsOffset = 0;
71
- while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
72
- var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity }, theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity };
73
- if (hunkBefore(mineCurrent, theirsCurrent)) {
74
- ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
75
- mineIndex++;
76
- theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
77
- } else if (hunkBefore(theirsCurrent, mineCurrent)) {
78
- ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
79
- theirsIndex++;
80
- mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
81
- } else {
82
- var mergedHunk = {
83
- oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
84
- oldLines: 0,
85
- newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
86
- newLines: 0,
87
- lines: []
88
- };
89
- mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
90
- theirsIndex++;
91
- mineIndex++;
92
- ret.hunks.push(mergedHunk);
93
- }
94
- }
95
- return ret;
96
- }
97
- function loadPatch(param, base) {
98
- if (typeof param === "string") {
99
- if (/^@@/m.test(param) || /^Index:/m.test(param)) return (0, _parse.parsePatch)(param)[0];
100
- if (!base) throw new Error("Must provide a base reference or pass in a patch");
101
- return (0, _create.structuredPatch)(void 0, void 0, base, param);
102
- }
103
- return param;
104
- }
105
- function fileNameChanged(patch) {
106
- return patch.newFileName && patch.newFileName !== patch.oldFileName;
107
- }
108
- function selectField(index, mine, theirs) {
109
- if (mine === theirs) return mine;
110
- else {
111
- index.conflict = true;
112
- return {
113
- mine,
114
- theirs
115
- };
116
- }
117
- }
118
- function hunkBefore(test, check) {
119
- return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
120
- }
121
- function cloneHunk(hunk, offset) {
122
- return {
123
- oldStart: hunk.oldStart,
124
- oldLines: hunk.oldLines,
125
- newStart: hunk.newStart + offset,
126
- newLines: hunk.newLines,
127
- lines: hunk.lines
128
- };
129
- }
130
- function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
131
- var mine = {
132
- offset: mineOffset,
133
- lines: mineLines,
134
- index: 0
135
- }, their = {
136
- offset: theirOffset,
137
- lines: theirLines,
138
- index: 0
139
- };
140
- insertLeading(hunk, mine, their);
141
- insertLeading(hunk, their, mine);
142
- while (mine.index < mine.lines.length && their.index < their.lines.length) {
143
- var mineCurrent = mine.lines[mine.index], theirCurrent = their.lines[their.index];
144
- if ((mineCurrent[0] === "-" || mineCurrent[0] === "+") && (theirCurrent[0] === "-" || theirCurrent[0] === "+")) mutualChange(hunk, mine, their);
145
- else if (mineCurrent[0] === "+" && theirCurrent[0] === " ") {
146
- /*istanbul ignore start*/
147
- var _hunk$lines;
148
- /*istanbul ignore end*/
149
- /*istanbul ignore start*/
150
- /*istanbul ignore end*/
151
- /*istanbul ignore start*/
152
- (_hunk$lines = hunk.lines).push.apply(
153
- /*istanbul ignore start*/
154
- _hunk$lines,
155
- /*istanbul ignore start*/
156
- _toConsumableArray(
157
- /*istanbul ignore end*/
158
- collectChange(mine)
159
- )
160
- );
161
- } else if (theirCurrent[0] === "+" && mineCurrent[0] === " ") {
162
- /*istanbul ignore start*/
163
- var _hunk$lines2;
164
- /*istanbul ignore end*/
165
- /*istanbul ignore start*/
166
- /*istanbul ignore end*/
167
- /*istanbul ignore start*/
168
- (_hunk$lines2 = hunk.lines).push.apply(
169
- /*istanbul ignore start*/
170
- _hunk$lines2,
171
- /*istanbul ignore start*/
172
- _toConsumableArray(
173
- /*istanbul ignore end*/
174
- collectChange(their)
175
- )
176
- );
177
- } else if (mineCurrent[0] === "-" && theirCurrent[0] === " ") removal(hunk, mine, their);
178
- else if (theirCurrent[0] === "-" && mineCurrent[0] === " ") removal(hunk, their, mine, true);
179
- else if (mineCurrent === theirCurrent) {
180
- hunk.lines.push(mineCurrent);
181
- mine.index++;
182
- their.index++;
183
- } else conflict(hunk, collectChange(mine), collectChange(their));
184
- }
185
- insertTrailing(hunk, mine);
186
- insertTrailing(hunk, their);
187
- calcLineCount(hunk);
188
- }
189
- function mutualChange(hunk, mine, their) {
190
- var myChanges = collectChange(mine), theirChanges = collectChange(their);
191
- if (allRemoves(myChanges) && allRemoves(theirChanges)) {
192
- if ((0, _array.arrayStartsWith)(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
193
- /*istanbul ignore start*/
194
- var _hunk$lines3;
195
- /*istanbul ignore end*/
196
- /*istanbul ignore start*/
197
- /*istanbul ignore end*/
198
- /*istanbul ignore start*/
199
- (_hunk$lines3 = hunk.lines).push.apply(
200
- /*istanbul ignore start*/
201
- _hunk$lines3,
202
- /*istanbul ignore start*/
203
- _toConsumableArray(
204
- /*istanbul ignore end*/
205
- myChanges
206
- )
207
- );
208
- return;
209
- } else if ((0, _array.arrayStartsWith)(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
210
- /*istanbul ignore start*/
211
- var _hunk$lines4;
212
- /*istanbul ignore end*/
213
- /*istanbul ignore start*/
214
- /*istanbul ignore end*/
215
- /*istanbul ignore start*/
216
- (_hunk$lines4 = hunk.lines).push.apply(
217
- /*istanbul ignore start*/
218
- _hunk$lines4,
219
- /*istanbul ignore start*/
220
- _toConsumableArray(
221
- /*istanbul ignore end*/
222
- theirChanges
223
- )
224
- );
225
- return;
226
- }
227
- } else if ((0, _array.arrayEqual)(myChanges, theirChanges)) {
228
- /*istanbul ignore start*/
229
- var _hunk$lines5;
230
- /*istanbul ignore end*/
231
- /*istanbul ignore start*/
232
- /*istanbul ignore end*/
233
- /*istanbul ignore start*/
234
- (_hunk$lines5 = hunk.lines).push.apply(
235
- /*istanbul ignore start*/
236
- _hunk$lines5,
237
- /*istanbul ignore start*/
238
- _toConsumableArray(
239
- /*istanbul ignore end*/
240
- myChanges
241
- )
242
- );
243
- return;
244
- }
245
- conflict(hunk, myChanges, theirChanges);
246
- }
247
- function removal(hunk, mine, their, swap) {
248
- var myChanges = collectChange(mine), theirChanges = collectContext(their, myChanges);
249
- if (theirChanges.merged) {
250
- /*istanbul ignore start*/
251
- var _hunk$lines6;
252
- /*istanbul ignore end*/
253
- /*istanbul ignore start*/
254
- /*istanbul ignore end*/
255
- /*istanbul ignore start*/
256
- (_hunk$lines6 = hunk.lines).push.apply(
257
- /*istanbul ignore start*/
258
- _hunk$lines6,
259
- /*istanbul ignore start*/
260
- _toConsumableArray(
261
- /*istanbul ignore end*/
262
- theirChanges.merged
263
- )
264
- );
265
- } else conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
266
- }
267
- function conflict(hunk, mine, their) {
268
- hunk.conflict = true;
269
- hunk.lines.push({
270
- conflict: true,
271
- mine,
272
- theirs: their
273
- });
274
- }
275
- function insertLeading(hunk, insert, their) {
276
- while (insert.offset < their.offset && insert.index < insert.lines.length) {
277
- var line = insert.lines[insert.index++];
278
- hunk.lines.push(line);
279
- insert.offset++;
280
- }
281
- }
282
- function insertTrailing(hunk, insert) {
283
- while (insert.index < insert.lines.length) {
284
- var line = insert.lines[insert.index++];
285
- hunk.lines.push(line);
286
- }
287
- }
288
- function collectChange(state) {
289
- var ret = [], operation = state.lines[state.index][0];
290
- while (state.index < state.lines.length) {
291
- var line = state.lines[state.index];
292
- if (operation === "-" && line[0] === "+") operation = "+";
293
- if (operation === line[0]) {
294
- ret.push(line);
295
- state.index++;
296
- } else break;
297
- }
298
- return ret;
299
- }
300
- function collectContext(state, matchChanges) {
301
- var changes = [], merged = [], matchIndex = 0, contextChanges = false, conflicted = false;
302
- while (matchIndex < matchChanges.length && state.index < state.lines.length) {
303
- var change = state.lines[state.index], match = matchChanges[matchIndex];
304
- if (match[0] === "+") break;
305
- contextChanges = contextChanges || change[0] !== " ";
306
- merged.push(match);
307
- matchIndex++;
308
- if (change[0] === "+") {
309
- conflicted = true;
310
- while (change[0] === "+") {
311
- changes.push(change);
312
- change = state.lines[++state.index];
313
- }
314
- }
315
- if (match.substr(1) === change.substr(1)) {
316
- changes.push(change);
317
- state.index++;
318
- } else conflicted = true;
319
- }
320
- if ((matchChanges[matchIndex] || "")[0] === "+" && contextChanges) conflicted = true;
321
- if (conflicted) return changes;
322
- while (matchIndex < matchChanges.length) merged.push(matchChanges[matchIndex++]);
323
- return {
324
- merged,
325
- changes
326
- };
327
- }
328
- function allRemoves(changes) {
329
- return changes.reduce(function(prev, change) {
330
- return prev && change[0] === "-";
331
- }, true);
332
- }
333
- function skipRemoveSuperset(state, removeChanges, delta) {
334
- for (var i = 0; i < delta; i++) {
335
- var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
336
- if (state.lines[state.index + i] !== " " + changeContent) return false;
337
- }
338
- state.index += delta;
339
- return true;
340
- }
341
- function calcOldNewLineCount(lines) {
342
- var oldLines = 0;
343
- var newLines = 0;
344
- lines.forEach(function(line) {
345
- if (typeof line !== "string") {
346
- var myCount = calcOldNewLineCount(line.mine);
347
- var theirCount = calcOldNewLineCount(line.theirs);
348
- if (oldLines !== void 0) if (myCount.oldLines === theirCount.oldLines) oldLines += myCount.oldLines;
349
- else oldLines = void 0;
350
- if (newLines !== void 0) if (myCount.newLines === theirCount.newLines) newLines += myCount.newLines;
351
- else newLines = void 0;
352
- } else {
353
- if (newLines !== void 0 && (line[0] === "+" || line[0] === " ")) newLines++;
354
- if (oldLines !== void 0 && (line[0] === "-" || line[0] === " ")) oldLines++;
355
- }
356
- });
357
- return {
358
- oldLines,
359
- newLines
360
- };
361
- }
362
- }) });
363
-
364
- //#endregion
365
- export default require_merge();
366
-
367
- export { require_merge };
@@ -1,91 +0,0 @@
1
- import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
-
3
- //#region ../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js
4
- var require_parse = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js": ((exports) => {
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.parsePatch = parsePatch;
7
- /*istanbul ignore end*/
8
- function parsePatch(uniDiff) {
9
- var diffstr = uniDiff.split(/\n/), list = [], i = 0;
10
- function parseIndex() {
11
- var index = {};
12
- list.push(index);
13
- while (i < diffstr.length) {
14
- var line = diffstr[i];
15
- if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) break;
16
- var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
17
- if (header) index.index = header[1];
18
- i++;
19
- }
20
- parseFileHeader(index);
21
- parseFileHeader(index);
22
- index.hunks = [];
23
- while (i < diffstr.length) {
24
- var _line = diffstr[i];
25
- if (/^(Index:\s|diff\s|\-\-\-\s|\+\+\+\s|===================================================================)/.test(_line)) break;
26
- else if (/^@@/.test(_line)) index.hunks.push(parseHunk());
27
- else if (_line) throw new Error("Unknown line " + (i + 1) + " " + JSON.stringify(_line));
28
- else i++;
29
- }
30
- }
31
- function parseFileHeader(index) {
32
- var fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]);
33
- if (fileHeader) {
34
- var keyPrefix = fileHeader[1] === "---" ? "old" : "new";
35
- var data = fileHeader[2].split(" ", 2);
36
- var fileName = data[0].replace(/\\\\/g, "\\");
37
- if (/^".*"$/.test(fileName)) fileName = fileName.substr(1, fileName.length - 2);
38
- index[keyPrefix + "FileName"] = fileName;
39
- index[keyPrefix + "Header"] = (data[1] || "").trim();
40
- i++;
41
- }
42
- }
43
- function parseHunk() {
44
- var chunkHeaderIndex = i, chunkHeaderLine = diffstr[i++], chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
45
- var hunk = {
46
- oldStart: +chunkHeader[1],
47
- oldLines: typeof chunkHeader[2] === "undefined" ? 1 : +chunkHeader[2],
48
- newStart: +chunkHeader[3],
49
- newLines: typeof chunkHeader[4] === "undefined" ? 1 : +chunkHeader[4],
50
- lines: []
51
- };
52
- if (hunk.oldLines === 0) hunk.oldStart += 1;
53
- if (hunk.newLines === 0) hunk.newStart += 1;
54
- var addCount = 0, removeCount = 0;
55
- for (; i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || (_diffstr$i = diffstr[i]) !== null && _diffstr$i !== void 0 && _diffstr$i.startsWith("\\")); i++) {
56
- /*istanbul ignore start*/
57
- var _diffstr$i;
58
- /*istanbul ignore end*/
59
- var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? " " : diffstr[i][0];
60
- if (operation === "+" || operation === "-" || operation === " " || operation === "\\") {
61
- hunk.lines.push(diffstr[i]);
62
- if (operation === "+") addCount++;
63
- else if (operation === "-") removeCount++;
64
- else if (operation === " ") {
65
- addCount++;
66
- removeCount++;
67
- }
68
- } else throw new Error(
69
- /*istanbul ignore start*/
70
- "Hunk at line ".concat(
71
- /*istanbul ignore end*/
72
- chunkHeaderIndex + 1,
73
- " contained invalid line "
74
- ).concat(diffstr[i])
75
- );
76
- }
77
- if (!addCount && hunk.newLines === 1) hunk.newLines = 0;
78
- if (!removeCount && hunk.oldLines === 1) hunk.oldLines = 0;
79
- if (addCount !== hunk.newLines) throw new Error("Added line count did not match for hunk at line " + (chunkHeaderIndex + 1));
80
- if (removeCount !== hunk.oldLines) throw new Error("Removed line count did not match for hunk at line " + (chunkHeaderIndex + 1));
81
- return hunk;
82
- }
83
- while (i < diffstr.length) parseIndex();
84
- return list;
85
- }
86
- }) });
87
-
88
- //#endregion
89
- export default require_parse();
90
-
91
- export { require_parse };
@@ -1,99 +0,0 @@
1
- import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
-
3
- //#region ../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js
4
- var require_reverse = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js": ((exports) => {
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.reversePatch = reversePatch;
7
- function _typeof(o) {
8
- "@babel/helpers - typeof";
9
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
10
- return typeof o$1;
11
- } : function(o$1) {
12
- return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
13
- }, _typeof(o);
14
- }
15
- function ownKeys(e, r) {
16
- var t = Object.keys(e);
17
- if (Object.getOwnPropertySymbols) {
18
- var o = Object.getOwnPropertySymbols(e);
19
- r && (o = o.filter(function(r$1) {
20
- return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
21
- })), t.push.apply(t, o);
22
- }
23
- return t;
24
- }
25
- function _objectSpread(e) {
26
- for (var r = 1; r < arguments.length; r++) {
27
- var t = null != arguments[r] ? arguments[r] : {};
28
- r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
29
- _defineProperty(e, r$1, t[r$1]);
30
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
31
- Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
32
- });
33
- }
34
- return e;
35
- }
36
- function _defineProperty(obj, key, value) {
37
- key = _toPropertyKey(key);
38
- if (key in obj) Object.defineProperty(obj, key, {
39
- value,
40
- enumerable: true,
41
- configurable: true,
42
- writable: true
43
- });
44
- else obj[key] = value;
45
- return obj;
46
- }
47
- function _toPropertyKey(t) {
48
- var i = _toPrimitive(t, "string");
49
- return "symbol" == _typeof(i) ? i : i + "";
50
- }
51
- function _toPrimitive(t, r) {
52
- if ("object" != _typeof(t) || !t) return t;
53
- var e = t[Symbol.toPrimitive];
54
- if (void 0 !== e) {
55
- var i = e.call(t, r || "default");
56
- if ("object" != _typeof(i)) return i;
57
- throw new TypeError("@@toPrimitive must return a primitive value.");
58
- }
59
- return ("string" === r ? String : Number)(t);
60
- }
61
- /*istanbul ignore end*/
62
- function reversePatch(structuredPatch) {
63
- if (Array.isArray(structuredPatch)) return structuredPatch.map(reversePatch).reverse();
64
- return _objectSpread(_objectSpread(
65
- {},
66
- /*istanbul ignore end*/
67
- structuredPatch
68
- ), {}, {
69
- oldFileName: structuredPatch.newFileName,
70
- oldHeader: structuredPatch.newHeader,
71
- newFileName: structuredPatch.oldFileName,
72
- newHeader: structuredPatch.oldHeader,
73
- hunks: structuredPatch.hunks.map(function(hunk) {
74
- return {
75
- oldLines: hunk.newLines,
76
- oldStart: hunk.newStart,
77
- newLines: hunk.oldLines,
78
- newStart: hunk.oldStart,
79
- lines: hunk.lines.map(function(l) {
80
- if (l.startsWith("-")) return "+".concat(
81
- /*istanbul ignore end*/
82
- l.slice(1)
83
- );
84
- if (l.startsWith("+")) return "-".concat(
85
- /*istanbul ignore end*/
86
- l.slice(1)
87
- );
88
- return l;
89
- })
90
- };
91
- })
92
- });
93
- }
94
- }) });
95
-
96
- //#endregion
97
- export default require_reverse();
98
-
99
- export { require_reverse };