@wix/zero-config-implementation 1.12.0 → 1.13.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
|
@@ -1475,11 +1475,23 @@ const Ym = (e) => e.declarations && e.declarations.length > 0 ? !e.declarations.
|
|
|
1475
1475
|
shouldRemoveUndefinedFromOptional: !0,
|
|
1476
1476
|
shouldIncludePropTagMap: !0,
|
|
1477
1477
|
skipChildrenPropWithoutDoc: !0,
|
|
1478
|
-
propFilter: Ym
|
|
1478
|
+
propFilter: Ym,
|
|
1479
|
+
// react-docgen-typescript resolves `commentSource` for known wrapper types (MemoExoticComponent,
|
|
1480
|
+
// ForwardRefExoticComponent, etc.) but not for NamedExoticComponent — the base type that
|
|
1481
|
+
// TypeScript reports when a memo-wrapped component is accessed via a default export alias.
|
|
1482
|
+
// Adding it here makes the library correctly resolve the actual variable symbol.
|
|
1483
|
+
customComponentTypes: ["NamedExoticComponent"]
|
|
1479
1484
|
};
|
|
1480
1485
|
function Jm(e, t) {
|
|
1481
|
-
const r = e.getTypeChecker(), n = e.getCompilerOptions()
|
|
1482
|
-
|
|
1486
|
+
const r = e.getTypeChecker(), n = e.getCompilerOptions(), a = (A, u) => {
|
|
1487
|
+
const s = r.getSymbolAtLocation(u);
|
|
1488
|
+
if (!s) return;
|
|
1489
|
+
const c = r.getExportsOfModule(s).find((l) => l.getName() === "default");
|
|
1490
|
+
if (!c || !(c.getFlags() & tt.SymbolFlags.Alias)) return;
|
|
1491
|
+
const h = r.getAliasedSymbol(c).getName();
|
|
1492
|
+
return h !== "default" ? h : void 0;
|
|
1493
|
+
};
|
|
1494
|
+
return ym.withCompilerOptions(n, { ...Wm, componentNameResolver: a }).parseWithProgramProvider([t], () => e).map((A) => qm(A, e, r));
|
|
1483
1495
|
}
|
|
1484
1496
|
function Vm(e, t) {
|
|
1485
1497
|
const r = Km(e, t);
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"registry": "https://registry.npmjs.org/",
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.13.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": "
|
|
77
|
+
"falconPackageHash": "415f1144395df7902b157f7d63d64cd53a60a5f69c460b61c217594b"
|
|
78
78
|
}
|
|
@@ -20,6 +20,11 @@ const sharedParserOptions = {
|
|
|
20
20
|
shouldIncludePropTagMap: true,
|
|
21
21
|
skipChildrenPropWithoutDoc: true,
|
|
22
22
|
propFilter: sharedPropFilter,
|
|
23
|
+
// react-docgen-typescript resolves `commentSource` for known wrapper types (MemoExoticComponent,
|
|
24
|
+
// ForwardRefExoticComponent, etc.) but not for NamedExoticComponent — the base type that
|
|
25
|
+
// TypeScript reports when a memo-wrapped component is accessed via a default export alias.
|
|
26
|
+
// Adding it here makes the library correctly resolve the actual variable symbol.
|
|
27
|
+
customComponentTypes: ['NamedExoticComponent'],
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -30,7 +35,21 @@ export function extractAllComponentInfo(program: ts.Program, filePath: string):
|
|
|
30
35
|
const checker = program.getTypeChecker()
|
|
31
36
|
const options = program.getCompilerOptions()
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
// react-docgen-typescript uses the filename stem as displayName fallback when a
|
|
39
|
+
// component symbol has a "generic" React type name (e.g. "FunctionComponent",
|
|
40
|
+
// "__function"). This happens for components only exported via `export default`,
|
|
41
|
+
// not as named exports. We resolve the actual name from the module's default export.
|
|
42
|
+
const componentNameResolver = (_exp: ts.Symbol, source: ts.SourceFile): string | undefined => {
|
|
43
|
+
const moduleSymbol = checker.getSymbolAtLocation(source)
|
|
44
|
+
if (!moduleSymbol) return undefined
|
|
45
|
+
const defaultSym = checker.getExportsOfModule(moduleSymbol).find((s) => s.getName() === 'default')
|
|
46
|
+
if (!defaultSym || !(defaultSym.getFlags() & ts.SymbolFlags.Alias)) return undefined
|
|
47
|
+
const aliased = checker.getAliasedSymbol(defaultSym)
|
|
48
|
+
const name = aliased.getName()
|
|
49
|
+
return name !== 'default' ? name : undefined
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const parser = withCompilerOptions(options, { ...sharedParserOptions, componentNameResolver })
|
|
34
53
|
|
|
35
54
|
const docs = parser.parseWithProgramProvider([filePath], () => program)
|
|
36
55
|
|