Skip to content

Commit d7083e8

Browse files
committed
fix(index-async): properly inline text containing $$
When using `'...'.replace(regex, replacement)`, any instances of `$$` inside `replacement` will be converted to `$` (see [mdn](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter). Thus, for example `$$minErr` and `$$moduleName` are converted to `$minErr` and `$moduleName`. This commit fixes it, by first using `'...'.split(regex).join(replacement)` instead. Fixes angular#283 Closes angular#286
1 parent 287e486 commit d7083e8

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

app/index-async.html

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@
1313
<script>
1414
// include angular loader, which allows the files to load in any order
1515
//@@NG_LOADER_START@@
16-
// You need to run `npm run update-index-async` to inject the angular async code here
16+
/*
17+
AngularJS v1.5.7
18+
(c) 2010-2016 Google, Inc. http://angularjs.org
19+
License: MIT
20+
*/
21+
(function(){'use strict';function d(b){return function(){var a=arguments[0],e;e="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.5.7/"+(b?b+"/":"")+a;for(a=1;a<arguments.length;a++){e=e+(1==a?"?":"&")+"p"+(a-1)+"=";var d=encodeURIComponent,c;c=arguments[a];c="function"==typeof c?c.toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof c?"undefined":"string"!=typeof c?JSON.stringify(c):c;e+=d(c)}return Error(e)}}(function(b){function a(c,a,b){return c[a]||(c[a]=b())}var e=d("$injector"),n=d("ng");
22+
b=a(b,"angular",Object);b.$$minErr=b.$$minErr||d;return a(b,"module",function(){var c={};return function(b,d,h){if("hasOwnProperty"===b)throw n("badname","module");d&&c.hasOwnProperty(b)&&(c[b]=null);return a(c,b,function(){function c(a,b,d,e){e||(e=f);return function(){e[d||"push"]([a,b,arguments]);return g}}function a(c,e){return function(a,d){d&&"function"===typeof d&&(d.$$moduleName=b);f.push([c,e,arguments]);return g}}if(!d)throw e("nomod",b);var f=[],k=[],l=[],m=c("$injector","invoke","push",
23+
k),g={_invokeQueue:f,_configBlocks:k,_runBlocks:l,requires:d,name:b,provider:a("$provide","provider"),factory:a("$provide","factory"),service:a("$provide","service"),value:c("$provide","value"),constant:c("$provide","constant","unshift"),decorator:a("$provide","decorator"),animation:a("$animateProvider","register"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),component:a("$compileProvider","component"),config:m,run:function(a){l.push(a);
24+
return this}};h&&m(h);return g})}})})(window)})(window);
25+
//# sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map
1726
//@@NG_LOADER_END@@
1827

1928
// include a third-party async loader library

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
"preprotractor": "npm run update-webdriver",
3333
"protractor": "protractor e2e-tests/protractor.conf.js",
3434

35-
"update-index-async": "node -e \"var fs=require('fs'),indexFile='app/index-async.html',loaderFile='app/bower_components/angular-loader/angular-loader.min.js',loaderText=fs.readFileSync(loaderFile,'utf-8').replace(/sourceMappingURL=angular-loader.min.js.map/,'sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map'),indexText=fs.readFileSync(indexFile,'utf-8').replace(/\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/,'//@@NG_LOADER_START@@\\n'+loaderText+' //@@NG_LOADER_END@@');fs.writeFileSync(indexFile,indexText);\""
35+
"update-index-async": "node -e \"var fs=require('fs'),indexFile='app/index-async.html',loaderFile='app/bower_components/angular-loader/angular-loader.min.js',loaderText=fs.readFileSync(loaderFile,'utf-8').split(/sourceMappingURL=angular-loader.min.js.map/).join('sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map'),indexText=fs.readFileSync(indexFile,'utf-8').split(/\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/).join('//@@NG_LOADER_START@@\\n'+loaderText+' //@@NG_LOADER_END@@');fs.writeFileSync(indexFile,indexText);\""
3636
}
3737
}

0 commit comments

Comments
 (0)