gkz / LiveScript

LiveScript is a language which compiles to JavaScript. It has a straightforward mapping to JavaScript and allows you to write expressive code devoid of repetitive boilerplate. While LiveScript adds many features to assist in functional style programming, it also has many improvements for object oriented and imperative programming.
http://livescript.net
MIT License
2.32k stars 155 forks source link

Require! Optimazation #1040

Closed askucher closed 6 years ago

askucher commented 6 years ago

Is it possible to optimize it

require! {
    \react
    \grommet/components/Form : Form
    \grommet/components/FormField : FormField
    \grommet/components/DateTime : DateTime
    \grommet/components/TextInput : TextInput
    \grommet/components/NumberInput : NumberInput
    \grommet/components/App : App
    \grommet/components/Box : Box
    \grommet/components/Sidebar : Sidebar
    \grommet/components/Header : Header
    \grommet/components/Title : Title
    \grommet/components/Anchor : Anchor
    \grommet/components/Menu : Menu
    \grommet/components/Footer : Footer
    \grommet/components/Select : Select
    \grommet/components/Button : Button
    \grommet/components/Section : Section
    \grommet/components/icons/base/FormPrevious : FormPrevious
}

to

require! {
    \react
    \grommet/components/ : { Form, ... } 
}
rhendric commented 6 years ago

As written,

require! {
    \react
    \grommet/components/ : { Form, ... } 
}

already means something else, and changing it is off the table.

You might be interested in @bartosz-m's compiler plugin infrastructure; his plugin for ES6 modules supports wildcards like this: import 'modules/**'. I don't know how well it works; I haven't taken it for a spin yet. But that's the place that new import-related features should be incubated, I think.