Skip to content

Instantly share code, notes, and snippets.

@NikhilVerma
Created August 21, 2023 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NikhilVerma/66b2f986433a5b2ffebf48599780eba2 to your computer and use it in GitHub Desktop.
Save NikhilVerma/66b2f986433a5b2ffebf48599780eba2 to your computer and use it in GitHub Desktop.
Volar generated virtual file for App.vue
/**
// App.vue
<script setup lang="ts">
import HelloWorld from "./components/HelloWorld.vue";
import Header from "./components/Header.vue";
import HeaderAlt from "./components/HeaderAlt.vue";
const isAlternateHeader = Math.random() > 0.5;
const items = [1, 2, 3];
const dynamicAttribute = isAlternateHeader ? 'alt-header' : 'header';
</script>
<template>
<HelloWorld msg="Vite + Vue">
<template #header>
<HeaderAlt v-if="isAlternateHeader" />
<Header v-else />
</template>
<div :[dynamicAttribute]="true" v-for="item in items" :key="item">
{{ item }}
</div>
{{ isAlternateHeader ? 'Alt header' : 'Header' }}
</HelloWorld>
</template>
**/
/* target: 3.3, extensions: [".vue"], lib: "vue", jsxSlots: false, strictTemplates: false, skipTemplateCodegen: false, nativeTags: ["html","body","base","head","link","meta","style","title","address","article","aside","footer","header","hgroup","h1","h2","h3","h4","h5","h6","nav","section","div","dd","dl","dt","figcaption","figure","picture","hr","img","li","main","ol","p","pre","ul","a","b","abbr","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rp","rt","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","area","audio","map","track","video","embed","object","param","source","canvas","script","noscript","del","ins","caption","col","colgroup","table","thead","tbody","td","th","tr","button","datalist","fieldset","form","input","label","legend","meter","optgroup","option","output","progress","select","textarea","details","dialog","menu","summary","template","blockquote","iframe","tfoot","svg","animate","animateMotion","animateTransform","circle","clipPath","color-profile","defs","desc","discard","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistanceLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","hatch","hatchpath","image","line","linearGradient","marker","mask","mesh","meshgradient","meshpatch","meshrow","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","solidcolor","stop","switch","symbol","text","textPath","tspan","unknown","use","view","slot","component"], dataAttributes: [], htmlAttributes: ["aria-*"], optionsWrapper: ["(await import('vue')).defineComponent(",")"], macros: {"defineProps":["defineProps"],"defineSlots":["defineSlots"],"defineEmits":["defineEmits"],"defineExpose":["defineExpose"],"withDefaults":["withDefaults"]}, plugins: [], hooks: [], experimentalDefinePropProposal: false, experimentalAdditionalLanguageModules: [], experimentalResolveStyleCssClasses: "scoped", experimentalModelPropName: {"":{"input":true},"value":{"input":{"type":"text"},"textarea":true,"select":true}}, experimentalUseElementAccessInTemplate: false */
import HelloWorld from "./components/HelloWorld.vue";
import Header from "./components/Header.vue";
import HeaderAlt from "./components/HeaderAlt.vue";
const {
defineProps,
defineEmits,
defineExpose,
defineOptions,
defineSlots,
defineModel,
withDefaults,
} = await import("vue");
const isAlternateHeader = Math.random() > 0.5;
const items = [1, 2, 3];
const dynamicAttribute = isAlternateHeader ? "alt-header" : "header";
const __VLS_publicComponent = (await import("vue")).defineComponent({
setup() {
return {};
},
});
const __VLS_componentsOption = {};
let __VLS_name!: "App";
function __VLS_template() {
let __VLS_ctx!: InstanceType<
__VLS_PickNotAny<typeof __VLS_publicComponent, new () => {}>
> &
InstanceType<
__VLS_PickNotAny<typeof __VLS_internalComponent, new () => {}>
> & {};
/* Components */
let __VLS_otherComponents!: NonNullable<
typeof __VLS_internalComponent extends { components: infer C } ? C : {}
> &
typeof __VLS_componentsOption;
let __VLS_own!: __VLS_SelfComponent<
typeof __VLS_name,
typeof __VLS_internalComponent &
typeof __VLS_publicComponent &
(new () => { $slots: typeof __VLS_slots })
>;
let __VLS_localComponents!: typeof __VLS_otherComponents &
Omit<typeof __VLS_own, keyof typeof __VLS_otherComponents>;
let __VLS_components!: typeof __VLS_localComponents &
__VLS_GlobalComponents &
typeof __VLS_ctx;
/* Style Scoped */
type __VLS_StyleScopedClasses = {};
let __VLS_styleScopedClasses!:
| __VLS_StyleScopedClasses
| keyof __VLS_StyleScopedClasses
| (keyof __VLS_StyleScopedClasses)[];
/* CSS variable injection */
/* CSS variable injection end */
let __VLS_resolvedLocalAndGlobalComponents!: {} & __VLS_WithComponent<
"HelloWorld",
typeof __VLS_localComponents,
"HelloWorld",
"HelloWorld",
"HelloWorld"
> &
__VLS_WithComponent<
"HeaderAlt",
typeof __VLS_localComponents,
"HeaderAlt",
"HeaderAlt",
"HeaderAlt"
> &
__VLS_WithComponent<
"Header",
typeof __VLS_localComponents,
"Header",
"Header",
"Header"
>;
__VLS_components.HelloWorld;
__VLS_components.HelloWorld;
// @ts-ignore
[HelloWorld, HelloWorld];
(({}) as __VLS_IntrinsicElements).template;
(({}) as __VLS_IntrinsicElements).template;
__VLS_components.HeaderAlt;
// @ts-ignore
[HeaderAlt];
__VLS_components.Header;
// @ts-ignore
[Header];
(({}) as __VLS_IntrinsicElements).div;
(({}) as __VLS_IntrinsicElements).div;
{
let __VLS_0!: "HelloWorld" extends keyof typeof __VLS_ctx
? typeof __VLS_ctx.HelloWorld
: (typeof __VLS_resolvedLocalAndGlobalComponents)["HelloWorld"];
const __VLS_1 = __VLS_asFunctionalComponent(
__VLS_0,
new __VLS_0({ ...{}, msg: "Vite + Vue" })
);
(({}) as { HelloWorld: typeof __VLS_0 }).HelloWorld;
(({}) as { HelloWorld: typeof __VLS_0 }).HelloWorld;
const __VLS_2 = __VLS_1(
{ ...{}, msg: "Vite + Vue" },
...__VLS_functionalComponentArgsRest(__VLS_1)
);
const __VLS_3 = __VLS_pickFunctionalComponentCtx(__VLS_0, __VLS_2)!;
{
const __VLS_4 = ({} as __VLS_IntrinsicElements)["template"];
const __VLS_5 = __VLS_asFunctionalComponent(__VLS_4, {});
(({}) as __VLS_IntrinsicElements).template;
(({}) as __VLS_IntrinsicElements).template;
const __VLS_6 = __VLS_5(
{ ...{} },
...__VLS_functionalComponentArgsRest(__VLS_5)
);
{
__VLS_3.slots!.header;
if (__VLS_ctx.isAlternateHeader) {
{
let __VLS_7!: "HeaderAlt" extends keyof typeof __VLS_ctx
? typeof __VLS_ctx.HeaderAlt
: (typeof __VLS_resolvedLocalAndGlobalComponents)["HeaderAlt"];
const __VLS_8 = __VLS_asFunctionalComponent(
__VLS_7,
new __VLS_7({ ...{} })
);
(({}) as { HeaderAlt: typeof __VLS_7 }).HeaderAlt;
const __VLS_9 = __VLS_8(
{ ...{} },
...__VLS_functionalComponentArgsRest(__VLS_8)
);
const __VLS_10 = __VLS_pickFunctionalComponentCtx(
__VLS_7,
__VLS_9
)!;
}
// @ts-ignore
[isAlternateHeader];
} else {
{
let __VLS_11!: "Header" extends keyof typeof __VLS_ctx
? typeof __VLS_ctx.Header
: (typeof __VLS_resolvedLocalAndGlobalComponents)["Header"];
const __VLS_12 = __VLS_asFunctionalComponent(
__VLS_11,
new __VLS_11({ ...{} })
);
(({}) as { Header: typeof __VLS_11 }).Header;
const __VLS_13 = __VLS_12(
{ ...{} },
...__VLS_functionalComponentArgsRest(__VLS_12)
);
const __VLS_14 = __VLS_pickFunctionalComponentCtx(
__VLS_11,
__VLS_13
)!;
}
}
}
}
for (const [item] of __VLS_getVForSourceType(__VLS_ctx.items!)) {
{
const __VLS_15 = ({} as __VLS_IntrinsicElements)["div"];
const __VLS_16 = __VLS_asFunctionalComponent(__VLS_15, {});
(({}) as __VLS_IntrinsicElements).div;
(({}) as __VLS_IntrinsicElements).div;
const __VLS_17 = __VLS_16(
{ ...{}, [__VLS_ctx.dynamicAttribute]: true, key: item },
...__VLS_functionalComponentArgsRest(__VLS_16)
);
const __VLS_18 = __VLS_pickFunctionalComponentCtx(__VLS_15, __VLS_17)!;
item;
}
// @ts-ignore
[items, dynamicAttribute];
}
__VLS_ctx.isAlternateHeader ? "Alt header" : "Header";
}
if (
typeof __VLS_styleScopedClasses === "object" &&
!Array.isArray(__VLS_styleScopedClasses)
) {
}
var __VLS_slots!: {};
// @ts-ignore
[isAlternateHeader];
return __VLS_slots;
}
const __VLS_internalComponent = (await import("vue")).defineComponent({
setup() {
return {
HelloWorld: HelloWorld as typeof HelloWorld,
Header: Header as typeof Header,
HeaderAlt: HeaderAlt as typeof HeaderAlt,
isAlternateHeader: isAlternateHeader as typeof isAlternateHeader,
items: items as typeof items,
dynamicAttribute: dynamicAttribute as typeof dynamicAttribute,
};
},
});
export default {} as typeof __VLS_publicComponent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment