@embeddable.com/sdk-core 3.14.7-next.3 → 4.0.0-next.1

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/lib/index.esm.js CHANGED
@@ -380,12 +380,12 @@ const loadJson = async (filePath) => {
380
380
 
381
381
  const getComponentLibraryConfig = (componentLibrary) => {
382
382
  let libraryName = componentLibrary;
383
- let include;
383
+ const include = [];
384
384
  const exclude = [];
385
385
  if (typeof componentLibrary === "object" && componentLibrary !== null) {
386
386
  libraryName = componentLibrary.name;
387
387
  if (componentLibrary.include) {
388
- include = [...componentLibrary.include];
388
+ include.push(...componentLibrary.include);
389
389
  }
390
390
  if (componentLibrary.exclude) {
391
391
  exclude.push(...componentLibrary.exclude);
@@ -422,15 +422,12 @@ async function generate$1(ctx) {
422
422
  await fs.writeFile(path$1.resolve(ctx.client.buildDir, ctx.outputOptions.typesEntryPointFilename), typeImports);
423
423
  }
424
424
  async function build$1(ctx) {
425
- var _a, _b, _c, _d;
425
+ var _a;
426
426
  const typesFilePath = path$1.resolve(ctx.client.buildDir, ctx.outputOptions.typesEntryPointFilename);
427
427
  await vite.build({
428
428
  logLevel: "error",
429
429
  build: {
430
430
  emptyOutDir: false,
431
- sourcemap: ((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.watch) ? false : true, // No sourcemaps for types in dev
432
- minify: !((_b = ctx.dev) === null || _b === void 0 ? void 0 : _b.watch), // No minification in dev
433
- rollupOptions: ((_c = ctx.dev) === null || _c === void 0 ? void 0 : _c.watch) ? { treeshake: false } : undefined,
434
431
  lib: {
435
432
  entry: typesFilePath,
436
433
  formats: ["es"],
@@ -439,7 +436,7 @@ async function build$1(ctx) {
439
436
  outDir: ctx.client.buildDir,
440
437
  },
441
438
  });
442
- if (!((_d = ctx.dev) === null || _d === void 0 ? void 0 : _d.watch)) {
439
+ if (!((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.watch)) {
443
440
  const fileContent = await fs.readFile(typesFilePath, "utf8");
444
441
  const fileHash = getContentHash(fileContent);
445
442
  const fileName = `embeddable-types-${fileHash}.js`;
@@ -22066,9 +22063,6 @@ let wss;
22066
22063
  let changedFiles = [];
22067
22064
  let browserWindow = null;
22068
22065
  let previewWorkspace;
22069
- // Build coordination to prevent duplicate plugin builds
22070
- let pluginBuildInProgress = false;
22071
- let pendingPluginBuilds = [];
22072
22066
  const SERVER_PORT = 8926;
22073
22067
  const BUILD_DEV_DIR = ".embeddable-dev-build";
22074
22068
  // NOTE: for backward compatibility, keep the file name as global.css
@@ -22076,43 +22070,6 @@ const CUSTOM_CANVAS_CSS = "/global.css";
22076
22070
  const buildWebComponent = async (config) => {
22077
22071
  await generate(config, "sdk-react");
22078
22072
  };
22079
- const executePluginBuilds = async (config, watchers) => {
22080
- if (pluginBuildInProgress) {
22081
- // If a plugin build is already in progress, queue this one
22082
- return new Promise((resolve) => {
22083
- pendingPluginBuilds.push(async () => {
22084
- await doPluginBuilds(config, watchers);
22085
- resolve();
22086
- });
22087
- });
22088
- }
22089
- else {
22090
- // Start the plugin build immediately
22091
- await doPluginBuilds(config, watchers);
22092
- }
22093
- };
22094
- const doPluginBuilds = async (config, watchers) => {
22095
- pluginBuildInProgress = true;
22096
- try {
22097
- for (const getPlugin of config.plugins) {
22098
- const plugin = getPlugin();
22099
- await plugin.validate(config);
22100
- const watcher = await plugin.build(config);
22101
- await configureWatcher(watcher, config);
22102
- watchers.push(watcher);
22103
- }
22104
- }
22105
- finally {
22106
- pluginBuildInProgress = false;
22107
- // Process any pending builds
22108
- if (pendingPluginBuilds.length > 0) {
22109
- const nextBuild = pendingPluginBuilds.shift();
22110
- if (nextBuild) {
22111
- await nextBuild();
22112
- }
22113
- }
22114
- }
22115
- };
22116
22073
  const addToGitingore = async () => {
22117
22074
  try {
22118
22075
  const gitignorePath = path.resolve(process.cwd(), ".gitignore");
@@ -22227,8 +22184,16 @@ var dev = async () => {
22227
22184
  });
22228
22185
  await sendBuildChanges(config);
22229
22186
  if (config.pushComponents) {
22230
- breadcrumbs.push("build plugins with coordination");
22231
- await executePluginBuilds(config, watchers);
22187
+ for (const getPlugin of config.plugins) {
22188
+ const plugin = getPlugin();
22189
+ breadcrumbs.push("validate plugin");
22190
+ await plugin.validate(config);
22191
+ breadcrumbs.push("build plugin");
22192
+ const watcher = await plugin.build(config);
22193
+ breadcrumbs.push("configure watcher");
22194
+ await configureWatcher(watcher, config);
22195
+ watchers.push(watcher);
22196
+ }
22232
22197
  const customCanvasCssWatch = globalCustomCanvasWatcher(config);
22233
22198
  watchers.push(customCanvasCssWatch);
22234
22199
  if (themeWatcher) {