vueless 0.0.478-beta.21 → 0.0.478-beta.23
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.
package/constants.js
CHANGED
|
@@ -191,5 +191,4 @@ export const NESTED_COMPONENT_REG_EXP = /\{U[^}]*}/g;
|
|
|
191
191
|
export const DYNAMIC_COLOR_PATTERN = "{color}";
|
|
192
192
|
export const TAILWIND_CLASS_DELIMITER = ":";
|
|
193
193
|
export const CACHE_PATH = "node_modules/.cache/vueless";
|
|
194
|
-
export const WEB_TYPES_FILE_NAME_WITH_EXT = "web-types.json";
|
|
195
194
|
export const VUELESS_CONFIG_FILE_NAME = "vueless.config";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "0.0.478-beta.
|
|
3
|
+
"version": "0.0.478-beta.23",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,12 +27,13 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
|
-
"
|
|
31
|
-
"dev": "
|
|
32
|
-
"
|
|
30
|
+
"pre:start": "npx @vueless/web-types && node .scripts/icons",
|
|
31
|
+
"dev:docs": "npm run pre:start && storybook dev -p 6006 --docs --no-open",
|
|
32
|
+
"dev": "npm run pre:start && STORYBOOK_FULL=1 storybook dev -p 6006 --no-open",
|
|
33
|
+
"build": "npm run pre:start && storybook build --docs",
|
|
33
34
|
"preview": "vite preview --host --outDir=storybook-static",
|
|
34
35
|
"ts:check": "vue-tsc --build --force",
|
|
35
|
-
"release:prepare": "
|
|
36
|
+
"release:prepare": "npm run pre:start && rm -rf dist && mkdir -p dist && cp -r src/. package.json LICENSE README.md node_modules/.cache/vueless/web-types.json dist/ && node .scripts/package",
|
|
36
37
|
"release:beta": "release-it --ci --npm.publish --preRelease=beta --increment=prerelease",
|
|
37
38
|
"release:patch": "release-it patch --ci --npm.publish",
|
|
38
39
|
"release:minor": "release-it minor --ci --npm.publish --git.tag --github.release",
|
|
@@ -8,7 +8,7 @@ import UnpluginVueComponents from "unplugin-vue-components/vite";
|
|
|
8
8
|
import { loadSvg } from "./utils/node/loaderSvg.js";
|
|
9
9
|
import { copyIcons, removeIcons } from "./utils/node/loaderIcon.js";
|
|
10
10
|
import { createTailwindSafelist, clearTailwindSafelist } from "./utils/node/tailwindSafelist.js";
|
|
11
|
-
import {
|
|
11
|
+
import { getNuxtFiles, getVueSourceFile } from "./utils/node/helper.js";
|
|
12
12
|
import { componentResolver, directiveResolver } from "./utils/node/vuelessResolver.js";
|
|
13
13
|
|
|
14
14
|
/* Automatically importing Vueless components on demand */
|
|
@@ -25,7 +25,7 @@ export const VuelessUnpluginComponents = (options) =>
|
|
|
25
25
|
– Loads SVG images as a Vue components.
|
|
26
26
|
*/
|
|
27
27
|
export const Vueless = function (options = {}) {
|
|
28
|
-
const { mode, debug, env, include
|
|
28
|
+
const { mode, debug, env, include } = options;
|
|
29
29
|
|
|
30
30
|
const isNuxt = mode === "nuxt-module";
|
|
31
31
|
const srcDir = isNuxt ? process.cwd() : getVueSourceFile();
|
|
@@ -72,9 +72,6 @@ export const Vueless = function (options = {}) {
|
|
|
72
72
|
if (config.command === "dev" || config.command === "serve") {
|
|
73
73
|
/* remove dynamically copied icons on dev server start */
|
|
74
74
|
await removeIcons({ debug, isNuxt });
|
|
75
|
-
|
|
76
|
-
/* add web-types config to the package.json */
|
|
77
|
-
addWebTypesToPackageJson({ env, debug, noWebTypesInPackageJson });
|
|
78
75
|
}
|
|
79
76
|
},
|
|
80
77
|
|
|
@@ -87,7 +84,7 @@ export const Vueless = function (options = {}) {
|
|
|
87
84
|
load: async (id) => await loadSvg(id, options),
|
|
88
85
|
|
|
89
86
|
handleHotUpdate: async ({ file, read }) => {
|
|
90
|
-
if (!isNuxt && [".js", ".ts", ".vue"].some((ext) => file.endsWith(ext))) {
|
|
87
|
+
if (!isNuxt && [".js", ".jsx", ".ts", ".tsx", ".vue"].some((ext) => file.endsWith(ext))) {
|
|
91
88
|
const fileContent = await read();
|
|
92
89
|
|
|
93
90
|
if (fileContent.includes("safelist:") || fileContent.includes("color=")) {
|
package/utils/node/helper.js
CHANGED
|
@@ -1,35 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import
|
|
2
|
+
import { statSync } from "fs";
|
|
3
3
|
import { readdir } from "node:fs/promises";
|
|
4
|
-
import { CACHE_PATH, WEB_TYPES_FILE_NAME_WITH_EXT } from "../../constants.js";
|
|
5
|
-
|
|
6
|
-
export function addWebTypesToPackageJson({ env, debug, noWebTypesInPackageJson } = {}) {
|
|
7
|
-
if (env === "vueless" || noWebTypesInPackageJson) return;
|
|
8
|
-
|
|
9
|
-
const projectWebTypesPath = path.join(process.cwd(), CACHE_PATH, WEB_TYPES_FILE_NAME_WITH_EXT);
|
|
10
|
-
|
|
11
|
-
const webTypesPath = fs.existsSync(projectWebTypesPath)
|
|
12
|
-
? `./${CACHE_PATH}/${WEB_TYPES_FILE_NAME_WITH_EXT}`
|
|
13
|
-
: `./node_modules/vueless/${WEB_TYPES_FILE_NAME_WITH_EXT}`;
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
const packageJsonPath = path.resolve(process.cwd(), "package.json");
|
|
17
|
-
const data = fs.readFileSync(packageJsonPath, "utf8");
|
|
18
|
-
let packageJson = JSON.parse(data);
|
|
19
|
-
|
|
20
|
-
packageJson["web-types"] = webTypesPath;
|
|
21
|
-
|
|
22
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n", "utf8");
|
|
23
|
-
|
|
24
|
-
if (debug) {
|
|
25
|
-
// eslint-disable-next-line no-console
|
|
26
|
-
console.error("Web-types added to project package.json", webTypesPath);
|
|
27
|
-
}
|
|
28
|
-
} catch (error) {
|
|
29
|
-
// eslint-disable-next-line no-console
|
|
30
|
-
console.error("Error:", error);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
4
|
|
|
34
5
|
export async function getDirFiles(dirPath, ext, { recursive = true, exclude = [] } = {}) {
|
|
35
6
|
let fileNames = [];
|
package/utils/storybook.ts
CHANGED
|
@@ -41,7 +41,18 @@ const [webTypes]: WebTypes[] = Object.values(
|
|
|
41
41
|
);
|
|
42
42
|
|
|
43
43
|
const getComponentData = (componentName: ComponentNames) => {
|
|
44
|
-
|
|
44
|
+
const component = webTypes?.contributions?.html?.tags?.find(
|
|
45
|
+
(item: Tag) => item.name === componentName,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
if (!component) {
|
|
49
|
+
// eslint-disable-next-line no-console
|
|
50
|
+
console.warn(
|
|
51
|
+
"The component docs data is missing. Probably the `web-types.json` file is missing or have incorrect format.",
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return component;
|
|
45
56
|
};
|
|
46
57
|
|
|
47
58
|
export function getSlotNames(componentName: string | undefined) {
|
package/web-types.json
CHANGED
|
File without changes
|
|
File without changes
|