@steambrew/ttc 2.8.5 → 2.8.7

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 CHANGED
@@ -622,7 +622,12 @@ var ComponentType;
622
622
  ComponentType[ComponentType["Webkit"] = 1] = "Webkit";
623
623
  })(ComponentType || (ComponentType = {}));
624
624
  const WrappedCallServerMethod = 'const __call_server_method__ = (methodName, kwargs) => Millennium.callServerMethod(pluginName, methodName, kwargs)';
625
- const WrappedCallable = 'const __wrapped_callable__ = (route) => MILLENNIUM_API.callable(__call_server_method__, route)';
625
+ function __wrapped_callable__(route) {
626
+ if (route.startsWith('webkit:')) {
627
+ return MILLENNIUM_API.callable((methodName, kwargs) => MILLENNIUM_API.__INTERNAL_CALL_WEBKIT_METHOD__(pluginName, methodName, kwargs), route.replace(/^webkit:/, ''));
628
+ }
629
+ return MILLENNIUM_API.callable(__call_server_method__, route);
630
+ }
626
631
  const ConstructFunctions = (parts) => {
627
632
  return parts.join('\n');
628
633
  };
@@ -643,7 +648,7 @@ function InsertMillennium(type, props) {
643
648
  InitializePlugins.toString(),
644
649
  InitializePlugins.name + '()',
645
650
  WrappedCallServerMethod,
646
- WrappedCallable,
651
+ __wrapped_callable__.toString(),
647
652
  generate(bundle[fileName].code),
648
653
  ExecutePluginModule.toString(),
649
654
  ExecutePluginModule.name + '()',
@@ -752,6 +757,7 @@ async function GetWebkitPluginComponents(props) {
752
757
  preventAssignment: true,
753
758
  'Millennium.callServerMethod': `__call_server_method__`,
754
759
  'webkit.callable': `__wrapped_callable__`,
760
+ 'webkit.Millennium.exposeObj(': 'webkit.Millennium.exposeObj(exports, ',
755
761
  'client.BindPluginSettings()': 'client.BindPluginSettings(pluginName)',
756
762
  }),
757
763
  babel({
@@ -796,7 +802,7 @@ const TranspilerPluginComponent = async (bIsMillennium, pluginJson, props) => {
796
802
  Logger.Error('The @steambrew/webkit module should not be included in the frontend module, use @steambrew/client instead. Please remove it from the frontend module and try again.');
797
803
  process.exit(1);
798
804
  }
799
- return id === '@steambrew/client' || id === 'react' || id === 'react-dom' || id === 'react-dom/client';
805
+ return id === '@steambrew/client' || id === 'react' || id === 'react-dom' || id === 'react-dom/client' || id === 'react/jsx-runtime';
800
806
  },
801
807
  output: {
802
808
  name: 'millennium_main',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steambrew/ttc",
3
- "version": "2.8.5",
3
+ "version": "2.8.7",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/transpiler.ts CHANGED
@@ -52,8 +52,24 @@ export interface TranspilerProps {
52
52
  strPluginInternalName: string;
53
53
  }
54
54
 
55
+ declare const MILLENNIUM_API: {
56
+ callable: (fn: Function, route: string) => any;
57
+ __INTERNAL_CALL_WEBKIT_METHOD__: (pluginName: string, methodName: string, kwargs: any) => any;
58
+ };
59
+
60
+ declare const __call_server_method__: (methodName: string, kwargs: any) => any;
55
61
  const WrappedCallServerMethod = 'const __call_server_method__ = (methodName, kwargs) => Millennium.callServerMethod(pluginName, methodName, kwargs)';
56
- const WrappedCallable = 'const __wrapped_callable__ = (route) => MILLENNIUM_API.callable(__call_server_method__, route)';
62
+
63
+ function __wrapped_callable__(route: string) {
64
+ if (route.startsWith('webkit:')) {
65
+ return MILLENNIUM_API.callable(
66
+ (methodName: string, kwargs: any) => MILLENNIUM_API.__INTERNAL_CALL_WEBKIT_METHOD__(pluginName, methodName, kwargs),
67
+ route.replace(/^webkit:/, ''),
68
+ );
69
+ }
70
+
71
+ return MILLENNIUM_API.callable(__call_server_method__, route);
72
+ }
57
73
 
58
74
  const ConstructFunctions = (parts: string[]): string => {
59
75
  return parts.join('\n');
@@ -79,7 +95,7 @@ function InsertMillennium(type: ComponentType, props: TranspilerProps): InputPlu
79
95
  InitializePlugins.toString(),
80
96
  InitializePlugins.name + '()',
81
97
  WrappedCallServerMethod,
82
- WrappedCallable,
98
+ __wrapped_callable__.toString(),
83
99
  generate(bundle[fileName].code),
84
100
  ExecutePluginModule.toString(),
85
101
  ExecutePluginModule.name + '()',
@@ -206,6 +222,7 @@ async function GetWebkitPluginComponents(props: TranspilerProps) {
206
222
  preventAssignment: true,
207
223
  'Millennium.callServerMethod': `__call_server_method__`,
208
224
  'webkit.callable': `__wrapped_callable__`,
225
+ 'webkit.Millennium.exposeObj(': 'webkit.Millennium.exposeObj(exports, ',
209
226
  'client.BindPluginSettings()': 'client.BindPluginSettings(pluginName)',
210
227
  }),
211
228
  babel({
@@ -260,7 +277,7 @@ export const TranspilerPluginComponent = async (bIsMillennium: boolean, pluginJs
260
277
  process.exit(1);
261
278
  }
262
279
 
263
- return id === '@steambrew/client' || id === 'react' || id === 'react-dom' || id === 'react-dom/client';
280
+ return id === '@steambrew/client' || id === 'react' || id === 'react-dom' || id === 'react-dom/client' || id === 'react/jsx-runtime';
264
281
  },
265
282
  output: {
266
283
  name: 'millennium_main',