@eggjs/mock 6.1.0-beta.3 → 6.1.0-beta.4

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 (104) hide show
  1. package/dist/_virtual/rolldown_runtime.js +24 -1
  2. package/dist/bootstrap.d.ts +1 -1
  3. package/dist/bootstrap.js +1 -1
  4. package/dist/index.js +0 -1
  5. package/dist/inject_mocha.d.ts +1 -0
  6. package/dist/inject_mocha.js +35 -0
  7. package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +142 -0
  8. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js +157 -0
  9. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js +97 -0
  10. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js +40 -0
  11. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +812 -0
  12. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +50 -0
  13. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +68 -0
  14. package/dist/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +752 -0
  15. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js +203 -0
  16. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js +209 -0
  17. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js +18 -0
  18. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js +215 -0
  19. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/dmp.js +24 -0
  20. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/xml.js +33 -0
  21. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/array.js +29 -0
  22. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/base.js +185 -0
  23. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/character.js +23 -0
  24. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/css.js +26 -0
  25. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/json.js +83 -0
  26. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/line.js +51 -0
  27. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/sentence.js +26 -0
  28. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/word.js +151 -0
  29. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js +178 -0
  30. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js +168 -0
  31. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js +301 -0
  32. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js +137 -0
  33. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js +367 -0
  34. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js +91 -0
  35. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js +99 -0
  36. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/array.js +23 -0
  37. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/distance-iterator.js +30 -0
  38. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/params.js +22 -0
  39. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/string.js +97 -0
  40. package/dist/node_modules/.pnpm/escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js +14 -0
  41. package/dist/node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js +16 -0
  42. package/dist/node_modules/.pnpm/he@1.2.0/node_modules/he/he.js +4093 -0
  43. package/dist/node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js +14 -0
  44. package/dist/node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js +27 -0
  45. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/index.js +12 -0
  46. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/context.js +83 -0
  47. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/error-constants.js +35 -0
  48. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/errors.js +392 -0
  49. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/hook.js +86 -0
  50. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js +104 -0
  51. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js +99 -0
  52. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js +65 -0
  53. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js +18 -0
  54. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js +95 -0
  55. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js +105 -0
  56. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocha.js +1037 -0
  57. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocharc.js +24 -0
  58. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/buffered-worker-pool.js +152 -0
  59. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/esm-utils.js +74 -0
  60. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/file-unloader.js +22 -0
  61. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/parallel-buffered-runner.js +329 -0
  62. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/serializer.js +314 -0
  63. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/pending.js +22 -0
  64. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/base.js +417 -0
  65. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/doc.js +79 -0
  66. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/dot.js +75 -0
  67. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/html.js +283 -0
  68. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/index.js +40 -0
  69. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json-stream.js +90 -0
  70. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json.js +145 -0
  71. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/landing.js +107 -0
  72. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/list.js +77 -0
  73. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/markdown.js +106 -0
  74. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/min.js +57 -0
  75. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/nyan.js +233 -0
  76. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/progress.js +92 -0
  77. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/spec.js +91 -0
  78. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js +261 -0
  79. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js +166 -0
  80. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runnable.js +346 -0
  81. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runner.js +922 -0
  82. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/stats-collector.js +72 -0
  83. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/suite.js +517 -0
  84. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/test.js +105 -0
  85. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/utils.js +505 -0
  86. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/package.js +225 -0
  87. package/dist/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +124 -0
  88. package/dist/node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/index.js +11 -0
  89. package/dist/node_modules/.pnpm/serialize-javascript@6.0.2/node_modules/serialize-javascript/index.js +114 -0
  90. package/dist/node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js +76 -0
  91. package/dist/node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js +89 -0
  92. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/Pool.js +366 -0
  93. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/Promise.js +248 -0
  94. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/WorkerHandler.js +419 -0
  95. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/debug-port-allocator.js +27 -0
  96. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/environment.js +18 -0
  97. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/generated/embeddedWorker.js +16 -0
  98. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/index.js +63 -0
  99. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/transfer.js +21 -0
  100. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/validateOptions.js +9 -0
  101. package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/worker.js +281 -0
  102. package/dist/register.d.ts +0 -2
  103. package/dist/register.js +1 -26
  104. package/package.json +10 -8
@@ -1,7 +1,30 @@
1
1
  import { createRequire } from "node:module";
2
2
 
3
3
  //#region rolldown:runtime
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __commonJS = (cb, mod) => function() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
4
27
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
28
 
6
29
  //#endregion
7
- export { __require };
30
+ export { __commonJS, __require, __toESM };
@@ -6,4 +6,4 @@ import { strict as assert } from "node:assert";
6
6
  //#region src/bootstrap.d.ts
7
7
  declare const app: ApplicationUnittest;
8
8
  //#endregion
9
- export { ApplicationUnittest as MockApplication, app, assert, getBootstrapApp, proxyMock as mm, proxyMock as mock };
9
+ export { type ApplicationUnittest as MockApplication, app, assert, getBootstrapApp, proxyMock as mm, proxyMock as mock };
package/dist/bootstrap.js CHANGED
@@ -11,4 +11,4 @@ if (readJSONSync(path.join(options.baseDir || process.cwd(), "package.json")).eg
11
11
  const app = setupApp();
12
12
 
13
13
  //#endregion
14
- export { MockApplication, app, assert, getBootstrapApp, src_default as mm, proxyMock as mock };
14
+ export { app, assert, getBootstrapApp, src_default as mm, proxyMock as mock };
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { createCluster } from "./lib/cluster.js";
2
- import "./app/extend/application.js";
3
2
  import { createApp } from "./lib/app.js";
4
3
  import { restore as restore$1 } from "./lib/restore.js";
5
4
  import { setGetAppCallback } from "./lib/app_handler.js";
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,35 @@
1
+ import { __require, __toESM } from "./_virtual/rolldown_runtime.js";
2
+ import { injectContext } from "./lib/inject_context.js";
3
+ import { require_mocha } from "./node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/index.js";
4
+ import { debuglog } from "node:util";
5
+ import { getRequire } from "@eggjs/utils";
6
+
7
+ //#region src/inject_mocha.ts
8
+ var import_mocha = /* @__PURE__ */ __toESM(require_mocha(), 1);
9
+ const debug = debuglog("egg/mock/inject_mocha");
10
+ /**
11
+ * Find active node mocha instances.
12
+ */
13
+ function findNodeJSMocha() {
14
+ let children;
15
+ if (typeof __require === "function") children = __require.cache || {};
16
+ else {
17
+ children = getRequire().cache || {};
18
+ debug("createRequire on esm");
19
+ }
20
+ return Object.keys(children).filter(function(child) {
21
+ const val = children[child].exports;
22
+ return typeof val === "function" && val.name === "Mocha";
23
+ }).map(function(child) {
24
+ return children[child].exports;
25
+ });
26
+ }
27
+ const modules = findNodeJSMocha();
28
+ debug("modules length: %s", modules.length);
29
+ for (const module of modules) {
30
+ if (!module) continue;
31
+ injectContext(module);
32
+ }
33
+
34
+ //#endregion
35
+ export { };
@@ -0,0 +1,142 @@
1
+ import { __commonJS } from "../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_color_convert } from "../../../color-convert@2.0.1/node_modules/color-convert/index.js";
3
+
4
+ //#region ../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js
5
+ var require_ansi_styles = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js": ((exports, module) => {
6
+ const wrapAnsi16 = (fn, offset) => (...args) => {
7
+ return `\u001B[${fn(...args) + offset}m`;
8
+ };
9
+ const wrapAnsi256 = (fn, offset) => (...args) => {
10
+ const code = fn(...args);
11
+ return `\u001B[${38 + offset};5;${code}m`;
12
+ };
13
+ const wrapAnsi16m = (fn, offset) => (...args) => {
14
+ const rgb = fn(...args);
15
+ return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
16
+ };
17
+ const ansi2ansi = (n) => n;
18
+ const rgb2rgb = (r, g, b) => [
19
+ r,
20
+ g,
21
+ b
22
+ ];
23
+ const setLazyProperty = (object, property, get) => {
24
+ Object.defineProperty(object, property, {
25
+ get: () => {
26
+ const value = get();
27
+ Object.defineProperty(object, property, {
28
+ value,
29
+ enumerable: true,
30
+ configurable: true
31
+ });
32
+ return value;
33
+ },
34
+ enumerable: true,
35
+ configurable: true
36
+ });
37
+ };
38
+ /** @type {typeof import('color-convert')} */
39
+ let colorConvert;
40
+ const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
41
+ if (colorConvert === void 0) colorConvert = require_color_convert();
42
+ const offset = isBackground ? 10 : 0;
43
+ const styles = {};
44
+ for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
45
+ const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
46
+ if (sourceSpace === targetSpace) styles[name] = wrap(identity, offset);
47
+ else if (typeof suite === "object") styles[name] = wrap(suite[targetSpace], offset);
48
+ }
49
+ return styles;
50
+ };
51
+ function assembleStyles() {
52
+ const codes = /* @__PURE__ */ new Map();
53
+ const styles = {
54
+ modifier: {
55
+ reset: [0, 0],
56
+ bold: [1, 22],
57
+ dim: [2, 22],
58
+ italic: [3, 23],
59
+ underline: [4, 24],
60
+ inverse: [7, 27],
61
+ hidden: [8, 28],
62
+ strikethrough: [9, 29]
63
+ },
64
+ color: {
65
+ black: [30, 39],
66
+ red: [31, 39],
67
+ green: [32, 39],
68
+ yellow: [33, 39],
69
+ blue: [34, 39],
70
+ magenta: [35, 39],
71
+ cyan: [36, 39],
72
+ white: [37, 39],
73
+ blackBright: [90, 39],
74
+ redBright: [91, 39],
75
+ greenBright: [92, 39],
76
+ yellowBright: [93, 39],
77
+ blueBright: [94, 39],
78
+ magentaBright: [95, 39],
79
+ cyanBright: [96, 39],
80
+ whiteBright: [97, 39]
81
+ },
82
+ bgColor: {
83
+ bgBlack: [40, 49],
84
+ bgRed: [41, 49],
85
+ bgGreen: [42, 49],
86
+ bgYellow: [43, 49],
87
+ bgBlue: [44, 49],
88
+ bgMagenta: [45, 49],
89
+ bgCyan: [46, 49],
90
+ bgWhite: [47, 49],
91
+ bgBlackBright: [100, 49],
92
+ bgRedBright: [101, 49],
93
+ bgGreenBright: [102, 49],
94
+ bgYellowBright: [103, 49],
95
+ bgBlueBright: [104, 49],
96
+ bgMagentaBright: [105, 49],
97
+ bgCyanBright: [106, 49],
98
+ bgWhiteBright: [107, 49]
99
+ }
100
+ };
101
+ styles.color.gray = styles.color.blackBright;
102
+ styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
103
+ styles.color.grey = styles.color.blackBright;
104
+ styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
105
+ for (const [groupName, group] of Object.entries(styles)) {
106
+ for (const [styleName, style] of Object.entries(group)) {
107
+ styles[styleName] = {
108
+ open: `\u001B[${style[0]}m`,
109
+ close: `\u001B[${style[1]}m`
110
+ };
111
+ group[styleName] = styles[styleName];
112
+ codes.set(style[0], style[1]);
113
+ }
114
+ Object.defineProperty(styles, groupName, {
115
+ value: group,
116
+ enumerable: false
117
+ });
118
+ }
119
+ Object.defineProperty(styles, "codes", {
120
+ value: codes,
121
+ enumerable: false
122
+ });
123
+ styles.color.close = "\x1B[39m";
124
+ styles.bgColor.close = "\x1B[49m";
125
+ setLazyProperty(styles.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
126
+ setLazyProperty(styles.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
127
+ setLazyProperty(styles.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
128
+ setLazyProperty(styles.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
129
+ setLazyProperty(styles.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
130
+ setLazyProperty(styles.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
131
+ return styles;
132
+ }
133
+ Object.defineProperty(module, "exports", {
134
+ enumerable: true,
135
+ get: assembleStyles
136
+ });
137
+ }) });
138
+
139
+ //#endregion
140
+ export default require_ansi_styles();
141
+
142
+ export { require_ansi_styles };
@@ -0,0 +1,157 @@
1
+ import { __commonJS } from "../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_ansi_styles } from "../../../../ansi-styles@4.3.0/node_modules/ansi-styles/index.js";
3
+ import { require_supports_color } from "../../../../supports-color@7.2.0/node_modules/supports-color/index.js";
4
+ import { require_util } from "./util.js";
5
+ import { require_templates } from "./templates.js";
6
+
7
+ //#region ../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js
8
+ var require_source = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js": ((exports, module) => {
9
+ const ansiStyles = require_ansi_styles();
10
+ const { stdout: stdoutColor, stderr: stderrColor } = require_supports_color();
11
+ const { stringReplaceAll, stringEncaseCRLFWithFirstIndex } = require_util();
12
+ const { isArray } = Array;
13
+ const levelMapping = [
14
+ "ansi",
15
+ "ansi",
16
+ "ansi256",
17
+ "ansi16m"
18
+ ];
19
+ const styles = Object.create(null);
20
+ const applyOptions = (object, options = {}) => {
21
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) throw new Error("The `level` option should be an integer from 0 to 3");
22
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
23
+ object.level = options.level === void 0 ? colorLevel : options.level;
24
+ };
25
+ var ChalkClass = class {
26
+ constructor(options) {
27
+ return chalkFactory(options);
28
+ }
29
+ };
30
+ const chalkFactory = (options) => {
31
+ const chalk$1 = {};
32
+ applyOptions(chalk$1, options);
33
+ chalk$1.template = (...arguments_) => chalkTag(chalk$1.template, ...arguments_);
34
+ Object.setPrototypeOf(chalk$1, Chalk.prototype);
35
+ Object.setPrototypeOf(chalk$1.template, chalk$1);
36
+ chalk$1.template.constructor = () => {
37
+ throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
38
+ };
39
+ chalk$1.template.Instance = ChalkClass;
40
+ return chalk$1.template;
41
+ };
42
+ function Chalk(options) {
43
+ return chalkFactory(options);
44
+ }
45
+ for (const [styleName, style] of Object.entries(ansiStyles)) styles[styleName] = { get() {
46
+ const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
47
+ Object.defineProperty(this, styleName, { value: builder });
48
+ return builder;
49
+ } };
50
+ styles.visible = { get() {
51
+ const builder = createBuilder(this, this._styler, true);
52
+ Object.defineProperty(this, "visible", { value: builder });
53
+ return builder;
54
+ } };
55
+ const usedModels = [
56
+ "rgb",
57
+ "hex",
58
+ "keyword",
59
+ "hsl",
60
+ "hsv",
61
+ "hwb",
62
+ "ansi",
63
+ "ansi256"
64
+ ];
65
+ for (const model of usedModels) styles[model] = { get() {
66
+ const { level } = this;
67
+ return function(...arguments_) {
68
+ const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
69
+ return createBuilder(this, styler, this._isEmpty);
70
+ };
71
+ } };
72
+ for (const model of usedModels) {
73
+ const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
74
+ styles[bgModel] = { get() {
75
+ const { level } = this;
76
+ return function(...arguments_) {
77
+ const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
78
+ return createBuilder(this, styler, this._isEmpty);
79
+ };
80
+ } };
81
+ }
82
+ const proto = Object.defineProperties(() => {}, {
83
+ ...styles,
84
+ level: {
85
+ enumerable: true,
86
+ get() {
87
+ return this._generator.level;
88
+ },
89
+ set(level) {
90
+ this._generator.level = level;
91
+ }
92
+ }
93
+ });
94
+ const createStyler = (open, close, parent) => {
95
+ let openAll;
96
+ let closeAll;
97
+ if (parent === void 0) {
98
+ openAll = open;
99
+ closeAll = close;
100
+ } else {
101
+ openAll = parent.openAll + open;
102
+ closeAll = close + parent.closeAll;
103
+ }
104
+ return {
105
+ open,
106
+ close,
107
+ openAll,
108
+ closeAll,
109
+ parent
110
+ };
111
+ };
112
+ const createBuilder = (self, _styler, _isEmpty) => {
113
+ const builder = (...arguments_) => {
114
+ if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) return applyStyle(builder, chalkTag(builder, ...arguments_));
115
+ return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
116
+ };
117
+ Object.setPrototypeOf(builder, proto);
118
+ builder._generator = self;
119
+ builder._styler = _styler;
120
+ builder._isEmpty = _isEmpty;
121
+ return builder;
122
+ };
123
+ const applyStyle = (self, string) => {
124
+ if (self.level <= 0 || !string) return self._isEmpty ? "" : string;
125
+ let styler = self._styler;
126
+ if (styler === void 0) return string;
127
+ const { openAll, closeAll } = styler;
128
+ if (string.indexOf("\x1B") !== -1) while (styler !== void 0) {
129
+ string = stringReplaceAll(string, styler.close, styler.open);
130
+ styler = styler.parent;
131
+ }
132
+ const lfIndex = string.indexOf("\n");
133
+ if (lfIndex !== -1) string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
134
+ return openAll + string + closeAll;
135
+ };
136
+ let template;
137
+ const chalkTag = (chalk$1, ...strings) => {
138
+ const [firstString] = strings;
139
+ if (!isArray(firstString) || !isArray(firstString.raw)) return strings.join(" ");
140
+ const arguments_ = strings.slice(1);
141
+ const parts = [firstString.raw[0]];
142
+ for (let i = 1; i < firstString.length; i++) parts.push(String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"), String(firstString.raw[i]));
143
+ if (template === void 0) template = require_templates();
144
+ return template(chalk$1, parts.join(""));
145
+ };
146
+ Object.defineProperties(Chalk.prototype, styles);
147
+ const chalk = Chalk();
148
+ chalk.supportsColor = stdoutColor;
149
+ chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
150
+ chalk.stderr.supportsColor = stderrColor;
151
+ module.exports = chalk;
152
+ }) });
153
+
154
+ //#endregion
155
+ export default require_source();
156
+
157
+ export { require_source };
@@ -0,0 +1,97 @@
1
+ import { __commonJS } from "../../../../../../_virtual/rolldown_runtime.js";
2
+
3
+ //#region ../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js
4
+ var require_templates = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js": ((exports, module) => {
5
+ const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
6
+ const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
7
+ const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
8
+ const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
9
+ const ESCAPES = new Map([
10
+ ["n", "\n"],
11
+ ["r", "\r"],
12
+ ["t", " "],
13
+ ["b", "\b"],
14
+ ["f", "\f"],
15
+ ["v", "\v"],
16
+ ["0", "\0"],
17
+ ["\\", "\\"],
18
+ ["e", "\x1B"],
19
+ ["a", "\x07"]
20
+ ]);
21
+ function unescape(c) {
22
+ const u = c[0] === "u";
23
+ const bracket = c[1] === "{";
24
+ if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) return String.fromCharCode(parseInt(c.slice(1), 16));
25
+ if (u && bracket) return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
26
+ return ESCAPES.get(c) || c;
27
+ }
28
+ function parseArguments(name, arguments_) {
29
+ const results = [];
30
+ const chunks = arguments_.trim().split(/\s*,\s*/g);
31
+ let matches;
32
+ for (const chunk of chunks) {
33
+ const number = Number(chunk);
34
+ if (!Number.isNaN(number)) results.push(number);
35
+ else if (matches = chunk.match(STRING_REGEX)) results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
36
+ else throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
37
+ }
38
+ return results;
39
+ }
40
+ function parseStyle(style) {
41
+ STYLE_REGEX.lastIndex = 0;
42
+ const results = [];
43
+ let matches;
44
+ while ((matches = STYLE_REGEX.exec(style)) !== null) {
45
+ const name = matches[1];
46
+ if (matches[2]) {
47
+ const args = parseArguments(name, matches[2]);
48
+ results.push([name].concat(args));
49
+ } else results.push([name]);
50
+ }
51
+ return results;
52
+ }
53
+ function buildStyle(chalk, styles) {
54
+ const enabled = {};
55
+ for (const layer of styles) for (const style of layer.styles) enabled[style[0]] = layer.inverse ? null : style.slice(1);
56
+ let current = chalk;
57
+ for (const [styleName, styles$1] of Object.entries(enabled)) {
58
+ if (!Array.isArray(styles$1)) continue;
59
+ if (!(styleName in current)) throw new Error(`Unknown Chalk style: ${styleName}`);
60
+ current = styles$1.length > 0 ? current[styleName](...styles$1) : current[styleName];
61
+ }
62
+ return current;
63
+ }
64
+ module.exports = (chalk, temporary) => {
65
+ const styles = [];
66
+ const chunks = [];
67
+ let chunk = [];
68
+ temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
69
+ if (escapeCharacter) chunk.push(unescape(escapeCharacter));
70
+ else if (style) {
71
+ const string = chunk.join("");
72
+ chunk = [];
73
+ chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
74
+ styles.push({
75
+ inverse,
76
+ styles: parseStyle(style)
77
+ });
78
+ } else if (close) {
79
+ if (styles.length === 0) throw new Error("Found extraneous } in Chalk template literal");
80
+ chunks.push(buildStyle(chalk, styles)(chunk.join("")));
81
+ chunk = [];
82
+ styles.pop();
83
+ } else chunk.push(character);
84
+ });
85
+ chunks.push(chunk.join(""));
86
+ if (styles.length > 0) {
87
+ const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
88
+ throw new Error(errMessage);
89
+ }
90
+ return chunks.join("");
91
+ };
92
+ }) });
93
+
94
+ //#endregion
95
+ export default require_templates();
96
+
97
+ export { require_templates };
@@ -0,0 +1,40 @@
1
+ import { __commonJS } from "../../../../../../_virtual/rolldown_runtime.js";
2
+
3
+ //#region ../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js
4
+ var require_util = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js": ((exports, module) => {
5
+ const stringReplaceAll = (string, substring, replacer) => {
6
+ let index = string.indexOf(substring);
7
+ if (index === -1) return string;
8
+ const substringLength = substring.length;
9
+ let endIndex = 0;
10
+ let returnValue = "";
11
+ do {
12
+ returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
13
+ endIndex = index + substringLength;
14
+ index = string.indexOf(substring, endIndex);
15
+ } while (index !== -1);
16
+ returnValue += string.substr(endIndex);
17
+ return returnValue;
18
+ };
19
+ const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
20
+ let endIndex = 0;
21
+ let returnValue = "";
22
+ do {
23
+ const gotCR = string[index - 1] === "\r";
24
+ returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
25
+ endIndex = index + 1;
26
+ index = string.indexOf("\n", endIndex);
27
+ } while (index !== -1);
28
+ returnValue += string.substr(endIndex);
29
+ return returnValue;
30
+ };
31
+ module.exports = {
32
+ stringReplaceAll,
33
+ stringEncaseCRLFWithFirstIndex
34
+ };
35
+ }) });
36
+
37
+ //#endregion
38
+ export default require_util();
39
+
40
+ export { require_util };