typescript-svelte-plugin 0.3.31 → 0.3.32
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.
|
@@ -420,6 +420,7 @@ exports.kitExports = {
|
|
|
420
420
|
DELETE: createApiExport('DELETE'),
|
|
421
421
|
OPTIONS: createApiExport('OPTIONS'),
|
|
422
422
|
HEAD: createApiExport('HEAD'),
|
|
423
|
+
fallback: createApiExport('fallback'),
|
|
423
424
|
// param matching
|
|
424
425
|
match: {
|
|
425
426
|
allowedIn: [],
|
|
@@ -471,6 +472,7 @@ exports.kitExports = {
|
|
|
471
472
|
]
|
|
472
473
|
}
|
|
473
474
|
};
|
|
475
|
+
const FORCE_UPDATE_VERSION = 'FORCE_UPDATE_VERSION';
|
|
474
476
|
function isKitRouteExportAllowedIn(basename, kitExport) {
|
|
475
477
|
if (!basename.startsWith('+')) {
|
|
476
478
|
return false;
|
|
@@ -597,9 +599,10 @@ function getProxiedLanguageService(info, ts, logger) {
|
|
|
597
599
|
return [...names];
|
|
598
600
|
}
|
|
599
601
|
getKitScriptSnapshotIfUpToDate(fileName) {
|
|
602
|
+
const scriptVersion = this.getScriptVersion(fileName);
|
|
600
603
|
if (!this.files[fileName] ||
|
|
601
|
-
|
|
602
|
-
|
|
604
|
+
(scriptVersion !== originalLanguageServiceHost.getScriptVersion(fileName) &&
|
|
605
|
+
scriptVersion !== FORCE_UPDATE_VERSION)) {
|
|
603
606
|
return undefined;
|
|
604
607
|
}
|
|
605
608
|
return this.files[fileName];
|
|
@@ -616,8 +619,14 @@ function getProxiedLanguageService(info, ts, logger) {
|
|
|
616
619
|
const { text, addedCode } = result;
|
|
617
620
|
const snap = ts.ScriptSnapshot.fromString(text);
|
|
618
621
|
snap.getChangeRange = (_) => undefined;
|
|
622
|
+
// If this is a new file, typescript might have cached the unpatched version
|
|
623
|
+
// It won't update even if we return the patched version in getScriptSnapshot, so we force an update
|
|
624
|
+
// This should only happen to files that are opened by the client after the first compilation of the proxy language service
|
|
625
|
+
// and won't happen if there are any updates to the file afterwards
|
|
619
626
|
this.files[fileName] = {
|
|
620
|
-
version:
|
|
627
|
+
version: this.files[fileName] === undefined
|
|
628
|
+
? FORCE_UPDATE_VERSION
|
|
629
|
+
: originalLanguageServiceHost.getScriptVersion(fileName),
|
|
621
630
|
file: snap,
|
|
622
631
|
addedCode
|
|
623
632
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typescript-svelte-plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.32",
|
|
4
4
|
"description": "A TypeScript Plugin providing Svelte intellisense",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -12,9 +12,8 @@
|
|
|
12
12
|
"author": "The Svelte Community",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@tsconfig/node16": "^1.0.0",
|
|
16
15
|
"@types/node": "^16.0.0",
|
|
17
|
-
"typescript": "
|
|
16
|
+
"typescript": "^5.2.2"
|
|
18
17
|
},
|
|
19
18
|
"dependencies": {
|
|
20
19
|
"@jridgewell/sourcemap-codec": "^1.4.14",
|