typerighter 0.3.0 → 0.3.1

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.
@@ -1,6 +1,6 @@
1
1
  import "./shared-DzTfF-_d.js";
2
2
  import { a as e, s as t } from "./constants-B7b8AsH0.js";
3
- import { n, r, t as i } from "./vite-BxXQPieu.js";
3
+ import { n, r, t as i } from "./vite-D9ePlTzy.js";
4
4
  import a from "node:path";
5
5
  import { build as o, createServer as s } from "vite";
6
6
  import c from "picocolors";
@@ -45,12 +45,12 @@ ${r}
45
45
  </html>`;
46
46
  }
47
47
  async function p(e) {
48
- let t = a.join(e, "assets"), n = [], r = await l.readdir(t).catch(() => n), i = [], o = [], s = "";
49
- for (let e of r) e.endsWith(".css") ? i.push(`assets/${e}`) : e.endsWith(".js") && (e.startsWith("client-entry") || e.startsWith("index") ? s = `assets/${e}` : o.push(`assets/${e}`));
50
- return !s && o.length > 0 && (s = o[0], o.splice(0, 1)), {
51
- clientEntry: s,
52
- cssFiles: i,
53
- jsFiles: o
48
+ let t = a.join(e, ".vite", "manifest.json"), n = await l.readFile(t, "utf-8"), r = JSON.parse(n), i = "", o = [], s = [];
49
+ for (let e of Object.values(r)) e.isEntry ? (i = e.file, e.css && o.push(...e.css)) : e.file.endsWith(".js") && s.push(e.file);
50
+ return {
51
+ clientEntry: i,
52
+ cssFiles: o,
53
+ jsFiles: s
54
54
  };
55
55
  }
56
56
  //#endregion
@@ -74,7 +74,12 @@ var m = class {
74
74
  }
75
75
  }, h = "typerighter/client/theme-default";
76
76
  async function g(e, t = {}) {
77
- let { root: s, logger: c } = e, u = a.resolve(s, t.outDir ?? "dist"), f = t.base ?? "/", p = a.join(u, ".client"), g = a.join(u, ".server"), v = await e.getTdContext(), [y, b, x] = await Promise.all([
77
+ let { root: s, logger: c } = e, u = a.resolve(s, t.outDir ?? "dist"), f = t.base ?? "/", p = a.join(u, ".client"), g = a.join(u, ".server");
78
+ await l.rm(u, {
79
+ recursive: !0,
80
+ force: !0
81
+ });
82
+ let v = await e.getTdContext(), [y, b, x] = await Promise.all([
78
83
  v.getConfig(),
79
84
  v.listFiles(),
80
85
  v.listFilesGroupedBySchema()
@@ -94,7 +99,8 @@ async function g(e, t = {}) {
94
99
  contentDir: y.contentDir,
95
100
  layoutImport: h,
96
101
  siteConfig: C,
97
- siteData: w
102
+ siteData: w,
103
+ hasIndex: S
98
104
  }))]);
99
105
  try {
100
106
  let n = i({ context: e }), r = e.createViteLogger(), h = new m(c, "Building client bundle...");
@@ -108,7 +114,7 @@ async function g(e, t = {}) {
108
114
  build: {
109
115
  ...t.viteConfig?.build,
110
116
  outDir: p,
111
- ssrManifest: !0,
117
+ manifest: !0,
112
118
  emptyOutDir: !0,
113
119
  rollupOptions: {
114
120
  ...t.viteConfig?.build?.rollupOptions,
@@ -558,7 +564,7 @@ function B() {
558
564
  r.dispose();
559
565
  }
560
566
  }), t.command("init [root]", "Scaffold a new project").action(async (e) => {
561
- let { initialize: t } = await import("./init-CUo89E7j.js");
567
+ let { initialize: t } = await import("./init-Ci83UWu-.js");
562
568
  await t(H(e));
563
569
  }), t.command("preview [root]", "Preview production build").option("--port <port>", "Port to listen on").action(async (e, t) => {
564
570
  let { preview: n } = await import("vite");
@@ -566,7 +572,7 @@ function B() {
566
572
  root: H(e),
567
573
  preview: { port: t.port }
568
574
  })).printUrls();
569
- }), t.help(), t.version("0.3.0"), t.parse();
575
+ }), t.help(), t.version("0.3.1"), t.parse();
570
576
  }
571
577
  function V(e, t) {
572
578
  let n = t instanceof Error ? t.message : String(t);
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./cli-CoyGXgR1.js";
1
+ import { t as e } from "./cli-VgaueuJP.js";
2
2
  export { e as cli };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./cli-CoyGXgR1.js";
2
- import { t as n } from "./vite-BxXQPieu.js";
3
- import "./plugin-D2xuSVM4.js";
1
+ import { n as e, t } from "./cli-VgaueuJP.js";
2
+ import { t as n } from "./vite-D9ePlTzy.js";
3
+ import "./plugin-DRzll98J.js";
4
4
  export { e as buildSite, t as cli, n as typedown };
@@ -2300,7 +2300,7 @@ function ei(e) {
2300
2300
  build: "typerighter build",
2301
2301
  preview: "typerighter preview"
2302
2302
  },
2303
- devDependencies: { typerighter: "^0.3.0" }
2303
+ devDependencies: { typerighter: "^0.3.1" }
2304
2304
  }, void 0, 2) + "\n";
2305
2305
  }
2306
2306
  function ti() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/build/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACE,KAAK,YAAY,EACzB,MAAM,MAAM,CAAC;AAad,OAAO,KAAK,EACV,UAAU,EACX,MAAM,YAAY,CAAC;AAIpB,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B;AAGD,wBAAsB,SAAS,CAAE,GAAG,EAAE,UAAU,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgJ3F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/build/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACE,KAAK,YAAY,EACzB,MAAM,MAAM,CAAC;AAad,OAAO,KAAK,EACV,UAAU,EACX,MAAM,YAAY,CAAC;AAIpB,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B;AAGD,wBAAsB,SAAS,CAAE,GAAG,EAAE,UAAU,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoJ3F"}
@@ -20,6 +20,8 @@ export interface SsrEntryOptions {
20
20
  siteConfig: string;
21
21
  /** Serialized siteData JSON */
22
22
  siteData: string;
23
+ /** Whether the vault has an index.td file */
24
+ hasIndex: boolean;
23
25
  }
24
26
  export declare function generateAppEntry(options: AppEntryOptions): string;
25
27
  export declare function generateIndexSfc(groups: Record<string, unknown[]>): string;
@@ -1 +1 @@
1
- {"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../../../src/node/plugin/vite/codegen.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,QAAQ,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAGD,wBAAgB,gBAAgB,CAAE,OAAO,EAAE,eAAe,GAAG,MAAM,CAwClE;AAGD,wBAAgB,gBAAgB,CAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,MAAM,CAe3E;AAGD,wBAAgB,gBAAgB,CAAE,OAAO,EAAE,eAAe,GAAG,MAAM,CAuBlE"}
1
+ {"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../../../src/node/plugin/vite/codegen.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,QAAQ,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,QAAQ,EAAE,OAAO,CAAC;CACnB;AAGD,wBAAgB,gBAAgB,CAAE,OAAO,EAAE,eAAe,GAAG,MAAM,CAwClE;AAGD,wBAAgB,gBAAgB,CAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,MAAM,CAe3E;AAGD,wBAAgB,gBAAgB,CAAE,OAAO,EAAE,eAAe,GAAG,MAAM,CA8BlE"}
@@ -0,0 +1 @@
1
+ import "./vite-D9ePlTzy.js";
@@ -70,18 +70,19 @@ export default { name: "index", components: { TdOverview } }
70
70
  <template><TdOverview :groups='${t}' /></template>`;
