@embeddable.com/sdk-core 3.1.2-next.0 → 3.1.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.
@@ -1,9 +1,9 @@
1
1
  export type EmbeddableConfig = {
2
2
  plugins: (() => {
3
3
  pluginName: string;
4
- build: (config: EmbeddableConfig) => Promise<void>;
5
- cleanup: (config: EmbeddableConfig) => Promise<void>;
6
- validate: (config: EmbeddableConfig) => Promise<void>;
4
+ build: (config: EmbeddableConfig) => Promise<unknown>;
5
+ cleanup: (config: EmbeddableConfig) => Promise<unknown>;
6
+ validate: (config: EmbeddableConfig) => Promise<unknown>;
7
7
  })[];
8
8
  pushBaseUrl?: string;
9
9
  audienceUrl?: string;
@@ -42,9 +42,9 @@ declare const _default: ({ plugins, pushBaseUrl, audienceUrl, authDomain, authCl
42
42
  rollbarAccessToken: string;
43
43
  plugins: (() => {
44
44
  pluginName: string;
45
- build: (config: EmbeddableConfig) => Promise<void>;
46
- cleanup: (config: EmbeddableConfig) => Promise<void>;
47
- validate: (config: EmbeddableConfig) => Promise<void>;
45
+ build: (config: EmbeddableConfig) => Promise<unknown>;
46
+ cleanup: (config: EmbeddableConfig) => Promise<unknown>;
47
+ validate: (config: EmbeddableConfig) => Promise<unknown>;
48
48
  })[];
49
49
  };
50
50
  export default _default;
package/lib/index.esm.js CHANGED
@@ -4,11 +4,10 @@ import * as path$1 from 'node:path';
4
4
  import { join } from 'node:path';
5
5
  import * as vite from 'vite';
6
6
  import 'node:child_process';
7
- import * as fsSync from 'node:fs';
7
+ import * as fs$2 from 'node:fs';
8
8
  import { createNodeLogger, createNodeSys } from '@stencil/core/sys/node';
9
9
  import { loadConfig, createCompiler } from '@stencil/core/compiler';
10
10
  import * as YAML from 'yaml';
11
- import * as url$2 from 'node:url';
12
11
  import * as path$2 from 'path';
13
12
  import path__default, { basename } from 'path';
14
13
  import require$$4$1 from 'util';
@@ -382,7 +381,7 @@ var prepare = async (ctx) => {
382
381
  await createComponentDir(ctx.client.componentDir);
383
382
  };
384
383
  async function removeIfExists(ctx) {
385
- if (fsSync.existsSync(ctx.client.buildDir))
384
+ if (fs$2.existsSync(ctx.client.buildDir))
386
385
  await fs$1.rm(ctx.client.buildDir, { recursive: true });
387
386
  }
388
387
  async function copyStencilConfigsToClient(ctx) {
@@ -4626,12 +4625,15 @@ const securityContextSchema = z.array(z.object({
4626
4625
 
4627
4626
  var provideConfig = async () => {
4628
4627
  const configFilePath = `${process.cwd()}/embeddable.config.js`;
4629
- if (!fsSync.existsSync(configFilePath)) {
4630
- console.log("Please create a proper `embeddable.config.js` file first.");
4628
+ const tsConfigFilePath = `${process.cwd()}/embeddable.config.ts`;
4629
+ if (!fs$2.existsSync(configFilePath) && !fs$2.existsSync(tsConfigFilePath)) {
4630
+ console.log("Please create a proper `embeddable.config.js` or `embeddable.config.ts` file in the root of your project.");
4631
4631
  process.exit(1);
4632
4632
  }
4633
- const configFileUrl = url$2.pathToFileURL(configFilePath).href;
4634
- return (await import(configFileUrl)).default;
4633
+ const configPath = fs$2.existsSync(tsConfigFilePath)
4634
+ ? tsConfigFilePath
4635
+ : configFilePath;
4636
+ return (await import(configPath)).default;
4635
4637
  };
4636
4638
 
4637
4639
  function getDefaultExportFromCjs (x) {
@@ -20080,6 +20082,8 @@ const inquirerSelect = import('@inquirer/select');
20080
20082
  const YAML_OR_JS_FILES = /^(.*)\.(cube|sc)\.(ya?ml|js)$/;
20081
20083
  let ora$1;
20082
20084
  var push = async () => {
20085
+ var _a;
20086
+ let spinnerPushing;
20083
20087
  try {
20084
20088
  checkNodeVersion();
20085
20089
  ora$1 = (await oraP$1).default;
@@ -20090,14 +20094,15 @@ var push = async () => {
20090
20094
  const filesList = await findFiles(config.client.srcDir, YAML_OR_JS_FILES);
20091
20095
  await archive(config, filesList);
20092
20096
  spinnerArchive.succeed("Bundling completed");
20093
- const spinnerPushing = ora$1(`Publishing to ${workspaceName} using ${config.pushBaseUrl}...`).start();
20097
+ spinnerPushing = ora$1(`Publishing to ${workspaceName} using ${config.pushBaseUrl}...`).start();
20094
20098
  await sendBuild(config, { workspaceId, token });
20095
20099
  spinnerPushing.succeed(`Published to ${workspaceName} using ${config.pushBaseUrl}`);
20096
20100
  }
20097
20101
  catch (error) {
20098
- console.log(error);
20102
+ spinnerPushing === null || spinnerPushing === void 0 ? void 0 : spinnerPushing.fail("Publishing failed");
20103
+ console.error(((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) || (error === null || error === void 0 ? void 0 : error.message) || error);
20099
20104
  await reportErrorToRollbar(error);
20100
- throw error;
20105
+ process.exit(1);
20101
20106
  }
20102
20107
  };
20103
20108
  async function selectWorkspace(ctx, token) {
@@ -20146,7 +20151,7 @@ async function verify(ctx) {
20146
20151
  return token;
20147
20152
  }
20148
20153
  async function archive(ctx, yamlFiles, includeBuild = true) {
20149
- const output = fsSync.createWriteStream(ctx.client.archiveFile);
20154
+ const output = fs$2.createWriteStream(ctx.client.archiveFile);
20150
20155
  const _archiver = archiver.create("zip", {
20151
20156
  zlib: { level: 9 },
20152
20157
  });