@sudajs/cli 0.12.4 → 0.13.0

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/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createHash } from 'crypto';
3
+ import { existsSync } from 'fs';
3
4
  import fs, { readFile, writeFile, stat, readdir, mkdir, copyFile, rm } from 'fs/promises';
4
5
  import { createRequire } from 'module';
5
6
  import path2 from 'path';
@@ -643,6 +644,24 @@ function createThemeEngineRuntimeAliasPlugin(root) {
643
644
  }
644
645
  };
645
646
  }
647
+ function createThemeEngineIconAliasPlugin(root) {
648
+ return {
649
+ name: "suda-theme-engine-icon-alias",
650
+ setup(build) {
651
+ const themeRequire = createRequire(path2.join(root, "package.json"));
652
+ const themeEngineEntry = themeRequire.resolve("@sudajs/theme-engine");
653
+ const entryDir = path2.dirname(themeEngineEntry);
654
+ const packageRoot2 = path2.basename(entryDir) === "dist" || path2.basename(entryDir) === "src" ? path2.dirname(entryDir) : entryDir;
655
+ const sourceEntry = path2.join(packageRoot2, "src", "icons", "lucide-icon.hydrate.client.tsx");
656
+ build.onResolve({ filter: /^@sudajs\/theme-engine\/icons$/ }, () => {
657
+ if (existsSync(sourceEntry)) {
658
+ return { path: sourceEntry };
659
+ }
660
+ return { path: themeRequire.resolve("@sudajs/theme-engine/icons") };
661
+ });
662
+ }
663
+ };
664
+ }
646
665
  function createThemeDependencyResolverPlugin(root) {
647
666
  return {
648
667
  name: "suda-theme-dependency-resolver",
@@ -1053,6 +1072,7 @@ async function buildClientRuntime(root, minify) {
1053
1072
  const hostReactShimPlugin = createHostReactShimPlugin();
1054
1073
  const hostPuckCoreShimPlugin = createHostPuckCoreShimPlugin();
1055
1074
  const themeEngineRuntimeAliasPlugin = createThemeEngineRuntimeAliasPlugin(root);
1075
+ const themeEngineIconAliasPlugin = createThemeEngineIconAliasPlugin(root);
1056
1076
  const themeDependencyResolverPlugin = createThemeDependencyResolverPlugin(root);
1057
1077
  await build({
1058
1078
  bundle: true,
@@ -1070,6 +1090,7 @@ async function buildClientRuntime(root, minify) {
1070
1090
  hostReactShimPlugin,
1071
1091
  hostPuckCoreShimPlugin,
1072
1092
  themeEngineRuntimeAliasPlugin,
1093
+ themeEngineIconAliasPlugin,
1073
1094
  themeDependencyResolverPlugin
1074
1095
  ],
1075
1096
  sourcemap: false,