@artinstack/migrator 0.1.6 → 0.1.8
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 +30 -1
- package/dist/{chunk-CIOYDRY5.js → chunk-ALLFBWBO.js} +115 -2
- package/dist/chunk-ALLFBWBO.js.map +1 -0
- package/dist/{chunk-XQVKA54A.js → chunk-CB5KRANW.js} +247 -59
- package/dist/chunk-CB5KRANW.js.map +1 -0
- package/dist/chunk-EJTWYEAX.js +1 -0
- package/dist/chunk-EJTWYEAX.js.map +1 -0
- package/dist/{chunk-EXYXTAZM.js → chunk-KYNKJ4XV.js} +39 -6
- package/dist/chunk-KYNKJ4XV.js.map +1 -0
- package/dist/{chunk-XYP3VYDH.js → chunk-WHGUE5FC.js} +111 -3
- package/dist/chunk-WHGUE5FC.js.map +1 -0
- package/dist/chunk-XRCF73DA.js +24 -0
- package/dist/chunk-XRCF73DA.js.map +1 -0
- package/dist/{chunk-IPYHS5R2.js → chunk-Z3L6N63Y.js} +45 -34
- package/dist/chunk-Z3L6N63Y.js.map +1 -0
- package/dist/cli/index.js +7 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +5 -17
- package/dist/index.js +38 -9
- package/dist/lib/index.d.ts +7 -25
- package/dist/lib/index.js +32 -3
- package/dist/media-urls-w46-CWUp.d.ts +74 -0
- package/dist/rewrite-inline-images-DyxKUNs3.d.ts +45 -0
- package/dist/sinks/index.d.ts +3 -2
- package/dist/sinks/index.js +4 -3
- package/dist/transformers/index.d.ts +15 -2
- package/dist/transformers/index.js +11 -4
- package/package.json +1 -1
- package/dist/chunk-CIOYDRY5.js.map +0 -1
- package/dist/chunk-EXYXTAZM.js.map +0 -1
- package/dist/chunk-IPYHS5R2.js.map +0 -1
- package/dist/chunk-XQVKA54A.js.map +0 -1
- package/dist/chunk-XYP3VYDH.js.map +0 -1
- package/dist/rewrite-inline-images-DPoxyzVC.d.ts +0 -21
|
@@ -1,5 +1,30 @@
|
|
|
1
|
-
// src/lib/
|
|
1
|
+
// src/lib/media-urls.ts
|
|
2
2
|
import * as cheerio from "cheerio";
|
|
3
|
+
function rewriteOriginUrlsInText(text, config) {
|
|
4
|
+
if (!text || config.rules.length === 0) return text;
|
|
5
|
+
let result = text;
|
|
6
|
+
for (const rule of config.rules) {
|
|
7
|
+
if (typeof rule.match === "string") {
|
|
8
|
+
if (!rule.match) continue;
|
|
9
|
+
result = result.split(rule.match).join(rule.replace);
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
result = result.replace(rule.match, rule.replace);
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
function createWpContentGatewayRewrite(gatewayBase, publicOrigin) {
|
|
17
|
+
const normalizedGateway = gatewayBase.replace(/\/$/, "");
|
|
18
|
+
const normalizedPublic = publicOrigin.replace(/\/$/, "");
|
|
19
|
+
return {
|
|
20
|
+
rules: [
|
|
21
|
+
{
|
|
22
|
+
match: `${normalizedGateway}/wp-content/`,
|
|
23
|
+
replace: `${normalizedPublic}/wp-content/`
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
}
|
|
3
28
|
var IMAGE_EXTENSIONS = "jpe?g|png|gif|webp|avif|svg";
|
|
4
29
|
var IMAGE_EXTENSION_PATTERN = new RegExp(String.raw`\.(?:${IMAGE_EXTENSIONS})\b`, "i");
|
|
5
30
|
var QUOTED_IMAGE_PATH = String.raw`[^"']+\.(?:${IMAGE_EXTENSIONS})(?:\?[^"'#]*)?(?:#.*)?`;
|
|
@@ -146,14 +171,97 @@ function discoverContentAssetUrls(content) {
|
|
|
146
171
|
function extractInlineImageSrcs(content) {
|
|
147
172
|
return discoverContentAssetUrls(content);
|
|
148
173
|
}
|
|
174
|
+
var MIGRATION_MEDIA_REF_SCHEME = "artinstack-migration://asset/";
|
|
175
|
+
function formatMigrationMediaRef(sourceAssetId) {
|
|
176
|
+
return `${MIGRATION_MEDIA_REF_SCHEME}${encodeURIComponent(sourceAssetId)}`;
|
|
177
|
+
}
|
|
178
|
+
function isMigrationMediaRef(value) {
|
|
179
|
+
return value.trim().startsWith(MIGRATION_MEDIA_REF_SCHEME);
|
|
180
|
+
}
|
|
181
|
+
function parseMigrationMediaRef(value) {
|
|
182
|
+
const trimmed = value.trim();
|
|
183
|
+
if (!trimmed.startsWith(MIGRATION_MEDIA_REF_SCHEME)) return void 0;
|
|
184
|
+
const encoded = trimmed.slice(MIGRATION_MEDIA_REF_SCHEME.length);
|
|
185
|
+
if (!encoded) return void 0;
|
|
186
|
+
try {
|
|
187
|
+
return decodeURIComponent(encoded);
|
|
188
|
+
} catch {
|
|
189
|
+
return void 0;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function createMigrationMediaRefReplaceWith() {
|
|
193
|
+
return (ref) => {
|
|
194
|
+
if (!ref.sourceAssetId) return "";
|
|
195
|
+
return formatMigrationMediaRef(ref.sourceAssetId);
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function canonicalizeInlineAssetUrl(raw, originUrlRewrite) {
|
|
199
|
+
let value = raw.trim();
|
|
200
|
+
if (!value || value.startsWith("data:")) return void 0;
|
|
201
|
+
if (originUrlRewrite) {
|
|
202
|
+
value = rewriteOriginUrlsInText(value, originUrlRewrite);
|
|
203
|
+
}
|
|
204
|
+
const canonicalUrl = normalizeAssetUrl(value);
|
|
205
|
+
if (!canonicalUrl) return void 0;
|
|
206
|
+
return {
|
|
207
|
+
canonicalUrl,
|
|
208
|
+
sourceId: `url:${canonicalUrl}`
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function urlPathname(url) {
|
|
212
|
+
try {
|
|
213
|
+
return new URL(url, "http://migration.local").pathname;
|
|
214
|
+
} catch {
|
|
215
|
+
return void 0;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function buildMigrationMediaUrlIndex(entries) {
|
|
219
|
+
const index = /* @__PURE__ */ new Map();
|
|
220
|
+
for (const entry of entries) {
|
|
221
|
+
index.set(entry.sourceUrl, entry.sourceId);
|
|
222
|
+
const normalized = normalizeAssetUrl(entry.sourceUrl);
|
|
223
|
+
if (normalized) index.set(normalized, entry.sourceId);
|
|
224
|
+
const pathname = urlPathname(entry.sourceUrl);
|
|
225
|
+
if (pathname) index.set(pathname, entry.sourceId);
|
|
226
|
+
}
|
|
227
|
+
return index;
|
|
228
|
+
}
|
|
229
|
+
function resolveMigrationMediaSourceId(src, urlIndex, originUrlRewrite) {
|
|
230
|
+
const canonical = canonicalizeInlineAssetUrl(src, originUrlRewrite);
|
|
231
|
+
const normalized = canonical?.canonicalUrl ?? normalizeAssetUrl(src);
|
|
232
|
+
if (!normalized) return void 0;
|
|
233
|
+
return urlIndex.get(normalized) ?? urlIndex.get(src) ?? (urlPathname(normalized) ? urlIndex.get(urlPathname(normalized)) : void 0);
|
|
234
|
+
}
|
|
235
|
+
function buildContentMediaUrlIndex(entries, originUrlRewrite) {
|
|
236
|
+
const canonicalEntries = [];
|
|
237
|
+
for (const entry of entries) {
|
|
238
|
+
const canonical = canonicalizeInlineAssetUrl(entry.sourceUrl, originUrlRewrite);
|
|
239
|
+
canonicalEntries.push({
|
|
240
|
+
sourceUrl: canonical?.canonicalUrl ?? entry.sourceUrl,
|
|
241
|
+
sourceId: entry.sourceId
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
return buildMigrationMediaUrlIndex(canonicalEntries);
|
|
245
|
+
}
|
|
149
246
|
|
|
150
247
|
export {
|
|
248
|
+
rewriteOriginUrlsInText,
|
|
249
|
+
createWpContentGatewayRewrite,
|
|
151
250
|
discoverRawImgSrcs,
|
|
152
251
|
normalizeAssetUrl,
|
|
153
252
|
isLikelyImageUrl,
|
|
154
253
|
discoverFeaturedAssetCandidateUrls,
|
|
155
254
|
resolveFeaturedContentAssetUrl,
|
|
156
255
|
discoverContentAssetUrls,
|
|
157
|
-
extractInlineImageSrcs
|
|
256
|
+
extractInlineImageSrcs,
|
|
257
|
+
MIGRATION_MEDIA_REF_SCHEME,
|
|
258
|
+
formatMigrationMediaRef,
|
|
259
|
+
isMigrationMediaRef,
|
|
260
|
+
parseMigrationMediaRef,
|
|
261
|
+
createMigrationMediaRefReplaceWith,
|
|
262
|
+
canonicalizeInlineAssetUrl,
|
|
263
|
+
buildMigrationMediaUrlIndex,
|
|
264
|
+
resolveMigrationMediaSourceId,
|
|
265
|
+
buildContentMediaUrlIndex
|
|
158
266
|
};
|
|
159
|
-
//# sourceMappingURL=chunk-
|
|
267
|
+
//# sourceMappingURL=chunk-WHGUE5FC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/media-urls.ts"],"sourcesContent":["import * as cheerio from \"cheerio\";\n\n// --- Origin URL rewrite (gateway → public origin before parse/discovery) ---\n\nexport interface OriginUrlRewriteRule {\n /** Literal substring or regex matched against the full text block. */\n match: string | RegExp;\n replace: string;\n}\n\nexport interface OriginUrlRewriteConfig {\n rules: OriginUrlRewriteRule[];\n}\n\n/** Swap legacy gateway/staging host fragments before parse, fetch, or asset discovery. */\nexport function rewriteOriginUrlsInText(text: string, config: OriginUrlRewriteConfig): string {\n if (!text || config.rules.length === 0) return text;\n\n let result = text;\n for (const rule of config.rules) {\n if (typeof rule.match === \"string\") {\n if (!rule.match) continue;\n result = result.split(rule.match).join(rule.replace);\n continue;\n }\n result = result.replace(rule.match, rule.replace);\n }\n return result;\n}\n\n/** Build a rule that rewrites API-gateway `/prod/wp-content/` paths to a public origin. */\nexport function createWpContentGatewayRewrite(gatewayBase: string, publicOrigin: string): OriginUrlRewriteConfig {\n const normalizedGateway = gatewayBase.replace(/\\/$/, \"\");\n const normalizedPublic = publicOrigin.replace(/\\/$/, \"\");\n return {\n rules: [\n {\n match: `${normalizedGateway}/wp-content/`,\n replace: `${normalizedPublic}/wp-content/`,\n },\n ],\n };\n}\n\n// --- Content asset URL discovery & normalization ---\n\nconst IMAGE_EXTENSIONS = \"jpe?g|png|gif|webp|avif|svg\";\n/** Image file extension in a path or URL (allows trailing `?query` / `#hash`). */\nconst IMAGE_EXTENSION_PATTERN = new RegExp(String.raw`\\.(?:${IMAGE_EXTENSIONS})\\b`, \"i\");\n\n/** Captured value must contain an image extension — skips `url=\"…/about\"`, `<iframe src=\"…youtube…\">`, etc. */\nconst QUOTED_IMAGE_PATH = String.raw`[^\"']+\\.(?:${IMAGE_EXTENSIONS})(?:\\?[^\"'#]*)?(?:#.*)?`;\n\nconst SHORTCODE_IMAGE_PARAM_PATTERN = new RegExp(\n String.raw`\\b(?:image|bg_image|background_image|url)\\s*=\\s*[\"'](${QUOTED_IMAGE_PATH})[\"']`,\n \"gi\",\n);\n\n/** Bare `src=\"…jpg\"` outside `<img>` (shortcode fragments); `<img src>` handled by cheerio. */\nconst BARE_SRC_PARAM_PATTERN = new RegExp(\n String.raw`\\bsrc\\s*=\\s*[\"'](${QUOTED_IMAGE_PATH})[\"']`,\n \"gi\",\n);\n\nconst DATA_BG_IMAGE_PATTERN = /\\bdata-bg-image\\s*=\\s*[\"']([^\"']+)[\"']/gi;\n\n/** Inline CSS `background` / `background-image: url(…)` (quoted or bare). */\nconst BACKGROUND_IMAGE_URL_PATTERN =\n /background(?:-image)?\\s*:[^;]*?url\\s*\\(\\s*(['\"]?)([^'\")]+)\\1\\s*\\)/gi;\n\nconst HERO_URL_PARAM_PATTERN = new RegExp(\n String.raw`\\b(?:bg_image|background_image)\\s*=\\s*[\"'](${QUOTED_IMAGE_PATH})[\"']`,\n \"gi\",\n);\n\nconst INLINE_IMAGE_PARAM_PATTERN = new RegExp(\n String.raw`\\bimage\\s*=\\s*[\"'](${QUOTED_IMAGE_PATH})[\"']`,\n \"gi\",\n);\n\nconst IMG_TAG_SRC_PATTERN = /<img\\b[^>]*\\bsrc\\s*=\\s*[\"']([^\"']+)[\"']/gi;\n\ninterface FeaturedAssetCandidate {\n url: string;\n index: number;\n tier: 0 | 1;\n}\n\nfunction ingestLikelyImageUrl(urls: Set<string>, raw: string | undefined): void {\n const normalized = normalizeAssetUrl(raw ?? \"\");\n if (normalized && isLikelyImageUrl(normalized)) {\n urls.add(normalized);\n }\n}\n\nfunction extractImgTagSrcs(content: string): string[] {\n if (!content.trim()) return [];\n const $ = cheerio.load(content, { xml: false });\n const srcs: string[] = [];\n $(\"img[src]\").each((_, el) => {\n const src = $(el).attr(\"src\")?.trim();\n if (src) srcs.push(src);\n });\n return srcs;\n}\n\nfunction hasImageExtension(value: string): boolean {\n const withoutHash = value.split(\"#\", 1)[0] ?? value;\n const withoutQuery = withoutHash.split(\"?\", 1)[0] ?? withoutHash;\n return IMAGE_EXTENSION_PATTERN.test(withoutQuery);\n}\n\nfunction extractDataBgImageUrls(content: string): string[] {\n const urls: string[] = [];\n for (const match of content.matchAll(DATA_BG_IMAGE_PATTERN)) {\n const raw = match[1]?.trim();\n if (raw) urls.push(raw);\n }\n return urls;\n}\n\nfunction extractCssBackgroundImageUrls(content: string): string[] {\n const urls: string[] = [];\n for (const match of content.matchAll(BACKGROUND_IMAGE_URL_PATTERN)) {\n const raw = match[2]?.trim();\n if (raw) urls.push(raw);\n }\n return urls;\n}\n\n/** All `<img src>` values (including those not ingested as vault assets). */\nexport function discoverRawImgSrcs(content: string): string[] {\n return extractImgTagSrcs(content).filter((src) => !src.startsWith(\"data:\"));\n}\n\n/** Normalize protocol-relative and trim; skip data URIs. */\nexport function normalizeAssetUrl(raw: string): string | undefined {\n const trimmed = raw.trim();\n if (!trimmed || trimmed.startsWith(\"data:\")) return undefined;\n if (trimmed.startsWith(\"//\")) return `https:${trimmed}`;\n return trimmed;\n}\n\n/** Heuristic: URL likely points at a raster/vector image asset, not a page link. */\nexport function isLikelyImageUrl(url: string): boolean {\n if (!url || url.startsWith(\"data:\")) return false;\n\n if (url.startsWith(\"/\")) {\n return hasImageExtension(url);\n }\n\n if (!/^https?:\\/\\//i.test(url)) return false;\n\n try {\n const { pathname } = new URL(url);\n if (hasImageExtension(pathname)) return true;\n } catch {\n // fall through — malformed absolute URL\n }\n\n return hasImageExtension(url);\n}\n\nfunction pushFeaturedCandidate(\n candidates: FeaturedAssetCandidate[],\n raw: string | undefined,\n index: number,\n tier: 0 | 1,\n): void {\n const normalized = normalizeAssetUrl(raw ?? \"\");\n if (!normalized || !isLikelyImageUrl(normalized)) return;\n candidates.push({ url: normalized, index, tier });\n}\n\nfunction collectFeaturedAssetCandidates(content: string): FeaturedAssetCandidate[] {\n const candidates: FeaturedAssetCandidate[] = [];\n\n for (const match of content.matchAll(DATA_BG_IMAGE_PATTERN)) {\n pushFeaturedCandidate(candidates, match[1], match.index ?? 0, 0);\n }\n for (const match of content.matchAll(BACKGROUND_IMAGE_URL_PATTERN)) {\n pushFeaturedCandidate(candidates, match[2], match.index ?? 0, 0);\n }\n for (const match of content.matchAll(HERO_URL_PARAM_PATTERN)) {\n pushFeaturedCandidate(candidates, match[1], match.index ?? 0, 0);\n }\n for (const match of content.matchAll(IMG_TAG_SRC_PATTERN)) {\n pushFeaturedCandidate(candidates, match[1], match.index ?? 0, 1);\n }\n for (const match of content.matchAll(INLINE_IMAGE_PARAM_PATTERN)) {\n pushFeaturedCandidate(candidates, match[1], match.index ?? 0, 1);\n }\n\n return candidates;\n}\n\n/**\n * Ordered featured-image candidates when `_thumbnail_id` is missing — heroes\n * (`data-bg-image`, CSS backgrounds, `bg_image=`) before inline assets; within\n * each tier, first in document order wins. Filename tokens (`_w`, `_2048`, …)\n * are not interpreted as quality signals.\n */\nexport function discoverFeaturedAssetCandidateUrls(content: string): string[] {\n if (!content.trim()) return [];\n\n const ranked = [...collectFeaturedAssetCandidates(content)].sort((left, right) => {\n if (left.tier !== right.tier) return left.tier - right.tier;\n return left.index - right.index;\n });\n\n const urls: string[] = [];\n const seen = new Set<string>();\n for (const candidate of ranked) {\n if (seen.has(candidate.url)) continue;\n seen.add(candidate.url);\n urls.push(candidate.url);\n }\n return urls;\n}\n\n/** Best featured-image URL from post/page HTML when attachment id is unavailable. */\nexport function resolveFeaturedContentAssetUrl(content: string): string | undefined {\n return discoverFeaturedAssetCandidateUrls(content)[0];\n}\n\n/**\n * Generic content-discovery pass: collect image URLs from HTML `<img>` tags,\n * section hero markers (`data-bg-image`), inline CSS backgrounds, and common\n * shortcode/builder attributes (`src=`, `image=`, `bg_image=`, …) without\n * parsing builder-specific structure (Tatsu, Elementor, etc.).\n */\nexport function discoverContentAssetUrls(content: string): string[] {\n if (!content.trim()) return [];\n\n const urls = new Set<string>();\n\n for (const raw of extractImgTagSrcs(content)) {\n ingestLikelyImageUrl(urls, raw);\n }\n\n for (const match of content.matchAll(SHORTCODE_IMAGE_PARAM_PATTERN)) {\n ingestLikelyImageUrl(urls, match[1]);\n }\n\n for (const match of content.matchAll(BARE_SRC_PARAM_PATTERN)) {\n ingestLikelyImageUrl(urls, match[1]);\n }\n\n for (const raw of extractDataBgImageUrls(content)) {\n ingestLikelyImageUrl(urls, raw);\n }\n\n for (const raw of extractCssBackgroundImageUrls(content)) {\n ingestLikelyImageUrl(urls, raw);\n }\n\n return [...urls];\n}\n\n/** @deprecated Use discoverContentAssetUrls — kept for call-site clarity during transition. */\nexport function extractInlineImageSrcs(content: string): string[] {\n return discoverContentAssetUrls(content);\n}\n\n// --- Migration media refs (`artinstack-migration://asset/{sourceId}`) ---\n\n/** Pseudo-URL scheme for portable migration asset pointers (not WordPress shortcodes). */\nexport const MIGRATION_MEDIA_REF_SCHEME = \"artinstack-migration://asset/\";\n\n/** Build `artinstack-migration://asset/{sourceId}` (percent-encodes the normalizer source id). */\nexport function formatMigrationMediaRef(sourceAssetId: string): string {\n return `${MIGRATION_MEDIA_REF_SCHEME}${encodeURIComponent(sourceAssetId)}`;\n}\n\nexport function isMigrationMediaRef(value: string): boolean {\n return value.trim().startsWith(MIGRATION_MEDIA_REF_SCHEME);\n}\n\n/** Parse a migration media ref back to the normalizer `sourceId`, or `undefined` if not a ref. */\nexport function parseMigrationMediaRef(value: string): string | undefined {\n const trimmed = value.trim();\n if (!trimmed.startsWith(MIGRATION_MEDIA_REF_SCHEME)) return undefined;\n const encoded = trimmed.slice(MIGRATION_MEDIA_REF_SCHEME.length);\n if (!encoded) return undefined;\n try {\n return decodeURIComponent(encoded);\n } catch {\n return undefined;\n }\n}\n\n/** Default `replaceWith` for `rewriteInlineImages` / `stampMigrationMediaRefs` (OSS-14). */\nexport function createMigrationMediaRefReplaceWith(): (\n ref: { sourceAssetId?: string },\n) => string {\n return (ref) => {\n if (!ref.sourceAssetId) return \"\";\n return formatMigrationMediaRef(ref.sourceAssetId);\n };\n}\n\n// --- Canonical inline keys & lookup index (OSS-15) ---\n\nexport interface CanonicalInlineAssetUrl {\n /** Canonical absolute URL stored on `NormalizedAsset.sourceUrl`. */\n canonicalUrl: string;\n /** Normalizer id: `url:{canonicalUrl}`. */\n sourceId: string;\n}\n\n/**\n * OSS-15: one canonical key for inline `url:` assets — apply origin rewrite then\n * `normalizeAssetUrl` so discovery, refs, and vault entities share the same id.\n */\nexport function canonicalizeInlineAssetUrl(\n raw: string,\n originUrlRewrite?: OriginUrlRewriteConfig,\n): CanonicalInlineAssetUrl | undefined {\n let value = raw.trim();\n if (!value || value.startsWith(\"data:\")) return undefined;\n\n if (originUrlRewrite) {\n value = rewriteOriginUrlsInText(value, originUrlRewrite);\n }\n\n const canonicalUrl = normalizeAssetUrl(value);\n if (!canonicalUrl) return undefined;\n\n return {\n canonicalUrl,\n sourceId: `url:${canonicalUrl}`,\n };\n}\n\nfunction urlPathname(url: string): string | undefined {\n try {\n return new URL(url, \"http://migration.local\").pathname;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Map normalized upload URLs (and pathnames) → normalizer `sourceId`.\n * Attachment ids are WXR `post_id` strings; inline discoveries use `url:{src}`.\n */\nexport function buildMigrationMediaUrlIndex(\n entries: Iterable<{ sourceUrl: string; sourceId: string }>,\n): Map<string, string> {\n const index = new Map<string, string>();\n\n for (const entry of entries) {\n index.set(entry.sourceUrl, entry.sourceId);\n const normalized = normalizeAssetUrl(entry.sourceUrl);\n if (normalized) index.set(normalized, entry.sourceId);\n const pathname = urlPathname(entry.sourceUrl);\n if (pathname) index.set(pathname, entry.sourceId);\n }\n\n return index;\n}\n\nexport function resolveMigrationMediaSourceId(\n src: string,\n urlIndex: Map<string, string>,\n originUrlRewrite?: OriginUrlRewriteConfig,\n): string | undefined {\n const canonical = canonicalizeInlineAssetUrl(src, originUrlRewrite);\n const normalized = canonical?.canonicalUrl ?? normalizeAssetUrl(src);\n if (!normalized) return undefined;\n\n return (\n urlIndex.get(normalized) ??\n urlIndex.get(src) ??\n (urlPathname(normalized) ? urlIndex.get(urlPathname(normalized)!) : undefined)\n );\n}\n\n/** Merge attachment + inline asset rows into one stamp/lookup index (OSS-15). */\nexport function buildContentMediaUrlIndex(\n entries: Iterable<{ sourceUrl: string; sourceId: string }>,\n originUrlRewrite?: OriginUrlRewriteConfig,\n): Map<string, string> {\n const canonicalEntries: { sourceUrl: string; sourceId: string }[] = [];\n for (const entry of entries) {\n const canonical = canonicalizeInlineAssetUrl(entry.sourceUrl, originUrlRewrite);\n canonicalEntries.push({\n sourceUrl: canonical?.canonicalUrl ?? entry.sourceUrl,\n sourceId: entry.sourceId,\n });\n }\n return buildMigrationMediaUrlIndex(canonicalEntries);\n}\n"],"mappings":";AAAA,YAAY,aAAa;AAelB,SAAS,wBAAwB,MAAc,QAAwC;AAC5F,MAAI,CAAC,QAAQ,OAAO,MAAM,WAAW,EAAG,QAAO;AAE/C,MAAI,SAAS;AACb,aAAW,QAAQ,OAAO,OAAO;AAC/B,QAAI,OAAO,KAAK,UAAU,UAAU;AAClC,UAAI,CAAC,KAAK,MAAO;AACjB,eAAS,OAAO,MAAM,KAAK,KAAK,EAAE,KAAK,KAAK,OAAO;AACnD;AAAA,IACF;AACA,aAAS,OAAO,QAAQ,KAAK,OAAO,KAAK,OAAO;AAAA,EAClD;AACA,SAAO;AACT;AAGO,SAAS,8BAA8B,aAAqB,cAA8C;AAC/G,QAAM,oBAAoB,YAAY,QAAQ,OAAO,EAAE;AACvD,QAAM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BACd,SACA,kBACqB;AACrB,QAAM,mBAA8D,CAAC;AACrE,aAAW,SAAS,SAAS;AAC3B,UAAM,YAAY,2BAA2B,MAAM,WAAW,gBAAgB;AAC9E,qBAAiB,KAAK;AAAA,MACpB,WAAW,WAAW,gBAAgB,MAAM;AAAA,MAC5C,UAAU,MAAM;AAAA,IAClB,CAAC;AAAA,EACH;AACA,SAAO,4BAA4B,gBAAgB;AACrD;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/lib/utility.ts
|
|
2
|
+
function sanitizeSlug(raw) {
|
|
3
|
+
return raw.trim().toLowerCase().replace(/&[^;]+;/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 200);
|
|
4
|
+
}
|
|
5
|
+
function linkToPath(link) {
|
|
6
|
+
if (!link) return void 0;
|
|
7
|
+
try {
|
|
8
|
+
const url = new URL(link);
|
|
9
|
+
const path = url.pathname;
|
|
10
|
+
if (!path || path === "/") return "/";
|
|
11
|
+
return path.endsWith("/") ? path : `${path}/`;
|
|
12
|
+
} catch {
|
|
13
|
+
if (link.startsWith("/")) {
|
|
14
|
+
return link.endsWith("/") ? link : `${link}/`;
|
|
15
|
+
}
|
|
16
|
+
return void 0;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
sanitizeSlug,
|
|
22
|
+
linkToPath
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chunk-XRCF73DA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utility.ts"],"sourcesContent":["/** Lowercase URL-safe slug from WordPress post_name or title. */\nexport function sanitizeSlug(raw: string): string {\n return raw\n .trim()\n .toLowerCase()\n .replace(/&[^;]+;/g, \"\")\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 200);\n}\n\n/** Normalize absolute permalink to root-relative path. */\nexport function linkToPath(link: string | undefined): string | undefined {\n if (!link) return undefined;\n try {\n const url = new URL(link);\n const path = url.pathname;\n if (!path || path === \"/\") return \"/\";\n return path.endsWith(\"/\") ? path : `${path}/`;\n } catch {\n if (link.startsWith(\"/\")) {\n return link.endsWith(\"/\") ? link : `${link}/`;\n }\n return undefined;\n }\n}\n"],"mappings":";AACO,SAAS,aAAa,KAAqB;AAChD,SAAO,IACJ,KAAK,EACL,YAAY,EACZ,QAAQ,YAAY,EAAE,EACtB,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE,EACtB,MAAM,GAAG,GAAG;AACjB;AAGO,SAAS,WAAW,MAA8C;AACvE,MAAI,CAAC,KAAM,QAAO;AAClB,MAAI;AACF,UAAM,MAAM,IAAI,IAAI,IAAI;AACxB,UAAM,OAAO,IAAI;AACjB,QAAI,CAAC,QAAQ,SAAS,IAAK,QAAO;AAClC,WAAO,KAAK,SAAS,GAAG,IAAI,OAAO,GAAG,IAAI;AAAA,EAC5C,QAAQ;AACN,QAAI,KAAK,WAAW,GAAG,GAAG;AACxB,aAAO,KAAK,SAAS,GAAG,IAAI,OAAO,GAAG,IAAI;AAAA,IAC5C;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -8,12 +8,18 @@ import {
|
|
|
8
8
|
} from "./chunk-HI7JHWZU.js";
|
|
9
9
|
import {
|
|
10
10
|
rewriteInlineImages
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KYNKJ4XV.js";
|
|
12
12
|
import {
|
|
13
|
+
linkToPath,
|
|
14
|
+
sanitizeSlug
|
|
15
|
+
} from "./chunk-XRCF73DA.js";
|
|
16
|
+
import {
|
|
17
|
+
createMigrationMediaRefReplaceWith,
|
|
13
18
|
discoverContentAssetUrls,
|
|
14
19
|
discoverRawImgSrcs,
|
|
20
|
+
isMigrationMediaRef,
|
|
15
21
|
normalizeAssetUrl
|
|
16
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-WHGUE5FC.js";
|
|
17
23
|
|
|
18
24
|
// src/sinks/types.ts
|
|
19
25
|
var MIGRATION_WRITE_STAGES = [
|
|
@@ -35,25 +41,6 @@ import * as cheerio2 from "cheerio";
|
|
|
35
41
|
import { readFile } from "fs/promises";
|
|
36
42
|
import { basename } from "path";
|
|
37
43
|
|
|
38
|
-
// src/lib/utility.ts
|
|
39
|
-
function sanitizeSlug(raw) {
|
|
40
|
-
return raw.trim().toLowerCase().replace(/&[^;]+;/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 200);
|
|
41
|
-
}
|
|
42
|
-
function linkToPath(link) {
|
|
43
|
-
if (!link) return void 0;
|
|
44
|
-
try {
|
|
45
|
-
const url = new URL(link);
|
|
46
|
-
const path = url.pathname;
|
|
47
|
-
if (!path || path === "/") return "/";
|
|
48
|
-
return path.endsWith("/") ? path : `${path}/`;
|
|
49
|
-
} catch {
|
|
50
|
-
if (link.startsWith("/")) {
|
|
51
|
-
return link.endsWith("/") ? link : `${link}/`;
|
|
52
|
-
}
|
|
53
|
-
return void 0;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
44
|
// src/parsers/squarespace/collect.ts
|
|
58
45
|
import * as cheerio from "cheerio";
|
|
59
46
|
import { z } from "zod";
|
|
@@ -961,8 +948,35 @@ function fractionalLayoutMap(config) {
|
|
|
961
948
|
bgParamName: config.bgParamName
|
|
962
949
|
};
|
|
963
950
|
}
|
|
951
|
+
var WP_WIDGET_PLACEHOLDER = "\u200B";
|
|
952
|
+
var WORDPRESS_WIDGET_REGISTRY = {
|
|
953
|
+
mapShortcodePrefixes: [
|
|
954
|
+
"blox_gmap",
|
|
955
|
+
"tatsu_gmap",
|
|
956
|
+
"tatsu_map",
|
|
957
|
+
"et_pb_map",
|
|
958
|
+
"vc_gmaps",
|
|
959
|
+
"vc_map"
|
|
960
|
+
],
|
|
961
|
+
contactFormRules: [
|
|
962
|
+
{ tag: "contact-form-7", source: "contact-form-7", idParam: "id" },
|
|
963
|
+
{ tag: "contact_form", source: "contact-form-7", idParam: "id" },
|
|
964
|
+
{ tag: "gravityform", source: "gravityforms", idParam: "id" },
|
|
965
|
+
{ tag: "ninja_form", source: "ninja-forms", idParam: "id" },
|
|
966
|
+
{ tag: "wpforms", source: "wpforms", idParam: "id" }
|
|
967
|
+
],
|
|
968
|
+
videoShortcodePrefixes: [
|
|
969
|
+
"youtube",
|
|
970
|
+
"vimeo",
|
|
971
|
+
"embed",
|
|
972
|
+
"tatsu_video",
|
|
973
|
+
"et_pb_video",
|
|
974
|
+
"vc_video"
|
|
975
|
+
],
|
|
976
|
+
portfolioShortcode: "portfolio",
|
|
977
|
+
galleryShortcode: "gallery"
|
|
978
|
+
};
|
|
964
979
|
var UNRESOLVABLE_SHORTCODE_PREFIXES = [
|
|
965
|
-
"portfolio",
|
|
966
980
|
"recent_posts",
|
|
967
981
|
"woocommerce_cart",
|
|
968
982
|
"woocommerce_checkout",
|
|
@@ -986,8 +1000,7 @@ var WORDPRESS_BUILDER_REGISTRY = [
|
|
|
986
1000
|
],
|
|
987
1001
|
urlRules: [
|
|
988
1002
|
{ shortcodePrefix: "tatsu_image", urlParams: ["image", "url", "src"], tag: "img" },
|
|
989
|
-
{ shortcodePrefix: "tatsu_single_image", urlParams: ["image", "url", "src"], tag: "img" }
|
|
990
|
-
{ shortcodePrefix: "tatsu_video", urlParams: ["video", "src", "url"], tag: "video" }
|
|
1003
|
+
{ shortcodePrefix: "tatsu_single_image", urlParams: ["image", "url", "src"], tag: "img" }
|
|
991
1004
|
],
|
|
992
1005
|
iconImageRules: [
|
|
993
1006
|
{ shortcodePrefix: "tatsu_icon", imageParam: "icon_image", hrefParam: "href" }
|
|
@@ -1097,12 +1110,6 @@ var WORDPRESS_BUILDER_REGISTRY = [
|
|
|
1097
1110
|
urlRules: [
|
|
1098
1111
|
{ shortcodePrefix: "blox_image", urlParams: ["image", "img", "src", "url"], tag: "img" }
|
|
1099
1112
|
],
|
|
1100
|
-
placeholderRules: [
|
|
1101
|
-
{
|
|
1102
|
-
shortcodePrefix: "blox_gmap",
|
|
1103
|
-
html: '<p data-unresolved-shortcode="blox_gmap"><!-- Map embed removed during migration --></p>'
|
|
1104
|
-
}
|
|
1105
|
-
],
|
|
1106
1113
|
scaffoldingPrefixes: ["blox_", "animate_icon"],
|
|
1107
1114
|
legacyScaffoldingTokens: ["text", "icon", "linebreak", "grids", "testimonials"]
|
|
1108
1115
|
}
|
|
@@ -1194,6 +1201,7 @@ function mediaUrlSet(bundle) {
|
|
|
1194
1201
|
function findUnresolvedInlineImages(sourceId, contentHtml, mediaUrls) {
|
|
1195
1202
|
const conflicts = [];
|
|
1196
1203
|
for (const raw of discoverRawImgSrcs(contentHtml)) {
|
|
1204
|
+
if (isMigrationMediaRef(raw)) continue;
|
|
1197
1205
|
const normalized = normalizeAssetUrl(raw);
|
|
1198
1206
|
if (!normalized) continue;
|
|
1199
1207
|
if (!mediaUrls.has(normalized) && !mediaUrls.has(raw)) {
|
|
@@ -1442,6 +1450,8 @@ function mergeRewriteOptions(bundle, options) {
|
|
|
1442
1450
|
const normalized = normalizeAssetUrl(asset.sourceUrl);
|
|
1443
1451
|
if (normalized) urlToSourceId.set(normalized, asset.sourceId);
|
|
1444
1452
|
}
|
|
1453
|
+
const replaceWith = options.replaceWith ?? createMigrationMediaRefReplaceWith();
|
|
1454
|
+
const requireUploaded = options.requireUploaded ?? Boolean(options.replaceWith);
|
|
1445
1455
|
return {
|
|
1446
1456
|
resolveAsset: (src) => {
|
|
1447
1457
|
const resolved = options.resolveAsset(src);
|
|
@@ -1451,7 +1461,8 @@ function mergeRewriteOptions(bundle, options) {
|
|
|
1451
1461
|
if (!sourceAssetId) return void 0;
|
|
1452
1462
|
return { originalSrc: src, sourceAssetId };
|
|
1453
1463
|
},
|
|
1454
|
-
replaceWith
|
|
1464
|
+
replaceWith,
|
|
1465
|
+
requireUploaded
|
|
1455
1466
|
};
|
|
1456
1467
|
}
|
|
1457
1468
|
function emptyBody() {
|
|
@@ -1682,8 +1693,6 @@ async function runDryRun(options) {
|
|
|
1682
1693
|
|
|
1683
1694
|
export {
|
|
1684
1695
|
MIGRATION_WRITE_STAGES,
|
|
1685
|
-
sanitizeSlug,
|
|
1686
|
-
linkToPath,
|
|
1687
1696
|
SQUARESPACE_JSON_FORMAT,
|
|
1688
1697
|
buildJsonPrettyUrl,
|
|
1689
1698
|
mapJsonPrettyWire,
|
|
@@ -1691,6 +1700,8 @@ export {
|
|
|
1691
1700
|
enumerateSquarespaceEntities,
|
|
1692
1701
|
summarizeSquarespaceExport,
|
|
1693
1702
|
validateSquarespaceExportFile,
|
|
1703
|
+
WP_WIDGET_PLACEHOLDER,
|
|
1704
|
+
WORDPRESS_WIDGET_REGISTRY,
|
|
1694
1705
|
WORDPRESS_BUILDER_REGISTRY,
|
|
1695
1706
|
emptyConflictReport,
|
|
1696
1707
|
analyzeConflicts,
|
|
@@ -1711,4 +1722,4 @@ export {
|
|
|
1711
1722
|
staleUrlsFromEstimate,
|
|
1712
1723
|
runDryRun
|
|
1713
1724
|
};
|
|
1714
|
-
//# sourceMappingURL=chunk-
|
|
1725
|
+
//# sourceMappingURL=chunk-Z3L6N63Y.js.map
|