@dcloudio/vite-plugin-uni 3.0.0-5000620260331001 → 3.0.0-5000720260410001
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 +6 -8
- package/dist/cli/utils.js +9 -7
- package/dist/cli/uvue.js +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +10 -14
- package/dist/plugins/copy.js +5 -4
- package/dist/vue/options.js +30 -7
- package/package.json +5 -5
package/dist/cli/action.js
CHANGED
|
@@ -48,7 +48,8 @@ async function runDev(options) {
|
|
|
48
48
|
options.minify = true;
|
|
49
49
|
}
|
|
50
50
|
(0, utils_1.initEnv)('dev', options);
|
|
51
|
-
if (
|
|
51
|
+
if (process.env.UNI_APP_X === 'true' &&
|
|
52
|
+
process.env.UNI_UTS_PLATFORM === 'app-android') {
|
|
52
53
|
return (0, uvue_1.runUVueAndroidDev)(options);
|
|
53
54
|
}
|
|
54
55
|
const createLogger = await Promise.resolve().then(() => __importStar(require('vite'))).then(({ createLogger }) => createLogger);
|
|
@@ -100,12 +101,11 @@ async function runDev(options) {
|
|
|
100
101
|
}
|
|
101
102
|
const utsChanged = process.env.UNI_APP_UTS_CHANGED === 'true';
|
|
102
103
|
process.env.UNI_APP_UTS_CHANGED = '';
|
|
103
|
-
let changedFiles = '';
|
|
104
104
|
if (options.platform === 'app') {
|
|
105
105
|
const files = process.env.UNI_APP_CHANGED_FILES;
|
|
106
106
|
const pages = process.env.UNI_APP_CHANGED_PAGES;
|
|
107
107
|
const dex = process.env.UNI_APP_UTS_CHANGED_FILES;
|
|
108
|
-
changedFiles = pages || files;
|
|
108
|
+
const changedFiles = pages || files;
|
|
109
109
|
process.env.UNI_APP_CHANGED_PAGES = '';
|
|
110
110
|
process.env.UNI_APP_CHANGED_FILES = '';
|
|
111
111
|
process.env.UNI_APP_UTS_CHANGED_FILES = '';
|
|
@@ -138,10 +138,7 @@ async function runDev(options) {
|
|
|
138
138
|
utsChanged) {
|
|
139
139
|
return (0, uni_cli_shared_1.output)('log', uni_cli_shared_1.M['dev.watching.end']);
|
|
140
140
|
}
|
|
141
|
-
|
|
142
|
-
if (!changedFiles) {
|
|
143
|
-
return (0, uni_cli_shared_1.output)('log', uni_cli_shared_1.M['uvue.dev.watching.end.empty']);
|
|
144
|
-
}
|
|
141
|
+
return (0, uni_cli_shared_1.output)('log', uni_cli_shared_1.M['uvue.dev.watching.end.empty']);
|
|
145
142
|
}
|
|
146
143
|
return (0, uni_cli_shared_1.output)('log', uni_cli_shared_1.M['dev.watching.end']);
|
|
147
144
|
}
|
|
@@ -177,7 +174,8 @@ async function runDev(options) {
|
|
|
177
174
|
exports.runDev = runDev;
|
|
178
175
|
async function runBuild(options) {
|
|
179
176
|
(0, utils_1.initEnv)('build', options);
|
|
180
|
-
if (
|
|
177
|
+
if (process.env.UNI_APP_X === 'true' &&
|
|
178
|
+
process.env.UNI_UTS_PLATFORM === 'app-android') {
|
|
181
179
|
return (0, uvue_1.runUVueAndroidBuild)(options);
|
|
182
180
|
}
|
|
183
181
|
try {
|
package/dist/cli/utils.js
CHANGED
|
@@ -176,7 +176,7 @@ 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']
|
|
179
|
+
if (manifestJson['uni-app-x']?.['styleIsolationVersion'] === '2') {
|
|
180
180
|
process.env.UNI_APP_STYLE_ISOLATION_VERSION = '2';
|
|
181
181
|
}
|
|
182
182
|
}
|
|
@@ -226,12 +226,14 @@ function initEnv(type, options) {
|
|
|
226
226
|
? 'true'
|
|
227
227
|
: 'false';
|
|
228
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');
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
console.log(uni_cli_shared_1.M['
|
|
229
|
+
// 应该全平台都显示吧,当初为啥只在部分平台显示?
|
|
230
|
+
if (process.env.UNI_PLATFORM === 'app' ||
|
|
231
|
+
process.env.UNI_PLATFORM === 'web' ||
|
|
232
|
+
process.env.UNI_PLATFORM === 'h5' ||
|
|
233
|
+
process.env.UNI_PLATFORM === 'app-harmony') {
|
|
234
|
+
console.log(uni_cli_shared_1.M['app.compiler.version'].replace('{version}', process.env.UNI_COMPILER_VERSION +
|
|
235
|
+
`(${process.env.UNI_APP_X === 'true' ? 'uni-app x' : 'vue3'})` +
|
|
236
|
+
(process.env.UNI_APP_X_DOM2 === 'true' ? '蒸汽模式' : '')));
|
|
235
237
|
}
|
|
236
238
|
console.log(uni_cli_shared_1.M['compiling']);
|
|
237
239
|
}
|
package/dist/cli/uvue.js
CHANGED
|
@@ -26,8 +26,8 @@ function initUVueEnv() {
|
|
|
26
26
|
}
|
|
27
27
|
if (process.env.UNI_PLATFORM === 'app') {
|
|
28
28
|
process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE = 'native';
|
|
29
|
-
//
|
|
30
|
-
if (
|
|
29
|
+
// 如果是app-ios,目前强制使用js引擎
|
|
30
|
+
if (process.env.UNI_UTS_PLATFORM === 'app-ios') {
|
|
31
31
|
process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE = 'js';
|
|
32
32
|
}
|
|
33
33
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -25,4 +25,3 @@ export interface VitePluginUniResolvedOptions extends VitePluginUniOptions {
|
|
|
25
25
|
}
|
|
26
26
|
export { runDev, runBuild } from './cli/action';
|
|
27
27
|
export default function uniPlugin(rawOptions?: VitePluginUniOptions): Plugin[];
|
|
28
|
-
export declare function shouldMoveSourceMapFromCache(): boolean | "";
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.runBuild = exports.runDev = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const vite_1 = __importDefault(require("unplugin-auto-import/vite"));
|
|
9
9
|
const plugin_vue_jsx_1 = __importDefault(require("@vitejs/plugin-vue-jsx"));
|
|
@@ -41,11 +41,13 @@ function uniPlugin(rawOptions = {}) {
|
|
|
41
41
|
};
|
|
42
42
|
options.platform = process.env.UNI_PLATFORM || 'h5';
|
|
43
43
|
options.inputDir = process.env.UNI_INPUT_DIR;
|
|
44
|
-
const plugins =
|
|
44
|
+
const plugins = process.env.UNI_APP_X === 'true' &&
|
|
45
|
+
process.env.UNI_UTS_PLATFORM === 'app-android'
|
|
45
46
|
? createUVueAndroidPlugins(options)
|
|
46
47
|
: createPlugins(options);
|
|
47
48
|
// x 提供 auto import(非android、android自行处理)
|
|
48
|
-
if (process.env.UNI_APP_X === 'true' &&
|
|
49
|
+
if (process.env.UNI_APP_X === 'true' &&
|
|
50
|
+
process.env.UNI_UTS_PLATFORM !== 'app-android') {
|
|
49
51
|
plugins.unshift((0, vite_1.default)((0, uni_cli_shared_1.initAutoImportOptions)(process.env.UNI_UTS_PLATFORM, options.autoImportOptions || {})));
|
|
50
52
|
}
|
|
51
53
|
plugins.unshift((0, uni_cli_shared_1.uniJsonPlugin)());
|
|
@@ -61,9 +63,7 @@ function createPlugins(options) {
|
|
|
61
63
|
// iOS 暂不使用该机制
|
|
62
64
|
process.env.UNI_UTS_PLATFORM !== 'app-ios' &&
|
|
63
65
|
// harmony 同 iOS
|
|
64
|
-
process.env.UNI_UTS_PLATFORM !== 'app-harmony'
|
|
65
|
-
// Android Vapor 暂不使用该机制(只有 Android Native 会进入该方法,不需要额外判断)
|
|
66
|
-
process.env.UNI_UTS_PLATFORM !== 'app-android') {
|
|
66
|
+
process.env.UNI_UTS_PLATFORM !== 'app-harmony') {
|
|
67
67
|
plugins.push((0, uni_cli_shared_1.uniUTSExtApiReplace)());
|
|
68
68
|
}
|
|
69
69
|
else {
|
|
@@ -135,7 +135,10 @@ function createPlugins(options) {
|
|
|
135
135
|
if (fs_1.default.existsSync(sourceMapPath)) {
|
|
136
136
|
(0, uni_cli_shared_1.emptyDir)(sourceMapPath);
|
|
137
137
|
}
|
|
138
|
-
if (
|
|
138
|
+
if (process.env.UNI_APP_X === 'true' &&
|
|
139
|
+
process.env.UNI_UTS_PLATFORM === 'app-ios' &&
|
|
140
|
+
process.env.UNI_APP_X_CACHE_DIR &&
|
|
141
|
+
process.env.NODE_ENV !== 'development') {
|
|
139
142
|
plugins.push((0, move_1.uniMovePlugin)({
|
|
140
143
|
apply: 'build',
|
|
141
144
|
enforce: 'post',
|
|
@@ -187,10 +190,3 @@ function createUVueAndroidPlugins(options) {
|
|
|
187
190
|
function resolveSourceMapDirByCacheDir() {
|
|
188
191
|
return path_1.default.resolve(process.env.UNI_APP_X_CACHE_DIR, 'sourcemap');
|
|
189
192
|
}
|
|
190
|
-
function shouldMoveSourceMapFromCache() {
|
|
191
|
-
return (process.env.UNI_APP_X === 'true' &&
|
|
192
|
-
process.env.UNI_APP_X_CACHE_DIR &&
|
|
193
|
-
process.env.NODE_ENV !== 'development' &&
|
|
194
|
-
((0, uni_cli_shared_1.isUniAppXIOS)() || (0, uni_cli_shared_1.isUniAppXAndroidJsEngine)()));
|
|
195
|
-
}
|
|
196
|
-
exports.shouldMoveSourceMapFromCache = shouldMoveSourceMapFromCache;
|
package/dist/plugins/copy.js
CHANGED
|
@@ -12,8 +12,9 @@ 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
|
|
16
|
-
|
|
15
|
+
const isDom2Harmony = process.env.UNI_APP_X_DOM2 === 'true' &&
|
|
16
|
+
process.env.UNI_PLATFORM === 'app-harmony';
|
|
17
|
+
const uniModulesCppDir = isDom2Harmony ? 'uni_modules/*/cppsdk/**/*' : '';
|
|
17
18
|
const assets = [staticDir, uniModulesStaticDir];
|
|
18
19
|
const cppAssets = [];
|
|
19
20
|
if (uniModulesCppDir) {
|
|
@@ -66,10 +67,10 @@ function uniCopyPlugin({ outputDir, copyOptions, }) {
|
|
|
66
67
|
},
|
|
67
68
|
];
|
|
68
69
|
targets.push(...copyOptions.targets);
|
|
69
|
-
if (process.env.
|
|
70
|
+
if (process.env.UNI_APP_HARMONY_DOM2_CPP_DIR && cppAssets.length) {
|
|
70
71
|
targets.push({
|
|
71
72
|
src: cppAssets,
|
|
72
|
-
dest: process.env.
|
|
73
|
+
dest: process.env.UNI_APP_HARMONY_DOM2_CPP_DIR,
|
|
73
74
|
watchOptions: {
|
|
74
75
|
readyTimeout: getReadyTimeout(),
|
|
75
76
|
ignored(path) {
|
package/dist/vue/options.js
CHANGED
|
@@ -4,6 +4,7 @@ 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");
|
|
9
10
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
@@ -52,9 +53,10 @@ function initPluginVueOptions(options, UniVitePlugins, uniPluginOptions) {
|
|
|
52
53
|
}
|
|
53
54
|
const templateOptions = vueOptions.template || (vueOptions.template = {});
|
|
54
55
|
const compilerOptions = templateOptions.compilerOptions || (templateOptions.compilerOptions = {});
|
|
55
|
-
const
|
|
56
|
+
const isDom2Harmony = process.env.UNI_APP_X_DOM2 === 'true' &&
|
|
57
|
+
process.env.UNI_PLATFORM === 'app-harmony';
|
|
56
58
|
compilerOptions.isX = process.env.UNI_APP_X === 'true';
|
|
57
|
-
compilerOptions.dom2 =
|
|
59
|
+
compilerOptions.dom2 = isDom2Harmony;
|
|
58
60
|
// 默认就移除comments节点
|
|
59
61
|
compilerOptions.comments = false;
|
|
60
62
|
const { compiler, styleOptions: { postcssPlugins }, compilerOptions: { miniProgram, isNativeTag, isVoidTag, isCustomElement, nodeTransforms, directiveTransforms, whitespace, }, } = uniPluginOptions;
|
|
@@ -143,7 +145,7 @@ function initPluginVueOptions(options, UniVitePlugins, uniPluginOptions) {
|
|
|
143
145
|
};
|
|
144
146
|
}
|
|
145
147
|
if (options.platform !== 'h5' && options.platform !== 'web') {
|
|
146
|
-
compilerOptions.nodeTransforms.push(...(0, uni_cli_shared_1.getBaseNodeTransforms)(options.base,
|
|
148
|
+
compilerOptions.nodeTransforms.push(...(0, uni_cli_shared_1.getBaseNodeTransforms)(options.base, isDom2Harmony ? (0, uni_cli_shared_1.createResolveStaticAsset)(options.inputDir) : undefined));
|
|
147
149
|
}
|
|
148
150
|
if (nodeTransforms) {
|
|
149
151
|
compilerOptions.nodeTransforms.push(...nodeTransforms);
|
|
@@ -214,7 +216,7 @@ function initPluginVueOptions(options, UniVitePlugins, uniPluginOptions) {
|
|
|
214
216
|
if (!vueOptions.script.babelParserPlugins.includes('decorators')) {
|
|
215
217
|
vueOptions.script.babelParserPlugins.push('decorators');
|
|
216
218
|
}
|
|
217
|
-
if (
|
|
219
|
+
if (isDom2Harmony) {
|
|
218
220
|
const appVue = (0, uni_cli_shared_1.resolveAppVue)(process.env.UNI_INPUT_DIR);
|
|
219
221
|
function isAppVue(id) {
|
|
220
222
|
return (0, uni_cli_shared_1.normalizePath)(id) === appVue;
|
|
@@ -229,8 +231,6 @@ function initPluginVueOptions(options, UniVitePlugins, uniPluginOptions) {
|
|
|
229
231
|
vueOptions.script.extraOptions = (descriptor) => {
|
|
230
232
|
return {
|
|
231
233
|
isWatch: process.env.NODE_ENV === 'development',
|
|
232
|
-
// TODO 目前使用全局开关,后续可能是页面级别的开关?
|
|
233
|
-
dynamicSharedData: process.env.UNI_APP_X_DOM2_DYNAMIC === 'true',
|
|
234
234
|
helper: (0, uni_cli_shared_1.requireUniHelpers)(),
|
|
235
235
|
componentType: (0, uni_cli_shared_1.isUniPageFile)(descriptor.filename)
|
|
236
236
|
? 'page'
|
|
@@ -239,8 +239,31 @@ function initPluginVueOptions(options, UniVitePlugins, uniPluginOptions) {
|
|
|
239
239
|
: 'component',
|
|
240
240
|
};
|
|
241
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
|
+
;
|
|
242
251
|
vueOptions.template.compilerOptions.extraOptions = (descriptor) => {
|
|
243
|
-
|
|
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
|
+
};
|
|
244
267
|
};
|
|
245
268
|
}
|
|
246
269
|
else {
|
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-5000720260410001",
|
|
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-shared": "3.0.0-
|
|
49
|
-
"@dcloudio/uni-nvue-styler": "3.0.0-
|
|
47
|
+
"@dcloudio/uni-cli-shared": "3.0.0-5000720260410001",
|
|
48
|
+
"@dcloudio/uni-shared": "3.0.0-5000720260410001",
|
|
49
|
+
"@dcloudio/uni-nvue-styler": "3.0.0-5000720260410001"
|
|
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": "5.
|
|
66
|
+
"compilerVersion": "5.07"
|
|
67
67
|
},
|
|
68
68
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
69
69
|
"scripts": {
|