orizu 0.5.53 → 0.5.54
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/app-commands.d.ts +2 -1
- package/dist/app-commands.d.ts.map +1 -1
- package/dist/app-commands.js +27 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/preview-runtime.d.ts +14 -3
- package/dist/preview-runtime.d.ts.map +1 -1
- package/dist/preview-runtime.js +13 -255
- package/dist/preview-workflow.d.ts +11 -0
- package/dist/preview-workflow.d.ts.map +1 -0
- package/dist/preview-workflow.js +260 -0
- package/package.json +1 -1
- package/src/app-commands.ts +30 -22
- package/src/index.ts +7 -1
- package/src/preview-runtime.ts +18 -280
- package/src/preview-workflow.ts +313 -0
package/dist/app-commands.d.ts
CHANGED
|
@@ -20,7 +20,8 @@ declare function readPromptSidecars(manifest: Record<string, unknown>, promptDir
|
|
|
20
20
|
declare function writeTextFileEnsuringDir(pathArg: string, content: string): void;
|
|
21
21
|
declare function readManifestFile(dirArg: string): Record<string, unknown>;
|
|
22
22
|
declare function createAppFromFile(): Promise<void>;
|
|
23
|
-
|
|
23
|
+
/** Resolves to the exit code of a stop (130 or 143), or undefined when the preview ended normally. */
|
|
24
|
+
declare function previewAppFromFile(): Promise<number | undefined>;
|
|
24
25
|
declare function updateAppFromFile(): Promise<void>;
|
|
25
26
|
declare function linkAppDataset(): Promise<void>;
|
|
26
27
|
declare function appDetail(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-commands.d.ts","sourceRoot":"","sources":["../src/app-commands.ts"],"names":[],"mappings":"AAuCA,iBAAe,QAAQ,kBActB;AAED,iBAAS,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAU/C;AAED,iBAAS,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUhD;AAED,iBAAS,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC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,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAK3G;AAED,iBAAe,eAAe,kBAmD7B;AAED,OAAO,EACL,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,eAAe,EACf,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,eAAe,GAChB,CAAA"}
|
package/dist/app-commands.js
CHANGED
|
@@ -13,7 +13,6 @@ import { inspectAppDestination } from './app-publish-paths.js';
|
|
|
13
13
|
import { authedFetch, getBaseUrl } from './http.js';
|
|
14
14
|
import { appPageUrl } from './app-page-url.js';
|
|
15
15
|
import { parseJsonResponse, sanitizeHumanInlineText, sanitizeTerminalText } from './json-response.js';
|
|
16
|
-
import { runLocalAppPreview } from './preview-runtime.js';
|
|
17
16
|
import { findWorkspaceRoot } from './workspace.js';
|
|
18
17
|
async function listApps() {
|
|
19
18
|
const project = getArg('--project') || await resolveProjectSlug(null);
|
|
@@ -289,6 +288,7 @@ async function createAppFromFile() {
|
|
|
289
288
|
throw new Error(`${getErrorMessage(error)}\nApp ID: ${appId}\nFolder: ${recoveryFolder}\nRetry: ${retryArgs.map(shellSingleQuote).join(' ')}`);
|
|
290
289
|
}
|
|
291
290
|
}
|
|
291
|
+
/** Resolves to the exit code of a stop (130 or 143), or undefined when the preview ended normally. */
|
|
292
292
|
async function previewAppFromFile() {
|
|
293
293
|
const filePath = getArg('--file');
|
|
294
294
|
const inputSchemaPath = getArg('--input-schema');
|
|
@@ -306,7 +306,29 @@ async function previewAppFromFile() {
|
|
|
306
306
|
const outputJsonSchema = readJsonFile(outputSchemaPath);
|
|
307
307
|
const sampleRow = readJsonFile(sampleRowPath);
|
|
308
308
|
const expandedScreenshotPath = screenshotPath ? expandHomePath(screenshotPath) : undefined;
|
|
309
|
-
const
|
|
309
|
+
const printRendered = (result) => {
|
|
310
|
+
if (hasJsonFlag()) {
|
|
311
|
+
printJson({
|
|
312
|
+
url: result.url,
|
|
313
|
+
screenshotPath: result.screenshotPath || null,
|
|
314
|
+
warnings: result.warnings,
|
|
315
|
+
});
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
printLine(`Preview rendered: ${formatTerminalLink(result.url)}`);
|
|
319
|
+
if (result.screenshotPath) {
|
|
320
|
+
printLine(`Screenshot: ${sanitizeTerminalText(result.screenshotPath)}`);
|
|
321
|
+
}
|
|
322
|
+
if (headed || keepOpen) {
|
|
323
|
+
printLine('Headed preview is running. Close Chromium or stop the command when you are done.');
|
|
324
|
+
}
|
|
325
|
+
if (result.warnings.length > 0) {
|
|
326
|
+
printLine(`Warnings: ${sanitizeTerminalText(result.warnings.join('; '))}`);
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
const { runPreviewCommand } = await import('./preview-workflow.js');
|
|
330
|
+
// Printed once the page is ready, so a keep-open preview says so while it is open.
|
|
331
|
+
const outcome = await runPreviewCommand({
|
|
310
332
|
filePath: expandedFilePath,
|
|
311
333
|
inputSchema: inputJsonSchema,
|
|
312
334
|
outputSchema: outputJsonSchema,
|
|
@@ -315,25 +337,10 @@ async function previewAppFromFile() {
|
|
|
315
337
|
componentName: component,
|
|
316
338
|
headed,
|
|
317
339
|
keepOpen,
|
|
340
|
+
onRendered: printRendered,
|
|
318
341
|
});
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
url: result.url,
|
|
322
|
-
screenshotPath: result.screenshotPath || null,
|
|
323
|
-
warnings: result.warnings,
|
|
324
|
-
});
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
printLine(`Preview rendered: ${formatTerminalLink(result.url)}`);
|
|
328
|
-
if (result.screenshotPath) {
|
|
329
|
-
printLine(`Screenshot: ${sanitizeTerminalText(result.screenshotPath)}`);
|
|
330
|
-
}
|
|
331
|
-
if (headed || keepOpen) {
|
|
332
|
-
printLine('Headed preview is running. Close Chromium or stop the command when you are done.');
|
|
333
|
-
}
|
|
334
|
-
if (result.warnings.length > 0) {
|
|
335
|
-
printLine(`Warnings: ${sanitizeTerminalText(result.warnings.join('; '))}`);
|
|
336
|
-
}
|
|
342
|
+
// A stop prints nothing more.
|
|
343
|
+
return 'interrupted' in outcome ? outcome.interrupted : undefined;
|
|
337
344
|
}
|
|
338
345
|
async function updateAppFromFile() {
|
|
339
346
|
const workspaceRoot = hostedWorkspaceRoot();
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAuLA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAEhE,eAAO,MAAM,wBAAwB,GAAI,iBAAiB,MAAM;;;EACJ,CAAA;AAE5D,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAmqCtD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CA0B1G;AAED,eAAO,MAAM,iBAAiB,SAAU,CAAA;AACxC,eAAO,MAAM,uBAAuB,QAAkB,CAAA;AACtD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAexH;AAmMD,wBAAsB,IAAI,CAAC,OAAO,WAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAuLA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAEhE,eAAO,MAAM,wBAAwB,GAAI,iBAAiB,MAAM;;;EACJ,CAAA;AAE5D,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAmqCtD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CA0B1G;AAED,eAAO,MAAM,iBAAiB,SAAU,CAAA;AACxC,eAAO,MAAM,uBAAuB,QAAkB,CAAA;AACtD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAexH;AAmMD,wBAAsB,IAAI,CAAC,OAAO,WAAwB,iBAuiBzD;AAuED,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAEhF,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1565,7 +1565,13 @@ export async function main(rawArgs = process.argv.slice(2)) {
|
|
|
1565
1565
|
return;
|
|
1566
1566
|
}
|
|
1567
1567
|
if (command === 'apps' && subcommand === 'preview') {
|
|
1568
|
-
await previewAppFromFile();
|
|
1568
|
+
const stopped = await previewAppFromFile();
|
|
1569
|
+
if (stopped !== undefined) {
|
|
1570
|
+
process.exitCode = stopped;
|
|
1571
|
+
// A Chromium launch can't be cancelled; one still starting holds the process
|
|
1572
|
+
// until it arrives and is closed. Exit anyway once the 10 s budget is spent.
|
|
1573
|
+
setTimeout(() => process.exit(stopped), 10_000).unref();
|
|
1574
|
+
}
|
|
1569
1575
|
return;
|
|
1570
1576
|
}
|
|
1571
1577
|
if (command === 'apps' && subcommand === 'update') {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Plugin } from 'esbuild';
|
|
1
2
|
export declare const PREVIEW_RUNTIME_REGISTRY_VERSION = 1;
|
|
2
3
|
export declare const PREVIEW_ALLOWED_IMPORTS: Record<string, string[]>;
|
|
3
4
|
export declare const PREVIEW_RUNTIME_GLOBALS: Record<string, string>;
|
|
@@ -14,6 +15,8 @@ export interface AppPreviewOptions {
|
|
|
14
15
|
forceSnapshot?: boolean;
|
|
15
16
|
playwright?: PreviewPlaywright;
|
|
16
17
|
chromiumExecutablePath?: string | null;
|
|
18
|
+
/** Called once the page is ready (and screenshotted), before a keep-open wait. */
|
|
19
|
+
onRendered?: (result: AppPreviewResult) => void;
|
|
17
20
|
}
|
|
18
21
|
export interface AppPreviewResult {
|
|
19
22
|
url: string;
|
|
@@ -24,19 +27,19 @@ interface Issue {
|
|
|
24
27
|
level: 'error' | 'warn';
|
|
25
28
|
message: string;
|
|
26
29
|
}
|
|
27
|
-
interface PreviewPlaywright {
|
|
30
|
+
export interface PreviewPlaywright {
|
|
28
31
|
chromium: {
|
|
29
32
|
launch: (options: Record<string, unknown>) => Promise<PreviewBrowser>;
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
|
-
interface PreviewBrowser {
|
|
35
|
+
export interface PreviewBrowser {
|
|
33
36
|
newPage: (options: Record<string, unknown>) => Promise<PreviewPage>;
|
|
34
37
|
close: () => Promise<void>;
|
|
35
38
|
once?: (event: string, listener: () => void) => unknown;
|
|
36
39
|
on?: (event: string, listener: () => void) => unknown;
|
|
37
40
|
off?: (event: string, listener: () => void) => unknown;
|
|
38
41
|
}
|
|
39
|
-
interface PreviewPage {
|
|
42
|
+
export interface PreviewPage {
|
|
40
43
|
goto: (url: string, options: Record<string, unknown>) => Promise<unknown>;
|
|
41
44
|
waitForSelector: (selector: string, options: Record<string, unknown>) => Promise<unknown>;
|
|
42
45
|
screenshot: (options: {
|
|
@@ -56,7 +59,10 @@ interface PreviewPage {
|
|
|
56
59
|
*/
|
|
57
60
|
export declare function stripComments(code: string): string;
|
|
58
61
|
export declare function validatePreviewInputs(options: AppPreviewOptions): Issue[];
|
|
62
|
+
/** Loads the preview workflow (and Effect) only when a preview runs. */
|
|
59
63
|
export declare function runLocalAppPreview(options: AppPreviewOptions): Promise<AppPreviewResult>;
|
|
64
|
+
export declare function findPreviewRepoRoot(cwd: string, appPath: string): string | null;
|
|
65
|
+
export declare function findCliPackageRoot(): string | null;
|
|
60
66
|
/**
|
|
61
67
|
* ALI-1071: react/react-dom are no longer dependencies of the PUBLISHED CLI
|
|
62
68
|
* (app-grade packages were moved to devDependencies), so a bare global install
|
|
@@ -65,12 +71,17 @@ export declare function runLocalAppPreview(options: AppPreviewOptions): Promise<
|
|
|
65
71
|
* an actionable message instead. Exported for tests.
|
|
66
72
|
*/
|
|
67
73
|
export declare function findMissingPreviewRuntimeDeps(nodeModuleDirs: string[]): string[];
|
|
74
|
+
export declare function findNodeModuleDirs(start: string): string[];
|
|
75
|
+
export declare function buildEntrySource(appPath: string, sampleRow: Record<string, unknown>): string;
|
|
76
|
+
export declare function buildRuntimeGlobalsSource(): string;
|
|
77
|
+
export declare function buildPreviewHtml(): string;
|
|
68
78
|
declare function loadPreviewCssModules(): Promise<{
|
|
69
79
|
postcss: typeof import("postcss").default;
|
|
70
80
|
tailwind: import("postcss/lib/postcss").PluginCreator<import("@tailwindcss/postcss").PluginOptions>;
|
|
71
81
|
}>;
|
|
72
82
|
/** `loadModules` is for tests: one that fails stands in for a broken install. */
|
|
73
83
|
export declare function buildPreviewCss(repoRoot: string | null, appPath: string, loadModules?: typeof loadPreviewCssModules): Promise<string>;
|
|
84
|
+
export declare function createPreviewSnapshotPlugin(): Plugin;
|
|
74
85
|
export declare function getPreviewSnapshotModulePaths(): string[];
|
|
75
86
|
export {};
|
|
76
87
|
//# sourceMappingURL=preview-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview-runtime.d.ts","sourceRoot":"","sources":["../src/preview-runtime.ts"],"names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,IAAI,MAAM,EAAE,CAExD"}
|
package/dist/preview-runtime.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { basename, dirname, isAbsolute, join, relative, resolve } from 'path';
|
|
5
|
-
import { fileURLToPath, pathToFileURL } from 'url';
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
|
+
import { dirname, join, resolve } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
6
4
|
export const PREVIEW_RUNTIME_REGISTRY_VERSION = 1;
|
|
7
5
|
// BEGIN_ORIZU_PREVIEW_IMPORT_REGISTRY
|
|
8
6
|
export const PREVIEW_ALLOWED_IMPORTS = {
|
|
@@ -59,9 +57,6 @@ export const PREVIEW_ALLOWED_IMPORTS = {
|
|
|
59
57
|
export const PREVIEW_RUNTIME_GLOBALS = {
|
|
60
58
|
React: 'react',
|
|
61
59
|
};
|
|
62
|
-
function isNodeError(error) {
|
|
63
|
-
return error instanceof Error;
|
|
64
|
-
}
|
|
65
60
|
const SUPPORTED_SCHEMA_KEYS = new Set(['type', 'required', 'properties', 'items', 'enum']);
|
|
66
61
|
/**
|
|
67
62
|
* Removes line and block comments, walking left to right so a `//` or `/*`
|
|
@@ -120,156 +115,10 @@ export function validatePreviewInputs(options) {
|
|
|
120
115
|
validatePayload(options.inputSchema, options.sampleRow, 'sample row', issues);
|
|
121
116
|
return issues;
|
|
122
117
|
}
|
|
118
|
+
/** Loads the preview workflow (and Effect) only when a preview runs. */
|
|
123
119
|
export async function runLocalAppPreview(options) {
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
if (errors.length > 0) {
|
|
127
|
-
throw new Error(errors.map(issue => issue.message).join('\n'));
|
|
128
|
-
}
|
|
129
|
-
const tempDir = mkdtempSync(join(tmpdir(), 'orizu-app-preview-'));
|
|
130
|
-
const appPath = realpathSync(options.filePath);
|
|
131
|
-
const repoRoot = options.forceSnapshot
|
|
132
|
-
? null
|
|
133
|
-
: findPreviewRepoRoot(options.cwd || process.cwd(), appPath);
|
|
134
|
-
const cliPackageRoot = findCliPackageRoot();
|
|
135
|
-
const entryPath = join(tempDir, 'entry.tsx');
|
|
136
|
-
const cssPath = join(tempDir, 'preview.css');
|
|
137
|
-
const htmlPath = join(tempDir, 'index.html');
|
|
138
|
-
const globalsPath = join(tempDir, 'runtime-globals.ts');
|
|
139
|
-
const outDir = join(tempDir, 'dist');
|
|
140
|
-
writeFileSync(entryPath, buildEntrySource(appPath, options.sampleRow), 'utf8');
|
|
141
|
-
writeFileSync(htmlPath, buildPreviewHtml(), 'utf8');
|
|
142
|
-
writeFileSync(globalsPath, buildRuntimeGlobalsSource(), 'utf8');
|
|
143
|
-
let server = null;
|
|
144
|
-
try {
|
|
145
|
-
const esbuild = await import('esbuild').catch(() => null);
|
|
146
|
-
if (!esbuild) {
|
|
147
|
-
throw new Error('Local preview requires esbuild. Install project dependencies with `bun install` or run from an Orizu checkout.');
|
|
148
|
-
}
|
|
149
|
-
const nodePaths = [
|
|
150
|
-
...(repoRoot ? [join(repoRoot, 'node_modules')] : []),
|
|
151
|
-
...(cliPackageRoot ? findNodeModuleDirs(cliPackageRoot) : []),
|
|
152
|
-
];
|
|
153
|
-
const missingRuntimeDeps = findMissingPreviewRuntimeDeps(nodePaths);
|
|
154
|
-
if (missingRuntimeDeps.length > 0) {
|
|
155
|
-
throw new Error(`Local preview requires ${missingRuntimeDeps.join(' and ')} to be installed nearby ` +
|
|
156
|
-
'(run inside a project that has them, `npm install react react-dom` next to your app, ' +
|
|
157
|
-
'or run from an Orizu checkout after `bun install`).');
|
|
158
|
-
}
|
|
159
|
-
// After the dependency checks, so their actionable errors come before a Tailwind warning.
|
|
160
|
-
writeFileSync(cssPath, await buildPreviewCss(repoRoot, appPath), 'utf8');
|
|
161
|
-
await esbuild.build({
|
|
162
|
-
entryPoints: [entryPath],
|
|
163
|
-
bundle: true,
|
|
164
|
-
outdir: outDir,
|
|
165
|
-
format: 'esm',
|
|
166
|
-
platform: 'browser',
|
|
167
|
-
target: 'es2020',
|
|
168
|
-
jsx: 'automatic',
|
|
169
|
-
jsxImportSource: 'react',
|
|
170
|
-
// Only replaces names the app uses without declaring or importing them.
|
|
171
|
-
inject: [globalsPath],
|
|
172
|
-
loader: {
|
|
173
|
-
'.css': 'css',
|
|
174
|
-
'.tsx': 'tsx',
|
|
175
|
-
'.ts': 'ts',
|
|
176
|
-
},
|
|
177
|
-
absWorkingDir: repoRoot || cliPackageRoot || process.cwd(),
|
|
178
|
-
nodePaths,
|
|
179
|
-
alias: repoRoot ? { '@': repoRoot } : undefined,
|
|
180
|
-
plugins: repoRoot ? undefined : [createPreviewSnapshotPlugin()],
|
|
181
|
-
logLevel: 'silent',
|
|
182
|
-
});
|
|
183
|
-
let url = pathToFileURL(htmlPath).href;
|
|
184
|
-
try {
|
|
185
|
-
server = await serveDirectory(tempDir);
|
|
186
|
-
url = `http://127.0.0.1:${server.port}/index.html`;
|
|
187
|
-
}
|
|
188
|
-
catch {
|
|
189
|
-
server = null;
|
|
190
|
-
}
|
|
191
|
-
const playwright = options.playwright || await loadPlaywright();
|
|
192
|
-
const chromiumExecutablePath = 'chromiumExecutablePath' in options
|
|
193
|
-
? options.chromiumExecutablePath
|
|
194
|
-
: resolveChromiumExecutablePath();
|
|
195
|
-
const browser = await playwright.chromium.launch({
|
|
196
|
-
headless: !options.headed,
|
|
197
|
-
...(chromiumExecutablePath ? { executablePath: chromiumExecutablePath } : {}),
|
|
198
|
-
});
|
|
199
|
-
let page = null;
|
|
200
|
-
let handleRenderError;
|
|
201
|
-
let hasFinishedKeepingOpen = false;
|
|
202
|
-
try {
|
|
203
|
-
page = await browser.newPage({ viewport: { width: 1440, height: 1000 } });
|
|
204
|
-
const renderError = new Promise((_, reject) => {
|
|
205
|
-
handleRenderError = error => reject(new Error(`App preview render failed: ${error.message}`));
|
|
206
|
-
page?.on?.('pageerror', handleRenderError);
|
|
207
|
-
});
|
|
208
|
-
// Listen before navigation: React can fail before the ready marker mounts.
|
|
209
|
-
await Promise.race([
|
|
210
|
-
page.goto(url, { waitUntil: 'networkidle' }).then(() => page.waitForSelector('[data-orizu-preview-ready="true"]', { timeout: 15_000 })),
|
|
211
|
-
renderError,
|
|
212
|
-
]);
|
|
213
|
-
if (options.screenshotPath) {
|
|
214
|
-
await page.screenshot({ path: options.screenshotPath, fullPage: true });
|
|
215
|
-
}
|
|
216
|
-
if (options.keepOpen) {
|
|
217
|
-
await waitForPreviewClose(page, browser);
|
|
218
|
-
hasFinishedKeepingOpen = true;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
finally {
|
|
222
|
-
if (handleRenderError)
|
|
223
|
-
page?.off?.('pageerror', handleRenderError);
|
|
224
|
-
if (!hasFinishedKeepingOpen) {
|
|
225
|
-
await browser.close();
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return {
|
|
229
|
-
url,
|
|
230
|
-
screenshotPath: options.screenshotPath,
|
|
231
|
-
warnings: issues.filter(issue => issue.level === 'warn').map(issue => issue.message),
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
finally {
|
|
235
|
-
await server?.close();
|
|
236
|
-
rmSync(tempDir, { recursive: true, force: true });
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
function waitForPreviewClose(page, browser) {
|
|
240
|
-
return new Promise(resolveClose => {
|
|
241
|
-
const cleanups = [];
|
|
242
|
-
let settled = false;
|
|
243
|
-
const done = () => {
|
|
244
|
-
if (settled)
|
|
245
|
-
return;
|
|
246
|
-
settled = true;
|
|
247
|
-
for (const cleanup of cleanups)
|
|
248
|
-
cleanup();
|
|
249
|
-
resolveClose();
|
|
250
|
-
};
|
|
251
|
-
const listen = (target, event) => {
|
|
252
|
-
if (typeof target.once === 'function') {
|
|
253
|
-
target.once(event, done);
|
|
254
|
-
return true;
|
|
255
|
-
}
|
|
256
|
-
if (typeof target.on === 'function') {
|
|
257
|
-
target.on(event, done);
|
|
258
|
-
if (typeof target.off === 'function') {
|
|
259
|
-
cleanups.push(() => target.off?.(event, done));
|
|
260
|
-
}
|
|
261
|
-
return true;
|
|
262
|
-
}
|
|
263
|
-
return false;
|
|
264
|
-
};
|
|
265
|
-
const listening = [
|
|
266
|
-
listen(page, 'close'),
|
|
267
|
-
listen(browser, 'disconnected'),
|
|
268
|
-
].some(Boolean);
|
|
269
|
-
if (!listening) {
|
|
270
|
-
page.waitForTimeout(24 * 60 * 60 * 1000).then(done, done);
|
|
271
|
-
}
|
|
272
|
-
});
|
|
120
|
+
const { runPreview } = await import('./preview-workflow.js');
|
|
121
|
+
return runPreview(options);
|
|
273
122
|
}
|
|
274
123
|
function validateImports(source, issues) {
|
|
275
124
|
const importRegex = /import\s+(?:(\w+)(?:\s*,\s*)?)?(?:\{([^}]+)\})?\s+from\s+['"`]([^'"`]+)['"`]/g;
|
|
@@ -456,7 +305,7 @@ function validatePayload(schema, payload, path, issues) {
|
|
|
456
305
|
issues.push({ level: 'error', message: `${path} must be a boolean.` });
|
|
457
306
|
}
|
|
458
307
|
}
|
|
459
|
-
function findPreviewRepoRoot(cwd, appPath) {
|
|
308
|
+
export function findPreviewRepoRoot(cwd, appPath) {
|
|
460
309
|
// ORI-1565 move: this detects local development inside the Orizu monorepo
|
|
461
310
|
// itself (to borrow its real Tailwind setup instead of the packaged
|
|
462
311
|
// snapshot CSS); components/, app/globals.css and lib/available-
|
|
@@ -483,7 +332,7 @@ function findPreviewRepoRoot(cwd, appPath) {
|
|
|
483
332
|
function fileURLPath() {
|
|
484
333
|
return fileURLToPath(new URL('.', import.meta.url));
|
|
485
334
|
}
|
|
486
|
-
function findCliPackageRoot() {
|
|
335
|
+
export function findCliPackageRoot() {
|
|
487
336
|
let current = resolve(dirname(fileURLPath()));
|
|
488
337
|
while (true) {
|
|
489
338
|
if (existsSync(join(current, 'package.json')) &&
|
|
@@ -507,7 +356,7 @@ function findCliPackageRoot() {
|
|
|
507
356
|
export function findMissingPreviewRuntimeDeps(nodeModuleDirs) {
|
|
508
357
|
return ['react', 'react-dom'].filter(name => !nodeModuleDirs.some(dir => existsSync(join(dir, name, 'package.json'))));
|
|
509
358
|
}
|
|
510
|
-
function findNodeModuleDirs(start) {
|
|
359
|
+
export function findNodeModuleDirs(start) {
|
|
511
360
|
const dirs = [];
|
|
512
361
|
let current = resolve(start);
|
|
513
362
|
while (true) {
|
|
@@ -522,7 +371,7 @@ function findNodeModuleDirs(start) {
|
|
|
522
371
|
}
|
|
523
372
|
return dirs;
|
|
524
373
|
}
|
|
525
|
-
function buildEntrySource(appPath, sampleRow) {
|
|
374
|
+
export function buildEntrySource(appPath, sampleRow) {
|
|
526
375
|
return `
|
|
527
376
|
import React from 'react'
|
|
528
377
|
import { createRoot } from 'react-dom/client'
|
|
@@ -558,12 +407,12 @@ function PreviewShell() {
|
|
|
558
407
|
root.render(React.createElement(PreviewShell))
|
|
559
408
|
`;
|
|
560
409
|
}
|
|
561
|
-
function buildRuntimeGlobalsSource() {
|
|
410
|
+
export function buildRuntimeGlobalsSource() {
|
|
562
411
|
return Object.entries(PREVIEW_RUNTIME_GLOBALS)
|
|
563
412
|
.map(([name, path]) => `import ${name} from ${JSON.stringify(path)}\nexport { ${name} }\n`)
|
|
564
413
|
.join('');
|
|
565
414
|
}
|
|
566
|
-
function buildPreviewHtml() {
|
|
415
|
+
export function buildPreviewHtml() {
|
|
567
416
|
return `<!doctype html>
|
|
568
417
|
<html lang="en">
|
|
569
418
|
<head>
|
|
@@ -676,7 +525,7 @@ function buildSnapshotTailwindCss() {
|
|
|
676
525
|
}
|
|
677
526
|
`;
|
|
678
527
|
}
|
|
679
|
-
function createPreviewSnapshotPlugin() {
|
|
528
|
+
export function createPreviewSnapshotPlugin() {
|
|
680
529
|
const modules = buildPreviewSnapshotModules();
|
|
681
530
|
return {
|
|
682
531
|
name: 'orizu-preview-runtime-snapshot',
|
|
@@ -981,94 +830,3 @@ export function ShortcutButton({ shortcut, shortcutLabel, children, className, d
|
|
|
981
830
|
export function getPreviewSnapshotModulePaths() {
|
|
982
831
|
return Object.keys(buildPreviewSnapshotModules()).sort();
|
|
983
832
|
}
|
|
984
|
-
async function serveDirectory(root) {
|
|
985
|
-
const server = createServer((request, response) => {
|
|
986
|
-
const url = new URL(request.url || '/', 'http://127.0.0.1');
|
|
987
|
-
const requestedPath = url.pathname === '/' ? '/index.html' : url.pathname;
|
|
988
|
-
const filePath = resolve(root, `.${requestedPath}`);
|
|
989
|
-
const relativePath = relative(root, filePath);
|
|
990
|
-
if (relativePath.startsWith('..') || isAbsolute(relativePath) || !existsSync(filePath)) {
|
|
991
|
-
response.statusCode = 404;
|
|
992
|
-
response.end('Not found');
|
|
993
|
-
return;
|
|
994
|
-
}
|
|
995
|
-
try {
|
|
996
|
-
if (!statSync(filePath).isFile()) {
|
|
997
|
-
response.statusCode = 404;
|
|
998
|
-
response.end('Not found');
|
|
999
|
-
return;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
catch {
|
|
1003
|
-
response.statusCode = 404;
|
|
1004
|
-
response.end('Not found');
|
|
1005
|
-
return;
|
|
1006
|
-
}
|
|
1007
|
-
const ext = basename(filePath).split('.').pop();
|
|
1008
|
-
const contentType = ext === 'html' ? 'text/html; charset=utf-8' :
|
|
1009
|
-
ext === 'js' ? 'text/javascript; charset=utf-8' :
|
|
1010
|
-
ext === 'css' ? 'text/css; charset=utf-8' :
|
|
1011
|
-
'application/octet-stream';
|
|
1012
|
-
response.setHeader('content-type', contentType);
|
|
1013
|
-
try {
|
|
1014
|
-
response.end(readFileSync(filePath));
|
|
1015
|
-
}
|
|
1016
|
-
catch {
|
|
1017
|
-
response.statusCode = 500;
|
|
1018
|
-
response.end('Internal server error');
|
|
1019
|
-
}
|
|
1020
|
-
});
|
|
1021
|
-
const port = await listenOnAvailablePort(server);
|
|
1022
|
-
const address = server.address();
|
|
1023
|
-
if (!address || typeof address === 'string') {
|
|
1024
|
-
throw new Error('Unable to start local preview server.');
|
|
1025
|
-
}
|
|
1026
|
-
return {
|
|
1027
|
-
port,
|
|
1028
|
-
close: () => new Promise(resolveClose => server.close(() => resolveClose())),
|
|
1029
|
-
};
|
|
1030
|
-
}
|
|
1031
|
-
async function listenOnAvailablePort(server) {
|
|
1032
|
-
const firstPort = 39000 + Math.floor(Math.random() * 1000);
|
|
1033
|
-
for (let offset = 0; offset < 20; offset += 1) {
|
|
1034
|
-
const port = firstPort + offset;
|
|
1035
|
-
try {
|
|
1036
|
-
await new Promise((resolveListen, reject) => {
|
|
1037
|
-
server.once('error', reject);
|
|
1038
|
-
server.listen(port, '127.0.0.1', () => {
|
|
1039
|
-
server.off('error', reject);
|
|
1040
|
-
resolveListen();
|
|
1041
|
-
});
|
|
1042
|
-
});
|
|
1043
|
-
return port;
|
|
1044
|
-
}
|
|
1045
|
-
catch (error) {
|
|
1046
|
-
server.removeAllListeners('error');
|
|
1047
|
-
if (!isNodeError(error) || error.code !== 'EADDRINUSE')
|
|
1048
|
-
throw error;
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
throw new Error('Unable to find an available localhost port for app preview.');
|
|
1052
|
-
}
|
|
1053
|
-
async function loadPlaywright() {
|
|
1054
|
-
const fromTest = await import('@playwright/test').catch(() => null);
|
|
1055
|
-
if (fromTest?.chromium)
|
|
1056
|
-
return fromTest;
|
|
1057
|
-
const fromPlaywright = await import('playwright').catch(() => null);
|
|
1058
|
-
if (fromPlaywright?.chromium)
|
|
1059
|
-
return fromPlaywright;
|
|
1060
|
-
throw new Error('Local preview requires Playwright. Install project dependencies with `bun install`, then rerun `orizu apps preview`.');
|
|
1061
|
-
}
|
|
1062
|
-
function resolveChromiumExecutablePath() {
|
|
1063
|
-
const candidates = [
|
|
1064
|
-
process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH,
|
|
1065
|
-
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
|
1066
|
-
'/Applications/Chromium.app/Contents/MacOS/Chromium',
|
|
1067
|
-
'/usr/bin/google-chrome',
|
|
1068
|
-
'/usr/bin/chromium',
|
|
1069
|
-
'/usr/bin/chromium-browser',
|
|
1070
|
-
'C:/Program Files/Google/Chrome/Application/chrome.exe',
|
|
1071
|
-
'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe',
|
|
1072
|
-
].filter(Boolean);
|
|
1073
|
-
return candidates.find(candidate => existsSync(candidate)) || null;
|
|
1074
|
-
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Interrupted } from './cli-stops.js';
|
|
2
|
+
import { type AppPreviewOptions, type AppPreviewResult } from './preview-runtime.js';
|
|
3
|
+
/** Renders the preview; Ctrl-C and SIGTERM are left to Node and Playwright, as before. */
|
|
4
|
+
export declare function runPreview(options: AppPreviewOptions): Promise<AppPreviewResult>;
|
|
5
|
+
/**
|
|
6
|
+
* `orizu apps preview`: Ctrl-C and SIGTERM stop the preview and close
|
|
7
|
+
* Chromium, the server and the folder before the command exits with 130 or 143.
|
|
8
|
+
* Playwright's own signal handlers are off, so it can't end the process first.
|
|
9
|
+
*/
|
|
10
|
+
export declare function runPreviewCommand(options: AppPreviewOptions): Promise<AppPreviewResult | Interrupted>;
|
|
11
|
+
//# sourceMappingURL=preview-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-workflow.d.ts","sourceRoot":"","sources":["../src/preview-workflow.ts"],"names":[],"mappings":"AAQA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,EAWL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAItB,MAAM,sBAAsB,CAAA;AA2Q7B,0FAA0F;AAC1F,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAItF;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,GAAG,WAAW,CAAC,CAQ3G"}
|