jrburke/requirejs — pull request #1039 by gartz (2014-02-19 19:45:16+00:00)
Title: Sync shim

Add option in the shim, to load dependencies in order.

Lets say you want to add parts of Polymer-Project in your project, that use requirejs, the shim config would be something like this:
```
'customElements': {
deps: [
'vendor/bower/CustomElements/src/scope',
'vendor/bower/CustomElements/src/Parser',
'weakmap',
'vendor/bower/MutationObservers/MutationObserver',
'vendor/bower/CustomElements/src/CustomElements',
'vendor/bower/CustomElements/src/Observer'
],
exports: 'window.CustomElements'
},
```

BUT IT WILL FAIL.

Because the dependence need to be loaded in order for Polymer-project, they don't use AMD at all. So you need to configure this way to work:

```
'vendor/bower/CustomElements/src/Parser': {
deps: [
'vendor/bower/CustomElements/src/scope'
]
},
'weakmap': {
deps: [
'vendor/bower/CustomElements/src/Parser'
]
},
'vendor/bower/MutationObservers/MutationObserver': {
deps: [
'weakmap'
]
},
'vendor/bower/CustomElements/src/CustomElements': {
deps: [
'vendor/bower/MutationObservers/MutationObserver'
]
},
'vendor/bower/CustomElements/src/Observer': {
deps: [
'vendor/bower/CustomElements/src/CustomElements'
]
},
'customElements': {
deps: [
'vendor/bower/CustomElements/src/Observer'
],
exports: 'window.CustomElements'
},
```

It will work but it's a lot of code for a simple task... Imagine for ShadowDOM there is more then 30 files that you need a sequential load.

The solution is add a `async` property that will only trigger if is explicit false, example:

```
'customElements': {
async: false,
deps: [
'vendor/bower/CustomElements/src/scope',
'vendor/bower/CustomElements/src/Parser',
'weakmap',
'vendor/bower/MutationObservers/MutationObserver',
'vendor/bower/CustomElements/src/CustomElements',
'vendor/bower/CustomElements/src/Observer'
],
exports: 'window.CustomElements'
},
```

This example above will do the same as the second but you don't need to do huge config to it work. And its awesome when is like 30 dependence in the shim, like ShadowDOM from Polymer-Project.