@mdsnai/sdk 0.2.1 → 0.2.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.
@@ -109,7 +109,7 @@ function blockToSerializableBlock(block) {
109
109
  };
110
110
  }
111
111
  function sendActionFragment(reqAccept, status, markdown, binding, res, options) {
112
- if ((0, negotiate_1.wantsMarkdown)(reqAccept) || !(0, negotiate_1.wantsHtml)(reqAccept)) {
112
+ if ((0, negotiate_1.wantsMarkdown)(reqAccept) && !(0, negotiate_1.wantsHtml)(reqAccept)) {
113
113
  res.status(status).type("text/markdown; charset=utf-8").send(markdown);
114
114
  return;
115
115
  }
@@ -29,7 +29,7 @@ function createStarterSite(targetDir) {
29
29
  start: "mdsn start",
30
30
  },
31
31
  dependencies: {
32
- "@mdsnai/sdk": "^0.2.1",
32
+ "@mdsnai/sdk": "^0.2.2",
33
33
  },
34
34
  }, null, 2) + "\n", "utf8");
35
35
  (0, node_fs_1.writeFileSync)(node_path_1.default.join(targetDir, "pages", "index.md"), `---
@@ -28,7 +28,13 @@ function hasAcceptableMediaType(acceptHeader, matcher) {
28
28
  return parseAcceptHeader(acceptHeader).some((entry) => entry.quality > 0 && matcher(entry.mediaType));
29
29
  }
30
30
  function wantsHtml(acceptHeader) {
31
- return hasAcceptableMediaType(acceptHeader, (mediaType) => mediaType === "text/html" || mediaType === "application/xhtml+xml");
31
+ return hasAcceptableMediaType(acceptHeader, (mediaType) => {
32
+ if (mediaType === "*/*")
33
+ return true;
34
+ if (mediaType === "text/*")
35
+ return true;
36
+ return mediaType === "text/html" || mediaType === "application/xhtml+xml";
37
+ });
32
38
  }
33
39
  function wantsMarkdown(acceptHeader) {
34
40
  return hasAcceptableMediaType(acceptHeader, (mediaType) => mediaType === "text/markdown");
@@ -15,7 +15,7 @@ function renderHostedPage(rawPage, options) {
15
15
  body: "Not Acceptable",
16
16
  };
17
17
  }
18
- if (!(0, negotiate_1.wantsHtml)(options.accept)) {
18
+ if ((0, negotiate_1.wantsMarkdown)(options.accept) && !(0, negotiate_1.wantsHtml)(options.accept)) {
19
19
  return {
20
20
  status: 200,
21
21
  contentType: "text/markdown; charset=utf-8",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdsnai/sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "private": false,
5
5
  "description": "SDK, framework host, parser, renderer, and CLI for building MDSN sites.",
6
6
  "license": "MIT",