next 15.2.0-canary.75 → 15.2.0-canary.76

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.

Potentially problematic release.


This version of next might be problematic. Click here for more details.

Files changed (120) 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/app-dir/form.d.ts +2 -43
  7. package/dist/client/app-dir/form.js +20 -144
  8. package/dist/client/app-dir/form.js.map +1 -1
  9. package/dist/client/components/react-dev-overlay/shared.d.ts +2 -0
  10. package/dist/client/components/react-dev-overlay/shared.js +10 -0
  11. package/dist/client/components/react-dev-overlay/shared.js.map +1 -1
  12. package/dist/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.d.ts +1 -1
  13. package/dist/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.js +11 -3
  14. package/dist/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.js.map +1 -1
  15. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.d.ts +3 -4
  16. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.js +45 -9
  17. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
  18. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.d.ts +4 -4
  19. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.js +5 -4
  20. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.js.map +1 -1
  21. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/route-info.d.ts +1 -1
  22. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/route-info.js +1 -1
  23. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/route-info.js.map +1 -1
  24. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.d.ts +1 -1
  25. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.js +1 -1
  26. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.js.map +1 -1
  27. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.d.ts +10 -0
  28. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js +254 -0
  29. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js.map +1 -0
  30. package/dist/client/components/react-dev-overlay/ui/components/shadow-portal.js +12 -0
  31. package/dist/client/components/react-dev-overlay/ui/components/shadow-portal.js.map +1 -1
  32. package/dist/client/components/react-dev-overlay/ui/icons/dark-icon.d.ts +1 -0
  33. package/dist/client/components/react-dev-overlay/ui/icons/dark-icon.js +34 -0
  34. package/dist/client/components/react-dev-overlay/ui/icons/dark-icon.js.map +1 -0
  35. package/dist/client/components/react-dev-overlay/ui/icons/external.d.ts +1 -0
  36. package/dist/client/components/react-dev-overlay/ui/icons/external.js +31 -3
  37. package/dist/client/components/react-dev-overlay/ui/icons/external.js.map +1 -1
  38. package/dist/client/components/react-dev-overlay/ui/icons/eye-icon.d.ts +1 -0
  39. package/dist/client/components/react-dev-overlay/ui/icons/eye-icon.js +33 -0
  40. package/dist/client/components/react-dev-overlay/ui/icons/eye-icon.js.map +1 -0
  41. package/dist/client/components/react-dev-overlay/ui/icons/gear-icon.d.ts +1 -0
  42. package/dist/client/components/react-dev-overlay/ui/icons/gear-icon.js +34 -0
  43. package/dist/client/components/react-dev-overlay/ui/icons/gear-icon.js.map +1 -0
  44. package/dist/client/components/react-dev-overlay/ui/icons/light-icon.d.ts +1 -0
  45. package/dist/client/components/react-dev-overlay/ui/icons/light-icon.js +48 -0
  46. package/dist/client/components/react-dev-overlay/ui/icons/light-icon.js.map +1 -0
  47. package/dist/client/components/react-dev-overlay/ui/styles/base.js +14 -2
  48. package/dist/client/components/react-dev-overlay/ui/styles/base.js.map +1 -1
  49. package/dist/client/components/react-dev-overlay/ui/styles/colors.js +16 -4
  50. package/dist/client/components/react-dev-overlay/ui/styles/colors.js.map +1 -1
  51. package/dist/client/components/react-dev-overlay/ui/styles/component-styles.js +3 -1
  52. package/dist/client/components/react-dev-overlay/ui/styles/component-styles.js.map +1 -1
  53. package/dist/client/form-shared.d.ts +50 -0
  54. package/dist/client/form-shared.js +155 -0
  55. package/dist/client/form-shared.js.map +1 -0
  56. package/dist/client/form.d.ts +6 -41
  57. package/dist/client/form.js +38 -196
  58. package/dist/client/form.js.map +1 -1
  59. package/dist/client/index.js +1 -1
  60. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +3 -3
  61. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
  62. package/dist/compiled/next-server/app-page.runtime.dev.js +3 -3
  63. package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
  64. package/dist/esm/build/index.js +2 -2
  65. package/dist/esm/build/swc/index.js +1 -1
  66. package/dist/esm/build/webpack-config.js +2 -2
  67. package/dist/esm/client/app-bootstrap.js +1 -1
  68. package/dist/esm/client/app-dir/form.js +17 -141
  69. package/dist/esm/client/app-dir/form.js.map +1 -1
  70. package/dist/esm/client/components/react-dev-overlay/shared.js +2 -0
  71. package/dist/esm/client/components/react-dev-overlay/shared.js.map +1 -1
  72. package/dist/esm/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.js +12 -4
  73. package/dist/esm/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.js.map +1 -1
  74. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.js +44 -9
  75. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
  76. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.js +5 -4
  77. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.js.map +1 -1
  78. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/route-info.js +1 -1
  79. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/route-info.js.map +1 -1
  80. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.js +1 -1
  81. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.js.map +1 -1
  82. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js +225 -0
  83. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js.map +1 -0
  84. package/dist/esm/client/components/react-dev-overlay/ui/components/shadow-portal.js +12 -0
  85. package/dist/esm/client/components/react-dev-overlay/ui/components/shadow-portal.js.map +1 -1
  86. package/dist/esm/client/components/react-dev-overlay/ui/icons/dark-icon.js +18 -0
  87. package/dist/esm/client/components/react-dev-overlay/ui/icons/dark-icon.js.map +1 -0
  88. package/dist/esm/client/components/react-dev-overlay/ui/icons/external.js +16 -0
  89. package/dist/esm/client/components/react-dev-overlay/ui/icons/external.js.map +1 -1
  90. package/dist/esm/client/components/react-dev-overlay/ui/icons/eye-icon.js +17 -0
  91. package/dist/esm/client/components/react-dev-overlay/ui/icons/eye-icon.js.map +1 -0
  92. package/dist/esm/client/components/react-dev-overlay/ui/icons/gear-icon.js +18 -0
  93. package/dist/esm/client/components/react-dev-overlay/ui/icons/gear-icon.js.map +1 -0
  94. package/dist/esm/client/components/react-dev-overlay/ui/icons/light-icon.js +32 -0
  95. package/dist/esm/client/components/react-dev-overlay/ui/icons/light-icon.js.map +1 -0
  96. package/dist/esm/client/components/react-dev-overlay/ui/styles/base.js +14 -2
  97. package/dist/esm/client/components/react-dev-overlay/ui/styles/base.js.map +1 -1
  98. package/dist/esm/client/components/react-dev-overlay/ui/styles/colors.js +16 -4
  99. package/dist/esm/client/components/react-dev-overlay/ui/styles/colors.js.map +1 -1
  100. package/dist/esm/client/components/react-dev-overlay/ui/styles/component-styles.js +3 -1
  101. package/dist/esm/client/components/react-dev-overlay/ui/styles/component-styles.js.map +1 -1
  102. package/dist/esm/client/form-shared.js +103 -0
  103. package/dist/esm/client/form-shared.js.map +1 -0
  104. package/dist/esm/client/form.js +35 -193
  105. package/dist/esm/client/form.js.map +1 -1
  106. package/dist/esm/client/index.js +1 -1
  107. package/dist/esm/server/config.js +1 -1
  108. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  109. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  110. package/dist/esm/server/lib/app-info-log.js +1 -1
  111. package/dist/esm/server/lib/start-server.js +1 -1
  112. package/dist/server/config.js +1 -1
  113. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  114. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  115. package/dist/server/lib/app-info-log.js +1 -1
  116. package/dist/server/lib/start-server.js +1 -1
  117. package/dist/telemetry/anonymous-meta.js +1 -1
  118. package/dist/telemetry/events/session-stopped.js +2 -2
  119. package/dist/telemetry/events/version.js +2 -2
  120. package/package.json +24 -24
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/form.tsx"],"sourcesContent":["'use client'\n\nimport { useEffect, type HTMLProps, type FormEvent, useContext } from 'react'\nimport { addBasePath } from './add-base-path'\nimport { useIntersection } from './use-intersection'\nimport { useMergedRef } from './use-merged-ref'\nimport {\n AppRouterContext,\n type AppRouterInstance,\n} from '../shared/lib/app-router-context.shared-runtime'\nimport { PrefetchKind } from './components/router-reducer/router-reducer-types'\nimport { RouterContext } from '../shared/lib/router-context.shared-runtime'\nimport type { NextRouter } from './router'\n\nconst DISALLOWED_FORM_PROPS = ['method', 'encType', 'target'] as const\n\ntype HTMLFormProps = HTMLProps<HTMLFormElement>\ntype DisallowedFormProps = (typeof DISALLOWED_FORM_PROPS)[number]\n\ntype InternalFormProps = {\n /**\n * `action` can be either a `string` or a function.\n * - If `action` is a string, it will be interpreted as a path or URL to navigate to when the form is submitted.\n * The path will be prefetched when the form becomes visible.\n * - If `action` is a function, it will be called when the form is submitted. See the [React docs](https://react.dev/reference/react-dom/components/form#props) for more.\n */\n action: NonNullable<HTMLFormProps['action']>\n /**\n * Controls how the route specified by `action` is prefetched.\n * Any `<Form />` that is in the viewport (initially or through scroll) will be prefetched.\n * Prefetch can be disabled by passing `prefetch={false}`. Prefetching is only enabled in production.\n *\n * Options:\n * - `null` (default): For statically generated pages, this will prefetch the full React Server Component data. For dynamic pages, this will prefetch up to the nearest route segment with a [`loading.js`](https://nextjs.org/docs/app/api-reference/file-conventions/loading) file. If there is no loading file, it will not fetch the full tree to avoid fetching too much data.\n * - `false`: This will not prefetch any data.\n *\n * In pages dir, prefetching is not supported, and passing this prop will emit a warning.\n *\n * @defaultValue `null`\n */\n prefetch?: false | null\n /**\n * Whether submitting the form should replace the current `history` state instead of adding a new url into the stack.\n * Only valid if `action` is a string.\n *\n * @defaultValue `false`\n */\n replace?: boolean\n /**\n * Override the default scroll behavior when navigating.\n * Only valid if `action` is a string.\n *\n * @defaultValue `true`\n */\n scroll?: boolean\n} & Omit<HTMLFormProps, 'action' | DisallowedFormProps>\n\n// `RouteInferType` is a stub here to avoid breaking `typedRoutes` when the type\n// isn't generated yet. It will be replaced when the webpack plugin runs.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type FormProps<RouteInferType = any> = InternalFormProps\n\nexport default function Form({\n replace,\n scroll,\n prefetch: prefetchProp,\n ref: externalRef,\n ...props\n}: FormProps) {\n const router = useAppOrPagesRouter()\n\n const actionProp = props.action\n const isNavigatingForm = typeof actionProp === 'string'\n\n // Validate `action`\n if (process.env.NODE_ENV === 'development') {\n if (isNavigatingForm) {\n checkActionUrl(actionProp, 'action')\n }\n }\n\n // Validate `prefetch`\n if (process.env.NODE_ENV === 'development') {\n if (\n !(\n prefetchProp === undefined ||\n prefetchProp === false ||\n prefetchProp === null\n )\n ) {\n console.error('The `prefetch` prop of <Form> must be `false` or `null`')\n }\n\n if (prefetchProp !== undefined) {\n if (!isAppRouter(router)) {\n console.error(\n 'Passing `prefetch` to a <Form> has no effect in the pages directory.'\n )\n } else if (!isNavigatingForm) {\n console.error(\n 'Passing `prefetch` to a <Form> whose `action` is a function has no effect.'\n )\n }\n }\n }\n\n const prefetch =\n prefetchProp === false || prefetchProp === null ? prefetchProp : null\n\n // Validate `scroll` and `replace`\n if (process.env.NODE_ENV === 'development') {\n if (!isNavigatingForm && (replace !== undefined || scroll !== undefined)) {\n console.error(\n 'Passing `replace` or `scroll` to a <Form> whose `action` is a function has no effect.\\n' +\n 'See the relevant docs to learn how to control this behavior for navigations triggered from actions:\\n' +\n ' `redirect()` - https://nextjs.org/docs/app/api-reference/functions/redirect#parameters\\n' +\n ' `router.replace()` - https://nextjs.org/docs/app/api-reference/functions/use-router#userouter\\n'\n )\n }\n }\n\n // Clean up any unsupported form props (and warn if present)\n for (const key of DISALLOWED_FORM_PROPS) {\n if (key in props) {\n if (process.env.NODE_ENV === 'development') {\n console.error(\n `<Form> does not support changing \\`${key}\\`. ` +\n (isNavigatingForm\n ? `If you'd like to use it to perform a mutation, consider making \\`action\\` a function instead.\\n` +\n `Learn more: https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations`\n : '')\n )\n }\n delete (props as Record<string, unknown>)[key]\n }\n }\n\n const isPrefetchEnabled =\n // there is no notion of instant loading states in pages dir, so prefetching is pointless\n isAppRouter(router) &&\n // if we don't have an action path, we can't preload anything anyway.\n isNavigatingForm &&\n prefetch === null\n\n const [setIntersectionRef, isVisible] = useIntersection({\n rootMargin: '200px',\n disabled: !isPrefetchEnabled,\n })\n\n const ownRef = useMergedRef<HTMLFormElement>(\n setIntersectionRef,\n externalRef ?? null\n )\n\n useEffect(() => {\n if (!isVisible || !isPrefetchEnabled) {\n return\n }\n\n try {\n const prefetchKind = PrefetchKind.AUTO\n router.prefetch(actionProp, { kind: prefetchKind })\n } catch (err) {\n console.error(err)\n }\n }, [isPrefetchEnabled, isVisible, actionProp, prefetch, router])\n\n if (!isNavigatingForm) {\n return <form {...props} ref={ownRef} />\n }\n\n const actionHref = addBasePath(actionProp)\n\n return (\n <form\n {...props}\n ref={ownRef}\n action={actionHref}\n onSubmit={(event) =>\n onFormSubmit(event, {\n router,\n actionHref,\n replace,\n scroll,\n onSubmit: props.onSubmit,\n })\n }\n />\n )\n}\n\nfunction onFormSubmit(\n event: FormEvent<HTMLFormElement>,\n {\n actionHref,\n onSubmit,\n replace,\n scroll,\n router,\n }: {\n actionHref: string\n onSubmit: FormProps['onSubmit']\n replace: FormProps['replace']\n scroll: FormProps['scroll']\n router: SomeRouter\n }\n) {\n if (typeof onSubmit === 'function') {\n onSubmit(event)\n\n // if the user called event.preventDefault(), do nothing.\n // (this matches what Link does for `onClick`)\n if (event.defaultPrevented) {\n return\n }\n }\n\n const formElement = event.currentTarget\n const submitter = (event.nativeEvent as SubmitEvent).submitter\n\n let action = actionHref\n\n if (submitter) {\n if (process.env.NODE_ENV === 'development') {\n // the way server actions are encoded (e.g. `formMethod=\"post\")\n // causes some unnecessary dev-mode warnings from `hasUnsupportedSubmitterAttributes`.\n // we'd bail out anyway, but we just do it silently.\n if (hasReactServerActionAttributes(submitter)) {\n return\n }\n }\n\n if (hasUnsupportedSubmitterAttributes(submitter)) {\n return\n }\n\n // client actions have `formAction=\"javascript:...\"`. We obviously can't prefetch/navigate to that.\n if (hasReactClientActionAttributes(submitter)) {\n return\n }\n\n // If the submitter specified an alternate formAction,\n // use that URL instead -- this is what a native form would do.\n // NOTE: `submitter.formAction` is unreliable, because it will give us `location.href` if it *wasn't* set\n // NOTE: this should not have `basePath` added, because we can't add it before hydration\n const submitterFormAction = submitter.getAttribute('formAction')\n if (submitterFormAction !== null) {\n if (process.env.NODE_ENV === 'development') {\n checkActionUrl(submitterFormAction, 'formAction')\n }\n action = submitterFormAction\n }\n }\n\n let targetUrl: URL\n try {\n // NOTE: It might be more correct to resolve URLs relative to `document.baseURI`,\n // but we already do it relative to `location.href` elsewhere:\n // (see e.g. https://github.com/vercel/next.js/blob/bb0e6722f87ceb2d43015f5b8a413d0072f2badf/packages/next/src/client/components/app-router.tsx#L146)\n // so it's better to stay consistent.\n const base = window.location.href\n targetUrl = new URL(action, base)\n } catch (err) {\n throw new Error(`Cannot parse form action \"${action}\" as a URL`, {\n cause: err,\n })\n }\n if (targetUrl.searchParams.size) {\n // url-encoded HTML forms *overwrite* any search params in the `action` url:\n //\n // \"Let `query` be the result of running the application/x-www-form-urlencoded serializer [...]\"\n // \"Set parsed action's query component to `query`.\"\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-mutate-action\n //\n // We need to match that.\n // (note that all other parts of the URL, like `hash`, are preserved)\n targetUrl.search = ''\n }\n\n const formData = new FormData(formElement)\n\n for (let [name, value] of formData) {\n if (typeof value !== 'string') {\n // For file inputs, the native browser behavior is to use the filename as the value instead:\n //\n // \"If entry's value is a File object, then let value be entry's value's name. Otherwise, let value be entry's value.\"\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs\n //\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n `<Form> only supports file inputs if \\`action\\` is a function. File inputs cannot be used if \\`action\\` is a string, ` +\n `because files cannot be encoded as search params.`\n )\n }\n value = value.name\n }\n\n targetUrl.searchParams.append(name, value)\n }\n\n // Finally, no more reasons for bailing out.\n event.preventDefault()\n\n const method = replace ? 'replace' : 'push'\n const targetHref = targetUrl.href\n if (isAppRouter(router)) {\n router[method](targetHref, { scroll })\n } else {\n // TODO(form): Make this use a transition so that pending states work\n //\n // Unlike the app router, pages router doesn't use startTransition,\n // and can't easily be wrapped in one because of implementation details\n // (e.g. it doesn't use any react state)\n // But it's important to have this wrapped in a transition because\n // pending states from e.g. `useFormStatus` rely on that.\n // So this needs some follow up work.\n router[method](targetHref, undefined, { scroll })\n }\n}\n\ntype SomeRouter = AppRouterInstance | NextRouter\n\nfunction isAppRouter(router: SomeRouter): router is AppRouterInstance {\n return !('asPath' in router)\n}\n\nfunction useAppOrPagesRouter(): SomeRouter {\n const pagesRouter = useContext(RouterContext)\n const appRouter = useContext(AppRouterContext)\n if (pagesRouter) {\n return pagesRouter\n } else {\n // We're in the app directory if there is no pages router.\n return appRouter!\n }\n}\n\nfunction checkActionUrl(action: string, source: 'action' | 'formAction') {\n const aPropName = source === 'action' ? `an \\`action\\`` : `a \\`formAction\\``\n\n let testUrl: URL\n try {\n testUrl = new URL(action, 'http://n')\n } catch (err) {\n console.error(\n `<Form> received ${aPropName} that cannot be parsed as a URL: \"${action}\".`\n )\n return\n }\n\n // url-encoded HTML forms ignore any queryparams in the `action` url. We need to match that.\n if (testUrl.searchParams.size) {\n console.warn(\n `<Form> received ${aPropName} that contains search params: \"${action}\". This is not supported, and they will be ignored. ` +\n `If you need to pass in additional search params, use an \\`<input type=\"hidden\" />\\` instead.`\n )\n }\n}\n\nconst isSupportedEncType = (value: string) =>\n value === 'application/x-www-form-urlencoded'\nconst isSupportedMethod = (value: string) => value === 'get'\nconst isSupportedTarget = (value: string) => value === '_self'\n\nfunction hasUnsupportedSubmitterAttributes(submitter: HTMLElement): boolean {\n // A submitter can override `encType` for the form.\n const formEncType = submitter.getAttribute('formEncType')\n if (formEncType !== null && !isSupportedEncType(formEncType)) {\n if (process.env.NODE_ENV === 'development') {\n console.error(\n `<Form>'s \\`encType\\` was set to an unsupported value via \\`formEncType=\"${formEncType}\"\\`. ` +\n `This will disable <Form>'s navigation functionality. If you need this, use a native <form> element instead.`\n )\n }\n return true\n }\n\n // A submitter can override `method` for the form.\n const formMethod = submitter.getAttribute('formMethod')\n if (formMethod !== null && !isSupportedMethod(formMethod)) {\n if (process.env.NODE_ENV === 'development') {\n console.error(\n `<Form>'s \\`method\\` was set to an unsupported value via \\`formMethod=\"${formMethod}\"\\`. ` +\n `This will disable <Form>'s navigation functionality. If you need this, use a native <form> element instead.`\n )\n }\n return true\n }\n\n // A submitter can override `target` for the form.\n const formTarget = submitter.getAttribute('formTarget')\n if (formTarget !== null && !isSupportedTarget(formTarget)) {\n if (process.env.NODE_ENV === 'development') {\n console.error(\n `<Form>'s \\`target\\` was set to an unsupported value via \\`formTarget=\"${formTarget}\"\\`. ` +\n `This will disable <Form>'s navigation functionality. If you need this, use a native <form> element instead.`\n )\n }\n return true\n }\n\n return false\n}\n\nfunction hasReactServerActionAttributes(submitter: HTMLElement) {\n // https://github.com/facebook/react/blob/942eb80381b96f8410eab1bef1c539bed1ab0eb1/packages/react-client/src/ReactFlightReplyClient.js#L931-L934\n const name = submitter.getAttribute('name')\n return (\n name && (name.startsWith('$ACTION_ID_') || name.startsWith('$ACTION_REF_'))\n )\n}\n\nfunction hasReactClientActionAttributes(submitter: HTMLElement) {\n // CSR: https://github.com/facebook/react/blob/942eb80381b96f8410eab1bef1c539bed1ab0eb1/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L482-L487\n // SSR: https://github.com/facebook/react/blob/942eb80381b96f8410eab1bef1c539bed1ab0eb1/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L2401\n const action = submitter.getAttribute('formAction')\n return action && /\\s*javascript:/i.test(action)\n}\n"],"names":["useEffect","useContext","addBasePath","useIntersection","useMergedRef","AppRouterContext","PrefetchKind","RouterContext","DISALLOWED_FORM_PROPS","Form","replace","scroll","prefetch","prefetchProp","ref","externalRef","props","router","useAppOrPagesRouter","actionProp","action","isNavigatingForm","process","env","NODE_ENV","checkActionUrl","undefined","console","error","isAppRouter","key","isPrefetchEnabled","setIntersectionRef","isVisible","rootMargin","disabled","ownRef","prefetchKind","AUTO","kind","err","form","actionHref","onSubmit","event","onFormSubmit","defaultPrevented","formElement","currentTarget","submitter","nativeEvent","hasReactServerActionAttributes","hasUnsupportedSubmitterAttributes","hasReactClientActionAttributes","submitterFormAction","getAttribute","targetUrl","base","window","location","href","URL","Error","cause","searchParams","size","search","formData","FormData","name","value","warn","append","preventDefault","method","targetHref","pagesRouter","appRouter","source","aPropName","testUrl","isSupportedEncType","isSupportedMethod","isSupportedTarget","formEncType","formMethod","formTarget","startsWith","test"],"mappings":"AAAA;;AAEA,SAASA,SAAS,EAAkCC,UAAU,QAAQ,QAAO;AAC7E,SAASC,WAAW,QAAQ,kBAAiB;AAC7C,SAASC,eAAe,QAAQ,qBAAoB;AACpD,SAASC,YAAY,QAAQ,mBAAkB;AAC/C,SACEC,gBAAgB,QAEX,kDAAiD;AACxD,SAASC,YAAY,QAAQ,mDAAkD;AAC/E,SAASC,aAAa,QAAQ,8CAA6C;AAG3E,MAAMC,wBAAwB;IAAC;IAAU;IAAW;CAAS;AAgD7D,eAAe,SAASC,KAAK,KAMjB;IANiB,IAAA,EAC3BC,OAAO,EACPC,MAAM,EACNC,UAAUC,YAAY,EACtBC,KAAKC,WAAW,EAChB,GAAGC,OACO,GANiB;IAO3B,MAAMC,SAASC;IAEf,MAAMC,aAAaH,MAAMI,MAAM;IAC/B,MAAMC,mBAAmB,OAAOF,eAAe;IAE/C,oBAAoB;IACpB,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,IAAIH,kBAAkB;YACpBI,eAAeN,YAAY;QAC7B;IACF;IAEA,sBAAsB;IACtB,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,IACE,CACEX,CAAAA,iBAAiBa,aACjBb,iBAAiB,SACjBA,iBAAiB,IAAG,GAEtB;YACAc,QAAQC,KAAK,CAAC;QAChB;QAEA,IAAIf,iBAAiBa,WAAW;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1C,IAAI+B,eAAe,QAAQ,CAACH,kBAAkBG,aAAa;QACzD,IAAIhE,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;YAC1CG,QAAQC,KAAK,CACX,AAAC,yEAAwE0D,aAAW,SACjF;QAEP;QACA,OAAO;IACT;IAEA,OAAO;AACT;AAEA,SAASnC,+BAA+BF,SAAsB;IAC5D,gJAAgJ;IAChJ,MAAMoB,OAAOpB,UAAUM,YAAY,CAAC;IACpC,OACEc,QAASA,CAAAA,KAAKkB,UAAU,CAAC,kBAAkBlB,KAAKkB,UAAU,CAAC,eAAc;AAE7E;AAEA,SAASlC,+BAA+BJ,SAAsB;IAC5D,6JAA6J;IAC7J,yJAAyJ;IACzJ,MAAM7B,SAAS6B,UAAUM,YAAY,CAAC;IACtC,OAAOnC,UAAU,kBAAkBoE,IAAI,CAACpE;AAC1C"}
1
+ {"version":3,"sources":["../../src/client/form.tsx"],"sourcesContent":["'use client'\n\nimport { type FormEvent, useContext, forwardRef } from 'react'\nimport { addBasePath } from './add-base-path'\nimport { RouterContext } from '../shared/lib/router-context.shared-runtime'\nimport type { NextRouter } from './router'\nimport {\n checkFormActionUrl,\n createFormSubmitDestinationUrl,\n DISALLOWED_FORM_PROPS,\n hasReactClientActionAttributes,\n hasUnsupportedSubmitterAttributes,\n type FormProps,\n} from './form-shared'\n\nexport type { FormProps }\n\nconst Form = forwardRef<HTMLFormElement, FormProps>(function FormComponent(\n { replace, scroll, prefetch: prefetchProp, ...props },\n ref\n) {\n const router = useContext(RouterContext)\n\n const actionProp = props.action\n const isNavigatingForm = typeof actionProp === 'string'\n\n // Validate `action`\n if (process.env.NODE_ENV === 'development') {\n if (isNavigatingForm) {\n checkFormActionUrl(actionProp, 'action')\n }\n }\n\n // Validate `prefetch`\n if (process.env.NODE_ENV === 'development') {\n if (prefetchProp !== undefined) {\n console.error(\n 'Passing `prefetch` to a <Form> has no effect in the pages directory.'\n )\n }\n }\n\n // Validate `scroll` and `replace`\n if (process.env.NODE_ENV === 'development') {\n if (!isNavigatingForm && (replace !== undefined || scroll !== undefined)) {\n console.error(\n 'Passing `replace` or `scroll` to a <Form> whose `action` is a function has no effect.\\n' +\n 'See the relevant docs to learn how to control this behavior for navigations triggered from actions:\\n' +\n ' `router.replace()` - https://nextjs.org/docs/pages/api-reference/functions/use-router#routerreplace\\n'\n )\n }\n }\n\n // Clean up any unsupported form props (and warn if present)\n for (const key of DISALLOWED_FORM_PROPS) {\n if (key in props) {\n if (process.env.NODE_ENV === 'development') {\n console.error(`<Form> does not support changing \\`${key}\\`.`)\n }\n delete (props as Record<string, unknown>)[key]\n }\n }\n\n if (!isNavigatingForm) {\n return <form {...props} ref={ref} />\n }\n\n const actionHref = addBasePath(actionProp)\n\n return (\n <form\n {...props}\n ref={ref}\n action={actionHref}\n onSubmit={(event) =>\n onFormSubmit(event, {\n router,\n actionHref,\n replace,\n scroll,\n onSubmit: props.onSubmit,\n })\n }\n />\n )\n})\n\nexport default Form\n\nfunction onFormSubmit(\n event: FormEvent<HTMLFormElement>,\n {\n actionHref,\n onSubmit,\n replace,\n scroll,\n router,\n }: {\n actionHref: string\n onSubmit: FormProps['onSubmit']\n replace: FormProps['replace']\n scroll: FormProps['scroll']\n router: NextRouter | null\n }\n) {\n if (typeof onSubmit === 'function') {\n onSubmit(event)\n\n // if the user called event.preventDefault(), do nothing.\n // (this matches what Link does for `onClick`)\n if (event.defaultPrevented) {\n return\n }\n }\n\n if (!router) {\n // Form was somehow used outside of the router (but not in app/, the implementation is forked!).\n // We can't perform a soft navigation, so let the native submit handling do its thing.\n return\n }\n\n const formElement = event.currentTarget\n const submitter = (event.nativeEvent as SubmitEvent).submitter\n\n let action = actionHref\n\n if (submitter) {\n // this is page-router-only, so we don't need to worry about false positives\n // from the attributes that react adds for server actions.\n if (hasUnsupportedSubmitterAttributes(submitter)) {\n return\n }\n\n // client actions have `formAction=\"javascript:...\"`. We obviously can't prefetch/navigate to that.\n if (hasReactClientActionAttributes(submitter)) {\n return\n }\n\n // If the submitter specified an alternate formAction,\n // use that URL instead -- this is what a native form would do.\n // NOTE: `submitter.formAction` is unreliable, because it will give us `location.href` if it *wasn't* set\n // NOTE: this should not have `basePath` added, because we can't add it before hydration\n const submitterFormAction = submitter.getAttribute('formAction')\n if (submitterFormAction !== null) {\n if (process.env.NODE_ENV === 'development') {\n checkFormActionUrl(submitterFormAction, 'formAction')\n }\n action = submitterFormAction\n }\n }\n\n const targetUrl = createFormSubmitDestinationUrl(action, formElement)\n\n // Finally, no more reasons for bailing out.\n event.preventDefault()\n\n const method = replace ? 'replace' : 'push'\n const targetHref = targetUrl.href // TODO: will pages router be happy about an absolute URL here?\n\n // TODO(form): Make this use a transition so that pending states work\n //\n // Unlike the app router, pages router doesn't use startTransition,\n // and can't easily be wrapped in one because of implementation details\n // (e.g. it doesn't use any react state)\n // But it's important to have this wrapped in a transition because\n // pending states from e.g. `useFormStatus` rely on that.\n // So this needs some follow up work.\n router[method](targetHref, undefined, { scroll })\n}\n"],"names":["useContext","forwardRef","addBasePath","RouterContext","checkFormActionUrl","createFormSubmitDestinationUrl","DISALLOWED_FORM_PROPS","hasReactClientActionAttributes","hasUnsupportedSubmitterAttributes","Form","FormComponent","ref","replace","scroll","prefetch","prefetchProp","props","router","actionProp","action","isNavigatingForm","process","env","NODE_ENV","undefined","console","error","key","form","actionHref","onSubmit","event","onFormSubmit","defaultPrevented","formElement","currentTarget","submitter","nativeEvent","submitterFormAction","getAttribute","targetUrl","preventDefault","method","targetHref","href"],"mappings":"AAAA;;AAEA,SAAyBA,UAAU,EAAEC,UAAU,QAAQ,QAAO;AAC9D,SAASC,WAAW,QAAQ,kBAAiB;AAC7C,SAASC,aAAa,QAAQ,8CAA6C;AAE3E,SACEC,kBAAkB,EAClBC,8BAA8B,EAC9BC,qBAAqB,EACrBC,8BAA8B,EAC9BC,iCAAiC,QAE5B,gBAAe;AAItB,MAAMC,qBAAOR,WAAuC,SAASS,cAC3D,KAAqD,EACrDC,GAAG;IADH,IAAA,E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U,EACVC,QAAQ,EACRlB,OAAO,EACPC,MAAM,EACNI,MAAM,EAOP,GAZD;IAcA,IAAI,OAAOa,aAAa,YAAY;QAClCA,SAASC;QAET,yDAAyD;QACzD,8CAA8C;QAC9C,IAAIA,MAAME,gBAAgB,EAAE;YAC1B;QACF;IACF;IAEA,IAAI,CAAChB,QAAQ;QACX,gGAAgG;QAChG,sFAAsF;QACtF;IACF;IAEA,MAAMiB,cAAcH,MAAMI,aAAa;IACvC,MAAMC,YAAY,AAACL,MAAMM,WAAW,CAAiBD,SAAS;IAE9D,IAAIjB,SAASU;IAEb,IAAIO,WAAW;QACb,4EAA4E;QAC5E,0DAA0D;QAC1D,IAAI5B,kCAAkC4B,YAAY;YAChD;QACF;QAEA,mGAAmG;QACnG,IAAI7B,+BAA+B6B,YAAY;YAC7C;QACF;QAEA,sDAAsD;QACtD,+DAA+D;QAC/D,yGAAyG;QACzG,wFAAwF;QACxF,MAAME,sBAAsBF,UAAUG,YAAY,CAAC;QACnD,IAAID,wBAAwB,MAAM;YAChC,IAAIjB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;gBAC1CnB,mBAAmBkC,qBAAqB;YAC1C;YACAnB,SAASmB;QACX;IACF;IAEA,MAAME,YAAYnC,+BAA+Bc,QAAQe;IAEzD,4CAA4C;IAC5CH,MAAMU,cAAc;IAEpB,MAAMC,SAAS9B,UAAU,YAAY;IACrC,MAAM+B,aAAaH,UAAUI,IAAI,CAAC,+DAA+D;;IAEjG,qEAAqE;IACrE,EAAE;IACF,mEAAmE;IACnE,uEAAuE;IACvE,wCAAwC;IACxC,kEAAkE;IAClE,yDAAyD;IACzD,qCAAqC;IACrC3B,MAAM,CAACyB,OAAO,CAACC,YAAYnB,WAAW;QAAEX;IAAO;AACjD"}
@@ -26,7 +26,7 @@ import { SearchParamsContext, PathParamsContext } from '../shared/lib/hooks-clie
26
26
  import { onRecoverableError } from './react-client-callbacks/on-recoverable-error';
