@onexapis/cli 1.1.42 → 1.1.43

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.mjs CHANGED
@@ -749,6 +749,14 @@ async function compileStandaloneTheme(themePath, themeName) {
749
749
  } catch {
750
750
  }
751
751
  await contentHashEntry(outputDir);
752
+ const themeAssetsDir = path9.join(themePath, "assets");
753
+ const distThemeAssets = path9.join(outputDir, "theme-assets");
754
+ try {
755
+ await fs8.access(themeAssetsDir);
756
+ await fs8.cp(themeAssetsDir, distThemeAssets, { recursive: true });
757
+ logger.info("Copied static assets to dist/theme-assets/");
758
+ } catch {
759
+ }
752
760
  await generateManifest(themeName, themePath, outputDir);
753
761
  await generateThemeData(themePath, outputDir, themeName);
754
762
  await generateThemeCSS(themePath, outputDir);
@@ -4295,20 +4303,27 @@ function createDevServer(options) {
4295
4303
  if (pathname.startsWith("/assets/")) {
4296
4304
  const subpath = pathname.replace(/^\/assets\//, "");
4297
4305
  const segments = subpath.split("/");
4306
+ const assetsBase = path9.join(options.themePath, "assets");
4298
4307
  let assetPath;
4299
4308
  if (segments[0] === options.themeName || segments[0] === options.themeName.replace(/^my-/, "")) {
4300
- assetPath = path9.join(
4301
- options.themePath,
4302
- "assets",
4303
- segments.slice(1).join("/")
4304
- );
4309
+ assetPath = path9.join(assetsBase, segments.slice(1).join("/"));
4305
4310
  } else {
4306
- assetPath = path9.join(options.themePath, "assets", subpath);
4311
+ assetPath = path9.join(assetsBase, subpath);
4307
4312
  }
4308
- if (assetPath.startsWith(path9.join(options.themePath, "assets")) && fs3.existsSync(assetPath)) {
4313
+ if (assetPath.startsWith(assetsBase) && fs3.existsSync(assetPath)) {
4309
4314
  serveFile(res, assetPath);
4310
4315
  return;
4311
4316
  }
4317
+ if (segments.length > 1) {
4318
+ const fallbackPath = path9.join(
4319
+ assetsBase,
4320
+ segments.slice(1).join("/")
4321
+ );
4322
+ if (fallbackPath.startsWith(assetsBase) && fs3.existsSync(fallbackPath)) {
4323
+ serveFile(res, fallbackPath);
4324
+ return;
4325
+ }
4326
+ }
4312
4327
  }
4313
4328
  const filePath = path9.join(options.distDir, pathname);
4314
4329
  if (!filePath.startsWith(options.distDir)) {