@mintlify/previewing 4.0.1520 → 4.0.1522
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/dist/__tests__/export-base-path.test.d.ts +1 -0
- package/dist/__tests__/export-base-path.test.js +101 -0
- package/dist/__tests__/export.test.js +15 -1
- package/dist/local-preview/export-assets.d.ts +1 -0
- package/dist/local-preview/export-assets.js +4 -1
- package/dist/local-preview/export-base-path.d.ts +6 -0
- package/dist/local-preview/export-base-path.js +43 -0
- package/dist/local-preview/export-llms.d.ts +1 -1
- package/dist/local-preview/export-llms.js +2 -2
- package/dist/local-preview/export.d.ts +2 -1
- package/dist/local-preview/export.js +32 -13
- package/dist/local-preview/setupNext.d.ts +3 -1
- package/dist/local-preview/setupNext.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/export-scripts/serve.js +16 -3
- package/package.json +5 -5
package/export-scripts/serve.js
CHANGED
|
@@ -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(
|
|
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(
|
|
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.
|
|
3
|
+
"version": "4.0.1522",
|
|
4
4
|
"description": "Preview Mintlify docs locally",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"type": "tsgo --noEmit"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@mintlify/common": "1.0.
|
|
48
|
-
"@mintlify/prebuild": "1.0.
|
|
47
|
+
"@mintlify/common": "1.0.1280",
|
|
48
|
+
"@mintlify/prebuild": "1.0.1445",
|
|
49
49
|
"@mintlify/validation": "0.1.933",
|
|
50
50
|
"adm-zip": "0.6.0",
|
|
51
51
|
"better-opn": "3.0.2",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"yargs": "17.7.1"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"@mintlify/package-builder": "0.0.
|
|
67
|
+
"@mintlify/package-builder": "0.0.68"
|
|
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": "
|
|
89
|
+
"gitHead": "f69aa7704fd264c2ee18fcc8feb21c52f56a7c65"
|
|
90
90
|
}
|