aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testAppNevena/Front/node_modules/pacote/lib/util
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/pacote/lib/util')
-rw-r--r--sandbox/testAppNevena/Front/node_modules/pacote/lib/util/add-git-sha.js15
-rw-r--r--sandbox/testAppNevena/Front/node_modules/pacote/lib/util/cache-dir.js12
-rw-r--r--sandbox/testAppNevena/Front/node_modules/pacote/lib/util/is-package-bin.js24
-rw-r--r--sandbox/testAppNevena/Front/node_modules/pacote/lib/util/npm.js15
-rw-r--r--sandbox/testAppNevena/Front/node_modules/pacote/lib/util/proc-log.js21
-rw-r--r--sandbox/testAppNevena/Front/node_modules/pacote/lib/util/tar-create-options.js30
6 files changed, 117 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/add-git-sha.js b/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/add-git-sha.js
new file mode 100644
index 00000000..843fe5b6
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/add-git-sha.js
@@ -0,0 +1,15 @@
+// add a sha to a git remote url spec
+const addGitSha = (spec, sha) => {
+ if (spec.hosted) {
+ const h = spec.hosted
+ const opt = { noCommittish: true }
+ const base = h.https && h.auth ? h.https(opt) : h.shortcut(opt)
+
+ return `${base}#${sha}`
+ } else {
+ // don't use new URL for this, because it doesn't handle scp urls
+ return spec.rawSpec.replace(/#.*$/, '') + `#${sha}`
+ }
+}
+
+module.exports = addGitSha
diff --git a/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/cache-dir.js b/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/cache-dir.js
new file mode 100644
index 00000000..abd24532
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/cache-dir.js
@@ -0,0 +1,12 @@
+const os = require('os')
+const {resolve} = require('path')
+
+module.exports = (fakePlatform = false) => {
+ const temp = os.tmpdir()
+ const uidOrPid = process.getuid ? process.getuid() : process.pid
+ const home = os.homedir() || resolve(temp, 'npm-' + uidOrPid)
+ const platform = fakePlatform || process.platform
+ const cacheExtra = platform === 'win32' ? 'npm-cache' : '.npm'
+ const cacheRoot = (platform === 'win32' && process.env.LOCALAPPDATA) || home
+ return resolve(cacheRoot, cacheExtra, '_cacache')
+}
diff --git a/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/is-package-bin.js b/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/is-package-bin.js
new file mode 100644
index 00000000..35cf0642
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/is-package-bin.js
@@ -0,0 +1,24 @@
+// Function to determine whether a path is in the package.bin set.
+// Used to prevent issues when people publish a package from a
+// windows machine, and then install with --no-bin-links.
+//
+// Note: this is not possible in remote or file fetchers, since
+// we don't have the manifest until AFTER we've unpacked. But the
+// main use case is registry fetching with git a distant second,
+// so that's an acceptable edge case to not handle.
+
+const binObj = (name, bin) =>
+ typeof bin === 'string' ? { [name]: bin } : bin
+
+const hasBin = (pkg, path) => {
+ const bin = binObj(pkg.name, pkg.bin)
+ const p = path.replace(/^[^\\\/]*\//, '')
+ for (const [k, v] of Object.entries(bin)) {
+ if (v === p)
+ return true
+ }
+ return false
+}
+
+module.exports = (pkg, path) =>
+ pkg && pkg.bin ? hasBin(pkg, path) : false
diff --git a/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/npm.js b/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/npm.js
new file mode 100644
index 00000000..f2f29bd0
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/npm.js
@@ -0,0 +1,15 @@
+// run an npm command
+const spawn = require('@npmcli/promise-spawn')
+const {dirname} = require('path')
+
+module.exports = (npmBin, npmCommand, cwd, env, extra) => {
+ const isJS = npmBin.endsWith('.js')
+ const cmd = isJS ? process.execPath : npmBin
+ const args = (isJS ? [npmBin] : []).concat(npmCommand)
+ // when installing to run the `prepare` script for a git dep, we need
+ // to ensure that we don't run into a cycle of checking out packages
+ // in temp directories. this lets us link previously-seen repos that
+ // are also being prepared.
+
+ return spawn(cmd, args, { cwd, stdioString: true, env }, extra)
+}
diff --git a/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/proc-log.js b/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/proc-log.js
new file mode 100644
index 00000000..b2bdd9dc
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/proc-log.js
@@ -0,0 +1,21 @@
+// default logger.
+// emits 'log' events on the process
+const LEVELS = [
+ 'notice',
+ 'error',
+ 'warn',
+ 'info',
+ 'verbose',
+ 'http',
+ 'silly',
+ 'pause',
+ 'resume'
+]
+
+const log = level => (...args) => process.emit('log', level, ...args)
+
+const logger = {}
+for (const level of LEVELS) {
+ logger[level] = log(level)
+}
+module.exports = logger
diff --git a/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/tar-create-options.js b/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/tar-create-options.js
new file mode 100644
index 00000000..31ab34c9
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/pacote/lib/util/tar-create-options.js
@@ -0,0 +1,30 @@
+const isPackageBin = require('./is-package-bin.js')
+
+const tarCreateOptions = manifest => ({
+ cwd: manifest._resolved,
+ prefix: 'package/',
+ portable: true,
+ gzip: {
+ // forcing the level to 9 seems to avoid some
+ // platform specific optimizations that cause
+ // integrity mismatch errors due to differing
+ // end results after compression
+ level: 9
+ },
+
+ // ensure that package bins are always executable
+ // Note that npm-packlist is already filtering out
+ // anything that is not a regular file, ignored by
+ // .npmignore or package.json "files", etc.
+ filter: (path, stat) => {
+ if (isPackageBin(manifest, path))
+ stat.mode |= 0o111
+ return true
+ },
+
+ // Provide a specific date in the 1980s for the benefit of zip,
+ // which is confounded by files dated at the Unix epoch 0.
+ mtime: new Date('1985-10-26T08:15:00.000Z'),
+})
+
+module.exports = tarCreateOptions