This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* eslint-enable no-param-reassign */ | |
| function genId() { | |
| const num = uuid(); | |
| return `graphql__${num}`; | |
| } | |
| function uuid() { | |
| return 'xxxxxxxx'.replace(/[xy]/g, function (c) { | |
| var r = (Math.random() * 16) | 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ReactDOMServer doesn't currently support React.Suspense which is a problem for us | |
| // as Next.js uses ReactDOMServer. So by us using components/Suspense instead of React.Suspense | |
| // we can work around this limitation by just returning the fallback instead of the Suspense boundary | |
| import { Suspense } from 'react'; | |
| import { isBrowserEnvironment } from 'utils/constants'; | |
| function LatticeSuspense(props: React.SuspenseProps): JSX.Element { | |
| if (typeof props.fallback === 'undefined') { | |
| throw new Error('LatticeSuspense requires fallback prop!'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /test-page | |
| Before: 1.9mb | |
| After: 345kb | |
| _app | |
| Before: 4.0mb | |
| After: 3.0mb | |
| Savings: 1.0mb | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/node_modules/date-fns-tz/esm/.DS_Store b/node_modules/date-fns-tz/esm/.DS_Store | |
| new file mode 100644 | |
| index 0000000..e69de29 | |
| diff --git a/node_modules/date-fns-tz/esm/_lib/tzIntlTimeZoneName/index.js b/node_modules/date-fns-tz/esm/_lib/tzIntlTimeZoneName/index.mjs | |
| similarity index 100% | |
| rename from node_modules/date-fns-tz/esm/_lib/tzIntlTimeZoneName/index.js | |
| rename to node_modules/date-fns-tz/esm/_lib/tzIntlTimeZoneName/index.mjs | |
| diff --git a/node_modules/date-fns-tz/esm/_lib/tzParseTimezone/index.js b/node_modules/date-fns-tz/esm/_lib/tzParseTimezone/index.mjs | |
| similarity index 98% | |
| rename from node_modules/date-fns-tz/esm/_lib/tzParseTimezone/index.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/node_modules/date-fns/esm/_lib/addLeadingZeros/index.js b/node_modules/date-fns/esm/_lib/addLeadingZeros/index.mjs | |
| similarity index 100% | |
| rename from node_modules/date-fns/esm/_lib/addLeadingZeros/index.js | |
| rename to node_modules/date-fns/esm/_lib/addLeadingZeros/index.mjs | |
| diff --git a/node_modules/date-fns/esm/_lib/assign/index.js b/node_modules/date-fns/esm/_lib/assign/index.mjs | |
| similarity index 100% | |
| rename from node_modules/date-fns/esm/_lib/assign/index.js | |
| rename to node_modules/date-fns/esm/_lib/assign/index.mjs | |
| diff --git a/node_modules/date-fns/esm/_lib/cloneObject/index.js b/node_modules/date-fns/esm/_lib/cloneObject/index.mjs | |
| similarity index 100% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ..... | |
| // we're using normalizeNode to automatically detect/insert links as the user types | |
| editor.normalizeNode = entry => { | |
| const [node, path] = entry; | |
| // because normalizeNode is recursive, we need to guard against two cases. | |
| // 1. Ensure we're operating on a leaf node (Text.isText) | |
| // 2. Ensure that our parent isn't a link. (Otherwise this function is called infinite times) | |
| const isText = Text.isText(node); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function plugin(settings = {}) { | |
| this.Compiler = compiler; | |
| function compiler(node) { | |
| return node.children.map(markdownToSlate); | |
| } | |
| } | |
| function markdownToSlate(node) { | |
| let children = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function parseToMarkdown(chunk) { | |
| let children = !chunk.type | |
| ? chunk.text | |
| : chunk.children.map(c => parseToMarkdown({ ...c, parentType: chunk.type })).join(''); | |
| if (children === '') return; | |
| // formatting | |
| if (chunk.bold) { | |
| children = `**${children.trim()}** `; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const parseGitLog = require('parse-git-log'); | |
| const isBefore = require('date-fns/isBefore'); | |
| const subBusinessDays = require('date-fns/subBusinessDays'); | |
| const parseISO = require('date-fns/parseISO'); | |
| const twoWeeksAgo = subBusinessDays(new Date(), 10); | |
| const commits = []; | |
| parseGitLog() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useLazyLoadQuery, graphql } from "react-relay/hooks"; | |
| import Link from "next/link"; | |
| import { PersonalPageQueryResponse } from "../__generated__/PersonalPageQuery.graphql"; | |
| export default function PersonalPage() { | |
| const data = useLazyLoadQuery<PersonalPageQueryResponse>( | |
| graphql` | |
| query PersonalPageQuery { | |
| viewer { | |
| user { |