@cypress-design/vue-icon 3.3.0 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/generate-icons.js CHANGED
@@ -26,11 +26,14 @@ const iconsComponents = Object.keys(iconsMetadata).map((name) => {
26
26
  return acc
27
27
  }, {})
28
28
 
29
+ // The PURE annotation lets bundlers drop icons the consumer never imports.
30
+ // Without it, each defineComponent() call is assumed to have side effects
31
+ // and every icon (plus the whole icon registry) ends up in the bundle.
29
32
  return dedent`
30
- export const Icon${pascalCaseName} = defineComponent<Omit<iconsRegistry.Icon${pascalCaseName}Props, 'name'> & {
33
+ export const Icon${pascalCaseName} = /* @__PURE__ */ defineComponent<Omit<iconsRegistry.Icon${pascalCaseName}Props, 'name'> & {
31
34
  class?: any
32
35
  }>({
33
- ...__iconComponentOpts__,
36
+ props: __iconComponentProps__,
34
37
  setup(props: iconsRegistry.NamelessIcon${pascalCaseName}Props & {
35
38
  class?: any
36
39
  }, { attrs }: { attrs: Omit<SVGAttributes, 'name' | 'class'> }) {
@@ -60,9 +63,13 @@ import type { ComputedRef, SVGAttributes, Ref } from 'vue'
60
63
  import * as iconsRegistry from '@cypress-design/icon-registry'
61
64
  import { compileVueIconProperties, useShouldRenderDefs } from './compileProperties'
62
65
 
63
- const __iconComponentOpts__ = {
64
- props: [...iconsRegistry.ICON_COLOR_PROP_NAMES, 'interactiveColorsOnGroup', 'size', 'class', 'alt'] as string[],
65
- } as any
66
+ // Shared by every icon. Referenced directly (not spread into the options) and
67
+ // built with a PURE concat() rather than an array spread, so esbuild and
68
+ // rollup can prove the module has no top-level side effects and drop unused
69
+ // icons along with the rest of the icon registry.
70
+ const __iconComponentProps__ = /* @__PURE__ */ (
71
+ iconsRegistry.ICON_COLOR_PROP_NAMES as readonly string[]
72
+ ).concat(['interactiveColorsOnGroup', 'size', 'class', 'alt']) as any
66
73
 
67
74
  function useIconProps(props: SVGAttributes & Omit<iconsRegistry.IconProps, 'name'>, iconBodiesAndDefs: Record<string, {body: string, defs?: string}>, availableSizes: string[], name: string) {
68
75
  return computed(() => {
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@cypress-design/vue-icon",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
4
4
  "files": [
5
5
  "*"
6
6
  ],
7
+ "sideEffects": false,
7
8
  "typings": "./dist/index.d.ts",
8
9
  "main": "./dist/index.umd.js",
9
10
  "module": "./dist/index.es.mjs",
@@ -21,7 +22,7 @@
21
22
  "build:types": "yarn exec vue-tsc --project ./tsconfig.build.json"
22
23
  },
23
24
  "dependencies": {
24
- "@cypress-design/icon-registry": "^3.3.0"
25
+ "@cypress-design/icon-registry": "^3.3.2"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@cypress-design/rollup-plugin-tailwind-keep": "*",