@onexapis/cli 1.1.14 → 1.1.16
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/cli.js +15 -24
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +15 -24
- package/dist/cli.mjs.map +1 -1
- package/dist/preview/preview-app.tsx +2 -61
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -3893,6 +3893,18 @@ function createDevServer(options) {
|
|
|
3893
3893
|
serveFile(res, options.previewRuntimePath);
|
|
3894
3894
|
return;
|
|
3895
3895
|
}
|
|
3896
|
+
if (pathname.startsWith("/_assets/")) {
|
|
3897
|
+
const parts = pathname.replace(/^\/_assets\//, "").split("/");
|
|
3898
|
+
const assetSubpath = parts.slice(1).join("/");
|
|
3899
|
+
const assetPath = path8.join(options.themePath, "assets", assetSubpath);
|
|
3900
|
+
if (!assetPath.startsWith(path8.join(options.themePath, "assets"))) {
|
|
3901
|
+
res.writeHead(403);
|
|
3902
|
+
res.end("Forbidden");
|
|
3903
|
+
return;
|
|
3904
|
+
}
|
|
3905
|
+
serveFile(res, assetPath);
|
|
3906
|
+
return;
|
|
3907
|
+
}
|
|
3896
3908
|
const filePath = path8.join(options.distDir, pathname);
|
|
3897
3909
|
if (!filePath.startsWith(options.distDir)) {
|
|
3898
3910
|
res.writeHead(403);
|
|
@@ -3954,32 +3966,10 @@ function generatePreviewHTML(themeName, port) {
|
|
|
3954
3966
|
<!-- Tailwind CSS Play CDN \u2014 JIT compilation in browser for dev preview -->
|
|
3955
3967
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
3956
3968
|
<style>
|
|
3957
|
-
#onex-
|
|
3958
|
-
position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
|
|
3959
|
-
height: 40px; background: #1a1a2e; color: #e0e0e0;
|
|
3960
|
-
display: flex; align-items: center; padding: 0 16px; gap: 16px;
|
|
3961
|
-
font-family: system-ui; font-size: 13px;
|
|
3962
|
-
border-bottom: 2px solid #16213e;
|
|
3963
|
-
}
|
|
3964
|
-
#onex-dev-toolbar .status { width: 8px; height: 8px; border-radius: 50%; }
|
|
3965
|
-
#onex-dev-toolbar .status.connected { background: #00ff88; }
|
|
3966
|
-
#onex-dev-toolbar .status.disconnected { background: #ff4444; }
|
|
3967
|
-
#onex-dev-toolbar .status.rebuilding { background: #ffaa00; animation: pulse 0.5s infinite; }
|
|
3968
|
-
@keyframes pulse { 50% { opacity: 0.5; } }
|
|
3969
|
-
#onex-preview-root { margin-top: 40px; }
|
|
3969
|
+
#onex-preview-root { margin-top: 0; }
|
|
3970
3970
|
</style>
|
|
3971
3971
|
</head>
|
|
3972
3972
|
<body>
|
|
3973
|
-
<div id="onex-dev-toolbar">
|
|
3974
|
-
<span style="font-weight:600;">OneX Dev</span>
|
|
3975
|
-
<span style="color:#888;">|</span>
|
|
3976
|
-
<span>${themeName}</span>
|
|
3977
|
-
<span style="color:#888;">|</span>
|
|
3978
|
-
<span id="page-indicator">Home</span>
|
|
3979
|
-
<span style="color:#888;">|</span>
|
|
3980
|
-
<span class="status connected" id="ws-status"></span>
|
|
3981
|
-
<span id="ws-label">Connected</span>
|
|
3982
|
-
</div>
|
|
3983
3973
|
<div id="onex-preview-root"></div>
|
|
3984
3974
|
<script type="module" src="/preview-runtime.js"></script>
|
|
3985
3975
|
</body>
|
|
@@ -4037,7 +4027,8 @@ async function devCommand(options) {
|
|
|
4037
4027
|
port,
|
|
4038
4028
|
distDir: outputDir,
|
|
4039
4029
|
previewRuntimePath,
|
|
4040
|
-
themeName
|
|
4030
|
+
themeName,
|
|
4031
|
+
themePath
|
|
4041
4032
|
});
|
|
4042
4033
|
const watcher = chokidar.watch(
|
|
4043
4034
|
[
|