Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/vite-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@vitejs/plugin-react": "5.1.1",
"globals": "16.5.0",
"typescript": "catalog:",
"vite": "7.2.6",
"vite": "catalog:",
"vite-plugin-rnw": "0.0.10"
}
}
155 changes: 77 additions & 78 deletions bun.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"bun.lockb"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.88.7.wasm",
"https://plugins.dprint.dev/typescript-0.95.15.wasm",
"https://plugins.dprint.dev/json-0.19.1.wasm"
]
}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@
"expo": "55.0.4",
"react-native": "0.83.2",
"react-native-web": "0.21.2",
"tailwindcss": "4.2.1"
"tailwindcss": "4.2.1",
"vite": "7.2.6"
}
},
"devDependencies": {
"typescript": "catalog:",
"dprint": "0.52.0",
"dprint": "0.53.0",
"eslint": "9.39.1",
"eslint-config-codemask": "2.2.1",
"husky": "9.1.7",
"turbo": "2.8.16"
"turbo": "2.8.17"
},
"packageManager": "bun@1.3.10",
"trustedDependencies": [
Expand Down
2 changes: 1 addition & 1 deletion packages/uniwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"ts-jest": "29.4.6",
"typescript": "catalog:",
"unbuild": "3.6.1",
"vite": "7.3.1",
"vite": "catalog:",
"esbuild": "0.27.3"
}
}
21 changes: 13 additions & 8 deletions packages/uniwind/src/metro/utils/serialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ export const serializeJSObject = (obj: Record<string, any>, serializer: (key: st
const serializedObject = pipe(obj)(
Object.entries,
entries => entries.map(([key, value]) => serializer(key, serialize(value))),
serializedValues =>
serializedValues.filter(serializedValue => {
try {
// eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func
new Function(`function validateJS() { const obj = ({ ${serializedValue} }) }`)

return true
} catch {
Logger.error(`Failed to serialize ${serializedValue} as a valid JS object entry. Skipping.`)

return false
}
}),
entries => entries.join(','),
result => {
if (result === '') {
Expand All @@ -110,13 +123,5 @@ export const serializeJSObject = (obj: Record<string, any>, serializer: (key: st
},
)

try {
// eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func
new Function(`function validateJS() { const obj = ({ ${serializedObject} }) }`)
} catch {
Logger.error('Failed to serialize javascript object')
return ''
}

return serializedObject
}