@dcloudio/vite-plugin-uni 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.
- package/dist/cli/action.js +20 -3
- package/dist/cli/utils.js +9 -1
- package/dist/configResolved/plugins/resolveId.js +8 -1
- package/dist/index.js +2 -1
- package/dist/plugins/copy.js +56 -21
- package/dist/vue/options.js +78 -18
- package/package.json +5 -5
package/dist/cli/action.js
CHANGED
|
@@ -80,6 +80,7 @@ async function runDev(options) {
|
|
|
80
80
|
options.platform === 'app-harmony' ||
|
|
81
81
|
options.platform === 'mp-harmony') {
|
|
82
82
|
process.env.UNI_APP_CHANGED_FILES = '';
|
|
83
|
+
process.env.UNI_APP_UTS_CHANGED = '';
|
|
83
84
|
}
|
|
84
85
|
if (options.platform === 'app') {
|
|
85
86
|
process.env.UNI_APP_CHANGED_PAGES = '';
|
|
@@ -98,6 +99,8 @@ async function runDev(options) {
|
|
|
98
99
|
await (0, exports.stopProfiler)((message) => createLogger(options.logLevel).info(message));
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
102
|
+
const utsChanged = process.env.UNI_APP_UTS_CHANGED === 'true';
|
|
103
|
+
process.env.UNI_APP_UTS_CHANGED = '';
|
|
101
104
|
if (options.platform === 'app') {
|
|
102
105
|
const files = process.env.UNI_APP_CHANGED_FILES;
|
|
103
106
|
const pages = process.env.UNI_APP_CHANGED_PAGES;
|
|
@@ -118,10 +121,24 @@ async function runDev(options) {
|
|
|
118
121
|
}
|
|
119
122
|
else if (options.platform === 'app-harmony' ||
|
|
120
123
|
options.platform === 'mp-harmony') {
|
|
121
|
-
|
|
122
|
-
if (
|
|
123
|
-
|
|
124
|
+
// 鸿蒙平台cpp/uts插件变更需要整体编译
|
|
125
|
+
if (process.env.UNI_APP_X_DOM2_CPP_CHANGED !== 'true' &&
|
|
126
|
+
!utsChanged) {
|
|
127
|
+
const files = process.env.UNI_APP_CHANGED_FILES;
|
|
128
|
+
if (files) {
|
|
129
|
+
return (0, uni_cli_shared_1.output)('log', uni_cli_shared_1.M['dev.watching.end.files'].replace('{files}', files));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// dom2 下仅 cpp/uts插件 变更需要整体编译
|
|
134
|
+
// 如果有changedFiles就增量输出,否则就不要输出,而是打印无变更,静态资源走额外的全量同步
|
|
135
|
+
// 之前之所以没有增量就全量同步,是为了兼容性,怕出意外。
|
|
136
|
+
if (process.env.UNI_APP_X_DOM2 === 'true') {
|
|
137
|
+
if (process.env.UNI_APP_X_DOM2_CPP_CHANGED === 'true' ||
|
|
138
|
+
utsChanged) {
|
|
139
|
+
return (0, uni_cli_shared_1.output)('log', uni_cli_shared_1.M['dev.watching.end']);
|
|
124
140
|
}
|
|
141
|
+
return (0, uni_cli_shared_1.output)('log', uni_cli_shared_1.M['uvue.dev.watching.end.empty']);
|
|
125
142
|
}
|
|
126
143
|
return (0, uni_cli_shared_1.output)('log', uni_cli_shared_1.M['dev.watching.end']);
|
|
127
144
|
}
|
package/dist/cli/utils.js
CHANGED
|
@@ -176,6 +176,9 @@ function initEnv(type, options) {
|
|
|
176
176
|
manifestJson['app-plus']?.['utsCompilerVersion'] === 'v1') {
|
|
177
177
|
process.env.UNI_APP_X_TSC = 'false';
|
|
178
178
|
}
|
|
179
|
+
if (manifestJson['uni-app-x']?.['styleIsolationVersion'] === '2') {
|
|
180
|
+
process.env.UNI_APP_STYLE_ISOLATION_VERSION = '2';
|
|
181
|
+
}
|
|
179
182
|
}
|
|
180
183
|
catch (e) { }
|
|
181
184
|
if (!process.env.UNI_APP_X_TSC_DIR) {
|
|
@@ -218,6 +221,10 @@ function initEnv(type, options) {
|
|
|
218
221
|
process.env.UNI_COMPILER_VERSION_TYPE = pkg.version.includes('alpha')
|
|
219
222
|
? 'a'
|
|
220
223
|
: 'r';
|
|
224
|
+
process.env.UNI_HX_VERSION_DEV =
|
|
225
|
+
process.env.HX_Version && process.env.HX_Version.includes('-dev')
|
|
226
|
+
? 'true'
|
|
227
|
+
: 'false';
|
|
221
228
|
(0, uni_cli_shared_1.initPreContext)(process.env.UNI_PLATFORM, process.env.UNI_CUSTOM_CONTEXT, process.env.UNI_UTS_PLATFORM, process.env.UNI_APP_X === 'true');
|
|
222
229
|
// 应该全平台都显示吧,当初为啥只在部分平台显示?
|
|
223
230
|
if (process.env.UNI_PLATFORM === 'app' ||
|
|
@@ -225,7 +232,8 @@ function initEnv(type, options) {
|
|
|
225
232
|
process.env.UNI_PLATFORM === 'h5' ||
|
|
226
233
|
process.env.UNI_PLATFORM === 'app-harmony') {
|
|
227
234
|
console.log(uni_cli_shared_1.M['app.compiler.version'].replace('{version}', process.env.UNI_COMPILER_VERSION +
|
|
228
|
-
`(${process.env.UNI_APP_X === 'true' ? 'uni-app x' : 'vue3'})`
|
|
235
|
+
`(${process.env.UNI_APP_X === 'true' ? 'uni-app x' : 'vue3'})` +
|
|
236
|
+
(process.env.UNI_APP_X_DOM2 === 'true' ? '蒸汽模式' : '')));
|
|
229
237
|
}
|
|
230
238
|
console.log(uni_cli_shared_1.M['compiling']);
|
|
231
239
|
}
|
|
@@ -31,13 +31,20 @@ const BUILT_IN_MODULES = {
|
|
|
31
31
|
};
|
|
32
32
|
function uniResolveIdPlugin(options) {
|
|
33
33
|
const resolveCache = {};
|
|
34
|
-
|
|
34
|
+
const isX = process.env.UNI_APP_X === 'true';
|
|
35
|
+
if (isX) {
|
|
35
36
|
BUILT_IN_MODULES['@dcloudio/uni-app'] = 'dist-x/uni-app.es.js';
|
|
36
37
|
BUILT_IN_MODULES['@dcloudio/uni-cloud'] = 'dist/uni-cloud-x.es.js';
|
|
37
38
|
}
|
|
38
39
|
return {
|
|
39
40
|
name: 'uni:resolve-id',
|
|
40
41
|
resolveId(id, importer) {
|
|
42
|
+
if (isX && process.env.UNI_UTS_PLATFORM.startsWith('mp-')) {
|
|
43
|
+
// TODO 优化此逻辑,目前unicloud-db等内置组件依赖UTSJSONObject时会自动引用tslib,此处逻辑防止内置组件引用插件内置tslib
|
|
44
|
+
if (id === 'tslib') {
|
|
45
|
+
return '\0tslib.js';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
41
48
|
const cache = resolveCache[id];
|
|
42
49
|
if (cache) {
|
|
43
50
|
// debugResolve('cache', id, cache)
|
package/dist/index.js
CHANGED
|
@@ -116,7 +116,8 @@ function createPlugins(options) {
|
|
|
116
116
|
addCopyPlugin = true;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
// 之前限制的是只有标准编译目标才 copy,现在 ext-api 也需要 copy 资源,暂时只排除 uni_modules
|
|
120
|
+
if (process.env.UNI_COMPILE_TARGET === 'uni_modules') {
|
|
120
121
|
addCopyPlugin = false;
|
|
121
122
|
}
|
|
122
123
|
if (addCopyPlugin) {
|
package/dist/plugins/copy.js
CHANGED
|
@@ -12,11 +12,21 @@ const debugCopy = (0, debug_1.default)('uni:copy');
|
|
|
12
12
|
function uniCopyPlugin({ outputDir, copyOptions, }) {
|
|
13
13
|
const staticDir = uni_cli_shared_1.PUBLIC_DIR + '/**/*';
|
|
14
14
|
const uniModulesStaticDir = 'uni_modules/*/' + uni_cli_shared_1.PUBLIC_DIR + '/**/*';
|
|
15
|
+
const isDom2Harmony = process.env.UNI_APP_X_DOM2 === 'true' &&
|
|
16
|
+
process.env.UNI_PLATFORM === 'app-harmony';
|
|
17
|
+
const uniModulesCppDir = isDom2Harmony ? 'uni_modules/*/cppsdk/**/*' : '';
|
|
15
18
|
const assets = [staticDir, uniModulesStaticDir];
|
|
19
|
+
const cppAssets = [];
|
|
20
|
+
if (uniModulesCppDir) {
|
|
21
|
+
cppAssets.push(uniModulesCppDir);
|
|
22
|
+
}
|
|
16
23
|
const subpackages = (0, uni_cli_shared_1.parseSubpackagesRootOnce)(process.env.UNI_INPUT_DIR, process.env.UNI_PLATFORM);
|
|
17
24
|
subpackages.forEach((root) => {
|
|
18
25
|
assets.push((0, uni_cli_shared_1.normalizePath)(path_1.default.join(root, staticDir)));
|
|
19
26
|
assets.push((0, uni_cli_shared_1.normalizePath)(path_1.default.join(root, uniModulesStaticDir)));
|
|
27
|
+
if (uniModulesCppDir) {
|
|
28
|
+
cppAssets.push((0, uni_cli_shared_1.normalizePath)(path_1.default.join(root, uniModulesCppDir)));
|
|
29
|
+
}
|
|
20
30
|
});
|
|
21
31
|
copyOptions.assets.forEach((asset) => {
|
|
22
32
|
assets.push(asset);
|
|
@@ -25,27 +35,11 @@ function uniCopyPlugin({ outputDir, copyOptions, }) {
|
|
|
25
35
|
const platform = process.env.UNI_PLATFORM;
|
|
26
36
|
const utsPlatform = process.env.UNI_UTS_PLATFORM;
|
|
27
37
|
// 非当前平台 static 目录
|
|
28
|
-
const ignorePlatformStaticDirs = (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return p !== utsPlatform;
|
|
34
|
-
}
|
|
35
|
-
return p !== 'app';
|
|
36
|
-
}
|
|
37
|
-
return p !== 'app' && p !== 'app-plus';
|
|
38
|
-
}
|
|
39
|
-
else if (platform === 'h5' || platform === 'web') {
|
|
40
|
-
return p !== 'h5' && p !== 'web';
|
|
41
|
-
}
|
|
42
|
-
else if (platform.startsWith('app-')) {
|
|
43
|
-
return p !== 'app' && p !== platform;
|
|
44
|
-
}
|
|
45
|
-
return p !== platform;
|
|
46
|
-
})
|
|
47
|
-
// 在最后增加 / 是为了避免误判以 platform 开头的目录,比如 app-test
|
|
48
|
-
.map((p) => '/' + uni_cli_shared_1.PUBLIC_DIR + '/' + p + '/');
|
|
38
|
+
const ignorePlatformStaticDirs = createIgnorePlatformDirs(uni_cli_shared_1.PUBLIC_DIR, platform, utsPlatform);
|
|
39
|
+
// 非当前平台 cppsdk 目录
|
|
40
|
+
const ignorePlatformCppDirs = uniModulesCppDir
|
|
41
|
+
? createIgnorePlatformDirs('cppsdk', platform, utsPlatform)
|
|
42
|
+
: [];
|
|
49
43
|
const targets = [
|
|
50
44
|
{
|
|
51
45
|
src: assets,
|
|
@@ -73,6 +67,24 @@ function uniCopyPlugin({ outputDir, copyOptions, }) {
|
|
|
73
67
|
},
|
|
74
68
|
];
|
|
75
69
|
targets.push(...copyOptions.targets);
|
|
70
|
+
if (process.env.UNI_APP_HARMONY_DOM2_CPP_DIR && cppAssets.length) {
|
|
71
|
+
targets.push({
|
|
72
|
+
src: cppAssets,
|
|
73
|
+
dest: process.env.UNI_APP_HARMONY_DOM2_CPP_DIR,
|
|
74
|
+
watchOptions: {
|
|
75
|
+
readyTimeout: getReadyTimeout(),
|
|
76
|
+
ignored(path) {
|
|
77
|
+
const normalizedPath = (0, uni_cli_shared_1.normalizePath)(path);
|
|
78
|
+
if (ignorePlatformCppDirs.find((dir) =>
|
|
79
|
+
// dir都是以 / 结尾,所以这里也要以 / 结尾
|
|
80
|
+
(normalizedPath + '/').includes(dir))) {
|
|
81
|
+
return fs_1.default.statSync(normalizedPath).isDirectory();
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
76
88
|
debugCopy(targets);
|
|
77
89
|
checkIgnoreStatic(ignorePlatformStaticDirs.map((dir) => dir.substring(1).split('/')));
|
|
78
90
|
return (0, uni_cli_shared_1.uniViteCopyPlugin)({
|
|
@@ -110,3 +122,26 @@ function getReadyTimeout() {
|
|
|
110
122
|
// 仅在生产环境使用
|
|
111
123
|
return 4000;
|
|
112
124
|
}
|
|
125
|
+
function createIgnorePlatformDirs(dir, platform, utsPlatform) {
|
|
126
|
+
return ((0, uni_cli_shared_1.getPlatforms)()
|
|
127
|
+
.filter((p) => {
|
|
128
|
+
if (platform === 'app') {
|
|
129
|
+
if (process.env.UNI_APP_X === 'true') {
|
|
130
|
+
if (p === 'app-android' || p === 'app-ios' || p === 'app-harmony') {
|
|
131
|
+
return p !== utsPlatform;
|
|
132
|
+
}
|
|
133
|
+
return p !== 'app';
|
|
134
|
+
}
|
|
135
|
+
return p !== 'app' && p !== 'app-plus';
|
|
136
|
+
}
|
|
137
|
+
else if (platform === 'h5' || platform === 'web') {
|
|
138
|
+
return p !== 'h5' && p !== 'web';
|
|
139
|
+
}
|
|
140
|
+
else if (platform.startsWith('app-')) {
|
|
141
|
+
return p !== 'app' && p !== platform;
|
|
142
|
+
}
|
|
143
|
+
return p !== platform;
|
|
144
|
+
})
|
|
145
|
+
// 在最后增加 / 是为了避免误判以 platform 开头的目录,比如 app-test
|
|
146
|
+
.map((p) => '/' + dir + '/' + p + '/'));
|
|
147
|
+
}
|
package/dist/vue/options.js
CHANGED
|
@@ -4,10 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.initPluginViteLegacyOptions = exports.initPluginVueJsxOptions = exports.initPluginVueOptions = exports.createPluginVueInstance = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
7
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
9
|
const shared_1 = require("@vue/shared");
|
|
10
|
+
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
9
11
|
const uni_cli_shared_1 = require("@dcloudio/uni-cli-shared");
|
|
10
|
-
const uni_nvue_styler_1 = require("@dcloudio/uni-nvue-styler");
|
|
11
12
|
const utils_1 = require("../utils");
|
|
12
13
|
const pluginVuePath = require.resolve('@vitejs/plugin-vue');
|
|
13
14
|
const normalizedPluginVuePath = (0, uni_cli_shared_1.normalizePath)(pluginVuePath);
|
|
@@ -45,24 +46,19 @@ function initPluginVueOptions(options, UniVitePlugins, uniPluginOptions) {
|
|
|
45
46
|
}
|
|
46
47
|
// 解析 scoped 中 deep 等特殊语法
|
|
47
48
|
styleOptions.postcssPlugins.push((0, uni_cli_shared_1.uniPostcssScopedPlugin)());
|
|
49
|
+
// 解析 :external() 语法,dom2 + 小程序平台下提升外部类选择器权重
|
|
50
|
+
if (process.env.UNI_APP_STYLE_ISOLATION_VERSION === '2' &&
|
|
51
|
+
process.env.UNI_APP_X === 'true') {
|
|
52
|
+
styleOptions.postcssPlugins.push((0, uni_cli_shared_1.uniPostcssExternalPlugin)());
|
|
53
|
+
}
|
|
48
54
|
const templateOptions = vueOptions.template || (vueOptions.template = {});
|
|
49
55
|
const compilerOptions = templateOptions.compilerOptions || (templateOptions.compilerOptions = {});
|
|
56
|
+
const isDom2Harmony = process.env.UNI_APP_X_DOM2 === 'true' &&
|
|
57
|
+
process.env.UNI_PLATFORM === 'app-harmony';
|
|
50
58
|
compilerOptions.isX = process.env.UNI_APP_X === 'true';
|
|
59
|
+
compilerOptions.dom2 = isDom2Harmony;
|
|
51
60
|
// 默认就移除comments节点
|
|
52
61
|
compilerOptions.comments = false;
|
|
53
|
-
if (process.env.UNI_PLATFORM !== 'web') {
|
|
54
|
-
// 非 web 平台,使用 factory 模式
|
|
55
|
-
;
|
|
56
|
-
compilerOptions.templateMode = 'factory';
|
|
57
|
-
compilerOptions.disableEventDelegation = true;
|
|
58
|
-
compilerOptions.disableClassBinding = true;
|
|
59
|
-
compilerOptions.parseStaticStyle = (style) => {
|
|
60
|
-
return (0, uni_nvue_styler_1.parseInlineStyleSync)(style, {
|
|
61
|
-
type: 'uvue',
|
|
62
|
-
platform: process.env.UNI_UTS_PLATFORM,
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
62
|
const { compiler, styleOptions: { postcssPlugins }, compilerOptions: { miniProgram, isNativeTag, isVoidTag, isCustomElement, nodeTransforms, directiveTransforms, whitespace, }, } = uniPluginOptions;
|
|
67
63
|
if (postcssPlugins) {
|
|
68
64
|
styleOptions.postcssPlugins.push(...postcssPlugins);
|
|
@@ -74,9 +70,18 @@ function initPluginVueOptions(options, UniVitePlugins, uniPluginOptions) {
|
|
|
74
70
|
;
|
|
75
71
|
compilerOptions.miniProgram = miniProgram;
|
|
76
72
|
}
|
|
73
|
+
const isDevX = process.env.UNI_HX_VERSION_DEV === 'true' &&
|
|
74
|
+
process.env.UNI_APP_X === 'true';
|
|
77
75
|
if (isNativeTag) {
|
|
78
76
|
const userIsNativeTag = compilerOptions.isNativeTag;
|
|
79
77
|
compilerOptions.isNativeTag = (tag) => {
|
|
78
|
+
if (isDevX) {
|
|
79
|
+
const source = (0, uni_cli_shared_1.matchEasycom)(tag);
|
|
80
|
+
// 不能是uts插件的easycom组件
|
|
81
|
+
if (source && !source.includes('?uts-proxy')) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
80
85
|
if (isNativeTag(tag)) {
|
|
81
86
|
return true;
|
|
82
87
|
}
|
|
@@ -129,7 +134,7 @@ function initPluginVueOptions(options, UniVitePlugins, uniPluginOptions) {
|
|
|
129
134
|
templateOptions.transformAssetUrls = builtInTransformAssetUrls;
|
|
130
135
|
if (typeof userOptionsTransformAssetUrls !== 'boolean' &&
|
|
131
136
|
!!userOptionsTransformAssetUrls?.tags &&
|
|
132
|
-
!
|
|
137
|
+
!(0, shared_1.isArray)(userOptionsTransformAssetUrls.tags)) {
|
|
133
138
|
templateOptions.transformAssetUrls = {
|
|
134
139
|
...builtInTransformAssetUrls,
|
|
135
140
|
...userOptionsTransformAssetUrls,
|
|
@@ -140,9 +145,7 @@ function initPluginVueOptions(options, UniVitePlugins, uniPluginOptions) {
|
|
|
140
145
|
};
|
|
141
146
|
}
|
|
142
147
|
if (options.platform !== 'h5' && options.platform !== 'web') {
|
|
143
|
-
compilerOptions.nodeTransforms.push(...(0, uni_cli_shared_1.getBaseNodeTransforms)(options.base,
|
|
144
|
-
? (0, uni_cli_shared_1.createResolveStaticAsset)(options.inputDir)
|
|
145
|
-
: undefined));
|
|
148
|
+
compilerOptions.nodeTransforms.push(...(0, uni_cli_shared_1.getBaseNodeTransforms)(options.base, isDom2Harmony ? (0, uni_cli_shared_1.createResolveStaticAsset)(options.inputDir) : undefined));
|
|
146
149
|
}
|
|
147
150
|
if (nodeTransforms) {
|
|
148
151
|
compilerOptions.nodeTransforms.push(...nodeTransforms);
|
|
@@ -213,6 +216,63 @@ function initPluginVueOptions(options, UniVitePlugins, uniPluginOptions) {
|
|
|
213
216
|
if (!vueOptions.script.babelParserPlugins.includes('decorators')) {
|
|
214
217
|
vueOptions.script.babelParserPlugins.push('decorators');
|
|
215
218
|
}
|
|
219
|
+
if (isDom2Harmony) {
|
|
220
|
+
const appVue = (0, uni_cli_shared_1.resolveAppVue)(process.env.UNI_INPUT_DIR);
|
|
221
|
+
function isAppVue(id) {
|
|
222
|
+
return (0, uni_cli_shared_1.normalizePath)(id) === appVue;
|
|
223
|
+
}
|
|
224
|
+
;
|
|
225
|
+
compilerOptions.isEasyComponent = (tag) => {
|
|
226
|
+
return (0, uni_shared_1.isDom2VueComponentTag)(tag) || !!(0, uni_cli_shared_1.matchEasycom)(tag);
|
|
227
|
+
};
|
|
228
|
+
compilerOptions.isUserComponent = (element) => {
|
|
229
|
+
return (0, uni_shared_1.isDom2AppUserVueComponentTag)(element.tag);
|
|
230
|
+
};
|
|
231
|
+
vueOptions.script.extraOptions = (descriptor) => {
|
|
232
|
+
return {
|
|
233
|
+
isWatch: process.env.NODE_ENV === 'development',
|
|
234
|
+
helper: (0, uni_cli_shared_1.requireUniHelpers)(),
|
|
235
|
+
componentType: (0, uni_cli_shared_1.isUniPageFile)(descriptor.filename)
|
|
236
|
+
? 'page'
|
|
237
|
+
: isAppVue(descriptor.filename)
|
|
238
|
+
? 'app'
|
|
239
|
+
: 'component',
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
let disableStaticStyle = false;
|
|
243
|
+
if (isDevX && process.env.NODE_ENV === 'development') {
|
|
244
|
+
if (process.env.UNI_UTS_PLATFORM === 'app-harmony') {
|
|
245
|
+
// 开发版本、开发模式下,非鸿蒙release模式打包
|
|
246
|
+
disableStaticStyle =
|
|
247
|
+
process.env.UNI_APP_HARMONY_RUN_MODE !== 'release';
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
;
|
|
251
|
+
vueOptions.template.compilerOptions.extraOptions = (descriptor) => {
|
|
252
|
+
const filename = (0, uni_cli_shared_1.normalizePath)(descriptor.filename.split('?')[0]);
|
|
253
|
+
const relativeFilename = (0, uni_cli_shared_1.normalizePath)(path_1.default.relative(process.env.UNI_INPUT_DIR, filename));
|
|
254
|
+
return {
|
|
255
|
+
root: (0, uni_cli_shared_1.normalizePath)(process.env.UNI_INPUT_DIR),
|
|
256
|
+
platform: process.env.UNI_UTS_PLATFORM,
|
|
257
|
+
componentType: (0, uni_cli_shared_1.isUniPageFile)(filename) ? 'page' : 'component',
|
|
258
|
+
relativeFilename,
|
|
259
|
+
helper: (0, uni_cli_shared_1.requireUniHelpers)(),
|
|
260
|
+
scriptCppBlocks: descriptor.scriptCppBlocks,
|
|
261
|
+
genVueId: !!process.env.UNI_AUTOMATOR_WS_ENDPOINT,
|
|
262
|
+
disableStaticStyle,
|
|
263
|
+
onVueTemplateCompileLog(type, error) {
|
|
264
|
+
return (0, uni_cli_shared_1.onVueTemplateCompileLog)(type, error, descriptor.source, relativeFilename);
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
// 如果是 easyComponent 组件,则不需要从setup中导入组件且不支持 self 引用
|
|
271
|
+
;
|
|
272
|
+
compilerOptions.isEasyComponent = (tag) => {
|
|
273
|
+
return (0, uni_shared_1.isBuiltInComponent)(tag) || !!(0, uni_cli_shared_1.matchEasycom)(tag);
|
|
274
|
+
};
|
|
275
|
+
}
|
|
216
276
|
}
|
|
217
277
|
return vueOptions;
|
|
218
278
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/vite-plugin-uni",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-5000320260312001",
|
|
4
4
|
"description": "uni-app vite plugin",
|
|
5
5
|
"bin": {
|
|
6
6
|
"uni": "bin/uni.js"
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"picocolors": "1.1.0",
|
|
45
45
|
"terser": "^5.4.0",
|
|
46
46
|
"unplugin-auto-import": "19.1.0",
|
|
47
|
-
"@dcloudio/uni-cli-shared": "3.0.0-
|
|
48
|
-
"@dcloudio/uni-
|
|
49
|
-
"@dcloudio/uni-
|
|
47
|
+
"@dcloudio/uni-cli-shared": "3.0.0-5000320260312001",
|
|
48
|
+
"@dcloudio/uni-nvue-styler": "3.0.0-5000320260312001",
|
|
49
|
+
"@dcloudio/uni-shared": "3.0.0-5000320260312001"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/debug": "4.1.12",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"vite": "5.2.8"
|
|
64
64
|
},
|
|
65
65
|
"uni-app": {
|
|
66
|
-
"compilerVersion": "
|
|
66
|
+
"compilerVersion": "5.03"
|
|
67
67
|
},
|
|
68
68
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
69
69
|
"scripts": {
|