@dcloudio/vite-plugin-uni 3.0.0-alpha-3040420220402003 → 3.0.0-alpha-3040420220402004
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/utils.d.ts +1 -1
- package/dist/cli/utils.js +7 -1
- package/dist/index.js +3 -1
- package/dist/resolveId/index.js +2 -2
- package/package.json +3 -3
package/dist/cli/utils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { InlineConfig, Logger } from 'vite';
|
|
|
2
2
|
import { CliOptions } from '.';
|
|
3
3
|
export declare const PLATFORMS: string[];
|
|
4
4
|
export declare function addConfigFile(inlineConfig: InlineConfig): InlineConfig;
|
|
5
|
-
export declare function initEnv(type: 'dev' | 'build', options: CliOptions): void;
|
|
5
|
+
export declare function initEnv(type: 'unknown' | 'dev' | 'build', options: CliOptions): void;
|
|
6
6
|
export declare function cleanOptions(options: CliOptions): {
|
|
7
7
|
'--'?: string[] | undefined;
|
|
8
8
|
platform?: string | undefined;
|
package/dist/cli/utils.js
CHANGED
|
@@ -42,7 +42,12 @@ function addConfigFile(inlineConfig) {
|
|
|
42
42
|
return inlineConfig;
|
|
43
43
|
}
|
|
44
44
|
exports.addConfigFile = addConfigFile;
|
|
45
|
+
let initliazed = false;
|
|
45
46
|
function initEnv(type, options) {
|
|
47
|
+
if (initliazed) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
initliazed = true;
|
|
46
51
|
if (options.platform === 'mp-360') {
|
|
47
52
|
console.error(uni_cli_shared_1.M['mp.360.unsupported']);
|
|
48
53
|
process.exit(0);
|
|
@@ -78,7 +83,8 @@ function initEnv(type, options) {
|
|
|
78
83
|
process.env.UNI_SUB_PLATFORM = options.platform;
|
|
79
84
|
options.platform = 'quickapp-webview';
|
|
80
85
|
}
|
|
81
|
-
process.env.VITE_ROOT_DIR =
|
|
86
|
+
process.env.VITE_ROOT_DIR =
|
|
87
|
+
process.env.VITE_ROOT_DIR || process.env.UNI_INPUT_DIR || process.cwd();
|
|
82
88
|
process.env.UNI_INPUT_DIR =
|
|
83
89
|
process.env.UNI_INPUT_DIR || path_1.default.resolve(process.cwd(), 'src');
|
|
84
90
|
initCustomScripts(options);
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ const configResolved_1 = require("./configResolved");
|
|
|
15
15
|
const copy_1 = require("./plugins/copy");
|
|
16
16
|
const utils_1 = require("./utils");
|
|
17
17
|
const vue_1 = require("./vue");
|
|
18
|
-
|
|
18
|
+
const utils_2 = require("./cli/utils");
|
|
19
19
|
const debugUni = (0, debug_1.default)('uni:plugin');
|
|
20
20
|
const pkg = require(path_1.default.resolve(__dirname, '../package.json'));
|
|
21
21
|
(0, uni_cli_shared_1.initModuleAlias)();
|
|
@@ -28,6 +28,8 @@ var action_1 = require("./cli/action");
|
|
|
28
28
|
Object.defineProperty(exports, "runDev", { enumerable: true, get: function () { return action_1.runDev; } });
|
|
29
29
|
Object.defineProperty(exports, "runBuild", { enumerable: true, get: function () { return action_1.runBuild; } });
|
|
30
30
|
function uniPlugin(rawOptions = {}) {
|
|
31
|
+
// 三方插件(如vitest)可能提供了自己的入口命令,需要补充 env 初始化逻辑
|
|
32
|
+
(0, utils_2.initEnv)('unknown', { platform: process.env.UNI_PLATFORM || 'h5' });
|
|
31
33
|
const options = {
|
|
32
34
|
...rawOptions,
|
|
33
35
|
base: '/',
|
package/dist/resolveId/index.js
CHANGED
|
@@ -6,10 +6,10 @@ function createResolveId(options) {
|
|
|
6
6
|
const inputDir = (0, uni_cli_shared_1.normalizePath)(options.inputDir);
|
|
7
7
|
return function (id) {
|
|
8
8
|
if (id.startsWith('@/')) {
|
|
9
|
-
return inputDir + id.
|
|
9
|
+
return inputDir + id.slice(1);
|
|
10
10
|
}
|
|
11
11
|
else if (id.startsWith('~@/')) {
|
|
12
|
-
return inputDir + id.
|
|
12
|
+
return inputDir + id.slice(2);
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/vite-plugin-uni",
|
|
3
|
-
"version": "3.0.0-alpha-
|
|
3
|
+
"version": "3.0.0-alpha-3040420220402004",
|
|
4
4
|
"description": "uni-app vite plugin",
|
|
5
5
|
"bin": {
|
|
6
6
|
"uni": "bin/uni.js"
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@babel/core": "^7.17.8",
|
|
26
26
|
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
|
27
27
|
"@babel/plugin-transform-typescript": "^7.16.8",
|
|
28
|
-
"@dcloudio/uni-cli-shared": "3.0.0-alpha-
|
|
29
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
28
|
+
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3040420220402004",
|
|
29
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3040420220402004",
|
|
30
30
|
"@rollup/pluginutils": "^4.2.0",
|
|
31
31
|
"@vitejs/plugin-legacy": "^1.8.0",
|
|
32
32
|
"@vitejs/plugin-vue": "^2.3.1",
|