New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

xastscript

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xastscript - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

4

package.json
{
"name": "xastscript",
"version": "2.1.0",
"version": "2.1.1",
"description": "xast utility to create trees",

@@ -48,3 +48,3 @@ "license": "MIT",

"unist-builder": "^2.0.0",
"xo": "^0.34.0"
"xo": "^0.36.0"
},

@@ -51,0 +51,0 @@ "scripts": {

@@ -234,2 +234,17 @@ # xastscript

For [TypeScript][], this can be done by setting `"jsx": "react"`,
`"jsxFactory": "x"`, and `"jsxFragmentFactory": "null"` in the compiler options.
For more details on configuring JSX for TypeScript, see the
[TypeScript JSX handbook page][].
TypeScript also lets you configure this in a script:
```tsx
/** @jsx x */
/** @jsxFrag null */
import * as x from 'xastscript'
console.log(<music />)
```
## Security

@@ -331,1 +346,5 @@

[babel-jsx]: https://github.com/babel/babel/tree/main/packages/babel-plugin-transform-react-jsx
[typescript]: https://www.typescriptlang.org
[typescript jsx handbook page]: https://www.typescriptlang.org/docs/handbook/jsx.html

@@ -1,6 +0,6 @@

// TypeScript Version: 3.7
// TypeScript Version: 4.0
import {Element, Node} from 'xast'
import * as xast from 'xast'
type Children = string | Node | number | Children[]
type Children = string | xast.Node | number | Children[]

@@ -20,3 +20,3 @@ type Primitive = null | undefined | string | number

*/
declare function xastscript(name: string, ...children: Children[]): Element
declare function xastscript(name: string, ...children: Children[]): xast.Element

@@ -27,2 +27,10 @@ /**

* @param name Qualified name. Case sensitive and can contain a namespace prefix (such as rdf:RDF).
* @param children (Lists of) child nodes. When strings are encountered, they are mapped to Text nodes.
*/
declare function xastscript(name: null, ...children: Children[]): xast.Root
/**
* Create XML trees in xast.
*
* @param name Qualified name. Case sensitive and can contain a namespace prefix (such as rdf:RDF).
* @param attributes Map of attributes. Nullish (null or undefined) or NaN values are ignored, other values are turned to strings.

@@ -35,4 +43,56 @@ * @param children (Lists of) child nodes. When strings are encountered, they are mapped to Text nodes.

...children: Children[]
): Element
): xast.Element
/**
* This unique symbol is declared to specify the key on which JSX children are passed, without conflicting
* with the Attributes type.
*/
declare const children: unique symbol
/**
* This namespace allows to use `xastscript` as a JSX implementation.
*
* This namespace is only used to support the use as JSX. It’s **not** intended for direct usage.
*/
declare namespace xastscript.JSX {
/**
* This defines the return value of JSX syntax.
*/
type Element = xast.Element | xast.Root
/**
* This disallows the use of functional components.
*/
type IntrinsicAttributes = never
/**
* This defines the prop types for known elements.
*
* For `xastscript` this defines any string may be used in combination with `xast` `Attributes`.
*
* This **must** be an interface.
*/
// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
interface IntrinsicElements {
[tagName: string]:
| Attributes
| {
/**
* The prop that matches `ElementChildrenAttribute` key defines the type of JSX children, defines the children type.
*/
[children]?: Children
}
}
/**
* The key of this interface defines as what prop children are passed.
*/
interface ElementChildrenAttribute {
/**
* Only the key matters, not the value.
*/
[children]?: never
}
}
export = xastscript
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