@observablehq/notebook-kit 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json
CHANGED
|
@@ -23,11 +23,18 @@ function resolve(_specifier) {
|
|
|
23
23
|
const { name, range, path } = parseNpmSpecifier(specifier);
|
|
24
24
|
return `https://cdn.jsdelivr.net/npm/${name}${range}${path + (isFile(path) || isDirectory(path) ? "" : "/+esm")}`;
|
|
25
25
|
}
|
|
26
|
+
/** Promote exclusive default export to module. */
|
|
27
|
+
function defaultify(module) {
|
|
28
|
+
for (const key in module)
|
|
29
|
+
if (key !== "default")
|
|
30
|
+
return { ...module }; // any named export
|
|
31
|
+
return "default" in module ? module.default : { ...module }; // promote exclusive default export
|
|
32
|
+
}
|
|
26
33
|
/** Allow mutation of required modules while maintaining a canonical instance; ugly! */
|
|
27
34
|
function objectify(module) {
|
|
28
35
|
let object = cache.get(module);
|
|
29
36
|
if (!object)
|
|
30
|
-
cache.set(module, (object =
|
|
37
|
+
cache.set(module, (object = defaultify(module)));
|
|
31
38
|
return object;
|
|
32
39
|
}
|
|
33
40
|
/** Returns true for e.g. https://example.com/ */
|
|
@@ -19,7 +19,7 @@ export class ZipArchive {
|
|
|
19
19
|
}
|
|
20
20
|
class ZipArchiveEntry extends AbstractFile {
|
|
21
21
|
constructor(object) {
|
|
22
|
-
super(
|
|
22
|
+
super(object.name);
|
|
23
23
|
Object.defineProperty(this, "href", {
|
|
24
24
|
enumerable: true,
|
|
25
25
|
configurable: true,
|
|
@@ -46,6 +46,9 @@ class ZipArchiveEntry extends AbstractFile {
|
|
|
46
46
|
async json() {
|
|
47
47
|
return JSON.parse(await this.text());
|
|
48
48
|
}
|
|
49
|
+
async stream() {
|
|
50
|
+
return (await this.blob()).stream(); // since href is unavailable
|
|
51
|
+
}
|
|
49
52
|
}
|
|
50
53
|
Object.defineProperty(ZipArchive, "name", { value: "ZipArchive" }); // prevent mangling
|
|
51
54
|
Object.defineProperty(ZipArchiveEntry, "name", { value: "ZipArchiveEntry" }); // prevent mangling
|