Skip to content
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

fix: avoid newer JS syntax to support old Safari #380

Merged
merged 2 commits into from Nov 24, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion rollup.config.js
Expand Up @@ -78,7 +78,18 @@ const baseConfig = {
const entryPoints = [
{
input: './src/picker/PickerElement.js',
output: './picker.js'
output: './picker.js',
plugins: [
// Replace newer syntax in Svelte v4 to avoid breaking iOS <13.4
// https://github.com/nolanlawson/emoji-picker-element/pull/379
replace({
'array_like_or_iterator?.length': 'array_like_or_iterator && array_like_or_iterator.length',
'$$ = undefined;': '', // not necessary to initialize class prop to undefined
'$$set = undefined;': '', // not necessary to initialize class prop to undefined
delimiters: ['', ''],
preventAssignment: true
})
]
},
{
input: './src/database/Database.js',
Expand Down
2 changes: 1 addition & 1 deletion shims/svelte-v3-shim.js
Expand Up @@ -3,7 +3,7 @@
// this code is copied from svelte v4
/* eslint-disable camelcase */
export function ensure_array_like_shim (array_like_or_iterator) {
return array_like_or_iterator?.length !== undefined
return (array_like_or_iterator && array_like_or_iterator.length !== undefined)
? array_like_or_iterator
: Array.from(array_like_or_iterator)
}