diff --git a/packages/uni-mp-compiler/__tests__/class.spec.ts b/packages/uni-mp-compiler/__tests__/class.spec.ts
index 28b03a36d369a31ab080aebb5c2dfa776f3d5d96..ecf394ba3dfa9c4ff4e3f22094cd98d987095a53 100644
--- a/packages/uni-mp-compiler/__tests__/class.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/class.spec.ts
@@ -29,14 +29,14 @@ describe('compiler: transform class', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.foo) }
+ return { a: _n(_ctx.foo) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.foo | _ctx.bar) }
+ return { a: _n(_ctx.foo | _ctx.bar) }
}`
)
})
@@ -45,14 +45,14 @@ describe('compiler: transform class', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.foo) }
+ return { a: _n(_ctx.foo) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.foo) }
+ return { a: _n(_ctx.foo) }
}`
)
})
@@ -68,7 +68,7 @@ describe('compiler: transform class', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _ctx.ok ? 1 : 0, b: _ctx.handle(_ctx.ok) ? 1 : 0, c: _ctx.ok > 1 ? 1 : 0, d: _ctx.j ? 1 : 0, e: _ctx.k, f: _ctx.l, g: _ctx.m ? 1 : 0, h: _normalizeClass(_ctx.n), i: _normalizeClass({ a: true }), j: _normalizeClass({ b: _ctx.o }) }
+ return { a: _ctx.ok ? 1 : 0, b: _ctx.handle(_ctx.ok) ? 1 : 0, c: _ctx.ok > 1 ? 1 : 0, d: _ctx.j ? 1 : 0, e: _ctx.k, f: _ctx.l, g: _ctx.m ? 1 : 0, h: _n(_ctx.n), i: _n({ a: true }), j: _n({ b: _ctx.o }) }
}`
)
})
@@ -91,14 +91,14 @@ describe('compiler: transform class', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _ctx.ok ? 1 : 0, b: _ctx.handle(_ctx.ok) ? 1 : 0, c: _ctx.ok > 1 ? 1 : 0, d: _ctx.j ? 1 : 0, e: _ctx.k, f: _ctx.l, g: _ctx.m ? 1 : 0, h: _normalizeClass(_ctx.n), i: _normalizeClass({ a: true }), j: _normalizeClass({ b: _ctx.o }) }
+ return { a: _ctx.ok ? 1 : 0, b: _ctx.handle(_ctx.ok) ? 1 : 0, c: _ctx.ok > 1 ? 1 : 0, d: _ctx.j ? 1 : 0, e: _ctx.k, f: _ctx.l, g: _ctx.m ? 1 : 0, h: _n(_ctx.n), i: _n({ a: true }), j: _n({ b: _ctx.o }) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _ctx.ok ? 1 : 0, b: _ctx.handle(_ctx.ok) ? 1 : 0, c: _ctx.ok > 1 ? 1 : 0, d: _ctx.j ? 1 : 0, e: _ctx.k, f: _ctx.l, g: _ctx.m ? 1 : 0, h: _normalizeClass(_ctx.n), i: _normalizeClass({ a: true }), j: _normalizeClass({ b: _ctx.o }) }
+ return { a: _ctx.ok ? 1 : 0, b: _ctx.handle(_ctx.ok) ? 1 : 0, c: _ctx.ok > 1 ? 1 : 0, d: _ctx.j ? 1 : 0, e: _ctx.k, f: _ctx.l, g: _ctx.m ? 1 : 0, h: _n(_ctx.n), i: _n({ a: true }), j: _n({ b: _ctx.o }) }
}`
)
})
@@ -107,21 +107,21 @@ describe('compiler: transform class', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.classA), b: _normalizeClass(\`\${_ctx.classB}\`) }
+ return { a: _n(_ctx.classA), b: _n(\`\${_ctx.classB}\`) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.classA), b: _normalizeClass(_ctx.classB) }
+ return { a: _n(_ctx.classA), b: _n(_ctx.classB) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.classA), b: _normalizeClass(_ctx.classB), c: _normalizeClass({ classC: _ctx.isC, classD: _ctx.isD }), d: _normalizeClass(_ctx.isF ? 'classF' : ''), e: _normalizeClass(_ctx.isG && 'classG'), f: _normalizeClass(_ctx.classH), g: _normalizeClass([_ctx.classI, _ctx.classJ]), h: _normalizeClass(_ctx.handle(_ctx.classK)) }
+ return { a: _n(_ctx.classA), b: _n(_ctx.classB), c: _n({ classC: _ctx.isC, classD: _ctx.isD }), d: _n(_ctx.isF ? 'classF' : ''), e: _n(_ctx.isG && 'classG'), f: _n(_ctx.classH), g: _n([_ctx.classI, _ctx.classJ]), h: _n(_ctx.handle(_ctx.classK)) }
}`
)
})
@@ -130,28 +130,28 @@ describe('compiler: transform class', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.classA), b: _normalizeClass(_ctx.classB) }
+ return { a: _n(_ctx.classA), b: _n(_ctx.classB) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.classA), b: _normalizeClass(_ctx.classB) }
+ return { a: _n(_ctx.classA), b: _n(_ctx.classB) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.classA), b: _normalizeClass(_ctx.classB), c: _normalizeClass({ classC: _ctx.isC, classD: _ctx.isD }), d: _normalizeClass(_ctx.isF ? 'classF' : ''), e: _normalizeClass(_ctx.isG && 'classG'), f: _normalizeClass(_ctx.classH), g: _normalizeClass([_ctx.classI, _ctx.classJ]), h: _normalizeClass(_ctx.handle(_ctx.classK)) }
+ return { a: _n(_ctx.classA), b: _n(_ctx.classB), c: _n({ classC: _ctx.isC, classD: _ctx.isD }), d: _n(_ctx.isF ? 'classF' : ''), e: _n(_ctx.isG && 'classG'), f: _n(_ctx.classH), g: _n([_ctx.classI, _ctx.classJ]), h: _n(_ctx.handle(_ctx.classK)) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.classA), b: _normalizeClass(_ctx.classB), c: _normalizeClass({ classC: _ctx.isC, classD: _ctx.isD }), d: _normalizeClass(_ctx.isF ? 'classF' : ''), e: _normalizeClass(_ctx.isG && 'classG'), f: _normalizeClass(_ctx.classH), g: _normalizeClass([_ctx.classI, _ctx.classJ]), h: _normalizeClass(_ctx.handle(_ctx.classK)) }
+ return { a: _n(_ctx.classA), b: _n(_ctx.classB), c: _n({ classC: _ctx.isC, classD: _ctx.isD }), d: _n(_ctx.isF ? 'classF' : ''), e: _n(_ctx.isG && 'classG'), f: _n(_ctx.classH), g: _n([_ctx.classI, _ctx.classJ]), h: _n(_ctx.handle(_ctx.classK)) }
}`
)
})
diff --git a/packages/uni-mp-compiler/__tests__/codegen.spec.ts b/packages/uni-mp-compiler/__tests__/codegen.spec.ts
index b8c221595538ae6aceea6dcce55b9b240d8a3b5e..fb6513c81c29c8e7c2880ee3a99129ccadc4b28d 100644
--- a/packages/uni-mp-compiler/__tests__/codegen.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/codegen.spec.ts
@@ -5,10 +5,10 @@ describe('compiler: codegen', () => {
assert(
``,
``,
- `import { vOn as _vOn, vFor as _vFor } from "vue"
+ `import { o as _o, f as _f } from "vue"
export function render(_ctx, _cache) {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return {}; }), b: _vOn(_ctx.onClick) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return {}; }), b: _o(_ctx.onClick) }
}`,
{ inline: false, mode: 'module', prefixIdentifiers: false }
)
@@ -18,10 +18,10 @@ export function render(_ctx, _cache) {
assert(
``,
``,
- `import { vOn as _vOn, vFor as _vFor } from "vue"
+ `import { o as _o, f as _f } from "vue"
export function render(_ctx, _cache) {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return {}; }), b: _vOn(_ctx.onClick) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return {}; }), b: _o(_ctx.onClick) }
}`,
{ inline: false, mode: 'module' }
)
@@ -35,9 +35,9 @@ export function render(_ctx, _cache) {
return function render(_ctx, _cache) {
with (_ctx) {
- const { vOn: _vOn, vFor: _vFor } = _Vue
+ const { o: _o, f: _f } = _Vue
- return { a: _vFor(items, (item, k0, i0) => { return {}; }), b: _vOn(onClick) }
+ return { a: _f(items, (item, k0, i0) => { return {}; }), b: _o(onClick) }
}
}`,
{ inline: false, mode: 'function', prefixIdentifiers: false }
@@ -47,10 +47,10 @@ return function render(_ctx, _cache) {
assert(
``,
``,
- `const { vOn: _vOn, vFor: _vFor } = Vue
+ `const { o: _o, f: _f } = Vue
return function render(_ctx, _cache) {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return {}; }), b: _vOn(_ctx.onClick) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return {}; }), b: _o(_ctx.onClick) }
}`,
{ inline: false, mode: 'function' }
)
@@ -69,7 +69,7 @@ return function render(_ctx, _cache) {
`{{hello}}`,
`{{a}}`,
`(_ctx, _cache) => {
- return { a: _toDisplayString(_ctx.hello) }
+ return { a: _t(_ctx.hello) }
}`
)
})
@@ -87,7 +87,7 @@ return function render(_ctx, _cache) {
`{{foo}}{{bar}}nested`,
`{{a}}{{b}}nested`,
`(_ctx, _cache) => {
- return { a: _toDisplayString(_ctx.foo), b: _toDisplayString(_ctx.bar) }
+ return { a: _t(_ctx.foo), b: _t(_ctx.bar) }
}`
)
})
diff --git a/packages/uni-mp-compiler/__tests__/component.spec.ts b/packages/uni-mp-compiler/__tests__/component.spec.ts
index a16459803a1c0146cb7b17ceacd6ce97431293e6..ddbce41ae2f2973cfa612d60a56704700676bb31 100644
--- a/packages/uni-mp-compiler/__tests__/component.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/component.spec.ts
@@ -43,7 +43,7 @@ describe('compiler: transform component', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-0' + '-' + i0 }; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-0' + '-' + i0 }; }) }
}`,
{
nodeTransforms: [addComponentBindLink as any],
@@ -53,7 +53,7 @@ describe('compiler: transform component', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, key, index) => { return { a: '2a9ec0b0-0' + '-' + index }; }) }
+ return { a: _f(_ctx.items, (item, key, index) => { return { a: '2a9ec0b0-0' + '-' + index }; }) }
}`,
{
nodeTransforms: [addComponentBindLink as any],
@@ -65,7 +65,7 @@ describe('compiler: transform component', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-1' + '-' + i0 + ',' + '2a9ec0b0-0' }; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-1' + '-' + i0 + ',' + '2a9ec0b0-0' }; }) }
}`,
{
nodeTransforms: [addComponentBindLink as any],
@@ -77,7 +77,7 @@ describe('compiler: transform component', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-1' + '-' + i0 + ',' + ('2a9ec0b0-0' + '-' + i0), b: '2a9ec0b0-0' + '-' + i0 }; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-1' + '-' + i0 + ',' + ('2a9ec0b0-0' + '-' + i0), b: '2a9ec0b0-0' + '-' + i0 }; }) }
}`,
{
nodeTransforms: [addComponentBindLink as any],
@@ -89,7 +89,7 @@ describe('compiler: transform component', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: _vFor(item.items, (item1, k1, i1) => { return { a: '2a9ec0b0-1' + '-' + i0 + '-' + i1 + ',' + ('2a9ec0b0-0' + '-' + i0) }; }), b: '2a9ec0b0-0' + '-' + i0 }; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return { a: _f(item.items, (item1, k1, i1) => { return { a: '2a9ec0b0-1' + '-' + i0 + '-' + i1 + ',' + ('2a9ec0b0-0' + '-' + i0) }; }), b: '2a9ec0b0-0' + '-' + i0 }; }) }
}`,
{
nodeTransforms: [addComponentBindLink as any],
diff --git a/packages/uni-mp-compiler/__tests__/ref.spec.ts b/packages/uni-mp-compiler/__tests__/ref.spec.ts
index 782a455efda4fa73a9ce2042f632d8d94ac2d929..e6a1511ecfb04cbd5da0fee3e6f655d412fa9cf0 100644
--- a/packages/uni-mp-compiler/__tests__/ref.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/ref.spec.ts
@@ -22,7 +22,7 @@ describe('compiler: transform ref', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-0' + '-' + i0 }; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-0' + '-' + i0 }; }) }
}`
)
})
diff --git a/packages/uni-mp-compiler/__tests__/scope.spec.ts b/packages/uni-mp-compiler/__tests__/scope.spec.ts
index 8cf56b7fe21f34f279cb72c7d77f64452289fa40..d6e9f413ff5e4675d30c17fa59eea1bf19f9ef9c 100644
--- a/packages/uni-mp-compiler/__tests__/scope.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/scope.spec.ts
@@ -6,7 +6,7 @@ describe('compiler: scope', () => {
`{{item.title}}`,
`{{item.a}}`,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: _toDisplayString(item.title), b: item.id, c: item.isRed ? 1 : 0, d: _vOn($event => _ctx.onClick(item)) }; }), b: _vOn(_ctx.longpress) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return { a: _t(item.title), b: item.id, c: item.isRed ? 1 : 0, d: _o($event => _ctx.onClick(item)) }; }), b: _o(_ctx.longpress) }
}`
)
})
@@ -15,21 +15,21 @@ describe('compiler: scope', () => {
`{{item.title}}{{handle(foo)}}{{item.id}}{{item1.title}}`,
`{{item.a}}{{b}}{{item.c}}{{item1.a}}`,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: _toDisplayString(item.title), b: _vFor(item.list, (item1, k1, i1) => { return { a: _toDisplayString(item1.title), b: item1.id, c: _vOn($event => _ctx.longpress(item1)) }; }), c: _toDisplayString(item.id), d: _vOn($event => _ctx.onClick(item)), e: item.id }; }), b: _toDisplayString(_ctx.handle(_ctx.foo)) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return { a: _t(item.title), b: _f(item.list, (item1, k1, i1) => { return { a: _t(item1.title), b: item1.id, c: _o($event => _ctx.longpress(item1)) }; }), c: _t(item.id), d: _o($event => _ctx.onClick(item)), e: item.id }; }), b: _t(_ctx.handle(_ctx.foo)) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: item.id }; }), b: _vFor(_ctx.item1, (item1, k1, i1) => { return { a: item1.title }; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return { a: item.id }; }), b: _f(_ctx.item1, (item1, k1, i1) => { return { a: item1.title }; }) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.weeks, (item, weekIndex, i0) => { return { a: _vFor(item, (weeks, weeksIndex, i1) => { return { a: weeksIndex, b: weeks.id }; }), b: weekIndex, c: item.id }; }) }
+ return { a: _f(_ctx.weeks, (item, weekIndex, i0) => { return { a: _f(item, (weeks, weeksIndex, i1) => { return { a: weeksIndex, b: weeks.id }; }), b: weekIndex, c: item.id }; }) }
}`
)
})
@@ -38,7 +38,7 @@ describe('compiler: scope', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return true ? { a: _ctx.id } : {}; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return true ? { a: _ctx.id } : {}; }) }
}`
)
})
@@ -47,7 +47,7 @@ describe('compiler: scope', () => {
`{{ok}}{{ok1}}{{ok2}}{{ok3}}`,
`{{b}}{{d}}{{f}}{{g}}`,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? { b: _toDisplayString(_ctx.ok) } : _ctx.ok1 ? { d: _toDisplayString(_ctx.ok1) } : _ctx.ok2 ? { f: _toDisplayString(_ctx.ok2) } : { g: _toDisplayString(_ctx.ok3) }, { c: _ctx.ok1, e: _ctx.ok2 })
+ return _e({ a: _ctx.ok }, _ctx.ok ? { b: _t(_ctx.ok) } : _ctx.ok1 ? { d: _t(_ctx.ok1) } : _ctx.ok2 ? { f: _t(_ctx.ok2) } : { g: _t(_ctx.ok3) }, { c: _ctx.ok1, e: _ctx.ok2 })
}`
)
})
@@ -56,7 +56,7 @@ describe('compiler: scope', () => {
``,
``,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? { b: _vFor(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.title }; }), c: _ctx.foo, d: _vOn(_ctx.onClick) } : _ctx.ok1 ? { f: _vFor(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.title }; }), g: _ctx.foo, h: _vOn(_ctx.onClick) } : { i: _vFor(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.title }; }), j: _ctx.foo, k: _vOn(_ctx.onClick) }, { e: _ctx.ok1 })
+ return _e({ a: _ctx.ok }, _ctx.ok ? { b: _f(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.title }; }), c: _ctx.foo, d: _o(_ctx.onClick) } : _ctx.ok1 ? { f: _f(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.title }; }), g: _ctx.foo, h: _o(_ctx.onClick) } : { i: _f(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.title }; }), j: _ctx.foo, k: _o(_ctx.onClick) }, { e: _ctx.ok1 })
}`
)
})
diff --git a/packages/uni-mp-compiler/__tests__/scopeId.spec.ts b/packages/uni-mp-compiler/__tests__/scopeId.spec.ts
index 43a6201ec40c11dcf51ab2ccf852ae7f48c08b9f..04b3b4815cd99447d7db3fdb1d9cf0bf5755b35a 100644
--- a/packages/uni-mp-compiler/__tests__/scopeId.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/scopeId.spec.ts
@@ -17,7 +17,7 @@ describe('compiler: transform scopeId', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.foo) }
+ return { a: _n(_ctx.foo) }
}`,
options
)
@@ -35,7 +35,7 @@ describe('compiler: transform scopeId', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.foo) }
+ return { a: _n(_ctx.foo) }
}`,
options
)
@@ -43,7 +43,7 @@ describe('compiler: transform scopeId', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _normalizeClass(_ctx.foo) }
+ return { a: _n(_ctx.foo) }
}`,
options
)
diff --git a/packages/uni-mp-compiler/__tests__/style.spec.ts b/packages/uni-mp-compiler/__tests__/style.spec.ts
index a9d72351715ddd3caf4713c8f3a77e296549a456..b6e68af695efedb8b222010adf18d5e030843d8e 100644
--- a/packages/uni-mp-compiler/__tests__/style.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/style.spec.ts
@@ -22,14 +22,14 @@ describe('compiler: transform style', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _stringifyStyle(_ctx.foo) }
+ return { a: _s(_ctx.foo) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _stringifyStyle(_ctx.foo | _ctx.bar) }
+ return { a: _s(_ctx.foo | _ctx.bar) }
}`
)
})
@@ -38,14 +38,14 @@ describe('compiler: transform style', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _stringifyStyle(_ctx.foo) }
+ return { a: _s(_ctx.foo) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _stringifyStyle(_ctx.foo) }
+ return { a: _s(_ctx.foo) }
}`
)
})
@@ -70,7 +70,7 @@ describe('compiler: transform style', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _ctx.handle(_ctx.bg), b: _ctx.fontWeight, c: _hyphenate(_ctx.padding), d: _ctx.box.padding, e: _stringifyStyle(_ctx.style), f: _stringifyStyle({ margin: '0px' }) }
+ return { a: _ctx.handle(_ctx.bg), b: _ctx.fontWeight, c: _h(_ctx.padding), d: _ctx.box.padding, e: _s(_ctx.style), f: _s({ margin: '0px' }) }
}`
)
})
@@ -93,14 +93,14 @@ describe('compiler: transform style', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _ctx.handle(_ctx.bg), b: _ctx.fontWeight, c: _hyphenate(_ctx.padding), d: _ctx.box.padding, e: _stringifyStyle(_ctx.style), f: _stringifyStyle({ margin: '0px' }) }
+ return { a: _ctx.handle(_ctx.bg), b: _ctx.fontWeight, c: _h(_ctx.padding), d: _ctx.box.padding, e: _s(_ctx.style), f: _s({ margin: '0px' }) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _ctx.handle(_ctx.bg), b: _ctx.fontWeight, c: _hyphenate(_ctx.padding), d: _ctx.box.padding, e: _stringifyStyle(_ctx.style), f: _stringifyStyle({ margin: '0px' }) }
+ return { a: _ctx.handle(_ctx.bg), b: _ctx.fontWeight, c: _h(_ctx.padding), d: _ctx.box.padding, e: _s(_ctx.style), f: _s({ margin: '0px' }) }
}`
)
})
@@ -109,21 +109,21 @@ describe('compiler: transform style', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _stringifyStyle(_ctx.styleA), b: _stringifyStyle(\`\${_ctx.styleB}\`) }
+ return { a: _s(_ctx.styleA), b: _s(\`\${_ctx.styleB}\`) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _stringifyStyle(_ctx.styleA), b: _stringifyStyle(_ctx.styleB) }
+ return { a: _s(_ctx.styleA), b: _s(_ctx.styleB) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _stringifyStyle(_ctx.styleA), b: _stringifyStyle(_ctx.styleB), c: _stringifyStyle({ color: 'red', fontSize: _ctx.fontSize }), d: _stringifyStyle(_ctx.styleC), e: _stringifyStyle([_ctx.styleD, _ctx.styleE]), f: _stringifyStyle(_ctx.handle(_ctx.styleF)) }
+ return { a: _s(_ctx.styleA), b: _s(_ctx.styleB), c: _s({ color: 'red', fontSize: _ctx.fontSize }), d: _s(_ctx.styleC), e: _s([_ctx.styleD, _ctx.styleE]), f: _s(_ctx.handle(_ctx.styleF)) }
}`
)
})
@@ -132,28 +132,28 @@ describe('compiler: transform style', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _stringifyStyle(_ctx.styleA), b: _stringifyStyle(_ctx.styleB) }
+ return { a: _s(_ctx.styleA), b: _s(_ctx.styleB) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _stringifyStyle(_ctx.styleA), b: _stringifyStyle(_ctx.styleB) }
+ return { a: _s(_ctx.styleA), b: _s(_ctx.styleB) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _stringifyStyle(_ctx.styleA), b: _stringifyStyle(_ctx.styleB), c: _stringifyStyle({ color: 'red', fontSize: _ctx.fontSize }), d: _stringifyStyle(_ctx.styleC), e: _stringifyStyle([_ctx.styleD, _ctx.styleE]), f: _stringifyStyle(_ctx.handle(_ctx.styleF)) }
+ return { a: _s(_ctx.styleA), b: _s(_ctx.styleB), c: _s({ color: 'red', fontSize: _ctx.fontSize }), d: _s(_ctx.styleC), e: _s([_ctx.styleD, _ctx.styleE]), f: _s(_ctx.handle(_ctx.styleF)) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _stringifyStyle(_ctx.styleA), b: _stringifyStyle(_ctx.styleB), c: _stringifyStyle({ color: 'red', fontSize: _ctx.fontSize }), d: _stringifyStyle(_ctx.styleC), e: _stringifyStyle([_ctx.styleD, _ctx.styleE]), f: _stringifyStyle(_ctx.handle(_ctx.styleF)) }
+ return { a: _s(_ctx.styleA), b: _s(_ctx.styleB), c: _s({ color: 'red', fontSize: _ctx.fontSize }), d: _s(_ctx.styleC), e: _s([_ctx.styleD, _ctx.styleE]), f: _s(_ctx.handle(_ctx.styleF)) }
}`
)
})
diff --git a/packages/uni-mp-compiler/__tests__/test.spec.ts b/packages/uni-mp-compiler/__tests__/test.spec.ts
index 05752244c5126fde21cfa6c996bc4c9c24246cdd..e828805598f724e62932844754258f542061296c 100644
--- a/packages/uni-mp-compiler/__tests__/test.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/test.spec.ts
@@ -40,7 +40,7 @@ describe('compiler', () => {
``,
`{{b}}`,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return _ctx.ok ? {} : {}; }), b: _ctx.ok }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return _ctx.ok ? {} : {}; }), b: _ctx.ok }
}`,
{
renderDataSpread: false,
diff --git a/packages/uni-mp-compiler/__tests__/vFor.spec.ts b/packages/uni-mp-compiler/__tests__/vFor.spec.ts
index e52be1b6d09a2bb21f2fcc63f443ba54f6fd414b..1a4f5b2c4a65e4b3cb7b30ea1ae3ab2fd058d8c3 100644
--- a/packages/uni-mp-compiler/__tests__/vFor.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/vFor.spec.ts
@@ -29,7 +29,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(5, (index, k0, i0) => { return {}; }) }
+ return { a: _f(5, (index, k0, i0) => { return {}; }) }
}`
)
})
@@ -38,7 +38,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return {}; }) }
}`
)
})
@@ -47,7 +47,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, ({ id, value }, k0, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, ({ id, value }, k0, i0) => { return {}; }) }
}`
)
})
@@ -56,7 +56,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, ([id, value], k0, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, ([id, value], k0, i0) => { return {}; }) }
}`
)
})
@@ -65,7 +65,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, key, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, (item, key, i0) => { return {}; }) }
}`
)
})
@@ -74,7 +74,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, key, index) => { return {}; }) }
+ return { a: _f(_ctx.items, (item, key, index) => { return {}; }) }
}`
)
})
@@ -83,7 +83,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (value, k0, index) => { return {}; }) }
+ return { a: _f(_ctx.items, (value, k0, index) => { return {}; }) }
}`
)
})
@@ -92,7 +92,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (v0, k0, index) => { return {}; }) }
+ return { a: _f(_ctx.items, (v0, k0, index) => { return {}; }) }
}`
)
})
@@ -101,7 +101,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return {}; }) }
}`
)
})
@@ -110,7 +110,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, key, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, (item, key, i0) => { return {}; }) }
}`
)
})
@@ -119,7 +119,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (value, key, index) => { return {}; }) }
+ return { a: _f(_ctx.items, (value, key, index) => { return {}; }) }
}`
)
})
@@ -128,7 +128,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (value, k0, index) => { return {}; }) }
+ return { a: _f(_ctx.items, (value, k0, index) => { return {}; }) }
}`
)
})
@@ -137,7 +137,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (v0, k0, index) => { return {}; }) }
+ return { a: _f(_ctx.items, (v0, k0, index) => { return {}; }) }
}`
)
})
@@ -146,7 +146,7 @@ describe(`compiler: v-for`, () => {
`hello`,
`hello`,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return {}; }) }
}`
)
})
@@ -155,7 +155,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return {}; }) }
}`
)
})
@@ -165,7 +165,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.id }; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return { a: item.id, b: item.id }; }) }
}`
)
})
@@ -174,7 +174,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return {}; }) }
}`
)
})
@@ -183,7 +183,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return {}; }) }
}`
)
})
@@ -192,7 +192,7 @@ describe(`compiler: v-for`, () => {
`hello`,
`hello`,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return {}; }) }
}`
)
})
@@ -201,7 +201,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? { b: _vFor(_ctx.list, (i, k0, i0) => { return {}; }) } : {})
+ return _e({ a: _ctx.ok }, _ctx.ok ? { b: _f(_ctx.list, (i, k0, i0) => { return {}; }) } : {})
}`
)
})
@@ -211,7 +211,7 @@ describe(`compiler: v-for`, () => {
``,
``,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? { b: _vFor(_ctx.list, (i, k0, i0) => { return {}; }) } : {})
+ return _e({ a: _ctx.ok }, _ctx.ok ? { b: _f(_ctx.list, (i, k0, i0) => { return {}; }) } : {})
}`
)
})
@@ -615,7 +615,7 @@ describe(`compiler: v-for`, () => {
`test`,
`test`,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: _ctx.itemKey(item) }; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return { a: _ctx.itemKey(item) }; }) }
}`
)
})
@@ -626,7 +626,7 @@ describe(`compiler: v-for`, () => {
`test`,
`test`,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: _ctx.itemKey(item) }; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return { a: _ctx.itemKey(item) }; }) }
}`
)
})
@@ -636,7 +636,7 @@ describe(`compiler: v-for`, () => {
`test`,
`test`,
`(_ctx, _cache) => {
- return { a: _vFor(_ctx.items, (item, k0, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return {}; }) }
}`
)
})
diff --git a/packages/uni-mp-compiler/__tests__/vIf.spec.ts b/packages/uni-mp-compiler/__tests__/vIf.spec.ts
index 82aba6e2fa61ff7649a1aed1e742f6e4df23d425..f24fb839674fbc1c3c5be734833f768f416e27af 100644
--- a/packages/uni-mp-compiler/__tests__/vIf.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/vIf.spec.ts
@@ -29,7 +29,7 @@ describe(`compiler: v-if`, () => {
``,
``,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? {} : {})
+ return _e({ a: _ctx.ok }, _ctx.ok ? {} : {})
}`
)
})
@@ -38,7 +38,7 @@ describe(`compiler: v-if`, () => {
`hello`,
`hello`,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? {} : {})
+ return _e({ a: _ctx.ok }, _ctx.ok ? {} : {})
}`
)
})
@@ -47,7 +47,7 @@ describe(`compiler: v-if`, () => {
``,
``,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? {} : {})
+ return _e({ a: _ctx.ok }, _ctx.ok ? {} : {})
}`
)
})
@@ -56,7 +56,7 @@ describe(`compiler: v-if`, () => {
``,
``,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? {} : {})
+ return _e({ a: _ctx.ok }, _ctx.ok ? {} : {})
}`
)
})
@@ -65,7 +65,7 @@ describe(`compiler: v-if`, () => {
// ``,
// ``,
// `(_ctx, _cache) => {
- // return _extend({ a: _ctx.ok }, _ctx.ok ? {} : {})
+ // return _e({ a: _ctx.ok }, _ctx.ok ? {} : {})
// }`
// )
})
@@ -74,7 +74,7 @@ describe(`compiler: v-if`, () => {
``,
``,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? {} : {})
+ return _e({ a: _ctx.ok }, _ctx.ok ? {} : {})
}`
)
})
@@ -83,7 +83,7 @@ describe(`compiler: v-if`, () => {
``,
``,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? {} : _ctx.orNot ? {} : {}, { b: _ctx.orNot })
+ return _e({ a: _ctx.ok }, _ctx.ok ? {} : _ctx.orNot ? {} : {}, { b: _ctx.orNot })
}`
)
})
@@ -92,7 +92,7 @@ describe(`compiler: v-if`, () => {
`fine`,
`fine`,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? {} : _ctx.orNot ? {} : {}, { b: _ctx.orNot })
+ return _e({ a: _ctx.ok }, _ctx.ok ? {} : _ctx.orNot ? {} : {}, { b: _ctx.orNot })
}`
)
})
@@ -119,7 +119,7 @@ describe(`compiler: v-if`, () => {
`fine`,
`fine`,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? {} : _ctx.orNot ? {} : 3 ? {} : {}, { b: _ctx.orNot })
+ return _e({ a: _ctx.ok }, _ctx.ok ? {} : _ctx.orNot ? {} : 3 ? {} : {}, { b: _ctx.orNot })
}`
)
})
@@ -134,7 +134,7 @@ describe(`compiler: v-if`, () => {
`,
`fine`,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? {} : _ctx.orNot ? {} : {}, { b: _ctx.orNot })
+ return _e({ a: _ctx.ok }, _ctx.ok ? {} : _ctx.orNot ? {} : {}, { b: _ctx.orNot })
}`
)
})
@@ -143,7 +143,7 @@ describe(`compiler: v-if`, () => {
` `,
``,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? {} : _ctx.no ? {} : {}, { b: _ctx.no })
+ return _e({ a: _ctx.ok }, _ctx.ok ? {} : _ctx.no ? {} : {}, { b: _ctx.no })
}`
)
})
@@ -163,7 +163,7 @@ describe(`compiler: v-if`, () => {
`,
``,
`(_ctx, _cache) => {
- return _extend({ a: _ctx.ok }, _ctx.ok ? _extend({ b: _ctx.ok2 }, _ctx.ok2 ? {} : {}) : {})
+ return _e({ a: _ctx.ok }, _ctx.ok ? _e({ b: _ctx.ok2 }, _ctx.ok2 ? {} : {}) : {})
}`
)
})
diff --git a/packages/uni-mp-compiler/__tests__/vModel.spec.ts b/packages/uni-mp-compiler/__tests__/vModel.spec.ts
index 43c3785b26e2ecb7ddbb1f0afda494a3a50d6471..ba68395edb9cdceb365666997085e2b55ec60098 100644
--- a/packages/uni-mp-compiler/__tests__/vModel.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/vModel.spec.ts
@@ -6,7 +6,7 @@ describe('compiler: transform v-model', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _ctx.model, b: _vOn($event => _ctx.model = $event) }
+ return { a: _ctx.model, b: _o($event => _ctx.model = $event) }
}`
)
})
@@ -15,7 +15,7 @@ describe('compiler: transform v-model', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _ctx.model, b: _vOn($event => _ctx.model = $event) }
+ return { a: _ctx.model, b: _o($event => _ctx.model = $event) }
}`,
{
cacheHandlers: true,
@@ -27,14 +27,14 @@ describe('compiler: transform v-model', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _ctx.model, b: _vOn($event => _ctx.model = $event.detail.value) }
+ return { a: _ctx.model, b: _o($event => _ctx.model = $event.detail.value) }
}`
)
assert(
``,
``,
`(_ctx, _cache) => {
- return { a: _ctx.model, b: _vOn($event => _ctx.model = $event.detail.value) }
+ return { a: _ctx.model, b: _o($event => _ctx.model = $event.detail.value) }
}`
)
})
@@ -43,7 +43,7 @@ describe('compiler: transform v-model', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vOn([$event => _ctx.model = $event.detail.value, _ctx.input]), b: _ctx.model }
+ return { a: _o([$event => _ctx.model = $event.detail.value, _ctx.input]), b: _ctx.model }
}`
)
})
diff --git a/packages/uni-mp-compiler/__tests__/vOn.mp.spec.ts b/packages/uni-mp-compiler/__tests__/vOn.mp.spec.ts
index c518d5cceb5916a9e0e1114106eaab64b3caff4a..1a96247cb53c598a0558ac812260fcc664930f66 100644
--- a/packages/uni-mp-compiler/__tests__/vOn.mp.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/vOn.mp.spec.ts
@@ -25,7 +25,7 @@ describe('compiler(mp): transform v-on', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vOn(_ctx.ready) }
+ return { a: _o(_ctx.ready) }
}`
)
})
diff --git a/packages/uni-mp-compiler/__tests__/vOn.spec.ts b/packages/uni-mp-compiler/__tests__/vOn.spec.ts
index 7c6b3252b31e3a60253638ab69d6a6713bc0aa06..888c762824506090057bca82306aad5ca3143c36 100644
--- a/packages/uni-mp-compiler/__tests__/vOn.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/vOn.spec.ts
@@ -17,7 +17,7 @@ describe('compiler: transform v-on', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vOn(_ctx.onClick) }
+ return { a: _o(_ctx.onClick) }
}`
)
})
@@ -35,7 +35,7 @@ describe('compiler: transform v-on', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vOn($event => _ctx.i++) }
+ return { a: _o($event => _ctx.i++) }
}`
)
})
@@ -44,7 +44,7 @@ describe('compiler: transform v-on', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vOn($event => { _ctx.foo(); _ctx.bar(); }) }
+ return { a: _o($event => { _ctx.foo(); _ctx.bar(); }) }
}`
)
})
@@ -54,9 +54,9 @@ describe('compiler: transform v-on', () => {
``,
`(_ctx, _cache) => {
with (_ctx) {
- const { vOn: _vOn } = _Vue
+ const { o: _o } = _Vue
- return { a: _vOn($event => { foo(); bar(); }) }
+ return { a: _o($event => { foo(); bar(); }) }
}
}`,
{ prefixIdentifiers: false, mode: 'function' }
@@ -67,7 +67,7 @@ describe('compiler: transform v-on', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vOn($event => _ctx.foo($event)) }
+ return { a: _o($event => _ctx.foo($event)) }
}`
)
})
@@ -76,7 +76,7 @@ describe('compiler: transform v-on', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vOn($event => { _ctx.foo($event); _ctx.bar(); }) }
+ return { a: _o($event => { _ctx.foo($event); _ctx.bar(); }) }
}`
)
})
@@ -85,7 +85,7 @@ describe('compiler: transform v-on', () => {
` foo($event)"/>`,
``,
`(_ctx, _cache) => {
- return { a: _vOn($event => _ctx.foo($event)) }
+ return { a: _o($event => _ctx.foo($event)) }
}`
)
})
@@ -98,7 +98,7 @@ describe('compiler: transform v-on', () => {
"/>`,
``,
`(_ctx, _cache) => {
- return { a: _vOn($event => { _ctx.foo($event); }) }
+ return { a: _o($event => { _ctx.foo($event); }) }
}`
)
})
@@ -111,7 +111,7 @@ describe('compiler: transform v-on', () => {
"/>`,
``,
`(_ctx, _cache) => {
- return { a: _vOn(function ($event) { _ctx.foo($event); }) }
+ return { a: _o(function ($event) { _ctx.foo($event); }) }
}`
)
})
@@ -121,9 +121,9 @@ describe('compiler: transform v-on', () => {
``,
`(_ctx, _cache) => {
with (_ctx) {
- const { vOn: _vOn } = _Vue
+ const { o: _o } = _Vue
- return { a: _vOn(a['b' + c]) }
+ return { a: _o(a['b' + c]) }
}
}`,
{
@@ -137,7 +137,7 @@ describe('compiler: transform v-on', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vOn(_ctx.a['b' + _ctx.c]) }
+ return { a: _o(_ctx.a['b' + _ctx.c]) }
}`
)
})
@@ -146,7 +146,7 @@ describe('compiler: transform v-on', () => {
` foo(e)"/>`,
``,
`(_ctx, _cache) => {
- return { a: _vOn(e => _ctx.foo(e)) }
+ return { a: _o(e => _ctx.foo(e)) }
}`
)
})
@@ -178,7 +178,7 @@ describe('compiler: transform v-on', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vOn(_ctx.onMount) }
+ return { a: _o(_ctx.onMount) }
}`
)
})
@@ -188,7 +188,7 @@ describe('compiler: transform v-on', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vOn(_ctx.onMount) }
+ return { a: _o(_ctx.onMount) }
}`
)
})
@@ -199,7 +199,7 @@ describe('compiler: transform v-on', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _vOn(() => {}) }
+ return { a: _o(() => {}) }
}`
)
})
diff --git a/packages/uni-mp-compiler/__tests__/vSlot.spec.ts b/packages/uni-mp-compiler/__tests__/vSlot.spec.ts
index d016c43745d1f8a397feb59373fa3af2e3963ce9..dfb4879480b917b30e7284382e92619a6c54e4eb 100644
--- a/packages/uni-mp-compiler/__tests__/vSlot.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/vSlot.spec.ts
@@ -32,7 +32,7 @@ describe('compiler: transform v-slot', () => {
`{{ slotProps.item }}`,
`{{a}}`,
`(_ctx, _cache) => {
- return { a: _toDisplayString(_ctx.slotProps.item), b: slotProps }
+ return { a: _t(_ctx.slotProps.item), b: slotProps }
}`
)
})
diff --git a/packages/uni-mp-compiler/src/runtimeHelpers.ts b/packages/uni-mp-compiler/src/runtimeHelpers.ts
index d8fe870214889e64cbab645893043e6671058756..90068b4f497024440b2a3c2a84c7d31ac8f7bf2a 100644
--- a/packages/uni-mp-compiler/src/runtimeHelpers.ts
+++ b/packages/uni-mp-compiler/src/runtimeHelpers.ts
@@ -3,12 +3,18 @@ import { registerRuntimeHelpers } from '@vue/compiler-core'
export const V_ON = Symbol(`vOn`)
export const V_FOR = Symbol(`vFor`)
export const EXTEND = Symbol(`extend`)
+export const CAMELIZE = Symbol(`camelize`)
export const HYPHENATE = Symbol(`hyphenate`)
export const STRINGIFY_STYLE = Symbol(`stringifyStyle`)
+export const NORMALIZE_CLASS = Symbol(`normalizeClass`)
+export const TO_DISPLAY_STRING = Symbol(`toDisplayString`)
registerRuntimeHelpers({
- [V_ON]: 'vOn',
- [V_FOR]: 'vFor',
- [EXTEND]: 'extend',
- [HYPHENATE]: 'hyphenate',
- [STRINGIFY_STYLE]: 'stringifyStyle',
+ [V_ON]: 'o',
+ [V_FOR]: 'f',
+ [EXTEND]: 'e',
+ [CAMELIZE]: 'c',
+ [HYPHENATE]: 'h',
+ [STRINGIFY_STYLE]: 's',
+ [NORMALIZE_CLASS]: 'n',
+ [TO_DISPLAY_STRING]: `t`,
})
diff --git a/packages/uni-mp-compiler/src/transform.ts b/packages/uni-mp-compiler/src/transform.ts
index f5dea9e8c9c397ef0e2f839308731643c8a41315..25723b885b0fc3e3b9912ff2f0d91fa58b8566c0 100644
--- a/packages/uni-mp-compiler/src/transform.ts
+++ b/packages/uni-mp-compiler/src/transform.ts
@@ -528,9 +528,9 @@ function parseReturnObjExpr(prop: ObjectProperty) {
isObjectProperty(prop) &&
isCallExpression(prop.value) &&
isIdentifier(prop.value.callee) &&
- prop.value.callee.name === '_vFor'
+ // 目前硬编码识别 _f,应该读取 context.helperString
+ prop.value.callee.name === '_f'
) {
- // 目前硬编码
return (
(
(prop.value.arguments[1] as ArrowFunctionExpression)
diff --git a/packages/uni-mp-compiler/src/transforms/transformClass.ts b/packages/uni-mp-compiler/src/transforms/transformClass.ts
index 38f73625f0d188623b0ec3809e1545cab1779d71..8b8054dce4933f52d4ace83c577bbce0ad87a628 100644
--- a/packages/uni-mp-compiler/src/transforms/transformClass.ts
+++ b/packages/uni-mp-compiler/src/transforms/transformClass.ts
@@ -27,11 +27,11 @@ import {
createSimpleExpression,
ExpressionNode,
createCompoundExpression,
- NORMALIZE_CLASS,
SourceLocation,
} from '@vue/compiler-core'
import { parseExpr, isTrueExpr, isUndefined, parseStringLiteral } from '../ast'
import { genBabelExpr } from '../codegen'
+import { NORMALIZE_CLASS } from '../runtimeHelpers'
import { TransformContext } from '../transform'
import {
parseExprWithRewrite,
diff --git a/packages/uni-mp-compiler/src/transforms/transformIdentifier.ts b/packages/uni-mp-compiler/src/transforms/transformIdentifier.ts
index 3496639e16b3c30afe62256f08e9b0640b138a34..b26550a4f47b7e62aeaf17bf68540e1848900acc 100644
--- a/packages/uni-mp-compiler/src/transforms/transformIdentifier.ts
+++ b/packages/uni-mp-compiler/src/transforms/transformIdentifier.ts
@@ -2,7 +2,6 @@ import {
createCompoundExpression,
DirectiveNode,
NodeTypes,
- TO_DISPLAY_STRING,
} from '@vue/compiler-core'
import { NodeTransform } from '../transform'
@@ -19,6 +18,7 @@ import {
isStyleBinding,
rewriteStyle,
} from './transformStyle'
+import { TO_DISPLAY_STRING } from '../runtimeHelpers'
export const transformIdentifier: NodeTransform = (node, context) => {
return () => {
diff --git a/packages/uni-mp-compiler/src/transforms/vBind.ts b/packages/uni-mp-compiler/src/transforms/vBind.ts
index 923c5254e5f2c135f15c4c6997bcfe76e893a521..5d80fd160c6f296938f90bfe0b6b43261d2f6ea4 100644
--- a/packages/uni-mp-compiler/src/transforms/vBind.ts
+++ b/packages/uni-mp-compiler/src/transforms/vBind.ts
@@ -1,7 +1,6 @@
import { camelize } from '@vue/shared'
import {
NodeTypes,
- CAMELIZE,
createCompilerError,
ErrorCodes,
createObjectProperty,
@@ -27,7 +26,7 @@ export const transformBind: DirectiveTransform = (dir, _node, context) => {
if (arg.isStatic) {
arg.content = camelize(arg.content)
} else {
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`
+ // arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`
}
} else {
// arg.children.unshift(`${context.helperString(CAMELIZE)}(`)
diff --git a/packages/uni-mp-vue/dist/vue.runtime.esm.js b/packages/uni-mp-vue/dist/vue.runtime.esm.js
index ae9b42ae0fb1fa455a70ca74a345688960466de9..58c68614b84ea209946819ecfc35614c61653f63 100644
--- a/packages/uni-mp-vue/dist/vue.runtime.esm.js
+++ b/packages/uni-mp-vue/dist/vue.runtime.esm.js
@@ -1,5 +1,5 @@
import { extend, isSymbol, isObject, toRawType, def, hasChanged, isArray, isFunction, NOOP, remove, toHandlerKey, camelize, capitalize, isString, normalizeClass, normalizeStyle, isOn, isPromise, EMPTY_OBJ, isSet, isMap, isPlainObject, invokeArrayFns, hasOwn, NO, isIntegerKey, toNumber, hyphenate, isReservedProp, EMPTY_ARR, makeMap, toTypeString, stringifyStyle as stringifyStyle$1 } from '@vue/shared';
-export { camelize, extend, hyphenate, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
+export { camelize as c, camelize, extend as e, hyphenate as h, normalizeClass as n, normalizeClass, normalizeProps, normalizeStyle, toDisplayString as t, toDisplayString, toHandlerKey } from '@vue/shared';
// lifecycle
// App and Page
@@ -5068,4 +5068,4 @@ function createApp(rootComponent, rootProps = null) {
}
const createSSRApp = createApp;
-export { EffectScope, ReactiveEffect, callWithAsyncErrorHandling, callWithErrorHandling, computed, createApp, createSSRApp, createVNode$1 as createVNode, createVueApp, customRef, defineComponent, defineEmits, defineExpose, defineProps, effect, effectScope, getCurrentInstance, getCurrentScope, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onUnmounted, onUpdated, provide, proxyRefs, queuePostFlushCb, reactive, readonly, ref, resolveComponent, resolveDirective, resolveFilter, setupDevtoolsPlugin, shallowReactive, shallowReadonly, shallowRef, stop, stringifyStyle, toHandlers, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useSSRContext, useSlots, vFor, vOn, version, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withModifiers, withScopeId };
+export { EffectScope, ReactiveEffect, callWithAsyncErrorHandling, callWithErrorHandling, computed, createApp, createSSRApp, createVNode$1 as createVNode, createVueApp, customRef, defineComponent, defineEmits, defineExpose, defineProps, effect, effectScope, vFor as f, getCurrentInstance, getCurrentScope, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, mergeDefaults, mergeProps, nextTick, vOn as o, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onUnmounted, onUpdated, provide, proxyRefs, queuePostFlushCb, reactive, readonly, ref, resolveComponent, resolveDirective, resolveFilter, stringifyStyle as s, setupDevtoolsPlugin, shallowReactive, shallowReadonly, shallowRef, stop, toHandlers, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useSSRContext, useSlots, version, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withModifiers, withScopeId };
diff --git a/packages/uni-mp-vue/src/index.ts b/packages/uni-mp-vue/src/index.ts
index 75b8969175cde4744aaae090d3531dc4a1892655..1dd4f8365cf5355ed2115703618b23217484b1e3 100644
--- a/packages/uni-mp-vue/src/index.ts
+++ b/packages/uni-mp-vue/src/index.ts
@@ -6,7 +6,18 @@ export function createApp(rootComponent: unknown, rootProps = null) {
return createVueApp(rootComponent, rootProps).use(plugin)
}
export const createSSRApp = createApp
-export * from './helpers'
-export { extend, hyphenate } from '@vue/shared'
+export {
+ vOn as o,
+ vFor as f,
+ stringifyStyle as s,
+ setupDevtoolsPlugin,
+} from './helpers'
+export {
+ camelize as c,
+ extend as e,
+ hyphenate as h,
+ normalizeClass as n,
+ toDisplayString as t,
+} from '@vue/shared'
// @ts-ignore
export * from '../lib/vue.runtime.esm.js'