@artinstack/migrator 0.1.8 → 0.1.10
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/{bundle-uAAHehbv.d.ts → bundle-Do-9ikQv.d.ts} +1 -1
- package/dist/{chunk-Z3L6N63Y.js → chunk-3A2PA4P3.js} +80 -9
- package/dist/chunk-3A2PA4P3.js.map +1 -0
- package/dist/{chunk-KYNKJ4XV.js → chunk-BONZ3U3I.js} +2 -2
- package/dist/{chunk-HI7JHWZU.js → chunk-LC7CGWDN.js} +1 -1
- package/dist/chunk-LC7CGWDN.js.map +1 -0
- package/dist/{chunk-WHGUE5FC.js → chunk-S4GMDRGX.js} +39 -4
- package/dist/chunk-S4GMDRGX.js.map +1 -0
- package/dist/{chunk-ALLFBWBO.js → chunk-S4SUJT2D.js} +2 -2
- package/dist/{chunk-CB5KRANW.js → chunk-YLVPZ4M3.js} +155 -30
- package/dist/chunk-YLVPZ4M3.js.map +1 -0
- package/dist/cli/index.js +12 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +12 -6
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +3 -1
- package/dist/{media-urls-w46-CWUp.d.ts → media-urls-u49RCyPn.d.ts} +15 -1
- package/dist/normalizer/index.d.ts +4 -4
- package/dist/normalizer/index.js +1 -1
- package/dist/{rewrite-inline-images-DyxKUNs3.d.ts → rewrite-inline-images-BsgSquzV.d.ts} +1 -1
- package/dist/sinks/index.d.ts +31 -6
- package/dist/sinks/index.js +8 -4
- package/dist/transformers/index.d.ts +3 -3
- package/dist/transformers/index.js +3 -3
- package/dist/{types-DWOP8Dcy.d.ts → types-TCHy3Oko.d.ts} +17 -1
- package/package.json +1 -1
- package/dist/chunk-CB5KRANW.js.map +0 -1
- package/dist/chunk-HI7JHWZU.js.map +0 -1
- package/dist/chunk-WHGUE5FC.js.map +0 -1
- package/dist/chunk-Z3L6N63Y.js.map +0 -1
- /package/dist/{chunk-KYNKJ4XV.js.map → chunk-BONZ3U3I.js.map} +0 -0
- /package/dist/{chunk-ALLFBWBO.js.map → chunk-S4SUJT2D.js.map} +0 -0
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { writeFile } from \"node:fs/promises\";\nimport { mkdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport { getAdapter } from \"../parsers/index.js\";\nimport type { MigrationPlatform } from \"../normalizer/types.js\";\nimport {\n analyzeConflicts,\n buildMigrationReport,\n buildRedirectMap,\n bundleToCombinedJson,\n createFilesystemMigrationSink,\n detectRedirectLoops,\n hasBlockingConflicts,\n hasWarnings,\n runDryRun,\n runMigration,\n writeFilesystemExport,\n} from \"../sinks/index.js\";\nimport { collectEntities } from \"../normalizer/bundle.js\";\nimport { createWpContentGatewayRewrite } from \"../lib/media-urls.js\";\nimport { estimateStorage, staleUrlsFromEstimate } from \"../sinks/storage-estimate.js\";\n\nconst PLATFORMS: MigrationPlatform[] = [\"wordpress\", \"smugmug\", \"squarespace\", \"wix\"];\nconst SINKS = [\"filesystem\"] as const;\n\nfunction printUsage(): void {\n console.log(`artinstack-migrate — platform content migration CLI\n\nUsage:\n artinstack-migrate <platform> <export-file> [options]\n artinstack-migrate validate <platform> <export-file>\n\nPlatforms: ${PLATFORMS.join(\", \")}\n\nOptions:\n --out <dir> Write grouped JSON files to directory\n --sink <name> Run through MigrationSink (supported: ${SINKS.join(\", \")})\n --format json Write combined JSON to stdout\n --dry-run Parse and analyze without writing content files\n --report <dir> With --dry-run, write conflicts.json + migration-report.json\n --offline Skip network HEAD requests (4 MB fallback per asset)\n --urls <file> Wix W2: newline URL list or sitemap.xml for static page snapshots\n --rewrite-gateway <url> WordPress: API gateway base (requires --rewrite-public)\n --rewrite-public <url> WordPress: public origin for /wp-content/ asset paths\n\nExamples:\n artinstack-migrate wordpress export.xml --dry-run --report ./preview/\n artinstack-migrate wordpress export.xml --rewrite-gateway https://gateway.example/prod --rewrite-public https://www.example.com --dry-run --report ./preview/\n artinstack-migrate wix feed.xml --urls ./sitemap-urls.txt --dry-run\n artinstack-migrate wordpress export.xml --out ./output\n artinstack-migrate wordpress export.xml --sink filesystem --out ./output\n pnpm cli wordpress fixtures/wordpress/long-form-journal.xml --dry-run\n`);\n}\n\nfunction printDryRunStatus(exitCode: 0 | 1 | 2, reportDir?: string): void {\n const dest = reportDir ? ` Reports written to ${reportDir}.` : \"\";\n if (exitCode === 0) {\n console.error(`Dry run complete.${dest}`);\n } else if (exitCode === 2) {\n console.error(`Dry run complete with warnings (exit 2).${dest}`);\n } else {\n console.error(`Dry run found blocking conflicts (exit 1).${dest}`);\n }\n}\n\nfunction parseArgs(argv: string[]): {\n command: string | undefined;\n platform: MigrationPlatform | undefined;\n inputPath: string | undefined;\n urlsPath: string | undefined;\n outDir: string | undefined;\n reportDir: string | undefined;\n sinkName: string | undefined;\n dryRun: boolean;\n formatJson: boolean;\n offline: boolean;\n rewriteGateway: string | undefined;\n rewritePublic: string | undefined;\n} {\n const args = [...argv];\n let command: string | undefined;\n let platform: MigrationPlatform | undefined;\n let inputPath: string | undefined;\n let urlsPath: string | undefined;\n let outDir: string | undefined;\n let reportDir: string | undefined;\n let sinkName: string | undefined;\n let dryRun = false;\n let formatJson = false;\n let offline = false;\n let rewriteGateway: string | undefined;\n let rewritePublic: string | undefined;\n\n const first = args[0];\n if (first === \"validate\") {\n command = \"validate\";\n platform = args[1] as MigrationPlatform;\n inputPath = args[2];\n for (let i = 3; i < args.length; i++) {\n if (args[i] === \"--urls\" && args[i + 1]) urlsPath = args[++i];\n }\n } else if (first && PLATFORMS.includes(first as MigrationPlatform)) {\n command = \"migrate\";\n platform = first as MigrationPlatform;\n inputPath = args[1];\n for (let i = 2; i < args.length; i++) {\n const flag = args[i];\n if (flag === \"--dry-run\") dryRun = true;\n else if (flag === \"--format\" && args[i + 1] === \"json\") formatJson = true;\n else if (flag === \"--offline\") offline = true;\n else if (flag === \"--out\" && args[i + 1]) {\n outDir = args[++i];\n } else if (flag === \"--report\" && args[i + 1]) {\n reportDir = args[++i];\n } else if (flag === \"--sink\" && args[i + 1]) {\n sinkName = args[++i];\n } else if (flag === \"--urls\" && args[i + 1]) {\n urlsPath = args[++i];\n } else if (flag === \"--rewrite-gateway\" && args[i + 1]) {\n rewriteGateway = args[++i];\n } else if (flag === \"--rewrite-public\" && args[i + 1]) {\n rewritePublic = args[++i];\n }\n }\n } else {\n command = first;\n }\n\n return { command, platform, inputPath, urlsPath, outDir, reportDir, sinkName, dryRun, formatJson, offline, rewriteGateway, rewritePublic };\n}\n\nfunction buildAdapterInput(\n platform: MigrationPlatform,\n inputPath: string,\n urlsPath: string | undefined,\n rewriteGateway: string | undefined,\n rewritePublic: string | undefined,\n): unknown {\n if (rewriteGateway || rewritePublic) {\n if (platform !== \"wordpress\") {\n throw new Error(\"--rewrite-gateway and --rewrite-public are WordPress-only options\");\n }\n if (!rewriteGateway || !rewritePublic) {\n throw new Error(\"Both --rewrite-gateway and --rewrite-public are required together\");\n }\n }\n\n if (platform === \"wordpress\") {\n return {\n path: inputPath,\n ...(rewriteGateway && rewritePublic\n ? { originUrlRewrite: createWpContentGatewayRewrite(rewriteGateway, rewritePublic) }\n : {}),\n };\n }\n\n return {\n path: inputPath,\n ...(urlsPath ? { urlsFile: urlsPath } : {}),\n };\n}\n\nfunction migrationExitCode(hasBlockers: boolean, hasWarn: boolean): 0 | 1 | 2 {\n if (hasBlockers) return 1;\n if (hasWarn) return 2;\n return 0;\n}\n\nasync function main(): Promise<void> {\n const { command, platform, inputPath, urlsPath, outDir, reportDir, sinkName, dryRun, formatJson, offline, rewriteGateway, rewritePublic } =\n parseArgs(process.argv.slice(2));\n\n if (!command || command === \"--help\" || command === \"-h\") {\n printUsage();\n process.exit(0);\n }\n\n if (command === \"validate\") {\n if (!platform || !PLATFORMS.includes(platform) || !inputPath) {\n console.error(\"Usage: artinstack-migrate validate <platform> <export-file>\");\n process.exit(1);\n }\n const adapter = getAdapter(platform);\n const result = await adapter.validateInput({\n path: inputPath,\n ...(urlsPath ? { urlsFile: urlsPath } : {}),\n });\n console.log(JSON.stringify(result, null, 2));\n process.exit(result.ok ? 0 : 1);\n }\n\n if (command === \"migrate\") {\n if (!platform || !inputPath) {\n printUsage();\n process.exit(1);\n }\n\n if (sinkName && !SINKS.includes(sinkName as (typeof SINKS)[number])) {\n console.error(`Unknown sink: ${sinkName}. Supported: ${SINKS.join(\", \")}`);\n process.exit(1);\n }\n\n const adapter = getAdapter(platform);\n let input: unknown;\n try {\n input = buildAdapterInput(platform, inputPath, urlsPath, rewriteGateway, rewritePublic);\n } catch (error) {\n console.error(error instanceof Error ? error.message : error);\n process.exit(1);\n }\n\n if (dryRun) {\n const result = await runDryRun({\n adapter,\n input,\n platform,\n offlineStorageEstimate: offline,\n });\n\n if (reportDir) {\n await mkdir(reportDir, { recursive: true });\n await writeFile(\n join(reportDir, \"conflicts.json\"),\n `${JSON.stringify(result.conflicts, null, 2)}\\n`,\n );\n await writeFile(\n join(reportDir, \"migration-report.json\"),\n `${JSON.stringify(result.report, null, 2)}\\n`,\n );\n } else {\n console.log(JSON.stringify(result.report, null, 2));\n }\n\n printDryRunStatus(result.exitCode, reportDir);\n process.exit(result.exitCode);\n }\n\n const startedAt = new Date();\n\n if (sinkName === \"filesystem\") {\n if (!outDir) {\n console.error(\"Filesystem sink requires --out <dir>\");\n process.exit(1);\n }\n\n const sink = createFilesystemMigrationSink();\n const runResult = await runMigration({\n sink,\n platform,\n entities: adapter.enumerateEntities({ input }),\n });\n\n const bundle = sink.bundle;\n const estimate = await estimateStorage({\n assets: bundle.media,\n offline,\n });\n const redirectMap = buildRedirectMap(bundle);\n const conflicts = analyzeConflicts(bundle, {\n staleAssetUrls: staleUrlsFromEstimate(estimate),\n redirectLoops: detectRedirectLoops(redirectMap),\n });\n const report = buildMigrationReport({\n platform,\n mode: \"sink\",\n bundle,\n conflicts,\n redirectMap,\n startedAt,\n storageBytesEstimated: estimate.totalBytes,\n warnings:\n runResult.failed > 0\n ? [`${runResult.failed} entity write(s) failed during sink migration`]\n : [],\n });\n\n await sink.flush({ outDir, bundle, conflicts, report });\n console.error(`Wrote sink export to ${outDir}`);\n\n const exitCode = migrationExitCode(\n hasBlockingConflicts(conflicts) || runResult.failed > 0,\n hasWarnings(conflicts),\n );\n process.exit(exitCode);\n }\n\n const bundle = await collectEntities(adapter.enumerateEntities({ input }));\n\n const estimate = await estimateStorage({\n assets: bundle.media,\n offline,\n });\n const redirectMap = buildRedirectMap(bundle);\n const conflicts = analyzeConflicts(bundle, {\n staleAssetUrls: staleUrlsFromEstimate(estimate),\n });\n\n const report = buildMigrationReport({\n platform,\n mode: \"export\",\n bundle,\n conflicts,\n redirectMap,\n startedAt,\n storageBytesEstimated: estimate.totalBytes,\n });\n\n if (formatJson) {\n console.log(JSON.stringify({ ...bundleToCombinedJson(bundle), conflicts, report }, null, 2));\n process.exit(0);\n }\n\n if (!outDir) {\n console.error(\"Specify --out <dir>, --format json, --dry-run, or --sink filesystem --out <dir>\");\n process.exit(1);\n }\n\n await writeFilesystemExport({\n outDir,\n bundle,\n conflicts,\n report,\n });\n\n console.error(`Wrote export to ${outDir}`);\n process.exit(0);\n }\n\n console.error(`Unknown command: ${command}`);\n printUsage();\n process.exit(1);\n}\n\nmain().catch((error: unknown) => {\n console.error(error instanceof Error ? error.message : error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,YAAY;AAqBrB,IAAM,YAAiC,CAAC,aAAa,WAAW,eAAe,KAAK;AACpF,IAAM,QAAQ,CAAC,YAAY;AAE3B,SAAS,aAAmB;AAC1B,UAAQ,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAMD,UAAU,KAAK,IAAI,CAAC;AAAA;AAA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,KAAK,CAAC;AAAA,EAChB;AAEA,UAAQ,MAAM,oBAAoB,OAAO,EAAE;AAC3C,aAAW;AACX,UAAQ,KAAK,CAAC;AAChB;AAEA,KAAK,EAAE,MAAM,CAAC,UAAmB;AAC/B,UAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,KAAK;AAC5D,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["bundle","estimate","redirectMap","conflicts","report"]}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { writeFile } from \"node:fs/promises\";\nimport { mkdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport { getAdapter } from \"../parsers/index.js\";\nimport type { MigrationPlatform } from \"../normalizer/types.js\";\nimport {\n analyzeConflicts,\n buildMigrationReport,\n buildRedirectMap,\n bundleToCombinedJson,\n createFilesystemMigrationSink,\n detectRedirectLoops,\n hasBlockingConflicts,\n hasWarnings,\n runDryRun,\n resolveAdapterImportSummary,\n runMigration,\n writeFilesystemExport,\n} from \"../sinks/index.js\";\nimport { collectEntities } from \"../normalizer/bundle.js\";\nimport { createWpContentGatewayRewrite } from \"../lib/media-urls.js\";\nimport { estimateStorage, staleUrlsFromEstimate } from \"../sinks/storage-estimate.js\";\n\nconst PLATFORMS: MigrationPlatform[] = [\"wordpress\", \"smugmug\", \"squarespace\", \"wix\"];\nconst SINKS = [\"filesystem\"] as const;\n\nfunction printUsage(): void {\n console.log(`artinstack-migrate — platform content migration CLI\n\nUsage:\n artinstack-migrate <platform> <export-file> [options]\n artinstack-migrate validate <platform> <export-file>\n\nPlatforms: ${PLATFORMS.join(\", \")}\n\nOptions:\n --out <dir> Write grouped JSON files to directory\n --sink <name> Run through MigrationSink (supported: ${SINKS.join(\", \")})\n --format json Write combined JSON to stdout\n --dry-run Parse and analyze without writing content files\n --report <dir> With --dry-run, write conflicts.json + migration-report.json\n --offline Skip network HEAD requests (4 MB fallback per asset)\n --urls <file> Wix W2: newline URL list or sitemap.xml for static page snapshots\n --rewrite-gateway <url> WordPress: API gateway base (requires --rewrite-public)\n --rewrite-public <url> WordPress: public origin for /wp-content/ asset paths\n\nExamples:\n artinstack-migrate wordpress export.xml --dry-run --report ./preview/\n artinstack-migrate wordpress export.xml --rewrite-gateway https://gateway.example/prod --rewrite-public https://www.example.com --dry-run --report ./preview/\n artinstack-migrate wix feed.xml --urls ./sitemap-urls.txt --dry-run\n artinstack-migrate wordpress export.xml --out ./output\n artinstack-migrate wordpress export.xml --sink filesystem --out ./output\n pnpm cli wordpress fixtures/wordpress/long-form-journal.xml --dry-run\n`);\n}\n\nfunction printDryRunStatus(exitCode: 0 | 1 | 2, reportDir?: string): void {\n const dest = reportDir ? ` Reports written to ${reportDir}.` : \"\";\n if (exitCode === 0) {\n console.error(`Dry run complete.${dest}`);\n } else if (exitCode === 2) {\n console.error(`Dry run complete with warnings (exit 2).${dest}`);\n } else {\n console.error(`Dry run found blocking conflicts (exit 1).${dest}`);\n }\n}\n\nfunction parseArgs(argv: string[]): {\n command: string | undefined;\n platform: MigrationPlatform | undefined;\n inputPath: string | undefined;\n urlsPath: string | undefined;\n outDir: string | undefined;\n reportDir: string | undefined;\n sinkName: string | undefined;\n dryRun: boolean;\n formatJson: boolean;\n offline: boolean;\n rewriteGateway: string | undefined;\n rewritePublic: string | undefined;\n} {\n const args = [...argv];\n let command: string | undefined;\n let platform: MigrationPlatform | undefined;\n let inputPath: string | undefined;\n let urlsPath: string | undefined;\n let outDir: string | undefined;\n let reportDir: string | undefined;\n let sinkName: string | undefined;\n let dryRun = false;\n let formatJson = false;\n let offline = false;\n let rewriteGateway: string | undefined;\n let rewritePublic: string | undefined;\n\n const first = args[0];\n if (first === \"validate\") {\n command = \"validate\";\n platform = args[1] as MigrationPlatform;\n inputPath = args[2];\n for (let i = 3; i < args.length; i++) {\n if (args[i] === \"--urls\" && args[i + 1]) urlsPath = args[++i];\n }\n } else if (first && PLATFORMS.includes(first as MigrationPlatform)) {\n command = \"migrate\";\n platform = first as MigrationPlatform;\n inputPath = args[1];\n for (let i = 2; i < args.length; i++) {\n const flag = args[i];\n if (flag === \"--dry-run\") dryRun = true;\n else if (flag === \"--format\" && args[i + 1] === \"json\") formatJson = true;\n else if (flag === \"--offline\") offline = true;\n else if (flag === \"--out\" && args[i + 1]) {\n outDir = args[++i];\n } else if (flag === \"--report\" && args[i + 1]) {\n reportDir = args[++i];\n } else if (flag === \"--sink\" && args[i + 1]) {\n sinkName = args[++i];\n } else if (flag === \"--urls\" && args[i + 1]) {\n urlsPath = args[++i];\n } else if (flag === \"--rewrite-gateway\" && args[i + 1]) {\n rewriteGateway = args[++i];\n } else if (flag === \"--rewrite-public\" && args[i + 1]) {\n rewritePublic = args[++i];\n }\n }\n } else {\n command = first;\n }\n\n return { command, platform, inputPath, urlsPath, outDir, reportDir, sinkName, dryRun, formatJson, offline, rewriteGateway, rewritePublic };\n}\n\nfunction buildAdapterInput(\n platform: MigrationPlatform,\n inputPath: string,\n urlsPath: string | undefined,\n rewriteGateway: string | undefined,\n rewritePublic: string | undefined,\n): unknown {\n if (rewriteGateway || rewritePublic) {\n if (platform !== \"wordpress\") {\n throw new Error(\"--rewrite-gateway and --rewrite-public are WordPress-only options\");\n }\n if (!rewriteGateway || !rewritePublic) {\n throw new Error(\"Both --rewrite-gateway and --rewrite-public are required together\");\n }\n }\n\n if (platform === \"wordpress\") {\n return {\n path: inputPath,\n ...(rewriteGateway && rewritePublic\n ? { originUrlRewrite: createWpContentGatewayRewrite(rewriteGateway, rewritePublic) }\n : {}),\n };\n }\n\n return {\n path: inputPath,\n ...(urlsPath ? { urlsFile: urlsPath } : {}),\n };\n}\n\nfunction migrationExitCode(hasBlockers: boolean, hasWarn: boolean): 0 | 1 | 2 {\n if (hasBlockers) return 1;\n if (hasWarn) return 2;\n return 0;\n}\n\nasync function main(): Promise<void> {\n const { command, platform, inputPath, urlsPath, outDir, reportDir, sinkName, dryRun, formatJson, offline, rewriteGateway, rewritePublic } =\n parseArgs(process.argv.slice(2));\n\n if (!command || command === \"--help\" || command === \"-h\") {\n printUsage();\n process.exit(0);\n }\n\n if (command === \"validate\") {\n if (!platform || !PLATFORMS.includes(platform) || !inputPath) {\n console.error(\"Usage: artinstack-migrate validate <platform> <export-file>\");\n process.exit(1);\n }\n const adapter = getAdapter(platform);\n const result = await adapter.validateInput({\n path: inputPath,\n ...(urlsPath ? { urlsFile: urlsPath } : {}),\n });\n console.log(JSON.stringify(result, null, 2));\n process.exit(result.ok ? 0 : 1);\n }\n\n if (command === \"migrate\") {\n if (!platform || !inputPath) {\n printUsage();\n process.exit(1);\n }\n\n if (sinkName && !SINKS.includes(sinkName as (typeof SINKS)[number])) {\n console.error(`Unknown sink: ${sinkName}. Supported: ${SINKS.join(\", \")}`);\n process.exit(1);\n }\n\n const adapter = getAdapter(platform);\n let input: unknown;\n try {\n input = buildAdapterInput(platform, inputPath, urlsPath, rewriteGateway, rewritePublic);\n } catch (error) {\n console.error(error instanceof Error ? error.message : error);\n process.exit(1);\n }\n\n if (dryRun) {\n const result = await runDryRun({\n adapter,\n input,\n platform,\n offlineStorageEstimate: offline,\n });\n\n if (reportDir) {\n await mkdir(reportDir, { recursive: true });\n await writeFile(\n join(reportDir, \"conflicts.json\"),\n `${JSON.stringify(result.conflicts, null, 2)}\\n`,\n );\n await writeFile(\n join(reportDir, \"migration-report.json\"),\n `${JSON.stringify(result.report, null, 2)}\\n`,\n );\n } else {\n console.log(JSON.stringify(result.report, null, 2));\n }\n\n printDryRunStatus(result.exitCode, reportDir);\n process.exit(result.exitCode);\n }\n\n const startedAt = new Date();\n\n if (sinkName === \"filesystem\") {\n if (!outDir) {\n console.error(\"Filesystem sink requires --out <dir>\");\n process.exit(1);\n }\n\n const sink = createFilesystemMigrationSink();\n const runResult = await runMigration({\n sink,\n platform,\n entities: adapter.enumerateEntities({ input }),\n });\n\n const bundle = sink.bundle;\n const wxrImportSummary = await resolveAdapterImportSummary(adapter, input);\n const estimate = await estimateStorage({\n assets: bundle.media,\n offline,\n });\n const redirectMap = buildRedirectMap(bundle);\n const conflicts = analyzeConflicts(bundle, {\n staleAssetUrls: staleUrlsFromEstimate(estimate),\n redirectLoops: detectRedirectLoops(redirectMap),\n wxrImportSummary,\n });\n const report = buildMigrationReport({\n platform,\n mode: \"sink\",\n bundle,\n conflicts,\n redirectMap,\n startedAt,\n storageBytesEstimated: estimate.totalBytes,\n warnings:\n runResult.failed > 0\n ? [`${runResult.failed} entity write(s) failed during sink migration`]\n : [],\n });\n\n await sink.flush({ outDir, bundle, conflicts, report });\n console.error(`Wrote sink export to ${outDir}`);\n\n const exitCode = migrationExitCode(\n hasBlockingConflicts(conflicts) || runResult.failed > 0,\n hasWarnings(conflicts),\n );\n process.exit(exitCode);\n }\n\n const bundle = await collectEntities(adapter.enumerateEntities({ input }));\n const wxrImportSummary = await resolveAdapterImportSummary(adapter, input);\n\n const estimate = await estimateStorage({\n assets: bundle.media,\n offline,\n });\n const redirectMap = buildRedirectMap(bundle);\n const conflicts = analyzeConflicts(bundle, {\n staleAssetUrls: staleUrlsFromEstimate(estimate),\n wxrImportSummary,\n });\n\n const report = buildMigrationReport({\n platform,\n mode: \"export\",\n bundle,\n conflicts,\n redirectMap,\n startedAt,\n storageBytesEstimated: estimate.totalBytes,\n });\n\n if (formatJson) {\n console.log(JSON.stringify({ ...bundleToCombinedJson(bundle), conflicts, report }, null, 2));\n process.exit(0);\n }\n\n if (!outDir) {\n console.error(\"Specify --out <dir>, --format json, --dry-run, or --sink filesystem --out <dir>\");\n process.exit(1);\n }\n\n await writeFilesystemExport({\n outDir,\n bundle,\n conflicts,\n report,\n });\n\n console.error(`Wrote export to ${outDir}`);\n process.exit(0);\n }\n\n console.error(`Unknown command: ${command}`);\n printUsage();\n process.exit(1);\n}\n\nmain().catch((error: unknown) => {\n console.error(error instanceof Error ? error.message : error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,iBAAiB;AAC1B,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ACd,cAAQ,IAAI,KAAK,UAAU,EAAE,GAAG,qBAAqB,MAAM,GAAG,WAAW,OAAO,GAAG,MAAM,CAAC,CAAC;AAC3F,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,QAAI,CAAC,QAAQ;AACX,cAAQ,MAAM,iFAAiF;AAC/F,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,UAAM,sBAAsB;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,YAAQ,MAAM,mBAAmB,MAAM,EAAE;AACzC,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,UAAQ,MAAM,oBAAoB,OAAO,EAAE;AAC3C,aAAW;AACX,UAAQ,KAAK,CAAC;AAChB;AAEA,KAAK,EAAE,MAAM,CAAC,UAAmB;AAC/B,UAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,KAAK;AAC5D,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["bundle","wxrImportSummary","estimate","redirectMap","conflicts","report"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { M as MigrationAdapter, g as MigrationPlatform } from './types-
|
|
2
|
-
export { A as AdapterContext, E as EntityKey, h as EntityType, i as MigrationCursor, b as NormalizedAsset, j as NormalizedAssetExif, d as NormalizedCategory, f as NormalizedEntity, a as NormalizedPage, c as NormalizedPortfolio, N as NormalizedPost, e as NormalizedTag, P as PortfolioMediaLink, k as PublishStatus, S as SourceMetadata, V as ValidationIssue, l as ValidationResult, m as entityKey } from './types-
|
|
1
|
+
import { M as MigrationAdapter, g as MigrationPlatform } from './types-TCHy3Oko.js';
|
|
2
|
+
export { A as AdapterContext, E as EntityKey, h as EntityType, i as MigrationCursor, b as NormalizedAsset, j as NormalizedAssetExif, d as NormalizedCategory, f as NormalizedEntity, a as NormalizedPage, c as NormalizedPortfolio, N as NormalizedPost, e as NormalizedTag, P as PortfolioMediaLink, k as PublishStatus, S as SourceMetadata, V as ValidationIssue, l as ValidationResult, W as WxrImportSummary, m as entityKey } from './types-TCHy3Oko.js';
|
|
3
3
|
export { EntityState, MigrationCheckpoint, TrackedEntity, buildPortfolioMediaLinks, isTerminalState, normalizedAssetExifSchema, normalizedAssetSchema, normalizedCategorySchema, normalizedEntitySchema, normalizedPageSchema, normalizedPortfolioSchema, normalizedPostSchema, normalizedTagSchema, shouldProcessEntity, sourceMetadataSchema, validateNormalizedAsset, validateNormalizedCategory, validateNormalizedEntity, validateNormalizedPage, validateNormalizedPortfolio, validateNormalizedPost, validateNormalizedTag } from './normalizer/index.js';
|
|
4
|
-
export { B as BundleCounts, E as EntityBundle, b as bundleCounts, c as collectEntities, e as emptyBundle } from './bundle-
|
|
5
|
-
export { ConflictReport, DryRunOptions, DryRunResult, FALLBACK_ASSET_BYTES, FilesystemMigrationSink, MIGRATION_WRITE_STAGES, MigrationRedirect, MigrationReport, MigrationRunMode, MigrationRunOptions, MigrationRunResult, MigrationSink, MigrationWriteStage, StorageEstimate, UploadAssetInput, UploadAssetResult, WriteFilesystemOptions, analyzeConflicts, buildMigrationReport, buildRedirectMap, bundleToCombinedJson, createFilesystemMigrationSink, detectRedirectLoops, emptyConflictReport, estimateStorage, hasBlockingConflicts, hasWarnings, portfolioMediaMatchesBundle, runDryRun, runMigration, runMigrationFromBundle, staleUrlsFromEstimate, writeFilesystemExport } from './sinks/index.js';
|
|
6
|
-
export { R as RewriteInlineImageRef, a as RewriteInlineImagesOptions, b as RewriteInlineImagesResult, S as StampMigrationMediaRefsOptions, U as UploadedAssetRef, r as rewriteInlineImages, s as stampMigrationMediaRefs } from './rewrite-inline-images-
|
|
4
|
+
export { B as BundleCounts, E as EntityBundle, b as bundleCounts, c as collectEntities, e as emptyBundle } from './bundle-Do-9ikQv.js';
|
|
5
|
+
export { AssetDiscoverySummary, ConflictReport, DryRunOptions, DryRunResult, FALLBACK_ASSET_BYTES, FilesystemMigrationSink, MIGRATION_WRITE_STAGES, MigrationRedirect, MigrationReport, MigrationRunMode, MigrationRunOptions, MigrationRunResult, MigrationSink, MigrationWriteStage, StorageEstimate, UploadAssetInput, UploadAssetResult, WriteFilesystemOptions, analyzeConflicts, buildMigrationReport, buildRedirectMap, bundleToCombinedJson, createFilesystemMigrationSink, detectRedirectLoops, emptyConflictReport, estimateStorage, hasBlockingConflicts, hasWarnings, portfolioMediaMatchesBundle, resolveAdapterImportSummary, runDryRun, runMigration, runMigrationFromBundle, staleUrlsFromEstimate, summarizeAssetDiscovery, writeFilesystemExport } from './sinks/index.js';
|
|
6
|
+
export { R as RewriteInlineImageRef, a as RewriteInlineImagesOptions, b as RewriteInlineImagesResult, S as StampMigrationMediaRefsOptions, U as UploadedAssetRef, r as rewriteInlineImages, s as stampMigrationMediaRefs } from './rewrite-inline-images-BsgSquzV.js';
|
|
7
7
|
export { ExpandMigrationMediaRefsResult, GrapesComponent, GrapesProjectSnapshot, GrapesStyleRule, HtmlToGrapesOptions, HtmlToTiptapOptions, LayoutKind, LayoutTypeMap, TiptapDoc, TiptapMark, TiptapNode, ValidateGrapesProjectSnapshotOptions, ValidateTiptapDocOptions, cssToStyles, expandMigrationMediaRefs, grapesComponentSchema, grapesProjectSnapshotSchema, grapesStyleRuleSchema, htmlToGrapes, htmlToTiptap, tiptapDocSchema, tiptapMarkSchema, tiptapNodeSchema, validateGrapesProjectSnapshot, validateTiptapDoc } from './transformers/index.js';
|
|
8
|
-
export { C as CanonicalInlineAssetUrl, M as MIGRATION_MEDIA_REF_SCHEME, O as OriginUrlRewriteConfig,
|
|
8
|
+
export { C as CanonicalInlineAssetUrl, a as ContentAssetDiscovery, M as MIGRATION_MEDIA_REF_SCHEME, O as OriginUrlRewriteConfig, b as OriginUrlRewriteRule, c as buildContentMediaUrlIndex, d as buildMigrationMediaUrlIndex, e as canonicalizeInlineAssetUrl, f as createMigrationMediaRefReplaceWith, g as createWpContentGatewayRewrite, h as discoverContentAssetUrls, i as discoverContentAssets, j as discoverFeaturedAssetCandidateUrls, k as discoverRawImgSrcs, l as extractInlineImageSrcs, m as formatMigrationMediaRef, n as isLikelyImageUrl, o as isMigrationMediaRef, p as normalizeAssetUrl, q as parseMigrationMediaRef, r as resolveFeaturedContentAssetUrl, s as resolveMigrationMediaSourceId, t as rewriteOriginUrlsInText } from './media-urls-u49RCyPn.js';
|
|
9
9
|
export { linkToPath, sanitizeSlug } from './lib/index.js';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
import 'node:stream';
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
squarespaceAdapter,
|
|
14
14
|
wixAdapter,
|
|
15
15
|
wordpressAdapter
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-YLVPZ4M3.js";
|
|
17
17
|
import {
|
|
18
18
|
normalizedAssetExifSchema,
|
|
19
19
|
normalizedAssetSchema,
|
|
@@ -51,12 +51,14 @@ import {
|
|
|
51
51
|
hasWarnings,
|
|
52
52
|
mapJsonPrettyWire,
|
|
53
53
|
portfolioMediaMatchesBundle,
|
|
54
|
+
resolveAdapterImportSummary,
|
|
54
55
|
runDryRun,
|
|
55
56
|
runMigration,
|
|
56
57
|
runMigrationFromBundle,
|
|
57
58
|
staleUrlsFromEstimate,
|
|
59
|
+
summarizeAssetDiscovery,
|
|
58
60
|
writeFilesystemExport
|
|
59
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-3A2PA4P3.js";
|
|
60
62
|
import {
|
|
61
63
|
buildPortfolioMediaLinks,
|
|
62
64
|
bundleCounts,
|
|
@@ -65,7 +67,7 @@ import {
|
|
|
65
67
|
entityKey,
|
|
66
68
|
isTerminalState,
|
|
67
69
|
shouldProcessEntity
|
|
68
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-LC7CGWDN.js";
|
|
69
71
|
import {
|
|
70
72
|
cssToStyles,
|
|
71
73
|
expandMigrationMediaRefs,
|
|
@@ -79,11 +81,11 @@ import {
|
|
|
79
81
|
tiptapNodeSchema,
|
|
80
82
|
validateGrapesProjectSnapshot,
|
|
81
83
|
validateTiptapDoc
|
|
82
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-S4SUJT2D.js";
|
|
83
85
|
import {
|
|
84
86
|
rewriteInlineImages,
|
|
85
87
|
stampMigrationMediaRefs
|
|
86
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-BONZ3U3I.js";
|
|
87
89
|
import "./chunk-EJTWYEAX.js";
|
|
88
90
|
import {
|
|
89
91
|
linkToPath,
|
|
@@ -97,6 +99,7 @@ import {
|
|
|
97
99
|
createMigrationMediaRefReplaceWith,
|
|
98
100
|
createWpContentGatewayRewrite,
|
|
99
101
|
discoverContentAssetUrls,
|
|
102
|
+
discoverContentAssets,
|
|
100
103
|
discoverFeaturedAssetCandidateUrls,
|
|
101
104
|
discoverRawImgSrcs,
|
|
102
105
|
extractInlineImageSrcs,
|
|
@@ -108,7 +111,7 @@ import {
|
|
|
108
111
|
resolveFeaturedContentAssetUrl,
|
|
109
112
|
resolveMigrationMediaSourceId,
|
|
110
113
|
rewriteOriginUrlsInText
|
|
111
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-S4GMDRGX.js";
|
|
112
115
|
export {
|
|
113
116
|
FALLBACK_ASSET_BYTES,
|
|
114
117
|
FilesystemMigrationSink,
|
|
@@ -139,6 +142,7 @@ export {
|
|
|
139
142
|
cssToStyles,
|
|
140
143
|
detectRedirectLoops,
|
|
141
144
|
discoverContentAssetUrls,
|
|
145
|
+
discoverContentAssets,
|
|
142
146
|
discoverFeaturedAssetCandidateUrls,
|
|
143
147
|
discoverRawImgSrcs,
|
|
144
148
|
emptyBundle,
|
|
@@ -173,6 +177,7 @@ export {
|
|
|
173
177
|
parseMigrationMediaRef,
|
|
174
178
|
portfolioMediaMatchesBundle,
|
|
175
179
|
readSmugMugCredentialsFromEnv,
|
|
180
|
+
resolveAdapterImportSummary,
|
|
176
181
|
resolveFeaturedContentAssetUrl,
|
|
177
182
|
resolveMigrationMediaSourceId,
|
|
178
183
|
rewriteInlineImages,
|
|
@@ -189,6 +194,7 @@ export {
|
|
|
189
194
|
squarespaceAdapter,
|
|
190
195
|
staleUrlsFromEstimate,
|
|
191
196
|
stampMigrationMediaRefs,
|
|
197
|
+
summarizeAssetDiscovery,
|
|
192
198
|
tiptapDocSchema,
|
|
193
199
|
tiptapMarkSchema,
|
|
194
200
|
tiptapNodeSchema,
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CanonicalInlineAssetUrl, M as MIGRATION_MEDIA_REF_SCHEME, O as OriginUrlRewriteConfig,
|
|
1
|
+
export { C as CanonicalInlineAssetUrl, a as ContentAssetDiscovery, M as MIGRATION_MEDIA_REF_SCHEME, O as OriginUrlRewriteConfig, b as OriginUrlRewriteRule, c as buildContentMediaUrlIndex, d as buildMigrationMediaUrlIndex, e as canonicalizeInlineAssetUrl, f as createMigrationMediaRefReplaceWith, g as createWpContentGatewayRewrite, h as discoverContentAssetUrls, i as discoverContentAssets, j as discoverFeaturedAssetCandidateUrls, k as discoverRawImgSrcs, l as extractInlineImageSrcs, m as formatMigrationMediaRef, n as isLikelyImageUrl, o as isMigrationMediaRef, p as normalizeAssetUrl, q as parseMigrationMediaRef, r as resolveFeaturedContentAssetUrl, s as resolveMigrationMediaSourceId, t as rewriteOriginUrlsInText } from '../media-urls-u49RCyPn.js';
|
|
2
2
|
|
|
3
3
|
/** Lowercase URL-safe slug from WordPress post_name or title. */
|
|
4
4
|
declare function sanitizeSlug(raw: string): string;
|
package/dist/lib/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
createMigrationMediaRefReplaceWith,
|
|
12
12
|
createWpContentGatewayRewrite,
|
|
13
13
|
discoverContentAssetUrls,
|
|
14
|
+
discoverContentAssets,
|
|
14
15
|
discoverFeaturedAssetCandidateUrls,
|
|
15
16
|
discoverRawImgSrcs,
|
|
16
17
|
extractInlineImageSrcs,
|
|
@@ -22,7 +23,7 @@ import {
|
|
|
22
23
|
resolveFeaturedContentAssetUrl,
|
|
23
24
|
resolveMigrationMediaSourceId,
|
|
24
25
|
rewriteOriginUrlsInText
|
|
25
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-S4GMDRGX.js";
|
|
26
27
|
export {
|
|
27
28
|
MIGRATION_MEDIA_REF_SCHEME,
|
|
28
29
|
buildContentMediaUrlIndex,
|
|
@@ -31,6 +32,7 @@ export {
|
|
|
31
32
|
createMigrationMediaRefReplaceWith,
|
|
32
33
|
createWpContentGatewayRewrite,
|
|
33
34
|
discoverContentAssetUrls,
|
|
35
|
+
discoverContentAssets,
|
|
34
36
|
discoverFeaturedAssetCandidateUrls,
|
|
35
37
|
discoverRawImgSrcs,
|
|
36
38
|
extractInlineImageSrcs,
|
|
@@ -10,6 +10,15 @@ interface OriginUrlRewriteConfig {
|
|
|
10
10
|
declare function rewriteOriginUrlsInText(text: string, config: OriginUrlRewriteConfig): string;
|
|
11
11
|
/** Build a rule that rewrites API-gateway `/prod/wp-content/` paths to a public origin. */
|
|
12
12
|
declare function createWpContentGatewayRewrite(gatewayBase: string, publicOrigin: string): OriginUrlRewriteConfig;
|
|
13
|
+
interface ContentAssetDiscovery {
|
|
14
|
+
/** Network-resolvable image paths (`<img>`, backgrounds, shortcode `image=` attrs, …). */
|
|
15
|
+
urls: string[];
|
|
16
|
+
/**
|
|
17
|
+
* WordPress attachment post ids referenced in content without an inline URL in this
|
|
18
|
+
* file context (`data-wp-attachment-id`, `[gallery ids=…]`, `[oshine_gallery ids=…]`, …).
|
|
19
|
+
*/
|
|
20
|
+
unresolvedAttachmentIds: string[];
|
|
21
|
+
}
|
|
13
22
|
/** All `<img src>` values (including those not ingested as vault assets). */
|
|
14
23
|
declare function discoverRawImgSrcs(content: string): string[];
|
|
15
24
|
/** Normalize protocol-relative and trim; skip data URIs. */
|
|
@@ -25,6 +34,11 @@ declare function isLikelyImageUrl(url: string): boolean;
|
|
|
25
34
|
declare function discoverFeaturedAssetCandidateUrls(content: string): string[];
|
|
26
35
|
/** Best featured-image URL from post/page HTML when attachment id is unavailable. */
|
|
27
36
|
declare function resolveFeaturedContentAssetUrl(content: string): string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Generic content-discovery pass: collect resolvable image URLs and attachment ids
|
|
39
|
+
* that still need an index / REST / crawl resolution step.
|
|
40
|
+
*/
|
|
41
|
+
declare function discoverContentAssets(content: string): ContentAssetDiscovery;
|
|
28
42
|
/**
|
|
29
43
|
* Generic content-discovery pass: collect image URLs from HTML `<img>` tags,
|
|
30
44
|
* section hero markers (`data-bg-image`), inline CSS backgrounds, and common
|
|
@@ -71,4 +85,4 @@ declare function buildContentMediaUrlIndex(entries: Iterable<{
|
|
|
71
85
|
sourceId: string;
|
|
72
86
|
}>, originUrlRewrite?: OriginUrlRewriteConfig): Map<string, string>;
|
|
73
87
|
|
|
74
|
-
export { type CanonicalInlineAssetUrl as C, MIGRATION_MEDIA_REF_SCHEME as M, type OriginUrlRewriteConfig as O, type
|
|
88
|
+
export { type CanonicalInlineAssetUrl as C, MIGRATION_MEDIA_REF_SCHEME as M, type OriginUrlRewriteConfig as O, type ContentAssetDiscovery as a, type OriginUrlRewriteRule as b, buildContentMediaUrlIndex as c, buildMigrationMediaUrlIndex as d, canonicalizeInlineAssetUrl as e, createMigrationMediaRefReplaceWith as f, createWpContentGatewayRewrite as g, discoverContentAssetUrls as h, discoverContentAssets as i, discoverFeaturedAssetCandidateUrls as j, discoverRawImgSrcs as k, extractInlineImageSrcs as l, formatMigrationMediaRef as m, isLikelyImageUrl as n, isMigrationMediaRef as o, normalizeAssetUrl as p, parseMigrationMediaRef as q, resolveFeaturedContentAssetUrl as r, resolveMigrationMediaSourceId as s, rewriteOriginUrlsInText as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as MigrationCursor, E as EntityKey, P as PortfolioMediaLink, l as ValidationResult } from '../types-
|
|
2
|
-
export { A as AdapterContext, h as EntityType, M as MigrationAdapter, g as MigrationPlatform, b as NormalizedAsset, j as NormalizedAssetExif, d as NormalizedCategory, f as NormalizedEntity, a as NormalizedPage, c as NormalizedPortfolio, N as NormalizedPost, e as NormalizedTag, k as PublishStatus, S as SourceMetadata, V as ValidationIssue, m as entityKey } from '../types-
|
|
3
|
-
import { E as EntityBundle } from '../bundle-
|
|
4
|
-
export { B as BundleCounts, b as bundleCounts, c as collectEntities, e as emptyBundle } from '../bundle-
|
|
1
|
+
import { i as MigrationCursor, E as EntityKey, P as PortfolioMediaLink, l as ValidationResult } from '../types-TCHy3Oko.js';
|
|
2
|
+
export { A as AdapterContext, h as EntityType, M as MigrationAdapter, g as MigrationPlatform, b as NormalizedAsset, j as NormalizedAssetExif, d as NormalizedCategory, f as NormalizedEntity, a as NormalizedPage, c as NormalizedPortfolio, N as NormalizedPost, e as NormalizedTag, k as PublishStatus, S as SourceMetadata, V as ValidationIssue, W as WxrImportSummary, m as entityKey } from '../types-TCHy3Oko.js';
|
|
3
|
+
import { E as EntityBundle } from '../bundle-Do-9ikQv.js';
|
|
4
|
+
export { B as BundleCounts, b as bundleCounts, c as collectEntities, e as emptyBundle } from '../bundle-Do-9ikQv.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
7
|
/** Portable entity state for resume / idempotency (not Directus field names). */
|
package/dist/normalizer/index.js
CHANGED
package/dist/sinks/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { d as NormalizedCategory, e as NormalizedTag, b as NormalizedAsset, c as NormalizedPortfolio, N as NormalizedPost, a as NormalizedPage, P as PortfolioMediaLink, E as EntityKey, f as NormalizedEntity, g as MigrationPlatform, M as MigrationAdapter } from '../types-
|
|
1
|
+
import { d as NormalizedCategory, e as NormalizedTag, b as NormalizedAsset, c as NormalizedPortfolio, N as NormalizedPost, a as NormalizedPage, P as PortfolioMediaLink, E as EntityKey, f as NormalizedEntity, g as MigrationPlatform, W as WxrImportSummary, M as MigrationAdapter } from '../types-TCHy3Oko.js';
|
|
2
2
|
import { Readable } from 'node:stream';
|
|
3
|
-
import { a as RewriteInlineImagesOptions } from '../rewrite-inline-images-
|
|
4
|
-
export { b as RewriteInlineImagesResult, r as rewriteInlineImages } from '../rewrite-inline-images-
|
|
5
|
-
import { E as EntityBundle } from '../bundle-
|
|
6
|
-
import '../media-urls-
|
|
3
|
+
import { a as RewriteInlineImagesOptions } from '../rewrite-inline-images-BsgSquzV.js';
|
|
4
|
+
export { b as RewriteInlineImagesResult, r as rewriteInlineImages } from '../rewrite-inline-images-BsgSquzV.js';
|
|
5
|
+
import { E as EntityBundle } from '../bundle-Do-9ikQv.js';
|
|
6
|
+
import '../media-urls-u49RCyPn.js';
|
|
7
7
|
|
|
8
8
|
interface CreatePostResult {
|
|
9
9
|
targetId: string;
|
|
@@ -116,6 +116,18 @@ interface RedirectLoopConflict {
|
|
|
116
116
|
toPath: string;
|
|
117
117
|
blocked: boolean;
|
|
118
118
|
}
|
|
119
|
+
interface AssetDiscoverySummary {
|
|
120
|
+
/** Unique resolvable image URLs found in post/page HTML. */
|
|
121
|
+
urlsDiscovered: number;
|
|
122
|
+
/** Unique WordPress attachment ids referenced in content (`data-wp-attachment-id`, gallery `ids=`). */
|
|
123
|
+
attachmentRefs: number;
|
|
124
|
+
/** Attachment ids that resolved to a `media.json` row in this job. */
|
|
125
|
+
attachmentRefsResolved: number;
|
|
126
|
+
/** Attachment ids still lacking a URL in this export context. */
|
|
127
|
+
attachmentRefsUnresolved: number;
|
|
128
|
+
/** Sorted unresolved ids (for scan UI / follow-up REST export). */
|
|
129
|
+
unresolvedAttachmentIds: string[];
|
|
130
|
+
}
|
|
119
131
|
interface ConflictReport {
|
|
120
132
|
duplicatePostSlugs: DuplicateSlugConflict[];
|
|
121
133
|
duplicatePageSlugs: DuplicateSlugConflict[];
|
|
@@ -125,11 +137,19 @@ interface ConflictReport {
|
|
|
125
137
|
unresolvedInlineImages: UnresolvedInlineImageConflict[];
|
|
126
138
|
unsupportedBlocks: UnsupportedBlockConflict[];
|
|
127
139
|
redirectLoops: RedirectLoopConflict[];
|
|
140
|
+
assetDiscovery: AssetDiscoverySummary;
|
|
141
|
+
/** OSS-19 — unsupported WXR `post_type` counts (commerce, builder globals, …). */
|
|
142
|
+
skippedPostTypes: Record<string, number>;
|
|
143
|
+
importableItemCount: number;
|
|
144
|
+
unsupportedOnly: boolean;
|
|
145
|
+
skippedWooCommerceStubPages?: number;
|
|
128
146
|
}
|
|
147
|
+
declare function summarizeAssetDiscovery(bundle: EntityBundle): AssetDiscoverySummary;
|
|
129
148
|
declare function emptyConflictReport(): ConflictReport;
|
|
130
149
|
declare function analyzeConflicts(bundle: EntityBundle, options?: {
|
|
131
150
|
staleAssetUrls?: StaleAssetUrlConflict[];
|
|
132
151
|
redirectLoops?: RedirectLoopConflict[];
|
|
152
|
+
wxrImportSummary?: WxrImportSummary;
|
|
133
153
|
}): ConflictReport;
|
|
134
154
|
declare function hasBlockingConflicts(report: ConflictReport): boolean;
|
|
135
155
|
declare function hasWarnings(report: ConflictReport): boolean;
|
|
@@ -158,6 +178,10 @@ interface MigrationReport {
|
|
|
158
178
|
categories: number;
|
|
159
179
|
tags: number;
|
|
160
180
|
storageBytesEstimated?: number;
|
|
181
|
+
assetDiscovery?: AssetDiscoverySummary;
|
|
182
|
+
importableItemCount?: number;
|
|
183
|
+
unsupportedOnly?: boolean;
|
|
184
|
+
skippedPostTypes?: Record<string, number>;
|
|
161
185
|
};
|
|
162
186
|
warnings: string[];
|
|
163
187
|
errors: string[];
|
|
@@ -233,6 +257,7 @@ interface DryRunResult {
|
|
|
233
257
|
report: MigrationReport;
|
|
234
258
|
exitCode: 0 | 1 | 2;
|
|
235
259
|
}
|
|
260
|
+
declare function resolveAdapterImportSummary(adapter: MigrationAdapter, input: unknown): Promise<WxrImportSummary | undefined>;
|
|
236
261
|
declare function runDryRun(options: DryRunOptions): Promise<DryRunResult>;
|
|
237
262
|
|
|
238
263
|
declare const FALLBACK_ASSET_BYTES: number;
|
|
@@ -260,4 +285,4 @@ declare function staleUrlsFromEstimate(estimate: StorageEstimate): {
|
|
|
260
285
|
reason: string;
|
|
261
286
|
}[];
|
|
262
287
|
|
|
263
|
-
export { type ConflictReport, type DryRunOptions, type DryRunResult, FALLBACK_ASSET_BYTES, FilesystemMigrationSink, MIGRATION_WRITE_STAGES, type MigrationRedirect, type MigrationReport, type MigrationRunMode, type MigrationRunOptions, type MigrationRunResult, type MigrationSink, type MigrationWriteStage, RewriteInlineImagesOptions, type StorageEstimate, type UploadAssetInput, type UploadAssetResult, type WriteFilesystemOptions, analyzeConflicts, buildMigrationReport, buildRedirectMap, bundleToCombinedJson, createFilesystemMigrationSink, detectRedirectLoops, emptyConflictReport, estimateStorage, hasBlockingConflicts, hasWarnings, portfolioMediaMatchesBundle, runDryRun, runMigration, runMigrationFromBundle, staleUrlsFromEstimate, writeFilesystemExport };
|
|
288
|
+
export { type AssetDiscoverySummary, type ConflictReport, type DryRunOptions, type DryRunResult, FALLBACK_ASSET_BYTES, FilesystemMigrationSink, MIGRATION_WRITE_STAGES, type MigrationRedirect, type MigrationReport, type MigrationRunMode, type MigrationRunOptions, type MigrationRunResult, type MigrationSink, type MigrationWriteStage, RewriteInlineImagesOptions, type StorageEstimate, type UploadAssetInput, type UploadAssetResult, type WriteFilesystemOptions, analyzeConflicts, buildMigrationReport, buildRedirectMap, bundleToCombinedJson, createFilesystemMigrationSink, detectRedirectLoops, emptyConflictReport, estimateStorage, hasBlockingConflicts, hasWarnings, portfolioMediaMatchesBundle, resolveAdapterImportSummary, runDryRun, runMigration, runMigrationFromBundle, staleUrlsFromEstimate, summarizeAssetDiscovery, writeFilesystemExport };
|
package/dist/sinks/index.js
CHANGED
|
@@ -13,18 +13,20 @@ import {
|
|
|
13
13
|
hasBlockingConflicts,
|
|
14
14
|
hasWarnings,
|
|
15
15
|
portfolioMediaMatchesBundle,
|
|
16
|
+
resolveAdapterImportSummary,
|
|
16
17
|
runDryRun,
|
|
17
18
|
runMigration,
|
|
18
19
|
runMigrationFromBundle,
|
|
19
20
|
staleUrlsFromEstimate,
|
|
21
|
+
summarizeAssetDiscovery,
|
|
20
22
|
writeFilesystemExport
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
+
} from "../chunk-3A2PA4P3.js";
|
|
24
|
+
import "../chunk-LC7CGWDN.js";
|
|
23
25
|
import {
|
|
24
26
|
rewriteInlineImages
|
|
25
|
-
} from "../chunk-
|
|
27
|
+
} from "../chunk-BONZ3U3I.js";
|
|
26
28
|
import "../chunk-XRCF73DA.js";
|
|
27
|
-
import "../chunk-
|
|
29
|
+
import "../chunk-S4GMDRGX.js";
|
|
28
30
|
export {
|
|
29
31
|
FALLBACK_ASSET_BYTES,
|
|
30
32
|
FilesystemMigrationSink,
|
|
@@ -40,11 +42,13 @@ export {
|
|
|
40
42
|
hasBlockingConflicts,
|
|
41
43
|
hasWarnings,
|
|
42
44
|
portfolioMediaMatchesBundle,
|
|
45
|
+
resolveAdapterImportSummary,
|
|
43
46
|
rewriteInlineImages,
|
|
44
47
|
runDryRun,
|
|
45
48
|
runMigration,
|
|
46
49
|
runMigrationFromBundle,
|
|
47
50
|
staleUrlsFromEstimate,
|
|
51
|
+
summarizeAssetDiscovery,
|
|
48
52
|
writeFilesystemExport
|
|
49
53
|
};
|
|
50
54
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { l as ValidationResult } from '../types-
|
|
3
|
-
export { R as RewriteInlineImageRef, a as RewriteInlineImagesOptions, b as RewriteInlineImagesResult, S as StampMigrationMediaRefsOptions, U as UploadedAssetRef, r as rewriteInlineImages, s as stampMigrationMediaRefs } from '../rewrite-inline-images-
|
|
4
|
-
export {
|
|
2
|
+
import { l as ValidationResult } from '../types-TCHy3Oko.js';
|
|
3
|
+
export { R as RewriteInlineImageRef, a as RewriteInlineImagesOptions, b as RewriteInlineImagesResult, S as StampMigrationMediaRefsOptions, U as UploadedAssetRef, r as rewriteInlineImages, s as stampMigrationMediaRefs } from '../rewrite-inline-images-BsgSquzV.js';
|
|
4
|
+
export { d as buildMigrationMediaUrlIndex } from '../media-urls-u49RCyPn.js';
|
|
5
5
|
|
|
6
6
|
type LayoutKind = "section" | "row" | "column";
|
|
7
7
|
/** Map OSS-2 `data-layout` markers to Grapes component types (host may override). */
|
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
tiptapNodeSchema,
|
|
12
12
|
validateGrapesProjectSnapshot,
|
|
13
13
|
validateTiptapDoc
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-S4SUJT2D.js";
|
|
15
15
|
import {
|
|
16
16
|
rewriteInlineImages,
|
|
17
17
|
stampMigrationMediaRefs
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-BONZ3U3I.js";
|
|
19
19
|
import {
|
|
20
20
|
buildMigrationMediaUrlIndex
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-S4GMDRGX.js";
|
|
22
22
|
export {
|
|
23
23
|
buildMigrationMediaUrlIndex,
|
|
24
24
|
cssToStyles,
|
|
@@ -7,6 +7,8 @@ interface SourceMetadata {
|
|
|
7
7
|
url?: string;
|
|
8
8
|
path?: string;
|
|
9
9
|
exportedAt?: string;
|
|
10
|
+
/** WordPress `post_type` when the DTO shape differs (e.g. portfolio CPT emitted as `page`). */
|
|
11
|
+
postType?: string;
|
|
10
12
|
}
|
|
11
13
|
/** Canonical post DTO — raw HTML; sanitize at host sink. */
|
|
12
14
|
interface NormalizedPost {
|
|
@@ -106,10 +108,22 @@ interface ValidationResult {
|
|
|
106
108
|
pages?: number;
|
|
107
109
|
assets?: number;
|
|
108
110
|
portfolios?: number;
|
|
111
|
+
/** WordPress `post_type=portfolio` (and configured CPT slugs) in raw WXR. */
|
|
112
|
+
portfolioCpt?: number;
|
|
109
113
|
categories?: number;
|
|
110
114
|
tags?: number;
|
|
115
|
+
/** WXR rows the parser would emit (OSS-19). */
|
|
116
|
+
importableItemCount?: number;
|
|
117
|
+
unsupportedOnly?: boolean;
|
|
118
|
+
skippedPostTypes?: Record<string, number>;
|
|
111
119
|
};
|
|
112
120
|
}
|
|
121
|
+
interface WxrImportSummary {
|
|
122
|
+
importableItemCount: number;
|
|
123
|
+
unsupportedOnly: boolean;
|
|
124
|
+
skippedPostTypes: Record<string, number>;
|
|
125
|
+
skippedWooCommerceStubPages?: number;
|
|
126
|
+
}
|
|
113
127
|
interface AdapterContext {
|
|
114
128
|
input: unknown;
|
|
115
129
|
cursor?: MigrationCursor;
|
|
@@ -118,6 +132,8 @@ interface MigrationAdapter {
|
|
|
118
132
|
platform: MigrationPlatform;
|
|
119
133
|
validateInput(input: unknown): ValidationResult | Promise<ValidationResult>;
|
|
120
134
|
enumerateEntities(ctx: AdapterContext): AsyncIterable<NormalizedEntity>;
|
|
135
|
+
/** Platform-specific import accounting (e.g. WordPress skipped `post_type`s). */
|
|
136
|
+
getImportSummary?(input: unknown): Promise<WxrImportSummary | undefined>;
|
|
121
137
|
}
|
|
122
138
|
interface MigrationCursor {
|
|
123
139
|
lastEntityKey?: EntityKey;
|
|
@@ -130,4 +146,4 @@ interface EntityKey {
|
|
|
130
146
|
}
|
|
131
147
|
declare function entityKey(entity: NormalizedEntity, platform: MigrationPlatform): EntityKey;
|
|
132
148
|
|
|
133
|
-
export { type AdapterContext as A, type EntityKey as E, type MigrationAdapter as M, type NormalizedPost as N, type PortfolioMediaLink as P, type SourceMetadata as S, type ValidationIssue as V, type NormalizedPage as a, type NormalizedAsset as b, type NormalizedPortfolio as c, type NormalizedCategory as d, type NormalizedTag as e, type NormalizedEntity as f, type MigrationPlatform as g, type EntityType as h, type MigrationCursor as i, type NormalizedAssetExif as j, type PublishStatus as k, type ValidationResult as l, entityKey as m };
|
|
149
|
+
export { type AdapterContext as A, type EntityKey as E, type MigrationAdapter as M, type NormalizedPost as N, type PortfolioMediaLink as P, type SourceMetadata as S, type ValidationIssue as V, type WxrImportSummary as W, type NormalizedPage as a, type NormalizedAsset as b, type NormalizedPortfolio as c, type NormalizedCategory as d, type NormalizedTag as e, type NormalizedEntity as f, type MigrationPlatform as g, type EntityType as h, type MigrationCursor as i, type NormalizedAssetExif as j, type PublishStatus as k, type ValidationResult as l, entityKey as m };
|
package/package.json
CHANGED