@virmator/docs 13.3.4 → 13.3.5

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
@@ -15,7 +15,6 @@ A default plugin for [virmator](https://www.npmjs.com/package/virmator).
15
15
  - Deps
16
16
  - [markdown-code-example-inserter](https://npmjs.com/package/markdown-code-example-inserter)
17
17
  - [typedoc](https://npmjs.com/package/typedoc)
18
- - [esbuild](https://npmjs.com/package/esbuild)
19
18
  - Sub Commands
20
19
 
21
20
  - **check**
@@ -2,12 +2,7 @@ import {baseTypedocConfig} from '@virmator/docs/configs/typedoc.config.base';
2
2
  import {join, resolve} from 'node:path';
3
3
  import type {TypeDocOptions} from 'typedoc';
4
4
 
5
- const repoRoot = resolve(
6
- __dirname,
7
- /** Go up two directories because this gets compiled into `node_modules/.virmator` */
8
- '..',
9
- '..',
10
- );
5
+ const repoRoot = resolve(import.meta.dirname, '..');
11
6
  const indexTsFile = join(repoRoot, 'src', 'index.ts');
12
7
 
13
8
  export const typeDocConfig: Partial<TypeDocOptions> = {
@@ -2,12 +2,7 @@ import {baseTypedocConfig} from '@virmator/docs/configs/typedoc.config.base';
2
2
  import {join, resolve} from 'path';
3
3
  import type {TypeDocOptions} from 'typedoc';
4
4
 
5
- const repoRoot = resolve(
6
- __dirname,
7
- /** Go up two directories because this gets compiled into `node_modules/.virmator` */
8
- '..',
9
- '..',
10
- );
5
+ const repoRoot = resolve(import.meta.dirname, '..');
11
6
  const indexTsFile = join(repoRoot, 'src', 'docs.ts');
12
7
 
13
8
  export const typeDocConfig: Partial<TypeDocOptions> = {
package/dist/docs.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { NpmDepType, PackageType, PluginLogger, VirmatorEnv } from '@virmator/core';
2
+ import type * as Typedoc from 'typedoc';
2
3
  /** A virmator plugin for checking and generating documentation. */
3
4
  export declare const virmatorDocsPlugin: Readonly<Readonly<{
4
5
  name: string;
@@ -40,12 +41,6 @@ export declare const virmatorDocsPlugin: Readonly<Readonly<{
40
41
  readonly env: readonly [VirmatorEnv.Node, VirmatorEnv.Web];
41
42
  readonly packageType: readonly [PackageType.TopPackage, PackageType.MonoPackage];
42
43
  };
43
- /** Needed to compile the TS dep-cruiser config file. */
44
- readonly esbuild: {
45
- readonly type: NpmDepType.Dev;
46
- readonly env: readonly [VirmatorEnv.Node, VirmatorEnv.Web];
47
- readonly packageType: readonly [PackageType.TopPackage, PackageType.MonoPackage];
48
- };
49
44
  };
50
45
  };
51
46
  }>;
@@ -89,20 +84,14 @@ export declare const virmatorDocsPlugin: Readonly<Readonly<{
89
84
  readonly env: readonly [VirmatorEnv.Node, VirmatorEnv.Web];
90
85
  readonly packageType: readonly [PackageType.TopPackage, PackageType.MonoPackage];
91
86
  };
92
- /** Needed to compile the TS dep-cruiser config file. */
93
- readonly esbuild: {
94
- readonly type: NpmDepType.Dev;
95
- readonly env: readonly [VirmatorEnv.Node, VirmatorEnv.Web];
96
- readonly packageType: readonly [PackageType.TopPackage, PackageType.MonoPackage];
97
- };
98
87
  };
99
88
  };
100
89
  }>>;
101
90
  }>;
102
91
  /** Runs TypeDoc with a TypeScript config file just like `@virmator/docs` does. */
