Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var path = require('path')
var rc = require('rc')
var optimist = require('optimist')
var toCC = require('to-camel-case')
var osenv = require('osenv')
var home = osenv.home()
var tmp = osenv.tmpdir()
module.exports = (function () {
// *** vvv Copied this stuff out of npmconf **********************
var uidOrPid = process.getuid ? process.getuid() : process.pid
if (home) process.env.HOME = home
else home = path.resolve(temp, "npm-" + uidOrPid)
var cacheExtra = process.platform === "win32" ? "npm-cache" : ".npm"
var cacheRoot = process.platform === "win32" && process.env.APPDATA || home
var cache = path.resolve(cacheRoot, cacheExtra)
// *** ^^^ Copied this stuff out of npmconf **********************
var config = rc('npmd', {
dbPath: path.join(process.env.HOME, '.npmd'),
var path = require('path');
var fs = require('graceful-fs');
var optimist = require('optimist');
var osenv = require('osenv');
var object = require('mout/object');
var string = require('mout/string');
var paths = require('./paths');
var defaults = require('./defaults');
var win = process.platform === 'win32';
var home = osenv.home();
function rc(name, cwd, argv) {
var argvConfig;
argv = argv || optimist.argv;
// Parse --config.foo=false
argvConfig = object.map(argv.config || {}, function (value) {
return value === 'false' ? false : value;
});
// If we have specified a cwd then use this as the base for getting config.
cwd = argvConfig.cwd ? argvConfig.cwd : cwd;
if (cwd) {
return object.deepMixIn.apply(null, [
var path = require('path');
var fs = require('graceful-fs');
var optimist = require('optimist');
var osenv = require('osenv');
var object = require('mout/object');
var string = require('mout/string');
var paths = require('./paths');
var defaults = require('./defaults');
var win = process.platform === 'win32';
var home = osenv.home();
function rc(name, cwd, argv) {
var argvConfig;
argv = argv || optimist.argv;
// Parse --config.foo=false
argvConfig = object.map(argv.config || {}, function(value) {
return value === 'false' ? false : value;
});
// If we have specified a cwd then use this as the base for getting config.
cwd = argvConfig.cwd ? argvConfig.cwd : cwd;
if (cwd) {
return object.deepMixIn.apply(null, [
function withTmp (opts, cb) {
if (opts.cache) {
// cacache has a special facility for working in a tmp dir
return cache.tmp.withTmp(opts.cache, {tmpPrefix: 'git-clone'}, cb)
} else {
const tmpDir = path.join(osenv.tmpdir(), 'pacote-git-tmp')
const tmpName = uniqueFilename(tmpDir, 'git-clone')
const tmp = mkdirp(tmpName).then(() => tmpName).disposer(rimraf)
return BB.using(tmp, cb)
}
}
function withTmp (opts, cb) {
if (opts.cache) {
// cacache has a special facility for working in a tmp dir
return cacache.tmp.withTmp(opts.cache, { tmpPrefix: 'git-clone' }, cb)
} else {
const tmpDir = path.join(osenv.tmpdir(), 'pacote-git-tmp')
const tmpName = uniqueFilename(tmpDir, 'git-clone')
const tmp = mkdirp(tmpName).then(() => tmpName).disposer(rimraf)
return BB.using(tmp, cb)
}
}
static setResolveLoaderPath(runtime) {
const jbRuntime = runtime || 'runtime-now-6';
const resolveLoaderPath = path.join(osenv.home(), './.feflow/node_modules');
// Loader在捷豹平台的查找路径
const jbLoaderPath = `/data/frontend/install/AlloyDist/${jbRuntime}/node_modules`;
return {
modules: [
path.resolve(__dirname, "../node_modules"),
resolveLoaderPath,
jbLoaderPath,
]
};
}
}
var test = require('tape')
var level = require('..')
var path = require('path')
var bytewise = require('bytewise')
var tmpdir = require('osenv').tmpdir()
var datadir = path.join(tmpdir, 'level-party-' + Math.random())
var lopts = { keyEncoding: bytewise, valueEncoding: 'json' }
test('bytewise key encoding', function (t) {
t.plan(7)
var adb = level(datadir, lopts)
var bdb = level(datadir, lopts)
var value = Math.floor(Math.random() * 100000)
adb.put(['a'], value, function (err) {
t.ifError(err)
bdb.get(['a'], function (err, x) {
t.ifError(err)
t.equal(x, value)
var test = require('tape');
var level = require('../');
var path = require('path');
var bsub = require('level-sublevel/bytewise');
var os = require('os');
var tmpdir = require('osenv').tmpdir();
var datadir = path.join(tmpdir, 'level-party-' + Math.random());
var bytewise = require('bytewise');
var lopts = { keyEncoding: bytewise, valueEncoding: 'json' };
test('bytewise sublevel', function (t) {
t.plan(5);
var a = level(datadir);
var b = level(datadir);
var adb = bsub(a, lopts);
var bdb = bsub(b, lopts);
var value = Math.floor(Math.random() * 100000);
adb.put([ 'a' ], value, function (err) {
if (err) t.fail(err);
var times = 0;
var test = require('tape');
var level = require('../');
var path = require('path');
var sub = require('level-sublevel');
var os = require('os');
var tmpdir = require('osenv').tmpdir();
var datadir = path.join(tmpdir, 'level-party-' + Math.random());
test('sublevel', function (t) {
t.plan(6);
var db = level(datadir);
var sdb = sub(db);
var a = sdb.sublevel('aaa', { valueEncoding: 'json' });
var b = sdb.sublevel('bbb', { valueEncoding: 'json' });
var value = Math.floor(Math.random() * 100000);
a.put('x', value, function (err) {
t.ifError(err);
a.get('x', function (err, x) {
t.ifError(err);
"use strict";
var abstract = require("./abstract");
var LevelUp = require("../../").persistence.LevelUp;
var async = require("async");
var tmpdir = require("osenv").tmpdir();
var path = require("path");
var rimraf = require("rimraf");
describe("mosca.persistence.LevelUp", function() {
this.timeout(4000);
var opts = {
ttl: {
subscriptions: 250,
packets: 250
}
};
abstract(LevelUp, function(cb) {
var that = this;