@webmate-studio/builder 0.2.31 → 0.2.33
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/build-service.js +11 -1
- package/package.json +1 -1
package/build-service.js
CHANGED
|
@@ -174,9 +174,10 @@ async function buildComponent(payload) {
|
|
|
174
174
|
const islandsDir = join(tmpDir, 'islands');
|
|
175
175
|
await mkdir(islandsDir, { recursive: true });
|
|
176
176
|
|
|
177
|
+
// FIRST: Write ALL island files to disk (for cross-imports)
|
|
178
|
+
// Some islands may import other files from the islands/ directory
|
|
177
179
|
for (const island of islands) {
|
|
178
180
|
const inputPath = join(islandsDir, island.file);
|
|
179
|
-
const outputPath = join(islandsDir, island.file.replace(/\.(jsx?|tsx?|svelte|vue)$/, '.js'));
|
|
180
181
|
|
|
181
182
|
// Auto-inject <svelte:options> for Svelte islands
|
|
182
183
|
let content = island.content;
|
|
@@ -186,6 +187,12 @@ async function buildComponent(payload) {
|
|
|
186
187
|
|
|
187
188
|
// Write source file
|
|
188
189
|
await writeFile(inputPath, content);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// SECOND: Bundle each island
|
|
193
|
+
for (const island of islands) {
|
|
194
|
+
const inputPath = join(islandsDir, island.file);
|
|
195
|
+
const outputPath = join(islandsDir, island.file.replace(/\.(jsx?|tsx?|svelte|vue)$/, '.js'));
|
|
189
196
|
|
|
190
197
|
console.log(`[Build Service] Bundling ${island.file}...`);
|
|
191
198
|
|
|
@@ -345,3 +352,6 @@ server.listen(PORT, () => {
|
|
|
345
352
|
console.log(` POST /css/generate - Generate Tailwind CSS`);
|
|
346
353
|
console.log(` POST /build - Build component (islands + CSS)`);
|
|
347
354
|
});
|
|
355
|
+
|
|
356
|
+
// Export for programmatic usage
|
|
357
|
+
export { buildComponent, generateComponentCSS };
|