103
- export declare function runTypedoc({ configPath, packageDir, checkOnly, log, }: {
104
- /** Path to TS typedoc config file. */
105
- configPath: string;
92
+ export declare function runTypedoc({ config, packageDir, checkOnly, log, }: {
93
+ /** Full typedoc options object. */
94
+ config: Partial<Typedoc.TypeDocOptions>;
106
95
  /**
107
96
  * Path to the npm package which is running typedoc. This should be a path to a directory that
108
97
  * directly contains a `package.json` file.
package/dist/docs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ensureError, isTruthy } from '@augment-vir/common';
2
2
  import { readPackageJson } from '@augment-vir/node-js';
3
- import { defaultPluginLogger, defineVirmatorPlugin, JsModuleType, NpmDepType, PackageType, VirmatorEnv, VirmatorNoTraceError, withImportedTsFile, } from '@virmator/core';
3
+ import { defaultPluginLogger, defineVirmatorPlugin, NpmDepType, PackageType, VirmatorEnv, VirmatorNoTraceError, } from '@virmator/core';
4
4
  import mri from 'mri';
5
5
  import { basename, join } from 'node:path';
6
6
  /** A virmator plugin for checking and generating documentation. */
@@ -77,18 +77,6 @@ export const virmatorDocsPlugin = defineVirmatorPlugin(import.meta.dirname, {
77
77
  PackageType.MonoPackage,
78
78
  ],
79
79
  },
80
- /** Needed to compile the TS dep-cruiser config file. */
81
- esbuild: {
82
- type: NpmDepType.Dev,
83
- env: [
84
- VirmatorEnv.Node,
85
- VirmatorEnv.Web,
86
- ],
87
- packageType: [
88
- PackageType.TopPackage,
89
- PackageType.MonoPackage,
90
- ],
91
- },
92
80
  },
93
81
  },
94
82
  },
@@ -131,10 +119,14 @@ export const virmatorDocsPlugin = defineVirmatorPlugin(import.meta.dirname, {
131
119
  log.faint(`Skipping typedoc ${typedocVerb} in private repo ${packageName}`);
132
120
  return;
133
121
  }
122
+ // dynamic imports are not branches
123
+ /* node:coverage ignore next 2 */
124
+ const config = (await import(join(packageDir, configs.docs.configs.typedoc.copyToPath)))
125
+ .typeDocConfig;
134
126
  await runTypedoc({
135
127
  checkOnly,
136
128
  packageDir,
137
- configPath: join(packageDir, configs.docs.configs.typedoc.copyToPath),
129
+ config,
138
130
  log,
139
131
  });
140
132
  }
@@ -154,24 +146,22 @@ export const virmatorDocsPlugin = defineVirmatorPlugin(import.meta.dirname, {
154
146
  }
155
147
  });
156
148
  /** Runs TypeDoc with a TypeScript config file just like `@virmator/docs` does. */
157
- export async function runTypedoc({ configPath, packageDir, checkOnly = false, log = defaultPluginLogger, }) {
158
- await withImportedTsFile({
159
- inputPath: configPath,
160
- outputPath: join(packageDir, 'node_modules', '.virmator', 'typedoc.config.cjs'),
161
- }, JsModuleType.Cjs, async (loadedConfig) => {
162
- const typedocOptions = loadedConfig.typeDocConfig;
163
- // dynamic imports are not branches
164
- /* node:coverage ignore next */
165
- const typedoc = await import('typedoc');
166
- const fullTypedocOptions = {
167
- ...typedocOptions,
168
- ...(checkOnly ? { emit: typedoc.Configuration.EmitStrategy.none } : {}),
169
- tsconfig: join(packageDir, 'tsconfig.json'),
170
- };
171
- if (!(await runTypedocInternal(fullTypedocOptions, typedoc, log))) {
172
- throw new VirmatorNoTraceError();
173
- }
174
- });
149
+ export async function runTypedoc({ config, packageDir, checkOnly = false, log = defaultPluginLogger, }) {
150
+ // dynamic imports are not branches
151
+ /* node:coverage ignore next */
152
+ const typedoc = await import('typedoc');
153
+ const combinedConfig = {
154
+ tsconfig: join(packageDir, 'tsconfig.json'),
155
+ ...config,
156
+ ...(checkOnly
157
+ ? {
158
+ emit: typedoc.Configuration.EmitStrategy.none,
159
+ }
160
+ : {}),
161
+ };
162
+ if (!(await runTypedocInternal(combinedConfig, typedoc, log))) {
163
+ throw new VirmatorNoTraceError();
164
+ }
175
165
  }
176
166
  async function runTypedocInternal(options, typeDoc, log) {
177
167
  /** Lots of edge cases included in here to just make sure we fully run the typedoc API. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virmator/docs",
3
- "version": "13.3.4",
3
+ "version": "13.3.5",
4
4
  "description": "Default TS docs plugin for virmator.",
5
5
  "keywords": [
6
6
  "virmator",
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@augment-vir/common": "^29.3.0",
36
36
  "@augment-vir/node-js": "^29.3.0",
37
- "@virmator/core": "^13.3.4",
37
+ "@virmator/core": "^13.3.5",
38
38
  "chalk": "^5.3.0",
39
39
  "mri": "^1.2.0",
40
40
  "run-time-assertions": "^1.5.2"