Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Issue 745 - Rename async modules #762

Merged
merged 7 commits into from
Feb 27, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Changed
- [#762](https://github.com/plotly/dash-core-components/pull/762) Renamed async modules with hyphen `-` instead of tilde `~`

## [1.8.0] - 2020-02-04
### Changed
- [#743](https://github.com/plotly/dash-core-components/pull/743) Location component now emits an event on URL path update from Link component
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ include dash_core_components/dash_core_components.min.js
include dash_core_components/dash_core_components.min.js.map
include dash_core_components/dash_core_components-shared.js
include dash_core_components/dash_core_components-shared.js.map
include dash_core_components/async~*.js
include dash_core_components/async~*.js.map
include dash_core_components/async-*.js
include dash_core_components/async-*.js.map
include dash_core_components/metadata.json
include dash_core_components/package-info.json
include dash_core_components/plotly.min.js
Expand Down
16 changes: 8 additions & 8 deletions dash_core_components_base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@
_js_dist = []

_js_dist.extend([{
'relative_package_path': 'async~{}.js'.format(async_resource),
'relative_package_path': 'async-{}.js'.format(async_resource),
'external_url': (
'https://unpkg.com/dash-core-components@{}'
'/dash_core_components/async~{}.js'
'/dash_core_components/async-{}.js'
).format(__version__, async_resource),
'namespace': 'dash_core_components',
'async': True
} for async_resource in async_resources])

_js_dist.extend([{
'relative_package_path': 'async~{}.js.map'.format(async_resource),
'relative_package_path': 'async-{}.js.map'.format(async_resource),
'external_url': (
'https://unpkg.com/dash-core-components@{}'
'/dash_core_components/async~{}.js.map'
'/dash_core_components/async-{}.js.map'
).format(__version__, async_resource),
'namespace': 'dash_core_components',
'dynamic': True
Expand Down Expand Up @@ -116,19 +116,19 @@
'async': 'eager'
},
{
'relative_package_path': 'async~plotlyjs.js',
'relative_package_path': 'async-plotlyjs.js',
'external_url': (
'https://unpkg.com/dash-core-components@{}'
'/dash_core_components/async~graph~plotlyjs.js'
'/dash_core_components/async-plotlyjs.js'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty bad error here and below with serve_locally=False

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes, nice find! Is there anything we can do to test this? I'm thinking like a standard test we can put in dash.testing and then run in all our repos with appropriate parameters, looping over _js_dist and ensuring external_url matches a certain pattern vs relative_package_path?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a followup issue would be fine for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow up in https://github.com/plotly/dash-core/issues/171 - providing at least two approaches: pattern matching as suggested and something more robust / matching e2e usage but requiring more effort.

).format(__version__),
'namespace': 'dash_core_components',
'async': 'lazy'
},
{
'relative_package_path': 'async~plotlyjs.js.map',
'relative_package_path': 'async-plotlyjs.js.map',
'external_url': (
'https://unpkg.com/dash-core-components@{}'
'/dash_core_components/async~graph~plotlyjs.js.map'
'/dash_core_components/async-plotlyjs.js.map'
).format(__version__),
'namespace': 'dash_core_components',
'dynamic': True
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/graph/test_graph_varia.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def findSyncPlotlyJs(scripts):

def findAsyncPlotlyJs(scripts):
for script in scripts:
if "dash_core_components/async~plotlyjs" in script.get_attribute(
if "dash_core_components/async-plotlyjs" in script.get_attribute(
'src'
):
return script
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ module.exports = (env, argv) => {
chunks: 'async',
minSize: 0,
name(module, chunks, cacheGroupKey) {
return `${cacheGroupKey}~${chunks[0].name}`;
return `${cacheGroupKey}-${chunks[0].name}`;
}
},
shared: {
Expand All @@ -134,7 +134,7 @@ module.exports = (env, argv) => {
new WebpackDashDynamicImport(),
new webpack.SourceMapDevToolPlugin({
filename: '[file].map',
exclude: ['async~plotlyjs']
exclude: ['async-plotlyjs']
})
]
}
Expand Down