@dcloudio/vite-plugin-uni 3.0.0-alpha-3031120220208001 → 3.0.0-alpha-3030820220114009
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/server.js +3 -3
- package/dist/cli/utils.js +2 -2
- package/dist/config/css.js +0 -7
- package/dist/config/resolve.js +1 -1
- package/dist/configResolved/index.d.ts +3 -1
- package/dist/configResolved/index.js +1 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +2 -1
- package/dist/plugins/copy.js +2 -1
- package/package.json +19 -19
package/dist/cli/server.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.createSSRServer = exports.createServer = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const
|
|
9
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
10
10
|
const vite_1 = require("vite");
|
|
11
11
|
const express_1 = __importDefault(require("express"));
|
|
12
12
|
const uni_cli_shared_1 = require("@dcloudio/uni-cli-shared");
|
|
@@ -21,8 +21,8 @@ async function createServer(options) {
|
|
|
21
21
|
}));
|
|
22
22
|
await server.listen();
|
|
23
23
|
const logger = server.config.logger;
|
|
24
|
-
logger.info(
|
|
25
|
-
|
|
24
|
+
logger.info(picocolors_1.default.cyan(`\n vite v${require('vite/package.json').version}`) +
|
|
25
|
+
picocolors_1.default.green(` dev server running at:\n`), {
|
|
26
26
|
clear: !server.config.logger.hasWarned,
|
|
27
27
|
});
|
|
28
28
|
server.printUrls();
|
package/dist/cli/utils.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.printStartupDuration = exports.cleanOptions = exports.initEnv = exports.
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const
|
|
10
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
11
11
|
const perf_hooks_1 = require("perf_hooks");
|
|
12
12
|
const uni_cli_shared_1 = require("@dcloudio/uni-cli-shared");
|
|
13
13
|
const nvue_1 = require("./nvue");
|
|
@@ -172,7 +172,7 @@ function printStartupDuration(logger, whitespace = true) {
|
|
|
172
172
|
if (global.__vite_start_time) {
|
|
173
173
|
// @ts-ignore
|
|
174
174
|
const startupDuration = perf_hooks_1.performance.now() - global.__vite_start_time;
|
|
175
|
-
logger.info(`${whitespace ? `\n ` : ''}${
|
|
175
|
+
logger.info(`${whitespace ? `\n ` : ''}${picocolors_1.default.cyan(`ready in ${Math.ceil(startupDuration)}ms.`)}\n`);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
exports.printStartupDuration = printStartupDuration;
|
package/dist/config/css.js
CHANGED
|
@@ -15,15 +15,8 @@ function resolveAdditionalData(inputDir, config) {
|
|
|
15
15
|
}
|
|
16
16
|
return fs_extra_1.default.readFileSync(uniScssFile, 'utf8') + '\n' + userAdditionalData;
|
|
17
17
|
}
|
|
18
|
-
function resolvePostcssConfig(inputDir) {
|
|
19
|
-
return [
|
|
20
|
-
path_1.default.resolve(inputDir, 'postcss.config.js'),
|
|
21
|
-
path_1.default.resolve(process.cwd(), 'postcss.config.js'),
|
|
22
|
-
].find((file) => fs_extra_1.default.existsSync(file));
|
|
23
|
-
}
|
|
24
18
|
function createCss(options, config) {
|
|
25
19
|
return {
|
|
26
|
-
postcss: resolvePostcssConfig(options.inputDir),
|
|
27
20
|
preprocessorOptions: {
|
|
28
21
|
scss: {
|
|
29
22
|
charset: false,
|
package/dist/config/resolve.js
CHANGED
|
@@ -10,7 +10,7 @@ function customResolver(updatedId) {
|
|
|
10
10
|
if (uni_cli_shared_1.isWindows) {
|
|
11
11
|
return (0, uni_cli_shared_1.normalizePath)((0, uni_cli_shared_1.requireResolve)(updatedId, process.env.UNI_INPUT_DIR));
|
|
12
12
|
}
|
|
13
|
-
return updatedId;
|
|
13
|
+
return (0, uni_cli_shared_1.requireResolve)(updatedId, process.env.UNI_INPUT_DIR);
|
|
14
14
|
}
|
|
15
15
|
exports.customResolver = customResolver;
|
|
16
16
|
function createResolve(options, _config) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
import { VitePluginUniResolvedOptions } from '..';
|
|
3
|
-
export declare function createConfigResolved(options: VitePluginUniResolvedOptions): ((config: Readonly<Omit<import("vite").UserConfig, "alias" | "dedupe" | "optimizeDeps" | "plugins" | "assetsInclude"> & {
|
|
3
|
+
export declare function createConfigResolved(options: VitePluginUniResolvedOptions): ((config: Readonly<Omit<import("vite").UserConfig, "alias" | "dedupe" | "optimizeDeps" | "plugins" | "assetsInclude" | "worker"> & {
|
|
4
4
|
configFile: string | undefined;
|
|
5
5
|
configFileDependencies: string[];
|
|
6
6
|
inlineConfig: import("vite").InlineConfig;
|
|
7
7
|
root: string;
|
|
8
8
|
base: string;
|
|
9
9
|
publicDir: string;
|
|
10
|
+
cacheDir: string;
|
|
10
11
|
command: "build" | "serve";
|
|
11
12
|
mode: string;
|
|
12
13
|
isProduction: boolean;
|
|
@@ -22,4 +23,5 @@ export declare function createConfigResolved(options: VitePluginUniResolvedOptio
|
|
|
22
23
|
logger: import("vite").Logger;
|
|
23
24
|
createResolver: (options?: Partial<import("vite").InternalResolveOptions> | undefined) => import("vite").ResolveFn;
|
|
24
25
|
optimizeDeps: Omit<import("vite").DepOptimizationOptions, "keepNames">;
|
|
26
|
+
worker: import("vite").ResolveWorkerOptions;
|
|
25
27
|
}>) => void | Promise<void>) | undefined;
|
|
@@ -15,6 +15,7 @@ function createConfigResolved(options) {
|
|
|
15
15
|
initCheckUpdate();
|
|
16
16
|
if (uni_cli_shared_1.isWindows) {
|
|
17
17
|
// TODO 等 https://github.com/vitejs/vite/issues/3331 修复后,可以移除下列代码
|
|
18
|
+
// 2.8.0 已修复,但为了兼容旧版本,先不移除
|
|
18
19
|
const item = config.resolve.alias.find((item) => typeof item.find !== 'string' ? item.find.test('@/') : false);
|
|
19
20
|
if (item) {
|
|
20
21
|
item.customResolver = resolve_1.customResolver;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,6 @@ import type { Options as ViteLegacyOptions } from '@vitejs/plugin-legacy';
|
|
|
4
4
|
import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx';
|
|
5
5
|
import { CopyOptions } from '@dcloudio/uni-cli-shared';
|
|
6
6
|
export interface VitePluginUniOptions {
|
|
7
|
-
inputDir?: string;
|
|
8
|
-
outputDir?: string;
|
|
9
7
|
vueOptions?: VueOptions;
|
|
10
8
|
vueJsxOptions?: (VueJSXPluginOptions & {
|
|
11
9
|
babelPlugins?: any[];
|
package/dist/index.js
CHANGED
|
@@ -42,7 +42,8 @@ function uniPlugin(rawOptions = {}) {
|
|
|
42
42
|
options.inputDir = process.env.UNI_INPUT_DIR;
|
|
43
43
|
(0, uni_cli_shared_1.initPreContext)(options.platform, process.env.UNI_CUSTOM_CONTEXT);
|
|
44
44
|
const plugins = [];
|
|
45
|
-
|
|
45
|
+
// 仅限 h5
|
|
46
|
+
if (options.viteLegacyOptions && options.platform === 'h5') {
|
|
46
47
|
plugins.push(...(0, plugin_legacy_1.default)((0, vue_1.initPluginViteLegacyOptions)(options)));
|
|
47
48
|
}
|
|
48
49
|
const uniPlugins = (0, utils_1.initExtraPlugins)(process.env.UNI_CLI_CONTEXT || process.cwd(), process.env.UNI_PLATFORM || 'h5', options);
|
package/dist/plugins/copy.js
CHANGED
|
@@ -39,8 +39,9 @@ function uniCopyPlugin({ outputDir, copyOptions, }) {
|
|
|
39
39
|
ignored(path) {
|
|
40
40
|
const normalizedPath = (0, uni_cli_shared_1.normalizePath)(path);
|
|
41
41
|
if (platformStaticDirs.find((dir) => normalizedPath.includes(dir))) {
|
|
42
|
-
return fs_1.default.statSync(normalizedPath).isDirectory;
|
|
42
|
+
return fs_1.default.statSync(normalizedPath).isDirectory();
|
|
43
43
|
}
|
|
44
|
+
return false;
|
|
44
45
|
},
|
|
45
46
|
},
|
|
46
47
|
},
|
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-3030820220114009",
|
|
4
4
|
"description": "uni-app vite plugin",
|
|
5
5
|
"bin": {
|
|
6
6
|
"uni": "bin/uni.js"
|
|
@@ -22,27 +22,27 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@babel/core": "^7.16.
|
|
25
|
+
"@babel/core": "^7.16.12",
|
|
26
26
|
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
|
27
|
-
"@babel/plugin-transform-typescript": "^7.16.
|
|
28
|
-
"@dcloudio/uni-cli-shared": "3.0.0-alpha-
|
|
29
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
27
|
+
"@babel/plugin-transform-typescript": "^7.16.8",
|
|
28
|
+
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3030820220114009",
|
|
29
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3030820220114009",
|
|
30
30
|
"@rollup/pluginutils": "^4.1.2",
|
|
31
|
-
"@vitejs/plugin-legacy": "^1.
|
|
32
|
-
"@vitejs/plugin-vue": "^2.0
|
|
33
|
-
"@vitejs/plugin-vue-jsx": "^1.3.
|
|
34
|
-
"@vue/compiler-core": "3.2.
|
|
35
|
-
"@vue/compiler-dom": "3.2.
|
|
36
|
-
"@vue/compiler-sfc": "3.2.
|
|
37
|
-
"@vue/shared": "3.2.
|
|
38
|
-
"cac": "
|
|
39
|
-
"
|
|
40
|
-
"debug": "^4.3.2",
|
|
31
|
+
"@vitejs/plugin-legacy": "^1.7.0",
|
|
32
|
+
"@vitejs/plugin-vue": "^2.2.0",
|
|
33
|
+
"@vitejs/plugin-vue-jsx": "^1.3.4",
|
|
34
|
+
"@vue/compiler-core": "3.2.30",
|
|
35
|
+
"@vue/compiler-dom": "3.2.30",
|
|
36
|
+
"@vue/compiler-sfc": "3.2.30",
|
|
37
|
+
"@vue/shared": "3.2.30",
|
|
38
|
+
"cac": "6.7.9",
|
|
39
|
+
"debug": "^4.3.3",
|
|
41
40
|
"estree-walker": "^2.0.2",
|
|
42
41
|
"express": "^4.17.1",
|
|
43
42
|
"fs-extra": "^10.0.0",
|
|
44
43
|
"hash-sum": "^2.0.0",
|
|
45
|
-
"jsonc-parser": "^3.0.0"
|
|
44
|
+
"jsonc-parser": "^3.0.0",
|
|
45
|
+
"picocolors": "^1.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/debug": "^4.1.7",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"@types/fs-extra": "^9.0.13",
|
|
51
51
|
"@types/sass": "^1.16.0",
|
|
52
52
|
"@vue/babel-plugin-jsx": "^1.1.1",
|
|
53
|
-
"chokidar": "^3.5.
|
|
53
|
+
"chokidar": "^3.5.3"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"vite": "^2.
|
|
56
|
+
"vite": "^2.8.0"
|
|
57
57
|
},
|
|
58
58
|
"uni-app": {
|
|
59
|
-
"compilerVersion": "3.3.
|
|
59
|
+
"compilerVersion": "3.3.8"
|
|
60
60
|
},
|
|
61
61
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da"
|
|
62
62
|
}
|