@eggjs/mock 6.1.0-beta.9 → 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 +8 -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,178 +0,0 @@
1
- import { __commonJS } from "../../../../../../_virtual/rolldown_runtime.js";
2
- import { require_base } from "./diff/base.js";
3
- import { require_character } from "./diff/character.js";
4
- import { require_word } from "./diff/word.js";
5
- import { require_line } from "./diff/line.js";
6
- import { require_sentence } from "./diff/sentence.js";
7
- import { require_css } from "./diff/css.js";
8
- import { require_json } from "./diff/json.js";
9
- import { require_array } from "./diff/array.js";
10
- import { require_parse } from "./patch/parse.js";
11
- import { require_apply } from "./patch/apply.js";
12
- import { require_create } from "./patch/create.js";
13
- import { require_merge } from "./patch/merge.js";
14
- import { require_reverse } from "./patch/reverse.js";
15
- import { require_dmp } from "./convert/dmp.js";
16
- import { require_xml } from "./convert/xml.js";
17
-
18
- //#region ../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js
19
- var require_lib = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js": ((exports) => {
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- Object.defineProperty(exports, "Diff", {
22
- enumerable: true,
23
- get: function get() {
24
- return _base["default"];
25
- }
26
- });
27
- Object.defineProperty(exports, "applyPatch", {
28
- enumerable: true,
29
- get: function get() {
30
- return _apply.applyPatch;
31
- }
32
- });
33
- Object.defineProperty(exports, "applyPatches", {
34
- enumerable: true,
35
- get: function get() {
36
- return _apply.applyPatches;
37
- }
38
- });
39
- Object.defineProperty(exports, "canonicalize", {
40
- enumerable: true,
41
- get: function get() {
42
- return _json.canonicalize;
43
- }
44
- });
45
- Object.defineProperty(exports, "convertChangesToDMP", {
46
- enumerable: true,
47
- get: function get() {
48
- return _dmp.convertChangesToDMP;
49
- }
50
- });
51
- Object.defineProperty(exports, "convertChangesToXML", {
52
- enumerable: true,
53
- get: function get() {
54
- return _xml.convertChangesToXML;
55
- }
56
- });
57
- Object.defineProperty(exports, "createPatch", {
58
- enumerable: true,
59
- get: function get() {
60
- return _create.createPatch;
61
- }
62
- });
63
- Object.defineProperty(exports, "createTwoFilesPatch", {
64
- enumerable: true,
65
- get: function get() {
66
- return _create.createTwoFilesPatch;
67
- }
68
- });
69
- Object.defineProperty(exports, "diffArrays", {
70
- enumerable: true,
71
- get: function get() {
72
- return _array.diffArrays;
73
- }
74
- });
75
- Object.defineProperty(exports, "diffChars", {
76
- enumerable: true,
77
- get: function get() {
78
- return _character.diffChars;
79
- }
80
- });
81
- Object.defineProperty(exports, "diffCss", {
82
- enumerable: true,
83
- get: function get() {
84
- return _css.diffCss;
85
- }
86
- });
87
- Object.defineProperty(exports, "diffJson", {
88
- enumerable: true,
89
- get: function get() {
90
- return _json.diffJson;
91
- }
92
- });
93
- Object.defineProperty(exports, "diffLines", {
94
- enumerable: true,
95
- get: function get() {
96
- return _line.diffLines;
97
- }
98
- });
99
- Object.defineProperty(exports, "diffSentences", {
100
- enumerable: true,
101
- get: function get() {
102
- return _sentence.diffSentences;
103
- }
104
- });
105
- Object.defineProperty(exports, "diffTrimmedLines", {
106
- enumerable: true,
107
- get: function get() {
108
- return _line.diffTrimmedLines;
109
- }
110
- });
111
- Object.defineProperty(exports, "diffWords", {
112
- enumerable: true,
113
- get: function get() {
114
- return _word.diffWords;
115
- }
116
- });
117
- Object.defineProperty(exports, "diffWordsWithSpace", {
118
- enumerable: true,
119
- get: function get() {
120
- return _word.diffWordsWithSpace;
121
- }
122
- });
123
- Object.defineProperty(exports, "formatPatch", {
124
- enumerable: true,
125
- get: function get() {
126
- return _create.formatPatch;
127
- }
128
- });
129
- Object.defineProperty(exports, "merge", {
130
- enumerable: true,
131
- get: function get() {
132
- return _merge.merge;
133
- }
134
- });
135
- Object.defineProperty(exports, "parsePatch", {
136
- enumerable: true,
137
- get: function get() {
138
- return _parse.parsePatch;
139
- }
140
- });
141
- Object.defineProperty(exports, "reversePatch", {
142
- enumerable: true,
143
- get: function get() {
144
- return _reverse.reversePatch;
145
- }
146
- });
147
- Object.defineProperty(exports, "structuredPatch", {
148
- enumerable: true,
149
- get: function get() {
150
- return _create.structuredPatch;
151
- }
152
- });
153
- /*istanbul ignore end*/
154
- var _base = _interopRequireDefault(require_base());
155
- var _character = require_character();
156
- var _word = require_word();
157
- var _line = require_line();
158
- var _sentence = require_sentence();
159
- var _css = require_css();
160
- var _json = require_json();
161
- var _array = require_array();
162
- var _apply = require_apply();
163
- var _parse = require_parse();
164
- var _merge = require_merge();
165
- var _reverse = require_reverse();
166
- var _create = require_create();
167
- var _dmp = require_dmp();
168
- var _xml = require_xml();
169
- /*istanbul ignore start*/ function _interopRequireDefault(obj) {
170
- return obj && obj.__esModule ? obj : { "default": obj };
171
- }
172
- }) });
173
- /*istanbul ignore end*/
174
-
175
- //#endregion
176
- export default require_lib();
177
-
178
- export { require_lib };
@@ -1,168 +0,0 @@
1
- import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
- import { require_string } from "../util/string.js";
3
- import { require_line_endings } from "./line-endings.js";
4
- import { require_parse } from "./parse.js";
5
- import { require_distance_iterator } from "../util/distance-iterator.js";
6
-
7
- //#region ../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js
8
- var require_apply = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js": ((exports) => {
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.applyPatch = applyPatch;
11
- exports.applyPatches = applyPatches;
12
- /*istanbul ignore end*/
13
- var _string = require_string();
14
- var _lineEndings = require_line_endings();
15
- var _parse = require_parse();
16
- var _distanceIterator = _interopRequireDefault(require_distance_iterator());
17
- /*istanbul ignore start*/ function _interopRequireDefault(obj) {
18
- return obj && obj.__esModule ? obj : { "default": obj };
19
- }
20
- /*istanbul ignore end*/
21
- function applyPatch(source, uniDiff) {
22
- /*istanbul ignore start*/
23
- var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
24
- if (typeof uniDiff === "string") uniDiff = (0, _parse.parsePatch)(uniDiff);
25
- if (Array.isArray(uniDiff)) {
26
- if (uniDiff.length > 1) throw new Error("applyPatch only works with a single input.");
27
- uniDiff = uniDiff[0];
28
- }
29
- if (options.autoConvertLineEndings || options.autoConvertLineEndings == null) {
30
- if ((0, _string.hasOnlyWinLineEndings)(source) && (0, _lineEndings.isUnix)(uniDiff)) uniDiff = (0, _lineEndings.unixToWin)(uniDiff);
31
- else if ((0, _string.hasOnlyUnixLineEndings)(source) && (0, _lineEndings.isWin)(uniDiff)) uniDiff = (0, _lineEndings.winToUnix)(uniDiff);
32
- }
33
- var lines = source.split("\n"), hunks = uniDiff.hunks, compareLine = options.compareLine || function(lineNumber, line$1, operation, patchContent) {
34
- return line$1 === patchContent;
35
- }, fuzzFactor = options.fuzzFactor || 0, minLine = 0;
36
- if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) throw new Error("fuzzFactor must be a non-negative integer");
37
- if (!hunks.length) return source;
38
- var prevLine = "", removeEOFNL = false, addEOFNL = false;
39
- for (var i = 0; i < hunks[hunks.length - 1].lines.length; i++) {
40
- var line = hunks[hunks.length - 1].lines[i];
41
- if (line[0] == "\\") {
42
- if (prevLine[0] == "+") removeEOFNL = true;
43
- else if (prevLine[0] == "-") addEOFNL = true;
44
- }
45
- prevLine = line;
46
- }
47
- if (removeEOFNL) {
48
- if (addEOFNL) {
49
- if (!fuzzFactor && lines[lines.length - 1] == "") return false;
50
- } else if (lines[lines.length - 1] == "") lines.pop();
51
- else if (!fuzzFactor) return false;
52
- } else if (addEOFNL) {
53
- if (lines[lines.length - 1] != "") lines.push("");
54
- else if (!fuzzFactor) return false;
55
- }
56
- /**
57
- * Checks if the hunk can be made to fit at the provided location with at most `maxErrors`
58
- * insertions, substitutions, or deletions, while ensuring also that:
59
- * - lines deleted in the hunk match exactly, and
60
- * - wherever an insertion operation or block of insertion operations appears in the hunk, the
61
- * immediately preceding and following lines of context match exactly
62
- *
63
- * `toPos` should be set such that lines[toPos] is meant to match hunkLines[0].
64
- *
65
- * If the hunk can be applied, returns an object with properties `oldLineLastI` and
66
- * `replacementLines`. Otherwise, returns null.
67
- */
68
- function applyHunk(hunkLines, toPos$1, maxErrors$1) {
69
- /*istanbul ignore start*/
70
- var hunkLinesI = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
71
- /*istanbul ignore start*/
72
- var lastContextLineMatched = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
73
- /*istanbul ignore start*/
74
- var patchedLines = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : [];
75
- /*istanbul ignore start*/
76
- var patchedLinesLength = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : 0;
77
- var nConsecutiveOldContextLines = 0;
78
- var nextContextLineMustMatch = false;
79
- for (; hunkLinesI < hunkLines.length; hunkLinesI++) {
80
- var hunkLine = hunkLines[hunkLinesI], operation = hunkLine.length > 0 ? hunkLine[0] : " ", content = hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine;
81
- if (operation === "-") if (compareLine(toPos$1 + 1, lines[toPos$1], operation, content)) {
82
- toPos$1++;
83
- nConsecutiveOldContextLines = 0;
84
- } else {
85
- if (!maxErrors$1 || lines[toPos$1] == null) return null;
86
- patchedLines[patchedLinesLength] = lines[toPos$1];
87
- return applyHunk(hunkLines, toPos$1 + 1, maxErrors$1 - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1);
88
- }
89
- if (operation === "+") {
90
- if (!lastContextLineMatched) return null;
91
- patchedLines[patchedLinesLength] = content;
92
- patchedLinesLength++;
93
- nConsecutiveOldContextLines = 0;
94
- nextContextLineMustMatch = true;
95
- }
96
- if (operation === " ") {
97
- nConsecutiveOldContextLines++;
98
- patchedLines[patchedLinesLength] = lines[toPos$1];
99
- if (compareLine(toPos$1 + 1, lines[toPos$1], operation, content)) {
100
- patchedLinesLength++;
101
- lastContextLineMatched = true;
102
- nextContextLineMustMatch = false;
103
- toPos$1++;
104
- } else {
105
- if (nextContextLineMustMatch || !maxErrors$1) return null;
106
- return lines[toPos$1] && (applyHunk(hunkLines, toPos$1 + 1, maxErrors$1 - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength + 1) || applyHunk(hunkLines, toPos$1 + 1, maxErrors$1 - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1)) || applyHunk(hunkLines, toPos$1, maxErrors$1 - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength);
107
- }
108
- }
109
- }
110
- patchedLinesLength -= nConsecutiveOldContextLines;
111
- toPos$1 -= nConsecutiveOldContextLines;
112
- patchedLines.length = patchedLinesLength;
113
- return {
114
- patchedLines,
115
- oldLineLastI: toPos$1 - 1
116
- };
117
- }
118
- var resultLines = [];
119
- var prevHunkOffset = 0;
120
- for (var _i = 0; _i < hunks.length; _i++) {
121
- var hunk = hunks[_i];
122
- var hunkResult = void 0;
123
- var maxLine = lines.length - hunk.oldLines + fuzzFactor;
124
- var toPos = void 0;
125
- for (var maxErrors = 0; maxErrors <= fuzzFactor; maxErrors++) {
126
- toPos = hunk.oldStart + prevHunkOffset - 1;
127
- var iterator = (0, _distanceIterator["default"])(toPos, minLine, maxLine);
128
- for (; toPos !== void 0; toPos = iterator()) {
129
- hunkResult = applyHunk(hunk.lines, toPos, maxErrors);
130
- if (hunkResult) break;
131
- }
132
- if (hunkResult) break;
133
- }
134
- if (!hunkResult) return false;
135
- for (var _i2 = minLine; _i2 < toPos; _i2++) resultLines.push(lines[_i2]);
136
- for (var _i3 = 0; _i3 < hunkResult.patchedLines.length; _i3++) {
137
- var _line = hunkResult.patchedLines[_i3];
138
- resultLines.push(_line);
139
- }
140
- minLine = hunkResult.oldLineLastI + 1;
141
- prevHunkOffset = toPos + 1 - hunk.oldStart;
142
- }
143
- for (var _i4 = minLine; _i4 < lines.length; _i4++) resultLines.push(lines[_i4]);
144
- return resultLines.join("\n");
145
- }
146
- function applyPatches(uniDiff, options) {
147
- if (typeof uniDiff === "string") uniDiff = (0, _parse.parsePatch)(uniDiff);
148
- var currentIndex = 0;
149
- function processIndex() {
150
- var index = uniDiff[currentIndex++];
151
- if (!index) return options.complete();
152
- options.loadFile(index, function(err, data) {
153
- if (err) return options.complete(err);
154
- var updatedContent = applyPatch(data, index, options);
155
- options.patched(index, updatedContent, function(err$1) {
156
- if (err$1) return options.complete(err$1);
157
- processIndex();
158
- });
159
- });
160
- }
161
- processIndex();
162
- }
163
- }) });
164
-
165
- //#endregion
166
- export default require_apply();
167
-
168
- export { require_apply };
@@ -1,301 +0,0 @@
1
- import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
- import { require_line } from "../diff/line.js";
3
-
4
- //#region ../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js
5
- var require_create = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js": ((exports) => {
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createPatch = createPatch;
8
- exports.createTwoFilesPatch = createTwoFilesPatch;
9
- exports.formatPatch = formatPatch;
10
- exports.structuredPatch = structuredPatch;
11
- /*istanbul ignore end*/
12
- var _line = require_line();
13
- /*istanbul ignore start*/ function _typeof(o) {
14
- "@babel/helpers - typeof";
15
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
16
- return typeof o$1;
17
- } : function(o$1) {
18
- return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
19
- }, _typeof(o);
20
- }
21
- function _toConsumableArray(arr) {
22
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
23
- }
24
- function _nonIterableSpread() {
25
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
26
- }
27
- function _unsupportedIterableToArray(o, minLen) {
28
- if (!o) return;
29
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
30
- var n = Object.prototype.toString.call(o).slice(8, -1);
31
- if (n === "Object" && o.constructor) n = o.constructor.name;
32
- if (n === "Map" || n === "Set") return Array.from(o);
33
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
34
- }
35
- function _iterableToArray(iter) {
36
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
37
- }
38
- function _arrayWithoutHoles(arr) {
39
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
40
- }
41
- function _arrayLikeToArray(arr, len) {
42
- if (len == null || len > arr.length) len = arr.length;
43
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
44
- return arr2;
45
- }
46
- function ownKeys(e, r) {
47
- var t = Object.keys(e);
48
- if (Object.getOwnPropertySymbols) {
49
- var o = Object.getOwnPropertySymbols(e);
50
- r && (o = o.filter(function(r$1) {
51
- return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
52
- })), t.push.apply(t, o);
53
- }
54
- return t;
55
- }
56
- function _objectSpread(e) {
57
- for (var r = 1; r < arguments.length; r++) {
58
- var t = null != arguments[r] ? arguments[r] : {};
59
- r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
60
- _defineProperty(e, r$1, t[r$1]);
61
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
62
- Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
63
- });
64
- }
65
- return e;
66
- }
67
- function _defineProperty(obj, key, value) {
68
- key = _toPropertyKey(key);
69
- if (key in obj) Object.defineProperty(obj, key, {
70
- value,
71
- enumerable: true,
72
- configurable: true,
73
- writable: true
74
- });
75
- else obj[key] = value;
76
- return obj;
77
- }
78
- function _toPropertyKey(t) {
79
- var i = _toPrimitive(t, "string");
80
- return "symbol" == _typeof(i) ? i : i + "";
81
- }
82
- function _toPrimitive(t, r) {
83
- if ("object" != _typeof(t) || !t) return t;
84
- var e = t[Symbol.toPrimitive];
85
- if (void 0 !== e) {
86
- var i = e.call(t, r || "default");
87
- if ("object" != _typeof(i)) return i;
88
- throw new TypeError("@@toPrimitive must return a primitive value.");
89
- }
90
- return ("string" === r ? String : Number)(t);
91
- }
92
- /*istanbul ignore end*/
93
- function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
94
- if (!options) options = {};
95
- if (typeof options === "function") options = { callback: options };
96
- if (typeof options.context === "undefined") options.context = 4;
97
- if (options.newlineIsToken) throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
98
- if (!options.callback) return diffLinesResultToPatch(
99
- /*istanbul ignore start*/
100
- (0, _line.diffLines)(oldStr, newStr, options)
101
- );
102
- else {
103
- var _options = options, _callback = _options.callback;
104
- /*istanbul ignore start*/
105
- (0, _line.diffLines)(
106
- oldStr,
107
- newStr,
108
- /*istanbul ignore start*/
109
- _objectSpread(_objectSpread(
110
- {},
111
- /*istanbul ignore end*/
112
- options
113
- ), {}, { callback: function callback(diff) {
114
- var patch = diffLinesResultToPatch(diff);
115
- _callback(patch);
116
- } })
117
- );
118
- }
119
- function diffLinesResultToPatch(diff) {
120
- if (!diff) return;
121
- diff.push({
122
- value: "",
123
- lines: []
124
- });
125
- function contextLines(lines) {
126
- return lines.map(function(entry) {
127
- return " " + entry;
128
- });
129
- }
130
- var hunks = [];
131
- var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
132
- /*istanbul ignore start*/
133
- var _loop = function _loop$1() {
134
- var current = diff[i], lines = current.lines || splitLines(current.value);
135
- current.lines = lines;
136
- if (current.added || current.removed) {
137
- /*istanbul ignore start*/
138
- var _curRange;
139
- /*istanbul ignore end*/
140
- if (!oldRangeStart) {
141
- var prev = diff[i - 1];
142
- oldRangeStart = oldLine;
143
- newRangeStart = newLine;
144
- if (prev) {
145
- curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
146
- oldRangeStart -= curRange.length;
147
- newRangeStart -= curRange.length;
148
- }
149
- }
150
- /*istanbul ignore start*/
151
- /*istanbul ignore end*/
152
- /*istanbul ignore start*/
153
- (_curRange = curRange).push.apply(
154
- /*istanbul ignore start*/
155
- _curRange,
156
- /*istanbul ignore start*/
157
- _toConsumableArray(
158
- /*istanbul ignore end*/
159
- lines.map(function(entry) {
160
- return (current.added ? "+" : "-") + entry;
161
- })
162
- )
163
- );
164
- if (current.added) newLine += lines.length;
165
- else oldLine += lines.length;
166
- } else {
167
- if (oldRangeStart) if (lines.length <= options.context * 2 && i < diff.length - 2) {
168
- /*istanbul ignore start*/
169
- var _curRange2;
170
- /*istanbul ignore end*/
171
- /*istanbul ignore start*/
172
- /*istanbul ignore end*/
173
- /*istanbul ignore start*/
174
- (_curRange2 = curRange).push.apply(
175
- /*istanbul ignore start*/
176
- _curRange2,
177
- /*istanbul ignore start*/
178
- _toConsumableArray(
179
- /*istanbul ignore end*/
180
- contextLines(lines)
181
- )
182
- );
183
- } else {
184
- /*istanbul ignore start*/
185
- var _curRange3;
186
- /*istanbul ignore end*/
187
- var contextSize = Math.min(lines.length, options.context);
188
- /*istanbul ignore start*/
189
- /*istanbul ignore end*/
190
- /*istanbul ignore start*/
191
- (_curRange3 = curRange).push.apply(
192
- /*istanbul ignore start*/
193
- _curRange3,
194
- /*istanbul ignore start*/
195
- _toConsumableArray(
196
- /*istanbul ignore end*/
197
- contextLines(lines.slice(0, contextSize))
198
- )
199
- );
200
- var _hunk = {
201
- oldStart: oldRangeStart,
202
- oldLines: oldLine - oldRangeStart + contextSize,
203
- newStart: newRangeStart,
204
- newLines: newLine - newRangeStart + contextSize,
205
- lines: curRange
206
- };
207
- hunks.push(_hunk);
208
- oldRangeStart = 0;
209
- newRangeStart = 0;
210
- curRange = [];
211
- }
212
- oldLine += lines.length;
213
- newLine += lines.length;
214
- }
215
- };
216
- for (var i = 0; i < diff.length; i++) _loop();
217
- /*istanbul ignore end*/
218
- for (var _i = 0, _hunks = hunks; _i < _hunks.length; _i++) {
219
- var hunk = _hunks[_i];
220
- for (var _i2 = 0; _i2 < hunk.lines.length; _i2++) if (hunk.lines[_i2].endsWith("\n")) hunk.lines[_i2] = hunk.lines[_i2].slice(0, -1);
221
- else {
222
- hunk.lines.splice(_i2 + 1, 0, "\");
223
- _i2++;
224
- }
225
- }
226
- return {
227
- oldFileName,
228
- newFileName,
229
- oldHeader,
230
- newHeader,
231
- hunks
232
- };
233
- }
234
- }
235
- function formatPatch(diff) {
236
- if (Array.isArray(diff)) return diff.map(formatPatch).join("\n");
237
- var ret = [];
238
- if (diff.oldFileName == diff.newFileName) ret.push("Index: " + diff.oldFileName);
239
- ret.push("===================================================================");
240
- ret.push("--- " + diff.oldFileName + (typeof diff.oldHeader === "undefined" ? "" : " " + diff.oldHeader));
241
- ret.push("+++ " + diff.newFileName + (typeof diff.newHeader === "undefined" ? "" : " " + diff.newHeader));
242
- for (var i = 0; i < diff.hunks.length; i++) {
243
- var hunk = diff.hunks[i];
244
- if (hunk.oldLines === 0) hunk.oldStart -= 1;
245
- if (hunk.newLines === 0) hunk.newStart -= 1;
246
- ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@");
247
- ret.push.apply(ret, hunk.lines);
248
- }
249
- return ret.join("\n") + "\n";
250
- }
251
- function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
252
- /*istanbul ignore start*/
253
- var _options2;
254
- /*istanbul ignore end*/
255
- if (typeof options === "function") options = { callback: options };
256
- if (!((_options2 = options) !== null && _options2 !== void 0 && _options2.callback)) {
257
- var patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
258
- if (!patchObj) return;
259
- return formatPatch(patchObj);
260
- } else {
261
- var _options3 = options, _callback2 = _options3.callback;
262
- structuredPatch(
263
- oldFileName,
264
- newFileName,
265
- oldStr,
266
- newStr,
267
- oldHeader,
268
- newHeader,
269
- /*istanbul ignore start*/
270
- _objectSpread(_objectSpread(
271
- {},
272
- /*istanbul ignore end*/
273
- options
274
- ), {}, { callback: function callback(patchObj$1) {
275
- if (!patchObj$1) _callback2();
276
- else _callback2(formatPatch(patchObj$1));
277
- } })
278
- );
279
- }
280
- }
281
- function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
282
- return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
283
- }
284
- /**
285
- * Split `text` into an array of lines, including the trailing newline character (where present)
286
- */
287
- function splitLines(text) {
288
- var hasTrailingNl = text.endsWith("\n");
289
- var result = text.split("\n").map(function(line) {
290
- return line + "\n";
291
- });
292
- if (hasTrailingNl) result.pop();
293
- else result.push(result.pop().slice(0, -1));
294
- return result;
295
- }
296
- }) });
297
-
298
- //#endregion
299
- export default require_create();
300
-
301
- export { require_create };