@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,13 @@
|
|
|
1
|
+
|
|
2
|
+
const require = await (async () => {
|
|
3
|
+
const { createRequire } = await import("node:module");
|
|
4
|
+
return createRequire(import.meta.url);
|
|
5
|
+
})();
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
nextResponseProxy
|
|
9
|
+
} from "../esm-chunks/chunk-B6QMRLBH.js";
|
|
10
|
+
import "../esm-chunks/chunk-RSKIKBZH.js";
|
|
11
|
+
export {
|
|
12
|
+
nextResponseProxy
|
|
13
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Edge runtime
|
|
2
|
+
|
|
3
|
+
This directory contains the logic required to create Netlify Edge Functions to support a Next.js
|
|
4
|
+
site.
|
|
5
|
+
|
|
6
|
+
It stands out from the rest of the project because it contains files that run in Deno, not Node.js.
|
|
7
|
+
Therefore any files within `edge-runtime/` should not be imported from anywhere outside this
|
|
8
|
+
directory.
|
|
9
|
+
|
|
10
|
+
There are a few sub-directories you should know about.
|
|
11
|
+
|
|
12
|
+
## `lib/`
|
|
13
|
+
|
|
14
|
+
Files that are imported by the generated edge functions.
|
|
15
|
+
|
|
16
|
+
## `shim/`
|
|
17
|
+
|
|
18
|
+
Files that are inlined in the generated edge functions. This means that _you must not import these
|
|
19
|
+
files_ from anywhere in the application, because they contain just fragments of a valid program.
|
|
20
|
+
|
|
21
|
+
## `vendor/`
|
|
22
|
+
|
|
23
|
+
Third-party dependencies used in the generated edge functions and pulled in ahead of time to avoid a
|
|
24
|
+
build time dependency on any package registry.
|
|
25
|
+
|
|
26
|
+
This directory is automatically managed by the build script and can be re-generated by running
|
|
27
|
+
`npm run build`.
|
|
28
|
+
|
|
29
|
+
You should not commit this directory to version control.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Next 13 supports request header mutations and has the side effect of prepending header values with 'x-middleware-request'
|
|
2
|
+
// as part of invoking NextResponse.next() in the middleware. We need to remove that before sending the response the user
|
|
3
|
+
// as the code that removes it in Next isn't run based on how we handle the middleware
|
|
4
|
+
//
|
|
5
|
+
// Related Next.js code:
|
|
6
|
+
// * https://github.com/vercel/next.js/blob/68d06fe015b28d8f81da52ca107a5f4bd72ab37c/packages/next/server/next-server.ts#L1918-L1928
|
|
7
|
+
// * https://github.com/vercel/next.js/blob/43c9d8940dc42337dd2f7d66aa90e6abf952278e/packages/next/server/web/spec-extension/response.ts#L10-L27
|
|
8
|
+
export function updateModifiedHeaders(requestHeaders: Headers, responseHeaders: Headers) {
|
|
9
|
+
const overriddenHeaders = responseHeaders.get('x-middleware-override-headers')
|
|
10
|
+
|
|
11
|
+
if (!overriddenHeaders) {
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const headersToUpdate = overriddenHeaders.split(',').map((header) => header.trim())
|
|
16
|
+
|
|
17
|
+
for (const header of headersToUpdate) {
|
|
18
|
+
const oldHeaderKey = 'x-middleware-request-' + header
|
|
19
|
+
const headerValue = responseHeaders.get(oldHeaderKey) || ''
|
|
20
|
+
|
|
21
|
+
requestHeaders.set(header, headerValue)
|
|
22
|
+
responseHeaders.delete(oldHeaderKey)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
responseHeaders.delete('x-middleware-override-headers')
|
|
26
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Context } from '@netlify/edge-functions'
|
|
2
|
+
|
|
3
|
+
import { ElementHandlers } from '../vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/index.ts'
|
|
4
|
+
|
|
5
|
+
type NextDataTransform = <T>(data: T) => T
|
|
6
|
+
|
|
7
|
+
interface ResponseCookies {
|
|
8
|
+
// This is non-standard that Next.js adds.
|
|
9
|
+
// https://github.com/vercel/next.js/blob/de08f8b3d31ef45131dad97a7d0e95fa01001167/packages/next/src/compiled/@edge-runtime/cookies/index.js#L158
|
|
10
|
+
readonly _headers: Headers
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface MiddlewareResponse extends Response {
|
|
14
|
+
originResponse: Response
|
|
15
|
+
dataTransforms: NextDataTransform[]
|
|
16
|
+
elementHandlers: Array<[selector: string, handlers: ElementHandlers]>
|
|
17
|
+
get cookies(): ResponseCookies
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface MiddlewareRequest {
|
|
21
|
+
request: Request
|
|
22
|
+
context: Context
|
|
23
|
+
originalRequest: Request
|
|
24
|
+
next(): Promise<MiddlewareResponse>
|
|
25
|
+
rewrite(destination: string | URL, init?: ResponseInit): Response
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function isMiddlewareRequest(
|
|
29
|
+
response: Response | MiddlewareRequest,
|
|
30
|
+
): response is MiddlewareRequest {
|
|
31
|
+
return 'originalRequest' in response
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function isMiddlewareResponse(
|
|
35
|
+
response: Response | MiddlewareResponse,
|
|
36
|
+
): response is MiddlewareResponse {
|
|
37
|
+
return 'dataTransforms' in response
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const addMiddlewareHeaders = async (
|
|
41
|
+
originResponse: Promise<Response> | Response,
|
|
42
|
+
middlewareResponse: Response,
|
|
43
|
+
) => {
|
|
44
|
+
// If there are extra headers, we need to add them to the response.
|
|
45
|
+
if ([...middlewareResponse.headers.keys()].length === 0) {
|
|
46
|
+
return originResponse
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// We need to await the response to get the origin headers, then we can add the ones from middleware.
|
|
50
|
+
const res = await originResponse
|
|
51
|
+
const response = new Response(res.body, res)
|
|
52
|
+
middlewareResponse.headers.forEach((value, key) => {
|
|
53
|
+
if (key === 'set-cookie') {
|
|
54
|
+
response.headers.append(key, value)
|
|
55
|
+
} else {
|
|
56
|
+
response.headers.set(key, value)
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
return response
|
|
60
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Context } from '@netlify/edge-functions'
|
|
2
|
+
|
|
3
|
+
interface I18NConfig {
|
|
4
|
+
defaultLocale: string
|
|
5
|
+
localeDetection?: false
|
|
6
|
+
locales: string[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface RequestData {
|
|
10
|
+
geo?: {
|
|
11
|
+
city?: string
|
|
12
|
+
country?: string
|
|
13
|
+
region?: string
|
|
14
|
+
latitude?: string
|
|
15
|
+
longitude?: string
|
|
16
|
+
timezone?: string
|
|
17
|
+
}
|
|
18
|
+
headers: Record<string, string>
|
|
19
|
+
ip?: string
|
|
20
|
+
method: string
|
|
21
|
+
nextConfig?: {
|
|
22
|
+
basePath?: string
|
|
23
|
+
i18n?: I18NConfig | null
|
|
24
|
+
trailingSlash?: boolean
|
|
25
|
+
}
|
|
26
|
+
page?: {
|
|
27
|
+
name?: string
|
|
28
|
+
params?: { [key: string]: string }
|
|
29
|
+
}
|
|
30
|
+
url: string
|
|
31
|
+
body?: ReadableStream<Uint8Array>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const buildNextRequest = (
|
|
35
|
+
request: Request,
|
|
36
|
+
context: Context,
|
|
37
|
+
nextConfig?: RequestData['nextConfig'],
|
|
38
|
+
): RequestData => {
|
|
39
|
+
const { url, method, body, headers } = request
|
|
40
|
+
const { country, subdivision, city, latitude, longitude, timezone } = context.geo
|
|
41
|
+
const geo: RequestData['geo'] = {
|
|
42
|
+
country: country?.code,
|
|
43
|
+
region: subdivision?.code,
|
|
44
|
+
city,
|
|
45
|
+
latitude: latitude?.toString(),
|
|
46
|
+
longitude: longitude?.toString(),
|
|
47
|
+
timezone,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
headers: Object.fromEntries(headers.entries()),
|
|
52
|
+
geo,
|
|
53
|
+
url,
|
|
54
|
+
method,
|
|
55
|
+
ip: context.ip,
|
|
56
|
+
body: body ?? undefined,
|
|
57
|
+
nextConfig,
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { Context } from '@netlify/edge-functions'
|
|
2
|
+
import { HTMLRewriter } from '../vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/index.ts'
|
|
3
|
+
|
|
4
|
+
import { updateModifiedHeaders } from './headers.ts'
|
|
5
|
+
import { normalizeDataUrl, relativizeURL } from './util.ts'
|
|
6
|
+
import { addMiddlewareHeaders, isMiddlewareRequest, isMiddlewareResponse } from './middleware.ts'
|
|
7
|
+
|
|
8
|
+
export interface FetchEventResult {
|
|
9
|
+
response: Response
|
|
10
|
+
waitUntil: Promise<any>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const buildResponse = async ({
|
|
14
|
+
result,
|
|
15
|
+
request,
|
|
16
|
+
context,
|
|
17
|
+
}: {
|
|
18
|
+
result: FetchEventResult
|
|
19
|
+
request: Request
|
|
20
|
+
context: Context
|
|
21
|
+
}) => {
|
|
22
|
+
updateModifiedHeaders(request.headers, result.response.headers)
|
|
23
|
+
|
|
24
|
+
// They've returned the MiddlewareRequest directly, so we'll call `next()` for them.
|
|
25
|
+
if (isMiddlewareRequest(result.response)) {
|
|
26
|
+
result.response = await result.response.next()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (isMiddlewareResponse(result.response)) {
|
|
30
|
+
const { response } = result
|
|
31
|
+
if (request.method === 'HEAD' || request.method === 'OPTIONS') {
|
|
32
|
+
return response.originResponse
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// NextResponse doesn't set cookies onto the originResponse, so we need to copy them over
|
|
36
|
+
// In some cases, it's possible there are no headers set. See https://github.com/netlify/pod-ecosystem-frameworks/issues/475
|
|
37
|
+
if (response.cookies._headers?.has('set-cookie')) {
|
|
38
|
+
response.originResponse.headers.set(
|
|
39
|
+
'set-cookie',
|
|
40
|
+
response.cookies._headers.get('set-cookie')!,
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// If it's JSON we don't need to use the rewriter, we can just parse it
|
|
45
|
+
if (response.originResponse.headers.get('content-type')?.includes('application/json')) {
|
|
46
|
+
const props = await response.originResponse.json()
|
|
47
|
+
const transformed = response.dataTransforms.reduce((prev, transform) => {
|
|
48
|
+
return transform(prev)
|
|
49
|
+
}, props)
|
|
50
|
+
const body = JSON.stringify(transformed)
|
|
51
|
+
const headers = new Headers(response.headers)
|
|
52
|
+
headers.set('content-length', String(body.length))
|
|
53
|
+
|
|
54
|
+
return Response.json(transformed, { ...response, headers })
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// This var will hold the contents of the script tag
|
|
58
|
+
let buffer = ''
|
|
59
|
+
// Create an HTMLRewriter that matches the Next data script tag
|
|
60
|
+
const rewriter = new HTMLRewriter()
|
|
61
|
+
|
|
62
|
+
if (response.dataTransforms.length > 0) {
|
|
63
|
+
rewriter.on('script[id="__NEXT_DATA__"]', {
|
|
64
|
+
text(textChunk) {
|
|
65
|
+
// Grab all the chunks in the Next data script tag
|
|
66
|
+
buffer += textChunk.text
|
|
67
|
+
if (textChunk.lastInTextNode) {
|
|
68
|
+
try {
|
|
69
|
+
// When we have all the data, try to parse it as JSON
|
|
70
|
+
const data = JSON.parse(buffer.trim())
|
|
71
|
+
// Apply all of the transforms to the props
|
|
72
|
+
const props = response.dataTransforms.reduce(
|
|
73
|
+
(prev, transform) => transform(prev),
|
|
74
|
+
data.props,
|
|
75
|
+
)
|
|
76
|
+
// Replace the data with the transformed props
|
|
77
|
+
// With `html: true` the input is treated as raw HTML
|
|
78
|
+
// @see https://developers.cloudflare.com/workers/runtime-apis/html-rewriter/#global-types
|
|
79
|
+
textChunk.replace(JSON.stringify({ ...data, props }), { html: true })
|
|
80
|
+
} catch (err) {
|
|
81
|
+
console.log('Could not parse', err)
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
// Remove the chunk after we've appended it to the buffer
|
|
85
|
+
textChunk.remove()
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (response.elementHandlers.length > 0) {
|
|
92
|
+
response.elementHandlers.forEach(([selector, handlers]) => rewriter.on(selector, handlers))
|
|
93
|
+
}
|
|
94
|
+
return rewriter.transform(response.originResponse)
|
|
95
|
+
}
|
|
96
|
+
const res = new Response(result.response.body, result.response)
|
|
97
|
+
request.headers.set('x-nf-next-middleware', 'skip')
|
|
98
|
+
|
|
99
|
+
const rewrite = res.headers.get('x-middleware-rewrite')
|
|
100
|
+
|
|
101
|
+
// Data requests (i.e. requests for /_next/data ) need special handling
|
|
102
|
+
const isDataReq = request.headers.get('x-nextjs-data')
|
|
103
|
+
|
|
104
|
+
if (rewrite) {
|
|
105
|
+
const rewriteUrl = new URL(rewrite, request.url)
|
|
106
|
+
const baseUrl = new URL(request.url)
|
|
107
|
+
const relativeUrl = relativizeURL(rewrite, request.url)
|
|
108
|
+
|
|
109
|
+
// Data requests might be rewritten to an external URL
|
|
110
|
+
// This header tells the client router the redirect target, and if it's external then it will do a full navigation
|
|
111
|
+
if (isDataReq) {
|
|
112
|
+
res.headers.set('x-nextjs-rewrite', relativeUrl)
|
|
113
|
+
}
|
|
114
|
+
if (rewriteUrl.origin !== baseUrl.origin) {
|
|
115
|
+
// Netlify Edge Functions don't support proxying to external domains, but Next middleware does
|
|
116
|
+
const proxied = fetch(new Request(rewriteUrl.toString(), request))
|
|
117
|
+
return addMiddlewareHeaders(proxied, res)
|
|
118
|
+
}
|
|
119
|
+
res.headers.set('x-middleware-rewrite', relativeUrl)
|
|
120
|
+
|
|
121
|
+
request.headers.set('x-original-path', new URL(request.url, `http://n`).pathname)
|
|
122
|
+
request.headers.set('x-middleware-rewrite', rewrite)
|
|
123
|
+
|
|
124
|
+
return addMiddlewareHeaders(context.rewrite(rewrite), res)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const redirect = res.headers.get('Location')
|
|
128
|
+
|
|
129
|
+
// Data requests shouldn't automatically redirect in the browser (they might be HTML pages): they're handled by the router
|
|
130
|
+
if (redirect && isDataReq) {
|
|
131
|
+
res.headers.delete('location')
|
|
132
|
+
res.headers.set('x-nextjs-redirect', relativizeURL(redirect, request.url))
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const nextRedirect = res.headers.get('x-nextjs-redirect')
|
|
136
|
+
|
|
137
|
+
if (nextRedirect && isDataReq) {
|
|
138
|
+
res.headers.set('x-nextjs-redirect', normalizeDataUrl(nextRedirect))
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (res.headers.get('x-middleware-next') === '1') {
|
|
142
|
+
return addMiddlewareHeaders(context.next(), res)
|
|
143
|
+
}
|
|
144
|
+
return res
|
|
145
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// If the redirect is a data URL, we need to normalize it.
|
|
2
|
+
// https://github.com/vercel/next.js/blob/25e0988e7c9033cb1503cbe0c62ba5de2e97849c/packages/next/src/shared/lib/router/utils/get-next-pathname-info.ts#L69-L76
|
|
3
|
+
export function normalizeDataUrl(redirect: string) {
|
|
4
|
+
if (redirect.startsWith('/_next/data/') && redirect.includes('.json')) {
|
|
5
|
+
const paths = redirect
|
|
6
|
+
.replace(/^\/_next\/data\//, '')
|
|
7
|
+
.replace(/\.json/, '')
|
|
8
|
+
.split('/')
|
|
9
|
+
|
|
10
|
+
redirect = paths[1] !== 'index' ? `/${paths.slice(1).join('/')}` : '/'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return redirect
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This is how Next handles rewritten URLs.
|
|
18
|
+
*/
|
|
19
|
+
export function relativizeURL(url: string | string, base: string | URL) {
|
|
20
|
+
const baseURL = typeof base === 'string' ? new URL(base) : base
|
|
21
|
+
const relative = new URL(url, base)
|
|
22
|
+
const origin = `${baseURL.protocol}//${baseURL.host}`
|
|
23
|
+
return `${relative.protocol}//${relative.host}` === origin
|
|
24
|
+
? relative.toString().replace(origin, '')
|
|
25
|
+
: relative.toString()
|
|
26
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Context } from '@netlify/edge-functions'
|
|
2
|
+
|
|
3
|
+
import { buildNextRequest, RequestData } from './lib/next-request.ts'
|
|
4
|
+
import { buildResponse } from './lib/response.ts'
|
|
5
|
+
import { FetchEventResult } from './lib/response.ts'
|
|
6
|
+
|
|
7
|
+
type NextHandler = (params: { request: RequestData }) => Promise<FetchEventResult>
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Runs a Next.js middleware as a Netlify Edge Function. It translates a web
|
|
11
|
+
* platform Request into a NextRequest instance on the way in, and translates
|
|
12
|
+
* a NextResponse into a web platform Response on the way out.
|
|
13
|
+
*
|
|
14
|
+
* @param request Incoming request
|
|
15
|
+
* @param context Netlify-specific context object
|
|
16
|
+
* @param nextHandler Next.js middleware handler
|
|
17
|
+
*/
|
|
18
|
+
export async function handleMiddleware(
|
|
19
|
+
request: Request,
|
|
20
|
+
context: Context,
|
|
21
|
+
nextHandler: NextHandler,
|
|
22
|
+
) {
|
|
23
|
+
// Don't run in dev
|
|
24
|
+
if (Netlify.env.has('NETLIFY_DEV')) {
|
|
25
|
+
return
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const nextRequest = buildNextRequest(request, context)
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
const result = await nextHandler({ request: nextRequest })
|
|
32
|
+
const response = await buildResponse({ result, request: request, context })
|
|
33
|
+
|
|
34
|
+
return response
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error(error)
|
|
37
|
+
|
|
38
|
+
return new Response(error.message, { status: 500 })
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// NOTE: This is a fragment of a JavaScript program that will be inlined with
|
|
2
|
+
// a Webpack bundle. You should not import this file from anywhere in the
|
|
3
|
+
// application.
|
|
4
|
+
import { AsyncLocalStorage } from 'node:async_hooks'
|
|
5
|
+
|
|
6
|
+
globalThis.AsyncLocalStorage = AsyncLocalStorage
|
|
7
|
+
|
|
8
|
+
var _ENTRIES = {}
|
package/{src/templates → edge-runtime}/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/index.ts
RENAMED
|
@@ -53,7 +53,7 @@ export class HTMLRewriter {
|
|
|
53
53
|
constructor() {
|
|
54
54
|
if (!initialized.settled && !executing) {
|
|
55
55
|
executing = true;
|
|
56
|
-
fetch("
|
|
56
|
+
fetch(new URL("./vendor/html_rewriter_bg.wasm", import.meta.url).href)
|
|
57
57
|
.then(r => r.ok ? r : (() => { throw Error('WASM response not ok') })())
|
|
58
58
|
.then(toWASMResponse)
|
|
59
59
|
.then(initWASM)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"imports": {
|
|
3
|
+
"https://ghuc.cc/worker-tools/resolvable-promise/index.ts": "./raw.githubusercontent.com/worker-tools/resolvable-promise/master/index.ts",
|
|
4
|
+
"https://deno.land/": "./deno.land/",
|
|
5
|
+
"https://esm.sh/": "./esm.sh/",
|
|
6
|
+
"https://raw.githubusercontent.com/": "./raw.githubusercontent.com/"
|
|
7
|
+
},
|
|
8
|
+
"scopes": {
|
|
9
|
+
"./esm.sh/": {
|
|
10
|
+
"/v91/next@12.2.5/deno/dist/compiled/cookie.js": "./esm.sh/v91/next@12.2.5/deno/dist/compiled/cookie.js"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// NOTE: This file contains a list of the third-party Deno dependencies we use.
|
|
2
|
+
// It acts as a seed that populates the `vendor/` directory and should not be
|
|
3
|
+
// imported directly.
|
|
4
|
+
|
|
5
|
+
import 'https://deno.land/std@0.175.0/encoding/base64.ts'
|
|
6
|
+
import 'https://deno.land/std@0.175.0/http/cookie.ts'
|
|
7
|
+
import 'https://deno.land/std@0.175.0/node/buffer.ts'
|
|
8
|
+
import 'https://deno.land/std@0.175.0/node/events.ts'
|
|
9
|
+
import 'https://deno.land/std@0.175.0/node/async_hooks.ts'
|
|
10
|
+
import 'https://deno.land/std@0.175.0/node/assert.ts'
|
|
11
|
+
import 'https://deno.land/std@0.175.0/node/util.ts'
|
|
12
|
+
import 'https://deno.land/std@0.175.0/path/mod.ts'
|
|
13
|
+
|
|
14
|
+
import 'https://deno.land/x/path_to_regexp@v6.2.1/index.ts'
|
|
15
|
+
import 'https://deno.land/x/html_rewriter@v0.1.0-pre.17/index.ts'
|
|
16
|
+
|
|
17
|
+
import 'https://esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js'
|
|
18
|
+
import 'https://esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/response.js'
|
package/manifest.yml
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
name: netlify-
|
|
1
|
+
name: '@netlify/plugin-nextjs'
|
package/package.json
CHANGED
|
@@ -1,75 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/plugin-nextjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-beta.0",
|
|
4
4
|
"description": "Run Next.js seamlessly on Netlify",
|
|
5
|
-
"main": "index.js",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"files": [
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"src/templates/edge-shared/*",
|
|
10
|
-
"src/templates/vendor/*",
|
|
11
|
-
"index.js",
|
|
8
|
+
"dist",
|
|
9
|
+
"edge-runtime",
|
|
12
10
|
"manifest.yml"
|
|
13
11
|
],
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"@netlify/esbuild": "0.14.39",
|
|
17
|
-
"@netlify/functions": "^1.6.0",
|
|
18
|
-
"@netlify/ipx": "^1.4.6",
|
|
19
|
-
"@vercel/node-bridge": "^2.1.0",
|
|
20
|
-
"chalk": "^4.1.2",
|
|
21
|
-
"chokidar": "^3.5.3",
|
|
22
|
-
"destr": "^1.1.1",
|
|
23
|
-
"execa": "^5.1.1",
|
|
24
|
-
"follow-redirects": "^1.15.2",
|
|
25
|
-
"fs-extra": "^10.0.0",
|
|
26
|
-
"globby": "^11.0.4",
|
|
27
|
-
"merge-stream": "^2.0.0",
|
|
28
|
-
"moize": "^6.1.0",
|
|
29
|
-
"node-fetch": "^2.6.6",
|
|
30
|
-
"node-stream-zip": "^1.15.0",
|
|
31
|
-
"outdent": "^0.8.0",
|
|
32
|
-
"p-limit": "^3.1.0",
|
|
33
|
-
"pathe": "^0.3.0",
|
|
34
|
-
"pretty-bytes": "^5.6.0",
|
|
35
|
-
"regexp-tree": "^0.1.24",
|
|
36
|
-
"semver": "^7.3.5",
|
|
37
|
-
"slash": "^3.0.0",
|
|
38
|
-
"tiny-glob": "^0.2.9"
|
|
39
|
-
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"@delucis/if-env": "^1.1.2",
|
|
42
|
-
"@netlify/build": "^29.30.0",
|
|
43
|
-
"@types/fs-extra": "^9.0.13",
|
|
44
|
-
"@types/jest": "^27.4.1",
|
|
45
|
-
"@types/merge-stream": "^1.1.2",
|
|
46
|
-
"@types/node": "^17.0.25",
|
|
47
|
-
"next": "^13.4.1",
|
|
48
|
-
"npm-run-all": "^4.1.5",
|
|
49
|
-
"typescript": "^4.6.3"
|
|
50
|
-
},
|
|
51
|
-
"scripts": {
|
|
52
|
-
"prepublishOnly": "run-s clean build",
|
|
53
|
-
"publish:pull": "git pull",
|
|
54
|
-
"publish:install": "npm ci",
|
|
55
|
-
"publish:test": "cd .. && npm ci && npm test",
|
|
56
|
-
"clean": "rimraf lib dist-types",
|
|
57
|
-
"build": "run-s build:*",
|
|
58
|
-
"build:vendor": "rimraf src/templates/vendor && deno vendor src/templates/vendor.ts --output=src/templates/vendor && node patch-import-map.mjs && patch src/templates/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/index.ts html_rewriter.patch",
|
|
59
|
-
"build:tsc": "tsc",
|
|
60
|
-
"watch": "tsc --watch",
|
|
61
|
-
"prepare": "npm run build"
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=18.0.0"
|
|
62
14
|
},
|
|
63
15
|
"repository": {
|
|
64
16
|
"type": "git",
|
|
65
|
-
"url": "git+https://github.com/netlify/next-runtime.git"
|
|
17
|
+
"url": "git+https://github.com/netlify/next-runtime-minimal.git"
|
|
66
18
|
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"nextjs",
|
|
21
|
+
"netlify",
|
|
22
|
+
"next",
|
|
23
|
+
"netlify-runtime"
|
|
24
|
+
],
|
|
67
25
|
"license": "MIT",
|
|
68
26
|
"bugs": {
|
|
69
|
-
"url": "https://github.com/netlify/next-runtime/issues"
|
|
27
|
+
"url": "https://github.com/netlify/next-runtime-minimal/issues"
|
|
70
28
|
},
|
|
71
|
-
"homepage": "https://github.com/netlify/next-runtime#readme",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
29
|
+
"homepage": "https://github.com/netlify/next-runtime-minimal#readme",
|
|
30
|
+
"clean-package": {
|
|
31
|
+
"indent": 2,
|
|
32
|
+
"remove": [
|
|
33
|
+
"dependencies",
|
|
34
|
+
"devDependencies",
|
|
35
|
+
"scripts"
|
|
36
|
+
]
|
|
74
37
|
}
|
|
75
38
|
}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./lib')
|
package/lib/constants.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DIVIDER = exports.LAMBDA_MAX_SIZE = exports.LAMBDA_WARNING_SIZE = exports.MINIMUM_REVALIDATE_SECONDS = exports.DYNAMIC_PARAMETER_REGEX = exports.OPTIONAL_CATCH_ALL_REGEX = exports.CATCH_ALL_REGEX = exports.DEFAULT_FUNCTIONS_SRC = exports.HANDLER_FUNCTION_PATH = exports.ODB_FUNCTION_PATH = exports.HIDDEN_PATHS = exports.IMAGE_FUNCTION_TITLE = exports.API_FUNCTION_TITLE = exports.ODB_FUNCTION_TITLE = exports.HANDLER_FUNCTION_TITLE = exports.NEXT_PLUGIN = exports.NEXT_PLUGIN_NAME = exports.IMAGE_FUNCTION_NAME = exports.API_FUNCTION_NAME = exports.ODB_FUNCTION_NAME = exports.HANDLER_FUNCTION_NAME = void 0;
|
|
7
|
-
const destr_1 = __importDefault(require("destr"));
|
|
8
|
-
exports.HANDLER_FUNCTION_NAME = '___netlify-handler';
|
|
9
|
-
exports.ODB_FUNCTION_NAME = '___netlify-odb-handler';
|
|
10
|
-
exports.API_FUNCTION_NAME = '___netlify-api-handler';
|
|
11
|
-
exports.IMAGE_FUNCTION_NAME = '_ipx';
|
|
12
|
-
exports.NEXT_PLUGIN_NAME = '@netlify/next-runtime';
|
|
13
|
-
exports.NEXT_PLUGIN = '@netlify/plugin-nextjs';
|
|
14
|
-
exports.HANDLER_FUNCTION_TITLE = 'Next.js SSR handler';
|
|
15
|
-
exports.ODB_FUNCTION_TITLE = 'Next.js ISR handler';
|
|
16
|
-
exports.API_FUNCTION_TITLE = 'Next.js API handler';
|
|
17
|
-
exports.IMAGE_FUNCTION_TITLE = 'next/image handler';
|
|
18
|
-
// These are paths in .next that shouldn't be publicly accessible
|
|
19
|
-
exports.HIDDEN_PATHS = (0, destr_1.default)(process.env.NEXT_KEEP_METADATA_FILES)
|
|
20
|
-
? []
|
|
21
|
-
: [
|
|
22
|
-
'/cache',
|
|
23
|
-
'/server',
|
|
24
|
-
'/serverless',
|
|
25
|
-
'/trace',
|
|
26
|
-
'/traces',
|
|
27
|
-
'/routes-manifest.json',
|
|
28
|
-
'/build-manifest.json',
|
|
29
|
-
'/prerender-manifest.json',
|
|
30
|
-
'/react-loadable-manifest.json',
|
|
31
|
-
'/BUILD_ID',
|
|
32
|
-
'/app-build-manifest.json',
|
|
33
|
-
'/app-path-routes-manifest.json',
|
|
34
|
-
'/export-marker.json',
|
|
35
|
-
'/images-manifest.json',
|
|
36
|
-
'/next-server.js.nft.json',
|
|
37
|
-
'/package.json',
|
|
38
|
-
'/prerender-manifest.js',
|
|
39
|
-
'/required-server-files.json',
|
|
40
|
-
'/static-manifest.json',
|
|
41
|
-
'/blobs-manifest.json',
|
|
42
|
-
];
|
|
43
|
-
exports.ODB_FUNCTION_PATH = `/.netlify/builders/${exports.ODB_FUNCTION_NAME}`;
|
|
44
|
-
exports.HANDLER_FUNCTION_PATH = `/.netlify/functions/${exports.HANDLER_FUNCTION_NAME}`;
|
|
45
|
-
exports.DEFAULT_FUNCTIONS_SRC = 'netlify/functions';
|
|
46
|
-
exports.CATCH_ALL_REGEX = /\/\[\.{3}(.*)](.json)?$/;
|
|
47
|
-
exports.OPTIONAL_CATCH_ALL_REGEX = /\/\[{2}\.{3}(.*)]{2}(.json)?$/;
|
|
48
|
-
exports.DYNAMIC_PARAMETER_REGEX = /\/\[(.*?)]/g;
|
|
49
|
-
exports.MINIMUM_REVALIDATE_SECONDS = 60;
|
|
50
|
-
// 50MB, which is the warning max
|
|
51
|
-
exports.LAMBDA_WARNING_SIZE = 1024 * 1024 * 50;
|
|
52
|
-
// 250MB, which is the hard max
|
|
53
|
-
exports.LAMBDA_MAX_SIZE = 1024 * 1024 * 250;
|
|
54
|
-
exports.DIVIDER = `
|
|
55
|
-
────────────────────────────────────────────────────────────────
|
|
56
|
-
`;
|