@superblocksteam/cli 2.0.3-next.150 → 2.0.3-next.151

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/README.md CHANGED
@@ -14,7 +14,7 @@ $ npm install -g @superblocksteam/cli
14
14
  $ superblocks COMMAND
15
15
  running command...
16
16
  $ superblocks (--version)
17
- @superblocksteam/cli/2.0.3-next.150 linux-x64 node-v20.19.0
17
+ @superblocksteam/cli/2.0.3-next.151 linux-x64 node-v20.19.0
18
18
  $ superblocks --help [COMMAND]
19
19
  USAGE
20
20
  $ superblocks COMMAND
package/dist/index.js CHANGED
@@ -331222,7 +331222,7 @@ var import_dd_trace = __toESM(require_dd_trace2(), 1);
331222
331222
  // ../sdk/package.json
331223
331223
  var package_default = {
331224
331224
  name: "@superblocksteam/sdk",
331225
- version: "2.0.3-next.150",
331225
+ version: "2.0.3-next.151",
331226
331226
  type: "module",
331227
331227
  description: "Superblocks JS SDK",
331228
331228
  homepage: "https://www.superblocks.com",
@@ -331252,8 +331252,8 @@ var package_default = {
331252
331252
  "@rollup/wasm-node": "^4.35.0",
331253
331253
  "@superblocksteam/bucketeer-sdk": "0.4.1",
331254
331254
  "@superblocksteam/shared": "0.9115.0",
331255
- "@superblocksteam/util": "2.0.3-next.150",
331256
- "@superblocksteam/vite-plugin-file-sync": "2.0.3-next.150",
331255
+ "@superblocksteam/util": "2.0.3-next.151",
331256
+ "@superblocksteam/vite-plugin-file-sync": "2.0.3-next.151",
331257
331257
  "@vitejs/plugin-react": "^4.3.4",
331258
331258
  axios: "^1.4.0",
331259
331259
  chokidar: "^4.0.3",
@@ -343390,24 +343390,37 @@ function parseExpression(value2) {
343390
343390
  return null;
343391
343391
  }
343392
343392
  }
343393
- function functionBodyContainsThisReference(code) {
343393
+ function getFunctionBodyThisExpressionData(code) {
343394
343394
  try {
343395
+ if (code.trim().startsWith("{")) {
343396
+ code = `(${code})`;
343397
+ }
343395
343398
  const wrappingFunction = `const a = () => {
343396
- ${code}
343397
- }`;
343399
+ ${code}
343400
+ };`;
343398
343401
  const compiled = (0, import_parser2.parse)(wrappingFunction, {
343399
343402
  sourceType: "module",
343400
343403
  plugins: [["typescript", {}], "jsx"]
343401
343404
  });
343402
343405
  let hasThisReference = false;
343406
+ let hasReturnStatement = false;
343403
343407
  traverse(compiled, {
343404
343408
  ThisExpression() {
343405
343409
  hasThisReference = true;
343410
+ },
343411
+ ReturnStatement() {
343412
+ hasReturnStatement = true;
343406
343413
  }
343407
343414
  });
343408
- return hasThisReference;
343415
+ return {
343416
+ hasThisReference,
343417
+ hasReturnStatement
343418
+ };
343409
343419
  } catch {
343410
- return false;
343420
+ return {
343421
+ hasThisReference: false,
343422
+ hasReturnStatement: false
343423
+ };
343411
343424
  }
343412
343425
  }
343413
343426
  function canBeAStringLiteral(value2) {
@@ -343430,10 +343443,15 @@ function isSbComputedNode(node) {
343430
343443
  function isSbTemplateNode(node) {
343431
343444
  if (isSbComputedNode(node)) {
343432
343445
  const argument = node.get("arguments.0");
343433
- if (!argument.isArrowFunctionExpression()) {
343434
- return false;
343446
+ if (argument.isArrowFunctionExpression()) {
343447
+ return argument.get("body").isTemplateLiteral();
343435
343448
  }
343436
- return argument.get("body").isTemplateLiteral();
343449
+ if (argument.isFunctionExpression() && argument.node.body.body.length === 1) {
343450
+ const returnStatement2 = argument.get("body.body.0");
343451
+ const expression = returnStatement2.get("argument");
343452
+ return expression?.isTemplateLiteral();
343453
+ }
343454
+ return false;
343437
343455
  }
343438
343456
  return node.isTemplateLiteral();
343439
343457
  }
@@ -343485,7 +343503,11 @@ function findFirstValidExpression(testCases) {
343485
343503
  return testCases.find(isValidJSXExpression);
343486
343504
  }
343487
343505
  function toCodeComputed(value2) {
343488
- if (functionBodyContainsThisReference(value2)) {
343506
+ const { hasThisReference, hasReturnStatement } = getFunctionBodyThisExpressionData(value2);
343507
+ if (hasThisReference) {
343508
+ if (!hasReturnStatement) {
343509
+ return transformers.computed(transformers.traditional(`return ${value2}`));
343510
+ }
343489
343511
  return transformers.computed(transformers.traditional(value2));
343490
343512
  }
343491
343513
  const computedTestCases = [
@@ -343907,12 +343929,19 @@ function toValueTemplate(nodePath) {
343907
343929
  return result;
343908
343930
  }
343909
343931
  const argument = nodePath.get("arguments.0");
343910
- if (!argument.isArrowFunctionExpression()) {
343932
+ if (argument.isFunctionExpression() && argument.node.body.body.length === 1 && argument.node.body.body[0]?.type === "ReturnStatement") {
343933
+ const returnStatement2 = argument.get("body.body.0");
343934
+ const expression = returnStatement2.get("argument");
343935
+ if (expression.isTemplateLiteral()) {
343936
+ return toValueTemplate(expression);
343937
+ }
343911
343938
  return "";
343912
343939
  }
343913
- const body = argument.get("body");
343914
- if (body.isTemplateLiteral()) {
343915
- return toValueTemplate(body);
343940
+ if (argument.isArrowFunctionExpression()) {
343941
+ const body = argument.get("body");
343942
+ if (body.isTemplateLiteral()) {
343943
+ return toValueTemplate(body);
343944
+ }
343916
343945
  }
343917
343946
  return "";
343918
343947
  }
@@ -375853,7 +375882,7 @@ async function startVite({ app, httpServer: httpServer2, root: root2, mode, port
375853
375882
  };
375854
375883
  const isCustomBuildEnabled2 = await isCustomComponentsEnabled();
375855
375884
  const customFolder = path21.join(root2, "custom");
375856
- const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.3-next.150";
375885
+ const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.3-next.151";
375857
375886
  const env3 = loadEnv(mode, root2, "");
375858
375887
  const hmrPort = await getFreePort();
375859
375888
  const hmrOptions = {
@@ -509,5 +509,5 @@
509
509
  "strict": true
510
510
  }
511
511
  },
512
- "version": "2.0.3-next.150"
512
+ "version": "2.0.3-next.151"
513
513
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/cli",
3
- "version": "2.0.3-next.150",
3
+ "version": "2.0.3-next.151",
4
4
  "type": "module",
5
5
  "description": "Official Superblocks CLI",
6
6
  "homepage": "https://www.superblocks.com",
@@ -42,9 +42,9 @@
42
42
  "devDependencies": {
43
43
  "@eslint/js": "^9.16.0",
44
44
  "@oclif/test": "^4.1.11",
45
- "@superblocksteam/sdk": "2.0.3-next.150",
45
+ "@superblocksteam/sdk": "2.0.3-next.151",
46
46
  "@superblocksteam/shared": "0.9115.0",
47
- "@superblocksteam/util": "2.0.3-next.150",
47
+ "@superblocksteam/util": "2.0.3-next.151",
48
48
  "@types/babel__core": "^7.20.0",
49
49
  "@types/chai": "^4",
50
50
  "@types/fs-extra": "^11.0.1",