@astrojs/language-server 2.0.14 → 2.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/dist/core/utils.js +9 -1
- package/package.json +1 -1
package/dist/core/utils.js
CHANGED
|
@@ -134,7 +134,15 @@ exports.classNameFromFilename = classNameFromFilename;
|
|
|
134
134
|
function patchTSX(code, fileName) {
|
|
135
135
|
const basename = path.basename(fileName, path.extname(fileName));
|
|
136
136
|
const isDynamic = basename.startsWith('[') && basename.endsWith(']');
|
|
137
|
-
return code.replace(/\b(\S*)__AstroComponent_
|
|
137
|
+
return code.replace(/\b(\S*)__AstroComponent_/gm, (fullMatch, m1) => {
|
|
138
|
+
// If we don't have a match here, it usually means the file has a weird name that couldn't be expressed with valid identifier characters
|
|
139
|
+
if (!m1) {
|
|
140
|
+
if (basename === '404')
|
|
141
|
+
return 'FourOhFour';
|
|
142
|
+
return fullMatch;
|
|
143
|
+
}
|
|
144
|
+
return isDynamic ? `_${m1}_` : m1[0].toUpperCase() + m1.slice(1);
|
|
145
|
+
});
|
|
138
146
|
}
|
|
139
147
|
exports.patchTSX = patchTSX;
|
|
140
148
|
//# sourceMappingURL=utils.js.map
|