@steambrew/ttc 2.8.6 → 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({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steambrew/ttc",
3
- "version": "2.8.6",
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({