@cedarjs/internal 0.6.1-next.0 → 0.7.0
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/ast.d.ts.map +1 -1
- package/dist/ast.js +28 -64
- package/dist/build/api.js +22 -56
- package/dist/cjs/ast.d.ts +26 -0
- package/dist/cjs/ast.d.ts.map +1 -0
- package/dist/cjs/ast.js +201 -0
- package/dist/cjs/build/api.d.ts +6 -0
- package/dist/cjs/build/api.d.ts.map +1 -0
- package/dist/cjs/build/api.js +109 -0
- package/dist/cjs/cliLogger.d.ts +11 -0
- package/dist/cjs/cliLogger.d.ts.map +1 -0
- package/dist/cjs/cliLogger.js +36 -0
- package/dist/cjs/dev.d.ts +2 -0
- package/dist/cjs/dev.d.ts.map +1 -0
- package/dist/cjs/dev.js +41 -0
- package/dist/cjs/files.d.ts +56 -0
- package/dist/cjs/files.d.ts.map +1 -0
- package/dist/cjs/files.js +230 -0
- package/dist/cjs/generate/clientPreset.d.ts +17 -0
- package/dist/cjs/generate/clientPreset.d.ts.map +1 -0
- package/dist/cjs/generate/clientPreset.js +85 -0
- package/dist/cjs/generate/generate.d.ts +10 -0
- package/dist/cjs/generate/generate.d.ts.map +1 -0
- package/dist/cjs/generate/generate.js +91 -0
- package/dist/cjs/generate/graphqlCodeGen.d.ts +16 -0
- package/dist/cjs/generate/graphqlCodeGen.d.ts.map +1 -0
- package/dist/cjs/generate/graphqlCodeGen.js +346 -0
- package/dist/cjs/generate/graphqlSchema.d.ts +8 -0
- package/dist/cjs/generate/graphqlSchema.d.ts.map +1 -0
- package/dist/cjs/generate/graphqlSchema.js +154 -0
- package/dist/cjs/generate/plugins/rw-typescript-resolvers/index.d.ts +7 -0
- package/dist/cjs/generate/plugins/rw-typescript-resolvers/index.d.ts.map +1 -0
- package/dist/cjs/generate/plugins/rw-typescript-resolvers/index.js +65 -0
- package/dist/cjs/generate/plugins/rw-typescript-resolvers/visitor.d.ts +9 -0
- package/dist/cjs/generate/plugins/rw-typescript-resolvers/visitor.d.ts.map +1 -0
- package/dist/cjs/generate/plugins/rw-typescript-resolvers/visitor.js +84 -0
- package/dist/cjs/generate/possibleTypes.d.ts +36 -0
- package/dist/cjs/generate/possibleTypes.d.ts.map +1 -0
- package/dist/cjs/generate/possibleTypes.js +106 -0
- package/dist/cjs/generate/templates/all-currentUser.d.ts.template +30 -0
- package/dist/cjs/generate/templates/api-globImports.d.ts.template +9 -0
- package/dist/cjs/generate/templates/api-globalContext.d.ts.template +7 -0
- package/dist/cjs/generate/templates/api-scenarios.d.ts.template +10 -0
- package/dist/cjs/generate/templates/api-test-globals.d.ts.template +5 -0
- package/dist/cjs/generate/templates/mirror-cell.d.ts.template +13 -0
- package/dist/cjs/generate/templates/mirror-directoryNamedModule.d.ts.template +5 -0
- package/dist/cjs/generate/templates/web-routerRoutes.d.ts.template +20 -0
- package/dist/cjs/generate/templates/web-routesPages.d.ts.template +13 -0
- package/dist/cjs/generate/templates/web-test-globals.d.ts.template +7 -0
- package/dist/cjs/generate/templates.d.ts +6 -0
- package/dist/cjs/generate/templates.d.ts.map +1 -0
- package/dist/cjs/generate/templates.js +68 -0
- package/dist/cjs/generate/trustedDocuments.d.ts +3 -0
- package/dist/cjs/generate/trustedDocuments.d.ts.map +1 -0
- package/dist/cjs/generate/trustedDocuments.js +95 -0
- package/dist/cjs/generate/typeDefinitions.d.ts +30 -0
- package/dist/cjs/generate/typeDefinitions.d.ts.map +1 -0
- package/dist/cjs/generate/typeDefinitions.js +369 -0
- package/dist/cjs/generate/types.d.ts +6 -0
- package/dist/cjs/generate/types.d.ts.map +1 -0
- package/dist/cjs/generate/types.js +16 -0
- package/dist/cjs/generate/watch.d.ts +3 -0
- package/dist/cjs/generate/watch.d.ts.map +1 -0
- package/dist/cjs/generate/watch.js +124 -0
- package/dist/cjs/gql.d.ts +14 -0
- package/dist/cjs/gql.d.ts.map +1 -0
- package/dist/cjs/gql.js +108 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +49 -0
- package/dist/cjs/jsx.d.ts +16 -0
- package/dist/cjs/jsx.d.ts.map +1 -0
- package/dist/cjs/jsx.js +101 -0
- package/dist/cjs/jsxAttributeValue.d.ts +2 -0
- package/dist/cjs/jsxAttributeValue.d.ts.map +1 -0
- package/dist/cjs/jsxAttributeValue.js +129 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/project.d.ts +8 -0
- package/dist/cjs/project.d.ts.map +1 -0
- package/dist/cjs/project.js +82 -0
- package/dist/cjs/routes.d.ts +42 -0
- package/dist/cjs/routes.d.ts.map +1 -0
- package/dist/cjs/routes.js +111 -0
- package/dist/cjs/ts2js.d.ts +40 -0
- package/dist/cjs/ts2js.d.ts.map +1 -0
- package/dist/cjs/ts2js.js +159 -0
- package/dist/cjs/validateSchema.d.ts +14 -0
- package/dist/cjs/validateSchema.d.ts.map +1 -0
- package/dist/cjs/validateSchema.js +194 -0
- package/dist/cliLogger.js +4 -28
- package/dist/dev.js +4 -38
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +46 -95
- package/dist/generate/clientPreset.js +17 -39
- package/dist/generate/generate.js +14 -39
- package/dist/generate/graphqlCodeGen.d.ts.map +1 -1
- package/dist/generate/graphqlCodeGen.js +49 -79
- package/dist/generate/graphqlSchema.d.ts.map +1 -1
- package/dist/generate/graphqlSchema.js +26 -59
- package/dist/generate/plugins/rw-typescript-resolvers/index.d.ts +4 -3
- package/dist/generate/plugins/rw-typescript-resolvers/index.d.ts.map +1 -1
- package/dist/generate/plugins/rw-typescript-resolvers/index.js +11 -35
- package/dist/generate/plugins/rw-typescript-resolvers/visitor.js +10 -31
- package/dist/generate/possibleTypes.js +19 -53
- package/dist/generate/templates.d.ts.map +1 -1
- package/dist/generate/templates.js +14 -42
- package/dist/generate/trustedDocuments.js +13 -48
- package/dist/generate/typeDefinitions.d.ts +2 -2
- package/dist/generate/typeDefinitions.d.ts.map +1 -1
- package/dist/generate/typeDefinitions.js +83 -123
- package/dist/generate/types.js +0 -16
- package/dist/generate/watch.js +55 -63
- package/dist/gql.js +16 -42
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -47
- package/dist/jsx.d.ts.map +1 -1
- package/dist/jsx.js +7 -40
- package/dist/jsxAttributeValue.js +2 -26
- package/dist/project.js +21 -58
- package/dist/routes.d.ts +1 -1
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +12 -48
- package/dist/ts2js.d.ts +1 -1
- package/dist/ts2js.js +33 -73
- package/dist/validateSchema.js +19 -47
- package/package.json +91 -31
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export * from '@cedarjs/project-config';
|
|
2
|
-
export * from './ts2js';
|
|
3
|
-
export * from './dev';
|
|
4
|
-
export * from './routes';
|
|
5
|
-
export * from './files';
|
|
6
|
-
export { generate } from './generate/generate';
|
|
7
|
-
export { buildApi } from './build/api';
|
|
8
|
-
export * from './validateSchema';
|
|
2
|
+
export * from './ts2js.js';
|
|
3
|
+
export * from './dev.js';
|
|
4
|
+
export * from './routes.js';
|
|
5
|
+
export * from './files.js';
|
|
6
|
+
export { generate } from './generate/generate.js';
|
|
7
|
+
export { buildApi } from './build/api.js';
|
|
8
|
+
export * from './validateSchema.js';
|
|
9
9
|
export * from '@cedarjs/babel-config';
|
|
10
|
-
export { listQueryTypeFieldsInProject } from './gql';
|
|
10
|
+
export { listQueryTypeFieldsInProject } from './gql.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AAEvC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AAEvC,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAE3B,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,cAAc,qBAAqB,CAAA;AAGnC,cAAc,uBAAuB,CAAA;AAErC,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,49 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var index_exports = {};
|
|
21
|
-
__export(index_exports, {
|
|
22
|
-
buildApi: () => import_api.buildApi,
|
|
23
|
-
generate: () => import_generate.generate,
|
|
24
|
-
listQueryTypeFieldsInProject: () => import_gql.listQueryTypeFieldsInProject
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
__reExport(index_exports, require("@cedarjs/project-config"), module.exports);
|
|
28
|
-
__reExport(index_exports, require("./ts2js"), module.exports);
|
|
29
|
-
__reExport(index_exports, require("./dev"), module.exports);
|
|
30
|
-
__reExport(index_exports, require("./routes"), module.exports);
|
|
31
|
-
__reExport(index_exports, require("./files"), module.exports);
|
|
32
|
-
var import_generate = require("./generate/generate");
|
|
33
|
-
var import_api = require("./build/api");
|
|
34
|
-
__reExport(index_exports, require("./validateSchema"), module.exports);
|
|
35
|
-
__reExport(index_exports, require("@cedarjs/babel-config"), module.exports);
|
|
36
|
-
var import_gql = require("./gql");
|
|
37
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
-
0 && (module.exports = {
|
|
1
|
+
export * from "@cedarjs/project-config";
|
|
2
|
+
export * from "./ts2js.js";
|
|
3
|
+
export * from "./dev.js";
|
|
4
|
+
export * from "./routes.js";
|
|
5
|
+
export * from "./files.js";
|
|
6
|
+
import { generate } from "./generate/generate.js";
|
|
7
|
+
import { buildApi } from "./build/api.js";
|
|
8
|
+
export * from "./validateSchema.js";
|
|
9
|
+
export * from "@cedarjs/babel-config";
|
|
10
|
+
import { listQueryTypeFieldsInProject } from "./gql.js";
|
|
11
|
+
export {
|
|
39
12
|
buildApi,
|
|
40
13
|
generate,
|
|
41
|
-
listQueryTypeFieldsInProject
|
|
42
|
-
|
|
43
|
-
...require("./ts2js"),
|
|
44
|
-
...require("./dev"),
|
|
45
|
-
...require("./routes"),
|
|
46
|
-
...require("./files"),
|
|
47
|
-
...require("./validateSchema"),
|
|
48
|
-
...require("@cedarjs/babel-config")
|
|
49
|
-
});
|
|
14
|
+
listQueryTypeFieldsInProject
|
|
15
|
+
};
|
package/dist/jsx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx.d.ts","sourceRoot":"","sources":["../src/jsx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"jsx.d.ts","sourceRoot":"","sources":["../src/jsx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAUxC,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAA;IACvB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,QAAS,KAAK,CAAC,IAAI,QAAQ,MAAM,iBAgB3D,CAAA"}
|
package/dist/jsx.js
CHANGED
|
@@ -1,41 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 jsx_exports = {};
|
|
30
|
-
__export(jsx_exports, {
|
|
31
|
-
getJsxElements: () => getJsxElements
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(jsx_exports);
|
|
34
|
-
var import_traverse = __toESM(require("@babel/traverse"));
|
|
35
|
-
var import_jsxAttributeValue = require("./jsxAttributeValue");
|
|
1
|
+
import babelTraverse from "@babel/traverse";
|
|
2
|
+
import { getJsxAttributeValue } from "./jsxAttributeValue.js";
|
|
3
|
+
const traverse = babelTraverse.default || babelTraverse;
|
|
36
4
|
const getJsxElements = (ast, name) => {
|
|
37
5
|
let elements = [];
|
|
38
|
-
(
|
|
6
|
+
traverse(ast, {
|
|
39
7
|
JSXIdentifier(path) {
|
|
40
8
|
if (path.node.name === name && path.parentPath.type === "JSXOpeningElement") {
|
|
41
9
|
if (path?.parentPath?.parentPath?.type === "JSXElement") {
|
|
@@ -57,7 +25,7 @@ const getJsxProps = (jsxElement) => {
|
|
|
57
25
|
const props = {};
|
|
58
26
|
for (const a of attributes) {
|
|
59
27
|
if (typeof a.name.name === "string") {
|
|
60
|
-
props[a.name.name] =
|
|
28
|
+
props[a.name.name] = getJsxAttributeValue(a.value);
|
|
61
29
|
}
|
|
62
30
|
}
|
|
63
31
|
return props;
|
|
@@ -94,7 +62,6 @@ const reduceJsxElement = (oldNode, currentNode) => {
|
|
|
94
62
|
}
|
|
95
63
|
return oldNode;
|
|
96
64
|
};
|
|
97
|
-
|
|
98
|
-
0 && (module.exports = {
|
|
65
|
+
export {
|
|
99
66
|
getJsxElements
|
|
100
|
-
}
|
|
67
|
+
};
|
|
@@ -1,26 +1,3 @@
|
|
|
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 jsxAttributeValue_exports = {};
|
|
20
|
-
__export(jsxAttributeValue_exports, {
|
|
21
|
-
getJsxAttributeValue: () => getJsxAttributeValue
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(jsxAttributeValue_exports);
|
|
24
1
|
const getJsxAttributeValue = (expression) => {
|
|
25
2
|
if (expression === null) {
|
|
26
3
|
return true;
|
|
@@ -123,7 +100,6 @@ const getJsxAttributeValue = (expression) => {
|
|
|
123
100
|
}
|
|
124
101
|
return `${expression.type} is not supported`;
|
|
125
102
|
};
|
|
126
|
-
|
|
127
|
-
0 && (module.exports = {
|
|
103
|
+
export {
|
|
128
104
|
getJsxAttributeValue
|
|
129
|
-
}
|
|
105
|
+
};
|
package/dist/project.js
CHANGED
|
@@ -1,54 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 project_exports = {};
|
|
30
|
-
__export(project_exports, {
|
|
31
|
-
getTsConfigs: () => getTsConfigs,
|
|
32
|
-
isRealtimeSetup: () => isRealtimeSetup,
|
|
33
|
-
isServerFileSetup: () => isServerFileSetup,
|
|
34
|
-
isTypeScriptProject: () => isTypeScriptProject
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(project_exports);
|
|
37
|
-
var import_fs = __toESM(require("fs"));
|
|
38
|
-
var import_path = __toESM(require("path"));
|
|
39
|
-
var import_typescript = require("typescript");
|
|
40
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { parseConfigFileTextToJson } from "typescript";
|
|
4
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
41
5
|
const getTsConfigs = () => {
|
|
42
|
-
const rwPaths =
|
|
43
|
-
const apiTsConfigPath =
|
|
44
|
-
const webTsConfigPath =
|
|
45
|
-
const apiTsConfig =
|
|
6
|
+
const rwPaths = getPaths();
|
|
7
|
+
const apiTsConfigPath = path.join(rwPaths.api.base, "tsconfig.json");
|
|
8
|
+
const webTsConfigPath = path.join(rwPaths.web.base, "tsconfig.json");
|
|
9
|
+
const apiTsConfig = fs.existsSync(apiTsConfigPath) ? parseConfigFileTextToJson(
|
|
46
10
|
apiTsConfigPath,
|
|
47
|
-
|
|
11
|
+
fs.readFileSync(apiTsConfigPath, "utf-8")
|
|
48
12
|
) : null;
|
|
49
|
-
const webTsConfig =
|
|
13
|
+
const webTsConfig = fs.existsSync(webTsConfigPath) ? parseConfigFileTextToJson(
|
|
50
14
|
webTsConfigPath,
|
|
51
|
-
|
|
15
|
+
fs.readFileSync(webTsConfigPath, "utf-8")
|
|
52
16
|
) : null;
|
|
53
17
|
return {
|
|
54
18
|
api: apiTsConfig?.config ?? null,
|
|
@@ -56,27 +20,26 @@ const getTsConfigs = () => {
|
|
|
56
20
|
};
|
|
57
21
|
};
|
|
58
22
|
const isTypeScriptProject = () => {
|
|
59
|
-
const paths =
|
|
60
|
-
return
|
|
23
|
+
const paths = getPaths();
|
|
24
|
+
return fs.existsSync(path.join(paths.web.base, "tsconfig.json")) || fs.existsSync(path.join(paths.api.base, "tsconfig.json"));
|
|
61
25
|
};
|
|
62
26
|
const isServerFileSetup = () => {
|
|
63
|
-
const serverFilePath =
|
|
64
|
-
|
|
27
|
+
const serverFilePath = path.join(
|
|
28
|
+
getPaths().api.src,
|
|
65
29
|
`server.${isTypeScriptProject() ? "ts" : "js"}`
|
|
66
30
|
);
|
|
67
|
-
return
|
|
31
|
+
return fs.existsSync(serverFilePath);
|
|
68
32
|
};
|
|
69
33
|
const isRealtimeSetup = () => {
|
|
70
|
-
const realtimePath =
|
|
71
|
-
|
|
34
|
+
const realtimePath = path.join(
|
|
35
|
+
getPaths().api.lib,
|
|
72
36
|
`realtime.${isTypeScriptProject() ? "ts" : "js"}`
|
|
73
37
|
);
|
|
74
|
-
return
|
|
38
|
+
return fs.existsSync(realtimePath);
|
|
75
39
|
};
|
|
76
|
-
|
|
77
|
-
0 && (module.exports = {
|
|
40
|
+
export {
|
|
78
41
|
getTsConfigs,
|
|
79
42
|
isRealtimeSetup,
|
|
80
43
|
isServerFileSetup,
|
|
81
44
|
isTypeScriptProject
|
|
82
|
-
}
|
|
45
|
+
};
|
package/dist/routes.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare function getDuplicateRoutes(): RouteInformation[];
|
|
|
10
10
|
/**
|
|
11
11
|
* Detects any potential duplicate routes and returns a formatted warning message
|
|
12
12
|
* @see {@link getDuplicateRoutes} for how duplicate routes are detected
|
|
13
|
-
* @return
|
|
13
|
+
* @return Warning message when duplicate routes found, empty string if not
|
|
14
14
|
*/
|
|
15
15
|
export declare function warningForDuplicateRoutes(): string;
|
|
16
16
|
export interface RWRouteManifestItem {
|
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,gBAAgB,EAAE,CAyBvD;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,WAgBxC;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,MAAM,CAAA;IACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,SAAS,EAAE,OAAO,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;IACnD,SAAS,EAAE,OAAO,CAAA;IAClB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAA;IAC/B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAE9B;AAED,MAAM,WAAW,SAAU,SAAQ,mBAAmB;IACpD,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,SAAS,EAAE,OAAO,CAAA;IAClB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED,eAAO,MAAM,gBAAgB,QAAO,SAAS,EAkC5C,CAAA"}
|
package/dist/routes.js
CHANGED
|
@@ -1,46 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 routes_exports = {};
|
|
30
|
-
__export(routes_exports, {
|
|
31
|
-
getDuplicateRoutes: () => getDuplicateRoutes,
|
|
32
|
-
getProjectRoutes: () => getProjectRoutes,
|
|
33
|
-
warningForDuplicateRoutes: () => warningForDuplicateRoutes
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(routes_exports);
|
|
36
|
-
var import_path = __toESM(require("path"));
|
|
37
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
38
|
-
var import_util = require("@cedarjs/router/dist/util");
|
|
39
|
-
var import_dist = require("@cedarjs/structure/dist/index.js");
|
|
40
|
-
const ansis = require("ansis");
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import ansis from "ansis";
|
|
3
|
+
import { getPaths, getRouteHookForPage } from "@cedarjs/project-config";
|
|
4
|
+
import { getRouteRegexAndParams } from "@cedarjs/router/dist/util";
|
|
5
|
+
import { getProject } from "@cedarjs/structure/dist/index.js";
|
|
41
6
|
function getDuplicateRoutes() {
|
|
42
7
|
const duplicateRoutes = [];
|
|
43
|
-
const allRoutes =
|
|
8
|
+
const allRoutes = getProject(getPaths().base).router.routes;
|
|
44
9
|
const uniqueNames = new Set(
|
|
45
10
|
allRoutes.filter((route) => route.name !== void 0).map((route) => route.name)
|
|
46
11
|
);
|
|
@@ -78,10 +43,10 @@ function warningForDuplicateRoutes() {
|
|
|
78
43
|
return message.trimEnd();
|
|
79
44
|
}
|
|
80
45
|
const getProjectRoutes = () => {
|
|
81
|
-
const rwProject =
|
|
46
|
+
const rwProject = getProject(getPaths().base);
|
|
82
47
|
const routes = rwProject.getRouter().routes;
|
|
83
48
|
return routes.map((route) => {
|
|
84
|
-
const { matchRegexString, routeParams } = route.isNotFound ? { matchRegexString: null, routeParams: null } :
|
|
49
|
+
const { matchRegexString, routeParams } = route.isNotFound ? { matchRegexString: null, routeParams: null } : getRouteRegexAndParams(route.path);
|
|
85
50
|
return {
|
|
86
51
|
name: route.isNotFound ? "NotFoundPage" : route.name,
|
|
87
52
|
pathDefinition: route.isNotFound ? "notfound" : route.path,
|
|
@@ -89,8 +54,8 @@ const getProjectRoutes = () => {
|
|
|
89
54
|
id: route.id,
|
|
90
55
|
isNotFound: route.isNotFound,
|
|
91
56
|
filePath: route.page?.filePath,
|
|
92
|
-
relativeFilePath: route.page?.filePath ?
|
|
93
|
-
routeHooks:
|
|
57
|
+
relativeFilePath: route.page?.filePath ? path.relative(getPaths().web.src, route.page?.filePath) : void 0,
|
|
58
|
+
routeHooks: getRouteHookForPage(route.page?.filePath),
|
|
94
59
|
renderMode: route.renderMode,
|
|
95
60
|
matchRegexString,
|
|
96
61
|
paramNames: routeParams,
|
|
@@ -103,9 +68,8 @@ const getProjectRoutes = () => {
|
|
|
103
68
|
};
|
|
104
69
|
});
|
|
105
70
|
};
|
|
106
|
-
|
|
107
|
-
0 && (module.exports = {
|
|
71
|
+
export {
|
|
108
72
|
getDuplicateRoutes,
|
|
109
73
|
getProjectRoutes,
|
|
110
74
|
warningForDuplicateRoutes
|
|
111
|
-
}
|
|
75
|
+
};
|
package/dist/ts2js.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare const transformTSToJS: (file: string) => Promise<string> | undefi
|
|
|
31
31
|
export declare const getPrettierConfig: () => Promise<any>;
|
|
32
32
|
/**
|
|
33
33
|
* Prettify `code` according to the extension in `filename`.
|
|
34
|
-
* This will also read a user's `prettier.config.
|
|
34
|
+
* This will also read a user's `prettier.config.cjs` file if it exists.
|
|
35
35
|
*
|
|
36
36
|
* @param {string} code
|
|
37
37
|
* @param {string} filename
|
package/dist/ts2js.js
CHANGED
|
@@ -1,53 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 ts2js_exports = {};
|
|
30
|
-
__export(ts2js_exports, {
|
|
31
|
-
convertTsFilesToJs: () => convertTsFilesToJs,
|
|
32
|
-
convertTsProjectToJs: () => convertTsProjectToJs,
|
|
33
|
-
convertTsScriptsToJs: () => convertTsScriptsToJs,
|
|
34
|
-
getPrettierConfig: () => getPrettierConfig,
|
|
35
|
-
prettify: () => prettify,
|
|
36
|
-
transformTSToJS: () => transformTSToJS,
|
|
37
|
-
typeScriptSourceFiles: () => typeScriptSourceFiles
|
|
38
|
-
});
|
|
39
|
-
module.exports = __toCommonJS(ts2js_exports);
|
|
40
|
-
var import_fs = __toESM(require("fs"));
|
|
41
|
-
var import_path = __toESM(require("path"));
|
|
42
|
-
var import_core = require("@babel/core");
|
|
43
|
-
var import_fast_glob = __toESM(require("fast-glob"));
|
|
44
|
-
var import_prettier = require("prettier");
|
|
45
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
46
|
-
const convertTsProjectToJs = (cwd = (0, import_project_config.getPaths)().base) => {
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { transform } from "@babel/core";
|
|
4
|
+
import fg from "fast-glob";
|
|
5
|
+
import { format } from "prettier";
|
|
6
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
7
|
+
const convertTsProjectToJs = (cwd = getPaths().base) => {
|
|
47
8
|
const files = typeScriptSourceFiles(cwd);
|
|
48
9
|
convertTsFilesToJs(cwd, files);
|
|
49
10
|
};
|
|
50
|
-
const convertTsScriptsToJs = (cwd =
|
|
11
|
+
const convertTsScriptsToJs = (cwd = getPaths().base) => {
|
|
51
12
|
const files = typeScriptSourceFiles(cwd, "scripts/*.{ts,tsx}");
|
|
52
13
|
convertTsFilesToJs(cwd, files);
|
|
53
14
|
};
|
|
@@ -58,46 +19,46 @@ const convertTsFilesToJs = async (cwd, files) => {
|
|
|
58
19
|
for (const f of files) {
|
|
59
20
|
const code = await transformTSToJS(f);
|
|
60
21
|
if (code) {
|
|
61
|
-
|
|
62
|
-
|
|
22
|
+
fs.writeFileSync(
|
|
23
|
+
path.join(cwd, f.replace(".tsx", ".jsx").replace(".ts", ".js")),
|
|
63
24
|
code,
|
|
64
25
|
"utf8"
|
|
65
26
|
);
|
|
66
|
-
|
|
27
|
+
fs.unlinkSync(path.join(cwd, f));
|
|
67
28
|
}
|
|
68
29
|
}
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
30
|
+
if (fs.existsSync(path.join(cwd, "api/tsconfig.json"))) {
|
|
31
|
+
fs.renameSync(
|
|
32
|
+
path.join(cwd, "api/tsconfig.json"),
|
|
33
|
+
path.join(cwd, "api/jsconfig.json")
|
|
73
34
|
);
|
|
74
35
|
}
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
36
|
+
if (fs.existsSync(path.join(cwd, "web/tsconfig.json"))) {
|
|
37
|
+
fs.renameSync(
|
|
38
|
+
path.join(cwd, "web/tsconfig.json"),
|
|
39
|
+
path.join(cwd, "web/jsconfig.json")
|
|
79
40
|
);
|
|
80
41
|
}
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
42
|
+
if (fs.existsSync(path.join(cwd, "scripts/tsconfig.json"))) {
|
|
43
|
+
fs.renameSync(
|
|
44
|
+
path.join(cwd, "scripts/tsconfig.json"),
|
|
45
|
+
path.join(cwd, "scripts/jsconfig.json")
|
|
85
46
|
);
|
|
86
47
|
}
|
|
87
48
|
};
|
|
88
49
|
const typeScriptSourceFiles = (cwd, globPattern = "{api,web}/src/**/*.{ts,tsx}") => {
|
|
89
50
|
console.log(globPattern);
|
|
90
|
-
return
|
|
51
|
+
return fg.sync(globPattern, {
|
|
91
52
|
cwd,
|
|
92
53
|
ignore: ["node_modules"]
|
|
93
54
|
});
|
|
94
55
|
};
|
|
95
56
|
const transformTSToJS = (file) => {
|
|
96
|
-
const tsCode =
|
|
97
|
-
const filename =
|
|
98
|
-
const result =
|
|
57
|
+
const tsCode = fs.readFileSync(file, "utf8");
|
|
58
|
+
const filename = path.basename(file);
|
|
59
|
+
const result = transform(tsCode, {
|
|
99
60
|
filename,
|
|
100
|
-
cwd:
|
|
61
|
+
cwd: getPaths().base,
|
|
101
62
|
configFile: false,
|
|
102
63
|
plugins: [
|
|
103
64
|
[
|
|
@@ -117,14 +78,14 @@ const transformTSToJS = (file) => {
|
|
|
117
78
|
};
|
|
118
79
|
const getPrettierConfig = async () => {
|
|
119
80
|
try {
|
|
120
|
-
const { default: prettierConfig } = await import(`file://${
|
|
81
|
+
const { default: prettierConfig } = await import(`file://${path.join(getPaths().base, "prettier.config.cjs")}`);
|
|
121
82
|
return prettierConfig;
|
|
122
83
|
} catch {
|
|
123
84
|
return void 0;
|
|
124
85
|
}
|
|
125
86
|
};
|
|
126
87
|
const prettierParser = (filename) => {
|
|
127
|
-
switch (
|
|
88
|
+
switch (path.extname(filename.replace(".template", ""))) {
|
|
128
89
|
case ".css":
|
|
129
90
|
return "css";
|
|
130
91
|
case ".js":
|
|
@@ -142,13 +103,12 @@ const prettify = async (code, filename) => {
|
|
|
142
103
|
return code;
|
|
143
104
|
}
|
|
144
105
|
const prettierConfig = await getPrettierConfig();
|
|
145
|
-
return
|
|
106
|
+
return format(code, {
|
|
146
107
|
...prettierConfig,
|
|
147
108
|
parser
|
|
148
109
|
});
|
|
149
110
|
};
|
|
150
|
-
|
|
151
|
-
0 && (module.exports = {
|
|
111
|
+
export {
|
|
152
112
|
convertTsFilesToJs,
|
|
153
113
|
convertTsProjectToJs,
|
|
154
114
|
convertTsScriptsToJs,
|
|
@@ -156,4 +116,4 @@ const prettify = async (code, filename) => {
|
|
|
156
116
|
prettify,
|
|
157
117
|
transformTSToJS,
|
|
158
118
|
typeScriptSourceFiles
|
|
159
|
-
}
|
|
119
|
+
};
|