@plumeria/vite-plugin 0.16.1 → 0.16.2
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/dist/index.js +19 -3
- package/package.json +2 -3
- package/zero-virtual.css +0 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { parseSync, traverse, transformFromAstSync, } from '@babel/core';
|
|
|
2
2
|
import * as t from '@babel/types';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import fs from 'fs';
|
|
5
|
-
import { createCSS, createTheme, createVars } from './create';
|
|
5
|
+
import { createCSS, createTheme, createVars } from './create.js';
|
|
6
6
|
import { genBase36Hash, transpile, camelToKebabCase } from 'zss-engine';
|
|
7
7
|
import { globSync } from '@rust-gear/glob';
|
|
8
8
|
const PROJECT_ROOT = process.cwd().split('node_modules')[0];
|
|
@@ -466,7 +466,7 @@ function scanForDefineTheme() {
|
|
|
466
466
|
export function plumeria() {
|
|
467
467
|
const stylesByFile = new Map();
|
|
468
468
|
let hasScanned = false;
|
|
469
|
-
const outputPath = path.join(
|
|
469
|
+
const outputPath = path.join(PROJECT_ROOT, 'zero-virtual.css');
|
|
470
470
|
return {
|
|
471
471
|
name: 'plumeria-vite-plugin',
|
|
472
472
|
config: ({ build = {} }) => ({
|
|
@@ -627,8 +627,11 @@ export function plumeria() {
|
|
|
627
627
|
.filter(Boolean)
|
|
628
628
|
.join('\n');
|
|
629
629
|
fs.writeFileSync(outputPath, css);
|
|
630
|
+
const importStatement = fs.existsSync(outputPath)
|
|
631
|
+
? `import '${outputPath}';`
|
|
632
|
+
: '// zero-virtual.css not found';
|
|
630
633
|
return {
|
|
631
|
-
code: `${source}\
|
|
634
|
+
code: `${source}\n${importStatement}`,
|
|
632
635
|
map: null,
|
|
633
636
|
};
|
|
634
637
|
}
|
|
@@ -653,6 +656,19 @@ export function plumeria() {
|
|
|
653
656
|
}
|
|
654
657
|
}
|
|
655
658
|
});
|
|
659
|
+
const cleanup = () => {
|
|
660
|
+
if (fs.existsSync(outputPath)) {
|
|
661
|
+
try {
|
|
662
|
+
fs.unlinkSync(outputPath);
|
|
663
|
+
}
|
|
664
|
+
catch (error) {
|
|
665
|
+
error;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
process.exit(0);
|
|
669
|
+
};
|
|
670
|
+
process.on('SIGINT', cleanup);
|
|
671
|
+
process.on('SIGTERM', cleanup);
|
|
656
672
|
server.watcher.on('unlink', (filePath) => {
|
|
657
673
|
stylesByFile.delete(filePath);
|
|
658
674
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/vite-plugin",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Plumeria Vite plugin",
|
|
6
6
|
"repository": {
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"types": "dist/index.d.ts",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"files": [
|
|
15
|
-
"dist/"
|
|
16
|
-
"zero-virtual.css"
|
|
15
|
+
"dist/"
|
|
17
16
|
],
|
|
18
17
|
"dependencies": {
|
|
19
18
|
"@babel/core": "^7.28.0",
|
package/zero-virtual.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/** Placeholder file */
|