@rsbuild/core 1.0.7 → 1.0.9

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.
@@ -1,22 +0,0 @@
1
- (The MIT License)
2
-
3
- Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- 'Software'), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1 +0,0 @@
1
- {"name":"commander","author":"TJ Holowaychuk <tj@vision-media.ca>","version":"12.1.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -1,157 +0,0 @@
1
- /// <reference types="node" />
2
- import { URL } from 'url';
3
-
4
- // TypeScript Version: 3.0
5
-
6
-
7
- interface DotenvParseOutput {
8
- [name: string]: string;
9
- }
10
-
11
- /**
12
- * Parses a string or buffer in the .env file format into an object.
13
- *
14
- * See https://dotenvx.com/docs
15
- *
16
- * @param src - contents to be parsed. example: `'DB_HOST=localhost'`
17
- * @returns an object with keys and values based on `src`. example: `{ DB_HOST : 'localhost' }`
18
- */
19
- declare function parse<T extends DotenvParseOutput = DotenvParseOutput>(
20
- src: string | Buffer
21
- ): T;
22
-
23
- interface DotenvConfigOptions {
24
- /**
25
- * Default: `path.resolve(process.cwd(), '.env')`
26
- *
27
- * Specify a custom path if your file containing environment variables is located elsewhere.
28
- * Can also be an array of strings, specifying multiple paths.
29
- *
30
- * example: `require('dotenv').config({ path: '/custom/path/to/.env' })`
31
- * example: `require('dotenv').config({ path: ['/path/to/first.env', '/path/to/second.env'] })`
32
- */
33
- path?: string | string[] | URL;
34
-
35
- /**
36
- * Default: `utf8`
37
- *
38
- * Specify the encoding of your file containing environment variables.
39
- *
40
- * example: `require('dotenv').config({ encoding: 'latin1' })`
41
- */
42
- encoding?: string;
43
-
44
- /**
45
- * Default: `false`
46
- *
47
- * Turn on logging to help debug why certain keys or values are not being set as you expect.
48
- *
49
- * example: `require('dotenv').config({ debug: process.env.DEBUG })`
50
- */
51
- debug?: boolean;
52
-
53
- /**
54
- * Default: `false`
55
- *
56
- * Override any environment variables that have already been set on your machine with values from your .env file.
57
- *
58
- * example: `require('dotenv').config({ override: true })`
59
- */
60
- override?: boolean;
61
-
62
- /**
63
- * Default: `process.env`
64
- *
65
- * Specify an object to write your secrets to. Defaults to process.env environment variables.
66
- *
67
- * example: `const processEnv = {}; require('dotenv').config({ processEnv: processEnv })`
68
- */
69
- processEnv?: DotenvPopulateInput;
70
-
71
- /**
72
- * Default: `undefined`
73
- *
74
- * Pass the DOTENV_KEY directly to config options. Defaults to looking for process.env.DOTENV_KEY environment variable. Note this only applies to decrypting .env.vault files. If passed as null or undefined, or not passed at all, dotenv falls back to its traditional job of parsing a .env file.
75
- *
76
- * example: `require('dotenv').config({ DOTENV_KEY: 'dotenv://:key_1234…@dotenvx.com/vault/.env.vault?environment=production' })`
77
- */
78
- DOTENV_KEY?: string;
79
- }
80
-
81
- interface DotenvConfigOutput {
82
- error?: Error;
83
- parsed?: DotenvParseOutput;
84
- }
85
-
86
- interface DotenvPopulateOptions {
87
- /**
88
- * Default: `false`
89
- *
90
- * Turn on logging to help debug why certain keys or values are not being set as you expect.
91
- *
92
- * example: `require('dotenv').config({ debug: process.env.DEBUG })`
93
- */
94
- debug?: boolean;
95
-
96
- /**
97
- * Default: `false`
98
- *
99
- * Override any environment variables that have already been set on your machine with values from your .env file.
100
- *
101
- * example: `require('dotenv').config({ override: true })`
102
- */
103
- override?: boolean;
104
- }
105
-
106
- interface DotenvPopulateInput {
107
- [name: string]: string;
108
- }
109
-
110
- /**
111
- * Loads `.env` file contents into process.env by default. If `DOTENV_KEY` is present, it smartly attempts to load encrypted `.env.vault` file contents into process.env.
112
- *
113
- * See https://dotenvx.com/docs
114
- *
115
- * @param options - additional options. example: `{ path: './custom/path', encoding: 'latin1', debug: true, override: false }`
116
- * @returns an object with a `parsed` key if successful or `error` key if an error occurred. example: { parsed: { KEY: 'value' } }
117
- *
118
- */
119
- declare function config(options?: DotenvConfigOptions): DotenvConfigOutput;
120
-
121
- /**
122
- * Loads `.env` file contents into process.env.
123
- *
124
- * See https://dotenvx.com/docs
125
- *
126
- * @param options - additional options. example: `{ path: './custom/path', encoding: 'latin1', debug: true, override: false }`
127
- * @returns an object with a `parsed` key if successful or `error` key if an error occurred. example: { parsed: { KEY: 'value' } }
128
- *
129
- */
130
- declare function configDotenv(options?: DotenvConfigOptions): DotenvConfigOutput;
131
-
132
- /**
133
- * Loads `source` json contents into `target` like process.env.
134
- *
135
- * See https://dotenvx.com/docs
136
- *
137
- * @param processEnv - the target JSON object. in most cases use process.env but you can also pass your own JSON object
138
- * @param parsed - the source JSON object
139
- * @param options - additional options. example: `{ debug: true, override: false }`
140
- * @returns {void}
141
- *
142
- */
143
- declare function populate(processEnv: DotenvPopulateInput, parsed: DotenvPopulateInput, options?: DotenvConfigOptions): void;
144
-
145
- /**
146
- * Decrypt ciphertext
147
- *
148
- * See https://dotenvx.com/docs
149
- *
150
- * @param encrypted - the encrypted ciphertext string
151
- * @param keyStr - the decryption key string
152
- * @returns {string}
153
- *
154
- */
155
- declare function decrypt(encrypted: string, keyStr: string): string;
156
-
157
- export { type DotenvConfigOptions, type DotenvConfigOutput, type DotenvParseOutput, type DotenvPopulateInput, type DotenvPopulateOptions, config, configDotenv, decrypt, parse, populate };
@@ -1,336 +0,0 @@
1
- (() => {
2
- var __webpack_modules__ = {
3
- 396: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
- const fs = __nccwpck_require__(147);
5
- const path = __nccwpck_require__(17);
6
- const os = __nccwpck_require__(37);
7
- const crypto = __nccwpck_require__(113);
8
- const packageJson = __nccwpck_require__(684);
9
- const version = packageJson.version;
10
- const LINE =
11
- /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
12
- function parse(src) {
13
- const obj = {};
14
- let lines = src.toString();
15
- lines = lines.replace(/\r\n?/gm, "\n");
16
- let match;
17
- while ((match = LINE.exec(lines)) != null) {
18
- const key = match[1];
19
- let value = match[2] || "";
20
- value = value.trim();
21
- const maybeQuote = value[0];
22
- value = value.replace(/^(['"`])([\s\S]*)\1$/gm, "$2");
23
- if (maybeQuote === '"') {
24
- value = value.replace(/\\n/g, "\n");
25
- value = value.replace(/\\r/g, "\r");
26
- }
27
- obj[key] = value;
28
- }
29
- return obj;
30
- }
31
- function _parseVault(options) {
32
- const vaultPath = _vaultPath(options);
33
- const result = DotenvModule.configDotenv({ path: vaultPath });
34
- if (!result.parsed) {
35
- const err = new Error(
36
- `MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`,
37
- );
38
- err.code = "MISSING_DATA";
39
- throw err;
40
- }
41
- const keys = _dotenvKey(options).split(",");
42
- const length = keys.length;
43
- let decrypted;
44
- for (let i = 0; i < length; i++) {
45
- try {
46
- const key = keys[i].trim();
47
- const attrs = _instructions(result, key);
48
- decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
49
- break;
50
- } catch (error) {
51
- if (i + 1 >= length) {
52
- throw error;
53
- }
54
- }
55
- }
56
- return DotenvModule.parse(decrypted);
57
- }
58
- function _log(message) {
59
- console.log(`[dotenv@${version}][INFO] ${message}`);
60
- }
61
- function _warn(message) {
62
- console.log(`[dotenv@${version}][WARN] ${message}`);
63
- }
64
- function _debug(message) {
65
- console.log(`[dotenv@${version}][DEBUG] ${message}`);
66
- }
67
- function _dotenvKey(options) {
68
- if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
69
- return options.DOTENV_KEY;
70
- }
71
- if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
72
- return process.env.DOTENV_KEY;
73
- }
74
- return "";
75
- }
76
- function _instructions(result, dotenvKey) {
77
- let uri;
78
- try {
79
- uri = new URL(dotenvKey);
80
- } catch (error) {
81
- if (error.code === "ERR_INVALID_URL") {
82
- const err = new Error(
83
- "INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development",
84
- );
85
- err.code = "INVALID_DOTENV_KEY";
86
- throw err;
87
- }
88
- throw error;
89
- }
90
- const key = uri.password;
91
- if (!key) {
92
- const err = new Error("INVALID_DOTENV_KEY: Missing key part");
93
- err.code = "INVALID_DOTENV_KEY";
94
- throw err;
95
- }
96
- const environment = uri.searchParams.get("environment");
97
- if (!environment) {
98
- const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
99
- err.code = "INVALID_DOTENV_KEY";
100
- throw err;
101
- }
102
- const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
103
- const ciphertext = result.parsed[environmentKey];
104
- if (!ciphertext) {
105
- const err = new Error(
106
- `NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`,
107
- );
108
- err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
109
- throw err;
110
- }
111
- return { ciphertext, key };
112
- }
113
- function _vaultPath(options) {
114
- let possibleVaultPath = null;
115
- if (options && options.path && options.path.length > 0) {
116
- if (Array.isArray(options.path)) {
117
- for (const filepath of options.path) {
118
- if (fs.existsSync(filepath)) {
119
- possibleVaultPath = filepath.endsWith(".vault")
120
- ? filepath
121
- : `${filepath}.vault`;
122
- }
123
- }
124
- } else {
125
- possibleVaultPath = options.path.endsWith(".vault")
126
- ? options.path
127
- : `${options.path}.vault`;
128
- }
129
- } else {
130
- possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
131
- }
132
- if (fs.existsSync(possibleVaultPath)) {
133
- return possibleVaultPath;
134
- }
135
- return null;
136
- }
137
- function _resolveHome(envPath) {
138
- return envPath[0] === "~"
139
- ? path.join(os.homedir(), envPath.slice(1))
140
- : envPath;
141
- }
142
- function _configVault(options) {
143
- _log("Loading env from encrypted .env.vault");
144
- const parsed = DotenvModule._parseVault(options);
145
- let processEnv = process.env;
146
- if (options && options.processEnv != null) {
147
- processEnv = options.processEnv;
148
- }
149
- DotenvModule.populate(processEnv, parsed, options);
150
- return { parsed };
151
- }
152
- function configDotenv(options) {
153
- const dotenvPath = path.resolve(process.cwd(), ".env");
154
- let encoding = "utf8";
155
- const debug = Boolean(options && options.debug);
156
- if (options && options.encoding) {
157
- encoding = options.encoding;
158
- } else {
159
- if (debug) {
160
- _debug("No encoding is specified. UTF-8 is used by default");
161
- }
162
- }
163
- let optionPaths = [dotenvPath];
164
- if (options && options.path) {
165
- if (!Array.isArray(options.path)) {
166
- optionPaths = [_resolveHome(options.path)];
167
- } else {
168
- optionPaths = [];
169
- for (const filepath of options.path) {
170
- optionPaths.push(_resolveHome(filepath));
171
- }
172
- }
173
- }
174
- let lastError;
175
- const parsedAll = {};
176
- for (const path of optionPaths) {
177
- try {
178
- const parsed = DotenvModule.parse(
179
- fs.readFileSync(path, { encoding }),
180
- );
181
- DotenvModule.populate(parsedAll, parsed, options);
182
- } catch (e) {
183
- if (debug) {
184
- _debug(`Failed to load ${path} ${e.message}`);
185
- }
186
- lastError = e;
187
- }
188
- }
189
- let processEnv = process.env;
190
- if (options && options.processEnv != null) {
191
- processEnv = options.processEnv;
192
- }
193
- DotenvModule.populate(processEnv, parsedAll, options);
194
- if (lastError) {
195
- return { parsed: parsedAll, error: lastError };
196
- } else {
197
- return { parsed: parsedAll };
198
- }
199
- }
200
- function config(options) {
201
- if (_dotenvKey(options).length === 0) {
202
- return DotenvModule.configDotenv(options);
203
- }
204
- const vaultPath = _vaultPath(options);
205
- if (!vaultPath) {
206
- _warn(
207
- `You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`,
208
- );
209
- return DotenvModule.configDotenv(options);
210
- }
211
- return DotenvModule._configVault(options);
212
- }
213
- function decrypt(encrypted, keyStr) {
214
- const key = Buffer.from(keyStr.slice(-64), "hex");
215
- let ciphertext = Buffer.from(encrypted, "base64");
216
- const nonce = ciphertext.subarray(0, 12);
217
- const authTag = ciphertext.subarray(-16);
218
- ciphertext = ciphertext.subarray(12, -16);
219
- try {
220
- const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
221
- aesgcm.setAuthTag(authTag);
222
- return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
223
- } catch (error) {
224
- const isRange = error instanceof RangeError;
225
- const invalidKeyLength = error.message === "Invalid key length";
226
- const decryptionFailed =
227
- error.message ===
228
- "Unsupported state or unable to authenticate data";
229
- if (isRange || invalidKeyLength) {
230
- const err = new Error(
231
- "INVALID_DOTENV_KEY: It must be 64 characters long (or more)",
232
- );
233
- err.code = "INVALID_DOTENV_KEY";
234
- throw err;
235
- } else if (decryptionFailed) {
236
- const err = new Error(
237
- "DECRYPTION_FAILED: Please check your DOTENV_KEY",
238
- );
239
- err.code = "DECRYPTION_FAILED";
240
- throw err;
241
- } else {
242
- throw error;
243
- }
244
- }
245
- }
246
- function populate(processEnv, parsed, options = {}) {
247
- const debug = Boolean(options && options.debug);
248
- const override = Boolean(options && options.override);
249
- if (typeof parsed !== "object") {
250
- const err = new Error(
251
- "OBJECT_REQUIRED: Please check the processEnv argument being passed to populate",
252
- );
253
- err.code = "OBJECT_REQUIRED";
254
- throw err;
255
- }
256
- for (const key of Object.keys(parsed)) {
257
- if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
258
- if (override === true) {
259
- processEnv[key] = parsed[key];
260
- }
261
- if (debug) {
262
- if (override === true) {
263
- _debug(`"${key}" is already defined and WAS overwritten`);
264
- } else {
265
- _debug(`"${key}" is already defined and was NOT overwritten`);
266
- }
267
- }
268
- } else {
269
- processEnv[key] = parsed[key];
270
- }
271
- }
272
- }
273
- const DotenvModule = {
274
- configDotenv,
275
- _configVault,
276
- _parseVault,
277
- config,
278
- decrypt,
279
- parse,
280
- populate,
281
- };
282
- module.exports.configDotenv = DotenvModule.configDotenv;
283
- module.exports._configVault = DotenvModule._configVault;
284
- module.exports._parseVault = DotenvModule._parseVault;
285
- module.exports.config = DotenvModule.config;
286
- module.exports.decrypt = DotenvModule.decrypt;
287
- module.exports.parse = DotenvModule.parse;
288
- module.exports.populate = DotenvModule.populate;
289
- module.exports = DotenvModule;
290
- },
291
- 684: (module) => {
292
- "use strict";
293
- module.exports = require("./package.json");
294
- },
295
- 113: (module) => {
296
- "use strict";
297
- module.exports = require("crypto");
298
- },
299
- 147: (module) => {
300
- "use strict";
301
- module.exports = require("fs");
302
- },
303
- 37: (module) => {
304
- "use strict";
305
- module.exports = require("os");
306
- },
307
- 17: (module) => {
308
- "use strict";
309
- module.exports = require("path");
310
- },
311
- };
312
- var __webpack_module_cache__ = {};
313
- function __nccwpck_require__(moduleId) {
314
- var cachedModule = __webpack_module_cache__[moduleId];
315
- if (cachedModule !== undefined) {
316
- return cachedModule.exports;
317
- }
318
- var module = (__webpack_module_cache__[moduleId] = { exports: {} });
319
- var threw = true;
320
- try {
321
- __webpack_modules__[moduleId](
322
- module,
323
- module.exports,
324
- __nccwpck_require__,
325
- );
326
- threw = false;
327
- } finally {
328
- if (threw) delete __webpack_module_cache__[moduleId];
329
- }
330
- return module.exports;
331
- }
332
- if (typeof __nccwpck_require__ !== "undefined")
333
- __nccwpck_require__.ab = __dirname + "/";
334
- var __webpack_exports__ = __nccwpck_require__(396);
335
- module.exports = __webpack_exports__;
336
- })();
@@ -1,23 +0,0 @@
1
- Copyright (c) 2015, Scott Motte
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without
5
- modification, are permitted provided that the following conditions are met:
6
-
7
- * Redistributions of source code must retain the above copyright notice, this
8
- list of conditions and the following disclaimer.
9
-
10
- * Redistributions in binary form must reproduce the above copyright notice,
11
- this list of conditions and the following disclaimer in the documentation
12
- and/or other materials provided with the distribution.
13
-
14
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1 +0,0 @@
1
- {"name":"dotenv","version":"16.4.5","funding":"https://dotenvx.com","license":"BSD-2-Clause","types":"index.d.ts","type":"commonjs"}
@@ -1,52 +0,0 @@
1
- /// <reference types="node" />
2
- // TypeScript Version: 3.0
3
-
4
- interface DotenvPopulateInput {
5
- [name: string]: string;
6
- }
7
-
8
- interface DotenvParseInput {
9
- [name: string]: string;
10
- }
11
-
12
- interface DotenvParseOutput {
13
- [name: string]: string;
14
- }
15
-
16
- interface DotenvExpandOptions {
17
- error?: Error;
18
-
19
- /**
20
- * Default: `process.env`
21
- *
22
- * Specify an object to write your secrets to. Defaults to process.env environment variables.
23
- *
24
- * example: `const processEnv = {}; require('dotenv').config({ processEnv: processEnv })`
25
- */
26
- processEnv?: DotenvPopulateInput;
27
-
28
- /**
29
- * Default: `object`
30
- *
31
- * Object coming from dotenv's parsed result.
32
- */
33
- parsed?: DotenvParseInput;
34
- }
35
-
36
- interface DotenvExpandOutput {
37
- error?: Error;
38
- parsed?: DotenvParseOutput;
39
- }
40
-
41
- /**
42
- * Adds variable expansion on top of dotenv.
43
- *
44
- * See https://docs.dotenv.org
45
- *
46
- * @param options - additional options. example: `{ processEnv: {}, error: null, parsed: { { KEY: 'value' } }`
47
- * @returns an object with a `parsed` key if successful or `error` key if an error occurred. example: { parsed: { KEY: 'value' } }
48
- *
49
- */
50
- declare function expand(options?: DotenvExpandOptions): DotenvExpandOutput
51
-
52
- export { type DotenvExpandOptions, type DotenvExpandOutput, type DotenvParseInput, type DotenvParseOutput, type DotenvPopulateInput, expand };