@dcloudio/uni-cli-shared 3.0.0-alpha-4070720250804001 → 3.0.0-alpha-4070620250731002

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/dist/easycom.d.ts +0 -1
  2. package/dist/easycom.js +13 -17
  3. package/dist/hbx/alias.js +10 -43
  4. package/dist/hbx/index.js +0 -10
  5. package/dist/hbx/log.js +1 -23
  6. package/dist/index.d.ts +1 -2
  7. package/dist/index.js +1 -3
  8. package/dist/json/index.d.ts +1 -1
  9. package/dist/json/index.js +1 -2
  10. package/dist/json/manifest.d.ts +0 -1
  11. package/dist/json/manifest.js +1 -11
  12. package/dist/json/mp/jsonFile.js +2 -4
  13. package/dist/json/mp/pages.js +0 -1
  14. package/dist/json/mp/types.d.ts +1 -4
  15. package/dist/json/uni-x/manifest.d.ts +0 -1
  16. package/dist/json/uni-x/manifest.js +1 -5
  17. package/dist/messages/zh_CN.js +0 -1
  18. package/dist/uni_modules.cloud.d.ts +4 -10
  19. package/dist/uni_modules.cloud.js +19 -58
  20. package/dist/uni_modules.d.ts +0 -2
  21. package/dist/uni_modules.js +2 -81
  22. package/dist/uts.js +0 -16
  23. package/dist/vite/autoImport.js +0 -2
  24. package/dist/vite/cloud.js +5 -51
  25. package/dist/vite/plugins/index.d.ts +0 -1
  26. package/dist/vite/plugins/index.js +1 -3
  27. package/dist/vite/plugins/inject.js +1 -3
  28. package/dist/vite/plugins/uts/uni_modules.d.ts +0 -1
  29. package/dist/vite/plugins/uts/uni_modules.js +14 -63
  30. package/dist/vite/plugins/uts/uvue.js +3 -17
  31. package/dist/vite/plugins/vitejs/plugins/css.js +5 -40
  32. package/dist/vue/transforms/transformUTSComponent.js +3 -8
  33. package/package.json +38 -38
  34. package/dist/vite/plugins/stats.d.ts +0 -2
  35. package/dist/vite/plugins/stats.js +0 -42
  36. package/dist/workers.d.ts +0 -14
  37. package/dist/workers.js +0 -187
  38. package/lib/vapor/@vitejs/plugin-vue/LICENSE +0 -21
  39. package/lib/vapor/@vitejs/plugin-vue/README.md +0 -278
  40. package/lib/vapor/@vitejs/plugin-vue/dist/index.cjs +0 -3105
  41. package/lib/vapor/@vitejs/plugin-vue/dist/index.d.cts +0 -113
  42. package/lib/vapor/@vitejs/plugin-vue/dist/index.d.mts +0 -111
  43. package/lib/vapor/@vitejs/plugin-vue/dist/index.d.ts +0 -113
  44. package/lib/vapor/@vitejs/plugin-vue/dist/index.mjs +0 -3090
  45. package/lib/vapor/@vitejs/plugin-vue/package.json +0 -50
  46. package/lib/vapor/@vue/compiler-core/LICENSE +0 -21
  47. package/lib/vapor/@vue/compiler-core/README.md +0 -1
  48. package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.js +0 -6902
  49. package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.prod.js +0 -6779
  50. package/lib/vapor/@vue/compiler-core/dist/compiler-core.esm-bundler.js +0 -5870
  51. package/lib/vapor/@vue/compiler-core/index.js +0 -7
  52. package/lib/vapor/@vue/compiler-core/package.json +0 -58
  53. package/lib/vapor/@vue/compiler-dom/LICENSE +0 -21
  54. package/lib/vapor/@vue/compiler-dom/README.md +0 -1
  55. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.cjs.js +0 -936
  56. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +0 -856
  57. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +0 -6682
  58. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +0 -14
  59. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +0 -693
  60. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.global.js +0 -6855
  61. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.global.prod.js +0 -14
  62. package/lib/vapor/@vue/compiler-dom/index.js +0 -7
  63. package/lib/vapor/@vue/compiler-dom/package.json +0 -57
  64. package/lib/vapor/@vue/compiler-sfc/LICENSE +0 -21
  65. package/lib/vapor/@vue/compiler-sfc/README.md +0 -80
  66. package/lib/vapor/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -21682
  67. package/lib/vapor/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +0 -66272
  68. package/lib/vapor/@vue/compiler-sfc/package.json +0 -68
  69. package/lib/vapor/@vue/compiler-ssr/LICENSE +0 -21
  70. package/lib/vapor/@vue/compiler-ssr/README.md +0 -1
  71. package/lib/vapor/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +0 -1402
  72. package/lib/vapor/@vue/compiler-ssr/package.json +0 -34
  73. package/lib/vapor/@vue/compiler-vapor/LICENSE +0 -21
  74. package/lib/vapor/@vue/compiler-vapor/README.md +0 -1
  75. package/lib/vapor/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +0 -4540
  76. package/lib/vapor/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +0 -37020
  77. package/lib/vapor/@vue/compiler-vapor/package.json +0 -49
  78. package/lib/vapor/@vue/reactivity/LICENSE +0 -21
  79. package/lib/vapor/@vue/reactivity/README.md +0 -19
  80. package/lib/vapor/@vue/reactivity/dist/reactivity.cjs.js +0 -2033
  81. package/lib/vapor/@vue/reactivity/dist/reactivity.cjs.prod.js +0 -1841
  82. package/lib/vapor/@vue/reactivity/dist/reactivity.esm-browser.js +0 -2023
  83. package/lib/vapor/@vue/reactivity/dist/reactivity.esm-browser.prod.js +0 -5
  84. package/lib/vapor/@vue/reactivity/dist/reactivity.esm-bundler.js +0 -1992
  85. package/lib/vapor/@vue/reactivity/dist/reactivity.global.js +0 -2082
  86. package/lib/vapor/@vue/reactivity/dist/reactivity.global.prod.js +0 -5
  87. package/lib/vapor/@vue/reactivity/index.js +0 -7
  88. package/lib/vapor/@vue/reactivity/package.json +0 -55
  89. package/lib/vapor/@vue/runtime-core/LICENSE +0 -21
  90. package/lib/vapor/@vue/runtime-core/README.md +0 -28
  91. package/lib/vapor/@vue/runtime-core/dist/runtime-core.cjs.js +0 -8972
  92. package/lib/vapor/@vue/runtime-core/dist/runtime-core.cjs.prod.js +0 -7088
  93. package/lib/vapor/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -8913
  94. package/lib/vapor/@vue/runtime-core/index.js +0 -7
  95. package/lib/vapor/@vue/runtime-core/package.json +0 -54
  96. package/lib/vapor/@vue/runtime-dom/LICENSE +0 -21
  97. package/lib/vapor/@vue/runtime-dom/README.md +0 -13
  98. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.cjs.js +0 -1797
  99. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +0 -1646
  100. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-browser.js +0 -12929
  101. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-browser.prod.js +0 -6
  102. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -1838
  103. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.global.js +0 -13086
  104. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.global.prod.js +0 -6
  105. package/lib/vapor/@vue/runtime-dom/index.js +0 -7
  106. package/lib/vapor/@vue/runtime-dom/package.json +0 -60
  107. package/lib/vapor/@vue/runtime-vapor/LICENSE +0 -21
  108. package/lib/vapor/@vue/runtime-vapor/README.md +0 -8
  109. package/lib/vapor/@vue/runtime-vapor/dist/runtime-vapor.esm-bundler.js +0 -3242
  110. package/lib/vapor/@vue/runtime-vapor/package.json +0 -47
  111. package/lib/vapor/@vue/server-renderer/LICENSE +0 -21
  112. package/lib/vapor/@vue/server-renderer/README.md +0 -178
  113. package/lib/vapor/@vue/server-renderer/dist/server-renderer.cjs.js +0 -1144
  114. package/lib/vapor/@vue/server-renderer/dist/server-renderer.cjs.prod.js +0 -871
  115. package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-browser.js +0 -8756
  116. package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-browser.prod.js +0 -5
  117. package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-bundler.js +0 -1366
  118. package/lib/vapor/@vue/server-renderer/index.js +0 -7
  119. package/lib/vapor/@vue/server-renderer/package.json +0 -55
  120. package/lib/vapor/@vue/shared/LICENSE +0 -21
  121. package/lib/vapor/@vue/shared/README.md +0 -3
  122. package/lib/vapor/@vue/shared/dist/shared.cjs.js +0 -698
  123. package/lib/vapor/@vue/shared/dist/shared.cjs.prod.js +0 -690
  124. package/lib/vapor/@vue/shared/dist/shared.esm-bundler.js +0 -616
  125. package/lib/vapor/@vue/shared/index.js +0 -7
  126. package/lib/vapor/@vue/shared/package.json +0 -47
  127. package/lib/vapor/@vue/vue/LICENSE +0 -21
  128. package/lib/vapor/@vue/vue/README.md +0 -62
  129. package/lib/vapor/@vue/vue/compiler-sfc/index.browser.js +0 -1
  130. package/lib/vapor/@vue/vue/compiler-sfc/index.browser.mjs +0 -1
  131. package/lib/vapor/@vue/vue/compiler-sfc/index.d.mts +0 -1
  132. package/lib/vapor/@vue/vue/compiler-sfc/index.d.ts +0 -1
  133. package/lib/vapor/@vue/vue/compiler-sfc/index.js +0 -3
  134. package/lib/vapor/@vue/vue/compiler-sfc/index.mjs +0 -3
  135. package/lib/vapor/@vue/vue/compiler-sfc/package.json +0 -4
  136. package/lib/vapor/@vue/vue/compiler-sfc/register-ts.js +0 -3
  137. package/lib/vapor/@vue/vue/dist/vue.cjs.js +0 -80
  138. package/lib/vapor/@vue/vue/dist/vue.cjs.prod.js +0 -66
  139. package/lib/vapor/@vue/vue/dist/vue.esm-browser.js +0 -18840
  140. package/lib/vapor/@vue/vue/dist/vue.esm-browser.prod.js +0 -12
  141. package/lib/vapor/@vue/vue/dist/vue.esm-bundler.js +0 -72
  142. package/lib/vapor/@vue/vue/dist/vue.global.js +0 -18820
  143. package/lib/vapor/@vue/vue/dist/vue.global.prod.js +0 -12
  144. package/lib/vapor/@vue/vue/dist/vue.runtime-with-vapor.esm-browser.js +0 -15648
  145. package/lib/vapor/@vue/vue/dist/vue.runtime-with-vapor.esm-browser.prod.js +0 -9
  146. package/lib/vapor/@vue/vue/dist/vue.runtime.esm-browser.js +0 -12953
  147. package/lib/vapor/@vue/vue/dist/vue.runtime.esm-browser.prod.js +0 -6
  148. package/lib/vapor/@vue/vue/dist/vue.runtime.esm-bundler.js +0 -29
  149. package/lib/vapor/@vue/vue/dist/vue.runtime.global.js +0 -13111
  150. package/lib/vapor/@vue/vue/dist/vue.runtime.global.prod.js +0 -6
  151. package/lib/vapor/@vue/vue/index.js +0 -7
  152. package/lib/vapor/@vue/vue/index.mjs +0 -1
  153. package/lib/vapor/@vue/vue/jsx-runtime/index.d.ts +0 -25
  154. package/lib/vapor/@vue/vue/jsx-runtime/index.js +0 -15
  155. package/lib/vapor/@vue/vue/jsx-runtime/index.mjs +0 -12
  156. package/lib/vapor/@vue/vue/jsx-runtime/package.json +0 -5
  157. package/lib/vapor/@vue/vue/jsx.d.ts +0 -22
  158. package/lib/vapor/@vue/vue/package.json +0 -114
  159. package/lib/vapor/@vue/vue/server-renderer/index.d.mts +0 -1
  160. package/lib/vapor/@vue/vue/server-renderer/index.d.ts +0 -1
  161. package/lib/vapor/@vue/vue/server-renderer/index.js +0 -1
  162. package/lib/vapor/@vue/vue/server-renderer/index.mjs +0 -1
  163. package/lib/vapor/@vue/vue/server-renderer/package.json +0 -4
