Repository: remix-run/remix
Pull request #6552 (2023-06-06 22:38:28)

chore: use long version numbers
This can prevent confusion like https://github.com/remix-run/remix/pull/6428#issuecomment-1579534404

---

Same as #6551, but for `dev` branch

changeset-bot[bot]: ###  ⚠️  No Changeset found

Latest commit: 3c54846bce01d16612fe7638010f7b65cb5379d6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. **If these changes should result in a version bump, you need to add a changeset.**

<details><summary>This PR includes no changesets</summary>

  When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

</details>

[Click here to learn what changesets are, and how to add one](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md).

[Click here if you're a maintainer who wants to add a changeset to this PR](https://github.com/MichaelDeBoey/remix/new/use-long-version-numbers-dev?filename=.changeset/funny-elephants-laugh.md&value=---%0A%22create-remix%22%3A%20patch%0A%22remix%22%3A%20patch%0A%22%40remix-run%2Farchitect%22%3A%20patch%0A%22%40remix-run%2Fcloudflare%22%3A%20patch%0A%22%40remix-run%2Fcloudflare-pages%22%3A%20patch%0A%22%40remix-run%2Fcloudflare-workers%22%3A%20patch%0A%22%40remix-run%2Fcss-bundle%22%3A%20patch%0A%22%40remix-run%2Fdeno%22%3A%20patch%0A%22%40remix-run%2Fdev%22%3A%20patch%0A%22%40remix-run%2Fexpress%22%3A%20patch%0A%22%40remix-run%2Fnetlify%22%3A%20patch%0A%22%40remix-run%2Fnode%22%3A%20patch%0A%22%40remix-run%2Freact%22%3A%20patch%0A%22%40remix-run%2Fserve%22%3A%20patch%0A%22%40remix-run%2Fserver-runtime%22%3A%20patch%0A%22%40remix-run%2Ftesting%22%3A%20patch%0A%22%40remix-run%2Fvercel%22%3A%20patch%0A---%0A%0Achore%3A%20use%20long%20version%20numbers%0A)



Patch:
diff --git a/.changeset/two-cobras-float.md b/.changeset/two-cobras-float.md
new file mode 100644
index 000000000..108d59b76
--- /dev/null
+++ b/.changeset/two-cobras-float.md
@@ -0,0 +1,5 @@
+---
+"@remix-run/react": patch
+---
+
+properly pass <Scripts /> props to inline script tags for deferred data
diff --git a/contributors.yml b/contributors.yml
index 3b4b2514c..cc11f989e 100644
--- a/contributors.yml
+++ b/contributors.yml
@@ -214,6 +214,7 @@
 - jacargentina
 - jacob-ebey
 - JacobParis
+- jack-r-warren
 - jakeginnivan
 - jakewtaylor
 - jamiebuilds
diff --git a/package.json b/package.json
index ed05ce081..2a19ece7d 100644
--- a/package.json
+++ b/package.json
@@ -138,6 +138,6 @@
     "unist-util-visit": "^4.1.1"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   }
 }
diff --git a/packages/create-remix/package.json b/packages/create-remix/package.json
index a01526c02..e56e969c7 100644
--- a/packages/create-remix/package.json
+++ b/packages/create-remix/package.json
@@ -20,7 +20,7 @@
     "@remix-run/dev": "1.17.0"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",
diff --git a/packages/remix-architect/package.json b/packages/remix-architect/package.json
index 12568ada0..28b6bbc25 100644
--- a/packages/remix-architect/package.json
+++ b/packages/remix-architect/package.json
@@ -23,7 +23,7 @@
     "lambda-tester": "^4.0.1"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",
diff --git a/packages/remix-cloudflare-pages/package.json b/packages/remix-cloudflare-pages/package.json
index b0151a767..21731f72d 100644
--- a/packages/remix-cloudflare-pages/package.json
+++ b/packages/remix-cloudflare-pages/package.json
@@ -25,7 +25,7 @@
     "@cloudflare/workers-types": "^3.0.0"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",
diff --git a/packages/remix-cloudflare-workers/package.json b/packages/remix-cloudflare-workers/package.json
index 0a448adac..22a2f72ba 100644
--- a/packages/remix-cloudflare-workers/package.json
+++ b/packages/remix-cloudflare-workers/package.json
@@ -25,7 +25,7 @@
     "@cloudflare/workers-types": "^2.0.0 || ^3.0.0"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",
diff --git a/packages/remix-cloudflare/package.json b/packages/remix-cloudflare/package.json
index 551e23a36..bb890880a 100644
--- a/packages/remix-cloudflare/package.json
+++ b/packages/remix-cloudflare/package.json
@@ -24,7 +24,7 @@
     "@cloudflare/workers-types": "^2.0.0 || ^3.0.0"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",
