Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Fixit: Update some imports of assertions to use standalone helpers #32828

Merged
merged 16 commits into from
Mar 3, 2021
Merged
2 changes: 1 addition & 1 deletion 3p/facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {dashToUnderline} from '../src/string';
import {dict} from '../src/utils/object';
import {loadScript} from './3p';
import {setStyle} from '../src/style';
import {userAssert} from '../src/log';
import {pureUserAssert as userAssert} from '../src/core/assert';

/**
* Produces the Facebook SDK object for the passed in callback.
Expand Down
2 changes: 1 addition & 1 deletion 3p/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import {userAssert} from '../src/log';
import {pureUserAssert as userAssert} from '../src/core/assert';
import {writeScript} from './3p';

/**
Expand Down
2 changes: 1 addition & 1 deletion 3p/mathml.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
import {setStyle} from '../src/style';
import {userAssert} from '../src/log';
import {pureUserAssert as userAssert} from '../src/core/assert';
import {writeScript} from './3p';

/**
Expand Down
2 changes: 1 addition & 1 deletion ads/vendors/csa.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {devAssert} from '../../src/log';
import {pureDevAssert as devAssert} from '../../src/core/assert';
import {getStyle, setStyle, setStyles} from '../../src/style';
import {loadScript, validateData} from '../../3p/3p';
import {tryParseJson} from '../../src/json.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {BaseElement} from './base-element';
import {CSS} from '../../../build/amp-__component_name_hyphenated__-__component_version__.css';
import {dict} from '../../../src/utils/object';
import {isExperimentOn} from '../../../src/experiments';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/** @const {string} */
const TAG = 'amp-__component_name_hyphenated__';
Expand Down
2 changes: 2 additions & 0 deletions build-system/test-configs/dep-check-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ exports.rules = [
'3p/**->src/utils/function.js',
'3p/**->src/utils/object.js',
'3p/**->src/utils/promise.js',
'3p/**->src/core/assert.js',
'3p/**->src/log.js',
'3p/**->src/types.js',
'3p/**->src/string.js',
Expand Down Expand Up @@ -136,6 +137,7 @@ exports.rules = [
'ads/**->src/utils/dom-fingerprint.js',
'ads/**->src/utils/object.js',
'ads/**->src/utils/rate-limit.js',
'ads/**->src/core/assert.js',
'ads/**->src/log.js',
'ads/**->src/mode.js',
'ads/**->src/url.js',
Expand Down
2 changes: 1 addition & 1 deletion contributing/building-a-bento-amp-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ Then protect your code with a check for the component-specific flag `isExperimen
```javascript
import {CSS} from '../../../build/amp-my-element-0.1.css';
import {isExperimentOn} from '../../../src/experiments';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/** @const */
const TAG = 'amp-my-element';
Expand Down
2 changes: 1 addition & 1 deletion contributing/building-an-amp-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ And then protecting your code with a check `isExperimentOn(win, 'amp-my-element'

```javascript
import {isExperimentOn} from '../../../src/experiments';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/** @const */
const EXPERIMENT = 'amp-my-element';
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-a4a/0.1/amp-ad-template-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import {LruCache} from '../../../src/utils/lru-cache';
import {Services} from '../../../src/services';
import {createElementWithAttributes} from '../../../src/dom';
import {devAssert} from '../../../src/log';
import {pureDevAssert as devAssert} from '../../../src/core/assert';
import {dict} from '../../../src/utils/object';
import {getMode} from '../../../src/mode';
import {
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-a4a/0.1/friendly-frame-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {Renderer} from './amp-ad-type-defs';
import {devAssert} from '../../../src/log';
import {pureDevAssert as devAssert} from '../../../src/core/assert';
import {renderCreativeIntoFriendlyFrame} from './friendly-frame-util';

/**
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-a4a/0.1/template-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {Renderer} from './amp-ad-type-defs';
import {devAssert} from '../../../src/log';
import {pureDevAssert as devAssert} from '../../../src/core/assert';
import {getAmpAdTemplateHelper} from './amp-ad-template-helper';
import {renderCreativeIntoFriendlyFrame} from './friendly-frame-util';

Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-access-scroll/0.1/scroll-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import {Services} from '../../../src/services';
import {assertDoesNotContainDisplay, px, setStyles} from '../../../src/style';
import {createElementWithAttributes} from '../../../src/dom';
import {devAssert} from '../../../src/log';
import {pureDevAssert as devAssert} from '../../../src/core/assert';
import {hasOwn} from '../../../src/utils/object';

/** @abstract */
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-accordion/1.0/amp-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {Services} from '../../../src/services';
import {createCustomEvent} from '../../../src/event-helper';
import {isExperimentOn} from '../../../src/experiments';
import {toWin} from '../../../src/types';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/** @const {string} */
const TAG = 'amp-accordion';
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-action-macro/0.1/amp-action-macro.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
import {LayoutPriority} from '../../../src/layout';
import {Services} from '../../../src/services';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/** @const {string} */
const TAG = 'amp-action-macro';
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-ad-custom/0.1/amp-ad-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {Services} from '../../../src/services';
import {TemplateRenderer} from '../../amp-a4a/0.1/template-renderer';
import {TemplateValidator} from '../../amp-a4a/0.1/template-validator';
import {addParamToUrl} from '../../../src/url';
import {devAssert} from '../../../src/log';
import {pureDevAssert as devAssert} from '../../../src/core/assert';

// These have no side-effects, and so may be reused between all instances.
const validator = new TemplateValidator();
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-ad-exit/0.1/filters/click-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {Filter, FilterType} from './filter';
import {userAssert} from '../../../../src/log';
import {pureUserAssert as userAssert} from '../../../../src/core/assert';

export class ClickLocationFilter extends Filter {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import {devAssert} from '../../../src/log';
import {pureDevAssert as devAssert} from '../../../src/core/assert';

/**
* Maintains state in between different AdSense slots on the same page. This
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import {
} from '../sra-utils';
import {Xhr} from '../../../../src/service/xhr-impl';
import {createElementWithAttributes} from '../../../../src/dom';
import {devAssert} from '../../../../src/log';
import {pureDevAssert as devAssert} from '../../../../src/core/assert';
import {layoutRectLtwh} from '../../../../src/layout-rect';
import {utf8Decode, utf8Encode} from '../../../../src/utils/bytes';

Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-ad/0.1/amp-ad-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
removeChildren,
} from '../../../src/dom';
import {hasOwn} from '../../../src/utils/object';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/** @const {string} Tag name for custom ad implementation. */
export const TAG_AD_CUSTOM = 'amp-ad-custom';
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-ad/0.1/amp-ad-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
createElementWithAttributes,
removeElement,
} from '../../../src/dom';
import {devAssert} from '../../../src/log';
import {pureDevAssert as devAssert} from '../../../src/core/assert';
import {dict} from '../../../src/utils/object';
import {getExperimentBranch} from '../../../src/experiments';

Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-ad/0.1/amp-ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {Services} from '../../../src/services';
import {adConfig} from '../../../ads/_config';
import {getA4ARegistry} from '../../../ads/_a4a-config';
import {hasOwn} from '../../../src/utils/object';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/**
* Construct ad network type-specific tag and script name. Note that this
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-addthis/0.1/amp-addthis.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import {isLayoutSizeDefined} from '../../../src/layout';
import {listen} from '../../../src/event-helper';
import {parseUrlDeprecated} from '../../../src/url';
import {setStyle} from '../../../src/style';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

// The following items will be shared by all AmpAddThis elements on a page, to
// prevent unnecessary HTTP requests, get accurate analytics, etc., and hence
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-analytics/0.1/scroll-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import {Observable} from '../../../src/observable';
import {Services} from '../../../src/services';
import {devAssert} from '../../../src/log';
import {pureDevAssert as devAssert} from '../../../src/core/assert';

/**
* @typedef {{
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-analytics/0.1/visibility-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import {Deferred} from '../../../src/utils/promise';
import {Observable} from '../../../src/observable';
import {devAssert} from '../../../src/log';
import {pureDevAssert as devAssert} from '../../../src/core/assert';
import {dict} from '../../../src/utils/object';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
WebSwitchAnimationDef,
} from '../web-animation-types';
import {assertDoesNotContainDisplay, setStyles} from '../../../../src/style';
import {devAssert} from '../../../../src/log';
import {pureDevAssert as devAssert} from '../../../../src/core/assert';
import {getTotalDuration} from './utils';

/**
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-animation/0.1/runners/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import {userAssert} from '../../../../src/log';
import {pureUserAssert as userAssert} from '../../../../src/core/assert';

/**
* @param {!Array<!../web-animation-types.InternalWebAnimationRequestDef>} requests
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-auto-ads/0.1/amp-auto-ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {dict} from '../../../src/utils/object';
import {getAdNetworkConfig} from './ad-network-config';
import {getPlacementsFromConfigObj} from './placement';
import {isExperimentOn} from '../../../src/experiments';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/** @const */
const TAG = 'amp-auto-ads';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import {ownProperty} from '../../../src/utils/object';
import {tryFocus} from '../../../src/dom';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

const TAG = 'amp-autocomplete';

Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-base-carousel/1.0/amp-base-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {createCustomEvent} from '../../../src/event-helper';
import {dict} from '../../../src/utils/object';
import {dispatchCustomEvent} from '../../../src/dom';
import {isExperimentOn} from '../../../src/experiments';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/** @const {string} */
const TAG = 'amp-base-carousel';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {isFiniteNumber, isObject} from '../../../src/types';
import {isLayoutSizeDefined} from '../../../src/layout';
import {parseJson} from '../../../src/json';
import {removeElement} from '../../../src/dom';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

const TAG = 'amp-bodymovin-animation';

Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-carousel/0.1/base-slides.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {ActionTrust} from '../../../src/action-constants';
import {BaseCarousel} from './base-carousel';
import {Services} from '../../../src/services';
import {isFiniteNumber} from '../../../src/types';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

export class BaseSlides extends BaseCarousel {
/** @param {!AmpElement} element */
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-connatix-player/0.1/amp-connatix-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
import {removeElement} from '../../../src/dom';
import {setIsMediaComponent} from '../../../src/video-interface';
import {tryParseJson} from '../../../src/json';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/**
* @param {!Array<T>} promises
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-delight-player/0.1/amp-delight-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
unobserveWithSharedInOb,
} from '../../../src/viewport-observer';
import {setStyle} from '../../../src/style';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/** @const */
const TAG = 'amp-delight-player';
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-embedly-card/0.1/amp-embedly-card-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {Services} from '../../../src/services';
import {getIframe} from '../../../src/3p-frame';
import {listenFor} from '../../../src/iframe-helper';
import {removeElement} from '../../../src/dom';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/**
* Component tag identifier.
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-embedly-card/0.1/amp-embedly-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {Layout} from '../../../src/layout';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/** @const {string} */
export const TAG = 'amp-embedly-key';
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-experiment/1.0/mutation-record.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {isObject, toArray} from '../../../src/types';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/**
* Types of possibile mutations
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-experiment/1.0/mutation/mutation.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import {userAssert} from '../../../../src/log';
import {pureUserAssert as userAssert} from '../../../../src/core/assert';

/**
* Interface for amp-experiment mutations.
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-fit-text/1.0/amp-fit-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import {BaseElement} from './base-element';
import {CSS} from '../../../build/amp-fit-text-1.0.css';
import {isExperimentOn} from '../../../src/experiments';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/** @const {string} */
const TAG = 'amp-fit-text';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import {FxType} from '../fx-type';
import {Services} from '../../../../src/services';
import {mapRange} from '../../../../src/utils/math';
import {userAssert} from '../../../../src/log';
import {pureUserAssert as userAssert} from '../../../../src/core/assert';

const MAX_MOBILE_WIDTH = 480;
const MAX_TABLET_WIDTH = 1000;
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-fx-collection/0.1/providers/fx-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
installStyles,
resolvePercentageToNumber,
} from './amp-fx-presets-utils';
import {devAssert} from '../../../../src/log';
import {pureDevAssert as devAssert} from '../../../../src/core/assert';
import {
getServiceForDoc,
registerServiceBuilderForDoc,
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-gwd-animation/0.1/amp-gwd-animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
getParentWindowFrameElement,
getServiceForDocOrNull,
} from '../../../src/service';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

/**
* Returns a value at any level in an object structure addressed by dot-notation
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-imgur/0.1/amp-imgur.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {isLayoutSizeDefined} from '../../../src/layout';
import {isObject} from '../../../src/types';
import {removeElement} from '../../../src/dom';
import {tryParseJson} from '../../../src/json';
import {userAssert} from '../../../src/log';
import {pureUserAssert as userAssert} from '../../../src/core/assert';

export class AmpImgur extends AMP.BaseElement {
/** @param {!AmpElement} element */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import {InlineGalleryEvents} from './inline-gallery-events';
import {Layout} from '../../../src/layout';
import {createCustomEvent} from '../../../src/event-helper';
import {devAssert} from '../../../src/log';
import {pureDevAssert as devAssert} from '../../../src/core/assert';
import {dict} from '../../../src/utils/object';
import {htmlFor} from '../../../src/static-template';
import {scopedQuerySelectorAll} from '../../../src/dom';
Expand Down
Loading