A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vue-next/commit/091e6d67bfcc215227d78be578c68ead542481ad below:

support configuring runtime compiler via `app.config.co… · vuejs/core@091e6d6 · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+85

-18

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+85

-18

lines changed Original file line number Diff line number Diff line change

@@ -69,7 +69,6 @@ export interface AppConfig {

69 69

performance: boolean

70 70

optionMergeStrategies: Record<string, OptionMergeFunction>

71 71

globalProperties: Record<string, any>

72 -

isCustomElement: (tag: string) => boolean

73 72

errorHandler?: (

74 73

err: unknown,

75 74

instance: ComponentPublicInstance | null,

@@ -80,6 +79,22 @@ export interface AppConfig {

80 79

instance: ComponentPublicInstance | null,

81 80

trace: string

82 81

) => void

82 + 83 +

/**

84 +

* @deprecated use config.compilerOptions.isCustomElement

85 +

*/

86 +

isCustomElement?: (tag: string) => boolean

87 + 88 +

/**

89 +

* Options to pass to @vue/compiler-dom.

90 +

* *Only supported in runtime compiler build.*

91 +

*/

92 +

compilerOptions: {

93 +

isCustomElement: (tag: string) => boolean

94 +

whitespace?: 'preserve' | 'condense'

95 +

comments?: boolean

96 +

delimiters?: [string, string]

97 +

}

83 98

}

84 99 85 100

export interface AppContext {

@@ -122,9 +137,11 @@ export function createAppContext(): AppContext {

122 137

performance: false,

123 138

globalProperties: {},

124 139

optionMergeStrategies: {},

125 -

isCustomElement: NO,

126 140

errorHandler: undefined,

127 -

warnHandler: undefined

141 +

warnHandler: undefined,

142 +

compilerOptions: {

143 +

isCustomElement: NO

144 +

}

128 145

},

129 146

mixins: [],

130 147

components: {},

Original file line number Diff line number Diff line change

@@ -727,18 +727,22 @@ export function finishComponentSetup(

727 727

if (__DEV__) {

728 728

startMeasure(instance, `compile`)

729 729

}

730 -

const compilerOptions: CompilerOptions = {

731 -

isCustomElement: instance.appContext.config.isCustomElement,

732 -

delimiters: Component.delimiters

733 -

}

730 +

const { isCustomElement, compilerOptions } = instance.appContext.config

731 +

const finalCompilerOptions: CompilerOptions = extend(

732 +

{

733 +

isCustomElement: isCustomElement || NO,

734 +

delimiters: Component.delimiters

735 +

},

736 +

compilerOptions

737 +

)

734 738

if (__COMPAT__) {

735 739

// pass runtime compat config into the compiler

736 -

compilerOptions.compatConfig = Object.create(globalCompatConfig)

740 +

finalCompilerOptions.compatConfig = Object.create(globalCompatConfig)

737 741

if (Component.compatConfig) {

738 -

extend(compilerOptions.compatConfig, Component.compatConfig)

742 +

extend(finalCompilerOptions.compatConfig, Component.compatConfig)

739 743

}

740 744

}

741 -

Component.render = compile(template, compilerOptions)

745 +

Component.render = compile(template, finalCompilerOptions)

742 746

if (__DEV__) {

743 747

endMeasure(instance, `compile`)

744 748

}

Original file line number Diff line number Diff line change

@@ -58,7 +58,7 @@ export const createApp = ((...args) => {

58 58 59 59

if (__DEV__) {

60 60

injectNativeTagCheck(app)

61 -

injectCustomElementCheck(app)

61 +

injectCompilerOptionsCheck(app)

62 62

}

63 63 64 64

const { mount } = app

@@ -106,7 +106,7 @@ export const createSSRApp = ((...args) => {

106 106 107 107

if (__DEV__) {

108 108

injectNativeTagCheck(app)

109 -

injectCustomElementCheck(app)

109 +

injectCompilerOptionsCheck(app)

110 110

}

111 111 112 112

const { mount } = app

@@ -130,21 +130,40 @@ function injectNativeTagCheck(app: App) {

130 130

}

131 131 132 132

// dev only

133 -

function injectCustomElementCheck(app: App) {

133 +

function injectCompilerOptionsCheck(app: App) {

134 134

if (isRuntimeOnly()) {

135 -

const value = app.config.isCustomElement

135 +

const isCustomElement = app.config.isCustomElement

136 136

Object.defineProperty(app.config, 'isCustomElement', {

137 137

get() {

138 -

return value

138 +

return isCustomElement

139 139

},

140 140

set() {

141 141

warn(

142 -

`The \`isCustomElement\` config option is only respected when using the runtime compiler.` +

143 -

`If you are using the runtime-only build, \`isCustomElement\` must be passed to \`@vue/compiler-dom\` in the build setup instead` +

144 -

`- for example, via the \`compilerOptions\` option in vue-loader: https://vue-loader.vuejs.org/options.html#compileroptions.`

142 +

`The \`isCustomElement\` config option is deprecated. Use ` +

143 +

`\`compilerOptions.isCustomElement\` instead.`

145 144

)

146 145

}

147 146

})

147 + 148 +

const compilerOptions = app.config.compilerOptions

149 +

const msg =

150 +

`The \`compilerOptions\` config option is only respected when using ` +

151 +

`a build of Vue.js that includes the runtime compiler (aka "full build"). ` +

152 +

`Since you are using the runtime-only build, \`compilerOptions\` ` +

153 +

`must be passed to \`@vue/compiler-dom\` in the build setup instead.\n` +

154 +

`- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.\n` +

155 +

`- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader\n` +

156 +

`- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-dom`

157 + 158 +

Object.defineProperty(app.config, 'compilerOptions', {

159 +

get() {

160 +

warn(msg)

161 +

return compilerOptions

162 +

},

163 +

set() {

164 +

warn(msg)

165 +

}

166 +

})

148 167

}

149 168

}

150 169 Original file line number Diff line number Diff line change

@@ -14,6 +14,7 @@ export const compilerOptions: CompilerOptions = reactive({

14 14

inline: false,

15 15

ssrCssVars: `{ color }`,

16 16

compatConfig: { MODE: 3 },

17 +

whitespace: 'condense',

17 18

bindingMetadata: {

18 19

TestComponent: BindingTypes.SETUP_CONST,

19 20

setupRef: BindingTypes.SETUP_REF,

@@ -83,6 +84,32 @@ const App = {

83 84

h('label', { for: 'mode-function' }, 'function')

84 85

]),

85 86 87 +

// whitespace handling

88 +

h('li', { id: 'whitespace' }, [

89 +

h('span', { class: 'label' }, 'whitespace: '),

90 +

h('input', {

91 +

type: 'radio',

92 +

id: 'whitespace-condense',

93 +

name: 'whitespace',

94 +

checked: compilerOptions.whitespace === 'condense',

95 +

onChange() {

96 +

compilerOptions.whitespace = 'condense'

97 +

}

98 +

}),

99 +

h('label', { for: 'whitespace-condense' }, 'condense'),

100 +

' ',

101 +

h('input', {

102 +

type: 'radio',

103 +

id: 'whitespace-preserve',

104 +

name: 'whitespace',

105 +

checked: compilerOptions.whitespace === 'preserve',

106 +

onChange() {

107 +

compilerOptions.whitespace = 'preserve'

108 +

}

109 +

}),

110 +

h('label', { for: 'whitespace-preserve' }, 'preserve')

111 +

]),

112 + 86 113

// SSR

87 114

h('li', [

88 115

h('input', {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4