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

avet-utils

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

avet-utils - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

1

index.js

@@ -9,3 +9,2 @@ 'use strict';

require('./lib/framework'),
require('./lib/plugin'),
require('./lib/build'),

@@ -12,0 +11,0 @@ require('./lib/resolve'),

30

lib/build.js

@@ -6,19 +6,21 @@ 'use strict';

exports.IS_BUNDLED_PAGE = /^bundles[/\\]page.*\.js$/;
exports.MATCH_ROUTE_NAME = /^bundles[/\\]page[/\\](.*)\.js$/;
module.exports = {
IS_BUNDLED_PAGE: /^bundles[/\\]page.*\.js$/,
MATCH_ROUTE_NAME: /^bundles[/\\]page[/\\](.*)\.js$/,
exports.getAvailableChunks = function(distDir) {
const chunksDir = join(distDir, 'chunks');
if (!existsSync(chunksDir)) return {};
getAvailableChunks: function(distDir) {
const chunksDir = join(distDir, 'chunks');
if (!existsSync(chunksDir)) return {};
const chunksMap = {};
const chunkFiles = readdirSync(chunksDir);
const chunksMap = {};
const chunkFiles = readdirSync(chunksDir);
chunkFiles.forEach(filename => {
if (/\.js$/.test(filename)) {
chunksMap[filename] = true;
}
});
chunkFiles.forEach(filename => {
if (/\.js$/.test(filename)) {
chunksMap[filename] = true;
}
});
return chunksMap;
};
return chunksMap;
}
}
'use strict';
exports.printAndExit = function(message, code = 1) {
function printAndExit(message, code = 1) {
if (code === 0) {

@@ -13,3 +13,3 @@ console.log(message);

exports.strUpperCamelize = function(str) {
function strUpperCamelize(str) {
const property = str.replace(/[_-][a-z]/ig, s => s.substring(1).toUpperCase());

@@ -20,1 +20,6 @@ let first = property[0];

};
module.exports = {
printAndExit,
strUpperCamelize
}
'use strict';
exports.getDisplayName = function(Component) {
function getDisplayName(Component) {
return Component.displayName || Component.name || 'UnKnown';
};
exports.loadGetInitialProps = async function(Component, ctx) {
async function loadGetInitialProps(Component, ctx) {
if (!Component.getInitialProps) return {};

@@ -12,3 +12,3 @@

if (!props && (!ctx.res || !ctx.res.finished)) {
const compName = exports.getDisplayName(Component);
const compName = getDisplayName(Component);
const message = `"${compName}.getInitialProps()" should resolve to an object. But found "${props}" instead.`;

@@ -20,1 +20,6 @@ throw new Error(message);

};
module.exports = {
getDisplayName,
loadGetInitialProps
}

@@ -9,3 +9,5 @@ 'use strict';

exports.getFrameworkPath = function({ framework, baseDir }) {
module.exports = { getFrameworkPath };
function getFrameworkPath({ framework, baseDir }) {
const pkgPath = path.join(baseDir, 'package.json');

@@ -12,0 +14,0 @@ assert(fs.existsSync(pkgPath), `${pkgPath} should exist`);

@@ -5,5 +5,9 @@ 'use strict';

exports.requireModule = async function(path) {
async function requireModule(path) {
const f = await resolvePath(path);
return require(f);
};
module.exports = {
requireModule
}

@@ -7,4 +7,4 @@ 'use strict';

exports.resolveFromList = function(id, files) {
const paths = exports.getPaths(id);
function resolveFromList(id, files) {
const paths = getPaths(id);
const fileSet = new Set(files);

@@ -16,6 +16,6 @@ for (const p of paths) {

exports.resolvePath = async function(id) {
const paths = exports.getPaths(id);
async function resolvePath(id) {
const paths = getPaths(id);
for (const p of paths) {
if (await exports.isFile(p)) {
if (await isFile(p)) {
return p;

@@ -31,3 +31,3 @@ }

exports.getPaths = function(id) {
function getPaths(id) {
const i = sep === '/' ? id : id.replace(/\//g, sep);

@@ -53,3 +53,3 @@

exports.isFile = async function(p) {
async function isFile(p) {
let stat;

@@ -63,3 +63,3 @@ try {

const realpath = await exports.getTrueFilePath(p);
const realpath = await getTrueFilePath(p);
if (p !== realpath) return false;

@@ -72,3 +72,3 @@

// We assume we'll get properly normalized path names as p
exports.getTrueFilePath = async function(p) {
async function getTrueFilePath(p) {
let fsPathNormalized = p;

@@ -93,1 +93,9 @@ // OSX: HFS+ stores filenames in NFD (decomposed normal form) Unicode format,

};
module.exports = {
resolveFromList,
resolvePath,
getPaths,
isFile,
getTrueFilePath
}
{
"name": "avet-utils",
"description": "Avet utils for all avet projects",
"version": "0.5.0",
"version": "0.6.0",
"author": "okoala <dapixp@gmail.com>",

@@ -6,0 +6,0 @@ "files": [

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