nitro-nightly 4.0.0-20251030-091344-d4418b98 → 4.0.0-20251030-122334-09c1a7a8
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 +763 -0
- package/dist/_build/rolldown.mjs +216 -0
- package/dist/_build/rollup.mjs +359 -0
- package/dist/_build/vite.build.mjs +67 -0
- package/dist/_build/vite.plugin.mjs +762 -0
- package/dist/_chunks/B-7HiF0V.mjs +1303 -0
- package/dist/_chunks/B3asVbT4.mjs +151 -0
- package/dist/_chunks/B5ooyfLk.mjs +372 -0
- package/dist/_chunks/DXMHy5ca.mjs +43 -0
- package/dist/_dev.d.mts +12 -0
- package/dist/_dev.mjs +675 -0
- package/dist/_libs/acorn.mjs +5034 -0
- package/dist/_libs/c12.mjs +2798 -0
- package/dist/_libs/chokidar.mjs +1560 -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/debug.mjs +848 -0
- package/dist/_libs/deepmerge.mjs +86 -0
- package/dist/_libs/depd.mjs +314 -0
- package/dist/_libs/dot-prop.mjs +138 -0
- package/dist/_libs/duplexer.mjs +71 -0
- package/dist/_libs/ee-first.mjs +68 -0
- package/dist/_libs/encodeurl.mjs +49 -0
- package/dist/_libs/escape-html.mjs +58 -0
- package/dist/_libs/escape-string-regexp.mjs +8 -0
- package/dist/_libs/estree-walker.mjs +330 -0
- package/dist/_libs/etag.mjs +75 -0
- package/dist/{_chunks/_deps → _libs}/fdir.mjs +49 -104
- package/dist/_libs/fresh.mjs +85 -0
- package/dist/_libs/function-bind.mjs +63 -0
- package/dist/_libs/gen-mapping.mjs +612 -0
- package/dist/_libs/giget.mjs +19076 -0
- package/dist/_libs/gzip-size.mjs +21 -0
- package/dist/_libs/hasown.mjs +14 -0
- package/dist/_libs/http-errors.mjs +436 -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/{_chunks/_deps → _libs}/js-tokens.mjs +83 -112
- package/dist/_libs/klona.mjs +90 -0
- package/dist/_libs/knitwork.mjs +124 -0
- package/dist/_libs/local-pkg.mjs +1686 -0
- package/dist/{_chunks/_deps → _libs}/magic-string.mjs +272 -629
- package/dist/_libs/mime-db.mjs +7642 -0
- package/dist/_libs/mime-types.mjs +162 -0
- package/dist/_libs/mime.mjs +1391 -0
- package/dist/_libs/node-fetch-native.mjs +173 -0
- package/dist/_libs/on-finished.mjs +170 -0
- package/dist/_libs/parseurl.mjs +103 -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 +1489 -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/range-parser.mjs +102 -0
- package/dist/_libs/remapping.mjs +117 -0
- package/dist/{_chunks/_deps → _libs}/rou3.mjs +7 -22
- package/dist/_libs/send.mjs +857 -0
- package/dist/_libs/serve-static.mjs +124 -0
- package/dist/_libs/std-env.mjs +158 -0
- package/dist/_libs/strip-literal.mjs +51 -0
- package/dist/{_chunks/_deps → _libs}/tinyglobby.mjs +32 -33
- 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 +5825 -0
- package/dist/{_chunks/_deps/@pi0 → _libs}/vite-plugin-fullstack.mjs +28 -42
- package/dist/_presets.mjs +1723 -0
- package/dist/builder.d.mts +37 -35
- package/dist/builder.mjs +45 -117
- package/dist/cli/_chunks/build.mjs +43 -0
- package/dist/cli/_chunks/common.mjs +15 -0
- package/dist/cli/_chunks/detect-acorn.mjs +12 -0
- package/dist/cli/_chunks/dev.mjs +79 -0
- package/dist/cli/_chunks/dist.mjs +3 -0
- package/dist/cli/_chunks/dist2.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 +19 -18
- package/dist/presets/_nitro/runtime/nitro-dev.d.mts +1 -0
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +42 -33
- package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +2 -2
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +4 -8
- package/dist/presets/_nitro/runtime/service-worker.d.mts +1 -0
- package/dist/presets/_nitro/runtime/service-worker.mjs +14 -11
- package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +1 -0
- package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +6 -5
- 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 +25 -27
- package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +7 -7
- 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 +22 -21
- package/dist/presets/bun/runtime/bun.d.mts +1 -0
- package/dist/presets/bun/runtime/bun.mjs +18 -17
- package/dist/presets/cloudflare/runtime/_module-handler.d.mts +10 -7
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +78 -87
- package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +6 -14
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +53 -58
- package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +1 -7
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +12 -14
- package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +12 -12
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +35 -39
- package/dist/presets/cloudflare/runtime/plugin.dev.d.mts +2 -2
- package/dist/presets/cloudflare/runtime/plugin.dev.mjs +86 -76
- package/dist/presets/deno/runtime/deno-deploy.d.mts +1 -0
- package/dist/presets/deno/runtime/deno-deploy.mjs +12 -11
- package/dist/presets/deno/runtime/deno-server.d.mts +2 -1
- package/dist/presets/deno/runtime/deno-server.mjs +31 -39
- package/dist/presets/netlify/runtime/netlify-edge.d.mts +2 -1
- package/dist/presets/netlify/runtime/netlify-edge.mjs +14 -11
- package/dist/presets/netlify/runtime/netlify.mjs +11 -17
- package/dist/presets/node/runtime/node-cluster.mjs +49 -48
- package/dist/presets/node/runtime/node-middleware.d.mts +3 -2
- package/dist/presets/node/runtime/node-middleware.mjs +7 -6
- package/dist/presets/node/runtime/node-server.mjs +33 -23
- package/dist/presets/standard/runtime/server.d.mts +1 -3
- package/dist/presets/standard/runtime/server.mjs +1 -3
- package/dist/presets/stormkit/runtime/stormkit.d.mts +13 -13
- package/dist/presets/stormkit/runtime/stormkit.mjs +20 -20
- package/dist/presets/vercel/runtime/vercel.d.mts +3 -3
- package/dist/presets/vercel/runtime/vercel.mjs +15 -14
- package/dist/presets/winterjs/runtime/winterjs.d.mts +2 -0
- package/dist/presets/winterjs/runtime/winterjs.mjs +72 -68
- package/dist/presets/zeabur/runtime/zeabur.d.mts +1 -1
- package/dist/runtime/index.d.mts +12 -1
- package/dist/runtime/index.mjs +12 -7
- package/dist/runtime/internal/app.mjs +175 -162
- package/dist/runtime/internal/cache.d.mts +10 -4
- package/dist/runtime/internal/cache.mjs +247 -216
- 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/prod.d.mts +2 -2
- package/dist/runtime/internal/error/prod.mjs +48 -52
- package/dist/runtime/internal/error/utils.d.mts +4 -4
- package/dist/runtime/internal/error/utils.mjs +1 -1
- package/dist/runtime/internal/index.d.mts +2 -0
- package/dist/runtime/internal/index.mjs +2 -0
- package/dist/runtime/internal/lib/http-graceful-shutdown.d.mts +14 -14
- package/dist/runtime/internal/lib/http-graceful-shutdown.mjs +248 -209
- 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/renderer.mjs +39 -31
- package/dist/runtime/internal/route-rules.d.mts +8 -8
- package/dist/runtime/internal/route-rules.mjs +53 -51
- package/dist/runtime/internal/routes/dev-tasks.d.mts +1 -30
- package/dist/runtime/internal/routes/dev-tasks.mjs +15 -17
- 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 +10 -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/shutdown.d.mts +2 -7
- package/dist/runtime/internal/shutdown.mjs +30 -29
- 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 -59
- package/dist/runtime/internal/utils.d.mts +1 -1
- package/dist/runtime/internal/utils.mjs +4 -10
- package/dist/types/index.d.mts +2566 -3851
- package/dist/types/index.mjs +1 -1
- package/dist/vite.d.mts +61 -51
- package/dist/vite.mjs +55 -132
- package/package.json +10 -10
- package/dist/_build/build.mjs +0 -368
- package/dist/_build/build2.mjs +0 -556
- package/dist/_build/info.mjs +0 -1002
- package/dist/_build/prepare.mjs +0 -1511
- package/dist/_build/snapshot.mjs +0 -185
- package/dist/_build/vite.mjs +0 -959
- package/dist/_build/vite2.mjs +0 -149
- package/dist/_chunks/_deps/@jridgewell/gen-mapping.mjs +0 -189
- package/dist/_chunks/_deps/@jridgewell/remapping.mjs +0 -137
- package/dist/_chunks/_deps/@jridgewell/resolve-uri.mjs +0 -231
- package/dist/_chunks/_deps/@jridgewell/sourcemap-codec.mjs +0 -173
- package/dist/_chunks/_deps/@jridgewell/trace-mapping.mjs +0 -170
- package/dist/_chunks/_deps/@rollup/plugin-alias.mjs +0 -89
- package/dist/_chunks/_deps/@rollup/plugin-commonjs.mjs +0 -2376
- package/dist/_chunks/_deps/@rollup/plugin-inject.mjs +0 -212
- package/dist/_chunks/_deps/@rollup/plugin-json.mjs +0 -37
- package/dist/_chunks/_deps/@rollup/plugin-node-resolve.mjs +0 -1386
- package/dist/_chunks/_deps/@rollup/plugin-replace.mjs +0 -133
- package/dist/_chunks/_deps/@rollup/pluginutils.mjs +0 -346
- package/dist/_chunks/_deps/acorn.mjs +0 -6225
- package/dist/_chunks/_deps/c12.mjs +0 -510
- package/dist/_chunks/_deps/chokidar.mjs +0 -1428
- package/dist/_chunks/_deps/citty.mjs +0 -460
- package/dist/_chunks/_deps/commondir.mjs +0 -77
- package/dist/_chunks/_deps/compatx.mjs +0 -76
- package/dist/_chunks/_deps/confbox.mjs +0 -300
- package/dist/_chunks/_deps/debug.mjs +0 -885
- package/dist/_chunks/_deps/deepmerge.mjs +0 -147
- package/dist/_chunks/_deps/depd.mjs +0 -550
- package/dist/_chunks/_deps/dot-prop.mjs +0 -282
- package/dist/_chunks/_deps/dotenv.mjs +0 -555
- package/dist/_chunks/_deps/duplexer.mjs +0 -1
- package/dist/_chunks/_deps/ee-first.mjs +0 -104
- package/dist/_chunks/_deps/encodeurl.mjs +0 -69
- package/dist/_chunks/_deps/escape-html.mjs +0 -87
- package/dist/_chunks/_deps/escape-string-regexp.mjs +0 -13
- package/dist/_chunks/_deps/estree-walker.mjs +0 -433
- package/dist/_chunks/_deps/etag.mjs +0 -147
- package/dist/_chunks/_deps/exsolve.mjs +0 -1416
- package/dist/_chunks/_deps/fresh.mjs +0 -145
- package/dist/_chunks/_deps/function-bind.mjs +0 -106
- package/dist/_chunks/_deps/giget.mjs +0 -451
- package/dist/_chunks/_deps/gzip-size.mjs +0 -19
- package/dist/_chunks/_deps/hasown.mjs +0 -19
- package/dist/_chunks/_deps/http-errors.mjs +0 -307
- package/dist/_chunks/_deps/httpxy.mjs +0 -580
- package/dist/_chunks/_deps/inherits.mjs +0 -57
- package/dist/_chunks/_deps/is-core-module.mjs +0 -596
- package/dist/_chunks/_deps/is-module.mjs +0 -25
- package/dist/_chunks/_deps/is-reference.mjs +0 -31
- package/dist/_chunks/_deps/klona.mjs +0 -137
- package/dist/_chunks/_deps/knitwork.mjs +0 -172
- package/dist/_chunks/_deps/local-pkg.mjs +0 -163
- package/dist/_chunks/_deps/mime-db.mjs +0 -11685
- package/dist/_chunks/_deps/mime-types.mjs +0 -287
- package/dist/_chunks/_deps/mime.mjs +0 -1172
- package/dist/_chunks/_deps/mlly.mjs +0 -2413
- package/dist/_chunks/_deps/ms.mjs +0 -172
- package/dist/_chunks/_deps/node-fetch-native.mjs +0 -3
- package/dist/_chunks/_deps/nypm.mjs +0 -219
- package/dist/_chunks/_deps/on-finished.mjs +0 -246
- package/dist/_chunks/_deps/parseurl.mjs +0 -168
- package/dist/_chunks/_deps/path-parse.mjs +0 -85
- package/dist/_chunks/_deps/pathe.mjs +0 -251
- package/dist/_chunks/_deps/perfect-debounce.mjs +0 -88
- package/dist/_chunks/_deps/picomatch.mjs +0 -2144
- package/dist/_chunks/_deps/pkg-types.mjs +0 -247
- package/dist/_chunks/_deps/pretty-bytes.mjs +0 -180
- package/dist/_chunks/_deps/quansync.mjs +0 -99
- package/dist/_chunks/_deps/range-parser.mjs +0 -171
- package/dist/_chunks/_deps/rc9.mjs +0 -219
- package/dist/_chunks/_deps/readdirp.mjs +0 -245
- package/dist/_chunks/_deps/resolve.mjs +0 -1260
- package/dist/_chunks/_deps/send.mjs +0 -1022
- package/dist/_chunks/_deps/serve-static.mjs +0 -228
- package/dist/_chunks/_deps/setprototypeof.mjs +0 -26
- package/dist/_chunks/_deps/statuses.mjs +0 -457
- package/dist/_chunks/_deps/std-env.mjs +0 -3
- package/dist/_chunks/_deps/strip-literal.mjs +0 -67
- package/dist/_chunks/_deps/supports-color.mjs +0 -44
- package/dist/_chunks/_deps/tinyexec.mjs +0 -552
- package/dist/_chunks/_deps/toidentifier.mjs +0 -41
- package/dist/_chunks/_deps/ultrahtml.mjs +0 -3
- package/dist/_chunks/_deps/unimport.mjs +0 -2267
- package/dist/_chunks/_deps/unplugin-utils.mjs +0 -65
- package/dist/_chunks/_deps/unplugin.mjs +0 -1294
- package/dist/_chunks/_deps/untyped.mjs +0 -375
- package/dist/_chunks/_deps/unwasm.mjs +0 -6959
- package/dist/_chunks/_deps/webpack-virtual-modules.mjs +0 -360
- package/dist/_chunks/_presets/_all.mjs +0 -59
- package/dist/_chunks/_presets/_nitro.mjs +0 -74
- package/dist/_chunks/_presets/_resolve.mjs +0 -64
- package/dist/_chunks/_presets/_static.mjs +0 -69
- package/dist/_chunks/_presets/_types.mjs +0 -3
- package/dist/_chunks/_presets/_utils.mjs +0 -31
- package/dist/_chunks/_presets/alwaysdata.mjs +0 -17
- package/dist/_chunks/_presets/aws-amplify.mjs +0 -111
- package/dist/_chunks/_presets/aws-lambda.mjs +0 -23
- package/dist/_chunks/_presets/azure.mjs +0 -162
- package/dist/_chunks/_presets/bun.mjs +0 -19
- package/dist/_chunks/_presets/cleavr.mjs +0 -15
- package/dist/_chunks/_presets/cloudflare.mjs +0 -608
- package/dist/_chunks/_presets/deno.mjs +0 -196
- package/dist/_chunks/_presets/digitalocean.mjs +0 -14
- package/dist/_chunks/_presets/firebase.mjs +0 -47
- package/dist/_chunks/_presets/flightcontrol.mjs +0 -14
- package/dist/_chunks/_presets/genezio.mjs +0 -13
- package/dist/_chunks/_presets/heroku.mjs +0 -14
- package/dist/_chunks/_presets/iis.mjs +0 -194
- package/dist/_chunks/_presets/index.mjs +0 -62
- package/dist/_chunks/_presets/koyeb.mjs +0 -14
- package/dist/_chunks/_presets/netlify.mjs +0 -241
- package/dist/_chunks/_presets/node.mjs +0 -54
- package/dist/_chunks/_presets/platform.mjs +0 -14
- package/dist/_chunks/_presets/render.mjs +0 -14
- package/dist/_chunks/_presets/standard.mjs +0 -23
- package/dist/_chunks/_presets/stormkit.mjs +0 -18
- package/dist/_chunks/_presets/vercel.mjs +0 -375
- package/dist/_chunks/_presets/winterjs.mjs +0 -22
- package/dist/_chunks/_presets/zeabur.mjs +0 -69
- package/dist/_chunks/_presets/zerops.mjs +0 -27
- package/dist/_chunks/app.mjs +0 -600
- package/dist/_chunks/builder.mjs +0 -648
- package/dist/_chunks/server.mjs +0 -256
- package/dist/_cli/build.mjs +0 -49
- package/dist/_cli/common.mjs +0 -13
- package/dist/_cli/dev.mjs +0 -121
- package/dist/_cli/index.mjs +0 -16
- package/dist/_cli/list.mjs +0 -33
- package/dist/_cli/prepare.mjs +0 -23
- package/dist/_cli/run.mjs +0 -59
- package/dist/presets/cloudflare/runtime/shims/workers.dev.d.mts +0 -21
- package/dist/runtime/internal/empty.d.mts +0 -0
- 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/ssr-renderer.d.mts +0 -4
- /package/lib/{indexd.mts → index.d.mts} +0 -0
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { promises, statSync } from 'node:fs';
|
|
2
|
-
import { a as resolvePath } from './mlly.mjs';
|
|
3
|
-
import { x, h, a as x$1, b as h$1, S } from './confbox.mjs';
|
|
4
|
-
import { i as isAbsolute, r as resolve, j as join, n as normalize, d as dirname } from './pathe.mjs';
|
|
5
|
-
import { r as resolveModulePath } from './exsolve.mjs';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { readFile } from 'node:fs/promises';
|
|
8
|
-
|
|
9
|
-
const defaultFindOptions$1 = {
|
|
10
|
-
startingFrom: ".",
|
|
11
|
-
rootPattern: /^node_modules$/,
|
|
12
|
-
reverse: false,
|
|
13
|
-
test: (filePath) => {
|
|
14
|
-
try {
|
|
15
|
-
if (statSync(filePath).isFile()) {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
} catch {
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
async function findFile$1(filename, _options = {}) {
|
|
23
|
-
const filenames = Array.isArray(filename) ? filename : [filename];
|
|
24
|
-
const options = { ...defaultFindOptions$1, ..._options };
|
|
25
|
-
const basePath = resolve(options.startingFrom);
|
|
26
|
-
const leadingSlash = basePath[0] === "/";
|
|
27
|
-
const segments = basePath.split("/").filter(Boolean);
|
|
28
|
-
if (leadingSlash) {
|
|
29
|
-
segments[0] = "/" + segments[0];
|
|
30
|
-
}
|
|
31
|
-
let root = segments.findIndex((r) => r.match(options.rootPattern));
|
|
32
|
-
if (root === -1) {
|
|
33
|
-
root = 0;
|
|
34
|
-
}
|
|
35
|
-
if (options.reverse) {
|
|
36
|
-
for (let index = root + 1; index <= segments.length; index++) {
|
|
37
|
-
for (const filename2 of filenames) {
|
|
38
|
-
const filePath = join(...segments.slice(0, index), filename2);
|
|
39
|
-
if (await options.test(filePath)) {
|
|
40
|
-
return filePath;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
for (let index = segments.length; index > root; index--) {
|
|
46
|
-
for (const filename2 of filenames) {
|
|
47
|
-
const filePath = join(...segments.slice(0, index), filename2);
|
|
48
|
-
if (await options.test(filePath)) {
|
|
49
|
-
return filePath;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
throw new Error(
|
|
55
|
-
`Cannot find matching ${filename} in ${options.startingFrom} or parent directories`
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
function findNearestFile$1(filename, _options = {}) {
|
|
59
|
-
return findFile$1(filename, _options);
|
|
60
|
-
}
|
|
61
|
-
const FileCache$1 = /* @__PURE__ */ new Map();
|
|
62
|
-
async function readPackageJSON$1(id, options = {}) {
|
|
63
|
-
const resolvedPath = await resolvePackageJSON$1(id, options);
|
|
64
|
-
const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : FileCache$1;
|
|
65
|
-
if (options.cache && cache.has(resolvedPath)) {
|
|
66
|
-
return cache.get(resolvedPath);
|
|
67
|
-
}
|
|
68
|
-
const blob = await promises.readFile(resolvedPath, "utf8");
|
|
69
|
-
let parsed;
|
|
70
|
-
try {
|
|
71
|
-
parsed = x(blob);
|
|
72
|
-
} catch {
|
|
73
|
-
parsed = h(blob);
|
|
74
|
-
}
|
|
75
|
-
cache.set(resolvedPath, parsed);
|
|
76
|
-
return parsed;
|
|
77
|
-
}
|
|
78
|
-
async function resolvePackageJSON$1(id = process.cwd(), options = {}) {
|
|
79
|
-
const resolvedPath = isAbsolute(id) ? id : await resolvePath(id, options);
|
|
80
|
-
return findNearestFile$1("package.json", {
|
|
81
|
-
startingFrom: resolvedPath,
|
|
82
|
-
...options
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const defaultFindOptions = {
|
|
87
|
-
startingFrom: ".",
|
|
88
|
-
rootPattern: /^node_modules$/,
|
|
89
|
-
reverse: false,
|
|
90
|
-
test: (filePath) => {
|
|
91
|
-
try {
|
|
92
|
-
if (statSync(filePath).isFile()) {
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
} catch {
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
async function findFile(filename, _options = {}) {
|
|
100
|
-
const filenames = Array.isArray(filename) ? filename : [filename];
|
|
101
|
-
const options = { ...defaultFindOptions, ..._options };
|
|
102
|
-
const basePath = resolve(options.startingFrom);
|
|
103
|
-
const leadingSlash = basePath[0] === "/";
|
|
104
|
-
const segments = basePath.split("/").filter(Boolean);
|
|
105
|
-
if (filenames.includes(segments.at(-1)) && await options.test(basePath)) {
|
|
106
|
-
return basePath;
|
|
107
|
-
}
|
|
108
|
-
if (leadingSlash) {
|
|
109
|
-
segments[0] = "/" + segments[0];
|
|
110
|
-
}
|
|
111
|
-
let root = segments.findIndex((r) => r.match(options.rootPattern));
|
|
112
|
-
if (root === -1) {
|
|
113
|
-
root = 0;
|
|
114
|
-
}
|
|
115
|
-
if (options.reverse) {
|
|
116
|
-
for (let index = root + 1; index <= segments.length; index++) {
|
|
117
|
-
for (const filename2 of filenames) {
|
|
118
|
-
const filePath = join(...segments.slice(0, index), filename2);
|
|
119
|
-
if (await options.test(filePath)) {
|
|
120
|
-
return filePath;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
} else {
|
|
125
|
-
for (let index = segments.length; index > root; index--) {
|
|
126
|
-
for (const filename2 of filenames) {
|
|
127
|
-
const filePath = join(...segments.slice(0, index), filename2);
|
|
128
|
-
if (await options.test(filePath)) {
|
|
129
|
-
return filePath;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
throw new Error(
|
|
135
|
-
`Cannot find matching ${filename} in ${options.startingFrom} or parent directories`
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
function findNearestFile(filename, options = {}) {
|
|
139
|
-
return findFile(filename, options);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function _resolvePath(id, opts = {}) {
|
|
143
|
-
if (id instanceof URL || id.startsWith("file://")) {
|
|
144
|
-
return normalize(fileURLToPath(id));
|
|
145
|
-
}
|
|
146
|
-
if (isAbsolute(id)) {
|
|
147
|
-
return normalize(id);
|
|
148
|
-
}
|
|
149
|
-
return resolveModulePath(id, {
|
|
150
|
-
...opts,
|
|
151
|
-
from: opts.from || opts.parent || opts.url
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const lockFiles = [
|
|
156
|
-
"yarn.lock",
|
|
157
|
-
"package-lock.json",
|
|
158
|
-
"pnpm-lock.yaml",
|
|
159
|
-
"npm-shrinkwrap.json",
|
|
160
|
-
"bun.lockb",
|
|
161
|
-
"bun.lock",
|
|
162
|
-
"deno.lock"
|
|
163
|
-
];
|
|
164
|
-
const packageFiles = ["package.json", "package.json5", "package.yaml"];
|
|
165
|
-
const workspaceFiles = [
|
|
166
|
-
"pnpm-workspace.yaml",
|
|
167
|
-
"lerna.json",
|
|
168
|
-
"turbo.json",
|
|
169
|
-
"rush.json",
|
|
170
|
-
"deno.json",
|
|
171
|
-
"deno.jsonc"
|
|
172
|
-
];
|
|
173
|
-
const FileCache = /* @__PURE__ */ new Map();
|
|
174
|
-
async function readPackageJSON(id, options = {}) {
|
|
175
|
-
const resolvedPath = await resolvePackageJSON(id, options);
|
|
176
|
-
const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : FileCache;
|
|
177
|
-
if (options.cache && cache.has(resolvedPath)) {
|
|
178
|
-
return cache.get(resolvedPath);
|
|
179
|
-
}
|
|
180
|
-
const blob = await promises.readFile(resolvedPath, "utf8");
|
|
181
|
-
let parsed;
|
|
182
|
-
try {
|
|
183
|
-
parsed = x$1(blob);
|
|
184
|
-
} catch {
|
|
185
|
-
parsed = h$1(blob);
|
|
186
|
-
}
|
|
187
|
-
cache.set(resolvedPath, parsed);
|
|
188
|
-
return parsed;
|
|
189
|
-
}
|
|
190
|
-
async function resolvePackageJSON(id = process.cwd(), options = {}) {
|
|
191
|
-
return findNearestFile("package.json", {
|
|
192
|
-
...options,
|
|
193
|
-
startingFrom: _resolvePath(id, options)
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
const workspaceTests = {
|
|
197
|
-
workspaceFile: (opts) => findFile(workspaceFiles, opts).then((r) => dirname(r)),
|
|
198
|
-
gitConfig: (opts) => findFile(".git/config", opts).then((r) => resolve(r, "../..")),
|
|
199
|
-
lockFile: (opts) => findFile(lockFiles, opts).then((r) => dirname(r)),
|
|
200
|
-
packageJson: (opts) => findFile(packageFiles, opts).then((r) => dirname(r))
|
|
201
|
-
};
|
|
202
|
-
async function findWorkspaceDir(id = process.cwd(), options = {}) {
|
|
203
|
-
const startingFrom = _resolvePath(id, options);
|
|
204
|
-
const tests = options.tests || ["workspaceFile", "gitConfig", "lockFile", "packageJson"];
|
|
205
|
-
for (const testName of tests) {
|
|
206
|
-
const test = workspaceTests[testName];
|
|
207
|
-
if (options[testName] === false || !test) {
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
const direction = options[testName] || (testName === "gitConfig" ? "closest" : "furthest");
|
|
211
|
-
const detected = await test({
|
|
212
|
-
...options,
|
|
213
|
-
startingFrom,
|
|
214
|
-
reverse: direction === "furthest"
|
|
215
|
-
}).catch(() => {
|
|
216
|
-
});
|
|
217
|
-
if (detected) {
|
|
218
|
-
return detected;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
throw new Error(`Cannot detect workspace root from ${id}`);
|
|
222
|
-
}
|
|
223
|
-
async function resolveGitConfig(dir, opts) {
|
|
224
|
-
return findNearestFile(".git/config", { ...opts, startingFrom: dir });
|
|
225
|
-
}
|
|
226
|
-
async function readGitConfig(dir, opts) {
|
|
227
|
-
const path = await resolveGitConfig(dir, opts);
|
|
228
|
-
const ini = await readFile(path, "utf8");
|
|
229
|
-
return parseGitConfig(ini);
|
|
230
|
-
}
|
|
231
|
-
function parseGitConfig(ini) {
|
|
232
|
-
return S(ini.replaceAll(/^\[(\w+) "(.+)"\]$/gm, "[$1.$2]"));
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
const index = {
|
|
236
|
-
__proto__: null,
|
|
237
|
-
findFile: findFile,
|
|
238
|
-
findNearestFile: findNearestFile,
|
|
239
|
-
findWorkspaceDir: findWorkspaceDir,
|
|
240
|
-
parseGitConfig: parseGitConfig,
|
|
241
|
-
readGitConfig: readGitConfig,
|
|
242
|
-
readPackageJSON: readPackageJSON,
|
|
243
|
-
resolveGitConfig: resolveGitConfig,
|
|
244
|
-
resolvePackageJSON: resolvePackageJSON
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
export { readPackageJSON$1 as a, resolvePackageJSON as b, findNearestFile as c, readGitConfig as d, findFile as e, findWorkspaceDir as f, index as i, readPackageJSON as r };
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
const BYTE_UNITS = [
|
|
2
|
-
'B',
|
|
3
|
-
'kB',
|
|
4
|
-
'MB',
|
|
5
|
-
'GB',
|
|
6
|
-
'TB',
|
|
7
|
-
'PB',
|
|
8
|
-
'EB',
|
|
9
|
-
'ZB',
|
|
10
|
-
'YB',
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
const BIBYTE_UNITS = [
|
|
14
|
-
'B',
|
|
15
|
-
'KiB',
|
|
16
|
-
'MiB',
|
|
17
|
-
'GiB',
|
|
18
|
-
'TiB',
|
|
19
|
-
'PiB',
|
|
20
|
-
'EiB',
|
|
21
|
-
'ZiB',
|
|
22
|
-
'YiB',
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
const BIT_UNITS = [
|
|
26
|
-
'b',
|
|
27
|
-
'kbit',
|
|
28
|
-
'Mbit',
|
|
29
|
-
'Gbit',
|
|
30
|
-
'Tbit',
|
|
31
|
-
'Pbit',
|
|
32
|
-
'Ebit',
|
|
33
|
-
'Zbit',
|
|
34
|
-
'Ybit',
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
const BIBIT_UNITS = [
|
|
38
|
-
'b',
|
|
39
|
-
'kibit',
|
|
40
|
-
'Mibit',
|
|
41
|
-
'Gibit',
|
|
42
|
-
'Tibit',
|
|
43
|
-
'Pibit',
|
|
44
|
-
'Eibit',
|
|
45
|
-
'Zibit',
|
|
46
|
-
'Yibit',
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
/*
|
|
50
|
-
Formats the given number using `Number#toLocaleString`.
|
|
51
|
-
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
52
|
-
- If locale is true, the system default locale is used for translation.
|
|
53
|
-
- If no value for locale is specified, the number is returned unmodified.
|
|
54
|
-
*/
|
|
55
|
-
const toLocaleString = (number, locale, options) => {
|
|
56
|
-
let result = number;
|
|
57
|
-
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
58
|
-
result = number.toLocaleString(locale, options);
|
|
59
|
-
} else if (locale === true || options !== undefined) {
|
|
60
|
-
result = number.toLocaleString(undefined, options);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return result;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const log10 = numberOrBigInt => {
|
|
67
|
-
if (typeof numberOrBigInt === 'number') {
|
|
68
|
-
return Math.log10(numberOrBigInt);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const string = numberOrBigInt.toString(10);
|
|
72
|
-
|
|
73
|
-
return string.length + Math.log10(`0.${string.slice(0, 15)}`);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const log = numberOrBigInt => {
|
|
77
|
-
if (typeof numberOrBigInt === 'number') {
|
|
78
|
-
return Math.log(numberOrBigInt);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return log10(numberOrBigInt) * Math.log(10);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const divide = (numberOrBigInt, divisor) => {
|
|
85
|
-
if (typeof numberOrBigInt === 'number') {
|
|
86
|
-
return numberOrBigInt / divisor;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const integerPart = numberOrBigInt / BigInt(divisor);
|
|
90
|
-
const remainder = numberOrBigInt % BigInt(divisor);
|
|
91
|
-
return Number(integerPart) + (Number(remainder) / divisor);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const applyFixedWidth = (result, fixedWidth) => {
|
|
95
|
-
if (fixedWidth === undefined) {
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (typeof fixedWidth !== 'number' || !Number.isSafeInteger(fixedWidth) || fixedWidth < 0) {
|
|
100
|
-
throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof fixedWidth}: ${fixedWidth}`);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (fixedWidth === 0) {
|
|
104
|
-
return result;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return result.length < fixedWidth ? result.padStart(fixedWidth, ' ') : result;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const buildLocaleOptions = options => {
|
|
111
|
-
const {minimumFractionDigits, maximumFractionDigits} = options;
|
|
112
|
-
|
|
113
|
-
if (minimumFractionDigits === undefined && maximumFractionDigits === undefined) {
|
|
114
|
-
return undefined;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return {
|
|
118
|
-
...(minimumFractionDigits !== undefined && {minimumFractionDigits}),
|
|
119
|
-
...(maximumFractionDigits !== undefined && {maximumFractionDigits}),
|
|
120
|
-
roundingMode: 'trunc',
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
function prettyBytes(number, options) {
|
|
125
|
-
if (typeof number !== 'bigint' && !Number.isFinite(number)) {
|
|
126
|
-
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
options = {
|
|
130
|
-
bits: false,
|
|
131
|
-
binary: false,
|
|
132
|
-
space: true,
|
|
133
|
-
nonBreakingSpace: false,
|
|
134
|
-
...options,
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const UNITS = options.bits
|
|
138
|
-
? (options.binary ? BIBIT_UNITS : BIT_UNITS)
|
|
139
|
-
: (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
|
|
140
|
-
|
|
141
|
-
const separator = options.space ? (options.nonBreakingSpace ? '\u00A0' : ' ') : '';
|
|
142
|
-
|
|
143
|
-
// Handle signed zero case
|
|
144
|
-
const isZero = typeof number === 'number' ? number === 0 : number === 0n;
|
|
145
|
-
if (options.signed && isZero) {
|
|
146
|
-
const result = ` 0${separator}${UNITS[0]}`;
|
|
147
|
-
return applyFixedWidth(result, options.fixedWidth);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const isNegative = number < 0;
|
|
151
|
-
const prefix = isNegative ? '-' : (options.signed ? '+' : '');
|
|
152
|
-
|
|
153
|
-
if (isNegative) {
|
|
154
|
-
number = -number;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const localeOptions = buildLocaleOptions(options);
|
|
158
|
-
let result;
|
|
159
|
-
|
|
160
|
-
if (number < 1) {
|
|
161
|
-
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
162
|
-
result = prefix + numberString + separator + UNITS[0];
|
|
163
|
-
} else {
|
|
164
|
-
const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
|
|
165
|
-
number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
|
|
166
|
-
|
|
167
|
-
if (!localeOptions) {
|
|
168
|
-
const minPrecision = Math.max(3, Math.floor(number).toString().length);
|
|
169
|
-
number = number.toPrecision(minPrecision);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
173
|
-
const unit = UNITS[exponent];
|
|
174
|
-
result = prefix + numberString + separator + unit;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return applyFixedWidth(result, options.fixedWidth);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export { prettyBytes as p };
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
const GET_IS_ASYNC = Symbol.for("quansync.getIsAsync");
|
|
2
|
-
class QuansyncError extends Error {
|
|
3
|
-
constructor(message = "Unexpected promise in sync context") {
|
|
4
|
-
super(message);
|
|
5
|
-
this.name = "QuansyncError";
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
function isThenable(value) {
|
|
9
|
-
return value && typeof value === "object" && typeof value.then === "function";
|
|
10
|
-
}
|
|
11
|
-
function isQuansyncGenerator(value) {
|
|
12
|
-
return value && typeof value === "object" && typeof value[Symbol.iterator] === "function" && "__quansync" in value;
|
|
13
|
-
}
|
|
14
|
-
function fromObject(options) {
|
|
15
|
-
const generator = function* (...args) {
|
|
16
|
-
const isAsync = yield GET_IS_ASYNC;
|
|
17
|
-
if (isAsync)
|
|
18
|
-
return yield options.async.apply(this, args);
|
|
19
|
-
return options.sync.apply(this, args);
|
|
20
|
-
};
|
|
21
|
-
function fn(...args) {
|
|
22
|
-
const iter = generator.apply(this, args);
|
|
23
|
-
iter.then = (...thenArgs) => options.async.apply(this, args).then(...thenArgs);
|
|
24
|
-
iter.__quansync = true;
|
|
25
|
-
return iter;
|
|
26
|
-
}
|
|
27
|
-
fn.sync = options.sync;
|
|
28
|
-
fn.async = options.async;
|
|
29
|
-
return fn;
|
|
30
|
-
}
|
|
31
|
-
function fromPromise(promise) {
|
|
32
|
-
return fromObject({
|
|
33
|
-
async: () => Promise.resolve(promise),
|
|
34
|
-
sync: () => {
|
|
35
|
-
if (isThenable(promise))
|
|
36
|
-
throw new QuansyncError();
|
|
37
|
-
return promise;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
function unwrapYield(value, isAsync) {
|
|
42
|
-
if (value === GET_IS_ASYNC)
|
|
43
|
-
return isAsync;
|
|
44
|
-
if (isQuansyncGenerator(value))
|
|
45
|
-
return isAsync ? iterateAsync(value) : iterateSync(value);
|
|
46
|
-
if (!isAsync && isThenable(value))
|
|
47
|
-
throw new QuansyncError();
|
|
48
|
-
return value;
|
|
49
|
-
}
|
|
50
|
-
const DEFAULT_ON_YIELD = (value) => value;
|
|
51
|
-
function iterateSync(generator, onYield = DEFAULT_ON_YIELD) {
|
|
52
|
-
let current = generator.next();
|
|
53
|
-
while (!current.done) {
|
|
54
|
-
try {
|
|
55
|
-
current = generator.next(unwrapYield(onYield(current.value, false)));
|
|
56
|
-
} catch (err) {
|
|
57
|
-
current = generator.throw(err);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return unwrapYield(current.value);
|
|
61
|
-
}
|
|
62
|
-
async function iterateAsync(generator, onYield = DEFAULT_ON_YIELD) {
|
|
63
|
-
let current = generator.next();
|
|
64
|
-
while (!current.done) {
|
|
65
|
-
try {
|
|
66
|
-
current = generator.next(await unwrapYield(onYield(current.value, true), true));
|
|
67
|
-
} catch (err) {
|
|
68
|
-
current = generator.throw(err);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return current.value;
|
|
72
|
-
}
|
|
73
|
-
function fromGeneratorFn(generatorFn, options) {
|
|
74
|
-
return fromObject({
|
|
75
|
-
name: generatorFn.name,
|
|
76
|
-
async(...args) {
|
|
77
|
-
return iterateAsync(generatorFn.apply(this, args), options?.onYield);
|
|
78
|
-
},
|
|
79
|
-
sync(...args) {
|
|
80
|
-
return iterateSync(generatorFn.apply(this, args), options?.onYield);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
function quansync$1(input, options) {
|
|
85
|
-
if (isThenable(input))
|
|
86
|
-
return fromPromise(input);
|
|
87
|
-
if (typeof input === "function")
|
|
88
|
-
return fromGeneratorFn(input, options);
|
|
89
|
-
else
|
|
90
|
-
return fromObject(input);
|
|
91
|
-
}
|
|
92
|
-
quansync$1({
|
|
93
|
-
async: () => Promise.resolve(true),
|
|
94
|
-
sync: () => false
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const quansync = quansync$1;
|
|
98
|
-
|
|
99
|
-
export { quansync as q };
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* range-parser
|
|
3
|
-
* Copyright(c) 2012-2014 TJ Holowaychuk
|
|
4
|
-
* Copyright(c) 2015-2016 Douglas Christopher Wilson
|
|
5
|
-
* MIT Licensed
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
var rangeParser_1;
|
|
9
|
-
var hasRequiredRangeParser;
|
|
10
|
-
|
|
11
|
-
function requireRangeParser () {
|
|
12
|
-
if (hasRequiredRangeParser) return rangeParser_1;
|
|
13
|
-
hasRequiredRangeParser = 1;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Module exports.
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
rangeParser_1 = rangeParser;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Parse "Range" header `str` relative to the given file `size`.
|
|
24
|
-
*
|
|
25
|
-
* @param {Number} size
|
|
26
|
-
* @param {String} str
|
|
27
|
-
* @param {Object} [options]
|
|
28
|
-
* @return {Array}
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
function rangeParser (size, str, options) {
|
|
33
|
-
if (typeof str !== 'string') {
|
|
34
|
-
throw new TypeError('argument str must be a string')
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
var index = str.indexOf('=');
|
|
38
|
-
|
|
39
|
-
if (index === -1) {
|
|
40
|
-
return -2
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// split the range string
|
|
44
|
-
var arr = str.slice(index + 1).split(',');
|
|
45
|
-
var ranges = [];
|
|
46
|
-
|
|
47
|
-
// add ranges type
|
|
48
|
-
ranges.type = str.slice(0, index);
|
|
49
|
-
|
|
50
|
-
// parse all ranges
|
|
51
|
-
for (var i = 0; i < arr.length; i++) {
|
|
52
|
-
var range = arr[i].split('-');
|
|
53
|
-
var start = parseInt(range[0], 10);
|
|
54
|
-
var end = parseInt(range[1], 10);
|
|
55
|
-
|
|
56
|
-
// -nnn
|
|
57
|
-
if (isNaN(start)) {
|
|
58
|
-
start = size - end;
|
|
59
|
-
end = size - 1;
|
|
60
|
-
// nnn-
|
|
61
|
-
} else if (isNaN(end)) {
|
|
62
|
-
end = size - 1;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// limit last-byte-pos to current length
|
|
66
|
-
if (end > size - 1) {
|
|
67
|
-
end = size - 1;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// invalid or unsatisifiable
|
|
71
|
-
if (isNaN(start) || isNaN(end) || start > end || start < 0) {
|
|
72
|
-
continue
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// add range
|
|
76
|
-
ranges.push({
|
|
77
|
-
start: start,
|
|
78
|
-
end: end
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (ranges.length < 1) {
|
|
83
|
-
// unsatisifiable
|
|
84
|
-
return -1
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return options && options.combine
|
|
88
|
-
? combineRanges(ranges)
|
|
89
|
-
: ranges
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Combine overlapping & adjacent ranges.
|
|
94
|
-
* @private
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
function combineRanges (ranges) {
|
|
98
|
-
var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart);
|
|
99
|
-
|
|
100
|
-
for (var j = 0, i = 1; i < ordered.length; i++) {
|
|
101
|
-
var range = ordered[i];
|
|
102
|
-
var current = ordered[j];
|
|
103
|
-
|
|
104
|
-
if (range.start > current.end + 1) {
|
|
105
|
-
// next range
|
|
106
|
-
ordered[++j] = range;
|
|
107
|
-
} else if (range.end > current.end) {
|
|
108
|
-
// extend range
|
|
109
|
-
current.end = range.end;
|
|
110
|
-
current.index = Math.min(current.index, range.index);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// trim ordered array
|
|
115
|
-
ordered.length = j + 1;
|
|
116
|
-
|
|
117
|
-
// generate combined range
|
|
118
|
-
var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex);
|
|
119
|
-
|
|
120
|
-
// copy ranges type
|
|
121
|
-
combined.type = ranges.type;
|
|
122
|
-
|
|
123
|
-
return combined
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Map function to add index value to ranges.
|
|
128
|
-
* @private
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
function mapWithIndex (range, index) {
|
|
132
|
-
return {
|
|
133
|
-
start: range.start,
|
|
134
|
-
end: range.end,
|
|
135
|
-
index: index
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Map function to remove index value from ranges.
|
|
141
|
-
* @private
|
|
142
|
-
*/
|
|
143
|
-
|
|
144
|
-
function mapWithoutIndex (range) {
|
|
145
|
-
return {
|
|
146
|
-
start: range.start,
|
|
147
|
-
end: range.end
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Sort function to sort ranges by index.
|
|
153
|
-
* @private
|
|
154
|
-
*/
|
|
155
|
-
|
|
156
|
-
function sortByRangeIndex (a, b) {
|
|
157
|
-
return a.index - b.index
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Sort function to sort ranges by start position.
|
|
162
|
-
* @private
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
|
-
function sortByRangeStart (a, b) {
|
|
166
|
-
return a.start - b.start
|
|
167
|
-
}
|
|
168
|
-
return rangeParser_1;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export { requireRangeParser as r };
|