@embeddable.com/sdk-core 3.3.1 → 3.4.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.js CHANGED
@@ -413,25 +413,25 @@ async function generate$1(ctx) {
413
413
  }
414
414
  async function build$1(ctx) {
415
415
  var _a;
416
+ const typesFilePath = path__namespace.resolve(ctx.client.buildDir, ctx.outputOptions.typesEntryPointFilename);
416
417
  await vite__namespace.build({
417
418
  logLevel: "error",
418
419
  build: {
419
420
  emptyOutDir: false,
420
421
  lib: {
421
- entry: path__namespace.resolve(ctx.client.buildDir, ctx.outputOptions.typesEntryPointFilename),
422
+ entry: typesFilePath,
422
423
  formats: ["es"],
423
424
  fileName: "embeddable-types",
424
425
  },
425
- rollupOptions: ((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.watch)
426
- ? undefined
427
- : {
428
- output: {
429
- entryFileNames: "embeddable-types-[hash].js",
430
- },
431
- },
432
426
  outDir: ctx.client.buildDir,
433
427
  },
434
428
  });
429
+ if (!((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.watch)) {
430
+ const fileContent = await fs__namespace.readFile(typesFilePath, "utf8");
431
+ const fileHash = getContentHash(fileContent);
432
+ const fileName = `embeddable-types-${fileHash}.js`;
433
+ await fs__namespace.rename(path__namespace.resolve(ctx.client.buildDir, "embeddable-types.js"), path__namespace.resolve(ctx.client.buildDir, fileName));
434
+ }
435
435
  }
436
436
  async function cleanup$1(ctx) {
437
437
  await fs__namespace.rm(path__namespace.resolve(ctx.client.buildDir, "embeddable-types-entry-point.js"));
@@ -542,22 +542,26 @@ const CREDENTIALS_FILE = path__namespace.resolve(CREDENTIALS_DIR, "credentials")
542
542
 
543
543
  const oraP$3 = import('ora');
544
544
  let ora$2;
545
- const checkNodeVersion$1 = async () => {
545
+ const checkNodeVersion = async () => {
546
546
  ora$2 = (await oraP$3).default;
547
- ora$2("Checking node version...");
547
+ const spinner = ora$2("Checking node version...");
548
548
  const [major, minor] = process.versions.node.split(".").map(Number);
549
- const engines = require("../package.json").engines.node;
550
- const [minMajor, minMinor] = engines
549
+ const packageJson = await Promise.resolve().then(function () { return _package$1; });
550
+ const { engines: { node }, } = packageJson;
551
+ const [minMajor, minMinor] = node
551
552
  .split(".")
552
553
  .map((v) => v.replace(/[^\d]/g, ""))
553
554
  .map(Number);
554
555
  if (major < minMajor || (major === minMajor && minor < minMinor)) {
555
- ora$2({
556
+ spinner.fail({
556
557
  text: `Node version ${minMajor}.${minMinor} or higher is required. You are running ${major}.${minor}.`,
557
558
  color: "red",
558
- }).fail();
559
+ });
559
560
  process.exit(1);
560
561
  }
562
+ else {
563
+ return true;
564
+ }
561
565
  };
562
566
  /**
563
567
  * Get the value of a process argument by key
@@ -674,16 +678,20 @@ async function createManifest({ ctx, typesFileName, metaFileName, editorsMetaFil
674
678
  await fs__namespace.writeFile(path__namespace.join(ctx.client.tmpDir, "embeddable-manifest.json"), JSON.stringify(manifest));
675
679
  }
676
680
  async function extractBuild(ctx) {
677
- const [[, stencilWrapperFilePath]] = await findFiles(ctx.client.stencilBuild, /embeddable-wrapper.esm-[a-z0-9]+\.js/);
681
+ const stencilBuildFiles = await findFiles(ctx.client.stencilBuild, /embeddable-wrapper.esm-[a-z0-9]+\.js/);
682
+ const [[, stencilWrapperFilePath]] = stencilBuildFiles || [];
678
683
  const stencilWrapperFileName = path__namespace.basename(stencilWrapperFilePath);
679
684
  await fs__namespace.rename(path__namespace.resolve(ctx.client.buildDir, ctx.client.stencilBuild), ctx.client.tmpDir);
680
- const [[, typesFilePath]] = await findFiles(ctx.client.buildDir, /embeddable-types-[a-z0-9]+\.js/);
685
+ const typesBuildFiles = await findFiles(ctx.client.buildDir, /embeddable-types-[a-z0-9]+\.js/);
686
+ const [[, typesFilePath]] = typesBuildFiles || [];
681
687
  const typesFileName = path__namespace.basename(typesFilePath);
682
688
  await fs__namespace.rename(typesFilePath, path__namespace.join(ctx.client.tmpDir, typesFileName));
683
- const [[, metaFilePath]] = await findFiles(ctx.client.buildDir, /embeddable-components-meta-[a-z0-9]+\.js/);
689
+ const metaBuildFiles = await findFiles(ctx.client.buildDir, /embeddable-components-meta-[a-z0-9]+\.js/);
690
+ const [[, metaFilePath]] = metaBuildFiles || [];
684
691
  const metaFileName = path__namespace.basename(metaFilePath);
685
692
  await fs__namespace.rename(metaFilePath, path__namespace.join(ctx.client.tmpDir, metaFileName));
686
- const [[, editorsMetaFilePath]] = await findFiles(ctx.client.buildDir, /embeddable-editors-meta-[a-z0-9]+\.js/);
693
+ const editorsMetaBuildFiles = await findFiles(ctx.client.buildDir, /embeddable-editors-meta-[a-z0-9]+\.js/);
694
+ const [[, editorsMetaFilePath]] = editorsMetaBuildFiles || [];
687
695
  const editorsMetaFileName = path__namespace.basename(editorsMetaFilePath);
688
696
  await fs__namespace.rename(editorsMetaFilePath, path__namespace.join(ctx.client.tmpDir, editorsMetaFileName));
689
697
  await createManifest({
@@ -1230,16 +1238,13 @@ PERFORMANCE OF THIS SOFTWARE.
1230
1238
  ***************************************************************************** */
1231
1239
 
1232
1240
  function __classPrivateFieldGet(receiver, state, kind, f) {
1233
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1234
1241
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1235
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1242
+ return state.get(receiver);
1236
1243
  }
1237
1244
 
1238
1245
  function __classPrivateFieldSet(receiver, state, value, kind, f) {
1239
- if (kind === "m") throw new TypeError("Private method is not writable");
1240
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1241
1246
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1242
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1247
+ return (state.set(receiver, value)), value;
1243
1248
  }
1244
1249
 
1245
1250
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
@@ -4181,10 +4186,10 @@ class ZodEnum extends ZodType {
4181
4186
  });
4182
4187
  return INVALID;
4183
4188
  }
4184
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
4185
- __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
4189
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache)) {
4190
+ __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values));
4186
4191
  }
