Home / File/ compiler-options.spec.ts — vue Source File

compiler-options.spec.ts — vue Source File

Architecture documentation for compiler-options.spec.ts, a typescript file in the vue codebase. 3 imports, 0 dependents.

File typescript 3 imports

Entity Profile

Dependency Diagram

graph LR
  008bd814_59f5_e1b4_f4ff_cca26c6336f4["compiler-options.spec.ts"]
  db9e7bef_009d_3918_6e7d_543a36a38d75["vue"]
  008bd814_59f5_e1b4_f4ff_cca26c6336f4 --> db9e7bef_009d_3918_6e7d_543a36a38d75
  4dbc3487_ac58_ac8b_f95d_843b35597d46["compiler"]
  008bd814_59f5_e1b4_f4ff_cca26c6336f4 --> 4dbc3487_ac58_ac8b_f95d_843b35597d46
  a53a30c8_9418_4cc4_6709_164fca9149e1["helpers"]
  008bd814_59f5_e1b4_f4ff_cca26c6336f4 --> a53a30c8_9418_4cc4_6709_164fca9149e1
  style 008bd814_59f5_e1b4_f4ff_cca26c6336f4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import Vue from 'vue'
import { compile } from 'web/compiler'
import { getAndRemoveAttr } from 'compiler/helpers'

describe('compile options', () => {
  it('should be compiled', () => {
    const { render, staticRenderFns, errors } = compile(
      `
      <div>
        <input type="text" v-model="msg" required max="8" v-validate:field1.group1.group2>
      </div>
    `,
      {
        directives: {
          validate(el, dir) {
            if (dir.name === 'validate' && dir.arg) {
              el.validate = {
                field: dir.arg,
                groups: dir.modifiers ? Object.keys(dir.modifiers) : []
              }
            }
          }
        },
        modules: [
          {
            transformNode(el) {
              el.validators = el.validators || []
              const validators = [
                'required',
                'min',
                'max',
                'pattern',
                'maxlength',
                'minlength'
              ]
              validators.forEach(name => {
                const rule = getAndRemoveAttr(el, name)
                if (rule !== undefined) {
                  el.validators.push({ name, rule })
                }
              })
            },
            genData(el) {
              let data = ''
              if (el.validate) {
                data += `validate:${JSON.stringify(el.validate)},`
              }
              if (el.validators) {
                data += `validators:${JSON.stringify(el.validators)},`
              }
              return data
            },
            transformCode(el, code) {
              // check
              if (!el.validate || !el.validators) {
                return code
              }
              // setup validation result props
              const result = { dirty: false } // define something other prop
              el.validators.forEach(validator => {
// ... (111 more lines)

Dependencies

  • compiler
  • helpers
  • vue

Frequently Asked Questions

What does compiler-options.spec.ts do?
compiler-options.spec.ts is a source file in the vue codebase, written in typescript.
What does compiler-options.spec.ts depend on?
compiler-options.spec.ts imports 3 module(s): compiler, helpers, vue.
Where is compiler-options.spec.ts in the architecture?
compiler-options.spec.ts is located at test/unit/modules/compiler/compiler-options.spec.ts (directory: test/unit/modules/compiler).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free