nitro 3.0.0 → 3.0.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_build/common.mjs +68 -0
- package/dist/_build/common2.mjs +772 -0
- package/dist/_build/rolldown.mjs +206 -0
- package/dist/_build/rollup.mjs +289 -0
- package/dist/_build/vite.build.mjs +56 -0
- package/dist/_build/vite.plugin.mjs +768 -0
- package/dist/_chunks/ANM1K1bE.mjs +304 -0
- package/dist/_chunks/B-D1JOIz.mjs +1355 -0
- package/dist/_chunks/BX9-zVkM.mjs +59 -0
- package/dist/_chunks/Bqks5huO.mjs +31 -0
- package/dist/_chunks/C7CbzoI1.mjs +39 -0
- package/dist/_dev.d.mts +12 -0
- package/dist/_dev.mjs +705 -0
- package/dist/_libs/acorn.mjs +5034 -0
- package/dist/_libs/c12.mjs +2858 -0
- package/dist/_libs/chokidar.mjs +1561 -0
- package/dist/_libs/citty.mjs +333 -0
- package/dist/_libs/commondir.mjs +22 -0
- package/dist/_libs/compatx.mjs +46 -0
- package/dist/_libs/confbox.mjs +2920 -0
- package/dist/_libs/deepmerge.mjs +86 -0
- package/dist/_libs/dot-prop.mjs +138 -0
- package/dist/_libs/duplexer.mjs +71 -0
- package/dist/_libs/escape-string-regexp.mjs +8 -0
- package/dist/_libs/estree-walker.mjs +330 -0
- package/dist/_libs/etag.mjs +80 -0
- package/dist/_libs/fdir.mjs +514 -0
- package/dist/_libs/function-bind.mjs +63 -0
- package/dist/_libs/gen-mapping.mjs +612 -0
- package/dist/_libs/giget.mjs +19289 -0
- package/dist/_libs/gzip-size.mjs +21 -0
- package/dist/_libs/hasown.mjs +14 -0
- package/dist/_libs/httpxy.mjs +410 -0
- package/dist/_libs/is-core-module.mjs +220 -0
- package/dist/_libs/is-module.mjs +13 -0
- package/dist/_libs/is-reference.mjs +32 -0
- package/dist/_libs/js-tokens.mjs +382 -0
- package/dist/_libs/klona.mjs +38 -0
- package/dist/_libs/knitwork.mjs +124 -0
- package/dist/_libs/local-pkg.mjs +1686 -0
- package/dist/_libs/magic-string.mjs +939 -0
- package/dist/_libs/mime.mjs +1391 -0
- package/dist/_libs/node-fetch-native.mjs +173 -0
- package/dist/_libs/path-parse.mjs +47 -0
- package/dist/_libs/pathe.mjs +41 -0
- package/dist/_libs/picomatch.mjs +1673 -0
- package/dist/_libs/plugin-alias.mjs +64 -0
- package/dist/_libs/plugin-commonjs.mjs +1491 -0
- package/dist/_libs/plugin-inject.mjs +135 -0
- package/dist/_libs/plugin-json.mjs +36 -0
- package/dist/_libs/plugin-node-resolve.mjs +1553 -0
- package/dist/_libs/plugin-replace.mjs +104 -0
- package/dist/_libs/pretty-bytes.mjs +116 -0
- package/dist/_libs/remapping.mjs +117 -0
- package/dist/_libs/rou3.mjs +319 -0
- package/dist/_libs/std-env.mjs +158 -0
- package/dist/_libs/strip-literal.mjs +51 -0
- package/dist/_libs/tinyglobby.mjs +292 -0
- package/dist/_libs/tsconfck.mjs +832 -0
- package/dist/_libs/ultrahtml.mjs +138 -0
- package/dist/_libs/unimport.mjs +3520 -0
- package/dist/_libs/untyped.mjs +271 -0
- package/dist/_libs/unwasm.mjs +5836 -0
- package/dist/_libs/vite-plugin-fullstack.mjs +561 -0
- package/dist/_presets.mjs +1752 -0
- package/dist/builder.d.mts +63 -0
- package/dist/builder.mjs +33 -0
- package/dist/cli/_chunks/build.mjs +48 -0
- package/dist/cli/_chunks/common.mjs +15 -0
- package/dist/cli/_chunks/detect-acorn.mjs +12 -0
- package/dist/cli/_chunks/dev.mjs +68 -0
- package/dist/cli/_chunks/dist.mjs +3 -0
- package/dist/cli/_chunks/dist2.mjs +3 -0
- package/dist/cli/_chunks/dist3.mjs +3 -0
- package/dist/cli/_chunks/dist4.mjs +4 -0
- package/dist/cli/_chunks/dist5.mjs +4 -0
- package/dist/cli/_chunks/esm.mjs +3 -0
- package/dist/cli/_chunks/json5.mjs +4 -0
- package/dist/cli/_chunks/jsonc.mjs +4 -0
- package/dist/cli/_chunks/list.mjs +27 -0
- package/dist/cli/_chunks/multipart-parser.mjs +6 -0
- package/dist/cli/_chunks/prepare.mjs +19 -0
- package/dist/cli/_chunks/run.mjs +55 -0
- package/dist/cli/_chunks/task.mjs +16 -0
- package/dist/cli/_chunks/toml.mjs +4 -0
- package/dist/cli/_chunks/yaml.mjs +4 -0
- package/dist/cli/index.d.mts +1 -1
- package/dist/cli/index.mjs +20 -476
- package/dist/node_modules/@poppinss/dumper/build/formatters/html/main.js +1 -1
- package/dist/node_modules/@poppinss/dumper/package.json +1 -1
- package/dist/node_modules/@sindresorhus/is/distribution/index.js +1 -1
- package/dist/node_modules/@sindresorhus/is/package.json +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/index.js +2 -2
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +2 -2
- package/dist/node_modules/@speed-highlight/core/package.json +7 -3
- package/dist/node_modules/cookie-es/dist/index.mjs +262 -0
- package/dist/node_modules/cookie-es/package.json +37 -0
- package/dist/node_modules/hookable/dist/index.mjs +243 -266
- package/dist/node_modules/hookable/package.json +29 -26
- package/dist/node_modules/rendu/dist/index.mjs +380 -0
- package/dist/node_modules/rendu/package.json +47 -0
- package/dist/node_modules/youch/build/{chunk-VE4LENUR.js → chunk-F4I6KX4R.js} +2 -1
- package/dist/node_modules/youch/build/{chunk-JAN2TFI2.js → chunk-YYEJ3AGB.js} +4 -1
- package/dist/node_modules/youch/build/index.js +16 -8
- package/dist/node_modules/youch/build/public/error_stack/script.js +20 -22
- package/dist/node_modules/youch/build/public/header/script.js +0 -2
- package/dist/node_modules/youch/build/public/layout/script.js +0 -8
- package/dist/node_modules/youch/build/public/layout/style.css +4 -0
- package/dist/node_modules/youch/package.json +16 -17
- package/dist/presets/_nitro/runtime/nitro-dev.d.mts +1 -0
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +48 -42
- package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +2 -2
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +10 -14
- package/dist/presets/_nitro/runtime/service-worker.d.mts +1 -0
- package/dist/presets/_nitro/runtime/service-worker.mjs +15 -12
- package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +1 -0
- package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +7 -6
- package/dist/presets/aws-lambda/runtime/_utils.d.mts +8 -13
- package/dist/presets/aws-lambda/runtime/_utils.mjs +95 -81
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +1 -2
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +26 -28
- package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +8 -8
- package/dist/presets/azure/runtime/_utils.mjs +43 -43
- package/dist/presets/azure/runtime/azure-swa.d.mts +2 -2
- package/dist/presets/azure/runtime/azure-swa.mjs +24 -22
- package/dist/presets/bun/runtime/bun.d.mts +2 -0
- package/dist/presets/bun/runtime/bun.mjs +34 -21
- package/dist/presets/cloudflare/runtime/_module-handler.d.mts +10 -7
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +80 -88
- package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +6 -14
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +60 -63
- package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +1 -7
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +14 -16
- package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +12 -12
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +40 -42
- package/dist/presets/cloudflare/runtime/plugin.dev.d.mts +2 -2
- package/dist/presets/cloudflare/runtime/plugin.dev.mjs +89 -82
- package/dist/presets/cloudflare/runtime/shims/workers.dev.mjs +27 -0
- package/dist/presets/deno/runtime/deno-deploy.d.mts +4 -0
- package/dist/presets/deno/runtime/deno-deploy.mjs +15 -12
- package/dist/presets/deno/runtime/deno-server.d.mts +0 -3
- package/dist/presets/deno/runtime/deno-server.mjs +32 -52
- package/dist/presets/netlify/runtime/netlify-edge.d.mts +2 -1
- package/dist/presets/netlify/runtime/netlify-edge.mjs +15 -12
- package/dist/presets/netlify/runtime/netlify.mjs +12 -18
- package/dist/presets/node/runtime/node-cluster.d.mts +3 -1
- package/dist/presets/node/runtime/node-cluster.mjs +50 -54
- package/dist/presets/node/runtime/node-middleware.d.mts +2 -3
- package/dist/presets/node/runtime/node-middleware.mjs +9 -8
- package/dist/presets/node/runtime/node-server.mjs +37 -34
- package/dist/presets/standard/runtime/server.d.mts +1 -3
- package/dist/presets/standard/runtime/server.mjs +2 -4
- package/dist/presets/stormkit/runtime/stormkit.d.mts +13 -13
- package/dist/presets/stormkit/runtime/stormkit.mjs +21 -21
- package/dist/presets/vercel/runtime/vercel.node.d.mts +3 -0
- package/dist/presets/vercel/runtime/vercel.node.mjs +15 -0
- package/dist/presets/vercel/runtime/{vercel.d.mts → vercel.web.d.mts} +3 -3
- package/dist/presets/vercel/runtime/vercel.web.mjs +20 -0
- package/dist/presets/winterjs/runtime/winterjs.d.mts +2 -0
- package/dist/presets/winterjs/runtime/winterjs.mjs +73 -69
- package/dist/presets/zeabur/runtime/zeabur.d.mts +1 -1
- package/dist/presets/zeabur/runtime/zeabur.mjs +1 -1
- package/dist/runtime/app.d.mts +1 -0
- package/dist/runtime/app.mjs +1 -0
- package/dist/runtime/cache.d.mts +1 -0
- package/dist/runtime/cache.mjs +1 -0
- package/dist/runtime/config.d.mts +3 -0
- package/dist/runtime/config.mjs +4 -0
- package/dist/runtime/context.d.mts +1 -0
- package/dist/runtime/context.mjs +1 -0
- package/dist/runtime/database.d.mts +1 -0
- package/dist/runtime/database.mjs +1 -0
- package/dist/runtime/internal/app.d.mts +11 -1
- package/dist/runtime/internal/app.mjs +188 -140
- package/dist/runtime/internal/cache.d.mts +9 -5
- package/dist/runtime/internal/cache.mjs +248 -219
- package/dist/runtime/internal/context.d.mts +9 -9
- package/dist/runtime/internal/context.mjs +17 -10
- package/dist/runtime/internal/database.mjs +8 -10
- package/dist/runtime/internal/error/dev.d.mts +5 -4
- package/dist/runtime/internal/error/dev.mjs +106 -105
- package/dist/runtime/internal/error/hooks.d.mts +1 -0
- package/dist/runtime/internal/error/hooks.mjs +9 -0
- package/dist/runtime/internal/error/prod.d.mts +5 -4
- package/dist/runtime/internal/error/prod.mjs +51 -59
- package/dist/runtime/internal/error/utils.d.mts +4 -4
- package/dist/runtime/internal/error/utils.mjs +1 -1
- package/dist/runtime/internal/meta.d.mts +1 -1
- package/dist/runtime/internal/meta.mjs +1 -1
- package/dist/runtime/internal/plugin.d.mts +2 -2
- package/dist/runtime/internal/plugin.mjs +1 -1
- package/dist/runtime/internal/route-rules.d.mts +8 -8
- package/dist/runtime/internal/route-rules.mjs +54 -52
- package/dist/runtime/internal/routes/dev-tasks.d.mts +1 -2
- package/dist/runtime/internal/routes/dev-tasks.mjs +16 -18
- package/dist/runtime/internal/routes/openapi.d.mts +1 -0
- package/dist/runtime/internal/routes/openapi.mjs +81 -87
- package/dist/runtime/internal/routes/renderer-template.d.mts +1 -1
- package/dist/runtime/internal/routes/renderer-template.dev.d.mts +1 -2
- package/dist/runtime/internal/routes/renderer-template.dev.mjs +15 -17
- package/dist/runtime/internal/routes/renderer-template.mjs +1 -1
- package/dist/runtime/internal/routes/scalar.d.mts +1 -0
- package/dist/runtime/internal/routes/scalar.mjs +22 -23
- package/dist/runtime/internal/routes/swagger.d.mts +1 -0
- package/dist/runtime/internal/routes/swagger.mjs +9 -11
- package/dist/runtime/internal/runtime-config.d.mts +4 -4
- package/dist/runtime/internal/runtime-config.mjs +40 -35
- package/dist/runtime/internal/static.mjs +63 -74
- package/dist/runtime/internal/storage.mjs +2 -2
- package/dist/runtime/internal/task.d.mts +6 -6
- package/dist/runtime/internal/task.mjs +56 -60
- package/dist/runtime/internal/vite/dev-entry.mjs +11 -1
- package/dist/runtime/internal/vite/dev-worker.mjs +9 -57
- package/dist/runtime/internal/vite/ssr-renderer.mjs +3 -1
- package/{lib/runtime-meta.d.mts → dist/runtime/meta.d.mts} +1 -1
- package/dist/runtime/meta.mjs +26 -0
- package/dist/runtime/nitro.d.mts +12 -0
- package/dist/runtime/nitro.mjs +32 -0
- package/dist/runtime/runtime-config.d.mts +1 -0
- package/dist/runtime/runtime-config.mjs +1 -0
- package/dist/runtime/storage.d.mts +1 -0
- package/dist/runtime/storage.mjs +1 -0
- package/dist/runtime/task.d.mts +1 -0
- package/dist/runtime/task.mjs +1 -0
- package/dist/runtime/vite-runtime.d.mts +8 -0
- package/dist/runtime/vite-runtime.mjs +9 -0
- package/dist/types/index.d.mts +2625 -2297
- package/dist/types/index.mjs +1 -1
- package/dist/vite.d.mts +49 -51
- package/dist/vite.mjs +44 -68
- package/lib/tsconfig.json +27 -0
- package/package.json +86 -76
- package/dist/_chunks/app.mjs +0 -19797
- package/dist/_chunks/build.mjs +0 -84
- package/dist/_chunks/build2.mjs +0 -318
- package/dist/_chunks/build3.mjs +0 -6452
- package/dist/_chunks/detect-acorn.mjs +0 -503
- package/dist/_chunks/index.mjs +0 -22242
- package/dist/_chunks/index2.mjs +0 -297
- package/dist/_chunks/index3.mjs +0 -1058
- package/dist/_chunks/index4.mjs +0 -1206
- package/dist/_chunks/info.mjs +0 -11157
- package/dist/_chunks/json5.mjs +0 -68
- package/dist/_chunks/jsonc.mjs +0 -51
- package/dist/_chunks/pathe.M-eThtNZ.mjs +0 -204
- package/dist/_chunks/plugin.mjs +0 -960
- package/dist/_chunks/server.mjs +0 -254
- package/dist/_chunks/snapshot.mjs +0 -284
- package/dist/_chunks/toml.mjs +0 -259
- package/dist/_chunks/yaml.mjs +0 -86
- package/dist/cli/build.mjs +0 -54
- package/dist/cli/common.mjs +0 -13
- package/dist/cli/dev.mjs +0 -95
- package/dist/cli/index2.mjs +0 -17
- package/dist/cli/list.mjs +0 -34
- package/dist/cli/prepare.mjs +0 -24
- package/dist/cli/run.mjs +0 -60
- package/dist/index.d.mts +0 -52
- package/dist/index.mjs +0 -55
- package/dist/node_modules/cookie/dist/index.js +0 -239
- package/dist/node_modules/cookie/package.json +0 -42
- package/dist/node_modules/klona/dist/index.mjs +0 -81
- package/dist/node_modules/klona/full/index.mjs +0 -53
- package/dist/node_modules/klona/package.json +0 -74
- package/dist/node_modules/std-env/dist/index.mjs +0 -1
- package/dist/node_modules/std-env/package.json +0 -46
- package/dist/presets/vercel/runtime/vercel.mjs +0 -17
- package/dist/presets.mjs +0 -2460
- package/dist/runtime/index.d.mts +0 -11
- package/dist/runtime/index.mjs +0 -17
- package/dist/runtime/internal/debug.d.mts +0 -2
- package/dist/runtime/internal/debug.mjs +0 -5
- package/dist/runtime/internal/empty.d.mts +0 -0
- package/dist/runtime/internal/index.d.mts +0 -3
- package/dist/runtime/internal/index.mjs +0 -3
- package/dist/runtime/internal/lib/http-graceful-shutdown.d.mts +0 -16
- package/dist/runtime/internal/lib/http-graceful-shutdown.mjs +0 -213
- package/dist/runtime/internal/renderer.d.mts +0 -3
- package/dist/runtime/internal/renderer.mjs +0 -36
- package/dist/runtime/internal/shutdown.d.mts +0 -9
- package/dist/runtime/internal/shutdown.mjs +0 -34
- package/dist/runtime/internal/utils.d.mts +0 -1
- package/dist/runtime/internal/utils.mjs +0 -15
- package/dist/runtime/internal/vite/dev-entry.d.mts +0 -1
- package/dist/runtime/internal/vite/dev-worker.d.mts +0 -1
- package/dist/runtime/internal/vite/prod-setup.d.mts +0 -4
- package/dist/runtime/internal/vite/prod-setup.mjs +0 -55
- package/dist/runtime/internal/vite/ssr-renderer.d.mts +0 -4
- package/lib/config.d.mts +0 -9
- package/lib/config.mjs +0 -5
- package/lib/meta.d.mts +0 -5
- package/lib/meta.mjs +0 -21
- package/lib/runtime-meta.mjs +0 -38
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { t as __commonJS } from "../_chunks/Bqks5huO.mjs";
|
|
2
|
+
|
|
3
|
+
//#region node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js
|
|
4
|
+
var require_cjs = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js": ((exports, module) => {
|
|
5
|
+
var isMergeableObject = function isMergeableObject$1(value) {
|
|
6
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
7
|
+
};
|
|
8
|
+
function isNonNullObject(value) {
|
|
9
|
+
return !!value && typeof value === "object";
|
|
10
|
+
}
|
|
11
|
+
function isSpecial(value) {
|
|
12
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
13
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
14
|
+
}
|
|
15
|
+
var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.element") : 60103;
|
|
16
|
+
function isReactElement(value) {
|
|
17
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
18
|
+
}
|
|
19
|
+
function emptyTarget(val) {
|
|
20
|
+
return Array.isArray(val) ? [] : {};
|
|
21
|
+
}
|
|
22
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
23
|
+
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
24
|
+
}
|
|
25
|
+
function defaultArrayMerge(target, source, options) {
|
|
26
|
+
return target.concat(source).map(function(element) {
|
|
27
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function getMergeFunction(key, options) {
|
|
31
|
+
if (!options.customMerge) return deepmerge;
|
|
32
|
+
var customMerge = options.customMerge(key);
|
|
33
|
+
return typeof customMerge === "function" ? customMerge : deepmerge;
|
|
34
|
+
}
|
|
35
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
36
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
37
|
+
return Object.propertyIsEnumerable.call(target, symbol);
|
|
38
|
+
}) : [];
|
|
39
|
+
}
|
|
40
|
+
function getKeys(target) {
|
|
41
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
42
|
+
}
|
|
43
|
+
function propertyIsOnObject(object, property) {
|
|
44
|
+
try {
|
|
45
|
+
return property in object;
|
|
46
|
+
} catch (_) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function propertyIsUnsafe(target, key) {
|
|
51
|
+
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
52
|
+
}
|
|
53
|
+
function mergeObject(target, source, options) {
|
|
54
|
+
var destination = {};
|
|
55
|
+
if (options.isMergeableObject(target)) getKeys(target).forEach(function(key) {
|
|
56
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
57
|
+
});
|
|
58
|
+
getKeys(source).forEach(function(key) {
|
|
59
|
+
if (propertyIsUnsafe(target, key)) return;
|
|
60
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
61
|
+
else destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
62
|
+
});
|
|
63
|
+
return destination;
|
|
64
|
+
}
|
|
65
|
+
function deepmerge(target, source, options) {
|
|
66
|
+
options = options || {};
|
|
67
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
68
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
69
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
70
|
+
var sourceIsArray = Array.isArray(source);
|
|
71
|
+
if (!(sourceIsArray === Array.isArray(target))) return cloneUnlessOtherwiseSpecified(source, options);
|
|
72
|
+
else if (sourceIsArray) return options.arrayMerge(target, source, options);
|
|
73
|
+
else return mergeObject(target, source, options);
|
|
74
|
+
}
|
|
75
|
+
deepmerge.all = function deepmergeAll(array, options) {
|
|
76
|
+
if (!Array.isArray(array)) throw new Error("first argument should be an array");
|
|
77
|
+
return array.reduce(function(prev, next) {
|
|
78
|
+
return deepmerge(prev, next, options);
|
|
79
|
+
}, {});
|
|
80
|
+
};
|
|
81
|
+
var deepmerge_1 = deepmerge;
|
|
82
|
+
module.exports = deepmerge_1;
|
|
83
|
+
}) });
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
export { require_cjs as t };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/dot-prop@10.1.0/node_modules/dot-prop/index.js
|
|
2
|
+
const isObject = (value) => {
|
|
3
|
+
const type = typeof value;
|
|
4
|
+
return value !== null && (type === "object" || type === "function");
|
|
5
|
+
};
|
|
6
|
+
const disallowedKeys = new Set([
|
|
7
|
+
"__proto__",
|
|
8
|
+
"prototype",
|
|
9
|
+
"constructor"
|
|
10
|
+
]);
|
|
11
|
+
const MAX_ARRAY_INDEX = 1e6;
|
|
12
|
+
const isDigit = (character) => character >= "0" && character <= "9";
|
|
13
|
+
function shouldCoerceToNumber(segment) {
|
|
14
|
+
if (segment === "0") return true;
|
|
15
|
+
if (/^[1-9]\d*$/.test(segment)) {
|
|
16
|
+
const parsedNumber = Number.parseInt(segment, 10);
|
|
17
|
+
return parsedNumber <= Number.MAX_SAFE_INTEGER && parsedNumber <= MAX_ARRAY_INDEX;
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
function processSegment(segment, parts) {
|
|
22
|
+
if (disallowedKeys.has(segment)) return false;
|
|
23
|
+
if (segment && shouldCoerceToNumber(segment)) parts.push(Number.parseInt(segment, 10));
|
|
24
|
+
else parts.push(segment);
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
function parsePath(path) {
|
|
28
|
+
if (typeof path !== "string") throw new TypeError(`Expected a string, got ${typeof path}`);
|
|
29
|
+
const parts = [];
|
|
30
|
+
let currentSegment = "";
|
|
31
|
+
let currentPart = "start";
|
|
32
|
+
let isEscaping = false;
|
|
33
|
+
let position = 0;
|
|
34
|
+
for (const character of path) {
|
|
35
|
+
position++;
|
|
36
|
+
if (isEscaping) {
|
|
37
|
+
currentSegment += character;
|
|
38
|
+
isEscaping = false;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (character === "\\") {
|
|
42
|
+
if (currentPart === "index") throw new Error(`Invalid character '${character}' in an index at position ${position}`);
|
|
43
|
+
if (currentPart === "indexEnd") throw new Error(`Invalid character '${character}' after an index at position ${position}`);
|
|
44
|
+
isEscaping = true;
|
|
45
|
+
currentPart = currentPart === "start" ? "property" : currentPart;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
switch (character) {
|
|
49
|
+
case ".":
|
|
50
|
+
if (currentPart === "index") throw new Error(`Invalid character '${character}' in an index at position ${position}`);
|
|
51
|
+
if (currentPart === "indexEnd") {
|
|
52
|
+
currentPart = "property";
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
if (!processSegment(currentSegment, parts)) return [];
|
|
56
|
+
currentSegment = "";
|
|
57
|
+
currentPart = "property";
|
|
58
|
+
break;
|
|
59
|
+
case "[":
|
|
60
|
+
if (currentPart === "index") throw new Error(`Invalid character '${character}' in an index at position ${position}`);
|
|
61
|
+
if (currentPart === "indexEnd") {
|
|
62
|
+
currentPart = "index";
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
if (currentPart === "property" || currentPart === "start") {
|
|
66
|
+
if ((currentSegment || currentPart === "property") && !processSegment(currentSegment, parts)) return [];
|
|
67
|
+
currentSegment = "";
|
|
68
|
+
}
|
|
69
|
+
currentPart = "index";
|
|
70
|
+
break;
|
|
71
|
+
case "]":
|
|
72
|
+
if (currentPart === "index") {
|
|
73
|
+
if (currentSegment === "") {
|
|
74
|
+
currentSegment = (parts.pop() || "") + "[]";
|
|
75
|
+
currentPart = "property";
|
|
76
|
+
} else {
|
|
77
|
+
const parsedNumber = Number.parseInt(currentSegment, 10);
|
|
78
|
+
if (!Number.isNaN(parsedNumber) && Number.isFinite(parsedNumber) && parsedNumber >= 0 && parsedNumber <= Number.MAX_SAFE_INTEGER && parsedNumber <= MAX_ARRAY_INDEX && currentSegment === String(parsedNumber)) parts.push(parsedNumber);
|
|
79
|
+
else parts.push(currentSegment);
|
|
80
|
+
currentSegment = "";
|
|
81
|
+
currentPart = "indexEnd";
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
if (currentPart === "indexEnd") throw new Error(`Invalid character '${character}' after an index at position ${position}`);
|
|
86
|
+
currentSegment += character;
|
|
87
|
+
break;
|
|
88
|
+
default:
|
|
89
|
+
if (currentPart === "index" && !isDigit(character)) throw new Error(`Invalid character '${character}' in an index at position ${position}`);
|
|
90
|
+
if (currentPart === "indexEnd") throw new Error(`Invalid character '${character}' after an index at position ${position}`);
|
|
91
|
+
if (currentPart === "start") currentPart = "property";
|
|
92
|
+
currentSegment += character;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (isEscaping) currentSegment += "\\";
|
|
96
|
+
switch (currentPart) {
|
|
97
|
+
case "property":
|
|
98
|
+
if (!processSegment(currentSegment, parts)) return [];
|
|
99
|
+
break;
|
|
100
|
+
case "index": throw new Error("Index was not closed");
|
|
101
|
+
case "start":
|
|
102
|
+
parts.push("");
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
return parts;
|
|
106
|
+
}
|
|
107
|
+
function normalizePath(path) {
|
|
108
|
+
if (typeof path === "string") return parsePath(path);
|
|
109
|
+
if (Array.isArray(path)) {
|
|
110
|
+
const normalized = [];
|
|
111
|
+
for (const [index, segment] of path.entries()) {
|
|
112
|
+
if (typeof segment !== "string" && typeof segment !== "number") throw new TypeError(`Expected a string or number for path segment at index ${index}, got ${typeof segment}`);
|
|
113
|
+
if (typeof segment === "number" && !Number.isFinite(segment)) throw new TypeError(`Path segment at index ${index} must be a finite number, got ${segment}`);
|
|
114
|
+
if (disallowedKeys.has(segment)) return [];
|
|
115
|
+
if (typeof segment === "string" && shouldCoerceToNumber(segment)) normalized.push(Number.parseInt(segment, 10));
|
|
116
|
+
else normalized.push(segment);
|
|
117
|
+
}
|
|
118
|
+
return normalized;
|
|
119
|
+
}
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
function getProperty(object, path, value) {
|
|
123
|
+
if (!isObject(object) || typeof path !== "string" && !Array.isArray(path)) return value === void 0 ? object : value;
|
|
124
|
+
const pathArray = normalizePath(path);
|
|
125
|
+
if (pathArray.length === 0) return value;
|
|
126
|
+
for (let index = 0; index < pathArray.length; index++) {
|
|
127
|
+
const key = pathArray[index];
|
|
128
|
+
object = object[key];
|
|
129
|
+
if (object === void 0 || object === null) {
|
|
130
|
+
if (index !== pathArray.length - 1) return value;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return object === void 0 ? value : object;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
//#endregion
|
|
138
|
+
export { getProperty as t };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { n as __require, t as __commonJS } from "../_chunks/Bqks5huO.mjs";
|
|
2
|
+
|
|
3
|
+
//#region node_modules/.pnpm/duplexer@0.1.2/node_modules/duplexer/index.js
|
|
4
|
+
var require_duplexer = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/duplexer@0.1.2/node_modules/duplexer/index.js": ((exports, module) => {
|
|
5
|
+
var Stream = __require("stream");
|
|
6
|
+
var writeMethods = [
|
|
7
|
+
"write",
|
|
8
|
+
"end",
|
|
9
|
+
"destroy"
|
|
10
|
+
];
|
|
11
|
+
var readMethods = ["resume", "pause"];
|
|
12
|
+
var readEvents = ["data", "close"];
|
|
13
|
+
var slice = Array.prototype.slice;
|
|
14
|
+
module.exports = duplex;
|
|
15
|
+
function forEach(arr, fn) {
|
|
16
|
+
if (arr.forEach) return arr.forEach(fn);
|
|
17
|
+
for (var i = 0; i < arr.length; i++) fn(arr[i], i);
|
|
18
|
+
}
|
|
19
|
+
function duplex(writer, reader) {
|
|
20
|
+
var stream = new Stream();
|
|
21
|
+
var ended = false;
|
|
22
|
+
forEach(writeMethods, proxyWriter);
|
|
23
|
+
forEach(readMethods, proxyReader);
|
|
24
|
+
forEach(readEvents, proxyStream);
|
|
25
|
+
reader.on("end", handleEnd);
|
|
26
|
+
writer.on("drain", function() {
|
|
27
|
+
stream.emit("drain");
|
|
28
|
+
});
|
|
29
|
+
writer.on("error", reemit);
|
|
30
|
+
reader.on("error", reemit);
|
|
31
|
+
stream.writable = writer.writable;
|
|
32
|
+
stream.readable = reader.readable;
|
|
33
|
+
return stream;
|
|
34
|
+
function proxyWriter(methodName) {
|
|
35
|
+
stream[methodName] = method;
|
|
36
|
+
function method() {
|
|
37
|
+
return writer[methodName].apply(writer, arguments);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function proxyReader(methodName) {
|
|
41
|
+
stream[methodName] = method;
|
|
42
|
+
function method() {
|
|
43
|
+
stream.emit(methodName);
|
|
44
|
+
var func = reader[methodName];
|
|
45
|
+
if (func) return func.apply(reader, arguments);
|
|
46
|
+
reader.emit(methodName);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function proxyStream(methodName) {
|
|
50
|
+
reader.on(methodName, reemit$1);
|
|
51
|
+
function reemit$1() {
|
|
52
|
+
var args = slice.call(arguments);
|
|
53
|
+
args.unshift(methodName);
|
|
54
|
+
stream.emit.apply(stream, args);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function handleEnd() {
|
|
58
|
+
if (ended) return;
|
|
59
|
+
ended = true;
|
|
60
|
+
var args = slice.call(arguments);
|
|
61
|
+
args.unshift("end");
|
|
62
|
+
stream.emit.apply(stream, args);
|
|
63
|
+
}
|
|
64
|
+
function reemit(err) {
|
|
65
|
+
stream.emit("error", err);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}) });
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { require_duplexer as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/escape-string-regexp@5.0.0/node_modules/escape-string-regexp/index.js
|
|
2
|
+
function escapeStringRegexp(string) {
|
|
3
|
+
if (typeof string !== "string") throw new TypeError("Expected a string");
|
|
4
|
+
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { escapeStringRegexp as t };
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/estree-walker@2.0.2/node_modules/estree-walker/dist/esm/estree-walker.js
|
|
2
|
+
/** @typedef { import('estree').BaseNode} BaseNode */
|
|
3
|
+
/** @typedef {{
|
|
4
|
+
skip: () => void;
|
|
5
|
+
remove: () => void;
|
|
6
|
+
replace: (node: BaseNode) => void;
|
|
7
|
+
}} WalkerContext */
|
|
8
|
+
var WalkerBase$1 = class {
|
|
9
|
+
constructor() {
|
|
10
|
+
/** @type {boolean} */
|
|
11
|
+
this.should_skip = false;
|
|
12
|
+
/** @type {boolean} */
|
|
13
|
+
this.should_remove = false;
|
|
14
|
+
/** @type {BaseNode | null} */
|
|
15
|
+
this.replacement = null;
|
|
16
|
+
/** @type {WalkerContext} */
|
|
17
|
+
this.context = {
|
|
18
|
+
skip: () => this.should_skip = true,
|
|
19
|
+
remove: () => this.should_remove = true,
|
|
20
|
+
replace: (node) => this.replacement = node
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param {any} parent
|
|
26
|
+
* @param {string} prop
|
|
27
|
+
* @param {number} index
|
|
28
|
+
* @param {BaseNode} node
|
|
29
|
+
*/
|
|
30
|
+
replace(parent, prop, index, node) {
|
|
31
|
+
if (parent) if (index !== null) parent[prop][index] = node;
|
|
32
|
+
else parent[prop] = node;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param {any} parent
|
|
37
|
+
* @param {string} prop
|
|
38
|
+
* @param {number} index
|
|
39
|
+
*/
|
|
40
|
+
remove(parent, prop, index) {
|
|
41
|
+
if (parent) if (index !== null) parent[prop].splice(index, 1);
|
|
42
|
+
else delete parent[prop];
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
/** @typedef { import('estree').BaseNode} BaseNode */
|
|
46
|
+
/** @typedef { import('./walker.js').WalkerContext} WalkerContext */
|
|
47
|
+
/** @typedef {(
|
|
48
|
+
* this: WalkerContext,
|
|
49
|
+
* node: BaseNode,
|
|
50
|
+
* parent: BaseNode,
|
|
51
|
+
* key: string,
|
|
52
|
+
* index: number
|
|
53
|
+
* ) => void} SyncHandler */
|
|
54
|
+
var SyncWalker$1 = class extends WalkerBase$1 {
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @param {SyncHandler} enter
|
|
58
|
+
* @param {SyncHandler} leave
|
|
59
|
+
*/
|
|
60
|
+
constructor(enter, leave) {
|
|
61
|
+
super();
|
|
62
|
+
/** @type {SyncHandler} */
|
|
63
|
+
this.enter = enter;
|
|
64
|
+
/** @type {SyncHandler} */
|
|
65
|
+
this.leave = leave;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @param {BaseNode} node
|
|
70
|
+
* @param {BaseNode} parent
|
|
71
|
+
* @param {string} [prop]
|
|
72
|
+
* @param {number} [index]
|
|
73
|
+
* @returns {BaseNode}
|
|
74
|
+
*/
|
|
75
|
+
visit(node, parent, prop, index) {
|
|
76
|
+
if (node) {
|
|
77
|
+
if (this.enter) {
|
|
78
|
+
const _should_skip = this.should_skip;
|
|
79
|
+
const _should_remove = this.should_remove;
|
|
80
|
+
const _replacement = this.replacement;
|
|
81
|
+
this.should_skip = false;
|
|
82
|
+
this.should_remove = false;
|
|
83
|
+
this.replacement = null;
|
|
84
|
+
this.enter.call(this.context, node, parent, prop, index);
|
|
85
|
+
if (this.replacement) {
|
|
86
|
+
node = this.replacement;
|
|
87
|
+
this.replace(parent, prop, index, node);
|
|
88
|
+
}
|
|
89
|
+
if (this.should_remove) this.remove(parent, prop, index);
|
|
90
|
+
const skipped = this.should_skip;
|
|
91
|
+
const removed = this.should_remove;
|
|
92
|
+
this.should_skip = _should_skip;
|
|
93
|
+
this.should_remove = _should_remove;
|
|
94
|
+
this.replacement = _replacement;
|
|
95
|
+
if (skipped) return node;
|
|
96
|
+
if (removed) return null;
|
|
97
|
+
}
|
|
98
|
+
for (const key in node) {
|
|
99
|
+
const value = node[key];
|
|
100
|
+
if (typeof value !== "object") continue;
|
|
101
|
+
else if (Array.isArray(value)) {
|
|
102
|
+
for (let i = 0; i < value.length; i += 1) if (value[i] !== null && typeof value[i].type === "string") {
|
|
103
|
+
if (!this.visit(value[i], node, key, i)) i--;
|
|
104
|
+
}
|
|
105
|
+
} else if (value !== null && typeof value.type === "string") this.visit(value, node, key, null);
|
|
106
|
+
}
|
|
107
|
+
if (this.leave) {
|
|
108
|
+
const _replacement = this.replacement;
|
|
109
|
+
const _should_remove = this.should_remove;
|
|
110
|
+
this.replacement = null;
|
|
111
|
+
this.should_remove = false;
|
|
112
|
+
this.leave.call(this.context, node, parent, prop, index);
|
|
113
|
+
if (this.replacement) {
|
|
114
|
+
node = this.replacement;
|
|
115
|
+
this.replace(parent, prop, index, node);
|
|
116
|
+
}
|
|
117
|
+
if (this.should_remove) this.remove(parent, prop, index);
|
|
118
|
+
const removed = this.should_remove;
|
|
119
|
+
this.replacement = _replacement;
|
|
120
|
+
this.should_remove = _should_remove;
|
|
121
|
+
if (removed) return null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return node;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
/** @typedef { import('estree').BaseNode} BaseNode */
|
|
128
|
+
/** @typedef { import('./sync.js').SyncHandler} SyncHandler */
|
|
129
|
+
/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */
|
|
130
|
+
/**
|
|
131
|
+
*
|
|
132
|
+
* @param {BaseNode} ast
|
|
133
|
+
* @param {{
|
|
134
|
+
* enter?: SyncHandler
|
|
135
|
+
* leave?: SyncHandler
|
|
136
|
+
* }} walker
|
|
137
|
+
* @returns {BaseNode}
|
|
138
|
+
*/
|
|
139
|
+
function walk$1(ast, { enter, leave }) {
|
|
140
|
+
return new SyncWalker$1(enter, leave).visit(ast, null);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/walker.js
|
|
145
|
+
/**
|
|
146
|
+
* @typedef { import('estree').Node} Node
|
|
147
|
+
* @typedef {{
|
|
148
|
+
* skip: () => void;
|
|
149
|
+
* remove: () => void;
|
|
150
|
+
* replace: (node: Node) => void;
|
|
151
|
+
* }} WalkerContext
|
|
152
|
+
*/
|
|
153
|
+
var WalkerBase = class {
|
|
154
|
+
constructor() {
|
|
155
|
+
/** @type {boolean} */
|
|
156
|
+
this.should_skip = false;
|
|
157
|
+
/** @type {boolean} */
|
|
158
|
+
this.should_remove = false;
|
|
159
|
+
/** @type {Node | null} */
|
|
160
|
+
this.replacement = null;
|
|
161
|
+
/** @type {WalkerContext} */
|
|
162
|
+
this.context = {
|
|
163
|
+
skip: () => this.should_skip = true,
|
|
164
|
+
remove: () => this.should_remove = true,
|
|
165
|
+
replace: (node) => this.replacement = node
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* @template {Node} Parent
|
|
170
|
+
* @param {Parent | null | undefined} parent
|
|
171
|
+
* @param {keyof Parent | null | undefined} prop
|
|
172
|
+
* @param {number | null | undefined} index
|
|
173
|
+
* @param {Node} node
|
|
174
|
+
*/
|
|
175
|
+
replace(parent, prop, index, node) {
|
|
176
|
+
if (parent && prop) if (index != null)
|
|
177
|
+
/** @type {Array<Node>} */ parent[prop][index] = node;
|
|
178
|
+
else
|
|
179
|
+
/** @type {Node} */ parent[prop] = node;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* @template {Node} Parent
|
|
183
|
+
* @param {Parent | null | undefined} parent
|
|
184
|
+
* @param {keyof Parent | null | undefined} prop
|
|
185
|
+
* @param {number | null | undefined} index
|
|
186
|
+
*/
|
|
187
|
+
remove(parent, prop, index) {
|
|
188
|
+
if (parent && prop) if (index !== null && index !== void 0)
|
|
189
|
+
/** @type {Array<Node>} */ parent[prop].splice(index, 1);
|
|
190
|
+
else delete parent[prop];
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/sync.js
|
|
196
|
+
/**
|
|
197
|
+
* @typedef { import('estree').Node} Node
|
|
198
|
+
* @typedef { import('./walker.js').WalkerContext} WalkerContext
|
|
199
|
+
* @typedef {(
|
|
200
|
+
* this: WalkerContext,
|
|
201
|
+
* node: Node,
|
|
202
|
+
* parent: Node | null,
|
|
203
|
+
* key: string | number | symbol | null | undefined,
|
|
204
|
+
* index: number | null | undefined
|
|
205
|
+
* ) => void} SyncHandler
|
|
206
|
+
*/
|
|
207
|
+
var SyncWalker = class extends WalkerBase {
|
|
208
|
+
/**
|
|
209
|
+
*
|
|
210
|
+
* @param {SyncHandler} [enter]
|
|
211
|
+
* @param {SyncHandler} [leave]
|
|
212
|
+
*/
|
|
213
|
+
constructor(enter, leave) {
|
|
214
|
+
super();
|
|
215
|
+
/** @type {boolean} */
|
|
216
|
+
this.should_skip = false;
|
|
217
|
+
/** @type {boolean} */
|
|
218
|
+
this.should_remove = false;
|
|
219
|
+
/** @type {Node | null} */
|
|
220
|
+
this.replacement = null;
|
|
221
|
+
/** @type {WalkerContext} */
|
|
222
|
+
this.context = {
|
|
223
|
+
skip: () => this.should_skip = true,
|
|
224
|
+
remove: () => this.should_remove = true,
|
|
225
|
+
replace: (node) => this.replacement = node
|
|
226
|
+
};
|
|
227
|
+
/** @type {SyncHandler | undefined} */
|
|
228
|
+
this.enter = enter;
|
|
229
|
+
/** @type {SyncHandler | undefined} */
|
|
230
|
+
this.leave = leave;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* @template {Node} Parent
|
|
234
|
+
* @param {Node} node
|
|
235
|
+
* @param {Parent | null} parent
|
|
236
|
+
* @param {keyof Parent} [prop]
|
|
237
|
+
* @param {number | null} [index]
|
|
238
|
+
* @returns {Node | null}
|
|
239
|
+
*/
|
|
240
|
+
visit(node, parent, prop, index) {
|
|
241
|
+
if (node) {
|
|
242
|
+
if (this.enter) {
|
|
243
|
+
const _should_skip = this.should_skip;
|
|
244
|
+
const _should_remove = this.should_remove;
|
|
245
|
+
const _replacement = this.replacement;
|
|
246
|
+
this.should_skip = false;
|
|
247
|
+
this.should_remove = false;
|
|
248
|
+
this.replacement = null;
|
|
249
|
+
this.enter.call(this.context, node, parent, prop, index);
|
|
250
|
+
if (this.replacement) {
|
|
251
|
+
node = this.replacement;
|
|
252
|
+
this.replace(parent, prop, index, node);
|
|
253
|
+
}
|
|
254
|
+
if (this.should_remove) this.remove(parent, prop, index);
|
|
255
|
+
const skipped = this.should_skip;
|
|
256
|
+
const removed = this.should_remove;
|
|
257
|
+
this.should_skip = _should_skip;
|
|
258
|
+
this.should_remove = _should_remove;
|
|
259
|
+
this.replacement = _replacement;
|
|
260
|
+
if (skipped) return node;
|
|
261
|
+
if (removed) return null;
|
|
262
|
+
}
|
|
263
|
+
/** @type {keyof Node} */
|
|
264
|
+
let key;
|
|
265
|
+
for (key in node) {
|
|
266
|
+
/** @type {unknown} */
|
|
267
|
+
const value = node[key];
|
|
268
|
+
if (value && typeof value === "object") {
|
|
269
|
+
if (Array.isArray(value)) {
|
|
270
|
+
const nodes = value;
|
|
271
|
+
for (let i = 0; i < nodes.length; i += 1) {
|
|
272
|
+
const item = nodes[i];
|
|
273
|
+
if (isNode(item)) {
|
|
274
|
+
if (!this.visit(item, node, key, i)) i--;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
} else if (isNode(value)) this.visit(value, node, key, null);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (this.leave) {
|
|
281
|
+
const _replacement = this.replacement;
|
|
282
|
+
const _should_remove = this.should_remove;
|
|
283
|
+
this.replacement = null;
|
|
284
|
+
this.should_remove = false;
|
|
285
|
+
this.leave.call(this.context, node, parent, prop, index);
|
|
286
|
+
if (this.replacement) {
|
|
287
|
+
node = this.replacement;
|
|
288
|
+
this.replace(parent, prop, index, node);
|
|
289
|
+
}
|
|
290
|
+
if (this.should_remove) this.remove(parent, prop, index);
|
|
291
|
+
const removed = this.should_remove;
|
|
292
|
+
this.replacement = _replacement;
|
|
293
|
+
this.should_remove = _should_remove;
|
|
294
|
+
if (removed) return null;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return node;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Ducktype a node.
|
|
302
|
+
*
|
|
303
|
+
* @param {unknown} value
|
|
304
|
+
* @returns {value is Node}
|
|
305
|
+
*/
|
|
306
|
+
function isNode(value) {
|
|
307
|
+
return value !== null && typeof value === "object" && "type" in value && typeof value.type === "string";
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
//#endregion
|
|
311
|
+
//#region node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/index.js
|
|
312
|
+
/**
|
|
313
|
+
* @typedef {import('estree').Node} Node
|
|
314
|
+
* @typedef {import('./sync.js').SyncHandler} SyncHandler
|
|
315
|
+
* @typedef {import('./async.js').AsyncHandler} AsyncHandler
|
|
316
|
+
*/
|
|
317
|
+
/**
|
|
318
|
+
* @param {Node} ast
|
|
319
|
+
* @param {{
|
|
320
|
+
* enter?: SyncHandler
|
|
321
|
+
* leave?: SyncHandler
|
|
322
|
+
* }} walker
|
|
323
|
+
* @returns {Node | null}
|
|
324
|
+
*/
|
|
325
|
+
function walk(ast, { enter, leave }) {
|
|
326
|
+
return new SyncWalker(enter, leave).visit(ast, null);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
//#endregion
|
|
330
|
+
export { walk$1 as n, walk as t };
|