vite-react-ssg 0.3.3 → 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/README.md +13 -0
- package/dist/index.d.cts +24 -0
- package/dist/index.d.mts +24 -0
- package/dist/index.d.ts +2 -2
- package/dist/node/cli.cjs +18 -4
- package/dist/node/cli.d.cts +2 -0
- package/dist/node/cli.d.mts +2 -0
- package/dist/node/cli.d.ts +1 -1
- package/dist/node/cli.mjs +16 -2
- package/dist/node.cjs +29153 -20
- package/dist/node.d.cts +11 -0
- package/dist/node.d.mts +11 -0
- package/dist/node.d.ts +1 -1
- package/dist/node.mjs +29132 -15
- package/dist/{types-3aee4b6b.d.ts → shared/vite-react-ssg.d5f23f74.d.cts} +1 -1
- package/dist/shared/vite-react-ssg.d5f23f74.d.mts +178 -0
- package/dist/shared/vite-react-ssg.d5f23f74.d.ts +178 -0
- package/dist/style-collectors/styled-components.d.cts +9 -0
- package/dist/style-collectors/styled-components.d.mts +9 -0
- package/package.json +20 -20
- package/dist/shared/vite-react-ssg.69de2462.cjs +0 -1541
- package/dist/shared/vite-react-ssg.f8eacfb1.mjs +0 -1532
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ See demo(also document): [docs](https://vite-react-ssg.netlify.app/)
|
|
|
19
19
|
* [Critical CSS](#critical-css)
|
|
20
20
|
* [Configuration](#configuration)
|
|
21
21
|
* [Custom Routes to Render](#custom-routes-to-render)
|
|
22
|
+
* [Https](#https)
|
|
22
23
|
* [Use CSR in development environment](#use-csr-in-development-environment)
|
|
23
24
|
* [Roadmap](#roadmap)
|
|
24
25
|
* [Credits](#credits)
|
|
@@ -438,6 +439,18 @@ export default {
|
|
|
438
439
|
}
|
|
439
440
|
```
|
|
440
441
|
|
|
442
|
+
### Https
|
|
443
|
+
|
|
444
|
+
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.
|
|
445
|
+
|
|
446
|
+
```ts
|
|
447
|
+
export default defineConfig({
|
|
448
|
+
server: {
|
|
449
|
+
https: true,
|
|
450
|
+
},
|
|
451
|
+
})
|
|
452
|
+
```
|
|
453
|
+
|
|
441
454
|
## Use CSR in development environment
|
|
442
455
|
|
|
443
456
|
If you want to use CSR during development, just:
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { R as RouterOptions, a as ViteReactSSGContext, b as ViteReactSSGClientOptions } from './shared/vite-react-ssg.d5f23f74.cjs';
|
|
2
|
+
export { I as IndexRouteRecord, N as NonIndexRouteRecord, c as RouteRecord, S as StyleCollector, V as ViteReactSSGOptions } from './shared/vite-react-ssg.d5f23f74.cjs';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
|
+
import { HelmetProps } from 'react-helmet-async';
|
|
5
|
+
import { LinkProps, NavLinkProps } from 'react-router-dom';
|
|
6
|
+
import 'critters';
|
|
7
|
+
|
|
8
|
+
type Props = HelmetProps & {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
declare function Head(props: Props): JSX.Element;
|
|
12
|
+
|
|
13
|
+
interface ClientOnlyProps {
|
|
14
|
+
children?: () => JSX.Element;
|
|
15
|
+
fallback?: JSX.Element;
|
|
16
|
+
}
|
|
17
|
+
declare function ClientOnly({ children, fallback, }: ClientOnlyProps): JSX.Element | null;
|
|
18
|
+
|
|
19
|
+
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
20
|
+
declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
21
|
+
|
|
22
|
+
declare function ViteReactSSG(routerOptions: RouterOptions, fn?: (context: ViteReactSSGContext<true>) => Promise<void> | void, options?: ViteReactSSGClientOptions): (client?: boolean, routePath?: string) => Promise<ViteReactSSGContext<true>>;
|
|
23
|
+
|
|
24
|
+
export { ClientOnly, Head, Link, NavLink, RouterOptions, ViteReactSSG, ViteReactSSGClientOptions, ViteReactSSGContext };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { R as RouterOptions, a as ViteReactSSGContext, b as ViteReactSSGClientOptions } from './shared/vite-react-ssg.d5f23f74.mjs';
|
|
2
|
+
export { I as IndexRouteRecord, N as NonIndexRouteRecord, c as RouteRecord, S as StyleCollector, V as ViteReactSSGOptions } from './shared/vite-react-ssg.d5f23f74.mjs';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
|
+
import { HelmetProps } from 'react-helmet-async';
|
|
5
|
+
import { LinkProps, NavLinkProps } from 'react-router-dom';
|
|
6
|
+
import 'critters';
|
|
7
|
+
|
|
8
|
+
type Props = HelmetProps & {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
declare function Head(props: Props): JSX.Element;
|
|
12
|
+
|
|
13
|
+
interface ClientOnlyProps {
|
|
14
|
+
children?: () => JSX.Element;
|
|
15
|
+
fallback?: JSX.Element;
|
|
16
|
+
}
|
|
17
|
+
declare function ClientOnly({ children, fallback, }: ClientOnlyProps): JSX.Element | null;
|
|
18
|
+
|
|
19
|
+
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
20
|
+
declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
21
|
+
|
|
22
|
+
declare function ViteReactSSG(routerOptions: RouterOptions, fn?: (context: ViteReactSSGContext<true>) => Promise<void> | void, options?: ViteReactSSGClientOptions): (client?: boolean, routePath?: string) => Promise<ViteReactSSGContext<true>>;
|
|
23
|
+
|
|
24
|
+
export { ClientOnly, Head, Link, NavLink, RouterOptions, ViteReactSSG, ViteReactSSGClientOptions, ViteReactSSGContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RouterOptions,
|
|
2
|
-
export { I as IndexRouteRecord, N as NonIndexRouteRecord, c as RouteRecord, S as StyleCollector,
|
|
1
|
+
import { R as RouterOptions, a as ViteReactSSGContext, b as ViteReactSSGClientOptions } from './shared/vite-react-ssg.d5f23f74.js';
|
|
2
|
+
export { I as IndexRouteRecord, N as NonIndexRouteRecord, c as RouteRecord, S as StyleCollector, V as ViteReactSSGOptions } from './shared/vite-react-ssg.d5f23f74.js';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
4
|
import { HelmetProps } from 'react-helmet-async';
|
|
5
5
|
import { LinkProps, NavLinkProps } from 'react-router-dom';
|
package/dist/node/cli.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const kolorist = require('kolorist');
|
|
|
4
4
|
const yargs = require('yargs');
|
|
5
5
|
const helpers = require('yargs/helpers');
|
|
6
6
|
const webFetch = require('@remix-run/web-fetch');
|
|
7
|
-
const
|
|
7
|
+
const node = require('../node.cjs');
|
|
8
8
|
require('node:path');
|
|
9
9
|
require('node:module');
|
|
10
10
|
require('fs-extra');
|
|
@@ -13,11 +13,25 @@ require('jsdom');
|
|
|
13
13
|
require('../shared/vite-react-ssg.4ca822c0.cjs');
|
|
14
14
|
require('react');
|
|
15
15
|
require('react-helmet-async');
|
|
16
|
-
require('express');
|
|
17
16
|
require('node:fs');
|
|
18
17
|
require('react-router-dom/server.js');
|
|
19
18
|
require('node:stream');
|
|
20
19
|
require('react-dom/server');
|
|
20
|
+
require('node:https');
|
|
21
|
+
require('express');
|
|
22
|
+
require('fs');
|
|
23
|
+
require('tty');
|
|
24
|
+
require('util');
|
|
25
|
+
require('os');
|
|
26
|
+
require('child_process');
|
|
27
|
+
require('path');
|
|
28
|
+
require('assert');
|
|
29
|
+
require('events');
|
|
30
|
+
require('crypto');
|
|
31
|
+
require('url');
|
|
32
|
+
require('net');
|
|
33
|
+
require('http');
|
|
34
|
+
require('punycode');
|
|
21
35
|
|
|
22
36
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
23
37
|
|
|
@@ -81,7 +95,7 @@ yargs__default(helpers.hideBin(process.argv)).scriptName("vite-react-ssg").usage
|
|
|
81
95
|
}),
|
|
82
96
|
async (args) => {
|
|
83
97
|
const { config: configFile = void 0, ...ssgOptions } = args;
|
|
84
|
-
await
|
|
98
|
+
await node.build(ssgOptions, { configFile });
|
|
85
99
|
}
|
|
86
100
|
).command(
|
|
87
101
|
"dev",
|
|
@@ -103,7 +117,7 @@ yargs__default(helpers.hideBin(process.argv)).scriptName("vite-react-ssg").usage
|
|
|
103
117
|
}),
|
|
104
118
|
async (args) => {
|
|
105
119
|
const { config: configFile = void 0, ...ssgOptions } = args;
|
|
106
|
-
await
|
|
120
|
+
await node.dev(ssgOptions, { configFile });
|
|
107
121
|
}
|
|
108
122
|
).fail((msg, err, yargs2) => {
|
|
109
123
|
console.error(`
|
package/dist/node/cli.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export { }
|
package/dist/node/cli.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { gray, bold, red, reset, underline } from 'kolorist';
|
|
|
2
2
|
import yargs from 'yargs';
|
|
3
3
|
import { hideBin } from 'yargs/helpers';
|
|
4
4
|
import { Request, Response, fetch as fetch$1, Headers, FormData } from '@remix-run/web-fetch';
|
|
5
|
-
import {
|
|
5
|
+
import { build, dev } from '../node.mjs';
|
|
6
6
|
import 'node:path';
|
|
7
7
|
import 'node:module';
|
|
8
8
|
import 'fs-extra';
|
|
@@ -11,11 +11,25 @@ import 'jsdom';
|
|
|
11
11
|
import '../shared/vite-react-ssg.9d005d5e.mjs';
|
|
12
12
|
import 'react';
|
|
13
13
|
import 'react-helmet-async';
|
|
14
|
-
import 'express';
|
|
15
14
|
import 'node:fs';
|
|
16
15
|
import 'react-router-dom/server.js';
|
|
17
16
|
import 'node:stream';
|
|
18
17
|
import 'react-dom/server';
|
|
18
|
+
import 'node:https';
|
|
19
|
+
import 'express';
|
|
20
|
+
import 'fs';
|
|
21
|
+
import 'tty';
|
|
22
|
+
import 'util';
|
|
23
|
+
import 'os';
|
|
24
|
+
import 'child_process';
|
|
25
|
+
import 'path';
|
|
26
|
+
import 'assert';
|
|
27
|
+
import 'events';
|
|
28
|
+
import 'crypto';
|
|
29
|
+
import 'url';
|
|
30
|
+
import 'net';
|
|
31
|
+
import 'http';
|
|
32
|
+
import 'punycode';
|
|
19
33
|
|
|
20
34
|
class NodeRequest extends Request {
|
|
21
35
|
constructor(info, init) {
|