@luxfi/ui 7.4.7 → 7.4.8

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/next.cjs CHANGED
@@ -80,17 +80,21 @@ var GUI_DEFINES = {
80
80
  "process.env.EXPO_OS": JSON.stringify("web"),
81
81
  "process.env.IS_WEB": JSON.stringify("true")
82
82
  };
83
- var ENGINE_DEDUPE = [
83
+ [
84
84
  "react",
85
85
  "react-dom",
86
86
  "@tanstack/react-query",
87
87
  ...GUI_PACKAGES
88
88
  ];
89
+ var ALIASABLE = [
90
+ "@tanstack/react-query",
91
+ ...GUI_PACKAGES
92
+ ];
89
93
  function guiAliases(from) {
90
94
  const { createRequire } = __require("module");
91
95
  const require_ = createRequire(`${from.replace(/\/?$/, "/")}noop.js`);
92
96
  const alias = {};
93
- for (const pkg of ENGINE_DEDUPE) {
97
+ for (const pkg of ALIASABLE) {
94
98
  try {
95
99
  alias[`${pkg}$`] = require_.resolve(pkg);
96
100
  } catch {
@@ -103,9 +107,14 @@ function guiAliases(from) {
103
107
  function withLuxUi(config = {}) {
104
108
  const userWebpack = config.webpack;
105
109
  const engine = guiAliases(config.dir ?? process.cwd());
106
- const engineTurbopack = Object.fromEntries(
107
- Object.entries(engine).map(([k, v]) => [k.replace(/\$$/, ""), v])
108
- );
110
+ const root = config.dir ?? process.cwd();
111
+ const path = __require("path");
112
+ const engineTurbopack = {};
113
+ for (const [key, abs] of Object.entries(engine)) {
114
+ const rel = path.relative(root, abs);
115
+ if (rel.startsWith("..") || path.isAbsolute(rel)) continue;
116
+ engineTurbopack[key.replace(/\$$/, "")] = `./${rel}`;
117
+ }
109
118
  const { dir: _dir, ...rest } = config;
110
119
  return {
111
120
  ...rest,
package/dist/next.js CHANGED
@@ -78,17 +78,21 @@ var GUI_DEFINES = {
78
78
  "process.env.EXPO_OS": JSON.stringify("web"),
79
79
  "process.env.IS_WEB": JSON.stringify("true")
80
80
  };
81
- var ENGINE_DEDUPE = [
81
+ [
82
82
  "react",
83
83
  "react-dom",
84
84
  "@tanstack/react-query",
85
85
  ...GUI_PACKAGES
86
86
  ];
87
+ var ALIASABLE = [
88
+ "@tanstack/react-query",
89
+ ...GUI_PACKAGES
90
+ ];
87
91
  function guiAliases(from) {
88
92
  const { createRequire } = __require("module");
89
93
  const require_ = createRequire(`${from.replace(/\/?$/, "/")}noop.js`);
90
94
  const alias = {};
91
- for (const pkg of ENGINE_DEDUPE) {
95
+ for (const pkg of ALIASABLE) {
92
96
  try {
93
97
  alias[`${pkg}$`] = require_.resolve(pkg);
94
98
  } catch {
@@ -101,9 +105,14 @@ function guiAliases(from) {
101
105
  function withLuxUi(config = {}) {
102
106
  const userWebpack = config.webpack;
103
107
  const engine = guiAliases(config.dir ?? process.cwd());
104
- const engineTurbopack = Object.fromEntries(
105
- Object.entries(engine).map(([k, v]) => [k.replace(/\$$/, ""), v])
106
- );
108
+ const root = config.dir ?? process.cwd();
109
+ const path = __require("path");
110
+ const engineTurbopack = {};
111
+ for (const [key, abs] of Object.entries(engine)) {
112
+ const rel = path.relative(root, abs);
113
+ if (rel.startsWith("..") || path.isAbsolute(rel)) continue;
114
+ engineTurbopack[key.replace(/\$$/, "")] = `./${rel}`;
115
+ }
107
116
  const { dir: _dir, ...rest } = config;
108
117
  return {
109
118
  ...rest,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxfi/ui",
3
- "version": "7.4.7",
3
+ "version": "7.4.8",
4
4
  "description": "Cross-platform DeFi UI components built on @hanzo/gui (Tamagui). Native mobile + web.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/engine.ts CHANGED
@@ -126,7 +126,23 @@ export const ENGINE_DEDUPE: ReadonlyArray<string> = [
126
126
  ];
127
127
 
128
128
  /**
129
- * Exact-match aliases pinning every deduped package to ONE entry file, for
129
+ * The subset of ENGINE_DEDUPE that may be pinned by a hard bundler ALIAS.
130
+ *
131
+ * `dedupe` is advisory hoisting; an alias is a hard redirect, and redirecting
132
+ * `react` / `react-dom` inside a Next app breaks the framework's own graph —
133
+ * the RSC client manifest is keyed on Next's copy, so the MPC dashboard died
134
+ * with `Could not find the module … segment-explorer-node.js#SegmentViewNode in
135
+ * the React Client Manifest` followed by `__webpack_modules__[moduleId] is not
136
+ * a function`. Next already guarantees one React; it does not guarantee one
137
+ * react-query, and it does not guarantee one popper.
138
+ */
139
+ export const ALIASABLE: ReadonlyArray<string> = [
140
+ '@tanstack/react-query',
141
+ ...GUI_PACKAGES,
142
+ ];
143
+
144
+ /**
145
+ * Exact-match aliases pinning every aliasable package to ONE entry file, for
130
146
  * bundlers that have no `dedupe` of their own (webpack, turbopack).
131
147
  *
132
148
  * Keys carry webpack's `$` exact-match suffix so only the bare specifier is
@@ -140,7 +156,7 @@ export function guiAliases(from: string): Record<string, string> {
140
156
  const { createRequire } = require('node:module') as typeof import('node:module');
141
157
  const require_ = createRequire(`${ from.replace(/\/?$/, '/') }noop.js`);
142
158
  const alias: Record<string, string> = {};
143
- for (const pkg of ENGINE_DEDUPE) {
159
+ for (const pkg of ALIASABLE) {
144
160
  try {
145
161
  alias[`${ pkg }$`] = require_.resolve(pkg);
146
162
  } catch {
package/src/next.ts CHANGED
@@ -53,11 +53,24 @@ export function withLuxUi(config: LuxUiNextConfig = {}): LuxUiNextConfig {
53
53
  // `webpack()` below is never called by `next dev`, so a webpack-only alias map
54
54
  // deduped production and left development with N copies of `@hanzogui/popper`
55
55
  // and the `Cannot read properties of undefined (reading 'setReference')`
56
- // storm that comes with them. Turbopack has no `$` exact-match suffix; a bare
57
- // key is already exact, so strip it.
58
- const engineTurbopack = Object.fromEntries(
59
- Object.entries(engine).map(([ k, v ]) => [ k.replace(/\$$/, ''), v ]),
60
- );
56
+ // storm that comes with them.
57
+ //
58
+ // Two shape differences from webpack, both load-bearing:
59
+ // - no `$` exact-match suffix; a bare key is already exact.
60
+ // - an ABSOLUTE path is not a valid alias value. Turbopack reads it as a
61
+ // server-relative URL and fails with `Can't resolve
62
+ // './Users/.../react/index.js' — server relative imports are not
63
+ // implemented yet`, which takes the whole dev server down. The value has
64
+ // to be a project-relative `./…` specifier, so a package resolved outside
65
+ // the project root is skipped rather than mis-aliased.
66
+ const root = config.dir ?? process.cwd();
67
+ const path = require('node:path') as typeof import('node:path');
68
+ const engineTurbopack: Record<string, string> = {};
69
+ for (const [ key, abs ] of Object.entries(engine)) {
70
+ const rel = path.relative(root, abs);
71
+ if (rel.startsWith('..') || path.isAbsolute(rel)) continue;
72
+ engineTurbopack[key.replace(/\$$/, '')] = `./${ rel }`;
73
+ }
61
74
  // `dir` is OURS, not Next's — leaving it on the returned object makes Next
62
75
  // print `Unrecognized key(s) in object: 'dir'` on every boot of every surface
63
76
  // that passes it. Consume it here.