@@ -1,693 +0,0 @@
1
- /**
2
- * @vue/compiler-dom v3.6.0-alpha.2
3
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
- * @license MIT
5
- **/
6
- import { registerRuntimeHelpers, createSimpleExpression, createCompilerError, createObjectProperty, createCallExpression, getConstantType, TO_DISPLAY_STRING, transformModel as transformModel$1, findProp, hasDynamicKeyVBind, findDir, isStaticArgOf, transformOn as transformOn$1, isStaticExp, createCompoundExpression, checkCompatEnabled, noopDirectiveTransform, baseCompile, baseParse } from '@vue/compiler-core';
7
- export * from '@vue/compiler-core';
8
- import { isHTMLTag, isSVGTag, isMathMLTag, isVoidTag, parseStringStyle, makeMap, capitalize, isString, extend } from '@vue/shared';
9
-
10
- const V_MODEL_RADIO = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelRadio` : ``);
11
- const V_MODEL_CHECKBOX = Symbol(
12
- !!(process.env.NODE_ENV !== "production") ? `vModelCheckbox` : ``
13
- );
14
- const V_MODEL_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelText` : ``);
15
- const V_MODEL_SELECT = Symbol(
16
- !!(process.env.NODE_ENV !== "production") ? `vModelSelect` : ``
17
- );
18
- const V_MODEL_DYNAMIC = Symbol(
19
- !!(process.env.NODE_ENV !== "production") ? `vModelDynamic` : ``
20
- );
21
- const V_ON_WITH_MODIFIERS = Symbol(
22
- !!(process.env.NODE_ENV !== "production") ? `vOnModifiersGuard` : ``
23
- );
24
- const V_ON_WITH_KEYS = Symbol(
25
- !!(process.env.NODE_ENV !== "production") ? `vOnKeysGuard` : ``
26
- );
27
- const V_SHOW = Symbol(!!(process.env.NODE_ENV !== "production") ? `vShow` : ``);
28
- const TRANSITION = Symbol(!!(process.env.NODE_ENV !== "production") ? `Transition` : ``);
29
- const TRANSITION_GROUP = Symbol(
30
- !!(process.env.NODE_ENV !== "production") ? `TransitionGroup` : ``
31
- );
32
- registerRuntimeHelpers({
33
- [V_MODEL_RADIO]: `vModelRadio`,
34
- [V_MODEL_CHECKBOX]: `vModelCheckbox`,
35
- [V_MODEL_TEXT]: `vModelText`,
36
- [V_MODEL_SELECT]: `vModelSelect`,
37
- [V_MODEL_DYNAMIC]: `vModelDynamic`,
38
- [V_ON_WITH_MODIFIERS]: `withModifiers`,
39
- [V_ON_WITH_KEYS]: `withKeys`,
40
- [V_SHOW]: `vShow`,
41
- [TRANSITION]: `Transition`,
42
- [TRANSITION_GROUP]: `TransitionGroup`
43
- });
44
-
45
- let decoder;
46
- function decodeHtmlBrowser(raw, asAttr = false) {
47
- if (!decoder) {
48
- decoder = document.createElement("div");
49
- }
50
- if (asAttr) {
51
- decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
52
- return decoder.children[0].getAttribute("foo");
53
- } else {
54
- decoder.innerHTML = raw;
55
- return decoder.textContent;
56
- }
57
- }
58
-
59
- const parserOptions = {
60
- parseMode: "html",
61
- isVoidTag,
62
- isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
63
- isPreTag: (tag) => tag === "pre",
64
- isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
65
- decodeEntities: decodeHtmlBrowser ,
66
- isBuiltInComponent: (tag) => {
67
- if (tag === "Transition" || tag === "transition") {
68
- return TRANSITION;
69
- } else if (tag === "TransitionGroup" || tag === "transition-group") {
70
- return TRANSITION_GROUP;
71
- }
72
- },
73
- // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
74
- getNamespace(tag, parent, rootNamespace) {
75
- let ns = parent ? parent.ns : rootNamespace;
76
- if (parent && ns === 2) {
77
- if (parent.tag === "annotation-xml") {
78
- if (tag === "svg") {
79
- return 1;
80
- }
81
- if (parent.props.some(
82
- (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
83
- )) {
84
- ns = 0;
85
- }
86
- } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
87
- ns = 0;
88
- }
89
- } else if (parent && ns === 1) {
90
- if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
91
- ns = 0;
92
- }
93
- }
94
- if (ns === 0) {
95
- if (tag === "svg") {
96
- return 1;
97
- }
98
- if (tag === "math") {
99
- return 2;
100
- }
101
- }
102
- return ns;
103
- }
104
- };
105
-
106
- const transformStyle = (node) => {
107
- if (node.type === 1) {
108
- node.props.forEach((p, i) => {
109
- if (p.type === 6 && p.name === "style" && p.value) {
110
- node.props[i] = {
111
- type: 7,
112
- name: `bind`,
113
- arg: createSimpleExpression(`style`, true, p.loc),
114
- exp: parseInlineCSS(p.value.content, p.loc),
115
- modifiers: [],
116
- loc: p.loc
117
- };
118
- }
119
- });
120
- }
121
- };
122
- const parseInlineCSS = (cssText, loc) => {
123
- const normalized = parseStringStyle(cssText);
124
- return createSimpleExpression(
125
- JSON.stringify(normalized),
126
- false,
127
- loc,
128
- 3
129
- );
130
- };
131
-
132
- function createDOMCompilerError(code, loc) {
133
- return createCompilerError(
134
- code,
135
- loc,
136
- !!(process.env.NODE_ENV !== "production") || false ? DOMErrorMessages : void 0
137
- );
138
- }
139
- const DOMErrorCodes = {
140
- "X_V_HTML_NO_EXPRESSION": 53,
141
- "53": "X_V_HTML_NO_EXPRESSION",
142
- "X_V_HTML_WITH_CHILDREN": 54,
143
- "54": "X_V_HTML_WITH_CHILDREN",
144
- "X_V_TEXT_NO_EXPRESSION": 55,
145
- "55": "X_V_TEXT_NO_EXPRESSION",
146
- "X_V_TEXT_WITH_CHILDREN": 56,
147
- "56": "X_V_TEXT_WITH_CHILDREN",
148
- "X_V_MODEL_ON_INVALID_ELEMENT": 57,
149
- "57": "X_V_MODEL_ON_INVALID_ELEMENT",
150
- "X_V_MODEL_ARG_ON_ELEMENT": 58,
151
- "58": "X_V_MODEL_ARG_ON_ELEMENT",
152
- "X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59,
153
- "59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
154
- "X_V_MODEL_UNNECESSARY_VALUE": 60,
155
- "60": "X_V_MODEL_UNNECESSARY_VALUE",
156
- "X_V_SHOW_NO_EXPRESSION": 61,
157
- "61": "X_V_SHOW_NO_EXPRESSION",
158
- "X_TRANSITION_INVALID_CHILDREN": 62,
159
- "62": "X_TRANSITION_INVALID_CHILDREN",
160
- "X_IGNORED_SIDE_EFFECT_TAG": 63,
161
- "63": "X_IGNORED_SIDE_EFFECT_TAG",
162
- "__EXTEND_POINT__": 64,
163
- "64": "__EXTEND_POINT__"
164
- };
165
- const DOMErrorMessages = {
166
- [53]: `v-html is missing expression.`,
167
- [54]: `v-html will override element children.`,
168
- [55]: `v-text is missing expression.`,
169
- [56]: `v-text will override element children.`,
170
- [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
171
- [58]: `v-model argument is not supported on plain elements.`,
172
- [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
173
- [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
174
- [61]: `v-show is missing expression.`,
175
- [62]: `<Transition> expects exactly one child element or component.`,
176
- [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
177
- // just to fulfill types
178
- [64]: ``
179
- };
180
-
181
- const transformVHtml = (dir, node, context) => {
182
- const { exp, loc } = dir;
183
- if (!exp) {
184
- context.onError(
185
- createDOMCompilerError(53, loc)
186
- );
187
- }
188
- if (node.children.length) {
189
- context.onError(
190
- createDOMCompilerError(54, loc)
191
- );
192
- node.children.length = 0;
193
- }
194
- return {
195
- props: [
196
- createObjectProperty(
197
- createSimpleExpression(`innerHTML`, true, loc),
198
- exp || createSimpleExpression("", true)
199
- )
200
- ]
201
- };
202
- };
203
-
204
- const transformVText = (dir, node, context) => {
205
- const { exp, loc } = dir;
206
- if (!exp) {
207
- context.onError(
208
- createDOMCompilerError(55, loc)
209
- );
210
- }
211
- if (node.children.length) {
212
- context.onError(
213
- createDOMCompilerError(56, loc)
214
- );
215
- node.children.length = 0;
216
- }
217
- return {
218
- props: [
219
- createObjectProperty(
220
- createSimpleExpression(`textContent`, true),
221
- exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
222
- context.helperString(TO_DISPLAY_STRING),
223
- [exp],
224
- loc
225
- ) : createSimpleExpression("", true)
226
- )
227
- ]
228
- };
229
- };
230
-
231
- const transformModel = (dir, node, context) => {
232
- const baseResult = transformModel$1(dir, node, context);
233
- if (!baseResult.props.length || node.tagType === 1) {
234
- return baseResult;
235
- }
236
- if (dir.arg) {
237
- context.onError(
238
- createDOMCompilerError(
239
- 58,
240
- dir.arg.loc
241
- )
242
- );
243
- }
244
- function checkDuplicatedValue() {
245
- const value = findDir(node, "bind");
246
- if (value && isStaticArgOf(value.arg, "value")) {
247
- context.onError(
248
- createDOMCompilerError(
249
- 60,
250
- value.loc
251
- )
252
- );
253
- }
254
- }
255
- const { tag } = node;
256
- const isCustomElement = context.isCustomElement(tag);
257
- if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
258
- let directiveToUse = V_MODEL_TEXT;
259
- let isInvalidType = false;
260
- if (tag === "input" || isCustomElement) {
261
- const type = findProp(node, `type`);
262
- if (type) {
263
- if (type.type === 7) {
264
- directiveToUse = V_MODEL_DYNAMIC;
265
- } else if (type.value) {
266
- switch (type.value.content) {
267
- case "radio":
268
- directiveToUse = V_MODEL_RADIO;
269
- break;
270
- case "checkbox":
271
- directiveToUse = V_MODEL_CHECKBOX;
272
- break;
273
- case "file":
274
- isInvalidType = true;
275
- context.onError(
276
- createDOMCompilerError(
277
- 59,
278
- dir.loc
279
- )
280
- );
281
- break;
282
- default:
283
- !!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
284
- break;
285
- }
286
- }
287
- } else if (hasDynamicKeyVBind(node)) {
288
- directiveToUse = V_MODEL_DYNAMIC;
289
- } else {
290
- !!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
291
- }
292
- } else if (tag === "select") {
293
- directiveToUse = V_MODEL_SELECT;
294
- } else {
295
- !!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
296
- }
297
- if (!isInvalidType) {
298
- baseResult.needRuntime = context.helper(directiveToUse);
299
- }
300
- } else {
301
- context.onError(
302
- createDOMCompilerError(
303
- 57,
304
- dir.loc
305
- )
306
- );
307
- }
308
- baseResult.props = baseResult.props.filter(
309
- (p) => !(p.key.type === 4 && p.key.content === "modelValue")
310
- );
311
- return baseResult;
312
- };
313
-
314
- const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
315
- const isNonKeyModifier = /* @__PURE__ */ makeMap(
316
- // event propagation management
317
- `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
318
- );
319
- const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
320
- const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
321
- const resolveModifiers = (key, modifiers, context, loc) => {
322
- const keyModifiers = [];
323
- const nonKeyModifiers = [];
324
- const eventOptionModifiers = [];
325
- for (let i = 0; i < modifiers.length; i++) {
326
- const modifier = modifiers[i].content;
327
- if (modifier === "native" && context && checkCompatEnabled(
328
- "COMPILER_V_ON_NATIVE",
329
- context,
330
- loc
331
- )) {
332
- eventOptionModifiers.push(modifier);
333
- } else if (isEventOptionModifier(modifier)) {
334
- eventOptionModifiers.push(modifier);
335
- } else {
336
- const keyString = isString(key) ? key : isStaticExp(key) ? key.content : null;
337
- if (maybeKeyModifier(modifier)) {
338
- if (keyString) {
339
- if (isKeyboardEvent(keyString.toLowerCase())) {
340
- keyModifiers.push(modifier);
341
- } else {
342
- nonKeyModifiers.push(modifier);
343
- }
344
- } else {
345
- keyModifiers.push(modifier);
346
- nonKeyModifiers.push(modifier);
347
- }
348
- } else {
349
- if (isNonKeyModifier(modifier)) {
350
- nonKeyModifiers.push(modifier);
351
- } else {
352
- keyModifiers.push(modifier);
353
- }
354
- }
355
- }
356
- }
357
- return {
358
- keyModifiers,
359
- nonKeyModifiers,
360
- eventOptionModifiers
361
- };
362
- };
363
- const transformClick = (key, event) => {
364
- const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
365
- return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
366
- `(`,
367
- key,
368
- `) === "onClick" ? "${event}" : (`,
369
- key,
370
- `)`
371
- ]) : key;
372
- };
373
- const transformOn = (dir, node, context) => {
374
- return transformOn$1(dir, node, context, (baseResult) => {
375
- const { modifiers } = dir;
376
- if (!modifiers.length) return baseResult;
377
- let { key, value: handlerExp } = baseResult.props[0];
378
- const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
379
- if (nonKeyModifiers.includes("right")) {
380
- key = transformClick(key, `onContextmenu`);
381
- }
382
- if (nonKeyModifiers.includes("middle")) {
383
- key = transformClick(key, `onMouseup`);
384
- }
385
- if (nonKeyModifiers.length) {
386
- handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
387
- handlerExp,
388
- JSON.stringify(nonKeyModifiers)
389
- ]);
390
- }
391
- if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
392
- (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
393
- handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
394
- handlerExp,
395
- JSON.stringify(keyModifiers)
396
- ]);
397
- }
398
- if (eventOptionModifiers.length) {
399
- const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
400
- key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
401
- }
402
- return {
403
- props: [createObjectProperty(key, handlerExp)]
404
- };
405
- });
406
- };
407
-
408
- const transformShow = (dir, node, context) => {
409
- const { exp, loc } = dir;
410
- if (!exp) {
411
- context.onError(
412
- createDOMCompilerError(61, loc)
413
- );
414
- }
415
- return {
416
- props: [],
417
- needRuntime: context.helper(V_SHOW)
418
- };
419
- };
420
-
421
- const transformTransition = (node, context) => {
422
- if (node.type === 1 && node.tagType === 1) {
423
- const component = context.isBuiltInComponent(node.tag);
424
- if (component === TRANSITION) {
425
- return () => {
426
- if (!node.children.length) {
427
- return;
428
- }
429
- if (hasMultipleChildren(node)) {
430
- context.onError(
431
- createDOMCompilerError(
432
- 62,
433
- {
434
- start: node.children[0].loc.start,
435
- end: node.children[node.children.length - 1].loc.end,
436
- source: ""
437
- }
438
- )
439
- );
440
- }
441
- const child = node.children[0];
442
- if (child.type === 1) {
443
- for (const p of child.props) {
444
- if (p.type === 7 && p.name === "show") {
445
- node.props.push({
446
- type: 6,
447
- name: "persisted",
448
- nameLoc: node.loc,
449
- value: void 0,
450
- loc: node.loc
451
- });
452
- }
453
- }
454
- }
455
- };
456
- }
457
- }
458
- };
459
- function hasMultipleChildren(node) {
460
- const children = node.children = node.children.filter(
461
- (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
462
- );
463
- const child = children[0];
464
- return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
465
- }
466
-
467
- const ignoreSideEffectTags = (node, context) => {
468
- if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
469
- !!(process.env.NODE_ENV !== "production") && context.onError(
470
- createDOMCompilerError(
471
- 63,
472
- node.loc
473
- )
474
- );
475
- context.removeNode();
476
- }
477
- };
478
-
479
- function isValidHTMLNesting(parent, child) {
480
- if (parent === "template") {
481
- return true;
482
- }
483
- if (parent in onlyValidChildren) {
484
- return onlyValidChildren[parent].has(child);
485
- }
486
- if (child in onlyValidParents) {
487
- return onlyValidParents[child].has(parent);
488
- }
489
- if (parent in knownInvalidChildren) {
490
- if (knownInvalidChildren[parent].has(child)) return false;
491
- }
492
- if (child in knownInvalidParents) {
493
- if (knownInvalidParents[child].has(parent)) return false;
494
- }
495
- return true;
496
- }
497
- const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
498
- const emptySet = /* @__PURE__ */ new Set([]);
499
- const onlyValidChildren = {
500
- head: /* @__PURE__ */ new Set([
501
- "base",
502
- "basefront",
503
- "bgsound",
504
- "link",
505
- "meta",
506
- "title",
507
- "noscript",
508
- "noframes",
509
- "style",
510
- "script",
511
- "template"
512
- ]),
513
- optgroup: /* @__PURE__ */ new Set(["option"]),
514
- select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
515
- // table
516
- table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
517
- tr: /* @__PURE__ */ new Set(["td", "th"]),
518
- colgroup: /* @__PURE__ */ new Set(["col"]),
519
- tbody: /* @__PURE__ */ new Set(["tr"]),
520
- thead: /* @__PURE__ */ new Set(["tr"]),
521
- tfoot: /* @__PURE__ */ new Set(["tr"]),
522
- // these elements can not have any children elements
523
- script: emptySet,
524
- iframe: emptySet,
525
- option: emptySet,
526
- textarea: emptySet,
527
- style: emptySet,
528
- title: emptySet
529
- };
530
- const onlyValidParents = {
531
- // sections
532
- html: emptySet,
533
- body: /* @__PURE__ */ new Set(["html"]),
534
- head: /* @__PURE__ */ new Set(["html"]),
535
- // table
536
- td: /* @__PURE__ */ new Set(["tr"]),
537
- colgroup: /* @__PURE__ */ new Set(["table"]),
538
- caption: /* @__PURE__ */ new Set(["table"]),
539
- tbody: /* @__PURE__ */ new Set(["table"]),
540
- tfoot: /* @__PURE__ */ new Set(["table"]),
541
- col: /* @__PURE__ */ new Set(["colgroup"]),
542
- th: /* @__PURE__ */ new Set(["tr"]),
543
- thead: /* @__PURE__ */ new Set(["table"]),
544
- tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
545
- // data list
546
- dd: /* @__PURE__ */ new Set(["dl", "div"]),
547
- dt: /* @__PURE__ */ new Set(["dl", "div"]),
548
- // other
549
- figcaption: /* @__PURE__ */ new Set(["figure"]),
550
- // li: new Set(["ul", "ol"]),
551
- summary: /* @__PURE__ */ new Set(["details"]),
552
- area: /* @__PURE__ */ new Set(["map"])
553
- };
554
- const knownInvalidChildren = {
555
- p: /* @__PURE__ */ new Set([
556
- "address",
557
- "article",
558
- "aside",
559
- "blockquote",
560
- "center",
561
- "details",
562
- "dialog",
563
- "dir",
564
- "div",
565
- "dl",
566
- "fieldset",
567
- "figure",
568
- "footer",
569
- "form",
570
- "h1",
571
- "h2",
572
- "h3",
573
- "h4",
574
- "h5",
575
- "h6",
576
- "header",
577
- "hgroup",
578
- "hr",
579
- "li",
580
- "main",
581
- "nav",
582
- "menu",
583
- "ol",
584
- "p",
585
- "pre",
586
- "section",
587
- "table",
588
- "ul"
589
- ]),
590
- svg: /* @__PURE__ */ new Set([
591
- "b",
592
- "blockquote",
593
- "br",
594
- "code",
595
- "dd",
596
- "div",
597
- "dl",
598
- "dt",
599
- "em",
600
- "embed",
601
- "h1",
602
- "h2",
603
- "h3",
604
- "h4",
605
- "h5",
606
- "h6",
607
- "hr",
608
- "i",
609
- "img",
610
- "li",
611
- "menu",
612
- "meta",
613
- "ol",
614
- "p",
615
- "pre",
616
- "ruby",
617
- "s",
618
- "small",
619
- "span",
620
- "strong",
621
- "sub",
622
- "sup",
623
- "table",
624
- "u",
625
- "ul",
626
- "var"
627
- ])
628
- };
629
- const knownInvalidParents = {
630
- a: /* @__PURE__ */ new Set(["a"]),
631
- button: /* @__PURE__ */ new Set(["button"]),
632
- dd: /* @__PURE__ */ new Set(["dd", "dt"]),
633
- dt: /* @__PURE__ */ new Set(["dd", "dt"]),
634
- form: /* @__PURE__ */ new Set(["form"]),
635
- li: /* @__PURE__ */ new Set(["li"]),
636
- h1: headings,
637
- h2: headings,
638
- h3: headings,
639
- h4: headings,
640
- h5: headings,
641
- h6: headings
642
- };
643
-
644
- const validateHtmlNesting = (node, context) => {
645
- if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
646
- const error = new SyntaxError(
647
- `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
648
- );
649
- error.loc = node.loc;
650
- context.onWarn(error);
651
- }
652
- };
653
-
654
- const DOMNodeTransforms = [
655
- transformStyle,
656
- ...!!(process.env.NODE_ENV !== "production") ? [transformTransition, validateHtmlNesting] : []
657
- ];
658
- const DOMDirectiveTransforms = {
659
- cloak: noopDirectiveTransform,
660
- html: transformVHtml,
661
- text: transformVText,
662
- model: transformModel,
663
- // override compiler-core
664
- on: transformOn,
665
- // override compiler-core
666
- show: transformShow
667
- };
668
- function compile(src, options = {}) {
669
- return baseCompile(
670
- src,
671
- extend({}, parserOptions, options, {
672
- nodeTransforms: [
673
- // ignore <script> and <tag>
674
- // this is not put inside DOMNodeTransforms because that list is used
675
- // by compiler-ssr to generate vnode fallback branches
676
- ignoreSideEffectTags,
677
- ...DOMNodeTransforms,
678
- ...options.nodeTransforms || []
679
- ],
680
- directiveTransforms: extend(
681
- {},
682
- DOMDirectiveTransforms,
683
- options.directiveTransforms || {}
684
- ),
685
- transformHoist: null
686
- })
687
- );
688
- }
689
- function parse(template, options = {}) {
690
- return baseParse(template, extend({}, parserOptions, options));
691
- }
692
-
693
- export { DOMDirectiveTransforms, DOMErrorCodes, DOMErrorMessages, DOMNodeTransforms, TRANSITION, TRANSITION_GROUP, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, compile, createDOMCompilerError, isValidHTMLNesting, parse, parserOptions, resolveModifiers, transformStyle };