Skip to content

Commit

Permalink
Merge branch 'master' into amp-next-page-v2-infinite-loading
Browse files Browse the repository at this point in the history
  • Loading branch information
wassgha committed Jan 15, 2020
2 parents 81a3e93 + d05f953 commit 63b4407
Show file tree
Hide file tree
Showing 121 changed files with 7,232 additions and 947 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/cherry_pick_template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Cherry-pick template
about: Used to request a cherry-pick. See bit.ly/amp-cherry-pick
about: Used to request a cherry-pick. See go.amp.dev/cherry-picks
title: "\U0001F338 Cherry-pick request for #<ISSUE_NUMBER> into #<RELEASE_ISSUE> (Pending)"
labels: 'Type: Release'
---
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/release-tracking-issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ If you perform cherry picks, add/update the checkboxes above as needed e.g.

See the [release documentation](https://github.com/ampproject/amphtml/blob/master/contributing/release-schedule.md) for more information on the release process, including how to test changes in the Dev Channel.

If you find a bug in this build, please file an [issue](https://github.com/ampproject/amphtml/issues/new). If you believe the bug should be fixed in this build, follow the instructions in the [cherry picks documentation](https://bit.ly/amp-cherry-pick).
If you find a bug in this build, please file an [issue](https://github.com/ampproject/amphtml/issues/new). If you believe the bug should be fixed in this build, follow the instructions in the [cherry picks documentation](https://go.amp.dev/cherry-picks).
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/release_issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ If you perform cherry picks, add/update the checkboxes above as needed e.g.

See the [release documentation](https://github.com/ampproject/amphtml/blob/master/contributing/release-schedule.md) for more information on the release process, including how to test changes in the Dev Channel.

If you find a bug in this build, please file an [issue](https://github.com/ampproject/amphtml/issues/new). If you believe the bug should be fixed in this build, follow the instructions in the [cherry picks documentation](https://bit.ly/amp-cherry-pick).
If you find a bug in this build, please file an [issue](https://github.com/ampproject/amphtml/issues/new). If you believe the bug should be fixed in this build, follow the instructions in the [cherry picks documentation](https://go.amp.dev/cherry-picks).
1 change: 1 addition & 0 deletions .renovaterc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"package.json",
"build-system/tasks/e2e/package.json",
"build-system/tasks/visual-diff/package.json",
"src/purifier/package.json",
"validator/package.json"
]
}
17 changes: 1 addition & 16 deletions ads/readmo.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function readmo(global, data) {

const {section, module, sponsoredByLabel, infinite, title, url} = data;

window.publisherUrl = url;
global.publisherUrl = url;

(global.readmo = global.readmo || []).push({
section,
Expand All @@ -41,21 +41,6 @@ export function readmo(global, data) {
amp: true,
});

global.context.observeIntersection(
entries => {
entries.forEach(entry => {
if (global.Readmo) {
global.Readmo.onViewChange({
intersectionRatio: entry.intersectionRatio,
});
}
});
},
{
threshold: [0, 0.5, 1],
}
);

loadScript(global, 'https://s.yimg.com/dy/ads/readmo.js', () =>
global.context.renderStart()
);
Expand Down
2 changes: 1 addition & 1 deletion ads/readmo.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ReadMo only requires a section code to run. Please work your account manager to
height="400"
type="readmo"
layout="responsive"
data-url="https://yoursite.com"
data-url="https://yourdomain.com"
data-infinite="true"
data-section="1234567"
>
Expand Down
4 changes: 2 additions & 2 deletions build-system/compile/bundles.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ exports.extensionBundles = [
},
{
name: 'amp-date-display',
version: '0.1',
version: ['0.1', '0.2'],
latestVersion: '0.1',
type: TYPES.MISC,
},
Expand Down Expand Up @@ -753,7 +753,7 @@ exports.extensionBundles = [
},
{
name: 'amp-next-page',
version: ['0.1', '0.2'],
version: ['0.1', '1.0'],
latestVersion: '0.1',
options: {hasCss: true},
type: TYPES.MISC,
Expand Down
3 changes: 2 additions & 1 deletion build-system/compile/check-for-unknown-deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

const log = require('fancy-log');
const through = require('through2');
const {red, cyan} = require('ansi-colors');
const {red, cyan, yellow} = require('ansi-colors');

/**
* Searches for the identifier "$$module$", which Closure uses to uniquely
Expand All @@ -44,6 +44,7 @@ exports.checkForUnknownDeps = function() {
red('Error:'),
`Unknown dependency ${cyan(match[0])} found in ${cyan(file.relative)}`
);
log(yellow(contents));
const err = new Error('Compilation failed due to unknown dependency');
err.showStack = false;
cb(err, file);
Expand Down
1 change: 1 addition & 0 deletions build-system/compile/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ function compile(
'third_party/web-animations-externs/web_animations.js',
'third_party/moment/moment.extern.js',
'third_party/react-externs/externs.js',
'build-system/externs/preact.extern.js',
];
const define = [`VERSION=${internalRuntimeVersion}`];
if (argv.pseudo_names) {
Expand Down
4 changes: 4 additions & 0 deletions build-system/compile/sources.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ const COMMON_GLOBS = [
'node_modules/@ampproject/animations/dist/animations.mjs',
'node_modules/@ampproject/worker-dom/package.json',
'node_modules/@ampproject/worker-dom/dist/amp/main.mjs',
'node_modules/preact/package.json',
'node_modules/preact/dist/*.js',
'node_modules/preact/hooks/package.json',
'node_modules/preact/hooks/dist/*.js',
];

/**
Expand Down
30 changes: 26 additions & 4 deletions build-system/eslint-rules/no-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,41 @@
* limitations under the License.
*/
'use strict';
const imports = ['sinon'];

const imports = [
{import: 'sinon', message: 'Importing sinon is forbidden'},
{
import: 'preact',
message:
"Please import preact from 'src/preact'. This gives us type safety.",
},
{
import: 'preact/hooks',
message:
"Please import preact/hooks from 'src/preact'. This gives us type safety.",
},
];

module.exports = function(context) {
return {
ImportDeclaration(node) {
const comments = context.getCommentsBefore(node);
const comments = context.getCommentsBefore(node.source);
const ok = comments.some(comment => comment.value === 'OK');
if (ok) {
return;
}

const name = node.source.value;
if (imports.includes(name)) {
context.report({node, message: `Importing ${name} is forbidden.`});

for (const forbidden of imports) {
if (name !== forbidden.import) {
continue;
}

context.report({
node,
message: forbidden.message,
});
}
},
};
Expand Down
56 changes: 56 additions & 0 deletions build-system/externs/preact.extern.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* Copyright 2020 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/** @externs */

/** @const */
var Preact = {}

/**
* @typedef {function(!JsonObject):Preact.Renderable}
*/
Preact.FunctionalComponent

/**
* @interface
*/
Preact.VNode = function() {}

/**
* @interface
*/
Preact.Context = function() {}

/**
* @param {!JsonObject} props
* @return {Preact.Renderable}
*/
Preact.Context.prototype.Provider = function(props) {};

/**
* @interface
*/
Preact.Context.prototype.Consumer = function() {};

/**
* @typedef {string|number|boolean|null|undefined}
*/
Preact.SimpleRenderable;

/**
* @typedef {Preact.SimpleRenderable|!Preact.VNode|!Array<Preact.SimpleRenderable|!Preact.VNode|!Array<Preact.SimpleRenderable|!Preact.VNode>>}
*/
Preact.Renderable;
2 changes: 1 addition & 1 deletion build-system/tasks/check-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async function checkTypes() {
{
include3pDirectories: true,
includePolyfills: true,
extraGlobs: ['src/inabox/*.js'],
extraGlobs: ['src/inabox/*.js', '!node_modules/preact'],
typeCheckOnly: true,
}
),
Expand Down
Loading

0 comments on commit 63b4407

Please sign in to comment.