next 15.3.0-canary.5 → 15.3.0-canary.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/bin/next +3 -2
  2. package/dist/bin/next.map +1 -1
  3. package/dist/build/collect-build-traces.js +1 -1
  4. package/dist/build/collect-build-traces.js.map +1 -1
  5. package/dist/build/create-compiler-aliases.js +9 -0
  6. package/dist/build/create-compiler-aliases.js.map +1 -1
  7. package/dist/build/index.d.ts +1 -1
  8. package/dist/build/index.js +24 -11
  9. package/dist/build/index.js.map +1 -1
  10. package/dist/build/swc/index.js +1 -1
  11. package/dist/build/webpack/plugins/define-env-plugin.js +1 -0
  12. package/dist/build/webpack/plugins/define-env-plugin.js.map +1 -1
  13. package/dist/build/webpack-config.js +4 -6
  14. package/dist/build/webpack-config.js.map +1 -1
  15. package/dist/cli/next-build.d.ts +1 -1
  16. package/dist/cli/next-build.js.map +1 -1
  17. package/dist/client/app-bootstrap.js +1 -1
  18. package/dist/client/app-index.js +1 -0
  19. package/dist/client/app-index.js.map +1 -1
  20. package/dist/client/app-next-dev.d.ts +1 -0
  21. package/dist/client/app-next-dev.js +1 -0
  22. package/dist/client/app-next-dev.js.map +1 -1
  23. package/dist/client/app-next-turbopack.d.ts +1 -1
  24. package/dist/client/app-next-turbopack.js +1 -0
  25. package/dist/client/app-next-turbopack.js.map +1 -1
  26. package/dist/client/app-next.d.ts +1 -0
  27. package/dist/client/app-next.js +1 -0
  28. package/dist/client/app-next.js.map +1 -1
  29. package/dist/client/components/react-dev-overlay/ui/components/code-frame/code-frame.d.ts +1 -1
  30. package/dist/client/components/react-dev-overlay/ui/components/code-frame/code-frame.js +30 -36
  31. package/dist/client/components/react-dev-overlay/ui/components/code-frame/code-frame.js.map +1 -1
  32. package/dist/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.d.ts +8 -0
  33. package/dist/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.js +90 -0
  34. package/dist/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.js.map +1 -0
  35. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js +2 -2
  36. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js.map +1 -1
  37. package/dist/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.d.ts +1 -1
  38. package/dist/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.js +1 -1
  39. package/dist/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.js.map +1 -1
  40. package/dist/client/components/react-dev-overlay/ui/container/runtime-error/index.d.ts +1 -1
  41. package/dist/client/index.d.ts +1 -0
  42. package/dist/client/index.js +2 -1
  43. package/dist/client/index.js.map +1 -1
  44. package/dist/client/next-turbopack.d.ts +1 -1
  45. package/dist/client/next-turbopack.js +1 -1
  46. package/dist/client/next-turbopack.js.map +1 -1
  47. package/dist/client/next.d.ts +1 -0
  48. package/dist/client/next.js +1 -0
  49. package/dist/client/next.js.map +1 -1
  50. package/dist/client/page-bootstrap.d.ts +1 -0
  51. package/dist/client/page-bootstrap.js +1 -0
  52. package/dist/client/page-bootstrap.js.map +1 -1
  53. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +3 -3
  54. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
  55. package/dist/compiled/next-server/app-page.runtime.dev.js +3 -3
  56. package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
  57. package/dist/compiled/next-server/server.runtime.prod.js +4 -4
  58. package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
  59. package/dist/esm/build/collect-build-traces.js +1 -1
  60. package/dist/esm/build/collect-build-traces.js.map +1 -1
  61. package/dist/esm/build/create-compiler-aliases.js +9 -0
  62. package/dist/esm/build/create-compiler-aliases.js.map +1 -1
  63. package/dist/esm/build/index.js +24 -11
  64. package/dist/esm/build/index.js.map +1 -1
  65. package/dist/esm/build/swc/index.js +1 -1
  66. package/dist/esm/build/webpack/plugins/define-env-plugin.js +1 -0
  67. package/dist/esm/build/webpack/plugins/define-env-plugin.js.map +1 -1
  68. package/dist/esm/build/webpack-config.js +5 -7
  69. package/dist/esm/build/webpack-config.js.map +1 -1
  70. package/dist/esm/client/app-bootstrap.js +1 -1
  71. package/dist/esm/client/app-index.js +1 -0
  72. package/dist/esm/client/app-index.js.map +1 -1
  73. package/dist/esm/client/app-next-dev.js +1 -0
  74. package/dist/esm/client/app-next-dev.js.map +1 -1
  75. package/dist/esm/client/app-next-turbopack.js +1 -0
  76. package/dist/esm/client/app-next-turbopack.js.map +1 -1
  77. package/dist/esm/client/app-next.js +1 -0
  78. package/dist/esm/client/app-next.js.map +1 -1
  79. package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/code-frame.js +30 -35
  80. package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/code-frame.js.map +1 -1
  81. package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.js +58 -0
  82. package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.js.map +1 -0
  83. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js +2 -2
  84. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js.map +1 -1
  85. package/dist/esm/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.js +1 -1
  86. package/dist/esm/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.js.map +1 -1
  87. package/dist/esm/client/index.js +2 -1
  88. package/dist/esm/client/index.js.map +1 -1
  89. package/dist/esm/client/next-turbopack.js +1 -0
  90. package/dist/esm/client/next-turbopack.js.map +1 -1
  91. package/dist/esm/client/next.js +1 -0
  92. package/dist/esm/client/next.js.map +1 -1
  93. package/dist/esm/client/page-bootstrap.js +1 -0
  94. package/dist/esm/client/page-bootstrap.js.map +1 -1
  95. package/dist/esm/lib/require-instrumentation-client.js +10 -0
  96. package/dist/esm/lib/require-instrumentation-client.js.map +1 -0
  97. package/dist/esm/server/base-server.js +2 -1
  98. package/dist/esm/server/base-server.js.map +1 -1
  99. package/dist/esm/server/config-schema.js +2 -2
  100. package/dist/esm/server/config-schema.js.map +1 -1
  101. package/dist/esm/server/config-shared.js +0 -1
  102. package/dist/esm/server/config-shared.js.map +1 -1
  103. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  104. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  105. package/dist/esm/server/lib/app-info-log.js +1 -1
  106. package/dist/esm/server/lib/decode-query-path-parameter.js +16 -0
  107. package/dist/esm/server/lib/decode-query-path-parameter.js.map +1 -0
  108. package/dist/esm/server/lib/start-server.js +1 -1
  109. package/dist/esm/server/typescript/index.js +7 -4
  110. package/dist/esm/server/typescript/index.js.map +1 -1
  111. package/dist/esm/shared/lib/canary-only.js +1 -1
  112. package/dist/lib/require-instrumentation-client.d.ts +6 -0
  113. package/dist/lib/require-instrumentation-client.js +11 -0
  114. package/dist/lib/require-instrumentation-client.js.map +1 -0
  115. package/dist/server/base-server.js +2 -1
  116. package/dist/server/base-server.js.map +1 -1
  117. package/dist/server/config-schema.js +2 -2
  118. package/dist/server/config-schema.js.map +1 -1
  119. package/dist/server/config-shared.d.ts +8 -1
  120. package/dist/server/config-shared.js +0 -1
  121. package/dist/server/config-shared.js.map +1 -1
  122. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  123. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  124. package/dist/server/lib/app-info-log.js +1 -1
  125. package/dist/server/lib/decode-query-path-parameter.d.ts +7 -0
  126. package/dist/server/lib/decode-query-path-parameter.js +26 -0
  127. package/dist/server/lib/decode-query-path-parameter.js.map +1 -0
  128. package/dist/server/lib/start-server.js +1 -1
  129. package/dist/server/typescript/index.js +7 -4
  130. package/dist/server/typescript/index.js.map +1 -1
  131. package/dist/shared/lib/canary-only.js +1 -1
  132. package/dist/telemetry/anonymous-meta.js +1 -1
  133. package/dist/telemetry/events/session-stopped.js +2 -2
  134. package/dist/telemetry/events/version.js +2 -2
  135. package/package.json +15 -15
@@ -8,7 +8,7 @@ export type NextBuildOptions = {
8
8
  experimentalDebugMemoryUsage: boolean;
9
9
  experimentalAppOnly?: boolean;
10
10
  experimentalTurbo?: boolean;
11
- experimentalBuildMode: 'default' | 'compile' | 'generate';
11
+ experimentalBuildMode: 'default' | 'compile' | 'generate' | 'generate-env';
12
12
  experimentalUploadTrace?: string;
13
13
  };
14
14
  declare const nextBuild: (options: NextBuildOptions, directory?: string) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/next-build.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport '../server/lib/cpu-profile'\nimport { existsSync } from 'fs'\nimport { italic } from '../lib/picocolors'\nimport build from '../build'\nimport { warn } from '../build/output/log'\nimport { printAndExit } from '../server/lib/utils'\nimport isError from '../lib/is-error'\nimport { getProjectDir } from '../lib/get-project-dir'\nimport { enableMemoryDebuggingMode } from '../lib/memory/startup'\nimport { disableMemoryDebuggingMode } from '../lib/memory/shutdown'\n\nexport type NextBuildOptions = {\n debug?: boolean\n profile?: boolean\n lint: boolean\n mangling: boolean\n experimentalDebugMemoryUsage: boolean\n experimentalAppOnly?: boolean\n experimentalTurbo?: boolean\n experimentalBuildMode: 'default' | 'compile' | 'generate'\n experimentalUploadTrace?: string\n}\n\nconst nextBuild = (options: NextBuildOptions, directory?: string) => {\n process.on('SIGTERM', () => process.exit(143))\n process.on('SIGINT', () => process.exit(130))\n\n const {\n debug,\n experimentalDebugMemoryUsage,\n profile,\n lint,\n mangling,\n experimentalAppOnly,\n experimentalTurbo,\n experimentalBuildMode,\n experimentalUploadTrace,\n } = options\n\n let traceUploadUrl: string | undefined\n if (experimentalUploadTrace && !process.env.NEXT_TRACE_UPLOAD_DISABLED) {\n traceUploadUrl = experimentalUploadTrace\n }\n\n if (!lint) {\n warn('Linting is disabled.')\n }\n\n if (!mangling) {\n warn(\n 'Mangling is disabled. Note: This may affect performance and should only be used for debugging purposes.'\n )\n }\n\n if (profile) {\n warn(\n `Profiling is enabled. ${italic('Note: This may affect performance.')}`\n )\n }\n\n if (experimentalDebugMemoryUsage) {\n process.env.EXPERIMENTAL_DEBUG_MEMORY_USAGE = '1'\n enableMemoryDebuggingMode()\n }\n\n const dir = getProjectDir(directory)\n\n if (!existsSync(dir)) {\n printAndExit(`> No such directory exists as the project root: ${dir}`)\n }\n\n if (experimentalTurbo) {\n process.env.TURBOPACK = '1'\n }\n\n return build(\n dir,\n profile,\n debug || Boolean(process.env.NEXT_DEBUG_BUILD),\n lint,\n !mangling,\n experimentalAppOnly,\n !!process.env.TURBOPACK,\n experimentalBuildMode,\n traceUploadUrl\n )\n .catch((err) => {\n if (experimentalDebugMemoryUsage) {\n disableMemoryDebuggingMode()\n }\n console.error('')\n if (\n isError(err) &&\n (err.code === 'INVALID_RESOLVE_ALIAS' ||\n err.code === 'WEBPACK_ERRORS' ||\n err.code === 'BUILD_OPTIMIZATION_FAILED' ||\n err.code === 'NEXT_EXPORT_ERROR' ||\n err.code === 'NEXT_STATIC_GEN_BAILOUT' ||\n err.code === 'EDGE_RUNTIME_UNSUPPORTED_API')\n ) {\n printAndExit(`> ${err.message}`)\n } else {\n console.error('> Build error occurred')\n printAndExit(err)\n }\n })\n .finally(() => {\n if (experimentalDebugMemoryUsage) {\n disableMemoryDebuggingMode()\n }\n })\n}\n\nexport { nextBuild }\n"],"names":["nextBuild","options","directory","process","on","exit","debug","experimentalDebugMemoryUsage","profile","lint","mangling","experimentalAppOnly","experimentalTurbo","experimentalBuildMode","experimentalUploadTrace","traceUploadUrl","env","NEXT_TRACE_UPLOAD_DISABLED","warn","italic","EXPERIMENTAL_DEBUG_MEMORY_USAGE","enableMemoryDebuggingMode","dir","getProjectDir","existsSync","printAndExit","TURBOPACK","build","Boolean","NEXT_DEBUG_BUILD","catch","err","disableMemoryDebuggingMode","console","error","isError","code","message","finally"],"mappings":";;;;;+BAmHSA;;;eAAAA;;;QAjHF;oBACoB;4BACJ;8DACL;qBACG;uBACQ;gEACT;+BACU;yBACY;0BACC;;;;;;AAc3C,MAAMA,YAAY,CAACC,SAA2BC;IAC5CC,QAAQC,EAAE,CAAC,WAAW,IAAMD,QAAQE,IAAI,CAAC;IACzCF,QAAQC,EAAE,CAAC,UAAU,IAAMD,QAAQE,IAAI,CAAC;IAExC,MAAM,EACJC,KAAK,EACLC,4BAA4B,EAC5BC,OAAO,EACPC,IAAI,EACJC,QAAQ,EACRC,mBAAmB,EACnBC,iBAAiB,EACjBC,qBAAqB,EACrBC,uBAAuB,EACxB,GAAGb;IAEJ,IAAIc;IACJ,IAAID,2BAA2B,CAACX,QAAQa,GAAG,CAACC,0BAA0B,EAAE;QACtEF,iBAAiBD;IACnB;IAEA,IAAI,CAACL,MAAM;QACTS,IAAAA,SAAI,EAAC;IACP;IAEA,IAAI,CAACR,UAAU;QACbQ,IAAAA,SAAI,EACF;IAEJ;IAEA,IAAIV,SAAS;QACXU,IAAAA,SAAI,EACF,CAAC,sBAAsB,EAAEC,IAAAA,kBAAM,EAAC,uCAAuC;IAE3E;IAEA,IAAIZ,8BAA8B;QAChCJ,QAAQa,GAAG,CAACI,+BAA+B,GAAG;QAC9CC,IAAAA,kCAAyB;IAC3B;IAEA,MAAMC,MAAMC,IAAAA,4BAAa,EAACrB;IAE1B,IAAI,CAACsB,IAAAA,cAAU,EAACF,MAAM;QACpBG,IAAAA,mBAAY,EAAC,CAAC,gDAAgD,EAAEH,KAAK;IACvE;IAEA,IAAIV,mBAAmB;QACrBT,QAAQa,GAAG,CAACU,SAAS,GAAG;IAC1B;IAEA,OAAOC,IAAAA,cAAK,EACVL,KACAd,SACAF,SAASsB,QAAQzB,QAAQa,GAAG,CAACa,gBAAgB,GAC7CpB,MACA,CAACC,UACDC,qBACA,CAAC,CAACR,QAAQa,GAAG,CAACU,SAAS,EACvBb,uBACAE,gBAECe,KAAK,CAAC,CAACC;QACN,IAAIxB,8BAA8B;YAChCyB,IAAAA,oCAA0B;QAC5B;QACAC,QAAQC,KAAK,CAAC;QACd,IACEC,IAAAA,gBAAO,EAACJ,QACPA,CAAAA,IAAIK,IAAI,KAAK,2BACZL,IAAIK,IAAI,KAAK,oBACbL,IAAIK,IAAI,KAAK,+BACbL,IAAIK,IAAI,KAAK,uBACbL,IAAIK,IAAI,KAAK,6BACbL,IAAIK,IAAI,KAAK,8BAA6B,GAC5C;YACAX,IAAAA,mBAAY,EAAC,CAAC,EAAE,EAAEM,IAAIM,OAAO,EAAE;QACjC,OAAO;YACLJ,QAAQC,KAAK,CAAC;YACdT,IAAAA,mBAAY,EAACM;QACf;IACF,GACCO,OAAO,CAAC;QACP,IAAI/B,8BAA8B;YAChCyB,IAAAA,oCAA0B;QAC5B;IACF;AACJ"}
