depthview-r3f-bridge 0.1.0 → 0.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/dist/vite.js CHANGED
@@ -99,12 +99,38 @@ function depthviewBabelPlugin(api, options = {}) {
99
99
  }
100
100
 
101
101
  // src/vite.ts
102
+ var CLIENT_ID = "virtual:depthview-client";
103
+ var RESOLVED_CLIENT_ID = `\0${CLIENT_ID}`;
104
+ var CLIENT_CODE = `
105
+ const api = { version: 1, load: () => import('depthview-r3f-bridge/look') };
106
+ window.__DEPTHVIEW_LOOK__ = api;
107
+ window.postMessage(
108
+ { source: 'depthview', v: 1, id: 'look-' + Date.now().toString(36), type: 'look:ready', payload: { version: 1 } },
109
+ window.location.origin === 'null' ? '*' : window.location.origin,
110
+ );
111
+ `;
102
112
  function depthviewVite(options = {}) {
103
113
  const include = options.include ?? /\.[jt]sx$/;
104
114
  return {
105
115
  name: "depthview:source-locations",
106
116
  enforce: "pre",
107
117
  apply: "serve",
118
+ // The look runtime must use the very three.js the site renders with.
119
+ // Pre-bundled when the server starts, so turning an effect on never makes Vite discover new
120
+ // dependencies and reload the page under the inspector.
121
+ config: () => options.look === false ? {} : {
122
+ resolve: { dedupe: ["three"] },
123
+ optimizeDeps: { include: ["depthview-r3f-bridge/look"] }
124
+ },
125
+ resolveId: (id) => id === CLIENT_ID ? RESOLVED_CLIENT_ID : null,
126
+ load: (id) => id === RESOLVED_CLIENT_ID ? CLIENT_CODE : null,
127
+ transformIndexHtml: () => options.look === false ? [] : [
128
+ {
129
+ tag: "script",
130
+ attrs: { type: "module", src: `/@id/__x00__${CLIENT_ID}` },
131
+ injectTo: "head"
132
+ }
133
+ ],
108
134
  async transform(code, id) {
109
135
  const file = id.split("?")[0];
110
136
  if (!include.test(file) || file.includes("/node_modules/") || !code.includes("<"))
package/package.json CHANGED
@@ -1,14 +1,9 @@
1
1
  {
2
2
  "name": "depthview-r3f-bridge",
3
- "version": "0.1.0",
4
- "description": "Development-only bridge between a React Three Fiber project and the Depthview inspector: source locations for JSX three elements and exact scene/scroll access.",
3
+ "version": "0.3.0",
4
+ "description": "Bridge between a three.js / React Three Fiber project and the Depthview inspector: source locations, scroll camera paths, realism looks and site controls.",
5
5
  "license": "MIT",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/himavamsi12/depthview.git",
9
- "directory": "packages/r3f-bridge"
10
- },
11
- "homepage": "https://github.com/himavamsi12/depthview/tree/main/packages/r3f-bridge#readme",
6
+ "homepage": "https://github.com/himavamsi12/depthview-plugin#readme",
12
7
  "type": "module",
13
8
  "sideEffects": false,
14
9
  "files": [
@@ -25,6 +20,28 @@
25
20
  "types": "./dist/types/cameraPath.d.ts",
26
21
  "default": "./dist/cameraPath.js"
27
22
  },
23
+ "./path": {
24
+ "types": "./dist/types/path.d.ts",
25
+ "default": "./dist/path.js"
26
+ },
27
+ "./look": {
28
+ "types": "./dist/types/lookRuntime.d.ts",
29
+ "default": "./dist/look.js"
30
+ },
31
+ "./look/react": {
32
+ "types": "./dist/types/lookReact.d.ts",
33
+ "default": "./dist/lookReact.js"
34
+ },
35
+ "./controls": {
36
+ "types": "./dist/types/controls.d.ts",
37
+ "development": "./dist/controls.js",
38
+ "default": "./dist/controls.prod.js"
39
+ },
40
+ "./controls/react": {
41
+ "types": "./dist/types/controlsReact.d.ts",
42
+ "development": "./dist/controlsReact.js",
43
+ "default": "./dist/controlsReact.prod.js"
44
+ },
28
45
  "./vite": {
29
46
  "types": "./dist/types/vite.d.ts",
30
47
  "default": "./dist/vite.js"
@@ -66,5 +83,8 @@
66
83
  "typescript": "~5.9.3",
67
84
  "vite": "^7.3.8",
68
85
  "vitest": "^3.2.7"
86
+ },
87
+ "bugs": {
88
+ "url": "https://github.com/himavamsi12/depthview-plugin/issues"
69
89
  }
70
90
  }