@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.esm.js CHANGED
@@ -378,11 +378,11 @@ async function generate$1(ctx) {
378
378
  const optionsFiles = await findFiles(ctx.client.srcDir, EMB_OPTIONS_FILE_REGEX);
379
379
  const typeImports = typeFiles
380
380
  .concat(optionsFiles)
381
- .map(([_fileName, filePath]) => `import './${path$1
381
+ .map(([_fileName, filePath]) => `import '../${path$1
382
382
  .relative(ctx.client.rootDir, filePath)
383
383
  .replaceAll("\\", "/")}';`)
384
384
  .join("\n");
385
- await fs$1.writeFile(path$1.resolve(ctx.client.rootDir, ctx.outputOptions.typesEntryPointFilename), typeImports);
385
+ await fs$1.writeFile(path$1.resolve(ctx.client.buildDir, ctx.outputOptions.typesEntryPointFilename), typeImports);
386
386
  }
387
387
  async function build$1(ctx) {
388
388
  var _a;
@@ -391,7 +391,7 @@ async function build$1(ctx) {
391
391
  build: {
392
392
  emptyOutDir: false,
393
393
  lib: {
394
- entry: path$1.resolve(ctx.client.rootDir, ctx.outputOptions.typesEntryPointFilename),
394
+ entry: path$1.resolve(ctx.client.buildDir, ctx.outputOptions.typesEntryPointFilename),
395
395
  formats: ["es"],
396
396
  fileName: "embeddable-types",
397
397
  },
@@ -407,7 +407,7 @@ async function build$1(ctx) {
407
407
  });
408
408
  }
409
409
  async function cleanup$1(ctx) {
410
- await fs$1.rm(path$1.resolve(ctx.client.rootDir, "embeddable-types-entry-point.js"));
410
+ await fs$1.rm(path$1.resolve(ctx.client.buildDir, "embeddable-types-entry-point.js"));
411
411
  }
412
412
 
413
413
  var prepare = async (ctx) => {
@@ -20635,24 +20635,48 @@ let browserWindow = null;
20635
20635
  let ora;
20636
20636
  let previewWorkspace;
20637
20637
  const SERVER_PORT = 8926;
20638
+ const BUILD_DEV_DIR = ".embeddable-dev-build";
20638
20639
  const buildWebComponent = async (config) => {
20639
20640
  await generate(config, "sdk-react");
20640
20641
  };
20642
+ const addToGitingore = async () => {
20643
+ try {
20644
+ const fs = require("fs").promises;
20645
+ const gitignorePath = path$2.resolve(process.cwd(), ".gitignore");
20646
+ const gitignoreContent = await fs.readFile(gitignorePath, "utf8");
20647
+ if (!gitignoreContent.includes(BUILD_DEV_DIR)) {
20648
+ await fs.appendFile(gitignorePath, `\n${BUILD_DEV_DIR}\n`);
20649
+ }
20650
+ }
20651
+ catch (e) {
20652
+ // ignore
20653
+ }
20654
+ };
20641
20655
  var dev = async () => {
20642
20656
  var _a;
20643
20657
  checkNodeVersion();
20658
+ addToGitingore();
20644
20659
  const http = require("http");
20645
20660
  ora = (await oraP).default;
20646
20661
  process.on("warning", (e) => console.warn(e.stack));
20647
20662
  const logger = createNodeLogger({ process });
20648
20663
  const sys = createNodeSys({ process });
20664
+ const defaultConfig = await provideConfig();
20665
+ const buildDir = path$2.resolve(defaultConfig.client.rootDir, ".embeddable-dev-build");
20649
20666
  const config = {
20667
+ ...defaultConfig,
20650
20668
  dev: {
20651
20669
  watch: true,
20652
20670
  logger,
20653
20671
  sys,
20654
20672
  },
20655
- ...(await provideConfig()),
20673
+ client: {
20674
+ ...defaultConfig.client,
20675
+ buildDir: buildDir,
20676
+ componentDir: path$2.resolve(buildDir, "component"),
20677
+ stencilBuild: path$2.resolve(buildDir, "dist", "embeddable-wrapper"),
20678
+ tmpDir: path$2.resolve(defaultConfig.client.rootDir, ".embeddable-dev-tmp"),
20679
+ },
20656
20680
  };
20657
20681
  await prepare(config);
20658
20682
  const finalhandler = require("finalhandler");