Skip to content

feat(runtime-vapor): onMounted and onUnMounted hook #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
093fbd9
feat(runtime-vapor): onMounted and onUnMounted hook
GaoNeng-wWw Dec 9, 2023
719601b
styles: Revision review comments
GaoNeng-wWw Dec 9, 2023
4bc650b
fix: UnMounted -> Unmounted
GaoNeng-wWw Dec 9, 2023
c301020
fix(runtime-vapor): name conflict for enum LifecycleHooks error
GaoNeng-wWw Dec 9, 2023
26308c5
feat: camel modifier for `v-bind` (#39)
LittleSound Dec 9, 2023
0521be9
fix(runtime-vapor): set isUnMountedRef to true when unmount component
GaoNeng-wWw Dec 9, 2023
341ddf0
feat(compiler-vapor/v-bind): globally allowed
sxzz Dec 9, 2023
45e86e3
fix(compiler-vapor): generate static expression
sxzz Dec 9, 2023
da8e196
refactor(compiler-vapor): v-on
sxzz Dec 9, 2023
4b4cb05
refactor: pushMulti
sxzz Dec 9, 2023
0c26b0d
feat: withIndent
sxzz Dec 9, 2023
ecf7da9
feat: pushFnCall
sxzz Dec 9, 2023
12250a8
feat(runtime-vapor): component props (#40)
ubugeeei Dec 9, 2023
b421aa9
test: combine with transform and codegen tests for `v-bind` (#45)
LittleSound Dec 9, 2023
d1dd1e1
fix(compiler-vapor): add modifier for empty v-on
sxzz Dec 9, 2023
6852ade
feat(runtime-vapor): onMounted and onUnMounted hook
GaoNeng-wWw Dec 9, 2023
98d48e7
styles: Revision review comments
GaoNeng-wWw Dec 9, 2023
4855284
fix: UnMounted -> Unmounted
GaoNeng-wWw Dec 9, 2023
cef4d28
fix(runtime-vapor): name conflict for enum LifecycleHooks error
GaoNeng-wWw Dec 9, 2023
25bdc24
fix(runtime-vapor): set isUnMountedRef to true when unmount component
GaoNeng-wWw Dec 9, 2023
bc72922
fix: Conflict Resolution
GaoNeng-wWw Dec 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/compiler-core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,17 @@ export const isMemberExpressionBrowser = (path: string): boolean => {
}

export const isMemberExpressionNode = __BROWSER__
? (NOOP as any as (path: string, context: TransformContext) => boolean)
: (path: string, context: TransformContext): boolean => {
? (NOOP as any as (
path: string,
options: Pick<TransformContext, 'expressionPlugins'>
) => boolean)
: (
path: string,
options: Pick<TransformContext, 'expressionPlugins'>
): boolean => {
try {
let ret: Expression = parseExpression(path, {
plugins: context.expressionPlugins
plugins: options.expressionPlugins
})
if (ret.type === 'TSAsExpression' || ret.type === 'TSTypeAssertion') {
ret = ret.expression
Expand Down
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`compiler: codegen v-bind > .camel modifier 1`] = `
exports[`compiler v-bind > .camel modifier 1`] = `
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';

export function render(_ctx) {
const t0 = _template("<div></div>")
const n0 = t0()
const { 0: [n1],} = _children(n0)
_effect(() => {
_setAttr(n1, "foo-bar", undefined, _ctx.id)
_setAttr(n1, "fooBar", undefined, _ctx.id)
})
return n0
}"
`;

exports[`compiler: codegen v-bind > dynamic arg 1`] = `
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';
exports[`compiler v-bind > .camel modifier w/ dynamic arg 1`] = `
"import { camelize as _camelize } from 'vue';

export function render(_ctx) {
const t0 = _template("<div></div>")
const n0 = t0()
const { 0: [n1],} = _children(n0)
_effect(() => {
_setAttr(n1, _ctx.id, undefined, _ctx.id)
_setAttr(n1, _camelize(_ctx.foo), undefined, _ctx.id)
})
return n0
}"
`;

exports[`compiler: codegen v-bind > no expression (shorthand) 1`] = `
exports[`compiler v-bind > .camel modifier w/ no expression 1`] = `
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';

export function render(_ctx) {
const t0 = _template("<div></div>")
const n0 = t0()
const { 0: [n1],} = _children(n0)
_effect(() => {
_setAttr(n1, "camel-case", undefined, _ctx.camelCase)
_setAttr(n1, "fooBar", undefined, _ctx.fooBar)
})
return n0
}"
`;

exports[`compiler: codegen v-bind > no expression 1`] = `
exports[`compiler v-bind > basic 1`] = `
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';

export function render(_ctx) {
Expand All @@ -56,17 +56,35 @@ export function render(_ctx) {
}"
`;

exports[`compiler: codegen v-bind > should error if no expression 1`] = `
"import { template as _template } from 'vue/vapor';
exports[`compiler v-bind > dynamic arg 1`] = `
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';

export function render(_ctx) {
const t0 = _template("<div arg=\\"\\"></div>")
const t0 = _template("<div></div>")
const n0 = t0()
const { 0: [n1],} = _children(n0)
_effect(() => {
_setAttr(n1, _ctx.id, undefined, _ctx.id)
})
return n0
}"
`;

exports[`compiler: codegen v-bind > simple expression 1`] = `
exports[`compiler v-bind > no expression (shorthand) 1`] = `
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';

export function render(_ctx) {
const t0 = _template("<div></div>")
const n0 = t0()
const { 0: [n1],} = _children(n0)
_effect(() => {
_setAttr(n1, "camel-case", undefined, _ctx.camelCase)
})
return n0
}"
`;

exports[`compiler v-bind > no expression 1`] = `
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';

export function render(_ctx) {
Expand All @@ -79,3 +97,13 @@ export function render(_ctx) {
return n0
}"
`;

exports[`compiler v-bind > should error if empty expression 1`] = `
"import { template as _template } from 'vue/vapor';

export function render(_ctx) {
const t0 = _template("<div arg=\\"\\"></div>")
const n0 = t0()
return n0
}"
`;
Loading