uawdijnntqw1x1x1
IP : 216.73.216.86
Hostname : 6.87.74.97.host.secureserver.net
Kernel : Linux 6.87.74.97.host.secureserver.net 4.18.0-553.83.1.el8_10.x86_64 #1 SMP Mon Nov 10 04:22:44 EST 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
emeraadmin
/
www
/
4d695
/
..
/
dist
/
..
/
node_modules
/
..
/
node_modules
/
..
/
src
/
..
/
4d695
/
promzard.tar
/
/
package.json000064400000002624151701457710007046 0ustar00{ "_id": "promzard@1.0.2", "_inBundle": true, "_location": "/npm/promzard", "_phantomChildren": {}, "_requiredBy": [ "/npm/init-package-json" ], "author": { "name": "GitHub Inc." }, "bugs": { "url": "https://github.com/npm/promzard/issues" }, "dependencies": { "read": "^3.0.1" }, "description": "prompting wizardly", "devDependencies": { "@npmcli/eslint-config": "^4.0.0", "@npmcli/template-oss": "4.22.0", "tap": "^16.3.0" }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" }, "files": [ "bin/", "lib/" ], "homepage": "https://github.com/npm/promzard#readme", "license": "ISC", "main": "lib/index.js", "name": "promzard", "repository": { "url": "git+https://github.com/npm/promzard.git", "type": "git" }, "scripts": { "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "lintfix": "npm run lint -- --fix", "postlint": "template-oss-check", "posttest": "npm run lint", "snap": "tap", "template-oss-apply": "template-oss-apply --force", "test": "tap" }, "tap": { "jobs": 1, "test-ignore": "fixtures/", "nyc-arg": [ "--exclude", "tap-snapshots/**" ] }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", "version": "4.22.0", "publish": true }, "version": "1.0.2" } lib/index.js000064400000011072151701457710006770 0ustar00const fs = require('fs/promises') const { runInThisContext } = require('vm') const { promisify } = require('util') const { randomBytes } = require('crypto') const { Module } = require('module') const { dirname, basename } = require('path') const { read } = require('read') const files = {} class PromZard { #file = null #backupFile = null #ctx = null #unique = randomBytes(8).toString('hex') #prompts = [] constructor (file, ctx = {}, options = {}) { this.#file = file this.#ctx = ctx this.#backupFile = options.backupFile } static async promzard (file, ctx, options) { const pz = new PromZard(file, ctx, options) return pz.load() } static async fromBuffer (buf, ctx, options) { let filename = 0 do { filename = '\0' + Math.random() } while (files[filename]) files[filename] = buf const ret = await PromZard.promzard(filename, ctx, options) delete files[filename] return ret } async load () { if (files[this.#file]) { return this.#loaded() } try { files[this.#file] = await fs.readFile(this.#file, 'utf8') } catch (er) { if (er && this.#backupFile) { this.#file = this.#backupFile this.#backupFile = null return this.load() } throw er } return this.#loaded() } async #loaded () { const mod = new Module(this.#file, module) mod.loaded = true mod.filename = this.#file mod.id = this.#file mod.paths = Module._nodeModulePaths(dirname(this.#file)) this.#ctx.prompt = this.#makePrompt() this.#ctx.__filename = this.#file this.#ctx.__dirname = dirname(this.#file) this.#ctx.__basename = basename(this.#file) this.#ctx.module = mod this.#ctx.require = (p) => mod.require(p) this.#ctx.require.resolve = (p) => Module._resolveFilename(p, mod) this.#ctx.exports = mod.exports const body = `(function(${Object.keys(this.#ctx).join(', ')}) { ${files[this.#file]}\n })` runInThisContext(body, this.#file).apply(this.#ctx, Object.values(this.#ctx)) this.#ctx.res = mod.exports return this.#walk() } #makePrompt () { return (...args) => { let p, d, t for (let i = 0; i < args.length; i++) { const a = args[i] if (typeof a === 'string') { if (p) { d = a } else { p = a } } else if (typeof a === 'function') { t = a } else if (a && typeof a === 'object') { p = a.prompt || p d = a.default || d t = a.transform || t } } try { return `${this.#unique}-${this.#prompts.length}` } finally { this.#prompts.push([p, d, t]) } } } async #walk (o = this.#ctx.res) { const keys = Object.keys(o) const len = keys.length let i = 0 while (i < len) { const k = keys[i] const v = o[k] i++ if (v && typeof v === 'object') { o[k] = await this.#walk(v) continue } if (v && typeof v === 'string' && v.startsWith(this.#unique)) { const n = +v.slice(this.#unique.length + 1) // default to the key // default to the ctx value, if there is one const [prompt = k, def = this.#ctx[k], tx] = this.#prompts[n] try { o[k] = await this.#prompt(prompt, def, tx) } catch (er) { if (er.notValid) { // eslint-disable-next-line no-console console.log(er.message) i-- } else { throw er } } continue } if (typeof v === 'function') { // XXX: remove v.length check to remove cb from functions // would be a breaking change for `npm init` // XXX: if cb is no longer an argument then this.#ctx should // be passed in to allow arrow fns to be used and still access ctx const fn = v.length ? promisify(v) : v o[k] = await fn.call(this.#ctx) // back up so that we process this one again. // this is because it might return a prompt() call in the cb. i-- continue } } return o } async #prompt (prompt, def, tx) { const res = await read({ prompt: prompt + ':', default: def }).then((r) => tx ? tx(r) : r) // XXX: remove this to require throwing an error instead of // returning it. would be a breaking change for `npm init` if (res instanceof Error && res.notValid) { throw res } return res } } module.exports = PromZard.promzard module.exports.fromBuffer = PromZard.fromBuffer module.exports.PromZard = PromZard LICENSE000064400000001354151701457710005564 0ustar00The ISC License Copyright (c) Isaac Z. Schlueter Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/home/emeraadmin/www/4d695/../dist/../node_modules/../node_modules/../src/../4d695/promzard.tar