@netlify/plugin-nextjs 4.41.3 → 5.0.0-beta.0
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 +61 -17
- package/dist/build/cache.js +15 -0
- package/dist/build/content/prerendered.js +16 -0
- package/dist/build/content/server.js +18 -0
- package/dist/build/content/static.js +20 -0
- package/dist/build/functions/edge.js +14 -0
- package/dist/build/functions/server.js +16 -0
- package/dist/build/plugin-context.js +17 -0
- package/dist/esm-chunks/chunk-4AJYXTWN.js +17 -0
- package/dist/esm-chunks/chunk-62KDS27E.js +77 -0
- package/dist/esm-chunks/chunk-AVWFCGVE.js +5536 -0
- package/dist/esm-chunks/chunk-B6QMRLBH.js +255 -0
- package/dist/esm-chunks/chunk-G2VRYWGL.js +107 -0
- package/dist/esm-chunks/chunk-G3GM7JNF.js +92 -0
- package/dist/esm-chunks/chunk-GGHAQM5D.js +28 -0
- package/dist/esm-chunks/chunk-HPGTYMVD.js +113 -0
- package/dist/esm-chunks/chunk-PEBUKFKH.js +89 -0
- package/dist/esm-chunks/chunk-R4NHZWGU.js +32 -0
- package/dist/esm-chunks/chunk-RSKIKBZH.js +44 -0
- package/dist/esm-chunks/chunk-XD5TSLZO.js +85 -0
- package/dist/esm-chunks/chunk-ZBX3SNQG.js +561 -0
- package/dist/index.js +66 -0
- package/dist/run/config.js +18 -0
- package/dist/run/constants.js +15 -0
- package/dist/run/handlers/cache.cjs +849 -0
- package/dist/run/handlers/server.js +3289 -0
- package/dist/run/headers.js +19 -0
- package/dist/run/next.cjs +1055 -0
- package/dist/run/revalidate.js +13 -0
- package/edge-runtime/README.md +29 -0
- package/edge-runtime/lib/headers.ts +26 -0
- package/edge-runtime/lib/middleware.ts +60 -0
- package/edge-runtime/lib/next-request.ts +59 -0
- package/edge-runtime/lib/response.ts +145 -0
- package/edge-runtime/lib/util.ts +26 -0
- package/edge-runtime/middleware.ts +40 -0
- package/edge-runtime/shim/index.js +8 -0
- package/{src/templates → edge-runtime}/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/index.ts +1 -1
- package/edge-runtime/vendor/import_map.json +13 -0
- package/edge-runtime/vendor.ts +18 -0
- package/manifest.yml +1 -1
- package/package.json +23 -60
- package/index.js +0 -1
- package/lib/constants.js +0 -56
- package/lib/helpers/analysis.js +0 -115
- package/lib/helpers/cache.js +0 -46
- package/lib/helpers/compiler.js +0 -119
- package/lib/helpers/config.js +0 -192
- package/lib/helpers/dev.js +0 -20
- package/lib/helpers/edge.js +0 -328
- package/lib/helpers/files.js +0 -335
- package/lib/helpers/flags.js +0 -46
- package/lib/helpers/functions.js +0 -437
- package/lib/helpers/functionsMetaData.js +0 -46
- package/lib/helpers/matchers.js +0 -41
- package/lib/helpers/middlewareWatcher.js +0 -12
- package/lib/helpers/pack.js +0 -41
- package/lib/helpers/redirects.js +0 -246
- package/lib/helpers/types.js +0 -2
- package/lib/helpers/utils.js +0 -226
- package/lib/helpers/verification.js +0 -182
- package/lib/index.js +0 -194
- package/lib/templates/blobStorage.js +0 -30
- package/lib/templates/getApiHandler.js +0 -120
- package/lib/templates/getHandler.js +0 -201
- package/lib/templates/getPageResolver.js +0 -54
- package/lib/templates/handlerUtils.js +0 -268
- package/lib/templates/ipx.js +0 -13
- package/lib/templates/requireHooks.js +0 -105
- package/lib/templates/server.js +0 -159
- package/lib/templates/vendor.js +0 -20
- package/src/templates/edge/bundle.js +0 -8
- package/src/templates/edge/function-runtime.ts +0 -24
- package/src/templates/edge/imageconfig.json +0 -3
- package/src/templates/edge/ipx.ts +0 -5
- package/src/templates/edge/matchers.json +0 -1
- package/src/templates/edge/middleware-runtime.ts +0 -62
- package/src/templates/edge/next-dev.js +0 -104
- package/src/templates/edge/rsc-data.ts +0 -5
- package/src/templates/edge/shims.js +0 -77
- package/src/templates/edge-shared/next-utils.ts +0 -407
- package/src/templates/edge-shared/nextConfig.json +0 -3
- package/src/templates/edge-shared/prerender-manifest.json +0 -7
- package/src/templates/edge-shared/rsc-data.ts +0 -78
- package/src/templates/edge-shared/utils.test.ts +0 -114
- package/src/templates/edge-shared/utils.ts +0 -315
- package/src/templates/vendor/import_map.json +0 -13
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.134.0/fmt/colors.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.134.0/testing/_diff.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.134.0/testing/asserts.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/_util/asserts.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/_util/os.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/async/abortable.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/async/deadline.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/async/debounce.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/async/deferred.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/async/delay.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/async/mod.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/async/mux_async_iterator.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/async/pool.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/async/retry.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/async/tee.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/bytes/index_of_needle.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/crypto/timing_safe_equal.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/datetime/to_imf.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/encoding/base64.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/encoding/base64url.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/flags/mod.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/fmt/colors.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/fmt/printf.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/http/cookie.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/_core.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/_events.d.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/_events.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/_global.d.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/_next_tick.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/_process/exiting.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/_process/process.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/_process/stdio.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/_process/streams.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/_stream.d.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/_stream.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/_util/_util_callbackify.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/_utils.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/assert.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/assertion_error.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/async_hooks.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/buffer.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/events.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/buffer.d.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/buffer.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/crypto/_keys.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/crypto/constants.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/error_codes.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/errors.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/fixed_queue.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/hide_stack_frames.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/net.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/normalize_encoding.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/options.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/primordials.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/process/per_thread.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/readline/callbacks.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/readline/utils.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/streams/destroy.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/streams/end-of-stream.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/streams/utils.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/util/comparisons.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/util/debuglog.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/util/inspect.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/util/types.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/util.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal/validators.mjs +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/_libuv_winerror.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/_listen.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/_node.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/_timingSafeEqual.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/_utils.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/_winerror.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/ares.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/async_wrap.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/buffer.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/cares_wrap.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/config.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/connection_wrap.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/constants.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/contextify.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/credentials.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/crypto.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/errors.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/fs.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/fs_dir.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/fs_event_wrap.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/handle_wrap.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/heap_utils.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/http_parser.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/icu.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/inspector.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/js_stream.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/messaging.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/mod.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/module_wrap.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/native_module.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/natives.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/node_file.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/node_options.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/options.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/os.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/performance.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/pipe_wrap.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/process_methods.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/report.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/serdes.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/signal_wrap.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/spawn_sync.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/stream_wrap.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/string_decoder.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/symbols.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/task_queue.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/tcp_wrap.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/timers.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/tls_wrap.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/trace_events.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/tty_wrap.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/types.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/udp_wrap.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/url.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/util.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/uv.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/v8.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/worker.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/internal_binding/zlib.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/process.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/stream.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/string_decoder.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/util/types.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/node/util.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/path/_constants.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/path/_interface.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/path/_util.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/path/common.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/path/glob.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/path/mod.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/path/posix.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/path/separator.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/path/win32.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/streams/write_all.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/testing/_diff.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/testing/_format.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/testing/asserts.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/std@0.175.0/types.d.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/vendor/asyncify.js +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/vendor/html_rewriter.d.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/vendor/html_rewriter.js +0 -0
- /package/{src/templates → edge-runtime}/vendor/deno.land/x/path_to_regexp@v6.2.1/index.ts +0 -0
- /package/{src/templates → edge-runtime}/vendor/esm.sh/v91/next@12.2.5/deno/dist/compiled/cookie.js +0 -0
- /package/{src/templates → edge-runtime}/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js +0 -0
- /package/{src/templates → edge-runtime}/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/response.js +0 -0
- /package/{src/templates → edge-runtime}/vendor/raw.githubusercontent.com/worker-tools/resolvable-promise/master/index.ts +0 -0
|
@@ -0,0 +1,1055 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// node_modules/fs-monkey/lib/util/lists.js
|
|
34
|
+
var require_lists = __commonJS({
|
|
35
|
+
"node_modules/fs-monkey/lib/util/lists.js"(exports2) {
|
|
36
|
+
"use strict";
|
|
37
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
38
|
+
value: true
|
|
39
|
+
});
|
|
40
|
+
exports2.fsSyncMethods = exports2.fsProps = exports2.fsAsyncMethods = void 0;
|
|
41
|
+
var fsProps = ["constants", "F_OK", "R_OK", "W_OK", "X_OK", "Stats"];
|
|
42
|
+
exports2.fsProps = fsProps;
|
|
43
|
+
var fsSyncMethods = ["renameSync", "ftruncateSync", "truncateSync", "chownSync", "fchownSync", "lchownSync", "chmodSync", "fchmodSync", "lchmodSync", "statSync", "lstatSync", "fstatSync", "linkSync", "symlinkSync", "readlinkSync", "realpathSync", "unlinkSync", "rmdirSync", "mkdirSync", "mkdirpSync", "readdirSync", "closeSync", "openSync", "utimesSync", "futimesSync", "fsyncSync", "writeSync", "readSync", "readFileSync", "writeFileSync", "appendFileSync", "existsSync", "accessSync", "fdatasyncSync", "mkdtempSync", "copyFileSync", "rmSync", "createReadStream", "createWriteStream"];
|
|
44
|
+
exports2.fsSyncMethods = fsSyncMethods;
|
|
45
|
+
var fsAsyncMethods = ["rename", "ftruncate", "truncate", "chown", "fchown", "lchown", "chmod", "fchmod", "lchmod", "stat", "lstat", "fstat", "link", "symlink", "readlink", "realpath", "unlink", "rmdir", "mkdir", "mkdirp", "readdir", "close", "open", "utimes", "futimes", "fsync", "write", "read", "readFile", "writeFile", "appendFile", "exists", "access", "fdatasync", "mkdtemp", "copyFile", "rm", "watchFile", "unwatchFile", "watch"];
|
|
46
|
+
exports2.fsAsyncMethods = fsAsyncMethods;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// node_modules/fs-monkey/lib/patchFs.js
|
|
51
|
+
var require_patchFs = __commonJS({
|
|
52
|
+
"node_modules/fs-monkey/lib/patchFs.js"(exports2) {
|
|
53
|
+
"use strict";
|
|
54
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
55
|
+
value: true
|
|
56
|
+
});
|
|
57
|
+
exports2["default"] = patchFs2;
|
|
58
|
+
var _lists = require_lists();
|
|
59
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
60
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
61
|
+
if (!it) {
|
|
62
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
63
|
+
if (it)
|
|
64
|
+
o = it;
|
|
65
|
+
var i = 0;
|
|
66
|
+
var F = function F2() {
|
|
67
|
+
};
|
|
68
|
+
return { s: F, n: function n() {
|
|
69
|
+
if (i >= o.length)
|
|
70
|
+
return { done: true };
|
|
71
|
+
return { done: false, value: o[i++] };
|
|
72
|
+
}, e: function e(_e) {
|
|
73
|
+
throw _e;
|
|
74
|
+
}, f: F };
|
|
75
|
+
}
|
|
76
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
77
|
+
}
|
|
78
|
+
var normalCompletion = true, didErr = false, err;
|
|
79
|
+
return { s: function s() {
|
|
80
|
+
it = it.call(o);
|
|
81
|
+
}, n: function n() {
|
|
82
|
+
var step = it.next();
|
|
83
|
+
normalCompletion = step.done;
|
|
84
|
+
return step;
|
|
85
|
+
}, e: function e(_e2) {
|
|
86
|
+
didErr = true;
|
|
87
|
+
err = _e2;
|
|
88
|
+
}, f: function f() {
|
|
89
|
+
try {
|
|
90
|
+
if (!normalCompletion && it["return"] != null)
|
|
91
|
+
it["return"]();
|
|
92
|
+
} finally {
|
|
93
|
+
if (didErr)
|
|
94
|
+
throw err;
|
|
95
|
+
}
|
|
96
|
+
} };
|
|
97
|
+
}
|
|
98
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
99
|
+
if (!o)
|
|
100
|
+
return;
|
|
101
|
+
if (typeof o === "string")
|
|
102
|
+
return _arrayLikeToArray(o, minLen);
|
|
103
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
104
|
+
if (n === "Object" && o.constructor)
|
|
105
|
+
n = o.constructor.name;
|
|
106
|
+
if (n === "Map" || n === "Set")
|
|
107
|
+
return Array.from(o);
|
|
108
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
109
|
+
return _arrayLikeToArray(o, minLen);
|
|
110
|
+
}
|
|
111
|
+
function _arrayLikeToArray(arr, len) {
|
|
112
|
+
if (len == null || len > arr.length)
|
|
113
|
+
len = arr.length;
|
|
114
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
115
|
+
arr2[i] = arr[i];
|
|
116
|
+
return arr2;
|
|
117
|
+
}
|
|
118
|
+
function patchFs2(vol) {
|
|
119
|
+
var fs2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : require("fs");
|
|
120
|
+
var bkp = {};
|
|
121
|
+
var patch = function patch2(key, newValue) {
|
|
122
|
+
bkp[key] = fs2[key];
|
|
123
|
+
fs2[key] = newValue;
|
|
124
|
+
};
|
|
125
|
+
var patchMethod = function patchMethod2(key) {
|
|
126
|
+
return patch(key, vol[key].bind(vol));
|
|
127
|
+
};
|
|
128
|
+
var _iterator = _createForOfIteratorHelper(_lists.fsProps), _step;
|
|
129
|
+
try {
|
|
130
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
131
|
+
var prop = _step.value;
|
|
132
|
+
if (typeof vol[prop] !== "undefined")
|
|
133
|
+
patch(prop, vol[prop]);
|
|
134
|
+
}
|
|
135
|
+
} catch (err) {
|
|
136
|
+
_iterator.e(err);
|
|
137
|
+
} finally {
|
|
138
|
+
_iterator.f();
|
|
139
|
+
}
|
|
140
|
+
if (typeof vol.StatWatcher === "function") {
|
|
141
|
+
patch("StatWatcher", vol.FSWatcher.bind(null, vol));
|
|
142
|
+
}
|
|
143
|
+
if (typeof vol.FSWatcher === "function") {
|
|
144
|
+
patch("FSWatcher", vol.StatWatcher.bind(null, vol));
|
|
145
|
+
}
|
|
146
|
+
if (typeof vol.ReadStream === "function") {
|
|
147
|
+
patch("ReadStream", vol.ReadStream.bind(null, vol));
|
|
148
|
+
}
|
|
149
|
+
if (typeof vol.WriteStream === "function") {
|
|
150
|
+
patch("WriteStream", vol.WriteStream.bind(null, vol));
|
|
151
|
+
}
|
|
152
|
+
if (typeof vol._toUnixTimestamp === "function")
|
|
153
|
+
patchMethod("_toUnixTimestamp");
|
|
154
|
+
var _iterator2 = _createForOfIteratorHelper(_lists.fsAsyncMethods), _step2;
|
|
155
|
+
try {
|
|
156
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
|
|
157
|
+
var method = _step2.value;
|
|
158
|
+
if (typeof vol[method] === "function")
|
|
159
|
+
patchMethod(method);
|
|
160
|
+
}
|
|
161
|
+
} catch (err) {
|
|
162
|
+
_iterator2.e(err);
|
|
163
|
+
} finally {
|
|
164
|
+
_iterator2.f();
|
|
165
|
+
}
|
|
166
|
+
var _iterator3 = _createForOfIteratorHelper(_lists.fsSyncMethods), _step3;
|
|
167
|
+
try {
|
|
168
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
|
|
169
|
+
var _method = _step3.value;
|
|
170
|
+
if (typeof vol[_method] === "function")
|
|
171
|
+
patchMethod(_method);
|
|
172
|
+
}
|
|
173
|
+
} catch (err) {
|
|
174
|
+
_iterator3.e(err);
|
|
175
|
+
} finally {
|
|
176
|
+
_iterator3.f();
|
|
177
|
+
}
|
|
178
|
+
return function unpatch() {
|
|
179
|
+
for (var key in bkp)
|
|
180
|
+
fs2[key] = bkp[key];
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// node_modules/fs-monkey/lib/correctPath.js
|
|
187
|
+
var require_correctPath = __commonJS({
|
|
188
|
+
"node_modules/fs-monkey/lib/correctPath.js"(exports2) {
|
|
189
|
+
"use strict";
|
|
190
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
191
|
+
value: true
|
|
192
|
+
});
|
|
193
|
+
exports2.correctPath = correctPath;
|
|
194
|
+
exports2.unixify = unixify;
|
|
195
|
+
var isWin = process.platform === "win32";
|
|
196
|
+
function removeTrailingSeparator(str) {
|
|
197
|
+
var i = str.length - 1;
|
|
198
|
+
if (i < 2) {
|
|
199
|
+
return str;
|
|
200
|
+
}
|
|
201
|
+
while (isSeparator(str, i)) {
|
|
202
|
+
i--;
|
|
203
|
+
}
|
|
204
|
+
return str.substr(0, i + 1);
|
|
205
|
+
}
|
|
206
|
+
function isSeparator(str, i) {
|
|
207
|
+
var _char = str[i];
|
|
208
|
+
return i > 0 && (_char === "/" || isWin && _char === "\\");
|
|
209
|
+
}
|
|
210
|
+
function normalizePath(str, stripTrailing) {
|
|
211
|
+
if (typeof str !== "string") {
|
|
212
|
+
throw new TypeError("expected a string");
|
|
213
|
+
}
|
|
214
|
+
str = str.replace(/[\\\/]+/g, "/");
|
|
215
|
+
if (stripTrailing !== false) {
|
|
216
|
+
str = removeTrailingSeparator(str);
|
|
217
|
+
}
|
|
218
|
+
return str;
|
|
219
|
+
}
|
|
220
|
+
function unixify(filepath) {
|
|
221
|
+
var stripTrailing = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
222
|
+
if (isWin) {
|
|
223
|
+
filepath = normalizePath(filepath, stripTrailing);
|
|
224
|
+
return filepath.replace(/^([a-zA-Z]+:|\.\/)/, "");
|
|
225
|
+
}
|
|
226
|
+
return filepath;
|
|
227
|
+
}
|
|
228
|
+
function correctPath(filepath) {
|
|
229
|
+
return unixify(filepath.replace(/^\\\\\?\\.:\\/, "\\"));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// node_modules/fs-monkey/lib/patchRequire.js
|
|
235
|
+
var require_patchRequire = __commonJS({
|
|
236
|
+
"node_modules/fs-monkey/lib/patchRequire.js"(exports2) {
|
|
237
|
+
"use strict";
|
|
238
|
+
function _typeof(obj) {
|
|
239
|
+
"@babel/helpers - typeof";
|
|
240
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
241
|
+
return typeof obj2;
|
|
242
|
+
} : function(obj2) {
|
|
243
|
+
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
244
|
+
}, _typeof(obj);
|
|
245
|
+
}
|
|
246
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
247
|
+
value: true
|
|
248
|
+
});
|
|
249
|
+
exports2["default"] = patchRequire;
|
|
250
|
+
var path = _interopRequireWildcard(require("path"));
|
|
251
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
252
|
+
if (typeof WeakMap !== "function")
|
|
253
|
+
return null;
|
|
254
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
255
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
256
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache2(nodeInterop2) {
|
|
257
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
258
|
+
})(nodeInterop);
|
|
259
|
+
}
|
|
260
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
261
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
262
|
+
return obj;
|
|
263
|
+
}
|
|
264
|
+
if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
|
|
265
|
+
return { "default": obj };
|
|
266
|
+
}
|
|
267
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
268
|
+
if (cache && cache.has(obj)) {
|
|
269
|
+
return cache.get(obj);
|
|
270
|
+
}
|
|
271
|
+
var newObj = {};
|
|
272
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
273
|
+
for (var key in obj) {
|
|
274
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
275
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
276
|
+
if (desc && (desc.get || desc.set)) {
|
|
277
|
+
Object.defineProperty(newObj, key, desc);
|
|
278
|
+
} else {
|
|
279
|
+
newObj[key] = obj[key];
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
newObj["default"] = obj;
|
|
284
|
+
if (cache) {
|
|
285
|
+
cache.set(obj, newObj);
|
|
286
|
+
}
|
|
287
|
+
return newObj;
|
|
288
|
+
}
|
|
289
|
+
var isWin32 = process.platform === "win32";
|
|
290
|
+
var correctPath = isWin32 ? require_correctPath().correctPath : function(p) {
|
|
291
|
+
return p;
|
|
292
|
+
};
|
|
293
|
+
function stripBOM(content) {
|
|
294
|
+
if (content.charCodeAt(0) === 65279) {
|
|
295
|
+
content = content.slice(1);
|
|
296
|
+
}
|
|
297
|
+
return content;
|
|
298
|
+
}
|
|
299
|
+
function patchRequire(vol) {
|
|
300
|
+
var unixifyPaths = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
301
|
+
var Module = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : require("module");
|
|
302
|
+
if (isWin32 && unixifyPaths) {
|
|
303
|
+
var original = vol;
|
|
304
|
+
vol = {
|
|
305
|
+
readFileSync: function readFileSync(path2, options) {
|
|
306
|
+
return original.readFileSync(correctPath(path2), options);
|
|
307
|
+
},
|
|
308
|
+
realpathSync: function realpathSync(path2) {
|
|
309
|
+
return original.realpathSync(correctPath(path2));
|
|
310
|
+
},
|
|
311
|
+
statSync: function statSync(path2) {
|
|
312
|
+
return original.statSync(correctPath(path2));
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
function internalModuleReadFile(path2) {
|
|
317
|
+
try {
|
|
318
|
+
return vol.readFileSync(path2, "utf8");
|
|
319
|
+
} catch (err) {
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function internalModuleStat(filename) {
|
|
323
|
+
try {
|
|
324
|
+
return vol.statSync(filename).isDirectory() ? 1 : 0;
|
|
325
|
+
} catch (err) {
|
|
326
|
+
return -2;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function stat(filename) {
|
|
330
|
+
filename = path._makeLong(filename);
|
|
331
|
+
var cache = stat.cache;
|
|
332
|
+
if (cache !== null) {
|
|
333
|
+
var _result = cache.get(filename);
|
|
334
|
+
if (_result !== void 0)
|
|
335
|
+
return _result;
|
|
336
|
+
}
|
|
337
|
+
var result = internalModuleStat(filename);
|
|
338
|
+
if (cache !== null)
|
|
339
|
+
cache.set(filename, result);
|
|
340
|
+
return result;
|
|
341
|
+
}
|
|
342
|
+
stat.cache = null;
|
|
343
|
+
var preserveSymlinks = false;
|
|
344
|
+
function toRealPath(requestPath) {
|
|
345
|
+
return vol.realpathSync(requestPath);
|
|
346
|
+
}
|
|
347
|
+
var packageMainCache = /* @__PURE__ */ Object.create(null);
|
|
348
|
+
function readPackage(requestPath) {
|
|
349
|
+
var entry = packageMainCache[requestPath];
|
|
350
|
+
if (entry)
|
|
351
|
+
return entry;
|
|
352
|
+
var jsonPath = path.resolve(requestPath, "package.json");
|
|
353
|
+
var json = internalModuleReadFile(path._makeLong(jsonPath));
|
|
354
|
+
if (json === void 0) {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
var pkg;
|
|
358
|
+
try {
|
|
359
|
+
var pkgJson = JSON.parse(json);
|
|
360
|
+
pkg = packageMainCache[requestPath] = pkgJson.exports && pkgJson.exports.require || pkgJson.main;
|
|
361
|
+
} catch (e) {
|
|
362
|
+
e.path = jsonPath;
|
|
363
|
+
e.message = "Error parsing " + jsonPath + ": " + e.message;
|
|
364
|
+
throw e;
|
|
365
|
+
}
|
|
366
|
+
return pkg;
|
|
367
|
+
}
|
|
368
|
+
function tryFile(requestPath, isMain) {
|
|
369
|
+
var rc = stat(requestPath);
|
|
370
|
+
if (preserveSymlinks && !isMain) {
|
|
371
|
+
return rc === 0 && path.resolve(requestPath);
|
|
372
|
+
}
|
|
373
|
+
return rc === 0 && toRealPath(requestPath);
|
|
374
|
+
}
|
|
375
|
+
function tryExtensions(p, exts, isMain) {
|
|
376
|
+
for (var i = 0; i < exts.length; i++) {
|
|
377
|
+
var filename = tryFile(p + exts[i], isMain);
|
|
378
|
+
if (filename) {
|
|
379
|
+
return filename;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
function tryPackage(requestPath, exts, isMain) {
|
|
385
|
+
var pkg = readPackage(requestPath);
|
|
386
|
+
if (!pkg)
|
|
387
|
+
return false;
|
|
388
|
+
var filename = path.resolve(requestPath, pkg);
|
|
389
|
+
return tryFile(filename, isMain) || tryExtensions(filename, exts, isMain) || tryExtensions(path.resolve(filename, "index"), exts, isMain);
|
|
390
|
+
}
|
|
391
|
+
Module._extensions[".js"] = function(module3, filename) {
|
|
392
|
+
var content = vol.readFileSync(filename, "utf8");
|
|
393
|
+
module3._compile(stripBOM(content), filename);
|
|
394
|
+
};
|
|
395
|
+
Module._extensions[".json"] = function(module3, filename) {
|
|
396
|
+
var content = vol.readFileSync(filename, "utf8");
|
|
397
|
+
try {
|
|
398
|
+
module3.exports = JSON.parse(stripBOM(content));
|
|
399
|
+
} catch (err) {
|
|
400
|
+
err.message = filename + ": " + err.message;
|
|
401
|
+
throw err;
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
var warned = true;
|
|
405
|
+
Module._findPath = function(request, paths, isMain) {
|
|
406
|
+
if (path.isAbsolute(request)) {
|
|
407
|
+
paths = [""];
|
|
408
|
+
} else if (!paths || paths.length === 0) {
|
|
409
|
+
return false;
|
|
410
|
+
}
|
|
411
|
+
var cacheKey = request + "\0" + (paths.length === 1 ? paths[0] : paths.join("\0"));
|
|
412
|
+
var entry = Module._pathCache[cacheKey];
|
|
413
|
+
if (entry)
|
|
414
|
+
return entry;
|
|
415
|
+
var exts;
|
|
416
|
+
var trailingSlash = request.length > 0 && request.charCodeAt(request.length - 1) === 47;
|
|
417
|
+
for (var i = 0; i < paths.length; i++) {
|
|
418
|
+
var curPath = paths[i];
|
|
419
|
+
if (curPath && stat(curPath) < 1)
|
|
420
|
+
continue;
|
|
421
|
+
var basePath = correctPath(path.resolve(curPath, request));
|
|
422
|
+
var filename;
|
|
423
|
+
var rc = stat(basePath);
|
|
424
|
+
if (!trailingSlash) {
|
|
425
|
+
if (rc === 0) {
|
|
426
|
+
if (preserveSymlinks && !isMain) {
|
|
427
|
+
filename = path.resolve(basePath);
|
|
428
|
+
} else {
|
|
429
|
+
filename = toRealPath(basePath);
|
|
430
|
+
}
|
|
431
|
+
} else if (rc === 1) {
|
|
432
|
+
if (exts === void 0)
|
|
433
|
+
exts = Object.keys(Module._extensions);
|
|
434
|
+
filename = tryPackage(basePath, exts, isMain);
|
|
435
|
+
}
|
|
436
|
+
if (!filename) {
|
|
437
|
+
if (exts === void 0)
|
|
438
|
+
exts = Object.keys(Module._extensions);
|
|
439
|
+
filename = tryExtensions(basePath, exts, isMain);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (!filename && rc === 1) {
|
|
443
|
+
if (exts === void 0)
|
|
444
|
+
exts = Object.keys(Module._extensions);
|
|
445
|
+
filename = tryPackage(basePath, exts, isMain);
|
|
446
|
+
}
|
|
447
|
+
if (!filename && rc === 1) {
|
|
448
|
+
if (exts === void 0)
|
|
449
|
+
exts = Object.keys(Module._extensions);
|
|
450
|
+
filename = tryExtensions(path.resolve(basePath, "index"), exts, isMain);
|
|
451
|
+
}
|
|
452
|
+
if (filename) {
|
|
453
|
+
if (request === "." && i > 0) {
|
|
454
|
+
if (!warned) {
|
|
455
|
+
warned = true;
|
|
456
|
+
process.emitWarning("warning: require('.') resolved outside the package directory. This functionality is deprecated and will be removed soon.", "DeprecationWarning", "DEP0019");
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
Module._pathCache[cacheKey] = filename;
|
|
460
|
+
return filename;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return false;
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
// node_modules/fs-monkey/lib/index.js
|
|
470
|
+
var require_lib = __commonJS({
|
|
471
|
+
"node_modules/fs-monkey/lib/index.js"(exports2) {
|
|
472
|
+
"use strict";
|
|
473
|
+
function _typeof(obj) {
|
|
474
|
+
"@babel/helpers - typeof";
|
|
475
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
476
|
+
return typeof obj2;
|
|
477
|
+
} : function(obj2) {
|
|
478
|
+
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
479
|
+
}, _typeof(obj);
|
|
480
|
+
}
|
|
481
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
482
|
+
value: true
|
|
483
|
+
});
|
|
484
|
+
Object.defineProperty(exports2, "patchFs", {
|
|
485
|
+
enumerable: true,
|
|
486
|
+
get: function get() {
|
|
487
|
+
return _patchFs["default"];
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
Object.defineProperty(exports2, "patchRequire", {
|
|
491
|
+
enumerable: true,
|
|
492
|
+
get: function get() {
|
|
493
|
+
return _patchRequire["default"];
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
Object.defineProperty(exports2, "unixify", {
|
|
497
|
+
enumerable: true,
|
|
498
|
+
get: function get() {
|
|
499
|
+
return _correctPath.unixify;
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
exports2.util = void 0;
|
|
503
|
+
var _patchFs = _interopRequireDefault(require_patchFs());
|
|
504
|
+
var _patchRequire = _interopRequireDefault(require_patchRequire());
|
|
505
|
+
var _correctPath = require_correctPath();
|
|
506
|
+
var util = _interopRequireWildcard(require_lists());
|
|
507
|
+
exports2.util = util;
|
|
508
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
509
|
+
if (typeof WeakMap !== "function")
|
|
510
|
+
return null;
|
|
511
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
512
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
513
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache2(nodeInterop2) {
|
|
514
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
515
|
+
})(nodeInterop);
|
|
516
|
+
}
|
|
517
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
518
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
519
|
+
return obj;
|
|
520
|
+
}
|
|
521
|
+
if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
|
|
522
|
+
return { "default": obj };
|
|
523
|
+
}
|
|
524
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
525
|
+
if (cache && cache.has(obj)) {
|
|
526
|
+
return cache.get(obj);
|
|
527
|
+
}
|
|
528
|
+
var newObj = {};
|
|
529
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
530
|
+
for (var key in obj) {
|
|
531
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
532
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
533
|
+
if (desc && (desc.get || desc.set)) {
|
|
534
|
+
Object.defineProperty(newObj, key, desc);
|
|
535
|
+
} else {
|
|
536
|
+
newObj[key] = obj[key];
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
newObj["default"] = obj;
|
|
541
|
+
if (cache) {
|
|
542
|
+
cache.set(obj, newObj);
|
|
543
|
+
}
|
|
544
|
+
return newObj;
|
|
545
|
+
}
|
|
546
|
+
function _interopRequireDefault(obj) {
|
|
547
|
+
return obj && obj.__esModule ? obj : { "default": obj };
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
// src/run/next.cts
|
|
553
|
+
var next_exports = {};
|
|
554
|
+
__export(next_exports, {
|
|
555
|
+
getMockedRequestHandlers: () => getMockedRequestHandlers
|
|
556
|
+
});
|
|
557
|
+
module.exports = __toCommonJS(next_exports);
|
|
558
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
559
|
+
var import_node_buffer = require("node:buffer");
|
|
560
|
+
var import_path = require("path");
|
|
561
|
+
|
|
562
|
+
// node_modules/@netlify/blobs/dist/main.js
|
|
563
|
+
var import_buffer = require("buffer");
|
|
564
|
+
var import_process = require("process");
|
|
565
|
+
var import_buffer2 = require("buffer");
|
|
566
|
+
var import_buffer3 = require("buffer");
|
|
567
|
+
var getEnvironmentContext = () => {
|
|
568
|
+
const context = globalThis.netlifyBlobsContext || import_process.env.NETLIFY_BLOBS_CONTEXT;
|
|
569
|
+
if (typeof context !== "string" || !context) {
|
|
570
|
+
return {};
|
|
571
|
+
}
|
|
572
|
+
const data = import_buffer.Buffer.from(context, "base64").toString();
|
|
573
|
+
try {
|
|
574
|
+
return JSON.parse(data);
|
|
575
|
+
} catch {
|
|
576
|
+
}
|
|
577
|
+
return {};
|
|
578
|
+
};
|
|
579
|
+
var MissingBlobsEnvironmentError = class extends Error {
|
|
580
|
+
constructor(requiredProperties) {
|
|
581
|
+
super(
|
|
582
|
+
`The environment has not been configured to use Netlify Blobs. To use it manually, supply the following properties when creating a store: ${requiredProperties.join(
|
|
583
|
+
", "
|
|
584
|
+
)}`
|
|
585
|
+
);
|
|
586
|
+
this.name = "MissingBlobsEnvironmentError";
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
var BASE64_PREFIX = "b64;";
|
|
590
|
+
var METADATA_HEADER_INTERNAL = "x-amz-meta-user";
|
|
591
|
+
var METADATA_HEADER_EXTERNAL = "netlify-blobs-metadata";
|
|
592
|
+
var METADATA_MAX_SIZE = 2 * 1024;
|
|
593
|
+
var encodeMetadata = (metadata) => {
|
|
594
|
+
if (!metadata) {
|
|
595
|
+
return null;
|
|
596
|
+
}
|
|
597
|
+
const encodedObject = import_buffer2.Buffer.from(JSON.stringify(metadata)).toString("base64");
|
|
598
|
+
const payload = `b64;${encodedObject}`;
|
|
599
|
+
if (METADATA_HEADER_EXTERNAL.length + payload.length > METADATA_MAX_SIZE) {
|
|
600
|
+
throw new Error("Metadata object exceeds the maximum size");
|
|
601
|
+
}
|
|
602
|
+
return payload;
|
|
603
|
+
};
|
|
604
|
+
var decodeMetadata = (header) => {
|
|
605
|
+
if (!header || !header.startsWith(BASE64_PREFIX)) {
|
|
606
|
+
return {};
|
|
607
|
+
}
|
|
608
|
+
const encodedData = header.slice(BASE64_PREFIX.length);
|
|
609
|
+
const decodedData = import_buffer2.Buffer.from(encodedData, "base64").toString();
|
|
610
|
+
const metadata = JSON.parse(decodedData);
|
|
611
|
+
return metadata;
|
|
612
|
+
};
|
|
613
|
+
var getMetadataFromResponse = (response) => {
|
|
614
|
+
if (!response.headers) {
|
|
615
|
+
return {};
|
|
616
|
+
}
|
|
617
|
+
const value = response.headers.get(METADATA_HEADER_EXTERNAL) || response.headers.get(METADATA_HEADER_INTERNAL);
|
|
618
|
+
try {
|
|
619
|
+
return decodeMetadata(value);
|
|
620
|
+
} catch {
|
|
621
|
+
throw new Error(
|
|
622
|
+
"An internal error occurred while trying to retrieve the metadata for an entry. Please try updating to the latest version of the Netlify Blobs client."
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
var DEFAULT_RETRY_DELAY = 5e3;
|
|
627
|
+
var MIN_RETRY_DELAY = 1e3;
|
|
628
|
+
var MAX_RETRY = 5;
|
|
629
|
+
var RATE_LIMIT_HEADER = "X-RateLimit-Reset";
|
|
630
|
+
var fetchAndRetry = async (fetch, url, options, attemptsLeft = MAX_RETRY) => {
|
|
631
|
+
try {
|
|
632
|
+
const res = await fetch(url, options);
|
|
633
|
+
if (attemptsLeft > 0 && (res.status === 429 || res.status >= 500)) {
|
|
634
|
+
const delay = getDelay(res.headers.get(RATE_LIMIT_HEADER));
|
|
635
|
+
await sleep(delay);
|
|
636
|
+
return fetchAndRetry(fetch, url, options, attemptsLeft - 1);
|
|
637
|
+
}
|
|
638
|
+
return res;
|
|
639
|
+
} catch (error) {
|
|
640
|
+
if (attemptsLeft === 0) {
|
|
641
|
+
throw error;
|
|
642
|
+
}
|
|
643
|
+
const delay = getDelay();
|
|
644
|
+
await sleep(delay);
|
|
645
|
+
return fetchAndRetry(fetch, url, options, attemptsLeft - 1);
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
var getDelay = (rateLimitReset) => {
|
|
649
|
+
if (!rateLimitReset) {
|
|
650
|
+
return DEFAULT_RETRY_DELAY;
|
|
651
|
+
}
|
|
652
|
+
return Math.max(Number(rateLimitReset) * 1e3 - Date.now(), MIN_RETRY_DELAY);
|
|
653
|
+
};
|
|
654
|
+
var sleep = (ms) => new Promise((resolve2) => {
|
|
655
|
+
setTimeout(resolve2, ms);
|
|
656
|
+
});
|
|
657
|
+
var Client = class {
|
|
658
|
+
constructor({ apiURL, edgeURL, fetch, siteID, token }) {
|
|
659
|
+
this.apiURL = apiURL;
|
|
660
|
+
this.edgeURL = edgeURL;
|
|
661
|
+
this.fetch = fetch ?? globalThis.fetch;
|
|
662
|
+
this.siteID = siteID;
|
|
663
|
+
this.token = token;
|
|
664
|
+
if (!this.fetch) {
|
|
665
|
+
throw new Error(
|
|
666
|
+
"Netlify Blobs could not find a `fetch` client in the global scope. You can either update your runtime to a version that includes `fetch` (like Node.js 18.0.0 or above), or you can supply your own implementation using the `fetch` property."
|
|
667
|
+
);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
async getFinalRequest({ key, metadata, method, parameters = {}, storeName }) {
|
|
671
|
+
const encodedMetadata = encodeMetadata(metadata);
|
|
672
|
+
if (this.edgeURL) {
|
|
673
|
+
const headers = {
|
|
674
|
+
authorization: `Bearer ${this.token}`
|
|
675
|
+
};
|
|
676
|
+
if (encodedMetadata) {
|
|
677
|
+
headers[METADATA_HEADER_INTERNAL] = encodedMetadata;
|
|
678
|
+
}
|
|
679
|
+
const path = key ? `/${this.siteID}/${storeName}/${key}` : `/${this.siteID}/${storeName}`;
|
|
680
|
+
const url2 = new URL(path, this.edgeURL);
|
|
681
|
+
for (const key2 in parameters) {
|
|
682
|
+
url2.searchParams.set(key2, parameters[key2]);
|
|
683
|
+
}
|
|
684
|
+
return {
|
|
685
|
+
headers,
|
|
686
|
+
url: url2.toString()
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
const apiHeaders = { authorization: `Bearer ${this.token}` };
|
|
690
|
+
const url = new URL(`/api/v1/sites/${this.siteID}/blobs`, this.apiURL ?? "https://api.netlify.com");
|
|
691
|
+
for (const key2 in parameters) {
|
|
692
|
+
url.searchParams.set(key2, parameters[key2]);
|
|
693
|
+
}
|
|
694
|
+
url.searchParams.set("context", storeName);
|
|
695
|
+
if (key === void 0) {
|
|
696
|
+
return {
|
|
697
|
+
headers: apiHeaders,
|
|
698
|
+
url: url.toString()
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
url.pathname += `/${key}`;
|
|
702
|
+
if (encodedMetadata) {
|
|
703
|
+
apiHeaders[METADATA_HEADER_EXTERNAL] = encodedMetadata;
|
|
704
|
+
}
|
|
705
|
+
if (method === "head") {
|
|
706
|
+
return {
|
|
707
|
+
headers: apiHeaders,
|
|
708
|
+
url: url.toString()
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
const res = await this.fetch(url.toString(), { headers: apiHeaders, method });
|
|
712
|
+
if (res.status !== 200) {
|
|
713
|
+
throw new Error(`Netlify Blobs has generated an internal error: ${res.status} response`);
|
|
714
|
+
}
|
|
715
|
+
const { url: signedURL } = await res.json();
|
|
716
|
+
const userHeaders = encodedMetadata ? { [METADATA_HEADER_INTERNAL]: encodedMetadata } : void 0;
|
|
717
|
+
return {
|
|
718
|
+
headers: userHeaders,
|
|
719
|
+
url: signedURL
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
async makeRequest({
|
|
723
|
+
body,
|
|
724
|
+
headers: extraHeaders,
|
|
725
|
+
key,
|
|
726
|
+
metadata,
|
|
727
|
+
method,
|
|
728
|
+
parameters,
|
|
729
|
+
storeName
|
|
730
|
+
}) {
|
|
731
|
+
const { headers: baseHeaders = {}, url } = await this.getFinalRequest({
|
|
732
|
+
key,
|
|
733
|
+
metadata,
|
|
734
|
+
method,
|
|
735
|
+
parameters,
|
|
736
|
+
storeName
|
|
737
|
+
});
|
|
738
|
+
const headers = {
|
|
739
|
+
...baseHeaders,
|
|
740
|
+
...extraHeaders
|
|
741
|
+
};
|
|
742
|
+
if (method === "put") {
|
|
743
|
+
headers["cache-control"] = "max-age=0, stale-while-revalidate=60";
|
|
744
|
+
}
|
|
745
|
+
const options = {
|
|
746
|
+
body,
|
|
747
|
+
headers,
|
|
748
|
+
method
|
|
749
|
+
};
|
|
750
|
+
if (body instanceof ReadableStream) {
|
|
751
|
+
options.duplex = "half";
|
|
752
|
+
}
|
|
753
|
+
return fetchAndRetry(this.fetch, url, options);
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
var getClientOptions = (options, contextOverride) => {
|
|
757
|
+
const context = contextOverride ?? getEnvironmentContext();
|
|
758
|
+
const siteID = context.siteID ?? options.siteID;
|
|
759
|
+
const token = context.token ?? options.token;
|
|
760
|
+
if (!siteID || !token) {
|
|
761
|
+
throw new MissingBlobsEnvironmentError(["siteID", "token"]);
|
|
762
|
+
}
|
|
763
|
+
const clientOptions = {
|
|
764
|
+
apiURL: context.apiURL ?? options.apiURL,
|
|
765
|
+
edgeURL: context.edgeURL ?? options.edgeURL,
|
|
766
|
+
fetch: options.fetch,
|
|
767
|
+
siteID,
|
|
768
|
+
token
|
|
769
|
+
};
|
|
770
|
+
return clientOptions;
|
|
771
|
+
};
|
|
772
|
+
var BlobsInternalError = class extends Error {
|
|
773
|
+
constructor(statusCode) {
|
|
774
|
+
super(`Netlify Blobs has generated an internal error: ${statusCode} response`);
|
|
775
|
+
this.name = "BlobsInternalError";
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
var collectIterator = async (iterator) => {
|
|
779
|
+
const result = [];
|
|
780
|
+
for await (const item of iterator) {
|
|
781
|
+
result.push(item);
|
|
782
|
+
}
|
|
783
|
+
return result;
|
|
784
|
+
};
|
|
785
|
+
var Store = class _Store {
|
|
786
|
+
constructor(options) {
|
|
787
|
+
this.client = options.client;
|
|
788
|
+
if ("deployID" in options) {
|
|
789
|
+
_Store.validateDeployID(options.deployID);
|
|
790
|
+
this.name = `deploy:${options.deployID}`;
|
|
791
|
+
} else {
|
|
792
|
+
_Store.validateStoreName(options.name);
|
|
793
|
+
this.name = options.name;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
async delete(key) {
|
|
797
|
+
const res = await this.client.makeRequest({ key, method: "delete", storeName: this.name });
|
|
798
|
+
if (![200, 204, 404].includes(res.status)) {
|
|
799
|
+
throw new BlobsInternalError(res.status);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
async get(key, options) {
|
|
803
|
+
const { type } = options ?? {};
|
|
804
|
+
const res = await this.client.makeRequest({ key, method: "get", storeName: this.name });
|
|
805
|
+
if (res.status === 404) {
|
|
806
|
+
return null;
|
|
807
|
+
}
|
|
808
|
+
if (res.status !== 200) {
|
|
809
|
+
throw new BlobsInternalError(res.status);
|
|
810
|
+
}
|
|
811
|
+
if (type === void 0 || type === "text") {
|
|
812
|
+
return res.text();
|
|
813
|
+
}
|
|
814
|
+
if (type === "arrayBuffer") {
|
|
815
|
+
return res.arrayBuffer();
|
|
816
|
+
}
|
|
817
|
+
if (type === "blob") {
|
|
818
|
+
return res.blob();
|
|
819
|
+
}
|
|
820
|
+
if (type === "json") {
|
|
821
|
+
return res.json();
|
|
822
|
+
}
|
|
823
|
+
if (type === "stream") {
|
|
824
|
+
return res.body;
|
|
825
|
+
}
|
|
826
|
+
throw new BlobsInternalError(res.status);
|
|
827
|
+
}
|
|
828
|
+
async getMetadata(key) {
|
|
829
|
+
const res = await this.client.makeRequest({ key, method: "head", storeName: this.name });
|
|
830
|
+
if (res.status === 404) {
|
|
831
|
+
return null;
|
|
832
|
+
}
|
|
833
|
+
if (res.status !== 200 && res.status !== 304) {
|
|
834
|
+
throw new BlobsInternalError(res.status);
|
|
835
|
+
}
|
|
836
|
+
const etag = res?.headers.get("etag") ?? void 0;
|
|
837
|
+
const metadata = getMetadataFromResponse(res);
|
|
838
|
+
const result = {
|
|
839
|
+
etag,
|
|
840
|
+
metadata
|
|
841
|
+
};
|
|
842
|
+
return result;
|
|
843
|
+
}
|
|
844
|
+
async getWithMetadata(key, options) {
|
|
845
|
+
const { etag: requestETag, type } = options ?? {};
|
|
846
|
+
const headers = requestETag ? { "if-none-match": requestETag } : void 0;
|
|
847
|
+
const res = await this.client.makeRequest({ headers, key, method: "get", storeName: this.name });
|
|
848
|
+
if (res.status === 404) {
|
|
849
|
+
return null;
|
|
850
|
+
}
|
|
851
|
+
if (res.status !== 200 && res.status !== 304) {
|
|
852
|
+
throw new BlobsInternalError(res.status);
|
|
853
|
+
}
|
|
854
|
+
const responseETag = res?.headers.get("etag") ?? void 0;
|
|
855
|
+
const metadata = getMetadataFromResponse(res);
|
|
856
|
+
const result = {
|
|
857
|
+
etag: responseETag,
|
|
858
|
+
metadata
|
|
859
|
+
};
|
|
860
|
+
if (res.status === 304 && requestETag) {
|
|
861
|
+
return { data: null, ...result };
|
|
862
|
+
}
|
|
863
|
+
if (type === void 0 || type === "text") {
|
|
864
|
+
return { data: await res.text(), ...result };
|
|
865
|
+
}
|
|
866
|
+
if (type === "arrayBuffer") {
|
|
867
|
+
return { data: await res.arrayBuffer(), ...result };
|
|
868
|
+
}
|
|
869
|
+
if (type === "blob") {
|
|
870
|
+
return { data: await res.blob(), ...result };
|
|
871
|
+
}
|
|
872
|
+
if (type === "json") {
|
|
873
|
+
return { data: await res.json(), ...result };
|
|
874
|
+
}
|
|
875
|
+
if (type === "stream") {
|
|
876
|
+
return { data: res.body, ...result };
|
|
877
|
+
}
|
|
878
|
+
throw new Error(`Invalid 'type' property: ${type}. Expected: arrayBuffer, blob, json, stream, or text.`);
|
|
879
|
+
}
|
|
880
|
+
list(options = {}) {
|
|
881
|
+
const iterator = this.getListIterator(options);
|
|
882
|
+
if (options.paginate) {
|
|
883
|
+
return iterator;
|
|
884
|
+
}
|
|
885
|
+
return collectIterator(iterator).then(
|
|
886
|
+
(items) => items.reduce(
|
|
887
|
+
(acc, item) => ({
|
|
888
|
+
blobs: [...acc.blobs, ...item.blobs],
|
|
889
|
+
directories: [...acc.directories, ...item.directories]
|
|
890
|
+
}),
|
|
891
|
+
{ blobs: [], directories: [] }
|
|
892
|
+
)
|
|
893
|
+
);
|
|
894
|
+
}
|
|
895
|
+
async set(key, data, { metadata } = {}) {
|
|
896
|
+
_Store.validateKey(key);
|
|
897
|
+
const res = await this.client.makeRequest({
|
|
898
|
+
body: data,
|
|
899
|
+
key,
|
|
900
|
+
metadata,
|
|
901
|
+
method: "put",
|
|
902
|
+
storeName: this.name
|
|
903
|
+
});
|
|
904
|
+
if (res.status !== 200) {
|
|
905
|
+
throw new BlobsInternalError(res.status);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
async setJSON(key, data, { metadata } = {}) {
|
|
909
|
+
_Store.validateKey(key);
|
|
910
|
+
const payload = JSON.stringify(data);
|
|
911
|
+
const headers = {
|
|
912
|
+
"content-type": "application/json"
|
|
913
|
+
};
|
|
914
|
+
const res = await this.client.makeRequest({
|
|
915
|
+
body: payload,
|
|
916
|
+
headers,
|
|
917
|
+
key,
|
|
918
|
+
metadata,
|
|
919
|
+
method: "put",
|
|
920
|
+
storeName: this.name
|
|
921
|
+
});
|
|
922
|
+
if (res.status !== 200) {
|
|
923
|
+
throw new BlobsInternalError(res.status);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
static formatListResultBlob(result) {
|
|
927
|
+
if (!result.key) {
|
|
928
|
+
return null;
|
|
929
|
+
}
|
|
930
|
+
return {
|
|
931
|
+
etag: result.etag,
|
|
932
|
+
key: result.key
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
static validateKey(key) {
|
|
936
|
+
if (key.startsWith("/") || key.startsWith("%2F")) {
|
|
937
|
+
throw new Error("Blob key must not start with forward slash (/).");
|
|
938
|
+
}
|
|
939
|
+
if (import_buffer3.Buffer.byteLength(key, "utf8") > 600) {
|
|
940
|
+
throw new Error(
|
|
941
|
+
"Blob key must be a sequence of Unicode characters whose UTF-8 encoding is at most 600 bytes long."
|
|
942
|
+
);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
static validateDeployID(deployID) {
|
|
946
|
+
if (!/^\w{1,24}$/.test(deployID)) {
|
|
947
|
+
throw new Error(`'${deployID}' is not a valid Netlify deploy ID.`);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
static validateStoreName(name) {
|
|
951
|
+
if (name.startsWith("deploy:") || name.startsWith("deploy%3A1")) {
|
|
952
|
+
throw new Error("Store name must not start with the `deploy:` reserved keyword.");
|
|
953
|
+
}
|
|
954
|
+
if (name.includes("/") || name.includes("%2F")) {
|
|
955
|
+
throw new Error("Store name must not contain forward slashes (/).");
|
|
956
|
+
}
|
|
957
|
+
if (import_buffer3.Buffer.byteLength(name, "utf8") > 64) {
|
|
958
|
+
throw new Error(
|
|
959
|
+
"Store name must be a sequence of Unicode characters whose UTF-8 encoding is at most 64 bytes long."
|
|
960
|
+
);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
getListIterator(options) {
|
|
964
|
+
const { client, name: storeName } = this;
|
|
965
|
+
const parameters = {};
|
|
966
|
+
if (options?.prefix) {
|
|
967
|
+
parameters.prefix = options.prefix;
|
|
968
|
+
}
|
|
969
|
+
if (options?.directories) {
|
|
970
|
+
parameters.directories = "true";
|
|
971
|
+
}
|
|
972
|
+
return {
|
|
973
|
+
[Symbol.asyncIterator]() {
|
|
974
|
+
let currentCursor = null;
|
|
975
|
+
let done = false;
|
|
976
|
+
return {
|
|
977
|
+
async next() {
|
|
978
|
+
if (done) {
|
|
979
|
+
return { done: true, value: void 0 };
|
|
980
|
+
}
|
|
981
|
+
const nextParameters = { ...parameters };
|
|
982
|
+
if (currentCursor !== null) {
|
|
983
|
+
nextParameters.cursor = currentCursor;
|
|
984
|
+
}
|
|
985
|
+
const res = await client.makeRequest({
|
|
986
|
+
method: "get",
|
|
987
|
+
parameters: nextParameters,
|
|
988
|
+
storeName
|
|
989
|
+
});
|
|
990
|
+
const page = await res.json();
|
|
991
|
+
if (page.next_cursor) {
|
|
992
|
+
currentCursor = page.next_cursor;
|
|
993
|
+
} else {
|
|
994
|
+
done = true;
|
|
995
|
+
}
|
|
996
|
+
const blobs = (page.blobs ?? []).map(_Store.formatListResultBlob).filter(Boolean);
|
|
997
|
+
return {
|
|
998
|
+
done: false,
|
|
999
|
+
value: {
|
|
1000
|
+
blobs,
|
|
1001
|
+
directories: page.directories ?? []
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
var getDeployStore = (options = {}) => {
|
|
1011
|
+
const context = getEnvironmentContext();
|
|
1012
|
+
const deployID = options.deployID ?? context.deployID;
|
|
1013
|
+
if (!deployID) {
|
|
1014
|
+
throw new MissingBlobsEnvironmentError(["deployID"]);
|
|
1015
|
+
}
|
|
1016
|
+
const clientOptions = getClientOptions(options, context);
|
|
1017
|
+
const client = new Client(clientOptions);
|
|
1018
|
+
return new Store({ client, deployID });
|
|
1019
|
+
};
|
|
1020
|
+
|
|
1021
|
+
// src/run/next.cts
|
|
1022
|
+
var import_fs_monkey = __toESM(require_lib());
|
|
1023
|
+
async function getMockedRequestHandlers(...args) {
|
|
1024
|
+
const store = getDeployStore();
|
|
1025
|
+
const ofs = { ...import_promises.default };
|
|
1026
|
+
async function readFileFallbackBlobStore(...fsargs) {
|
|
1027
|
+
const [path, options] = fsargs;
|
|
1028
|
+
try {
|
|
1029
|
+
return await ofs.readFile(path, options);
|
|
1030
|
+
} catch (error) {
|
|
1031
|
+
if (typeof path === "string" && path.endsWith(".html")) {
|
|
1032
|
+
const relPath = (0, import_path.relative)((0, import_path.resolve)(".next/server/pages"), path);
|
|
1033
|
+
const blobKey = import_node_buffer.Buffer.from(relPath).toString("base64");
|
|
1034
|
+
const file = await store.get(blobKey);
|
|
1035
|
+
if (file !== null) {
|
|
1036
|
+
return file;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
throw error;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
(0, import_fs_monkey.patchFs)(
|
|
1043
|
+
{
|
|
1044
|
+
readFile: readFileFallbackBlobStore
|
|
1045
|
+
},
|
|
1046
|
+
// eslint-disable-next-line n/global-require
|
|
1047
|
+
require("fs").promises
|
|
1048
|
+
);
|
|
1049
|
+
const { getRequestHandlers } = await import("next/dist/server/lib/start-server.js");
|
|
1050
|
+
return getRequestHandlers(...args);
|
|
1051
|
+
}
|
|
1052
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1053
|
+
0 && (module.exports = {
|
|
1054
|
+
getMockedRequestHandlers
|
|
1055
|
+
});
|