slicejs-web-framework 2.4.5 → 2.4.7

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.
@@ -73,12 +73,6 @@ export default class Controller {
73
73
 
74
74
  const bundlePath = `/bundles/${bundleInfo.file}`;
75
75
 
76
- const integrityOk = await this.verifyBundleIntegrity(bundlePath, bundleInfo.integrity);
77
- if (!integrityOk) {
78
- console.warn(`❌ Integrity check failed for bundle ${bundleName}`);
79
- return;
80
- }
81
-
82
76
  // Dynamic import of the bundle
83
77
  const bundleModule = await import(bundlePath);
84
78
 
@@ -93,47 +87,6 @@ export default class Controller {
93
87
  }
94
88
  }
95
89
 
96
- /**
97
- * Verifies bundle integrity by comparing sha256 hash.
98
- * @param {string} bundlePath
99
- * @param {string|null} expectedIntegrity
100
- * @returns {Promise<boolean>}
101
- */
102
- async verifyBundleIntegrity(bundlePath, expectedIntegrity) {
103
- if (!expectedIntegrity) {
104
- return true;
105
- }
106
-
107
- try {
108
- const response = await fetch(bundlePath, { cache: 'no-store' });
109
- if (!response.ok) {
110
- console.warn(`Failed to fetch bundle for integrity check: ${response.status}`);
111
- return false;
112
- }
113
-
114
- const content = await response.text();
115
- const actualIntegrity = await this.hashSha256(content);
116
- return actualIntegrity === expectedIntegrity;
117
- } catch (error) {
118
- console.warn(`Integrity check error for ${bundlePath}:`, error);
119
- return false;
120
- }
121
- }
122
-
123
- /**
124
- * Calculates sha256 digest for a string.
125
- * @param {string} content
126
- * @returns {Promise<string>}
127
- */
128
- async hashSha256(content) {
129
- const encoder = new TextEncoder();
130
- const data = encoder.encode(content);
131
- const hashBuffer = await crypto.subtle.digest('SHA-256', data);
132
- const hashArray = Array.from(new Uint8Array(hashBuffer));
133
- const hashHex = hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');
134
- return `sha256:${hashHex}`;
135
- }
136
-
137
90
  /**
138
91
  * 📦 Registers a bundle's components (called automatically by bundle files)
139
92
  */
package/api/index.js CHANGED
@@ -199,6 +199,14 @@ if (runMode === 'development') {
199
199
  }
200
200
  return res.status(404).send('routes.js not found');
201
201
  });
202
+ app.get('/sliceConfig.json', (req, res) => {
203
+ const configPath = path.join(__dirname, `../${folderDeployed}`, 'sliceConfig.json');
204
+ if (fs.existsSync(configPath)) {
205
+ res.setHeader('Content-Type', 'application/json; charset=utf-8');
206
+ return res.send(fs.readFileSync(configPath, 'utf8'));
207
+ }
208
+ return res.status(404).send('sliceConfig.json not found');
209
+ });
202
210
  for (const folder of normalizedPublicFolders) {
203
211
  app.use(folder, express.static(path.join(__dirname, `../${folderDeployed}`, folder)));
204
212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicejs-web-framework",
3
- "version": "2.4.5",
3
+ "version": "2.4.7",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=20"