fix(ui): serve SPA bundle from root, add cache-busting query, expose files API and include default CSS manager styles
This commit is contained in:
BIN
.playwright-mcp/page-2026-01-04T23-02-02-966Z.png
Normal file
BIN
.playwright-mcp/page-2026-01-04T23-02-02-966Z.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
.playwright-mcp/page-2026-01-04T23-28-43-211Z.png
Normal file
BIN
.playwright-mcp/page-2026-01-04T23-28-43-211Z.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
.playwright-mcp/page-2026-01-04T23-29-06-868Z.png
Normal file
BIN
.playwright-mcp/page-2026-01-04T23-29-06-868Z.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
.playwright-mcp/page-2026-01-04T23-29-24-899Z.png
Normal file
BIN
.playwright-mcp/page-2026-01-04T23-29-24-899Z.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
BIN
.playwright-mcp/page-2026-01-04T23-29-40-477Z.png
Normal file
BIN
.playwright-mcp/page-2026-01-04T23-29-40-477Z.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
28
changelog.md
Normal file
28
changelog.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-01-10 - 1.0.4 - fix(ui)
|
||||||
|
serve SPA bundle from root, add cache-busting query, expose files API and include default CSS manager styles
|
||||||
|
|
||||||
|
- Changed HTML script src to use absolute path /bundle.js so the SPA loads correctly when served from various routes.
|
||||||
|
- Added cache-busting by appending ?v=${project.version} to /bundle.js in served index.html to avoid stale client bundles.
|
||||||
|
- Made the /api/files/:org/:package endpoint available (removed dev-only gating) so package file listing is accessible in non-dev modes, with permission check retained.
|
||||||
|
- Added cssManager.defaultStyles to the opencdn-mainpage element to ensure default design system styles are included.
|
||||||
|
|
||||||
|
## 2026-01-04 - 1.0.3 - maintenance
|
||||||
|
Consolidated maintenance updates.
|
||||||
|
|
||||||
|
- Minor maintenance and housekeeping ("update" commits).
|
||||||
|
- Duplicate update commits merged; no further detail provided in commit messages.
|
||||||
|
- No explicit functional changes described.
|
||||||
|
|
||||||
|
## 2022-01-06 - 1.0.1–1.0.3 - core fixes & release tags
|
||||||
|
Summary of early releases: core fixes and several non-descriptive release/tag commits.
|
||||||
|
|
||||||
|
- fix(core): update — core fixes applied (appears in 1.0.1 and 1.0.2).
|
||||||
|
- Non-descriptive release/tag commits for 1.0.2 and 1.0.3 (messages: "1.0.2", "1.0.3")—no details provided.
|
||||||
|
- These commits appear to be small fixes and housekeeping around the initial 1.0.x releases.
|
||||||
|
|
||||||
|
## 2022-01-05 - unknown - initial
|
||||||
|
Initial project commit.
|
||||||
|
|
||||||
|
- Project initialized ("Initial commit").
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script type="module" src="./bundle.js"></script>
|
<script type="module" src="/bundle.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
const appContainer = document.getElementById('app');
|
const appContainer = document.getElementById('app');
|
||||||
|
|||||||
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @push.rocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@serve.zone/opencdn',
|
||||||
|
version: '1.0.4',
|
||||||
|
description: 'A CDN that serves files directly from npm packages'
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -133,8 +133,7 @@ export class UiPublicServer {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// API endpoint for file listing (dev mode)
|
// API endpoint for file listing
|
||||||
if (this.options.mode === 'dev') {
|
|
||||||
expressApplication.get('/api/files/:org/:package', async (req, res) => {
|
expressApplication.get('/api/files/:org/:package', async (req, res) => {
|
||||||
const packageName = `${req.params.org}/${req.params.package}`;
|
const packageName = `${req.params.org}/${req.params.package}`;
|
||||||
const version = (req.query.version as string) || '';
|
const version = (req.query.version as string) || '';
|
||||||
@@ -177,7 +176,6 @@ export class UiPublicServer {
|
|||||||
expressApplication.get('/peek', async (req, res) => {
|
expressApplication.get('/peek', async (req, res) => {
|
||||||
await this.serveIndexHtml(req, res);
|
await this.serveIndexHtml(req, res);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
// Main package serving route
|
// Main package serving route
|
||||||
expressApplication.use('/', async (req, res) => {
|
expressApplication.use('/', async (req, res) => {
|
||||||
@@ -229,6 +227,9 @@ export class UiPublicServer {
|
|||||||
const configScript = `<script>window.__OPENCDN_CONFIG__ = ${JSON.stringify(config)};</script>`;
|
const configScript = `<script>window.__OPENCDN_CONFIG__ = ${JSON.stringify(config)};</script>`;
|
||||||
html = html.replace('</head>', `${configScript}\n</head>`);
|
html = html.replace('</head>', `${configScript}\n</head>`);
|
||||||
|
|
||||||
|
// Add version query parameter to bundle.js for cache busting
|
||||||
|
html = html.replace('/bundle.js', `/bundle.js?v=${this.projectinfo.version}`);
|
||||||
|
|
||||||
res.setHeader('content-type', embeddedFile.contentType);
|
res.setHeader('content-type', embeddedFile.contentType);
|
||||||
res.setHeader('cache-control', 'no-cache');
|
res.setHeader('cache-control', 'no-cache');
|
||||||
res.status(200).send(html);
|
res.status(200).send(html);
|
||||||
|
|||||||
8
ts_web/00_commitinfo_data.ts
Normal file
8
ts_web/00_commitinfo_data.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @push.rocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@serve.zone/opencdn',
|
||||||
|
version: '1.0.4',
|
||||||
|
description: 'A CDN that serves files directly from npm packages'
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
html,
|
html,
|
||||||
customElement,
|
customElement,
|
||||||
type TemplateResult,
|
type TemplateResult,
|
||||||
|
cssManager,
|
||||||
css,
|
css,
|
||||||
state,
|
state,
|
||||||
} from '@design.estate/dees-element';
|
} from '@design.estate/dees-element';
|
||||||
@@ -31,6 +32,7 @@ export class OpencdnMainpage extends DeesElement {
|
|||||||
|
|
||||||
// Shadcn-like color palette
|
// Shadcn-like color palette
|
||||||
public static styles = [
|
public static styles = [
|
||||||
|
cssManager.defaultStyles,
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
--background: #09090b;
|
--background: #09090b;
|
||||||
|
|||||||
Reference in New Issue
Block a user