@tryghost/mg-jekyll-export 0.13.8-0 → 0.14.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.
@@ -0,0 +1,154 @@
1
+ import MarkdownIt from 'markdown-it';
2
+ import { slugify } from '@tryghost/string';
3
+ import { RecordDataError } from '@tryghost/mg-context';
4
+ import { urlUtils } from '@tryghost/mg-utils';
5
+ import { load, Schema, timestampTag, YAML11_SCHEMA } from 'js-yaml';
6
+ import processHtml from './process-html.js';
7
+ const md = new MarkdownIt({
8
+ html: true
9
+ });
10
+ /**
11
+ * Jekyll reads front matter as YAML 1.1. Timestamps stay strings, so `parseDate()` reads every date the same way,
12
+ * rejecting impossible dates that YAML would roll over (such as `2021-02-30`).
13
+ */
14
+ const schema = new Schema(YAML11_SCHEMA.tags.filter(tag => tag !== timestampTag));
15
+ // Front matter sits between `---` lines (or `= yaml =` and `...`), and may be empty.
16
+ const frontMatterPattern = /^\uFEFF?(---|= yaml =)\r?\n(?:([\s\S]*?)\r?\n)?(?:\1|\.\.\.)[ \t]*(?:\r?\n|$)/;
17
+ /** A post file's path: `_posts/` or `_drafts/`, optional subdirectories, an optional date, and the extension. */
18
+ const FILE = /^(?:.*\/)?(?:(\d{4})-(\d{1,2})-(\d{1,2})-)?([^/]*)\.(md|markdown|html)$/;
19
+ /**
20
+ * Split a post file into its front matter attributes and body. A file without front matter has no attributes, and
21
+ * front matter that is not a YAML mapping is ignored. Invalid YAML is a `RecordDataError`.
22
+ */
23
+ export function parseFrontMatter(contents) {
24
+ const match = contents.match(frontMatterPattern);
25
+ if (!match) {
26
+ return { attributes: {}, body: contents };
27
+ }
28
+ const yaml = match[2]?.trim();
29
+ let attributes;
30
+ try {
31
+ attributes = yaml ? load(yaml, { schema }) : {};
32
+ }
33
+ catch (error) {
34
+ throw new RecordDataError(`Invalid front matter: ${error.message.split('\n')[0]}`);
35
+ }
36
+ return {
37
+ attributes: attributes && typeof attributes === 'object' && !Array.isArray(attributes)
38
+ ? attributes
39
+ : {},
40
+ body: contents.slice(match[0].length)
41
+ };
42
+ }
43
+ /** A UTC date from its parts, or `null` when a part is out of range (such as February 30th or 25:00). */
44
+ function utcDate(year, month, day, hours = 0, minutes = 0, seconds = 0) {
45
+ const date = new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds));
46
+ const valid = date.getUTCMonth() === month - 1 &&
47
+ date.getUTCDate() === day &&
48
+ date.getUTCHours() === hours &&
49
+ date.getUTCMinutes() === minutes &&
50
+ date.getUTCSeconds() === seconds;
51
+ return valid ? date : null;
52
+ }
53
+ const DATE = /^(\d{4})-(\d{1,2})-(\d{1,2})(?:(?:[Tt]|[ \t]+)(\d{1,2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?)?(?:[ \t]*(Z|UTC|GMT|[-+]\d{1,2}(?::?\d{2})?))?$/i;
54
+ /**
55
+ * Read a front matter date, which Jekyll writes as `YYYY-MM-DD HH:MM:SS +/-TTTT`; the time, seconds and offset
56
+ * are optional, and a `T` may separate the date and time. A date without an offset is read as UTC. Returns `null`
57
+ * for anything else.
58
+ */
59
+ export function parseDate(value) {
60
+ const match = typeof value === 'string' ? value.trim().match(DATE) : null;
61
+ if (!match) {
62
+ return null;
63
+ }
64
+ const [, year, month, day, hours = '0', minutes = '0', seconds = '0', fraction = '', zone = 'Z'] = match;
65
+ const date = utcDate(+year, +month, +day, +hours, +minutes, +seconds);
66
+ if (!date) {
67
+ return null;
68
+ }
69
+ const offset = zone.match(/^([-+])(\d{1,2}):?(\d{2})?$/);
70
+ const offsetMinutes = offset ? (offset[1] === '-' ? -1 : 1) * (+offset[2] * 60 + +(offset[3] ?? 0)) : 0;
71
+ return new Date(date.getTime() + Number(`0.${fraction}`) * 1000 - offsetMinutes * 60_000);
72
+ }
73
+ /** A trimmed string or number, or `undefined` when the value is neither or blank. */
74
+ function text(value) {
75
+ return typeof value === 'string' || typeof value === 'number' ? String(value).trim() || undefined : undefined;
76
+ }
77
+ /** Jekyll lists are a YAML list, or a space-separated string. */
78
+ function list(value) {
79
+ const items = Array.isArray(value) ? value.map(text) : (text(value)?.split(/\s+/) ?? []);
80
+ return items.filter((item) => Boolean(item));
81
+ }
82
+ /** The fields Jekyll takes from a post's path and front matter, without its body. */
83
+ function readMeta(path, attributes) {
84
+ const file = path.match(FILE);
85
+ if (!file) {
86
+ throw new Error(`Not a Jekyll post file: ${path}`);
87
+ }
88
+ const [, year, month, day, name] = file;
89
+ const directory = path.split('/').slice(-2, -1)[0];
90
+ // `basename` in the front matter overrides the slug from the file name.
91
+ const sourceSlug = urlUtils.trimTrailingSlashes((text(attributes.basename) ?? name).replace(/^\/+/, ''));
92
+ const fileDate = year ? utcDate(+year, +month, +day) : null;
93
+ return {
94
+ sourceSlug,
95
+ slug: slugify(sourceSlug) || slugify(text(attributes.title) ?? '') || 'post',
96
+ title: text(attributes.title) ?? '(Untitled)',
97
+ status: path.startsWith('_drafts/') || attributes.published === false ? 'draft' : 'published',
98
+ // The front matter date wins; a missing or invalid one falls back to the date in the file name.
99
+ date: parseDate(attributes.date) ?? fileDate,
100
+ // Posts in a subdirectory such as `_posts/notes/` get an internal tag named after it.
101
+ postType: directory === '_posts' || directory === '_drafts' ? null : directory
102
+ };
103
+ }
104
+ /**
105
+ * Read a post's slug, live URL fields and date from its path and front matter, without rendering its body. Throws
106
+ * a `RecordDataError` for invalid front matter.
107
+ */
108
+ export function readPost(path, contents) {
109
+ const { sourceSlug, date, status } = readMeta(path, parseFrontMatter(contents).attributes);
110
+ return { sourceSlug, date, status };
111
+ }
112
+ function tag(name, slug) {
113
+ return { name, slug };
114
+ }
115
+ /**
116
+ * Process one Jekyll post file: its front matter and its Markdown or HTML body, which is converted to clean HTML.
117
+ * `path` is the file's path from the site root, such as `_posts/2021-08-23-my-post.md` or `_drafts/my-draft.md`.
118
+ *
119
+ * Tags come from `category` and `categories` (as `category-` tags, first so the first category is the primary
120
+ * tag), then `tag` and `tags`, then `options.addTags`; a `#` tag named after a subdirectory of `_posts`, and
121
+ * `#jekyll`, come after the public tags. Throws a `RecordDataError` for invalid front matter.
122
+ */
123
+ export function processPost(path, contents, options = {}) {
124
+ const { attributes, body } = parseFrontMatter(contents);
125
+ const meta = readMeta(path, attributes);
126
+ // `.html` bodies are kept as they are; Markdown may contain HTML too.
127
+ const html = processHtml(path.endsWith('.html') ? body : md.render(body), options.url);
128
+ const tags = [
129
+ ...[...list([attributes.category].flat()), ...list(attributes.categories)].map(name => tag(name, `category-${slugify(name)}`)),
130
+ ...[...list([attributes.tag].flat()), ...list(attributes.tags)].map(name => tag(name, slugify(name))),
131
+ ...(meta.postType ? [tag(`#${meta.postType}`, `hash-${slugify(meta.postType)}`)] : []),
132
+ tag('#jekyll', 'hash-jekyll'),
133
+ ...(options.addTags ?? '')
134
+ .split(',')
135
+ .map(name => name.trim())
136
+ .filter(Boolean)
137
+ .map(name => tag(name, slugify(name.replace('#', 'hash-'))))
138
+ ];
139
+ // Public tags come first, then internal (`#`) tags, keeping their order otherwise; a repeated slug is one tag.
140
+ tags.sort((a, b) => Number(a.name.startsWith('#')) - Number(b.name.startsWith('#')));
141
+ const unique = tags.filter((item, index) => tags.findIndex(other => other.slug === item.slug) === index);
142
+ const post = {
143
+ sourceSlug: meta.sourceSlug,
144
+ slug: meta.slug,
145
+ title: meta.title,
146
+ status: meta.status,
147
+ date: meta.date,
148
+ html,
149
+ authors: list([attributes.author].flat()),
150
+ tags: unique
151
+ };
152
+ return post;
153
+ }
154
+ //# sourceMappingURL=process-post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-post.js","sourceRoot":"","sources":["../../src/lib/process-post.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAC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C,GAAG,CAAC,CAAC,CAAC,CAAC;IACrF,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC;IAEzG,MAAM,IAAI,GAAe;QACrB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI;QACJ,OAAO,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QACzC,IAAI,EAAE,MAAM;KACf,CAAC;IACF,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -0,0 +1,31 @@
1
+ export interface JekyllOptions {
2
+ /** The live site's URL. It makes root-relative links absolute, gives posts their old URLs and scopes Ghost IDs. */
3
+ url?: string;
4
+ /** The domain of authors' placeholder emails, such as `example.com`. */
5
+ email?: string | false | null;
6
+ /** Comma-separated tag names added to every post. */
7
+ addTags?: string | null;
8
+ /** The live site's dated permalink structure, kept in the paths links are rewritten to. */
9
+ datedPermalinks?: 'none' | '/yyyy/mm/' | '/yyyy/mm/dd/' | string | null;
10
+ [key: string]: any;
11
+ }
12
+ export interface JekyllTag {
13
+ name: string;
14
+ slug: string;
15
+ }
16
+ /** One Jekyll post, read from its path, front matter and body. */
17
+ export interface JekyllPost {
18
+ /** The slug in the post's live URL: front matter `basename`, or the file name without its date and extension. */
19
+ sourceSlug: string;
20
+ /** The Ghost slug: the slugified `sourceSlug`. */
21
+ slug: string;
22
+ title: string;
23
+ status: 'published' | 'draft';
24
+ /** The front matter date, or the date in the file name; `null` when neither is a valid date. */
25
+ date: Date | null;
26
+ html: string;
27
+ /** The front matter `author` names. */
28
+ authors: string[];
29
+ /** Tags in order: public tags, then internal `#` tags. */
30
+ tags: JekyllTag[];
31
+ }
@@ -0,0 +1,3 @@
1
+ export {};
2
+ /* c8 ignore stop */
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":";AAkCA,oBAAoB"}
@@ -0,0 +1,18 @@
1
+ import { MigrateContext } from '@tryghost/mg-context';
2
+ /** Every fixture post, under `_posts/`. */
3
+ export declare function fixturePosts(): Promise<Record<string, string>>;
4
+ /** A Markdown post with front matter. */
5
+ export declare function post(attributes: Record<string, string>, body?: string): string;
6
+ /** A new temporary directory, removed by `cleanUp()`. */
7
+ export declare function tempDirectory(): Promise<string>;
8
+ /** Write `files` (relative path → contents) into a new directory, and return its path. */
9
+ export declare function makeDirectory(files: Record<string, string>): Promise<string>;
10
+ /** Write `files` (path in the zip → contents) into a zip, and return its path. */
11
+ export declare function makeZip(files: Record<string, string>, name?: string): Promise<string>;
12
+ export declare function cleanUp(): Promise<void>;
13
+ export declare function memoryContext(): Promise<MigrateContext>;
14
+ /** A context holding the ingested site zip of `files`. */
15
+ export declare function ingested(files: Record<string, string>): Promise<MigrateContext>;
16
+ export declare function events(context: MigrateContext, type: string): {
17
+ details: Record<string, any>;
18
+ }[];
@@ -0,0 +1,64 @@
1
+ import { mkdir, mkdtemp, readFile, readdir, rm, writeFile } from 'node:fs/promises';
2
+ import { tmpdir } from 'node:os';
3
+ import { dirname, join } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import fsUtils from '@tryghost/mg-fs-utils';
6
+ import { MigrateContext } from '@tryghost/mg-context';
7
+ import { ingest } from '../index.js';
8
+ const fixtures = fileURLToPath(new URL('../../src/test/fixtures/', import.meta.url));
9
+ /** Every fixture post, under `_posts/`. */
10
+ export async function fixturePosts() {
11
+ const files = {};
12
+ for (const name of await readdir(fixtures)) {
13
+ files[`_posts/${name}`] = await readFile(join(fixtures, name), 'utf8');
14
+ }
15
+ return files;
16
+ }
17
+ /** A Markdown post with front matter. */
18
+ export function post(attributes, body = 'Body text.') {
19
+ const lines = Object.entries(attributes).map(([key, value]) => `${key}: ${value}`);
20
+ return `---\n${lines.join('\n')}\n---\n${body}\n`;
21
+ }
22
+ const directories = [];
23
+ /** A new temporary directory, removed by `cleanUp()`. */
24
+ export async function tempDirectory() {
25
+ const directory = await mkdtemp(join(tmpdir(), 'mg-jekyll-test-'));
26
+ directories.push(directory);
27
+ return directory;
28
+ }
29
+ /** Write `files` (relative path → contents) into a new directory, and return its path. */
30
+ export async function makeDirectory(files) {
31
+ const directory = join(await tempDirectory(), 'site');
32
+ await mkdir(directory);
33
+ for (const [path, contents] of Object.entries(files)) {
34
+ await mkdir(dirname(join(directory, path)), { recursive: true });
35
+ await writeFile(join(directory, path), contents);
36
+ }
37
+ return directory;
38
+ }
39
+ /** Write `files` (path in the zip → contents) into a zip, and return its path. */
40
+ export async function makeZip(files, name = 'site.zip') {
41
+ const content = await makeDirectory(files);
42
+ const result = await fsUtils.zip.write(dirname(content), content, name);
43
+ return result.path;
44
+ }
45
+ export async function cleanUp() {
46
+ for (const directory of directories.splice(0)) {
47
+ await rm(directory, { recursive: true, force: true });
48
+ }
49
+ }
50
+ export async function memoryContext() {
51
+ const context = new MigrateContext({ storage: 'memory' });
52
+ await context.init();
53
+ return context;
54
+ }
55
+ /** A context holding the ingested site zip of `files`. */
56
+ export async function ingested(files) {
57
+ const context = await memoryContext();
58
+ await ingest(await makeZip(files), context);
59
+ return context;
60
+ }
61
+ export function events(context, type) {
62
+ return context.getMigrationReport().events.filter(event => event.type === type);
63
+ }
64
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/test/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,QA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EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;IACxD,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa;IAC/B,MAAM,OAAO,GAAG,IAAI,cAAc,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAC,CAAC,CAAC;IACxD,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;IACrB,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,0DAA0D;AAC1D,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,KAA6B;IACxD,MAAM,OAAO,GAAG,MAAM,aAAa,EAAE,CAAC;IACtC,MAAM,MAAM,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAAuB,EAAE,IAAY;IACxD,OAAO,OAAO,CAAC,kBAAkB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAU,CAAC;AAC7F,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,108 @@
1
+ import assert from 'node:assert/strict';
2
+ import { after, describe, it } from 'node:test';
3
+ import { ingest, parse } from '../index.js';
4
+ import { cleanUp, events, ingested, makeDirectory, makeZip, memoryContext, post } from './helpers.js';
5
+ async function parsed(input) {
6
+ const records = [];
7
+ for await (const record of parse(input)) {
8
+ records.push(record);
9
+ }
10
+ return records;
11
+ }
12
+ async function stored(context) {
13
+ const records = [];
14
+ for await (const record of context.sources.records()) {
15
+ records.push(record);
16
+ }
17
+ return records;
18
+ }
19
+ const site = {
20
+ '_posts/2021-08-23-first.md': post({ title: 'First' }),
21
+ '_posts/notes/2021-08-24-nested.markdown': post({ title: 'Nested' }),
22
+ '_posts/2021-08-25-page.html': post({ title: 'HTML' }, '<p>HTML</p>'),
23
+ '_drafts/draft.md': post({ title: 'Draft' }),
24
+ '_posts/image.jpg': 'Not a post',
25
+ '_config.yml': 'title: Site',
26
+ 'about.md': post({ title: 'About' }),
27
+ 'blog/_posts/2021-08-26-elsewhere.md': post({ title: 'Not in the site root' })
28
+ };
29
+ describe('parse', function () {
30
+ after(cleanUp);
31
+ it('yields each post and draft file of a zip as a post record keyed by its path', async function () {
32
+ const records = await parsed(await makeZip(site));
33
+ assert.deepEqual(records.map(record => [record.kind, record.key, record.format]).sort(), [
34
+ ['post', '_drafts/draft.md', 'markdown'],
35
+ ['post', '_posts/2021-08-23-first.md', 'markdown'],
36
+ ['post', '_posts/2021-08-25-page.html', 'html'],
37
+ ['post', '_posts/notes/2021-08-24-nested.markdown', 'markdown']
38
+ ]);
39
+ assert.equal(records.find(record => record.key === '_posts/2021-08-23-first.md').content, site['_posts/2021-08-23-first.md']);
40
+ });
41
+ it('reads a zip holding the site in a directory, or only its _posts directory', async function () {
42
+ const wrapped = await parsed(await makeZip({ 'my-site/_posts/2021-01-01-a.md': post({ title: 'A' }) }));
43
+ const postsOnly = await parsed(await makeZip({ '_posts/2021-01-01-a.md': post({ title: 'A' }) }));
44
+ assert.deepEqual(wrapped.map(record => record.key), ['_posts/2021-01-01-a.md']);
45
+ assert.deepEqual(postsOnly.map(record => record.key), ['_posts/2021-01-01-a.md']);
46
+ });
47
+ it('reads the site directory in path order', async function () {
48
+ const records = await parsed(await makeDirectory(site));
49
+ assert.deepEqual(records.map(record => [record.key, record.format]), [
50
+ ['_drafts/draft.md', 'markdown'],
51
+ ['_posts/2021-08-23-first.md', 'markdown'],
52
+ ['_posts/2021-08-25-page.html', 'html'],
53
+ ['_posts/notes/2021-08-24-nested.markdown', 'markdown']
54
+ ]);
55
+ });
56
+ it('rejects an input without posts', async function () {
57
+ const pathToZip = await makeZip({ '_config.yml': 'title: Site', 'about.md': 'About' });
58
+ await assert.rejects(parsed(pathToZip), /site\.zip: No Jekyll posts found/);
59
+ await assert.rejects(parsed(await makeDirectory({ 'about.md': 'About' })), /No Jekyll posts found/);
60
+ });
61
+ });
62
+ describe('ingest', function () {
63
+ after(cleanUp);
64
+ it('stores the posts with the export name in the ingestion metadata', async function () {
65
+ const context = await ingested(site);
66
+ try {
67
+ assert.equal((await stored(context)).length, 4);
68
+ assert.deepEqual(context.sources.currentIngestion.metadata, { adapter: 'jekyll', file: 'site.zip' });
69
+ }
70
+ finally {
71
+ await context.close();
72
+ }
73
+ });
74
+ it('keeps the first copy of a repeated path and reports the conflict', async function () {
75
+ // The zip's only top-level directory is `_posts/`, so `_posts/_posts/a.md` is named `_posts/a.md`, the same
76
+ // path as `_posts/a.md` itself.
77
+ const context = await ingested({
78
+ '_posts/2021-01-01-a.md': post({ title: 'Outer' }),
79
+ '_posts/_posts/2021-01-01-a.md': post({ title: 'Inner' })
80
+ });
81
+ try {
82
+ const records = await stored(context);
83
+ assert.equal(records.length, 1);
84
+ assert.equal(records[0].key, '_posts/2021-01-01-a.md');
85
+ assert.equal(events(context, 'source:conflict').length, 1);
86
+ }
87
+ finally {
88
+ await context.close();
89
+ }
90
+ });
91
+ it('needs replace to read again, and keeps the stored posts when a read fails', async function () {
92
+ const context = await memoryContext();
93
+ try {
94
+ await ingest(await makeZip(site), context);
95
+ await assert.rejects(ingest(await makeZip(site), context), /explicitly request replacement/);
96
+ await assert.rejects(ingest(await makeZip({ 'about.md': 'About' }), context, { replace: true }), /No Jekyll posts found/);
97
+ assert.equal((await stored(context)).length, 4);
98
+ await ingest(await makeDirectory({ '_posts/2021-01-01-only.md': post({ title: 'Only' }) }), context, {
99
+ replace: true
100
+ });
101
+ assert.deepEqual((await stored(context)).map(record => record.key), ['_posts/2021-01-01-only.md']);
102
+ }
103
+ finally {
104
+ await context.close();
105
+ }
106
+ });
107
+ });
108
+ //# sourceMappingURL=ingest.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingest.test.js","sourceRoot":"","sources":["../../src/test/ingest.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oB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