@mintlify/previewing 4.0.1519 → 4.0.1521

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.
@@ -7,6 +7,7 @@ const { execFile } = require('child_process');
7
7
 
8
8
  const PORT = process.env.PORT || 3000;
9
9
  const DIR = __dirname;
10
+ const BASE_PATH = '';
10
11
 
11
12
  const IMMUTABLE_PATH = /^\/(?:_next\/static|_mintlify\/assets|_mintlify\/export-assets)\//;
12
13
 
@@ -76,15 +77,27 @@ http
76
77
  return;
77
78
  }
78
79
 
80
+ if (BASE_PATH && urlPath !== BASE_PATH && !urlPath.startsWith(BASE_PATH + '/')) {
81
+ if (urlPath === '/') {
82
+ res.writeHead(302, { Location: BASE_PATH + '/' });
83
+ res.end();
84
+ return;
85
+ }
86
+ res.writeHead(404, { 'Content-Type': 'text/plain' });
87
+ res.end('404 Not Found');
88
+ return;
89
+ }
90
+
91
+ const exportPath = urlPath.slice(BASE_PATH.length) || '/';
79
92
  const rsc = isRscRequest(req);
80
- const file = rsc ? resolveRscPayload(urlPath) : resolveFile(urlPath);
93
+ const file = rsc ? resolveRscPayload(exportPath) : resolveFile(exportPath);
81
94
 
82
95
  if (file) {
83
96
  const ext = path.extname(file).toLowerCase();
84
97
  res.writeHead(200, {
85
98
  'Content-Type': rsc ? 'text/x-component' : MIME_TYPES[ext] || 'application/octet-stream',
86
99
  Vary: 'RSC',
87
- 'Cache-Control': IMMUTABLE_PATH.test(urlPath)
100
+ 'Cache-Control': IMMUTABLE_PATH.test(exportPath)
88
101
  ? 'public, max-age=31536000, immutable'
89
102
  : 'no-cache',
90
103
  });
@@ -95,7 +108,7 @@ http
95
108
  }
96
109
  })
97
110
  .listen(PORT, () => {
98
- const url = 'http://localhost:' + PORT;
111
+ const url = 'http://localhost:' + PORT + BASE_PATH + '/';
99
112
  console.log('Serving docs at ' + url);
100
113
  openInBrowser(url);
101
114
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/previewing",
3
- "version": "4.0.1519",
3
+ "version": "4.0.1521",
4
4
  "description": "Preview Mintlify docs locally",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -44,9 +44,9 @@
44
44
  "type": "tsgo --noEmit"
45
45
  },
46
46
  "dependencies": {
47
- "@mintlify/common": "1.0.1277",
48
- "@mintlify/prebuild": "1.0.1442",
49
- "@mintlify/validation": "0.1.932",
47
+ "@mintlify/common": "1.0.1279",
48
+ "@mintlify/prebuild": "1.0.1444",
49
+ "@mintlify/validation": "0.1.933",
50
50
  "adm-zip": "0.6.0",
51
51
  "better-opn": "3.0.2",
52
52
  "chalk": "5.2.0",
@@ -64,7 +64,7 @@
64
64
  "yargs": "17.7.1"
65
65
  },
66
66
  "optionalDependencies": {
67
- "@mintlify/package-builder": "0.0.65"
67
+ "@mintlify/package-builder": "0.0.67"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@mintlify/models": "0.0.376",
@@ -86,5 +86,5 @@
86
86
  "vitest": "2.1.9",
87
87
  "vitest-mock-process": "1.0.4"
88
88
  },
89
- "gitHead": "89c33b896c4fb3b5a2634d6180354acc9d500c35"
89
+ "gitHead": "0c8c981dc0a4e1158ac9368d4bda1aa688880efa"
90
90
  }