From 3f39345cb9baf82450eef7bc3aac1c4fa4023617 Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Thu, 9 Feb 2023 12:54:32 +0100 Subject: [PATCH 01/37] initial implem --- .vscode/settings.json | 26 ++++++++++++++++++- bench/vercel/benchmark-app/app/rsc/page.js | 2 ++ bench/vercel/benchmark-app/server-hooks.js | 5 ++++ packages/next/src/build/entries.ts | 13 ++++++++++ packages/next/src/build/index.ts | 11 ++++++-- packages/next/src/build/utils.ts | 8 ++++++ .../loaders/next-edge-ssr-loader/render.ts | 25 +++++++++++++++--- packages/next/src/lib/constants.ts | 4 +++ packages/next/src/lib/flat-readdir.ts | 7 +++-- packages/next/src/server/next.ts | 21 +++++++++++++-- 10 files changed, 112 insertions(+), 10 deletions(-) create mode 100644 bench/vercel/benchmark-app/server-hooks.js diff --git a/.vscode/settings.json b/.vscode/settings.json index c98c9387e7de9..d831d8bdca835 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -57,5 +57,29 @@ "explorer.fileNesting.patterns": { "*.ts": "$(capture).test.ts, $(capture).test.tsx", "*.tsx": "$(capture).test.ts, $(capture).test.tsx" - } + }, + "workbench.colorCustomizations": { + "activityBar.activeBackground": "#2f7c47", + "activityBar.background": "#2f7c47", + "activityBar.foreground": "#e7e7e7", + "activityBar.inactiveForeground": "#e7e7e799", + "activityBarBadge.background": "#422c74", + "activityBarBadge.foreground": "#e7e7e7", + "commandCenter.border": "#e7e7e799", + "editorGroup.border": "#2f7c47", + "panel.border": "#2f7c47", + "sash.hoverBorder": "#2f7c47", + "sideBar.border": "#2f7c47", + "statusBar.background": "#215732", + "statusBar.foreground": "#e7e7e7", + "statusBarItem.hoverBackground": "#2f7c47", + "statusBarItem.remoteBackground": "#215732", + "statusBarItem.remoteForeground": "#e7e7e7", + "tab.activeBorder": "#2f7c47", + "titleBar.activeBackground": "#215732", + "titleBar.activeForeground": "#e7e7e7", + "titleBar.inactiveBackground": "#21573299", + "titleBar.inactiveForeground": "#e7e7e799" + }, + "peacock.color": "#215732" } diff --git a/bench/vercel/benchmark-app/app/rsc/page.js b/bench/vercel/benchmark-app/app/rsc/page.js index d24c366ad67a5..dd81f67de1b03 100644 --- a/bench/vercel/benchmark-app/app/rsc/page.js +++ b/bench/vercel/benchmark-app/app/rsc/page.js @@ -18,3 +18,5 @@ export default function page() { return
{previous ? 'HOT' : 'COLD'}
} + +export const runtime = 'edge' diff --git a/bench/vercel/benchmark-app/server-hooks.js b/bench/vercel/benchmark-app/server-hooks.js new file mode 100644 index 0000000000000..6dfb09c674c3c --- /dev/null +++ b/bench/vercel/benchmark-app/server-hooks.js @@ -0,0 +1,5 @@ +export function beforeNextInit() { + // This is called before the Next.js app is initialized + // and before the server is started + console.log('beforeNextInit', require.resolve('react-dom/server')) +} diff --git a/packages/next/src/build/entries.ts b/packages/next/src/build/entries.ts index 9001094864485..768866c31fa41 100644 --- a/packages/next/src/build/entries.ts +++ b/packages/next/src/build/entries.ts @@ -16,6 +16,7 @@ import { ROOT_DIR_ALIAS, APP_DIR_ALIAS, WEBPACK_LAYERS, + SERVER_HOOKS_FILENAME, } from '../lib/constants' import { isAPIRoute } from '../lib/is-api-route' import { isEdgeRuntime } from '../lib/is-edge-runtime' @@ -35,6 +36,7 @@ import { warn } from './output/log' import { isMiddlewareFile, isMiddlewareFilename, + isServerHooksFile, NestedMiddlewareError, } from './utils' import { getPageStaticInfo } from './analysis/get-page-static-info' @@ -185,6 +187,13 @@ export function getEdgeServerEntry(opts: { return `next-edge-function-loader?${stringify(loaderParams)}!` } + if (isServerHooksFile(opts.page)) { + return { + import: opts.page, + filename: `edge-${SERVER_HOOKS_FILENAME}.js`, + } + } + const loaderParams: EdgeSSRLoaderQuery = { absolute500Path: opts.pages['/500'] || '', absoluteAppPath: opts.pages['/_app'], @@ -253,6 +262,10 @@ export async function runDependingOnPageType(params: { page: string pageRuntime: ServerRuntime }): Promise { + if (isServerHooksFile(params.page)) { + await Promise.all([params.onServer(), params.onEdgeServer()]) + return + } if (isMiddlewareFile(params.page)) { await params.onEdgeServer() return diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index ae42c4010b3d9..84716515665d8 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -23,6 +23,7 @@ import { PUBLIC_DIR_MIDDLEWARE_CONFLICT, MIDDLEWARE_FILENAME, PAGES_DIR_ALIAS, + SERVER_HOOKS_FILENAME, } from '../lib/constants' import { fileExists } from '../lib/file-exists' import { findPagesDir } from '../lib/find-pages-dir' @@ -513,11 +514,17 @@ export default async function build( `^${MIDDLEWARE_FILENAME}\\.(?:${config.pageExtensions.join('|')})$` ) + const serverHooksDetectionRegExp = new RegExp( + `^${SERVER_HOOKS_FILENAME}\\.(?:${config.pageExtensions.join('|')})$` + ) + const rootDir = path.join((pagesDir || appDir)!, '..') const rootPaths = ( - await flatReaddir(rootDir, middlewareDetectionRegExp) + await flatReaddir(rootDir, [ + middlewareDetectionRegExp, + serverHooksDetectionRegExp, + ]) ).map((absoluteFile) => absoluteFile.replace(dir, '')) - // needed for static exporting since we want to replace with HTML // files diff --git a/packages/next/src/build/utils.ts b/packages/next/src/build/utils.ts index dc790b36b91d9..11c91b7006202 100644 --- a/packages/next/src/build/utils.ts +++ b/packages/next/src/build/utils.ts @@ -26,6 +26,7 @@ import { SERVER_PROPS_GET_INIT_PROPS_CONFLICT, SERVER_PROPS_SSG_CONFLICT, MIDDLEWARE_FILENAME, + SERVER_HOOKS_FILENAME, } from '../lib/constants' import { MODERN_BROWSERSLIST_TARGET } from '../shared/lib/constants' import prettyBytes from '../lib/pretty-bytes' @@ -1828,6 +1829,13 @@ export function isMiddlewareFile(file: string) { ) } +export function isServerHooksFile(file: string) { + return ( + file === `/${SERVER_HOOKS_FILENAME}` || + file === `/src/${SERVER_HOOKS_FILENAME}` + ) +} + export function getPossibleMiddlewareFilenames( folder: string, extensions: string[] diff --git a/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/render.ts b/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/render.ts index ff616c2f06af5..c2c385aaecfd6 100644 --- a/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/render.ts +++ b/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/render.ts @@ -1,4 +1,4 @@ -import type { NextConfig } from '../../../../server/config-shared' +import type { NextConfigComplete } from '../../../../server/config-shared' import type { DocumentType, AppType } from '../../../../shared/lib/utils' import type { BuildManifest } from '../../../../server/get-page-files' @@ -10,7 +10,10 @@ import { WebNextRequest, WebNextResponse, } from '../../../../server/base-http/web' -import { SERVER_RUNTIME } from '../../../../lib/constants' +import { + SERVER_HOOKS_FILENAME, + SERVER_RUNTIME, +} from '../../../../lib/constants' export function getRender({ dev, @@ -31,6 +34,7 @@ export function getRender({ config, buildId, fontLoaderManifest, + serverHooksPath, }: { pagesType: 'app' | 'pages' | 'root' dev: boolean @@ -48,9 +52,10 @@ export function getRender({ serverComponentManifest: any serverCSSManifest: any appServerMod: any - config: NextConfig + config: NextConfigComplete buildId: string fontLoaderManifest: FontLoaderManifest + serverHooksPath: string }) { const isAppPath = pagesType === 'app' const baseLoadComponentResult = { @@ -63,6 +68,20 @@ export function getRender({ App: appMod?.default as AppType, } + try { + const serverHooks = require((config.dir || '.', + config.distDir, + 'server', + `edge-${SERVER_HOOKS_FILENAME}`)) + + serverHooks.beforeNextInit?.() + } catch (err: any) { + console.error('Error loading server hooks', err) + if (err.code !== 'MODULE_NOT_FOUND') { + throw err + } + } + const server = new WebServer({ dev, conf: config, diff --git a/packages/next/src/lib/constants.ts b/packages/next/src/lib/constants.ts index 4b9e4be7cac9e..56e795dafb49e 100644 --- a/packages/next/src/lib/constants.ts +++ b/packages/next/src/lib/constants.ts @@ -4,6 +4,10 @@ import type { ServerRuntime } from '../../types' export const MIDDLEWARE_FILENAME = 'middleware' export const MIDDLEWARE_LOCATION_REGEXP = `(?:src/)?${MIDDLEWARE_FILENAME}` +// Pattern to detect server hooks file +export const SERVER_HOOKS_FILENAME = 'server-hooks' +export const SERVER_HOOKS_LOCATION_REGEXP = `(?:src/)?${SERVER_HOOKS_FILENAME}` + // Because on Windows absolute paths in the generated code can break because of numbers, eg 1 in the path, // we have to use a private alias export const PAGES_DIR_ALIAS = 'private-next-pages' diff --git a/packages/next/src/lib/flat-readdir.ts b/packages/next/src/lib/flat-readdir.ts index 7d5ade5051de9..62a96bebe2367 100644 --- a/packages/next/src/lib/flat-readdir.ts +++ b/packages/next/src/lib/flat-readdir.ts @@ -2,7 +2,7 @@ import { join } from 'path' import { nonNullable } from './non-nullable' import { promises } from 'fs' -export async function flatReaddir(dir: string, include: RegExp) { +export async function flatReaddir(dir: string, includes: RegExp[]) { const dirents = await promises.readdir(dir, { withFileTypes: true }) const result = await Promise.all( dirents.map(async (part) => { @@ -14,7 +14,10 @@ export async function flatReaddir(dir: string, include: RegExp) { } } - if (part.isDirectory() || !include.test(part.name)) { + if ( + part.isDirectory() || + !includes.some((include) => include.test(part.name)) + ) { return null } diff --git a/packages/next/src/server/next.ts b/packages/next/src/server/next.ts index 99148e288b6a1..8b0bd4785ff34 100644 --- a/packages/next/src/server/next.ts +++ b/packages/next/src/server/next.ts @@ -5,8 +5,8 @@ import './node-polyfill-fetch' import { default as Server } from './next-server' import * as log from '../build/output/log' import loadConfig from './config' -import { resolve } from 'path' -import { NON_STANDARD_NODE_ENV } from '../lib/constants' +import { join, resolve } from 'path' +import { NON_STANDARD_NODE_ENV, SERVER_HOOKS_FILENAME } from '../lib/constants' import { PHASE_DEVELOPMENT_SERVER } from '../shared/lib/constants' import { PHASE_PRODUCTION_SERVER } from '../shared/lib/constants' import { IncomingMessage, ServerResponse } from 'http' @@ -154,6 +154,23 @@ export class NextServer { process.env.NEXT_PREBUNDLED_REACT = '1' overrideBuiltInReactPackages() } + try { + const serverHooks = require(join( + this.options.dir || '.', + conf.distDir, + 'server', + SERVER_HOOKS_FILENAME + )) + + if (serverHooks.beforeNextInit) { + await serverHooks.beforeNextInit() + } + } catch (err: any) { + console.error('Error loading server hooks', err) + if (err.code !== 'MODULE_NOT_FOUND') { + throw err + } + } this.server = await this.createServer({ ...this.options, From 1cffc9b3cc698ed94b4ee604caca46213a5b1f7b Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Mon, 13 Feb 2023 22:32:57 +0100 Subject: [PATCH 02/37] rename --- packages/next/src/build/entries.ts | 11 +++--- packages/next/src/build/index.ts | 10 +++-- packages/next/src/build/utils.ts | 24 ++++++++++-- .../loaders/next-edge-ssr-loader/render.ts | 21 +---------- packages/next/src/cli/next-dev.ts | 37 +++++++++++++++++-- packages/next/src/lib/constants.ts | 6 +-- packages/next/src/server/base-server.ts | 2 +- .../next/src/server/dev/next-dev-server.ts | 37 +++++++++++++++++-- .../src/server/dev/on-demand-entry-handler.ts | 25 ++++++++++--- packages/next/src/server/next-server.ts | 20 ++++++++++ packages/next/src/server/next.ts | 22 +---------- 11 files changed, 146 insertions(+), 69 deletions(-) diff --git a/packages/next/src/build/entries.ts b/packages/next/src/build/entries.ts index 768866c31fa41..164a4d86cead3 100644 --- a/packages/next/src/build/entries.ts +++ b/packages/next/src/build/entries.ts @@ -16,7 +16,7 @@ import { ROOT_DIR_ALIAS, APP_DIR_ALIAS, WEBPACK_LAYERS, - SERVER_HOOKS_FILENAME, + INSTRUMENTATION_HOOK_FILENAME, } from '../lib/constants' import { isAPIRoute } from '../lib/is-api-route' import { isEdgeRuntime } from '../lib/is-edge-runtime' @@ -36,7 +36,7 @@ import { warn } from './output/log' import { isMiddlewareFile, isMiddlewareFilename, - isServerHooksFile, + isInstrumentationHookFile, NestedMiddlewareError, } from './utils' import { getPageStaticInfo } from './analysis/get-page-static-info' @@ -163,6 +163,7 @@ export function getEdgeServerEntry(opts: { middleware?: Partial pagesType: 'app' | 'pages' | 'root' appDirLoader?: string + hasInstrumentationHook?: boolean }) { if (isMiddlewareFile(opts.page)) { const loaderParams: MiddlewareLoaderOptions = { @@ -187,10 +188,10 @@ export function getEdgeServerEntry(opts: { return `next-edge-function-loader?${stringify(loaderParams)}!` } - if (isServerHooksFile(opts.page)) { + if (isInstrumentationHookFile(opts.page)) { return { import: opts.page, - filename: `edge-${SERVER_HOOKS_FILENAME}.js`, + filename: `edge-${INSTRUMENTATION_HOOK_FILENAME}.js`, } } @@ -262,7 +263,7 @@ export async function runDependingOnPageType(params: { page: string pageRuntime: ServerRuntime }): Promise { - if (isServerHooksFile(params.page)) { + if (isInstrumentationHookFile(params.page)) { await Promise.all([params.onServer(), params.onEdgeServer()]) return } diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index 84716515665d8..674e263fe973f 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -23,7 +23,7 @@ import { PUBLIC_DIR_MIDDLEWARE_CONFLICT, MIDDLEWARE_FILENAME, PAGES_DIR_ALIAS, - SERVER_HOOKS_FILENAME, + INSTRUMENTATION_HOOK_FILENAME, } from '../lib/constants' import { fileExists } from '../lib/file-exists' import { findPagesDir } from '../lib/find-pages-dir' @@ -514,15 +514,17 @@ export default async function build( `^${MIDDLEWARE_FILENAME}\\.(?:${config.pageExtensions.join('|')})$` ) - const serverHooksDetectionRegExp = new RegExp( - `^${SERVER_HOOKS_FILENAME}\\.(?:${config.pageExtensions.join('|')})$` + const instrumentationHookDetectionRegExp = new RegExp( + `^${INSTRUMENTATION_HOOK_FILENAME}\\.(?:${config.pageExtensions.join( + '|' + )})$` ) const rootDir = path.join((pagesDir || appDir)!, '..') const rootPaths = ( await flatReaddir(rootDir, [ middlewareDetectionRegExp, - serverHooksDetectionRegExp, + instrumentationHookDetectionRegExp, ]) ).map((absoluteFile) => absoluteFile.replace(dir, '')) // needed for static exporting since we want to replace with HTML diff --git a/packages/next/src/build/utils.ts b/packages/next/src/build/utils.ts index 11c91b7006202..e6680641f83af 100644 --- a/packages/next/src/build/utils.ts +++ b/packages/next/src/build/utils.ts @@ -26,7 +26,7 @@ import { SERVER_PROPS_GET_INIT_PROPS_CONFLICT, SERVER_PROPS_SSG_CONFLICT, MIDDLEWARE_FILENAME, - SERVER_HOOKS_FILENAME, + INSTRUMENTATION_HOOK_FILENAME, } from '../lib/constants' import { MODERN_BROWSERSLIST_TARGET } from '../shared/lib/constants' import prettyBytes from '../lib/pretty-bytes' @@ -287,6 +287,13 @@ export function isMiddlewareFilename(file?: string) { return file === MIDDLEWARE_FILENAME || file === `src/${MIDDLEWARE_FILENAME}` } +export function isInstrumentationHookFilename(file?: string) { + return ( + file === INSTRUMENTATION_HOOK_FILENAME || + file === `src/${INSTRUMENTATION_HOOK_FILENAME}` + ) +} + export interface PageInfo { isHybridAmp?: boolean size: number @@ -1829,10 +1836,19 @@ export function isMiddlewareFile(file: string) { ) } -export function isServerHooksFile(file: string) { +export function isInstrumentationHookFile(file: string) { return ( - file === `/${SERVER_HOOKS_FILENAME}` || - file === `/src/${SERVER_HOOKS_FILENAME}` + file === `/${INSTRUMENTATION_HOOK_FILENAME}` || + file === `/src/${INSTRUMENTATION_HOOK_FILENAME}` + ) +} + +export function getPossibleInstrumentationHookFilenames( + folder: string, + extensions: string[] +) { + return extensions.map((extension) => + path.join(folder, `${INSTRUMENTATION_HOOK_FILENAME}.${extension}`) ) } diff --git a/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/render.ts b/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/render.ts index c2c385aaecfd6..535308421e6b6 100644 --- a/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/render.ts +++ b/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/render.ts @@ -10,10 +10,7 @@ import { WebNextRequest, WebNextResponse, } from '../../../../server/base-http/web' -import { - SERVER_HOOKS_FILENAME, - SERVER_RUNTIME, -} from '../../../../lib/constants' +import { SERVER_RUNTIME } from '../../../../lib/constants' export function getRender({ dev, @@ -34,7 +31,6 @@ export function getRender({ config, buildId, fontLoaderManifest, - serverHooksPath, }: { pagesType: 'app' | 'pages' | 'root' dev: boolean @@ -55,7 +51,6 @@ export function getRender({ config: NextConfigComplete buildId: string fontLoaderManifest: FontLoaderManifest - serverHooksPath: string }) { const isAppPath = pagesType === 'app' const baseLoadComponentResult = { @@ -68,20 +63,6 @@ export function getRender({ App: appMod?.default as AppType, } - try { - const serverHooks = require((config.dir || '.', - config.distDir, - 'server', - `edge-${SERVER_HOOKS_FILENAME}`)) - - serverHooks.beforeNextInit?.() - } catch (err: any) { - console.error('Error loading server hooks', err) - if (err.code !== 'MODULE_NOT_FOUND') { - throw err - } - } - const server = new WebServer({ dev, conf: config, diff --git a/packages/next/src/cli/next-dev.ts b/packages/next/src/cli/next-dev.ts index b09ff810197b5..4ccb0d8b24c76 100644 --- a/packages/next/src/cli/next-dev.ts +++ b/packages/next/src/cli/next-dev.ts @@ -21,6 +21,7 @@ import { fileExists } from '../lib/file-exists' import Watchpack from 'next/dist/compiled/watchpack' import stripAnsi from 'next/dist/compiled/strip-ansi' import { warn } from '../build/output/log' +import { getPossibleInstrumentationHookFilenames } from '../build/utils' let isTurboSession = false let sessionStopHandled = false @@ -594,20 +595,50 @@ If you cannot make the changes above, but still want to try out\nNext.js v13 wit const watchedEntryLength = parentDir.split('/').length + 1 const previousItems = new Set() + const files = getPossibleInstrumentationHookFilenames( + dir, + config.pageExtensions + ) + const wp = new Watchpack({ ignored: (entry: string) => { - // watch only one level - return !(entry.split('/').length <= watchedEntryLength) + return ( + !(entry.split('/').length <= watchedEntryLength) && + !files.includes(entry) + ) }, }) wp.watch({ directories: [parentDir], startTime: 0 }) - + let instrumentationFileTimeCache: number | undefined = undefined wp.on('aggregated', () => { const knownFiles = wp.getTimeInfoEntries() const newFiles: string[] = [] let hasPagesApp = false + // check if the `instrumentation.js` has changed + // if it has we need to restart the server + const instrumentationFile = [...knownFiles.keys()].find((key) => + files.includes(key) + ) + if (instrumentationFile) { + const instrumentationFileTime = + knownFiles.get(instrumentationFile)?.timestamp + if ( + instrumentationFileTimeCache !== undefined && + instrumentationFileTime !== instrumentationFileTimeCache + ) { + warn( + `The instrumentation file has changed, restarting the server to apply changes.` + ) + childProcessExitUnsub() + childProcess?.kill() + childProcessExitUnsub = setupFork() + } else { + instrumentationFileTimeCache = instrumentationFileTime + } + } + // if the dir still exists nothing to check try { const result = findPagesDir(dir, !!config.experimental?.appDir) diff --git a/packages/next/src/lib/constants.ts b/packages/next/src/lib/constants.ts index 56e795dafb49e..2a373f6f9281f 100644 --- a/packages/next/src/lib/constants.ts +++ b/packages/next/src/lib/constants.ts @@ -4,9 +4,9 @@ import type { ServerRuntime } from '../../types' export const MIDDLEWARE_FILENAME = 'middleware' export const MIDDLEWARE_LOCATION_REGEXP = `(?:src/)?${MIDDLEWARE_FILENAME}` -// Pattern to detect server hooks file -export const SERVER_HOOKS_FILENAME = 'server-hooks' -export const SERVER_HOOKS_LOCATION_REGEXP = `(?:src/)?${SERVER_HOOKS_FILENAME}` +// Pattern to detect instrumentation hooks file +export const INSTRUMENTATION_HOOK_FILENAME = 'instrumentation' +export const INSTRUMENTATION_HOOKS_LOCATION_REGEXP = `(?:src/)?${INSTRUMENTATION_HOOK_FILENAME}` // Because on Windows absolute paths in the generated code can break because of numbers, eg 1 in the path, // we have to use a private alias diff --git a/packages/next/src/server/base-server.ts b/packages/next/src/server/base-server.ts index e1ccae3ff7ef4..6b6e2a95f6510 100644 --- a/packages/next/src/server/base-server.ts +++ b/packages/next/src/server/base-server.ts @@ -114,7 +114,7 @@ export interface Options { /** * Object containing the configuration next.config.js */ - conf: NextConfig + conf: NextConfigComplete /** * Set to false when the server was created by Next.js */ diff --git a/packages/next/src/server/dev/next-dev-server.ts b/packages/next/src/server/dev/next-dev-server.ts index 2e3897b8963a8..582e628bd2759 100644 --- a/packages/next/src/server/dev/next-dev-server.ts +++ b/packages/next/src/server/dev/next-dev-server.ts @@ -72,7 +72,9 @@ import { getPageStaticInfo } from '../../build/analysis/get-page-static-info' import { normalizePathSep } from '../../shared/lib/page-path/normalize-path-sep' import { normalizeAppPath } from '../../shared/lib/router/utils/app-paths' import { + getPossibleInstrumentationHookFilenames, getPossibleMiddlewareFilenames, + isInstrumentationHookFile, isMiddlewareFile, NestedMiddlewareError, } from '../../build/utils' @@ -121,6 +123,7 @@ export default class DevServer extends Server { private pagesDir?: string private appDir?: string private actualMiddlewareFile?: string + private actualInstrumentationHookFile?: string private middleware?: MiddlewareRoutingItem private edgeFunctions?: RoutingItem[] private verifyingTypeScript?: boolean @@ -364,10 +367,16 @@ export default class DevServer extends Server { const directories = [...pages, ...app] const rootDir = this.pagesDir || this.appDir - const files = getPossibleMiddlewareFilenames( - pathJoin(rootDir!, '..'), - this.nextConfig.pageExtensions - ) + const files = [ + ...getPossibleMiddlewareFilenames( + pathJoin(rootDir!, '..'), + this.nextConfig.pageExtensions + ), + ...getPossibleInstrumentationHookFilenames( + pathJoin(rootDir!, '..'), + this.nextConfig.pageExtensions + ), + ] let nestedMiddleware: string[] = [] const envFiles = [ @@ -482,6 +491,10 @@ export default class DevServer extends Server { ] continue } + if (isInstrumentationHookFile(rootFile)) { + this.actualInstrumentationHookFile = rootFile + continue + } if (fileName.endsWith('.ts') || fileName.endsWith('.tsx')) { enabledTypeScript = true @@ -803,6 +816,7 @@ export default class DevServer extends Server { await this.addExportPathMapRoutes() await this.hotReloader.start() await this.startWatcher() + await this.ensureInstrumentation() await this.matchers.reload() this.setDevReady!() @@ -1330,6 +1344,21 @@ export default class DevServer extends Server { }) } + private async ensureInstrumentation() { + if (this.actualInstrumentationHookFile) { + await this.hotReloader!.ensurePage({ + page: this.actualInstrumentationHookFile!, + clientOnly: false, + }) + try { + require(pathJoin(this.distDir, 'server', 'instrumentation')).register() + } catch (err: any) { + err.message = `An error occurred while loading instrumentation hook: ${err.message}` + throw err + } + } + } + protected async ensureEdgeFunction({ page, appPaths, diff --git a/packages/next/src/server/dev/on-demand-entry-handler.ts b/packages/next/src/server/dev/on-demand-entry-handler.ts index 643ae5b8dbadf..d7676438f0cad 100644 --- a/packages/next/src/server/dev/on-demand-entry-handler.ts +++ b/packages/next/src/server/dev/on-demand-entry-handler.ts @@ -15,7 +15,12 @@ import { removePagePathTail } from '../../shared/lib/page-path/remove-page-path- import { reportTrigger } from '../../build/output' import getRouteFromEntrypoint from '../get-route-from-entrypoint' import { getPageStaticInfo } from '../../build/analysis/get-page-static-info' -import { isMiddlewareFile, isMiddlewareFilename } from '../../build/utils' +import { + isInstrumentationHookFile, + isInstrumentationHookFilename, + isMiddlewareFile, + isMiddlewareFilename, +} from '../../build/utils' import { PageNotFoundError } from '../../shared/lib/utils' import { CompilerNameValues, @@ -296,7 +301,10 @@ async function findPagePathData( const normalizedPagePath = tryToNormalizePagePath(page) let pagePath: string | null = null - if (isMiddlewareFile(normalizedPagePath)) { + if ( + isMiddlewareFile(normalizedPagePath) || + isInstrumentationHookFile(normalizedPagePath) + ) { pagePath = await findPageFile( rootDir, normalizedPagePath, @@ -434,7 +442,8 @@ export function onDemandEntryHandler({ pagePaths.push(`${type}${page}`) } else if ( (root && entrypoint.name === 'root') || - isMiddlewareFilename(entrypoint.name) + isMiddlewareFilename(entrypoint.name) || + isInstrumentationHookFilename(entrypoint.name) ) { pagePaths.push(`${type}/${entrypoint.name}`) } @@ -685,7 +694,10 @@ export function onDemandEntryHandler({ onServer: () => { added.set(COMPILER_NAMES.server, addEntry(COMPILER_NAMES.server)) const edgeServerEntry = `${COMPILER_NAMES.edgeServer}${pagePathData.page}` - if (entries[edgeServerEntry]) { + if ( + entries[edgeServerEntry] && + !isInstrumentationHookFile(pagePathData.page) + ) { // Runtime switched from edge to server delete entries[edgeServerEntry] } @@ -696,7 +708,10 @@ export function onDemandEntryHandler({ addEntry(COMPILER_NAMES.edgeServer) ) const serverEntry = `${COMPILER_NAMES.server}${pagePathData.page}` - if (entries[serverEntry]) { + if ( + entries[serverEntry] && + !isInstrumentationHookFile(pagePathData.page) + ) { // Runtime switched from server to edge delete entries[serverEntry] } diff --git a/packages/next/src/server/next-server.ts b/packages/next/src/server/next-server.ts index dcbf9528109d8..75a7e6a6bed90 100644 --- a/packages/next/src/server/next-server.ts +++ b/packages/next/src/server/next-server.ts @@ -101,6 +101,7 @@ import { RouteKind } from './future/route-kind' import { AppRouteRouteHandler } from './future/route-handlers/app-route-route-handler' import { PagesAPIRouteMatch } from './future/route-matches/pages-api-route-match' import { MatchOptions } from './future/route-matcher-managers/route-matcher-manager' +import { INSTRUMENTATION_HOOK_FILENAME } from '../lib/constants' export * from './base-server' @@ -237,6 +238,25 @@ export default class NextNodeServer extends BaseServer { this.imageResponseCache = new ResponseCache(this.minimalMode) } + if (!options.dev) { + try { + const instrumentationHook = require(join( + options.dir || '.', + options.conf.distDir!, + 'server', + INSTRUMENTATION_HOOK_FILENAME + )) + + instrumentationHook.register?.() + } catch (err: any) { + console.error(err) + if (err.code !== 'MODULE_NOT_FOUND') { + console.error('Error loading instrumentation.js hook', err) + throw err + } + } + } + if (!options.dev) { // pre-warm _document and _app as these will be // needed for most requests diff --git a/packages/next/src/server/next.ts b/packages/next/src/server/next.ts index 8b0bd4785ff34..656a1b844c6fc 100644 --- a/packages/next/src/server/next.ts +++ b/packages/next/src/server/next.ts @@ -5,8 +5,8 @@ import './node-polyfill-fetch' import { default as Server } from './next-server' import * as log from '../build/output/log' import loadConfig from './config' -import { join, resolve } from 'path' -import { NON_STANDARD_NODE_ENV, SERVER_HOOKS_FILENAME } from '../lib/constants' +import { resolve } from 'path' +import { NON_STANDARD_NODE_ENV } from '../lib/constants' import { PHASE_DEVELOPMENT_SERVER } from '../shared/lib/constants' import { PHASE_PRODUCTION_SERVER } from '../shared/lib/constants' import { IncomingMessage, ServerResponse } from 'http' @@ -154,24 +154,6 @@ export class NextServer { process.env.NEXT_PREBUNDLED_REACT = '1' overrideBuiltInReactPackages() } - try { - const serverHooks = require(join( - this.options.dir || '.', - conf.distDir, - 'server', - SERVER_HOOKS_FILENAME - )) - - if (serverHooks.beforeNextInit) { - await serverHooks.beforeNextInit() - } - } catch (err: any) { - console.error('Error loading server hooks', err) - if (err.code !== 'MODULE_NOT_FOUND') { - throw err - } - } - this.server = await this.createServer({ ...this.options, conf, From 182a58c3a1f1488b2ee6fc518098e6297fe2a6d9 Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Wed, 15 Feb 2023 15:30:01 +0100 Subject: [PATCH 03/37] rename hook file --- packages/next/src/server/dev/next-dev-server.ts | 4 ++-- packages/next/src/server/next-server.ts | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/next/src/server/dev/next-dev-server.ts b/packages/next/src/server/dev/next-dev-server.ts index 582e628bd2759..6f564ba4715ba 100644 --- a/packages/next/src/server/dev/next-dev-server.ts +++ b/packages/next/src/server/dev/next-dev-server.ts @@ -816,7 +816,7 @@ export default class DevServer extends Server { await this.addExportPathMapRoutes() await this.hotReloader.start() await this.startWatcher() - await this.ensureInstrumentation() + await this.runInstrumentationHookIfAvailable() await this.matchers.reload() this.setDevReady!() @@ -1344,7 +1344,7 @@ export default class DevServer extends Server { }) } - private async ensureInstrumentation() { + private async runInstrumentationHookIfAvailable() { if (this.actualInstrumentationHookFile) { await this.hotReloader!.ensurePage({ page: this.actualInstrumentationHookFile!, diff --git a/packages/next/src/server/next-server.ts b/packages/next/src/server/next-server.ts index 75a7e6a6bed90..aa2b3e95f038b 100644 --- a/packages/next/src/server/next-server.ts +++ b/packages/next/src/server/next-server.ts @@ -249,9 +249,8 @@ export default class NextNodeServer extends BaseServer { instrumentationHook.register?.() } catch (err: any) { - console.error(err) if (err.code !== 'MODULE_NOT_FOUND') { - console.error('Error loading instrumentation.js hook', err) + err.message = `An error occurred while loading instrumentation hook: ${err.message}` throw err } } From 5eb89740167fc7fbaf005a1a82979bc502df44e3 Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Thu, 16 Feb 2023 16:01:30 +0100 Subject: [PATCH 04/37] rename --- .vscode/settings.json | 3 +- packages/next/src/build/build-context.ts | 1 + packages/next/src/build/entries.ts | 1 + packages/next/src/build/index.ts | 6 ++++ packages/next/src/build/webpack-build.ts | 11 +++++--- packages/next/src/build/webpack-config.ts | 3 ++ .../loaders/next-edge-ssr-loader/index.ts | 2 +- .../webpack/plugins/middleware-plugin.ts | 28 +++++++++++++++---- packages/next/src/cli/next-dev.ts | 2 +- packages/next/src/server/base-server.ts | 2 +- packages/next/src/server/web/adapter.ts | 9 ++++++ 11 files changed, 53 insertions(+), 15 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index d831d8bdca835..9fafd41d512dd 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -80,6 +80,5 @@ "titleBar.activeForeground": "#e7e7e7", "titleBar.inactiveBackground": "#21573299", "titleBar.inactiveForeground": "#e7e7e799" - }, - "peacock.color": "#215732" + } } diff --git a/packages/next/src/build/build-context.ts b/packages/next/src/build/build-context.ts index 0130be1746b16..eb4318f8291b1 100644 --- a/packages/next/src/build/build-context.ts +++ b/packages/next/src/build/build-context.ts @@ -37,6 +37,7 @@ export const NextBuildContext: Partial<{ mappedRootPaths: { [page: string]: string } + hasInstrumentationHook: boolean // misc fields telemetryPlugin: TelemetryPlugin diff --git a/packages/next/src/build/entries.ts b/packages/next/src/build/entries.ts index 164a4d86cead3..5bf06c1ae29bd 100644 --- a/packages/next/src/build/entries.ts +++ b/packages/next/src/build/entries.ts @@ -148,6 +148,7 @@ export interface CreateEntrypointsParams { appDir?: string appPaths?: Record pageExtensions: string[] + hasInstrumentationHook?: boolean } export function getEdgeServerEntry(opts: { diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index 674e263fe973f..ebe1d76b805d2 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -527,6 +527,12 @@ export default async function build( instrumentationHookDetectionRegExp, ]) ).map((absoluteFile) => absoluteFile.replace(dir, '')) + + const hasInstrumentationHook = rootPaths.some((p) => + p.includes(INSTRUMENTATION_HOOK_FILENAME) + ) + NextBuildContext.hasInstrumentationHook = hasInstrumentationHook + // needed for static exporting since we want to replace with HTML // files diff --git a/packages/next/src/build/webpack-build.ts b/packages/next/src/build/webpack-build.ts index 9b5e3cfe7f57c..33b013df6bd3c 100644 --- a/packages/next/src/build/webpack-build.ts +++ b/packages/next/src/build/webpack-build.ts @@ -60,6 +60,7 @@ async function webpackBuildImpl(): Promise<{ const nextBuildSpan = NextBuildContext.nextBuildSpan! const buildSpinner = NextBuildContext.buildSpinner const dir = NextBuildContext.dir! + const config = NextBuildContext.config! const runWebpackSpan = nextBuildSpan.traceChild('run-webpack-compiler') const entrypoints = await nextBuildSpan @@ -67,30 +68,32 @@ async function webpackBuildImpl(): Promise<{ .traceAsyncFn(() => createEntrypoints({ buildId: NextBuildContext.buildId!, - config: NextBuildContext.config!, + config: config, envFiles: NextBuildContext.loadedEnvFiles!, isDev: false, rootDir: dir, - pageExtensions: NextBuildContext.config!.pageExtensions!, + pageExtensions: config.pageExtensions!, pagesDir: NextBuildContext.pagesDir!, appDir: NextBuildContext.appDir!, pages: NextBuildContext.mappedPages!, appPaths: NextBuildContext.mappedAppPages!, previewMode: NextBuildContext.previewProps!, rootPaths: NextBuildContext.mappedRootPaths!, + hasInstrumentationHook: NextBuildContext.hasInstrumentationHook!, }) ) const commonWebpackOptions = { isServer: false, buildId: NextBuildContext.buildId!, - config: NextBuildContext.config!, - target: NextBuildContext.config!.target!, + config: config, + target: config.target!, appDir: NextBuildContext.appDir!, pagesDir: NextBuildContext.pagesDir!, rewrites: NextBuildContext.rewrites!, reactProductionProfiling: NextBuildContext.reactProductionProfiling!, noMangling: NextBuildContext.noMangling!, + hasInstrumentationHook: NextBuildContext.hasInstrumentationHook!, } const configs = await runWebpackSpan diff --git a/packages/next/src/build/webpack-config.ts b/packages/next/src/build/webpack-config.ts index eef6afd739a3e..76528fb9dafcd 100644 --- a/packages/next/src/build/webpack-config.ts +++ b/packages/next/src/build/webpack-config.ts @@ -617,6 +617,7 @@ export default async function getBaseWebpackConfig( jsConfig, resolvedBaseUrl, supportedBrowsers, + hasInstrumentationHook = false, }: { buildId: string config: NextConfigComplete @@ -635,6 +636,7 @@ export default async function getBaseWebpackConfig( jsConfig: any resolvedBaseUrl: string | undefined supportedBrowsers: string[] | undefined + hasInstrumentationHook?: boolean } ): Promise { const isClient = compilerType === COMPILER_NAMES.client @@ -2104,6 +2106,7 @@ export default async function getBaseWebpackConfig( new MiddlewarePlugin({ dev, sriEnabled: !dev && !!config.experimental.sri?.algorithm, + hasInstrumentationHook: hasInstrumentationHook, }), isClient && new BuildManifestPlugin({ diff --git a/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/index.ts b/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/index.ts index 1de9b6617a398..d94b1671b217e 100644 --- a/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/index.ts +++ b/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/index.ts @@ -90,7 +90,7 @@ export default async function edgeSSRLoader(this: any) { import { getRender } from 'next/dist/esm/build/webpack/loaders/next-edge-ssr-loader/render' enhanceGlobals() - + const pageType = ${JSON.stringify(pagesType)} ${ isAppDir diff --git a/packages/next/src/build/webpack/plugins/middleware-plugin.ts b/packages/next/src/build/webpack/plugins/middleware-plugin.ts index 61bd2d4ff8c1d..b9e08cf086f4b 100644 --- a/packages/next/src/build/webpack/plugins/middleware-plugin.ts +++ b/packages/next/src/build/webpack/plugins/middleware-plugin.ts @@ -29,6 +29,7 @@ import { Telemetry } from '../../../telemetry/storage' import { traceGlobals } from '../../../trace/shared' import { EVENT_BUILD_FEATURE_USAGE } from '../../../telemetry/events' import { normalizeAppPath } from '../../../shared/lib/router/utils/app-paths' +import { INSTRUMENTATION_HOOK_FILENAME } from '../../../lib/constants' export interface EdgeFunctionDefinition { env: string[] @@ -90,7 +91,10 @@ function isUsingIndirectEvalAndUsedByExports(args: { function getEntryFiles( entryFiles: string[], meta: EntryMetadata, - opts: { sriEnabled: boolean } + opts: { + sriEnabled: boolean + hasInstrumentationHook: boolean + } ) { const files: string[] = [] if (meta.edgeSSR) { @@ -120,8 +124,9 @@ function getEntryFiles( `server/${MIDDLEWARE_REACT_LOADABLE_MANIFEST}.js` ) - files.push(`server/${FONT_LOADER_MANIFEST}.js`) - } + if (opts.hasInstrumentationHook) { + files.push(`server/edge-${INSTRUMENTATION_HOOK_FILENAME}.js`) + } files.push( ...entryFiles @@ -134,7 +139,10 @@ function getEntryFiles( function getCreateAssets(params: { compilation: webpack.Compilation metadataByEntry: Map - opts: { sriEnabled: boolean } + opts: { + sriEnabled: boolean + hasInstrumentationHook: boolean + } }) { const { compilation, metadataByEntry, opts } = params return (assets: any) => { @@ -785,8 +793,15 @@ function getExtractMetadata(params: { export default class MiddlewarePlugin { private readonly dev: boolean private readonly sriEnabled: boolean - - constructor({ dev, sriEnabled }: { dev: boolean; sriEnabled: boolean }) { + private readonly hasInstrumentationHook: boolean + + constructor({ + dev, + sriEnabled, + }: { + dev: boolean + sriEnabled: boolean + }) { this.dev = dev this.sriEnabled = sriEnabled } @@ -833,6 +848,7 @@ export default class MiddlewarePlugin { metadataByEntry, opts: { sriEnabled: this.sriEnabled, + hasInstrumentationHook: this.hasInstrumentationHook, }, }) ) diff --git a/packages/next/src/cli/next-dev.ts b/packages/next/src/cli/next-dev.ts index 4ccb0d8b24c76..2447069286785 100644 --- a/packages/next/src/cli/next-dev.ts +++ b/packages/next/src/cli/next-dev.ts @@ -597,7 +597,7 @@ If you cannot make the changes above, but still want to try out\nNext.js v13 wit const files = getPossibleInstrumentationHookFilenames( dir, - config.pageExtensions + config.pageExtensions! ) const wp = new Watchpack({ diff --git a/packages/next/src/server/base-server.ts b/packages/next/src/server/base-server.ts index 6b6e2a95f6510..e1ccae3ff7ef4 100644 --- a/packages/next/src/server/base-server.ts +++ b/packages/next/src/server/base-server.ts @@ -114,7 +114,7 @@ export interface Options { /** * Object containing the configuration next.config.js */ - conf: NextConfigComplete + conf: NextConfig /** * Set to false when the server was created by Next.js */ diff --git a/packages/next/src/server/web/adapter.ts b/packages/next/src/server/web/adapter.ts index 01e050eee980c..67918a82785bd 100644 --- a/packages/next/src/server/web/adapter.ts +++ b/packages/next/src/server/web/adapter.ts @@ -17,6 +17,8 @@ import { RSC, } from '../../client/components/app-router-headers' +declare const _ENTRIES: any + class NextRequestHint extends NextRequest { sourcePage: string @@ -240,4 +242,11 @@ export function enhanceGlobals() { enumerable: false, configurable: false, }) + + if ( + _ENTRIES.middleware_instrumentation && + _ENTRIES.middleware_instrumentation.register + ) { + _ENTRIES.middleware_instrumentation.register() + } } From 42621c1307ebf7de51665d83a21d9a64ce9476f0 Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Thu, 16 Feb 2023 16:06:56 +0100 Subject: [PATCH 05/37] remove vscode set --- .vscode/settings.json | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 9fafd41d512dd..c98c9387e7de9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -57,28 +57,5 @@ "explorer.fileNesting.patterns": { "*.ts": "$(capture).test.ts, $(capture).test.tsx", "*.tsx": "$(capture).test.ts, $(capture).test.tsx" - }, - "workbench.colorCustomizations": { - "activityBar.activeBackground": "#2f7c47", - "activityBar.background": "#2f7c47", - "activityBar.foreground": "#e7e7e7", - "activityBar.inactiveForeground": "#e7e7e799", - "activityBarBadge.background": "#422c74", - "activityBarBadge.foreground": "#e7e7e7", - "commandCenter.border": "#e7e7e799", - "editorGroup.border": "#2f7c47", - "panel.border": "#2f7c47", - "sash.hoverBorder": "#2f7c47", - "sideBar.border": "#2f7c47", - "statusBar.background": "#215732", - "statusBar.foreground": "#e7e7e7", - "statusBarItem.hoverBackground": "#2f7c47", - "statusBarItem.remoteBackground": "#215732", - "statusBarItem.remoteForeground": "#e7e7e7", - "tab.activeBorder": "#2f7c47", - "titleBar.activeBackground": "#215732", - "titleBar.activeForeground": "#e7e7e7", - "titleBar.inactiveBackground": "#21573299", - "titleBar.inactiveForeground": "#e7e7e799" } } From 18ef6c5478a3427a16549e5637f2c81e5718a5ee Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Thu, 16 Feb 2023 16:09:24 +0100 Subject: [PATCH 06/37] remove testfiles --- bench/vercel/benchmark-app/app/rsc/page.js | 2 -- bench/vercel/benchmark-app/server-hooks.js | 5 ----- 2 files changed, 7 deletions(-) delete mode 100644 bench/vercel/benchmark-app/server-hooks.js diff --git a/bench/vercel/benchmark-app/app/rsc/page.js b/bench/vercel/benchmark-app/app/rsc/page.js index dd81f67de1b03..d24c366ad67a5 100644 --- a/bench/vercel/benchmark-app/app/rsc/page.js +++ b/bench/vercel/benchmark-app/app/rsc/page.js @@ -18,5 +18,3 @@ export default function page() { return
{previous ? 'HOT' : 'COLD'}
} - -export const runtime = 'edge' diff --git a/bench/vercel/benchmark-app/server-hooks.js b/bench/vercel/benchmark-app/server-hooks.js deleted file mode 100644 index 6dfb09c674c3c..0000000000000 --- a/bench/vercel/benchmark-app/server-hooks.js +++ /dev/null @@ -1,5 +0,0 @@ -export function beforeNextInit() { - // This is called before the Next.js app is initialized - // and before the server is started - console.log('beforeNextInit', require.resolve('react-dom/server')) -} From 77cd61636a5c2e592b150a016889dfc4262e78fb Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Thu, 16 Feb 2023 16:19:25 +0100 Subject: [PATCH 07/37] add error message --- packages/next/src/server/web/adapter.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/next/src/server/web/adapter.ts b/packages/next/src/server/web/adapter.ts index 67918a82785bd..dc893dcb5449f 100644 --- a/packages/next/src/server/web/adapter.ts +++ b/packages/next/src/server/web/adapter.ts @@ -247,6 +247,11 @@ export function enhanceGlobals() { _ENTRIES.middleware_instrumentation && _ENTRIES.middleware_instrumentation.register ) { - _ENTRIES.middleware_instrumentation.register() + try { + _ENTRIES.middleware_instrumentation.register() + } catch (err) { + err.message = `An error occurred while loading instrumentation hook: ${err.message}` + throw err + } } } From f501bed8e39dc4e1fbb403e7a5e321d6af9728ba Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Thu, 16 Feb 2023 16:21:32 +0100 Subject: [PATCH 08/37] add error message --- packages/next/src/server/web/adapter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/src/server/web/adapter.ts b/packages/next/src/server/web/adapter.ts index dc893dcb5449f..079e7cc9ab0e5 100644 --- a/packages/next/src/server/web/adapter.ts +++ b/packages/next/src/server/web/adapter.ts @@ -249,7 +249,7 @@ export function enhanceGlobals() { ) { try { _ENTRIES.middleware_instrumentation.register() - } catch (err) { + } catch (err: any) { err.message = `An error occurred while loading instrumentation hook: ${err.message}` throw err } From f92dc3c7a994a9e4f43fe44e749b304514bed875 Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Fri, 17 Feb 2023 10:12:18 +0100 Subject: [PATCH 09/37] fix rebase artifact + fix build --- packages/next/src/build/entries.ts | 5 ++++- packages/next/src/build/webpack/plugins/middleware-plugin.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/next/src/build/entries.ts b/packages/next/src/build/entries.ts index 5bf06c1ae29bd..4f7fee4ae8c88 100644 --- a/packages/next/src/build/entries.ts +++ b/packages/next/src/build/entries.ts @@ -263,11 +263,13 @@ export async function runDependingOnPageType(params: { onServer: () => T page: string pageRuntime: ServerRuntime + pagesType?: 'app' | 'pages' | 'root' }): Promise { - if (isInstrumentationHookFile(params.page)) { + if (params.pagesType === 'root' && isInstrumentationHookFile(params.page)) { await Promise.all([params.onServer(), params.onEdgeServer()]) return } + if (isMiddlewareFile(params.page)) { await params.onEdgeServer() return @@ -404,6 +406,7 @@ export async function createEntrypoints(params: CreateEntrypointsParams) { await runDependingOnPageType({ page, pageRuntime: staticInfo.runtime, + pagesType, onClient: () => { if (isServerComponent || isInsideAppDir) { // We skip the initial entries for server component pages and let the diff --git a/packages/next/src/build/webpack/plugins/middleware-plugin.ts b/packages/next/src/build/webpack/plugins/middleware-plugin.ts index b9e08cf086f4b..666ba21d56a58 100644 --- a/packages/next/src/build/webpack/plugins/middleware-plugin.ts +++ b/packages/next/src/build/webpack/plugins/middleware-plugin.ts @@ -19,7 +19,6 @@ import { NEXT_CLIENT_SSR_ENTRY_SUFFIX, FLIGHT_SERVER_CSS_MANIFEST, SUBRESOURCE_INTEGRITY_MANIFEST, - FONT_LOADER_MANIFEST, } from '../../../shared/lib/constants' import { getPageStaticInfo, @@ -127,6 +126,7 @@ function getEntryFiles( if (opts.hasInstrumentationHook) { files.push(`server/edge-${INSTRUMENTATION_HOOK_FILENAME}.js`) } + } files.push( ...entryFiles @@ -798,12 +798,15 @@ export default class MiddlewarePlugin { constructor({ dev, sriEnabled, + hasInstrumentationHook, }: { dev: boolean sriEnabled: boolean + hasInstrumentationHook: boolean }) { this.dev = dev this.sriEnabled = sriEnabled + this.hasInstrumentationHook = hasInstrumentationHook } public apply(compiler: webpack.Compiler) { From 10f657f9fc6020c0606e79d22705b8dbbb4c15d7 Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Fri, 17 Feb 2023 11:04:13 +0100 Subject: [PATCH 10/37] fix --- packages/next/src/server/web/adapter.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/next/src/server/web/adapter.ts b/packages/next/src/server/web/adapter.ts index 079e7cc9ab0e5..e8a9911540d07 100644 --- a/packages/next/src/server/web/adapter.ts +++ b/packages/next/src/server/web/adapter.ts @@ -244,6 +244,7 @@ export function enhanceGlobals() { }) if ( + '__ENTRIES' in globalThis && _ENTRIES.middleware_instrumentation && _ENTRIES.middleware_instrumentation.register ) { From 2371da15e600deddae44cc12981fae0b19888737 Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Fri, 17 Feb 2023 18:26:48 +0100 Subject: [PATCH 11/37] fix conflict with pages/instrumentation --- packages/next/src/server/dev/on-demand-entry-handler.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/next/src/server/dev/on-demand-entry-handler.ts b/packages/next/src/server/dev/on-demand-entry-handler.ts index d7676438f0cad..f29f49f817695 100644 --- a/packages/next/src/server/dev/on-demand-entry-handler.ts +++ b/packages/next/src/server/dev/on-demand-entry-handler.ts @@ -633,8 +633,13 @@ export function onDemandEntryHandler({ shouldInvalidate: boolean } => { const entryKey = `${compilerType}${pagePathData.page}` - - if (entries[entryKey]) { + if ( + entries[entryKey] && + // there can be an overlap in the entryKey for the instrumentation hook file and a page named the same + // this is a quick fix to support this scenario by overwriting the instrumentation hook entry, since we only use it one time + // any changes to the instrumentation hook file will require a restart of the dev server anyway + !isInstrumentationHookFilename(entries[entryKey].bundlePath) + ) { entries[entryKey].dispose = false entries[entryKey].lastActiveTime = Date.now() if (entries[entryKey].status === BUILT) { From 7ae8c72d89c84ec51ef3dd98c454ddd8cc55acaf Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Fri, 17 Feb 2023 18:47:44 +0100 Subject: [PATCH 12/37] fix test + fix edge --- packages/next/src/server/web/adapter.ts | 2 +- .../instrumentation-hook.test.ts | 37 +++++++++++++++++++ .../instrumentation-hook/instrumentation.js | 7 ++++ test/e2e/instrumentation-hook/pages/edge.tsx | 15 ++++++++ test/e2e/instrumentation-hook/pages/index.tsx | 3 ++ .../pages/instrumentation.tsx | 3 ++ 6 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 test/e2e/instrumentation-hook/instrumentation-hook.test.ts create mode 100644 test/e2e/instrumentation-hook/instrumentation.js create mode 100644 test/e2e/instrumentation-hook/pages/edge.tsx create mode 100644 test/e2e/instrumentation-hook/pages/index.tsx create mode 100644 test/e2e/instrumentation-hook/pages/instrumentation.tsx diff --git a/packages/next/src/server/web/adapter.ts b/packages/next/src/server/web/adapter.ts index e8a9911540d07..01d115af4e6a4 100644 --- a/packages/next/src/server/web/adapter.ts +++ b/packages/next/src/server/web/adapter.ts @@ -244,7 +244,7 @@ export function enhanceGlobals() { }) if ( - '__ENTRIES' in globalThis && + '_ENTRIES' in globalThis && _ENTRIES.middleware_instrumentation && _ENTRIES.middleware_instrumentation.register ) { diff --git a/test/e2e/instrumentation-hook/instrumentation-hook.test.ts b/test/e2e/instrumentation-hook/instrumentation-hook.test.ts new file mode 100644 index 0000000000000..1699cfdd3af2e --- /dev/null +++ b/test/e2e/instrumentation-hook/instrumentation-hook.test.ts @@ -0,0 +1,37 @@ +import { createNextDescribe } from 'e2e-utils' +import { check } from 'next-test-utils' + +createNextDescribe( + 'instrumentation-hook', + { + files: __dirname, + }, + ({ next, isNextDev }) => { + it('should run the instrumentation hook', async () => { + await next.render('/') + const stdout = await next.cliOutput + console.log(stdout) + expect(stdout).toInclude('instrumentation hook') + }) + it('should not overlap with a instrumentation page', async () => { + const page = await next.render('/instrumentation') + expect(page).toContain('Hello') + }) + it('should run the edge instrumentation compiled version with the edge runtime', async () => { + await next.render('/edge') + const stdout = await next.cliOutput + console.log(stdout) + expect(stdout).toInclude('instrumentation hook on the edge') + }) + if (isNextDev) { + it('should reload the server when the instrumentation hook changes', async () => { + await next.render('/') + await next.patchFile( + './instrumentation.js', + `export function register() {console.log('toast')}` + ) + await check(() => next.cliOutput, /toast/) + }) + } + } +) diff --git a/test/e2e/instrumentation-hook/instrumentation.js b/test/e2e/instrumentation-hook/instrumentation.js new file mode 100644 index 0000000000000..0f656113a2f0a --- /dev/null +++ b/test/e2e/instrumentation-hook/instrumentation.js @@ -0,0 +1,7 @@ +export function register() { + if (process.env.NEXT_RUNTIME === 'edge') { + console.log('instrumentation hook on the edge') + } else { + console.log('instrumentation hook') + } +} diff --git a/test/e2e/instrumentation-hook/pages/edge.tsx b/test/e2e/instrumentation-hook/pages/edge.tsx new file mode 100644 index 0000000000000..f1b1be4b3ed55 --- /dev/null +++ b/test/e2e/instrumentation-hook/pages/edge.tsx @@ -0,0 +1,15 @@ +import React from 'react' + +export default function EdgePage() { + return
Edge Page
+} + +export const config = { + runtime: 'experimental-edge', +} + +export function getServerSideProps() { + return { + props: {}, + } +} diff --git a/test/e2e/instrumentation-hook/pages/index.tsx b/test/e2e/instrumentation-hook/pages/index.tsx new file mode 100644 index 0000000000000..ff7159d9149fe --- /dev/null +++ b/test/e2e/instrumentation-hook/pages/index.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return

