@thatopen/services 0.36.1 → 0.37.1

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