@remix-run/cli 0.4.0 → 0.5.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix-run/cli",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Command-line interface for Remix",
5
5
  "author": "Michael Jackson <mjijackson@gmail.com>",
6
6
  "license": "MIT",
@@ -34,10 +34,10 @@
34
34
  "jsonc-parser": "^3.3.1",
35
35
  "semver": "^7.7.4",
36
36
  "@remix-run/data-table": "^0.4.0",
37
- "@remix-run/data-table-mysql": "^0.5.0",
37
+ "@remix-run/data-table-postgres": "^0.5.0",
38
38
  "@remix-run/data-table-sqlite": "^0.6.0",
39
+ "@remix-run/data-table-mysql": "^0.5.0",
39
40
  "@remix-run/terminal": "^0.1.1",
40
- "@remix-run/data-table-postgres": "^0.5.0",
41
41
  "@remix-run/test": "^0.6.0"
42
42
  },
43
43
  "devDependencies": {
@@ -84,7 +84,7 @@ let entryPreloads = await assetServer.getPreloads('app/actions/public/entry.ts')
84
84
 
85
85
  Use this when rendering documents or layouts that boot browser behavior with a known client entry.
86
86
 
87
- When resolving hydrated client entries during server rendering, pass the source entry ID from `clientEntry(import.meta.url, ...)` to `getHref()` inside `resolveClientEntry`. Keep export-name resolution in that render helper, and avoid hard-coding public asset URLs in source-owned component modules.
87
+ When resolving hydrated client entries during server rendering, pass the source entry ID from `clientEntry(import.meta.url, ...)` to `getHref()` and `getPreloads()` inside `resolveClientEntry`. Return those preload hrefs through the entry's `preloads` property so the browser can fetch the module graph without walking it serially. Keep this resolution in the shared render helper rather than hard-coding public asset URLs in source-owned component modules.
88
88
 
89
89
  ## Development vs Deployment
90
90
 
@@ -76,9 +76,15 @@ let stream = renderToStream(<App />, {
76
76
  throw new Error(`Unable to resolve client entry export for ${entryId}`)
77
77
  }
78
78
 
79
+ let [href, preloads] = await Promise.all([
80
+ assetServer.getHref(entryId),
81
+ assetServer.getPreloads(entryId),
82
+ ])
83
+
79
84
  return {
80
- href: await assetServer.getHref(entryId),
85
+ href,
81
86
  exportName,
87
+ preloads,
82
88
  }
83
89
  },
84
90
  })
@@ -90,6 +96,8 @@ On the server, `clientEntry` components render like any other component. The ser
90
96
 
91
97
  Client entry props must be serializable: strings, numbers, booleans, `null`, `undefined`, plain objects/arrays of the above, JSX elements, and `<Frame>` elements. Functions and class instances cannot be passed.
92
98
 
99
+ The resolved `preloads` array contains browser module hrefs. During server rendering these are emitted as `<link rel="modulepreload">` tags, including preloads discovered in blocking frames. When a later frame response introduces a client entry, its preloads start before the entry module is loaded.
100
+
93
101
  ## Booting the Client
94
102
 
95
103
  Use `run` to start the client runtime. It scans the document for client entry markers, loads modules, and hydrates each one:
@@ -16,7 +16,7 @@ export function render() {
16
16
  frameSrc: request.url,
17
17
  signal: request.signal,
18
18
  resolveFrame: (src) => resolveFrame(router, request, src),
19
- // Server rendering turns client entries into browser module URLs.
19
+ // Server rendering turns client entries into browser module URLs and preloads.
20
20
  async resolveClientEntry(entryId, component) {
21
21
  if (!entryId.startsWith('file://')) {
22
22
  throw new Error(
@@ -24,9 +24,15 @@ export function render() {
24
24
  )
25
25
  }
26
26
 
27
+ let [href, preloads] = await Promise.all([
28
+ assetServer.getHref(entryId),
29
+ assetServer.getPreloads(entryId),
30
+ ])
31
+
27
32
  return {
28
- href: await assetServer.getHref(entryId),
33
+ href,
29
34
  exportName: entryId.split('#')[1] || component.name || titleCaseFileName(entryId),
35
+ preloads,
30
36
  }
31
37
  },
32
38
  })