@vixt/core 0.4.3 → 0.4.5

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.
@@ -176,7 +176,13 @@ declare function generateCss(options: AppOptions): string;
176
176
 
177
177
  declare function generateIndexHtml(options: AppOptions, vixt: Vixt): string;
178
178
 
179
+ /**
180
+ * compatible unocss v66.0.0 to vite v7.0.0
181
+ * `[unocss:global:build:scan] cssPlugins.get(...).transform.call is not a function`
182
+ */
183
+ declare function patchUnocss(): void;
184
+
179
185
  declare function generatePlugins(vixt: Vixt): string;
180
186
 
181
- export { applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, findUpWorkspaceDir, generateAppConfig, generateClient, generateCss, generateIndexHtml, generatePlugins, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, resolveLayersDirs, typescript };
187
+ export { applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, findUpWorkspaceDir, generateAppConfig, generateClient, generateCss, generateIndexHtml, generatePlugins, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, patchUnocss, resolveLayersDirs, typescript };
182
188
  export type { AppHead, AppOptions, ModuleDefinition, ModuleMeta, ModuleOptions, PluginOptions, TypescriptOptions, Vixt, VixtConfigLayer, VixtConfigLayerMeta, VixtModule, VixtOptions };
@@ -176,7 +176,13 @@ declare function generateCss(options: AppOptions): string;
176
176
 
177
177
  declare function generateIndexHtml(options: AppOptions, vixt: Vixt): string;
178
178
 
179
+ /**
180
+ * compatible unocss v66.0.0 to vite v7.0.0
181
+ * `[unocss:global:build:scan] cssPlugins.get(...).transform.call is not a function`
182
+ */
183
+ declare function patchUnocss(): void;
184
+
179
185
  declare function generatePlugins(vixt: Vixt): string;
180
186
 
181
- export { applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, findUpWorkspaceDir, generateAppConfig, generateClient, generateCss, generateIndexHtml, generatePlugins, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, resolveLayersDirs, typescript };
187
+ export { applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, findUpWorkspaceDir, generateAppConfig, generateClient, generateCss, generateIndexHtml, generatePlugins, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, patchUnocss, resolveLayersDirs, typescript };
182
188
  export type { AppHead, AppOptions, ModuleDefinition, ModuleMeta, ModuleOptions, PluginOptions, TypescriptOptions, Vixt, VixtConfigLayer, VixtConfigLayerMeta, VixtModule, VixtOptions };
@@ -6,7 +6,7 @@ import { cac } from 'cac';
6
6
  import { findUpSync } from 'find-up';
7
7
  import { loadEnv as loadEnv$1 } from 'vite';
8
8
  import defu from 'defu';
9
- import { pathToFileURL } from 'mlly';
9
+ import { pathToFileURL, resolvePathSync } from 'mlly';
10
10
  import 'tsx/esm';
11
11
  import Checker from 'vite-plugin-checker';
12
12
 
@@ -38,6 +38,7 @@ function applyLayers(layers, config) {
38
38
  }
39
39
  if (layer.cwd?.includes("node_modules")) {
40
40
  const newCwd = resolve(buildLayersDir, layerName);
41
+ fs.removeSync(newCwd);
41
42
  fs.copySync(layer.cwd, newCwd, {
42
43
  filter: (src) => {
43
44
  const nodeModulesPath = resolve(layer.cwd, "node_modules");
@@ -391,6 +392,20 @@ ${noscriptTemplate}
391
392
  return code;
392
393
  }
393
394
 
395
+ function patchUnocss() {
396
+ const filePath = resolvePathSync("@unocss/vite");
397
+ let fileContent = fs.readFileSync(filePath, "utf-8");
398
+ if (fileContent.includes(`const result = await cssPlugins.get(dir).transform.call(ctx2, css, id);`)) {
399
+ fileContent = fileContent.replace(
400
+ `const result = await cssPlugins.get(dir).transform.call(ctx2, css, id);`,
401
+ `const cssPlugin = cssPlugins.get(dir);
402
+ const cssPluginTransformHandler = "handler" in cssPlugin.transform ? cssPlugin.transform.handler : cssPlugin.transform;
403
+ const result = await cssPluginTransformHandler.call(ctx2, css, id);`
404
+ );
405
+ fs.writeFileSync(filePath, fileContent);
406
+ }
407
+ }
408
+
394
409
  function generatePlugins(vixt) {
395
410
  const { plugins: pluginsDirs = [] } = resolveLayersDirs(vixt._layers);
396
411
  let pluginsImportTemplate = "";
@@ -447,4 +462,4 @@ function createVixtPlugin(loadOptions) {
447
462
  });
448
463
  }
449
464
 
450
- export { applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, findUpWorkspaceDir, generateAppConfig, generateClient, generateCss, generateIndexHtml, generatePlugins, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, resolveLayersDirs, typescript };
465
+ export { applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, findUpWorkspaceDir, generateAppConfig, generateClient, generateCss, generateIndexHtml, generatePlugins, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, patchUnocss, resolveLayersDirs, typescript };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/core",
3
3
  "type": "module",
4
- "version": "0.4.3",
4
+ "version": "0.4.5",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/SoulLyoko/vixt#readme",
@@ -31,9 +31,9 @@
31
31
  "fs-extra": "^11.3.0",
32
32
  "mlly": "^1.7.4",
33
33
  "pathe": "^2.0.3",
34
- "pkg-types": "^2.1.0",
34
+ "pkg-types": "^2.2.0",
35
35
  "tsx": "^4.20.3",
36
- "vite": "^6.3.5",
36
+ "vite": "^7.0.0",
37
37
  "vite-plugin-checker": "^0.9.3"
38
38
  },
39
39
  "scripts": {