@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,856 +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
- 'use strict';
7
-
8
- Object.defineProperty(exports, '__esModule', { value: true });
9
-
10
- var compilerCore = require('@vue/compiler-core');
11
- var shared = require('@vue/shared');
12
-
13
- const V_MODEL_RADIO = Symbol(``);
14
- const V_MODEL_CHECKBOX = Symbol(
15
- ``
16
- );
17
- const V_MODEL_TEXT = Symbol(``);
18
- const V_MODEL_SELECT = Symbol(
19
- ``
20
- );
21
- const V_MODEL_DYNAMIC = Symbol(
22
- ``
23
- );
24
- const V_ON_WITH_MODIFIERS = Symbol(
25
- ``
26
- );
27
- const V_ON_WITH_KEYS = Symbol(
28
- ``
29
- );
30
- const V_SHOW = Symbol(``);
31
- const TRANSITION = Symbol(``);
32
- const TRANSITION_GROUP = Symbol(
33
- ``
34
- );
35
- compilerCore.registerRuntimeHelpers({
36
- [V_MODEL_RADIO]: `vModelRadio`,
37
- [V_MODEL_CHECKBOX]: `vModelCheckbox`,
38
- [V_MODEL_TEXT]: `vModelText`,
39
- [V_MODEL_SELECT]: `vModelSelect`,
40
- [V_MODEL_DYNAMIC]: `vModelDynamic`,
41
- [V_ON_WITH_MODIFIERS]: `withModifiers`,
42
- [V_ON_WITH_KEYS]: `withKeys`,
43
- [V_SHOW]: `vShow`,
44
- [TRANSITION]: `Transition`,
45
- [TRANSITION_GROUP]: `TransitionGroup`
46
- });
47
-
48
- const parserOptions = {
49
- parseMode: "html",
50
- isVoidTag: shared.isVoidTag,
51
- isNativeTag: (tag) => shared.isHTMLTag(tag) || shared.isSVGTag(tag) || shared.isMathMLTag(tag),
52
- isPreTag: (tag) => tag === "pre",
53
- isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
54
- decodeEntities: void 0,
55
- isBuiltInComponent: (tag) => {
56
- if (tag === "Transition" || tag === "transition") {
57
- return TRANSITION;
58
- } else if (tag === "TransitionGroup" || tag === "transition-group") {
59
- return TRANSITION_GROUP;
60
- }
61
- },
62
- // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
63
- getNamespace(tag, parent, rootNamespace) {
64
- let ns = parent ? parent.ns : rootNamespace;
65
- if (parent && ns === 2) {
66
- if (parent.tag === "annotation-xml") {
67
- if (tag === "svg") {
68
- return 1;
69
- }
70
- if (parent.props.some(
71
- (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
72
- )) {
73
- ns = 0;
74
- }
75
- } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
76
- ns = 0;
77
- }
78
- } else if (parent && ns === 1) {
79
- if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
80
- ns = 0;
81
- }
82
- }
83
- if (ns === 0) {
84
- if (tag === "svg") {
85
- return 1;
86
- }
87
- if (tag === "math") {
88
- return 2;
89
- }
90
- }
91
- return ns;
92
- }
93
- };
94
-
95
- const transformStyle = (node) => {
96
- if (node.type === 1) {
97
- node.props.forEach((p, i) => {
98
- if (p.type === 6 && p.name === "style" && p.value) {
99
- node.props[i] = {
100
- type: 7,
101
- name: `bind`,
102
- arg: compilerCore.createSimpleExpression(`style`, true, p.loc),
103
- exp: parseInlineCSS(p.value.content, p.loc),
104
- modifiers: [],
105
- loc: p.loc
106
- };
107
- }
108
- });
109
- }
110
- };
111
- const parseInlineCSS = (cssText, loc) => {
112
- const normalized = shared.parseStringStyle(cssText);
113
- return compilerCore.createSimpleExpression(
114
- JSON.stringify(normalized),
115
- false,
116
- loc,
117
- 3
118
- );
119
- };
120
-
121
- function createDOMCompilerError(code, loc) {
122
- return compilerCore.createCompilerError(
123
- code,
124
- loc,
125
- DOMErrorMessages
126
- );
127
- }
128
- const DOMErrorCodes = {
129
- "X_V_HTML_NO_EXPRESSION": 53,
130
- "53": "X_V_HTML_NO_EXPRESSION",
131
- "X_V_HTML_WITH_CHILDREN": 54,
132
- "54": "X_V_HTML_WITH_CHILDREN",
133
- "X_V_TEXT_NO_EXPRESSION": 55,
134
- "55": "X_V_TEXT_NO_EXPRESSION",
135
- "X_V_TEXT_WITH_CHILDREN": 56,
136
- "56": "X_V_TEXT_WITH_CHILDREN",
137
- "X_V_MODEL_ON_INVALID_ELEMENT": 57,
138
- "57": "X_V_MODEL_ON_INVALID_ELEMENT",
139
- "X_V_MODEL_ARG_ON_ELEMENT": 58,
140
- "58": "X_V_MODEL_ARG_ON_ELEMENT",
141
- "X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59,
142
- "59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
143
- "X_V_MODEL_UNNECESSARY_VALUE": 60,
144
- "60": "X_V_MODEL_UNNECESSARY_VALUE",
145
- "X_V_SHOW_NO_EXPRESSION": 61,
146
- "61": "X_V_SHOW_NO_EXPRESSION",
147
- "X_TRANSITION_INVALID_CHILDREN": 62,
148
- "62": "X_TRANSITION_INVALID_CHILDREN",
149
- "X_IGNORED_SIDE_EFFECT_TAG": 63,
150
- "63": "X_IGNORED_SIDE_EFFECT_TAG",
151
- "__EXTEND_POINT__": 64,
152
- "64": "__EXTEND_POINT__"
153
- };
154
- const DOMErrorMessages = {
155
- [53]: `v-html is missing expression.`,
156
- [54]: `v-html will override element children.`,
157
- [55]: `v-text is missing expression.`,
158
- [56]: `v-text will override element children.`,
159
- [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
160
- [58]: `v-model argument is not supported on plain elements.`,
161
- [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
162
- [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
163
- [61]: `v-show is missing expression.`,
164
- [62]: `<Transition> expects exactly one child element or component.`,
165
- [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
166
- // just to fulfill types
167
- [64]: ``
168
- };
169
-
170
- const transformVHtml = (dir, node, context) => {
171
- const { exp, loc } = dir;
172
- if (!exp) {
173
- context.onError(
174
- createDOMCompilerError(53, loc)
175
- );
176
- }
177
- if (node.children.length) {
178
- context.onError(
179
- createDOMCompilerError(54, loc)
180
- );
181
- node.children.length = 0;
182
- }
183
- return {
184
- props: [
185
- compilerCore.createObjectProperty(
186
- compilerCore.createSimpleExpression(`innerHTML`, true, loc),
187
- exp || compilerCore.createSimpleExpression("", true)
188
- )
189
- ]
190
- };
191
- };
192
-
193
- const transformVText = (dir, node, context) => {
194
- const { exp, loc } = dir;
195
- if (!exp) {
196
- context.onError(
197
- createDOMCompilerError(55, loc)
198
- );
199
- }
200
- if (node.children.length) {
201
- context.onError(
202
- createDOMCompilerError(56, loc)
203
- );
204
- node.children.length = 0;
205
- }
206
- return {
207
- props: [
208
- compilerCore.createObjectProperty(
209
- compilerCore.createSimpleExpression(`textContent`, true),
210
- exp ? compilerCore.getConstantType(exp, context) > 0 ? exp : compilerCore.createCallExpression(
211
- context.helperString(compilerCore.TO_DISPLAY_STRING),
212
- [exp],
213
- loc
214
- ) : compilerCore.createSimpleExpression("", true)
215
- )
216
- ]
217
- };
218
- };
219
-
220
- const transformModel = (dir, node, context) => {
221
- const baseResult = compilerCore.transformModel(dir, node, context);
222
- if (!baseResult.props.length || node.tagType === 1) {
223
- return baseResult;
224
- }
225
- if (dir.arg) {
226
- context.onError(
227
- createDOMCompilerError(
228
- 58,
229
- dir.arg.loc
230
- )
231
- );
232
- }
233
- const { tag } = node;
234
- const isCustomElement = context.isCustomElement(tag);
235
- if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
236
- let directiveToUse = V_MODEL_TEXT;
237
- let isInvalidType = false;
238
- if (tag === "input" || isCustomElement) {
239
- const type = compilerCore.findProp(node, `type`);
240
- if (type) {
241
- if (type.type === 7) {
242
- directiveToUse = V_MODEL_DYNAMIC;
243
- } else if (type.value) {
244
- switch (type.value.content) {
245
- case "radio":
246
- directiveToUse = V_MODEL_RADIO;
247
- break;
248
- case "checkbox":
249
- directiveToUse = V_MODEL_CHECKBOX;
250
- break;
251
- case "file":
252
- isInvalidType = true;
253
- context.onError(
254
- createDOMCompilerError(
255
- 59,
256
- dir.loc
257
- )
258
- );
259
- break;
260
- }
261
- }
262
- } else if (compilerCore.hasDynamicKeyVBind(node)) {
263
- directiveToUse = V_MODEL_DYNAMIC;
264
- } else ;
265
- } else if (tag === "select") {
266
- directiveToUse = V_MODEL_SELECT;
267
- } else ;
268
- if (!isInvalidType) {
269
- baseResult.needRuntime = context.helper(directiveToUse);
270
- }
271
- } else {
272
- context.onError(
273
- createDOMCompilerError(
274
- 57,
275
- dir.loc
276
- )
277
- );
278
- }
279
- baseResult.props = baseResult.props.filter(
280
- (p) => !(p.key.type === 4 && p.key.content === "modelValue")
281
- );
282
- return baseResult;
283
- };
284
-
285
- const isEventOptionModifier = /* @__PURE__ */ shared.makeMap(`passive,once,capture`);
286
- const isNonKeyModifier = /* @__PURE__ */ shared.makeMap(
287
- // event propagation management
288
- `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
289
- );
290
- const maybeKeyModifier = /* @__PURE__ */ shared.makeMap("left,right");
291
- const isKeyboardEvent = /* @__PURE__ */ shared.makeMap(`onkeyup,onkeydown,onkeypress`);
292
- const resolveModifiers = (key, modifiers, context, loc) => {
293
- const keyModifiers = [];
294
- const nonKeyModifiers = [];
295
- const eventOptionModifiers = [];
296
- for (let i = 0; i < modifiers.length; i++) {
297
- const modifier = modifiers[i].content;
298
- if (modifier === "native" && context && compilerCore.checkCompatEnabled(
299
- "COMPILER_V_ON_NATIVE",
300
- context,
301
- loc
302
- )) {
303
- eventOptionModifiers.push(modifier);
304
- } else if (isEventOptionModifier(modifier)) {
305
- eventOptionModifiers.push(modifier);
306
- } else {
307
- const keyString = shared.isString(key) ? key : compilerCore.isStaticExp(key) ? key.content : null;
308
- if (maybeKeyModifier(modifier)) {
309
- if (keyString) {
310
- if (isKeyboardEvent(keyString.toLowerCase())) {
311
- keyModifiers.push(modifier);
312
- } else {
313
- nonKeyModifiers.push(modifier);
314
- }
315
- } else {
316
- keyModifiers.push(modifier);
317
- nonKeyModifiers.push(modifier);
318
- }
319
- } else {
320
- if (isNonKeyModifier(modifier)) {
321
- nonKeyModifiers.push(modifier);
322
- } else {
323
- keyModifiers.push(modifier);
324
- }
325
- }
326
- }
327
- }
328
- return {
329
- keyModifiers,
330
- nonKeyModifiers,
331
- eventOptionModifiers
332
- };
333
- };
334
- const transformClick = (key, event) => {
335
- const isStaticClick = compilerCore.isStaticExp(key) && key.content.toLowerCase() === "onclick";
336
- return isStaticClick ? compilerCore.createSimpleExpression(event, true) : key.type !== 4 ? compilerCore.createCompoundExpression([
337
- `(`,
338
- key,
339
- `) === "onClick" ? "${event}" : (`,
340
- key,
341
- `)`
342
- ]) : key;
343
- };
344
- const transformOn = (dir, node, context) => {
345
- return compilerCore.transformOn(dir, node, context, (baseResult) => {
346
- const { modifiers } = dir;
347
- if (!modifiers.length) return baseResult;
348
- let { key, value: handlerExp } = baseResult.props[0];
349
- const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
350
- if (nonKeyModifiers.includes("right")) {
351
- key = transformClick(key, `onContextmenu`);
352
- }
353
- if (nonKeyModifiers.includes("middle")) {
354
- key = transformClick(key, `onMouseup`);
355
- }
356
- if (nonKeyModifiers.length) {
357
- handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
358
- handlerExp,
359
- JSON.stringify(nonKeyModifiers)
360
- ]);
361
- }
362
- if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
363
- (!compilerCore.isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
364
- handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_KEYS), [
365
- handlerExp,
366
- JSON.stringify(keyModifiers)
367
- ]);
368
- }
369
- if (eventOptionModifiers.length) {
370
- const modifierPostfix = eventOptionModifiers.map(shared.capitalize).join("");
371
- key = compilerCore.isStaticExp(key) ? compilerCore.createSimpleExpression(`${key.content}${modifierPostfix}`, true) : compilerCore.createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
372
- }
373
- return {
374
- props: [compilerCore.createObjectProperty(key, handlerExp)]
375
- };
376
- });
377
- };
378
-
379
- const transformShow = (dir, node, context) => {
380
- const { exp, loc } = dir;
381
- if (!exp) {
382
- context.onError(
383
- createDOMCompilerError(61, loc)
384
- );
385
- }
386
- return {
387
- props: [],
388
- needRuntime: context.helper(V_SHOW)
389
- };
390
- };
391
-
392
- const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
393
- const stringifyStatic = (children, context, parent) => {
394
- if (context.scopes.vSlot > 0) {
395
- return;
396
- }
397
- const isParentCached = parent.type === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !shared.isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 20;
398
- let nc = 0;
399
- let ec = 0;
400
- const currentChunk = [];
401
- const stringifyCurrentChunk = (currentIndex) => {
402
- if (nc >= 20 || ec >= 5) {
403
- const staticCall = compilerCore.createCallExpression(context.helper(compilerCore.CREATE_STATIC), [
404
- JSON.stringify(
405
- currentChunk.map((node) => stringifyNode(node, context)).join("")
406
- ).replace(expReplaceRE, `" + $1 + "`),
407
- // the 2nd argument indicates the number of DOM nodes this static vnode
408
- // will insert / hydrate
409
- String(currentChunk.length)
410
- ]);
411
- const deleteCount = currentChunk.length - 1;
412
- if (isParentCached) {
413
- children.splice(
414
- currentIndex - currentChunk.length,
415
- currentChunk.length,
416
- // @ts-expect-error
417
- staticCall
418
- );
419
- } else {
420
- currentChunk[0].codegenNode.value = staticCall;
421
- if (currentChunk.length > 1) {
422
- children.splice(currentIndex - currentChunk.length + 1, deleteCount);
423
- const cacheIndex = context.cached.indexOf(
424
- currentChunk[currentChunk.length - 1].codegenNode
425
- );
426
- if (cacheIndex > -1) {
427
- for (let i2 = cacheIndex; i2 < context.cached.length; i2++) {
428
- const c = context.cached[i2];
429
- if (c) c.index -= deleteCount;
430
- }
431
- context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
432
- }
433
- }
434
- }
435
- return deleteCount;
436
- }
437
- return 0;
438
- };
439
- let i = 0;
440
- for (; i < children.length; i++) {
441
- const child = children[i];
442
- const isCached = isParentCached || getCachedNode(child);
443
- if (isCached) {
444
- const result = analyzeNode(child);
445
- if (result) {
446
- nc += result[0];
447
- ec += result[1];
448
- currentChunk.push(child);
449
- continue;
450
- }
451
- }
452
- i -= stringifyCurrentChunk(i);
453
- nc = 0;
454
- ec = 0;
455
- currentChunk.length = 0;
456
- }
457
- stringifyCurrentChunk(i);
458
- };
459
- const getCachedNode = (node) => {
460
- if ((node.type === 1 && node.tagType === 0 || node.type === 12) && node.codegenNode && node.codegenNode.type === 20) {
461
- return node.codegenNode;
462
- }
463
- };
464
- const dataAriaRE = /^(data|aria)-/;
465
- const isStringifiableAttr = (name, ns) => {
466
- return (ns === 0 ? shared.isKnownHtmlAttr(name) : ns === 1 ? shared.isKnownSvgAttr(name) : ns === 2 ? shared.isKnownMathMLAttr(name) : false) || dataAriaRE.test(name);
467
- };
468
- const isNonStringifiable = /* @__PURE__ */ shared.makeMap(
469
- `caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
470
- );
471
- function analyzeNode(node) {
472
- if (node.type === 1 && isNonStringifiable(node.tag)) {
473
- return false;
474
- }
475
- if (node.type === 12) {
476
- return [1, 0];
477
- }
478
- let nc = 1;
479
- let ec = node.props.length > 0 ? 1 : 0;
480
- let bailed = false;
481
- const bail = () => {
482
- bailed = true;
483
- return false;
484
- };
485
- function walk(node2) {
486
- const isOptionTag = node2.tag === "option" && node2.ns === 0;
487
- for (let i = 0; i < node2.props.length; i++) {
488
- const p = node2.props[i];
489
- if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
490
- return bail();
491
- }
492
- if (p.type === 7 && p.name === "bind") {
493
- if (p.arg && (p.arg.type === 8 || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node2.ns))) {
494
- return bail();
495
- }
496
- if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
497
- return bail();
498
- }
499
- if (isOptionTag && compilerCore.isStaticArgOf(p.arg, "value") && p.exp && !p.exp.isStatic) {
500
- return bail();
501
- }
502
- }
503
- }
504
- for (let i = 0; i < node2.children.length; i++) {
505
- nc++;
506
- const child = node2.children[i];
507
- if (child.type === 1) {
508
- if (child.props.length > 0) {
509
- ec++;
510
- }
511
- walk(child);
512
- if (bailed) {
513
- return false;
514
- }
515
- }
516
- }
517
- return true;
518
- }
519
- return walk(node) ? [nc, ec] : false;
520
- }
521
- function stringifyNode(node, context) {
522
- if (shared.isString(node)) {
523
- return node;
524
- }
525
- if (shared.isSymbol(node)) {
526
- return ``;
527
- }
528
- switch (node.type) {
529
- case 1:
530
- return stringifyElement(node, context);
531
- case 2:
532
- return shared.escapeHtml(node.content);
533
- case 3:
534
- return `<!--${shared.escapeHtml(node.content)}-->`;
535
- case 5:
536
- return shared.escapeHtml(shared.toDisplayString(evaluateConstant(node.content)));
537
- case 8:
538
- return shared.escapeHtml(evaluateConstant(node));
539
- case 12:
540
- return stringifyNode(node.content, context);
541
- default:
542
- return "";
543
- }
544
- }
545
- function stringifyElement(node, context) {
546
- let res = `<${node.tag}`;
547
- let innerHTML = "";
548
- for (let i = 0; i < node.props.length; i++) {
549
- const p = node.props[i];
550
- if (p.type === 6) {
551
- res += ` ${p.name}`;
552
- if (p.value) {
553
- res += `="${shared.escapeHtml(p.value.content)}"`;
554
- }
555
- } else if (p.type === 7) {
556
- if (p.name === "bind") {
557
- const exp = p.exp;
558
- if (exp.content[0] === "_") {
559
- res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
560
- continue;
561
- }
562
- if (shared.isBooleanAttr(p.arg.content) && exp.content === "false") {
563
- continue;
564
- }
565
- let evaluated = evaluateConstant(exp);
566
- if (evaluated != null) {
567
- const arg = p.arg && p.arg.content;
568
- if (arg === "class") {
569
- evaluated = shared.normalizeClass(evaluated);
570
- } else if (arg === "style") {
571
- evaluated = shared.stringifyStyle(shared.normalizeStyle(evaluated));
572
- }
573
- res += ` ${p.arg.content}="${shared.escapeHtml(
574
- evaluated
575
- )}"`;
576
- }
577
- } else if (p.name === "html") {
578
- innerHTML = evaluateConstant(p.exp);
579
- } else if (p.name === "text") {
580
- innerHTML = shared.escapeHtml(
581
- shared.toDisplayString(evaluateConstant(p.exp))
582
- );
583
- }
584
- }
585
- }
586
- if (context.scopeId) {
587
- res += ` ${context.scopeId}`;
588
- }
589
- res += `>`;
590
- if (innerHTML) {
591
- res += innerHTML;
592
- } else {
593
- for (let i = 0; i < node.children.length; i++) {
594
- res += stringifyNode(node.children[i], context);
595
- }
596
- }
597
- if (!shared.isVoidTag(node.tag)) {
598
- res += `</${node.tag}>`;
599
- }
600
- return res;
601
- }
602
- function evaluateConstant(exp) {
603
- if (exp.type === 4) {
604
- return new Function(`return (${exp.content})`)();
605
- } else {
606
- let res = ``;
607
- exp.children.forEach((c) => {
608
- if (shared.isString(c) || shared.isSymbol(c)) {
609
- return;
610
- }
611
- if (c.type === 2) {
612
- res += c.content;
613
- } else if (c.type === 5) {
614
- res += shared.toDisplayString(evaluateConstant(c.content));
615
- } else {
616
- res += evaluateConstant(c);
617
- }
618
- });
619
- return res;
620
- }
621
- }
622
-
623
- const ignoreSideEffectTags = (node, context) => {
624
- if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
625
- context.removeNode();
626
- }
627
- };
628
-
629
- function isValidHTMLNesting(parent, child) {
630
- if (parent === "template") {
631
- return true;
632
- }
633
- if (parent in onlyValidChildren) {
634
- return onlyValidChildren[parent].has(child);
635
- }
636
- if (child in onlyValidParents) {
637
- return onlyValidParents[child].has(parent);
638
- }
639
- if (parent in knownInvalidChildren) {
640
- if (knownInvalidChildren[parent].has(child)) return false;
641
- }
642
- if (child in knownInvalidParents) {
643
- if (knownInvalidParents[child].has(parent)) return false;
644
- }
645
- return true;
646
- }
647
- const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
648
- const emptySet = /* @__PURE__ */ new Set([]);
649
- const onlyValidChildren = {
650
- head: /* @__PURE__ */ new Set([
651
- "base",
652
- "basefront",
653
- "bgsound",
654
- "link",
655
- "meta",
656
- "title",
657
- "noscript",
658
- "noframes",
659
- "style",
660
- "script",
661
- "template"
662
- ]),
663
- optgroup: /* @__PURE__ */ new Set(["option"]),
664
- select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
665
- // table
666
- table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
667
- tr: /* @__PURE__ */ new Set(["td", "th"]),
668
- colgroup: /* @__PURE__ */ new Set(["col"]),
669
- tbody: /* @__PURE__ */ new Set(["tr"]),
670
- thead: /* @__PURE__ */ new Set(["tr"]),
671
- tfoot: /* @__PURE__ */ new Set(["tr"]),
672
- // these elements can not have any children elements
673
- script: emptySet,
674
- iframe: emptySet,
675
- option: emptySet,
676
- textarea: emptySet,
677
- style: emptySet,
678
- title: emptySet
679
- };
680
- const onlyValidParents = {
681
- // sections
682
- html: emptySet,
683
- body: /* @__PURE__ */ new Set(["html"]),
684
- head: /* @__PURE__ */ new Set(["html"]),
685
- // table
686
- td: /* @__PURE__ */ new Set(["tr"]),
687
- colgroup: /* @__PURE__ */ new Set(["table"]),
688
- caption: /* @__PURE__ */ new Set(["table"]),
689
- tbody: /* @__PURE__ */ new Set(["table"]),
690
- tfoot: /* @__PURE__ */ new Set(["table"]),
691
- col: /* @__PURE__ */ new Set(["colgroup"]),
692
- th: /* @__PURE__ */ new Set(["tr"]),
693
- thead: /* @__PURE__ */ new Set(["table"]),
694
- tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
695
- // data list
696
- dd: /* @__PURE__ */ new Set(["dl", "div"]),
697
- dt: /* @__PURE__ */ new Set(["dl", "div"]),
698
- // other
699
- figcaption: /* @__PURE__ */ new Set(["figure"]),
700
- // li: new Set(["ul", "ol"]),
701
- summary: /* @__PURE__ */ new Set(["details"]),
702
- area: /* @__PURE__ */ new Set(["map"])
703
- };
704
- const knownInvalidChildren = {
705
- p: /* @__PURE__ */ new Set([
706
- "address",
707
- "article",
708
- "aside",
709
- "blockquote",
710
- "center",
711
- "details",
712
- "dialog",
713
- "dir",
714
- "div",
715
- "dl",
716
- "fieldset",
717
- "figure",
718
- "footer",
719
- "form",
720
- "h1",
721
- "h2",
722
- "h3",
723
- "h4",
724
- "h5",
725
- "h6",
726
- "header",
727
- "hgroup",
728
- "hr",
729
- "li",
730
- "main",
731
- "nav",
732
- "menu",
733
- "ol",
734
- "p",
735
- "pre",
736
- "section",
737
- "table",
738
- "ul"
739
- ]),
740
- svg: /* @__PURE__ */ new Set([
741
- "b",
742
- "blockquote",
743
- "br",
744
- "code",
745
- "dd",
746
- "div",
747
- "dl",
748
- "dt",
749
- "em",
750
- "embed",
751
- "h1",
752
- "h2",
753
- "h3",
754
- "h4",
755
- "h5",
756
- "h6",
757
- "hr",
758
- "i",
759
- "img",
760
- "li",
761
- "menu",
762
- "meta",
763
- "ol",
764
- "p",
765
- "pre",
766
- "ruby",
767
- "s",
768
- "small",
769
- "span",
770
- "strong",
771
- "sub",
772
- "sup",
773
- "table",
774
- "u",
775
- "ul",
776
- "var"
777
- ])
778
- };
779
- const knownInvalidParents = {
780
- a: /* @__PURE__ */ new Set(["a"]),
781
- button: /* @__PURE__ */ new Set(["button"]),
782
- dd: /* @__PURE__ */ new Set(["dd", "dt"]),
783
- dt: /* @__PURE__ */ new Set(["dd", "dt"]),
784
- form: /* @__PURE__ */ new Set(["form"]),
785
- li: /* @__PURE__ */ new Set(["li"]),
786
- h1: headings,
787
- h2: headings,
788
- h3: headings,
789
- h4: headings,
790
- h5: headings,
791
- h6: headings
792
- };
793
-
794
- const DOMNodeTransforms = [
795
- transformStyle,
796
- ...[]
797
- ];
798
- const DOMDirectiveTransforms = {
799
- cloak: compilerCore.noopDirectiveTransform,
800
- html: transformVHtml,
801
- text: transformVText,
802
- model: transformModel,
803
- // override compiler-core
804
- on: transformOn,
805
- // override compiler-core
806
- show: transformShow
807
- };
808
- function compile(src, options = {}) {
809
- return compilerCore.baseCompile(
810
- src,
811
- shared.extend({}, parserOptions, options, {
812
- nodeTransforms: [
813
- // ignore <script> and <tag>
814
- // this is not put inside DOMNodeTransforms because that list is used
815
- // by compiler-ssr to generate vnode fallback branches
816
- ignoreSideEffectTags,
817
- ...DOMNodeTransforms,
818
- ...options.nodeTransforms || []
819
- ],
820
- directiveTransforms: shared.extend(
821
- {},
822
- DOMDirectiveTransforms,
823
- options.directiveTransforms || {}
824
- ),
825
- transformHoist: stringifyStatic
826
- })
827
- );
828
- }
829
- function parse(template, options = {}) {
830
- return compilerCore.baseParse(template, shared.extend({}, parserOptions, options));
831
- }
832
-
833
- exports.DOMDirectiveTransforms = DOMDirectiveTransforms;
834
- exports.DOMErrorCodes = DOMErrorCodes;
835
- exports.DOMErrorMessages = DOMErrorMessages;
836
- exports.DOMNodeTransforms = DOMNodeTransforms;
837
- exports.TRANSITION = TRANSITION;
838
- exports.TRANSITION_GROUP = TRANSITION_GROUP;
839
- exports.V_MODEL_CHECKBOX = V_MODEL_CHECKBOX;
840
- exports.V_MODEL_DYNAMIC = V_MODEL_DYNAMIC;
841
- exports.V_MODEL_RADIO = V_MODEL_RADIO;
842
- exports.V_MODEL_SELECT = V_MODEL_SELECT;
843
- exports.V_MODEL_TEXT = V_MODEL_TEXT;
844
- exports.V_ON_WITH_KEYS = V_ON_WITH_KEYS;
845
- exports.V_ON_WITH_MODIFIERS = V_ON_WITH_MODIFIERS;
846
- exports.V_SHOW = V_SHOW;
847
- exports.compile = compile;
848
- exports.createDOMCompilerError = createDOMCompilerError;
849
- exports.isValidHTMLNesting = isValidHTMLNesting;
850
- exports.parse = parse;
851
- exports.parserOptions = parserOptions;
852
- exports.resolveModifiers = resolveModifiers;
853
- exports.transformStyle = transformStyle;
854
- Object.keys(compilerCore).forEach(function (k) {
855
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = compilerCore[k];
856
- });