4187
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
4192
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache).has(input.data)) {
4188
4193
  const ctx = this._getOrReturnCtx(input);
4189
4194
  const expectedValues = this._def.values;
4190
4195
  addIssueToContext(ctx, {
@@ -4253,10 +4258,10 @@ class ZodNativeEnum extends ZodType {
4253
4258
  });
4254
4259
  return INVALID;
4255
4260
  }
4256
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
4257
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util$7.getValidEnumValues(this._def.values)), "f");
4261
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache)) {
4262
+ __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util$7.getValidEnumValues(this._def.values)));
4258
4263
  }
4259
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
4264
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache).has(input.data)) {
4260
4265
  const expectedValues = util$7.objectValues(nativeEnumValues);
4261
4266
  addIssueToContext(ctx, {
4262
4267
  received: ctx.data,
@@ -4938,14 +4943,6 @@ var z = /*#__PURE__*/Object.freeze({
4938
4943
 
4939
4944
  const CUBE_YAML_FILE_REGEX = /^(.*)\.cube\.ya?ml$/;
4940
4945
  const SECURITY_CONTEXT_FILE_REGEX = /^(.*)\.sc\.ya?ml$/;
4941
- const checkNodeVersion = () => {
4942
- const [major, minor] = process.versions.node.split(".").map(Number);
4943
- const engines = require("../package.json").engines.node;
4944
- const [minMajor, minMinor] = engines.split(".").map(Number);
4945
- if (major < minMajor || (major === minMajor && minor < minMinor)) {
4946
- throw new Error(`Node version ${minMajor}.${minMinor} or higher is required. You are running ${major}.${minor}.`);
4947
- }
4948
- };
4949
4946
  var validate = async (ctx, exitIfInvalid = true) => {
4950
4947
  checkNodeVersion();
4951
4948
  const ora = (await import('ora')).default;
@@ -4975,21 +4972,26 @@ async function dataModelsValidation(filesList) {
4975
4972
  const errors = [];
4976
4973
  for (const [_, filePath] of filesList) {
4977
4974
  const fileContentRaw = await fs__namespace.readFile(filePath, "utf8");
4978
- const cube = YAML__namespace.parse(fileContentRaw);
4979
- if (!(cube === null || cube === void 0 ? void 0 : cube.cubes) && !(cube === null || cube === void 0 ? void 0 : cube.views)) {
4980
- return [`${filePath}: At least one cubes or views must be defined`];
4981
- }
4982
- const cubeModelSafeParse = cubeModelSchema.safeParse(cube);
4983
- const viewModelSafeParse = viewModelSchema.safeParse(cube);
4984
- if (cube.cubes && !cubeModelSafeParse.success) {
4985
- errorFormatter(cubeModelSafeParse.error.issues).forEach((error) => {
4986
- errors.push(`${filePath}: ${error}`);
4987
- });
4975
+ try {
4976
+ const cube = YAML__namespace.parse(fileContentRaw);
4977
+ if (!(cube === null || cube === void 0 ? void 0 : cube.cubes) && !(cube === null || cube === void 0 ? void 0 : cube.views)) {
4978
+ return [`${filePath}: At least one cubes or views must be defined`];
4979
+ }
4980
+ const cubeModelSafeParse = cubeModelSchema.safeParse(cube);
4981
+ const viewModelSafeParse = viewModelSchema.safeParse(cube);
4982
+ if (cube.cubes && !cubeModelSafeParse.success) {
4983
+ errorFormatter(cubeModelSafeParse.error.issues).forEach((error) => {
4984
+ errors.push(`${filePath}: ${error}`);
4985
+ });
4986
+ }
4987
+ if (cube.views && !viewModelSafeParse.success) {
4988
+ errorFormatter(viewModelSafeParse.error.issues).forEach((error) => {
4989
+ errors.push(`${filePath}: ${error}`);
4990
+ });
4991
+ }
4988
4992
  }
4989
- if (cube.views && !viewModelSafeParse.success) {
4990
- errorFormatter(viewModelSafeParse.error.issues).forEach((error) => {
4991
- errors.push(`${filePath}: ${error}`);
4992
- });
4993
+ catch (e) {
4994
+ errors.push(`${filePath}: ${e.message}`);
4993
4995
  }
4994
4996
  }
4995
4997
  return errors;
@@ -5128,25 +5130,25 @@ function getAugmentedNamespace(n) {
5128
5130
  return a;
5129
5131
  }
5130
5132
 
5131
- var name = "rollbar";
5132
- var version = "2.26.2";
5133
- var repository = {
5133
+ var name$1 = "rollbar";
5134
+ var version$1 = "2.26.2";
5135
+ var repository$1 = {
5134
5136
  type: "git",
5135
5137
  url: "http://github.com/rollbar/rollbar.js"
5136
5138
  };
5137
- var description = "Effortlessly track and debug errors in your JavaScript applications with Rollbar. This package includes advanced error tracking features and an intuitive interface to help you identify and fix issues more quickly.";
5138
- var keywords = [
5139
+ var description$1 = "Effortlessly track and debug errors in your JavaScript applications with Rollbar. This package includes advanced error tracking features and an intuitive interface to help you identify and fix issues more quickly.";
5140
+ var keywords$1 = [
5139
5141
  "error",
5140
5142
  "tracking",
5141
5143
  "logging",
5142
5144
  "debugging",
5143
5145
  "javascript"
5144
5146
  ];
5145
- var license = "MIT";
5146
- var main = "src/server/rollbar.js";
5147
+ var license$1 = "MIT";
5148
+ var main$1 = "src/server/rollbar.js";
5147
5149
  var browser = "dist/rollbar.umd.min.js";
5148
- var types = "./index.d.ts";
5149
- var dependencies = {
5150
+ var types$1 = "./index.d.ts";
5151
+ var dependencies$1 = {
5150
5152
  async: "~3.2.3",
5151
5153
  "console-polyfill": "0.3.0",
5152
5154
  "error-stack-parser": "^2.0.4",
@@ -5155,7 +5157,7 @@ var dependencies = {
5155
5157
  "request-ip": "~3.3.0",
5156
5158
  "source-map": "^0.5.7"
5157
5159
  };
5158
- var devDependencies = {
5160
+ var devDependencies$1 = {
5159
5161
  "babel-core": "^6.26.3",
5160
5162
  "babel-eslint": "^10.0.3",
5161
5163
  "babel-loader": "^8.0.4",
@@ -5217,7 +5219,7 @@ var devDependencies = {
5217
5219
  var optionalDependencies = {
5218
5220
  decache: "^3.0.5"
5219
5221
  };
5220
- var scripts = {
5222
+ var scripts$1 = {
5221
5223
  build: "./node_modules/.bin/grunt",
5222
5224
  test: "./node_modules/.bin/grunt test",
5223
5225
  "test-browser": "./node_modules/.bin/grunt test-browser",
@@ -5291,19 +5293,19 @@ var plugins = {
5291
5293
  }
5292
5294
  };
5293
5295
  var require$$2 = {
5294
- name: name,
5295
- version: version,
5296
- repository: repository,
5297
- description: description,
5298
- keywords: keywords,
5299
- license: license,
5300
- main: main,
5296
+ name: name$1,
5297
+ version: version$1,
5298
+ repository: repository$1,
5299
+ description: description$1,
5300
+ keywords: keywords$1,
5301
+ license: license$1,
5302
+ main: main$1,
5301
5303
  browser: browser,
5302
- types: types,
5303
- dependencies: dependencies,
5304
- devDependencies: devDependencies,
5304
+ types: types$1,
5305
+ dependencies: dependencies$1,
5306
+ devDependencies: devDependencies$1,
5305
5307
  optionalDependencies: optionalDependencies,
5306
- scripts: scripts,
5308
+ scripts: scripts$1,
5307
5309
  cdn: cdn,
5308
5310
  defaults: defaults$1,
5309
5311
  plugins: plugins
@@ -20415,7 +20417,7 @@ async function getUserData() {
20415
20417
 
20416
20418
  var build = async () => {
20417
20419
  try {
20418
- checkNodeVersion$1();
20420
+ checkNodeVersion();
20419
20421
  removeBuildSuccessFlag();
20420
20422
  const config = await provideConfig();
20421
20423
  await validate(config);
@@ -20527,7 +20529,7 @@ var push = async () => {
20527
20529
  var _a, _b;
20528
20530
  let spinnerPushing;
20529
20531
  try {
20530
- checkNodeVersion$1();
20532
+ checkNodeVersion();
20531
20533
  const isBuildSuccess = await checkBuildSuccess();
20532
20534
  if (!isBuildSuccess) {
20533
20535
  console.error("Build failed or not completed. Please run `embeddable:build` first.");
@@ -20542,10 +20544,13 @@ var push = async () => {
20542
20544
  return;
20543
20545
  }
20544
20546
  const token = await verify(config);
20547
+ spinnerPushing = ora$1()
20548
+ .start()
20549
+ .info("No API Key provided. Standard login will be used.");
20545
20550
  const { workspaceId, name: workspaceName } = await selectWorkspace(config, token);
20546
20551
  const workspacePreviewUrl = `${config.previewBaseUrl}/workspace/${workspaceId}`;
20547
20552
  await buildArchive(config);
20548
- spinnerPushing = ora$1(`Publishing to ${workspaceName} using ${workspacePreviewUrl}...`).start();
20553
+ spinnerPushing.info(`Publishing to ${workspaceName} using ${workspacePreviewUrl}...`);
20549
20554
  await sendBuild(config, { workspaceId, token });
20550
20555
  spinnerPushing.succeed(`Published to ${workspaceName} using ${workspacePreviewUrl}`);
20551
20556
  }
@@ -20732,7 +20737,7 @@ const addToGitingore = async () => {
20732
20737
  };
20733
20738
  var dev = async () => {
20734
20739
  var _a;
20735
- checkNodeVersion$1();
20740
+ checkNodeVersion();
20736
20741
  addToGitingore();
20737
20742
  const http = require("http");
20738
20743
  ora = (await oraP).default;
@@ -20961,6 +20966,111 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
20961
20966
  };
20962
20967
  };
20963
20968
 
20969
+ var name = "@embeddable.com/sdk-core";
20970
+ var version = "3.4.1";
20971
+ var description = "Core Embeddable SDK module responsible for web-components bundling and publishing.";
20972
+ var keywords = [
20973
+ "embeddable",
20974
+ "sdk",
20975
+ "web-components"
20976
+ ];
20977
+ var main = "lib/index.js";
20978
+ var module$1 = "lib/index.esm.js";
20979
+ var types = "lib/index.d.ts";
20980
+ var repository = {
20981
+ type: "git",
20982
+ url: "git+https://github.com/embeddable-hq/embeddable-sdk.git",
20983
+ directory: "packages/core-sdk"
20984
+ };
20985
+ var scripts = {
20986
+ build: "rollup -c",
20987
+ test: "vitest run",
20988
+ "test:watch": "vitest"
20989
+ };
20990
+ var author = "Embeddable.com <engineering@embeddable.com>";
20991
+ var files = [
20992
+ "bin/",
20993
+ "src/",
20994
+ "lib/",
20995
+ "loader/",
20996
+ "templates/",
20997
+ "configs/"
20998
+ ];
20999
+ var bin = {
21000
+ embeddable: "bin/embeddable"
21001
+ };
21002
+ var engines = {
21003
+ node: ">=18.0.0"
21004
+ };
21005
+ var license = "MIT";
21006
+ var dependencies = {
21007
+ "@embeddable.com/sdk-utils": "*",
21008
+ "@inquirer/select": "^1.3.0",
21009
+ "@stencil/core": "^4.18.2",
21010
+ "@swc-node/register": "^1.9.0",
21011
+ archiver: "^5.3.1",
21012
+ axios: "^1.7.2",
21013
+ chokidar: "^3.6.0",
21014
+ finalhandler: "^1.2.0",
21015
+ "formdata-node": "^6.0.3",
21016
+ minimist: "^1.2.8",
21017
+ open: "^9.1.0",
21018
+ ora: "^8.0.1",
21019
+ "serve-static": "^1.15.0",
21020
+ sorcery: "^0.11.0",
21021
+ vite: "^5.3.2",
21022
+ ws: "^8.17.0",
21023
+ yaml: "^2.3.3"
21024
+ };
21025
+ var devDependencies = {
21026
+ "@types/archiver": "^5.3.4",
21027
+ "@types/ws": "^8.5.10"
21028
+ };
21029
+ var _package = {
21030
+ name: name,
21031
+ version: version,
21032
+ description: description,
21033
+ keywords: keywords,
21034
+ main: main,
21035
+ module: module$1,
21036
+ types: types,
21037
+ repository: repository,
21038
+ scripts: scripts,
21039
+ author: author,
21040
+ files: files,
21041
+ bin: bin,
21042
+ engines: engines,
21043
+ license: license,
21044
+ dependencies: dependencies,
21045
+ "lint-staged": {
21046
+ "*.{js,ts,json}": [
21047
+ "prettier --write"
21048
+ ]
21049
+ },
21050
+ devDependencies: devDependencies
21051
+ };
21052
+
21053
+ var _package$1 = /*#__PURE__*/Object.freeze({
21054
+ __proto__: null,
21055
+ author: author,
21056
+ bin: bin,
21057
+ default: _package,
21058
+ dependencies: dependencies,
21059
+ description: description,
21060
+ devDependencies: devDependencies,
21061
+ engines: engines,
21062
+ files: files,
21063
+ keywords: keywords,
21064
+ license: license,
21065
+ main: main,
21066
+ module: module$1,
21067
+ name: name,
21068
+ repository: repository,
21069
+ scripts: scripts,
21070
+ types: types,
21071
+ version: version
21072
+ });
21073
+
20964
21074
  var __accessCheck = (obj, member, msg) => {
20965
21075
  if (!member.has(obj))
20966
21076
  throw TypeError("Cannot " + msg);
@@ -20976,7 +21086,7 @@ var __privateAdd = (obj, member, value) => {
20976
21086
  };
20977
21087
  var __privateSet = (obj, member, value, setter) => {
20978
21088
  __accessCheck(obj, member, "write to private field");
20979
- setter ? setter.call(obj, value) : member.set(obj, value);
21089
+ member.set(obj, value);
20980
21090
  return value;
20981
21091
  };
20982
21092