@open-document/core 0.13.3 → 0.14.1
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/{build-CvsOak5B.js → build-I0cgoERP.js} +1 -1
- package/dist/{check-CbUBwYmf.js → check-Dys96QSL.js} +3 -3
- package/dist/cli/bin.js +10 -21
- package/dist/{config-BWtOZ1jc.d.ts → config-cAV1OCuY.d.ts} +9 -1
- package/dist/{context-CWgfsHoE.js → context-C-osJW5f.js} +1 -1
- package/dist/{dev-B8H2qT6G.js → dev-CC4PrIOC.js} +1 -1
- package/dist/{diff-BvIjjgnc.js → diff-DhutD4TJ.js} +2 -2
- package/dist/{export-DX30_s2q.js → export-KrajVJO7.js} +3 -3
- package/dist/{import-DgsdJT5e.js → import-Yv34za3L.js} +3 -2
- package/dist/index.d.ts +2 -2
- package/dist/ops/index.d.ts +3 -1
- package/dist/ops/index.js +2 -2
- package/dist/ops-Dux5HlkH.js +401 -0
- package/dist/{preview-DYMUNjXL.js → preview-7eqn9Wzf.js} +1 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/{config-CltJJVsw.js → session-BSbrC5gK.js} +3268 -385
- package/dist/{templates-B5Tz0AKb.js → templates-s-VLTSRc.js} +3 -3
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/package.json +1 -1
- package/skills/create-doc/SKILL.md +1 -1
- package/skills/doc-authoring/SKILL.md +6 -0
- package/src/app/app.tsx +2 -0
- package/src/app/components/agent/agent-dock.tsx +75 -0
- package/src/app/components/agent/agent-markdown.tsx +45 -0
- package/src/app/components/agent/agent-panel.tsx +695 -0
- package/src/app/components/agent/agent-presence.tsx +74 -0
- package/src/app/components/agent/composer.tsx +120 -0
- package/src/app/components/agent/connect-view.tsx +183 -0
- package/src/app/components/agent/history-view.tsx +134 -0
- package/src/app/components/agent/provider-logo.tsx +23 -0
- package/src/app/components/agent/transcript.tsx +717 -0
- package/src/app/components/comments/comments-panel.tsx +26 -2
- package/src/app/components/inspector/inspector.tsx +17 -0
- package/src/app/components/note-markdown.tsx +85 -0
- package/src/app/components/page-error-boundary.tsx +84 -0
- package/src/app/components/page-frame.tsx +2 -1
- package/src/app/components/panel/resize-handle.tsx +129 -0
- package/src/app/components/ui/button.tsx +97 -0
- package/src/app/components/ui/popover.tsx +144 -0
- package/src/app/components/ui/tooltip.tsx +123 -0
- package/src/app/lib/agent/use-agent.ts +543 -0
- package/src/app/lib/diagnostics.ts +13 -0
- package/src/app/lib/export-dom.ts +2 -1
- package/src/app/lib/export-pdf.ts +2 -1
- package/src/app/lib/i18n-ja/agent-panel.ts +115 -0
- package/src/app/lib/i18n-ja/agent.ts +9 -0
- package/src/app/lib/i18n-ja/index.ts +9 -1
- package/src/app/lib/i18n-ko/agent-panel.ts +114 -0
- package/src/app/lib/i18n-ko/agent.ts +9 -0
- package/src/app/lib/i18n-ko/index.ts +9 -1
- package/src/app/lib/i18n-zh-cn/agent-panel.ts +113 -0
- package/src/app/lib/i18n-zh-cn/agent.ts +9 -0
- package/src/app/lib/i18n-zh-cn/index.ts +9 -1
- package/src/app/lib/i18n-zh-tw/agent-panel.ts +113 -0
- package/src/app/lib/i18n-zh-tw/agent.ts +9 -0
- package/src/app/lib/i18n-zh-tw/index.ts +9 -1
- package/src/app/lib/note-markdown.ts +116 -0
- package/src/app/lib/toast.ts +50 -0
- package/src/app/lib/use-auto-grow.ts +15 -0
- package/src/app/lib/use-doc-titles.ts +28 -0
- package/src/app/lib/use-locale.ts +151 -0
- package/src/app/lib/utils.ts +4 -0
- package/src/app/routes/doc-preview.tsx +103 -0
- package/src/app/routes/doc.tsx +118 -11
- package/src/app/routes/home.tsx +43 -8
- package/src/app/styles.css +193 -0
- package/dist/ops-CSR5RlrE.js +0 -1673
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { t as cliContext } from "./context-
|
|
1
|
+
import { R as listDocIds, S as closeRenderSession, x as checkLayout } from "./session-BSbrC5gK.js";
|
|
2
|
+
import "./ops-Dux5HlkH.js";
|
|
3
|
+
import { t as cliContext } from "./context-C-osJW5f.js";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
//#region src/cli/check.ts
|
|
6
6
|
function line(finding) {
|
package/dist/cli/bin.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.js";
|
|
2
3
|
import { i as ORIENTATIONS, o as PAGE_SIZE_NAMES, r as EXPORT_FORMATS } from "../sdk-CqNZzbkz.js";
|
|
3
4
|
import { n as readCoreVersion } from "../package-version-C89gtYSk.js";
|
|
4
5
|
import chalk from "chalk";
|
|
@@ -8,18 +9,6 @@ import { fileURLToPath } from "node:url";
|
|
|
8
9
|
import { Argument, Command, Option } from "commander";
|
|
9
10
|
import fs from "node:fs/promises";
|
|
10
11
|
import { existsSync } from "node:fs";
|
|
11
|
-
//#region \0rolldown/runtime.js
|
|
12
|
-
var __defProp = Object.defineProperty;
|
|
13
|
-
var __exportAll = (all, no_symbols) => {
|
|
14
|
-
let target = {};
|
|
15
|
-
for (var name in all) __defProp(target, name, {
|
|
16
|
-
get: all[name],
|
|
17
|
-
enumerable: true
|
|
18
|
-
});
|
|
19
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
20
|
-
return target;
|
|
21
|
-
};
|
|
22
|
-
//#endregion
|
|
23
12
|
//#region src/cli/sync.ts
|
|
24
13
|
var sync_exports = /* @__PURE__ */ __exportAll({
|
|
25
14
|
detectSkillsDrift: () => detectSkillsDrift,
|
|
@@ -154,39 +143,39 @@ async function run(argv) {
|
|
|
154
143
|
program.name("open-doc").description("Author documents — we handle the Vite/React stack, pagination, and export.").version(version, "-v, --version", "print version").helpOption("-h, --help", "show help").showHelpAfterError(chalk.dim("(run `open-doc --help` for usage)"));
|
|
155
144
|
program.command("dev").description("Start the dev server").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").option("--no-skills-check", "skip the built-in skills drift check").option("--mcp", "serve an MCP endpoint at /mcp (requires @open-document/mcp)").action(async (flags) => {
|
|
156
145
|
if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
|
|
157
|
-
const { dev } = await import("../dev-
|
|
146
|
+
const { dev } = await import("../dev-CC4PrIOC.js");
|
|
158
147
|
await dev(flags);
|
|
159
148
|
});
|
|
160
149
|
program.command("build").description("Build a static site").option("--out-dir <dir>", "output directory (defaults to `dist`)").action(async (flags) => {
|
|
161
|
-
const { build } = await import("../build-
|
|
150
|
+
const { build } = await import("../build-I0cgoERP.js");
|
|
162
151
|
await build(flags);
|
|
163
152
|
});
|
|
164
153
|
program.command("preview").description("Preview the production build").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").action(async (flags) => {
|
|
165
|
-
const { preview } = await import("../preview-
|
|
154
|
+
const { preview } = await import("../preview-7eqn9Wzf.js");
|
|
166
155
|
await preview(flags);
|
|
167
156
|
});
|
|
168
157
|
program.command("export [docIds...]").description("Render documents headlessly to PDF, HTML, PNG, or DOCX").addOption(new Option("-f, --format <format>", "output format").choices([...EXPORT_FORMATS])).option("-o, --out-dir <dir>", "directory to write into (defaults to `out`)").option("--all", "export every document under docs/").option("--each", "one copy per row of the document's `records`").option("--name <pattern>", "with --each: file name, e.g. \"certificate-{name}\" ({#} is the row number)").action(async (docIds, flags) => {
|
|
169
|
-
const { exportDocs } = await import("../export-
|
|
158
|
+
const { exportDocs } = await import("../export-KrajVJO7.js");
|
|
170
159
|
await exportDocs(docIds, flags);
|
|
171
160
|
});
|
|
172
161
|
program.command("diff <docId>").description("Show what changed in a document since a git revision, page by page").option("-s, --since <rev>", "revision to compare against (defaults to HEAD)").option("-o, --out-dir <dir>", "directory to write the report into (defaults to `out`)").option("--json", "print the result as JSON").action(async (docId, flags) => {
|
|
173
|
-
const { diffDoc } = await import("../diff-
|
|
162
|
+
const { diffDoc } = await import("../diff-DhutD4TJ.js");
|
|
174
163
|
await diffDoc(docId, flags);
|
|
175
164
|
});
|
|
176
165
|
program.command("check [docIds...]").description("Report layout faults — clipped content, blank sheets, stranded headings").option("--json", "print the full report as JSON").action(async (docIds, flags) => {
|
|
177
|
-
const { checkDocs } = await import("../check-
|
|
166
|
+
const { checkDocs } = await import("../check-Dys96QSL.js");
|
|
178
167
|
await checkDocs(docIds, flags);
|
|
179
168
|
});
|
|
180
169
|
program.command("templates").description("List the templates a new document can start from").option("--json", "print them as JSON").action(async (flags) => {
|
|
181
|
-
const { printTemplates } = await import("../templates-
|
|
170
|
+
const { printTemplates } = await import("../templates-s-VLTSRc.js");
|
|
182
171
|
await printTemplates(flags);
|
|
183
172
|
});
|
|
184
173
|
program.command("new [docId]").description("Create a document under docs/ from a template (see `open-doc templates`)").option("-t, --template <name>", "template to start from (defaults to blank)").option("--title <title>", "title of the new document").action(async (docId, flags) => {
|
|
185
|
-
const { newDoc } = await import("../templates-
|
|
174
|
+
const { newDoc } = await import("../templates-s-VLTSRc.js");
|
|
186
175
|
await newDoc(docId, flags);
|
|
187
176
|
});
|
|
188
177
|
program.command("import <file>").description("Turn a Markdown file into a document under docs/").option("--id <id>", "document id (defaults to a slug of the title)").option("--title <title>", "override the title").option("--subtitle <subtitle>", "subtitle, also used as the cover eyebrow").option("--lang <tag>", "language of the text, e.g. zh-Hant-TW (detected for CJK when omitted)").option("--author <author>", "author line on the cover").option("--theme <theme>", "theme id to back-link from meta.theme").addOption(new Option("--page-size <size>", "page size").choices(PAGE_SIZE_NAMES)).addOption(new Option("--orientation <orientation>", "page orientation").choices(ORIENTATIONS)).option("--no-cover", "skip the title page").option("--contents", "add a self-filling contents page").action(async (file, flags) => {
|
|
189
|
-
const { importDoc } = await import("../import-
|
|
178
|
+
const { importDoc } = await import("../import-Yv34za3L.js");
|
|
190
179
|
await importDoc(file, flags);
|
|
191
180
|
});
|
|
192
181
|
program.command("sync:skills").description("Sync built-in skills from @open-document/core into this workspace").option("--dry-run", "show what would change without writing").action(async (flags) => {
|
|
@@ -25,6 +25,13 @@ type OpenDocGcpDeployConfig = {
|
|
|
25
25
|
type OpenDocDeployConfig = {
|
|
26
26
|
gcp?: OpenDocGcpDeployConfig;
|
|
27
27
|
};
|
|
28
|
+
type OpenDocAgentConfig = {
|
|
29
|
+
/**
|
|
30
|
+
* The agent panel in `open-doc dev`, driving the Codex CLI installed on this
|
|
31
|
+
* machine through its SDK. Defaults to true.
|
|
32
|
+
*/
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
};
|
|
28
35
|
type OpenDocConfig = {
|
|
29
36
|
base?: string;
|
|
30
37
|
/**
|
|
@@ -40,6 +47,7 @@ type OpenDocConfig = {
|
|
|
40
47
|
allowedHosts?: string[] | true;
|
|
41
48
|
build?: OpenDocBuildConfig;
|
|
42
49
|
deploy?: OpenDocDeployConfig;
|
|
50
|
+
agent?: OpenDocAgentConfig;
|
|
43
51
|
};
|
|
44
52
|
//#endregion
|
|
45
|
-
export { OpenDocGcpDeployConfig as i,
|
|
53
|
+
export { OpenDocGcpDeployConfig as a, OpenDocDeployConfig as i, OpenDocBuildConfig as n, OpenDocConfig as r, OpenDocAgentConfig as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as readCoreVersion } from "./package-version-C89gtYSk.js";
|
|
2
2
|
import { n as loadUserConfig } from "./open-doc-plugin-DnX5usgI.js";
|
|
3
|
-
import {
|
|
3
|
+
import { W as makeContext } from "./session-BSbrC5gK.js";
|
|
4
4
|
//#region src/cli/context.ts
|
|
5
5
|
/** The same context the dev API and the MCP server run on, for commands that call `ops/`. */
|
|
6
6
|
async function cliContext(userCwd = process.cwd()) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as cliContext } from "./context-
|
|
1
|
+
import { t as diffDocument } from "./ops-Dux5HlkH.js";
|
|
2
|
+
import { t as cliContext } from "./context-C-osJW5f.js";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
//#region src/cli/diff.ts
|
|
5
5
|
const MARK = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as EXPORT_FORMATS } from "./sdk-CqNZzbkz.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { t as cliContext } from "./context-
|
|
2
|
+
import { C as exportDocument, R as listDocIds, S as closeRenderSession } from "./session-BSbrC5gK.js";
|
|
3
|
+
import "./ops-Dux5HlkH.js";
|
|
4
|
+
import { t as cliContext } from "./context-C-osJW5f.js";
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
//#region src/cli/export.ts
|
|
7
7
|
const FORMATS = EXPORT_FORMATS;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { T as importMarkdown } from "./session-BSbrC5gK.js";
|
|
2
|
+
import "./ops-Dux5HlkH.js";
|
|
3
|
+
import { t as cliContext } from "./context-C-osJW5f.js";
|
|
3
4
|
import chalk from "chalk";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
//#region src/cli/import.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as DesignPalette, B as useDocLabels, C as isPageSizeName, D as FieldProps, E as Field, F as designToCssVars, I as LabelEntry, L as LabelKind, M as DesignTypeScale, N as cssVarsToString, O as useRecord, P as defaultDesign, R as LabelVocabulary, S as isOrientation, T as DataRecord, _ as Orientation, a as isFlowSection, b as PageGeometry, c as DEFAULT_PAGE_SIZE, d as DocModule, f as DocPage, g as ORIENTATIONS, h as FlowSection, i as flow, j as DesignSystem, k as DesignFonts, l as DocEntry, n as BlockSlice, o as paginateBlocks, r as PaginationResult, s as DEFAULT_ORIENTATION, t as BlockMetrics, u as DocMeta, v as PAGE_SIZES, w as resolvePageGeometry, x as PageSizeName, y as PAGE_SIZE_NAMES, z as useDocLabel } from "./flow-CS5apebG.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as OpenDocGcpDeployConfig, i as OpenDocDeployConfig, n as OpenDocBuildConfig, r as OpenDocConfig, t as OpenDocAgentConfig } from "./config-cAV1OCuY.js";
|
|
3
3
|
import { CSSProperties, ReactNode } from "react";
|
|
4
4
|
//#region src/app/lib/source-loc.d.ts
|
|
5
5
|
/**
|
|
@@ -489,4 +489,4 @@ type CompileOptions = LayoutOptions & RenderOptions;
|
|
|
489
489
|
/** Mermaid-flavoured text in, themed SVG out. One call, no browser. */
|
|
490
490
|
declare function compileDiagram(source: string, options?: CompileOptions): CompiledDiagram;
|
|
491
491
|
//#endregion
|
|
492
|
-
export { Bibliography, type BibliographyItem, type BibliographyProps, type BlockMetrics, type BlockSlice, Callout, type CalloutProps, type CalloutVariant, type CellValue, Chart, type ChartFormat, type ChartProps, type ChartType, Cite, type CiteProps, CodeBlock, type CodeBlockProps, type CompileOptions, type CompiledDiagram, DEFAULT_ORIENTATION, DEFAULT_PAGE_SIZE, type DataAlign, type DataColumn, type DataFormat, type DataRecord, type DataSummaryOp, DataTable, type DataTableProps, type DelimitedTable, type DesignFonts, type DesignPalette, type DesignSystem, type DesignTypeScale, Diagram, type DiagramProps, type DiagramSource, type DiagramSubgraph, DiagramSyntaxError, type DocEntry, type DocMeta, type DocModule, type DocPage, Field, type FieldProps, Figure, type FigureProps, type FlowSection, Footnote, type FootnoteProps, Footnotes, type FootnotesProps, ImagePlaceholder, type ImagePlaceholderProps, type LabelEntry, type LabelKind, type LabelVocabulary, type LaidOutLifeline, type LaidOutSubgraph, ListOf, ListOfFigures, type ListOfProps, ListOfTables, ORIENTATIONS, type OpenDocBuildConfig, type OpenDocConfig, type OpenDocDeployConfig, type OpenDocGcpDeployConfig, type Orientation, type OutlineEntry, PAGE_SIZES, PAGE_SIZE_NAMES, type PageGeometry, type PageSizeName, type PaginationResult, Ref, type RefProps, type SequenceMessage, type SequenceParticipant, Sparkline, type SparklineProps, TableOfContents, type TableOfContentsProps, compileDiagram, cssVarsToString, defaultDesign, designToCssVars, flow, isFlowSection, isOrientation, isPageSizeName, paginateBlocks, parseDelimited, resolvePageGeometry, useDocLabel, useDocLabels, useDocOutline, useDocPageCount, useDocPageNumber, useRecord };
|
|
492
|
+
export { Bibliography, type BibliographyItem, type BibliographyProps, type BlockMetrics, type BlockSlice, Callout, type CalloutProps, type CalloutVariant, type CellValue, Chart, type ChartFormat, type ChartProps, type ChartType, Cite, type CiteProps, CodeBlock, type CodeBlockProps, type CompileOptions, type CompiledDiagram, DEFAULT_ORIENTATION, DEFAULT_PAGE_SIZE, type DataAlign, type DataColumn, type DataFormat, type DataRecord, type DataSummaryOp, DataTable, type DataTableProps, type DelimitedTable, type DesignFonts, type DesignPalette, type DesignSystem, type DesignTypeScale, Diagram, type DiagramProps, type DiagramSource, type DiagramSubgraph, DiagramSyntaxError, type DocEntry, type DocMeta, type DocModule, type DocPage, Field, type FieldProps, Figure, type FigureProps, type FlowSection, Footnote, type FootnoteProps, Footnotes, type FootnotesProps, ImagePlaceholder, type ImagePlaceholderProps, type LabelEntry, type LabelKind, type LabelVocabulary, type LaidOutLifeline, type LaidOutSubgraph, ListOf, ListOfFigures, type ListOfProps, ListOfTables, ORIENTATIONS, type OpenDocAgentConfig, type OpenDocBuildConfig, type OpenDocConfig, type OpenDocDeployConfig, type OpenDocGcpDeployConfig, type Orientation, type OutlineEntry, PAGE_SIZES, PAGE_SIZE_NAMES, type PageGeometry, type PageSizeName, type PaginationResult, Ref, type RefProps, type SequenceMessage, type SequenceParticipant, Sparkline, type SparklineProps, TableOfContents, type TableOfContentsProps, compileDiagram, cssVarsToString, defaultDesign, designToCssVars, flow, isFlowSection, isOrientation, isPageSizeName, paginateBlocks, parseDelimited, resolvePageGeometry, useDocLabel, useDocLabels, useDocOutline, useDocPageCount, useDocPageNumber, useRecord };
|
package/dist/ops/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ type ApiPluginOptions = {
|
|
|
22
22
|
assetsDir?: string;
|
|
23
23
|
coreVersion: string;
|
|
24
24
|
serverOrigin?: string;
|
|
25
|
+
/** Mount the agent panel's endpoints. Defaults to true. */
|
|
26
|
+
agent?: boolean;
|
|
25
27
|
};
|
|
26
28
|
declare function makeContext(opts: ApiPluginOptions): ApiContext;
|
|
27
29
|
//#endregion
|
|
@@ -116,7 +118,7 @@ declare function assertExpectedSource(current: string, opts?: {
|
|
|
116
118
|
declare function withFileLock<T>(filePath: string, fn: () => Promise<T>): Promise<T>;
|
|
117
119
|
//#endregion
|
|
118
120
|
//#region src/app/lib/diagnostics.d.ts
|
|
119
|
-
type LayoutRule = 'unresolved-ref' | 'duplicate-id' | 'heading-skip' | 'page-overflow' | 'off-page' | 'blank-page' | 'oversized-block' | 'orphan-heading' | 'tiny-text' | 'broken-image';
|
|
121
|
+
type LayoutRule = 'render-error' | 'unresolved-ref' | 'duplicate-id' | 'heading-skip' | 'page-overflow' | 'off-page' | 'blank-page' | 'oversized-block' | 'orphan-heading' | 'tiny-text' | 'broken-image';
|
|
120
122
|
type LayoutSeverity = 'error' | 'warn';
|
|
121
123
|
type LayoutFinding = {
|
|
122
124
|
/** 1-based sheet the problem is on. */
|
package/dist/ops/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { i as ORIENTATIONS, o as PAGE_SIZE_NAMES, r as EXPORT_FORMATS } from "../sdk-CqNZzbkz.js";
|
|
2
|
-
import { A as
|
|
3
|
-
import {
|
|
2
|
+
import { A as assertExpectedSource, B as readDocument, C as exportDocument, D as listRevisions, E as slugify, F as deleteDocument, H as resolveEntry, I as docDir, L as duplicateDocument, M as withFileLock, N as OpsError, O as readChanges, P as createDocument, R as listDocIds, S as closeRenderSession, T as importMarkdown, U as writeDocument, V as renameDocument, W as makeContext, _ as listFolders, a as readText, b as writeAsset, c as writeTexts, d as suggestDocId, f as createFolder, g as listAssets, h as findAssetUsages, i as addComment, j as hashSource, k as revertChange, l as createFromTemplate, m as fileDocument, o as writeEdits, p as deleteAsset, s as writeText, u as listTemplates, v as listThemes, w as renderDocPage, x as checkLayout, y as readTheme, z as listDocuments } from "../session-BSbrC5gK.js";
|
|
3
|
+
import { t as diffDocument } from "../ops-Dux5HlkH.js";
|
|
4
4
|
export { EXPORT_FORMATS, ORIENTATIONS, OpsError, PAGE_SIZE_NAMES, addComment, assertExpectedSource, checkLayout, closeRenderSession, createDocument, createFolder, createFromTemplate, deleteAsset, deleteDocument, diffDocument, docDir, duplicateDocument, exportDocument, fileDocument, findAssetUsages, hashSource, importMarkdown, listAssets, listDocIds, listDocuments, listFolders, listRevisions, listTemplates, listThemes, makeContext, readChanges, readDocument, readText, readTheme, renameDocument, renderDocPage, resolveEntry, revertChange, slugify, suggestDocId, withFileLock, writeAsset, writeDocument, writeEdits, writeText, writeTexts };
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { H as resolveEntry, N as OpsError, n as createRenderSession, t as RenderUnavailableError } from "./session-BSbrC5gK.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "node:fs/promises";
|
|
4
|
+
import { execFile } from "node:child_process";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { Buffer } from "node:buffer";
|
|
7
|
+
//#region src/ops/diff-pages.ts
|
|
8
|
+
/** Longest common subsequence over two lists, as pairs of matching indices. */
|
|
9
|
+
function lcs(a, b, same) {
|
|
10
|
+
const rows = a.length;
|
|
11
|
+
const cols = b.length;
|
|
12
|
+
const table = Array.from({ length: rows + 1 }, () => new Array(cols + 1).fill(0));
|
|
13
|
+
for (let i = rows - 1; i >= 0; i--) for (let j = cols - 1; j >= 0; j--) {
|
|
14
|
+
const row = table[i];
|
|
15
|
+
const below = table[i + 1];
|
|
16
|
+
row[j] = same(a[i], b[j]) ? (below[j + 1] ?? 0) + 1 : Math.max(below[j] ?? 0, row[j + 1] ?? 0);
|
|
17
|
+
}
|
|
18
|
+
const pairs = [];
|
|
19
|
+
let i = 0;
|
|
20
|
+
let j = 0;
|
|
21
|
+
while (i < rows && j < cols) if (same(a[i], b[j])) {
|
|
22
|
+
pairs.push([i, j]);
|
|
23
|
+
i++;
|
|
24
|
+
j++;
|
|
25
|
+
} else if ((table[i + 1]?.[j] ?? 0) >= (table[i]?.[j + 1] ?? 0)) i++;
|
|
26
|
+
else j++;
|
|
27
|
+
return pairs;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Pairs the sheets of two versions. Pages whose text is unchanged anchor the
|
|
31
|
+
* alignment, so a page inserted in the middle shows as one new page rather than
|
|
32
|
+
* as every page after it having changed. Between two anchors the remaining
|
|
33
|
+
* pages pair up in order; whichever side has more keeps the rest as added or
|
|
34
|
+
* removed.
|
|
35
|
+
*/
|
|
36
|
+
function alignPages(before, after) {
|
|
37
|
+
const anchors = lcs(before, after, (x, y) => x === y);
|
|
38
|
+
const pairs = [];
|
|
39
|
+
let i = 0;
|
|
40
|
+
let j = 0;
|
|
41
|
+
const fill = (untilI, untilJ) => {
|
|
42
|
+
while (i < untilI && j < untilJ) pairs.push({
|
|
43
|
+
before: i++,
|
|
44
|
+
after: j++
|
|
45
|
+
});
|
|
46
|
+
while (i < untilI) pairs.push({
|
|
47
|
+
before: i++,
|
|
48
|
+
after: null
|
|
49
|
+
});
|
|
50
|
+
while (j < untilJ) pairs.push({
|
|
51
|
+
before: null,
|
|
52
|
+
after: j++
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
for (const [ai, aj] of anchors) {
|
|
56
|
+
fill(ai, aj);
|
|
57
|
+
pairs.push({
|
|
58
|
+
before: i++,
|
|
59
|
+
after: j++
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
fill(before.length, after.length);
|
|
63
|
+
return pairs;
|
|
64
|
+
}
|
|
65
|
+
function textLines(text) {
|
|
66
|
+
return text.split("\n").map((line) => line.replace(/\s+/g, " ").trim()).filter((line) => line !== "");
|
|
67
|
+
}
|
|
68
|
+
/** A line-level diff, in reading order. */
|
|
69
|
+
function diffLines(before, after) {
|
|
70
|
+
const anchors = lcs(before, after, (x, y) => x === y);
|
|
71
|
+
const out = [];
|
|
72
|
+
let i = 0;
|
|
73
|
+
let j = 0;
|
|
74
|
+
for (const [ai, aj] of [...anchors, [before.length, after.length]]) {
|
|
75
|
+
while (i < ai) out.push({
|
|
76
|
+
op: "remove",
|
|
77
|
+
text: before[i++] ?? ""
|
|
78
|
+
});
|
|
79
|
+
while (j < aj) out.push({
|
|
80
|
+
op: "add",
|
|
81
|
+
text: after[j++] ?? ""
|
|
82
|
+
});
|
|
83
|
+
if (i < before.length && j < after.length && ai < before.length) {
|
|
84
|
+
out.push({
|
|
85
|
+
op: "same",
|
|
86
|
+
text: before[i] ?? ""
|
|
87
|
+
});
|
|
88
|
+
i++;
|
|
89
|
+
j++;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/ops/diff-report.ts
|
|
96
|
+
function escapeHtml(text) {
|
|
97
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
98
|
+
}
|
|
99
|
+
function dataUrl(png) {
|
|
100
|
+
return png ? `data:image/png;base64,${Buffer.from(png).toString("base64")}` : "";
|
|
101
|
+
}
|
|
102
|
+
/** A sheet with its changed regions outlined, as percentages so it scales with the image. */
|
|
103
|
+
function sheet(png, boxes, size) {
|
|
104
|
+
const marks = boxes.map((box) => {
|
|
105
|
+
const left = box.x / size.width * 100;
|
|
106
|
+
const top = box.y / size.height * 100;
|
|
107
|
+
const width = box.width / size.width * 100;
|
|
108
|
+
const height = box.height / size.height * 100;
|
|
109
|
+
return `<span class="mark" style="left:${left.toFixed(2)}%;top:${top.toFixed(2)}%;width:${width.toFixed(2)}%;height:${height.toFixed(2)}%"></span>`;
|
|
110
|
+
}).join("");
|
|
111
|
+
return `<div class="sheet"><img src="${dataUrl(png)}" alt="" />${marks}</div>`;
|
|
112
|
+
}
|
|
113
|
+
/** PNG width and height, read from the IHDR chunk. */
|
|
114
|
+
function sizeOf(png) {
|
|
115
|
+
if (!png || png.length < 24) return {
|
|
116
|
+
width: 1,
|
|
117
|
+
height: 1
|
|
118
|
+
};
|
|
119
|
+
const view = new DataView(png.buffer, png.byteOffset, png.byteLength);
|
|
120
|
+
return {
|
|
121
|
+
width: view.getUint32(16) || 1,
|
|
122
|
+
height: view.getUint32(20) || 1
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const LABEL = {
|
|
126
|
+
same: "Unchanged",
|
|
127
|
+
changed: "Changed",
|
|
128
|
+
added: "Added",
|
|
129
|
+
removed: "Removed"
|
|
130
|
+
};
|
|
131
|
+
function pageName(change) {
|
|
132
|
+
if (change.after !== null && change.before !== null && change.after !== change.before) return `Page ${change.after} <span class="was">(was ${change.before})</span>`;
|
|
133
|
+
return `Page ${change.after ?? change.before}`;
|
|
134
|
+
}
|
|
135
|
+
function section(change, input) {
|
|
136
|
+
const before = change.before === null ? void 0 : input.before[change.before - 1];
|
|
137
|
+
const after = change.after === null ? void 0 : input.after[change.after - 1];
|
|
138
|
+
const head = `<h2>${pageName(change)} <span class="badge ${change.status}">${LABEL[change.status]}</span></h2>`;
|
|
139
|
+
if (change.status === "added") return `<section>${head}<div class="pair one"><figure class="added">${sheet(after, [], sizeOf(after))}<figcaption>New</figcaption></figure></div></section>`;
|
|
140
|
+
if (change.status === "removed") return `<section>${head}<div class="pair one"><figure class="removed">${sheet(before, [], sizeOf(before))}<figcaption>Removed</figcaption></figure></div></section>`;
|
|
141
|
+
const lines = change.lines.map((line) => `<li class="${line.op}"><span>${line.op === "add" ? "+" : "−"}</span>${escapeHtml(line.text)}</li>`).join("");
|
|
142
|
+
return `<section>${head}<div class="pair"><figure>${sheet(before, change.boxes, sizeOf(after))}<figcaption>Before · p. ${change.before}</figcaption></figure><figure>${sheet(after, change.boxes, sizeOf(after))}<figcaption>After · p. ${change.after}</figcaption></figure></div>${lines ? `<ul class="lines">${lines}</ul>` : "<p class=\"note\">Only the drawing changed — no text was added or removed.</p>"}</section>`;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The report `open-doc diff` writes: one self-contained HTML file, pictures
|
|
146
|
+
* inlined, so it can be sent to a reviewer who has neither the repository nor
|
|
147
|
+
* open-doc. Changed pages show before and after side by side with the changed
|
|
148
|
+
* regions outlined and the text that moved listed beneath; unchanged pages are
|
|
149
|
+
* a single line.
|
|
150
|
+
*/
|
|
151
|
+
function renderDiffReport(input) {
|
|
152
|
+
const count = (status) => input.pages.filter((page) => page.status === status).length;
|
|
153
|
+
const changed = count("changed");
|
|
154
|
+
const added = count("added");
|
|
155
|
+
const removed = count("removed");
|
|
156
|
+
const unchanged = input.pages.filter((page) => page.status === "same");
|
|
157
|
+
const summary = changed + added + removed === 0 ? "No changes." : [
|
|
158
|
+
changed && `${changed} changed`,
|
|
159
|
+
added && `${added} added`,
|
|
160
|
+
removed && `${removed} removed`,
|
|
161
|
+
unchanged.length && `${unchanged.length} unchanged`
|
|
162
|
+
].filter(Boolean).join(" · ");
|
|
163
|
+
const body = input.pages.filter((page) => page.status !== "same").map((page) => section(page, input)).join("");
|
|
164
|
+
const same = unchanged.length ? `<p class="note">Unchanged: ${unchanged.map((page) => `p. ${page.after}`).join(", ")}</p>` : "";
|
|
165
|
+
return `<!doctype html>
|
|
166
|
+
<html lang="en">
|
|
167
|
+
<head>
|
|
168
|
+
<meta charset="utf-8" />
|
|
169
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
170
|
+
<title>${escapeHtml(`${input.title} — changes since ${input.since}`)}</title>
|
|
171
|
+
<style>
|
|
172
|
+
:root { --text: #16181d; --muted: #6b7280; --rule: #e5e7eb; --bg: #f6f7f9; --add: #15803d; --remove: #b91c1c; --mark: #f59e0b; }
|
|
173
|
+
* { box-sizing: border-box; }
|
|
174
|
+
body { margin: 0; padding: 32px 16px 64px; background: var(--bg); color: var(--text);
|
|
175
|
+
font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Segoe UI", sans-serif; }
|
|
176
|
+
main { max-width: 1100px; margin: 0 auto; }
|
|
177
|
+
header h1 { margin: 0 0 4px; font-size: 22px; }
|
|
178
|
+
header p { margin: 0; color: var(--muted); }
|
|
179
|
+
code { font: 12px ui-monospace, Menlo, monospace; }
|
|
180
|
+
.summary { margin: 16px 0 8px; font-weight: 600; }
|
|
181
|
+
section { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--rule); }
|
|
182
|
+
h2 { margin: 0 0 12px; font-size: 16px; }
|
|
183
|
+
.was { color: var(--muted); font-weight: 400; }
|
|
184
|
+
.badge { margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; vertical-align: 2px; }
|
|
185
|
+
.badge.changed { background: #fef3c7; color: #92400e; }
|
|
186
|
+
.badge.added { background: #dcfce7; color: var(--add); }
|
|
187
|
+
.badge.removed { background: #fee2e2; color: var(--remove); }
|
|
188
|
+
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
|
|
189
|
+
.pair.one { grid-template-columns: minmax(0, 520px); }
|
|
190
|
+
@media (max-width: 720px) { .pair { grid-template-columns: 1fr; } }
|
|
191
|
+
figure { margin: 0; }
|
|
192
|
+
figcaption { margin-top: 6px; color: var(--muted); font-size: 12px; }
|
|
193
|
+
.sheet { position: relative; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
|
|
194
|
+
.sheet img { display: block; width: 100%; height: auto; }
|
|
195
|
+
.added .sheet { outline: 3px solid var(--add); }
|
|
196
|
+
.removed .sheet { outline: 3px solid var(--remove); opacity: 0.7; }
|
|
197
|
+
.mark { position: absolute; border: 2px solid var(--mark); background: rgb(245 158 11 / 0.12); border-radius: 2px; }
|
|
198
|
+
.lines { margin: 14px 0 0; padding: 0; list-style: none; font-size: 13px; }
|
|
199
|
+
.lines li { display: flex; gap: 8px; padding: 2px 8px; border-radius: 4px; }
|
|
200
|
+
.lines li span { flex: none; width: 1ch; font-weight: 700; }
|
|
201
|
+
.lines .add { background: #f0fdf4; color: var(--add); }
|
|
202
|
+
.lines .remove { background: #fef2f2; color: var(--remove); text-decoration: line-through; text-decoration-color: rgb(185 28 28 / 0.4); }
|
|
203
|
+
.note { color: var(--muted); }
|
|
204
|
+
</style>
|
|
205
|
+
</head>
|
|
206
|
+
<body>
|
|
207
|
+
<main>
|
|
208
|
+
<header>
|
|
209
|
+
<h1>${escapeHtml(input.title)}</h1>
|
|
210
|
+
<p>Changes since <code>${escapeHtml(input.since)}</code> (<code>${escapeHtml(input.commit.slice(0, 7))}</code>) · <code>${escapeHtml(input.docId)}</code></p>
|
|
211
|
+
</header>
|
|
212
|
+
<p class="summary">${summary}</p>
|
|
213
|
+
${same}
|
|
214
|
+
${body}
|
|
215
|
+
</main>
|
|
216
|
+
</body>
|
|
217
|
+
</html>
|
|
218
|
+
`;
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/ops/diff.ts
|
|
222
|
+
const run = promisify(execFile);
|
|
223
|
+
const MAX_BUFFER = 67108864;
|
|
224
|
+
async function git(cwd, args) {
|
|
225
|
+
const { stdout } = await run("git", args, {
|
|
226
|
+
cwd,
|
|
227
|
+
maxBuffer: MAX_BUFFER
|
|
228
|
+
});
|
|
229
|
+
return stdout;
|
|
230
|
+
}
|
|
231
|
+
async function gitBytes(cwd, args) {
|
|
232
|
+
const { stdout } = await run("git", args, {
|
|
233
|
+
cwd,
|
|
234
|
+
maxBuffer: MAX_BUFFER,
|
|
235
|
+
encoding: "buffer"
|
|
236
|
+
});
|
|
237
|
+
return stdout;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* The workspace as it was at `commit`, as far as one document needs it: its
|
|
241
|
+
* folder, the global assets, and the config. It lives inside the workspace so
|
|
242
|
+
* that `react` and `@open-document/core` resolve to the same installed copies
|
|
243
|
+
* the current version renders with.
|
|
244
|
+
*/
|
|
245
|
+
async function checkout(ctx, docId, commit) {
|
|
246
|
+
const prefix = (await git(ctx.userCwd, ["rev-parse", "--show-prefix"])).trim();
|
|
247
|
+
const dir = path.join(ctx.userCwd, ".open-doc-diff", `${commit.slice(0, 12)}-${docId}`);
|
|
248
|
+
await fs.rm(dir, {
|
|
249
|
+
recursive: true,
|
|
250
|
+
force: true
|
|
251
|
+
});
|
|
252
|
+
const docRel = path.relative(ctx.userCwd, path.join(ctx.docsRoot, docId));
|
|
253
|
+
const wanted = [
|
|
254
|
+
docRel,
|
|
255
|
+
path.relative(ctx.userCwd, ctx.globalAssetsRoot),
|
|
256
|
+
"open-doc.config.ts"
|
|
257
|
+
];
|
|
258
|
+
let exists = false;
|
|
259
|
+
for (const rel of wanted) {
|
|
260
|
+
const listed = await git(ctx.userCwd, [
|
|
261
|
+
"ls-tree",
|
|
262
|
+
"-r",
|
|
263
|
+
"--full-tree",
|
|
264
|
+
"--name-only",
|
|
265
|
+
commit,
|
|
266
|
+
"--",
|
|
267
|
+
`${prefix}${rel.split(path.sep).join("/")}`
|
|
268
|
+
]);
|
|
269
|
+
for (const file of listed.split("\n").filter(Boolean)) {
|
|
270
|
+
const local = file.slice(prefix.length);
|
|
271
|
+
const target = path.join(dir, local);
|
|
272
|
+
await fs.mkdir(path.dirname(target), { recursive: true });
|
|
273
|
+
await fs.writeFile(target, await gitBytes(ctx.userCwd, ["show", `${commit}:${file}`]));
|
|
274
|
+
if (rel === docRel) exists = true;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
const config = path.join(dir, "open-doc.config.ts");
|
|
278
|
+
try {
|
|
279
|
+
await fs.access(config);
|
|
280
|
+
} catch {
|
|
281
|
+
await fs.copyFile(path.join(ctx.userCwd, "open-doc.config.ts"), config).catch(() => {});
|
|
282
|
+
}
|
|
283
|
+
return {
|
|
284
|
+
dir,
|
|
285
|
+
exists
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
async function sheetsOf(session, docId) {
|
|
289
|
+
const renderer = await session.open(docId);
|
|
290
|
+
try {
|
|
291
|
+
return {
|
|
292
|
+
title: renderer.status.title || docId,
|
|
293
|
+
sheets: await renderer.sheets()
|
|
294
|
+
};
|
|
295
|
+
} finally {
|
|
296
|
+
await renderer.close();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
async function openSession(userCwd, origin) {
|
|
300
|
+
try {
|
|
301
|
+
return await createRenderSession({
|
|
302
|
+
userCwd,
|
|
303
|
+
...origin ? { origin } : {},
|
|
304
|
+
deviceScaleFactor: 1
|
|
305
|
+
});
|
|
306
|
+
} catch (err) {
|
|
307
|
+
if (err instanceof RenderUnavailableError) throw new OpsError(503, err.message);
|
|
308
|
+
throw err;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* What changed in a document since a revision, page by page: the old and new
|
|
313
|
+
* sheets rendered through the same print pipeline as an export, paired by
|
|
314
|
+
* content, compared as pictures and as text, and written up as a report a
|
|
315
|
+
* reviewer can read without the source.
|
|
316
|
+
*/
|
|
317
|
+
async function diffDocument(ctx, docId, opts = {}) {
|
|
318
|
+
if (!resolveEntry(ctx, docId)) throw new OpsError(404, `document not found: ${docId}`);
|
|
319
|
+
const since = opts.since ?? "HEAD";
|
|
320
|
+
let commit;
|
|
321
|
+
try {
|
|
322
|
+
commit = (await git(ctx.userCwd, [
|
|
323
|
+
"rev-parse",
|
|
324
|
+
"--verify",
|
|
325
|
+
`${since}^{commit}`
|
|
326
|
+
])).trim();
|
|
327
|
+
} catch {
|
|
328
|
+
throw new OpsError(400, `not a revision in this repository: ${since}`);
|
|
329
|
+
}
|
|
330
|
+
const outDir = path.resolve(ctx.userCwd, opts.outDir ?? "out");
|
|
331
|
+
if (outDir !== ctx.userCwd && !outDir.startsWith(ctx.userCwd + path.sep)) throw new OpsError(400, `outDir must stay inside the workspace: ${opts.outDir}`);
|
|
332
|
+
const old = await checkout(ctx, docId, commit);
|
|
333
|
+
const current = await openSession(ctx.userCwd, ctx.serverOrigin);
|
|
334
|
+
try {
|
|
335
|
+
let before = [];
|
|
336
|
+
if (old.exists) {
|
|
337
|
+
const past = await openSession(old.dir);
|
|
338
|
+
try {
|
|
339
|
+
before = (await sheetsOf(past, docId)).sheets;
|
|
340
|
+
} finally {
|
|
341
|
+
await past.close();
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
const after = await sheetsOf(current, docId);
|
|
345
|
+
const pairs = alignPages(before.map((sheet) => sheet.text), after.sheets.map((sheet) => sheet.text));
|
|
346
|
+
const pages = [];
|
|
347
|
+
for (const pair of pairs) {
|
|
348
|
+
const b = pair.before === null ? null : before[pair.before];
|
|
349
|
+
const a = pair.after === null ? null : after.sheets[pair.after];
|
|
350
|
+
const page = {
|
|
351
|
+
before: pair.before === null ? null : pair.before + 1,
|
|
352
|
+
after: pair.after === null ? null : pair.after + 1
|
|
353
|
+
};
|
|
354
|
+
if (!b || !a) {
|
|
355
|
+
pages.push({
|
|
356
|
+
...page,
|
|
357
|
+
status: b ? "removed" : "added",
|
|
358
|
+
lines: [],
|
|
359
|
+
boxes: []
|
|
360
|
+
});
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
const picture = await current.compareImages(b.png, a.png);
|
|
364
|
+
const lines = diffLines(textLines(b.text), textLines(a.text)).filter((line) => line.op !== "same");
|
|
365
|
+
const same = picture.boxes.length === 0 && lines.length === 0;
|
|
366
|
+
pages.push({
|
|
367
|
+
...page,
|
|
368
|
+
status: same ? "same" : "changed",
|
|
369
|
+
lines,
|
|
370
|
+
boxes: picture.boxes
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
await fs.mkdir(outDir, { recursive: true });
|
|
374
|
+
const file = path.join(outDir, `${docId}-diff.html`);
|
|
375
|
+
await fs.writeFile(file, renderDiffReport({
|
|
376
|
+
docId,
|
|
377
|
+
title: after.title,
|
|
378
|
+
since,
|
|
379
|
+
commit,
|
|
380
|
+
pages,
|
|
381
|
+
before: before.map((sheet) => sheet.png),
|
|
382
|
+
after: after.sheets.map((sheet) => sheet.png)
|
|
383
|
+
}));
|
|
384
|
+
return {
|
|
385
|
+
docId,
|
|
386
|
+
since,
|
|
387
|
+
commit,
|
|
388
|
+
pages,
|
|
389
|
+
file: path.relative(ctx.userCwd, file)
|
|
390
|
+
};
|
|
391
|
+
} finally {
|
|
392
|
+
await current.close();
|
|
393
|
+
await fs.rm(old.dir, {
|
|
394
|
+
recursive: true,
|
|
395
|
+
force: true
|
|
396
|
+
});
|
|
397
|
+
await fs.rmdir(path.dirname(old.dir)).catch(() => {});
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
//#endregion
|
|
401
|
+
export { diffDocument as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll as t };
|