@yahoo/uds 3.116.1 → 3.116.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/dist/components/client/BottomSheet/BottomSheet.cjs +37 -8
- package/dist/components/client/BottomSheet/BottomSheet.js +38 -9
- package/dist/components/client/BottomSheet/BottomSheetContent.cjs +4 -2
- package/dist/components/client/BottomSheet/BottomSheetContent.js +4 -2
- package/dist/components/client/BottomSheet/BottomSheetInternalContext.cjs +15 -0
- package/dist/components/client/BottomSheet/BottomSheetInternalContext.d.cts +12 -0
- package/dist/components/client/BottomSheet/BottomSheetInternalContext.d.ts +12 -0
- package/dist/components/client/BottomSheet/BottomSheetInternalContext.js +12 -0
- package/dist/styles/styler.d.cts +44 -44
- package/dist/styles/styler.d.ts +44 -44
- package/dist/tailwind/dist/css/generate.cjs +6 -0
- package/dist/tailwind/dist/css/generate.helpers.cjs +5 -1
- package/dist/tailwind/dist/css/generate.helpers.js +5 -1
- package/dist/tailwind/dist/css/generate.js +6 -0
- package/dist/tailwind/dist/css/nodeUtils.cjs +2 -1
- package/dist/tailwind/dist/css/nodeUtils.js +2 -1
- package/dist/tailwind/dist/purger/optimized/ast/expressions.cjs +103 -1
- package/dist/tailwind/dist/purger/optimized/ast/expressions.js +102 -2
- package/dist/tailwind/dist/purger/optimized/ast/jsx.cjs +7 -1
- package/dist/tailwind/dist/purger/optimized/ast/jsx.js +7 -1
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.cjs +18 -13
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.js +18 -13
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.cjs +2 -1
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js +2 -1
- package/dist/uds/generated/componentData.cjs +79 -60
- package/dist/uds/generated/componentData.js +74 -61
- package/dist/uds/generated/tailwindPurge.cjs +7 -7
- package/dist/uds/generated/tailwindPurge.js +7 -7
- package/generated/componentData.json +97 -82
- package/generated/tailwindPurge.ts +2 -2
- package/package.json +1 -1
package/dist/styles/styler.d.ts
CHANGED
|
@@ -23,8 +23,8 @@ declare const getStylesInternal: (props?: ({
|
|
|
23
23
|
bottomsheetVariantRoot?: "default" | undefined;
|
|
24
24
|
buttonSizeIcon?: "xs" | "sm" | "md" | "lg" | "default" | undefined;
|
|
25
25
|
buttonSizeRoot?: "xs" | "sm" | "md" | "lg" | "default" | undefined;
|
|
26
|
-
buttonVariantIcon?: "primary" | "secondary" | "
|
|
27
|
-
buttonVariantRoot?: "primary" | "secondary" | "
|
|
26
|
+
buttonVariantIcon?: "primary" | "secondary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "tertiary" | "default" | "alert-tertiary" | "brand-tertiary" | "contrast-high" | "contrast-low" | "contrast-medium" | "info-tertiary" | "positive-tertiary" | "warning-tertiary" | undefined;
|
|
27
|
+
buttonVariantRoot?: "primary" | "secondary" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "tertiary" | "default" | "alert-tertiary" | "brand-tertiary" | "contrast-high" | "contrast-low" | "contrast-medium" | "info-tertiary" | "positive-tertiary" | "warning-tertiary" | undefined;
|
|
28
28
|
checkboxSizeCheckbox?: "sm" | "md" | "default" | undefined;
|
|
29
29
|
checkboxSizeRoot?: "sm" | "md" | "default" | undefined;
|
|
30
30
|
checkboxVariantCheckbox?: "primary" | "secondary" | "alert" | "alert-secondary" | "default" | undefined;
|
|
@@ -143,76 +143,76 @@ declare const getStylesInternal: (props?: ({
|
|
|
143
143
|
tooltipVariantIcon?: "default" | undefined;
|
|
144
144
|
tooltipVariantRoot?: "default" | undefined;
|
|
145
145
|
tooltipVariantSvg?: "default" | undefined;
|
|
146
|
-
color?: "primary" | "secondary" | "
|
|
147
|
-
placeholderColor?: "primary" | "secondary" | "
|
|
146
|
+
color?: "primary" | "secondary" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "tertiary" | "muted" | "on-color" | undefined;
|
|
147
|
+
placeholderColor?: "primary" | "secondary" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "tertiary" | "muted" | "on-color" | undefined;
|
|
148
148
|
fontFamily?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | "display1/emphasized" | "display2/emphasized" | "display3/emphasized" | "title1/emphasized" | "title2/emphasized" | "title3/emphasized" | "title4/emphasized" | "headline1/emphasized" | "body1/emphasized" | "label1/emphasized" | "label2/emphasized" | "label3/emphasized" | "label4/emphasized" | "caption1/emphasized" | "caption2/emphasized" | "legal1/emphasized" | "ui1/emphasized" | "ui2/emphasized" | "ui3/emphasized" | "ui4/emphasized" | "ui5/emphasized" | "ui6/emphasized" | "sans" | "sans-alt" | "serif" | "serif-alt" | "mono" | undefined;
|
|
149
149
|
fontSize?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | "display1/emphasized" | "display2/emphasized" | "display3/emphasized" | "title1/emphasized" | "title2/emphasized" | "title3/emphasized" | "title4/emphasized" | "headline1/emphasized" | "body1/emphasized" | "label1/emphasized" | "label2/emphasized" | "label3/emphasized" | "label4/emphasized" | "caption1/emphasized" | "caption2/emphasized" | "legal1/emphasized" | "ui1/emphasized" | "ui2/emphasized" | "ui3/emphasized" | "ui4/emphasized" | "ui5/emphasized" | "ui6/emphasized" | undefined;
|
|
150
|
-
fontWeight?: "
|
|
150
|
+
fontWeight?: "black" | "thin" | "medium" | "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | "display1/emphasized" | "display2/emphasized" | "display3/emphasized" | "title1/emphasized" | "title2/emphasized" | "title3/emphasized" | "title4/emphasized" | "headline1/emphasized" | "body1/emphasized" | "label1/emphasized" | "label2/emphasized" | "label3/emphasized" | "label4/emphasized" | "caption1/emphasized" | "caption2/emphasized" | "legal1/emphasized" | "ui1/emphasized" | "ui2/emphasized" | "ui3/emphasized" | "ui4/emphasized" | "ui5/emphasized" | "ui6/emphasized" | "bold" | "extralight" | "light" | "regular" | "semibold" | "extrabold" | undefined;
|
|
151
151
|
lineHeight?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | "display1/emphasized" | "display2/emphasized" | "display3/emphasized" | "title1/emphasized" | "title2/emphasized" | "title3/emphasized" | "title4/emphasized" | "headline1/emphasized" | "body1/emphasized" | "label1/emphasized" | "label2/emphasized" | "label3/emphasized" | "label4/emphasized" | "caption1/emphasized" | "caption2/emphasized" | "legal1/emphasized" | "ui1/emphasized" | "ui2/emphasized" | "ui3/emphasized" | "ui4/emphasized" | "ui5/emphasized" | "ui6/emphasized" | undefined;
|
|
152
152
|
letterSpacing?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | "display1/emphasized" | "display2/emphasized" | "display3/emphasized" | "title1/emphasized" | "title2/emphasized" | "title3/emphasized" | "title4/emphasized" | "headline1/emphasized" | "body1/emphasized" | "label1/emphasized" | "label2/emphasized" | "label3/emphasized" | "label4/emphasized" | "caption1/emphasized" | "caption2/emphasized" | "legal1/emphasized" | "ui1/emphasized" | "ui2/emphasized" | "ui3/emphasized" | "ui4/emphasized" | "ui5/emphasized" | "ui6/emphasized" | undefined;
|
|
153
153
|
textAlign?: "start" | "end" | "center" | "justify" | undefined;
|
|
154
|
-
textTransform?: "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | "display1/emphasized" | "display2/emphasized" | "display3/emphasized" | "title1/emphasized" | "title2/emphasized" | "title3/emphasized" | "title4/emphasized" | "headline1/emphasized" | "body1/emphasized" | "label1/emphasized" | "label2/emphasized" | "label3/emphasized" | "label4/emphasized" | "caption1/emphasized" | "caption2/emphasized" | "legal1/emphasized" | "ui1/emphasized" | "ui2/emphasized" | "ui3/emphasized" | "ui4/emphasized" | "ui5/emphasized" | "ui6/emphasized" | "
|
|
155
|
-
spacing?: "0" | "
|
|
156
|
-
spacingHorizontal?: "0" | "
|
|
157
|
-
spacingVertical?: "0" | "
|
|
158
|
-
spacingBottom?: "0" | "
|
|
159
|
-
spacingEnd?: "0" | "
|
|
160
|
-
spacingStart?: "0" | "
|
|
161
|
-
spacingTop?: "0" | "
|
|
162
|
-
offset?: "0" | "
|
|
163
|
-
offsetVertical?: "0" | "
|
|
164
|
-
offsetHorizontal?: "0" | "
|
|
165
|
-
offsetBottom?: "0" | "
|
|
166
|
-
offsetEnd?: "0" | "
|
|
167
|
-
offsetStart?: "0" | "
|
|
168
|
-
offsetTop?: "0" | "
|
|
169
|
-
columnGap?: "0" | "
|
|
170
|
-
rowGap?: "0" | "
|
|
154
|
+
textTransform?: "none" | "display1" | "display2" | "display3" | "title1" | "title2" | "title3" | "title4" | "headline1" | "body1" | "label1" | "label2" | "label3" | "label4" | "caption1" | "caption2" | "legal1" | "ui1" | "ui2" | "ui3" | "ui4" | "ui5" | "ui6" | "display1/emphasized" | "display2/emphasized" | "display3/emphasized" | "title1/emphasized" | "title2/emphasized" | "title3/emphasized" | "title4/emphasized" | "headline1/emphasized" | "body1/emphasized" | "label1/emphasized" | "label2/emphasized" | "label3/emphasized" | "label4/emphasized" | "caption1/emphasized" | "caption2/emphasized" | "legal1/emphasized" | "ui1/emphasized" | "ui2/emphasized" | "ui3/emphasized" | "ui4/emphasized" | "ui5/emphasized" | "ui6/emphasized" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
155
|
+
spacing?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
156
|
+
spacingHorizontal?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
157
|
+
spacingVertical?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
158
|
+
spacingBottom?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
159
|
+
spacingEnd?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
160
|
+
spacingStart?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
161
|
+
spacingTop?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
162
|
+
offset?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
163
|
+
offsetVertical?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
164
|
+
offsetHorizontal?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
165
|
+
offsetBottom?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
166
|
+
offsetEnd?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
167
|
+
offsetStart?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
168
|
+
offsetTop?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
169
|
+
columnGap?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
170
|
+
rowGap?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
171
171
|
backgroundColor?: "primary" | "secondary" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | undefined;
|
|
172
|
-
borderColor?: "primary" | "secondary" | "
|
|
173
|
-
borderStartColor?: "primary" | "secondary" | "
|
|
174
|
-
borderEndColor?: "primary" | "secondary" | "
|
|
175
|
-
borderBottomColor?: "primary" | "secondary" | "
|
|
176
|
-
borderTopColor?: "primary" | "secondary" | "
|
|
172
|
+
borderColor?: "primary" | "secondary" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "tertiary" | "muted" | undefined;
|
|
173
|
+
borderStartColor?: "primary" | "secondary" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "tertiary" | "muted" | undefined;
|
|
174
|
+
borderEndColor?: "primary" | "secondary" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "tertiary" | "muted" | undefined;
|
|
175
|
+
borderBottomColor?: "primary" | "secondary" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "tertiary" | "muted" | undefined;
|
|
176
|
+
borderTopColor?: "primary" | "secondary" | "accent" | "brand" | "alert" | "positive" | "warning" | "info" | "brand-secondary" | "alert-secondary" | "positive-secondary" | "warning-secondary" | "info-secondary" | "white" | "black" | "transparent" | "current" | "always/white" | "always/black" | "always/transparent" | "always/current" | "always/brand" | "always/accent" | "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "tertiary" | "muted" | undefined;
|
|
177
177
|
borderRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
178
178
|
borderTopStartRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
179
179
|
borderTopEndRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
180
180
|
borderBottomStartRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
181
181
|
borderBottomEndRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
182
|
-
borderWidth?: "
|
|
183
|
-
borderVerticalWidth?: "
|
|
184
|
-
borderHorizontalWidth?: "
|
|
185
|
-
borderStartWidth?: "
|
|
186
|
-
borderEndWidth?: "
|
|
187
|
-
borderTopWidth?: "
|
|
188
|
-
borderBottomWidth?: "
|
|
182
|
+
borderWidth?: "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "none" | "thin" | "medium" | "thick" | undefined;
|
|
183
|
+
borderVerticalWidth?: "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "none" | "thin" | "medium" | "thick" | undefined;
|
|
184
|
+
borderHorizontalWidth?: "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "none" | "thin" | "medium" | "thick" | undefined;
|
|
185
|
+
borderStartWidth?: "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "none" | "thin" | "medium" | "thick" | undefined;
|
|
186
|
+
borderEndWidth?: "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "none" | "thin" | "medium" | "thick" | undefined;
|
|
187
|
+
borderTopWidth?: "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "none" | "thin" | "medium" | "thick" | undefined;
|
|
188
|
+
borderBottomWidth?: "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "none" | "thin" | "medium" | "thick" | undefined;
|
|
189
189
|
avatarSize?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
190
190
|
iconSize?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
191
191
|
alignContent?: "center" | "flex-start" | "flex-end" | "stretch" | "space-between" | "space-around" | undefined;
|
|
192
192
|
alignItems?: "center" | "flex-start" | "flex-end" | "stretch" | "baseline" | undefined;
|
|
193
193
|
alignSelf?: "center" | "flex-start" | "flex-end" | "stretch" | "baseline" | "auto" | undefined;
|
|
194
|
-
flex?: "
|
|
194
|
+
flex?: "1" | "none" | "auto" | "initial" | undefined;
|
|
195
195
|
flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" | undefined;
|
|
196
196
|
flexGrow?: "0" | "1" | "2" | "3" | undefined;
|
|
197
197
|
flexShrink?: "0" | "1" | undefined;
|
|
198
198
|
flexWrap?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
|
|
199
199
|
justifyContent?: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | undefined;
|
|
200
200
|
flexBasis?: "min-content" | undefined;
|
|
201
|
-
display?: "flex" | "none" | "block" | "inline-block" | "inline" | "inline-flex" | "
|
|
202
|
-
overflow?: "
|
|
203
|
-
overflowX?: "
|
|
204
|
-
overflowY?: "
|
|
201
|
+
display?: "flex" | "table" | "none" | "block" | "inline-block" | "inline" | "inline-flex" | "inline-table" | "table-caption" | "table-cell" | "table-column" | "table-column-group" | "table-footer-group" | "table-header-group" | "table-row-group" | "table-row" | "flow-root" | "grid" | "contents" | undefined;
|
|
202
|
+
overflow?: "hidden" | "auto" | "clip" | "visible" | "scroll" | undefined;
|
|
203
|
+
overflowX?: "hidden" | "auto" | "clip" | "visible" | "scroll" | undefined;
|
|
204
|
+
overflowY?: "hidden" | "auto" | "clip" | "visible" | "scroll" | undefined;
|
|
205
205
|
position?: "static" | "fixed" | "absolute" | "relative" | "sticky" | undefined;
|
|
206
|
-
contentFit?: "none" | "
|
|
206
|
+
contentFit?: "none" | "fill" | "cover" | "contain" | "scale-down" | undefined;
|
|
207
207
|
colorMode?: "light" | "dark" | undefined;
|
|
208
|
-
scaleMode?: "
|
|
208
|
+
scaleMode?: "small" | "medium" | "xSmall" | "large" | "xLarge" | "xxLarge" | "xxxLarge" | undefined;
|
|
209
209
|
width?: "full" | "fit" | "screen" | undefined;
|
|
210
210
|
height?: "full" | "fit" | "screen" | undefined;
|
|
211
|
-
dropShadow?: "
|
|
211
|
+
dropShadow?: "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | undefined;
|
|
212
212
|
insetShadow?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "xs-invert" | "sm-invert" | "md-invert" | "lg-invert" | "xl-invert" | "2xl-invert" | undefined;
|
|
213
213
|
nestedBorderRadiusSize?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
214
|
-
nestedBorderRadiusWidth?: "
|
|
215
|
-
nestedBorderRadiusSpacing?: "0" | "
|
|
214
|
+
nestedBorderRadiusWidth?: "elevation-0" | "elevation-1" | "elevation-2" | "elevation-3" | "elevation-4" | "elevation-5" | "none" | "thin" | "medium" | "thick" | undefined;
|
|
215
|
+
nestedBorderRadiusSpacing?: "0" | "1" | "2" | "3" | "4" | "5" | "px" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | undefined;
|
|
216
216
|
nestedBorderRadius?: boolean | "first" | "last" | undefined;
|
|
217
217
|
} & {
|
|
218
218
|
className?: string | undefined;
|
|
@@ -23,6 +23,11 @@ const normalizeScope = (scope) => {
|
|
|
23
23
|
const trimmedScope = scope?.trim();
|
|
24
24
|
return trimmedScope ? trimmedScope : void 0;
|
|
25
25
|
};
|
|
26
|
+
const getArbitrarySafelistRawContent = (safelist) => {
|
|
27
|
+
const arbitraryClasses = safelist.filter((entry) => typeof entry === "string" && entry.includes("["));
|
|
28
|
+
if (arbitraryClasses.length === 0) return [];
|
|
29
|
+
return [`<div class="${arbitraryClasses.join(" ")}"></div>`];
|
|
30
|
+
};
|
|
26
31
|
/**
|
|
27
32
|
* Generate CSS from a safelist using Tailwind + PostCSS
|
|
28
33
|
* @param safelist - UDS component classes to include
|
|
@@ -38,6 +43,7 @@ const generateCSS = async (safelist, config, options) => {
|
|
|
38
43
|
let css = await require_generate_helpers.applyScopedColorModeFix((await (0, postcss.default)(require_generate_helpers.buildPostcssPlugins({
|
|
39
44
|
tailwindPlugin: require_generate_helpers.createTailwindPlugin({
|
|
40
45
|
contentDir,
|
|
46
|
+
rawContents: getArbitrarySafelistRawContent(safelist),
|
|
41
47
|
safelist,
|
|
42
48
|
config,
|
|
43
49
|
enablePreflight: cssFlags.enablePreflight,
|
|
@@ -34,9 +34,13 @@ const getCssFeatureFlags = (cssOptions) => {
|
|
|
34
34
|
const getContentGlobs = (contentDir) => {
|
|
35
35
|
return (Array.isArray(contentDir) ? contentDir : [contentDir]).map((dir) => require_entryPoints.hasAllowedEntryFileExtension(dir) ? dir : node_path.default.join(dir, "**/*.{js,jsx,ts,tsx}"));
|
|
36
36
|
};
|
|
37
|
+
const getRawContentEntries = (rawContents) => rawContents.map((rawContent) => ({
|
|
38
|
+
raw: rawContent,
|
|
39
|
+
extension: "html"
|
|
40
|
+
}));
|
|
37
41
|
const createTailwindPlugin = (options) => {
|
|
38
42
|
return (0, tailwindcss.default)({
|
|
39
|
-
content: getContentGlobs(options.contentDir),
|
|
43
|
+
content: [...getContentGlobs(options.contentDir), ...getRawContentEntries(options.rawContents ?? [])],
|
|
40
44
|
safelist: options.safelist,
|
|
41
45
|
corePlugins: { preflight: options.enablePreflight },
|
|
42
46
|
plugins: [require_plugin.tailwindPlugin({
|
|
@@ -27,9 +27,13 @@ const getCssFeatureFlags = (cssOptions) => {
|
|
|
27
27
|
const getContentGlobs = (contentDir) => {
|
|
28
28
|
return (Array.isArray(contentDir) ? contentDir : [contentDir]).map((dir) => hasAllowedEntryFileExtension(dir) ? dir : path.join(dir, "**/*.{js,jsx,ts,tsx}"));
|
|
29
29
|
};
|
|
30
|
+
const getRawContentEntries = (rawContents) => rawContents.map((rawContent) => ({
|
|
31
|
+
raw: rawContent,
|
|
32
|
+
extension: "html"
|
|
33
|
+
}));
|
|
30
34
|
const createTailwindPlugin = (options) => {
|
|
31
35
|
return tailwindcss({
|
|
32
|
-
content: getContentGlobs(options.contentDir),
|
|
36
|
+
content: [...getContentGlobs(options.contentDir), ...getRawContentEntries(options.rawContents ?? [])],
|
|
33
37
|
safelist: options.safelist,
|
|
34
38
|
corePlugins: { preflight: options.enablePreflight },
|
|
35
39
|
plugins: [tailwindPlugin({
|
|
@@ -19,6 +19,11 @@ const normalizeScope = (scope) => {
|
|
|
19
19
|
const trimmedScope = scope?.trim();
|
|
20
20
|
return trimmedScope ? trimmedScope : void 0;
|
|
21
21
|
};
|
|
22
|
+
const getArbitrarySafelistRawContent = (safelist) => {
|
|
23
|
+
const arbitraryClasses = safelist.filter((entry) => typeof entry === "string" && entry.includes("["));
|
|
24
|
+
if (arbitraryClasses.length === 0) return [];
|
|
25
|
+
return [`<div class="${arbitraryClasses.join(" ")}"></div>`];
|
|
26
|
+
};
|
|
22
27
|
/**
|
|
23
28
|
* Generate CSS from a safelist using Tailwind + PostCSS
|
|
24
29
|
* @param safelist - UDS component classes to include
|
|
@@ -34,6 +39,7 @@ const generateCSS = async (safelist, config, options) => {
|
|
|
34
39
|
let css = await applyScopedColorModeFix((await postcss(buildPostcssPlugins({
|
|
35
40
|
tailwindPlugin: createTailwindPlugin({
|
|
36
41
|
contentDir,
|
|
42
|
+
rawContents: getArbitrarySafelistRawContent(safelist),
|
|
37
43
|
safelist,
|
|
38
44
|
config,
|
|
39
45
|
enablePreflight: cssFlags.enablePreflight,
|
|
@@ -1,9 +1,108 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
const require_runtime = require('../../../../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let node_path = require("node:path");
|
|
4
|
+
node_path = require_runtime.__toESM(node_path);
|
|
5
|
+
let node_fs = require("node:fs");
|
|
6
|
+
node_fs = require_runtime.__toESM(node_fs);
|
|
3
7
|
let ts_morph = require("ts-morph");
|
|
4
8
|
|
|
5
9
|
//#region ../tailwind/dist/purger/optimized/ast/expressions.js
|
|
6
10
|
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
11
|
+
const importedSourceProject = new ts_morph.Project({ useInMemoryFileSystem: true });
|
|
12
|
+
const importedSourceFileCache = /* @__PURE__ */ new Map();
|
|
13
|
+
const tsConfigPathCache = /* @__PURE__ */ new Map();
|
|
14
|
+
const compilerOptionsCache = /* @__PURE__ */ new Map();
|
|
15
|
+
const hasImportQuery = (moduleSpecifier) => moduleSpecifier.includes("?");
|
|
16
|
+
const isExistingFile = (candidate) => node_fs.default.existsSync(candidate) && node_fs.default.statSync(candidate).isFile();
|
|
17
|
+
const resolveRelativeImportPath = (sourceFilePath, moduleSpecifier) => {
|
|
18
|
+
if (!node_path.default.isAbsolute(sourceFilePath) || !moduleSpecifier.startsWith(".") || hasImportQuery(moduleSpecifier)) return null;
|
|
19
|
+
const basePath = node_path.default.resolve(node_path.default.dirname(sourceFilePath), moduleSpecifier);
|
|
20
|
+
return [
|
|
21
|
+
basePath,
|
|
22
|
+
`${basePath}.ts`,
|
|
23
|
+
`${basePath}.tsx`,
|
|
24
|
+
`${basePath}.js`,
|
|
25
|
+
`${basePath}.jsx`,
|
|
26
|
+
node_path.default.join(basePath, "index.ts"),
|
|
27
|
+
node_path.default.join(basePath, "index.tsx"),
|
|
28
|
+
node_path.default.join(basePath, "index.js"),
|
|
29
|
+
node_path.default.join(basePath, "index.jsx")
|
|
30
|
+
].find((candidate) => isExistingFile(candidate)) ?? null;
|
|
31
|
+
};
|
|
32
|
+
const findNearestTypeScriptConfig = (sourceFilePath) => {
|
|
33
|
+
const sourceDir = node_path.default.dirname(sourceFilePath);
|
|
34
|
+
const cached = tsConfigPathCache.get(sourceDir);
|
|
35
|
+
if (cached !== void 0) return cached;
|
|
36
|
+
let currentDir = sourceDir;
|
|
37
|
+
while (true) {
|
|
38
|
+
const tsConfigPath = node_path.default.join(currentDir, "tsconfig.json");
|
|
39
|
+
if (isExistingFile(tsConfigPath)) {
|
|
40
|
+
tsConfigPathCache.set(sourceDir, tsConfigPath);
|
|
41
|
+
return tsConfigPath;
|
|
42
|
+
}
|
|
43
|
+
const jsConfigPath = node_path.default.join(currentDir, "jsconfig.json");
|
|
44
|
+
if (isExistingFile(jsConfigPath)) {
|
|
45
|
+
tsConfigPathCache.set(sourceDir, jsConfigPath);
|
|
46
|
+
return jsConfigPath;
|
|
47
|
+
}
|
|
48
|
+
const parentDir = node_path.default.dirname(currentDir);
|
|
49
|
+
if (parentDir === currentDir) {
|
|
50
|
+
tsConfigPathCache.set(sourceDir, null);
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
currentDir = parentDir;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const getCompilerOptionsForSourceFile = (sourceFilePath) => {
|
|
57
|
+
const configPath = findNearestTypeScriptConfig(sourceFilePath);
|
|
58
|
+
if (!configPath) return null;
|
|
59
|
+
const cached = compilerOptionsCache.get(configPath);
|
|
60
|
+
if (cached !== void 0) return cached;
|
|
61
|
+
const readResult = ts_morph.ts.readConfigFile(configPath, ts_morph.ts.sys.readFile);
|
|
62
|
+
if (readResult.error) {
|
|
63
|
+
compilerOptionsCache.set(configPath, null);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const parsed = ts_morph.ts.parseJsonConfigFileContent(readResult.config, ts_morph.ts.sys, node_path.default.dirname(configPath));
|
|
67
|
+
const compilerOptions = parsed.options.paths && !parsed.options.baseUrl ? {
|
|
68
|
+
...parsed.options,
|
|
69
|
+
baseUrl: node_path.default.dirname(configPath)
|
|
70
|
+
} : parsed.options;
|
|
71
|
+
compilerOptionsCache.set(configPath, compilerOptions);
|
|
72
|
+
return compilerOptions;
|
|
73
|
+
};
|
|
74
|
+
const resolveConfigImportPath = (sourceFilePath, moduleSpecifier) => {
|
|
75
|
+
if (hasImportQuery(moduleSpecifier)) return null;
|
|
76
|
+
const compilerOptions = getCompilerOptionsForSourceFile(sourceFilePath);
|
|
77
|
+
if (!compilerOptions) return null;
|
|
78
|
+
const resolvedModule = ts_morph.ts.resolveModuleName(moduleSpecifier, sourceFilePath, compilerOptions, ts_morph.ts.sys).resolvedModule;
|
|
79
|
+
if (!resolvedModule) return null;
|
|
80
|
+
return isExistingFile(resolvedModule.resolvedFileName) ? resolvedModule.resolvedFileName : null;
|
|
81
|
+
};
|
|
82
|
+
const resolveImportPath = (sourceFilePath, moduleSpecifier) => moduleSpecifier.startsWith(".") ? resolveRelativeImportPath(sourceFilePath, moduleSpecifier) : resolveConfigImportPath(sourceFilePath, moduleSpecifier);
|
|
83
|
+
const getImportedSourceFile = (filePath) => {
|
|
84
|
+
const cached = importedSourceFileCache.get(filePath);
|
|
85
|
+
if (cached) return cached;
|
|
86
|
+
if (!node_fs.default.existsSync(filePath)) return null;
|
|
87
|
+
const sourceFile = importedSourceProject.createSourceFile(filePath, node_fs.default.readFileSync(filePath, "utf-8"), { overwrite: true });
|
|
88
|
+
importedSourceFileCache.set(filePath, sourceFile);
|
|
89
|
+
return sourceFile;
|
|
90
|
+
};
|
|
91
|
+
const extractImportedIdentifierValues = (node, visited) => {
|
|
92
|
+
if (!ts_morph.Node.isIdentifier(node)) return [];
|
|
93
|
+
const sourceFile = node.getSourceFile();
|
|
94
|
+
const sourceFilePath = sourceFile.getFilePath();
|
|
95
|
+
const importMatch = sourceFile.getImportDeclarations().find((importDecl) => importDecl.getNamedImports().some((namedImport) => (namedImport.getAliasNode()?.getText() ?? namedImport.getName()) === node.getText()));
|
|
96
|
+
if (!importMatch) return [];
|
|
97
|
+
const namedImport = importMatch.getNamedImports().find((candidate) => (candidate.getAliasNode()?.getText() ?? candidate.getName()) === node.getText());
|
|
98
|
+
if (!namedImport) return [];
|
|
99
|
+
const resolvedPath = resolveImportPath(sourceFilePath, importMatch.getModuleSpecifierValue());
|
|
100
|
+
if (!resolvedPath) return [];
|
|
101
|
+
const importedSourceFile = getImportedSourceFile(resolvedPath);
|
|
102
|
+
if (!importedSourceFile) return [];
|
|
103
|
+
const initializer = importedSourceFile.getVariableDeclaration(namedImport.getName())?.getInitializer();
|
|
104
|
+
return initializer ? extractStringLiterals(initializer, visited) : [];
|
|
105
|
+
};
|
|
7
106
|
/**
|
|
8
107
|
* Extracts string literal values from an expression.
|
|
9
108
|
*
|
|
@@ -109,7 +208,10 @@ const extractIdentifierValues = (node, visited) => {
|
|
|
109
208
|
}
|
|
110
209
|
return [];
|
|
111
210
|
});
|
|
112
|
-
|
|
211
|
+
if (values.length > 0) return values;
|
|
212
|
+
const importedValues = extractImportedIdentifierValues(node, visited);
|
|
213
|
+
if (importedValues.length > 0) return importedValues;
|
|
214
|
+
return extractLiteralValuesFromType(node);
|
|
113
215
|
};
|
|
114
216
|
/**
|
|
115
217
|
* Extract string literals from arrow functions or function expressions
|
|
@@ -1,8 +1,105 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
import
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import { Node, Project, SyntaxKind, ts } from "ts-morph";
|
|
3
5
|
|
|
4
6
|
//#region ../tailwind/dist/purger/optimized/ast/expressions.js
|
|
5
7
|
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
8
|
+
const importedSourceProject = new Project({ useInMemoryFileSystem: true });
|
|
9
|
+
const importedSourceFileCache = /* @__PURE__ */ new Map();
|
|
10
|
+
const tsConfigPathCache = /* @__PURE__ */ new Map();
|
|
11
|
+
const compilerOptionsCache = /* @__PURE__ */ new Map();
|
|
12
|
+
const hasImportQuery = (moduleSpecifier) => moduleSpecifier.includes("?");
|
|
13
|
+
const isExistingFile = (candidate) => fs.existsSync(candidate) && fs.statSync(candidate).isFile();
|
|
14
|
+
const resolveRelativeImportPath = (sourceFilePath, moduleSpecifier) => {
|
|
15
|
+
if (!path.isAbsolute(sourceFilePath) || !moduleSpecifier.startsWith(".") || hasImportQuery(moduleSpecifier)) return null;
|
|
16
|
+
const basePath = path.resolve(path.dirname(sourceFilePath), moduleSpecifier);
|
|
17
|
+
return [
|
|
18
|
+
basePath,
|
|
19
|
+
`${basePath}.ts`,
|
|
20
|
+
`${basePath}.tsx`,
|
|
21
|
+
`${basePath}.js`,
|
|
22
|
+
`${basePath}.jsx`,
|
|
23
|
+
path.join(basePath, "index.ts"),
|
|
24
|
+
path.join(basePath, "index.tsx"),
|
|
25
|
+
path.join(basePath, "index.js"),
|
|
26
|
+
path.join(basePath, "index.jsx")
|
|
27
|
+
].find((candidate) => isExistingFile(candidate)) ?? null;
|
|
28
|
+
};
|
|
29
|
+
const findNearestTypeScriptConfig = (sourceFilePath) => {
|
|
30
|
+
const sourceDir = path.dirname(sourceFilePath);
|
|
31
|
+
const cached = tsConfigPathCache.get(sourceDir);
|
|
32
|
+
if (cached !== void 0) return cached;
|
|
33
|
+
let currentDir = sourceDir;
|
|
34
|
+
while (true) {
|
|
35
|
+
const tsConfigPath = path.join(currentDir, "tsconfig.json");
|
|
36
|
+
if (isExistingFile(tsConfigPath)) {
|
|
37
|
+
tsConfigPathCache.set(sourceDir, tsConfigPath);
|
|
38
|
+
return tsConfigPath;
|
|
39
|
+
}
|
|
40
|
+
const jsConfigPath = path.join(currentDir, "jsconfig.json");
|
|
41
|
+
if (isExistingFile(jsConfigPath)) {
|
|
42
|
+
tsConfigPathCache.set(sourceDir, jsConfigPath);
|
|
43
|
+
return jsConfigPath;
|
|
44
|
+
}
|
|
45
|
+
const parentDir = path.dirname(currentDir);
|
|
46
|
+
if (parentDir === currentDir) {
|
|
47
|
+
tsConfigPathCache.set(sourceDir, null);
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
currentDir = parentDir;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const getCompilerOptionsForSourceFile = (sourceFilePath) => {
|
|
54
|
+
const configPath = findNearestTypeScriptConfig(sourceFilePath);
|
|
55
|
+
if (!configPath) return null;
|
|
56
|
+
const cached = compilerOptionsCache.get(configPath);
|
|
57
|
+
if (cached !== void 0) return cached;
|
|
58
|
+
const readResult = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
59
|
+
if (readResult.error) {
|
|
60
|
+
compilerOptionsCache.set(configPath, null);
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const parsed = ts.parseJsonConfigFileContent(readResult.config, ts.sys, path.dirname(configPath));
|
|
64
|
+
const compilerOptions = parsed.options.paths && !parsed.options.baseUrl ? {
|
|
65
|
+
...parsed.options,
|
|
66
|
+
baseUrl: path.dirname(configPath)
|
|
67
|
+
} : parsed.options;
|
|
68
|
+
compilerOptionsCache.set(configPath, compilerOptions);
|
|
69
|
+
return compilerOptions;
|
|
70
|
+
};
|
|
71
|
+
const resolveConfigImportPath = (sourceFilePath, moduleSpecifier) => {
|
|
72
|
+
if (hasImportQuery(moduleSpecifier)) return null;
|
|
73
|
+
const compilerOptions = getCompilerOptionsForSourceFile(sourceFilePath);
|
|
74
|
+
if (!compilerOptions) return null;
|
|
75
|
+
const resolvedModule = ts.resolveModuleName(moduleSpecifier, sourceFilePath, compilerOptions, ts.sys).resolvedModule;
|
|
76
|
+
if (!resolvedModule) return null;
|
|
77
|
+
return isExistingFile(resolvedModule.resolvedFileName) ? resolvedModule.resolvedFileName : null;
|
|
78
|
+
};
|
|
79
|
+
const resolveImportPath = (sourceFilePath, moduleSpecifier) => moduleSpecifier.startsWith(".") ? resolveRelativeImportPath(sourceFilePath, moduleSpecifier) : resolveConfigImportPath(sourceFilePath, moduleSpecifier);
|
|
80
|
+
const getImportedSourceFile = (filePath) => {
|
|
81
|
+
const cached = importedSourceFileCache.get(filePath);
|
|
82
|
+
if (cached) return cached;
|
|
83
|
+
if (!fs.existsSync(filePath)) return null;
|
|
84
|
+
const sourceFile = importedSourceProject.createSourceFile(filePath, fs.readFileSync(filePath, "utf-8"), { overwrite: true });
|
|
85
|
+
importedSourceFileCache.set(filePath, sourceFile);
|
|
86
|
+
return sourceFile;
|
|
87
|
+
};
|
|
88
|
+
const extractImportedIdentifierValues = (node, visited) => {
|
|
89
|
+
if (!Node.isIdentifier(node)) return [];
|
|
90
|
+
const sourceFile = node.getSourceFile();
|
|
91
|
+
const sourceFilePath = sourceFile.getFilePath();
|
|
92
|
+
const importMatch = sourceFile.getImportDeclarations().find((importDecl) => importDecl.getNamedImports().some((namedImport) => (namedImport.getAliasNode()?.getText() ?? namedImport.getName()) === node.getText()));
|
|
93
|
+
if (!importMatch) return [];
|
|
94
|
+
const namedImport = importMatch.getNamedImports().find((candidate) => (candidate.getAliasNode()?.getText() ?? candidate.getName()) === node.getText());
|
|
95
|
+
if (!namedImport) return [];
|
|
96
|
+
const resolvedPath = resolveImportPath(sourceFilePath, importMatch.getModuleSpecifierValue());
|
|
97
|
+
if (!resolvedPath) return [];
|
|
98
|
+
const importedSourceFile = getImportedSourceFile(resolvedPath);
|
|
99
|
+
if (!importedSourceFile) return [];
|
|
100
|
+
const initializer = importedSourceFile.getVariableDeclaration(namedImport.getName())?.getInitializer();
|
|
101
|
+
return initializer ? extractStringLiterals(initializer, visited) : [];
|
|
102
|
+
};
|
|
6
103
|
/**
|
|
7
104
|
* Extracts string literal values from an expression.
|
|
8
105
|
*
|
|
@@ -108,7 +205,10 @@ const extractIdentifierValues = (node, visited) => {
|
|
|
108
205
|
}
|
|
109
206
|
return [];
|
|
110
207
|
});
|
|
111
|
-
|
|
208
|
+
if (values.length > 0) return values;
|
|
209
|
+
const importedValues = extractImportedIdentifierValues(node, visited);
|
|
210
|
+
if (importedValues.length > 0) return importedValues;
|
|
211
|
+
return extractLiteralValuesFromType(node);
|
|
112
212
|
};
|
|
113
213
|
/**
|
|
114
214
|
* Extract string literals from arrow functions or function expressions
|
|
@@ -7,7 +7,13 @@ let ts_morph = require("ts-morph");
|
|
|
7
7
|
/**
|
|
8
8
|
* Find all JSX usages of a component from its identifier
|
|
9
9
|
*/
|
|
10
|
-
const findJsxReferences = (identifier) =>
|
|
10
|
+
const findJsxReferences = (identifier) => {
|
|
11
|
+
try {
|
|
12
|
+
return identifier.findReferencesAsNodes().map((reference) => reference.getFirstAncestor((n) => ts_morph.Node.isJsxOpeningElement(n) || ts_morph.Node.isJsxSelfClosingElement(n))).filter((node) => Boolean(node) && (ts_morph.Node.isJsxOpeningElement(node) || ts_morph.Node.isJsxSelfClosingElement(node)));
|
|
13
|
+
} catch {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
};
|
|
11
17
|
|
|
12
18
|
//#endregion
|
|
13
19
|
exports.findJsxReferences = findJsxReferences;
|
|
@@ -6,7 +6,13 @@ import { Node, SyntaxKind } from "ts-morph";
|
|
|
6
6
|
/**
|
|
7
7
|
* Find all JSX usages of a component from its identifier
|
|
8
8
|
*/
|
|
9
|
-
const findJsxReferences = (identifier) =>
|
|
9
|
+
const findJsxReferences = (identifier) => {
|
|
10
|
+
try {
|
|
11
|
+
return identifier.findReferencesAsNodes().map((reference) => reference.getFirstAncestor((n) => Node.isJsxOpeningElement(n) || Node.isJsxSelfClosingElement(n))).filter((node) => Boolean(node) && (Node.isJsxOpeningElement(node) || Node.isJsxSelfClosingElement(node)));
|
|
12
|
+
} catch {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
};
|
|
10
16
|
|
|
11
17
|
//#endregion
|
|
12
18
|
export { findJsxReferences };
|