roslib
Version:
The standard ROS Javascript Library
32 lines (31 loc) • 1.19 kB
JavaScript
(map => {
const mapUrl = document.currentScript.src;
const resolve = imports => Object.fromEntries(Object.entries(imports ).map(([k, v]) => [k, new URL(v, mapUrl).href]));
document.head.appendChild(Object.assign(document.createElement("script"), {
type: "importmap",
innerHTML: JSON.stringify({
imports: resolve(map.imports),
scopes: Object.fromEntries(Object.entries(map.scopes).map(([k, v]) => [new URL(k, mapUrl).href, resolve(v)]))
})
}));
})
({
"imports": {
"roslib": "./dist/RosLib.js"
},
"scopes": {
"./": {
"bson": "https://unpkg.com/bson@7.2.0/lib/bson.mjs",
"cbor2": "https://unpkg.com/cbor2@2.2.1/lib/index.js",
"eventemitter3": "https://unpkg.com/eventemitter3@5.0.4/index.mjs",
"fast-png": "https://unpkg.com/fast-png@8.0.0/lib/index.js",
"uuid": "https://unpkg.com/uuid@13.0.0/dist/index.js",
"ws": "https://unpkg.com/ws@8.19.0/browser.js"
},
"https://unpkg.com/": {
"@cto.af/wtf8": "https://unpkg.com/@cto.af/wtf8@0.0.4/lib/index.js",
"fflate": "https://unpkg.com/fflate@0.8.2/esm/browser.js",
"iobuffer": "https://unpkg.com/iobuffer@6.0.1/lib/iobuffer.js"
}
}
});