-
Notifications
You must be signed in to change notification settings - Fork 10.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
chore(gatsby-cli): bundle ink logger #26887
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
379704b
chore(gatsby-cli): bundle ink logger
pieh 563a3f1
use shippedProposals (to handle class properties etc)
pieh c6c2368
add yoga-layout-prebuilt as dependency
pieh 8837d22
.babelrc.json -> .babelrc
pieh 49a1b72
Merge remote-tracking branch 'origin/master' into chore/bundle-cli
pieh File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,20 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/env", | ||
{ | ||
"modules": false, | ||
"shippedProposals": true, | ||
"targets": { "node": "10.13.0" } | ||
} | ||
], | ||
"@babel/preset-react" | ||
], | ||
"plugins": ["@babel/plugin-transform-runtime"], | ||
"overrides": [ | ||
{ | ||
"test": ["**/*.ts", "**/*.tsx"], | ||
"plugins": [["@babel/plugin-transform-typescript", { "isTSX": 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 @@ | ||
// This being a babel.config.js file instead of a .babelrc file allows the | ||
// packages in `internal-plugins` to be compiled with the rest of the source. | ||
// Ref: https://github.com/babel/babel/pull/7358 | ||
|
||
const configPath = require(`path`).join(__dirname, `..`, `..`, `.babelrc.js`) | ||
|
||
module.exports = require(configPath) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import resolve from "@rollup/plugin-node-resolve" | ||
import babel from "@rollup/plugin-babel" | ||
import commonjs from "@rollup/plugin-commonjs" | ||
import json from "@rollup/plugin-json" | ||
import replace from "@rollup/plugin-replace"; | ||
import autoExternal from "rollup-plugin-auto-external" | ||
import internal from "rollup-plugin-internal" | ||
|
||
import path from "path" | ||
|
||
// Rollup hoists Ink's dynamic require of react-devtools-core which causes | ||
// a window not found error so we exclude Ink's devtools file for now. | ||
function excludeDevTools() { | ||
const re = /ink/ | ||
return { | ||
name: `ignoreDevTools`, | ||
|
||
load(id) { | ||
if (id.match(re)) { | ||
if (path.parse(id).name === `devtools`) { | ||
return { code: `` } | ||
} | ||
} | ||
}, | ||
} | ||
} | ||
|
||
export default { | ||
input: `src/reporter/loggers/ink/index.tsx`, | ||
output: { | ||
file: `lib/reporter/loggers/ink/index.js`, | ||
format: `cjs`, | ||
}, | ||
cache: false, | ||
plugins: [ | ||
replace({ | ||
values: { | ||
"process.env.NODE_ENV": JSON.stringify(`production`) | ||
} | ||
}), | ||
excludeDevTools(), | ||
json(), | ||
babel({ | ||
extensions: [`.js`, `.jsx`, `.es6`, `.es`, `.mjs`, `.ts`, `.tsx`] , | ||
babelHelpers: `runtime`, | ||
skipPreflightCheck: true, | ||
exclude: `node_modules/**`, | ||
}), | ||
resolve({ | ||
extensions: [`.mjs`, `.js`, `.json`, `.node`, `.ts`, `.tsx`], | ||
dedupe: [ `react`, `ink` ] | ||
}), | ||
commonjs(), | ||
autoExternal(), | ||
internal([ | ||
`react`, | ||
`ink`, | ||
`ink-spinner` | ||
]), | ||
], | ||
external: [ | ||
`yoga-layout-prebuilt`, | ||
// Next one deserve explanation: ... it's because ink logger imports | ||
// getStore, onLogAction from higher up (../../redux). But we don't want | ||
// two copies of it - one bundled and one not, because it would result | ||
// in multiple store copies | ||
`../../redux` | ||
] | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
adding inline comment here to highlight this - this is the most fragile part of this setup