In this GitHub issue: https://github.com/magento/magento2/issues/7475
A Magento employee made two curious statements. First
Sorry I didn't understand your proposal on utilizing x-magento-init.
Then
General info: components in folders lib/web and app/code/Magento/Ui are global and may be utilized on any page. All other JS components are module specific and should be utilized when you develop extension to a specific module.
Regarding the x-magento-init statement -- I've been under the (incorrect?) assumption that creating a text/x-magento-init script tag that runs a Magento_Ui/js/core/app program is "the right" way to get server side rendered data into our javascript programs. Magento_Ui/js/core/app will load component JSON into the requirejs('uiRegistry') registry, which can then be used by other modules. Is Magento_Ui/js/core/app the right way to handle server side rendered data? Or is there another story here?
Regarding: "All other JS components are module specific". This seems -- wrong? A cursory search of Magento's core code shows places where this isn't true. For example, the Magento_Weee module uses modules from the Magento_Checkout module
#File: vendor/magento/module-weee/view/frontend/web/js/view/checkout/summary/weee.js define( [ 'Magento_Checkout/js/view/summary/abstract-total', 'Magento_Checkout/js/model/quote', 'Magento_Checkout/js/model/totals', 'Magento_Catalog/js/price-utils' ], function(){ /* ... */ } )
Is it the intention of Magento's RequireJS implementation that modules can not use other module's source code unless those modules are in lib/web and app/code/Magento/Ui? If not, are there actual guidelines on what can and can't be used, or are things still a little loosey goosey here?