From 4a83b4bf1a9da60af79902932831638dd8a61de4 Mon Sep 17 00:00:00 2001 From: Yiou Chen Date: Sat, 17 Nov 2018 12:12:43 -0800 Subject: [PATCH] #14 babel plugin source map support for style and createGlobalStyle --- package.json | 4 ++- src/index.js | 6 ++-- src/utils/detectors.js | 17 ++++++++++-- src/utils/options.js | 1 + src/utils/sourceMap.js | 38 +++++++++++++++++++++++++ src/visitors/addConfig.js | 30 ++++++++++++++++++++ src/visitors/displayNameAndId.js | 39 ++++++++------------------ src/visitors/sourceMapConfig.js | 19 +++++++++++++ test/__snapshots__/index.test.js.snap | 40 +++++++++++++++++++++++++++ test/fixtures/add-sourcemap/.babelrc | 13 +++++++++ test/fixtures/add-sourcemap/index.js | 21 ++++++++++++++ yarn.lock | 12 ++++++++ 12 files changed, 207 insertions(+), 33 deletions(-) create mode 100644 src/utils/sourceMap.js create mode 100644 src/visitors/addConfig.js create mode 100644 src/visitors/sourceMapConfig.js create mode 100644 test/fixtures/add-sourcemap/.babelrc create mode 100644 test/fixtures/add-sourcemap/index.js diff --git a/package.json b/package.json index 756cf6b..ba881dc 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,9 @@ }, "dependencies": { "@babel/helper-annotate-as-pure": "^7.0.0", - "lodash": "^4.17.10" + "convert-source-map": "^1.6.0", + "lodash": "^4.17.10", + "source-map": "^0.7.3" }, "resolutions": { "babel-core": "7.0.0-bridge.0" diff --git a/src/index.js b/src/index.js index df1d220..be71865 100644 --- a/src/index.js +++ b/src/index.js @@ -3,17 +3,19 @@ import minify from './visitors/minify' import displayNameAndId from './visitors/displayNameAndId' import templateLiterals from './visitors/templateLiterals' import assignStyledRequired from './visitors/assignStyledRequired' +import addConfig from './visitors/addConfig' +import sourceMapConfig from './visitors/sourceMapConfig' export default function({ types: t }) { return { visitor: { CallExpression(path, state) { - displayNameAndId(t)(path, state) + addConfig(t)(path, state)(displayNameAndId, sourceMapConfig) pureAnnotation(t)(path, state) }, TaggedTemplateExpression(path, state) { minify(t)(path, state) - displayNameAndId(t)(path, state) + addConfig(t)(path, state)(displayNameAndId, sourceMapConfig) templateLiterals(t)(path, state) pureAnnotation(t)(path, state) }, diff --git a/src/utils/detectors.js b/src/utils/detectors.js index 902dfeb..a7c5574 100644 --- a/src/utils/detectors.js +++ b/src/utils/detectors.js @@ -87,9 +87,20 @@ export const isStyled = t => (tag, state) => { export const isCSSHelper = t => (tag, state) => t.isIdentifier(tag) && tag.name === importLocalName('css', state) -export const isCreateGlobalStyleHelper = t => (tag, state) => - t.isIdentifier(tag) && - tag.name === importLocalName('createGlobalStyle', state) +export const isCreateGlobalStyleHelper = t => (tag, state) => { + const tagName = (() => { + // handle createGlobalStyle`` + if (t.isIdentifier(tag)) { + return tag.name + } + // handle createGlobalStyle.withConfig({})`` + if (t.isCallExpression(tag) && t.isMemberExpression(tag.callee)) { + return tag.callee.object.name + } + })() + + return tagName && tagName === importLocalName('createGlobalStyle', state) +} export const isInjectGlobalHelper = t => (tag, state) => t.isIdentifier(tag) && tag.name === importLocalName('injectGlobal', state) diff --git a/src/utils/options.js b/src/utils/options.js index 5c319cd..92c8538 100644 --- a/src/utils/options.js +++ b/src/utils/options.js @@ -12,3 +12,4 @@ export const useTranspileTemplateLiterals = state => getOption(state, 'transpileTemplateLiterals') export const usePureAnnotation = state => getOption(state, 'pure', false) +export const useSourceMap = state => getOption(state, 'sourceMap', false) diff --git a/src/utils/sourceMap.js b/src/utils/sourceMap.js new file mode 100644 index 0000000..cd1a06a --- /dev/null +++ b/src/utils/sourceMap.js @@ -0,0 +1,38 @@ +// shamelessly copied and modified +// from https://github.com/emotion-js/emotion/blob/master/packages/babel-plugin-emotion/src/utils/source-maps.js +import { SourceMapGenerator } from 'source-map' +import convert from 'convert-source-map' + +function getGeneratorOpts(file) { + return file.opts.generatorOpts ? file.opts.generatorOpts : file.opts +} + +function makeSourceMapGenerator(file) { + const generatorOpts = getGeneratorOpts(file) + const filename = generatorOpts.sourceFileName + const generator = new SourceMapGenerator({ + file: filename, + sourceRoot: generatorOpts.sourceRoot, + }) + + generator.setSourceContent(filename, file.code) + return generator +} + +export function getSourceMap(offset, state) { + const { line, column } = offset + const generator = makeSourceMapGenerator(state.file) + const generatorOpts = getGeneratorOpts(state.file) + if (generatorOpts.sourceFileName) { + generator.addMapping({ + generated: { + line: 1, + column: 0, + }, + source: generatorOpts.sourceFileName, + original: offset, + }) + return convert.fromObject(generator).toComment({ multiline: true }) + } + return '' +} diff --git a/src/visitors/addConfig.js b/src/visitors/addConfig.js new file mode 100644 index 0000000..7e3ab69 --- /dev/null +++ b/src/visitors/addConfig.js @@ -0,0 +1,30 @@ +const addConfig = t => (path, state) => (...visitors) => { + const withConfigProps = [] + visitors.forEach(visitor => + withConfigProps.push(...(visitor(t)(path, state) || [])) + ) + + if (withConfigProps.length === 0) { + return + } + + if (path.node.tag) { + // Replace x`...` with x.withConfig({ })`...` + path.node.tag = t.callExpression( + t.memberExpression(path.node.tag, t.identifier('withConfig')), + [t.objectExpression(withConfigProps)] + ) + } else { + path.replaceWith( + t.callExpression( + t.callExpression( + t.memberExpression(path.node.callee, t.identifier('withConfig')), + [t.objectExpression(withConfigProps)] + ), + path.node.arguments + ) + ) + } +} + +export default addConfig diff --git a/src/visitors/displayNameAndId.js b/src/visitors/displayNameAndId.js index f266698..70de51e 100644 --- a/src/visitors/displayNameAndId.js +++ b/src/visitors/displayNameAndId.js @@ -6,9 +6,9 @@ import prefixLeadingDigit from '../utils/prefixDigit' import hash from '../utils/hash' import { isStyled } from '../utils/detectors' -const addConfig = t => (path, displayName, componentId) => { +const getConfig = t => (path, displayName, componentId, sourceMap) => { if (!displayName && !componentId) { - return + return [] } const withConfigProps = [] @@ -29,23 +29,7 @@ const addConfig = t => (path, displayName, componentId) => { ) } - if (path.node.tag) { - // Replace x`...` with x.withConfig({ })`...` - path.node.tag = t.callExpression( - t.memberExpression(path.node.tag, t.identifier('withConfig')), - [t.objectExpression(withConfigProps)] - ) - } else { - path.replaceWith( - t.callExpression( - t.callExpression( - t.memberExpression(path.node.callee, t.identifier('withConfig')), - [t.objectExpression(withConfigProps)] - ), - path.node.arguments - ) - ) - } + return withConfigProps } const getBlockName = file => { @@ -132,23 +116,24 @@ const getComponentId = state => { // Prefix the identifier with a character because CSS classes cannot start with a number return `${prefixLeadingDigit(getFileHash(state))}-${getNextId(state)}` } +export const isUnconfiguredStyled = t => (path, state) => + path.node.tag + ? isStyled(t)(path.node.tag, state) + : isStyled(t)(path.node.callee, state) && + path.node.callee.property && + path.node.callee.property.name !== 'withConfig' export default t => (path, state) => { - if ( - path.node.tag - ? isStyled(t)(path.node.tag, state) - : isStyled(t)(path.node.callee, state) && - path.node.callee.property && - path.node.callee.property.name !== 'withConfig' - ) { + if (isUnconfiguredStyled(t)(path, state)) { const displayName = useDisplayName(state) && getDisplayName(t)(path, useFileName(state) && state) - addConfig(t)( + return getConfig(t)( path, displayName && displayName.replace(/[^_a-zA-Z0-9-]/g, ''), useSSR(state) && getComponentId(state) ) } + return [] } diff --git a/src/visitors/sourceMapConfig.js b/src/visitors/sourceMapConfig.js new file mode 100644 index 0000000..7250d90 --- /dev/null +++ b/src/visitors/sourceMapConfig.js @@ -0,0 +1,19 @@ +import { getSourceMap } from '../utils/sourceMap' +import { useSourceMap } from '../utils/options' +import { isCreateGlobalStyleHelper } from '../utils/detectors' +import { isUnconfiguredStyled } from './displayNameAndId' + +export default t => (path, state) => { + const isUnconfiguredCreateGlobalStyle = + path.node.tag && isCreateGlobalStyleHelper(t)(path.node.tag, state) + if (isUnconfiguredCreateGlobalStyle || isUnconfiguredStyled(t)(path, state)) { + const sourceMap = + useSourceMap(state) && getSourceMap(path.node.quasi.loc.start, state) + if (sourceMap) { + return [ + t.objectProperty(t.identifier('sourceMap'), t.stringLiteral(sourceMap)), + ] + } + } + return [] +} diff --git a/test/__snapshots__/index.test.js.snap b/test/__snapshots__/index.test.js.snap index d998039..2bfb16a 100644 --- a/test/__snapshots__/index.test.js.snap +++ b/test/__snapshots__/index.test.js.snap @@ -84,6 +84,46 @@ const WrappedComponent = styled(Inner).withConfig({ })\`\`;" `; +exports[`fixtures should add sourcemap 1`] = ` +"const Test = styled.div.withConfig({ + displayName: \\"Test\\", + sourceMap: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUF1QiIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImNvbnN0IFRlc3QgPSBzdHlsZWQuZGl2YFxuICB3aWR0aDogMTAwJTtcbmBcbmNvbnN0IFRlc3QyID0gc3R5bGVkKCdkaXYnKWBcbiAgY29sb3I6IHJlZDtcbmBcbmNvbnN0IFRlc3QzID0gdHJ1ZSA/IHN0eWxlZC5kaXZgYCA6IHN0eWxlZC5kaXZgYFxuY29uc3Qgc3R5bGVzID0ge1xuICBPbmU6IHN0eWxlZC5kaXZgXG4gICAgY29sb3I6IHllbGxvdztcbiAgYCxcbn1cbmxldCBDb21wb25lbnRcbkNvbXBvbmVudCA9IHN0eWxlZC5kaXZgYFxuY29uc3QgV3JhcHBlZENvbXBvbmVudCA9IHN0eWxlZChJbm5lcilgYFxuXG5jb25zdCBHbG9iYWxTdHlsZSA9IGNyZWF0ZUdsb2JhbFN0eWxlYFxuICAgIGJvZHkge1xuICAgICAgICBjb2xvcjogcmVkO1xuICAgIH1cbmBcbiJdfQ== */\\" +})\`width:100%;\`; +const Test2 = styled('div').withConfig({ + displayName: \\"Test2\\", + sourceMap: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUcyQiIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImNvbnN0IFRlc3QgPSBzdHlsZWQuZGl2YFxuICB3aWR0aDogMTAwJTtcbmBcbmNvbnN0IFRlc3QyID0gc3R5bGVkKCdkaXYnKWBcbiAgY29sb3I6IHJlZDtcbmBcbmNvbnN0IFRlc3QzID0gdHJ1ZSA/IHN0eWxlZC5kaXZgYCA6IHN0eWxlZC5kaXZgYFxuY29uc3Qgc3R5bGVzID0ge1xuICBPbmU6IHN0eWxlZC5kaXZgXG4gICAgY29sb3I6IHllbGxvdztcbiAgYCxcbn1cbmxldCBDb21wb25lbnRcbkNvbXBvbmVudCA9IHN0eWxlZC5kaXZgYFxuY29uc3QgV3JhcHBlZENvbXBvbmVudCA9IHN0eWxlZChJbm5lcilgYFxuXG5jb25zdCBHbG9iYWxTdHlsZSA9IGNyZWF0ZUdsb2JhbFN0eWxlYFxuICAgIGJvZHkge1xuICAgICAgICBjb2xvcjogcmVkO1xuICAgIH1cbmBcbiJdfQ== */\\" +})\`color:red;\`; +const Test3 = true ? styled.div.withConfig({ + displayName: \\"Test3\\", + sourceMap: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU0rQiIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImNvbnN0IFRlc3QgPSBzdHlsZWQuZGl2YFxuICB3aWR0aDogMTAwJTtcbmBcbmNvbnN0IFRlc3QyID0gc3R5bGVkKCdkaXYnKWBcbiAgY29sb3I6IHJlZDtcbmBcbmNvbnN0IFRlc3QzID0gdHJ1ZSA/IHN0eWxlZC5kaXZgYCA6IHN0eWxlZC5kaXZgYFxuY29uc3Qgc3R5bGVzID0ge1xuICBPbmU6IHN0eWxlZC5kaXZgXG4gICAgY29sb3I6IHllbGxvdztcbiAgYCxcbn1cbmxldCBDb21wb25lbnRcbkNvbXBvbmVudCA9IHN0eWxlZC5kaXZgYFxuY29uc3QgV3JhcHBlZENvbXBvbmVudCA9IHN0eWxlZChJbm5lcilgYFxuXG5jb25zdCBHbG9iYWxTdHlsZSA9IGNyZWF0ZUdsb2JhbFN0eWxlYFxuICAgIGJvZHkge1xuICAgICAgICBjb2xvcjogcmVkO1xuICAgIH1cbmBcbiJdfQ== */\\" +})\`\` : styled.div.withConfig({ + displayName: \\"Test3\\", + sourceMap: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU04QyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImNvbnN0IFRlc3QgPSBzdHlsZWQuZGl2YFxuICB3aWR0aDogMTAwJTtcbmBcbmNvbnN0IFRlc3QyID0gc3R5bGVkKCdkaXYnKWBcbiAgY29sb3I6IHJlZDtcbmBcbmNvbnN0IFRlc3QzID0gdHJ1ZSA/IHN0eWxlZC5kaXZgYCA6IHN0eWxlZC5kaXZgYFxuY29uc3Qgc3R5bGVzID0ge1xuICBPbmU6IHN0eWxlZC5kaXZgXG4gICAgY29sb3I6IHllbGxvdztcbiAgYCxcbn1cbmxldCBDb21wb25lbnRcbkNvbXBvbmVudCA9IHN0eWxlZC5kaXZgYFxuY29uc3QgV3JhcHBlZENvbXBvbmVudCA9IHN0eWxlZChJbm5lcilgYFxuXG5jb25zdCBHbG9iYWxTdHlsZSA9IGNyZWF0ZUdsb2JhbFN0eWxlYFxuICAgIGJvZHkge1xuICAgICAgICBjb2xvcjogcmVkO1xuICAgIH1cbmBcbiJdfQ== */\\" +})\`\`; +const styles = { + One: styled.div.withConfig({ + displayName: \\"One\\", + sourceMap: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVFpQiIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImNvbnN0IFRlc3QgPSBzdHlsZWQuZGl2YFxuICB3aWR0aDogMTAwJTtcbmBcbmNvbnN0IFRlc3QyID0gc3R5bGVkKCdkaXYnKWBcbiAgY29sb3I6IHJlZDtcbmBcbmNvbnN0IFRlc3QzID0gdHJ1ZSA/IHN0eWxlZC5kaXZgYCA6IHN0eWxlZC5kaXZgYFxuY29uc3Qgc3R5bGVzID0ge1xuICBPbmU6IHN0eWxlZC5kaXZgXG4gICAgY29sb3I6IHllbGxvdztcbiAgYCxcbn1cbmxldCBDb21wb25lbnRcbkNvbXBvbmVudCA9IHN0eWxlZC5kaXZgYFxuY29uc3QgV3JhcHBlZENvbXBvbmVudCA9IHN0eWxlZChJbm5lcilgYFxuXG5jb25zdCBHbG9iYWxTdHlsZSA9IGNyZWF0ZUdsb2JhbFN0eWxlYFxuICAgIGJvZHkge1xuICAgICAgICBjb2xvcjogcmVkO1xuICAgIH1cbmBcbiJdfQ== */\\" + })\`color:yellow;\` +}; +let Component; +Component = styled.div.withConfig({ + displayName: \\"Component\\", + sourceMap: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWFzQiIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImNvbnN0IFRlc3QgPSBzdHlsZWQuZGl2YFxuICB3aWR0aDogMTAwJTtcbmBcbmNvbnN0IFRlc3QyID0gc3R5bGVkKCdkaXYnKWBcbiAgY29sb3I6IHJlZDtcbmBcbmNvbnN0IFRlc3QzID0gdHJ1ZSA/IHN0eWxlZC5kaXZgYCA6IHN0eWxlZC5kaXZgYFxuY29uc3Qgc3R5bGVzID0ge1xuICBPbmU6IHN0eWxlZC5kaXZgXG4gICAgY29sb3I6IHllbGxvdztcbiAgYCxcbn1cbmxldCBDb21wb25lbnRcbkNvbXBvbmVudCA9IHN0eWxlZC5kaXZgYFxuY29uc3QgV3JhcHBlZENvbXBvbmVudCA9IHN0eWxlZChJbm5lcilgYFxuXG5jb25zdCBHbG9iYWxTdHlsZSA9IGNyZWF0ZUdsb2JhbFN0eWxlYFxuICAgIGJvZHkge1xuICAgICAgICBjb2xvcjogcmVkO1xuICAgIH1cbmBcbiJdfQ== */\\" +})\`\`; +const WrappedComponent = styled(Inner).withConfig({ + displayName: \\"WrappedComponent\\", + sourceMap: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWNzQyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImNvbnN0IFRlc3QgPSBzdHlsZWQuZGl2YFxuICB3aWR0aDogMTAwJTtcbmBcbmNvbnN0IFRlc3QyID0gc3R5bGVkKCdkaXYnKWBcbiAgY29sb3I6IHJlZDtcbmBcbmNvbnN0IFRlc3QzID0gdHJ1ZSA/IHN0eWxlZC5kaXZgYCA6IHN0eWxlZC5kaXZgYFxuY29uc3Qgc3R5bGVzID0ge1xuICBPbmU6IHN0eWxlZC5kaXZgXG4gICAgY29sb3I6IHllbGxvdztcbiAgYCxcbn1cbmxldCBDb21wb25lbnRcbkNvbXBvbmVudCA9IHN0eWxlZC5kaXZgYFxuY29uc3QgV3JhcHBlZENvbXBvbmVudCA9IHN0eWxlZChJbm5lcilgYFxuXG5jb25zdCBHbG9iYWxTdHlsZSA9IGNyZWF0ZUdsb2JhbFN0eWxlYFxuICAgIGJvZHkge1xuICAgICAgICBjb2xvcjogcmVkO1xuICAgIH1cbmBcbiJdfQ== */\\" +})\`\`; +const GlobalStyle = createGlobalStyle.withConfig({ + sourceMap: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWdCcUMiLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJjb25zdCBUZXN0ID0gc3R5bGVkLmRpdmBcbiAgd2lkdGg6IDEwMCU7XG5gXG5jb25zdCBUZXN0MiA9IHN0eWxlZCgnZGl2JylgXG4gIGNvbG9yOiByZWQ7XG5gXG5jb25zdCBUZXN0MyA9IHRydWUgPyBzdHlsZWQuZGl2YGAgOiBzdHlsZWQuZGl2YGBcbmNvbnN0IHN0eWxlcyA9IHtcbiAgT25lOiBzdHlsZWQuZGl2YFxuICAgIGNvbG9yOiB5ZWxsb3c7XG4gIGAsXG59XG5sZXQgQ29tcG9uZW50XG5Db21wb25lbnQgPSBzdHlsZWQuZGl2YGBcbmNvbnN0IFdyYXBwZWRDb21wb25lbnQgPSBzdHlsZWQoSW5uZXIpYGBcblxuY29uc3QgR2xvYmFsU3R5bGUgPSBjcmVhdGVHbG9iYWxTdHlsZWBcbiAgICBib2R5IHtcbiAgICAgICAgY29sb3I6IHJlZDtcbiAgICB9XG5gXG4iXX0= */\\" +})\` + body { + color: red; + } +\`;" +`; + exports[`fixtures should allow chains of member calls 1`] = ` "const WithAttrs = styled.div.attrs({ some: 'value' diff --git a/test/fixtures/add-sourcemap/.babelrc b/test/fixtures/add-sourcemap/.babelrc new file mode 100644 index 0000000..e47adcc --- /dev/null +++ b/test/fixtures/add-sourcemap/.babelrc @@ -0,0 +1,13 @@ +{ + "plugins": [ + [ + "../../../src", + { + "ssr": false, + "fileName": false, + "transpileTemplateLiterals": false, + "sourceMap": true + } + ] + ] +} diff --git a/test/fixtures/add-sourcemap/index.js b/test/fixtures/add-sourcemap/index.js new file mode 100644 index 0000000..cd3b018 --- /dev/null +++ b/test/fixtures/add-sourcemap/index.js @@ -0,0 +1,21 @@ +const Test = styled.div` + width: 100%; +` +const Test2 = styled('div')` + color: red; +` +const Test3 = true ? styled.div`` : styled.div`` +const styles = { + One: styled.div` + color: yellow; + `, +} +let Component +Component = styled.div`` +const WrappedComponent = styled(Inner)`` + +const GlobalStyle = createGlobalStyle` + body { + color: red; + } +` diff --git a/yarn.lock b/yarn.lock index 26ce30f..7babb9a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1238,6 +1238,13 @@ convert-source-map@^1.4.0: version "1.5.1" resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" +convert-source-map@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" + integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A== + dependencies: + safe-buffer "~5.1.1" + copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" @@ -3699,6 +3706,11 @@ source-map@^0.6.0, source-map@~0.6.1: version "0.6.1" resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" +source-map@^0.7.3: + version "0.7.3" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" + integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== + spdx-correct@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40"