@kiva/kv-components 5.3.7 → 6.1.0
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/package.json +4 -3
- package/build/libCss.js +0 -59
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@babel/preset-react": "^7.24.7",
|
|
20
20
|
"@babel/preset-typescript": "^7.24.7",
|
|
21
21
|
"@kiva/kv-tokens": "^3.1.0",
|
|
22
|
+
"@kiva/vite-plugin-vue-lib-css": "^2.0.0",
|
|
22
23
|
"@laynezh/vite-plugin-lib-assets": "^0.6.1",
|
|
23
24
|
"@mdi/js": "^7.4.47",
|
|
24
25
|
"@storybook/addon-a11y": "^8.4.7",
|
|
@@ -99,12 +100,12 @@
|
|
|
99
100
|
"numeral": "2.x",
|
|
100
101
|
"vue": "3.x"
|
|
101
102
|
},
|
|
102
|
-
"
|
|
103
|
+
"bundleDependencies": [
|
|
103
104
|
"aria-hidden",
|
|
104
105
|
"embla-carousel",
|
|
105
106
|
"embla-carousel-autoplay",
|
|
106
107
|
"embla-carousel-fade",
|
|
107
108
|
"popper.js"
|
|
108
109
|
],
|
|
109
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "397ce45807789b5d40169cd1c84531c9a75d0e00"
|
|
110
111
|
}
|
package/build/libCss.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { writeFileSync } from 'node:fs';
|
|
2
|
-
import {
|
|
3
|
-
basename,
|
|
4
|
-
dirname,
|
|
5
|
-
relative,
|
|
6
|
-
resolve,
|
|
7
|
-
} from 'node:path';
|
|
8
|
-
|
|
9
|
-
let viteConfig;
|
|
10
|
-
|
|
11
|
-
export default function libCss() {
|
|
12
|
-
return {
|
|
13
|
-
name: 'lib-css',
|
|
14
|
-
apply: 'build',
|
|
15
|
-
enforce: 'post',
|
|
16
|
-
|
|
17
|
-
// Get Vite config when it's resolved to use later
|
|
18
|
-
configResolved(config) {
|
|
19
|
-
viteConfig = config;
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
// Write css import statements to files with imported css after bundle is created
|
|
23
|
-
writeBundle(option, bundle) {
|
|
24
|
-
// Only run for es format in library mode
|
|
25
|
-
if (!viteConfig.build?.lib || option.format !== 'es') {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const { root } = viteConfig;
|
|
30
|
-
const { outDir } = viteConfig.build;
|
|
31
|
-
const cssReplaceRegex = /\/\* empty css \s*\*\//;
|
|
32
|
-
const files = Object.keys(bundle);
|
|
33
|
-
|
|
34
|
-
// Find files with imported css
|
|
35
|
-
const filesWithImportedCss = files.filter((file) => bundle[file].viteMetadata?.importedCss?.size > 0);
|
|
36
|
-
|
|
37
|
-
// Replace empty css comment with css import statement in each file
|
|
38
|
-
filesWithImportedCss.forEach((file) => {
|
|
39
|
-
if (bundle[file].viteMetadata.importedCss.size > 1) {
|
|
40
|
-
console.warn(`Multiple css file imports not supported yet, skipping ${file}`);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Get css import path relative to current file
|
|
45
|
-
const [cssPath] = bundle[file].viteMetadata.importedCss;
|
|
46
|
-
const cssImportPath = relative(dirname(file), cssPath);
|
|
47
|
-
|
|
48
|
-
// Add prefix for current directory to css import path if necessary
|
|
49
|
-
const prefix = cssImportPath === basename(cssPath) ? './' : '';
|
|
50
|
-
|
|
51
|
-
// Replace empty css comment with css import statement
|
|
52
|
-
const fileContent = bundle[file].code.replace(cssReplaceRegex, `import "${prefix}${cssImportPath}";`);
|
|
53
|
-
|
|
54
|
-
// Write updated file content
|
|
55
|
-
writeFileSync(resolve(root, outDir, file), fileContent);
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
}
|