@vixt/core 0.5.4 → 0.5.6

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,13 +176,7 @@ 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
-
185
179
  declare function generatePlugins(vixt: Vixt): string;
186
180
 
187
- export { applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, findUpWorkspaceDir, generateAppConfig, generateClient, generateCss, generateIndexHtml, generatePlugins, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, patchUnocss, resolveLayersDirs, typescript };
181
+ export { applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, findUpWorkspaceDir, generateAppConfig, generateClient, generateCss, generateIndexHtml, generatePlugins, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, resolveLayersDirs, typescript };
188
182
  export type { AppHead, AppOptions, ModuleDefinition, ModuleMeta, ModuleOptions, PluginOptions, TypescriptOptions, Vixt, VixtConfigLayer, VixtConfigLayerMeta, VixtModule, VixtOptions };
@@ -176,13 +176,7 @@ 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
-
185
179
  declare function generatePlugins(vixt: Vixt): string;
186
180
 
187
- export { applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, findUpWorkspaceDir, generateAppConfig, generateClient, generateCss, generateIndexHtml, generatePlugins, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, patchUnocss, resolveLayersDirs, typescript };
181
+ export { applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, findUpWorkspaceDir, generateAppConfig, generateClient, generateCss, generateIndexHtml, generatePlugins, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, resolveLayersDirs, typescript };
188
182
  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, resolvePathSync } from 'mlly';
9
+ import { pathToFileURL } from 'mlly';
10
10
  import 'tsx/esm';
11
11
  import Checker from 'vite-plugin-checker';
12
12
 
@@ -128,13 +128,17 @@ async function applyLayerModules(layers) {
128
128
  for (const m of modulesDirs.reverse()) {
129
129
  if (fs.existsSync(m)) {
130
130
  const files = fs.readdirSync(m);
131
- for (const f of files.filter((f2) => /(?:t|j)s$/.test(f2))) {
131
+ for (const f of files) {
132
132
  const p = path.resolve(m, f);
133
- const module = await import(
134
- /* @vite-ignore */
135
- pathToFileURL(p)
136
- ).then((m2) => m2.default);
137
- modules.push(module);
133
+ try {
134
+ const module = await import(
135
+ /* @vite-ignore */
136
+ pathToFileURL(p)
137
+ ).then((m2) => m2.default);
138
+ modules.push(module);
139
+ } catch (error) {
140
+ console.error("[LoadVixtModule Error]:", error);
141
+ }
138
142
  }
139
143
  }
140
144
  }
@@ -394,20 +398,6 @@ ${noscriptTemplate}
394
398
  return code;
395
399
  }
396
400
 
397
- function patchUnocss() {
398
- const filePath = resolvePathSync("@unocss/vite");
399
- let fileContent = fs.readFileSync(filePath, "utf-8");
400
- if (fileContent.includes(`const result = await cssPlugins.get(dir).transform.call(ctx2, css, id);`)) {
401
- fileContent = fileContent.replace(
402
- `const result = await cssPlugins.get(dir).transform.call(ctx2, css, id);`,
403
- `const cssPlugin = cssPlugins.get(dir);
404
- const cssPluginTransformHandler = "handler" in cssPlugin.transform ? cssPlugin.transform.handler : cssPlugin.transform;
405
- const result = await cssPluginTransformHandler.call(ctx2, css, id);`
406
- );
407
- fs.writeFileSync(filePath, fileContent);
408
- }
409
- }
410
-
411
401
  function generatePlugins(vixt) {
412
402
  const { plugins: pluginsDirs = [] } = resolveLayersDirs(vixt._layers);
413
403
  let pluginsImportTemplate = "";
@@ -415,7 +405,7 @@ function generatePlugins(vixt) {
415
405
  let i = 0;
416
406
  for (const pluginsDir of pluginsDirs.reverse()) {
417
407
  const files = fs.existsSync(pluginsDir) ? fs.readdirSync(pluginsDir) : [];
418
- for (const f of files.filter((f2) => /(?:t|j)sx?$/.test(f2))) {
408
+ for (const f of files.filter((f2) => /[jt]sx?$/.test(f2))) {
419
409
  const p = path.resolve(pluginsDir, f);
420
410
  const pluginName = `__plugin_${i}`;
421
411
  pluginsImportTemplate += `import ${pluginName} from '${p}'
@@ -464,4 +454,4 @@ function createVixtPlugin(loadOptions) {
464
454
  });
465
455
  }
466
456
 
467
- export { applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, findUpWorkspaceDir, generateAppConfig, generateClient, generateCss, generateIndexHtml, generatePlugins, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, patchUnocss, resolveLayersDirs, typescript };
457
+ export { applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, findUpWorkspaceDir, generateAppConfig, generateClient, generateCss, generateIndexHtml, generatePlugins, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, resolveLayersDirs, typescript };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/core",
3
3
  "type": "module",
4
- "version": "0.5.4",
4
+ "version": "0.5.6",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://soullyoko.github.io/vixt/",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@types/fs-extra": "^11.0.4",
35
35
  "@vue/tsconfig": "^0.7.0",
36
- "c12": "^3.0.4",
36
+ "c12": "^3.1.0",
37
37
  "cac": "^6.7.14",
38
38
  "defu": "^6.1.4",
39
39
  "find-up": "^7.0.0",
@@ -42,7 +42,7 @@
42
42
  "pathe": "^2.0.3",
43
43
  "pkg-types": "^2.2.0",
44
44
  "tsx": "^4.20.3",
45
- "vite": "^7.0.3",
45
+ "vite": "^7.0.5",
46
46
  "vite-plugin-checker": "^0.10.0"
47
47
  },
48
48
  "scripts": {