From 6936d0c1f845a46a7be3addb9cbfbb1682fe81fa Mon Sep 17 00:00:00 2001 From: luhc228 Date: Thu, 14 Sep 2023 10:40:41 +0800 Subject: [PATCH 1/7] feat: support modify vendors name --- packages/pkg/src/helpers/getRollupOptions.ts | 10 +++++++--- packages/pkg/src/types.ts | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/pkg/src/helpers/getRollupOptions.ts b/packages/pkg/src/helpers/getRollupOptions.ts index a1cbc9b1..079befa7 100644 --- a/packages/pkg/src/helpers/getRollupOptions.ts +++ b/packages/pkg/src/helpers/getRollupOptions.ts @@ -165,12 +165,16 @@ function getRollupOutputs({ esVersion, command, }: GetRollupOutputsOptions): OutputOptions[] { - const { outputDir } = bundleTaskConfig; + const defaultVendorsName = 'vendors'; + const { outputDir, modifyVendorsName = (vendorsName: string) => vendorsName } = bundleTaskConfig; const outputFormats = (bundleTaskConfig.formats || []).filter((format) => format !== 'es2017') as Array<'umd' | 'esm' | 'cjs'>; const name = bundleTaskConfig.name ?? pkg.name; const minify = bundleTaskConfig.jsMinify(mode, command); + + const vendorsName = modifyVendorsName(defaultVendorsName); + return outputFormats.map((format) => ({ name, format, @@ -183,7 +187,7 @@ function getRollupOutputs({ chunkFileNames: getFilename('[name]', format, esVersion, mode, 'js'), manualChunks: format !== 'umd' ? (id, { getModuleInfo }) => { if (/node_modules/.test(id)) { - return 'vendor'; + return vendorsName; } const entryPoints = []; @@ -204,7 +208,7 @@ function getRollupOutputs({ } // For multiple entries, we put it into a "shared code" bundle if (entryPoints.length > 1) { - return 'vendor'; + return vendorsName; } } : undefined, plugins: [ diff --git a/packages/pkg/src/types.ts b/packages/pkg/src/types.ts index 5d239d94..303c9d12 100644 --- a/packages/pkg/src/types.ts +++ b/packages/pkg/src/types.ts @@ -218,6 +218,8 @@ export interface BundleTaskConfig extends jsMinify?: (mode: string, command: string) => JSMinify; cssMinify?: (mode: string, command: string) => CSSMinify; + + modifyVendorsName?: (defaultVendorsName: string) => string; } export interface TransformTaskConfig extends _TaskConfig, TransformUserConfig { From 1de94aaa837cd6d861fb8dd31a7bc8ddc34d6aeb Mon Sep 17 00:00:00 2001 From: luhc228 Date: Thu, 14 Sep 2023 10:41:15 +0800 Subject: [PATCH 2/7] chore: changeset --- .changeset/hip-oranges-reflect.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/hip-oranges-reflect.md diff --git a/.changeset/hip-oranges-reflect.md b/.changeset/hip-oranges-reflect.md new file mode 100644 index 00000000..43ad2c65 --- /dev/null +++ b/.changeset/hip-oranges-reflect.md @@ -0,0 +1,5 @@ +--- +'@ice/pkg': patch +--- + +feat: support modify vendors name From e10747cf25d6fa511fbbc12fb917696ac4fa60c9 Mon Sep 17 00:00:00 2001 From: luhc228 Date: Thu, 14 Sep 2023 10:58:29 +0800 Subject: [PATCH 3/7] chore: update --- packages/pkg/src/helpers/getRollupOptions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pkg/src/helpers/getRollupOptions.ts b/packages/pkg/src/helpers/getRollupOptions.ts index 079befa7..908cc4a1 100644 --- a/packages/pkg/src/helpers/getRollupOptions.ts +++ b/packages/pkg/src/helpers/getRollupOptions.ts @@ -165,7 +165,7 @@ function getRollupOutputs({ esVersion, command, }: GetRollupOutputsOptions): OutputOptions[] { - const defaultVendorsName = 'vendors'; + const defaultVendorsName = 'vendor'; const { outputDir, modifyVendorsName = (vendorsName: string) => vendorsName } = bundleTaskConfig; const outputFormats = (bundleTaskConfig.formats || []).filter((format) => format !== 'es2017') as Array<'umd' | 'esm' | 'cjs'>; From 27f06423bac34c4a3827648abb573f5b7b940e7a Mon Sep 17 00:00:00 2001 From: luhc228 Date: Fri, 15 Sep 2023 17:01:33 +0800 Subject: [PATCH 4/7] fix: vendors -> vendor --- packages/pkg/src/helpers/getRollupOptions.ts | 10 +++++----- packages/pkg/src/types.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/pkg/src/helpers/getRollupOptions.ts b/packages/pkg/src/helpers/getRollupOptions.ts index 908cc4a1..3af6da4d 100644 --- a/packages/pkg/src/helpers/getRollupOptions.ts +++ b/packages/pkg/src/helpers/getRollupOptions.ts @@ -165,15 +165,15 @@ function getRollupOutputs({ esVersion, command, }: GetRollupOutputsOptions): OutputOptions[] { - const defaultVendorsName = 'vendor'; - const { outputDir, modifyVendorsName = (vendorsName: string) => vendorsName } = bundleTaskConfig; + const defaultVendorName = 'vendor'; + const { outputDir, modifyVendorName = (vendorName: string) => vendorName } = bundleTaskConfig; const outputFormats = (bundleTaskConfig.formats || []).filter((format) => format !== 'es2017') as Array<'umd' | 'esm' | 'cjs'>; const name = bundleTaskConfig.name ?? pkg.name; const minify = bundleTaskConfig.jsMinify(mode, command); - const vendorsName = modifyVendorsName(defaultVendorsName); + const vendorName = modifyVendorName(defaultVendorName); return outputFormats.map((format) => ({ name, @@ -187,7 +187,7 @@ function getRollupOutputs({ chunkFileNames: getFilename('[name]', format, esVersion, mode, 'js'), manualChunks: format !== 'umd' ? (id, { getModuleInfo }) => { if (/node_modules/.test(id)) { - return vendorsName; + return vendorName; } const entryPoints = []; @@ -208,7 +208,7 @@ function getRollupOutputs({ } // For multiple entries, we put it into a "shared code" bundle if (entryPoints.length > 1) { - return vendorsName; + return vendorName; } } : undefined, plugins: [ diff --git a/packages/pkg/src/types.ts b/packages/pkg/src/types.ts index 303c9d12..be3f02c2 100644 --- a/packages/pkg/src/types.ts +++ b/packages/pkg/src/types.ts @@ -219,7 +219,7 @@ export interface BundleTaskConfig extends cssMinify?: (mode: string, command: string) => CSSMinify; - modifyVendorsName?: (defaultVendorsName: string) => string; + modifyVendorName?: (defaultVendorName: string) => string; } export interface TransformTaskConfig extends _TaskConfig, TransformUserConfig { From 23a6f61663c4dc47bc8b8a597a051d7a534af6ce Mon Sep 17 00:00:00 2001 From: luhc228 Date: Fri, 15 Sep 2023 17:05:11 +0800 Subject: [PATCH 5/7] chore: update changelog --- .changeset/hip-oranges-reflect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/hip-oranges-reflect.md b/.changeset/hip-oranges-reflect.md index 43ad2c65..6c4d1e11 100644 --- a/.changeset/hip-oranges-reflect.md +++ b/.changeset/hip-oranges-reflect.md @@ -2,4 +2,4 @@ '@ice/pkg': patch --- -feat: support modify vendors name +feat: support modify vendor name From 8c037b9d562b9b9844a025bbd89f583484f54929 Mon Sep 17 00:00:00 2001 From: luhc228 Date: Fri, 22 Sep 2023 11:23:09 +0800 Subject: [PATCH 6/7] fix: comment --- packages/pkg/src/helpers/getRollupOptions.ts | 5 +---- packages/pkg/src/types.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/pkg/src/helpers/getRollupOptions.ts b/packages/pkg/src/helpers/getRollupOptions.ts index 3af6da4d..a4166252 100644 --- a/packages/pkg/src/helpers/getRollupOptions.ts +++ b/packages/pkg/src/helpers/getRollupOptions.ts @@ -165,16 +165,13 @@ function getRollupOutputs({ esVersion, command, }: GetRollupOutputsOptions): OutputOptions[] { - const defaultVendorName = 'vendor'; - const { outputDir, modifyVendorName = (vendorName: string) => vendorName } = bundleTaskConfig; + const { outputDir, vendorName = 'vendor' } = bundleTaskConfig; const outputFormats = (bundleTaskConfig.formats || []).filter((format) => format !== 'es2017') as Array<'umd' | 'esm' | 'cjs'>; const name = bundleTaskConfig.name ?? pkg.name; const minify = bundleTaskConfig.jsMinify(mode, command); - const vendorName = modifyVendorName(defaultVendorName); - return outputFormats.map((format) => ({ name, format, diff --git a/packages/pkg/src/types.ts b/packages/pkg/src/types.ts index be3f02c2..8c74318d 100644 --- a/packages/pkg/src/types.ts +++ b/packages/pkg/src/types.ts @@ -219,7 +219,7 @@ export interface BundleTaskConfig extends cssMinify?: (mode: string, command: string) => CSSMinify; - modifyVendorName?: (defaultVendorName: string) => string; + vendorName?: string; } export interface TransformTaskConfig extends _TaskConfig, TransformUserConfig { From 4e4dff74972b56d8162a3c95c5bc9b682b45ea4f Mon Sep 17 00:00:00 2001 From: luhc228 Date: Mon, 25 Sep 2023 11:28:15 +0800 Subject: [PATCH 7/7] chore: version and changelog --- .changeset/hip-oranges-reflect.md | 5 ----- packages/pkg/CHANGELOG.md | 6 ++++++ packages/pkg/package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/hip-oranges-reflect.md diff --git a/.changeset/hip-oranges-reflect.md b/.changeset/hip-oranges-reflect.md deleted file mode 100644 index 6c4d1e11..00000000 --- a/.changeset/hip-oranges-reflect.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@ice/pkg': patch ---- - -feat: support modify vendor name diff --git a/packages/pkg/CHANGELOG.md b/packages/pkg/CHANGELOG.md index 0e6a954d..e3e0da54 100644 --- a/packages/pkg/CHANGELOG.md +++ b/packages/pkg/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.5.13 + +### Patch Changes + +- 1de94aa: feat: support modify vendor name + ## 1.5.12 ### Patch Changes diff --git a/packages/pkg/package.json b/packages/pkg/package.json index 09a40b2a..07e3705a 100644 --- a/packages/pkg/package.json +++ b/packages/pkg/package.json @@ -1,6 +1,6 @@ { "name": "@ice/pkg", - "version": "1.5.12", + "version": "1.5.13", "description": "A fast builder for React components, Node modules and web libraries.", "type": "module", "main": "./lib/index.js",