@memberjunction/react-runtime 2.112.0 → 2.113.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/.turbo/turbo-build.log +11 -10
- package/CHANGELOG.md +15 -1
- package/dist/compiler/component-compiler.d.ts.map +1 -1
- package/dist/compiler/component-compiler.js +56 -66
- package/dist/compiler/component-compiler.js.map +1 -1
- package/dist/component-manager/component-manager.d.ts.map +1 -1
- package/dist/component-manager/component-manager.js +42 -48
- package/dist/component-manager/component-manager.js.map +1 -1
- package/dist/component-manager/types.d.ts +1 -1
- package/dist/component-manager/types.d.ts.map +1 -1
- package/dist/component-manager/types.js.map +1 -1
- package/dist/registry/component-registry-service.d.ts +1 -1
- package/dist/registry/component-registry-service.d.ts.map +1 -1
- package/dist/registry/component-registry-service.js +34 -34
- package/dist/registry/component-registry-service.js.map +1 -1
- package/dist/registry/component-resolver.d.ts +1 -1
- package/dist/registry/component-resolver.d.ts.map +1 -1
- package/dist/registry/component-resolver.js +11 -10
- package/dist/registry/component-resolver.js.map +1 -1
- package/dist/runtime/component-hierarchy.d.ts +1 -1
- package/dist/runtime/component-hierarchy.d.ts.map +1 -1
- package/dist/runtime/component-hierarchy.js +43 -43
- package/dist/runtime/component-hierarchy.js.map +1 -1
- package/dist/runtime/prop-builder.d.ts.map +1 -1
- package/dist/runtime/prop-builder.js +24 -22
- package/dist/runtime/prop-builder.js.map +1 -1
- package/dist/runtime.umd.js +511 -494
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/library-registry.d.ts +1 -1
- package/dist/utilities/library-registry.d.ts.map +1 -1
- package/dist/utilities/library-registry.js +10 -10
- package/dist/utilities/library-registry.js.map +1 -1
- package/package.json +6 -5
- package/src/compiler/component-compiler.ts +164 -186
- package/src/component-manager/component-manager.ts +216 -162
- package/src/component-manager/types.ts +27 -27
- package/src/registry/component-registry-service.ts +218 -190
- package/src/registry/component-resolver.ts +98 -87
- package/src/runtime/component-hierarchy.ts +94 -57
- package/src/runtime/prop-builder.ts +33 -28
- package/src/types/index.ts +4 -3
- package/src/utilities/library-registry.ts +19 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAK3H,MAAM,WAAW,iBAAiB;IAEhC,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,eAAe,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,eAAe,CAAC;IAElH,EAAE,EAAE,MAAM,CAAC;IAEX,IAAI,EAAE,MAAM,CAAC;IAEb,UAAU,EAAE,IAAI,CAAC;IAEjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAKD,MAAM,WAAW,cAAc;IAE7B,aAAa,EAAE,MAAM,CAAC;IAEtB,aAAa,EAAE,MAAM,CAAC;IAEtB,MAAM,CAAC,EAAE,eAAe,CAAC;IAEzB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAGxB,SAAS,CAAC,EAAE,0BAA0B,EAAE,CAAC;IAGzC,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAKtD,YAAY,EAAE,sBAAsB,EAAE,CAAC;CACxC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B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"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkOA,mDAAiC;AAGjC,qDAAmC","sourcesContent":["/**\n * @fileoverview Core type definitions for the MemberJunction React Runtime.\n * These types are platform-agnostic and can be used in any JavaScript environment.\n * @module @memberjunction/react-runtime/types\n */\n\nimport { UserInfo } from '@memberjunction/core';\nimport { ComponentLibraryEntity } from '@memberjunction/core-entities';\nimport { ComponentLibraryDependency, ComponentStyles, ComponentObject } from '@memberjunction/interactive-component-types';\n\n/**\n * Represents a compiled React component with its metadata\n */\nexport interface CompiledComponent {\n /** Factory function that creates a ComponentObject when called with context */\n factory: (context: RuntimeContext, styles?: ComponentStyles, components?: Record<string, any>) => ComponentObject;\n /** Unique identifier for the component */\n id: string;\n /** Original component name */\n name: string;\n /** Compilation timestamp */\n compiledAt: Date;\n /** Any compilation warnings */\n warnings?: string[];\n}\n\n/**\n * Options for compiling a React component\n */\nexport interface CompileOptions {\n /** Component name for identification */\n componentName: string;\n /** Raw component code to compile */\n componentCode: string;\n /** Optional styles to inject */\n styles?: ComponentStyles;\n /** Whether to use production mode optimizations */\n production?: boolean;\n /** Custom Babel plugins to use */\n babelPlugins?: string[];\n /** Custom Babel presets to use */\n babelPresets?: string[];\n\n /** Library dependencies that the component requires */\n libraries?: ComponentLibraryDependency[];\n \n /** Child component dependencies that the component requires */\n dependencies?: Array<{ name: string; code?: string }>;\n\n /**\n * Required, metadata for all possible libraries allowed by the system\n */\n allLibraries: ComponentLibraryEntity[];\n}\n\n\n/**\n * Registry entry for a compiled component\n */\nexport interface RegistryEntry {\n /** The compiled component object with all methods */\n component: ComponentObject;\n /** Component metadata */\n metadata: ComponentMetadata;\n /** Last access time for LRU cache */\n lastAccessed: Date;\n /** Reference count for cleanup */\n refCount: number;\n}\n\n/**\n * Metadata about a registered component\n */\nexport interface ComponentMetadata {\n /** Unique component identifier */\n id: string;\n /** Component name */\n name: string;\n /** Component version */\n version: string;\n /** Namespace for organization */\n namespace: string;\n /** Registration timestamp */\n registeredAt: Date;\n /** Optional tags for categorization */\n tags?: string[];\n}\n\n/**\n * Error information from component execution\n */\nexport interface ComponentError {\n /** Error message */\n message: string;\n /** Error stack trace */\n stack?: string;\n /** Component name where error occurred */\n componentName: string;\n /** Error phase (compilation, render, etc.) */\n phase: 'compilation' | 'registration' | 'render' | 'runtime';\n /** Additional error details */\n details?: any;\n}\n\n/**\n * Props passed to React components\n */\nexport interface ComponentProps {\n /** Data object for the component */\n data: any;\n /** User-managed state */\n userState: any;\n /** Utility functions available to the component */\n utilities: any;\n /** Callback functions */\n callbacks: any;\n /** Child components available for use */\n components?: Record<string, any>;\n /** Component styles */\n styles?: ComponentStyles;\n /** Standard state change handler for controlled components */\n onStateChanged?: (stateUpdate: Record<string, any>) => void;\n}\n\n/**\n * Configuration for the component compiler\n */\nexport interface CompilerConfig {\n /** Babel configuration */\n babel: {\n /** Presets to use */\n presets: string[];\n /** Plugins to use */\n plugins: string[];\n };\n /** Whether to minify output */\n minify: boolean;\n /** Source map generation */\n sourceMaps: boolean;\n /** Cache compiled components */\n cache: boolean;\n /** Maximum cache size */\n maxCacheSize: number;\n /** Enable debug logging */\n debug?: boolean;\n}\n\n/**\n * Configuration for the component registry\n */\nexport interface RegistryConfig {\n /** Maximum number of components to keep in memory */\n maxComponents: number;\n /** Time in ms before removing unused components */\n cleanupInterval: number;\n /** Whether to use LRU eviction */\n useLRU: boolean;\n /** Namespace isolation */\n enableNamespaces: boolean;\n /** Enable debug logging */\n debug?: boolean;\n}\n\n/**\n * Result of a compilation operation\n */\nexport interface CompilationResult {\n /** Whether compilation succeeded */\n success: boolean;\n /** The compiled component if successful */\n component?: CompiledComponent;\n /** Error information if failed */\n error?: ComponentError;\n /** Compilation duration in ms */\n duration: number;\n /** Size of compiled code in bytes */\n size?: number;\n /** Libraries loaded during compilation */\n loadedLibraries?: Map<string, any>;\n}\n\n/**\n * Runtime context for component execution\n */\nexport interface RuntimeContext {\n /** React library reference */\n React: any;\n /** ReactDOM library reference */\n ReactDOM?: any;\n /** Additional libraries available */\n libraries?: Record<string, any>;\n /** Global utilities */\n utilities?: Record<string, any>;\n}\n\n/**\n * Component lifecycle events\n */\nexport interface ComponentLifecycle {\n /** Called before component mounts */\n beforeMount?: () => void;\n /** Called after component mounts */\n afterMount?: () => void;\n /** Called before component updates */\n beforeUpdate?: (prevProps: any, nextProps: any) => void;\n /** Called after component updates */\n afterUpdate?: (prevProps: any, currentProps: any) => void;\n /** Called before component unmounts */\n beforeUnmount?: () => void;\n}\n\n/**\n * Options for creating an error boundary\n */\nexport interface ErrorBoundaryOptions {\n /** Custom error handler */\n onError?: (error: Error, errorInfo: any) => void;\n /** Fallback UI to render on error */\n fallback?: any;\n /** Whether to log errors */\n logErrors?: boolean;\n /** Error recovery strategy */\n recovery?: 'retry' | 'reset' | 'none';\n}\n\n// Export library configuration types\nexport * from './library-config';\n\n// Export dependency types\nexport * from './dependency-types';\n\n// Re-export ComponentObject for convenience\nexport { ComponentObject } from '@memberjunction/interactive-component-types';"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library-registry.d.ts","sourceRoot":"","sources":["../../src/utilities/library-registry.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,sBAAsB,EAA2B,MAAM,+BAA+B,CAAC;AAKhG,MAAM,WAAW,iBAAiB;IAEhC,IAAI,EAAE,MAAM,CAAC;IAEb,cAAc,EAAE,MAAM,CAAC;IAEvB,QAAQ,EAAE,MAAM,CAAC;IAEjB,QAAQ,EAAE;QACR,CAAC,OAAO,EAAE,MAAM,GAAG;YACjB,MAAM,EAAE,MAAM,CAAC;YAEf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;SACpB,CAAC;KACH,CAAC;IAEF,cAAc,EAAE,MAAM,CAAC;CACxB;AAMD,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,SAAS,CAA6C;IACrE,OAAO,CAAC,MAAM,CAAC,WAAW,C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
|
|
14
14
|
for (const [name, versions] of libraryGroups) {
|
|
15
15
|
const libDef = {
|
|
16
16
|
name,
|
|
17
|
-
globalVariable: versions[0].GlobalVariable ||
|
|
18
|
-
category: versions[0].Category ||
|
|
17
|
+
globalVariable: versions[0].GlobalVariable || "",
|
|
18
|
+
category: versions[0].Category || "",
|
|
19
19
|
versions: {},
|
|
20
|
-
defaultVersion: versions[0].Version ||
|
|
20
|
+
defaultVersion: versions[0].Version || ""
|
|
21
21
|
};
|
|
22
22
|
for (const version of versions) {
|
|
23
23
|
libDef.versions[version.Version] = {
|
|
24
|
-
cdnUrl: version.CDNUrl ||
|
|
25
|
-
cssUrls: version.CDNCssUrl?.split(
|
|
24
|
+
cdnUrl: version.CDNUrl || "",
|
|
25
|
+
cssUrls: version.CDNCssUrl?.split(",") || []
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
this.libraries.set(name, libDef);
|
|
@@ -32,12 +32,12 @@ class LibraryRegistry {
|
|
|
32
32
|
}
|
|
33
33
|
static getLibrary(name) {
|
|
34
34
|
if (!this._configured)
|
|
35
|
-
throw new Error(
|
|
35
|
+
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
36
36
|
return this.libraries.get(name?.trim().toLowerCase());
|
|
37
37
|
}
|
|
38
38
|
static getCdnUrl(name, version) {
|
|
39
39
|
if (!this._configured)
|
|
40
|
-
throw new Error(
|
|
40
|
+
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
41
41
|
const library = this.libraries.get(name?.trim().toLowerCase());
|
|
42
42
|
if (!library)
|
|
43
43
|
return undefined;
|
|
@@ -46,12 +46,12 @@ class LibraryRegistry {
|
|
|
46
46
|
}
|
|
47
47
|
static isApproved(name) {
|
|
48
48
|
if (!this._configured)
|
|
49
|
-
throw new Error(
|
|
49
|
+
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
50
50
|
return this.libraries.has(name?.trim().toLowerCase());
|
|
51
51
|
}
|
|
52
52
|
static resolveVersion(name, versionPattern) {
|
|
53
53
|
if (!this._configured)
|
|
54
|
-
throw new Error(
|
|
54
|
+
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
55
55
|
const library = this.libraries.get(name?.trim().toLowerCase());
|
|
56
56
|
if (!library)
|
|
57
57
|
return undefined;
|
|
@@ -64,7 +64,7 @@ class LibraryRegistry {
|
|
|
64
64
|
}
|
|
65
65
|
static registerLibrary(definition) {
|
|
66
66
|
if (!this._configured)
|
|
67
|
-
throw new Error(
|
|
67
|
+
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
68
68
|
this.libraries.set(definition.name?.trim().toLowerCase(), definition);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library-registry.js","sourceRoot":"","sources":["../../src/utilities/library-registry.ts"],"names":[],"mappings":";;;AAmCA,MAAa,eAAe;IAGnB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,eAAwB,KAAK,EAAE,kBAA4C;QACpG,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,YAAY,EAAE,CAAC;YAKtC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAoC,CAAC;YAClE,KAAK,MAAM,GAAG,IAAI,kBAAkB,EAAE,CAAC;gBACrC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;oBAC/C,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;gBAChD,CAAC;gBACD,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACvD,CAAC;YAID,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC;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;QAClD,IAAI,CAAC,IAAI,CAAC,WAAW;YACnB,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAC;QAEpG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CAAC;IACxE,CAAC;;AAhHH,0CAiHC;AAhHgB,yBAAS,GAAmC,IAAI,GAAG,EAAE,CAAC;AACtD,2BAAW,GAAY,KAAK,CAAC","sourcesContent":["/**\n * @fileoverview Library registry for approved third-party libraries\n * Maintains a secure registry of libraries that components can use\n * @module @memberjunction/react-runtime/utilities\n */\n\nimport { UserInfo } from \"@memberjunction/core\";\nimport { ComponentLibraryEntity, ComponentMetadataEngine } from \"@memberjunction/core-entities\";\n\n/**\n * Library definition in the registry\n */\nexport interface LibraryDefinition {\n /** Library name (e.g., \"Chart.js\", \"lodash\") */\n name: string;\n /** Global variable name when loaded (e.g., \"Chart\", \"_\") */\n globalVariable: string;\n /** Category path for organization (e.g., \"charting/advanced\", \"utility/date\") */\n category: string;\n /** Available versions with their CDN URLs */\n versions: {\n [version: string]: {\n cdnUrl: string;\n /** Optional CSS URLs for UI libraries */\n cssUrls?: string[];\n };\n };\n /** Default version to use if not specified */\n defaultVersion: string;\n}\n\n/**\n * Registry of approved libraries that components can use\n * This is the security boundary - only libraries defined here can be loaded\n */\nexport class LibraryRegistry {\n private static libraries: Map<string, LibraryDefinition> = new Map();\n private static _configured: boolean = false;\n public static async Config(forceRefresh: boolean = false, componentLibraries: ComponentLibraryEntity[]) {\n if (!this._configured || forceRefresh) {\n // next up, we need to map the component metadata to the library definitions \n // with two steps - first step is that we need to group the libraries in the engine\n // by name and then we'll have all the versions for that particular library we can break\n // into versions in our structure\n const libraryGroups = new Map<string, ComponentLibraryEntity[]>();\n for (const lib of componentLibraries) {\n if (!libraryGroups.has(lib.Name.toLowerCase())) {\n libraryGroups.set(lib.Name.toLowerCase(), []);\n }\n libraryGroups.get(lib.Name.toLowerCase())!.push(lib);\n }\n\n // now we have grouped libraries using the ComponentLibraryEntity type, and next up\n // we can map this to our internal structure of LibraryDefinition\n for (const [name, versions] of libraryGroups) {\n const libDef: LibraryDefinition = {\n name,\n globalVariable: versions[0].GlobalVariable || \"\",\n category: versions[0].Category || \"\",\n versions: {},\n defaultVersion: versions[0].Version || \"\"\n };\n for (const version of versions) {\n libDef.versions[version.Version!] = {\n cdnUrl: version.CDNUrl || \"\",\n cssUrls: version.CDNCssUrl?.split(\",\") || []\n };\n }\n this.libraries.set(name, libDef);\n }\n\n // at this point, our library registry is fully populated\n this._configured = true;\n }\n }\n\n /**\n * Get library definition by name\n */\n static getLibrary(name: string): LibraryDefinition | undefined {\n if (!this._configured)\n throw new Error(\"LibraryRegistry is not configured, call LibraryRegistry.Config() before using!\");\n\n return this.libraries.get(name?.trim().toLowerCase());\n }\n\n /**\n * Get CDN URL for a library\n * @param name Library name\n * @param version Optional version (uses default if not specified)\n * @returns CDN URL or undefined if library/version not found\n */\n static getCdnUrl(name: string, version?: string): string | undefined {\n if (!this._configured)\n throw new Error(\"LibraryRegistry is not configured, call LibraryRegistry.Config() before using!\");\n\n const library = this.libraries.get(name?.trim().toLowerCase());\n if (!library) return undefined;\n\n const targetVersion = version || library.defaultVersion;\n return library.versions[targetVersion]?.cdnUrl;\n }\n\n /**\n * Check if a library is approved\n */\n static isApproved(name: string): boolean {\n if (!this._configured)\n throw new Error(\"LibraryRegistry is not configured, call LibraryRegistry.Config() before using!\");\n\n return this.libraries.has(name?.trim().toLowerCase());\n }\n\n /**\n * Resolve library version based on semver-like pattern\n * For now, just returns exact match or default\n * TODO: Implement proper semver resolution\n */\n static resolveVersion(name: string, versionPattern?: string): string | undefined {\n if (!this._configured)\n throw new Error(\"LibraryRegistry is not configured, call LibraryRegistry.Config() before using!\");\n\n const library = this.libraries.get(name?.trim().toLowerCase());\n if (!library) return undefined;\n\n if (!versionPattern) return library.defaultVersion;\n\n // For now, just check exact match\n // TODO: Implement proper semver resolution for patterns like \"^4.0.0\"\n if (library.versions[versionPattern]) {\n return versionPattern;\n }\n\n // If no exact match, return default\n return library.defaultVersion;\n }\n\n /**\n * Add a library to the registry (for future extensibility)\n * This would typically be called during app initialization\n * with libraries loaded from a database\n */\n static registerLibrary(definition: LibraryDefinition): void {\n if (!this._configured)\n throw new Error(\"LibraryRegistry is not configured, call LibraryRegistry.Config() before using!\");\n\n this.libraries.set(definition.name?.trim().toLowerCase(), definition);\n }\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/react-runtime",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.113.0",
|
|
4
4
|
"description": "Platform-agnostic React component runtime for MemberJunction. Provides core compilation, registry, and execution capabilities for React components in any JavaScript environment.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,10 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/MemberJunction/MJ#readme",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@memberjunction/
|
|
31
|
-
"@memberjunction/
|
|
32
|
-
"@memberjunction/
|
|
33
|
-
"@memberjunction/
|
|
30
|
+
"@memberjunction/core": "2.113.0",
|
|
31
|
+
"@memberjunction/global": "2.113.0",
|
|
32
|
+
"@memberjunction/interactive-component-types": "2.113.0",
|
|
33
|
+
"@memberjunction/core-entities": "2.113.0",
|
|
34
|
+
"@memberjunction/graphql-dataprovider": "2.113.0",
|
|
34
35
|
"@babel/standalone": "^7.23.5",
|
|
35
36
|
"rxjs": "^7.8.1"
|
|
36
37
|
},
|