Skip to content

✨[amp-story-player] Add support to load documents from the cache#27658

Merged
Enriqe merged 3 commits intoampproject:masterfrom
Enriqe:cache-player
Apr 27, 2020
Merged

✨[amp-story-player] Add support to load documents from the cache#27658
Enriqe merged 3 commits intoampproject:masterfrom
Enriqe:cache-player

Conversation

@Enriqe
Copy link
Copy Markdown
Contributor

@Enriqe Enriqe commented Apr 8, 2020

Closes #27588

@Enriqe Enriqe requested review from gmajoulet and newmuis April 8, 2020 22:06
Copy link
Copy Markdown
Contributor

@kristoferbaxter kristoferbaxter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small items to consider.

Copy link
Copy Markdown
Contributor

@gmajoulet gmajoulet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

if (!SUPPORTED_CACHES.includes(ampCache)) {
throw new Error(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we discuss if we want to fallback on the origin or completely fail?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did discuss and I believe the consensus was that we shouldn't fallback to origin.

/cc @newmuis

Enriqe added 3 commits April 22, 2020 11:01
* updating amp-toolbox for newly introduced servingType support
* updates PR with recent revert from custom elements
Copy link
Copy Markdown
Contributor Author

@Enriqe Enriqe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the PR with the recent changes from moving the code to another directory, adding support in the amp-toolbox package for servingType, etc.. PTAL :)

@Enriqe
Copy link
Copy Markdown
Contributor Author

Enriqe commented Apr 23, 2020

/to @kristoferbaxter for owners approval

@Enriqe
Copy link
Copy Markdown
Contributor Author

Enriqe commented Apr 24, 2020

Friendly ping @kristoferbaxter

@Enriqe Enriqe requested a review from danielrozenberg April 24, 2020 18:09
Copy link
Copy Markdown
Member

@danielrozenberg danielrozenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package.json approval

@Enriqe Enriqe merged commit 6144391 into ampproject:master Apr 27, 2020
ldoroshe pushed a commit to ldoroshe/amphtml that referenced this pull request May 8, 2020
…project#27658)

* load documents from the cache when speciifed by publisher

* get cache options from caches.js, wait for cacheurl promise

* update PR with recent changes:

* updating amp-toolbox for newly introduced servingType support
* updates PR with recent revert from custom elements
* limitations under the License.
*/

import * as ampCaches from '../../build-system/global-configs/caches.json';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importing from build-system isn't supported, because isn't not included as one of our files when we pass them to closure.

Additionally, you can't import JSON like this in real JS, this is a node behavior without real semantics. TC39 is currently discussing JSON imports, but semantics we have will only expose a default export:

import ampCaches from '…/caches.json' with type: 'json';

ampCaches.caches.map()

I'd imagine closure will have undefined semantics for this in the meantime. We'd need to preprocess this file into a JS file during builds, and you can import from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[amp-story-player] Load documents from the cache

7 participants