版博士V2.0程序
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

chunk-6JSA6K4E.mjs 1.5 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import {
  2. transformDefineSingle
  3. } from "./chunk-SPMTHNBU.mjs";
  4. // src/index.ts
  5. import { createUnplugin } from "unplugin";
  6. import {
  7. REGEX_SETUP_SFC,
  8. REGEX_VUE_SFC,
  9. REGEX_VUE_SUB,
  10. createFilter,
  11. detectVueVersion
  12. } from "@vue-macros/common";
  13. import { RollupResolve, setResolveTSFileIdImpl } from "@vue-macros/api";
  14. function resolveOption(options, framework) {
  15. const version = options.version || detectVueVersion();
  16. return {
  17. include: [REGEX_VUE_SFC, REGEX_SETUP_SFC].concat(
  18. version === 2 && framework === "webpack" ? REGEX_VUE_SUB : []
  19. ),
  20. isProduction: process.env.NODE_ENV === "production",
  21. ...options,
  22. version
  23. };
  24. }
  25. var name = "unplugin-vue-single-define";
  26. var src_default = createUnplugin(
  27. (userOptions = {}, { framework }) => {
  28. const options = resolveOption(userOptions, framework);
  29. const filter = createFilter(options);
  30. const { resolve, handleHotUpdate } = RollupResolve();
  31. return {
  32. name,
  33. enforce: "pre",
  34. buildStart() {
  35. if (framework === "rollup" || framework === "vite") {
  36. setResolveTSFileIdImpl(resolve(this));
  37. }
  38. },
  39. transformInclude(id) {
  40. return filter(id);
  41. },
  42. transform(code, id) {
  43. return transformDefineSingle(code, id, options.isProduction);
  44. },
  45. vite: {
  46. configResolved(config) {
  47. options.isProduction = config.isProduction;
  48. },
  49. handleHotUpdate
  50. }
  51. };
  52. }
  53. );
  54. export {
  55. src_default
  56. };