next 15.4.0-canary.26 → 15.4.0-canary.27

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 (48) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +2 -2
  3. package/dist/build/swc/index.js +1 -1
  4. package/dist/build/webpack-config.js +2 -2
  5. package/dist/client/app-bootstrap.js +1 -1
  6. package/dist/client/index.js +1 -1
  7. package/dist/client/script.js +9 -3
  8. package/dist/client/script.js.map +1 -1
  9. package/dist/compiled/next-server/pages-turbo.runtime.dev.js +4 -3
  10. package/dist/compiled/next-server/pages-turbo.runtime.dev.js.map +1 -1
  11. package/dist/compiled/next-server/pages-turbo.runtime.prod.js +7 -6
  12. package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
  13. package/dist/compiled/next-server/pages.runtime.dev.js +4 -3
  14. package/dist/compiled/next-server/pages.runtime.dev.js.map +1 -1
  15. package/dist/compiled/next-server/pages.runtime.prod.js +9 -8
  16. package/dist/compiled/next-server/pages.runtime.prod.js.map +1 -1
  17. package/dist/esm/build/index.js +2 -2
  18. package/dist/esm/build/swc/index.js +1 -1
  19. package/dist/esm/build/webpack-config.js +2 -2
  20. package/dist/esm/client/app-bootstrap.js +1 -1
  21. package/dist/esm/client/index.js +1 -1
  22. package/dist/esm/client/script.js +9 -3
  23. package/dist/esm/client/script.js.map +1 -1
  24. package/dist/esm/pages/_document.js +7 -3
  25. package/dist/esm/pages/_document.js.map +1 -1
  26. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  27. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  28. package/dist/esm/server/lib/app-info-log.js +1 -1
  29. package/dist/esm/server/lib/start-server.js +1 -1
  30. package/dist/esm/server/render.js +7 -2
  31. package/dist/esm/server/render.js.map +1 -1
  32. package/dist/esm/shared/lib/canary-only.js +1 -1
  33. package/dist/esm/shared/lib/html-context.shared-runtime.js.map +1 -1
  34. package/dist/pages/_document.js +7 -3
  35. package/dist/pages/_document.js.map +1 -1
  36. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  37. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  38. package/dist/server/lib/app-info-log.js +1 -1
  39. package/dist/server/lib/start-server.js +1 -1
  40. package/dist/server/render.js +7 -2
  41. package/dist/server/render.js.map +1 -1
  42. package/dist/shared/lib/canary-only.js +1 -1
  43. package/dist/shared/lib/html-context.shared-runtime.d.ts +1 -0
  44. package/dist/shared/lib/html-context.shared-runtime.js.map +1 -1
  45. package/dist/telemetry/anonymous-meta.js +1 -1
  46. package/dist/telemetry/events/session-stopped.js +2 -2
  47. package/dist/telemetry/events/version.js +2 -2
  48. package/package.json +15 -15
