@cedarjs/cli 5.0.0-canary.2383 → 5.0.0-canary.2385

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.
@@ -95,6 +95,33 @@ function posToIndex(str, line, column) {
95
95
  }
96
96
  return index + column;
97
97
  }
98
+ function resolveConfigObject(arg) {
99
+ if (t.isObjectExpression(arg)) {
100
+ return arg;
101
+ }
102
+ if (t.isArrowFunctionExpression(arg)) {
103
+ if (t.isObjectExpression(arg.body)) {
104
+ return arg.body;
105
+ }
106
+ if (t.isBlockStatement(arg.body)) {
107
+ const returnStmt = arg.body.body.find((s) => t.isReturnStatement(s));
108
+ if (returnStmt && t.isObjectExpression(returnStmt.argument)) {
109
+ return returnStmt.argument;
110
+ }
111
+ }
112
+ return null;
113
+ }
114
+ if (t.isFunctionExpression(arg)) {
115
+ if (t.isBlockStatement(arg.body)) {
116
+ const returnStmt = arg.body.body.find((s) => t.isReturnStatement(s));
117
+ if (returnStmt && t.isObjectExpression(returnStmt.argument)) {
118
+ return returnStmt.argument;
119
+ }
120
+ }
121
+ return null;
122
+ }
123
+ return null;
124
+ }
98
125
  function insertPluginsBeforeCedar({ content, pluginCodes }) {
99
126
  const ast = recast.parse(content, {
100
127
  parser: {
@@ -112,8 +139,8 @@ function insertPluginsBeforeCedar({ content, pluginCodes }) {
112
139
  if (!defaultExport) {
113
140
  return null;
114
141
  }
115
- const configArg = defaultExport.declaration.arguments[0];
116
- if (!t.isObjectExpression(configArg)) {
142
+ const configArg = resolveConfigObject(defaultExport.declaration.arguments[0]);
143
+ if (!configArg) {
117
144
  return null;
118
145
  }
119
146
  const pluginsProp = configArg.properties.find(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "5.0.0-canary.2383",
3
+ "version": "5.0.0-canary.2385",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,17 +33,17 @@
33
33
  "dependencies": {
34
34
  "@babel/parser": "7.29.3",
35
35
  "@babel/preset-typescript": "7.28.5",
36
- "@cedarjs/api-server": "5.0.0-canary.2383",
37
- "@cedarjs/cli-helpers": "5.0.0-canary.2383",
38
- "@cedarjs/fastify-web": "5.0.0-canary.2383",
39
- "@cedarjs/internal": "5.0.0-canary.2383",
40
- "@cedarjs/prerender": "5.0.0-canary.2383",
41
- "@cedarjs/project-config": "5.0.0-canary.2383",
42
- "@cedarjs/structure": "5.0.0-canary.2383",
43
- "@cedarjs/telemetry": "5.0.0-canary.2383",
44
- "@cedarjs/utils": "5.0.0-canary.2383",
45
- "@cedarjs/vite": "5.0.0-canary.2383",
46
- "@cedarjs/web-server": "5.0.0-canary.2383",
36
+ "@cedarjs/api-server": "5.0.0-canary.2385",
37
+ "@cedarjs/cli-helpers": "5.0.0-canary.2385",
38
+ "@cedarjs/fastify-web": "5.0.0-canary.2385",
39
+ "@cedarjs/internal": "5.0.0-canary.2385",
40
+ "@cedarjs/prerender": "5.0.0-canary.2385",
41
+ "@cedarjs/project-config": "5.0.0-canary.2385",
42
+ "@cedarjs/structure": "5.0.0-canary.2385",
43
+ "@cedarjs/telemetry": "5.0.0-canary.2385",
44
+ "@cedarjs/utils": "5.0.0-canary.2385",
45
+ "@cedarjs/vite": "5.0.0-canary.2385",
46
+ "@cedarjs/web-server": "5.0.0-canary.2385",
47
47
  "@listr2/prompt-adapter-enquirer": "4.2.1",
48
48
  "@opentelemetry/api": "1.9.0",
49
49
  "@opentelemetry/core": "1.30.1",