acrylblends 1.0.2 → 1.0.3

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/dist/index.js CHANGED
@@ -697,7 +697,7 @@ function mount(appDir, plugin) {
697
697
  const found = (plugin.after ? new RegExp(`^( *)- id: ?\\S+\\n\\1 {2}name: ?${plugin.after}\\n(?:\\1 {2}config:\\n(?:\\1 {4}.*\\n|\\1 {2}\\s*\\n)*)?`, "mu") : /^( *)- id: ?routes\n/mu).exec(text);
698
698
  if (found) {
699
699
  const indent = found[1];
700
- const row = `${indent}- id: ${plugin.name}\n${indent} name: ${plugin.name}\n`;
700
+ const row = `${indent}- id: ${plugin.row ?? plugin.name}\n${indent} name: ${plugin.name}\n`;
701
701
  const at = plugin.after ? found.index + found[0].length : found.index;
702
702
  text = text.slice(0, at) + row + text.slice(at);
703
703
  writeFileSync(manifestFile, text);
@@ -712,15 +712,17 @@ function mount(appDir, plugin) {
712
712
  if (text.includes(entry)) done.push("src/app.ts (already registered)");
713
713
  else {
714
714
  const last = [...text.matchAll(/^import .* from '\.\.\/plugins\/[^']+'\n/gmu)].at(-1);
715
- const table = /^export const registry = \{\n/mu.exec(text);
715
+ const table = /^export const registry = \{(\s)/mu.exec(text);
716
716
  if (last && table) {
717
- const line = `import * as ${plugin.local} from '../plugins/${plugin.name}/index.ts'\n`;
718
- text = text.slice(0, table.index + table[0].length) + ` ${entry},\n` + text.slice(table.index + table[0].length);
717
+ const file = plugin.entry ?? "index.ts";
718
+ const line = `import * as ${plugin.local} from '../plugins/${plugin.name}/${file}'\n`;
719
+ const at = table.index + table[0].length;
720
+ text = text.slice(0, at) + (table[1] === "\n" ? ` ${entry},\n` : `${entry}, `) + text.slice(at);
719
721
  const lastEnd = last.index + last[0].length;
720
722
  text = text.slice(0, lastEnd) + line + text.slice(lastEnd);
721
723
  writeFileSync(appFile, text);
722
724
  done.push(`src/app.ts (registered as ${plugin.local})`);
723
- } else failed.push(`src/app.ts: import it as \`${plugin.local}\` from '../plugins/${plugin.name}/index.ts' and add \`${entry}\` to the registry`);
725
+ } else failed.push(`src/app.ts: import it as \`${plugin.local}\` from '../plugins/${plugin.name}/${plugin.entry ?? "index.ts"}' and add \`${entry}\` to the registry`);
724
726
  }
725
727
  } else failed.push(`src/app.ts: not found; register ${entry(plugin)} in the app's registry`);
726
728
  return {