Skip to content

build: update vite version and fix inline-chunk plugin #2722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions internals/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,13 @@
{
"name": "internal-cli",
"private": true,
"type": "commonjs",
"version": "1.0.5-mf.0",
"private": true,
"description": "internal-cli",
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "7.16.7",
"@opentiny-internal/unplugin-virtual-template": "workspace:*",
"@opentiny/vue-vite-template2jsx": "workspace:*",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^24.0.1",
"@types/fs-extra": "^11.0.1",
"@vue/tsconfig": "^0.4.0",
"chalk": "2.4.2",
"commander": "^10.0.0",
"esbuild-register": "^3.4.2",
"find-up": "^5.0.0",
"fs-extra": "^11.1.0",
"handlebars": "4.7.7",
"prettier": "^2.7.1",
"rollup": "^3.7.3",
"semver": "^7.3.8",
"tsup": "7.2.0",
"vite": "^4.3.8",
"typescript": "catalog:",
"tailwindcss": "^3.2.4"
},
"main": "./dist/cjs/index.js",
"bin": {
"cli": "./dist/cjs/index.js"
},
"main": "./dist/cjs/index.js",
"scripts": {
"build": "tsup",
"// -------注意带 # 开头的脚本命令不要直接执行------- ": "",
Expand All @@ -56,14 +33,37 @@
"build:chartTheme": "esno src/index.ts build:chartTheme"
},
"dependencies": {
"@opentiny/huicharts": "~1.0.0",
"@vue/babel-helper-vue-jsx-merge-props": "^1.4.0",
"esno": "^4.7.0",
"fast-glob": "^3.2.12",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-visualizer": "^5.12.0",
"vite-plugin-dts": "~3.0.0",
"vite-plugin-svgr": "^3.2.0",
"vite-svg-loader": "^3.6.0",
"@opentiny/huicharts": "~1.0.0"
"vite-svg-loader": "^3.6.0"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "7.16.7",
"@opentiny-internal/unplugin-virtual-template": "workspace:*",
"@opentiny/vue-vite-template2jsx": "workspace:*",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^24.0.1",
"@types/fs-extra": "^11.0.1",
"@vue/tsconfig": "^0.4.0",
"chalk": "2.4.2",
"commander": "^10.0.0",
"esbuild-register": "^3.4.2",
"find-up": "^5.0.0",
"fs-extra": "^11.1.0",
"handlebars": "4.7.7",
"prettier": "^2.7.1",
"rollup": "^3.7.3",
"semver": "^7.3.8",
"tailwindcss": "^3.2.4",
"tsup": "7.2.0",
"typescript": "catalog:",
"vite": "catalog:"
}
}
4 changes: 2 additions & 2 deletions internals/cli/src/commands/build/rollup/inline-chunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function ({ deleteInlinedFiles = true }): Plugin {
if (!jsChunk.code) continue

if (format === 'es') {
const reg = /^import(\s*.+\s*from)?\s+"[./]+(.+-[a-f0-9]{8}.+)".*$/gim
const reg = /^import(\s*.+\s*from)?\s+"[./]+(.+-[A-Za-z0-9_-]{8}\.[mc]?js)".*$/gim

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regular expression has been updated to match a broader range of file name patterns, including different extensions and character sets. Ensure that this change does not inadvertently match unintended file names.

const matchArr = jsChunk.code.match(reg)
if (matchArr) {
const filePath = path.join(dir, jsName)
Expand All @@ -40,7 +40,7 @@ export default function ({ deleteInlinedFiles = true }): Plugin {
}

if (format === 'cjs') {
const reg = /require\("[./]+(.+-[a-f0-9]{8}.+)".*$/gim
const reg = /require\("[./]+(.+-[A-Za-z0-9_-]{8}\.[mc]?js)".*$/gim

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regular expression for 'require' statements has been updated similarly to the 'import' statements. Verify that this change aligns with the intended file patterns and does not introduce any security vulnerabilities.

const matchArr = jsChunk.code.match(reg)
if (matchArr) {
const filePath = path.join(dir, jsName)
Expand Down
Loading