@eggjs/mock 6.0.7 → 6.1.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -56
- package/README.zh_CN.md +30 -50
- package/dist/_virtual/rolldown_runtime.js +30 -0
- package/dist/app/extend/agent.d.ts +39 -0
- package/dist/app/extend/agent.js +48 -0
- package/dist/app/extend/application.d.ts +175 -0
- package/dist/app/extend/application.js +385 -0
- package/dist/app/middleware/cluster_app_mock.d.ts +6 -0
- package/dist/app/middleware/cluster_app_mock.js +97 -0
- package/dist/app.d.ts +10 -0
- package/dist/app.js +17 -0
- package/dist/bootstrap.d.ts +9 -0
- package/dist/bootstrap.js +14 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.js +47 -0
- package/dist/inject_mocha.d.ts +1 -0
- package/dist/inject_mocha.js +35 -0
- package/dist/lib/agent_handler.d.ts +7 -0
- package/dist/lib/agent_handler.js +26 -0
- package/dist/lib/app.d.ts +7 -0
- package/dist/lib/app.js +251 -0
- package/dist/lib/app_handler.d.ts +9 -0
- package/dist/lib/app_handler.js +56 -0
- package/dist/lib/cluster.d.ts +126 -0
- package/dist/lib/cluster.js +283 -0
- package/dist/lib/context.d.ts +4 -0
- package/dist/lib/context.js +12 -0
- package/dist/lib/format_options.d.ts +10 -0
- package/dist/lib/format_options.js +65 -0
- package/dist/lib/inject_context.d.ts +9 -0
- package/dist/lib/inject_context.js +106 -0
- package/dist/lib/mock_agent.d.ts +9 -0
- package/dist/lib/mock_agent.js +45 -0
- package/dist/lib/mock_custom_loader.d.ts +4 -0
- package/dist/lib/mock_custom_loader.js +35 -0
- package/dist/lib/mock_http_server.d.ts +6 -0
- package/dist/lib/mock_http_server.js +17 -0
- package/dist/lib/mock_httpclient.d.ts +40 -0
- package/dist/lib/mock_httpclient.js +110 -0
- package/dist/lib/parallel/agent.d.ts +24 -0
- package/dist/lib/parallel/agent.js +111 -0
- package/dist/lib/parallel/app.d.ts +24 -0
- package/dist/lib/parallel/app.js +99 -0
- package/dist/lib/parallel/util.d.ts +6 -0
- package/dist/lib/parallel/util.js +59 -0
- package/dist/lib/prerequire.d.ts +1 -0
- package/dist/lib/prerequire.js +1 -0
- package/dist/lib/request_call_function.d.ts +1 -0
- package/dist/lib/request_call_function.js +37 -0
- package/dist/lib/restore.d.ts +4 -0
- package/dist/lib/restore.js +16 -0
- package/dist/lib/start-cluster.d.ts +1 -0
- package/dist/lib/start-cluster.js +19 -0
- package/dist/lib/supertest.d.ts +16 -0
- package/dist/lib/supertest.js +39 -0
- package/dist/lib/tmp/empty.d.ts +1 -0
- package/dist/lib/tmp/empty.js +1 -0
- package/{src/lib/types.ts → dist/lib/types.d.ts} +12 -29
- package/dist/lib/types.js +1 -0
- package/dist/lib/utils.d.ts +12 -0
- package/dist/lib/utils.js +40 -0
- package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +142 -0
- package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js +157 -0
- package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js +97 -0
- package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js +40 -0
- package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +814 -0
- package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +50 -0
- package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +68 -0
- package/dist/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +752 -0
- package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js +203 -0
- package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js +209 -0
- package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js +18 -0
- package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js +215 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/dmp.js +24 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/xml.js +33 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/array.js +29 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/base.js +185 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/character.js +23 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/css.js +26 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/json.js +83 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/line.js +51 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/sentence.js +26 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/word.js +151 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js +178 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js +168 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js +301 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js +137 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js +367 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js +91 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js +99 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/array.js +23 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/distance-iterator.js +30 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/params.js +22 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/string.js +97 -0
- package/dist/node_modules/.pnpm/escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js +14 -0
- package/dist/node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js +16 -0
- package/dist/node_modules/.pnpm/he@1.2.0/node_modules/he/he.js +4093 -0
- package/dist/node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js +14 -0
- package/dist/node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js +27 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/index.js +12 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/context.js +83 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/error-constants.js +35 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/errors.js +392 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/hook.js +86 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js +104 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js +99 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js +65 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js +18 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js +95 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js +105 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocha.js +1037 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocharc.js +24 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/buffered-worker-pool.js +152 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/esm-utils.js +74 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/file-unloader.js +22 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/parallel-buffered-runner.js +329 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/serializer.js +314 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/pending.js +22 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/base.js +417 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/doc.js +79 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/dot.js +75 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/html.js +283 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/index.js +40 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json-stream.js +90 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json.js +145 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/landing.js +107 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/list.js +77 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/markdown.js +106 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/min.js +57 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/nyan.js +233 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/progress.js +92 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/spec.js +91 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js +261 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js +166 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runnable.js +346 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runner.js +922 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/stats-collector.js +72 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/suite.js +517 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/test.js +105 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/utils.js +505 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/package.js +225 -0
- package/dist/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +124 -0
- package/dist/node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/index.js +11 -0
- package/dist/node_modules/.pnpm/serialize-javascript@6.0.2/node_modules/serialize-javascript/index.js +114 -0
- package/dist/node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js +76 -0
- package/dist/node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js +89 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Pool.js +366 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Promise.js +248 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/WorkerHandler.js +419 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/debug-port-allocator.js +27 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/environment.js +18 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/generated/embeddedWorker.js +16 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/index.js +63 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/transfer.js +21 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/validateOptions.js +9 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/worker.js +277 -0
- package/dist/register.d.ts +10 -0
- package/dist/register.js +40 -0
- package/dist/typings/index.d.ts +1 -0
- package/package.json +71 -98
- package/dist/commonjs/app/extend/agent.d.ts +0 -34
- package/dist/commonjs/app/extend/agent.js +0 -49
- package/dist/commonjs/app/extend/application.d.ts +0 -172
- package/dist/commonjs/app/extend/application.js +0 -450
- package/dist/commonjs/app/middleware/cluster_app_mock.d.ts +0 -3
- package/dist/commonjs/app/middleware/cluster_app_mock.js +0 -101
- package/dist/commonjs/app.d.ts +0 -6
- package/dist/commonjs/app.js +0 -20
- package/dist/commonjs/bootstrap.d.ts +0 -5
- package/dist/commonjs/bootstrap.js +0 -59
- package/dist/commonjs/index.d.ts +0 -77
- package/dist/commonjs/index.js +0 -114
- package/dist/commonjs/lib/agent_handler.d.ts +0 -3
- package/dist/commonjs/lib/agent_handler.js +0 -28
- package/dist/commonjs/lib/app.d.ts +0 -3
- package/dist/commonjs/lib/app.js +0 -301
- package/dist/commonjs/lib/app_handler.d.ts +0 -5
- package/dist/commonjs/lib/app_handler.js +0 -71
- package/dist/commonjs/lib/cluster.d.ts +0 -114
- package/dist/commonjs/lib/cluster.js +0 -337
- package/dist/commonjs/lib/context.d.ts +0 -1
- package/dist/commonjs/lib/context.js +0 -16
- package/dist/commonjs/lib/format_options.d.ts +0 -5
- package/dist/commonjs/lib/format_options.js +0 -100
- package/dist/commonjs/lib/inject_context.d.ts +0 -6
- package/dist/commonjs/lib/inject_context.js +0 -132
- package/dist/commonjs/lib/mock_agent.d.ts +0 -5
- package/dist/commonjs/lib/mock_agent.js +0 -49
- package/dist/commonjs/lib/mock_custom_loader.d.ts +0 -1
- package/dist/commonjs/lib/mock_custom_loader.js +0 -37
- package/dist/commonjs/lib/mock_http_server.d.ts +0 -2
- package/dist/commonjs/lib/mock_http_server.js +0 -24
- package/dist/commonjs/lib/mock_httpclient.d.ts +0 -36
- package/dist/commonjs/lib/mock_httpclient.js +0 -147
- package/dist/commonjs/lib/parallel/agent.d.ts +0 -20
- package/dist/commonjs/lib/parallel/agent.js +0 -125
- package/dist/commonjs/lib/parallel/app.d.ts +0 -20
- package/dist/commonjs/lib/parallel/app.js +0 -115
- package/dist/commonjs/lib/parallel/util.d.ts +0 -3
- package/dist/commonjs/lib/parallel/util.js +0 -77
- package/dist/commonjs/lib/prerequire.d.ts +0 -1
- package/dist/commonjs/lib/prerequire.js +0 -26
- package/dist/commonjs/lib/request_call_function.d.ts +0 -1
- package/dist/commonjs/lib/request_call_function.js +0 -52
- package/dist/commonjs/lib/restore.d.ts +0 -1
- package/dist/commonjs/lib/restore.js +0 -16
- package/dist/commonjs/lib/start-cluster.d.ts +0 -2
- package/dist/commonjs/lib/start-cluster.js +0 -23
- package/dist/commonjs/lib/supertest.d.ts +0 -11
- package/dist/commonjs/lib/supertest.js +0 -48
- package/dist/commonjs/lib/tmp/empty.d.ts +0 -1
- package/dist/commonjs/lib/tmp/empty.js +0 -3
- package/dist/commonjs/lib/types.d.ts +0 -68
- package/dist/commonjs/lib/types.js +0 -3
- package/dist/commonjs/lib/utils.d.ts +0 -9
- package/dist/commonjs/lib/utils.js +0 -80
- package/dist/commonjs/package.json +0 -3
- package/dist/commonjs/register.d.ts +0 -8
- package/dist/commonjs/register.js +0 -80
- package/dist/esm/app/extend/agent.d.ts +0 -34
- package/dist/esm/app/extend/agent.js +0 -46
- package/dist/esm/app/extend/application.d.ts +0 -172
- package/dist/esm/app/extend/application.js +0 -444
- package/dist/esm/app/middleware/cluster_app_mock.d.ts +0 -3
- package/dist/esm/app/middleware/cluster_app_mock.js +0 -99
- package/dist/esm/app.d.ts +0 -6
- package/dist/esm/app.js +0 -17
- package/dist/esm/bootstrap.d.ts +0 -5
- package/dist/esm/bootstrap.js +0 -15
- package/dist/esm/index.d.ts +0 -77
- package/dist/esm/index.js +0 -91
- package/dist/esm/lib/agent_handler.d.ts +0 -3
- package/dist/esm/lib/agent_handler.js +0 -24
- package/dist/esm/lib/app.d.ts +0 -3
- package/dist/esm/lib/app.js +0 -295
- package/dist/esm/lib/app_handler.d.ts +0 -5
- package/dist/esm/lib/app_handler.js +0 -65
- package/dist/esm/lib/cluster.d.ts +0 -114
- package/dist/esm/lib/cluster.js +0 -328
- package/dist/esm/lib/context.d.ts +0 -1
- package/dist/esm/lib/context.js +0 -13
- package/dist/esm/lib/format_options.d.ts +0 -5
- package/dist/esm/lib/format_options.js +0 -94
- package/dist/esm/lib/inject_context.d.ts +0 -6
- package/dist/esm/lib/inject_context.js +0 -126
- package/dist/esm/lib/mock_agent.d.ts +0 -5
- package/dist/esm/lib/mock_agent.js +0 -45
- package/dist/esm/lib/mock_custom_loader.d.ts +0 -1
- package/dist/esm/lib/mock_custom_loader.js +0 -34
- package/dist/esm/lib/mock_http_server.d.ts +0 -2
- package/dist/esm/lib/mock_http_server.js +0 -18
- package/dist/esm/lib/mock_httpclient.d.ts +0 -36
- package/dist/esm/lib/mock_httpclient.js +0 -144
- package/dist/esm/lib/parallel/agent.d.ts +0 -20
- package/dist/esm/lib/parallel/agent.js +0 -117
- package/dist/esm/lib/parallel/app.d.ts +0 -20
- package/dist/esm/lib/parallel/app.js +0 -110
- package/dist/esm/lib/parallel/util.d.ts +0 -3
- package/dist/esm/lib/parallel/util.js +0 -73
- package/dist/esm/lib/prerequire.d.ts +0 -1
- package/dist/esm/lib/prerequire.js +0 -25
- package/dist/esm/lib/request_call_function.d.ts +0 -1
- package/dist/esm/lib/request_call_function.js +0 -47
- package/dist/esm/lib/restore.d.ts +0 -1
- package/dist/esm/lib/restore.js +0 -13
- package/dist/esm/lib/start-cluster.d.ts +0 -2
- package/dist/esm/lib/start-cluster.js +0 -18
- package/dist/esm/lib/supertest.d.ts +0 -11
- package/dist/esm/lib/supertest.js +0 -40
- package/dist/esm/lib/tmp/empty.d.ts +0 -1
- package/dist/esm/lib/tmp/empty.js +0 -2
- package/dist/esm/lib/types.d.ts +0 -68
- package/dist/esm/lib/types.js +0 -2
- package/dist/esm/lib/utils.d.ts +0 -9
- package/dist/esm/lib/utils.js +0 -69
- package/dist/esm/package.json +0 -3
- package/dist/esm/register.d.ts +0 -8
- package/dist/esm/register.js +0 -75
- package/dist/package.json +0 -4
- package/src/app/extend/agent.ts +0 -57
- package/src/app/extend/application.ts +0 -512
- package/src/app/middleware/cluster_app_mock.ts +0 -102
- package/src/app.ts +0 -18
- package/src/bootstrap.ts +0 -25
- package/src/index.ts +0 -112
- package/src/lib/agent_handler.ts +0 -28
- package/src/lib/app.ts +0 -314
- package/src/lib/app_handler.ts +0 -77
- package/src/lib/cluster.ts +0 -363
- package/src/lib/context.ts +0 -14
- package/src/lib/format_options.ts +0 -103
- package/src/lib/inject_context.ts +0 -134
- package/src/lib/mock_agent.ts +0 -57
- package/src/lib/mock_custom_loader.ts +0 -36
- package/src/lib/mock_http_server.ts +0 -19
- package/src/lib/mock_httpclient.ts +0 -183
- package/src/lib/parallel/agent.ts +0 -128
- package/src/lib/parallel/app.ts +0 -123
- package/src/lib/parallel/util.ts +0 -66
- package/src/lib/prerequire.ts +0 -25
- package/src/lib/request_call_function.ts +0 -49
- package/src/lib/restore.ts +0 -14
- package/src/lib/start-cluster.ts +0 -23
- package/src/lib/supertest.ts +0 -45
- package/src/lib/tmp/.gitkeep +0 -0
- package/src/lib/tmp/empty.ts +0 -0
- package/src/lib/utils.ts +0 -82
- package/src/register.ts +0 -80
- package/src/typings/index.d.ts +0 -4
|
@@ -1,55 +1,49 @@
|
|
|
1
|
-
|
|
1
|
+
import { MockHttpClientMethod, MockResponseCallbackOptions, MockResultFunction, MockResultOptions, ResultObject } from "./mock_httpclient.js";
|
|
2
|
+
import { MockAgent } from "urllib";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/types.d.ts
|
|
5
|
+
interface MockOptions {
|
|
2
6
|
/**
|
|
3
7
|
* The directory of the application
|
|
4
8
|
*/
|
|
5
9
|
baseDir?: string;
|
|
6
|
-
|
|
7
10
|
/**
|
|
8
11
|
* Custom you plugins
|
|
9
12
|
*/
|
|
10
13
|
plugins?: any;
|
|
11
|
-
|
|
12
14
|
/**
|
|
13
15
|
* The directory of the egg framework
|
|
14
16
|
*
|
|
15
17
|
* Set to `true` to use the current directory as framework directory
|
|
16
18
|
*/
|
|
17
19
|
framework?: string | boolean;
|
|
18
|
-
|
|
19
20
|
/**
|
|
20
21
|
* current test on plugin
|
|
21
22
|
*/
|
|
22
23
|
plugin?: boolean;
|
|
23
|
-
|
|
24
24
|
/**
|
|
25
|
-
* @deprecated please use framework instead
|
|
25
|
+
* @deprecated please use `framework` instead
|
|
26
26
|
*/
|
|
27
27
|
customEgg?: string | boolean;
|
|
28
|
-
|
|
29
28
|
/**
|
|
30
29
|
* Cache application based on baseDir
|
|
31
30
|
*/
|
|
32
31
|
cache?: boolean;
|
|
33
|
-
|
|
34
32
|
/**
|
|
35
33
|
* Switch on process coverage, but it'll be slower
|
|
36
34
|
*/
|
|
37
35
|
coverage?: boolean;
|
|
38
|
-
|
|
39
36
|
/**
|
|
40
37
|
* Remove $baseDir/logs and $baseDir/run before start, default is `true`
|
|
41
38
|
*/
|
|
42
39
|
clean?: boolean;
|
|
43
|
-
|
|
44
40
|
/**
|
|
45
41
|
* default options.mockCtxStorage value on each mockContext
|
|
46
42
|
*/
|
|
47
43
|
mockCtxStorage?: boolean;
|
|
48
|
-
|
|
49
44
|
beforeInit?: (app: any) => Promise<void>;
|
|
50
45
|
}
|
|
51
|
-
|
|
52
|
-
export interface MockClusterOptions extends MockOptions {
|
|
46
|
+
interface MockClusterOptions extends MockOptions {
|
|
53
47
|
workers?: number | string;
|
|
54
48
|
cache?: boolean;
|
|
55
49
|
port?: number;
|
|
@@ -59,31 +53,20 @@ export interface MockClusterOptions extends MockOptions {
|
|
|
59
53
|
opt?: object;
|
|
60
54
|
startMode?: 'process' | 'worker_threads';
|
|
61
55
|
}
|
|
62
|
-
|
|
63
56
|
/**
|
|
64
57
|
* @deprecated please use MockOptions instead
|
|
65
58
|
* keep this for compatible
|
|
66
59
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
export interface MockApplicationOptions extends MockOptions {
|
|
60
|
+
type MockOption = MockOptions;
|
|
61
|
+
interface MockApplicationOptions extends MockOptions {
|
|
70
62
|
baseDir: string;
|
|
71
63
|
framework: string;
|
|
72
64
|
clusterPort?: number;
|
|
73
65
|
}
|
|
74
|
-
|
|
75
|
-
export interface MockClusterApplicationOptions extends MockClusterOptions {
|
|
66
|
+
interface MockClusterApplicationOptions extends MockClusterOptions {
|
|
76
67
|
baseDir: string;
|
|
77
68
|
framework: string;
|
|
78
69
|
port: number;
|
|
79
70
|
}
|
|
80
|
-
|
|
81
|
-
export type
|
|
82
|
-
MockResultOptions, ResultObject,
|
|
83
|
-
MockResponseCallbackOptions, MockResultFunction,
|
|
84
|
-
MockHttpClientMethod,
|
|
85
|
-
} from './mock_httpclient.js';
|
|
86
|
-
|
|
87
|
-
export type {
|
|
88
|
-
MockAgent,
|
|
89
|
-
} from 'urllib';
|
|
71
|
+
//#endregion
|
|
72
|
+
export { type MockAgent, MockApplicationOptions, MockClusterApplicationOptions, MockClusterOptions, type MockHttpClientMethod, MockOption, MockOptions, type MockResponseCallbackOptions, type MockResultFunction, type MockResultOptions, type ResultObject };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/lib/utils.d.ts
|
|
2
|
+
declare function getSourceDirname(): string;
|
|
3
|
+
declare function sleep(delay: number): Promise<void>;
|
|
4
|
+
declare function rimraf(filepath: string): Promise<void>;
|
|
5
|
+
declare function rimrafSync(filepath: string): void;
|
|
6
|
+
declare function getProperty(target: any, prop: PropertyKey): any;
|
|
7
|
+
declare function getEggOptions(): {
|
|
8
|
+
baseDir: string;
|
|
9
|
+
framework: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { getEggOptions, getProperty, getSourceDirname, rimraf, rimrafSync, sleep };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { rmSync } from "node:fs";
|
|
3
|
+
import { rm } from "node:fs/promises";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { scheduler } from "node:timers/promises";
|
|
6
|
+
|
|
7
|
+
//#region src/lib/utils.ts
|
|
8
|
+
function getSourceDirname() {
|
|
9
|
+
if (typeof __dirname !== "undefined") return path.dirname(__dirname);
|
|
10
|
+
return path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
11
|
+
}
|
|
12
|
+
async function sleep(delay) {
|
|
13
|
+
await scheduler.wait(delay);
|
|
14
|
+
}
|
|
15
|
+
async function rimraf(filepath) {
|
|
16
|
+
await rm(filepath, {
|
|
17
|
+
force: true,
|
|
18
|
+
recursive: true
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function rimrafSync(filepath) {
|
|
22
|
+
rmSync(filepath, {
|
|
23
|
+
force: true,
|
|
24
|
+
recursive: true
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function getProperty(target, prop) {
|
|
28
|
+
const member = target[prop];
|
|
29
|
+
if (typeof member === "function") return member.bind(target);
|
|
30
|
+
return member;
|
|
31
|
+
}
|
|
32
|
+
function getEggOptions() {
|
|
33
|
+
return {
|
|
34
|
+
baseDir: process.env.EGG_BASE_DIR ?? process.cwd(),
|
|
35
|
+
framework: process.env.EGG_FRAMEWORK
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { getEggOptions, getProperty, getSourceDirname, rimraf, rimrafSync, sleep };
|
|
@@ -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 };
|