dbxlite-ui 0.3.1 → 0.3.2
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/assets/assets/{main-D7VyIWiO.js → main-CyH5V7SF.js} +1687 -1687
- package/assets/index.html +1 -1
- package/dist/cli.js +23 -5
- package/package.json +1 -1
package/assets/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
<!-- Favicon - database icon in gradient rounded square -->
|
|
16
16
|
<link rel="icon" type="image/svg+xml" href="./logo/favicon.svg">
|
|
17
|
-
<script type="module" crossorigin src="./assets/main-
|
|
17
|
+
<script type="module" crossorigin src="./assets/main-CyH5V7SF.js"></script>
|
|
18
18
|
<link rel="modulepreload" crossorigin href="./assets/oauth-constants-m7PlKcMR.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="./assets/react-vendor-B2Ij4Vfr.js">
|
|
20
20
|
<link rel="modulepreload" crossorigin href="./assets/monaco-editor-CbzSR0rd.js">
|
package/dist/cli.js
CHANGED
|
@@ -160,12 +160,22 @@ function findAssetsDir() {
|
|
|
160
160
|
const ASSETS_DIR = findAssetsDir();
|
|
161
161
|
console.log(`Assets directory: ${ASSETS_DIR}`);
|
|
162
162
|
|
|
163
|
+
// SPA-route prefixes that map to actual on-disk asset folders. Any path
|
|
164
|
+
// outside these prefixes that doesn't resolve to a file falls back to
|
|
165
|
+
// index.html so the React router can handle it (mirrors the Vercel rewrite).
|
|
166
|
+
const ASSET_PREFIXES = ['/assets/', '/duckdb/', '/sql-templates/', '/logo/', '/screenshots/'];
|
|
167
|
+
const ASSET_FILES = ['/robots.txt', '/sitemap.xml', '/favicon.ico'];
|
|
168
|
+
|
|
169
|
+
function isAssetPath(urlPath) {
|
|
170
|
+
return ASSET_PREFIXES.some(p => urlPath.startsWith(p)) || ASSET_FILES.includes(urlPath);
|
|
171
|
+
}
|
|
172
|
+
|
|
163
173
|
// Create asset server
|
|
164
174
|
const server = createServer((req, res) => {
|
|
165
175
|
let urlPath = req.url.split('?')[0];
|
|
166
176
|
if (urlPath === '/') urlPath = '/index.html';
|
|
167
177
|
|
|
168
|
-
|
|
178
|
+
let filePath = join(ASSETS_DIR, urlPath);
|
|
169
179
|
|
|
170
180
|
// Security: prevent directory traversal
|
|
171
181
|
if (!filePath.startsWith(ASSETS_DIR)) {
|
|
@@ -175,10 +185,18 @@ const server = createServer((req, res) => {
|
|
|
175
185
|
}
|
|
176
186
|
|
|
177
187
|
try {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
188
|
+
const missing = !existsSync(filePath) || statSync(filePath).isDirectory();
|
|
189
|
+
if (missing) {
|
|
190
|
+
// SPA fallback: non-asset routes (e.g. /examples, /screenshots-page)
|
|
191
|
+
// serve index.html so the React router can handle them. True asset
|
|
192
|
+
// misses (under /assets/, /duckdb/, etc.) still 404.
|
|
193
|
+
if (!isAssetPath(urlPath) && urlPath !== '/index.html') {
|
|
194
|
+
filePath = join(ASSETS_DIR, 'index.html');
|
|
195
|
+
} else {
|
|
196
|
+
res.writeHead(404, { 'Content-Type': 'text/plain', 'Content-Length': 9 });
|
|
197
|
+
res.end('Not found');
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
182
200
|
}
|
|
183
201
|
|
|
184
202
|
const content = readFileSync(filePath);
|
package/package.json
CHANGED