Skip to content

Commit

Permalink
feat: Adapt this pr vitejs/vite#9669
Browse files Browse the repository at this point in the history
  • Loading branch information
yzydeveloper committed Mar 12, 2024
1 parent 7fd7c72 commit 91f5dd7
Show file tree
Hide file tree
Showing 9 changed files with 968 additions and 1,038 deletions.
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -2,21 +2,21 @@
"name": "vite-plugin-mpa-plus-monorepo",
"version": "0.5.5",
"license": "MIT",
"author": "yzydeveloper",
"homepage": "https://github.com/yzydeveloper/vite-plugin-mpa-plus",
"repository": {
"type": "git",
"url": "https://github.com/yzydeveloper/vite-plugin-mpa-plus"
},
"author": "yzydeveloper",
"homepage": "https://github.com/yzydeveloper/vite-plugin-mpa-plus",
"scripts": {
"prepublish": "pnpm --filter vite-plugin-mpa-plus build",
"release": "bumpp package.json packages/core/package.json --commit --push --tag && pnpm --filter vite-plugin-mpa-plus publish --access public"
},
"devDependencies": {
"@yzydeveloper/eslint-config": "^0.1.4",
"bumpp": "^8.2.1",
"vite": "^3.0.0",
"eslint": "^8.12.0",
"typescript": "^4.6.3"
"typescript": "^4.6.3",
"vite": "^5.0.0"
}
}
36 changes: 18 additions & 18 deletions packages/core/package.json
Expand Up @@ -2,37 +2,37 @@
"name": "vite-plugin-mpa-plus",
"version": "0.5.5",
"description": "More flexible MPA (multipage application) supports html template",
"author": "yzydeveloper",
"keywords": [
"vite",
"html",
"vite-plugin"
],
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "dist/index.mjs",
"repository": {
"type": "git",
"url": "https://github.com/yzydeveloper/vite-plugin-mpa-plus"
},
"author": "yzydeveloper",
"files": [
"dist"
],
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
}
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "dist/index.mjs",
"scripts": {
"build": "tsup",
"dev": "tsup --watch"
},
"keywords": [
"vite",
"html",
"vite-plugin"
],
"homepage": "https://github.com/yzydeveloper/vite-plugin-mpa-plus",
"repository": {
"type": "git",
"url": "https://github.com/yzydeveloper/vite-plugin-mpa-plus"
},
"files": [
"dist"
],
"peerDependencies": {
"vite": ">=2.0.0"
"vite": ">=4.0.0"
},
"dependencies": {
"@types/connect-history-api-fallback": "^1.3.5",
Expand All @@ -41,7 +41,7 @@
},
"devDependencies": {
"@types/ejs": "^3.1.1",
"@types/node": "^17.0.35",
"@types/node": "^20.0.0",
"node-html-parser": "^5.3.3",
"tsup": "^5.12.1"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/htmlFixPlugin.ts
Expand Up @@ -51,8 +51,8 @@ export function createHtmlFixPlugin(options: Options): Plugin {
viteConfig = config
},
transformIndexHtml: {
enforce: 'post',
transform(html, ctx) {
order: 'post',
handler(html, ctx) {
const root = parse(html)
const nodes = root.querySelectorAll(`[${VITE_PLUGIN_NAME}]`)
nodes.forEach(node => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/multiPagePlugin.ts
Expand Up @@ -226,8 +226,8 @@ export function createMpaPlugin(options: Options): Plugin {
}) as Connect.NextHandleFunction)
},
transformIndexHtml: {
enforce: 'pre',
async transform(html, ctx) {
order: 'pre',
async handler(html, ctx) {
const url = ctx.filename
const { base, root } = viteConfig // process.cwd() > vite.root, The default root is process.cwd(), Fixing edge problems.
const excludeBaseUrl = url.replace(base, '/')
Expand Down
5 changes: 3 additions & 2 deletions packages/playground/mpa-filename/package.json
@@ -1,5 +1,6 @@
{
"name": "playground-mpa-filename",
"type": "module",
"version": "0.0.1",
"private": true,
"scripts": {
Expand All @@ -12,7 +13,7 @@
"vue-router": "^4.0.14"
},
"devDependencies": {
"@vitejs/plugin-vue": "^2.2.4",
"vite": "^3.0.0"
"@vitejs/plugin-vue": "^5.0.0",
"vite": "^5.0.0"
}
}
5 changes: 3 additions & 2 deletions packages/playground/mpa-rewites/package.json
@@ -1,5 +1,6 @@
{
"name": "playground-mpa-rewites",
"type": "module",
"version": "0.0.1",
"private": true,
"scripts": {
Expand All @@ -12,7 +13,7 @@
"vue-router": "^4.0.14"
},
"devDependencies": {
"@vitejs/plugin-vue": "^2.2.4",
"vite": "^3.0.0"
"@vitejs/plugin-vue": "^5.0.0",
"vite": "^5.0.0"
}
}
5 changes: 3 additions & 2 deletions packages/playground/mpa/package.json
@@ -1,5 +1,6 @@
{
"name": "playground-mpa",
"type": "module",
"version": "0.0.1",
"private": true,
"scripts": {
Expand All @@ -12,7 +13,7 @@
"vue-router": "^4.0.14"
},
"devDependencies": {
"@vitejs/plugin-vue": "^2.2.4",
"vite": "^3.0.0"
"@vitejs/plugin-vue": "^5.0.0",
"vite": "^5.0.0"
}
}
5 changes: 3 additions & 2 deletions packages/playground/spa/package.json
@@ -1,5 +1,6 @@
{
"name": "playground-spa",
"type": "module",
"version": "0.0.1",
"private": true,
"scripts": {
Expand All @@ -12,7 +13,7 @@
"vue-router": "^4.0.14"
},
"devDependencies": {
"@vitejs/plugin-vue": "^2.2.4",
"vite": "3.0.0"
"@vitejs/plugin-vue": "^5.0.0",
"vite": "^5.0.0"
}
}

0 comments on commit 91f5dd7

Please sign in to comment.