27
27
  import tracer from './tracing/tracer';
28
28
  import { isNextRouterError } from './components/is-next-router-error';
29
- export const version = "15.2.0-canary.75";
29
+ export const version = "15.2.0-canary.76";
30
30
  export let router;
31
31
  export const emitter = mitt();
32
32
  const looseToArray = (input)=>[].slice.call(input);
@@ -188,7 +188,7 @@ function assignDefaults(dir, userConfig, silent) {
188
188
  configurable: true
189
189
  });
190
190
  }
191
- if (!((_process_env___NEXT_VERSION = "15.2.0-canary.75") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV) {
191
+ if (!((_process_env___NEXT_VERSION = "15.2.0-canary.76") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV) {
192
192
  var _result_experimental7, _result_experimental8, _result_experimental_turbo3, _result_experimental9, _result_experimental10;
193
193
  // Prevents usage of certain experimental features outside of canary
194
194
  if ((_result_experimental7 = result.experimental) == null ? void 0 : _result_experimental7.ppr) {
@@ -83,7 +83,7 @@ export async function createHotReloaderTurbopack(opts, serverFields, distDir, re
83
83
  }
84
84
  const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
85
85
  const hotReloaderSpan = trace('hot-reloader', undefined, {
86
- version: "15.2.0-canary.75"
86
+ version: "15.2.0-canary.76"
87
87
  });
88
88
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
89
89
  // of the current `next dev` invocation.
@@ -180,7 +180,7 @@ export default class HotReloaderWebpack {
180
180
  this.previewProps = previewProps;
181
181
  this.rewrites = rewrites;
182
182
  this.hotReloaderSpan = trace('hot-reloader', undefined, {
183
- version: "15.2.0-canary.75"
183
+ version: "15.2.0-canary.76"
184
184
  });
185
185
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
186
186
  // of the current `next dev` invocation.
@@ -4,7 +4,7 @@ import { bold, purple } from '../../lib/picocolors';
4
4
  import { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants';
5
5
  import loadConfig, { getConfiguredExperimentalFeatures } from '../config';
6
6
  export function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures, maxExperimentalFeatures = Infinity }) {
7
- Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.2.0-canary.75"}`))}${process.env.TURBOPACK ? ' (Turbopack)' : ''}`);
7
+ Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.2.0-canary.76"}`))}${process.env.TURBOPACK ? ' (Turbopack)' : ''}`);
8
8
  if (appUrl) {
9
9
  Log.bootstrap(`- Local: ${appUrl}`);
10
10
  }
@@ -43,7 +43,7 @@ export async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup,
43
43
  export async function startServer(serverOptions) {
44
44
  const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
45
45
  let { port } = serverOptions;
46
- process.title = `next-server (v${"15.2.0-canary.75"})`;
46
+ process.title = `next-server (v${"15.2.0-canary.76"})`;
47
47
  let handlersReady = ()=>{};
48
48
  let handlersError = ()=>{};
49
49
  let handlersPromise = new Promise((resolve, reject)=>{
@@ -267,7 +267,7 @@ function assignDefaults(dir, userConfig, silent) {
267
267
  configurable: true
268
268
  });
269
269
  }
270
- if (!((_process_env___NEXT_VERSION = "15.2.0-canary.75") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV) {
270
+ if (!((_process_env___NEXT_VERSION = "15.2.0-canary.76") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV) {
271
271
  var _result_experimental7, _result_experimental8, _result_experimental_turbo3, _result_experimental9, _result_experimental10;
272
272
  // Prevents usage of certain experimental features outside of canary
273
273
  if ((_result_experimental7 = result.experimental) == null ? void 0 : _result_experimental7.ppr) {
@@ -139,7 +139,7 @@ async function createHotReloaderTurbopack(opts, serverFields, distDir, resetFetc
139
139
  }
140
140
  const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
141
141
  const hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
142
- version: "15.2.0-canary.75"
142
+ version: "15.2.0-canary.76"
143
143
  });
144
144
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
145
145
  // of the current `next dev` invocation.
@@ -256,7 +256,7 @@ class HotReloaderWebpack {
256
256
  this.previewProps = previewProps;
257
257
  this.rewrites = rewrites;
258
258
  this.hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
259
- version: "15.2.0-canary.75"
259
+ version: "15.2.0-canary.76"
260
260
  });
261
261
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
262
262
  // of the current `next dev` invocation.
@@ -67,7 +67,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
67
67
  return newObj;
68
68
  }
69
69
  function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures, maxExperimentalFeatures = Infinity }) {
70
- _log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.2.0-canary.75"}`))}${process.env.TURBOPACK ? ' (Turbopack)' : ''}`);
70
+ _log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.2.0-canary.76"}`))}${process.env.TURBOPACK ? ' (Turbopack)' : ''}`);
71
71
  if (appUrl) {
72
72
  _log.bootstrap(`- Local: ${appUrl}`);
73
73
  }
@@ -111,7 +111,7 @@ async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup, server
111
111
  async function startServer(serverOptions) {
112
112
  const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
113
113
  let { port } = serverOptions;
114
- process.title = `next-server (v${"15.2.0-canary.75"})`;
114
+ process.title = `next-server (v${"15.2.0-canary.76"})`;
115
115
  let handlersReady = ()=>{};
116
116
  let handlersError = ()=>{};
117
117
  let handlersPromise = new Promise((resolve, reject)=>{
@@ -81,7 +81,7 @@ function getAnonymousMeta() {
81
81
  isWsl: _iswsl.default,
82
82
  isCI: _ciinfo.isCI,
83
83
  ciName: _ciinfo.isCI && _ciinfo.name || null,
84
- nextVersion: "15.2.0-canary.75"
84
+ nextVersion: "15.2.0-canary.76"
85
85
  };
86
86
  return traits;
87
87
  }
@@ -11,11 +11,11 @@ Object.defineProperty(exports, "eventCliSessionStopped", {
11
11
  const EVENT_VERSION = 'NEXT_CLI_SESSION_STOPPED';
12
12
  function eventCliSessionStopped(event) {
13
13
  // This should be an invariant, if it fails our build tooling is broken.
14
- if (typeof "15.2.0-canary.75" !== 'string') {
14
+ if (typeof "15.2.0-canary.76" !== 'string') {
15
15
  return [];
16
16
  }
17
17
  const payload = {
18
- nextVersion: "15.2.0-canary.75",
18
+ nextVersion: "15.2.0-canary.76",
19
19
  nodeVersion: process.version,
20
20
  cliCommand: event.cliCommand,
21
21
  durationMilliseconds: event.durationMilliseconds,
@@ -36,12 +36,12 @@ function hasBabelConfig(dir) {
36
36
  function eventCliSession(dir, nextConfig, event) {
37
37
  var _nextConfig_experimental_staleTimes, _nextConfig_experimental_staleTimes1, _nextConfig_experimental_reactCompiler, _nextConfig_experimental_reactCompiler1;
38
38
  // This should be an invariant, if it fails our build tooling is broken.
39
- if (typeof "15.2.0-canary.75" !== 'string') {
39
+ if (typeof "15.2.0-canary.76" !== 'string') {
40
40
  return [];
41
41
  }
42
42
  const { images, i18n } = nextConfig || {};
43
43
  const payload = {
44
- nextVersion: "15.2.0-canary.75",
44
+ nextVersion: "15.2.0-canary.76",
45
45
  nodeVersion: process.version,
46
46
  cliCommand: event.cliCommand,
47
47
  isSrcDir: event.isSrcDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next",
3
- "version": "15.2.0-canary.75",
3
+ "version": "15.2.0-canary.76",
4
4
  "description": "The React Framework",
5
5
  "main": "./dist/server/next.js",
6
6
  "license": "MIT",
@@ -100,7 +100,7 @@
100
100
  ]
101
101
  },
102
102
  "dependencies": {
103
- "@next/env": "15.2.0-canary.75",
103
+ "@next/env": "15.2.0-canary.76",
104
104
  "@swc/counter": "0.1.3",
105
105
  "@swc/helpers": "0.5.15",
106
106
  "busboy": "1.6.0",
@@ -132,14 +132,14 @@
132
132
  },
133
133
  "optionalDependencies": {
134
134
  "sharp": "^0.33.5",
135
- "@next/swc-darwin-arm64": "15.2.0-canary.75",
136
- "@next/swc-darwin-x64": "15.2.0-canary.75",
137
- "@next/swc-linux-arm64-gnu": "15.2.0-canary.75",
138
- "@next/swc-linux-arm64-musl": "15.2.0-canary.75",
139
- "@next/swc-linux-x64-gnu": "15.2.0-canary.75",
140
- "@next/swc-linux-x64-musl": "15.2.0-canary.75",
141
- "@next/swc-win32-arm64-msvc": "15.2.0-canary.75",
142
- "@next/swc-win32-x64-msvc": "15.2.0-canary.75"
135
+ "@next/swc-darwin-arm64": "15.2.0-canary.76",
136
+ "@next/swc-darwin-x64": "15.2.0-canary.76",
137
+ "@next/swc-linux-arm64-gnu": "15.2.0-canary.76",
138
+ "@next/swc-linux-arm64-musl": "15.2.0-canary.76",
139
+ "@next/swc-linux-x64-gnu": "15.2.0-canary.76",
140
+ "@next/swc-linux-x64-musl": "15.2.0-canary.76",
141
+ "@next/swc-win32-arm64-msvc": "15.2.0-canary.76",
142
+ "@next/swc-win32-x64-msvc": "15.2.0-canary.76"
143
143
  },
144
144
  "devDependencies": {
145
145
  "@ampproject/toolbox-optimizer": "2.8.3",
@@ -172,21 +172,21 @@
172
172
  "@jest/types": "29.5.0",
173
173
  "@mswjs/interceptors": "0.23.0",
174
174
  "@napi-rs/triples": "1.2.0",
175
- "@next/font": "15.2.0-canary.75",
176
- "@next/polyfill-module": "15.2.0-canary.75",
177
- "@next/polyfill-nomodule": "15.2.0-canary.75",
178
- "@next/react-refresh-utils": "15.2.0-canary.75",
179
- "@next/swc": "15.2.0-canary.75",
175
+ "@next/font": "15.2.0-canary.76",
176
+ "@next/polyfill-module": "15.2.0-canary.76",
177
+ "@next/polyfill-nomodule": "15.2.0-canary.76",
178
+ "@next/react-refresh-utils": "15.2.0-canary.76",
179
+ "@next/swc": "15.2.0-canary.76",
180
180
  "@opentelemetry/api": "1.6.0",
181
181
  "@playwright/test": "1.41.2",
182
- "@storybook/addon-a11y": "8.5.2",
183
- "@storybook/addon-essentials": "8.5.2",
184
- "@storybook/addon-interactions": "8.5.2",
185
- "@storybook/addon-webpack5-compiler-swc": "^1.0.5",
186
- "@storybook/blocks": "8.5.2",
187
- "@storybook/react": "8.5.2",
188
- "@storybook/react-webpack5": "8.5.2",
189
- "@storybook/test": "8.5.2",
182
+ "@storybook/addon-a11y": "8.6.0",
183
+ "@storybook/addon-essentials": "8.6.0",
184
+ "@storybook/addon-interactions": "8.6.0",
185
+ "@storybook/addon-webpack5-compiler-swc": "1.0.5",
186
+ "@storybook/blocks": "8.6.0",
187
+ "@storybook/react": "8.6.0",
188
+ "@storybook/react-webpack5": "8.6.0",
189
+ "@storybook/test": "8.6.0",
190
190
  "@storybook/test-runner": "0.21.0",
191
191
  "@swc/core": "1.9.3",
192
192
  "@swc/types": "0.1.7",
@@ -327,7 +327,7 @@
327
327
  "source-map-loader": "5.0.0",
328
328
  "source-map08": "npm:source-map@0.8.0-beta.0",
329
329
  "stacktrace-parser": "0.1.10",
330
- "storybook": "8.5.2",
330
+ "storybook": "8.6.0",
331
331
  "stream-browserify": "3.0.0",
332
332
  "stream-http": "3.1.1",
333
333
  "strict-event-emitter": "0.5.0",