@dcloudio/uni-cli-shared 3.0.0-4080720251210001 → 3.0.0-5000320260312001

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 (145) hide show
  1. package/dist/constants.d.ts +3 -0
  2. package/dist/constants.js +6 -1
  3. package/dist/deps.js +6 -1
  4. package/dist/dom2/index.d.ts +1 -0
  5. package/dist/dom2/index.js +17 -0
  6. package/dist/dom2/sharedData.d.ts +2 -0
  7. package/dist/dom2/sharedData.js +19 -0
  8. package/dist/easycom.js +34 -5
  9. package/dist/env/define.d.ts +3 -0
  10. package/dist/env/define.js +12 -0
  11. package/dist/hbx/alias.js +15 -17
  12. package/dist/hbx/index.d.ts +1 -1
  13. package/dist/hbx/index.js +4 -2
  14. package/dist/hbx/log.d.ts +5 -0
  15. package/dist/hbx/log.js +44 -1
  16. package/dist/i18n.js +4 -0
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.js +1 -0
  19. package/dist/json/app/manifest/index.d.ts +1 -0
  20. package/dist/json/app/manifest/index.js +3 -1
  21. package/dist/json/mp/pages.js +0 -5
  22. package/dist/json/pages.d.ts +2 -2
  23. package/dist/json/pages.js +4 -1
  24. package/dist/json/uni-x/index.d.ts +1 -1
  25. package/dist/json/utils.js +31 -22
  26. package/dist/logs/console.js +1 -1
  27. package/dist/logs/index.d.ts +11 -0
  28. package/dist/logs/index.js +34 -1
  29. package/dist/messages/en.d.ts +6 -3
  30. package/dist/messages/en.js +6 -3
  31. package/dist/messages/index.d.ts +11 -5
  32. package/dist/messages/zh_CN.d.ts +5 -2
  33. package/dist/messages/zh_CN.js +5 -2
  34. package/dist/mp/assets.d.ts +1 -0
  35. package/dist/mp/assets.js +27 -1
  36. package/dist/mp/externalClasses.d.ts +38 -2
  37. package/dist/mp/externalClasses.js +90 -4
  38. package/dist/mp/index.d.ts +4 -3
  39. package/dist/mp/index.js +11 -1
  40. package/dist/mp/plugin.d.ts +1 -0
  41. package/dist/mp/plugin.js +14 -1
  42. package/dist/mp/style.d.ts +1 -0
  43. package/dist/mp/style.js +8 -1
  44. package/dist/mp/usingComponents.d.ts +1 -0
  45. package/dist/mp/usingComponents.js +17 -1
  46. package/dist/postcss/index.d.ts +2 -0
  47. package/dist/postcss/index.js +3 -1
  48. package/dist/postcss/plugins/stylePluginExternal.d.ts +17 -0
  49. package/dist/postcss/plugins/stylePluginExternal.js +127 -0
  50. package/dist/postcss/plugins/stylePluginScoped.js +30 -0
  51. package/dist/preprocess/context.js +2 -0
  52. package/dist/preprocess/index.d.ts +9 -6
  53. package/dist/preprocess/index.js +33 -8
  54. package/dist/resolve.js +5 -1
  55. package/dist/uni_modules.js +20 -4
  56. package/dist/utils.d.ts +2 -2
  57. package/dist/utils.js +9 -6
  58. package/dist/utsUtils.d.ts +1 -0
  59. package/dist/utsUtils.js +2 -1
  60. package/dist/vite/autoImport.js +91 -6
  61. package/dist/vite/plugins/console.js +1 -1
  62. package/dist/vite/plugins/cssScoped.js +2 -1
  63. package/dist/vite/plugins/easycom.js +7 -0
  64. package/dist/vite/plugins/json.js +69 -2
  65. package/dist/vite/plugins/pre.js +4 -2
  66. package/dist/vite/plugins/sfc.js +1 -1
  67. package/dist/vite/plugins/stats.js +32 -0
  68. package/dist/vite/plugins/uts/ext-api.js +1 -1
  69. package/dist/vite/plugins/uts/uni_modules.js +12 -0
  70. package/dist/vite/plugins/uts/uvue.js +7 -2
  71. package/dist/vite/plugins/vitejs/plugins/asset.d.ts +1 -0
  72. package/dist/vite/plugins/vitejs/plugins/asset.js +19 -1
  73. package/dist/vite/plugins/vitejs/plugins/css.d.ts +2 -1
  74. package/dist/vite/plugins/vitejs/plugins/css.js +27 -10
  75. package/dist/vite/utils/ast.d.ts +2 -1
  76. package/dist/vite/utils/ast.js +5 -1
  77. package/dist/vue/parse.d.ts +2 -0
  78. package/dist/vue/parse.js +3 -1
  79. package/dist/vue/transforms/index.d.ts +1 -0
  80. package/dist/vue/transforms/index.js +1 -0
  81. package/dist/vue/transforms/transformLineBreak.d.ts +2 -0
  82. package/dist/vue/transforms/transformLineBreak.js +15 -0
  83. package/dist/vue/transforms/transformTag.d.ts +1 -1
  84. package/dist/vue/transforms/transformTag.js +5 -0
  85. package/dist/vue/transforms/x/transformMPBuiltInTag.js +2 -2
  86. package/dist/vue/utils.js +8 -1
  87. package/lib/@vue/compiler-core/dist/compiler-core.cjs.js +42 -23
  88. package/lib/@vue/compiler-core/dist/compiler-core.cjs.prod.js +42 -23
  89. package/lib/@vue/compiler-core/dist/compiler-core.esm-bundler.js +39 -19
  90. package/lib/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +4635 -1024
  91. package/lib/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +8762 -7849
  92. package/lib/dom2/app/@vitejs/plugin-vue/LICENSE +21 -0
  93. package/lib/dom2/app/@vitejs/plugin-vue/README.md +278 -0
  94. package/lib/dom2/app/@vitejs/plugin-vue/dist/index.cjs +3353 -0
  95. package/lib/dom2/app/@vitejs/plugin-vue/dist/index.d.cts +113 -0
  96. package/lib/dom2/app/@vitejs/plugin-vue/dist/index.d.mts +111 -0
  97. package/lib/dom2/app/@vitejs/plugin-vue/dist/index.d.ts +113 -0
  98. package/lib/dom2/app/@vitejs/plugin-vue/dist/index.mjs +3338 -0
  99. package/lib/dom2/app/@vitejs/plugin-vue/package.json +50 -0
  100. package/lib/dom2/app/@vue/compiler-core/LICENSE +21 -0
  101. package/lib/dom2/app/@vue/compiler-core/README.md +1 -0
  102. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.js +5492 -0
  103. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.prod.js +5436 -0
  104. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.d.ts +1187 -0
  105. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.esm-bundler.js +4335 -0
  106. package/lib/dom2/app/@vue/compiler-core/index.js +7 -0
  107. package/lib/dom2/app/@vue/compiler-core/package.json +58 -0
  108. package/lib/dom2/app/@vue/compiler-dom/LICENSE +21 -0
  109. package/lib/dom2/app/@vue/compiler-dom/README.md +1 -0
  110. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.js +762 -0
  111. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +736 -0
  112. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.d.ts +73 -0
  113. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +5051 -0
  114. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +11 -0
  115. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +557 -0
  116. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.js +5234 -0
  117. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.prod.js +11 -0
  118. package/lib/dom2/app/@vue/compiler-dom/index.js +7 -0
  119. package/lib/dom2/app/@vue/compiler-dom/package.json +57 -0
  120. package/lib/dom2/app/@vue/compiler-sfc/LICENSE +21 -0
  121. package/lib/dom2/app/@vue/compiler-sfc/README.md +80 -0
  122. package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +15528 -0
  123. package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.d.ts +11595 -0
  124. package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +41525 -0
  125. package/lib/dom2/app/@vue/compiler-sfc/package.json +68 -0
  126. package/lib/dom2/app/@vue/compiler-vapor/LICENSE +21 -0
  127. package/lib/dom2/app/@vue/compiler-vapor/README.md +1 -0
  128. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +3584 -0
  129. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.d.ts +22858 -0
  130. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +22438 -0
  131. package/lib/dom2/app/@vue/compiler-vapor/package.json +51 -0
  132. package/lib/dom2/app/@vue/compiler-vapor-dom2/dist/compiler-vapor-dom2.cjs.js +1 -0
  133. package/lib/dom2/app/@vue/compiler-vapor-dom2/package.json +56 -0
  134. package/lib/dom2/app/@vue/shared/LICENSE +21 -0
  135. package/lib/dom2/app/@vue/shared/README.md +3 -0
  136. package/lib/dom2/app/@vue/shared/dist/shared.cjs.js +773 -0
  137. package/lib/dom2/app/@vue/shared/dist/shared.cjs.prod.js +773 -0
  138. package/lib/dom2/app/@vue/shared/dist/shared.d.ts +412 -0
  139. package/lib/dom2/app/@vue/shared/dist/shared.esm-bundler.js +688 -0
  140. package/lib/dom2/app/@vue/shared/index.js +7 -0
  141. package/lib/dom2/app/@vue/shared/package.json +47 -0
  142. package/lib/preprocess/lib/preprocess.js +9 -3
  143. package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.js +1 -1
  144. package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.prod.js +1 -1
  145. package/package.json +8 -6
