vite-plugin-pages
Advanced tools
+7
-7
@@ -48,6 +48,6 @@ "use strict"; | ||
| // src/index.ts | ||
| var src_exports = {}; | ||
| __export(src_exports, { | ||
| var index_exports = {}; | ||
| __export(index_exports, { | ||
| PageContext: () => PageContext, | ||
| default: () => src_default, | ||
| default: () => index_default, | ||
| reactResolver: () => reactResolver, | ||
@@ -58,3 +58,3 @@ solidResolver: () => solidResolver, | ||
| }); | ||
| module.exports = __toCommonJS(src_exports); | ||
| module.exports = __toCommonJS(index_exports); | ||
@@ -86,3 +86,3 @@ // src/constants.ts | ||
| // node_modules/.pnpm/@antfu+utils@0.7.10/node_modules/@antfu/utils/dist/index.mjs | ||
| // node_modules/.pnpm/@antfu+utils@9.1.0/node_modules/@antfu/utils/dist/index.mjs | ||
| function toArray(array) { | ||
@@ -519,6 +519,6 @@ array = array != null ? array : []; | ||
| var import_node_fs = __toESM(require("fs"), 1); | ||
| var import_extract_comments = __toESM(require("extract-comments"), 1); | ||
| var import_json5 = __toESM(require("json5"), 1); | ||
| var import_local_pkg = require("local-pkg"); | ||
| var import_yaml = require("yaml"); | ||
| var import_extract_comments = __toESM(require("extract-comments"), 1); | ||
| var routeJSXReg = /^\s+(route)\s+/gm; | ||
@@ -969,3 +969,3 @@ function parseJSX(code) { | ||
| } | ||
| var src_default = pagesPlugin; | ||
| var index_default = pagesPlugin; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
@@ -972,0 +972,0 @@ 0 && (module.exports = { |
+4
-4
@@ -46,3 +46,3 @@ var __defProp = Object.defineProperty; | ||
| // node_modules/.pnpm/@antfu+utils@0.7.10/node_modules/@antfu/utils/dist/index.mjs | ||
| // node_modules/.pnpm/@antfu+utils@9.1.0/node_modules/@antfu/utils/dist/index.mjs | ||
| function toArray(array) { | ||
@@ -479,6 +479,6 @@ array = array != null ? array : []; | ||
| import fs from "node:fs"; | ||
| import extractComments from "extract-comments"; | ||
| import JSON5 from "json5"; | ||
| import { importModule } from "local-pkg"; | ||
| import { parse as YAMLParser } from "yaml"; | ||
| import extractComments from "extract-comments"; | ||
| var routeJSXReg = /^\s+(route)\s+/gm; | ||
@@ -929,6 +929,6 @@ function parseJSX(code) { | ||
| } | ||
| var src_default = pagesPlugin; | ||
| var index_default = pagesPlugin; | ||
| export { | ||
| PageContext, | ||
| src_default as default, | ||
| index_default as default, | ||
| reactResolver, | ||
@@ -935,0 +935,0 @@ solidResolver, |
+20
-20
| { | ||
| "name": "vite-plugin-pages", | ||
| "type": "module", | ||
| "version": "0.32.4", | ||
| "version": "0.32.5", | ||
| "description": "File system base vue-router plugin for Vite", | ||
@@ -70,30 +70,30 @@ "author": "hannoeru <me@hanlee.co>", | ||
| "@types/debug": "^4.1.12", | ||
| "debug": "^4.3.7", | ||
| "debug": "^4.4.0", | ||
| "dequal": "^2.0.3", | ||
| "extract-comments": "^1.1.0", | ||
| "fast-glob": "^3.3.2", | ||
| "fast-glob": "^3.3.3", | ||
| "json5": "^2.2.3", | ||
| "local-pkg": "^0.5.1", | ||
| "local-pkg": "^1.0.0", | ||
| "picocolors": "^1.1.1", | ||
| "yaml": "^2.6.1" | ||
| "yaml": "^2.7.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@antfu/eslint-config": "^3.10.0", | ||
| "@antfu/utils": "^0.7.10", | ||
| "@solidjs/router": "^0.15.1", | ||
| "@antfu/eslint-config": "^4.3.0", | ||
| "@antfu/utils": "^9.1.0", | ||
| "@solidjs/router": "^0.15.3", | ||
| "@types/glob-to-regexp": "^0.4.4", | ||
| "@types/node": "^22.10.0", | ||
| "@vitest/ui": "^2.1.6", | ||
| "@types/node": "^22.13.4", | ||
| "@vitest/ui": "^3.0.6", | ||
| "@vue/compiler-sfc": "^3.5.13", | ||
| "bumpp": "^9.8.1", | ||
| "eslint": "^9.15.0", | ||
| "bumpp": "^10.0.3", | ||
| "eslint": "^9.20.1", | ||
| "esno": "^4.8.0", | ||
| "playwright": "^1.49.0", | ||
| "react": "^18.3.1", | ||
| "react-router": "^7.0.1", | ||
| "solid-js": "^1.9.3", | ||
| "tsup": "^8.3.5", | ||
| "typescript": "^5.7.2", | ||
| "vite": "^6.0.0", | ||
| "vitest": "^2.1.6", | ||
| "playwright": "^1.50.1", | ||
| "react": "^19.0.0", | ||
| "react-router": "^7.2.0", | ||
| "solid-js": "^1.9.4", | ||
| "tsup": "^8.3.6", | ||
| "typescript": "^5.7.3", | ||
| "vite": "^6.1.1", | ||
| "vitest": "^3.0.6", | ||
| "vue": "^3.5.13", | ||
@@ -100,0 +100,0 @@ "vue-router": "^4.5.0" |
+35
-9
@@ -76,4 +76,4 @@ # vite-plugin-pages | ||
| ```ts | ||
| import { createRouter } from 'vue-router' | ||
| import routes from '~pages' | ||
| import { createRouter } from 'vue-router' | ||
@@ -98,6 +98,4 @@ const router = createRouter({ | ||
| ```tsx | ||
| import routes from '~react-pages' | ||
| import { StrictMode, Suspense } from 'react' | ||
| import { createRoot } from 'react-dom/client' | ||
| import { | ||
@@ -108,2 +106,4 @@ BrowserRouter, | ||
| import routes from '~react-pages' | ||
| function App() { | ||
@@ -137,15 +137,22 @@ return ( | ||
| **experimental** | ||
| #### Passing routes to solid-router | ||
| This guide is for solid-router v0.10.x and newer. For older versions see the [migration guide](https://github.com/solidjs/solid-router/blob/1c9eb8ed2cb70e4fa5a53d0d2836fc112e8ac4a0/README.md?plain=1#L925). | ||
| ```tsx | ||
| import { Router, useRoutes } from '@solidjs/router' | ||
| import { Router } from '@solidjs/router' | ||
| import { render } from 'solid-js/web' | ||
| import routes from '~solid-pages' | ||
| import { render } from 'solid-js/web' | ||
| render( | ||
| () => { | ||
| const Routes = useRoutes(routes) | ||
| return ( | ||
| <Router> | ||
| <Routes /> | ||
| <Router | ||
| root={props => ( | ||
| <Suspense> | ||
| {props.children} | ||
| </Suspense> | ||
| )} | ||
| > | ||
| {routes} | ||
| </Router> | ||
@@ -158,2 +165,21 @@ ) | ||
| #### Configuring vite-plugin with SolidJS | ||
| Remember to check the `dirs` is set to the correct routes directory in `vite.config.ts`: | ||
| ```ts | ||
| import { defineConfig } from 'vite' | ||
| import Pages from 'vite-plugin-pages' | ||
| import solidPlugin from 'vite-plugin-solid' | ||
| export default defineConfig({ | ||
| plugins: [ | ||
| Pages({ | ||
| dirs: ['src/pages'], | ||
| }), | ||
| solidPlugin() | ||
| ], | ||
| }) | ||
| ``` | ||
| **Type** | ||
@@ -160,0 +186,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
264337
1.35%661
4.09%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
Updated
Updated
Updated
Updated