@pubinfo-pr/vite 0.245.1 → 0.246.1

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.
Files changed (2) hide show
  1. package/dist/index.mjs +4 -31
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -3,10 +3,9 @@ import { defineConfig, loadEnv, mergeConfig, normalizePath } from "vite";
3
3
  import process, { cwd } from "node:process";
4
4
  import { logger } from "@pubinfo-pr/shared";
5
5
  import chalk from "chalk";
6
- import path, { dirname, join, posix, relative, resolve } from "node:path";
6
+ import { dirname, join, posix, relative, resolve } from "node:path";
7
7
  import vue from "@vitejs/plugin-vue";
8
8
  import vueJsx from "@vitejs/plugin-vue-jsx";
9
- import fs from "fs-extra";
10
9
  import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
11
10
  import { proxyCreateProgram } from "@volar/typescript";
12
11
  import { createParsedCommandLine, createVueLanguagePlugin, getDefaultCompilerOptions } from "@vue/language-core";
@@ -80,33 +79,6 @@ function getServerProxy(env, isProxy) {
80
79
  return serverProxy;
81
80
  }
82
81
 
83
- //#endregion
84
- //#region src/plugins/built-in/clean-build.ts
85
- function createCleanBuild() {
86
- let config;
87
- return {
88
- name: "vite-plugin-clean-build",
89
- apply: "build",
90
- enforce: "post",
91
- configResolved(resolvedConfig) {
92
- config = resolvedConfig;
93
- },
94
- buildStart() {
95
- const outDir = config.build.outDir;
96
- const root = config.root;
97
- const outputPath = path.resolve(root, outDir);
98
- if (fs.existsSync(outputPath)) try {
99
- fs.rmSync(outputPath, {
100
- recursive: true,
101
- force: true
102
- });
103
- } catch (error) {
104
- logger.error(`[vite-plugin-clean-build] Failed to clean build directory: ${error}`);
105
- }
106
- }
107
- };
108
- }
109
-
110
82
  //#endregion
111
83
  //#region src/plugins/built-in/dts.ts
112
84
  function createDTS(options = {}) {
@@ -804,7 +776,6 @@ function createVitePlugins(viteEnv, isBuild = false, config, type) {
804
776
  enabled: !moduleConfig.pure
805
777
  }));
806
778
  }
807
- if (type === "app") vitePlugins.push(createCleanBuild());
808
779
  if (isBuild) vitePlugins.push(createCompression(viteEnv));
809
780
  return vitePlugins.filter(Boolean);
810
781
  }
@@ -815,7 +786,7 @@ function createDefaultAppConfig(config) {
815
786
  return ({ mode, command }) => {
816
787
  const root = cwd();
817
788
  const isBuild = command === "build";
818
- const timestamp = (/* @__PURE__ */ new Date()).getTime();
789
+ const timestamp = Date.now();
819
790
  const env = loadEnv(mode, root);
820
791
  const { VITE_OPEN_PROXY, VITE_BUILD_SOURCEMAP } = env;
821
792
  return {
@@ -834,6 +805,8 @@ function createDefaultAppConfig(config) {
834
805
  resolve: { alias: alias(root) },
835
806
  build: {
836
807
  outDir: mode === "production" ? "dist" : `dist-${mode}`,
808
+ emptyOutDir: true,
809
+ copyPublicDir: true,
837
810
  sourcemap: VITE_BUILD_SOURCEMAP === "true",
838
811
  reportCompressedSize: false,
839
812
  chunkSizeWarningLimit: 2e3,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo-pr/vite",
3
3
  "type": "module",
4
- "version": "0.245.1",
4
+ "version": "0.246.1",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.mts",
@@ -25,8 +25,8 @@
25
25
  "vue-tsc": "^3.2.4"
26
26
  },
27
27
  "dependencies": {
28
- "@pubinfo-pr/devtools": "0.245.1",
29
- "@pubinfo-pr/shared": "0.245.1",
28
+ "@pubinfo-pr/devtools": "0.246.1",
29
+ "@pubinfo-pr/shared": "0.246.1",
30
30
  "@pubinfo/unplugin-openapi": "^0.9.1",
31
31
  "@vitejs/plugin-legacy": "^8.0.0",
32
32
  "@vitejs/plugin-vue": "^6.0.4",