Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
Additional pure annotations for Rollup tree shaking #101
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmayer committed Jun 6, 2021
1 parent 9699c65 commit f99f1d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ class EventSingleton extends Event {
singleton: false
}) {
if(singleton) {
return new EventSingleton({
return /*@__PURE__*/new EventSingleton({
name,
addListenerCallback,
removeListenerCallback,
notifyListenersCallback
});
}
return new Event({
return /*@__PURE__*/new Event({
name,
addListenerCallback,
removeListenerCallback,
Expand Down
8 changes: 4 additions & 4 deletions src/linkResolution.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ import linkResolutionGoogleNewsContentScript from "include:./content-scripts/lin
* @see {@link https://amp.dev/documentation/guides-and-tutorials/learn/amp-caches-and-cors/amp-cache-urls/}
* @constant {RegExp}
*/
export const ampRegExp = new RegExp(
export const ampRegExp = /*@__PURE__*/(() => new RegExp(
// AMP cache regular expression
`(?:^https?://(?:(?<ampCacheSubdomain>[a-zA-Z0-9\\-\\.]*)\\.)?(?<ampCacheDomain>${ampCacheDomains.map(matching.escapeRegExpString).join("|")})/(?<ampCacheContentType>c|i|r)/(?<ampCacheIsSecure>s/)?(?<ampCacheUrl>.*)$)`
+ `|` +
// AMP viewer regular expression
`(?:^https?://(?<ampViewerDomainAndPath>${ampViewerDomainsAndPaths.map(matching.escapeRegExpString).join("|")})/(?<ampViewerUrl>.*)$)`
, "i");
, "i"))();

/**
* A MatchPatternSet for AMP caches and viewers.
* @constant {matching.MatchPatternSet}
*/
export const ampMatchPatternSet = matching.createMatchPatternSet(
export const ampMatchPatternSet = /*@__PURE__*/(() => matching.createMatchPatternSet(
matching.domainsToMatchPatterns(ampCacheDomains, false).concat(
ampViewerDomainsAndPaths.map(ampViewerDomainAndPath => `*://${ampViewerDomainAndPath}*`)));
ampViewerDomainsAndPaths.map(ampViewerDomainAndPath => `*://${ampViewerDomainAndPath}*`))))();

/**
* Parse the underlying URL from an AMP cache or viewer URL, if the URL is an AMP cache or viewer URL.
Expand Down

0 comments on commit f99f1d6

Please sign in to comment.