zowe / zlux

The top-level superproject for zLUX. zLUX includes the Zowe Desktop framework in addition to several built-in apps and an example server implementation.
Eclipse Public License 2.0
38 stars 42 forks source link

Wrap ts-term build output in a module loader #958

Closed 1000TurquoisePogs closed 1 year ago

1000TurquoisePogs commented 1 year ago

https://github.com/TSTerminal/TSTerm/blob/main/lib/tsterm.min.js is missing the wrapping of

! function(exports) {
...
return exports;}("undefined"==typeof my_global_name?my_global_name={}:my_global_name);

Which is what is done in https://github.com/zowe/tn3270-ng2/blob/v2.x/staging/webClient/src/lib/js/tn3270.js

We need that because the terminal app initializes the terminal library by calling functions of off a global, such as what you see off of "org_zowe_terminal_tn3270" within https://github.com/zowe/tn3270-ng2/blob/v2.x/staging/webClient/src/app/terminal.ts#L14

tsterm shouldnt be using the global named "org_zowe_terminal_tn3270", because its not zowe. It could use a global name like "org_omp_tsterm_tn3270"

The tsterm build uses "rollup" and it looks like the rollup config file is here https://github.com/TSTerminal/TSTerm/blob/main/rollup.config.js and there should be some way to configure rollup so that it adds that type of wrapper automatically.

note: i'm pretty sure the solution in rollup is --format iife --name "org_omp_tsterm_tn3270" but you gotta try it.

Martin-Zeithaml commented 1 year ago

PR14 done.