vite-react-ssg 0.7.1 → 0.7.3

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
@@ -456,9 +459,9 @@ interface ViteReactSSGOptions {
456
459
  *
457
460
  * @default 'none'
458
461
  */
459
- formatting?: 'minify' | 'prettify' | 'none'
462
+ formatting?: 'prettify' | 'none'
460
463
  /**
461
- * Vite environmeng mode.
464
+ * Vite environment mode.
462
465
  */
463
466
  mode?: string
464
467
  /**
@@ -472,7 +475,7 @@ interface ViteReactSSGOptions {
472
475
  dirStyle?: 'flat' | 'nested'
473
476
  /**
474
477
  * Generate for all routes, including dynamic routes.
475
- * If enabled, you will need to configGure your serve
478
+ * If enabled, you will need to configure your serve
476
479
  * manually to handle dynamic routes properly.
477
480
  *
478
481
  * @default false
File without changes
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.4d155759.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.4d155759.cjs';
2
+ import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.de54c34e.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.de54c34e.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.4d155759.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.4d155759.mjs';
2
+ import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.de54c34e.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.de54c34e.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.4d155759.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.4d155759.js';
2
+ import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.de54c34e.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.de54c34e.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.4d155759.cjs';
2
- export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.4d155759.cjs';
1
+ import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.de54c34e.cjs';
2
+ export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.de54c34e.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.4d155759.mjs';
2
- export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.4d155759.mjs';
1
+ import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.de54c34e.mjs';
2
+ export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.de54c34e.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.4d155759.js';
2
- export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.4d155759.js';
1
+ import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.de54c34e.js';
2
+ export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.de54c34e.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.cjs CHANGED
@@ -1391,16 +1391,7 @@ function rewriteScripts(indexHTML, mode) {
1391
1391
  return indexHTML.replace(/<script type="module" /g, `<script type="module" ${mode} `);
1392
1392
  }
1393
1393
  async function formatHtml(html, formatting) {
1394
- if (formatting === "minify") {
1395
- const htmlMinifier = await import('html-minifier');
1396
- return htmlMinifier.minify(html, {
1397
- collapseWhitespace: true,
1398
- caseSensitive: true,
1399
- collapseInlineTagWhitespace: false,
1400
- minifyJS: true,
1401
- minifyCSS: true
1402
- });
1403
- } else if (formatting === "prettify") {
1394
+ if (formatting === "prettify") {
1404
1395
  try {
1405
1396
  const prettier = (await import('prettier/esm/standalone.mjs')).default;
1406
1397
  const parserHTML = (await import('prettier/esm/parser-html.mjs')).default;
@@ -1416,7 +1407,7 @@ async function formatHtml(html, formatting) {
1416
1407
  function invariant(value, message) {
1417
1408
  if (value === false || value === null || typeof value === "undefined") {
1418
1409
  console.error(
1419
- "The following error is a bug in Remix; please open an issue! https://github.com/remix-run/remix/issues/new"
1410
+ "The following error is a bug in Vite-react-ssg; please open an issue! https://github.com/Daydreamer-riri/vite-react-ssg/issues/new"
1420
1411
  );
1421
1412
  throw new Error(message);
1422
1413
  }
package/dist/node.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { InlineConfig } from 'vite';
2
- import { b as ViteReactSSGOptions } from './shared/vite-react-ssg.4d155759.cjs';
2
+ import { b as ViteReactSSGOptions } from './shared/vite-react-ssg.de54c34e.cjs';
3
3
  import 'critters';
4
4
  import 'react';
5
5
  import 'react-router-dom';
package/dist/node.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { InlineConfig } from 'vite';
2
- import { b as ViteReactSSGOptions } from './shared/vite-react-ssg.4d155759.mjs';
2
+ import { b as ViteReactSSGOptions } from './shared/vite-react-ssg.de54c34e.mjs';
3
3
  import 'critters';
4
4
  import 'react';
5
5
  import 'react-router-dom';
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { InlineConfig } from 'vite';
2
- import { b as ViteReactSSGOptions } from './shared/vite-react-ssg.4d155759.js';
2
+ import { b as ViteReactSSGOptions } from './shared/vite-react-ssg.de54c34e.js';
3
3
  import 'critters';
4
4
  import 'react';
5
5
  import 'react-router-dom';
package/dist/node.mjs CHANGED
@@ -1384,16 +1384,7 @@ function rewriteScripts(indexHTML, mode) {
1384
1384
  return indexHTML.replace(/<script type="module" /g, `<script type="module" ${mode} `);
1385
1385
  }
1386
1386
  async function formatHtml(html, formatting) {
1387
- if (formatting === "minify") {
1388
- const htmlMinifier = await import('html-minifier');
1389
- return htmlMinifier.minify(html, {
1390
- collapseWhitespace: true,
1391
- caseSensitive: true,
1392
- collapseInlineTagWhitespace: false,
1393
- minifyJS: true,
1394
- minifyCSS: true
1395
- });
1396
- } else if (formatting === "prettify") {
1387
+ if (formatting === "prettify") {
1397
1388
  try {
1398
1389
  const prettier = (await import('prettier/esm/standalone.mjs')).default;
1399
1390
  const parserHTML = (await import('prettier/esm/parser-html.mjs')).default;
@@ -1409,7 +1400,7 @@ async function formatHtml(html, formatting) {
1409
1400
  function invariant(value, message) {
1410
1401
  if (value === false || value === null || typeof value === "undefined") {
1411
1402
  console.error(
1412
- "The following error is a bug in Remix; please open an issue! https://github.com/remix-run/remix/issues/new"
1403
+ "The following error is a bug in Vite-react-ssg; please open an issue! https://github.com/Daydreamer-riri/vite-react-ssg/issues/new"
1413
1404
  );
1414
1405
  throw new Error(message);
1415
1406
  }
@@ -35,7 +35,7 @@ interface ViteReactSSGOptions {
35
35
  *
36
36
  * @default 'none'
37
37
  */
38
- formatting?: 'minify' | 'prettify' | 'none';
38
+ formatting?: 'prettify' | 'none';
39
39
  /**
40
40
  * Vite environmeng mode.
41
41
  */
@@ -35,7 +35,7 @@ interface ViteReactSSGOptions {
35
35
  *
36
36
  * @default 'none'
37
37
  */
38
- formatting?: 'minify' | 'prettify' | 'none';
38
+ formatting?: 'prettify' | 'none';
39
39
  /**
40
40
  * Vite environmeng mode.
41
41
  */
@@ -35,7 +35,7 @@ interface ViteReactSSGOptions {
35
35
  *
36
36
  * @default 'none'
37
37
  */
38
- formatting?: 'minify' | 'prettify' | 'none';
38
+ formatting?: 'prettify' | 'none';
39
39
  /**
40
40
  * Vite environmeng mode.
41
41
  */
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "vite-react-ssg",
3
3
  "type": "module",
4
- "version": "0.7.1",
5
- "packageManager": "pnpm@9.4.0",
6
- "description": "",
4
+ "version": "0.7.3",
5
+ "packageManager": "pnpm@9.7.1",
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",
@@ -102,25 +102,23 @@
102
102
  "dependencies": {
103
103
  "@remix-run/web-fetch": "^4.4.2",
104
104
  "fs-extra": "^11.2.0",
105
- "html-minifier": "^4.0.0",
106
105
  "html5parser": "^2.0.2",
107
- "jsdom": "^24.1.0",
106
+ "jsdom": "^24.1.1",
108
107
  "kolorist": "^1.8.0",
109
108
  "react-helmet-async": "^1.3.0",
110
109
  "yargs": "^17.7.2"
111
110
  },
112
111
  "devDependencies": {
113
112
  "@ririd/eslint-config": "^1.3.2",
114
- "@types/fs-extra": "^11.0.1",
115
- "@types/html-minifier": "^4.0.2",
116
- "@types/jsdom": "^21.1.1",
117
- "@types/node": "^18.15.11",
113
+ "@types/fs-extra": "^11.0.4",
114
+ "@types/jsdom": "^21.1.7",
115
+ "@types/node": "^18.19.44",
118
116
  "@types/react": "^18.2.14",
119
117
  "@types/react-dom": "^18.2.6",
120
- "@types/yargs": "^17.0.24",
121
- "bumpp": "^9.4.0",
118
+ "@types/yargs": "^17.0.33",
119
+ "bumpp": "^9.5.1",
122
120
  "critters": "^0.0.22",
123
- "eslint": "^8.56.0",
121
+ "eslint": "^9.9.0",
124
122
  "esno": "^4.7.0",
125
123
  "fast-glob": "3.3.2",
126
124
  "p-queue": "^8.0.1",
@@ -130,10 +128,10 @@
130
128
  "react-router-dom": "^6.15.0",
131
129
  "rimraf": "5.0.1",
132
130
  "styled-components": "6.0.5",
133
- "typescript": "^5.5.2",
131
+ "typescript": "^5.5.4",
134
132
  "unbuild": "^2.0.0",
135
- "vite": "^5.3.1",
136
- "vite-plugin-pwa": "^0.17.4",
133
+ "vite": "^5.4.1",
134
+ "vite-plugin-pwa": "^0.17.5",
137
135
  "vitest": "1.6.0"
138
136
  }
139
137
  }