Skip to content

Commit d601fd2

Browse files
committed
update: build
1 parent 85c0738 commit d601fd2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

dist/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,23 @@ const CORE_RAW_URL = 'https://raw.githubusercontent.com/nodejs/security-wg/main/
6363

6464
let lastETagValue
6565

66-
const coreLocalFile = __nccwpck_require__.ab + "core.json"
67-
const ETagFile = __nccwpck_require__.ab + ".etag"
66+
const coreLocalFile = path.join(__dirname, 'core.json')
67+
const ETagFile = path.join(__dirname, '.etag')
6868

6969
async function readLocal (file) {
7070
return require(file)
7171
}
7272

7373
function loadETag () {
74-
if (fs.existsSync(__nccwpck_require__.ab + ".etag")) {
74+
if (fs.existsSync(ETagFile)) {
7575
debug('Loading local ETag')
7676
lastETagValue = fs.readFileSync(ETagFile).toString()
7777
}
7878
}
7979

8080
function updateLastETag (etag) {
8181
lastETagValue = etag
82-
fs.writeFileSync(__nccwpck_require__.ab + ".etag", lastETagValue)
82+
fs.writeFileSync(ETagFile, lastETagValue)
8383
}
8484

8585
async function fetchCoreIndex () {
@@ -90,20 +90,20 @@ async function fetchCoreIndex () {
9090
abortRequest.emit('abort')
9191
process.nextTick(() => { process.exit(1) })
9292
}
93-
return fs.createWriteStream(__nccwpck_require__.ab + "core.json", { flags: 'w', autoClose: true })
93+
return fs.createWriteStream(coreLocalFile, { flags: 'w', autoClose: true })
9494
})
95-
return readLocal(__nccwpck_require__.ab + "core.json")
95+
return readLocal(coreLocalFile)
9696
}
9797

9898
async function getCoreIndex () {
9999
const { headers } = await request(CORE_RAW_URL, { method: 'HEAD' })
100-
if (!lastETagValue || lastETagValue !== headers.etag || !fs.existsSync(__nccwpck_require__.ab + "core.json")) {
100+
if (!lastETagValue || lastETagValue !== headers.etag || !fs.existsSync(coreLocalFile)) {
101101
updateLastETag(headers.etag)
102102
debug('Creating local core.json')
103103
return fetchCoreIndex()
104104
} else {
105105
debug(`No updates from upstream. Getting a cached version: ${coreLocalFile}`)
106-
return readLocal(__nccwpck_require__.ab + "core.json")
106+
return readLocal(coreLocalFile)
107107
}
108108
}
109109

0 commit comments

Comments
 (0)