-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(babel-transpiler): support .js babel config files (#1422)
The babel transpiler will now also look for babel.config.js files. New algoritm: * Check if the provided optionsFile is a `.babelrc.js`-file. If so, require and return it. * Check if the provided optionsFile is a `babel.config.js`. If so, require it, call it with an optionsApi object provided by the user and return the result
- Loading branch information
1 parent
03e6d9a
commit 9e321f0
Showing
12 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/babel-transpiler/testResources/babelProjectWithBabelConfigJs/babel.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = api => { | ||
api.cache.forever(); | ||
|
||
return { | ||
presets: ["@babel/preset-typescript"] | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-transpiler/testResources/babelProjectWithBabelConfigJs/expectedResult/foo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const foo = 4; |
1 change: 1 addition & 0 deletions
1
packages/babel-transpiler/testResources/babelProjectWithBabelConfigJs/expectedResult/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const x = 0; |
1 change: 1 addition & 0 deletions
1
packages/babel-transpiler/testResources/babelProjectWithBabelConfigJs/source/foo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const foo: number = 4; |
1 change: 1 addition & 0 deletions
1
packages/babel-transpiler/testResources/babelProjectWithBabelConfigJs/source/main.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const x: number = 0; |
3 changes: 3 additions & 0 deletions
3
packages/babel-transpiler/testResources/babelProjectWithBabelRcJs/.babelrc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: ["@babel/preset-typescript"] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-transpiler/testResources/babelProjectWithBabelRcJs/expectedResult/foo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const foo = 4; |
1 change: 1 addition & 0 deletions
1
packages/babel-transpiler/testResources/babelProjectWithBabelRcJs/expectedResult/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const x = 0; |
1 change: 1 addition & 0 deletions
1
packages/babel-transpiler/testResources/babelProjectWithBabelRcJs/source/foo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const foo: number = 4; |
1 change: 1 addition & 0 deletions
1
packages/babel-transpiler/testResources/babelProjectWithBabelRcJs/source/main.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const x: number = 0; |