1
+ {"version":3,"sources":["../../src/cli/next-build.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport '../server/lib/cpu-profile'\nimport { existsSync } from 'fs'\nimport { italic } from '../lib/picocolors'\nimport build from '../build'\nimport { warn } from '../build/output/log'\nimport { printAndExit } from '../server/lib/utils'\nimport isError from '../lib/is-error'\nimport { getProjectDir } from '../lib/get-project-dir'\nimport { enableMemoryDebuggingMode } from '../lib/memory/startup'\nimport { disableMemoryDebuggingMode } from '../lib/memory/shutdown'\n\nexport type NextBuildOptions = {\n debug?: boolean\n profile?: boolean\n lint: boolean\n mangling: boolean\n experimentalDebugMemoryUsage: boolean\n experimentalAppOnly?: boolean\n experimentalTurbo?: boolean\n experimentalBuildMode: 'default' | 'compile' | 'generate' | 'generate-env'\n experimentalUploadTrace?: string\n}\n\nconst nextBuild = (options: NextBuildOptions, directory?: string) => {\n process.on('SIGTERM', () => process.exit(143))\n process.on('SIGINT', () => process.exit(130))\n\n const {\n debug,\n experimentalDebugMemoryUsage,\n profile,\n lint,\n mangling,\n experimentalAppOnly,\n experimentalTurbo,\n experimentalBuildMode,\n experimentalUploadTrace,\n } = options\n\n let traceUploadUrl: string | undefined\n if (experimentalUploadTrace && !process.env.NEXT_TRACE_UPLOAD_DISABLED) {\n traceUploadUrl = experimentalUploadTrace\n }\n\n if (!lint) {\n warn('Linting is disabled.')\n }\n\n if (!mangling) {\n warn(\n 'Mangling is disabled. Note: This may affect performance and should only be used for debugging purposes.'\n )\n }\n\n if (profile) {\n warn(\n `Profiling is enabled. ${italic('Note: This may affect performance.')}`\n )\n }\n\n if (experimentalDebugMemoryUsage) {\n process.env.EXPERIMENTAL_DEBUG_MEMORY_USAGE = '1'\n enableMemoryDebuggingMode()\n }\n\n const dir = getProjectDir(directory)\n\n if (!existsSync(dir)) {\n printAndExit(`> No such directory exists as the project root: ${dir}`)\n }\n\n if (experimentalTurbo) {\n process.env.TURBOPACK = '1'\n }\n\n return build(\n dir,\n profile,\n debug || Boolean(process.env.NEXT_DEBUG_BUILD),\n lint,\n !mangling,\n experimentalAppOnly,\n !!process.env.TURBOPACK,\n experimentalBuildMode,\n traceUploadUrl\n )\n .catch((err) => {\n if (experimentalDebugMemoryUsage) {\n disableMemoryDebuggingMode()\n }\n console.error('')\n if (\n isError(err) &&\n (err.code === 'INVALID_RESOLVE_ALIAS' ||\n err.code === 'WEBPACK_ERRORS' ||\n err.code === 'BUILD_OPTIMIZATION_FAILED' ||\n err.code === 'NEXT_EXPORT_ERROR' ||\n err.code === 'NEXT_STATIC_GEN_BAILOUT' ||\n err.code === 'EDGE_RUNTIME_UNSUPPORTED_API')\n ) {\n printAndExit(`> ${err.message}`)\n } else {\n console.error('> Build error occurred')\n printAndExit(err)\n }\n })\n .finally(() => {\n if (experimentalDebugMemoryUsage) {\n disableMemoryDebuggingMode()\n }\n })\n}\n\nexport { nextBuild }\n"],"names":["nextBuild","options","directory","process","on","exit","debug","experimentalDebugMemoryUsage","profile","lint","mangling","experimentalAppOnly","experimentalTurbo","experimentalBuildMode","experimentalUploadTrace","traceUploadUrl","env","NEXT_TRACE_UPLOAD_DISABLED","warn","italic","EXPERIMENTAL_DEBUG_MEMORY_USAGE","enableMemoryDebuggingMode","dir","getProjectDir","existsSync","printAndExit","TURBOPACK","build","Boolean","NEXT_DEBUG_BUILD","catch","err","disableMemoryDebuggingMode","console","error","isError","code","message","finally"],"mappings":";;;;;+BAmHSA;;;eAAAA;;;QAjHF;oBACoB;4BACJ;8DACL;qBACG;uBACQ;gEACT;+BACU;yBACY;0BACC;;;;;;AAc3C,MAAMA,YAAY,CAACC,SAA2BC;IAC5CC,QAAQC,EAAE,CAAC,WAAW,IAAMD,QAAQE,IAAI,CAAC;IACzCF,QAAQC,EAAE,CAAC,UAAU,IAAMD,QAAQE,IAAI,CAAC;IAExC,MAAM,EACJC,KAAK,EACLC,4BAA4B,EAC5BC,OAAO,EACPC,IAAI,EACJC,QAAQ,EACRC,mBAAmB,EACnBC,iBAAiB,EACjBC,qBAAqB,EACrBC,uBAAuB,EACxB,GAAGb;IAEJ,IAAIc;IACJ,IAAID,2BAA2B,CAACX,QAAQa,GAAG,CAACC,0BAA0B,EAAE;QACtEF,iBAAiBD;IACnB;IAEA,IAAI,CAACL,MAAM;QACTS,IAAAA,SAAI,EAAC;IACP;IAEA,IAAI,CAACR,UAAU;QACbQ,IAAAA,SAAI,EACF;IAEJ;IAEA,IAAIV,SAAS;QACXU,IAAAA,SAAI,EACF,CAAC,sBAAsB,EAAEC,IAAAA,kBAAM,EAAC,uCAAuC;IAE3E;IAEA,IAAIZ,8BAA8B;QAChCJ,QAAQa,GAAG,CAACI,+BAA+B,GAAG;QAC9CC,IAAAA,kCAAyB;IAC3B;IAEA,MAAMC,MAAMC,IAAAA,4BAAa,EAACrB;IAE1B,IAAI,CAACsB,IAAAA,cAAU,EAACF,MAAM;QACpBG,IAAAA,mBAAY,EAAC,CAAC,gDAAgD,EAAEH,KAAK;IACvE;IAEA,IAAIV,mBAAmB;QACrBT,QAAQa,GAAG,CAACU,SAAS,GAAG;IAC1B;IAEA,OAAOC,IAAAA,cAAK,EACVL,KACAd,SACAF,SAASsB,QAAQzB,QAAQa,GAAG,CAACa,gBAAgB,GAC7CpB,MACA,CAACC,UACDC,qBACA,CAAC,CAACR,QAAQa,GAAG,CAACU,SAAS,EACvBb,uBACAE,gBAECe,KAAK,CAAC,CAACC;QACN,IAAIxB,8BAA8B;YAChCyB,IAAAA,oCAA0B;QAC5B;QACAC,QAAQC,KAAK,CAAC;QACd,IACEC,IAAAA,gBAAO,EAACJ,QACPA,CAAAA,IAAIK,IAAI,KAAK,2BACZL,IAAIK,IAAI,KAAK,oBACbL,IAAIK,IAAI,KAAK,+BACbL,IAAIK,IAAI,KAAK,uBACbL,IAAIK,IAAI,KAAK,6BACbL,IAAIK,IAAI,KAAK,8BAA6B,GAC5C;YACAX,IAAAA,mBAAY,EAAC,CAAC,EAAE,EAAEM,IAAIM,OAAO,EAAE;QACjC,OAAO;YACLJ,QAAQC,KAAK,CAAC;YACdT,IAAAA,mBAAY,EAACM;QACf;IACF,GACCO,OAAO,CAAC;QACP,IAAI/B,8BAA8B;YAChCyB,IAAAA,oCAA0B;QAC5B;IACF;AACJ"}
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "appBootstrap", {
13
13
  return appBootstrap;
14
14
  }
15
15
  });
16
- const version = "15.3.0-canary.5";
16
+ const version = "15.3.0-canary.8";
17
17
  window.next = {
18
18
  version,
19
19
  appDir: true
@@ -178,6 +178,7 @@ function Root(param) {
178
178
  // eslint-disable-next-line react-hooks/rules-of-hooks
179
179
  _react.default.useEffect(()=>{
180
180
  window.__NEXT_HYDRATED = true;
181
+ window.__NEXT_HYDRATED_AT = performance.now();
181
182
  window.__NEXT_HYDRATED_CB == null ? void 0 : window.__NEXT_HYDRATED_CB.call(window);
182
183
  }, []);
183
184
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/app-index.tsx"],"sourcesContent":["// imports polyfill from `@next/polyfill-module` after build.\nimport '../build/polyfills/polyfill-module'\n\nimport './components/globals/patch-console'\nimport './components/globals/handle-global-errors'\n\nimport ReactDOMClient from 'react-dom/client'\nimport React, { use } from 'react'\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { createFromReadableStream } from 'react-server-dom-webpack/client'\nimport { HeadManagerContext } from '../shared/lib/head-manager-context.shared-runtime'\nimport { onRecoverableError } from './react-client-callbacks/on-recoverable-error'\nimport {\n onCaughtError,\n onUncaughtError,\n} from './react-client-callbacks/error-boundary-callbacks'\nimport { callServer } from './app-call-server'\nimport { findSourceMapURL } from './app-find-source-map-url'\nimport {\n type AppRouterActionQueue,\n createMutableActionQueue,\n} from '../shared/lib/router/action-queue'\nimport AppRouter from './components/app-router'\nimport type { InitialRSCPayload } from '../server/app-render/types'\nimport { createInitialRouterState } from './components/router-reducer/create-initial-router-state'\nimport { MissingSlotContext } from '../shared/lib/app-router-context.shared-runtime'\nimport { setAppBuildId } from './app-build-id'\nimport { shouldRenderRootLevelErrorOverlay } from './lib/is-error-thrown-while-rendering-rsc'\n\n/// <reference types=\"react-dom/experimental\" />\n\nconst appElement: HTMLElement | Document = document\n\nconst encoder = new TextEncoder()\n\nlet initialServerDataBuffer: (string | Uint8Array)[] | undefined = undefined\nlet initialServerDataWriter: ReadableStreamDefaultController | undefined =\n undefined\nlet initialServerDataLoaded = false\nlet initialServerDataFlushed = false\n\nlet initialFormStateData: null | any = null\n\ntype FlightSegment =\n | [isBootStrap: 0]\n | [isNotBootstrap: 1, responsePartial: string]\n | [isFormState: 2, formState: any]\n | [isBinary: 3, responseBase64Partial: string]\n\ntype NextFlight = Omit<Array<FlightSegment>, 'push'> & {\n push: (seg: FlightSegment) => void\n}\n\ndeclare global {\n // If you're working in a browser environment\n interface Window {\n __next_f: NextFlight\n }\n}\n\nfunction nextServerDataCallback(seg: FlightSegment): void {\n if (seg[0] === 0) {\n initialServerDataBuffer = []\n } else if (seg[0] === 1) {\n if (!initialServerDataBuffer)\n throw new Error('Unexpected server data: missing bootstrap script.')\n\n if (initialServerDataWriter) {\n initialServerDataWriter.enqueue(encoder.encode(seg[1]))\n } else {\n initialServerDataBuffer.push(seg[1])\n }\n } else if (seg[0] === 2) {\n initialFormStateData = seg[1]\n } else if (seg[0] === 3) {\n if (!initialServerDataBuffer)\n throw new Error('Unexpected server data: missing bootstrap script.')\n\n // Decode the base64 string back to binary data.\n const binaryString = atob(seg[1])\n const decodedChunk = new Uint8Array(binaryString.length)\n for (var i = 0; i < binaryString.length; i++) {\n decodedChunk[i] = binaryString.charCodeAt(i)\n }\n\n if (initialServerDataWriter) {\n initialServerDataWriter.enqueue(decodedChunk)\n } else {\n initialServerDataBuffer.push(decodedChunk)\n }\n }\n}\n\nfunction isStreamErrorOrUnfinished(ctr: ReadableStreamDefaultController) {\n // If `desiredSize` is null, it means the stream is closed or errored. If it is lower than 0, the stream is still unfinished.\n return ctr.desiredSize === null || ctr.desiredSize < 0\n}\n\n// There might be race conditions between `nextServerDataRegisterWriter` and\n// `DOMContentLoaded`. The former will be called when React starts to hydrate\n// the root, the latter will be called when the DOM is fully loaded.\n// For streaming, the former is called first due to partial hydration.\n// For non-streaming, the latter can be called first.\n// Hence, we use two variables `initialServerDataLoaded` and\n// `initialServerDataFlushed` to make sure the writer will be closed and\n// `initialServerDataBuffer` will be cleared in the right time.\nfunction nextServerDataRegisterWriter(ctr: ReadableStreamDefaultController) {\n if (initialServerDataBuffer) {\n initialServerDataBuffer.forEach((val) => {\n ctr.enqueue(typeof val === 'string' ? encoder.encode(val) : val)\n })\n if (initialServerDataLoaded && !initialServerDataFlushed) {\n if (isStreamErrorOrUnfinished(ctr)) {\n ctr.error(\n new Error(\n 'The connection to the page was unexpectedly closed, possibly due to the stop button being clicked, loss of Wi-Fi, or an unstable internet connection.'\n )\n )\n } else {\n ctr.close()\n }\n initialServerDataFlushed = true\n initialServerDataBuffer = undefined\n }\n }\n\n initialServerDataWriter = ctr\n}\n\n// When `DOMContentLoaded`, we can close all pending writers to finish hydration.\nconst DOMContentLoaded = function () {\n if (initialServerDataWriter && !initialServerDataFlushed) {\n initialServerDataWriter.close()\n initialServerDataFlushed = true\n initialServerDataBuffer = undefined\n }\n initialServerDataLoaded = true\n}\n\n// It's possible that the DOM is already loaded.\nif (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', DOMContentLoaded, false)\n} else {\n // Delayed in marco task to ensure it's executed later than hydration\n setTimeout(DOMContentLoaded)\n}\n\nconst nextServerDataLoadingGlobal = (self.__next_f = self.__next_f || [])\nnextServerDataLoadingGlobal.forEach(nextServerDataCallback)\nnextServerDataLoadingGlobal.push = nextServerDataCallback\n\nconst readable = new ReadableStream({\n start(controller) {\n nextServerDataRegisterWriter(controller)\n },\n})\n\nconst initialServerResponse = createFromReadableStream<InitialRSCPayload>(\n readable,\n { callServer, findSourceMapURL }\n)\n\n// React overrides `.then` and doesn't return a new promise chain,\n// so we wrap the action queue in a promise to ensure that its value\n// is defined when the promise resolves.\n// https://github.com/facebook/react/blob/163365a07872337e04826c4f501565d43dbd2fd4/packages/react-client/src/ReactFlightClient.js#L189-L190\nconst pendingActionQueue: Promise<AppRouterActionQueue> = new Promise(\n (resolve, reject) => {\n initialServerResponse.then(\n (initialRSCPayload) => {\n // setAppBuildId should be called only once, during JS initialization\n // and before any components have hydrated.\n setAppBuildId(initialRSCPayload.b)\n\n resolve(\n createMutableActionQueue(\n createInitialRouterState({\n initialFlightData: initialRSCPayload.f,\n initialCanonicalUrlParts: initialRSCPayload.c,\n initialParallelRoutes: new Map(),\n location: window.location,\n couldBeIntercepted: initialRSCPayload.i,\n postponed: initialRSCPayload.s,\n prerendered: initialRSCPayload.S,\n })\n )\n )\n },\n (err: Error) => reject(err)\n )\n }\n)\n\nfunction ServerRoot(): React.ReactNode {\n const initialRSCPayload = use(initialServerResponse)\n const actionQueue = use<AppRouterActionQueue>(pendingActionQueue)\n\n const router = (\n <AppRouter\n actionQueue={actionQueue}\n globalErrorComponentAndStyles={initialRSCPayload.G}\n assetPrefix={initialRSCPayload.p}\n />\n )\n\n if (process.env.NODE_ENV === 'development' && initialRSCPayload.m) {\n // We provide missing slot information in a context provider only during development\n // as we log some additional information about the missing slots in the console.\n return (\n <MissingSlotContext value={initialRSCPayload.m}>\n {router}\n </MissingSlotContext>\n )\n }\n\n return router\n}\n\nconst StrictModeIfEnabled = process.env.__NEXT_STRICT_MODE_APP\n ? React.StrictMode\n : React.Fragment\n\nfunction Root({ children }: React.PropsWithChildren<{}>) {\n if (process.env.__NEXT_TEST_MODE) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n window.__NEXT_HYDRATED = true\n window.__NEXT_HYDRATED_CB?.()\n }, [])\n }\n\n return children\n}\n\nconst reactRootOptions: ReactDOMClient.RootOptions = {\n onRecoverableError,\n onCaughtError,\n onUncaughtError,\n}\n\nexport function hydrate() {\n const reactEl = (\n <StrictModeIfEnabled>\n <HeadManagerContext.Provider value={{ appDir: true }}>\n <Root>\n <ServerRoot />\n </Root>\n </HeadManagerContext.Provider>\n </StrictModeIfEnabled>\n )\n\n if (\n document.documentElement.id === '__next_error__' ||\n !!window.__next_root_layout_missing_tags?.length\n ) {\n let element = reactEl\n // Server rendering failed, fall back to client-side rendering\n if (\n process.env.NODE_ENV !== 'production' &&\n shouldRenderRootLevelErrorOverlay()\n ) {\n const { createRootLevelDevOverlayElement } =\n require('./components/react-dev-overlay/app/client-entry') as typeof import('./components/react-dev-overlay/app/client-entry')\n\n // Note this won't cause hydration mismatch because we are doing CSR w/o hydration\n element = createRootLevelDevOverlayElement(element)\n }\n\n ReactDOMClient.createRoot(appElement, reactRootOptions).render(element)\n } else {\n React.startTransition(() => {\n ReactDOMClient.hydrateRoot(appElement, reactEl, {\n ...reactRootOptions,\n formState: initialFormStateData,\n })\n })\n }\n\n // TODO-APP: Remove this logic when Float has GC built-in in development.\n if (process.env.NODE_ENV !== 'production') {\n const { linkGc } =\n require('./app-link-gc') as typeof import('./app-link-gc')\n linkGc()\n }\n}\n"],"names":["hydrate","appElement","document","encoder","TextEncoder","initialServerDataBuffer","undefined","initialServerDataWriter","initialServerDataLoaded","initialServerDataFlushed","initialFormStateData","nextServerDataCallback","seg","Error","enqueue","encode","push","binaryString","atob","decodedChunk","Uint8Array","length","i","charCodeAt","isStreamErrorOrUnfinished","ctr","desiredSize","nextServerDataRegisterWriter","forEach","val","error","close","DOMContentLoaded","readyState","addEventListener","setTimeout","nextServerDataLoadingGlobal","self","__next_f","readable","ReadableStream","start","controller","initialServerResponse","createFromReadableStream","callServer","findSourceMapURL","pendingActionQueue","Promise","resolve","reject","then","initialRSCPayload","setAppBuildId","b","createMutableActionQueue","createInitialRouterState","initialFlightData","f","initialCanonicalUrlParts","c","initialParallelRoutes","Map","location","window","couldBeIntercepted","postponed","s","prerendered","S","err","ServerRoot","use","actionQueue","router","AppRouter","globalErrorComponentAndStyles","G","assetPrefix","p","process","env","NODE_ENV","m","MissingSlotContext","value","StrictModeIfEnabled","__NEXT_STRICT_MODE_APP","React","StrictMode","Fragment","Root","children","__NEXT_TEST_MODE","useEffect","__NEXT_HYDRATED","__NEXT_HYDRATED_CB","reactRootOptions","onRecoverableError","onCaughtError","onUncaughtError","reactEl","HeadManagerContext","Provider","appDir","documentElement","id","__next_root_layout_missing_tags","element","shouldRenderRootLevelErrorOverlay","createRootLevelDevOverlayElement","require","ReactDOMClient","createRoot","render","startTransition","hydrateRoot","formState","linkGc"],"mappings":"AAAA,6DAA6D;;;;;+BAgP7CA;;;eAAAA;;;;;;QA/OT;QAEA;QACA;iEAEoB;iEACA;yBAEc;iDACN;oCACA;wCAI5B;+BACoB;qCACM;6BAI1B;oEACe;0CAEmB;+CACN;4BACL;gDACoB;AAElD,gDAAgD;AAEhD,MAAMC,aAAqCC;AAE3C,MAAMC,UAAU,IAAIC;AAEpB,IAAIC,0BAA+DC;AACnE,IAAIC,0BACFD;AACF,IAAIE,0BAA0B;AAC9B,IAAIC,2BAA2B;AAE/B,IAAIC,uBAAmC;AAmBvC,SAASC,uBAAuBC,GAAkB;IAChD,IAAIA,GAAG,CAAC,EAA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VgE;IAZJ,MAAMqC,wBACJ,qBAACf;kBACC,cAAA,qBAACgB,mDAAkB,CAACC,QAAQ;YAAClB,OAAO;gBAAEmB,QAAQ;YAAK;sBACjD,cAAA,qBAACb;0BACC,cAAA,qBAACpB;;;;IAMT,IACErE,SAASuG,eAAe,CAACC,EAAE,KAAK,oBAChC,CAAC,GAAC1C,0CAAAA,OAAO2C,+BAA+B,qBAAtC3C,wCAAwC3C,MAAM,GAChD;QACA,IAAIuF,UAAUP;QACd,8DAA8D;QAC9D,IACErB,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBACzB2B,IAAAA,iEAAiC,KACjC;YACA,MAAM,EAAEC,gCAAgC,EAAE,GACxCC,QAAQ;YAEV,kFAAkF;YAClFH,UAAUE,iCAAiCF;QAC7C;QAEAI,eAAc,CAACC,UAAU,CAAChH,YAAYgG,kBAAkBiB,MAAM,CAACN;IACjE,OAAO;QACLpB,cAAK,CAAC2B,eAAe,CAAC;YACpBH,eAAc,CAACI,WAAW,CAACnH,YAAYoG,SAAS;gBAC9C,GAAGJ,gBAAgB;gBACnBoB,WAAW3G;YACb;QACF;IACF;IAEA,yEAAyE;IACzE,IAAIsE,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,MAAM,EAAEoC,MAAM,EAAE,GACdP,QAAQ;QACVO;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/client/app-index.tsx"],"sourcesContent":["// imports polyfill from `@next/polyfill-module` after build.\nimport '../build/polyfills/polyfill-module'\n\nimport './components/globals/patch-console'\nimport './components/globals/handle-global-errors'\n\nimport ReactDOMClient from 'react-dom/client'\nimport React, { use } from 'react'\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { createFromReadableStream } from 'react-server-dom-webpack/client'\nimport { HeadManagerContext } from '../shared/lib/head-manager-context.shared-runtime'\nimport { onRecoverableError } from './react-client-callbacks/on-recoverable-error'\nimport {\n onCaughtError,\n onUncaughtError,\n} from './react-client-callbacks/error-boundary-callbacks'\nimport { callServer } from './app-call-server'\nimport { findSourceMapURL } from './app-find-source-map-url'\nimport {\n type AppRouterActionQueue,\n createMutableActionQueue,\n} from '../shared/lib/router/action-queue'\nimport AppRouter from './components/app-router'\nimport type { InitialRSCPayload } from '../server/app-render/types'\nimport { createInitialRouterState } from './components/router-reducer/create-initial-router-state'\nimport { MissingSlotContext } from '../shared/lib/app-router-context.shared-runtime'\nimport { setAppBuildId } from './app-build-id'\nimport { shouldRenderRootLevelErrorOverlay } from './lib/is-error-thrown-while-rendering-rsc'\n\n/// <reference types=\"react-dom/experimental\" />\n\nconst appElement: HTMLElement | Document = document\n\nconst encoder = new TextEncoder()\n\nlet initialServerDataBuffer: (string | Uint8Array)[] | undefined = undefined\nlet initialServerDataWriter: ReadableStreamDefaultController | undefined =\n undefined\nlet initialServerDataLoaded = false\nlet initialServerDataFlushed = false\n\nlet initialFormStateData: null | any = null\n\ntype FlightSegment =\n | [isBootStrap: 0]\n | [isNotBootstrap: 1, responsePartial: string]\n | [isFormState: 2, formState: any]\n | [isBinary: 3, responseBase64Partial: string]\n\ntype NextFlight = Omit<Array<FlightSegment>, 'push'> & {\n push: (seg: FlightSegment) => void\n}\n\ndeclare global {\n // If you're working in a browser environment\n interface Window {\n __next_f: NextFlight\n }\n}\n\nfunction nextServerDataCallback(seg: FlightSegment): void {\n if (seg[0] === 0) {\n initialServerDataBuffer = []\n } else if (seg[0] === 1) {\n if (!initialServerDataBuffer)\n throw new Error('Unexpected server data: missing bootstrap script.')\n\n if (initialServerDataWriter) {\n initialServerDataWriter.enqueue(encoder.encode(seg[1]))\n } else {\n initialServerDataBuffer.push(seg[1])\n }\n } else if (seg[0] === 2) {\n initialFormStateData = seg[1]\n } else if (seg[0] === 3) {\n if (!initialServerDataBuffer)\n throw new Error('Unexpected server data: missing bootstrap script.')\n\n // Decode the base64 string back to binary data.\n const binaryString = atob(seg[1])\n const decodedChunk = new Uint8Array(binaryString.length)\n for (var i = 0; i < binaryString.length; i++) {\n decodedChunk[i] = binaryString.charCodeAt(i)\n }\n\n if (initialServerDataWriter) {\n initialServerDataWriter.enqueue(decodedChunk)\n } else {\n initialServerDataBuffer.push(decodedChunk)\n }\n }\n}\n\nfunction isStreamErrorOrUnfinished(ctr: ReadableStreamDefaultController) {\n // If `desiredSize` is null, it means the stream is closed or errored. If it is lower than 0, the stream is still unfinished.\n return ctr.desiredSize === null || ctr.desiredSize < 0\n}\n\n// There might be race conditions between `nextServerDataRegisterWriter` and\n// `DOMContentLoaded`. The former will be called when React starts to hydrate\n// the root, the latter will be called when the DOM is fully loaded.\n// For streaming, the former is called first due to partial hydration.\n// For non-streaming, the latter can be called first.\n// Hence, we use two variables `initialServerDataLoaded` and\n// `initialServerDataFlushed` to make sure the writer will be closed and\n// `initialServerDataBuffer` will be cleared in the right time.\nfunction nextServerDataRegisterWriter(ctr: ReadableStreamDefaultController) {\n if (initialServerDataBuffer) {\n initialServerDataBuffer.forEach((val) => {\n ctr.enqueue(typeof val === 'string' ? encoder.encode(val) : val)\n })\n if (initialServerDataLoaded && !initialServerDataFlushed) {\n if (isStreamErrorOrUnfinished(ctr)) {\n ctr.error(\n new Error(\n 'The connection to the page was unexpectedly closed, possibly due to the stop button being clicked, loss of Wi-Fi, or an unstable internet connection.'\n )\n )\n } else {\n ctr.close()\n }\n initialServerDataFlushed = true\n initialServerDataBuffer = undefined\n }\n }\n\n initialServerDataWriter = ctr\n}\n\n// When `DOMContentLoaded`, we can close all pending writers to finish hydration.\nconst DOMContentLoaded = function () {\n if (initialServerDataWriter && !initialServerDataFlushed) {\n initialServerDataWriter.close()\n initialServerDataFlushed = true\n initialServerDataBuffer = undefined\n }\n initialServerDataLoaded = true\n}\n\n// It's possible that the DOM is already loaded.\nif (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', DOMContentLoaded, false)\n} else {\n // Delayed in marco task to ensure it's executed later than hydration\n setTimeout(DOMContentLoaded)\n}\n\nconst nextServerDataLoadingGlobal = (self.__next_f = self.__next_f || [])\nnextServerDataLoadingGlobal.forEach(nextServerDataCallback)\nnextServerDataLoadingGlobal.push = nextServerDataCallback\n\nconst readable = new ReadableStream({\n start(controller) {\n nextServerDataRegisterWriter(controller)\n },\n})\n\nconst initialServerResponse = createFromReadableStream<InitialRSCPayload>(\n readable,\n { callServer, findSourceMapURL }\n)\n\n// React overrides `.then` and doesn't return a new promise chain,\n// so we wrap the action queue in a promise to ensure that its value\n// is defined when the promise resolves.\n// https://github.com/facebook/react/blob/163365a07872337e04826c4f501565d43dbd2fd4/packages/react-client/src/ReactFlightClient.js#L189-L190\nconst pendingActionQueue: Promise<AppRouterActionQueue> = new Promise(\n (resolve, reject) => {\n initialServerResponse.then(\n (initialRSCPayload) => {\n // setAppBuildId should be called only once, during JS initialization\n // and before any components have hydrated.\n setAppBuildId(initialRSCPayload.b)\n\n resolve(\n createMutableActionQueue(\n createInitialRouterState({\n initialFlightData: initialRSCPayload.f,\n initialCanonicalUrlParts: initialRSCPayload.c,\n initialParallelRoutes: new Map(),\n location: window.location,\n couldBeIntercepted: initialRSCPayload.i,\n postponed: initialRSCPayload.s,\n prerendered: initialRSCPayload.S,\n })\n )\n )\n },\n (err: Error) => reject(err)\n )\n }\n)\n\nfunction ServerRoot(): React.ReactNode {\n const initialRSCPayload = use(initialServerResponse)\n const actionQueue = use<AppRouterActionQueue>(pendingActionQueue)\n\n const router = (\n <AppRouter\n actionQueue={actionQueue}\n globalErrorComponentAndStyles={initialRSCPayload.G}\n assetPrefix={initialRSCPayload.p}\n />\n )\n\n if (process.env.NODE_ENV === 'development' && initialRSCPayload.m) {\n // We provide missing slot information in a context provider only during development\n // as we log some additional information about the missing slots in the console.\n return (\n <MissingSlotContext value={initialRSCPayload.m}>\n {router}\n </MissingSlotContext>\n )\n }\n\n return router\n}\n\nconst StrictModeIfEnabled = process.env.__NEXT_STRICT_MODE_APP\n ? React.StrictMode\n : React.Fragment\n\nfunction Root({ children }: React.PropsWithChildren<{}>) {\n if (process.env.__NEXT_TEST_MODE) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n window.__NEXT_HYDRATED = true\n window.__NEXT_HYDRATED_AT = performance.now()\n window.__NEXT_HYDRATED_CB?.()\n }, [])\n }\n\n return children\n}\n\nconst reactRootOptions: ReactDOMClient.RootOptions = {\n onRecoverableError,\n onCaughtError,\n onUncaughtError,\n}\n\nexport function hydrate() {\n const reactEl = (\n <StrictModeIfEnabled>\n <HeadManagerContext.Provider value={{ appDir: true }}>\n <Root>\n <ServerRoot />\n </Root>\n </HeadManagerContext.Provider>\n </StrictModeIfEnabled>\n )\n\n if (\n document.documentElement.id === '__next_error__' ||\n !!window.__next_root_layout_missing_tags?.length\n ) {\n let element = reactEl\n // Server rendering failed, fall back to client-side rendering\n if (\n process.env.NODE_ENV !== 'production' &&\n shouldRenderRootLevelErrorOverlay()\n ) {\n const { createRootLevelDevOverlayElement } =\n require('./components/react-dev-overlay/app/client-entry') as typeof import('./components/react-dev-overlay/app/client-entry')\n\n // Note this won't cause hydration mismatch because we are doing CSR w/o hydration\n element = createRootLevelDevOverlayElement(element)\n }\n\n ReactDOMClient.createRoot(appElement, reactRootOptions).render(element)\n } else {\n React.startTransition(() => {\n ReactDOMClient.hydrateRoot(appElement, reactEl, {\n ...reactRootOptions,\n formState: initialFormStateData,\n })\n })\n }\n\n // TODO-APP: Remove this logic when Float has GC built-in in development.\n if (process.env.NODE_ENV !== 'production') {\n const { linkGc } =\n require('./app-link-gc') as typeof import('./app-link-gc')\n linkGc()\n }\n}\n"],"names":["hydrate","appElement","document","encoder","TextEncoder","initialServerDataBuffer","undefined","initialServerDataWriter","initialServerDataLoaded","initialServerDataFlushed","initialFormStateData","nextServerDataCallback","seg","Error","enqueue","encode","push","binaryString","atob","decodedChunk","Uint8Array","length","i","charCodeAt","isStreamErrorOrUnfinished","ctr","desiredSize","nextServerDataRegisterWriter","forEach","val","error","close","DOMContentLoaded","readyState","addEventListener","setTimeout","nextServerDataLoadingGlobal","self","__next_f","readable","ReadableStream","start","controller","initialServerResponse","createFromReadableStream","callServer","findSourceMapURL","pendingActionQueue","Promise","resolve","reject","then","initialRSCPayload","setAppBuildId","b","createMutableActionQueue","createInitialRouterState","initialFlightData","f","initialCanonicalUrlParts","c","initialParallelRoutes","Map","location","window","couldBeIntercepted","postponed","s","prerendered","S","err","ServerRoot","use","actionQueue","router","AppRouter","globalErrorComponentAndStyles","G","assetPrefix","p","process","env","NODE_ENV","m","MissingSlotContext","value","StrictModeIfEnabled","__NEXT_STRICT_MODE_APP","React","StrictMode","Fragment","Root","children","__NEXT_TEST_MODE","useEffect","__NEXT_HYDRATED","__NEXT_HYDRATED_AT","performance","now","__NEXT_HYDRATED_CB","reactRootOptions","onRecoverableError","onCaughtError","onUncaughtError","reactEl","HeadManagerContext","Provider","appDir","documentElement","id","__next_root_layout_missing_tags","element","shouldRenderRootLevelErrorOverlay","createRootLevelDevOverlayElement","require","ReactDOMClient","createRoot","render","startTransition","hydrateRoot","formState","linkGc"],"mappings":"AAAA,6DAA6D;;;;;+BAiP7CA;;;eAAAA;;;;;;QAhPT;QAEA;QACA;iEAEoB;iEACA;yBAEc;iDACN;oCACA;wCAI5B;+BACoB;qCACM;6BAI1B;oEACe;0CAEmB;+CACN;4BACL;gDACoB;AAElD,gDAAgD;AAEhD,MAAMC,aAAqCC;AAE3C,MAAMC,UAAU,IAAIC;AAEpB,IAAIC,0BAA+DC;AACnE,IAAIC,0BACFD;AACF,IAAIE,0BAA0B;AAC9B,IAAIC,2BAA2B;AAE/B,IAAIC,uBAAmC;AAmBvC,SAASC,uBAAuBC,GAAkB;IAChD,IAAIA,GAAG,CAAC,EAAE,KAAK,GAAG;QAChBP,0BAA0B,EAAE;IAC9B,OAAO,IAAIO,GAAG,CAAC,EAAE,KAAK,GAAG;QACvB,IAAI,CAACP,yBACH,MAAM,qBAA8D,CAA9D,IAAIQ,MAAM,sDAAV,qBAAA;mBAAA;wBAAA;0BAAA;QAA6D;QAErE,IAAIN,yBAAyB;YAC3BA,wBAAw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G,eAAe,CAACC,EAAE,KAAK,oBAChC,CAAC,GAAC7C,0CAAAA,OAAO8C,+BAA+B,qBAAtC9C,wCAAwC3C,MAAM,GAChD;QACA,IAAI0F,UAAUP;QACd,8DAA8D;QAC9D,IACExB,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBACzB8B,IAAAA,iEAAiC,KACjC;YACA,MAAM,EAAEC,gCAAgC,EAAE,GACxCC,QAAQ;YAEV,kFAAkF;YAClFH,UAAUE,iCAAiCF;QAC7C;QAEAI,eAAc,CAACC,UAAU,CAACnH,YAAYmG,kBAAkBiB,MAAM,CAACN;IACjE,OAAO;QACLvB,cAAK,CAAC8B,eAAe,CAAC;YACpBH,eAAc,CAACI,WAAW,CAACtH,YAAYuG,SAAS;gBAC9C,GAAGJ,gBAAgB;gBACnBoB,WAAW9G;YACb;QACF;IACF;IAEA,yEAAyE;IACzE,IAAIsE,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,MAAM,EAAEuC,MAAM,EAAE,GACdP,QAAQ;QACVO;IACF;AACF"}
@@ -1 +1,2 @@
1
1
  import './app-webpack';
2
+ import '../lib/require-instrumentation-client';
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  require("./app-webpack");
7
+ require("../lib/require-instrumentation-client");
7
8
  const _appbootstrap = require("./app-bootstrap");
8
9
  const _initializeforapprouter = require("./dev/dev-build-indicator/initialize-for-app-router");
9
10
  (0, _appbootstrap.appBootstrap)(()=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/app-next-dev.ts"],"sourcesContent":["// TODO-APP: hydration warning\n\nimport './app-webpack'\nimport { appBootstrap } from './app-bootstrap'\nimport { initializeDevBuildIndicatorForAppRouter } from './dev/dev-build-indicator/initialize-for-app-router'\n\nappBootstrap(() => {\n const { hydrate } = require('./app-index')\n hydrate()\n initializeDevBuildIndicatorForAppRouter()\n})\n"],"names":["appBootstrap","hydrate","require","initializeDevBuildIndicatorForAppRouter"],"mappings":"AAAA,8BAA8B;;;;;QAEvB;8BACsB;wCAC2B;AAExDA,IAAAA,0BAAY,EAAC;IACX,MAAM,EAAEC,OAAO,EAAE,GAAGC,QAAQ;IAC5BD;IACAE,IAAAA,+DAAuC;AACzC"}
1
+ {"version":3,"sources":["../../src/client/app-next-dev.ts"],"sourcesContent":["// TODO-APP: hydration warning\n\nimport './app-webpack'\nimport '../lib/require-instrumentation-client'\nimport { appBootstrap } from './app-bootstrap'\nimport { initializeDevBuildIndicatorForAppRouter } from './dev/dev-build-indicator/initialize-for-app-router'\n\nappBootstrap(() => {\n const { hydrate } = require('./app-index')\n hydrate()\n initializeDevBuildIndicatorForAppRouter()\n})\n"],"names":["appBootstrap","hydrate","require","initializeDevBuildIndicatorForAppRouter"],"mappings":"AAAA,8BAA8B;;;;;QAEvB;QACA;8BACsB;wCAC2B;AAExDA,IAAAA,0BAAY,EAAC;IACX,MAAM,EAAEC,OAAO,EAAE,GAAGC,QAAQ;IAC5BD;IACAE,IAAAA,+DAAuC;AACzC"}
@@ -1 +1 @@
1
- export {};
1
+ import '../lib/require-instrumentation-client';
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ require("../lib/require-instrumentation-client");
6
7
  const _appbootstrap = require("./app-bootstrap");
7
8
  window.next.version += '-turbo';
8
9
  self.__webpack_hash__ = '';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/app-next-turbopack.ts"],"sourcesContent":["// TODO-APP: hydration warning\n\nimport { appBootstrap } from './app-bootstrap'\n\nwindow.next.version += '-turbo'\n;(self as any).__webpack_hash__ = ''\n\nappBootstrap(() => {\n const { hydrate } = require('./app-index')\n hydrate()\n\n if (process.env.NODE_ENV !== 'production') {\n const { initializeDevBuildIndicatorForAppRouter } =\n require('./dev/dev-build-indicator/initialize-for-app-router') as typeof import('./dev/dev-build-indicator/initialize-for-app-router')\n initializeDevBuildIndicatorForAppRouter()\n }\n})\n"],"names":["window","next","version","self","__webpack_hash__","appBootstrap","hydrate","require","process","env","NODE_ENV","initializeDevBuildIndicatorForAppRouter"],"mappings":"AAAA,8BAA8B;;;;;8BAED;AAE7BA,OAAOC,IAAI,CAACC,OAAO,IAAI;AACrBC,KAAaC,gBAAgB,GAAG;AAElCC,IAAAA,0BAAY,EAAC;IACX,MAAM,EAAEC,OAAO,EAAE,GAAGC,QAAQ;IAC5BD;IAEA,IAAIE,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,MAAM,EAAEC,uCAAuC,EAAE,GAC/CJ,QAAQ;QACVI;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/client/app-next-turbopack.ts"],"sourcesContent":["// TODO-APP: hydration warning\n\nimport '../lib/require-instrumentation-client'\nimport { appBootstrap } from './app-bootstrap'\n\nwindow.next.version += '-turbo'\n;(self as any).__webpack_hash__ = ''\n\nappBootstrap(() => {\n const { hydrate } = require('./app-index')\n hydrate()\n\n if (process.env.NODE_ENV !== 'production') {\n const { initializeDevBuildIndicatorForAppRouter } =\n require('./dev/dev-build-indicator/initialize-for-app-router') as typeof import('./dev/dev-build-indicator/initialize-for-app-router')\n initializeDevBuildIndicatorForAppRouter()\n }\n})\n"],"names":["window","next","version","self","__webpack_hash__","appBootstrap","hydrate","require","process","env","NODE_ENV","initializeDevBuildIndicatorForAppRouter"],"mappings":"AAAA,8BAA8B;;;;;QAEvB;8BACsB;AAE7BA,OAAOC,IAAI,CAACC,OAAO,IAAI;AACrBC,KAAaC,gBAAgB,GAAG;AAElCC,IAAAA,0BAAY,EAAC;IACX,MAAM,EAAEC,OAAO,EAAE,GAAGC,QAAQ;IAC5BD;IAEA,IAAIE,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,MAAM,EAAEC,uCAAuC,EAAE,GAC/CJ,QAAQ;QACVI;IACF;AACF"}
@@ -1 +1,2 @@
1
1
  import './app-webpack';
2
+ import '../lib/require-instrumentation-client';
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  require("./app-webpack");
8
+ require("../lib/require-instrumentation-client");
8
9
  const _appbootstrap = require("./app-bootstrap");
9
10
  (0, _appbootstrap.appBootstrap)(()=>{
10
11
  const { hydrate } = require('./app-index');
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/app-next.ts"],"sourcesContent":["// This import must go first because it needs to patch webpack chunk loading\n// before React patches chunk loading.\nimport './app-webpack'\nimport { appBootstrap } from './app-bootstrap'\n\nappBootstrap(() => {\n const { hydrate } = require('./app-index')\n // Include app-router and layout-router in the main chunk\n require('next/dist/client/components/app-router')\n require('next/dist/client/components/layout-router')\n hydrate()\n})\n"],"names":["appBootstrap","hydrate","require"],"mappings":"AAAA,4EAA4E;AAC5E,sCAAsC;;;;;QAC/B;8BACsB;AAE7BA,IAAAA,0BAAY,EAAC;IACX,MAAM,EAAEC,OAAO,EAAE,GAAGC,QAAQ;IAC5B,yDAAyD;IACzDA,QAAQ;IACRA,QAAQ;IACRD;AACF"}
1
+ {"version":3,"sources":["../../src/client/app-next.ts"],"sourcesContent":["// This import must go first because it needs to patch webpack chunk loading\n// before React patches chunk loading.\nimport './app-webpack'\nimport '../lib/require-instrumentation-client'\nimport { appBootstrap } from './app-bootstrap'\n\nappBootstrap(() => {\n const { hydrate } = require('./app-index')\n // Include app-router and layout-router in the main chunk\n require('next/dist/client/components/app-router')\n require('next/dist/client/components/layout-router')\n hydrate()\n})\n"],"names":["appBootstrap","hydrate","require"],"mappings":"AAAA,4EAA4E;AAC5E,sCAAsC;;;;;QAC/B;QACA;8BACsB;AAE7BA,IAAAA,0BAAY,EAAC;IACX,MAAM,EAAEC,OAAO,EAAE,GAAGC,QAAQ;IAC5B,yDAAyD;IACzDA,QAAQ;IACRA,QAAQ;IACRD;AACF"}
@@ -4,4 +4,4 @@ export type CodeFrameProps = {
4
4
  codeFrame: string;
5
5
  };
6
6
  export declare function CodeFrame({ stackFrame, codeFrame }: CodeFrameProps): import("react/jsx-runtime").JSX.Element;
7
- export declare const CODE_FRAME_STYLES = "\n [data-nextjs-codeframe] {\n background-color: var(--color-background-200);\n overflow: hidden;\n color: var(--color-gray-1000);\n text-overflow: ellipsis;\n border: 1px solid var(--color-gray-400);\n border-radius: 8px;\n font-family: var(--font-stack-monospace);\n font-size: var(--size-12);\n line-height: var(--size-16);\n margin: 8px 0;\n\n svg {\n width: var(--size-16);\n height: var(--size-16);\n }\n }\n\n .code-frame-link,\n .code-frame-pre {\n padding: 12px;\n }\n\n .code-frame-link svg {\n flex-shrink: 0;\n }\n\n .code-frame-link [data-text] {\n display: inline-flex;\n text-align: left;\n margin: auto 6px;\n }\n\n .code-frame-pre {\n white-space: pre-wrap;\n }\n\n .code-frame-header {\n width: 100%;\n transition: background 100ms ease-out;\n border-radius: 8px 8px 0 0;\n border-bottom: 1px solid var(--color-gray-400);\n }\n\n [data-with-open-in-editor-link-source-file] {\n padding: 4px;\n margin: -4px 0 -4px auto;\n border-radius: var(--rounded-full);\n margin-left: auto;\n\n &:focus-visible {\n outline: var(--focus-ring);\n outline-offset: -2px;\n }\n\n &:hover {\n background: var(--color-gray-100);\n }\n }\n\n [data-nextjs-codeframe]::selection,\n [data-nextjs-codeframe] *::selection {\n background-color: var(--color-ansi-selection);\n }\n\n [data-nextjs-codeframe] *:not(a) {\n color: inherit;\n background-color: transparent;\n font-family: var(--font-stack-monospace);\n }\n\n [data-nextjs-codeframe] > * {\n margin: 0;\n }\n\n .code-frame-link {\n display: flex;\n margin: 0;\n outline: 0;\n }\n .code-frame-link [data-icon='right'] {\n margin-left: auto;\n }\n\n [data-nextjs-codeframe] div > pre {\n overflow: hidden;\n display: inline-block;\n }\n\n [data-nextjs-codeframe] svg {\n color: var(--color-gray-900);\n }\n";
7
+ export declare const CODE_FRAME_STYLES = "\n [data-nextjs-codeframe] {\n --code-frame-padding: 12px;\n --code-frame-line-height: var(--size-16);\n background-color: var(--color-background-200);\n overflow: hidden;\n color: var(--color-gray-1000);\n text-overflow: ellipsis;\n border: 1px solid var(--color-gray-400);\n border-radius: 8px;\n font-family: var(--font-stack-monospace);\n font-size: var(--size-12);\n line-height: var(--code-frame-line-height);\n margin: 8px 0;\n\n svg {\n width: var(--size-16);\n height: var(--size-16);\n }\n }\n\n .code-frame-link,\n .code-frame-pre {\n padding: var(--code-frame-padding);\n }\n\n .code-frame-link svg {\n flex-shrink: 0;\n }\n\n .code-frame-link [data-text] {\n display: inline-flex;\n text-align: left;\n margin: auto 6px;\n }\n\n .code-frame-pre {\n white-space: pre-wrap;\n }\n\n .code-frame-header {\n width: 100%;\n transition: background 100ms ease-out;\n border-radius: 8px 8px 0 0;\n border-bottom: 1px solid var(--color-gray-400);\n }\n\n [data-with-open-in-editor-link-source-file] {\n padding: 4px;\n margin: -4px 0 -4px auto;\n border-radius: var(--rounded-full);\n margin-left: auto;\n\n &:focus-visible {\n outline: var(--focus-ring);\n outline-offset: -2px;\n }\n\n &:hover {\n background: var(--color-gray-100);\n }\n }\n\n [data-nextjs-codeframe]::selection,\n [data-nextjs-codeframe] *::selection {\n background-color: var(--color-ansi-selection);\n }\n\n [data-nextjs-codeframe] *:not(a) {\n color: inherit;\n background-color: transparent;\n font-family: var(--font-stack-monospace);\n }\n\n [data-nextjs-codeframe-line][data-nextjs-codeframe-line--errored=\"true\"] {\n position: relative;\n\n > span { \n position: relative;\n z-index: 1;\n }\n\n &::after {\n content: \"\";\n width: calc(100% + var(--code-frame-padding) * 2);\n height: var(--code-frame-line-height);\n left: calc(-1 * var(--code-frame-padding));\n background: var(--color-red-200);\n box-shadow: 2px 0 0 0 var(--color-red-900) inset;\n position: absolute;\n }\n }\n\n\n [data-nextjs-codeframe] > * {\n margin: 0;\n }\n\n .code-frame-link {\n display: flex;\n margin: 0;\n outline: 0;\n }\n .code-frame-link [data-icon='right'] {\n margin-left: auto;\n }\n\n [data-nextjs-codeframe] div > pre {\n overflow: hidden;\n display: inline-block;\n }\n\n [data-nextjs-codeframe] svg {\n color: var(--color-gray-900);\n }\n";
@@ -20,40 +20,21 @@ _export(exports, {
20
20
  return CodeFrame;
21
21
  }
22
22
  });
23
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
24
23
  const _jsxruntime = require("react/jsx-runtime");
25
- const _anser = /*#__PURE__*/ _interop_require_default._(require("next/dist/compiled/anser"));
26
- const _stripansi = /*#__PURE__*/ _interop_require_default._(require("next/dist/compiled/strip-ansi"));
27
24
  const _react = require("react");
28
25
  const _hotlinkedtext = require("../hot-linked-text");
29
26
  const _stackframe = require("../../../utils/stack-frame");
30
27
  const _useopenineditor = require("../../utils/use-open-in-editor");
31
28
  const _external = require("../../icons/external");
32
29
  const _file = require("../../icons/file");
30
+ const _parsecodeframe = require("./parse-code-frame");
33
31
  function CodeFrame(param) {
34
32
  let { stackFrame, codeFrame } = param;
35
33
  var _stackFrame_file;
36
- // Strip leading spaces out of the code frame:
37
- const formattedFrame = (0, _react.useMemo)(()=>{
38
- const lines = codeFrame.split(/\r?\n/g);
39
- // Find the minimum length of leading spaces after `|` in the code frame
40
- const miniLeadingSpacesLength = lines.map((line)=>/^>? +\d+ +\| [ ]+/.exec((0, _stripansi.default)(line)) === null ? null : /^>? +\d+ +\| ( *)/.exec((0, _stripansi.default)(line))).filter(Boolean).map((v)=>v.pop()).reduce((c, n)=>isNaN(c) ? n.length : Math.min(c, n.length), NaN);
41
- // When the minimum length of leading spaces is greater than 1, remove them
42
- // from the code frame to help the indentation looks better when there's a lot leading spaces.
43
- if (miniLeadingSpacesLength > 1) {
44
- return lines.map((line, a)=>~(a = line.indexOf('|')) ? line.substring(0, a) + line.substring(a).replace("^\\ {" + miniLeadingSpacesLength + "}", '') : line).join('\n');
45
- }
46
- return lines.join('\n');
47
- }, [
34
+ const formattedFrame = (0, _react.useMemo)(()=>(0, _parsecodeframe.formatCodeFrame)(codeFrame), [
48
35
  codeFrame
49
36
  ]);
50
- const decoded = (0, _react.useMemo)(()=>{
51
- return _anser.default.ansiToJson(formattedFrame, {
52
- json: true,
53
- use_classes: true,
54
- remove_empty: true
55
- });
56
- }, [
37
+ const decodedLines = (0, _react.useMemo)(()=>(0, _parsecodeframe.groupCodeFrameLines)(formattedFrame), [
57
38
  formattedFrame
58
39
  ]);
59
40
  const open = (0, _useopenineditor.useOpenInEditor)({
@@ -106,24 +87,37 @@ function CodeFrame(param) {
106
87
  }),
107
88
  /*#__PURE__*/ (0, _jsxruntime.jsx)("pre", {
108
89
  className: "code-frame-pre",
109
- children: decoded.map((entry, index)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
110
- style: {
111
- color: entry.fg ? "var(--color-" + entry.fg + ")" : undefined,
112
- ...entry.decoration === 'bold' ? // having longer width than expected on Geist Mono font-weight
113
- // above 600, hence a temporary fix is to use 500 for bold.
114
- {
115
- fontWeight: 500
116
- } : entry.decoration === 'italic' ? {
117
- fontStyle: 'italic'
118
- } : undefined
119
- },
120
- children: entry.content
121
- }, "frame-" + index))
90
+ children: decodedLines.map((line, lineIndex)=>{
91
+ const { lineNumber, isErroredLine } = (0, _parsecodeframe.parseLineNumberFromCodeFrameLine)(line, stackFrame);
92
+ const lineNumberProps = {};
93
+ if (lineNumber) {
94
+ lineNumberProps['data-nextjs-codeframe-line'] = lineNumber;
95
+ }
96
+ if (isErroredLine) {
97
+ lineNumberProps['data-nextjs-codeframe-line--errored'] = true;
98
+ }
99
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
100
+ ...lineNumberProps,
101
+ children: line.map((entry, entryIndex)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
102
+ style: {
103
+ color: entry.fg ? "var(--color-" + entry.fg + ")" : undefined,
104
+ ...entry.decoration === 'bold' ? // having longer width than expected on Geist Mono font-weight
105
+ // above 600, hence a temporary fix is to use 500 for bold.
106
+ {
107
+ fontWeight: 500
108
+ } : entry.decoration === 'italic' ? {
109
+ fontStyle: 'italic'
110
+ } : undefined
111
+ },
112
+ children: entry.content
113
+ }, "frame-" + entryIndex))
114
+ }, "line-" + lineIndex);
115
+ })
122
116
  })
123
117
  ]
124
118
  });
125
119
  }
