-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
amp-date-picker: restore rrule support #28887
Conversation
One thing to consider here: I believe the original motivation for putting |
After testing, I've learned that the esm version of rrule adds Testing this out now here jkbrzt/rrule#410 |
3f1c0c6
to
aa04c4c
Compare
Sorry about the late reply. My preference is to patch If you check in a copy to |
Oh no, while this works in uncompiled mode (browserify), when its compiled (cc) I get errors that I haven't been able to debug: Also, @rsimha, re the second point:
This is still suboptimal because an |
Yeah. Hopefully your patch is targeted enough that it will always work. Perhaps you could make the replacement optional and print a non-blocking warning if it's missing, so that if a future version stops importing Edit: I should mention this is why we have Renovate. All subsequent |
I'm not sure this makes sense considering we run Separately, something interesting I ran in to is that browserify and cc seem to deal with es6 imports of cjs modules differently. Namely that CC pretends everything is a default import, whereas browserify is flattened one level. So this is valid in cc: import * as rrule from 'rrule'
const rrulestr = rrule.default.rrulestr; And this is a working representation in browserify: import * as rrule from 'rrule'
const rrulestr = rrule.rrulestr; |
This reverts commit 11e9de2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -42,6 +42,7 @@ const COMMON_GLOBS = [ | |||
'node_modules/intersection-observer/intersection-observer.install.js', | |||
'node_modules/promise-pjs/package.json', | |||
'node_modules/promise-pjs/promise.mjs', | |||
'node_modules/rrule/dist/es5/rrule.min.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 🔥 🔥
import {requireExternal} from '../../../src/module'; | ||
|
||
const rrulestr = rrule.default.rrulestr || rrule.rrulestr; // CC imports into .default, browserify flattens a layer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Please move this into tryParseRrulestr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes more sense where it is, considering ideally it would even be import {rrulestr} from 'rrule';
. We can discuss and i'd be happy to move it in a teeny future PR if it makes the most sense / I misunderstood the reasoning
sidebar: i realized that |
summary
Reverts #25230, fixes #24682 and #25244. This PR replaces #28842.
We need
rrule
in order to support a couple of features within amp-date-picker.rrule
imports luxon which has circular deps which breaks Google Closure Compiler.Even though
luxon
is marked as an optional dependency of rrule within its package.json, it statically imports luxon making it essentially required. If Closure Compiler had the same notion of "externals" that webpack has we could potentially get around it by declaring luxon as external.short term fix: patch
datewithzone.js
within node_modules.long term fix: find a better solution: e.g. a timezone-less esm output target for rrule.
rrule in action
cc @caroqliu