-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev'
# Conflicts: # dash-renderer/package-lock.json
- Loading branch information
Showing
42 changed files
with
1,005 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Plotly | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "@plotly/dash-component-plugins", | ||
"version": "1.0.1", | ||
"description": "Plugins for Dash Components", | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:plotly/dash.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/plotly/dash/issues" | ||
}, | ||
"homepage": "https://github.com/plotly/dash", | ||
"main": "src/index.js", | ||
"author": "Marc-André Rivet", | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { lazy } from 'react'; | ||
|
||
export const asyncDecorator = (target, promise) => { | ||
let resolve; | ||
const isReady = new Promise(r => { | ||
resolve = r; | ||
}); | ||
|
||
const state = { | ||
isReady, | ||
get: lazy(() => { | ||
return Promise.resolve(promise()).then(res => { | ||
setTimeout(async () => { | ||
await resolve(true); | ||
state.isReady = true; | ||
}, 0); | ||
|
||
return res; | ||
}); | ||
}), | ||
}; | ||
|
||
Object.defineProperty(target, '_dashprivate_isLazyComponentReady', { | ||
get: () => state.isReady, | ||
}); | ||
|
||
return state.get; | ||
}; | ||
|
||
export const isReady = target => target && | ||
target._dashprivate_isLazyComponentReady; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { asyncDecorator, isReady } from './dynamicImport'; | ||
|
||
export { asyncDecorator, isReady }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Plotly | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "@plotly/webpack-dash-dynamic-import", | ||
"version": "1.1.1", | ||
"description": "Webpack Plugin for Dynamic Import in Dash", | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:plotly/dash.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/plotly/dash/issues" | ||
}, | ||
"homepage": "https://github.com/plotly/dash", | ||
"main": "src/index.js", | ||
"author": "Marc-André Rivet", | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
const fs = require('fs'); | ||
|
||
function getFingerprint() { | ||
const package = fs.readFileSync('./package.json'); | ||
const packageJson = JSON.parse(package); | ||
|
||
const timestamp = Math.round(Date.now() / 1000); | ||
const version = packageJson.version.replace(/[.]/g, '_'); | ||
|
||
return `"v${version}m${timestamp}"`; | ||
} | ||
|
||
const resolveImportSource = () => `\ | ||
const getCurrentScript = function() { | ||
let script = document.currentScript; | ||
if (!script) { | ||
/* Shim for IE11 and below */ | ||
/* Do not take into account async scripts and inline scripts */ | ||
const scripts = Array.from(document.getElementsByTagName('script')).filter(function(s) { return !s.async && !s.text && !s.textContent; }); | ||
script = scripts.slice(-1)[0]; | ||
} | ||
return script; | ||
}; | ||
const isLocalScript = function(script) { | ||
return /\\\/_dash-component-suites\\\//.test(script.src); | ||
}; | ||
Object.defineProperty(__webpack_require__, 'p', { | ||
get: (function () { | ||
let script = getCurrentScript(); | ||
var url = script.src.split('/').slice(0, -1).join('/') + '/'; | ||
return function() { | ||
return url; | ||
}; | ||
})() | ||
}); | ||
const __jsonpScriptSrc__ = jsonpScriptSrc; | ||
jsonpScriptSrc = function(chunkId) { | ||
let script = getCurrentScript(); | ||
let isLocal = isLocalScript(script); | ||
let src = __jsonpScriptSrc__(chunkId); | ||
if(!isLocal) { | ||
return src; | ||
} | ||
const srcFragments = src.split('/'); | ||
const fileFragments = srcFragments.slice(-1)[0].split('.'); | ||
fileFragments.splice(1, 0, ${getFingerprint()}); | ||
srcFragments.splice(-1, 1, fileFragments.join('.')) | ||
return srcFragments.join('/'); | ||
}; | ||
` | ||
|
||
class WebpackDashDynamicImport { | ||
apply(compiler) { | ||
compiler.hooks.compilation.tap('WebpackDashDynamicImport', compilation => { | ||
compilation.mainTemplate.hooks.requireExtensions.tap('WebpackDashDynamicImport > RequireExtensions', (source, chunk, hash) => { | ||
return [ | ||
source, | ||
resolveImportSource() | ||
] | ||
}); | ||
}); | ||
} | ||
} | ||
|
||
module.exports = WebpackDashDynamicImport; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
presets: [['@babel/preset-env', { | ||
useBuiltIns: 'usage', | ||
corejs: 3 | ||
}], '@babel/preset-react'], | ||
env: { | ||
test: { | ||
plugins: [ | ||
'@babel/plugin-transform-modules-commonjs' | ||
] | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.