BJSPM
BJSPM is an npm-like package manager made specially for Babylon.js. Its development started over a year ago with the goal of having a way for us to more easily share code and assets. Instead of having to go through npm, GitHub, playgrounds, the forum, etc., we can now get and share ready-to-go packages with just a few search queries and CLI commands!
Features:
- No login requied;
- Unlimited public packages;
- Unlimited private packages, with the ability to manage user permissions;
- Not just code – any asset allowed;
- You can upload individual files, no need to make a
package.json
file or anything; - Packages and their files are available on the website, no CORS restrictions;
- Packages can be used in the ES6 Playground;
- Packages of up to 1 GiB in size.
ES6 Playground
The ES6 Playground is a derivative of the Babylon.js Playground, made to complement BJSPM. It uses Babylon.js’ ES6 modules instead of the global BABYLON
object, so you can import package modules.
Features:
- Auto-adds missing class imports on run (i.e. you can leave out the
BABYLON
prefix); - Converts
BABYLON
code to ES6 code on run; - Catches Babylon.js errors to detect missing side effect imports, automatically patches the code (but cannot catch errors in async code);
- Import any BJSPM package, IntelliSense enabled (checks for a corresponding
.d.ts
file for every imported.js
module).
Important differences:
- Playgrounds get executed in an
iframe
with their ownwindow
object, this is to prevent old imports to persist, which would allow missing imports in the editor to go unnoticed; - The “latest” Babylon.js version on the ES6 Playground will lag behind the actual latest as seen on the Babylon.js Playground, because it has to be updated manually;
- There is no way to search for ES6 playground in the database.
Demo:
https://playground.croncle.com/#CEGIX2
Please use the Babylon.js Playground if you don’t use a BJSPM package or have no need for ES6 modules, so as to keep things in one place.
Onwards!
Now let’s add some packages! Whether you have a whole extension or just a code snippet, please do share!
Please be aware that there are bound to be some bugs; if you find them, please send me a message. Any feedback is welcome.