package/dist/bin/next CHANGED
@@ -79,7 +79,7 @@ const program = new NextRootCommand();
79
79
  program.name('next').description('The Next.js CLI allows you to develop, build, start your application, and more.').configureHelp({
80
80
  formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
81
81
  subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
82
- }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.4.0-canary.26"}`, '-v, --version', 'Outputs the Next.js version.');
82
+ }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.4.0-canary.27"}`, '-v, --version', 'Outputs the Next.js version.');
83
83
  program.command('build').description('Creates an optimized production build of your application. The output displays information about each route.').argument('[directory]', `A directory on which to build the application. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).option('-d, --debug', 'Enables a more verbose build output.').option('--no-lint', 'Disables linting.').option('--no-mangling', 'Disables mangling.').option('--profile', 'Enables production profiling for React.').option('--experimental-app-only', 'Builds only App Router routes.').option('--turbo', 'Starts development mode using Turbopack.').option('--turbopack', 'Starts development mode using Turbopack.').addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
84
84
  'compile',
85
85
  'generate',
@@ -375,7 +375,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
375
375
  const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
376
376
  buildMode: experimentalBuildMode,
377
377
  isTurboBuild: String(isTurbopack),
378
- version: "15.4.0-canary.26"
378
+ version: "15.4.0-canary.27"
379
379
  });
380
380
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
381
381
  _buildcontext.NextBuildContext.dir = dir;
@@ -757,7 +757,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
757
757
  // Files outside of the distDir can be "type": "module"
758
758
  await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
759
759
  // These are written to distDir, so they need to come after creating and cleaning distDr.
760
- await (0, _builddiagnostics.recordFrameworkVersion)("15.4.0-canary.26");
760
+ await (0, _builddiagnostics.recordFrameworkVersion)("15.4.0-canary.27");
761
761
  await (0, _builddiagnostics.updateBuildDiagnostics)({
762
762
  buildStage: 'start'
763
763
  });
@@ -123,7 +123,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
123
123
  }
124
124
  return newObj;
125
125
  }
126
- const nextVersion = "15.4.0-canary.26";
126
+ const nextVersion = "15.4.0-canary.27";
127
127
  const ArchName = (0, _os.arch)();
128
128
  const PlatformName = (0, _os.platform)();
129
129
  function infoLog(...args) {
@@ -1653,7 +1653,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
1653
1653
  isClient && new _copyfileplugin.CopyFilePlugin({
1654
1654
  // file path to build output of `@next/polyfill-nomodule`
1655
1655
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1656
- cacheKey: "15.4.0-canary.26",
1656
+ cacheKey: "15.4.0-canary.27",
1657
1657
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1658
1658
  minimize: false,
1659
1659
  info: {
@@ -1830,7 +1830,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
1830
1830
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1831
1831
  // - Next.js version
1832
1832
  // - next.config.js keys that affect compilation
1833
- version: `${__dirname}|${"15.4.0-canary.26"}|${configVars}`,
1833
+ version: `${__dirname}|${"15.4.0-canary.27"}|${configVars}`,
1834
1834
  cacheDirectory: _path.default.join(distDir, 'cache', 'webpack'),
1835
1835
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1836
1836
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "appBootstrap", {
13
13
  return appBootstrap;
14
14
  }
15
15
  });
16
- const version = "15.4.0-canary.26";
16
+ const version = "15.4.0-canary.27";
17
17
  window.next = {
18
18
  version,
19
19
  appDir: true
@@ -61,7 +61,7 @@ const _hooksclientcontextsharedruntime = require("../shared/lib/hooks-client-con
61
61
  const _onrecoverableerror = require("./react-client-callbacks/on-recoverable-error");
62
62
  const _tracer = /*#__PURE__*/ _interop_require_default._(require("./tracing/tracer"));
63
63
  const _isnextroutererror = require("./components/is-next-router-error");
64
- const version = "15.4.0-canary.26";
64
+ const version = "15.4.0-canary.27";
65
65
  let router;
66
66
  const emitter = (0, _mitt.default)();
67
67
  const looseToArray = (input)=>[].slice.call(input);
@@ -169,7 +169,9 @@ function initScriptLoader(scriptLoaderItems) {
169
169
  */ function Script(props) {
170
170
  const { id, src = '', onLoad = ()=>{}, onReady = null, strategy = 'afterInteractive', onError, stylesheets, ...restProps } = props;
171
171
  // Context is available only during SSR
172
- const { updateScripts, scripts, getIsSsr, appDir, nonce } = (0, _react.useContext)(_headmanagercontextsharedruntime.HeadManagerContext);
172
+ let { updateScripts, scripts, getIsSsr, appDir, nonce } = (0, _react.useContext)(_headmanagercontextsharedruntime.HeadManagerContext);
173
+ // if a nonce is explicitly passed to the script tag, favor that over the automatic handling
174
+ nonce = restProps.nonce || nonce;
173
175
  /**
174
176
  * - First mount:
175
177
  * 1. The useEffect for onReady executes
@@ -233,7 +235,8 @@ function initScriptLoader(scriptLoaderItems) {
233
235
  onLoad,
234
236
  onReady,
235
237
  onError,
236
- ...restProps
238
+ ...restProps,
239
+ nonce
237
240
  }
238
241
  ]);
239
242
  updateScripts(scripts);
@@ -241,7 +244,10 @@ function initScriptLoader(scriptLoaderItems) {
241
244
  // Script has already loaded during SSR
242
245
  LoadCache.add(id || src);
243
246
  } else if (getIsSsr && !getIsSsr()) {
244
- loadScript(props);
247
+ loadScript({
248
+ ...props,
249
+ nonce
250
+ });
245
251
  }
246
252
  }
247
253
  // For the app directory, we need React Float to preload these scripts.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/script.tsx"],"sourcesContent":["'use client'\n\nimport ReactDOM from 'react-dom'\nimport React, { useEffect, useContext, useRef, type JSX } from 'react'\nimport type { ScriptHTMLAttributes } from 'react'\nimport { HeadManagerContext } from '../shared/lib/head-manager-context.shared-runtime'\nimport { setAttributesFromProps } from './set-attributes-from-props'\nimport { requestIdleCallback } from './request-idle-callback'\n\nconst ScriptCache = new Map()\nconst LoadCache = new Set()\n\nexport interface ScriptProps extends ScriptHTMLAttributes<HTMLScriptElement> {\n strategy?: 'afterInteractive' | 'lazyOnload' | 'beforeInteractive' | 'worker'\n id?: string\n onLoad?: (e: any) => void\n onReady?: () => void | null\n onError?: (e: any) => void\n children?: React.ReactNode\n stylesheets?: string[]\n}\n\n/**\n * @deprecated Use `ScriptProps` instead.\n */\nexport type Props = ScriptProps\n\nconst insertStylesheets = (stylesheets: string[]) => {\n // Case 1: Styles for afterInteractive/lazyOnload with appDir injected via handleClientScriptLoad\n //\n // Using ReactDOM.preinit to feature detect appDir and inject styles\n // Stylesheets might have already been loaded if initialized with Script component\n // Re-inject styles here to handle scripts loaded via handleClientScriptLoad\n // ReactDOM.preinit handles dedup and ensures the styles are loaded only once\n if (ReactDOM.preinit) {\n stylesheets.forEach((stylesheet: string) => {\n ReactDOM.preinit(stylesheet, { as: 'style' })\n })\n\n return\n }\n\n // Case 2: Styles for afterInteractive/lazyOnload with pages injected via handleClientScriptLoad\n //\n // We use this function to load styles when appdir is not detected\n // TODO: Use React float APIs to load styles once available for pages dir\n if (typeof window !== 'undefined') {\n let head = document.head\n stylesheets.forEach((stylesheet: string) => {\n let link = document.createElement('link')\n\n link.type = 'text/css'\n link.rel = 'stylesheet'\n link.href = stylesheet\n\n head.appendChild(link)\n })\n }\n}\n\nconst loadScript = (props: ScriptProps): void => {\n const {\n src,\n id,\n onLoad = () => {},\n onReady = null,\n dangerouslySetInnerHTML,\n children = '',\n strategy = 'afterInteractive',\n onError,\n stylesheets,\n } = props\n\n const cacheKey = id || src\n\n // Script has already loaded\n if (cacheKey && LoadCache.has(cacheKey)) {\n return\n }\n\n // Contents of this script are already loading/loaded\n if (ScriptCache.has(src)) {\n LoadCache.add(cacheKey)\n // It is possible that multiple `next/script` components all have same \"src\", but has different \"onLoad\"\n // This is to make sure the same remote script will only load once, but \"onLoad\" are executed in order\n ScriptCache.get(src).then(onLoad, onError)\n return\n }\n\n /** Execute after the script first loaded */\n const afterLoad = () => {\n // Run onReady for the first time after load event\n if (onReady) {\n onReady()\n }\n // add cacheKey to LoadCache when load successfully\n LoadCache.add(cacheKey)\n }\n\n const el = document.createElement('script')\n\n const loadPromise = new Promise<void>((resolve, reject) => {\n el.addEventListener('load', function (e) {\n resolve()\n if (onLoad) {\n onLoad.call(this, e)\n }\n afterLoad()\n })\n el.addEventListener('error', function (e) {\n reject(e)\n })\n }).catch(function (e) {\n if (onError) {\n onError(e)\n }\n })\n\n if (dangerouslySetInnerHTML) {\n // Casting since lib.dom.d.ts doesn't have TrustedHTML yet.\n el.innerHTML = (dangerouslySetInnerHTML.__html as string) || ''\n\n afterLoad()\n } else if (children) {\n el.textContent =\n typeof children === 'string'\n ? children\n : Array.isArray(children)\n ? children.join('')\n : ''\n\n afterLoad()\n } else if (src) {\n el.src = src\n // do not add cacheKey into LoadCache for remote script here\n // cacheKey will be added to LoadCache when it is actually loaded (see loadPromise above)\n\n ScriptCache.set(src, loadPromise)\n }\n\n setAttributesFromProps(el, props)\n\n if (strategy === 'worker') {\n el.setAttribute('type', 'text/partytown')\n }\n\n el.setAttribute('data-nscript', strategy)\n\n // Load styles associated with this script\n if (stylesheets) {\n insertStylesheets(stylesheets)\n }\n\n document.body.appendChild(el)\n}\n\nexport function handleClientScriptLoad(props: ScriptProps) {\n const { strategy = 'afterInteractive' } = props\n if (strategy === 'lazyOnload') {\n window.addEventListener('load', () => {\n requestIdleCallback(() => loadScript(props))\n })\n } else {\n loadScript(props)\n }\n}\n\nfunction loadLazyScript(props: ScriptProps) {\n if (document.readyState === 'complete') {\n requestIdleCallback(() => loadScript(props))\n } else {\n window.addEventListener('load', () => {\n requestIdleCallback(() => loadScript(props))\n })\n }\n}\n\nfunction addBeforeInteractiveToCache() {\n const scripts = [\n ...document.querySelectorAll('[data-nscript=\"beforeInteractive\"]'),\n ...document.querySelectorAll('[data-nscript=\"beforePageRender\"]'),\n ]\n scripts.forEach((script) => {\n const cacheKey = script.id || script.getAttribute('src')\n LoadCache.add(cacheKey)\n })\n}\n\nexport function initScriptLoader(scriptLoaderItems: ScriptProps[]) {\n scriptLoaderItems.forEach(handleClientScriptLoad)\n addBeforeInteractiveToCache()\n}\n\n/**\n * Load a third-party scripts in an optimized way.\n *\n * Read more: [Next.js Docs: `next/script`](https://nextjs.org/docs/app/api-reference/components/script)\n */\nfunction Script(props: ScriptProps): JSX.Element | null {\n const {\n id,\n src = '',\n onLoad = () => {},\n onReady = null,\n strategy = 'afterInteractive',\n onError,\n stylesheets,\n ...restProps\n } = props\n\n // Context is available only during SSR\n const { updateScripts, scripts, getIsSsr, appDir, nonce } =\n useContext(HeadManagerContext)\n\n /**\n * - First mount:\n * 1. The useEffect for onReady executes\n * 2. hasOnReadyEffectCalled.current is false, but the script hasn't loaded yet (not in LoadCache)\n * onReady is skipped, set hasOnReadyEffectCalled.current to true\n * 3. The useEffect for loadScript executes\n * 4. hasLoadScriptEffectCalled.current is false, loadScript executes\n * Once the script is loaded, the onLoad and onReady will be called by then\n * [If strict mode is enabled / is wrapped in <OffScreen /> component]\n * 5. The useEffect for onReady executes again\n * 6. hasOnReadyEffectCalled.current is true, so entire effect is skipped\n * 7. The useEffect for loadScript executes again\n * 8. hasLoadScriptEffectCalled.current is true, so entire effect is skipped\n *\n * - Second mount:\n * 1. The useEffect for onReady executes\n * 2. hasOnReadyEffectCalled.current is false, but the script has already loaded (found in LoadCache)\n * onReady is called, set hasOnReadyEffectCalled.current to true\n * 3. The useEffect for loadScript executes\n * 4. The script is already loaded, loadScript bails out\n * [If strict mode is enabled / is wrapped in <OffScreen /> component]\n * 5. The useEffect for onReady executes again\n * 6. hasOnReadyEffectCalled.current is true, so entire effect is skipped\n * 7. The useEffect for loadScript executes again\n * 8. hasLoadScriptEffectCalled.current is true, so entire effect is skipped\n */\n const hasOnReadyEffectCalled = useRef(false)\n\n useEffect(() => {\n const cacheKey = id || src\n if (!hasOnReadyEffectCalled.current) {\n // Run onReady if script has loaded before but component is re-mounted\n if (onReady && cacheKey && LoadCache.has(cacheKey)) {\n onReady()\n }\n\n hasOnReadyEffectCalled.current = true\n }\n }, [onReady, id, src])\n\n const hasLoadScriptEffectCalled = useRef(false)\n\n useEffect(() => {\n if (!hasLoadScriptEffectCalled.current) {\n if (strategy === 'afterInteractive') {\n loadScript(props)\n } else if (strategy === 'lazyOnload') {\n loadLazyScript(props)\n }\n\n hasLoadScriptEffectCalled.current = true\n }\n }, [props, strategy])\n\n if (strategy === 'beforeInteractive' || strategy === 'worker') {\n if (updateScripts) {\n scripts[strategy] = (scripts[strategy] || []).concat([\n {\n id,\n src,\n onLoad,\n onReady,\n onError,\n ...restProps,\n },\n ])\n updateScripts(scripts)\n } else if (getIsSsr && getIsSsr()) {\n // Script has already loaded during SSR\n LoadCache.add(id || src)\n } else if (getIsSsr && !getIsSsr()) {\n loadScript(props)\n }\n }\n\n // For the app directory, we need React Float to preload these scripts.\n if (appDir) {\n // Injecting stylesheets here handles beforeInteractive and worker scripts correctly\n // For other strategies injecting here ensures correct stylesheet order\n // ReactDOM.preinit handles loading the styles in the correct order,\n // also ensures the stylesheet is loaded only once and in a consistent manner\n //\n // Case 1: Styles for beforeInteractive/worker with appDir - handled here\n // Case 2: Styles for beforeInteractive/worker with pages dir - Not handled yet\n // Case 3: Styles for afterInteractive/lazyOnload with appDir - handled here\n // Case 4: Styles for afterInteractive/lazyOnload with pages dir - handled in insertStylesheets function\n if (stylesheets) {\n stylesheets.forEach((styleSrc) => {\n ReactDOM.preinit(styleSrc, { as: 'style' })\n })\n }\n\n // Before interactive scripts need to be loaded by Next.js' runtime instead\n // of native <script> tags, because they no longer have `defer`.\n if (strategy === 'beforeInteractive') {\n if (!src) {\n // For inlined scripts, we put the content in `children`.\n if (restProps.dangerouslySetInnerHTML) {\n // Casting since lib.dom.d.ts doesn't have TrustedHTML yet.\n restProps.children = restProps.dangerouslySetInnerHTML\n .__html as string\n delete restProps.dangerouslySetInnerHTML\n }\n\n return (\n <script\n nonce={nonce}\n dangerouslySetInnerHTML={{\n __html: `(self.__next_s=self.__next_s||[]).push(${JSON.stringify([\n 0,\n { ...restProps, id },\n ])})`,\n }}\n />\n )\n } else {\n // @ts-ignore\n ReactDOM.preload(\n src,\n restProps.integrity\n ? {\n as: 'script',\n integrity: restProps.integrity,\n nonce,\n crossOrigin: restProps.crossOrigin,\n }\n : { as: 'script', nonce, crossOrigin: restProps.crossOrigin }\n )\n return (\n <script\n nonce={nonce}\n dangerouslySetInnerHTML={{\n __html: `(self.__next_s=self.__next_s||[]).push(${JSON.stringify([\n src,\n { ...restProps, id },\n ])})`,\n }}\n />\n )\n }\n } else if (strategy === 'afterInteractive') {\n if (src) {\n // @ts-ignore\n ReactDOM.preload(\n src,\n restProps.integrity\n ? {\n as: 'script',\n integrity: restProps.integrity,\n nonce,\n crossOrigin: restProps.crossOrigin,\n }\n : { as: 'script', nonce, crossOrigin: restProps.crossOrigin }\n )\n }\n }\n }\n\n return null\n}\n\nObject.defineProperty(Script, '__nextScript', { value: true })\n\nexport default Script\n"],"names":["handleClientScriptLoad","initScriptLoader","ScriptCache","Map","LoadCache","Set","insertStylesheets","stylesheets","ReactDOM","preinit","forEach","stylesheet","as","window","head","document","link","createElement","type","rel","href","appendChild","loadScript","props","src","id","onLoad","onReady","dangerouslySetInnerHTML","children","strategy","onError","cacheKey","has","add","get","then","afterLoad","el","loadPromise","Promise","resolve","reject","addEventListener","e","call","catch","innerHTML","__html","textContent","Array","isArray","join","set","setAttributesFromProps","setAttribute","body","requestIdleCallback","loadLazyScript","readyState","addBeforeInteractiveToCache","scripts","querySelectorAll","script","getAttribute","scriptLoaderItems","Script","restProps","updateScripts","getIsSsr","appDir","nonce","useContext","HeadManagerContext","hasOnReadyEffectCalled","useRef","useEffect","current","hasLoadScriptEffectCalled","concat","styleSrc","JSON","stringify","preload","integrity","crossOrigin","Object","defineProperty","value"],"mappings":"AAAA;;;;;;;;;;;;;;;;;IAyXA,OAAqB;eAArB;;IA7NgBA,sBAAsB;eAAtBA;;IAgCAC,gBAAgB;eAAhBA;;;;;;mEA1LK;iEAC0C;iDAE5B;wCACI;qCACH;AAEpC,MAAMC,cAAc,IAAIC;AACxB,MAAMC,YAAY,IAAIC;AAiBtB,MAAMC,oBAAoB,CAACC;IACzB,iGAAiG;IACjG,EAAE;IACF,oEAAoE;IACpE,kFAAkF;IAClF,4EAA4E;IAC5E,6EAA6E;IAC7E,IAAIC,iBAAQ,CAACC,OAAO,EAAE;QACpBF,YAAYG,OAAO,CAAC,CAACC;YACnBH,iBAAQ,CAACC,OAAO,CAACE,YAAY;gBAAEC,IAAI;YAAQ;QAC7C;QAEA;IACF;IAEA,gGAAgG;IAChG,EAAE;IACF,kEAAkE;IAClE,yEAAyE;IACzE,IAAI,OAAOC,WAAW,aAAa;QACjC,IAAIC,OAAOC,SAASD,IAAI;QACxBP,YAAYG,OAAO,CAAC,CAACC;YACnB,IAAIK,OAAOD,SAASE,aAAa,CAAC;YAElCD,KAAKE,IAAI,GAAG;YAC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4BACA;gCAAE,GAAG2C,SAAS;gCAAE1C;4BAAG;yBACpB,IAAE;oBACL;;YAGN;QACF,OAAO,IAAIK,aAAa,oBAAoB;YAC1C,IAAIN,KAAK;gBACP,aAAa;gBACbhB,iBAAQ,CAAC2E,OAAO,CACd3D,KACA2C,UAAUiB,SAAS,GACf;oBACExE,IAAI;oBACJwE,WAAWjB,UAAUiB,SAAS;oBAC9Bb;oBACAc,aAAalB,UAAUkB,WAAW;gBACpC,IACA;oBAAEzE,IAAI;oBAAU2D;oBAAOc,aAAalB,UAAUkB,WAAW;gBAAC;YAElE;QACF;IACF;IAEA,OAAO;AACT;AAEAC,OAAOC,cAAc,CAACrB,QAAQ,gBAAgB;IAAEsB,OAAO;AAAK;MAE5D,WAAetB","ignoreList":[0]}
1
+ {"version":3,"sources":["../../src/client/script.tsx"],"sourcesContent":["'use client'\n\nimport ReactDOM from 'react-dom'\nimport React, { useEffect, useContext, useRef, type JSX } from 'react'\nimport type { ScriptHTMLAttributes } from 'react'\nimport { HeadManagerContext } from '../shared/lib/head-manager-context.shared-runtime'\nimport { setAttributesFromProps } from './set-attributes-from-props'\nimport { requestIdleCallback } from './request-idle-callback'\n\nconst ScriptCache = new Map()\nconst LoadCache = new Set()\n\nexport interface ScriptProps extends ScriptHTMLAttributes<HTMLScriptElement> {\n strategy?: 'afterInteractive' | 'lazyOnload' | 'beforeInteractive' | 'worker'\n id?: string\n onLoad?: (e: any) => void\n onReady?: () => void | null\n onError?: (e: any) => void\n children?: React.ReactNode\n stylesheets?: string[]\n}\n\n/**\n * @deprecated Use `ScriptProps` instead.\n */\nexport type Props = ScriptProps\n\nconst insertStylesheets = (stylesheets: string[]) => {\n // Case 1: Styles for afterInteractive/lazyOnload with appDir injected via handleClientScriptLoad\n //\n // Using ReactDOM.preinit to feature detect appDir and inject styles\n // Stylesheets might have already been loaded if initialized with Script component\n // Re-inject styles here to handle scripts loaded via handleClientScriptLoad\n // ReactDOM.preinit handles dedup and ensures the styles are loaded only once\n if (ReactDOM.preinit) {\n stylesheets.forEach((stylesheet: string) => {\n ReactDOM.preinit(stylesheet, { as: 'style' })\n })\n\n return\n }\n\n // Case 2: Styles for afterInteractive/lazyOnload with pages injected via handleClientScriptLoad\n //\n // We use this function to load styles when appdir is not detected\n // TODO: Use React float APIs to load styles once available for pages dir\n if (typeof window !== 'undefined') {\n let head = document.head\n stylesheets.forEach((stylesheet: string) => {\n let link = document.createElement('link')\n\n link.type = 'text/css'\n link.rel = 'stylesheet'\n link.href = stylesheet\n\n head.appendChild(link)\n })\n }\n}\n\nconst loadScript = (props: ScriptProps): void => {\n const {\n src,\n id,\n onLoad = () => {},\n onReady = null,\n dangerouslySetInnerHTML,\n children = '',\n strategy = 'afterInteractive',\n onError,\n stylesheets,\n } = props\n\n const cacheKey = id || src\n\n // Script has already loaded\n if (cacheKey && LoadCache.has(cacheKey)) {\n return\n }\n\n // Contents of this script are already loading/loaded\n if (ScriptCache.has(src)) {\n LoadCache.add(cacheKey)\n // It is possible that multiple `next/script` components all have same \"src\", but has different \"onLoad\"\n // This is to make sure the same remote script will only load once, but \"onLoad\" are executed in order\n ScriptCache.get(src).then(onLoad, onError)\n return\n }\n\n /** Execute after the script first loaded */\n const afterLoad = () => {\n // Run onReady for the first time after load event\n if (onReady) {\n onReady()\n }\n // add cacheKey to LoadCache when load successfully\n LoadCache.add(cacheKey)\n }\n\n const el = document.createElement('script')\n\n const loadPromise = new Promise<void>((resolve, reject) => {\n el.addEventListener('load', function (e) {\n resolve()\n if (onLoad) {\n onLoad.call(this, e)\n }\n afterLoad()\n })\n el.addEventListener('error', function (e) {\n reject(e)\n })\n }).catch(function (e) {\n if (onError) {\n onError(e)\n }\n })\n\n if (dangerouslySetInnerHTML) {\n // Casting since lib.dom.d.ts doesn't have TrustedHTML yet.\n el.innerHTML = (dangerouslySetInnerHTML.__html as string) || ''\n\n afterLoad()\n } else if (children) {\n el.textContent =\n typeof children === 'string'\n ? children\n : Array.isArray(children)\n ? children.join('')\n : ''\n\n afterLoad()\n } else if (src) {\n el.src = src\n // do not add cacheKey into LoadCache for remote script here\n // cacheKey will be added to LoadCache when it is actually loaded (see loadPromise above)\n\n ScriptCache.set(src, loadPromise)\n }\n\n setAttributesFromProps(el, props)\n\n if (strategy === 'worker') {\n el.setAttribute('type', 'text/partytown')\n }\n\n el.setAttribute('data-nscript', strategy)\n\n // Load styles associated with this script\n if (stylesheets) {\n insertStylesheets(stylesheets)\n }\n\n document.body.appendChild(el)\n}\n\nexport function handleClientScriptLoad(props: ScriptProps) {\n const { strategy = 'afterInteractive' } = props\n if (strategy === 'lazyOnload') {\n window.addEventListener('load', () => {\n requestIdleCallback(() => loadScript(props))\n })\n } else {\n loadScript(props)\n }\n}\n\nfunction loadLazyScript(props: ScriptProps) {\n if (document.readyState === 'complete') {\n requestIdleCallback(() => loadScript(props))\n } else {\n window.addEventListener('load', () => {\n requestIdleCallback(() => loadScript(props))\n })\n }\n}\n\nfunction addBeforeInteractiveToCache() {\n const scripts = [\n ...document.querySelectorAll('[data-nscript=\"beforeInteractive\"]'),\n ...document.querySelectorAll('[data-nscript=\"beforePageRender\"]'),\n ]\n scripts.forEach((script) => {\n const cacheKey = script.id || script.getAttribute('src')\n LoadCache.add(cacheKey)\n })\n}\n\nexport function initScriptLoader(scriptLoaderItems: ScriptProps[]) {\n scriptLoaderItems.forEach(handleClientScriptLoad)\n addBeforeInteractiveToCache()\n}\n\n/**\n * Load a third-party scripts in an optimized way.\n *\n * Read more: [Next.js Docs: `next/script`](https://nextjs.org/docs/app/api-reference/components/script)\n */\nfunction Script(props: ScriptProps): JSX.Element | null {\n const {\n id,\n src = '',\n onLoad = () => {},\n onReady = null,\n strategy = 'afterInteractive',\n onError,\n stylesheets,\n ...restProps\n } = props\n\n // Context is available only during SSR\n let { updateScripts, scripts, getIsSsr, appDir, nonce } =\n useContext(HeadManagerContext)\n\n // if a nonce is explicitly passed to the script tag, favor that over the automatic handling\n nonce = restProps.nonce || nonce\n\n /**\n * - First mount:\n * 1. The useEffect for onReady executes\n * 2. hasOnReadyEffectCalled.current is false, but the script hasn't loaded yet (not in LoadCache)\n * onReady is skipped, set hasOnReadyEffectCalled.current to true\n * 3. The useEffect for loadScript executes\n * 4. hasLoadScriptEffectCalled.current is false, loadScript executes\n * Once the script is loaded, the onLoad and onReady will be called by then\n * [If strict mode is enabled / is wrapped in <OffScreen /> component]\n * 5. The useEffect for onReady executes again\n * 6. hasOnReadyEffectCalled.current is true, so entire effect is skipped\n * 7. The useEffect for loadScript executes again\n * 8. hasLoadScriptEffectCalled.current is true, so entire effect is skipped\n *\n * - Second mount:\n * 1. The useEffect for onReady executes\n * 2. hasOnReadyEffectCalled.current is false, but the script has already loaded (found in LoadCache)\n * onReady is called, set hasOnReadyEffectCalled.current to true\n * 3. The useEffect for loadScript executes\n * 4. The script is already loaded, loadScript bails out\n * [If strict mode is enabled / is wrapped in <OffScreen /> component]\n * 5. The useEffect for onReady executes again\n * 6. hasOnReadyEffectCalled.current is true, so entire effect is skipped\n * 7. The useEffect for loadScript executes again\n * 8. hasLoadScriptEffectCalled.current is true, so entire effect is skipped\n */\n const hasOnReadyEffectCalled = useRef(false)\n\n useEffect(() => {\n const cacheKey = id || src\n if (!hasOnReadyEffectCalled.current) {\n // Run onReady if script has loaded before but component is re-mounted\n if (onReady && cacheKey && LoadCache.has(cacheKey)) {\n onReady()\n }\n\n hasOnReadyEffectCalled.current = true\n }\n }, [onReady, id, src])\n\n const hasLoadScriptEffectCalled = useRef(false)\n\n useEffect(() => {\n if (!hasLoadScriptEffectCalled.current) {\n if (strategy === 'afterInteractive') {\n loadScript(props)\n } else if (strategy === 'lazyOnload') {\n loadLazyScript(props)\n }\n\n hasLoadScriptEffectCalled.current = true\n }\n }, [props, strategy])\n\n if (strategy === 'beforeInteractive' || strategy === 'worker') {\n if (updateScripts) {\n scripts[strategy] = (scripts[strategy] || []).concat([\n {\n id,\n src,\n onLoad,\n onReady,\n onError,\n ...restProps,\n nonce,\n },\n ])\n updateScripts(scripts)\n } else if (getIsSsr && getIsSsr()) {\n // Script has already loaded during SSR\n LoadCache.add(id || src)\n } else if (getIsSsr && !getIsSsr()) {\n loadScript({\n ...props,\n nonce,\n })\n }\n }\n\n // For the app directory, we need React Float to preload these scripts.\n if (appDir) {\n // Injecting stylesheets here handles beforeInteractive and worker scripts correctly\n // For other strategies injecting here ensures correct stylesheet order\n // ReactDOM.preinit handles loading the styles in the correct order,\n // also ensures the stylesheet is loaded only once and in a consistent manner\n //\n // Case 1: Styles for beforeInteractive/worker with appDir - handled here\n // Case 2: Styles for beforeInteractive/worker with pages dir - Not handled yet\n // Case 3: Styles for afterInteractive/lazyOnload with appDir - handled here\n // Case 4: Styles for afterInteractive/lazyOnload with pages dir - handled in insertStylesheets function\n if (stylesheets) {\n stylesheets.forEach((styleSrc) => {\n ReactDOM.preinit(styleSrc, { as: 'style' })\n })\n }\n\n // Before interactive scripts need to be loaded by Next.js' runtime instead\n // of native <script> tags, because they no longer have `defer`.\n if (strategy === 'beforeInteractive') {\n if (!src) {\n // For inlined scripts, we put the content in `children`.\n if (restProps.dangerouslySetInnerHTML) {\n // Casting since lib.dom.d.ts doesn't have TrustedHTML yet.\n restProps.children = restProps.dangerouslySetInnerHTML\n .__html as string\n delete restProps.dangerouslySetInnerHTML\n }\n\n return (\n <script\n nonce={nonce}\n dangerouslySetInnerHTML={{\n __html: `(self.__next_s=self.__next_s||[]).push(${JSON.stringify([\n 0,\n { ...restProps, id },\n ])})`,\n }}\n />\n )\n } else {\n // @ts-ignore\n ReactDOM.preload(\n src,\n restProps.integrity\n ? {\n as: 'script',\n integrity: restProps.integrity,\n nonce,\n crossOrigin: restProps.crossOrigin,\n }\n : { as: 'script', nonce, crossOrigin: restProps.crossOrigin }\n )\n return (\n <script\n nonce={nonce}\n dangerouslySetInnerHTML={{\n __html: `(self.__next_s=self.__next_s||[]).push(${JSON.stringify([\n src,\n { ...restProps, id },\n ])})`,\n }}\n />\n )\n }\n } else if (strategy === 'afterInteractive') {\n if (src) {\n // @ts-ignore\n ReactDOM.preload(\n src,\n restProps.integrity\n ? {\n as: 'script',\n integrity: restProps.integrity,\n nonce,\n crossOrigin: restProps.crossOrigin,\n }\n : { as: 'script', nonce, crossOrigin: restProps.crossOrigin }\n )\n }\n }\n }\n\n return null\n}\n\nObject.defineProperty(Script, '__nextScript', { value: true })\n\nexport default Script\n"],"names":["handleClientScriptLoad","initScriptLoader","ScriptCache","Map","LoadCache","Set","insertStylesheets","stylesheets","ReactDOM","preinit","forEach","stylesheet","as","window","head","document","link","createElement","type","rel","href","appendChild","loadScript","props","src","id","onLoad","onReady","dangerouslySetInnerHTML","children","strategy","onError","cacheKey","has","add","get","then","afterLoad","el","loadPromise","Promise","resolve","reject","addEventListener","e","call","catch","innerHTML","__html","textContent","Array","isArray","join","set","setAttributesFromProps","setAttribute","body","requestIdleCallback","loadLazyScript","readyState","addBeforeInteractiveToCache","scripts","querySelectorAll","script","getAttribute","scriptLoaderItems","Script","restProps","updateScripts","getIsSsr","appDir","nonce","useContext","HeadManagerContext","hasOnReadyEffectCalled","useRef","useEffect","current","hasLoadScriptEffectCalled","concat","styleSrc","JSON","stringify","preload","integrity","crossOrigin","Object","defineProperty","value"],"mappings":"AAAA;;;;;;;;;;;;;;;;;IAgYA,OAAqB;eAArB;;IApOgBA,sBAAsB;eAAtBA;;IAgCAC,gBAAgB;eAAhBA;;;;;;mEA1LK;iEAC0C;iDAE5B;wCACI;qCACH;AAEpC,MAAMC,cAAc,IAAIC;AACxB,MAAMC,YAAY,IAAIC;AAiBtB,MAAMC,oBAAoB,CAACC;IACzB,iGAAiG;IACjG,EAAE;IACF,oEAAoE;IACpE,kFAAkF;IAClF,4EAA4E;IAC5E,6EAA6E;IAC7E,IAAIC,iBAAQ,CAACC,OAAO,EAAE;QACpBF,YAAYG,OAAO,CAAC,CAACC;YACnBH,iBAAQ,CAACC,OAAO,CAACE,YAAY;gBAAEC,IAAI;YAAQ;QAC7C;QAEA;IACF;IAEA,gGAAgG;IACh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