mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 22:11:38 +00:00
Add JSONC Support for Project, Meta, and Model JSON files (#1144)
Replaces `serde_json` parsing with `jsonc-parser` throughout the codebase, enabling support for **comments** and **trailing commas** in all JSON files including `.project.json`, `.model.json`, and `.meta.json` files. MSRV bumps from `1.83.0` to `1.88.0` in order to use the jsonc_parser dependency.
This commit is contained in:
parent
aabe6d11b2
commit
d0b029f995
15 changed files with 471 additions and 65 deletions
|
|
@ -1,10 +1,10 @@
|
|||
use std::path::Path;
|
||||
|
||||
use anyhow::Context;
|
||||
use memofs::{IoResultExt, Vfs};
|
||||
use rbx_dom_weak::ustr;
|
||||
|
||||
use crate::{
|
||||
json,
|
||||
lua_ast::{Expression, Statement},
|
||||
snapshot::{InstanceContext, InstanceMetadata, InstanceSnapshot},
|
||||
};
|
||||
|
|
@ -19,8 +19,9 @@ pub fn snapshot_json(
|
|||
) -> anyhow::Result<Option<InstanceSnapshot>> {
|
||||
let contents = vfs.read(path)?;
|
||||
|
||||
let value: serde_json::Value = serde_json::from_slice(&contents)
|
||||
.with_context(|| format!("File contains malformed JSON: {}", path.display()))?;
|
||||
let value = json::parse_value_from_slice_with_context(&contents, || {
|
||||
format!("File contains malformed JSON: {}", path.display())
|
||||
})?;
|
||||
|
||||
let as_lua = json_to_lua(value).to_string();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue