This file contains 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
#!/bin/bash | |
unset AWS_ACCESS_KEY_ID | |
unset AWS_SECRET_ACCESS_KEY | |
unset AWS_SESSION_TOKEN | |
mkdir -p '/tmp/app/.next/server/pages' | |
echo '[x-amplify-log][INFO] starting copy' | |
cp -r '/var/task/.next/server/pages' '/tmp/app/.next/server' | |
echo '[x-amplify-log][INFO] copy server pages complete' | |
cp -f /var/task/server.js /tmp/app/server.js | |
echo '[x-amplify-log][INFO] copy complete' |
先週に同僚と会話していたときに気になっていた Experimental Test Proxy について。
mugi さんの素振りメモ や この機能が実装された際の PR のコードを読んで、ようやく何が行われているかを理解した。
まず、README にある以下のコードがどこをスタブしているかであるが、
import { test, expect } from "next/experimental/testmode/playwright";
This file contains 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 { cache } from "react"; | |
import DataLoader from "dataloader"; | |
// backend service clients | |
import { getPopularPosts, getUserById, getUsers } from "@/services"; | |
const memoizedGetUserById = cache(getUserById); | |
const getUserLoader = () => |
Relay や Apollo のスタンス:
- Performance 都合のみであれば、Document Cache でも十分。
- Cached Data の一貫性を保持することを考えると、Document Cache では不十分であり、正規化が必要
https://relay.dev/docs/principles-and-architecture/thinking-in-graphql/#client-caching
This file contains 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 assert from "assert"; | |
import { parse, print, DocumentNode, visit } from "graphql"; | |
function removeUnusedFragment(document: DocumentNode) { | |
const usedFragmentSet = new Set<string>(); | |
// mark used | |
visit(document, { | |
FragmentSpread(node) { | |
usedFragmentSet.add(node.name.value); |
https://devblogs.microsoft.com/typescript/announcing-typescript-4-2/
下記のように、Rest Elements が tuple の最初でなくても使えるようになっています。
This file contains 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
/** | |
* | |
* Mini calc with TypeScript template string types | |
* | |
* EBNF | |
* | |
* ``` | |
* expr = mul ("+" mul)* | |
* mul = primary ("*" primary)* | |
* primary = num | "(" expr ")" |
- Facebookが開発した クエリ言語
- 今はGraphQL Foundationに移管されている
This file contains 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 { Rule } from "eslint"; | |
const rule: Rule.RuleModule = { | |
create: (context) => { | |
return { | |
['NewExpression:not(:has(*.arguments)) > Identifier[name="Date"], CallExpression > MemberExpression:has(Identifier.object[name="Date"]) > Identifier.property[name="now"]']: (node: any) => { | |
context.report({ | |
message: "Don't use side-effective Date function.", | |
node, | |
}); |
NewerOlder