@amerged/ohmyhost-mcp 0.1.32 → 0.1.33

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.
@@ -48,6 +48,47 @@ const CORPUS_NEXT_PAGE = `export default function Home() {
48
48
  return <main>Hello from ohmyho.st</main>;
49
49
  }
50
50
  `;
51
+ // The config `create-next-app@16.4.0 --yes --no-tailwind` writes: Cache Components with partial
52
+ // prefetching.
53
+ const CREATE_NEXT_APP_CONFIG = `import type { NextConfig } from "next";
54
+
55
+ const nextConfig: NextConfig = {
56
+ /* config options here */
57
+ cacheComponents: true,
58
+ partialPrefetching: true,
59
+ };
60
+
61
+ export default nextConfig;
62
+ `;
63
+ // With Tailwind CSS, which --yes selects, create-next-app on its default Turbopack bundler adds this
64
+ // rule instead of a postcss.config.mjs; the Webpack build ignores turbopack.rules.
65
+ const CREATE_NEXT_APP_TAILWIND_RULE = ` turbopack: {
66
+ rules: {
67
+ "*.css": {
68
+ loaders: ["@tailwindcss/turbopack"],
69
+ as: "*.css",
70
+ },
71
+ },
72
+ },
73
+ `;
74
+ const CREATE_NEXT_APP_POSTCSS_CONFIG = `const config = {
75
+ plugins: {
76
+ "@tailwindcss/postcss": {},
77
+ },
78
+ };
79
+
80
+ export default config;
81
+ `;
82
+ const CREATE_NEXT_APP_LAYOUT = `import "./globals.css";
83
+
84
+ export default function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
85
+ return (
86
+ <html lang="en">
87
+ <body>{children}</body>
88
+ </html>
89
+ );
90
+ }
91
+ `;
51
92
  const CORPUS_TANSTACK_CONFIG = `import { tanstackStart } from "@tanstack/react-start/plugin/vite";
52
93
  import viteReact from "@vitejs/plugin-react";
53
94
  import { defineConfig } from "vite";
@@ -93,6 +134,14 @@ export const FRAMEWORK_ADMISSION_CONFORMANCE_CORPUS: Readonly<{
93
134
  viteSource({ declared: "^8.2.0", resolved: "8.3.4" }),
94
135
  ),
95
136
  corpusCase("TanStack Start 1.168.60 prerendered for the static runtime", tanStackSource()),
137
+ corpusCase(
138
+ "create-next-app 16.4 --yes --no-tailwind: Cache Components with partial prefetching",
139
+ createNextAppSource({ tailwind: false }),
140
+ ),
141
+ corpusCase(
142
+ "create-next-app 16.4 --yes with a postcss.config.mjs added beside its Turbopack rule",
143
+ createNextAppSource({ tailwind: true, postcss: true }),
144
+ ),
96
145
  ]),
97
146
  pending: Object.freeze([
98
147
  Object.freeze({
@@ -148,6 +197,11 @@ export const FRAMEWORK_ADMISSION_CONFORMANCE_CORPUS: Readonly<{
148
197
  }),
149
198
  { code: "next_base_path_unsupported", path: "next.config.ts" },
150
199
  ),
200
+ refusedCase(
201
+ "create-next-app 16.4 --yes: Tailwind CSS only in a Turbopack rule",
202
+ createNextAppSource({ tailwind: true }),
203
+ { code: "next_tailwind_turbopack_only", path: "next.config.ts" },
204
+ ),
151
205
  refusedCase(
152
206
  "Next.js build script with a second step",
153
207
  nextSource({ build: "next build && next-sitemap" }),
@@ -325,6 +379,49 @@ function nextSource(
325
379
  });
326
380
  }
327
381
 
382
+ /**
383
+ * The next.config.ts and Tailwind CSS files and packages `create-next-app@16.4.0 --yes` writes, in
384
+ * an App Router source with the packageManager, lockfile and ohmyhost.yaml ohmyho.st requires;
385
+ * `tailwind: false` is its --no-tailwind output. On Turbopack, its default bundler, it adds only the
386
+ * Turbopack rule for Tailwind CSS; `postcss` adds the postcss.config.mjs and @tailwindcss/postcss it
387
+ * writes for any other bundler.
388
+ */
389
+ function createNextAppSource(
390
+ options: Readonly<{ tailwind: boolean; postcss?: boolean }>,
391
+ ): Readonly<Record<string, string>> {
392
+ const [packageManager, lockfile] = CORPUS_MANAGERS.npm;
393
+ const runtime = { next: "16.4.0", react: "19.3.0", "react-dom": "19.3.0" };
394
+ const postcss = options.postcss === true;
395
+ return Object.freeze({
396
+ "ohmyhost.yaml": corpusConfiguration("npm", ".open-next/assets", "edge"),
397
+ "package.json": corpusJson({
398
+ name: "website",
399
+ version: "0.1.0",
400
+ private: true,
401
+ packageManager,
402
+ scripts: { dev: "next dev", build: "next build", start: "next start" },
403
+ dependencies: runtime,
404
+ ...(options.tailwind
405
+ ? {
406
+ devDependencies: {
407
+ ...(postcss ? { "@tailwindcss/postcss": "^4" } : {}),
408
+ "@tailwindcss/turbopack": "^4",
409
+ tailwindcss: "^4",
410
+ },
411
+ }
412
+ : {}),
413
+ }),
414
+ [lockfile]: corpusLockfile("npm", runtime, runtime),
415
+ "next.config.ts": options.tailwind
416
+ ? CREATE_NEXT_APP_CONFIG.replace("};\n", `${CREATE_NEXT_APP_TAILWIND_RULE}};\n`)
417
+ : CREATE_NEXT_APP_CONFIG,
418
+ ...(postcss ? { "postcss.config.mjs": CREATE_NEXT_APP_POSTCSS_CONFIG } : {}),
419
+ "app/globals.css": options.tailwind ? '@import "tailwindcss";\n' : "body {\n margin: 0;\n}\n",
420
+ "app/layout.tsx": CREATE_NEXT_APP_LAYOUT,
421
+ "app/page.tsx": CORPUS_NEXT_PAGE,
422
+ });
423
+ }
424
+
328
425
  function viteSource(
329
426
  options: Readonly<{ declared?: string; resolved?: string; config?: string }> = {},
330
427
  ): Readonly<Record<string, string>> {
@@ -373,9 +373,9 @@ const FRAMEWORK_CONVERSION_DETAILS = Object.freeze({
373
373
  paths: ["framework_config"],
374
374
  template: `"{{path}}" does not follow the TanStack Start plugin contract: import tanstackStart from "@tanstack/react-start/plugin/vite"; on runtime edge also import cloudflare from "@cloudflare/vite-plugin" and call cloudflare({ viteEnvironment: { name: "ssr" } }) before tanstackStart(); on runtime static do not import the Cloudflare plugin. ${PUSH_AND_PLAN}`,
375
375
  },
376
- next_cache_components_unsupported: {
376
+ next_tailwind_turbopack_only: {
377
377
  paths: ["framework_config"],
378
- template: `"{{path}}" sets cacheComponents: true, which ohmyho.st does not support; remove it or set it to false. ${PUSH_AND_PLAN}`,
378
+ template: `"{{path}}" loads Tailwind CSS through the Turbopack rule "@tailwindcss/turbopack", which the Webpack build on ohmyho.st ignores, and the application root has no PostCSS configuration that Webpack reads, so the site would deploy without its Tailwind classes. Add postcss.config.mjs to the application root with export default { plugins: { "@tailwindcss/postcss": {} } } and remove the Turbopack rule. Use the package manager to add @tailwindcss/postcss to devDependencies at the same version as tailwindcss and to remove @tailwindcss/turbopack, so the lockfile records both. ${PUSH_AND_PLAN}`,
379
379
  },
380
380
  framework_version_unsupported: {
381
381
  paths: ["manifest", "lockfile"],
@@ -119,6 +119,10 @@ const BUILD_OUTPUTS: Readonly<Partial<Record<FrameworkSourceFramework, string>>>
119
119
  });
120
120
  const REQUIRED_CONFIG_PATHS: Readonly<Partial<Record<FrameworkSourceFramework, string>>> =
121
121
  Object.freeze({ nextjs: "next.config.ts", "tanstack-start": "vite.config.ts" });
122
+ // The PostCSS configuration the Next.js Webpack build reads: package.json "postcss" or one of these
123
+ // files at the application root. It never reads a TypeScript one such as postcss.config.ts.
124
+ const POSTCSS_CONFIG_PATH = /^(?:postcss\.config\.(?:[cm]?js|json)|\.postcssrc\.(?:js|json))$/u;
125
+ const TAILWIND_TURBOPACK_LOADER = "@tailwindcss/turbopack";
122
126
  const MAXIMUM_LOCKFILE_LENGTH = 5 * 1024 * 1024;
123
127
  const MAXIMUM_PNPM_LOCKFILE_HEAD = 256 * 1024;
124
128
  const PNPM_LOCKFILE_BODY = /^(?:packages|snapshots):/mu;
@@ -327,12 +331,15 @@ export function repositorySourceFindings(
327
331
 
328
332
  /**
329
333
  * The Next.js config rules: inspection size, comment and string syntax, the root origin
330
- * (basePath, assetPrefix), output, cacheComponents and the default export; next.config.js may
331
- * assign module.exports instead.
334
+ * (basePath, assetPrefix), output, the "@tailwindcss/turbopack" loader and the default export;
335
+ * next.config.js may assign module.exports instead. ohmyho.st builds with Webpack, which ignores
336
+ * Turbopack rules and applies Tailwind CSS only through PostCSS, so that loader is refused unless
337
+ * `postcss` reports a PostCSS configuration Webpack reads at the application root.
332
338
  */
333
339
  export function nextConfigFindings(
334
340
  text: string,
335
341
  path: string,
342
+ postcss: boolean,
336
343
  ): readonly FrameworkConversionDiagnostic[] {
337
344
  const lexed = lexFrameworkConfig(text, path);
338
345
  if ("finding" in lexed) return Object.freeze([lexed.finding]);
@@ -342,8 +349,11 @@ export function nextConfigFindings(
342
349
  findings.push(diagnostic({ code: "next_base_path_unsupported", path }));
343
350
  if (hasProperty(tokens, "output", "export") || hasProperty(tokens, "output", "standalone"))
344
351
  findings.push(diagnostic({ code: "next_output_unsupported", path }));
345
- if (hasProperty(tokens, "cacheComponents", "true"))
346
- findings.push(diagnostic({ code: "next_cache_components_unsupported", path }));
352
+ if (
353
+ !postcss &&
354
+ tokens.some(({ kind, value }) => kind === "string" && value === TAILWIND_TURBOPACK_LOADER)
355
+ )
356
+ findings.push(diagnostic({ code: "next_tailwind_turbopack_only", path }));
347
357
  if (
348
358
  !hasExportDefault(tokens) &&
349
359
  !(path.slice(path.lastIndexOf("/") + 1) === "next.config.js" && hasModuleExports(tokens))
@@ -619,12 +629,19 @@ function frameworkConfigFindings(
619
629
  const { frameworkConfig, framework } = input;
620
630
  if (frameworkConfig === null || framework === "functions") return [];
621
631
  const { path, text } = frameworkConfig;
622
- if (framework === "nextjs") return nextConfigFindings(text, path);
632
+ if (framework === "nextjs") return nextConfigFindings(text, path, hasPostcssConfiguration(input));
623
633
  if (framework === "vite-static") return viteConfigFindings(text, path);
624
634
  const mode = input.configuration.runtime.mode;
625
635
  return tanStackViteConfigFindings(text, path, mode === "edge" || mode === "static" ? mode : null);
626
636
  }
627
637
 
638
+ /** Whether package.json or a file at the application root configures PostCSS for Webpack. */
639
+ function hasPostcssConfiguration({ files, manifest }: FrameworkSourceRuleInput): boolean {
640
+ return (
641
+ isRecord(ownValue(manifest, "postcss")) || files.some((path) => POSTCSS_CONFIG_PATH.test(path))
642
+ );
643
+ }
644
+
628
645
  function repositoryConfiguration(text: string | null | undefined): OhmyhostConfig | null {
629
646
  if (typeof text !== "string") return null;
630
647
  try {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohmyhost/sdk-ts",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {