vite-react-ssg 0.7.0 → 0.7.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,11 +4,12 @@ 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!**
7
+ **🎈 Support for [`@tanstack/router`](https://tanstack.com/router/latest/docs/framework/react/overview)
8
+ and [`wouter`](https://github.com/molefrog/wouter) is in progress!**
8
9
 
9
10
  [![NPM version](https://img.shields.io/npm/v/vite-react-ssg?color=a1b858&label=)](https://www.npmjs.com/package/vite-react-ssg)
10
11
 
11
- # Table of contents
12
+ ## Table of contents
12
13
 
13
14
  - [Usage](#usage)
14
15
  - [Use CSR during development](#use-csr-during-development)
@@ -25,7 +26,6 @@ See demo(also document): [docs](https://vite-react-ssg.netlify.app/)
25
26
  - [Critical CSS](#critical-css)
26
27
  - [Configuration](#configuration)
27
28
  - [Custom Routes to Render](#custom-routes-to-render)
28
- - [Https](#https)
29
29
  - [Roadmap](#roadmap)
30
30
  - [Credits](#credits)
31
31
 
@@ -103,7 +103,8 @@ export const routes: RouteRecord[] = [
103
103
 
104
104
  ### Use CSR during development
105
105
 
106
- Vite React SSG provide SSR (Server-Side Rendering) during development to ensure consistency between development and production as much as possible.
106
+ Vite React SSG provide SSR (Server-Side Rendering) during development to ensure consistency
107
+ between development and production as much as possible.
107
108
 
108
109
  But if you want to use CSR during development, just:
109
110
 
@@ -120,7 +121,8 @@ But if you want to use CSR during development, just:
120
121
 
121
122
  ### Single Page SSG
122
123
 
123
- For SSG of an index page only (i.e. without `react-router-dom`); import `vite-react-ssg/single-page` instead.
124
+ For SSG of an index page only (i.e. without `react-router-dom`);
125
+ import `vite-react-ssg/single-page` instead.
124
126
 
125
127
  ```tsx
126
128
  // src/main.tsx
@@ -180,7 +182,7 @@ export function getStaticPaths() {
180
182
  const routes = [
181
183
  {
182
184
  path: '/:page',
183
- lazy: () => import('./pages/[page]')
185
+ lazy: () => import('./pages/[page]'),
184
186
  }
185
187
  ]
186
188
  ```
@@ -393,7 +395,8 @@ npm i -D critters
393
395
 
394
396
  Critical CSS generation will automatically be enabled for you.
395
397
 
396
- To configure `critters`, pass [its options](https://github.com/GoogleChromeLabs/critters#usage) into `ssgOptions.crittersOptions` in `vite.config.ts`:
398
+ To configure `critters`, pass [its options](https://github.com/GoogleChromeLabs/critters#usage)
399
+ into `ssgOptions.crittersOptions` in `vite.config.ts`:
397
400
 
398
401
  ```ts
399
402
  // vite.config.ts
File without changes
package/dist/node.cjs CHANGED
@@ -1010,8 +1010,12 @@ function extractHelmet(context, styleCollector) {
1010
1010
  const { helmet } = context;
1011
1011
  const htmlAttributes = helmet.htmlAttributes.toString();
1012
1012
  const bodyAttributes = helmet.bodyAttributes.toString();
1013
+ let titleString = helmet.title.toString();
1014
+ if (titleString.split(">")[1] === "</title") {
1015
+ titleString = "";
1016
+ }
1013
1017
  const metaStrings = [
1014
- helmet.title.toString(),
1018
+ titleString,
1015
1019
  helmet.meta.toString(),
1016
1020
  helmet.link.toString(),
1017
1021
  helmet.script.toString()
@@ -1412,7 +1416,7 @@ async function formatHtml(html, formatting) {
1412
1416
  function invariant(value, message) {
1413
1417
  if (value === false || value === null || typeof value === "undefined") {
1414
1418
  console.error(
1415
- "The following error is a bug in Remix; please open an issue! https://github.com/remix-run/remix/issues/new"
1419
+ "The following error is a bug in Vite-react-ssg; please open an issue! https://github.com/Daydreamer-riri/vite-react-ssg/issues/new"
1416
1420
  );
1417
1421
  throw new Error(message);
1418
1422
  }
package/dist/node.mjs CHANGED
@@ -1003,8 +1003,12 @@ function extractHelmet(context, styleCollector) {
1003
1003
  const { helmet } = context;
1004
1004
  const htmlAttributes = helmet.htmlAttributes.toString();
1005
1005
  const bodyAttributes = helmet.bodyAttributes.toString();
1006
+ let titleString = helmet.title.toString();
1007
+ if (titleString.split(">")[1] === "</title") {
1008
+ titleString = "";
1009
+ }
1006
1010
  const metaStrings = [
1007
- helmet.title.toString(),
1011
+ titleString,
1008
1012
  helmet.meta.toString(),
1009
1013
  helmet.link.toString(),
1010
1014
  helmet.script.toString()
@@ -1405,7 +1409,7 @@ async function formatHtml(html, formatting) {
1405
1409
  function invariant(value, message) {
1406
1410
  if (value === false || value === null || typeof value === "undefined") {
1407
1411
  console.error(
1408
- "The following error is a bug in Remix; please open an issue! https://github.com/remix-run/remix/issues/new"
1412
+ "The following error is a bug in Vite-react-ssg; please open an issue! https://github.com/Daydreamer-riri/vite-react-ssg/issues/new"
1409
1413
  );
1410
1414
  throw new Error(message);
1411
1415
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "vite-react-ssg",
3
3
  "type": "module",
4
- "version": "0.7.0",
4
+ "version": "0.7.2",
5
5
  "packageManager": "pnpm@9.4.0",
6
- "description": "",
6
+ "description": "Static-site generation for React on Vite.",
7
7
  "author": "Riri <Daydreamerriri@outlook.com>",
8
8
  "license": "MIT",
9
9
  "homepage": "https://github.com/Daydreamer-riri/vite-react-ssg#readme",