@artinstack/migrator 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,177 @@
1
+ import { z } from 'zod';
2
+ import { l as ValidationResult } from './types-DWOP8Dcy.js';
3
+ import './rewrite-inline-images-Bq16bJA5.js';
4
+
5
+ /**
6
+ * Map normalized upload URLs (and pathnames) → normalizer `sourceId`.
7
+ * Attachment ids are WXR `post_id` strings; inline discoveries use `url:{src}`.
8
+ */
9
+ declare function buildMigrationMediaUrlIndex(entries: Iterable<{
10
+ sourceUrl: string;
11
+ sourceId: string;
12
+ }>): Map<string, string>;
13
+ declare function resolveMigrationMediaSourceId(src: string, urlIndex: Map<string, string>): string | undefined;
14
+
15
+ type LayoutKind = "section" | "row" | "column";
16
+ /** Map OSS-2 `data-layout` markers to Grapes component types (host may override). */
17
+ interface LayoutTypeMap {
18
+ section?: string;
19
+ row?: string;
20
+ column?: string;
21
+ }
22
+ interface HtmlToGrapesOptions {
23
+ /** Map source class names to Grapes component types. */
24
+ componentMap?: Record<string, string>;
25
+ /** Map HTML tag names to Grapes component types (e.g. `h2` → `heading`). */
26
+ tagMap?: Record<string, string>;
27
+ /** Map `data-layout` section/row/column markers to Grapes component types. */
28
+ layoutTypeMap?: LayoutTypeMap;
29
+ }
30
+ interface GrapesStyleRule {
31
+ selectors: string[];
32
+ style: Record<string, string>;
33
+ }
34
+ interface GrapesComponent {
35
+ type: string;
36
+ tagName?: string;
37
+ attributes?: Record<string, string>;
38
+ classes?: string[];
39
+ components?: GrapesComponent[];
40
+ content?: string;
41
+ void?: boolean;
42
+ }
43
+ interface GrapesProjectSnapshot {
44
+ content: GrapesComponent[];
45
+ styles: GrapesStyleRule[];
46
+ contentHtml?: string;
47
+ contentCss?: string;
48
+ }
49
+
50
+ /** Cheerio HTML walk → Grapes `content` + root `styles`. */
51
+ declare function htmlToGrapes(html: string, options?: HtmlToGrapesOptions): GrapesProjectSnapshot;
52
+
53
+ /** ProseMirror / Tiptap mark (inline formatting). */
54
+ interface TiptapMark {
55
+ type: string;
56
+ attrs?: Record<string, string>;
57
+ }
58
+ /** ProseMirror / Tiptap node — text nodes use `text`; others use `content`. */
59
+ interface TiptapNode {
60
+ type: string;
61
+ attrs?: Record<string, unknown>;
62
+ content?: TiptapNode[];
63
+ marks?: TiptapMark[];
64
+ text?: string;
65
+ }
66
+ /** Root Tiptap document (`content_json` shape). */
67
+ interface TiptapDoc {
68
+ type: "doc";
69
+ content: TiptapNode[];
70
+ }
71
+ interface HtmlToTiptapOptions {
72
+ /**
73
+ * Unwrap OSS-2 `data-layout` scaffolding (section/row/column divs) into prose blocks.
74
+ * @default true
75
+ */
76
+ unwrapLayoutMarkers?: boolean;
77
+ }
78
+
79
+ /** Cheerio HTML walk → Tiptap / ProseMirror `doc` JSON for blog `content_json`. */
80
+ declare function htmlToTiptap(html: string, options?: HtmlToTiptapOptions): TiptapDoc;
81
+
82
+ /** Parse `<style>` blocks and class rules into Grapes root `styles[]`. */
83
+ declare function cssToStyles(css: string): GrapesStyleRule[];
84
+
85
+ declare const grapesStyleRuleSchema: z.ZodObject<{
86
+ selectors: z.ZodArray<z.ZodString, "many">;
87
+ style: z.ZodRecord<z.ZodString, z.ZodString>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ style: Record<string, string>;
90
+ selectors: string[];
91
+ }, {
92
+ style: Record<string, string>;
93
+ selectors: string[];
94
+ }>;
95
+ declare const grapesComponentSchema: z.ZodType<GrapesComponent>;
96
+ declare const grapesProjectSnapshotSchema: z.ZodObject<{
97
+ content: z.ZodArray<z.ZodType<GrapesComponent, z.ZodTypeDef, GrapesComponent>, "many">;
98
+ styles: z.ZodArray<z.ZodObject<{
99
+ selectors: z.ZodArray<z.ZodString, "many">;
100
+ style: z.ZodRecord<z.ZodString, z.ZodString>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ style: Record<string, string>;
103
+ selectors: string[];
104
+ }, {
105
+ style: Record<string, string>;
106
+ selectors: string[];
107
+ }>, "many">;
108
+ contentHtml: z.ZodOptional<z.ZodString>;
109
+ contentCss: z.ZodOptional<z.ZodString>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ content: GrapesComponent[];
112
+ styles: {
113
+ style: Record<string, string>;
114
+ selectors: string[];
115
+ }[];
116
+ contentHtml?: string | undefined;
117
+ contentCss?: string | undefined;
118
+ }, {
119
+ content: GrapesComponent[];
120
+ styles: {
121
+ style: Record<string, string>;
122
+ selectors: string[];
123
+ }[];
124
+ contentHtml?: string | undefined;
125
+ contentCss?: string | undefined;
126
+ }>;
127
+ interface ValidateGrapesProjectSnapshotOptions {
128
+ /** When set, every component `type` in the tree must be in this allowlist. */
129
+ allowedComponentTypes?: string[];
130
+ }
131
+ /**
132
+ * Opt-in structural check for a Grapes project snapshot (not a full Grapes editor project file).
133
+ * Does not validate host-specific component registries unless `allowedComponentTypes` is passed.
134
+ */
135
+ declare function validateGrapesProjectSnapshot(snapshot: unknown, options?: ValidateGrapesProjectSnapshotOptions): ValidationResult;
136
+
137
+ declare const tiptapMarkSchema: z.ZodObject<{
138
+ type: z.ZodString;
139
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
140
+ }, "strip", z.ZodTypeAny, {
141
+ type: string;
142
+ attrs?: Record<string, string> | undefined;
143
+ }, {
144
+ type: string;
145
+ attrs?: Record<string, string> | undefined;
146
+ }>;
147
+ declare const tiptapNodeSchema: z.ZodType<TiptapNode>;
148
+ declare const tiptapDocSchema: z.ZodObject<{
149
+ type: z.ZodLiteral<"doc">;
150
+ content: z.ZodArray<z.ZodType<TiptapNode, z.ZodTypeDef, TiptapNode>, "many">;
151
+ }, "strip", z.ZodTypeAny, {
152
+ type: "doc";
153
+ content: TiptapNode[];
154
+ }, {
155
+ type: "doc";
156
+ content: TiptapNode[];
157
+ }>;
158
+ interface ValidateTiptapDocOptions {
159
+ /** When set, every node `type` in the tree must be in this allowlist. */
160
+ allowedNodeTypes?: string[];
161
+ /** When set, every mark `type` must be in this allowlist. */
162
+ allowedMarkTypes?: string[];
163
+ }
164
+ /** Opt-in structural check for a Tiptap / ProseMirror document. */
165
+ declare function validateTiptapDoc(doc: unknown, options?: ValidateTiptapDocOptions): ValidationResult;
166
+
167
+ interface ExpandMigrationMediaRefsResult {
168
+ html: string;
169
+ unresolved: string[];
170
+ }
171
+ /**
172
+ * Expand OSS-14 `artinstack-migration://asset/…` refs to host CDN URLs.
173
+ * Lookup (`migration_entities` → `publicUrl`) is host-supplied via `resolvePublicUrl`.
174
+ */
175
+ declare function expandMigrationMediaRefs(html: string, resolvePublicUrl: (sourceId: string) => string | undefined): ExpandMigrationMediaRefsResult;
176
+
177
+ export { type ExpandMigrationMediaRefsResult as E, type GrapesComponent as G, type HtmlToGrapesOptions as H, type LayoutKind as L, type TiptapDoc as T, type ValidateGrapesProjectSnapshotOptions as V, type GrapesProjectSnapshot as a, type GrapesStyleRule as b, type HtmlToTiptapOptions as c, type LayoutTypeMap as d, type TiptapMark as e, type TiptapNode as f, type ValidateTiptapDocOptions as g, buildMigrationMediaUrlIndex as h, cssToStyles as i, expandMigrationMediaRefs as j, grapesComponentSchema as k, grapesProjectSnapshotSchema as l, grapesStyleRuleSchema as m, htmlToGrapes as n, htmlToTiptap as o, tiptapMarkSchema as p, tiptapNodeSchema as q, resolveMigrationMediaSourceId as r, validateTiptapDoc as s, tiptapDocSchema as t, validateGrapesProjectSnapshot as v };
package/dist/index.d.ts CHANGED
@@ -3,8 +3,8 @@ export { A as AdapterContext, E as EntityKey, h as EntityType, i as MigrationCur
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
4
  export { B as BundleCounts, E as EntityBundle, b as bundleCounts, c as collectEntities, e as emptyBundle } from './bundle-uAAHehbv.js';
5
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, U as UploadedAssetRef, r as rewriteInlineImages } from './rewrite-inline-images-DPoxyzVC.js';
7
- export { GrapesComponent, GrapesProjectSnapshot, GrapesStyleRule, HtmlToGrapesOptions, HtmlToTiptapOptions, LayoutKind, LayoutTypeMap, TiptapDoc, TiptapMark, TiptapNode, ValidateGrapesProjectSnapshotOptions, ValidateTiptapDocOptions, cssToStyles, grapesComponentSchema, grapesProjectSnapshotSchema, grapesStyleRuleSchema, htmlToGrapes, htmlToTiptap, tiptapDocSchema, tiptapMarkSchema, tiptapNodeSchema, validateGrapesProjectSnapshot, validateTiptapDoc } from './transformers/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-Bq16bJA5.js';
7
+ export { E as ExpandMigrationMediaRefsResult, G as GrapesComponent, a as GrapesProjectSnapshot, b as GrapesStyleRule, H as HtmlToGrapesOptions, c as HtmlToTiptapOptions, L as LayoutKind, d as LayoutTypeMap, T as TiptapDoc, e as TiptapMark, f as TiptapNode, V as ValidateGrapesProjectSnapshotOptions, g as ValidateTiptapDocOptions, h as buildMigrationMediaUrlIndex, i as cssToStyles, j as expandMigrationMediaRefs, k as grapesComponentSchema, l as grapesProjectSnapshotSchema, m as grapesStyleRuleSchema, n as htmlToGrapes, o as htmlToTiptap, r as resolveMigrationMediaSourceId, t as tiptapDocSchema, p as tiptapMarkSchema, q as tiptapNodeSchema, v as validateGrapesProjectSnapshot, s as validateTiptapDoc } from './index-Dp6nqBqe.js';
8
8
  export { discoverContentAssetUrls, discoverFeaturedAssetCandidateUrls, discoverRawImgSrcs, extractInlineImageSrcs, isLikelyImageUrl, normalizeAssetUrl, resolveFeaturedContentAssetUrl } from './lib/index.js';
