@travetto/doc 5.0.0-rc.0 → 5.0.0-rc.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/doc",
3
- "version": "5.0.0-rc.0",
3
+ "version": "5.0.0-rc.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/base": "^5.0.0-rc.0",
27
+ "@travetto/base": "^5.0.0-rc.1",
28
28
  "@types/prismjs": "^1.26.4",
29
29
  "prismjs": "^1.29.0"
30
30
  },
31
31
  "peerDependencies": {
32
- "@travetto/cli": "^5.0.0-rc.0"
32
+ "@travetto/cli": "^5.0.0-rc.1"
33
33
  },
34
34
  "peerDependenciesMeta": {
35
35
  "@travetto/cli": {
@@ -1,7 +1,8 @@
1
1
  import fs from 'node:fs/promises';
2
2
 
3
3
  import { JSXElement } from '@travetto/doc/jsx-runtime';
4
- import { RuntimeIndex, PackageUtil, RuntimeContext } from '@travetto/manifest';
4
+ import { RuntimeContext } from '@travetto/base';
5
+ import { RuntimeIndex, PackageUtil } from '@travetto/manifest';
5
6
 
6
7
  import { highlight } from './code-highlight';
7
8
  import { RenderProvider, RenderState } from '../types';
@@ -1,5 +1,6 @@
1
1
  import fs from 'node:fs/promises';
2
- import { PackageUtil, RuntimeIndex, RuntimeContext } from '@travetto/manifest';
2
+ import { RuntimeContext } from '@travetto/base';
3
+ import { PackageUtil, RuntimeIndex } from '@travetto/manifest';
3
4
 
4
5
  import { RenderProvider } from '../types';
5
6
  import { c, getComponentName } from '../jsx';
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path';
2
2
 
3
- import { ManifestContext, PackageUtil, RuntimeIndex } from '@travetto/manifest';
3
+ import { type ManifestContext, PackageUtil, RuntimeIndex } from '@travetto/manifest';
4
4
  import { isJSXElement, JSXElement, JSXFragmentType } from '@travetto/doc/jsx-runtime';
5
5
 
6
6
  import { EMPTY_ELEMENT, getComponentName, JSXElementByFn, c } from '../jsx';
package/src/util/run.ts CHANGED
@@ -2,8 +2,8 @@ import os from 'node:os';
2
2
  import util from 'node:util';
3
3
  import { spawn, ChildProcess } from 'node:child_process';
4
4
 
5
- import { path, RuntimeIndex, RuntimeContext } from '@travetto/manifest';
6
- import { Env, ExecUtil } from '@travetto/base';
5
+ import { path, RuntimeIndex } from '@travetto/manifest';
6
+ import { Env, ExecUtil, RuntimeContext } from '@travetto/base';
7
7
 
8
8
  export const COMMON_DATE = new Date('2029-03-14T00:00:00.000').getTime();
9
9
 
@@ -45,11 +45,16 @@ class DocState {
45
45
  export class DocRunUtil {
46
46
  static #docState = new DocState();
47
47
 
48
+ /** Build cwd from config */
49
+ static cwd(cfg: RunConfig): string {
50
+ return path.toPosix(cfg.module ? RuntimeIndex.getModule(cfg.module)?.sourcePath! : RuntimeContext.mainSourcePath);
51
+ }
52
+
48
53
  /**
49
54
  * Clean run output
50
55
  */
51
56
  static cleanRunOutput(text: string, cfg: RunConfig): string {
52
- const cwd = path.toPosix((cfg.module ? RuntimeIndex.getModule(cfg.module)! : RuntimeIndex.mainModule).sourcePath);
57
+ const cwd = this.cwd(cfg);
53
58
  text = util.stripVTControlCharacters(text.trim())
54
59
  .replaceAll(cwd, '.')
55
60
  .replaceAll(os.tmpdir(), '/tmp')
@@ -76,7 +81,7 @@ export class DocRunUtil {
76
81
  */
77
82
  static spawn(cmd: string, args: string[], config: RunConfig = {}): ChildProcess {
78
83
  return spawn(cmd, args, {
79
- cwd: path.toPosix(config.cwd ?? (config.module ? RuntimeIndex.getModule(config.module)! : RuntimeIndex.mainModule).sourcePath),
84
+ cwd: config.cwd ?? this.cwd(config),
80
85
  shell: '/bin/bash',
81
86
  env: {
82
87
  ...process.env,
@@ -85,6 +90,7 @@ export class DocRunUtil {
85
90
  ...Env.TRV_CLI_IPC.export(undefined),
86
91
  ...Env.TRV_MANIFEST.export(''),
87
92
  ...Env.TRV_BUILD.export('none'),
93
+ ...Env.TRV_BUILD_REENTRANT.export(true),
88
94
  ...Env.TRV_ROLE.export(undefined),
89
95
  ...Env.TRV_MODULE.export(config.module ?? ''),
90
96
  ...(config.envName ? Env.TRV_ENV.export(config.envName) : {}),
@@ -2,8 +2,8 @@ import fs from 'node:fs/promises';
2
2
  import { spawn } from 'node:child_process';
3
3
  import path from 'node:path';
4
4
 
5
- import { PackageUtil, RuntimeIndex, RuntimeContext } from '@travetto/manifest';
6
- import { ExecUtil, Env, watchCompiler } from '@travetto/base';
5
+ import { PackageUtil } from '@travetto/manifest';
6
+ import { ExecUtil, Env, watchCompiler, RuntimeContext } from '@travetto/base';
7
7
  import { CliCommandShape, CliCommand, CliValidationError, CliUtil } from '@travetto/cli';
8
8
  import { MinLength } from '@travetto/schema';
9
9
 
@@ -56,7 +56,7 @@ export class DocCommand implements CliCommandShape {
56
56
  for await (const { action, file } of watchCompiler({ restartOnExit: true })) {
57
57
  if (action === 'update' && file === this.input) {
58
58
  const proc = spawn('npx', ['trv', ...args], {
59
- cwd: RuntimeIndex.mainModule.sourcePath,
59
+ cwd: RuntimeContext.mainSourcePath,
60
60
  shell: false,
61
61
  env: { ...process.env, ...Env.TRV_QUIET.export(true) },
62
62
  stdio: 'inherit'