@bobfrankston/extractids 1.0.14 → 1.0.15
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/.claude/settings.local.json +2 -1
- package/index.js +13 -1
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -80,7 +80,14 @@ function updateTypesFile(specifiedHtmlFile) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
const html = fs.readFileSync(htmlFile, 'utf8');
|
|
83
|
+
if (!html || html.length < 10) {
|
|
84
|
+
console.error(`[extractids] WARNING: ${htmlFile} read returned ${html.length} bytes — possible transient read failure, skipping update`);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
83
87
|
const ids = getHtmlIDs(html);
|
|
88
|
+
if (ids.length === 0) {
|
|
89
|
+
console.warn(`[extractids] WARNING: No IDs found in ${htmlFile} (${html.length} bytes) — check file content`);
|
|
90
|
+
}
|
|
84
91
|
const cssFiles = globReadCssFiles();
|
|
85
92
|
const allClasses = new Set();
|
|
86
93
|
cssFiles.forEach(file => {
|
|
@@ -128,8 +135,12 @@ if (watchMode) {
|
|
|
128
135
|
const htmlFilesToWatch = specifiedHtmlFile
|
|
129
136
|
? [specifiedHtmlFile]
|
|
130
137
|
: ['index.html', 'default.html', 'default.htm'];
|
|
138
|
+
let debounceTimer;
|
|
131
139
|
const watcher = chokidar.watch([...htmlFilesToWatch, '**/*.css'], { ignored: /node_modules/ });
|
|
132
|
-
watcher.on('change', () =>
|
|
140
|
+
watcher.on('change', () => {
|
|
141
|
+
clearTimeout(debounceTimer);
|
|
142
|
+
debounceTimer = setTimeout(() => updateTypesFile(specifiedHtmlFile), 100);
|
|
143
|
+
});
|
|
133
144
|
watcher.on('ready', () => {
|
|
134
145
|
console.log('[extractids] Watcher is ready and running.');
|
|
135
146
|
});
|
|
@@ -141,3 +152,4 @@ if (watchMode) {
|
|
|
141
152
|
else {
|
|
142
153
|
updateTypesFile(specifiedHtmlFile);
|
|
143
154
|
}
|
|
155
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/extractids",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "Extracd html and css as types",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
},
|
|
9
9
|
"module": "main.js",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
|
+
"release": "npmglobalize"
|
|
12
13
|
},
|
|
13
14
|
"keywords": [],
|
|
14
15
|
"author": "Bob Frankston",
|