index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * Alpine CSP Build.
  3. *
  4. * Alpine allows you to use JavaScript directly inside your HTML. This is an
  5. * incredibly powerful features. However, it violates the "unsafe-eval"
  6. * Content Security Policy. This alternate Alpine build provides a
  7. * more constrained API for Alpine that is also CSP-friendly...
  8. */
  9. import Alpine from 'alpinejs/src/alpine'
  10. /**
  11. * _______________________________________________________
  12. * The Evaluator
  13. * -------------------------------------------------------
  14. *
  15. * By default, Alpine's evaluator "eval"-like utilties to
  16. * interpret strings as runtime JS. We're going to use
  17. * a more CSP-friendly evaluator for this instead.
  18. */
  19. import { cspEvaluator } from './evaluator'
  20. Alpine.setEvaluator(cspEvaluator)
  21. /**
  22. * The rest of this file bootstraps Alpine the way it is
  23. * normally bootstrapped in the default build. We will
  24. * set and define it's directives, magics, etc...
  25. */
  26. import { reactive, effect, stop, toRaw } from '@vue/reactivity'
  27. Alpine.setReactivityEngine({ reactive, effect, release: stop, raw: toRaw })
  28. import 'alpinejs/src/magics/index'
  29. import 'alpinejs/src/directives/index'
  30. export default Alpine