chore: 更新vite
This commit is contained in:
@@ -552,9 +552,11 @@ export default defineConfig({
|
|||||||
|
|
||||||
vite: {
|
vite: {
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
esbuildOptions: {
|
rolldownOptions: {
|
||||||
define: {
|
transform: {
|
||||||
global: 'globalThis',
|
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",
|
"playground:react": "pnpm --filter \"runtime-react\" build:libs && pnpm --filter \"runtime-react\" --filter \"tmagic-playground\" dev:react",
|
||||||
"pg:react": "pnpm playground:react",
|
"pg:react": "pnpm playground:react",
|
||||||
"build": "pnpm build:dts && node scripts/build.mjs",
|
"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",
|
"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",
|
"build:playground": "pnpm --filter \"runtime-vue\" build && pnpm --filter \"tmagic-playground\" build",
|
||||||
"docs:dev": "vitepress dev docs",
|
"docs:dev": "vitepress dev docs",
|
||||||
@@ -42,11 +42,10 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^20.1.0",
|
"@commitlint/cli": "^20.1.0",
|
||||||
"@commitlint/config-conventional": "^20.0.0",
|
"@commitlint/config-conventional": "^20.0.0",
|
||||||
"@rollup/plugin-alias": "^6.0.0",
|
|
||||||
"@tmagic/eslint-config": "workspace:*",
|
"@tmagic/eslint-config": "workspace:*",
|
||||||
"@types/node": "24.0.10",
|
"@types/node": "24.0.10",
|
||||||
"@vitejs/plugin-vue": "^6.0.2",
|
"@vitejs/plugin-vue": "^6.0.5",
|
||||||
"@vitest/coverage-v8": "^4.0.12",
|
"@vitest/coverage-v8": "^4.1.0",
|
||||||
"@vue/compiler-sfc": "catalog:",
|
"@vue/compiler-sfc": "catalog:",
|
||||||
"c8": "^10.1.3",
|
"c8": "^10.1.3",
|
||||||
"commitizen": "^4.3.1",
|
"commitizen": "^4.3.1",
|
||||||
@@ -66,8 +65,8 @@
|
|||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"recast": "^0.23.11",
|
"recast": "^0.23.11",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"rollup": "4.44.1",
|
"rolldown": "^1.0.0-rc.9",
|
||||||
"rollup-plugin-dts": "^6.2.3",
|
"rolldown-plugin-dts": "^0.22.5",
|
||||||
"sass-embedded": "^1.93.3",
|
"sass-embedded": "^1.93.3",
|
||||||
"semver": "^7.7.3",
|
"semver": "^7.7.3",
|
||||||
"serialize-javascript": "^7.0.0",
|
"serialize-javascript": "^7.0.0",
|
||||||
@@ -75,7 +74,7 @@
|
|||||||
"typescript": "catalog:",
|
"typescript": "catalog:",
|
||||||
"vite": "catalog:",
|
"vite": "catalog:",
|
||||||
"vitepress": "^1.6.4",
|
"vitepress": "^1.6.4",
|
||||||
"vitest": "^4.0.12",
|
"vitest": "^4.1.0",
|
||||||
"vue": "catalog:",
|
"vue": "catalog:",
|
||||||
"vue-tsc": "^3.1.4"
|
"vue-tsc": "^3.1.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -30,9 +30,9 @@
|
|||||||
"@types/lodash-es": "^4.17.4",
|
"@types/lodash-es": "^4.17.4",
|
||||||
"@types/node": "^24.0.10",
|
"@types/node": "^24.0.10",
|
||||||
"@types/serialize-javascript": "^5.0.4",
|
"@types/serialize-javascript": "^5.0.4",
|
||||||
"@vitejs/plugin-legacy": "^7.2.1",
|
"@vitejs/plugin-legacy": "^8.0.0",
|
||||||
"@vitejs/plugin-vue": "^6.0.2",
|
"@vitejs/plugin-vue": "^6.0.5",
|
||||||
"@vitejs/plugin-vue-jsx": "^5.1.2",
|
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
||||||
"@vue/compiler-sfc": "catalog:",
|
"@vue/compiler-sfc": "catalog:",
|
||||||
"terser": "^5.44.1",
|
"terser": "^5.44.1",
|
||||||
"typescript": "catalog:",
|
"typescript": "catalog:",
|
||||||
|
|||||||
@@ -86,9 +86,11 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
|
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
esbuildOptions: {
|
rolldownOptions: {
|
||||||
define: {
|
transform: {
|
||||||
global: 'globalThis',
|
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:
|
catalog:
|
||||||
vue: ^3.5.24
|
vue: ^3.5.24
|
||||||
'@vue/compiler-sfc': ^3.5.24
|
'@vue/compiler-sfc': ^3.5.24
|
||||||
vite: ^7.2.4
|
vite: ^8.0.0
|
||||||
typescript: "^5.9.3"
|
typescript: "^5.9.3"
|
||||||
|
|
||||||
@@ -2,8 +2,7 @@ import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import alias from '@rollup/plugin-alias';
|
import { dts } from 'rolldown-plugin-dts';
|
||||||
import dts from 'rollup-plugin-dts';
|
|
||||||
|
|
||||||
if (!existsSync('temp')) {
|
if (!existsSync('temp')) {
|
||||||
console.warn(
|
console.warn(
|
||||||
@@ -24,36 +23,45 @@ const targetPackages = targets ? packages.filter((pkg) => targets.includes(pkg))
|
|||||||
|
|
||||||
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
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 {
|
return {
|
||||||
input: `./temp/${base}/${pkg}/src/index.d.ts`,
|
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: {
|
output: {
|
||||||
file: `${base}/${pkg}/types/index.d.ts`,
|
file: `${base}/${pkg}/types/index.d.ts`,
|
||||||
format: 'es',
|
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 [
|
export default [
|
||||||
...targetPackages.map((pkg) => rollupConfig(pkg, 'packages')),
|
...targetPackages.map((pkg) => rolldownConfig(pkg, 'packages')),
|
||||||
...runtimes.map((pkg) => rollupConfig(pkg, 'runtime')),
|
...runtimes.map((pkg) => rolldownConfig(pkg, 'runtime')),
|
||||||
];
|
];
|
||||||
|
|
||||||
function removeScss(path) {
|
function removeScss(path) {
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/react": "^18.3.3",
|
"@types/react": "^18.3.3",
|
||||||
"@types/react-dom": "^18.3.0",
|
"@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",
|
"@vitejs/plugin-react-refresh": "^1.3.6",
|
||||||
"fs-extra": "^11.3.1",
|
"fs-extra": "^11.3.1",
|
||||||
"typescript": "catalog:",
|
"typescript": "catalog:",
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ import { defineConfig } from 'vite';
|
|||||||
|
|
||||||
import baseConfig from '../vite.config';
|
import baseConfig from '../vite.config';
|
||||||
|
|
||||||
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
|
||||||
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
...baseConfig,
|
...baseConfig,
|
||||||
|
|
||||||
@@ -18,15 +15,5 @@ export default defineConfig({
|
|||||||
emptyOutDir: false,
|
emptyOutDir: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
outDir: '../dist/page',
|
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';
|
import baseConfig from '../vite.config';
|
||||||
|
|
||||||
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
|
||||||
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
...baseConfig,
|
...baseConfig,
|
||||||
|
|
||||||
@@ -18,15 +15,5 @@ export default defineConfig({
|
|||||||
emptyOutDir: false,
|
emptyOutDir: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
outDir: '../dist/playground',
|
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: {
|
build: {
|
||||||
rollupOptions: {
|
rolldownOptions: {
|
||||||
input: {
|
input: {
|
||||||
page: path.resolve(__dirname, './page/index.html'),
|
page: path.resolve(__dirname, './page/index.html'),
|
||||||
playground: path.resolve(__dirname, './playground/index.html'),
|
playground: path.resolve(__dirname, './playground/index.html'),
|
||||||
|
|||||||
@@ -26,15 +26,13 @@
|
|||||||
"@tmagic/cli": "1.7.7",
|
"@tmagic/cli": "1.7.7",
|
||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/node": "^24.0.10",
|
"@types/node": "^24.0.10",
|
||||||
"@vitejs/plugin-legacy": "^7.2.1",
|
"@vitejs/plugin-legacy": "^8.0.0",
|
||||||
"@vitejs/plugin-vue": "^6.0.2",
|
"@vitejs/plugin-vue": "^6.0.5",
|
||||||
"@vitejs/plugin-vue-jsx": "^5.1.2",
|
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
||||||
"@vue/compiler-sfc": "catalog:",
|
"@vue/compiler-sfc": "catalog:",
|
||||||
"fs-extra": "^11.3.1",
|
"fs-extra": "^11.3.1",
|
||||||
"minimist": "^1.2.8",
|
"minimist": "^1.2.8",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"rollup": "4.44.1",
|
|
||||||
"rollup-plugin-external-globals": "^0.13.0",
|
|
||||||
"terser": "^5.44.1",
|
"terser": "^5.44.1",
|
||||||
"typescript": "catalog:",
|
"typescript": "catalog:",
|
||||||
"vite": "catalog:"
|
"vite": "catalog:"
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ import { defineConfig } from 'vite';
|
|||||||
|
|
||||||
import baseConfig from '../vite.config';
|
import baseConfig from '../vite.config';
|
||||||
|
|
||||||
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
|
||||||
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
...baseConfig,
|
...baseConfig,
|
||||||
|
|
||||||
@@ -16,15 +13,5 @@ export default defineConfig({
|
|||||||
emptyOutDir: false,
|
emptyOutDir: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
outDir: '../dist/page',
|
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';
|
import baseConfig from '../vite.config';
|
||||||
|
|
||||||
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
|
||||||
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
...baseConfig,
|
...baseConfig,
|
||||||
|
|
||||||
@@ -16,15 +13,5 @@ export default defineConfig({
|
|||||||
emptyOutDir: false,
|
emptyOutDir: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
outDir: '../dist/playground',
|
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: {
|
build: {
|
||||||
rollupOptions: {
|
rolldownOptions: {
|
||||||
input: {
|
input: {
|
||||||
page: path.resolve(__dirname, './page/index.html'),
|
page: path.resolve(__dirname, './page/index.html'),
|
||||||
playground: path.resolve(__dirname, './playground/index.html'),
|
playground: path.resolve(__dirname, './playground/index.html'),
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ async function build({ packageName, format, pkg, packagesDir }) {
|
|||||||
cssFileName: 'style',
|
cssFileName: 'style',
|
||||||
},
|
},
|
||||||
|
|
||||||
rollupOptions: {
|
rolldownOptions: {
|
||||||
// 确保外部化处理那些你不想打包进库的依赖
|
// 确保外部化处理那些你不想打包进库的依赖
|
||||||
external(id) {
|
external(id) {
|
||||||
if (format === 'umd' && id === 'lodash-es') {
|
if (format === 'umd' && id === 'lodash-es') {
|
||||||
|
|||||||
Reference in New Issue
Block a user