Fix various issues with the build system (#129)

* Fix react-icons breaking in CRA 5 for some reason

* Replace fuzzysort with fuzzy so we don't break Webpack

Webpack messes up esbuild’s internal modules if the inlined module is an AMD module. Check any new dep you add if it is an AMD module.

* Inline dataverse deps.

Mainly because the CJS build consuming the ESM lodash-es broke some bundlers.

* react-icons fix nr 2

* Stop eslint breaking in CRA 5

* Update r3f-cra example to CRA 5 and fix double-bundling react & co

* Fix r3f tree-shaking and switch to ESM only output

* Make r3f example shake studio and its extension in prod

* Examples have separate and wildly differing build setups so remove them from the pre-commit hook linting

* Update out-of-date yarn.lock
This commit is contained in:
Andrew Prifer 2022-04-21 22:03:51 +02:00 committed by GitHub
parent f2089302d5
commit 39da042edc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 6066 additions and 218 deletions

View file

@ -95,7 +95,7 @@
},
"dependencies": {
"fast-deep-equal": "^3.1.3",
"fuzzysort": "^1.1.4"
"fuzzy": "^0.1.3"
},
"//": "Add packages here to have them bundled with studio, otherwise add them in the package.json of either studio or core, and they'll be treated as their externals."
}

View file

@ -2,7 +2,7 @@ import type {Pointer} from '@theatre/dataverse'
import {val} from '@theatre/dataverse'
import React, {useLayoutEffect, useMemo, useRef, useState} from 'react'
import styled from 'styled-components'
import fuzzySort from 'fuzzysort'
import fuzzy from 'fuzzy'
import type {SequenceEditorPanelLayout} from '@theatre/studio/panels/SequenceEditorPanel/layout/layout'
import getStudio from '@theatre/studio/getStudio'
import type {CommitOrDiscard} from '@theatre/studio/StudioStore/StudioStore'
@ -132,10 +132,12 @@ const CurveEditorPopover: React.FC<
const presetSearchResults = useMemo(
() =>
fuzzySort.go(filter, presets, {
key: 'label',
allowTypo: false,
fuzzy.filter(filter, presets, {
extract: (el) => el.label,
pre: '<b>',
post: '</b>',
}),
[filter],
)
@ -145,7 +147,7 @@ const CurveEditorPopover: React.FC<
const displayedPresets = useMemo(
() =>
useQuery ? presetSearchResults.map((result) => result.obj) : presets,
useQuery ? presetSearchResults.map((result) => result.original) : presets,
[presetSearchResults, useQuery],
)
@ -199,7 +201,7 @@ const CurveEditorPopover: React.FC<
}
const args =
cssCubicBezierArgsToHandles(newCurve) ??
cssCubicBezierArgsToHandles(presetSearchResults[0].obj.value)
cssCubicBezierArgsToHandles(presetSearchResults[0].original.value)
if (!args) {
return
@ -409,9 +411,7 @@ const CurveEditorPopover: React.FC<
{useQuery ? (
<span
dangerouslySetInnerHTML={{
__html: fuzzySort.highlight(
presetSearchResults[index] as any,
)!,
__html: presetSearchResults[index].string,
}}
/>
) : (