diff --git a/packages/remix-css-bundle/package.json b/packages/remix-css-bundle/package.json
index b2b14f47d..bc466e66d 100644
--- a/packages/remix-css-bundle/package.json
+++ b/packages/remix-css-bundle/package.json
@@ -14,5 +14,8 @@
   "license": "MIT",
   "main": "./dist/index.js",
   "module": "./dist/esm/index.js",
-  "typings": "./dist/index.d.ts"
+  "typings": "./dist/index.d.ts",
+  "engines": {
+    "node": ">=14.0.0"
+  }
 }
diff --git a/packages/remix-deno/package.json b/packages/remix-deno/package.json
index a430a0249..7d11d2b6c 100644
--- a/packages/remix-deno/package.json
+++ b/packages/remix-deno/package.json
@@ -19,6 +19,6 @@
     "mime": "^3.0.0"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   }
 }
diff --git a/packages/remix-dev/package.json b/packages/remix-dev/package.json
index 108db8c11..ec314a579 100644
--- a/packages/remix-dev/package.json
+++ b/packages/remix-dev/package.json
@@ -102,7 +102,7 @@
     }
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",
diff --git a/packages/remix-express/package.json b/packages/remix-express/package.json
index 80e7f90ec..985154066 100644
--- a/packages/remix-express/package.json
+++ b/packages/remix-express/package.json
@@ -27,7 +27,7 @@
     "express": "^4.17.1"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",
diff --git a/packages/remix-netlify/package.json b/packages/remix-netlify/package.json
index 113f69824..3151d0b2d 100644
--- a/packages/remix-netlify/package.json
+++ b/packages/remix-netlify/package.json
@@ -23,7 +23,7 @@
     "@netlify/functions": "^0.10.0 || ^0.11.0 || ^1.0.0"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",
diff --git a/packages/remix-node/package.json b/packages/remix-node/package.json
index 51194e9c6..f7b3f0701 100644
--- a/packages/remix-node/package.json
+++ b/packages/remix-node/package.json
@@ -32,7 +32,7 @@
     "@types/source-map-support": "^0.5.4"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",
diff --git a/packages/remix-react/components.tsx b/packages/remix-react/components.tsx
index 17fbe9313..b0c9393db 100644
--- a/packages/remix-react/components.tsx
+++ b/packages/remix-react/components.tsx
@@ -950,6 +950,7 @@ export function Scripts(props: ScriptProps) {
                       deferredData={deferredData}
                       routeId={routeId}
                       dataKey={key}
+                      scriptProps={props}
                     />
                   );
 
