@dcloudio/uni-cli-shared 3.0.0-4080720251210001 → 3.0.0-5000420260317001
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.
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +6 -1
- package/dist/deps.js +6 -1
- package/dist/dom2/index.d.ts +1 -0
- package/dist/dom2/index.js +17 -0
- package/dist/dom2/sharedData.d.ts +2 -0
- package/dist/dom2/sharedData.js +19 -0
- package/dist/easycom.js +34 -5
- package/dist/env/define.d.ts +3 -0
- package/dist/env/define.js +12 -0
- package/dist/hbx/alias.js +15 -17
- package/dist/hbx/index.d.ts +1 -1
- package/dist/hbx/index.js +4 -2
- package/dist/hbx/log.d.ts +5 -0
- package/dist/hbx/log.js +44 -1
- package/dist/i18n.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/json/app/manifest/index.d.ts +1 -0
- package/dist/json/app/manifest/index.js +3 -1
- package/dist/json/mp/pages.js +0 -5
- package/dist/json/pages.d.ts +2 -2
- package/dist/json/pages.js +4 -1
- package/dist/json/uni-x/index.d.ts +1 -1
- package/dist/json/utils.js +31 -22
- package/dist/logs/console.js +1 -1
- package/dist/logs/index.d.ts +11 -0
- package/dist/logs/index.js +34 -1
- package/dist/messages/en.d.ts +6 -3
- package/dist/messages/en.js +6 -3
- package/dist/messages/index.d.ts +11 -5
- package/dist/messages/zh_CN.d.ts +5 -2
- package/dist/messages/zh_CN.js +5 -2
- package/dist/mp/assets.d.ts +1 -0
- package/dist/mp/assets.js +27 -1
- package/dist/mp/externalClasses.d.ts +38 -2
- package/dist/mp/externalClasses.js +90 -4
- package/dist/mp/index.d.ts +4 -3
- package/dist/mp/index.js +11 -1
- package/dist/mp/plugin.d.ts +1 -0
- package/dist/mp/plugin.js +14 -1
- package/dist/mp/style.d.ts +1 -0
- package/dist/mp/style.js +8 -1
- package/dist/mp/usingComponents.d.ts +1 -0
- package/dist/mp/usingComponents.js +17 -1
- package/dist/postcss/index.d.ts +2 -0
- package/dist/postcss/index.js +3 -1
- package/dist/postcss/plugins/stylePluginExternal.d.ts +17 -0
- package/dist/postcss/plugins/stylePluginExternal.js +127 -0
- package/dist/postcss/plugins/stylePluginScoped.js +30 -0
- package/dist/preprocess/context.js +2 -0
- package/dist/preprocess/index.d.ts +9 -6
- package/dist/preprocess/index.js +33 -8
- package/dist/resolve.js +5 -1
- package/dist/uni_modules.js +20 -4
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +9 -6
- package/dist/utsUtils.d.ts +1 -0
- package/dist/utsUtils.js +2 -1
- package/dist/vite/autoImport.js +91 -6
- package/dist/vite/plugins/console.js +1 -1
- package/dist/vite/plugins/cssScoped.js +2 -1
- package/dist/vite/plugins/easycom.js +7 -0
- package/dist/vite/plugins/json.js +69 -2
- package/dist/vite/plugins/pre.js +4 -2
- package/dist/vite/plugins/sfc.js +1 -1
- package/dist/vite/plugins/stats.js +32 -0
- package/dist/vite/plugins/uts/ext-api.js +1 -1
- package/dist/vite/plugins/uts/uni_modules.js +12 -0
- package/dist/vite/plugins/uts/uvue.js +7 -2
- package/dist/vite/plugins/vitejs/plugins/asset.d.ts +1 -0
- package/dist/vite/plugins/vitejs/plugins/asset.js +19 -1
- package/dist/vite/plugins/vitejs/plugins/css.d.ts +2 -1
- package/dist/vite/plugins/vitejs/plugins/css.js +27 -10
- package/dist/vite/utils/ast.d.ts +2 -1
- package/dist/vite/utils/ast.js +5 -1
- package/dist/vue/parse.d.ts +2 -0
- package/dist/vue/parse.js +3 -1
- package/dist/vue/transforms/index.d.ts +1 -0
- package/dist/vue/transforms/index.js +1 -0
- package/dist/vue/transforms/transformLineBreak.d.ts +2 -0
- package/dist/vue/transforms/transformLineBreak.js +15 -0
- package/dist/vue/transforms/transformTag.d.ts +1 -1
- package/dist/vue/transforms/transformTag.js +5 -0
- package/dist/vue/transforms/x/transformMPBuiltInTag.js +2 -2
- package/dist/vue/utils.js +8 -1
- package/lib/@vue/compiler-core/dist/compiler-core.cjs.js +42 -23
- package/lib/@vue/compiler-core/dist/compiler-core.cjs.prod.js +42 -23
- package/lib/@vue/compiler-core/dist/compiler-core.esm-bundler.js +39 -19
- package/lib/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +4635 -1024
- package/lib/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +8762 -7849
- package/lib/dom2/app/@vitejs/plugin-vue/LICENSE +21 -0
- package/lib/dom2/app/@vitejs/plugin-vue/README.md +278 -0
- package/lib/dom2/app/@vitejs/plugin-vue/dist/index.cjs +3353 -0
- package/lib/dom2/app/@vitejs/plugin-vue/dist/index.d.cts +113 -0
- package/lib/dom2/app/@vitejs/plugin-vue/dist/index.d.mts +111 -0
- package/lib/dom2/app/@vitejs/plugin-vue/dist/index.d.ts +113 -0
- package/lib/dom2/app/@vitejs/plugin-vue/dist/index.mjs +3338 -0
- package/lib/dom2/app/@vitejs/plugin-vue/package.json +50 -0
- package/lib/dom2/app/@vue/compiler-core/LICENSE +21 -0
- package/lib/dom2/app/@vue/compiler-core/README.md +1 -0
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.js +5492 -0
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.prod.js +5436 -0
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.d.ts +1187 -0
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.esm-bundler.js +4335 -0
- package/lib/dom2/app/@vue/compiler-core/index.js +7 -0
- package/lib/dom2/app/@vue/compiler-core/package.json +58 -0
- package/lib/dom2/app/@vue/compiler-dom/LICENSE +21 -0
- package/lib/dom2/app/@vue/compiler-dom/README.md +1 -0
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.js +762 -0
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +736 -0
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.d.ts +73 -0
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +5051 -0
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +11 -0
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +557 -0
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.js +5234 -0
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.prod.js +11 -0
- package/lib/dom2/app/@vue/compiler-dom/index.js +7 -0
- package/lib/dom2/app/@vue/compiler-dom/package.json +57 -0
- package/lib/dom2/app/@vue/compiler-sfc/LICENSE +21 -0
- package/lib/dom2/app/@vue/compiler-sfc/README.md +80 -0
- package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +15528 -0
- package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.d.ts +11595 -0
- package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +41525 -0
- package/lib/dom2/app/@vue/compiler-sfc/package.json +68 -0
- package/lib/dom2/app/@vue/compiler-vapor/LICENSE +21 -0
- package/lib/dom2/app/@vue/compiler-vapor/README.md +1 -0
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +3584 -0
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.d.ts +22858 -0
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +22438 -0
- package/lib/dom2/app/@vue/compiler-vapor/package.json +51 -0
- package/lib/dom2/app/@vue/compiler-vapor-dom2/dist/compiler-vapor-dom2.cjs.js +1 -0
- package/lib/dom2/app/@vue/compiler-vapor-dom2/package.json +56 -0
- package/lib/dom2/app/@vue/shared/LICENSE +21 -0
- package/lib/dom2/app/@vue/shared/README.md +3 -0
- package/lib/dom2/app/@vue/shared/dist/shared.cjs.js +773 -0
- package/lib/dom2/app/@vue/shared/dist/shared.cjs.prod.js +773 -0
- package/lib/dom2/app/@vue/shared/dist/shared.d.ts +412 -0
- package/lib/dom2/app/@vue/shared/dist/shared.esm-bundler.js +688 -0
- package/lib/dom2/app/@vue/shared/index.js +7 -0
- package/lib/dom2/app/@vue/shared/package.json +47 -0
- package/lib/preprocess/lib/preprocess.js +9 -3
- package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.js +1 -1
- package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.prod.js +1 -1
- package/package.json +8 -6
package/dist/vite/autoImport.js
CHANGED
|
@@ -1,8 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.initAutoImportOptions = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
4
8
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
5
9
|
const uts_1 = require("../uts");
|
|
10
|
+
const workers_1 = require("../workers");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
12
|
+
const uniWebLifeCyclePreset = {
|
|
13
|
+
from: '@dcloudio/uni-app',
|
|
14
|
+
imports: [
|
|
15
|
+
// ssr
|
|
16
|
+
'ssrRef',
|
|
17
|
+
'shallowSsrRef',
|
|
18
|
+
// uni-app lifecycle
|
|
19
|
+
// App and Page
|
|
20
|
+
'onShow',
|
|
21
|
+
'onHide',
|
|
22
|
+
// App
|
|
23
|
+
'onLaunch',
|
|
24
|
+
// web平台如下生命周期和uni.xxx api冲突,发行时改为通过uni-h5导入api实现,运行时通过uni-app导入
|
|
25
|
+
// 'onAppShow',
|
|
26
|
+
// 'onAppHide',
|
|
27
|
+
// 'onError',
|
|
28
|
+
// 'onPageNotFound',
|
|
29
|
+
// 'onUnhandledRejection',
|
|
30
|
+
'onThemeChange',
|
|
31
|
+
'onKeyboardHeightChange',
|
|
32
|
+
'onLastPageBackPress',
|
|
33
|
+
'onExit',
|
|
34
|
+
// Page
|
|
35
|
+
'onPageShow',
|
|
36
|
+
'onPageHide',
|
|
37
|
+
'onLoad',
|
|
38
|
+
'onReady',
|
|
39
|
+
'onUnload',
|
|
40
|
+
'onResize',
|
|
41
|
+
'onBackPress',
|
|
42
|
+
'onPageScroll',
|
|
43
|
+
'onTabItemTap',
|
|
44
|
+
'onReachBottom',
|
|
45
|
+
'onPullDownRefresh',
|
|
46
|
+
// 其他
|
|
47
|
+
'onShareTimeline',
|
|
48
|
+
'onShareAppMessage',
|
|
49
|
+
'onShareChat', // xhs-share
|
|
50
|
+
'onCopyUrl',
|
|
51
|
+
'onUploadDouyinVideo',
|
|
52
|
+
'onLiveMount',
|
|
53
|
+
'onTitleClick',
|
|
54
|
+
// 辅助
|
|
55
|
+
'renderComponentSlot',
|
|
56
|
+
],
|
|
57
|
+
};
|
|
6
58
|
const uniLifeCyclePreset = {
|
|
7
59
|
from: '@dcloudio/uni-app',
|
|
8
60
|
imports: [
|
|
@@ -15,6 +67,8 @@ const uniLifeCyclePreset = {
|
|
|
15
67
|
'onHide',
|
|
16
68
|
// App
|
|
17
69
|
'onLaunch',
|
|
70
|
+
'onAppShow',
|
|
71
|
+
'onAppHide',
|
|
18
72
|
'onError',
|
|
19
73
|
'onThemeChange',
|
|
20
74
|
'onKeyboardHeightChange',
|
|
@@ -38,6 +92,10 @@ const uniLifeCyclePreset = {
|
|
|
38
92
|
'onShareTimeline',
|
|
39
93
|
'onShareAppMessage',
|
|
40
94
|
'onShareChat', // xhs-share
|
|
95
|
+
'onCopyUrl',
|
|
96
|
+
'onUploadDouyinVideo',
|
|
97
|
+
'onLiveMount',
|
|
98
|
+
'onTitleClick',
|
|
41
99
|
// 辅助
|
|
42
100
|
'renderComponentSlot',
|
|
43
101
|
],
|
|
@@ -45,10 +103,6 @@ const uniLifeCyclePreset = {
|
|
|
45
103
|
const uniH5Preset = {
|
|
46
104
|
from: '@dcloudio/uni-h5',
|
|
47
105
|
imports: [
|
|
48
|
-
'onAppShow',
|
|
49
|
-
'onAppHide',
|
|
50
|
-
'offAppHide',
|
|
51
|
-
'offAppShow',
|
|
52
106
|
'UniElement',
|
|
53
107
|
'UniElementImpl',
|
|
54
108
|
'UniButtonElement',
|
|
@@ -78,6 +132,7 @@ const uniH5Preset = {
|
|
|
78
132
|
'UniTextElement',
|
|
79
133
|
'UniTextareaElement',
|
|
80
134
|
'UniViewElement',
|
|
135
|
+
'UniViewElementImpl',
|
|
81
136
|
'UniListViewElement',
|
|
82
137
|
'UniListItemElement',
|
|
83
138
|
'UniStickySectionElement',
|
|
@@ -90,6 +145,14 @@ const uniH5Preset = {
|
|
|
90
145
|
'UniPickerElement',
|
|
91
146
|
],
|
|
92
147
|
};
|
|
148
|
+
if (process.env.NODE_ENV === 'development') {
|
|
149
|
+
uniWebLifeCyclePreset.imports.push(
|
|
150
|
+
// web平台如下生命周期和uni.xxx api冲突,发行时改为通过uni-h5导入api实现,运行时通过uni-app导入
|
|
151
|
+
'onAppShow', 'onAppHide', 'onError', 'onPageNotFound', 'onUnhandledRejection');
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
uniH5Preset.imports.push('onAppShow', 'onAppHide', 'onError', 'onPageNotFound', 'onUnhandledRejection');
|
|
155
|
+
}
|
|
93
156
|
const uniMiniProgramPreset = {
|
|
94
157
|
from: 'vue',
|
|
95
158
|
imports: ['UniElement', 'UniElementImpl'],
|
|
@@ -98,6 +161,10 @@ const cloudPreset = {
|
|
|
98
161
|
from: '@dcloudio/uni-cloud',
|
|
99
162
|
imports: ['uniCloud', 'UniCloudError'],
|
|
100
163
|
};
|
|
164
|
+
const utsJsPreset = {
|
|
165
|
+
from: '@dcloudio/uni-shared',
|
|
166
|
+
imports: ['UTS', 'UTSJSONObject', 'UTSValueIterable', 'UniError'],
|
|
167
|
+
};
|
|
101
168
|
const uniAppLifeCyclePreset = {
|
|
102
169
|
from: 'vue',
|
|
103
170
|
imports: [
|
|
@@ -109,13 +176,15 @@ const uniAppLifeCyclePreset = {
|
|
|
109
176
|
'onShow',
|
|
110
177
|
'onHide',
|
|
111
178
|
// App
|
|
179
|
+
'onAppShow',
|
|
180
|
+
'onAppHide',
|
|
112
181
|
'onLaunch',
|
|
113
182
|
'onError',
|
|
114
183
|
'onThemeChange',
|
|
184
|
+
'onLastPageBackPress',
|
|
115
185
|
// onKeyboardHeightChange,
|
|
116
186
|
'onPageNotFound',
|
|
117
187
|
'onUnhandledRejection',
|
|
118
|
-
// onLastPageBackPress,
|
|
119
188
|
'onExit',
|
|
120
189
|
// Page
|
|
121
190
|
'onPageShow',
|
|
@@ -151,9 +220,14 @@ const vuePreset = {
|
|
|
151
220
|
'onServerPrefetch',
|
|
152
221
|
'onUnmounted',
|
|
153
222
|
'onUpdated',
|
|
223
|
+
// uni-app specific lifecycle
|
|
224
|
+
'onReuse',
|
|
225
|
+
'onRecycle',
|
|
154
226
|
// setup helpers
|
|
155
227
|
'useAttrs',
|
|
156
228
|
'useSlots',
|
|
229
|
+
'useComputedStyle',
|
|
230
|
+
'useRecycleState',
|
|
157
231
|
// reactivity,
|
|
158
232
|
'computed',
|
|
159
233
|
'customRef',
|
|
@@ -214,6 +288,9 @@ function initAutoImportOptions(platform, { imports = [], ...userOptions }) {
|
|
|
214
288
|
if (platform === 'app-ios' || platform === 'app-harmony') {
|
|
215
289
|
autoImport.push(uniAppLifeCyclePreset);
|
|
216
290
|
}
|
|
291
|
+
else if (platform === 'web') {
|
|
292
|
+
autoImport.push(uniWebLifeCyclePreset);
|
|
293
|
+
}
|
|
217
294
|
else {
|
|
218
295
|
autoImport.push(uniLifeCyclePreset);
|
|
219
296
|
}
|
|
@@ -226,11 +303,19 @@ function initAutoImportOptions(platform, { imports = [], ...userOptions }) {
|
|
|
226
303
|
}
|
|
227
304
|
else if (platform.startsWith('mp-')) {
|
|
228
305
|
autoImport.push(uniMiniProgramPreset);
|
|
306
|
+
if (process.env.UNI_APP_X === 'true') {
|
|
307
|
+
// 小程序端使用autoImport
|
|
308
|
+
autoImport.push(utsJsPreset);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
const exclude = [/[\\/]\.git[\\/]/];
|
|
312
|
+
if (process.env.UNI_INPUT_DIR) {
|
|
313
|
+
exclude.push(...(0, workers_1.resolveWorkersDir)(process.env.UNI_INPUT_DIR).map((dir) => (0, utils_1.normalizePath)(path_1.default.join(process.env.UNI_INPUT_DIR, dir, '*'))));
|
|
229
314
|
}
|
|
230
315
|
return {
|
|
231
316
|
...userOptions,
|
|
232
317
|
include: [/\.[u]?ts$/, /\.[u]?vue/],
|
|
233
|
-
exclude
|
|
318
|
+
exclude,
|
|
234
319
|
imports: imports.concat(
|
|
235
320
|
// app-android 平台暂不注入其他
|
|
236
321
|
platform === 'app-android' ? [] : autoImport),
|
|
@@ -45,6 +45,7 @@ function uniRemoveCssScopedPlugin(_ = { filter: () => false }) {
|
|
|
45
45
|
}
|
|
46
46
|
exports.uniRemoveCssScopedPlugin = uniRemoveCssScopedPlugin;
|
|
47
47
|
function uniCssScopedPlugin({ filter } = { filter: () => false }) {
|
|
48
|
+
const isNewStyleIsolation = process.env.UNI_APP_STYLE_ISOLATION_VERSION === '2';
|
|
48
49
|
return {
|
|
49
50
|
name: 'uni:css-scoped',
|
|
50
51
|
enforce: 'pre',
|
|
@@ -62,7 +63,7 @@ function uniCssScopedPlugin({ filter } = { filter: () => false }) {
|
|
|
62
63
|
if (!constants_1.EXTNAME_VUE.includes(path_1.default.extname(ctx.file))) {
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
65
|
-
const scoped = !(0, utils_1.isAppVue)(ctx.file);
|
|
66
|
+
const scoped = isNewStyleIsolation || !(0, utils_1.isAppVue)(ctx.file);
|
|
66
67
|
debugScoped('hmr', ctx.file);
|
|
67
68
|
const oldRead = ctx.read;
|
|
68
69
|
ctx.read = async () => {
|
|
@@ -11,6 +11,7 @@ const url_1 = require("../utils/url");
|
|
|
11
11
|
const constants_1 = require("../../constants");
|
|
12
12
|
const easycom_1 = require("../../easycom");
|
|
13
13
|
const uts_1 = require("../../uts");
|
|
14
|
+
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
14
15
|
function uniEasycomPlugin(options) {
|
|
15
16
|
const filter = (0, pluginutils_1.createFilter)(options.include, options.exclude);
|
|
16
17
|
return {
|
|
@@ -46,6 +47,12 @@ function uniEasycomPlugin(options) {
|
|
|
46
47
|
return `'${name}'`;
|
|
47
48
|
}
|
|
48
49
|
}
|
|
50
|
+
if (process.env.UNI_APP_X === 'true') {
|
|
51
|
+
if ((0, uni_shared_1.isAppUVueBuiltInEasyComponent)(name)) {
|
|
52
|
+
// 内置easycom组件不传入self参数
|
|
53
|
+
return str.replace(', true)', ')');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
49
56
|
}
|
|
50
57
|
return str;
|
|
51
58
|
});
|
|
@@ -9,19 +9,86 @@ const json_1 = require("../../json");
|
|
|
9
9
|
const preprocess_1 = require("../../preprocess");
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
11
|
function uniJsonPlugin() {
|
|
12
|
+
const UTS_CAST_ARRAY_MARKER = '/*__UTS_CAST_UTSJSON_ARRAY__*/';
|
|
13
|
+
const UTS_CAST_OBJECT_MARKER = '/*__UTS_CAST_UTSJSON_OBJECT__*/';
|
|
14
|
+
const IS_UNI_X_ANDROID = process.env.UNI_APP_X === 'true' &&
|
|
15
|
+
process.env.UNI_UTS_PLATFORM === 'app-android';
|
|
12
16
|
return {
|
|
13
17
|
name: 'uni:json',
|
|
14
18
|
enforce: 'pre',
|
|
19
|
+
generateBundle(options, bundle) {
|
|
20
|
+
if (IS_UNI_X_ANDROID) {
|
|
21
|
+
for (const [fileName, file] of Object.entries(bundle)) {
|
|
22
|
+
if (fileName.endsWith('.json.ts')) {
|
|
23
|
+
if (file.type === 'asset' && file.source) {
|
|
24
|
+
const source = file.source.toString();
|
|
25
|
+
if (source.includes(UTS_CAST_ARRAY_MARKER) ||
|
|
26
|
+
source.includes(UTS_CAST_OBJECT_MARKER)) {
|
|
27
|
+
file.source = source
|
|
28
|
+
.replace(new RegExp(UTS_CAST_ARRAY_MARKER.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), ' as UTSJSONObject[]')
|
|
29
|
+
.replace(new RegExp(UTS_CAST_OBJECT_MARKER.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), ' as UTSJSONObject');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
15
36
|
transform(code, id) {
|
|
16
37
|
// 如果已经被其他插件处理过了,就不再处理,比如 commonjs 插件,ICAPRegistrar.json?commonjs-external
|
|
17
38
|
if (id.startsWith('\0')) {
|
|
18
39
|
return;
|
|
19
40
|
}
|
|
20
|
-
|
|
41
|
+
const { filename } = (0, utils_1.parseVueRequest)(id);
|
|
42
|
+
if (path_1.default.extname(filename) !== '.json') {
|
|
21
43
|
return;
|
|
22
44
|
}
|
|
45
|
+
let codeObj = (0, json_1.parseJson)((0, preprocess_1.preJson)(code, id), false, id);
|
|
46
|
+
let codeJson = '';
|
|
47
|
+
if (IS_UNI_X_ANDROID) {
|
|
48
|
+
if (Array.isArray(codeObj)) {
|
|
49
|
+
codeJson +=
|
|
50
|
+
'export default JSON.parseArray(`' +
|
|
51
|
+
JSON.stringify(codeObj, null, 2) +
|
|
52
|
+
'`)' +
|
|
53
|
+
UTS_CAST_ARRAY_MARKER +
|
|
54
|
+
';\n';
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
codeJson +=
|
|
58
|
+
'let __jsonObj = JSON.parseObject(`' +
|
|
59
|
+
JSON.stringify(codeObj, null, 2) +
|
|
60
|
+
'`);\n';
|
|
61
|
+
for (const key in codeObj) {
|
|
62
|
+
if (!Object.hasOwn(codeObj, key))
|
|
63
|
+
continue;
|
|
64
|
+
const element = codeObj[key];
|
|
65
|
+
if (Array.isArray(element)) {
|
|
66
|
+
codeJson += `export const ${key} = __jsonObj?.getArray("${key}")${UTS_CAST_ARRAY_MARKER};\n`;
|
|
67
|
+
}
|
|
68
|
+
else if (typeof element === 'object' && element !== null) {
|
|
69
|
+
codeJson += `export const ${key} = __jsonObj?.get("${key}")${UTS_CAST_OBJECT_MARKER};\n`;
|
|
70
|
+
}
|
|
71
|
+
else if (typeof element === 'string') {
|
|
72
|
+
codeJson += `export const ${key} = __jsonObj?.getString("${key}") ?? '';\n`;
|
|
73
|
+
}
|
|
74
|
+
else if (typeof element === 'number') {
|
|
75
|
+
codeJson += `export const ${key} = __jsonObj?.getNumber("${key}") ?? 0;\n`;
|
|
76
|
+
}
|
|
77
|
+
else if (typeof element === 'boolean') {
|
|
78
|
+
codeJson += `export const ${key} = __jsonObj?.getBoolean("${key}") ?? false;\n`;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
codeJson += `export const ${key} = __jsonObj?.get("${key}")${UTS_CAST_OBJECT_MARKER};\n`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
codeJson += `export default __jsonObj;`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
codeJson = JSON.stringify(codeObj, null, 2);
|
|
89
|
+
}
|
|
23
90
|
return {
|
|
24
|
-
code:
|
|
91
|
+
code: codeJson,
|
|
25
92
|
map: {
|
|
26
93
|
mappings: '',
|
|
27
94
|
},
|
package/dist/vite/plugins/pre.js
CHANGED
|
@@ -41,12 +41,14 @@ function uniPrePlugin(config, options) {
|
|
|
41
41
|
if (!hasEndif) {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
+
// 因为完整的 vue 会先条件编译,而 vue&type=template 等会再次条件编译,如果走error模式会报两次错误,且第二次错误没有正确的位置映射
|
|
45
|
+
const unbalanced = query.vue ? 'skip' : 'error';
|
|
44
46
|
if (isHtml) {
|
|
45
|
-
code = preHtmlFile(code, id);
|
|
47
|
+
code = preHtmlFile(code, id, { unbalanced });
|
|
46
48
|
debugPreHtml(id);
|
|
47
49
|
}
|
|
48
50
|
if (isJs) {
|
|
49
|
-
code = preJsFile(code, id);
|
|
51
|
+
code = preJsFile(code, id, { unbalanced });
|
|
50
52
|
debugPreJs(id);
|
|
51
53
|
}
|
|
52
54
|
return {
|
package/dist/vite/plugins/sfc.js
CHANGED
|
@@ -120,7 +120,7 @@ function uniViteSfcSrcImportPlugin({ onlyVue } = { onlyVue: true }) {
|
|
|
120
120
|
}
|
|
121
121
|
return {
|
|
122
122
|
code: s.toString(),
|
|
123
|
-
map: sourceMap ? s.generateMap({ hires: true }) :
|
|
123
|
+
map: sourceMap ? s.generateMap({ hires: true }) : null,
|
|
124
124
|
};
|
|
125
125
|
},
|
|
126
126
|
};
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.uniStatsPlugin = void 0;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
4
8
|
const utils_1 = require("../../utils");
|
|
9
|
+
const json_1 = require("../../json");
|
|
10
|
+
const messages_1 = require("../../messages");
|
|
5
11
|
const emittedHashMap = new WeakMap();
|
|
6
12
|
function uniStatsPlugin() {
|
|
7
13
|
let resolvedConfig;
|
|
14
|
+
let isManifestChanged = false;
|
|
15
|
+
const shouldTrackManifestChange = process.env.UNI_APP_X === 'true' &&
|
|
16
|
+
process.env.UNI_PLATFORM === 'app-harmony';
|
|
17
|
+
let isVapor = shouldTrackManifestChange && process.env.UNI_APP_X_DOM2 === 'true';
|
|
8
18
|
return {
|
|
9
19
|
name: 'uni:app-stats',
|
|
10
20
|
enforce: 'post',
|
|
@@ -12,6 +22,20 @@ function uniStatsPlugin() {
|
|
|
12
22
|
resolvedConfig = config;
|
|
13
23
|
emittedHashMap.set(resolvedConfig, new Map());
|
|
14
24
|
},
|
|
25
|
+
watchChange(id) {
|
|
26
|
+
if (shouldTrackManifestChange && id.endsWith('manifest.json')) {
|
|
27
|
+
isManifestChanged = true;
|
|
28
|
+
try {
|
|
29
|
+
const manifest = (0, json_1.parseJson)(fs_extra_1.default.readFileSync(id, 'utf-8'), true, 'manifest.json');
|
|
30
|
+
const uniAppX = manifest['uni-app-x'] || {};
|
|
31
|
+
if (uniAppX.vapor !== isVapor) {
|
|
32
|
+
isVapor = uniAppX.vapor === true;
|
|
33
|
+
console.warn(messages_1.M['dev.watching.restart.vapor']);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (e) { }
|
|
37
|
+
}
|
|
38
|
+
},
|
|
15
39
|
writeBundle(_, bundle) {
|
|
16
40
|
if (resolvedConfig.isProduction) {
|
|
17
41
|
// 仅dev生效
|
|
@@ -20,6 +44,10 @@ function uniStatsPlugin() {
|
|
|
20
44
|
const emittedHash = emittedHashMap.get(resolvedConfig);
|
|
21
45
|
const changedFiles = [];
|
|
22
46
|
Object.keys(bundle).forEach((filename) => {
|
|
47
|
+
// 不处理sourcemap
|
|
48
|
+
if (filename.endsWith('.map')) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
23
51
|
const outputFile = bundle[filename];
|
|
24
52
|
let outputFileHash = '';
|
|
25
53
|
if (outputFile.type === 'asset') {
|
|
@@ -33,6 +61,10 @@ function uniStatsPlugin() {
|
|
|
33
61
|
changedFiles.push(filename);
|
|
34
62
|
}
|
|
35
63
|
});
|
|
64
|
+
if (isManifestChanged) {
|
|
65
|
+
isManifestChanged = false;
|
|
66
|
+
changedFiles.unshift('manifest.json');
|
|
67
|
+
}
|
|
36
68
|
process.env.UNI_APP_CHANGED_FILES = changedFiles.length
|
|
37
69
|
? JSON.stringify(changedFiles)
|
|
38
70
|
: '';
|
|
@@ -188,11 +188,23 @@ const emptyHarmonyCacheDirOnce = (0, uni_shared_1.once)(() => {
|
|
|
188
188
|
emptyCacheDir('app-harmony');
|
|
189
189
|
});
|
|
190
190
|
const handleCompileResult = (result, pluginContext) => {
|
|
191
|
+
process.env.UNI_APP_UTS_CHANGED = 'true';
|
|
191
192
|
if (pluginContext) {
|
|
192
193
|
result.deps.forEach((dep) => {
|
|
193
194
|
pluginContext.addWatchFile(dep);
|
|
194
195
|
});
|
|
195
196
|
}
|
|
197
|
+
if (process.env.UNI_APP_X === 'true' &&
|
|
198
|
+
process.env.UNI_UTS_PLATFORM === 'app-android') {
|
|
199
|
+
if (result.errMsg) {
|
|
200
|
+
const err = new Error(result.errMsg);
|
|
201
|
+
err.customPrint = () => {
|
|
202
|
+
// 不需要输出,因为编译uts插件的地方已经打印了
|
|
203
|
+
// console.error(result.errMsg)
|
|
204
|
+
};
|
|
205
|
+
throw err;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
196
208
|
};
|
|
197
209
|
// 该插件仅限app-android、app-ios、app-harmony
|
|
198
210
|
function uniUTSAppUniModulesPlugin(options = {}) {
|
|
@@ -19,10 +19,14 @@ function uniUTSUVueJavaScriptPlugin(options = {}) {
|
|
|
19
19
|
if (!(0, vue_1.isVueSfcFile)(id)) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
+
const platform = process.env.UNI_PLATFORM;
|
|
23
|
+
const isApp = platform === 'app' ||
|
|
24
|
+
platform === 'app-plus' ||
|
|
25
|
+
platform === 'app-harmony';
|
|
22
26
|
return {
|
|
23
27
|
code: code.replace(/<script([^>]*)>/gi, (match, attributes) => {
|
|
24
28
|
let vapor = false;
|
|
25
|
-
if (process.env.
|
|
29
|
+
if (process.env.UNI_APP_X_DOM2 === 'true') {
|
|
26
30
|
if (attributes.includes('setup') && !attributes.includes('vapor')) {
|
|
27
31
|
vapor = true;
|
|
28
32
|
}
|
|
@@ -42,7 +46,8 @@ function uniUTSUVueJavaScriptPlugin(options = {}) {
|
|
|
42
46
|
}
|
|
43
47
|
return result;
|
|
44
48
|
}),
|
|
45
|
-
|
|
49
|
+
// app平台不可返回null,否则会报错“Multiple conflicting contents for sourcemap source”
|
|
50
|
+
map: isApp ? { mappings: '' } : null,
|
|
46
51
|
};
|
|
47
52
|
},
|
|
48
53
|
};
|
|
@@ -15,6 +15,7 @@ export declare function parseAssets(config: ResolvedConfig, code: string): strin
|
|
|
15
15
|
export declare function registerAssetToChunk(chunk: RenderedChunk, file: string): void;
|
|
16
16
|
export declare function checkPublicFile(url: string, { publicDir }: ResolvedConfig): string | undefined;
|
|
17
17
|
export declare function fileToUrl(id: string, config: ResolvedConfig, ctx: PluginContext, canInline: boolean | undefined, isStaticFile: IsStaticFile): string;
|
|
18
|
+
export declare function getAssetFilenameById(id: string, config: ResolvedConfig): string | undefined;
|
|
18
19
|
export declare function getAssetFilename(hash: string, config: ResolvedConfig): string | undefined;
|
|
19
20
|
/**
|
|
20
21
|
* converts the source filepath of the asset to the output filename based on the assetFileNames option. \
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.urlToBuiltUrl = exports.getAssetHash = exports.assetFileNamesToFileName = exports.getAssetFilename = exports.fileToUrl = exports.checkPublicFile = exports.registerAssetToChunk = exports.parseAssets = exports.assetPlugin = exports.chunkToEmittedAssetsMap = exports.assetUrlRE = void 0;
|
|
29
|
+
exports.urlToBuiltUrl = exports.getAssetHash = exports.assetFileNamesToFileName = exports.getAssetFilename = exports.getAssetFilenameById = exports.fileToUrl = exports.checkPublicFile = exports.registerAssetToChunk = exports.parseAssets = exports.assetPlugin = exports.chunkToEmittedAssetsMap = exports.assetUrlRE = void 0;
|
|
30
30
|
const path_1 = __importDefault(require("path"));
|
|
31
31
|
const url_1 = require("url");
|
|
32
32
|
const lite_1 = __importDefault(require("mime/lite"));
|
|
@@ -181,6 +181,24 @@ function fileToUrl(id, config, ctx, canInline = false, isStaticFile) {
|
|
|
181
181
|
return fileToBuiltUrl(id, config, ctx, false, canInline, isStaticFile);
|
|
182
182
|
}
|
|
183
183
|
exports.fileToUrl = fileToUrl;
|
|
184
|
+
function getAssetFilenameById(id, config) {
|
|
185
|
+
const [cacheForUrl] = assetCache.get(config);
|
|
186
|
+
if (cacheForUrl) {
|
|
187
|
+
let assetUrl = cacheForUrl.get(id);
|
|
188
|
+
// 以防万一路径不一致
|
|
189
|
+
if (!assetUrl && utils_1.isWindows) {
|
|
190
|
+
assetUrl = cacheForUrl.get((0, utils_1.normalizePath)(id));
|
|
191
|
+
}
|
|
192
|
+
if (assetUrl) {
|
|
193
|
+
const matches = assetUrl.match(/__VITE_ASSET__([a-z\d]{8})__(?:\$_(.*?)__)?/);
|
|
194
|
+
if (matches) {
|
|
195
|
+
const [, hash] = matches;
|
|
196
|
+
return getAssetFilename(hash, config);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.getAssetFilenameById = getAssetFilenameById;
|
|
184
202
|
function getAssetFilename(hash, config) {
|
|
185
203
|
return assetHashToFilenameMap.get(config)?.get(hash);
|
|
186
204
|
}
|
|
@@ -42,13 +42,14 @@ export declare function cssPlugin(config: ResolvedConfig, options?: {
|
|
|
42
42
|
/**
|
|
43
43
|
* Plugin applied after user plugins
|
|
44
44
|
*/
|
|
45
|
-
export declare function cssPostPlugin(config: ResolvedConfig, { platform, isJsCode, preserveModules, chunkCssFilename, chunkCssCode, includeComponentCss, }: {
|
|
45
|
+
export declare function cssPostPlugin(config: ResolvedConfig, { platform, isJsCode, preserveModules, chunkCssFilename, chunkCssCode, includeComponentCss, emitFile, }: {
|
|
46
46
|
platform: UniApp.PLATFORM;
|
|
47
47
|
isJsCode?: boolean;
|
|
48
48
|
preserveModules?: boolean;
|
|
49
49
|
chunkCssFilename: (id: string) => string | void;
|
|
50
50
|
chunkCssCode: (filename: string, cssCode: string) => Promise<string> | string;
|
|
51
51
|
includeComponentCss?: boolean;
|
|
52
|
+
emitFile?: (filename: string, cssCode: string) => void;
|
|
52
53
|
}): Plugin;
|
|
53
54
|
export declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): ExistingRawSourceMap;
|
|
54
55
|
export type CssUrlReplacer = (url: string, importer?: string, source?: PostCSS.Source) => string | Promise<string>;
|
|
@@ -151,7 +151,7 @@ function cssPlugin(config, options = { isAndroidX: false }) {
|
|
|
151
151
|
}
|
|
152
152
|
return url;
|
|
153
153
|
});
|
|
154
|
-
const { code: css, modules, deps, } = await compileCSS(id, raw, config, urlReplacer, atImportResolvers, server);
|
|
154
|
+
const { code: css, map, modules, deps, } = await compileCSS(id, raw, config, urlReplacer, atImportResolvers, server);
|
|
155
155
|
if (modules) {
|
|
156
156
|
moduleCache.set(id, modules);
|
|
157
157
|
}
|
|
@@ -171,8 +171,13 @@ function cssPlugin(config, options = { isAndroidX: false }) {
|
|
|
171
171
|
}
|
|
172
172
|
return {
|
|
173
173
|
code: css,
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
map: null,
|
|
175
|
+
meta: {
|
|
176
|
+
uni: {
|
|
177
|
+
// 向后传递用于合并
|
|
178
|
+
cssPreprocessorSourceMap: map,
|
|
179
|
+
},
|
|
180
|
+
},
|
|
176
181
|
};
|
|
177
182
|
},
|
|
178
183
|
};
|
|
@@ -214,10 +219,11 @@ function findCssModuleIds(moduleId, includeComponentCss = true, cssModuleIds, se
|
|
|
214
219
|
/**
|
|
215
220
|
* Plugin applied after user plugins
|
|
216
221
|
*/
|
|
217
|
-
function cssPostPlugin(config, { platform, isJsCode, preserveModules, chunkCssFilename, chunkCssCode, includeComponentCss, }) {
|
|
222
|
+
function cssPostPlugin(config, { platform, isJsCode, preserveModules, chunkCssFilename, chunkCssCode, includeComponentCss, emitFile, }) {
|
|
218
223
|
// styles initialization in buildStart causes a styling loss in watch
|
|
219
224
|
const styles = new Map();
|
|
220
225
|
let cssChunks;
|
|
226
|
+
const isDom2Harmony = process.env.UNI_APP_X_DOM2 === 'true' && platform === 'app-harmony';
|
|
221
227
|
return {
|
|
222
228
|
name: 'vite:css-post',
|
|
223
229
|
buildStart() {
|
|
@@ -232,7 +238,12 @@ function cssPostPlugin(config, { platform, isJsCode, preserveModules, chunkCssFi
|
|
|
232
238
|
// build CSS handling ----------------------------------------------------
|
|
233
239
|
styles.set(id, css);
|
|
234
240
|
return {
|
|
235
|
-
code: modulesCode ||
|
|
241
|
+
code: modulesCode ||
|
|
242
|
+
(isJsCode
|
|
243
|
+
? isDom2Harmony
|
|
244
|
+
? `export default ${constants_1.JS_STYLE_PLACEHOLDER_STR}`
|
|
245
|
+
: 'export default {}'
|
|
246
|
+
: ''),
|
|
236
247
|
map: { mappings: '' },
|
|
237
248
|
// avoid the css module from being tree-shaken so that we can retrieve
|
|
238
249
|
// it in renderChunk()
|
|
@@ -240,6 +251,10 @@ function cssPostPlugin(config, { platform, isJsCode, preserveModules, chunkCssFi
|
|
|
240
251
|
};
|
|
241
252
|
},
|
|
242
253
|
async renderChunk(_code, chunk, _opts) {
|
|
254
|
+
if (isDom2Harmony) {
|
|
255
|
+
// 通过 generateBundle 实现
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
243
258
|
const id = chunk.facadeModuleId;
|
|
244
259
|
if (id) {
|
|
245
260
|
// 云编译小程序时,只会生成一个chunk(index.module.js),不会动态import,给每个组件产生一个chunk,所以这里需要自行处理组件wxss
|
|
@@ -358,11 +373,13 @@ function cssPostPlugin(config, { platform, isJsCode, preserveModules, chunkCssFi
|
|
|
358
373
|
minify: true,
|
|
359
374
|
});
|
|
360
375
|
if (source.trim()) {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
376
|
+
emitFile
|
|
377
|
+
? emitFile(filename, source)
|
|
378
|
+
: this.emitFile({
|
|
379
|
+
fileName: filename,
|
|
380
|
+
type: 'asset',
|
|
381
|
+
source,
|
|
382
|
+
});
|
|
366
383
|
}
|
|
367
384
|
}
|
|
368
385
|
},
|
package/dist/vite/utils/ast.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AssignmentExpression, BaseNode, CallExpression, ExportSpecifier, Identifier, Literal, MemberExpression, MethodDefinition, Property } from 'estree';
|
|
2
|
-
import { type AttributeNode, type CompoundExpressionNode, type DirectiveNode, type ElementNode, type Node, type PlainElementNode, type SimpleExpressionNode } from '@vue/compiler-core';
|
|
2
|
+
import { type AttributeNode, type CommentNode, type CompoundExpressionNode, type DirectiveNode, type ElementNode, type Node, type PlainElementNode, type SimpleExpressionNode } from '@vue/compiler-core';
|
|
3
3
|
export declare const isProperty: (node: BaseNode) => node is Property;
|
|
4
4
|
export declare const isIdentifier: (node: BaseNode) => node is Identifier;
|
|
5
5
|
export declare const isAssignmentExpression: (node: BaseNode) => node is AssignmentExpression;
|
|
@@ -18,3 +18,4 @@ export declare function isAttributeNode(node: Node): node is AttributeNode;
|
|
|
18
18
|
export declare function isDirectiveNode(node: Node): node is DirectiveNode;
|
|
19
19
|
export declare function isSimpleExpressionNode(node: Node): node is SimpleExpressionNode;
|
|
20
20
|
export declare function isCompoundExpressionNode(node: Node): node is CompoundExpressionNode;
|
|
21
|
+
export declare function isCommentNode(node: Node): node is CommentNode;
|
package/dist/vite/utils/ast.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCompoundExpressionNode = exports.isSimpleExpressionNode = exports.isDirectiveNode = exports.isAttributeNode = exports.isPlainElementNode = exports.isElementNode = exports.parseVue = exports.createCallExpression = exports.createIdentifier = exports.createLiteral = exports.isReference = exports.isExportSpecifier = exports.isMethodDefinition = exports.isMemberExpression = exports.isCallExpression = exports.isAssignmentExpression = exports.isIdentifier = exports.isProperty = void 0;
|
|
3
|
+
exports.isCommentNode = exports.isCompoundExpressionNode = exports.isSimpleExpressionNode = exports.isDirectiveNode = exports.isAttributeNode = exports.isPlainElementNode = exports.isElementNode = exports.parseVue = exports.createCallExpression = exports.createIdentifier = exports.createLiteral = exports.isReference = exports.isExportSpecifier = exports.isMethodDefinition = exports.isMemberExpression = exports.isCallExpression = exports.isAssignmentExpression = exports.isIdentifier = exports.isProperty = void 0;
|
|
4
4
|
const compiler_core_1 = require("@vue/compiler-core");
|
|
5
5
|
const compiler_dom_1 = require("@vue/compiler-dom");
|
|
6
6
|
const isProperty = (node) => node.type === 'Property';
|
|
@@ -96,3 +96,7 @@ function isCompoundExpressionNode(node) {
|
|
|
96
96
|
return node.type === compiler_core_1.NodeTypes.COMPOUND_EXPRESSION;
|
|
97
97
|
}
|
|
98
98
|
exports.isCompoundExpressionNode = isCompoundExpressionNode;
|
|
99
|
+
function isCommentNode(node) {
|
|
100
|
+
return node.type === compiler_core_1.NodeTypes.COMMENT;
|
|
101
|
+
}
|
|
102
|
+
exports.isCommentNode = isCommentNode;
|
package/dist/vue/parse.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ElementNode, type RootNode } from '@vue/compiler-core';
|
|
2
|
+
import { onCompileLog } from '../logs';
|
|
2
3
|
export declare function parseVueCode(code: string, isNVue?: boolean): {
|
|
3
4
|
code: string;
|
|
4
5
|
files?: undefined;
|
|
@@ -11,3 +12,4 @@ export declare function parseVueCode(code: string, isNVue?: boolean): {
|
|
|
11
12
|
export declare function parseBlockCode(ast: RootNode, code: string): string;
|
|
12
13
|
export declare function parseWxsNodes(ast: RootNode): ElementNode[];
|
|
13
14
|
export declare function parseWxsCode(wxsNodes: ElementNode[], code: string): string;
|
|
15
|
+
export declare const onVueTemplateCompileLog: typeof onCompileLog;
|