9
9
  import { z } from 'zod';
10
10
  import 'node:stream';
@@ -521,4 +521,16 @@ declare const wixAdapter: MigrationAdapter;
521
521
 
522
522
  declare function getAdapter(platform: MigrationPlatform): MigrationAdapter;
523
523
 
524
- export { MigrationAdapter, MigrationPlatform, type OriginUrlRewriteConfig, type OriginUrlRewriteRule, SMUGMUG_API_BASE, SMUGMUG_OAUTH_ENDPOINTS, SQUARESPACE_JSON_FORMAT, SmugMugApiClient, type SmugMugClientOptions, type SmugMugCredentials, type SquarespaceClientOptions, type SquarespaceCollectTarget, SquarespaceCollectionClient, WixCollectionClient, WixPageSnapshotCollector, buildJsonPrettyUrl, buildSmugMugAuthorizationHeader, createWpContentGatewayRewrite, getAdapter, mapJsonPrettyWire, readSmugMugCredentialsFromEnv, rewriteOriginUrlsInText, signSmugMugOAuthRequest, smugMugCredentialsSchema, smugmugAdapter, squarespaceAdapter, wixAdapter, wordpressAdapter };
524
+ /** Pseudo-URL scheme for portable migration asset pointers (not WordPress shortcodes). */
525
+ declare const MIGRATION_MEDIA_REF_SCHEME = "artinstack-migration://asset/";
526
+ /** Build `artinstack-migration://asset/{sourceId}` (percent-encodes the normalizer source id). */
527
+ declare function formatMigrationMediaRef(sourceAssetId: string): string;
528
+ declare function isMigrationMediaRef(value: string): boolean;
529
+ /** Parse a migration media ref back to the normalizer `sourceId`, or `undefined` if not a ref. */
530
+ declare function parseMigrationMediaRef(value: string): string | undefined;
531
+ /** Default `replaceWith` for `rewriteInlineImages` / `stampMigrationMediaRefs` (OSS-14). */
532
+ declare function createMigrationMediaRefReplaceWith(): (ref: {
533
+ sourceAssetId?: string;
534
+ }) => string;
535
+
536
+ export { MIGRATION_MEDIA_REF_SCHEME, MigrationAdapter, MigrationPlatform, type OriginUrlRewriteConfig, type OriginUrlRewriteRule, SMUGMUG_API_BASE, SMUGMUG_OAUTH_ENDPOINTS, SQUARESPACE_JSON_FORMAT, SmugMugApiClient, type SmugMugClientOptions, type SmugMugCredentials, type SquarespaceClientOptions, type SquarespaceCollectTarget, SquarespaceCollectionClient, WixCollectionClient, WixPageSnapshotCollector, buildJsonPrettyUrl, buildSmugMugAuthorizationHeader, createMigrationMediaRefReplaceWith, createWpContentGatewayRewrite, formatMigrationMediaRef, getAdapter, isMigrationMediaRef, mapJsonPrettyWire, parseMigrationMediaRef, readSmugMugCredentialsFromEnv, rewriteOriginUrlsInText, signSmugMugOAuthRequest, smugMugCredentialsSchema, smugmugAdapter, squarespaceAdapter, wixAdapter, wordpressAdapter };
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  squarespaceAdapter,
16
16
  wixAdapter,
