Skip to content

Commit 78c46ce

Browse files
committed
ups
1 parent 04bfc23 commit 78c46ce

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/cache.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
*
77
* @see https://github.com/babel/babel-loader/
88
*/
9-
import * as fs from "fs"
10-
import * as os from "os"
11-
import * as path from "path"
12-
import * as zlib from "zlib"
13-
import * as crypto from "crypto"
14-
import * as findCacheDir from "find-cache-dir"
15-
import * as makeDir from "make-dir"
16-
import { promisify } from "util"
17-
import { CacheOptions, TransformParams } from "./types"
18-
import { transform } from "."
9+
import * as fs from 'fs'
10+
import * as os from 'os'
11+
import * as path from 'path'
12+
import * as zlib from 'zlib'
13+
import * as crypto from 'crypto'
14+
import * as findCacheDir from 'find-cache-dir'
15+
import * as makeDir from 'make-dir'
16+
import { promisify } from 'util'
17+
import { CacheOptions, TransformParams } from './types'
18+
import { transform } from '.'
1919

2020
// Lazily instantiated when needed
2121
let defaultCacheDirectory: string | null = null
@@ -33,7 +33,7 @@ const gzip = promisify(zlib.gzip)
3333
* @params {Boolean} compress
3434
*/
3535
const read = async function (filename: string, compress: boolean) {
36-
const data = await readFile(filename + (compress ? ".gz" : ""))
36+
const data = await readFile(filename + (compress ? '.gz' : ''))
3737
const content = compress ? await gunzip(data) : data
3838

3939
return JSON.parse(content.toString())
@@ -51,7 +51,7 @@ const write = async function (filename: string, compress: boolean, result: strin
5151
const content = JSON.stringify(result)
5252

5353
const data = compress ? await gzip(content) : content
54-
return await writeFile(filename + (compress ? ".gz" : ""), data)
54+
return await writeFile(filename + (compress ? '.gz' : ''), data)
5555
}
5656

5757
/**
@@ -63,13 +63,13 @@ const write = async function (filename: string, compress: boolean, result: strin
6363
* @return {String}
6464
*/
6565
const filename = function (source: string, identifier: string) {
66-
const hash = crypto.createHash("md4")
66+
const hash = crypto.createHash('md4')
6767

6868
const contents = JSON.stringify({ source, identifier })
6969

7070
hash.update(contents)
7171

72-
return hash.digest("hex") + ".json"
72+
return hash.digest('hex') + '.json'
7373
}
7474

7575
/**
@@ -95,7 +95,7 @@ const handleCache = async function (
9595
// continue regardless of error
9696
}
9797

98-
const fallback = typeof cacheDirectory !== "string" && directory !== os.tmpdir()
98+
const fallback = typeof cacheDirectory !== 'string' && directory !== os.tmpdir()
9999

100100
// Make sure the directory exists.
101101
try {
@@ -138,11 +138,11 @@ const handleCache = async function (
138138
export async function cache(cacheOptions: CacheOptions, transformParams: TransformParams): Promise<string> {
139139
let directory
140140

141-
if (typeof cacheOptions.cacheDirectory === "string") {
141+
if (typeof cacheOptions.cacheDirectory === 'string') {
142142
directory = cacheOptions.cacheDirectory
143143
} else {
144144
if (defaultCacheDirectory === null) {
145-
defaultCacheDirectory = findCacheDir({ name: "responsive-loader" }) || os.tmpdir()
145+
defaultCacheDirectory = findCacheDir({ name: 'responsive-loader' }) || os.tmpdir()
146146
}
147147

148148
directory = defaultCacheDirectory

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ async function orchestrate(params: OrchestrateParams) {
146146
}
147147

148148
// Transform based on the parameters
149-
async function transform({
149+
export async function transform({
150150
adapterModule,
151151
resourcePath,
152152
createFile,

0 commit comments

Comments
 (0)