@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/bin/embeddable CHANGED
@@ -8,7 +8,11 @@ const path = require("path");
8
8
 
9
9
  // Check if the loader is already applied to avoid infinite spawning
10
10
  if (!process.env.LOADER_APPLIED) {
11
- const env = { ...process.env, LOADER_APPLIED: "1" };
11
+ const env = {
12
+ ...process.env,
13
+ LOADER_APPLIED: "1",
14
+ VITE_CJS_IGNORE_WARNING: "true", // see https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated
15
+ };
12
16
  const entryPointPath = path.join(__dirname, "../src/entryPoint.js");
13
17
  const customLoaderPath = path.join(
14
18
  __dirname,
package/lib/cleanup.d.ts CHANGED
@@ -1,2 +1,10 @@
1
1
  declare const _default: (ctx: any) => Promise<void>;
2
2
  export default _default;
3
+ type ManifestArgs = {
4
+ ctx: any;
5
+ typesFileName: string;
6
+ metaFileName: string;
7
+ editorsMetaFileName: string;
8
+ stencilWrapperFileName: string;
9
+ };
10
+ export declare function createManifest({ ctx, typesFileName, metaFileName, editorsMetaFileName, stencilWrapperFileName, }: ManifestArgs): Promise<void>;
package/lib/index.esm.js CHANGED
@@ -386,25 +386,25 @@ async function generate$1(ctx) {
386
386
  }
387
387
  async function build$1(ctx) {
388
388
  var _a;
389
+ const typesFilePath = path$1.resolve(ctx.client.buildDir, ctx.outputOptions.typesEntryPointFilename);
389
390
  await vite.build({
390
391
  logLevel: "error",
391
392
  build: {
392
393
  emptyOutDir: false,
393
394
  lib: {
394
- entry: path$1.resolve(ctx.client.buildDir, ctx.outputOptions.typesEntryPointFilename),
395
+ entry: typesFilePath,
395
396
  formats: ["es"],
396
397
  fileName: "embeddable-types",
397
398
  },
398
- rollupOptions: ((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.watch)
399
- ? undefined
400
- : {
401
- output: {
402
- entryFileNames: "embeddable-types-[hash].js",
403
- },
404
- },
405
399
  outDir: ctx.client.buildDir,
406
400
  },
407
401
  });
402
+ if (!((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.watch)) {
403
+ const fileContent = await fs$1.readFile(typesFilePath, "utf8");
404
+ const fileHash = getContentHash(fileContent);
405
+ const fileName = `embeddable-types-${fileHash}.js`;
406
+ await fs$1.rename(path$1.resolve(ctx.client.buildDir, "embeddable-types.js"), path$1.resolve(ctx.client.buildDir, fileName));
407
+ }
408
408
  }
409
409
  async function cleanup$1(ctx) {
410
410
  await fs$1.rm(path$1.resolve(ctx.client.buildDir, "embeddable-types-entry-point.js"));
@@ -515,22 +515,26 @@ const CREDENTIALS_FILE = path$1.resolve(CREDENTIALS_DIR, "credentials");
515
515
 
516
516
  const oraP$3 = import('ora');
517
517
  let ora$2;
518
- const checkNodeVersion$1 = async () => {
518
+ const checkNodeVersion = async () => {
519
519
  ora$2 = (await oraP$3).default;
520
- ora$2("Checking node version...");
520
+ const spinner = ora$2("Checking node version...");
521
521
  const [major, minor] = process.versions.node.split(".").map(Number);
522
- const engines = require("../package.json").engines.node;
523
- const [minMajor, minMinor] = engines
522
+ const packageJson = await Promise.resolve().then(function () { return _package$1; });
523
+ const { engines: { node }, } = packageJson;
524
+ const [minMajor, minMinor] = node
524
525
  .split(".")
525
526
  .map((v) => v.replace(/[^\d]/g, ""))
526
527
  .map(Number);
527
528
  if (major < minMajor || (major === minMajor && minor < minMinor)) {
528
- ora$2({
529
+ spinner.fail({
529
530
  text: `Node version ${minMajor}.${minMinor} or higher is required. You are running ${major}.${minor}.`,
530
531
  color: "red",
531
- }).fail();
532
+ });
532
533
  process.exit(1);
533
534
  }
535
+ else {
536
+ return true;
537
+ }
534
538
  };
535
539
  /**
536
540
  * Get the value of a process argument by key
@@ -647,16 +651,20 @@ async function createManifest({ ctx, typesFileName, metaFileName, editorsMetaFil
647
651
  await fs$1.writeFile(path$1.join(ctx.client.tmpDir, "embeddable-manifest.json"), JSON.stringify(manifest));
648
652
  }
649
653
  async function extractBuild(ctx) {
650
- const [[, stencilWrapperFilePath]] = await findFiles(ctx.client.stencilBuild, /embeddable-wrapper.esm-[a-z0-9]+\.js/);
654
+ const stencilBuildFiles = await findFiles(ctx.client.stencilBuild, /embeddable-wrapper.esm-[a-z0-9]+\.js/);
655
+ const [[, stencilWrapperFilePath]] = stencilBuildFiles || [];
651
656
  const stencilWrapperFileName = path$1.basename(stencilWrapperFilePath);
652
657
  await fs$1.rename(path$1.resolve(ctx.client.buildDir, ctx.client.stencilBuild), ctx.client.tmpDir);
653
- const [[, typesFilePath]] = await findFiles(ctx.client.buildDir, /embeddable-types-[a-z0-9]+\.js/);
658
+ const typesBuildFiles = await findFiles(ctx.client.buildDir, /embeddable-types-[a-z0-9]+\.js/);
659
+ const [[, typesFilePath]] = typesBuildFiles || [];
654
660
  const typesFileName = path$1.basename(typesFilePath);
655
661
  await fs$1.rename(typesFilePath, path$1.join(ctx.client.tmpDir, typesFileName));
656
- const [[, metaFilePath]] = await findFiles(ctx.client.buildDir, /embeddable-components-meta-[a-z0-9]+\.js/);
662
+ const metaBuildFiles = await findFiles(ctx.client.buildDir, /embeddable-components-meta-[a-z0-9]+\.js/);
663
+ const [[, metaFilePath]] = metaBuildFiles || [];
657
664
  const metaFileName = path$1.basename(metaFilePath);
658
665
  await fs$1.rename(metaFilePath, path$1.join(ctx.client.tmpDir, metaFileName));
659
- const [[, editorsMetaFilePath]] = await findFiles(ctx.client.buildDir, /embeddable-editors-meta-[a-z0-9]+\.js/);
666
+ const editorsMetaBuildFiles = await findFiles(ctx.client.buildDir, /embeddable-editors-meta-[a-z0-9]+\.js/);
667
+ const [[, editorsMetaFilePath]] = editorsMetaBuildFiles || [];
660
668
  const editorsMetaFileName = path$1.basename(editorsMetaFilePath);
661
669
  await fs$1.rename(editorsMetaFilePath, path$1.join(ctx.client.tmpDir, editorsMetaFileName));
662
670
  await createManifest({
@@ -1203,16 +1211,13 @@ PERFORMANCE OF THIS SOFTWARE.
1203
1211
  ***************************************************************************** */
1204
1212
 
1205
1213
  function __classPrivateFieldGet(receiver, state, kind, f) {
1206
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1207
1214
  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");
1208
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1215
+ return state.get(receiver);
1209
1216
  }
1210
1217
 
1211
1218
  function __classPrivateFieldSet(receiver, state, value, kind, f) {
1212
- if (kind === "m") throw new TypeError("Private method is not writable");
1213
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1214
1219
  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");
1215
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1220
+ return (state.set(receiver, value)), value;
1216
1221
  }
1217
1222
 
1218
1223
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
@@ -4154,10 +4159,10 @@ class ZodEnum extends ZodType {
4154
4159
  });
4155
4160
  return INVALID;
4156
4161
  }
4157
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
4158
- __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
4162
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache)) {
4163
+ __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values));
4159
4164
  }
