@contentrain/wp-import 0.11.27 → 0.12.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/dist/index.d.mts +9 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +16 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -202,6 +202,14 @@ declare const canon: (o: unknown) => string;
|
|
|
202
202
|
* Whether a stored record gets a public route is the route producer's decision.
|
|
203
203
|
*/
|
|
204
204
|
declare const SKIP_TYPES: RegExp;
|
|
205
|
+
/**
|
|
206
|
+
* Elementor landing pages (`e-landing-page`) are public pages at `/<slug>/`, the same address and SEO as a page, built
|
|
207
|
+
* in the same editor. They enter the import as pages — one `pages` model, one permalink space, the page's SEO — not as a
|
|
208
|
+
* model of their own. WordPress lists the type over REST only when it is `show_in_rest`; a site that hides it is imported
|
|
209
|
+
* from a WXR export instead.
|
|
210
|
+
*/
|
|
211
|
+
declare const LANDING_PAGE_TYPE = "e-landing-page";
|
|
212
|
+
declare const pageTypeOf: (type: string) => string;
|
|
205
213
|
/** Open meta keys that are plugin plumbing, not editorial fields. */
|
|
206
214
|
declare const PLUGIN_META: RegExp;
|
|
207
215
|
/** Taxonomy → model id. */
|
|
@@ -258,5 +266,5 @@ declare function planSourceDelta(input: PlanSourceDeltaInput): SourceDeltaPlan;
|
|
|
258
266
|
/** The plan as text, for a dry run: one line per record, then conflicts, unmapped records, redirects and warnings. */
|
|
259
267
|
declare function formatSourceDeltaReport(plan: SourceDeltaPlan): string;
|
|
260
268
|
//#endregion
|
|
261
|
-
export { type ContentrainResult, DEFAULT_IMPORTERS, DEFAULT_TAXONOMIES, type DeltaStore, type ImportReport, PLUGIN_META, type PlanSourceDeltaInput, type RestImportOptions, type RestImportResult, SKIP_TYPES, type UnserializeResult, type WxrParseResult, type WxrStats, addressSlug, buildCommentsExport, canon, fetchRestRawIR, formatSourceDeltaReport, hexId, looksSerialized, parseWxr, phpUnserialize, planSourceDelta, rawToContentrain, selectComments, slugify, strip, summarizeComments, taxModelId, tryUnserialize };
|
|
269
|
+
export { type ContentrainResult, DEFAULT_IMPORTERS, DEFAULT_TAXONOMIES, type DeltaStore, type ImportReport, LANDING_PAGE_TYPE, PLUGIN_META, type PlanSourceDeltaInput, type RestImportOptions, type RestImportResult, SKIP_TYPES, type UnserializeResult, type WxrParseResult, type WxrStats, addressSlug, buildCommentsExport, canon, fetchRestRawIR, formatSourceDeltaReport, hexId, looksSerialized, pageTypeOf, parseWxr, phpUnserialize, planSourceDelta, rawToContentrain, selectComments, slugify, strip, summarizeComments, taxModelId, tryUnserialize };
|
|
262
270
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/wxr.ts","../src/rest.ts","../src/contentrain.ts","../src/comments.ts","../src/php-unserialize.ts","../src/core.ts","../src/delta.ts"],"mappings":";;;;UA2BiB,QAAA;EACf,UAAA;IAAc,QAAA;IAAkB,OAAA;IAAiB,MAAA;IAAgB,IAAA;EAAA;EACjE,UAAA;EACA,gBAAA;EACA,MAAA,EAAQ,MAAA;AAAA;AAAA,UAGO,cAAA;EACf,GAAA,EAAK,KAAA;EACL,KAAA,EAAO,QAAA;AAAA;AAAA,iBAiBa,QAAA,CAAS,KAAA,WAAgB,QAAA,EAAU,IAAA;EAAS,IAAA;AAAA,IAAkB,OAAA,CAAQ,cAAA;;;UCnC3E,iBAAA;EACf,MAAA;;EAEA,SAAA,UAAmB,KAAA;EDMI;;;;;;;;ECGvB,IAAA;IAAS,IAAA;IAAc,WAAA;EAAA;EACvB,OAAA;EDAc;AAGhB;;;;ECGE,WAAA;EDFK;;;;ECOL,QAAA;EACA,IAAA;AAAA;AAAA,UAGe,gBAAA;EACf,GAAA,EAAK,KAAA;EACL,QAAA;EDKkF;;;;;;;;ECIlF,UAAA;IAAc,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A,EAAK,cAAA,GAAiB,eAAA;;;UC3CvC,iBAAA;EACf,EAAA;EACA,UAAA;EACA,KAAA;EACA,KAAA;AAAA;AAAA,iBAGc,eAAA,CAAgB,CAAA,YAAa,CAAA;AAAA,iBAI7B,cAAA,CAAe,GAAA;;iBAyFf,cAAA,CAAe,CAAA,WAAY,iBAAA;;;;;;;;cCrE9B,KAAA,GAAS,CAAA;;cAGT,KAAA,GAAS,CAAA;;cAcT,KAAA,GAAS,CAAA;;;;;;;;ALCtB;;cK8Ba,UAAA,EAAU,MAAA;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/wxr.ts","../src/rest.ts","../src/contentrain.ts","../src/comments.ts","../src/php-unserialize.ts","../src/core.ts","../src/delta.ts"],"mappings":";;;;UA2BiB,QAAA;EACf,UAAA;IAAc,QAAA;IAAkB,OAAA;IAAiB,MAAA;IAAgB,IAAA;EAAA;EACjE,UAAA;EACA,gBAAA;EACA,MAAA,EAAQ,MAAA;AAAA;AAAA,UAGO,cAAA;EACf,GAAA,EAAK,KAAA;EACL,KAAA,EAAO,QAAA;AAAA;AAAA,iBAiBa,QAAA,CAAS,KAAA,WAAgB,QAAA,EAAU,IAAA;EAAS,IAAA;AAAA,IAAkB,OAAA,CAAQ,cAAA;;;UCnC3E,iBAAA;EACf,MAAA;;EAEA,SAAA,UAAmB,KAAA;EDMI;;;;;;;;ECGvB,IAAA;IAAS,IAAA;IAAc,WAAA;EAAA;EACvB,OAAA;EDAc;AAGhB;;;;ECGE,WAAA;EDFK;;;;ECOL,QAAA;EACA,IAAA;AAAA;AAAA,UAGe,gBAAA;EACf,GAAA,EAAK,KAAA;EACL,QAAA;EDKkF;;;;;;;;ECIlF,UAAA;IAAc,MAAA;IAA0C,SAAA;EAAA;;;AAvC1D;;;;;;;;;;EAoDE,IAAA;AAAA;AAAA,iBA4EoB,cAAA,CAAe,OAAA,EAAS,iBAAA,GAAoB,OAAA,CAAQ,gBAAA;;;;UCnHzD,QAAA;E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CAAe,GAAA;;iBAyFf,cAAA,CAAe,CAAA,WAAY,iBAAA;;;;;;;;cCrE9B,KAAA,GAAS,CAAA;;cAGT,KAAA,GAAS,CAAA;;cAcT,KAAA,GAAS,CAAA;;;;;;;;ALCtB;;cK8Ba,UAAA,EAAU,MAAA;;;;;;;cASV,iBAAA;AAAA,cACA,UAAA,GAAc,IAAA;;cAGd,WAAA,EAAW,MAAA;;cAOX,UAAA,GAAc,CAAA;AAAA,cAGd,OAAA,GAAW,CAAA;;AJxFxB;;;;;cIsGa,WAAA,GAAe,GAAA;;;;UCrGX,UAAA;EACf,KAAA,EAAO,MAAA;EACP,gBAAA,EAAkB,cAAA;AAAA;AAAA,UAGH,oBAAA;ENOD;EMLd,KAAA,EAAO,eAAA;ENEO;EMAd,KAAA,EAAO,UAAA;ENA0C;EMEjD,QAAA,GAAW,UAAA;ENDX;;;;;EMOA,UAAA;ENFe;;;;EMOf,SAAA;AAAA;AAAA,cAGW,kBAAA;AAAA,cACA,iBAAA;;;ANQb;;;;;;;;;;iBM8NgB,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAuB,eAAA;;iBAkC9C,uBAAA,CAAwB,IAAA,EAAM,eAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -179,7 +179,15 @@ const PROTECTED = "[protected]";
|
|
|
179
179
|
* their cross-model parent links are part of the lossless import contract.
|
|
180
180
|
* Whether a stored record gets a public route is the route producer's decision.
|
|
181
181
|
*/
|
|
182
|
-
const SKIP_TYPES = /^(attachment|nav_menu_item|wp_|jp_|pattern|revision|oembed_cache|customize_changeset|user_request|custom_css|gblocks_|gblocks-|gp_elements|gp-elements|elementor_library|
|
|
182
|
+
const SKIP_TYPES = /^(attachment|nav_menu_item|wp_|jp_|pattern|revision|oembed_cache|customize_changeset|user_request|custom_css|gblocks_|gblocks-|gp_elements|gp-elements|elementor_library|wpcf7_contact_form|wpforms)/;
|
|
183
|
+
/**
|
|
184
|
+
* Elementor landing pages (`e-landing-page`) are public pages at `/<slug>/`, the same address and SEO as a page, built
|
|
185
|
+
* in the same editor. They enter the import as pages — one `pages` model, one permalink space, the page's SEO — not as a
|
|
186
|
+
* model of their own. WordPress lists the type over REST only when it is `show_in_rest`; a site that hides it is imported
|
|
187
|
+
* from a WXR export instead.
|
|
188
|
+
*/
|
|
189
|
+
const LANDING_PAGE_TYPE = "e-landing-page";
|
|
190
|
+
const pageTypeOf = (type) => type === "e-landing-page" ? "page" : type;
|
|
183
191
|
/** Open meta keys that are plugin plumbing, not editorial fields. */
|
|
184
192
|
const PLUGIN_META = /^(jetpack|wpdc|discourse|footnotes|inline_featured|spay_|advanced_seo|rank_math|yoast)/i;
|
|
185
193
|
/** Taxonomy → model id. */
|
|
@@ -496,7 +504,7 @@ async function parseWxr(input, opts) {
|
|
|
496
504
|
const comments = it.comments.map((c) => ({
|
|
497
505
|
id: num(c.id),
|
|
498
506
|
post: id,
|
|
499
|
-
post_type: it.type || "post",
|
|
507
|
+
post_type: pageTypeOf(it.type || "post"),
|
|
500
508
|
parent: num(c.parent) || null,
|
|
501
509
|
parent_resolved: null,
|
|
502
510
|
author: c.author ?? "",
|
|
@@ -512,7 +520,7 @@ async function parseWxr(input, opts) {
|
|
|
512
520
|
}));
|
|
513
521
|
return {
|
|
514
522
|
id,
|
|
515
|
-
type: it.type || "post",
|
|
523
|
+
type: pageTypeOf(it.type || "post"),
|
|
516
524
|
status: it.status || "publish",
|
|
517
525
|
slug: it.slug || "",
|
|
518
526
|
title: it.title ?? "",
|
|
@@ -1835,6 +1843,7 @@ async function fetchRestRawIR(options) {
|
|
|
1835
1843
|
}
|
|
1836
1844
|
const userById = new Map(users.map((u) => [u.id, u]));
|
|
1837
1845
|
const posts = [];
|
|
1846
|
+
const landingIds = /* @__PURE__ */ new Set();
|
|
1838
1847
|
const languagePairs = [];
|
|
1839
1848
|
const seenGroups = /* @__PURE__ */ new Set();
|
|
1840
1849
|
const recordGroup = (self, lang) => {
|
|
@@ -1883,10 +1892,11 @@ async function fetchRestRawIR(options) {
|
|
|
1883
1892
|
if (p.featured_media) meta._thumbnail_id = String(p.featured_media);
|
|
1884
1893
|
const lang = typeof p.lang === "string" && p.lang || typeof p.wpml_current_locale === "string" && p.wpml_current_locale || null;
|
|
1885
1894
|
recordGroup(p, lang);
|
|
1895
|
+
if (base.slug === "e-landing-page") landingIds.add(p.id);
|
|
1886
1896
|
posts.push({
|
|
1887
1897
|
...lang ? { lang } : {},
|
|
1888
1898
|
id: p.id,
|
|
1889
|
-
type: base.slug,
|
|
1899
|
+
type: pageTypeOf(base.slug),
|
|
1890
1900
|
status: p.status ?? "publish",
|
|
1891
1901
|
slug: p.slug,
|
|
1892
1902
|
title: p.title?.rendered ?? "",
|
|
@@ -1995,7 +2005,7 @@ async function fetchRestRawIR(options) {
|
|
|
1995
2005
|
},
|
|
1996
2006
|
postLink: (id) => linkOf.get(id),
|
|
1997
2007
|
termLink: (taxonomy, id) => termsById.get(id)?.taxonomy === taxonomy ? termLinks.get(id) : void 0,
|
|
1998
|
-
pages: posts.filter((p) => p.type === "page" && p.status === "publish" && !p.password).map((p) => ({
|
|
2008
|
+
pages: posts.filter((p) => p.type === "page" && !landingIds.has(p.id) && p.status === "publish" && !p.password).map((p) => ({
|
|
1999
2009
|
id: p.id,
|
|
2000
2010
|
parent: p.parent ?? null,
|
|
2001
2011
|
menu_order: p.menu_order ?? 0,
|
|
@@ -3601,6 +3611,6 @@ function formatSourceDeltaReport(plan) {
|
|
|
3601
3611
|
return `${lines.join("\n")}\n`;
|
|
3602
3612
|
}
|
|
3603
3613
|
//#endregion
|
|
3604
|
-
export { DEFAULT_IMPORTERS, DEFAULT_TAXONOMIES, PLUGIN_META, SKIP_TYPES, addressSlug, buildCommentsExport, canon, fetchRestRawIR, formatSourceDeltaReport, hexId, looksSerialized, parseWxr, phpUnserialize, planSourceDelta, rawToContentrain, selectComments, slugify, strip, summarizeComments, taxModelId, tryUnserialize };
|
|
3614
|
+
export { DEFAULT_IMPORTERS, DEFAULT_TAXONOMIES, LANDING_PAGE_TYPE, PLUGIN_META, SKIP_TYPES, addressSlug, buildCommentsExport, canon, fetchRestRawIR, formatSourceDeltaReport, hexId, looksSerialized, pageTypeOf, parseWxr, phpUnserialize, planSourceDelta, rawToContentrain, selectComments, slugify, strip, summarizeComments, taxModelId, tryUnserialize };
|
|
3605
3615
|
|
|
3606
3616
|
//# sourceMappingURL=index.mjs.map
|