Earlier versions of Experience Builder made use of string matching against the compiled JavaScript code to determine which drupalSettings to add to the page.
Existing JavaScriptComponent config entities will get dataDependencies set automatically based on string matching (thanks to the update path in experience_builder_post_update_javascript_component_data_dependencies() + JavascriptComponentDataDependenciesUpdateTest). Code components that use either getSiteData(), getPageData() in @/lib/drupal-utils or @drupal-api-client/json-api-client will get dataDependencies: { <something> }, those that don't will get dataDependencies: {}.
From 0.7.3-alpha1 dataDependencies will be updated to make use of @babel/parser to explicitly detect the needed settings via parsing and storing in the JavaScriptComponent config entity.
- Before (without any data dependencies)
-
… css: original: '' compiled: '' - After (without any data dependencies)
-
… css: original: '' compiled: '' dataDependencies: []
- Before (WITH some data dependencies)
-
… css: original: '' compiled: '' - After (WITH some data dependencies)
-
… css: original: '' compiled: '' dataDependencies: drupalSettings: - v0.baseUrl - v0.branding
The \Drupal\experience_builder\CodeComponentDataProvider::getRequiredXbDataLibraries() method is deprecated with no replacement and will be removed in Experience Builder 1.0.0.