版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

74 lines
1.9 KiB

  1. "use strict";Object.defineProperty(exports, "__esModule", {value: true});
  2. var _chunkUJQOYP4Ujs = require('./chunk-UJQOYP4U.js');
  3. // src/index.ts
  4. var _unplugin = require('unplugin');
  5. var _common = require('@vue-macros/common');
  6. function resolveOption(options, framework) {
  7. const version = options.version || _common.detectVueVersion.call(void 0, );
  8. return {
  9. include: [_common.REGEX_SRC_FILE, _common.REGEX_VUE_SFC, _common.REGEX_SETUP_SFC].concat(
  10. version === 2 && framework === "webpack" ? _common.REGEX_VUE_SUB : []
  11. ),
  12. exclude: [_common.REGEX_NODE_MODULES],
  13. ...options,
  14. version
  15. };
  16. }
  17. var name = "unplugin-reactivity-transform";
  18. var src_default = _unplugin.createUnplugin.call(void 0,
  19. (userOptions = {}, { framework }) => {
  20. const options = resolveOption(userOptions, framework);
  21. const filter = _common.createFilter.call(void 0, options);
  22. return {
  23. name,
  24. enforce: "pre",
  25. resolveId(id) {
  26. if (id === _chunkUJQOYP4Ujs.helperId)
  27. return id;
  28. },
  29. loadInclude(id) {
  30. return id === _chunkUJQOYP4Ujs.helperId;
  31. },
  32. load(_id) {
  33. const id = _common.normalizePath.call(void 0, _id);
  34. if (id === _chunkUJQOYP4Ujs.helperId)
  35. return _chunkUJQOYP4Ujs.code_default;
  36. },
  37. transformInclude(id) {
  38. return filter(id);
  39. },
  40. transform(code, id) {
  41. if (_common.REGEX_VUE_SFC.test(id) || _common.REGEX_SETUP_SFC.test(id) || framework === "webpack" && _common.REGEX_VUE_SUB.test(id)) {
  42. return _chunkUJQOYP4Ujs.transformVueSFC.call(void 0, code, id);
  43. } else {
  44. if (!_chunkUJQOYP4Ujs.shouldTransform.call(void 0, code))
  45. return;
  46. return _chunkUJQOYP4Ujs.transform.call(void 0, code, {
  47. filename: id,
  48. sourceMap: true
  49. });
  50. }
  51. }
  52. };
  53. }
  54. );
  55. exports.src_default = src_default;