This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: seperate zone.js into evergreen only and legacy included bundles.
- Loading branch information
1 parent
ce9c2e0
commit ac3851e
Showing
34 changed files
with
713 additions
and
324 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
module.exports = function (config) { | ||
require('./karma-evergreen-dist.conf.js')(config); | ||
|
||
config.plugins.push(require('karma-jasmine')); | ||
config.frameworks.push('jasmine'); | ||
}; |
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,12 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
module.exports = function (config) { | ||
require('./karma-evergreen-dist-jasmine.conf.js')(config); | ||
require('./sauce-evergreen.conf')(config); | ||
}; |
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,25 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
module.exports = function(config) { | ||
require('./karma-base.conf.js')(config); | ||
config.files.push('build/test/wtf_mock.js'); | ||
config.files.push('build/test/test_fake_polyfill.js'); | ||
config.files.push('build/test/custom_error.js'); | ||
config.files.push('dist/zone-evergreen.js'); | ||
config.files.push('dist/zone-patch-canvas.js'); | ||
config.files.push('dist/zone-patch-fetch.js'); | ||
config.files.push('dist/webapis-media-query.js'); | ||
config.files.push('dist/webapis-notification.js'); | ||
config.files.push('dist/zone-patch-user-media.js'); | ||
config.files.push('dist/zone-patch-resize-observer.js'); | ||
config.files.push('dist/task-tracking.js'); | ||
config.files.push('dist/wtf.js'); | ||
config.files.push('dist/zone-testing.js'); | ||
config.files.push('build/test/main.js'); | ||
}; |
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 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {bindArguments, patchMacroTask, patchMethod, patchOnProperties} from '../common/utils'; | ||
|
||
Zone.__load_patch('util', (global: any, Zone: ZoneType, api: _ZonePrivate) => { | ||
api.patchOnProperties = patchOnProperties; | ||
api.patchMethod = patchMethod; | ||
api.bindArguments = bindArguments; | ||
api.patchMacroTask = patchMacroTask; | ||
}); |
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,28 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
/** | ||
* @fileoverview | ||
* @suppress {missingRequire} | ||
*/ | ||
|
||
import {eventTargetLegacyPatch} from './event-target-legacy'; | ||
import {propertyDescriptorLegacyPatch} from './property-descriptor-legacy'; | ||
import {registerElementPatch} from './register-element'; | ||
|
||
Zone.__load_patch('registerElement', (global: any, Zone: ZoneType, api: _ZonePrivate) => { | ||
registerElementPatch(global); | ||
}); | ||
|
||
Zone.__load_patch('EventTargetLegacy', (global: any, Zone: ZoneType, api: _ZonePrivate) => { | ||
const SYMBOL_BLACK_LISTED_EVENTS = Zone.__symbol__('BLACK_LISTED_EVENTS'); | ||
if (global[SYMBOL_BLACK_LISTED_EVENTS]) { | ||
(Zone as any)[SYMBOL_BLACK_LISTED_EVENTS] = global[SYMBOL_BLACK_LISTED_EVENTS]; | ||
} | ||
eventTargetLegacyPatch(global, api); | ||
propertyDescriptorLegacyPatch(api, global); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
Zone.__load_patch('canvas', (global: any, Zone: ZoneType, api: _ZonePrivate) => { | ||
const HTMLCanvasElement = global['HTMLCanvasElement']; | ||
if (typeof HTMLCanvasElement !== 'undefined' && HTMLCanvasElement.prototype && | ||
HTMLCanvasElement.prototype.toBlob) { | ||
api.patchMacroTask(HTMLCanvasElement.prototype, 'toBlob', (self: any, args: any[]) => { | ||
return {name: 'HTMLCanvasElement.toBlob', target: self, cbIdx: 0, args: args}; | ||
}); | ||
} | ||
}); |
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,54 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {attachOriginToPatched, isBrowser, isMix, ObjectGetOwnPropertyDescriptor, wrapWithCurrentZone} from '../common/utils'; | ||
|
||
import {_redefineProperty} from './define-property'; | ||
|
||
export function patchCallbacks( | ||
target: any, targetName: string, method: string, callbacks: string[]) { | ||
const symbol = Zone.__symbol__(method); | ||
if (target[symbol]) { | ||
return; | ||
} | ||
const nativeDelegate = target[symbol] = target[method]; | ||
target[method] = function(name: any, opts: any, options?: any) { | ||
if (opts && opts.prototype) { | ||
callbacks.forEach(function(callback) { | ||
const source = `${targetName}.${method}::` + callback; | ||
const prototype = opts.prototype; | ||
if (prototype.hasOwnProperty(callback)) { | ||
const descriptor = ObjectGetOwnPropertyDescriptor(prototype, callback); | ||
if (descriptor && descriptor.value) { | ||
descriptor.value = wrapWithCurrentZone(descriptor.value, source); | ||
_redefineProperty(opts.prototype, callback, descriptor); | ||
} else if (prototype[callback]) { | ||
prototype[callback] = wrapWithCurrentZone(prototype[callback], source); | ||
} | ||
} else if (prototype[callback]) { | ||
prototype[callback] = wrapWithCurrentZone(prototype[callback], source); | ||
} | ||
}); | ||
} | ||
|
||
return nativeDelegate.call(target, name, opts, options); | ||
}; | ||
|
||
attachOriginToPatched(target[method], nativeDelegate); | ||
} | ||
|
||
export function patchCustomElements(_global: any) { | ||
if ((!isBrowser && !isMix) || !('customElements' in _global)) { | ||
return; | ||
} | ||
|
||
const callbacks = | ||
['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback']; | ||
|
||
patchCallbacks(_global.customElements, 'customElements', 'define', callbacks); | ||
} |
Oops, something went wrong.