@cedarjs/cli 6.0.0-canary.2766 → 6.0.0-canary.2769
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.
|
@@ -4,7 +4,6 @@ import * as parser from "@babel/parser";
|
|
|
4
4
|
import * as t from "@babel/types";
|
|
5
5
|
import execa from "execa";
|
|
6
6
|
import { Listr } from "listr2";
|
|
7
|
-
import * as recast from "recast";
|
|
8
7
|
import { getConfigPath, getConfig } from "@cedarjs/project-config";
|
|
9
8
|
import { getPaths, writeFilesTask } from "../../../../lib/index.js";
|
|
10
9
|
const updateApiURLTask = (apiUrl) => {
|
|
@@ -88,14 +87,6 @@ const verifyUDSetupTask = () => {
|
|
|
88
87
|
}
|
|
89
88
|
};
|
|
90
89
|
};
|
|
91
|
-
function posToIndex(str, line, column) {
|
|
92
|
-
const lines = str.split("\n");
|
|
93
|
-
let index = 0;
|
|
94
|
-
for (let i = 0; i < line - 1; i++) {
|
|
95
|
-
index += lines[i].length + 1;
|
|
96
|
-
}
|
|
97
|
-
return index + column;
|
|
98
|
-
}
|
|
99
90
|
function resolveConfigObject(arg) {
|
|
100
91
|
if (t.isObjectExpression(arg)) {
|
|
101
92
|
return arg;
|
|
@@ -127,15 +118,9 @@ function insertPluginsBeforeCedar({
|
|
|
127
118
|
content,
|
|
128
119
|
pluginCodes
|
|
129
120
|
}) {
|
|
130
|
-
const ast =
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return parser.parse(source, {
|
|
134
|
-
sourceType: "module",
|
|
135
|
-
plugins: ["typescript", "jsx"]
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}
|
|
121
|
+
const ast = parser.parse(content, {
|
|
122
|
+
sourceType: "module",
|
|
123
|
+
plugins: ["typescript", "jsx"]
|
|
139
124
|
});
|
|
140
125
|
const defaultExport = ast.program.body.find(t.isExportDefaultDeclaration);
|
|
141
126
|
if (!defaultExport) {
|
|
@@ -163,33 +148,18 @@ function insertPluginsBeforeCedar({
|
|
|
163
148
|
return null;
|
|
164
149
|
}
|
|
165
150
|
const cedarNode = cedarElement;
|
|
166
|
-
if (!cedarNode.loc || !arrayExpr.loc || !pluginsProp.loc) {
|
|
151
|
+
if (!cedarNode.loc || !arrayExpr.loc || !pluginsProp.loc || cedarNode.start == null || arrayExpr.start == null || arrayExpr.end == null) {
|
|
167
152
|
return null;
|
|
168
153
|
}
|
|
169
154
|
const isInline = cedarNode.loc.start.line === arrayExpr.loc.start.line;
|
|
170
155
|
if (isInline) {
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
arrayExpr.loc.start.line,
|
|
174
|
-
arrayExpr.loc.start.column
|
|
175
|
-
);
|
|
176
|
-
const endPos = posToIndex(
|
|
177
|
-
content,
|
|
178
|
-
arrayExpr.loc.end.line,
|
|
179
|
-
arrayExpr.loc.end.column
|
|
180
|
-
);
|
|
181
|
-
const precedingText = content.slice(0, startPos);
|
|
182
|
-
const followingText = content.slice(endPos);
|
|
156
|
+
const precedingText = content.slice(0, arrayExpr.start);
|
|
157
|
+
const followingText = content.slice(arrayExpr.end);
|
|
183
158
|
const existingCodes = elements.flatMap((el) => {
|
|
184
|
-
if (
|
|
159
|
+
if (el?.start == null || el.end == null) {
|
|
185
160
|
return [];
|
|
186
161
|
}
|
|
187
|
-
return [
|
|
188
|
-
content.slice(
|
|
189
|
-
posToIndex(content, el.loc.start.line, el.loc.start.column),
|
|
190
|
-
posToIndex(content, el.loc.end.line, el.loc.end.column)
|
|
191
|
-
)
|
|
192
|
-
];
|
|
162
|
+
return [content.slice(el.start, el.end)];
|
|
193
163
|
});
|
|
194
164
|
const lines2 = content.split("\n");
|
|
195
165
|
const pluginsLine = pluginsProp.loc.start.line;
|
|
@@ -205,7 +175,7 @@ function insertPluginsBeforeCedar({
|
|
|
205
175
|
return precedingText + multiline + followingText;
|
|
206
176
|
}
|
|
207
177
|
const cedarLine = cedarNode.loc.start.line;
|
|
208
|
-
const insertPos =
|
|
178
|
+
const insertPos = cedarNode.start - cedarNode.loc.start.column;
|
|
209
179
|
const lines = content.split("\n");
|
|
210
180
|
const indent = (lines[cedarLine - 1].match(/^\s*/) ?? [""])[0];
|
|
211
181
|
const insertion = pluginCodes.map((code) => `${indent}${code},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "6.0.0-canary.
|
|
3
|
+
"version": "6.0.0-canary.2769",
|
|
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.7",
|
|
35
35
|
"@babel/preset-typescript": "7.29.7",
|
|
36
|
-
"@cedarjs/api-server": "6.0.0-canary.
|
|
37
|
-
"@cedarjs/cli-helpers": "6.0.0-canary.
|
|
38
|
-
"@cedarjs/fastify-web": "6.0.0-canary.
|
|
39
|
-
"@cedarjs/internal": "6.0.0-canary.
|
|
40
|
-
"@cedarjs/prerender": "6.0.0-canary.
|
|
41
|
-
"@cedarjs/project-config": "6.0.0-canary.
|
|
42
|
-
"@cedarjs/structure": "6.0.0-canary.
|
|
43
|
-
"@cedarjs/telemetry": "6.0.0-canary.
|
|
44
|
-
"@cedarjs/utils": "6.0.0-canary.
|
|
45
|
-
"@cedarjs/vite": "6.0.0-canary.
|
|
46
|
-
"@cedarjs/web-server": "6.0.0-canary.
|
|
36
|
+
"@cedarjs/api-server": "6.0.0-canary.2769",
|
|
37
|
+
"@cedarjs/cli-helpers": "6.0.0-canary.2769",
|
|
38
|
+
"@cedarjs/fastify-web": "6.0.0-canary.2769",
|
|
39
|
+
"@cedarjs/internal": "6.0.0-canary.2769",
|
|
40
|
+
"@cedarjs/prerender": "6.0.0-canary.2769",
|
|
41
|
+
"@cedarjs/project-config": "6.0.0-canary.2769",
|
|
42
|
+
"@cedarjs/structure": "6.0.0-canary.2769",
|
|
43
|
+
"@cedarjs/telemetry": "6.0.0-canary.2769",
|
|
44
|
+
"@cedarjs/utils": "6.0.0-canary.2769",
|
|
45
|
+
"@cedarjs/vite": "6.0.0-canary.2769",
|
|
46
|
+
"@cedarjs/web-server": "6.0.0-canary.2769",
|
|
47
47
|
"@listr2/prompt-adapter-enquirer": "4.3.0",
|
|
48
48
|
"@opentelemetry/api": "1.9.1",
|
|
49
49
|
"@opentelemetry/core": "1.30.1",
|
|
@@ -80,7 +80,6 @@
|
|
|
80
80
|
"prettier": "3.8.4",
|
|
81
81
|
"prisma": "7.8.0",
|
|
82
82
|
"prompts": "2.4.2",
|
|
83
|
-
"recast": "0.23.12",
|
|
84
83
|
"rimraf": "6.1.3",
|
|
85
84
|
"semver": "7.7.4",
|
|
86
85
|
"smol-toml": "1.6.1",
|