@tinacms/mdx 0.0.0-a1ff961-20250623024558 → 0.0.0-a30bc52-20251201062201

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.
@@ -4,7 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
7
  var __commonJS = (cb, mod) => function __require() {
9
8
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
9
  };
@@ -28,7 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
27
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
28
  mod
30
29
  ));
31
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
32
30
 
33
31
  // ../../../node_modules/.pnpm/is-buffer@2.0.5/node_modules/is-buffer/index.js
34
32
  var require_is_buffer = __commonJS({
@@ -6360,82 +6358,6 @@ var require_acorn_jsx = __commonJS({
6360
6358
  }
6361
6359
  });
6362
6360
 
6363
- // ../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js
6364
- var require_lodash = __commonJS({
6365
- "../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js"(exports, module) {
6366
- var MAX_SAFE_INTEGER = 9007199254740991;
6367
- var argsTag = "[object Arguments]";
6368
- var funcTag = "[object Function]";
6369
- var genTag = "[object GeneratorFunction]";
6370
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
6371
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
6372
- var root2 = freeGlobal || freeSelf || Function("return this")();
6373
- function arrayPush(array, values2) {
6374
- var index2 = -1, length = values2.length, offset3 = array.length;
6375
- while (++index2 < length) {
6376
- array[offset3 + index2] = values2[index2];
6377
- }
6378
- return array;
6379
- }
6380
- var objectProto = Object.prototype;
6381
- var hasOwnProperty4 = objectProto.hasOwnProperty;
6382
- var objectToString = objectProto.toString;
6383
- var Symbol2 = root2.Symbol;
6384
- var propertyIsEnumerable = objectProto.propertyIsEnumerable;
6385
- var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
6386
- function baseFlatten(array, depth, predicate, isStrict, result) {
6387
- var index2 = -1, length = array.length;
6388
- predicate || (predicate = isFlattenable);
6389
- result || (result = []);
6390
- while (++index2 < length) {
6391
- var value = array[index2];
6392
- if (depth > 0 && predicate(value)) {
6393
- if (depth > 1) {
6394
- baseFlatten(value, depth - 1, predicate, isStrict, result);
6395
- } else {
6396
- arrayPush(result, value);
6397
- }
6398
- } else if (!isStrict) {
6399
- result[result.length] = value;
6400
- }
6401
- }
6402
- return result;
6403
- }
6404
- function isFlattenable(value) {
6405
- return isArray3(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
6406
- }
6407
- function flatten2(array) {
6408
- var length = array ? array.length : 0;
6409
- return length ? baseFlatten(array, 1) : [];
6410
- }
6411
- function isArguments(value) {
6412
- return isArrayLikeObject(value) && hasOwnProperty4.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
6413
- }
6414
- var isArray3 = Array.isArray;
6415
- function isArrayLike(value) {
6416
- return value != null && isLength(value.length) && !isFunction(value);
6417
- }
6418
- function isArrayLikeObject(value) {
6419
- return isObjectLike(value) && isArrayLike(value);
6420
- }
6421
- function isFunction(value) {
6422
- var tag = isObject2(value) ? objectToString.call(value) : "";
6423
- return tag == funcTag || tag == genTag;
6424
- }
6425
- function isLength(value) {
6426
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
6427
- }
6428
- function isObject2(value) {
6429
- var type = typeof value;
6430
- return !!value && (type == "object" || type == "function");
6431
- }
6432
- function isObjectLike(value) {
6433
- return !!value && typeof value == "object";
6434
- }
6435
- module.exports = flatten2;
6436
- }
6437
- });
6438
-
6439
6361
  // ../../../node_modules/.pnpm/mdast-util-to-string@3.2.0/node_modules/mdast-util-to-string/lib/index.js
6440
6362
  var emptyOptions = {};
6441
6363
  function toString(value, options) {
@@ -40828,7 +40750,7 @@ var Ty = Rg();
40828
40750
  var stringifyPropsInline = (element2, field, imageCallback) => {
40829
40751
  return stringifyProps(element2, field, true, imageCallback);
40830
40752
  };
40831
- function stringifyProps(element2, parentField, flatten2, imageCallback) {
40753
+ function stringifyProps(element2, parentField, flatten, imageCallback) {
40832
40754
  const attributes2 = [];
40833
40755
  const children = [];
40834
40756
  let template;
@@ -40969,7 +40891,7 @@ function stringifyProps(element2, parentField, flatten2, imageCallback) {
40969
40891
  name: name2,
40970
40892
  value: {
40971
40893
  type: "mdxJsxAttributeValueExpression",
40972
- value: stringifyObj(result, flatten2)
40894
+ value: stringifyObj(result, flatten)
40973
40895
  }
40974
40896
  });
40975
40897
  break;
@@ -40982,7 +40904,7 @@ function stringifyProps(element2, parentField, flatten2, imageCallback) {
40982
40904
  if (field.list) {
40983
40905
  throw new Error(`Rich-text list is not supported`);
40984
40906
  } else {
40985
- const joiner = flatten2 ? " " : "\n";
40907
+ const joiner = flatten ? " " : "\n";
40986
40908
  let val = "";
40987
40909
  if (isPlainObject2(value) && Object.keys(value).length === 0) {
40988
40910
  return;
@@ -41004,7 +40926,7 @@ function stringifyProps(element2, parentField, flatten2, imageCallback) {
41004
40926
  val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
41005
40927
  }
41006
40928
  }
41007
- if (flatten2) {
40929
+ if (flatten) {
41008
40930
  attributes2.push({
41009
40931
  type: "mdxJsxAttribute",
41010
40932
  name: name2,
@@ -41051,7 +40973,7 @@ ${val}
41051
40973
  }
41052
40974
  return { attributes: attributes2, children, useDirective, directiveType };
41053
40975
  }
41054
- function stringifyObj(obj, flatten2) {
40976
+ function stringifyObj(obj, flatten) {
41055
40977
  if (typeof obj === "object" && obj !== null) {
41056
40978
  const dummyFunc = `const dummyFunc = `;
41057
40979
  const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
@@ -41060,7 +40982,7 @@ function stringifyObj(obj, flatten2) {
41060
40982
  semi: false,
41061
40983
  plugins: [mc]
41062
40984
  }).trim().replace(dummyFunc, "");
41063
- return flatten2 ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
40985
+ return flatten ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
41064
40986
  } else {
41065
40987
  throw new Error(
41066
40988
  `stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
@@ -41244,12 +41166,17 @@ var eat2 = (c, field, imageCallback) => {
41244
41166
  const marks = getMarks(first);
41245
41167
  if (marks.length === 0) {
41246
41168
  if (first.linkifyTextNode) {
41169
+ const f = first;
41247
41170
  return [
41248
- first.linkifyTextNode(text5(first)),
41171
+ first.linkifyTextNode(text5({ text: f.text })),
41249
41172
  ...eat2(content3.slice(1), field, imageCallback)
41250
41173
  ];
41251
41174
  } else {
41252
- return [text5(first), ...eat2(content3.slice(1), field, imageCallback)];
41175
+ const f = first;
41176
+ return [
41177
+ text5({ text: f.text }),
41178
+ ...eat2(content3.slice(1), field, imageCallback)
41179
+ ];
41253
41180
  }
41254
41181
  }
41255
41182
  let nonMatchingSiblingIndex = 0;
@@ -41285,17 +41212,23 @@ var eat2 = (c, field, imageCallback) => {
41285
41212
  }
41286
41213
  });
41287
41214
  if (!markToProcess) {
41288
- return [text5(first), ...eat2(content3.slice(1), field, imageCallback)];
41215
+ const f = first;
41216
+ return [
41217
+ text5({ text: f.text }),
41218
+ ...eat2(content3.slice(1), field, imageCallback)
41219
+ ];
41289
41220
  }
41290
41221
  if (markToProcess === "inlineCode") {
41291
41222
  if (nonMatchingSiblingIndex) {
41292
41223
  throw new Error("Marks inside inline code are not supported");
41293
41224
  }
41225
+ const f = first;
41294
41226
  const node2 = {
41295
41227
  type: markToProcess,
41296
- value: first.text
41228
+ value: f.text
41297
41229
  };
41298
41230
  return [
41231
+ // @ts-ignore
41299
41232
  first.linkifyTextNode?.(node2) ?? node2,
41300
41233
  ...eat2(content3.slice(nonMatchingSiblingIndex + 1), field, imageCallback)
41301
41234
  ];
@@ -41685,7 +41618,7 @@ var getMarks = (content3) => {
41685
41618
  var stringifyPropsInline2 = (element2, field, imageCallback) => {
41686
41619
  return stringifyProps2(element2, field, true, imageCallback);
41687
41620
  };
41688
- function stringifyProps2(element2, parentField, flatten2, imageCallback) {
41621
+ function stringifyProps2(element2, parentField, flatten, imageCallback) {
41689
41622
  const attributes2 = [];
41690
41623
  const children = [];
41691
41624
  let template;
@@ -41821,7 +41754,7 @@ function stringifyProps2(element2, parentField, flatten2, imageCallback) {
41821
41754
  name: name2,
41822
41755
  value: {
41823
41756
  type: "mdxJsxAttributeValueExpression",
41824
- value: stringifyObj2(value, flatten2)
41757
+ value: stringifyObj2(value, flatten)
41825
41758
  }
41826
41759
  });
41827
41760
  break;
@@ -41834,7 +41767,7 @@ function stringifyProps2(element2, parentField, flatten2, imageCallback) {
41834
41767
  if (field.list) {
41835
41768
  throw new Error(`Rich-text list is not supported`);
41836
41769
  } else {
41837
- const joiner = flatten2 ? " " : "\n";
41770
+ const joiner = flatten ? " " : "\n";
41838
41771
  let val = "";
41839
41772
  assertShape2(
41840
41773
  value,
@@ -41853,7 +41786,7 @@ function stringifyProps2(element2, parentField, flatten2, imageCallback) {
41853
41786
  val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
41854
41787
  }
41855
41788
  }
41856
- if (flatten2) {
41789
+ if (flatten) {
41857
41790
  attributes2.push({
41858
41791
  type: "mdxJsxAttribute",
41859
41792
  name: name2,
@@ -41900,7 +41833,7 @@ ${val}
41900
41833
  }
41901
41834
  return { attributes: attributes2, children, useDirective, directiveType };
41902
41835
  }
41903
- function stringifyObj2(obj, flatten2) {
41836
+ function stringifyObj2(obj, flatten) {
41904
41837
  if (typeof obj === "object" && obj !== null) {
41905
41838
  const dummyFunc = `const dummyFunc = `;
41906
41839
  const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
@@ -41909,7 +41842,7 @@ function stringifyObj2(obj, flatten2) {
41909
41842
  semi: false,
41910
41843
  plugins: [mc]
41911
41844
  }).trim().replace(dummyFunc, "");
41912
- return flatten2 ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
41845
+ return flatten ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
41913
41846
  } else {
41914
41847
  throw new Error(
41915
41848
  `stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
@@ -42041,13 +41974,17 @@ var eat3 = (c, field, imageCallback) => {
42041
41974
  }
42042
41975
  const marks = getMarks(first);
42043
41976
  if (marks.length === 0) {
41977
+ const f = first;
42044
41978
  if (first.linkifyTextNode) {
42045
41979
  return [
42046
- first.linkifyTextNode(text6(first)),
41980
+ first.linkifyTextNode(text6({ text: f.text })),
42047
41981
  ...eat3(content3.slice(1), field, imageCallback)
42048
41982
  ];
42049
41983
  } else {
42050
- return [text6(first), ...eat3(content3.slice(1), field, imageCallback)];
41984
+ return [
41985
+ text6({ text: f.text }),
41986
+ ...eat3(content3.slice(1), field, imageCallback)
41987
+ ];
42051
41988
  }
42052
41989
  }
42053
41990
  let nonMatchingSiblingIndex = 0;
@@ -42083,17 +42020,23 @@ var eat3 = (c, field, imageCallback) => {
42083
42020
  }
42084
42021
  });
42085
42022
  if (!markToProcess) {
42086
- return [text6(first), ...eat3(content3.slice(1), field, imageCallback)];
42023
+ const f = first;
42024
+ return [
42025
+ text6({ text: f.text }),
42026
+ ...eat3(content3.slice(1), field, imageCallback)
42027
+ ];
42087
42028
  }
42088
42029
  if (markToProcess === "inlineCode") {
42030
+ const f = first;
42089
42031
  if (nonMatchingSiblingIndex) {
42090
42032
  throw new Error(`Marks inside inline code are not supported`);
42091
42033
  }
42092
42034
  const node2 = {
42093
42035
  type: markToProcess,
42094
- value: first.text
42036
+ value: f.text
42095
42037
  };
42096
42038
  return [
42039
+ // @ts-ignore
42097
42040
  first.linkifyTextNode?.(node2) ?? node2,
42098
42041
  ...eat3(content3.slice(nonMatchingSiblingIndex + 1), field, imageCallback)
42099
42042
  ];
@@ -48159,9 +48102,6 @@ function compact(tree) {
48159
48102
  return tree;
48160
48103
  }
48161
48104
 
48162
- // src/parse/remarkToPlate.ts
48163
- var import_lodash = __toESM(require_lodash());
48164
-
48165
48105
  // src/parse/acorn.ts
48166
48106
  var extractAttributes = (attributes2, fields, imageCallback) => {
48167
48107
  const properties = {};
@@ -48558,11 +48498,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
48558
48498
  children: [
48559
48499
  {
48560
48500
  type: "p",
48561
- children: (0, import_lodash.default)(
48562
- tableCell.children.map(
48563
- (child) => phrasingContent(child)
48564
- )
48565
- )
48501
+ children: tableCell.children.map((child) => phrasingContent(child)).flat()
48566
48502
  }
48567
48503
  ]
48568
48504
  };
@@ -48605,9 +48541,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
48605
48541
  children: [
48606
48542
  {
48607
48543
  type: "lic",
48608
- children: (0, import_lodash.default)(
48609
- content4.children.map((child) => unwrapBlockContent(child))
48610
- )
48544
+ children: content4.children.map((child) => unwrapBlockContent(child)).flat()
48611
48545
  }
48612
48546
  ]
48613
48547
  };
@@ -48671,9 +48605,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
48671
48605
  case "paragraph":
48672
48606
  return {
48673
48607
  type: "lic",
48674
- children: (0, import_lodash.default)(
48675
- child.children.map((child2) => phrasingContent(child2))
48676
- )
48608
+ children: child.children.map((child2) => phrasingContent(child2)).flat()
48677
48609
  };
48678
48610
  case "blockquote": {
48679
48611
  return {
@@ -48736,7 +48668,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
48736
48668
  const unwrapBlockContent = (content4) => {
48737
48669
  const flattenPhrasingContent = (children) => {
48738
48670
  const children2 = children.map((child) => phrasingContent(child));
48739
- return (0, import_lodash.default)(Array.isArray(children2) ? children2 : [children2]);
48671
+ return (Array.isArray(children2) ? children2 : [children2]).flat();
48740
48672
  };
48741
48673
  switch (content4.type) {
48742
48674
  case "heading":
@@ -48786,15 +48718,13 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
48786
48718
  type: "a",
48787
48719
  url: sanitizeUrl(content4.url),
48788
48720
  title: content4.title,
48789
- children: (0, import_lodash.default)(
48790
- content4.children.map((child) => staticPhrasingContent(child))
48791
- )
48721
+ children: content4.children.map((child) => staticPhrasingContent(child)).flat()
48792
48722
  };
48793
48723
  };
48794
48724
  const heading2 = (content4) => {
48795
48725
  return {
48796
48726
  type: ["h1", "h2", "h3", "h4", "h5", "h6"][content4.depth - 1],
48797
- children: (0, import_lodash.default)(content4.children.map(phrasingContent))
48727
+ children: content4.children.map(phrasingContent).flat()
48798
48728
  };
48799
48729
  };
48800
48730
  const staticPhrasingContent = (content4) => {
@@ -48867,11 +48797,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
48867
48797
  const accum = [];
48868
48798
  switch (node2.type) {
48869
48799
  case "emphasis": {
48870
- const children = (0, import_lodash.default)(
48871
- node2.children.map(
48872
- (child) => phrashingMark(child, [...marks, "italic"])
48873
- )
48874
- );
48800
+ const children = node2.children.map((child) => phrashingMark(child, [...marks, "italic"])).flat();
48875
48801
  children.forEach((child) => {
48876
48802
  accum.push(child);
48877
48803
  });
@@ -48889,20 +48815,14 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
48889
48815
  break;
48890
48816
  }
48891
48817
  case "delete": {
48892
- const children = (0, import_lodash.default)(
48893
- node2.children.map(
48894
- (child) => phrashingMark(child, [...marks, "strikethrough"])
48895
- )
48896
- );
48818
+ const children = node2.children.map((child) => phrashingMark(child, [...marks, "strikethrough"])).flat();
48897
48819
  children.forEach((child) => {
48898
48820
  accum.push(child);
48899
48821
  });
48900
48822
  break;
48901
48823
  }
48902
48824
  case "strong": {
48903
- const children = (0, import_lodash.default)(
48904
- node2.children.map((child) => phrashingMark(child, [...marks, "bold"]))
48905
- );
48825
+ const children = node2.children.map((child) => phrashingMark(child, [...marks, "bold"])).flat();
48906
48826
  children.forEach((child) => {
48907
48827
  accum.push(child);
48908
48828
  });
@@ -48913,9 +48833,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
48913
48833
  break;
48914
48834
  }
48915
48835
  case "link": {
48916
- const children = (0, import_lodash.default)(
48917
- node2.children.map((child) => phrashingMark(child, marks))
48918
- );
48836
+ const children = node2.children.map((child) => phrashingMark(child, marks)).flat();
48919
48837
  accum.push({
48920
48838
  type: "a",
48921
48839
  url: sanitizeUrl(node2.url),
@@ -48977,7 +48895,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
48977
48895
  };
48978
48896
  };
48979
48897
  const paragraph2 = (content4) => {
48980
- const children = (0, import_lodash.default)(content4.children.map(phrasingContent));
48898
+ const children = content4.children.map(phrasingContent).flat();
48981
48899
  if (children.length === 1) {
48982
48900
  if (children[0]) {
48983
48901
  if (children[0].type === "html_inline") {
@@ -49001,9 +48919,9 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
49001
48919
  };
49002
48920
  };
49003
48921
  var RichTextParseError = class _RichTextParseError extends Error {
48922
+ position;
49004
48923
  constructor(message, position2) {
49005
48924
  super(message);
49006
- __publicField(this, "position");
49007
48925
  if (Error.captureStackTrace) {
49008
48926
  Error.captureStackTrace(this, _RichTextParseError);
49009
48927
  }
@@ -49101,7 +49019,7 @@ function parseShortcode(preprocessedString, template) {
49101
49019
  var mdxToAst = (value) => {
49102
49020
  return remark().use(remarkMdx).use(remarkGfm).parse(value);
49103
49021
  };
49104
- var MDX_PARSE_ERROR_MSG = "TinaCMS supports a stricter version of markdown and a subset of MDX. https://tina.io/docs/editing/mdx/#differences-from-other-mdx-implementations";
49022
+ var MDX_PARSE_ERROR_MSG = "TinaCMS supports a stricter version of markdown and a subset of MDX. https://tina.io/docs/r/what-is-markdown";
49105
49023
  var parseMDX = (value, field, imageCallback) => {
49106
49024
  if (!value) {
49107
49025
  return { type: "root", children: [] };