From dc1ad0fd4971aed618c4144de9b933400c64028c Mon Sep 17 00:00:00 2001 From: rhlin Date: Sat, 11 May 2024 12:28:53 -0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A0=B9=E6=8D=AE=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E4=BF=AE=E6=94=B9=E5=87=BD=E6=95=B0=E5=90=8D?= =?UTF-8?q?=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/design-core/scripts/localCdnFile/copyBundleDeps.js | 5 ++--- packages/design-core/scripts/localCdnFile/copyImportMap.js | 4 ++-- .../design-core/scripts/localCdnFile/copyPreviewImportMap.js | 5 ++--- .../design-core/scripts/localCdnFile/locateCdnNpmInfo.js | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/design-core/scripts/localCdnFile/copyBundleDeps.js b/packages/design-core/scripts/localCdnFile/copyBundleDeps.js index ddc2e52eb..5cb31e927 100644 --- a/packages/design-core/scripts/localCdnFile/copyBundleDeps.js +++ b/packages/design-core/scripts/localCdnFile/copyBundleDeps.js @@ -5,7 +5,7 @@ import { configServerAddProxy } from '../vite-plugins/configureServerAddProxy' import { viteStaticCopy } from 'vite-plugin-static-copy' import { getCdnPathNpmInfoForSingleFile, - analysisPackageNeedToInstallAndModifyFilesMergeToSameVersion, + getPackageNeedToInstallAndFilesUsingSameVersion, dedupeCopyFiles, copyfileToDynamicSrcMapper } from './locateCdnNpmInfo' @@ -51,8 +51,7 @@ export function copyBundleDeps( const cdnFiles = extraBundleCdnLink(bundleFile, originCdnPrefix).map((url) => getCdnPathNpmInfoForSingleFile(url, originCdnPrefix, base, dir, false, bundleTempDir) ) - const { packages: packageNeedToInstall, files } = - analysisPackageNeedToInstallAndModifyFilesMergeToSameVersion(cdnFiles) + const { packages: packageNeedToInstall, files } = getPackageNeedToInstallAndFilesUsingSameVersion(cdnFiles) const plugin = (isDev) => { return [ diff --git a/packages/design-core/scripts/localCdnFile/copyImportMap.js b/packages/design-core/scripts/localCdnFile/copyImportMap.js index 2960b91c3..35d3fb275 100644 --- a/packages/design-core/scripts/localCdnFile/copyImportMap.js +++ b/packages/design-core/scripts/localCdnFile/copyImportMap.js @@ -1,6 +1,6 @@ import { viteStaticCopy } from 'vite-plugin-static-copy' import { - analysisPackageNeedToInstallAndModifyFilesMergeToSameVersion, + getPackageNeedToInstallAndFilesUsingSameVersion, copyfileToDynamicSrcMapper, dedupeCopyFiles, getCdnPathNpmInfoForPackage, @@ -30,7 +30,7 @@ export const copyLocalImportMap = ( .filter((styleUrl) => styleUrl.startsWith(originCdnPrefix)) .map((url) => getCdnPathNpmInfoForSingleFile(url, originCdnPrefix, publicPath, dir, false), bundleTempDir) - const { packages: packageNeedToInstall, files } = analysisPackageNeedToInstallAndModifyFilesMergeToSameVersion( + const { packages: packageNeedToInstall, files } = getPackageNeedToInstallAndFilesUsingSameVersion( importMapFiles.concat(styleFiles) ) diff --git a/packages/design-core/scripts/localCdnFile/copyPreviewImportMap.js b/packages/design-core/scripts/localCdnFile/copyPreviewImportMap.js index 92feb9b2c..050a7aa5b 100644 --- a/packages/design-core/scripts/localCdnFile/copyPreviewImportMap.js +++ b/packages/design-core/scripts/localCdnFile/copyPreviewImportMap.js @@ -1,7 +1,7 @@ import path from 'node:path' import { readJsonSync } from 'fs-extra' import { - analysisPackageNeedToInstallAndModifyFilesMergeToSameVersion, + getPackageNeedToInstallAndFilesUsingSameVersion, copyfileToDynamicSrcMapper, dedupeCopyFiles, getCdnPathNpmInfoForPackage, @@ -69,8 +69,7 @@ export function copyPreviewImportMap( } return getCdnPathNpmInfoForSingleFile(url, originCdnPrefix, base, dir, false, bundleTempDir) }) - const { packages: packageNeedToInstall, files } = - analysisPackageNeedToInstallAndModifyFilesMergeToSameVersion(cdnFiles) + const { packages: packageNeedToInstall, files } = getPackageNeedToInstallAndFilesUsingSameVersion(cdnFiles) return [ ...installPackageTemporary(packageNeedToInstall, bundleTempDir), ...viteStaticCopy({ diff --git a/packages/design-core/scripts/localCdnFile/locateCdnNpmInfo.js b/packages/design-core/scripts/localCdnFile/locateCdnNpmInfo.js index 5b2429242..17ed37fbe 100644 --- a/packages/design-core/scripts/localCdnFile/locateCdnNpmInfo.js +++ b/packages/design-core/scripts/localCdnFile/locateCdnNpmInfo.js @@ -170,7 +170,7 @@ export function dedupeCopyFiles(files) { }, []) } -export function analysisPackageNeedToInstallAndModifyFilesMergeToSameVersion(files) { +export function getPackageNeedToInstallAndFilesUsingSameVersion(files) { const packageNeedToInstall = files .filter((item) => !item.sourceExist) .map(({ packageName, version, sourceExistExternal: exist }) => ({ packageName, version, exist }))