From 582fa0df842198b0a74ff53476cdcd341012991b Mon Sep 17 00:00:00 2001 From: ajaxzheng <894103554@qq.com> Date: Tue, 18 Apr 2023 23:29:35 -0700 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbuild:ui=E6=89=93=E5=8C=85?= =?UTF-8?q?=E5=87=BA=E6=9D=A5=E7=9A=84=E4=BA=A7=E7=89=A9=E6=9C=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98bug=EF=BC=8C=E4=BF=AE=E5=A4=8Dinput=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E5=BC=80=E5=8F=91=E6=8A=A5=E8=AD=A6=E5=91=8A?= =?UTF-8?q?bug=20(#150)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(grid): 修复cropperjs依赖超期的问题 * fix(build): 修复打包文件出错问题 * fix(input): 修复input组件本地开发报警告问题 --- internals/cli/src/commands/build/build-ui.ts | 69 ++++++++++---------- packages/vue/src/crop/package.json | 6 +- packages/vue/src/input/src/index.ts | 5 +- 3 files changed, 39 insertions(+), 41 deletions(-) diff --git a/internals/cli/src/commands/build/build-ui.ts b/internals/cli/src/commands/build/build-ui.ts index ac7483e29..284831ffa 100644 --- a/internals/cli/src/commands/build/build-ui.ts +++ b/internals/cli/src/commands/build/build-ui.ts @@ -64,33 +64,33 @@ export const getBaseConfig = ({ vueVersion, dtsInclude, dts, buildTarget, themeV ...getVuePlugins(vueVersion), dts ? dtsPlugin({ - root: pathFromWorkspaceRoot(), - tsConfigFilePath: `tsconfig.vue${vueVersion}.json`, - aliasesExclude: [/@opentiny\/vue.+/], - compilerOptions: { - paths: { - ...compilerOptions.paths, - // 一定要映射到 packages/vue 下对应的 vue 版本和 @vue/composition-api 才能正确生成 dts - 'vue': [`packages/vue/node_modules/vue${vueVersion}`], - '@vue/runtime-core': ['packages/vue/node_modules/@vue/runtime-core'], - '@vue/runtime-dom': ['packages/vue/node_modules/@vue/runtime-dom'], - '@vue/composition-api': ['packages/vue/node_modules/@vue/composition-api'] + root: pathFromWorkspaceRoot(), + tsConfigFilePath: `tsconfig.vue${vueVersion}.json`, + aliasesExclude: [/@opentiny\/vue.+/], + compilerOptions: { + paths: { + ...compilerOptions.paths, + // 一定要映射到 packages/vue 下对应的 vue 版本和 @vue/composition-api 才能正确生成 dts + 'vue': [`packages/vue/node_modules/vue${vueVersion}`], + '@vue/runtime-core': ['packages/vue/node_modules/@vue/runtime-core'], + '@vue/runtime-dom': ['packages/vue/node_modules/@vue/runtime-dom'], + '@vue/composition-api': ['packages/vue/node_modules/@vue/composition-api'] + } + }, + include: [...dtsInclude, 'packages/vue/*.d.ts'], + // 忽略类型检查错误,保证生成不会阻断 + skipDiagnostics: true, + beforeWriteFile: (filePath, content) => { + return { + // "vue/src/alert/index.d.ts" ==> "alert/index.d.ts" + filePath: filePath.replace('/vue/src', '').replace('\\vue\\src', ''), + content: content + // vue 2.7 还不能正常识别 vue-common + .replace(/import\('[./]+vue-common.+'\)/, 'import("vue")') + .replace(/\("vue[1-9\.]+/g, '("vue') + } } - }, - include: [...dtsInclude, 'packages/vue/*.d.ts'], - // 忽略类型检查错误,保证生成不会阻断 - skipDiagnostics: true, - beforeWriteFile: (filePath, content) => { - return { - // "vue/src/alert/index.d.ts" ==> "alert/index.d.ts" - filePath: filePath.replace('/vue/src', '').replace('\\vue\\src', ''), - content: content - // vue 2.7 还不能正常识别 vue-common - .replace(/import\('[./]+vue-common.+'\)/, 'import("vue")') - .replace(/\("vue[1-9\.]+/g, '("vue') - } - } - }) + }) : undefined, inlineChunksPlugin({ deleteInlinedFiles: true }), generatePackageJsonPlugin({ @@ -191,8 +191,6 @@ async function batchBuildAll({ vueVersion, tasks, formats, message, emptyOutDir, utils.logGreen(`====== 开始构建 ${message} ======`) const entry = toEntry(tasks) - const entryPathSet = new Set(Object.values(entry)) - const dtsInclude = toTsInclude(tasks) await build({ configFile: false, @@ -212,12 +210,6 @@ async function batchBuildAll({ vueVersion, tasks, formats, message, emptyOutDir, return false } - // 模块作为入口时不需要通过external分离 - const srcPath = path.resolve(importer, '..', source.split('?')[0]) - if (entryPathSet.has(srcPath)) { - return false - } - // 图标入口排除子图标 if (/vue-icon\/(index|lowercase)/.test(importer)) { return /^\.\//.test(source) @@ -306,7 +298,14 @@ function getTasks(names: string[]): Module[] { export async function buildUi( names: string[] = [], - { vueVersions = ['2', '3'], buildTarget = '8.0', formats = ['es'], clean = false, dts = true, themeVersion }: BuildUiOption + { + vueVersions = ['2', '3'], + buildTarget = '8.0', + formats = ['es'], + clean = false, + dts = true, + themeVersion + }: BuildUiOption ) { // 是否清空构建目录 let emptyOutDir = clean diff --git a/packages/vue/src/crop/package.json b/packages/vue/src/crop/package.json index 479d29e58..3e039d2de 100644 --- a/packages/vue/src/crop/package.json +++ b/packages/vue/src/crop/package.json @@ -4,11 +4,11 @@ "description": "", "main": "lib/index.js", "module": "index.ts", - "devDependencies": { + "devDependencies": { "@opentiny-internal/vue-test-utils": "workspace:*", "vitest": "^0.25.7" }, - "scripts": { + "scripts": { "build": "pnpm -w build:ui $npm_package_name", "//postversion": "pnpm build" }, @@ -16,7 +16,7 @@ "@opentiny/vue-common": "workspace:~", "@opentiny/vue-renderless": "workspace:~", "@opentiny/vue-icon": "workspace:~", - "cropperjs": "1.5.7" + "cropperjs": "1.5.13" }, "license": "MIT" } diff --git a/packages/vue/src/input/src/index.ts b/packages/vue/src/input/src/index.ts index 86b7dd97b..a2e650c7f 100644 --- a/packages/vue/src/input/src/index.ts +++ b/packages/vue/src/input/src/index.ts @@ -73,7 +73,7 @@ export default defineComponent({ }, contentStyle: { type: Object, - default: {} + default: () => ({}) }, isSelect: { type: Boolean, @@ -121,5 +121,4 @@ export default defineComponent({ setup(props, context) { return $setup({ props, context, template }) } -} -) +})