Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-virtual-mpa

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-virtual-mpa - npm Package Compare versions

Comparing version 1.8.0 to 1.8.1

12

CHANGELOG.md

@@ -0,6 +1,12 @@

# 1.8.1
- fix: `ERR_TOO_MANY_REDIRECTS` when set `base` option and visit base. Closed [#33](https://github.com/emosheeep/vite-plugin-virtual-mpa/issues/33)
- feat: Support `/dir/` without explicit `index.html` refer to the implementation of vite.
- chore: Preserve the priority of `clearScreen` option provided by user.
# 1.8.0
feat: Add `scanOptions` to generate pages with a similar directory structure.
fix: Can't access assets by url & Prevent ejs syntax error.
chore: Remove redundant rewrite rules ensure a correct plugin hook order.
- feat: Add `scanOptions` to generate pages with a similar directory structure. Closed [#29](https://github.com/emosheeep/vite-plugin-virtual-mpa/issues/29).
- fix: Can't access assets by url & Prevent ejs syntax error. Closed [#30](https://github.com/emosheeep/vite-plugin-virtual-mpa/issues/30).
- chore: Remove redundant rewrite rules ensure a correct plugin hook order.

@@ -7,0 +13,0 @@ # 1.7.0

@@ -53,12 +53,29 @@ "use strict";

function useHistoryFallbackMiddleware(middlewares, rewrites2 = []) {
const { base } = resolvedConfig;
middlewares.use(
// @ts-ignore
history({
// Override the index (default /index.html).
index: vite.normalizePath(`/${base}/index.html`),
htmlAcceptHeaders: ["text/html", "application/xhtml+xml"],
rewrites: rewrites2.concat([
{
from: new RegExp(vite.normalizePath(`/${resolvedConfig.base}/(${Object.keys(inputMap).join("|")})`)),
from: new RegExp(vite.normalizePath(`/${base}/(${Object.keys(inputMap).join("|")})`)),
to: (ctx) => {
return vite.normalizePath(`/${resolvedConfig.base}/${inputMap[ctx.match[1]]}`);
return vite.normalizePath(`/${base}/${inputMap[ctx.match[1]]}`);
}
},
{
from: /\/$/,
/**
* Support /dir/ without explicit index.html
* @see https://github.com/vitejs/vite/blob/main/packages/vite/src/node/server/middlewares/htmlFallback.ts#L13
*/
to({ parsedUrl, request }) {
const rewritten = decodeURIComponent(parsedUrl.pathname) + "index.html";
if (fs.existsSync(rewritten.replace(base, ""))) {
return rewritten;
}
return request.url;
}
}

@@ -100,7 +117,7 @@ ])

name: pluginName,
config() {
config(config2) {
configInit(pages);
return {
appType: "mpa",
clearScreen: false,
clearScreen: config2.clearScreen ?? false,
optimizeDeps: {

@@ -107,0 +124,0 @@ entries: pages.map((v) => v.entry).filter((v) => !!v)

{
"name": "vite-plugin-virtual-mpa",
"version": "1.8.0",
"version": "1.8.1",
"license": "MIT",

@@ -5,0 +5,0 @@ "author": "秦旭洋",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc