feat: integrate latest HMDesign design system updates
This commit is contained in:
1 parent
99faec189e
commit
1c4e0bb9a1
209 files changed
+8845
-552
No files matched your search
@@ -1,4 +1,5 @@
|
||||
// Portable test launcher: built-in modules only; never invokes npm or a global Node.
|
||||
// Preview launcher: built-in modules only. Bundled Node when present, installed
|
||||
// Node otherwise; no npm install/build is needed for the static preview.
|
||||
const http = require('node:http');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
@@ -11,12 +12,13 @@ const server = http.createServer((req, res) => {
|
||||
try { pathname = decodeURIComponent(new URL(req.url, 'http://127.0.0.1').pathname); }
|
||||
catch { res.writeHead(400); res.end(); return; }
|
||||
// Dashboard is a production export and must be served from its own URL root.
|
||||
const example = pathname === '/example' || pathname.startsWith('/example/');
|
||||
const dashboard = pathname === '/dashboard' || pathname.startsWith('/dashboard/');
|
||||
const dashboardPath = dashboard ? (pathname === '/dashboard' ? '/dashboard/' : pathname) : pathname;
|
||||
// Source Reference/static example paths keep their repository-relative imports.
|
||||
const reference = ['/docs/','/packages/','/src/','/public/'].some(prefix => pathname.startsWith(prefix));
|
||||
const base = dashboard ? path.join(root, 'dist-dashboard') : (reference ? root : path.join(root, 'storybook-static'));
|
||||
const relativePath = dashboard ? dashboardPath.slice('/dashboard'.length) || '/' : (pathname === '/favicon.ico' ? '/favicon.svg' : pathname);
|
||||
const base = example ? path.join(root, 'examples/publisher-list/dist') : dashboard ? path.join(root, 'dist-dashboard') : (reference ? root : path.join(root, 'storybook-static'));
|
||||
const relativePath = example ? pathname.slice('/example'.length) || '/' : dashboard ? dashboardPath.slice('/dashboard'.length) || '/' : (pathname === '/favicon.ico' ? '/favicon.svg' : pathname);
|
||||
let file = path.resolve(base, '.' + relativePath);
|
||||
const relative = path.relative(base, file);
|
||||
if (relative.startsWith('..') || path.isAbsolute(relative) || pathname.includes('\\')) { res.writeHead(403); res.end(); return; }
|
||||
@@ -58,7 +60,7 @@ server.on('error', error => {
|
||||
});
|
||||
server.on('listening', () => {
|
||||
const url = `http://127.0.0.1:${server.address().port}/`;
|
||||
console.log(`HM Design System Portable Test\nNode ${process.version} (${process.arch})\nStorybook: ${url}\nDashboard: ${url}dashboard/\nStatic status example: ${url}docs/patterns/dashboard-status-static.html\nPress Ctrl+C to stop this preview.\n`);
|
||||
console.log(`HM Design System Portable Test\nNode ${process.version} (${process.arch})\nStorybook: ${url}\nNew React screen: ${url}example/\nDashboard: ${url}dashboard/\nStatic status example: ${url}docs/patterns/dashboard-status-static.html\nPress Ctrl+C to stop this preview.\n`);
|
||||
openDefaultBrowser(url);
|
||||
});
|
||||
process.on('SIGINT', () => server.close(() => process.exit(0)));
|
||||
|
||||
Reference in new issue
Block a user