@travetto/doc 6.0.0 → 7.0.0-rc.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.
- package/package.json +3 -3
- package/src/mapping/lib-mapping.ts +1 -0
- package/src/mapping/mod-mapping.ts +3 -11
- package/src/util/file.ts +19 -17
- package/src/util/run.ts +0 -1
- package/support/cli.doc.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/doc",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-rc.0",
|
|
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": "^
|
|
27
|
+
"@travetto/runtime": "^7.0.0-rc.0",
|
|
28
28
|
"@types/prismjs": "^1.26.5",
|
|
29
29
|
"prismjs": "^1.30.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@travetto/cli": "^
|
|
32
|
+
"@travetto/cli": "^7.0.0-rc.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependenciesMeta": {
|
|
35
35
|
"@travetto/cli": {
|
|
@@ -45,6 +45,7 @@ export const LIB_MAPPING = {
|
|
|
45
45
|
NodeHttp: { title: 'http', href: 'https://nodejs.org/api/http.html' },
|
|
46
46
|
NodePath: { title: 'path', href: 'https://nodejs.org/api/path.html' },
|
|
47
47
|
NodeHttps: { title: 'https', href: 'https://nodejs.org/api/https.html' },
|
|
48
|
+
NodeHttp2: { title: 'http2', href: 'https://nodejs.org/api/http2.html' },
|
|
48
49
|
NodeConsole: { title: 'console', href: 'https://nodejs.org/api/console.html' },
|
|
49
50
|
NodeAssert: { title: 'assert', href: 'https://nodejs.org/api/assert.html' },
|
|
50
51
|
NodeEventEmitter: { title: 'EventEmitter', href: 'https://nodejs.org/api/events.html#class-eventemitter' },
|
|
@@ -67,10 +67,6 @@ 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
|
-
},
|
|
74
70
|
Image: {
|
|
75
71
|
name: '@travetto/image', folder: '@travetto/image', displayName: 'Image',
|
|
76
72
|
description: 'Image support, resizing, and optimization'
|
|
@@ -193,7 +189,7 @@ export const MOD_MAPPING = {
|
|
|
193
189
|
},
|
|
194
190
|
Web: {
|
|
195
191
|
name: '@travetto/web', folder: '@travetto/web', displayName: 'Web API',
|
|
196
|
-
description: 'Declarative
|
|
192
|
+
description: 'Declarative support for creating Web Applications'
|
|
197
193
|
},
|
|
198
194
|
WebAwsLambda: {
|
|
199
195
|
name: '@travetto/web-aws-lambda', folder: '@travetto/web-aws-lambda', displayName: 'Web AWS Lambda',
|
|
@@ -203,14 +199,10 @@ export const MOD_MAPPING = {
|
|
|
203
199
|
name: '@travetto/web-connect', folder: '@travetto/web-connect', displayName: 'Web Connect Support',
|
|
204
200
|
description: 'Web integration for Connect-Like Resources'
|
|
205
201
|
},
|
|
206
|
-
|
|
207
|
-
name: '@travetto/web-http
|
|
202
|
+
WebHttp: {
|
|
203
|
+
name: '@travetto/web-http', folder: '@travetto/web-http', displayName: 'Web HTTP Server Support',
|
|
208
204
|
description: 'Web HTTP Server Support'
|
|
209
205
|
},
|
|
210
|
-
WebNode: {
|
|
211
|
-
name: '@travetto/web-node', folder: '@travetto/web-node', displayName: 'Node Web Server',
|
|
212
|
-
description: 'Node provider for the travetto web module.'
|
|
213
|
-
},
|
|
214
206
|
WebRpc: {
|
|
215
207
|
name: '@travetto/web-rpc', folder: '@travetto/web-rpc', displayName: 'Web RPC Support',
|
|
216
208
|
description: 'RPC support for a Web Application'
|
package/src/util/file.ts
CHANGED
|
@@ -7,27 +7,29 @@ import { ManifestModuleFileType, ManifestModuleUtil } from '@travetto/manifest';
|
|
|
7
7
|
const ESLINT_PATTERN = /\s{0,10}\/\/ eslint.{0,300}$/g;
|
|
8
8
|
const ENV_KEY = /Env.([^.]{1,100})[.]key/g;
|
|
9
9
|
|
|
10
|
+
const MOD_FILE_TO_LANG: Record<ManifestModuleFileType, string | undefined> = {
|
|
11
|
+
ts: 'typescript',
|
|
12
|
+
js: 'javascript',
|
|
13
|
+
md: 'markdown',
|
|
14
|
+
json: 'json',
|
|
15
|
+
typings: 'typescript',
|
|
16
|
+
'package-json': 'json',
|
|
17
|
+
fixture: undefined,
|
|
18
|
+
unknown: undefined
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const EXT_TO_LANG: Record<string, string> = {
|
|
22
|
+
'.yaml': 'yaml',
|
|
23
|
+
'.yml': 'yaml',
|
|
24
|
+
'.sh': 'bash',
|
|
25
|
+
};
|
|
26
|
+
|
|
10
27
|
/**
|
|
11
28
|
* Standard file utilities
|
|
12
29
|
*/
|
|
13
30
|
export class DocFileUtil {
|
|
14
31
|
|
|
15
32
|
static #decCache: Record<string, boolean> = {};
|
|
16
|
-
static #modFileTypeToLang: Record<ManifestModuleFileType, string | undefined> = {
|
|
17
|
-
ts: 'typescript',
|
|
18
|
-
js: 'javascript',
|
|
19
|
-
md: 'markdown',
|
|
20
|
-
json: 'json',
|
|
21
|
-
typings: 'typescript',
|
|
22
|
-
'package-json': 'json',
|
|
23
|
-
fixture: undefined,
|
|
24
|
-
unknown: undefined
|
|
25
|
-
};
|
|
26
|
-
static #extToLang: Record<string, string> = {
|
|
27
|
-
'.yaml': 'yaml',
|
|
28
|
-
'.yml': 'yaml',
|
|
29
|
-
'.sh': 'bash',
|
|
30
|
-
};
|
|
31
33
|
|
|
32
34
|
static isFile(src: string): boolean {
|
|
33
35
|
return /^[@:A-Za-z0-9\/\\\-_.]+[.]([a-z]{2,10})$/.test(src);
|
|
@@ -74,7 +76,7 @@ export class DocFileUtil {
|
|
|
74
76
|
if (file !== undefined) {
|
|
75
77
|
const ext = path.extname(file);
|
|
76
78
|
const type = ManifestModuleUtil.getFileType(file);
|
|
77
|
-
const language =
|
|
79
|
+
const language = MOD_FILE_TO_LANG[type] ?? EXT_TO_LANG[ext] ?? ext.replace('.', '');
|
|
78
80
|
return { content, file, language };
|
|
79
81
|
} else {
|
|
80
82
|
return { content, file: '', language: '' };
|
|
@@ -108,7 +110,7 @@ export class DocFileUtil {
|
|
|
108
110
|
let found = false;
|
|
109
111
|
if (start > 0) {
|
|
110
112
|
for (let i = start - 1; i > start - 3; i--) {
|
|
111
|
-
if (lines[i].includes('@
|
|
113
|
+
if (lines[i].includes('@kind decorator')) {
|
|
112
114
|
found = true;
|
|
113
115
|
break;
|
|
114
116
|
}
|
package/src/util/run.ts
CHANGED
|
@@ -74,7 +74,6 @@ export class DocRunUtil {
|
|
|
74
74
|
static spawn(cmd: string, args: string[], config: RunConfig = {}): ChildProcess {
|
|
75
75
|
return spawn(cmd, args, {
|
|
76
76
|
cwd: config.cwd ?? this.cwd(config),
|
|
77
|
-
shell: '/bin/bash',
|
|
78
77
|
env: {
|
|
79
78
|
...process.env,
|
|
80
79
|
...Env.DEBUG.export(false),
|
package/support/cli.doc.ts
CHANGED
|
@@ -57,7 +57,6 @@ export class DocCommand implements CliCommandShape {
|
|
|
57
57
|
if (action === 'update' && file === this.input) {
|
|
58
58
|
const proc = spawn('npx', ['trv', ...args], {
|
|
59
59
|
cwd: Runtime.mainSourcePath,
|
|
60
|
-
shell: false,
|
|
61
60
|
env: { ...process.env, ...Env.TRV_QUIET.export(true) },
|
|
62
61
|
stdio: 'inherit'
|
|
63
62
|
});
|