@reticlehq/next 2.13.1 → 2.14.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/index.cjs +19 -9
- package/index.d.ts +11 -1
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -260,9 +260,17 @@ function sdkPackageVersion() {
|
|
|
260
260
|
|
|
261
261
|
/**
|
|
262
262
|
* @param {import('next').NextConfig} [nextConfig]
|
|
263
|
+
* @param {{ sourceMapping?: boolean }} [options] Pass `{ sourceMapping: false }` for an app that
|
|
264
|
+
* renders through a non-DOM React reconciler — react-three-fiber, react-pdf, ink. A lowercase JSX
|
|
265
|
+
* tag is a host element in every React renderer, but only React DOM's host instances are nodes
|
|
266
|
+
* that take attributes. R3F reads the dashed `data-reticle-source` as a pierced property path,
|
|
267
|
+
* walks `data` -> `reticle` on a three.js instance that has no `data`, and throws from the commit
|
|
268
|
+
* phase — unmounting the whole tree to a white screen. The babel plugin's allowlist keeps the
|
|
269
|
+
* stamp off `<mesh>`, and cannot help with the tags that COLLIDE: `<line>` is SVG's AND
|
|
270
|
+
* `THREE.Line`; `<audio>` is both. Turning the stamp off costs source pointers, not the app.
|
|
263
271
|
* @returns {import('next').NextConfig}
|
|
264
272
|
*/
|
|
265
|
-
function withReticle(nextConfig = {}) {
|
|
273
|
+
function withReticle(nextConfig = {}, options = {}) {
|
|
266
274
|
// Production builds are untouched — this is a dev-time aid only.
|
|
267
275
|
if (process.env.NODE_ENV === 'production') return nextConfig;
|
|
268
276
|
|
|
@@ -292,14 +300,16 @@ function withReticle(nextConfig = {}) {
|
|
|
292
300
|
NEXT_PUBLIC_RETICLE_SDK_VERSION: sdkPackageVersion(),
|
|
293
301
|
},
|
|
294
302
|
webpack(config, ctx) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
+
if (options.sourceMapping !== false) {
|
|
304
|
+
config.module = config.module || { rules: [] };
|
|
305
|
+
config.module.rules = config.module.rules || [];
|
|
306
|
+
config.module.rules.push({
|
|
307
|
+
test: /\.(t|j)sx$/,
|
|
308
|
+
exclude: /node_modules/,
|
|
309
|
+
enforce: 'pre',
|
|
310
|
+
use: [{ loader: require.resolve('./loader.cjs') }],
|
|
311
|
+
});
|
|
312
|
+
}
|
|
303
313
|
return typeof userWebpack === 'function' ? userWebpack(config, ctx) : config;
|
|
304
314
|
},
|
|
305
315
|
};
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
/** Wrap a Next.js config to add dev-only source-file mapping (data-reticle-source), keeping SWC. */
|
|
2
|
-
export function withReticle<T = unknown>(
|
|
2
|
+
export function withReticle<T = unknown>(
|
|
3
|
+
nextConfig?: T,
|
|
4
|
+
options?: {
|
|
5
|
+
/**
|
|
6
|
+
* Stamp `data-reticle-source` on JSX host elements. Default true. Set false for an app that
|
|
7
|
+
* renders through a non-DOM React reconciler (react-three-fiber, react-pdf, ink), where a
|
|
8
|
+
* lowercase tag is not an element and the stamp crashes the app at commit time.
|
|
9
|
+
*/
|
|
10
|
+
sourceMapping?: boolean;
|
|
11
|
+
},
|
|
12
|
+
): T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reticlehq/next",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "Next.js helper for Reticle: keeps SWC, adds source-file mapping via a dev-only webpack pre-loader (data-reticle-source).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Reticle contributors",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@babel/core": "^7.26.0",
|
|
41
|
-
"@reticlehq/babel-plugin": "2.
|
|
41
|
+
"@reticlehq/babel-plugin": "2.14.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"next": ">=13"
|