Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98b6f96b69 | ||
|
|
f2a301054d | ||
|
|
91e9ff92d0 | ||
|
|
a7dc007cb4 | ||
|
|
c3d555d49c | ||
|
|
83e47694ef | ||
|
|
246e01b55c | ||
|
|
ba3bbf7e65 | ||
|
|
53e03d2b7c | ||
|
|
20f7cb24d4 | ||
|
|
5ee1f296e3 |
No files matched your search
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
name: main
|
name: main
|
||||||
title: Main Project
|
title: Main Project
|
||||||
version: 0.34.0-dev
|
version: 0.33.1
|
||||||
prerelease: true
|
prerelease: false
|
||||||
nav:
|
nav:
|
||||||
- nav.adoc
|
- nav.adoc
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
// the following attributes must be updated immediately before a release
|
// the following attributes must be updated immediately before a release
|
||||||
|
|
||||||
// pkl version corresponding to current git commit without -dev suffix or git hash
|
// pkl version corresponding to current git commit without -dev suffix or git hash
|
||||||
:pkl-version-no-suffix: 0.34.0
|
:pkl-version-no-suffix: 0.33.1
|
||||||
// tells whether pkl version corresponding to current git commit
|
// tells whether pkl version corresponding to current git commit
|
||||||
// is a release version (:is-release-version: '') or dev version (:!is-release-version:)
|
// is a release version (:is-release-version: '') or dev version (:!is-release-version:)
|
||||||
:!is-release-version:
|
:is-release-version: ''
|
||||||
|
|
||||||
// the remaining attributes do not need to be updated regularly
|
// the remaining attributes do not need to be updated regularly
|
||||||
|
|
||||||
@@ -77,6 +77,7 @@ endif::[]
|
|||||||
:uri-stdlib-netModule: {uri-pkl-stdlib-docs}/net
|
:uri-stdlib-netModule: {uri-pkl-stdlib-docs}/net
|
||||||
:uri-stdlib-net-Url: {uri-stdlib-netModule}/Url
|
:uri-stdlib-net-Url: {uri-stdlib-netModule}/Url
|
||||||
:uri-stdlib-xmlModule: {uri-pkl-stdlib-docs}/xml
|
:uri-stdlib-xmlModule: {uri-pkl-stdlib-docs}/xml
|
||||||
|
:uri-stdlib-protobufModule: {uri-pkl-stdlib-docs}/protobuf
|
||||||
:uri-stdlib-pklbinaryModule: {uri-pkl-stdlib-docs}/pklbinary
|
:uri-stdlib-pklbinaryModule: {uri-pkl-stdlib-docs}/pklbinary
|
||||||
:uri-stdlib-yamlModule: {uri-pkl-stdlib-docs}/yaml
|
:uri-stdlib-yamlModule: {uri-pkl-stdlib-docs}/yaml
|
||||||
:uri-stdlib-YamlParser: {uri-stdlib-yamlModule}/Parser
|
:uri-stdlib-YamlParser: {uri-stdlib-yamlModule}/Parser
|
||||||
|
|||||||
@@ -2752,6 +2752,7 @@ The standard library provides these renderers:
|
|||||||
* link:{uri-stdlib-baseModule}/PcfRenderer[PcfRenderer]
|
* link:{uri-stdlib-baseModule}/PcfRenderer[PcfRenderer]
|
||||||
* link:{uri-stdlib-baseModule}/PListRenderer[PListRenderer]
|
* link:{uri-stdlib-baseModule}/PListRenderer[PListRenderer]
|
||||||
* link:{uri-stdlib-baseModule}/PropertiesRenderer[PropertiesRenderer]
|
* link:{uri-stdlib-baseModule}/PropertiesRenderer[PropertiesRenderer]
|
||||||
|
* link:{uri-stdlib-protobufModule}/Renderer[protobuf.Renderer]
|
||||||
* link:{uri-stdlib-xmlModule}/Renderer[xml.Renderer]
|
* link:{uri-stdlib-xmlModule}/Renderer[xml.Renderer]
|
||||||
* link:{uri-stdlib-baseModule}/YamlRenderer[YamlRenderer]
|
* link:{uri-stdlib-baseModule}/YamlRenderer[YamlRenderer]
|
||||||
|
|
||||||
|
|||||||
@@ -307,6 +307,7 @@ The default output renderer for a module supports the following formats:
|
|||||||
* `pcf`
|
* `pcf`
|
||||||
* `plist`
|
* `plist`
|
||||||
* `properties`
|
* `properties`
|
||||||
|
* `textproto` (deprecated in Pkl 0.33)
|
||||||
* `xml`
|
* `xml`
|
||||||
* `yaml`
|
* `yaml`
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ The default output renderer for a module supports the following formats:
|
|||||||
* `"pcf"`
|
* `"pcf"`
|
||||||
* `"plist"`
|
* `"plist"`
|
||||||
* `"properties"`
|
* `"properties"`
|
||||||
|
* `"textproto"` (deprecated in Pkl 0.33)
|
||||||
* `"xml"`
|
* `"xml"`
|
||||||
* `"yaml"`
|
* `"yaml"`
|
||||||
====
|
====
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
= Pkl 0.34 Release Notes
|
|
||||||
|
|
||||||
:version: 0.34
|
|
||||||
:version-minor: 0.34.0
|
|
||||||
:release-date: TBD
|
|
||||||
:version-next: 0.35.0
|
|
||||||
:version-next-date: June 2027
|
|
||||||
|
|
||||||
link:partial$intro.adoc[role=include]
|
|
||||||
|
|
||||||
== Highlights [small]#💖#
|
|
||||||
|
|
||||||
News you don't want to miss.
|
|
||||||
|
|
||||||
=== XXX
|
|
||||||
|
|
||||||
== Noteworthy [small]#🎶#
|
|
||||||
|
|
||||||
Ready when you need them.
|
|
||||||
|
|
||||||
=== XXX
|
|
||||||
|
|
||||||
== Breaking Changes [small]#💔#
|
|
||||||
|
|
||||||
Things to watch out for when upgrading.
|
|
||||||
|
|
||||||
=== XXX
|
|
||||||
|
|
||||||
== Miscellaneous [small]#🐸#
|
|
||||||
|
|
||||||
* XXX
|
|
||||||
* XXX
|
|
||||||
|
|
||||||
== Bug Fixes [small]#🐜#
|
|
||||||
|
|
||||||
* XXX
|
|
||||||
* XXX
|
|
||||||
|
|
||||||
== Security Fixes [small]#🔒#
|
|
||||||
|
|
||||||
The following security vulnerabilities were fixed:
|
|
||||||
|
|
||||||
== Contributors [small]#🙏#
|
|
||||||
|
|
||||||
We would like to thank the contributors to this release (in alphabetical order):
|
|
||||||
|
|
||||||
* XXX
|
|
||||||
@@ -1,11 +1,6 @@
|
|||||||
= Changelog
|
= Changelog
|
||||||
include::ROOT:partial$component-attributes.adoc[]
|
include::ROOT:partial$component-attributes.adoc[]
|
||||||
|
|
||||||
[[release-0.34.0]]
|
|
||||||
== 0.34.0 (UNRELEASED)
|
|
||||||
|
|
||||||
xref:0.34.adoc[Release Notes]
|
|
||||||
|
|
||||||
[[release-0.33.1]]
|
[[release-0.33.1]]
|
||||||
== 0.33.1 (2026-11-18)
|
== 0.33.1 (2026-11-18)
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
The Pkl team aims to release a new version of Pkl in February, June, and October of each year.
|
The Pkl team aims to release a new version of Pkl in February, June, and October of each year.
|
||||||
|
|
||||||
* xref:0.34.adoc[0.34 Release Notes]
|
|
||||||
* xref:0.33.adoc[0.33 Release Notes]
|
* xref:0.33.adoc[0.33 Release Notes]
|
||||||
* xref:0.32.adoc[0.32 Release Notes]
|
* xref:0.32.adoc[0.32 Release Notes]
|
||||||
* xref:0.31.adoc[0.31 Release Notes]
|
* xref:0.31.adoc[0.31 Release Notes]
|
||||||
|
|||||||
@@ -5,39 +5,47 @@
|
|||||||
:version-next: XXX (e.g., 0.10)
|
:version-next: XXX (e.g., 0.10)
|
||||||
:version-next-date: XXX (e.g., July 2018)
|
:version-next-date: XXX (e.g., July 2018)
|
||||||
|
|
||||||
link:partial$intro.adoc[role=include]
|
include::partial$intro.adoc[]
|
||||||
|
|
||||||
== Highlights [small]#💖#
|
== Highlights [small]#💖#
|
||||||
|
|
||||||
News you don't want to miss.
|
News you don't want to miss.
|
||||||
|
|
||||||
=== XXX
|
.XXX
|
||||||
|
[%collapsible]
|
||||||
|
====
|
||||||
|
XXX
|
||||||
|
====
|
||||||
|
|
||||||
== Noteworthy [small]#🎶#
|
== Noteworthy [small]#🎶#
|
||||||
|
|
||||||
Ready when you need them.
|
Ready when you need them.
|
||||||
|
|
||||||
=== XXX
|
.XXX
|
||||||
|
[%collapsible]
|
||||||
|
====
|
||||||
|
XXX
|
||||||
|
====
|
||||||
|
|
||||||
== Breaking Changes [small]#💔#
|
== Breaking Changes [small]#💔#
|
||||||
|
|
||||||
Things to watch out for when upgrading.
|
Things to watch out for when upgrading.
|
||||||
|
|
||||||
=== XXX
|
.XXX
|
||||||
|
[%collapsible]
|
||||||
|
====
|
||||||
|
XXX
|
||||||
|
====
|
||||||
|
|
||||||
== Miscellaneous [small]#🐸#
|
== Work In Progress [small]#🚆#
|
||||||
|
|
||||||
* XXX
|
They missed the train but deserve a mention.
|
||||||
* XXX
|
|
||||||
|
|
||||||
== Bug Fixes [small]#🐜#
|
.XXX
|
||||||
|
[%collapsible]
|
||||||
* XXX
|
====
|
||||||
* XXX
|
XXX
|
||||||
|
====
|
||||||
== Security Fixes [small]#🔒#
|
|
||||||
|
|
||||||
The following security vulnerabilities were fixed:
|
|
||||||
|
|
||||||
== Contributors [small]#🙏#
|
== Contributors [small]#🙏#
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
* xref:ROOT:evolution-and-roadmap.adoc[Evolution and Roadmap]
|
* xref:ROOT:evolution-and-roadmap.adoc[Evolution and Roadmap]
|
||||||
|
|
||||||
* xref:release-notes:index.adoc[Release Notes]
|
* xref:release-notes:index.adoc[Release Notes]
|
||||||
** xref:release-notes:0.34.adoc[0.34 Release Notes]
|
|
||||||
** xref:release-notes:0.33.adoc[0.33 Release Notes]
|
** xref:release-notes:0.33.adoc[0.33 Release Notes]
|
||||||
** xref:release-notes:0.32.adoc[0.32 Release Notes]
|
** xref:release-notes:0.32.adoc[0.32 Release Notes]
|
||||||
** xref:release-notes:0.31.adoc[0.31 Release Notes]
|
** xref:release-notes:0.31.adoc[0.31 Release Notes]
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
# suppress inspection "UnusedProperty" for whole file
|
# suppress inspection "UnusedProperty" for whole file
|
||||||
|
|
||||||
group=org.pkl-lang
|
group=org.pkl-lang
|
||||||
version=0.34.0
|
version=0.33.1
|
||||||
|
|
||||||
# google-java-format requires jdk.compiler exports
|
# google-java-format requires jdk.compiler exports
|
||||||
org.gradle.jvmargs= \
|
org.gradle.jvmargs= \
|
||||||
|
|||||||
@@ -11,22 +11,22 @@ errorPronePlugin = "5.1.0"
|
|||||||
geantyref = "2.0.1"
|
geantyref = "2.0.1"
|
||||||
#noinspection UnusedVersionCatalogEntry
|
#noinspection UnusedVersionCatalogEntry
|
||||||
googleJavaFormat = "1.35.0"
|
googleJavaFormat = "1.35.0"
|
||||||
graalVm = "25.5.5.0.3"
|
graalVm = "25.2.4"
|
||||||
graalVmJdkVersion = "25.0.5.0.3"
|
graalVmJdkVersion = "25.0.4"
|
||||||
#noinspection UnusedVersionCatalogEntry
|
#noinspection UnusedVersionCatalogEntry
|
||||||
graalVmInnovation = "5"
|
graalVmInnovation = "2"
|
||||||
# slightly hacky but convenient place so we remember to update the checksum
|
# slightly hacky but convenient place so we remember to update the checksum
|
||||||
# pklGraalVm.gradle.kts assumes this entry exists
|
# pklGraalVm.gradle.kts assumes this entry exists
|
||||||
#noinspection UnusedVersionCatalogEntry
|
#noinspection UnusedVersionCatalogEntry
|
||||||
graalVmSha256-macos-x64 = "unavailable"
|
graalVmSha256-macos-x64 = "unavailable"
|
||||||
#noinspection UnusedVersionCatalogEntry
|
#noinspection UnusedVersionCatalogEntry
|
||||||
graalVmSha256-macos-aarch64 = "54369d4a5931a5a2101c7c52444a4e7e6647a3a4e041335053cda6fd22295e0c"
|
graalVmSha256-macos-aarch64 = "507330fff8907de51b8621c95a21a491fa9b0d8c240de184594f40f83add3bfa"
|
||||||
#noinspection UnusedVersionCatalogEntry
|
#noinspection UnusedVersionCatalogEntry
|
||||||
graalVmSha256-linux-x64 = "c6438dee6c3ade2220d40b7ccdcad24b512d30e233e61bb4fc70519522de34ef"
|
graalVmSha256-linux-x64 = "3f4a89de8eaa96f2ed677f09957c7e872cd8467aad3537f8b5394c1b8c4b942e"
|
||||||
#noinspection UnusedVersionCatalogEntry
|
#noinspection UnusedVersionCatalogEntry
|
||||||
graalVmSha256-linux-aarch64 = "41741c0650ae7564a78335f9e4fc353a902e6ff1d4140f2e4fabd1c55d5cce66"
|
graalVmSha256-linux-aarch64 = "22286f7ecd21b9aedb3226b9bf797469e1bd3eefc491e12ef3dd49b452d230b7"
|
||||||
#noinspection UnusedVersionCatalogEntry
|
#noinspection UnusedVersionCatalogEntry
|
||||||
graalVmSha256-windows-x64 = "b02c3b162129fa8cbfa7ebd0fcc1ae6eba2fc736bf3bef8e40e5ace3e9d9a0d6"
|
graalVmSha256-windows-x64 = "789d2af1c06c3c24f402d2d4a711bdbb19b36f7d8c74afe6a959492fd121ef33"
|
||||||
# pklGraalVm.gradle.kts assumes this entry exists
|
# pklGraalVm.gradle.kts assumes this entry exists
|
||||||
#noinspection UnusedVersionCatalogEntry
|
#noinspection UnusedVersionCatalogEntry
|
||||||
graalVmSha256-windows-aarch64 = "unavailable"
|
graalVmSha256-windows-aarch64 = "unavailable"
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ data class CliEvaluatorOptions(
|
|||||||
* - `"pcf"` (default)
|
* - `"pcf"` (default)
|
||||||
* - `"plist"`
|
* - `"plist"`
|
||||||
* - `"properties"`
|
* - `"properties"`
|
||||||
|
* - `"textproto"` (deprecated in Pkl 0.33)
|
||||||
* - `"xml"`
|
* - `"xml"`
|
||||||
* - `"yaml"`
|
* - `"yaml"`
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ internal object ReplMessages {
|
|||||||
|
|
||||||
For more examples, see the Language Reference${if (isMacOs()) " (Command+Double-click the link below)" else ""}:
|
For more examples, see the Language Reference${if (isMacOs()) " (Command+Double-click the link below)" else ""}:
|
||||||
|
|
||||||
https://pkl-lang.org/main/current/language-reference/index.html
|
${Release.current().documentation().homepage()}language-reference/
|
||||||
|
|
||||||
"""
|
"""
|
||||||
.trimIndent()
|
.trimIndent()
|
||||||
|
|||||||
@@ -709,7 +709,8 @@ result = someLib.x
|
|||||||
assertThat(output).isEqualTo("x: 1\n---\nx: 3\n")
|
assertThat(output).isEqualTo("x: 1\n---\nx: 3\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
@EnumSource
|
// prototext can't render `Dynamic`.
|
||||||
|
@EnumSource(names = ["TEXTPROTO"], mode = EnumSource.Mode.EXCLUDE)
|
||||||
@ParameterizedTest(name = "{0} console output ends with newline")
|
@ParameterizedTest(name = "{0} console output ends with newline")
|
||||||
fun `console output ends with newline`(outputFormat: OutputFormat) {
|
fun `console output ends with newline`(outputFormat: OutputFormat) {
|
||||||
val sourceFiles = listOf(writePklFile("test0.pkl", "foo = 0\nbar=\"Baz\""))
|
val sourceFiles = listOf(writePklFile("test0.pkl", "foo = 0\nbar=\"Baz\""))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
|
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -73,10 +73,4 @@ class ReplMessagesTest {
|
|||||||
assertThat(responses.size).isEqualTo(1)
|
assertThat(responses.size).isEqualTo(1)
|
||||||
assertThat(responses).hasOnlyElementsOfType(ReplResponse.EvalError::class.java)
|
assertThat(responses).hasOnlyElementsOfType(ReplResponse.EvalError::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `examples link to the current language reference`() {
|
|
||||||
assertThat(ReplMessages.examples.trimEnd().lines().last())
|
|
||||||
.isEqualTo("https://pkl-lang.org/main/current/language-reference/index.html")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
|
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -22,6 +22,7 @@ public enum OutputFormat {
|
|||||||
PCF("pcf"),
|
PCF("pcf"),
|
||||||
PROPERTIES("properties"),
|
PROPERTIES("properties"),
|
||||||
PLIST("plist"),
|
PLIST("plist"),
|
||||||
|
TEXTPROTO("textproto"),
|
||||||
XML("xml"),
|
XML("xml"),
|
||||||
YAML("yaml");
|
YAML("yaml");
|
||||||
|
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ import org.pkl.core.stdlib.registry.ExternalMemberRegistry;
|
|||||||
import org.pkl.core.stdlib.registry.MemberRegistryFactory;
|
import org.pkl.core.stdlib.registry.MemberRegistryFactory;
|
||||||
import org.pkl.core.util.CollectionUtils;
|
import org.pkl.core.util.CollectionUtils;
|
||||||
import org.pkl.core.util.EconomicMaps;
|
import org.pkl.core.util.EconomicMaps;
|
||||||
|
import org.pkl.core.util.ErrorMessages;
|
||||||
import org.pkl.core.util.IoUtils;
|
import org.pkl.core.util.IoUtils;
|
||||||
import org.pkl.core.util.Pair;
|
import org.pkl.core.util.Pair;
|
||||||
import org.pkl.parser.Span;
|
import org.pkl.parser.Span;
|
||||||
@@ -393,20 +394,14 @@ public class AstBuilder extends AbstractAstBuilder<Object> {
|
|||||||
if (currentScope.getConstLevel() == ConstLevel.MODULE) {
|
if (currentScope.getConstLevel() == ConstLevel.MODULE) {
|
||||||
for (var scope = currentScope; scope != null; scope = scope.getParent()) {
|
for (var scope = currentScope; scope != null; scope = scope.getParent()) {
|
||||||
if (scope.isAnnotationScope()) {
|
if (scope.isAnnotationScope()) {
|
||||||
throw exceptionBuilder()
|
errorMessage = ErrorMessages.create("invalidModuleTypeInAnnotation");
|
||||||
.withSourceSection(sourceSection)
|
break;
|
||||||
.evalError("invalidModuleTypeInAnnotation")
|
|
||||||
.build();
|
|
||||||
} else if (scope.isClassScope()) {
|
} else if (scope.isClassScope()) {
|
||||||
throw exceptionBuilder()
|
errorMessage = ErrorMessages.create("invalidModuleTypeInClass");
|
||||||
.withSourceSection(sourceSection)
|
break;
|
||||||
.evalError("invalidModuleTypeInClass")
|
|
||||||
.build();
|
|
||||||
} else if (scope.isTypeAliasScope()) {
|
} else if (scope.isTypeAliasScope()) {
|
||||||
throw exceptionBuilder()
|
errorMessage = ErrorMessages.create("invalidModuleTypeInTypeAlias");
|
||||||
.withSourceSection(sourceSection)
|
break;
|
||||||
.evalError("invalidModuleTypeInTypeAlias")
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -423,16 +418,18 @@ public class AstBuilder extends AbstractAstBuilder<Object> {
|
|||||||
}
|
}
|
||||||
var message =
|
var message =
|
||||||
scope.isPropertyScope() ? "invalidModuleTypeInProperty" : "invalidModuleTypeInMethod";
|
scope.isPropertyScope() ? "invalidModuleTypeInProperty" : "invalidModuleTypeInMethod";
|
||||||
throw exceptionBuilder()
|
errorMessage = ErrorMessages.create(message, scope.getQualifiedName());
|
||||||
.withSourceSection(sourceSection)
|
break;
|
||||||
.evalError(message, scope.getQualifiedName())
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert errorMessage != null;
|
||||||
// we should always throw a real exception before we get here!
|
// TODO: when making this an error, update comment on moduleClass in ReferenceTypeNode.eval
|
||||||
throw PklBugException.unreachableCode();
|
VmContext.get(null)
|
||||||
|
.getLogger()
|
||||||
|
.warn(
|
||||||
|
errorMessage + " This will be an error in a future release.",
|
||||||
|
VmUtils.createStackFrame(sourceSection, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import org.pkl.parser.syntax.Module;
|
|||||||
@TruffleLanguage.Registration(
|
@TruffleLanguage.Registration(
|
||||||
id = "pkl",
|
id = "pkl",
|
||||||
name = "Pkl",
|
name = "Pkl",
|
||||||
version = "0.34.0-dev",
|
version = "0.33.1",
|
||||||
characterMimeTypes = VmLanguage.MIME_TYPE,
|
characterMimeTypes = VmLanguage.MIME_TYPE,
|
||||||
contextPolicy = ContextPolicy.SHARED)
|
contextPolicy = ContextPolicy.SHARED)
|
||||||
@ProvidedTags(PklTags.Expression.class)
|
@ProvidedTags(PklTags.Expression.class)
|
||||||
|
|||||||
@@ -0,0 +1,663 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.pkl.core.stdlib.protobuf;
|
||||||
|
|
||||||
|
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
|
||||||
|
import com.oracle.truffle.api.dsl.Cached;
|
||||||
|
import com.oracle.truffle.api.dsl.Specialization;
|
||||||
|
import com.oracle.truffle.api.nodes.IndirectCallNode;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Deque;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.jspecify.annotations.Nullable;
|
||||||
|
import org.pkl.core.DurationUnit;
|
||||||
|
import org.pkl.core.ast.member.ClassProperty;
|
||||||
|
import org.pkl.core.ast.member.PropertyTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.BooleanTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.IntSlotTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.IntTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.ListTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.ListingOrMappingTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.ListingTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.MapTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.MappingTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.NonFinalClassTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.NullableTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.ObjectSlotTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.SetTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.StringLiteralTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.StringTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.TypeAliasTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.UnionOfStringLiteralsTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.UnionTypeNode;
|
||||||
|
import org.pkl.core.ast.type.TypeNode.UnionTypeNodeExploded;
|
||||||
|
import org.pkl.core.ast.type.VmTypeMismatchException;
|
||||||
|
import org.pkl.core.runtime.Identifier;
|
||||||
|
import org.pkl.core.runtime.VmBytes;
|
||||||
|
import org.pkl.core.runtime.VmClass;
|
||||||
|
import org.pkl.core.runtime.VmDataSize;
|
||||||
|
import org.pkl.core.runtime.VmDuration;
|
||||||
|
import org.pkl.core.runtime.VmDynamic;
|
||||||
|
import org.pkl.core.runtime.VmExceptionBuilder;
|
||||||
|
import org.pkl.core.runtime.VmIntSeq;
|
||||||
|
import org.pkl.core.runtime.VmLanguage;
|
||||||
|
import org.pkl.core.runtime.VmList;
|
||||||
|
import org.pkl.core.runtime.VmListing;
|
||||||
|
import org.pkl.core.runtime.VmMap;
|
||||||
|
import org.pkl.core.runtime.VmMapping;
|
||||||
|
import org.pkl.core.runtime.VmNull;
|
||||||
|
import org.pkl.core.runtime.VmPair;
|
||||||
|
import org.pkl.core.runtime.VmReference;
|
||||||
|
import org.pkl.core.runtime.VmRegex;
|
||||||
|
import org.pkl.core.runtime.VmSet;
|
||||||
|
import org.pkl.core.runtime.VmType;
|
||||||
|
import org.pkl.core.runtime.VmTyped;
|
||||||
|
import org.pkl.core.runtime.VmUtils;
|
||||||
|
import org.pkl.core.runtime.VmValue;
|
||||||
|
import org.pkl.core.stdlib.AbstractStringRenderer;
|
||||||
|
import org.pkl.core.stdlib.ExternalMethod1Node;
|
||||||
|
import org.pkl.core.stdlib.PklConverter;
|
||||||
|
import org.pkl.core.util.ArrayCharEscaper;
|
||||||
|
import org.pkl.core.util.json.JsonEscaper;
|
||||||
|
|
||||||
|
public final class RendererNodes {
|
||||||
|
// Defined here because only relevant to this class.
|
||||||
|
private static final Identifier SECONDS = Identifier.get("seconds");
|
||||||
|
private static final Identifier NANOS = Identifier.get("nanos");
|
||||||
|
|
||||||
|
private static final ArrayCharEscaper fieldNameEscaper =
|
||||||
|
ArrayCharEscaper.builder().withEscape('.', "_").withEscape('#', "_").build();
|
||||||
|
|
||||||
|
private static final StringTypeNode STRING_TYPE =
|
||||||
|
new StringTypeNode(VmUtils.unavailableSourceSection());
|
||||||
|
private static final IntTypeNode INT_TYPE = new IntTypeNode(VmUtils.unavailableSourceSection());
|
||||||
|
|
||||||
|
private RendererNodes() {}
|
||||||
|
|
||||||
|
public abstract static class renderDocument extends ExternalMethod1Node {
|
||||||
|
@Specialization
|
||||||
|
@TruffleBoundary
|
||||||
|
protected String eval(
|
||||||
|
VmTyped self, Object value, @Cached("create()") IndirectCallNode callNode) {
|
||||||
|
var builder = new StringBuilder();
|
||||||
|
createRenderer(self, builder, callNode).renderDocument(value);
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract static class renderValue extends ExternalMethod1Node {
|
||||||
|
@Specialization
|
||||||
|
@TruffleBoundary
|
||||||
|
protected String eval(
|
||||||
|
VmTyped self, Object value, @Cached("create()") IndirectCallNode callNode) {
|
||||||
|
var builder = new StringBuilder();
|
||||||
|
createRenderer(self, builder, callNode).renderValue(value);
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract static class renderType extends ExternalMethod1Node {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
@Specialization
|
||||||
|
protected String eval(VmTyped self, Object value) {
|
||||||
|
return renderType(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@TruffleBoundary
|
||||||
|
private static String renderType(Object value) {
|
||||||
|
var clazz =
|
||||||
|
value instanceof VmValue vmValue
|
||||||
|
? vmValue.getVmClass()
|
||||||
|
: value instanceof TypeNode typeNode
|
||||||
|
? typeNode.getType().getVmClass()
|
||||||
|
: value.getClass();
|
||||||
|
if (clazz == null) {
|
||||||
|
throw new VmExceptionBuilder()
|
||||||
|
.evalError("cannotResolveTypeForProtobuf")
|
||||||
|
.withProgramValue("Value", value)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
var name =
|
||||||
|
clazz instanceof VmClass vmClass
|
||||||
|
? vmClass.getSimpleName()
|
||||||
|
: ((Class<?>) clazz).getSimpleName();
|
||||||
|
|
||||||
|
return fieldNameEscaper.escape(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TruffleBoundary
|
||||||
|
private static ProtobufRenderer createRenderer(
|
||||||
|
VmTyped self, StringBuilder builder, IndirectCallNode callNode) {
|
||||||
|
var indent = (String) VmUtils.readMember(self, Identifier.INDENT, callNode);
|
||||||
|
return new ProtobufRenderer(builder, indent, PklConverter.fromRenderer(self, callNode));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class ProtobufRenderer extends AbstractStringRenderer {
|
||||||
|
private final Deque<Identifier> propertyPath = new ArrayDeque<>();
|
||||||
|
private final Deque<Boolean> wrapperRequirement = new ArrayDeque<>();
|
||||||
|
private final JsonEscaper jsonEscaper = new JsonEscaper(false);
|
||||||
|
|
||||||
|
private @Nullable TypeNode collectionType = null;
|
||||||
|
|
||||||
|
public ProtobufRenderer(StringBuilder builder, String indent, PklConverter converter) {
|
||||||
|
super("Protobuf", builder, indent, converter, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void visitDocument(Object value) {
|
||||||
|
visit(value);
|
||||||
|
startNewLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void visitTopLevelValue(Object value) {
|
||||||
|
if (value instanceof VmValue && !(value instanceof VmTyped || value instanceof VmDuration)) {
|
||||||
|
var name = value.getClass().getSimpleName();
|
||||||
|
if (name.startsWith("Vm")) {
|
||||||
|
name = name.substring(2);
|
||||||
|
}
|
||||||
|
throw new VmExceptionBuilder().evalError("invalidProtobufTopLevelValue", name).build();
|
||||||
|
}
|
||||||
|
assert propertyPath.isEmpty() && wrapperRequirement.isEmpty() : "Corrupted traversal stack.";
|
||||||
|
wrapperRequirement.push(false);
|
||||||
|
visit(value);
|
||||||
|
var wrap = wrapperRequirement.pop();
|
||||||
|
assert !wrap && propertyPath.isEmpty() && wrapperRequirement.isEmpty()
|
||||||
|
: "Corrupted traversal stack.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void visitRenderDirective(VmTyped value) {
|
||||||
|
writePropertyName();
|
||||||
|
// append verbatim
|
||||||
|
builder.append(VmUtils.readTextProperty(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void startDynamic(VmDynamic value) {
|
||||||
|
throw new VmExceptionBuilder()
|
||||||
|
.evalError("cannotRenderTypeAddConverter", "Dynamic", "Protobuf")
|
||||||
|
.withProgramValue("Value", value)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void endDynamic(VmDynamic value, boolean isEmpty) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void startTyped(VmTyped value) {
|
||||||
|
wrapperRequirement.push(false);
|
||||||
|
if (!propertyPath.isEmpty()) {
|
||||||
|
writePropertyName();
|
||||||
|
startMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void endTyped(VmTyped value, boolean isEmpty) {
|
||||||
|
var popped = wrapperRequirement.pop();
|
||||||
|
assert !popped : "Corrupted traversal stack.";
|
||||||
|
if (!propertyPath.isEmpty()) {
|
||||||
|
endMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void startListing(VmListing value) {
|
||||||
|
startWrapper();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void endListing(VmListing value, boolean isEmpty) {
|
||||||
|
endWrapper();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void startMapping(VmMapping value) {
|
||||||
|
startMaplike();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void endMapping(VmMapping value, boolean isEmpty) {
|
||||||
|
endMaplike();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startMaplike() {
|
||||||
|
if (requiresWrapper()) {
|
||||||
|
writePropertyName();
|
||||||
|
propertyPath.push(Identifier.IT);
|
||||||
|
startMessage();
|
||||||
|
}
|
||||||
|
wrapperRequirement.push(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void endMaplike() {
|
||||||
|
wrapperRequirement.pop();
|
||||||
|
if (requiresWrapper()) {
|
||||||
|
endMessage();
|
||||||
|
var popped = propertyPath.pop();
|
||||||
|
assert popped == Identifier.IT : "Corrupted traversal stack.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void startList(VmList value) {
|
||||||
|
startWrapper();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void endList(VmList value) {
|
||||||
|
endWrapper();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void startSet(VmSet value) {
|
||||||
|
startWrapper();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void endSet(VmSet value) {
|
||||||
|
endWrapper();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void startMap(VmMap value) {
|
||||||
|
startMaplike();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void endMap(VmMap value) {
|
||||||
|
endMaplike();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void visitElement(long index, Object value, boolean isFirst) {
|
||||||
|
if (requiresWrapper()) {
|
||||||
|
propertyPath.push(Identifier.IT);
|
||||||
|
}
|
||||||
|
var typeName = computeName(collectionType, value);
|
||||||
|
var addedType = false;
|
||||||
|
if (typeName != null) {
|
||||||
|
addedType = true;
|
||||||
|
writePropertyName();
|
||||||
|
startMessage();
|
||||||
|
propertyPath.push(Identifier.get("it_" + typeName));
|
||||||
|
}
|
||||||
|
wrapperRequirement.push(true);
|
||||||
|
visit(value);
|
||||||
|
var popped = wrapperRequirement.pop();
|
||||||
|
assert popped : "Corrupted traversal stack.";
|
||||||
|
if (addedType) {
|
||||||
|
propertyPath.pop();
|
||||||
|
endMessage();
|
||||||
|
}
|
||||||
|
if (requiresWrapper()) {
|
||||||
|
propertyPath.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void visitEntryKey(Object key, boolean isFirst) {
|
||||||
|
var isDirective = isRenderDirective(key);
|
||||||
|
var isValidKey =
|
||||||
|
isDirective || key instanceof Long || key instanceof Boolean || key instanceof String;
|
||||||
|
if (!isValidKey) {
|
||||||
|
throw new VmExceptionBuilder()
|
||||||
|
.evalError("cannotRenderProtobufMapKey")
|
||||||
|
.withProgramValue("Key", key)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
writePropertyName();
|
||||||
|
startMessage();
|
||||||
|
startNewLine();
|
||||||
|
builder.append("key: ");
|
||||||
|
if (isDirective) {
|
||||||
|
builder.append(VmUtils.readTextProperty(key));
|
||||||
|
} else if (key instanceof String string) {
|
||||||
|
builder.append('"').append(jsonEscaper.escape(string)).append('"');
|
||||||
|
} else {
|
||||||
|
builder.append(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void visitEntryValue(Object value) {
|
||||||
|
propertyPath.push(Identifier.VALUE);
|
||||||
|
visit(value);
|
||||||
|
propertyPath.pop();
|
||||||
|
endMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private @Nullable String computeName(@Nullable TypeNode it, Object value) {
|
||||||
|
if (it instanceof UnionTypeNode unionTypeNode) {
|
||||||
|
for (var type : unionTypeNode.getElementTypeNodes()) {
|
||||||
|
if (type instanceof UnionTypeNode) {
|
||||||
|
var computedName = computeName(type, value);
|
||||||
|
if (computedName != null) {
|
||||||
|
return computedName;
|
||||||
|
}
|
||||||
|
} else if (type instanceof NonFinalClassTypeNode) {
|
||||||
|
var clazz = type.getType().getVmClass();
|
||||||
|
if (value instanceof VmValue vmValue) {
|
||||||
|
if (clazz == vmValue.getVmClass()) {
|
||||||
|
return clazz.getSimpleName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
type.execute(VmUtils.createEmptyMaterializedFrame(), value);
|
||||||
|
} catch (VmTypeMismatchException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return renderType(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void visitProperty(Identifier name, Object value, boolean isFirst) {
|
||||||
|
var hasWrapper = false;
|
||||||
|
var hasCollection = false;
|
||||||
|
var prevCollectionType = collectionType;
|
||||||
|
Identifier expectedName = null;
|
||||||
|
propertyPath.push(name);
|
||||||
|
if (enclosingValue instanceof VmTyped) {
|
||||||
|
var clazz = value instanceof VmValue vmValue ? vmValue.getVmClass() : value.getClass();
|
||||||
|
// Compute the name of the field in the wrapper, based on the type, but only if a wrapper
|
||||||
|
// is required.
|
||||||
|
var optionalType =
|
||||||
|
Optional.of(name)
|
||||||
|
.map(enclosingValue.getVmClass()::getProperty)
|
||||||
|
.map(ClassProperty::getTypeNode)
|
||||||
|
.map(PropertyTypeNode::getTypeNode)
|
||||||
|
.map(this::resolveType);
|
||||||
|
if (optionalType.isPresent()) {
|
||||||
|
var type = optionalType.get();
|
||||||
|
var computedName = computeName(type, value);
|
||||||
|
if (computedName != null) {
|
||||||
|
hasWrapper = true;
|
||||||
|
writePropertyName();
|
||||||
|
expectedName = Identifier.get("it_" + computedName);
|
||||||
|
propertyPath.push(expectedName);
|
||||||
|
startMessage();
|
||||||
|
} else if (type instanceof ListingOrMappingTypeNode listingOrMappingType) {
|
||||||
|
hasCollection = true;
|
||||||
|
collectionType = listingOrMappingType.getValueTypeNode();
|
||||||
|
} else if (type instanceof ListTypeNode listType) {
|
||||||
|
hasCollection = true;
|
||||||
|
collectionType = listType.getElementTypeNode();
|
||||||
|
} else if (type instanceof MapTypeNode mapType) {
|
||||||
|
hasCollection = true;
|
||||||
|
collectionType = mapType.getValueTypeNode();
|
||||||
|
} else if (type instanceof SetTypeNode setType) {
|
||||||
|
hasCollection = true;
|
||||||
|
collectionType = setType.getElementTypeNode();
|
||||||
|
} else if (type instanceof NonFinalClassTypeNode) {
|
||||||
|
if (type.getType().getVmClass() != clazz) {
|
||||||
|
throw new VmExceptionBuilder()
|
||||||
|
.evalError("cannotRenderSubtypeForProtobuf", type.getType().getVmClass(), clazz)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
visit(value);
|
||||||
|
if (hasWrapper) {
|
||||||
|
endMessage();
|
||||||
|
var popped = propertyPath.pop();
|
||||||
|
assert popped == expectedName : "Corrupted traversal stack.";
|
||||||
|
} else if (hasCollection) {
|
||||||
|
collectionType = prevCollectionType;
|
||||||
|
}
|
||||||
|
var popped = propertyPath.pop();
|
||||||
|
assert name == popped : "Corrupted traversal stack.";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startNewLine() {
|
||||||
|
if (indent.isEmpty() || builder.isEmpty() || builder.charAt(builder.length() - 1) == '\n')
|
||||||
|
return;
|
||||||
|
|
||||||
|
builder.append('\n');
|
||||||
|
builder.append(currIndent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startWrapper() {
|
||||||
|
if (requiresWrapper()) {
|
||||||
|
writePropertyName();
|
||||||
|
startMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void endWrapper() {
|
||||||
|
if (requiresWrapper()) {
|
||||||
|
endMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean requiresWrapper() {
|
||||||
|
var result = wrapperRequirement.peek();
|
||||||
|
assert result != null : "Corrupted traversal stack.";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startMessage() {
|
||||||
|
builder.append('{');
|
||||||
|
increaseIndent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void endMessage() {
|
||||||
|
decreaseIndent();
|
||||||
|
if (builder.charAt(builder.length() - 1) != '{') {
|
||||||
|
startNewLine();
|
||||||
|
}
|
||||||
|
builder.append('}');
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writePropertyName() {
|
||||||
|
if (propertyPath.isEmpty()) return;
|
||||||
|
startNewLine();
|
||||||
|
var name = propertyPath.peek();
|
||||||
|
assert name != null : "Corrupted traversal stack.";
|
||||||
|
builder.append(name);
|
||||||
|
builder.append(": ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitString(String value) {
|
||||||
|
writePropertyName();
|
||||||
|
builder.append('"').append(jsonEscaper.escape(value)).append('"');
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitBoolean(Boolean value) {
|
||||||
|
writePropertyName();
|
||||||
|
builder.append(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitInt(Long value) {
|
||||||
|
writePropertyName();
|
||||||
|
builder.append(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitFloat(Double value) {
|
||||||
|
writePropertyName();
|
||||||
|
builder.append(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitDuration(VmDuration value) {
|
||||||
|
writePropertyName();
|
||||||
|
var nanos = (long) value.convertTo(DurationUnit.NANOS).getValue() % 1000000000;
|
||||||
|
var seconds = (long) Math.floor(value.convertTo(DurationUnit.SECONDS).getValue());
|
||||||
|
startMessage();
|
||||||
|
|
||||||
|
propertyPath.push(SECONDS);
|
||||||
|
writePropertyName();
|
||||||
|
builder.append(seconds);
|
||||||
|
propertyPath.pop();
|
||||||
|
|
||||||
|
propertyPath.push(NANOS);
|
||||||
|
writePropertyName();
|
||||||
|
builder.append(nanos);
|
||||||
|
propertyPath.pop();
|
||||||
|
|
||||||
|
endMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitDataSize(VmDataSize value) {
|
||||||
|
throw new VmExceptionBuilder()
|
||||||
|
.evalError("cannotRenderTypeAddConverter", "DataSize", "Protobuf")
|
||||||
|
.withProgramValue("Value", value)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitBytes(VmBytes value) {
|
||||||
|
throw new VmExceptionBuilder()
|
||||||
|
.evalError("cannotRenderTypeAddConverter", "Bytes", "Protobuf")
|
||||||
|
.withProgramValue("Value", value)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitIntSeq(VmIntSeq value) {
|
||||||
|
writePropertyName();
|
||||||
|
builder.append(value.toPklString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitPair(VmPair value) {
|
||||||
|
writePropertyName();
|
||||||
|
builder.append(value.toPklString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitRegex(VmRegex value) {
|
||||||
|
writePropertyName();
|
||||||
|
builder.append(value.toPklString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitNull(VmNull value) {
|
||||||
|
writePropertyName();
|
||||||
|
builder.append(value.toPklString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitReference(VmReference value) {
|
||||||
|
writePropertyName();
|
||||||
|
builder.append(value.toPklString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves types for the purpose of protobuf rendering. "Sees through" nullable types and type
|
||||||
|
* aliases, simplifies variations of {@code Int} and {@code String} types (literate string
|
||||||
|
* types, {@code (U)Int_X_} type aliases, etc.), and checks that map key types are legal for
|
||||||
|
* protobuf.
|
||||||
|
*/
|
||||||
|
// TODO: Memoize?
|
||||||
|
private @Nullable TypeNode resolveType(@Nullable TypeNode type) {
|
||||||
|
if (type instanceof IntTypeNode
|
||||||
|
|| type instanceof StringTypeNode
|
||||||
|
|| type instanceof BooleanTypeNode) {
|
||||||
|
return type;
|
||||||
|
} else if (type instanceof IntSlotTypeNode) {
|
||||||
|
return INT_TYPE;
|
||||||
|
} else if (type instanceof UnionOfStringLiteralsTypeNode
|
||||||
|
|| type instanceof StringLiteralTypeNode) {
|
||||||
|
return STRING_TYPE;
|
||||||
|
} else if (type instanceof NullableTypeNode nullableType) {
|
||||||
|
return resolveType(nullableType.getElementTypeNode());
|
||||||
|
} else if (type instanceof TypeAliasTypeNode typeAliasType) {
|
||||||
|
return resolveType(
|
||||||
|
((VmType.AliasType) typeAliasType.getType()).getVmTypeAlias().getTypeNode());
|
||||||
|
} else if (type instanceof ListingTypeNode listingType) {
|
||||||
|
var valueType = resolveType(listingType.getValueTypeNode());
|
||||||
|
assert valueType != null : "Failed to resolve type node.";
|
||||||
|
|
||||||
|
type =
|
||||||
|
requiresWrapper()
|
||||||
|
? null
|
||||||
|
: new ListingTypeNode(
|
||||||
|
VmUtils.unavailableSourceSection(), VmLanguage.get(null), valueType);
|
||||||
|
return type;
|
||||||
|
} else if (type instanceof MappingTypeNode mappingType) {
|
||||||
|
var keyType = resolveType(mappingType.getKeyTypeNode());
|
||||||
|
if (!(keyType instanceof IntTypeNode
|
||||||
|
|| keyType instanceof StringTypeNode
|
||||||
|
|| keyType instanceof BooleanTypeNode)) {
|
||||||
|
throw new VmExceptionBuilder()
|
||||||
|
.evalError("cannotRenderProtobufMapKeyType")
|
||||||
|
.withSourceSection(type.getSourceSection())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
var valueType = resolveType(mappingType.getValueTypeNode());
|
||||||
|
assert valueType != null : "Incomplete or malformed Mapping type";
|
||||||
|
mappingType =
|
||||||
|
new MappingTypeNode(
|
||||||
|
VmUtils.unavailableSourceSection(), VmLanguage.get(null), keyType, valueType);
|
||||||
|
|
||||||
|
type = requiresWrapper() ? null : mappingType;
|
||||||
|
return type;
|
||||||
|
} else if (type instanceof UnionTypeNode) {
|
||||||
|
// Some non-obvious normalization going on here:
|
||||||
|
// - A union type resolves to a union type, unless all element types are string or string
|
||||||
|
// literal types.
|
||||||
|
// - All element types are resolved also.
|
||||||
|
// - All string literal types are combined into a single String case.
|
||||||
|
var hasString = false;
|
||||||
|
var elements = new ArrayList<@Nullable TypeNode>();
|
||||||
|
for (var t : ((UnionTypeNode) type).getElementTypeNodes()) {
|
||||||
|
var resolved = resolveType(t);
|
||||||
|
if (resolved instanceof StringLiteralTypeNode || resolved instanceof StringTypeNode) {
|
||||||
|
if (!hasString) {
|
||||||
|
hasString = true;
|
||||||
|
elements.add(new StringTypeNode(VmUtils.unavailableSourceSection()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
elements.add(resolved);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Sort classes with lowest-in-hierarchy first, to correctly derive names for oneOf.
|
||||||
|
elements.sort(
|
||||||
|
(o1, o2) -> {
|
||||||
|
if (o1 instanceof ObjectSlotTypeNode && o2 instanceof ObjectSlotTypeNode) {
|
||||||
|
var t1 = o1.getType().getVmClass();
|
||||||
|
var t2 = o2.getType().getVmClass();
|
||||||
|
if (t1 == null || t2 == null) return 0;
|
||||||
|
return t1.isSubclassOf(t2) ? -1 : t2.isSubclassOf(t1) ? 1 : 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
type =
|
||||||
|
hasString && elements.size() == 1
|
||||||
|
? elements.get(0)
|
||||||
|
: new UnionTypeNodeExploded(
|
||||||
|
VmUtils.unavailableSourceSection(), -1, elements.toArray(new TypeNode[0]));
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
@NullMarked
|
||||||
|
package org.pkl.core.stdlib.protobuf;
|
||||||
|
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
@@ -619,6 +619,12 @@ Cannot render map with non-scalar key as {0}.
|
|||||||
cannotRenderObjectWithNonScalarKey=\
|
cannotRenderObjectWithNonScalarKey=\
|
||||||
Cannot render object with non-scalar key as {0}.
|
Cannot render object with non-scalar key as {0}.
|
||||||
|
|
||||||
|
cannotRenderProtobufMapKey=\
|
||||||
|
Cannot render map with a non-scalar, floating point or byte array key.
|
||||||
|
|
||||||
|
cannotRenderProtobufMapKeyType=\
|
||||||
|
Cannot render map with a non-scalar, floating point or byte array key type.
|
||||||
|
|
||||||
cannotRenderObjectWithElementsAndOtherMembers=\
|
cannotRenderObjectWithElementsAndOtherMembers=\
|
||||||
Cannot render object with both elements and properties/entries as {0}.
|
Cannot render object with both elements and properties/entries as {0}.
|
||||||
|
|
||||||
@@ -753,6 +759,17 @@ The top-level value of an XML property list must have type `Typed`, `Dynamic`, `
|
|||||||
invalidPropertiesTopLevelValue=\
|
invalidPropertiesTopLevelValue=\
|
||||||
The top-level value of a Java properties file must have type `Typed`, `Dynamic`, `Mapping`, or `Map`, but got type `{0}`.
|
The top-level value of a Java properties file must have type `Typed`, `Dynamic`, `Mapping`, or `Map`, but got type `{0}`.
|
||||||
|
|
||||||
|
invalidProtobufTopLevelValue=\
|
||||||
|
The top-level value of a protobuf file must have type `Typed`, but got type `{0}`.
|
||||||
|
|
||||||
|
cannotResolveTypeForProtobuf=\
|
||||||
|
Failed to resolve type required for rendering protobuf.\n\
|
||||||
|
\n\
|
||||||
|
Consider adding a type annotation.
|
||||||
|
|
||||||
|
cannotRenderSubtypeForProtobuf=\
|
||||||
|
Cannot render subtype {0} of specified type {1} in protobuf.
|
||||||
|
|
||||||
cannotExportValue=\
|
cannotExportValue=\
|
||||||
A value of type `{0}` cannot be exported.
|
A value of type `{0}` cannot be exported.
|
||||||
|
|
||||||
|
|||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
typealias MyModule = module
|
||||||
@@ -0,0 +1,265 @@
|
|||||||
|
amends "../snippetTest.pkl"
|
||||||
|
|
||||||
|
import "pkl:protobuf"
|
||||||
|
|
||||||
|
local renderer = new protobuf.Renderer {}
|
||||||
|
local function renderValue(it: Any): String =
|
||||||
|
renderer.renderValue(it)
|
||||||
|
|
||||||
|
/// For testing inheritance; [Foo] is the _base_ class.
|
||||||
|
local open class Foo {
|
||||||
|
foo: String
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For testing inheritance; [Bar] is the _derived_ class.
|
||||||
|
local class Bar extends Foo {
|
||||||
|
foo = "Bar"
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For testing the rendering of types inside a `VmTyped`.
|
||||||
|
local class Baz {
|
||||||
|
foo: Foo
|
||||||
|
bar: Bar
|
||||||
|
foos: Listing<Foo>
|
||||||
|
bars: Mapping<String, Bar>
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For testing how rendering deals with _annotated_ (outer) collection types.
|
||||||
|
local class CollectionTypes {
|
||||||
|
emptyList: List<Foo>
|
||||||
|
list: List<Foo> = List(new Bar {}, new Foo { foo = "test foo" })
|
||||||
|
emptyListing: Listing<Foo>
|
||||||
|
listing: Listing<Foo> = new {
|
||||||
|
new Bar { foo = "listing bar" }
|
||||||
|
new Foo { foo = "listing foo" }
|
||||||
|
}
|
||||||
|
emptyMap: Map<Int, String>
|
||||||
|
map: Map<Int, Foo> = Map(
|
||||||
|
1, new Bar { foo = "first" },
|
||||||
|
2, new Foo { foo = "second" }
|
||||||
|
)
|
||||||
|
emptyMapping: Mapping<Int, Bar>
|
||||||
|
mapping: String =
|
||||||
|
module.catch(() ->
|
||||||
|
renderValue(new Mapping<Foo, Bar> {
|
||||||
|
[new Foo { foo = "key foo" }] = new Bar { foo = "value bar" }
|
||||||
|
})
|
||||||
|
)
|
||||||
|
emptySet: Set<Foo>
|
||||||
|
set: Set<Foo> = Set(
|
||||||
|
new Bar { foo = "setOne" },
|
||||||
|
new Bar { foo = "setTwo" }
|
||||||
|
)
|
||||||
|
mappingWithUnannotatedValueType: Mapping<String, Listing> = new {
|
||||||
|
["some"] {
|
||||||
|
new Bar {}
|
||||||
|
new Bar {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For testing _admissable_ mapping key types.
|
||||||
|
local class MappingKeys {
|
||||||
|
string: Mapping<String, Bar>
|
||||||
|
long: Mapping<Int, Bar>
|
||||||
|
int: Mapping<Int32, Bar>
|
||||||
|
short: Mapping<Int16, Bar>
|
||||||
|
boolean: Mapping<Boolean, Bar>
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For testing that using _inadmissable_ mapping key types does indeed throw.
|
||||||
|
local class InvalidMappingKey {
|
||||||
|
foo: Mapping<Bar, Bar>
|
||||||
|
}
|
||||||
|
|
||||||
|
local typealias StringLiteralUnion
|
||||||
|
= *"Qux"
|
||||||
|
| "quux"
|
||||||
|
| "QUUX"
|
||||||
|
|
||||||
|
local typealias OpenEndedStringUnion
|
||||||
|
= *"corge"
|
||||||
|
| String // Not a union of string literals, although fully String-y.
|
||||||
|
|
||||||
|
local typealias HeterogeneousUnion
|
||||||
|
= "Grault"
|
||||||
|
| "GRAULT"
|
||||||
|
| Int
|
||||||
|
| Foo
|
||||||
|
|
||||||
|
local typealias SynonymPureEnum = StringLiteralUnion
|
||||||
|
|
||||||
|
local class TypeAliasBehavior {
|
||||||
|
doubleAlias: SynonymPureEnum
|
||||||
|
}
|
||||||
|
|
||||||
|
local class StringLiteralUnionBehavior {
|
||||||
|
theProperty: StringLiteralUnion
|
||||||
|
}
|
||||||
|
|
||||||
|
local class OpenEndedStringUnionBehavior {
|
||||||
|
theProperty: OpenEndedStringUnion
|
||||||
|
}
|
||||||
|
|
||||||
|
local class HeterogeneousUnionBehavior {
|
||||||
|
theHeterogeneousUnion: Listing<HeterogeneousUnion>
|
||||||
|
}
|
||||||
|
|
||||||
|
local class HeterogeneousUnionBehaviorX {
|
||||||
|
theHeterogeneousUnion: HeterogeneousUnion
|
||||||
|
}
|
||||||
|
|
||||||
|
local class InvalidUnionBehavior {
|
||||||
|
myMapping: Mapping<HeterogeneousUnion, Int> = new {
|
||||||
|
[5] = 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local class DynamicBehavior {
|
||||||
|
myDynamic: Dynamic
|
||||||
|
}
|
||||||
|
|
||||||
|
local class DurationBehavior {
|
||||||
|
myDuration: Duration = 42.ns
|
||||||
|
}
|
||||||
|
|
||||||
|
local class DataSizeBehavior {
|
||||||
|
myDataSize: DataSize
|
||||||
|
}
|
||||||
|
|
||||||
|
local class SubtypingBehavior {
|
||||||
|
myFoo: Foo
|
||||||
|
myFooOrBar: (Foo|Bar)?
|
||||||
|
}
|
||||||
|
|
||||||
|
examples {
|
||||||
|
["Rendering primitive values"] {
|
||||||
|
for (v in new Listing {
|
||||||
|
true
|
||||||
|
false
|
||||||
|
|
||||||
|
-42 as Int8
|
||||||
|
-42 as Int16
|
||||||
|
-42 as Int32
|
||||||
|
-42 as Int
|
||||||
|
|
||||||
|
42 as UInt8
|
||||||
|
42 as UInt16
|
||||||
|
42 as UInt32
|
||||||
|
42 as UInt
|
||||||
|
|
||||||
|
-13.37 as Float
|
||||||
|
|
||||||
|
-13.37 as Number
|
||||||
|
13.37 as Number
|
||||||
|
-42 as Number
|
||||||
|
42 as Number
|
||||||
|
|
||||||
|
"Hello world"
|
||||||
|
|
||||||
|
10.min
|
||||||
|
2.ms
|
||||||
|
120.ns
|
||||||
|
5.s + 120.ns
|
||||||
|
}) {
|
||||||
|
renderValue(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
["Collection types"] {
|
||||||
|
renderValue(new CollectionTypes {})
|
||||||
|
}
|
||||||
|
|
||||||
|
["Typed objects rendered as protobuf.ProtoMessage"] {
|
||||||
|
renderValue(new Foo { foo = "new" })
|
||||||
|
renderValue(new Bar {})
|
||||||
|
renderValue(new Bar { foo = "Baz" })
|
||||||
|
renderValue(
|
||||||
|
new Baz {
|
||||||
|
foo {
|
||||||
|
foo = "FOO"
|
||||||
|
}
|
||||||
|
foos {
|
||||||
|
foo
|
||||||
|
outer.bar
|
||||||
|
}
|
||||||
|
bars {
|
||||||
|
["default"] {}
|
||||||
|
["amended"] {
|
||||||
|
foo = "Bars"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
renderValue(new DurationBehavior {})
|
||||||
|
}
|
||||||
|
|
||||||
|
["Unsupported types"] {
|
||||||
|
module.catch(() -> throw(renderValue(new DynamicBehavior {})))
|
||||||
|
module.catch(() -> throw(renderValue(new DataSizeBehavior { myDataSize = 10.kb })))
|
||||||
|
}
|
||||||
|
|
||||||
|
["Types not supported at top-level"] {
|
||||||
|
module.catch(() -> throw(renderValue(Map(3,4))))
|
||||||
|
module.catch(() -> throw(renderValue(new Mapping {[1] = 2})))
|
||||||
|
}
|
||||||
|
|
||||||
|
["Keys in maps"] {
|
||||||
|
renderValue(new MappingKeys {
|
||||||
|
string {
|
||||||
|
["Hello world"] {}
|
||||||
|
}
|
||||||
|
long {
|
||||||
|
[1337] {}
|
||||||
|
}
|
||||||
|
int {
|
||||||
|
[42] {}
|
||||||
|
}
|
||||||
|
short {
|
||||||
|
[1] {}
|
||||||
|
}
|
||||||
|
boolean {
|
||||||
|
[false] {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
module.catch(() -> throw(renderValue(new InvalidMappingKey {
|
||||||
|
foo {
|
||||||
|
[new Bar {}] {}
|
||||||
|
}
|
||||||
|
})))
|
||||||
|
}
|
||||||
|
|
||||||
|
["typealiases"] {
|
||||||
|
renderValue(new TypeAliasBehavior {})
|
||||||
|
}
|
||||||
|
|
||||||
|
["unions"] {
|
||||||
|
renderValue(new StringLiteralUnionBehavior {})
|
||||||
|
renderValue(new OpenEndedStringUnionBehavior {})
|
||||||
|
renderValue(new HeterogeneousUnionBehaviorX {
|
||||||
|
theHeterogeneousUnion = "Grault"
|
||||||
|
})
|
||||||
|
renderValue(new HeterogeneousUnionBehavior {
|
||||||
|
theHeterogeneousUnion {
|
||||||
|
"Grault"
|
||||||
|
0
|
||||||
|
new Bar {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
module.catch(() -> renderValue(new InvalidUnionBehavior {}))
|
||||||
|
}
|
||||||
|
["subtypes"] {
|
||||||
|
renderValue(new SubtypingBehavior {
|
||||||
|
myFoo = new Foo { foo = "renders" }
|
||||||
|
})
|
||||||
|
module.catch(() ->
|
||||||
|
renderValue(new SubtypingBehavior {
|
||||||
|
myFoo = new Bar { foo = "shouldn't render" }
|
||||||
|
})
|
||||||
|
)
|
||||||
|
renderValue(new SubtypingBehavior {
|
||||||
|
myFoo = new Foo { foo = "renders" }
|
||||||
|
myFooOrBar = new Bar { foo = "also renders" }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
amends "../snippetTest.pkl"
|
||||||
|
|
||||||
|
import "pkl:protobuf"
|
||||||
|
|
||||||
|
local renderer = new protobuf.Renderer {}
|
||||||
|
|
||||||
|
local class NestedStructures {
|
||||||
|
plainString: String = "plain string"
|
||||||
|
nestedListing: Listing<Listing<String>>
|
||||||
|
nestedListing2: Listing<Listing<Listing<Listing<String>>>>
|
||||||
|
nestedMapping: Mapping<String, Mapping<Int, Boolean>>
|
||||||
|
listingInMapping: Mapping<String, Listing<String>>
|
||||||
|
mappingInListing: Listing<Mapping<Int, Boolean>>
|
||||||
|
nestedList: List<List<String>>
|
||||||
|
nestedMap: Map<String, Map<Int, Boolean>>
|
||||||
|
}
|
||||||
|
|
||||||
|
examples {
|
||||||
|
["some"] {
|
||||||
|
renderer.renderDocument(new NestedStructures {
|
||||||
|
nestedListing {
|
||||||
|
new {
|
||||||
|
"foo"
|
||||||
|
"bar"
|
||||||
|
}
|
||||||
|
new {
|
||||||
|
"baz"
|
||||||
|
"qux"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nestedListing2 {
|
||||||
|
new {
|
||||||
|
new {
|
||||||
|
new {
|
||||||
|
"foo"
|
||||||
|
"bar"
|
||||||
|
"baz"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nestedMapping {
|
||||||
|
["quux"] {
|
||||||
|
[42] = true
|
||||||
|
[1337] = false
|
||||||
|
}
|
||||||
|
["corge"] {
|
||||||
|
[0] = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
listingInMapping {
|
||||||
|
["grault"] {
|
||||||
|
"grault1"
|
||||||
|
"grault2"
|
||||||
|
}
|
||||||
|
["garply"] {
|
||||||
|
"garply1"
|
||||||
|
}
|
||||||
|
["waldo"] {}
|
||||||
|
}
|
||||||
|
mappingInListing {
|
||||||
|
new {
|
||||||
|
[-1] = false
|
||||||
|
[1] = true
|
||||||
|
}
|
||||||
|
new {
|
||||||
|
[-2] = true
|
||||||
|
[2] = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nestedList = List(List("pigeon", "plugh"), List(), List("xyzzy"))
|
||||||
|
nestedMap = Map("thud", Map(), "wibble", Map(1, false, 2, true), "wobble", Map(0, false))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import "pkl:protobuf"
|
||||||
|
|
||||||
|
import ".../input-helper/api/annotationConverter.pkl"
|
||||||
|
|
||||||
|
class Comment extends Annotation
|
||||||
|
|
||||||
|
@protobuf.Property { name = "FOO" }
|
||||||
|
foo: String = "a"
|
||||||
|
|
||||||
|
@annotationConverter.LineComment { text = "bar" }
|
||||||
|
bar: String = "b"
|
||||||
|
|
||||||
|
baz: Nested
|
||||||
|
|
||||||
|
class Nested {
|
||||||
|
@annotationConverter.LineComment { text = "qux" }
|
||||||
|
qux: String = "c"
|
||||||
|
|
||||||
|
quux: String = "c"
|
||||||
|
}
|
||||||
|
|
||||||
|
output {
|
||||||
|
renderer = new protobuf.Renderer {
|
||||||
|
convertPropertyTransformers {
|
||||||
|
[annotationConverter.LineComment] { prefix = " # " }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ amends ".../snippetTest.pkl"
|
|||||||
|
|
||||||
import "pkl:xml"
|
import "pkl:xml"
|
||||||
import "pkl:jsonnet"
|
import "pkl:jsonnet"
|
||||||
|
import "pkl:protobuf"
|
||||||
|
|
||||||
examples {
|
examples {
|
||||||
for (format, renderer in new Mapping {
|
for (format, renderer in new Mapping {
|
||||||
@@ -10,6 +11,7 @@ examples {
|
|||||||
["jsonnet"] = new jsonnet.Renderer {}
|
["jsonnet"] = new jsonnet.Renderer {}
|
||||||
["plist"] = new PListRenderer {}
|
["plist"] = new PListRenderer {}
|
||||||
["properties"] = new PropertiesRenderer {}
|
["properties"] = new PropertiesRenderer {}
|
||||||
|
["textproto"] = new protobuf.Renderer {}
|
||||||
["xml"] = new xml.Renderer {}
|
["xml"] = new xml.Renderer {}
|
||||||
["yaml"] = new YamlRenderer {}
|
["yaml"] = new YamlRenderer {}
|
||||||
}) {
|
}) {
|
||||||
@@ -21,6 +23,9 @@ examples {
|
|||||||
listing = null
|
listing = null
|
||||||
mapping = null
|
mapping = null
|
||||||
}
|
}
|
||||||
|
when (format == "textproto") {
|
||||||
|
dynamic = null
|
||||||
|
}
|
||||||
})
|
})
|
||||||
renderer.renderDocument(new RenderDirective { text = #"✅\❌ /-#;)<>"# })
|
renderer.renderDocument(new RenderDirective { text = #"✅\❌ /-#;)<>"# })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,13 @@ amends ".../snippetTest.pkl"
|
|||||||
|
|
||||||
import "pkl:xml"
|
import "pkl:xml"
|
||||||
import "pkl:jsonnet"
|
import "pkl:jsonnet"
|
||||||
|
import "pkl:protobuf"
|
||||||
|
|
||||||
|
local class TypedTestCase {
|
||||||
|
property: String
|
||||||
|
elements: Listing<String>
|
||||||
|
entries: Mapping<String, String>
|
||||||
|
}
|
||||||
|
|
||||||
examples {
|
examples {
|
||||||
for (format, renderer in new Mapping {
|
for (format, renderer in new Mapping {
|
||||||
@@ -19,6 +26,16 @@ examples {
|
|||||||
[Listing] = (it: Listing) -> it.join(",")
|
[Listing] = (it: Listing) -> it.join(",")
|
||||||
}
|
}
|
||||||
} |> converters
|
} |> converters
|
||||||
|
["textproto"] = new protobuf.Renderer {
|
||||||
|
converters {
|
||||||
|
[Dynamic] = (it) ->
|
||||||
|
(it) {
|
||||||
|
elements = it.elements.toList().toListing()
|
||||||
|
entries = it.entries.toMap().toMapping()
|
||||||
|
}.toTyped(TypedTestCase)
|
||||||
|
[String] = (it) -> new RenderDirective { text = "(\(it))"}
|
||||||
|
}
|
||||||
|
}
|
||||||
["xml"] = new xml.Renderer {} |> converters
|
["xml"] = new xml.Renderer {} |> converters
|
||||||
["yaml"] = new YamlRenderer {} |> converters
|
["yaml"] = new YamlRenderer {} |> converters
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
+22
@@ -18,8 +18,26 @@ res6a: module = res6[0]
|
|||||||
|
|
||||||
function fun(m: module): List<module> = List((m) { x = 2 })
|
function fun(m: module): List<module> = List((m) { x = 2 })
|
||||||
|
|
||||||
|
class Bad {
|
||||||
|
res7: module = "abc"
|
||||||
|
|
||||||
|
res8: module = new Person {}
|
||||||
|
|
||||||
|
res9: module? = new Person {}
|
||||||
|
|
||||||
|
res10: List<module> = List(new Person {})
|
||||||
|
}
|
||||||
|
|
||||||
class Person
|
class Person
|
||||||
|
|
||||||
|
res7 = test.catch(() -> new Bad {}.res7)
|
||||||
|
|
||||||
|
res8 = test.catch(() -> new Bad {}.res8)
|
||||||
|
|
||||||
|
res9 = test.catch(() -> new Bad {}.res9)
|
||||||
|
|
||||||
|
res10 = test.catch(() -> new Bad {}.res10)
|
||||||
|
|
||||||
output {
|
output {
|
||||||
// force eval but don't render to prevent recursion
|
// force eval but don't render to prevent recursion
|
||||||
value =
|
value =
|
||||||
@@ -30,5 +48,9 @@ output {
|
|||||||
let (r5 = res5)
|
let (r5 = res5)
|
||||||
let (r6 = res6)
|
let (r6 = res6)
|
||||||
let (r6a = res6a)
|
let (r6a = res6a)
|
||||||
|
let (r7 = res7)
|
||||||
|
let (r8 = res8)
|
||||||
|
let (r9 = res9)
|
||||||
|
let (r10 = res10)
|
||||||
new Dynamic { result = "ok" }
|
new Dynamic { result = "ok" }
|
||||||
}
|
}
|
||||||
+22
@@ -20,8 +20,26 @@ res6a: module = res6[0]
|
|||||||
|
|
||||||
function fun(m: module): List<module> = List((m) { x = 2 })
|
function fun(m: module): List<module> = List((m) { x = 2 })
|
||||||
|
|
||||||
|
class Bad {
|
||||||
|
res7: module = "abc"
|
||||||
|
|
||||||
|
res8: module = new Person {}
|
||||||
|
|
||||||
|
res9: module? = new Person {}
|
||||||
|
|
||||||
|
res10: List<module> = List(new Person {})
|
||||||
|
}
|
||||||
|
|
||||||
class Person
|
class Person
|
||||||
|
|
||||||
|
res7 = test.catch(() -> new Bad {}.res7)
|
||||||
|
|
||||||
|
res8 = test.catch(() -> new Bad {}.res8)
|
||||||
|
|
||||||
|
res9 = test.catch(() -> new Bad {}.res9)
|
||||||
|
|
||||||
|
res10 = test.catch(() -> new Bad {}.res10)
|
||||||
|
|
||||||
output {
|
output {
|
||||||
// force eval but don't render to prevent recursion
|
// force eval but don't render to prevent recursion
|
||||||
value =
|
value =
|
||||||
@@ -32,5 +50,9 @@ output {
|
|||||||
let (r5 = res5)
|
let (r5 = res5)
|
||||||
let (r6 = res6)
|
let (r6 = res6)
|
||||||
let (r6a = res6a)
|
let (r6a = res6a)
|
||||||
|
let (r7 = res7)
|
||||||
|
let (r8 = res8)
|
||||||
|
let (r9 = res9)
|
||||||
|
let (r10 = res10)
|
||||||
new Dynamic { result = "ok" }
|
new Dynamic { result = "ok" }
|
||||||
}
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
typealias Foo = module
|
||||||
|
|
||||||
|
@Baz { valid = true is module }
|
||||||
|
class Bar {
|
||||||
|
baz: module
|
||||||
|
}
|
||||||
|
|
||||||
|
class Baz extends Annotation {
|
||||||
|
valid: Boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const qux = true is module
|
||||||
|
const function quux() = true is module
|
||||||
|
|
||||||
|
const corge = new {
|
||||||
|
grault {
|
||||||
|
garply = true is module
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hidden const waldo = (x: module) -> true
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
typealias Foo = module
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
@Baz { valid = true is module }
|
|
||||||
class Bar
|
|
||||||
|
|
||||||
class Baz extends Annotation {
|
|
||||||
valid: Boolean
|
|
||||||
}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
class Bar {
|
|
||||||
baz: module
|
|
||||||
}
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
const qux = true is module
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
const function quux() = true is module
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
const corge = new {
|
|
||||||
grault {
|
|
||||||
garply = true is module
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
hidden const waldo = (x: module) -> true
|
|
||||||
+2
@@ -4,6 +4,8 @@ import ".../input-helper/types/moduleTypeProperty.pkl"
|
|||||||
|
|
||||||
class ModuleSubclass extends moduleTypeProperty {
|
class ModuleSubclass extends moduleTypeProperty {
|
||||||
x = 2
|
x = 2
|
||||||
|
hidden mod2: module
|
||||||
|
mod2x = mod2.x
|
||||||
}
|
}
|
||||||
|
|
||||||
x = -1
|
x = -1
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import "../../input-helper/types/typeAliasModule.pkl"
|
||||||
|
|
||||||
|
res: typeAliasModule = module
|
||||||
@@ -0,0 +1,214 @@
|
|||||||
|
examples {
|
||||||
|
["Rendering primitive values"] {
|
||||||
|
"true"
|
||||||
|
"false"
|
||||||
|
"-42"
|
||||||
|
"-42"
|
||||||
|
"-42"
|
||||||
|
"-42"
|
||||||
|
"42"
|
||||||
|
"42"
|
||||||
|
"42"
|
||||||
|
"42"
|
||||||
|
"-13.37"
|
||||||
|
"-13.37"
|
||||||
|
"13.37"
|
||||||
|
"-42"
|
||||||
|
"42"
|
||||||
|
"\"Hello world\""
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
seconds: 600
|
||||||
|
nanos: 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
seconds: 0
|
||||||
|
nanos: 2000000
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
seconds: 0
|
||||||
|
nanos: 120
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
seconds: 5
|
||||||
|
nanos: 120
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
["Collection types"] {
|
||||||
|
"""
|
||||||
|
list: {
|
||||||
|
foo: "Bar"
|
||||||
|
}
|
||||||
|
list: {
|
||||||
|
foo: "test foo"
|
||||||
|
}
|
||||||
|
listing: {
|
||||||
|
foo: "listing bar"
|
||||||
|
}
|
||||||
|
listing: {
|
||||||
|
foo: "listing foo"
|
||||||
|
}
|
||||||
|
map: {
|
||||||
|
key: 1
|
||||||
|
value: {
|
||||||
|
foo: "first"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map: {
|
||||||
|
key: 2
|
||||||
|
value: {
|
||||||
|
foo: "second"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mapping: "Cannot call method `renderValue` from here because it is not `const`."
|
||||||
|
set: {
|
||||||
|
foo: "setOne"
|
||||||
|
}
|
||||||
|
set: {
|
||||||
|
foo: "setTwo"
|
||||||
|
}
|
||||||
|
mappingWithUnannotatedValueType: {
|
||||||
|
key: "some"
|
||||||
|
value: {
|
||||||
|
it: {
|
||||||
|
foo: "Bar"
|
||||||
|
}
|
||||||
|
it: {
|
||||||
|
foo: "Bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
["Typed objects rendered as protobuf.ProtoMessage"] {
|
||||||
|
"foo: \"new\""
|
||||||
|
"foo: \"Bar\""
|
||||||
|
"foo: \"Baz\""
|
||||||
|
"""
|
||||||
|
foo: {
|
||||||
|
foo: "FOO"
|
||||||
|
}
|
||||||
|
bar: {
|
||||||
|
foo: "Bar"
|
||||||
|
}
|
||||||
|
foos: {
|
||||||
|
foo: "FOO"
|
||||||
|
}
|
||||||
|
foos: {
|
||||||
|
foo: "Bar"
|
||||||
|
}
|
||||||
|
bars: {
|
||||||
|
key: "default"
|
||||||
|
value: {
|
||||||
|
foo: "Bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bars: {
|
||||||
|
key: "amended"
|
||||||
|
value: {
|
||||||
|
foo: "Bars"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
myDuration: {
|
||||||
|
seconds: 0
|
||||||
|
nanos: 42
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
["Unsupported types"] {
|
||||||
|
"Cannot render value of type `Dynamic` as Protobuf. Value: new Dynamic {}"
|
||||||
|
"Cannot render value of type `DataSize` as Protobuf. Value: 10.kb"
|
||||||
|
}
|
||||||
|
["Types not supported at top-level"] {
|
||||||
|
"The top-level value of a protobuf file must have type `Typed`, but got type `Map`."
|
||||||
|
"The top-level value of a protobuf file must have type `Typed`, but got type `Mapping`."
|
||||||
|
}
|
||||||
|
["Keys in maps"] {
|
||||||
|
"""
|
||||||
|
string: {
|
||||||
|
key: "Hello world"
|
||||||
|
value: {
|
||||||
|
foo: "Bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
long: {
|
||||||
|
key: 1337
|
||||||
|
value: {
|
||||||
|
foo: "Bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int: {
|
||||||
|
key: 42
|
||||||
|
value: {
|
||||||
|
foo: "Bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
short: {
|
||||||
|
key: 1
|
||||||
|
value: {
|
||||||
|
foo: "Bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean: {
|
||||||
|
key: false
|
||||||
|
value: {
|
||||||
|
foo: "Bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
"Cannot render map with a non-scalar, floating point or byte array key type."
|
||||||
|
}
|
||||||
|
["typealiases"] {
|
||||||
|
"doubleAlias: \"Qux\""
|
||||||
|
}
|
||||||
|
["unions"] {
|
||||||
|
"theProperty: \"Qux\""
|
||||||
|
"theProperty: \"corge\""
|
||||||
|
"""
|
||||||
|
theHeterogeneousUnion: {
|
||||||
|
it_String: "Grault"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
theHeterogeneousUnion: {
|
||||||
|
it_String: "Grault"
|
||||||
|
}
|
||||||
|
theHeterogeneousUnion: {
|
||||||
|
it_Int: 0
|
||||||
|
}
|
||||||
|
theHeterogeneousUnion: {
|
||||||
|
it_Foo: {
|
||||||
|
foo: "Bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
"Cannot render map with a non-scalar, floating point or byte array key type."
|
||||||
|
}
|
||||||
|
["subtypes"] {
|
||||||
|
"""
|
||||||
|
myFoo: {
|
||||||
|
foo: "renders"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
"Cannot render subtype protobuf#Foo of specified type protobuf#Bar in protobuf."
|
||||||
|
"""
|
||||||
|
myFoo: {
|
||||||
|
foo: "renders"
|
||||||
|
}
|
||||||
|
myFooOrBar: {
|
||||||
|
it_Bar: {
|
||||||
|
foo: "also renders"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
examples {
|
||||||
|
["some"] {
|
||||||
|
"""
|
||||||
|
plainString: "plain string"
|
||||||
|
nestedListing: {
|
||||||
|
it: "foo"
|
||||||
|
it: "bar"
|
||||||
|
}
|
||||||
|
nestedListing: {
|
||||||
|
it: "baz"
|
||||||
|
it: "qux"
|
||||||
|
}
|
||||||
|
nestedListing2: {
|
||||||
|
it: {
|
||||||
|
it: {
|
||||||
|
it: "foo"
|
||||||
|
it: "bar"
|
||||||
|
it: "baz"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nestedMapping: {
|
||||||
|
key: "quux"
|
||||||
|
value: {
|
||||||
|
it: {
|
||||||
|
key: 42
|
||||||
|
value: true
|
||||||
|
}
|
||||||
|
it: {
|
||||||
|
key: 1337
|
||||||
|
value: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nestedMapping: {
|
||||||
|
key: "corge"
|
||||||
|
value: {
|
||||||
|
it: {
|
||||||
|
key: 0
|
||||||
|
value: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
listingInMapping: {
|
||||||
|
key: "grault"
|
||||||
|
value: {
|
||||||
|
it: "grault1"
|
||||||
|
it: "grault2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
listingInMapping: {
|
||||||
|
key: "garply"
|
||||||
|
value: {
|
||||||
|
it: "garply1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
listingInMapping: {
|
||||||
|
key: "waldo"
|
||||||
|
value: {}
|
||||||
|
}
|
||||||
|
mappingInListing: {
|
||||||
|
it: {
|
||||||
|
key: -1
|
||||||
|
value: false
|
||||||
|
}
|
||||||
|
it: {
|
||||||
|
key: 1
|
||||||
|
value: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mappingInListing: {
|
||||||
|
it: {
|
||||||
|
key: -2
|
||||||
|
value: true
|
||||||
|
}
|
||||||
|
it: {
|
||||||
|
key: 2
|
||||||
|
value: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nestedList: {
|
||||||
|
it: "pigeon"
|
||||||
|
it: "plugh"
|
||||||
|
}
|
||||||
|
nestedList: {}
|
||||||
|
nestedList: {
|
||||||
|
it: "xyzzy"
|
||||||
|
}
|
||||||
|
nestedMap: {
|
||||||
|
key: "thud"
|
||||||
|
value: {}
|
||||||
|
}
|
||||||
|
nestedMap: {
|
||||||
|
key: "wibble"
|
||||||
|
value: {
|
||||||
|
it: {
|
||||||
|
key: 1
|
||||||
|
value: false
|
||||||
|
}
|
||||||
|
it: {
|
||||||
|
key: 2
|
||||||
|
value: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nestedMap: {
|
||||||
|
key: "wobble"
|
||||||
|
value: {
|
||||||
|
it: {
|
||||||
|
key: 0
|
||||||
|
value: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
FOO: "a"
|
||||||
|
bar: "b" # bar
|
||||||
|
baz: {
|
||||||
|
qux: "c" # qux
|
||||||
|
quux: "c"
|
||||||
|
}
|
||||||
@@ -176,6 +176,37 @@ examples {
|
|||||||
"""
|
"""
|
||||||
"✅\\❌ /-#;)<>"
|
"✅\\❌ /-#;)<>"
|
||||||
}
|
}
|
||||||
|
["textproto"] {
|
||||||
|
"""
|
||||||
|
1"2
|
||||||
|
3\t4'
|
||||||
|
"""
|
||||||
|
"+* /\\-;)❌#✅<>"
|
||||||
|
"""
|
||||||
|
directiveProperty: ✅/&\\;)*❌
|
||||||
|
normalProperty: 42
|
||||||
|
listing: "foo"
|
||||||
|
listing: 💰
|
||||||
|
listing: "baz"
|
||||||
|
mapping: {
|
||||||
|
key: "key"
|
||||||
|
value: "value"
|
||||||
|
}
|
||||||
|
mapping: {
|
||||||
|
key: 🔑
|
||||||
|
value: 42
|
||||||
|
}
|
||||||
|
mapping: {
|
||||||
|
key: "other"
|
||||||
|
value: 💰
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
✅\\❌ /-#;)<>
|
||||||
|
|
||||||
|
"""
|
||||||
|
}
|
||||||
["xml"] {
|
["xml"] {
|
||||||
"""
|
"""
|
||||||
1"2
|
1"2
|
||||||
|
|||||||
@@ -79,6 +79,22 @@ examples {
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
["textproto"] {
|
||||||
|
"""
|
||||||
|
property: (value)
|
||||||
|
elements: (element1)
|
||||||
|
elements: (element2)
|
||||||
|
entries: {
|
||||||
|
key: (key1)
|
||||||
|
value: (value1)
|
||||||
|
}
|
||||||
|
entries: {
|
||||||
|
key: (key2)
|
||||||
|
value: (value2)
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
}
|
||||||
["xml"] {
|
["xml"] {
|
||||||
"""
|
"""
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|||||||
+1
@@ -20,6 +20,7 @@ pkl:net
|
|||||||
pkl:pklbinary
|
pkl:pklbinary
|
||||||
pkl:platform
|
pkl:platform
|
||||||
pkl:Project
|
pkl:Project
|
||||||
|
pkl:protobuf
|
||||||
pkl:ref
|
pkl:ref
|
||||||
pkl:reflect
|
pkl:reflect
|
||||||
pkl:release
|
pkl:release
|
||||||
|
|||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
result = "ok"
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl)
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
result = "ok"
|
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
result = "ok"
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
result = "ok"
|
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
result = "ok"
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
result = "ok"
|
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
qux = false
|
||||||
|
corge {
|
||||||
|
grault {
|
||||||
|
garply = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pkl: WARN: Cannot reference `module` type within an annotation body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a type alias body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type from const property `currentModuleType4#qux`. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type from const property `currentModuleType4#corge`. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type from const property `currentModuleType4#waldo`. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type from const method `currentModuleType4#quux`. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
–– Pkl Error ––
|
|
||||||
Cannot reference `module` type within a type alias body.
|
|
||||||
|
|
||||||
x | typealias Foo = module
|
|
||||||
^^^^^^
|
|
||||||
at currentModuleType4a#Foo (file:///$snippetsDir/input/types/currentModuleType4a.pkl)
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
–– Pkl Error ––
|
|
||||||
Cannot reference `module` type within an annotation body.
|
|
||||||
|
|
||||||
x | @Baz { valid = true is module }
|
|
||||||
^^^^^^
|
|
||||||
at currentModuleType4b#Bar.valid (file:///$snippetsDir/input/types/currentModuleType4b.pkl)
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
–– Pkl Error ––
|
|
||||||
Cannot reference `module` type within a class body.
|
|
||||||
|
|
||||||
x | baz: module
|
|
||||||
^^^^^^
|
|
||||||
at currentModuleType4c#Bar.baz (file:///$snippetsDir/input/types/currentModuleType4c.pkl)
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
–– Pkl Error ––
|
|
||||||
Cannot reference `module` type from const property `currentModuleType4d#qux`.
|
|
||||||
|
|
||||||
x | const qux = true is module
|
|
||||||
^^^^^^
|
|
||||||
at currentModuleType4d#qux (file:///$snippetsDir/input/types/currentModuleType4d.pkl)
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
–– Pkl Error ––
|
|
||||||
Cannot reference `module` type from const method `currentModuleType4e#quux`.
|
|
||||||
|
|
||||||
x | const function quux() = true is module
|
|
||||||
^^^^^^
|
|
||||||
at currentModuleType4e#quux (file:///$snippetsDir/input/types/currentModuleType4e.pkl)
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
–– Pkl Error ––
|
|
||||||
Cannot reference `module` type from const property `currentModuleType4f#corge`.
|
|
||||||
|
|
||||||
x | garply = true is module
|
|
||||||
^^^^^^
|
|
||||||
at currentModuleType4f#corge.grault.garply (file:///$snippetsDir/input/types/currentModuleType4f.pkl)
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
–– Pkl Error ––
|
|
||||||
Cannot reference `module` type from const property `currentModuleType4g#waldo`.
|
|
||||||
|
|
||||||
x | hidden const waldo = (x: module) -> true
|
|
||||||
^^^^^^
|
|
||||||
at currentModuleType4g#waldo.<function#1> (file:///$snippetsDir/input/types/currentModuleType4g.pkl)
|
|
||||||
+2
@@ -13,5 +13,7 @@ res3 {
|
|||||||
x = 2
|
x = 2
|
||||||
y = 2
|
y = 2
|
||||||
modName = "currentModuleType6#ModuleSubclass"
|
modName = "currentModuleType6#ModuleSubclass"
|
||||||
|
mod2x = -1
|
||||||
}
|
}
|
||||||
res4 = "Expected value of type `currentModuleType6#ModuleSubclass`, but got type `moduleTypeProperty`. Value: new moduleTypeProperty { x = ?; y = ?; modName = ? }"
|
res4 = "Expected value of type `currentModuleType6#ModuleSubclass`, but got type `moduleTypeProperty`. Value: new moduleTypeProperty { x = ?; y = ?; modName = ? }"
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType6.pkl)
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
pkl: WARN: Cannot reference `module` type within a type alias body. This will be an error in a future release. (file:///$snippetsDir/input-helper/types/typeAliasModule.pkl)
|
||||||
|
–– Pkl Error ––
|
||||||
|
Expected value of type `typeAliasModule`, but got type `typeAlias6`.
|
||||||
|
Value: new typeAlias6 { res = ? }
|
||||||
|
|
||||||
|
x | res: typeAliasModule = module
|
||||||
|
^^^^^^^^^^^^^^^
|
||||||
|
at typeAlias6#res (file:///$snippetsDir/input/types/typeAlias6.pkl)
|
||||||
|
|
||||||
|
xxx | renderer.renderDocument(value)
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
at pkl.base#Module.output.text (pkl:base)
|
||||||
|
|
||||||
|
xxx | if (renderer is BytesRenderer) renderer.renderDocument(value) else text.encodeToBytes("UTF-8")
|
||||||
|
^^^^
|
||||||
|
at pkl.base#Module.output.bytes (pkl:base)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
|
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -30,6 +30,7 @@ class ReflectModuleTest {
|
|||||||
"pkl:json",
|
"pkl:json",
|
||||||
"pkl:jsonnet",
|
"pkl:jsonnet",
|
||||||
"pkl:math",
|
"pkl:math",
|
||||||
|
"pkl:protobuf",
|
||||||
"pkl:reflect",
|
"pkl:reflect",
|
||||||
"pkl:settings",
|
"pkl:settings",
|
||||||
"pkl:shell",
|
"pkl:shell",
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
start_timestamp_ms: 0
|
||||||
|
end_timestamp_ms: 100
|
||||||
|
people: {
|
||||||
|
key: "Pigeon"
|
||||||
|
value: {
|
||||||
|
name: "Pigeon"
|
||||||
|
profile: {
|
||||||
|
isExtinct: false
|
||||||
|
}
|
||||||
|
fictional: true
|
||||||
|
height: 1.77
|
||||||
|
hobbies: "cooing"
|
||||||
|
role: Lead
|
||||||
|
}
|
||||||
|
}
|
||||||
|
people: {
|
||||||
|
key: "Parrot"
|
||||||
|
value: {
|
||||||
|
name: "Parrot"
|
||||||
|
fictional: true
|
||||||
|
height: 1.76
|
||||||
|
hobbies: "singing"
|
||||||
|
role: Lead
|
||||||
|
}
|
||||||
|
}
|
||||||
|
owner: "Pigeon"
|
||||||
+3
-3
@@ -29,9 +29,9 @@ class Foo {
|
|||||||
|
|
||||||
x5: String|moduleTypes1|Int
|
x5: String|moduleTypes1|Int
|
||||||
|
|
||||||
x6: this
|
x6: module
|
||||||
|
|
||||||
x7: List<this>
|
x7: List<module>
|
||||||
|
|
||||||
x8: String|this|Int
|
x8: String|module|Int
|
||||||
}
|
}
|
||||||
Vendored
+3
-3
@@ -108,7 +108,7 @@
|
|||||||
<div class="member-modifiers"></div>
|
<div class="member-modifiers"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">x6</span>: this<a class="member-source-link" href="https://example.com/package1/moduleTypes2.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">x6</span>: module<a class="member-source-link" href="https://example.com/package1/moduleTypes2.pkl#L123-L456">Source</a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
<div class="member-modifiers"></div>
|
<div class="member-modifiers"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">x7</span>: <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/List.html" class="name-ref">List</a><this><a class="member-source-link" href="https://example.com/package1/moduleTypes2.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">x7</span>: <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/List.html" class="name-ref">List</a><module><a class="member-source-link" href="https://example.com/package1/moduleTypes2.pkl#L123-L456">Source</a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
<div class="member-modifiers"></div>
|
<div class="member-modifiers"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">x8</span>: <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/String.html" class="name-ref">String</a>|this|<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Int.html" class="name-ref">Int</a><a class="member-source-link" href="https://example.com/package1/moduleTypes2.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">x8</span>: <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/String.html" class="name-ref">String</a>|module|<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Int.html" class="name-ref">Int</a><a class="member-source-link" href="https://example.com/package1/moduleTypes2.pkl#L123-L456">Source</a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3"},"summary":"Docs for Package 1.","deprecation":"com.package1 is deprecated","sourceCode":"https://example.com/package1/","sourceCodeUrlScheme":"https://example.com/package1%{path}#L%{line}-L%{endLine}","dependencies":[{"ref":{"pkg":"com.package2","pkgUri":null,"version":"4.5.6"}},{"ref":{"pkg":"com.externalpackage","pkgUri":null,"version":"7.8.9"}},{"ref":{"pkg":"pkl","pkgUri":null,"version":"0.24.0"}}],"modules":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"Module Containing Spaces"},"summary":"This is a module that has spaces in its name.","moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"Module Containing Spaces","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]}},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"baseModule"},"moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"baseModule","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},"classes":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"baseModule","type":"BaseClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations"},"moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},"classes":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"AnnotatedClss"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"AnnotatedClssWithExpandableComment"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"AnnotatedClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments"},"summary":"The greatest breakthrough since ever.","moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},"classes":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments","type":"Comments1"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments","type":"Comments2"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":Line truncated
|
{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3"},"summary":"Docs for Package 1.","deprecation":"com.package1 is deprecated","sourceCode":"https://example.com/package1/","sourceCodeUrlScheme":"https://example.com/package1%{path}#L%{line}-L%{endLine}","dependencies":[{"ref":{"pkg":"com.package2","pkgUri":null,"version":"4.5.6"}},{"ref":{"pkg":"com.externalpackage","pkgUri":null,"version":"7.8.9"}},{"ref":{"pkg":"pkl","pkgUri":null,"version":"0.24.0"}}],"modules":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"Module Containing Spaces"},"summary":"This is a module that has spaces in its name.","moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"Module Containing Spaces","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]}},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"baseModule"},"moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"baseModule","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},"classes":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"baseModule","type":"BaseClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations"},"moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},"classes":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"AnnotatedClss"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"AnnotatedClssWithExpandableComment"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"AnnotatedClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments"},"summary":"The greatest breakthrough since ever.","moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},"classes":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments","type":"Comments1"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments","type":"Comments2"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":Line truncated
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
searchData='[{"name":"com.package1.Module Containing Spaces","kind":1,"url":"Module Containing Spaces/index.html"},{"name":"com.package1.baseModule","kind":1,"url":"baseModule/index.html"},{"name":"baseProperty","kind":5,"url":"baseModule/index.html#baseProperty","sig":": unknown","parId":1},{"name":"baseMethod","kind":4,"url":"baseModule/index.html#baseMethod()","sig":"(): unknown","parId":1},{"name":"BaseClass","kind":3,"url":"baseModule/BaseClass.html","parId":1},{"name":"com.package1.classAnnotations","kind":1,"url":"classAnnotations/index.html"},{"name":"AnnotatedClss","kind":3,"url":"classAnnotations/AnnotatedClss.html","parId":5,"deprecated":true,"aka":["OtherName"]},{"name":"AnnotatedClssWithExpandableComment","kind":3,"url":"classAnnotations/AnnotatedClssWithExpandableComment.html","parId":5,"deprecated":true,"aka":["OtherName"]},{"name":"AnnotatedClass","kind":3,"url":"classAnnotations/AnnotatedClass.html","parId":5,"deprecated":true,"aka":["OtherName"]},{"name":"com.package1.classComments","kind":1,"url":"classComments/index.html"},{"name":"Comments1","kind":3,"url":"classComments/Comments1.html","parId":9},{"name":"Comments2","kind":3,"url":"classComments/Comments2.html","parId":9},{"name":"Comments3","kind":3,"url":"classComments/Comments3.html","parId":9},{"name":"Comments4","kind":3,"url":"classComments/Comments4.html","parId":9},{"name":"Comments5","kind":3,"url":"classComments/Comments5.html","parId":9},{"name":"Comments6","kind":3,"url":"classComments/Comments6.html","parId":9},{"name":"Comments7","kind":3,"url":"classComments/Comments7.html","parId":9},{"name":"Comments8","kind":3,"url":"classComments/Comments8.html","parId":9},{"name":"com.package1.classInheritance","kind":1,"url":"classInheritance/index.html"},{"name":"MyClass1","kind":3,"url":"classInheritance/MyClass1.html","parId":18},{"name":"property1","kind":5,"url":"classInheritance/MyClass1.html#property1","sig":": Boolean","parId":19},{"name":"method1","kind":4,"url":"classInheritance/MyClass1.html#method1()","sig":"(arg): Boolean","parId":19},{"name":"MyClass2","kind":3,"url":"classInheritance/MyClass2.html","parId":18},{"name":"property1","kind":5,"url":"classInheritance/MyClass2.html#property1","sig":": Boolean","parId":22},{"name":"property2","kind":5,"url":"classInheritance/MyClass2.html#property2","sig":": String","parId":22},{"name":"method1","kind":4,"url":"classInheritance/MyClass2.html#method1()","sig":"(arg): Boolean","parId":22},{"name":"method2","kind":4,"url":"classInheritance/MyClass2.html#method2()","sig":"(arg): Boolean","parId":22},{"name":"MyClass3","kind":3,"url":"classInheritance/MyClass3.html","parId":18},{"name":"property1","kind":5,"url":"classInheritance/MyClass3.html#property1","sig":": Boolean","parId":27},{"name":"method1","kind":4,"url":"classInheritance/MyClass3.html#method1()","sig":"(arg): Boolean","parId":27},{"name":"MyClass4","kind":3,"url":"classInheritance/MyClass4.html","parId":18},{"name":"property4","kind":5,"url":"classInheritance/MyClass4.html#property4","sig":": String","parId":30},{"name":"method3","kind":4,"url":"classInheritance/MyClass4.html#method3()","sig":"(arg): Boolean","parId":30},{"name":"com.package1.classMethodComments","kind":1,"url":"classMethodComments/index.html"},{"name":"Comments","kind":3,"url":"classMethodComments/Comments.html","parId":33},{"name":"method1","kind":4,"url":"classMethodComments/Comments.html#method1()","sig":"(): Float","parId":34},{"name":"method2","kind":4,"url":"classMethodComments/Comments.html#method2()","sig":"(): Float","parId":34},{"name":"method3","kind":4,"url":"classMethodComments/Comments.html#method3()","sig":"(): Float","parId":34},{"name":"method4","kind":4,"url":"classMethodComments/Comments.html#method4()","sig":"(): Float","parId":34},{"name":"method5","kind":4,"url":"classMethodComments/Comments.html#method5()","sig":"(): Float","parId":34},{"name":"method6","kind":4,"url":"classMethodComments/Comments.html#method6()","sig":"(): Float","parId":34},{"name":"method7","kind":4,"url":"classMethodComments/Comments.html#method7()","sig":"(): Float","parId":34},{"name":"com.package1.classMethodModifiers","kind":1,"url":"classMethodModifiers/index.html"},{"name":"Modifiers","kind":3,"url":"classMethodModifiers/Modifiers.html","parId":42},{"name":"method1","kind":4,"url":"classMethodModifiers/Modifiers.html#method1()","sig":"(arg): Boolean","parId":43},{"name":"com.package1.classMethodTypeAnnotations","kind":1,"url":"classMethodTypeAnnotations/index.html"},{"name":"TypeAnnotations","kind":3,"url":"classMethodTypeAnnotations/TypeAnnotations.html","parId":45},{"name":"method1","kind":4,"url":"classMethodTypeAnnotations/TypeAnnotations.html#method1()","sig":"(): unknown","parId":46},{"name":"method2","kind":4,"url":"classMethodTypeAnnotations/TypeAnnotations.html#method2()","sig":"(arg1): unknown","parId":46},{"name":"method3","kind":4,"url":"classMethodTypeAnnotations/TypeAnnotations.html#method3()","sig":"(arg1, arg2): unknown","parId":46}Line truncated
|
searchData='[{"name":"com.package1.Module Containing Spaces","kind":1,"url":"Module Containing Spaces/index.html"},{"name":"com.package1.baseModule","kind":1,"url":"baseModule/index.html"},{"name":"baseProperty","kind":5,"url":"baseModule/index.html#baseProperty","sig":": unknown","parId":1},{"name":"baseMethod","kind":4,"url":"baseModule/index.html#baseMethod()","sig":"(): unknown","parId":1},{"name":"BaseClass","kind":3,"url":"baseModule/BaseClass.html","parId":1},{"name":"com.package1.classAnnotations","kind":1,"url":"classAnnotations/index.html"},{"name":"AnnotatedClss","kind":3,"url":"classAnnotations/AnnotatedClss.html","parId":5,"deprecated":true,"aka":["OtherName"]},{"name":"AnnotatedClssWithExpandableComment","kind":3,"url":"classAnnotations/AnnotatedClssWithExpandableComment.html","parId":5,"deprecated":true,"aka":["OtherName"]},{"name":"AnnotatedClass","kind":3,"url":"classAnnotations/AnnotatedClass.html","parId":5,"deprecated":true,"aka":["OtherName"]},{"name":"com.package1.classComments","kind":1,"url":"classComments/index.html"},{"name":"Comments1","kind":3,"url":"classComments/Comments1.html","parId":9},{"name":"Comments2","kind":3,"url":"classComments/Comments2.html","parId":9},{"name":"Comments3","kind":3,"url":"classComments/Comments3.html","parId":9},{"name":"Comments4","kind":3,"url":"classComments/Comments4.html","parId":9},{"name":"Comments5","kind":3,"url":"classComments/Comments5.html","parId":9},{"name":"Comments6","kind":3,"url":"classComments/Comments6.html","parId":9},{"name":"Comments7","kind":3,"url":"classComments/Comments7.html","parId":9},{"name":"Comments8","kind":3,"url":"classComments/Comments8.html","parId":9},{"name":"com.package1.classInheritance","kind":1,"url":"classInheritance/index.html"},{"name":"MyClass1","kind":3,"url":"classInheritance/MyClass1.html","parId":18},{"name":"property1","kind":5,"url":"classInheritance/MyClass1.html#property1","sig":": Boolean","parId":19},{"name":"method1","kind":4,"url":"classInheritance/MyClass1.html#method1()","sig":"(arg): Boolean","parId":19},{"name":"MyClass2","kind":3,"url":"classInheritance/MyClass2.html","parId":18},{"name":"property1","kind":5,"url":"classInheritance/MyClass2.html#property1","sig":": Boolean","parId":22},{"name":"property2","kind":5,"url":"classInheritance/MyClass2.html#property2","sig":": String","parId":22},{"name":"method1","kind":4,"url":"classInheritance/MyClass2.html#method1()","sig":"(arg): Boolean","parId":22},{"name":"method2","kind":4,"url":"classInheritance/MyClass2.html#method2()","sig":"(arg): Boolean","parId":22},{"name":"MyClass3","kind":3,"url":"classInheritance/MyClass3.html","parId":18},{"name":"property1","kind":5,"url":"classInheritance/MyClass3.html#property1","sig":": Boolean","parId":27},{"name":"method1","kind":4,"url":"classInheritance/MyClass3.html#method1()","sig":"(arg): Boolean","parId":27},{"name":"MyClass4","kind":3,"url":"classInheritance/MyClass4.html","parId":18},{"name":"property4","kind":5,"url":"classInheritance/MyClass4.html#property4","sig":": String","parId":30},{"name":"method3","kind":4,"url":"classInheritance/MyClass4.html#method3()","sig":"(arg): Boolean","parId":30},{"name":"com.package1.classMethodComments","kind":1,"url":"classMethodComments/index.html"},{"name":"Comments","kind":3,"url":"classMethodComments/Comments.html","parId":33},{"name":"method1","kind":4,"url":"classMethodComments/Comments.html#method1()","sig":"(): Float","parId":34},{"name":"method2","kind":4,"url":"classMethodComments/Comments.html#method2()","sig":"(): Float","parId":34},{"name":"method3","kind":4,"url":"classMethodComments/Comments.html#method3()","sig":"(): Float","parId":34},{"name":"method4","kind":4,"url":"classMethodComments/Comments.html#method4()","sig":"(): Float","parId":34},{"name":"method5","kind":4,"url":"classMethodComments/Comments.html#method5()","sig":"(): Float","parId":34},{"name":"method6","kind":4,"url":"classMethodComments/Comments.html#method6()","sig":"(): Float","parId":34},{"name":"method7","kind":4,"url":"classMethodComments/Comments.html#method7()","sig":"(): Float","parId":34},{"name":"com.package1.classMethodModifiers","kind":1,"url":"classMethodModifiers/index.html"},{"name":"Modifiers","kind":3,"url":"classMethodModifiers/Modifiers.html","parId":42},{"name":"method1","kind":4,"url":"classMethodModifiers/Modifiers.html#method1()","sig":"(arg): Boolean","parId":43},{"name":"com.package1.classMethodTypeAnnotations","kind":1,"url":"classMethodTypeAnnotations/index.html"},{"name":"TypeAnnotations","kind":3,"url":"classMethodTypeAnnotations/TypeAnnotations.html","parId":45},{"name":"method1","kind":4,"url":"classMethodTypeAnnotations/TypeAnnotations.html#method1()","sig":"(): unknown","parId":46},{"name":"method2","kind":4,"url":"classMethodTypeAnnotations/TypeAnnotations.html#method2()","sig":"(arg1): unknown","parId":46},{"name":"method3","kind":4,"url":"classMethodTypeAnnotations/TypeAnnotations.html#method3()","sig":"(arg1, arg2): unknown","parId":46}Line truncated
|
||||||
pkl-doc/src/test/files/DocGeneratorTest/output/run-1/data/com.package1/1.2.3/moduleTypes2/index.json
Vendored
+8
-1
@@ -1 +1,8 @@
|
|||||||
{}
|
{
|
||||||
|
"knownUsages": [
|
||||||
|
{
|
||||||
|
"text": "Foo",
|
||||||
|
"href": "Foo.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Vendored
+3
-3
@@ -108,7 +108,7 @@
|
|||||||
<div class="member-modifiers"></div>
|
<div class="member-modifiers"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">x6</span>: this<a class="member-source-link" href="https://example.com/package1/moduleTypes2.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">x6</span>: module<a class="member-source-link" href="https://example.com/package1/moduleTypes2.pkl#L123-L456">Source</a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
<div class="member-modifiers"></div>
|
<div class="member-modifiers"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">x7</span>: <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/List.html" class="name-ref">List</a><this><a class="member-source-link" href="https://example.com/package1/moduleTypes2.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">x7</span>: <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/List.html" class="name-ref">List</a><module><a class="member-source-link" href="https://example.com/package1/moduleTypes2.pkl#L123-L456">Source</a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
<div class="member-modifiers"></div>
|
<div class="member-modifiers"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">x8</span>: <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/String.html" class="name-ref">String</a>|this|<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Int.html" class="name-ref">Int</a><a class="member-source-link" href="https://example.com/package1/moduleTypes2.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">x8</span>: <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/String.html" class="name-ref">String</a>|module|<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Int.html" class="name-ref">Int</a><a class="member-source-link" href="https://example.com/package1/moduleTypes2.pkl#L123-L456">Source</a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3"},"summary":"Docs for Package 1.","deprecation":"com.package1 is deprecated","sourceCode":"https://example.com/package1/","sourceCodeUrlScheme":"https://example.com/package1%{path}#L%{line}-L%{endLine}","dependencies":[{"ref":{"pkg":"com.package2","pkgUri":null,"version":"4.5.6"}},{"ref":{"pkg":"com.externalpackage","pkgUri":null,"version":"7.8.9"}},{"ref":{"pkg":"pkl","pkgUri":null,"version":"0.24.0"}}],"modules":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"Module Containing Spaces"},"summary":"This is a module that has spaces in its name.","moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"Module Containing Spaces","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]}},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"baseModule"},"moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"baseModule","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},"classes":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"baseModule","type":"BaseClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations"},"moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},"classes":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"AnnotatedClss"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"AnnotatedClssWithExpandableComment"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"AnnotatedClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments"},"summary":"The greatest breakthrough since ever.","moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},"classes":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments","type":"Comments1"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments","type":"Comments2"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":Line truncated
|
{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3"},"summary":"Docs for Package 1.","deprecation":"com.package1 is deprecated","sourceCode":"https://example.com/package1/","sourceCodeUrlScheme":"https://example.com/package1%{path}#L%{line}-L%{endLine}","dependencies":[{"ref":{"pkg":"com.package2","pkgUri":null,"version":"4.5.6"}},{"ref":{"pkg":"com.externalpackage","pkgUri":null,"version":"7.8.9"}},{"ref":{"pkg":"pkl","pkgUri":null,"version":"0.24.0"}}],"modules":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"Module Containing Spaces"},"summary":"This is a module that has spaces in its name.","moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"Module Containing Spaces","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]}},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"baseModule"},"moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"baseModule","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},"classes":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"baseModule","type":"BaseClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations"},"moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},"classes":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"AnnotatedClss"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"AnnotatedClssWithExpandableComment"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classAnnotations","type":"AnnotatedClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments"},"summary":"The greatest breakthrough since ever.","moduleClass":{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments","type":"ModuleClass"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Module"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},"classes":[{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments","type":"Comments1"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":"com.package1","pkgUri":null,"version":"1.2.3","module":"classComments","type":"Comments2"},"superclasses":[{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Typed"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Object"},{"pkg":"pkl","pkgUri":null,"version":"0.24.0","module":"base","type":"Any"}]},{"ref":{"pkg":Line truncated
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
searchData='[{"name":"com.package1.Module Containing Spaces","kind":1,"url":"Module Containing Spaces/index.html"},{"name":"com.package1.baseModule","kind":1,"url":"baseModule/index.html"},{"name":"baseProperty","kind":5,"url":"baseModule/index.html#baseProperty","sig":": unknown","parId":1},{"name":"baseMethod","kind":4,"url":"baseModule/index.html#baseMethod()","sig":"(): unknown","parId":1},{"name":"BaseClass","kind":3,"url":"baseModule/BaseClass.html","parId":1},{"name":"com.package1.classAnnotations","kind":1,"url":"classAnnotations/index.html"},{"name":"AnnotatedClss","kind":3,"url":"classAnnotations/AnnotatedClss.html","parId":5,"deprecated":true,"aka":["OtherName"]},{"name":"AnnotatedClssWithExpandableComment","kind":3,"url":"classAnnotations/AnnotatedClssWithExpandableComment.html","parId":5,"deprecated":true,"aka":["OtherName"]},{"name":"AnnotatedClass","kind":3,"url":"classAnnotations/AnnotatedClass.html","parId":5,"deprecated":true,"aka":["OtherName"]},{"name":"com.package1.classComments","kind":1,"url":"classComments/index.html"},{"name":"Comments1","kind":3,"url":"classComments/Comments1.html","parId":9},{"name":"Comments2","kind":3,"url":"classComments/Comments2.html","parId":9},{"name":"Comments3","kind":3,"url":"classComments/Comments3.html","parId":9},{"name":"Comments4","kind":3,"url":"classComments/Comments4.html","parId":9},{"name":"Comments5","kind":3,"url":"classComments/Comments5.html","parId":9},{"name":"Comments6","kind":3,"url":"classComments/Comments6.html","parId":9},{"name":"Comments7","kind":3,"url":"classComments/Comments7.html","parId":9},{"name":"Comments8","kind":3,"url":"classComments/Comments8.html","parId":9},{"name":"com.package1.classInheritance","kind":1,"url":"classInheritance/index.html"},{"name":"MyClass1","kind":3,"url":"classInheritance/MyClass1.html","parId":18},{"name":"property1","kind":5,"url":"classInheritance/MyClass1.html#property1","sig":": Boolean","parId":19},{"name":"method1","kind":4,"url":"classInheritance/MyClass1.html#method1()","sig":"(arg): Boolean","parId":19},{"name":"MyClass2","kind":3,"url":"classInheritance/MyClass2.html","parId":18},{"name":"property1","kind":5,"url":"classInheritance/MyClass2.html#property1","sig":": Boolean","parId":22},{"name":"property2","kind":5,"url":"classInheritance/MyClass2.html#property2","sig":": String","parId":22},{"name":"method1","kind":4,"url":"classInheritance/MyClass2.html#method1()","sig":"(arg): Boolean","parId":22},{"name":"method2","kind":4,"url":"classInheritance/MyClass2.html#method2()","sig":"(arg): Boolean","parId":22},{"name":"MyClass3","kind":3,"url":"classInheritance/MyClass3.html","parId":18},{"name":"property1","kind":5,"url":"classInheritance/MyClass3.html#property1","sig":": Boolean","parId":27},{"name":"method1","kind":4,"url":"classInheritance/MyClass3.html#method1()","sig":"(arg): Boolean","parId":27},{"name":"MyClass4","kind":3,"url":"classInheritance/MyClass4.html","parId":18},{"name":"property4","kind":5,"url":"classInheritance/MyClass4.html#property4","sig":": String","parId":30},{"name":"method3","kind":4,"url":"classInheritance/MyClass4.html#method3()","sig":"(arg): Boolean","parId":30},{"name":"com.package1.classMethodComments","kind":1,"url":"classMethodComments/index.html"},{"name":"Comments","kind":3,"url":"classMethodComments/Comments.html","parId":33},{"name":"method1","kind":4,"url":"classMethodComments/Comments.html#method1()","sig":"(): Float","parId":34},{"name":"method2","kind":4,"url":"classMethodComments/Comments.html#method2()","sig":"(): Float","parId":34},{"name":"method3","kind":4,"url":"classMethodComments/Comments.html#method3()","sig":"(): Float","parId":34},{"name":"method4","kind":4,"url":"classMethodComments/Comments.html#method4()","sig":"(): Float","parId":34},{"name":"method5","kind":4,"url":"classMethodComments/Comments.html#method5()","sig":"(): Float","parId":34},{"name":"method6","kind":4,"url":"classMethodComments/Comments.html#method6()","sig":"(): Float","parId":34},{"name":"method7","kind":4,"url":"classMethodComments/Comments.html#method7()","sig":"(): Float","parId":34},{"name":"com.package1.classMethodModifiers","kind":1,"url":"classMethodModifiers/index.html"},{"name":"Modifiers","kind":3,"url":"classMethodModifiers/Modifiers.html","parId":42},{"name":"method1","kind":4,"url":"classMethodModifiers/Modifiers.html#method1()","sig":"(arg): Boolean","parId":43},{"name":"com.package1.classMethodTypeAnnotations","kind":1,"url":"classMethodTypeAnnotations/index.html"},{"name":"TypeAnnotations","kind":3,"url":"classMethodTypeAnnotations/TypeAnnotations.html","parId":45},{"name":"method1","kind":4,"url":"classMethodTypeAnnotations/TypeAnnotations.html#method1()","sig":"(): unknown","parId":46},{"name":"method2","kind":4,"url":"classMethodTypeAnnotations/TypeAnnotations.html#method2()","sig":"(arg1): unknown","parId":46},{"name":"method3","kind":4,"url":"classMethodTypeAnnotations/TypeAnnotations.html#method3()","sig":"(arg1, arg2): unknown","parId":46}Line truncated
|
searchData='[{"name":"com.package1.Module Containing Spaces","kind":1,"url":"Module Containing Spaces/index.html"},{"name":"com.package1.baseModule","kind":1,"url":"baseModule/index.html"},{"name":"baseProperty","kind":5,"url":"baseModule/index.html#baseProperty","sig":": unknown","parId":1},{"name":"baseMethod","kind":4,"url":"baseModule/index.html#baseMethod()","sig":"(): unknown","parId":1},{"name":"BaseClass","kind":3,"url":"baseModule/BaseClass.html","parId":1},{"name":"com.package1.classAnnotations","kind":1,"url":"classAnnotations/index.html"},{"name":"AnnotatedClss","kind":3,"url":"classAnnotations/AnnotatedClss.html","parId":5,"deprecated":true,"aka":["OtherName"]},{"name":"AnnotatedClssWithExpandableComment","kind":3,"url":"classAnnotations/AnnotatedClssWithExpandableComment.html","parId":5,"deprecated":true,"aka":["OtherName"]},{"name":"AnnotatedClass","kind":3,"url":"classAnnotations/AnnotatedClass.html","parId":5,"deprecated":true,"aka":["OtherName"]},{"name":"com.package1.classComments","kind":1,"url":"classComments/index.html"},{"name":"Comments1","kind":3,"url":"classComments/Comments1.html","parId":9},{"name":"Comments2","kind":3,"url":"classComments/Comments2.html","parId":9},{"name":"Comments3","kind":3,"url":"classComments/Comments3.html","parId":9},{"name":"Comments4","kind":3,"url":"classComments/Comments4.html","parId":9},{"name":"Comments5","kind":3,"url":"classComments/Comments5.html","parId":9},{"name":"Comments6","kind":3,"url":"classComments/Comments6.html","parId":9},{"name":"Comments7","kind":3,"url":"classComments/Comments7.html","parId":9},{"name":"Comments8","kind":3,"url":"classComments/Comments8.html","parId":9},{"name":"com.package1.classInheritance","kind":1,"url":"classInheritance/index.html"},{"name":"MyClass1","kind":3,"url":"classInheritance/MyClass1.html","parId":18},{"name":"property1","kind":5,"url":"classInheritance/MyClass1.html#property1","sig":": Boolean","parId":19},{"name":"method1","kind":4,"url":"classInheritance/MyClass1.html#method1()","sig":"(arg): Boolean","parId":19},{"name":"MyClass2","kind":3,"url":"classInheritance/MyClass2.html","parId":18},{"name":"property1","kind":5,"url":"classInheritance/MyClass2.html#property1","sig":": Boolean","parId":22},{"name":"property2","kind":5,"url":"classInheritance/MyClass2.html#property2","sig":": String","parId":22},{"name":"method1","kind":4,"url":"classInheritance/MyClass2.html#method1()","sig":"(arg): Boolean","parId":22},{"name":"method2","kind":4,"url":"classInheritance/MyClass2.html#method2()","sig":"(arg): Boolean","parId":22},{"name":"MyClass3","kind":3,"url":"classInheritance/MyClass3.html","parId":18},{"name":"property1","kind":5,"url":"classInheritance/MyClass3.html#property1","sig":": Boolean","parId":27},{"name":"method1","kind":4,"url":"classInheritance/MyClass3.html#method1()","sig":"(arg): Boolean","parId":27},{"name":"MyClass4","kind":3,"url":"classInheritance/MyClass4.html","parId":18},{"name":"property4","kind":5,"url":"classInheritance/MyClass4.html#property4","sig":": String","parId":30},{"name":"method3","kind":4,"url":"classInheritance/MyClass4.html#method3()","sig":"(arg): Boolean","parId":30},{"name":"com.package1.classMethodComments","kind":1,"url":"classMethodComments/index.html"},{"name":"Comments","kind":3,"url":"classMethodComments/Comments.html","parId":33},{"name":"method1","kind":4,"url":"classMethodComments/Comments.html#method1()","sig":"(): Float","parId":34},{"name":"method2","kind":4,"url":"classMethodComments/Comments.html#method2()","sig":"(): Float","parId":34},{"name":"method3","kind":4,"url":"classMethodComments/Comments.html#method3()","sig":"(): Float","parId":34},{"name":"method4","kind":4,"url":"classMethodComments/Comments.html#method4()","sig":"(): Float","parId":34},{"name":"method5","kind":4,"url":"classMethodComments/Comments.html#method5()","sig":"(): Float","parId":34},{"name":"method6","kind":4,"url":"classMethodComments/Comments.html#method6()","sig":"(): Float","parId":34},{"name":"method7","kind":4,"url":"classMethodComments/Comments.html#method7()","sig":"(): Float","parId":34},{"name":"com.package1.classMethodModifiers","kind":1,"url":"classMethodModifiers/index.html"},{"name":"Modifiers","kind":3,"url":"classMethodModifiers/Modifiers.html","parId":42},{"name":"method1","kind":4,"url":"classMethodModifiers/Modifiers.html#method1()","sig":"(arg): Boolean","parId":43},{"name":"com.package1.classMethodTypeAnnotations","kind":1,"url":"classMethodTypeAnnotations/index.html"},{"name":"TypeAnnotations","kind":3,"url":"classMethodTypeAnnotations/TypeAnnotations.html","parId":45},{"name":"method1","kind":4,"url":"classMethodTypeAnnotations/TypeAnnotations.html#method1()","sig":"(): unknown","parId":46},{"name":"method2","kind":4,"url":"classMethodTypeAnnotations/TypeAnnotations.html#method2()","sig":"(arg1): unknown","parId":46},{"name":"method3","kind":4,"url":"classMethodTypeAnnotations/TypeAnnotations.html#method3()","sig":"(arg1, arg2): unknown","parId":46}Line truncated
|
||||||
pkl-doc/src/test/files/DocGeneratorTest/output/run-2/data/com.package1/1.2.3/moduleTypes2/index.json
Vendored
+8
-1
@@ -1 +1,8 @@
|
|||||||
{}
|
{
|
||||||
|
"knownUsages": [
|
||||||
|
{
|
||||||
|
"text": "Foo",
|
||||||
|
"href": "Foo.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
///
|
///
|
||||||
/// Warning: Although this module is ready for initial use,
|
/// Warning: Although this module is ready for initial use,
|
||||||
/// benchmark results may be inaccurate or inconsistent.
|
/// benchmark results may be inaccurate or inconsistent.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.Benchmark
|
module pkl.Benchmark
|
||||||
|
|
||||||
import "pkl:platform" as _platform
|
import "pkl:platform" as _platform
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@
|
|||||||
/// // ...
|
/// // ...
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
open module pkl.Command
|
open module pkl.Command
|
||||||
|
|
||||||
import "pkl:Command"
|
import "pkl:Command"
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
/// @Deprecated { message = "Use `com.example.Birds.Parrot` instead" }
|
/// @Deprecated { message = "Use `com.example.Birds.Parrot` instead" }
|
||||||
/// amends "pkl:PackageInfo"
|
/// amends "pkl:PackageInfo"
|
||||||
/// ```
|
/// ```
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.DocPackageInfo
|
module pkl.DocPackageInfo
|
||||||
|
|
||||||
// used by doc comments
|
// used by doc comments
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
///
|
///
|
||||||
/// title = "Title displayed in the header of each page"
|
/// title = "Title displayed in the header of each page"
|
||||||
/// ```
|
/// ```
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.DocsiteInfo
|
module pkl.DocsiteInfo
|
||||||
|
|
||||||
import "pkl:reflect"
|
import "pkl:reflect"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// Common settings for Pkl's own evaluator.
|
/// Common settings for Pkl's own evaluator.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
@Since { version = "0.26.0" }
|
@Since { version = "0.26.0" }
|
||||||
module pkl.EvaluatorSettings
|
module pkl.EvaluatorSettings
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@
|
|||||||
/// value = project
|
/// value = project
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.Project
|
module pkl.Project
|
||||||
|
|
||||||
import "pkl:EvaluatorSettings" as EvaluatorSettingsModule
|
import "pkl:EvaluatorSettings" as EvaluatorSettingsModule
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
/// These tools differentiate from [pkl:reflect][reflect] in that they parse Pkl modules, but do not
|
/// These tools differentiate from [pkl:reflect][reflect] in that they parse Pkl modules, but do not
|
||||||
/// execute any code within these modules.
|
/// execute any code within these modules.
|
||||||
@Since { version = "0.27.0" }
|
@Since { version = "0.27.0" }
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.analyze
|
module pkl.analyze
|
||||||
|
|
||||||
// used by doc comments
|
// used by doc comments
|
||||||
|
|||||||
+5
-2
@@ -17,7 +17,7 @@
|
|||||||
/// Fundamental properties, methods, and classes for writing Pkl programs.
|
/// Fundamental properties, methods, and classes for writing Pkl programs.
|
||||||
///
|
///
|
||||||
/// Members of this module are automatically available in every Pkl module.
|
/// Members of this module are automatically available in every Pkl module.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.base
|
module pkl.base
|
||||||
|
|
||||||
import "pkl:json"
|
import "pkl:json"
|
||||||
@@ -26,6 +26,7 @@ import "pkl:math"
|
|||||||
import "pkl:net"
|
import "pkl:net"
|
||||||
import "pkl:pklbinary"
|
import "pkl:pklbinary"
|
||||||
// noinspection Deprecated
|
// noinspection Deprecated
|
||||||
|
import "pkl:protobuf"
|
||||||
import "pkl:xml"
|
import "pkl:xml"
|
||||||
import "pkl:yaml"
|
import "pkl:yaml"
|
||||||
|
|
||||||
@@ -115,6 +116,8 @@ abstract external class Module {
|
|||||||
new PListRenderer {}
|
new PListRenderer {}
|
||||||
else if (format == "properties")
|
else if (format == "properties")
|
||||||
new PropertiesRenderer {}
|
new PropertiesRenderer {}
|
||||||
|
else if (format == "textproto")
|
||||||
|
new protobuf.Renderer {}
|
||||||
else if (format == "xml")
|
else if (format == "xml")
|
||||||
new xml.Renderer {}
|
new xml.Renderer {}
|
||||||
else if (format == "yaml")
|
else if (format == "yaml")
|
||||||
@@ -123,7 +126,7 @@ abstract external class Module {
|
|||||||
new pklbinary.Renderer {}
|
new pklbinary.Renderer {}
|
||||||
else
|
else
|
||||||
throw(
|
throw(
|
||||||
"Unknown output format: `\(format)`. Supported formats are `json`, `jsonnet`, `pcf`, `plist`, `properties`, `xml`, `yaml`, `pkl-binary`."
|
"Unknown output format: `\(format)`. Supported formats are `json`, `jsonnet`, `pcf`, `plist`, `properties`, `textproto`, `xml`, `yaml`, `pkl-binary`."
|
||||||
)
|
)
|
||||||
text =
|
text =
|
||||||
if (renderer is ValueRenderer)
|
if (renderer is ValueRenderer)
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// A JSON parser.
|
/// A JSON parser.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.json
|
module pkl.json
|
||||||
|
|
||||||
/// Annotate properties of classes and modules with this class to override how a [JsonRenderer]
|
/// Annotate properties of classes and modules with this class to override how a [JsonRenderer]
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// A [Jsonnet](https://jsonnet.org) renderer.
|
/// A [Jsonnet](https://jsonnet.org) renderer.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.jsonnet
|
module pkl.jsonnet
|
||||||
|
|
||||||
/// Constructs an [ImportStr].
|
/// Constructs an [ImportStr].
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@
|
|||||||
///
|
///
|
||||||
/// Note that some mathematical functions, such as `sign()`, `abs()`, and `round()`,
|
/// Note that some mathematical functions, such as `sign()`, `abs()`, and `round()`,
|
||||||
/// are directly defined in classes [Number], [Int], and [Float].
|
/// are directly defined in classes [Number], [Int], and [Float].
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.math
|
module pkl.math
|
||||||
|
|
||||||
/// The minimum [Int] value: `-9223372036854775808`.
|
/// The minimum [Int] value: `-9223372036854775808`.
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// Utilities for networking, like URL parsing.
|
/// Utilities for networking, like URL parsing.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
@Since { version = "0.33.0" }
|
@Since { version = "0.33.0" }
|
||||||
module pkl.net
|
module pkl.net
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
/// The `pkl-binary` format uses MessagePack encoding.
|
/// The `pkl-binary` format uses MessagePack encoding.
|
||||||
/// Its specification is available at
|
/// Its specification is available at
|
||||||
/// <https://pkl-lang.org/main/current/bindings-specification/binary-encoding.html>.
|
/// <https://pkl-lang.org/main/current/bindings-specification/binary-encoding.html>.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.pklbinary
|
module pkl.pklbinary
|
||||||
|
|
||||||
/// Render values as `pkl-binary`.
|
/// Render values as `pkl-binary`.
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// Information about the platform that the current program runs on.
|
/// Information about the platform that the current program runs on.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.platform
|
module pkl.platform
|
||||||
|
|
||||||
/// The platform that the current program runs on.
|
/// The platform that the current program runs on.
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
// Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
/// A renderer for [Protocol Buffers](https://developers.google.com/protocol-buffers).
|
||||||
|
///
|
||||||
|
/// WARNING:
|
||||||
|
/// This module is deprecated, and scheduled for removal without replacement.
|
||||||
|
/// For rendering into a protobuf wire format, consider rendering to
|
||||||
|
/// [ProtoJSON](https://protobuf.dev/programming-guides/json/) using [json.Renderer].
|
||||||
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
|
@Deprecated { since = "0.33.0"; message = "Scheduled for removal without replacement" }
|
||||||
|
module pkl.protobuf
|
||||||
|
|
||||||
|
import "pkl:json"
|
||||||
|
import "pkl:reflect"
|
||||||
|
|
||||||
|
/// A renderer for [Protocol Buffers](https://developers.google.com/protocol-buffers).
|
||||||
|
/// Note: This class is _experimental_ and not ready for production use.
|
||||||
|
///
|
||||||
|
/// As of this release, only Protocol Buffers' text format is supported.
|
||||||
|
///
|
||||||
|
/// The [Property] annotation can be used to change how a property name renders into Protobuf.
|
||||||
|
///
|
||||||
|
/// Example:
|
||||||
|
/// ```
|
||||||
|
/// import "pkl:protobuf"
|
||||||
|
///
|
||||||
|
/// @protobuf.Property { name = "wing_span" }
|
||||||
|
/// wingSpan: Int
|
||||||
|
/// ```
|
||||||
|
class Renderer extends ValueRenderer {
|
||||||
|
/// The characters to use for indenting output.
|
||||||
|
///
|
||||||
|
/// Defaults to two spaces.
|
||||||
|
indent: String = " "
|
||||||
|
|
||||||
|
external function renderDocument(value: Any): String
|
||||||
|
|
||||||
|
external function renderValue(value: Any): String
|
||||||
|
|
||||||
|
/// Returns the canonical name for [type].
|
||||||
|
external function renderType(type: reflect.Type): String
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Annotate properties of classes and modules with this class to override how a [Renderer]
|
||||||
|
/// interprets a property's name.
|
||||||
|
@Since { version = "0.31.0" }
|
||||||
|
class Property extends ConvertProperty {
|
||||||
|
/// The new name to use for the annotated property when rendered by [Renderer].
|
||||||
|
name: String
|
||||||
|
|
||||||
|
render = (prop, renderer) -> if (renderer is Renderer) Pair(name, prop.value) else prop
|
||||||
|
}
|
||||||
+1
-1
@@ -25,7 +25,7 @@
|
|||||||
/// * CI pipelines
|
/// * CI pipelines
|
||||||
/// * Build graphs
|
/// * Build graphs
|
||||||
/// * Workflow tools
|
/// * Workflow tools
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
@Since { version = "0.32.0" }
|
@Since { version = "0.32.0" }
|
||||||
module pkl.ref
|
module pkl.ref
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@
|
|||||||
/// - Documentation generators (such as *Pkldoc*)
|
/// - Documentation generators (such as *Pkldoc*)
|
||||||
/// - Code generators (such as *pkl-codegen-java* and *pkl-codegen-kotlin*)
|
/// - Code generators (such as *pkl-codegen-java* and *pkl-codegen-kotlin*)
|
||||||
/// - Domain-specific schema validators
|
/// - Domain-specific schema validators
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.reflect
|
module pkl.reflect
|
||||||
|
|
||||||
import "pkl:base"
|
import "pkl:base"
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// Information about the Pkl release that the current program runs on.
|
/// Information about the Pkl release that the current program runs on.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.release
|
module pkl.release
|
||||||
|
|
||||||
import "pkl:semver"
|
import "pkl:semver"
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// Parsing, comparison, and manipulation of [semantic version](https://semver.org/spec/v2.0.0.html) numbers.
|
/// Parsing, comparison, and manipulation of [semantic version](https://semver.org/spec/v2.0.0.html) numbers.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.semver
|
module pkl.semver
|
||||||
|
|
||||||
/// Tells whether [version] is a valid semantic version number.
|
/// Tells whether [version] is a valid semantic version number.
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@
|
|||||||
/// (dirs separated by `:` on Unix, `;` on Windows).
|
/// (dirs separated by `:` on Unix, `;` on Windows).
|
||||||
/// 5. `/etc/xdg/pkl/settings.pkl`
|
/// 5. `/etc/xdg/pkl/settings.pkl`
|
||||||
/// 6. `~/.pkl/settings.pkl` (legacy location used by Pkl 0.32 and lower)
|
/// 6. `~/.pkl/settings.pkl` (legacy location used by Pkl 0.32 and lower)
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.settings
|
module pkl.settings
|
||||||
|
|
||||||
import "pkl:EvaluatorSettings"
|
import "pkl:EvaluatorSettings"
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// Utilities for generating shell scripts.
|
/// Utilities for generating shell scripts.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.shell
|
module pkl.shell
|
||||||
|
|
||||||
/// Escapes [str] by enclosing it in single quotes.
|
/// Escapes [str] by enclosing it in single quotes.
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// Utilities for managing Pkl source code.
|
/// Utilities for managing Pkl source code.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
@Since { version = "0.33.0" }
|
@Since { version = "0.33.0" }
|
||||||
module pkl.syntax
|
module pkl.syntax
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@
|
|||||||
///
|
///
|
||||||
/// To write tests, amend this module and define [facts] or [examples] (or both).
|
/// To write tests, amend this module and define [facts] or [examples] (or both).
|
||||||
/// To run tests, use the `pkl test` command to evaluate the amended module.
|
/// To run tests, use the `pkl test` command to evaluate the amended module.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
open module pkl.test
|
open module pkl.test
|
||||||
|
|
||||||
/// Named groups of boolean expressions that are expected to evaluate to [true].
|
/// Named groups of boolean expressions that are expected to evaluate to [true].
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// An XML renderer.
|
/// An XML renderer.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.xml
|
module pkl.xml
|
||||||
|
|
||||||
/// Renders values as XML.
|
/// Renders values as XML.
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// A YAML 1.2 compliant YAML parser.
|
/// A YAML 1.2 compliant YAML parser.
|
||||||
@ModuleInfo { minPklVersion = "0.34.0" }
|
@ModuleInfo { minPklVersion = "0.33.1" }
|
||||||
module pkl.yaml
|
module pkl.yaml
|
||||||
|
|
||||||
/// Annotate properties of classes and modules with this class to override how a [YamlRenderer]
|
/// Annotate properties of classes and modules with this class to override how a [YamlRenderer]
|
||||||
|
|||||||
Reference in new issue
Block a user