版博士V2.0程序
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

38 righe
927 B

  1. "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/core/index.ts
  2. var _common = require('@vue-macros/common');
  3. function transformDefineProps(code, id) {
  4. if (!code.includes(_common.DEFINE_PROPS_DOLLAR))
  5. return;
  6. const { scriptSetup, getSetupAst } = _common.parseSFC.call(void 0, code, id);
  7. if (!scriptSetup)
  8. return;
  9. const offset = scriptSetup.loc.start.offset;
  10. const s = new (0, _common.MagicString)(code);
  11. const setupAst = getSetupAst();
  12. _common.walkAST.call(void 0, setupAst, {
  13. enter(node) {
  14. if (_common.isCallOf.call(void 0, node, _common.DEFINE_PROPS_DOLLAR)) {
  15. s.overwriteNode(
  16. node.callee,
  17. // add space for fixing mapping
  18. ` ${_common.DEFINE_PROPS}`,
  19. { offset }
  20. );
  21. }
  22. }
  23. });
  24. return _common.getTransformResult.call(void 0, s, id);
  25. }
  26. exports.transformDefineProps = transformDefineProps;