17
17
  wordpressAdapter
18
- } from "./chunk-XQVKA54A.js";
18
+ } from "./chunk-KF7G7DM6.js";
19
19
  import {
20
20
  normalizedAssetExifSchema,
21
21
  normalizedAssetSchema,
@@ -58,7 +58,7 @@ import {
58
58
  runMigrationFromBundle,
59
59
  staleUrlsFromEstimate,
60
60
  writeFilesystemExport
61
- } from "./chunk-IPYHS5R2.js";
61
+ } from "./chunk-MDSY3FEZ.js";
62
62
  import {
63
63
  buildPortfolioMediaLinks,
64
64
  bundleCounts,
@@ -70,6 +70,7 @@ import {
70
70
  } from "./chunk-HI7JHWZU.js";
71
71
  import {
72
72
  cssToStyles,
73
+ expandMigrationMediaRefs,
73
74
  grapesComponentSchema,
74
75
  grapesProjectSnapshotSchema,
75
76
  grapesStyleRuleSchema,
@@ -80,10 +81,18 @@ import {
80
81
  tiptapNodeSchema,
81
82
  validateGrapesProjectSnapshot,
82
83
  validateTiptapDoc
83
- } from "./chunk-CIOYDRY5.js";
84
+ } from "./chunk-S4XYG4SM.js";
84
85
  import {
85
- rewriteInlineImages
86
- } from "./chunk-EXYXTAZM.js";
86
+ MIGRATION_MEDIA_REF_SCHEME,
87
+ buildMigrationMediaUrlIndex,
88
+ createMigrationMediaRefReplaceWith,
89
+ formatMigrationMediaRef,
90
+ isMigrationMediaRef,
91
+ parseMigrationMediaRef,
92
+ resolveMigrationMediaSourceId,
93
+ rewriteInlineImages,
94
+ stampMigrationMediaRefs
95
+ } from "./chunk-BOYB6XRA.js";
87
96
  import {
88
97
  discoverContentAssetUrls,
89
98
  discoverFeaturedAssetCandidateUrls,
@@ -96,6 +105,7 @@ import {
96
105
  export {
97
106
  FALLBACK_ASSET_BYTES,
98
107
  FilesystemMigrationSink,
108
+ MIGRATION_MEDIA_REF_SCHEME,
99
109
  MIGRATION_WRITE_STAGES,
100
110
  SMUGMUG_API_BASE,
101
111
  SMUGMUG_OAUTH_ENDPOINTS,
@@ -106,6 +116,7 @@ export {
106
116
  WixPageSnapshotCollector,
107
117
  analyzeConflicts,
108
118
  buildJsonPrettyUrl,
119
+ buildMigrationMediaUrlIndex,
109
120
  buildMigrationReport,
110
121
  buildPortfolioMediaLinks,
111
122
  buildRedirectMap,
@@ -114,6 +125,7 @@ export {
114
125
  bundleToCombinedJson,
115
126
  collectEntities,
116
127
  createFilesystemMigrationSink,
128
+ createMigrationMediaRefReplaceWith,
117
129
  createWpContentGatewayRewrite,
118
130
  cssToStyles,
119
131
  detectRedirectLoops,
@@ -124,7 +136,9 @@ export {
124
136
  emptyConflictReport,
125
137
  entityKey,
126
138
  estimateStorage,
139
+ expandMigrationMediaRefs,
127
140
  extractInlineImageSrcs,
141
+ formatMigrationMediaRef,
128
142
  getAdapter,
129
143
  grapesComponentSchema,
130
144
  grapesProjectSnapshotSchema,
@@ -134,6 +148,7 @@ export {
134
148
  htmlToGrapes,
135
149
  htmlToTiptap,
136
150
  isLikelyImageUrl,
151
+ isMigrationMediaRef,
137
152
  isTerminalState,
138
153
  mapJsonPrettyWire,
139
154
  normalizeAssetUrl,
@@ -145,9 +160,11 @@ export {
145
160
  normalizedPortfolioSchema,
146
161
  normalizedPostSchema,
147
162
  normalizedTagSchema,
163
+ parseMigrationMediaRef,
148
164
  portfolioMediaMatchesBundle,
149
165
  readSmugMugCredentialsFromEnv,
150
166
  resolveFeaturedContentAssetUrl,
167
+ resolveMigrationMediaSourceId,
151
168
  rewriteInlineImages,
152
169
  rewriteOriginUrlsInText,
153
170
  runDryRun,
@@ -160,6 +177,7 @@ export {
160
177
  sourceMetadataSchema,
161
178
  squarespaceAdapter,
162
179
  staleUrlsFromEstimate,
180
+ stampMigrationMediaRefs,
163
181
  tiptapDocSchema,
164
182
  tiptapMarkSchema,
165
183
  tiptapNodeSchema,
@@ -0,0 +1,41 @@
1
+ interface RewriteInlineImageRef {
2
+ originalSrc: string;
3
+ sourceAssetId?: string;
4
+ }
5
+ interface UploadedAssetRef {
6
+ targetId: string;
7
+ publicUrl?: string;
8
+ }
9
+ interface RewriteInlineImagesOptions {
10
+ resolveAsset: (src: string) => RewriteInlineImageRef | undefined;
11
+ /**
12
+ * Replace a resolved source id with a migration ref or CDN URL.
13
+ * When omitted, defaults to OSS-14 `artinstack-migration://asset/…` refs.
14
+ */
15
+ replaceWith?: (ref: RewriteInlineImageRef, uploaded?: UploadedAssetRef) => string;
16
+ /**
17
+ * When true, skip URLs that cannot be matched to an uploaded vault target.
18
+ * Default: false when using migration refs; true when a custom `replaceWith` is supplied.
19
+ */
20
+ requireUploaded?: boolean;
21
+ }
22
+ interface RewriteInlineImagesResult {
23
+ html: string;
24
+ referencedSources: string[];
25
+ unresolved: string[];
26
+ }
27
+ /** Rewrite `<img src>` / `srcset`, `data-bg-image`, and inline CSS backgrounds using uploaded asset targets. */
28
+ declare function rewriteInlineImages(html: string, options: RewriteInlineImagesOptions, uploadedBySourceId: Map<string, UploadedAssetRef>): RewriteInlineImagesResult;
29
+ interface StampMigrationMediaRefsOptions {
30
+ /** Pre-built url/pathname → sourceId map (from attachments + inline assets). */
31
+ urlToSourceId: Map<string, string>;
32
+ replaceWith?: RewriteInlineImagesOptions["replaceWith"];
33
+ requireUploaded?: boolean;
34
+ }
35
+ /**
36
+ * OSS-14 — replace resolved `wp-content/uploads` URLs with `artinstack-migration://asset/…`
37
+ * refs. Does not invent refs for unknown URLs (left unchanged + listed in `unresolved`).
38
+ */
39
+ declare function stampMigrationMediaRefs(html: string, options: StampMigrationMediaRefsOptions): RewriteInlineImagesResult;
40
+
41
+ export { type RewriteInlineImageRef as R, type StampMigrationMediaRefsOptions as S, type UploadedAssetRef as U, type RewriteInlineImagesOptions as a, type RewriteInlineImagesResult as b, rewriteInlineImages as r, stampMigrationMediaRefs as s };
@@ -1,7 +1,7 @@
1
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-DWOP8Dcy.js';
2
2
  import { Readable } from 'node:stream';
3
- import { a as RewriteInlineImagesOptions } from '../rewrite-inline-images-DPoxyzVC.js';
4
- export { b as RewriteInlineImagesResult, r as rewriteInlineImages } from '../rewrite-inline-images-DPoxyzVC.js';
3
+ import { a as RewriteInlineImagesOptions } from '../rewrite-inline-images-Bq16bJA5.js';
4
+ export { b as RewriteInlineImagesResult, r as rewriteInlineImages } from '../rewrite-inline-images-Bq16bJA5.js';
5
5
  import { E as EntityBundle } from '../bundle-uAAHehbv.js';
6
6
 
7
7
  interface CreatePostResult {
@@ -18,11 +18,11 @@ import {
18
18
  runMigrationFromBundle,
19
19
  staleUrlsFromEstimate,
20
20
  writeFilesystemExport
21
- } from "../chunk-IPYHS5R2.js";
21
+ } from "../chunk-MDSY3FEZ.js";
22
22
  import "../chunk-HI7JHWZU.js";
23
23
  import {
24
24
  rewriteInlineImages
25
- } from "../chunk-EXYXTAZM.js";
25
+ } from "../chunk-BOYB6XRA.js";
26
26
  import "../chunk-XYP3VYDH.js";
27
27
  export {
28
28
  FALLBACK_ASSET_BYTES,
@@ -1,157 +1,4 @@
1
- import { z } from 'zod';
2
- import { l as ValidationResult } from '../types-DWOP8Dcy.js';
3
- export { R as RewriteInlineImageRef, a as RewriteInlineImagesOptions, b as RewriteInlineImagesResult, U as UploadedAssetRef, r as rewriteInlineImages } from '../rewrite-inline-images-DPoxyzVC.js';
4
-
5
- type LayoutKind = "section" | "row" | "column";
6
- /** Map OSS-2 `data-layout` markers to Grapes component types (host may override). */
7
- interface LayoutTypeMap {
8
- section?: string;
9
- row?: string;
10
- column?: string;
11
- }
12
- interface HtmlToGrapesOptions {
13
- /** Map source class names to Grapes component types. */
14
- componentMap?: Record<string, string>;
15
- /** Map HTML tag names to Grapes component types (e.g. `h2` → `heading`). */
16
- tagMap?: Record<string, string>;
17
- /** Map `data-layout` section/row/column markers to Grapes component types. */
18
- layoutTypeMap?: LayoutTypeMap;
19
- }
20
- interface GrapesStyleRule {
21
- selectors: string[];
22
- style: Record<string, string>;
23
- }
24
- interface GrapesComponent {
25
- type: string;
26
- tagName?: string;
27
- attributes?: Record<string, string>;
28
- classes?: string[];
29
- components?: GrapesComponent[];
30
- content?: string;
31
- void?: boolean;
32
- }
33
- interface GrapesProjectSnapshot {
34
- content: GrapesComponent[];
35
- styles: GrapesStyleRule[];
36
- contentHtml?: string;
37
- contentCss?: string;
38
- }
39
-
40
- /** Cheerio HTML walk → Grapes `content` + root `styles`. */
41
- declare function htmlToGrapes(html: string, options?: HtmlToGrapesOptions): GrapesProjectSnapshot;
42
-
43
- /** ProseMirror / Tiptap mark (inline formatting). */
44
- interface TiptapMark {
45
- type: string;
46
- attrs?: Record<string, string>;
47
- }
48
- /** ProseMirror / Tiptap node — text nodes use `text`; others use `content`. */
49
- interface TiptapNode {
50
- type: string;
51
- attrs?: Record<string, unknown>;
52
- content?: TiptapNode[];
53
- marks?: TiptapMark[];
54
- text?: string;
55
- }
56
- /** Root Tiptap document (`content_json` shape). */
57
- interface TiptapDoc {
58
- type: "doc";
59
- content: TiptapNode[];
60
- }
61
- interface HtmlToTiptapOptions {
62
- /**
63
- * Unwrap OSS-2 `data-layout` scaffolding (section/row/column divs) into prose blocks.
64
- * @default true
65
- */
66
- unwrapLayoutMarkers?: boolean;
67
- }
68
-
69
- /** Cheerio HTML walk → Tiptap / ProseMirror `doc` JSON for blog `content_json`. */
70
- declare function htmlToTiptap(html: string, options?: HtmlToTiptapOptions): TiptapDoc;
71
-
72
- /** Parse `<style>` blocks and class rules into Grapes root `styles[]`. */
73
- declare function cssToStyles(css: string): GrapesStyleRule[];
74
-
75
- declare const grapesStyleRuleSchema: z.ZodObject<{
76
- selectors: z.ZodArray<z.ZodString, "many">;
77
- style: z.ZodRecord<z.ZodString, z.ZodString>;
78
- }, "strip", z.ZodTypeAny, {
79
- style: Record<string, string>;
80
- selectors: string[];
81
- }, {
82
- style: Record<string, string>;
83
- selectors: string[];
84
- }>;
85
- declare const grapesComponentSchema: z.ZodType<GrapesComponent>;
86
- declare const grapesProjectSnapshotSchema: z.ZodObject<{
87
- content: z.ZodArray<z.ZodType<GrapesComponent, z.ZodTypeDef, GrapesComponent>, "many">;
88
- styles: z.ZodArray<z.ZodObject<{
89
- selectors: z.ZodArray<z.ZodString, "many">;
90
- style: z.ZodRecord<z.ZodString, z.ZodString>;
91
- }, "strip", z.ZodTypeAny, {
92
- style: Record<string, string>;
93
- selectors: string[];
94
- }, {
95
- style: Record<string, string>;
96
- selectors: string[];
97
- }>, "many">;
98
- contentHtml: z.ZodOptional<z.ZodString>;
99
- contentCss: z.ZodOptional<z.ZodString>;
100
- }, "strip", z.ZodTypeAny, {
101
- content: GrapesComponent[];
102
- styles: {
103
- style: Record<string, string>;
104
- selectors: string[];
105
- }[];
106
- contentHtml?: string | undefined;
107
- contentCss?: string | undefined;
108
- }, {
109
- content: GrapesComponent[];
110
- styles: {
111
- style: Record<string, string>;
112
- selectors: string[];
113
- }[];
114
- contentHtml?: string | undefined;
115
- contentCss?: string | undefined;
116
- }>;
117
- interface ValidateGrapesProjectSnapshotOptions {
118
- /** When set, every component `type` in the tree must be in this allowlist. */
119
- allowedComponentTypes?: string[];
120
- }
121
- /**
122
- * Opt-in structural check for a Grapes project snapshot (not a full Grapes editor project file).
123
- * Does not validate host-specific component registries unless `allowedComponentTypes` is passed.
124
- */
125
- declare function validateGrapesProjectSnapshot(snapshot: unknown, options?: ValidateGrapesProjectSnapshotOptions): ValidationResult;
126
-
127
- declare const tiptapMarkSchema: z.ZodObject<{
128
- type: z.ZodString;
129
- attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
130
- }, "strip", z.ZodTypeAny, {
131
- type: string;
132
- attrs?: Record<string, string> | undefined;
133
- }, {
134
- type: string;
135
- attrs?: Record<string, string> | undefined;
136
- }>;
137
- declare const tiptapNodeSchema: z.ZodType<TiptapNode>;
138
- declare const tiptapDocSchema: z.ZodObject<{
139
- type: z.ZodLiteral<"doc">;
140
- content: z.ZodArray<z.ZodType<TiptapNode, z.ZodTypeDef, TiptapNode>, "many">;
141
- }, "strip", z.ZodTypeAny, {
142
- type: "doc";
143
- content: TiptapNode[];
144
- }, {
145
- type: "doc";
146
- content: TiptapNode[];
147
- }>;
148
- interface ValidateTiptapDocOptions {
149
- /** When set, every node `type` in the tree must be in this allowlist. */
150
- allowedNodeTypes?: string[];
151
- /** When set, every mark `type` must be in this allowlist. */
152
- allowedMarkTypes?: string[];
153
- }
154
- /** Opt-in structural check for a Tiptap / ProseMirror document. */
155
- declare function validateTiptapDoc(doc: unknown, options?: ValidateTiptapDocOptions): ValidationResult;
156
-
157
- export { type GrapesComponent, type GrapesProjectSnapshot, type GrapesStyleRule, type HtmlToGrapesOptions, type HtmlToTiptapOptions, type LayoutKind, type LayoutTypeMap, type TiptapDoc, type TiptapMark, type TiptapNode, type ValidateGrapesProjectSnapshotOptions, type ValidateTiptapDocOptions, cssToStyles, grapesComponentSchema, grapesProjectSnapshotSchema, grapesStyleRuleSchema, htmlToGrapes, htmlToTiptap, tiptapDocSchema, tiptapMarkSchema, tiptapNodeSchema, validateGrapesProjectSnapshot, validateTiptapDoc };
1
+ export { E as ExpandMigrationMediaRefsResult, G as GrapesComponent, a as GrapesProjectSnapshot, b as GrapesStyleRule, H as HtmlToGrapesOptions, c as HtmlToTiptapOptions, L as LayoutKind, d as LayoutTypeMap, T as TiptapDoc, e as TiptapMark, f as TiptapNode, V as ValidateGrapesProjectSnapshotOptions, g as ValidateTiptapDocOptions, h as buildMigrationMediaUrlIndex, i as cssToStyles, j as expandMigrationMediaRefs, k as grapesComponentSchema, l as grapesProjectSnapshotSchema, m as grapesStyleRuleSchema, n as htmlToGrapes, o as htmlToTiptap, t as tiptapDocSchema, p as tiptapMarkSchema, q as tiptapNodeSchema, v as validateGrapesProjectSnapshot, s as validateTiptapDoc } from '../index-Dp6nqBqe.js';
2
+ 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-Bq16bJA5.js';
3
+ import 'zod';
4
+ import '../types-DWOP8Dcy.js';
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  cssToStyles,
3
+ expandMigrationMediaRefs,
3
4
  grapesComponentSchema,
4
5
  grapesProjectSnapshotSchema,
5
6
  grapesStyleRuleSchema,
@@ -10,19 +11,24 @@ import {
10
11
  tiptapNodeSchema,
11
12
  validateGrapesProjectSnapshot,
12
13
  validateTiptapDoc
13
- } from "../chunk-CIOYDRY5.js";
14
+ } from "../chunk-S4XYG4SM.js";
14
15
  import {
15
- rewriteInlineImages
16
- } from "../chunk-EXYXTAZM.js";
16
+ buildMigrationMediaUrlIndex,
17
+ rewriteInlineImages,
18
+ stampMigrationMediaRefs
19
+ } from "../chunk-BOYB6XRA.js";
17
20
  import "../chunk-XYP3VYDH.js";
18
21
  export {
22
+ buildMigrationMediaUrlIndex,
19
23
  cssToStyles,
24
+ expandMigrationMediaRefs,
20
25
  grapesComponentSchema,
21
26
  grapesProjectSnapshotSchema,
22
27
  grapesStyleRuleSchema,
23
28
  htmlToGrapes,
24
29
  htmlToTiptap,
25
30
  rewriteInlineImages,
31
+ stampMigrationMediaRefs,
26
32
  tiptapDocSchema,
27
33
  tiptapMarkSchema,
28
34
  tiptapNodeSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artinstack/migrator",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Stateless content normalizer and migration framework — WordPress, SmugMug, Squarespace → platform-agnostic schema",
5
5
  "license": "MIT",
6
6
  "author": "ArtInStack",