From 37835548c9fbc3b2202c195d228ebcb6d58e32d5 Mon Sep 17 00:00:00 2001 From: Titus Date: Fri, 18 Dec 2020 16:50:13 +0100 Subject: [PATCH] Refactor to generate JS AST MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR changes the internals of the core `@mdx-js/mdx` package to generate a JavaScript syntax tree instead of a string. This fixes escaping issues such as #1219. It makes `mdx-hast-to-jsx` much more palatable. It also prevents several Babel parses. It paves the way for passing in Babel plugins, which is useful for users, but also for us to compile to `React.createElement`, `_jsx`, or Vue’s `h` calls directly and make MDX’s output directly usable. * `babel-plugin-apply-mdx-type-props`: add `parentType` * `mdx`: use `rehype-minify-whitespace` to remove superfluous whitespace * `mdx`: use `hast-util-to-estree` to transform hast to estree * `mdx`: use `estree-to-babel` to transform estree to Babel * `mdx`: generate estree/Babel instead of strings * `mdx`: use `@babel/generator` to serialize Babel AST * `vue`: stop supporting the react transform: (it doesn’t make sense) * `vue`: fix support for props to components Related to GH-741. Related to GH-1152. Closes GH-606. Closes GH-1028. Closes GH-1219. Closes GH-1382. Reviewed-by: Christian Murphy --- .../index.js | 21 + .../test/index.test.js | 2 +- packages/mdx/index.js | 2 + packages/mdx/mdx-hast-to-jsx.js | 547 +- packages/mdx/package.json | 17 +- packages/mdx/test/index.test.js | 91 +- packages/preact/test/test.js | 3 +- packages/react/test/test.js | 3 +- packages/remark-mdx/package.json | 4 +- .../test/fixtures/block-parsing.json | 568 +- .../test/fixtures/character-reference.json | 45 + .../test/fixtures/examples-from-jsx.json | 808 ++- .../examples-from-react-accessibility.json | 5727 ++++++++++------- .../examples-from-react-jsx-in-depth.json | 4502 ++++++++----- .../remark-mdx/test/fixtures/expressions.json | 1633 +++-- .../test/fixtures/format-attributes.json | 1448 ++++- .../test/fixtures/interleaving.json | 1516 +++-- .../remark-mdx/test/fixtures/markdown.json | 340 +- packages/remark-mdx/test/fixtures/span.json | 519 +- packages/runtime/test/index.test.js | 4 +- packages/vue-loader/package.json | 1 + packages/vue/package.json | 7 +- packages/vue/src/create-element.js | 47 +- packages/vue/test/test.js | 31 +- yarn.lock | 203 +- 25 files changed, 11799 insertions(+), 6290 deletions(-) diff --git a/packages/babel-plugin-apply-mdx-type-props/index.js b/packages/babel-plugin-apply-mdx-type-props/index.js index ab549dd48..c34939a04 100644 --- a/packages/babel-plugin-apply-mdx-type-props/index.js +++ b/packages/babel-plugin-apply-mdx-type-props/index.js @@ -16,6 +16,27 @@ class BabelPluginApplyMdxTypeProp { JSXOpeningElement(path) { const jsxName = path.node.name.name + let parentPath = path.parentPath.parentPath + let parentName + + while (parentPath) { + if (parentPath.node.type === 'JSXElement') { + parentName = parentPath.node.openingElement.name.name + break + } + + parentPath = parentPath.parentPath + } + + if (typeof parentName === 'string' && parentName !== 'MDXLayout') { + path.node.attributes.push( + t.jSXAttribute( + t.jSXIdentifier(`parentName`), + t.stringLiteral(parentName) + ) + ) + } + if (startsWithCapitalLetter(jsxName)) { names.push(jsxName) diff --git a/packages/babel-plugin-apply-mdx-type-props/test/index.test.js b/packages/babel-plugin-apply-mdx-type-props/test/index.test.js index 97ff81498..9c6202b6b 100644 --- a/packages/babel-plugin-apply-mdx-type-props/test/index.test.js +++ b/packages/babel-plugin-apply-mdx-type-props/test/index.test.js @@ -19,7 +19,7 @@ const transform = value => { describe('babel-plugin-add-mdx-type-prop', () => { test('should add `mdxType` to components', () => { expect(transform('var d =
').code).toEqual( - 'var d =
;' + 'var d =
;' ) }) diff --git a/packages/mdx/index.js b/packages/mdx/index.js index a65d528f3..a79d3dfcc 100644 --- a/packages/mdx/index.js +++ b/packages/mdx/index.js @@ -2,6 +2,7 @@ const unified = require('unified') const remarkParse = require('remark-parse') const remarkMdx = require('remark-mdx') const squeeze = require('remark-squeeze-paragraphs') +const minifyWhitespace = require('rehype-minify-whitespace') const mdxAstToMdxHast = require('./mdx-ast-to-mdx-hast') const mdxHastToJsx = require('./mdx-hast-to-jsx') @@ -20,6 +21,7 @@ function createMdxAstCompiler(options = {}) { function createCompiler(options = {}) { return createMdxAstCompiler(options) .use(options.rehypePlugins) + .use(minifyWhitespace, {newlines: true}) .use(mdxHastToJsx, options) } diff --git a/packages/mdx/mdx-hast-to-jsx.js b/packages/mdx/mdx-hast-to-jsx.js index 727dee487..a136463fc 100644 --- a/packages/mdx/mdx-hast-to-jsx.js +++ b/packages/mdx/mdx-hast-to-jsx.js @@ -1,260 +1,118 @@ -const {transformSync} = require('@babel/core') +const {transformFromAstSync} = require('@babel/core') +const generate = require('@babel/generator').default const uniq = require('lodash.uniq') -const encode = require('stringify-entities/light') -const toH = require('hast-to-hyperscript') -const recast = require('recast') +const toEstree = require('hast-util-to-estree') +const estreeToBabel = require('estree-to-babel') const BabelPluginApplyMdxProp = require('babel-plugin-apply-mdx-type-prop') const BabelPluginExtractImportNames = require('babel-plugin-extract-import-names') const BabelPluginExtractExportNames = require('babel-plugin-extract-export-names') -// To do: `recast` might be heavy (have to check), and `astring` might be a good -// alternative. -// However, `astring` doesn’t support JSX. -// When we start compiling JSX away, `astring` might be a good fit though. - -function toJSX(node, parentNode = {}, options = {}) { - if (node.type === 'root') { - return serializeRoot(node, options) - } - - if (node.type === 'element') { - return serializeElement(node, options, parentNode) - } - - // Wraps text nodes inside template string, so that we don't run into escaping issues. - if (node.type === 'text') { - return serializeText(node, options, parentNode) - } - - if (node.type === 'mdxFlowExpression' || node.type === 'mdxTextExpression') { - return serializeMdxExpression(node) - } - - // To do: pass `parentName` in? - if (node.type === 'mdxJsxFlowElement' || node.type === 'mdxJsxTextElement') { - return serializeComponent(node, options, parentNode) - } -} - -function serializeRoot(node, options) { +function serializeEstree(estree, options) { const { // Default options skipExport = false, wrapExport } = options - const groups = {mdxjsEsm: [], rest: []} - - node.children.forEach(child => { - groups[child.type === 'mdxjsEsm' ? child.type : 'rest'].push(child) - }) - - // Find a default export, assumes there’s zero or one. - const importStatements = [] - const exportStatements = [] let layout + let children = [] + + // Find the `export default`, the JSX expression, and leave the rest + // (import/exports) as they are. + estree.body = estree.body.filter(child => { + if (child.type === 'ExportDefaultDeclaration') { + layout = child.declaration + return false + } - groups.mdxjsEsm.forEach(child => { - child.data.estree.body.forEach(eschild => { - if (eschild.type === 'ImportDeclaration') { - importStatements.push(recast.prettyPrint(eschild).code) - } else if (eschild.type === 'ExportDefaultDeclaration') { - layout = recast.prettyPrint(eschild.declaration).code - } else { - exportStatements.push(recast.prettyPrint(eschild).code) - } - }) + if ( + child.type === 'ExpressionStatement' && + (child.expression.type === 'JSXFragment' || + child.expression.type === 'JSXElement') + ) { + children = + child.expression.type === 'JSXFragment' + ? child.expression.children + : [child.expression] + return false + } + + return true }) - const doc = groups.rest - .map(childNode => toJSX(childNode, node, options)) - .join('') - .replace(/^\n+|\n+$/, '') + estree.body = [ + ...estree.body, + ...createMdxLayout(layout), + ...createMdxContent(children) + ] - const fn = `function MDXContent({ components, ...props }) { -return ( - -${doc} - -) -}; -MDXContent.isMDXComponent = true` + // Now, transform the whole with Babel. + const babelTree = estreeToBabel(estree) - // Check JSX nodes against imports + // Get all the identifiers that are imported or exported (as those might be + // component names). const babelPluginExtractImportNamesInstance = new BabelPluginExtractImportNames() const babelPluginExtractExportNamesInstance = new BabelPluginExtractExportNames() - const importsAndExports = [] - .concat(importStatements, exportStatements) - .join('\n') - - transformSync(importsAndExports, { - filename: options.filename, - configFile: false, - babelrc: false, - plugins: [ - require('@babel/plugin-syntax-jsx'), - require('@babel/plugin-syntax-object-rest-spread'), - babelPluginExtractImportNamesInstance.plugin, - babelPluginExtractExportNamesInstance.plugin - ] - }) - - const importNames = babelPluginExtractImportNamesInstance.state.names - const exportNames = babelPluginExtractExportNamesInstance.state.names - - // Add `mdxType` props. + // Get all used JSX identifiers (`mdxType` props). const babelPluginApplyMdxPropInstance = new BabelPluginApplyMdxProp() - const babelPluginApplyMdxPropToExportsInstance = new BabelPluginApplyMdxProp() - const fnPostMdxTypeProp = transformSync(fn, { + // Mutate the Babel AST. + transformFromAstSync(babelTree, '', { filename: options.filename, + ast: false, + code: false, + cloneInputAst: false, configFile: false, babelrc: false, plugins: [ - require('@babel/plugin-syntax-jsx'), - require('@babel/plugin-syntax-object-rest-spread'), + babelPluginExtractImportNamesInstance.plugin, + babelPluginExtractExportNamesInstance.plugin, babelPluginApplyMdxPropInstance.plugin ] - }).code - - const exportStatementsPostMdxTypeProps = transformSync( - exportStatements.join('\n'), - { - filename: options.filename, - configFile: false, - babelrc: false, - plugins: [ - require('@babel/plugin-syntax-jsx'), - require('@babel/plugin-syntax-object-rest-spread'), - babelPluginApplyMdxPropToExportsInstance.plugin - ] - } - ).code - - const allJsxNames = [ - ...babelPluginApplyMdxPropInstance.state.names, - ...babelPluginApplyMdxPropToExportsInstance.state.names - ] - const jsxNames = allJsxNames.filter(name => name !== 'MDXLayout') - - const importExportNames = importNames.concat(exportNames) - const uniqNames = uniq(jsxNames) - .filter(name => !importExportNames.includes(name)) - .map(name => `const ${name} = makeShortcode("${name}");`) - - const fakedModulesForGlobalScope = - uniqNames.length > 0 - ? `const makeShortcode = name => function MDXDefaultShortcode(props) { - console.warn("Component \`" + name + "\` was not imported, exported, or provided by MDXProvider as global scope") - return
-}; -` + uniqNames.join('\n') - : '' - - const moduleBase = `${importStatements} -${exportStatementsPostMdxTypeProps} -${fakedModulesForGlobalScope} -const MDXLayout = ${layout || '"wrapper"'}` - - if (skipExport) { - return `${moduleBase} -${fnPostMdxTypeProp}` - } - - if (wrapExport) { - return `${moduleBase} -${fnPostMdxTypeProp} -export default ${wrapExport}(MDXContent)` - } - - return `${moduleBase} -export default ${fnPostMdxTypeProp}` -} + }) -function serializeElement(node, options, parentNode) { - const parentName = parentNode.tagName - const {type, props} = toH( - fakeReactCreateElement, - Object.assign({}, node, {children: []}), - {prefix: false} + const importExportNames = babelPluginExtractImportNamesInstance.state.names.concat( + babelPluginExtractExportNamesInstance.state.names ) - const content = serializeChildren(node, options) - - delete props.key - const data = parentName ? {...props, parentName} : props - - const spread = - Object.keys(data).length === 0 ? null : ' {...' + JSON.stringify(data) + '}' - - return ( - '<' + - type + - (spread ? ' ' + spread : '') + - (content ? '>' + content + '' : '/>') + const jsxNames = babelPluginApplyMdxPropInstance.state.names.filter( + name => name !== 'MDXLayout' ) -} - -function serializeComponent(node, options) { - const tags = serializeTags(node) - let content = serializeChildren(node, options) - - if (node.type === 'mdxJsxFlowElement' && content) { - content = '\n' + content + '\n' - } - return tags.open + content + (tags.close || '') -} - -function serializeText(node, options, parentNode) { - // Don't wrap newlines unless specifically instructed to by the flag, - // to avoid issues like React warnings caused by text nodes in tables. - const preserveNewlines = - options.preserveNewlines || parentNode.tagName === 'p' - - if (node.value === '\n' && !preserveNewlines) { - return node.value - } + const shortcodes = createMakeShortcodeHelper( + uniq(jsxNames).filter(name => !importExportNames.includes(name)) + ) - return toTemplateLiteral(node.value) -} + const exports = [] -function serializeChildren(node, options) { - const children = node.children || [] - const childOptions = Object.assign({}, options, { - // Tell all children inside
 tags to preserve newlines as text nodes
-    preserveNewlines: options.preserveNewlines || node.tagName === 'pre'
-  })
+  if (!skipExport) {
+    let declaration = {type: 'Identifier', name: 'MDXContent'}
 
-  return children.map(child => toJSX(child, node, childOptions)).join('\n')
-}
+    if (wrapExport) {
+      declaration = {
+        type: 'CallExpression',
+        callee: {type: 'Identifier', name: wrapExport},
+        arguments: [declaration]
+      }
+    }
 
-// We only do this for the props, so we’re ignoring children.
-function fakeReactCreateElement(name, props) {
-  return {
-    type: name,
-    props: props,
-    // Needed for `toH` to think this is React.
-    key: null,
-    _owner: null
+    exports.push({type: 'ExportDefaultDeclaration', declaration: declaration})
   }
-}
 
-function toTemplateLiteral(value) {
-  const escaped = value
-    .replace(/\\(?!\$)/g, '\\\\') // Escape all "\" to avoid unwanted escaping in text nodes
-    // and ignore "\$" since it's already escaped and is common
-    // with prettier https://github.com/mdx-js/mdx/issues/606
-    .replace(/`/g, '\\`') // Escape "`"" since
-    .replace(/(\\\$)/g, '\\$1') // Escape \$ so render it as it is
-    .replace(/(\\\$)(\{)/g, '\\$1\\$2') // Escape \${} so render it as it is
-    .replace(/\$\{/g, '\\${') // Escape ${} in text so that it doesn't eval
+  babelTree.program.body = [
+    ...shortcodes,
+    ...babelTree.program.body,
+    ...exports
+  ]
 
-  return '{`' + escaped + '`}'
+  return generate(babelTree).code
 }
 
 function compile(options = {}) {
   function compiler(tree, file) {
-    return toJSX(tree, undefined, {filename: (file || {}).path, ...options})
+    return serializeEstree(toEstree(tree), {
+      filename: (file || {}).path,
+      ...options
+    })
   }
 
   this.Compiler = compiler
@@ -262,92 +120,197 @@ function compile(options = {}) {
 
 module.exports = compile
 compile.default = compile
-compile.toJSX = toJSX
-
-// To do: this is all extracted (and simplified) from `mdast-util-mdx-jsx` for
-// now.
-// We can remove it when we drop JSX!
-
-const eol = /\r?\n|\r/g
-
-function serializeTags(node) {
-  const selfClosing = node.name && (!node.children || !node.children.length)
-  const attributes = []
-  let index = -1
-  let attribute
-  let result
-
-  // None.
-  if (node.attributes && node.attributes.length) {
-    if (!node.name) {
-      throw new Error('Cannot serialize fragment w/ attributes')
-    }
 
-    while (++index < node.attributes.length) {
-      attribute = node.attributes[index]
-
-      if (attribute.type === 'mdxJsxExpressionAttribute') {
-        result = '{' + (attribute.value || '') + '}'
-      } else {
-        if (!attribute.name) {
-          throw new Error('Cannot serialize attribute w/o name')
+function createMdxContent(children) {
+  return [
+    {
+      type: 'FunctionDeclaration',
+      id: {type: 'Identifier', name: 'MDXContent'},
+      expression: false,
+      generator: false,
+      async: false,
+      params: [
+        {
+          type: 'ObjectPattern',
+          properties: [
+            {
+              type: 'Property',
+              method: false,
+              shorthand: true,
+              computed: false,
+              key: {type: 'Identifier', name: 'components'},
+              kind: 'init',
+              value: {type: 'Identifier', name: 'components'}
+            },
+            {type: 'RestElement', argument: {type: 'Identifier', name: 'props'}}
+          ]
         }
-
-        result =
-          attribute.name +
-          (attribute.value == null
-            ? ''
-            : '=' +
-              (typeof attribute.value === 'object'
-                ? '{' + (attribute.value.value || '') + '}'
-                : '"' + encode(attribute.value, {subset: ['"']}) + '"'))
+      ],
+      body: {
+        type: 'BlockStatement',
+        body: [
+          {
+            type: 'ReturnStatement',
+            argument: {
+              type: 'JSXElement',
+              openingElement: {
+                type: 'JSXOpeningElement',
+                attributes: [
+                  {
+                    type: 'JSXAttribute',
+                    name: {type: 'JSXIdentifier', name: 'components'},
+                    value: {
+                      type: 'JSXExpressionContainer',
+                      expression: {type: 'Identifier', name: 'components'}
+                    }
+                  },
+                  {
+                    type: 'JSXSpreadAttribute',
+                    argument: {type: 'Identifier', name: 'props'}
+                  }
+                ],
+                name: {type: 'JSXIdentifier', name: 'MDXLayout'},
+                selfClosing: false
+              },
+              closingElement: {
+                type: 'JSXClosingElement',
+                name: {type: 'JSXIdentifier', name: 'MDXLayout'}
+              },
+              children: children
+            }
+          }
+        ]
+      }
+    },
+    {
+      type: 'ExpressionStatement',
+      expression: {
+        type: 'AssignmentExpression',
+        operator: '=',
+        left: {
+          type: 'MemberExpression',
+          object: {type: 'Identifier', name: 'MDXContent'},
+          property: {type: 'Identifier', name: 'isMDXComponent'},
+          computed: false,
+          optional: false
+        },
+        right: {type: 'Literal', value: true, raw: 'true'}
       }
-
-      attributes.push(result)
     }
-  }
-
-  return {
-    open:
-      '<' +
-      (node.name || '') +
-      (node.type === 'mdxJsxFlowElement' && attributes.length > 1
-        ? // Flow w/ multiple attributes.
-          '\n' + indent(attributes.join('\n')) + '\n'
-        : attributes.length // Text or flow w/ a single attribute.
-        ? ' ' + dedentStart(indent(attributes.join(' ')))
-        : '') +
-      (selfClosing ? '/' : '') +
-      '>',
-    close: selfClosing ? '' : ''
-  }
-}
-
-function serializeMdxExpression(node) {
-  const value = node.value || ''
-  return '{' + (node.type === 'mdxFlowExpression' ? indent(value) : value) + '}'
+  ]
 }
 
-function dedentStart(value) {
-  return value.replace(/^ +/, '')
+function createMdxLayout(declaration) {
+  return [
+    {
+      type: 'VariableDeclaration',
+      declarations: [
+        {
+          type: 'VariableDeclarator',
+          id: {type: 'Identifier', name: 'MDXLayout'},
+          init: declaration || {
+            type: 'Literal',
+            value: 'wrapper',
+            raw: '"wrapper"'
+          }
+        }
+      ],
+      kind: 'const'
+    }
+  ]
 }
 
-function indent(value) {
-  const result = []
-  let start = 0
-  let match
-
-  while ((match = eol.exec(value))) {
-    one(value.slice(start, match.index))
-    result.push(match[0])
-    start = match.index + match[0].length
+// Note: this creates a Babel AST, not an estree.
+function createMakeShortcodeHelper(names) {
+  const func = {
+    type: 'VariableDeclaration',
+    declarations: [
+      {
+        type: 'VariableDeclarator',
+        id: {type: 'Identifier', name: 'makeShortcode'},
+        init: {
+          type: 'ArrowFunctionExpression',
+          id: null,
+          expression: true,
+          generator: false,
+          async: false,
+          params: [{type: 'Identifier', name: 'name'}],
+          body: {
+            type: 'ArrowFunctionExpression',
+            id: null,
+            expression: false,
+            generator: false,
+            async: false,
+            params: [{type: 'Identifier', name: 'props'}],
+            body: {
+              type: 'BlockStatement',
+              body: [
+                {
+                  type: 'ExpressionStatement',
+                  expression: {
+                    type: 'CallExpression',
+                    callee: {
+                      type: 'MemberExpression',
+                      object: {type: 'Identifier', name: 'console'},
+                      property: {type: 'Identifier', name: 'warn'},
+                      computed: false,
+                      optional: false
+                    },
+                    arguments: [
+                      {
+                        // Note: Babel!
+                        type: 'StringLiteral',
+                        value:
+                          'Component `%s` was not imported, exported, or provided by MDXProvider as global scope'
+                      },
+                      {type: 'Identifier', name: 'name'}
+                    ]
+                  }
+                },
+                {
+                  type: 'ReturnStatement',
+                  argument: {
+                    type: 'JSXElement',
+                    openingElement: {
+                      type: 'JSXOpeningElement',
+                      attributes: [
+                        {
+                          type: 'JSXSpreadAttribute',
+                          argument: {type: 'Identifier', name: 'props'}
+                        }
+                      ],
+                      name: {type: 'JSXIdentifier', name: 'div'},
+                      selfClosing: true
+                    },
+                    closingElement: null,
+                    children: []
+                  }
+                }
+              ]
+            }
+          }
+        }
+      }
+    ],
+    kind: 'const'
   }
 
-  one(value.slice(start))
-
-  return result.join('')
+  const shortcodes = names.map(name => ({
+    type: 'VariableDeclaration',
+    declarations: [
+      {
+        type: 'VariableDeclarator',
+        id: {type: 'Identifier', name: String(name)},
+        init: {
+          type: 'CallExpression',
+          callee: {type: 'Identifier', name: 'makeShortcode'},
+          // Note: Babel!
+          arguments: [{type: 'StringLiteral', value: String(name)}]
+        }
+      }
+    ],
+    kind: 'const'
+  }))
 
-  function one(slice) {
-    result.push((slice ? '  ' : '') + slice)
-  }
+  return shortcodes.length > 0 ? [func, ...shortcodes] : []
 }
diff --git a/packages/mdx/package.json b/packages/mdx/package.json
index 412bf391a..2aff0bb23 100644
--- a/packages/mdx/package.json
+++ b/packages/mdx/package.json
@@ -42,23 +42,22 @@
     "test": "yarn test-coverage && yarn test-types"
   },
   "dependencies": {
-    "@babel/core": "7.10.5",
-    "@babel/plugin-syntax-jsx": "7.10.4",
-    "@babel/plugin-syntax-object-rest-spread": "7.8.3",
+    "@babel/core": "^7.12.10",
+    "@babel/generator": "^7.12.10",
     "@mdx-js/util": "2.0.0-next.1",
     "babel-plugin-apply-mdx-type-prop": "^2.0.0-next.8",
     "babel-plugin-extract-export-names": "^2.0.0-next.8",
     "babel-plugin-extract-import-names": "^2.0.0-next.8",
     "detab": "2.0.3",
-    "hast-to-hyperscript": "9.0.0",
+    "estree-to-babel": "^3.0.1",
+    "hast-util-to-estree": "^1.1.0",
     "lodash.uniq": "4.5.0",
     "mdast-util-to-hast": "^10.1.0",
-    "recast": "^0.20.4",
+    "rehype-minify-whitespace": "^4.0.0",
     "remark-mdx": "^2.0.0-next.8",
-    "remark-parse": "9.0.0",
-    "remark-squeeze-paragraphs": "4.0.0",
-    "stringify-entities": "^3.1.0",
-    "unified": "9.0.0",
+    "remark-parse": "^9.0.0",
+    "remark-squeeze-paragraphs": "^4.0.0",
+    "unified": "^9.2.0",
     "unist-builder": "2.0.3"
   },
   "devDependencies": {
diff --git a/packages/mdx/test/index.test.js b/packages/mdx/test/index.test.js
index 9eee4c6a4..e6db700d1 100644
--- a/packages/mdx/test/index.test.js
+++ b/packages/mdx/test/index.test.js
@@ -33,7 +33,7 @@ describe('@mdx-js/mdx', () => {
   it('should generate JSX', async () => {
     const result = await mdx('Hello World')
 
-    expect(result).toMatch(/

\{`Hello World`\}<\/p>/) + expect(result).toMatch(/

\{"Hello World"\}<\/p>/) }) it('should generate runnable JSX', async () => { @@ -304,6 +304,32 @@ describe('@mdx-js/mdx', () => { ) }) + it('should support an empty document', async () => { + const Content = await run('') + + expect(renderToStaticMarkup()).toEqual( + renderToStaticMarkup(<>) + ) + }) + + it('should support an ignored node instead of a `root`', async () => { + const plugin = () => () => ({type: 'doctype', name: 'html'}) + const Content = await run('', {rehypePlugins: [plugin]}) + + expect(renderToStaticMarkup()).toEqual( + renderToStaticMarkup(<>) + ) + }) + + it('should support an element instead of a `root`', async () => { + const plugin = () => () => ({type: 'element', tagName: 'x', children: []}) + const Content = await run('', {rehypePlugins: [plugin]}) + + expect(renderToStaticMarkup()).toEqual( + renderToStaticMarkup() + ) + }) + it('should support imports', async () => { expect.assertions(2) @@ -526,7 +552,8 @@ describe('@mdx-js/mdx', () => { ) expect(console.warn).toHaveBeenCalledWith( - 'Component `Y` was not imported, exported, or provided by MDXProvider as global scope' + 'Component `%s` was not imported, exported, or provided by MDXProvider as global scope', + 'Y' ) console.warn = warn @@ -542,7 +569,7 @@ describe('@mdx-js/mdx', () => { ) }) - it('should ignore unknown nodes in mdxhast', async () => { + it('should crash on unknown nodes in mdxhast', async () => { const plugin = () => tree => { // A leaf. tree.children.push({type: 'unknown', value: 'y'}) @@ -554,28 +581,9 @@ describe('@mdx-js/mdx', () => { }) } - const Content = await run('x', {rehypePlugins: [plugin]}) - - expect(renderToStaticMarkup()).toEqual( - renderToStaticMarkup(

x

) - ) - }) - - it('should support `element` nodes w/o `children` in mdxhast', async () => { - const plugin = () => tree => { - tree.children.push({type: 'element', tagName: 'y', properties: {}}) - } - - const Content = await run('x', {rehypePlugins: [plugin]}) - - expect(renderToStaticMarkup()).toEqual( - renderToStaticMarkup( - <> -

x

- - - ) - ) + expect(() => { + mdx.sync('x', {rehypePlugins: [plugin]}) + }).toThrow(/Cannot handle unknown node `unknown`/) }) it('should support `element` nodes w/o `properties` in mdxhast', async () => { @@ -606,7 +614,7 @@ describe('@mdx-js/mdx', () => { expect(resultDefault).toEqual(resultFalse) expect(resultTrue).toMatch(/\nfunction MDXContent/) - expect(resultFalse).toMatch(/export default function MDXContent/) + expect(resultFalse).toMatch(/export default MDXContent/) }) it('should support `wrapExport` to wrap the exported value', async () => { @@ -616,7 +624,7 @@ describe('@mdx-js/mdx', () => { expect(resultDefault).toEqual(resultNull) expect(resultValue).toMatch(/export default y\(MDXContent\)/) - expect(resultNull).toMatch(/export default function MDXContent/) + expect(resultNull).toMatch(/export default MDXContent/) }) it('should expose an `isMDXComponent` field on the component', async () => { @@ -658,24 +666,24 @@ describe('@mdx-js/mdx', () => { describe('default', () => { it('should be async', async () => { - expect(mdx('x')).resolves.toMatch(/

{`x`}<\/p>/) + expect(mdx('x')).resolves.toMatch(/

{"x"}<\/p>/) }) it('should support `remarkPlugins`', async () => { expect(mdx('$x$', {remarkPlugins: [math]})).resolves.toMatch( - /"className": "math math-inline",/ + /className="math math-inline"/ ) }) }) describe('sync', () => { it('should be sync', () => { - expect(mdx.sync('x')).toMatch(/

{`x`}<\/p>/) + expect(mdx.sync('x')).toMatch(/

{"x"}<\/p>/) }) it('should support `remarkPlugins`', () => { expect(mdx.sync('$x$', {remarkPlugins: [math]})).toMatch( - /"className": "math math-inline",/ + /className="math math-inline"/ ) }) }) @@ -719,7 +727,7 @@ describe('createMdxAstCompiler', () => { describe('createCompiler', () => { it('should create a unified processor', () => { expect(String(mdx.createCompiler().processSync('x'))).toMatch( - /

{`x`}<\/p>/ + /

{"x"}<\/p>/ ) }) }) @@ -757,26 +765,13 @@ describe('mdx-hast-to-jsx', () => { const tree = { type: 'root', children: [ - { - type: 'element', - tagName: 'x', - children: [{type: 'mdxTextExpression', value: '1 + 1'}] - } + {type: 'element', tagName: 'x', children: [{type: 'text', value: 'a'}]} ] } const doc = unified().use(toJsx).stringify(tree) - expect(doc).toMatch(/export default function MDXContent/) - expect(doc).toMatch(/\{1 \+ 1}<\/x>/) - }) -}) - -describe('mdx-hast-to-jsx.toJSX', () => { - it('should be a function that serializes mdxhast nodes', () => { - expect(toJsx.toJSX({type: 'element', tagName: 'x'})).toEqual('') - expect(toJsx.toJSX({type: 'mdxTextExpression', value: '1 + 1'})).toEqual( - '{1 + 1}' - ) + expect(doc).toMatch(/export default MDXContent/) + expect(doc).toMatch(/\{"a"}<\/x>/) }) }) diff --git a/packages/preact/test/test.js b/packages/preact/test/test.js index 16d9d238d..c290851a8 100644 --- a/packages/preact/test/test.js +++ b/packages/preact/test/test.js @@ -58,7 +58,8 @@ describe('@mdx-js/preact', () => { expect(render()).toEqual('

') expect(console.warn).toHaveBeenCalledWith( - 'Component `Component` was not imported, exported, or provided by MDXProvider as global scope' + 'Component `%s` was not imported, exported, or provided by MDXProvider as global scope', + 'Component' ) console.warn = warn diff --git a/packages/react/test/test.js b/packages/react/test/test.js index 8d3688895..4cc9b01db 100644 --- a/packages/react/test/test.js +++ b/packages/react/test/test.js @@ -58,7 +58,8 @@ describe('@mdx-js/react', () => { expect(renderToString()).toEqual('
') expect(console.warn).toHaveBeenCalledWith( - 'Component `Component` was not imported, exported, or provided by MDXProvider as global scope' + 'Component `%s` was not imported, exported, or provided by MDXProvider as global scope', + 'Component' ) console.warn = warn diff --git a/packages/remark-mdx/package.json b/packages/remark-mdx/package.json index 0656cb681..15cca4360 100644 --- a/packages/remark-mdx/package.json +++ b/packages/remark-mdx/package.json @@ -40,8 +40,8 @@ }, "dependencies": { "mdast-util-mdx": "^0.1.1", - "micromark-extension-mdx": "^0.1.0", - "micromark-extension-mdxjs": "^0.1.0" + "micromark-extension-mdx": "^0.2.0", + "micromark-extension-mdxjs": "^0.3.0" }, "devDependencies": { "nyc": "^15.1.0", diff --git a/packages/remark-mdx/test/fixtures/block-parsing.json b/packages/remark-mdx/test/fixtures/block-parsing.json index 08814f41a..4c52dbc49 100644 --- a/packages/remark-mdx/test/fixtures/block-parsing.json +++ b/packages/remark-mdx/test/fixtures/block-parsing.json @@ -888,41 +888,91 @@ "value": "`\nHere is a template literal\n\nwith an empty line\n`", "data": { "estree": { - "type": "TemplateLiteral", - "start": 0, - "end": 52, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "expressions": [], - "quasis": [ + "type": "Program", + "start": 526, + "end": 578, + "body": [ { - "type": "TemplateElement", - "start": 1, - "end": 51, + "type": "ExpressionStatement", + "expression": { + "type": "TemplateLiteral", + "start": 526, + "end": 578, + "loc": { + "start": { + "line": 31, + "column": 9 + }, + "end": { + "line": 31, + "column": 61 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 527, + "end": 577, + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 60 + } + }, + "value": { + "raw": "\nHere is a template literal\n\nwith an empty line\n ", + "cooked": "\nHere is a template literal\n\nwith an empty line\n " + }, + "tail": true, + "range": [ + 527, + 577 + ] + } + ], + "range": [ + 526, + 578 + ] + }, + "start": 526, + "end": 578, "loc": { "start": { - "line": 1, - "column": 1 + "line": 31, + "column": 9 }, "end": { - "line": 5, - "column": 2 + "line": 31, + "column": 61 } }, - "value": { - "raw": "\nHere is a template literal\n\nwith an empty line\n ", - "cooked": "\nHere is a template literal\n\nwith an empty line\n " - }, - "tail": true + "range": [ + 526, + 578 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 31, + "column": 9 + }, + "end": { + "line": 31, + "column": 61 } + }, + "range": [ + 526, + 578 ] } } @@ -985,53 +1035,107 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 10, + "type": "Program", + "start": 596, + "end": 606, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 596, + "end": 606, + "object": { + "type": "Identifier", + "start": 596, + "end": 601, + "name": "props", + "loc": { + "start": { + "line": 38, + "column": 12 + }, + "end": { + "line": 38, + "column": 17 + } + }, + "range": [ + 596, + 601 + ] + }, + "property": { + "type": "Identifier", + "start": 602, + "end": 606, + "name": "name", + "loc": { + "start": { + "line": 38, + "column": 18 + }, + "end": { + "line": 38, + "column": 22 + } + }, + "range": [ + 602, + 606 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 38, + "column": 12 + }, + "end": { + "line": 38, + "column": 22 + } + }, + "range": [ + 596, + 606 + ] + }, + "start": 596, + "end": 606, + "loc": { + "start": { + "line": 38, + "column": 12 + }, + "end": { + "line": 38, + "column": 22 + } + }, + "range": [ + 596, + 606 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 38, + "column": 12 }, "end": { - "line": 1, - "column": 10 + "line": 38, + "column": 22 } }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "name" - }, - "computed": false, - "optional": false + "range": [ + 596, + 606 + ] } } } @@ -1152,149 +1256,227 @@ }, "data": { "estree": { - "type": "JSXElement", - "start": 5, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "attributes": [], - "name": { - "type": "JSXIdentifier", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "h2" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "name": "h2" - } - }, - "children": [ + "type": "Program", + "start": 648, + "end": 670, + "body": [ { - "type": "JSXExpressionContainer", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 13 - } - }, + "type": "ExpressionStatement", "expression": { - "type": "BinaryExpression", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 2, - "column": 9 + "type": "JSXElement", + "start": 653, + "end": 667, + "openingElement": { + "type": "JSXOpeningElement", + "start": 653, + "end": 657, + "attributes": [], + "name": { + "type": "JSXIdentifier", + "start": 654, + "end": 656, + "name": "h2", + "loc": { + "start": { + "line": 45, + "column": 9 + }, + "end": { + "line": 45, + "column": 11 + } + }, + "range": [ + 654, + 656 + ] }, - "end": { - "line": 2, - "column": 12 - } - }, - "left": { - "type": "Literal", - "start": 10, - "end": 11, + "selfClosing": false, "loc": { "start": { - "line": 2, - "column": 9 + "line": 45, + "column": 8 }, "end": { - "line": 2, - "column": 10 + "line": 45, + "column": 12 } }, - "value": 1, - "raw": "1" + "range": [ + 653, + 657 + ] }, - "operator": "+", - "right": { - "type": "Literal", - "start": 12, - "end": 13, + "closingElement": { + "type": "JSXClosingElement", + "start": 662, + "end": 667, + "name": { + "type": "JSXIdentifier", + "start": 664, + "end": 666, + "name": "h2", + "loc": { + "start": { + "line": 45, + "column": 19 + }, + "end": { + "line": 45, + "column": 21 + } + }, + "range": [ + 664, + 666 + ] + }, "loc": { "start": { - "line": 2, - "column": 11 + "line": 45, + "column": 17 }, "end": { - "line": 2, - "column": 12 + "line": 45, + "column": 22 } }, - "value": 1, - "raw": "1" + "range": [ + 662, + 667 + ] + }, + "children": [ + { + "type": "JSXExpressionContainer", + "start": 657, + "end": 662, + "expression": { + "type": "BinaryExpression", + "start": 658, + "end": 661, + "left": { + "type": "Literal", + "start": 658, + "end": 659, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 45, + "column": 13 + }, + "end": { + "line": 45, + "column": 14 + } + }, + "range": [ + 658, + 659 + ] + }, + "operator": "+", + "right": { + "type": "Literal", + "start": 660, + "end": 661, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 45, + "column": 15 + }, + "end": { + "line": 45, + "column": 16 + } + }, + "range": [ + 660, + 661 + ] + }, + "loc": { + "start": { + "line": 45, + "column": 13 + }, + "end": { + "line": 45, + "column": 16 + } + }, + "range": [ + 658, + 661 + ] + }, + "loc": { + "start": { + "line": 45, + "column": 12 + }, + "end": { + "line": 45, + "column": 17 + } + }, + "range": [ + 657, + 662 + ] + } + ], + "loc": { + "start": { + "line": 45, + "column": 8 + }, + "end": { + "line": 45, + "column": 22 + } + }, + "range": [ + 653, + 667 + ] + }, + "start": 648, + "end": 670, + "loc": { + "start": { + "line": 45, + "column": 3 + }, + "end": { + "line": 45, + "column": 25 } - } + }, + "range": [ + 648, + 670 + ] } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 45, + "column": 3 + }, + "end": { + "line": 45, + "column": 25 + } + }, + "range": [ + 648, + 670 ] } } diff --git a/packages/remark-mdx/test/fixtures/character-reference.json b/packages/remark-mdx/test/fixtures/character-reference.json index c312bfac5..ff0fbf608 100644 --- a/packages/remark-mdx/test/fixtures/character-reference.json +++ b/packages/remark-mdx/test/fixtures/character-reference.json @@ -278,6 +278,51 @@ "column": 49, "offset": 224 } + }, + "data": { + "estree": { + "type": "Program", + "start": 177, + "end": 223, + "body": [], + "sourceType": "module", + "comments": [ + { + "type": "Block", + "value": " starts an expression, it must be closed: ", + "start": 177, + "end": 223, + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 47 + } + }, + "range": [ + 177, + 223 + ] + } + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 47 + } + }, + "range": [ + 177, + 223 + ] + } } }, { diff --git a/packages/remark-mdx/test/fixtures/examples-from-jsx.json b/packages/remark-mdx/test/fixtures/examples-from-jsx.json index 9fcc35e0d..f653cd554 100644 --- a/packages/remark-mdx/test/fixtures/examples-from-jsx.json +++ b/packages/remark-mdx/test/fixtures/examples-from-jsx.json @@ -366,391 +366,529 @@ }, "data": { "estree": { - "type": "ConditionalExpression", - "start": 5, - "end": 126, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 6, - "column": 18 - } - }, - "test": { - "type": "CallExpression", - "start": 5, - "end": 27, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 5, - "end": 21, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "name": "shouldShowAnswer" - }, - "arguments": [ - { - "type": "Identifier", - "start": 22, - "end": 26, - "loc": { - "start": { - "line": 2, - "column": 21 + "type": "Program", + "start": 261, + "end": 390, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ConditionalExpression", + "start": 266, + "end": 387, + "test": { + "type": "CallExpression", + "start": 266, + "end": 288, + "callee": { + "type": "Identifier", + "start": 266, + "end": 282, + "name": "shouldShowAnswer", + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 24 + } + }, + "range": [ + 266, + 282 + ] }, - "end": { - "line": 2, - "column": 25 - } - }, - "name": "user" - } - ], - "optional": false - }, - "consequent": { - "type": "JSXElement", - "start": 34, - "end": 67, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 37 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 34, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 26 - } - }, - "attributes": [ - { - "type": "JSXAttribute", - "start": 42, - "end": 55, + "arguments": [ + { + "type": "Identifier", + "start": 283, + "end": 287, + "name": "user", + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 29 + } + }, + "range": [ + 283, + 287 + ] + } + ], + "optional": false, "loc": { "start": { - "line": 3, - "column": 12 + "line": 15, + "column": 8 }, "end": { - "line": 3, - "column": 25 + "line": 15, + "column": 30 } }, - "name": { - "type": "JSXIdentifier", - "start": 42, - "end": 47, + "range": [ + 266, + 288 + ] + }, + "consequent": { + "type": "JSXElement", + "start": 295, + "end": 328, + "openingElement": { + "type": "JSXOpeningElement", + "start": 295, + "end": 317, + "attributes": [ + { + "type": "JSXAttribute", + "start": 303, + "end": 316, + "name": { + "type": "JSXIdentifier", + "start": 303, + "end": 308, + "name": "value", + "loc": { + "start": { + "line": 15, + "column": 45 + }, + "end": { + "line": 15, + "column": 50 + } + }, + "range": [ + 303, + 308 + ] + }, + "value": { + "type": "JSXExpressionContainer", + "start": 309, + "end": 316, + "expression": { + "type": "Literal", + "start": 310, + "end": 315, + "value": false, + "raw": "false", + "loc": { + "start": { + "line": 15, + "column": 52 + }, + "end": { + "line": 15, + "column": 57 + } + }, + "range": [ + 310, + 315 + ] + }, + "loc": { + "start": { + "line": 15, + "column": 51 + }, + "end": { + "line": 15, + "column": 58 + } + }, + "range": [ + 309, + 316 + ] + }, + "loc": { + "start": { + "line": 15, + "column": 45 + }, + "end": { + "line": 15, + "column": 58 + } + }, + "range": [ + 303, + 316 + ] + } + ], + "name": { + "type": "JSXIdentifier", + "start": 296, + "end": 302, + "name": "Answer", + "loc": { + "start": { + "line": 15, + "column": 38 + }, + "end": { + "line": 15, + "column": 44 + } + }, + "range": [ + 296, + 302 + ] + }, + "selfClosing": false, "loc": { "start": { - "line": 3, - "column": 12 + "line": 15, + "column": 37 }, "end": { - "line": 3, - "column": 17 + "line": 15, + "column": 59 } }, - "name": "value" + "range": [ + 295, + 317 + ] }, - "value": { - "type": "JSXExpressionContainer", - "start": 48, - "end": 55, + "closingElement": { + "type": "JSXClosingElement", + "start": 319, + "end": 328, + "name": { + "type": "JSXIdentifier", + "start": 321, + "end": 327, + "name": "Answer", + "loc": { + "start": { + "line": 15, + "column": 63 + }, + "end": { + "line": 15, + "column": 69 + } + }, + "range": [ + 321, + 327 + ] + }, "loc": { "start": { - "line": 3, - "column": 18 + "line": 15, + "column": 61 }, "end": { - "line": 3, - "column": 25 + "line": 15, + "column": 70 } }, - "expression": { - "type": "Literal", - "start": 49, - "end": 54, + "range": [ + 319, + 328 + ] + }, + "children": [ + { + "type": "JSXText", + "start": 317, + "end": 319, + "value": "no", + "raw": "no", "loc": { "start": { - "line": 3, - "column": 19 + "line": 15, + "column": 59 }, "end": { - "line": 3, - "column": 24 + "line": 15, + "column": 61 } }, - "value": false, - "raw": "false" + "range": [ + 317, + 319 + ] } - } - } - ], - "name": { - "type": "JSXIdentifier", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "name": "Answer" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 58, - "end": 67, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 37 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 60, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 36 - } - }, - "name": "Answer" - } - }, - "children": [ - { - "type": "JSXText", - "start": 56, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "value": "no", - "raw": "no" - } - ] - }, - "alternate": { - "type": "JSXElement", - "start": 74, - "end": 126, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 6, - "column": 18 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 74, - "end": 87, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 17 - } - }, - "attributes": [], - "name": { - "type": "JSXMemberExpression", - "start": 75, - "end": 86, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 16 - } - }, - "object": { - "type": "JSXIdentifier", - "start": 75, - "end": 78, + ], "loc": { "start": { - "line": 4, - "column": 5 + "line": 15, + "column": 37 }, "end": { - "line": 4, - "column": 8 + "line": 15, + "column": 70 } }, - "name": "Box" + "range": [ + 295, + 328 + ] }, - "property": { - "type": "JSXIdentifier", - "start": 79, - "end": 86, - "loc": { - "start": { - "line": 4, - "column": 9 + "alternate": { + "type": "JSXElement", + "start": 335, + "end": 387, + "openingElement": { + "type": "JSXOpeningElement", + "start": 335, + "end": 348, + "attributes": [], + "name": { + "type": "JSXMemberExpression", + "start": 336, + "end": 347, + "object": { + "type": "JSXIdentifier", + "start": 336, + "end": 339, + "name": "Box", + "loc": { + "start": { + "line": 15, + "column": 78 + }, + "end": { + "line": 15, + "column": 81 + } + }, + "range": [ + 336, + 339 + ] + }, + "property": { + "type": "JSXIdentifier", + "start": 340, + "end": 347, + "name": "Comment", + "loc": { + "start": { + "line": 15, + "column": 82 + }, + "end": { + "line": 15, + "column": 89 + } + }, + "range": [ + 340, + 347 + ] + }, + "loc": { + "start": { + "line": 15, + "column": 78 + }, + "end": { + "line": 15, + "column": 89 + } + }, + "range": [ + 336, + 347 + ] }, - "end": { - "line": 4, - "column": 16 - } - }, - "name": "Comment" - } - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 112, - "end": 126, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 18 - } - }, - "name": { - "type": "JSXMemberExpression", - "start": 114, - "end": 125, - "loc": { - "start": { - "line": 6, - "column": 6 + "selfClosing": false, + "loc": { + "start": { + "line": 15, + "column": 77 + }, + "end": { + "line": 15, + "column": 90 + } + }, + "range": [ + 335, + 348 + ] }, - "end": { - "line": 6, - "column": 17 - } - }, - "object": { - "type": "JSXIdentifier", - "start": 114, - "end": 117, - "loc": { - "start": { - "line": 6, - "column": 6 + "closingElement": { + "type": "JSXClosingElement", + "start": 373, + "end": 387, + "name": { + "type": "JSXMemberExpression", + "start": 375, + "end": 386, + "object": { + "type": "JSXIdentifier", + "start": 375, + "end": 378, + "name": "Box", + "loc": { + "start": { + "line": 15, + "column": 117 + }, + "end": { + "line": 15, + "column": 120 + } + }, + "range": [ + 375, + 378 + ] + }, + "property": { + "type": "JSXIdentifier", + "start": 379, + "end": 386, + "name": "Comment", + "loc": { + "start": { + "line": 15, + "column": 121 + }, + "end": { + "line": 15, + "column": 128 + } + }, + "range": [ + 379, + 386 + ] + }, + "loc": { + "start": { + "line": 15, + "column": 117 + }, + "end": { + "line": 15, + "column": 128 + } + }, + "range": [ + 375, + 386 + ] }, - "end": { - "line": 6, - "column": 9 - } + "loc": { + "start": { + "line": 15, + "column": 115 + }, + "end": { + "line": 15, + "column": 129 + } + }, + "range": [ + 373, + 387 + ] }, - "name": "Box" - }, - "property": { - "type": "JSXIdentifier", - "start": 118, - "end": 125, + "children": [ + { + "type": "JSXText", + "start": 348, + "end": 373, + "value": "\n Text Content\n ", + "raw": "\n Text Content\n ", + "loc": { + "start": { + "line": 15, + "column": 90 + }, + "end": { + "line": 15, + "column": 115 + } + }, + "range": [ + 348, + 373 + ] + } + ], "loc": { "start": { - "line": 6, - "column": 10 + "line": 15, + "column": 77 }, "end": { - "line": 6, - "column": 17 + "line": 15, + "column": 129 } }, - "name": "Comment" - } - } - }, - "children": [ - { - "type": "JSXText", - "start": 87, - "end": 112, + "range": [ + 335, + 387 + ] + }, "loc": { "start": { - "line": 4, - "column": 17 + "line": 15, + "column": 8 }, "end": { - "line": 6, - "column": 4 + "line": 15, + "column": 129 } }, - "value": "\n Text Content\n ", - "raw": "\n Text Content\n " - } - ] - } + "range": [ + 266, + 387 + ] + }, + "start": 261, + "end": 390, + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 132 + } + }, + "range": [ + 261, + 390 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 132 + } + }, + "range": [ + 261, + 390 + ] } } } diff --git a/packages/remark-mdx/test/fixtures/examples-from-react-accessibility.json b/packages/remark-mdx/test/fixtures/examples-from-react-accessibility.json index f3b81c55e..ad1a98d4d 100644 --- a/packages/remark-mdx/test/fixtures/examples-from-react-accessibility.json +++ b/packages/remark-mdx/test/fixtures/examples-from-react-accessibility.json @@ -136,20 +136,66 @@ "value": "labelText", "data": { "estree": { - "type": "Identifier", - "start": 0, - "end": 9, + "type": "Program", + "start": 146, + "end": 155, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "start": 146, + "end": 155, + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 23 + } + }, + "name": "labelText", + "range": [ + 146, + 155 + ] + }, + "start": 146, + "end": 155, + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 23 + } + }, + "range": [ + 146, + 155 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 7, + "column": 14 }, "end": { - "line": 1, - "column": 9 + "line": 7, + "column": 23 } }, - "name": "labelText" + "range": [ + 146, + 155 + ] } } } @@ -167,20 +213,66 @@ "value": "onchangeHandler", "data": { "estree": { - "type": "Identifier", - "start": 0, - "end": 15, + "type": "Program", + "start": 192, + "end": 207, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "start": 192, + "end": 207, + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 27 + } + }, + "name": "onchangeHandler", + "range": [ + 192, + 207 + ] + }, + "start": 192, + "end": 207, + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 27 + } + }, + "range": [ + 192, + 207 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 9, + "column": 12 }, "end": { - "line": 1, - "column": 15 + "line": 9, + "column": 27 } }, - "name": "onchangeHandler" + "range": [ + 192, + 207 + ] } } } @@ -193,20 +285,66 @@ "value": "inputValue", "data": { "estree": { - "type": "Identifier", - "start": 0, - "end": 10, + "type": "Program", + "start": 218, + "end": 228, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "start": 218, + "end": 228, + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 19 + } + }, + "name": "inputValue", + "range": [ + 218, + 228 + ] + }, + "start": 218, + "end": 228, + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 19 + } + }, + "range": [ + 218, + 228 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 10, + "column": 9 }, "end": { - "line": 1, - "column": 10 + "line": 10, + "column": 19 } }, - "name": "inputValue" + "range": [ + 218, + 228 + ] } } } @@ -261,53 +399,107 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 9, + "type": "Program", + "start": 258, + "end": 267, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 258, + "end": 267, + "object": { + "type": "Identifier", + "start": 258, + "end": 262, + "name": "item", + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 11 + } + }, + "range": [ + 258, + 262 + ] + }, + "property": { + "type": "Identifier", + "start": 263, + "end": 267, + "name": "term", + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 16 + } + }, + "range": [ + 263, + 267 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 16 + } + }, + "range": [ + 258, + 267 + ] + }, + "start": 258, + "end": 267, + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 16 + } + }, + "range": [ + 258, + 267 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 15, + "column": 7 }, "end": { - "line": 1, - "column": 9 + "line": 15, + "column": 16 } }, - "object": { - "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "item" - }, - "property": { - "type": "Identifier", - "start": 5, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "term" - }, - "computed": false, - "optional": false + "range": [ + 258, + 267 + ] } } } @@ -363,53 +555,107 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 16, + "type": "Program", + "start": 281, + "end": 297, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 281, + "end": 297, + "object": { + "type": "Identifier", + "start": 281, + "end": 285, + "name": "item", + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 11 + } + }, + "range": [ + 281, + 285 + ] + }, + "property": { + "type": "Identifier", + "start": 286, + "end": 297, + "name": "description", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 286, + 297 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 281, + 297 + ] + }, + "start": 281, + "end": 297, + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 281, + 297 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 16, + "column": 7 }, "end": { - "line": 1, - "column": 16 + "line": 16, + "column": 23 } }, - "object": { - "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "item" - }, - "property": { - "type": "Identifier", - "start": 5, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "name": "description" - }, - "computed": false, - "optional": false + "range": [ + 281, + 297 + ] } } } @@ -477,349 +723,475 @@ }, "data": { "estree": { - "type": "CallExpression", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 4 - } - }, - "callee": { - "type": "MemberExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "object": { - "type": "MemberExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "items" - }, - "computed": false, - "optional": false - }, - "property": { - "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "name": "map" - }, - "computed": false, - "optional": false - }, - "arguments": [ + "type": "Program", + "start": 317, + "end": 390, + "body": [ { - "type": "ArrowFunctionExpression", - "start": 16, - "end": 72, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 3 - } - }, - "id": null, - "expression": true, - "generator": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "name": "item" - } - ], - "body": { - "type": "JSXElement", - "start": 30, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 42 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 30, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 42 - } - }, - "attributes": [ - { - "type": "JSXAttribute", - "start": 40, - "end": 51, + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "start": 317, + "end": 390, + "callee": { + "type": "MemberExpression", + "start": 317, + "end": 332, + "object": { + "type": "MemberExpression", + "start": 317, + "end": 328, + "object": { + "type": "Identifier", + "start": 317, + "end": 322, + "name": "props", "loc": { "start": { - "line": 2, - "column": 14 + "line": 20, + "column": 3 }, "end": { - "line": 2, - "column": 25 + "line": 20, + "column": 8 } }, - "name": { - "type": "JSXIdentifier", - "start": 40, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "name": "item" - }, - "value": { - "type": "JSXExpressionContainer", - "start": 45, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "expression": { - "type": "Identifier", - "start": 46, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "name": "item" - } - } + "range": [ + 317, + 322 + ] }, - { - "type": "JSXAttribute", - "start": 52, - "end": 65, + "property": { + "type": "Identifier", + "start": 323, + "end": 328, + "name": "items", "loc": { "start": { - "line": 2, - "column": 26 + "line": 20, + "column": 9 }, "end": { - "line": 2, - "column": 39 + "line": 20, + "column": 14 } }, - "name": { - "type": "JSXIdentifier", - "start": 52, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 29 - } - }, - "name": "key" + "range": [ + 323, + 328 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 14 + } + }, + "range": [ + 317, + 328 + ] + }, + "property": { + "type": "Identifier", + "start": 329, + "end": 332, + "name": "map", + "loc": { + "start": { + "line": 20, + "column": 15 }, - "value": { - "type": "JSXExpressionContainer", - "start": 56, - "end": 65, + "end": { + "line": 20, + "column": 18 + } + }, + "range": [ + 329, + 332 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 18 + } + }, + "range": [ + 317, + 332 + ] + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "start": 333, + "end": 389, + "id": null, + "expression": true, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 333, + "end": 337, + "name": "item", "loc": { "start": { - "line": 2, - "column": 30 + "line": 20, + "column": 19 }, "end": { - "line": 2, - "column": 39 + "line": 20, + "column": 23 } }, - "expression": { - "type": "MemberExpression", - "start": 57, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 31 + "range": [ + 333, + 337 + ] + } + ], + "body": { + "type": "JSXElement", + "start": 347, + "end": 385, + "openingElement": { + "type": "JSXOpeningElement", + "start": 347, + "end": 385, + "attributes": [ + { + "type": "JSXAttribute", + "start": 357, + "end": 368, + "name": { + "type": "JSXIdentifier", + "start": 357, + "end": 361, + "name": "item", + "loc": { + "start": { + "line": 20, + "column": 43 + }, + "end": { + "line": 20, + "column": 47 + } + }, + "range": [ + 357, + 361 + ] + }, + "value": { + "type": "JSXExpressionContainer", + "start": 362, + "end": 368, + "expression": { + "type": "Identifier", + "start": 363, + "end": 367, + "name": "item", + "loc": { + "start": { + "line": 20, + "column": 49 + }, + "end": { + "line": 20, + "column": 53 + } + }, + "range": [ + 363, + 367 + ] + }, + "loc": { + "start": { + "line": 20, + "column": 48 + }, + "end": { + "line": 20, + "column": 54 + } + }, + "range": [ + 362, + 368 + ] }, - "end": { - "line": 2, - "column": 38 - } - }, - "object": { - "type": "Identifier", - "start": 57, - "end": 61, "loc": { "start": { - "line": 2, - "column": 31 + "line": 20, + "column": 43 }, "end": { - "line": 2, - "column": 35 + "line": 20, + "column": 54 } }, - "name": "item" + "range": [ + 357, + 368 + ] }, - "property": { - "type": "Identifier", - "start": 62, - "end": 64, + { + "type": "JSXAttribute", + "start": 369, + "end": 382, + "name": { + "type": "JSXIdentifier", + "start": 369, + "end": 372, + "name": "key", + "loc": { + "start": { + "line": 20, + "column": 55 + }, + "end": { + "line": 20, + "column": 58 + } + }, + "range": [ + 369, + 372 + ] + }, + "value": { + "type": "JSXExpressionContainer", + "start": 373, + "end": 382, + "expression": { + "type": "MemberExpression", + "start": 374, + "end": 381, + "object": { + "type": "Identifier", + "start": 374, + "end": 378, + "name": "item", + "loc": { + "start": { + "line": 20, + "column": 60 + }, + "end": { + "line": 20, + "column": 64 + } + }, + "range": [ + 374, + 378 + ] + }, + "property": { + "type": "Identifier", + "start": 379, + "end": 381, + "name": "id", + "loc": { + "start": { + "line": 20, + "column": 65 + }, + "end": { + "line": 20, + "column": 67 + } + }, + "range": [ + 379, + 381 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 20, + "column": 60 + }, + "end": { + "line": 20, + "column": 67 + } + }, + "range": [ + 374, + 381 + ] + }, + "loc": { + "start": { + "line": 20, + "column": 59 + }, + "end": { + "line": 20, + "column": 68 + } + }, + "range": [ + 373, + 382 + ] + }, "loc": { "start": { - "line": 2, - "column": 36 + "line": 20, + "column": 55 }, "end": { - "line": 2, - "column": 38 + "line": 20, + "column": 68 } }, - "name": "id" + "range": [ + 369, + 382 + ] + } + ], + "name": { + "type": "JSXIdentifier", + "start": 348, + "end": 356, + "name": "ListItem", + "loc": { + "start": { + "line": 20, + "column": 34 + }, + "end": { + "line": 20, + "column": 42 + } }, - "computed": false, - "optional": false + "range": [ + 348, + 356 + ] + }, + "selfClosing": true, + "loc": { + "start": { + "line": 20, + "column": 33 + }, + "end": { + "line": 20, + "column": 71 + } + }, + "range": [ + 347, + 385 + ] + }, + "closingElement": null, + "children": [], + "loc": { + "start": { + "line": 20, + "column": 33 + }, + "end": { + "line": 20, + "column": 71 } - } - } - ], - "name": { - "type": "JSXIdentifier", - "start": 31, - "end": 39, + }, + "range": [ + 347, + 385 + ] + }, "loc": { "start": { - "line": 2, - "column": 5 + "line": 20, + "column": 19 }, "end": { - "line": 2, - "column": 13 + "line": 20, + "column": 75 } }, - "name": "ListItem" + "range": [ + 333, + 389 + ] + } + ], + "optional": false, + "loc": { + "start": { + "line": 20, + "column": 3 }, - "selfClosing": true + "end": { + "line": 20, + "column": 76 + } }, - "closingElement": null, - "children": [] - } + "range": [ + 317, + 390 + ] + }, + "start": 317, + "end": 390, + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 76 + } + }, + "range": [ + 317, + 390 + ] } ], - "optional": false + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 76 + } + }, + "range": [ + 317, + 390 + ] } } } @@ -859,669 +1231,892 @@ }, "data": { "estree": { - "type": "CallExpression", - "start": 0, - "end": 208, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 4 - } - }, - "callee": { - "type": "MemberExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "object": { - "type": "MemberExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "items" - }, - "computed": false, - "optional": false - }, - "property": { - "type": "Identifier", - "start": 12, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "name": "map" - }, - "computed": false, - "optional": false - }, - "arguments": [ + "type": "Program", + "start": 407, + "end": 615, + "body": [ { - "type": "ArrowFunctionExpression", - "start": 16, - "end": 207, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 7, - "column": 3 - } - }, - "id": null, - "expression": true, - "generator": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "start": 407, + "end": 615, + "callee": { + "type": "MemberExpression", + "start": 407, + "end": 422, + "object": { + "type": "MemberExpression", + "start": 407, + "end": 418, + "object": { + "type": "Identifier", + "start": 407, + "end": 412, + "name": "props", + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 8 + } + }, + "range": [ + 407, + 412 + ] }, - "end": { - "line": 1, - "column": 20 - } + "property": { + "type": "Identifier", + "start": 413, + "end": 418, + "name": "items", + "loc": { + "start": { + "line": 26, + "column": 9 + }, + "end": { + "line": 26, + "column": 14 + } + }, + "range": [ + 413, + 418 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 14 + } + }, + "range": [ + 407, + 418 + ] }, - "name": "item" - } - ], - "body": { - "type": "JSXElement", - "start": 102, - "end": 203, - "loc": { - "start": { - "line": 3, - "column": 4 + "property": { + "type": "Identifier", + "start": 419, + "end": 422, + "name": "map", + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 18 + } + }, + "range": [ + 419, + 422 + ] }, - "end": { - "line": 6, - "column": 15 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 102, - "end": 126, + "computed": false, + "optional": false, "loc": { "start": { - "line": 3, - "column": 4 + "line": 26, + "column": 3 }, "end": { - "line": 3, - "column": 28 + "line": 26, + "column": 18 } }, - "attributes": [ - { - "type": "JSXAttribute", - "start": 112, - "end": 125, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 27 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 112, - "end": 115, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 17 - } - }, - "name": "key" - }, - "value": { - "type": "JSXExpressionContainer", - "start": 116, - "end": 125, + "range": [ + 407, + 422 + ] + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "start": 423, + "end": 614, + "id": null, + "expression": true, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 423, + "end": 427, + "name": "item", "loc": { "start": { - "line": 3, - "column": 18 + "line": 26, + "column": 19 }, "end": { - "line": 3, - "column": 27 + "line": 26, + "column": 23 } }, - "expression": { - "type": "MemberExpression", - "start": 117, - "end": 124, - "loc": { - "start": { - "line": 3, - "column": 19 + "range": [ + 423, + 427 + ] + } + ], + "body": { + "type": "JSXElement", + "start": 509, + "end": 610, + "openingElement": { + "type": "JSXOpeningElement", + "start": 509, + "end": 533, + "attributes": [ + { + "type": "JSXAttribute", + "start": 519, + "end": 532, + "name": { + "type": "JSXIdentifier", + "start": 519, + "end": 522, + "name": "key", + "loc": { + "start": { + "line": 26, + "column": 115 + }, + "end": { + "line": 26, + "column": 118 + } + }, + "range": [ + 519, + 522 + ] }, - "end": { - "line": 3, - "column": 26 - } - }, - "object": { - "type": "Identifier", - "start": 117, - "end": 121, - "loc": { - "start": { - "line": 3, - "column": 19 + "value": { + "type": "JSXExpressionContainer", + "start": 523, + "end": 532, + "expression": { + "type": "MemberExpression", + "start": 524, + "end": 531, + "object": { + "type": "Identifier", + "start": 524, + "end": 528, + "name": "item", + "loc": { + "start": { + "line": 26, + "column": 120 + }, + "end": { + "line": 26, + "column": 124 + } + }, + "range": [ + 524, + 528 + ] + }, + "property": { + "type": "Identifier", + "start": 529, + "end": 531, + "name": "id", + "loc": { + "start": { + "line": 26, + "column": 125 + }, + "end": { + "line": 26, + "column": 127 + } + }, + "range": [ + 529, + 531 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 26, + "column": 120 + }, + "end": { + "line": 26, + "column": 127 + } + }, + "range": [ + 524, + 531 + ] }, - "end": { - "line": 3, - "column": 23 - } + "loc": { + "start": { + "line": 26, + "column": 119 + }, + "end": { + "line": 26, + "column": 128 + } + }, + "range": [ + 523, + 532 + ] }, - "name": "item" - }, - "property": { - "type": "Identifier", - "start": 122, - "end": 124, "loc": { "start": { - "line": 3, - "column": 24 + "line": 26, + "column": 115 }, "end": { - "line": 3, - "column": 26 + "line": 26, + "column": 128 } }, - "name": "id" + "range": [ + 519, + 532 + ] + } + ], + "name": { + "type": "JSXIdentifier", + "start": 510, + "end": 518, + "name": "Fragment", + "loc": { + "start": { + "line": 26, + "column": 106 + }, + "end": { + "line": 26, + "column": 114 + } }, - "computed": false, - "optional": false - } - } - } - ], - "name": { - "type": "JSXIdentifier", - "start": 103, - "end": 111, - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "name": "Fragment" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 192, - "end": 203, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 15 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 194, - "end": 202, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 14 - } - }, - "name": "Fragment" - } - }, - "children": [ - { - "type": "JSXText", - "start": 126, - "end": 133, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 4, - "column": 6 - } - }, - "value": "\n ", - "raw": "\n " - }, - { - "type": "JSXElement", - "start": 133, - "end": 153, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 26 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 133, - "end": 137, - "loc": { - "start": { - "line": 4, - "column": 6 + "range": [ + 510, + 518 + ] }, - "end": { - "line": 4, - "column": 10 - } - }, - "attributes": [], - "name": { - "type": "JSXIdentifier", - "start": 134, - "end": 136, + "selfClosing": false, "loc": { "start": { - "line": 4, - "column": 7 + "line": 26, + "column": 105 }, "end": { - "line": 4, - "column": 9 + "line": 26, + "column": 129 } }, - "name": "dt" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 148, - "end": 153, - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 26 - } + "range": [ + 509, + 533 + ] }, - "name": { - "type": "JSXIdentifier", - "start": 150, - "end": 152, - "loc": { - "start": { - "line": 4, - "column": 23 + "closingElement": { + "type": "JSXClosingElement", + "start": 599, + "end": 610, + "name": { + "type": "JSXIdentifier", + "start": 601, + "end": 609, + "name": "Fragment", + "loc": { + "start": { + "line": 26, + "column": 197 + }, + "end": { + "line": 26, + "column": 205 + } }, - "end": { - "line": 4, - "column": 25 - } + "range": [ + 601, + 609 + ] }, - "name": "dt" - } - }, - "children": [ - { - "type": "JSXExpressionContainer", - "start": 137, - "end": 148, "loc": { "start": { - "line": 4, - "column": 10 + "line": 26, + "column": 195 }, "end": { - "line": 4, - "column": 21 + "line": 26, + "column": 206 } }, - "expression": { - "type": "MemberExpression", - "start": 138, - "end": 147, + "range": [ + 599, + 610 + ] + }, + "children": [ + { + "type": "JSXText", + "start": 533, + "end": 540, + "value": "\n ", + "raw": "\n ", "loc": { "start": { - "line": 4, - "column": 11 + "line": 26, + "column": 129 }, "end": { - "line": 4, - "column": 20 + "line": 26, + "column": 136 } }, - "object": { - "type": "Identifier", - "start": 138, - "end": 142, + "range": [ + 533, + 540 + ] + }, + { + "type": "JSXElement", + "start": 540, + "end": 560, + "openingElement": { + "type": "JSXOpeningElement", + "start": 540, + "end": 544, + "attributes": [], + "name": { + "type": "JSXIdentifier", + "start": 541, + "end": 543, + "name": "dt", + "loc": { + "start": { + "line": 26, + "column": 137 + }, + "end": { + "line": 26, + "column": 139 + } + }, + "range": [ + 541, + 543 + ] + }, + "selfClosing": false, "loc": { "start": { - "line": 4, - "column": 11 + "line": 26, + "column": 136 }, "end": { - "line": 4, - "column": 15 + "line": 26, + "column": 140 } }, - "name": "item" + "range": [ + 540, + 544 + ] }, - "property": { - "type": "Identifier", - "start": 143, - "end": 147, + "closingElement": { + "type": "JSXClosingElement", + "start": 555, + "end": 560, + "name": { + "type": "JSXIdentifier", + "start": 557, + "end": 559, + "name": "dt", + "loc": { + "start": { + "line": 26, + "column": 153 + }, + "end": { + "line": 26, + "column": 155 + } + }, + "range": [ + 557, + 559 + ] + }, "loc": { "start": { - "line": 4, - "column": 16 + "line": 26, + "column": 151 }, "end": { - "line": 4, - "column": 20 + "line": 26, + "column": 156 } }, - "name": "term" - }, - "computed": false, - "optional": false - } - } - ] - }, - { - "type": "JSXText", - "start": 153, - "end": 160, - "loc": { - "start": { - "line": 4, - "column": 26 - }, - "end": { - "line": 5, - "column": 6 - } - }, - "value": "\n ", - "raw": "\n " - }, - { - "type": "JSXElement", - "start": 160, - "end": 187, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 33 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 160, - "end": 164, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 10 - } - }, - "attributes": [], - "name": { - "type": "JSXIdentifier", - "start": 161, - "end": 163, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 9 - } - }, - "name": "dd" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 182, - "end": 187, - "loc": { - "start": { - "line": 5, - "column": 28 - }, - "end": { - "line": 5, - "column": 33 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 184, - "end": 186, - "loc": { - "start": { - "line": 5, - "column": 30 + "range": [ + 555, + 560 + ] }, - "end": { - "line": 5, - "column": 32 - } - }, - "name": "dd" - } - }, - "children": [ - { - "type": "JSXExpressionContainer", - "start": 164, - "end": 182, - "loc": { - "start": { - "line": 5, - "column": 10 + "children": [ + { + "type": "JSXExpressionContainer", + "start": 544, + "end": 555, + "expression": { + "type": "MemberExpression", + "start": 545, + "end": 554, + "object": { + "type": "Identifier", + "start": 545, + "end": 549, + "name": "item", + "loc": { + "start": { + "line": 26, + "column": 141 + }, + "end": { + "line": 26, + "column": 145 + } + }, + "range": [ + 545, + 549 + ] + }, + "property": { + "type": "Identifier", + "start": 550, + "end": 554, + "name": "term", + "loc": { + "start": { + "line": 26, + "column": 146 + }, + "end": { + "line": 26, + "column": 150 + } + }, + "range": [ + 550, + 554 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 26, + "column": 141 + }, + "end": { + "line": 26, + "column": 150 + } + }, + "range": [ + 545, + 554 + ] + }, + "loc": { + "start": { + "line": 26, + "column": 140 + }, + "end": { + "line": 26, + "column": 151 + } + }, + "range": [ + 544, + 555 + ] + } + ], + "loc": { + "start": { + "line": 26, + "column": 136 + }, + "end": { + "line": 26, + "column": 156 + } }, - "end": { - "line": 5, - "column": 28 - } + "range": [ + 540, + 560 + ] }, - "expression": { - "type": "MemberExpression", - "start": 165, - "end": 181, + { + "type": "JSXText", + "start": 560, + "end": 567, + "value": "\n ", + "raw": "\n ", "loc": { "start": { - "line": 5, - "column": 11 + "line": 26, + "column": 156 }, "end": { - "line": 5, - "column": 27 + "line": 26, + "column": 163 } }, - "object": { - "type": "Identifier", - "start": 165, - "end": 169, + "range": [ + 560, + 567 + ] + }, + { + "type": "JSXElement", + "start": 567, + "end": 594, + "openingElement": { + "type": "JSXOpeningElement", + "start": 567, + "end": 571, + "attributes": [], + "name": { + "type": "JSXIdentifier", + "start": 568, + "end": 570, + "name": "dd", + "loc": { + "start": { + "line": 26, + "column": 164 + }, + "end": { + "line": 26, + "column": 166 + } + }, + "range": [ + 568, + 570 + ] + }, + "selfClosing": false, "loc": { "start": { - "line": 5, - "column": 11 + "line": 26, + "column": 163 }, "end": { - "line": 5, - "column": 15 + "line": 26, + "column": 167 } }, - "name": "item" + "range": [ + 567, + 571 + ] }, - "property": { - "type": "Identifier", - "start": 170, - "end": 181, + "closingElement": { + "type": "JSXClosingElement", + "start": 589, + "end": 594, + "name": { + "type": "JSXIdentifier", + "start": 591, + "end": 593, + "name": "dd", + "loc": { + "start": { + "line": 26, + "column": 187 + }, + "end": { + "line": 26, + "column": 189 + } + }, + "range": [ + 591, + 593 + ] + }, "loc": { "start": { - "line": 5, - "column": 16 + "line": 26, + "column": 185 }, "end": { - "line": 5, - "column": 27 + "line": 26, + "column": 190 } }, - "name": "description" + "range": [ + 589, + 594 + ] }, - "computed": false, - "optional": false + "children": [ + { + "type": "JSXExpressionContainer", + "start": 571, + "end": 589, + "expression": { + "type": "MemberExpression", + "start": 572, + "end": 588, + "object": { + "type": "Identifier", + "start": 572, + "end": 576, + "name": "item", + "loc": { + "start": { + "line": 26, + "column": 168 + }, + "end": { + "line": 26, + "column": 172 + } + }, + "range": [ + 572, + 576 + ] + }, + "property": { + "type": "Identifier", + "start": 577, + "end": 588, + "name": "description", + "loc": { + "start": { + "line": 26, + "column": 173 + }, + "end": { + "line": 26, + "column": 184 + } + }, + "range": [ + 577, + 588 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 26, + "column": 168 + }, + "end": { + "line": 26, + "column": 184 + } + }, + "range": [ + 572, + 588 + ] + }, + "loc": { + "start": { + "line": 26, + "column": 167 + }, + "end": { + "line": 26, + "column": 185 + } + }, + "range": [ + 571, + 589 + ] + } + ], + "loc": { + "start": { + "line": 26, + "column": 163 + }, + "end": { + "line": 26, + "column": 190 + } + }, + "range": [ + 567, + 594 + ] + }, + { + "type": "JSXText", + "start": 594, + "end": 599, + "value": "\n ", + "raw": "\n ", + "loc": { + "start": { + "line": 26, + "column": 190 + }, + "end": { + "line": 26, + "column": 195 + } + }, + "range": [ + 594, + 599 + ] } - } - ] - }, - { - "type": "JSXText", - "start": 187, - "end": 192, + ], + "loc": { + "start": { + "line": 26, + "column": 105 + }, + "end": { + "line": 26, + "column": 206 + } + }, + "range": [ + 509, + 610 + ] + }, "loc": { "start": { - "line": 5, - "column": 33 + "line": 26, + "column": 19 }, "end": { - "line": 6, - "column": 4 + "line": 26, + "column": 210 } }, - "value": "\n ", - "raw": "\n " + "range": [ + 423, + 614 + ] + } + ], + "optional": false, + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 211 } + }, + "range": [ + 407, + 615 ] - } + }, + "start": 407, + "end": 615, + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 211 + } + }, + "range": [ + 407, + 615 + ] } ], - "optional": false - } - } - } - ], - "position": { - "start": { - "line": 25, - "column": 1, - "offset": 399 - }, + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " Fragments should also have a `key` prop when mapping collections", + "start": 437, + "end": 504, + "loc": { + "start": { + "line": 26, + "column": 33 + }, + "end": { + "line": 26, + "column": 100 + } + }, + "range": [ + 437, + 504 + ] + } + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 211 + } + }, + "range": [ + 407, + 615 + ] + } + } + } + ], + "position": { + "start": { + "line": 25, + "column": 1, + "offset": 399 + }, "end": { "line": 33, "column": 6, @@ -1633,52 +2228,106 @@ "value": "this.toggleContainer", "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 20, + "type": "Program", + "start": 726, + "end": 746, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 726, + "end": 746, + "loc": { + "start": { + "line": 38, + "column": 10 + }, + "end": { + "line": 38, + "column": 30 + } + }, + "object": { + "type": "ThisExpression", + "start": 726, + "end": 730, + "loc": { + "start": { + "line": 38, + "column": 10 + }, + "end": { + "line": 38, + "column": 14 + } + }, + "range": [ + 726, + 730 + ] + }, + "property": { + "type": "Identifier", + "start": 731, + "end": 746, + "loc": { + "start": { + "line": 38, + "column": 15 + }, + "end": { + "line": 38, + "column": 30 + } + }, + "name": "toggleContainer", + "range": [ + 731, + 746 + ] + }, + "computed": false, + "optional": false, + "range": [ + 726, + 746 + ] + }, + "start": 726, + "end": 746, + "loc": { + "start": { + "line": 38, + "column": 10 + }, + "end": { + "line": 38, + "column": 30 + } + }, + "range": [ + 726, + 746 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 38, + "column": 10 }, "end": { - "line": 1, - "column": 20 - } - }, - "object": { - "type": "ThisExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } + "line": 38, + "column": 30 } }, - "property": { - "type": "Identifier", - "start": 5, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "name": "toggleContainer" - }, - "computed": false, - "optional": false + "range": [ + 726, + 746 + ] } } } @@ -1700,52 +2349,106 @@ "value": "this.onClickHandler", "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 19, + "type": "Program", + "start": 768, + "end": 787, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 768, + "end": 787, + "loc": { + "start": { + "line": 39, + "column": 19 + }, + "end": { + "line": 39, + "column": 38 + } + }, + "object": { + "type": "ThisExpression", + "start": 768, + "end": 772, + "loc": { + "start": { + "line": 39, + "column": 19 + }, + "end": { + "line": 39, + "column": 23 + } + }, + "range": [ + 768, + 772 + ] + }, + "property": { + "type": "Identifier", + "start": 773, + "end": 787, + "loc": { + "start": { + "line": 39, + "column": 24 + }, + "end": { + "line": 39, + "column": 38 + } + }, + "name": "onClickHandler", + "range": [ + 773, + 787 + ] + }, + "computed": false, + "optional": false, + "range": [ + 768, + 787 + ] + }, + "start": 768, + "end": 787, + "loc": { + "start": { + "line": 39, + "column": 19 + }, + "end": { + "line": 39, + "column": 38 + } + }, + "range": [ + 768, + 787 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 39, + "column": 19 }, "end": { - "line": 1, - "column": 19 - } - }, - "object": { - "type": "ThisExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } + "line": 39, + "column": 38 } }, - "property": { - "type": "Identifier", - "start": 5, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "name": "onClickHandler" - }, - "computed": false, - "optional": false + "range": [ + 768, + 787 + ] } } } @@ -1813,544 +2516,718 @@ }, "data": { "estree": { - "type": "LogicalExpression", - "start": 0, - "end": 117, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - } - }, - "left": { - "type": "MemberExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "object": { - "type": "ThisExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 + "type": "Program", + "start": 818, + "end": 935, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "start": 818, + "end": 935, + "left": { + "type": "MemberExpression", + "start": 818, + "end": 835, + "object": { + "type": "MemberExpression", + "start": 818, + "end": 828, + "object": { + "type": "ThisExpression", + "start": 818, + "end": 822, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 7 + } + }, + "range": [ + 818, + 822 + ] + }, + "property": { + "type": "Identifier", + "start": 823, + "end": 828, + "name": "state", + "loc": { + "start": { + "line": 40, + "column": 8 + }, + "end": { + "line": 40, + "column": 13 + } + }, + "range": [ + 823, + 828 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 13 + } + }, + "range": [ + 818, + 828 + ] }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "property": { - "type": "Identifier", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 + "property": { + "type": "Identifier", + "start": 829, + "end": 835, + "name": "isOpen", + "loc": { + "start": { + "line": 40, + "column": 14 + }, + "end": { + "line": 40, + "column": 20 + } + }, + "range": [ + 829, + 835 + ] }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "state" - }, - "computed": false, - "optional": false - }, - "property": { - "type": "Identifier", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "isOpen" - }, - "computed": false, - "optional": false - }, - "operator": "&&", - "right": { - "type": "JSXElement", - "start": 27, - "end": 113, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 6, - "column": 9 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "attributes": [], - "name": { - "type": "JSXIdentifier", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 5 + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 20 + } }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "ul" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 108, - "end": 113, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 9 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 110, - "end": 112, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 8 - } - }, - "name": "ul" - } - }, - "children": [ - { - "type": "JSXText", - "start": 31, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 3, - "column": 6 - } - }, - "value": "\n ", - "raw": "\n " - }, - { - "type": "JSXElement", - "start": 38, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 23 - } + "range": [ + 818, + 835 + ] }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 38, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 6 + "operator": "&&", + "right": { + "type": "JSXElement", + "start": 845, + "end": 931, + "openingElement": { + "type": "JSXOpeningElement", + "start": 845, + "end": 849, + "attributes": [], + "name": { + "type": "JSXIdentifier", + "start": 846, + "end": 848, + "name": "ul", + "loc": { + "start": { + "line": 40, + "column": 31 + }, + "end": { + "line": 40, + "column": 33 + } + }, + "range": [ + 846, + 848 + ] }, - "end": { - "line": 3, - "column": 10 - } - }, - "attributes": [], - "name": { - "type": "JSXIdentifier", - "start": 39, - "end": 41, + "selfClosing": false, "loc": { "start": { - "line": 3, - "column": 7 + "line": 40, + "column": 30 }, "end": { - "line": 3, - "column": 9 + "line": 40, + "column": 34 } }, - "name": "li" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 50, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 23 - } + "range": [ + 845, + 849 + ] }, - "name": { - "type": "JSXIdentifier", - "start": 52, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 20 + "closingElement": { + "type": "JSXClosingElement", + "start": 926, + "end": 931, + "name": { + "type": "JSXIdentifier", + "start": 928, + "end": 930, + "name": "ul", + "loc": { + "start": { + "line": 40, + "column": 113 + }, + "end": { + "line": 40, + "column": 115 + } }, - "end": { - "line": 3, - "column": 22 - } + "range": [ + 928, + 930 + ] }, - "name": "li" - } - }, - "children": [ - { - "type": "JSXText", - "start": 42, - "end": 50, "loc": { "start": { - "line": 3, - "column": 10 + "line": 40, + "column": 111 }, "end": { - "line": 3, - "column": 18 + "line": 40, + "column": 116 } }, - "value": "Option 1", - "raw": "Option 1" - } - ] - }, - { - "type": "JSXText", - "start": 55, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 4, - "column": 6 - } - }, - "value": "\n ", - "raw": "\n " - }, - { - "type": "JSXElement", - "start": 62, - "end": 79, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 23 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 62, - "end": 66, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 10 - } + "range": [ + 926, + 931 + ] }, - "attributes": [], - "name": { - "type": "JSXIdentifier", - "start": 63, - "end": 65, - "loc": { - "start": { - "line": 4, - "column": 7 + "children": [ + { + "type": "JSXText", + "start": 849, + "end": 856, + "value": "\n ", + "raw": "\n ", + "loc": { + "start": { + "line": 40, + "column": 34 + }, + "end": { + "line": 40, + "column": 41 + } }, - "end": { - "line": 4, - "column": 9 - } + "range": [ + 849, + 856 + ] }, - "name": "li" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 74, - "end": 79, - "loc": { - "start": { - "line": 4, - "column": 18 + { + "type": "JSXElement", + "start": 856, + "end": 873, + "openingElement": { + "type": "JSXOpeningElement", + "start": 856, + "end": 860, + "attributes": [], + "name": { + "type": "JSXIdentifier", + "start": 857, + "end": 859, + "name": "li", + "loc": { + "start": { + "line": 40, + "column": 42 + }, + "end": { + "line": 40, + "column": 44 + } + }, + "range": [ + 857, + 859 + ] + }, + "selfClosing": false, + "loc": { + "start": { + "line": 40, + "column": 41 + }, + "end": { + "line": 40, + "column": 45 + } + }, + "range": [ + 856, + 860 + ] + }, + "closingElement": { + "type": "JSXClosingElement", + "start": 868, + "end": 873, + "name": { + "type": "JSXIdentifier", + "start": 870, + "end": 872, + "name": "li", + "loc": { + "start": { + "line": 40, + "column": 55 + }, + "end": { + "line": 40, + "column": 57 + } + }, + "range": [ + 870, + 872 + ] + }, + "loc": { + "start": { + "line": 40, + "column": 53 + }, + "end": { + "line": 40, + "column": 58 + } + }, + "range": [ + 868, + 873 + ] + }, + "children": [ + { + "type": "JSXText", + "start": 860, + "end": 868, + "value": "Option 1", + "raw": "Option 1", + "loc": { + "start": { + "line": 40, + "column": 45 + }, + "end": { + "line": 40, + "column": 53 + } + }, + "range": [ + 860, + 868 + ] + } + ], + "loc": { + "start": { + "line": 40, + "column": 41 + }, + "end": { + "line": 40, + "column": 58 + } + }, + "range": [ + 856, + 873 + ] }, - "end": { - "line": 4, - "column": 23 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 76, - "end": 78, - "loc": { - "start": { - "line": 4, - "column": 20 + { + "type": "JSXText", + "start": 873, + "end": 880, + "value": "\n ", + "raw": "\n ", + "loc": { + "start": { + "line": 40, + "column": 58 + }, + "end": { + "line": 40, + "column": 65 + } }, - "end": { - "line": 4, - "column": 22 - } + "range": [ + 873, + 880 + ] }, - "name": "li" - } - }, - "children": [ - { - "type": "JSXText", - "start": 66, - "end": 74, - "loc": { - "start": { - "line": 4, - "column": 10 + { + "type": "JSXElement", + "start": 880, + "end": 897, + "openingElement": { + "type": "JSXOpeningElement", + "start": 880, + "end": 884, + "attributes": [], + "name": { + "type": "JSXIdentifier", + "start": 881, + "end": 883, + "name": "li", + "loc": { + "start": { + "line": 40, + "column": 66 + }, + "end": { + "line": 40, + "column": 68 + } + }, + "range": [ + 881, + 883 + ] + }, + "selfClosing": false, + "loc": { + "start": { + "line": 40, + "column": 65 + }, + "end": { + "line": 40, + "column": 69 + } + }, + "range": [ + 880, + 884 + ] }, - "end": { - "line": 4, - "column": 18 - } + "closingElement": { + "type": "JSXClosingElement", + "start": 892, + "end": 897, + "name": { + "type": "JSXIdentifier", + "start": 894, + "end": 896, + "name": "li", + "loc": { + "start": { + "line": 40, + "column": 79 + }, + "end": { + "line": 40, + "column": 81 + } + }, + "range": [ + 894, + 896 + ] + }, + "loc": { + "start": { + "line": 40, + "column": 77 + }, + "end": { + "line": 40, + "column": 82 + } + }, + "range": [ + 892, + 897 + ] + }, + "children": [ + { + "type": "JSXText", + "start": 884, + "end": 892, + "value": "Option 2", + "raw": "Option 2", + "loc": { + "start": { + "line": 40, + "column": 69 + }, + "end": { + "line": 40, + "column": 77 + } + }, + "range": [ + 884, + 892 + ] + } + ], + "loc": { + "start": { + "line": 40, + "column": 65 + }, + "end": { + "line": 40, + "column": 82 + } + }, + "range": [ + 880, + 897 + ] }, - "value": "Option 2", - "raw": "Option 2" - } - ] - }, - { - "type": "JSXText", - "start": 79, - "end": 86, - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 5, - "column": 6 - } - }, - "value": "\n ", - "raw": "\n " - }, - { - "type": "JSXElement", - "start": 86, - "end": 103, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 23 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 86, - "end": 90, - "loc": { - "start": { - "line": 5, - "column": 6 + { + "type": "JSXText", + "start": 897, + "end": 904, + "value": "\n ", + "raw": "\n ", + "loc": { + "start": { + "line": 40, + "column": 82 + }, + "end": { + "line": 40, + "column": 89 + } + }, + "range": [ + 897, + 904 + ] }, - "end": { - "line": 5, - "column": 10 - } - }, - "attributes": [], - "name": { - "type": "JSXIdentifier", - "start": 87, - "end": 89, - "loc": { - "start": { - "line": 5, - "column": 7 + { + "type": "JSXElement", + "start": 904, + "end": 921, + "openingElement": { + "type": "JSXOpeningElement", + "start": 904, + "end": 908, + "attributes": [], + "name": { + "type": "JSXIdentifier", + "start": 905, + "end": 907, + "name": "li", + "loc": { + "start": { + "line": 40, + "column": 90 + }, + "end": { + "line": 40, + "column": 92 + } + }, + "range": [ + 905, + 907 + ] + }, + "selfClosing": false, + "loc": { + "start": { + "line": 40, + "column": 89 + }, + "end": { + "line": 40, + "column": 93 + } + }, + "range": [ + 904, + 908 + ] + }, + "closingElement": { + "type": "JSXClosingElement", + "start": 916, + "end": 921, + "name": { + "type": "JSXIdentifier", + "start": 918, + "end": 920, + "name": "li", + "loc": { + "start": { + "line": 40, + "column": 103 + }, + "end": { + "line": 40, + "column": 105 + } + }, + "range": [ + 918, + 920 + ] + }, + "loc": { + "start": { + "line": 40, + "column": 101 + }, + "end": { + "line": 40, + "column": 106 + } + }, + "range": [ + 916, + 921 + ] + }, + "children": [ + { + "type": "JSXText", + "start": 908, + "end": 916, + "value": "Option 3", + "raw": "Option 3", + "loc": { + "start": { + "line": 40, + "column": 93 + }, + "end": { + "line": 40, + "column": 101 + } + }, + "range": [ + 908, + 916 + ] + } + ], + "loc": { + "start": { + "line": 40, + "column": 89 + }, + "end": { + "line": 40, + "column": 106 + } }, - "end": { - "line": 5, - "column": 9 - } + "range": [ + 904, + 921 + ] }, - "name": "li" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 98, - "end": 103, + { + "type": "JSXText", + "start": 921, + "end": 926, + "value": "\n ", + "raw": "\n ", + "loc": { + "start": { + "line": 40, + "column": 106 + }, + "end": { + "line": 40, + "column": 111 + } + }, + "range": [ + 921, + 926 + ] + } + ], "loc": { "start": { - "line": 5, - "column": 18 + "line": 40, + "column": 30 }, "end": { - "line": 5, - "column": 23 + "line": 40, + "column": 116 } }, - "name": { - "type": "JSXIdentifier", - "start": 100, - "end": 102, - "loc": { - "start": { - "line": 5, - "column": 20 - }, - "end": { - "line": 5, - "column": 22 - } - }, - "name": "li" - } + "range": [ + 845, + 931 + ] }, - "children": [ - { - "type": "JSXText", - "start": 90, - "end": 98, - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 18 - } - }, - "value": "Option 3", - "raw": "Option 3" - } - ] - }, - { - "type": "JSXText", - "start": 103, - "end": 108, "loc": { "start": { - "line": 5, - "column": 23 + "line": 40, + "column": 3 }, "end": { - "line": 6, - "column": 4 + "line": 40, + "column": 120 } }, - "value": "\n ", - "raw": "\n " - } - ] - } + "range": [ + 818, + 935 + ] + }, + "start": 818, + "end": 935, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 120 + } + }, + "range": [ + 818, + 935 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 120 + } + }, + "range": [ + 818, + 935 + ] } } } @@ -2380,52 +3257,106 @@ "value": "this.onBlurHandler", "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 18, + "type": "Program", + "start": 958, + "end": 976, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 958, + "end": 976, + "loc": { + "start": { + "line": 49, + "column": 13 + }, + "end": { + "line": 49, + "column": 31 + } + }, + "object": { + "type": "ThisExpression", + "start": 958, + "end": 962, + "loc": { + "start": { + "line": 49, + "column": 13 + }, + "end": { + "line": 49, + "column": 17 + } + }, + "range": [ + 958, + 962 + ] + }, + "property": { + "type": "Identifier", + "start": 963, + "end": 976, + "loc": { + "start": { + "line": 49, + "column": 18 + }, + "end": { + "line": 49, + "column": 31 + } + }, + "name": "onBlurHandler", + "range": [ + 963, + 976 + ] + }, + "computed": false, + "optional": false, + "range": [ + 958, + 976 + ] + }, + "start": 958, + "end": 976, + "loc": { + "start": { + "line": 49, + "column": 13 + }, + "end": { + "line": 49, + "column": 31 + } + }, + "range": [ + 958, + 976 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 49, + "column": 13 }, "end": { - "line": 1, - "column": 18 - } - }, - "object": { - "type": "ThisExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } + "line": 49, + "column": 31 } }, - "property": { - "type": "Identifier", - "start": 5, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "name": "onBlurHandler" - }, - "computed": false, - "optional": false + "range": [ + 958, + 976 + ] } } } @@ -2438,52 +3369,106 @@ "value": "this.onFocusHandler", "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 19, + "type": "Program", + "start": 992, + "end": 1011, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 992, + "end": 1011, + "loc": { + "start": { + "line": 50, + "column": 14 + }, + "end": { + "line": 50, + "column": 33 + } + }, + "object": { + "type": "ThisExpression", + "start": 992, + "end": 996, + "loc": { + "start": { + "line": 50, + "column": 14 + }, + "end": { + "line": 50, + "column": 18 + } + }, + "range": [ + 992, + 996 + ] + }, + "property": { + "type": "Identifier", + "start": 997, + "end": 1011, + "loc": { + "start": { + "line": 50, + "column": 19 + }, + "end": { + "line": 50, + "column": 33 + } + }, + "name": "onFocusHandler", + "range": [ + 997, + 1011 + ] + }, + "computed": false, + "optional": false, + "range": [ + 992, + 1011 + ] + }, + "start": 992, + "end": 1011, + "loc": { + "start": { + "line": 50, + "column": 14 + }, + "end": { + "line": 50, + "column": 33 + } + }, + "range": [ + 992, + 1011 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 50, + "column": 14 }, "end": { - "line": 1, - "column": 19 - } - }, - "object": { - "type": "ThisExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } + "line": 50, + "column": 33 } }, - "property": { - "type": "Identifier", - "start": 5, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "name": "onFocusHandler" - }, - "computed": false, - "optional": false + "range": [ + 992, + 1011 + ] } } } @@ -2502,52 +3487,106 @@ "value": "this.onClickHandler", "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 19, + "type": "Program", + "start": 1033, + "end": 1052, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 1033, + "end": 1052, + "loc": { + "start": { + "line": 51, + "column": 19 + }, + "end": { + "line": 51, + "column": 38 + } + }, + "object": { + "type": "ThisExpression", + "start": 1033, + "end": 1037, + "loc": { + "start": { + "line": 51, + "column": 19 + }, + "end": { + "line": 51, + "column": 23 + } + }, + "range": [ + 1033, + 1037 + ] + }, + "property": { + "type": "Identifier", + "start": 1038, + "end": 1052, + "loc": { + "start": { + "line": 51, + "column": 24 + }, + "end": { + "line": 51, + "column": 38 + } + }, + "name": "onClickHandler", + "range": [ + 1038, + 1052 + ] + }, + "computed": false, + "optional": false, + "range": [ + 1033, + 1052 + ] + }, + "start": 1033, + "end": 1052, + "loc": { + "start": { + "line": 51, + "column": 19 + }, + "end": { + "line": 51, + "column": 38 + } + }, + "range": [ + 1033, + 1052 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 51, + "column": 19 }, "end": { - "line": 1, - "column": 19 - } - }, - "object": { - "type": "ThisExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } + "line": 51, + "column": 38 } }, - "property": { - "type": "Identifier", - "start": 5, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "name": "onClickHandler" - }, - "computed": false, - "optional": false + "range": [ + 1033, + 1052 + ] } } } @@ -2565,85 +3604,147 @@ "value": "this.state.isOpen", "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "object": { - "type": "ThisExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 + "type": "Program", + "start": 1110, + "end": 1127, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 1110, + "end": 1127, + "loc": { + "start": { + "line": 53, + "column": 25 + }, + "end": { + "line": 53, + "column": 42 + } }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "property": { - "type": "Identifier", - "start": 5, - "end": 10, + "object": { + "type": "MemberExpression", + "start": 1110, + "end": 1120, + "loc": { + "start": { + "line": 53, + "column": 25 + }, + "end": { + "line": 53, + "column": 35 + } + }, + "object": { + "type": "ThisExpression", + "start": 1110, + "end": 1114, + "loc": { + "start": { + "line": 53, + "column": 25 + }, + "end": { + "line": 53, + "column": 29 + } + }, + "range": [ + 1110, + 1114 + ] + }, + "property": { + "type": "Identifier", + "start": 1115, + "end": 1120, + "loc": { + "start": { + "line": 53, + "column": 30 + }, + "end": { + "line": 53, + "column": 35 + } + }, + "name": "state", + "range": [ + 1115, + 1120 + ] + }, + "computed": false, + "optional": false, + "range": [ + 1110, + 1120 + ] + }, + "property": { + "type": "Identifier", + "start": 1121, + "end": 1127, + "loc": { + "start": { + "line": 53, + "column": 36 + }, + "end": { + "line": 53, + "column": 42 + } + }, + "name": "isOpen", + "range": [ + 1121, + 1127 + ] + }, + "computed": false, + "optional": false, + "range": [ + 1110, + 1127 + ] + }, + "start": 1110, + "end": 1127, "loc": { "start": { - "line": 1, - "column": 5 + "line": 53, + "column": 25 }, "end": { - "line": 1, - "column": 10 + "line": 53, + "column": 42 } }, - "name": "state" - }, - "computed": false, - "optional": false - }, - "property": { - "type": "Identifier", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } + "range": [ + 1110, + 1127 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 53, + "column": 25 }, - "name": "isOpen" + "end": { + "line": 53, + "column": 42 + } }, - "computed": false, - "optional": false + "range": [ + 1110, + 1127 + ] } } } @@ -2714,544 +3815,718 @@ }, "data": { "estree": { - "type": "LogicalExpression", - "start": 0, - "end": 117, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - } - }, - "left": { - "type": "MemberExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "object": { - "type": "ThisExpression", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "property": { - "type": "Identifier", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "state" - }, - "computed": false, - "optional": false - }, - "property": { - "type": "Identifier", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "isOpen" - }, - "computed": false, - "optional": false - }, - "operator": "&&", - "right": { - "type": "JSXElement", - "start": 27, - "end": 113, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 6, - "column": 9 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 27, - "end": 31, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "attributes": [], - "name": { - "type": "JSXIdentifier", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "ul" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 108, - "end": 113, - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 9 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 110, - "end": 112, - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 8 - } - }, - "name": "ul" - } - }, - "children": [ - { - "type": "JSXText", - "start": 31, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 3, - "column": 6 - } - }, - "value": "\n ", - "raw": "\n " - }, - { - "type": "JSXElement", - "start": 38, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 38, - "end": 42, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "attributes": [], - "name": { - "type": "JSXIdentifier", - "start": 39, - "end": 41, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "name": "li" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 50, - "end": 55, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 52, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 20 + "type": "Program", + "start": 1166, + "end": 1283, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "start": 1166, + "end": 1283, + "left": { + "type": "MemberExpression", + "start": 1166, + "end": 1183, + "object": { + "type": "MemberExpression", + "start": 1166, + "end": 1176, + "object": { + "type": "ThisExpression", + "start": 1166, + "end": 1170, + "loc": { + "start": { + "line": 56, + "column": 3 + }, + "end": { + "line": 56, + "column": 7 + } }, - "end": { - "line": 3, - "column": 22 - } + "range": [ + 1166, + 1170 + ] }, - "name": "li" - } - }, - "children": [ - { - "type": "JSXText", - "start": 42, - "end": 50, - "loc": { - "start": { - "line": 3, - "column": 10 + "property": { + "type": "Identifier", + "start": 1171, + "end": 1176, + "name": "state", + "loc": { + "start": { + "line": 56, + "column": 8 + }, + "end": { + "line": 56, + "column": 13 + } }, - "end": { - "line": 3, - "column": 18 - } - }, - "value": "Option 1", - "raw": "Option 1" - } - ] - }, - { - "type": "JSXText", - "start": 55, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 4, - "column": 6 - } - }, - "value": "\n ", - "raw": "\n " - }, - { - "type": "JSXElement", - "start": 62, - "end": 79, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 23 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 62, - "end": 66, - "loc": { - "start": { - "line": 4, - "column": 6 + "range": [ + 1171, + 1176 + ] }, - "end": { - "line": 4, - "column": 10 - } - }, - "attributes": [], - "name": { - "type": "JSXIdentifier", - "start": 63, - "end": 65, + "computed": false, + "optional": false, "loc": { "start": { - "line": 4, - "column": 7 + "line": 56, + "column": 3 }, "end": { - "line": 4, - "column": 9 + "line": 56, + "column": 13 } }, - "name": "li" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 74, - "end": 79, - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 23 - } + "range": [ + 1166, + 1176 + ] }, - "name": { - "type": "JSXIdentifier", - "start": 76, - "end": 78, - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 22 - } - }, - "name": "li" - } - }, - "children": [ - { - "type": "JSXText", - "start": 66, - "end": 74, + "property": { + "type": "Identifier", + "start": 1177, + "end": 1183, + "name": "isOpen", "loc": { "start": { - "line": 4, - "column": 10 + "line": 56, + "column": 14 }, "end": { - "line": 4, - "column": 18 + "line": 56, + "column": 20 } }, - "value": "Option 2", - "raw": "Option 2" - } - ] - }, - { - "type": "JSXText", - "start": 79, - "end": 86, - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 5, - "column": 6 - } - }, - "value": "\n ", - "raw": "\n " - }, - { - "type": "JSXElement", - "start": 86, - "end": 103, - "loc": { - "start": { - "line": 5, - "column": 6 + "range": [ + 1177, + 1183 + ] }, - "end": { - "line": 5, - "column": 23 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 86, - "end": 90, + "computed": false, + "optional": false, "loc": { "start": { - "line": 5, - "column": 6 + "line": 56, + "column": 3 }, "end": { - "line": 5, - "column": 10 + "line": 56, + "column": 20 } }, - "attributes": [], - "name": { - "type": "JSXIdentifier", - "start": 87, - "end": 89, + "range": [ + 1166, + 1183 + ] + }, + "operator": "&&", + "right": { + "type": "JSXElement", + "start": 1193, + "end": 1279, + "openingElement": { + "type": "JSXOpeningElement", + "start": 1193, + "end": 1197, + "attributes": [], + "name": { + "type": "JSXIdentifier", + "start": 1194, + "end": 1196, + "name": "ul", + "loc": { + "start": { + "line": 56, + "column": 31 + }, + "end": { + "line": 56, + "column": 33 + } + }, + "range": [ + 1194, + 1196 + ] + }, + "selfClosing": false, "loc": { "start": { - "line": 5, - "column": 7 + "line": 56, + "column": 30 }, "end": { - "line": 5, - "column": 9 + "line": 56, + "column": 34 } }, - "name": "li" + "range": [ + 1193, + 1197 + ] }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 98, - "end": 103, - "loc": { - "start": { - "line": 5, - "column": 18 + "closingElement": { + "type": "JSXClosingElement", + "start": 1274, + "end": 1279, + "name": { + "type": "JSXIdentifier", + "start": 1276, + "end": 1278, + "name": "ul", + "loc": { + "start": { + "line": 56, + "column": 113 + }, + "end": { + "line": 56, + "column": 115 + } + }, + "range": [ + 1276, + 1278 + ] }, - "end": { - "line": 5, - "column": 23 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 100, - "end": 102, "loc": { "start": { - "line": 5, - "column": 20 + "line": 56, + "column": 111 }, "end": { - "line": 5, - "column": 22 + "line": 56, + "column": 116 } }, - "name": "li" - } - }, - "children": [ - { - "type": "JSXText", - "start": 90, - "end": 98, - "loc": { - "start": { - "line": 5, - "column": 10 + "range": [ + 1274, + 1279 + ] + }, + "children": [ + { + "type": "JSXText", + "start": 1197, + "end": 1204, + "value": "\n ", + "raw": "\n ", + "loc": { + "start": { + "line": 56, + "column": 34 + }, + "end": { + "line": 56, + "column": 41 + } }, - "end": { - "line": 5, - "column": 18 - } + "range": [ + 1197, + 1204 + ] }, - "value": "Option 3", - "raw": "Option 3" - } - ] - }, - { - "type": "JSXText", - "start": 103, - "end": 108, + { + "type": "JSXElement", + "start": 1204, + "end": 1221, + "openingElement": { + "type": "JSXOpeningElement", + "start": 1204, + "end": 1208, + "attributes": [], + "name": { + "type": "JSXIdentifier", + "start": 1205, + "end": 1207, + "name": "li", + "loc": { + "start": { + "line": 56, + "column": 42 + }, + "end": { + "line": 56, + "column": 44 + } + }, + "range": [ + 1205, + 1207 + ] + }, + "selfClosing": false, + "loc": { + "start": { + "line": 56, + "column": 41 + }, + "end": { + "line": 56, + "column": 45 + } + }, + "range": [ + 1204, + 1208 + ] + }, + "closingElement": { + "type": "JSXClosingElement", + "start": 1216, + "end": 1221, + "name": { + "type": "JSXIdentifier", + "start": 1218, + "end": 1220, + "name": "li", + "loc": { + "start": { + "line": 56, + "column": 55 + }, + "end": { + "line": 56, + "column": 57 + } + }, + "range": [ + 1218, + 1220 + ] + }, + "loc": { + "start": { + "line": 56, + "column": 53 + }, + "end": { + "line": 56, + "column": 58 + } + }, + "range": [ + 1216, + 1221 + ] + }, + "children": [ + { + "type": "JSXText", + "start": 1208, + "end": 1216, + "value": "Option 1", + "raw": "Option 1", + "loc": { + "start": { + "line": 56, + "column": 45 + }, + "end": { + "line": 56, + "column": 53 + } + }, + "range": [ + 1208, + 1216 + ] + } + ], + "loc": { + "start": { + "line": 56, + "column": 41 + }, + "end": { + "line": 56, + "column": 58 + } + }, + "range": [ + 1204, + 1221 + ] + }, + { + "type": "JSXText", + "start": 1221, + "end": 1228, + "value": "\n ", + "raw": "\n ", + "loc": { + "start": { + "line": 56, + "column": 58 + }, + "end": { + "line": 56, + "column": 65 + } + }, + "range": [ + 1221, + 1228 + ] + }, + { + "type": "JSXElement", + "start": 1228, + "end": 1245, + "openingElement": { + "type": "JSXOpeningElement", + "start": 1228, + "end": 1232, + "attributes": [], + "name": { + "type": "JSXIdentifier", + "start": 1229, + "end": 1231, + "name": "li", + "loc": { + "start": { + "line": 56, + "column": 66 + }, + "end": { + "line": 56, + "column": 68 + } + }, + "range": [ + 1229, + 1231 + ] + }, + "selfClosing": false, + "loc": { + "start": { + "line": 56, + "column": 65 + }, + "end": { + "line": 56, + "column": 69 + } + }, + "range": [ + 1228, + 1232 + ] + }, + "closingElement": { + "type": "JSXClosingElement", + "start": 1240, + "end": 1245, + "name": { + "type": "JSXIdentifier", + "start": 1242, + "end": 1244, + "name": "li", + "loc": { + "start": { + "line": 56, + "column": 79 + }, + "end": { + "line": 56, + "column": 81 + } + }, + "range": [ + 1242, + 1244 + ] + }, + "loc": { + "start": { + "line": 56, + "column": 77 + }, + "end": { + "line": 56, + "column": 82 + } + }, + "range": [ + 1240, + 1245 + ] + }, + "children": [ + { + "type": "JSXText", + "start": 1232, + "end": 1240, + "value": "Option 2", + "raw": "Option 2", + "loc": { + "start": { + "line": 56, + "column": 69 + }, + "end": { + "line": 56, + "column": 77 + } + }, + "range": [ + 1232, + 1240 + ] + } + ], + "loc": { + "start": { + "line": 56, + "column": 65 + }, + "end": { + "line": 56, + "column": 82 + } + }, + "range": [ + 1228, + 1245 + ] + }, + { + "type": "JSXText", + "start": 1245, + "end": 1252, + "value": "\n ", + "raw": "\n ", + "loc": { + "start": { + "line": 56, + "column": 82 + }, + "end": { + "line": 56, + "column": 89 + } + }, + "range": [ + 1245, + 1252 + ] + }, + { + "type": "JSXElement", + "start": 1252, + "end": 1269, + "openingElement": { + "type": "JSXOpeningElement", + "start": 1252, + "end": 1256, + "attributes": [], + "name": { + "type": "JSXIdentifier", + "start": 1253, + "end": 1255, + "name": "li", + "loc": { + "start": { + "line": 56, + "column": 90 + }, + "end": { + "line": 56, + "column": 92 + } + }, + "range": [ + 1253, + 1255 + ] + }, + "selfClosing": false, + "loc": { + "start": { + "line": 56, + "column": 89 + }, + "end": { + "line": 56, + "column": 93 + } + }, + "range": [ + 1252, + 1256 + ] + }, + "closingElement": { + "type": "JSXClosingElement", + "start": 1264, + "end": 1269, + "name": { + "type": "JSXIdentifier", + "start": 1266, + "end": 1268, + "name": "li", + "loc": { + "start": { + "line": 56, + "column": 103 + }, + "end": { + "line": 56, + "column": 105 + } + }, + "range": [ + 1266, + 1268 + ] + }, + "loc": { + "start": { + "line": 56, + "column": 101 + }, + "end": { + "line": 56, + "column": 106 + } + }, + "range": [ + 1264, + 1269 + ] + }, + "children": [ + { + "type": "JSXText", + "start": 1256, + "end": 1264, + "value": "Option 3", + "raw": "Option 3", + "loc": { + "start": { + "line": 56, + "column": 93 + }, + "end": { + "line": 56, + "column": 101 + } + }, + "range": [ + 1256, + 1264 + ] + } + ], + "loc": { + "start": { + "line": 56, + "column": 89 + }, + "end": { + "line": 56, + "column": 106 + } + }, + "range": [ + 1252, + 1269 + ] + }, + { + "type": "JSXText", + "start": 1269, + "end": 1274, + "value": "\n ", + "raw": "\n ", + "loc": { + "start": { + "line": 56, + "column": 106 + }, + "end": { + "line": 56, + "column": 111 + } + }, + "range": [ + 1269, + 1274 + ] + } + ], + "loc": { + "start": { + "line": 56, + "column": 30 + }, + "end": { + "line": 56, + "column": 116 + } + }, + "range": [ + 1193, + 1279 + ] + }, "loc": { "start": { - "line": 5, - "column": 23 + "line": 56, + "column": 3 }, "end": { - "line": 6, - "column": 4 + "line": 56, + "column": 120 } }, - "value": "\n ", - "raw": "\n " - } - ] - } + "range": [ + 1166, + 1283 + ] + }, + "start": 1166, + "end": 1283, + "loc": { + "start": { + "line": 56, + "column": 3 + }, + "end": { + "line": 56, + "column": 120 + } + }, + "range": [ + 1166, + 1283 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 56, + "column": 3 + }, + "end": { + "line": 56, + "column": 120 + } + }, + "range": [ + 1166, + 1283 + ] } } } diff --git a/packages/remark-mdx/test/fixtures/examples-from-react-jsx-in-depth.json b/packages/remark-mdx/test/fixtures/examples-from-react-jsx-in-depth.json index 20a5cb82a..acf689c4e 100644 --- a/packages/remark-mdx/test/fixtures/examples-from-react-jsx-in-depth.json +++ b/packages/remark-mdx/test/fixtures/examples-from-react-jsx-in-depth.json @@ -136,21 +136,67 @@ "value": "2", "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 1, + "type": "Program", + "start": 143, + "end": 144, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 143, + "end": 144, + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + }, + "value": 2, + "raw": "2", + "range": [ + 143, + 144 + ] + }, + "start": 143, + "end": 144, + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + }, + "range": [ + 143, + 144 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 5, + "column": 35 }, "end": { - "line": 1, - "column": 1 + "line": 5, + "column": 36 } }, - "value": 2, - "raw": "2" + "range": [ + 143, + 144 + ] } } } @@ -293,53 +339,107 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 12, + "type": "Program", + "start": 254, + "end": 266, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 254, + "end": 266, + "object": { + "type": "Identifier", + "start": 254, + "end": 259, + "name": "props", + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 17 + } + }, + "range": [ + 254, + 259 + ] + }, + "property": { + "type": "Identifier", + "start": 260, + "end": 266, + "name": "toWhat", + "loc": { + "start": { + "line": 13, + "column": 18 + }, + "end": { + "line": 13, + "column": 24 + } + }, + "range": [ + 260, + 266 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 24 + } + }, + "range": [ + 254, + 266 + ] + }, + "start": 254, + "end": 266, + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 24 + } + }, + "range": [ + 254, + 266 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 13, + "column": 12 }, "end": { - "line": 1, - "column": 12 + "line": 13, + "column": 24 } }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "name": "toWhat" - }, - "computed": false, - "optional": false + "range": [ + 254, + 266 + ] } } } @@ -383,120 +483,190 @@ "value": "1 + 2 + 3 + 4", "data": { "estree": { - "type": "BinaryExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "left": { - "type": "BinaryExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "left": { - "type": "BinaryExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "left": { - "type": "Literal", - "start": 0, - "end": 1, + "type": "Program", + "start": 293, + "end": 306, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "start": 293, + "end": 306, "loc": { "start": { - "line": 1, - "column": 0 + "line": 15, + "column": 18 }, "end": { - "line": 1, - "column": 1 + "line": 15, + "column": 31 } }, - "value": 1, - "raw": "1" - }, - "operator": "+", - "right": { - "type": "Literal", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 + "left": { + "type": "BinaryExpression", + "start": 293, + "end": 302, + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 27 + } }, - "end": { - "line": 1, - "column": 5 - } + "left": { + "type": "BinaryExpression", + "start": 293, + "end": 298, + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "left": { + "type": "Literal", + "start": 293, + "end": 294, + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 19 + } + }, + "value": 1, + "raw": "1", + "range": [ + 293, + 294 + ] + }, + "operator": "+", + "right": { + "type": "Literal", + "start": 297, + "end": 298, + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "value": 2, + "raw": "2", + "range": [ + 297, + 298 + ] + }, + "range": [ + 293, + 298 + ] + }, + "operator": "+", + "right": { + "type": "Literal", + "start": 301, + "end": 302, + "loc": { + "start": { + "line": 15, + "column": 26 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "value": 3, + "raw": "3", + "range": [ + 301, + 302 + ] + }, + "range": [ + 293, + 302 + ] }, - "value": 2, - "raw": "2" - } - }, - "operator": "+", - "right": { - "type": "Literal", - "start": 8, - "end": 9, + "operator": "+", + "right": { + "type": "Literal", + "start": 305, + "end": 306, + "loc": { + "start": { + "line": 15, + "column": 30 + }, + "end": { + "line": 15, + "column": 31 + } + }, + "value": 4, + "raw": "4", + "range": [ + 305, + 306 + ] + }, + "range": [ + 293, + 306 + ] + }, + "start": 293, + "end": 306, "loc": { "start": { - "line": 1, - "column": 8 + "line": 15, + "column": 18 }, "end": { - "line": 1, - "column": 9 + "line": 15, + "column": 31 } }, - "value": 3, - "raw": "3" + "range": [ + 293, + 306 + ] } - }, - "operator": "+", - "right": { - "type": "Literal", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 15, + "column": 18 }, - "value": 4, - "raw": "4" - } + "end": { + "line": 15, + "column": 31 + } + }, + "range": [ + 293, + 306 + ] } } } @@ -541,53 +711,107 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 12, + "type": "Program", + "start": 318, + "end": 330, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 318, + "end": 330, + "object": { + "type": "Identifier", + "start": 318, + "end": 323, + "name": "props", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 11 + } + }, + "range": [ + 318, + 323 + ] + }, + "property": { + "type": "Identifier", + "start": 324, + "end": 330, + "name": "number", + "loc": { + "start": { + "line": 17, + "column": 12 + }, + "end": { + "line": 17, + "column": 18 + } + }, + "range": [ + 324, + 330 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 18 + } + }, + "range": [ + 318, + 330 + ] + }, + "start": 318, + "end": 330, + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 18 + } + }, + "range": [ + 318, + 330 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 17, + "column": 6 }, "end": { - "line": 1, - "column": 12 + "line": 17, + "column": 18 } }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "name": "number" - }, - "computed": false, - "optional": false + "range": [ + 318, + 330 + ] } } }, @@ -624,20 +848,66 @@ }, "data": { "estree": { - "type": "Identifier", - "start": 0, - "end": 11, + "type": "Program", + "start": 339, + "end": 350, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "start": 339, + "end": 350, + "name": "description", + "loc": { + "start": { + "line": 17, + "column": 27 + }, + "end": { + "line": 17, + "column": 38 + } + }, + "range": [ + 339, + 350 + ] + }, + "start": 339, + "end": 350, + "loc": { + "start": { + "line": 17, + "column": 27 + }, + "end": { + "line": 17, + "column": 38 + } + }, + "range": [ + 339, + 350 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 17, + "column": 27 }, "end": { - "line": 1, - "column": 11 + "line": 17, + "column": 38 } }, - "name": "description" + "range": [ + 339, + 350 + ] } } }, @@ -721,26 +991,72 @@ "value": "'hello world'", "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "value": "hello world", - "raw": "'hello world'" - } - } - } - } - ], + "type": "Program", + "start": 427, + "end": 440, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 427, + "end": 440, + "loc": { + "start": { + "line": 21, + "column": 22 + }, + "end": { + "line": 21, + "column": 35 + } + }, + "value": "hello world", + "raw": "'hello world'", + "range": [ + 427, + 440 + ] + }, + "start": 427, + "end": 440, + "loc": { + "start": { + "line": 21, + "column": 22 + }, + "end": { + "line": 21, + "column": 35 + } + }, + "range": [ + 427, + 440 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 21, + "column": 22 + }, + "end": { + "line": 21, + "column": 35 + } + }, + "range": [ + 427, + 440 + ] + } + } + } + } + ], "children": [], "position": { "start": { @@ -791,21 +1107,67 @@ "value": "'<3'", "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 4, + "type": "Program", + "start": 501, + "end": 505, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 501, + "end": 505, + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "value": "<3", + "raw": "'<3'", + "range": [ + 501, + 505 + ] + }, + "start": 501, + "end": 505, + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "range": [ + 501, + 505 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 25, + "column": 22 }, "end": { - "line": 1, - "column": 4 + "line": 25, + "column": 26 } }, - "value": "<3", - "raw": "'<3'" + "range": [ + 501, + 505 + ] } } } @@ -861,21 +1223,67 @@ "value": "true", "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 4, + "type": "Program", + "start": 564, + "end": 568, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 564, + "end": 568, + "loc": { + "start": { + "line": 29, + "column": 25 + }, + "end": { + "line": 29, + "column": 29 + } + }, + "value": true, + "raw": "true", + "range": [ + 564, + 568 + ] + }, + "start": 564, + "end": 568, + "loc": { + "start": { + "line": 29, + "column": 25 + }, + "end": { + "line": 29, + "column": 29 + } + }, + "range": [ + 564, + 568 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 29, + "column": 25 }, "end": { - "line": 1, - "column": 4 + "line": 29, + "column": 29 } }, - "value": true, - "raw": "true" + "range": [ + 564, + 568 + ] } } } @@ -933,35 +1341,106 @@ "value": "...props", "data": { "estree": { - "type": "SpreadElement", - "start": 3, - "end": 11, + "type": "Program", + "start": 633, + "end": 641, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 633, + "end": 641, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 19 + } + }, + "properties": [ + { + "type": "SpreadElement", + "start": 633, + "end": 641, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 19 + } + }, + "argument": { + "type": "Identifier", + "start": 636, + "end": 641, + "loc": { + "start": { + "line": 33, + "column": 14 + }, + "end": { + "line": 33, + "column": 19 + } + }, + "name": "props", + "range": [ + 636, + 641 + ] + }, + "range": [ + 633, + 641 + ] + } + ], + "range": [ + 633, + 641 + ] + }, + "start": 633, + "end": 641, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 19 + } + }, + "range": [ + 633, + 641 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 3 + "line": 33, + "column": 11 }, "end": { - "line": 1, - "column": 11 + "line": 33, + "column": 19 } }, - "argument": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "props" - } + "range": [ + 633, + 641 + ] } } } @@ -992,20 +1471,66 @@ "value": "className", "data": { "estree": { - "type": "Identifier", - "start": 0, - "end": 9, + "type": "Program", + "start": 666, + "end": 675, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "start": 666, + "end": 675, + "loc": { + "start": { + "line": 35, + "column": 19 + }, + "end": { + "line": 35, + "column": 28 + } + }, + "name": "className", + "range": [ + 666, + 675 + ] + }, + "start": 666, + "end": 675, + "loc": { + "start": { + "line": 35, + "column": 19 + }, + "end": { + "line": 35, + "column": 28 + } + }, + "range": [ + 666, + 675 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 35, + "column": 19 }, "end": { - "line": 1, - "column": 9 + "line": 35, + "column": 28 } }, - "name": "className" + "range": [ + 666, + 675 + ] } } } @@ -1015,35 +1540,106 @@ "value": "...other", "data": { "estree": { - "type": "SpreadElement", - "start": 3, - "end": 11, + "type": "Program", + "start": 678, + "end": 686, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 678, + "end": 686, + "loc": { + "start": { + "line": 35, + "column": 31 + }, + "end": { + "line": 35, + "column": 39 + } + }, + "properties": [ + { + "type": "SpreadElement", + "start": 678, + "end": 686, + "loc": { + "start": { + "line": 35, + "column": 31 + }, + "end": { + "line": 35, + "column": 39 + } + }, + "argument": { + "type": "Identifier", + "start": 681, + "end": 686, + "loc": { + "start": { + "line": 35, + "column": 34 + }, + "end": { + "line": 35, + "column": 39 + } + }, + "name": "other", + "range": [ + 681, + 686 + ] + }, + "range": [ + 678, + 686 + ] + } + ], + "range": [ + 678, + 686 + ] + }, + "start": 678, + "end": 686, + "loc": { + "start": { + "line": 35, + "column": 31 + }, + "end": { + "line": 35, + "column": 39 + } + }, + "range": [ + 678, + 686 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 3 + "line": 35, + "column": 31 }, "end": { - "line": 1, - "column": 11 + "line": 35, + "column": 39 } }, - "argument": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "other" - } + "range": [ + 678, + 686 + ] } } } @@ -1084,117 +1680,183 @@ "value": "() => console.log(\"clicked!\")", "data": { "estree": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "id": null, - "expression": true, - "generator": false, - "async": false, - "params": [], - "body": { - "type": "CallExpression", - "start": 6, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "callee": { - "type": "MemberExpression", - "start": 6, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "object": { - "type": "Identifier", - "start": 6, - "end": 13, + "type": "Program", + "start": 732, + "end": 761, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "start": 732, + "end": 761, "loc": { "start": { - "line": 1, - "column": 6 + "line": 38, + "column": 34 }, "end": { - "line": 1, - "column": 13 + "line": 38, + "column": 63 } }, - "name": "console" - }, - "property": { - "type": "Identifier", - "start": 14, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 14 + "id": null, + "expression": true, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "CallExpression", + "start": 738, + "end": 761, + "loc": { + "start": { + "line": 38, + "column": 40 + }, + "end": { + "line": 38, + "column": 63 + } }, - "end": { - "line": 1, - "column": 17 - } + "callee": { + "type": "MemberExpression", + "start": 738, + "end": 749, + "loc": { + "start": { + "line": 38, + "column": 40 + }, + "end": { + "line": 38, + "column": 51 + } + }, + "object": { + "type": "Identifier", + "start": 738, + "end": 745, + "loc": { + "start": { + "line": 38, + "column": 40 + }, + "end": { + "line": 38, + "column": 47 + } + }, + "name": "console", + "range": [ + 738, + 745 + ] + }, + "property": { + "type": "Identifier", + "start": 746, + "end": 749, + "loc": { + "start": { + "line": 38, + "column": 48 + }, + "end": { + "line": 38, + "column": 51 + } + }, + "name": "log", + "range": [ + 746, + 749 + ] + }, + "computed": false, + "optional": false, + "range": [ + 738, + 749 + ] + }, + "arguments": [ + { + "type": "Literal", + "start": 750, + "end": 760, + "loc": { + "start": { + "line": 38, + "column": 52 + }, + "end": { + "line": 38, + "column": 62 + } + }, + "value": "clicked!", + "raw": "\"clicked!\"", + "range": [ + 750, + 760 + ] + } + ], + "optional": false, + "range": [ + 738, + 761 + ] }, - "name": "log" + "range": [ + 732, + 761 + ] }, - "computed": false, - "optional": false - }, - "arguments": [ - { - "type": "Literal", - "start": 18, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } + "start": 732, + "end": 761, + "loc": { + "start": { + "line": 38, + "column": 34 }, - "value": "clicked!", - "raw": "\"clicked!\"" - } - ], - "optional": false - } - } - } - } - } - ], - "children": [ - { - "type": "paragraph", - "children": [ + "end": { + "line": 38, + "column": 63 + } + }, + "range": [ + 732, + 761 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 38, + "column": 34 + }, + "end": { + "line": 38, + "column": 63 + } + }, + "range": [ + 732, + 761 + ] + } + } + } + } + ], + "children": [ + { + "type": "paragraph", + "children": [ { "type": "text", "value": "Hello World!", @@ -1871,21 +2533,67 @@ }, "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 5, + "type": "Program", + "start": 1219, + "end": 1224, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 1219, + "end": 1224, + "value": "foo", + "raw": "'foo'", + "loc": { + "start": { + "line": 79, + "column": 14 + }, + "end": { + "line": 79, + "column": 19 + } + }, + "range": [ + 1219, + 1224 + ] + }, + "start": 1219, + "end": 1224, + "loc": { + "start": { + "line": 79, + "column": 14 + }, + "end": { + "line": 79, + "column": 19 + } + }, + "range": [ + 1219, + 1224 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 79, + "column": 14 }, "end": { - "line": 1, - "column": 5 + "line": 79, + "column": 19 } }, - "value": "foo", - "raw": "'foo'" + "range": [ + 1219, + 1224 + ] } } } @@ -1939,283 +2647,393 @@ }, "data": { "estree": { - "type": "CallExpression", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 64 - } - }, - "callee": { - "type": "MemberExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "todos" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "map" - }, - "computed": false, - "optional": false - }, - "arguments": [ + "type": "Program", + "start": 1249, + "end": 1313, + "body": [ { - "type": "ArrowFunctionExpression", - "start": 10, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 63 - } - }, - "id": null, - "expression": true, - "generator": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 11, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 11 + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "start": 1249, + "end": 1313, + "callee": { + "type": "MemberExpression", + "start": 1249, + "end": 1258, + "object": { + "type": "Identifier", + "start": 1249, + "end": 1254, + "name": "todos", + "loc": { + "start": { + "line": 82, + "column": 3 + }, + "end": { + "line": 82, + "column": 8 + } }, - "end": { - "line": 1, - "column": 18 - } + "range": [ + 1249, + 1254 + ] }, - "name": "message" - } - ], - "body": { - "type": "JSXElement", - "start": 23, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 23 + "property": { + "type": "Identifier", + "start": 1255, + "end": 1258, + "name": "map", + "loc": { + "start": { + "line": 82, + "column": 9 + }, + "end": { + "line": 82, + "column": 12 + } + }, + "range": [ + 1255, + 1258 + ] }, - "end": { - "line": 1, - "column": 63 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 23, - "end": 63, + "computed": false, + "optional": false, "loc": { "start": { - "line": 1, - "column": 23 + "line": 82, + "column": 3 }, "end": { - "line": 1, - "column": 63 + "line": 82, + "column": 12 } }, - "attributes": [ - { - "type": "JSXAttribute", - "start": 29, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 29, - "end": 32, + "range": [ + 1249, + 1258 + ] + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "start": 1259, + "end": 1312, + "id": null, + "expression": true, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 1260, + "end": 1267, + "name": "message", "loc": { "start": { - "line": 1, - "column": 29 + "line": 82, + "column": 14 }, "end": { - "line": 1, - "column": 32 + "line": 82, + "column": 21 } }, - "name": "key" - }, - "value": { - "type": "JSXExpressionContainer", - "start": 33, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 33 + "range": [ + 1260, + 1267 + ] + } + ], + "body": { + "type": "JSXElement", + "start": 1272, + "end": 1312, + "openingElement": { + "type": "JSXOpeningElement", + "start": 1272, + "end": 1312, + "attributes": [ + { + "type": "JSXAttribute", + "start": 1278, + "end": 1291, + "name": { + "type": "JSXIdentifier", + "start": 1278, + "end": 1281, + "name": "key", + "loc": { + "start": { + "line": 82, + "column": 32 + }, + "end": { + "line": 82, + "column": 35 + } + }, + "range": [ + 1278, + 1281 + ] + }, + "value": { + "type": "JSXExpressionContainer", + "start": 1282, + "end": 1291, + "expression": { + "type": "Identifier", + "start": 1283, + "end": 1290, + "name": "message", + "loc": { + "start": { + "line": 82, + "column": 37 + }, + "end": { + "line": 82, + "column": 44 + } + }, + "range": [ + 1283, + 1290 + ] + }, + "loc": { + "start": { + "line": 82, + "column": 36 + }, + "end": { + "line": 82, + "column": 45 + } + }, + "range": [ + 1282, + 1291 + ] + }, + "loc": { + "start": { + "line": 82, + "column": 32 + }, + "end": { + "line": 82, + "column": 45 + } + }, + "range": [ + 1278, + 1291 + ] }, - "end": { - "line": 1, - "column": 42 + { + "type": "JSXAttribute", + "start": 1292, + "end": 1309, + "name": { + "type": "JSXIdentifier", + "start": 1292, + "end": 1299, + "name": "message", + "loc": { + "start": { + "line": 82, + "column": 46 + }, + "end": { + "line": 82, + "column": 53 + } + }, + "range": [ + 1292, + 1299 + ] + }, + "value": { + "type": "JSXExpressionContainer", + "start": 1300, + "end": 1309, + "expression": { + "type": "Identifier", + "start": 1301, + "end": 1308, + "name": "message", + "loc": { + "start": { + "line": 82, + "column": 55 + }, + "end": { + "line": 82, + "column": 62 + } + }, + "range": [ + 1301, + 1308 + ] + }, + "loc": { + "start": { + "line": 82, + "column": 54 + }, + "end": { + "line": 82, + "column": 63 + } + }, + "range": [ + 1300, + 1309 + ] + }, + "loc": { + "start": { + "line": 82, + "column": 46 + }, + "end": { + "line": 82, + "column": 63 + } + }, + "range": [ + 1292, + 1309 + ] } - }, - "expression": { - "type": "Identifier", - "start": 34, - "end": 41, + ], + "name": { + "type": "JSXIdentifier", + "start": 1273, + "end": 1277, + "name": "Item", "loc": { "start": { - "line": 1, - "column": 34 + "line": 82, + "column": 27 }, "end": { - "line": 1, - "column": 41 + "line": 82, + "column": 31 } }, - "name": "message" - } - } - }, - { - "type": "JSXAttribute", - "start": 43, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 43 + "range": [ + 1273, + 1277 + ] }, - "end": { - "line": 1, - "column": 60 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 43, - "end": 50, + "selfClosing": true, "loc": { "start": { - "line": 1, - "column": 43 + "line": 82, + "column": 26 }, "end": { - "line": 1, - "column": 50 + "line": 82, + "column": 66 } }, - "name": "message" + "range": [ + 1272, + 1312 + ] }, - "value": { - "type": "JSXExpressionContainer", - "start": 51, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 60 - } + "closingElement": null, + "children": [], + "loc": { + "start": { + "line": 82, + "column": 26 }, - "expression": { - "type": "Identifier", - "start": 52, - "end": 59, - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 59 - } - }, - "name": "message" + "end": { + "line": 82, + "column": 66 } - } - } - ], - "name": { - "type": "JSXIdentifier", - "start": 24, - "end": 28, + }, + "range": [ + 1272, + 1312 + ] + }, "loc": { "start": { - "line": 1, - "column": 24 + "line": 82, + "column": 13 }, "end": { - "line": 1, - "column": 28 + "line": 82, + "column": 66 } }, - "name": "Item" + "range": [ + 1259, + 1312 + ] + } + ], + "optional": false, + "loc": { + "start": { + "line": 82, + "column": 3 }, - "selfClosing": true + "end": { + "line": 82, + "column": 67 + } }, - "closingElement": null, - "children": [] - } + "range": [ + 1249, + 1313 + ] + }, + "start": 1249, + "end": 1313, + "loc": { + "start": { + "line": 82, + "column": 3 + }, + "end": { + "line": 82, + "column": 67 + } + }, + "range": [ + 1249, + 1313 + ] } ], - "optional": false + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 82, + "column": 3 + }, + "end": { + "line": 82, + "column": 67 + } + }, + "range": [ + 1249, + 1313 + ] } } } @@ -2274,53 +3092,107 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 15, + "type": "Program", + "start": 1334, + "end": 1349, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 1334, + "end": 1349, + "object": { + "type": "Identifier", + "start": 1334, + "end": 1339, + "name": "props", + "loc": { + "start": { + "line": 85, + "column": 12 + }, + "end": { + "line": 85, + "column": 17 + } + }, + "range": [ + 1334, + 1339 + ] + }, + "property": { + "type": "Identifier", + "start": 1340, + "end": 1349, + "name": "addressee", + "loc": { + "start": { + "line": 85, + "column": 18 + }, + "end": { + "line": 85, + "column": 27 + } + }, + "range": [ + 1340, + 1349 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 85, + "column": 12 + }, + "end": { + "line": 85, + "column": 27 + } + }, + "range": [ + 1334, + 1349 + ] + }, + "start": 1334, + "end": 1349, + "loc": { + "start": { + "line": 85, + "column": 12 + }, + "end": { + "line": 85, + "column": 27 + } + }, + "range": [ + 1334, + 1349 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 85, + "column": 12 }, "end": { - "line": 1, - "column": 15 + "line": 85, + "column": 27 } }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "name": "addressee" - }, - "computed": false, - "optional": false + "range": [ + 1334, + 1349 + ] } } }, @@ -2380,21 +3252,67 @@ "value": "10", "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 2, + "type": "Program", + "start": 1377, + "end": 1379, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 1377, + "end": 1379, + "loc": { + "start": { + "line": 87, + "column": 18 + }, + "end": { + "line": 87, + "column": 20 + } + }, + "value": 10, + "raw": "10", + "range": [ + 1377, + 1379 + ] + }, + "start": 1377, + "end": 1379, + "loc": { + "start": { + "line": 87, + "column": 18 + }, + "end": { + "line": 87, + "column": 20 + } + }, + "range": [ + 1377, + 1379 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 87, + "column": 18 }, "end": { - "line": 1, - "column": 2 + "line": 87, + "column": 20 } }, - "value": 10, - "raw": "10" + "range": [ + 1377, + 1379 + ] } } } @@ -2418,250 +3336,352 @@ }, "data": { "estree": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 66 - } - }, - "id": null, - "expression": true, - "generator": false, - "async": false, - "params": [ + "type": "Program", + "start": 1385, + "end": 1451, + "body": [ { - "type": "Identifier", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "name": "index" - } - ], - "body": { - "type": "JSXElement", - "start": 11, - "end": 66, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 66 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 11, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "attributes": [ - { - "type": "JSXAttribute", - "start": 16, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 16 + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "start": 1385, + "end": 1451, + "id": null, + "expression": true, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 1386, + "end": 1391, + "name": "index", + "loc": { + "start": { + "line": 88, + "column": 4 + }, + "end": { + "line": 88, + "column": 9 + } }, - "end": { - "line": 1, - "column": 27 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 16, - "end": 19, + "range": [ + 1386, + 1391 + ] + } + ], + "body": { + "type": "JSXElement", + "start": 1396, + "end": 1451, + "openingElement": { + "type": "JSXOpeningElement", + "start": 1396, + "end": 1413, + "attributes": [ + { + "type": "JSXAttribute", + "start": 1401, + "end": 1412, + "name": { + "type": "JSXIdentifier", + "start": 1401, + "end": 1404, + "name": "key", + "loc": { + "start": { + "line": 88, + "column": 19 + }, + "end": { + "line": 88, + "column": 22 + } + }, + "range": [ + 1401, + 1404 + ] + }, + "value": { + "type": "JSXExpressionContainer", + "start": 1405, + "end": 1412, + "expression": { + "type": "Identifier", + "start": 1406, + "end": 1411, + "name": "index", + "loc": { + "start": { + "line": 88, + "column": 24 + }, + "end": { + "line": 88, + "column": 29 + } + }, + "range": [ + 1406, + 1411 + ] + }, + "loc": { + "start": { + "line": 88, + "column": 23 + }, + "end": { + "line": 88, + "column": 30 + } + }, + "range": [ + 1405, + 1412 + ] + }, + "loc": { + "start": { + "line": 88, + "column": 19 + }, + "end": { + "line": 88, + "column": 30 + } + }, + "range": [ + 1401, + 1412 + ] + } + ], + "name": { + "type": "JSXIdentifier", + "start": 1397, + "end": 1400, + "name": "div", + "loc": { + "start": { + "line": 88, + "column": 15 + }, + "end": { + "line": 88, + "column": 18 + } + }, + "range": [ + 1397, + 1400 + ] + }, + "selfClosing": false, "loc": { "start": { - "line": 1, - "column": 16 + "line": 88, + "column": 14 }, "end": { - "line": 1, - "column": 19 + "line": 88, + "column": 31 } }, - "name": "key" + "range": [ + 1396, + 1413 + ] }, - "value": { - "type": "JSXExpressionContainer", - "start": 20, - "end": 27, + "closingElement": { + "type": "JSXClosingElement", + "start": 1445, + "end": 1451, + "name": { + "type": "JSXIdentifier", + "start": 1447, + "end": 1450, + "name": "div", + "loc": { + "start": { + "line": 88, + "column": 65 + }, + "end": { + "line": 88, + "column": 68 + } + }, + "range": [ + 1447, + 1450 + ] + }, "loc": { "start": { - "line": 1, - "column": 20 + "line": 88, + "column": 63 }, "end": { - "line": 1, - "column": 27 + "line": 88, + "column": 69 } }, - "expression": { - "type": "Identifier", - "start": 21, - "end": 26, + "range": [ + 1445, + 1451 + ] + }, + "children": [ + { + "type": "JSXText", + "start": 1413, + "end": 1426, + "value": "This is item ", + "raw": "This is item ", "loc": { "start": { - "line": 1, - "column": 21 + "line": 88, + "column": 31 }, "end": { - "line": 1, - "column": 26 + "line": 88, + "column": 44 + } + }, + "range": [ + 1413, + 1426 + ] + }, + { + "type": "JSXExpressionContainer", + "start": 1426, + "end": 1433, + "expression": { + "type": "Identifier", + "start": 1427, + "end": 1432, + "name": "index", + "loc": { + "start": { + "line": 88, + "column": 45 + }, + "end": { + "line": 88, + "column": 50 + } + }, + "range": [ + 1427, + 1432 + ] + }, + "loc": { + "start": { + "line": 88, + "column": 44 + }, + "end": { + "line": 88, + "column": 51 + } + }, + "range": [ + 1426, + 1433 + ] + }, + { + "type": "JSXText", + "start": 1433, + "end": 1445, + "value": " in the list", + "raw": " in the list", + "loc": { + "start": { + "line": 88, + "column": 51 + }, + "end": { + "line": 88, + "column": 63 } }, - "name": "index" + "range": [ + 1433, + 1445 + ] } - } - } - ], - "name": { - "type": "JSXIdentifier", - "start": 12, - "end": 15, + ], + "loc": { + "start": { + "line": 88, + "column": 14 + }, + "end": { + "line": 88, + "column": 69 + } + }, + "range": [ + 1396, + 1451 + ] + }, "loc": { "start": { - "line": 1, - "column": 12 + "line": 88, + "column": 3 }, "end": { - "line": 1, - "column": 15 + "line": 88, + "column": 69 } }, - "name": "div" + "range": [ + 1385, + 1451 + ] }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 60, - "end": 66, + "start": 1385, + "end": 1451, "loc": { "start": { - "line": 1, - "column": 60 + "line": 88, + "column": 3 }, "end": { - "line": 1, - "column": 66 + "line": 88, + "column": 69 } }, - "name": { - "type": "JSXIdentifier", - "start": 62, - "end": 65, - "loc": { - "start": { - "line": 1, - "column": 62 - }, - "end": { - "line": 1, - "column": 65 - } - }, - "name": "div" - } + "range": [ + 1385, + 1451 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 88, + "column": 3 }, - "children": [ - { - "type": "JSXText", - "start": 28, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "value": "This is item ", - "raw": "This is item " - }, - { - "type": "JSXExpressionContainer", - "start": 41, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "expression": { - "type": "Identifier", - "start": 42, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "name": "index" - } - }, - { - "type": "JSXText", - "start": 48, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 60 - } - }, - "value": " in the list", - "raw": " in the list" - } - ] - } + "end": { + "line": 88, + "column": 69 + } + }, + "range": [ + 1385, + 1451 + ] } } } @@ -2740,21 +3760,67 @@ }, "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 5, + "type": "Program", + "start": 1492, + "end": 1497, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 1492, + "end": 1497, + "value": false, + "raw": "false", + "loc": { + "start": { + "line": 95, + "column": 6 + }, + "end": { + "line": 95, + "column": 11 + } + }, + "range": [ + 1492, + 1497 + ] + }, + "start": 1492, + "end": 1497, + "loc": { + "start": { + "line": 95, + "column": 6 + }, + "end": { + "line": 95, + "column": 11 + } + }, + "range": [ + 1492, + 1497 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 95, + "column": 6 }, "end": { - "line": 1, - "column": 5 + "line": 95, + "column": 11 } }, - "value": false, - "raw": "false" + "range": [ + 1492, + 1497 + ] } } } @@ -2811,21 +3877,67 @@ }, "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 4, + "type": "Program", + "start": 1512, + "end": 1516, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 1512, + "end": 1516, + "value": null, + "raw": "null", + "loc": { + "start": { + "line": 97, + "column": 6 + }, + "end": { + "line": 97, + "column": 10 + } + }, + "range": [ + 1512, + 1516 + ] + }, + "start": 1512, + "end": 1516, + "loc": { + "start": { + "line": 97, + "column": 6 + }, + "end": { + "line": 97, + "column": 10 + } + }, + "range": [ + 1512, + 1516 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 97, + "column": 6 }, "end": { - "line": 1, - "column": 4 + "line": 97, + "column": 10 } }, - "value": null, - "raw": "null" + "range": [ + 1512, + 1516 + ] } } } @@ -2882,20 +3994,66 @@ }, "data": { "estree": { - "type": "Identifier", - "start": 0, - "end": 9, + "type": "Program", + "start": 1531, + "end": 1540, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "start": 1531, + "end": 1540, + "name": "undefined", + "loc": { + "start": { + "line": 99, + "column": 6 + }, + "end": { + "line": 99, + "column": 15 + } + }, + "range": [ + 1531, + 1540 + ] + }, + "start": 1531, + "end": 1540, + "loc": { + "start": { + "line": 99, + "column": 6 + }, + "end": { + "line": 99, + "column": 15 + } + }, + "range": [ + 1531, + 1540 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 99, + "column": 6 }, "end": { - "line": 1, - "column": 9 + "line": 99, + "column": 15 } }, - "name": "undefined" + "range": [ + 1531, + 1540 + ] } } } @@ -2952,21 +4110,67 @@ }, "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 4, + "type": "Program", + "start": 1555, + "end": 1559, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 1555, + "end": 1559, + "value": true, + "raw": "true", + "loc": { + "start": { + "line": 101, + "column": 6 + }, + "end": { + "line": 101, + "column": 10 + } + }, + "range": [ + 1555, + 1559 + ] + }, + "start": 1555, + "end": 1559, + "loc": { + "start": { + "line": 101, + "column": 6 + }, + "end": { + "line": 101, + "column": 10 + } + }, + "range": [ + 1555, + 1559 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 101, + "column": 6 }, "end": { - "line": 1, - "column": 4 + "line": 101, + "column": 10 } }, - "value": true, - "raw": "true" + "range": [ + 1555, + 1559 + ] } } } @@ -3020,86 +4224,148 @@ }, "data": { "estree": { - "type": "LogicalExpression", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "left": { - "type": "Identifier", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "showHeader" - }, - "operator": "&&", - "right": { - "type": "JSXElement", - "start": 14, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 14, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 14 + "type": "Program", + "start": 1577, + "end": 1601, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "start": 1577, + "end": 1601, + "left": { + "type": "Identifier", + "start": 1577, + "end": 1587, + "name": "showHeader", + "loc": { + "start": { + "line": 104, + "column": 3 + }, + "end": { + "line": 104, + "column": 13 + } + }, + "range": [ + 1577, + 1587 + ] + }, + "operator": "&&", + "right": { + "type": "JSXElement", + "start": 1591, + "end": 1601, + "openingElement": { + "type": "JSXOpeningElement", + "start": 1591, + "end": 1601, + "attributes": [], + "name": { + "type": "JSXIdentifier", + "start": 1592, + "end": 1598, + "name": "Header", + "loc": { + "start": { + "line": 104, + "column": 18 + }, + "end": { + "line": 104, + "column": 24 + } + }, + "range": [ + 1592, + 1598 + ] + }, + "selfClosing": true, + "loc": { + "start": { + "line": 104, + "column": 17 + }, + "end": { + "line": 104, + "column": 27 + } + }, + "range": [ + 1591, + 1601 + ] + }, + "closingElement": null, + "children": [], + "loc": { + "start": { + "line": 104, + "column": 17 + }, + "end": { + "line": 104, + "column": 27 + } + }, + "range": [ + 1591, + 1601 + ] }, - "end": { - "line": 1, - "column": 24 - } - }, - "attributes": [], - "name": { - "type": "JSXIdentifier", - "start": 15, - "end": 21, "loc": { "start": { - "line": 1, - "column": 15 + "line": 104, + "column": 3 }, "end": { - "line": 1, - "column": 21 + "line": 104, + "column": 27 } }, - "name": "Header" + "range": [ + 1577, + 1601 + ] + }, + "start": 1577, + "end": 1601, + "loc": { + "start": { + "line": 104, + "column": 3 + }, + "end": { + "line": 104, + "column": 27 + } }, - "selfClosing": true + "range": [ + 1577, + 1601 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 104, + "column": 3 }, - "closingElement": null, - "children": [] - } + "end": { + "line": 104, + "column": 27 + } + }, + "range": [ + 1577, + 1601 + ] } } }, @@ -3157,248 +4423,350 @@ }, "data": { "estree": { - "type": "LogicalExpression", - "start": 0, - "end": 70, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "left": { - "type": "MemberExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "object": { - "type": "MemberExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "messages" - }, - "computed": false, - "optional": false - }, - "property": { - "type": "Identifier", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "name": "length" - }, - "computed": false, - "optional": false - }, - "operator": "&&", - "right": { - "type": "JSXElement", - "start": 29, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 29, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "attributes": [ - { - "type": "JSXAttribute", - "start": 42, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 17 + "type": "Program", + "start": 1634, + "end": 1707, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "start": 1634, + "end": 1704, + "left": { + "type": "MemberExpression", + "start": 1634, + "end": 1655, + "object": { + "type": "MemberExpression", + "start": 1634, + "end": 1648, + "object": { + "type": "Identifier", + "start": 1634, + "end": 1639, + "name": "props", + "loc": { + "start": { + "line": 109, + "column": 3 + }, + "end": { + "line": 109, + "column": 8 + } + }, + "range": [ + 1634, + 1639 + ] }, - "end": { - "line": 2, - "column": 42 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 42, - "end": 50, + "property": { + "type": "Identifier", + "start": 1640, + "end": 1648, + "name": "messages", + "loc": { + "start": { + "line": 109, + "column": 9 + }, + "end": { + "line": 109, + "column": 17 + } + }, + "range": [ + 1640, + 1648 + ] + }, + "computed": false, + "optional": false, "loc": { "start": { - "line": 2, - "column": 17 + "line": 109, + "column": 3 }, "end": { - "line": 2, - "column": 25 + "line": 109, + "column": 17 } }, - "name": "messages" + "range": [ + 1634, + 1648 + ] }, - "value": { - "type": "JSXExpressionContainer", - "start": 51, - "end": 67, + "property": { + "type": "Identifier", + "start": 1649, + "end": 1655, + "name": "length", "loc": { "start": { - "line": 2, - "column": 26 + "line": 109, + "column": 18 }, "end": { - "line": 2, - "column": 42 + "line": 109, + "column": 24 } }, - "expression": { - "type": "MemberExpression", - "start": 52, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 27 + "range": [ + 1649, + 1655 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 109, + "column": 3 + }, + "end": { + "line": 109, + "column": 24 + } + }, + "range": [ + 1634, + 1655 + ] + }, + "operator": "&&", + "right": { + "type": "JSXElement", + "start": 1663, + "end": 1704, + "openingElement": { + "type": "JSXOpeningElement", + "start": 1663, + "end": 1704, + "attributes": [ + { + "type": "JSXAttribute", + "start": 1676, + "end": 1701, + "name": { + "type": "JSXIdentifier", + "start": 1676, + "end": 1684, + "name": "messages", + "loc": { + "start": { + "line": 109, + "column": 45 + }, + "end": { + "line": 109, + "column": 53 + } + }, + "range": [ + 1676, + 1684 + ] }, - "end": { - "line": 2, - "column": 41 - } - }, - "object": { - "type": "Identifier", - "start": 52, - "end": 57, - "loc": { - "start": { - "line": 2, - "column": 27 + "value": { + "type": "JSXExpressionContainer", + "start": 1685, + "end": 1701, + "expression": { + "type": "MemberExpression", + "start": 1686, + "end": 1700, + "object": { + "type": "Identifier", + "start": 1686, + "end": 1691, + "name": "props", + "loc": { + "start": { + "line": 109, + "column": 55 + }, + "end": { + "line": 109, + "column": 60 + } + }, + "range": [ + 1686, + 1691 + ] + }, + "property": { + "type": "Identifier", + "start": 1692, + "end": 1700, + "name": "messages", + "loc": { + "start": { + "line": 109, + "column": 61 + }, + "end": { + "line": 109, + "column": 69 + } + }, + "range": [ + 1692, + 1700 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 109, + "column": 55 + }, + "end": { + "line": 109, + "column": 69 + } + }, + "range": [ + 1686, + 1700 + ] }, - "end": { - "line": 2, - "column": 32 - } + "loc": { + "start": { + "line": 109, + "column": 54 + }, + "end": { + "line": 109, + "column": 70 + } + }, + "range": [ + 1685, + 1701 + ] }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 58, - "end": 66, "loc": { "start": { - "line": 2, - "column": 33 + "line": 109, + "column": 45 }, "end": { - "line": 2, - "column": 41 + "line": 109, + "column": 70 } }, - "name": "messages" + "range": [ + 1676, + 1701 + ] + } + ], + "name": { + "type": "JSXIdentifier", + "start": 1664, + "end": 1675, + "name": "MessageList", + "loc": { + "start": { + "line": 109, + "column": 33 + }, + "end": { + "line": 109, + "column": 44 + } }, - "computed": false, - "optional": false + "range": [ + 1664, + 1675 + ] + }, + "selfClosing": true, + "loc": { + "start": { + "line": 109, + "column": 32 + }, + "end": { + "line": 109, + "column": 73 + } + }, + "range": [ + 1663, + 1704 + ] + }, + "closingElement": null, + "children": [], + "loc": { + "start": { + "line": 109, + "column": 32 + }, + "end": { + "line": 109, + "column": 73 } - } - } - ], - "name": { - "type": "JSXIdentifier", - "start": 30, - "end": 41, + }, + "range": [ + 1663, + 1704 + ] + }, "loc": { "start": { - "line": 2, - "column": 5 + "line": 109, + "column": 3 }, "end": { - "line": 2, - "column": 16 + "line": 109, + "column": 73 } }, - "name": "MessageList" + "range": [ + 1634, + 1704 + ] }, - "selfClosing": true + "start": 1634, + "end": 1707, + "loc": { + "start": { + "line": 109, + "column": 3 + }, + "end": { + "line": 109, + "column": 76 + } + }, + "range": [ + 1634, + 1707 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 109, + "column": 3 }, - "closingElement": null, - "children": [] - } + "end": { + "line": 109, + "column": 76 + } + }, + "range": [ + 1634, + 1707 + ] } } } @@ -3438,281 +4806,391 @@ }, "data": { "estree": { - "type": "LogicalExpression", - "start": 0, - "end": 74, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "left": { - "type": "BinaryExpression", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "object": { - "type": "MemberExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 6 + "type": "Program", + "start": 1726, + "end": 1803, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "start": 1726, + "end": 1800, + "left": { + "type": "BinaryExpression", + "start": 1726, + "end": 1751, + "left": { + "type": "MemberExpression", + "start": 1726, + "end": 1747, + "object": { + "type": "MemberExpression", + "start": 1726, + "end": 1740, + "object": { + "type": "Identifier", + "start": 1726, + "end": 1731, + "name": "props", + "loc": { + "start": { + "line": 115, + "column": 3 + }, + "end": { + "line": 115, + "column": 8 + } + }, + "range": [ + 1726, + 1731 + ] + }, + "property": { + "type": "Identifier", + "start": 1732, + "end": 1740, + "name": "messages", + "loc": { + "start": { + "line": 115, + "column": 9 + }, + "end": { + "line": 115, + "column": 17 + } + }, + "range": [ + 1732, + 1740 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 115, + "column": 3 + }, + "end": { + "line": 115, + "column": 17 + } + }, + "range": [ + 1726, + 1740 + ] }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "messages" - }, - "computed": false, - "optional": false - }, - "property": { - "type": "Identifier", - "start": 15, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "name": "length" - }, - "computed": false, - "optional": false - }, - "operator": ">", - "right": { - "type": "Literal", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "value": 0, - "raw": "0" - } - }, - "operator": "&&", - "right": { - "type": "JSXElement", - "start": 33, - "end": 74, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 33, - "end": 74, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "attributes": [ - { - "type": "JSXAttribute", - "start": 46, - "end": 71, - "loc": { - "start": { - "line": 2, - "column": 17 + "property": { + "type": "Identifier", + "start": 1741, + "end": 1747, + "name": "length", + "loc": { + "start": { + "line": 115, + "column": 18 + }, + "end": { + "line": 115, + "column": 24 + } + }, + "range": [ + 1741, + 1747 + ] }, - "end": { - "line": 2, - "column": 42 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 46, - "end": 54, + "computed": false, + "optional": false, "loc": { "start": { - "line": 2, - "column": 17 + "line": 115, + "column": 3 }, "end": { - "line": 2, - "column": 25 + "line": 115, + "column": 24 } }, - "name": "messages" + "range": [ + 1726, + 1747 + ] }, - "value": { - "type": "JSXExpressionContainer", - "start": 55, - "end": 71, + "operator": ">", + "right": { + "type": "Literal", + "start": 1750, + "end": 1751, + "value": 0, + "raw": "0", "loc": { "start": { - "line": 2, - "column": 26 + "line": 115, + "column": 27 }, "end": { - "line": 2, - "column": 42 + "line": 115, + "column": 28 } }, - "expression": { - "type": "MemberExpression", - "start": 56, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 27 + "range": [ + 1750, + 1751 + ] + }, + "loc": { + "start": { + "line": 115, + "column": 3 + }, + "end": { + "line": 115, + "column": 28 + } + }, + "range": [ + 1726, + 1751 + ] + }, + "operator": "&&", + "right": { + "type": "JSXElement", + "start": 1759, + "end": 1800, + "openingElement": { + "type": "JSXOpeningElement", + "start": 1759, + "end": 1800, + "attributes": [ + { + "type": "JSXAttribute", + "start": 1772, + "end": 1797, + "name": { + "type": "JSXIdentifier", + "start": 1772, + "end": 1780, + "name": "messages", + "loc": { + "start": { + "line": 115, + "column": 49 + }, + "end": { + "line": 115, + "column": 57 + } + }, + "range": [ + 1772, + 1780 + ] }, - "end": { - "line": 2, - "column": 41 - } - }, - "object": { - "type": "Identifier", - "start": 56, - "end": 61, - "loc": { - "start": { - "line": 2, - "column": 27 + "value": { + "type": "JSXExpressionContainer", + "start": 1781, + "end": 1797, + "expression": { + "type": "MemberExpression", + "start": 1782, + "end": 1796, + "object": { + "type": "Identifier", + "start": 1782, + "end": 1787, + "name": "props", + "loc": { + "start": { + "line": 115, + "column": 59 + }, + "end": { + "line": 115, + "column": 64 + } + }, + "range": [ + 1782, + 1787 + ] + }, + "property": { + "type": "Identifier", + "start": 1788, + "end": 1796, + "name": "messages", + "loc": { + "start": { + "line": 115, + "column": 65 + }, + "end": { + "line": 115, + "column": 73 + } + }, + "range": [ + 1788, + 1796 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 115, + "column": 59 + }, + "end": { + "line": 115, + "column": 73 + } + }, + "range": [ + 1782, + 1796 + ] }, - "end": { - "line": 2, - "column": 32 - } + "loc": { + "start": { + "line": 115, + "column": 58 + }, + "end": { + "line": 115, + "column": 74 + } + }, + "range": [ + 1781, + 1797 + ] }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 62, - "end": 70, "loc": { "start": { - "line": 2, - "column": 33 + "line": 115, + "column": 49 }, "end": { - "line": 2, - "column": 41 + "line": 115, + "column": 74 } }, - "name": "messages" + "range": [ + 1772, + 1797 + ] + } + ], + "name": { + "type": "JSXIdentifier", + "start": 1760, + "end": 1771, + "name": "MessageList", + "loc": { + "start": { + "line": 115, + "column": 37 + }, + "end": { + "line": 115, + "column": 48 + } }, - "computed": false, - "optional": false + "range": [ + 1760, + 1771 + ] + }, + "selfClosing": true, + "loc": { + "start": { + "line": 115, + "column": 36 + }, + "end": { + "line": 115, + "column": 77 + } + }, + "range": [ + 1759, + 1800 + ] + }, + "closingElement": null, + "children": [], + "loc": { + "start": { + "line": 115, + "column": 36 + }, + "end": { + "line": 115, + "column": 77 } - } - } - ], - "name": { - "type": "JSXIdentifier", - "start": 34, - "end": 45, + }, + "range": [ + 1759, + 1800 + ] + }, "loc": { "start": { - "line": 2, - "column": 5 + "line": 115, + "column": 3 }, "end": { - "line": 2, - "column": 16 + "line": 115, + "column": 77 } }, - "name": "MessageList" + "range": [ + 1726, + 1800 + ] + }, + "start": 1726, + "end": 1803, + "loc": { + "start": { + "line": 115, + "column": 3 + }, + "end": { + "line": 115, + "column": 80 + } }, - "selfClosing": true + "range": [ + 1726, + 1803 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 115, + "column": 3 }, - "closingElement": null, - "children": [] - } + "end": { + "line": 115, + "column": 80 + } + }, + "range": [ + 1726, + 1803 + ] } } } @@ -3771,54 +5249,108 @@ }, "data": { "estree": { - "type": "CallExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "callee": { - "type": "Identifier", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "name": "String" - }, - "arguments": [ + "type": "Program", + "start": 1848, + "end": 1866, + "body": [ { - "type": "Identifier", - "start": 7, - "end": 17, + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "start": 1848, + "end": 1866, + "callee": { + "type": "Identifier", + "start": 1848, + "end": 1854, + "name": "String", + "loc": { + "start": { + "line": 121, + "column": 29 + }, + "end": { + "line": 121, + "column": 35 + } + }, + "range": [ + 1848, + 1854 + ] + }, + "arguments": [ + { + "type": "Identifier", + "start": 1855, + "end": 1865, + "name": "myVariable", + "loc": { + "start": { + "line": 121, + "column": 36 + }, + "end": { + "line": 121, + "column": 46 + } + }, + "range": [ + 1855, + 1865 + ] + } + ], + "optional": false, + "loc": { + "start": { + "line": 121, + "column": 29 + }, + "end": { + "line": 121, + "column": 47 + } + }, + "range": [ + 1848, + 1866 + ] + }, + "start": 1848, + "end": 1866, "loc": { "start": { - "line": 1, - "column": 7 + "line": 121, + "column": 29 }, "end": { - "line": 1, - "column": 17 + "line": 121, + "column": 47 } }, - "name": "myVariable" + "range": [ + 1848, + 1866 + ] } ], - "optional": false + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 121, + "column": 29 + }, + "end": { + "line": 121, + "column": 47 + } + }, + "range": [ + 1848, + 1866 + ] } } }, diff --git a/packages/remark-mdx/test/fixtures/expressions.json b/packages/remark-mdx/test/fixtures/expressions.json index 25a322b9d..0001a56e1 100644 --- a/packages/remark-mdx/test/fixtures/expressions.json +++ b/packages/remark-mdx/test/fixtures/expressions.json @@ -81,41 +81,91 @@ "value": "`\n// Blank line in attribute\n\n// …expression.\n`", "data": { "estree": { - "type": "TemplateLiteral", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "expressions": [], - "quasis": [ + "type": "Program", + "start": 64, + "end": 115, + "body": [ { - "type": "TemplateElement", - "start": 1, - "end": 50, + "type": "ExpressionStatement", + "expression": { + "type": "TemplateLiteral", + "start": 64, + "end": 115, + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 57 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 65, + "end": 114, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 56 + } + }, + "value": { + "raw": "\n // Blank line in attribute\n\n // …expression.\n", + "cooked": "\n // Blank line in attribute\n\n // …expression.\n" + }, + "tail": true, + "range": [ + 65, + 114 + ] + } + ], + "range": [ + 64, + 115 + ] + }, + "start": 64, + "end": 115, "loc": { "start": { - "line": 1, - "column": 1 + "line": 5, + "column": 6 }, "end": { "line": 5, - "column": 0 + "column": 57 } }, - "value": { - "raw": "\n // Blank line in attribute\n\n // …expression.\n", - "cooked": "\n // Blank line in attribute\n\n // …expression.\n" - }, - "tail": true + "range": [ + 64, + 115 + ] } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 57 + } + }, + "range": [ + 64, + 115 ] } } @@ -182,72 +232,130 @@ "value": "{z: true}", "data": { "estree": { - "type": "ObjectExpression", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "properties": [ + "type": "Program", + "start": 158, + "end": 167, + "body": [ { - "type": "Property", - "start": 1, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 1, - "end": 2, + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 158, + "end": 167, "loc": { "start": { - "line": 1, - "column": 1 + "line": 13, + "column": 31 }, "end": { - "line": 1, - "column": 2 + "line": 13, + "column": 40 } }, - "name": "z" - }, - "value": { - "type": "Literal", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 + "properties": [ + { + "type": "Property", + "start": 159, + "end": 166, + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 39 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 159, + "end": 160, + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 33 + } + }, + "name": "z", + "range": [ + 159, + 160 + ] + }, + "value": { + "type": "Literal", + "start": 162, + "end": 166, + "loc": { + "start": { + "line": 13, + "column": 35 + }, + "end": { + "line": 13, + "column": 39 + } + }, + "value": true, + "raw": "true", + "range": [ + 162, + 166 + ] + }, + "kind": "init", + "range": [ + 159, + 166 + ] } + ], + "range": [ + 158, + 167 + ] + }, + "start": 158, + "end": 167, + "loc": { + "start": { + "line": 13, + "column": 31 }, - "value": true, - "raw": "true" + "end": { + "line": 13, + "column": 40 + } }, - "kind": "init" + "range": [ + 158, + 167 + ] } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 13, + "column": 31 + }, + "end": { + "line": 13, + "column": 40 + } + }, + "range": [ + 158, + 167 ] } } @@ -325,35 +433,127 @@ "value": "/*stuff!*/...d", "data": { "estree": { - "type": "SpreadElement", - "start": 13, - "end": 17, + "type": "Program", + "start": 201, + "end": 215, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 201, + "end": 215, + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 18 + } + }, + "properties": [ + { + "type": "SpreadElement", + "start": 211, + "end": 215, + "loc": { + "start": { + "line": 17, + "column": 14 + }, + "end": { + "line": 17, + "column": 18 + } + }, + "argument": { + "type": "Identifier", + "start": 214, + "end": 215, + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 18 + } + }, + "name": "d", + "range": [ + 214, + 215 + ] + }, + "range": [ + 211, + 215 + ] + } + ], + "range": [ + 201, + 215 + ] + }, + "start": 201, + "end": 215, + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 18 + } + }, + "range": [ + 201, + 215 + ] + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Block", + "value": "stuff!", + "start": 201, + "end": 211, + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 14 + } + }, + "range": [ + 201, + 211 + ] + } + ], "loc": { "start": { - "line": 1, - "column": 13 + "line": 17, + "column": 4 }, "end": { - "line": 1, - "column": 17 + "line": 17, + "column": 18 } }, - "argument": { - "type": "Identifier", - "start": 16, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "d" - } + "range": [ + 201, + 215 + ] } } } @@ -415,140 +615,235 @@ "value": "...{x: '1', z: \"zulu\"}", "data": { "estree": { - "type": "SpreadElement", - "start": 3, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "argument": { - "type": "ObjectExpression", - "start": 6, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "properties": [ - { - "type": "Property", - "start": 7, - "end": 13, + "type": "Program", + "start": 244, + "end": 266, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 244, + "end": 266, "loc": { "start": { - "line": 1, - "column": 7 + "line": 21, + "column": 17 }, "end": { - "line": 1, - "column": 13 + "line": 21, + "column": 39 } }, - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 + "properties": [ + { + "type": "SpreadElement", + "start": 244, + "end": 266, + "loc": { + "start": { + "line": 21, + "column": 17 + }, + "end": { + "line": 21, + "column": 39 + } }, - "end": { - "line": 1, - "column": 8 - } - }, - "name": "x" - }, - "value": { - "type": "Literal", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 + "argument": { + "type": "ObjectExpression", + "start": 247, + "end": 266, + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 21, + "column": 39 + } + }, + "properties": [ + { + "type": "Property", + "start": 248, + "end": 254, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 27 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 248, + "end": 249, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 22 + } + }, + "name": "x", + "range": [ + 248, + 249 + ] + }, + "value": { + "type": "Literal", + "start": 251, + "end": 254, + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 27 + } + }, + "value": "1", + "raw": "'1'", + "range": [ + 251, + 254 + ] + }, + "kind": "init", + "range": [ + 248, + 254 + ] + }, + { + "type": "Property", + "start": 256, + "end": 265, + "loc": { + "start": { + "line": 21, + "column": 29 + }, + "end": { + "line": 21, + "column": 38 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 256, + "end": 257, + "loc": { + "start": { + "line": 21, + "column": 29 + }, + "end": { + "line": 21, + "column": 30 + } + }, + "name": "z", + "range": [ + 256, + 257 + ] + }, + "value": { + "type": "Literal", + "start": 259, + "end": 265, + "loc": { + "start": { + "line": 21, + "column": 32 + }, + "end": { + "line": 21, + "column": 38 + } + }, + "value": "zulu", + "raw": "\"zulu\"", + "range": [ + 259, + 265 + ] + }, + "kind": "init", + "range": [ + 256, + 265 + ] + } + ], + "range": [ + 247, + 266 + ] }, - "end": { - "line": 1, - "column": 13 - } - }, - "value": "1", - "raw": "'1'" - }, - "kind": "init" - }, - { - "type": "Property", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 + "range": [ + 244, + 266 + ] } + ], + "range": [ + 244, + 266 + ] + }, + "start": 244, + "end": 266, + "loc": { + "start": { + "line": 21, + "column": 17 }, - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "name": "z" - }, - "value": { - "type": "Literal", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "value": "zulu", - "raw": "\"zulu\"" - }, - "kind": "init" - } - ] - } + "end": { + "line": 21, + "column": 39 + } + }, + "range": [ + 244, + 266 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 21, + "column": 17 + }, + "end": { + "line": 21, + "column": 39 + } + }, + "range": [ + 244, + 266 + ] } } } @@ -666,53 +961,107 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 3, - "end": 10, + "type": "Program", + "start": 299, + "end": 310, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 302, + "end": 309, + "object": { + "type": "Identifier", + "start": 302, + "end": 306, + "name": "Math", + "loc": { + "start": { + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 8 + } + }, + "range": [ + 302, + 306 + ] + }, + "property": { + "type": "Identifier", + "start": 307, + "end": 309, + "name": "PI", + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 11 + } + }, + "range": [ + 307, + 309 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 11 + } + }, + "range": [ + 302, + 309 + ] + }, + "start": 299, + "end": 310, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 12 + } + }, + "range": [ + 299, + 310 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 2, - "column": 2 + "line": 27, + "column": 1 }, "end": { - "line": 2, - "column": 9 + "line": 27, + "column": 12 } }, - "object": { - "type": "Identifier", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "name": "Math" - }, - "property": { - "type": "Identifier", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "name": "PI" - }, - "computed": false, - "optional": false + "range": [ + 299, + 310 + ] } } }, @@ -767,140 +1116,214 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "object": { - "type": "ObjectExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "properties": [ - { - "type": "Property", - "start": 1, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 1, - "end": 2, + "type": "Program", + "start": 334, + "end": 349, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 334, + "end": 349, + "object": { + "type": "ObjectExpression", + "start": 334, + "end": 344, + "properties": [ + { + "type": "Property", + "start": 335, + "end": 343, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 335, + "end": 336, + "name": "a", + "loc": { + "start": { + "line": 33, + "column": 15 + }, + "end": { + "line": 33, + "column": 16 + } + }, + "range": [ + 335, + 336 + ] + }, + "value": { + "type": "BinaryExpression", + "start": 338, + "end": 343, + "left": { + "type": "Literal", + "start": 338, + "end": 339, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 33, + "column": 18 + }, + "end": { + "line": 33, + "column": 19 + } + }, + "range": [ + 338, + 339 + ] + }, + "operator": "+", + "right": { + "type": "Literal", + "start": 342, + "end": 343, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 33, + "column": 22 + }, + "end": { + "line": 33, + "column": 23 + } + }, + "range": [ + 342, + 343 + ] + }, + "loc": { + "start": { + "line": 33, + "column": 18 + }, + "end": { + "line": 33, + "column": 23 + } + }, + "range": [ + 338, + 343 + ] + }, + "kind": "init", + "loc": { + "start": { + "line": 33, + "column": 15 + }, + "end": { + "line": 33, + "column": 23 + } + }, + "range": [ + 335, + 343 + ] + } + ], "loc": { "start": { - "line": 1, - "column": 1 + "line": 33, + "column": 14 }, "end": { - "line": 1, - "column": 2 + "line": 33, + "column": 24 } }, - "name": "a" + "range": [ + 334, + 344 + ] }, - "value": { - "type": "BinaryExpression", - "start": 4, - "end": 9, + "property": { + "type": "Literal", + "start": 345, + "end": 348, + "value": "a", + "raw": "\"a\"", "loc": { "start": { - "line": 1, - "column": 4 + "line": 33, + "column": 25 }, "end": { - "line": 1, - "column": 9 + "line": 33, + "column": 28 } }, - "left": { - "type": "Literal", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "value": 1, - "raw": "1" + "range": [ + 345, + 348 + ] + }, + "computed": true, + "optional": false, + "loc": { + "start": { + "line": 33, + "column": 14 }, - "operator": "+", - "right": { - "type": "Literal", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "value": 1, - "raw": "1" + "end": { + "line": 33, + "column": 29 } }, - "kind": "init" - } - ] - }, - "property": { - "type": "Literal", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 + "range": [ + 334, + 349 + ] }, - "end": { - "line": 1, - "column": 14 - } + "start": 334, + "end": 349, + "loc": { + "start": { + "line": 33, + "column": 14 + }, + "end": { + "line": 33, + "column": 29 + } + }, + "range": [ + 334, + 349 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 33, + "column": 14 }, - "value": "a", - "raw": "\"a\"" + "end": { + "line": 33, + "column": 29 + } }, - "computed": true, - "optional": false + "range": [ + 334, + 349 + ] } } }, @@ -990,54 +1413,108 @@ }, "data": { "estree": { - "type": "BinaryExpression", - "start": 5, - "end": 10, + "type": "Program", + "start": 371, + "end": 384, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "start": 376, + "end": 381, + "left": { + "type": "Literal", + "start": 376, + "end": 377, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 38, + "column": 8 + }, + "end": { + "line": 38, + "column": 9 + } + }, + "range": [ + 376, + 377 + ] + }, + "operator": "+", + "right": { + "type": "Literal", + "start": 380, + "end": 381, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 38, + "column": 12 + }, + "end": { + "line": 38, + "column": 13 + } + }, + "range": [ + 380, + 381 + ] + }, + "loc": { + "start": { + "line": 38, + "column": 8 + }, + "end": { + "line": 38, + "column": 13 + } + }, + "range": [ + 376, + 381 + ] + }, + "start": 371, + "end": 384, + "loc": { + "start": { + "line": 38, + "column": 3 + }, + "end": { + "line": 38, + "column": 16 + } + }, + "range": [ + 371, + 384 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 2, - "column": 4 + "line": 38, + "column": 3 }, "end": { - "line": 2, - "column": 9 + "line": 38, + "column": 16 } }, - "left": { - "type": "Literal", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "value": 1, - "raw": "1" - }, - "operator": "+", - "right": { - "type": "Literal", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "value": 1, - "raw": "1" - } + "range": [ + 371, + 384 + ] } } } @@ -1127,140 +1604,214 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "object": { - "type": "ObjectExpression", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "properties": [ - { - "type": "Property", - "start": 1, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 1, - "end": 2, + "type": "Program", + "start": 415, + "end": 430, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 415, + "end": 430, + "object": { + "type": "ObjectExpression", + "start": 415, + "end": 425, + "properties": [ + { + "type": "Property", + "start": 416, + "end": 424, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 416, + "end": 417, + "name": "a", + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 18 + } + }, + "range": [ + 416, + 417 + ] + }, + "value": { + "type": "BinaryExpression", + "start": 419, + "end": 424, + "left": { + "type": "Literal", + "start": 419, + "end": 420, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 45, + "column": 20 + }, + "end": { + "line": 45, + "column": 21 + } + }, + "range": [ + 419, + 420 + ] + }, + "operator": "+", + "right": { + "type": "Literal", + "start": 423, + "end": 424, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 45, + "column": 24 + }, + "end": { + "line": 45, + "column": 25 + } + }, + "range": [ + 423, + 424 + ] + }, + "loc": { + "start": { + "line": 45, + "column": 20 + }, + "end": { + "line": 45, + "column": 25 + } + }, + "range": [ + 419, + 424 + ] + }, + "kind": "init", + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 25 + } + }, + "range": [ + 416, + 424 + ] + } + ], "loc": { "start": { - "line": 1, - "column": 1 + "line": 45, + "column": 16 }, "end": { - "line": 1, - "column": 2 + "line": 45, + "column": 26 } }, - "name": "a" + "range": [ + 415, + 425 + ] }, - "value": { - "type": "BinaryExpression", - "start": 4, - "end": 9, + "property": { + "type": "Literal", + "start": 426, + "end": 429, + "value": "a", + "raw": "\"a\"", "loc": { "start": { - "line": 1, - "column": 4 + "line": 45, + "column": 27 }, "end": { - "line": 1, - "column": 9 + "line": 45, + "column": 30 } }, - "left": { - "type": "Literal", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "value": 1, - "raw": "1" + "range": [ + 426, + 429 + ] + }, + "computed": true, + "optional": false, + "loc": { + "start": { + "line": 45, + "column": 16 }, - "operator": "+", - "right": { - "type": "Literal", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "value": 1, - "raw": "1" + "end": { + "line": 45, + "column": 31 } }, - "kind": "init" - } - ] - }, - "property": { - "type": "Literal", - "start": 11, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 11 + "range": [ + 415, + 430 + ] }, - "end": { - "line": 1, - "column": 14 - } + "start": 415, + "end": 430, + "loc": { + "start": { + "line": 45, + "column": 16 + }, + "end": { + "line": 45, + "column": 31 + } + }, + "range": [ + 415, + 430 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 45, + "column": 16 }, - "value": "a", - "raw": "\"a\"" + "end": { + "line": 45, + "column": 31 + } }, - "computed": true, - "optional": false + "range": [ + 415, + 430 + ] } } } diff --git a/packages/remark-mdx/test/fixtures/format-attributes.json b/packages/remark-mdx/test/fixtures/format-attributes.json index 990574a5a..0924eb400 100644 --- a/packages/remark-mdx/test/fixtures/format-attributes.json +++ b/packages/remark-mdx/test/fixtures/format-attributes.json @@ -196,21 +196,67 @@ "value": "\"echo\"", "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 6, + "type": "Program", + "start": 127, + "end": 133, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 127, + "end": 133, + "loc": { + "start": { + "line": 13, + "column": 34 + }, + "end": { + "line": 13, + "column": 40 + } + }, + "value": "echo", + "raw": "\"echo\"", + "range": [ + 127, + 133 + ] + }, + "start": 127, + "end": 133, + "loc": { + "start": { + "line": 13, + "column": 34 + }, + "end": { + "line": 13, + "column": 40 + } + }, + "range": [ + 127, + 133 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 13, + "column": 34 }, "end": { - "line": 1, - "column": 6 + "line": 13, + "column": 40 } }, - "value": "echo", - "raw": "\"echo\"" + "range": [ + 127, + 133 + ] } } } @@ -220,35 +266,106 @@ "value": "...props", "data": { "estree": { - "type": "SpreadElement", - "start": 3, - "end": 11, + "type": "Program", + "start": 136, + "end": 144, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 136, + "end": 144, + "loc": { + "start": { + "line": 13, + "column": 43 + }, + "end": { + "line": 13, + "column": 51 + } + }, + "properties": [ + { + "type": "SpreadElement", + "start": 136, + "end": 144, + "loc": { + "start": { + "line": 13, + "column": 43 + }, + "end": { + "line": 13, + "column": 51 + } + }, + "argument": { + "type": "Identifier", + "start": 139, + "end": 144, + "loc": { + "start": { + "line": 13, + "column": 46 + }, + "end": { + "line": 13, + "column": 51 + } + }, + "name": "props", + "range": [ + 139, + 144 + ] + }, + "range": [ + 136, + 144 + ] + } + ], + "range": [ + 136, + 144 + ] + }, + "start": 136, + "end": 144, + "loc": { + "start": { + "line": 13, + "column": 43 + }, + "end": { + "line": 13, + "column": 51 + } + }, + "range": [ + 136, + 144 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 3 + "line": 13, + "column": 43 }, "end": { - "line": 1, - "column": 11 + "line": 13, + "column": 51 } }, - "argument": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "props" - } + "range": [ + 136, + 144 + ] } } } @@ -394,21 +511,67 @@ "value": "\"echo\"", "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 6, + "type": "Program", + "start": 250, + "end": 256, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 250, + "end": 256, + "loc": { + "start": { + "line": 23, + "column": 34 + }, + "end": { + "line": 23, + "column": 40 + } + }, + "value": "echo", + "raw": "\"echo\"", + "range": [ + 250, + 256 + ] + }, + "start": 250, + "end": 256, + "loc": { + "start": { + "line": 23, + "column": 34 + }, + "end": { + "line": 23, + "column": 40 + } + }, + "range": [ + 250, + 256 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 23, + "column": 34 }, "end": { - "line": 1, - "column": 6 + "line": 23, + "column": 40 } }, - "value": "echo", - "raw": "\"echo\"" + "range": [ + 250, + 256 + ] } } } @@ -418,35 +581,106 @@ "value": "...props", "data": { "estree": { - "type": "SpreadElement", - "start": 3, - "end": 11, + "type": "Program", + "start": 259, + "end": 267, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 259, + "end": 267, + "loc": { + "start": { + "line": 23, + "column": 43 + }, + "end": { + "line": 23, + "column": 51 + } + }, + "properties": [ + { + "type": "SpreadElement", + "start": 259, + "end": 267, + "loc": { + "start": { + "line": 23, + "column": 43 + }, + "end": { + "line": 23, + "column": 51 + } + }, + "argument": { + "type": "Identifier", + "start": 262, + "end": 267, + "loc": { + "start": { + "line": 23, + "column": 46 + }, + "end": { + "line": 23, + "column": 51 + } + }, + "name": "props", + "range": [ + 262, + 267 + ] + }, + "range": [ + 259, + 267 + ] + } + ], + "range": [ + 259, + 267 + ] + }, + "start": 259, + "end": 267, + "loc": { + "start": { + "line": 23, + "column": 43 + }, + "end": { + "line": 23, + "column": 51 + } + }, + "range": [ + 259, + 267 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 3 + "line": 23, + "column": 43 }, "end": { - "line": 1, - "column": 11 + "line": 23, + "column": 51 } }, - "argument": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "props" - } + "range": [ + 259, + 267 + ] } } } @@ -697,21 +931,67 @@ "value": "\"echo\"", "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 6, + "type": "Program", + "start": 408, + "end": 414, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 408, + "end": 414, + "loc": { + "start": { + "line": 33, + "column": 34 + }, + "end": { + "line": 33, + "column": 40 + } + }, + "value": "echo", + "raw": "\"echo\"", + "range": [ + 408, + 414 + ] + }, + "start": 408, + "end": 414, + "loc": { + "start": { + "line": 33, + "column": 34 + }, + "end": { + "line": 33, + "column": 40 + } + }, + "range": [ + 408, + 414 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 33, + "column": 34 }, "end": { - "line": 1, - "column": 6 + "line": 33, + "column": 40 } }, - "value": "echo", - "raw": "\"echo\"" + "range": [ + 408, + 414 + ] } } } @@ -721,35 +1001,106 @@ "value": "...props", "data": { "estree": { - "type": "SpreadElement", - "start": 3, - "end": 11, + "type": "Program", + "start": 417, + "end": 425, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 417, + "end": 425, + "loc": { + "start": { + "line": 33, + "column": 43 + }, + "end": { + "line": 33, + "column": 51 + } + }, + "properties": [ + { + "type": "SpreadElement", + "start": 417, + "end": 425, + "loc": { + "start": { + "line": 33, + "column": 43 + }, + "end": { + "line": 33, + "column": 51 + } + }, + "argument": { + "type": "Identifier", + "start": 420, + "end": 425, + "loc": { + "start": { + "line": 33, + "column": 46 + }, + "end": { + "line": 33, + "column": 51 + } + }, + "name": "props", + "range": [ + 420, + 425 + ] + }, + "range": [ + 417, + 425 + ] + } + ], + "range": [ + 417, + 425 + ] + }, + "start": 417, + "end": 425, + "loc": { + "start": { + "line": 33, + "column": 43 + }, + "end": { + "line": 33, + "column": 51 + } + }, + "range": [ + 417, + 425 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 3 + "line": 33, + "column": 43 }, "end": { - "line": 1, - "column": 11 + "line": 33, + "column": 51 } }, - "argument": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "props" - } + "range": [ + 417, + 425 + ] } } } @@ -1178,21 +1529,67 @@ "value": "\"echo\"", "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 6, + "type": "Program", + "start": 630, + "end": 636, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 630, + "end": 636, + "loc": { + "start": { + "line": 55, + "column": 34 + }, + "end": { + "line": 55, + "column": 40 + } + }, + "value": "echo", + "raw": "\"echo\"", + "range": [ + 630, + 636 + ] + }, + "start": 630, + "end": 636, + "loc": { + "start": { + "line": 55, + "column": 34 + }, + "end": { + "line": 55, + "column": 40 + } + }, + "range": [ + 630, + 636 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 55, + "column": 34 }, "end": { - "line": 1, - "column": 6 + "line": 55, + "column": 40 } }, - "value": "echo", - "raw": "\"echo\"" + "range": [ + 630, + 636 + ] } } } @@ -1202,35 +1599,106 @@ "value": "...props", "data": { "estree": { - "type": "SpreadElement", - "start": 3, - "end": 11, + "type": "Program", + "start": 639, + "end": 647, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 639, + "end": 647, + "loc": { + "start": { + "line": 55, + "column": 43 + }, + "end": { + "line": 55, + "column": 51 + } + }, + "properties": [ + { + "type": "SpreadElement", + "start": 639, + "end": 647, + "loc": { + "start": { + "line": 55, + "column": 43 + }, + "end": { + "line": 55, + "column": 51 + } + }, + "argument": { + "type": "Identifier", + "start": 642, + "end": 647, + "loc": { + "start": { + "line": 55, + "column": 46 + }, + "end": { + "line": 55, + "column": 51 + } + }, + "name": "props", + "range": [ + 642, + 647 + ] + }, + "range": [ + 639, + 647 + ] + } + ], + "range": [ + 639, + 647 + ] + }, + "start": 639, + "end": 647, + "loc": { + "start": { + "line": 55, + "column": 43 + }, + "end": { + "line": 55, + "column": 51 + } + }, + "range": [ + 639, + 647 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 3 + "line": 55, + "column": 43 }, "end": { - "line": 1, - "column": 11 + "line": 55, + "column": 51 } }, - "argument": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "props" - } + "range": [ + 639, + 647 + ] } } } @@ -1596,21 +2064,67 @@ "value": "\"echo\"", "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 6, + "type": "Program", + "start": 789, + "end": 795, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 789, + "end": 795, + "loc": { + "start": { + "line": 71, + "column": 34 + }, + "end": { + "line": 71, + "column": 40 + } + }, + "value": "echo", + "raw": "\"echo\"", + "range": [ + 789, + 795 + ] + }, + "start": 789, + "end": 795, + "loc": { + "start": { + "line": 71, + "column": 34 + }, + "end": { + "line": 71, + "column": 40 + } + }, + "range": [ + 789, + 795 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 71, + "column": 34 }, "end": { - "line": 1, - "column": 6 + "line": 71, + "column": 40 } }, - "value": "echo", - "raw": "\"echo\"" + "range": [ + 789, + 795 + ] } } } @@ -1620,35 +2134,106 @@ "value": "...props", "data": { "estree": { - "type": "SpreadElement", - "start": 3, - "end": 11, + "type": "Program", + "start": 798, + "end": 806, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 798, + "end": 806, + "loc": { + "start": { + "line": 71, + "column": 43 + }, + "end": { + "line": 71, + "column": 51 + } + }, + "properties": [ + { + "type": "SpreadElement", + "start": 798, + "end": 806, + "loc": { + "start": { + "line": 71, + "column": 43 + }, + "end": { + "line": 71, + "column": 51 + } + }, + "argument": { + "type": "Identifier", + "start": 801, + "end": 806, + "loc": { + "start": { + "line": 71, + "column": 46 + }, + "end": { + "line": 71, + "column": 51 + } + }, + "name": "props", + "range": [ + 801, + 806 + ] + }, + "range": [ + 798, + 806 + ] + } + ], + "range": [ + 798, + 806 + ] + }, + "start": 798, + "end": 806, + "loc": { + "start": { + "line": 71, + "column": 43 + }, + "end": { + "line": 71, + "column": 51 + } + }, + "range": [ + 798, + 806 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 3 + "line": 71, + "column": 43 }, "end": { - "line": 1, - "column": 11 + "line": 71, + "column": 51 } }, - "argument": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "props" - } + "range": [ + 798, + 806 + ] } } } @@ -1926,21 +2511,67 @@ "value": "\"echo\"", "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 6, + "type": "Program", + "start": 916, + "end": 922, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 916, + "end": 922, + "loc": { + "start": { + "line": 81, + "column": 34 + }, + "end": { + "line": 81, + "column": 40 + } + }, + "value": "echo", + "raw": "\"echo\"", + "range": [ + 916, + 922 + ] + }, + "start": 916, + "end": 922, + "loc": { + "start": { + "line": 81, + "column": 34 + }, + "end": { + "line": 81, + "column": 40 + } + }, + "range": [ + 916, + 922 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 81, + "column": 34 }, "end": { - "line": 1, - "column": 6 + "line": 81, + "column": 40 } }, - "value": "echo", - "raw": "\"echo\"" + "range": [ + 916, + 922 + ] } } } @@ -1950,35 +2581,106 @@ "value": "...props", "data": { "estree": { - "type": "SpreadElement", - "start": 3, - "end": 11, + "type": "Program", + "start": 925, + "end": 933, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 925, + "end": 933, + "loc": { + "start": { + "line": 81, + "column": 43 + }, + "end": { + "line": 81, + "column": 51 + } + }, + "properties": [ + { + "type": "SpreadElement", + "start": 925, + "end": 933, + "loc": { + "start": { + "line": 81, + "column": 43 + }, + "end": { + "line": 81, + "column": 51 + } + }, + "argument": { + "type": "Identifier", + "start": 928, + "end": 933, + "loc": { + "start": { + "line": 81, + "column": 46 + }, + "end": { + "line": 81, + "column": 51 + } + }, + "name": "props", + "range": [ + 928, + 933 + ] + }, + "range": [ + 925, + 933 + ] + } + ], + "range": [ + 925, + 933 + ] + }, + "start": 925, + "end": 933, + "loc": { + "start": { + "line": 81, + "column": 43 + }, + "end": { + "line": 81, + "column": 51 + } + }, + "range": [ + 925, + 933 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 3 + "line": 81, + "column": 43 }, "end": { - "line": 1, - "column": 11 + "line": 81, + "column": 51 } }, - "argument": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "props" - } + "range": [ + 925, + 933 + ] } } } @@ -2358,21 +3060,67 @@ "value": "\"echo\"", "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 6, + "type": "Program", + "start": 1078, + "end": 1084, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 1078, + "end": 1084, + "loc": { + "start": { + "line": 91, + "column": 34 + }, + "end": { + "line": 91, + "column": 40 + } + }, + "value": "echo", + "raw": "\"echo\"", + "range": [ + 1078, + 1084 + ] + }, + "start": 1078, + "end": 1084, + "loc": { + "start": { + "line": 91, + "column": 34 + }, + "end": { + "line": 91, + "column": 40 + } + }, + "range": [ + 1078, + 1084 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 91, + "column": 34 }, "end": { - "line": 1, - "column": 6 + "line": 91, + "column": 40 } }, - "value": "echo", - "raw": "\"echo\"" + "range": [ + 1078, + 1084 + ] } } } @@ -2382,35 +3130,106 @@ "value": "...props", "data": { "estree": { - "type": "SpreadElement", - "start": 3, - "end": 11, + "type": "Program", + "start": 1087, + "end": 1095, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 1087, + "end": 1095, + "loc": { + "start": { + "line": 91, + "column": 43 + }, + "end": { + "line": 91, + "column": 51 + } + }, + "properties": [ + { + "type": "SpreadElement", + "start": 1087, + "end": 1095, + "loc": { + "start": { + "line": 91, + "column": 43 + }, + "end": { + "line": 91, + "column": 51 + } + }, + "argument": { + "type": "Identifier", + "start": 1090, + "end": 1095, + "loc": { + "start": { + "line": 91, + "column": 46 + }, + "end": { + "line": 91, + "column": 51 + } + }, + "name": "props", + "range": [ + 1090, + 1095 + ] + }, + "range": [ + 1087, + 1095 + ] + } + ], + "range": [ + 1087, + 1095 + ] + }, + "start": 1087, + "end": 1095, + "loc": { + "start": { + "line": 91, + "column": 43 + }, + "end": { + "line": 91, + "column": 51 + } + }, + "range": [ + 1087, + 1095 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 3 + "line": 91, + "column": 43 }, "end": { - "line": 1, - "column": 11 + "line": 91, + "column": 51 } }, - "argument": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "props" - } + "range": [ + 1087, + 1095 + ] } } } @@ -2971,21 +3790,67 @@ "value": "\"echo\"", "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 6, + "type": "Program", + "start": 1310, + "end": 1316, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 1310, + "end": 1316, + "loc": { + "start": { + "line": 101, + "column": 34 + }, + "end": { + "line": 101, + "column": 40 + } + }, + "value": "echo", + "raw": "\"echo\"", + "range": [ + 1310, + 1316 + ] + }, + "start": 1310, + "end": 1316, + "loc": { + "start": { + "line": 101, + "column": 34 + }, + "end": { + "line": 101, + "column": 40 + } + }, + "range": [ + 1310, + 1316 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 101, + "column": 34 }, "end": { - "line": 1, - "column": 6 + "line": 101, + "column": 40 } }, - "value": "echo", - "raw": "\"echo\"" + "range": [ + 1310, + 1316 + ] } } } @@ -2995,35 +3860,106 @@ "value": "...props", "data": { "estree": { - "type": "SpreadElement", - "start": 3, - "end": 11, + "type": "Program", + "start": 1319, + "end": 1327, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 1319, + "end": 1327, + "loc": { + "start": { + "line": 101, + "column": 43 + }, + "end": { + "line": 101, + "column": 51 + } + }, + "properties": [ + { + "type": "SpreadElement", + "start": 1319, + "end": 1327, + "loc": { + "start": { + "line": 101, + "column": 43 + }, + "end": { + "line": 101, + "column": 51 + } + }, + "argument": { + "type": "Identifier", + "start": 1322, + "end": 1327, + "loc": { + "start": { + "line": 101, + "column": 46 + }, + "end": { + "line": 101, + "column": 51 + } + }, + "name": "props", + "range": [ + 1322, + 1327 + ] + }, + "range": [ + 1319, + 1327 + ] + } + ], + "range": [ + 1319, + 1327 + ] + }, + "start": 1319, + "end": 1327, + "loc": { + "start": { + "line": 101, + "column": 43 + }, + "end": { + "line": 101, + "column": 51 + } + }, + "range": [ + 1319, + 1327 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 3 + "line": 101, + "column": 43 }, "end": { - "line": 1, - "column": 11 + "line": 101, + "column": 51 } }, - "argument": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "props" - } + "range": [ + 1319, + 1327 + ] } } } diff --git a/packages/remark-mdx/test/fixtures/interleaving.json b/packages/remark-mdx/test/fixtures/interleaving.json index e947bd507..aed059607 100644 --- a/packages/remark-mdx/test/fixtures/interleaving.json +++ b/packages/remark-mdx/test/fixtures/interleaving.json @@ -263,53 +263,107 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 10, + "type": "Program", + "start": 180, + "end": 190, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 180, + "end": 190, + "object": { + "type": "Identifier", + "start": 180, + "end": 185, + "name": "props", + "loc": { + "start": { + "line": 7, + "column": 39 + }, + "end": { + "line": 7, + "column": 44 + } + }, + "range": [ + 180, + 185 + ] + }, + "property": { + "type": "Identifier", + "start": 186, + "end": 190, + "name": "name", + "loc": { + "start": { + "line": 7, + "column": 45 + }, + "end": { + "line": 7, + "column": 49 + } + }, + "range": [ + 186, + 190 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 7, + "column": 39 + }, + "end": { + "line": 7, + "column": 49 + } + }, + "range": [ + 180, + 190 + ] + }, + "start": 180, + "end": 190, + "loc": { + "start": { + "line": 7, + "column": 39 + }, + "end": { + "line": 7, + "column": 49 + } + }, + "range": [ + 180, + 190 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 7, + "column": 39 }, "end": { - "line": 1, - "column": 10 + "line": 7, + "column": 49 } }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "name" - }, - "computed": false, - "optional": false + "range": [ + 180, + 190 + ] } } } @@ -564,53 +618,107 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 10, + "type": "Program", + "start": 263, + "end": 273, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 263, + "end": 273, + "object": { + "type": "Identifier", + "start": 263, + "end": 268, + "name": "props", + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 22 + } + }, + "range": [ + 263, + 268 + ] + }, + "property": { + "type": "Identifier", + "start": 269, + "end": 273, + "name": "name", + "loc": { + "start": { + "line": 17, + "column": 23 + }, + "end": { + "line": 17, + "column": 27 + } + }, + "range": [ + 269, + 273 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 27 + } + }, + "range": [ + 263, + 273 + ] + }, + "start": 263, + "end": 273, + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 27 + } + }, + "range": [ + 263, + 273 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 17, + "column": 17 }, "end": { - "line": 1, - "column": 10 + "line": 17, + "column": 27 } }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "name" - }, - "computed": false, - "optional": false + "range": [ + 263, + 273 + ] } } } @@ -688,53 +796,107 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 11, + "type": "Program", + "start": 317, + "end": 328, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 317, + "end": 328, + "object": { + "type": "Identifier", + "start": 317, + "end": 322, + "name": "props", + "loc": { + "start": { + "line": 21, + "column": 30 + }, + "end": { + "line": 21, + "column": 35 + } + }, + "range": [ + 317, + 322 + ] + }, + "property": { + "type": "Identifier", + "start": 323, + "end": 328, + "name": "thing", + "loc": { + "start": { + "line": 21, + "column": 36 + }, + "end": { + "line": 21, + "column": 41 + } + }, + "range": [ + 323, + 328 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 21, + "column": 30 + }, + "end": { + "line": 21, + "column": 41 + } + }, + "range": [ + 317, + 328 + ] + }, + "start": 317, + "end": 328, + "loc": { + "start": { + "line": 21, + "column": 30 + }, + "end": { + "line": 21, + "column": 41 + } + }, + "range": [ + 317, + 328 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 21, + "column": 30 }, "end": { - "line": 1, - "column": 11 + "line": 21, + "column": 41 } }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "thing" - }, - "computed": false, - "optional": false + "range": [ + 317, + 328 + ] } } } @@ -853,53 +1015,107 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 10, + "type": "Program", + "start": 367, + "end": 377, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 367, + "end": 377, + "object": { + "type": "Identifier", + "start": 367, + "end": 372, + "name": "props", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "range": [ + 367, + 372 + ] + }, + "property": { + "type": "Identifier", + "start": 373, + "end": 377, + "name": "name", + "loc": { + "start": { + "line": 27, + "column": 23 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "range": [ + 373, + 377 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "range": [ + 367, + 377 + ] + }, + "start": 367, + "end": 377, + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "range": [ + 367, + 377 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 27, + "column": 17 }, "end": { - "line": 1, - "column": 10 + "line": 27, + "column": 27 } }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "name" - }, - "computed": false, - "optional": false + "range": [ + 367, + 377 + ] } } } @@ -1220,284 +1436,394 @@ }, "data": { "estree": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "id": null, - "expression": false, - "generator": false, - "async": false, - "params": [ + "type": "Program", + "start": 627, + "end": 707, + "body": [ { - "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "prop" - } - ], - "body": { - "type": "BlockStatement", - "start": 8, - "end": 80, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 14, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 34 - } - }, - "declarations": [ + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "start": 627, + "end": 707, + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [ { - "type": "VariableDeclarator", - "start": 20, - "end": 44, + "type": "Identifier", + "start": 627, + "end": 631, + "name": "prop", "loc": { "start": { - "line": 2, - "column": 10 + "line": 49, + "column": 3 }, "end": { - "line": 2, - "column": 34 + "line": 49, + "column": 7 } }, - "id": { - "type": "Identifier", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "name": "newValue" - }, - "init": { - "type": "CallExpression", - "start": 31, - "end": 44, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 34 - } - }, - "callee": { - "type": "Identifier", - "start": 31, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 28 - } - }, - "name": "doStuff" - }, - "arguments": [ + "range": [ + 627, + 631 + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 635, + "end": 707, + "body": [ + { + "type": "VariableDeclaration", + "start": 641, + "end": 671, + "declarations": [ { - "type": "Identifier", - "start": 39, - "end": 43, + "type": "VariableDeclarator", + "start": 647, + "end": 671, + "id": { + "type": "Identifier", + "start": 647, + "end": 655, + "name": "newValue", + "loc": { + "start": { + "line": 49, + "column": 23 + }, + "end": { + "line": 49, + "column": 31 + } + }, + "range": [ + 647, + 655 + ] + }, + "init": { + "type": "CallExpression", + "start": 658, + "end": 671, + "callee": { + "type": "Identifier", + "start": 658, + "end": 665, + "name": "doStuff", + "loc": { + "start": { + "line": 49, + "column": 34 + }, + "end": { + "line": 49, + "column": 41 + } + }, + "range": [ + 658, + 665 + ] + }, + "arguments": [ + { + "type": "Identifier", + "start": 666, + "end": 670, + "name": "prop", + "loc": { + "start": { + "line": 49, + "column": 42 + }, + "end": { + "line": 49, + "column": 46 + } + }, + "range": [ + 666, + 670 + ] + } + ], + "optional": false, + "loc": { + "start": { + "line": 49, + "column": 34 + }, + "end": { + "line": 49, + "column": 47 + } + }, + "range": [ + 658, + 671 + ] + }, "loc": { "start": { - "line": 2, - "column": 29 + "line": 49, + "column": 23 }, "end": { - "line": 2, - "column": 33 + "line": 49, + "column": 47 } }, - "name": "prop" + "range": [ + 647, + 671 + ] } ], - "optional": false - } - } - ], - "kind": "const" - }, - { - "type": "ReturnStatement", - "start": 50, - "end": 76, - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 30 - } - }, - "argument": { - "type": "JSXElement", - "start": 57, - "end": 76, - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 30 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 57, - "end": 61, - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 15 - } - }, - "attributes": [], - "name": { - "type": "JSXIdentifier", - "start": 58, - "end": 60, + "kind": "const", "loc": { "start": { - "line": 4, - "column": 12 + "line": 49, + "column": 17 }, "end": { - "line": 4, - "column": 14 + "line": 49, + "column": 47 } }, - "name": "h1" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 71, - "end": 76, - "loc": { - "start": { - "line": 4, - "column": 25 - }, - "end": { - "line": 4, - "column": 30 - } + "range": [ + 641, + 671 + ] }, - "name": { - "type": "JSXIdentifier", - "start": 73, - "end": 75, - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 29 - } - }, - "name": "h1" - } - }, - "children": [ { - "type": "JSXExpressionContainer", - "start": 61, - "end": 71, - "loc": { - "start": { - "line": 4, - "column": 15 + "type": "ReturnStatement", + "start": 677, + "end": 703, + "argument": { + "type": "JSXElement", + "start": 684, + "end": 703, + "openingElement": { + "type": "JSXOpeningElement", + "start": 684, + "end": 688, + "attributes": [], + "name": { + "type": "JSXIdentifier", + "start": 685, + "end": 687, + "name": "h1", + "loc": { + "start": { + "line": 49, + "column": 61 + }, + "end": { + "line": 49, + "column": 63 + } + }, + "range": [ + 685, + 687 + ] + }, + "selfClosing": false, + "loc": { + "start": { + "line": 49, + "column": 60 + }, + "end": { + "line": 49, + "column": 64 + } + }, + "range": [ + 684, + 688 + ] }, - "end": { - "line": 4, - "column": 25 - } - }, - "expression": { - "type": "Identifier", - "start": 62, - "end": 70, + "closingElement": { + "type": "JSXClosingElement", + "start": 698, + "end": 703, + "name": { + "type": "JSXIdentifier", + "start": 700, + "end": 702, + "name": "h1", + "loc": { + "start": { + "line": 49, + "column": 76 + }, + "end": { + "line": 49, + "column": 78 + } + }, + "range": [ + 700, + 702 + ] + }, + "loc": { + "start": { + "line": 49, + "column": 74 + }, + "end": { + "line": 49, + "column": 79 + } + }, + "range": [ + 698, + 703 + ] + }, + "children": [ + { + "type": "JSXExpressionContainer", + "start": 688, + "end": 698, + "expression": { + "type": "Identifier", + "start": 689, + "end": 697, + "name": "newValue", + "loc": { + "start": { + "line": 49, + "column": 65 + }, + "end": { + "line": 49, + "column": 73 + } + }, + "range": [ + 689, + 697 + ] + }, + "loc": { + "start": { + "line": 49, + "column": 64 + }, + "end": { + "line": 49, + "column": 74 + } + }, + "range": [ + 688, + 698 + ] + } + ], "loc": { "start": { - "line": 4, - "column": 16 + "line": 49, + "column": 60 }, "end": { - "line": 4, - "column": 24 + "line": 49, + "column": 79 } }, - "name": "newValue" - } + "range": [ + 684, + 703 + ] + }, + "loc": { + "start": { + "line": 49, + "column": 53 + }, + "end": { + "line": 49, + "column": 79 + } + }, + "range": [ + 677, + 703 + ] + } + ], + "loc": { + "start": { + "line": 49, + "column": 11 + }, + "end": { + "line": 49, + "column": 83 } + }, + "range": [ + 635, + 707 ] + }, + "loc": { + "start": { + "line": 49, + "column": 3 + }, + "end": { + "line": 49, + "column": 83 + } + }, + "range": [ + 627, + 707 + ] + }, + "start": 627, + "end": 707, + "loc": { + "start": { + "line": 49, + "column": 3 + }, + "end": { + "line": 49, + "column": 83 } - } - ] - } + }, + "range": [ + 627, + 707 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 49, + "column": 3 + }, + "end": { + "line": 49, + "column": 83 + } + }, + "range": [ + 627, + 707 + ] } } } @@ -1576,41 +1902,91 @@ "value": "`\nHere's a template string\n\nwith empty lines\n`", "data": { "estree": { - "type": "TemplateLiteral", - "start": 0, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "expressions": [], - "quasis": [ + "type": "Program", + "start": 778, + "end": 834, + "body": [ { - "type": "TemplateElement", - "start": 1, - "end": 55, + "type": "ExpressionStatement", + "expression": { + "type": "TemplateLiteral", + "start": 778, + "end": 834, + "loc": { + "start": { + "line": 61, + "column": 12 + }, + "end": { + "line": 61, + "column": 68 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 779, + "end": 833, + "loc": { + "start": { + "line": 61, + "column": 13 + }, + "end": { + "line": 61, + "column": 67 + } + }, + "value": { + "raw": "\n Here's a template string\n\n with empty lines\n ", + "cooked": "\n Here's a template string\n\n with empty lines\n " + }, + "tail": true, + "range": [ + 779, + 833 + ] + } + ], + "range": [ + 778, + 834 + ] + }, + "start": 778, + "end": 834, "loc": { "start": { - "line": 1, - "column": 1 + "line": 61, + "column": 12 }, "end": { - "line": 5, - "column": 2 + "line": 61, + "column": 68 } }, - "value": { - "raw": "\n Here's a template string\n\n with empty lines\n ", - "cooked": "\n Here's a template string\n\n with empty lines\n " - }, - "tail": true + "range": [ + 778, + 834 + ] + } + ], + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 61, + "column": 12 + }, + "end": { + "line": 61, + "column": 68 } + }, + "range": [ + 778, + 834 ] } } @@ -2139,53 +2515,107 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 10, + "type": "Program", + "start": 1107, + "end": 1117, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 1107, + "end": 1117, + "object": { + "type": "Identifier", + "start": 1107, + "end": 1112, + "name": "props", + "loc": { + "start": { + "line": 84, + "column": 17 + }, + "end": { + "line": 84, + "column": 22 + } + }, + "range": [ + 1107, + 1112 + ] + }, + "property": { + "type": "Identifier", + "start": 1113, + "end": 1117, + "name": "name", + "loc": { + "start": { + "line": 84, + "column": 23 + }, + "end": { + "line": 84, + "column": 27 + } + }, + "range": [ + 1113, + 1117 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 84, + "column": 17 + }, + "end": { + "line": 84, + "column": 27 + } + }, + "range": [ + 1107, + 1117 + ] + }, + "start": 1107, + "end": 1117, + "loc": { + "start": { + "line": 84, + "column": 17 + }, + "end": { + "line": 84, + "column": 27 + } + }, + "range": [ + 1107, + 1117 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 84, + "column": 17 }, "end": { - "line": 1, - "column": 10 + "line": 84, + "column": 27 } }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "name" - }, - "computed": false, - "optional": false + "range": [ + 1107, + 1117 + ] } } } @@ -2254,53 +2684,107 @@ }, "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 10, + "type": "Program", + "start": 1137, + "end": 1147, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 1137, + "end": 1147, + "object": { + "type": "Identifier", + "start": 1137, + "end": 1142, + "name": "props", + "loc": { + "start": { + "line": 86, + "column": 14 + }, + "end": { + "line": 86, + "column": 19 + } + }, + "range": [ + 1137, + 1142 + ] + }, + "property": { + "type": "Identifier", + "start": 1143, + "end": 1147, + "name": "name", + "loc": { + "start": { + "line": 86, + "column": 20 + }, + "end": { + "line": 86, + "column": 24 + } + }, + "range": [ + 1143, + 1147 + ] + }, + "computed": false, + "optional": false, + "loc": { + "start": { + "line": 86, + "column": 14 + }, + "end": { + "line": 86, + "column": 24 + } + }, + "range": [ + 1137, + 1147 + ] + }, + "start": 1137, + "end": 1147, + "loc": { + "start": { + "line": 86, + "column": 14 + }, + "end": { + "line": 86, + "column": 24 + } + }, + "range": [ + 1137, + 1147 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 86, + "column": 14 }, "end": { - "line": 1, - "column": 10 + "line": 86, + "column": 24 } }, - "object": { - "type": "Identifier", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "props" - }, - "property": { - "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "name" - }, - "computed": false, - "optional": false + "range": [ + 1137, + 1147 + ] } } } diff --git a/packages/remark-mdx/test/fixtures/markdown.json b/packages/remark-mdx/test/fixtures/markdown.json index 5de8faa82..97a4286d2 100644 --- a/packages/remark-mdx/test/fixtures/markdown.json +++ b/packages/remark-mdx/test/fixtures/markdown.json @@ -262,54 +262,108 @@ }, "data": { "estree": { - "type": "BinaryExpression", - "start": 0, - "end": 5, + "type": "Program", + "start": 138, + "end": 143, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "start": 138, + "end": 143, + "left": { + "type": "Literal", + "start": 138, + "end": 139, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 9, + "column": 35 + }, + "end": { + "line": 9, + "column": 36 + } + }, + "range": [ + 138, + 139 + ] + }, + "operator": "+", + "right": { + "type": "Literal", + "start": 142, + "end": 143, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 9, + "column": 39 + }, + "end": { + "line": 9, + "column": 40 + } + }, + "range": [ + 142, + 143 + ] + }, + "loc": { + "start": { + "line": 9, + "column": 35 + }, + "end": { + "line": 9, + "column": 40 + } + }, + "range": [ + 138, + 143 + ] + }, + "start": 138, + "end": 143, + "loc": { + "start": { + "line": 9, + "column": 35 + }, + "end": { + "line": 9, + "column": 40 + } + }, + "range": [ + 138, + 143 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 9, + "column": 35 }, "end": { - "line": 1, - "column": 5 + "line": 9, + "column": 40 } }, - "left": { - "type": "Literal", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "value": 1, - "raw": "1" - }, - "operator": "+", - "right": { - "type": "Literal", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "value": 1, - "raw": "1" - } + "range": [ + 138, + 143 + ] } } }, @@ -808,54 +862,108 @@ }, "data": { "estree": { - "type": "BinaryExpression", - "start": 0, - "end": 5, + "type": "Program", + "start": 306, + "end": 311, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "start": 306, + "end": 311, + "left": { + "type": "Literal", + "start": 306, + "end": 307, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + } + }, + "range": [ + 306, + 307 + ] + }, + "operator": "+", + "right": { + "type": "Literal", + "start": 310, + "end": 311, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 24, + "column": 12 + }, + "end": { + "line": 24, + "column": 13 + } + }, + "range": [ + 310, + 311 + ] + }, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 13 + } + }, + "range": [ + 306, + 311 + ] + }, + "start": 306, + "end": 311, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 13 + } + }, + "range": [ + 306, + 311 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 24, + "column": 8 }, "end": { - "line": 1, - "column": 5 + "line": 24, + "column": 13 } }, - "left": { - "type": "Literal", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "value": 1, - "raw": "1" - }, - "operator": "+", - "right": { - "type": "Literal", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "value": 1, - "raw": "1" - } + "range": [ + 306, + 311 + ] } } } @@ -1895,21 +2003,67 @@ }, "data": { "estree": { - "type": "Literal", - "start": 0, - "end": 12, + "type": "Program", + "start": 877, + "end": 889, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "start": 877, + "end": 889, + "value": "references", + "raw": "\"references\"", + "loc": { + "start": { + "line": 64, + "column": 26 + }, + "end": { + "line": 64, + "column": 38 + } + }, + "range": [ + 877, + 889 + ] + }, + "start": 877, + "end": 889, + "loc": { + "start": { + "line": 64, + "column": 26 + }, + "end": { + "line": 64, + "column": 38 + } + }, + "range": [ + 877, + 889 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 64, + "column": 26 }, "end": { - "line": 1, - "column": 12 + "line": 64, + "column": 38 } }, - "value": "references", - "raw": "\"references\"" + "range": [ + 877, + 889 + ] } } } diff --git a/packages/remark-mdx/test/fixtures/span.json b/packages/remark-mdx/test/fixtures/span.json index 664f64b7a..ce0b8f6dc 100644 --- a/packages/remark-mdx/test/fixtures/span.json +++ b/packages/remark-mdx/test/fixtures/span.json @@ -74,54 +74,108 @@ }, "data": { "estree": { - "type": "BinaryExpression", - "start": 0, - "end": 5, + "type": "Program", + "start": 32, + "end": 37, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "start": 32, + "end": 37, + "left": { + "type": "Literal", + "start": 32, + "end": 33, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 32, + 33 + ] + }, + "operator": "+", + "right": { + "type": "Literal", + "start": 36, + "end": 37, + "value": 1, + "raw": "1", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 36, + 37 + ] + }, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 32, + 37 + ] + }, + "start": 32, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 32, + 37 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { "line": 1, - "column": 0 + "column": 32 }, "end": { "line": 1, - "column": 5 + "column": 37 } }, - "left": { - "type": "Literal", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "value": 1, - "raw": "1" - }, - "operator": "+", - "right": { - "type": "Literal", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "value": 1, - "raw": "1" - } + "range": [ + 32, + 37 + ] } } } @@ -310,54 +364,108 @@ }, "data": { "estree": { - "type": "CallExpression", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "callee": { - "type": "Identifier", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "formatName" - }, - "arguments": [ + "type": "Program", + "start": 113, + "end": 129, + "body": [ { - "type": "Identifier", - "start": 11, - "end": 15, + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "start": 113, + "end": 129, + "callee": { + "type": "Identifier", + "start": 113, + "end": 123, + "name": "formatName", + "loc": { + "start": { + "line": 5, + "column": 34 + }, + "end": { + "line": 5, + "column": 44 + } + }, + "range": [ + 113, + 123 + ] + }, + "arguments": [ + { + "type": "Identifier", + "start": 124, + "end": 128, + "name": "user", + "loc": { + "start": { + "line": 5, + "column": 45 + }, + "end": { + "line": 5, + "column": 49 + } + }, + "range": [ + 124, + 128 + ] + } + ], + "optional": false, + "loc": { + "start": { + "line": 5, + "column": 34 + }, + "end": { + "line": 5, + "column": 50 + } + }, + "range": [ + 113, + 129 + ] + }, + "start": 113, + "end": 129, "loc": { "start": { - "line": 1, - "column": 11 + "line": 5, + "column": 34 }, "end": { - "line": 1, - "column": 15 + "line": 5, + "column": 50 } }, - "name": "user" + "range": [ + 113, + 129 + ] } ], - "optional": false + "sourceType": "module", + "comments": [], + "loc": { + "start": { + "line": 5, + "column": 34 + }, + "end": { + "line": 5, + "column": 50 + } + }, + "range": [ + 113, + 129 + ] } } }, @@ -509,53 +617,107 @@ "value": "user.avatarUrl", "data": { "estree": { - "type": "MemberExpression", - "start": 0, - "end": 14, + "type": "Program", + "start": 217, + "end": 231, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "start": 217, + "end": 231, + "loc": { + "start": { + "line": 9, + "column": 39 + }, + "end": { + "line": 9, + "column": 53 + } + }, + "object": { + "type": "Identifier", + "start": 217, + "end": 221, + "loc": { + "start": { + "line": 9, + "column": 39 + }, + "end": { + "line": 9, + "column": 43 + } + }, + "name": "user", + "range": [ + 217, + 221 + ] + }, + "property": { + "type": "Identifier", + "start": 222, + "end": 231, + "loc": { + "start": { + "line": 9, + "column": 44 + }, + "end": { + "line": 9, + "column": 53 + } + }, + "name": "avatarUrl", + "range": [ + 222, + 231 + ] + }, + "computed": false, + "optional": false, + "range": [ + 217, + 231 + ] + }, + "start": 217, + "end": 231, + "loc": { + "start": { + "line": 9, + "column": 39 + }, + "end": { + "line": 9, + "column": 53 + } + }, + "range": [ + 217, + 231 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 0 + "line": 9, + "column": 39 }, "end": { - "line": 1, - "column": 14 + "line": 9, + "column": 53 } }, - "object": { - "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "user" - }, - "property": { - "type": "Identifier", - "start": 5, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "avatarUrl" - }, - "computed": false, - "optional": false + "range": [ + 217, + 231 + ] } } } @@ -633,35 +795,106 @@ "value": "...props", "data": { "estree": { - "type": "SpreadElement", - "start": 3, - "end": 11, + "type": "Program", + "start": 271, + "end": 279, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "start": 271, + "end": 279, + "loc": { + "start": { + "line": 11, + "column": 29 + }, + "end": { + "line": 11, + "column": 37 + } + }, + "properties": [ + { + "type": "SpreadElement", + "start": 271, + "end": 279, + "loc": { + "start": { + "line": 11, + "column": 29 + }, + "end": { + "line": 11, + "column": 37 + } + }, + "argument": { + "type": "Identifier", + "start": 274, + "end": 279, + "loc": { + "start": { + "line": 11, + "column": 32 + }, + "end": { + "line": 11, + "column": 37 + } + }, + "name": "props", + "range": [ + 274, + 279 + ] + }, + "range": [ + 271, + 279 + ] + } + ], + "range": [ + 271, + 279 + ] + }, + "start": 271, + "end": 279, + "loc": { + "start": { + "line": 11, + "column": 29 + }, + "end": { + "line": 11, + "column": 37 + } + }, + "range": [ + 271, + 279 + ] + } + ], + "sourceType": "module", + "comments": [], "loc": { "start": { - "line": 1, - "column": 3 + "line": 11, + "column": 29 }, "end": { - "line": 1, - "column": 11 + "line": 11, + "column": 37 } }, - "argument": { - "type": "Identifier", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "props" - } + "range": [ + 271, + 279 + ] } } } diff --git a/packages/runtime/test/index.test.js b/packages/runtime/test/index.test.js index c651cbba6..676c80263 100644 --- a/packages/runtime/test/index.test.js +++ b/packages/runtime/test/index.test.js @@ -70,9 +70,7 @@ describe('@mdx-js/runtime', () => { it('should crash if non-syntactical JSX in JS is used', async () => { expect(() => { renderToString(}'} />) - }).toThrow( - 'Could not parse expression with acorn: SyntaxError: Unexpected token' - ) + }).toThrow('Could not parse expression with acorn: Unexpected token') }) it('should crash if non-syntactical JS is used', async () => { diff --git a/packages/vue-loader/package.json b/packages/vue-loader/package.json index 0cce6e86a..f67f46734 100644 --- a/packages/vue-loader/package.json +++ b/packages/vue-loader/package.json @@ -48,6 +48,7 @@ }, "devDependencies": { "@vue/test-utils": "^1.0.0", + "babel-helper-vue-jsx-merge-props": "^2.0.0", "babel-plugin-transform-vue-jsx": "^4.0.0", "memory-fs": "^0.5.0", "rehype-autolink-headings": "^5.0.0", diff --git a/packages/vue/package.json b/packages/vue/package.json index 8924638d6..3d1e423b7 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -34,13 +34,10 @@ }, "devDependencies": { "@vue/test-utils": "^1.1.1", - "babel-helper-vue-jsx-merge-props": "^2.0.3", + "babel-helper-vue-jsx-merge-props": "^2.0.0", "microbundle": "^0.12.0" }, - "dependencies": { - "hast-to-hyperscript": "^9.0.0", - "hastscript": "^6.0.0" - }, + "dependencies": {}, "jest": { "testEnvironment": "jsdom" }, diff --git a/packages/vue/src/create-element.js b/packages/vue/src/create-element.js index 04b4f0a09..7a7c68f55 100644 --- a/packages/vue/src/create-element.js +++ b/packages/vue/src/create-element.js @@ -1,6 +1,3 @@ -import h from 'hastscript' -import toH from 'hast-to-hyperscript' - /** * MDX default components */ @@ -17,15 +14,17 @@ const defaults = { const own = {}.hasOwnProperty -export default function createMdxElement(type, props, ...children) { - let node - +export default function createMdxElement(type, props, children) { if (own.call(this.components, type)) { type = this.components[type] } else if (own.call(defaults, type)) { type = defaults[type] } + if (!children) { + children = [] + } + if (props && typeof props === 'object' && !Array.isArray(props)) { // Empty. } else { @@ -33,29 +32,17 @@ export default function createMdxElement(type, props, ...children) { props = {} } - children = children - .flatMap(d => (d == null ? [] : d)) - .map(d => - typeof d === 'number' || typeof d === 'string' - ? this.createElement('d', {}, String(d)).children[0] - : d - ) - - if (typeof type === 'string') { - node = toH( - this.createElement, - h( - type, - Object.assign({}, props, { - components: null, - mdxType: null, - parentName: null - }) - ), - {prefix: false} - ) - node.children = children - return node + children = children.map(d => + typeof d === 'number' || typeof d === 'string' + ? this.createElement('d', {}, String(d)).children[0] + : d + ) + + if (props.attrs) { + // Vue places the special MDX props in `props.attrs`, move them back into + // `props`. + const {components, mdxType, parentName, ...attrs} = props.attrs + props = {...props, components, mdxType, parentName, attrs} } // Just a render function. @@ -67,5 +54,5 @@ export default function createMdxElement(type, props, ...children) { } // Vue component. - return this.createElement(type, {props}, children) + return this.createElement(type, props, children) } diff --git a/packages/vue/test/test.js b/packages/vue/test/test.js index 3ead6c094..90651c1e6 100644 --- a/packages/vue/test/test.js +++ b/packages/vue/test/test.js @@ -1,6 +1,7 @@ import path from 'path' import {mount} from '@vue/test-utils' import mdxTransform from '../../mdx' +import vueMergeProps from 'babel-helper-vue-jsx-merge-props' import {transformAsync as babelTransform} from '@babel/core' import {MDXProvider, mdx} from '../src' @@ -12,9 +13,7 @@ const run = async value => { const {code} = await babelTransform(doc, { configFile: false, plugins: [ - // Here we use react-jsx, which does support a pragma. - // `vue-loader` tests with `babel-plugin-transform-vue-jsx`. - '@babel/plugin-transform-react-jsx', + 'babel-plugin-transform-vue-jsx', path.resolve(__dirname, '../../babel-plugin-remove-export-keywords') ] }) @@ -22,9 +21,13 @@ const run = async value => { // …and finally run it, returning the component. // eslint-disable-next-line no-new-func return new Function( - 'unboundMdx', - `let mdx; - ${code}; + 'mdx', + '_mergeJSXProps', + `let h; + ${code.replace( + /import _mergeJSXProps from "babel-helper-vue-jsx-merge-props";/, + '' + )}; return { name: 'Mdx', @@ -39,11 +42,11 @@ const run = async value => { } }, render(createElement) { - mdx = unboundMdx.bind({ createElement, components: this.components }) - return MDXContent({ components: this.components }) + h = mdx.bind({createElement, components: this.components}) + return MDXContent({components: this.components}) } }` - )(mdx) + )(mdx, vueMergeProps) } describe('@mdx-js/vue', () => { @@ -87,13 +90,11 @@ describe('@mdx-js/vue', () => { const warn = console.warn console.warn = jest.fn() - // The literal `undefined` is because the shortcode injected by `mdx-js/mdx`, - // combined with react-jsx, yields a for Vue unexpected value: a function - // instead of props. - expect(mount(Content).html()).toEqual('
undefined
') + expect(mount(Content).html()).toEqual('
') expect(console.warn).toHaveBeenCalledWith( - 'Component `Component` was not imported, exported, or provided by MDXProvider as global scope' + 'Component `%s` was not imported, exported, or provided by MDXProvider as global scope', + 'Component' ) console.warn = warn @@ -161,7 +162,7 @@ describe('MDXProvider', () => { } }).html() ).toEqual( - '
\n

a and c.

\n
' + '
\n

a and c.

\n
' ) console.error = error diff --git a/yarn.lock b/yarn.lock index 2f4027b4b..46c26c09d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -110,28 +110,6 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.12.7.tgz#9329b4782a7d6bbd7eef57e11addf91ee3ef1e41" integrity sha512-YaxPMGs/XIWtYqrdEOZOCPsVWfEoriXopnsz3/i7apYPXQ3698UFhS6dVT1KN5qOsWmVgw/FOrmQgpRaZayGsw== -"@babel/core@7.10.5": - version "7.10.5" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.10.5.tgz#1f15e2cca8ad9a1d78a38ddba612f5e7cdbbd330" - integrity sha512-O34LQooYVDXPl7QWCdW9p4NR+QlzOr7xShPPJz8GsuCU3/8ua/wqTr7gmnxXv+WBESiGU/G5s16i6tUvHkNb+w== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.10.5" - "@babel/helper-module-transforms" "^7.10.5" - "@babel/helpers" "^7.10.4" - "@babel/parser" "^7.10.5" - "@babel/template" "^7.10.4" - "@babel/traverse" "^7.10.5" - "@babel/types" "^7.10.5" - convert-source-map "^1.7.0" - debug "^4.1.0" - gensync "^1.0.0-beta.1" - json5 "^2.1.2" - lodash "^4.17.19" - resolve "^1.3.2" - semver "^5.4.1" - source-map "^0.5.0" - "@babel/core@7.11.1": version "7.11.1" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.11.1.tgz#2c55b604e73a40dc21b0e52650b11c65cf276643" @@ -218,7 +196,7 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@^7.1.0", "@babel/core@^7.10.2", "@babel/core@^7.10.3", "@babel/core@^7.10.5", "@babel/core@^7.11.0", "@babel/core@^7.12.0", "@babel/core@^7.12.3", "@babel/core@^7.4.4", "@babel/core@^7.4.5", "@babel/core@^7.5.5", "@babel/core@^7.7.5", "@babel/core@^7.9.6": +"@babel/core@^7.1.0", "@babel/core@^7.10.2", "@babel/core@^7.10.3", "@babel/core@^7.10.5", "@babel/core@^7.11.0", "@babel/core@^7.12.0", "@babel/core@^7.12.10", "@babel/core@^7.12.3", "@babel/core@^7.4.4", "@babel/core@^7.4.5", "@babel/core@^7.5.5", "@babel/core@^7.7.5", "@babel/core@^7.9.6": version "7.12.10" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.10.tgz#b79a2e1b9f70ed3d84bbfb6d8c4ef825f606bccd" integrity sha512-eTAlQKq65zHfkHZV0sIVODCPGVgoo1HdBlbSLi9CqOzuZanMv2ihzY+4paiKr1mH+XmYESMAmJ/dpZ68eN6d8w== @@ -239,12 +217,12 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.10.3", "@babel/generator@^7.10.5", "@babel/generator@^7.11.0", "@babel/generator@^7.12.10", "@babel/generator@^7.12.5", "@babel/generator@^7.4.0", "@babel/generator@^7.4.4", "@babel/generator@^7.7.7", "@babel/generator@^7.9.0": - version "7.12.11" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.11.tgz#98a7df7b8c358c9a37ab07a24056853016aba3af" - integrity sha512-Ggg6WPOJtSi8yYQvLVjG8F/TlpWDlKx0OpS4Kt+xMQPs5OaGYWy+v1A+1TvxI6sAMGZpKWWoAQ1DaeQbImlItA== +"@babel/generator@^7.10.3", "@babel/generator@^7.11.0", "@babel/generator@^7.12.10", "@babel/generator@^7.12.5", "@babel/generator@^7.4.0", "@babel/generator@^7.4.4", "@babel/generator@^7.7.7", "@babel/generator@^7.9.0": + version "7.12.10" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.10.tgz#2b188fc329fb8e4f762181703beffc0fe6df3460" + integrity sha512-6mCdfhWgmqLdtTkhXjnIz0LcdVCd26wS2JXRtj2XY0u5klDsXBREA/pG5NVOuVnF2LUrBGNFtQkIqqTbblg0ww== dependencies: - "@babel/types" "^7.12.11" + "@babel/types" "^7.12.10" jsesc "^2.5.1" source-map "^0.5.0" @@ -362,7 +340,7 @@ dependencies: "@babel/types" "^7.12.5" -"@babel/helper-module-transforms@^7.10.4", "@babel/helper-module-transforms@^7.10.5", "@babel/helper-module-transforms@^7.11.0", "@babel/helper-module-transforms@^7.12.1", "@babel/helper-module-transforms@^7.9.0": +"@babel/helper-module-transforms@^7.10.4", "@babel/helper-module-transforms@^7.11.0", "@babel/helper-module-transforms@^7.12.1", "@babel/helper-module-transforms@^7.9.0": version "7.12.1" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz#7954fec71f5b32c48e4b303b437c34453fd7247c" integrity sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w== @@ -467,10 +445,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.1.3", "@babel/parser@^7.10.3", "@babel/parser@^7.10.5", "@babel/parser@^7.11.1", "@babel/parser@^7.12.10", "@babel/parser@^7.12.5", "@babel/parser@^7.12.7", "@babel/parser@^7.3.3", "@babel/parser@^7.4.3", "@babel/parser@^7.4.4", "@babel/parser@^7.7.0", "@babel/parser@^7.7.7", "@babel/parser@^7.9.0": - version "7.12.11" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.11.tgz#9ce3595bcd74bc5c466905e86c535b8b25011e79" - integrity sha512-N3UxG+uuF4CMYoNj8AhnbAcJF0PiuJ9KHuy1lQmkYsxTer/MAH9UBNHsBoAX/4s6NvlDD047No8mYVGGzLL4hg== +"@babel/parser@^7.1.0", "@babel/parser@^7.1.3", "@babel/parser@^7.10.3", "@babel/parser@^7.11.1", "@babel/parser@^7.12.10", "@babel/parser@^7.12.5", "@babel/parser@^7.12.7", "@babel/parser@^7.3.3", "@babel/parser@^7.4.3", "@babel/parser@^7.4.4", "@babel/parser@^7.7.0", "@babel/parser@^7.7.7", "@babel/parser@^7.9.0": + version "7.12.10" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.10.tgz#824600d59e96aea26a5a2af5a9d812af05c3ae81" + integrity sha512-PJdRPwyoOqFAWfLytxrWwGrAxghCgh/yTNCYciOz8QgjflA7aZhECPZAa2VUedKg2+QMWkI0L9lynh2SNmNEgA== "@babel/plugin-proposal-async-generator-functions@^7.10.4", "@babel/plugin-proposal-async-generator-functions@^7.12.1", "@babel/plugin-proposal-async-generator-functions@^7.8.3": version "7.12.1" @@ -1568,7 +1546,7 @@ "@babel/parser" "^7.12.7" "@babel/types" "^7.12.7" -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.10.3", "@babel/traverse@^7.10.4", "@babel/traverse@^7.10.5", "@babel/traverse@^7.11.0", "@babel/traverse@^7.12.1", "@babel/traverse@^7.12.10", "@babel/traverse@^7.12.5", "@babel/traverse@^7.12.9", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.0", "@babel/traverse@^7.7.4", "@babel/traverse@^7.9.0": +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.1.6", "@babel/traverse@^7.10.3", "@babel/traverse@^7.10.4", "@babel/traverse@^7.11.0", "@babel/traverse@^7.12.1", "@babel/traverse@^7.12.10", "@babel/traverse@^7.12.5", "@babel/traverse@^7.12.9", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.0", "@babel/traverse@^7.7.4", "@babel/traverse@^7.9.0": version "7.12.10" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.12.10.tgz#2d1f4041e8bf42ea099e5b2dc48d6a594c00017a" integrity sha512-6aEtf0IeRgbYWzta29lePeYSk+YAFIC3kyqESeft8o5CkFlYIMX+EQDDWEiAQ9LHOA3d0oHdgrSsID/CKqXJlg== @@ -1610,7 +1588,7 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" -"@babel/types@^7.0.0", "@babel/types@^7.0.0-beta.49", "@babel/types@^7.10.3", "@babel/types@^7.10.4", "@babel/types@^7.10.5", "@babel/types@^7.11.0", "@babel/types@^7.11.5", "@babel/types@^7.12.1", "@babel/types@^7.12.10", "@babel/types@^7.12.11", "@babel/types@^7.12.5", "@babel/types@^7.12.6", "@babel/types@^7.12.7", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.7.0", "@babel/types@^7.7.4", "@babel/types@^7.9.0": +"@babel/types@^7.0.0", "@babel/types@^7.0.0-beta.49", "@babel/types@^7.10.3", "@babel/types@^7.10.4", "@babel/types@^7.10.5", "@babel/types@^7.11.0", "@babel/types@^7.11.5", "@babel/types@^7.12.1", "@babel/types@^7.12.10", "@babel/types@^7.12.11", "@babel/types@^7.12.5", "@babel/types@^7.12.6", "@babel/types@^7.12.7", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.7.0", "@babel/types@^7.7.4", "@babel/types@^7.9.0": version "7.12.11" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.11.tgz#a86e4d71e30a9b6ee102590446c98662589283ce" integrity sha512-ukA9SQtKThINm++CX1CwmliMrE54J6nIYB5XTwL5f/CLFW9owfls+YSU8tVW15RQ2w+a3fSbPjC6HdQNtWZkiA== @@ -6090,13 +6068,6 @@ ast-types@0.13.2: resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.13.2.tgz#df39b677a911a83f3a049644fb74fdded23cea48" integrity sha512-uWMHxJxtfj/1oZClOxDEV1sQ1HCDkA4MG8Gr69KKeBjEVH0R84WlejZ0y2DcwyBlpAEMltmVYkVgqfLFb2oyiA== -ast-types@0.14.2: - version "0.14.2" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.14.2.tgz#600b882df8583e3cd4f2df5fa20fa83759d4bdfd" - integrity sha512-O0yuUDnZeQDL+ncNGlJ78BiO4jnYI3bvMsD5prT0/nsgijG/LpNBIr63gTjVTNsiGkgQhiyCShTgxt8oXOrklA== - dependencies: - tslib "^2.0.1" - astral-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" @@ -6430,7 +6401,7 @@ babel-helper-replace-supers@^6.24.1: babel-traverse "^6.24.1" babel-types "^6.24.1" -babel-helper-vue-jsx-merge-props@^2.0.3: +babel-helper-vue-jsx-merge-props@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz#22aebd3b33902328e513293a8e4992b384f9f1b6" integrity sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg== @@ -12225,7 +12196,7 @@ esprima@^3.1.3: resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= -esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0: +esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== @@ -12259,6 +12230,14 @@ estraverse@^5.1.0, estraverse@^5.2.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== +estree-to-babel@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/estree-to-babel/-/estree-to-babel-3.0.1.tgz#16579004d4f4f1a2a42f9da6551b282844fbb969" + integrity sha512-jNp7Ffa5XIgFZ5P2OwiSysNlngXt+QuHvomepSPDTDpnjf2hiXGKK69O1SXfe+HIePQBPM5ljHsswro+Zvf0IA== + dependencies: + "@babel/traverse" "^7.1.6" + "@babel/types" "^7.2.0" + estree-walker@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" @@ -14915,19 +14894,6 @@ hasha@^5.0.0, hasha@^5.2.0: is-stream "^2.0.0" type-fest "^0.8.0" -hast-to-hyperscript@9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/hast-to-hyperscript/-/hast-to-hyperscript-9.0.0.tgz#768fb557765fe28749169c885056417342d71e83" - integrity sha512-NJvMYU3GlMLs7hN3CRbsNlMzusVNkYBogVWDGybsuuVQ336gFLiD+q9qtFZT2meSHzln3pNISZWTASWothMSMg== - dependencies: - "@types/unist" "^2.0.3" - comma-separated-tokens "^1.0.0" - property-information "^5.3.0" - space-separated-tokens "^1.0.0" - style-to-object "^0.3.0" - unist-util-is "^4.0.0" - web-namespaces "^1.0.0" - hast-to-hyperscript@^9.0.0: version "9.0.1" resolved "https://registry.yarnpkg.com/hast-to-hyperscript/-/hast-to-hyperscript-9.0.1.tgz#9b67fd188e4c81e8ad66f803855334173920218d" @@ -14941,6 +14907,13 @@ hast-to-hyperscript@^9.0.0: unist-util-is "^4.0.0" web-namespaces "^1.0.0" +hast-util-embedded@^1.0.0: + version "1.0.6" + resolved "https://registry.yarnpkg.com/hast-util-embedded/-/hast-util-embedded-1.0.6.tgz#ea7007323351cc43e19e1d6256b7cde66ad1aa03" + integrity sha512-JQMW+TJe0UAIXZMjCJ4Wf6ayDV9Yv3PBDPsHD4ExBpAspJ6MOcCX+nzVF+UJVv7OqPcg852WEMSHQPoRA+FVSw== + dependencies: + hast-util-is-element "^1.1.0" + hast-util-from-parse5@^6.0.0: version "6.0.1" resolved "https://registry.yarnpkg.com/hast-util-from-parse5/-/hast-util-from-parse5-6.0.1.tgz#554e34abdeea25ac76f5bd950a1f0180e0b3bc2a" @@ -14963,7 +14936,7 @@ hast-util-heading-rank@^1.0.0: resolved "https://registry.yarnpkg.com/hast-util-heading-rank/-/hast-util-heading-rank-1.0.1.tgz#28dfd8b0724cfb0da48308e2a794b1d9f24fd80d" integrity sha512-P6Hq7RCky9syMevlrN90QWpqWDXCxwIVOfQR2rK6P4GpY4bqjKEuCzoWSRORZ7vz+VgRpLnXimh+mkwvVFjbyQ== -hast-util-is-element@^1.0.0: +hast-util-is-element@^1.0.0, hast-util-is-element@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/hast-util-is-element/-/hast-util-is-element-1.1.0.tgz#3b3ed5159a2707c6137b48637fbfe068e175a425" integrity sha512-oUmNua0bFbdrD/ELDSSEadRVtWZOf3iF6Lbv81naqsIV99RnSCieTbWuWCY8BAeEfKJTKl0gRdokv+dELutHGQ== @@ -15006,6 +14979,19 @@ hast-util-select@^1.0.1: space-separated-tokens "^1.1.0" zwitch "^1.0.0" +hast-util-to-estree@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/hast-util-to-estree/-/hast-util-to-estree-1.1.0.tgz#bc7ea111657962b4edc4a88c028f0365d9072454" + integrity sha512-AyEsrzGpnApUS7zo3MDDGPB+ZRsomHMGpcq254TK651tLgwvlbukQNsuUgDmP7j2FiY8I/1DxAM+/uILTpcUFg== + dependencies: + comma-separated-tokens "^1.0.0" + hast-util-whitespace "^1.0.0" + property-information "^5.0.0" + space-separated-tokens "^1.0.0" + style-to-object "^0.3.0" + unist-util-position "^3.1.0" + zwitch "^1.0.0" + hast-util-to-parse5@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/hast-util-to-parse5/-/hast-util-to-parse5-6.0.0.tgz#1ec44650b631d72952066cea9b1445df699f8479" @@ -15026,7 +15012,7 @@ hast-util-to-text@^2.0.0: repeat-string "^1.0.0" unist-util-find-after "^3.0.0" -hast-util-whitespace@^1.0.0: +hast-util-whitespace@^1.0.0, hast-util-whitespace@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-1.0.4.tgz#e4fe77c4a9ae1cb2e6c25e02df0043d0164f6e41" integrity sha512-I5GTdSfhYfAPNztx2xJRQpG8cuDSNt599/7YUn7Gx/WxNMsG+a835k97TDkFgk123cwjfwINaZknkKkphx/f2A== @@ -19581,6 +19567,14 @@ micromark-extension-mdx-expression@^0.1.1, micromark-extension-mdx-expression@~0 micromark "~2.11.0" vfile-message "^2.0.0" +micromark-extension-mdx-expression@^0.3.0, micromark-extension-mdx-expression@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-0.3.0.tgz#6952e9ab7b5fc7b43dc0fad7b6c486db05f77d36" + integrity sha512-hx6SgBEhoBzN7/zWBAU7X8OgxJyHQe3lA7cOUK3HIXZsJbr/N0tKrLR2izAXNkX7eRQWKrE+5bPVPjI34eHYnA== + dependencies: + micromark "~2.11.0" + vfile-message "^2.0.0" + micromark-extension-mdx-jsx@~0.1.0: version "0.1.4" resolved "https://registry.yarnpkg.com/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-0.1.4.tgz#349c117df3bc4bdce9fcdb438934099bfd04387c" @@ -19590,19 +19584,28 @@ micromark-extension-mdx-jsx@~0.1.0: micromark-extension-mdx-expression "^0.1.1" vfile-message "^2.0.0" +micromark-extension-mdx-jsx@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-0.3.0.tgz#ddd8790ec128477483489c59de796f554e28d473" + integrity sha512-A88CrOJnnqV4Fiu4//3H+UcFAUjiqr5Jna14lB/iCKEwAPOMOu2XLFnaMuBv4a8IHCkqzEkqEOKJSV8Kc9AjyA== + dependencies: + micromark "~2.11.0" + micromark-extension-mdx-expression "^0.3.0" + vfile-message "^2.0.0" + micromark-extension-mdx-md@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/micromark-extension-mdx-md/-/micromark-extension-mdx-md-0.1.1.tgz#277b4e82ada37bfdf222f6c3530e20563d73e064" integrity sha512-emlFQEyfx/2aPhwyEqeNDfKE6jPH1cvLTb5ANRo4qZBjaUObnzjLRdzK8RJ4Xc8+/dOmKN8TTRxFnOYF5/EAwQ== -micromark-extension-mdx@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/micromark-extension-mdx/-/micromark-extension-mdx-0.1.0.tgz#1c20c6a9aa0fa484d481502c4de8cc4d49e13d44" - integrity sha512-DNki8rRlbAeB9C2MmUfftZtVUz85QA6VrW9Fub99bToBrK4eSEM1t/de5xDDW95nUooAaoW3dcSWMql/g59wsQ== +micromark-extension-mdx@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/micromark-extension-mdx/-/micromark-extension-mdx-0.2.1.tgz#074b85013909481d23f382f17dced7b4cd173c0a" + integrity sha512-J+nZegf1ExPz1Ft6shxu8M9WfRom1gwRIx6gpJK1SEEqKzY5LjOR1d/WHRtjwV4KoMXrL53+PoN7T1Rw1euJew== dependencies: micromark "~2.11.0" - micromark-extension-mdx-expression "~0.1.0" - micromark-extension-mdx-jsx "~0.1.0" + micromark-extension-mdx-expression "~0.3.0" + micromark-extension-mdx-jsx "~0.3.0" micromark-extension-mdx-md "~0.1.0" micromark-extension-mdxjs-esm@~0.1.0: @@ -19613,6 +19616,15 @@ micromark-extension-mdxjs-esm@~0.1.0: micromark "~2.11.0" vfile-message "^2.0.0" +micromark-extension-mdxjs-esm@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/micromark-extension-mdxjs-esm/-/micromark-extension-mdxjs-esm-0.3.0.tgz#20d763aff4c539a491f41a40dd141223c8da1713" + integrity sha512-ZkI/cneSGQFdmB3iOT34n9Zq0Gc6vknAd1o2G7SaiCUY5D9a5ZCvGP/vCjHmlB7f2Y4b4+O1YMLywxYmQeUFwQ== + dependencies: + micromark "~2.11.0" + micromark-extension-mdx-expression "^0.3.0" + vfile-message "^2.0.0" + micromark-extension-mdxjs@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/micromark-extension-mdxjs/-/micromark-extension-mdxjs-0.1.0.tgz#53d35be8ae9f74c97dc7931aafbda6b6442a856d" @@ -19626,6 +19638,19 @@ micromark-extension-mdxjs@^0.1.0: micromark-extension-mdx-md "~0.1.0" micromark-extension-mdxjs-esm "~0.1.0" +micromark-extension-mdxjs@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/micromark-extension-mdxjs/-/micromark-extension-mdxjs-0.3.0.tgz#35ecebaf14b8377b6046b659780fd3111196eccd" + integrity sha512-NQuiYA0lw+eFDtSG4+c7ao3RG9dM4P0Kx/sn8OLyPhxtIc6k+9n14k5VfLxRKfAxYRTo8c5PLZPaRNmslGWxJw== + dependencies: + acorn "^8.0.0" + acorn-jsx "^5.0.0" + micromark "~2.11.0" + micromark-extension-mdx-expression "~0.3.0" + micromark-extension-mdx-jsx "~0.3.0" + micromark-extension-mdx-md "~0.1.0" + micromark-extension-mdxjs-esm "~0.3.0" + micromark@~2.11.0: version "2.11.2" resolved "https://registry.yarnpkg.com/micromark/-/micromark-2.11.2.tgz#e8b6a05f54697d2d3d27fc89600c6bc40dd05f35" @@ -24164,16 +24189,6 @@ rebass@^4.0.7: dependencies: reflexbox "^4.0.6" -recast@^0.20.4: - version "0.20.4" - resolved "https://registry.yarnpkg.com/recast/-/recast-0.20.4.tgz#db55983eac70c46b3fff96c8e467d65ffb4a7abc" - integrity sha512-6qLIBGGRcwjrTZGIiBpJVC/NeuXpogXNyRQpqU1zWPUigCphvApoCs9KIwDYh1eDuJ6dAFlQoi/QUyE5KQ6RBQ== - dependencies: - ast-types "0.14.2" - esprima "~4.0.0" - source-map "~0.6.1" - tslib "^2.0.1" - recursive-readdir@2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/recursive-readdir/-/recursive-readdir-2.2.1.tgz#90ef231d0778c5ce093c9a48d74e5c5422d13a99" @@ -24450,6 +24465,16 @@ rehype-katex@^4.0.0: unified "^9.0.0" unist-util-visit "^2.0.0" +rehype-minify-whitespace@^4.0.0: + version "4.0.5" + resolved "https://registry.yarnpkg.com/rehype-minify-whitespace/-/rehype-minify-whitespace-4.0.5.tgz#5b4781786116216f6d5d7ceadf84e2489dd7b3cd" + integrity sha512-QC3Z+bZ5wbv+jGYQewpAAYhXhzuH/TVRx7z08rurBmh9AbG8Nu8oJnvs9LWj43Fd/C7UIhXoQ7Wddgt+ThWK5g== + dependencies: + hast-util-embedded "^1.0.0" + hast-util-is-element "^1.0.0" + hast-util-whitespace "^1.0.4" + unist-util-is "^4.0.0" + rehype-parse@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/rehype-parse/-/rehype-parse-7.0.1.tgz#58900f6702b56767814afc2a9efa2d42b1c90c57" @@ -25375,13 +25400,6 @@ remark-parse@8.0.3, remark-parse@^8.0.3: vfile-location "^3.0.0" xtend "^4.0.1" -remark-parse@9.0.0, remark-parse@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-9.0.0.tgz#4d20a299665880e4f4af5d90b7c7b8a935853640" - integrity sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw== - dependencies: - mdast-util-from-markdown "^0.8.0" - remark-parse@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-5.0.0.tgz#4c077f9e499044d1d5c13f80d7a98cf7b9285d95" @@ -25424,6 +25442,13 @@ remark-parse@^6.0.0, remark-parse@^6.0.3: vfile-location "^2.0.0" xtend "^4.0.1" +remark-parse@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-9.0.0.tgz#4d20a299665880e4f4af5d90b7c7b8a935853640" + integrity sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw== + dependencies: + mdast-util-from-markdown "^0.8.0" + remark-preset-lint-recommended@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/remark-preset-lint-recommended/-/remark-preset-lint-recommended-4.0.1.tgz#2077b38706759277c0eb304c57453ebfa3e63207" @@ -25632,7 +25657,7 @@ remark-slug@^5.0.0: mdast-util-to-string "^1.0.0" unist-util-visit "^1.0.0" -remark-squeeze-paragraphs@4.0.0: +remark-squeeze-paragraphs@4.0.0, remark-squeeze-paragraphs@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/remark-squeeze-paragraphs/-/remark-squeeze-paragraphs-4.0.0.tgz#76eb0e085295131c84748c8e43810159c5653ead" integrity sha512-8qRqmL9F4nuLPIgl92XUuxI3pFxize+F1H0e/W3llTk0UsjJaj01+RrirkMw7P21RKe4X6goQhYRSvNWX+70Rw== @@ -29144,18 +29169,6 @@ unified-ui@^0.0.3: styled-components "^4.0.2" styled-system "^3.1.11" -unified@9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/unified/-/unified-9.0.0.tgz#12b099f97ee8b36792dbad13d278ee2f696eed1d" - integrity sha512-ssFo33gljU3PdlWLjNp15Inqb77d6JnJSfyplGJPT/a+fNRNyCBeveBAYJdO5khKdF6WVHa/yYCC7Xl6BDwZUQ== - dependencies: - bail "^1.0.0" - extend "^3.0.0" - is-buffer "^2.0.0" - is-plain-obj "^2.0.0" - trough "^1.0.0" - vfile "^4.0.0" - unified@9.2.0, unified@^9.0.0, unified@^9.1.0, unified@^9.2.0: version "9.2.0" resolved "https://registry.yarnpkg.com/unified/-/unified-9.2.0.tgz#67a62c627c40589edebbf60f53edfd4d822027f8"