Skip to content

Commit

Permalink
chore(build): use /*@__PURE__*/ annotation consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Sep 4, 2024
1 parent 4eee630 commit 4019369
Show file tree
Hide file tree
Showing 49 changed files with 173 additions and 173 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ exports[`compiler: cacheStatic transform > prefixIdentifiers > hoist class with
const { createElementVNode: _createElementVNode } = _Vue
const _hoisted_1 = {
class: /*#__PURE__*/_normalizeClass({ foo: true })
class: /*@__PURE__*/_normalizeClass({ foo: true })
}
return function render(_ctx, _cache) {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-core/src/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ interface MappingItem {
name: string | null
}

const PURE_ANNOTATION = `/*#__PURE__*/`
const PURE_ANNOTATION = `/*@__PURE__*/`

const aliasHelper = (s: symbol) => `${helperNameMap[s]}: _${helperNameMap[s]}`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { parseExpression } from '@babel/parser'
import { IS_REF, UNREF } from '../runtimeHelpers'
import { BindingTypes } from '../options'

const isLiteralWhitelisted = /*#__PURE__*/ makeMap('true,false,null,this')
const isLiteralWhitelisted = /*@__PURE__*/ makeMap('true,false,null,this')

export const transformExpression: NodeTransform = (node, context) => {
if (node.type === NodeTypes.INTERPOLATION) {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-dom/src/transforms/stringifyStatic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const isStringifiableAttr = (name: string, ns: Namespaces) => {
)
}

const isNonStringifiable = /*#__PURE__*/ makeMap(
const isNonStringifiable = /*@__PURE__*/ makeMap(
`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`,
)

Expand Down
8 changes: 4 additions & 4 deletions packages/compiler-dom/src/transforms/vOn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
import { V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS } from '../runtimeHelpers'
import { capitalize, makeMap } from '@vue/shared'

const isEventOptionModifier = /*#__PURE__*/ makeMap(`passive,once,capture`)
const isNonKeyModifier = /*#__PURE__*/ makeMap(
const isEventOptionModifier = /*@__PURE__*/ makeMap(`passive,once,capture`)
const isNonKeyModifier = /*@__PURE__*/ makeMap(
// event propagation management
`stop,prevent,self,` +
// system modifiers + exact
Expand All @@ -27,8 +27,8 @@ const isNonKeyModifier = /*#__PURE__*/ makeMap(
`middle`,
)
// left & right could be mouse or key modifiers based on event type
const maybeKeyModifier = /*#__PURE__*/ makeMap('left,right')
const isKeyboardEvent = /*#__PURE__*/ makeMap(
const maybeKeyModifier = /*@__PURE__*/ makeMap('left,right')
const isKeyboardEvent = /*@__PURE__*/ makeMap(
`onkeyup,onkeydown,onkeypress`,
true,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports[`SFC analyze <script> bindings > auto name inference > do not overwrite
name: 'Baz'
})
export default /*#__PURE__*/Object.assign(__default__, {
export default /*@__PURE__*/Object.assign(__default__, {
setup(__props, { expose: __expose }) {
__expose();
const a = 1
Expand All @@ -36,7 +36,7 @@ exports[`SFC analyze <script> bindings > auto name inference > do not overwrite
name: 'Baz'
}
export default /*#__PURE__*/Object.assign(__default__, {
export default /*@__PURE__*/Object.assign(__default__, {
setup(__props, { expose: __expose }) {
__expose();
const a = 1
Expand All @@ -53,7 +53,7 @@ exports[`SFC compile <script setup> > <script> and <script setup> co-usage > exp
}
const __default__ = fn();
export default /*#__PURE__*/Object.assign(__default__, {
export default /*@__PURE__*/Object.assign(__default__, {
setup(__props, { expose: __expose }) {
__expose();
Expand Down Expand Up @@ -91,7 +91,7 @@ exports[`SFC compile <script setup> > <script> and <script setup> co-usage > scr
const __default__ = {}
export default /*#__PURE__*/Object.assign(__default__, {
export default /*@__PURE__*/Object.assign(__default__, {
setup(__props, { expose: __expose }) {
__expose();
Expand All @@ -110,7 +110,7 @@ exports[`SFC compile <script setup> > <script> and <script setup> co-usage > scr
const __default__ = {}
export default /*#__PURE__*/Object.assign(__default__, {
export default /*@__PURE__*/Object.assign(__default__, {
setup(__props, { expose: __expose }) {
__expose();
Expand All @@ -131,7 +131,7 @@ import { x } from './x'
}
export default /*#__PURE__*/_defineComponent({
export default /*@__PURE__*/_defineComponent({
...__default__,
setup(__props, { expose: __expose }) {
__expose();
Expand All @@ -154,7 +154,7 @@ exports[`SFC compile <script setup> > <script> and <script setup> co-usage > scr
const __default__ = def
export default /*#__PURE__*/Object.assign(__default__, {
export default /*@__PURE__*/Object.assign(__default__, {
setup(__props, { expose: __expose }) {
__expose();
Expand All @@ -174,7 +174,7 @@ exports[`SFC compile <script setup> > <script> and <script setup> co-usage > spa
some:'option'
}
export default /*#__PURE__*/Object.assign(__default__, {
export default /*@__PURE__*/Object.assign(__default__, {
setup(__props, { expose: __expose }) {
__expose();
Expand All @@ -194,7 +194,7 @@ exports[`SFC compile <script setup> > <script> and <script setup> co-usage > spa
some:'option'
}
export default /*#__PURE__*/Object.assign(__default__, {
export default /*@__PURE__*/Object.assign(__default__, {
setup(__props, { expose: __expose }) {
__expose();
Expand Down Expand Up @@ -1142,7 +1142,7 @@ exports[`SFC compile <script setup> > with TypeScript > const Enum 1`] = `
"import { defineComponent as _defineComponent } from 'vue'
const enum Foo { A = 123 }
export default /*#__PURE__*/_defineComponent({
export default /*@__PURE__*/_defineComponent({
setup(__props, { expose: __expose }) {
__expose();
Expand All @@ -1158,7 +1158,7 @@ exports[`SFC compile <script setup> > with TypeScript > hoist type declarations
export interface Foo {}
type Bar = {}
export default /*#__PURE__*/_defineComponent({
export default /*@__PURE__*/_defineComponent({
setup(__props, { expose: __expose }) {
__expose();
Expand All @@ -1174,7 +1174,7 @@ exports[`SFC compile <script setup> > with TypeScript > import type 1`] = `
import type { Foo } from './main.ts'
import { type Bar, Baz } from './main.ts'
export default /*#__PURE__*/_defineComponent({
export default /*@__PURE__*/_defineComponent({
setup(__props, { expose: __expose }) {
__expose();
Expand All @@ -1189,7 +1189,7 @@ exports[`SFC compile <script setup> > with TypeScript > runtime Enum 1`] = `
"import { defineComponent as _defineComponent } from 'vue'
enum Foo { A = 123 }
export default /*#__PURE__*/_defineComponent({
export default /*@__PURE__*/_defineComponent({
setup(__props, { expose: __expose }) {
__expose();
Expand All @@ -1207,7 +1207,7 @@ exports[`SFC compile <script setup> > with TypeScript > runtime Enum in normal s
const enum C { C = "C" }
enum B { B = "B" }
export default /*#__PURE__*/_defineComponent({
export default /*@__PURE__*/_defineComponent({
setup(__props, { expose: __expose }) {
__expose();
Expand All @@ -1223,7 +1223,7 @@ exports[`SFC compile <script setup> > with TypeScript > with generic attribute 1
"import { defineComponent as _defineComponent } from 'vue'
type Bar = {}
export default /*#__PURE__*/_defineComponent({
export default /*@__PURE__*/_defineComponent({
setup(__props, { expose: __expose }) {
__expose();
Expand Down Expand Up @@ -1252,7 +1252,7 @@ exports[`SFC genDefaultAs > <script setup> only w/ ts 1`] = `
"import { defineComponent as _defineComponent } from 'vue'
const a = 1
const _sfc_ = /*#__PURE__*/_defineComponent({
const _sfc_ = /*@__PURE__*/_defineComponent({
setup(__props, { expose: __expose }) {
__expose();
Expand All @@ -1267,7 +1267,7 @@ exports[`SFC genDefaultAs > <script> + <script setup> 1`] = `
"
const __default__ = {}
const _sfc_ = /*#__PURE__*/Object.assign(__default__, {
const _sfc_ = /*@__PURE__*/Object.assign(__default__, {
setup(__props, { expose: __expose }) {
__expose();
Expand All @@ -1283,7 +1283,7 @@ exports[`SFC genDefaultAs > <script> + <script setup> 2`] = `
"
const __default__ = {}
const _sfc_ = /*#__PURE__*/Object.assign(__default__, {
const _sfc_ = /*@__PURE__*/Object.assign(__default__, {
setup(__props, { expose: __expose }) {
__expose();
Expand All @@ -1300,7 +1300,7 @@ exports[`SFC genDefaultAs > <script> + <script setup> w/ ts 1`] = `
const __default__ = {}
const _sfc_ = /*#__PURE__*/_defineComponent({
const _sfc_ = /*@__PURE__*/_defineComponent({
...__default__,
setup(__props, { expose: __expose }) {
__expose();
Expand Down
8 changes: 4 additions & 4 deletions packages/compiler-sfc/__tests__/compileScript.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ describe('SFC genDefaultAs', () => {
)
expect(content).not.toMatch('export default')
expect(content).toMatch(
`const _sfc_ = /*#__PURE__*/Object.assign(__default__`,
`const _sfc_ = /*@__PURE__*/Object.assign(__default__`,
)
assertCode(content)
})
Expand All @@ -1376,7 +1376,7 @@ describe('SFC genDefaultAs', () => {
)
expect(content).not.toMatch('export default')
expect(content).toMatch(
`const _sfc_ = /*#__PURE__*/Object.assign(__default__`,
`const _sfc_ = /*@__PURE__*/Object.assign(__default__`,
)
assertCode(content)
})
Expand Down Expand Up @@ -1405,7 +1405,7 @@ describe('SFC genDefaultAs', () => {
},
)
expect(content).not.toMatch('export default')
expect(content).toMatch(`const _sfc_ = /*#__PURE__*/_defineComponent(`)
expect(content).toMatch(`const _sfc_ = /*@__PURE__*/_defineComponent(`)
assertCode(content)
})

Expand All @@ -1423,7 +1423,7 @@ describe('SFC genDefaultAs', () => {
)
expect(content).not.toMatch('export default')
expect(content).toMatch(
`const _sfc_ = /*#__PURE__*/_defineComponent({\n ...__default__`,
`const _sfc_ = /*@__PURE__*/_defineComponent({\n ...__default__`,
)
assertCode(content)
})
Expand Down
Loading

0 comments on commit 4019369

Please sign in to comment.