@vixt/core 0.4.3 → 0.4.4

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
 
@@ -391,6 +391,20 @@ ${noscriptTemplate}
391
391
  return code;
392
392
  }
393
393
 
394
+ function patchUnocss() {
395
+ const filePath = resolvePathSync("@unocss/vite");
396
+ let fileContent = fs.readFileSync(filePath, "utf-8");
397
+ if (fileContent.includes(`const result = await cssPlugins.get(dir).transform.call(ctx2, css, id);`)) {
398
+ fileContent = fileContent.replace(
399
+ `const result = await cssPlugins.get(dir).transform.call(ctx2, css, id);`,
400
+ `const cssPlugin = cssPlugins.get(dir);
401
+ const cssPluginTransformHandler = "handler" in cssPlugin.transform ? cssPlugin.transform.handler : cssPlugin.transform;
402
+ const result = await cssPluginTransformHandler.call(ctx2, css, id);`
403
+ );
404
+ fs.writeFileSync(filePath, fileContent);
405
+ }
406
+ }
407
+
394
408
  function generatePlugins(vixt) {
395
409
  const { plugins: pluginsDirs = [] } = resolveLayersDirs(vixt._layers);
396
410
  let pluginsImportTemplate = "";
@@ -429,6 +443,8 @@ async function loadVixt(opts) {
429
443
  const isForce = !!parsedArgv.options.force;
430
444
  if (isForce) {
431
445
  fs.removeSync(result.config.buildDir);
446
+ } else {
447
+ fs.removeSync(result.config.buildLayersDir);
432
448
  }
433
449
  result.layers = applyLayers(result.layers ?? [], result.config);
434
450
  const layerModules = await applyLayerModules(result.layers ?? []);
@@ -447,4 +463,4 @@ function createVixtPlugin(loadOptions) {
447
463
  });
448
464
  }
449
465
 
450
- export { applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, findUpWorkspaceDir, generateAppConfig, generateClient, generateCss, generateIndexHtml, generatePlugins, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, resolveLayersDirs, typescript };
466
+ 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.4",
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": {