Commit graph

47 commits

Author SHA1 Message Date
Joe Haddad
c731d59149
Fix AMP Test Flake (#13450)
Observed here: https://github.com/zeit/next.js/pull/13434#issuecomment-634566450
2020-05-27 16:28:43 +00:00
Joe Haddad
86160a5190
Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
Jan Potoms
714747957a
Add eslint-plugin-jest (#13003) 2020-05-18 13:16:07 -04:00
Jan Potoms
32057c849d
Use the jest-circus test runner (#12974) 2020-05-16 16:56:06 -04:00
Joe Haddad
ae1daea355
Enable Fast Refresh by Default (#12640) 2020-05-10 19:25:57 -04:00
JJ Kasper
5d13e55a4a
Ensure modern AMP client page bundles are removed (#12138) 2020-04-23 21:16:35 +02:00
JJ Kasper
fa167e3346
Update to latest version of AMP optimizer (#11753)
* Update to latest version of AMP optimizer

* Update test

* Update another test

* Update another test
2020-04-09 10:23:31 +02:00
JJ Kasper
d61eced9a6
Update to make sure AMP only bundles are always removed in pro… (#11527) 2020-04-01 10:24:44 +02:00
Sebastian Benz
ae9b13e0be
Migrate to AMP Optimizer 2.0 (#10535)
* Migrate to AMP Optimizer 2.0

Most notable changes:

* Automatically import all missing AMP component scripts.
* Automatically add any missing mandatary AMP tags.
* 40% faster

I've updated the docs to mention component auto import and added a corresponding
test case.

* change validator tests which now pass validation

* Improve wording

Co-Authored-By: JJ Kasper <jj@jjsweb.site>

* Update adding-amp-components.md

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-14 16:01:43 -05:00
JJ Kasper
fd95d6c8bc
Fix AMP HMR for child components (#9736) 2019-12-16 11:45:48 -06:00
JJ Kasper
87d9b2e03e
Add tests ensuring auto-exported amphtml rel is valid (#9762) 2019-12-16 11:32:35 -06:00
JJ Kasper
409f20a9ca
Fix AMP HTML content emit (#9468)
* Add failing test

* Escape dollar signs in AMP HTML

* Update to not use replace for updating AMP_RENDER_TARGET
2019-11-25 14:05:52 -06:00
Joe Haddad
18a9c7e371
Improve linting rules to catch more errors (#9374)
* Update `packages/`

* Update examples

* Update tests

* Update bench

* Update top level files

* Fix build

* trigger
2019-11-10 19:24:53 -08:00
Joe Haddad
636be2466e
Add test for #8924 (#9243)
This adds a test for PR #8924.
2019-10-30 00:01:56 -04:00
Joe Haddad
e42fdd824a
Reenable AMP Tests (#9162) 2019-10-23 16:05:57 -04:00
Joe Haddad
ae3410c3f3
Upgrade Lockfile (#9158)
* Upgrade Lockfile

* Fix types version mismatch

* Upgrade amphtml-validator

* Revert "Upgrade amphtml-validator"

This reverts commit 05068b2ad9f2f53429cf514b47b4f7924b0b9623.

* Disable AMP Tests

* Skip 2x more AMP tests
2019-10-22 11:42:43 -04:00
Liran Cohen
b7efb3fffb Allow manually setting amphtml (#9098)
* allow to remove amphtml from desktop page

* only 1 link with amphtml rel

* clean up

* remove checkup for amphtml link

* Dedupe looping
2019-10-18 10:22:53 -05:00
JJ Kasper
fbf784d76f Add data-ampdevmode attribute for AMP scripts (#8524)
* Add data-ampdevmode attribute

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>
2019-09-03 11:11:22 -04:00
JJ Kasper
4bcf6aabe7 Allow manually setting amphtml and canonical links (#8129) 2019-07-29 08:18:23 +01:00
Joe Haddad
3aed76fad8
Unflag Automatic Prerendering (#7666)
* Unflag Dynamic Routing

* Unflag Automatic Prerendering

* Ensure pages are lambdas for test

* Fix file check

* Fix tests

* oof

* Use lambda for document middleware test
2019-06-28 16:01:11 -04:00
JJ Kasper
fa45fa0a60
Add export const config support and make withAmp a no-op (#7525)
* Add export const config support and make withAmp a no-op

* Use babel plugin for PageConfig

* Fix serverless-loader exports

* Add backwards compatibility for withAmp
2019-06-09 17:16:14 -07:00
JJ Kasper
03d589349a
Render valid optimized AMP by default (#7465)
* Upgrade to latest AMP toolbox optimizer

* Remove amphtml from AMP only and update tests

* Update tests

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <timer150@gmail.com>
2019-05-29 19:53:41 -07:00
Joe Haddad
b3170d2648
Format missed files (#7464)
* Format missed files

* Remove unnecessary rule

* Fix type error
2019-05-29 18:19:32 -07:00
JJ Kasper
24034ec957 Add amp.canonicalBase option to set absolute URL (#7262)
* Add canonicalBase config to allow setting
absolute path for canonical link

* Make sure canonicalBase is set for
export and serverless

* Move canonicalBase to amp.canonicalBase

* Update tests with canonicalBase config

* Update tests

* run lint-fix

* Fix canonicalBase config parsing

* Fix canonicalBase during export

* Update amphtml tests
2019-05-28 17:32:17 -07:00
JJ Kasper
cdd54afb0d Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps

* Add support for exporting serverless to static
and serving the html files during next start

* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests

* Update flying-shuttle test

* revert un-used pagesManifest change

* remove query.amp RegExp test

* Fix windows backslashes not being replaced

* Re-enable serverless support for next start

* bump

* Fix getInitialProps check

* Fix incorrect error check

* Re-add check for reserved pages

* Fix static check

* Update to ignore /api pages and clean up some tests

* Re-add needed next.config for test and correct behavior

* Update RegExp for ignored pages for auto-static

* Add checking for custom getInitialProps in pages/_app

* Update isPageStatic logic to only use default export

* Re-add retrying to CircleCi

* Update query during dev to only have values
available during export for static pages

* Fix test

* Add warning when page without default export is
found and make sure to update pages-manifest
correctly in flying-shuttle mode

* Fix backslashes not being replaced

* Integrate auto-static with flying-shuttle
and make sure AMP is handled in flying-shuttle

* Add autoExport for opting in
2019-05-22 09:36:53 -07:00
JJ Kasper
dc47c607d7
Make sure to 404 for AMP client bundles in dev mode (#7183)
* Make sure to 404 for AMP bundle in dev mode

* Add test for non-AMP to AMP navigating in dev mode
2019-04-28 13:08:38 -05:00
JJ Kasper
80210bc31a Update removing AMP pages to not require during build (#7081)
* Update to use babel plugin with webpack plugin to
remove AMP client bundles since they are not used

* Remove acorn dependency since it isn't used
2019-04-22 06:25:17 +09:00
JJ Kasper
fdfbab5d25 Updated handling of AMP page reloading (#7052) 2019-04-16 18:04:41 -05:00
JJ Kasper
75a2c45f6a AMP fix escaped rel (#7045)
if `&amp=1` is used to point to the `amphtml` version of a page it get's escaped causing it to become `&amp;amp=1` this fixes it to stay as `&amp=1`

Closes: #7038
2019-04-16 22:57:17 +09:00
JJ Kasper
11016221cd
Make sure AmpContext is available in _document (#7021)
* Make sure AmpContext is available during _document
render and update filtering of script tags in AMP mode

* Update amphtml test to make sure
AmpContext is set for _document render

* Fix stray comma in render.tsx
2019-04-12 19:04:52 -05:00
JJ Kasper
e5111745b5
Replace .amp.js with withAmp(Comp) (#7009)
* Add WithAmp to enable AMP support for
pages instead of .amp.js

* Update handling for exporting AMP

* Fix ampPath in export for / path and
revert isAmp logic to handle right

* Update amphtml test suite

* Add handling for noDirtyAmp during
export and update amp-export test suite

* Update serverless and export-default-map
test suites

* Update require-page tests
2019-04-11 13:59:26 -05:00
JJ Kasper
aac50e4501
Add error message for AMP bind syntax (#6865)
* Add error message for AMP bind syntax

* Fix custom AMP scripts getting dropped

* Add data.js to package.json to include it
in releases
2019-04-02 17:32:07 -05:00
JJ Kasper
6344c5f0c1
Add optimizing AMP pages (#6835)
* Added amp-toolbox-optimizer and added
optimizing AMP pages as dirty and clean

* Fix amp-optimizer breaking serverless build

* Exclude amp-toolbox-optimizer from serverless build

* Added check to make sure hybrid AMP pages
optimize cleanly during export

* Add check to make sure noDirtyAmp is applied
2019-04-02 13:01:34 -05:00
JJ Kasper
14eef58702 Re-add chromedriver retrying from previous webdriver setup (#6846)
* Re-add previous webdriver setup with falling
back to BrowserStack setup

* Add missing webdriver imports
2019-04-01 16:09:09 +02:00
JJ Kasper
26a4eb827c Add dropping of custom scripts in AMP mode (#6830)
Drops user `<script>` tags and shows a warning in AMP mode. Right now they are only dropped in production mode and left in dev mode so the validator shows its warning since it looks like conflicting props log messages are being cleared causing them to not show. 

Closes: #6688
2019-03-29 17:20:12 +01:00
JJ Kasper
533018f7d0 Update tests for BrowserStack (#6810)
Update tests to setup webdriver stuff in `jest-environment` and re-use one browser session instead of spawning one for each webdriver call to prevent creating too many BrowserStack sessions.
2019-03-29 16:05:53 +01:00
Joe Haddad
31f6f4c606
Ensure browser gets closed during testing (#6724)
* Ensure browser gets closed during testing

* Remove fit
2019-03-19 18:03:50 -04:00
JJ Kasper
bce75ae9c3
Add checking for corresponding pages for link tags (#6719) 2019-03-19 14:01:42 -05:00
JJ Kasper
12cbb934b3 Add support for creating AMP pages (#6706)
* Add support for .amp.js pages and
resolving /page?amp=1 to page.amp.js

* Update amp tests

* Update example and clean up amp page resolving

* Add nested amp test

* page => normalizedPage

* Add type to page options

* Add handling of amp with all pageExtensions
and normalize page

* Make sure findPageFile only falls back to
amp if enabled
2019-03-18 23:24:21 -04:00
JJ Kasper
2d6a73cb66 Remove conflicting <head> tags in amp mode (#6693) 2019-03-18 12:29:31 +01:00
JJ Kasper
69b53bfc81 Remove sourceMaps from amp styles to not go over limit (#6674)
* Remove sourceMaps from amp styles to not go over limit

* Add test to make sure style sourceMaps
are removed in amp
2019-03-15 14:53:02 -04:00
Joe Haddad
330bedacc7 Add Babel plugin that fixes className for Amp elements (#6486)
This is a simple Babel plugin that overwrites certain attributes for `amp-` elements.
2019-02-28 23:04:29 +01:00
Joe Haddad
f15cfeba0a
AMP automatic page refreshing in dev (#6392)
* AMP page reload

* Fix comment

* Skip dev files in production

* Polyfill event source

* Add HMR test for AMP

* Use webdriver

* Use a dynamic server for HMR test

* ffs
2019-02-25 17:00:14 -05:00
Connor Davis
fcf1167cd4 Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12
2019-02-19 22:45:07 +01:00
Joe Haddad
ee18967dfc Add tests for AMP style tags (#6355)
Relevant commit: f913aabe16

~~I needed to upgrade Standard to work with JSX fragment syntax.~~ This caused too much noise so I just stopped using Fragments.
2019-02-19 16:37:19 +01:00
Joe Haddad
6dfcacb7bf
Use a query parameter for AMP pages instead of new route (#6336)
Per consensus in a mixed-application scenario, we'll use the `amp` query parameter convention.
2019-02-18 09:44:21 -05:00
Tim Neutkens
4051ffcb01 [experimental] Rendering to AMP (#6218)
* Add initial AMP implementation

* Implement experimental feature flag

* Implement feedback from sbenz

* Add next/amp and `useAmp` hook

* Use /:path*/amp instead

* Add canonical

* Add amphtml tag

* Add ampEnabled for rel=“amphtml”

* Remove extra type
2019-02-14 10:22:57 -05:00