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

@nuxtjs/dotenv

Package Overview
Dependencies
Maintainers
5
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuxtjs/dotenv - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

22

dist/index.js

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

var path = require('path');
var path__default = _interopDefault(path);

@@ -14,9 +15,10 @@ 'use strict';

/*
* Parses a string or buffer into an object
* @param {String|Buffer} src - source to be parsed
* @returns {Object}
* @param {(string|Buffer)} src - source to be parsed
* @returns {Object} keys and values from src
*/
function parse (src) {
var obj = {};
const obj = {};

@@ -26,12 +28,12 @@ // convert Buffers before splitting into lines and processing

// matching "KEY' and 'VAL' in 'KEY=VAL'
var keyValueArr = line.match(/^\s*([\w\.\-]+)\s*=\s*(.*)?\s*$/);
const keyValueArr = line.match(/^\s*([\w\.\-]+)\s*=\s*(.*)?\s*$/);
// matched?
if (keyValueArr != null) {
var key = keyValueArr[1];
const key = keyValueArr[1];
// default undefined or missing values to empty string
var value = keyValueArr[2] ? keyValueArr[2] : '';
let value = keyValueArr[2] || '';
// expand newlines in quoted values
var len = value ? value.length : 0;
const len = value ? value.length : 0;
if (len > 0 && value.charAt(0) === '"' && value.charAt(len - 1) === '"') {

@@ -64,2 +66,8 @@ value = value.replace(/\\n/gm, '\n');

var envFilePath = path.join(options.path, '/.env');
try {
fs.accessSync(envFilePath, fs.constants.R_OK);
} catch (err) {
// file not found, just return
return;
}
var envConfig = parse_1(fs.readFileSync(envFilePath));

@@ -66,0 +74,0 @@

{
"name": "@nuxtjs/dotenv",
"version": "1.1.0",
"version": "1.1.1",
"description": "A nuxt.js module that loads your .env file into your context options",

@@ -44,7 +44,7 @@ "license": "MIT",

"dependencies": {
"dotenv": "^4.0.0"
"dotenv": "^5.0.0"
},
"devDependencies": {
"nuxt-module-builder": "latest"
"nuxt-module-builder": "0.0.2"
}
}

@@ -66,3 +66,3 @@ # nuxtjs-dotenv-module

Note that this is the path to the **folder** where the `.env` file live, not the the `.env` file itself.
Note that this is the path to the **folder** where the `.env` file live, not to the `.env` file itself.

@@ -69,0 +69,0 @@ The path can be absolute or relative.

@@ -1,2 +0,2 @@

import { readFileSync } from 'fs'
import { readFileSync, accessSync, constants as fsconstants } from 'fs'
import { join } from 'path'

@@ -14,2 +14,8 @@ import { parse } from 'dotenv'

const envFilePath = join(options.path, '/.env')
try {
accessSync(envFilePath, fsconstants.R_OK)
} catch (err) {
// file not found, just return
return
}
const envConfig = parse(readFileSync(envFilePath))

@@ -16,0 +22,0 @@

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