@plumeria/compiler 0.18.0 → 0.18.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 +13 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46,15 +46,16 @@ else {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
let coreFilePath;
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
coreFilePath = path.join(
|
|
49
|
+
try {
|
|
50
|
+
const corePackageJsonPath = require.resolve('@plumeria/core/package.json', {
|
|
51
|
+
paths: [projectRoot, process.cwd()],
|
|
52
|
+
});
|
|
53
|
+
coreFilePath = path.join(path.dirname(corePackageJsonPath), 'stylesheet.css');
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
catch (error) {
|
|
56
|
+
console.error('Could not find "@plumeria/core/stylesheet.css". Please make sure it is installed.' +
|
|
57
|
+
error);
|
|
58
|
+
process.exit(1);
|
|
58
59
|
}
|
|
59
60
|
const cleanUp = async () => {
|
|
60
61
|
if (process.env.CI && existsSync(coreFilePath)) {
|
|
@@ -68,7 +69,7 @@ const cleanUp = async () => {
|
|
|
68
69
|
console.error('An error occurred:', err);
|
|
69
70
|
}
|
|
70
71
|
};
|
|
71
|
-
function isCSS(filePath
|
|
72
|
+
function isCSS(filePath) {
|
|
72
73
|
if (statSync(filePath).isDirectory()) {
|
|
73
74
|
return false;
|
|
74
75
|
}
|
|
@@ -83,13 +84,7 @@ function isCSS(filePath, target) {
|
|
|
83
84
|
function visit(node) {
|
|
84
85
|
if (node.type === 'MemberExpression' && node.property?.value) {
|
|
85
86
|
if (node.object?.type === 'Identifier' && node.object.value === 'css') {
|
|
86
|
-
if (
|
|
87
|
-
if (node.property.value === 'props') {
|
|
88
|
-
found = true;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
else if (node.property.value === 'props' ||
|
|
92
|
-
node.property.value === 'global') {
|
|
87
|
+
if (node.property.value === 'props') {
|
|
93
88
|
found = true;
|
|
94
89
|
}
|
|
95
90
|
}
|
|
@@ -153,11 +148,8 @@ async function optimizeCSS() {
|
|
|
153
148
|
}
|
|
154
149
|
}
|
|
155
150
|
const styleFiles = filesSupportExtensions
|
|
156
|
-
.filter((file) => isCSS(file
|
|
151
|
+
.filter((file) => isCSS(file))
|
|
157
152
|
.sort();
|
|
158
|
-
const propsFiles = styleFiles.filter((file) => {
|
|
159
|
-
return isCSS(file, 'props');
|
|
160
|
-
});
|
|
161
153
|
for (let i = 0; i < styleFiles.length; i++) {
|
|
162
154
|
await execute(path.resolve(styleFiles[i]));
|
|
163
155
|
if (process.argv.includes('--paths'))
|
|
@@ -166,7 +158,7 @@ async function optimizeCSS() {
|
|
|
166
158
|
for (let i = 0; i < styleFiles.length; i++) {
|
|
167
159
|
await buildGlobal(coreFilePath);
|
|
168
160
|
}
|
|
169
|
-
for (let i = 0; i <
|
|
161
|
+
for (let i = 0; i < styleFiles.length; i++) {
|
|
170
162
|
await buildProps(coreFilePath);
|
|
171
163
|
}
|
|
172
164
|
await optimizeCSS();
|