@memberjunction/react-runtime 2.70.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.
Files changed (58) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/CHANGELOG.md +3 -0
  3. package/README.md +224 -0
  4. package/dist/compiler/babel-config.d.ts +40 -0
  5. package/dist/compiler/babel-config.d.ts.map +1 -0
  6. package/dist/compiler/babel-config.js +52 -0
  7. package/dist/compiler/component-compiler.d.ts +22 -0
  8. package/dist/compiler/component-compiler.d.ts.map +1 -0
  9. package/dist/compiler/component-compiler.js +188 -0
  10. package/dist/compiler/index.d.ts +3 -0
  11. package/dist/compiler/index.d.ts.map +1 -0
  12. package/dist/compiler/index.js +13 -0
  13. package/dist/index.d.ts +41 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +95 -0
  16. package/dist/registry/component-registry.d.ts +32 -0
  17. package/dist/registry/component-registry.d.ts.map +1 -0
  18. package/dist/registry/component-registry.js +197 -0
  19. package/dist/registry/component-resolver.d.ts +29 -0
  20. package/dist/registry/component-resolver.d.ts.map +1 -0
  21. package/dist/registry/component-resolver.js +112 -0
  22. package/dist/registry/index.d.ts +3 -0
  23. package/dist/registry/index.d.ts.map +1 -0
  24. package/dist/registry/index.js +7 -0
  25. package/dist/runtime/component-hierarchy.d.ts +44 -0
  26. package/dist/runtime/component-hierarchy.d.ts.map +1 -0
  27. package/dist/runtime/component-hierarchy.js +162 -0
  28. package/dist/runtime/component-wrapper.d.ts +18 -0
  29. package/dist/runtime/component-wrapper.d.ts.map +1 -0
  30. package/dist/runtime/component-wrapper.js +108 -0
  31. package/dist/runtime/error-boundary.d.ts +6 -0
  32. package/dist/runtime/error-boundary.d.ts.map +1 -0
  33. package/dist/runtime/error-boundary.js +139 -0
  34. package/dist/runtime/index.d.ts +5 -0
  35. package/dist/runtime/index.d.ts.map +1 -0
  36. package/dist/runtime/index.js +31 -0
  37. package/dist/runtime/prop-builder.d.ts +16 -0
  38. package/dist/runtime/prop-builder.d.ts.map +1 -0
  39. package/dist/runtime/prop-builder.js +161 -0
  40. package/dist/types/index.d.ts +98 -0
  41. package/dist/types/index.d.ts.map +1 -0
  42. package/dist/types/index.js +2 -0
  43. package/package.json +36 -0
  44. package/src/compiler/babel-config.ts +97 -0
  45. package/src/compiler/component-compiler.ts +366 -0
  46. package/src/compiler/index.ts +15 -0
  47. package/src/index.ts +125 -0
  48. package/src/registry/component-registry.ts +379 -0
  49. package/src/registry/component-resolver.ts +275 -0
  50. package/src/registry/index.ts +7 -0
  51. package/src/runtime/component-hierarchy.ts +346 -0
  52. package/src/runtime/component-wrapper.ts +249 -0
  53. package/src/runtime/error-boundary.ts +242 -0
  54. package/src/runtime/index.ts +45 -0
  55. package/src/runtime/prop-builder.ts +290 -0
  56. package/src/types/index.ts +226 -0
  57. package/tsconfig.json +37 -0
  58. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.buildComponentProps = void 0;
