mdts 0.17.0 → 0.19.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.
Files changed (59) hide show
  1. package/README.md +4 -0
  2. package/dist/cli.js +32 -13
  3. package/dist/frontend/bundle.js +2366 -2245
  4. package/dist/frontend/markdown.css +40 -0
  5. package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_architecture-PBZL5I3N_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_architecture-YZFGNWBL_mjs.bundle.js} +4 -4
  6. package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_gitGraph-HDMCJU4V_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_gitGraph-7Q5UKJZL_mjs.bundle.js} +4 -4
  7. package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_info-3K5VOQVL_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_info-OMHHGYJF_mjs.bundle.js} +4 -4
  8. package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_packet-RMMSAZCW_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_packet-4T2RLAQJ_mjs.bundle.js} +4 -4
  9. package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_pie-UPGHQEXC_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_pie-ZZUOXDRM_mjs.bundle.js} +4 -4
  10. package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_radar-KQ55EAFF_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_radar-PYXPWWZC_mjs.bundle.js} +4 -4
  11. package/dist/frontend/node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_treeView-SZITEDCU_mjs.bundle.js +22 -0
  12. package/dist/frontend/{node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_treemap-KZPCXAKY_mjs.bundle.js → node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_treemap-W4RFUUIX_mjs.bundle.js} +4 -4
  13. package/dist/frontend/node_modules_mermaid-js_parser_dist_chunks_mermaid-parser_core_wardley-RL74JXVD_mjs.bundle.js +22 -0
  14. package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_classDiagram-6PBFFD2Q_mjs.bundle.js +22 -0
  15. package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_classDiagram-v2-HSJHXN6E_mjs.bundle.js +22 -0
  16. package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_diagram-5BDNPKRD_mjs.bundle.js +42 -0
  17. package/dist/frontend/{node_modules_mermaid_dist_chunks_mermaid_core_diagram-P4PSJMXO_mjs.bundle.js → node_modules_mermaid_dist_chunks_mermaid_core_diagram-TYMM5635_mjs.bundle.js} +4 -4
  18. package/dist/frontend/{node_modules_mermaid_dist_chunks_mermaid_core_infoDiagram-LFFYTUFH_mjs.bundle.js → node_modules_mermaid_dist_chunks_mermaid_core_infoDiagram-42DDH7IO_mjs.bundle.js} +4 -4
  19. package/dist/frontend/{node_modules_mermaid_dist_chunks_mermaid_core_pieDiagram-SKSYHLDU_mjs.bundle.js → node_modules_mermaid_dist_chunks_mermaid_core_pieDiagram-DEJITSTG_mjs.bundle.js} +4 -4
  20. package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_stateDiagram-v2-QKLJ7IA2_mjs.bundle.js +22 -0
  21. package/dist/frontend/vendors-node_modules_mermaid-js_parser_dist_mermaid-parser_core_mjs.bundle.js +45 -25
  22. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_architectureDiagram-2XIMDMQ5_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_architectureDiagram-Q4EWVU46_mjs.bundle.js} +4 -4
  23. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_blockDiagram-DXYQGD6D_mjs.bundle.js +52 -0
  24. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_c4Diagram-IC4MRINW_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_c4Diagram-AHTNJAMY_mjs.bundle.js} +7 -7
  25. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_chunk-4TB4RGXK_mjs.bundle.js +62 -0
  26. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_chunk-NQ4KR5QH_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_chunk-OYMX7WX6_mjs.bundle.js} +7 -7
  27. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_dagre-KLK3FWXG_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_dagre-KV5264BT_mjs.bundle.js} +4 -4
  28. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_diagram-E7M64L7V_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_diagram-G4DWMVQ6_mjs.bundle.js} +7 -7
  29. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_diagram-IFDJBPK2_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_diagram-MMDJMWI5_mjs.bundle.js} +4 -4
  30. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_erDiagram-INFDFZHY_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_erDiagram-SMLLAGMA_mjs.bundle.js} +7 -7
  31. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_flowDiagram-DWJPFMVM_mjs.bundle.js +72 -0
  32. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_ganttDiagram-T4ZO3ILL_mjs.bundle.js +62 -0
  33. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_gitGraphDiagram-UUTBAWPF_mjs.bundle.js +42 -0
  34. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_ishikawaDiagram-PHBUUO56_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_ishikawaDiagram-UXIWVN3A_mjs.bundle.js} +4 -4
  35. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_journeyDiagram-4ABVD52K_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_journeyDiagram-VCZTEJTY_mjs.bundle.js} +7 -7
  36. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_kanban-definition-K7BYSVSG_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_kanban-definition-6JOO6SKY_mjs.bundle.js} +4 -4
  37. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_mindmap-definition-YRQLILUH_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_mindmap-definition-QFDTVHPH_mjs.bundle.js} +7 -7
  38. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_quadrantDiagram-337W2JSQ_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_quadrantDiagram-34T5L4WZ_mjs.bundle.js} +4 -4
  39. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_requirementDiagram-Z7DCOOCP_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_requirementDiagram-MS252O5E_mjs.bundle.js} +7 -7
  40. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_sankeyDiagram-WA2Y5GQK_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_sankeyDiagram-XADWPNL6_mjs.bundle.js} +7 -7
  41. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_sequenceDiagram-FGHM5R23_mjs.bundle.js +42 -0
  42. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_stateDiagram-FHFEXIEX_mjs.bundle.js +22 -0
  43. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_timeline-definition-GMOUNBTQ_mjs.bundle.js +22 -0
  44. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_vennDiagram-LZ73GAT5_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_vennDiagram-DHZGUBPP_mjs.bundle.js} +4 -4
  45. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_wardleyDiagram-NUSXRM2D_mjs.bundle.js +32 -0
  46. package/dist/frontend/{vendors-node_modules_mermaid_dist_chunks_mermaid_core_xychartDiagram-JWTSCODW_mjs.bundle.js → vendors-node_modules_mermaid_dist_chunks_mermaid_core_xychartDiagram-5P7HB3ND_mjs.bundle.js} +4 -4
  47. package/dist/server/server.js +29 -10
  48. package/package.json +3 -3
  49. package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_classDiagram-VBA2DB6C_mjs.bundle.js +0 -22
  50. package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_classDiagram-v2-RAHNMMFH_mjs.bundle.js +0 -22
  51. package/dist/frontend/node_modules_mermaid_dist_chunks_mermaid_core_stateDiagram-v2-FVOUBMTO_mjs.bundle.js +0 -22
  52. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_blockDiagram-WCTKOSBZ_mjs.bundle.js +0 -52
  53. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_chunk-WL4C6EOR_mjs.bundle.js +0 -62
  54. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_flowDiagram-PKNHOUZH_mjs.bundle.js +0 -72
  55. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_ganttDiagram-A5KZAMGK_mjs.bundle.js +0 -62
  56. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_gitGraphDiagram-K3NZZRJ6_mjs.bundle.js +0 -42
  57. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_sequenceDiagram-2WXFIKYE_mjs.bundle.js +0 -42
  58. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_stateDiagram-RAJIS63D_mjs.bundle.js +0 -22
  59. package/dist/frontend/vendors-node_modules_mermaid_dist_chunks_mermaid_core_timeline-definition-YZTLITO2_mjs.bundle.js +0 -22
package/README.md CHANGED
@@ -103,3 +103,7 @@ Experience mdts in action with real examples and interactive features.
103
103
 
104
104
  Found a bug? Have an idea? Want to send a PR?
105
105
  See [CONTRIBUTING.md](./CONTRIBUTING.md) for details — we'd love to have your help!
106
+
107
+ ## Author
108
+
109
+ [@unhappychoice](https://unhappychoice.com)
package/dist/cli.js CHANGED
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -15,7 +24,7 @@ const DEFAULT_DIRECTORY = '.';
15
24
  class CLI {
16
25
  run() {
17
26
  return this.requireOpen()
18
- .then((open) => {
27
+ .then((open) => __awaiter(this, void 0, void 0, function* () {
19
28
  const program = new commander_1.Command();
20
29
  const packageJsonPath = path_1.default.join(__dirname, '..', 'package.json');
21
30
  const packageJson = JSON.parse((0, fs_1.readFileSync)(packageJsonPath, 'utf8'));
@@ -23,37 +32,47 @@ class CLI {
23
32
  .version(packageJson.version)
24
33
  .description('A zero-config CLI tool to preview local Markdown files in a browser')
25
34
  .option('-H, --host <host>', 'host to listen on', 'localhost')
26
- .option('-p, --port <port>', 'port to serve on', String(DEFAULT_PORT))
35
+ .option('-p, --port <port>', 'port to serve on (use "auto" to find an available port)', String(DEFAULT_PORT))
27
36
  .option('-s, --silent', 'suppress server logs', false)
28
37
  .option('--no-open', 'do not open the browser automatically')
29
38
  .option('-g, --glob <patterns...>', 'glob patterns to filter markdown files (e.g. "docs/*.md")')
30
39
  .argument('[directory]', 'directory to serve', DEFAULT_DIRECTORY)
31
- .action((directory, options) => {
40
+ .action((directory, options) => __awaiter(this, void 0, void 0, function* () {
32
41
  logger_1.logger.setSilent(options.silent);
33
42
  logger_1.logger.showLogo();
34
43
  logger_1.logger.log('Announcement', '🎉 Thanks for using mdts!');
35
44
  logger_1.logger.log('Announcement', '✨ Like it? Star it on GitHub: https://github.com/unhappychoice/mdts');
36
45
  logger_1.logger.log('CLI', '⚙ Options: ' + JSON.stringify(options));
37
- const port = parseInt(options.port, 10);
46
+ const autoPort = options.port === 'auto';
47
+ const port = autoPort ? DEFAULT_PORT : parseInt(options.port, 10);
38
48
  const host = options.host;
39
49
  const absoluteDirectory = path_1.default.resolve(process.cwd(), directory);
40
50
  const context = options.glob
41
51
  ? (0, glob_1.resolveGlobPatterns)(absoluteDirectory, options.glob)
42
52
  : { directory: absoluteDirectory };
43
- (0, server_1.serve)(context, port, host);
44
- const readmePath = path_1.default.join(context.directory, 'README.md');
45
- const initialPath = (0, fs_1.existsSync)(readmePath) ? '/README.md' : '';
53
+ let actualPort;
54
+ try {
55
+ ({ port: actualPort } = yield (0, server_1.serve)(context, port, host, autoPort));
56
+ }
57
+ catch (err) {
58
+ logger_1.logger.error(`❌ Failed to start server: ${err instanceof Error ? err.message : err}`);
59
+ process.exitCode = 1;
60
+ return;
61
+ }
62
+ const defaultPages = ['README.md', 'index.md'];
63
+ const defaultPage = defaultPages.find((name) => (0, fs_1.existsSync)(path_1.default.join(context.directory, name)));
64
+ const initialPath = defaultPage ? `/${defaultPage}` : '';
46
65
  const displayHost = (host === '0.0.0.0' || host === '::') ? 'localhost' : host;
47
66
  if (options.open) {
48
- logger_1.logger.log('CLI', `🌐 Opening browser at http://${displayHost}:${port}${initialPath}`);
49
- open(`http://${displayHost}:${port}${initialPath}`);
67
+ logger_1.logger.log('CLI', `🌐 Opening browser at http://${displayHost}:${actualPort}${initialPath}`);
68
+ open(`http://${displayHost}:${actualPort}${initialPath}`);
50
69
  }
51
70
  else {
52
- logger_1.logger.log('CLI', `🌐 Server running at http://${displayHost}:${port}${initialPath}`);
71
+ logger_1.logger.log('CLI', `🌐 Server running at http://${displayHost}:${actualPort}${initialPath}`);
53
72
  }
54
- });
55
- program.parse(process.argv);
56
- });
73
+ }));
74
+ yield program.parseAsync(process.argv);
75
+ }));
57
76
  }
58
77
  requireOpen() {
59
78
  return import('open').then((module) => module.default);