rsnext/packages/next/shared/lib
Shu Ding e933e1d211
Load beforeInteractive scripts properly without blocking hydration (#41164)
This PR ensures that for the app directory, `beforeInteractive`, `afterInteractive` and `lazyOnload` scripts via `next/script` are properly supported.

For both `beforeInteractive` and `afterInteractive` scripts, a preload link tag needs to be injected by Float. For `beforeInteractive` scripts and Next.js' polyfills, they need to be manually executed in order before starting the Next.js' runtime, without blocking the downloading of HTML and other scripts.

This PR doesn't include the `worker` type of scripts yet.

Note: in this PR I changed the inlined flight data `__next_s` to `__next_f`, and use `__next_s` for scripts data, because I can't find a better name for `next/script` that is also short at the same time.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-09 15:08:51 +00:00
..
i18n Enable @typescript-eslint/no-use-before-define for functions (#39602) 2022-08-15 10:29:51 -04:00
isomorphic polish isomorphic path module (#36521) 2022-04-27 18:23:26 +00:00
page-path Bypass empty pages folder for layouts (#40132) 2022-09-03 00:13:47 +00:00
router Update to use HEAD request for middleware query hydration (#40973) 2022-09-28 07:37:45 +00:00
amp-context.ts
amp-mode.ts Fix bloat in main bundle from amp (#37383) 2022-06-02 00:21:09 +00:00
amp.ts Fix bloat in main bundle from amp (#37383) 2022-06-02 00:21:09 +00:00
app-router-context.ts Update app-router options type (#40862) 2022-09-23 16:32:41 -07:00
constants.ts Adding experimental size adjust based option (#41009) 2022-09-30 00:35:50 +00:00
dynamic.tsx Alias next/dynamic to lazy impl for appDir (#41216) 2022-10-06 17:41:27 +02:00
escape-regexp.ts perf(escapeStringRegexp): test before replace (#34472) 2022-04-16 05:42:10 +00:00
flatten.ts Refactor Page Paths utils and Middleware Plugin (#36576) 2022-04-30 11:19:27 +00:00
get-hostname.ts Execute middleware on Next.js internal requests (#37121) 2022-05-27 13:29:04 -05:00
head-manager-context.ts Load beforeInteractive scripts properly without blocking hydration (#41164) 2022-10-09 15:08:51 +00:00
head.tsx Implement SWC transformer for server and client graphs (#40603) 2022-09-17 00:12:59 +02:00
html-context.ts Add support for font loaders (#40746) 2022-09-21 22:12:59 -07:00
image-blur-svg.ts Update next/future/image to use svg blur placeholder during next dev (#39992) 2022-08-29 17:19:39 -05:00
image-config-context.ts fix: make sure image-config gets transpiled (#34677) 2022-02-22 09:27:18 -05:00
image-config.ts Update to stable: next/future/image, remotePatterns, unoptimized (#40142) 2022-08-31 22:44:17 +00:00
is-plain-object.ts Use Edge Runtime for running Edge Functions locally (#37024) 2022-05-30 12:01:36 +00:00
loadable-context.ts
loadable.d.ts
loadable.js Preload chunks for next/dynamic in suspense mode (#37245) 2022-05-27 20:11:34 +00:00
match-remote-pattern.ts Fix experimental remotePatterns wildcard (#37137) 2022-05-25 20:25:06 +00:00
mitt.ts
router-context.ts Add new target for middleware (#30299) 2021-10-26 18:50:56 +02:00
runtime-config.ts
server-inserted-html.tsx rename flush effects to server inserted html (#41073) 2022-10-03 13:43:35 +00:00
side-effect.tsx Upgrade typescript to 4.8.2 (#39979) 2022-08-29 16:56:02 +00:00
styled-jsx.d.ts Remove precopied styled-jsx (#39520) 2022-08-12 17:08:38 +00:00
styled-jsx.js Remove precopied styled-jsx (#39520) 2022-08-12 17:08:38 +00:00
utils.ts add attribution to web vitals (#39368) 2022-10-04 00:17:30 +00:00