126
- const CODE_FRAME_STYLES = "\n [data-nextjs-codeframe] {\n background-color: var(--color-background-200);\n overflow: hidden;\n color: var(--color-gray-1000);\n text-overflow: ellipsis;\n border: 1px solid var(--color-gray-400);\n border-radius: 8px;\n font-family: var(--font-stack-monospace);\n font-size: var(--size-12);\n line-height: var(--size-16);\n margin: 8px 0;\n\n svg {\n width: var(--size-16);\n height: var(--size-16);\n }\n }\n\n .code-frame-link,\n .code-frame-pre {\n padding: 12px;\n }\n\n .code-frame-link svg {\n flex-shrink: 0;\n }\n\n .code-frame-link [data-text] {\n display: inline-flex;\n text-align: left;\n margin: auto 6px;\n }\n\n .code-frame-pre {\n white-space: pre-wrap;\n }\n\n .code-frame-header {\n width: 100%;\n transition: background 100ms ease-out;\n border-radius: 8px 8px 0 0;\n border-bottom: 1px solid var(--color-gray-400);\n }\n\n [data-with-open-in-editor-link-source-file] {\n padding: 4px;\n margin: -4px 0 -4px auto;\n border-radius: var(--rounded-full);\n margin-left: auto;\n\n &:focus-visible {\n outline: var(--focus-ring);\n outline-offset: -2px;\n }\n\n &:hover {\n background: var(--color-gray-100);\n }\n }\n\n [data-nextjs-codeframe]::selection,\n [data-nextjs-codeframe] *::selection {\n background-color: var(--color-ansi-selection);\n }\n\n [data-nextjs-codeframe] *:not(a) {\n color: inherit;\n background-color: transparent;\n font-family: var(--font-stack-monospace);\n }\n\n [data-nextjs-codeframe] > * {\n margin: 0;\n }\n\n .code-frame-link {\n display: flex;\n margin: 0;\n outline: 0;\n }\n .code-frame-link [data-icon='right'] {\n margin-left: auto;\n }\n\n [data-nextjs-codeframe] div > pre {\n overflow: hidden;\n display: inline-block;\n }\n\n [data-nextjs-codeframe] svg {\n color: var(--color-gray-900);\n }\n";
120
+ const CODE_FRAME_STYLES = '\n [data-nextjs-codeframe] {\n --code-frame-padding: 12px;\n --code-frame-line-height: var(--size-16);\n background-color: var(--color-background-200);\n overflow: hidden;\n color: var(--color-gray-1000);\n text-overflow: ellipsis;\n border: 1px solid var(--color-gray-400);\n border-radius: 8px;\n font-family: var(--font-stack-monospace);\n font-size: var(--size-12);\n line-height: var(--code-frame-line-height);\n margin: 8px 0;\n\n svg {\n width: var(--size-16);\n height: var(--size-16);\n }\n }\n\n .code-frame-link,\n .code-frame-pre {\n padding: var(--code-frame-padding);\n }\n\n .code-frame-link svg {\n flex-shrink: 0;\n }\n\n .code-frame-link [data-text] {\n display: inline-flex;\n text-align: left;\n margin: auto 6px;\n }\n\n .code-frame-pre {\n white-space: pre-wrap;\n }\n\n .code-frame-header {\n width: 100%;\n transition: background 100ms ease-out;\n border-radius: 8px 8px 0 0;\n border-bottom: 1px solid var(--color-gray-400);\n }\n\n [data-with-open-in-editor-link-source-file] {\n padding: 4px;\n margin: -4px 0 -4px auto;\n border-radius: var(--rounded-full);\n margin-left: auto;\n\n &:focus-visible {\n outline: var(--focus-ring);\n outline-offset: -2px;\n }\n\n &:hover {\n background: var(--color-gray-100);\n }\n }\n\n [data-nextjs-codeframe]::selection,\n [data-nextjs-codeframe] *::selection {\n background-color: var(--color-ansi-selection);\n }\n\n [data-nextjs-codeframe] *:not(a) {\n color: inherit;\n background-color: transparent;\n font-family: var(--font-stack-monospace);\n }\n\n [data-nextjs-codeframe-line][data-nextjs-codeframe-line--errored="true"] {\n position: relative;\n\n > span { \n position: relative;\n z-index: 1;\n }\n\n &::after {\n content: "";\n width: calc(100% + var(--code-frame-padding) * 2);\n height: var(--code-frame-line-height);\n left: calc(-1 * var(--code-frame-padding));\n background: var(--color-red-200);\n box-shadow: 2px 0 0 0 var(--color-red-900) inset;\n position: absolute;\n }\n }\n\n\n [data-nextjs-codeframe] > * {\n margin: 0;\n }\n\n .code-frame-link {\n display: flex;\n margin: 0;\n outline: 0;\n }\n .code-frame-link [data-icon=\'right\'] {\n margin-left: auto;\n }\n\n [data-nextjs-codeframe] div > pre {\n overflow: hidden;\n display: inline-block;\n }\n\n [data-nextjs-codeframe] svg {\n color: var(--color-gray-900);\n }\n';
127
121
 
