Skip to content

KDL Parser #2064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open

KDL Parser #2064

wants to merge 33 commits into from

Conversation

Bashamega
Copy link
Contributor

This PR is a small part of #2053.

It introduces the kdljs dependency and adds a parser utility that converts KDL text into the specific JSON structure we want.

Changes

  • Added kdljs to dependencies.
  • Created a parser function that takes KDL input and returns our expected JSON format.

Motivation

Part of the work to address #2053, where we need to handle KDL-formatted data in our system.

Notes

  • This is an initial step to enable downstream processing of KDL.
  • Follow-up PRs will build on this foundation.

@saschanaz
Copy link
Contributor

I think we'll need a minimal amount of migration in this PR, to confirm the code works 👀

@Bashamega
Copy link
Contributor Author

I think we'll need a minimal amount of migration in this PR, to confirm the code works 👀

It is just the same code as in #2056
I have just cleaned it up and made it smaller

@saschanaz
Copy link
Contributor

That's in a different PR. It should be in the same PR so that it's easy to see the CI works on the PR, as the code can change during the review pingpong.

@Bashamega
Copy link
Contributor Author

That's in a different PR. It should be in the same PR so that it's easy to see the CI works on the PR, as the code can change during the review pingpong.

I will add it today

@Bashamega
Copy link
Contributor Author

I have updated it @saschanaz
I have migrated AutFill.
I also made a function that would read all KDL files, so we don't need the change the build files when adding new topics.

@Bashamega
Copy link
Contributor Author

I have updated it @saschanaz

Copy link
Contributor

@saschanaz saschanaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks nice to me! Some smaller nits:

Copy link
Contributor

@saschanaz saschanaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks cool. Thanks for the work! Just some last nits:

Bashamega and others added 2 commits July 10, 2025 11:37
Co-authored-by: Kagami Sascha Rosylight <[email protected]>
Co-authored-by: Kagami Sascha Rosylight <[email protected]>
@Bashamega
Copy link
Contributor Author

Your are welcome @saschanaz

Thank you for taking the time to review this PR.

* feat: FontDisplay

* rename

* feat: InsertPosition

* feat: RTCStatsIceCandidatePairState

* feat: GlobalCompositeOperation

* PermissionName

* -

* Delete inputfiles/patches/imageOrientation.kdl
@Bashamega
Copy link
Contributor Author

Bashamega commented Jul 10, 2025

I have migrated more enums.

Can you quickly check it again @saschanaz?
Thank you

@saschanaz
Copy link
Contributor

Err I thought we'll do that in a separate PR

@saschanaz
Copy link
Contributor

(And I know it's an existing convention to use camelCase in file names, for new files I prefer hyphenated names as done in src/build/)

@saschanaz
Copy link
Contributor

(But perhaps @jakebailey would want consistency with the core typescript repository which also uses camel case)

@Bashamega
Copy link
Contributor Author

Err I thought we'll do that in a separate PR

If you want i can make it a separate PR.

(And I know it's an existing convention to use camelCase in file names, for new files I prefer hyphenated names as done in src/build/)

But all the input files are camelCased. If you want, I can create another PR to convert everything to be hyphenated even though I prefer camelCased.

@saschanaz
Copy link
Contributor

If you want i can make it a separate PR.

Let's do that

@jakebailey
Copy link
Member

(But perhaps @jakebailey would want consistency with the core typescript repository which also uses camel case)

Of course, my personal preference is not to have dashes in filenames like this, no.

As for the PR as a whole, I'm not sure I understand the benefit of KDL specifically in this instance; can't the splitting be done without doing that? Pretty surprised by the repetition of the word "value" over and over.

@saschanaz
Copy link
Contributor

Technically we can skip value:

enum Enum {
  "foo"
  "bar"
  baz // Actually even the quote can be skipped
  baz-baz // Because this is legal
}

But this way we won't be able to tell the child node type anymore, as we treat the type as random input string. I was thinking about a chance to add another child node, but perhaps that won't happen and we can do it simpler.

@saschanaz
Copy link
Contributor

Of course, my personal preference is not to have dashes in filenames like this, no.

Ok... 🥺

Copy link
Contributor

@saschanaz saschanaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

back to r- to roll back the additional enums. And we should also try the shorter form without value per @jakebailey's feedback.

@Bashamega
Copy link
Contributor Author

I have reverted it @saschanaz

1 similar comment
@Bashamega
Copy link
Contributor Author

I have reverted it @saschanaz

@saschanaz
Copy link
Contributor

Should we try the shorter form mentioned in #2064 (comment) ? (we can speed it up if you open another PR to my fork, if you want!)

@Bashamega
Copy link
Contributor Author

Should we try the shorter form mentioned in #2064 (comment) ? (we can speed it up if you open another PR to my fork, if you want!)

Sure, I will open another PR. Because I am very busy

@saschanaz
Copy link
Contributor

@jakebailey is it better now? 👀 (I wonder it's better to always quote or always not quote. It has no difference in the parse result though.)

@saschanaz
Copy link
Contributor

(LGTM from me)

Copy link
Contributor

Sorry @saschanaz, you don't have access to these files:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants