packages/plugin/index.js
function noncifyTag({ name, block: { nodes } }) {
      if (name === 'form' && csrfInputValueExpression) {
        nodes.unshift({
          type: 'Conditional',
          test: csrfInputValueExpression,
          consequent: {
            type: 'Block',
            nodes: [
              {
                type: 'Tag',
                name: 'input',
                selfClosing: false,
                block: {
                  type: 'Block',
                  nodes: [],
                },
                attrs: [
                  {
                    name: 'name',
                    val: stringify(csrfInputName),
                    mustEscape: true,
                  },
                  {
                    name: 'type',
                    val: '\'hidden\'',
                    mustEscape: true,
                  },
                  {
                    name: 'value',
                    val: csrfInputValueExpression,
                    mustEscape: true,
                  },
                ],
                attributeBlocks: [],
                isInline: false,
              },
            ],
          },
          alternate: null,
        });
      }
    }
function noncifyTag({ name, block: { nodes } }) {
      if (name === 'form' && csrfInputValueExpression) {
        nodes.unshift({
          type: 'Conditional',
          test: csrfInputValueExpression,
          consequent: {
            type: 'Block',
            nodes: [
              {
                type: 'Tag',
                name: 'input',
                selfClosing: false,
                block: {
                  type: 'Block',
                  nodes: [],
                },
                attrs: [
                  {
                    name: 'name',
                    val: stringify(csrfInputName),
                    mustEscape: true,
                  },
                  {
                    name: 'type',
                    val: '\'hidden\'',
                    mustEscape: true,
                  },
                  {
                    name: 'value',
                    val: csrfInputValueExpression,
                    mustEscape: true,
                  },
                ],
                attributeBlocks: [],
                isInline: false,
              },
            ],
          },
          alternate: null,
        });
      }
    }
function noncifyTag ( { name , block : { nodes } } ) { if ( name === 'form' && csrfInputValueExpression ) { nodes . unshift ( { type : 'Conditional' , test : csrfInputValueExpression , consequent : { type : 'Block' , nodes : [ { type : 'Tag' , name : 'input' , selfClosing : false , block : { type : 'Block' , nodes : [ ] , } , attrs : [ { name : 'name' , val : stringify ( csrfInputName ) , mustEscape : true , } , { name : 'type' , val : '\'hidden\'' , mustEscape : true , } , { name : 'value' , val : csrfInputValueExpression , mustEscape : true , } , ] , attributeBlocks : [ ] , isInline : false , } , ] , } , alternate : null , } ) ; } }
Add nonce attributes to tags as needed.
Add nonce attributes to tags as needed .