hello world

+} diff --git a/test/e2e/instrumentation-hook/pages/instrumentation.tsx b/test/e2e/instrumentation-hook/pages/instrumentation.tsx new file mode 100644 index 0000000000000..5d53bd77f7f0f --- /dev/null +++ b/test/e2e/instrumentation-hook/pages/instrumentation.tsx @@ -0,0 +1,3 @@ +export default function Hello() { + return
Hello
+} From 8b7e859650266383f7d8b9296a623bc5f0602408 Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Mon, 20 Feb 2023 10:04:30 +0100 Subject: [PATCH 13/37] add initial implem --- examples/with-opentelemetry/.gitignore | 36 + examples/with-opentelemetry/README.md | 30 + .../with-opentelemetry/instrumentation.js | 63 + examples/with-opentelemetry/package.json | 27 + examples/with-opentelemetry/pages/index.tsx | 29 + .../with-opentelemetry/pages/preact-stars.tsx | 22 + examples/with-opentelemetry/tsconfig.json | 20 + examples/with-opentelemetry/types/github.d.ts | 10 + packages/next/package.json | 3 + .../src/compiled/@opentelemetry/api/LICENSE | 201 +++ .../src/compiled/@opentelemetry/api/index.js | 1 + .../compiled/@opentelemetry/api/package.json | 1 + .../compiled/webpack/lazy-compilation-node.js | 41 +- .../compiled/webpack/lazy-compilation-web.js | 75 +- .../next/src/server/lib/trace/constants.ts | 87 + packages/next/src/server/lib/trace/tracer.ts | 43 + packages/next/src/server/next.ts | 12 +- packages/next/taskfile.js | 12 + packages/next/types/misc.d.ts | 5 + pnpm-lock.yaml | 1406 ++++++++++++++++- test/e2e/instrumentation-hook/app/layout.tsx | 0 21 files changed, 1962 insertions(+), 162 deletions(-) create mode 100644 examples/with-opentelemetry/.gitignore create mode 100644 examples/with-opentelemetry/README.md create mode 100644 examples/with-opentelemetry/instrumentation.js create mode 100644 examples/with-opentelemetry/package.json create mode 100644 examples/with-opentelemetry/pages/index.tsx create mode 100644 examples/with-opentelemetry/pages/preact-stars.tsx create mode 100644 examples/with-opentelemetry/tsconfig.json create mode 100644 examples/with-opentelemetry/types/github.d.ts create mode 100644 packages/next/src/compiled/@opentelemetry/api/LICENSE create mode 100644 packages/next/src/compiled/@opentelemetry/api/index.js create mode 100644 packages/next/src/compiled/@opentelemetry/api/package.json create mode 100644 packages/next/src/server/lib/trace/constants.ts create mode 100644 packages/next/src/server/lib/trace/tracer.ts create mode 100644 test/e2e/instrumentation-hook/app/layout.tsx diff --git a/examples/with-opentelemetry/.gitignore b/examples/with-opentelemetry/.gitignore new file mode 100644 index 0000000000000..c87c9b392c020 --- /dev/null +++ b/examples/with-opentelemetry/.gitignore @@ -0,0 +1,36 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# local env files +.env*.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts diff --git a/examples/with-opentelemetry/README.md b/examples/with-opentelemetry/README.md new file mode 100644 index 0000000000000..b3adf6aef5fbf --- /dev/null +++ b/examples/with-opentelemetry/README.md @@ -0,0 +1,30 @@ +# Data fetch example + +Next.js was conceived to make it easy to create universal apps. That's why fetching data +on the server and the client when necessary is so easy with Next.js. + +By using `getStaticProps` Next.js will fetch data at build time from a page, and pre-render the page to static assets. + +## Deploy your own + +Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/data-fetch) + +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/data-fetch&project-name=data-fetch&repository-name=data-fetch) + +## How to use + +Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example: + +```bash +npx create-next-app --example data-fetch data-fetch-app +``` + +```bash +yarn create next-app --example data-fetch data-fetch-app +``` + +```bash +pnpm create next-app --example data-fetch data-fetch-app +``` + +Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)). diff --git a/examples/with-opentelemetry/instrumentation.js b/examples/with-opentelemetry/instrumentation.js new file mode 100644 index 0000000000000..b898b0759b7ec --- /dev/null +++ b/examples/with-opentelemetry/instrumentation.js @@ -0,0 +1,63 @@ +export function register() { + if (process.env.NEXT_RUNTIME === 'nodejs') { + // const opentelemetry = require('@opentelemetry/sdk-node') + // // const { + // // getNodeAutoInstrumentations, + // // } = require('@opentelemetry/auto-instrumentations-node') + + // const { + // OTLPTraceExporter, + // } = require('@opentelemetry/exporter-trace-otlp-http') + // const { + // BasicTracerProvider, + // ConsoleSpanExporter, + // SimpleSpanProcessor, + // } = require('@opentelemetry/sdk-trace-base') + + // const sdk = new opentelemetry.NodeSDK({ + // traceExporter: new OTLPTraceExporter(), + // instrumentations: [], + // }) + + // sdk. + // const { + // registerInstrumentations, + // } = require('@opentelemetry/instrumentation') + // const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node') + + // Create and configure NodeTracerProvider + // const provider = new NodeTracerProvider({ + // traceExporter: [new ConsoleSpanExporter()], + // }) + + // Initialize the provider + // provider.register() + + // register and load instrumentation and old plugins - old plugins will be loaded automatically as previously + // but instrumentations needs to be added + // registerInstrumentations({}) + const opentelemetry = require('@opentelemetry/sdk-node') + // const { + // getNodeAutoInstrumentations, + // } = require('@opentelemetry/auto-instrumentations-node') + const { + OTLPTraceExporter, + } = require('@opentelemetry/exporter-trace-otlp-http') + const { Resource } = require('@opentelemetry/resources') + const { + SemanticResourceAttributes, + } = require('@opentelemetry/semantic-conventions') + const sdk = new opentelemetry.NodeSDK({ + traceExporter: new OTLPTraceExporter({ + // optional - collection of custom headers to be sent with each request, empty by default + headers: {}, + }), + instrumentations: [], + resource: new Resource({ + [SemanticResourceAttributes.SERVICE_NAME]: 'next-app', + }), + }) + sdk.start() + console.log('registered') + } +} diff --git a/examples/with-opentelemetry/package.json b/examples/with-opentelemetry/package.json new file mode 100644 index 0000000000000..ec73f082ddfcf --- /dev/null +++ b/examples/with-opentelemetry/package.json @@ -0,0 +1,27 @@ +{ + "private": true, + "scripts": { + "dev": "next", + "build": "next build", + "start": "next start" + }, + "dependencies": { + "@opentelemetry/api": "1.4.0", + "@opentelemetry/auto-instrumentations-node": "0.36.3", + "@opentelemetry/exporter-trace-otlp-grpc": "0.35.1", + "@opentelemetry/exporter-trace-otlp-http": "0.35.1", + "@opentelemetry/instrumentation-fetch": "0.35.1", + "@opentelemetry/resources": "1.9.1", + "@opentelemetry/sdk-node": "0.35.1", + "@opentelemetry/sdk-trace-base": "1.9.1", + "@opentelemetry/semantic-conventions": "1.9.1", + "next": "latest", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@types/node": "18.7.11", + "@types/react": "18.0.17", + "typescript": "4.7.4" + } +} diff --git a/examples/with-opentelemetry/pages/index.tsx b/examples/with-opentelemetry/pages/index.tsx new file mode 100644 index 0000000000000..864de565917f4 --- /dev/null +++ b/examples/with-opentelemetry/pages/index.tsx @@ -0,0 +1,29 @@ +import Link from 'next/link' +import type { InferGetStaticPropsType } from 'next' +import type { Repository } from '../types/github' + +// @ts-ignore +import api from '@opentelemetry/api' + +export async function getServerSideProps() { + const tracer = api.trace.getTracer('nextjs-example') + const span = tracer.startSpan('getServerSideProps') + + const res = await fetch('https://api.github.com/repos/vercel/next.js') + const data: Repository = await res.json() + span.end() + return { + props: { + stars: data.stargazers_count, + }, + } +} + +export default function IndexPage({ stars }) { + return ( + <> +

