@lunora/codegen 1.0.0-alpha.26 → 1.0.0-alpha.27
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/index.mjs
CHANGED
|
@@ -23,7 +23,7 @@ export { GENERATED_HEADER, emitApi, emitCollections, emitContainers, emitCrons,
|
|
|
23
23
|
export { emitApp } from './packem_shared/emitApp-C38fHt_1.mjs';
|
|
24
24
|
export { buildOpenApiDocument, emitOpenApi, emitOpenApiModule } from './packem_shared/buildOpenApiDocument-BlpXQe2K.mjs';
|
|
25
25
|
export { OPENRPC_VERSION, buildOpenRpcDocument, emitOpenRpc, emitOpenRpcModule } from './packem_shared/OPENRPC_VERSION-CRe5l79E.mjs';
|
|
26
|
-
export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME-
|
|
26
|
+
export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME-B3TwY0JD.mjs';
|
|
27
27
|
export { SCHEMA_SNAPSHOT_VERSION, SchemaSnapshotParseError, buildSchemaSnapshot, diffSchemaSnapshots, evaluateSchemaDrift, parseSchemaSnapshot, serializeSchemaSnapshot } from './packem_shared/SCHEMA_SNAPSHOT_VERSION-wWGP2_5E.mjs';
|
|
28
28
|
export { schemaFromIr } from './packem_shared/schemaFromIr-DTYsLBaA.mjs';
|
|
29
29
|
export { LUNORA_ERROR_CODES, validatorIrToJsonSchema } from './packem_shared/LUNORA_ERROR_CODES-CySpQPD3.mjs';
|
|
@@ -268,20 +268,28 @@ const PROBES = {
|
|
|
268
268
|
vectors: { contextProperty: "vectors", moduleSpecifier: "@lunora/bindings/vectors" },
|
|
269
269
|
workflows: { contextProperty: "workflows", moduleSpecifier: "@lunora/workflow" }
|
|
270
270
|
};
|
|
271
|
-
const
|
|
271
|
+
const contextPropertiesRead = (sourceFile) => {
|
|
272
272
|
const reachesContext = (receiver) => Node.isIdentifier(receiver) && receiver.getText() === "ctx";
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
273
|
+
const names = /* @__PURE__ */ new Set();
|
|
274
|
+
for (const access of sourceFile.getDescendantsOfKind(SyntaxKind.PropertyAccessExpression)) {
|
|
275
|
+
if (reachesContext(access.getExpression())) {
|
|
276
|
+
names.add(access.getName());
|
|
277
|
+
}
|
|
276
278
|
}
|
|
277
|
-
|
|
279
|
+
for (const declaration of sourceFile.getDescendantsOfKind(SyntaxKind.VariableDeclaration)) {
|
|
278
280
|
const initializer = declaration.getInitializer();
|
|
279
281
|
const nameNode = declaration.getNameNode();
|
|
280
282
|
if (initializer === void 0 || !reachesContext(initializer) || !Node.isObjectBindingPattern(nameNode)) {
|
|
281
|
-
|
|
283
|
+
continue;
|
|
282
284
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
+
for (const element of nameNode.getElements()) {
|
|
286
|
+
const name = element.getPropertyNameNode()?.getText() ?? element.getName();
|
|
287
|
+
if (name) {
|
|
288
|
+
names.add(name);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return names;
|
|
285
293
|
};
|
|
286
294
|
const discoverFeatureUsage = (project, lunoraDirectory) => {
|
|
287
295
|
const usage = {
|
|
@@ -306,6 +314,7 @@ const discoverFeatureUsage = (project, lunoraDirectory) => {
|
|
|
306
314
|
for (const filePath of listLunoraSourceFiles(lunoraDirectory)) {
|
|
307
315
|
const sourceFile = project.getSourceFile(filePath) ?? project.addSourceFileAtPath(filePath);
|
|
308
316
|
const importSpecifiers = new Set(sourceFile.getImportDeclarations().map((declaration) => declaration.getModuleSpecifierValue()));
|
|
317
|
+
const contextProperties = contextPropertiesRead(sourceFile);
|
|
309
318
|
for (const key of keys) {
|
|
310
319
|
if (usage[key]) {
|
|
311
320
|
continue;
|
|
@@ -315,7 +324,7 @@ const discoverFeatureUsage = (project, lunoraDirectory) => {
|
|
|
315
324
|
usage[key] = true;
|
|
316
325
|
continue;
|
|
317
326
|
}
|
|
318
|
-
if (probe.contextProperty !== void 0 &&
|
|
327
|
+
if (probe.contextProperty !== void 0 && contextProperties.has(probe.contextProperty)) {
|
|
319
328
|
usage[key] = true;
|
|
320
329
|
}
|
|
321
330
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/codegen",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.27",
|
|
4
4
|
"description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@lunora/advisor": "1.0.0-alpha.
|
|
49
|
+
"@lunora/advisor": "1.0.0-alpha.15",
|
|
50
50
|
"@lunora/container": "1.0.0-alpha.5",
|
|
51
51
|
"@lunora/queue": "1.0.0-alpha.2",
|
|
52
52
|
"@lunora/scheduler": "1.0.0-alpha.4",
|