bun-plugin-stx 0.2.6 → 0.2.8

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.
@@ -282,6 +282,18 @@ function stxPlugin(userOptions) {
282
282
  ...userOptions
283
283
  };
284
284
  const allDependencies = new Set;
285
+ if (!build.config.root && build.config.entrypoints?.length) {
286
+ const dirs = build.config.entrypoints.map((e) => path2.dirname(path2.resolve(e)));
287
+ const commonRoot = dirs.reduce((a, b) => {
288
+ const aParts = a.split(path2.sep);
289
+ const bParts = b.split(path2.sep);
290
+ let i = 0;
291
+ while (i < aParts.length && i < bParts.length && aParts[i] === bParts[i])
292
+ i++;
293
+ return aParts.slice(0, i).join(path2.sep);
294
+ });
295
+ build.config.root = commonRoot;
296
+ }
285
297
  const webComponentsPath = options.webComponents?.enabled ? `./${path2.relative(path2.dirname(build.config?.outdir || "dist"), options.webComponents.outputDir || "dist/web-components")}` : "/web-components";
286
298
  const builtComponents = [];
287
299
  if (options.webComponents?.enabled) {
@@ -374,7 +386,7 @@ export { content as default };
374
386
  const serverScripts = [];
375
387
  const signalsScripts = [];
376
388
  let scriptMatch;
377
- const usesSignalsAPI = (content2) => /\b(?:state|derived|effect|batch)\s*\(/.test(content2);
389
+ const usesSignalsAPI = (content2) => /\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(content2);
378
390
  while ((scriptMatch = scriptRegex.exec(content)) !== null) {
379
391
  const attrs = scriptMatch[1];
380
392
  const scriptContent = scriptMatch[2];