@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.
@@ -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_/, (_, m1) => isDynamic ? `_${m1}_` : m1[0].toUpperCase() + m1.slice(1));
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/language-server",
3
- "version": "2.0.14",
3
+ "version": "2.0.15",
4
4
  "author": "withastro",
5
5
  "license": "MIT",
6
6
  "repository": {