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

meta: add support for Fragment short syntax #4953

Merged
merged 2 commits into from
Feb 26, 2024
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
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = (api) => {
}],
],
plugins: [
['@babel/plugin-transform-react-jsx', { pragma: 'h' }],
['@babel/plugin-transform-react-jsx', { pragma: 'h', pragmaFrag: 'Fragment' }],
process.env.NODE_ENV !== 'dev' && 'babel-plugin-inline-package-json',
].filter(Boolean),
}
Expand Down
9 changes: 8 additions & 1 deletion bin/build-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ async function buildLib () {
},
}]
const isTSX = file.endsWith('.tsx')
if (isTSX || file.endsWith('.ts')) { plugins.push(['@babel/plugin-transform-typescript', { disallowAmbiguousJSXLike: true, isTSX, jsxPragma: 'h' }]) }
if (isTSX || file.endsWith('.ts')) {
plugins.push(['@babel/plugin-transform-typescript', {
disallowAmbiguousJSXLike: true,
isTSX,
jsxPragma: 'h',
jsxPragmaFrag: 'Fragment',
}])
}

const { code, map } = await babel.transformFileAsync(file, {
sourceMaps: true,
Expand Down
8 changes: 4 additions & 4 deletions packages/@uppy/dashboard/src/components/AddFiles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ class AddFiles extends Component {
const lastTwoAcquirers = acquirersWithoutLastTwo.splice(acquirers.length - 2, acquirers.length)

return (
<Fragment>
<>
{acquirersWithoutLastTwo.map((acquirer) => this.renderAcquirer(acquirer))}
<span role="presentation" style={{ 'white-space': 'nowrap' }}>
{lastTwoAcquirers.map((acquirer) => this.renderAcquirer(acquirer))}
</span>
</Fragment>
</>
)
}

Expand Down Expand Up @@ -258,7 +258,7 @@ class AddFiles extends Component {
const renderList = (l) => l.map(({ key, elements }) => <Fragment key={key}>{elements}</Fragment>)

return (
<Fragment>
<>
{this.renderDropPasteBrowseTagline(list.length)}

<div className="uppy-Dashboard-AddFiles-list" role="tablist">
Expand All @@ -268,7 +268,7 @@ class AddFiles extends Component {
{renderList(lastTwo)}
</span>
</div>
</Fragment>
</>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ const renderAuthor = (props) => {
{truncateString(author.name, 13)}
</a>
{providerName ? (
<Fragment>
<>
{` ${dot} `}
{providerName}
{` ${dot} `}
</Fragment>
</>
) : null}
</div>
)
Expand Down