Skip to content

Commit

Permalink
Add wrappers for yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed Jan 20, 2025
1 parent a08634e commit ed16393
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ To learn more please refer to the [API Reference](https://jetbrains.github.io/ko
| `kotlin-vercel-ncc` | [API](https://jetbrains.github.io/kotlin-wrappers/kotlin-vercel-ncc) | [README](kotlin-vercel-ncc/README.md) | | [![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin-wrappers/kotlin-vercel-ncc)](https://mvnrepository.com/artifact/org.jetbrains.kotlin-wrappers/kotlin-vercel-ncc/) |
| `kotlin-web` | [API](https://jetbrains.github.io/kotlin-wrappers/kotlin-web) | [README](kotlin-web/README.md) | | [![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin-wrappers/kotlin-web)](https://mvnrepository.com/artifact/org.jetbrains.kotlin-wrappers/kotlin-web/) |
| `kotlin-wrappers-bom` | [API](https://jetbrains.github.io/kotlin-wrappers/kotlin-wrappers-bom) | [README](kotlin-wrappers-bom/README.md) | | [![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin-wrappers/kotlin-wrappers-bom)](https://mvnrepository.com/artifact/org.jetbrains.kotlin-wrappers/kotlin-wrappers-bom/) |
| `kotlin-yaml` | [API](https://jetbrains.github.io/kotlin-wrappers/kotlin-yaml) | [README](kotlin-yaml/README.md) | | [![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin-wrappers/kotlin-yaml)](https://mvnrepository.com/artifact/org.jetbrains.kotlin-wrappers/kotlin-yaml/) |

Artifacts are published to Maven Central, see the corresponding README files for package coordinates.

Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,6 @@ inline-style-prefixer.npm.version=^7.0.1

# https://www.npmjs.com/package/puppeteer
puppeteer.npm.version=^24.1.0

# https://www.npmjs.com/package/yaml
yaml.npm.version=^2.7.0
5 changes: 5 additions & 0 deletions kotlin-yaml/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin-wrappers/kotlin-yaml)](https://mvnrepository.com/artifact/org.jetbrains.kotlin-wrappers/kotlin-yaml)

# Module kotlin-yaml

Kotlin wrapper for the [YAML](https://eemeli.org/yaml/) library.
7 changes: 7 additions & 0 deletions kotlin-yaml/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-library-conventions`
}

dependencies {
jsMainApi(npm(libs.npm.yaml))
}
2 changes: 2 additions & 0 deletions kotlin-yaml/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
description=Kotlin wrapper for YAML
js.platform=web
19 changes: 19 additions & 0 deletions kotlin-yaml/src/jsMain/kotlin/yaml/parse.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package yaml

@JsModule("yaml")
external object YAML {
/**
* Parse an input string into JavaScript.
*
* Only supports input consisting of a single YAML document; for multi-document
* support you should use `YAML.parseAllDocuments`. May throw on error, and may
* log warnings using `console.warn`.
*
* @param str - A string with YAML formatting.
* @param reviver - A reviver function, as in `JSON.parse()`
* @returns The value will match the type of the root value of the parsed YAML
* document, so Maps become objects, Sequences arrays, and scalars result in
* nulls, booleans, numbers and strings.
*/
fun <T> parse(src: String): T
}
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,6 @@ include("kotlin-web")
include("kotlin-wrappers-bom")

include("kotlin-wrappers-catalog")

// Kotlin/JS: yaml wrappers
include("kotlin-yaml")

0 comments on commit ed16393

Please sign in to comment.