@mintlify/previewing 4.0.1661 → 4.0.1663

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.
@@ -1,6 +1,7 @@
1
1
  import { ArgumentsCamelCase } from 'yargs';
2
2
  export declare const run: (argv: ArgumentsCamelCase & {
3
3
  needsUpdate: boolean;
4
+ onExit?: () => Promise<void>;
4
5
  fileImportsMap?: Map<string, Set<string>>;
5
6
  apiUrl?: string;
6
7
  }) => Promise<void>;
@@ -5,7 +5,7 @@ import { createServer } from 'http';
5
5
  import { Server as SocketServer } from 'socket.io';
6
6
  import { CLIENT_FRAMEWORK, CMD_EXEC_PATH, NEXT_PUBLIC_PATH } from '../constants.js';
7
7
  import { addLog, removeSpinnerLogs } from '../logging-state.js';
8
- import { LaunchLog, SearchDisabledLog, UpdateLog } from '../logs.js';
8
+ import { InfoLog, LaunchLog, SearchDisabledLog, UpdateLog } from '../logs.js';
9
9
  import { maybeFixMissingWindowsEnvVar } from '../util.js';
10
10
  import { addDevTimingLog, startDevTiming, timeDev } from './dev-timing.js';
11
11
  import listener, { initializeDocsConfigHashCache, initializeFrontmatterHashCache, initializeImportCache, } from './listener/index.js';
@@ -159,6 +159,9 @@ export const run = async (argv) => {
159
159
  if (!accessToken) {
160
160
  addLog(_jsx(SearchDisabledLog, { loginCommand: `${argv.packageName} login` }));
161
161
  }
162
+ if (typeof argv.previewReadyMessage === 'string') {
163
+ addLog(_jsx(InfoLog, { message: argv.previewReadyMessage }));
164
+ }
162
165
  addLog(_jsx(LaunchLog, { localUrl: `http://localhost:${port}`, networkUrl: exposeOnNetwork && localIp ? `http://${localIp}:${port}` : undefined }));
163
166
  /**
164
167
  * We're running into a known bug with the `open` package, where Windows machines error out because process.env.SYSTEMROOT is not set:
@@ -172,9 +175,7 @@ export const run = async (argv) => {
172
175
  void open(`http://localhost:${port}`);
173
176
  }
174
177
  // exit with successful status
175
- const onExit = () => {
176
- process.exit(0);
177
- };
178
+ const onExit = argv.onExit ?? (() => process.exit(0));
178
179
  process.on('SIGINT', onExit);
179
180
  process.on('SIGTERM', onExit);
180
181
  });