@adonisjs/env 3.0.2 → 3.0.6
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.
- package/LICENSE.md +1 -1
- package/README.md +4 -4
- package/build/src/Parser/index.js +6 -0
- package/build/src/Schema/boolean.js +1 -1
- package/build/src/Schema/number.js +1 -1
- package/build/src/Schema/oneOf.js +1 -1
- package/build/src/Schema/string.js +1 -1
- package/build/src/loader.js +3 -3
- package/package.json +18 -18
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The MIT License
|
|
2
2
|
|
|
3
|
-
Copyright
|
|
3
|
+
Copyright 2021 Harminder Virk, contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
6
|
|
package/README.md
CHANGED
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
|
|
14
14
|
<div align="center">
|
|
15
15
|
|
|
16
|
-
[![
|
|
16
|
+
[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url] [![synk-image]][synk-url]
|
|
17
17
|
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
20
|
<div align="center">
|
|
21
21
|
<h3>
|
|
22
|
-
<a href="https://
|
|
22
|
+
<a href="https://adonisjs.com">
|
|
23
23
|
Website
|
|
24
24
|
</a>
|
|
25
25
|
<span> | </span>
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
<sub>Built with ❤︎ by <a href="https://twitter.com/AmanVirk1">Harminder Virk</a>
|
|
38
38
|
</div>
|
|
39
39
|
|
|
40
|
-
[
|
|
41
|
-
[
|
|
40
|
+
[gh-workflow-image]: https://img.shields.io/github/workflow/status/adonisjs/env/test?style=for-the-badge
|
|
41
|
+
[gh-workflow-url]: https://github.com/adonisjs/env/actions/workflows/test.yml "Github action"
|
|
42
42
|
|
|
43
43
|
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
|
|
44
44
|
[typescript-url]: "typescript"
|
|
@@ -131,6 +131,12 @@ class EnvParser {
|
|
|
131
131
|
* Replace the ending escape sequence with a $
|
|
132
132
|
*/
|
|
133
133
|
newValue += token.replace(/\\$/, '$');
|
|
134
|
+
/**
|
|
135
|
+
* and then skip the next token if it ends with escape sequence
|
|
136
|
+
*/
|
|
137
|
+
if (token.endsWith('\\')) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
134
140
|
}
|
|
135
141
|
else {
|
|
136
142
|
/**
|
|
@@ -31,7 +31,7 @@ function castToBoolean(key, value, message) {
|
|
|
31
31
|
*/
|
|
32
32
|
function boolean(options) {
|
|
33
33
|
return function validate(key, value) {
|
|
34
|
-
helpers_1.ensureValue(key, value, options?.message);
|
|
34
|
+
(0, helpers_1.ensureValue)(key, value, options?.message);
|
|
35
35
|
return castToBoolean(key, value, options?.message);
|
|
36
36
|
};
|
|
37
37
|
}
|
|
@@ -29,7 +29,7 @@ exports.castToNumber = castToNumber;
|
|
|
29
29
|
*/
|
|
30
30
|
function number(options) {
|
|
31
31
|
return function validate(key, value) {
|
|
32
|
-
helpers_1.ensureValue(key, value, options?.message);
|
|
32
|
+
(0, helpers_1.ensureValue)(key, value, options?.message);
|
|
33
33
|
return castToNumber(key, value, options?.message);
|
|
34
34
|
};
|
|
35
35
|
}
|
|
@@ -51,7 +51,7 @@ function ensureOneOf(choices, key, value, message) {
|
|
|
51
51
|
*/
|
|
52
52
|
function oneOf(choices, options) {
|
|
53
53
|
return function validate(key, value) {
|
|
54
|
-
helpers_1.ensureValue(key, value, options?.message);
|
|
54
|
+
(0, helpers_1.ensureValue)(key, value, options?.message);
|
|
55
55
|
return ensureOneOf(choices, key, value, options?.message);
|
|
56
56
|
};
|
|
57
57
|
}
|
|
@@ -42,7 +42,7 @@ const formats = {
|
|
|
42
42
|
*/
|
|
43
43
|
function string(options) {
|
|
44
44
|
return function validate(key, value) {
|
|
45
|
-
helpers_1.ensureValue(key, value, options?.message);
|
|
45
|
+
(0, helpers_1.ensureValue)(key, value, options?.message);
|
|
46
46
|
if (options?.format) {
|
|
47
47
|
formats[options.format](key, value, options);
|
|
48
48
|
}
|
package/build/src/loader.js
CHANGED
|
@@ -18,7 +18,7 @@ const utils_1 = require("@poppinss/utils");
|
|
|
18
18
|
*/
|
|
19
19
|
function loadFile(filePath, optional = false) {
|
|
20
20
|
try {
|
|
21
|
-
return fs_1.readFileSync(filePath, 'utf-8');
|
|
21
|
+
return (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
24
24
|
if (error.code !== 'ENOENT') {
|
|
@@ -35,14 +35,14 @@ function loadFile(filePath, optional = false) {
|
|
|
35
35
|
*/
|
|
36
36
|
function envLoader(appRoot) {
|
|
37
37
|
const envPath = process.env.ENV_PATH || '.env';
|
|
38
|
-
const absPath = path_1.isAbsolute(envPath) ? envPath : path_1.join(appRoot, envPath);
|
|
38
|
+
const absPath = (0, path_1.isAbsolute)(envPath) ? envPath : (0, path_1.join)(appRoot, envPath);
|
|
39
39
|
const envContents = loadFile(absPath, true);
|
|
40
40
|
/**
|
|
41
41
|
* Optionally loading the `.env.testing` file in test environment
|
|
42
42
|
*/
|
|
43
43
|
let testEnvContent = '';
|
|
44
44
|
if (process.env.NODE_ENV === 'testing') {
|
|
45
|
-
testEnvContent = loadFile(path_1.join(appRoot, '.env.testing'), true);
|
|
45
|
+
testEnvContent = loadFile((0, path_1.join)(appRoot, '.env.testing'), true);
|
|
46
46
|
}
|
|
47
47
|
return { testEnvContent, envContents };
|
|
48
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/env",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"description": "Environment variable manager for Node.js",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -31,24 +31,24 @@
|
|
|
31
31
|
"author": "virk,adonisjs",
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@adonisjs/mrm-preset": "^
|
|
35
|
-
"@adonisjs/require-ts": "^2.0.
|
|
36
|
-
"@poppinss/dev-utils": "^
|
|
37
|
-
"@types/node": "^
|
|
38
|
-
"commitizen": "^4.2.
|
|
34
|
+
"@adonisjs/mrm-preset": "^5.0.2",
|
|
35
|
+
"@adonisjs/require-ts": "^2.0.7",
|
|
36
|
+
"@poppinss/dev-utils": "^2.0.1",
|
|
37
|
+
"@types/node": "^17.0.8",
|
|
38
|
+
"commitizen": "^4.2.4",
|
|
39
39
|
"cz-conventional-changelog": "^3.3.0",
|
|
40
|
-
"del-cli": "^
|
|
41
|
-
"eslint": "^7.
|
|
40
|
+
"del-cli": "^4.0.1",
|
|
41
|
+
"eslint": "^8.7.0",
|
|
42
42
|
"eslint-config-prettier": "^8.3.0",
|
|
43
|
-
"eslint-plugin-adonis": "^1.
|
|
44
|
-
"eslint-plugin-prettier": "^
|
|
45
|
-
"github-label-sync": "^2.0.
|
|
46
|
-
"husky": "^
|
|
47
|
-
"japa": "^
|
|
48
|
-
"mrm": "^3.0.
|
|
43
|
+
"eslint-plugin-adonis": "^2.1.0",
|
|
44
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
45
|
+
"github-label-sync": "^2.0.1",
|
|
46
|
+
"husky": "^7.0.1",
|
|
47
|
+
"japa": "^4.0.0",
|
|
48
|
+
"mrm": "^3.0.2",
|
|
49
49
|
"np": "^7.5.0",
|
|
50
|
-
"prettier": "^2.2
|
|
51
|
-
"typescript": "^4.
|
|
50
|
+
"prettier": "^2.3.2",
|
|
51
|
+
"typescript": "^4.3.5"
|
|
52
52
|
},
|
|
53
53
|
"nyc": {
|
|
54
54
|
"exclude": [
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"anyBranch": false
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@poppinss/utils": "^
|
|
77
|
-
"dotenv": "^
|
|
76
|
+
"@poppinss/utils": "^4.0.1",
|
|
77
|
+
"dotenv": "^12.0.4",
|
|
78
78
|
"validator": "^13.6.0"
|
|
79
79
|
},
|
|
80
80
|
"directories": {
|