Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,32 @@ import width from "./width.js";
export default Object.assign(function Library(resolver) {
const require = requirer(resolver);
Object.defineProperties(this, properties({
DOM: () => DOM,
FileAttachment: () => NoFileAttachments,
Files: () => Files,
Generators: () => Generators,
Inputs: () => require("@observablehq/inputs@0.8.0/dist/inputs.umd.min.js"),
Mutable: () => Mutable,
Plot: () => require("@observablehq/plot@0.1.0/dist/plot.umd.min.js"),
Promises: () => Promises,
SQLite: () => SQLite(require),
_: () => require("lodash@4.17.21/lodash.min.js"),
d3: () => require("d3@6.7.0/dist/d3.min.js"),
dot: () => require("@observablehq/graphviz@0.2.1/dist/graphviz.min.js"),
htl: () => require("htl@0.2.5/dist/htl.min.js"),
html: () => html,
md: () => md(require),
now: now,
now,
require: () => require,
resolve: () => resolve,
svg: () => svg,
tex: () => tex(require),
vl: () => vegalite(require),
width: width
width,

// Note: these are namespace objects, and thus exposed directly rather than
// being wrapped in a function. This allows library.Generators to resolve,
// rather than needing module.value.
DOM,
Files,
Generators,
Promises
}));
}, {resolve: requireDefault.resolve});

Expand Down
7 changes: 7 additions & 0 deletions test/generators/generators-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import range from "../../src/generators/range";
import valueAt from "../../src/generators/valueAt";
import observe from "../../src/generators/observe";
import queue from "../../src/generators/queue";
import Library from "../../src/library";

test("library.Generators.observe is a function", t => {
const library = new Library();
t.equal(typeof library.Generators.observe, "function");
t.end();
});

test("filter(value, fn) filters", t => {
function* input() {
Expand Down