@embeddable.com/sdk-core 3.14.7-next.2 → 4.0.0-next.0

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`;
@@ -22000,9 +21997,8 @@ async function archive(args) {
22000
21997
  archive.pipe(output);
22001
21998
  if (!isDev) {
22002
21999
  archive.directory(ctx.client.buildDir, false);
22003
- // NOTE: for backward compatibility, keep the file name as global.css
22004
22000
  archive.file(ctx.client.customCanvasCss, {
22005
- name: "global.css",
22001
+ name: "custom-canvas.css",
22006
22002
  });
22007
22003
  }
22008
22004
  for (const fileData of filesList) {
@@ -22066,53 +22062,12 @@ let wss;
22066
22062
  let changedFiles = [];
22067
22063
  let browserWindow = null;
22068
22064
  let previewWorkspace;
22069
- // Build coordination to prevent duplicate plugin builds
22070
- let pluginBuildInProgress = false;
22071
- let pendingPluginBuilds = [];
22072
22065
  const SERVER_PORT = 8926;
22073
22066
  const BUILD_DEV_DIR = ".embeddable-dev-build";
22074
- // NOTE: for backward compatibility, keep the file name as global.css
22075
- const CUSTOM_CANVAS_CSS = "/global.css";
22067
+ const CUSTOM_CANVAS_CSS = "/custom-canvas.css";
22076
22068
  const buildWebComponent = async (config) => {
22077
22069
  await generate(config, "sdk-react");
22078
22070
  };
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
22071
  const addToGitingore = async () => {
22117
22072
  try {
22118
22073
  const gitignorePath = path.resolve(process.cwd(), ".gitignore");
@@ -22227,8 +22182,16 @@ var dev = async () => {
22227
22182
  });
22228
22183
  await sendBuildChanges(config);
22229
22184
  if (config.pushComponents) {
22230
- breadcrumbs.push("build plugins with coordination");
22231
- await executePluginBuilds(config, watchers);
22185
+ for (const getPlugin of config.plugins) {
22186
+ const plugin = getPlugin();
22187
+ breadcrumbs.push("validate plugin");
22188
+ await plugin.validate(config);
22189
+ breadcrumbs.push("build plugin");
22190
+ const watcher = await plugin.build(config);
22191
+ breadcrumbs.push("configure watcher");
22192
+ await configureWatcher(watcher, config);
22193
+ watchers.push(watcher);
22194
+ }
22232
22195
  const customCanvasCssWatch = globalCustomCanvasWatcher(config);
22233
22196
  watchers.push(customCanvasCssWatch);
22234
22197
  if (themeWatcher) {