synthesisui 0.16.126 → 0.16.127
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/commands/import.js +30 -1
- package/package.json +1 -1
package/dist/commands/import.js
CHANGED
|
@@ -874,7 +874,23 @@ export async function takeCensus(root, opts) {
|
|
|
874
874
|
* because every declared option now looked used.
|
|
875
875
|
*/
|
|
876
876
|
const declaredBy = new Map(defined.map((d) => [d.name, d]));
|
|
877
|
-
const enriched = inventory.map((
|
|
877
|
+
const enriched = inventory.map((c0) => {
|
|
878
|
+
/**
|
|
879
|
+
* A NAME THIS SCOPE DECLARES IS THEIRS, whoever else imports the same identifier.
|
|
880
|
+
*
|
|
881
|
+
* The usage scan reads imports per FILE, so a name gets the package of the file that
|
|
882
|
+
* imported it. Their `Pill` does `import { Toggle } from "@base-ui/react/toggle"`, and
|
|
883
|
+
* that name collides with the `Toggle` atom they wrote one folder over: the entry came
|
|
884
|
+
* out carrying `from: "@base-ui/react/toggle"`, and `from` is what makes the crosswalk
|
|
885
|
+
* skip a component and `exclusiveContracts` drop it. Their Toggle - 12 declarations, 3
|
|
886
|
+
* parts, `size` and `checked` - was absent from the whole system (test50, dono, 04/08).
|
|
887
|
+
*
|
|
888
|
+
* `defined` is a DEFINITION: a function of theirs that returns JSX. A scope that merely
|
|
889
|
+
* re-exports a library component under the same name is not in it, so a real
|
|
890
|
+
* third-party keeps its package. This is law 14's ordering, one level up: what they
|
|
891
|
+
* declare breaks the tie before the crosswalk is asked.
|
|
892
|
+
*/
|
|
893
|
+
const c = declaredWins(c0, declaredBy.has(c0.name));
|
|
878
894
|
const d = declaredBy.get(c.name);
|
|
879
895
|
const fromVariants = variantAxes.get(c.name);
|
|
880
896
|
if (!d && !fromVariants)
|
|
@@ -1901,6 +1917,19 @@ function sayReach(c) {
|
|
|
1901
1917
|
* (a return the scanner did not follow) must say nothing rather than borrow the
|
|
1902
1918
|
* first node's package.
|
|
1903
1919
|
*/
|
|
1920
|
+
/**
|
|
1921
|
+
* A NAME THIS SCOPE DECLARES IS THEIRS - see the call site in `takeCensus` for what it cost.
|
|
1922
|
+
*
|
|
1923
|
+
* Kept as a function so the rule has a name and a test: the usage scan is per FILE, so an
|
|
1924
|
+
* identifier takes the package of whoever imported it, and one of their own components can
|
|
1925
|
+
* shadow one of their own names. `declared` is a DEFINITION of theirs, which is what makes
|
|
1926
|
+
* this a tie-break rather than a preference.
|
|
1927
|
+
*/
|
|
1928
|
+
export function declaredWins(component, declared) {
|
|
1929
|
+
return component.from && declared
|
|
1930
|
+
? { ...component, from: undefined }
|
|
1931
|
+
: component;
|
|
1932
|
+
}
|
|
1904
1933
|
function rootPackage(tag, sketch) {
|
|
1905
1934
|
if (!tag || !/^[A-Z]/.test(tag))
|
|
1906
1935
|
return {};
|
package/package.json
CHANGED