refactor(upgrade): rename module
constant to avoid webpack bug (#30058)
When targeting ES2015 (as is the default in cli@8), `const` is not downleveled to `var` and thus declaring `const module` throws an error due to webpack wrapping the code in a function call with a `module` argument (even when compiling for the `web` environment). Related: webpack/webpack#7369 Fixes #30050 PR Close #30058
This commit is contained in:

committed by
Andrew Kushnir

parent
a9379e0ed2
commit
abcb2cf9a0
@ -62,7 +62,7 @@ withEachNg1Version(() => {
|
||||
|
||||
const downModA = doDowngradeModule(Ng2ModuleA);
|
||||
const downModB = doDowngradeModule(Ng2ModuleB);
|
||||
const ng1Module = angular.module('ng1', [downModA, downModB])
|
||||
const ng1Module = angular.module_('ng1', [downModA, downModB])
|
||||
.directive('ng2A', downgradeComponent({
|
||||
component: Ng2ComponentA,
|
||||
downgradedModule: downModA, propagateDigest,
|
||||
@ -130,7 +130,7 @@ withEachNg1Version(() => {
|
||||
const downModA = doDowngradeModule(Ng2ModuleA);
|
||||
const downModB = doDowngradeModule(Ng2ModuleB);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [downModA, downModB])
|
||||
angular.module_('ng1', [downModA, downModB])
|
||||
.directive('ng1A', () => ({template: 'ng1A(<ng2-b ng-if="showB"></ng2-b>)'}))
|
||||
.directive('ng2A', downgradeComponent({
|
||||
component: Ng2ComponentA,
|
||||
@ -203,7 +203,7 @@ withEachNg1Version(() => {
|
||||
|
||||
const downModA = doDowngradeModule(Ng2ModuleA);
|
||||
const downModB = doDowngradeModule(Ng2ModuleB);
|
||||
const ng1Module = angular.module('ng1', [downModA, downModB])
|
||||
const ng1Module = angular.module_('ng1', [downModA, downModB])
|
||||
.directive('ng2A', downgradeComponent({
|
||||
component: Ng2ComponentA,
|
||||
downgradedModule: downModA, propagateDigest,
|
||||
@ -296,7 +296,7 @@ withEachNg1Version(() => {
|
||||
|
||||
const downModA = doDowngradeModule(Ng2ModuleA);
|
||||
const downModB = doDowngradeModule(Ng2ModuleB);
|
||||
const ng1Module = angular.module('ng1', [downModA, downModB])
|
||||
const ng1Module = angular.module_('ng1', [downModA, downModB])
|
||||
.directive('ng2A', downgradeComponent({
|
||||
component: Ng2ComponentA,
|
||||
downgradedModule: downModA, propagateDigest,
|
||||
@ -386,7 +386,7 @@ withEachNg1Version(() => {
|
||||
|
||||
const downMod = downgradeModule(bootstrapFn);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [downMod])
|
||||
angular.module_('ng1', [downMod])
|
||||
.directive(
|
||||
'ng2A', downgradeComponent({component: Ng2ComponentA, propagateDigest}))
|
||||
.directive(
|
||||
@ -494,7 +494,7 @@ withEachNg1Version(() => {
|
||||
|
||||
const downModA = doDowngradeModule(Ng2ModuleA);
|
||||
const downModB = doDowngradeModule(Ng2ModuleB);
|
||||
const ng1Module = angular.module('ng1', [downModA, downModB])
|
||||
const ng1Module = angular.module_('ng1', [downModA, downModB])
|
||||
.directive('ng2A', downgradeComponent({
|
||||
component: Ng2ComponentA,
|
||||
downgradedModule: downModA, propagateDigest,
|
||||
@ -560,7 +560,7 @@ withEachNg1Version(() => {
|
||||
platformBrowserDynamic(extraProviders).bootstrapModule(Ng2Module);
|
||||
const lazyModuleName = downgradeModule<Ng2Module>(bootstrapFn);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [lazyModuleName])
|
||||
angular.module_('ng1', [lazyModuleName])
|
||||
.directive(
|
||||
'ng2', downgradeComponent({component: Ng2AComponent, propagateDigest}))
|
||||
.run(($rootScope: angular.IRootScopeService) => $rootScope.value = 0);
|
||||
@ -623,7 +623,7 @@ withEachNg1Version(() => {
|
||||
platformBrowserDynamic(extraProviders).bootstrapModule(Ng2Module);
|
||||
const lazyModuleName = downgradeModule<Ng2Module>(bootstrapFn);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [lazyModuleName])
|
||||
angular.module_('ng1', [lazyModuleName])
|
||||
.directive('ng2', downgradeComponent({component: Ng2Component, propagateDigest}))
|
||||
.value('ng1Value', 'foo');
|
||||
|
||||
@ -667,7 +667,7 @@ withEachNg1Version(() => {
|
||||
platformBrowserDynamic(extraProviders).bootstrapModule(Ng2Module);
|
||||
const lazyModuleName = downgradeModule<Ng2Module>(bootstrapFn);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [lazyModuleName])
|
||||
angular.module_('ng1', [lazyModuleName])
|
||||
.directive(
|
||||
'ng2', downgradeComponent({component: Ng2Component, propagateDigest}));
|
||||
|
||||
@ -702,7 +702,7 @@ withEachNg1Version(() => {
|
||||
platformBrowserDynamic(extraProviders).bootstrapModule(Ng2Module);
|
||||
const lazyModuleName = downgradeModule<Ng2Module>(bootstrapFn);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [lazyModuleName])
|
||||
angular.module_('ng1', [lazyModuleName])
|
||||
.directive(
|
||||
'ng2', downgradeComponent({component: Ng2Component, propagateDigest}));
|
||||
|
||||
@ -742,7 +742,7 @@ withEachNg1Version(() => {
|
||||
platformBrowserDynamic(extraProviders).bootstrapModule(Ng2Module);
|
||||
const lazyModuleName = downgradeModule<Ng2Module>(bootstrapFn);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [lazyModuleName])
|
||||
angular.module_('ng1', [lazyModuleName])
|
||||
.directive('ng2', downgradeComponent({component: Ng2Component, propagateDigest}))
|
||||
.run(($rootScope: angular.IRootScopeService) => {
|
||||
$rootScope.attrVal = 'bar';
|
||||
@ -809,7 +809,7 @@ withEachNg1Version(() => {
|
||||
platformBrowserDynamic(extraProviders).bootstrapModule(Ng2Module);
|
||||
const lazyModuleName = downgradeModule<Ng2Module>(bootstrapFn);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [lazyModuleName])
|
||||
angular.module_('ng1', [lazyModuleName])
|
||||
.directive(
|
||||
'test', downgradeComponent({component: TestComponent, propagateDigest}))
|
||||
.directive(
|
||||
@ -858,7 +858,7 @@ withEachNg1Version(() => {
|
||||
platformBrowserDynamic(extraProviders).bootstrapModule(Ng2Module);
|
||||
const lazyModuleName = downgradeModule<Ng2Module>(bootstrapFn);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [lazyModuleName])
|
||||
angular.module_('ng1', [lazyModuleName])
|
||||
.directive(
|
||||
'ng2', downgradeComponent({component: Ng2Component, propagateDigest}));
|
||||
|
||||
@ -908,7 +908,7 @@ withEachNg1Version(() => {
|
||||
platformBrowserDynamic(extraProviders).bootstrapModule(Ng2Module);
|
||||
const lazyModuleName = downgradeModule<Ng2Module>(bootstrapFn);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [lazyModuleName])
|
||||
angular.module_('ng1', [lazyModuleName])
|
||||
.directive(
|
||||
'test', downgradeComponent({component: TestComponent, propagateDigest}))
|
||||
.directive(
|
||||
@ -978,7 +978,7 @@ withEachNg1Version(() => {
|
||||
platformBrowserDynamic(extraProviders).bootstrapModule(Ng2Module);
|
||||
const lazyModuleName = downgradeModule<Ng2Module>(bootstrapFn);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [lazyModuleName])
|
||||
angular.module_('ng1', [lazyModuleName])
|
||||
.directive('ng2', downgradeComponent({component: Ng2Component, propagateDigest}))
|
||||
.run(($rootScope: angular.IRootScopeService) => {
|
||||
rootScope = $rootScope;
|
||||
@ -1121,7 +1121,7 @@ withEachNg1Version(() => {
|
||||
platformBrowserDynamic(extraProviders).bootstrapModule(Ng2Module);
|
||||
const lazyModuleName = downgradeModule<Ng2Module>(bootstrapFn);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [lazyModuleName])
|
||||
angular.module_('ng1', [lazyModuleName])
|
||||
.directive(
|
||||
'ng2', downgradeComponent({component: Ng2Component, propagateDigest}));
|
||||
|
||||
@ -1178,7 +1178,7 @@ withEachNg1Version(() => {
|
||||
platformBrowserDynamic(extraProviders).bootstrapModule(Ng2Module);
|
||||
const lazyModuleName = downgradeModule<Ng2Module>(bootstrapFn);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [lazyModuleName])
|
||||
angular.module_('ng1', [lazyModuleName])
|
||||
.directive(
|
||||
'ng2', downgradeComponent({component: Ng2Component, propagateDigest}));
|
||||
|
||||
@ -1233,7 +1233,7 @@ withEachNg1Version(() => {
|
||||
platformBrowserDynamic(extraProviders).bootstrapModule(Ng2Module);
|
||||
const lazyModuleName = downgradeModule<Ng2Module>(bootstrapFn);
|
||||
const ng1Module =
|
||||
angular.module('ng1', [lazyModuleName])
|
||||
angular.module_('ng1', [lazyModuleName])
|
||||
.directive(
|
||||
'ng2', downgradeComponent({component: Ng2Component, propagateDigest}));
|
||||
|
||||
@ -1298,7 +1298,7 @@ withEachNg1Version(() => {
|
||||
afterEach(() => setTempInjectorRef(null !));
|
||||
|
||||
it('should throw if no downgraded module is included', async(() => {
|
||||
const ng1Module = angular.module('ng1', [])
|
||||
const ng1Module = angular.module_('ng1', [])
|
||||
.value($EXCEPTION_HANDLER, errorSpy)
|
||||
.directive('ng2A', downgradeComponent({
|
||||
component: Ng2CompA,
|
||||
@ -1330,7 +1330,7 @@ withEachNg1Version(() => {
|
||||
}));
|
||||
|
||||
it('should throw if the corresponding downgraded module is not included', async(() => {
|
||||
const ng1Module = angular.module('ng1', [downModA])
|
||||
const ng1Module = angular.module_('ng1', [downModA])
|
||||
.value($EXCEPTION_HANDLER, errorSpy)
|
||||
.directive('ng2A', downgradeComponent({
|
||||
component: Ng2CompA,
|
||||
@ -1356,7 +1356,7 @@ withEachNg1Version(() => {
|
||||
|
||||
it('should throw if `downgradedModule` is not specified and there are multiple downgraded modules',
|
||||
async(() => {
|
||||
const ng1Module = angular.module('ng1', [downModA, downModB])
|
||||
const ng1Module = angular.module_('ng1', [downModA, downModB])
|
||||
.value($EXCEPTION_HANDLER, errorSpy)
|
||||
.directive('ng2A', downgradeComponent({
|
||||
component: Ng2CompA,
|
||||
|
Reference in New Issue
Block a user