@@ -0,0 +1,557 @@
1
+ /**
2
+ * @vue/compiler-dom v3.6.0-beta.5
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/
6
+ import { TO_DISPLAY_STRING, baseCompile, baseParse, checkCompatEnabled, createCallExpression, createCompilerError, createCompoundExpression, createObjectProperty, createSimpleExpression, findDir, findProp, getConstantType, hasDynamicKeyVBind, isCommentOrWhitespace, isStaticArgOf, isStaticExp, noopDirectiveTransform, registerRuntimeHelpers, transformModel, transformOn } from "@vue/compiler-core";
7
+ import { capitalize, extend, isHTMLTag, isMathMLTag, isSVGTag, isString, isVoidTag, makeMap, parseStringStyle } from "@vue/shared";
8
+
9
+ export * from "@vue/compiler-core"
10
+
11
+ //#region packages/compiler-dom/src/runtimeHelpers.ts
12
+ const V_MODEL_RADIO = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelRadio` : ``);
13
+ const V_MODEL_CHECKBOX = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelCheckbox` : ``);
14
+ const V_MODEL_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelText` : ``);
15
+ const V_MODEL_SELECT = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelSelect` : ``);
16
+ const V_MODEL_DYNAMIC = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelDynamic` : ``);
17
+ const V_ON_WITH_MODIFIERS = Symbol(!!(process.env.NODE_ENV !== "production") ? `vOnModifiersGuard` : ``);
18
+ const V_ON_WITH_KEYS = Symbol(!!(process.env.NODE_ENV !== "production") ? `vOnKeysGuard` : ``);
19
+ const V_SHOW = Symbol(!!(process.env.NODE_ENV !== "production") ? `vShow` : ``);
20
+ const TRANSITION = Symbol(!!(process.env.NODE_ENV !== "production") ? `Transition` : ``);
21
+ const TRANSITION_GROUP = Symbol(!!(process.env.NODE_ENV !== "production") ? `TransitionGroup` : ``);
22
+ registerRuntimeHelpers({
23
+ [V_MODEL_RADIO]: `vModelRadio`,
24
+ [V_MODEL_CHECKBOX]: `vModelCheckbox`,
25
+ [V_MODEL_TEXT]: `vModelText`,
26
+ [V_MODEL_SELECT]: `vModelSelect`,
27
+ [V_MODEL_DYNAMIC]: `vModelDynamic`,
28
+ [V_ON_WITH_MODIFIERS]: `withModifiers`,
29
+ [V_ON_WITH_KEYS]: `withKeys`,
30
+ [V_SHOW]: `vShow`,
31
+ [TRANSITION]: `Transition`,
32
+ [TRANSITION_GROUP]: `TransitionGroup`
33
+ });
34
+
35
+ //#endregion
36
+ //#region packages/compiler-dom/src/decodeHtmlBrowser.ts
37
+ let decoder;
38
+ function decodeHtmlBrowser(raw, asAttr = false) {
39
+ if (!decoder) decoder = document.createElement("div");
40
+ if (asAttr) {
41
+ decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
42
+ return decoder.children[0].getAttribute("foo");
43
+ } else {
44
+ decoder.innerHTML = raw;
45
+ return decoder.textContent;
46
+ }
47
+ }
48
+
49
+ //#endregion
50
+ //#region packages/compiler-dom/src/parserOptions.ts
51
+ const parserOptions = {
52
+ parseMode: "html",
53
+ isVoidTag,
54
+ isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
55
+ isPreTag: (tag) => tag === "pre",
56
+ isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
57
+ decodeEntities: decodeHtmlBrowser,
58
+ isBuiltInComponent: (tag) => {
59
+ if (tag === "Transition" || tag === "transition") return TRANSITION;
60
+ else if (tag === "TransitionGroup" || tag === "transition-group") return TRANSITION_GROUP;
61
+ },
62
+ getNamespace(tag, parent, rootNamespace) {
63
+ let ns = parent ? parent.ns : rootNamespace;
64
+ if (parent && ns === 2) {
65
+ if (parent.tag === "annotation-xml") {
66
+ if (isSVGTag(tag)) return 1;
67
+ if (parent.props.some((a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml"))) ns = 0;
68
+ } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") ns = 0;
69
+ } else if (parent && ns === 1) {
70
+ if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") ns = 0;
71
+ }
72
+ if (ns === 0) {
73
+ if (isSVGTag(tag)) return 1;
74
+ if (isMathMLTag(tag)) return 2;
75
+ }
76
+ return ns;
77
+ }
78
+ };
79
+
80
+ //#endregion
81
+ //#region packages/compiler-dom/src/transforms/transformStyle.ts
82
+ const transformStyle = (node) => {
83
+ if (node.type === 1) node.props.forEach((p, i) => {
84
+ if (p.type === 6 && p.name === "style" && p.value) node.props[i] = {
85
+ type: 7,
86
+ name: `bind`,
87
+ arg: createSimpleExpression(`style`, true, p.loc),
88
+ exp: parseInlineCSS(p.value.content, p.loc),
89
+ modifiers: [],
90
+ loc: p.loc
91
+ };
92
+ });
93
+ };
94
+ const parseInlineCSS = (cssText, loc) => {
95
+ const normalized = parseStringStyle(cssText);
96
+ return createSimpleExpression(JSON.stringify(normalized), false, loc, 3);
97
+ };
98
+
99
+ //#endregion
100
+ //#region packages/compiler-dom/src/errors.ts
101
+ function createDOMCompilerError(code, loc) {
102
+ return createCompilerError(code, loc, !!(process.env.NODE_ENV !== "production") || false ? DOMErrorMessages : void 0);
103
+ }
104
+ const DOMErrorCodes = {
105
+ "X_V_HTML_NO_EXPRESSION": 54,
106
+ "54": "X_V_HTML_NO_EXPRESSION",
107
+ "X_V_HTML_WITH_CHILDREN": 55,
108
+ "55": "X_V_HTML_WITH_CHILDREN",
109
+ "X_V_TEXT_NO_EXPRESSION": 56,
110
+ "56": "X_V_TEXT_NO_EXPRESSION",
111
+ "X_V_TEXT_WITH_CHILDREN": 57,
112
+ "57": "X_V_TEXT_WITH_CHILDREN",
113
+ "X_V_MODEL_ON_INVALID_ELEMENT": 58,
114
+ "58": "X_V_MODEL_ON_INVALID_ELEMENT",
115
+ "X_V_MODEL_ARG_ON_ELEMENT": 59,
116
+ "59": "X_V_MODEL_ARG_ON_ELEMENT",
117
+ "X_V_MODEL_ON_FILE_INPUT_ELEMENT": 60,
118
+ "60": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
119
+ "X_V_MODEL_UNNECESSARY_VALUE": 61,
120
+ "61": "X_V_MODEL_UNNECESSARY_VALUE",
121
+ "X_V_SHOW_NO_EXPRESSION": 62,
122
+ "62": "X_V_SHOW_NO_EXPRESSION",
123
+ "X_TRANSITION_INVALID_CHILDREN": 63,
124
+ "63": "X_TRANSITION_INVALID_CHILDREN",
125
+ "X_IGNORED_SIDE_EFFECT_TAG": 64,
126
+ "64": "X_IGNORED_SIDE_EFFECT_TAG",
127
+ "__EXTEND_POINT__": 65,
128
+ "65": "__EXTEND_POINT__"
129
+ };
130
+ const DOMErrorMessages = {
131
+ [54]: `v-html is missing expression.`,
132
+ [55]: `v-html will override element children.`,
133
+ [56]: `v-text is missing expression.`,
134
+ [57]: `v-text will override element children.`,
135
+ [58]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
136
+ [59]: `v-model argument is not supported on plain elements.`,
137
+ [60]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
138
+ [61]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
139
+ [62]: `v-show is missing expression.`,
140
+ [63]: `<Transition> expects exactly one child element or component.`,
141
+ [64]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
142
+ [65]: ``
143
+ };
144
+
145
+ //#endregion
146
+ //#region packages/compiler-dom/src/transforms/vHtml.ts
147
+ const transformVHtml = (dir, node, context) => {
148
+ const { exp, loc } = dir;
149
+ if (!exp) context.onError(createDOMCompilerError(54, loc));
150
+ if (node.children.length) {
151
+ context.onError(createDOMCompilerError(55, loc));
152
+ node.children.length = 0;
153
+ }
154
+ return { props: [createObjectProperty(createSimpleExpression(`innerHTML`, true, loc), exp || createSimpleExpression("", true))] };
155
+ };
156
+
157
+ //#endregion
158
+ //#region packages/compiler-dom/src/transforms/vText.ts
159
+ const transformVText = (dir, node, context) => {
160
+ const { exp, loc } = dir;
161
+ if (!exp) context.onError(createDOMCompilerError(56, loc));
162
+ if (node.children.length) {
163
+ context.onError(createDOMCompilerError(57, loc));
164
+ node.children.length = 0;
165
+ }
166
+ return { props: [createObjectProperty(createSimpleExpression(`textContent`, true), exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(context.helperString(TO_DISPLAY_STRING), [exp], loc) : createSimpleExpression("", true))] };
167
+ };
168
+
169
+ //#endregion
170
+ //#region packages/compiler-dom/src/transforms/vModel.ts
171
+ const transformModel$1 = (dir, node, context) => {
172
+ const baseResult = transformModel(dir, node, context);
173
+ if (!baseResult.props.length || node.tagType === 1) return baseResult;
174
+ if (dir.arg) context.onError(createDOMCompilerError(59, dir.arg.loc));
175
+ function checkDuplicatedValue() {
176
+ const value = findDir(node, "bind");
177
+ if (value && isStaticArgOf(value.arg, "value")) context.onError(createDOMCompilerError(61, value.loc));
178
+ }
179
+ const { tag } = node;
180
+ const isCustomElement = context.isCustomElement(tag);
181
+ if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
182
+ let directiveToUse = V_MODEL_TEXT;
183
+ let isInvalidType = false;
184
+ if (tag === "input" || isCustomElement) {
185
+ const type = findProp(node, `type`);
186
+ if (type) {
187
+ if (type.type === 7) directiveToUse = V_MODEL_DYNAMIC;
188
+ else if (type.value) switch (type.value.content) {
189
+ case "radio":
190
+ directiveToUse = V_MODEL_RADIO;
191
+ break;
192
+ case "checkbox":
193
+ directiveToUse = V_MODEL_CHECKBOX;
194
+ break;
195
+ case "file":
196
+ isInvalidType = true;
197
+ context.onError(createDOMCompilerError(60, dir.loc));
198
+ break;
199
+ default:
200
+ process.env.NODE_ENV !== "production" && checkDuplicatedValue();
201
+ break;
202
+ }
203
+ } else if (hasDynamicKeyVBind(node)) directiveToUse = V_MODEL_DYNAMIC;
204
+ else process.env.NODE_ENV !== "production" && checkDuplicatedValue();
205
+ } else if (tag === "select") directiveToUse = V_MODEL_SELECT;
206
+ else process.env.NODE_ENV !== "production" && checkDuplicatedValue();
207
+ if (!isInvalidType) baseResult.needRuntime = context.helper(directiveToUse);
208
+ } else context.onError(createDOMCompilerError(58, dir.loc));
209
+ baseResult.props = baseResult.props.filter((p) => !(p.key.type === 4 && p.key.content === "modelValue"));
210
+ return baseResult;
211
+ };
212
+
213
+ //#endregion
214
+ //#region packages/compiler-dom/src/transforms/vOn.ts
215
+ const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
216
+ const isNonKeyModifier = /* @__PURE__ */ makeMap("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
217
+ const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
218
+ const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
219
+ const resolveModifiers = (key, modifiers, context, loc) => {
220
+ const keyModifiers = [];
221
+ const nonKeyModifiers = [];
222
+ const eventOptionModifiers = [];
223
+ for (let i = 0; i < modifiers.length; i++) {
224
+ const modifier = modifiers[i].content;
225
+ if (modifier === "native" && context && checkCompatEnabled("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
226
+ else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
227
+ else {
228
+ const keyString = isString(key) ? key : isStaticExp(key) ? key.content : null;
229
+ if (maybeKeyModifier(modifier)) if (keyString) if (isKeyboardEvent(keyString.toLowerCase())) keyModifiers.push(modifier);
230
+ else nonKeyModifiers.push(modifier);
231
+ else {
232
+ keyModifiers.push(modifier);
233
+ nonKeyModifiers.push(modifier);
234
+ }
235
+ else if (isNonKeyModifier(modifier)) nonKeyModifiers.push(modifier);
236
+ else keyModifiers.push(modifier);
237
+ }
238
+ }
239
+ return {
240
+ keyModifiers,
241
+ nonKeyModifiers,
242
+ eventOptionModifiers
243
+ };
244
+ };
245
+ const transformClick = (key, event) => {
246
+ return isStaticExp(key) && key.content.toLowerCase() === "onclick" ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
247
+ `(`,
248
+ key,
249
+ `) === "onClick" ? "${event}" : (`,
250
+ key,
251
+ `)`
252
+ ]) : key;
253
+ };
254
+ const transformOn$1 = (dir, node, context) => {
255
+ return transformOn(dir, node, context, (baseResult) => {
256
+ const { modifiers } = dir;
257
+ if (!modifiers.length) return baseResult;
258
+ let { key, value: handlerExp } = baseResult.props[0];
259
+ const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
260
+ if (nonKeyModifiers.includes("right")) key = transformClick(key, `onContextmenu`);
261
+ if (nonKeyModifiers.includes("middle")) key = transformClick(key, `onMouseup`);
262
+ if (nonKeyModifiers.length) handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [handlerExp, JSON.stringify(nonKeyModifiers)]);
263
+ if (keyModifiers.length && (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [handlerExp, JSON.stringify(keyModifiers)]);
264
+ if (eventOptionModifiers.length) {
265
+ const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
266
+ key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([
267
+ `(`,
268
+ key,
269
+ `) + "${modifierPostfix}"`
270
+ ]);
271
+ }
272
+ return { props: [createObjectProperty(key, handlerExp)] };
273
+ });
274
+ };
275
+
276
+ //#endregion
277
+ //#region packages/compiler-dom/src/transforms/vShow.ts
278
+ const transformShow = (dir, node, context) => {
279
+ const { exp, loc } = dir;
280
+ if (!exp) context.onError(createDOMCompilerError(62, loc));
281
+ return {
282
+ props: [],
283
+ needRuntime: context.helper(V_SHOW)
284
+ };
285
+ };
286
+
287
+ //#endregion
288
+ //#region packages/compiler-dom/src/transforms/Transition.ts
289
+ const transformTransition = (node, context) => {
290
+ if (node.type === 1 && node.tagType === 1) {
291
+ if (context.isBuiltInComponent(node.tag) === TRANSITION) return postTransformTransition(node, context.onError);
292
+ }
293
+ };
294
+ function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
295
+ return () => {
296
+ if (!node.children.length) return;
297
+ if (hasMultipleChildren(node)) onError(createDOMCompilerError(63, {
298
+ start: node.children[0].loc.start,
299
+ end: node.children[node.children.length - 1].loc.end,
300
+ source: ""
301
+ }));
302
+ const child = node.children[0];
303
+ if (child.type === 1) {
304
+ for (const p of child.props) if (p.type === 7 && p.name === "show") node.props.push({
305
+ type: 6,
306
+ name: "persisted",
307
+ nameLoc: node.loc,
308
+ value: void 0,
309
+ loc: node.loc
310
+ });
311
+ }
312
+ };
313
+ }
314
+ function defaultHasMultipleChildren(node) {
315
+ const children = node.children = node.children.filter((c) => !isCommentOrWhitespace(c));
316
+ const child = children[0];
317
+ return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
318
+ }
319
+
320
+ //#endregion
321
+ //#region packages/compiler-dom/src/transforms/ignoreSideEffectTags.ts
322
+ const ignoreSideEffectTags = (node, context) => {
323
+ if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
324
+ process.env.NODE_ENV !== "production" && context.onError(createDOMCompilerError(64, node.loc));
325
+ context.removeNode();
326
+ }
327
+ };
328
+
329
+ //#endregion
330
+ //#region packages/compiler-dom/src/htmlNesting.ts
331
+ /**
332
+ * Copied from https://github.com/MananTank/validate-html-nesting
333
+ * with ISC license
334
+ *
335
+ * To avoid runtime dependency on validate-html-nesting
336
+ * This file should not change very often in the original repo
337
+ * but we may need to keep it up-to-date from time to time.
338
+ */
339
+ /**
340
+ * returns true if given parent-child nesting is valid HTML
341
+ */
342
+ function isValidHTMLNesting(parent, child) {
343
+ if (parent === "template") return true;
344
+ if (parent in onlyValidChildren) return onlyValidChildren[parent].has(child);
345
+ if (child in onlyValidParents) return onlyValidParents[child].has(parent);
346
+ if (parent in knownInvalidChildren) {
347
+ if (knownInvalidChildren[parent].has(child)) return false;
348
+ }
349
+ if (child in knownInvalidParents) {
350
+ if (knownInvalidParents[child].has(parent)) return false;
351
+ }
352
+ return true;
353
+ }
354
+ const headings = new Set([
355
+ "h1",
356
+ "h2",
357
+ "h3",
358
+ "h4",
359
+ "h5",
360
+ "h6"
361
+ ]);
362
+ const emptySet = /* @__PURE__ */ new Set([]);
363
+ /**
364
+ * maps element to set of elements that can be it's children, no other */
365
+ const onlyValidChildren = {
366
+ head: new Set([
367
+ "base",
368
+ "basefront",
369
+ "bgsound",
370
+ "link",
371
+ "meta",
372
+ "title",
373
+ "noscript",
374
+ "noframes",
375
+ "style",
376
+ "script",
377
+ "template"
378
+ ]),
379
+ optgroup: new Set(["option"]),
380
+ select: new Set([
381
+ "optgroup",
382
+ "option",
383
+ "hr"
384
+ ]),
385
+ table: new Set([
386
+ "caption",
387
+ "colgroup",
388
+ "tbody",
389
+ "tfoot",
390
+ "thead"
391
+ ]),
392
+ tr: new Set(["td", "th"]),
393
+ colgroup: new Set(["col"]),
394
+ tbody: new Set(["tr"]),
395
+ thead: new Set(["tr"]),
396
+ tfoot: new Set(["tr"]),
397
+ script: emptySet,
398
+ iframe: emptySet,
399
+ option: emptySet,
400
+ textarea: emptySet,
401
+ style: emptySet,
402
+ title: emptySet
403
+ };
404
+ /** maps elements to set of elements which can be it's parent, no other */
405
+ const onlyValidParents = {
406
+ html: emptySet,
407
+ body: new Set(["html"]),
408
+ head: new Set(["html"]),
409
+ td: new Set(["tr"]),
410
+ colgroup: new Set(["table"]),
411
+ caption: new Set(["table"]),
412
+ tbody: new Set(["table"]),
413
+ tfoot: new Set(["table"]),
414
+ col: new Set(["colgroup"]),
415
+ th: new Set(["tr"]),
416
+ thead: new Set(["table"]),
417
+ tr: new Set([
418
+ "tbody",
419
+ "thead",
420
+ "tfoot"
421
+ ]),
422
+ dd: new Set(["dl", "div"]),
423
+ dt: new Set(["dl", "div"]),
424
+ figcaption: new Set(["figure"]),
425
+ summary: new Set(["details"]),
426
+ area: new Set(["map"])
427
+ };
428
+ /** maps element to set of elements that can not be it's children, others can */
429
+ const knownInvalidChildren = {
430
+ p: new Set([
431
+ "address",
432
+ "article",
433
+ "aside",
434
+ "blockquote",
435
+ "center",
436
+ "details",
437
+ "dialog",
438
+ "dir",
439
+ "div",
440
+ "dl",
441
+ "fieldset",
442
+ "figure",
443
+ "footer",
444
+ "form",
445
+ "h1",
446
+ "h2",
447
+ "h3",
448
+ "h4",
449
+ "h5",
450
+ "h6",
451
+ "header",
452
+ "hgroup",
453
+ "hr",
454
+ "li",
455
+ "main",
456
+ "nav",
457
+ "menu",
458
+ "ol",
459
+ "p",
460
+ "pre",
461
+ "section",
462
+ "table",
463
+ "ul"
464
+ ]),
465
+ svg: new Set([
466
+ "b",
467
+ "blockquote",
468
+ "br",
469
+ "code",
470
+ "dd",
471
+ "div",
472
+ "dl",
473
+ "dt",
474
+ "em",
475
+ "embed",
476
+ "h1",
477
+ "h2",
478
+ "h3",
479
+ "h4",
480
+ "h5",
481
+ "h6",
482
+ "hr",
483
+ "i",
484
+ "img",
485
+ "li",
486
+ "menu",
487
+ "meta",
488
+ "ol",
489
+ "p",
490
+ "pre",
491
+ "ruby",
492
+ "s",
493
+ "small",
494
+ "span",
495
+ "strong",
496
+ "sub",
497
+ "sup",
498
+ "table",
499
+ "u",
500
+ "ul",
501
+ "var"
502
+ ])
503
+ };
504
+ /** maps element to set of elements that can not be it's parent, others can */
505
+ const knownInvalidParents = {
506
+ a: new Set(["a"]),
507
+ button: new Set(["button"]),
508
+ dd: new Set(["dd", "dt"]),
509
+ dt: new Set(["dd", "dt"]),
510
+ form: new Set(["form"]),
511
+ li: new Set(["li"]),
512
+ h1: headings,
513
+ h2: headings,
514
+ h3: headings,
515
+ h4: headings,
516
+ h5: headings,
517
+ h6: headings
518
+ };
519
+
520
+ //#endregion
521
+ //#region packages/compiler-dom/src/transforms/validateHtmlNesting.ts
522
+ const validateHtmlNesting = (node, context) => {
523
+ if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
524
+ const error = /* @__PURE__ */ new SyntaxError(`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`);
525
+ error.loc = node.loc;
526
+ context.onWarn(error);
527
+ }
528
+ };
529
+
530
+ //#endregion
531
+ //#region packages/compiler-dom/src/index.ts
532
+ const DOMNodeTransforms = [transformStyle, ...!!(process.env.NODE_ENV !== "production") ? [transformTransition, validateHtmlNesting] : []];
533
+ const DOMDirectiveTransforms = {
534
+ cloak: noopDirectiveTransform,
535
+ html: transformVHtml,
536
+ text: transformVText,
537
+ model: transformModel$1,
538
+ on: transformOn$1,
539
+ show: transformShow
540
+ };
541
+ function compile(src, options = {}) {
542
+ return baseCompile(src, extend({}, parserOptions, options, {
543
+ nodeTransforms: [
544
+ ignoreSideEffectTags,
545
+ ...DOMNodeTransforms,
546
+ ...options.nodeTransforms || []
547
+ ],
548
+ directiveTransforms: extend({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
549
+ transformHoist: null
550
+ }));
551
+ }
552
+ function parse(template, options = {}) {
553
+ return baseParse(template, extend({}, parserOptions, options));
554
+ }
555
+
556
+ //#endregion
557
+ 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, isKeyboardEvent, isValidHTMLNesting, parse, parserOptions, postTransformTransition, resolveModifiers, transformStyle };