@jay-framework/compiler-shared 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.d.ts +39 -6
- package/dist/index.js +160 -73
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -69,6 +69,8 @@ declare const Import: {
|
|
|
69
69
|
mimicJayElement: ImportName;
|
|
70
70
|
jayContract: ImportName;
|
|
71
71
|
injectHeadLinks: ImportName;
|
|
72
|
+
makeJayComponent: ImportName;
|
|
73
|
+
makeHeadlessInstanceComponent: ImportName;
|
|
72
74
|
};
|
|
73
75
|
declare class Imports {
|
|
74
76
|
private readonly imports;
|
|
@@ -93,6 +95,7 @@ declare const JAY_SECURE = "@jay-framework/secure";
|
|
|
93
95
|
declare const JAY_RUNTIME = "@jay-framework/runtime";
|
|
94
96
|
declare const JAY_4_REACT = "@jay-framework/4-react";
|
|
95
97
|
declare const JAY_FULLSTACK_COMPONENTS = "@jay-framework/fullstack-component";
|
|
98
|
+
declare const JAY_STACK_CLIENT_RUNTIME = "@jay-framework/stack-client-runtime";
|
|
96
99
|
declare const REACT = "react";
|
|
97
100
|
declare const MAKE_JAY_COMPONENT = "makeJayComponent";
|
|
98
101
|
declare const MAKE_JAY_TSX_COMPONENT = "makeJayTsxComponent";
|
|
@@ -386,6 +389,20 @@ declare class WithValidations<Value> {
|
|
|
386
389
|
flatMap<R>(func: (v: Value) => WithValidations<R>): WithValidations<R>;
|
|
387
390
|
flatMapAsync<R>(func: (v: Value) => Promise<WithValidations<R>>): Promise<WithValidations<R>>;
|
|
388
391
|
merge(other: WithValidations<Value>, merge: (t1: Value, t2: Value) => Value): WithValidations<Value>;
|
|
392
|
+
/**
|
|
393
|
+
* Append validations from another WithValidations without changing the value.
|
|
394
|
+
* Useful for collecting validations from side-effect operations.
|
|
395
|
+
*/
|
|
396
|
+
withValidationsFrom<T>(other: WithValidations<T>): WithValidations<Value>;
|
|
397
|
+
/**
|
|
398
|
+
* Merge an array of WithValidations into a single WithValidations containing an array of values.
|
|
399
|
+
* All validations are collected.
|
|
400
|
+
*/
|
|
401
|
+
static all<T>(items: WithValidations<T>[]): WithValidations<T[]>;
|
|
402
|
+
/**
|
|
403
|
+
* Create a WithValidations with no validations (pure value).
|
|
404
|
+
*/
|
|
405
|
+
static pure<T>(value: T): WithValidations<T>;
|
|
389
406
|
}
|
|
390
407
|
declare function checkValidationErrors<T>(withValidations: WithValidations<T>): T;
|
|
391
408
|
|
|
@@ -475,6 +492,17 @@ declare function removeComments(code: string): string;
|
|
|
475
492
|
* ```
|
|
476
493
|
*/
|
|
477
494
|
type PluginInitConfig = string;
|
|
495
|
+
/**
|
|
496
|
+
* Dynamic contract generator configuration.
|
|
497
|
+
*/
|
|
498
|
+
interface DynamicContractConfig {
|
|
499
|
+
/** Path to the generator module (relative to plugin root) */
|
|
500
|
+
generator: string;
|
|
501
|
+
/** Path to the headless component (relative to plugin root) */
|
|
502
|
+
component: string;
|
|
503
|
+
/** Prefix for generated contract names (e.g., "cms" -> "cms/blog-posts") */
|
|
504
|
+
prefix: string;
|
|
505
|
+
}
|
|
478
506
|
/**
|
|
479
507
|
* Plugin manifest structure from plugin.yaml
|
|
480
508
|
*/
|
|
@@ -488,15 +516,20 @@ interface PluginManifest {
|
|
|
488
516
|
component: string;
|
|
489
517
|
description?: string;
|
|
490
518
|
}>;
|
|
491
|
-
dynamic_contracts?:
|
|
492
|
-
generator: string;
|
|
493
|
-
component: string;
|
|
494
|
-
prefix: string;
|
|
495
|
-
};
|
|
519
|
+
dynamic_contracts?: DynamicContractConfig | DynamicContractConfig[];
|
|
496
520
|
/** Named exports from plugin backend bundle that are JayAction instances */
|
|
497
521
|
actions?: string[];
|
|
498
522
|
/** Plugin initialization configuration */
|
|
499
523
|
init?: PluginInitConfig;
|
|
524
|
+
/** Plugin setup configuration (Design Log #87) */
|
|
525
|
+
setup?: {
|
|
526
|
+
/** Export name (NPM) or relative path (local) to setup handler function */
|
|
527
|
+
handler: string;
|
|
528
|
+
/** Export name for reference data generation (called by jay-stack agent-kit) */
|
|
529
|
+
references?: string;
|
|
530
|
+
/** Human-readable description of what setup does */
|
|
531
|
+
description?: string;
|
|
532
|
+
};
|
|
500
533
|
}
|
|
501
534
|
/**
|
|
502
535
|
* Result of resolving a plugin component
|
|
@@ -548,4 +581,4 @@ declare function resolveNpmPlugin(projectRoot: string, pluginName: string, contr
|
|
|
548
581
|
*/
|
|
549
582
|
declare function resolvePluginComponent(projectRoot: string, pluginName: string, contractName: string): WithValidations<PluginComponentResolution>;
|
|
550
583
|
|
|
551
|
-
export { CSS_EXTENSION, type CompilerSourceFile, GenerateTarget, type GenericTypescriptSourceFile, Import, type ImportName, type ImportedRefsTree, Imports, ImportsFor, JAY_4_REACT, JAY_COMPONENT, JAY_CONTRACT_DTS_EXTENSION, JAY_CONTRACT_EXTENSION, JAY_DTS_EXTENSION, JAY_EXTENSION, JAY_FULLSTACK_COMPONENTS, JAY_QUERY_CLIENT, JAY_QUERY_MAIN_SANDBOX, JAY_QUERY_MAIN_SANDBOX_TS, JAY_QUERY_PREFIX, JAY_QUERY_SERVER, JAY_QUERY_WORKER_SANDBOX, JAY_QUERY_WORKER_SANDBOX_TS, JAY_QUERY_WORKER_TRUSTED, JAY_QUERY_WORKER_TRUSTED_TS, JAY_RUNTIME, JAY_SECURE, JAY_TS_EXTENSION, JayArrayType, JayAtomicType, JayBoolean, JayBuildEnvironment, JayComponentApiMember, JayComponentType, JayDate, JayElementConstructorType, JayElementType, JayEnumType, type JayEnvironment, JayErrorType, JayHTMLType, type JayImportLink, type JayImportName, JayImportedType, JayNumber, JayObjectType, JayPromiseType, JayRecursiveType, JayString, type JayType, JayTypeAlias, JayTypeKind, JayUnionType, JayUnknown, type JayValidations, MAKE_JAY_4_REACT_COMPONENT, MAKE_JAY_COMPONENT, MAKE_JAY_TSX_COMPONENT, type MainRuntimeModes, type ParsedJayModuleSpecifier, type PluginComponentResolution, type PluginInitConfig, type PluginManifest, REACT, type RecursiveRegion, type Ref, type RefsTree, RenderFragment, RuntimeMode, SourceFileFormat, TSX_EXTENSION, TS_EXTENSION, WithValidations, addBuildEnvironment, checkValidationErrors, equalJayTypes, getBasePath, getBuildEnvironment, getJayTsFileSourcePath, getMode, getModeFileExtension, getModeFromExtension, hasBuildEnvironment, hasExtension, hasJayExtension, hasJayModeExtension, hasRefs, isArrayType, isAtomicType, isComponentType, isCurrencyType, isDateWithTimezoneType, isElementConstructorType, isElementType, isEnumType, isHTMLType, isImportedType, isLocalModule, isObjectType, isPromiseType, isRecursiveType, isTypeAliasType, isUnionType, loadPluginManifest, mergeRefsTrees, mkRef, mkRefsTree, nestRefs, parseJayModuleSpecifier, prettify, prettifyHtml, removeComments, resolveLocalPlugin, resolveNpmPlugin, resolvePluginComponent, resolvePrimitiveType, withOriginalTrace, withoutExtension };
|
|
584
|
+
export { CSS_EXTENSION, type CompilerSourceFile, type DynamicContractConfig, GenerateTarget, type GenericTypescriptSourceFile, Import, type ImportName, type ImportedRefsTree, Imports, ImportsFor, JAY_4_REACT, JAY_COMPONENT, JAY_CONTRACT_DTS_EXTENSION, JAY_CONTRACT_EXTENSION, JAY_DTS_EXTENSION, JAY_EXTENSION, JAY_FULLSTACK_COMPONENTS, JAY_QUERY_CLIENT, JAY_QUERY_MAIN_SANDBOX, JAY_QUERY_MAIN_SANDBOX_TS, JAY_QUERY_PREFIX, JAY_QUERY_SERVER, JAY_QUERY_WORKER_SANDBOX, JAY_QUERY_WORKER_SANDBOX_TS, JAY_QUERY_WORKER_TRUSTED, JAY_QUERY_WORKER_TRUSTED_TS, JAY_RUNTIME, JAY_SECURE, JAY_STACK_CLIENT_RUNTIME, JAY_TS_EXTENSION, JayArrayType, JayAtomicType, JayBoolean, JayBuildEnvironment, JayComponentApiMember, JayComponentType, JayDate, JayElementConstructorType, JayElementType, JayEnumType, type JayEnvironment, JayErrorType, JayHTMLType, type JayImportLink, type JayImportName, JayImportedType, JayNumber, JayObjectType, JayPromiseType, JayRecursiveType, JayString, type JayType, JayTypeAlias, JayTypeKind, JayUnionType, JayUnknown, type JayValidations, MAKE_JAY_4_REACT_COMPONENT, MAKE_JAY_COMPONENT, MAKE_JAY_TSX_COMPONENT, type MainRuntimeModes, type ParsedJayModuleSpecifier, type PluginComponentResolution, type PluginInitConfig, type PluginManifest, REACT, type RecursiveRegion, type Ref, type RefsTree, RenderFragment, RuntimeMode, SourceFileFormat, TSX_EXTENSION, TS_EXTENSION, WithValidations, addBuildEnvironment, checkValidationErrors, equalJayTypes, getBasePath, getBuildEnvironment, getJayTsFileSourcePath, getMode, getModeFileExtension, getModeFromExtension, hasBuildEnvironment, hasExtension, hasJayExtension, hasJayModeExtension, hasRefs, isArrayType, isAtomicType, isComponentType, isCurrencyType, isDateWithTimezoneType, isElementConstructorType, isElementType, isEnumType, isHTMLType, isImportedType, isLocalModule, isObjectType, isPromiseType, isRecursiveType, isTypeAliasType, isUnionType, loadPluginManifest, mergeRefsTrees, mkRef, mkRefsTree, nestRefs, parseJayModuleSpecifier, prettify, prettifyHtml, removeComments, resolveLocalPlugin, resolveNpmPlugin, resolvePluginComponent, resolvePrimitiveType, withOriginalTrace, withoutExtension };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ const JAY_SECURE = "@jay-framework/secure";
|
|
|
21
21
|
const JAY_RUNTIME = "@jay-framework/runtime";
|
|
22
22
|
const JAY_4_REACT = "@jay-framework/4-react";
|
|
23
23
|
const JAY_FULLSTACK_COMPONENTS = "@jay-framework/fullstack-component";
|
|
24
|
+
const JAY_STACK_CLIENT_RUNTIME = "@jay-framework/stack-client-runtime";
|
|
24
25
|
const REACT = "react";
|
|
25
26
|
const MAKE_JAY_COMPONENT = "makeJayComponent";
|
|
26
27
|
const MAKE_JAY_TSX_COMPONENT = "makeJayTsxComponent";
|
|
@@ -400,6 +401,18 @@ const Import = {
|
|
|
400
401
|
"injectHeadLinks",
|
|
401
402
|
1
|
|
402
403
|
/* implementation */
|
|
404
|
+
),
|
|
405
|
+
makeJayComponent: importStatementFragment(
|
|
406
|
+
JAY_COMPONENT,
|
|
407
|
+
"makeJayComponent",
|
|
408
|
+
1
|
|
409
|
+
/* implementation */
|
|
410
|
+
),
|
|
411
|
+
makeHeadlessInstanceComponent: importStatementFragment(
|
|
412
|
+
JAY_STACK_CLIENT_RUNTIME,
|
|
413
|
+
"makeHeadlessInstanceComponent",
|
|
414
|
+
1
|
|
415
|
+
/* implementation */
|
|
403
416
|
)
|
|
404
417
|
};
|
|
405
418
|
class Imports {
|
|
@@ -928,6 +941,28 @@ class WithValidations {
|
|
|
928
941
|
...other.validations
|
|
929
942
|
]);
|
|
930
943
|
}
|
|
944
|
+
/**
|
|
945
|
+
* Append validations from another WithValidations without changing the value.
|
|
946
|
+
* Useful for collecting validations from side-effect operations.
|
|
947
|
+
*/
|
|
948
|
+
withValidationsFrom(other) {
|
|
949
|
+
return new WithValidations(this.val, [...this.validations, ...other.validations]);
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Merge an array of WithValidations into a single WithValidations containing an array of values.
|
|
953
|
+
* All validations are collected.
|
|
954
|
+
*/
|
|
955
|
+
static all(items) {
|
|
956
|
+
const values = items.map((item) => item.val).filter((v) => v !== void 0);
|
|
957
|
+
const validations = items.flatMap((item) => item.validations);
|
|
958
|
+
return new WithValidations(values, validations);
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Create a WithValidations with no validations (pure value).
|
|
962
|
+
*/
|
|
963
|
+
static pure(value) {
|
|
964
|
+
return new WithValidations(value, []);
|
|
965
|
+
}
|
|
931
966
|
}
|
|
932
967
|
function checkValidationErrors(withValidations) {
|
|
933
968
|
const { validations } = withValidations;
|
|
@@ -1102,6 +1137,18 @@ function loadPluginManifest(pluginDir) {
|
|
|
1102
1137
|
return null;
|
|
1103
1138
|
}
|
|
1104
1139
|
}
|
|
1140
|
+
function findDynamicContract(manifest, contractName) {
|
|
1141
|
+
if (!manifest.dynamic_contracts) {
|
|
1142
|
+
return null;
|
|
1143
|
+
}
|
|
1144
|
+
const slashIndex = contractName.indexOf("/");
|
|
1145
|
+
if (slashIndex === -1) {
|
|
1146
|
+
return null;
|
|
1147
|
+
}
|
|
1148
|
+
const prefix = contractName.substring(0, slashIndex);
|
|
1149
|
+
const dynamicConfigs = Array.isArray(manifest.dynamic_contracts) ? manifest.dynamic_contracts : [manifest.dynamic_contracts];
|
|
1150
|
+
return dynamicConfigs.find((config) => config.prefix === prefix) || null;
|
|
1151
|
+
}
|
|
1105
1152
|
function resolveLocalPlugin(projectRoot, pluginName, contractName) {
|
|
1106
1153
|
const localPluginPath = path.join(projectRoot, "src/plugins", pluginName);
|
|
1107
1154
|
const pluginYamlPath = path.join(localPluginPath, "plugin.yaml");
|
|
@@ -1119,30 +1166,46 @@ function resolveLocalPlugin(projectRoot, pluginName, contractName) {
|
|
|
1119
1166
|
`Failed to parse plugin.yaml for local plugin "${pluginName}" at ${pluginYamlPath}`
|
|
1120
1167
|
]);
|
|
1121
1168
|
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1169
|
+
const componentModule = manifest.module || "index.js";
|
|
1170
|
+
const componentPath = path.join(localPluginPath, componentModule);
|
|
1171
|
+
if (manifest.contracts && manifest.contracts.length > 0) {
|
|
1172
|
+
const contract = manifest.contracts.find((c2) => c2.name === contractName);
|
|
1173
|
+
if (contract) {
|
|
1174
|
+
return new WithValidations(
|
|
1175
|
+
{
|
|
1176
|
+
contractPath: path.join(localPluginPath, contract.contract),
|
|
1177
|
+
componentPath,
|
|
1178
|
+
componentName: contract.component,
|
|
1179
|
+
isNpmPackage: false
|
|
1180
|
+
},
|
|
1181
|
+
[]
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1126
1184
|
}
|
|
1127
|
-
const
|
|
1128
|
-
if (
|
|
1129
|
-
|
|
1185
|
+
const dynamicConfig = findDynamicContract(manifest, contractName);
|
|
1186
|
+
if (dynamicConfig) {
|
|
1187
|
+
return new WithValidations(
|
|
1188
|
+
{
|
|
1189
|
+
contractPath: "",
|
|
1190
|
+
// Dynamic contracts don't have a static path
|
|
1191
|
+
componentPath,
|
|
1192
|
+
componentName: dynamicConfig.component,
|
|
1193
|
+
isNpmPackage: false
|
|
1194
|
+
},
|
|
1195
|
+
[]
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
if (!manifest.contracts && !manifest.dynamic_contracts) {
|
|
1130
1199
|
return new WithValidations(null, [
|
|
1131
|
-
`
|
|
1200
|
+
`Local plugin "${pluginName}" has no contracts or dynamic_contracts defined in plugin.yaml`
|
|
1132
1201
|
]);
|
|
1133
1202
|
}
|
|
1134
|
-
const
|
|
1135
|
-
const
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
componentName: contract.component,
|
|
1141
|
-
// This is the exported member name
|
|
1142
|
-
isNpmPackage: false
|
|
1143
|
-
},
|
|
1144
|
-
[]
|
|
1145
|
-
);
|
|
1203
|
+
const availableContracts = manifest.contracts?.map((c2) => c2.name) || [];
|
|
1204
|
+
const dynamicPrefixes = manifest.dynamic_contracts ? (Array.isArray(manifest.dynamic_contracts) ? manifest.dynamic_contracts : [manifest.dynamic_contracts]).map((c2) => `${c2.prefix}/*`) : [];
|
|
1205
|
+
const allAvailable = [...availableContracts, ...dynamicPrefixes].join(", ");
|
|
1206
|
+
return new WithValidations(null, [
|
|
1207
|
+
`Contract "${contractName}" not found in local plugin "${pluginName}". Available: ${allAvailable}`
|
|
1208
|
+
]);
|
|
1146
1209
|
}
|
|
1147
1210
|
function resolveNpmPlugin(projectRoot, pluginName, contractName) {
|
|
1148
1211
|
let pluginYamlPath;
|
|
@@ -1167,65 +1230,88 @@ function resolveNpmPlugin(projectRoot, pluginName, contractName) {
|
|
|
1167
1230
|
`Failed to parse plugin.yaml for NPM package "${pluginName}" at ${pluginYamlPath}`
|
|
1168
1231
|
]);
|
|
1169
1232
|
}
|
|
1170
|
-
if (!manifest.contracts || manifest.contracts.length === 0) {
|
|
1171
|
-
return new WithValidations(null, [
|
|
1172
|
-
`NPM package "${pluginName}" has no contracts defined in plugin.yaml`
|
|
1173
|
-
]);
|
|
1174
|
-
}
|
|
1175
|
-
const contract = manifest.contracts.find((c2) => c2.name === contractName);
|
|
1176
|
-
if (!contract) {
|
|
1177
|
-
const availableContracts = manifest.contracts.map((c2) => c2.name).join(", ");
|
|
1178
|
-
return new WithValidations(null, [
|
|
1179
|
-
`Contract "${contractName}" not found in NPM package "${pluginName}". Available contracts: ${availableContracts}`
|
|
1180
|
-
]);
|
|
1181
|
-
}
|
|
1182
1233
|
const packageJsonPath = path.join(npmPluginPath, "package.json");
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
}
|
|
1195
|
-
componentPath = path.join(npmPluginPath, "dist/index.js");
|
|
1234
|
+
const getComponentPath = () => {
|
|
1235
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
1236
|
+
try {
|
|
1237
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
1238
|
+
const packageName = packageJson.name;
|
|
1239
|
+
const moduleName = manifest.module || packageName;
|
|
1240
|
+
if ((moduleName === packageName || !manifest.module) && packageJson.exports && packageJson.exports["."]) {
|
|
1241
|
+
const mainExport = packageJson.exports["."];
|
|
1242
|
+
const mainPath = typeof mainExport === "string" ? mainExport : mainExport.default || mainExport.import;
|
|
1243
|
+
return path.join(npmPluginPath, mainPath);
|
|
1244
|
+
}
|
|
1245
|
+
} catch {
|
|
1196
1246
|
}
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1247
|
+
}
|
|
1248
|
+
return path.join(npmPluginPath, "dist/index.js");
|
|
1249
|
+
};
|
|
1250
|
+
if (manifest.contracts && manifest.contracts.length > 0) {
|
|
1251
|
+
const contract = manifest.contracts.find((c2) => c2.name === contractName);
|
|
1252
|
+
if (contract) {
|
|
1253
|
+
const componentPath = getComponentPath();
|
|
1254
|
+
let contractPath;
|
|
1255
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
1256
|
+
try {
|
|
1257
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
1258
|
+
const contractSpec = contract.contract;
|
|
1259
|
+
const contractExportKey = "./" + contractSpec;
|
|
1260
|
+
if (packageJson.exports && packageJson.exports[contractExportKey]) {
|
|
1261
|
+
const exportPath = packageJson.exports[contractExportKey];
|
|
1262
|
+
contractPath = path.join(npmPluginPath, exportPath);
|
|
1263
|
+
} else {
|
|
1264
|
+
const possiblePaths = [
|
|
1265
|
+
path.join(npmPluginPath, "dist", contractSpec),
|
|
1266
|
+
path.join(npmPluginPath, "lib", contractSpec),
|
|
1267
|
+
path.join(npmPluginPath, contractSpec)
|
|
1268
|
+
];
|
|
1269
|
+
contractPath = possiblePaths.find((p) => fs.existsSync(p)) || possiblePaths[0];
|
|
1270
|
+
}
|
|
1271
|
+
} catch {
|
|
1272
|
+
contractPath = path.join(npmPluginPath, "dist", contract.contract);
|
|
1273
|
+
}
|
|
1202
1274
|
} else {
|
|
1203
|
-
|
|
1204
|
-
path.join(npmPluginPath, "dist", contractSpec),
|
|
1205
|
-
path.join(npmPluginPath, "lib", contractSpec),
|
|
1206
|
-
path.join(npmPluginPath, contractSpec)
|
|
1207
|
-
];
|
|
1208
|
-
contractPath = possiblePaths.find((p) => fs.existsSync(p)) || possiblePaths[0];
|
|
1275
|
+
contractPath = path.join(npmPluginPath, "dist", contract.contract);
|
|
1209
1276
|
}
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1277
|
+
return new WithValidations(
|
|
1278
|
+
{
|
|
1279
|
+
contractPath,
|
|
1280
|
+
componentPath,
|
|
1281
|
+
componentName: contract.component,
|
|
1282
|
+
isNpmPackage: true,
|
|
1283
|
+
packageName: pluginName
|
|
1284
|
+
},
|
|
1285
|
+
[]
|
|
1286
|
+
);
|
|
1213
1287
|
}
|
|
1214
|
-
} else {
|
|
1215
|
-
componentPath = path.join(npmPluginPath, "dist/index.js");
|
|
1216
|
-
contractPath = path.join(npmPluginPath, "dist", contract.contract);
|
|
1217
1288
|
}
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1289
|
+
const dynamicConfig = findDynamicContract(manifest, contractName);
|
|
1290
|
+
if (dynamicConfig) {
|
|
1291
|
+
const componentPath = getComponentPath();
|
|
1292
|
+
return new WithValidations(
|
|
1293
|
+
{
|
|
1294
|
+
contractPath: "",
|
|
1295
|
+
// Dynamic contracts don't have a static path
|
|
1296
|
+
componentPath,
|
|
1297
|
+
componentName: dynamicConfig.component,
|
|
1298
|
+
isNpmPackage: true,
|
|
1299
|
+
packageName: pluginName
|
|
1300
|
+
},
|
|
1301
|
+
[]
|
|
1302
|
+
);
|
|
1303
|
+
}
|
|
1304
|
+
if (!manifest.contracts && !manifest.dynamic_contracts) {
|
|
1305
|
+
return new WithValidations(null, [
|
|
1306
|
+
`NPM package "${pluginName}" has no contracts or dynamic_contracts defined in plugin.yaml`
|
|
1307
|
+
]);
|
|
1308
|
+
}
|
|
1309
|
+
const availableContracts = manifest.contracts?.map((c2) => c2.name) || [];
|
|
1310
|
+
const dynamicPrefixes = manifest.dynamic_contracts ? (Array.isArray(manifest.dynamic_contracts) ? manifest.dynamic_contracts : [manifest.dynamic_contracts]).map((c2) => `${c2.prefix}/*`) : [];
|
|
1311
|
+
const allAvailable = [...availableContracts, ...dynamicPrefixes].join(", ");
|
|
1312
|
+
return new WithValidations(null, [
|
|
1313
|
+
`Contract "${contractName}" not found in NPM package "${pluginName}". Available: ${allAvailable}`
|
|
1314
|
+
]);
|
|
1229
1315
|
}
|
|
1230
1316
|
function resolvePluginComponent(projectRoot, pluginName, contractName) {
|
|
1231
1317
|
const localResult = resolveLocalPlugin(projectRoot, pluginName, contractName);
|
|
@@ -1272,6 +1358,7 @@ export {
|
|
|
1272
1358
|
JAY_QUERY_WORKER_TRUSTED_TS,
|
|
1273
1359
|
JAY_RUNTIME,
|
|
1274
1360
|
JAY_SECURE,
|
|
1361
|
+
JAY_STACK_CLIENT_RUNTIME,
|
|
1275
1362
|
JAY_TS_EXTENSION,
|
|
1276
1363
|
JayArrayType,
|
|
1277
1364
|
JayAtomicType,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/compiler-shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"author": "",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@jay-framework/component": "^0.
|
|
29
|
-
"@jay-framework/runtime": "^0.
|
|
30
|
-
"@jay-framework/secure": "^0.
|
|
31
|
-
"@jay-framework/typescript-bridge": "^0.
|
|
28
|
+
"@jay-framework/component": "^0.12.0",
|
|
29
|
+
"@jay-framework/runtime": "^0.12.0",
|
|
30
|
+
"@jay-framework/secure": "^0.12.0",
|
|
31
|
+
"@jay-framework/typescript-bridge": "^0.7.0",
|
|
32
32
|
"@types/js-yaml": "^4.0.9",
|
|
33
33
|
"change-case": "^4.1.2",
|
|
34
34
|
"js-beautify": "^1.14.11",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@caiogondim/strip-margin": "^1.0.0",
|
|
44
|
-
"@jay-framework/dev-environment": "^0.
|
|
44
|
+
"@jay-framework/dev-environment": "^0.12.0",
|
|
45
45
|
"@testing-library/jest-dom": "^6.2.0",
|
|
46
46
|
"@types/js-beautify": "^1",
|
|
47
47
|
"@types/node": "^20.11.5",
|