@embeddable.com/sdk-core 3.2.2 → 3.3.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.js CHANGED
@@ -405,11 +405,11 @@ async function generate$1(ctx) {
405
405
  const optionsFiles = await findFiles(ctx.client.srcDir, EMB_OPTIONS_FILE_REGEX);
406
406
  const typeImports = typeFiles
407
407
  .concat(optionsFiles)
408
- .map(([_fileName, filePath]) => `import './${path__namespace
408
+ .map(([_fileName, filePath]) => `import '../${path__namespace
409
409
  .relative(ctx.client.rootDir, filePath)
410
410
  .replaceAll("\\", "/")}';`)
411
411
  .join("\n");
412
- await fs__namespace.writeFile(path__namespace.resolve(ctx.client.rootDir, ctx.outputOptions.typesEntryPointFilename), typeImports);
412
+ await fs__namespace.writeFile(path__namespace.resolve(ctx.client.buildDir, ctx.outputOptions.typesEntryPointFilename), typeImports);
413
413
  }
414
414
  async function build$1(ctx) {
415
415
  var _a;
@@ -418,7 +418,7 @@ async function build$1(ctx) {
418
418
  build: {
419
419
  emptyOutDir: false,
420
420
  lib: {
421
- entry: path__namespace.resolve(ctx.client.rootDir, ctx.outputOptions.typesEntryPointFilename),
421
+ entry: path__namespace.resolve(ctx.client.buildDir, ctx.outputOptions.typesEntryPointFilename),
422
422
  formats: ["es"],
423
423
  fileName: "embeddable-types",
424
424
  },
@@ -434,7 +434,7 @@ async function build$1(ctx) {
434
434
  });
435
435
  }
436
436
  async function cleanup$1(ctx) {
437
- await fs__namespace.rm(path__namespace.resolve(ctx.client.rootDir, "embeddable-types-entry-point.js"));
437
+ await fs__namespace.rm(path__namespace.resolve(ctx.client.buildDir, "embeddable-types-entry-point.js"));
438
438
  }
439
439
 
440
440
  var prepare = async (ctx) => {
@@ -20662,24 +20662,48 @@ let browserWindow = null;
20662
20662
  let ora;
20663
20663
  let previewWorkspace;
20664
20664
  const SERVER_PORT = 8926;
20665
+ const BUILD_DEV_DIR = ".embeddable-dev-build";
20665
20666
  const buildWebComponent = async (config) => {
20666
20667
  await generate(config, "sdk-react");
20667
20668
  };
20669
+ const addToGitingore = async () => {
20670
+ try {
20671
+ const fs = require("fs").promises;
20672
+ const gitignorePath = path__namespace$1.resolve(process.cwd(), ".gitignore");
20673
+ const gitignoreContent = await fs.readFile(gitignorePath, "utf8");
20674
+ if (!gitignoreContent.includes(BUILD_DEV_DIR)) {
20675
+ await fs.appendFile(gitignorePath, `\n${BUILD_DEV_DIR}\n`);
20676
+ }
20677
+ }
20678
+ catch (e) {
20679
+ // ignore
20680
+ }
20681
+ };
20668
20682
  var dev = async () => {
20669
20683
  var _a;
20670
20684
  checkNodeVersion();
20685
+ addToGitingore();
20671
20686
  const http = require("http");
20672
20687
  ora = (await oraP).default;
20673
20688
  process.on("warning", (e) => console.warn(e.stack));
20674
20689
  const logger = node.createNodeLogger({ process });
20675
20690
  const sys = node.createNodeSys({ process });
20691
+ const defaultConfig = await provideConfig();
20692
+ const buildDir = path__namespace$1.resolve(defaultConfig.client.rootDir, ".embeddable-dev-build");
20676
20693
  const config = {
20694
+ ...defaultConfig,
20677
20695
  dev: {
20678
20696
  watch: true,
20679
20697
  logger,
20680
20698
  sys,
20681
20699
  },
20682
- ...(await provideConfig()),
20700
+ client: {
20701
+ ...defaultConfig.client,
20702
+ buildDir: buildDir,
20703
+ componentDir: path__namespace$1.resolve(buildDir, "component"),
20704
+ stencilBuild: path__namespace$1.resolve(buildDir, "dist", "embeddable-wrapper"),
20705
+ tmpDir: path__namespace$1.resolve(defaultConfig.client.rootDir, ".embeddable-dev-tmp"),
20706
+ },
20683
20707
  };
20684
20708
  await prepare(config);
20685
20709
  const finalhandler = require("finalhandler");