@embeddable.com/sdk-core 3.3.1 → 3.4.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
@@ -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;
@@ -5128,25 +5125,25 @@ function getAugmentedNamespace(n) {
5128
5125
  return a;
5129
5126
  }
5130
5127
 
5131
- var name = "rollbar";
5132
- var version = "2.26.2";
5133
- var repository = {
5128
+ var name$1 = "rollbar";
5129
+ var version$1 = "2.26.2";
5130
+ var repository$1 = {
5134
5131
  type: "git",
5135
5132
  url: "http://github.com/rollbar/rollbar.js"
5136
5133
  };
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 = [
5134
+ 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.";
5135
+ var keywords$1 = [
5139
5136
  "error",
5140
5137
  "tracking",
5141
5138
  "logging",
5142
5139
  "debugging",
5143
5140
  "javascript"
5144
5141
  ];
5145
- var license = "MIT";
5146
- var main = "src/server/rollbar.js";
5142
+ var license$1 = "MIT";
5143
+ var main$1 = "src/server/rollbar.js";
5147
5144
  var browser = "dist/rollbar.umd.min.js";
5148
- var types = "./index.d.ts";
5149
- var dependencies = {
5145
+ var types$1 = "./index.d.ts";
5146
+ var dependencies$1 = {
5150
5147
  async: "~3.2.3",
5151
5148
  "console-polyfill": "0.3.0",
5152
5149
  "error-stack-parser": "^2.0.4",
@@ -5155,7 +5152,7 @@ var dependencies = {
5155
5152
  "request-ip": "~3.3.0",
5156
5153
  "source-map": "^0.5.7"
5157
5154
  };
5158
- var devDependencies = {
5155
+ var devDependencies$1 = {
5159
5156
  "babel-core": "^6.26.3",
5160
5157
  "babel-eslint": "^10.0.3",
5161
5158
  "babel-loader": "^8.0.4",
@@ -5217,7 +5214,7 @@ var devDependencies = {
5217
5214
  var optionalDependencies = {
5218
5215
  decache: "^3.0.5"
5219
5216
  };
5220
- var scripts = {
5217
+ var scripts$1 = {
5221
5218
  build: "./node_modules/.bin/grunt",
5222
5219
  test: "./node_modules/.bin/grunt test",
5223
5220
  "test-browser": "./node_modules/.bin/grunt test-browser",
@@ -5291,19 +5288,19 @@ var plugins = {
5291
5288
  }
5292
5289
  };
5293
5290
  var require$$2 = {
5294
- name: name,
5295
- version: version,
5296
- repository: repository,
5297
- description: description,
5298
- keywords: keywords,
5299
- license: license,
5300
- main: main,
5291
+ name: name$1,
5292
+ version: version$1,
5293
+ repository: repository$1,
5294
+ description: description$1,
5295
+ keywords: keywords$1,
5296
+ license: license$1,
5297
+ main: main$1,
5301
5298
  browser: browser,
5302
- types: types,
5303
- dependencies: dependencies,
5304
- devDependencies: devDependencies,
5299
+ types: types$1,
5300
+ dependencies: dependencies$1,
5301
+ devDependencies: devDependencies$1,
5305
5302
  optionalDependencies: optionalDependencies,
5306
- scripts: scripts,
5303
+ scripts: scripts$1,
5307
5304
  cdn: cdn,
5308
5305
  defaults: defaults$1,
5309
5306
  plugins: plugins
@@ -20415,7 +20412,7 @@ async function getUserData() {
20415
20412
 
20416
20413
  var build = async () => {
20417
20414
  try {
20418
- checkNodeVersion$1();
20415
+ checkNodeVersion();
20419
20416
  removeBuildSuccessFlag();
20420
20417
  const config = await provideConfig();
20421
20418
  await validate(config);
@@ -20527,7 +20524,7 @@ var push = async () => {
20527
20524
  var _a, _b;
20528
20525
  let spinnerPushing;
20529
20526
  try {
20530
- checkNodeVersion$1();
20527
+ checkNodeVersion();
20531
20528
  const isBuildSuccess = await checkBuildSuccess();
20532
20529
  if (!isBuildSuccess) {
20533
20530
  console.error("Build failed or not completed. Please run `embeddable:build` first.");
@@ -20542,10 +20539,13 @@ var push = async () => {
20542
20539
  return;
20543
20540
  }
20544
20541
  const token = await verify(config);
20542
+ spinnerPushing = ora$1()
20543
+ .start()
20544
+ .info("No API Key provided. Standard login will be used.");
20545
20545
  const { workspaceId, name: workspaceName } = await selectWorkspace(config, token);
20546
20546
  const workspacePreviewUrl = `${config.previewBaseUrl}/workspace/${workspaceId}`;
20547
20547
  await buildArchive(config);
20548
- spinnerPushing = ora$1(`Publishing to ${workspaceName} using ${workspacePreviewUrl}...`).start();
20548
+ spinnerPushing.info(`Publishing to ${workspaceName} using ${workspacePreviewUrl}...`);
20549
20549
  await sendBuild(config, { workspaceId, token });
20550
20550
  spinnerPushing.succeed(`Published to ${workspaceName} using ${workspacePreviewUrl}`);
20551
20551
  }
@@ -20732,7 +20732,7 @@ const addToGitingore = async () => {
20732
20732
  };
20733
20733
  var dev = async () => {
20734
20734
  var _a;
20735
- checkNodeVersion$1();
20735
+ checkNodeVersion();
20736
20736
  addToGitingore();
20737
20737
  const http = require("http");
20738
20738
  ora = (await oraP).default;
@@ -20961,6 +20961,111 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
20961
20961
  };
20962
20962
  };
20963
20963
 
20964
+ var name = "@embeddable.com/sdk-core";
20965
+ var version = "3.4.0";
20966
+ var description = "Core Embeddable SDK module responsible for web-components bundling and publishing.";
20967
+ var keywords = [
20968
+ "embeddable",
20969
+ "sdk",
20970
+ "web-components"
20971
+ ];
20972
+ var main = "lib/index.js";
20973
+ var module$1 = "lib/index.esm.js";
20974
+ var types = "lib/index.d.ts";
20975
+ var repository = {
20976
+ type: "git",
20977
+ url: "git+https://github.com/embeddable-hq/embeddable-sdk.git",
20978
+ directory: "packages/core-sdk"
20979
+ };
20980
+ var scripts = {
20981
+ build: "rollup -c",
20982
+ test: "vitest run",
20983
+ "test:watch": "vitest"
20984
+ };
20985
+ var author = "Embeddable.com <engineering@embeddable.com>";
20986
+ var files = [
20987
+ "bin/",
20988
+ "src/",
20989
+ "lib/",
20990
+ "loader/",
20991
+ "templates/",
20992
+ "configs/"
20993
+ ];
20994
+ var bin = {
20995
+ embeddable: "bin/embeddable"
20996
+ };
20997
+ var engines = {
20998
+ node: ">=18.0.0"
20999
+ };
21000
+ var license = "MIT";
21001
+ var dependencies = {
21002
+ "@embeddable.com/sdk-utils": "*",
21003
+ "@inquirer/select": "^1.3.0",
21004
+ "@stencil/core": "^4.18.2",
21005
+ "@swc-node/register": "^1.9.0",
21006
+ archiver: "^5.3.1",
21007
+ axios: "^1.7.2",
21008
+ chokidar: "^3.6.0",
21009
+ finalhandler: "^1.2.0",
21010
+ "formdata-node": "^6.0.3",
21011
+ minimist: "^1.2.8",
21012
+ open: "^9.1.0",
21013
+ ora: "^8.0.1",
21014
+ "serve-static": "^1.15.0",
21015
+ sorcery: "^0.11.0",
21016
+ vite: "^5.3.1",
21017
+ ws: "^8.17.0",
21018
+ yaml: "^2.3.3"
21019
+ };
21020
+ var devDependencies = {
21021
+ "@types/archiver": "^5.3.4",
21022
+ "@types/ws": "^8.5.10"
21023
+ };
21024
+ var _package = {
21025
+ name: name,
21026
+ version: version,
21027
+ description: description,
21028
+ keywords: keywords,
21029
+ main: main,
21030
+ module: module$1,
21031
+ types: types,
21032
+ repository: repository,
21033
+ scripts: scripts,
21034
+ author: author,
21035
+ files: files,
21036
+ bin: bin,
21037
+ engines: engines,
21038
+ license: license,
21039
+ dependencies: dependencies,
21040
+ "lint-staged": {
21041
+ "*.{js,ts,json}": [
21042
+ "prettier --write"
21043
+ ]
21044
+ },
21045
+ devDependencies: devDependencies
21046
+ };
21047
+
21048
+ var _package$1 = /*#__PURE__*/Object.freeze({
21049
+ __proto__: null,
21050
+ author: author,
21051
+ bin: bin,
21052
+ default: _package,
21053
+ dependencies: dependencies,
21054
+ description: description,
21055
+ devDependencies: devDependencies,
21056
+ engines: engines,
21057
+ files: files,
21058
+ keywords: keywords,
21059
+ license: license,
21060
+ main: main,
21061
+ module: module$1,
21062
+ name: name,
21063
+ repository: repository,
21064
+ scripts: scripts,
21065
+ types: types,
21066
+ version: version
21067
+ });
21068
+
20964
21069
  var __accessCheck = (obj, member, msg) => {
20965
21070
  if (!member.has(obj))
20966
21071
  throw TypeError("Cannot " + msg);
@@ -20976,7 +21081,7 @@ var __privateAdd = (obj, member, value) => {
20976
21081
  };
20977
21082
  var __privateSet = (obj, member, value, setter) => {
20978
21083
  __accessCheck(obj, member, "write to private field");
20979
- setter ? setter.call(obj, value) : member.set(obj, value);
21084
+ member.set(obj, value);
20980
21085
  return value;
20981
21086
  };
20982
21087