@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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,278 @@
1
+ # @vitejs/plugin-vue [![npm](https://img.shields.io/npm/v/@vitejs/plugin-vue.svg)](https://npmjs.com/package/@vitejs/plugin-vue)
2
+
3
+ > Note: as of `vue` 3.2.13+ and `@vitejs/plugin-vue` 1.9.0+, `@vue/compiler-sfc` is no longer required as a peer dependency.
4
+
5
+ ```js
6
+ // vite.config.js
7
+ import vue from '@vitejs/plugin-vue'
8
+
9
+ export default {
10
+ plugins: [vue()],
11
+ }
12
+ ```
13
+
14
+ For JSX / TSX support, [`@vitejs/plugin-vue-jsx`](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) is also needed.
15
+
16
+ ## Options
17
+
18
+ ```ts
19
+ export interface Options {
20
+ include?: string | RegExp | (string | RegExp)[]
21
+ exclude?: string | RegExp | (string | RegExp)[]
22
+
23
+ isProduction?: boolean
24
+
25
+ /**
26
+ * Requires @vitejs/plugin-vue@^5.1.0
27
+ */
28
+ features?: {
29
+ /**
30
+ * Enable reactive destructure for `defineProps`.
31
+ * - Available in Vue 3.4 and later.
32
+ * - **default:** `false` in Vue 3.4 (**experimental**), `true` in Vue 3.5+
33
+ */
34
+ propsDestructure?: boolean
35
+ /**
36
+ * Transform Vue SFCs into custom elements.
37
+ * - `true`: all `*.vue` imports are converted into custom elements
38
+ * - `string | RegExp`: matched files are converted into custom elements
39
+ * - **default:** /\.ce\.vue$/
40
+ */
41
+ customElement?: boolean | string | RegExp | (string | RegExp)[]
42
+ /**
43
+ * Set to `false` to disable Options API support and allow related code in
44
+ * Vue core to be dropped via dead-code elimination in production builds,
45
+ * resulting in smaller bundles.
46
+ * - **default:** `true`
47
+ */
48
+ optionsAPI?: boolean
49
+ /**
50
+ * Set to `true` to enable devtools support in production builds.
51
+ * Results in slightly larger bundles.
52
+ * - **default:** `false`
53
+ */
54
+ prodDevtools?: boolean
55
+ /**
56
+ * Set to `true` to enable detailed information for hydration mismatch
57
+ * errors in production builds. Results in slightly larger bundles.
58
+ * - **default:** `false`
59
+ */
60
+ prodHydrationMismatchDetails?: boolean
61
+ /**
62
+ * Customize the component ID generation strategy.
63
+ * - `'filepath'`: hash the file path (relative to the project root)
64
+ * - `'filepath-source'`: hash the file path and the source code
65
+ * - `function`: custom function that takes the file path, source code,
66
+ * whether in production mode, and the default hash function as arguments
67
+ * - **default:** `'filepath'` in development, `'filepath-source'` in production
68
+ */
69
+ componentIdGenerator?:
70
+ | 'filepath'
71
+ | 'filepath-source'
72
+ | ((
73
+ filepath: string,
74
+ source: string,
75
+ isProduction: boolean | undefined,
76
+ getHash: (text: string) => string,
77
+ ) => string)
78
+ }
79
+
80
+ // `script`, `template` and `style` are lower-level compiler options
81
+ // to pass on to respective APIs of `vue/compiler-sfc`
82
+
83
+ script?: Partial<
84
+ Omit<
85
+ SFCScriptCompileOptions,
86
+ | 'id'
87
+ | 'isProd'
88
+ | 'inlineTemplate'
89
+ | 'templateOptions'
90
+ | 'sourceMap'
91
+ | 'genDefaultAs'
92
+ | 'customElement'
93
+ >
94
+ >
95
+
96
+ template?: Partial<
97
+ Omit<
98
+ SFCTemplateCompileOptions,
99
+ | 'id'
100
+ | 'source'
101
+ | 'ast'
102
+ | 'filename'
103
+ | 'scoped'
104
+ | 'slotted'
105
+ | 'isProd'
106
+ | 'inMap'
107
+ | 'ssr'
108
+ | 'ssrCssVars'
109
+ | 'preprocessLang'
110
+ >
111
+ >
112
+
113
+ style?: Partial<
114
+ Omit<
115
+ SFCStyleCompileOptions,
116
+ | 'filename'
117
+ | 'id'
118
+ | 'isProd'
119
+ | 'source'
120
+ | 'scoped'
121
+ | 'cssDevSourcemap'
122
+ | 'postcssOptions'
123
+ | 'map'
124
+ | 'postcssPlugins'
125
+ | 'preprocessCustomRequire'
126
+ | 'preprocessLang'
127
+ | 'preprocessOptions'
128
+ >
129
+ >
130
+
131
+ /**
132
+ * Use custom compiler-sfc instance. Can be used to force a specific version.
133
+ */
134
+ compiler?: typeof _compiler
135
+
136
+ /**
137
+ * @deprecated moved to `features.customElement`.
138
+ */
139
+ customElements?: boolean | string | RegExp | (string | RegExp)[]
140
+ }
141
+ ```
142
+
143
+ ## Asset URL handling
144
+
145
+ When `@vitejs/plugin-vue` compiles the `<template>` blocks in SFCs, it also converts any encountered asset URLs into ESM imports.
146
+
147
+ For example, the following template snippet:
148
+
149
+ ```vue
150
+ <img src="../image.png" />
151
+ ```
152
+
153
+ Is the same as:
154
+
155
+ ```vue
156
+ <script setup>
157
+ import _imports_0 from '../image.png'
158
+ </script>
159
+
160
+ <img :src="_imports_0" />
161
+ ```
162
+
163
+ By default the following tag/attribute combinations are transformed, and can be configured using the `template.transformAssetUrls` option.
164
+
165
+ ```js
166
+ {
167
+ video: ['src', 'poster'],
168
+ source: ['src'],
169
+ img: ['src'],
170
+ image: ['xlink:href', 'href'],
171
+ use: ['xlink:href', 'href']
172
+ }
173
+ ```
174
+
175
+ Note that only attribute values that are static strings are transformed. Otherwise, you'd need to import the asset manually, e.g. `import imgUrl from '../image.png'`.
176
+
177
+ ## Example for passing options to `vue/compiler-sfc`:
178
+
179
+ ```ts
180
+ import vue from '@vitejs/plugin-vue'
181
+
182
+ export default {
183
+ plugins: [
184
+ vue({
185
+ template: {
186
+ compilerOptions: {
187
+ // ...
188
+ },
189
+ transformAssetUrls: {
190
+ // ...
191
+ },
192
+ },
193
+ }),
194
+ ],
195
+ }
196
+ ```
197
+
198
+ ## Example for transforming custom blocks
199
+
200
+ ```ts
201
+ import vue from '@vitejs/plugin-vue'
202
+ import yaml from 'js-yaml'
203
+
204
+ const vueI18nPlugin = {
205
+ name: 'vue-i18n',
206
+ transform(code, id) {
207
+ // if .vue file don't have <i18n> block, just return
208
+ if (!/vue&type=i18n/.test(id)) {
209
+ return
210
+ }
211
+ // parse yaml
212
+ if (/\.ya?ml$/.test(id)) {
213
+ code = JSON.stringify(yaml.load(code.trim()))
214
+ }
215
+ // mount the value on the i18n property of the component instance
216
+ return `export default Comp => {
217
+ Comp.i18n = ${code}
218
+ }`
219
+ },
220
+ }
221
+
222
+ export default {
223
+ plugins: [vue(), vueI18nPlugin],
224
+ }
225
+ ```
226
+
227
+ Create a file named `Demo.vue`, add `lang="yaml"` to the `<i18n>` blocks, then you can use the syntax of `YAML`:
228
+
229
+ ```vue
230
+ <template>Hello</template>
231
+
232
+ <i18n lang="yaml">
233
+ message: 'world'
234
+ fullWord: 'hello world'
235
+ </i18n>
236
+ ```
237
+
238
+ `message` is mounted on the i18n property of the component instance, you can use like this:
239
+
240
+ ```vue
241
+ <script setup lang="ts">
242
+ import Demo from 'components/Demo.vue'
243
+ </script>
244
+
245
+ <template>
246
+ <Demo /> {{ Demo.i18n.message }}
247
+ <div>{{ Demo.i18n.fullWord }}</div>
248
+ </template>
249
+ ```
250
+
251
+ ## Using Vue SFCs as Custom Elements
252
+
253
+ > Requires `vue@^3.2.0` & `@vitejs/plugin-vue@^1.4.0`
254
+
255
+ Vue 3.2 introduces the `defineCustomElement` method, which works with SFCs. By default, `<style>` tags inside SFCs are extracted and merged into CSS files during build. However when shipping a library of custom elements, it may be desirable to inline the styles as JavaScript strings and inject them into the custom elements' shadow root instead.
256
+
257
+ Starting in 1.4.0, files ending with `*.ce.vue` will be compiled in "custom elements" mode: its `<style>` tags are compiled into inlined CSS strings and attached to the component as its `styles` property:
258
+
259
+ ```js
260
+ import { defineCustomElement } from 'vue'
261
+ import Example from './Example.ce.vue'
262
+
263
+ console.log(Example.styles) // ['/* css content */']
264
+
265
+ // register
266
+ customElements.define('my-example', defineCustomElement(Example))
267
+ ```
268
+
269
+ Note in custom elements mode there is no need to use `<style scoped>` since the CSS is already scoped inside the shadow DOM.
270
+
271
+ The `customElement` plugin option can be used to configure the behavior:
272
+
273
+ - `{ customElement: true }` will import all `*.vue` files in custom element mode.
274
+ - Use a string or regex pattern to change how files should be loaded as Custom Elements (this check is applied after `include` and `exclude` matches).
275
+
276
+ ## License
277
+
278
+ MIT