@vitemcp/server 1.6.3 → 1.6.4

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/ViteMCP.cjs CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
 
14
14
 
15
- var _chunkUTQ425O2cjs = require('./chunk-UTQ425O2.cjs');
15
+ var _chunk252JIXOLcjs = require('./chunk-252JIXOL.cjs');
16
16
 
17
17
  // src/ViteMCP.ts
18
18
 
@@ -1352,5 +1352,5 @@ var normalizeToolResult = (result, hasOutputSchema) => {
1352
1352
 
1353
1353
 
1354
1354
 
1355
- exports.AuthProvider = _chunkUTQ425O2cjs.AuthProvider; exports.AzureProvider = _chunkUTQ425O2cjs.AzureProvider; exports.DiscoveryDocumentCache = DiscoveryDocumentCache; exports.GitHubProvider = _chunkUTQ425O2cjs.GitHubProvider; exports.GoogleProvider = _chunkUTQ425O2cjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkUTQ425O2cjs.OAuthProvider; exports.OAuthProxy = _chunkUTQ425O2cjs.OAuthProxy; exports.OAuthProxyError = _chunkUTQ425O2cjs.OAuthProxyError; exports.ServerState = ServerState; exports.UnexpectedStateError = UnexpectedStateError; exports.UserError = UserError; exports.ViteMCP = ViteMCP; exports.ViteMCPError = ViteMCPError; exports.audioContent = audioContent; exports.delay = _promises3.setTimeout; exports.getAuthSession = _chunkUTQ425O2cjs.getAuthSession; exports.imageContent = imageContent; exports.jsonSchemaAdapter = jsonSchemaAdapter; exports.requireAll = _chunkUTQ425O2cjs.requireAll; exports.requireAny = _chunkUTQ425O2cjs.requireAny; exports.requireAuth = _chunkUTQ425O2cjs.requireAuth; exports.requireRole = _chunkUTQ425O2cjs.requireRole; exports.requireScopes = _chunkUTQ425O2cjs.requireScopes;
1355
+ exports.AuthProvider = _chunk252JIXOLcjs.AuthProvider; exports.AzureProvider = _chunk252JIXOLcjs.AzureProvider; exports.DiscoveryDocumentCache = DiscoveryDocumentCache; exports.GitHubProvider = _chunk252JIXOLcjs.GitHubProvider; exports.GoogleProvider = _chunk252JIXOLcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunk252JIXOLcjs.OAuthProvider; exports.OAuthProxy = _chunk252JIXOLcjs.OAuthProxy; exports.OAuthProxyError = _chunk252JIXOLcjs.OAuthProxyError; exports.ServerState = ServerState; exports.UnexpectedStateError = UnexpectedStateError; exports.UserError = UserError; exports.ViteMCP = ViteMCP; exports.ViteMCPError = ViteMCPError; exports.audioContent = audioContent; exports.delay = _promises3.setTimeout; exports.getAuthSession = _chunk252JIXOLcjs.getAuthSession; exports.imageContent = imageContent; exports.jsonSchemaAdapter = jsonSchemaAdapter; exports.requireAll = _chunk252JIXOLcjs.requireAll; exports.requireAny = _chunk252JIXOLcjs.requireAny; exports.requireAuth = _chunk252JIXOLcjs.requireAuth; exports.requireRole = _chunk252JIXOLcjs.requireRole; exports.requireScopes = _chunk252JIXOLcjs.requireScopes;
1356
1356
  //# sourceMappingURL=ViteMCP.cjs.map
package/dist/ViteMCP.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  requireAuth,
13
13
  requireRole,
14
14
  requireScopes
15
- } from "./chunk-INI5RROX.js";
15
+ } from "./chunk-J2FAZRSL.js";
16
16
 
17
17
  // src/ViteMCP.ts
