Public
Edited
Feb 8, 2024
Paused
Importers
Insert cell
Insert cell
Insert cell
output = compile(input).code
Insert cell
Insert cell
mm.d({ a_in: 2, b_in: 3 })
Insert cell
introspection(input).cul_input_map
Insert cell
mm = require(URL.createObjectURL(
new Blob([b64_to_utf8(m)], {
type: "text/javascript"
})
))
Insert cell
rollup = require("@rollup/browser@4.9.2/dist/rollup.browser.js")
Insert cell
modules = ({
"./cul_scope_0.mjs": output
//"./cul_scope_0.mjs":
// "import foo from 'foo.js'; import a from 'aaa.js'; export {a}; console.log(foo);",
//"foo.js": "import a from 'aaa.js?fff=3';export default a;",
//"aaa.js": "export default 33;"
//"aaa.js?fff=3": "export default 33;"
})
Insert cell
m = rollup
.rollup({
input: "./cul_scope_0.mjs",
plugins: [
{
name: "loader",
transform(code, filename) {
console.log("TRANSFORM", code, filename);
},
resolveId(source) {
console.log("RESOLVE " + source);
if (modules.hasOwnProperty(source.split("?")[0])) {
return source; //.split("?")[0];
// resolving to that was a bad idea
}
},
load(id) {
console.log("LOAD", id);
if (modules.hasOwnProperty(id.split("?")[0])) {
return modules[id.split("?")[0]];
}
}
},
{
name: "ddd",
buildEnd(e) {
console.log("END", e);
},
resolveId(source) {
order: "pre", console.log("B", source);
if (modules.hasOwnProperty(source)) {
return source;
}
},
load(id) {
console.log(id);
}
}
]
})
.then((bundle) => bundle.generate({ format: "amd" }))
.then(({ output }) => {
console.log(" OUT ", output[0].code + " OVER");
return output[0].code;
})
Insert cell
bundle = (input) => {
let modules = { "./cul_scope_0.mjs": compile(input) };

return rollup
.rollup({
input: "./cul_scope_0.mjs",
plugins: [
{
name: "loader",
transform(code, filename) {
console.log("TRANSFORM", code, filename);
},
resolveId(source) {
console.log("RESOLVE " + source);
if (modules.hasOwnProperty(source.split("?")[0])) {
return source; //.split("?")[0];
// resolving to that was a bad idea
}
},
load(id) {
console.log("LOAD", id);
if (modules.hasOwnProperty(id.split("?")[0])) {
return modules[id.split("?")[0]];
}
}
},
{
name: "ddd",
buildEnd(e) {
console.log("END", e);
},
resolveId(source) {
order: "pre", console.log("B", source);
if (modules.hasOwnProperty(source)) {
return source;
}
},
load(id) {
console.log(id);
}
}
]
})
.then((bundle) => bundle.generate({ format: "amd" }))
.then(({ output }) => {
console.log(" OUT ", output[0].code + " OVER");
return output[0].code;
});
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
introspection(input).cul_input_map.get("0_a")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more