@webmate-studio/builder 0.2.125 → 0.2.126

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/bundler.js +9 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmate-studio/builder",
3
- "version": "0.2.125",
3
+ "version": "0.2.126",
4
4
  "type": "module",
5
5
  "description": "Webmate Studio Component Builder",
6
6
  "keywords": [
package/src/bundler.js CHANGED
@@ -54,6 +54,7 @@ export async function bundleIsland(islandPath, outputPath, options = {}) {
54
54
  target,
55
55
  outfile: outputPath,
56
56
  platform: 'browser',
57
+ ...(format === 'iife' ? { globalName: '__IslandExport' } : {}),
57
58
  charset: 'utf8', // Force UTF-8 output to prevent base64 corruption (esbuild bug #1501)
58
59
  // Loaders for different file types
59
60
  // NOTE: All image formats are handled by custom plugin above (image-base64-dataurl)
@@ -205,7 +206,7 @@ export async function bundleComponentIslands(componentDir, outputDir, options =
205
206
 
206
207
  // Find all island files (JS, JSX, Svelte, Vue, etc.)
207
208
  const files = await fs.readdir(islandsDir);
208
- const islandFiles = files.filter((f) =>
209
+ const allIslandFiles = files.filter((f) =>
209
210
  f.endsWith('.js') ||
210
211
  f.endsWith('.jsx') ||
211
212
  f.endsWith('.svelte') ||
@@ -214,6 +215,13 @@ export async function bundleComponentIslands(componentDir, outputDir, options =
214
215
  f.endsWith('.tsx')
215
216
  );
216
217
 
218
+ // Skip .svelte files that have a matching .js wrapper (the .js is the entry point)
219
+ const jsNames = new Set(allIslandFiles.filter(f => f.endsWith('.js')).map(f => f.replace(/\.js$/, '')));
220
+ const islandFiles = allIslandFiles.filter(f => {
221
+ if (f.endsWith('.svelte') && jsNames.has(f.replace(/\.svelte$/, ''))) return false;
222
+ return true;
223
+ });
224
+
217
225
  if (islandFiles.length === 0) {
218
226
  return { islands: [], success: true };
219
227
  }