Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

micromark-extension-mdx-expression

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micromark-extension-mdx-expression - npm Package Compare versions

Comparing version 1.0.8 to 2.0.0

9

dev/lib/syntax.d.ts

@@ -33,3 +33,4 @@ /**

/**
* Whether to add `estree` fields to tokens with results from acorn.
* Whether to add `estree` fields to tokens with results from acorn (default:
* `false`).
*/

@@ -39,3 +40,4 @@ addResult?: boolean | null | undefined

* Undocumented option to parse only a spread (used by
* `micromark-extension-mdx-jsx` to parse spread attributes).
* `micromark-extension-mdx-jsx` to parse spread attributes) (default:
* `false`).
*/

@@ -45,5 +47,6 @@ spread?: boolean | null | undefined

* Undocumented option to disallow empty attributes (used by
* `micromark-extension-mdx-jsx` to prohobit empty attribute values).
* `micromark-extension-mdx-jsx` to prohobit empty attribute values)
* (default: `false`).
*/
allowEmpty?: boolean | null | undefined
}

@@ -21,17 +21,19 @@ /**

* @property {boolean | null | undefined} [addResult=false]
* Whether to add `estree` fields to tokens with results from acorn.
* Whether to add `estree` fields to tokens with results from acorn (default:
* `false`).
* @property {boolean | null | undefined} [spread=false]
* Undocumented option to parse only a spread (used by
* `micromark-extension-mdx-jsx` to parse spread attributes).
* `micromark-extension-mdx-jsx` to parse spread attributes) (default:
* `false`).
* @property {boolean | null | undefined} [allowEmpty=true]
* Undocumented option to disallow empty attributes (used by
* `micromark-extension-mdx-jsx` to prohobit empty attribute values).
* `micromark-extension-mdx-jsx` to prohobit empty attribute values)
* (default: `false`).
*/
import {ok as assert} from 'devlop'
import {factoryMdxExpression} from 'micromark-factory-mdx-expression'
import {factorySpace} from 'micromark-factory-space'
import {markdownLineEnding, markdownSpace} from 'micromark-util-character'
import {codes} from 'micromark-util-symbol/codes.js'
import {types} from 'micromark-util-symbol/types.js'
import {ok as assert} from 'uvu/assert'
import {codes, types} from 'micromark-util-symbol'

@@ -38,0 +40,0 @@ /**

@@ -33,3 +33,4 @@ /**

/**
* Whether to add `estree` fields to tokens with results from acorn.
* Whether to add `estree` fields to tokens with results from acorn (default:
* `false`).
*/

@@ -39,3 +40,4 @@ addResult?: boolean | null | undefined

* Undocumented option to parse only a spread (used by
* `micromark-extension-mdx-jsx` to parse spread attributes).
* `micromark-extension-mdx-jsx` to parse spread attributes) (default:
* `false`).
*/

@@ -45,5 +47,6 @@ spread?: boolean | null | undefined

* Undocumented option to disallow empty attributes (used by
* `micromark-extension-mdx-jsx` to prohobit empty attribute values).
* `micromark-extension-mdx-jsx` to prohobit empty attribute values)
* (default: `false`).
*/
allowEmpty?: boolean | null | undefined
}

@@ -21,9 +21,12 @@ /**

* @property {boolean | null | undefined} [addResult=false]
* Whether to add `estree` fields to tokens with results from acorn.
* Whether to add `estree` fields to tokens with results from acorn (default:
* `false`).
* @property {boolean | null | undefined} [spread=false]
* Undocumented option to parse only a spread (used by
* `micromark-extension-mdx-jsx` to parse spread attributes).
* `micromark-extension-mdx-jsx` to parse spread attributes) (default:
* `false`).
* @property {boolean | null | undefined} [allowEmpty=true]
* Undocumented option to disallow empty attributes (used by
* `micromark-extension-mdx-jsx` to prohobit empty attribute values).
* `micromark-extension-mdx-jsx` to prohobit empty attribute values)
* (default: `false`).
*/

@@ -30,0 +33,0 @@

{
"name": "micromark-extension-mdx-expression",
"version": "1.0.8",
"version": "2.0.0",
"description": "micromark extension to support MDX or MDX JS expressions",

@@ -37,4 +37,6 @@ "license": "MIT",

"type": "module",
"main": "index.js",
"types": "dev/index.d.ts",
"exports": {
"development": "./dev/index.js",
"default": "./index.js"
},
"files": [

@@ -46,15 +48,11 @@ "dev/",

],
"exports": {
"development": "./dev/index.js",
"default": "./index.js"
},
"dependencies": {
"@types/estree": "^1.0.0",
"micromark-factory-mdx-expression": "^1.0.0",
"micromark-factory-space": "^1.0.0",
"micromark-util-character": "^1.0.0",
"micromark-util-events-to-acorn": "^1.0.0",
"micromark-util-symbol": "^1.0.0",
"micromark-util-types": "^1.0.0",
"uvu": "^0.5.0"
"devlop": "^1.0.0",
"micromark-factory-mdx-expression": "^2.0.0",
"micromark-factory-space": "^2.0.0",
"micromark-util-character": "^2.0.0",
"micromark-util-events-to-acorn": "^2.0.0",
"micromark-util-symbol": "^2.0.0",
"micromark-util-types": "^2.0.0"
},

@@ -64,9 +62,9 @@ "scripts": {

},
"xo": false,
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true,
"ignoreCatch": true
}
"ignoreCatch": true,
"strict": true
},
"xo": false
}

