Skip to content

Commit

Permalink
More merges
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoferbaxter committed Jun 15, 2021
2 parents d94dbe0 + 7702194 commit 184ccf3
Show file tree
Hide file tree
Showing 367 changed files with 1,977 additions and 1,583 deletions.
40 changes: 20 additions & 20 deletions .renovaterc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@
{
"groupName": "subpackage devDependencies",
"matchPaths": ["**/*"],
"automerge": true,
"assignAutomerge": true
"rebaseWhen": "never",
"automerge": true
},
{
"groupName": "build-system devDependencies",
"matchPaths": ["build-system/**"],
"labels": ["WG: infra"],
"automerge": true,
"assignAutomerge": true
"rebaseWhen": "never",
"automerge": true
},
{
"groupName": "validator devDependencies",
"matchPaths": ["validator/**"],
"labels": ["WG: caching"],
"automerge": true,
"assignAutomerge": true
"rebaseWhen": "never",
"automerge": true
},
{
"groupName": "validator webui",
Expand All @@ -47,60 +47,60 @@
"groupName": "core devDependencies",
"matchFiles": ["package.json"],
"labels": ["WG: infra"],
"automerge": true,
"assignAutomerge": true
"rebaseWhen": "never",
"automerge": true
},
{
"groupName": "linting devDependencies",
"matchFiles": ["package.json"],
"matchPackagePatterns": ["\\b(prettier|eslint)\\b"],
"labels": ["WG: infra"],
"automerge": true,
"assignAutomerge": true
"rebaseWhen": "never",
"automerge": true
},
{
"groupName": "babel devDependencies",
"matchFiles": ["package.json"],
"matchPackagePatterns": ["\\bbabel"],
"major": {"automerge": false, "assignAutomerge": false},
"labels": ["WG: infra", "WG: performance"],
"automerge": true,
"assignAutomerge": true
"rebaseWhen": "never",
"automerge": true
},
{
"groupName": "esbuild devDependencies",
"matchFiles": ["package.json"],
"matchPackagePatterns": ["\\besbuild\\b"],
"labels": ["WG: infra", "WG: performance"],
"automerge": true,
"assignAutomerge": true
"rebaseWhen": "never",
"automerge": true
},
{
"groupName": "ampproject devDependencies",
"matchFiles": ["package.json"],
"matchPackagePatterns": ["^@ampproject/"],
"matchDepTypes": ["devDependencies"],
"labels": ["WG: bento", "WG: components", "WG: performance"],
"automerge": true,
"assignAutomerge": true
"rebaseWhen": "never",
"automerge": true
},
{
"groupName": "ampproject dependencies",
"matchFiles": ["package.json"],
"matchPackagePatterns": ["^@ampproject/"],
"matchDepTypes": ["dependencies"],
"labels": ["WG: bento", "WG: components", "WG: performance"],
"automerge": false,
"assignAutomerge": false
"rebaseWhen": "never",
"automerge": false
},
{
"groupName": "core dependencies",
"matchFiles": ["package.json"],
"excludePackagePatterns": ["^@ampproject/"],
"matchDepTypes": ["dependencies"],
"labels": ["WG: bento", "WG: components", "WG: performance"],
"automerge": false,
"assignAutomerge": false
"rebaseWhen": "never",
"automerge": false
}
]
}
2 changes: 1 addition & 1 deletion OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
{
// Locked down to minimize new import aliases being added
pattern: 'jsconfig.json',
pattern: 'tsconfig.json',
owners: [{name: 'ampproject/wg-performance', required: true}],
},
],
Expand Down
2 changes: 1 addition & 1 deletion ads/google/a4a/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {MockA4AImpl} from '../../../../extensions/amp-a4a/0.1/test/utils';
import {Services} from '#service';
import {buildUrl} from '#ads/google/a4a/shared/url-builder';
import {createElementWithAttributes} from '#core/dom';
import {createIframePromise} from '../../../../testing/iframe';
import {createIframePromise} from '#testing/iframe';
import {installDocService} from '#service/ampdoc-impl';
import {installExtensionsService} from '#service/extensions-impl';
import {installXhrService} from '#service/xhr-impl';
Expand Down
39 changes: 27 additions & 12 deletions ads/google/ima/ima-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,9 @@ function renderElements(elementOrDoc) {
</div>
</div>
<div ref="time">
<!-- Text content must match format in updateTime(). -->
-:- / 0:00
</div>
<div ref="time">-:-</div>
<div ref="progress">
<div ref="progress" hidden>
<div ref="progressLine"></div>
<div ref="progressMarker"></div>
</div>
Expand Down Expand Up @@ -949,14 +946,35 @@ function playerDataTick() {
*/
export function updateTime(currentTime, duration) {
const {
'progress': progress,
'progressLine': progressLine,
'progressMarker': progressMarker,
'time': time,
} = elements;
time.textContent = formatTime(currentTime) + ' / ' + formatTime(duration);
const progressPercent = Math.floor((currentTime / duration) * 100);
setStyle(progressLine, 'width', progressPercent + '%');
setStyle(progressMarker, 'left', progressPercent - 1 + '%');

// https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/duration
const isLivestream = duration === Infinity;

// Progress bar should not be displayed on livestreams.
// TODO(alanorozco): This is likely handled by native controls, so we wouldn't
// need this clause if we switch. https://go.amp.dev/issue/8841
if (progress.hasAttribute('hidden') !== isLivestream) {
toggle(progress, !isLivestream);
progress.setAttribute('aria-hidden', String(isLivestream));
}

// TODO(alanorozco): Consider adding a label for livestreams to display next
// to the current time.
const currentTimeFormatted = formatTime(currentTime);
time.textContent = isLivestream
? currentTimeFormatted
: `${currentTimeFormatted} / ${formatTime(duration)}`;

if (!isLivestream) {
const progressPercent = Math.floor((currentTime / duration) * 100);
setStyle(progressLine, 'width', progressPercent + '%');
setStyle(progressMarker, 'left', progressPercent - 1 + '%');
}
}

/**
Expand Down Expand Up @@ -1452,9 +1470,6 @@ export function getPropertiesForTesting() {
playPauseDiv: elements['playButton'],
countdownDiv: elements['countdown'],
timeDiv: elements['time'],
progressBarWrapper: elements['progress'],
progressLine: elements['progressLine'],
progressMarkerDiv: elements['progressMarker'],
muteUnmuteDiv: elements['muteButton'],
fullscreenDiv: elements['fullscreenButton'],
bigPlayDiv: elements['overlayButton'],
Expand Down
16 changes: 8 additions & 8 deletions build-system/babel-config/import-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
const fs = require('fs');
const path = require('path');

const JSCONFIG_PATH = path.join(__dirname, '..', '..', 'jsconfig.json');
let jsConfigPaths = null;
const TSCONFIG_PATH = path.join(__dirname, '..', '..', 'tsconfig.json');
let tsConfigPaths = null;

/**
* Reads import paths from jsconfig.json. This file is used by VSCode for
* Reads import paths from tsconfig.json. This file is used by VSCode for
* Intellisense/auto-import. Rather than duplicate and require updating both
* files, we can read from it directly. JSConfig format looks like:
* { compilerOptions: { paths: {
Expand All @@ -38,20 +38,20 @@ let jsConfigPaths = null;
* @return {!Object<string, string>}
*/
function readJsconfigPaths() {
if (!jsConfigPaths) {
const jsConfig = JSON.parse(fs.readFileSync(JSCONFIG_PATH, 'utf8'));
const aliasPaths = jsConfig.compilerOptions.paths;
if (!tsConfigPaths) {
const tsConfig = JSON.parse(fs.readFileSync(TSCONFIG_PATH, 'utf8'));
const aliasPaths = tsConfig.compilerOptions.paths;

const stripSuffix = (s) => s.replace(/\/\*$/, '');
const aliases = Object.entries(aliasPaths).map(([alias, [dest]]) => [
stripSuffix(alias),
stripSuffix(dest),
]);

jsConfigPaths = Object.fromEntries(aliases);
tsConfigPaths = Object.fromEntries(aliases);
}

return jsConfigPaths;
return tsConfigPaths;
}

/**
Expand Down
1 change: 1 addition & 0 deletions build-system/compile/bundles.config.extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,7 @@
"latestVersion": "0.1",
"options": {
"hasCss": true,
"npm": true,
"wrapper": "bento"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import {BaseElement} from './base-element';
__css_import__;
import {dict} from '../../../src/core/types/object';
import {isExperimentOn} from '../../../src/experiments';
import {dict} from '#core/types/object';
import {isExperimentOn} from '#experiments';
import {userAssert} from '../../../src/log';

/** @const {string} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

__jss_import_component_css__;
import {__component_name_pascalcase__} from './component';
import {PreactBaseElement} from '../../../src/preact/base-element';
import {PreactBaseElement} from '#preact/base-element';

export class BaseElement extends PreactBaseElement {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
* limitations under the License.
*/

import * as Preact from '../../../src/preact';
import {ContainWrapper} from '../../../src/preact/component';
import * as Preact from '#preact';
import {ContainWrapper} from '#preact/component';
import {
useCallback,
useEffect,
useLayoutEffect,
useMemo,
useRef,
useState,
} from '../../../src/preact';
} from '#preact';
__jss_import_use_styles__;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import * as Preact from '../../../../src/preact';
import * as Preact from '#preact';
import {__component_name_pascalcase__} from '../component'
import {withKnobs} from '@storybook/addon-knobs';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import '../amp-__component_name_hyphenated__';
import {htmlFor} from '../../../../src/core/dom/static-template';
import {toggleExperiment} from '../../../../src/experiments';
import {htmlFor} from '#core/dom/static-template';
import {toggleExperiment} from '#experiments';
import {waitFor} from '../../../../testing/test-helper';

describes.realWin(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/

__css_import__;
import {Layout} from '../../../src/core/dom/layout';
import {Layout, applyFillContent} from '#core/dom/layout';

const TAG = 'amp-__component_name_hyphenated__';

export class Amp__component_name_pascalcase__ extends AMP.BaseElement {
/** @param {!AmpElement} element */
constructor(element) {
Expand All @@ -37,7 +37,7 @@ export class Amp__component_name_pascalcase__ extends AMP.BaseElement {
this.container_ = this.element.ownerDocument.createElement('div');
this.container_.textContent = this.myText_;
this.element.appendChild(this.container_);
this.applyFillContent(this.container_, /* replacedContent */ true);
applyFillContent(this.container_, /* replacedContent */ true);
}

/** @override */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import '../amp-__component_name_hyphenated__';
import {htmlFor} from '../../../../src/core/dom/static-template';
import {htmlFor} from '#core/dom/static-template';

describes.realWin(
'amp-__component_name_hyphenated__-v__component_version__',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import * as Preact from '../../../../src/preact';
import * as Preact from '#src/preact';
import {withAmp} from '@ampproject/storybook-addon';
import {withKnobs} from '@storybook/addon-knobs';

Expand Down
15 changes: 14 additions & 1 deletion build-system/tasks/validate-html-fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,20 @@ async function runCheck(filesToCheck) {
}
}
if (foundValidationErrors) {
throw new Error('Please address the errors listed above.');
log('Please address the errors listed above.');
log(
'⤷ If a failing fixture is a',
cyan('Bento'),
'document, it is not meant to be valid AMP.'
);
log(
'⤷ Place it under any directory named',
cyan('bento'),
'like',
cyan('examples/bento/'),
'so that it is not validated.'
);
throw new Error('Validation failed.');
}
log(green('SUCCESS:'), 'All HTML fixtures are valid.');
}
Expand Down
Loading

0 comments on commit 184ccf3

Please sign in to comment.