@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.js CHANGED
@@ -792,6 +792,14 @@ async function compileStandaloneTheme(themePath, themeName) {
792
792
  } catch {
793
793
  }
794
794
  await contentHashEntry(outputDir);
795
+ const themeAssetsDir = path9__default.default.join(themePath, "assets");
796
+ const distThemeAssets = path9__default.default.join(outputDir, "theme-assets");
797
+ try {
798
+ await fs8__default.default.access(themeAssetsDir);
799
+ await fs8__default.default.cp(themeAssetsDir, distThemeAssets, { recursive: true });
800
+ logger.info("Copied static assets to dist/theme-assets/");
801
+ } catch {
802
+ }
795
803
  await generateManifest(themeName, themePath, outputDir);
796
804
  await generateThemeData(themePath, outputDir, themeName);
797
805
  await generateThemeCSS(themePath, outputDir);
@@ -4338,20 +4346,27 @@ function createDevServer(options) {
4338
4346
  if (pathname.startsWith("/assets/")) {
4339
4347
  const subpath = pathname.replace(/^\/assets\//, "");
4340
4348
  const segments = subpath.split("/");
4349
+ const assetsBase = path9__default.default.join(options.themePath, "assets");
4341
4350
  let assetPath;
4342
4351
  if (segments[0] === options.themeName || segments[0] === options.themeName.replace(/^my-/, "")) {
4343
- assetPath = path9__default.default.join(
4344
- options.themePath,
4345
- "assets",
4346
- segments.slice(1).join("/")
4347
- );
4352
+ assetPath = path9__default.default.join(assetsBase, segments.slice(1).join("/"));
4348
4353
  } else {
4349
- assetPath = path9__default.default.join(options.themePath, "assets", subpath);
4354
+ assetPath = path9__default.default.join(assetsBase, subpath);
4350
4355
  }
4351
- if (assetPath.startsWith(path9__default.default.join(options.themePath, "assets")) && fs3__default.default.existsSync(assetPath)) {
4356
+ if (assetPath.startsWith(assetsBase) && fs3__default.default.existsSync(assetPath)) {
4352
4357
  serveFile(res, assetPath);
4353
4358
  return;
4354
4359
  }
4360
+ if (segments.length > 1) {
4361
+ const fallbackPath = path9__default.default.join(
4362
+ assetsBase,
4363
+ segments.slice(1).join("/")
4364
+ );
4365
+ if (fallbackPath.startsWith(assetsBase) && fs3__default.default.existsSync(fallbackPath)) {
4366
+ serveFile(res, fallbackPath);
4367
+ return;
4368
+ }
4369
+ }
4355
4370
  }
4356
4371
  const filePath = path9__default.default.join(options.distDir, pathname);
4357
4372
  if (!filePath.startsWith(options.distDir)) {