xatriumcss 1.0.5 → 1.0.6
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
CHANGED
package/src/collectClasses.js
CHANGED
|
@@ -3,10 +3,11 @@ const { glob } = require('glob');
|
|
|
3
3
|
|
|
4
4
|
let nativeScanner;
|
|
5
5
|
try {
|
|
6
|
-
nativeScanner = require('
|
|
6
|
+
nativeScanner = require('../index');
|
|
7
7
|
console.log("using native scanner")
|
|
8
8
|
} catch (e) {
|
|
9
9
|
console.log("using fallback scanner")
|
|
10
|
+
console.log("ERROR:", e.message);
|
|
10
11
|
nativeScanner = null;
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -133,35 +134,34 @@ function collectClasses(contentPaths) {
|
|
|
133
134
|
});
|
|
134
135
|
});
|
|
135
136
|
|
|
136
|
-
console.log('🚀 Using native scanner (Rust)
|
|
137
|
+
console.log('🚀 Using native scanner (Rust) for file discovery');
|
|
138
|
+
console.log('📋 Patterns:', pathsArray);
|
|
137
139
|
|
|
138
140
|
// Create scanner with options
|
|
139
|
-
|
|
141
|
+
let scanner;
|
|
142
|
+
try {
|
|
143
|
+
scanner = new nativeScanner.Scanner({ sources });
|
|
144
|
+
} catch (error) {
|
|
145
|
+
console.warn('⚠️ Native scanner failed, falling back to JS:', error.message);
|
|
146
|
+
}
|
|
140
147
|
|
|
141
|
-
// Get the files that were
|
|
148
|
+
// Get the files that were matched by the scanner
|
|
142
149
|
const files = scanner.files;
|
|
143
150
|
|
|
151
|
+
if (!files || files.length === 0) {
|
|
152
|
+
console.warn('⚠️ Native scanner found no files');
|
|
153
|
+
throw new Error('No files found');
|
|
154
|
+
}
|
|
155
|
+
|
|
144
156
|
console.log(`📄 Native scanner found ${files.length} files`);
|
|
145
157
|
|
|
146
158
|
// Read files and extract quoted strings manually to preserve grouping
|
|
147
|
-
const quotedStrings =
|
|
148
|
-
files.forEach(filePath => {
|
|
149
|
-
try {
|
|
150
|
-
const fileContent = fs.readFileSync(filePath, 'utf8');
|
|
151
|
-
// Extract strings inside quotes (single, double, or backticks)
|
|
152
|
-
const matches = fileContent.matchAll(/(['"`])(.*?)\1/gs);
|
|
153
|
-
for (const match of matches) {
|
|
154
|
-
quotedStrings.push(match[2]);
|
|
155
|
-
}
|
|
156
|
-
} catch (err) {
|
|
157
|
-
console.warn(`⚠️ Error reading file ${filePath}:`, err.message);
|
|
158
|
-
}
|
|
159
|
-
});
|
|
159
|
+
const quotedStrings = scanner.scan(); // Rust does EVERYTHING!
|
|
160
160
|
|
|
161
|
-
console.log(`✅
|
|
161
|
+
console.log(`✅ Extracted ${quotedStrings.length} quoted strings from files`);
|
|
162
162
|
return processClasses(quotedStrings);
|
|
163
163
|
} catch (error) {
|
|
164
|
-
console.warn('⚠️ Native scanner failed, falling back:', error.message);
|
|
164
|
+
console.warn('⚠️ Native scanner failed, falling back to JS:', error.message);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
package/src/parser.js
CHANGED
|
@@ -25743,7 +25743,7 @@ function runParser(config) {
|
|
|
25743
25743
|
isFirstRun = true;
|
|
25744
25744
|
previouslyParsedClasses = [];
|
|
25745
25745
|
previouslyGeneratedProps.clear();
|
|
25746
|
-
const fullResult = generateCSSString(collectClasses(), false, isFirstRun);
|
|
25746
|
+
const fullResult = generateCSSString(collectClasses(config.content), false, isFirstRun);
|
|
25747
25747
|
const finalCSS = removeNewlines(fullResult.css); // ← Use fullResult, not result
|
|
25748
25748
|
fs.writeFileSync(outputPath, finalCSS, 'utf8');
|
|
25749
25749
|
isFirstRun = false; // ← Reset the flag after rebuild
|
|
Binary file
|
|
Binary file
|
|
Binary file
|