svelte2tsx 0.6.20 → 0.6.22
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/index.js +17 -8
- package/index.mjs +17 -8
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1315,7 +1315,16 @@ function extractTag(htmlx, tag) {
|
|
|
1315
1315
|
return matches;
|
|
1316
1316
|
}
|
|
1317
1317
|
function findVerbatimElements(htmlx) {
|
|
1318
|
-
|
|
1318
|
+
const styleTags = extractTag(htmlx, 'style');
|
|
1319
|
+
const tags = extractTag(htmlx, 'script');
|
|
1320
|
+
for (const styleTag of styleTags) {
|
|
1321
|
+
// Could happen if someone has a `<style>...</style>` string in their script tag
|
|
1322
|
+
const insideScript = tags.some((tag) => tag.start < styleTag.start && tag.end > styleTag.end);
|
|
1323
|
+
if (!insideScript) {
|
|
1324
|
+
tags.push(styleTag);
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
return tags;
|
|
1319
1328
|
}
|
|
1320
1329
|
function blankVerbatimContent(htmlx, verbatimElements) {
|
|
1321
1330
|
let output = htmlx;
|
|
@@ -3752,6 +3761,7 @@ function upserKitRouteFile(ts, basename, getSource, surround) {
|
|
|
3752
3761
|
insertApiMethod('DELETE');
|
|
3753
3762
|
insertApiMethod('OPTIONS');
|
|
3754
3763
|
insertApiMethod('HEAD');
|
|
3764
|
+
insertApiMethod('fallback');
|
|
3755
3765
|
return { addedCode, originalText: source.getFullText() };
|
|
3756
3766
|
}
|
|
3757
3767
|
function upserKitParamsFile(ts, fileName, basename, paramsPath, getSource, surround) {
|
|
@@ -4233,17 +4243,16 @@ class ExportedNames {
|
|
|
4233
4243
|
// - The check if exports are assignable to $$Props is not done because a component should be allowed
|
|
4234
4244
|
// to use less props than defined (it just ignores them)
|
|
4235
4245
|
// - __sveltets_2_ensureRightProps needs to be declared in a way that doesn't affect the type result of props
|
|
4236
|
-
return ('{...__sveltets_2_ensureRightProps<{' +
|
|
4246
|
+
return ('{ ...__sveltets_2_ensureRightProps<{' +
|
|
4237
4247
|
this.createReturnElementsType(lets).join(',') +
|
|
4238
|
-
'}>(__sveltets_2_any("") as $$Props)
|
|
4239
|
-
'...{} as unknown as $$Props, ...{' +
|
|
4248
|
+
'}>(__sveltets_2_any("") as $$Props)} as ' +
|
|
4240
4249
|
// We add other exports of classes and functions here because
|
|
4241
4250
|
// they need to appear in the props object in order to properly
|
|
4242
4251
|
// type bind:xx but they are not needed to be part of $$Props
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
'
|
|
4252
|
+
(others.length
|
|
4253
|
+
? '{' + this.createReturnElementsType(others).join(',') + '} & '
|
|
4254
|
+
: '') +
|
|
4255
|
+
'$$Props');
|
|
4247
4256
|
}
|
|
4248
4257
|
if (names.length === 0 && !uses$$propsOr$$restProps) {
|
|
4249
4258
|
// Necessary, because {} roughly equals to any
|
package/index.mjs
CHANGED
|
@@ -1295,7 +1295,16 @@ function extractTag(htmlx, tag) {
|
|
|
1295
1295
|
return matches;
|
|
1296
1296
|
}
|
|
1297
1297
|
function findVerbatimElements(htmlx) {
|
|
1298
|
-
|
|
1298
|
+
const styleTags = extractTag(htmlx, 'style');
|
|
1299
|
+
const tags = extractTag(htmlx, 'script');
|
|
1300
|
+
for (const styleTag of styleTags) {
|
|
1301
|
+
// Could happen if someone has a `<style>...</style>` string in their script tag
|
|
1302
|
+
const insideScript = tags.some((tag) => tag.start < styleTag.start && tag.end > styleTag.end);
|
|
1303
|
+
if (!insideScript) {
|
|
1304
|
+
tags.push(styleTag);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
return tags;
|
|
1299
1308
|
}
|
|
1300
1309
|
function blankVerbatimContent(htmlx, verbatimElements) {
|
|
1301
1310
|
let output = htmlx;
|
|
@@ -3732,6 +3741,7 @@ function upserKitRouteFile(ts, basename, getSource, surround) {
|
|
|
3732
3741
|
insertApiMethod('DELETE');
|
|
3733
3742
|
insertApiMethod('OPTIONS');
|
|
3734
3743
|
insertApiMethod('HEAD');
|
|
3744
|
+
insertApiMethod('fallback');
|
|
3735
3745
|
return { addedCode, originalText: source.getFullText() };
|
|
3736
3746
|
}
|
|
3737
3747
|
function upserKitParamsFile(ts, fileName, basename, paramsPath, getSource, surround) {
|
|
@@ -4213,17 +4223,16 @@ class ExportedNames {
|
|
|
4213
4223
|
// - The check if exports are assignable to $$Props is not done because a component should be allowed
|
|
4214
4224
|
// to use less props than defined (it just ignores them)
|
|
4215
4225
|
// - __sveltets_2_ensureRightProps needs to be declared in a way that doesn't affect the type result of props
|
|
4216
|
-
return ('{...__sveltets_2_ensureRightProps<{' +
|
|
4226
|
+
return ('{ ...__sveltets_2_ensureRightProps<{' +
|
|
4217
4227
|
this.createReturnElementsType(lets).join(',') +
|
|
4218
|
-
'}>(__sveltets_2_any("") as $$Props)
|
|
4219
|
-
'...{} as unknown as $$Props, ...{' +
|
|
4228
|
+
'}>(__sveltets_2_any("") as $$Props)} as ' +
|
|
4220
4229
|
// We add other exports of classes and functions here because
|
|
4221
4230
|
// they need to appear in the props object in order to properly
|
|
4222
4231
|
// type bind:xx but they are not needed to be part of $$Props
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
'
|
|
4232
|
+
(others.length
|
|
4233
|
+
? '{' + this.createReturnElementsType(others).join(',') + '} & '
|
|
4234
|
+
: '') +
|
|
4235
|
+
'$$Props');
|
|
4227
4236
|
}
|
|
4228
4237
|
if (names.length === 0 && !uses$$propsOr$$restProps) {
|
|
4229
4238
|
// Necessary, because {} roughly equals to any
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte2tsx",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.22",
|
|
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": "~3.57.0",
|
|
41
41
|
"tiny-glob": "^0.2.6",
|
|
42
42
|
"tslib": "^2.4.0",
|
|
43
|
-
"typescript": "^5.
|
|
43
|
+
"typescript": "^5.2.2"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"svelte": "^3.55 || ^4.0.0-next.0 || ^4.0",
|