@cedarjs/cli 5.0.0-canary.2477 → 5.0.0-canary.2478
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/dist/commands/experimental/setupReactCompilerHandler.js +10 -5
- package/dist/commands/experimental/setupStreamingSsrHandler.js +9 -4
- package/dist/commands/generate/component/componentHandler.js +16 -9
- package/dist/commands/generate/function/functionHandler.js +21 -12
- package/dist/commands/generate/realtime/realtimeHandler.js +14 -5
- package/dist/plugin.js +10 -6
- package/package.json +12 -12
|
@@ -13,7 +13,10 @@ import {
|
|
|
13
13
|
EXPERIMENTAL_TOPIC_ID
|
|
14
14
|
} from "./setupReactCompiler.js";
|
|
15
15
|
import { printTaskEpilogue } from "./util.js";
|
|
16
|
-
const handler = async ({
|
|
16
|
+
const handler = async ({
|
|
17
|
+
force,
|
|
18
|
+
verbose
|
|
19
|
+
}) => {
|
|
17
20
|
const rwPaths = getPaths();
|
|
18
21
|
const configTomlPath = getConfigPath();
|
|
19
22
|
const configFileName = path.basename(configTomlPath);
|
|
@@ -37,7 +40,7 @@ const handler = async ({ force, verbose }) => {
|
|
|
37
40
|
);
|
|
38
41
|
const reactVersion = webPkgJson["dependencies"]["react"];
|
|
39
42
|
const coercedReactVersion = semver.coerce(reactVersion);
|
|
40
|
-
if (!semver.gte(coercedReactVersion, "19.0.0")) {
|
|
43
|
+
if (!coercedReactVersion || !semver.gte(coercedReactVersion, "19.0.0")) {
|
|
41
44
|
throw new Error(
|
|
42
45
|
"You need to be using at least React version 19 to enable the React Compiler"
|
|
43
46
|
);
|
|
@@ -118,9 +121,11 @@ const handler = async ({ force, verbose }) => {
|
|
|
118
121
|
try {
|
|
119
122
|
await tasks.run();
|
|
120
123
|
} catch (e) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
process.
|
|
124
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
125
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
126
|
+
errorTelemetry(process.argv, message);
|
|
127
|
+
console.error(c.error(message));
|
|
128
|
+
process.exit(exitCode);
|
|
124
129
|
}
|
|
125
130
|
};
|
|
126
131
|
export {
|
|
@@ -13,7 +13,10 @@ import {
|
|
|
13
13
|
EXPERIMENTAL_TOPIC_ID
|
|
14
14
|
} from "./setupStreamingSsr.js";
|
|
15
15
|
import { printTaskEpilogue } from "./util.js";
|
|
16
|
-
const handler = async ({
|
|
16
|
+
const handler = async ({
|
|
17
|
+
force,
|
|
18
|
+
verbose
|
|
19
|
+
}) => {
|
|
17
20
|
const rwPaths = getPaths();
|
|
18
21
|
const configPath = getConfigPath();
|
|
19
22
|
const configContent = fs.readFileSync(configPath, "utf-8");
|
|
@@ -197,9 +200,11 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
|
|
|
197
200
|
try {
|
|
198
201
|
await tasks.run();
|
|
199
202
|
} catch (e) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
process.
|
|
203
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
204
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
205
|
+
errorTelemetry(process.argv, message);
|
|
206
|
+
console.error(c.error(message));
|
|
207
|
+
process.exit(exitCode);
|
|
203
208
|
}
|
|
204
209
|
};
|
|
205
210
|
export {
|
|
@@ -4,7 +4,11 @@ import {
|
|
|
4
4
|
templateForComponentFile
|
|
5
5
|
} from "../yargsHandlerHelpers.js";
|
|
6
6
|
const REDWOOD_WEB_PATH_NAME = "components";
|
|
7
|
-
const files = async ({
|
|
7
|
+
const files = async ({
|
|
8
|
+
name,
|
|
9
|
+
typescript = false,
|
|
10
|
+
...argv
|
|
11
|
+
}) => {
|
|
8
12
|
const extension = typescript ? ".tsx" : ".jsx";
|
|
9
13
|
const componentFile = await templateForComponentFile({
|
|
10
14
|
name,
|
|
@@ -36,14 +40,17 @@ const files = async ({ name, typescript = false, ...argv }) => {
|
|
|
36
40
|
if (argv.tests) {
|
|
37
41
|
files2.push(testFile);
|
|
38
42
|
}
|
|
39
|
-
return files2.reduce(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
return files2.reduce(
|
|
44
|
+
async (accP, [outputPath, content]) => {
|
|
45
|
+
const acc = await accP;
|
|
46
|
+
const template = typescript ? content : await transformTSToJS(outputPath, content);
|
|
47
|
+
return {
|
|
48
|
+
[outputPath]: template,
|
|
49
|
+
...acc
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
Promise.resolve({})
|
|
53
|
+
);
|
|
47
54
|
};
|
|
48
55
|
const handler = createHandler({
|
|
49
56
|
componentName: "component",
|
|
@@ -43,16 +43,23 @@ const files = async ({
|
|
|
43
43
|
outputFiles.push(testFile);
|
|
44
44
|
outputFiles.push(scenarioFile);
|
|
45
45
|
}
|
|
46
|
-
return outputFiles.reduce(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
return outputFiles.reduce(
|
|
47
|
+
async (accP, [outputPath, content]) => {
|
|
48
|
+
const acc = await accP;
|
|
49
|
+
const template = generateTypescript ? content : await transformTSToJS(outputPath, content);
|
|
50
|
+
return {
|
|
51
|
+
[outputPath]: template,
|
|
52
|
+
...acc
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
Promise.resolve({})
|
|
56
|
+
);
|
|
54
57
|
};
|
|
55
|
-
const handler = async ({
|
|
58
|
+
const handler = async ({
|
|
59
|
+
name,
|
|
60
|
+
force,
|
|
61
|
+
...rest
|
|
62
|
+
}) => {
|
|
56
63
|
recordTelemetryAttributes({
|
|
57
64
|
command: "generate function",
|
|
58
65
|
force,
|
|
@@ -94,9 +101,11 @@ const handler = async ({ name, force, ...rest }) => {
|
|
|
94
101
|
);
|
|
95
102
|
console.info("");
|
|
96
103
|
} catch (e) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
process.
|
|
104
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
105
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
106
|
+
errorTelemetry(process.argv, message);
|
|
107
|
+
console.error(c.error(message));
|
|
108
|
+
process.exit(exitCode);
|
|
100
109
|
}
|
|
101
110
|
};
|
|
102
111
|
export {
|
|
@@ -35,7 +35,13 @@ const templateVariables = (name) => {
|
|
|
35
35
|
subscriptionServiceResolver: `publishTo${pascalcase(name)}Channel`
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
async function handler({
|
|
38
|
+
async function handler({
|
|
39
|
+
name,
|
|
40
|
+
type,
|
|
41
|
+
force,
|
|
42
|
+
verbose,
|
|
43
|
+
silent
|
|
44
|
+
}) {
|
|
39
45
|
const cedarPaths = getPaths();
|
|
40
46
|
const ts = isTypeScriptProject();
|
|
41
47
|
name = pluralize.singular(name.toLowerCase());
|
|
@@ -65,7 +71,8 @@ async function handler({ name, type, force, verbose, silent }) {
|
|
|
65
71
|
{
|
|
66
72
|
title: "Checking for realtime environment prerequisites ...",
|
|
67
73
|
task: () => {
|
|
68
|
-
isServerFileSetup()
|
|
74
|
+
isServerFileSetup();
|
|
75
|
+
isRealtimeSetup();
|
|
69
76
|
}
|
|
70
77
|
},
|
|
71
78
|
{
|
|
@@ -209,9 +216,11 @@ async function handler({ name, type, force, verbose, silent }) {
|
|
|
209
216
|
try {
|
|
210
217
|
await tasks.run();
|
|
211
218
|
} catch (e) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
process.
|
|
219
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
220
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
221
|
+
errorTelemetry(process.argv, message);
|
|
222
|
+
console.error(c.error(message));
|
|
223
|
+
process.exit(exitCode);
|
|
215
224
|
}
|
|
216
225
|
}
|
|
217
226
|
export {
|
package/dist/plugin.js
CHANGED
|
@@ -112,7 +112,9 @@ async function loadPlugins(yargs) {
|
|
|
112
112
|
continue;
|
|
113
113
|
}
|
|
114
114
|
const commandFirstWords = [];
|
|
115
|
-
for (const [command, info] of Object.entries(
|
|
115
|
+
for (const [command, info] of Object.entries(
|
|
116
|
+
cacheEntry
|
|
117
|
+
)) {
|
|
116
118
|
commandFirstWords.push(command.split(" ")[0]);
|
|
117
119
|
commandFirstWords.push(
|
|
118
120
|
...info.aliases?.map((a) => a.split(" ")[0]) ?? []
|
|
@@ -193,16 +195,18 @@ async function loadCommandsFromCacheOrPackage(packageName, cache, autoInstall, r
|
|
|
193
195
|
return {
|
|
194
196
|
command,
|
|
195
197
|
describe: info.description,
|
|
196
|
-
aliases: info.aliases
|
|
198
|
+
aliases: info.aliases,
|
|
199
|
+
handler: () => {
|
|
200
|
+
}
|
|
197
201
|
};
|
|
198
202
|
});
|
|
199
203
|
return commands;
|
|
200
204
|
}
|
|
201
205
|
const plugin = await loadPluginPackage(packageName, void 0, autoInstall);
|
|
202
206
|
if (plugin) {
|
|
203
|
-
const
|
|
207
|
+
const rawCommands = plugin.commands ?? [];
|
|
204
208
|
const cacheUpdate = {};
|
|
205
|
-
for (const command of
|
|
209
|
+
for (const command of rawCommands) {
|
|
206
210
|
const info = {
|
|
207
211
|
aliases: command.aliases,
|
|
208
212
|
description: command.description
|
|
@@ -211,10 +215,10 @@ async function loadCommandsFromCacheOrPackage(packageName, cache, autoInstall, r
|
|
|
211
215
|
cacheUpdate[command.command] = info;
|
|
212
216
|
}
|
|
213
217
|
}
|
|
214
|
-
if (Object.keys(cacheUpdate).length > 0) {
|
|
218
|
+
if (cache && Object.keys(cacheUpdate).length > 0) {
|
|
215
219
|
cache[packageName] = cacheUpdate;
|
|
216
220
|
}
|
|
217
|
-
return commands;
|
|
221
|
+
return plugin.commands ?? [];
|
|
218
222
|
}
|
|
219
223
|
return [];
|
|
220
224
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.2478",
|
|
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.
|
|
37
|
-
"@cedarjs/cli-helpers": "5.0.0-canary.
|
|
38
|
-
"@cedarjs/fastify-web": "5.0.0-canary.
|
|
39
|
-
"@cedarjs/internal": "5.0.0-canary.
|
|
40
|
-
"@cedarjs/prerender": "5.0.0-canary.
|
|
41
|
-
"@cedarjs/project-config": "5.0.0-canary.
|
|
42
|
-
"@cedarjs/structure": "5.0.0-canary.
|
|
43
|
-
"@cedarjs/telemetry": "5.0.0-canary.
|
|
44
|
-
"@cedarjs/utils": "5.0.0-canary.
|
|
45
|
-
"@cedarjs/vite": "5.0.0-canary.
|
|
46
|
-
"@cedarjs/web-server": "5.0.0-canary.
|
|
36
|
+
"@cedarjs/api-server": "5.0.0-canary.2478",
|
|
37
|
+
"@cedarjs/cli-helpers": "5.0.0-canary.2478",
|
|
38
|
+
"@cedarjs/fastify-web": "5.0.0-canary.2478",
|
|
39
|
+
"@cedarjs/internal": "5.0.0-canary.2478",
|
|
40
|
+
"@cedarjs/prerender": "5.0.0-canary.2478",
|
|
41
|
+
"@cedarjs/project-config": "5.0.0-canary.2478",
|
|
42
|
+
"@cedarjs/structure": "5.0.0-canary.2478",
|
|
43
|
+
"@cedarjs/telemetry": "5.0.0-canary.2478",
|
|
44
|
+
"@cedarjs/utils": "5.0.0-canary.2478",
|
|
45
|
+
"@cedarjs/vite": "5.0.0-canary.2478",
|
|
46
|
+
"@cedarjs/web-server": "5.0.0-canary.2478",
|
|
47
47
|
"@listr2/prompt-adapter-enquirer": "4.2.1",
|
|
48
48
|
"@opentelemetry/api": "1.9.1",
|
|
49
49
|
"@opentelemetry/core": "1.30.1",
|