Blame view

node_modules/less/test/less-bom/plugin/plugin-preeval.js 695 Bytes
ce4c83ff   wxy   初始提交
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  module.exports = {
      install({ tree: { Quoted }, visitors }, manager) {
          class Visitor {
              constructor() {
                  this.native = new visitors.Visitor(this);
  
                  this.isPreEvalVisitor = true;
                  this.isReplacing = true;
              }
  
              run(root) {
                  return this.native.visit(root);
              }
  
              visitVariable(node) {
                  if (node.name === '@replace') {
                      return new Quoted(`'`, 'bar', true);
                  }
                  return node;
              }
          }
  
          manager.addVisitor(new Visitor());
          // console.log(manager);
      },
      minVersion: [2,0,0]
  };