18
18
  import {
@@ -24,7 +24,7 @@
24
24
 
25
25
 
26
26
 
27
- var _chunkUTQ425O2cjs = require('../chunk-UTQ425O2.cjs');
27
+ var _chunk252JIXOLcjs = require('../chunk-252JIXOL.cjs');
28
28
 
29
29
 
30
30
 
@@ -51,5 +51,5 @@ var _chunkUTQ425O2cjs = require('../chunk-UTQ425O2.cjs');
51
51
 
52
52
 
53
53
 
54
- exports.AuthProvider = _chunkUTQ425O2cjs.AuthProvider; exports.AzureProvider = _chunkUTQ425O2cjs.AzureProvider; exports.ConsentManager = _chunkUTQ425O2cjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkUTQ425O2cjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkUTQ425O2cjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkUTQ425O2cjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkUTQ425O2cjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkUTQ425O2cjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkUTQ425O2cjs.DiskStore; exports.EncryptedTokenStorage = _chunkUTQ425O2cjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkUTQ425O2cjs.GitHubProvider; exports.GoogleProvider = _chunkUTQ425O2cjs.GoogleProvider; exports.JWKSVerifier = _chunkUTQ425O2cjs.JWKSVerifier; exports.JWTIssuer = _chunkUTQ425O2cjs.JWTIssuer; exports.MemoryTokenStorage = _chunkUTQ425O2cjs.MemoryTokenStorage; exports.OAuthProvider = _chunkUTQ425O2cjs.OAuthProvider; exports.OAuthProxy = _chunkUTQ425O2cjs.OAuthProxy; exports.OAuthProxyError = _chunkUTQ425O2cjs.OAuthProxyError; exports.PKCEUtils = _chunkUTQ425O2cjs.PKCEUtils; exports.getAuthSession = _chunkUTQ425O2cjs.getAuthSession; exports.requireAll = _chunkUTQ425O2cjs.requireAll; exports.requireAny = _chunkUTQ425O2cjs.requireAny; exports.requireAuth = _chunkUTQ425O2cjs.requireAuth; exports.requireRole = _chunkUTQ425O2cjs.requireRole; exports.requireScopes = _chunkUTQ425O2cjs.requireScopes;
54
+ exports.AuthProvider = _chunk252JIXOLcjs.AuthProvider; exports.AzureProvider = _chunk252JIXOLcjs.AzureProvider; exports.ConsentManager = _chunk252JIXOLcjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunk252JIXOLcjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunk252JIXOLcjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunk252JIXOLcjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunk252JIXOLcjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunk252JIXOLcjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunk252JIXOLcjs.DiskStore; exports.EncryptedTokenStorage = _chunk252JIXOLcjs.EncryptedTokenStorage; exports.GitHubProvider = _chunk252JIXOLcjs.GitHubProvider; exports.GoogleProvider = _chunk252JIXOLcjs.GoogleProvider; exports.JWKSVerifier = _chunk252JIXOLcjs.JWKSVerifier; exports.JWTIssuer = _chunk252JIXOLcjs.JWTIssuer; exports.MemoryTokenStorage = _chunk252JIXOLcjs.MemoryTokenStorage; exports.OAuthProvider = _chunk252JIXOLcjs.OAuthProvider; exports.OAuthProxy = _chunk252JIXOLcjs.OAuthProxy; exports.OAuthProxyError = _chunk252JIXOLcjs.OAuthProxyError; exports.PKCEUtils = _chunk252JIXOLcjs.PKCEUtils; exports.getAuthSession = _chunk252JIXOLcjs.getAuthSession; exports.requireAll = _chunk252JIXOLcjs.requireAll; exports.requireAny = _chunk252JIXOLcjs.requireAny; exports.requireAuth = _chunk252JIXOLcjs.requireAuth; exports.requireRole = _chunk252JIXOLcjs.requireRole; exports.requireScopes = _chunk252JIXOLcjs.requireScopes;
55
55
  //# sourceMappingURL=index.cjs.map
@@ -72,12 +72,19 @@ interface DiskStoreOptions {
72
72
  * Persists tokens to filesystem for survival across server restarts
73
73
  */
74
74
  declare class DiskStore implements TokenStorage {
75
+ private cleanupInFlight;
75
76
  private cleanupInterval;
76
77
  private directory;
77
78
  private fileExtension;
78
79
  constructor(options: DiskStoreOptions);
79
80
  /**
80
- * Clean up expired entries
81
+ * Clean up expired entries.
82
+ *
83
+ * A sweep walks the whole directory and reads every entry, so on a large
84
+ * store it can outlast the cleanup interval. Callers arriving while one is
85
+ * running — the timer below, the OAuth proxy's own cleanup timer, or a
86
+ * direct call — join the sweep in flight instead of starting a second walk
87
+ * over the same files, which would only make a slow sweep slower.
81
88
  */
82
89
  cleanup(): Promise<void>;
83
90
  /**
@@ -117,6 +124,11 @@ declare class DiskStore implements TokenStorage {
117
124
  * Get file path for a key
118
125
  */
119
126
  private getFilePath;
127
+ /**
128
+ * One directory sweep. Always call through {@link cleanup}, which keeps
129
+ * concurrent sweeps from overlapping.
130
+ */
131
+ private runCleanup;
120
132
  }
121
133
 
122
134
  /**
@@ -72,12 +72,19 @@ interface DiskStoreOptions {
72
72
  * Persists tokens to filesystem for survival across server restarts
73
73
  */
74
74
  declare class DiskStore implements TokenStorage {
75
+ private cleanupInFlight;
75
76
  private cleanupInterval;
76
77
  private directory;
77
78
  private fileExtension;
78
79
  constructor(options: DiskStoreOptions);
79
80
  /**
80
- * Clean up expired entries
81
+ * Clean up expired entries.
82
+ *
83
+ * A sweep walks the whole directory and reads every entry, so on a large
84
+ * store it can outlast the cleanup interval. Callers arriving while one is
85
+ * running — the timer below, the OAuth proxy's own cleanup timer, or a
86
+ * direct call — join the sweep in flight instead of starting a second walk
87
+ * over the same files, which would only make a slow sweep slower.
81
88
  */
82
89
  cleanup(): Promise<void>;
83
90
  /**
@@ -117,6 +124,11 @@ declare class DiskStore implements TokenStorage {
117
124
  * Get file path for a key
118
125
  */
119
126
  private getFilePath;
127
+ /**
128
+ * One directory sweep. Always call through {@link cleanup}, which keeps
129
+ * concurrent sweeps from overlapping.
130
+ */
131
+ private runCleanup;
120
132
  }
121
133
 
122
134
  /**
@@ -24,7 +24,7 @@ import {
24
24
  requireAuth,
25
25
  requireRole,
26
26
  requireScopes
27
- } from "../chunk-INI5RROX.js";
27
+ } from "../chunk-J2FAZRSL.js";
28
28
  export {
29
29
  AuthProvider,
30
30
  AzureProvider,
@@ -2944,10 +2944,11 @@ var OAuthProvider = class extends AuthProvider {
2944
2944
  var _promises = require('fs/promises');
2945
2945
  var _path = require('path');
2946
2946
  var DiskStore = (_class6 = class {
2947
- __init10() {this.cleanupInterval = null}
2947
+ __init10() {this.cleanupInFlight = null}
2948
+ __init11() {this.cleanupInterval = null}
2948
2949
 
2949
2950
 
2950
- constructor(options) {;_class6.prototype.__init10.call(this);
2951
+ constructor(options) {;_class6.prototype.__init10.call(this);_class6.prototype.__init11.call(this);
2951
2952
  this.directory = options.directory;
2952
2953
  this.fileExtension = options.fileExtension || ".json";
2953
2954
  void this.ensureDirectory();
@@ -2957,35 +2958,19 @@ var DiskStore = (_class6 = class {
2957
2958
  }, cleanupIntervalMs);
2958
2959
  }
2959
2960
  /**
2960
- * Clean up expired entries
2961
+ * Clean up expired entries.
2962
+ *
2963
+ * A sweep walks the whole directory and reads every entry, so on a large
2964
+ * store it can outlast the cleanup interval. Callers arriving while one is
2965
+ * running — the timer below, the OAuth proxy's own cleanup timer, or a
2966
+ * direct call — join the sweep in flight instead of starting a second walk
2967
+ * over the same files, which would only make a slow sweep slower.
2961
2968
  */
2962
2969
  async cleanup() {
2963
- try {
2964
- await this.ensureDirectory();
2965
- const files = await _promises.readdir.call(void 0, this.directory);
2966
- const now = Date.now();
2967
- for (const file of files) {
2968
- if (!file.endsWith(this.fileExtension)) {
2969
- continue;
2970
- }
2971
- try {
2972
- const filePath = _path.join.call(void 0, this.directory, file);
2973
- const content = await _promises.readFile.call(void 0, filePath, "utf-8");
2974
- const entry = JSON.parse(content);
2975
- if (entry.expiresAt < now) {
2976
- await _promises.rm.call(void 0, filePath);
2977
- }
2978
- } catch (error) {
2979
- console.warn(`Failed to read/parse file ${file}, deleting:`, error);
2980
- try {
2981
- await _promises.rm.call(void 0, _path.join.call(void 0, this.directory, file));
2982
- } catch (e10) {
2983
- }
2984
- }
2985
- }
2986
- } catch (error) {
2987
- console.error("Cleanup failed:", error);
2988
- }
2970
+ this.cleanupInFlight ??= this.runCleanup().finally(() => {
2971
+ this.cleanupInFlight = null;
2972
+ });
2973
+ return this.cleanupInFlight;
2989
2974
  }
2990
2975
  /**
2991
2976
  * Delete a value
@@ -3059,7 +3044,7 @@ var DiskStore = (_class6 = class {
3059
3044
  await this.ensureDirectory();
3060
3045
  const files = await _promises.readdir.call(void 0, this.directory);
3061
3046
  return files.filter((f) => f.endsWith(this.fileExtension)).length;
3062
- } catch (e11) {
3047
+ } catch (e10) {
3063
3048
  return 0;
3064
3049
  }
3065
3050
  }
@@ -3117,15 +3102,47 @@ var DiskStore = (_class6 = class {
3117
3102
  const sanitizedKey = key.replace(/[^a-zA-Z0-9_-]/g, "_");
3118
3103
  return _path.join.call(void 0, this.directory, `${sanitizedKey}${this.fileExtension}`);
3119
3104
  }
3105
+ /**
3106
+ * One directory sweep. Always call through {@link cleanup}, which keeps
3107
+ * concurrent sweeps from overlapping.
3108
+ */
3109
+ async runCleanup() {
3110
+ try {
3111
+ await this.ensureDirectory();
3112
+ const files = await _promises.readdir.call(void 0, this.directory);
3113
+ const now = Date.now();
3114
+ for (const file of files) {
3115
+ if (!file.endsWith(this.fileExtension)) {
3116
+ continue;
3117
+ }
3118
+ try {
3119
+ const filePath = _path.join.call(void 0, this.directory, file);
3120
+ const content = await _promises.readFile.call(void 0, filePath, "utf-8");
3121
+ const entry = JSON.parse(content);
3122
+ if (entry.expiresAt < now) {
3123
+ await _promises.rm.call(void 0, filePath);
3124
+ }
3125
+ } catch (error) {
3126
+ console.warn(`Failed to read/parse file ${file}, deleting:`, error);
3127
+ try {
3128
+ await _promises.rm.call(void 0, _path.join.call(void 0, this.directory, file));
3129
+ } catch (e11) {
3130
+ }
3131
+ }
3132
+ }
3133
+ } catch (error) {
3134
+ console.error("Cleanup failed:", error);
3135
+ }
3136
+ }
3120
3137
  }, _class6);
