Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nuxt/utils

Package Overview
Dependencies
Maintainers
3
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuxt/utils - npm Package Compare versions

Comparing version 2.8.1 to 2.9.0

86

dist/utils.js
/*!
* @nuxt/utils v2.8.1 (c) 2016-2019
* @nuxt/utils v2.9.0 (c) 2016-2019

@@ -24,7 +24,7 @@ * - All the amazing contributors

const getContext = function getContext(req, res) {
const getContext = function getContext (req, res) {
return { req, res }
};
const determineGlobals = function determineGlobals(globalName, globals) {
const determineGlobals = function determineGlobals (globalName, globals) {
const _globals = {};

@@ -41,3 +41,3 @@ for (const global in globals) {

const encodeHtml = function encodeHtml(str) {
const encodeHtml = function encodeHtml (str) {
return str.replace(/</g, '&lt;').replace(/>/g, '&gt;')

@@ -52,7 +52,7 @@ };

const isUrl = function isUrl(url) {
const isUrl = function isUrl (url) {
return ['http', '//'].some(str => url.startsWith(str))
};
const urlJoin = function urlJoin() {
const urlJoin = function urlJoin () {
return [].slice

@@ -81,3 +81,3 @@ .call(arguments)

const stripWhitespace = function stripWhitespace(string) {
const stripWhitespace = function stripWhitespace (string) {
WHITESPACE_REPLACEMENTS.forEach(([regex, newSubstr]) => {

@@ -96,7 +96,7 @@ string = string.replace(regex, newSubstr);

function getLockOptions(options) {
function getLockOptions (options) {
return Object.assign({}, defaultLockOptions, options)
}
function createLockPath({ id = 'nuxt', dir, root }) {
function createLockPath ({ id = 'nuxt', dir, root }) {
const sum = hash(`${root}-${dir}`);

@@ -107,3 +107,3 @@

async function getLockPath(config) {
async function getLockPath (config) {
const lockPath = createLockPath(config);

@@ -118,3 +118,3 @@

async function lock({ id, dir, root, options }) {
async function lock ({ id, dir, root, options }) {
const lockPath = await getLockPath({ id, dir, root });

@@ -162,3 +162,3 @@

return async function lockRelease() {
return async function lockRelease () {
try {

@@ -505,5 +505,5 @@ await fs.remove(lockPath);

const isWindows = /^win/.test(process.platform);
const isWindows = process.platform.startsWith('win');
const wp = function wp(p = '') {
const wp = function wp (p = '') {
if (isWindows) {

@@ -515,3 +515,3 @@ return p.replace(/\\/g, '\\\\')

const wChunk = function wChunk(p = '') {
const wChunk = function wChunk (p = '') {
if (isWindows) {

@@ -527,3 +527,3 @@ return p.replace(/\//g, '_')

const r = function r(...args) {
const r = function r (...args) {
const lastArg = args[args.length - 1];

@@ -538,3 +538,3 @@

const relativeTo = function relativeTo(...args) {
const relativeTo = function relativeTo (...args) {
const dir = args.shift();

@@ -566,3 +566,3 @@

function defineAlias(src, target, prop, opts = {}) {
function defineAlias (src, target, prop, opts = {}) {
const { bind = true, warn = false } = opts;

@@ -600,3 +600,3 @@

function isIndexFileAndFolder(pluginFiles) {
function isIndexFileAndFolder (pluginFiles) {
// Return early in case the matching file count exceeds 2 (index.js + folder)

@@ -1521,3 +1521,3 @@ if (pluginFiles.length !== 2) {

const flatRoutes = function flatRoutes(router, fileName = '', routes = []) {
const flatRoutes = function flatRoutes (router, fileName = '', routes = []) {
router.forEach((r) => {

@@ -1543,3 +1543,3 @@ if ([':', '*'].some(c => r.path.includes(c))) {

function cleanChildrenRoutes(routes, isChild = false, routeNameSplitter = '-') {
function cleanChildrenRoutes (routes, isChild = false, routeNameSplitter = '-') {
let start = -1;

@@ -1593,3 +1593,3 @@ const regExpIndex = new RegExp(`${routeNameSplitter}index$`);

const sortRoutes = function sortRoutes(routes) {
const sortRoutes = function sortRoutes (routes) {
routes.sort((a, b) => {

@@ -1651,3 +1651,3 @@ if (!a.path.length) {

const createRoutes = function createRoutes({
const createRoutes = function createRoutes ({
files,

@@ -1657,3 +1657,3 @@ srcDir,

routeNameSplitter = '-',
supportedExtensions = ['vue', 'js', 'ts', 'tsx']
supportedExtensions = ['vue', 'js']
}) {

@@ -1703,3 +1703,3 @@ const routes = [];

// Guard dir1 from dir2 which can be indiscriminately removed
const guardDir = function guardDir(options, key1, key2) {
const guardDir = function guardDir (options, key1, key2) {
const dir1 = get_1(options, key1, false);

@@ -1737,3 +1737,3 @@ const dir2 = get_1(options, key2, false);

const promisifyRoute = function promisifyRoute(fn, ...args) {
const promisifyRoute = function promisifyRoute (fn, ...args) {
// If routes is an array

@@ -1764,3 +1764,3 @@ if (Array.isArray(fn)) {

function normalizeFunctions(obj) {
function normalizeFunctions (obj) {
if (typeof obj !== 'object' || Array.isArray(obj) || obj === null) {

@@ -1794,3 +1794,3 @@ return obj

function serializeFunction(func) {
function serializeFunction (func) {
let open = false;

@@ -1817,3 +1817,3 @@ func = normalizeFunctions(func);

const sequence = function sequence(tasks, fn) {
const sequence = function sequence (tasks, fn) {
return tasks.reduce(

@@ -1825,7 +1825,7 @@ (promise, task) => promise.then(() => fn(task)),

const parallel = function parallel(tasks, fn) {
const parallel = function parallel (tasks, fn) {
return Promise.all(tasks.map(fn))
};
const chainFn = function chainFn(base, fn) {
const chainFn = function chainFn (base, fn) {
if (typeof fn !== 'function') {

@@ -1856,3 +1856,3 @@ return base

async function promiseFinally(fn, finalFn) {
async function promiseFinally (fn, finalFn) {
let result;

@@ -1871,3 +1871,3 @@ try {

const timeout = function timeout(fn, ms, msg) {
const timeout = function timeout (fn, ms, msg) {
let timerId;

@@ -1881,11 +1881,11 @@ const warpPromise = promiseFinally(fn, () => clearTimeout(timerId));

const waitFor = function waitFor(ms) {
const waitFor = function waitFor (ms) {
return new Promise(resolve => setTimeout(resolve, ms || 0))
};
class Timer {
constructor() {
constructor () {
this._times = new Map();
}
start(name, description) {
start (name, description) {
const time = {

@@ -1900,3 +1900,3 @@ name,

end(name) {
end (name) {
if (this._times.has(name)) {

@@ -1910,3 +1910,3 @@ const time = this._times.get(name);

hrtime(start) {
hrtime (start) {
const useBigInt = typeof process.hrtime.bigint === 'function';

@@ -1922,3 +1922,3 @@ if (start) {

clear() {
clear () {
this._times.clear();

@@ -1928,3 +1928,3 @@ }

function clearRequireCache(id) {
function clearRequireCache (id) {
const entry = require.cache[id];

@@ -1946,3 +1946,3 @@ if (!entry || id.includes('node_modules')) {

function scanRequireTree(id, files = new Set()) {
function scanRequireTree (id, files = new Set()) {
const entry = require.cache[id];

@@ -2008,2 +2008,5 @@ if (!entry || id.includes('node_modules') || files.has(id)) {

// https://gist.github.com/samthor/64b114e4a4f539915a95b91ffd340acc
const safariNoModuleFix = `!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();`;
exports.ModernBrowsers = ModernBrowsers;

@@ -2040,2 +2043,3 @@ exports.Timer = Timer;

exports.relativeTo = relativeTo;
exports.safariNoModuleFix = safariNoModuleFix;
exports.scanRequireTree = scanRequireTree;

@@ -2042,0 +2046,0 @@ exports.sequence = sequence;

{
"name": "@nuxt/utils",
"version": "2.8.1",
"version": "2.9.0",
"repository": "nuxt/nuxt.js",

@@ -11,10 +11,10 @@ "license": "MIT",

"dependencies": {
"consola": "^2.7.1",
"fs-extra": "^8.0.1",
"hash-sum": "^1.0.2",
"consola": "^2.10.1",
"fs-extra": "^8.1.0",
"hash-sum": "^2.0.0",
"proper-lockfile": "^4.1.1",
"semver": "^6.1.1",
"semver": "^6.3.0",
"serialize-javascript": "^1.7.0",
"signal-exit": "^3.0.2",
"ua-parser-js": "^0.7.19"
"ua-parser-js": "^0.7.20"
},

@@ -21,0 +21,0 @@ "publishConfig": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc