svelte2tsx 0.7.27 → 0.7.28

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.
Files changed (3) hide show
  1. package/index.js +8 -3
  2. package/index.mjs +8 -3
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -6178,15 +6178,20 @@ class HoistableInterfaces {
6178
6178
  if (hoistable.has(this.props_interface.name)) {
6179
6179
  for (const [name, node] of hoistable) {
6180
6180
  let pos = node.pos + astOffset;
6181
- // node.pos includes preceeding whitespace, which could mean we accidentally also move stuff appended to a previous node
6182
- if (name !== '$$ComponentProps') {
6181
+ if (name === '$$ComponentProps') {
6182
+ // So that organize imports doesn't mess with the types
6183
+ str.prependRight(pos, '\n');
6184
+ }
6185
+ else {
6186
+ // node.pos includes preceeding whitespace, which could mean we accidentally also move stuff appended to a previous node
6183
6187
  if (str.original[pos] === '\r') {
6184
6188
  pos++;
6185
6189
  }
6186
6190
  if (/\s/.test(str.original[pos])) {
6187
6191
  pos++;
6188
6192
  }
6189
- // jsdoc comments would be ignored if they are on the same line as the ;, so we add a newline, too
6193
+ // jsdoc comments would be ignored if they are on the same line as the ;, so we add a newline, too.
6194
+ // Also helps with organize imports not messing with the types
6190
6195
  str.prependRight(pos, ';\n');
6191
6196
  str.appendLeft(node.end + astOffset, ';');
6192
6197
  }
package/index.mjs CHANGED
@@ -6158,15 +6158,20 @@ class HoistableInterfaces {
6158
6158
  if (hoistable.has(this.props_interface.name)) {
6159
6159
  for (const [name, node] of hoistable) {
6160
6160
  let pos = node.pos + astOffset;
6161
- // node.pos includes preceeding whitespace, which could mean we accidentally also move stuff appended to a previous node
6162
- if (name !== '$$ComponentProps') {
6161
+ if (name === '$$ComponentProps') {
6162
+ // So that organize imports doesn't mess with the types
6163
+ str.prependRight(pos, '\n');
6164
+ }
6165
+ else {
6166
+ // node.pos includes preceeding whitespace, which could mean we accidentally also move stuff appended to a previous node
6163
6167
  if (str.original[pos] === '\r') {
6164
6168
  pos++;
6165
6169
  }
6166
6170
  if (/\s/.test(str.original[pos])) {
6167
6171
  pos++;
6168
6172
  }
6169
- // jsdoc comments would be ignored if they are on the same line as the ;, so we add a newline, too
6173
+ // jsdoc comments would be ignored if they are on the same line as the ;, so we add a newline, too.
6174
+ // Also helps with organize imports not messing with the types
6170
6175
  str.prependRight(pos, ';\n');
6171
6176
  str.appendLeft(node.end + astOffset, ';');
6172
6177
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte2tsx",
3
- "version": "0.7.27",
3
+ "version": "0.7.28",
4
4
  "description": "Convert Svelte components to TSX for type checking",
5
5
  "author": "David Pershouse",
6
6
  "license": "MIT",
@@ -40,7 +40,7 @@
40
40
  "svelte": "~4.2.19",
41
41
  "tiny-glob": "^0.2.6",
42
42
  "tslib": "^2.4.0",
43
- "typescript": "^5.6.3"
43
+ "typescript": "~5.6.3"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "svelte": "^3.55 || ^4.0.0-next.0 || ^4.0 || ^5.0.0-next.0",