typerighter 0.11.0 → 0.11.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.

Potentially problematic release.


This version of typerighter might be problematic. Click here for more details.

@@ -1,11 +1,11 @@
1
- import { B as __toESM, C as isUrlToPage, D as filestem, I as INDEX_FILENAME, L as SEARCH_FIELDS, N as EXTERNAL_URL_RE, O as isContentFile, P as CONTENT_EXTENSIONS, R as SEARCH_STORE_FIELDS, S as isUrlExternal, c as stripHtml, d as buildContentTree, f as buildDirectoryListingMap, m as getTdResourceTitle, p as getTdIndexTitle, s as escapeHtml$2, y as getTdContentUrl, z as __commonJSMin } from "./shared-BIdsxcZ2.js";
1
+ import { A as isContentFile, B as SEARCH_STORE_FIELDS, C as isUrlToPage, F as EXTERNAL_URL_RE, H as __toESM, I as CONTENT_EXTENSIONS, O as extname, R as INDEX_FILENAME, S as isUrlExternal, V as __commonJSMin, c as stripHtml, d as buildContentTree, f as buildDirectoryListingMap, k as filestem, m as getTdResourceTitle, p as getTdIndexTitle, s as escapeHtml$2, y as getTdContentUrl, z as SEARCH_FIELDS } from "./shared-xivlz-gA.js";
2
2
  import { i as renderToString, n as ParseError, t as MiniSearch } from "./es-CG8rP6j5.js";
3
+ import fs, { createReadStream, existsSync, statSync } from "node:fs";
3
4
  import path, { resolve } from "node:path";
4
5
  import pc from "picocolors";
5
6
  import tailwindcss from "@tailwindcss/vite";
6
7
  import vue from "@vitejs/plugin-vue";
7
8
  import { createLogger, normalizePath } from "vite";
8
- import fs from "node:fs";
9
9
  import { RpcServer } from "@typerighter/rpc-server";
10
10
  import { RpcClient } from "@typerighter/rpc-client";
11
11
  import MarkdownIt from "markdown-it";
@@ -10472,6 +10472,23 @@ function resolveAliases() {
10472
10472
  }
10473
10473
  //#endregion
10474
10474
  //#region src/node/plugin/vite/index.ts
10475
+ var COMMON_MIME_TYPES = {
10476
+ jpg: "image/jpeg",
10477
+ jpeg: "image/jpeg",
10478
+ png: "image/png",
10479
+ gif: "image/gif",
10480
+ webp: "image/webp",
10481
+ svg: "image/svg+xml",
10482
+ avif: "image/avif",
10483
+ ico: "image/x-icon",
10484
+ pdf: "application/pdf",
10485
+ zip: "application/zip",
10486
+ mp3: "audio/mpeg",
10487
+ mp4: "video/mp4",
10488
+ woff: "font/woff",
10489
+ woff2: "font/woff2",
10490
+ ttf: "font/ttf"
10491
+ };
10475
10492
  function generateClientAppEntry(A) {
10476
10493
  let { contentDir: j } = A, M = `/${j}/**/*.{td,md}`, N = JSON.stringify({
10477
10494
  title: A.siteTitle,
@@ -10603,7 +10620,25 @@ function typedown(A = {}) {
10603
10620
  M && invalidateSearchIndex(M);
10604
10621
  }), hmrInvalidateAll(M));
10605
10622
  }
10606
- return j.rpc.onContentCreated(I), j.rpc.onContentDeleted(I), j.rpc.onSchemaChanged(() => M && hmrInvalidateAll(M)), j.rpc.onSchemaCreated(() => M && hmrInvalidateAll(M)), j.rpc.onSchemaDeleted(() => M && hmrInvalidateAll(M)), () => {
10623
+ j.rpc.onContentCreated(I), j.rpc.onContentDeleted(I), j.rpc.onSchemaChanged(() => M && hmrInvalidateAll(M)), j.rpc.onSchemaCreated(() => M && hmrInvalidateAll(M)), j.rpc.onSchemaDeleted(() => M && hmrInvalidateAll(M));
10624
+ let L = "vault/content";
10625
+ return j.getConfig().then((A) => {
10626
+ L = A.contentDir;
10627
+ }).catch(() => {}), A.middlewares.use((A, j, N) => {
10628
+ if (!A.url || A.method !== "GET" || j.writableEnded || !M) return N();
10629
+ let P = A.url.split("?")[0].split("#")[0];
10630
+ if (P.startsWith("/@") || P.startsWith("/node_modules")) return N();
10631
+ let F = P.replace(/^\//, ""), I = resolve(M.config.root, L, F);
10632
+ if (existsSync(I)) try {
10633
+ let A = statSync(I);
10634
+ if (A.isFile()) {
10635
+ let M = COMMON_MIME_TYPES[extname(I).slice(1).toLowerCase()] ?? "application/octet-stream";
10636
+ j.setHeader("Content-Type", M), j.setHeader("Content-Length", A.size), createReadStream(I).pipe(j);
10637
+ return;
10638
+ }
10639
+ } catch {}
10640
+ N();
10641
+ }), () => {
10607
10642
  A.middlewares.use((A, M, N) => {
10608
10643
  if (!A.url || M.writableEnded || A.url.startsWith("/@") || A.url.startsWith("/node_modules") || A.url.includes(".")) return N();
10609
10644
  j.getConfig().then((A) => {
package/dist/vite.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "./vite-8CV23ALg.js";
1
+ import { n as e, t } from "./vite-ofOi3oqG.js";
2
2
  export { t as generateClientAppEntry, e as typedown };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "typerighter",
4
- "version": "0.11.0",
4
+ "version": "0.11.2",
5
5
  "description": "Typedown: A typed content framework.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -85,8 +85,8 @@
85
85
  "tailwindcss": "^4.3.3",
86
86
  "vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
87
87
  "vue": "^3.0.0",
88
- "@typerighter/rpc-server": "0.11.0",
89
- "@typerighter/rpc-client": "0.11.0"
88
+ "@typerighter/rpc-client": "0.11.2",
89
+ "@typerighter/rpc-server": "0.11.2"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@hdnax/nuclint": "^0.17.4",