Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(gatsby): Use options in gatsby-preset & use native loade… (#15875)
* chore: upgrade babel preset tests & use babel options * use babel-options for stage in js.loader * don't use custom gatsby babel-loader for dependencies * fix stage option default * fix test name * add v3 comment * add stage to identifier
- Loading branch information
1 parent
499838b
commit d1e2f44
Showing
11 changed files
with
324 additions
and
186 deletions.
There are no files selected for viewing
229 changes: 229 additions & 0 deletions
229
packages/babel-preset-gatsby/src/__tests__/__snapshots__/index.js.snap
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,229 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`babel-preset-gatsby should specify proper presets and plugins when stage is build-html 1`] = ` | ||
Object { | ||
"plugins": Array [ | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-proposal-class-properties/lib/index.js", | ||
Object { | ||
"loose": true, | ||
}, | ||
], | ||
"<PROJECT_ROOT>/node_modules/babel-plugin-macros/dist/index.js", | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js", | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-transform-runtime/lib/index.js", | ||
Object { | ||
"absoluteRuntimePath": "<PROJECT_ROOT>/packages/babel-preset-gatsby/node_modules/@babel/runtime", | ||
"corejs": false, | ||
"helpers": false, | ||
"regenerator": true, | ||
"useESModules": true, | ||
}, | ||
], | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-transform-spread/lib/index.js", | ||
Object { | ||
"loose": false, | ||
}, | ||
], | ||
"<PROJECT_ROOT>/node_modules/babel-plugin-dynamic-import-node/lib/index.js", | ||
], | ||
"presets": Array [ | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/index.js", | ||
Object { | ||
"corejs": 2, | ||
"exclude": Array [ | ||
"transform-typeof-symbol", | ||
], | ||
"loose": true, | ||
"modules": false, | ||
"targets": Object { | ||
"node": "current", | ||
}, | ||
"useBuiltIns": "usage", | ||
}, | ||
], | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/preset-react/lib/index.js", | ||
Object { | ||
"development": false, | ||
"pragma": "React.createElement", | ||
"useBuiltIns": true, | ||
}, | ||
], | ||
], | ||
} | ||
`; | ||
|
||
exports[`babel-preset-gatsby should specify proper presets and plugins when stage is build-javascript 1`] = ` | ||
Object { | ||
"plugins": Array [ | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-proposal-class-properties/lib/index.js", | ||
Object { | ||
"loose": true, | ||
}, | ||
], | ||
"<PROJECT_ROOT>/node_modules/babel-plugin-macros/dist/index.js", | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js", | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-transform-runtime/lib/index.js", | ||
Object { | ||
"absoluteRuntimePath": "<PROJECT_ROOT>/packages/babel-preset-gatsby/node_modules/@babel/runtime", | ||
"corejs": false, | ||
"helpers": false, | ||
"regenerator": true, | ||
"useESModules": true, | ||
}, | ||
], | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-transform-spread/lib/index.js", | ||
Object { | ||
"loose": false, | ||
}, | ||
], | ||
"<PROJECT_ROOT>/node_modules/babel-plugin-dynamic-import-node/lib/index.js", | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/babel-plugin-transform-react-remove-prop-types/lib/index.js", | ||
Object { | ||
"removeImport": true, | ||
}, | ||
], | ||
], | ||
"presets": Array [ | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/index.js", | ||
Object { | ||
"corejs": 2, | ||
"exclude": Array [ | ||
"transform-typeof-symbol", | ||
], | ||
"loose": true, | ||
"modules": false, | ||
"targets": undefined, | ||
"useBuiltIns": "usage", | ||
}, | ||
], | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/preset-react/lib/index.js", | ||
Object { | ||
"development": false, | ||
"pragma": "React.createElement", | ||
"useBuiltIns": true, | ||
}, | ||
], | ||
], | ||
} | ||
`; | ||
|
||
exports[`babel-preset-gatsby should specify proper presets and plugins when stage is build-stage 1`] = ` | ||
Object { | ||
"plugins": Array [ | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-proposal-class-properties/lib/index.js", | ||
Object { | ||
"loose": true, | ||
}, | ||
], | ||
"<PROJECT_ROOT>/node_modules/babel-plugin-macros/dist/index.js", | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js", | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-transform-runtime/lib/index.js", | ||
Object { | ||
"absoluteRuntimePath": "<PROJECT_ROOT>/packages/babel-preset-gatsby/node_modules/@babel/runtime", | ||
"corejs": false, | ||
"helpers": false, | ||
"regenerator": true, | ||
"useESModules": true, | ||
}, | ||
], | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-transform-spread/lib/index.js", | ||
Object { | ||
"loose": false, | ||
}, | ||
], | ||
"<PROJECT_ROOT>/node_modules/babel-plugin-dynamic-import-node/lib/index.js", | ||
], | ||
"presets": Array [ | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/index.js", | ||
Object { | ||
"corejs": 2, | ||
"exclude": Array [ | ||
"transform-typeof-symbol", | ||
], | ||
"loose": true, | ||
"modules": false, | ||
"targets": undefined, | ||
"useBuiltIns": "usage", | ||
}, | ||
], | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/preset-react/lib/index.js", | ||
Object { | ||
"development": false, | ||
"pragma": "React.createElement", | ||
"useBuiltIns": true, | ||
}, | ||
], | ||
], | ||
} | ||
`; | ||
|
||
exports[`babel-preset-gatsby should specify proper presets and plugins when stage is develop 1`] = ` | ||
Object { | ||
"plugins": Array [ | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-proposal-class-properties/lib/index.js", | ||
Object { | ||
"loose": true, | ||
}, | ||
], | ||
"<PROJECT_ROOT>/node_modules/babel-plugin-macros/dist/index.js", | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js", | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-transform-runtime/lib/index.js", | ||
Object { | ||
"absoluteRuntimePath": "<PROJECT_ROOT>/packages/babel-preset-gatsby/node_modules/@babel/runtime", | ||
"corejs": false, | ||
"helpers": true, | ||
"regenerator": true, | ||
"useESModules": true, | ||
}, | ||
], | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/plugin-transform-spread/lib/index.js", | ||
Object { | ||
"loose": false, | ||
}, | ||
], | ||
"<PROJECT_ROOT>/node_modules/babel-plugin-dynamic-import-node/lib/index.js", | ||
], | ||
"presets": Array [ | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/index.js", | ||
Object { | ||
"corejs": 2, | ||
"exclude": Array [ | ||
"transform-typeof-symbol", | ||
], | ||
"loose": true, | ||
"modules": false, | ||
"targets": undefined, | ||
"useBuiltIns": "usage", | ||
}, | ||
], | ||
Array [ | ||
"<PROJECT_ROOT>/node_modules/@babel/preset-react/lib/index.js", | ||
Object { | ||
"development": true, | ||
"pragma": "React.createElement", | ||
"useBuiltIns": true, | ||
}, | ||
], | ||
], | ||
} | ||
`; |
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 @@ | ||
const preset = require(`../dependencies`) | ||
|
||
describe(`dependencies`, () => { | ||
it(`should specify proper presets and plugins`, () => { | ||
expect(preset()).toMatchSnapshot() | ||
}) | ||
}) |
Oops, something went wrong.