Running https://grid.space/kiri/engine.html Locally

Hello!

I’m trying to better understand the Kiri:Moto engine and I’m trying to get this engine.html page (Kiri:Moto Javascript Engine API) up and running locally so I can interact with it.

In particular it looks like /code/engine.js is maybe dynamically generated?

How would I go about generating that file?

Hey there,

That’s great that you’re trying to learn more about the Kiri:Moto internals.
If you want to run the engine.html page, you can achive that by running the dev npm script and then going to http://localhost:8080/kiri/engine.html . If you open up devtool from there, you’ll see that engine.js looks like this:

self.debug=true;
(function() { let load = [ 
"/src/main/gapp.js?_4.1.6",
"/src/add/array.js?_4.1.6",
"/src/add/class.js?_4.1.6",
"/src/ext/three.js?_4.1.6",
"/src/add/three.js?_4.1.6",
"/src/data/local.js?_4.1.6",
"/src/ext/clip2.js?_4.1.6",
"/src/ext/earcut.js?_4.1.6",
"/src/geo/base.js?_4.1.6",
"/src/geo/bounds.js?_4.1.6",
"/src/geo/line.js?_4.1.6",
"/src/geo/point.js?_4.1.6",
"/src/geo/paths.js?_4.1.6",
"/src/geo/points.js?_4.1.6",
"/src/geo/polygons.js?_4.1.6",
"/src/geo/polygon.js?_4.1.6",
"/src/geo/slope.js?_4.1.6",
"/src/moto/license.js?_4.1.6",
"/src/load/stl.js?_4.1.6",
"/src/kiri/conf.js?_4.1.6",
"/src/kiri/client.js?_4.1.6",
"/src/kiri/utils.js?_4.1.6",
"/src/kiri/widget.js?_4.1.6",
"/src/moto/broker.js?_4.1.6",
"/src/kiri/consts.js?_4.1.6",
"/src/kiri/api.js?_4.1.6",
"/src/kiri/slice.js?_4.1.6",
"/src/kiri/layers.js?_4.1.6",
"/src/kiri/codec.js?_4.1.6",
"/src/mesh/util.js?_4.1.6",
"/src/kiri-run/engine.js?_4.1.6",
"/src/main/kiri.js?_4.1.6",
]; function load_next() {
let file = load.shift();
if (!file) return;
if (!self.document) { importScripts(file); return load_next() }
let s = document.createElement("script");
s.type = "text/javascript";
s.src = file;
s.onload = load_next;
document.head.appendChild(s);
} load_next(); })();

In dev mode, it will show you all the files that it is built from.

In the production mode, these files get bundled, and the code for the bundling can be found in the concatCode function at line 685 of app.js.

Hope this helps!

1 Like

That is super helpful! I will start there, thank you :smiley: