@forumulate/cli 0.4.0 → 0.8.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 +116 -5
- package/dist/api/args.d.ts +21 -0
- package/dist/api/args.d.ts.map +1 -0
- package/dist/api/args.js +81 -0
- package/dist/api/args.js.map +1 -0
- package/dist/api/command.d.ts +17 -0
- package/dist/api/command.d.ts.map +1 -0
- package/dist/api/command.js +182 -0
- package/dist/api/command.js.map +1 -0
- package/dist/api/describe.d.ts +5 -0
- package/dist/api/describe.d.ts.map +1 -0
- package/dist/api/describe.js +121 -0
- package/dist/api/describe.js.map +1 -0
- package/dist/api/http.d.ts +81 -0
- package/dist/api/http.d.ts.map +1 -0
- package/dist/api/http.js +183 -0
- package/dist/api/http.js.map +1 -0
- package/dist/api/operations.json +1 -0
- package/dist/api/output.d.ts +35 -0
- package/dist/api/output.d.ts.map +1 -0
- package/dist/api/output.js +176 -0
- package/dist/api/output.js.map +1 -0
- package/dist/api/request.d.ts +37 -0
- package/dist/api/request.d.ts.map +1 -0
- package/dist/api/request.js +230 -0
- package/dist/api/request.js.map +1 -0
- package/dist/api/send.d.ts +35 -0
- package/dist/api/send.d.ts.map +1 -0
- package/dist/api/send.js +85 -0
- package/dist/api/send.js.map +1 -0
- package/dist/api/spec.d.ts +96 -0
- package/dist/api/spec.d.ts.map +1 -0
- package/dist/api/spec.js +126 -0
- package/dist/api/spec.js.map +1 -0
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/completion.d.ts +12 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +153 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/commands/config.d.ts +33 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +144 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/context.d.ts +35 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +59 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/groups-api.d.ts +11 -0
- package/dist/commands/groups-api.d.ts.map +1 -0
- package/dist/commands/groups-api.js +140 -0
- package/dist/commands/groups-api.js.map +1 -0
- package/dist/commands/groups-community.d.ts +15 -0
- package/dist/commands/groups-community.d.ts.map +1 -0
- package/dist/commands/groups-community.js +344 -0
- package/dist/commands/groups-community.js.map +1 -0
- package/dist/commands/groups-content.d.ts +10 -0
- package/dist/commands/groups-content.d.ts.map +1 -0
- package/dist/commands/groups-content.js +331 -0
- package/dist/commands/groups-content.js.map +1 -0
- package/dist/commands/groups-docs.d.ts +12 -0
- package/dist/commands/groups-docs.d.ts.map +1 -0
- package/dist/commands/groups-docs.js +414 -0
- package/dist/commands/groups-docs.js.map +1 -0
- package/dist/commands/groups-org.d.ts +10 -0
- package/dist/commands/groups-org.d.ts.map +1 -0
- package/dist/commands/groups-org.js +405 -0
- package/dist/commands/groups-org.js.map +1 -0
- package/dist/commands/groups-site.d.ts +3 -0
- package/dist/commands/groups-site.d.ts.map +1 -0
- package/dist/commands/groups-site.js +230 -0
- package/dist/commands/groups-site.js.map +1 -0
- package/dist/commands/groups-spaces.d.ts +3 -0
- package/dist/commands/groups-spaces.d.ts.map +1 -0
- package/dist/commands/groups-spaces.js +273 -0
- package/dist/commands/groups-spaces.js.map +1 -0
- package/dist/commands/groups-types.d.ts +3 -0
- package/dist/commands/groups-types.d.ts.map +1 -0
- package/dist/commands/groups-types.js +251 -0
- package/dist/commands/groups-types.js.map +1 -0
- package/dist/commands/groups.d.ts +4 -0
- package/dist/commands/groups.d.ts.map +1 -0
- package/dist/commands/groups.js +71 -0
- package/dist/commands/groups.js.map +1 -0
- package/dist/commands/index.d.ts +25 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +118 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/resource.d.ts +86 -0
- package/dist/commands/resource.d.ts.map +1 -0
- package/dist/commands/resource.js +314 -0
- package/dist/commands/resource.js.map +1 -0
- package/dist/content/command.d.ts +34 -0
- package/dist/content/command.d.ts.map +1 -0
- package/dist/content/command.js +225 -0
- package/dist/content/command.js.map +1 -0
- package/dist/content/library.d.ts +23 -0
- package/dist/content/library.d.ts.map +1 -0
- package/dist/content/library.js +41 -0
- package/dist/content/library.js.map +1 -0
- package/dist/content/render.d.ts +15 -0
- package/dist/content/render.d.ts.map +1 -0
- package/dist/content/render.js +85 -0
- package/dist/content/render.js.map +1 -0
- package/dist/content/types-gen.d.ts +40 -0
- package/dist/content/types-gen.d.ts.map +1 -0
- package/dist/content/types-gen.js +200 -0
- package/dist/content/types-gen.js.map +1 -0
- package/dist/help.d.ts +3 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +142 -0
- package/dist/help.js.map +1 -0
- package/dist/import/coerce.d.ts +34 -0
- package/dist/import/coerce.d.ts.map +1 -0
- package/dist/import/coerce.js +134 -0
- package/dist/import/coerce.js.map +1 -0
- package/dist/import/command.d.ts +25 -0
- package/dist/import/command.d.ts.map +1 -0
- package/dist/import/command.js +127 -0
- package/dist/import/command.js.map +1 -0
- package/dist/import/config.d.ts +39 -0
- package/dist/import/config.d.ts.map +1 -0
- package/dist/import/config.js +48 -0
- package/dist/import/config.js.map +1 -0
- package/dist/import/contentful.d.ts +3 -0
- package/dist/import/contentful.d.ts.map +1 -0
- package/dist/import/contentful.js +179 -0
- package/dist/import/contentful.js.map +1 -0
- package/dist/import/disk.d.ts +4 -0
- package/dist/import/disk.d.ts.map +1 -0
- package/dist/import/disk.js +19 -0
- package/dist/import/disk.js.map +1 -0
- package/dist/import/engine-locales.d.ts +35 -0
- package/dist/import/engine-locales.d.ts.map +1 -0
- package/dist/import/engine-locales.js +61 -0
- package/dist/import/engine-locales.js.map +1 -0
- package/dist/import/engine.d.ts +29 -0
- package/dist/import/engine.d.ts.map +1 -0
- package/dist/import/engine.js +248 -0
- package/dist/import/engine.js.map +1 -0
- package/dist/import/media.d.ts +24 -0
- package/dist/import/media.d.ts.map +1 -0
- package/dist/import/media.js +39 -0
- package/dist/import/media.js.map +1 -0
- package/dist/import/model-fields.d.ts +22 -0
- package/dist/import/model-fields.d.ts.map +1 -0
- package/dist/import/model-fields.js +60 -0
- package/dist/import/model-fields.js.map +1 -0
- package/dist/import/payload/index.d.ts +9 -0
- package/dist/import/payload/index.d.ts.map +1 -0
- package/dist/import/payload/index.js +129 -0
- package/dist/import/payload/index.js.map +1 -0
- package/dist/import/report.d.ts +5 -0
- package/dist/import/report.d.ts.map +1 -0
- package/dist/import/report.js +52 -0
- package/dist/import/report.js.map +1 -0
- package/dist/import/richtext-core.d.ts +26 -0
- package/dist/import/richtext-core.d.ts.map +1 -0
- package/dist/import/richtext-core.js +65 -0
- package/dist/import/richtext-core.js.map +1 -0
- package/dist/import/richtext-html.d.ts +5 -0
- package/dist/import/richtext-html.d.ts.map +1 -0
- package/dist/import/richtext-html.js +311 -0
- package/dist/import/richtext-html.js.map +1 -0
- package/dist/import/richtext-json.d.ts +10 -0
- package/dist/import/richtext-json.d.ts.map +1 -0
- package/dist/import/richtext-json.js +250 -0
- package/dist/import/richtext-json.js.map +1 -0
- package/dist/import/sanity.d.ts +8 -0
- package/dist/import/sanity.d.ts.map +1 -0
- package/dist/import/sanity.js +158 -0
- package/dist/import/sanity.js.map +1 -0
- package/dist/import/strapi-archive.d.ts +6 -0
- package/dist/import/strapi-archive.d.ts.map +1 -0
- package/dist/import/strapi-archive.js +127 -0
- package/dist/import/strapi-archive.js.map +1 -0
- package/dist/import/strapi.d.ts +7 -0
- package/dist/import/strapi.d.ts.map +1 -0
- package/dist/import/strapi.js +185 -0
- package/dist/import/strapi.js.map +1 -0
- package/dist/import/tar.d.ts +3 -0
- package/dist/import/tar.d.ts.map +1 -0
- package/dist/import/tar.js +48 -0
- package/dist/import/tar.js.map +1 -0
- package/dist/import/types.d.ts +157 -0
- package/dist/import/types.d.ts.map +1 -0
- package/dist/import/types.js +12 -0
- package/dist/import/types.js.map +1 -0
- package/dist/import/wordpress.d.ts +15 -0
- package/dist/import/wordpress.d.ts.map +1 -0
- package/dist/import/wordpress.js +147 -0
- package/dist/import/wordpress.js.map +1 -0
- package/dist/publish/scan.d.ts +1 -1
- package/dist/publish/scan.d.ts.map +1 -1
- package/dist/publish/scan.js +2 -2
- package/dist/publish/scan.js.map +1 -1
- package/dist/publish-dir.d.ts +54 -0
- package/dist/publish-dir.d.ts.map +1 -0
- package/dist/publish-dir.js +119 -0
- package/dist/publish-dir.js.map +1 -0
- package/dist/run.d.ts +21 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +70 -65
- package/dist/run.js.map +1 -1
- package/dist/translations/command.d.ts +36 -0
- package/dist/translations/command.d.ts.map +1 -0
- package/dist/translations/command.js +411 -0
- package/dist/translations/command.js.map +1 -0
- package/dist/translations/extras.d.ts +29 -0
- package/dist/translations/extras.d.ts.map +1 -0
- package/dist/translations/extras.js +123 -0
- package/dist/translations/extras.js.map +1 -0
- package/dist/translations/files.d.ts +22 -0
- package/dist/translations/files.d.ts.map +1 -0
- package/dist/translations/files.js +75 -0
- package/dist/translations/files.js.map +1 -0
- package/dist/translations/sync.d.ts +89 -0
- package/dist/translations/sync.d.ts.map +1 -0
- package/dist/translations/sync.js +215 -0
- package/dist/translations/sync.js.map +1 -0
- package/dist/translations/target.d.ts +33 -0
- package/dist/translations/target.d.ts.map +1 -0
- package/dist/translations/target.js +54 -0
- package/dist/translations/target.js.map +1 -0
- package/dist/translations/xliff.d.ts +29 -0
- package/dist/translations/xliff.d.ts.map +1 -0
- package/dist/translations/xliff.js +62 -0
- package/dist/translations/xliff.js.map +1 -0
- package/package.json +6 -4
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exitCode = void 0;
|
|
4
|
+
exports.reportLines = reportLines;
|
|
5
|
+
/**
|
|
6
|
+
* The report of an import as lines a person reads: what the model needed,
|
|
7
|
+
* what landed, and above all what did NOT, since an import that says only
|
|
8
|
+
* "done" hides exactly the part the author has to act on.
|
|
9
|
+
*/
|
|
10
|
+
const render_1 = require("../content/render");
|
|
11
|
+
function reportLines(r) {
|
|
12
|
+
const out = [];
|
|
13
|
+
const verb = r.dryRun ? 'would be' : 'were';
|
|
14
|
+
out.push(r.model.changed
|
|
15
|
+
? `Model: ${r.dryRun ? 'would change' : 'changed'} (version ${r.model.version ?? '?'}).`
|
|
16
|
+
: 'Model: unchanged.');
|
|
17
|
+
out.push(...(0, render_1.issueLines)(r.model.issues));
|
|
18
|
+
if (r.dryRun) {
|
|
19
|
+
out.push(`${r.entries.planned} entr${r.entries.planned === 1 ? 'y' : 'ies'} and ${r.media.planned} file${r.media.planned === 1 ? '' : 's'} ${verb} imported from ${r.source}.`);
|
|
20
|
+
if (r.plan)
|
|
21
|
+
out.push(` ${r.plan.new} new, ${r.plan.update} already imported before (they would be updated in place).`);
|
|
22
|
+
if (r.entries.translations)
|
|
23
|
+
out.push(` ${r.entries.translations} translation${r.entries.translations === 1 ? '' : 's'} (locale twins) would be written.`);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
out.push(`Media: ${r.media.uploaded} uploaded of ${r.media.planned} (files already in the library are reused).`);
|
|
27
|
+
out.push(`Entries: ${r.entries.created} created, ${r.entries.updated} updated of ${r.entries.planned}, ${r.entries.published} published.`);
|
|
28
|
+
if (r.entries.translations)
|
|
29
|
+
out.push(`Translations: ${r.entries.translations} locale twin${r.entries.translations === 1 ? '' : 's'} written.`);
|
|
30
|
+
}
|
|
31
|
+
if (r.dropped.length) {
|
|
32
|
+
out.push(`Values with no matching field in the model (${r.dropped.length}):`);
|
|
33
|
+
for (const d of r.dropped)
|
|
34
|
+
out.push(` ${d.field} ×${d.count}`);
|
|
35
|
+
}
|
|
36
|
+
if (r.unresolved.length) {
|
|
37
|
+
out.push(`References to records that are not in the export (${r.unresolved.length}):`);
|
|
38
|
+
for (const u of r.unresolved)
|
|
39
|
+
out.push(` ${u.from} → ${u.to}`);
|
|
40
|
+
}
|
|
41
|
+
for (const f of r.media.failed)
|
|
42
|
+
out.push(`Media failed: ${f.id}: ${f.message}`);
|
|
43
|
+
for (const f of r.entries.failed)
|
|
44
|
+
out.push(`Entry failed: ${f.type} ${f.id}: ${f.message}`);
|
|
45
|
+
for (const n of r.notes)
|
|
46
|
+
out.push(`Note: ${n}`);
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
/** Non-zero when anything failed, so a script can tell a clean import from a partial one. */
|
|
50
|
+
const exitCode = (r) => (r.entries.failed.length || r.media.failed.length ? 1 : 0);
|
|
51
|
+
exports.exitCode = exitCode;
|
|
52
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/import/report.ts"],"names":[],"mappings":";;;AAQA,kCA8BC;AAtCD;;;;GAIG;AACH,8CAA+C;AAG/C,SAAgB,WAAW,CAAC,CAAe;IACzC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5C,GAAG,CAAC,IAAI,CACN,CAAC,CAAC,KAAK,CAAC,OAAO;QACb,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,aAAa,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,GAAG,IAAI;QACxF,CAAC,CAAC,mBAAmB,CACxB,CAAC;IACF,GAAG,CAAC,IAAI,CAAC,GAAG,IAAA,mBAAU,EAAC,CAAC,CAAC,KAAK,CAAC,MAAe,CAAC,CAAC,CAAC;IACjD,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;QACb,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,QAAQ,CAAC,CAAC,OAAO,CAAC,OAAO,K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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAAnG,QAAA,QAAQ,YAA2F"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Building blocks every rich-text reader uses to write a BlockDoc.
|
|
3
|
+
*
|
|
4
|
+
* Text is held as runs with a set of marks and only turned into nodes at the
|
|
5
|
+
* end, so adjacent runs with the same marks merge (a source that splits
|
|
6
|
+
* "Hello" into five spans must not become five nodes) and empty text is never
|
|
7
|
+
* written (the block model refuses it).
|
|
8
|
+
*/
|
|
9
|
+
import type { DocNode, RichDoc } from './types';
|
|
10
|
+
export type MarkName = 'bold' | 'italic' | 'code' | 'strike' | 'underline';
|
|
11
|
+
export interface Run {
|
|
12
|
+
text: string;
|
|
13
|
+
marks: MarkName[];
|
|
14
|
+
href?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function textNodes(runs: Run[]): DocNode[];
|
|
17
|
+
export declare const paragraph: (runs: Run[]) => DocNode;
|
|
18
|
+
export declare const heading: (level: number, runs: Run[]) => DocNode;
|
|
19
|
+
export declare const codeBlock: (code: string, language?: string | null) => DocNode;
|
|
20
|
+
export declare const image: (src: string, alt?: string) => DocNode;
|
|
21
|
+
export declare const list: (ordered: boolean, items: DocNode[][]) => DocNode;
|
|
22
|
+
/** A document is never empty: the editor and the block model both need one block. */
|
|
23
|
+
export declare function doc(content: DocNode[]): RichDoc;
|
|
24
|
+
/** The `http(s)`, `mailto:`, relative and `#` links a document may carry; `javascript:` and friends are dropped. */
|
|
25
|
+
export declare function safeHref(href: string | undefined | null): string | undefined;
|
|
26
|
+
//# sourceMappingURL=richtext-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richtext-core.d.ts","sourceRoot":"","sources":["../../src/import/richtext-core.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEhD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC;AAC3E,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAID,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,CAoBhD;AAED,eAAO,MAAM,SAAS,GAAI,MAAM,GAAG,EAAE,KAAG,OAGvC,CAAC;AACF,eAAO,MAAM,OAAO,GAAI,OAAO,MAAM,EAAE,MAAM,GAAG,EAAE,KAAG,OAInD,CAAC;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,GAAG,IAAI,KAAG,OAIjE,CAAC;AACH,eAAO,MAAM,KAAK,GAAI,KAAK,MAAM,EAAE,MAAM,MAAM,KAAG,OAAuE,CAAC;AAC1H,eAAO,MAAM,IAAI,GAAI,SAAS,OAAO,EAAE,OAAO,OAAO,EAAE,EAAE,KAAG,OAG1D,CAAC;AAEH,qFAAqF;AACrF,wBAAgB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAE/C;AAED,oHAAoH;AACpH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAI5E"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.list = exports.image = exports.codeBlock = exports.heading = exports.paragraph = void 0;
|
|
4
|
+
exports.textNodes = textNodes;
|
|
5
|
+
exports.doc = doc;
|
|
6
|
+
exports.safeHref = safeHref;
|
|
7
|
+
const ORDER = ['bold', 'italic', 'strike', 'underline', 'code'];
|
|
8
|
+
function textNodes(runs) {
|
|
9
|
+
const out = [];
|
|
10
|
+
let last;
|
|
11
|
+
for (const r of runs) {
|
|
12
|
+
if (r.text === '\n') {
|
|
13
|
+
out.push({ type: 'hardBreak' });
|
|
14
|
+
last = undefined;
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (!r.text)
|
|
18
|
+
continue;
|
|
19
|
+
const same = (a, b) => a.href === b.href && a.marks.length === b.marks.length && a.marks.every((m) => b.marks.includes(m));
|
|
20
|
+
if (last && same(last, r)) {
|
|
21
|
+
out[out.length - 1].text += r.text;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const marks = [...ORDER.filter((m) => r.marks.includes(m)).map((type) => ({ type })), ...(r.href ? [{ type: 'link', attrs: { href: r.href } }] : [])];
|
|
25
|
+
out.push({ type: 'text', text: r.text, ...(marks.length ? { marks } : {}) });
|
|
26
|
+
last = r;
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
const paragraph = (runs) => {
|
|
31
|
+
const content = textNodes(runs);
|
|
32
|
+
return content.length ? { type: 'paragraph', content } : { type: 'paragraph' };
|
|
33
|
+
};
|
|
34
|
+
exports.paragraph = paragraph;
|
|
35
|
+
const heading = (level, runs) => ({
|
|
36
|
+
type: 'heading',
|
|
37
|
+
attrs: { level: Math.min(6, Math.max(1, level)) },
|
|
38
|
+
content: textNodes(runs),
|
|
39
|
+
});
|
|
40
|
+
exports.heading = heading;
|
|
41
|
+
const codeBlock = (code, language) => ({
|
|
42
|
+
type: 'codeBlock',
|
|
43
|
+
attrs: language ? { language } : {},
|
|
44
|
+
...(code ? { content: [{ type: 'text', text: code }] } : {}),
|
|
45
|
+
});
|
|
46
|
+
exports.codeBlock = codeBlock;
|
|
47
|
+
const image = (src, alt) => ({ type: 'image', attrs: { src, ...(alt ? { alt } : {}) } });
|
|
48
|
+
exports.image = image;
|
|
49
|
+
const list = (ordered, items) => ({
|
|
50
|
+
type: ordered ? 'orderedList' : 'bulletList',
|
|
51
|
+
content: items.map((content) => ({ type: 'listItem', content: content.length ? content : [{ type: 'paragraph' }] })),
|
|
52
|
+
});
|
|
53
|
+
exports.list = list;
|
|
54
|
+
/** A document is never empty: the editor and the block model both need one block. */
|
|
55
|
+
function doc(content) {
|
|
56
|
+
return { type: 'doc', content: content.length ? content : [{ type: 'paragraph' }] };
|
|
57
|
+
}
|
|
58
|
+
/** The `http(s)`, `mailto:`, relative and `#` links a document may carry; `javascript:` and friends are dropped. */
|
|
59
|
+
function safeHref(href) {
|
|
60
|
+
if (!href)
|
|
61
|
+
return undefined;
|
|
62
|
+
const h = href.trim();
|
|
63
|
+
return /^(https?:|mailto:|tel:|\/|#|\.{1,2}\/)/i.test(h) || !/^[a-z][a-z0-9+.-]*:/i.test(h) ? h : undefined;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=richtext-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richtext-core.js","sourceRoot":"","sources":["../../src/import/richtext-core.ts"],"names":[],"mappings":";;;AAmBA,8BAoBC;AAuBD,kBAEC;AAGD,4BAIC;AAtDD,MAAM,KAAK,GAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;AAE5E,SAAgB,SAAS,CAAC,IAAW;IACnC,MAAM,GAAG,GAAc,EAAE,CAAC;IAC1B,IAAI,IAAqB,CAAC;IAC1B,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACpB,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;YAChC,IAAI,GAAG,SAAS,CAAC;YACjB,SAAS;QACX,CAAC;QACD,IAAI,CAAC,CAAC,CAAC,IAAI;YAAE,SAAS;QACtB,MAAM,IAAI,GAAG,CAAC,CAAM,EAAE,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC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,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY;IAC5C,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC;CACrH,CAAC,CAAC;AAHU,QAAA,IAAI,QAGd;AAEH,qFAAqF;AACrF,SAAgB,GAAG,CAAC,OAAkB;IACpC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;AACtF,CAAC;AAED,oHAAoH;AACpH,SAAgB,QAAQ,CAAC,IAA+B;IACtD,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IACtB,OAAO,yCAAyC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9G,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ImageResolver, RichDoc } from './types';
|
|
2
|
+
export declare function decodeEntities(s: string): string;
|
|
3
|
+
export declare function fromHtml(html: string, imageOf: ImageResolver): RichDoc;
|
|
4
|
+
export declare function fromMarkdown(md: string, imageOf: ImageResolver): RichDoc;
|
|
5
|
+
//# sourceMappingURL=richtext-html.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richtext-html.d.ts","sourceRoot":"","sources":["../../src/import/richtext-html.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAW,aAAa,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAG/D,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAQhD;AAuKD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAItE;AA6BD,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CA0DxE"}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decodeEntities = decodeEntities;
|
|
4
|
+
exports.fromHtml = fromHtml;
|
|
5
|
+
exports.fromMarkdown = fromMarkdown;
|
|
6
|
+
/**
|
|
7
|
+
* HTML and Markdown to a BlockDoc: the rich text of WordPress (HTML), Strapi 4
|
|
8
|
+
* (Markdown) and anything an export carries as a string.
|
|
9
|
+
*
|
|
10
|
+
* Deliberately a small tolerant reader, not a browser: it understands the
|
|
11
|
+
* structure a rich-text editor writes (paragraphs, headings, lists, quotes,
|
|
12
|
+
* code, pictures, links, bold/italic/code/strike/underline) and turns the
|
|
13
|
+
* rest into its text. A tag it does not know never loses its words, and a
|
|
14
|
+
* `<script>` or `<style>` loses everything, because it is not content.
|
|
15
|
+
*/
|
|
16
|
+
const richtext_core_1 = require("./richtext-core");
|
|
17
|
+
const ENTITIES = { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'", nbsp: ' ', hellip: '…', mdash: '—', ndash: '–', rsquo: '’', lsquo: '‘', rdquo: '”', ldquo: '“' };
|
|
18
|
+
function decodeEntities(s) {
|
|
19
|
+
return s.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi, (m, e) => {
|
|
20
|
+
if (e[0] === '#') {
|
|
21
|
+
const code = e[1] === 'x' || e[1] === 'X' ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10);
|
|
22
|
+
return Number.isFinite(code) && code > 0 && code < 0x110000 ? String.fromCodePoint(code) : m;
|
|
23
|
+
}
|
|
24
|
+
return ENTITIES[e.toLowerCase()] ?? m;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const VOID = new Set(['br', 'hr', 'img', 'input', 'meta', 'link', 'source', 'wbr']);
|
|
28
|
+
const SKIP = new Set(['script', 'style', 'head', 'template', 'noscript']);
|
|
29
|
+
function parse(html) {
|
|
30
|
+
const root = { tag: '#root', attrs: {}, children: [] };
|
|
31
|
+
const stack = [root];
|
|
32
|
+
const re = /<!--[\s\S]*?-->|<(\/?)([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^'">])*)>|([^<]+|<)/g;
|
|
33
|
+
for (let m; (m = re.exec(html));) {
|
|
34
|
+
const top = stack[stack.length - 1];
|
|
35
|
+
if (m[4] !== undefined) {
|
|
36
|
+
top.children.push(m[4]);
|
|
37
|
+
}
|
|
38
|
+
else if (m[2]) {
|
|
39
|
+
const tag = m[2].toLowerCase();
|
|
40
|
+
if (m[1]) {
|
|
41
|
+
const at = stack.map((e) => e.tag).lastIndexOf(tag);
|
|
42
|
+
if (at > 0)
|
|
43
|
+
stack.length = at;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const attrs = {};
|
|
47
|
+
for (const a of (m[3] ?? '').matchAll(/([^\s=/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g)) {
|
|
48
|
+
attrs[a[1].toLowerCase()] = decodeEntities(a[2] ?? a[3] ?? a[4] ?? '');
|
|
49
|
+
}
|
|
50
|
+
const el = { tag, attrs, children: [] };
|
|
51
|
+
top.children.push(el);
|
|
52
|
+
// <p> and <li> close themselves when the next one opens, as in a browser.
|
|
53
|
+
if (!VOID.has(tag) && !/\/\s*$/.test(m[3] ?? ''))
|
|
54
|
+
stack.push(el);
|
|
55
|
+
if (SKIP.has(tag)) {
|
|
56
|
+
const end = html.toLowerCase().indexOf(`</${tag}`, re.lastIndex);
|
|
57
|
+
if (end >= 0)
|
|
58
|
+
re.lastIndex = html.indexOf('>', end) + 1 || html.length;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return root;
|
|
64
|
+
}
|
|
65
|
+
const MARKS = { strong: 'bold', b: 'bold', em: 'italic', i: 'italic', code: 'code', s: 'strike', del: 'strike', strike: 'strike', u: 'underline' };
|
|
66
|
+
function inline(el, marks, href, out, ctx) {
|
|
67
|
+
if (typeof el === 'string') {
|
|
68
|
+
out.push({ text: decodeEntities(el).replace(/\s+/g, ' '), marks, href });
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (SKIP.has(el.tag))
|
|
72
|
+
return;
|
|
73
|
+
if (el.tag === 'br')
|
|
74
|
+
return void out.push({ text: '\n', marks: [] });
|
|
75
|
+
if (el.tag === 'img') {
|
|
76
|
+
// A picture in the middle of a line closes the line: a block model has no inline images.
|
|
77
|
+
flush(out, ctx);
|
|
78
|
+
if (el.attrs.src)
|
|
79
|
+
ctx.blocks.push((0, richtext_core_1.image)(ctx.image(el.attrs.src, el.attrs.alt), el.attrs.alt));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const mark = MARKS[el.tag];
|
|
83
|
+
const next = mark && !marks.includes(mark) ? [...marks, mark] : marks;
|
|
84
|
+
const link = el.tag === 'a' ? ((0, richtext_core_1.safeHref)(el.attrs.href) ?? href) : href;
|
|
85
|
+
for (const c of el.children)
|
|
86
|
+
inline(c, next, link, out, ctx);
|
|
87
|
+
}
|
|
88
|
+
function flush(runs, ctx) {
|
|
89
|
+
if (!runs.length)
|
|
90
|
+
return;
|
|
91
|
+
// Collapse the whitespace a source indents with, but keep the single space between words.
|
|
92
|
+
const trimmed = runs.map((r) => ({ ...r }));
|
|
93
|
+
while (trimmed.length && trimmed[0].text !== '\n' && !trimmed[0].text.trim())
|
|
94
|
+
trimmed.shift();
|
|
95
|
+
while (trimmed.length && trimmed[trimmed.length - 1].text !== '\n' && !trimmed[trimmed.length - 1].text.trim())
|
|
96
|
+
trimmed.pop();
|
|
97
|
+
if (trimmed.length) {
|
|
98
|
+
trimmed[0].text = trimmed[0].text.replace(/^\s+/, '');
|
|
99
|
+
trimmed[trimmed.length - 1].text = trimmed[trimmed.length - 1].text.replace(/\s+$/, '');
|
|
100
|
+
if (trimmed.some((r) => r.text))
|
|
101
|
+
ctx.blocks.push((0, richtext_core_1.paragraph)(trimmed));
|
|
102
|
+
}
|
|
103
|
+
runs.length = 0;
|
|
104
|
+
}
|
|
105
|
+
const INLINE_TAGS = new Set(['a', 'span', 'strong', 'b', 'em', 'i', 'code', 's', 'del', 'strike', 'u', 'small', 'mark', 'sub', 'sup', 'abbr', 'cite', 'font', 'label', 'br', 'img']);
|
|
106
|
+
function textOf(el) {
|
|
107
|
+
if (typeof el === 'string')
|
|
108
|
+
return decodeEntities(el);
|
|
109
|
+
if (SKIP.has(el.tag))
|
|
110
|
+
return '';
|
|
111
|
+
return el.tag === 'br' ? '\n' : el.children.map(textOf).join('');
|
|
112
|
+
}
|
|
113
|
+
function blocksOf(children, ctx, into = ctx.blocks) {
|
|
114
|
+
const outer = ctx.blocks;
|
|
115
|
+
ctx.blocks = into;
|
|
116
|
+
const run = [];
|
|
117
|
+
for (const c of children) {
|
|
118
|
+
if (typeof c === 'string' || INLINE_TAGS.has(c.tag)) {
|
|
119
|
+
inline(c, [], undefined, run, ctx);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
flush(run, ctx);
|
|
123
|
+
block(c, ctx);
|
|
124
|
+
}
|
|
125
|
+
flush(run, ctx);
|
|
126
|
+
ctx.blocks = outer;
|
|
127
|
+
}
|
|
128
|
+
function block(el, ctx) {
|
|
129
|
+
if (SKIP.has(el.tag))
|
|
130
|
+
return;
|
|
131
|
+
const lvl = /^h([1-6])$/.exec(el.tag);
|
|
132
|
+
if (lvl) {
|
|
133
|
+
const runs = [];
|
|
134
|
+
el.children.forEach((c) => inline(c, [], undefined, runs, ctx));
|
|
135
|
+
const h = (0, richtext_core_1.heading)(Number(lvl[1]), runs);
|
|
136
|
+
if (h.content?.length)
|
|
137
|
+
ctx.blocks.push(h);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
switch (el.tag) {
|
|
141
|
+
case 'p': {
|
|
142
|
+
const runs = [];
|
|
143
|
+
el.children.forEach((c) => inline(c, [], undefined, runs, ctx));
|
|
144
|
+
flush(runs, ctx);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
case 'ul':
|
|
148
|
+
case 'ol': {
|
|
149
|
+
const items = el.children.filter((c) => typeof c !== 'string' && c.tag === 'li');
|
|
150
|
+
if (!items.length)
|
|
151
|
+
return;
|
|
152
|
+
ctx.blocks.push((0, richtext_core_1.list)(el.tag === 'ol', items.map((li) => { const into = []; blocksOf(li.children, ctx, into); return into; })));
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
case 'blockquote': {
|
|
156
|
+
const into = [];
|
|
157
|
+
blocksOf(el.children, ctx, into);
|
|
158
|
+
if (into.length)
|
|
159
|
+
ctx.blocks.push({ type: 'blockquote', content: into });
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
case 'pre': {
|
|
163
|
+
const codeEl = el.children.find((c) => typeof c !== 'string' && c.tag === 'code');
|
|
164
|
+
const lang = /(?:language|lang)-([\w+#-]+)/.exec(codeEl?.attrs.class ?? el.attrs.class ?? '')?.[1];
|
|
165
|
+
ctx.blocks.push((0, richtext_core_1.codeBlock)(textOf(codeEl ?? el).replace(/\n$/, ''), lang));
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
case 'hr':
|
|
169
|
+
ctx.blocks.push({ type: 'horizontalRule' });
|
|
170
|
+
return;
|
|
171
|
+
case 'img':
|
|
172
|
+
if (el.attrs.src)
|
|
173
|
+
ctx.blocks.push((0, richtext_core_1.image)(ctx.image(el.attrs.src, el.attrs.alt), el.attrs.alt));
|
|
174
|
+
return;
|
|
175
|
+
case 'figure': {
|
|
176
|
+
const img = el.children.find((c) => typeof c !== 'string' && (c.tag === 'img' || (c.tag === 'a' && c.children.some((x) => typeof x !== 'string' && x.tag === 'img'))));
|
|
177
|
+
const imgEl = img?.tag === 'a' ? img.children.find((x) => typeof x !== 'string' && x.tag === 'img') : img;
|
|
178
|
+
const cap = el.children.find((c) => typeof c !== 'string' && c.tag === 'figcaption');
|
|
179
|
+
if (imgEl?.attrs.src) {
|
|
180
|
+
const caption = cap ? textOf(cap).trim() : '';
|
|
181
|
+
const node = (0, richtext_core_1.image)(ctx.image(imgEl.attrs.src, imgEl.attrs.alt), imgEl.attrs.alt);
|
|
182
|
+
if (caption)
|
|
183
|
+
node.attrs.caption = caption;
|
|
184
|
+
ctx.blocks.push(node);
|
|
185
|
+
}
|
|
186
|
+
else
|
|
187
|
+
blocksOf(el.children, ctx);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
default:
|
|
191
|
+
// div, section, table, figure parts…: keep the words, lose the wrapper.
|
|
192
|
+
blocksOf(el.children, ctx);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function fromHtml(html, imageOf) {
|
|
196
|
+
const ctx = { image: imageOf, blocks: [] };
|
|
197
|
+
blocksOf(parse(html).children, ctx);
|
|
198
|
+
return (0, richtext_core_1.doc)(ctx.blocks);
|
|
199
|
+
}
|
|
200
|
+
/* ---------------------------- Markdown ---------------------------- */
|
|
201
|
+
function inlineMd(s, resolve, blocks) {
|
|
202
|
+
const out = [];
|
|
203
|
+
const re = /(!\[([^\]]*)\]\(([^)\s]+)(?:\s+"[^"]*")?\))|(\[([^\]]+)\]\(([^)\s]+)(?:\s+"[^"]*")?\))|(`+)([\s\S]*?[^`])\7(?!`)|(\*\*|__)(?=\S)([\s\S]*?\S)\9|(~~)(?=\S)([\s\S]*?\S)\11|(\*|_)(?=\S)([\s\S]*?\S)\13/g;
|
|
204
|
+
let at = 0;
|
|
205
|
+
const walk = (text, marks, href) => {
|
|
206
|
+
if (text)
|
|
207
|
+
out.push({ text, marks, href });
|
|
208
|
+
};
|
|
209
|
+
for (let m; (m = re.exec(s));) {
|
|
210
|
+
walk(s.slice(at, m.index).replace(/\\([\\`*_{}[\]()#+\-.!~])/g, '$1'), []);
|
|
211
|
+
at = m.index + m[0].length;
|
|
212
|
+
if (m[1]) {
|
|
213
|
+
blocks.push((0, richtext_core_1.image)(resolve(m[3], m[2]), m[2] || undefined));
|
|
214
|
+
}
|
|
215
|
+
else if (m[4]) {
|
|
216
|
+
const inner = inlineMd(m[5], resolve, blocks);
|
|
217
|
+
const href = (0, richtext_core_1.safeHref)(m[6]);
|
|
218
|
+
for (const r of inner)
|
|
219
|
+
out.push({ ...r, href: href ?? r.href });
|
|
220
|
+
}
|
|
221
|
+
else if (m[7])
|
|
222
|
+
walk(m[8], ['code']);
|
|
223
|
+
else if (m[9])
|
|
224
|
+
for (const r of inlineMd(m[10], resolve, blocks))
|
|
225
|
+
out.push({ ...r, marks: [...r.marks, 'bold'] });
|
|
226
|
+
else if (m[11])
|
|
227
|
+
for (const r of inlineMd(m[12], resolve, blocks))
|
|
228
|
+
out.push({ ...r, marks: [...r.marks, 'strike'] });
|
|
229
|
+
else if (m[13])
|
|
230
|
+
for (const r of inlineMd(m[14], resolve, blocks))
|
|
231
|
+
out.push({ ...r, marks: [...r.marks, 'italic'] });
|
|
232
|
+
}
|
|
233
|
+
walk(s.slice(at).replace(/\\([\\`*_{}[\]()#+\-.!~])/g, '$1'), []);
|
|
234
|
+
return out;
|
|
235
|
+
}
|
|
236
|
+
function fromMarkdown(md, imageOf) {
|
|
237
|
+
const lines = md.replace(/\r\n?/g, '\n').split('\n');
|
|
238
|
+
const blocks = [];
|
|
239
|
+
const parseBlocks = (ls, into) => {
|
|
240
|
+
for (let i = 0; i < ls.length;) {
|
|
241
|
+
const line = ls[i];
|
|
242
|
+
if (!line.trim()) {
|
|
243
|
+
i++;
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
const fence = /^\s*(`{3,}|~{3,})\s*([\w+#.-]*)/.exec(line);
|
|
247
|
+
if (fence) {
|
|
248
|
+
const body = [];
|
|
249
|
+
for (i++; i < ls.length && !ls[i].trimStart().startsWith(fence[1]); i++)
|
|
250
|
+
body.push(ls[i]);
|
|
251
|
+
i++;
|
|
252
|
+
into.push((0, richtext_core_1.codeBlock)(body.join('\n'), fence[2]));
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
const h = /^(#{1,6})\s+(.*?)\s*#*\s*$/.exec(line);
|
|
256
|
+
if (h) {
|
|
257
|
+
const extra = [];
|
|
258
|
+
into.push((0, richtext_core_1.heading)(h[1].length, inlineMd(h[2], imageOf, extra)), ...extra);
|
|
259
|
+
i++;
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if (/^\s*([-*_])(\s*\1){2,}\s*$/.test(line)) {
|
|
263
|
+
into.push({ type: 'horizontalRule' });
|
|
264
|
+
i++;
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
if (/^\s*>/.test(line)) {
|
|
268
|
+
const body = [];
|
|
269
|
+
for (; i < ls.length && /^\s*>/.test(ls[i]); i++)
|
|
270
|
+
body.push(ls[i].replace(/^\s*>\s?/, ''));
|
|
271
|
+
const inner = [];
|
|
272
|
+
parseBlocks(body, inner);
|
|
273
|
+
into.push({ type: 'blockquote', content: inner });
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
const li = /^(\s*)([-*+]|\d+[.)])\s+/.exec(line);
|
|
277
|
+
if (li) {
|
|
278
|
+
const ordered = /\d/.test(li[2]);
|
|
279
|
+
const indent = li[1].length;
|
|
280
|
+
const items = [];
|
|
281
|
+
for (; i < ls.length; i++) {
|
|
282
|
+
const l = ls[i];
|
|
283
|
+
const m = /^(\s*)([-*+]|\d+[.)])\s+(.*)$/.exec(l);
|
|
284
|
+
if (m && m[1].length === indent && /\d/.test(m[2]) === ordered)
|
|
285
|
+
items.push([m[3]]);
|
|
286
|
+
else if (m && m[1].length > indent && items.length)
|
|
287
|
+
items[items.length - 1].push(l.slice(indent + 2));
|
|
288
|
+
else if (l.trim() && /^\s+/.test(l) && items.length)
|
|
289
|
+
items[items.length - 1].push(l.trim());
|
|
290
|
+
else
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
into.push((0, richtext_core_1.list)(ordered, items.map((item) => { const inner = []; parseBlocks(item, inner); return inner; })));
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
const para = [];
|
|
297
|
+
for (; i < ls.length && ls[i].trim() && !/^\s*(#{1,6}\s|>|`{3}|~{3}|([-*+]|\d+[.)])\s)/.test(ls[i]); i++)
|
|
298
|
+
para.push(ls[i].trim());
|
|
299
|
+
const extra = [];
|
|
300
|
+
const runs = [];
|
|
301
|
+
para.forEach((p, k) => { if (k)
|
|
302
|
+
runs.push({ text: ' ', marks: [] }); runs.push(...inlineMd(p, imageOf, extra)); });
|
|
303
|
+
if (runs.some((r) => r.text.trim()))
|
|
304
|
+
into.push((0, richtext_core_1.paragraph)(runs));
|
|
305
|
+
into.push(...extra);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
parseBlocks(lines, blocks);
|
|
309
|
+
return (0, richtext_core_1.doc)(blocks);
|
|
310
|
+
}
|
|
311
|
+
//# sourceMappingURL=richtext-html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richtext-html.js","sourceRoot":"","sources":["../../src/import/richtext-html.ts"],"names":[],"mappings":";;AAcA,wCAQC;AAuKD,4BAIC;AA6BD,oCA0DC;AAxRD;;;;;;;;;GASG;AACH,mDAAqH;AAGrH,MAAM,QAAQ,GAA2B,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAA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AC;YAC1B,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,IAAI,CAAC,8CAA8C,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAE,CAAC,EAAE,CAAC,EAAE;gBAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC,CAAC;YACrI,MAAM,KAAK,GAAc,EAAE,CAAC;YAC5B,MAAM,IAAI,GAAU,EAAE,CAAC;YACvB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC;gBAAE,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACnH,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBAAE,IAAI,CAAC,IAAI,CAAC,IAAA,yBAAS,EAAC,IAAI,CAAC,CAAC,CAAC;YAChE,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC;IACF,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC3B,OAAO,IAAA,mBAAG,EAAC,MAAM,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ImageResolver, RichDoc } from './types';
|
|
2
|
+
export declare function fromLexical(value: unknown, imageOf: ImageResolver, mediaUrl?: (id: unknown) => string | null): RichDoc | null;
|
|
3
|
+
export declare function fromPortableText(value: unknown, imageOf: ImageResolver, assetUrl: (ref: string) => string | null): RichDoc | null;
|
|
4
|
+
/** `assetOf` maps a linked asset id to the URL the engine will rewrite to the uploaded file. */
|
|
5
|
+
export declare function fromContentful(value: unknown, imageOf: ImageResolver, assetOf: (id: string) => {
|
|
6
|
+
url: string;
|
|
7
|
+
alt?: string;
|
|
8
|
+
} | null): RichDoc | null;
|
|
9
|
+
export declare function fromStrapiBlocks(value: unknown, imageOf: ImageResolver): RichDoc | null;
|
|
10
|
+
//# sourceMappingURL=richtext-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richtext-json.d.ts","sourceRoot":"","sources":["../../src/import/richtext-json.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAW,aAAa,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAY/D,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,GAAE,CAAC,EAAE,EAAE,OAAO,KAAK,MAAM,GAAG,IAAiB,GAAG,OAAO,GAAG,IAAI,CA8CzI;AAMD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CA8DjI;AAMD,gGAAgG;AAChG,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CAyCpJ;AAID,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,GAAG,IAAI,CA0CvF"}
|