vite-react-ssg 0.6.1 → 0.6.2

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/README.md CHANGED
@@ -4,6 +4,8 @@ Static-site generation for React on Vite.
4
4
 
5
5
  See demo(also document): [docs](https://vite-react-ssg.netlify.app/)
6
6
 
7
+ **🎈 Support for [`@tanstack/router`](https://tanstack.com/router/latest/docs/framework/react/overview) and [`wouter`](https://github.com/molefrog/wouter) is in progress!**
8
+
7
9
  [![NPM version](https://img.shields.io/npm/v/vite-react-ssg?color=a1b858&label=)](https://www.npmjs.com/package/vite-react-ssg)
8
10
 
9
11
  # Table of contents
@@ -528,10 +530,6 @@ export default {
528
530
  }
529
531
  ```
530
532
 
531
- ### Https
532
-
533
- If you set `https` to true in Vite, we will by default use `devcert` to generate a local HTTPS service for you. Of course, if you pass in your own custom https parameters, we will also help you pass them through to the Express server.
534
-
535
533
  ```ts
536
534
  export default defineConfig({
537
535
  server: {
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.d734eb79.cjs';
3
- export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.d734eb79.cjs';
2
+ import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.870c683b.cjs';
3
+ export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.870c683b.cjs';
4
4
  export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.faf3855a.cjs';
5
5
  import 'critters';
6
6
  import 'react-router-dom';
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.d734eb79.mjs';
3
- export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.d734eb79.mjs';
2
+ import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.870c683b.mjs';
3
+ export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.870c683b.mjs';
4
4
  export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.faf3855a.mjs';
5
5
  import 'critters';
6
6
  import 'react-router-dom';
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.d734eb79.js';
3
- export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.d734eb79.js';
2
+ import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.870c683b.js';
3
+ export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.870c683b.js';
4
4
  export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.faf3855a.js';
5
5
  import 'critters';
6
6
  import 'react-router-dom';
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.d734eb79.cjs';
2
- export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.d734eb79.cjs';
1
+ import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.870c683b.cjs';
2
+ export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.870c683b.cjs';
3
3
  export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.faf3855a.cjs';
4
4
  import React from 'react';
5
5
  import { LinkProps, NavLinkProps } from 'react-router-dom';
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.d734eb79.mjs';
2
- export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.d734eb79.mjs';
1
+ import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.870c683b.mjs';
2
+ export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.870c683b.mjs';
3
3
  export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.faf3855a.mjs';
4
4
  import React from 'react';
5
5
  import { LinkProps, NavLinkProps } from 'react-router-dom';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.d734eb79.js';
2
- export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.d734eb79.js';
1
+ import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.870c683b.js';
2
+ export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.870c683b.js';
3
3
  export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.faf3855a.js';
4
4
  import React from 'react';
5
5
  import { LinkProps, NavLinkProps } from 'react-router-dom';
package/dist/node/cli.cjs CHANGED
@@ -3,8 +3,8 @@
3
3
  const kolorist = require('kolorist');
4
4
  const yargs = require('yargs');
5
5
  const helpers = require('yargs/helpers');
6
- const webFetch = require('@remix-run/web-fetch');
7
6
  const node = require('../node.cjs');
7
+ const webFetch = require('@remix-run/web-fetch');
8
8
  require('node:path');
9
9
  require('node:module');
10
10
  require('fs-extra');
@@ -16,48 +16,16 @@ require('react');
16
16
  require('react-helmet-async');
17
17
  require('node:stream');
18
18
  require('react-dom/server');
19
- require('node:https');
20
- require('express');
21
- require('@childrentime/devcert');
22
19
 
23
20
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
24
21
 
25
22
  const yargs__default = /*#__PURE__*/_interopDefaultCompat(yargs);
26
23
 
27
- class NodeRequest extends webFetch.Request {
28
- constructor(info, init) {
29
- super(info, init);
30
- }
31
- get headers() {
32
- return super.headers;
33
- }
34
- clone() {
35
- return new NodeRequest(this);
36
- }
37
- }
38
- class NodeResponse extends webFetch.Response {
39
- get headers() {
40
- return super.headers;
41
- }
42
- clone() {
43
- return super.clone();
44
- }
45
- }
46
- const fetch = (info, init) => {
47
- init = {
48
- // Disable compression handling so people can return the result of a fetch
49
- // directly in the loader without messing with the Content-Encoding header.
50
- compress: false,
51
- ...init
52
- };
53
- return webFetch.fetch(info, init);
54
- };
55
-
56
24
  function installGlobals() {
57
25
  global.Headers = webFetch.Headers;
58
- global.Request = NodeRequest;
59
- global.Response = NodeResponse;
60
- global.fetch = fetch;
26
+ global.Request = webFetch.Request;
27
+ global.Response = webFetch.Response;
28
+ global.fetch = webFetch.fetch;
61
29
  global.FormData = webFetch.FormData;
62
30
  }
63
31
 
@@ -101,10 +69,13 @@ yargs__default(helpers.hideBin(process.argv)).scriptName("vite-react-ssg").usage
101
69
  alias: "b",
102
70
  type: "string",
103
71
  describe: "The base path to render"
72
+ }).option("host", {
73
+ type: "boolean",
74
+ describe: "The host to expose"
104
75
  }),
105
76
  async (args) => {
106
- const { config: configFile = void 0, ...ssgOptions } = args;
107
- await node.dev(ssgOptions, { configFile });
77
+ const { config: configFile = void 0, host, ...ssgOptions } = args;
78
+ await node.dev(ssgOptions, { configFile, server: { host } });
108
79
  }
109
80
  ).fail((msg, err, yargs2) => {
110
81
  console.error(`
package/dist/node/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { gray, bold, red, reset, underline } from 'kolorist';
2
2
  import yargs from 'yargs';
3
3
  import { hideBin } from 'yargs/helpers';
4
- import { Request, Response, fetch as fetch$1, Headers, FormData } from '@remix-run/web-fetch';
5
4
  import { build, dev } from '../node.mjs';
5
+ import { Headers, Request, Response, fetch, FormData } from '@remix-run/web-fetch';
6
6
  import 'node:path';
7
7
  import 'node:module';
8
8
  import 'fs-extra';
@@ -14,43 +14,11 @@ import 'react';
14
14
  import 'react-helmet-async';
15
15
  import 'node:stream';
16
16
  import 'react-dom/server';
17
- import 'node:https';
18
- import 'express';
19
- import '@childrentime/devcert';
20
-
21
- class NodeRequest extends Request {
22
- constructor(info, init) {
23
- super(info, init);
24
- }
25
- get headers() {
26
- return super.headers;
27
- }
28
- clone() {
29
- return new NodeRequest(this);
30
- }
31
- }
32
- class NodeResponse extends Response {
33
- get headers() {
34
- return super.headers;
35
- }
36
- clone() {
37
- return super.clone();
38
- }
39
- }
40
- const fetch = (info, init) => {
41
- init = {
42
- // Disable compression handling so people can return the result of a fetch
43
- // directly in the loader without messing with the Content-Encoding header.
44
- compress: false,
45
- ...init
46
- };
47
- return fetch$1(info, init);
48
- };
49
17
 
50
18
  function installGlobals() {
51
19
  global.Headers = Headers;
52
- global.Request = NodeRequest;
53
- global.Response = NodeResponse;
20
+ global.Request = Request;
21
+ global.Response = Response;
54
22
  global.fetch = fetch;
55
23
  global.FormData = FormData;
56
24
  }
@@ -95,10 +63,13 @@ yargs(hideBin(process.argv)).scriptName("vite-react-ssg").usage("$0 [args]").com
95
63
  alias: "b",
96
64
  type: "string",
97
65
  describe: "The base path to render"
66
+ }).option("host", {
67
+ type: "boolean",
68
+ describe: "The host to expose"
98
69
  }),
99
70
  async (args) => {
100
- const { config: configFile = void 0, ...ssgOptions } = args;
101
- await dev(ssgOptions, { configFile });
71
+ const { config: configFile = void 0, host, ...ssgOptions } = args;
72
+ await dev(ssgOptions, { configFile, server: { host } });
102
73
  }
103
74
  ).fail((msg, err, yargs2) => {
104
75
  console.error(`