@mintlify/previewing 4.0.580 → 4.0.582

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,7 +1,7 @@
1
1
  import type { Ora as OraType } from 'ora';
2
- export declare const getTargetMintVersion: (logger: OraType) => Promise<string | undefined>;
2
+ export declare const getTargetMintVersion: (logger?: OraType) => Promise<string | undefined>;
3
3
  export declare const downloadTargetMint: ({ logger, targetVersion, existingVersion, }: {
4
- logger: OraType;
4
+ logger: OraType | undefined;
5
5
  targetVersion: string;
6
6
  existingVersion: string | null;
7
7
  }) => Promise<void>;
@@ -15,7 +15,9 @@ export const getTargetMintVersion = async (logger) => {
15
15
  return response.body;
16
16
  }
17
17
  catch (error) {
18
- logger.text = `Failed to fetch the latest Mintlify version: ${error instanceof Error ? error.message : 'Unknown error'}`;
18
+ if (logger) {
19
+ logger.text = `Failed to fetch the latest Mintlify version: ${error instanceof Error ? error.message : 'Unknown error'}`;
20
+ }
19
21
  }
20
22
  return undefined;
21
23
  };
@@ -24,7 +26,9 @@ export const downloadTargetMint = async ({ logger, targetVersion, existingVersio
24
26
  fse.moveSync(DOT_MINTLIFY, DOT_MINTLIFY_LAST, { overwrite: true });
25
27
  }
26
28
  fse.ensureDirSync(DOT_MINTLIFY);
27
- logger.text = 'Downloading Mintlify framework...';
29
+ if (logger) {
30
+ logger.text = 'Downloading Mintlify framework...';
31
+ }
28
32
  const tarUrl = getTarUrl(targetVersion);
29
33
  let currentVersion = targetVersion.trim();
30
34
  try {
@@ -32,18 +36,24 @@ export const downloadTargetMint = async ({ logger, targetVersion, existingVersio
32
36
  }
33
37
  catch (error) {
34
38
  if (existingVersion) {
35
- logger.warn(`Failed to download Mintlify framework version ${currentVersion}, ${error}, falling back to existing version: ${existingVersion}`);
39
+ if (logger) {
40
+ logger.warn(`Failed to download Mintlify framework version ${currentVersion}, ${error}, falling back to existing version: ${existingVersion}`);
41
+ }
36
42
  currentVersion = existingVersion;
37
43
  restoreMintlifyLast();
38
44
  return;
39
45
  }
40
46
  else {
41
- logger.fail(`Failed to download Mintlify framework version ${currentVersion}, ${error}`);
47
+ if (logger) {
48
+ logger.fail(`Failed to download Mintlify framework version ${currentVersion}, ${error}`);
49
+ }
42
50
  process.exit(1);
43
51
  }
44
52
  }
45
53
  try {
46
- logger.text = 'Extracting Mintlify framework...';
54
+ if (logger) {
55
+ logger.text = 'Extracting Mintlify framework...';
56
+ }
47
57
  tar.x({
48
58
  sync: true,
49
59
  file: TAR_PATH,
@@ -55,13 +65,17 @@ export const downloadTargetMint = async ({ logger, targetVersion, existingVersio
55
65
  }
56
66
  catch (error) {
57
67
  if (existingVersion) {
58
- logger.warn(`Failed to extract Mintlify framework version ${currentVersion}, ${error}, using existing version: ${existingVersion}`);
68
+ if (logger) {
69
+ logger.warn(`Failed to extract Mintlify framework version ${currentVersion}, ${error}, using existing version: ${existingVersion}`);
70
+ }
59
71
  currentVersion = existingVersion;
60
72
  restoreMintlifyLast();
61
73
  return;
62
74
  }
63
75
  else {
64
- logger.fail(`Failed to extract Mintlify framework version ${currentVersion}, ${error}`);
76
+ if (logger) {
77
+ logger.fail(`Failed to extract Mintlify framework version ${currentVersion}, ${error}`);
78
+ }
65
79
  process.exit(1);
66
80
  }
67
81
  }
@@ -201,7 +201,8 @@ const onUpdateEvent = async (filename, callback) => {
201
201
  if (hasImports(importsResponse)) {
202
202
  contentStr = stringifyTree(await resolveAllImports({ ...importsResponse, filename }));
203
203
  }
204
- const { pageContent } = await createPage(filename, contentStr, CMD_EXEC_PATH, [], []);
204
+ // set suppressErrLog true here to avoid double logging errors already logged in preparseMdxTree
205
+ const { pageContent } = await createPage(filename, contentStr, CMD_EXEC_PATH, [], [], true);
205
206
  await fse.outputFile(targetPath, pageContent, {
206
207
  flag: 'w',
207
208
  });
@@ -8,6 +8,19 @@ import { maybeFixMissingWindowsEnvVar } from '../util.js';
8
8
  import listener from './listener/index.js';
9
9
  import { setupNext } from './setupNext.js';
10
10
  export const run = async (argv) => {
11
+ // Ignore tailwind warnings
12
+ const ignoredMessages = [
13
+ 'No utility classes were detected',
14
+ 'https://tailwindcss.com/docs/content-configuration',
15
+ ];
16
+ const originalConsoleWarn = console.warn;
17
+ console.warn = (...args) => {
18
+ const message = args.join(' ');
19
+ if (ignoredMessages.some((ignoredMessage) => message.includes(ignoredMessage))) {
20
+ return;
21
+ }
22
+ originalConsoleWarn.apply(console, args);
23
+ };
11
24
  const port = argv.port || '3000';
12
25
  const currentPort = parseInt(port, 10) || 3000;
13
26
  const app = express();
@@ -15,7 +15,7 @@
15
15
  * Links:
16
16
  * - [standalone build](https://nextjs.org/docs/pages/api-reference/next-config-js/output#automatically-copying-traced-files)
17
17
  * - [server.js](https://github.com/vercel/next.js/blob/492156b4c5e2559b2a280f7d483cd85a8e8742a9/packages/next/src/build/utils.ts#L2108-L2113) (created programmatically)
18
- * - [start-server.ts](https://github.com/vercel/next.js/blob/492156b4c5e2559b2a280f7d483cd85a8e8742a9/packages/next/src/server/lib/start-server.ts#L296-L308)
18
+ * - [start-server.ts](https://github.com/vercel/next.js/blob/59e5ccb225189d366f57f1b204c5f44053a434ce/packages/next/src/server/lib/start-server.ts#L416-L429)
19
19
  *
20
20
  * @returns the request handler provided by next.js
21
21
  */
@@ -18,7 +18,7 @@ import { CLIENT_PATH, NEXT_CONFIG_PATH, NEXT_ROUTER_SERVER_PATH, NEXT_SIDE_EFFEC
18
18
  * Links:
19
19
  * - [standalone build](https://nextjs.org/docs/pages/api-reference/next-config-js/output#automatically-copying-traced-files)
20
20
  * - [server.js](https://github.com/vercel/next.js/blob/492156b4c5e2559b2a280f7d483cd85a8e8742a9/packages/next/src/build/utils.ts#L2108-L2113) (created programmatically)
21
- * - [start-server.ts](https://github.com/vercel/next.js/blob/492156b4c5e2559b2a280f7d483cd85a8e8742a9/packages/next/src/server/lib/start-server.ts#L296-L308)
21
+ * - [start-server.ts](https://github.com/vercel/next.js/blob/59e5ccb225189d366f57f1b204c5f44053a434ce/packages/next/src/server/lib/start-server.ts#L416-L429)
22
22
  *
23
23
  * @returns the request handler provided by next.js
24
24
  */
@@ -31,11 +31,13 @@ export const setupNext = async () => {
31
31
  // Also, Windows requires us to use `pathToFileURL` (see #899)
32
32
  await import(pathToFileURL(NEXT_SIDE_EFFECT_PATH).href);
33
33
  const { initialize } = await import(pathToFileURL(NEXT_ROUTER_SERVER_PATH).href);
34
- const [requestHandler] = await initialize({
34
+ // requestHandler was returned as an array in Next 14, and as an object in Next 15
35
+ // this lets us support both version for old (<=0.0.1326) and new (>=0.0.1327) versions of the client app
36
+ const result = await initialize({
35
37
  dir: CLIENT_PATH,
36
38
  dev: false,
37
39
  hostname,
38
40
  minimalMode: true,
39
41
  });
40
- return requestHandler;
42
+ return Array.isArray(result) ? result[0] : result.requestHandler;
41
43
  };