fyn 0.4.40 → 0.4.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/fyn.js +1 -1
  2. package/package.json +1 -1
package/dist/fyn.js CHANGED
@@ -170,7 +170,7 @@ eval("\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(obje
170
170
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
171
171
 
172
172
  "use strict";
173
- eval("\n/* eslint-disable no-magic-numbers, max-statements, no-eval, camelcase, no-param-reassign */\n//\n// execute npm scripts\n//\n\nconst Path = __webpack_require__(/*! path */ \"path\");\n\nconst optionalRequire = __webpack_require__(/*! optional-require */ \"./node_modules/optional-require/index.js\")(eval(\"require\"));\n\nconst assert = __webpack_require__(/*! assert */ \"assert\");\n\nconst xsh = __webpack_require__(/*! xsh */ \"./node_modules/xsh/lib/index.js\");\n\nconst Promise = __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/release/bluebird.js\");\n\nconst chalk = __webpack_require__(/*! chalk */ \"./node_modules/chalk/source/index.js\");\n\nconst _ = __webpack_require__(/*! lodash */ \"./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js\");\n\nconst logger = __webpack_require__(/*! ./logger */ \"./lib/logger.js\");\n\nconst logFormat = __webpack_require__(/*! ./util/log-format */ \"./lib/util/log-format.js\");\n\nconst VisualExec = __webpack_require__(/*! visual-exec */ \"./node_modules/visual-exec/lib/visual-exec.js\");\n\nconst fyntil = __webpack_require__(/*! ./util/fyntil */ \"./lib/util/fyntil.js\");\n\nconst requireAt = __webpack_require__(/*! require-at */ \"./node_modules/require-at/require-at.js\");\n\nconst npmConfigEnv = __webpack_require__(/*! ./util/npm-config-env */ \"./lib/util/npm-config-env.js\");\n\nconst readPkgJson = dir => {\n return fyntil.readPkgJson(dir).catch(() => {\n return {};\n });\n};\n\nxsh.Promise = Promise; // When released, all code are bundled into dist/fyn.js\n// When running from original source, this is under lib/lifecycle-scripts.js\n// It's important to maintain same level so \"../package.json\" works.\n\nconst fynInstalledDir = Path.dirname(optionalRequire.resolve(\"../package.json\"));\nconst fynCli = requireAt(fynInstalledDir).resolve(\"./bin/fyn.js\");\n/*\n * ref: https://github.com/npm/npm/blob/75b462c19ea16ef0d7f943f94ff4d255695a5c0d/lib/utils/lifecycle.js\n * docs: https://docs.npmjs.com/misc/scripts\n *\n */\n\nconst ONE_MB = 1024 * 1024;\n\nconst getGlobalNodeModules = () => {\n const nodeDir = Path.dirname(process.execPath);\n\n if (process.platform === \"win32\") {\n // windows put node binary under <installed_dir>/node.exe\n // and node_modules under <installed_dir>/node_modules\n return Path.join(nodeDir, \"node_modules\");\n } else {\n // node install on unix put node binary under <installed_dir>/bin/node\n // and node_modules under <installed_dir>/lib/node_modules\n return Path.join(Path.dirname(nodeDir), \"lib/node_modules\");\n }\n};\n\nclass LifecycleScripts {\n constructor(options) {\n if (typeof options === \"string\") {\n options = {\n dir: options\n };\n }\n\n this._fyn = options._fyn || {};\n this._pkgDir = options.dir;\n this._options = Object.assign({}, options);\n }\n\n _getNpm6NodeGyp({\n version,\n npmDir,\n xrequire\n }) {\n try {\n const npmLifecycleDir = Path.dirname(xrequire.resolve(\"npm-lifecycle/package.json\"));\n return {\n envFile: xrequire.resolve(\"node-gyp/bin/node-gyp\"),\n envPath: Path.join(npmLifecycleDir, \"node-gyp-bin\")\n };\n } catch (err) {\n logger.debug(`failed to resolve node-gyp dir from npm ${version}, using defaults.`, err);\n return {\n envFile: Path.join(npmDir, \"node_modules/node-gyp/bin/node-gyp.js\"),\n envPath: Path.join(npmDir, \"node_modules/npm-lifecycle/node-gyp-bin\")\n };\n }\n }\n\n _getNpm7NodeGyp({\n version,\n npmDir,\n xrequire\n }) {\n try {\n // npm 7 has node-gyp as dep directly\n // node-gyp-bin is under npm/bin\n return {\n envFile: xrequire.resolve(\"node-gyp/bin/node-gyp\"),\n envPath: Path.join(npmDir, \"bin\")\n };\n } catch (err) {\n logger.debug(`failed to resolve node-gyp dir from npm ${version}, using defaults.`, err);\n return {\n envFile: Path.join(npmDir, \"node_modules\", \"node-gyp\", \"bin\", \"node-gyp.js\"),\n envPath: Path.join(npmDir, \"bin\")\n };\n }\n }\n\n _findNodeGypFromNpm(env) {\n const npmDir = Path.join(getGlobalNodeModules(), \"npm\");\n const xrequire = requireAt(npmDir);\n const npmPkg = xrequire(\"./package.json\");\n const version = parseInt(npmPkg.version.split(\".\")[0]);\n\n if (version > 7) {\n logger.error(`Unknown npm version ${version} - can't provide node-gyp binary`);\n return;\n }\n\n const {\n envFile,\n envPath\n } = version <= 6 ? this._getNpm6NodeGyp({\n version: npmPkg.version,\n npmDir,\n xrequire\n }) : this._getNpm7NodeGyp({\n version: npmPkg.version,\n npmDir,\n xrequire\n });\n env.npm_config_node_gyp = envFile;\n xsh.envPath.addToFront(envPath, env);\n logger.debug(`env npm_config_node_gyp set to ${env.npm_config_node_gyp}, path ${envPath} added`);\n }\n\n makeEnv(override) {\n // let env = Object.assign({}, process.env, override);\n // this._addNpmPackageConfig(this._appPkg.config, env);\n // this._addNpmPackageConfig(this._pkg.config, env);\n const env = Object.assign({}, npmConfigEnv(this._pkg, this._fyn.allrc || {}), override);\n\n this._findNodeGypFromNpm(env);\n\n if (this._appDir) {\n xsh.envPath.addToFront(Path.join(this._appDir, \"node_modules/.bin\"), env);\n }\n\n xsh.envPath.addToFront(Path.join(this._pkgDir, \"node_modules/.bin\"), env); // env.npm_lifecycle_event = stage; // TODO\n\n env.npm_node_execpath = env.NODE = env.NODE || process.execPath;\n env.npm_execpath = fynCli;\n env.INIT_CWD = this._fyn.cwd;\n return env;\n }\n\n execute(aliases, silent) {\n return Promise.try(() => this._execute(aliases, silent));\n }\n\n async _initialize() {\n const options = this._options;\n\n if (options.appDir && options.appDir !== options.dir) {\n this._appDir = options.appDir;\n this._appPkg = await readPkgJson(this._appDir);\n } else {\n this._appPkg = {};\n }\n\n this._pkg = options.json || (await readPkgJson(this._pkgDir));\n assert(this._pkg, `Unable to load package.json from ${this._pkgDir}`);\n\n if (!this._pkg.scripts) {\n this._pkg.scripts = {};\n }\n }\n\n async _execute(aliases, silent) {\n if (!this._pkg) {\n await this._initialize();\n }\n\n if (typeof aliases === \"string\") aliases = [aliases];\n\n const name = _.keys(this._pkg.scripts).find(x => aliases.indexOf(x) >= 0);\n\n if (!name || !this._pkg.scripts.hasOwnProperty(name)) {\n return false;\n }\n\n assert(this._pkg.scripts[name], `No npm script ${name} found in package.json in ${this._pkgDir}.`);\n const pkgName = logFormat.pkgId(this._pkg);\n const dimPkgName = chalk.dim(pkgName);\n const scriptName = chalk.magenta(name);\n const script = `\"${chalk.cyan(this._pkg.scripts[name])}\"`;\n const pkgDir = logFormat.pkgPath(this._pkg.name, this._pkgDir);\n logger.verbose(`executing npm script ${scriptName} of ${dimPkgName} '${script}' ${pkgDir}`);\n const child = xsh.exec({\n silent,\n cwd: this._pkgDir,\n env: this.makeEnv({\n PWD: this._pkgDir\n }),\n maxBuffer: ONE_MB\n }, this._pkg.scripts[name]);\n if (!silent) return child.promise;\n const ve = new VisualExec({\n command: this._pkg.scripts[name],\n cwd: this._pkgDir,\n visualLogger: logger,\n displayTitle: `Running ${scriptName} of ${pkgName}`,\n logLabel: `${pkgName} npm script ${scriptName}`,\n outputLabel: `${dimPkgName} npm script ${scriptName}`\n });\n return ve.show(child);\n }\n\n}\n\nmodule.exports = LifecycleScripts;\n\n//# sourceURL=webpack://fyn/./lib/lifecycle-scripts.js?");
173
+ eval("\n/* eslint-disable no-magic-numbers, max-statements, no-eval, camelcase, no-param-reassign */\n//\n// execute npm scripts\n//\n\nconst Path = __webpack_require__(/*! path */ \"path\");\n\nconst optionalRequire = __webpack_require__(/*! optional-require */ \"./node_modules/optional-require/index.js\")(eval(\"require\"));\n\nconst assert = __webpack_require__(/*! assert */ \"assert\");\n\nconst xsh = __webpack_require__(/*! xsh */ \"./node_modules/xsh/lib/index.js\");\n\nconst Promise = __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/release/bluebird.js\");\n\nconst chalk = __webpack_require__(/*! chalk */ \"./node_modules/chalk/source/index.js\");\n\nconst _ = __webpack_require__(/*! lodash */ \"./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js\");\n\nconst logger = __webpack_require__(/*! ./logger */ \"./lib/logger.js\");\n\nconst logFormat = __webpack_require__(/*! ./util/log-format */ \"./lib/util/log-format.js\");\n\nconst VisualExec = __webpack_require__(/*! visual-exec */ \"./node_modules/visual-exec/lib/visual-exec.js\");\n\nconst fyntil = __webpack_require__(/*! ./util/fyntil */ \"./lib/util/fyntil.js\");\n\nconst requireAt = __webpack_require__(/*! require-at */ \"./node_modules/require-at/require-at.js\");\n\nconst npmConfigEnv = __webpack_require__(/*! ./util/npm-config-env */ \"./lib/util/npm-config-env.js\");\n\nconst readPkgJson = dir => {\n return fyntil.readPkgJson(dir).catch(() => {\n return {};\n });\n};\n\nxsh.Promise = Promise; // When released, all code are bundled into dist/fyn.js\n// When running from original source, this is under lib/lifecycle-scripts.js\n// It's important to maintain same level so \"../package.json\" works.\n\nconst fynInstalledDir = Path.dirname(optionalRequire.resolve(\"../package.json\"));\nconst fynCli = requireAt(fynInstalledDir).resolve(\"./bin/fyn.js\");\n/*\n * ref: https://github.com/npm/npm/blob/75b462c19ea16ef0d7f943f94ff4d255695a5c0d/lib/utils/lifecycle.js\n * docs: https://docs.npmjs.com/misc/scripts\n *\n */\n\nconst ONE_MB = 1024 * 1024;\n\nconst getGlobalNodeModules = () => {\n const nodeDir = Path.dirname(process.execPath);\n\n if (process.platform === \"win32\") {\n // windows put node binary under <installed_dir>/node.exe\n // and node_modules under <installed_dir>/node_modules\n return Path.join(nodeDir, \"node_modules\");\n } else {\n // node install on unix put node binary under <installed_dir>/bin/node\n // and node_modules under <installed_dir>/lib/node_modules\n return Path.join(Path.dirname(nodeDir), \"lib/node_modules\");\n }\n};\n\nclass LifecycleScripts {\n constructor(options) {\n if (typeof options === \"string\") {\n options = {\n dir: options\n };\n }\n\n this._fyn = options._fyn || {};\n this._pkgDir = options.dir;\n this._options = Object.assign({}, options);\n }\n\n _getNpm6NodeGyp({\n version,\n npmDir,\n xrequire\n }) {\n try {\n const npmLifecycleDir = Path.dirname(xrequire.resolve(\"npm-lifecycle/package.json\"));\n return {\n envFile: xrequire.resolve(\"node-gyp/bin/node-gyp\"),\n envPath: Path.join(npmLifecycleDir, \"node-gyp-bin\")\n };\n } catch (err) {\n logger.debug(`failed to resolve node-gyp dir from npm ${version}, using defaults.`, err);\n return {\n envFile: Path.join(npmDir, \"node_modules/node-gyp/bin/node-gyp.js\"),\n envPath: Path.join(npmDir, \"node_modules/npm-lifecycle/node-gyp-bin\")\n };\n }\n }\n\n _getNpm7NodeGyp({\n version,\n npmDir,\n xrequire\n }) {\n try {\n // npm 7 has node-gyp as dep directly\n // node-gyp-bin is under npm/bin\n return {\n envFile: xrequire.resolve(\"node-gyp/bin/node-gyp\"),\n envPath: Path.join(npmDir, \"bin\")\n };\n } catch (err) {\n logger.debug(`failed to resolve node-gyp dir from npm ${version}, using defaults.`, err);\n return {\n envFile: Path.join(npmDir, \"node_modules\", \"node-gyp\", \"bin\", \"node-gyp.js\"),\n envPath: Path.join(npmDir, \"bin\")\n };\n }\n }\n\n _findNodeGypFromNpm(env) {\n const npmDir = Path.join(getGlobalNodeModules(), \"npm\");\n const xrequire = requireAt(npmDir);\n const npmPkg = xrequire(\"./package.json\");\n const version = parseInt(npmPkg.version.split(\".\")[0]);\n\n if (version > 8) {\n logger.error(`Unknown npm version ${version} - can't provide node-gyp binary`);\n return;\n }\n\n const {\n envFile,\n envPath\n } = version <= 6 ? this._getNpm6NodeGyp({\n version: npmPkg.version,\n npmDir,\n xrequire\n }) : this._getNpm7NodeGyp({\n version: npmPkg.version,\n npmDir,\n xrequire\n });\n env.npm_config_node_gyp = envFile;\n xsh.envPath.addToFront(envPath, env);\n logger.debug(`env npm_config_node_gyp set to ${env.npm_config_node_gyp}, path ${envPath} added`);\n }\n\n makeEnv(override) {\n // let env = Object.assign({}, process.env, override);\n // this._addNpmPackageConfig(this._appPkg.config, env);\n // this._addNpmPackageConfig(this._pkg.config, env);\n const env = Object.assign({}, npmConfigEnv(this._pkg, this._fyn.allrc || {}), override);\n\n this._findNodeGypFromNpm(env);\n\n if (this._appDir) {\n xsh.envPath.addToFront(Path.join(this._appDir, \"node_modules/.bin\"), env);\n }\n\n xsh.envPath.addToFront(Path.join(this._pkgDir, \"node_modules/.bin\"), env); // env.npm_lifecycle_event = stage; // TODO\n\n env.npm_node_execpath = env.NODE = env.NODE || process.execPath;\n env.npm_execpath = fynCli;\n env.INIT_CWD = this._fyn.cwd;\n return env;\n }\n\n execute(aliases, silent) {\n return Promise.try(() => this._execute(aliases, silent));\n }\n\n async _initialize() {\n const options = this._options;\n\n if (options.appDir && options.appDir !== options.dir) {\n this._appDir = options.appDir;\n this._appPkg = await readPkgJson(this._appDir);\n } else {\n this._appPkg = {};\n }\n\n this._pkg = options.json || (await readPkgJson(this._pkgDir));\n assert(this._pkg, `Unable to load package.json from ${this._pkgDir}`);\n\n if (!this._pkg.scripts) {\n this._pkg.scripts = {};\n }\n }\n\n async _execute(aliases, silent) {\n if (!this._pkg) {\n await this._initialize();\n }\n\n if (typeof aliases === \"string\") aliases = [aliases];\n\n const name = _.keys(this._pkg.scripts).find(x => aliases.indexOf(x) >= 0);\n\n if (!name || !this._pkg.scripts.hasOwnProperty(name)) {\n return false;\n }\n\n assert(this._pkg.scripts[name], `No npm script ${name} found in package.json in ${this._pkgDir}.`);\n const pkgName = logFormat.pkgId(this._pkg);\n const dimPkgName = chalk.dim(pkgName);\n const scriptName = chalk.magenta(name);\n const script = `\"${chalk.cyan(this._pkg.scripts[name])}\"`;\n const pkgDir = logFormat.pkgPath(this._pkg.name, this._pkgDir);\n logger.verbose(`executing npm script ${scriptName} of ${dimPkgName} '${script}' ${pkgDir}`);\n const child = xsh.exec({\n silent,\n cwd: this._pkgDir,\n env: this.makeEnv({\n PWD: this._pkgDir\n }),\n maxBuffer: ONE_MB\n }, this._pkg.scripts[name]);\n if (!silent) return child.promise;\n const ve = new VisualExec({\n command: this._pkg.scripts[name],\n cwd: this._pkgDir,\n visualLogger: logger,\n displayTitle: `Running ${scriptName} of ${pkgName}`,\n logLabel: `${pkgName} npm script ${scriptName}`,\n outputLabel: `${dimPkgName} npm script ${scriptName}`\n });\n return ve.show(child);\n }\n\n}\n\nmodule.exports = LifecycleScripts;\n\n//# sourceURL=webpack://fyn/./lib/lifecycle-scripts.js?");
174
174
 
175
175
  /***/ }),
176
176
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fyn",
3
- "version": "0.4.40",
3
+ "version": "0.4.41",
4
4
  "description": "A fast node package manager for better productivity and efficiency",
5
5
  "main": "./bin/fyn.js",
6
6
  "scripts": {