@cedarjs/cli 5.0.0-canary.2574 → 5.0.0-canary.2576
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/lib/exec.js +18 -7
- package/package.json +12 -12
package/dist/lib/exec.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
1
|
+
import { existsSync, statSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { createServer, isRunnableDevEnvironment } from "vite";
|
|
4
4
|
import { getPaths, importStatementPath } from "@cedarjs/project-config";
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
cedarAutoImportsPlugin,
|
|
12
12
|
cedarCjsCompatPlugin
|
|
13
13
|
} from "@cedarjs/vite";
|
|
14
|
-
function
|
|
15
|
-
if (existsSync(id)) {
|
|
14
|
+
function resolveId(id) {
|
|
15
|
+
if (existsSync(id) && statSync(id).isFile()) {
|
|
16
16
|
return id;
|
|
17
17
|
}
|
|
18
18
|
const withoutExt = /\.jsx?$/.test(id) ? id.replace(/\.jsx?$/, "") : id;
|
|
@@ -21,6 +21,16 @@ function resolveExtension(id) {
|
|
|
21
21
|
return withoutExt + ext;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
if (existsSync(id) && statSync(id).isDirectory()) {
|
|
25
|
+
for (const base of ["index", path.basename(id)]) {
|
|
26
|
+
for (const ext of [".ts", ".tsx", ".js", ".jsx"]) {
|
|
27
|
+
const candidate = path.join(id, base + ext);
|
|
28
|
+
if (existsSync(candidate)) {
|
|
29
|
+
return candidate;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
24
34
|
return id;
|
|
25
35
|
}
|
|
26
36
|
async function runScriptFunction({
|
|
@@ -69,12 +79,12 @@ async function runScriptFunction({
|
|
|
69
79
|
const webImportBase = importStatementPath(getPaths().web.base);
|
|
70
80
|
if (importer?.startsWith(apiImportBase)) {
|
|
71
81
|
const apiImportSrc = importStatementPath(getPaths().api.src);
|
|
72
|
-
const
|
|
73
|
-
return { id:
|
|
82
|
+
const apiId = id.replace("src", apiImportSrc);
|
|
83
|
+
return { id: resolveId(apiId) };
|
|
74
84
|
} else if (importer?.startsWith(webImportBase)) {
|
|
75
85
|
const webImportSrc = importStatementPath(getPaths().web.src);
|
|
76
|
-
const
|
|
77
|
-
return { id:
|
|
86
|
+
const webId = id.replace("src", webImportSrc);
|
|
87
|
+
return { id: resolveId(webId) };
|
|
78
88
|
}
|
|
79
89
|
return null;
|
|
80
90
|
}
|
|
@@ -118,5 +128,6 @@ async function runScriptFunction({
|
|
|
118
128
|
return returnValue;
|
|
119
129
|
}
|
|
120
130
|
export {
|
|
131
|
+
resolveId,
|
|
121
132
|
runScriptFunction
|
|
122
133
|
};
|
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.2576",
|
|
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": "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.2576",
|
|
37
|
+
"@cedarjs/cli-helpers": "5.0.0-canary.2576",
|
|
38
|
+
"@cedarjs/fastify-web": "5.0.0-canary.2576",
|
|
39
|
+
"@cedarjs/internal": "5.0.0-canary.2576",
|
|
40
|
+
"@cedarjs/prerender": "5.0.0-canary.2576",
|
|
41
|
+
"@cedarjs/project-config": "5.0.0-canary.2576",
|
|
42
|
+
"@cedarjs/structure": "5.0.0-canary.2576",
|
|
43
|
+
"@cedarjs/telemetry": "5.0.0-canary.2576",
|
|
44
|
+
"@cedarjs/utils": "5.0.0-canary.2576",
|
|
45
|
+
"@cedarjs/vite": "5.0.0-canary.2576",
|
|
46
|
+
"@cedarjs/web-server": "5.0.0-canary.2576",
|
|
47
47
|
"@listr2/prompt-adapter-enquirer": "4.2.1",
|
|
48
48
|
"@opentelemetry/api": "1.9.1",
|
|
49
49
|
"@opentelemetry/core": "1.30.1",
|