@amerged/ohmyhost-cli 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.
- package/README.md +1 -1
- package/dist/bin.js +1 -1
- package/dist/{chunk-EPW2O2ZL.js → chunk-3RDHFA76.js} +12 -7
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/apps/product-cli/package.json +1 -1
- package/src/packages/contracts/src/framework-admission-corpus.ts +97 -0
- package/src/packages/contracts/src/framework-admission.ts +2 -2
- package/src/packages/contracts/src/framework-source-rules.ts +22 -5
- package/src/packages/sdk-ts/package.json +1 -1
package/README.md
CHANGED
package/dist/bin.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createRequire as __ohmyhostCreateRequire } from "node:module"; const require = __ohmyhostCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
runProductionCli
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3RDHFA76.js";
|
|
6
6
|
import "./chunk-7D2RFLWM.js";
|
|
7
7
|
|
|
8
8
|
// apps/product-cli/dist/bin.js
|
|
@@ -34783,9 +34783,9 @@ var FRAMEWORK_CONVERSION_DETAILS = Object.freeze({
|
|
|
34783
34783
|
paths: ["framework_config"],
|
|
34784
34784
|
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}`
|
|
34785
34785
|
},
|
|
34786
|
-
|
|
34786
|
+
next_tailwind_turbopack_only: {
|
|
34787
34787
|
paths: ["framework_config"],
|
|
34788
|
-
template: `"{{path}}"
|
|
34788
|
+
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}`
|
|
34789
34789
|
},
|
|
34790
34790
|
framework_version_unsupported: {
|
|
34791
34791
|
paths: ["manifest", "lockfile"],
|
|
@@ -40628,7 +40628,7 @@ function exact3(v, keys) {
|
|
|
40628
40628
|
// apps/product-cli/package.json
|
|
40629
40629
|
var package_default = {
|
|
40630
40630
|
name: "@ohmyhost/product-cli",
|
|
40631
|
-
version: "0.1.
|
|
40631
|
+
version: "0.1.33",
|
|
40632
40632
|
private: true,
|
|
40633
40633
|
ohmyhost: {
|
|
40634
40634
|
deployment: "production",
|
|
@@ -47191,6 +47191,8 @@ var BUILD_OUTPUTS = Object.freeze({
|
|
|
47191
47191
|
"tanstack-start": "dist/client"
|
|
47192
47192
|
});
|
|
47193
47193
|
var REQUIRED_CONFIG_PATHS = Object.freeze({ nextjs: "next.config.ts", "tanstack-start": "vite.config.ts" });
|
|
47194
|
+
var POSTCSS_CONFIG_PATH = /^(?:postcss\.config\.(?:[cm]?js|json)|\.postcssrc\.(?:js|json))$/u;
|
|
47195
|
+
var TAILWIND_TURBOPACK_LOADER = "@tailwindcss/turbopack";
|
|
47194
47196
|
var MAXIMUM_LOCKFILE_LENGTH = 5 * 1024 * 1024;
|
|
47195
47197
|
var MAXIMUM_PNPM_LOCKFILE_HEAD = 256 * 1024;
|
|
47196
47198
|
var PNPM_LOCKFILE_BODY = /^(?:packages|snapshots):/mu;
|
|
@@ -47327,7 +47329,7 @@ function repositorySourceFindings(files) {
|
|
|
47327
47329
|
versions: result.versions
|
|
47328
47330
|
});
|
|
47329
47331
|
}
|
|
47330
|
-
function nextConfigFindings(text, path2) {
|
|
47332
|
+
function nextConfigFindings(text, path2, postcss) {
|
|
47331
47333
|
const lexed = lexFrameworkConfig(text, path2);
|
|
47332
47334
|
if ("finding" in lexed)
|
|
47333
47335
|
return Object.freeze([lexed.finding]);
|
|
@@ -47337,8 +47339,8 @@ function nextConfigFindings(text, path2) {
|
|
|
47337
47339
|
findings.push(diagnostic({ code: "next_base_path_unsupported", path: path2 }));
|
|
47338
47340
|
if (hasProperty(tokens, "output", "export") || hasProperty(tokens, "output", "standalone"))
|
|
47339
47341
|
findings.push(diagnostic({ code: "next_output_unsupported", path: path2 }));
|
|
47340
|
-
if (
|
|
47341
|
-
findings.push(diagnostic({ code: "
|
|
47342
|
+
if (!postcss && tokens.some(({ kind, value }) => kind === "string" && value === TAILWIND_TURBOPACK_LOADER))
|
|
47343
|
+
findings.push(diagnostic({ code: "next_tailwind_turbopack_only", path: path2 }));
|
|
47342
47344
|
if (!hasExportDefault(tokens) && !(path2.slice(path2.lastIndexOf("/") + 1) === "next.config.js" && hasModuleExports(tokens)))
|
|
47343
47345
|
findings.push(diagnostic({ code: "framework_config_default_export_required", path: path2 }));
|
|
47344
47346
|
return Object.freeze(findings);
|
|
@@ -47509,12 +47511,15 @@ function frameworkConfigFindings(input) {
|
|
|
47509
47511
|
return [];
|
|
47510
47512
|
const { path: path2, text } = frameworkConfig;
|
|
47511
47513
|
if (framework === "nextjs")
|
|
47512
|
-
return nextConfigFindings(text, path2);
|
|
47514
|
+
return nextConfigFindings(text, path2, hasPostcssConfiguration(input));
|
|
47513
47515
|
if (framework === "vite-static")
|
|
47514
47516
|
return viteConfigFindings(text, path2);
|
|
47515
47517
|
const mode = input.configuration.runtime.mode;
|
|
47516
47518
|
return tanStackViteConfigFindings(text, path2, mode === "edge" || mode === "static" ? mode : null);
|
|
47517
47519
|
}
|
|
47520
|
+
function hasPostcssConfiguration({ files, manifest: manifest2 }) {
|
|
47521
|
+
return isRecord4(ownValue(manifest2, "postcss")) || files.some((path2) => POSTCSS_CONFIG_PATH.test(path2));
|
|
47522
|
+
}
|
|
47518
47523
|
function repositoryConfiguration(text) {
|
|
47519
47524
|
if (typeof text !== "string")
|
|
47520
47525
|
return null;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -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
|
-
|
|
376
|
+
next_tailwind_turbopack_only: {
|
|
377
377
|
paths: ["framework_config"],
|
|
378
|
-
template: `"{{path}}"
|
|
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,
|
|
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 (
|
|
346
|
-
|
|
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 {
|