@@ -1048,7 +1049,9 @@ import(${JSON.stringify(manifest.entry.module)});`;
 
   if (!isStatic && typeof __remixContext === "object" && __remixContext.a) {
     for (let i = 0; i < __remixContext.a; i++) {
-      deferredScripts.push(<DeferredHydrationScript key={i} />);
+      deferredScripts.push(
+        <DeferredHydrationScript key={i} scriptProps={props} />
+      );
     }
   }
 
@@ -1102,10 +1105,12 @@ function DeferredHydrationScript({
   dataKey,
   deferredData,
   routeId,
+  scriptProps,
 }: {
   dataKey?: string;
   deferredData?: DeferredData;
   routeId?: string;
+  scriptProps?: ScriptProps;
 }) {
   if (typeof document === "undefined" && deferredData && dataKey && routeId) {
     invariant(
@@ -1125,6 +1130,7 @@ function DeferredHydrationScript({
         dataKey &&
         routeId ? null : (
           <script
+            {...scriptProps}
             async
             suppressHydrationWarning
             dangerouslySetInnerHTML={{ __html: " " }}
@@ -1136,10 +1142,15 @@ function DeferredHydrationScript({
         <Await
           resolve={deferredData.data[dataKey]}
           errorElement={
-            <ErrorDeferredHydrationScript dataKey={dataKey} routeId={routeId} />
+            <ErrorDeferredHydrationScript
+              dataKey={dataKey}
+              routeId={routeId}
+              scriptProps={scriptProps}
+            />
           }
           children={(data) => (
             <script
+              {...scriptProps}
               async
               suppressHydrationWarning
               dangerouslySetInnerHTML={{
@@ -1154,6 +1165,7 @@ function DeferredHydrationScript({
         />
       ) : (
         <script
+          {...scriptProps}
           async
           suppressHydrationWarning
           dangerouslySetInnerHTML={{ __html: " " }}
@@ -1166,9 +1178,11 @@ function DeferredHydrationScript({
 function ErrorDeferredHydrationScript({
   dataKey,
   routeId,
+  scriptProps,
 }: {
   dataKey: string;
   routeId: string;
+  scriptProps?: ScriptProps;
 }) {
   let error = useAsyncError() as Error;
   let toSerialize: { message: string; stack?: string } =
@@ -1184,6 +1198,7 @@ function ErrorDeferredHydrationScript({
 
   return (
     <script
+      {...scriptProps}
       suppressHydrationWarning
       dangerouslySetInnerHTML={{
         __html: `__remixContext.r(${JSON.stringify(routeId)}, ${JSON.stringify(
diff --git a/packages/remix-react/package.json b/packages/remix-react/package.json
index 17b9da568..398315234 100644
--- a/packages/remix-react/package.json
+++ b/packages/remix-react/package.json
@@ -29,11 +29,11 @@
     "react-dom": "^18.2.0"
   },
   "peerDependencies": {
-    "react": ">=16.8",
-    "react-dom": ">=16.8"
+    "react": ">=16.8.0",
+    "react-dom": ">=16.8.0"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",
diff --git a/packages/remix-serve/package.json b/packages/remix-serve/package.json
index 8e1287f2d..3d2d9d004 100644
--- a/packages/remix-serve/package.json
+++ b/packages/remix-serve/package.json
@@ -29,7 +29,7 @@
     "@types/morgan": "^1.9.2"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",
diff --git a/packages/remix-server-runtime/package.json b/packages/remix-server-runtime/package.json
index 587593af7..a89491478 100644
--- a/packages/remix-server-runtime/package.json
+++ b/packages/remix-server-runtime/package.json
@@ -28,7 +28,7 @@
     "@types/set-cookie-parser": "^2.4.1"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",
diff --git a/packages/remix-vercel/package.json b/packages/remix-vercel/package.json
index 61068ef00..5bc572ade 100644
--- a/packages/remix-vercel/package.json
+++ b/packages/remix-vercel/package.json
@@ -26,7 +26,7 @@
     "@vercel/node": "^1.8.3 || ^2.4.0"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",
diff --git a/packages/remix/package.json b/packages/remix/package.json
index 0ef1ea725..8d60c2604 100644
--- a/packages/remix/package.json
+++ b/packages/remix/package.json
@@ -17,7 +17,7 @@
   "typings": "dist/index.d.ts",
   "module": "dist/esm/index.js",
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",


Test patch:
diff --git a/packages/remix-dev/__tests__/fixtures/cloudflare/package.json b/packages/remix-dev/__tests__/fixtures/cloudflare/package.json
index c641fb788..f23eaae66 100644
--- a/packages/remix-dev/__tests__/fixtures/cloudflare/package.json
+++ b/packages/remix-dev/__tests__/fixtures/cloudflare/package.json
@@ -31,6 +31,6 @@
     "wrangler": "^2.2.1"
   },
   "engines": {
-    "node": ">=16.13"
+    "node": ">=16.13.0"
   }
 }
diff --git a/packages/remix-dev/__tests__/fixtures/deno/package.json b/packages/remix-dev/__tests__/fixtures/deno/package.json
index 6bca35275..9ee2f64af 100644
--- a/packages/remix-dev/__tests__/fixtures/deno/package.json
+++ b/packages/remix-dev/__tests__/fixtures/deno/package.json
@@ -25,6 +25,6 @@
     "npm-run-all": "^4.1.5"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   }
 }
diff --git a/packages/remix-dev/__tests__/fixtures/indie-stack/package.json b/packages/remix-dev/__tests__/fixtures/indie-stack/package.json
index 546308862..c456c8d98 100644
--- a/packages/remix-dev/__tests__/fixtures/indie-stack/package.json
+++ b/packages/remix-dev/__tests__/fixtures/indie-stack/package.json
@@ -19,6 +19,6 @@
     "typescript": "^5.0.4"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   }
 }
diff --git a/packages/remix-dev/__tests__/fixtures/node/package.json b/packages/remix-dev/__tests__/fixtures/node/package.json
index 5ae857457..7af91dfb3 100644
--- a/packages/remix-dev/__tests__/fixtures/node/package.json
+++ b/packages/remix-dev/__tests__/fixtures/node/package.json
@@ -24,6 +24,6 @@
     "typescript": "^5.0.4"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   }
 }
diff --git a/packages/remix-dev/__tests__/fixtures/replace-remix-magic-imports/package.json b/packages/remix-dev/__tests__/fixtures/replace-remix-magic-imports/package.json
index db097f595..cb37f4843 100644
--- a/packages/remix-dev/__tests__/fixtures/replace-remix-magic-imports/package.json
+++ b/packages/remix-dev/__tests__/fixtures/replace-remix-magic-imports/package.json
@@ -61,7 +61,7 @@
     "vitest": "^0.7.4"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "prisma": {
     "seed": "node --require esbuild-register prisma/seed.ts"
diff --git a/packages/remix-dev/__tests__/fixtures/stack/package.json b/packages/remix-dev/__tests__/fixtures/stack/package.json
index 3ab75a6c5..839ecf39c 100644
--- a/packages/remix-dev/__tests__/fixtures/stack/package.json
+++ b/packages/remix-dev/__tests__/fixtures/stack/package.json
@@ -10,6 +10,6 @@
   "dependencies": {},
   "devDependencies": {},
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   }
 }
