@thatopen/services 0.36.0 → 0.37.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/cli.js CHANGED
@@ -13762,6 +13762,57 @@ const serveCommand = new Command2("serve").description(
13762
13762
  });
13763
13763
  }
13764
13764
  },
13765
+ {
13766
+ // 🔴 WHAT DRAWS WITH WEBGL ONLY, ON ITS OWN COPY OF three (24-11: the app template's `.3tz` viewer draws with a
13767
+ // library that has no WebGPU, in a renderer of its own, while the app is on three's WebGPU build). Everything under
13768
+ // `src/webgl/` is built with three's plain build, and so is all it imports (its libraries and their addons): a
13769
+ // copy of its own, never shared with the app's, so neither sees the other's. The rest of the app is untouched.
13770
+ name: "webgl-on-its-own-three",
13771
+ setup(build) {
13772
+ const root = require$$2.join(cwd, "src", "webgl");
13773
+ if (!require$$3$1.existsSync(root)) return;
13774
+ const plainThree = require$$2.join(cwd, "node_modules", "three", "build", "three.module.js");
13775
+ const inside = (path2) => path2.startsWith(root + "\\") || path2.startsWith(root + "/");
13776
+ build.onResolve({ filter: /.*/ }, async (args) => {
13777
+ if (args.pluginData === "webgl-inner") return null;
13778
+ const fromWebgl = args.namespace === "webgl";
13779
+ if (!fromWebgl && !(args.resolveDir && inside(require$$2.join(args.resolveDir, args.path)))) return null;
13780
+ if (args.path === "three" || args.path === "three/webgpu") return { path: plainThree, namespace: "webgl" };
13781
+ const resolved = await build.resolve(args.path, { kind: args.kind, resolveDir: args.resolveDir, importer: args.importer, pluginData: "webgl-inner" });
13782
+ if (resolved.errors.length > 0 || resolved.external) return null;
13783
+ if (fromWebgl || inside(resolved.path)) return { path: resolved.path, namespace: "webgl" };
13784
+ return null;
13785
+ });
13786
+ build.onLoad({ filter: /.*/, namespace: "webgl" }, async (args) => {
13787
+ const { readFile } = await import("node:fs/promises");
13788
+ const { dirname, extname } = await import("node:path");
13789
+ const ext = extname(args.path).slice(1);
13790
+ const loader = ["ts", "tsx", "js", "mjs", "cjs", "jsx", "json", "css"].includes(ext) ? ext === "mjs" || ext === "cjs" ? "js" : ext : "js";
13791
+ return { contents: await readFile(args.path, "utf8"), loader, resolveDir: dirname(args.path) };
13792
+ });
13793
+ }
13794
+ },
13795
+ {
13796
+ // 🔴 ON WEBGPU, AS THE PLATFORM'S APPS (Antonio 24-11: «la plantilla debería funcionar siempre con webgpu, misma
13797
+ // configuración que el coordinator»). An app that carries the WebGPU stand-ins (`src/webgpu/`, the app template
13798
+ // does) is built on three's WebGPU build: the engine sees `WebGPURenderer` in `three` and draws with it (WebGL2
13799
+ // only where the browser has no WebGPU), and its WebGL-only addons (fat lines, postprocessing passes) go to the
13800
+ // stand-ins. Before `dedupe-three`, which would answer `three` with the plain build.
13801
+ name: "three-on-webgpu",
13802
+ setup(build) {
13803
+ const standIns = require$$2.join(cwd, "src", "webgpu");
13804
+ const lines = require$$2.join(standIns, "webgpu-lines.mjs");
13805
+ const addons = require$$2.join(standIns, "webgl-addons-stub.mjs");
13806
+ if (!require$$3$1.existsSync(lines) || !require$$3$1.existsSync(addons)) return;
13807
+ build.onResolve({ filter: /^three(\/webgpu)?$/ }, async (args) => {
13808
+ if (args.pluginData === "three-on-webgpu" || args.pluginData === "dedupe-three") return null;
13809
+ const resolved = await build.resolve("three/webgpu", { kind: args.kind, resolveDir: cwd, pluginData: "three-on-webgpu" });
13810
+ return resolved.errors.length > 0 ? null : { path: resolved.path, sideEffects: resolved.sideEffects };
13811
+ });
13812
+ build.onResolve({ filter: /^three\/(examples\/jsm|addons)\/lines\/(Line2|LineSegments2|LineMaterial|Wireframe)\.js$/ }, () => ({ path: lines }));
13813
+ build.onResolve({ filter: /^three\/(examples\/jsm|addons)\/postprocessing\/.*$/ }, () => ({ path: addons }));
13814
+ }
13815
+ },
13765
13816
  {
13766
13817
  // With published packages every `import "three"` lands in the app's
13767
13818
  // single copy, because npm hoists one three to the app root. When the