Skip to content

Commit

Permalink
chore(gatsby): Migrate utils/get-cache.js to ts (#22094)
Browse files Browse the repository at this point in the history
* migrate get-cache.js to ts

* fix using named export
  • Loading branch information
cola119 committed Mar 9, 2020
1 parent 7b1a0cc commit f607506
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const getCache = require(`../get-cache`)
import { getCache } from "../get-cache"

const CACHE_KEY = `__test__`

Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/utils/api-runner-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const reporter = require(`gatsby-cli/lib/reporter`)
const stackTrace = require(`stack-trace`)
const { codeFrameColumns } = require(`@babel/code-frame`)
const fs = require(`fs-extra`)
const getCache = require(`./get-cache`)
const { getCache } = require(`./get-cache`)
const createNodeId = require(`./create-node-id`)
const { createContentDigest } = require(`gatsby-core-utils`)
const {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const Cache = require(`./cache`).default
import Cache from "./cache"

const caches = new Map()
const caches = new Map<string, Cache>()

module.exports = function getCache(name) {
export const getCache = (name: string): Cache => {
let cache = caches.get(name)
if (!cache) {
cache = new Cache({ name }).init()
Expand Down

0 comments on commit f607506

Please sign in to comment.