@travetto/doc 7.0.2 → 7.0.4

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.
package/README.md CHANGED
@@ -23,7 +23,7 @@ import { c } from '@travetto/doc';
23
23
  export const text = <>
24
24
  <c.StdHeader />
25
25
 
26
- Sample documentation for fictional module. This module fictitiously relies upon <c.Mod name='Cache' /> functionality.
26
+ Sample documentation for fictional module. This module fictitiously relies upon <c.Module name='Cache' /> functionality.
27
27
 
28
28
  <ol>
29
29
  <li>First</li>
@@ -70,7 +70,7 @@ As you can see, you need to export a field named `text` as the body of the help
70
70
  * `Install` - Installing a package or a program
71
71
  * `Library` - Library reference
72
72
  * `Method` - Method declaration
73
- * `Mod` - Node Module Reference
73
+ * `Module` - Node Module Reference
74
74
  * `Note` - A note
75
75
  * `Path` - Path reference
76
76
  * `Ref` - File reference
@@ -84,7 +84,7 @@ As you can see, you need to export a field named `text` as the body of the help
84
84
  Some of the more common libraries are provided as the `d.library` method. The purpose of this is to have consistent references to common utilities to help keep external linking simple.
85
85
 
86
86
  ## Modules
87
- You can also link to other [Travetto](https://travetto.dev) based modules as needed. The `d.mod` object relies on what is already imported into your project, and reference the package.json of the related module. If the module is not installed, doc generation will fail.
87
+ You can also link to other [Travetto](https://travetto.dev) based modules as needed. The `d.module` object relies on what is already imported into your project, and reference the package.json of the related module. If the module is not installed, doc generation will fail.
88
88
 
89
89
  ## CLI - doc
90
90
  The run command allows for generating documentation output.
package/__index__.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { type JSXElement as DocJSXElement, isJSXElement as isDocJSXElement } from './support/jsx-runtime.ts';
2
2
  export { c, d, JSXElementByFn as DocJSXElementByFn } from './src/jsx.ts';
3
- export { MOD_MAPPING as mod } from './src/mapping/mod-mapping.ts';
3
+ export { MODULES as module } from './src/mapping/module.ts';
4
4
  export { DocFileUtil } from './src/util/file.ts';
5
5
  export { DocRunUtil, COMMON_DATE } from './src/util/run.ts';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/doc",
3
- "version": "7.0.2",
3
+ "version": "7.0.4",
4
4
  "description": "Documentation support for the Travetto framework",
5
5
  "keywords": [
6
6
  "docs",
@@ -24,12 +24,12 @@
24
24
  "directory": "module/doc"
25
25
  },
26
26
  "dependencies": {
27
- "@travetto/runtime": "^7.0.2",
27
+ "@travetto/runtime": "^7.0.4",
28
28
  "@types/prismjs": "^1.26.5",
29
29
  "prismjs": "^1.30.0"
30
30
  },
31
31
  "peerDependencies": {
32
- "@travetto/cli": "^7.0.2"
32
+ "@travetto/cli": "^7.0.6"
33
33
  },
34
34
  "peerDependenciesMeta": {
35
35
  "@travetto/cli": {
package/src/jsx.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  import { castTo, TypedObject } from '@travetto/runtime';
2
2
 
3
- import { LIB_MAPPING } from './mapping/lib-mapping.ts';
4
- import { MOD_MAPPING } from './mapping/mod-mapping.ts';
5
- import { CodeProps, RunConfig } from './util/types.ts';
3
+ import type { LIBRARIES } from './mapping/library.ts';
4
+ import type { MODULES } from './mapping/module.ts';
5
+ import type { CodeProps, RunConfig } from './util/types.ts';
6
6
 
7
- import { createElement, JSXElement, JSXComponentFunction as CompFn } from '../support/jsx-runtime.ts';
7
+ import { createElement, type JSXElement, type JSXComponentFunction as CompFn } from '../support/jsx-runtime.ts';
8
8
 
9
9
  type InstallProps = { title: string, pkg: string };
10
10
  type ExecProps = { title: string, cmd: string, args?: string[], config?: RunConfig & { formatCommand?(cmd: string, args: string[]): string } };
11
- type StdHeaderProps = { mod?: string, install?: boolean };
11
+ type StdHeaderProps = { module?: string, install?: boolean };
12
12
  type HeaderProps = { title: string, description?: string };
13
- type ModProps = { name: keyof typeof MOD_MAPPING };
14
- type LibraryProps = { name: keyof typeof LIB_MAPPING };
13
+ type ModuleProps = { name: keyof typeof MODULES };
14
+ type LibraryProps = { name: keyof typeof LIBRARIES };
15
15
  type LinkProps = { title: string, href: string, line?: number };
16
16
  type CodeLinkProps = { title: string, src: string | Function, startRe: RegExp };
17
17
  type Named = { name: string };
@@ -46,13 +46,13 @@ const StdHeader: CompFn<StdHeaderProps> = () => EMPTY; // Standard module header
46
46
  const Header: CompFn<HeaderProps> = () => EMPTY; // Basic module header
47
47
  const Execution: CompFn<ExecProps> = () => EMPTY; // Run a command, and include the output as part of the document
48
48
 
49
- const Mod: CompFn<ModProps> = () => EMPTY; // Node Module Reference
49
+ const Module: CompFn<ModuleProps> = () => EMPTY; // Node Module Reference
50
50
  const Library: CompFn<LibraryProps> = () => EMPTY; // Library reference
51
51
 
52
52
  export const c = {
53
53
  Input, Field, Method, Command, Path, Class,
54
54
  Anchor, Library, Ref, File, Image, CodeLink,
55
- Mod, Note, Header, StdHeader,
55
+ Module, Note, Header, StdHeader,
56
56
  Section, SubSection, SubSubSection,
57
57
  Code, Execution, Terminal, Install, Config
58
58
  } as const;
@@ -103,6 +103,6 @@ export const d = {
103
103
  path: (name: string) => createElement(c.Path, { name }),
104
104
  command: (name: string) => createElement(c.Command, { name }),
105
105
  field: (name: string) => createElement(c.Field, { name }),
106
- library: (name: keyof typeof LIB_MAPPING) => createElement(c.Library, { name }),
107
- mod: (name: keyof typeof MOD_MAPPING) => createElement(c.Mod, { name }),
106
+ library: (name: keyof typeof LIBRARIES) => createElement(c.Library, { name }),
107
+ module: (name: keyof typeof MODULES) => createElement(c.Module, { name }),
108
108
  };
@@ -1,4 +1,4 @@
1
- export const LIB_MAPPING = {
1
+ export const LIBRARIES = {
2
2
  Travetto: { title: 'Travetto', href: 'https://travetto.dev' },
3
3
  Typescript: { title: 'Typescript', href: 'https://typescriptlang.org' },
4
4
  Javascript: { title: 'Javascript', href: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript' },
@@ -1,4 +1,4 @@
1
- export const MOD_MAPPING = {
1
+ export const MODULES = {
2
2
  Auth: {
3
3
  name: '@travetto/auth', folder: '@travetto/auth', displayName: 'Authentication',
4
4
  description: 'Authentication scaffolding for the Travetto framework'
@@ -67,6 +67,10 @@ export const MOD_MAPPING = {
67
67
  name: '@travetto/email-nodemailer', folder: '@travetto/email-nodemailer', displayName: 'Email Nodemailer Support',
68
68
  description: 'Email transmission module.'
69
69
  },
70
+ Eslint: {
71
+ name: '@travetto/eslint', folder: '@travetto/eslint', displayName: 'ES Linting Rules',
72
+ description: 'ES Linting Rules'
73
+ },
70
74
  Image: {
71
75
  name: '@travetto/image', folder: '@travetto/image', displayName: 'Image',
72
76
  description: 'Image support, resizing, and optimization'
@@ -3,8 +3,8 @@ import path from 'node:path';
3
3
  import { PackageUtil } from '@travetto/manifest';
4
4
  import { castTo, RuntimeIndex } from '@travetto/runtime';
5
5
 
6
- import { JSXElementByFn, c } from '../jsx.ts';
7
- import { DocResolveUtil, ResolvedCode, ResolvedRef, ResolvedSnippetLink } from '../util/resolve.ts';
6
+ import { type JSXElementByFn, c } from '../jsx.ts';
7
+ import { DocResolveUtil, type ResolvedCode, type ResolvedRef, type ResolvedSnippetLink } from '../util/resolve.ts';
8
8
  import { DocRunUtil } from '../util/run.ts';
9
9
  import { createElement, JSXRuntimeTag } from '../../support/jsx-runtime.ts';
10
10
 
@@ -4,11 +4,11 @@ import { Runtime, RuntimeIndex } from '@travetto/runtime';
4
4
  import { PackageUtil } from '@travetto/manifest';
5
5
 
6
6
  import { highlight } from './code-highlight.ts';
7
- import { RenderProvider, RenderState } from '../types.ts';
7
+ import type { RenderProvider, RenderState } from '../types.ts';
8
8
  import { c, getComponentName } from '../jsx.ts';
9
- import { MOD_MAPPING } from '../mapping/mod-mapping.ts';
10
- import { LIB_MAPPING } from '../mapping/lib-mapping.ts';
11
- import { RenderContext } from './context.ts';
9
+ import { MODULES } from '../mapping/module.ts';
10
+ import { LIBRARIES } from '../mapping/library.ts';
11
+ import type { RenderContext } from './context.ts';
12
12
  import { DocResolveUtil } from '../util/resolve.ts';
13
13
  import type { JSXElement } from '../../support/jsx-runtime.ts';
14
14
 
@@ -133,12 +133,12 @@ yarn add ${node.props.pkg}
133
133
  return `<img src="${context.link(props.href, props)}" alt="${props.title}">`;
134
134
  },
135
135
 
136
- Mod: async ({ context, props }) => {
137
- const config = MOD_MAPPING[props.name];
136
+ Module: async ({ context, props }) => {
137
+ const config = MODULES[props.name];
138
138
  return `<a class="module-link" href="${context.link(config.folder, config)}" title="${config.description}">${config.displayName}</a>`;
139
139
  },
140
140
  Library: async ({ context, props }) => {
141
- const config = LIB_MAPPING[props.name];
141
+ const config = LIBRARIES[props.name];
142
142
  return `<a target="_blank" class="external-link" href="${context.link(config.href, config)}">${config.title}</a>`;
143
143
  },
144
144
 
@@ -146,8 +146,8 @@ yarn add ${node.props.pkg}
146
146
  Header: async ({ props }) => `<h1>${props.title} ${props.description ? `\n<small>${props.description}</small>\n` : ''}</h1>\n`,
147
147
 
148
148
  StdHeader: async state => {
149
- const mod = state.node.props.mod ?? Runtime.main.name;
150
- const pkg = PackageUtil.readPackage(RuntimeIndex.getModule(mod)!.sourcePath);
149
+ const module = state.node.props.module ?? Runtime.main.name;
150
+ const pkg = PackageUtil.readPackage(RuntimeIndex.getModule(module)!.sourcePath);
151
151
  const title = pkg.travetto?.displayName ?? pkg.name;
152
152
  const desc = pkg.description;
153
153
  let install = '';
@@ -3,11 +3,11 @@ import fs from 'node:fs/promises';
3
3
  import { Runtime, RuntimeIndex } from '@travetto/runtime';
4
4
  import { PackageUtil } from '@travetto/manifest';
5
5
 
6
- import { RenderProvider } from '../types.ts';
6
+ import type { RenderProvider } from '../types.ts';
7
7
  import { c, getComponentName } from '../jsx.ts';
8
- import { MOD_MAPPING } from '../mapping/mod-mapping.ts';
9
- import { LIB_MAPPING } from '../mapping/lib-mapping.ts';
10
- import { RenderContext } from './context.ts';
8
+ import { MODULES } from '../mapping/module.ts';
9
+ import { LIBRARIES } from '../mapping/library.ts';
10
+ import type { RenderContext } from './context.ts';
11
11
  import { DocResolveUtil } from '../util/resolve.ts';
12
12
 
13
13
  export const Markdown: RenderProvider<RenderContext> = {
@@ -113,8 +113,8 @@ ${context.cleanText(content.text)}
113
113
  Header: async ({ props }) => `# ${props.title}\n${props.description ? `## ${props.description}\n` : ''}\n`,
114
114
 
115
115
  StdHeader: async state => {
116
- const mod = state.node.props.mod ?? Runtime.main.name;
117
- const pkg = PackageUtil.readPackage(RuntimeIndex.getModule(mod)!.sourcePath);
116
+ const module = state.node.props.module ?? Runtime.main.name;
117
+ const pkg = PackageUtil.readPackage(RuntimeIndex.getModule(module)!.sourcePath);
118
118
  const title = pkg.travetto?.displayName ?? pkg.name;
119
119
  const desc = pkg.description;
120
120
  let install = '';
@@ -124,12 +124,12 @@ ${context.cleanText(content.text)}
124
124
  }
125
125
  return `# ${title}\n${desc ? `## ${desc}\n` : ''}${install}\n`;
126
126
  },
127
- Mod: async ({ props, context }) => {
128
- const config = MOD_MAPPING[props.name];
127
+ Module: async ({ props, context }) => {
128
+ const config = MODULES[props.name];
129
129
  return `[${config.displayName}](${context.link(config.folder, config)}#readme "${config.description}")`;
130
130
  },
131
131
  Library: async ({ props }) => {
132
- const config = LIB_MAPPING[props.name];
132
+ const config = LIBRARIES[props.name];
133
133
  return `[${config.title}](${config.href})`;
134
134
  }
135
135
  };
@@ -1,17 +1,17 @@
1
1
  import path from 'node:path';
2
2
 
3
3
  import { type ManifestContext, PackageUtil } from '@travetto/manifest';
4
- import { castTo, Class, Runtime } from '@travetto/runtime';
4
+ import { castTo, type Class, Runtime } from '@travetto/runtime';
5
5
 
6
- import { EMPTY_ELEMENT, getComponentName, JSXElementByFn, c } from '../jsx.ts';
7
- import { DocumentShape, RenderProvider, RenderState } from '../types.ts';
6
+ import { EMPTY_ELEMENT, getComponentName, type JSXElementByFn, type c } from '../jsx.ts';
7
+ import type { DocumentShape, RenderProvider, RenderState } from '../types.ts';
8
8
  import { DocFileUtil } from '../util/file.ts';
9
9
 
10
10
  import { RenderContext } from './context.ts';
11
11
  import { Html } from './html.ts';
12
12
  import { Markdown } from './markdown.ts';
13
13
 
14
- import { isJSXElement, JSXElement, JSXFragmentType } from '../../support/jsx-runtime.ts';
14
+ import { isJSXElement, type JSXElement, JSXFragmentType } from '../../support/jsx-runtime.ts';
15
15
 
16
16
  const providers = { [Html.ext]: Html, [Markdown.ext]: Markdown };
17
17
 
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { JSXElementByFn, c } from './jsx.ts';
1
+ import type { JSXElementByFn, c } from './jsx.ts';
2
2
  import type { JSXElement, ValidHtmlTags } from '../support/jsx-runtime.ts';
3
3
 
4
4
  export type Wrapper = Record<string, (cnt: string) => string>;
package/src/util/file.ts CHANGED
@@ -2,7 +2,7 @@ import { readFileSync, existsSync } from 'node:fs';
2
2
  import path from 'node:path';
3
3
 
4
4
  import { AppError, Runtime, RuntimeIndex } from '@travetto/runtime';
5
- import { ManifestModuleFileType, ManifestModuleUtil } from '@travetto/manifest';
5
+ import { type ManifestModuleFileType, ManifestModuleUtil } from '@travetto/manifest';
6
6
 
7
7
  const ESLINT_PATTERN = /\s{0,10}\/\/ eslint.{0,300}$/g;
8
8
  const ENV_KEY = /Env.([^.]{1,100})[.]key/g;
@@ -1,5 +1,5 @@
1
1
  import { DocFileUtil } from './file.ts';
2
- import { CodeProps } from './types.ts';
2
+ import type { CodeProps } from './types.ts';
3
3
 
4
4
  export type ResolvedRef = { title: string, file: string, line: number };
5
5
  export type ResolvedCode = { text: string, language: string, file?: string };
package/src/util/run.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import os from 'node:os';
2
2
  import util from 'node:util';
3
- import { spawn, ChildProcess } from 'node:child_process';
3
+ import { spawn, type ChildProcess } from 'node:child_process';
4
4
  import path from 'node:path';
5
5
 
6
6
  import { Env, ExecUtil, Runtime, RuntimeIndex } from '@travetto/runtime';
7
- import { RunConfig } from './types.ts';
7
+ import type { RunConfig } from './types.ts';
8
8
 
9
9
  export const COMMON_DATE = new Date('2029-03-14T00:00:00.000').getTime();
10
10
 
@@ -4,7 +4,7 @@ import { spawn } from 'node:child_process';
4
4
 
5
5
  import { PackageUtil } from '@travetto/manifest';
6
6
  import { ExecUtil, Env, Runtime, WatchUtil } from '@travetto/runtime';
7
- import { CliCommandShape, CliCommand, CliValidationError } from '@travetto/cli';
7
+ import { type CliCommandShape, CliCommand, type CliValidationError } from '@travetto/cli';
8
8
  import { MinLength } from '@travetto/schema';
9
9
 
10
10
  /**
@@ -1,4 +1,4 @@
1
- import { castTo, Class } from '@travetto/runtime';
1
+ import { castTo, type Class } from '@travetto/runtime';
2
2
 
3
3
  type JSXChild = JSXElement | number | bigint | boolean | object | string;
4
4
  type JSXProps = { children?: JSXChild | JSXChild[] | null };