@cedarjs/internal 0.0.4

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.
Files changed (88) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/dist/ast.d.ts +26 -0
  4. package/dist/ast.d.ts.map +1 -0
  5. package/dist/ast.js +198 -0
  6. package/dist/build/api.d.ts +6 -0
  7. package/dist/build/api.d.ts.map +1 -0
  8. package/dist/build/api.js +109 -0
  9. package/dist/cliLogger.d.ts +11 -0
  10. package/dist/cliLogger.d.ts.map +1 -0
  11. package/dist/cliLogger.js +36 -0
  12. package/dist/dev.d.ts +2 -0
  13. package/dist/dev.d.ts.map +1 -0
  14. package/dist/dev.js +41 -0
  15. package/dist/files.d.ts +51 -0
  16. package/dist/files.d.ts.map +1 -0
  17. package/dist/files.js +223 -0
  18. package/dist/generate/clientPreset.d.ts +17 -0
  19. package/dist/generate/clientPreset.d.ts.map +1 -0
  20. package/dist/generate/clientPreset.js +85 -0
  21. package/dist/generate/generate.d.ts +10 -0
  22. package/dist/generate/generate.d.ts.map +1 -0
  23. package/dist/generate/generate.js +91 -0
  24. package/dist/generate/graphqlCodeGen.d.ts +16 -0
  25. package/dist/generate/graphqlCodeGen.d.ts.map +1 -0
  26. package/dist/generate/graphqlCodeGen.js +339 -0
  27. package/dist/generate/graphqlSchema.d.ts +8 -0
  28. package/dist/generate/graphqlSchema.d.ts.map +1 -0
  29. package/dist/generate/graphqlSchema.js +153 -0
  30. package/dist/generate/plugins/rw-typescript-resolvers/index.d.ts +6 -0
  31. package/dist/generate/plugins/rw-typescript-resolvers/index.d.ts.map +1 -0
  32. package/dist/generate/plugins/rw-typescript-resolvers/index.js +67 -0
  33. package/dist/generate/plugins/rw-typescript-resolvers/visitor.d.ts +9 -0
  34. package/dist/generate/plugins/rw-typescript-resolvers/visitor.d.ts.map +1 -0
  35. package/dist/generate/plugins/rw-typescript-resolvers/visitor.js +84 -0
  36. package/dist/generate/possibleTypes.d.ts +36 -0
  37. package/dist/generate/possibleTypes.d.ts.map +1 -0
  38. package/dist/generate/possibleTypes.js +106 -0
  39. package/dist/generate/templates/all-currentUser.d.ts.template +28 -0
  40. package/dist/generate/templates/api-globImports.d.ts.template +9 -0
  41. package/dist/generate/templates/api-globalContext.d.ts.template +7 -0
  42. package/dist/generate/templates/api-scenarios.d.ts.template +10 -0
  43. package/dist/generate/templates/api-test-globals.d.ts.template +5 -0
  44. package/dist/generate/templates/mirror-cell.d.ts.template +13 -0
  45. package/dist/generate/templates/mirror-directoryNamedModule.d.ts.template +5 -0
  46. package/dist/generate/templates/web-routerRoutes.d.ts.template +20 -0
  47. package/dist/generate/templates/web-routesPages.d.ts.template +13 -0
  48. package/dist/generate/templates/web-test-globals.d.ts.template +7 -0
  49. package/dist/generate/templates.d.ts +6 -0
  50. package/dist/generate/templates.d.ts.map +1 -0
  51. package/dist/generate/templates.js +61 -0
  52. package/dist/generate/trustedDocuments.d.ts +3 -0
  53. package/dist/generate/trustedDocuments.d.ts.map +1 -0
  54. package/dist/generate/trustedDocuments.js +95 -0
  55. package/dist/generate/typeDefinitions.d.ts +30 -0
  56. package/dist/generate/typeDefinitions.d.ts.map +1 -0
  57. package/dist/generate/typeDefinitions.js +369 -0
  58. package/dist/generate/types.d.ts +6 -0
  59. package/dist/generate/types.d.ts.map +1 -0
  60. package/dist/generate/types.js +16 -0
  61. package/dist/generate/watch.d.ts +3 -0
  62. package/dist/generate/watch.d.ts.map +1 -0
  63. package/dist/generate/watch.js +124 -0
  64. package/dist/gql.d.ts +14 -0
  65. package/dist/gql.d.ts.map +1 -0
  66. package/dist/gql.js +108 -0
  67. package/dist/index.d.ts +11 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +49 -0
  70. package/dist/jsx.d.ts +16 -0
  71. package/dist/jsx.d.ts.map +1 -0
  72. package/dist/jsx.js +100 -0
  73. package/dist/jsxAttributeValue.d.ts +2 -0
  74. package/dist/jsxAttributeValue.d.ts.map +1 -0
  75. package/dist/jsxAttributeValue.js +129 -0
  76. package/dist/project.d.ts +8 -0
  77. package/dist/project.d.ts.map +1 -0
  78. package/dist/project.js +82 -0
  79. package/dist/routes.d.ts +42 -0
  80. package/dist/routes.d.ts.map +1 -0
  81. package/dist/routes.js +111 -0
  82. package/dist/ts2js.d.ts +40 -0
  83. package/dist/ts2js.d.ts.map +1 -0
  84. package/dist/ts2js.js +159 -0
  85. package/dist/validateSchema.d.ts +14 -0
  86. package/dist/validateSchema.d.ts.map +1 -0
  87. package/dist/validateSchema.js +193 -0
  88. package/package.json +131 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Cedar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Our Internals
