@cedarjs/api-server 5.0.6 → 5.0.7-next.219
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 +0 -1
- package/dist/apiCLIConfig.d.ts.map +1 -1
- package/dist/apiCLIConfig.js +1 -1
- package/dist/apiCLIConfigHandler.d.ts.map +1 -1
- package/dist/apiCLIConfigHandler.js +5 -0
- package/dist/bin.js +130 -43
- package/dist/bothCLIConfig.d.ts.map +1 -1
- package/dist/bothCLIConfig.js +2 -2
- package/dist/bothCLIConfigHandler.d.ts.map +1 -1
- package/dist/bothCLIConfigHandler.js +8 -2
- package/dist/cliHelpers.d.ts +21 -4
- package/dist/cliHelpers.d.ts.map +1 -1
- package/dist/cliHelpers.js +39 -11
- package/dist/createServer.d.ts.map +1 -1
- package/dist/createServer.js +4 -4
- package/dist/createServerHelpers.d.ts.map +1 -1
- package/dist/createServerHelpers.js +6 -2
- package/dist/logFormatter/formatters.d.ts.map +1 -1
- package/dist/plugins/api.d.ts +1 -1
- package/dist/plugins/api.d.ts.map +1 -1
- package/dist/plugins/api.js +1 -1
- package/dist/plugins/graphql.d.ts +3 -3
- package/dist/plugins/graphql.d.ts.map +1 -1
- package/dist/plugins/graphql.js +14 -12
- package/dist/plugins/lambdaLoader.d.ts.map +1 -1
- package/dist/serverFile.d.ts +23 -0
- package/dist/serverFile.d.ts.map +1 -0
- package/dist/serverFile.js +35 -0
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +0 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +0 -20
- package/package.json +36 -77
- package/dist/buildManager.d.ts +0 -15
- package/dist/buildManager.d.ts.map +0 -1
- package/dist/buildManager.js +0 -55
- package/dist/cjs/apiCLIConfig.d.ts +0 -6
- package/dist/cjs/apiCLIConfig.d.ts.map +0 -1
- package/dist/cjs/apiCLIConfig.js +0 -71
- package/dist/cjs/apiCLIConfigHandler.d.ts +0 -3
- package/dist/cjs/apiCLIConfigHandler.d.ts.map +0 -1
- package/dist/cjs/apiCLIConfigHandler.js +0 -67
- package/dist/cjs/bin.d.ts +0 -2
- package/dist/cjs/bin.d.ts.map +0 -1
- package/dist/cjs/bin.js +0 -1002
- package/dist/cjs/bothCLIConfig.d.ts +0 -6
- package/dist/cjs/bothCLIConfig.d.ts.map +0 -1
- package/dist/cjs/bothCLIConfig.js +0 -76
- package/dist/cjs/bothCLIConfigHandler.d.ts +0 -3
- package/dist/cjs/bothCLIConfigHandler.d.ts.map +0 -1
- package/dist/cjs/bothCLIConfigHandler.js +0 -107
- package/dist/cjs/buildManager.d.ts +0 -15
- package/dist/cjs/buildManager.d.ts.map +0 -1
- package/dist/cjs/buildManager.js +0 -79
- package/dist/cjs/cliHelpers.d.ts +0 -6
- package/dist/cjs/cliHelpers.d.ts.map +0 -1
- package/dist/cjs/cliHelpers.js +0 -57
- package/dist/cjs/createServer.d.ts +0 -30
- package/dist/cjs/createServer.d.ts.map +0 -1
- package/dist/cjs/createServer.js +0 -145
- package/dist/cjs/createServerHelpers.d.ts +0 -38
- package/dist/cjs/createServerHelpers.d.ts.map +0 -1
- package/dist/cjs/createServerHelpers.js +0 -112
- package/dist/cjs/fastify.d.ts +0 -13
- package/dist/cjs/fastify.d.ts.map +0 -1
- package/dist/cjs/fastify.js +0 -96
- package/dist/cjs/logFormatter/ambient.d.js +0 -1
- package/dist/cjs/logFormatter/bin.d.ts +0 -2
- package/dist/cjs/logFormatter/bin.d.ts.map +0 -1
- package/dist/cjs/logFormatter/bin.js +0 -369
- package/dist/cjs/logFormatter/formatters.d.ts +0 -30
- package/dist/cjs/logFormatter/formatters.d.ts.map +0 -1
- package/dist/cjs/logFormatter/formatters.js +0 -275
- package/dist/cjs/logFormatter/index.d.ts +0 -2
- package/dist/cjs/logFormatter/index.d.ts.map +0 -1
- package/dist/cjs/logFormatter/index.js +0 -184
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/plugins/api.d.ts +0 -14
- package/dist/cjs/plugins/api.d.ts.map +0 -1
- package/dist/cjs/plugins/api.js +0 -78
- package/dist/cjs/plugins/graphql.d.ts +0 -10
- package/dist/cjs/plugins/graphql.d.ts.map +0 -1
- package/dist/cjs/plugins/graphql.js +0 -135
- package/dist/cjs/plugins/lambdaLoader.d.ts +0 -34
- package/dist/cjs/plugins/lambdaLoader.d.ts.map +0 -1
- package/dist/cjs/plugins/lambdaLoader.js +0 -199
- package/dist/cjs/requestHandlers/awsLambdaFastify.d.ts +0 -5
- package/dist/cjs/requestHandlers/awsLambdaFastify.d.ts.map +0 -1
- package/dist/cjs/requestHandlers/awsLambdaFastify.js +0 -105
- package/dist/cjs/requestHandlers/utils.d.ts +0 -26
- package/dist/cjs/requestHandlers/utils.d.ts.map +0 -1
- package/dist/cjs/requestHandlers/utils.js +0 -55
- package/dist/cjs/serverManager.d.ts +0 -8
- package/dist/cjs/serverManager.d.ts.map +0 -1
- package/dist/cjs/serverManager.js +0 -137
- package/dist/cjs/types.d.ts +0 -19
- package/dist/cjs/types.d.ts.map +0 -1
- package/dist/cjs/utils.d.ts +0 -6
- package/dist/cjs/utils.d.ts.map +0 -1
- package/dist/cjs/utils.js +0 -58
- package/dist/cjs/watch.d.ts +0 -10
- package/dist/cjs/watch.d.ts.map +0 -1
- package/dist/cjs/watch.js +0 -399
- package/dist/cjs/watchPaths.d.ts +0 -3
- package/dist/cjs/watchPaths.d.ts.map +0 -1
- package/dist/cjs/watchPaths.js +0 -140
- package/dist/serverManager.d.ts +0 -8
- package/dist/serverManager.d.ts.map +0 -1
- package/dist/serverManager.js +0 -102
- package/dist/watch.d.ts +0 -10
- package/dist/watch.d.ts.map +0 -1
- package/dist/watch.js +0 -375
- package/dist/watchPaths.d.ts +0 -3
- package/dist/watchPaths.d.ts.map +0 -1
- package/dist/watchPaths.js +0 -109
package/dist/watchPaths.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
getDbDir,
|
|
5
|
-
getPaths,
|
|
6
|
-
importStatementPath
|
|
7
|
-
} from "@cedarjs/project-config";
|
|
8
|
-
async function workspacePackagesPaths() {
|
|
9
|
-
const cedarPaths = getPaths();
|
|
10
|
-
const packagesDir = path.join(cedarPaths.packages);
|
|
11
|
-
const packages = [];
|
|
12
|
-
try {
|
|
13
|
-
const rootPackageJsonPath = path.join(cedarPaths.base, "package.json");
|
|
14
|
-
const rootPackageJson = JSON.parse(
|
|
15
|
-
fs.readFileSync(rootPackageJsonPath, "utf8")
|
|
16
|
-
);
|
|
17
|
-
const hasPackageJsonWorkspaces = Array.isArray(rootPackageJson.workspaces) && rootPackageJson.workspaces.some((w) => w.startsWith("packages/"));
|
|
18
|
-
if (!hasPackageJsonWorkspaces || !fs.existsSync(packagesDir)) {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
const globPattern = path.join(packagesDir, "*").replaceAll("\\", "/");
|
|
22
|
-
const packageDirs = await Array.fromAsync(fs.promises.glob(globPattern));
|
|
23
|
-
const apiPackageJsonPath = path.join(cedarPaths.api.base, "package.json");
|
|
24
|
-
const apiPackageJson = JSON.parse(
|
|
25
|
-
fs.readFileSync(apiPackageJsonPath, "utf8")
|
|
26
|
-
);
|
|
27
|
-
const deps = {
|
|
28
|
-
...apiPackageJson.dependencies ?? {},
|
|
29
|
-
...apiPackageJson.devDependencies ?? {},
|
|
30
|
-
...apiPackageJson.peerDependencies ?? {}
|
|
31
|
-
};
|
|
32
|
-
const workspaceDepNames = /* @__PURE__ */ new Set();
|
|
33
|
-
for (const [name, version] of Object.entries(deps)) {
|
|
34
|
-
if (String(version).startsWith("workspace:")) {
|
|
35
|
-
workspaceDepNames.add(name);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
for (const packageDir of packageDirs) {
|
|
39
|
-
const packageJsonPath = path.join(packageDir, "package.json");
|
|
40
|
-
if (!fs.existsSync(packageJsonPath)) {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
const pkgJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
44
|
-
if (workspaceDepNames.has(pkgJson.name)) {
|
|
45
|
-
packages.push(path.join(packageDir, "dist"));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
} catch {
|
|
49
|
-
}
|
|
50
|
-
return packages;
|
|
51
|
-
}
|
|
52
|
-
async function apiIgnorePaths() {
|
|
53
|
-
const cedarPaths = getPaths();
|
|
54
|
-
const dbDir = await getDbDir(cedarPaths.api.prismaConfig);
|
|
55
|
-
if (dbDir === cedarPaths.api.base) {
|
|
56
|
-
throw new Error(
|
|
57
|
-
"Database directory cannot be the same as the API directory"
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
const ignoredApiPaths = [
|
|
61
|
-
// TODO: Is this still true?
|
|
62
|
-
// use this, because using cedarPaths.api.dist seems to not ignore on first
|
|
63
|
-
// build
|
|
64
|
-
"api/dist",
|
|
65
|
-
cedarPaths.api.types,
|
|
66
|
-
dbDir
|
|
67
|
-
];
|
|
68
|
-
return ignoredApiPaths;
|
|
69
|
-
}
|
|
70
|
-
async function getIgnoreFunction() {
|
|
71
|
-
const cedarPaths = getPaths();
|
|
72
|
-
const ignoredApiPaths = await apiIgnorePaths();
|
|
73
|
-
const ignoredExtensions = [
|
|
74
|
-
".DS_Store",
|
|
75
|
-
".db",
|
|
76
|
-
".sqlite",
|
|
77
|
-
"-journal",
|
|
78
|
-
".test.js",
|
|
79
|
-
".test.ts",
|
|
80
|
-
".scenarios.ts",
|
|
81
|
-
".scenarios.js",
|
|
82
|
-
".d.ts",
|
|
83
|
-
".log"
|
|
84
|
-
];
|
|
85
|
-
return (file) => {
|
|
86
|
-
if (file.includes("node_modules")) {
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
if (ignoredExtensions.some((ext) => file.endsWith(ext))) {
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
if (file.includes(importStatementPath(cedarPaths.packages)) && file.includes("/src/")) {
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
if (ignoredApiPaths.some((ignoredPath) => file.includes(ignoredPath))) {
|
|
96
|
-
return true;
|
|
97
|
-
}
|
|
98
|
-
return false;
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
async function pathsToWatch() {
|
|
102
|
-
const cedarPaths = getPaths();
|
|
103
|
-
const watchPaths = [cedarPaths.api.src, ...await workspacePackagesPaths()];
|
|
104
|
-
return watchPaths.map((p) => importStatementPath(p));
|
|
105
|
-
}
|
|
106
|
-
export {
|
|
107
|
-
getIgnoreFunction,
|
|
108
|
-
pathsToWatch
|
|
109
|
-
};
|