mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-03-19 04:03:47 +00:00
chore: 更新vite
This commit is contained in:
parent
3e4d49dd45
commit
6d91a7a844
@ -552,9 +552,11 @@ export default defineConfig({
|
||||
|
||||
vite: {
|
||||
optimizeDeps: {
|
||||
esbuildOptions: {
|
||||
define: {
|
||||
global: 'globalThis',
|
||||
rolldownOptions: {
|
||||
transform: {
|
||||
define: {
|
||||
global: 'globalThis',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
13
package.json
13
package.json
@ -16,7 +16,7 @@
|
||||
"playground:react": "pnpm --filter \"runtime-react\" build:libs && pnpm --filter \"runtime-react\" --filter \"tmagic-playground\" dev:react",
|
||||
"pg:react": "pnpm playground:react",
|
||||
"build": "pnpm build:dts && node scripts/build.mjs",
|
||||
"build:dts": "pnpm --filter \"@tmagic/cli\" build && tsc -p tsconfig.build-browser.json && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.build-vue.json && rollup -c rollup.dts.config.js && rimraf temp",
|
||||
"build:dts": "pnpm --filter \"@tmagic/cli\" build && tsc -p tsconfig.build-browser.json && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.build-vue.json && rolldown -c rolldown.dts.config.mjs && rimraf temp",
|
||||
"check:type": "tsc --incremental --noEmit -p tsconfig.check.json && vue-tsc --noEmit -p tsconfig.check-vue.json",
|
||||
"build:playground": "pnpm --filter \"runtime-vue\" build && pnpm --filter \"tmagic-playground\" build",
|
||||
"docs:dev": "vitepress dev docs",
|
||||
@ -42,11 +42,10 @@
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^20.1.0",
|
||||
"@commitlint/config-conventional": "^20.0.0",
|
||||
"@rollup/plugin-alias": "^6.0.0",
|
||||
"@tmagic/eslint-config": "workspace:*",
|
||||
"@types/node": "24.0.10",
|
||||
"@vitejs/plugin-vue": "^6.0.2",
|
||||
"@vitest/coverage-v8": "^4.0.12",
|
||||
"@vitejs/plugin-vue": "^6.0.5",
|
||||
"@vitest/coverage-v8": "^4.1.0",
|
||||
"@vue/compiler-sfc": "catalog:",
|
||||
"c8": "^10.1.3",
|
||||
"commitizen": "^4.3.1",
|
||||
@ -66,8 +65,8 @@
|
||||
"prettier": "^3.6.2",
|
||||
"recast": "^0.23.11",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "4.44.1",
|
||||
"rollup-plugin-dts": "^6.2.3",
|
||||
"rolldown": "^1.0.0-rc.9",
|
||||
"rolldown-plugin-dts": "^0.22.5",
|
||||
"sass-embedded": "^1.93.3",
|
||||
"semver": "^7.7.3",
|
||||
"serialize-javascript": "^7.0.0",
|
||||
@ -75,7 +74,7 @@
|
||||
"typescript": "catalog:",
|
||||
"vite": "catalog:",
|
||||
"vitepress": "^1.6.4",
|
||||
"vitest": "^4.0.12",
|
||||
"vitest": "^4.1.0",
|
||||
"vue": "catalog:",
|
||||
"vue-tsc": "^3.1.4"
|
||||
},
|
||||
|
||||
@ -30,9 +30,9 @@
|
||||
"@types/lodash-es": "^4.17.4",
|
||||
"@types/node": "^24.0.10",
|
||||
"@types/serialize-javascript": "^5.0.4",
|
||||
"@vitejs/plugin-legacy": "^7.2.1",
|
||||
"@vitejs/plugin-vue": "^6.0.2",
|
||||
"@vitejs/plugin-vue-jsx": "^5.1.2",
|
||||
"@vitejs/plugin-legacy": "^8.0.0",
|
||||
"@vitejs/plugin-vue": "^6.0.5",
|
||||
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
||||
"@vue/compiler-sfc": "catalog:",
|
||||
"terser": "^5.44.1",
|
||||
"typescript": "catalog:",
|
||||
|
||||
@ -86,9 +86,11 @@ export default defineConfig({
|
||||
},
|
||||
|
||||
optimizeDeps: {
|
||||
esbuildOptions: {
|
||||
define: {
|
||||
global: 'globalThis',
|
||||
rolldownOptions: {
|
||||
transform: {
|
||||
define: {
|
||||
global: 'globalThis',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
2330
pnpm-lock.yaml
generated
2330
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,6 @@ packages:
|
||||
catalog:
|
||||
vue: ^3.5.24
|
||||
'@vue/compiler-sfc': ^3.5.24
|
||||
vite: ^7.2.4
|
||||
vite: ^8.0.0
|
||||
typescript: "^5.9.3"
|
||||
|
||||
@ -2,8 +2,7 @@ import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import alias from '@rollup/plugin-alias';
|
||||
import dts from 'rollup-plugin-dts';
|
||||
import { dts } from 'rolldown-plugin-dts';
|
||||
|
||||
if (!existsSync('temp')) {
|
||||
console.warn(
|
||||
@ -24,36 +23,45 @@ const targetPackages = targets ? packages.filter((pkg) => targets.includes(pkg))
|
||||
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
function rollupConfig(pkg, base) {
|
||||
const aliasEntries = [
|
||||
{ find: /^@form\//, replacement: `${path.join(dirname, './temp/packages/form/src')}/` },
|
||||
{ find: /^@editor\//, replacement: `${path.join(dirname, './temp/packages/editor/src')}/` },
|
||||
{ find: /^@data-source\//, replacement: `${path.join(dirname, './temp/packages/data-source/src')}/` },
|
||||
];
|
||||
|
||||
function aliasPlugin() {
|
||||
return {
|
||||
name: 'dts-alias',
|
||||
resolveId(source) {
|
||||
for (const { find, replacement } of aliasEntries) {
|
||||
if (find.test(source)) {
|
||||
return source.replace(find, replacement);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function rolldownConfig(pkg, base) {
|
||||
return {
|
||||
input: `./temp/${base}/${pkg}/src/index.d.ts`,
|
||||
external: (id) =>
|
||||
!id.startsWith('.') &&
|
||||
!id.startsWith('/') &&
|
||||
!id.startsWith('@editor/') &&
|
||||
!id.startsWith('@form/') &&
|
||||
!id.startsWith('@data-source/'),
|
||||
plugins: [aliasPlugin(), ...dts({ dtsInput: true, tsconfig: false })],
|
||||
output: {
|
||||
file: `${base}/${pkg}/types/index.d.ts`,
|
||||
format: 'es',
|
||||
},
|
||||
plugins: [
|
||||
alias({
|
||||
entries: [
|
||||
{ find: /^@form/, replacement: path.join(dirname, './temp/packages/form/src') },
|
||||
{ find: /^@editor/, replacement: path.join(dirname, './temp/packages/editor/src') },
|
||||
{ find: /^@data-source/, replacement: path.join(dirname, './temp/packages/data-source/src') },
|
||||
],
|
||||
}),
|
||||
dts(),
|
||||
],
|
||||
onwarn(warning, warn) {
|
||||
// during dts rollup, everything is externalized by default
|
||||
if (warning.code === 'UNRESOLVED_IMPORT' && !warning.exporter?.startsWith('.')) {
|
||||
return;
|
||||
}
|
||||
warn(warning);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default [
|
||||
...targetPackages.map((pkg) => rollupConfig(pkg, 'packages')),
|
||||
...runtimes.map((pkg) => rollupConfig(pkg, 'runtime')),
|
||||
...targetPackages.map((pkg) => rolldownConfig(pkg, 'packages')),
|
||||
...runtimes.map((pkg) => rolldownConfig(pkg, 'runtime')),
|
||||
];
|
||||
|
||||
function removeScss(path) {
|
||||
@ -29,7 +29,7 @@
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@vitejs/plugin-legacy": "^7.2.1",
|
||||
"@vitejs/plugin-legacy": "^8.0.0",
|
||||
"@vitejs/plugin-react-refresh": "^1.3.6",
|
||||
"fs-extra": "^11.3.1",
|
||||
"typescript": "catalog:",
|
||||
|
||||
@ -2,9 +2,6 @@ import { defineConfig } from 'vite';
|
||||
|
||||
import baseConfig from '../vite.config';
|
||||
|
||||
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
||||
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
||||
|
||||
export default defineConfig({
|
||||
...baseConfig,
|
||||
|
||||
@ -18,15 +15,5 @@ export default defineConfig({
|
||||
emptyOutDir: false,
|
||||
sourcemap: true,
|
||||
outDir: '../dist/page',
|
||||
rollupOptions: {
|
||||
output: {
|
||||
// https://github.com/rollup/rollup/blob/master/src/utils/sanitizeFileName.ts
|
||||
sanitizeFileName(name) {
|
||||
const match = DRIVE_LETTER_REGEX.exec(name);
|
||||
const driveLetter = match ? match[0] : '';
|
||||
return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, '');
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@ -2,9 +2,6 @@ import { defineConfig } from 'vite';
|
||||
|
||||
import baseConfig from '../vite.config';
|
||||
|
||||
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
||||
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
||||
|
||||
export default defineConfig({
|
||||
...baseConfig,
|
||||
|
||||
@ -18,15 +15,5 @@ export default defineConfig({
|
||||
emptyOutDir: false,
|
||||
sourcemap: true,
|
||||
outDir: '../dist/playground',
|
||||
rollupOptions: {
|
||||
output: {
|
||||
// https://github.com/rollup/rollup/blob/master/src/utils/sanitizeFileName.ts
|
||||
sanitizeFileName(name) {
|
||||
const match = DRIVE_LETTER_REGEX.exec(name);
|
||||
const driveLetter = match ? match[0] : '';
|
||||
return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, '');
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@ -71,7 +71,7 @@ export default defineConfig({
|
||||
},
|
||||
|
||||
build: {
|
||||
rollupOptions: {
|
||||
rolldownOptions: {
|
||||
input: {
|
||||
page: path.resolve(__dirname, './page/index.html'),
|
||||
playground: path.resolve(__dirname, './playground/index.html'),
|
||||
|
||||
@ -26,15 +26,13 @@
|
||||
"@tmagic/cli": "1.7.7",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/node": "^24.0.10",
|
||||
"@vitejs/plugin-legacy": "^7.2.1",
|
||||
"@vitejs/plugin-vue": "^6.0.2",
|
||||
"@vitejs/plugin-vue-jsx": "^5.1.2",
|
||||
"@vitejs/plugin-legacy": "^8.0.0",
|
||||
"@vitejs/plugin-vue": "^6.0.5",
|
||||
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
||||
"@vue/compiler-sfc": "catalog:",
|
||||
"fs-extra": "^11.3.1",
|
||||
"minimist": "^1.2.8",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "4.44.1",
|
||||
"rollup-plugin-external-globals": "^0.13.0",
|
||||
"terser": "^5.44.1",
|
||||
"typescript": "catalog:",
|
||||
"vite": "catalog:"
|
||||
|
||||
@ -2,9 +2,6 @@ import { defineConfig } from 'vite';
|
||||
|
||||
import baseConfig from '../vite.config';
|
||||
|
||||
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
||||
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
||||
|
||||
export default defineConfig({
|
||||
...baseConfig,
|
||||
|
||||
@ -16,15 +13,5 @@ export default defineConfig({
|
||||
emptyOutDir: false,
|
||||
sourcemap: true,
|
||||
outDir: '../dist/page',
|
||||
rollupOptions: {
|
||||
output: {
|
||||
// https://github.com/rollup/rollup/blob/master/src/utils/sanitizeFileName.ts
|
||||
sanitizeFileName(name) {
|
||||
const match = DRIVE_LETTER_REGEX.exec(name);
|
||||
const driveLetter = match ? match[0] : '';
|
||||
return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, '');
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@ -2,9 +2,6 @@ import { defineConfig } from 'vite';
|
||||
|
||||
import baseConfig from '../vite.config';
|
||||
|
||||
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
||||
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
||||
|
||||
export default defineConfig({
|
||||
...baseConfig,
|
||||
|
||||
@ -16,15 +13,5 @@ export default defineConfig({
|
||||
emptyOutDir: false,
|
||||
sourcemap: true,
|
||||
outDir: '../dist/playground',
|
||||
rollupOptions: {
|
||||
output: {
|
||||
// https://github.com/rollup/rollup/blob/master/src/utils/sanitizeFileName.ts
|
||||
sanitizeFileName(name) {
|
||||
const match = DRIVE_LETTER_REGEX.exec(name);
|
||||
const driveLetter = match ? match[0] : '';
|
||||
return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, '');
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@ -62,7 +62,7 @@ export default defineConfig({
|
||||
},
|
||||
|
||||
build: {
|
||||
rollupOptions: {
|
||||
rolldownOptions: {
|
||||
input: {
|
||||
page: path.resolve(__dirname, './page/index.html'),
|
||||
playground: path.resolve(__dirname, './playground/index.html'),
|
||||
|
||||
@ -67,7 +67,7 @@ async function build({ packageName, format, pkg, packagesDir }) {
|
||||
cssFileName: 'style',
|
||||
},
|
||||
|
||||
rollupOptions: {
|
||||
rolldownOptions: {
|
||||
// 确保外部化处理那些你不想打包进库的依赖
|
||||
external(id) {
|
||||
if (format === 'umd' && id === 'lodash-es') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user