Next.js has {stars} ⭐️

+ How about preact? + + ) +} diff --git a/examples/with-opentelemetry/pages/preact-stars.tsx b/examples/with-opentelemetry/pages/preact-stars.tsx new file mode 100644 index 0000000000000..c4fab49bd47b9 --- /dev/null +++ b/examples/with-opentelemetry/pages/preact-stars.tsx @@ -0,0 +1,22 @@ +import Link from 'next/link' +import type { InferGetStaticPropsType } from 'next' +import type { Repository } from '../types/github' + +export async function getServerSideProps() { + const res = await fetch('https://api.github.com/repos/preactjs/preact') + const json: Repository = await res.json() + return { + props: { + stars: json.stargazers_count, + }, + } +} + +export default function PreactStarsPage({ stars }) { + return ( + <> +

Preact has {stars} ⭐

+ I bet Next.js has more stars (?) + + ) +} diff --git a/examples/with-opentelemetry/tsconfig.json b/examples/with-opentelemetry/tsconfig.json new file mode 100644 index 0000000000000..b8d597880a1ae --- /dev/null +++ b/examples/with-opentelemetry/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": false, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] +} diff --git a/examples/with-opentelemetry/types/github.d.ts b/examples/with-opentelemetry/types/github.d.ts new file mode 100644 index 0000000000000..1d373d98bc27e --- /dev/null +++ b/examples/with-opentelemetry/types/github.d.ts @@ -0,0 +1,10 @@ +// For simplicity we are creating our own types here. +// If you want the full types check out: +// https://github.com/octokit/openapi-types.ts +export type Repository = { + id: number + name: string + full_name: string + stargazers_count: number + private: boolean +} & Record diff --git a/packages/next/package.json b/packages/next/package.json index ec947d2c746f5..f5540b4019f88 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -86,6 +86,9 @@ "postcss": "8.4.14", "styled-jsx": "5.1.1" }, + "optionalDependencies": { + "@opentelemetry/api": "1.4.0" + }, "peerDependencies": { "fibers": ">= 3.1.0", "node-sass": "^6.0.0 || ^7.0.0", diff --git a/packages/next/src/compiled/@opentelemetry/api/LICENSE b/packages/next/src/compiled/@opentelemetry/api/LICENSE new file mode 100644 index 0000000000000..261eeb9e9f8b2 --- /dev/null +++ b/packages/next/src/compiled/@opentelemetry/api/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/next/src/compiled/@opentelemetry/api/index.js b/packages/next/src/compiled/@opentelemetry/api/index.js new file mode 100644 index 0000000000000..ad40c24a1ec83 --- /dev/null +++ b/packages/next/src/compiled/@opentelemetry/api/index.js @@ -0,0 +1 @@ +(()=>{"use strict";var e={959:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.ContextAPI=void 0;const n=r(190);const a=r(83);const o=r(669);const i="context";const c=new n.NoopContextManager;class ContextAPI{constructor(){}static getInstance(){if(!this._instance){this._instance=new ContextAPI}return this._instance}setGlobalContextManager(e){return(0,a.registerGlobal)(i,e,o.DiagAPI.instance())}active(){return this._getContextManager().active()}with(e,t,r,...n){return this._getContextManager().with(e,t,r,...n)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return(0,a.getGlobal)(i)||c}disable(){this._getContextManager().disable();(0,a.unregisterGlobal)(i,o.DiagAPI.instance())}}t.ContextAPI=ContextAPI},669:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.DiagAPI=void 0;const n=r(908);const a=r(802);const o=r(963);const i=r(83);const c="diag";class DiagAPI{constructor(){function _logProxy(e){return function(...t){const r=(0,i.getGlobal)("diag");if(!r)return;return r[e](...t)}}const e=this;const setLogger=(t,r={logLevel:o.DiagLogLevel.INFO})=>{var n,c,s;if(t===e){const t=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");e.error((n=t.stack)!==null&&n!==void 0?n:t.message);return false}if(typeof r==="number"){r={logLevel:r}}const u=(0,i.getGlobal)("diag");const l=(0,a.createLogLevelDiagLogger)((c=r.logLevel)!==null&&c!==void 0?c:o.DiagLogLevel.INFO,t);if(u&&!r.suppressOverrideMessage){const e=(s=(new Error).stack)!==null&&s!==void 0?s:"";u.warn(`Current logger will be overwritten from ${e}`);l.warn(`Current logger will overwrite one already registered from ${e}`)}return(0,i.registerGlobal)("diag",l,e,true)};e.setLogger=setLogger;e.disable=()=>{(0,i.unregisterGlobal)(c,e)};e.createComponentLogger=e=>new n.DiagComponentLogger(e);e.verbose=_logProxy("verbose");e.debug=_logProxy("debug");e.info=_logProxy("info");e.warn=_logProxy("warn");e.error=_logProxy("error")}static instance(){if(!this._instance){this._instance=new DiagAPI}return this._instance}}t.DiagAPI=DiagAPI},680:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.MetricsAPI=void 0;const n=r(429);const a=r(83);const o=r(669);const i="metrics";class MetricsAPI{constructor(){}static getInstance(){if(!this._instance){this._instance=new MetricsAPI}return this._instance}setGlobalMeterProvider(e){return(0,a.registerGlobal)(i,e,o.DiagAPI.instance())}getMeterProvider(){return(0,a.getGlobal)(i)||n.NOOP_METER_PROVIDER}getMeter(e,t,r){return this.getMeterProvider().getMeter(e,t,r)}disable(){(0,a.unregisterGlobal)(i,o.DiagAPI.instance())}}t.MetricsAPI=MetricsAPI},425:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.PropagationAPI=void 0;const n=r(83);const a=r(528);const o=r(675);const i=r(409);const c=r(957);const s=r(669);const u="propagation";const l=new a.NoopTextMapPropagator;class PropagationAPI{constructor(){this.createBaggage=c.createBaggage;this.getBaggage=i.getBaggage;this.getActiveBaggage=i.getActiveBaggage;this.setBaggage=i.setBaggage;this.deleteBaggage=i.deleteBaggage}static getInstance(){if(!this._instance){this._instance=new PropagationAPI}return this._instance}setGlobalPropagator(e){return(0,n.registerGlobal)(u,e,s.DiagAPI.instance())}inject(e,t,r=o.defaultTextMapSetter){return this._getGlobalPropagator().inject(e,t,r)}extract(e,t,r=o.defaultTextMapGetter){return this._getGlobalPropagator().extract(e,t,r)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,n.unregisterGlobal)(u,s.DiagAPI.instance())}_getGlobalPropagator(){return(0,n.getGlobal)(u)||l}}t.PropagationAPI=PropagationAPI},463:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.TraceAPI=void 0;const n=r(83);const a=r(743);const o=r(566);const i=r(54);const c=r(669);const s="trace";class TraceAPI{constructor(){this._proxyTracerProvider=new a.ProxyTracerProvider;this.wrapSpanContext=o.wrapSpanContext;this.isSpanContextValid=o.isSpanContextValid;this.deleteSpan=i.deleteSpan;this.getSpan=i.getSpan;this.getActiveSpan=i.getActiveSpan;this.getSpanContext=i.getSpanContext;this.setSpan=i.setSpan;this.setSpanContext=i.setSpanContext}static getInstance(){if(!this._instance){this._instance=new TraceAPI}return this._instance}setGlobalTracerProvider(e){const t=(0,n.registerGlobal)(s,this._proxyTracerProvider,c.DiagAPI.instance());if(t){this._proxyTracerProvider.setDelegate(e)}return t}getTracerProvider(){return(0,n.getGlobal)(s)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){(0,n.unregisterGlobal)(s,c.DiagAPI.instance());this._proxyTracerProvider=new a.ProxyTracerProvider}}t.TraceAPI=TraceAPI},409:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.deleteBaggage=t.setBaggage=t.getActiveBaggage=t.getBaggage=void 0;const n=r(959);const a=r(12);const o=(0,a.createContextKey)("OpenTelemetry Baggage Key");function getBaggage(e){return e.getValue(o)||undefined}t.getBaggage=getBaggage;function getActiveBaggage(){return getBaggage(n.ContextAPI.getInstance().active())}t.getActiveBaggage=getActiveBaggage;function setBaggage(e,t){return e.setValue(o,t)}t.setBaggage=setBaggage;function deleteBaggage(e){return e.deleteValue(o)}t.deleteBaggage=deleteBaggage},37:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.BaggageImpl=void 0;class BaggageImpl{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){const t=this._entries.get(e);if(!t){return undefined}return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries()).map((([e,t])=>[e,t]))}setEntry(e,t){const r=new BaggageImpl(this._entries);r._entries.set(e,t);return r}removeEntry(e){const t=new BaggageImpl(this._entries);t._entries.delete(e);return t}removeEntries(...e){const t=new BaggageImpl(this._entries);for(const r of e){t._entries.delete(r)}return t}clear(){return new BaggageImpl}}t.BaggageImpl=BaggageImpl},714:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.baggageEntryMetadataSymbol=void 0;t.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")},957:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.baggageEntryMetadataFromString=t.createBaggage=void 0;const n=r(669);const a=r(37);const o=r(714);const i=n.DiagAPI.instance();function createBaggage(e={}){return new a.BaggageImpl(new Map(Object.entries(e)))}t.createBaggage=createBaggage;function baggageEntryMetadataFromString(e){if(typeof e!=="string"){i.error(`Cannot create baggage metadata from unknown type: ${typeof e}`);e=""}return{__TYPE__:o.baggageEntryMetadataSymbol,toString(){return e}}}t.baggageEntryMetadataFromString=baggageEntryMetadataFromString},493:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.context=void 0;const n=r(959);t.context=n.ContextAPI.getInstance()},190:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.NoopContextManager=void 0;const n=r(12);class NoopContextManager{active(){return n.ROOT_CONTEXT}with(e,t,r,...n){return t.call(r,...n)}bind(e,t){return t}enable(){return this}disable(){return this}}t.NoopContextManager=NoopContextManager},12:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.ROOT_CONTEXT=t.createContextKey=void 0;function createContextKey(e){return Symbol.for(e)}t.createContextKey=createContextKey;class BaseContext{constructor(e){const t=this;t._currentContext=e?new Map(e):new Map;t.getValue=e=>t._currentContext.get(e);t.setValue=(e,r)=>{const n=new BaseContext(t._currentContext);n._currentContext.set(e,r);return n};t.deleteValue=e=>{const r=new BaseContext(t._currentContext);r._currentContext.delete(e);return r}}}t.ROOT_CONTEXT=new BaseContext},305:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.diag=void 0;const n=r(669);t.diag=n.DiagAPI.instance()},908:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.DiagComponentLogger=void 0;const n=r(83);class DiagComponentLogger{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return logProxy("debug",this._namespace,e)}error(...e){return logProxy("error",this._namespace,e)}info(...e){return logProxy("info",this._namespace,e)}warn(...e){return logProxy("warn",this._namespace,e)}verbose(...e){return logProxy("verbose",this._namespace,e)}}t.DiagComponentLogger=DiagComponentLogger;function logProxy(e,t,r){const a=(0,n.getGlobal)("diag");if(!a){return}r.unshift(t);return a[e](...r)}},479:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.DiagConsoleLogger=void 0;const r=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class DiagConsoleLogger{constructor(){function _consoleFunc(e){return function(...t){if(console){let r=console[e];if(typeof r!=="function"){r=console.log}if(typeof r==="function"){return r.apply(console,t)}}}}for(let e=0;e{Object.defineProperty(t,"__esModule",{value:true});t.createLogLevelDiagLogger=void 0;const n=r(963);function createLogLevelDiagLogger(e,t){if(en.DiagLogLevel.ALL){e=n.DiagLogLevel.ALL}t=t||{};function _filterFunc(r,n){const a=t[r];if(typeof a==="function"&&e>=n){return a.bind(t)}return function(){}}return{error:_filterFunc("error",n.DiagLogLevel.ERROR),warn:_filterFunc("warn",n.DiagLogLevel.WARN),info:_filterFunc("info",n.DiagLogLevel.INFO),debug:_filterFunc("debug",n.DiagLogLevel.DEBUG),verbose:_filterFunc("verbose",n.DiagLogLevel.VERBOSE)}}t.createLogLevelDiagLogger=createLogLevelDiagLogger},963:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.DiagLogLevel=void 0;var r;(function(e){e[e["NONE"]=0]="NONE";e[e["ERROR"]=30]="ERROR";e[e["WARN"]=50]="WARN";e[e["INFO"]=60]="INFO";e[e["DEBUG"]=70]="DEBUG";e[e["VERBOSE"]=80]="VERBOSE";e[e["ALL"]=9999]="ALL"})(r=t.DiagLogLevel||(t.DiagLogLevel={}))},83:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.unregisterGlobal=t.getGlobal=t.registerGlobal=void 0;const n=r(287);const a=r(236);const o=r(381);const i=a.VERSION.split(".")[0];const c=Symbol.for(`opentelemetry.js.api.${i}`);const s=n._globalThis;function registerGlobal(e,t,r,n=false){var o;const i=s[c]=(o=s[c])!==null&&o!==void 0?o:{version:a.VERSION};if(!n&&i[e]){const t=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);r.error(t.stack||t.message);return false}if(i.version!==a.VERSION){const e=new Error("@opentelemetry/api: All API registration versions must match");r.error(e.stack||e.message);return false}i[e]=t;r.debug(`@opentelemetry/api: Registered a global for ${e} v${a.VERSION}.`);return true}t.registerGlobal=registerGlobal;function getGlobal(e){var t,r;const n=(t=s[c])===null||t===void 0?void 0:t.version;if(!n||!(0,o.isCompatible)(n)){return}return(r=s[c])===null||r===void 0?void 0:r[e]}t.getGlobal=getGlobal;function unregisterGlobal(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${a.VERSION}.`);const r=s[c];if(r){delete r[e]}}t.unregisterGlobal=unregisterGlobal},381:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.isCompatible=t._makeCompatibilityCheck=void 0;const n=r(236);const a=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function _makeCompatibilityCheck(e){const t=new Set([e]);const r=new Set;const n=e.match(a);if(!n){return()=>false}const o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(o.prerelease!=null){return function isExactmatch(t){return t===e}}function _reject(e){r.add(e);return false}function _accept(e){t.add(e);return true}return function isCompatible(e){if(t.has(e)){return true}if(r.has(e)){return false}const n=e.match(a);if(!n){return _reject(e)}const i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null){return _reject(e)}if(o.major!==i.major){return _reject(e)}if(o.major===0){if(o.minor===i.minor&&o.patch<=i.patch){return _accept(e)}return _reject(e)}if(o.minor<=i.minor){return _accept(e)}return _reject(e)}}t._makeCompatibilityCheck=_makeCompatibilityCheck;t.isCompatible=_makeCompatibilityCheck(n.VERSION)},39:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.metrics=void 0;const n=r(680);t.metrics=n.MetricsAPI.getInstance()},770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.ValueType=void 0;var r;(function(e){e[e["INT"]=0]="INT";e[e["DOUBLE"]=1]="DOUBLE"})(r=t.ValueType||(t.ValueType={}))},745:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.createNoopMeter=t.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=t.NOOP_OBSERVABLE_GAUGE_METRIC=t.NOOP_OBSERVABLE_COUNTER_METRIC=t.NOOP_UP_DOWN_COUNTER_METRIC=t.NOOP_HISTOGRAM_METRIC=t.NOOP_COUNTER_METRIC=t.NOOP_METER=t.NoopObservableUpDownCounterMetric=t.NoopObservableGaugeMetric=t.NoopObservableCounterMetric=t.NoopObservableMetric=t.NoopHistogramMetric=t.NoopUpDownCounterMetric=t.NoopCounterMetric=t.NoopMetric=t.NoopMeter=void 0;class NoopMeter{constructor(){}createHistogram(e,r){return t.NOOP_HISTOGRAM_METRIC}createCounter(e,r){return t.NOOP_COUNTER_METRIC}createUpDownCounter(e,r){return t.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(e,r){return t.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(e,r){return t.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(e,r){return t.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}}t.NoopMeter=NoopMeter;class NoopMetric{}t.NoopMetric=NoopMetric;class NoopCounterMetric extends NoopMetric{add(e,t){}}t.NoopCounterMetric=NoopCounterMetric;class NoopUpDownCounterMetric extends NoopMetric{add(e,t){}}t.NoopUpDownCounterMetric=NoopUpDownCounterMetric;class NoopHistogramMetric extends NoopMetric{record(e,t){}}t.NoopHistogramMetric=NoopHistogramMetric;class NoopObservableMetric{addCallback(e){}removeCallback(e){}}t.NoopObservableMetric=NoopObservableMetric;class NoopObservableCounterMetric extends NoopObservableMetric{}t.NoopObservableCounterMetric=NoopObservableCounterMetric;class NoopObservableGaugeMetric extends NoopObservableMetric{}t.NoopObservableGaugeMetric=NoopObservableGaugeMetric;class NoopObservableUpDownCounterMetric extends NoopObservableMetric{}t.NoopObservableUpDownCounterMetric=NoopObservableUpDownCounterMetric;t.NOOP_METER=new NoopMeter;t.NOOP_COUNTER_METRIC=new NoopCounterMetric;t.NOOP_HISTOGRAM_METRIC=new NoopHistogramMetric;t.NOOP_UP_DOWN_COUNTER_METRIC=new NoopUpDownCounterMetric;t.NOOP_OBSERVABLE_COUNTER_METRIC=new NoopObservableCounterMetric;t.NOOP_OBSERVABLE_GAUGE_METRIC=new NoopObservableGaugeMetric;t.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new NoopObservableUpDownCounterMetric;function createNoopMeter(){return t.NOOP_METER}t.createNoopMeter=createNoopMeter},429:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.NOOP_METER_PROVIDER=t.NoopMeterProvider=void 0;const n=r(745);class NoopMeterProvider{getMeter(e,t,r){return n.NOOP_METER}}t.NoopMeterProvider=NoopMeterProvider;t.NOOP_METER_PROVIDER=new NoopMeterProvider},287:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var a=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))n(t,e,r)};Object.defineProperty(t,"__esModule",{value:true});a(r(951),t)},542:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t._globalThis=void 0;t._globalThis=typeof globalThis==="object"?globalThis:global},951:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var a=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))n(t,e,r)};Object.defineProperty(t,"__esModule",{value:true});a(r(542),t)},282:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.propagation=void 0;const n=r(425);t.propagation=n.PropagationAPI.getInstance()},528:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.NoopTextMapPropagator=void 0;class NoopTextMapPropagator{inject(e,t){}extract(e,t){return e}fields(){return[]}}t.NoopTextMapPropagator=NoopTextMapPropagator},675:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.defaultTextMapSetter=t.defaultTextMapGetter=void 0;t.defaultTextMapGetter={get(e,t){if(e==null){return undefined}return e[t]},keys(e){if(e==null){return[]}return Object.keys(e)}};t.defaultTextMapSetter={set(e,t,r){if(e==null){return}e[t]=r}}},873:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.trace=void 0;const n=r(463);t.trace=n.TraceAPI.getInstance()},115:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.NonRecordingSpan=void 0;const n=r(212);class NonRecordingSpan{constructor(e=n.INVALID_SPAN_CONTEXT){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return false}recordException(e,t){}}t.NonRecordingSpan=NonRecordingSpan},796:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.NoopTracer=void 0;const n=r(959);const a=r(54);const o=r(115);const i=r(566);const c=n.ContextAPI.getInstance();class NoopTracer{startSpan(e,t,r=c.active()){const n=Boolean(t===null||t===void 0?void 0:t.root);if(n){return new o.NonRecordingSpan}const s=r&&(0,a.getSpanContext)(r);if(isSpanContext(s)&&(0,i.isSpanContextValid)(s)){return new o.NonRecordingSpan(s)}else{return new o.NonRecordingSpan}}startActiveSpan(e,t,r,n){let o;let i;let s;if(arguments.length<2){return}else if(arguments.length===2){s=t}else if(arguments.length===3){o=t;s=r}else{o=t;i=r;s=n}const u=i!==null&&i!==void 0?i:c.active();const l=this.startSpan(e,o,u);const g=(0,a.setSpan)(u,l);return c.with(g,s,undefined,l)}}t.NoopTracer=NoopTracer;function isSpanContext(e){return typeof e==="object"&&typeof e["spanId"]==="string"&&typeof e["traceId"]==="string"&&typeof e["traceFlags"]==="number"}},69:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.NoopTracerProvider=void 0;const n=r(796);class NoopTracerProvider{getTracer(e,t,r){return new n.NoopTracer}}t.NoopTracerProvider=NoopTracerProvider},889:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.ProxyTracer=void 0;const n=r(796);const a=new n.NoopTracer;class ProxyTracer{constructor(e,t,r,n){this._provider=e;this.name=t;this.version=r;this.options=n}startSpan(e,t,r){return this._getTracer().startSpan(e,t,r)}startActiveSpan(e,t,r,n){const a=this._getTracer();return Reflect.apply(a.startActiveSpan,a,arguments)}_getTracer(){if(this._delegate){return this._delegate}const e=this._provider.getDelegateTracer(this.name,this.version,this.options);if(!e){return a}this._delegate=e;return this._delegate}}t.ProxyTracer=ProxyTracer},743:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.ProxyTracerProvider=void 0;const n=r(889);const a=r(69);const o=new a.NoopTracerProvider;class ProxyTracerProvider{getTracer(e,t,r){var a;return(a=this.getDelegateTracer(e,t,r))!==null&&a!==void 0?a:new n.ProxyTracer(this,e,t,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:o}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,r){var n;return(n=this._delegate)===null||n===void 0?void 0:n.getTracer(e,t,r)}}t.ProxyTracerProvider=ProxyTracerProvider},847:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.SamplingDecision=void 0;var r;(function(e){e[e["NOT_RECORD"]=0]="NOT_RECORD";e[e["RECORD"]=1]="RECORD";e[e["RECORD_AND_SAMPLED"]=2]="RECORD_AND_SAMPLED"})(r=t.SamplingDecision||(t.SamplingDecision={}))},54:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.getSpanContext=t.setSpanContext=t.deleteSpan=t.setSpan=t.getActiveSpan=t.getSpan=void 0;const n=r(12);const a=r(115);const o=r(959);const i=(0,n.createContextKey)("OpenTelemetry Context Key SPAN");function getSpan(e){return e.getValue(i)||undefined}t.getSpan=getSpan;function getActiveSpan(){return getSpan(o.ContextAPI.getInstance().active())}t.getActiveSpan=getActiveSpan;function setSpan(e,t){return e.setValue(i,t)}t.setSpan=setSpan;function deleteSpan(e){return e.deleteValue(i)}t.deleteSpan=deleteSpan;function setSpanContext(e,t){return setSpan(e,new a.NonRecordingSpan(t))}t.setSpanContext=setSpanContext;function getSpanContext(e){var t;return(t=getSpan(e))===null||t===void 0?void 0:t.spanContext()}t.getSpanContext=getSpanContext},79:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.TraceStateImpl=void 0;const n=r(825);const a=32;const o=512;const i=",";const c="=";class TraceStateImpl{constructor(e){this._internalState=new Map;if(e)this._parse(e)}set(e,t){const r=this._clone();if(r._internalState.has(e)){r._internalState.delete(e)}r._internalState.set(e,t);return r}unset(e){const t=this._clone();t._internalState.delete(e);return t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce(((e,t)=>{e.push(t+c+this.get(t));return e}),[]).join(i)}_parse(e){if(e.length>o)return;this._internalState=e.split(i).reverse().reduce(((e,t)=>{const r=t.trim();const a=r.indexOf(c);if(a!==-1){const o=r.slice(0,a);const i=r.slice(a+1,t.length);if((0,n.validateKey)(o)&&(0,n.validateValue)(i)){e.set(o,i)}else{}}return e}),new Map);if(this._internalState.size>a){this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,a))}}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const e=new TraceStateImpl;e._internalState=new Map(this._internalState);return e}}t.TraceStateImpl=TraceStateImpl},825:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.validateValue=t.validateKey=void 0;const r="[_0-9a-z-*/]";const n=`[a-z]${r}{0,255}`;const a=`[a-z0-9]${r}{0,240}@[a-z]${r}{0,13}`;const o=new RegExp(`^(?:${n}|${a})$`);const i=/^[ -~]{0,255}[!-~]$/;const c=/,|=/;function validateKey(e){return o.test(e)}t.validateKey=validateKey;function validateValue(e){return i.test(e)&&!c.test(e)}t.validateValue=validateValue},339:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.createTraceState=void 0;const n=r(79);function createTraceState(e){return new n.TraceStateImpl(e)}t.createTraceState=createTraceState},212:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.INVALID_SPAN_CONTEXT=t.INVALID_TRACEID=t.INVALID_SPANID=void 0;const n=r(785);t.INVALID_SPANID="0000000000000000";t.INVALID_TRACEID="00000000000000000000000000000000";t.INVALID_SPAN_CONTEXT={traceId:t.INVALID_TRACEID,spanId:t.INVALID_SPANID,traceFlags:n.TraceFlags.NONE}},155:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.SpanKind=void 0;var r;(function(e){e[e["INTERNAL"]=0]="INTERNAL";e[e["SERVER"]=1]="SERVER";e[e["CLIENT"]=2]="CLIENT";e[e["PRODUCER"]=3]="PRODUCER";e[e["CONSUMER"]=4]="CONSUMER"})(r=t.SpanKind||(t.SpanKind={}))},566:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.wrapSpanContext=t.isSpanContextValid=t.isValidSpanId=t.isValidTraceId=void 0;const n=r(212);const a=r(115);const o=/^([0-9a-f]{32})$/i;const i=/^[0-9a-f]{16}$/i;function isValidTraceId(e){return o.test(e)&&e!==n.INVALID_TRACEID}t.isValidTraceId=isValidTraceId;function isValidSpanId(e){return i.test(e)&&e!==n.INVALID_SPANID}t.isValidSpanId=isValidSpanId;function isSpanContextValid(e){return isValidTraceId(e.traceId)&&isValidSpanId(e.spanId)}t.isSpanContextValid=isSpanContextValid;function wrapSpanContext(e){return new a.NonRecordingSpan(e)}t.wrapSpanContext=wrapSpanContext},645:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.SpanStatusCode=void 0;var r;(function(e){e[e["UNSET"]=0]="UNSET";e[e["OK"]=1]="OK";e[e["ERROR"]=2]="ERROR"})(r=t.SpanStatusCode||(t.SpanStatusCode={}))},785:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.TraceFlags=void 0;var r;(function(e){e[e["NONE"]=0]="NONE";e[e["SAMPLED"]=1]="SAMPLED"})(r=t.TraceFlags||(t.TraceFlags={}))},236:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.VERSION=void 0;t.VERSION="1.4.0"}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var a=t[r]={exports:{}};var o=true;try{e[r].call(a.exports,a,a.exports,__nccwpck_require__);o=false}finally{if(o)delete t[r]}return a.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r={};(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:true});e.trace=e.propagation=e.metrics=e.diag=e.context=e.INVALID_SPAN_CONTEXT=e.INVALID_TRACEID=e.INVALID_SPANID=e.isValidSpanId=e.isValidTraceId=e.isSpanContextValid=e.createTraceState=e.TraceFlags=e.SpanStatusCode=e.SpanKind=e.SamplingDecision=e.ProxyTracerProvider=e.ProxyTracer=e.defaultTextMapSetter=e.defaultTextMapGetter=e.ValueType=e.createNoopMeter=e.DiagLogLevel=e.DiagConsoleLogger=e.ROOT_CONTEXT=e.createContextKey=e.baggageEntryMetadataFromString=void 0;var t=__nccwpck_require__(957);Object.defineProperty(e,"baggageEntryMetadataFromString",{enumerable:true,get:function(){return t.baggageEntryMetadataFromString}});var n=__nccwpck_require__(12);Object.defineProperty(e,"createContextKey",{enumerable:true,get:function(){return n.createContextKey}});Object.defineProperty(e,"ROOT_CONTEXT",{enumerable:true,get:function(){return n.ROOT_CONTEXT}});var a=__nccwpck_require__(479);Object.defineProperty(e,"DiagConsoleLogger",{enumerable:true,get:function(){return a.DiagConsoleLogger}});var o=__nccwpck_require__(963);Object.defineProperty(e,"DiagLogLevel",{enumerable:true,get:function(){return o.DiagLogLevel}});var i=__nccwpck_require__(745);Object.defineProperty(e,"createNoopMeter",{enumerable:true,get:function(){return i.createNoopMeter}});var c=__nccwpck_require__(770);Object.defineProperty(e,"ValueType",{enumerable:true,get:function(){return c.ValueType}});var s=__nccwpck_require__(675);Object.defineProperty(e,"defaultTextMapGetter",{enumerable:true,get:function(){return s.defaultTextMapGetter}});Object.defineProperty(e,"defaultTextMapSetter",{enumerable:true,get:function(){return s.defaultTextMapSetter}});var u=__nccwpck_require__(889);Object.defineProperty(e,"ProxyTracer",{enumerable:true,get:function(){return u.ProxyTracer}});var l=__nccwpck_require__(743);Object.defineProperty(e,"ProxyTracerProvider",{enumerable:true,get:function(){return l.ProxyTracerProvider}});var g=__nccwpck_require__(847);Object.defineProperty(e,"SamplingDecision",{enumerable:true,get:function(){return g.SamplingDecision}});var p=__nccwpck_require__(155);Object.defineProperty(e,"SpanKind",{enumerable:true,get:function(){return p.SpanKind}});var _=__nccwpck_require__(645);Object.defineProperty(e,"SpanStatusCode",{enumerable:true,get:function(){return _.SpanStatusCode}});var d=__nccwpck_require__(785);Object.defineProperty(e,"TraceFlags",{enumerable:true,get:function(){return d.TraceFlags}});var f=__nccwpck_require__(339);Object.defineProperty(e,"createTraceState",{enumerable:true,get:function(){return f.createTraceState}});var b=__nccwpck_require__(566);Object.defineProperty(e,"isSpanContextValid",{enumerable:true,get:function(){return b.isSpanContextValid}});Object.defineProperty(e,"isValidTraceId",{enumerable:true,get:function(){return b.isValidTraceId}});Object.defineProperty(e,"isValidSpanId",{enumerable:true,get:function(){return b.isValidSpanId}});var v=__nccwpck_require__(212);Object.defineProperty(e,"INVALID_SPANID",{enumerable:true,get:function(){return v.INVALID_SPANID}});Object.defineProperty(e,"INVALID_TRACEID",{enumerable:true,get:function(){return v.INVALID_TRACEID}});Object.defineProperty(e,"INVALID_SPAN_CONTEXT",{enumerable:true,get:function(){return v.INVALID_SPAN_CONTEXT}});const O=__nccwpck_require__(493);Object.defineProperty(e,"context",{enumerable:true,get:function(){return O.context}});const P=__nccwpck_require__(305);Object.defineProperty(e,"diag",{enumerable:true,get:function(){return P.diag}});const N=__nccwpck_require__(39);Object.defineProperty(e,"metrics",{enumerable:true,get:function(){return N.metrics}});const S=__nccwpck_require__(282);Object.defineProperty(e,"propagation",{enumerable:true,get:function(){return S.propagation}});const C=__nccwpck_require__(873);Object.defineProperty(e,"trace",{enumerable:true,get:function(){return C.trace}});e["default"]={context:O.context,diag:P.diag,metrics:N.metrics,propagation:S.propagation,trace:C.trace}})();module.exports=r})(); \ No newline at end of file diff --git a/packages/next/src/compiled/@opentelemetry/api/package.json b/packages/next/src/compiled/@opentelemetry/api/package.json new file mode 100644 index 0000000000000..8d1e180d1a87a --- /dev/null +++ b/packages/next/src/compiled/@opentelemetry/api/package.json @@ -0,0 +1 @@ +{"name":"@opentelemetry/api","main":"index.js","author":"OpenTelemetry Authors","license":"Apache-2.0"} diff --git a/packages/next/src/compiled/webpack/lazy-compilation-node.js b/packages/next/src/compiled/webpack/lazy-compilation-node.js index 5dd417b7b0ade..2de4b4a177c98 100644 --- a/packages/next/src/compiled/webpack/lazy-compilation-node.js +++ b/packages/next/src/compiled/webpack/lazy-compilation-node.js @@ -1,40 +1 @@ -/* global __resourceQuery */ - -"use strict"; - -var urlBase = decodeURIComponent(__resourceQuery.slice(1)); -exports.keepAlive = function (options) { - var data = options.data; - var onError = options.onError; - var active = options.active; - var module = options.module; - var response; - var request = ( - urlBase.startsWith("https") ? require("https") : require("http") - ).request( - urlBase + data, - { - agent: false, - headers: { accept: "text/event-stream" } - }, - function (res) { - response = res; - response.on("error", errorHandler); - if (!active && !module.hot) { - console.log( - "Hot Module Replacement is not enabled. Waiting for process restart..." - ); - } - } - ); - function errorHandler(err) { - err.message = - "Problem communicating active modules to the server: " + err.message; - onError(err); - } - request.on("error", errorHandler); - request.end(); - return function () { - response.destroy(); - }; -}; +(function(){"use strict";var e={685:function(e){e.exports=require("http")},687:function(e){e.exports=require("https")}};var r={};function __nccwpck_require__(t){var a=r[t];if(a!==undefined){return a.exports}var n=r[t]={exports:{}};var o=true;try{e[t](n,n.exports,__nccwpck_require__);o=false}finally{if(o)delete r[t]}return n.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t={};!function(){var e=t;var r="";var a=decodeURIComponent(r.slice(1));e.keepAlive=function(e){var r=e.data;var t=e.onError;var n=e.active;var o=e.module;var i;var _=(a.startsWith("https")?__nccwpck_require__(687):__nccwpck_require__(685)).request(a+r,{agent:false,headers:{accept:"text/event-stream"}},(function(e){i=e;i.on("error",errorHandler);if(!n&&!o.hot){console.log("Hot Module Replacement is not enabled. Waiting for process restart...")}}));function errorHandler(e){e.message="Problem communicating active modules to the server: "+e.message;t(e)}_.on("error",errorHandler);_.end();return function(){i.destroy()}}}();module.exports=t})(); \ No newline at end of file diff --git a/packages/next/src/compiled/webpack/lazy-compilation-web.js b/packages/next/src/compiled/webpack/lazy-compilation-web.js index 62d955c5a22bf..fda9b32c9b3b2 100644 --- a/packages/next/src/compiled/webpack/lazy-compilation-web.js +++ b/packages/next/src/compiled/webpack/lazy-compilation-web.js @@ -1,74 +1 @@ -/* global __resourceQuery */ - -"use strict"; - -if (typeof EventSource !== "function") { - throw new Error( - "Environment doesn't support lazy compilation (requires EventSource)" - ); -} - -var urlBase = decodeURIComponent(__resourceQuery.slice(1)); -var activeEventSource; -var activeKeys = new Map(); -var errorHandlers = new Set(); - -var updateEventSource = function updateEventSource() { - if (activeEventSource) activeEventSource.close(); - if (activeKeys.size) { - activeEventSource = new EventSource( - urlBase + Array.from(activeKeys.keys()).join("@") - ); - activeEventSource.onerror = function (event) { - errorHandlers.forEach(function (onError) { - onError( - new Error( - "Problem communicating active modules to the server: " + - event.message + - " " + - event.filename + - ":" + - event.lineno + - ":" + - event.colno + - " " + - event.error - ) - ); - }); - }; - } else { - activeEventSource = undefined; - } -}; - -exports.keepAlive = function (options) { - var data = options.data; - var onError = options.onError; - var active = options.active; - var module = options.module; - errorHandlers.add(onError); - var value = activeKeys.get(data) || 0; - activeKeys.set(data, value + 1); - if (value === 0) { - updateEventSource(); - } - if (!active && !module.hot) { - console.log( - "Hot Module Replacement is not enabled. Waiting for process restart..." - ); - } - - return function () { - errorHandlers.delete(onError); - setTimeout(function () { - var value = activeKeys.get(data); - if (value === 1) { - activeKeys.delete(data); - updateEventSource(); - } else { - activeKeys.set(data, value - 1); - } - }, 1000); - }; -}; +(function(){"use strict";if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var e={};!function(){var r=e;var o="";if(typeof EventSource!=="function"){throw new Error("Environment doesn't support lazy compilation (requires EventSource)")}var n=decodeURIComponent(o.slice(1));var t;var i=new Map;var a=new Set;var c=function updateEventSource(){if(t)t.close();if(i.size){t=new EventSource(n+Array.from(i.keys()).join("@"));t.onerror=function(e){a.forEach((function(r){r(new Error("Problem communicating active modules to the server: "+e.message+" "+e.filename+":"+e.lineno+":"+e.colno+" "+e.error))}))}}else{t=undefined}};r.keepAlive=function(e){var r=e.data;var o=e.onError;var n=e.active;var t=e.module;a.add(o);var u=i.get(r)||0;i.set(r,u+1);if(u===0){c()}if(!n&&!t.hot){console.log("Hot Module Replacement is not enabled. Waiting for process restart...")}return function(){a.delete(o);setTimeout((function(){var e=i.get(r);if(e===1){i.delete(r);c()}else{i.set(r,e-1)}}),1e3)}}}();module.exports=e})(); \ No newline at end of file diff --git a/packages/next/src/server/lib/trace/constants.ts b/packages/next/src/server/lib/trace/constants.ts new file mode 100644 index 0000000000000..25b5c143a1633 --- /dev/null +++ b/packages/next/src/server/lib/trace/constants.ts @@ -0,0 +1,87 @@ +/** + * Contains predefined constants for the trace span name in next/server. + * + * Currently, next/server/tracer is internal implementation only for tracking + * next.js's implementation only with known span names defined here. + **/ + +// eslint typescript has a bug with TS enums +/* eslint-disable no-shadow */ + +enum BaseServerSpan { + handleRequest = 'BaseServer.handleRequest', + run = 'BaseServer.run', + pipe = 'BaseServer.pipe', + getStaticHTML = 'BaseServer.getStaticHTML', + render = 'BaseServer.render', + renderToResponseWithComponents = 'BaseServer.renderToResponseWithComponents', + renderToResponse = 'BaseServer.renderToResponse', + renderToHTML = 'BaseServer.renderToHTML', + renderError = 'BaseServer.renderError', + renderErrorToResponse = 'BaseServer.renderErrorToResponse', + renderErrorToHTML = 'BaseServer.renderErrorToHTML', + render404 = 'BaseServer.render404', +} + +enum LoadComponentsSpan { + loadDefaultErrorComponents = 'LoadComponents.loadDefaultErrorComponents', + loadComponents = 'LoadComponents.loadComponents', +} + +enum NextServerSpan { + getRequestHandler = 'NextServer.getRequestHandler', + getServer = 'NextServer.getServer', + getServerRequestHandler = 'NextServer.getServerRequestHandler', + createServer = 'createServer.createServer', +} + +enum NextNodeServerSpan { + compression = 'NextNodeServer.compression', + getBuildId = 'NextNodeServer.getBuildId', + generateStaticRoutes = 'NextNodeServer.generateStaticRoutes', + generateFsStaticRoutes = 'NextNodeServer.generateFsStaticRoutes', + generatePublicRoutes = 'NextNodeServer.generatePublicRoutes', + generateImageRoutes = 'NextNodeServer.generateImageRoutes.route', + sendRenderResult = 'NextNodeServer.sendRenderResult', + sendStatic = 'NextNodeServer.sendStatic', + proxyRequest = 'NextNodeServer.proxyRequest', + runApi = 'NextNodeServer.runApi', + render = 'NextNodeServer.render', + renderHTML = 'NextNodeServer.renderHTML', + imageOptimizer = 'NextNodeServer.imageOptimizer', + getPagePath = 'NextNodeServer.getPagePath', + getRoutesManifest = 'NextNodeServer.getRoutesManifest', + findPageComponents = 'NextNodeServer.findPageComponents', + getFontManifest = 'NextNodeServer.getFontManifest', + getServerComponentManifest = 'NextNodeServer.getServerComponentManifest', + getRequestHandler = 'NextNodeServer.getRequestHandler', + renderToHTML = 'NextNodeServer.renderToHTML', + renderError = 'NextNodeServer.renderError', + renderErrorToHTML = 'NextNodeServer.renderErrorToHTML', + render404 = 'NextNodeServer.render404', + + // nested inner span, does not require parent scope name + route = 'route', + onProxyReq = 'onProxyReq', + apiResolver = 'apiResolver', +} + +enum StartServerSpan { + startServer = 'startServer.startServer', +} + +type SpanNames = + | `${BaseServerSpan}` + | `${LoadComponentsSpan}` + | `${NextServerSpan}` + | `${StartServerSpan}` + | `${NextNodeServerSpan}` + +export { + BaseServerSpan, + LoadComponentsSpan, + NextServerSpan, + NextNodeServerSpan, + StartServerSpan, + SpanNames, +} diff --git a/packages/next/src/server/lib/trace/tracer.ts b/packages/next/src/server/lib/trace/tracer.ts new file mode 100644 index 0000000000000..e3fcd7b260a03 --- /dev/null +++ b/packages/next/src/server/lib/trace/tracer.ts @@ -0,0 +1,43 @@ +// import api, { +// Context, +// diag, +// DiagConsoleLogger, +// DiagLogLevel, +// Span, +// SpanOptions, +// Tracer, +// } from 'next/dist/compiled/@opentelemetry/api' +import { SpanNames } from './constants' + +import type { Context, Span, SpanOptions, Tracer } from '@opentelemetry/api' + +let api: typeof import('@opentelemetry/api') + +try { + api = require('@opentelemetry/api') +} catch (err) { + api = require('next/dist/compiled/@opentelemetry/api') +} + +interface NextTracer extends Tracer { + startSpan(name: SpanNames, options?: SpanOptions, context?: Context): Span + startActiveSpan unknown>( + name: SpanNames, + fn: F + ): ReturnType + startActiveSpan unknown>( + name: SpanNames, + options: SpanOptions, + fn: F + ): ReturnType + startActiveSpan unknown>( + name: SpanNames, + options: SpanOptions, + context: Context, + fn: F + ): ReturnType +} + +export function getTracer(): NextTracer { + return api.trace.getTracer('next.js') +} diff --git a/packages/next/src/server/next.ts b/packages/next/src/server/next.ts index 656a1b844c6fc..ed62a3c3458c2 100644 --- a/packages/next/src/server/next.ts +++ b/packages/next/src/server/next.ts @@ -15,6 +15,8 @@ import { loadRequireHook, overrideBuiltInReactPackages, } from '../build/webpack/require-hook' +import { getTracer } from './lib/trace/tracer' +import { NextServerSpan } from './lib/trace/constants' loadRequireHook() @@ -62,8 +64,14 @@ export class NextServer { res: ServerResponse, parsedUrl?: UrlWithParsedQuery ) => { - const requestHandler = await this.getServerRequestHandler() - return requestHandler(req, res, parsedUrl) + return getTracer().startActiveSpan( + NextServerSpan.getRequestHandler, + async (span) => { + const requestHandler = await this.getServerRequestHandler() + span.end() + return requestHandler(req, res, parsedUrl) + } + ) } } diff --git a/packages/next/taskfile.js b/packages/next/taskfile.js index 1553cdb4b5c37..958c367796ecc 100644 --- a/packages/next/taskfile.js +++ b/packages/next/taskfile.js @@ -2019,6 +2019,17 @@ export async function path_to_regexp(task, opts) { .target('dist/compiled/path-to-regexp') } +// eslint-disable-next-line camelcase +externals['@opentelemetry/api'] = 'next/dist/compiled/@opentelemetry/api' +export async function ncc_opentelemetry_api(task, opts) { + await task + .source( + opts.src || relative(__dirname, require.resolve('@opentelemetry/api')) + ) + .ncc({ packageName: '@opentelemetry/api', externals }) + .target('src/compiled/@opentelemetry/api') +} + export async function precompile(task, opts) { await task.parallel( [ @@ -2151,6 +2162,7 @@ export async function ncc(task, opts) { 'ncc_ua_parser_js', 'ncc_minimatch', 'ncc_mini_css_extract_plugin', + 'ncc_opentelemetry_api', ], opts ) diff --git a/packages/next/types/misc.d.ts b/packages/next/types/misc.d.ts index a7119966cff76..f0fa351a91c5d 100644 --- a/packages/next/types/misc.d.ts +++ b/packages/next/types/misc.d.ts @@ -434,3 +434,8 @@ declare module 'next/dist/compiled/watchpack' { declare module 'next/dist/compiled/is-animated' { export default function isAnimated(buffer: Buffer): boolean } + +declare module 'next/dist/compiled/@opentelemetry/api' { + import * as m from '@opentelemetry/api' + export = m +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c224e06f2bc78..1d8740712b332 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,13 +1,5 @@ lockfileVersion: 5.4 -overrides: - browserslist: 4.20.2 - caniuse-lite: 1.0.30001406 - '@babel/core': 7.18.0 - '@babel/parser': 7.18.0 - '@babel/types': 7.18.0 - '@babel/traverse': 7.18.0 - importers: .: @@ -386,6 +378,41 @@ importers: webpack-bundle-analyzer: 4.6.1 webpack-stats-plugin: 1.1.0 + examples/with-opentelemetry: + specifiers: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/auto-instrumentations-node': 0.36.3 + '@opentelemetry/exporter-trace-otlp-grpc': 0.35.1 + '@opentelemetry/exporter-trace-otlp-http': 0.35.1 + '@opentelemetry/instrumentation-fetch': 0.35.1 + '@opentelemetry/resources': 1.9.1 + '@opentelemetry/sdk-node': 0.35.1 + '@opentelemetry/sdk-trace-base': 1.9.1 + '@opentelemetry/semantic-conventions': 1.9.1 + '@types/node': 18.7.11 + '@types/react': 18.0.17 + next: latest + react: ^18.2.0 + react-dom: ^18.2.0 + typescript: 4.7.4 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/auto-instrumentations-node': 0.36.3_@opentelemetry+api@1.4.0 + '@opentelemetry/exporter-trace-otlp-grpc': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/exporter-trace-otlp-http': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-fetch': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/resources': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-node': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-trace-base': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + next: link:../../packages/next + react: 18.2.0 + react-dom: 18.2.0_react@18.2.0 + devDependencies: + '@types/node': 18.7.11 + '@types/react': 18.0.17 + typescript: 4.7.4 + packages/create-next-app: specifiers: '@types/async-retry': 1.4.2 @@ -517,6 +544,7 @@ importers: '@next/react-dev-overlay': 13.1.7-canary.18 '@next/react-refresh-utils': 13.1.7-canary.18 '@next/swc': 13.1.7-canary.18 + '@opentelemetry/api': 1.4.0 '@segment/ajv-human-errors': 2.1.2 '@swc/helpers': 0.4.14 '@taskr/clear': 1.1.0 @@ -695,6 +723,8 @@ importers: react-dom: 18.2.0_react@18.2.0 sass: 1.54.0 styled-jsx: 5.1.1_uuaxwgga6hqycsez5ok7v2wg4i + optionalDependencies: + '@opentelemetry/api': 1.4.0 devDependencies: '@ampproject/toolbox-optimizer': 2.8.3 '@babel/code-frame': 7.12.11 @@ -4732,6 +4762,14 @@ packages: semver: 6.3.0 dev: true + /@grpc/grpc-js/1.8.9: + resolution: {integrity: sha512-xzsl2HamhovnZddS/2pMF4Q+FgwINaBvxoFGQ+G54Lo7Xsge36VvfDO/TDkL7FofmrRK/X5weRvwlJh7rKwN4w==} + engines: {node: ^8.13.0 || >=10.10.0} + dependencies: + '@grpc/proto-loader': 0.7.5 + '@types/node': 18.11.18 + dev: false + /@grpc/proto-loader/0.5.3: resolution: {integrity: sha512-8qvUtGg77G2ZT2HqdqYoM/OY97gQd/0crSG34xNmZ4ZOsv3aQT/FQV9QfZPazTGna6MIoyUd+u6AxsoZjJ/VMQ==} engines: {node: '>=6'} @@ -4740,6 +4778,18 @@ packages: protobufjs: 6.11.2 dev: true + /@grpc/proto-loader/0.7.5: + resolution: {integrity: sha512-mfcTuMbFowq1wh/Rn5KQl6qb95M21Prej3bewD9dUQMurYGVckGO/Pbe2Ocwto6sD05b/mxZLspvqwx60xO2Rg==} + engines: {node: '>=6'} + hasBin: true + dependencies: + '@types/long': 4.0.1 + lodash.camelcase: 4.3.0 + long: 4.0.0 + protobufjs: 7.2.2 + yargs: 16.2.0 + dev: false + /@hapi/accept/5.0.2: resolution: {integrity: sha512-CmzBx/bXUR8451fnZRuZAJRlzgm0Jgu5dltTX/bszmR2lheb9BpyN47Q1RbaGTsvFzn0PXAEs+lXDKfshccYZw==} dependencies: @@ -4747,15 +4797,66 @@ packages: '@hapi/hoek': 9.1.0 dev: true + /@hapi/b64/5.0.0: + resolution: {integrity: sha512-ngu0tSEmrezoiIaNGG6rRvKOUkUuDdf4XTPnONHGYfSGRmDqPZX5oJL6HAdKTo1UQHECbdB4OzhWrfgVppjHUw==} + dependencies: + '@hapi/hoek': 9.1.0 + dev: false + /@hapi/boom/9.1.0: resolution: {integrity: sha512-4nZmpp4tXbm162LaZT45P7F7sgiem8dwAh2vHWT6XX24dozNjGMg6BvKCRvtCUcmcXqeMIUqWN8Rc5X8yKuROQ==} dependencies: '@hapi/hoek': 9.1.0 - dev: true + + /@hapi/bourne/2.1.0: + resolution: {integrity: sha512-i1BpaNDVLJdRBEKeJWkVO6tYX6DMFBuwMhSuWqLsY4ufeTKGVuV5rBsUhxPayXqnnWHgXUAmWK16H/ykO5Wj4Q==} + dev: false + + /@hapi/cryptiles/5.1.0: + resolution: {integrity: sha512-fo9+d1Ba5/FIoMySfMqPBR/7Pa29J2RsiPrl7bkwo5W5o+AN1dAYQRi4SPrPwwVxVGKjgLOEWrsvt1BonJSfLA==} + engines: {node: '>=12.0.0'} + dependencies: + '@hapi/boom': 9.1.0 + dev: false /@hapi/hoek/9.1.0: resolution: {integrity: sha512-i9YbZPN3QgfighY/1X1Pu118VUz2Fmmhd6b2n0/O8YVgGGfw0FbUYoA97k7FkpGJ+pLCFEDLUmAPPV4D1kpeFw==} - dev: true + + /@hapi/iron/6.0.0: + resolution: {integrity: sha512-zvGvWDufiTGpTJPG1Y/McN8UqWBu0k/xs/7l++HVU535NLHXsHhy54cfEMdW7EjwKfbBfM9Xy25FmTiobb7Hvw==} + dependencies: + '@hapi/b64': 5.0.0 + '@hapi/boom': 9.1.0 + '@hapi/bourne': 2.1.0 + '@hapi/cryptiles': 5.1.0 + '@hapi/hoek': 9.1.0 + dev: false + + /@hapi/podium/4.1.3: + resolution: {integrity: sha512-ljsKGQzLkFqnQxE7qeanvgGj4dejnciErYd30dbrYzUOF/FyS/DOF97qcrT3bhoVwCYmxa6PEMhxfCPlnUcD2g==} + dependencies: + '@hapi/hoek': 9.1.0 + '@hapi/teamwork': 5.1.1 + '@hapi/validate': 1.1.3 + dev: false + + /@hapi/teamwork/5.1.1: + resolution: {integrity: sha512-1oPx9AE5TIv+V6Ih54RP9lTZBso3rP8j4Xhb6iSVwPXtAM+sDopl5TFMv5Paw73UnpZJ9gjcrTE1BXrWt9eQrg==} + engines: {node: '>=12.0.0'} + dev: false + + /@hapi/topo/5.1.0: + resolution: {integrity: sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==} + dependencies: + '@hapi/hoek': 9.1.0 + dev: false + + /@hapi/validate/1.1.3: + resolution: {integrity: sha512-/XMR0N0wjw0Twzq2pQOzPBZlDzkekGcoCtzO314BpIEsbXdYGthQUbxgkGDf4nhk1+IPDAsXqWjMohRQYO06UA==} + dependencies: + '@hapi/hoek': 9.1.0 + '@hapi/topo': 5.1.0 + dev: false /@humanwhocodes/config-array/0.11.8: resolution: {integrity: sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==} @@ -6113,12 +6214,864 @@ packages: - encoding dev: true - /@octokit/types/6.8.3: - resolution: {integrity: sha512-ZNAy8z77ewKZ5LCX0KaUm4tWdgloWQ6FWJCh06qgahq/MH13sQefIPKSo0dBdPU3bcioltyZUcC0k8oHHfjvnQ==} + /@octokit/types/6.8.3: + resolution: {integrity: sha512-ZNAy8z77ewKZ5LCX0KaUm4tWdgloWQ6FWJCh06qgahq/MH13sQefIPKSo0dBdPU3bcioltyZUcC0k8oHHfjvnQ==} + dependencies: + '@octokit/openapi-types': 4.0.2 + '@types/node': 18.11.18 + dev: true + + /@opentelemetry/api/1.4.0: + resolution: {integrity: sha512-IgMK9i3sFGNUqPMbjABm0G26g0QCKCUBfglhQ7rQq6WcxbKfEHRcmwsoER4hZcuYqJgkYn2OeuoJIv7Jsftp7g==} + engines: {node: '>=8.0.0'} + requiresBuild: true + dev: false + + /@opentelemetry/auto-instrumentations-node/0.36.3_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-8aQxNV8R4/4sGi7WvfxEPF8jK7zgmTC8po7EjUnW9tD6IXW3IpktHQyL6FV862kZjQk1bvIk7ucGvzqsLAGV+w==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-amqplib': 0.32.2_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-aws-lambda': 0.35.0_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-aws-sdk': 0.34.0_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-bunyan': 0.31.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-cassandra-driver': 0.32.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-connect': 0.31.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-dataloader': 0.4.0_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-dns': 0.31.2_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-express': 0.32.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-fastify': 0.31.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-fs': 0.7.0_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-generic-pool': 0.31.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-graphql': 0.33.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-grpc': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-hapi': 0.31.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-http': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-ioredis': 0.33.2_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-knex': 0.31.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-koa': 0.34.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-lru-memoizer': 0.32.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-memcached': 0.31.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-mongodb': 0.34.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-mongoose': 0.32.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-mysql': 0.33.0_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-mysql2': 0.33.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-nestjs-core': 0.32.2_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-net': 0.31.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-pg': 0.34.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-pino': 0.33.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-redis': 0.34.2_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-redis-4': 0.34.2_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-restify': 0.32.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-router': 0.32.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-socket.io': 0.33.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-tedious': 0.5.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation-winston': 0.31.1_@opentelemetry+api@1.4.0 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/context-async-hooks/1.9.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-HmycxnnIm00gdmxfD5OkDotL15bGqazLYqQJdcv1uNt22OSc5F/a3Paz3yznmf+/gWdPG8nlq/zd9H0mNXJnGg==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.5.0' + dependencies: + '@opentelemetry/api': 1.4.0 + dev: false + + /@opentelemetry/core/1.9.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-6/qon6tw2I8ZaJnHAQUUn4BqhTbTNRS0WP8/bA0ynaX+Uzp/DDbd0NS0Cq6TMlh8+mrlsyqDE7mO50nmv2Yvlg==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.5.0' + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + dev: false + + /@opentelemetry/exporter-jaeger/1.9.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-6F10NMOtBT3HdxpT0IwYf1BX8RzZB7SpqHTvZsB2vzUvxVAyoLX8+cuo6Ke9sHS9YMqoTA3rER5x9kC6NOxEMQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.0.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-trace-base': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + jaeger-client: 3.19.0 + dev: false + + /@opentelemetry/exporter-trace-otlp-grpc/0.35.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-d0OPJhJyxpfrd8xA5dYun8GRx8rgw6ZdS7vo+EAOqmA9zM71VXS6HiypjWuDJ/F/NzUXrVD7lfoXmPZFTOZ7Kw==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.0.0 + dependencies: + '@grpc/grpc-js': 1.8.9 + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/otlp-grpc-exporter-base': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/otlp-transformer': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/resources': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-trace-base': 1.9.1_@opentelemetry+api@1.4.0 + dev: false + + /@opentelemetry/exporter-trace-otlp-http/0.35.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-EJgAsrvscKsqb/GzF1zS74vM+Z/aQRhrFE7hs/1GK1M9bLixaVyMGwg2pxz1wdYdjxS1mqpHMhXU+VvMvFCw1w==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.0.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/otlp-exporter-base': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/otlp-transformer': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/resources': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-trace-base': 1.9.1_@opentelemetry+api@1.4.0 + dev: false + + /@opentelemetry/exporter-trace-otlp-proto/0.35.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-ki6wBjL+TR45fYJibtoacONp0eJezQLqnY3QyKSWP9GAftThhM+aZzIHBRetHb99PJN4ipIIVWL5WYdeAttc9g==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.0.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/otlp-exporter-base': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/otlp-proto-exporter-base': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/otlp-transformer': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/resources': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-trace-base': 1.9.1_@opentelemetry+api@1.4.0 + dev: false + + /@opentelemetry/exporter-zipkin/1.9.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-KBgf3w84luP5vWLlrqVFKmbwFK4lXM//t6K7H4nsg576htbz1RpBbQfybADjPdXTjGHqDTtLiC5MC90hxS7Z2w==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.0.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/resources': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-trace-base': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + dev: false + + /@opentelemetry/instrumentation-amqplib/0.32.2_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-NSXvRKtJhBqkKQltmOicg0ChyAA5VfrKPa9WSrFDXvlw8Pjs9UiQQTEYbiBT3V5LSjJXH6CpNnQp6v2bqEldow==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-aws-lambda/0.35.0_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-x6nd1DEf/MYU57AMphwyxQLSPSNit6lnJAMNz9eQmQ0TdzGaWUsWUz2OgoZXzjF2D8hbaJHYaDvl1IUOk7cNVg==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/propagator-aws-xray': 1.2.0_@opentelemetry+api@1.4.0 + '@opentelemetry/resources': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + '@types/aws-lambda': 8.10.81 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-aws-sdk/0.34.0_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-DT7Z08MVNOk/kyvztV1l4s1YMjW4qTbw852EhKkgpyYeKkxfGwdHqvv6+7MzOboJPXFQv/ADn1zcPtD8Lqia/Q==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/propagation-utils': 0.29.2_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-bunyan/0.31.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-y81y0L50ocziES+jVcsCM684R+1p3M64bfGwVumZI/cH3LNSlnvOd4xgQom4Ug+UzcYcP9RxjFURDQAvh8tnDw==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@types/bunyan': 1.8.7 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-cassandra-driver/0.32.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-28tbhM8I7Yp7PfSRnykxMFHKDsJC5efwOOoI/CehxIITSLOLrenmCEeNhSUfVUHzMIiqFiZXW/F0wurbAy38pg==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-connect/0.31.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-72hDzkUIpq4TFrBi0yooNH/LVQbiGZ3wgL0uVGjvyTfN1ZOfoa5LhverWwtfAcjn1aniVU4xEL6aWqGl0A3nDQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + '@types/connect': 3.4.35 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-dataloader/0.4.0_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-t12pWySH7d5Kmo9CZDAPs22d40kzWHyvMFsQGysc7UVtBOXB+Vg7Bzt4j3R4jdal/WkGKRgXL920zhGmziuzxw==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-dns/0.31.2_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-BBfMzbJGdEEz/OX2uPq0u9NAX2HL9KZ5x3PqwnJEqnUnRBr8hHJ9xbbY9WKRxZ55cGt8XeQpkj2NbRNkoy4hzQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + semver: 7.3.8 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-express/0.32.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-MR5ondudJaBG+GscjTWp3dm+mUacWgD9CnFs+EURNzd4EfHpPcxB9ZtFgUfzsp6FMJQZvOsgN5/fHQ4wmkf/fg==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + '@types/express': 4.17.13 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-fastify/0.31.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-oROINVKIvkkX3wQidPOYH78ruHwvfVBIi74svkeNaMzZ78xW2Djb/BiA5tXAujhi+fRGl2kwCG580iS9q5G7YA==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-fetch/0.35.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-2vwADdzxiwQwhuHlnRdxIL+CFD+R/PGg8Re+gSR0WJOS8Hk6SbSAtufAQskgGxu6PzlgpUBereqZmWpTN0kxPQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.0.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-trace-web': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-fs/0.7.0_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-iO5AHT9RJVTSpwGaUpDD1hFM7o9rwgZdbm2UNzWQtXUZT4ilNQrserpZGZFlytPAJ4avODxtM7uKpZnl61sBXA==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-generic-pool/0.31.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-FvoQKVpafcXvsJvIQU3QOFx/KBwbCblIGW83JWwoz2ymMu1coSJTveqN7cNVqEMR3BZ0eN4Ljgmq3AvimWXiTg==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + '@types/generic-pool': 3.8.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-graphql/0.33.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-rBMkSZpvth3odCwZi3Ih+h17ptpBhZu5YTzIKGxE1L4HH9iFdS7NspSBM2moIVngJs4CVCIV+JVAShz7svY3nQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-grpc/0.35.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-EBmpCD+5QfUXPmupynjwxt3tUG5bgTrGZT12B0/+By9ZMLboDAryHjpiermanbPh5mTOq0q73YzruGQWU9TExg==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-hapi/0.31.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-kk/LdhIb/5AC48xHq1LzoV6My7TgEAANxsIXQwLiIUVBgM5yjH3bEb5TjyqbSVNvqsJ1aU5etQICjKbSNh+zlA==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + '@types/hapi__hapi': 20.0.9 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-http/0.35.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-tH92LznX5pcxpuTSb6A662IdldlMk8QTtneDN66h4nIT9ch98Gtu68GSSKjMoTR25GzH3opvPC9mX2xJamxMJw==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + semver: 7.3.8 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-ioredis/0.33.2_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-86x9Ba4cyOZShORp7HECRULnS/hSJdTSE3cM9oSSAtOu6obUSA9eRGh0P8QZ5Ws1OXB7yD5A8MzxDLBPZSrWCg==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/redis-common': 0.34.0 + '@opentelemetry/semantic-conventions': 1.9.1 + '@types/ioredis': 4.26.6 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-knex/0.31.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-X9SIdzmyyoknPwUB+/JfcF8VHujQWxXDNMKl3PpxU2PwEaKpXPKtOgdA7do08tSoULMI0xCftFIzBUFnWivPFQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-koa/0.34.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-9PTzoI5IBrwVtAVGqnRuFfGV3RvdHi1R0ezSNAx0um3vM8FQj16mNpRAshC914WcocJLJWMZVnU/c2LnOsgPPQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + '@types/koa': 2.13.4 + '@types/koa__router': 8.0.7 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-lru-memoizer/0.32.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-Lx6t3LN4nfe9UGtc7zVAJ0AwiftFTqHGY+Mf4qOWOPcsBoTgj4Z0tZ8dwX1DTYFyNmmFUyWKSXrEWshfhOjexQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-memcached/0.31.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-uDiLLTsXlXLIvwYdl9+1AvxvWZkYrXAIvHwPOi6FthznnDIJtyxk0DgxusUaezhRUS9W1CqO5hFb1+8Hmg5DCQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + '@types/memcached': 2.2.7 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-mongodb/0.34.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-zRmotNkUQF6G9KWMEr2K2xZSqlaYKLY4HvV+DGHtOeJ1NbRUFk0V5XBNpB6nc4dXiEJUlGfXRyrQ/yu5TKiUuA==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-mongoose/0.32.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-ibTM94JpTM6nbfARoql0wLWFOOchCIlDAhSibFNxQ+TImWLZxVQ6NpNnrtbrNoUoPD0xnB/ZlYR7as72Xu4Vyg==} + engines: {node: '>=14.0'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-mysql/0.33.0_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-dU0phFuwtI81M7HyHbr/N4OllEAWYbQaOtSaJnDPMCxy4f840Np1kPzcTcAqd6zYIMhaO3B1nt7N2cP3ftu2RQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + '@types/mysql': 2.15.19 + mysql: 2.18.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-mysql2/0.33.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-ZyGg2KAaQRTctjCUIo+s25Yl4WDAvReF//EA0vKb9nKxMafon1NEbWeO1+qIE6xiXRXFUFn80hnf0N/YLu5gvw==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-nestjs-core/0.32.2_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-nUidxCbRnN+QUKArl5f8rE3hkYTsYlHEZRoWMqH9fFsVxOdZ4S6kT/HP55/Pj9+cDZ6XfBbelEOZjpsYeO2dYg==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-net/0.31.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-Gfks0UUi076w7aSTX1Q7KfnmlSqt0vMX0sc6jUWRd/BOQo/r84aS/DU0dP1FuPLyC4Vzpx9pPCnD37MRPhbkKA==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-pg/0.34.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-nM8fCZk3mD7NWeVl3HH3S+k+YLE+XyasdD3PaZpxX79dLSayg35JR5rPxn4AbVCXrkwrywYGxKCzmA5gNFBfAQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + '@types/pg': 8.6.1 + '@types/pg-pool': 2.0.3 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-pino/0.33.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-Rajum1USKFE3khFSg7JRqoI+2BK2BpC2SiB0mjXdQ5s31IxaNuc6qiXdNz6mRzbdzMb/ydsJchlQiSNwB2iVeQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-redis-4/0.34.2_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-MK6cnCYP5ON6h21YnWL2euG2FCzdbqC8BByLh34sbDZJuzTT7/C1H5CJVw/J0jQRqlR8yXvmmnqBcG7jQyJhhg==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/redis-common': 0.34.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-redis/0.34.2_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-Sdz5OYY7ZKxaLDu+ONd3m/UH4iBmgm7W3AZ2clagmUJeksoSHbmVZSyBbVtQ/EXk2wLQ8ZuvxLEOec3OwQ7UTA==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/redis-common': 0.34.0 + '@opentelemetry/semantic-conventions': 1.9.1 + '@types/redis': 2.8.31 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-restify/0.32.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-eko2ESs93LA8G81+qaVsDsCMdvDvvtWJKILBbqJAUeas0WqdLvytcMv/KlXGrHkenTtHA+t1pyTOPw4uyxELsQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-router/0.32.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-hLj2+Io3jaLfknaXOLhZc/ITs0St29Kf/LGIpfUA067JKtf9YSXndlfvI731nFf6O0KzKWc9loD/mKvc9W4bWQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-socket.io/0.33.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-P5SkNaV0PtthVbn5h0E9XZsAAID33+4eTZDlo4jRPPBmFsPE9e3TXknlEc+xVkZVhPrdEvuAfZMKoFdr/DB5XA==} + engines: {node: '>=14.0'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-tedious/0.5.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-iDDF/ZtxoV6eGzOjVj5qnHJ88RpTg7SbRnrFjPQ4E8HaNEjlnMnig3LjIKESV6GZpPO2DVciqIBWSfs8x34RIw==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + '@types/tedious': 4.0.9 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation-winston/0.31.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-qPK89Fp5bI6+IGMm2J2+A4kmeRfvRdrfgdwYlXoMZhO4aLL6BL5thdPYkDmIKO4FIzoOmybg62H3lMAExUUAyA==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/instrumentation/0.35.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-EZsvXqxenbRTSNsft6LDcrT4pjAiyZOx3rkDNeqKpwZZe6GmZtsXaZZKuDkJtz9fTjOGjDHjZj9/h80Ya9iIJw==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + dependencies: + '@opentelemetry/api': 1.4.0 + require-in-the-middle: 5.2.0 + semver: 7.3.8 + shimmer: 1.2.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/otlp-exporter-base/0.35.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-Sc0buJIs8CfUeQCL/12vDDjBREgsqHdjboBa/kPQDgMf008OBJSM02Ijj6T1TH+QVHl/VHBBEVJF+FTf0EH9Vg==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.0.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + dev: false + + /@opentelemetry/otlp-grpc-exporter-base/0.35.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-FRfUI0MlKK437jD3EI8WyfFide4B0VAegQHMoKT0/2sy+KPGREeZr/DioZtr/VJFqDHIn+21FJECWIJ75qyRWw==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.0.0 + dependencies: + '@grpc/grpc-js': 1.8.9 + '@grpc/proto-loader': 0.7.5 + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/otlp-exporter-base': 0.35.1_@opentelemetry+api@1.4.0 + dev: false + + /@opentelemetry/otlp-proto-exporter-base/0.35.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-EVL1eMMg7hxZA80wr6s0x3L8nAXBad+1/sNHQLioAAXLU1FbAI8eX5s0ko+REIqOjZw4r/ddMF0VAwUEUipSqw==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.0.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/otlp-exporter-base': 0.35.1_@opentelemetry+api@1.4.0 + protobufjs: 7.2.2 + dev: false + + /@opentelemetry/otlp-transformer/0.35.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-c0HXcJ49MKoWSaA49J8PXlVx48CeEFpL0odP6KBkVT+Bw6kAe8JlI3mIezyN05VCDJGtS2I5E6WEsE+DJL1t9A==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': '>=1.3.0 <1.5.0' + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/resources': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-metrics': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-trace-base': 1.9.1_@opentelemetry+api@1.4.0 + dev: false + + /@opentelemetry/propagation-utils/0.29.2_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-ynHFE2BMSZVK1Vq71qVJtdXQAt+pfYAYHHD+ZQYEKnkJN0F2GVMWz75JiHxh7wytt/maIqV9qcWxfjWFK1TUFw==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.0.0 + dependencies: + '@opentelemetry/api': 1.4.0 + dev: false + + /@opentelemetry/propagator-aws-xray/1.2.0_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-KCNFXdv63c+dItes2pUPVd1QDPmfcx3AVwcgE28emSx6tPI71q11zpMTDAWKPU8J9GQAGXMDyGnRGhIgua40aw==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': ^1.0.0 + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + dev: false + + /@opentelemetry/propagator-b3/1.9.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-V+/ufHnZSr0YlbNhPg4PIQAZOhP61fVwL0JZJ6qnl9i0jgaZBSAtV99ZvHMxMy0Z1tf+oGj1Hk+S6jRRXL+j1Q==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.5.0' + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + dev: false + + /@opentelemetry/propagator-jaeger/1.9.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-xjG5HnOgu/1f9+GphWr8lqxaU51iFL9HgFdnSQBSFqhM2OeMuzpFt6jmkpZJBAK3oqQ9BG52fHfCdYlw3GOkVQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.5.0' + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + dev: false + + /@opentelemetry/redis-common/0.34.0: + resolution: {integrity: sha512-Y+WXnW2Z+ywqzC8l2Hv6FC7surPFYITLgjVTvErnycEiAZpA3JtboeHGZ66Bi7LJKPFCkWaQKnQkpG3RgohxMg==} + engines: {node: '>=14'} + dev: false + + /@opentelemetry/resources/1.9.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-VqBGbnAfubI+l+yrtYxeLyOoL358JK57btPMJDd3TCOV3mV5TNBmzvOfmesM4NeTyXuGJByd3XvOHvFezLn3rQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.5.0' + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + dev: false + + /@opentelemetry/sdk-metrics/1.9.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-AyhKDcA8NuV7o1+9KvzRMxNbATJ8AcrutKilJ6hWSo9R5utnzxgffV4y+Hp4mJn84iXxkv+CBb99GOJ2A5OMzA==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': '>=1.3.0 <1.5.0' + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/resources': 1.9.1_@opentelemetry+api@1.4.0 + lodash.merge: 4.6.2 + dev: false + + /@opentelemetry/sdk-node/0.35.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-3If8ryB74hNmZiT3/tNNWre7CbjZFmzApwThJG4olLe/PnUIq/ezo8MJYZwzPcc3QW8IKso77oJQjKm73dEtqQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': '>=1.3.0 <1.5.0' + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/exporter-jaeger': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/exporter-trace-otlp-grpc': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/exporter-trace-otlp-http': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/exporter-trace-otlp-proto': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/exporter-zipkin': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/instrumentation': 0.35.1_@opentelemetry+api@1.4.0 + '@opentelemetry/resources': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-metrics': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-trace-base': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-trace-node': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@opentelemetry/sdk-trace-base/1.9.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-Y9gC5M1efhDLYHeeo2MWcDDMmR40z6QpqcWnPCm4Dmh+RHAMf4dnEBBntIe1dDpor686kyU6JV1D29ih1lZpsQ==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.5.0' + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/resources': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + dev: false + + /@opentelemetry/sdk-trace-node/1.9.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-wwwCM2G/A0LY3oPLDyO31uRnm9EMNkhhjSxL9cmkK2kM+F915em8K0pXkPWFNGWu0OHkGALWYwH6Oz0P5nVcHA==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.5.0' + dependencies: + '@opentelemetry/api': 1.4.0 + '@opentelemetry/context-async-hooks': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/propagator-b3': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/propagator-jaeger': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-trace-base': 1.9.1_@opentelemetry+api@1.4.0 + semver: 7.3.8 + dev: false + + /@opentelemetry/sdk-trace-web/1.9.1_@opentelemetry+api@1.4.0: + resolution: {integrity: sha512-VCnr8IYW1GYonGF8M3nDqUGFjf2jcL3nlhnNyF3PKGw6OI7xNCBR+65IgW5Va7QhDP0D01jRVJ9oNuTshrVewA==} + engines: {node: '>=14'} + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.5.0' dependencies: - '@octokit/openapi-types': 4.0.2 - '@types/node': 18.11.18 - dev: true + '@opentelemetry/api': 1.4.0 + '@opentelemetry/core': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/sdk-trace-base': 1.9.1_@opentelemetry+api@1.4.0 + '@opentelemetry/semantic-conventions': 1.9.1 + dev: false + + /@opentelemetry/semantic-conventions/1.9.1: + resolution: {integrity: sha512-oPQdbFDmZvjXk5ZDoBGXG8B4tSB/qW5vQunJWQMFUBp7Xe8O1ByPANueJ+Jzg58esEBegyyxZ7LRmfJr7kFcFg==} + engines: {node: '>=14'} + dev: false /@pkgr/utils/2.3.1: resolution: {integrity: sha512-wfzX8kc1PMyUILA+1Z/EqoE4UCXGy0iRGMhPwdfae1+f0OXlLqCk+By+aMzgJBzR9AzS4CDizioG6Ss1gvAFJw==} @@ -6137,46 +7090,36 @@ packages: /@protobufjs/aspromise/1.1.2: resolution: {integrity: sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==} - dev: true /@protobufjs/base64/1.1.2: resolution: {integrity: sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==} - dev: true /@protobufjs/codegen/2.0.4: resolution: {integrity: sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==} - dev: true /@protobufjs/eventemitter/1.1.0: resolution: {integrity: sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==} - dev: true /@protobufjs/fetch/1.1.0: resolution: {integrity: sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==} dependencies: '@protobufjs/aspromise': 1.1.2 '@protobufjs/inquire': 1.1.0 - dev: true /@protobufjs/float/1.0.2: resolution: {integrity: sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==} - dev: true /@protobufjs/inquire/1.1.0: resolution: {integrity: sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==} - dev: true /@protobufjs/path/1.1.2: resolution: {integrity: sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==} - dev: true /@protobufjs/pool/1.1.0: resolution: {integrity: sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==} - dev: true /@protobufjs/utf8/1.1.0: resolution: {integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==} - dev: true /@resvg/resvg-wasm/2.0.0-alpha.4: resolution: {integrity: sha512-pWIG9a/x1ky8gXKRhPH1OPKpHFoMN1ISLbJ+O+gPXQHIAKhNd5I28RlWf7q576hAOQA9JZTlo3p/M2uyLzJmmw==} @@ -6307,6 +7250,20 @@ packages: string.prototype.codepointat: 0.2.1 dev: true + /@sideway/address/4.1.4: + resolution: {integrity: sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==} + dependencies: + '@hapi/hoek': 9.1.0 + dev: false + + /@sideway/formula/3.0.1: + resolution: {integrity: sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==} + dev: false + + /@sideway/pinpoint/2.0.0: + resolution: {integrity: sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==} + dev: false + /@sidvind/better-ajv-errors/0.6.10_ajv@6.12.6: resolution: {integrity: sha512-vPv8ks6J1KQW1LPYgxmANxcHniE6LFuekxNpcoUUkotJ2srxP4qXZ+y9qpo5LAXhnLoNP0AH8cninimK68gS6A==} engines: {node: '>= 8.0'} @@ -6721,6 +7678,12 @@ packages: resolution: {integrity: sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==} dev: true + /@types/accepts/1.3.5: + resolution: {integrity: sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==} + dependencies: + '@types/node': 18.11.18 + dev: false + /@types/acorn/4.0.6: resolution: {integrity: sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==} dependencies: @@ -6746,6 +7709,10 @@ packages: '@types/retry': 0.12.0 dev: true + /@types/aws-lambda/8.10.81: + resolution: {integrity: sha512-C1rFKGVZ8KwqhwBOYlpoybTSRtxu2433ea6JaO3amc6ubEe08yQoFsPa9aU9YqvX7ppeZ25CnCtC4AH9mhtxsQ==} + dev: false + /@types/babel__code-frame/7.0.2: resolution: {integrity: sha512-imO+jT/yjOKOAS5GQZ8SDtwiIloAGGr6OaZDKB0V5JVaSfGZLat5K5/ZRtyKW6R60XHV3RHYPTFfhYb+wDKyKg==} @@ -6797,14 +7764,19 @@ packages: /@types/body-parser/1.17.1: resolution: {integrity: sha512-RoX2EZjMiFMjZh9lmYrwgoP9RTpAjSHiJxdp4oidAQVO02T7HER3xj9UKue5534ULWeqVEkujhWcyvUce+d68w==} dependencies: - '@types/connect': 3.4.33 + '@types/connect': 3.4.35 '@types/node': 18.11.18 - dev: true /@types/braces/3.0.1: resolution: {integrity: sha512-+euflG6ygo4bn0JHtn4pYqcXwRtLvElQ7/nnjDu7iYG56H0+OhCd7d6Ug0IE3WcFpZozBKW2+80FUbv5QGk5AQ==} dev: true + /@types/bunyan/1.8.7: + resolution: {integrity: sha512-jaNt6xX5poSmXuDAkQrSqx2zkR66OrdRDuVnU8ldvn3k/Ci/7Sf5nooKspQWimDnw337Bzt/yirqSThTjvrHkg==} + dependencies: + '@types/node': 18.11.18 + dev: false + /@types/bytes/3.1.1: resolution: {integrity: sha512-lOGyCnw+2JVPKU3wIV0srU0NyALwTBJlVSx5DfMQOFuuohA8y9S8orImpuIQikZ0uIQ8gehrRjxgQC1rLRi11w==} dev: true @@ -6834,15 +7806,13 @@ packages: '@types/express': 4.17.2 dev: true - /@types/connect/3.4.33: - resolution: {integrity: sha512-2+FrkXY4zllzTNfJth7jOqEHC+enpLeGslEhpnTAkg21GkRrWV4SsAtqchtT4YS9/nODBU2/ZfsBY2X4J/dX7A==} + /@types/connect/3.4.35: + resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: '@types/node': 18.11.18 - dev: true /@types/content-disposition/0.5.4: resolution: {integrity: sha512-0mPF08jn9zYI0n0Q/Pnz7C4kThdSt+6LD4amsrYDDpgBfrVWa3TcCOxKX1zkGgYniGagRv8heN2cbh+CAn+uuQ==} - dev: true /@types/content-type/1.1.3: resolution: {integrity: sha512-pv8VcFrZ3fN93L4rTNIbbUzdkzjEyVMp5mPVjsFfOYTDOZMZiZ8P1dhu+kEv3faYyKzZgLlSvnyQNFg+p/v5ug==} @@ -6852,6 +7822,15 @@ packages: resolution: {integrity: sha512-LKVP3cgXBT9RYj+t+9FDKwS5tdI+rPBXaNSkma7hvqy35lc7mAokC2zsqWJH0LaqIt3B962nuYI77hsJoT1gow==} dev: true + /@types/cookies/0.7.7: + resolution: {integrity: sha512-h7BcvPUogWbKCzBR2lY4oqaZbO3jXZksexYJVFvkrFeLgbZjQkU4x8pRq6eg2MHXQhY0McQdqmmsxRWlVAHooA==} + dependencies: + '@types/connect': 3.4.35 + '@types/express': 4.17.13 + '@types/keygrip': 1.0.2 + '@types/node': 18.11.18 + dev: false + /@types/cross-spawn/6.0.0: resolution: {integrity: sha512-evp2ZGsFw9YKprDbg8ySgC9NA15g3YgiI8ANkGmKKvvi0P2aDGYLPxQIC5qfeKNUOe3TjABVGuah6omPRpIYhg==} dependencies: @@ -6899,6 +7878,22 @@ packages: '@types/range-parser': 1.2.3 dev: true + /@types/express-serve-static-core/4.17.33: + resolution: {integrity: sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==} + dependencies: + '@types/node': 18.11.18 + '@types/qs': 6.9.7 + '@types/range-parser': 1.2.3 + + /@types/express/4.17.13: + resolution: {integrity: sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==} + dependencies: + '@types/body-parser': 1.17.1 + '@types/express-serve-static-core': 4.17.33 + '@types/qs': 6.9.7 + '@types/serve-static': 1.13.3 + dev: false + /@types/express/4.17.2: resolution: {integrity: sha512-5mHFNyavtLoJmnusB8OKJ5bshSzw+qkMIBAobLrIM48HJvunFva9mOa6aBwh64lBFyNwBbs0xiEFuj4eU/NjCA==} dependencies: @@ -6927,6 +7922,13 @@ packages: '@types/node': 17.0.21 dev: true + /@types/generic-pool/3.8.1: + resolution: {integrity: sha512-eaMAbZS0EfKvaP5PUZ/Cdf5uJBO2t6T3RdvQTKuMqUwGhNpCnPAsKWEMyV+mCeCQG3UiHrtgdzni8X6DmhxRaQ==} + deprecated: This is a stub types definition. generic-pool provides its own type definitions, so you do not need this installed. + dependencies: + generic-pool: 3.9.0 + dev: false + /@types/glob/7.1.1: resolution: {integrity: sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==} dependencies: @@ -6941,6 +7943,35 @@ packages: '@types/node': 18.11.18 dev: true + /@types/hapi__catbox/10.2.4: + resolution: {integrity: sha512-A6ivRrXD5glmnJna1UAGw87QNZRp/vdFO9U4GS+WhOMWzHnw+oTGkMvg0g6y1930CbeheGOCm7A1qHsqH7AXqg==} + dev: false + + /@types/hapi__hapi/20.0.9: + resolution: {integrity: sha512-fGpKScknCKZityRXdZgpCLGbm41R1ppFgnKHerfZlqOOlCX/jI129S6ghgBqkqCE8m9A0CIu1h7Ch04lD9KOoA==} + dependencies: + '@hapi/boom': 9.1.0 + '@hapi/iron': 6.0.0 + '@hapi/podium': 4.1.3 + '@types/hapi__catbox': 10.2.4 + '@types/hapi__mimos': 4.1.4 + '@types/hapi__shot': 4.1.2 + '@types/node': 18.11.18 + joi: 17.7.1 + dev: false + + /@types/hapi__mimos/4.1.4: + resolution: {integrity: sha512-i9hvJpFYTT/qzB5xKWvDYaSXrIiNqi4ephi+5Lo6+DoQdwqPXQgmVVOZR+s3MBiHoFqsCZCX9TmVWG3HczmTEQ==} + dependencies: + '@types/mime-db': 1.43.1 + dev: false + + /@types/hapi__shot/4.1.2: + resolution: {integrity: sha512-8wWgLVP1TeGqgzZtCdt+F+k15DWQvLG1Yv6ZzPfb3D5WIo5/S+GGKtJBVo2uNEcqabP5Ifc71QnJTDnTmw1axA==} + dependencies: + '@types/node': 18.11.18 + dev: false + /@types/hast/2.3.1: resolution: {integrity: sha512-viwwrB+6xGzw+G1eWpF9geV3fnsDgXqHG+cqgiHrvQfDUW5hzhCyV7Sy3UJxhfRFBsgky2SSW33qi/YrIkjX5Q==} dependencies: @@ -6952,10 +7983,18 @@ packages: '@types/node': 17.0.21 dev: true + /@types/http-assert/1.5.3: + resolution: {integrity: sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==} + dev: false + /@types/http-cache-semantics/4.0.0: resolution: {integrity: sha512-c3Xy026kOF7QOTn00hbIllV1dLR9hG9NkSrLQgCVs8NF6sBU+VGWjD3wLPhmh1TYAc7ugCFsvHYMN4VcBN1U1A==} dev: true + /@types/http-errors/2.0.1: + resolution: {integrity: sha512-/K3ds8TRAfBvi5vfjuz8y6+GiAYBZ0x4tXv1Av6CWBWn0IlADc+ZX9pMq7oU0fNQPnBwIZl3rmeLp6SBApbxSQ==} + dev: false + /@types/http-proxy/1.17.3: resolution: {integrity: sha512-wIPqXANye5BbORbuh74exbwNzj+UWCwWyeEFJzUQ7Fq3W2NSAy+7x7nX1fgbEypr2/TdKqpeuxLnXWgzN533/Q==} dependencies: @@ -6969,6 +8008,12 @@ packages: rxjs: 7.5.1 dev: true + /@types/ioredis/4.26.6: + resolution: {integrity: sha512-Q9ydXL/5Mot751i7WLCm9OGTj5jlW3XBdkdEW21SkXZ8Y03srbkluFGbM3q8c+vzPW30JOLJ+NsZWHoly0+13A==} + dependencies: + '@types/node': 18.11.18 + dev: false + /@types/istanbul-lib-coverage/2.0.3: resolution: {integrity: sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw==} dev: true @@ -7017,12 +8062,41 @@ packages: '@types/node': 18.11.18 dev: true + /@types/keygrip/1.0.2: + resolution: {integrity: sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==} + dev: false + /@types/keyv/3.1.1: resolution: {integrity: sha512-MPtoySlAZQ37VoLaPcTHCu1RWJ4llDkULYZIzOYxlhxBqYPB0RsRlmMU0R6tahtFe27mIdkHV+551ZWV4PLmVw==} dependencies: '@types/node': 18.11.18 dev: true + /@types/koa-compose/3.2.5: + resolution: {integrity: sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==} + dependencies: + '@types/koa': 2.13.4 + dev: false + + /@types/koa/2.13.4: + resolution: {integrity: sha512-dfHYMfU+z/vKtQB7NUrthdAEiSvnLebvBjwHtfFmpZmB7em2N3WVQdHgnFq+xvyVgxW5jKDmjWfLD3lw4g4uTw==} + dependencies: + '@types/accepts': 1.3.5 + '@types/content-disposition': 0.5.4 + '@types/cookies': 0.7.7 + '@types/http-assert': 1.5.3 + '@types/http-errors': 2.0.1 + '@types/keygrip': 1.0.2 + '@types/koa-compose': 3.2.5 + '@types/node': 18.11.18 + dev: false + + /@types/koa__router/8.0.7: + resolution: {integrity: sha512-OB3Ax75nmTP+WR9AgdzA42DI7YmBtiNKN2g1Wxl+d5Dyek9SWt740t+ukwXSmv/jMBCUPyV3YEI93vZHgdP7UQ==} + dependencies: + '@types/koa': 2.13.4 + dev: false + /@types/liftoff/4.0.0: resolution: {integrity: sha512-Ny/PJkO6nxWAQnaet8q/oWz15lrfwvdvBpuY4treB0CSsBO1CG0fVuNLngR3m3bepQLd+E4c3Y3DlC2okpUvPw==} dependencies: @@ -7042,7 +8116,6 @@ packages: /@types/long/4.0.1: resolution: {integrity: sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==} - dev: true /@types/lru-cache/4.1.1: resolution: {integrity: sha512-8mNEUG6diOrI6pMqOHrHPDBB1JsrpedeMK9AWGzVCQ7StRRribiT9BRvUmF8aUws9iBbVlgVekOT5Sgzc1MTKw==} @@ -7060,15 +8133,24 @@ packages: /@types/mdx/2.0.3: resolution: {integrity: sha512-IgHxcT3RC8LzFLhKwP3gbMPeaK7BM9eBH46OdapPA7yvuIUJ8H6zHZV53J8hGZcTSnt95jANt+rTBNUUc22ACQ==} + /@types/memcached/2.2.7: + resolution: {integrity: sha512-ImJbz1i8pl+OnyhYdIDnHe8jAuM8TOwM/7VsciqhYX3IL0jPPUToAtVxklfcWFGYckahEYZxhd9FS0z3MM1dpA==} + dependencies: + '@types/node': 18.11.18 + dev: false + /@types/micromatch/4.0.2: resolution: {integrity: sha512-oqXqVb0ci19GtH0vOA/U2TmHTcRY9kuZl4mqUxe0QmJAlIW13kzhuK5pi1i9+ngav8FjpSb9FVS/GE00GLX1VA==} dependencies: '@types/braces': 3.0.1 dev: true + /@types/mime-db/1.43.1: + resolution: {integrity: sha512-kGZJY+R+WnR5Rk+RPHUMERtb2qBRViIHCBdtUrY+NmwuGb8pQdfTqQiCKPrxpdoycl8KWm2DLdkpoSdt479XoQ==} + dev: false + /@types/mime/2.0.1: resolution: {integrity: sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw==} - dev: true /@types/minimatch/3.0.3: resolution: {integrity: sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==} @@ -7083,6 +8165,12 @@ packages: '@types/node': 18.11.18 dev: true + /@types/mysql/2.15.19: + resolution: {integrity: sha512-wSRg2QZv14CWcZXkgdvHbbV2ACufNy5EgI8mBBxnJIptchv7DBy/h53VMa2jDhyo0C9MO4iowE6z9vF8Ja1DkQ==} + dependencies: + '@types/node': 18.11.18 + dev: false + /@types/node-fetch/2.3.2: resolution: {integrity: sha512-yW0EOebSsQme9yKu09XbdDfle4/SmWZMK4dfteWcSLCYNQQcF+YOv0kIrvm+9pO11/ghA4E6A+RNQqvYj4Nr3A==} dependencies: @@ -7115,6 +8203,10 @@ packages: /@types/node/18.11.18: resolution: {integrity: sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==} + /@types/node/18.7.11: + resolution: {integrity: sha512-KZhFpSLlmK/sdocfSAjqPETTMd0ug6HIMIAwkwUpU79olnZdQtMxpQP+G1wDzCH7na+FltSIhbaZuKdwZ8RDrw==} + dev: true + /@types/normalize-package-data/2.4.0: resolution: {integrity: sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==} @@ -7133,6 +8225,20 @@ packages: path-to-regexp: 6.1.0 dev: true + /@types/pg-pool/2.0.3: + resolution: {integrity: sha512-fwK5WtG42Yb5RxAwxm3Cc2dJ39FlgcaNiXKvtTLAwtCn642X7dgel+w1+cLWwpSOFImR3YjsZtbkfjxbHtFAeg==} + dependencies: + '@types/pg': 8.6.1 + dev: false + + /@types/pg/8.6.1: + resolution: {integrity: sha512-1Kc4oAGzAl7uqUStZCDvaLFqZrW9qWSjXOmBfdgyBP5La7Us6Mg4GBvRlSoaZMhQF/zSj1C8CtKMBkoiT8eL8w==} + dependencies: + '@types/node': 18.11.18 + pg-protocol: 1.6.0 + pg-types: 2.2.0 + dev: false + /@types/platform/1.3.4: resolution: {integrity: sha512-U0o4K+GNiK0PNxoDwd8xRnvLVe4kzei6opn3/FCjAriqaP+rfrDdSl1kP/hLL6Y3/Y3hhGnBwD4dCkkAqs1W/Q==} dev: true @@ -7152,9 +8258,11 @@ packages: resolution: {integrity: sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==} dev: true + /@types/qs/6.9.7: + resolution: {integrity: sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==} + /@types/range-parser/1.2.3: resolution: {integrity: sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==} - dev: true /@types/react-dom/16.9.4: resolution: {integrity: sha512-fya9xteU/n90tda0s+FtN5Ym4tbgxpq/hb/Af24dvs6uYnYn+fspaxw5USlw0R8apDNwxsqumdRoCoKitckQqw==} @@ -7180,6 +8288,20 @@ packages: '@types/prop-types': 15.7.3 csstype: 2.6.8 + /@types/react/18.0.17: + resolution: {integrity: sha512-38ETy4tL+rn4uQQi7mB81G7V1g0u2ryquNmsVIOKUAEIDK+3CUjZ6rSRpdvS99dNBnkLFL83qfmtLacGOTIhwQ==} + dependencies: + '@types/prop-types': 15.7.3 + '@types/scheduler': 0.16.2 + csstype: 3.0.10 + dev: true + + /@types/redis/2.8.31: + resolution: {integrity: sha512-daWrrTDYaa5iSDFbgzZ9gOOzyp2AJmYK59OlG/2KGBgYWF3lfs8GDKm1c//tik5Uc93hDD36O+qLPvzDolChbA==} + dependencies: + '@types/node': 18.11.18 + dev: false + /@types/relay-runtime/13.0.0: resolution: {integrity: sha512-yzv6F8EZPWA2rtfFP2qMluS8tsz1q4lfdYxLegCshdAjX5uqxTR2pAliATj9wrzD6OMZF4fl9aU+Y+zmSfm2EA==} dev: true @@ -7207,6 +8329,10 @@ packages: '@types/node': 17.0.21 dev: true + /@types/scheduler/0.16.2: + resolution: {integrity: sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==} + dev: true + /@types/selenium-webdriver/4.0.15: resolution: {integrity: sha512-5760PIZkzhPejy3hsKAdCKe5LJygGdxLKOLxmZL9GEUcFlO5OgzM6G2EbdbvOnaw4xvUSa9Uip6Ipwkih12BPA==} dev: true @@ -7227,9 +8353,8 @@ packages: /@types/serve-static/1.13.3: resolution: {integrity: sha512-oprSwp094zOglVrXdlo/4bAHtKTAxX6VT8FOZlBKrmyLbNvE1zxZyJ6yikMVtHIvwP45+ZQGJn+FdXGKTozq0g==} dependencies: - '@types/express-serve-static-core': 4.17.1 + '@types/express-serve-static-core': 4.17.33 '@types/mime': 2.0.1 - dev: true /@types/sharp/0.29.3: resolution: {integrity: sha512-83Xp05eK2hvfNnmKLr2Fz0C2A0jrr2TnSLqKRbkLTYuAu+Erj6mKQLoEMGafE73Om8p3q3ryZxtHFM/7hy4Adg==} @@ -7260,6 +8385,12 @@ packages: '@types/node': 17.0.21 dev: true + /@types/tedious/4.0.9: + resolution: {integrity: sha512-ipwFvfy9b2m0gjHsIX0D6NAAwGCKokzf5zJqUZHUGt+7uWVlBIy6n2eyMgiKQ8ChLFVxic/zwQUhjLYNzbHDRA==} + dependencies: + '@types/node': 18.11.18 + dev: false + /@types/text-table/0.2.1: resolution: {integrity: sha512-dchbFCWfVgUSWEvhOkXGS7zjm+K7jCUvGrQkAHPk2Fmslfofp4HQTH2pqnQ3Pw5GPYv0zWa2AQjKtsfZThuemQ==} dev: true @@ -7912,6 +9043,10 @@ packages: string-width: 3.1.0 dev: true + /ansi-color/0.2.1: + resolution: {integrity: sha512-bF6xLaZBLpOQzgYUtYEhJx090nPSZk1BQ/q2oyBK9aMMcJHzx9uXGCjI2Y+LebsN4Jwoykr0V9whbPiogdyHoQ==} + dev: false + /ansi-colors/4.1.1: resolution: {integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==} engines: {node: '>=6'} @@ -8653,6 +9788,10 @@ packages: resolution: {integrity: sha512-bCtHMwL9LeDIozFn+oNhhFoq+yQ3BNdnsLSASUxLciOb1vgvpHsIO1dsENiGMgbb4SkP5TrzWzRiLddn8ahVOQ==} dev: true + /bignumber.js/9.0.0: + resolution: {integrity: sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==} + dev: false + /binary-extensions/2.1.0: resolution: {integrity: sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==} engines: {node: '>=8'} @@ -8923,6 +10062,16 @@ packages: ieee754: 1.2.1 dev: true + /bufrw/1.3.0: + resolution: {integrity: sha512-jzQnSbdJqhIltU9O5KUiTtljP9ccw2u5ix59McQy4pV2xGhVLhRZIndY8GIrgh5HjXa6+QJ9AQhOd2QWQizJFQ==} + engines: {node: '>= 0.10.x'} + dependencies: + ansi-color: 0.2.1 + error: 7.0.2 + hexer: 1.5.0 + xtend: 4.0.2 + dev: false + /builtin-modules/3.1.0: resolution: {integrity: sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==} engines: {node: '>=6'} @@ -11297,6 +12446,13 @@ packages: dependencies: is-arrayish: 0.2.1 + /error/7.0.2: + resolution: {integrity: sha512-UtVv4l5MhijsYUxPJo4390gzfZvAnTHreNnDjnTZaKIiZ/SemXxAhBkYSKtWa5RtBXbLP8tMgn/n0RUa/H7jXw==} + dependencies: + string-template: 0.2.1 + xtend: 4.0.2 + dev: false + /es-abstract/1.19.1: resolution: {integrity: sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==} engines: {node: '>= 0.4'} @@ -12865,6 +14021,11 @@ packages: loader-utils: 1.4.0 dev: true + /generic-pool/3.9.0: + resolution: {integrity: sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g==} + engines: {node: '>= 4'} + dev: false + /gensync/1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} @@ -13659,6 +14820,17 @@ packages: resolution: {integrity: sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==} dev: true + /hexer/1.5.0: + resolution: {integrity: sha512-dyrPC8KzBzUJ19QTIo1gXNqIISRXQ0NwteW6OeQHRN4ZuZeHkdODfj0zHBdOlHbRY8GqbqK57C9oWSvQZizFsg==} + engines: {node: '>= 0.10.x'} + hasBin: true + dependencies: + ansi-color: 0.2.1 + minimist: 1.2.6 + process: 0.10.1 + xtend: 4.0.2 + dev: false + /hmac-drbg/1.0.1: resolution: {integrity: sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=} dependencies: @@ -14844,6 +16016,17 @@ packages: is-object: 1.0.1 dev: true + /jaeger-client/3.19.0: + resolution: {integrity: sha512-M0c7cKHmdyEUtjemnJyx/y9uX16XHocL46yQvyqDlPdvAcwPDbHrIbKjQdBqtiE4apQ/9dmr+ZLJYYPGnurgpw==} + engines: {node: '>=10'} + dependencies: + node-int64: 0.4.0 + opentracing: 0.14.7 + thriftrw: 3.12.0 + uuid: 8.3.2 + xorshift: 1.2.0 + dev: false + /jake/10.8.5: resolution: {integrity: sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==} engines: {node: '>=10'} @@ -15573,6 +16756,16 @@ packages: - utf-8-validate dev: true + /joi/17.7.1: + resolution: {integrity: sha512-teoLhIvWE298R6AeJywcjR4sX2hHjB3/xJX4qPjg+gTg+c0mzUDsziYlqPmLomq9gVsfaMcgPaGc7VxtD/9StA==} + dependencies: + '@hapi/hoek': 9.1.0 + '@hapi/topo': 5.1.0 + '@sideway/address': 4.1.4 + '@sideway/formula': 3.0.1 + '@sideway/pinpoint': 2.0.0 + dev: false + /js-base64/2.5.1: resolution: {integrity: sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw==} @@ -16247,8 +17440,7 @@ packages: dev: true /lodash.camelcase/4.3.0: - resolution: {integrity: sha1-soqmKIorn8ZRA1x3EfZathkDMaY=} - dev: true + resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} /lodash.curry/4.1.1: resolution: {integrity: sha1-JI42By7ekGUB11lmIAqG2riyMXA=} @@ -16416,9 +17608,17 @@ packages: wrap-ansi: 6.2.0 dev: false + /long/2.4.0: + resolution: {integrity: sha512-ijUtjmO/n2A5PaosNG9ZGDsQ3vxJg7ZW8vsY8Kp0f2yIZWhSJvjmegV7t+9RPQKxKrvj8yKGehhS+po14hPLGQ==} + engines: {node: '>=0.6'} + dev: false + /long/4.0.0: resolution: {integrity: sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==} - dev: true + + /long/5.2.1: + resolution: {integrity: sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A==} + dev: false /longest-streak/2.0.4: resolution: {integrity: sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==} @@ -17504,8 +18704,7 @@ packages: dev: true /module-details-from-path/1.0.3: - resolution: {integrity: sha1-EUyUlnPiqKNenTV4hSeqN7Z52is=} - dev: true + resolution: {integrity: sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A==} /moment/2.24.0: resolution: {integrity: sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==} @@ -17580,6 +18779,16 @@ packages: /mute-stream/0.0.8: resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} + /mysql/2.18.1: + resolution: {integrity: sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==} + engines: {node: '>= 0.6'} + dependencies: + bignumber.js: 9.0.0 + readable-stream: 2.3.7 + safe-buffer: 5.1.2 + sqlstring: 2.3.1 + dev: false + /nan/2.15.0: resolution: {integrity: sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==} requiresBuild: true @@ -17792,7 +19001,6 @@ packages: /node-int64/0.4.0: resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} - dev: true /node-plop/0.30.0: resolution: {integrity: sha512-5w9+jWoy9OtMm3qRmHgL2z/3L5VL3RhEegKkKC4tA1IIjG3aXf8Ee/8wdgU9qXyt1yDfPWI9Tan1rHpXAp0ZnA==} @@ -18255,7 +19463,6 @@ packages: /opentracing/0.14.7: resolution: {integrity: sha512-vz9iS7MJ5+Bp1URw8Khvdyw1H/hGvzHWlKQ7eRrQojSCDL1/SrWfrY9QebLw97n2deyRtzHRC3MkQfVNUCo91Q==} engines: {node: '>=0.10'} - dev: true /opn/5.4.0: resolution: {integrity: sha512-YF9MNdVy/0qvJvDtunAOzFw9iasOQHpVthTCvGzxt61Il64AYSGdK+rYwld7NAfk9qJ7dt+hymBNSc9LNYS+Sw==} @@ -18866,6 +20073,26 @@ packages: estree-walker: 3.0.3 is-reference: 3.0.1 + /pg-int8/1.0.1: + resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} + engines: {node: '>=4.0.0'} + dev: false + + /pg-protocol/1.6.0: + resolution: {integrity: sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q==} + dev: false + + /pg-types/2.2.0: + resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} + engines: {node: '>=4'} + dependencies: + pg-int8: 1.0.1 + postgres-array: 2.0.0 + postgres-bytea: 1.0.0 + postgres-date: 1.0.7 + postgres-interval: 1.2.0 + dev: false + /picocolors/1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} @@ -19844,6 +21071,28 @@ packages: source-map-js: 1.0.2 dev: true + /postgres-array/2.0.0: + resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} + engines: {node: '>=4'} + dev: false + + /postgres-bytea/1.0.0: + resolution: {integrity: sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==} + engines: {node: '>=0.10.0'} + dev: false + + /postgres-date/1.0.7: + resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==} + engines: {node: '>=0.10.0'} + dev: false + + /postgres-interval/1.2.0: + resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==} + engines: {node: '>=0.10.0'} + dependencies: + xtend: 4.0.2 + dev: false + /prelude-ls/1.1.2: resolution: {integrity: sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==} engines: {node: '>= 0.8.0'} @@ -19951,6 +21200,11 @@ packages: /process-nextick-args/2.0.1: resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} + /process/0.10.1: + resolution: {integrity: sha512-dyIett8dgGIZ/TXKUzeYExt7WA6ldDzys9vTDU/cCA9L17Ypme+KzS+NjQCjpn9xsvi/shbMC+yP/BcFMBz0NA==} + engines: {node: '>= 0.6.0'} + dev: false + /process/0.11.10: resolution: {integrity: sha1-czIwDoQBYb2j5podHZGn1LwW8YI=} engines: {node: '>= 0.6.0'} @@ -20071,6 +21325,25 @@ packages: long: 4.0.0 dev: true + /protobufjs/7.2.2: + resolution: {integrity: sha512-++PrQIjrom+bFDPpfmqXfAGSQs40116JRrqqyf53dymUMvvb5d/LMRyicRoF1AUKoXVS1/IgJXlEgcpr4gTF3Q==} + engines: {node: '>=12.0.0'} + requiresBuild: true + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/base64': 1.1.2 + '@protobufjs/codegen': 2.0.4 + '@protobufjs/eventemitter': 1.1.0 + '@protobufjs/fetch': 1.1.0 + '@protobufjs/float': 1.0.2 + '@protobufjs/inquire': 1.1.0 + '@protobufjs/path': 1.1.2 + '@protobufjs/pool': 1.1.0 + '@protobufjs/utf8': 1.1.0 + '@types/node': 18.11.18 + long: 5.2.1 + dev: false + /protocols/1.4.7: resolution: {integrity: sha512-Fx65lf9/YDn3hUX08XUc0J8rSux36rEsyiv21ZGUC1mOyeM3lTRpZLcrm8aAolzS4itwVfm7TAPyxC2E5zd6xg==} dev: true @@ -21001,6 +22274,17 @@ packages: engines: {node: '>=0.10.0'} dev: true + /require-in-the-middle/5.2.0: + resolution: {integrity: sha512-efCx3b+0Z69/LGJmm9Yvi4cqEdxnoGnxYxGxBghkkTTFeXRtTCmmhO0AnAfHz59k957uTSuy8WaHqOs8wbYUWg==} + engines: {node: '>=6'} + dependencies: + debug: 4.3.4 + module-details-from-path: 1.0.3 + resolve: 1.22.1 + transitivePeerDependencies: + - supports-color + dev: false + /require-like/0.1.2: resolution: {integrity: sha1-rW8wwTvs15cBDEaK+ndcDAprR/o=} dev: true @@ -21687,6 +22971,10 @@ packages: rechoir: 0.6.2 dev: true + /shimmer/1.2.1: + resolution: {integrity: sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw==} + dev: false + /side-channel/1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} dependencies: @@ -21982,6 +23270,11 @@ packages: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} dev: true + /sqlstring/2.3.1: + resolution: {integrity: sha512-ooAzh/7dxIG5+uDik1z/Rd1vli0+38izZhGzSa34FwR7IbelPWCCKSNIl8jlL/F7ERvy8CB2jNeM1E9i9mXMAQ==} + engines: {node: '>= 0.6'} + dev: false + /sshpk/1.16.1: resolution: {integrity: sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==} engines: {node: '>=0.10.0'} @@ -22111,6 +23404,10 @@ packages: strip-ansi: 6.0.1 dev: true + /string-template/0.2.1: + resolution: {integrity: sha512-Yptehjogou2xm4UJbxJ4CxgZx12HBfeystp0y3x7s4Dj32ltVVG1Gg8YhKjHZkHicuKpZX/ffilA8505VbUbpw==} + dev: false + /string-width/1.0.2: resolution: {integrity: sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==} engines: {node: '>=0.10.0'} @@ -22773,6 +24070,16 @@ packages: /text-table/0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + /thriftrw/3.12.0: + resolution: {integrity: sha512-4YZvR4DPEI41n4Opwr4jmrLGG4hndxr7387kzRFIIzxHQjarPusH4lGXrugvgb7TtPrfZVTpZCVe44/xUxowEw==} + engines: {node: '>= 0.10.x'} + hasBin: true + dependencies: + bufrw: 1.3.0 + error: 7.0.2 + long: 2.4.0 + dev: false + /throat/6.0.1: resolution: {integrity: sha512-8hmiGIJMDlwjg7dlJ4yKGLK8EsYqKgPWbG3b4wjJddKNwc7N7Dpn08Df4szr/sZdMVeOstrdYSsqzX6BYbcB+w==} dev: true @@ -23247,6 +24554,12 @@ packages: resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} dev: true + /typescript/4.7.4: + resolution: {integrity: sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==} + engines: {node: '>=4.2.0'} + hasBin: true + dev: true + /typescript/4.8.2: resolution: {integrity: sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==} engines: {node: '>=4.2.0'} @@ -23757,7 +25070,6 @@ packages: /uuid/8.3.2: resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} hasBin: true - dev: true /uvu/0.5.6: resolution: {integrity: sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==} @@ -24355,6 +25667,10 @@ packages: engines: {node: '>=0.4.0'} dev: true + /xorshift/1.2.0: + resolution: {integrity: sha512-iYgNnGyeeJ4t6U11NpA/QiKy+PXn5Aa3Azg5qkwIFz1tBLllQrjjsk9yzD7IAK0naNU4JxdeDgqW9ov4u/hc4g==} + dev: false + /xtend/2.1.2: resolution: {integrity: sha512-vMNKzr2rHP9Dp/e1NQFnLQlwlhp9L/LfvnsVdHxN1f+uggyVI3i08uD14GPvCToPkdsRfyPqIyYGmIk58V98ZQ==} engines: {node: '>=0.4'} @@ -24365,7 +25681,6 @@ packages: /xtend/4.0.2: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} - dev: true /y18n/4.0.0: resolution: {integrity: sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==} @@ -24439,7 +25754,6 @@ packages: string-width: 4.2.3 y18n: 5.0.5 yargs-parser: 20.2.4 - dev: true /yargs/17.5.1: resolution: {integrity: sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==} diff --git a/test/e2e/instrumentation-hook/app/layout.tsx b/test/e2e/instrumentation-hook/app/layout.tsx new file mode 100644 index 0000000000000..e69de29bb2d1d From f8bfdda26dc488b84aa82653d9c80241a880b561 Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Tue, 21 Feb 2023 17:58:11 +0100 Subject: [PATCH 14/37] fix merge artifact --- packages/next/src/build/webpack/plugins/middleware-plugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/src/build/webpack/plugins/middleware-plugin.ts b/packages/next/src/build/webpack/plugins/middleware-plugin.ts index 67128e7152485..314283078620a 100644 --- a/packages/next/src/build/webpack/plugins/middleware-plugin.ts +++ b/packages/next/src/build/webpack/plugins/middleware-plugin.ts @@ -19,6 +19,7 @@ import { NEXT_CLIENT_SSR_ENTRY_SUFFIX, FLIGHT_SERVER_CSS_MANIFEST, SUBRESOURCE_INTEGRITY_MANIFEST, + FONT_LOADER_MANIFEST, } from '../../../shared/lib/constants' import { getPageStaticInfo, @@ -852,7 +853,6 @@ export default class MiddlewarePlugin { metadataByEntry, opts: { sriEnabled: this.sriEnabled, - hasInstrumentationHook: this.hasInstrumentationHook, }, }) ) From f09d19274bd6649f8dd9a65f93b3d2cfac00a639 Mon Sep 17 00:00:00 2001 From: Jimmy Lai Date: Tue, 21 Feb 2023 17:59:01 +0100 Subject: [PATCH 15/37] add tracer --- packages/next/src/server/app-render.tsx | 526 +++++++++--------- packages/next/src/server/base-server.ts | 109 +++- .../next/src/server/lib/trace/constants.ts | 33 ++ packages/next/src/server/lib/trace/tracer.ts | 319 ++++++++++- packages/next/src/server/load-components.ts | 16 +- packages/next/src/server/next-server.ts | 52 +- packages/next/src/server/next.ts | 17 +- .../src/server/node-web-streams-helper.ts | 6 +- packages/next/src/server/render.tsx | 78 +-- packages/next/src/server/router.ts | 20 +- 10 files changed, 826 insertions(+), 350 deletions(-) diff --git a/packages/next/src/server/app-render.tsx b/packages/next/src/server/app-render.tsx index 58b0a427a5c0a..4cf198f68398c 100644 --- a/packages/next/src/server/app-render.tsx +++ b/packages/next/src/server/app-render.tsx @@ -55,6 +55,8 @@ import { warnOnce } from '../shared/lib/utils/warn-once' import { isNotFoundError } from '../client/components/not-found' import { isRedirectError } from '../client/components/redirect' import { NEXT_DYNAMIC_NO_SSR_CODE } from '../shared/lib/lazy-dynamic/no-ssr-error' +import { getTracer, SpanKind } from './lib/trace/tracer' +import { AppRenderSpan } from './lib/trace/constants' const isEdgeRuntime = process.env.NEXT_RUNTIME === 'edge' @@ -308,165 +310,147 @@ function patchFetch(ComponentMod: any) { ComponentMod.staticGenerationAsyncStorage const originFetch = globalThis.fetch - globalThis.fetch = async (input, init) => { - const staticGenerationStore = staticGenerationAsyncStorage.getStore() - - // If the staticGenerationStore is not available, we can't do any special - // treatment of fetch, therefore fallback to the original fetch - // implementation. - if (!staticGenerationStore) { - return originFetch(input, init) - } - - let revalidate: number | undefined | boolean - - if (typeof init?.next?.revalidate === 'number') { - revalidate = init.next.revalidate - } - - if (init?.next?.revalidate === false) { - revalidate = CACHE_ONE_YEAR - } + globalThis.fetch = getTracer().wrap( + AppRenderSpan.fetch, + { + kind: SpanKind.CLIENT, + }, + async (input, init) => { + const staticGenerationStore = staticGenerationAsyncStorage.getStore() + const span = getTracer().getActiveScopeSpan() + span?.setAttributes({ + 'http.url': input.toString(), + 'http.method': init?.method || 'GET', + // TODO: add more attributes + }) + // If the staticGenerationStore is not available, we can't do any special + // treatment of fetch, therefore fallback to the original fetch + // implementation. + if (!staticGenerationStore) { + return originFetch(input, init) + } - if ( - !staticGenerationStore.revalidate || - (typeof revalidate === 'number' && - revalidate < staticGenerationStore.revalidate) - ) { - staticGenerationStore.revalidate = revalidate - } + let revalidate: number | undefined | boolean - let cacheKey: string | undefined + if (typeof init?.next?.revalidate === 'number') { + revalidate = init.next.revalidate + } - const doOriginalFetch = async () => { - return originFetch(input, init).then(async (res) => { - if ( - staticGenerationStore.incrementalCache && - cacheKey && - typeof revalidate === 'number' && - revalidate > 0 - ) { - const clonedRes = res.clone() + if (init?.next?.revalidate === false) { + revalidate = CACHE_ONE_YEAR + } - let base64Body = '' + if ( + !staticGenerationStore.revalidate || + (typeof revalidate === 'number' && + revalidate < staticGenerationStore.revalidate) + ) { + staticGenerationStore.revalidate = revalidate + } - if (process.env.NEXT_RUNTIME === 'edge') { - let string = '' - new Uint8Array(await clonedRes.arrayBuffer()).forEach((byte) => { - string += String.fromCharCode(byte) - }) - base64Body = btoa(string) - } else { - base64Body = Buffer.from(await clonedRes.arrayBuffer()).toString( - 'base64' - ) - } + let cacheKey: string | undefined + + const doOriginalFetch = async () => { + return originFetch(input, init).then(async (res) => { + if ( + staticGenerationStore.incrementalCache && + cacheKey && + typeof revalidate === 'number' && + revalidate > 0 + ) { + const clonedRes = res.clone() + + let base64Body = '' + + if (process.env.NEXT_RUNTIME === 'edge') { + let string = '' + new Uint8Array(await clonedRes.arrayBuffer()).forEach((byte) => { + string += String.fromCharCode(byte) + }) + base64Body = btoa(string) + } else { + base64Body = Buffer.from(await clonedRes.arrayBuffer()).toString( + 'base64' + ) + } - await staticGenerationStore.incrementalCache.set( - cacheKey, - { - kind: 'FETCH', - isStale: false, - age: 0, - data: { - headers: Object.fromEntries(clonedRes.headers.entries()), - body: base64Body, + await staticGenerationStore.incrementalCache.set( + cacheKey, + { + kind: 'FETCH', + isStale: false, + age: 0, + data: { + headers: Object.fromEntries(clonedRes.headers.entries()), + body: base64Body, + }, + revalidate, }, revalidate, - }, - revalidate, - true - ) - } - return res - }) - } + true + ) + } + return res + }) + } - if ( - staticGenerationStore.incrementalCache && - typeof revalidate === 'number' && - revalidate > 0 - ) { - cacheKey = await staticGenerationStore.incrementalCache.fetchCacheKey( - input.toString(), - init - ) - const entry = await staticGenerationStore.incrementalCache.get( - cacheKey, - true - ) + if ( + staticGenerationStore.incrementalCache && + typeof revalidate === 'number' && + revalidate > 0 + ) { + cacheKey = await staticGenerationStore.incrementalCache.fetchCacheKey( + input.toString(), + init + ) + const entry = await staticGenerationStore.incrementalCache.get( + cacheKey, + true + ) - if (entry?.value && entry.value.kind === 'FETCH') { - // when stale and is revalidating we wait for fresh data - // so the revalidated entry has the updated data - if (!staticGenerationStore.isRevalidate || !entry.isStale) { - if (entry.isStale) { - if (!staticGenerationStore.pendingRevalidates) { - staticGenerationStore.pendingRevalidates = [] + if (entry?.value && entry.value.kind === 'FETCH') { + // when stale and is revalidating we wait for fresh data + // so the revalidated entry has the updated data + if (!staticGenerationStore.isRevalidate || !entry.isStale) { + if (entry.isStale) { + if (!staticGenerationStore.pendingRevalidates) { + staticGenerationStore.pendingRevalidates = [] + } + staticGenerationStore.pendingRevalidates.push( + doOriginalFetch().catch(console.error) + ) } - staticGenerationStore.pendingRevalidates.push( - doOriginalFetch().catch(console.error) - ) - } - const resData = entry.value.data - let decodedBody = '' + const resData = entry.value.data + let decodedBody = '' - // TODO: handle non-text response bodies - if (process.env.NEXT_RUNTIME === 'edge') { - decodedBody = atob(resData.body) - } else { - decodedBody = Buffer.from(resData.body, 'base64').toString() - } + // TODO: handle non-text response bodies + if (process.env.NEXT_RUNTIME === 'edge') { + decodedBody = atob(resData.body) + } else { + decodedBody = Buffer.from(resData.body, 'base64').toString() + } - return new Response(decodedBody, { - headers: resData.headers, - status: resData.status, - }) + return new Response(decodedBody, { + headers: resData.headers, + status: resData.status, + }) + } } } - } - - if (staticGenerationStore.isStaticGeneration) { - if (init && typeof init === 'object') { - const cache = init.cache - // Delete `cache` property as Cloudflare Workers will throw an error - if (isEdgeRuntime) { - delete init.cache - } - if (cache === 'no-store') { - staticGenerationStore.revalidate = 0 - // TODO: ensure this error isn't logged to the user - // seems it's slipping through currently - const dynamicUsageReason = `no-store fetch ${input}${ - staticGenerationStore.pathname - ? ` ${staticGenerationStore.pathname}` - : '' - }` - const err = new DynamicServerError(dynamicUsageReason) - staticGenerationStore.dynamicUsageStack = err.stack - staticGenerationStore.dynamicUsageDescription = dynamicUsageReason - - throw err - } - - const hasNextConfig = 'next' in init - const next = init.next || {} - if ( - typeof next.revalidate === 'number' && - (typeof staticGenerationStore.revalidate === 'undefined' || - next.revalidate < staticGenerationStore.revalidate) - ) { - const forceDynamic = staticGenerationStore.forceDynamic - if (!forceDynamic || next.revalidate !== 0) { - staticGenerationStore.revalidate = next.revalidate + if (staticGenerationStore.isStaticGeneration) { + if (init && typeof init === 'object') { + const cache = init.cache + // Delete `cache` property as Cloudflare Workers will throw an error + if (isEdgeRuntime) { + delete init.cache } - - if (!forceDynamic && next.revalidate === 0) { - const dynamicUsageReason = `revalidate: ${ - next.revalidate - } fetch ${input}${ + if (cache === 'no-store') { + staticGenerationStore.revalidate = 0 + // TODO: ensure this error isn't logged to the user + // seems it's slipping through currently + const dynamicUsageReason = `no-store fetch ${input}${ staticGenerationStore.pathname ? ` ${staticGenerationStore.pathname}` : '' @@ -477,13 +461,42 @@ function patchFetch(ComponentMod: any) { throw err } + + const hasNextConfig = 'next' in init + const next = init.next || {} + if ( + typeof next.revalidate === 'number' && + (typeof staticGenerationStore.revalidate === 'undefined' || + next.revalidate < staticGenerationStore.revalidate) + ) { + const forceDynamic = staticGenerationStore.forceDynamic + + if (!forceDynamic || next.revalidate !== 0) { + staticGenerationStore.revalidate = next.revalidate + } + + if (!forceDynamic && next.revalidate === 0) { + const dynamicUsageReason = `revalidate: ${ + next.revalidate + } fetch ${input}${ + staticGenerationStore.pathname + ? ` ${staticGenerationStore.pathname}` + : '' + }` + const err = new DynamicServerError(dynamicUsageReason) + staticGenerationStore.dynamicUsageStack = err.stack + staticGenerationStore.dynamicUsageDescription = dynamicUsageReason + + throw err + } + } + if (hasNextConfig) delete init.next } - if (hasNextConfig) delete init.next } - } - return doOriginalFetch() - } + return doOriginalFetch() + } + ) ;(globalThis.fetch as any).patched = true } @@ -916,9 +929,11 @@ function getScriptNonceFromHeader(cspHeaderValue: string): string | undefined { } async function renderToString(element: React.ReactElement) { - const renderStream = await ReactDOMServer.renderToReadableStream(element) - await renderStream.allReady - return streamToString(renderStream) + return getTracer().trace(AppRenderSpan.renderToString, async () => { + const renderStream = await ReactDOMServer.renderToReadableStream(element) + await renderStream.allReady + return streamToString(renderStream) + }) } export async function renderToHTMLOrFlight( @@ -1982,124 +1997,127 @@ export async function renderToHTMLOrFlight( ) } - const bodyResult = async () => { - const polyfills = buildManifest.polyfillFiles - .filter( - (polyfill) => - polyfill.endsWith('.js') && !polyfill.endsWith('.module.js') + const bodyResult = getTracer().wrap( + AppRenderSpan.getBodyResult, + async () => { + const polyfills = buildManifest.polyfillFiles + .filter( + (polyfill) => + polyfill.endsWith('.js') && !polyfill.endsWith('.module.js') + ) + .map((polyfill) => ({ + src: `${assetPrefix}/_next/${polyfill}`, + integrity: subresourceIntegrityManifest?.[polyfill], + })) + + const content = ( + + + ) - .map((polyfill) => ({ - src: `${assetPrefix}/_next/${polyfill}`, - integrity: subresourceIntegrityManifest?.[polyfill], - })) - - const content = ( - - - - ) - let polyfillsFlushed = false - const getServerInsertedHTML = (): Promise => { - const flushed = renderToString( - <> - {Array.from(serverInsertedHTMLCallbacks).map((callback) => - callback() - )} - {polyfillsFlushed - ? null - : polyfills?.map((polyfill) => { - return ( -