From a92f9673acc074b1fce83a065c2141bdc02b54f9 Mon Sep 17 00:00:00 2001 From: Kirill Grachev Date: Sat, 22 Apr 2023 17:10:23 +0300 Subject: [PATCH 01/59] SNRK-58: Add gradle files to new subproject --- settings.gradle.kts | 1 + snark-document-builder/build.gradle.kts | 15 +++++++++++++++ snark-document-builder/src/main/kotlin/Hello.kt | 12 ++++++++++++ snark-document-builder/src/test/kotlin/Hello.kt | 11 +++++++++++ 4 files changed, 39 insertions(+) create mode 100644 snark-document-builder/build.gradle.kts create mode 100644 snark-document-builder/src/main/kotlin/Hello.kt create mode 100644 snark-document-builder/src/test/kotlin/Hello.kt diff --git a/settings.gradle.kts b/settings.gradle.kts index 7e9af2c..e502783 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -43,4 +43,5 @@ include( ":snark-html", ":snark-ktor", ":snark-storage-driver", + ":snark-document-builder", ) \ No newline at end of file diff --git a/snark-document-builder/build.gradle.kts b/snark-document-builder/build.gradle.kts new file mode 100644 index 0000000..4895628 --- /dev/null +++ b/snark-document-builder/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + id("space.kscience.gradle.jvm") + `maven-publish` +} + +val coroutinesVersion = space.kscience.gradle.KScienceVersions.coroutinesVersion +val jacksonVersion = "2.14.2" + + +dependencies { + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") + + implementation(project(":snark-storage-driver")) + implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion") +} diff --git a/snark-document-builder/src/main/kotlin/Hello.kt b/snark-document-builder/src/main/kotlin/Hello.kt new file mode 100644 index 0000000..027138f --- /dev/null +++ b/snark-document-builder/src/main/kotlin/Hello.kt @@ -0,0 +1,12 @@ +package hello + +import com.fasterxml.jackson.core.io.BigDecimalParser +import space.kscience.snark.storage.* +import space.kscience.snark.storage.local.LocalDirectory +import java.nio.file.Path + + +public suspend fun doSomethingEssential() { + val dir: Directory = LocalDirectory(".") + dir.get("notexists") +} \ No newline at end of file diff --git a/snark-document-builder/src/test/kotlin/Hello.kt b/snark-document-builder/src/test/kotlin/Hello.kt new file mode 100644 index 0000000..4ba4d64 --- /dev/null +++ b/snark-document-builder/src/test/kotlin/Hello.kt @@ -0,0 +1,11 @@ +package hello + +import org.junit.jupiter.api.Test +import kotlinx.coroutines.runBlocking + +class SomeTest { + @Test + fun testEssential() = runBlocking { + doSomethingEssential() + } +} From 4465e68408d5d6fd405fe746046d863cce56d55b Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Mon, 24 Apr 2023 07:01:31 +0300 Subject: [PATCH 02/59] SNRK-66:buildDocument function scratch is added, AstNodes are copied from prototype --- snark-document-builder/build.gradle.kts | 2 + .../src/main/kotlin/DocumentBuilder.kt | 16 +++ .../src/main/kotlin/Hello.kt | 12 -- .../src/main/kotlin/MdParser.kt | 112 ++++++++++++++++++ .../kotlin/{Hello.kt => DocumentBuilder.kt} | 4 +- 5 files changed, 132 insertions(+), 14 deletions(-) create mode 100644 snark-document-builder/src/main/kotlin/DocumentBuilder.kt delete mode 100644 snark-document-builder/src/main/kotlin/Hello.kt create mode 100644 snark-document-builder/src/main/kotlin/MdParser.kt rename snark-document-builder/src/test/kotlin/{Hello.kt => DocumentBuilder.kt} (71%) diff --git a/snark-document-builder/build.gradle.kts b/snark-document-builder/build.gradle.kts index 4895628..d7d9d05 100644 --- a/snark-document-builder/build.gradle.kts +++ b/snark-document-builder/build.gradle.kts @@ -1,6 +1,7 @@ plugins { id("space.kscience.gradle.jvm") `maven-publish` + id("kotlinx-serialization") } val coroutinesVersion = space.kscience.gradle.KScienceVersions.coroutinesVersion @@ -12,4 +13,5 @@ dependencies { implementation(project(":snark-storage-driver")) implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3") } diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt new file mode 100644 index 0000000..891848c --- /dev/null +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -0,0 +1,16 @@ +package documentBuilder + +import com.fasterxml.jackson.core.io.BigDecimalParser +import space.kscience.snark.storage.* +import space.kscience.snark.storage.local.LocalDirectory +import java.nio.file.Path + +val DEFAULT_DOCUMENT_ROOT = "main.md" + +public suspend fun buildDocument(documentPath: String) { + val documentDirectory: Directory = LocalDirectory(documentPath) + val documentRoot = documentDirectory.get(DEFAULT_DOCUMENT_ROOT) + + // val (dependencies, vertex) = parseMd(documentRoot.readAll()) + +} \ No newline at end of file diff --git a/snark-document-builder/src/main/kotlin/Hello.kt b/snark-document-builder/src/main/kotlin/Hello.kt deleted file mode 100644 index 027138f..0000000 --- a/snark-document-builder/src/main/kotlin/Hello.kt +++ /dev/null @@ -1,12 +0,0 @@ -package hello - -import com.fasterxml.jackson.core.io.BigDecimalParser -import space.kscience.snark.storage.* -import space.kscience.snark.storage.local.LocalDirectory -import java.nio.file.Path - - -public suspend fun doSomethingEssential() { - val dir: Directory = LocalDirectory(".") - dir.get("notexists") -} \ No newline at end of file diff --git a/snark-document-builder/src/main/kotlin/MdParser.kt b/snark-document-builder/src/main/kotlin/MdParser.kt new file mode 100644 index 0000000..0d40c67 --- /dev/null +++ b/snark-document-builder/src/main/kotlin/MdParser.kt @@ -0,0 +1,112 @@ +package documentBuilder + +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo + +sealed interface DependencyGraphEdge { +} + +data class IncludeDependency( + val parentNode: MdAstParent, + val dependentNode: Iterator, + val includeList: List +) : DependencyGraphEdge + +data class DependencyGraphVertex( + val mdAst: MdAstRoot, + val dependencies: MutableList +) + +// data class DependencyGraph( +// val root: DependencyGraphVertex +// ) + +enum class DependenceType { + INCLUDE +} + +data class ParseResult(val dependencies: Dependencies, val vertex: DependencyGraphVertex) + +typealias Dependencies = HashMap> + +// public suspend fun parseMd(mdFile: ByteArray): ParseResult { +// } + +@Serializable +data class Point(val line: Int, val column: Int, val offset: Int) + +@Serializable +data class Position(val start: Point, val end: Point) + +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type" +) +@JsonSubTypes( + JsonSubTypes.Type(value = MdAstRoot::class, name = "root"), + JsonSubTypes.Type(value = MdAstParagraph::class, name = "paragraph"), + JsonSubTypes.Type(value = MdAstText::class, name = "text"), + JsonSubTypes.Type(value = MdAstHeading::class, name = "heading"), + JsonSubTypes.Type(value = MdAstCode::class, name = "code"), + JsonSubTypes.Type(value = MdAstBlockquote::class, name = "blockquote") +) +@Serializable +sealed interface MdAstElement{ + abstract var position: Position +} + +@Serializable +sealed interface MdAstParent: MdAstElement{ + var children: List +} + +@Serializable +@SerialName("root") +data class MdAstRoot( + override var children: List, + override var position: Position +): MdAstParent + + +@Serializable +@SerialName("paragraph") +data class MdAstParagraph( + override var children: List, + override var position: Position +): MdAstParent + + +@Serializable +@SerialName("text") +data class MdAstText( + val value: String, + override var position: Position +): MdAstElement + + +@Serializable +@SerialName("heading") +data class MdAstHeading( + val depth: Int, + override var children: List, + override var position: Position +): MdAstParent + +@Serializable +@SerialName("code") +data class MdAstCode( + var lang: String? = null, + var meta: String? = null, + var value: String, + override var position: Position, +) : MdAstElement + +@Serializable +@SerialName("blockquote") +data class MdAstBlockquote( + override var children: List, + override var position: Position +): MdAstParent \ No newline at end of file diff --git a/snark-document-builder/src/test/kotlin/Hello.kt b/snark-document-builder/src/test/kotlin/DocumentBuilder.kt similarity index 71% rename from snark-document-builder/src/test/kotlin/Hello.kt rename to snark-document-builder/src/test/kotlin/DocumentBuilder.kt index 4ba4d64..1c4436f 100644 --- a/snark-document-builder/src/test/kotlin/Hello.kt +++ b/snark-document-builder/src/test/kotlin/DocumentBuilder.kt @@ -1,4 +1,4 @@ -package hello +package documentBuilder import org.junit.jupiter.api.Test import kotlinx.coroutines.runBlocking @@ -6,6 +6,6 @@ import kotlinx.coroutines.runBlocking class SomeTest { @Test fun testEssential() = runBlocking { - doSomethingEssential() + buildDocument("./example") } } From 0ef269ec5cef79ef212605e03834e384377502e2 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Mon, 24 Apr 2023 07:24:18 +0300 Subject: [PATCH 03/59] SNRK-66: documentDependencies and dependencyGraph are added --- snark-document-builder/src/main/kotlin/DocumentBuilder.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index 891848c..cd4ddfd 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -11,6 +11,12 @@ public suspend fun buildDocument(documentPath: String) { val documentDirectory: Directory = LocalDirectory(documentPath) val documentRoot = documentDirectory.get(DEFAULT_DOCUMENT_ROOT) - // val (dependencies, vertex) = parseMd(documentRoot.readAll()) + val (dependencies, vertex) = parseMd(documentRoot.readAll()) + val documentDependencies: HashMap = HashMap() + val dependencyGraph: HashMap = + HashMap() + + documentDependencies.put(documentPath, dependencies) + dependencyGraph.put(documentPath, vertex) } \ No newline at end of file From 49c350abad8a06414f6a24bfe494765883f535e1 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Mon, 24 Apr 2023 07:27:07 +0300 Subject: [PATCH 04/59] SNRK-66: parseMd is added --- snark-document-builder/src/main/kotlin/MdParser.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/MdParser.kt b/snark-document-builder/src/main/kotlin/MdParser.kt index 0d40c67..5b6b5c2 100644 --- a/snark-document-builder/src/main/kotlin/MdParser.kt +++ b/snark-document-builder/src/main/kotlin/MdParser.kt @@ -19,10 +19,6 @@ data class DependencyGraphVertex( val dependencies: MutableList ) -// data class DependencyGraph( -// val root: DependencyGraphVertex -// ) - enum class DependenceType { INCLUDE } @@ -31,8 +27,9 @@ data class ParseResult(val dependencies: Dependencies, val vertex: DependencyGra typealias Dependencies = HashMap> -// public suspend fun parseMd(mdFile: ByteArray): ParseResult { -// } +public suspend fun parseMd(mdFile: ByteArray): ParseResult { + TODO() +} @Serializable data class Point(val line: Int, val column: Int, val offset: Int) From 0ab26812f84cda66e22ef5c58aae531494c2577c Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Mon, 24 Apr 2023 07:27:32 +0300 Subject: [PATCH 05/59] SNRK-66: example is added --- snark-document-builder/src/test/example/main.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 snark-document-builder/src/test/example/main.md diff --git a/snark-document-builder/src/test/example/main.md b/snark-document-builder/src/test/example/main.md new file mode 100644 index 0000000..e69de29 From 57df19f1bf07e9c619ee45de6b8647b325079bc1 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Mon, 24 Apr 2023 07:27:44 +0300 Subject: [PATCH 06/59] SNRK-66: better test --- snark-document-builder/src/test/kotlin/DocumentBuilder.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snark-document-builder/src/test/kotlin/DocumentBuilder.kt b/snark-document-builder/src/test/kotlin/DocumentBuilder.kt index 1c4436f..bc019e3 100644 --- a/snark-document-builder/src/test/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/test/kotlin/DocumentBuilder.kt @@ -6,6 +6,6 @@ import kotlinx.coroutines.runBlocking class SomeTest { @Test fun testEssential() = runBlocking { - buildDocument("./example") + buildDocument("../example") } } From ea4fef95b897e9379b5322fa99b234376b7c78d4 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sun, 30 Apr 2023 22:33:40 +0300 Subject: [PATCH 07/59] SNRK-70: MdAstElements and DependencyGraph moved to seperate files, return type of parseMd is changed to DepencyGraphVertex --- .../src/main/kotlin/DependencyGraph.kt | 19 +++ .../src/main/kotlin/MdAstElements.kt | 84 ++++++++++++++ .../src/main/kotlin/MdParser.kt | 108 +----------------- 3 files changed, 105 insertions(+), 106 deletions(-) create mode 100644 snark-document-builder/src/main/kotlin/DependencyGraph.kt create mode 100644 snark-document-builder/src/main/kotlin/MdAstElements.kt diff --git a/snark-document-builder/src/main/kotlin/DependencyGraph.kt b/snark-document-builder/src/main/kotlin/DependencyGraph.kt new file mode 100644 index 0000000..c10e666 --- /dev/null +++ b/snark-document-builder/src/main/kotlin/DependencyGraph.kt @@ -0,0 +1,19 @@ +package documentBuilder + +sealed interface DependencyGraphEdge { +} + +data class IncludeDependency( + val parentNode: MdAstParent, + val dependentNode: Iterator, + val includeList: List +) : DependencyGraphEdge + +data class DependencyGraphNode( + val mdAst: MdAstRoot, + val dependencies: List +) + +data class DependencyGraph( + val nodes: Map +) \ No newline at end of file diff --git a/snark-document-builder/src/main/kotlin/MdAstElements.kt b/snark-document-builder/src/main/kotlin/MdAstElements.kt new file mode 100644 index 0000000..313ca2b --- /dev/null +++ b/snark-document-builder/src/main/kotlin/MdAstElements.kt @@ -0,0 +1,84 @@ +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerialName +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo + +package documentBuilder + +@Serializable +data class Point(val line: Int, val column: Int, val offset: Int) + +@Serializable +data class Position(val start: Point, val end: Point) + +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type" +) + +@JsonSubTypes( + JsonSubTypes.Type(value = MdAstRoot::class, name = "root"), + JsonSubTypes.Type(value = MdAstParagraph::class, name = "paragraph"), + JsonSubTypes.Type(value = MdAstText::class, name = "text"), + JsonSubTypes.Type(value = MdAstHeading::class, name = "heading"), + JsonSubTypes.Type(value = MdAstCode::class, name = "code"), + JsonSubTypes.Type(value = MdAstBlockquote::class, name = "blockquote") +) + +@Serializable +sealed interface MdAstElement{ + abstract var position: Position +} + +@Serializable +sealed interface MdAstParent: MdAstElement{ + var children: List +} + +@Serializable +@SerialName("root") +data class MdAstRoot( + override var children: List, + override var position: Position +): MdAstParent + + +@Serializable +@SerialName("paragraph") +data class MdAstParagraph( + override var children: List, + override var position: Position +): MdAstParent + + +@Serializable +@SerialName("text") +data class MdAstText( + val value: String, + override var position: Position +): MdAstElement + +@Serializable +@SerialName("heading") +data class MdAstHeading( + val depth: Int, + override var children: List, + override var position: Position +): MdAstParent + +@Serializable +@SerialName("code") +data class MdAstCode( + var lang: String? = null, + var meta: String? = null, + var value: String, + override var position: Position, +) : MdAstElement + +@Serializable +@SerialName("blockquote") +data class MdAstBlockquote( + override var children: List, + override var position: Position +): MdAstParent \ No newline at end of file diff --git a/snark-document-builder/src/main/kotlin/MdParser.kt b/snark-document-builder/src/main/kotlin/MdParser.kt index 5b6b5c2..69c97d0 100644 --- a/snark-document-builder/src/main/kotlin/MdParser.kt +++ b/snark-document-builder/src/main/kotlin/MdParser.kt @@ -1,109 +1,5 @@ package documentBuilder -import kotlinx.serialization.Serializable -import kotlinx.serialization.SerialName -import com.fasterxml.jackson.annotation.JsonSubTypes -import com.fasterxml.jackson.annotation.JsonTypeInfo - -sealed interface DependencyGraphEdge { -} - -data class IncludeDependency( - val parentNode: MdAstParent, - val dependentNode: Iterator, - val includeList: List -) : DependencyGraphEdge - -data class DependencyGraphVertex( - val mdAst: MdAstRoot, - val dependencies: MutableList -) - -enum class DependenceType { - INCLUDE -} - -data class ParseResult(val dependencies: Dependencies, val vertex: DependencyGraphVertex) - -typealias Dependencies = HashMap> - -public suspend fun parseMd(mdFile: ByteArray): ParseResult { +public suspend fun parseMd(mdFile: ByteArray): DependencyGraphVertex { TODO() -} - -@Serializable -data class Point(val line: Int, val column: Int, val offset: Int) - -@Serializable -data class Position(val start: Point, val end: Point) - -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "type" -) -@JsonSubTypes( - JsonSubTypes.Type(value = MdAstRoot::class, name = "root"), - JsonSubTypes.Type(value = MdAstParagraph::class, name = "paragraph"), - JsonSubTypes.Type(value = MdAstText::class, name = "text"), - JsonSubTypes.Type(value = MdAstHeading::class, name = "heading"), - JsonSubTypes.Type(value = MdAstCode::class, name = "code"), - JsonSubTypes.Type(value = MdAstBlockquote::class, name = "blockquote") -) -@Serializable -sealed interface MdAstElement{ - abstract var position: Position -} - -@Serializable -sealed interface MdAstParent: MdAstElement{ - var children: List -} - -@Serializable -@SerialName("root") -data class MdAstRoot( - override var children: List, - override var position: Position -): MdAstParent - - -@Serializable -@SerialName("paragraph") -data class MdAstParagraph( - override var children: List, - override var position: Position -): MdAstParent - - -@Serializable -@SerialName("text") -data class MdAstText( - val value: String, - override var position: Position -): MdAstElement - - -@Serializable -@SerialName("heading") -data class MdAstHeading( - val depth: Int, - override var children: List, - override var position: Position -): MdAstParent - -@Serializable -@SerialName("code") -data class MdAstCode( - var lang: String? = null, - var meta: String? = null, - var value: String, - override var position: Position, -) : MdAstElement - -@Serializable -@SerialName("blockquote") -data class MdAstBlockquote( - override var children: List, - override var position: Position -): MdAstParent \ No newline at end of file +} \ No newline at end of file From efc3bc25372bb71a3efa30624a8b1de8493e7493 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sun, 30 Apr 2023 22:34:17 +0300 Subject: [PATCH 08/59] SNRK-70: typo is removed --- snark-document-builder/src/main/kotlin/MdParser.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snark-document-builder/src/main/kotlin/MdParser.kt b/snark-document-builder/src/main/kotlin/MdParser.kt index 69c97d0..0fd107a 100644 --- a/snark-document-builder/src/main/kotlin/MdParser.kt +++ b/snark-document-builder/src/main/kotlin/MdParser.kt @@ -1,5 +1,5 @@ package documentBuilder -public suspend fun parseMd(mdFile: ByteArray): DependencyGraphVertex { +public suspend fun parseMd(mdFile: ByteArray): DependencyGraphNode { TODO() } \ No newline at end of file From 7a57de989b5da4a2e441c3b0b554f52dccf83cd6 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sun, 30 Apr 2023 22:40:53 +0300 Subject: [PATCH 09/59] SNRK-70: better package placement --- snark-document-builder/src/main/kotlin/MdAstElements.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/MdAstElements.kt b/snark-document-builder/src/main/kotlin/MdAstElements.kt index 313ca2b..605e2e7 100644 --- a/snark-document-builder/src/main/kotlin/MdAstElements.kt +++ b/snark-document-builder/src/main/kotlin/MdAstElements.kt @@ -1,10 +1,10 @@ +package documentBuilder + import kotlinx.serialization.Serializable import kotlinx.serialization.SerialName import com.fasterxml.jackson.annotation.JsonSubTypes import com.fasterxml.jackson.annotation.JsonTypeInfo -package documentBuilder - @Serializable data class Point(val line: Int, val column: Int, val offset: Int) From b7a439f711f6411e6eadcf1d80254dd9b572d9fc Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sun, 30 Apr 2023 22:43:21 +0300 Subject: [PATCH 10/59] SNRK-70: obsollete code is removed --- .../src/main/kotlin/DocumentBuilder.kt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index cd4ddfd..551ba70 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -11,12 +11,5 @@ public suspend fun buildDocument(documentPath: String) { val documentDirectory: Directory = LocalDirectory(documentPath) val documentRoot = documentDirectory.get(DEFAULT_DOCUMENT_ROOT) - val (dependencies, vertex) = parseMd(documentRoot.readAll()) - - val documentDependencies: HashMap = HashMap() - val dependencyGraph: HashMap = - HashMap() - - documentDependencies.put(documentPath, dependencies) - dependencyGraph.put(documentPath, vertex) + TODO() } \ No newline at end of file From 3c2ffb572bdea64225d82cc42939882763c617b5 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sun, 30 Apr 2023 22:46:31 +0300 Subject: [PATCH 11/59] SNRK-70: alias is added for names of files --- snark-document-builder/src/main/kotlin/DependencyGraph.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DependencyGraph.kt b/snark-document-builder/src/main/kotlin/DependencyGraph.kt index c10e666..bb1e311 100644 --- a/snark-document-builder/src/main/kotlin/DependencyGraph.kt +++ b/snark-document-builder/src/main/kotlin/DependencyGraph.kt @@ -1,12 +1,14 @@ package documentBuilder +typealias FileName = String + sealed interface DependencyGraphEdge { } data class IncludeDependency( val parentNode: MdAstParent, val dependentNode: Iterator, - val includeList: List + val includeList: List ) : DependencyGraphEdge data class DependencyGraphNode( @@ -15,5 +17,5 @@ data class DependencyGraphNode( ) data class DependencyGraph( - val nodes: Map + val nodes: Map ) \ No newline at end of file From 417d90b842676f0e8968d8454304e42fd7184d0c Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sun, 30 Apr 2023 23:16:56 +0300 Subject: [PATCH 12/59] SNRK-70: documentation is added --- .../src/main/kotlin/DependencyGraph.kt | 37 +++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DependencyGraph.kt b/snark-document-builder/src/main/kotlin/DependencyGraph.kt index bb1e311..7058a2c 100644 --- a/snark-document-builder/src/main/kotlin/DependencyGraph.kt +++ b/snark-document-builder/src/main/kotlin/DependencyGraph.kt @@ -2,20 +2,43 @@ package documentBuilder typealias FileName = String +/** + * Node of dependency graph. + * + * One node represents one file and its dependencies + * + * @property mdAst - AST tree of current file. + * @property dependencies - list of tail end adjacent to this node (dependencies of current file to be resolved). + */ +data class DependencyGraphNode( + val mdAst: MdAstRoot, + val dependencies: List +) + +/** + * Interface of all dependency edges. + */ sealed interface DependencyGraphEdge { } - + +/** + * Include dependency edge. + * + * @property parentNode - node inside AST tree, that is parent for dependent node. + * @property dependentNode - iterator to a dependent node, i.e. node of part of document with include commands + * @property includeList - list of files to be included. + */ data class IncludeDependency( val parentNode: MdAstParent, val dependentNode: Iterator, val includeList: List ) : DependencyGraphEdge - -data class DependencyGraphNode( - val mdAst: MdAstRoot, - val dependencies: List -) - + +/** + * Whole dependency graph. + * + * @property nodes - map of nodes, where you can find DependencyGraphNode of file by its name. + */ data class DependencyGraph( val nodes: Map ) \ No newline at end of file From fd45104a7e9aa87feb1bbe3fe1b7fb321332aab9 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Mon, 1 May 2023 14:48:34 +0300 Subject: [PATCH 13/59] SNRK-70: visibility specificators are added --- .../src/main/kotlin/DependencyGraph.kt | 10 ++++---- .../src/main/kotlin/MdAstElements.kt | 24 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DependencyGraph.kt b/snark-document-builder/src/main/kotlin/DependencyGraph.kt index 7058a2c..bb00d47 100644 --- a/snark-document-builder/src/main/kotlin/DependencyGraph.kt +++ b/snark-document-builder/src/main/kotlin/DependencyGraph.kt @@ -1,6 +1,6 @@ package documentBuilder -typealias FileName = String +public typealias FileName = String /** * Node of dependency graph. @@ -10,7 +10,7 @@ typealias FileName = String * @property mdAst - AST tree of current file. * @property dependencies - list of tail end adjacent to this node (dependencies of current file to be resolved). */ -data class DependencyGraphNode( +public data class DependencyGraphNode( val mdAst: MdAstRoot, val dependencies: List ) @@ -18,7 +18,7 @@ data class DependencyGraphNode( /** * Interface of all dependency edges. */ -sealed interface DependencyGraphEdge { +public sealed interface DependencyGraphEdge { } /** @@ -28,7 +28,7 @@ sealed interface DependencyGraphEdge { * @property dependentNode - iterator to a dependent node, i.e. node of part of document with include commands * @property includeList - list of files to be included. */ -data class IncludeDependency( +public data class IncludeDependency( val parentNode: MdAstParent, val dependentNode: Iterator, val includeList: List @@ -39,6 +39,6 @@ data class IncludeDependency( * * @property nodes - map of nodes, where you can find DependencyGraphNode of file by its name. */ -data class DependencyGraph( +public data class DependencyGraph( val nodes: Map ) \ No newline at end of file diff --git a/snark-document-builder/src/main/kotlin/MdAstElements.kt b/snark-document-builder/src/main/kotlin/MdAstElements.kt index 605e2e7..035ce37 100644 --- a/snark-document-builder/src/main/kotlin/MdAstElements.kt +++ b/snark-document-builder/src/main/kotlin/MdAstElements.kt @@ -6,10 +6,10 @@ import com.fasterxml.jackson.annotation.JsonSubTypes import com.fasterxml.jackson.annotation.JsonTypeInfo @Serializable -data class Point(val line: Int, val column: Int, val offset: Int) +public data class Point(val line: Int, val column: Int, val offset: Int) @Serializable -data class Position(val start: Point, val end: Point) +public data class Position(val start: Point, val end: Point) @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, @@ -27,18 +27,18 @@ data class Position(val start: Point, val end: Point) ) @Serializable -sealed interface MdAstElement{ - abstract var position: Position +public sealed interface MdAstElement{ + public abstract var position: Position } @Serializable -sealed interface MdAstParent: MdAstElement{ - var children: List +public sealed interface MdAstParent: MdAstElement{ + public var children: List } @Serializable @SerialName("root") -data class MdAstRoot( +public data class MdAstRoot( override var children: List, override var position: Position ): MdAstParent @@ -46,7 +46,7 @@ data class MdAstRoot( @Serializable @SerialName("paragraph") -data class MdAstParagraph( +public data class MdAstParagraph( override var children: List, override var position: Position ): MdAstParent @@ -54,14 +54,14 @@ data class MdAstParagraph( @Serializable @SerialName("text") -data class MdAstText( +public data class MdAstText( val value: String, override var position: Position ): MdAstElement @Serializable @SerialName("heading") -data class MdAstHeading( +public data class MdAstHeading( val depth: Int, override var children: List, override var position: Position @@ -69,7 +69,7 @@ data class MdAstHeading( @Serializable @SerialName("code") -data class MdAstCode( +public data class MdAstCode( var lang: String? = null, var meta: String? = null, var value: String, @@ -78,7 +78,7 @@ data class MdAstCode( @Serializable @SerialName("blockquote") -data class MdAstBlockquote( +public data class MdAstBlockquote( override var children: List, override var position: Position ): MdAstParent \ No newline at end of file From 1db2afce125e597ae6543980396e11c878a61c53 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Mon, 1 May 2023 21:23:09 +0300 Subject: [PATCH 14/59] SNRK-71: buildDependencyGraph scratch is added --- .../src/main/kotlin/DocumentBuilder.kt | 20 ++++++++++++++++++- .../src/main/kotlin/MdParser.kt | 6 +++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index 551ba70..ff069d5 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -9,7 +9,25 @@ val DEFAULT_DOCUMENT_ROOT = "main.md" public suspend fun buildDocument(documentPath: String) { val documentDirectory: Directory = LocalDirectory(documentPath) - val documentRoot = documentDirectory.get(DEFAULT_DOCUMENT_ROOT) + val dependencyGraph = buildDependencyGraph(documentDirectory) + + TODO() /*resolving of dependencies*/ +} + +public suspend fun buildDependencyGraph(root: Directory) : DependencyGraph { + // val rootDcoument = root.get(DEFAULT_DOCUMENT_ROOT) + + // val filesToParse: Queue = LinkedList(listOf(root)) + // var documentName = "." + + // val nodes = HashMap() + + // while (!filesToParse.isEmpty()) + // { + // dependencyGraphNode = buildDependencyNode(filesToParse.remove()) + + // nodes.put() + // } TODO() } \ No newline at end of file diff --git a/snark-document-builder/src/main/kotlin/MdParser.kt b/snark-document-builder/src/main/kotlin/MdParser.kt index 0fd107a..0f6d90b 100644 --- a/snark-document-builder/src/main/kotlin/MdParser.kt +++ b/snark-document-builder/src/main/kotlin/MdParser.kt @@ -1,5 +1,9 @@ package documentBuilder -public suspend fun parseMd(mdFile: ByteArray): DependencyGraphNode { +public suspend fun parseMd(mdFile: ByteArray): MdAstRoot { + TODO() +} + +public suspend fun buildDependencyGraphNode(mdFile: ByteArray): DependencyGraphNode { TODO() } \ No newline at end of file From 6c9a08a14a1acc031fd42c6220c3224597bcf72e Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Thu, 4 May 2023 02:18:37 +0300 Subject: [PATCH 15/59] SNRK-70: better test naming --- snark-document-builder/src/test/kotlin/DocumentBuilder.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snark-document-builder/src/test/kotlin/DocumentBuilder.kt b/snark-document-builder/src/test/kotlin/DocumentBuilder.kt index bc019e3..6c16cc9 100644 --- a/snark-document-builder/src/test/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/test/kotlin/DocumentBuilder.kt @@ -5,7 +5,7 @@ import kotlinx.coroutines.runBlocking class SomeTest { @Test - fun testEssential() = runBlocking { + fun justWorks() = runBlocking { buildDocument("../example") } } From 5458bd367740773e0a25f24d638fb679c88ddc23 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Thu, 4 May 2023 02:30:03 +0300 Subject: [PATCH 16/59] SNRK-70: better arguments in buildDocument --- snark-document-builder/src/main/kotlin/DocumentBuilder.kt | 4 +--- snark-document-builder/src/test/kotlin/DocumentBuilder.kt | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index 551ba70..1b1ebe5 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -2,13 +2,11 @@ package documentBuilder import com.fasterxml.jackson.core.io.BigDecimalParser import space.kscience.snark.storage.* -import space.kscience.snark.storage.local.LocalDirectory import java.nio.file.Path val DEFAULT_DOCUMENT_ROOT = "main.md" -public suspend fun buildDocument(documentPath: String) { - val documentDirectory: Directory = LocalDirectory(documentPath) +public suspend fun buildDocument(documentDirectory: Directory) { val documentRoot = documentDirectory.get(DEFAULT_DOCUMENT_ROOT) TODO() diff --git a/snark-document-builder/src/test/kotlin/DocumentBuilder.kt b/snark-document-builder/src/test/kotlin/DocumentBuilder.kt index 6c16cc9..95c6002 100644 --- a/snark-document-builder/src/test/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/test/kotlin/DocumentBuilder.kt @@ -6,6 +6,6 @@ import kotlinx.coroutines.runBlocking class SomeTest { @Test fun justWorks() = runBlocking { - buildDocument("../example") + // buildDocument(Directory("../example")) } } From dee40ecdcc699f33fa64e4bc7c92b0251845f264 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Thu, 4 May 2023 02:33:58 +0300 Subject: [PATCH 17/59] SNRK-70: visibility of DEFAULT_DICUMENT_ROOT is specified --- snark-document-builder/src/main/kotlin/DocumentBuilder.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index 1b1ebe5..fe96f5e 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.io.BigDecimalParser import space.kscience.snark.storage.* import java.nio.file.Path -val DEFAULT_DOCUMENT_ROOT = "main.md" +private val DEFAULT_DOCUMENT_ROOT = "main.md" public suspend fun buildDocument(documentDirectory: Directory) { val documentRoot = documentDirectory.get(DEFAULT_DOCUMENT_ROOT) From c76ecd592fd9c3478e2f388344a18cd895afd8de Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Thu, 4 May 2023 07:55:48 +0300 Subject: [PATCH 18/59] SNARK-71: buildDependencyGraph is implemented --- .../src/main/kotlin/DocumentBuilder.kt | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index 0ad0933..1b26d45 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -7,25 +7,44 @@ import java.nio.file.Path private val DEFAULT_DOCUMENT_ROOT = "main.md" public suspend fun buildDocument(documentDirectory: Directory) { - val dependencyGraph = buildDependencyGraph(documentDirectory) TODO() /*resolving of dependencies*/ } -public suspend fun buildDependencyGraph(root: Directory) : DependencyGraph { - // val rootDcoument = root.get(DEFAULT_DOCUMENT_ROOT) +public suspend fun buildDependencyGraph(root: Directory): DependencyGraph { + val nodes = HashMap() - // val filesToParse: Queue = LinkedList(listOf(root)) - // var documentName = "." + // buildNodes(root, nodes) - // val nodes = HashMap() + val rootDcoument = root.get(DEFAULT_DOCUMENT_ROOT) - // while (!filesToParse.isEmpty()) - // { - // dependencyGraphNode = buildDependencyNode(filesToParse.remove()) + nodes.put(".", buildDependencyGraphNode(rootDcoument.readAll())) - // nodes.put() - // } + val filesToParse = getDependencies(nodes.getValue(".")) + + while (!filesToParse.isEmpty()) + { + val currentFile = filesToParse.remove() + val currentDocument = Directory(currentFile).get(DEFAULT_DOCUMENT_ROOT) + + nodes.put(currentFile, buildDependencyGraphNode(currentDocument.readAll())) + + val currentDependencies = getDependencies(nodes.getValue(currentFile)) + + for (fileName in currentDependencies) { + if (!nodes.containsKey(fileName) && !filesToParse.contains(fileName)) + filesToParse.add(fileName) + } + } + + return DependencyGraph(nodes) +} + +// private suspend fun buildNodes(folder: Directory, nodes: HashMap) { +// assert(!nodes.containsKey(folder.getPath())) +// } + +public suspend fun getDependencies(node: DependencyGraphNode): Set { TODO() } \ No newline at end of file From 54828a6535a308f7b8f60298b95831a2e9b99f52 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Thu, 4 May 2023 08:09:06 +0300 Subject: [PATCH 19/59] SNARK-71: better implementation --- .../src/main/kotlin/DocumentBuilder.kt | 40 +++++++------------ 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index 1b26d45..d421599 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -15,35 +15,25 @@ public suspend fun buildDocument(documentDirectory: Directory) { public suspend fun buildDependencyGraph(root: Directory): DependencyGraph { val nodes = HashMap() - // buildNodes(root, nodes) - - val rootDcoument = root.get(DEFAULT_DOCUMENT_ROOT) - - nodes.put(".", buildDependencyGraphNode(rootDcoument.readAll())) - - val filesToParse = getDependencies(nodes.getValue(".")) - - while (!filesToParse.isEmpty()) - { - val currentFile = filesToParse.remove() - val currentDocument = Directory(currentFile).get(DEFAULT_DOCUMENT_ROOT) - - nodes.put(currentFile, buildDependencyGraphNode(currentDocument.readAll())) - - val currentDependencies = getDependencies(nodes.getValue(currentFile)) - - for (fileName in currentDependencies) { - if (!nodes.containsKey(fileName) && !filesToParse.contains(fileName)) - filesToParse.add(fileName) - } - } + buildNodes(root, nodes) return DependencyGraph(nodes) } -// private suspend fun buildNodes(folder: Directory, nodes: HashMap) { -// assert(!nodes.containsKey(folder.getPath())) -// } +private suspend fun buildNodes(folder: Directory, nodes: HashMap) { + assert(!nodes.containsKey(folder.getPath())) + + val path = folder.getPath() + val rootDcoument = folder.get(DEFAULT_DOCUMENT_ROOT) + nodes.put(path, buildDependencyGraphNode(rootDcoument.readAll())) + + val dependencies = getDependencies(nodes.getValue(path)) + + for (dependency in dependencies) { + if (!nodes.containsKey(dependency)) + buildNodes(folder.getSubdir(dependency), nodes) + } +} public suspend fun getDependencies(node: DependencyGraphNode): Set { TODO() From a411849d6f38c84b2fa6a403bc10c39b12827609 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Thu, 4 May 2023 09:47:00 +0300 Subject: [PATCH 20/59] SNARK-71: getDependencies are implemented --- .../src/main/kotlin/DocumentBuilder.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index d421599..dffae85 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -3,6 +3,7 @@ package documentBuilder import com.fasterxml.jackson.core.io.BigDecimalParser import space.kscience.snark.storage.* import java.nio.file.Path +import java.nio.file.Paths private val DEFAULT_DOCUMENT_ROOT = "main.md" @@ -31,10 +32,19 @@ private suspend fun buildNodes(folder: Directory, nodes: HashMap { - TODO() + val dependencies = mutableListOf() + + for (dependency in node.dependencies) { + when (dependency) { + is IncludeDependency -> dependencies.addAll(dependency.includeList) + else -> TODO() + } + } + + return dependencies.toSet() } \ No newline at end of file From 06bcdbd48942bc0cad8f9d39599c75978aec09e9 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Thu, 4 May 2023 18:53:55 +0300 Subject: [PATCH 21/59] SNARK-71: better path using --- .../src/main/kotlin/DocumentBuilder.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index dffae85..a004ef6 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -22,13 +22,14 @@ public suspend fun buildDependencyGraph(root: Directory): DependencyGraph { } private suspend fun buildNodes(folder: Directory, nodes: HashMap) { - assert(!nodes.containsKey(folder.getPath())) + val pathString = folder.getPath().pathString + + assert(!nodes.containsKey(pathString)) - val path = folder.getPath() val rootDcoument = folder.get(DEFAULT_DOCUMENT_ROOT) - nodes.put(path, buildDependencyGraphNode(rootDcoument.readAll())) + nodes.put(pathString, buildDependencyGraphNode(rootDcoument.readAll())) - val dependencies = getDependencies(nodes.getValue(path)) + val dependencies = getDependencies(nodes.getValue(pathString)) for (dependency in dependencies) { if (!nodes.containsKey(dependency)) From 859c53745f37fa044ab9ce32ba2699617aa720a6 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Thu, 4 May 2023 18:54:21 +0300 Subject: [PATCH 22/59] SNARK-71: redundant else is removed --- snark-document-builder/src/main/kotlin/DocumentBuilder.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index a004ef6..f9d81ad 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -43,7 +43,6 @@ public suspend fun getDependencies(node: DependencyGraphNode): Set { for (dependency in node.dependencies) { when (dependency) { is IncludeDependency -> dependencies.addAll(dependency.includeList) - else -> TODO() } } From e90c9728c198512e76d73eac0a5f77516b023887 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Thu, 4 May 2023 18:57:25 +0300 Subject: [PATCH 23/59] SNRK-71: pathString replaced with toString() --- snark-document-builder/src/main/kotlin/DocumentBuilder.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index f9d81ad..6f92c77 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -22,7 +22,7 @@ public suspend fun buildDependencyGraph(root: Directory): DependencyGraph { } private suspend fun buildNodes(folder: Directory, nodes: HashMap) { - val pathString = folder.getPath().pathString + val pathString = folder.getPath().toString() assert(!nodes.containsKey(pathString)) From 248677dad9a4f924e0cfdf94002dffea4a65b609 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Thu, 4 May 2023 23:54:57 +0300 Subject: [PATCH 24/59] SNRK-71: nodejs scripts for markdown parsing are added --- .../src/main/nodejs/MarkdownParser.js | 14 + .../src/main/nodejs/package-lock.json | 4152 +++++++++++++++++ .../src/main/nodejs/package.json | 30 + 3 files changed, 4196 insertions(+) create mode 100644 snark-document-builder/src/main/nodejs/MarkdownParser.js create mode 100644 snark-document-builder/src/main/nodejs/package-lock.json create mode 100644 snark-document-builder/src/main/nodejs/package.json diff --git a/snark-document-builder/src/main/nodejs/MarkdownParser.js b/snark-document-builder/src/main/nodejs/MarkdownParser.js new file mode 100644 index 0000000..46436d3 --- /dev/null +++ b/snark-document-builder/src/main/nodejs/MarkdownParser.js @@ -0,0 +1,14 @@ +import {fromMarkdown} from 'mdast-util-from-markdown' + +main() + +function main() +{ + if (process.argv.length < 3) + throw "No input" + + const markdown_string = process.argv[2] + const mdast = fromMarkdown(markdown_string) + + console.log(JSON.stringify(mdast)) +} \ No newline at end of file diff --git a/snark-document-builder/src/main/nodejs/package-lock.json b/snark-document-builder/src/main/nodejs/package-lock.json new file mode 100644 index 0000000..c9a8052 --- /dev/null +++ b/snark-document-builder/src/main/nodejs/package-lock.json @@ -0,0 +1,4152 @@ +{ + + "name": "SnarkPrototype", + + "lockfileVersion": 2, + + "requires": true, + + "packages": { + + "": { + + "dependencies": { + + "fs": "^0.0.1-security", + + "hast-util-to-html": "^8.0.4", + + "mdast-util-to-hast": "^12.3.0", + + "node-fetch": "^3.3.1", + + "remark-html": "^15.0.2", + + "remark-parse": "^10.0.1", + + "require": "^2.4.20", + + "to-vfile": "^7.2.4", + + "unified": "^10.1.2", + + "whatwg-fetch": "^3.6.2" + + } + + }, + + "node_modules/@types/debug": { + + "version": "4.1.7", + + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz", + + "integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==", + + "dependencies": { + + "@types/ms": "*" + + } + + }, + + "node_modules/@types/hast": { + + "version": "2.3.4", + + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.4.tgz", + + "integrity": "sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==", + + "dependencies": { + + "@types/unist": "*" + + } + + }, + + "node_modules/@types/mdast": { + + "version": "3.0.11", + + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.11.tgz", + + "integrity": "sha512-Y/uImid8aAwrEA24/1tcRZwpxX3pIFTSilcNDKSPn+Y2iDywSEachzRuvgAYYLR3wpGXAsMbv5lvKLDZLeYPAw==", + + "dependencies": { + + "@types/unist": "*" + + } + + }, + + "node_modules/@types/ms": { + + "version": "0.7.31", + + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz", + + "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" + + }, + + "node_modules/@types/parse5": { + + "version": "6.0.3", + + "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz", + + "integrity": "sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==" + + }, + + "node_modules/@types/unist": { + + "version": "2.0.6", + + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", + + "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==" + + }, + + "node_modules/amdefine": { + + "version": "1.0.1", + + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + + "integrity": "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==", + + "engines": { + + "node": ">=0.4.2" + + } + + }, + + "node_modules/async": { + + "version": "0.2.10", + + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + + "integrity": "sha512-eAkdoKxU6/LkKDBzLpT+t6Ff5EtfSF4wx1WfJiPEEV7WNLnDaRXk0oVysiEPm262roaachGexwUv94WhSgN5TQ==" + + }, + + "node_modules/bail": { + + "version": "2.0.2", + + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/ccount": { + + "version": "2.0.1", + + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/character-entities": { + + "version": "2.0.2", + + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/character-entities-html4": { + + "version": "2.1.0", + + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/character-entities-legacy": { + + "version": "3.0.0", + + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/comma-separated-tokens": { + + "version": "2.0.3", + + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/data-uri-to-buffer": { + + "version": "4.0.1", + + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + + "engines": { + + "node": ">= 12" + + } + + }, + + "node_modules/debug": { + + "version": "4.3.4", + + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + + "dependencies": { + + "ms": "2.1.2" + + }, + + "engines": { + + "node": ">=6.0" + + }, + + "peerDependenciesMeta": { + + "supports-color": { + + "optional": true + + } + + } + + }, + + "node_modules/decode-named-character-reference": { + + "version": "1.0.2", + + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", + + "integrity": "sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==", + + "dependencies": { + + "character-entities": "^2.0.0" + + }, + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/dequal": { + + "version": "2.0.3", + + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + + "engines": { + + "node": ">=6" + + } + + }, + + "node_modules/diff": { + + "version": "5.1.0", + + "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz", + + "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==", + + "engines": { + + "node": ">=0.3.1" + + } + + }, + + "node_modules/extend": { + + "version": "3.0.2", + + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + + }, + + "node_modules/fetch-blob": { + + "version": "3.2.0", + + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + + "funding": [ + + { + + "type": "github", + + "url": "https://github.com/sponsors/jimmywarting" + + }, + + { + + "type": "paypal", + + "url": "https://paypal.me/jimmywarting" + + } + + ], + + "dependencies": { + + "node-domexception": "^1.0.0", + + "web-streams-polyfill": "^3.0.3" + + }, + + "engines": { + + "node": "^12.20 || >= 14.13" + + } + + }, + + "node_modules/formdata-polyfill": { + + "version": "4.0.10", + + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + + "dependencies": { + + "fetch-blob": "^3.1.2" + + }, + + "engines": { + + "node": ">=12.20.0" + + } + + }, + + "node_modules/fs": { + + "version": "0.0.1-security", + + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" + + }, + + "node_modules/hast-util-from-parse5": { + + "version": "7.1.2", + + "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-7.1.2.tgz", + + "integrity": "sha512-Nz7FfPBuljzsN3tCQ4kCBKqdNhQE2l0Tn+X1ubgKBPRoiDIu1mL08Cfw4k7q71+Duyaw7DXDN+VTAp4Vh3oCOw==", + + "dependencies": { + + "@types/hast": "^2.0.0", + + "@types/unist": "^2.0.0", + + "hastscript": "^7.0.0", + + "property-information": "^6.0.0", + + "vfile": "^5.0.0", + + "vfile-location": "^4.0.0", + + "web-namespaces": "^2.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/hast-util-parse-selector": { + + "version": "3.1.1", + + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz", + + "integrity": "sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==", + + "dependencies": { + + "@types/hast": "^2.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/hast-util-raw": { + + "version": "7.2.3", + + "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-7.2.3.tgz", + + "integrity": "sha512-RujVQfVsOrxzPOPSzZFiwofMArbQke6DJjnFfceiEbFh7S05CbPt0cYN+A5YeD3pso0JQk6O1aHBnx9+Pm2uqg==", + + "dependencies": { + + "@types/hast": "^2.0.0", + + "@types/parse5": "^6.0.0", + + "hast-util-from-parse5": "^7.0.0", + + "hast-util-to-parse5": "^7.0.0", + + "html-void-elements": "^2.0.0", + + "parse5": "^6.0.0", + + "unist-util-position": "^4.0.0", + + "unist-util-visit": "^4.0.0", + + "vfile": "^5.0.0", + + "web-namespaces": "^2.0.0", + + "zwitch": "^2.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/hast-util-sanitize": { + + "version": "4.1.0", + + "resolved": "https://registry.npmjs.org/hast-util-sanitize/-/hast-util-sanitize-4.1.0.tgz", + + "integrity": "sha512-Hd9tU0ltknMGRDv+d6Ro/4XKzBqQnP/EZrpiTbpFYfXv/uOhWeKc+2uajcbEvAEH98VZd7eII2PiXm13RihnLw==", + + "dependencies": { + + "@types/hast": "^2.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/hast-util-to-html": { + + "version": "8.0.4", + + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-8.0.4.tgz", + + "integrity": "sha512-4tpQTUOr9BMjtYyNlt0P50mH7xj0Ks2xpo8M943Vykljf99HW6EzulIoJP1N3eKOSScEHzyzi9dm7/cn0RfGwA==", + + "dependencies": { + + "@types/hast": "^2.0.0", + + "@types/unist": "^2.0.0", + + "ccount": "^2.0.0", + + "comma-separated-tokens": "^2.0.0", + + "hast-util-raw": "^7.0.0", + + "hast-util-whitespace": "^2.0.0", + + "html-void-elements": "^2.0.0", + + "property-information": "^6.0.0", + + "space-separated-tokens": "^2.0.0", + + "stringify-entities": "^4.0.0", + + "zwitch": "^2.0.4" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/hast-util-to-parse5": { + + "version": "7.1.0", + + "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-7.1.0.tgz", + + "integrity": "sha512-YNRgAJkH2Jky5ySkIqFXTQiaqcAtJyVE+D5lkN6CdtOqrnkLfGYYrEcKuHOJZlp+MwjSwuD3fZuawI+sic/RBw==", + + "dependencies": { + + "@types/hast": "^2.0.0", + + "comma-separated-tokens": "^2.0.0", + + "property-information": "^6.0.0", + + "space-separated-tokens": "^2.0.0", + + "web-namespaces": "^2.0.0", + + "zwitch": "^2.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/hast-util-whitespace": { + + "version": "2.0.1", + + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz", + + "integrity": "sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==", + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/hastscript": { + + "version": "7.2.0", + + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-7.2.0.tgz", + + "integrity": "sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==", + + "dependencies": { + + "@types/hast": "^2.0.0", + + "comma-separated-tokens": "^2.0.0", + + "hast-util-parse-selector": "^3.0.0", + + "property-information": "^6.0.0", + + "space-separated-tokens": "^2.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/html-void-elements": { + + "version": "2.0.1", + + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-2.0.1.tgz", + + "integrity": "sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==", + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/is-buffer": { + + "version": "2.0.5", + + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + + "funding": [ + + { + + "type": "github", + + "url": "https://github.com/sponsors/feross" + + }, + + { + + "type": "patreon", + + "url": "https://www.patreon.com/feross" + + }, + + { + + "type": "consulting", + + "url": "https://feross.org/support" + + } + + ], + + "engines": { + + "node": ">=4" + + } + + }, + + "node_modules/is-plain-obj": { + + "version": "4.1.0", + + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + + "engines": { + + "node": ">=12" + + }, + + "funding": { + + "url": "https://github.com/sponsors/sindresorhus" + + } + + }, + + "node_modules/kleur": { + + "version": "4.1.5", + + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + + "engines": { + + "node": ">=6" + + } + + }, + + "node_modules/mdast-util-definitions": { + + "version": "5.1.2", + + "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-5.1.2.tgz", + + "integrity": "sha512-8SVPMuHqlPME/z3gqVwWY4zVXn8lqKv/pAhC57FuJ40ImXyBpmO5ukh98zB2v7Blql2FiHjHv9LVztSIqjY+MA==", + + "dependencies": { + + "@types/mdast": "^3.0.0", + + "@types/unist": "^2.0.0", + + "unist-util-visit": "^4.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/mdast-util-from-markdown": { + + "version": "1.3.0", + + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-1.3.0.tgz", + + "integrity": "sha512-HN3W1gRIuN/ZW295c7zi7g9lVBllMgZE40RxCX37wrTPWXCWtpvOZdfnuK+1WNpvZje6XuJeI3Wnb4TJEUem+g==", + + "dependencies": { + + "@types/mdast": "^3.0.0", + + "@types/unist": "^2.0.0", + + "decode-named-character-reference": "^1.0.0", + + "mdast-util-to-string": "^3.1.0", + + "micromark": "^3.0.0", + + "micromark-util-decode-numeric-character-reference": "^1.0.0", + + "micromark-util-decode-string": "^1.0.0", + + "micromark-util-normalize-identifier": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0", + + "unist-util-stringify-position": "^3.0.0", + + "uvu": "^0.5.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/mdast-util-to-hast": { + + "version": "12.3.0", + + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-12.3.0.tgz", + + "integrity": "sha512-pits93r8PhnIoU4Vy9bjW39M2jJ6/tdHyja9rrot9uujkN7UTU9SDnE6WNJz/IGyQk3XHX6yNNtrBH6cQzm8Hw==", + + "dependencies": { + + "@types/hast": "^2.0.0", + + "@types/mdast": "^3.0.0", + + "mdast-util-definitions": "^5.0.0", + + "micromark-util-sanitize-uri": "^1.1.0", + + "trim-lines": "^3.0.0", + + "unist-util-generated": "^2.0.0", + + "unist-util-position": "^4.0.0", + + "unist-util-visit": "^4.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/mdast-util-to-string": { + + "version": "3.1.1", + + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.1.1.tgz", + + "integrity": "sha512-tGvhT94e+cVnQt8JWE9/b3cUQZWS732TJxXHktvP+BYo62PpYD53Ls/6cC60rW21dW+txxiM4zMdc6abASvZKA==", + + "dependencies": { + + "@types/mdast": "^3.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/micromark": { + + "version": "3.1.0", + + "resolved": "https://registry.npmjs.org/micromark/-/micromark-3.1.0.tgz", + + "integrity": "sha512-6Mj0yHLdUZjHnOPgr5xfWIMqMWS12zDN6iws9SLuSz76W8jTtAv24MN4/CL7gJrl5vtxGInkkqDv/JIoRsQOvA==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "@types/debug": "^4.0.0", + + "debug": "^4.0.0", + + "decode-named-character-reference": "^1.0.0", + + "micromark-core-commonmark": "^1.0.1", + + "micromark-factory-space": "^1.0.0", + + "micromark-util-character": "^1.0.0", + + "micromark-util-chunked": "^1.0.0", + + "micromark-util-combine-extensions": "^1.0.0", + + "micromark-util-decode-numeric-character-reference": "^1.0.0", + + "micromark-util-encode": "^1.0.0", + + "micromark-util-normalize-identifier": "^1.0.0", + + "micromark-util-resolve-all": "^1.0.0", + + "micromark-util-sanitize-uri": "^1.0.0", + + "micromark-util-subtokenize": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.1", + + "uvu": "^0.5.0" + + } + + }, + + "node_modules/micromark-core-commonmark": { + + "version": "1.0.6", + + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-1.0.6.tgz", + + "integrity": "sha512-K+PkJTxqjFfSNkfAhp4GB+cZPfQd6dxtTXnf+RjZOV7T4EEXnvgzOcnp+eSTmpGk9d1S9sL6/lqrgSNn/s0HZA==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "decode-named-character-reference": "^1.0.0", + + "micromark-factory-destination": "^1.0.0", + + "micromark-factory-label": "^1.0.0", + + "micromark-factory-space": "^1.0.0", + + "micromark-factory-title": "^1.0.0", + + "micromark-factory-whitespace": "^1.0.0", + + "micromark-util-character": "^1.0.0", + + "micromark-util-chunked": "^1.0.0", + + "micromark-util-classify-character": "^1.0.0", + + "micromark-util-html-tag-name": "^1.0.0", + + "micromark-util-normalize-identifier": "^1.0.0", + + "micromark-util-resolve-all": "^1.0.0", + + "micromark-util-subtokenize": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.1", + + "uvu": "^0.5.0" + + } + + }, + + "node_modules/micromark-factory-destination": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-1.0.0.tgz", + + "integrity": "sha512-eUBA7Rs1/xtTVun9TmV3gjfPz2wEwgK5R5xcbIM5ZYAtvGF6JkyaDsj0agx8urXnO31tEO6Ug83iVH3tdedLnw==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-util-character": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0" + + } + + }, + + "node_modules/micromark-factory-label": { + + "version": "1.0.2", + + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-1.0.2.tgz", + + "integrity": "sha512-CTIwxlOnU7dEshXDQ+dsr2n+yxpP0+fn271pu0bwDIS8uqfFcumXpj5mLn3hSC8iw2MUr6Gx8EcKng1dD7i6hg==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-util-character": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0", + + "uvu": "^0.5.0" + + } + + }, + + "node_modules/micromark-factory-space": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-1.0.0.tgz", + + "integrity": "sha512-qUmqs4kj9a5yBnk3JMLyjtWYN6Mzfcx8uJfi5XAveBniDevmZasdGBba5b4QsvRcAkmvGo5ACmSUmyGiKTLZew==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-util-character": "^1.0.0", + + "micromark-util-types": "^1.0.0" + + } + + }, + + "node_modules/micromark-factory-title": { + + "version": "1.0.2", + + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-1.0.2.tgz", + + "integrity": "sha512-zily+Nr4yFqgMGRKLpTVsNl5L4PMu485fGFDOQJQBl2NFpjGte1e86zC0da93wf97jrc4+2G2GQudFMHn3IX+A==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-factory-space": "^1.0.0", + + "micromark-util-character": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0", + + "uvu": "^0.5.0" + + } + + }, + + "node_modules/micromark-factory-whitespace": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-1.0.0.tgz", + + "integrity": "sha512-Qx7uEyahU1lt1RnsECBiuEbfr9INjQTGa6Err+gF3g0Tx4YEviPbqqGKNv/NrBaE7dVHdn1bVZKM/n5I/Bak7A==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-factory-space": "^1.0.0", + + "micromark-util-character": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0" + + } + + }, + + "node_modules/micromark-util-character": { + + "version": "1.1.0", + + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-1.1.0.tgz", + + "integrity": "sha512-agJ5B3unGNJ9rJvADMJ5ZiYjBRyDpzKAOk01Kpi1TKhlT1APx3XZk6eN7RtSz1erbWHC2L8T3xLZ81wdtGRZzg==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0" + + } + + }, + + "node_modules/micromark-util-chunked": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-1.0.0.tgz", + + "integrity": "sha512-5e8xTis5tEZKgesfbQMKRCyzvffRRUX+lK/y+DvsMFdabAicPkkZV6gO+FEWi9RfuKKoxxPwNL+dFF0SMImc1g==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-util-symbol": "^1.0.0" + + } + + }, + + "node_modules/micromark-util-classify-character": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-1.0.0.tgz", + + "integrity": "sha512-F8oW2KKrQRb3vS5ud5HIqBVkCqQi224Nm55o5wYLzY/9PwHGXC01tr3d7+TqHHz6zrKQ72Okwtvm/xQm6OVNZA==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-util-character": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0" + + } + + }, + + "node_modules/micromark-util-combine-extensions": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-1.0.0.tgz", + + "integrity": "sha512-J8H058vFBdo/6+AsjHp2NF7AJ02SZtWaVUjsayNFeAiydTxUwViQPxN0Hf8dp4FmCQi0UUFovFsEyRSUmFH3MA==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-util-chunked": "^1.0.0", + + "micromark-util-types": "^1.0.0" + + } + + }, + + "node_modules/micromark-util-decode-numeric-character-reference": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-1.0.0.tgz", + + "integrity": "sha512-OzO9AI5VUtrTD7KSdagf4MWgHMtET17Ua1fIpXTpuhclCqD8egFWo85GxSGvxgkGS74bEahvtM0WP0HjvV0e4w==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-util-symbol": "^1.0.0" + + } + + }, + + "node_modules/micromark-util-decode-string": { + + "version": "1.0.2", + + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-1.0.2.tgz", + + "integrity": "sha512-DLT5Ho02qr6QWVNYbRZ3RYOSSWWFuH3tJexd3dgN1odEuPNxCngTCXJum7+ViRAd9BbdxCvMToPOD/IvVhzG6Q==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "decode-named-character-reference": "^1.0.0", + + "micromark-util-character": "^1.0.0", + + "micromark-util-decode-numeric-character-reference": "^1.0.0", + + "micromark-util-symbol": "^1.0.0" + + } + + }, + + "node_modules/micromark-util-encode": { + + "version": "1.0.1", + + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-1.0.1.tgz", + + "integrity": "sha512-U2s5YdnAYexjKDel31SVMPbfi+eF8y1U4pfiRW/Y8EFVCy/vgxk/2wWTxzcqE71LHtCuCzlBDRU2a5CQ5j+mQA==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ] + + }, + + "node_modules/micromark-util-html-tag-name": { + + "version": "1.1.0", + + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-1.1.0.tgz", + + "integrity": "sha512-BKlClMmYROy9UiV03SwNmckkjn8QHVaWkqoAqzivabvdGcwNGMMMH/5szAnywmsTBUzDsU57/mFi0sp4BQO6dA==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ] + + }, + + "node_modules/micromark-util-normalize-identifier": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-1.0.0.tgz", + + "integrity": "sha512-yg+zrL14bBTFrQ7n35CmByWUTFsgst5JhA4gJYoty4Dqzj4Z4Fr/DHekSS5aLfH9bdlfnSvKAWsAgJhIbogyBg==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-util-symbol": "^1.0.0" + + } + + }, + + "node_modules/micromark-util-resolve-all": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-1.0.0.tgz", + + "integrity": "sha512-CB/AGk98u50k42kvgaMM94wzBqozSzDDaonKU7P7jwQIuH2RU0TeBqGYJz2WY1UdihhjweivStrJ2JdkdEmcfw==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-util-types": "^1.0.0" + + } + + }, + + "node_modules/micromark-util-sanitize-uri": { + + "version": "1.1.0", + + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.1.0.tgz", + + "integrity": "sha512-RoxtuSCX6sUNtxhbmsEFQfWzs8VN7cTctmBPvYivo98xb/kDEoTCtJQX5wyzIYEmk/lvNFTat4hL8oW0KndFpg==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-util-character": "^1.0.0", + + "micromark-util-encode": "^1.0.0", + + "micromark-util-symbol": "^1.0.0" + + } + + }, + + "node_modules/micromark-util-subtokenize": { + + "version": "1.0.2", + + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-1.0.2.tgz", + + "integrity": "sha512-d90uqCnXp/cy4G881Ub4psE57Sf8YD0pim9QdjCRNjfas2M1u6Lbt+XZK9gnHL2XFhnozZiEdCa9CNfXSfQ6xA==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ], + + "dependencies": { + + "micromark-util-chunked": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0", + + "uvu": "^0.5.0" + + } + + }, + + "node_modules/micromark-util-symbol": { + + "version": "1.0.1", + + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-1.0.1.tgz", + + "integrity": "sha512-oKDEMK2u5qqAptasDAwWDXq0tG9AssVwAx3E9bBF3t/shRIGsWIRG+cGafs2p/SnDSOecnt6hZPCE2o6lHfFmQ==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ] + + }, + + "node_modules/micromark-util-types": { + + "version": "1.0.2", + + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-1.0.2.tgz", + + "integrity": "sha512-DCfg/T8fcrhrRKTPjRrw/5LLvdGV7BHySf/1LOZx7TzWZdYRjogNtyNq885z3nNallwr3QUKARjqvHqX1/7t+w==", + + "funding": [ + + { + + "type": "GitHub Sponsors", + + "url": "https://github.com/sponsors/unifiedjs" + + }, + + { + + "type": "OpenCollective", + + "url": "https://opencollective.com/unified" + + } + + ] + + }, + + "node_modules/mri": { + + "version": "1.2.0", + + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + + "engines": { + + "node": ">=4" + + } + + }, + + "node_modules/ms": { + + "version": "2.1.2", + + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + + }, + + "node_modules/node-domexception": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + + "funding": [ + + { + + "type": "github", + + "url": "https://github.com/sponsors/jimmywarting" + + }, + + { + + "type": "github", + + "url": "https://paypal.me/jimmywarting" + + } + + ], + + "engines": { + + "node": ">=10.5.0" + + } + + }, + + "node_modules/node-fetch": { + + "version": "3.3.1", + + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.1.tgz", + + "integrity": "sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow==", + + "dependencies": { + + "data-uri-to-buffer": "^4.0.0", + + "fetch-blob": "^3.1.4", + + "formdata-polyfill": "^4.0.10" + + }, + + "engines": { + + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/node-fetch" + + } + + }, + + "node_modules/optimist": { + + "version": "0.3.7", + + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz", + + "integrity": "sha512-TCx0dXQzVtSCg2OgY/bO9hjM9cV4XYx09TVK+s3+FhkjT6LovsLe+pPMzpWf+6yXK/hUizs2gUoTw3jHM0VaTQ==", + + "dependencies": { + + "wordwrap": "~0.0.2" + + } + + }, + + "node_modules/parse5": { + + "version": "6.0.1", + + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + + }, + + "node_modules/property-information": { + + "version": "6.2.0", + + "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.2.0.tgz", + + "integrity": "sha512-kma4U7AFCTwpqq5twzC1YVIDXSqg6qQK6JN0smOw8fgRy1OkMi0CYSzFmsy6dnqSenamAtj0CyXMUJ1Mf6oROg==", + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/remark-html": { + + "version": "15.0.2", + + "resolved": "https://registry.npmjs.org/remark-html/-/remark-html-15.0.2.tgz", + + "integrity": "sha512-/CIOI7wzHJzsh48AiuIyIe1clxVkUtreul73zcCXLub0FmnevQE0UMFDQm7NUx8/3rl/4zCshlMfqBdWScQthw==", + + "dependencies": { + + "@types/mdast": "^3.0.0", + + "hast-util-sanitize": "^4.0.0", + + "hast-util-to-html": "^8.0.0", + + "mdast-util-to-hast": "^12.0.0", + + "unified": "^10.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/remark-parse": { + + "version": "10.0.1", + + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-10.0.1.tgz", + + "integrity": "sha512-1fUyHr2jLsVOkhbvPRBJ5zTKZZyD6yZzYaWCS6BPBdQ8vEMBCH+9zNCDA6tET/zHCi/jLqjCWtlJZUPk+DbnFw==", + + "dependencies": { + + "@types/mdast": "^3.0.0", + + "mdast-util-from-markdown": "^1.0.0", + + "unified": "^10.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/require": { + + "version": "2.4.20", + + "resolved": "https://registry.npmjs.org/require/-/require-2.4.20.tgz", + + "integrity": "sha512-7eop5rvh38qhQQQOoUyf68meVIcxT2yFySNywTbxoEECgkX4KDqqDRaEszfvFnuB3fuZVjDdJZ1TI/Esr16RRA==", + + "dependencies": { + + "std": "0.1.40", + + "uglify-js": "2.3.0" + + }, + + "bin": { + + "require": "bin/require-command.js" + + }, + + "engines": { + + "browsers": "*", + + "node": "*" + + } + + }, + + "node_modules/sade": { + + "version": "1.8.1", + + "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", + + "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", + + "dependencies": { + + "mri": "^1.1.0" + + }, + + "engines": { + + "node": ">=6" + + } + + }, + + "node_modules/source-map": { + + "version": "0.1.43", + + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", + + "integrity": "sha512-VtCvB9SIQhk3aF6h+N85EaqIaBFIAfZ9Cu+NJHHVvc8BbEcnvDcFw6sqQ2dQrT6SlOrZq3tIvyD9+EGq/lJryQ==", + + "dependencies": { + + "amdefine": ">=0.0.4" + + }, + + "engines": { + + "node": ">=0.8.0" + + } + + }, + + "node_modules/space-separated-tokens": { + + "version": "2.0.2", + + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/std": { + + "version": "0.1.40", + + "resolved": "https://registry.npmjs.org/std/-/std-0.1.40.tgz", + + "integrity": "sha512-wUf57hkDGCoVShrhPA8Q7lAg2Qosk+FaMlECmAsr1A4/rL2NRXFHQGBcgMUFKVkPEemJFW9gzjCQisRty14ohg==", + + "engines": { + + "node": "*" + + } + + }, + + "node_modules/stringify-entities": { + + "version": "4.0.3", + + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.3.tgz", + + "integrity": "sha512-BP9nNHMhhfcMbiuQKCqMjhDP5yBCAxsPu4pHFFzJ6Alo9dZgY4VLDPutXqIjpRiMoKdp7Av85Gr73Q5uH9k7+g==", + + "dependencies": { + + "character-entities-html4": "^2.0.0", + + "character-entities-legacy": "^3.0.0" + + }, + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/to-vfile": { + + "version": "7.2.4", + + "resolved": "https://registry.npmjs.org/to-vfile/-/to-vfile-7.2.4.tgz", + + "integrity": "sha512-2eQ+rJ2qGbyw3senPI0qjuM7aut8IYXK6AEoOWb+fJx/mQYzviTckm1wDjq91QYHAPBTYzmdJXxMFA6Mk14mdw==", + + "dependencies": { + + "is-buffer": "^2.0.0", + + "vfile": "^5.1.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/trim-lines": { + + "version": "3.0.1", + + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/trough": { + + "version": "2.1.0", + + "resolved": "https://registry.npmjs.org/trough/-/trough-2.1.0.tgz", + + "integrity": "sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==", + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/uglify-js": { + + "version": "2.3.0", + + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.3.0.tgz", + + "integrity": "sha512-AQvbxRKdaQeYADywQaao0k8Tj+7NGEVTne6xwgX1yQpv/G8b0CKdIw70HkCptwfvNGDsVe+0Bng3U9hfWbxxfg==", + + "dependencies": { + + "async": "~0.2.6", + + "optimist": "~0.3.5", + + "source-map": "~0.1.7" + + }, + + "bin": { + + "uglifyjs": "bin/uglifyjs" + + }, + + "engines": { + + "node": ">=0.4.0" + + } + + }, + + "node_modules/unified": { + + "version": "10.1.2", + + "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", + + "integrity": "sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==", + + "dependencies": { + + "@types/unist": "^2.0.0", + + "bail": "^2.0.0", + + "extend": "^3.0.0", + + "is-buffer": "^2.0.0", + + "is-plain-obj": "^4.0.0", + + "trough": "^2.0.0", + + "vfile": "^5.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/unist-util-generated": { + + "version": "2.0.1", + + "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-2.0.1.tgz", + + "integrity": "sha512-qF72kLmPxAw0oN2fwpWIqbXAVyEqUzDHMsbtPvOudIlUzXYFIeQIuxXQCRCFh22B7cixvU0MG7m3MW8FTq/S+A==", + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/unist-util-is": { + + "version": "5.2.1", + + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", + + "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", + + "dependencies": { + + "@types/unist": "^2.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/unist-util-position": { + + "version": "4.0.4", + + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.4.tgz", + + "integrity": "sha512-kUBE91efOWfIVBo8xzh/uZQ7p9ffYRtUbMRZBNFYwf0RK8koUMx6dGUfwylLOKmaT2cs4wSW96QoYUSXAyEtpg==", + + "dependencies": { + + "@types/unist": "^2.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/unist-util-stringify-position": { + + "version": "3.0.3", + + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", + + "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", + + "dependencies": { + + "@types/unist": "^2.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/unist-util-visit": { + + "version": "4.1.2", + + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz", + + "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==", + + "dependencies": { + + "@types/unist": "^2.0.0", + + "unist-util-is": "^5.0.0", + + "unist-util-visit-parents": "^5.1.1" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/unist-util-visit-parents": { + + "version": "5.1.3", + + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz", + + "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==", + + "dependencies": { + + "@types/unist": "^2.0.0", + + "unist-util-is": "^5.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/uvu": { + + "version": "0.5.6", + + "resolved": "https://registry.npmjs.org/uvu/-/uvu-0.5.6.tgz", + + "integrity": "sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==", + + "dependencies": { + + "dequal": "^2.0.0", + + "diff": "^5.0.0", + + "kleur": "^4.0.3", + + "sade": "^1.7.3" + + }, + + "bin": { + + "uvu": "bin.js" + + }, + + "engines": { + + "node": ">=8" + + } + + }, + + "node_modules/vfile": { + + "version": "5.3.7", + + "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", + + "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", + + "dependencies": { + + "@types/unist": "^2.0.0", + + "is-buffer": "^2.0.0", + + "unist-util-stringify-position": "^3.0.0", + + "vfile-message": "^3.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/vfile-location": { + + "version": "4.1.0", + + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.1.0.tgz", + + "integrity": "sha512-YF23YMyASIIJXpktBa4vIGLJ5Gs88UB/XePgqPmTa7cDA+JeO3yclbpheQYCHjVHBn/yePzrXuygIL+xbvRYHw==", + + "dependencies": { + + "@types/unist": "^2.0.0", + + "vfile": "^5.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/vfile-message": { + + "version": "3.1.4", + + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", + + "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", + + "dependencies": { + + "@types/unist": "^2.0.0", + + "unist-util-stringify-position": "^3.0.0" + + }, + + "funding": { + + "type": "opencollective", + + "url": "https://opencollective.com/unified" + + } + + }, + + "node_modules/web-namespaces": { + + "version": "2.0.1", + + "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz", + + "integrity": "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==", + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + }, + + "node_modules/web-streams-polyfill": { + + "version": "3.2.1", + + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", + + "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", + + "engines": { + + "node": ">= 8" + + } + + }, + + "node_modules/whatwg-fetch": { + + "version": "3.6.2", + + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", + + "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==" + + }, + + "node_modules/wordwrap": { + + "version": "0.0.3", + + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + + "integrity": "sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw==", + + "engines": { + + "node": ">=0.4.0" + + } + + }, + + "node_modules/zwitch": { + + "version": "2.0.4", + + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + + "funding": { + + "type": "github", + + "url": "https://github.com/sponsors/wooorm" + + } + + } + + }, + + "dependencies": { + + "@types/debug": { + + "version": "4.1.7", + + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz", + + "integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==", + + "requires": { + + "@types/ms": "*" + + } + + }, + + "@types/hast": { + + "version": "2.3.4", + + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.4.tgz", + + "integrity": "sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==", + + "requires": { + + "@types/unist": "*" + + } + + }, + + "@types/mdast": { + + "version": "3.0.11", + + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.11.tgz", + + "integrity": "sha512-Y/uImid8aAwrEA24/1tcRZwpxX3pIFTSilcNDKSPn+Y2iDywSEachzRuvgAYYLR3wpGXAsMbv5lvKLDZLeYPAw==", + + "requires": { + + "@types/unist": "*" + + } + + }, + + "@types/ms": { + + "version": "0.7.31", + + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz", + + "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" + + }, + + "@types/parse5": { + + "version": "6.0.3", + + "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz", + + "integrity": "sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==" + + }, + + "@types/unist": { + + "version": "2.0.6", + + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", + + "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==" + + }, + + "amdefine": { + + "version": "1.0.1", + + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + + "integrity": "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==" + + }, + + "async": { + + "version": "0.2.10", + + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + + "integrity": "sha512-eAkdoKxU6/LkKDBzLpT+t6Ff5EtfSF4wx1WfJiPEEV7WNLnDaRXk0oVysiEPm262roaachGexwUv94WhSgN5TQ==" + + }, + + "bail": { + + "version": "2.0.2", + + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==" + + }, + + "ccount": { + + "version": "2.0.1", + + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==" + + }, + + "character-entities": { + + "version": "2.0.2", + + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==" + + }, + + "character-entities-html4": { + + "version": "2.1.0", + + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==" + + }, + + "character-entities-legacy": { + + "version": "3.0.0", + + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==" + + }, + + "comma-separated-tokens": { + + "version": "2.0.3", + + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==" + + }, + + "data-uri-to-buffer": { + + "version": "4.0.1", + + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==" + + }, + + "debug": { + + "version": "4.3.4", + + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + + "requires": { + + "ms": "2.1.2" + + } + + }, + + "decode-named-character-reference": { + + "version": "1.0.2", + + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", + + "integrity": "sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==", + + "requires": { + + "character-entities": "^2.0.0" + + } + + }, + + "dequal": { + + "version": "2.0.3", + + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==" + + }, + + "diff": { + + "version": "5.1.0", + + "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz", + + "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==" + + }, + + "extend": { + + "version": "3.0.2", + + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + + }, + + "fetch-blob": { + + "version": "3.2.0", + + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + + "requires": { + + "node-domexception": "^1.0.0", + + "web-streams-polyfill": "^3.0.3" + + } + + }, + + "formdata-polyfill": { + + "version": "4.0.10", + + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + + "requires": { + + "fetch-blob": "^3.1.2" + + } + + }, + + "fs": { + + "version": "0.0.1-security", + + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" + + }, + + "hast-util-from-parse5": { + + "version": "7.1.2", + + "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-7.1.2.tgz", + + "integrity": "sha512-Nz7FfPBuljzsN3tCQ4kCBKqdNhQE2l0Tn+X1ubgKBPRoiDIu1mL08Cfw4k7q71+Duyaw7DXDN+VTAp4Vh3oCOw==", + + "requires": { + + "@types/hast": "^2.0.0", + + "@types/unist": "^2.0.0", + + "hastscript": "^7.0.0", + + "property-information": "^6.0.0", + + "vfile": "^5.0.0", + + "vfile-location": "^4.0.0", + + "web-namespaces": "^2.0.0" + + } + + }, + + "hast-util-parse-selector": { + + "version": "3.1.1", + + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz", + + "integrity": "sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==", + + "requires": { + + "@types/hast": "^2.0.0" + + } + + }, + + "hast-util-raw": { + + "version": "7.2.3", + + "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-7.2.3.tgz", + + "integrity": "sha512-RujVQfVsOrxzPOPSzZFiwofMArbQke6DJjnFfceiEbFh7S05CbPt0cYN+A5YeD3pso0JQk6O1aHBnx9+Pm2uqg==", + + "requires": { + + "@types/hast": "^2.0.0", + + "@types/parse5": "^6.0.0", + + "hast-util-from-parse5": "^7.0.0", + + "hast-util-to-parse5": "^7.0.0", + + "html-void-elements": "^2.0.0", + + "parse5": "^6.0.0", + + "unist-util-position": "^4.0.0", + + "unist-util-visit": "^4.0.0", + + "vfile": "^5.0.0", + + "web-namespaces": "^2.0.0", + + "zwitch": "^2.0.0" + + } + + }, + + "hast-util-sanitize": { + + "version": "4.1.0", + + "resolved": "https://registry.npmjs.org/hast-util-sanitize/-/hast-util-sanitize-4.1.0.tgz", + + "integrity": "sha512-Hd9tU0ltknMGRDv+d6Ro/4XKzBqQnP/EZrpiTbpFYfXv/uOhWeKc+2uajcbEvAEH98VZd7eII2PiXm13RihnLw==", + + "requires": { + + "@types/hast": "^2.0.0" + + } + + }, + + "hast-util-to-html": { + + "version": "8.0.4", + + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-8.0.4.tgz", + + "integrity": "sha512-4tpQTUOr9BMjtYyNlt0P50mH7xj0Ks2xpo8M943Vykljf99HW6EzulIoJP1N3eKOSScEHzyzi9dm7/cn0RfGwA==", + + "requires": { + + "@types/hast": "^2.0.0", + + "@types/unist": "^2.0.0", + + "ccount": "^2.0.0", + + "comma-separated-tokens": "^2.0.0", + + "hast-util-raw": "^7.0.0", + + "hast-util-whitespace": "^2.0.0", + + "html-void-elements": "^2.0.0", + + "property-information": "^6.0.0", + + "space-separated-tokens": "^2.0.0", + + "stringify-entities": "^4.0.0", + + "zwitch": "^2.0.4" + + } + + }, + + "hast-util-to-parse5": { + + "version": "7.1.0", + + "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-7.1.0.tgz", + + "integrity": "sha512-YNRgAJkH2Jky5ySkIqFXTQiaqcAtJyVE+D5lkN6CdtOqrnkLfGYYrEcKuHOJZlp+MwjSwuD3fZuawI+sic/RBw==", + + "requires": { + + "@types/hast": "^2.0.0", + + "comma-separated-tokens": "^2.0.0", + + "property-information": "^6.0.0", + + "space-separated-tokens": "^2.0.0", + + "web-namespaces": "^2.0.0", + + "zwitch": "^2.0.0" + + } + + }, + + "hast-util-whitespace": { + + "version": "2.0.1", + + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz", + + "integrity": "sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==" + + }, + + "hastscript": { + + "version": "7.2.0", + + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-7.2.0.tgz", + + "integrity": "sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==", + + "requires": { + + "@types/hast": "^2.0.0", + + "comma-separated-tokens": "^2.0.0", + + "hast-util-parse-selector": "^3.0.0", + + "property-information": "^6.0.0", + + "space-separated-tokens": "^2.0.0" + + } + + }, + + "html-void-elements": { + + "version": "2.0.1", + + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-2.0.1.tgz", + + "integrity": "sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==" + + }, + + "is-buffer": { + + "version": "2.0.5", + + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==" + + }, + + "is-plain-obj": { + + "version": "4.1.0", + + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==" + + }, + + "kleur": { + + "version": "4.1.5", + + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==" + + }, + + "mdast-util-definitions": { + + "version": "5.1.2", + + "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-5.1.2.tgz", + + "integrity": "sha512-8SVPMuHqlPME/z3gqVwWY4zVXn8lqKv/pAhC57FuJ40ImXyBpmO5ukh98zB2v7Blql2FiHjHv9LVztSIqjY+MA==", + + "requires": { + + "@types/mdast": "^3.0.0", + + "@types/unist": "^2.0.0", + + "unist-util-visit": "^4.0.0" + + } + + }, + + "mdast-util-from-markdown": { + + "version": "1.3.0", + + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-1.3.0.tgz", + + "integrity": "sha512-HN3W1gRIuN/ZW295c7zi7g9lVBllMgZE40RxCX37wrTPWXCWtpvOZdfnuK+1WNpvZje6XuJeI3Wnb4TJEUem+g==", + + "requires": { + + "@types/mdast": "^3.0.0", + + "@types/unist": "^2.0.0", + + "decode-named-character-reference": "^1.0.0", + + "mdast-util-to-string": "^3.1.0", + + "micromark": "^3.0.0", + + "micromark-util-decode-numeric-character-reference": "^1.0.0", + + "micromark-util-decode-string": "^1.0.0", + + "micromark-util-normalize-identifier": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0", + + "unist-util-stringify-position": "^3.0.0", + + "uvu": "^0.5.0" + + } + + }, + + "mdast-util-to-hast": { + + "version": "12.3.0", + + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-12.3.0.tgz", + + "integrity": "sha512-pits93r8PhnIoU4Vy9bjW39M2jJ6/tdHyja9rrot9uujkN7UTU9SDnE6WNJz/IGyQk3XHX6yNNtrBH6cQzm8Hw==", + + "requires": { + + "@types/hast": "^2.0.0", + + "@types/mdast": "^3.0.0", + + "mdast-util-definitions": "^5.0.0", + + "micromark-util-sanitize-uri": "^1.1.0", + + "trim-lines": "^3.0.0", + + "unist-util-generated": "^2.0.0", + + "unist-util-position": "^4.0.0", + + "unist-util-visit": "^4.0.0" + + } + + }, + + "mdast-util-to-string": { + + "version": "3.1.1", + + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.1.1.tgz", + + "integrity": "sha512-tGvhT94e+cVnQt8JWE9/b3cUQZWS732TJxXHktvP+BYo62PpYD53Ls/6cC60rW21dW+txxiM4zMdc6abASvZKA==", + + "requires": { + + "@types/mdast": "^3.0.0" + + } + + }, + + "micromark": { + + "version": "3.1.0", + + "resolved": "https://registry.npmjs.org/micromark/-/micromark-3.1.0.tgz", + + "integrity": "sha512-6Mj0yHLdUZjHnOPgr5xfWIMqMWS12zDN6iws9SLuSz76W8jTtAv24MN4/CL7gJrl5vtxGInkkqDv/JIoRsQOvA==", + + "requires": { + + "@types/debug": "^4.0.0", + + "debug": "^4.0.0", + + "decode-named-character-reference": "^1.0.0", + + "micromark-core-commonmark": "^1.0.1", + + "micromark-factory-space": "^1.0.0", + + "micromark-util-character": "^1.0.0", + + "micromark-util-chunked": "^1.0.0", + + "micromark-util-combine-extensions": "^1.0.0", + + "micromark-util-decode-numeric-character-reference": "^1.0.0", + + "micromark-util-encode": "^1.0.0", + + "micromark-util-normalize-identifier": "^1.0.0", + + "micromark-util-resolve-all": "^1.0.0", + + "micromark-util-sanitize-uri": "^1.0.0", + + "micromark-util-subtokenize": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.1", + + "uvu": "^0.5.0" + + } + + }, + + "micromark-core-commonmark": { + + "version": "1.0.6", + + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-1.0.6.tgz", + + "integrity": "sha512-K+PkJTxqjFfSNkfAhp4GB+cZPfQd6dxtTXnf+RjZOV7T4EEXnvgzOcnp+eSTmpGk9d1S9sL6/lqrgSNn/s0HZA==", + + "requires": { + + "decode-named-character-reference": "^1.0.0", + + "micromark-factory-destination": "^1.0.0", + + "micromark-factory-label": "^1.0.0", + + "micromark-factory-space": "^1.0.0", + + "micromark-factory-title": "^1.0.0", + + "micromark-factory-whitespace": "^1.0.0", + + "micromark-util-character": "^1.0.0", + + "micromark-util-chunked": "^1.0.0", + + "micromark-util-classify-character": "^1.0.0", + + "micromark-util-html-tag-name": "^1.0.0", + + "micromark-util-normalize-identifier": "^1.0.0", + + "micromark-util-resolve-all": "^1.0.0", + + "micromark-util-subtokenize": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.1", + + "uvu": "^0.5.0" + + } + + }, + + "micromark-factory-destination": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-1.0.0.tgz", + + "integrity": "sha512-eUBA7Rs1/xtTVun9TmV3gjfPz2wEwgK5R5xcbIM5ZYAtvGF6JkyaDsj0agx8urXnO31tEO6Ug83iVH3tdedLnw==", + + "requires": { + + "micromark-util-character": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0" + + } + + }, + + "micromark-factory-label": { + + "version": "1.0.2", + + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-1.0.2.tgz", + + "integrity": "sha512-CTIwxlOnU7dEshXDQ+dsr2n+yxpP0+fn271pu0bwDIS8uqfFcumXpj5mLn3hSC8iw2MUr6Gx8EcKng1dD7i6hg==", + + "requires": { + + "micromark-util-character": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0", + + "uvu": "^0.5.0" + + } + + }, + + "micromark-factory-space": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-1.0.0.tgz", + + "integrity": "sha512-qUmqs4kj9a5yBnk3JMLyjtWYN6Mzfcx8uJfi5XAveBniDevmZasdGBba5b4QsvRcAkmvGo5ACmSUmyGiKTLZew==", + + "requires": { + + "micromark-util-character": "^1.0.0", + + "micromark-util-types": "^1.0.0" + + } + + }, + + "micromark-factory-title": { + + "version": "1.0.2", + + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-1.0.2.tgz", + + "integrity": "sha512-zily+Nr4yFqgMGRKLpTVsNl5L4PMu485fGFDOQJQBl2NFpjGte1e86zC0da93wf97jrc4+2G2GQudFMHn3IX+A==", + + "requires": { + + "micromark-factory-space": "^1.0.0", + + "micromark-util-character": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0", + + "uvu": "^0.5.0" + + } + + }, + + "micromark-factory-whitespace": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-1.0.0.tgz", + + "integrity": "sha512-Qx7uEyahU1lt1RnsECBiuEbfr9INjQTGa6Err+gF3g0Tx4YEviPbqqGKNv/NrBaE7dVHdn1bVZKM/n5I/Bak7A==", + + "requires": { + + "micromark-factory-space": "^1.0.0", + + "micromark-util-character": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0" + + } + + }, + + "micromark-util-character": { + + "version": "1.1.0", + + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-1.1.0.tgz", + + "integrity": "sha512-agJ5B3unGNJ9rJvADMJ5ZiYjBRyDpzKAOk01Kpi1TKhlT1APx3XZk6eN7RtSz1erbWHC2L8T3xLZ81wdtGRZzg==", + + "requires": { + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0" + + } + + }, + + "micromark-util-chunked": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-1.0.0.tgz", + + "integrity": "sha512-5e8xTis5tEZKgesfbQMKRCyzvffRRUX+lK/y+DvsMFdabAicPkkZV6gO+FEWi9RfuKKoxxPwNL+dFF0SMImc1g==", + + "requires": { + + "micromark-util-symbol": "^1.0.0" + + } + + }, + + "micromark-util-classify-character": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-1.0.0.tgz", + + "integrity": "sha512-F8oW2KKrQRb3vS5ud5HIqBVkCqQi224Nm55o5wYLzY/9PwHGXC01tr3d7+TqHHz6zrKQ72Okwtvm/xQm6OVNZA==", + + "requires": { + + "micromark-util-character": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0" + + } + + }, + + "micromark-util-combine-extensions": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-1.0.0.tgz", + + "integrity": "sha512-J8H058vFBdo/6+AsjHp2NF7AJ02SZtWaVUjsayNFeAiydTxUwViQPxN0Hf8dp4FmCQi0UUFovFsEyRSUmFH3MA==", + + "requires": { + + "micromark-util-chunked": "^1.0.0", + + "micromark-util-types": "^1.0.0" + + } + + }, + + "micromark-util-decode-numeric-character-reference": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-1.0.0.tgz", + + "integrity": "sha512-OzO9AI5VUtrTD7KSdagf4MWgHMtET17Ua1fIpXTpuhclCqD8egFWo85GxSGvxgkGS74bEahvtM0WP0HjvV0e4w==", + + "requires": { + + "micromark-util-symbol": "^1.0.0" + + } + + }, + + "micromark-util-decode-string": { + + "version": "1.0.2", + + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-1.0.2.tgz", + + "integrity": "sha512-DLT5Ho02qr6QWVNYbRZ3RYOSSWWFuH3tJexd3dgN1odEuPNxCngTCXJum7+ViRAd9BbdxCvMToPOD/IvVhzG6Q==", + + "requires": { + + "decode-named-character-reference": "^1.0.0", + + "micromark-util-character": "^1.0.0", + + "micromark-util-decode-numeric-character-reference": "^1.0.0", + + "micromark-util-symbol": "^1.0.0" + + } + + }, + + "micromark-util-encode": { + + "version": "1.0.1", + + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-1.0.1.tgz", + + "integrity": "sha512-U2s5YdnAYexjKDel31SVMPbfi+eF8y1U4pfiRW/Y8EFVCy/vgxk/2wWTxzcqE71LHtCuCzlBDRU2a5CQ5j+mQA==" + + }, + + "micromark-util-html-tag-name": { + + "version": "1.1.0", + + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-1.1.0.tgz", + + "integrity": "sha512-BKlClMmYROy9UiV03SwNmckkjn8QHVaWkqoAqzivabvdGcwNGMMMH/5szAnywmsTBUzDsU57/mFi0sp4BQO6dA==" + + }, + + "micromark-util-normalize-identifier": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-1.0.0.tgz", + + "integrity": "sha512-yg+zrL14bBTFrQ7n35CmByWUTFsgst5JhA4gJYoty4Dqzj4Z4Fr/DHekSS5aLfH9bdlfnSvKAWsAgJhIbogyBg==", + + "requires": { + + "micromark-util-symbol": "^1.0.0" + + } + + }, + + "micromark-util-resolve-all": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-1.0.0.tgz", + + "integrity": "sha512-CB/AGk98u50k42kvgaMM94wzBqozSzDDaonKU7P7jwQIuH2RU0TeBqGYJz2WY1UdihhjweivStrJ2JdkdEmcfw==", + + "requires": { + + "micromark-util-types": "^1.0.0" + + } + + }, + + "micromark-util-sanitize-uri": { + + "version": "1.1.0", + + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.1.0.tgz", + + "integrity": "sha512-RoxtuSCX6sUNtxhbmsEFQfWzs8VN7cTctmBPvYivo98xb/kDEoTCtJQX5wyzIYEmk/lvNFTat4hL8oW0KndFpg==", + + "requires": { + + "micromark-util-character": "^1.0.0", + + "micromark-util-encode": "^1.0.0", + + "micromark-util-symbol": "^1.0.0" + + } + + }, + + "micromark-util-subtokenize": { + + "version": "1.0.2", + + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-1.0.2.tgz", + + "integrity": "sha512-d90uqCnXp/cy4G881Ub4psE57Sf8YD0pim9QdjCRNjfas2M1u6Lbt+XZK9gnHL2XFhnozZiEdCa9CNfXSfQ6xA==", + + "requires": { + + "micromark-util-chunked": "^1.0.0", + + "micromark-util-symbol": "^1.0.0", + + "micromark-util-types": "^1.0.0", + + "uvu": "^0.5.0" + + } + + }, + + "micromark-util-symbol": { + + "version": "1.0.1", + + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-1.0.1.tgz", + + "integrity": "sha512-oKDEMK2u5qqAptasDAwWDXq0tG9AssVwAx3E9bBF3t/shRIGsWIRG+cGafs2p/SnDSOecnt6hZPCE2o6lHfFmQ==" + + }, + + "micromark-util-types": { + + "version": "1.0.2", + + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-1.0.2.tgz", + + "integrity": "sha512-DCfg/T8fcrhrRKTPjRrw/5LLvdGV7BHySf/1LOZx7TzWZdYRjogNtyNq885z3nNallwr3QUKARjqvHqX1/7t+w==" + + }, + + "mri": { + + "version": "1.2.0", + + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==" + + }, + + "ms": { + + "version": "2.1.2", + + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + + }, + + "node-domexception": { + + "version": "1.0.0", + + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" + + }, + + "node-fetch": { + + "version": "3.3.1", + + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.1.tgz", + + "integrity": "sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow==", + + "requires": { + + "data-uri-to-buffer": "^4.0.0", + + "fetch-blob": "^3.1.4", + + "formdata-polyfill": "^4.0.10" + + } + + }, + + "optimist": { + + "version": "0.3.7", + + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz", + + "integrity": "sha512-TCx0dXQzVtSCg2OgY/bO9hjM9cV4XYx09TVK+s3+FhkjT6LovsLe+pPMzpWf+6yXK/hUizs2gUoTw3jHM0VaTQ==", + + "requires": { + + "wordwrap": "~0.0.2" + + } + + }, + + "parse5": { + + "version": "6.0.1", + + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + + }, + + "property-information": { + + "version": "6.2.0", + + "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.2.0.tgz", + + "integrity": "sha512-kma4U7AFCTwpqq5twzC1YVIDXSqg6qQK6JN0smOw8fgRy1OkMi0CYSzFmsy6dnqSenamAtj0CyXMUJ1Mf6oROg==" + + }, + + "remark-html": { + + "version": "15.0.2", + + "resolved": "https://registry.npmjs.org/remark-html/-/remark-html-15.0.2.tgz", + + "integrity": "sha512-/CIOI7wzHJzsh48AiuIyIe1clxVkUtreul73zcCXLub0FmnevQE0UMFDQm7NUx8/3rl/4zCshlMfqBdWScQthw==", + + "requires": { + + "@types/mdast": "^3.0.0", + + "hast-util-sanitize": "^4.0.0", + + "hast-util-to-html": "^8.0.0", + + "mdast-util-to-hast": "^12.0.0", + + "unified": "^10.0.0" + + } + + }, + + "remark-parse": { + + "version": "10.0.1", + + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-10.0.1.tgz", + + "integrity": "sha512-1fUyHr2jLsVOkhbvPRBJ5zTKZZyD6yZzYaWCS6BPBdQ8vEMBCH+9zNCDA6tET/zHCi/jLqjCWtlJZUPk+DbnFw==", + + "requires": { + + "@types/mdast": "^3.0.0", + + "mdast-util-from-markdown": "^1.0.0", + + "unified": "^10.0.0" + + } + + }, + + "require": { + + "version": "2.4.20", + + "resolved": "https://registry.npmjs.org/require/-/require-2.4.20.tgz", + + "integrity": "sha512-7eop5rvh38qhQQQOoUyf68meVIcxT2yFySNywTbxoEECgkX4KDqqDRaEszfvFnuB3fuZVjDdJZ1TI/Esr16RRA==", + + "requires": { + + "std": "0.1.40", + + "uglify-js": "2.3.0" + + } + + }, + + "sade": { + + "version": "1.8.1", + + "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", + + "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", + + "requires": { + + "mri": "^1.1.0" + + } + + }, + + "source-map": { + + "version": "0.1.43", + + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", + + "integrity": "sha512-VtCvB9SIQhk3aF6h+N85EaqIaBFIAfZ9Cu+NJHHVvc8BbEcnvDcFw6sqQ2dQrT6SlOrZq3tIvyD9+EGq/lJryQ==", + + "requires": { + + "amdefine": ">=0.0.4" + + } + + }, + + "space-separated-tokens": { + + "version": "2.0.2", + + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==" + + }, + + "std": { + + "version": "0.1.40", + + "resolved": "https://registry.npmjs.org/std/-/std-0.1.40.tgz", + + "integrity": "sha512-wUf57hkDGCoVShrhPA8Q7lAg2Qosk+FaMlECmAsr1A4/rL2NRXFHQGBcgMUFKVkPEemJFW9gzjCQisRty14ohg==" + + }, + + "stringify-entities": { + + "version": "4.0.3", + + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.3.tgz", + + "integrity": "sha512-BP9nNHMhhfcMbiuQKCqMjhDP5yBCAxsPu4pHFFzJ6Alo9dZgY4VLDPutXqIjpRiMoKdp7Av85Gr73Q5uH9k7+g==", + + "requires": { + + "character-entities-html4": "^2.0.0", + + "character-entities-legacy": "^3.0.0" + + } + + }, + + "to-vfile": { + + "version": "7.2.4", + + "resolved": "https://registry.npmjs.org/to-vfile/-/to-vfile-7.2.4.tgz", + + "integrity": "sha512-2eQ+rJ2qGbyw3senPI0qjuM7aut8IYXK6AEoOWb+fJx/mQYzviTckm1wDjq91QYHAPBTYzmdJXxMFA6Mk14mdw==", + + "requires": { + + "is-buffer": "^2.0.0", + + "vfile": "^5.1.0" + + } + + }, + + "trim-lines": { + + "version": "3.0.1", + + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==" + + }, + + "trough": { + + "version": "2.1.0", + + "resolved": "https://registry.npmjs.org/trough/-/trough-2.1.0.tgz", + + "integrity": "sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==" + + }, + + "uglify-js": { + + "version": "2.3.0", + + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.3.0.tgz", + + "integrity": "sha512-AQvbxRKdaQeYADywQaao0k8Tj+7NGEVTne6xwgX1yQpv/G8b0CKdIw70HkCptwfvNGDsVe+0Bng3U9hfWbxxfg==", + + "requires": { + + "async": "~0.2.6", + + "optimist": "~0.3.5", + + "source-map": "~0.1.7" + + } + + }, + + "unified": { + + "version": "10.1.2", + + "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", + + "integrity": "sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==", + + "requires": { + + "@types/unist": "^2.0.0", + + "bail": "^2.0.0", + + "extend": "^3.0.0", + + "is-buffer": "^2.0.0", + + "is-plain-obj": "^4.0.0", + + "trough": "^2.0.0", + + "vfile": "^5.0.0" + + } + + }, + + "unist-util-generated": { + + "version": "2.0.1", + + "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-2.0.1.tgz", + + "integrity": "sha512-qF72kLmPxAw0oN2fwpWIqbXAVyEqUzDHMsbtPvOudIlUzXYFIeQIuxXQCRCFh22B7cixvU0MG7m3MW8FTq/S+A==" + + }, + + "unist-util-is": { + + "version": "5.2.1", + + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", + + "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", + + "requires": { + + "@types/unist": "^2.0.0" + + } + + }, + + "unist-util-position": { + + "version": "4.0.4", + + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.4.tgz", + + "integrity": "sha512-kUBE91efOWfIVBo8xzh/uZQ7p9ffYRtUbMRZBNFYwf0RK8koUMx6dGUfwylLOKmaT2cs4wSW96QoYUSXAyEtpg==", + + "requires": { + + "@types/unist": "^2.0.0" + + } + + }, + + "unist-util-stringify-position": { + + "version": "3.0.3", + + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", + + "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", + + "requires": { + + "@types/unist": "^2.0.0" + + } + + }, + + "unist-util-visit": { + + "version": "4.1.2", + + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz", + + "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==", + + "requires": { + + "@types/unist": "^2.0.0", + + "unist-util-is": "^5.0.0", + + "unist-util-visit-parents": "^5.1.1" + + } + + }, + + "unist-util-visit-parents": { + + "version": "5.1.3", + + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz", + + "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==", + + "requires": { + + "@types/unist": "^2.0.0", + + "unist-util-is": "^5.0.0" + + } + + }, + + "uvu": { + + "version": "0.5.6", + + "resolved": "https://registry.npmjs.org/uvu/-/uvu-0.5.6.tgz", + + "integrity": "sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==", + + "requires": { + + "dequal": "^2.0.0", + + "diff": "^5.0.0", + + "kleur": "^4.0.3", + + "sade": "^1.7.3" + + } + + }, + + "vfile": { + + "version": "5.3.7", + + "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", + + "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", + + "requires": { + + "@types/unist": "^2.0.0", + + "is-buffer": "^2.0.0", + + "unist-util-stringify-position": "^3.0.0", + + "vfile-message": "^3.0.0" + + } + + }, + + "vfile-location": { + + "version": "4.1.0", + + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.1.0.tgz", + + "integrity": "sha512-YF23YMyASIIJXpktBa4vIGLJ5Gs88UB/XePgqPmTa7cDA+JeO3yclbpheQYCHjVHBn/yePzrXuygIL+xbvRYHw==", + + "requires": { + + "@types/unist": "^2.0.0", + + "vfile": "^5.0.0" + + } + + }, + + "vfile-message": { + + "version": "3.1.4", + + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", + + "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", + + "requires": { + + "@types/unist": "^2.0.0", + + "unist-util-stringify-position": "^3.0.0" + + } + + }, + + "web-namespaces": { + + "version": "2.0.1", + + "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz", + + "integrity": "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==" + + }, + + "web-streams-polyfill": { + + "version": "3.2.1", + + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", + + "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==" + + }, + + "whatwg-fetch": { + + "version": "3.6.2", + + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", + + "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==" + + }, + + "wordwrap": { + + "version": "0.0.3", + + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + + "integrity": "sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw==" + + }, + + "zwitch": { + + "version": "2.0.4", + + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==" + + } + + } + +} + diff --git a/snark-document-builder/src/main/nodejs/package.json b/snark-document-builder/src/main/nodejs/package.json new file mode 100644 index 0000000..4f0b1b3 --- /dev/null +++ b/snark-document-builder/src/main/nodejs/package.json @@ -0,0 +1,30 @@ +{ + + "type": "module", + + "dependencies": { + + "fs": "^0.0.1-security", + + "hast-util-to-html": "^8.0.4", + + "mdast-util-to-hast": "^12.3.0", + + "node-fetch": "^3.3.1", + + "remark-html": "^15.0.2", + + "remark-parse": "^10.0.1", + + "require": "^2.4.20", + + "to-vfile": "^7.2.4", + + "unified": "^10.1.2", + + "whatwg-fetch": "^3.6.2" + + } + +} + From e0ef373c485570fea1195f24f96cbc18f1644866 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Fri, 5 May 2023 00:07:59 +0300 Subject: [PATCH 25/59] SNRK-71: parseMd is implemented --- snark-document-builder/src/main/kotlin/MdParser.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/snark-document-builder/src/main/kotlin/MdParser.kt b/snark-document-builder/src/main/kotlin/MdParser.kt index 0f6d90b..8186b23 100644 --- a/snark-document-builder/src/main/kotlin/MdParser.kt +++ b/snark-document-builder/src/main/kotlin/MdParser.kt @@ -1,7 +1,16 @@ package documentBuilder +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue + +private val MARKDOWN_PARSER = "../nodejs/MarkdownParser.js" + public suspend fun parseMd(mdFile: ByteArray): MdAstRoot { - TODO() + return jacksonObjectMapper() + .readValue(ProcessBuilder("node", MARKDOWN_PARSER, mdFile.toString()) + .redirectOutput(ProcessBuilder.Redirect.PIPE) + .redirectError(ProcessBuilder.Redirect.INHERIT) + .start().inputStream.bufferedReader().readText()) } public suspend fun buildDependencyGraphNode(mdFile: ByteArray): DependencyGraphNode { From c112a74652a304c991cdb8a99fd37fb2ed390d0e Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Fri, 5 May 2023 00:21:20 +0300 Subject: [PATCH 26/59] SNRK-71: update after adding of path property --- snark-document-builder/src/main/kotlin/DocumentBuilder.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index 6f92c77..c2d76c8 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -22,7 +22,7 @@ public suspend fun buildDependencyGraph(root: Directory): DependencyGraph { } private suspend fun buildNodes(folder: Directory, nodes: HashMap) { - val pathString = folder.getPath().toString() + val pathString = folder.path.toString() assert(!nodes.containsKey(pathString)) From ff84d2e87b1f8e515144c61aeb1544d17f430900 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Fri, 5 May 2023 21:21:46 +0300 Subject: [PATCH 27/59] SNRK-71: buildDependencyNode is implemented --- .../src/main/kotlin/MdParser.kt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/snark-document-builder/src/main/kotlin/MdParser.kt b/snark-document-builder/src/main/kotlin/MdParser.kt index 8186b23..20243b0 100644 --- a/snark-document-builder/src/main/kotlin/MdParser.kt +++ b/snark-document-builder/src/main/kotlin/MdParser.kt @@ -14,5 +14,29 @@ public suspend fun parseMd(mdFile: ByteArray): MdAstRoot { } public suspend fun buildDependencyGraphNode(mdFile: ByteArray): DependencyGraphNode { + val treeRoot = parseMd(mdFile) + val dependencies = mutableListOf() + + fillDependencies(treeRoot, dependencies) + + return DependencyGraphNode(treeRoot, dependencies) +} + +private suspend fun fillDependencies( + currentNode: MdAstElement, + dependencies: MutableList) { + // when (currentNode) { + // is MdAstParent -> { + // val iterator = currentNode.children.listIterator() + + // while (iterator.hasNext()) { + + + // iterator.next() + // } + + // } + // else -> {} + // } TODO() } \ No newline at end of file From fdcf9c9c5b9610feea2693b43d97ab53372d7edb Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Fri, 5 May 2023 21:25:43 +0300 Subject: [PATCH 28/59] SNRK-70: IncludeDependency is changed --- snark-document-builder/src/main/kotlin/DependencyGraph.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DependencyGraph.kt b/snark-document-builder/src/main/kotlin/DependencyGraph.kt index bb00d47..dc0a8bc 100644 --- a/snark-document-builder/src/main/kotlin/DependencyGraph.kt +++ b/snark-document-builder/src/main/kotlin/DependencyGraph.kt @@ -25,12 +25,12 @@ public sealed interface DependencyGraphEdge { * Include dependency edge. * * @property parentNode - node inside AST tree, that is parent for dependent node. - * @property dependentNode - iterator to a dependent node, i.e. node of part of document with include commands + * @property dependentNode - dependent node, i.e. node of part of document with include commands * @property includeList - list of files to be included. */ public data class IncludeDependency( val parentNode: MdAstParent, - val dependentNode: Iterator, + val dependentNode: MdAstElement, val includeList: List ) : DependencyGraphEdge From 225b7346a8c5076ee49e0deefebd0546af5a9d65 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Fri, 5 May 2023 23:39:51 +0300 Subject: [PATCH 29/59] fillDependencies is implemented --- .../src/main/kotlin/DocumentBuilder.kt | 8 ++-- .../src/main/kotlin/MdParser.kt | 38 ++++++++++++------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index c2d76c8..6650197 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -13,7 +13,7 @@ public suspend fun buildDocument(documentDirectory: Directory) { TODO() /*resolving of dependencies*/ } -public suspend fun buildDependencyGraph(root: Directory): DependencyGraph { +public suspend fun buildDependencyGraph(root: Directory): DependencyGraph { val nodes = HashMap() buildNodes(root, nodes) @@ -23,11 +23,11 @@ public suspend fun buildDependencyGraph(root: Directory): DependencyGraph { private suspend fun buildNodes(folder: Directory, nodes: HashMap) { val pathString = folder.path.toString() - + assert(!nodes.containsKey(pathString)) val rootDcoument = folder.get(DEFAULT_DOCUMENT_ROOT) - nodes.put(pathString, buildDependencyGraphNode(rootDcoument.readAll())) + nodes.put(pathString, buildDependencyGraphNode(rootDcoument.readAll(), folder.path)) val dependencies = getDependencies(nodes.getValue(pathString)) @@ -39,7 +39,7 @@ private suspend fun buildNodes(folder: Directory, nodes: HashMap { val dependencies = mutableListOf() - + for (dependency in node.dependencies) { when (dependency) { is IncludeDependency -> dependencies.addAll(dependency.includeList) diff --git a/snark-document-builder/src/main/kotlin/MdParser.kt b/snark-document-builder/src/main/kotlin/MdParser.kt index 20243b0..bf4bc83 100644 --- a/snark-document-builder/src/main/kotlin/MdParser.kt +++ b/snark-document-builder/src/main/kotlin/MdParser.kt @@ -2,6 +2,7 @@ package documentBuilder import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.readValue +import java.nio.file.Path private val MARKDOWN_PARSER = "../nodejs/MarkdownParser.js" @@ -13,30 +14,39 @@ public suspend fun parseMd(mdFile: ByteArray): MdAstRoot { .start().inputStream.bufferedReader().readText()) } -public suspend fun buildDependencyGraphNode(mdFile: ByteArray): DependencyGraphNode { +public suspend fun buildDependencyGraphNode(mdFile: ByteArray, path: Path): DependencyGraphNode { val treeRoot = parseMd(mdFile) val dependencies = mutableListOf() - fillDependencies(treeRoot, dependencies) + fillDependencies(treeRoot, dependencies, path) return DependencyGraphNode(treeRoot, dependencies) } -private suspend fun fillDependencies( +internal suspend fun fillDependencies( currentNode: MdAstElement, - dependencies: MutableList) { - // when (currentNode) { - // is MdAstParent -> { - // val iterator = currentNode.children.listIterator() + dependencies: MutableList, + path: Path) { + when (currentNode) { + is MdAstParent -> { + for (child in currentNode.children) { + if (child is MdAstText) { + val includeList = getIncludeFiles(child.value).toMutableList() - // while (iterator.hasNext()) { + if (includeList.size > 0) { + includeList.replaceAll { path.toString() + "/" + it } + dependencies += IncludeDependency(currentNode, child, includeList) + } + } else { + fillDependencies(child, dependencies, path) + } + } + } + else -> {} + } +} - // iterator.next() - // } - - // } - // else -> {} - // } +public suspend fun getIncludeFiles(string: String): List { TODO() } \ No newline at end of file From 4019cbfe6bdca62d179f29f695fb15a35c5d7876 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sat, 6 May 2023 00:17:33 +0300 Subject: [PATCH 30/59] SnarkParser.py is added --- .../src/main/python/SnarkParser.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 snark-document-builder/src/main/python/SnarkParser.py diff --git a/snark-document-builder/src/main/python/SnarkParser.py b/snark-document-builder/src/main/python/SnarkParser.py new file mode 100644 index 0000000..fb71d7f --- /dev/null +++ b/snark-document-builder/src/main/python/SnarkParser.py @@ -0,0 +1,26 @@ +import sys +import re +import json + +assert(len(sys.argv) >= 2) + +string = sys.argv[1] + +outputfile = sys.argv[2] if len(sys.argv) >= 3 else None + +pattern = r'^([\n|\t| ]*@include\([a-z|0-9|.|_]*.md\)[\n|\t| ]*)*$' + +files = [] + +if re.search("@include", string, re.IGNORECASE): + if re.match(pattern, string): + matches = re.findall(r'@include\((.*?)\)', string) + files.extend(matches) + else: + sys.exit("Illformed string") + +if outputfile is None: + print(json.dumps(files)) +else: + with open(outputfile, 'w+') as f: + json.dump(files, f) \ No newline at end of file From 778e58fc63260cdde415aa5552a57440437a50db Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sat, 6 May 2023 01:33:26 +0300 Subject: [PATCH 31/59] SNRK-71: getIncludeFiles is implemented --- snark-document-builder/src/main/kotlin/MdParser.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/snark-document-builder/src/main/kotlin/MdParser.kt b/snark-document-builder/src/main/kotlin/MdParser.kt index bf4bc83..d1ffe45 100644 --- a/snark-document-builder/src/main/kotlin/MdParser.kt +++ b/snark-document-builder/src/main/kotlin/MdParser.kt @@ -5,6 +5,7 @@ import com.fasterxml.jackson.module.kotlin.readValue import java.nio.file.Path private val MARKDOWN_PARSER = "../nodejs/MarkdownParser.js" +private val SNARK_PARSER = "../python/SnarkParse.py" public suspend fun parseMd(mdFile: ByteArray): MdAstRoot { return jacksonObjectMapper() @@ -48,5 +49,9 @@ internal suspend fun fillDependencies( } public suspend fun getIncludeFiles(string: String): List { - TODO() + return jacksonObjectMapper() + .readValue>(ProcessBuilder("python3", SNARK_PARSER, string) + .redirectOutput(ProcessBuilder.Redirect.PIPE) + .redirectError(ProcessBuilder.Redirect.INHERIT) + .start().inputStream.bufferedReader().readText()) } \ No newline at end of file From 234dd279f05cad129d981e0602c04ac4fc197e73 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sat, 6 May 2023 17:58:51 +0300 Subject: [PATCH 32/59] SNARK-71: better folder naming --- snark-document-builder/src/test/{example => resources}/main.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename snark-document-builder/src/test/{example => resources}/main.md (100%) diff --git a/snark-document-builder/src/test/example/main.md b/snark-document-builder/src/test/resources/main.md similarity index 100% rename from snark-document-builder/src/test/example/main.md rename to snark-document-builder/src/test/resources/main.md From 19a023190f5f0400c7b12ed728008a85f9f2cb9a Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sat, 6 May 2023 18:00:12 +0300 Subject: [PATCH 33/59] SNRK-71: better test document --- snark-document-builder/src/test/resources/main.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/snark-document-builder/src/test/resources/main.md b/snark-document-builder/src/test/resources/main.md index e69de29..b068642 100644 --- a/snark-document-builder/src/test/resources/main.md +++ b/snark-document-builder/src/test/resources/main.md @@ -0,0 +1,3 @@ +# Hello + +I'm almost empty test document without any dependencies \ No newline at end of file From 33b4c56e4f4faa1151c90359d7e78a21a5268f64 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sat, 6 May 2023 18:05:36 +0300 Subject: [PATCH 34/59] SNRK-71: subfolder for example is added --- .../src/test/resources/{ => no_dependencies_example}/main.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename snark-document-builder/src/test/resources/{ => no_dependencies_example}/main.md (100%) diff --git a/snark-document-builder/src/test/resources/main.md b/snark-document-builder/src/test/resources/no_dependencies_example/main.md similarity index 100% rename from snark-document-builder/src/test/resources/main.md rename to snark-document-builder/src/test/resources/no_dependencies_example/main.md From 667688d46d7ac62400ef3499528a29db5d1fe8eb Mon Sep 17 00:00:00 2001 From: Kirill Grachev Date: Sat, 6 May 2023 18:57:55 +0300 Subject: [PATCH 35/59] SNRK-86: Assembly parts --- settings.gradle.kts | 1 + snark-document-builder/build.gradle.kts | 2 ++ .../src/main/kotlin/DocumentBuilder.kt | 4 +++- .../src/test/kotlin/DocumentBuilder.kt | 1 + snark-ktor/build.gradle.kts | 2 +- .../space/kscience/snark/ktor/WebInterface.kt | 10 +++++---- snark-main/build.gradle.kts | 21 +++++++++++++++++++ .../kotlin/space/kscience/snark/main/Main.kt | 17 +++++++++++++++ .../kscience/snark/main/ServerDataHolder.kt | 15 +++++++++++++ .../space/kscience/snark/main/Acceptance.kt | 15 +++++++++++++ 10 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 snark-main/build.gradle.kts create mode 100644 snark-main/src/main/kotlin/space/kscience/snark/main/Main.kt create mode 100644 snark-main/src/main/kotlin/space/kscience/snark/main/ServerDataHolder.kt create mode 100644 snark-main/src/test/kotlin/space/kscience/snark/main/Acceptance.kt diff --git a/settings.gradle.kts b/settings.gradle.kts index e502783..2736d1f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -44,4 +44,5 @@ include( ":snark-ktor", ":snark-storage-driver", ":snark-document-builder", + ":snark-main", ) \ No newline at end of file diff --git a/snark-document-builder/build.gradle.kts b/snark-document-builder/build.gradle.kts index d7d9d05..fae0acf 100644 --- a/snark-document-builder/build.gradle.kts +++ b/snark-document-builder/build.gradle.kts @@ -6,10 +6,12 @@ plugins { val coroutinesVersion = space.kscience.gradle.KScienceVersions.coroutinesVersion val jacksonVersion = "2.14.2" +val ktorVersion = space.kscience.gradle.KScienceVersions.ktorVersion dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") + api("io.ktor:ktor-server-html-builder:$ktorVersion") implementation(project(":snark-storage-driver")) implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion") diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index 6650197..17f5582 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -4,10 +4,12 @@ import com.fasterxml.jackson.core.io.BigDecimalParser import space.kscience.snark.storage.* import java.nio.file.Path import java.nio.file.Paths +import kotlinx.html.* +import kotlinx.html.dom.createHTMLDocument private val DEFAULT_DOCUMENT_ROOT = "main.md" -public suspend fun buildDocument(documentDirectory: Directory) { +public suspend fun buildDocument(documentDirectory: Directory): HTML { val dependencyGraph = buildDependencyGraph(documentDirectory) TODO() /*resolving of dependencies*/ diff --git a/snark-document-builder/src/test/kotlin/DocumentBuilder.kt b/snark-document-builder/src/test/kotlin/DocumentBuilder.kt index 95c6002..a21550d 100644 --- a/snark-document-builder/src/test/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/test/kotlin/DocumentBuilder.kt @@ -2,6 +2,7 @@ package documentBuilder import org.junit.jupiter.api.Test import kotlinx.coroutines.runBlocking +import space.kscience.snark.storage.local.localStorage class SomeTest { @Test diff --git a/snark-ktor/build.gradle.kts b/snark-ktor/build.gradle.kts index 1a40f79..2078cae 100644 --- a/snark-ktor/build.gradle.kts +++ b/snark-ktor/build.gradle.kts @@ -13,7 +13,7 @@ dependencies { api("io.ktor:ktor-server-html-builder:$ktorVersion") api("io.ktor:ktor-server-host-common:$ktorVersion") implementation("io.ktor:ktor-server-netty:2.3.0") - implementation(project(mapOf("path" to ":snark-storage-driver"))) + implementation(project(":snark-storage-driver")) testApi("io.ktor:ktor-server-tests:$ktorVersion") } \ No newline at end of file diff --git a/snark-ktor/src/main/kotlin/space/kscience/snark/ktor/WebInterface.kt b/snark-ktor/src/main/kotlin/space/kscience/snark/ktor/WebInterface.kt index 368bad6..6f3ce73 100644 --- a/snark-ktor/src/main/kotlin/space/kscience/snark/ktor/WebInterface.kt +++ b/snark-ktor/src/main/kotlin/space/kscience/snark/ktor/WebInterface.kt @@ -11,7 +11,10 @@ import io.ktor.server.response.* import io.ktor.server.http.content.* import kotlinx.html.* import io.ktor.server.routing.* +import kotlinx.css.h1 import kotlinx.css.html +import kotlinx.html.dom.create +import kotlinx.html.dom.document import java.nio.file.Path import space.kscience.snark.storage.Directory import space.kscience.snark.storage.local.localStorage @@ -22,9 +25,8 @@ import kotlin.io.path.name import space.kscience.snark.storage.unzip.unzip public interface DataHolder { - - fun init() : Directory - fun represent(): String + public fun init() : Directory + public suspend fun represent(): String //will be HTML later } class LocalDataHolder: DataHolder { @@ -44,7 +46,7 @@ class LocalDataHolder: DataHolder { } } } - override fun represent() : String = + override suspend fun represent(): String = if (source == null) { "No data was loaded!" } else { diff --git a/snark-main/build.gradle.kts b/snark-main/build.gradle.kts new file mode 100644 index 0000000..819f8f0 --- /dev/null +++ b/snark-main/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + id("space.kscience.gradle.jvm") + `maven-publish` +} + +val coroutinesVersion = space.kscience.gradle.KScienceVersions.coroutinesVersion + + +dependencies { + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") + implementation(project(":snark-ktor")) + implementation(project(":snark-storage-driver")) + implementation(project(":snark-document-builder")) + + testImplementation(kotlin("test")) + testImplementation("org.junit.jupiter:junit-jupiter:5.8.1") +} + +tasks.test { + useJUnitPlatform() +} diff --git a/snark-main/src/main/kotlin/space/kscience/snark/main/Main.kt b/snark-main/src/main/kotlin/space/kscience/snark/main/Main.kt new file mode 100644 index 0000000..7b6e975 --- /dev/null +++ b/snark-main/src/main/kotlin/space/kscience/snark/main/Main.kt @@ -0,0 +1,17 @@ +package space.kscience.snark.main + +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking +import space.kscience.snark.ktor.SNARKServer +import space.kscience.snark.storage.local.localStorage +import kotlin.io.path.Path + +fun main() = runBlocking { + val port = 8080 + val directory = localStorage(Path("./rundata")) + val server = SNARKServer(ServerDataHolder(directory), port) + launch { + server.run() + } +} \ No newline at end of file diff --git a/snark-main/src/main/kotlin/space/kscience/snark/main/ServerDataHolder.kt b/snark-main/src/main/kotlin/space/kscience/snark/main/ServerDataHolder.kt new file mode 100644 index 0000000..ce1a9e1 --- /dev/null +++ b/snark-main/src/main/kotlin/space/kscience/snark/main/ServerDataHolder.kt @@ -0,0 +1,15 @@ +package space.kscience.snark.main + +import space.kscience.snark.ktor.DataHolder +import space.kscience.snark.storage.Directory +import documentBuilder.* +import kotlinx.html.HTML + +internal class ServerDataHolder(private val directory: Directory): DataHolder { + override fun init(): Directory = + directory + + override suspend fun represent(): String { + return buildDocument(directory).toString() + } +} \ No newline at end of file diff --git a/snark-main/src/test/kotlin/space/kscience/snark/main/Acceptance.kt b/snark-main/src/test/kotlin/space/kscience/snark/main/Acceptance.kt new file mode 100644 index 0000000..cf3e86b --- /dev/null +++ b/snark-main/src/test/kotlin/space/kscience/snark/main/Acceptance.kt @@ -0,0 +1,15 @@ +package space.kscience.snark.main + +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking +import org.junit.jupiter.api.Test +import space.kscience.snark.ktor.SNARKServer +import space.kscience.snark.storage.local.localStorage +import kotlin.io.path.Path + +class Acceptance { + @Test + fun justWorks() = runBlocking { + main() + } +} \ No newline at end of file From a99e71d1b12e91145abb4ef262019351a256491f Mon Sep 17 00:00:00 2001 From: Kirill Grachev Date: Sat, 6 May 2023 19:14:44 +0300 Subject: [PATCH 36/59] SNRK-86: Works --- .../main/kotlin/space/kscience/snark/main/Main.kt | 2 +- .../space/kscience/snark/main/Acceptance.kt | 15 --------------- .../test/kotlin/space/kscience/snark/main/Test.kt | 13 +++++++++++++ 3 files changed, 14 insertions(+), 16 deletions(-) delete mode 100644 snark-main/src/test/kotlin/space/kscience/snark/main/Acceptance.kt create mode 100644 snark-main/src/test/kotlin/space/kscience/snark/main/Test.kt diff --git a/snark-main/src/main/kotlin/space/kscience/snark/main/Main.kt b/snark-main/src/main/kotlin/space/kscience/snark/main/Main.kt index 7b6e975..150ee58 100644 --- a/snark-main/src/main/kotlin/space/kscience/snark/main/Main.kt +++ b/snark-main/src/main/kotlin/space/kscience/snark/main/Main.kt @@ -7,7 +7,7 @@ import space.kscience.snark.ktor.SNARKServer import space.kscience.snark.storage.local.localStorage import kotlin.io.path.Path -fun main() = runBlocking { +fun main(): Unit = runBlocking { val port = 8080 val directory = localStorage(Path("./rundata")) val server = SNARKServer(ServerDataHolder(directory), port) diff --git a/snark-main/src/test/kotlin/space/kscience/snark/main/Acceptance.kt b/snark-main/src/test/kotlin/space/kscience/snark/main/Acceptance.kt deleted file mode 100644 index cf3e86b..0000000 --- a/snark-main/src/test/kotlin/space/kscience/snark/main/Acceptance.kt +++ /dev/null @@ -1,15 +0,0 @@ -package space.kscience.snark.main - -import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking -import org.junit.jupiter.api.Test -import space.kscience.snark.ktor.SNARKServer -import space.kscience.snark.storage.local.localStorage -import kotlin.io.path.Path - -class Acceptance { - @Test - fun justWorks() = runBlocking { - main() - } -} \ No newline at end of file diff --git a/snark-main/src/test/kotlin/space/kscience/snark/main/Test.kt b/snark-main/src/test/kotlin/space/kscience/snark/main/Test.kt new file mode 100644 index 0000000..86d0824 --- /dev/null +++ b/snark-main/src/test/kotlin/space/kscience/snark/main/Test.kt @@ -0,0 +1,13 @@ +package space.kscience.snark.main + +import kotlinx.coroutines.delay +import kotlinx.coroutines.runBlocking +import org.junit.jupiter.api.Test + +class Test { + @Test + fun justWorks() = runBlocking { + delay(5) + main() + } +} \ No newline at end of file From 14c1e650b994fac98e871160f6575beafeed5cc5 Mon Sep 17 00:00:00 2001 From: Kirill Grachev Date: Sat, 6 May 2023 19:25:38 +0300 Subject: [PATCH 37/59] SNRK-86: Runs without fails --- snark-document-builder/src/main/kotlin/DocumentBuilder.kt | 6 ++++-- snark-document-builder/src/main/kotlin/MdParser.kt | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index 17f5582..5f1ff31 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -9,10 +9,12 @@ import kotlinx.html.dom.createHTMLDocument private val DEFAULT_DOCUMENT_ROOT = "main.md" -public suspend fun buildDocument(documentDirectory: Directory): HTML { +public suspend fun buildDocument(documentDirectory: Directory): String { val dependencyGraph = buildDependencyGraph(documentDirectory) - TODO() /*resolving of dependencies*/ +// TODO() /*resolving of dependencies*/ + + return "Not implemented" } public suspend fun buildDependencyGraph(root: Directory): DependencyGraph { diff --git a/snark-document-builder/src/main/kotlin/MdParser.kt b/snark-document-builder/src/main/kotlin/MdParser.kt index d1ffe45..d502d41 100644 --- a/snark-document-builder/src/main/kotlin/MdParser.kt +++ b/snark-document-builder/src/main/kotlin/MdParser.kt @@ -4,8 +4,8 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.readValue import java.nio.file.Path -private val MARKDOWN_PARSER = "../nodejs/MarkdownParser.js" -private val SNARK_PARSER = "../python/SnarkParse.py" +private val MARKDOWN_PARSER = "snark-document-builder/src/main/nodejs/MarkdownParser.js" +private val SNARK_PARSER = "snark-document-builder/src/main/python/SnarkParser.py" public suspend fun parseMd(mdFile: ByteArray): MdAstRoot { return jacksonObjectMapper() From a13c4a8e8c3db6eec9690e4dcd28f32a6ac01480 Mon Sep 17 00:00:00 2001 From: Kirill Grachev Date: Sat, 6 May 2023 19:46:38 +0300 Subject: [PATCH 38/59] SNRK-82: Add code from another repository --- snark-document-builder/src/main/kotlin/Build.kt | 17 +++++++++++++++++ .../src/main/kotlin/DependencyGraph.kt | 14 +++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 snark-document-builder/src/main/kotlin/Build.kt diff --git a/snark-document-builder/src/main/kotlin/Build.kt b/snark-document-builder/src/main/kotlin/Build.kt new file mode 100644 index 0000000..c15b225 --- /dev/null +++ b/snark-document-builder/src/main/kotlin/Build.kt @@ -0,0 +1,17 @@ +package documentBuilder + +internal class GraphManager(private val graph: DependencyGraph) { + fun buildDocument(file: FileName) { + val list = graph.nodes[file] + if (list != null) { + for (element in list.dependencies) { + element.visit(this) + } + } + } + + fun getAstRootDocument(file: FileName): MdAstRoot { + buildDocument(file) + return graph.nodes[file]!!.mdAst + } +} diff --git a/snark-document-builder/src/main/kotlin/DependencyGraph.kt b/snark-document-builder/src/main/kotlin/DependencyGraph.kt index dc0a8bc..864838a 100644 --- a/snark-document-builder/src/main/kotlin/DependencyGraph.kt +++ b/snark-document-builder/src/main/kotlin/DependencyGraph.kt @@ -1,5 +1,7 @@ package documentBuilder +import kotlinx.coroutines.coroutineScope + public typealias FileName = String /** @@ -19,6 +21,7 @@ public data class DependencyGraphNode( * Interface of all dependency edges. */ public sealed interface DependencyGraphEdge { + public fun visit(graphManager: GraphManager) } /** @@ -32,7 +35,16 @@ public data class IncludeDependency( val parentNode: MdAstParent, val dependentNode: MdAstElement, val includeList: List -) : DependencyGraphEdge +) : DependencyGraphEdge { + override fun visit(graphManager: GraphManager) { + val parent = parentNode + for (file in includeList) { + graphManager.buildDocument(file) + parent.children.add(graphManager.graph.nodes[file].mdAst) + } + dependentNode = parent + } +} /** * Whole dependency graph. From 1dfb5d8772fef30ad7649e1178a6ce1ccd1c15a6 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sat, 6 May 2023 19:43:51 +0300 Subject: [PATCH 39/59] SNRK-85: script to install dependencies is added --- snark-document-builder/ci/requirments.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 snark-document-builder/ci/requirments.sh diff --git a/snark-document-builder/ci/requirments.sh b/snark-document-builder/ci/requirments.sh new file mode 100755 index 0000000..e5e1a9d --- /dev/null +++ b/snark-document-builder/ci/requirments.sh @@ -0,0 +1,6 @@ +sudo apt-get install -y python3 +sudo apt-get install -y nodejs +sudo apt-get install -y npm + +cd ../src/main/nodejs +sudo npm install . \ No newline at end of file From 3358f8c856f393079d8f26a1bdf561da54aceaef Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sat, 6 May 2023 19:45:09 +0300 Subject: [PATCH 40/59] SNRK-85: better --- snark-document-builder/src/main/nodejs/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snark-document-builder/src/main/nodejs/package-lock.json b/snark-document-builder/src/main/nodejs/package-lock.json index c9a8052..ad597d6 100644 --- a/snark-document-builder/src/main/nodejs/package-lock.json +++ b/snark-document-builder/src/main/nodejs/package-lock.json @@ -1,6 +1,6 @@ { - "name": "SnarkPrototype", + "name": "nodejs", "lockfileVersion": 2, From 8ed0cc04994049f1d9bba17bc1c9778efad79e36 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sat, 6 May 2023 19:46:50 +0300 Subject: [PATCH 41/59] SNRK-85: .gitignore to ignore node_modules folder is added --- snark-document-builder/src/main/nodejs/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 snark-document-builder/src/main/nodejs/.gitignore diff --git a/snark-document-builder/src/main/nodejs/.gitignore b/snark-document-builder/src/main/nodejs/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/snark-document-builder/src/main/nodejs/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file From 9a41f67e2997c943fdabcda190eff9f5867f5948 Mon Sep 17 00:00:00 2001 From: Kirill Grachev Date: Sat, 6 May 2023 19:50:24 +0300 Subject: [PATCH 42/59] Add comments --- snark-document-builder/src/main/kotlin/Build.kt | 2 +- snark-main/src/main/kotlin/space/kscience/snark/main/Main.kt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/snark-document-builder/src/main/kotlin/Build.kt b/snark-document-builder/src/main/kotlin/Build.kt index c15b225..aff99f6 100644 --- a/snark-document-builder/src/main/kotlin/Build.kt +++ b/snark-document-builder/src/main/kotlin/Build.kt @@ -1,6 +1,6 @@ package documentBuilder -internal class GraphManager(private val graph: DependencyGraph) { +public class GraphManager(private val graph: DependencyGraph) { fun buildDocument(file: FileName) { val list = graph.nodes[file] if (list != null) { diff --git a/snark-main/src/main/kotlin/space/kscience/snark/main/Main.kt b/snark-main/src/main/kotlin/space/kscience/snark/main/Main.kt index 150ee58..b758434 100644 --- a/snark-main/src/main/kotlin/space/kscience/snark/main/Main.kt +++ b/snark-main/src/main/kotlin/space/kscience/snark/main/Main.kt @@ -7,7 +7,9 @@ import space.kscience.snark.ktor.SNARKServer import space.kscience.snark.storage.local.localStorage import kotlin.io.path.Path +// Entrypoint fun main(): Unit = runBlocking { + // Parse config, create driver val port = 8080 val directory = localStorage(Path("./rundata")) val server = SNARKServer(ServerDataHolder(directory), port) From 29d842b0bfb5c5fca617c21af55f828a3a2fe93e Mon Sep 17 00:00:00 2001 From: Kirill Grachev Date: Sat, 6 May 2023 20:56:54 +0300 Subject: [PATCH 43/59] SNRK-68: Implement new semantics --- .../space/kscience/snark/storage/Driver.kt | 23 ++++++------- .../snark/storage/local/LocalDriver.kt | 34 +++++++++++++------ .../kscience/snark/storage/s3/S3Directory.kt | 5 +++ 3 files changed, 40 insertions(+), 22 deletions(-) diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/Driver.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/Driver.kt index eaa3e6f..d743d99 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/Driver.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/Driver.kt @@ -3,30 +3,29 @@ package space.kscience.snark.storage import java.nio.file.Path public interface Directory : AutoCloseable { - @Deprecated( - message = "Use Path, not String", - level = DeprecationLevel.WARNING, - ) + @Deprecated("Use Path, not String") public suspend fun get(filename: String): FileReader + // get file from subtree public suspend fun get(filename: Path): FileReader + @Deprecated("Use put") public suspend fun create(filename: String, ignoreIfExists: Boolean = false) - @Deprecated( - message = "Use Path, not String", - level = DeprecationLevel.WARNING, - ) + + @Deprecated("Use Path, not String") public suspend fun put(filename: String): FileWriter + // put file to subtree public suspend fun put(filename: Path): FileWriter public suspend fun getSubdir(path: Path): Directory + + public suspend operator fun div(path: Path): Directory = getSubdir(path) + + @Deprecated("Directories are created on put") public suspend fun createSubdir(dirname: String, ignoreIfExists: Boolean = false): Directory - @Deprecated( - message = "Not a good idea", - level = DeprecationLevel.WARNING, - ) + @Deprecated("Not a good idea") public val path: Path } diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/local/LocalDriver.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/local/LocalDriver.kt index 1b81fba..d6c5e94 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/local/LocalDriver.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/local/LocalDriver.kt @@ -3,9 +3,8 @@ package space.kscience.snark.storage.local import space.kscience.snark.storage.Directory import space.kscience.snark.storage.FileReader import space.kscience.snark.storage.FileWriter -import java.io.File +import java.lang.Exception import java.nio.file.Path -import java.nio.file.attribute.PosixFilePermission import kotlin.io.path.* public fun localStorage(rootPath: Path): Directory { @@ -16,24 +15,35 @@ internal class LocalFile(private val path: Path) : FileReader, FileWriter { override fun close() {} override suspend fun readAll(): ByteArray = path.readBytes() - override suspend fun write(bytes: ByteArray) = path.writeBytes(bytes) + override suspend fun write(bytes: ByteArray) { + path.parent.createDirectories() + try { + path.createFile() + } catch (ex: java.nio.file.FileAlreadyExistsException) { + // Do nothing + } + path.writeBytes(bytes) + } } internal class LocalDirectory(private val root: Path, private val currentDir: Path) : Directory { - private fun child(child: String): Path = root / currentDir / child - private fun child(child: Path): Path = root / currentDir / child + @Deprecated("Use Path, not String") + private fun realpath(child: String): Path = root / currentDir / child + private fun realpath(child: Path): Path = root / currentDir / child override fun close() {} - override suspend fun get(filename: String): LocalFile = LocalFile(child(filename)) + @Deprecated("Use Path, not String") + override suspend fun get(filename: String): LocalFile = LocalFile(realpath(filename)) - override suspend fun get(filename: Path): LocalFile = LocalFile(child(filename)) + override suspend fun get(filename: Path): LocalFile = LocalFile(realpath(filename)) + @Deprecated("Use put") override suspend fun create(filename: String, ignoreIfExists: Boolean) { - val dir = child(filename) + val dir = realpath(filename) dir.parent.createDirectories() try { - child(filename).createFile() + realpath(filename).createFile() } catch (ex: java.nio.file.FileAlreadyExistsException) { if (!ignoreIfExists) { throw ex @@ -41,13 +51,16 @@ internal class LocalDirectory(private val root: Path, private val currentDir: Pa } } + @Deprecated("Use Path, not String") override suspend fun put(filename: String): LocalFile = get(filename) override suspend fun put(filename: Path): LocalFile = get(filename) override suspend fun getSubdir(path: Path): LocalDirectory = LocalDirectory(root, currentDir / path) + + @Deprecated("Directories are created on put") override suspend fun createSubdir(dirname: String, ignoreIfExists: Boolean): LocalDirectory { - val dir = child(dirname) + val dir = realpath(dirname) dir.parent.createDirectories() try { dir.createDirectory() @@ -59,6 +72,7 @@ internal class LocalDirectory(private val root: Path, private val currentDir: Pa return LocalDirectory(root, currentDir / dirname) } + @Deprecated("Not a good idea") override val path: Path get() = currentDir } diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt index 7dbb52b..6416dc3 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt @@ -12,18 +12,21 @@ internal class S3Directory( private val bucketName: String, private val currentDir: Path, ) : Directory { + @Deprecated("Use Path, not String") override suspend fun get(filename: String): FileReader = S3FileReader(client, bucketName, currentDir / filename) override suspend fun get(filename: Path): FileReader = S3FileReader(client, bucketName, currentDir / filename) + @Deprecated("Use put") override suspend fun create(filename: String, ignoreIfExists: Boolean) { if (!ignoreIfExists) { TODO("could not check if file exists") } } + @Deprecated("Use Path, not String") override suspend fun put(filename: String): FileWriter = S3FileWriter(client, bucketName, currentDir / filename) @@ -33,6 +36,7 @@ internal class S3Directory( override suspend fun getSubdir(path: Path): S3Directory = S3Directory(client, bucketName, currentDir / path) + @Deprecated("Directories are created on put") override suspend fun createSubdir(dirname: String, ignoreIfExists: Boolean): S3Directory = if (!ignoreIfExists) { TODO("could not check if directory exists") @@ -40,6 +44,7 @@ internal class S3Directory( S3Directory(client, bucketName, currentDir / dirname) } + @Deprecated("Not a good idea") override val path: Path get() = currentDir From c6ceba2ed596769fdc54620af700f06e778bfcf8 Mon Sep 17 00:00:00 2001 From: Kirill Grachev Date: Sat, 6 May 2023 21:25:38 +0300 Subject: [PATCH 44/59] SNRK-68: Use extend functions to mark methods as final --- .../space/kscience/snark/storage/Driver.kt | 18 +++---- .../snark/storage/local/LocalDriver.kt | 8 +--- .../kscience/snark/storage/s3/S3Directory.kt | 8 ---- .../space/kscience/snark/storage/s3/S3Root.kt | 9 +--- .../kscience/snark/storage/unzip/Unzip.kt | 2 +- .../kscience/snark/storage/local/Example.kt | 47 +++++++++++++++++++ .../kscience/snark/storage/local/Tests.kt | 2 +- .../kscience/snark/storage/unzip/Tests.kt | 3 +- 8 files changed, 63 insertions(+), 34 deletions(-) create mode 100644 snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/local/Example.kt diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/Driver.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/Driver.kt index d743d99..5fb2fbc 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/Driver.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/Driver.kt @@ -1,27 +1,20 @@ package space.kscience.snark.storage import java.nio.file.Path +import kotlin.io.path.* public interface Directory : AutoCloseable { - @Deprecated("Use Path, not String") - public suspend fun get(filename: String): FileReader - // get file from subtree public suspend fun get(filename: Path): FileReader @Deprecated("Use put") public suspend fun create(filename: String, ignoreIfExists: Boolean = false) - @Deprecated("Use Path, not String") - public suspend fun put(filename: String): FileWriter - // put file to subtree public suspend fun put(filename: Path): FileWriter public suspend fun getSubdir(path: Path): Directory - public suspend operator fun div(path: Path): Directory = getSubdir(path) - @Deprecated("Directories are created on put") public suspend fun createSubdir(dirname: String, ignoreIfExists: Boolean = false): Directory @@ -29,6 +22,15 @@ public interface Directory : AutoCloseable { public val path: Path } + +public suspend fun Directory.get(filename: String): FileReader = get(Path(filename)) + +public suspend fun Directory.put(filename: String): FileWriter = put(Path(filename)) + +public suspend operator fun Directory.div(path: Path): Directory = getSubdir(path) + +public suspend operator fun Directory.div(path: String): Directory = getSubdir(Path(path)) + public interface FileReader : AutoCloseable { public suspend fun readAll(): ByteArray } diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/local/LocalDriver.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/local/LocalDriver.kt index d6c5e94..ea452e7 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/local/LocalDriver.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/local/LocalDriver.kt @@ -19,7 +19,7 @@ internal class LocalFile(private val path: Path) : FileReader, FileWriter { path.parent.createDirectories() try { path.createFile() - } catch (ex: java.nio.file.FileAlreadyExistsException) { + } catch (ex: Exception) { // Do nothing } path.writeBytes(bytes) @@ -33,9 +33,6 @@ internal class LocalDirectory(private val root: Path, private val currentDir: Pa override fun close() {} - @Deprecated("Use Path, not String") - override suspend fun get(filename: String): LocalFile = LocalFile(realpath(filename)) - override suspend fun get(filename: Path): LocalFile = LocalFile(realpath(filename)) @Deprecated("Use put") @@ -51,9 +48,6 @@ internal class LocalDirectory(private val root: Path, private val currentDir: Pa } } - @Deprecated("Use Path, not String") - override suspend fun put(filename: String): LocalFile = get(filename) - override suspend fun put(filename: Path): LocalFile = get(filename) override suspend fun getSubdir(path: Path): LocalDirectory = LocalDirectory(root, currentDir / path) diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt index 6416dc3..8ec96a5 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt @@ -12,10 +12,6 @@ internal class S3Directory( private val bucketName: String, private val currentDir: Path, ) : Directory { - @Deprecated("Use Path, not String") - override suspend fun get(filename: String): FileReader = - S3FileReader(client, bucketName, currentDir / filename) - override suspend fun get(filename: Path): FileReader = S3FileReader(client, bucketName, currentDir / filename) @@ -26,10 +22,6 @@ internal class S3Directory( } } - @Deprecated("Use Path, not String") - override suspend fun put(filename: String): FileWriter = - S3FileWriter(client, bucketName, currentDir / filename) - override suspend fun put(filename: Path): FileWriter = S3FileWriter(client, bucketName, currentDir / filename) diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt index 8f32607..19ad43f 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt @@ -21,22 +21,16 @@ internal fun splitPathIntoBucketAndPath(path: Path): Pair { } internal class S3Root(private val client: S3Client) : Directory { - override suspend fun get(filename: String): FileReader { - throw NoSuchFileException(Path(filename).toFile()) - } override suspend fun get(filename: Path): FileReader { throw NoSuchFileException(filename.toFile()) } + @Deprecated("Use put") override suspend fun create(filename: String, ignoreIfExists: Boolean) { throw NoSuchFileException(Path(filename).toFile()) } - override suspend fun put(filename: String): FileWriter { - throw NoSuchFileException(Path(filename).toFile()) - } - override suspend fun put(filename: Path): FileWriter { throw NoSuchFileException(filename.toFile()) } @@ -51,6 +45,7 @@ internal class S3Root(private val client: S3Client) : Directory { throw AccessDeniedException(path.toFile(), reason = ex.message) } + @Deprecated("Directories are created on put") override suspend fun createSubdir(dirname: String, ignoreIfExists: Boolean): Directory = try { val (bucketName, filePath) = splitPathIntoBucketAndPath(Path(dirname)) client.createBucket { diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/unzip/Unzip.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/unzip/Unzip.kt index 5201930..b60cc9c 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/unzip/Unzip.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/unzip/Unzip.kt @@ -1,6 +1,6 @@ package space.kscience.snark.storage.unzip -import space.kscience.snark.storage.Directory +import space.kscience.snark.storage.* import java.io.FileInputStream import java.util.zip.ZipInputStream diff --git a/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/local/Example.kt b/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/local/Example.kt new file mode 100644 index 0000000..324120f --- /dev/null +++ b/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/local/Example.kt @@ -0,0 +1,47 @@ +package space.kscience.snark.storage.local + +import kotlinx.coroutines.runBlocking +import org.junit.jupiter.api.BeforeAll +import space.kscience.snark.storage.* +import java.nio.file.Path +import kotlin.io.path.createTempDirectory +import kotlin.io.path.deleteExisting +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.io.path.* +import kotlin.test.assertEquals + +class Example { + var tempDir: Path? = null + var somedir: Directory? = null + + @BeforeTest + fun setUp() { + tempDir = createTempDirectory() + somedir = localStorage(tempDir!!) + } + + @AfterTest + fun tearDown() { + tempDir!!.toFile().deleteRecursively() + somedir = null + } + + @Test + fun exampleTest() = runBlocking { + somedir!!.put(Path("somefile")).write("hello".toByteArray()) + assertEquals("hello", somedir!!.get(Path("somefile")).readAll().decodeToString()) + } + + @Test + fun subdirExample() = runBlocking { + val dir1 = somedir!! / "tmp1" + dir1.put("somefile").write("hello".toByteArray()) + + val dir2 = somedir!! / "tmp1" + val data = dir2.get("somefile").readAll() + + assertEquals("hello", data.decodeToString()) + } +} \ No newline at end of file diff --git a/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/local/Tests.kt b/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/local/Tests.kt index ec5765e..f47e7fa 100644 --- a/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/local/Tests.kt +++ b/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/local/Tests.kt @@ -2,7 +2,7 @@ package space.kscience.snark.storage.local import kotlinx.coroutines.runBlocking -import space.kscience.snark.storage.Directory +import space.kscience.snark.storage.* import java.io.File import java.nio.file.Path import kotlin.io.path.* diff --git a/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/unzip/Tests.kt b/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/unzip/Tests.kt index 3b6e054..b567948 100644 --- a/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/unzip/Tests.kt +++ b/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/unzip/Tests.kt @@ -2,8 +2,7 @@ package space.kscience.snark.storage.unzip import kotlinx.coroutines.runBlocking -import space.kscience.snark.storage.Directory -import space.kscience.snark.storage.local.LocalDirectory +import space.kscience.snark.storage.* import space.kscience.snark.storage.local.localStorage import java.io.* import java.nio.file.Files From 793218b6bcf66b9a42d47d393d086b0150a0f577 Mon Sep 17 00:00:00 2001 From: Kirill Grachev Date: Sat, 6 May 2023 21:26:34 +0300 Subject: [PATCH 45/59] SNRK-68: Update examples --- .../test/kotlin/space/kscience/snark/storage/local/Example.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/local/Example.kt b/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/local/Example.kt index 324120f..e474fee 100644 --- a/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/local/Example.kt +++ b/snark-storage-driver/src/test/kotlin/space/kscience/snark/storage/local/Example.kt @@ -30,8 +30,8 @@ class Example { @Test fun exampleTest() = runBlocking { - somedir!!.put(Path("somefile")).write("hello".toByteArray()) - assertEquals("hello", somedir!!.get(Path("somefile")).readAll().decodeToString()) + somedir!!.put("somefile").write("hello".toByteArray()) + assertEquals("hello", somedir!!.get("somefile").readAll().decodeToString()) } @Test From 82255014888eed225eddb908934222119a678837 Mon Sep 17 00:00:00 2001 From: Kirill Grachev Date: Sat, 6 May 2023 21:32:17 +0300 Subject: [PATCH 46/59] Format files --- .../main/kotlin/space/kscience/snark/storage/Driver.kt | 2 +- .../space/kscience/snark/storage/local/LocalDriver.kt | 1 - .../space/kscience/snark/storage/s3/S3Directory.kt | 2 +- .../kotlin/space/kscience/snark/storage/s3/S3File.kt | 9 +++++---- .../kotlin/space/kscience/snark/storage/s3/S3Root.kt | 8 +++++--- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/Driver.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/Driver.kt index 5fb2fbc..902aa23 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/Driver.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/Driver.kt @@ -1,7 +1,7 @@ package space.kscience.snark.storage import java.nio.file.Path -import kotlin.io.path.* +import kotlin.io.path.Path public interface Directory : AutoCloseable { // get file from subtree diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/local/LocalDriver.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/local/LocalDriver.kt index ea452e7..33292c4 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/local/LocalDriver.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/local/LocalDriver.kt @@ -3,7 +3,6 @@ package space.kscience.snark.storage.local import space.kscience.snark.storage.Directory import space.kscience.snark.storage.FileReader import space.kscience.snark.storage.FileWriter -import java.lang.Exception import java.nio.file.Path import kotlin.io.path.* diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt index 8ec96a5..2f858f7 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Directory.kt @@ -5,7 +5,7 @@ import space.kscience.snark.storage.Directory import space.kscience.snark.storage.FileReader import space.kscience.snark.storage.FileWriter import java.nio.file.Path -import kotlin.io.path.* +import kotlin.io.path.div internal class S3Directory( private val client: S3Client, diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3File.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3File.kt index 8255519..478f1d5 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3File.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3File.kt @@ -8,11 +8,11 @@ import aws.smithy.kotlin.runtime.content.toByteArray import space.kscience.snark.storage.FileReader import space.kscience.snark.storage.FileWriter import java.nio.file.Path -import kotlin.io.path.* -internal class S3FileReader(private val client: S3Client, private val bucketName: String, private val path: Path) : FileReader { +internal class S3FileReader(private val client: S3Client, private val bucketName: String, private val path: Path) : + FileReader { override suspend fun readAll(): ByteArray { - val result = client.getObject(GetObjectRequest{ + val result = client.getObject(GetObjectRequest { bucket = bucketName key = path.toString() }) { @@ -25,7 +25,8 @@ internal class S3FileReader(private val client: S3Client, private val bucketName } } -internal class S3FileWriter(private val client: S3Client, private val bucketName: String, private val path: Path) : FileWriter { +internal class S3FileWriter(private val client: S3Client, private val bucketName: String, private val path: Path) : + FileWriter { override suspend fun write(bytes: ByteArray) { client.putObject { bucket = bucketName diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt index 19ad43f..be4a8ad 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt @@ -1,12 +1,13 @@ package space.kscience.snark.storage.s3 -import aws.sdk.kotlin.services.s3.* +import aws.sdk.kotlin.services.s3.S3Client +import aws.sdk.kotlin.services.s3.createBucket +import aws.sdk.kotlin.services.s3.headBucket import space.kscience.snark.storage.Directory import space.kscience.snark.storage.FileReader import space.kscience.snark.storage.FileWriter -import java.lang.Exception import java.nio.file.Path -import kotlin.io.path.* +import kotlin.io.path.Path public fun s3Storage(client: S3Client): Directory = S3Root(client) @@ -56,6 +57,7 @@ internal class S3Root(private val client: S3Client) : Directory { throw AccessDeniedException(Path(dirname).toFile(), reason = ex.message) } + @Deprecated("Not a good idea") override val path: Path get() = Path("") From ffaa932127e2398c5cb050121f4f84f707e52af6 Mon Sep 17 00:00:00 2001 From: Leonid Pereverzin Date: Sun, 7 May 2023 16:06:26 +0300 Subject: [PATCH 47/59] CE fix --- .../src/main/kotlin/Build.kt | 4 ++-- .../src/main/kotlin/DependencyGraph.kt | 21 +++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/Build.kt b/snark-document-builder/src/main/kotlin/Build.kt index aff99f6..b6a5ac8 100644 --- a/snark-document-builder/src/main/kotlin/Build.kt +++ b/snark-document-builder/src/main/kotlin/Build.kt @@ -1,6 +1,6 @@ package documentBuilder -public class GraphManager(private val graph: DependencyGraph) { +public class GraphManager(public val graph: DependencyGraph) { fun buildDocument(file: FileName) { val list = graph.nodes[file] if (list != null) { @@ -14,4 +14,4 @@ public class GraphManager(private val graph: DependencyGraph) { buildDocument(file) return graph.nodes[file]!!.mdAst } -} +} \ No newline at end of file diff --git a/snark-document-builder/src/main/kotlin/DependencyGraph.kt b/snark-document-builder/src/main/kotlin/DependencyGraph.kt index 864838a..0737713 100644 --- a/snark-document-builder/src/main/kotlin/DependencyGraph.kt +++ b/snark-document-builder/src/main/kotlin/DependencyGraph.kt @@ -1,6 +1,8 @@ package documentBuilder import kotlinx.coroutines.coroutineScope +import kotlin.collections.MutableList + public typealias FileName = String @@ -38,14 +40,29 @@ public data class IncludeDependency( ) : DependencyGraphEdge { override fun visit(graphManager: GraphManager) { val parent = parentNode + val childs: MutableList = mutableListOf() for (file in includeList) { graphManager.buildDocument(file) - parent.children.add(graphManager.graph.nodes[file].mdAst) + childs.addAll(graphManager.graph.nodes[file]!!.mdAst.children) } - dependentNode = parent + val elements: MutableList = parent.children.toMutableList() + val index = parent.children.indexOf(dependentNode) + elements.removeAt(index) + elements.addAll(index, childs) + parent.children = elements } } +// parent - List -------------------------------------- +// | \ +// | \ +// \ \ +// | \ +// | \ +// dependentNode - MdAstElement \ +// | +// List -> List --> List> ===> List + /** * Whole dependency graph. * From 046bbda23a1ed25738bafa59c030cfc18e8a7756 Mon Sep 17 00:00:00 2001 From: Leonid Pereverzin Date: Sun, 7 May 2023 17:57:41 +0300 Subject: [PATCH 48/59] SNRK-84: better --- .../src/main/kotlin/DependencyGraph.kt | 12 +++++------- .../src/main/kotlin/DocumentBuilder.kt | 11 +++++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DependencyGraph.kt b/snark-document-builder/src/main/kotlin/DependencyGraph.kt index 0737713..2928cf7 100644 --- a/snark-document-builder/src/main/kotlin/DependencyGraph.kt +++ b/snark-document-builder/src/main/kotlin/DependencyGraph.kt @@ -53,14 +53,12 @@ public data class IncludeDependency( } } -// parent - List -------------------------------------- +// parent - List ------------------------------------- // | \ -// | \ -// \ \ -// | \ -// | \ -// dependentNode - MdAstElement \ -// | +// \ \ +// | \ +// dependentNode - MdAstElement \ +// | // List -> List --> List> ===> List /** diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index 5f1ff31..c555c85 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -6,15 +6,18 @@ import java.nio.file.Path import java.nio.file.Paths import kotlinx.html.* import kotlinx.html.dom.createHTMLDocument +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue private val DEFAULT_DOCUMENT_ROOT = "main.md" public suspend fun buildDocument(documentDirectory: Directory): String { val dependencyGraph = buildDependencyGraph(documentDirectory) - -// TODO() /*resolving of dependencies*/ - - return "Not implemented" + println(1) + val roooot: MdAstRoot = dependencyGraph.nodes[""]!!.mdAst + println(2) + return jacksonObjectMapper().writeValueAsString(roooot) + // TODO прикрутить html } public suspend fun buildDependencyGraph(root: Directory): DependencyGraph { From ef54c02c41212e07de2917bc43668f22c7aff9a4 Mon Sep 17 00:00:00 2001 From: Leonid Pereverzin Date: Sun, 7 May 2023 17:59:46 +0300 Subject: [PATCH 49/59] delete debug print --- snark-document-builder/src/main/kotlin/DocumentBuilder.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index c555c85..9f7279b 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -13,9 +13,8 @@ private val DEFAULT_DOCUMENT_ROOT = "main.md" public suspend fun buildDocument(documentDirectory: Directory): String { val dependencyGraph = buildDependencyGraph(documentDirectory) - println(1) val roooot: MdAstRoot = dependencyGraph.nodes[""]!!.mdAst - println(2) + return jacksonObjectMapper().writeValueAsString(roooot) // TODO прикрутить html } From fbd52375738975c1432bdd486afd4daba6b7a088 Mon Sep 17 00:00:00 2001 From: Leonid Pereverzin Date: Sun, 7 May 2023 18:06:12 +0300 Subject: [PATCH 50/59] better naming --- snark-document-builder/src/main/kotlin/DocumentBuilder.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index 9f7279b..a65eeaa 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -13,9 +13,9 @@ private val DEFAULT_DOCUMENT_ROOT = "main.md" public suspend fun buildDocument(documentDirectory: Directory): String { val dependencyGraph = buildDependencyGraph(documentDirectory) - val roooot: MdAstRoot = dependencyGraph.nodes[""]!!.mdAst + val root: MdAstRoot = dependencyGraph.nodes[""]!!.mdAst - return jacksonObjectMapper().writeValueAsString(roooot) + return jacksonObjectMapper().writeValueAsString(root) // TODO прикрутить html } From 8ffda3f42a453da712fc73662487f88527e9c218 Mon Sep 17 00:00:00 2001 From: Anton Belyi Date: Fri, 12 May 2023 18:06:57 +0300 Subject: [PATCH 51/59] SNRK-90: return html as string --- .../main/kotlin/space/kscience/snark/ktor/WebInterface.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/snark-ktor/src/main/kotlin/space/kscience/snark/ktor/WebInterface.kt b/snark-ktor/src/main/kotlin/space/kscience/snark/ktor/WebInterface.kt index 368bad6..a2568ef 100644 --- a/snark-ktor/src/main/kotlin/space/kscience/snark/ktor/WebInterface.kt +++ b/snark-ktor/src/main/kotlin/space/kscience/snark/ktor/WebInterface.kt @@ -8,17 +8,14 @@ import io.ktor.server.application.* import io.ktor.server.html.* import io.ktor.server.request.* import io.ktor.server.response.* -import io.ktor.server.http.content.* import kotlinx.html.* import io.ktor.server.routing.* -import kotlinx.css.html import java.nio.file.Path import space.kscience.snark.storage.Directory import space.kscience.snark.storage.local.localStorage import kotlin.io.path.createTempDirectory import kotlin.io.path.isDirectory import kotlin.io.path.listDirectoryEntries -import kotlin.io.path.name import space.kscience.snark.storage.unzip.unzip public interface DataHolder { @@ -56,7 +53,7 @@ class LocalDataHolder: DataHolder { public class SNARKServer(val dataHolder: DataHolder, val port: Int): Runnable { private suspend fun renderGet(call: ApplicationCall) { - call.respondText(dataHolder.represent()) + call.respondText(dataHolder.represent(), ContentType.Text.Html) } private suspend fun renderUpload(call: ApplicationCall) { val multipartData = call.receiveMultipart() From 7fb778e483ba1f85e60deaee9249de345a6d47e6 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sat, 13 May 2023 20:05:22 +0300 Subject: [PATCH 52/59] SNRK-78: requirments installation script is added --- requirments.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 requirments.sh diff --git a/requirments.sh b/requirments.sh new file mode 100755 index 0000000..ce4f85f --- /dev/null +++ b/requirments.sh @@ -0,0 +1,27 @@ +set -e + +apt-get update +apt-get install -y sudo + +sudo apt-get install -y kotlin + +for dir in ./*/ +do + if [[($dir == *'snark'*)]] + then + cd "$dir" + + if [[ $(find -type d -name "ci") ]] + then + + cd ci + + ./requirments.sh + + cd .. + fi + + cd .. + fi +done + From b0e3b5551ac3a8d9e14da2f4a446f7c50937d0d6 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sat, 13 May 2023 21:45:44 +0300 Subject: [PATCH 53/59] SNRK-78: better --- requirments.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirments.sh b/requirments.sh index ce4f85f..8878fdb 100755 --- a/requirments.sh +++ b/requirments.sh @@ -7,7 +7,7 @@ sudo apt-get install -y kotlin for dir in ./*/ do - if [[($dir == *'snark'*)]] + if [[ $dir == *'snark'* ]] then cd "$dir" From f30b35e66a3fc2160a8a61e9ebbba873e5c5de2d Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sat, 13 May 2023 21:48:25 +0300 Subject: [PATCH 54/59] SNRK-78: docker file is added --- Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..05d2f2d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM ubuntu:latest + +WORKDIR Snark + +COPY . . + +RUN ./requirments.sh +RUN ./gradlew build test \ No newline at end of file From 8795b49d3842244fb69497a70a0e8831542518f6 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sat, 13 May 2023 22:53:56 +0300 Subject: [PATCH 55/59] SNRK-78: .dockerignore is added --- .dockerignore | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2541772 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,19 @@ +# .gitignore contents + +.gradle/ +build/ +.idea/ +/logs/ + +!gradle/wrapper/gradle-wrapper.jar + +kotlin-js-store +*.iml + +# addition to .gitignore + +README.md +LICENSE +gradlew.bat +.dockerignore +Dockerfile \ No newline at end of file From 2755e2020dad91d7f25e5210f49f42d92c2ed570 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sat, 13 May 2023 22:54:31 +0300 Subject: [PATCH 56/59] SNRK-78: call of main is commented because test cannot end --- snark-main/src/test/kotlin/space/kscience/snark/main/Test.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snark-main/src/test/kotlin/space/kscience/snark/main/Test.kt b/snark-main/src/test/kotlin/space/kscience/snark/main/Test.kt index 86d0824..5eb1c84 100644 --- a/snark-main/src/test/kotlin/space/kscience/snark/main/Test.kt +++ b/snark-main/src/test/kotlin/space/kscience/snark/main/Test.kt @@ -8,6 +8,6 @@ class Test { @Test fun justWorks() = runBlocking { delay(5) - main() + //main() } } \ No newline at end of file From bd8dcdca4d0d818f892740193beac25831cfa2a7 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Sun, 14 May 2023 19:41:27 +0300 Subject: [PATCH 57/59] SNRK-78: .gitignore is added to .dockerignore --- .dockerignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.dockerignore b/.dockerignore index 2541772..7cac5f9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -16,4 +16,5 @@ README.md LICENSE gradlew.bat .dockerignore +.gitignore Dockerfile \ No newline at end of file From 5c88ff5a00d8604ed2c7fa7ecc0ed95af8ce8355 Mon Sep 17 00:00:00 2001 From: Leonid Pereverzin Date: Sun, 14 May 2023 20:31:39 +0300 Subject: [PATCH 58/59] SNRK-89: ??? --- .../src/main/kotlin/DocumentBuilder.kt | 16 ++++++++++++++-- .../src/main/nodejs/HtmlRenderer.js | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 snark-document-builder/src/main/nodejs/HtmlRenderer.js diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index a65eeaa..0692b0a 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -8,15 +8,27 @@ import kotlinx.html.* import kotlinx.html.dom.createHTMLDocument import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.readValue +import kotlinx.serialization.json.Json + +private val SNARK_HTML_RENDER = "snark-document-builder/src/main/nodejs/HtmlRenderer.js" +fun getHtml(ast_string: String): String +{ + return ProcessBuilder("node", SNARK_HTML_RENDER, ast_string) + .redirectOutput(ProcessBuilder.Redirect.PIPE) + .redirectError(ProcessBuilder.Redirect.INHERIT) + .start().inputStream.bufferedReader().readText() +} private val DEFAULT_DOCUMENT_ROOT = "main.md" public suspend fun buildDocument(documentDirectory: Directory): String { val dependencyGraph = buildDependencyGraph(documentDirectory) + val root: MdAstRoot = dependencyGraph.nodes[""]!!.mdAst - return jacksonObjectMapper().writeValueAsString(root) - // TODO прикрутить html + // return getHtml(jacksonObjectMapper().writeValueAsString(root)) + // return jacksonObjectMapper().writeValueAsString(root) + return root.toString() } public suspend fun buildDependencyGraph(root: Directory): DependencyGraph { diff --git a/snark-document-builder/src/main/nodejs/HtmlRenderer.js b/snark-document-builder/src/main/nodejs/HtmlRenderer.js new file mode 100644 index 0000000..dc9cda0 --- /dev/null +++ b/snark-document-builder/src/main/nodejs/HtmlRenderer.js @@ -0,0 +1,16 @@ +import {toHast} from 'mdast-util-to-hast' +import {toHtml} from 'hast-util-to-html' + +main() + +function main() +{ + if (process.argv.length < 3) + throw "No input" + + const md_ast = JSON.parse(process.argv[2]) + const hast = toHast(md_ast) + const html = toHtml(hast) + + console.log(html) +} From 167037e2769ba94e2b803f810b6c9856b5c381d9 Mon Sep 17 00:00:00 2001 From: Leonid Pereverzin Date: Sun, 14 May 2023 20:33:26 +0300 Subject: [PATCH 59/59] better --- snark-document-builder/src/main/kotlin/DocumentBuilder.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt index 0692b0a..e462ae0 100644 --- a/snark-document-builder/src/main/kotlin/DocumentBuilder.kt +++ b/snark-document-builder/src/main/kotlin/DocumentBuilder.kt @@ -26,9 +26,8 @@ public suspend fun buildDocument(documentDirectory: Directory): String { val root: MdAstRoot = dependencyGraph.nodes[""]!!.mdAst - // return getHtml(jacksonObjectMapper().writeValueAsString(root)) + return getHtml(jacksonObjectMapper().writeValueAsString(root)) // return jacksonObjectMapper().writeValueAsString(root) - return root.toString() } public suspend fun buildDependencyGraph(root: Directory): DependencyGraph {