@travetto/doc 6.0.0 → 6.0.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.
- package/package.json +3 -3
- package/src/mapping/lib-mapping.ts +1 -0
- package/src/mapping/mod-mapping.ts +1 -1
- package/src/util/file.ts +18 -16
- 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": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
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": "^6.0.
|
|
27
|
+
"@travetto/runtime": "^6.0.1",
|
|
28
28
|
"@types/prismjs": "^1.26.5",
|
|
29
29
|
"prismjs": "^1.30.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@travetto/cli": "^6.0.
|
|
32
|
+
"@travetto/cli": "^6.0.1"
|
|
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' },
|
|
@@ -193,7 +193,7 @@ export const MOD_MAPPING = {
|
|
|
193
193
|
},
|
|
194
194
|
Web: {
|
|
195
195
|
name: '@travetto/web', folder: '@travetto/web', displayName: 'Web API',
|
|
196
|
-
description: 'Declarative
|
|
196
|
+
description: 'Declarative support for creating Web Applications'
|
|
197
197
|
},
|
|
198
198
|
WebAwsLambda: {
|
|
199
199
|
name: '@travetto/web-aws-lambda', folder: '@travetto/web-aws-lambda', displayName: 'Web AWS Lambda',
|
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: '' };
|
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
|
});
|