2
+
3
+ This package is not intended to be used directly.
package/dist/ast.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ import { types } from '@babel/core';
2
+ export declare const fileToAst: (filePath: string) => types.Node;
3
+ interface NamedExports {
4
+ name: string;
5
+ type: 're-export' | 'variable' | 'function' | 'class';
6
+ location: {
7
+ line: number;
8
+ column: number;
9
+ };
10
+ }
11
+ /**
12
+ * get all the named exports in a given piece of code.
13
+ */
14
+ export declare const getNamedExports: (ast: types.Node) => NamedExports[];
15
+ /**
16
+ * get all the gql queries from the supplied code
17
+ */
18
+ export declare const getGqlQueries: (ast: types.Node) => string[];
19
+ export declare const getCellGqlQuery: (ast: types.Node) => undefined;
20
+ export declare const hasDefaultExport: (ast: types.Node) => boolean;
21
+ export declare const getDefaultExportLocation: (ast: types.Node) => {
22
+ line: number;
23
+ column: number;
24
+ } | null;
25
+ export {};
26
+ //# sourceMappingURL=ast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../src/ast.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAUnC,eAAO,MAAM,SAAS,aAAc,MAAM,KAAG,KAAK,CAAC,IAyBlD,CAAA;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAA;IACrD,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AACD;;GAEG;AACH,eAAO,MAAM,eAAe,QAAS,KAAK,CAAC,IAAI,KAAG,YAAY,EA4D7D,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,QAAS,KAAK,CAAC,IAAI,aAY5C,CAAA;AAED,eAAO,MAAM,eAAe,QAAS,KAAK,CAAC,IAAI,cA4B9C,CAAA;AAED,eAAO,MAAM,gBAAgB,QAAS,KAAK,CAAC,IAAI,KAAG,OASlD,CAAA;AAED,eAAO,MAAM,wBAAwB,QAC9B,KAAK,CAAC,IAAI,KACd;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IA0CrC,CAAA"}
package/dist/ast.js ADDED
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var ast_exports = {};
30
+ __export(ast_exports, {
31
+ fileToAst: () => fileToAst,
32
+ getCellGqlQuery: () => getCellGqlQuery,
33
+ getDefaultExportLocation: () => getDefaultExportLocation,
34
+ getGqlQueries: () => getGqlQueries,
35
+ getNamedExports: () => getNamedExports,
36
+ hasDefaultExport: () => hasDefaultExport
37
+ });
38
+ module.exports = __toCommonJS(ast_exports);
39
+ var import_fs = __toESM(require("fs"));
40
+ var import_path = __toESM(require("path"));
41
+ var import_core = require("@babel/core");
42
+ var import_parser = require("@babel/parser");
43
+ var import_traverse = __toESM(require("@babel/traverse"));
44
+ var import_chalk = __toESM(require("chalk"));
45
+ var import_project_config = require("@cedarjs/project-config");
46
+ var import_files = require("./files");
47
+ const fileToAst = (filePath) => {
48
+ const code = import_fs.default.readFileSync(filePath, "utf-8");
49
+ const isJsxFile = import_path.default.extname(filePath).match(/[jt]sx$/) || (0, import_files.isFileInsideFolder)(filePath, (0, import_project_config.getPaths)().web.base);
50
+ const plugins = [
51
+ "typescript",
52
+ "nullishCoalescingOperator",
53
+ "objectRestSpread",
54
+ isJsxFile && "jsx"
55
+ ].filter(Boolean);
56
+ try {
57
+ return (0, import_parser.parse)(code, {
58
+ sourceType: "module",
59
+ plugins
60
+ });
61
+ } catch (e) {
62
+ console.error(import_chalk.default.red(`Error parsing: ${filePath}`));
63
+ console.error(e);
64
+ throw new Error(e?.message);
65
+ }
66
+ };
67
+ const getNamedExports = (ast) => {
68
+ const namedExports = [];
69
+ (0, import_traverse.default)(ast, {
70
+ ExportNamedDeclaration(path2) {
71
+ const specifiers = path2.node?.specifiers;
72
+ if (specifiers.length) {
73
+ for (const s of specifiers) {
74
+ const id = s.exported;
75
+ namedExports.push({
76
+ name: id.name,
77
+ type: "re-export",
78
+ location: {
79
+ line: id.loc?.start.line ?? 1,
80
+ column: id.loc?.start.column ?? 0
81
+ }
82
+ });
83
+ }
84
+ return;
85
+ }
86
+ const declaration = path2.node.declaration;
87
+ if (!declaration) {
88
+ return;
89
+ }
90
+ if (declaration.type === "VariableDeclaration") {
91
+ const id = declaration.declarations[0].id;
92
+ namedExports.push({
93
+ name: id.name,
94
+ type: "variable",
95
+ location: {
96
+ line: id.loc?.start.line ?? 1,
97
+ column: id.loc?.start.column ?? 0
98
+ }
99
+ });
100
+ } else if (declaration.type === "FunctionDeclaration") {
101
+ namedExports.push({
102
+ name: declaration?.id?.name,
103
+ type: "function",
104
+ location: {
105
+ line: declaration?.id?.loc?.start.line ?? 1,
106
+ column: declaration?.id?.loc?.start.column ?? 0
107
+ }
108
+ });
109
+ } else if (declaration.type === "ClassDeclaration") {
110
+ namedExports.push({
111
+ name: declaration?.id?.name,
112
+ type: "class",
113
+ location: {
114
+ line: declaration?.id?.loc?.start.line ?? 1,
115
+ column: declaration?.id?.loc?.start.column ?? 0
116
+ }
117
+ });
118
+ }
119
+ }
120
+ });
121
+ return namedExports;
122
+ };
123
+ const getGqlQueries = (ast) => {
124
+ const gqlQueries = [];
125
+ (0, import_traverse.default)(ast, {
126
+ TaggedTemplateExpression(path2) {
127
+ const gqlTag = path2.node.tag;
128
+ if (gqlTag.type === "Identifier" && gqlTag.name === "gql") {
129
+ gqlQueries.push(path2.node.quasi.quasis[0].value.raw);
130
+ }
131
+ }
132
+ });
133
+ return gqlQueries;
134
+ };
135
+ const getCellGqlQuery = (ast) => {
136
+ let cellQuery = void 0;
137
+ (0, import_traverse.default)(ast, {
138
+ ExportNamedDeclaration({ node }) {
139
+ if (node.exportKind === "value" && import_core.types.isVariableDeclaration(node.declaration)) {
140
+ const exportedQueryNode = node.declaration.declarations.find((d) => {
141
+ return import_core.types.isIdentifier(d.id) && d.id.name === "QUERY" && import_core.types.isTaggedTemplateExpression(d.init);
142
+ });
143
+ if (exportedQueryNode) {
144
+ const templateExpression = exportedQueryNode.init;
145
+ cellQuery = templateExpression.quasi.quasis[0].value.raw;
146
+ }
147
+ }
148
+ return;
149
+ }
150
+ });
151
+ return cellQuery;
152
+ };
153
+ const hasDefaultExport = (ast) => {
154
+ let exported = false;
155
+ (0, import_traverse.default)(ast, {
156
+ ExportDefaultDeclaration() {
157
+ exported = true;
158
+ return;
159
+ }
160
+ });
161
+ return exported;
162
+ };
163
+ const getDefaultExportLocation = (ast) => {
164
+ let defaultExport;
165
+ (0, import_traverse.default)(ast, {
166
+ ExportDefaultDeclaration(path2) {
167
+ defaultExport = path2.node;
168
+ }
169
+ });
170
+ if (!defaultExport) {
171
+ return null;
172
+ }
173
+ if (import_core.types.isIdentifier(defaultExport.declaration) && import_core.types.isFile(ast)) {
174
+ const exportedName = defaultExport.declaration.name;
175
+ const declaration = ast.program.body.find((node) => {
176
+ return import_core.types.isVariableDeclaration(node) && node.declarations.find((d) => {
177
+ return import_core.types.isVariableDeclarator(d) && import_core.types.isIdentifier(d.id) && d.id.name === exportedName;
178
+ });
179
+ });
180
+ return {
181
+ line: declaration?.loc?.start.line ?? 1,
182
+ column: declaration?.loc?.start.column ?? 0
183
+ };
184
+ }
185
+ return {
186
+ line: defaultExport.loc?.start.line ?? 1,
187
+ column: defaultExport.loc?.start.column ?? 0
188
+ };
189
+ };
190
+ // Annotate the CommonJS export names for ESM import in node:
191
+ 0 && (module.exports = {
192
+ fileToAst,
193
+ getCellGqlQuery,
194
+ getDefaultExportLocation,
195
+ getGqlQueries,
196
+ getNamedExports,
197
+ hasDefaultExport
198
+ });
@@ -0,0 +1,6 @@
1
+ import type { BuildOptions } from 'esbuild';
2
+ export declare const buildApi: () => Promise<import("esbuild").BuildResult<BuildOptions>>;
3
+ export declare const rebuildApi: () => Promise<import("esbuild").BuildResult<BuildOptions>>;
4
+ export declare const cleanApiBuild: () => Promise<void>;
5
+ export declare const transpileApi: (files: string[]) => Promise<import("esbuild").BuildResult<BuildOptions>>;
6
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/build/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,YAAY,EAAe,MAAM,SAAS,CAAA;AActE,eAAO,MAAM,QAAQ,4DAOpB,CAAA;AAED,eAAO,MAAM,UAAU,4DAQtB,CAAA;AAED,eAAO,MAAM,aAAa,qBAGzB,CAAA;AAiCD,eAAO,MAAM,YAAY,UAAiB,MAAM,EAAE,yDAEjD,CAAA"}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var api_exports = {};
30
+ __export(api_exports, {
31
+ buildApi: () => buildApi,
32
+ cleanApiBuild: () => cleanApiBuild,
33
+ rebuildApi: () => rebuildApi,
34
+ transpileApi: () => transpileApi
35
+ });
36
+ module.exports = __toCommonJS(api_exports);
37
+ var import_esbuild = require("esbuild");
38
+ var import_fs_extra = __toESM(require("fs-extra"));
39
+ var import_babel_config = require("@cedarjs/babel-config");
40
+ var import_project_config = require("@cedarjs/project-config");
41
+ var import_files = require("../files");
42
+ let BUILD_CTX = null;
43
+ const buildApi = async () => {
44
+ BUILD_CTX?.dispose();
45
+ BUILD_CTX = null;
46
+ return transpileApi((0, import_files.findApiFiles)());
47
+ };
48
+ const rebuildApi = async () => {
49
+ const apiFiles = (0, import_files.findApiFiles)();
50
+ if (!BUILD_CTX) {
51
+ BUILD_CTX = await (0, import_esbuild.context)(getEsbuildOptions(apiFiles));
52
+ }
53
+ return BUILD_CTX.rebuild();
54
+ };
55
+ const cleanApiBuild = async () => {
56
+ const rwjsPaths = (0, import_project_config.getPaths)();
57
+ return import_fs_extra.default.remove(rwjsPaths.api.dist);
58
+ };
59
+ const runRwBabelTransformsPlugin = {
60
+ name: "rw-esbuild-babel-transform",
61
+ setup(build2) {
62
+ const rwjsConfig = (0, import_project_config.getConfig)();
63
+ build2.onLoad({ filter: /\.(js|ts|tsx|jsx)$/ }, async (args) => {
64
+ const transformedCode = await (0, import_babel_config.transformWithBabel)(
65
+ args.path,
66
+ (0, import_babel_config.getApiSideBabelPlugins)({
67
+ openTelemetry: rwjsConfig.experimental.opentelemetry.enabled && rwjsConfig.experimental.opentelemetry.wrapApi,
68
+ projectIsEsm: (0, import_project_config.projectSideIsEsm)("api")
69
+ })
70
+ );
71
+ if (transformedCode?.code) {
72
+ return {
73
+ contents: transformedCode.code,
74
+ loader: "js"
75
+ };
76
+ }
77
+ throw new Error(`Could not transform file: ${args.path}`);
78
+ });
79
+ }
80
+ };
81
+ const transpileApi = async (files) => {
82
+ return (0, import_esbuild.build)(getEsbuildOptions(files));
83
+ };
84
+ function getEsbuildOptions(files) {
85
+ const rwjsPaths = (0, import_project_config.getPaths)();
86
+ const format = (0, import_project_config.projectSideIsEsm)("api") ? "esm" : "cjs";
87
+ return {
88
+ absWorkingDir: rwjsPaths.api.base,
89
+ entryPoints: files,
90
+ platform: "node",
91
+ target: "node20",
92
+ format,
93
+ allowOverwrite: true,
94
+ bundle: false,
95
+ plugins: [runRwBabelTransformsPlugin],
96
+ outdir: rwjsPaths.api.dist,
97
+ // setting this to 'true' will generate an external sourcemap x.js.map
98
+ // AND set the sourceMappingURL comment
99
+ // (setting it to 'external' will ONLY generate the file, but won't add the comment)
100
+ sourcemap: true
101
+ };
102
+ }
103
+ // Annotate the CommonJS export names for ESM import in node:
104
+ 0 && (module.exports = {
105
+ buildApi,
106
+ cleanApiBuild,
107
+ rebuildApi,
108
+ transpileApi
109
+ });
@@ -0,0 +1,11 @@
1
+ type CLog = (typeof console)['log'];
2
+ /**
3
+ * An alternative to createLogger which supports the same logging levels
4
+ * but allows for full ANSI when printing to the console.
5
+ */
6
+ export declare const cliLogger: CLog & {
7
+ trace: CLog;
8
+ debug: CLog;
9
+ };
10
+ export {};
11
+ //# sourceMappingURL=cliLogger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cliLogger.d.ts","sourceRoot":"","sources":["../src/cliLogger.ts"],"names":[],"mappings":"AAIA,KAAK,IAAI,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,CAAC,CAAA;AAEnC;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,IAAI,GAAG;IAC7B,KAAK,EAAE,IAAI,CAAA;IACX,KAAK,EAAE,IAAI,CAAA;CAGZ,CAAA"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var cliLogger_exports = {};
20
+ __export(cliLogger_exports, {
21
+ cliLogger: () => cliLogger
22
+ });
23
+ module.exports = __toCommonJS(cliLogger_exports);
24
+ var import_logger = require("@cedarjs/api/logger");
25
+ const logLevel = import_logger.defaultLoggerOptions.level;
26
+ const cliLogger = function(...data) {
27
+ console.log(...data);
28
+ };
29
+ cliLogger.trace = logLevel === "trace" ? console.log : () => {
30
+ };
31
+ cliLogger.debug = logLevel === "trace" || logLevel === "debug" ? console.log : () => {
32
+ };
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ cliLogger
36
+ });
package/dist/dev.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const shutdownPort: (port: number, method?: "tcp" | "udp") => Promise<void>;
2
+ //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,SAAU,MAAM,WAAU,KAAK,GAAG,KAAK,kBAE/D,CAAA"}
package/dist/dev.js ADDED
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var dev_exports = {};
30
+ __export(dev_exports, {
31
+ shutdownPort: () => shutdownPort
32
+ });
33
+ module.exports = __toCommonJS(dev_exports);
34
+ var import_kill_port = __toESM(require("kill-port"));
35
+ const shutdownPort = (port, method = "tcp") => {
36
+ return (0, import_kill_port.default)(port, method);
37
+ };
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ shutdownPort
41
+ });
@@ -0,0 +1,51 @@
1
+ export declare const findCells: (cwd?: string) => string[];
2
+ export declare const findPages: (cwd?: string) => string[];
3
+ /**
4
+ * This function finds all modules in the 'web' and 'api' directories excluding 'node_modules' and Cell files.
5
+ * Cell files are also directory named modules but they have their special type mirror file, so they are ignored.
6
+ *
7
+ * @param {string} cwd - The directory path to start searching from. By default, it is the base path of the project.
8
+ * @returns {Array} modules - An array of absolute paths for the found modules.
9
+ *
10
+ * @example
11
+ * // Assuming the base directory of your project is '/Users/user/myproject'
12
+ * findDirectoryNamedModules('/Users/user/myproject');
13
+ * // This will return an array with the absolute paths of all matching files, e.g.:
14
+ * // ['/Users/user/myproject/web/src/components/Author/Author.tsx', '/Users/user/myproject/web/src/pages/AboutPage/AboutPage.tsx']
15
+ */
16
+ export declare const findDirectoryNamedModules: (cwd?: string) => string[];
17
+ export declare const findGraphQLSchemas: (cwd?: string) => string[];
18
+ export declare const findApiFiles: (cwd?: string) => string[];
19
+ export declare const findWebFiles: (cwd?: string) => string[];
20
+ export declare const findApiServerFunctions: (cwd?: string) => string[];
21
+ export declare const findApiDistFunctions: (cwd?: string) => string[];
22
+ export declare const findRouteHooksSrc: (cwd?: string) => string[];
23
+ export declare const isCellFile: (p: string) => boolean;
24
+ export declare const findScripts: (cwd?: string) => string[];
25
+ export declare const isPageFile: (p: string) => boolean;
26
+ /**
27
+ * This function checks if the given path belongs to a directory named module.
28
+ * A directory named module is where the filename (without extension) is the same as the directory it is in.
29
+ *
30
+ * @param {string} p - The absolute path of the file.
31
+ * @returns {boolean} - Returns true if the path belongs to a directory named module, false otherwise.
32
+ *
33
+ * @example
34
+ * isDirectoryNamedModuleFile('/Users/user/myproject/web/src/components/Author/Author.tsx');
35
+ * // Returns: true
36
+ *
37
+ * isDirectoryNamedModuleFile('/Users/user/myproject/web/src/components/Author/AuthorInfo.tsx');
38
+ * // Returns: false
39
+ */
40
+ export declare const isDirectoryNamedModuleFile: (p: string) => boolean;
41
+ export declare const isGraphQLSchemaFile: (p: string) => boolean;
42
+ /**
43
+ * The following patterns are supported for api functions:
44
+ *
45
+ * 1. a module at the top level: `/graphql.js`
46
+ * 2. a module in a folder with a module of the same name: `/health/health.js`
47
+ * 3. a module in a folder named index: `/x/index.js`
48
+ */
49
+ export declare const isApiFunction: (p: string, functionsPath: string) => boolean;
50
+ export declare const isFileInsideFolder: (filePath: string, folderPath: string) => boolean;
51
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS,SAAS,MAAM,aAOpC,CAAA;AAED,eAAO,MAAM,SAAS,SAAS,MAAM,aAQpC,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,SAAS,MAAM,aAUpD,CAAA;AAED,eAAO,MAAM,kBAAkB,SAAS,MAAM,aAI7C,CAAA;AASD,eAAO,MAAM,YAAY,SAAS,MAAM,aAOvC,CAAA;AAED,eAAO,MAAM,YAAY,SAAS,MAAM,aAYvC,CAAA;AAED,eAAO,MAAM,sBAAsB,SAC5B,MAAM,aAUZ,CAAA;AAED,eAAO,MAAM,oBAAoB,SAAS,MAAM,aAM/C,CAAA;AAED,eAAO,MAAM,iBAAiB,SAAS,MAAM,aAK5C,CAAA;AAED,eAAO,MAAM,UAAU,MAAO,MAAM,YA6BnC,CAAA;AAED,eAAO,MAAM,WAAW,SAAS,MAAM,aAMtC,CAAA;AAED,eAAO,MAAM,UAAU,MAAO,MAAM,YAoBnC,CAAA;AACD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,0BAA0B,MAAO,MAAM,YAGnD,CAAA;AAED,eAAO,MAAM,mBAAmB,MAAO,MAAM,YAQ5C,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,MAAO,MAAM,iBAAiB,MAAM,YAc7D,CAAA;AAED,eAAO,MAAM,kBAAkB,aAAc,MAAM,cAAc,MAAM,YAYtE,CAAA"}