@webmate-studio/builder 0.2.166 → 0.2.168
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 +24 -6
- package/package.json +1 -1
- package/src/bundler.js +3 -2
package/build-service.js
CHANGED
|
@@ -172,13 +172,31 @@ async function buildComponent(payload) {
|
|
|
172
172
|
// These become Custom Elements, others are just utilities/sub-components
|
|
173
173
|
const usedIslands = new Set();
|
|
174
174
|
if (html) {
|
|
175
|
-
//
|
|
176
|
-
|
|
177
|
-
const componentTagRegex = /<([A-Z][a-zA-Z0-9]*)[^>]*?\/?>/g;
|
|
175
|
+
// Match PascalCase tags: <SliderMitText ...> or <SliderMitText .../>
|
|
176
|
+
const pascalCaseRegex = /<([A-Z][a-zA-Z0-9]*)[^>]*?\/?>/g;
|
|
178
177
|
let match;
|
|
179
|
-
while ((match =
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
while ((match = pascalCaseRegex.exec(html)) !== null) {
|
|
179
|
+
usedIslands.add(match[1]); // e.g. "SliderMitText"
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Also match kebab-case custom elements (HTML may already be transformed by Workbench)
|
|
183
|
+
// e.g. <slider-mit-text ...> or <wm-counter ...>
|
|
184
|
+
if (usedIslands.size === 0 && islands && islands.length > 0) {
|
|
185
|
+
const kebabRegex = /<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)[^>]*?\/?>/g;
|
|
186
|
+
const kebabTags = new Set();
|
|
187
|
+
while ((match = kebabRegex.exec(html)) !== null) {
|
|
188
|
+
kebabTags.add(match[1]); // e.g. "slider-mit-text"
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Map island filenames to their kebab-case equivalents and check
|
|
192
|
+
for (const island of islands) {
|
|
193
|
+
const name = island.file.replace(/\.(jsx?|tsx?|svelte|vue)$/, '');
|
|
194
|
+
const kebab = name.replace(/([A-Z])/g, '-$1').toLowerCase().replace(/^-/, '');
|
|
195
|
+
const prefixed = 'wm-' + kebab;
|
|
196
|
+
if (kebabTags.has(kebab) || kebabTags.has(prefixed)) {
|
|
197
|
+
usedIslands.add(name); // Add PascalCase name for later matching
|
|
198
|
+
}
|
|
199
|
+
}
|
|
182
200
|
}
|
|
183
201
|
}
|
|
184
202
|
|
package/package.json
CHANGED
package/src/bundler.js
CHANGED
|
@@ -29,6 +29,9 @@ export async function bundleIsland(islandPath, outputPath, options = {}) {
|
|
|
29
29
|
svelteCustomElement = true // Set false for mount()-based islands (preview mode)
|
|
30
30
|
} = options;
|
|
31
31
|
|
|
32
|
+
let entryPoint = islandPath;
|
|
33
|
+
let wrapperPath = null;
|
|
34
|
+
|
|
32
35
|
try {
|
|
33
36
|
// Resolve paths for dependencies from builder package
|
|
34
37
|
// In npx environment, we need to find where the actual dependencies are installed
|
|
@@ -43,8 +46,6 @@ export async function bundleIsland(islandPath, outputPath, options = {}) {
|
|
|
43
46
|
|
|
44
47
|
// Check if island source already registers as Custom Element
|
|
45
48
|
// If not (plain class export), create a wrapper entry that auto-registers it
|
|
46
|
-
let entryPoint = islandPath;
|
|
47
|
-
let wrapperPath = null;
|
|
48
49
|
|
|
49
50
|
const isSvelte = islandPath.endsWith('.svelte');
|
|
50
51
|
if (!isSvelte) {
|