@wix/zero-config-implementation 1.10.0 → 1.12.0

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/index.js CHANGED
@@ -12038,7 +12038,7 @@ function T0() {
12038
12038
  }
12039
12039
  function Uk() {
12040
12040
  return {
12041
- ariaLabel: Ye.lorem.sentence(),
12041
+ ariaLabel: `mock_ariaLabel_${Ye.string.alphanumeric(6)}`,
12042
12042
  role: Ye.helpers.arrayElement(["button", "link", "img", "region"]),
12043
12043
  tabIndex: Ye.helpers.arrayElement([0, -1])
12044
12044
  };
@@ -12226,7 +12226,7 @@ function $k(e, t) {
12226
12226
  if (r && !r.startsWith("mock_"))
12227
12227
  return Ln(r);
12228
12228
  const n = Vr(e, "aria-label");
12229
- if (n)
12229
+ if (n && !n.startsWith("mock_"))
12230
12230
  return Ln(n);
12231
12231
  const a = Vr(e, "aria-labelledby");
12232
12232
  if (a) {
@@ -40527,9 +40527,13 @@ function PL(e, t, r) {
40527
40527
  const n = t.types.filter((A) => A.value !== "undefined" && A.value !== "null");
40528
40528
  if (n.length === 0)
40529
40529
  return e.dataType = $e.text, e.text = {}, mt(void 0);
40530
- if (n.length <= 2 && n.every((A) => A.kind === "literal" && (A.value === !0 || A.value === !1)))
40530
+ if (n.length <= 2 && n.every(
40531
+ (A) => A.kind === "literal" && (A.value === !0 || A.value === !1)
40532
+ ))
40531
40533
  return e.dataType = $e.booleanValue, mt(void 0);
40532
- if (n.every((A) => A.kind === "literal" && typeof A.value == "string"))
40534
+ if (n.every(
40535
+ (A) => A.kind === "literal" && typeof A.value == "string"
40536
+ ))
40533
40537
  return e.dataType = $e.textEnum, e.textEnum = {
40534
40538
  options: n.map((A) => ({
40535
40539
  value: String(A.value || ""),
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "1.10.0",
7
+ "version": "1.12.0",
8
8
  "description": "Core library for extracting component manifests from JS and CSS files",
9
9
  "type": "module",
10
10
  "main": "dist/index.js",
@@ -74,5 +74,5 @@
74
74
  ]
75
75
  }
76
76
  },
77
- "falconPackageHash": "21d3bc497b17268af6551d502a02de709d17f09eaa98040d2017ae4b"
77
+ "falconPackageHash": "6af8a6509bed6bf77cac3e06a3c9b2ce44962c86bda8e8eceafa5f45"
78
78
  }
@@ -148,13 +148,15 @@ function handlePrimitiveType(
148
148
  const typeValue = (resolvedType.value as string | undefined)?.toLowerCase() || propInfo.type.toLowerCase()
149
149
 
150
150
  if (typeValue.includes('string')) {
151
- if (bindings?.some((b) => b.attribute === 'dir')) {
151
+ if (bindings?.some((binding) => binding.attribute === 'dir')) {
152
152
  dataItem.dataType = DATA_TYPE.direction
153
- } else if (bindings?.some((b) => b.attribute === 'href' && b.element === 'a' && !b.concatenated)) {
153
+ } else if (
154
+ bindings?.some((binding) => binding.attribute === 'href' && binding.element === 'a' && !binding.concatenated)
155
+ ) {
154
156
  dataItem.dataType = DATA_TYPE.webUrl
155
- } else if (bindings?.some((b) => b.attribute === 'id')) {
157
+ } else if (bindings?.some((binding) => binding.attribute === 'id')) {
156
158
  dataItem.dataType = DATA_TYPE.guid
157
- } else if (bindings?.some((b) => b.attribute === 'pattern')) {
159
+ } else if (bindings?.some((binding) => binding.attribute === 'pattern')) {
158
160
  dataItem.dataType = DATA_TYPE.regex
159
161
  } else {
160
162
  dataItem.dataType = DATA_TYPE.text
@@ -299,21 +301,26 @@ function handleUnionType(
299
301
 
300
302
  // Check if it's a boolean type (union of true | false literals)
301
303
  const isBooleanLiteralUnion =
302
- validTypes.length <= 2 && validTypes.every((t) => t.kind === 'literal' && (t.value === true || t.value === false))
304
+ validTypes.length <= 2 &&
305
+ validTypes.every(
306
+ (validType) => validType.kind === 'literal' && (validType.value === true || validType.value === false),
307
+ )
303
308
  if (isBooleanLiteralUnion) {
304
309
  dataItem.dataType = DATA_TYPE.booleanValue
305
310
  return ok(undefined)
306
311
  }
307
312
 
308
313
  // Check if it's a union of string literals (enum-like)
309
- const allStringLiterals = validTypes.every((t) => t.kind === 'literal' && typeof t.value === 'string')
314
+ const allStringLiterals = validTypes.every(
315
+ (validType) => validType.kind === 'literal' && typeof validType.value === 'string',
316
+ )
310
317
  if (allStringLiterals) {
311
318
  dataItem.dataType = DATA_TYPE.textEnum
312
319
  dataItem.textEnum = {
313
320
  options: validTypes
314
- .map((t) => ({
315
- value: String(t.value || ''),
316
- displayName: formatDisplayName(String(t.value || '')),
321
+ .map((validType) => ({
322
+ value: String(validType.value || ''),
323
+ displayName: formatDisplayName(String(validType.value || '')),
317
324
  }))
318
325
  .filter((opt) => opt.value),
319
326
  }
@@ -78,17 +78,17 @@ function buildElements(
78
78
  ): Record<string, ElementItem> {
79
79
  const result: Record<string, ElementItem> = {}
80
80
 
81
- for (const el of elements) {
82
- const elementData = innerElementProps?.get(el.traceId)
81
+ for (const element of elements) {
82
+ const elementData = innerElementProps?.get(element.traceId)
83
83
  const data = elementData && propUsages ? buildData(elementData, propUsages) : undefined
84
- const cssProps = buildCssProperties(el)
85
- const cssCustomProps = buildCssCustomPropertiesForElement(el)
84
+ const cssProps = buildCssProperties(element)
85
+ const cssCustomProps = buildCssCustomPropertiesForElement(element)
86
86
 
87
- result[el.name] = {
87
+ result[element.name] = {
88
88
  elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
89
89
  inlineElement: {
90
- selector: buildSelector(el),
91
- displayName: formatDisplayName(el.name),
90
+ selector: buildSelector(element),
91
+ displayName: formatDisplayName(element.name),
92
92
  // Add data from inner element props if available
93
93
  ...(data && Object.keys(data).length > 0 && { data }),
94
94
  // CSS properties from heuristic + matched CSS files
@@ -96,7 +96,8 @@ function buildElements(
96
96
  // CSS custom properties from matched rules for this element
97
97
  ...(Object.keys(cssCustomProps).length > 0 && { cssCustomProperties: cssCustomProps }),
98
98
  // Recursively build nested elements
99
- elements: el.children.length > 0 ? buildElements(el.children, innerElementProps, propUsages) : undefined,
99
+ elements:
100
+ element.children.length > 0 ? buildElements(element.children, innerElementProps, propUsages) : undefined,
100
101
  },
101
102
  }
102
103
  }
@@ -140,10 +140,10 @@ function parseAllProperties(cssString: string): Map<string, CSSProperty[]> {
140
140
 
141
141
  for (const keyframe of rule.value.keyframes) {
142
142
  // Each keyframe has selectors like 'from', 'to', '50%'
143
- const keyframeSelectors = keyframe.selectors.map((s) => {
144
- if (typeof s === 'string') return s
145
- if ('percentage' in s) return `${s.percentage}%`
146
- return String(s)
143
+ const keyframeSelectors = keyframe.selectors.map((selector) => {
144
+ if (typeof selector === 'string') return selector
145
+ if ('percentage' in selector) return `${selector.percentage}%`
146
+ return String(selector)
147
147
  })
148
148
 
149
149
  const properties: CSSProperty[] = []
@@ -73,16 +73,16 @@ function enrichElements(
73
73
  matchesByTraceId: Map<string, CssSelectorMatch[]>,
74
74
  customPropsByTraceId: Map<string, Record<string, string>>,
75
75
  ): ExtractedElement[] {
76
- return elements.map((el) => {
76
+ return elements.map((element) => {
77
77
  const data: MatchedCssData = {
78
- matches: matchesByTraceId.get(el.traceId) ?? [],
79
- customProperties: customPropsByTraceId.get(el.traceId) ?? {},
78
+ matches: matchesByTraceId.get(element.traceId) ?? [],
79
+ customProperties: customPropsByTraceId.get(element.traceId) ?? {},
80
80
  }
81
- el.extractorData.set('css-matcher', data)
81
+ element.extractorData.set('css-matcher', data)
82
82
 
83
83
  return {
84
- ...el,
85
- children: enrichElements(el.children, matchesByTraceId, customPropsByTraceId),
84
+ ...element,
85
+ children: enrichElements(element.children, matchesByTraceId, customPropsByTraceId),
86
86
  }
87
87
  })
88
88
  }
@@ -154,7 +154,7 @@ function getElementNamePart(element: Element, getElementById: (id: string) => El
154
154
  }
155
155
 
156
156
  const ariaLabel = getAttribute(element, 'aria-label')
157
- if (ariaLabel) {
157
+ if (ariaLabel && !ariaLabel.startsWith('mock_')) {
158
158
  return pascalCase(ariaLabel)
159
159
  }
160
160
 
@@ -377,7 +377,7 @@ function generateMockLink(): Record<string, unknown> {
377
377
 
378
378
  function generateMockA11y(): Record<string, unknown> {
379
379
  return {
380
- ariaLabel: faker.lorem.sentence(),
380
+ ariaLabel: `mock_ariaLabel_${faker.string.alphanumeric(6)}`,
381
381
  role: faker.helpers.arrayElement(['button', 'link', 'img', 'region']),
382
382
  tabIndex: faker.helpers.arrayElement([0, -1]),
383
383
  }
@@ -10,7 +10,7 @@ import { resolveType } from './utils/semantic-type-resolver'
10
10
  const sharedPropFilter = (prop: PropItem) => {
11
11
  // Exclude props inherited from node_modules (e.g. HTMLAttributes)
12
12
  if (prop.declarations && prop.declarations.length > 0) {
13
- return !prop.declarations.every((d) => d.fileName.includes('node_modules'))
13
+ return !prop.declarations.every((declaration) => declaration.fileName.includes('node_modules'))
14
14
  }
15
15
  return true
16
16
  }
@@ -69,7 +69,7 @@ function findDefaultExportName(program: ts.Program, filePath: string): string |
69
69
  const moduleSymbol = checker.getSymbolAtLocation(sourceFile)
70
70
  if (!moduleSymbol) return undefined
71
71
 
72
- const defaultSymbol = checker.getExportsOfModule(moduleSymbol).find((s) => s.getName() === 'default')
72
+ const defaultSymbol = checker.getExportsOfModule(moduleSymbol).find((symbol) => symbol.getName() === 'default')
73
73
  if (!defaultSymbol) return undefined
74
74
 
75
75
  // For `export default Foo` the symbol is an alias — resolve it to get 'Foo'
@@ -158,11 +158,11 @@ function findPropsType(
158
158
  if (!moduleSymbol) return undefined
159
159
 
160
160
  const exports = checker.getExportsOfModule(moduleSymbol)
161
- let componentSymbol = exports.find((s) => s.getName() === componentName)
161
+ let componentSymbol = exports.find((symbol) => symbol.getName() === componentName)
162
162
 
163
163
  // If not found by name, check whether the default export resolves to the component
164
164
  if (!componentSymbol) {
165
- const defaultSymbol = exports.find((s) => s.getName() === 'default')
165
+ const defaultSymbol = exports.find((symbol) => symbol.getName() === 'default')
166
166
  if (defaultSymbol && (defaultSymbol.getFlags() & ts.SymbolFlags.Alias) !== 0) {
167
167
  const resolved = checker.getAliasedSymbol(defaultSymbol)
168
168
  if (resolved.getName() === componentName) {
@@ -292,21 +292,21 @@ function extractBindings(
292
292
  }
293
293
 
294
294
  function convertElements(elements: ExtractedElement[]): CoupledComponentInfo['elements'] {
295
- return elements.map((el) => {
295
+ return elements.map((element) => {
296
296
  // Get prop-tracker data for boundProps
297
- const propTrackerData = el.extractorData.get('prop-tracker') as PropTrackerData | undefined
297
+ const propTrackerData = element.extractorData.get('prop-tracker') as PropTrackerData | undefined
298
298
 
299
299
  return {
300
- traceId: el.traceId,
301
- name: el.name,
302
- tag: el.tag,
303
- attributes: el.attributes,
304
- extractorData: el.extractorData,
305
- children: convertElements(el.children),
300
+ traceId: element.traceId,
301
+ name: element.name,
302
+ tag: element.tag,
303
+ attributes: element.attributes,
304
+ extractorData: element.extractorData,
305
+ children: convertElements(element.children),
306
306
  // Legacy fields
307
307
  boundProps: propTrackerData?.boundProps ?? [],
308
308
  role: propTrackerData?.role,
309
- hasTextContent: el.hasTextContent,
309
+ hasTextContent: element.hasTextContent,
310
310
  }
311
311
  })
312
312
  }