71
71
  }
72
72
  function m(e) {
73
- let t = `/${e.contentDir}/**/*.td`;
73
+ let t = `/${e.contentDir}/**/*.td`, n = e.hasIndex ? "" : `pages['/${e.contentDir}/${i}'] = import('${i}');`, r = e.hasIndex ? "" : ` || (pagePath === '/' ? pages['/${e.contentDir}/${i}'] : undefined)`;
74
74
  return `
75
75
  import { createTypedownApp } from 'typerighter/client';
76
76
  import { renderToString } from 'vue/server-renderer';
77
77
  import theme from '${e.layoutImport}';
78
78
 
79
79
  const pages = import.meta.glob('${t}', { eager: true });
80
+ ${n}
80
81
 
81
82
  function loadPageModule(pagePath) {
82
83
  const key = '/${e.contentDir}/' + pagePath.replace(/^\\//, '') + '.td';
83
84
  const altKey = '/${e.contentDir}/' + pagePath.replace(/^\\//, '') + '/index.td';
84
- return Promise.resolve(pages[key] || pages[altKey]);
85
+ return Promise.resolve(pages[key] || pages[altKey]${r});
85
86
  }
86
87
 
87
88
  export async function render(url) {
package/dist/vite.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as e } from "./vite-BxXQPieu.js";
2
- import "./plugin-D2xuSVM4.js";
1
+ import { t as e } from "./vite-D9ePlTzy.js";
2
+ import "./plugin-DRzll98J.js";
3
3
  export { 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.3.0",
4
+ "version": "0.3.1",
5
5
  "description": "Typedown: A typed content framework.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -78,8 +78,8 @@
78
78
  "tailwindcss": "^4.3.3",
79
79
  "vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
80
80
  "vue": "^3.0.0",
81
- "@typerighter/rpc-client": "0.3.0",
82
- "@typerighter/rpc-server": "0.3.0"
81
+ "@typerighter/rpc-client": "0.3.1",
82
+ "@typerighter/rpc-server": "0.3.1"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@hdnax/nuclint": "^0.17.4",
@@ -1 +0,0 @@
1
- import "./vite-BxXQPieu.js";