4
+ function buildComponentProps(data = {}, userState = {}, utilities = {}, callbacks = {}, components = {}, styles, options = {}) {
5
+ const { validate = true, transformData, transformState } = options;
6
+ const transformedData = transformData ? transformData(data) : data;
7
+ const transformedState = transformState ? transformState(userState) : userState;
8
+ const props = {
9
+ data: transformedData,
10
+ userState: transformedState,
11
+ utilities,
12
+ callbacks: normalizeCallbacks(callbacks),
13
+ components,
14
+ styles: normalizeStyles(styles)
15
+ };
16
+ if (validate) {
17
+ validateComponentProps(props);
18
+ }
19
+ return props;
20
+ }
21
+ exports.buildComponentProps = buildComponentProps;
22
+ function normalizeCallbacks(callbacks) {
23
+ const normalized = {};
24
+ if (callbacks.RefreshData && typeof callbacks.RefreshData === 'function') {
25
+ normalized.RefreshData = callbacks.RefreshData;
26
+ }
27
+ if (callbacks.OpenEntityRecord && typeof callbacks.OpenEntityRecord === 'function') {
28
+ normalized.OpenEntityRecord = callbacks.OpenEntityRecord;
29
+ }
30
+ if (callbacks.UpdateUserState && typeof callbacks.UpdateUserState === 'function') {
31
+ normalized.UpdateUserState = callbacks.UpdateUserState;
32
+ }
33
+ if (callbacks.NotifyEvent && typeof callbacks.NotifyEvent === 'function') {
34
+ normalized.NotifyEvent = callbacks.NotifyEvent;
35
+ }
36
+ return normalized;
37
+ }
38
+ exports.normalizeCallbacks = normalizeCallbacks;
39
+ function normalizeStyles(styles) {
40
+ return styles;
41
+ }
42
+ exports.normalizeStyles = normalizeStyles;
43
+ function validateComponentProps(props) {
44
+ if (props.data === null || props.data === undefined) {
45
+ throw new Error('Component props.data cannot be null or undefined');
46
+ }
47
+ if (props.userState === null) {
48
+ throw new Error('Component props.userState cannot be null');
49
+ }
50
+ if (props.utilities === null) {
51
+ throw new Error('Component props.utilities cannot be null');
52
+ }
53
+ if (!props.callbacks || typeof props.callbacks !== 'object') {
54
+ throw new Error('Component props.callbacks must be an object');
55
+ }
56
+ for (const [key, value] of Object.entries(props.callbacks)) {
57
+ if (value !== undefined && typeof value !== 'function') {
58
+ throw new Error(`Component callback "${key}" must be a function`);
59
+ }
60
+ }
61
+ }
62
+ exports.validateComponentProps = validateComponentProps;
63
+ function mergeProps(...propsList) {
64
+ const merged = {
65
+ data: {},
66
+ userState: {},
67
+ utilities: {},
68
+ callbacks: {},
69
+ components: {},
70
+ styles: {}
71
+ };
72
+ for (const props of propsList) {
73
+ if (props.data) {
74
+ merged.data = { ...merged.data, ...props.data };
75
+ }
76
+ if (props.userState) {
77
+ merged.userState = { ...merged.userState, ...props.userState };
78
+ }
79
+ if (props.utilities) {
80
+ merged.utilities = { ...merged.utilities, ...props.utilities };
81
+ }
82
+ if (props.callbacks) {
83
+ merged.callbacks = { ...merged.callbacks, ...props.callbacks };
84
+ }
85
+ if (props.components) {
86
+ merged.components = { ...merged.components, ...props.components };
87
+ }
88
+ if (props.styles) {
89
+ merged.styles = { ...merged.styles, ...props.styles };
90
+ }
91
+ }
92
+ return merged;
93
+ }
94
+ exports.mergeProps = mergeProps;
95
+ function createPropsTransformer(transformations) {
96
+ return (props) => {
97
+ const transformed = { ...props };
98
+ for (const [path, transformer] of Object.entries(transformations)) {
99
+ const pathParts = path.split('.');
100
+ let current = transformed;
101
+ for (let i = 0; i < pathParts.length - 1; i++) {
102
+ if (!current[pathParts[i]]) {
103
+ current[pathParts[i]] = {};
104
+ }
105
+ current = current[pathParts[i]];
106
+ }
107
+ const lastPart = pathParts[pathParts.length - 1];
108
+ if (current[lastPart] !== undefined) {
109
+ current[lastPart] = transformer(current[lastPart]);
110
+ }
111
+ }
112
+ return transformed;
113
+ };
114
+ }
115
+ exports.createPropsTransformer = createPropsTransformer;
116
+ function wrapCallbacksWithLogging(callbacks, componentName) {
117
+ const wrapped = {};
118
+ if (callbacks.RefreshData) {
119
+ wrapped.RefreshData = () => {
120
+ console.log(`[${componentName}] RefreshData called`);
121
+ callbacks.RefreshData();
122
+ };
123
+ }
124
+ if (callbacks.OpenEntityRecord) {
125
+ wrapped.OpenEntityRecord = (entityName, key) => {
126
+ console.log(`[${componentName}] OpenEntityRecord called:`, { entityName, key });
127
+ callbacks.OpenEntityRecord(entityName, key);
128
+ };
129
+ }
130
+ if (callbacks.UpdateUserState) {
131
+ wrapped.UpdateUserState = (state) => {
132
+ console.log(`[${componentName}] UpdateUserState called:`, state);
133
+ callbacks.UpdateUserState(state);
134
+ };
135
+ }
136
+ if (callbacks.NotifyEvent) {
137
+ wrapped.NotifyEvent = (event, data) => {
138
+ console.log(`[${componentName}] NotifyEvent called:`, { event, data });
139
+ callbacks.NotifyEvent(event, data);
140
+ };
141
+ }
142
+ return wrapped;
143
+ }
144
+ exports.wrapCallbacksWithLogging = wrapCallbacksWithLogging;
145
+ function extractPropPaths(componentCode) {
146
+ const paths = [];
147
+ const patterns = [
148
+ /props\.data\.(\w+)/g,
149
+ /props\.userState\.(\w+)/g,
150
+ /props\.utilities\.(\w+)/g,
151
+ /props\.callbacks\.(\w+)/g
152
+ ];
153
+ for (const pattern of patterns) {
154
+ let match;
155
+ while ((match = pattern.exec(componentCode)) !== null) {
156
+ paths.push(match[0]);
157
+ }
158
+ }
159
+ return [...new Set(paths)];
160
+ }
161
+ exports.extractPropPaths = extractPropPaths;
@@ -0,0 +1,98 @@
1
+ export interface CompiledComponent {
2
+ component: any;
3
+ id: string;
4
+ name: string;
5
+ compiledAt: Date;
6
+ warnings?: string[];
7
+ }
8
+ export interface CompileOptions {
9
+ componentName: string;
10
+ componentCode: string;
11
+ styles?: ComponentStyles;
12
+ production?: boolean;
13
+ babelPlugins?: string[];
14
+ babelPresets?: string[];
15
+ }
16
+ export interface ComponentStyles {
17
+ className?: string;
18
+ style?: Record<string, any>;
19
+ globalCss?: string;
20
+ }
21
+ export interface RegistryEntry {
22
+ component: any;
23
+ metadata: ComponentMetadata;
24
+ lastAccessed: Date;
25
+ refCount: number;
26
+ }
27
+ export interface ComponentMetadata {
28
+ id: string;
29
+ name: string;
30
+ version: string;
31
+ namespace: string;
32
+ registeredAt: Date;
33
+ tags?: string[];
34
+ }
35
+ export interface ComponentError {
36
+ message: string;
37
+ stack?: string;
38
+ componentName: string;
39
+ phase: 'compilation' | 'registration' | 'render' | 'runtime';
40
+ details?: any;
41
+ }
42
+ export interface ComponentProps {
43
+ data: any;
44
+ userState: any;
45
+ utilities: any;
46
+ callbacks: ComponentCallbacks;
47
+ components?: Record<string, any>;
48
+ styles?: ComponentStyles;
49
+ }
50
+ export interface ComponentCallbacks {
51
+ RefreshData?: () => void;
52
+ OpenEntityRecord?: (entityName: string, key: any) => void;
53
+ UpdateUserState?: (state: any) => void;
54
+ NotifyEvent?: (event: string, data: any) => void;
55
+ }
56
+ export interface CompilerConfig {
57
+ babel: {
58
+ presets: string[];
59
+ plugins: string[];
60
+ };
61
+ minify: boolean;
62
+ sourceMaps: boolean;
63
+ cache: boolean;
64
+ maxCacheSize: number;
65
+ }
66
+ export interface RegistryConfig {
67
+ maxComponents: number;
68
+ cleanupInterval: number;
69
+ useLRU: boolean;
70
+ enableNamespaces: boolean;
71
+ }
72
+ export interface CompilationResult {
73
+ success: boolean;
74
+ component?: CompiledComponent;
75
+ error?: ComponentError;
76
+ duration: number;
77
+ size?: number;
78
+ }
79
+ export interface RuntimeContext {
80
+ React: any;
81
+ ReactDOM?: any;
82
+ libraries?: Record<string, any>;
83
+ utilities?: Record<string, any>;
84
+ }
85
+ export interface ComponentLifecycle {
86
+ beforeMount?: () => void;
87
+ afterMount?: () => void;
88
+ beforeUpdate?: (prevProps: any, nextProps: any) => void;
89
+ afterUpdate?: (prevProps: any, currentProps: any) => void;
90
+ beforeUnmount?: () => void;
91
+ }
92
+ export interface ErrorBoundaryOptions {
93
+ onError?: (error: Error, errorInfo: any) => void;
94
+ fallback?: any;
95
+ logErrors?: boolean;
96
+ recovery?: 'retry' | 'reset' | 'none';
97
+ }
98
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,iBAAiB;IAEhC,SAAS,EAAE,GAAG,CAAC;IAEf,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;CACzB;AAKD,MAAM,WAAW,eAAe;IAE9B,SAAS,CAAC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GAAG,KAAK,IAAI,CAAC;IAE1D,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAKD,MAAM,WAAW,oBAAoB;IAEnC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC;IAEjD,QAAQ,CAAC,EAAE,GAAG,CAAC;IAEf,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;CACvC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@memberjunction/react-runtime",
3
+ "version": "2.70.0",
4
+ "description": "Platform-agnostic React component runtime for MemberJunction. Provides core compilation, registry, and execution capabilities for React components in any JavaScript environment.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "build:clean": "rimraf ./dist && npm run build",
10
+ "watch": "tsc -w",
11
+ "patchVersion": "npm version patch",
12
+ "test": "jest"
13
+ },
14
+ "keywords": [
15
+ "memberjunction",
16
+ "react",
17
+ "runtime",
18
+ "component",
19
+ "compiler"
20
+ ],
21
+ "author": "",
22
+ "license": "ISC",
23
+ "bugs": {
24
+ "url": "https://github.com/MemberJunction/MJ/issues"
25
+ },
26
+ "homepage": "https://github.com/MemberJunction/MJ#readme",
27
+ "dependencies": {
28
+ "@babel/standalone": "^7.23.5"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "20.10.0",
32
+ "jest": "^27.5.1",
33
+ "rimraf": "^3.0.2",
34
+ "typescript": "~5.3.3"
35
+ }
36
+ }
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @fileoverview Babel configuration for React component compilation.
3
+ * Provides default presets and plugins for transforming JSX and modern JavaScript.
4
+ * @module @memberjunction/react-runtime/compiler
5
+ */
6
+
7
+ /**
8
+ * Default Babel presets for React compilation
9
+ */
10
+ export const DEFAULT_PRESETS = [
11
+ 'react', // Transforms JSX
12
+ ];
13
+
14
+ /**
15
+ * Default Babel plugins for enhanced functionality
16
+ */
17
+ export const DEFAULT_PLUGINS: string[] = [
18
+ // Add plugins as needed for specific transformations
19
+ // e.g., 'transform-class-properties', 'transform-optional-chaining'
20
+ ];
21
+
22
+ /**
23
+ * Production-specific Babel configuration
24
+ */
25
+ export const PRODUCTION_CONFIG = {
26
+ presets: DEFAULT_PRESETS,
27
+ plugins: [
28
+ ...DEFAULT_PLUGINS,
29
+ // Production optimizations could go here
30
+ ],
31
+ minified: true,
32
+ comments: false
33
+ };
34
+
35
+ /**
36
+ * Development-specific Babel configuration
37
+ */
38
+ export const DEVELOPMENT_CONFIG = {
39
+ presets: DEFAULT_PRESETS,
40
+ plugins: [
41
+ ...DEFAULT_PLUGINS,
42
+ // Development helpers could go here
43
+ ],
44
+ sourceMaps: 'inline',
45
+ minified: false,
46
+ comments: true
47
+ };
48
+
49
+ /**
50
+ * Get Babel configuration based on environment
51
+ * @param production - Whether to use production configuration
52
+ * @returns Babel configuration object
53
+ */
54
+ export function getBabelConfig(production: boolean = false) {
55
+ return production ? PRODUCTION_CONFIG : DEVELOPMENT_CONFIG;
56
+ }
57
+
58
+ /**
59
+ * Validates that required Babel presets are available
60
+ * @param babel - Babel instance to check
61
+ * @returns true if all required presets are available
62
+ */
63
+ export function validateBabelPresets(babel: any): boolean {
64
+ if (!babel || !babel.availablePresets) {
65
+ return false;
66
+ }
67
+
68
+ // Check that React preset is available
69
+ return 'react' in babel.availablePresets;
70
+ }
71
+
72
+ /**
73
+ * Common JSX pragma options for different React versions
74
+ */
75
+ export const JSX_PRAGMAS = {
76
+ classic: {
77
+ pragma: 'React.createElement',
78
+ pragmaFrag: 'React.Fragment'
79
+ },
80
+ automatic: {
81
+ runtime: 'automatic',
82
+ importSource: 'react'
83
+ }
84
+ };
85
+
86
+ /**
87
+ * Get appropriate JSX configuration based on React version
88
+ * @param reactVersion - React version (e.g., "18.2.0")
89
+ * @returns JSX configuration options
90
+ */
91
+ export function getJSXConfig(reactVersion?: string) {
92
+ // React 17+ supports the new JSX transform
93
+ if (reactVersion && parseInt(reactVersion.split('.')[0]) >= 17) {
94
+ return JSX_PRAGMAS.automatic;
95
+ }
96
+ return JSX_PRAGMAS.classic;
97
+ }