@spektre/veil 1.0.2 → 1.0.3

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.
@@ -20,7 +20,7 @@ interface AnalysisResult {
20
20
  /**
21
21
  * Fetch and parse the source map
22
22
  */
23
- export declare function fetchSourceMap(sourceMapUrl: string): Promise<any>;
23
+ export declare function fetchSourceMap(sourceMapUrl?: string): Promise<any>;
24
24
  /**
25
25
  * Extract all source code from source map
26
26
  */
@@ -32,7 +32,7 @@ export declare function analyzeSourceCode(sourceCode: string, fileName: string):
32
32
  /**
33
33
  * Generate full security analysis of all source code
34
34
  */
35
- export declare function generateSecurityAnalysis(sourceMapUrl: string): Promise<AnalysisResult>;
35
+ export declare function generateSecurityAnalysis(sourceMapUrl?: string): Promise<AnalysisResult>;
36
36
  /**
37
37
  * Format analysis for display
38
38
  */
package/dist/index.esm.js CHANGED
@@ -11,19 +11,30 @@ async function fetchSourceMap(sourceMapUrl) {
11
11
  if (cachedSourceMap) {
12
12
  return cachedSourceMap;
13
13
  }
14
- try {
15
- const response = await fetch(sourceMapUrl);
16
- if (!response.ok) {
17
- console.warn('[Spektre] Could not fetch source map:', sourceMapUrl);
18
- return null;
14
+ // Try multiple possible locations for source map
15
+ const possibleUrls = [
16
+ sourceMapUrl || `${window.location.origin}/index.js.map`,
17
+ `${window.location.origin}/dist/index.js.map`,
18
+ `${window.location.origin}/dist/index.esm.js.map`,
19
+ '/index.js.map',
20
+ '/dist/index.js.map',
21
+ '/dist/index.esm.js.map',
22
+ ];
23
+ for (const url of possibleUrls) {
24
+ try {
25
+ const response = await fetch(url);
26
+ if (response.ok) {
27
+ cachedSourceMap = await response.json();
28
+ console.log('[Spektre] Source map loaded from:', url);
29
+ return cachedSourceMap;
30
+ }
31
+ }
32
+ catch (error) {
33
+ // Continue to next URL
19
34
  }
20
- cachedSourceMap = await response.json();
21
- return cachedSourceMap;
22
- }
23
- catch (error) {
24
- console.warn('[Spektre] Source map parsing failed:', error);
25
- return null;
26
35
  }
36
+ console.warn('[Spektre] Could not find source map at any location:', possibleUrls);
37
+ return null;
27
38
  }
28
39
  /**
29
40
  * Extract all source code from source map
@@ -161,7 +172,7 @@ async function generateSecurityAnalysis(sourceMapUrl) {
161
172
  mediumCount: 0,
162
173
  lowCount: 0,
163
174
  issues: [],
164
- summary: 'Could not load source map for analysis.',
175
+ summary: 'Could not load source map for analysis. Make sure your build includes source maps (sourcemap: true in rollup config).',
165
176
  };
166
177
  }
167
178
  const sourceCode = await extractAllSourceCode(sourceMap);
@@ -221,7 +232,7 @@ function generateSummary(critical, high, medium, low) {
221
232
  }
222
233
 
223
234
  const DEV_UI_STORAGE_KEY = 'spektre_dev_enabled';
224
- let DEV_UI_VERSION = '1.0.0';
235
+ let DEV_UI_VERSION = '1.0.3';
225
236
  // Inject styles directly into the document
226
237
  function injectDevUIStyles() {
227
238
  if (document.getElementById('spektre-dev-ui-styles')) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.js CHANGED
@@ -13,19 +13,30 @@ async function fetchSourceMap(sourceMapUrl) {
13
13
  if (cachedSourceMap) {
14
14
  return cachedSourceMap;
15
15
  }
16
- try {
17
- const response = await fetch(sourceMapUrl);
18
- if (!response.ok) {
19
- console.warn('[Spektre] Could not fetch source map:', sourceMapUrl);
20
- return null;
16
+ // Try multiple possible locations for source map
17
+ const possibleUrls = [
18
+ sourceMapUrl || `${window.location.origin}/index.js.map`,
19
+ `${window.location.origin}/dist/index.js.map`,
20
+ `${window.location.origin}/dist/index.esm.js.map`,
21
+ '/index.js.map',
22
+ '/dist/index.js.map',
23
+ '/dist/index.esm.js.map',
24
+ ];
25
+ for (const url of possibleUrls) {
26
+ try {
27
+ const response = await fetch(url);
28
+ if (response.ok) {
29
+ cachedSourceMap = await response.json();
30
+ console.log('[Spektre] Source map loaded from:', url);
31
+ return cachedSourceMap;
32
+ }
33
+ }
34
+ catch (error) {
35
+ // Continue to next URL
21
36
  }
22
- cachedSourceMap = await response.json();
23
- return cachedSourceMap;
24
- }
25
- catch (error) {
26
- console.warn('[Spektre] Source map parsing failed:', error);
27
- return null;
28
37
  }
38
+ console.warn('[Spektre] Could not find source map at any location:', possibleUrls);
39
+ return null;
29
40
  }
30
41
  /**
31
42
  * Extract all source code from source map
@@ -163,7 +174,7 @@ async function generateSecurityAnalysis(sourceMapUrl) {
163
174
  mediumCount: 0,
164
175
  lowCount: 0,
165
176
  issues: [],
166
- summary: 'Could not load source map for analysis.',
177
+ summary: 'Could not load source map for analysis. Make sure your build includes source maps (sourcemap: true in rollup config).',
167
178
  };
168
179
  }
169
180
  const sourceCode = await extractAllSourceCode(sourceMap);
@@ -223,7 +234,7 @@ function generateSummary(critical, high, medium, low) {
223
234
  }
224
235
 
225
236
  const DEV_UI_STORAGE_KEY = 'spektre_dev_enabled';
226
- let DEV_UI_VERSION = '1.0.0';
237
+ let DEV_UI_VERSION = '1.0.3';
227
238
  // Inject styles directly into the document
228
239
  function injectDevUIStyles() {
229
240
  if (document.getElementById('spektre-dev-ui-styles')) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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1,6 @@
1
1
  {
2
2
  "name": "@spektre/veil",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "description": "Security and monitoring wrapper for React apps built with AI tools",
6
6
  "main": "dist/index.js",