4160
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
4165
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache).has(input.data)) {
4161
4166
  const ctx = this._getOrReturnCtx(input);
4162
4167
  const expectedValues = this._def.values;
4163
4168
  addIssueToContext(ctx, {
@@ -4226,10 +4231,10 @@ class ZodNativeEnum extends ZodType {
4226
4231
  });
4227
4232
  return INVALID;
4228
4233
  }
4229
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
4230
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util$7.getValidEnumValues(this._def.values)), "f");
4234
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache)) {
4235
+ __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util$7.getValidEnumValues(this._def.values)));
4231
4236
  }
4232
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
4237
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache).has(input.data)) {
4233
4238
  const expectedValues = util$7.objectValues(nativeEnumValues);
4234
4239
  addIssueToContext(ctx, {
4235
4240
  received: ctx.data,
@@ -4911,14 +4916,6 @@ var z = /*#__PURE__*/Object.freeze({
4911
4916
 
4912
4917
  const CUBE_YAML_FILE_REGEX = /^(.*)\.cube\.ya?ml$/;
4913
4918
  const SECURITY_CONTEXT_FILE_REGEX = /^(.*)\.sc\.ya?ml$/;
4914
- const checkNodeVersion = () => {
4915
- const [major, minor] = process.versions.node.split(".").map(Number);
4916
- const engines = require("../package.json").engines.node;
4917
- const [minMajor, minMinor] = engines.split(".").map(Number);
4918
- if (major < minMajor || (major === minMajor && minor < minMinor)) {
4919
- throw new Error(`Node version ${minMajor}.${minMinor} or higher is required. You are running ${major}.${minor}.`);
4920
- }
4921
- };
4922
4919
  var validate = async (ctx, exitIfInvalid = true) => {
4923
4920
  checkNodeVersion();
4924
4921
  const ora = (await import('ora')).default;
@@ -4948,21 +4945,26 @@ async function dataModelsValidation(filesList) {
4948
4945
  const errors = [];
4949
4946
  for (const [_, filePath] of filesList) {
4950
4947
  const fileContentRaw = await fs$1.readFile(filePath, "utf8");
4951
- const cube = YAML.parse(fileContentRaw);
4952
- if (!(cube === null || cube === void 0 ? void 0 : cube.cubes) && !(cube === null || cube === void 0 ? void 0 : cube.views)) {
4953
- return [`${filePath}: At least one cubes or views must be defined`];
4954
- }
4955
- const cubeModelSafeParse = cubeModelSchema.safeParse(cube);
4956
- const viewModelSafeParse = viewModelSchema.safeParse(cube);
4957
- if (cube.cubes && !cubeModelSafeParse.success) {
4958
- errorFormatter(cubeModelSafeParse.error.issues).forEach((error) => {
4959
- errors.push(`${filePath}: ${error}`);
4960
- });
4948
+ try {
4949
+ const cube = YAML.parse(fileContentRaw);
4950
+ if (!(cube === null || cube === void 0 ? void 0 : cube.cubes) && !(cube === null || cube === void 0 ? void 0 : cube.views)) {
4951
+ return [`${filePath}: At least one cubes or views must be defined`];
4952
+ }
4953
+ const cubeModelSafeParse = cubeModelSchema.safeParse(cube);
4954
+ const viewModelSafeParse = viewModelSchema.safeParse(cube);
4955
+ if (cube.cubes && !cubeModelSafeParse.success) {
4956
+ errorFormatter(cubeModelSafeParse.error.issues).forEach((error) => {
4957
+ errors.push(`${filePath}: ${error}`);
4958
+ });
4959
+ }
4960
+ if (cube.views && !viewModelSafeParse.success) {
4961
+ errorFormatter(viewModelSafeParse.error.issues).forEach((error) => {
4962
+ errors.push(`${filePath}: ${error}`);
4963
+ });
4964
+ }
4961
4965
  }
4962
- if (cube.views && !viewModelSafeParse.success) {
4963
- errorFormatter(viewModelSafeParse.error.issues).forEach((error) => {
4964
- errors.push(`${filePath}: ${error}`);
4965
- });
4966
+ catch (e) {
4967
+ errors.push(`${filePath}: ${e.message}`);
4966
4968
  }
4967
4969
  }
4968
4970
  return errors;
@@ -5101,25 +5103,25 @@ function getAugmentedNamespace(n) {
5101
5103
  return a;
5102
5104
  }
5103
5105
 
5104
- var name = "rollbar";
5105
- var version = "2.26.2";
5106
- var repository = {
5106
+ var name$1 = "rollbar";
5107
+ var version$1 = "2.26.2";
5108
+ var repository$1 = {
5107
5109
  type: "git",
5108
5110
  url: "http://github.com/rollbar/rollbar.js"
5109
5111
  };
5110
- 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.";
5111
- var keywords = [
5112
+ 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.";
5113
+ var keywords$1 = [
5112
5114
  "error",
5113
5115
  "tracking",
5114
5116
  "logging",
5115
5117
  "debugging",
5116
5118
  "javascript"
5117
5119
  ];
5118
- var license = "MIT";
5119
- var main = "src/server/rollbar.js";
5120
+ var license$1 = "MIT";
5121
+ var main$1 = "src/server/rollbar.js";
5120
5122
  var browser = "dist/rollbar.umd.min.js";
5121
- var types = "./index.d.ts";
5122
- var dependencies = {
5123
+ var types$1 = "./index.d.ts";
5124
+ var dependencies$1 = {
5123
5125
  async: "~3.2.3",
5124
5126
  "console-polyfill": "0.3.0",
5125
5127
  "error-stack-parser": "^2.0.4",
@@ -5128,7 +5130,7 @@ var dependencies = {
5128
5130
  "request-ip": "~3.3.0",
5129
5131
  "source-map": "^0.5.7"
5130
5132
  };
5131
- var devDependencies = {
5133
+ var devDependencies$1 = {
5132
5134
  "babel-core": "^6.26.3",
5133
5135
  "babel-eslint": "^10.0.3",
5134
5136
  "babel-loader": "^8.0.4",
@@ -5190,7 +5192,7 @@ var devDependencies = {
5190
5192
  var optionalDependencies = {
5191
5193
  decache: "^3.0.5"
5192
5194
  };
5193
- var scripts = {
5195
+ var scripts$1 = {
5194
5196
  build: "./node_modules/.bin/grunt",
5195
5197
  test: "./node_modules/.bin/grunt test",
5196
5198
  "test-browser": "./node_modules/.bin/grunt test-browser",
@@ -5264,19 +5266,19 @@ var plugins = {
5264
5266
  }
5265
5267
  };
5266
5268
  var require$$2 = {
5267
- name: name,
5268
- version: version,
5269
- repository: repository,
5270
- description: description,
5271
- keywords: keywords,
5272
- license: license,
5273
- main: main,
5269
+ name: name$1,
5270
+ version: version$1,
5271
+ repository: repository$1,
5272
+ description: description$1,
5273
+ keywords: keywords$1,
5274
+ license: license$1,
5275
+ main: main$1,
5274
5276
  browser: browser,
5275
- types: types,
5276
- dependencies: dependencies,
5277
- devDependencies: devDependencies,
5277
+ types: types$1,
5278
+ dependencies: dependencies$1,
5279
+ devDependencies: devDependencies$1,
5278
5280
  optionalDependencies: optionalDependencies,
5279
- scripts: scripts,
5281
+ scripts: scripts$1,
5280
5282
  cdn: cdn,
5281
5283
  defaults: defaults$1,
5282
5284
  plugins: plugins
@@ -20388,7 +20390,7 @@ async function getUserData() {
20388
20390
 
20389
20391
  var build = async () => {
20390
20392
  try {
20391
- checkNodeVersion$1();
20393
+ checkNodeVersion();
20392
20394
  removeBuildSuccessFlag();
20393
20395
  const config = await provideConfig();
20394
20396
  await validate(config);
@@ -20500,7 +20502,7 @@ var push = async () => {
20500
20502
  var _a, _b;
20501
20503
  let spinnerPushing;
20502
20504
  try {
20503
- checkNodeVersion$1();
20505
+ checkNodeVersion();
20504
20506
  const isBuildSuccess = await checkBuildSuccess();
20505
20507
  if (!isBuildSuccess) {
20506
20508
  console.error("Build failed or not completed. Please run `embeddable:build` first.");
@@ -20515,10 +20517,13 @@ var push = async () => {
20515
20517
  return;
20516
20518
  }
20517
20519
  const token = await verify(config);
20520
+ spinnerPushing = ora$1()
20521
+ .start()
20522
+ .info("No API Key provided. Standard login will be used.");
20518
20523
  const { workspaceId, name: workspaceName } = await selectWorkspace(config, token);
20519
20524
  const workspacePreviewUrl = `${config.previewBaseUrl}/workspace/${workspaceId}`;
20520
20525
  await buildArchive(config);
20521
- spinnerPushing = ora$1(`Publishing to ${workspaceName} using ${workspacePreviewUrl}...`).start();
20526
+ spinnerPushing.info(`Publishing to ${workspaceName} using ${workspacePreviewUrl}...`);
20522
20527
  await sendBuild(config, { workspaceId, token });
20523
20528
  spinnerPushing.succeed(`Published to ${workspaceName} using ${workspacePreviewUrl}`);
20524
20529
  }
@@ -20705,7 +20710,7 @@ const addToGitingore = async () => {
20705
20710
  };
20706
20711
  var dev = async () => {
20707
20712
  var _a;
20708
- checkNodeVersion$1();
20713
+ checkNodeVersion();
20709
20714
  addToGitingore();
20710
20715
  const http = require("http");
20711
20716
  ora = (await oraP).default;
@@ -20934,6 +20939,111 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
20934
20939
  };
20935
20940
  };
20936
20941
 
20942
+ var name = "@embeddable.com/sdk-core";
20943
+ var version = "3.4.1";
20944
+ var description = "Core Embeddable SDK module responsible for web-components bundling and publishing.";
20945
+ var keywords = [
20946
+ "embeddable",
20947
+ "sdk",
20948
+ "web-components"
20949
+ ];
20950
+ var main = "lib/index.js";
20951
+ var module = "lib/index.esm.js";
20952
+ var types = "lib/index.d.ts";
20953
+ var repository = {
20954
+ type: "git",
20955
+ url: "git+https://github.com/embeddable-hq/embeddable-sdk.git",
20956
+ directory: "packages/core-sdk"
20957
+ };
20958
+ var scripts = {
20959
+ build: "rollup -c",
20960
+ test: "vitest run",
20961
+ "test:watch": "vitest"
20962
+ };
20963
+ var author = "Embeddable.com <engineering@embeddable.com>";
20964
+ var files = [
20965
+ "bin/",
20966
+ "src/",
20967
+ "lib/",
20968
+ "loader/",
20969
+ "templates/",
20970
+ "configs/"
20971
+ ];
20972
+ var bin = {
20973
+ embeddable: "bin/embeddable"
20974
+ };
20975
+ var engines = {
20976
+ node: ">=18.0.0"
20977
+ };
20978
+ var license = "MIT";
20979
+ var dependencies = {
20980
+ "@embeddable.com/sdk-utils": "*",
20981
+ "@inquirer/select": "^1.3.0",
20982
+ "@stencil/core": "^4.18.2",
20983
+ "@swc-node/register": "^1.9.0",
20984
+ archiver: "^5.3.1",
20985
+ axios: "^1.7.2",
20986
+ chokidar: "^3.6.0",
20987
+ finalhandler: "^1.2.0",
20988
+ "formdata-node": "^6.0.3",
20989
+ minimist: "^1.2.8",
20990
+ open: "^9.1.0",
20991
+ ora: "^8.0.1",
20992
+ "serve-static": "^1.15.0",
20993
+ sorcery: "^0.11.0",
20994
+ vite: "^5.3.2",
20995
+ ws: "^8.17.0",
20996
+ yaml: "^2.3.3"
20997
+ };
20998
+ var devDependencies = {
20999
+ "@types/archiver": "^5.3.4",
21000
+ "@types/ws": "^8.5.10"
21001
+ };
21002
+ var _package = {
21003
+ name: name,
21004
+ version: version,
21005
+ description: description,
21006
+ keywords: keywords,
21007
+ main: main,
21008
+ module: module,
21009
+ types: types,
21010
+ repository: repository,
21011
+ scripts: scripts,
21012
+ author: author,
21013
+ files: files,
21014
+ bin: bin,
21015
+ engines: engines,
21016
+ license: license,
21017
+ dependencies: dependencies,
21018
+ "lint-staged": {
21019
+ "*.{js,ts,json}": [
21020
+ "prettier --write"
21021
+ ]
21022
+ },
21023
+ devDependencies: devDependencies
21024
+ };
21025
+
21026
+ var _package$1 = /*#__PURE__*/Object.freeze({
21027
+ __proto__: null,
21028
+ author: author,
21029
+ bin: bin,
21030
+ default: _package,
21031
+ dependencies: dependencies,
21032
+ description: description,
21033
+ devDependencies: devDependencies,
21034
+ engines: engines,
21035
+ files: files,
21036
+ keywords: keywords,
21037
+ license: license,
21038
+ main: main,
21039
+ module: module,
21040
+ name: name,
21041
+ repository: repository,
21042
+ scripts: scripts,
21043
+ types: types,
21044
+ version: version
21045
+ });
21046
+
20937
21047
  var __accessCheck = (obj, member, msg) => {
20938
21048
  if (!member.has(obj))
20939
21049
  throw TypeError("Cannot " + msg);
@@ -20949,7 +21059,7 @@ var __privateAdd = (obj, member, value) => {
20949
21059
  };
20950
21060
  var __privateSet = (obj, member, value, setter) => {
20951
21061
  __accessCheck(obj, member, "write to private field");
20952
- setter ? setter.call(obj, value) : member.set(obj, value);
21062
+ member.set(obj, value);
20953
21063
  return value;
20954
21064
  };
20955
21065