128
122
  if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
129
123
  Object.defineProperty(exports.default, '__esModule', { value: true });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/ui/components/code-frame/code-frame.tsx"],"sourcesContent":["import type { StackFrame } from 'next/dist/compiled/stacktrace-parser'\n\nimport Anser from 'next/dist/compiled/anser'\nimport stripAnsi from 'next/dist/compiled/strip-ansi'\n\nimport { useMemo } from 'react'\nimport { HotlinkedText } from '../hot-linked-text'\nimport { getFrameSource } from '../../../utils/stack-frame'\nimport { useOpenInEditor } from '../../utils/use-open-in-editor'\nimport { ExternalIcon } from '../../icons/external'\nimport { FileIcon } from '../../icons/file'\n\nexport type CodeFrameProps = { stackFrame: StackFrame; codeFrame: string }\n\nexport function CodeFrame({ stackFrame, codeFrame }: CodeFrameProps) {\n // Strip leading spaces out of the code frame:\n const formattedFrame = useMemo<string>(() => {\n const lines = codeFrame.split(/\\r?\\n/g)\n\n // Find the minimum length of leading spaces after `|` in the code frame\n const miniLeadingSpacesLength = lines\n .map((line) =>\n /^>? +\\d+ +\\| [ ]+/.exec(stripAnsi(line)) === null\n ? null\n : /^>? +\\d+ +\\| ( *)/.exec(stripAnsi(line))\n )\n .filter(Boolean)\n .map((v) => v!.pop()!)\n .reduce((c, n) => (isNaN(c) ? n.length : Math.min(c, n.length)), NaN)\n\n // When the minimum length of leading spaces is greater than 1, remove them\n // from the code frame to help the indentation looks better when there's a lot leading spaces.\n if (miniLeadingSpacesLength > 1) {\n return lines\n .map((line, a) =>\n ~(a = line.indexOf('|'))\n ? line.substring(0, a) +\n line.substring(a).replace(`^\\\\ {${miniLeadingSpacesLength}}`, '')\n : line\n )\n .join('\\n')\n }\n return lines.join('\\n')\n }, [codeFrame])\n\n const decoded = useMemo(() => {\n return Anser.ansiToJson(formattedFrame, {\n json: true,\n use_classes: true,\n remove_empty: true,\n })\n }, [formattedFrame])\n\n const open = useOpenInEditor({\n file: stackFrame.file,\n lineNumber: stackFrame.lineNumber,\n column: stackFrame.column,\n })\n\n const fileExtension = stackFrame?.file?.split('.').pop()\n\n // TODO: make the caret absolute\n return (\n <div data-nextjs-codeframe>\n <div className=\"code-frame-header\">\n {/* TODO: This is <div> in `Terminal` component.\n Changing now will require multiple test snapshots updates.\n Leaving as <div> as is trivial and does not affect the UI.\n Change when the new redbox matcher `toDisplayRedbox` is used.\n */}\n <p className=\"code-frame-link\">\n <span className=\"code-frame-icon\">\n <FileIcon lang={fileExtension} />\n </span>\n <span data-text>\n {getFrameSource(stackFrame)} @{' '}\n <HotlinkedText text={stackFrame.methodName} />\n </span>\n <button\n aria-label=\"Open in editor\"\n data-with-open-in-editor-link-source-file\n onClick={open}\n >\n <span className=\"code-frame-icon\" data-icon=\"right\">\n <ExternalIcon width={16} height={16} />\n </span>\n </button>\n </p>\n </div>\n <pre className=\"code-frame-pre\">\n {decoded.map((entry, index) => (\n <span\n key={`frame-${index}`}\n style={{\n color: entry.fg ? `var(--color-${entry.fg})` : undefined,\n ...(entry.decoration === 'bold'\n ? // TODO(jiwon): This used to be 800, but the symbols like `─┬─` are\n // having longer width than expected on Geist Mono font-weight\n // above 600, hence a temporary fix is to use 500 for bold.\n { fontWeight: 500 }\n : entry.decoration === 'italic'\n ? { fontStyle: 'italic' }\n : undefined),\n }}\n >\n {entry.content}\n </span>\n ))}\n </pre>\n </div>\n )\n}\n\nexport const CODE_FRAME_STYLES = `\n [data-nextjs-codeframe] {\n background-color: var(--color-background-200);\n overflow: hidden;\n color: var(--color-gray-1000);\n text-overflow: ellipsis;\n border: 1px solid var(--color-gray-400);\n border-radius: 8px;\n font-family: var(--font-stack-monospace);\n font-size: var(--size-12);\n line-height: var(--size-16);\n margin: 8px 0;\n\n svg {\n width: var(--size-16);\n height: var(--size-16);\n }\n }\n\n .code-frame-link,\n .code-frame-pre {\n padding: 12px;\n }\n\n .code-frame-link svg {\n flex-shrink: 0;\n }\n\n .code-frame-link [data-text] {\n display: inline-flex;\n text-align: left;\n margin: auto 6px;\n }\n\n .code-frame-pre {\n white-space: pre-wrap;\n }\n\n .code-frame-header {\n width: 100%;\n transition: background 100ms ease-out;\n border-radius: 8px 8px 0 0;\n border-bottom: 1px solid var(--color-gray-400);\n }\n\n [data-with-open-in-editor-link-source-file] {\n padding: 4px;\n margin: -4px 0 -4px auto;\n border-radius: var(--rounded-full);\n margin-left: auto;\n\n &:focus-visible {\n outline: var(--focus-ring);\n outline-offset: -2px;\n }\n\n &:hover {\n background: var(--color-gray-100);\n }\n }\n\n [data-nextjs-codeframe]::selection,\n [data-nextjs-codeframe] *::selection {\n background-color: var(--color-ansi-selection);\n }\n\n [data-nextjs-codeframe] *:not(a) {\n color: inherit;\n background-color: transparent;\n font-family: var(--font-stack-monospace);\n }\n\n [data-nextjs-codeframe] > * {\n margin: 0;\n }\n\n .code-frame-link {\n display: flex;\n margin: 0;\n outline: 0;\n }\n .code-frame-link [data-icon='right'] {\n margin-left: auto;\n }\n\n [data-nextjs-codeframe] div > pre {\n overflow: hidden;\n display: inline-block;\n }\n\n [data-nextjs-codeframe] svg {\n color: var(--color-gray-900);\n }\n`\n"],"names":["CODE_FRAME_STYLES","CodeFrame","stackFrame","codeFrame","formattedFrame","useMemo","lines","split","miniLeadingSpacesLength","map","line","exec","stripAnsi","filter","Boolean","v","pop","reduce","c","n","isNaN","length","Math","min","NaN","a","indexOf","substring","replace","join","decoded","Anser","ansiToJson","json","use_classes","remove_empty","open","useOpenInEditor","file","lineNumber","column","fileExtension","div","data-nextjs-codeframe","className","p","span","FileIcon","lang","data-text","getFrameSource","HotlinkedText","text","methodName","button","aria-label","data-with-open-in-editor-link-source-file","onClick","data-icon","ExternalIcon","width","height","pre","entry","index","style","color","fg","undefined","decoration","fontWeight","fontStyle","content"],"mappings":";;;;;;;;;;;;;;;IAiHaA,iBAAiB;eAAjBA;;IAnGGC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WAAWqC,UAAU;QACjCC,QAAQtC,WAAWsC,MAAM;IAC3B;IAEA,MAAMC,gBAAgBvC,+BAAAA,mBAAAA,WAAYoC,IAAI,qBAAhBpC,iBAAkBK,KAAK,CAAC,KAAKS,GAAG;IAEtD,gCAAgC;IAChC,qBACE,sBAAC0B;QAAIC,uBAAqB;;0BACxB,qBAACD;gBAAIE,WAAU;0BAMb,cAAA,sBAACC;oBAAED,WAAU;;sCACX,qBAACE;4BAAKF,WAAU;sCACd,cAAA,qBAACG,cAAQ;gCAACC,MAAMP;;;sCAElB,sBAACK;4BAAKG,WAAS;;gCACZC,IAAAA,0BAAc,EAAChD;gCAAY;gCAAG;8CAC/B,qBAACiD,4BAAa;oCAACC,MAAMlD,WAAWmD,UAAU;;;;sCAE5C,qBAACC;4BACCC,cAAW;4BACXC,2CAAyC;4BACzCC,SAASrB;sCAET,cAAA,qBAACU;gCAAKF,WAAU;gCAAkBc,aAAU;0CAC1C,cAAA,qBAACC,sBAAY;oCAACC,OAAO;oCAAIC,QAAQ;;;;;;;0BAKzC,qBAACC;gBAAIlB,WAAU;0BACZd,QAAQrB,GAAG,CAAC,CAACsD,OAAOC,sBACnB,qBAAClB;wBAECmB,OAAO;4BACLC,OAAOH,MAAMI,EAAE,GAAG,AAAC,iBAAcJ,MAAMI,EAAE,GAAC,MAAKC;4BAC/C,GAAIL,MAAMM,UAAU,KAAK,SAErB,8DAA8D;4BAC9D,2DAA2D;4BAC3D;gCAAEC,YAAY;4BAAI,IAClBP,MAAMM,UAAU,KAAK,WACnB;gCAAEE,WAAW;4BAAS,IACtBH,SAAS;wBACjB;kCAECL,MAAMS,OAAO;uBAbT,AAAC,WAAQR;;;;AAmB1B;AAEO,MAAMhE,oBAAqB"}
1
+ {"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/ui/components/code-frame/code-frame.tsx"],"sourcesContent":["import type { StackFrame } from 'next/dist/compiled/stacktrace-parser'\nimport { useMemo } from 'react'\nimport { HotlinkedText } from '../hot-linked-text'\nimport { getFrameSource } from '../../../utils/stack-frame'\nimport { useOpenInEditor } from '../../utils/use-open-in-editor'\nimport { ExternalIcon } from '../../icons/external'\nimport { FileIcon } from '../../icons/file'\nimport {\n formatCodeFrame,\n groupCodeFrameLines,\n parseLineNumberFromCodeFrameLine,\n} from './parse-code-frame'\n\nexport type CodeFrameProps = { stackFrame: StackFrame; codeFrame: string }\n\nexport function CodeFrame({ stackFrame, codeFrame }: CodeFrameProps) {\n const formattedFrame = useMemo<string>(\n () => formatCodeFrame(codeFrame),\n [codeFrame]\n )\n const decodedLines = useMemo(\n () => groupCodeFrameLines(formattedFrame),\n [formattedFrame]\n )\n\n const open = useOpenInEditor({\n file: stackFrame.file,\n lineNumber: stackFrame.lineNumber,\n column: stackFrame.column,\n })\n\n const fileExtension = stackFrame?.file?.split('.').pop()\n\n // TODO: make the caret absolute\n return (\n <div data-nextjs-codeframe>\n <div className=\"code-frame-header\">\n {/* TODO: This is <div> in `Terminal` component.\n Changing now will require multiple test snapshots updates.\n Leaving as <div> as is trivial and does not affect the UI.\n Change when the new redbox matcher `toDisplayRedbox` is used.\n */}\n <p className=\"code-frame-link\">\n <span className=\"code-frame-icon\">\n <FileIcon lang={fileExtension} />\n </span>\n <span data-text>\n {getFrameSource(stackFrame)} @{' '}\n <HotlinkedText text={stackFrame.methodName} />\n </span>\n <button\n aria-label=\"Open in editor\"\n data-with-open-in-editor-link-source-file\n onClick={open}\n >\n <span className=\"code-frame-icon\" data-icon=\"right\">\n <ExternalIcon width={16} height={16} />\n </span>\n </button>\n </p>\n </div>\n <pre className=\"code-frame-pre\">\n {decodedLines.map((line, lineIndex) => {\n const { lineNumber, isErroredLine } =\n parseLineNumberFromCodeFrameLine(line, stackFrame)\n\n const lineNumberProps: Record<string, string | boolean> = {}\n if (lineNumber) {\n lineNumberProps['data-nextjs-codeframe-line'] = lineNumber\n }\n if (isErroredLine) {\n lineNumberProps['data-nextjs-codeframe-line--errored'] = true\n }\n\n return (\n <div key={`line-${lineIndex}`} {...lineNumberProps}>\n {line.map((entry, entryIndex) => (\n <span\n key={`frame-${entryIndex}`}\n style={{\n color: entry.fg ? `var(--color-${entry.fg})` : undefined,\n ...(entry.decoration === 'bold'\n ? // TODO(jiwon): This used to be 800, but the symbols like `─┬─` are\n // having longer width than expected on Geist Mono font-weight\n // above 600, hence a temporary fix is to use 500 for bold.\n { fontWeight: 500 }\n : entry.decoration === 'italic'\n ? { fontStyle: 'italic' }\n : undefined),\n }}\n >\n {entry.content}\n </span>\n ))}\n </div>\n )\n })}\n </pre>\n </div>\n )\n}\n\nexport const CODE_FRAME_STYLES = `\n [data-nextjs-codeframe] {\n --code-frame-padding: 12px;\n --code-frame-line-height: var(--size-16);\n background-color: var(--color-background-200);\n overflow: hidden;\n color: var(--color-gray-1000);\n text-overflow: ellipsis;\n border: 1px solid var(--color-gray-400);\n border-radius: 8px;\n font-family: var(--font-stack-monospace);\n font-size: var(--size-12);\n line-height: var(--code-frame-line-height);\n margin: 8px 0;\n\n svg {\n width: var(--size-16);\n height: var(--size-16);\n }\n }\n\n .code-frame-link,\n .code-frame-pre {\n padding: var(--code-frame-padding);\n }\n\n .code-frame-link svg {\n flex-shrink: 0;\n }\n\n .code-frame-link [data-text] {\n display: inline-flex;\n text-align: left;\n margin: auto 6px;\n }\n\n .code-frame-pre {\n white-space: pre-wrap;\n }\n\n .code-frame-header {\n width: 100%;\n transition: background 100ms ease-out;\n border-radius: 8px 8px 0 0;\n border-bottom: 1px solid var(--color-gray-400);\n }\n\n [data-with-open-in-editor-link-source-file] {\n padding: 4px;\n margin: -4px 0 -4px auto;\n border-radius: var(--rounded-full);\n margin-left: auto;\n\n &:focus-visible {\n outline: var(--focus-ring);\n outline-offset: -2px;\n }\n\n &:hover {\n background: var(--color-gray-100);\n }\n }\n\n [data-nextjs-codeframe]::selection,\n [data-nextjs-codeframe] *::selection {\n background-color: var(--color-ansi-selection);\n }\n\n [data-nextjs-codeframe] *:not(a) {\n color: inherit;\n background-color: transparent;\n font-family: var(--font-stack-monospace);\n }\n\n [data-nextjs-codeframe-line][data-nextjs-codeframe-line--errored=\"true\"] {\n position: relative;\n\n > span { \n position: relative;\n z-index: 1;\n }\n\n &::after {\n content: \"\";\n width: calc(100% + var(--code-frame-padding) * 2);\n height: var(--code-frame-line-height);\n left: calc(-1 * var(--code-frame-padding));\n background: var(--color-red-200);\n box-shadow: 2px 0 0 0 var(--color-red-900) inset;\n position: absolute;\n }\n }\n\n\n [data-nextjs-codeframe] > * {\n margin: 0;\n }\n\n .code-frame-link {\n display: flex;\n margin: 0;\n outline: 0;\n }\n .code-frame-link [data-icon='right'] {\n margin-left: auto;\n }\n\n [data-nextjs-codeframe] div > pre {\n overflow: hidden;\n display: inline-block;\n }\n\n [data-nextjs-codeframe] svg {\n color: var(--color-gray-900);\n }\n`\n"],"names":["CODE_FRAME_STYLES","CodeFrame","stackFrame","codeFrame","formattedFrame","useMemo","formatCodeFrame","decodedLines","groupCodeFrameLines","open","useOpenInEditor","file","lineNumber","column","fileExtension","split","pop","div","data-nextjs-codeframe","className","p","span","FileIcon","lang","data-text","getFrameSource","HotlinkedText","text","methodName","button","aria-label","data-with-open-in-editor-link-source-file","onClick","data-icon","ExternalIcon","width","height","pre","map","line","lineIndex","isErroredLine","parseLineNumberFromCodeFrameLine","lineNumberProps","entry","entryIndex","style","color","fg","undefined","decoration","fontWeight","fontStyle","content"],"mappings":";;;;;;;;;;;;;;;IAsGaA,iBAAiB;eAAjBA;;IAvFGC,SAAS;eAATA;;;;uBAdQ;+BACM;4BACC;iCACC;0BACH;sBACJ;gCAKlB;AAIA,SAASA,UAAU,KAAyC;IAAzC,IAAA,EAAEC,UAAU,EAAEC,SAAS,EAAkB,GAAzC;QAgBFD;IAftB,MAAME,iBAAiBC,IAAAA,cAAO,EAC5B,IAAMC,IAAAA,+BAAe,EAACH,YACtB;QAACA;KAAU;IAEb,MAAMI,eAAeF,IAAAA,cAAO,EAC1B,IAAMG,IAAAA,mCAAmB,EAACJ,i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,MAAMI,EAAE,GAAC,MAAKC;oCAC/C,GAAIL,MAAMM,UAAU,KAAK,SAErB,8DAA8D;oCAC9D,2DAA2D;oCAC3D;wCAAEC,YAAY;oCAAI,IAClBP,MAAMM,UAAU,KAAK,WACnB;wCAAEE,WAAW;oCAAS,IACtBH,SAAS;gCACjB;0CAECL,MAAMS,OAAO;+BAbT,AAAC,WAAQR;uBAHV,AAAC,UAAOL;gBAqBtB;;;;AAIR;AAEO,MAAMxC,oBAAqB"}
@@ -0,0 +1,8 @@
1
+ import type { StackFrame } from 'next/dist/compiled/stacktrace-parser';
2
+ import { type AnserJsonEntry } from 'next/dist/compiled/anser';
3
+ export declare function formatCodeFrame(codeFrame: string): string;
4
+ export declare function groupCodeFrameLines(formattedFrame: string): AnserJsonEntry[][];
5
+ export declare function parseLineNumberFromCodeFrameLine(line: AnserJsonEntry[], stackFrame: StackFrame): {
6
+ lineNumber: string | undefined;
7
+ isErroredLine: boolean;
8
+ };
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ 0 && (module.exports = {
6
+ formatCodeFrame: null,
7
+ groupCodeFrameLines: null,
8
+ parseLineNumberFromCodeFrameLine: null
9
+ });
10
+ function _export(target, all) {
11
+ for(var name in all)Object.defineProperty(target, name, {
12
+ enumerable: true,
13
+ get: all[name]
14
+ });
15
+ }
16
+ _export(exports, {
17
+ formatCodeFrame: function() {
18
+ return formatCodeFrame;
19
+ },
20
+ groupCodeFrameLines: function() {
21
+ return groupCodeFrameLines;
22
+ },
23
+ parseLineNumberFromCodeFrameLine: function() {
24
+ return parseLineNumberFromCodeFrameLine;
25
+ }
26
+ });
27
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
28
+ const _anser = /*#__PURE__*/ _interop_require_default._(require("next/dist/compiled/anser"));
29
+ const _stripansi = /*#__PURE__*/ _interop_require_default._(require("next/dist/compiled/strip-ansi"));
30
+ function formatCodeFrame(codeFrame) {
31
+ const lines = codeFrame.split(/\r?\n/g);
32
+ // Find the minimum length of leading spaces after `|` in the code frame
33
+ const miniLeadingSpacesLength = lines.map((line)=>/^>? +\d+ +\| [ ]+/.exec((0, _stripansi.default)(line)) === null ? null : /^>? +\d+ +\| ( *)/.exec((0, _stripansi.default)(line))).filter(Boolean).map((v)=>v.pop()).reduce((c, n)=>isNaN(c) ? n.length : Math.min(c, n.length), NaN);
34
+ // When the minimum length of leading spaces is greater than 1, remove them
35
+ // from the code frame to help the indentation looks better when there's a lot leading spaces.
36
+ if (miniLeadingSpacesLength > 1) {
37
+ return lines.map((line, a)=>~(a = line.indexOf('|')) ? line.substring(0, a) + line.substring(a).replace("^\\ {" + miniLeadingSpacesLength + "}", '') : line).join('\n');
38
+ }
39
+ return lines.join('\n');
40
+ }
41
+ function groupCodeFrameLines(formattedFrame) {
42
+ // Map the decoded lines to a format that can be rendered
43
+ const decoded = _anser.default.ansiToJson(formattedFrame, {
44
+ json: true,
45
+ use_classes: true,
46
+ remove_empty: true
47
+ });
48
+ const lines = [];
49
+ let line = [];
50
+ for (const token of decoded){
51
+ if (token.content === '\n') {
52
+ lines.push(line);
53
+ line = [];
54
+ } else {
55
+ line.push(token);
56
+ }
57
+ }
58
+ if (line.length > 0) {
59
+ lines.push(line);
60
+ }
61
+ return lines;
62
+ }
63
+ function parseLineNumberFromCodeFrameLine(line, stackFrame) {
64
+ var _line_, _line_1, _stackFrame_lineNumber;
65
+ let lineNumberToken;
66
+ let lineNumber;
67
+ // parse line number from line first 2 tokens
68
+ // e.g. ` > 1 | const foo = 'bar'` => `1`, first token is `1 |`
69
+ // e.g. ` 2 | const foo = 'bar'` => `2`. first 2 tokens are ' ' and ' 2 |'
70
+ // console.log('line', line)
71
+ if (((_line_ = line[0]) == null ? void 0 : _line_.content) === '>' || ((_line_1 = line[0]) == null ? void 0 : _line_1.content) === ' ') {
72
+ var _lineNumberToken_content_replace, _lineNumberToken_content;
73
+ lineNumberToken = line[1];
74
+ lineNumber = lineNumberToken == null ? void 0 : (_lineNumberToken_content = lineNumberToken.content) == null ? void 0 : (_lineNumberToken_content_replace = _lineNumberToken_content.replace('|', '')) == null ? void 0 : _lineNumberToken_content_replace.trim();
75
+ }
76
+ // When the line number is possibly undefined, it can be just the non-source code line
77
+ // e.g. the ^ sign can also take a line, we skip rendering line number for it
78
+ return {
79
+ lineNumber,
80
+ isErroredLine: lineNumber === ((_stackFrame_lineNumber = stackFrame.lineNumber) == null ? void 0 : _stackFrame_lineNumber.toString())
81
+ };
82
+ }
83
+
84
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
85
+ Object.defineProperty(exports.default, '__esModule', { value: true });
86
+ Object.assign(exports.default, exports);
87
+ module.exports = exports.default;
88
+ }
89
+
90
+ //# sourceMappingURL=parse-code-frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.ts"],"sourcesContent":["import type { StackFrame } from 'next/dist/compiled/stacktrace-parser'\nimport Anser, { type AnserJsonEntry } from 'next/dist/compiled/anser'\nimport stripAnsi from 'next/dist/compiled/strip-ansi'\n\n// Strip leading spaces out of the code frame\nexport function formatCodeFrame(codeFrame: string) {\n const lines = codeFrame.split(/\\r?\\n/g)\n\n // Find the minimum length of leading spaces after `|` in the code frame\n const miniLeadingSpacesLength = lines\n .map((line) =>\n /^>? +\\d+ +\\| [ ]+/.exec(stripAnsi(line)) === null\n ? null\n : /^>? +\\d+ +\\| ( *)/.exec(stripAnsi(line))\n )\n .filter(Boolean)\n .map((v) => v!.pop()!)\n .reduce((c, n) => (isNaN(c) ? n.length : Math.min(c, n.length)), NaN)\n\n // When the minimum length of leading spaces is greater than 1, remove them\n // from the code frame to help the indentation looks better when there's a lot leading spaces.\n if (miniLeadingSpacesLength > 1) {\n return lines\n .map((line, a) =>\n ~(a = line.indexOf('|'))\n ? line.substring(0, a) +\n line.substring(a).replace(`^\\\\ {${miniLeadingSpacesLength}}`, '')\n : line\n )\n .join('\\n')\n }\n return lines.join('\\n')\n}\n\nexport function groupCodeFrameLines(formattedFrame: string) {\n // Map the decoded lines to a format that can be rendered\n const decoded = Anser.ansiToJson(formattedFrame, {\n json: true,\n use_classes: true,\n remove_empty: true,\n })\n const lines: (typeof decoded)[] = []\n\n let line: typeof decoded = []\n for (const token of decoded) {\n if (token.content === '\\n') {\n lines.push(line)\n line = []\n } else {\n line.push(token)\n }\n }\n if (line.length > 0) {\n lines.push(line)\n }\n\n return lines\n}\n\nexport function parseLineNumberFromCodeFrameLine(\n line: AnserJsonEntry[],\n stackFrame: StackFrame\n) {\n let lineNumberToken: AnserJsonEntry | undefined\n let lineNumber: string | undefined\n // parse line number from line first 2 tokens\n // e.g. ` > 1 | const foo = 'bar'` => `1`, first token is `1 |`\n // e.g. ` 2 | const foo = 'bar'` => `2`. first 2 tokens are ' ' and ' 2 |'\n // console.log('line', line)\n if (line[0]?.content === '>' || line[0]?.content === ' ') {\n lineNumberToken = line[1]\n lineNumber = lineNumberToken?.content?.replace('|', '')?.trim()\n }\n\n // When the line number is possibly undefined, it can be just the non-source code line\n // e.g. the ^ sign can also take a line, we skip rendering line number for it\n return {\n lineNumber,\n isErroredLine: lineNumber === stackFrame.lineNumber?.toString(),\n }\n}\n"],"names":["formatCodeFrame","groupCodeFrameLines","parseLineNumberFromCodeFrameLine","codeFrame","lines","split","miniLeadingSpacesLength","map","line","exec","stripAnsi","filter","Boolean","v","pop","reduce","c","n","isNaN","length","Math","min","NaN","a","indexOf","substring","replace","join","formattedFrame","decoded","Anser","ansiToJson","json","use_classes","remove_empty","token","content","push","stackFrame","lineNumberToken","lineNumber","trim","isErroredLine","toString"],"mappings":";;;;;;;;;;;;;;;;IAKgBA,eAAe;eAAfA;;IA6BAC,mBAAmB;eAAnBA;;IAyBAC,gCAAgC;eAAhCA;;;;gEA1D2B;oEACrB;AAGf,SAASF,gBAAgBG,SAAiB;IAC/C,M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UAAsB;QAQlB9B,QAA4BA,SASA8B;IAfhC,IAAIC;IACJ,IAAIC;IACJ,6CAA6C;IAC7C,+DAA+D;IAC/D,2EAA2E;IAC3E,4BAA4B;IAC5B,IAAIhC,EAAAA,SAAAA,IAAI,CAAC,EAAE,qBAAPA,OAAS4B,OAAO,MAAK,OAAO5B,EAAAA,UAAAA,IAAI,CAAC,EAAE,qBAAPA,QAAS4B,OAAO,MAAK,KAAK;YAE3CG,kCAAAA;QADbA,kBAAkB/B,IAAI,CAAC,EAAE;QACzBgC,aAAaD,oCAAAA,2BAAAA,gBAAiBH,OAAO,sBAAxBG,mCAAAA,yBAA0Bb,OAAO,CAAC,KAAK,wBAAvCa,iCAA4CE,IAAI;IAC/D;IAEA,sFAAsF;IACtF,6EAA6E;IAC7E,OAAO;QACLD;QACAE,eAAeF,iBAAeF,yBAAAA,WAAWE,UAAU,qBAArBF,uBAAuBK,QAAQ;IAC/D;AACF"}
@@ -201,7 +201,7 @@ function UserPreferences(param) {
201
201
  className: "preference-header",
202
202
  children: [
203
203
  /*#__PURE__*/ (0, _jsxruntime.jsx)("label", {
204
- htmlFor: "hide-dev-tools",
204
+ id: "hide-dev-tools",
205
205
  children: "Hide Dev Tools for this session"
206
206
  }),
207
207
  /*#__PURE__*/ (0, _jsxruntime.jsx)("p", {
@@ -213,7 +213,7 @@ function UserPreferences(param) {
213
213
  /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
214
214
  className: "preference-control",
215
215
  children: /*#__PURE__*/ (0, _jsxruntime.jsxs)("button", {
216
- id: "hide-dev-tools",
216
+ "aria-describedby": "hide-dev-tools",
217
217
  name: "hide-dev-tools",
218
218
  "data-hide-dev-tools": true,
219
219
  className: "action-button",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../src/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.tsx"],"sourcesContent":["import { useState, type HTMLProps } from 'react'\nimport { css } from '../../../../../utils/css'\nimport EyeIcon from '../../../../icons/eye-icon'\nimport { STORAGE_KEY_POSITION, STORAGE_KEY_THEME } from '../../../../../shared'\nimport LightIcon from '../../../../icons/light-icon'\nimport DarkIcon from '../../../../icons/dark-icon'\nimport SystemIcon from '../../../../icons/system-icon'\nimport type { DevToolsInfoPropsCore } from './dev-tools-info'\nimport { DevToolsInfo } from './dev-tools-info'\nimport {\n getInitialTheme,\n NEXT_DEV_TOOLS_SCALE,\n type DevToolsIndicatorPosition,\n type DevToolsScale,\n} from './preferences'\n\nexport function UserPreferences({\n setPosition,\n position,\n hide,\n scale,\n setScale,\n ...props\n}: {\n setPosition: (position: DevToolsIndicatorPosition) => void\n position: DevToolsIndicatorPosition\n scale: DevToolsScale\n setScale: (value: DevToolsScale) => void\n hide: () => void\n} & DevToolsInfoPropsCore &\n Omit<HTMLProps<HTMLDivElement>, 'size'>) {\n // derive initial theme from system preference\n const [theme, setTheme] = useState(getInitialTheme())\n\n const handleThemeChange = (e: React.ChangeEvent<HTMLSelectElement>) => {\n const portal = document.querySelector('nextjs-portal')\n if (!portal) return\n\n setTheme(e.target.value)\n\n if (e.target.value === 'system') {\n portal.classList.remove('dark')\n portal.classList.remove('light')\n localStorage.removeItem(STORAGE_KEY_THEME)\n return\n }\n\n if (e.target.value === 'dark') {\n portal.classList.add('dark')\n portal.classList.remove('light')\n localStorage.setItem(STORAGE_KEY_THEME, 'dark')\n } else {\n portal.classList.remove('dark')\n portal.classList.add('light')\n localStorage.setItem(STORAGE_KEY_THEME, 'light')\n }\n }\n\n function handlePositionChange(e: React.ChangeEvent<HTMLSelectElement>) {\n setPosition(e.target.value as DevToolsIndicatorPosition)\n localStorage.setItem(STORAGE_KEY_POSITION, e.target.value)\n }\n\n function handleSizeChange({ target }: React.ChangeEvent<HTMLSelectElement>) {\n const value = Number(target.value) as DevToolsScale\n setScale(value)\n }\n\n return (\n <DevToolsInfo title=\"Preferences\" {...props}>\n <div className=\"preferences-container\">\n <div className=\"preference-section\">\n <div className=\"preference-header\">\n <label htmlFor=\"theme\">Theme</label>\n <p className=\"preference-description\">\n Select your theme preference.\n </p>\n </div>\n <Select\n id=\"theme\"\n name=\"theme\"\n prefix={<ThemeIcon theme={theme as 'dark' | 'light' | 'system'} />}\n value={theme}\n onChange={handleThemeChange}\n >\n <option value=\"system\">System</option>\n <option value=\"light\">Light</option>\n <option value=\"dark\">Dark</option>\n </Select>\n </div>\n\n <div className=\"preference-section\">\n <div className=\"preference-header\">\n <label htmlFor=\"position\">Position</label>\n <p className=\"preference-description\">\n Adjust the placement of your dev tools.\n </p>\n </div>\n <Select\n id=\"position\"\n name=\"position\"\n value={position}\n onChange={handlePositionChange}\n >\n <option value=\"bottom-left\">Bottom Left</option>\n <option value=\"bottom-right\">Bottom Right</option>\n <option value=\"top-left\">Top Left</option>\n <option value=\"top-right\">Top Right</option>\n </Select>\n </div>\n\n <div className=\"preference-section\">\n <div className=\"preference-header\">\n <label htmlFor=\"size\">Size</label>\n <p className=\"preference-description\">\n Adjust the size of your dev tools.\n </p>\n </div>\n <Select\n id=\"size\"\n name=\"size\"\n value={scale}\n onChange={handleSizeChange}\n >\n {Object.entries(NEXT_DEV_TOOLS_SCALE).map(([key, value]) => {\n return (\n <option value={value} key={key}>\n {key}\n </option>\n )\n })}\n </Select>\n </div>\n\n <div className=\"preference-section\">\n <div className=\"preference-header\">\n <label htmlFor=\"hide-dev-tools\">\n Hide Dev Tools for this session\n </label>\n <p className=\"preference-description\">\n Hide Dev Tools until you restart your dev server, or 1 day.\n </p>\n </div>\n <div className=\"preference-control\">\n <button\n id=\"hide-dev-tools\"\n name=\"hide-dev-tools\"\n data-hide-dev-tools\n className=\"action-button\"\n onClick={hide}\n >\n <EyeIcon />\n <span>Hide</span>\n </button>\n </div>\n </div>\n\n <div className=\"preference-section\">\n <div className=\"preference-header\">\n <label>Disable Dev Tools for this project</label>\n <p className=\"preference-description\">\n To disable this UI completely, set{' '}\n <code className=\"dev-tools-info-code\">devIndicators: false</code>{' '}\n in your <code className=\"dev-tools-info-code\">next.config</code>{' '}\n file.\n </p>\n </div>\n </div>\n </div>\n </DevToolsInfo>\n )\n}\n\nfunction Select({\n children,\n prefix,\n ...props\n}: {\n prefix?: React.ReactNode\n} & Omit<React.HTMLProps<HTMLSelectElement>, 'prefix'>) {\n return (\n <div className=\"select-button\">\n {prefix}\n <select {...props}>{children}</select>\n <ChevronDownIcon />\n </div>\n )\n}\n\nfunction ThemeIcon({ theme }: { theme: 'dark' | 'light' | 'system' }) {\n switch (theme) {\n case 'system':\n return <SystemIcon />\n case 'dark':\n return <DarkIcon />\n case 'light':\n return <LightIcon />\n default:\n return null\n }\n}\n\nexport const DEV_TOOLS_INFO_USER_PREFERENCES_STYLES = css`\n .preferences-container {\n padding: 8px 6px;\n width: 100%;\n }\n\n @media (min-width: 576px) {\n .preferences-container {\n width: 480px;\n }\n }\n\n .preference-section:first-child {\n padding-top: 0;\n }\n\n .preference-section {\n padding: 12px 0;\n border-bottom: 1px solid var(--color-gray-400);\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 24px;\n }\n\n .preference-section:last-child {\n border-bottom: none;\n }\n\n .preference-header {\n margin-bottom: 0;\n flex: 1;\n }\n\n .preference-header label {\n font-size: var(--size-14);\n font-weight: 500;\n color: var(--color-gray-1000);\n margin: 0;\n }\n\n .preference-description {\n color: var(--color-gray-900);\n font-size: var(--size-14);\n margin: 0;\n }\n\n .select-button,\n .action-button {\n display: flex;\n align-items: center;\n gap: 8px;\n background: var(--color-background-100);\n border: 1px solid var(--color-gray-400);\n border-radius: var(--rounded-lg);\n font-weight: 400;\n font-size: var(--size-14);\n color: var(--color-gray-1000);\n padding: 6px 8px;\n\n &:hover {\n background: var(--color-gray-100);\n }\n }\n\n .select-button {\n &:focus-within {\n outline: var(--focus-ring);\n }\n\n select {\n all: unset;\n }\n }\n\n :global(.icon) {\n width: 18px;\n height: 18px;\n color: #666;\n }\n`\n\nfunction ChevronDownIcon() {\n return (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M14.0607 5.49999L13.5303 6.03032L8.7071 10.8535C8.31658 11.2441 7.68341 11.2441 7.29289 10.8535L2.46966 6.03032L1.93933 5.49999L2.99999 4.43933L3.53032 4.96966L7.99999 9.43933L12.4697 4.96966L13 4.43933L14.0607 5.49999Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n"],"names":["DEV_TOOLS_INFO_USER_PREFERENCES_STYLES","UserPreferences","setPosition","position","hide","scale","setScale","props","theme","setTheme","useState","getInitialTheme","handleThemeChange","e","portal","document","querySelector","target","value","classList","remove","localStorage","removeItem","STORAGE_KEY_THEME","add","setItem","handlePositionChange","STORAGE_KEY_POSITION","handleSizeChange","Number","DevToolsInfo","title","div","className","label","htmlFor","p","Select","id","name","prefix","ThemeIcon","onChange","option","Object","entries","NEXT_DEV_TOOLS_SCALE","map","key","button","data-hide-dev-tools","onClick","EyeIcon","span","code","children","select","ChevronDownIcon","SystemIcon","DarkIcon","LightIcon","css","svg","width","height","viewBox","aria-hidden","path","fillRule","clipRule","d","fill"],"mappings":";;;;;;;;;;;;;;;IA0MaA,sCAAsC;eAAtCA;;IA1LGC,eAAe;eAAfA;;;;;;uBAhByB;qBACrB;kEACA;wBACoC;oEAClC;mEACD;qEACE;8BAEM;6BAMtB;;;;;;;;;;AAEA,SAASA,gBAAgB,KAcS;IAdT,IAAA,EAC9BC,WAAW,EACXC,QAAQ,EACRC,IAAI,EACJC,KAAK,EACLC,QAAQ,EACR,GAAGC,OAQoC,GAdT;IAe9B,8CAA8C;IAC9C,MAAM,CAACC,OAAOC,SAAS,GAAGC,IAAAA,eAAQ,EAACC,IAAAA,4BAAe;IAElD,MAAMC,oBAAoB,CAACC;QACzB,MAAMC,SAASC,SAASC,aAAa,CAAC;QACtC,IAAI,CAACF,QAAQ;QAEbL,SAASI,EAAEI,MAAM,CAACC,KAAK;QAEvB,IAAIL,EAAEI,MAAM,CAACC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9D,qBAACqB;wCAAKrB,WAAU;kDAAsB;;oCAAmB;oCAAI;;;;;;;;;AAQnF;AAEA,SAASI,OAAO,KAMsC;IANtC,IAAA,EACdkB,QAAQ,EACRf,MAAM,EACN,GAAGjC,OAGiD,GANtC;IAOd,qBACE,sBAACyB;QAAIC,WAAU;;YACZO;0BACD,qBAACgB;gBAAQ,GAAGjD,KAAK;0BAAGgD;;0BACpB,qBAACE;;;AAGP;AAEA,SAAShB,UAAU,KAAiD;IAAjD,IAAA,EAAEjC,KAAK,EAA0C,GAAjD;IACjB,OAAQA;QACN,KAAK;YACH,qBAAO,qBAACkD,mBAAU;QACpB,KAAK;YACH,qBAAO,qBAACC,iBAAQ;QAClB,KAAK;YACH,qBAAO,qBAACC,kBAAS;QACnB;YACE,OAAO;IACX;AACF;AAEO,MAAM5D,6CAAyC6D,QAAG;AAkFzD,SAASJ;IACP,qBACE,qBAACK;QAAIC,OAAM;QAAKC,QAAO;QAAKC,SAAQ;QAAYC,aAAW;kBACzD,cAAA,qBAACC;YACCC,UAAS;YACTC,UAAS;YACTC,GAAE;YACFC,MAAK;;;AAIb"}
1
+ {"version":3,"sources":["../../../../../../../../../src/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.tsx"],"sourcesContent":["import { useState, type HTMLProps } from 'react'\nimport { css } from '../../../../../utils/css'\nimport EyeIcon from '../../../../icons/eye-icon'\nimport { STORAGE_KEY_POSITION, STORAGE_KEY_THEME } from '../../../../../shared'\nimport LightIcon from '../../../../icons/light-icon'\nimport DarkIcon from '../../../../icons/dark-icon'\nimport SystemIcon from '../../../../icons/system-icon'\nimport type { DevToolsInfoPropsCore } from './dev-tools-info'\nimport { DevToolsInfo } from './dev-tools-info'\nimport {\n getInitialTheme,\n NEXT_DEV_TOOLS_SCALE,\n type DevToolsIndicatorPosition,\n type DevToolsScale,\n} from './preferences'\n\nexport function UserPreferences({\n setPosition,\n position,\n hide,\n scale,\n setScale,\n ...props\n}: {\n setPosition: (position: DevToolsIndicatorPosition) => void\n position: DevToolsIndicatorPosition\n scale: DevToolsScale\n setScale: (value: DevToolsScale) => void\n hide: () => void\n} & DevToolsInfoPropsCore &\n Omit<HTMLProps<HTMLDivElement>, 'size'>) {\n // derive initial theme from system preference\n const [theme, setTheme] = useState(getInitialTheme())\n\n const handleThemeChange = (e: React.ChangeEvent<HTMLSelectElement>) => {\n const portal = document.querySelector('nextjs-portal')\n if (!portal) return\n\n setTheme(e.target.value)\n\n if (e.target.value === 'system') {\n portal.classList.remove('dark')\n portal.classList.remove('light')\n localStorage.removeItem(STORAGE_KEY_THEME)\n return\n }\n\n if (e.target.value === 'dark') {\n portal.classList.add('dark')\n portal.classList.remove('light')\n localStorage.setItem(STORAGE_KEY_THEME, 'dark')\n } else {\n portal.classList.remove('dark')\n portal.classList.add('light')\n localStorage.setItem(STORAGE_KEY_THEME, 'light')\n }\n }\n\n function handlePositionChange(e: React.ChangeEvent<HTMLSelectElement>) {\n setPosition(e.target.value as DevToolsIndicatorPosition)\n localStorage.setItem(STORAGE_KEY_POSITION, e.target.value)\n }\n\n function handleSizeChange({ target }: React.ChangeEvent<HTMLSelectElement>) {\n const value = Number(target.value) as DevToolsScale\n setScale(value)\n }\n\n return (\n <DevToolsInfo title=\"Preferences\" {...props}>\n <div className=\"preferences-container\">\n <div className=\"preference-section\">\n <div className=\"preference-header\">\n <label htmlFor=\"theme\">Theme</label>\n <p className=\"preference-description\">\n Select your theme preference.\n </p>\n </div>\n <Select\n id=\"theme\"\n name=\"theme\"\n prefix={<ThemeIcon theme={theme as 'dark' | 'light' | 'system'} />}\n value={theme}\n onChange={handleThemeChange}\n >\n <option value=\"system\">System</option>\n <option value=\"light\">Light</option>\n <option value=\"dark\">Dark</option>\n </Select>\n </div>\n\n <div className=\"preference-section\">\n <div className=\"preference-header\">\n <label htmlFor=\"position\">Position</label>\n <p className=\"preference-description\">\n Adjust the placement of your dev tools.\n </p>\n </div>\n <Select\n id=\"position\"\n name=\"position\"\n value={position}\n onChange={handlePositionChange}\n >\n <option value=\"bottom-left\">Bottom Left</option>\n <option value=\"bottom-right\">Bottom Right</option>\n <option value=\"top-left\">Top Left</option>\n <option value=\"top-right\">Top Right</option>\n </Select>\n </div>\n\n <div className=\"preference-section\">\n <div className=\"preference-header\">\n <label htmlFor=\"size\">Size</label>\n <p className=\"preference-description\">\n Adjust the size of your dev tools.\n </p>\n </div>\n <Select\n id=\"size\"\n name=\"size\"\n value={scale}\n onChange={handleSizeChange}\n >\n {Object.entries(NEXT_DEV_TOOLS_SCALE).map(([key, value]) => {\n return (\n <option value={value} key={key}>\n {key}\n </option>\n )\n })}\n </Select>\n </div>\n\n <div className=\"preference-section\">\n <div className=\"preference-header\">\n <label id=\"hide-dev-tools\">Hide Dev Tools for this session</label>\n <p className=\"preference-description\">\n Hide Dev Tools until you restart your dev server, or 1 day.\n </p>\n </div>\n <div className=\"preference-control\">\n <button\n aria-describedby=\"hide-dev-tools\"\n name=\"hide-dev-tools\"\n data-hide-dev-tools\n className=\"action-button\"\n onClick={hide}\n >\n <EyeIcon />\n <span>Hide</span>\n </button>\n </div>\n </div>\n\n <div className=\"preference-section\">\n <div className=\"preference-header\">\n <label>Disable Dev Tools for this project</label>\n <p className=\"preference-description\">\n To disable this UI completely, set{' '}\n <code className=\"dev-tools-info-code\">devIndicators: false</code>{' '}\n in your <code className=\"dev-tools-info-code\">next.config</code>{' '}\n file.\n </p>\n </div>\n </div>\n </div>\n </DevToolsInfo>\n )\n}\n\nfunction Select({\n children,\n prefix,\n ...props\n}: {\n prefix?: React.ReactNode\n} & Omit<React.HTMLProps<HTMLSelectElement>, 'prefix'>) {\n return (\n <div className=\"select-button\">\n {prefix}\n <select {...props}>{children}</select>\n <ChevronDownIcon />\n </div>\n )\n}\n\nfunction ThemeIcon({ theme }: { theme: 'dark' | 'light' | 'system' }) {\n switch (theme) {\n case 'system':\n return <SystemIcon />\n case 'dark':\n return <DarkIcon />\n case 'light':\n return <LightIcon />\n default:\n return null\n }\n}\n\nexport const DEV_TOOLS_INFO_USER_PREFERENCES_STYLES = css`\n .preferences-container {\n padding: 8px 6px;\n width: 100%;\n }\n\n @media (min-width: 576px) {\n .preferences-container {\n width: 480px;\n }\n }\n\n .preference-section:first-child {\n padding-top: 0;\n }\n\n .preference-section {\n padding: 12px 0;\n border-bottom: 1px solid var(--color-gray-400);\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 24px;\n }\n\n .preference-section:last-child {\n border-bottom: none;\n }\n\n .preference-header {\n margin-bottom: 0;\n flex: 1;\n }\n\n .preference-header label {\n font-size: var(--size-14);\n font-weight: 500;\n color: var(--color-gray-1000);\n margin: 0;\n }\n\n .preference-description {\n color: var(--color-gray-900);\n font-size: var(--size-14);\n margin: 0;\n }\n\n .select-button,\n .action-button {\n display: flex;\n align-items: center;\n gap: 8px;\n background: var(--color-background-100);\n border: 1px solid var(--color-gray-400);\n border-radius: var(--rounded-lg);\n font-weight: 400;\n font-size: var(--size-14);\n color: var(--color-gray-1000);\n padding: 6px 8px;\n\n &:hover {\n background: var(--color-gray-100);\n }\n }\n\n .select-button {\n &:focus-within {\n outline: var(--focus-ring);\n }\n\n select {\n all: unset;\n }\n }\n\n :global(.icon) {\n width: 18px;\n height: 18px;\n color: #666;\n }\n`\n\nfunction ChevronDownIcon() {\n return (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M14.0607 5.49999L13.5303 6.03032L8.7071 10.8535C8.31658 11.2441 7.68341 11.2441 7.29289 10.8535L2.46966 6.03032L1.93933 5.49999L2.99999 4.43933L3.53032 4.96966L7.99999 9.43933L12.4697 4.96966L13 4.43933L14.0607 5.49999Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n"],"names":["DEV_TOOLS_INFO_USER_PREFERENCES_STYLES","UserPreferences","setPosition","position","hide","scale","setScale","props","theme","setTheme","useState","getInitialTheme","handleThemeChange","e","portal","document","querySelector","target","value","classList","remove","localStorage","removeItem","STORAGE_KEY_THEME","add","setItem","handlePositionChange","STORAGE_KEY_POSITION","handleSizeChange","Number","DevToolsInfo","title","div","className","label","htmlFor","p","Select","id","name","prefix","ThemeIcon","onChange","option","Object","entries","NEXT_DEV_TOOLS_SCALE","map","key","button","aria-describedby","data-hide-dev-tools","onClick","EyeIcon","span","code","children","select","ChevronDownIcon","SystemIcon","DarkIcon","LightIcon","css","svg","width","height","viewBox","aria-hidden","path","fillRule","clipRule","d","fill"],"mappings":";;;;;;;;;;;;;;;IAwMaA,sCAAsC;eAAtCA;;IAxLGC,eAAe;eAAfA;;;;;;uBAhByB;qBACrB;kEACA;wBACoC;oEAClC;mEACD;qEACE;8BAEM;6BAMtB;;;;;;;;;;AAEA,SAASA,gBAAgB,KAcS;IAdT,IAAA,EAC9BC,WAAW,EACXC,QAAQ,EACRC,IAAI,EACJC,KAAK,EACLC,QAAQ,EACR,GAAGC,OAQoC,GAdT;IAe9B,8CAA8C;IAC9C,MAAM,CAACC,OAAOC,SAAS,GAAGC,IAAAA,eAAQ,EAACC,IAAAA,4BAAe;IAElD,MAAMC,oBAAoB,CAACC;QACzB,MAAMC,SAASC,SAASC,aAAa,CAAC;QACtC,IAAI,CAACF,QAAQ;QAEbL,SAASI,EAAEI,MAAM,CAACC,KAAK;QAEvB,IAAIL,EAAEI,MAAM,CAACC,KAAK,KAAK,UAAU;YAC/BJ,OAAOK,SAAS,CAACC,MAAM,CAAC;YACxBN,OAAOK,SAAS,CAACC,MAAM,CAAC;YACxBC,aAAaC,UAAU,CAACC,yBAAiB;YACzC;QACF;QAEA,IAAIV,EAAEI,MAAM,CAACC,KAAK,KAAK,QAAQ;YAC7BJ,OAAOK,SAAS,CAACK,GAAG,CAAC;YACrBV,OAAOK,SAAS,CAACC,MAAM,CAAC;YACxBC,aAAaI,OAAO,CAACF,yBAAiB,EAAE;QAC1C,OAAO;YACLT,OAAOK,SAAS,CAACC,MAAM,CAAC;YACxBN,O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