@react-vector-graphics/core
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -1,5 +0,1 @@ | ||
import { Configuration } from '@react-vector-graphics/types'; | ||
declare const run: ({ config }: { | ||
config: Configuration; | ||
}) => Promise<void>; | ||
export default run; | ||
export { run as default } from './main'; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const core_1 = require("@svgr/core"); | ||
const plugins_1 = require("./plugins"); | ||
const normalizePluginParams = (codeOrParams, prevParams) => { | ||
if (typeof codeOrParams === 'string') { | ||
return Object.assign(Object.assign({ state: {} }, prevParams), { code: codeOrParams }); | ||
} | ||
return Object.assign(Object.assign({}, prevParams), codeOrParams); | ||
}; | ||
const run = ({ config }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const pluginArgs = [{}]; | ||
for (const plugin of plugins_1.getPlugins(config)) { | ||
const [pluginFn, pluginConfig] = yield Promise.all([ | ||
plugins_1.resolvePlugin(plugin), | ||
core_1.loadConfig(config), | ||
]); | ||
const results = yield Promise.all(pluginArgs.splice(0).map((args) => __awaiter(void 0, void 0, void 0, function* () { | ||
const result = yield pluginFn(args.code, pluginConfig, args.state); | ||
return (Array.isArray(result) ? result : [result]) | ||
.filter(Boolean) | ||
.map(r => normalizePluginParams(r, args)); | ||
}))); | ||
pluginArgs.push(...pluginArgs.concat(...results)); | ||
} | ||
}); | ||
exports.default = run; | ||
var main_1 = require("./main"); | ||
exports.default = main_1.run; |
{ | ||
"name": "@react-vector-graphics/core", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Core library of react-vector-graphics", | ||
@@ -33,3 +33,3 @@ "author": "Top Hat <opensource@tophat.com>", | ||
}, | ||
"gitHead": "bae3f9b98d20f38d1e6e5fe96d36c1a7be95988f" | ||
"gitHead": "081e037a78fe7d460492046829ae36c5a9e96fb8" | ||
} |
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
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
16458
9
85