typerighter 0.11.5 → 0.12.0

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,5 +1,5 @@
1
1
  import { A as e, I as t, L as n, M as r, d as i, f as a, s as o } from "./shared-xivlz-gA.js";
2
- import { a as s, n as c, t as l } from "./vite-ofOi3oqG.js";
2
+ import { a as s, n as c, t as l } from "./vite-sjqEapXH.js";
3
3
  import u from "node:fs";
4
4
  import d from "node:path";
5
5
  import f from "picocolors";
@@ -110,14 +110,14 @@ async function S(e, t = {}) {
110
110
  await h.mkdir(M, { recursive: !0 });
111
111
  let N = d.join(M, "client-entry.js"), P = d.join(M, "ssr-entry.js");
112
112
  await Promise.all([h.writeFile(N, l({
113
- contentDir: _.contentDir,
113
+ rootDir: _.rootDir,
114
114
  siteTitle: _.siteTitle,
115
115
  siteDescription: _.siteDescription,
116
116
  repo: _.repo,
117
117
  contentTree: k,
118
118
  schemas: O
119
119
  })), h.writeFile(P, C({
120
- contentDir: _.contentDir,
120
+ rootDir: _.rootDir,
121
121
  layoutImport: x,
122
122
  siteConfig: A,
123
123
  siteData: j
@@ -177,7 +177,7 @@ async function S(e, t = {}) {
177
177
  let D = T(S, s);
178
178
  await h.writeFile(d.join(o, "sitemap.xml"), D);
179
179
  let O = d.join(u, "assets"), A = d.join(o, "assets");
180
- await h.cp(O, A, { recursive: !0 }).catch(() => {}), await w(d.join(n, _.contentDir), o);
180
+ await h.cp(O, A, { recursive: !0 }).catch(() => {}), await w(d.join(n, _.rootDir), o);
181
181
  } finally {
182
182
  await Promise.all([
183
183
  h.rm(M, {
@@ -197,7 +197,7 @@ async function S(e, t = {}) {
197
197
  a.log(`\nBuild complete. Output: ${o}`);
198
198
  }
199
199
  function C(e) {
200
- let r = `/${e.contentDir}/${n}`, i = JSON.parse(e.siteConfig), o = JSON.parse(e.siteData), s = a((o.contentTree ?? {
200
+ let r = `/${e.rootDir}/${n}`, i = JSON.parse(e.siteConfig), o = JSON.parse(e.siteData), s = a((o.contentTree ?? {
201
201
  rootItems: [],
202
202
  children: []
203
203
  }).children ?? [], i.title ?? ""), c = JSON.stringify({
@@ -224,7 +224,7 @@ function findPage(base) {
224
224
  }
225
225
 
226
226
  function loadPageModule(pagePath) {
227
- const base = ('/${e.contentDir}/' + pagePath).replace(/\\/+/g, '/').replace(/\\/$/, '');
227
+ const base = ('/${e.rootDir}/' + pagePath).replace(/\\/+/g, '/').replace(/\\/$/, '');
228
228
  const page = findPage(base);
229
229
  if (page) return Promise.resolve(page);
230
230
 
@@ -652,7 +652,7 @@ function Y() {
652
652
  n.dispose();
653
653
  }
654
654
  }), e.command("init [root]", "Scaffold a new project").action(async (e) => {
655
- let { initialize: t } = await import("./init-CBURu_-H.js");
655
+ let { initialize: t } = await import("./init-Cr4wOumz.js");
656
656
  await t(Z(e));
657
657
  }), e.command("preview [root]", "Preview production build").option("--port <port>", "Port to listen on").action(async (e, t) => {
658
658
  let { preview: n } = await import("vite");
@@ -671,7 +671,7 @@ function Y() {
671
671
  for (let r of n) {
672
672
  let n = await e.formatFile(r);
673
673
  if (n.changed) {
674
- let e = d.resolve(t.contentDir, r);
674
+ let e = d.resolve(t.rootDir, r);
675
675
  u.writeFileSync(e, n.content), i++;
676
676
  }
677
677
  }
@@ -682,7 +682,7 @@ function Y() {
682
682
  } finally {
683
683
  n.dispose();
684
684
  }
685
- }), e.help(), e.version("0.11.5"), e.parse();
685
+ }), e.help(), e.version("0.12.0"), e.parse();
686
686
  }
687
687
  function X(e, t) {
688
688
  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-kT3xfgwK.js";
1
+ import { t as e } from "./cli-Be6WWIHS.js";
2
2
  export { e as cli };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./vite-ofOi3oqG.js";
1
+ import { n as e, t } from "./vite-sjqEapXH.js";
2
2
  import "./vite.js";
3
- import { n, t as r } from "./cli-kT3xfgwK.js";
3
+ import { n, t as r } from "./cli-Be6WWIHS.js";
4
4
  export { n as buildSite, r as cli, t as generateClientAppEntry, e as typedown };
@@ -1,5 +1,5 @@
1
1
  import { V as e, s as t } from "./shared-xivlz-gA.js";
2
- import { i as n, r } from "./vite-ofOi3oqG.js";
2
+ import { i as n, r } from "./vite-sjqEapXH.js";
3
3
  import { a as i, i as a, n as o, r as s, t as c } from "./brand-CG1fQshq.js";
4
4
  import "node:fs";
5
5
  import l from "node:path";
@@ -2303,7 +2303,7 @@ function ai(e) {
2303
2303
  build: "typerighter build",
2304
2304
  preview: "typerighter preview"
2305
2305
  },
2306
- devDependencies: { typerighter: "^0.11.5" }
2306
+ devDependencies: { typerighter: "^0.12.0" }
2307
2307
  }, void 0, 2) + "\n";
2308
2308
  }
2309
2309
  function oi() {
@@ -2318,8 +2318,7 @@ function ci() {
2318
2318
  function li(e) {
2319
2319
  return `version: "1.0.0"
2320
2320
  vault:
2321
- content_dir: vault/content
2322
- schema_dir: vault/schemas
2321
+ root_dir: "vault"
2323
2322
  site:
2324
2323
  title: "${e.siteTitle}"
2325
2324
  description: "${e.siteDescription}"
@@ -2338,7 +2337,7 @@ async function di(e, t) {
2338
2337
  return br(n) && (qr("Cancelled."), process.exit(0)), n;
2339
2338
  }
2340
2339
  async function fi(e, t) {
2341
- let n = l.join(e, "vault", "content"), r = l.join(e, "vault", "schemas"), i = l.join(e, "public"), a = l.join(e, ".typedown", ".local");
2340
+ let n = l.join(e, "vault"), r = l.join(e, "vault", "_types"), i = l.join(e, "public"), a = l.join(e, ".typedown", ".local");
2342
2341
  await Promise.all([
2343
2342
  u.mkdir(n, { recursive: !0 }),
2344
2343
  u.mkdir(r, { recursive: !0 }),
@@ -19,7 +19,6 @@ export declare class TypedownContext {
19
19
  listFiles(): Promise<string[]>;
20
20
  listFilesGroupedBySchema(): Promise<SchemaGroups>;
21
21
  getConfig(): Promise<TdSiteConfig>;
22
- getAssetDir(filepath: string): Promise<string>;
23
22
  getSchema(schema: string): Promise<TdSchemaInfo>;
24
23
  listSchemas(): Promise<string[]>;
25
24
  checkVault(): Promise<TdDiagnosticReport>;
@@ -1 +1 @@
1
- {"version":3,"file":"typedown-context.d.ts","sourceRoot":"","sources":["../../../src/node/lib/typedown-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EAAE,kBAAkB,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAChF,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACmB,KAAK,gBAAgB,EAC9C,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,YAAY,EACb,MAAM,UAAU,CAAC;AAIlB,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,GAAG,CAAmB;gBAEjB,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,gBAAgB;IAMpD,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,0BAA0B,CAA2B;IAC7D,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,eAAe,CAAmC;IAC1D,OAAO,CAAC,aAAa,CAAsC;IAE3D,OAAO,CAAC,aAAa,CAAK;IAE1B,OAAO,CAAC,4BAA4B;IA8DpC,IAAI,GAAG,IAAK,SAAS,CAEpB;IAIK,OAAO,CAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAIpD,QAAQ,CAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAatD,SAAS,IAAK,OAAO,CAAC,MAAM,EAAE,CAAC;IAQ/B,wBAAwB,IAAK,OAAO,CAAC,YAAY,CAAC;IAgBlD,SAAS,IAAK,OAAO,CAAC,YAAY,CAAC;IASnC,WAAW,CAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAM/C,SAAS,CAAE,M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YAAY,CAAC;IAgBlD,SAAS,IAAK,OAAO,CAAC,YAAY,CAAC;IAQnC,SAAS,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAYjD,WAAW,IAAK,OAAO,CAAC,MAAM,EAAE,CAAC;IAQjC,UAAU,IAAK,OAAO,CAAC,kBAAkB,CAAC;IAI1C,UAAU,CAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAI5D,IAAI,EAAE,IAAK,gBAAgB,CAE1B;CACF"}
@@ -2,8 +2,8 @@ import { type Plugin } from 'vite';
2
2
  import { type AppContext } from '../../context';
3
3
  import type { ContentTree } from '@/shared';
4
4
  export interface ClientAppEntryOptions {
5
- /** Content directory relative to project root */
6
- contentDir: string;
5
+ /** Vault root directory relative to project root */
6
+ rootDir?: string;
7
7
  /** URL base path */
8
8
  basePath?: string;
9
9
  /** Site title */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/node/plugin/vite/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,MAAM,EACZ,MAAM,MAAM,CAAC;AAId,OAAO,EACiC,KAAK,UAAU,EACtD,MAAM,eAAe,CAAC;AAuBvB,OAAO,KAAK,EACV,WAAW,EACZ,MAAM,UAAU,CAAC;AAoBlB,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,WAAW,EAAE,WAAW,CAAC;IACzB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAGD,MAAM,WAAW,qBAAqB;IAEpC,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAED,wBAAgB,sBAAsB,CAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAoE9E;AAED,wBAAgB,QAAQ,CAAE,OAAO,GAAE,qBAA0B,GAAG,MAAM,EAAE,CAiUvE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/node/plugin/vite/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,MAAM,EACZ,MAAM,MAAM,CAAC;AAId,OAAO,EACiC,KAAK,UAAU,EACtD,MAAM,eAAe,CAAC;AAuBvB,OAAO,KAAK,EACV,WAAW,EACZ,MAAM,UAAU,CAAC;AAoBlB,MAAM,WAAW,qBAAqB;IACpC,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,WAAW,EAAE,WAAW,CAAC;IACzB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAGD,MAAM,WAAW,qBAAqB;IAEpC,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAED,wBAAgB,sBAAsB,CAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAoE9E;AAED,wBAAgB,QAAQ,CAAE,OAAO,GAAE,qBAA0B,GAAG,MAAM,EAAE,CAkUvE"}
@@ -10306,10 +10306,6 @@ var TypedownContext = class {
10306
10306
  async getConfig() {
10307
10307
  return this.cachedConfig ||= await this.rpc.getConfig(), this.cachedConfig;
10308
10308
  }
10309
- async getAssetDir(A) {
10310
- let j = await this.getConfig();
10311
- return path.join(path.dirname(A), j.assetsDir.path);
10312
- }
10313
10309
  async getSchema(A) {
10314
10310
  let j = this.cachedSchemaMap.get(A);
10315
10311
  if (j) return j;
@@ -10490,7 +10486,7 @@ var COMMON_MIME_TYPES = {
10490
10486
  ttf: "font/ttf"
10491
10487
  };
10492
10488
  function generateClientAppEntry(A) {
10493
- let { contentDir: j } = A, M = `/${j}/**/*.{td,md}`, N = JSON.stringify({
10489
+ let { rootDir: j = "." } = A, M = j === "." ? "/**/*.{td,md}" : `/${j}/**/*.{td,md}`, N = JSON.stringify({
10494
10490
  title: A.siteTitle,
10495
10491
  description: A.siteDescription,
10496
10492
  basePath: A.basePath ?? "/",
@@ -10594,6 +10590,7 @@ function typedown(A = {}) {
10594
10590
  ]), R = await Promise.all(L.map(async (A) => [A, (await j.getSchema(A)).properties])), z = Object.fromEntries(R), B = buildContentTree(Object.values(I).flat());
10595
10591
  return generateClientAppEntry({
10596
10592
  ...M,
10593
+ rootDir: M.rootDir,
10597
10594
  contentTree: B,
10598
10595
  schemas: z
10599
10596
  });
@@ -10606,7 +10603,7 @@ function typedown(A = {}) {
10606
10603
  A && M && (N.addPage(A), invalidateSearchIndex(M));
10607
10604
  }).catch(() => {}), j.getConfig().then((j) => {
10608
10605
  if (!M) return;
10609
- let N = normalizePath(resolve(M.config.root, j.contentDir, A)), P = M.moduleGraph.getModulesByFile(N);
10606
+ let N = normalizePath(resolve(M.config.root, j.rootDir, A)), P = M.moduleGraph.getModulesByFile(N);
10610
10607
  if (!P?.size) return;
10611
10608
  let F = [...P].map((A) => (M?.moduleGraph.invalidateModule(A), makeHmrUpdate(A)));
10612
10609
  M.hot.send({
@@ -10621,9 +10618,9 @@ function typedown(A = {}) {
10621
10618
  }), hmrInvalidateAll(M));
10622
10619
  }
10623
10620
  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";
10621
+ let L = "vault";
10625
10622
  return j.getConfig().then((A) => {
10626
- L = A.contentDir;
10623
+ L = A.rootDir;
10627
10624
  }).catch(() => {}), A.middlewares.use((A, j, N) => {
10628
10625
  if (!A.url || A.method !== "GET" || j.writableEnded || !M) return N();
10629
10626
  let P = A.url.split("?")[0].split("#")[0];
@@ -10672,7 +10669,7 @@ function typedown(A = {}) {
10672
10669
  async transform(A, j) {
10673
10670
  let M = j.split("?")[0];
10674
10671
  if (!isContentFile(M)) return;
10675
- let N = await F(), P = (await N.getConfig()).contentDir, I = M.includes(P) ? M.slice(M.indexOf(P) + P.length + 1) : M, { vueSrc: L } = await renderToVueSfc(N, await N.getFile(I), I);
10672
+ let N = await F(), P = (await N.getConfig()).rootDir, I = M.includes(P) ? M.slice(M.indexOf(P) + P.length + 1) : M, { vueSrc: L } = await renderToVueSfc(N, await N.getFile(I), I);
10676
10673
  return {
10677
10674
  code: L,
10678
10675
  map: null
package/dist/vite.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "./vite-ofOi3oqG.js";
1
+ import { n as e, t } from "./vite-sjqEapXH.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.5",
4
+ "version": "0.12.0",
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-client": "0.11.5",
89
- "@typerighter/rpc-server": "0.11.5"
88
+ "@typerighter/rpc-client": "0.12.0",
89
+ "@typerighter/rpc-server": "0.12.0"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@hdnax/nuclint": "^0.17.4",