@lukoweb/apitogo 0.1.55 → 0.1.57

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.
@@ -1,6 +1,8 @@
1
+ import { createRequire } from "node:module";
1
2
  import path from "node:path";
2
3
  import { normalizeTheme, type ThemeRegistration } from "shiki";
3
4
  import type { Plugin } from "vite";
5
+ import type { ConfigWithMeta } from "../config/loader.js";
4
6
  import { getCurrentConfig } from "../config/loader.js";
5
7
  import type {
6
8
  FontConfig,
@@ -200,6 +202,44 @@ const processFonts = async (themeConfig: ZudokuConfig["theme"]) => {
200
202
  return { imports, families };
201
203
  };
202
204
 
205
+ const MODULE_SOURCE_PACKAGES = [
206
+ "@lukoweb/apitogo-module-landing",
207
+ "@lukoweb/apitogo-module-user-panel",
208
+ ];
209
+
210
+ /**
211
+ * Directories of module packages (landing, user panel) that use Tailwind
212
+ * utility classes. They live outside the Tailwind `source("..")` root set in
213
+ * main.css, so they must be added as explicit `@source` scan paths — otherwise
214
+ * their arbitrary-value utilities (e.g. the landing hero grid template and
215
+ * terminal card colors) are missing from the generated CSS.
216
+ */
217
+ const resolveModuleSourceDirs = (config: ConfigWithMeta): string[] => {
218
+ if (config.__meta.mode === "internal") {
219
+ return MODULE_SOURCE_PACKAGES.map((pkg) =>
220
+ path.join(
221
+ config.__meta.moduleDir,
222
+ "..",
223
+ pkg.replace("@lukoweb/apitogo-", ""),
224
+ "src",
225
+ ),
226
+ );
227
+ }
228
+
229
+ const require = createRequire(
230
+ path.join(config.__meta.rootDir, "package.json"),
231
+ );
232
+ const dirs: string[] = [];
233
+ for (const pkg of MODULE_SOURCE_PACKAGES) {
234
+ try {
235
+ dirs.push(path.dirname(require.resolve(pkg)));
236
+ } catch {
237
+ // Module package not installed — nothing to scan.
238
+ }
239
+ }
240
+ return dirs;
241
+ };
242
+
203
243
  export const virtualModuleId = "virtual:zudoku-theme.css";
204
244
  export const resolvedVirtualModuleId = `\0${virtualModuleId}`;
205
245
 
@@ -348,6 +388,7 @@ export const viteThemePlugin = (): Plugin => {
348
388
  config.__meta.rootDir,
349
389
  ...config.__meta.dependencies,
350
390
  ...(config.__pluginDirs ?? []),
391
+ ...resolveModuleSourceDirs(config),
351
392
  ].map((file) => path.relative(path.dirname(id), file)),
352
393
  );
353
394