@poli-page/cli 0.8.2 → 0.10.0
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 +282 -117
- package/dist/api-client.d.ts +101 -111
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +99 -133
- package/dist/api-client.js.map +1 -1
- package/dist/auth.d.ts +10 -4
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +6 -3
- package/dist/auth.js.map +1 -1
- package/dist/cloud-context.d.ts +0 -2
- package/dist/cloud-context.d.ts.map +1 -1
- package/dist/cloud-context.js +2 -25
- package/dist/cloud-context.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +5 -2
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/dev.d.ts +97 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +534 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/documents/get.d.ts +4 -0
- package/dist/commands/documents/get.d.ts.map +1 -1
- package/dist/commands/documents/get.js +3 -5
- package/dist/commands/documents/get.js.map +1 -1
- package/dist/commands/env.d.ts +3 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +227 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/init.d.ts +42 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +152 -18
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/link.d.ts +8 -0
- package/dist/commands/link.d.ts.map +1 -1
- package/dist/commands/link.js +25 -36
- package/dist/commands/link.js.map +1 -1
- package/dist/commands/publish.d.ts +17 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +163 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/render.d.ts +27 -11
- package/dist/commands/render.d.ts.map +1 -1
- package/dist/commands/render.js +128 -60
- package/dist/commands/render.js.map +1 -1
- package/dist/commands/watch.d.ts +1 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +14 -123
- package/dist/commands/watch.js.map +1 -1
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +15 -3
- package/dist/credentials.js.map +1 -1
- package/dist/dev-page.d.ts +22 -0
- package/dist/dev-page.d.ts.map +1 -0
- package/dist/dev-page.js +280 -0
- package/dist/dev-page.js.map +1 -0
- package/dist/dev-server.d.ts +51 -0
- package/dist/dev-server.d.ts.map +1 -0
- package/dist/dev-server.js +228 -0
- package/dist/dev-server.js.map +1 -0
- package/dist/environment-name.d.ts +8 -0
- package/dist/environment-name.d.ts.map +1 -0
- package/dist/environment-name.js +21 -0
- package/dist/environment-name.js.map +1 -0
- package/dist/exit-codes.d.ts +4 -0
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +14 -10
- package/dist/exit-codes.js.map +1 -1
- package/dist/manifest.d.ts +8 -1
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +28 -2
- package/dist/manifest.js.map +1 -1
- package/dist/manifest.schema.d.ts +0 -2
- package/dist/manifest.schema.d.ts.map +1 -1
- package/dist/manifest.schema.js +1 -15
- package/dist/manifest.schema.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +6 -10
- package/dist/program.js.map +1 -1
- package/dist/project-files.d.ts +11 -0
- package/dist/project-files.d.ts.map +1 -0
- package/dist/project-files.js +57 -0
- package/dist/project-files.js.map +1 -0
- package/dist/project-sync.d.ts +50 -0
- package/dist/project-sync.d.ts.map +1 -0
- package/dist/project-sync.js +118 -0
- package/dist/project-sync.js.map +1 -0
- package/dist/sync-engine.d.ts +3 -3
- package/dist/sync-engine.d.ts.map +1 -1
- package/dist/sync-engine.js +4 -3
- package/dist/sync-engine.js.map +1 -1
- package/dist/template-importer.d.ts +15 -0
- package/dist/template-importer.d.ts.map +1 -1
- package/dist/template-importer.js +44 -0
- package/dist/template-importer.js.map +1 -1
- package/dist/template-prompt.d.ts +8 -0
- package/dist/template-prompt.d.ts.map +1 -1
- package/dist/template-prompt.js +4 -4
- package/dist/template-prompt.js.map +1 -1
- package/package.json +3 -3
- package/dist/commands/checkout.d.ts +0 -15
- package/dist/commands/checkout.d.ts.map +0 -1
- package/dist/commands/checkout.js +0 -145
- package/dist/commands/checkout.js.map +0 -1
- package/dist/commands/preview.d.ts +0 -30
- package/dist/commands/preview.d.ts.map +0 -1
- package/dist/commands/preview.js +0 -129
- package/dist/commands/preview.js.map +0 -1
- package/dist/commands/push.d.ts +0 -26
- package/dist/commands/push.d.ts.map +0 -1
- package/dist/commands/push.js +0 -139
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/version-state.d.ts +0 -35
- package/dist/commands/version-state.d.ts.map +0 -1
- package/dist/commands/version-state.js +0 -179
- package/dist/commands/version-state.js.map +0 -1
- package/dist/commands/versions.d.ts +0 -19
- package/dist/commands/versions.d.ts.map +0 -1
- package/dist/commands/versions.js +0 -120
- package/dist/commands/versions.js.map +0 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import type { ApiClient } from '../api-client.js';
|
|
3
|
+
import { type FileWatcher, type FileWatcherOptions } from '../file-watcher.js';
|
|
4
|
+
export type DevEventType = 'ready' | 'syncing' | 'synced' | 'rendering' | 'rendered' | 'error' | 'stopped';
|
|
5
|
+
export interface DevEvent {
|
|
6
|
+
type: DevEventType;
|
|
7
|
+
message?: string;
|
|
8
|
+
template?: string;
|
|
9
|
+
}
|
|
10
|
+
export type DevStatus = 'idle' | 'syncing' | 'rendering';
|
|
11
|
+
export interface DevError {
|
|
12
|
+
/** Which step produced it — the overlay titles itself from this. */
|
|
13
|
+
stage: 'sync' | 'render' | 'project';
|
|
14
|
+
message: string;
|
|
15
|
+
file?: string;
|
|
16
|
+
line?: number;
|
|
17
|
+
column?: number;
|
|
18
|
+
}
|
|
19
|
+
/** The snapshot handed to the browser on `/state` and over SSE. */
|
|
20
|
+
export interface DevState {
|
|
21
|
+
templates: string[];
|
|
22
|
+
activeTemplate: string | null;
|
|
23
|
+
pinned: boolean;
|
|
24
|
+
status: DevStatus;
|
|
25
|
+
/** Bumped on every successful render — the browser's reload trigger. */
|
|
26
|
+
renderVersion: number;
|
|
27
|
+
error: DevError | null;
|
|
28
|
+
lastRenderedAt: string | null;
|
|
29
|
+
}
|
|
30
|
+
export interface DevOptions {
|
|
31
|
+
cwd?: string;
|
|
32
|
+
homeDir?: string;
|
|
33
|
+
apiClient?: ApiClient;
|
|
34
|
+
port?: number;
|
|
35
|
+
maxPortAttempts?: number;
|
|
36
|
+
/** Open the browser on start. Defaults to true. */
|
|
37
|
+
open?: boolean;
|
|
38
|
+
/** `-d, --data <path>` — overrides every template's mock, like `poli render -d`. */
|
|
39
|
+
data?: string;
|
|
40
|
+
signal?: AbortSignal;
|
|
41
|
+
watcherFactory?: (options: FileWatcherOptions) => FileWatcher;
|
|
42
|
+
debounceMs?: number;
|
|
43
|
+
onEvent?: (event: DevEvent) => void;
|
|
44
|
+
/** Injectable for tests — defaults to the `open` package. */
|
|
45
|
+
openFn?: (url: string) => Promise<unknown>;
|
|
46
|
+
}
|
|
47
|
+
export interface DevSession {
|
|
48
|
+
readonly url: string;
|
|
49
|
+
readonly port: number;
|
|
50
|
+
getState(): DevState;
|
|
51
|
+
/** Resolves once the in-flight sync/render work has settled. */
|
|
52
|
+
close(): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A `templates/<name>/…` path belongs to `<name>`. Anything else — a
|
|
56
|
+
* shared partial, `tailwind.css`, an asset, the manifest — belongs to no
|
|
57
|
+
* single template, so it cannot move the follow target.
|
|
58
|
+
*/
|
|
59
|
+
export declare function attributeChangedTemplate(changedPath: string, templateNames: readonly string[]): string | null;
|
|
60
|
+
/**
|
|
61
|
+
* Decide which template the view should follow after a sync.
|
|
62
|
+
*
|
|
63
|
+
* "Most recently changed" is resolved per *template-owned* file: only
|
|
64
|
+
* paths under `templates/<name>/` name a template. A batch that touches
|
|
65
|
+
* several of them picks the one whose file has the newest mtime (ties
|
|
66
|
+
* broken alphabetically, so the answer is deterministic).
|
|
67
|
+
*
|
|
68
|
+
* Editing a shared partial, `tailwind.css`, an asset, or the manifest
|
|
69
|
+
* changes many templates at once and therefore names none: the function
|
|
70
|
+
* returns `null`, meaning "keep whatever is on screen and re-render it".
|
|
71
|
+
* That is the honest reading — a shared edit has no single owner, and
|
|
72
|
+
* yanking the user to an arbitrary template would be worse than staying.
|
|
73
|
+
*/
|
|
74
|
+
export declare function pickFollowTarget(cwd: string, changedPaths: readonly string[], templateNames: readonly string[]): Promise<string | null>;
|
|
75
|
+
/**
|
|
76
|
+
* Pull a `file:line[:column]` out of an engine error message when the
|
|
77
|
+
* engine bothered to include one. The message is always shown verbatim —
|
|
78
|
+
* this only enriches the overlay header, never replaces the text.
|
|
79
|
+
*/
|
|
80
|
+
export declare function extractErrorPosition(message: string): {
|
|
81
|
+
file?: string;
|
|
82
|
+
line?: number;
|
|
83
|
+
column?: number;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Start the `poli dev` loop and its local server.
|
|
87
|
+
*
|
|
88
|
+
* Deliberately does **not** require a TTY: `poli dev` is a server meant
|
|
89
|
+
* to be composed into a user's own dev script (`concurrently`, `npm-run-all`,
|
|
90
|
+
* a Procfile), all of which pipe child stdout.
|
|
91
|
+
*/
|
|
92
|
+
export declare function startDevSession(templateName: string | undefined, options?: DevOptions): Promise<DevSession>;
|
|
93
|
+
/** Start the session and stay up until the abort signal fires. */
|
|
94
|
+
export declare function executeDev(templateName: string | undefined, options?: DevOptions): Promise<void>;
|
|
95
|
+
export declare function parsePort(raw: string): number;
|
|
96
|
+
export declare function registerDevCommand(program: Command): void;
|
|
97
|
+
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,O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tB,OAAO,CAAC,UAAU,CAAC,CAyWrB;AAED,kEAAkE;AAClE,wBAAsB,UAAU,CAC/B,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,OAAO,GAAE,UAAe,GACtB,OAAO,CAAC,IAAI,CAAC,CAef;AA2BD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU7C;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgEzD"}
|
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
import { readFile, stat } from 'node:fs/promises';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { resolveCloudContext } from '../cloud-context.js';
|
|
4
|
+
import { createFileWatcher } from '../file-watcher.js';
|
|
5
|
+
import { createProjectSyncer } from '../project-sync.js';
|
|
6
|
+
import { findTemplate, loadProject, loadTemplate, unwrapMockJson, } from '../project-loader.js';
|
|
7
|
+
import { errorToExitCode } from '../exit-codes.js';
|
|
8
|
+
import { startDevServer, DEFAULT_DEV_PORT, } from '../dev-server.js';
|
|
9
|
+
import { DEV_PAGE_HTML, DEV_PLACEHOLDER_HTML } from '../dev-page.js';
|
|
10
|
+
const DEFAULT_DEBOUNCE_MS = 300;
|
|
11
|
+
/**
|
|
12
|
+
* A `templates/<name>/…` path belongs to `<name>`. Anything else — a
|
|
13
|
+
* shared partial, `tailwind.css`, an asset, the manifest — belongs to no
|
|
14
|
+
* single template, so it cannot move the follow target.
|
|
15
|
+
*/
|
|
16
|
+
export function attributeChangedTemplate(changedPath, templateNames) {
|
|
17
|
+
const segments = changedPath.split('/');
|
|
18
|
+
if (segments.length < 3)
|
|
19
|
+
return null;
|
|
20
|
+
if (segments[0] !== 'templates')
|
|
21
|
+
return null;
|
|
22
|
+
const name = segments[1];
|
|
23
|
+
return templateNames.includes(name) ? name : null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Decide which template the view should follow after a sync.
|
|
27
|
+
*
|
|
28
|
+
* "Most recently changed" is resolved per *template-owned* file: only
|
|
29
|
+
* paths under `templates/<name>/` name a template. A batch that touches
|
|
30
|
+
* several of them picks the one whose file has the newest mtime (ties
|
|
31
|
+
* broken alphabetically, so the answer is deterministic).
|
|
32
|
+
*
|
|
33
|
+
* Editing a shared partial, `tailwind.css`, an asset, or the manifest
|
|
34
|
+
* changes many templates at once and therefore names none: the function
|
|
35
|
+
* returns `null`, meaning "keep whatever is on screen and re-render it".
|
|
36
|
+
* That is the honest reading — a shared edit has no single owner, and
|
|
37
|
+
* yanking the user to an arbitrary template would be worse than staying.
|
|
38
|
+
*/
|
|
39
|
+
export async function pickFollowTarget(cwd, changedPaths, templateNames) {
|
|
40
|
+
const newest = new Map();
|
|
41
|
+
for (const changedPath of changedPaths) {
|
|
42
|
+
const template = attributeChangedTemplate(changedPath, templateNames);
|
|
43
|
+
if (!template)
|
|
44
|
+
continue;
|
|
45
|
+
let mtime = 0;
|
|
46
|
+
try {
|
|
47
|
+
mtime = (await stat(join(cwd, changedPath))).mtimeMs;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Deleted between the sync and this stat — it still counts as a
|
|
51
|
+
// change, just without a usable timestamp.
|
|
52
|
+
mtime = 0;
|
|
53
|
+
}
|
|
54
|
+
const current = newest.get(template);
|
|
55
|
+
if (current === undefined || mtime > current) {
|
|
56
|
+
newest.set(template, mtime);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (newest.size === 0)
|
|
60
|
+
return null;
|
|
61
|
+
return [...newest.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))[0][0];
|
|
62
|
+
}
|
|
63
|
+
const POSITION_PATTERNS = [
|
|
64
|
+
// `templates/invoice/invoice.html:42:7`
|
|
65
|
+
/([\w./\\-]+\.(?:html|css|json)):(\d+)(?::(\d+))?/i,
|
|
66
|
+
// `… in invoice.html at line 42, column 7`
|
|
67
|
+
/(?:in|at)\s+([\w./\\-]+\.(?:html|css|json))\D+line\s+(\d+)(?:\D+column\s+(\d+))?/i,
|
|
68
|
+
];
|
|
69
|
+
/**
|
|
70
|
+
* Pull a `file:line[:column]` out of an engine error message when the
|
|
71
|
+
* engine bothered to include one. The message is always shown verbatim —
|
|
72
|
+
* this only enriches the overlay header, never replaces the text.
|
|
73
|
+
*/
|
|
74
|
+
export function extractErrorPosition(message) {
|
|
75
|
+
for (const pattern of POSITION_PATTERNS) {
|
|
76
|
+
const match = pattern.exec(message);
|
|
77
|
+
if (!match)
|
|
78
|
+
continue;
|
|
79
|
+
const line = Number.parseInt(match[2], 10);
|
|
80
|
+
const column = match[3] ? Number.parseInt(match[3], 10) : undefined;
|
|
81
|
+
return {
|
|
82
|
+
file: match[1],
|
|
83
|
+
...(Number.isFinite(line) ? { line } : {}),
|
|
84
|
+
...(column !== undefined && Number.isFinite(column) ? { column } : {}),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return {};
|
|
88
|
+
}
|
|
89
|
+
function toDevError(stage, err) {
|
|
90
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
91
|
+
return { stage, message, ...extractErrorPosition(message) };
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Start the `poli dev` loop and its local server.
|
|
95
|
+
*
|
|
96
|
+
* Deliberately does **not** require a TTY: `poli dev` is a server meant
|
|
97
|
+
* to be composed into a user's own dev script (`concurrently`, `npm-run-all`,
|
|
98
|
+
* a Procfile), all of which pipe child stdout.
|
|
99
|
+
*/
|
|
100
|
+
export async function startDevSession(templateName, options = {}) {
|
|
101
|
+
const cwd = options.cwd ?? process.cwd();
|
|
102
|
+
const emit = (event) => options.onEvent?.(event);
|
|
103
|
+
// Resolves the manifest, the session token and the org — throws the
|
|
104
|
+
// familiar "not linked" / "not logged in" errors before anything is
|
|
105
|
+
// served, so a misconfigured project fails fast instead of booting a
|
|
106
|
+
// server that can never work.
|
|
107
|
+
const { client, ctx } = await resolveCloudContext({
|
|
108
|
+
cwd,
|
|
109
|
+
apiClient: options.apiClient,
|
|
110
|
+
homeDir: options.homeDir,
|
|
111
|
+
});
|
|
112
|
+
const initial = await loadProject(cwd);
|
|
113
|
+
let manifest = initial.manifest;
|
|
114
|
+
let templates = templateNamesOf(manifest);
|
|
115
|
+
// `projectSlug` is optional in the manifest schema (legacy links lack
|
|
116
|
+
// it) but every render payload needs it. Without this guard the
|
|
117
|
+
// server boots and then fails every render into the overlay forever —
|
|
118
|
+
// fail fast instead, with the same message (and exit code) as
|
|
119
|
+
// `poli render`.
|
|
120
|
+
if (!manifest.cloud?.projectSlug) {
|
|
121
|
+
throw new Error("This folder isn't linked to a cloud project. Run `poli link` first.");
|
|
122
|
+
}
|
|
123
|
+
if (templateName !== undefined) {
|
|
124
|
+
// Fail fast on an unknown name given on the command line — same
|
|
125
|
+
// message (and exit code) as `poli render`.
|
|
126
|
+
findTemplate(manifest, templateName);
|
|
127
|
+
}
|
|
128
|
+
// The draft renders through the signed-in session only: an API key
|
|
129
|
+
// gets `403 DRAFT_REQUIRES_SESSION`, so `POLI_PAGE_API_KEY` plays no part.
|
|
130
|
+
const draftAuthorization = `Bearer ${ctx.session}`;
|
|
131
|
+
const state = {
|
|
132
|
+
templates,
|
|
133
|
+
// The positional argument only chooses the *initial* view. It does
|
|
134
|
+
// not pin — the documented default stays "follow the most recently
|
|
135
|
+
// changed template" until the user clicks Pin.
|
|
136
|
+
activeTemplate: templateName ?? templates[0] ?? null,
|
|
137
|
+
pinned: false,
|
|
138
|
+
status: 'idle',
|
|
139
|
+
renderVersion: 0,
|
|
140
|
+
error: null,
|
|
141
|
+
lastRenderedAt: null,
|
|
142
|
+
};
|
|
143
|
+
if (templates.length === 0) {
|
|
144
|
+
state.error = {
|
|
145
|
+
stage: 'project',
|
|
146
|
+
message: `No templates declared in poli-page.json. Add one with \`poli new <name>\`.`,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
let lastGoodPdf = null;
|
|
150
|
+
let renderSeq = 0;
|
|
151
|
+
let server = null;
|
|
152
|
+
let stopped = false;
|
|
153
|
+
// The last sync failure, until a sync succeeds: a render of the (stale)
|
|
154
|
+
// draft must not hide that the local files were not uploaded.
|
|
155
|
+
let syncError = null;
|
|
156
|
+
/** Set the moment `close()` is called — the session is shutting down. */
|
|
157
|
+
let closing = null;
|
|
158
|
+
/**
|
|
159
|
+
* The watcher batch currently being processed. `close()` awaits it so
|
|
160
|
+
* "resolves once the in-flight sync/render work has settled" is true
|
|
161
|
+
* even for a batch that was already past the `stopped` check.
|
|
162
|
+
*/
|
|
163
|
+
let inflightBatch = Promise.resolve();
|
|
164
|
+
function broadcast() {
|
|
165
|
+
// During shutdown the SSE responses are being ended — a batch
|
|
166
|
+
// still settling must not write into them.
|
|
167
|
+
if (closing)
|
|
168
|
+
return;
|
|
169
|
+
server?.broadcast('state', state);
|
|
170
|
+
}
|
|
171
|
+
function setStatus(next) {
|
|
172
|
+
state.status = next;
|
|
173
|
+
broadcast();
|
|
174
|
+
}
|
|
175
|
+
const syncer = createProjectSyncer({ cwd, client, ctx, signal: options.signal });
|
|
176
|
+
/**
|
|
177
|
+
* Re-read the manifest so templates added, renamed or removed during
|
|
178
|
+
* the session show up in the switcher. A broken manifest surfaces in
|
|
179
|
+
* the overlay and leaves the previous list in place.
|
|
180
|
+
*/
|
|
181
|
+
async function refreshManifest() {
|
|
182
|
+
try {
|
|
183
|
+
const loaded = await loadProject(cwd);
|
|
184
|
+
manifest = loaded.manifest;
|
|
185
|
+
templates = templateNamesOf(manifest);
|
|
186
|
+
state.templates = templates;
|
|
187
|
+
if (state.activeTemplate && !templates.includes(state.activeTemplate)) {
|
|
188
|
+
const gone = state.activeTemplate;
|
|
189
|
+
state.activeTemplate = templates[0] ?? null;
|
|
190
|
+
const message = state.activeTemplate
|
|
191
|
+
? `Template "${gone}" is gone from poli-page.json — switched to "${state.activeTemplate}".`
|
|
192
|
+
: `Template "${gone}" is gone from poli-page.json and none is left.`;
|
|
193
|
+
state.error = { stage: 'project', message };
|
|
194
|
+
emit({ type: 'error', message });
|
|
195
|
+
}
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
catch (err) {
|
|
199
|
+
state.error = toDevError('project', err);
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
async function resolveRenderInput(template) {
|
|
204
|
+
const entry = findTemplate(manifest, template);
|
|
205
|
+
const loaded = await loadTemplate(cwd, entry);
|
|
206
|
+
if (!options.data) {
|
|
207
|
+
return { entry, data: loaded.data, locale: loaded.locale };
|
|
208
|
+
}
|
|
209
|
+
// Re-read on every render so edits to the override file are picked
|
|
210
|
+
// up without restarting the server.
|
|
211
|
+
const dataPath = resolve(cwd, options.data);
|
|
212
|
+
const raw = JSON.parse(await readFile(dataPath, 'utf-8'));
|
|
213
|
+
const unwrapped = unwrapMockJson(raw);
|
|
214
|
+
return { entry, data: unwrapped.data, locale: unwrapped.locale };
|
|
215
|
+
}
|
|
216
|
+
function draftPayload(entry, data, locale) {
|
|
217
|
+
return {
|
|
218
|
+
project: manifest.cloud?.projectSlug,
|
|
219
|
+
template: entry.name,
|
|
220
|
+
data,
|
|
221
|
+
format: entry.format,
|
|
222
|
+
orientation: entry.orientation,
|
|
223
|
+
...(locale ? { locale } : {}),
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
async function render() {
|
|
227
|
+
const template = state.activeTemplate;
|
|
228
|
+
if (!template) {
|
|
229
|
+
setStatus('idle');
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const seq = ++renderSeq;
|
|
233
|
+
setStatus('rendering');
|
|
234
|
+
emit({ type: 'rendering', template });
|
|
235
|
+
try {
|
|
236
|
+
const { entry, data, locale } = await resolveRenderInput(template);
|
|
237
|
+
const buffer = await client.renderDraft(draftAuthorization, ctx.orgId, draftPayload(entry, data, locale));
|
|
238
|
+
// A newer render was requested while this one was in flight —
|
|
239
|
+
// drop the stale result rather than flashing it on screen.
|
|
240
|
+
if (seq !== renderSeq)
|
|
241
|
+
return;
|
|
242
|
+
lastGoodPdf = { template, buffer };
|
|
243
|
+
state.renderVersion += 1;
|
|
244
|
+
state.lastRenderedAt = new Date().toISOString();
|
|
245
|
+
state.error = syncError;
|
|
246
|
+
emit({ type: 'rendered', template });
|
|
247
|
+
}
|
|
248
|
+
catch (err) {
|
|
249
|
+
if (seq !== renderSeq)
|
|
250
|
+
return;
|
|
251
|
+
// The last good render stays on screen behind the overlay.
|
|
252
|
+
state.error = toDevError('render', err);
|
|
253
|
+
emit({ type: 'error', template, message: state.error.message });
|
|
254
|
+
}
|
|
255
|
+
finally {
|
|
256
|
+
if (seq === renderSeq)
|
|
257
|
+
setStatus('idle');
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
async function onBatch() {
|
|
261
|
+
if (stopped || options.signal?.aborted)
|
|
262
|
+
return;
|
|
263
|
+
try {
|
|
264
|
+
setStatus('syncing');
|
|
265
|
+
emit({ type: 'syncing' });
|
|
266
|
+
const outcome = await syncer.sync();
|
|
267
|
+
syncError = null;
|
|
268
|
+
if (!(await refreshManifest())) {
|
|
269
|
+
setStatus('idle');
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
if (outcome.changed) {
|
|
273
|
+
emit({ type: 'synced', message: `${outcome.changedPaths.length} file(s)` });
|
|
274
|
+
if (!state.pinned) {
|
|
275
|
+
const target = await pickFollowTarget(cwd, outcome.changedPaths, templates);
|
|
276
|
+
if (target)
|
|
277
|
+
state.activeTemplate = target;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
// Render on the sync-completed event — never on a timer. Even a
|
|
281
|
+
// "no changes" batch re-renders: the draft is known good and the
|
|
282
|
+
// user asked for feedback.
|
|
283
|
+
await render();
|
|
284
|
+
}
|
|
285
|
+
catch (err) {
|
|
286
|
+
if (options.signal?.aborted)
|
|
287
|
+
return;
|
|
288
|
+
syncError = state.error = toDevError('sync', err);
|
|
289
|
+
emit({ type: 'error', message: state.error.message });
|
|
290
|
+
setStatus('idle');
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
async function handleRequest(request) {
|
|
294
|
+
const { method, pathname, query, res } = request;
|
|
295
|
+
if (method === 'GET' && (pathname === '/' || pathname === '/index.html')) {
|
|
296
|
+
sendHtml(res, DEV_PAGE_HTML);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (method === 'GET' && pathname === '/pdf') {
|
|
300
|
+
if (!lastGoodPdf) {
|
|
301
|
+
sendHtml(res, DEV_PLACEHOLDER_HTML);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
res.writeHead(200, {
|
|
305
|
+
'Content-Type': 'application/pdf',
|
|
306
|
+
'Content-Length': String(lastGoodPdf.buffer.byteLength),
|
|
307
|
+
'Content-Disposition': `inline; filename="${encodeURIComponent(lastGoodPdf.template)}.pdf"`,
|
|
308
|
+
'Cache-Control': 'no-store',
|
|
309
|
+
});
|
|
310
|
+
res.end(lastGoodPdf.buffer);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
if (method === 'GET' && pathname === '/state') {
|
|
314
|
+
sendJson(res, 200, state);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (method === 'POST' && pathname === '/api/select') {
|
|
318
|
+
const requested = query.get('template');
|
|
319
|
+
if (!requested || !templates.includes(requested)) {
|
|
320
|
+
state.error = {
|
|
321
|
+
stage: 'project',
|
|
322
|
+
message: `Template "${requested ?? ''}" is not in poli-page.json.`,
|
|
323
|
+
};
|
|
324
|
+
sendJson(res, 404, state);
|
|
325
|
+
broadcast();
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
if (requested !== state.activeTemplate) {
|
|
329
|
+
state.activeTemplate = requested;
|
|
330
|
+
state.error = syncError;
|
|
331
|
+
sendJson(res, 200, state);
|
|
332
|
+
broadcast();
|
|
333
|
+
await render();
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
sendJson(res, 200, state);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (method === 'POST' && pathname === '/api/pin') {
|
|
340
|
+
state.pinned = query.get('value') !== 'false';
|
|
341
|
+
sendJson(res, 200, state);
|
|
342
|
+
broadcast();
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
sendJson(res, 404, { error: `No route for ${method} ${pathname}` });
|
|
346
|
+
}
|
|
347
|
+
// The server comes up before the first render so the URL is printable
|
|
348
|
+
// (and the browser openable) immediately: the page shows its
|
|
349
|
+
// placeholder and follows the first sync/render live over SSE.
|
|
350
|
+
server = await startDevServer({
|
|
351
|
+
port: options.port ?? DEFAULT_DEV_PORT,
|
|
352
|
+
maxPortAttempts: options.maxPortAttempts,
|
|
353
|
+
handleRequest,
|
|
354
|
+
});
|
|
355
|
+
emit({
|
|
356
|
+
type: 'ready',
|
|
357
|
+
message: server.url,
|
|
358
|
+
...(state.activeTemplate ? { template: state.activeTemplate } : {}),
|
|
359
|
+
});
|
|
360
|
+
if (options.open !== false) {
|
|
361
|
+
const opener = options.openFn ?? defaultOpen;
|
|
362
|
+
try {
|
|
363
|
+
await opener(server.url);
|
|
364
|
+
}
|
|
365
|
+
catch {
|
|
366
|
+
// No browser available (headless box, container, CI) — the URL
|
|
367
|
+
// is already printed, so this is not worth failing over.
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
// Snapshot the tree, then push all of it so the cloud draft matches
|
|
371
|
+
// the working copy before the very first render. Without it, run #1
|
|
372
|
+
// would render whatever the draft happened to contain.
|
|
373
|
+
await syncer.prime();
|
|
374
|
+
try {
|
|
375
|
+
setStatus('syncing');
|
|
376
|
+
emit({ type: 'syncing' });
|
|
377
|
+
await syncer.syncAll();
|
|
378
|
+
}
|
|
379
|
+
catch (err) {
|
|
380
|
+
syncError = state.error = toDevError('sync', err);
|
|
381
|
+
emit({ type: 'error', message: state.error.message });
|
|
382
|
+
}
|
|
383
|
+
state.status = 'idle';
|
|
384
|
+
if (!stopped) {
|
|
385
|
+
await render();
|
|
386
|
+
}
|
|
387
|
+
// Only now start watching: a batch arriving mid-bootstrap would race
|
|
388
|
+
// the initial full sync.
|
|
389
|
+
const watcher = (options.watcherFactory ?? createFileWatcher)({
|
|
390
|
+
cwd,
|
|
391
|
+
debounceMs: options.debounceMs ?? DEFAULT_DEBOUNCE_MS,
|
|
392
|
+
onBatch: () => {
|
|
393
|
+
// Chained rather than fire-and-forget so `close()` can await
|
|
394
|
+
// the batch already in flight. `onBatch` handles its own
|
|
395
|
+
// failures; the catch only keeps a surprise rejection from
|
|
396
|
+
// wedging the chain (and with it, `close()`).
|
|
397
|
+
inflightBatch = inflightBatch.then(onBatch).catch(() => { });
|
|
398
|
+
},
|
|
399
|
+
});
|
|
400
|
+
const close = async () => {
|
|
401
|
+
if (closing)
|
|
402
|
+
return closing;
|
|
403
|
+
stopped = true;
|
|
404
|
+
closing = (async () => {
|
|
405
|
+
// No new batches once the watcher is down…
|
|
406
|
+
await watcher.close();
|
|
407
|
+
// …and the one already past the `stopped` check finishes
|
|
408
|
+
// before the SSE responses and the port go away.
|
|
409
|
+
await inflightBatch;
|
|
410
|
+
await server?.close();
|
|
411
|
+
emit({ type: 'stopped' });
|
|
412
|
+
})();
|
|
413
|
+
return closing;
|
|
414
|
+
};
|
|
415
|
+
if (options.signal) {
|
|
416
|
+
if (options.signal.aborted) {
|
|
417
|
+
await close();
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
options.signal.addEventListener('abort', () => void close(), { once: true });
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return {
|
|
424
|
+
url: server.url,
|
|
425
|
+
port: server.port,
|
|
426
|
+
getState: () => ({ ...state, templates: [...state.templates] }),
|
|
427
|
+
close,
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
/** Start the session and stay up until the abort signal fires. */
|
|
431
|
+
export async function executeDev(templateName, options = {}) {
|
|
432
|
+
const session = await startDevSession(templateName, options);
|
|
433
|
+
await new Promise((done) => {
|
|
434
|
+
// No signal → the server runs until the process itself is killed.
|
|
435
|
+
// The CLI action always supplies one (SIGINT / SIGTERM).
|
|
436
|
+
if (!options.signal)
|
|
437
|
+
return;
|
|
438
|
+
if (options.signal.aborted) {
|
|
439
|
+
done();
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
options.signal.addEventListener('abort', () => done(), { once: true });
|
|
443
|
+
});
|
|
444
|
+
await session.close();
|
|
445
|
+
}
|
|
446
|
+
function templateNamesOf(manifest) {
|
|
447
|
+
return (manifest.templates ?? []).map((entry) => entry.name);
|
|
448
|
+
}
|
|
449
|
+
function sendHtml(res, html) {
|
|
450
|
+
res.writeHead(200, {
|
|
451
|
+
'Content-Type': 'text/html; charset=utf-8',
|
|
452
|
+
'Cache-Control': 'no-store',
|
|
453
|
+
});
|
|
454
|
+
res.end(html);
|
|
455
|
+
}
|
|
456
|
+
function sendJson(res, status, payload) {
|
|
457
|
+
res.writeHead(status, {
|
|
458
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
459
|
+
'Cache-Control': 'no-store',
|
|
460
|
+
});
|
|
461
|
+
res.end(JSON.stringify(payload));
|
|
462
|
+
}
|
|
463
|
+
async function defaultOpen(url) {
|
|
464
|
+
const open = await import('open');
|
|
465
|
+
return open.default(url);
|
|
466
|
+
}
|
|
467
|
+
export function parsePort(raw) {
|
|
468
|
+
const port = Number.parseInt(raw, 10);
|
|
469
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
470
|
+
const error = new Error(`Invalid --port "${raw}": expected an integer between 1 and 65535.`);
|
|
471
|
+
Object.assign(error, { exitCode: 2 });
|
|
472
|
+
throw error;
|
|
473
|
+
}
|
|
474
|
+
return port;
|
|
475
|
+
}
|
|
476
|
+
export function registerDevCommand(program) {
|
|
477
|
+
program
|
|
478
|
+
.command('dev')
|
|
479
|
+
.description('Live PDF preview of the cloud draft: sync each save, render the draft through your session, reload the browser')
|
|
480
|
+
.argument('[template]', 'Template to show first (defaults to the first in the manifest)')
|
|
481
|
+
.option('-p, --port <n>', `Port to listen on (default: ${DEFAULT_DEV_PORT})`)
|
|
482
|
+
.option('-d, --data <path>', 'JSON data file (overrides the template mock)')
|
|
483
|
+
.option('--no-open', 'Do not open the browser on start')
|
|
484
|
+
.action(async (template, opts) => {
|
|
485
|
+
const { default: chalk } = await import('chalk');
|
|
486
|
+
const controller = new AbortController();
|
|
487
|
+
const stop = () => controller.abort();
|
|
488
|
+
process.on('SIGINT', stop);
|
|
489
|
+
process.on('SIGTERM', stop);
|
|
490
|
+
try {
|
|
491
|
+
await executeDev(template, {
|
|
492
|
+
signal: controller.signal,
|
|
493
|
+
port: opts.port ? parsePort(opts.port) : undefined,
|
|
494
|
+
data: opts.data,
|
|
495
|
+
open: opts.open !== false,
|
|
496
|
+
// Line-oriented, never carriage-return overwrites: the
|
|
497
|
+
// output has to stay readable when piped through
|
|
498
|
+
// `concurrently` or captured in a log file.
|
|
499
|
+
onEvent: (event) => {
|
|
500
|
+
const ts = new Date().toLocaleTimeString();
|
|
501
|
+
switch (event.type) {
|
|
502
|
+
case 'ready':
|
|
503
|
+
console.log(chalk.cyan(`▸ poli dev — ${event.message ?? ''}`) +
|
|
504
|
+
(event.template ? chalk.dim(` (${event.template})`) : ''));
|
|
505
|
+
console.log(chalk.dim(' Save a file to re-render. Ctrl-C to stop.'));
|
|
506
|
+
break;
|
|
507
|
+
case 'syncing':
|
|
508
|
+
console.log(chalk.dim(`[${ts}] syncing...`));
|
|
509
|
+
break;
|
|
510
|
+
case 'rendered':
|
|
511
|
+
console.log(chalk.green(`[${ts}] ✓ rendered ${event.template ?? ''}`));
|
|
512
|
+
break;
|
|
513
|
+
case 'error':
|
|
514
|
+
console.error(chalk.red(`[${ts}] ✗ ${event.message ?? 'error'}`));
|
|
515
|
+
break;
|
|
516
|
+
case 'stopped':
|
|
517
|
+
console.log(chalk.dim('Dev server stopped.'));
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
catch (err) {
|
|
524
|
+
const message = err instanceof Error ? err.message : 'Dev server failed';
|
|
525
|
+
console.error(chalk.red(message));
|
|
526
|
+
process.exitCode = errorToExitCode(err);
|
|
527
|
+
}
|
|
528
|
+
finally {
|
|
529
|
+
process.removeListener('SIGINT', stop);
|
|
530
|
+
process.removeListener('SIGTERM', stop);
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAA6C,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACN,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,GAEd,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACN,cAAc,EACd,gBAAgB,GAGhB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAErE,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAkEhC;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACvC,WAAmB,EACnB,aAAgC;IAEhC,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,WAAW;QAAE,O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