版博士V2.0程序
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

index.mjs 906 B

12345678910111213141516171819202122232425
  1. var createPlugin = function (plugin, config) {
  2. return {
  3. handler: plugin,
  4. config: config,
  5. };
  6. };
  7. createPlugin.withOptions = function (pluginFunction, configFunction) {
  8. if (configFunction === void 0) { configFunction = function () { return ({}); }; }
  9. var optionsFunction = function (options) {
  10. if (options === void 0) { options = {}; }
  11. return {
  12. __options: options,
  13. handler: pluginFunction(options),
  14. config: configFunction(options),
  15. };
  16. };
  17. optionsFunction.__isOptionsFunction = true;
  18. // Expose plugin dependencies so that `object-hash` returns a different
  19. // value if anything here changes, to ensure a rebuild is triggered.
  20. optionsFunction.__pluginFunction = pluginFunction;
  21. optionsFunction.__configFunction = configFunction;
  22. return optionsFunction;
  23. };
  24. export { createPlugin as default };