@@ -63,23 +63,23 @@ const CORE_RAW_URL = 'https://raw.githubusercontent.com/nodejs/security-wg/main/
63
63
64
64
let lastETagValue
65
65
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')
68
68
69
69
async function readLocal (file) {
70
70
return require(file)
71
71
}
72
72
73
73
function loadETag () {
74
- if (fs.existsSync(__nccwpck_require__.ab + ".etag" )) {
74
+ if (fs.existsSync(ETagFile )) {
75
75
debug('Loading local ETag')
76
76
lastETagValue = fs.readFileSync(ETagFile).toString()
77
77
}
78
78
}
79
79
80
80
function updateLastETag (etag) {
81
81
lastETagValue = etag
82
- fs.writeFileSync(__nccwpck_require__.ab + ".etag" , lastETagValue)
82
+ fs.writeFileSync(ETagFile , lastETagValue)
83
83
}
84
84
85
85
async function fetchCoreIndex () {
@@ -90,20 +90,20 @@ async function fetchCoreIndex () {
90
90
abortRequest.emit('abort')
91
91
process.nextTick(() => { process.exit(1) })
92
92
}
93
- return fs.createWriteStream(__nccwpck_require__.ab + "core.json" , { flags: 'w', autoClose: true })
93
+ return fs.createWriteStream(coreLocalFile , { flags: 'w', autoClose: true })
94
94
})
95
- return readLocal(__nccwpck_require__.ab + "core.json" )
95
+ return readLocal(coreLocalFile )
96
96
}
97
97
98
98
async function getCoreIndex () {
99
99
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 )) {
101
101
updateLastETag(headers.etag)
102
102
debug('Creating local core.json')
103
103
return fetchCoreIndex()
104
104
} else {
105
105
debug(`No updates from upstream. Getting a cached version: ${coreLocalFile}`)
106
- return readLocal(__nccwpck_require__.ab + "core.json" )
106
+ return readLocal(coreLocalFile )
107
107
}
108
108
}
109
109
0 commit comments