1 | {"version":3,"sources":["../../../telemetry/events/build.ts"],"names":["REGEXP_DIRECTORY_DUNDER","REGEXP_DIRECTORY_TESTS","REGEXP_FILE_TEST","EVENT_TYPE_CHECK_COMPLETED","eventTypeCheckCompleted","event","eventName","payload","EVENT_LINT_CHECK_COMPLETED","eventLintCheckCompleted","EVENT_BUILD_COMPLETED","eventBuildCompleted","pagePaths","totalPageCount","length","hasDunderPages","some","path","test","hasTestPages","EVENT_BUILD_OPTIMIZED","eventBuildOptimize"],"mappings":"mPAAA,KAAMA,CAAAA,uBAAuB,CAAG,mDAAhC,CACA,KAAMC,CAAAA,sBAAsB,CAAG,8BAA/B,CACA,KAAMC,CAAAA,gBAAgB,CAAG,0BAAzB,CAEA,KAAMC,CAAAA,0BAA0B,CAAG,2BAAnC,CASO,QAASC,CAAAA,uBAAT,CACLC,KADK,CAEoD,CACzD,MAAO,CACLC,SAAS,CAAEH,0BADN,CAELI,OAAO,CAAEF,KAFJ,CAAP,CAID,CAED,KAAMG,CAAAA,0BAA0B,CAAG,2BAAnC,CAYO,QAASC,CAAAA,uBAAT,CACLJ,KADK,CAEoD,CACzD,MAAO,CACLC,SAAS,CAAEE,0BADN,CAELD,OAAO,CAAEF,KAFJ,CAAP,CAID,CAED,KAAMK,CAAAA,qBAAqB,CAAG,sBAA9B,CAQO,QAASC,CAAAA,mBAAT,CACLC,SADK,CAELP,KAFK,CAMgD,CACrD,MAAO,CACLC,SAAS,CAAEI,qBADN,CAELH,OAAO,CAAE,CACP,GAAGF,KADI,CAEPQ,cAAc,CAAED,SAAS,CAACE,MAFnB,CAGPC,cAAc,CAAEH,SAAS,CAACI,IAAV,CAAgBC,IAAD,EAC7BjB,uBAAuB,CAACkB,IAAxB,CAA6BD,IAA7B,CADc,CAHT,CAMPE,YAAY,CAAEP,SAAS,CAACI,IAAV,CACXC,IAAD,EACEhB,sBAAsB,CAACiB,IAAvB,CAA4BD,IAA5B,GAAqCf,gBAAgB,CAACgB,IAAjB,CAAsBD,IAAtB,CAF3B,CANP,CAFJ,CAAP,CAcD,CAED,KAAMG,CAAAA,qBAAqB,CAAG,sBAA9B,CAoBO,QAASC,CAAAA,kBAAT,CACLT,SADK,CAELP,KAFK,CAMgD,CACrD,MAAO,CACLC,SAAS,CAAEc,qBADN,CAELb,OAAO,CAAE,CACP,GAAGF,KADI,CAEPQ,cAAc,CAAED,SAAS,CAACE,MAFnB,CAGPC,cAAc,CAAEH,SAAS,CAACI,IAAV,CAAgBC,IAAD,EAC7BjB,uBAAuB,CAACkB,IAAxB,CAA6BD,IAA7B,CADc,CAHT,CAMPE,YAAY,CAAEP,SAAS,CAACI,IAAV,CACXC,IAAD,EACEhB,sBAAsB,CAACiB,IAAvB,CAA4BD,IAA5B,GAAqCf,gBAAgB,CAACgB,IAAjB,CAAsBD,IAAtB,CAF3B,CANP,CAFJ,CAAP,CAcD","sourcesContent":["const REGEXP_DIRECTORY_DUNDER = /[\\\\/]__[^\\\\/]+(?<![\\\\/]__(?:tests|mocks))__[\\\\/]/i\nconst REGEXP_DIRECTORY_TESTS = /[\\\\/]__(tests|mocks)__[\\\\/]/i\nconst REGEXP_FILE_TEST = /\\.(?:spec|test)\\.[^.]+$/i\n\nconst EVENT_TYPE_CHECK_COMPLETED = 'NEXT_TYPE_CHECK_COMPLETED'\ntype EventTypeCheckCompleted = {\n durationInSeconds: number\n typescriptVersion: string | null\n inputFilesCount?: number\n totalFilesCount?: number\n incremental?: boolean\n}\n\nexport function eventTypeCheckCompleted(\n event: EventTypeCheckCompleted\n): { eventName: string; payload: EventTypeCheckCompleted } {\n return {\n eventName: EVENT_TYPE_CHECK_COMPLETED,\n payload: event,\n }\n}\n\nconst EVENT_LINT_CHECK_COMPLETED = 'NEXT_LINT_CHECK_COMPLETED'\nexport type EventLintCheckCompleted = {\n durationInSeconds: number\n eslintVersion: string | null\n lintedFilesCount?: number\n lintFix?: boolean\n buildLint?: boolean\n nextEslintPluginVersion?: string | null\n nextEslintPluginErrorsCount?: number\n nextEslintPluginWarningsCount?: number\n}\n\nexport function eventLintCheckCompleted(\n event: EventLintCheckCompleted\n): { eventName: string; payload: EventLintCheckCompleted } {\n return {\n eventName: EVENT_LINT_CHECK_COMPLETED,\n payload: event,\n }\n}\n\nconst EVENT_BUILD_COMPLETED = 'NEXT_BUILD_COMPLETED'\ntype EventBuildCompleted = {\n durationInSeconds: number\n totalPageCount: number\n hasDunderPages: boolean\n hasTestPages: boolean\n}\n\nexport function eventBuildCompleted(\n pagePaths: string[],\n event: Omit<\n EventBuildCompleted,\n 'totalPageCount' | 'hasDunderPages' | 'hasTestPages'\n >\n): { eventName: string; payload: EventBuildCompleted } {\n return {\n eventName: EVENT_BUILD_COMPLETED,\n payload: {\n ...event,\n totalPageCount: pagePaths.length,\n hasDunderPages: pagePaths.some((path) =>\n REGEXP_DIRECTORY_DUNDER.test(path)\n ),\n hasTestPages: pagePaths.some(\n (path) =>\n REGEXP_DIRECTORY_TESTS.test(path) || REGEXP_FILE_TEST.test(path)\n ),\n },\n }\n}\n\nconst EVENT_BUILD_OPTIMIZED = 'NEXT_BUILD_OPTIMIZED'\ntype EventBuildOptimized = {\n durationInSeconds: number\n totalPageCount: number\n staticPageCount: number\n staticPropsPageCount: number\n serverPropsPageCount: number\n ssrPageCount: number\n hasDunderPages: boolean\n hasTestPages: boolean\n hasStatic404: boolean\n hasReportWebVitals: boolean\n headersCount: number\n rewritesCount: number\n redirectsCount: number\n headersWithHasCount: number\n rewritesWithHasCount: number\n redirectsWithHasCount: number\n}\n\nexport function eventBuildOptimize(\n pagePaths: string[],\n event: Omit<\n EventBuildOptimized,\n 'totalPageCount' | 'hasDunderPages' | 'hasTestPages'\n >\n): { eventName: string; payload: EventBuildOptimized } {\n return {\n eventName: EVENT_BUILD_OPTIMIZED,\n payload: {\n ...event,\n totalPageCount: pagePaths.length,\n hasDunderPages: pagePaths.some((path) =>\n REGEXP_DIRECTORY_DUNDER.test(path)\n ),\n hasTestPages: pagePaths.some(\n (path) =>\n REGEXP_DIRECTORY_TESTS.test(path) || REGEXP_FILE_TEST.test(path)\n ),\n },\n }\n}\n"]} |