@travetto/doc 2.0.1 → 2.1.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/bin/cli-doc.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as path from 'path';
2
- import * as fs from 'fs';
2
+ import * as fs from 'fs/promises';
3
3
 
4
4
  import { BasePlugin } from '@travetto/cli/src/plugin-base';
5
5
  import { EnvInit } from '@travetto/base/bin/init';
@@ -52,7 +52,7 @@ export class DocPlugin extends BasePlugin {
52
52
  const fmt = path.extname(out) ?? this.cmd.format;
53
53
  const finalName = await PathUtil.resolveUnix(out);
54
54
  const result = await RenderUtil.render(docFile, fmt);
55
- await fs.promises.writeFile(finalName, result, 'utf8');
55
+ await fs.writeFile(finalName, result, 'utf8');
56
56
  }
57
57
  };
58
58
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@travetto/doc",
3
3
  "displayName": "Documentation",
4
- "version": "2.0.1",
4
+ "version": "2.1.1",
5
5
  "description": "Documentation support for the travetto framework",
6
6
  "keywords": [
7
7
  "docs",
@@ -25,11 +25,11 @@
25
25
  "directory": "module/doc"
26
26
  },
27
27
  "dependencies": {
28
- "@travetto/base": "^2.0.1",
29
- "prismjs": "^1.23.0"
28
+ "@travetto/base": "^2.1.1",
29
+ "prismjs": "^1.27.0"
30
30
  },
31
31
  "optionalPeerDependencies": {
32
- "@travetto/cli": "^2.0.1"
32
+ "@travetto/cli": "^2.1.1"
33
33
  },
34
34
  "private": false,
35
35
  "publishConfig": {
package/src/util/file.ts CHANGED
@@ -1,7 +1,7 @@
1
- import * as fs from 'fs';
1
+ import { readFileSync } from 'fs';
2
2
  import * as path from 'path';
3
3
 
4
- import { FsUtil, PathUtil } from '@travetto/boot';
4
+ import { FsUtil, Package, PathUtil } from '@travetto/boot';
5
5
 
6
6
  const ESLINT_PATTERN = /\s*\/\/ eslint.*$/;
7
7
 
@@ -28,7 +28,7 @@ export class FileUtil {
28
28
  file = require.resolve(file);
29
29
  }
30
30
  const resolved = PathUtil.resolveUnix(file);
31
- return { resolved, cleaned: resolved.replace(/^.*node_modules\//, '') };
31
+ return { resolved, cleaned: PathUtil.simplifyPath(resolved, Package.name) };
32
32
  }
33
33
 
34
34
  /**
@@ -45,7 +45,7 @@ export class FileUtil {
45
45
 
46
46
  let text: string | undefined;
47
47
  if (language) {
48
- text = fs.readFileSync(resolved, 'utf8')
48
+ text = readFileSync(resolved, 'utf8')
49
49
  .replace(/^\/\/\s*@file-if.*/, '');
50
50
 
51
51
  text = text.split(/\n/)
@@ -73,7 +73,7 @@ export class FileUtil {
73
73
  return this.#decCache[key];
74
74
  }
75
75
 
76
- const text = fs.readFileSync(resolved, 'utf8')
76
+ const text = readFileSync(resolved, 'utf8')
77
77
  .split(/\n/g);
78
78
 
79
79
  const start = text.findIndex(x => new RegExp(`function ${name}\\b`).test(x));