prefixIdentifiers.spec.ts — vue Source File
Architecture documentation for prefixIdentifiers.spec.ts, a typescript file in the vue codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 274291c3_092c_9022_0cef_c4d2708cc615["prefixIdentifiers.spec.ts"] 472584c7_15d2_7ac4_2300_5c0fac3bab21["prefixIdentifiers.ts"] 274291c3_092c_9022_0cef_c4d2708cc615 --> 472584c7_15d2_7ac4_2300_5c0fac3bab21 3c98115b_726f_620d_0dc3_3d696ff8a7c2["prefixIdentifiers"] 274291c3_092c_9022_0cef_c4d2708cc615 --> 3c98115b_726f_620d_0dc3_3d696ff8a7c2 1a27e6b3_7515_332e_8d02_d958c72a568c["types.ts"] 274291c3_092c_9022_0cef_c4d2708cc615 --> 1a27e6b3_7515_332e_8d02_d958c72a568c fd729ff9_ab37_2b0a_f764_780a95167427["BindingTypes"] 274291c3_092c_9022_0cef_c4d2708cc615 --> fd729ff9_ab37_2b0a_f764_780a95167427 9a86f0ef_e790_9be0_8f5d_04e887a7ec24["entry-compiler"] 274291c3_092c_9022_0cef_c4d2708cc615 --> 9a86f0ef_e790_9be0_8f5d_04e887a7ec24 99c63299_6ece_9885_d97b_6e3808997b15["prettier"] 274291c3_092c_9022_0cef_c4d2708cc615 --> 99c63299_6ece_9885_d97b_6e3808997b15 style 274291c3_092c_9022_0cef_c4d2708cc615 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { prefixIdentifiers } from '../src/prefixIdentifiers'
import { compile } from 'web/entry-compiler'
import { format } from 'prettier'
import { BindingTypes } from '../src/types'
const toFn = (source: string) => `function render(){${source}\n}`
it('should work', () => {
const { render } = compile(`<div id="app">
<div :style="{ color }">{{ foo }}</div>
<p v-for="i in list">{{ i }}</p>
<foo inline-template>
<div>{{ bar }}</div>
</foo>
</div>`)
const result = format(prefixIdentifiers(toFn(render)), {
semi: false,
parser: 'babel'
})
expect(result).not.toMatch(`_vm._c`)
expect(result).toMatch(`_vm.foo`)
expect(result).toMatch(`_vm.list`)
expect(result).toMatch(`{ color: _vm.color }`)
expect(result).not.toMatch(`_vm.i`)
expect(result).not.toMatch(`with (this)`)
expect(result).toMatchInlineSnapshot(`
"function render() {
var _vm = this,
_c = _vm._self._c
return _c(
"div",
{ attrs: { id: "app" } },
[
_c("div", { style: { color: _vm.color } }, [_vm._v(_vm._s(_vm.foo))]),
_vm._v(" "),
_vm._l(_vm.list, function (i) {
return _c("p", [_vm._v(_vm._s(i))])
}),
_vm._v(" "),
_c("foo", {
inlineTemplate: {
render: function () {
var _vm = this,
_c = _vm._self._c
return _c("div", [_vm._v(_vm._s(_vm.bar))])
},
staticRenderFns: [],
},
}),
],
2
)
}
"
`)
})
it('setup bindings', () => {
const { render } = compile(`<div @click="count++">{{ count }}</div>`)
const result = format(
prefixIdentifiers(toFn(render), false, false, undefined, {
count: BindingTypes.SETUP_REF
}),
{
semi: false,
parser: 'babel'
}
)
expect(result).toMatch(`_setup = _vm._self._setupProxy`)
expect(result).toMatch(`_setup.count++`)
expect(result).toMatch(`_vm._s(_setup.count)`)
expect(result).toMatchInlineSnapshot(`
"function render() {
var _vm = this,
_c = _vm._self._c,
_setup = _vm._self._setupProxy
return _c(
"div",
{
on: {
click: function ($event) {
_setup.count++
},
},
},
[_vm._v(_vm._s(_setup.count))]
)
}
"
`)
})
Domain
Subdomains
Functions
Dependencies
- BindingTypes
- entry-compiler
- prefixIdentifiers
- prefixIdentifiers.ts
- prettier
- types.ts
Source
Frequently Asked Questions
What does prefixIdentifiers.spec.ts do?
prefixIdentifiers.spec.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, VDom subdomain.
What functions are defined in prefixIdentifiers.spec.ts?
prefixIdentifiers.spec.ts defines 1 function(s): toFn.
What does prefixIdentifiers.spec.ts depend on?
prefixIdentifiers.spec.ts imports 6 module(s): BindingTypes, entry-compiler, prefixIdentifiers, prefixIdentifiers.ts, prettier, types.ts.
Where is prefixIdentifiers.spec.ts in the architecture?
prefixIdentifiers.spec.ts is located at packages/compiler-sfc/test/prefixIdentifiers.spec.ts (domain: VueCore, subdomain: VDom, directory: packages/compiler-sfc/test).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free