orator-static-server 2.1.2 → 2.1.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/package.json
CHANGED
|
@@ -34,13 +34,18 @@ class OratorStaticServer extends libFableServiceProviderBase
|
|
|
34
34
|
this.routes = [];
|
|
35
35
|
|
|
36
36
|
// This is here because libMime has a breaking change from v1 to v2 and the lookup function was update to be getType per https://stackoverflow.com/a/60741078
|
|
37
|
-
//
|
|
38
|
-
//
|
|
37
|
+
// mime v4 additionally ships as ESM, so require() returns a module namespace object where getType lives on .default rather than the top level.
|
|
38
|
+
// We don't want to introspect properties on this library every single time we need to check mime types, so resolve the callable once here.
|
|
39
39
|
this.oldLibMime = false;
|
|
40
|
+
this.libMime = libMime;
|
|
40
41
|
if ('lookup' in libMime)
|
|
41
42
|
{
|
|
42
43
|
this.oldLibMime = true;
|
|
43
44
|
}
|
|
45
|
+
else if (libMime.default && typeof libMime.default.getType === 'function')
|
|
46
|
+
{
|
|
47
|
+
this.libMime = libMime.default;
|
|
48
|
+
}
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
/**
|
|
@@ -55,11 +60,11 @@ class OratorStaticServer extends libFableServiceProviderBase
|
|
|
55
60
|
|
|
56
61
|
if (this.oldLibMime)
|
|
57
62
|
{
|
|
58
|
-
tmpHeader = libMime.lookup(pFileName);
|
|
63
|
+
tmpHeader = this.libMime.lookup(pFileName);
|
|
59
64
|
}
|
|
60
65
|
else
|
|
61
66
|
{
|
|
62
|
-
tmpHeader = libMime.getType(pFileName);
|
|
67
|
+
tmpHeader = this.libMime.getType(pFileName);
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
if (!tmpHeader)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
body { font-family: sans-serif; color: #333; }
|
|
1
|
+
body { font-family: sans-serif; color: var(--theme-color-text-primary, #333); }
|