@tinvar/renderer 0.4.13 → 0.4.14

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.
@@ -42,7 +42,7 @@ const [socketPath, appRoot] = positional;
42
42
  const port = Number(option('port'));
43
43
  if (!socketPath || !appRoot || !Number.isInteger(port) || port < 1 || port > 65535) {
44
44
  console.error(
45
- 'usage: dev-renderer.js <socket-path> <app-root> --port=N [--deferred=FILE] [--public-host=NAME] [--codec=msgpack|json-lines] [--exit-with-stdin]',
45
+ 'usage: dev-renderer.js <socket-path> <app-root> --port=N [--deferred=FILE] [--public-host=NAME[,NAME...]] [--codec=msgpack|json-lines] [--exit-with-stdin]',
46
46
  );
47
47
  process.exit(64);
48
48
  }
@@ -88,7 +88,7 @@ try {
88
88
  port,
89
89
  deferredManifest: option('deferred') ? path.resolve(option('deferred')) : null,
90
90
  // A tunnel's name, which serve --dev's Caddyfile lets in (ADR 0190).
91
- publicHost: option('public-host') ?? null,
91
+ publicHosts: (option('public-host') ?? '').split(',').filter((name) => name !== ''),
92
92
  });
93
93
  } catch (error) {
94
94
  console.error(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinvar/renderer",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "src",
package/src/dev-server.js CHANGED
@@ -55,11 +55,11 @@ function configFileOf(appRoot) {
55
55
  * Starts Vite's dev server on loopback for the app at `appRoot`, and points
56
56
  * the renderer's dev entry at its rsc environment.
57
57
  *
58
- * @param {{ appRoot: string, port: number, host?: string, deferredManifest?: string | null, publicHost?: string | null, logLevel?: string }} options
58
+ * @param {{ appRoot: string, port: number, host?: string, deferredManifest?: string | null, publicHosts?: string[], logLevel?: string }} options
59
59
  * `deferredManifest` is where to keep the views' <Deferred> components
60
60
  * up to date, as the build's deferredBoundaries() writes them;
61
- * `publicHost` the one name a tunnel serves the app under, which
62
- * Vite's host check lets in beside loopback's (ADR 0190)
61
+ * `publicHosts` the names a tunnel serves the app under, which
62
+ * Vite's host check lets in beside loopback's (ADR 0190, 0195)
63
63
  * @returns {Promise<{ vite: any, url: string, close: () => Promise<void> }>}
64
64
  */
65
65
  export async function createDevServer({
@@ -67,7 +67,7 @@ export async function createDevServer({
67
67
  port,
68
68
  host = '127.0.0.1',
69
69
  deferredManifest = null,
70
- publicHost = null,
70
+ publicHosts = [],
71
71
  logLevel,
72
72
  }) {
73
73
  assertDevelopment();
@@ -124,8 +124,8 @@ export async function createDevServer({
124
124
  port,
125
125
  strictPort: true,
126
126
  // Vite answers loopback's names alone, against DNS rebinding, as the
127
- // Caddyfile in front of it does; a tunnel's one name besides.
128
- ...(publicHost ? { allowedHosts: [publicHost] } : {}),
127
+ // Caddyfile in front of it does; a tunnel's names besides.
128
+ ...(publicHosts.length > 0 ? { allowedHosts: [...publicHosts] } : {}),
129
129
  fs: {
130
130
  // Vite's own refusals, and the secrets an app keeps beside its code:
131
131
  // a key file, a database, the PHP dependencies.