nodejs: upgrade 22.11.0 -> 22.12.0

License-Update: Add JSON parsing library under MIT license.
  https://github.com/nodejs/node/pull/56040/commits/27bcd103e775e00eb8d03ac37052bbd4ccb6d239

Drop backported patch fix-build-with-icu-76.patch.  It is already
integrated in this version https://github.com/nodejs/node/pull/56040/commits/c3ca978d9c73d1a96f4d5c7bfa3c10ce786b8fe9

Changelog: https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V22.md#22.12.0

Signed-off-by: Jason Schonberg <schonm@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Jason Schonberg
2024-12-03 23:54:07 -05:00
committed by Khem Raj
parent 6390454940
commit d6fe4dc9ae
4 changed files with 2 additions and 32 deletions
@@ -0,0 +1,77 @@
#!/usr/bin/env node
/// Usage: oe-npm-cache <cache-dir> <type> <key> <file-name>
/// <type> ... meta - metainformation about package
/// tgz - tarball
const process = require("node:process");
module.paths.unshift("@@libdir@@/node_modules/npm/node_modules");
const cacache = require('cacache')
const fs = require('fs')
// argv[0] is 'node', argv[1] is this script
const cache_dir = process.argv[2]
const type = process.argv[3]
const key = process.argv[4]
const file = process.argv[5]
const data = fs.readFileSync(file)
// metadata content is highly nodejs dependent; when cache entries are not
// found, place debug statements in 'make-fetch-happen/lib/cache/policy.js'
// (CachePolicy::satisfies())
const xlate = {
'meta': {
'key_prefix': 'make-fetch-happen:request-cache:',
'metadata': function() {
return {
time: Date.now(),
url: key,
reqHeaders: {
'accept': 'application/json',
},
resHeaders: {
"content-type": "application/json",
"status": 200,
},
options: {
compress: true,
}
};
},
},
'tgz': {
'key_prefix': 'make-fetch-happen:request-cache:',
'metadata': function() {
return {
time: Date.now(),
url: key,
reqHeaders: {
'accept': '*/*',
},
resHeaders: {
"content-type": "application/octet-stream",
"status": 200,
},
options: {
compress: true,
},
};
},
},
};
const info = xlate[type];
let opts = {}
if (info.metadata) {
opts['metadata'] = info.metadata();
}
cacache.put(cache_dir, info.key_prefix + key, data, opts)
.then(integrity => {
console.log(`Saved content of ${key} (${file}).`);
})