@observablehq/notebook-kit 1.7.3 → 1.7.4
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
|
@@ -21,7 +21,7 @@ function resolve(_specifier) {
|
|
|
21
21
|
if (isProtocol(specifier) || isLocal(specifier))
|
|
22
22
|
return specifier;
|
|
23
23
|
const { name, range, path } = parseNpmSpecifier(specifier);
|
|
24
|
-
return `https://cdn.jsdelivr.net/npm/${name}${range}${path + (isFile(path) || isDirectory(path) ? "" : "/+esm")}`;
|
|
24
|
+
return `https://cdn.jsdelivr.net/npm/${name}${range}${path + ((isFile(path) && !isJavaScript(path)) || isDirectory(path) ? "" : "/+esm")}`;
|
|
25
25
|
}
|
|
26
26
|
/** Promote exclusive default export to module. */
|
|
27
27
|
function defaultify(module) {
|
|
@@ -46,10 +46,14 @@ function isLocal(specifier) {
|
|
|
46
46
|
return /^(\.\/|\.\.\/|\/)/.test(specifier);
|
|
47
47
|
}
|
|
48
48
|
/** Returns true for e.g. foo/bar.js */
|
|
49
|
+
function isJavaScript(specifier) {
|
|
50
|
+
return /\.js$/i.test(specifier);
|
|
51
|
+
}
|
|
52
|
+
/** Returns true for e.g. foo/bar.txt */
|
|
49
53
|
function isFile(specifier) {
|
|
50
|
-
return
|
|
54
|
+
return /\.\w*$/.test(specifier);
|
|
51
55
|
}
|
|
52
56
|
/** Returns true for e.g. foo/bar/ */
|
|
53
57
|
function isDirectory(specifier) {
|
|
54
|
-
return
|
|
58
|
+
return /\/$/.test(specifier);
|
|
55
59
|
}
|