diff --git a/package.json b/package.json index b85a3da..2f561a8 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,6 @@ "react": "^15.3.1" }, "dependencies": { - "babel-template": "^6.26.0", - "babel-traverse": "^6.26.0", "babylon": "^6.18.0", "lodash.isplainobject": "^4.0.6", "resolve": "^1.8.1", diff --git a/src/index.js b/src/index.js index 31aa0e3..4870724 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,5 @@ import { extname, dirname } from 'path'; import { readFileSync } from 'fs'; -import template from 'babel-template'; -import traverse from 'babel-traverse'; import { parse } from 'babylon'; import resolve from 'resolve'; @@ -10,18 +8,18 @@ import escapeBraces from './escapeBraces'; import transformSvg from './transformSvg'; import fileExistsWithCaseSync from './fileExistsWithCaseSync'; -const buildSvg = template(` +let ignoreRegex; + +export default ({ template, traverse, types: t }) => { + const buildSvg = template(` var SVG_NAME = function SVG_NAME(props) { return SVG_CODE; }; `); -const buildSvgWithDefaults = template(` + const buildSvgWithDefaults = template(` var SVG_NAME = function SVG_NAME(props) { return SVG_CODE; }; SVG_NAME.defaultProps = SVG_DEFAULT_PROPS_CODE; `); -let ignoreRegex; - -export default ({ types: t }) => { function applyPlugin(importIdentifier, importPath, path, state) { if (typeof importPath !== 'string') { throw new TypeError('`applyPlugin` `importPath` must be a string');