@lotics/ui 47.2.1 → 47.3.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/docs/reviewing.md +18 -0
- package/package.json +2 -2
- package/src/vite.mjs +33 -0
package/docs/reviewing.md
CHANGED
|
@@ -10,6 +10,24 @@ Everything here is about a screen **that already renders**. Building one starts
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
+
## The kit's peer ranges are a resolution contract, not a floor
|
|
14
|
+
|
|
15
|
+
`lucide-react-native` sat at `>=0.460.0` — unbounded — while `icon.tsx` deep-imports
|
|
16
|
+
`lucide-react-native/dist/esm/icons/<name>` to keep the ~1650-icon barrel out of the
|
|
17
|
+
Metro bundle. lucide later shipped an `exports` map listing only `.` and `./icons`, so
|
|
18
|
+
that path stopped being publicly exported, and every resolver that honours `exports`
|
|
19
|
+
(Vite's dep optimizer among them) began refusing it. Nothing in this repo changed; the
|
|
20
|
+
range simply accepted the version that changed the rules.
|
|
21
|
+
|
|
22
|
+
It surfaced late and looked intermittent because a warm `.vite` cache never re-resolves
|
|
23
|
+
— only a fresh install hits it, which is why it kept coming back and kept getting
|
|
24
|
+
patched as a symptom (clear the cache, add a local `exclude`).
|
|
25
|
+
|
|
26
|
+
**A peer range with no upper bound on a package we deep-import is a standing invitation
|
|
27
|
+
for this.** When the kit reaches past a package's public entry points, bound the range,
|
|
28
|
+
and say in the code why the deep path is being used at all.
|
|
29
|
+
|
|
30
|
+
|
|
13
31
|
## The method
|
|
14
32
|
|
|
15
33
|
**"Looks off" is where a finding starts.** Trust the impression and use measurement to say
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lotics/ui",
|
|
3
|
-
"version": "47.
|
|
3
|
+
"version": "47.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./accordion": "./src/accordion.tsx",
|
|
@@ -355,7 +355,7 @@
|
|
|
355
355
|
"@react-native-picker/picker": ">=2.0.0",
|
|
356
356
|
"expo-image": ">=3.0.0",
|
|
357
357
|
"lucide-react": ">=0.460.0",
|
|
358
|
-
"lucide-react-native": "
|
|
358
|
+
"lucide-react-native": "^0.562.0",
|
|
359
359
|
"react": "^19.2.0",
|
|
360
360
|
"react-dom": "^19.2.0",
|
|
361
361
|
"react-native": ">=0.85.0",
|
package/src/vite.mjs
CHANGED
|
@@ -102,11 +102,44 @@ export const loticsOptimizeDeps = [
|
|
|
102
102
|
* const base = loticsResolve();
|
|
103
103
|
* resolve: { ...base, alias: [...base.alias, { find: "x", replacement: "y" }] }
|
|
104
104
|
*/
|
|
105
|
+
/**
|
|
106
|
+
* Absolute path to lucide's ESM icon directory, or null when it isn't installed.
|
|
107
|
+
*
|
|
108
|
+
* `icon.tsx` deep-imports `lucide-react-native/dist/esm/icons/<name>` to keep the
|
|
109
|
+
* ~1650-icon barrel out of the Metro bundle. lucide 0.562 ships an `exports` map
|
|
110
|
+
* listing only `.` and `./icons`, so that specifier is not publicly exported —
|
|
111
|
+
* and Vite's dep optimizer, which honours `exports`, refuses it outright:
|
|
112
|
+
* `Missing "./dist/esm/icons/activity" specifier`. The rollup build resolves it
|
|
113
|
+
* anyway, so the failure is dev-only, and it stayed hidden because a warm
|
|
114
|
+
* `.vite` cache never re-resolves. Any app installing fresh hits it immediately.
|
|
115
|
+
*
|
|
116
|
+
* Resolving the package's own ESM entry and walking to its sibling `icons/`
|
|
117
|
+
* gives the optimizer a real path, so no consumer has to touch its vite config
|
|
118
|
+
* and no bundle changes. `import.meta.resolve` (not `createRequire`) because we
|
|
119
|
+
* need the ESM condition — the require condition lands in `dist/cjs`.
|
|
120
|
+
*/
|
|
121
|
+
function lucideIconsDir() {
|
|
122
|
+
try {
|
|
123
|
+
// `import.meta.resolve`, and string-slicing rather than `node:path` /
|
|
124
|
+
// `node:url`, because this module must stay a zero-import leaf — see the
|
|
125
|
+
// header. The ESM condition matters: the require condition lands in
|
|
126
|
+
// `dist/cjs`, whose icons are CJS and would defeat the point.
|
|
127
|
+
const url = import.meta.resolve("lucide-react-native");
|
|
128
|
+
if (!url.startsWith("file://")) return null;
|
|
129
|
+
const file = decodeURIComponent(url.slice("file://".length));
|
|
130
|
+
return `${file.slice(0, file.lastIndexOf("/"))}/icons`;
|
|
131
|
+
} catch {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
105
136
|
export function loticsResolve() {
|
|
106
137
|
const uiSrc = process.env.LOTICS_UI_SRC;
|
|
138
|
+
const icons = lucideIconsDir();
|
|
107
139
|
return {
|
|
108
140
|
alias: [
|
|
109
141
|
...(uiSrc ? [{ find: /^@lotics\/ui\/(.+)$/, replacement: `${uiSrc}/$1` }] : []),
|
|
142
|
+
...(icons ? [{ find: /^lucide-react-native\/dist\/esm\/icons\/(.+)$/, replacement: `${icons}/$1` }] : []),
|
|
110
143
|
{ find: "react-native", replacement: "react-native-web" },
|
|
111
144
|
],
|
|
112
145
|
extensions: [".web.tsx", ".web.ts", ".web.js", ".tsx", ".ts", ".jsx", ".js", ".mjs", ".mts"],
|