@@ -26,4 +26,6 @@ # micromark-extension-mdx-expression

* [Unexpected end of file in expression, expected a corresponding closing brace for `{`](#unexpected-end-of-file-in-expression-expected-a-corresponding-closing-brace-for-)
* [Could not parse expression with acorn: Unexpected content after expression](#could-not-parse-expression-with-acorn-unexpected-content-after-expression)
* [Could not parse expression with acorn: $error](#could-not-parse-expression-with-acorn-error)
* [Unexpected lazy line in expression in container, expected line to be prefixed…](#unexpected-lazy-line-in-expression-in-container-expected-line-to-be-prefixed)
* [Unexpected `$type` in code: expected an object spread (`{...spread}`)](#unexpected-type-in-code-expected-an-object-spread-spread)
* [Unexpected extra content in spread: only a single spread is supported](#unexpected-extra-content-in-spread-only-a-single-spread-is-supported)
* [Could not parse expression with acorn](#could-not-parse-expression-with-acorn)
* [Tokens](#tokens)

@@ -74,3 +76,3 @@ * [Types](#types)

```js
import {mdxExpression} from 'https://esm.sh/micromark-extension-mdx-expression@1'
import {mdxExpression} from 'https://esm.sh/micromark-extension-mdx-expression@2'
```

@@ -82,3 +84,3 @@

<script type="module">
import {mdxExpression} from 'https://esm.sh/micromark-extension-mdx-expression@1?bundle'
import {mdxExpression} from 'https://esm.sh/micromark-extension-mdx-expression@2?bundle'
</script>

@@ -111,12 +113,20 @@ ```

```txt
[1:5: Could not parse expression with acorn: Unexpected token] {
reason: 'Could not parse expression with acorn: Unexpected token',
[1:5: Could not parse expression with acorn] {
ancestors: undefined,
cause: SyntaxError: Unexpected token
at pp$4.raise (file:///Users/tilde/Projects/oss/micromark-extension-mdx-expression/node_modules/acorn/dist/acorn.mjs:3547:13)
at pp$9.unexpected (file:///Users/tilde/Projects/oss/micromark-extension-mdx-expression/node_modules/acorn/dist/acorn.mjs:758:8)
pos: 4,
loc: { line: 1, column: 4 },
raisedAt: 1
},
column: 5,
fatal: undefined,
line: 1,
column: 5,
place: { line: 1, column: 5, offset: 4 },
reason: 'Could not parse expression with acorn',
ruleId: 'acorn',
source: 'micromark-extension-mdx-expression',
ruleId: 'acorn',
position: {
start: { line: 1, column: 5, offset: 4 },
end: { line: null, column: null }
}
url: 'https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression#could-not-parse-expression-with-acorn'
}

@@ -200,3 +210,3 @@ ```

```markdown
```mdx
Here is an expression in a heading:

@@ -225,3 +235,5 @@

}!
```
```mdx-broken
Blank lines cannot occur in text, because markdown has already split them in

@@ -231,4 +243,5 @@ separate constructs, so this is incorrect: {1 +

1}
```
```mdx
In flow, you can have blank lines:

@@ -251,23 +264,48 @@

```markdown
```mdx-broken
a { b
```
### Could not parse expression with acorn: Unexpected content after expression
### Unexpected lazy line in expression in container, expected line to be prefixed…
This error occurs when there is more content after a JS expression (source:
`micromark-extension-mdx-expression`, rule id: `acorn`).
This error occurs if a `{` was seen in a container which then has lazy content
(source: `micromark-extension-mdx-expression`, rule id: `unexpected-lazy`).
For example:
```markdown
a {"b" "c"} d
```mdx-broken
> {a
b}
```
### Could not parse expression with acorn: $error
### Unexpected `$type` in code: expected an object spread (`{...spread}`)
This error occurs if acorn crashes (source: `micromark-extension-mdx-expression`,
rule id: `acorn`).
This error occurs if a spread was expected but something else was found
(source: `micromark-extension-mdx-expression`, rule id: `non-spread`).
For example:
```markdown
```mdx-broken
<a {b=c}={} d>
```
### Unexpected extra content in spread: only a single spread is supported
This error occurs if a spread was expected but more was found after it
(source: `micromark-extension-mdx-expression`, rule id: `spread-extra`).
For example:
```mdx-broken
<a {...b,c} d>
```
### Could not parse expression with acorn
This error occurs if acorn crashes or when there is more content after a JS
expression (source: `micromark-extension-mdx-expression`, rule id: `acorn`).
For example:
```mdx-broken
a {"b" "c"} d
```
```mdx-broken
a {var b = "c"} d

@@ -296,9 +334,12 @@ ```

Projects maintained by the unified collective are compatible with all maintained
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
As of now, that is Node.js 16+.
Our projects sometimes work with older versions, but this is not guaranteed.
These extensions work with `micromark` version 3+.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line,
`micromark-extension-mdx-expression@^2`, compatible with Node.js 16.
This package works with `micromark` version `3` and later.
## Security

@@ -345,5 +386,5 @@

[size-badge]: https://img.shields.io/bundlephobia/minzip/micromark-extension-mdx-expression.svg
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-mdx-expression
[size]: https://bundlephobia.com/result?p=micromark-extension-mdx-expression
[size]: https://bundlejs.com/?q=micromark-extension-mdx-expression

@@ -350,0 +391,0 @@ [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc