orizu 0.5.34 → 0.5.35
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.
|
@@ -64,7 +64,12 @@ export declare function runLocalAppPreview(options: AppPreviewOptions): Promise<
|
|
|
64
64
|
* an actionable message instead. Exported for tests.
|
|
65
65
|
*/
|
|
66
66
|
export declare function findMissingPreviewRuntimeDeps(nodeModuleDirs: string[]): string[];
|
|
67
|
-
|
|
67
|
+
declare function loadPreviewCssModules(): Promise<{
|
|
68
|
+
postcss: typeof import("postcss").default;
|
|
69
|
+
tailwind: import("postcss/lib/postcss").PluginCreator<import("@tailwindcss/postcss").PluginOptions>;
|
|
70
|
+
}>;
|
|
71
|
+
/** `loadModules` is for tests: one that fails stands in for a broken install. */
|
|
72
|
+
export declare function buildPreviewCss(repoRoot: string | null, appPath: string, loadModules?: typeof loadPreviewCssModules): Promise<string>;
|
|
68
73
|
export declare function getPreviewSnapshotModulePaths(): string[];
|
|
69
74
|
export {};
|
|
70
75
|
//# sourceMappingURL=preview-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview-runtime.d.ts","sourceRoot":"","sources":["../src/preview-runtime.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gCAAgC,IAAI,CAAA;AAGjD,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CA+C5D,CAAA;AAGD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,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F;AACjF,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAE,OAAO,qBAA6C,mBA+BhJ;AAyWD,wBAAgB,6BAA6B,IAAI,MAAM,EAAE,CAExD"}
|
package/dist/preview-runtime.js
CHANGED
|
@@ -130,7 +130,6 @@ export async function runLocalAppPreview(options) {
|
|
|
130
130
|
const cssPath = join(tempDir, 'preview.css');
|
|
131
131
|
const htmlPath = join(tempDir, 'index.html');
|
|
132
132
|
const outDir = join(tempDir, 'dist');
|
|
133
|
-
writeFileSync(cssPath, await buildPreviewCss(repoRoot, appPath), 'utf8');
|
|
134
133
|
writeFileSync(entryPath, buildEntrySource(appPath, options.sampleRow), 'utf8');
|
|
135
134
|
writeFileSync(htmlPath, buildPreviewHtml(), 'utf8');
|
|
136
135
|
let server = null;
|
|
@@ -149,6 +148,8 @@ export async function runLocalAppPreview(options) {
|
|
|
149
148
|
'(run inside a project that has them, `npm install react react-dom` next to your app, ' +
|
|
150
149
|
'or run from an Orizu checkout after `bun install`).');
|
|
151
150
|
}
|
|
151
|
+
// After the dependency checks, so their actionable errors come before a Tailwind warning.
|
|
152
|
+
writeFileSync(cssPath, await buildPreviewCss(repoRoot, appPath), 'utf8');
|
|
152
153
|
await esbuild.build({
|
|
153
154
|
entryPoints: [entryPath],
|
|
154
155
|
bundle: true,
|
|
@@ -550,11 +551,15 @@ function buildPreviewHtml() {
|
|
|
550
551
|
</html>
|
|
551
552
|
`;
|
|
552
553
|
}
|
|
553
|
-
|
|
554
|
+
const PREVIEW_TAILWIND_FALLBACK_WARNING = 'Tailwind CSS could not be built; the preview uses fallback styles';
|
|
555
|
+
async function loadPreviewCssModules() {
|
|
556
|
+
return { postcss: (await import('postcss')).default, tailwind: (await import('@tailwindcss/postcss')).default };
|
|
557
|
+
}
|
|
558
|
+
/** `loadModules` is for tests: one that fails stands in for a broken install. */
|
|
559
|
+
export async function buildPreviewCss(repoRoot, appPath, loadModules = loadPreviewCssModules) {
|
|
554
560
|
const fallbackCss = buildPreviewChromeCss();
|
|
555
561
|
try {
|
|
556
|
-
const postcss =
|
|
557
|
-
const tailwind = (await import('@tailwindcss/postcss')).default;
|
|
562
|
+
const { postcss, tailwind } = await loadModules();
|
|
558
563
|
const cliPackageRoot = findCliPackageRoot();
|
|
559
564
|
const globalsPath = repoRoot
|
|
560
565
|
? join(repoRoot, 'app', 'globals.css')
|
|
@@ -576,7 +581,10 @@ export async function buildPreviewCss(repoRoot, appPath) {
|
|
|
576
581
|
const result = await postcss([tailwind()]).process(sourceCss, { from: globalsPath });
|
|
577
582
|
return result.css;
|
|
578
583
|
}
|
|
579
|
-
catch {
|
|
584
|
+
catch (error) {
|
|
585
|
+
// Without Tailwind the screenshot loses the app's utility styling, so say so
|
|
586
|
+
// instead of looking right (ORI-2261: the sandbox tools check fails on it).
|
|
587
|
+
process.stderr.write(`warning: ${PREVIEW_TAILWIND_FALLBACK_WARNING} (${error instanceof Error ? error.message : String(error)})\n`);
|
|
580
588
|
return fallbackCss;
|
|
581
589
|
}
|
|
582
590
|
}
|
package/package.json
CHANGED
package/src/preview-runtime.ts
CHANGED
|
@@ -193,7 +193,6 @@ export async function runLocalAppPreview(options: AppPreviewOptions): Promise<Ap
|
|
|
193
193
|
const htmlPath = join(tempDir, 'index.html')
|
|
194
194
|
const outDir = join(tempDir, 'dist')
|
|
195
195
|
|
|
196
|
-
writeFileSync(cssPath, await buildPreviewCss(repoRoot, appPath), 'utf8')
|
|
197
196
|
writeFileSync(entryPath, buildEntrySource(appPath, options.sampleRow), 'utf8')
|
|
198
197
|
writeFileSync(htmlPath, buildPreviewHtml(), 'utf8')
|
|
199
198
|
|
|
@@ -219,6 +218,8 @@ export async function runLocalAppPreview(options: AppPreviewOptions): Promise<Ap
|
|
|
219
218
|
)
|
|
220
219
|
}
|
|
221
220
|
|
|
221
|
+
// After the dependency checks, so their actionable errors come before a Tailwind warning.
|
|
222
|
+
writeFileSync(cssPath, await buildPreviewCss(repoRoot, appPath), 'utf8')
|
|
222
223
|
await esbuild.build({
|
|
223
224
|
entryPoints: [entryPath],
|
|
224
225
|
bundle: true,
|
|
@@ -656,12 +657,18 @@ function buildPreviewHtml() {
|
|
|
656
657
|
`
|
|
657
658
|
}
|
|
658
659
|
|
|
659
|
-
|
|
660
|
+
const PREVIEW_TAILWIND_FALLBACK_WARNING = 'Tailwind CSS could not be built; the preview uses fallback styles'
|
|
661
|
+
|
|
662
|
+
async function loadPreviewCssModules() {
|
|
663
|
+
return { postcss: (await import('postcss')).default, tailwind: (await import('@tailwindcss/postcss')).default }
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
/** `loadModules` is for tests: one that fails stands in for a broken install. */
|
|
667
|
+
export async function buildPreviewCss(repoRoot: string | null, appPath: string, loadModules: typeof loadPreviewCssModules = loadPreviewCssModules) {
|
|
660
668
|
const fallbackCss = buildPreviewChromeCss()
|
|
661
669
|
|
|
662
670
|
try {
|
|
663
|
-
const postcss =
|
|
664
|
-
const tailwind = (await import('@tailwindcss/postcss')).default
|
|
671
|
+
const { postcss, tailwind } = await loadModules()
|
|
665
672
|
const cliPackageRoot = findCliPackageRoot()
|
|
666
673
|
const globalsPath = repoRoot
|
|
667
674
|
? join(repoRoot, 'app', 'globals.css')
|
|
@@ -682,7 +689,10 @@ export async function buildPreviewCss(repoRoot: string | null, appPath: string)
|
|
|
682
689
|
].join('\n')
|
|
683
690
|
const result = await postcss([tailwind()]).process(sourceCss, { from: globalsPath })
|
|
684
691
|
return result.css
|
|
685
|
-
} catch {
|
|
692
|
+
} catch (error) {
|
|
693
|
+
// Without Tailwind the screenshot loses the app's utility styling, so say so
|
|
694
|
+
// instead of looking right (ORI-2261: the sandbox tools check fails on it).
|
|
695
|
+
process.stderr.write(`warning: ${PREVIEW_TAILWIND_FALLBACK_WARNING} (${error instanceof Error ? error.message : String(error)})\n`)
|
|
686
696
|
return fallbackCss
|
|
687
697
|
}
|
|
688
698
|
}
|
|
@@ -1580,7 +1580,16 @@ orizu apps preview \
|
|
|
1580
1580
|
|
|
1581
1581
|
The command validates the same app contract and allowed import registry as upload, validates the sample row against `input.json`, serves a temporary static preview page, passes `inputData`, `initialValues`, and `onComplete`, then uses Playwright to render it. Add `--headed` for visible Chromium review, and `--keep-open` when you want to inspect the local page manually. In the Orizu web checkout, preview uses the live component tree and global Tailwind CSS; in the mirrored/published CLI package, it uses the bundled preview runtime snapshot so the workflow remains available without the site source tree.
|
|
1582
1582
|
|
|
1583
|
-
|
|
1583
|
+
In a hosted session, the sandbox already has the preview tooling and a headless Chromium. Run `orizu apps preview` with `--screenshot` as shown above; `--headed` and `--keep-open` are for local use and do not work in a sandbox. Do not `npm install` anything for it, including `react` or `react-dom`. If preview still fails there, run the plain-`node` smoke test (`scripts/test-app.mjs`) to check the app contract, then file the preview failure:
|
|
1584
|
+
|
|
1585
|
+
```bash
|
|
1586
|
+
orizu feedback --category bug --severity major \
|
|
1587
|
+
--summary "orizu apps preview fails in the hosted sandbox" \
|
|
1588
|
+
--tried "<the orizu apps preview command you ran>" \
|
|
1589
|
+
--actual "<the error it printed, without customer content>"
|
|
1590
|
+
```
|
|
1591
|
+
|
|
1592
|
+
Locally, the published CLI does not install the preview tooling (`esbuild`, `react`, `react-dom`, `@playwright/test`, Tailwind): run preview inside a project that provides them or from an Orizu checkout. When they are missing the command exits with an actionable error; the plain-`node` smoke test (`scripts/test-app.mjs`) still works everywhere in the meantime.
|
|
1584
1593
|
|
|
1585
1594
|
For coding agents: do not treat a passing contract check as enough. After generating or editing an app, run `orizu apps preview` with a representative row, inspect the screenshot, and compare the rendered workflow to the user's likely intent: are the right fields visible, is the primary judgment obvious, do controls fit, and would a human reviewer know what to do? If the screenshot looks wrong, revise the app and preview again before publishing.
|
|
1586
1595
|
|