@jay-framework/plugin-validator 0.11.0 → 0.12.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/index.js +70 -56
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -156,29 +156,33 @@ async function validateSchema(context, result) {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
if (manifest.dynamic_contracts) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
159
|
+
const dynamicConfigs = Array.isArray(manifest.dynamic_contracts) ? manifest.dynamic_contracts : [manifest.dynamic_contracts];
|
|
160
|
+
for (const config of dynamicConfigs) {
|
|
161
|
+
const prefix = config.prefix || "(unknown)";
|
|
162
|
+
if (!config.component) {
|
|
163
|
+
result.errors.push({
|
|
164
|
+
type: "schema",
|
|
165
|
+
message: `dynamic_contracts[${prefix}] is missing "component" field`,
|
|
166
|
+
location: "plugin.yaml",
|
|
167
|
+
suggestion: "Specify path to shared component for dynamic contracts"
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
if (!config.generator) {
|
|
171
|
+
result.errors.push({
|
|
172
|
+
type: "schema",
|
|
173
|
+
message: `dynamic_contracts[${prefix}] is missing "generator" field`,
|
|
174
|
+
location: "plugin.yaml",
|
|
175
|
+
suggestion: "Specify path to generator file or export name"
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
if (!config.prefix) {
|
|
179
|
+
result.errors.push({
|
|
180
|
+
type: "schema",
|
|
181
|
+
message: 'dynamic_contracts entry is missing "prefix" field',
|
|
182
|
+
location: "plugin.yaml",
|
|
183
|
+
suggestion: 'Specify prefix for dynamic contract names (e.g., "cms")'
|
|
184
|
+
});
|
|
185
|
+
}
|
|
182
186
|
}
|
|
183
187
|
}
|
|
184
188
|
if (!manifest.contracts && !manifest.dynamic_contracts) {
|
|
@@ -369,43 +373,53 @@ async function validateDynamicContracts(context, result) {
|
|
|
369
373
|
const { dynamic_contracts } = context.manifest;
|
|
370
374
|
if (!dynamic_contracts)
|
|
371
375
|
return;
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
if (
|
|
378
|
-
|
|
379
|
-
|
|
376
|
+
const dynamicConfigs = Array.isArray(dynamic_contracts) ? dynamic_contracts : [dynamic_contracts];
|
|
377
|
+
for (const config of dynamicConfigs) {
|
|
378
|
+
const prefix = config.prefix || "(unknown)";
|
|
379
|
+
if (config.generator) {
|
|
380
|
+
const isFilePath = config.generator.startsWith("./") || config.generator.startsWith("/") || config.generator.includes(".ts") || config.generator.includes(".js");
|
|
381
|
+
if (isFilePath) {
|
|
382
|
+
const generatorPath = path.join(context.pluginPath, config.generator);
|
|
383
|
+
const possibleExtensions = ["", ".ts", ".js", "/index.ts", "/index.js"];
|
|
384
|
+
let found = false;
|
|
385
|
+
for (const ext of possibleExtensions) {
|
|
386
|
+
if (fs.existsSync(generatorPath + ext)) {
|
|
387
|
+
found = true;
|
|
388
|
+
break;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
if (!found && !context.isNpmPackage) {
|
|
392
|
+
result.errors.push({
|
|
393
|
+
type: "file-missing",
|
|
394
|
+
message: `Generator file not found for ${prefix}: ${config.generator}`,
|
|
395
|
+
location: "plugin.yaml dynamic_contracts",
|
|
396
|
+
suggestion: `Create generator file at ${generatorPath}.ts`
|
|
397
|
+
});
|
|
398
|
+
}
|
|
380
399
|
}
|
|
381
400
|
}
|
|
382
|
-
if (
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
401
|
+
if (config.component) {
|
|
402
|
+
const isFilePath = config.component.startsWith("./") || config.component.startsWith("/") || config.component.includes(".ts") || config.component.includes(".js");
|
|
403
|
+
if (isFilePath) {
|
|
404
|
+
const componentPath = path.join(context.pluginPath, config.component);
|
|
405
|
+
const possibleExtensions = ["", ".ts", ".js", "/index.ts", "/index.js"];
|
|
406
|
+
let found = false;
|
|
407
|
+
for (const ext of possibleExtensions) {
|
|
408
|
+
if (fs.existsSync(componentPath + ext)) {
|
|
409
|
+
found = true;
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (!found && !context.isNpmPackage) {
|
|
414
|
+
result.errors.push({
|
|
415
|
+
type: "file-missing",
|
|
416
|
+
message: `Dynamic contracts component not found for ${prefix}: ${config.component}`,
|
|
417
|
+
location: "plugin.yaml dynamic_contracts",
|
|
418
|
+
suggestion: `Create component file at ${componentPath}.ts`
|
|
419
|
+
});
|
|
420
|
+
}
|
|
399
421
|
}
|
|
400
422
|
}
|
|
401
|
-
if (!found && !context.isNpmPackage) {
|
|
402
|
-
result.errors.push({
|
|
403
|
-
type: "file-missing",
|
|
404
|
-
message: `Dynamic contracts component not found: ${dynamic_contracts.component}`,
|
|
405
|
-
location: "plugin.yaml dynamic_contracts",
|
|
406
|
-
suggestion: `Create component file at ${componentPath}.ts`
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
423
|
}
|
|
410
424
|
}
|
|
411
425
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/plugin-validator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "Validation tool for Jay Stack plugins",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"test:watch": ":"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@jay-framework/compiler-jay-html": "^0.
|
|
29
|
-
"@jay-framework/editor-protocol": "^0.
|
|
28
|
+
"@jay-framework/compiler-jay-html": "^0.12.0",
|
|
29
|
+
"@jay-framework/editor-protocol": "^0.12.0",
|
|
30
30
|
"chalk": "^4.1.2",
|
|
31
31
|
"yaml": "^2.3.4"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@jay-framework/dev-environment": "^0.
|
|
34
|
+
"@jay-framework/dev-environment": "^0.12.0",
|
|
35
35
|
"@types/node": "^22.15.21",
|
|
36
36
|
"rimraf": "^5.0.5",
|
|
37
37
|
"tsup": "^8.0.1",
|