-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[WIP] File Name Extension Add #1673
base: main
Are you sure you want to change the base?
Conversation
Deploy preview for babel-new ready! Built with commit 5694645 |
js/repl/compile.js
Outdated
@@ -81,7 +81,7 @@ export default function compile(code: string, config: CompileConfig): Return { | |||
try { | |||
const babelConfig = { | |||
babelrc: false, | |||
filename: "repl", | |||
filename: config.fileName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer we name this config.filename
in lowercase so it would be more consistent with Babel's own option name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the sample page, this appears to not be set. Not sure what the issue is. Maybe it's not getting passed along somewhere?
@@ -215,6 +217,15 @@ class ExpandedContainer extends Component<Props, State> { | |||
/> | |||
File Size | |||
</label> | |||
<label className={styles.settingsLabel}> | |||
File Name | |||
<input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least on the published sample, it doesn't seem like I'm actually able to type in this box?
@AkshatSrivastava2 are you still working on this? I can pick up if necessary, otherwise you can check out #1676 (which I think is similar) for hints. cc @loganfsmyth |
@alexzherdev If you could help me with where am I doing wrong would be great. It will be my first contribution in the open source community. |
Deploy preview for babel failed. Built with commit aeb20d1 https://app.netlify.com/sites/babel/deploys/5b50bcac792f894e8105a43d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments. Also, you're still missing a change necessary in PluginConfig.js (see my change https://github.com/babel/website/pull/1676/files#diff-70f5c2fe2441a48519c15305524aef72)
@@ -0,0 +1,36 @@ | |||
<component name="ProjectCodeStyleConfiguration"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these files in .idea/
should not be committed
@@ -154,6 +154,7 @@ require("@babel/parser").parse("code", { | |||
> NOTE: When a plugin is specified multiple times, only the first options are considered. | |||
|
|||
- `decorators`: | |||
- `decoratorsBeforeExport` (`boolean`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm why is this change here?
@@ -71,6 +71,7 @@ type State = { | |||
pluginSearch: ?string, | |||
showOfficialExternalPlugins: boolean, | |||
loadingExternalPlugins: boolean, | |||
filename: ?string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need to add the setting to the state initializer similar to https://github.com/babel/website/pull/1676/files#diff-13734ac24709204bbae97c4b659d1ba1R149
@@ -213,6 +215,15 @@ class ExpandedContainer extends Component<Props, State> { | |||
/> | |||
File Size | |||
</label> | |||
|
|||
<label className={styles.settingsLabel}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This label is missing a closing tag after the input, hence the broken build.
@@ -213,6 +215,15 @@ class ExpandedContainer extends Component<Props, State> { | |||
/> | |||
File Size | |||
</label> | |||
|
|||
<label className={styles.settingsLabel}> | |||
File Name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be indented one level deeper
<label className={styles.settingsLabel}> | ||
File Name | ||
<input | ||
type= "text" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after =
isn't necessary
type= "text" | ||
className={styles.inputFileBoxLeft} | ||
size={fileNameBoxSize} | ||
value={filename} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this controlled component to work properly, it needs to have an onChange
handler to report the changes happening to it. You can probably follow how I did it https://github.com/babel/website/pull/1676/files#diff-ecb6fb48984cd148bfc45fb63ca3f34aR225
@@ -80,6 +80,7 @@ export type PluginState = LazyLoadedState & { | |||
|
|||
export type PluginStateMap = { [name: string]: PluginState }; | |||
|
|||
export type filename = "file.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need this type, I believe what this is saying is that a filename can only be equal to file.js
, which isn't what we want.
File Name Field Add. Unable to change the file name.
Fixes #1666