vueless 0.0.478-beta.15 → 0.0.478-beta.16

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.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The file should have `.js` extension to allow import from the folder without adding `/index.ts` in the end.
3
+ * Vite doesn't recognize `.ts` files without extension.
4
+ */
5
+
6
+ export { default as vTooltip } from "./tooltip/vTooltip.ts";
7
+ export { default as vClickOutside } from "./clickOutside/vClickOutside.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.478-beta.15",
3
+ "version": "0.0.478-beta.16",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -176,7 +176,7 @@ async function getComponentSafelist(
176
176
 
177
177
  if (defaultConfigPath) {
178
178
  // disable file caching on vueless env (for the dev purpose)
179
- defaultConfigPath = isVuelessEnv ? defaultConfigPath : `${defaultConfigPath}?${Date.now()}`;
179
+ defaultConfigPath = isVuelessEnv ? `${defaultConfigPath}?${Date.now()}` : defaultConfigPath;
180
180
 
181
181
  const configPath = path.join(process.cwd(), defaultConfigPath);
182
182
  const defaultConfigContent = await readFile(configPath, { encoding: "utf-8" });
package/vite.js CHANGED
@@ -71,7 +71,7 @@ export const Vueless = function (options = {}) {
71
71
 
72
72
  if (config.command === "dev" || config.command === "serve") {
73
73
  /* remove dynamically copied icons on dev server start */
74
- await removeIcons(debug);
74
+ await removeIcons({ debug, isNuxt });
75
75
 
76
76
  /* add web-types config to the package.json */
77
77
  addWebTypesToPackageJson(env, debug);
@@ -1,2 +0,0 @@
1
- export { default as vTooltip } from "./tooltip/vTooltip.ts";
2
- export { default as vClickOutside } from "./clickOutside/vClickOutside.ts";
package/vite/index.js DELETED
@@ -1,100 +0,0 @@
1
- /**
2
- * The file has `.js` extension because it is a node script.
3
- * Please do not change the extension if you do not fully understand the consequences.
4
- */
5
-
6
- import UnpluginVueComponents from "unplugin-vue-components/vite";
7
-
8
- import { loadSvg } from "../utils/node/loaderSvg.js";
9
- import { copyIcons, removeIcons } from "../utils/node/loaderIcon.js";
10
- import { createTailwindSafelist, clearTailwindSafelist } from "../utils/node/tailwindSafelist.js";
11
- import { addWebTypesToPackageJson, getNuxtFiles, getVueSourceFile } from "../utils/node/helper.js";
12
- import { componentResolver, directiveResolver } from "../utils/node/vuelessResolver.js";
13
-
14
- /* Automatically importing Vueless components on demand */
15
- export const VuelessUnpluginComponents = (options) =>
16
- UnpluginVueComponents({
17
- resolvers: [componentResolver, directiveResolver],
18
- dts: false,
19
- ...options,
20
- });
21
-
22
- /*
23
- – Creates tailwind colors safelist (collect only used on the project colors).
24
- – Collects SVG icons for build (UIcon bundle size optimization).
25
- – Loads SVG images as a Vue components.
26
- */
27
- export const Vueless = function (options = {}) {
28
- const { mode, debug, env, include } = options;
29
-
30
- const isNuxt = mode === "nuxt-module";
31
- const srcDir = isNuxt ? process.cwd() : getVueSourceFile();
32
-
33
- const targetFiles = [srcDir, ...(include || []), ...(isNuxt ? getNuxtFiles() : [])];
34
-
35
- /* if server stopped by developer (Ctrl+C) */
36
- process.on("SIGINT", async () => {
37
- /* remove dynamically copied icons */
38
- await removeIcons({ debug, isNuxt });
39
-
40
- /* clear tailwind safelist */
41
- clearTailwindSafelist(debug);
42
- process.exit(0);
43
- });
44
-
45
- return {
46
- name: "vite-plugin-vue-vueless",
47
- enforce: "pre",
48
-
49
- config: () => ({
50
- define: {
51
- "process.env": {},
52
- },
53
- optimizeDeps: {
54
- include: ["tailwindcss/colors.js"],
55
- },
56
- }),
57
-
58
- configResolved: async (config) => {
59
- /* collect used in project colors for tailwind safelist */
60
- if (!isNuxt) {
61
- await createTailwindSafelist({ mode, env, debug, targetFiles });
62
- }
63
-
64
- if (config.command === "build") {
65
- await removeIcons({ debug, isNuxt });
66
-
67
- /* dynamically copy used icons before build */
68
- await copyIcons({ mode: "vuelessIcons", env, debug, targetFiles });
69
- await copyIcons({ mode, env, debug, targetFiles, isNuxt });
70
- }
71
-
72
- if (config.command === "dev" || config.command === "serve") {
73
- /* remove dynamically copied icons on dev server start */
74
- await removeIcons(debug);
75
-
76
- /* add web-types config to the package.json */
77
- addWebTypesToPackageJson(env, debug);
78
- }
79
- },
80
-
81
- /* remove dynamically copied icons after build */
82
- buildEnd: async () => {
83
- await removeIcons({ debug, isNuxt });
84
- },
85
-
86
- /* load SVG images as a Vue components */
87
- load: async (id) => await loadSvg(id, options),
88
-
89
- handleHotUpdate: async ({ file, read }) => {
90
- if (!isNuxt && [".js", ".ts", ".vue"].some((ext) => file.endsWith(ext))) {
91
- const fileContent = await read();
92
-
93
- if (fileContent.includes("safelist:") || fileContent.includes("color=")) {
94
- /* collect used in project colors for tailwind safelist */
95
- await createTailwindSafelist({ mode, env, debug, targetFiles });
96
- }
97
- }
98
- },
99
- };
100
- };