@tinacms/mdx 0.61.14 → 0.61.16

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.
Files changed (2) hide show
  1. package/dist/index.js +54 -8
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -6670,7 +6670,7 @@ var require_doc = __commonJS({
6670
6670
  if (parts.length === 0) {
6671
6671
  break;
6672
6672
  }
6673
- const [content3, whitespace] = parts;
6673
+ const [content3, whitespace2] = parts;
6674
6674
  const contentFlatCmd = [ind, MODE_FLAT, content3];
6675
6675
  const contentBreakCmd = [ind, MODE_BREAK, content3];
6676
6676
  const contentFits = fits(contentFlatCmd, [], rem, options, lineSuffix.length > 0, true);
@@ -6682,8 +6682,8 @@ var require_doc = __commonJS({
6682
6682
  }
6683
6683
  break;
6684
6684
  }
6685
- const whitespaceFlatCmd = [ind, MODE_FLAT, whitespace];
6686
- const whitespaceBreakCmd = [ind, MODE_BREAK, whitespace];
6685
+ const whitespaceFlatCmd = [ind, MODE_FLAT, whitespace2];
6686
+ const whitespaceBreakCmd = [ind, MODE_BREAK, whitespace2];
6687
6687
  if (parts.length === 2) {
6688
6688
  if (contentFits) {
6689
6689
  cmds.push(whitespaceFlatCmd, contentFlatCmd);
@@ -6695,7 +6695,7 @@ var require_doc = __commonJS({
6695
6695
  parts.splice(0, 2);
6696
6696
  const remainingCmd = [ind, mode, fill(parts)];
6697
6697
  const secondContent = parts[0];
6698
- const firstAndSecondContentFlatCmd = [ind, MODE_FLAT, [content3, whitespace, secondContent]];
6698
+ const firstAndSecondContentFlatCmd = [ind, MODE_FLAT, [content3, whitespace2, secondContent]];
6699
6699
  const firstAndSecondContentFits = fits(firstAndSecondContentFlatCmd, [], rem, options, lineSuffix.length > 0, true);
6700
6700
  if (firstAndSecondContentFits) {
6701
6701
  cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd);
@@ -197710,7 +197710,7 @@ var require_prettier = __commonJS({
197710
197710
  const {
197711
197711
  logger = console,
197712
197712
  descriptor = defaults_1.defaultDescriptor,
197713
- unknown: unknown2 = defaults_1.defaultUnknownHandler,
197713
+ unknown: unknown3 = defaults_1.defaultUnknownHandler,
197714
197714
  invalid: invalid2 = defaults_1.defaultInvalidHandler,
197715
197715
  deprecated = defaults_1.defaultDeprecatedHandler
197716
197716
  } = opts || {};
@@ -197727,7 +197727,7 @@ var require_prettier = __commonJS({
197727
197727
  normalizeRedirectResult: utils_1.normalizeRedirectResult,
197728
197728
  normalizeValidateResult: utils_1.normalizeValidateResult
197729
197729
  };
197730
- this._unknownHandler = unknown2;
197730
+ this._unknownHandler = unknown3;
197731
197731
  this._invalidHandler = invalid2;
197732
197732
  this._deprecatedHandler = deprecated;
197733
197733
  this.cleanHistory();
@@ -197926,7 +197926,7 @@ var require_prettier = __commonJS({
197926
197926
  colorsModule = null,
197927
197927
  levenshteinDistance = null
197928
197928
  } = {}) {
197929
- const unknown2 = !passThrough ? (key, value, options2) => {
197929
+ const unknown3 = !passThrough ? (key, value, options2) => {
197930
197930
  const _options2$schemas = options2.schemas, {
197931
197931
  _
197932
197932
  } = _options2$schemas, schemas2 = _objectWithoutProperties(_options2$schemas, _excluded2);
@@ -197946,7 +197946,7 @@ var require_prettier = __commonJS({
197946
197946
  });
197947
197947
  const normalizer = new vnopts.Normalizer(schemas, {
197948
197948
  logger,
197949
- unknown: unknown2,
197949
+ unknown: unknown3,
197950
197950
  descriptor
197951
197951
  });
197952
197952
  const shouldSuppressDuplicateDeprecationWarnings = logger !== false;
@@ -243985,6 +243985,49 @@ function remarkMdx(options = {}) {
243985
243985
  }
243986
243986
  }
243987
243987
 
243988
+ // ../../../node_modules/.pnpm/hast-util-whitespace@2.0.0/node_modules/hast-util-whitespace/index.js
243989
+ function whitespace(thing) {
243990
+ var value = thing && typeof thing === "object" && thing.type === "text" ? thing.value || "" : thing;
243991
+ return typeof value === "string" && value.replace(/[ \t\n\f\r]/g, "") === "";
243992
+ }
243993
+
243994
+ // ../../../node_modules/.pnpm/remark-unwrap-images@3.0.1/node_modules/remark-unwrap-images/index.js
243995
+ var unknown2 = 1;
243996
+ var containsImage = 2;
243997
+ var containsOther = 3;
243998
+ function remarkUnwrapImages() {
243999
+ return (tree) => {
244000
+ visit(tree, "paragraph", (node, index2, parent) => {
244001
+ if (parent && typeof index2 === "number" && applicable(node) === containsImage) {
244002
+ parent.children.splice(index2, 1, ...node.children);
244003
+ return [SKIP, index2];
244004
+ }
244005
+ });
244006
+ };
244007
+ }
244008
+ function applicable(node, inLink) {
244009
+ let image2 = unknown2;
244010
+ let index2 = -1;
244011
+ while (++index2 < node.children.length) {
244012
+ const child = node.children[index2];
244013
+ if (whitespace(child)) {
244014
+ } else if (child.type === "image" || child.type === "imageReference") {
244015
+ image2 = containsImage;
244016
+ } else if (!inLink && (child.type === "link" || child.type === "linkReference")) {
244017
+ const linkResult = applicable(child, true);
244018
+ if (linkResult === containsOther) {
244019
+ return containsOther;
244020
+ }
244021
+ if (linkResult === containsImage) {
244022
+ image2 = containsImage;
244023
+ }
244024
+ } else {
244025
+ return containsOther;
244026
+ }
244027
+ }
244028
+ return image2;
244029
+ }
244030
+
243988
244031
  // ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js
243989
244032
  var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
243990
244033
  var freeGlobal_default = freeGlobal;
@@ -244386,6 +244429,8 @@ var remarkToSlate = (root3, field, imageCallback) => {
244386
244429
  return code2(content4);
244387
244430
  case "paragraph":
244388
244431
  return paragraph2(content4);
244432
+ case "image":
244433
+ return image2(content4);
244389
244434
  case "mdxJsxFlowElement":
244390
244435
  return mdxJsxElement(content4, field, imageCallback);
244391
244436
  case "thematicBreak":
@@ -244690,6 +244735,7 @@ var markdownToAst = (value, field) => {
244690
244735
  if (!tree) {
244691
244736
  throw new Error("Error parsing markdown");
244692
244737
  }
244738
+ remarkUnwrapImages({})(tree);
244693
244739
  return tree;
244694
244740
  } catch (e) {
244695
244741
  throw new RichTextParseError(e, e.position);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/mdx",
3
- "version": "0.61.14",
3
+ "version": "0.61.16",
4
4
  "typings": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -19,7 +19,7 @@
19
19
  ]
20
20
  },
21
21
  "dependencies": {
22
- "@tinacms/schema-tools": "0.1.9",
22
+ "@tinacms/schema-tools": "0.2.1",
23
23
  "acorn": "^8.7.1",
24
24
  "lodash-es": "^4.17.21",
25
25
  "mdast-util-mdx-jsx": "^2.0.1",
@@ -27,6 +27,7 @@
27
27
  "prettier": "^2.7.1",
28
28
  "remark": "^14.0.2",
29
29
  "remark-mdx": "^2.1.2",
30
+ "remark-unwrap-images": "^3.0.1",
30
31
  "unist-util-visit": "^4.1.0",
31
32
  "vfile": "^4.2.0"
32
33
  },