@octohash/vite-config 0.3.1 → 0.3.3

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 +17 -8
  2. package/package.json +2 -1
package/dist/index.mjs CHANGED
@@ -10299,10 +10299,10 @@ const isCwdInScope = isPackageExists("@octohash/vite-config");
10299
10299
  function isPackageInScope(name) {
10300
10300
  return isPackageExists(name, { paths: [scopeUrl] });
10301
10301
  }
10302
- async function ensurePackages(packages) {
10302
+ async function ensurePackages(packages, dev = true) {
10303
10303
  if (process$1.env.CI || process$1.stdout.isTTY === false || isCwdInScope === false)
10304
10304
  return;
10305
- const pkgs = packages.filter((i) => i && !isPackageInScope(i));
10305
+ const pkgs = packages.filter((i) => i && !isPackageInScope(i) && !isPackageExists(i));
10306
10306
  if (pkgs.length === 0)
10307
10307
  return;
10308
10308
  const p = await import('@clack/prompts');
@@ -10311,7 +10311,7 @@ async function ensurePackages(packages) {
10311
10311
  });
10312
10312
  if (result) {
10313
10313
  const { installPackage } = await import('@antfu/install-pkg');
10314
- await installPackage(pkgs, { dev: true });
10314
+ await installPackage(pkgs, { dev });
10315
10315
  }
10316
10316
  }
10317
10317
 
@@ -10489,6 +10489,8 @@ async function loadVuePlugins(projectType, options) {
10489
10489
  devtools ? "vite-plugin-vue-devtools" : void 0,
10490
10490
  i18n ? "@intlify/unplugin-vue-i18n" : void 0
10491
10491
  ]);
10492
+ if (i18n)
10493
+ await ensurePackages(["vue-i18n"], false);
10492
10494
  return loadPlugins([
10493
10495
  {
10494
10496
  condition: true,
@@ -10517,7 +10519,8 @@ async function loadVuePlugins(projectType, options) {
10517
10519
  typeof i18n === "boolean" ? {
10518
10520
  compositionOnly: true,
10519
10521
  fullInstall: true,
10520
- runtimeOnly: true
10522
+ runtimeOnly: true,
10523
+ include: [resolve(process$1.cwd(), "i18n/**")]
10521
10524
  } : i18n
10522
10525
  )
10523
10526
  ];
@@ -10582,6 +10585,10 @@ async function resolveAutoImports() {
10582
10585
  imports.push("@vueuse/core");
10583
10586
  if (isPackageExists("vue-i18n"))
10584
10587
  imports.push("vue-i18n");
10588
+ if (isPackageExists("@unhead/vue")) {
10589
+ const { unheadVueComposablesImports } = await import('@unhead/vue');
10590
+ imports.push(unheadVueComposablesImports);
10591
+ }
10585
10592
  return imports;
10586
10593
  }
10587
10594
  async function resolveUIComponentResolvers() {
@@ -10769,14 +10776,16 @@ function defineLibConfig(options) {
10769
10776
  build: {
10770
10777
  lib: {
10771
10778
  entry: "src/index.ts",
10772
- fileName: () => "index.mjs",
10779
+ fileName: (_, name) => `${name}.mjs`,
10773
10780
  formats: ["es"]
10774
10781
  },
10775
10782
  rollupOptions: {
10783
+ output: {
10784
+ preserveModules: true,
10785
+ preserveModulesRoot: "src"
10786
+ },
10776
10787
  external: (id) => {
10777
- return externalPackages.some(
10778
- (pkg) => id === pkg || id.startsWith(`${pkg}/`)
10779
- );
10788
+ return externalPackages.some((pkg) => id === pkg || id.startsWith(`${pkg}/`));
10780
10789
  }
10781
10790
  }
10782
10791
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@octohash/vite-config",
3
3
  "type": "module",
4
- "version": "0.3.1",
4
+ "version": "0.3.3",
5
5
  "description": "Opinionated Vite config preset.",
6
6
  "author": "jinghaihan",
7
7
  "license": "MIT",
@@ -31,6 +31,7 @@
31
31
  "dist"
32
32
  ],
33
33
  "peerDependencies": {
34
+ "@unhead/vue": ">=2.0.0",
34
35
  "vite": ">=7.0.0"
35
36
  },
36
37
  "dependencies": {