3121
3138
 
3122
3139
  // src/auth/utils/jwks.ts
3123
3140
  var JWKSVerifier = (_class7 = class {
3124
3141
 
3125
3142
 
3126
- __init11() {this.joseLoaded = false}
3143
+ __init12() {this.joseLoaded = false}
3127
3144
 
3128
- constructor(config) {;_class7.prototype.__init11.call(this);
3145
+ constructor(config) {;_class7.prototype.__init12.call(this);
3129
3146
  this.config = {
3130
3147
  cacheDuration: 36e5,
3131
3148
  // 1 hour
@@ -3283,4 +3300,4 @@ Original error: ${error.message}`
3283
3300
 
3284
3301
 
3285
3302
  exports.getAuthSession = getAuthSession; exports.requireAll = requireAll; exports.requireAny = requireAny; exports.requireAuth = requireAuth; exports.requireRole = requireRole; exports.requireScopes = requireScopes; exports.DEFAULT_ACCESS_TOKEN_TTL = DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_REFRESH_TOKEN_TTL = DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_AUTHORIZATION_CODE_TTL = DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_TRANSACTION_TTL = DEFAULT_TRANSACTION_TTL; exports.ConsentManager = ConsentManager; exports.JWTIssuer = JWTIssuer; exports.PKCEUtils = PKCEUtils; exports.EncryptedTokenStorage = EncryptedTokenStorage; exports.MemoryTokenStorage = MemoryTokenStorage; exports.OAuthProxy = OAuthProxy; exports.OAuthProxyError = OAuthProxyError; exports.AuthProvider = AuthProvider; exports.AzureProvider = AzureProvider; exports.GitHubProvider = GitHubProvider; exports.GoogleProvider = GoogleProvider; exports.OAuthProvider = OAuthProvider; exports.DiskStore = DiskStore; exports.JWKSVerifier = JWKSVerifier;
3286
- //# sourceMappingURL=chunk-UTQ425O2.cjs.map
3303
+ //# sourceMappingURL=chunk-252JIXOL.cjs.map