版博士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.

chunk-M75D44JJ.mjs 1.7 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import {
  2. code_default,
  3. helperId,
  4. shouldTransform,
  5. transform,
  6. transformVueSFC
  7. } from "./chunk-RYASVNY2.mjs";
  8. // src/index.ts
  9. import { createUnplugin } from "unplugin";
  10. import {
  11. REGEX_NODE_MODULES,
  12. REGEX_SETUP_SFC,
  13. REGEX_SRC_FILE,
  14. REGEX_VUE_SFC,
  15. REGEX_VUE_SUB,
  16. createFilter,
  17. detectVueVersion,
  18. normalizePath
  19. } from "@vue-macros/common";
  20. function resolveOption(options, framework) {
  21. const version = options.version || detectVueVersion();
  22. return {
  23. include: [REGEX_SRC_FILE, REGEX_VUE_SFC, REGEX_SETUP_SFC].concat(
  24. version === 2 && framework === "webpack" ? REGEX_VUE_SUB : []
  25. ),
  26. exclude: [REGEX_NODE_MODULES],
  27. ...options,
  28. version
  29. };
  30. }
  31. var name = "unplugin-reactivity-transform";
  32. var src_default = createUnplugin(
  33. (userOptions = {}, { framework }) => {
  34. const options = resolveOption(userOptions, framework);
  35. const filter = createFilter(options);
  36. return {
  37. name,
  38. enforce: "pre",
  39. resolveId(id) {
  40. if (id === helperId)
  41. return id;
  42. },
  43. loadInclude(id) {
  44. return id === helperId;
  45. },
  46. load(_id) {
  47. const id = normalizePath(_id);
  48. if (id === helperId)
  49. return code_default;
  50. },
  51. transformInclude(id) {
  52. return filter(id);
  53. },
  54. transform(code, id) {
  55. if (REGEX_VUE_SFC.test(id) || REGEX_SETUP_SFC.test(id) || framework === "webpack" && REGEX_VUE_SUB.test(id)) {
  56. return transformVueSFC(code, id);
  57. } else {
  58. if (!shouldTransform(code))
  59. return;
  60. return transform(code, {
  61. filename: id,
  62. sourceMap: true
  63. });
  64. }
  65. }
  66. };
  67. }
  68. );
  69. export {
  70. src_default
  71. };