babel-plugin-emotion
Advanced tools
Comparing version 8.0.11 to 8.0.12
@@ -76,6 +76,5 @@ 'use strict'; | ||
if (state.opts.autoImportCssProp !== false) { | ||
if (!state.cssPropIdentifier) { | ||
state.cssPropIdentifier = (0, _helperModuleImports.addNamed)(path, 'css', 'emotion'); | ||
} | ||
return state.cssPropIdentifier; | ||
var cssImport = (0, _helperModuleImports.addNamed)(path, 'css', 'emotion'); | ||
state.cssPropIdentifiers.push(cssImport); | ||
return cssImport; | ||
} else { | ||
@@ -87,6 +86,3 @@ return t.identifier(state.importedNames.css); | ||
if (state.opts.autoImportCssProp !== false) { | ||
if (!state.cssPropMergeIdentifier) { | ||
state.cssPropMergeIdentifier = (0, _helperModuleImports.addNamed)(path, 'merge', 'emotion'); | ||
} | ||
return state.cssPropMergeIdentifier; | ||
return (0, _helperModuleImports.addNamed)(path, 'merge', 'emotion'); | ||
} else { | ||
@@ -93,0 +89,0 @@ return t.identifier(state.importedNames.merge); |
132
lib/index.js
@@ -124,3 +124,3 @@ 'use strict'; | ||
}); | ||
state.cssPropIdentifiers = []; | ||
state.extractStatic = | ||
@@ -161,3 +161,3 @@ // path.hub.file.opts.filename !== 'unknown' || | ||
CallExpression: function CallExpression(callExprPath) { | ||
if (callExprPath.node.callee.name === state.importedNames.css || callExprPath.node.callee === state.cssPropIdentifier) { | ||
if (callExprPath.node.callee.name === state.importedNames.css || state.cssPropIdentifiers.indexOf(callExprPath.node.callee) !== -1) { | ||
hoistPureArgs(callExprPath); | ||
@@ -169,42 +169,56 @@ } | ||
}, | ||
CallExpression: function CallExpression(path, state) { | ||
if (path[visited]) { | ||
return; | ||
} | ||
try { | ||
if (t.isIdentifier(path.node.callee)) { | ||
switch (path.node.callee.name) { | ||
case state.importedNames.css: | ||
case state.importedNames.keyframes: | ||
{ | ||
path.addComment('leading', '#__PURE__'); | ||
if (state.opts.autoLabel) { | ||
var identifierName = (0, _babelUtils.getIdentifierName)(path, t); | ||
if (identifierName) { | ||
path.node.arguments.push(t.stringLiteral('label:' + identifierName.trim() + ';')); | ||
CallExpression: { | ||
enter: function enter(path, state) { | ||
if (path[visited]) { | ||
return; | ||
} | ||
try { | ||
if (t.isIdentifier(path.node.callee)) { | ||
switch (path.node.callee.name) { | ||
case state.importedNames.css: | ||
case state.importedNames.keyframes: | ||
{ | ||
path.addComment('leading', '#__PURE__'); | ||
if (state.opts.autoLabel) { | ||
var identifierName = (0, _babelUtils.getIdentifierName)(path, t); | ||
if (identifierName) { | ||
path.node.arguments.push(t.stringLiteral('label:' + identifierName.trim() + ';')); | ||
} | ||
} | ||
} | ||
} | ||
// eslint-disable-next-line no-fallthrough | ||
case state.importedNames.injectGlobal: | ||
case state.importedNames.fontFace: | ||
if (state.opts.sourceMap === true && path.node.loc !== undefined) { | ||
path.node.arguments.push(t.stringLiteral((0, _sourceMap.addSourceMaps)(path.node.loc.start, state))); | ||
} | ||
// eslint-disable-next-line no-fallthrough | ||
case state.importedNames.injectGlobal: | ||
case state.importedNames.fontFace: | ||
if (state.opts.sourceMap === true && path.node.loc !== undefined) { | ||
path.node.arguments.push(t.stringLiteral((0, _sourceMap.addSourceMaps)(path.node.loc.start, state))); | ||
} | ||
} | ||
} | ||
} | ||
if (t.isCallExpression(path.node.callee) && path.node.callee.callee.name === state.importedNames.styled || t.isMemberExpression(path.node.callee) && t.isIdentifier(path.node.callee.object) && path.node.callee.object.name === state.importedNames.styled) { | ||
var identifier = t.isCallExpression(path.node.callee) ? path.node.callee.callee : path.node.callee.object; | ||
path.replaceWith(buildStyledObjectCallExpression(path, state, identifier, t)); | ||
if (t.isCallExpression(path.node.callee) && path.node.callee.callee.name === state.importedNames.styled || t.isMemberExpression(path.node.callee) && t.isIdentifier(path.node.callee.object) && path.node.callee.object.name === state.importedNames.styled) { | ||
var identifier = t.isCallExpression(path.node.callee) ? path.node.callee.callee : path.node.callee.object; | ||
path.replaceWith(buildStyledObjectCallExpression(path, state, identifier, t)); | ||
if (state.opts.hoist) { | ||
hoistPureArgs(path); | ||
if (state.opts.hoist) { | ||
hoistPureArgs(path); | ||
} | ||
} | ||
} catch (e) { | ||
throw path.buildCodeFrameError(e); | ||
} | ||
} catch (e) { | ||
throw path.buildCodeFrameError(e); | ||
path[visited] = true; | ||
}, | ||
exit: function exit(path, state) { | ||
try { | ||
if (path.node.callee && path.node.callee.property && path.node.callee.property.name === 'withComponent') { | ||
if (path.node.arguments.length === 1) { | ||
path.node.arguments.push(t.objectExpression([buildTargetObjectProperty(path, state, t)])); | ||
} | ||
} | ||
} catch (e) { | ||
throw path.buildCodeFrameError(e); | ||
} | ||
} | ||
path[visited] = true; | ||
}, | ||
@@ -225,3 +239,3 @@ TaggedTemplateExpression: function TaggedTemplateExpression(path, state) { | ||
} else if (t.isIdentifier(path.node.tag)) { | ||
if (path.node.tag.name === state.importedNames.css || path.node.tag === state.cssPropIdentifier) { | ||
if (path.node.tag.name === state.importedNames.css || state.cssPropIdentifiers.indexOf(path.node.tag) !== -1) { | ||
replaceCssWithCallExpression(path, path.node.tag, state, t); | ||
@@ -253,2 +267,6 @@ } else if (path.node.tag.name === state.importedNames.keyframes) { | ||
var _findRoot = require('find-root'); | ||
var _findRoot2 = _interopRequireDefault(_findRoot); | ||
var _path = require('path'); | ||
@@ -343,5 +361,36 @@ | ||
var getPackageRootPath = (0, _emotionUtils.memoize)(function (filename) { | ||
return (0, _findRoot2.default)(filename); | ||
}); | ||
function buildTargetObjectProperty(path, state, t) { | ||
if (state.count === undefined) { | ||
state.count = 0; | ||
} | ||
var filename = state.file.opts.filename; | ||
// normalize the file path to ignore folder structure | ||
// outside the current node project and arch-specific delimiters | ||
var moduleName = ''; | ||
var rootPath = filename; | ||
try { | ||
rootPath = getPackageRootPath(filename); | ||
moduleName = require(rootPath + '/package.json').name; | ||
} catch (err) {} | ||
var finalPath = filename === rootPath ? (0, _path.basename)(filename) : filename.slice(rootPath.length); | ||
var positionInFile = state.count++; | ||
var stableClassName = (0, _babelUtils.getName)('' + hashArray([(0, _path.normalize)(finalPath), moduleName, state.file.code]) + positionInFile, 'css'); | ||
return t.objectProperty(t.identifier('target'), t.stringLiteral(stableClassName)); | ||
} | ||
function buildStyledCallExpression(identifier, tag, path, state, t) { | ||
var identifierName = (0, _babelUtils.getIdentifierName)(path, t); | ||
var targetProperty = buildTargetObjectProperty(path, state, t); | ||
if (state.extractStatic && !path.node.quasi.expressions.length) { | ||
@@ -353,7 +402,8 @@ var _createRawStringFromT2 = (0, _babelUtils.createRawStringFromTemplateLiteral)(path.node.quasi, identifierName, 'styled' // we don't want these styles to be merged in css`` | ||
var staticClassName = 'css-' + hash; | ||
var staticClassName = (0, _babelUtils.getName)(hash, 'css'); | ||
var staticCSSRules = staticStylis('.' + staticClassName, _src); | ||
state.insertStaticRules([staticCSSRules]); | ||
return t.callExpression(t.callExpression(identifier, [tag, t.objectExpression([t.objectProperty(t.identifier('e'), t.stringLiteral(staticClassName))])]), []); | ||
return t.callExpression(t.callExpression(identifier, [tag, t.objectExpression([t.objectProperty(t.identifier('e'), t.stringLiteral(staticClassName)), targetProperty])]), []); | ||
} | ||
@@ -370,3 +420,9 @@ | ||
return t.callExpression(t.callExpression(identifier, state.opts.autoLabel && identifierName ? [tag, t.objectExpression([t.objectProperty(t.identifier('label'), t.stringLiteral(identifierName.trim()))])] : [tag]), new _astObject2.default((0, _babelUtils.minify)(src), path.node.quasi.expressions, t).toExpressions()); | ||
var labelProperty = void 0; | ||
if (state.opts.autoLabel && identifierName) { | ||
labelProperty = t.objectProperty(t.identifier('label'), t.stringLiteral(identifierName.trim())); | ||
} | ||
return t.callExpression(t.callExpression(identifier, [tag, t.objectExpression([labelProperty, targetProperty].filter(Boolean))]), new _astObject2.default((0, _babelUtils.minify)(src), path.node.quasi.expressions, t).toExpressions()); | ||
} | ||
@@ -373,0 +429,0 @@ |
@@ -15,7 +15,12 @@ 'use strict'; | ||
function getGeneratorOpts(file) { | ||
return file.opts.generatorOpts ? file.opts.generatorOpts : file.opts; | ||
} | ||
function makeSourceMapGenerator(file) { | ||
var filename = file.opts.sourceFileName; | ||
var generatorOpts = getGeneratorOpts(file); | ||
var filename = generatorOpts.sourceFileName; | ||
var generator = new _sourceMap.SourceMapGenerator({ | ||
file: filename, | ||
sourceRoot: file.opts.sourceRoot | ||
sourceRoot: generatorOpts.sourceRoot | ||
}); | ||
@@ -29,2 +34,3 @@ | ||
var generator = makeSourceMapGenerator(state.file); | ||
var generatorOpts = getGeneratorOpts(state.file); | ||
generator.addMapping({ | ||
@@ -35,3 +41,3 @@ generated: { | ||
}, | ||
source: state.file.opts.sourceFileName, | ||
source: generatorOpts.sourceFileName, | ||
original: offset | ||
@@ -38,0 +44,0 @@ }); |
{ | ||
"name": "babel-plugin-emotion", | ||
"version": "8.0.11", | ||
"version": "8.0.12", | ||
"description": "A recommended babel preprocessing plugin for emotion, The Next Generation of CSS-in-JS.", | ||
@@ -17,7 +17,8 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@babel/helper-module-imports": "7.0.0-beta.31", | ||
"@babel/helper-module-imports": "7.0.0-beta.32", | ||
"babel-macros": "^1.2.0", | ||
"babel-plugin-syntax-jsx": "^6.18.0", | ||
"convert-source-map": "^1.5.0", | ||
"emotion-utils": "^8.0.11", | ||
"emotion-utils": "^8.0.12", | ||
"find-root": "^1.1.0", | ||
"source-map": "^0.5.7", | ||
@@ -27,3 +28,3 @@ "touch": "^1.0.0" | ||
"devDependencies": { | ||
"@babel/core": "7.0.0-beta.31", | ||
"@babel/core": "7.0.0-beta.32", | ||
"babel-cli": "^6.24.1", | ||
@@ -30,0 +31,0 @@ "npm-run-all": "^4.0.2", |
@@ -15,2 +15,3 @@ # babel-plugin-emotion | ||
| styled.div`` syntax | | ✅ | Supporting the shortcut syntax without the Babel plugin requires a large list of valid elements to be included in the bundle. | | ||
| components as selectors | | ✅ | Allows an emotion component to be [used as a CSS selector](https://github.com/emotion-js/emotion/blob/master/docs/styled.md#targeting-another-emotion-component). | | ||
| Minification | | ✅ | Any leading/trailing space between properties in your `css` and `styled` blocks is removed. This can reduce the size of your final bundle. | | ||
@@ -21,3 +22,3 @@ | Dead Code Elimination | | ✅ | Uglifyjs will use the injected `/*#__PURE__*/` flag comments to mark your `css` and `styled` blocks as candidates for dead code elimination. | | ||
| `css` as Prop | | ✅ | Convenient helper for calling `css` and appending the generated className during compile time. | | ||
| Contextual Class Names | | ✅ | Generated class names include the name of the variable or component they were defined in. | ||
| Contextual Class Names | | ✅ | Generated class names include the name of the variable or component they were defined in. | ||
## Example | ||
@@ -79,3 +80,3 @@ | ||
"plugins": [ | ||
["emotion", { | ||
["emotion", { | ||
"hoist": false, | ||
@@ -98,3 +99,3 @@ "sourceMap": false, | ||
Recommended Setup | ||
Recommended Setup | ||
@@ -139,7 +140,7 @@ Use [Babel's `env` property](https://babeljs.io/docs/usage/babelrc/#env-option) | ||
- Any argument supplied to `css` or `styled` is hoisted. | ||
- Any argument supplied to `css` or `styled` is hoisted. | ||
By hoisting the argument, or assigning the value to a variable, | ||
By hoisting the argument, or assigning the value to a variable, | ||
emotion is able to leverage the use of a [WeakMap](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) | ||
[cache](https://github.com/emotion-js/emotion/blob/6257f0c9cb00db9cbd08a9d6995f335730808329/packages/emotion/src/index.js#L85-L116) to increase performance. Users of object styles will benefit the most from enabling this option. | ||
[cache](https://github.com/emotion-js/emotion/blob/6257f0c9cb00db9cbd08a9d6995f335730808329/packages/emotion/src/index.js#L85-L116) to increase performance. Users of object styles will benefit the most from enabling this option. | ||
@@ -176,3 +177,3 @@ **In** | ||
- Automatically adds the `label` property to styles so that class names generated by `css` or `styled` include the name of the variable the result is assigned to. | ||
- Automatically adds the `label` property to styles so that class names generated by `css` or `styled` include the name of the variable the result is assigned to. | ||
@@ -244,3 +245,3 @@ #### css | ||
### `importedNames` | ||
### `importedNames` | ||
@@ -264,4 +265,4 @@ | ||
- Configurable import names | ||
[**Documentation**](docs/configurable-imports.md) | ||
@@ -108,6 +108,5 @@ import { addNamed } from '@babel/helper-module-imports' | ||
if (state.opts.autoImportCssProp !== false) { | ||
if (!state.cssPropIdentifier) { | ||
state.cssPropIdentifier = addNamed(path, 'css', 'emotion') | ||
} | ||
return state.cssPropIdentifier | ||
const cssImport = addNamed(path, 'css', 'emotion') | ||
state.cssPropIdentifiers.push(cssImport) | ||
return cssImport | ||
} else { | ||
@@ -119,6 +118,3 @@ return t.identifier(state.importedNames.css) | ||
if (state.opts.autoImportCssProp !== false) { | ||
if (!state.cssPropMergeIdentifier) { | ||
state.cssPropMergeIdentifier = addNamed(path, 'merge', 'emotion') | ||
} | ||
return state.cssPropMergeIdentifier | ||
return addNamed(path, 'merge', 'emotion') | ||
} else { | ||
@@ -125,0 +121,0 @@ return t.identifier(state.importedNames.merge) |
198
src/index.js
// @flow weak | ||
import fs from 'fs' | ||
import { basename } from 'path' | ||
import findRoot from 'find-root' | ||
import { basename, normalize } from 'path' | ||
import { touchSync } from 'touch' | ||
@@ -13,3 +14,3 @@ import { addSideEffect } from '@babel/helper-module-imports' | ||
import { hashString, Stylis } from 'emotion-utils' | ||
import { hashString, Stylis, memoize } from 'emotion-utils' | ||
import { addSourceMaps } from './source-map' | ||
@@ -98,5 +99,45 @@ | ||
const getPackageRootPath = memoize(filename => findRoot(filename)) | ||
function buildTargetObjectProperty(path, state, t) { | ||
if (state.count === undefined) { | ||
state.count = 0 | ||
} | ||
const filename = state.file.opts.filename | ||
// normalize the file path to ignore folder structure | ||
// outside the current node project and arch-specific delimiters | ||
let moduleName = '' | ||
let rootPath = filename | ||
try { | ||
rootPath = getPackageRootPath(filename) | ||
moduleName = require(rootPath + '/package.json').name | ||
} catch (err) {} | ||
const finalPath = | ||
filename === rootPath ? basename(filename) : filename.slice(rootPath.length) | ||
const positionInFile = state.count++ | ||
const stableClassName = getName( | ||
`${hashArray([ | ||
normalize(finalPath), | ||
moduleName, | ||
state.file.code | ||
])}${positionInFile}`, | ||
'css' | ||
) | ||
return t.objectProperty( | ||
t.identifier('target'), | ||
t.stringLiteral(stableClassName) | ||
) | ||
} | ||
export function buildStyledCallExpression(identifier, tag, path, state, t) { | ||
const identifierName = getIdentifierName(path, t) | ||
const targetProperty = buildTargetObjectProperty(path, state, t) | ||
if (state.extractStatic && !path.node.quasi.expressions.length) { | ||
@@ -108,6 +149,7 @@ const { hash, src } = createRawStringFromTemplateLiteral( | ||
) | ||
const staticClassName = `css-${hash}` | ||
const staticClassName = getName(hash, 'css') | ||
const staticCSSRules = staticStylis(`.${staticClassName}`, src) | ||
state.insertStaticRules([staticCSSRules]) | ||
return t.callExpression( | ||
@@ -117,3 +159,4 @@ t.callExpression(identifier, [ | ||
t.objectExpression([ | ||
t.objectProperty(t.identifier('e'), t.stringLiteral(staticClassName)) | ||
t.objectProperty(t.identifier('e'), t.stringLiteral(staticClassName)), | ||
targetProperty | ||
]) | ||
@@ -133,17 +176,16 @@ ]), | ||
let labelProperty | ||
if (state.opts.autoLabel && identifierName) { | ||
labelProperty = t.objectProperty( | ||
t.identifier('label'), | ||
t.stringLiteral(identifierName.trim()) | ||
) | ||
} | ||
return t.callExpression( | ||
t.callExpression( | ||
identifier, | ||
state.opts.autoLabel && identifierName | ||
? [ | ||
tag, | ||
t.objectExpression([ | ||
t.objectProperty( | ||
t.identifier('label'), | ||
t.stringLiteral(identifierName.trim()) | ||
) | ||
]) | ||
] | ||
: [tag] | ||
), | ||
t.callExpression(identifier, [ | ||
tag, | ||
t.objectExpression([labelProperty, targetProperty].filter(Boolean)) | ||
]), | ||
new ASTObject(minify(src), path.node.quasi.expressions, t).toExpressions() | ||
@@ -290,3 +332,3 @@ ) | ||
}) | ||
state.cssPropIdentifiers = [] | ||
state.extractStatic = | ||
@@ -329,3 +371,4 @@ // path.hub.file.opts.filename !== 'unknown' || | ||
callExprPath.node.callee.name === state.importedNames.css || | ||
callExprPath.node.callee === state.cssPropIdentifier | ||
state.cssPropIdentifiers.indexOf(callExprPath.node.callee) !== | ||
-1 | ||
) { | ||
@@ -338,58 +381,79 @@ hoistPureArgs(callExprPath) | ||
}, | ||
CallExpression(path, state) { | ||
if (path[visited]) { | ||
return | ||
} | ||
try { | ||
if (t.isIdentifier(path.node.callee)) { | ||
switch (path.node.callee.name) { | ||
case state.importedNames.css: | ||
case state.importedNames.keyframes: { | ||
path.addComment('leading', '#__PURE__') | ||
if (state.opts.autoLabel) { | ||
const identifierName = getIdentifierName(path, t) | ||
if (identifierName) { | ||
CallExpression: { | ||
enter(path, state) { | ||
if (path[visited]) { | ||
return | ||
} | ||
try { | ||
if (t.isIdentifier(path.node.callee)) { | ||
switch (path.node.callee.name) { | ||
case state.importedNames.css: | ||
case state.importedNames.keyframes: { | ||
path.addComment('leading', '#__PURE__') | ||
if (state.opts.autoLabel) { | ||
const identifierName = getIdentifierName(path, t) | ||
if (identifierName) { | ||
path.node.arguments.push( | ||
t.stringLiteral(`label:${identifierName.trim()};`) | ||
) | ||
} | ||
} | ||
} | ||
// eslint-disable-next-line no-fallthrough | ||
case state.importedNames.injectGlobal: | ||
case state.importedNames.fontFace: | ||
if ( | ||
state.opts.sourceMap === true && | ||
path.node.loc !== undefined | ||
) { | ||
path.node.arguments.push( | ||
t.stringLiteral(`label:${identifierName.trim()};`) | ||
t.stringLiteral(addSourceMaps(path.node.loc.start, state)) | ||
) | ||
} | ||
} | ||
} | ||
// eslint-disable-next-line no-fallthrough | ||
case state.importedNames.injectGlobal: | ||
case state.importedNames.fontFace: | ||
if ( | ||
state.opts.sourceMap === true && | ||
path.node.loc !== undefined | ||
) { | ||
path.node.arguments.push( | ||
t.stringLiteral(addSourceMaps(path.node.loc.start, state)) | ||
) | ||
} | ||
} | ||
} | ||
if ( | ||
(t.isCallExpression(path.node.callee) && | ||
path.node.callee.callee.name === state.importedNames.styled) || | ||
(t.isMemberExpression(path.node.callee) && | ||
t.isIdentifier(path.node.callee.object) && | ||
path.node.callee.object.name === state.importedNames.styled) | ||
) { | ||
const identifier = t.isCallExpression(path.node.callee) | ||
? path.node.callee.callee | ||
: path.node.callee.object | ||
path.replaceWith( | ||
buildStyledObjectCallExpression(path, state, identifier, t) | ||
) | ||
if ( | ||
(t.isCallExpression(path.node.callee) && | ||
path.node.callee.callee.name === state.importedNames.styled) || | ||
(t.isMemberExpression(path.node.callee) && | ||
t.isIdentifier(path.node.callee.object) && | ||
path.node.callee.object.name === state.importedNames.styled) | ||
) { | ||
const identifier = t.isCallExpression(path.node.callee) | ||
? path.node.callee.callee | ||
: path.node.callee.object | ||
path.replaceWith( | ||
buildStyledObjectCallExpression(path, state, identifier, t) | ||
) | ||
if (state.opts.hoist) { | ||
hoistPureArgs(path) | ||
if (state.opts.hoist) { | ||
hoistPureArgs(path) | ||
} | ||
} | ||
} catch (e) { | ||
throw path.buildCodeFrameError(e) | ||
} | ||
} catch (e) { | ||
throw path.buildCodeFrameError(e) | ||
path[visited] = true | ||
}, | ||
exit(path, state) { | ||
try { | ||
if ( | ||
path.node.callee && | ||
path.node.callee.property && | ||
path.node.callee.property.name === 'withComponent' | ||
) { | ||
if (path.node.arguments.length === 1) { | ||
path.node.arguments.push( | ||
t.objectExpression([ | ||
buildTargetObjectProperty(path, state, t) | ||
]) | ||
) | ||
} | ||
} | ||
} catch (e) { | ||
throw path.buildCodeFrameError(e) | ||
} | ||
} | ||
path[visited] = true | ||
}, | ||
@@ -432,3 +496,3 @@ TaggedTemplateExpression(path, state) { | ||
path.node.tag.name === state.importedNames.css || | ||
path.node.tag === state.cssPropIdentifier | ||
state.cssPropIdentifiers.indexOf(path.node.tag) !== -1 | ||
) { | ||
@@ -435,0 +499,0 @@ replaceCssWithCallExpression(path, path.node.tag, state, t) |
import { SourceMapGenerator } from 'source-map' | ||
import convert from 'convert-source-map' | ||
function getGeneratorOpts(file) { | ||
return file.opts.generatorOpts ? file.opts.generatorOpts : file.opts | ||
} | ||
export function makeSourceMapGenerator(file) { | ||
const filename = file.opts.sourceFileName | ||
const generatorOpts = getGeneratorOpts(file) | ||
const filename = generatorOpts.sourceFileName | ||
const generator = new SourceMapGenerator({ | ||
file: filename, | ||
sourceRoot: file.opts.sourceRoot | ||
sourceRoot: generatorOpts.sourceRoot | ||
}) | ||
@@ -17,2 +22,3 @@ | ||
const generator = makeSourceMapGenerator(state.file) | ||
const generatorOpts = getGeneratorOpts(state.file) | ||
generator.addMapping({ | ||
@@ -23,3 +29,3 @@ generated: { | ||
}, | ||
source: state.file.opts.sourceFileName, | ||
source: generatorOpts.sourceFileName, | ||
original: offset | ||
@@ -26,0 +32,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68356
1622
261
8
5
+ Addedfind-root@^1.1.0
+ Added@babel/helper-module-imports@7.0.0-beta.32(transitive)
+ Added@babel/types@7.0.0-beta.32(transitive)
+ Addedfind-root@1.1.0(transitive)
- Removed@babel/helper-module-imports@7.0.0-beta.31(transitive)
- Removed@babel/types@7.0.0-beta.31(transitive)
Updatedemotion-utils@^8.0.12