diff --git a/packages/remix-react/__tests__/deferred-scripts-test.tsx b/packages/remix-react/__tests__/deferred-scripts-test.tsx
new file mode 100644
index 000000000..082377ecc
--- /dev/null
+++ b/packages/remix-react/__tests__/deferred-scripts-test.tsx
@@ -0,0 +1,102 @@
+import * as React from "react";
+import { createMemoryRouter } from "react-router-dom";
+import { defer } from "react-router-dom";
+import { StaticRouterProvider } from "react-router-dom/server";
+import { render } from "@testing-library/react";
+import type { EntryContext } from "@remix-run/server-runtime";
+
+import { Scripts, RemixContext } from "../components";
+
+import "@testing-library/jest-dom/extend-expect";
+
+/**
+ * Don't try to add additional tests for <Scripts /> to this file!
+ *
+ * <Scripts /> gates most of its functionality on the **unexported**
+ * variable isHydrated, defined inside ../components, and it sets that
+ * variable the first time it is rendered. This means that subsequent
+ * calls to <Scripts /> will skip writing actual script tags.
+ *
+ * Using jest.resetModules() or .isolateModules() won't help here as
+ * we'd need to re-import or re-require [1]. Re-importing would need new
+ * packages to work [2] and re-requiring has problems with React [3].
+ *
+ * [1]: https://github.com/jestjs/jest/issues/3236
+ * [2]: https://github.com/jestjs/jest/issues/3236#issuecomment-698271251
+ * [3]: https://github.com/jestjs/jest/issues/11471
+ */
+
+describe("<Scripts /> with activeDeferreds", () => {
+  it("should pass custom props", () => {
+    let context: EntryContext = {
+      routeModules: { root: { default: () => null } },
+      manifest: {
+        routes: {
+          root: {
+            hasLoader: false,
+            hasAction: false,
+            hasCatchBoundary: false,
+            hasErrorBoundary: false,
+            id: "root",
+            module: "root.js",
+          },
+        },
+        entry: { imports: [], module: "" },
+        url: "",
+        version: "",
+      },
+      // @ts-expect-error
+      // Enumerating all flags just to set them to false is overly brittle;
+      // we allow an empty object as a shortcut.
+      future: {},
+      // @ts-expect-error
+      // Similarly, we have no interest in the rest of the static handler
+      // context. We're not trying to write a test for React Router, we
+      // just want to trick <Scripts /> into thinking there's a need for
+      // deferred scripts. We'll look for "key with a promise" to check that
+      // this isn't being ignored.
+      staticHandlerContext: {
+        activeDeferreds: {
+          "/": defer({
+            "key with a promise": new Promise((resolve) => resolve("value")),
+          }),
+        },
+      },
+    };
+
+    let router = createMemoryRouter([
+      {
+        id: "root",
+        path: "/",
+        element: <Scripts nonce="some nonce" />,
+      },
+    ]);
+
+    let { container } = render(
+      <RemixContext.Provider value={context}>
+        <StaticRouterProvider
+          router={router}
+          context={context.staticHandlerContext}
+          // We're testing <Scripts />, but <StaticRouterProvider /> can insert
+          // its own script tags too, so we pass it the same nonce prop so our
+          // check for "do all script tags have the nonce prop" still works.
+          nonce="some nonce"
+        />
+      </RemixContext.Provider>
+    );
+
+    let scriptElements = Array.from(container.getElementsByTagName("script"));
+
+    // Confirm that activeDeferreds is being handled
+    expect(
+      scriptElements.filter((elem) =>
+        elem.innerHTML.includes("key with a promise")
+      ).length
+    ).toBeGreaterThan(0);
+
+    // Test that all script tags have the additional nonce prop
+    scriptElements.forEach((elem) =>
+      expect(elem).toHaveAttribute("nonce", "some nonce")
+    );
+  });
+});
diff --git a/packages/remix-testing/package.json b/packages/remix-testing/package.json
index cc2b018ca..f7ca2fb7c 100644
--- a/packages/remix-testing/package.json
+++ b/packages/remix-testing/package.json
@@ -33,7 +33,7 @@
     "react": "^17.0.0 || ^18.0.0"
   },
   "engines": {
-    "node": ">=14"
+    "node": ">=14.0.0"
   },
   "files": [
     "dist/",