@rsbuild/core 0.6.7 → 0.6.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.
- package/compiled/commander/{typings/index.d.ts → index.d.ts} +26 -24
- package/compiled/commander/index.js +3528 -1
- package/compiled/commander/package.json +1 -1
- package/compiled/connect-history-api-fallback/index.js +186 -1
- package/compiled/dotenv/{lib/main.d.ts → index.d.ts} +16 -12
- package/compiled/dotenv/index.js +458 -1
- package/compiled/dotenv/package.json +1 -1
- package/compiled/dotenv-expand/{lib/main.d.ts → index.d.ts} +9 -7
- package/compiled/dotenv-expand/index.js +146 -1
- package/compiled/dotenv-expand/package.json +1 -1
- package/compiled/http-compression/index.js +185 -1
- package/compiled/launch-editor-middleware/index.js +843 -1
- package/compiled/on-finished/index.d.ts +2 -2
- package/compiled/on-finished/index.js +390 -3
- package/compiled/on-finished/package.json +1 -1
- package/compiled/open/index.d.ts +1 -153
- package/compiled/open/index.js +526 -1
- package/compiled/open/package.json +1 -1
- package/compiled/sirv/index.d.ts +1 -0
- package/compiled/sirv/index.js +798 -1
- package/compiled/sirv/package.json +1 -1
- package/compiled/webpack-dev-middleware/index.d.ts +1 -0
- package/compiled/webpack-dev-middleware/index.js +6696 -0
- package/compiled/webpack-dev-middleware/license +20 -0
- package/compiled/webpack-dev-middleware/package.json +1 -0
- package/compiled/webpack-dev-middleware/schema-utils.js +1 -0
- package/compiled/ws/index.d.ts +7 -15
- package/compiled/ws/index.js +4885 -1
- package/compiled/ws/package.json +1 -1
- package/dist/cli/commands.js +1 -1
- package/dist/cli/prepare.js +1 -1
- package/dist/client/format.d.ts +5 -0
- package/dist/client/{formatStats.js → format.js} +22 -46
- package/dist/client/hmr.d.ts +5 -0
- package/dist/client/hmr.mjs +201 -474
- package/dist/client/overlay.mjs +208 -237
- package/dist/createContext.js +1 -1
- package/dist/index.js +1 -1
- package/dist/plugins/target.js +19 -16
- package/dist/provider/plugins/swc.js +1 -0
- package/dist/provider/shared.js +2 -2
- package/dist/server/devMiddleware.js +1 -1
- package/dist/server/devServer.js +6 -1
- package/dist/server/getDevMiddlewares.d.ts +3 -0
- package/dist/server/getDevMiddlewares.js +6 -8
- package/dist/server/helper.d.ts +4 -4
- package/dist/server/middlewares.d.ts +5 -2
- package/dist/server/middlewares.js +1 -7
- package/package.json +6 -5
- package/compiled/open/license +0 -9
- package/compiled/sirv/sirv.d.ts +0 -27
- package/dist/client/formatStats.d.ts +0 -12
- package/dist/client/hmr/createSocketUrl.d.ts +0 -12
- package/dist/client/hmr/index.d.ts +0 -4
package/compiled/dotenv/index.js
CHANGED
|
@@ -1 +1,458 @@
|
|
|
1
|
-
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ var __webpack_modules__ = ({
|
|
3
|
+
|
|
4
|
+
/***/ 396:
|
|
5
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
6
|
+
|
|
7
|
+
const fs = __nccwpck_require__(147)
|
|
8
|
+
const path = __nccwpck_require__(17)
|
|
9
|
+
const os = __nccwpck_require__(37)
|
|
10
|
+
const crypto = __nccwpck_require__(113)
|
|
11
|
+
const packageJson = __nccwpck_require__(684)
|
|
12
|
+
|
|
13
|
+
const version = packageJson.version
|
|
14
|
+
|
|
15
|
+
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg
|
|
16
|
+
|
|
17
|
+
// Parse src into an Object
|
|
18
|
+
function parse (src) {
|
|
19
|
+
const obj = {}
|
|
20
|
+
|
|
21
|
+
// Convert buffer to string
|
|
22
|
+
let lines = src.toString()
|
|
23
|
+
|
|
24
|
+
// Convert line breaks to same format
|
|
25
|
+
lines = lines.replace(/\r\n?/mg, '\n')
|
|
26
|
+
|
|
27
|
+
let match
|
|
28
|
+
while ((match = LINE.exec(lines)) != null) {
|
|
29
|
+
const key = match[1]
|
|
30
|
+
|
|
31
|
+
// Default undefined or null to empty string
|
|
32
|
+
let value = (match[2] || '')
|
|
33
|
+
|
|
34
|
+
// Remove whitespace
|
|
35
|
+
value = value.trim()
|
|
36
|
+
|
|
37
|
+
// Check if double quoted
|
|
38
|
+
const maybeQuote = value[0]
|
|
39
|
+
|
|
40
|
+
// Remove surrounding quotes
|
|
41
|
+
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2')
|
|
42
|
+
|
|
43
|
+
// Expand newlines if double quoted
|
|
44
|
+
if (maybeQuote === '"') {
|
|
45
|
+
value = value.replace(/\\n/g, '\n')
|
|
46
|
+
value = value.replace(/\\r/g, '\r')
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Add to object
|
|
50
|
+
obj[key] = value
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return obj
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function _parseVault (options) {
|
|
57
|
+
const vaultPath = _vaultPath(options)
|
|
58
|
+
|
|
59
|
+
// Parse .env.vault
|
|
60
|
+
const result = DotenvModule.configDotenv({ path: vaultPath })
|
|
61
|
+
if (!result.parsed) {
|
|
62
|
+
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)
|
|
63
|
+
err.code = 'MISSING_DATA'
|
|
64
|
+
throw err
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// handle scenario for comma separated keys - for use with key rotation
|
|
68
|
+
// example: DOTENV_KEY="dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod"
|
|
69
|
+
const keys = _dotenvKey(options).split(',')
|
|
70
|
+
const length = keys.length
|
|
71
|
+
|
|
72
|
+
let decrypted
|
|
73
|
+
for (let i = 0; i < length; i++) {
|
|
74
|
+
try {
|
|
75
|
+
// Get full key
|
|
76
|
+
const key = keys[i].trim()
|
|
77
|
+
|
|
78
|
+
// Get instructions for decrypt
|
|
79
|
+
const attrs = _instructions(result, key)
|
|
80
|
+
|
|
81
|
+
// Decrypt
|
|
82
|
+
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key)
|
|
83
|
+
|
|
84
|
+
break
|
|
85
|
+
} catch (error) {
|
|
86
|
+
// last key
|
|
87
|
+
if (i + 1 >= length) {
|
|
88
|
+
throw error
|
|
89
|
+
}
|
|
90
|
+
// try next key
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Parse decrypted .env string
|
|
95
|
+
return DotenvModule.parse(decrypted)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function _log (message) {
|
|
99
|
+
console.log(`[dotenv@${version}][INFO] ${message}`)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function _warn (message) {
|
|
103
|
+
console.log(`[dotenv@${version}][WARN] ${message}`)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function _debug (message) {
|
|
107
|
+
console.log(`[dotenv@${version}][DEBUG] ${message}`)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function _dotenvKey (options) {
|
|
111
|
+
// prioritize developer directly setting options.DOTENV_KEY
|
|
112
|
+
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
113
|
+
return options.DOTENV_KEY
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// secondary infra already contains a DOTENV_KEY environment variable
|
|
117
|
+
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
118
|
+
return process.env.DOTENV_KEY
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// fallback to empty string
|
|
122
|
+
return ''
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function _instructions (result, dotenvKey) {
|
|
126
|
+
// Parse DOTENV_KEY. Format is a URI
|
|
127
|
+
let uri
|
|
128
|
+
try {
|
|
129
|
+
uri = new URL(dotenvKey)
|
|
130
|
+
} catch (error) {
|
|
131
|
+
if (error.code === 'ERR_INVALID_URL') {
|
|
132
|
+
const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development')
|
|
133
|
+
err.code = 'INVALID_DOTENV_KEY'
|
|
134
|
+
throw err
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
throw error
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Get decrypt key
|
|
141
|
+
const key = uri.password
|
|
142
|
+
if (!key) {
|
|
143
|
+
const err = new Error('INVALID_DOTENV_KEY: Missing key part')
|
|
144
|
+
err.code = 'INVALID_DOTENV_KEY'
|
|
145
|
+
throw err
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Get environment
|
|
149
|
+
const environment = uri.searchParams.get('environment')
|
|
150
|
+
if (!environment) {
|
|
151
|
+
const err = new Error('INVALID_DOTENV_KEY: Missing environment part')
|
|
152
|
+
err.code = 'INVALID_DOTENV_KEY'
|
|
153
|
+
throw err
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Get ciphertext payload
|
|
157
|
+
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`
|
|
158
|
+
const ciphertext = result.parsed[environmentKey] // DOTENV_VAULT_PRODUCTION
|
|
159
|
+
if (!ciphertext) {
|
|
160
|
+
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)
|
|
161
|
+
err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT'
|
|
162
|
+
throw err
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return { ciphertext, key }
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function _vaultPath (options) {
|
|
169
|
+
let possibleVaultPath = null
|
|
170
|
+
|
|
171
|
+
if (options && options.path && options.path.length > 0) {
|
|
172
|
+
if (Array.isArray(options.path)) {
|
|
173
|
+
for (const filepath of options.path) {
|
|
174
|
+
if (fs.existsSync(filepath)) {
|
|
175
|
+
possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`
|
|
180
|
+
}
|
|
181
|
+
} else {
|
|
182
|
+
possibleVaultPath = path.resolve(process.cwd(), '.env.vault')
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (fs.existsSync(possibleVaultPath)) {
|
|
186
|
+
return possibleVaultPath
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return null
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function _resolveHome (envPath) {
|
|
193
|
+
return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function _configVault (options) {
|
|
197
|
+
_log('Loading env from encrypted .env.vault')
|
|
198
|
+
|
|
199
|
+
const parsed = DotenvModule._parseVault(options)
|
|
200
|
+
|
|
201
|
+
let processEnv = process.env
|
|
202
|
+
if (options && options.processEnv != null) {
|
|
203
|
+
processEnv = options.processEnv
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
DotenvModule.populate(processEnv, parsed, options)
|
|
207
|
+
|
|
208
|
+
return { parsed }
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function configDotenv (options) {
|
|
212
|
+
const dotenvPath = path.resolve(process.cwd(), '.env')
|
|
213
|
+
let encoding = 'utf8'
|
|
214
|
+
const debug = Boolean(options && options.debug)
|
|
215
|
+
|
|
216
|
+
if (options && options.encoding) {
|
|
217
|
+
encoding = options.encoding
|
|
218
|
+
} else {
|
|
219
|
+
if (debug) {
|
|
220
|
+
_debug('No encoding is specified. UTF-8 is used by default')
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
let optionPaths = [dotenvPath] // default, look for .env
|
|
225
|
+
if (options && options.path) {
|
|
226
|
+
if (!Array.isArray(options.path)) {
|
|
227
|
+
optionPaths = [_resolveHome(options.path)]
|
|
228
|
+
} else {
|
|
229
|
+
optionPaths = [] // reset default
|
|
230
|
+
for (const filepath of options.path) {
|
|
231
|
+
optionPaths.push(_resolveHome(filepath))
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Build the parsed data in a temporary object (because we need to return it). Once we have the final
|
|
237
|
+
// parsed data, we will combine it with process.env (or options.processEnv if provided).
|
|
238
|
+
let lastError
|
|
239
|
+
const parsedAll = {}
|
|
240
|
+
for (const path of optionPaths) {
|
|
241
|
+
try {
|
|
242
|
+
// Specifying an encoding returns a string instead of a buffer
|
|
243
|
+
const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }))
|
|
244
|
+
|
|
245
|
+
DotenvModule.populate(parsedAll, parsed, options)
|
|
246
|
+
} catch (e) {
|
|
247
|
+
if (debug) {
|
|
248
|
+
_debug(`Failed to load ${path} ${e.message}`)
|
|
249
|
+
}
|
|
250
|
+
lastError = e
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
let processEnv = process.env
|
|
255
|
+
if (options && options.processEnv != null) {
|
|
256
|
+
processEnv = options.processEnv
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
DotenvModule.populate(processEnv, parsedAll, options)
|
|
260
|
+
|
|
261
|
+
if (lastError) {
|
|
262
|
+
return { parsed: parsedAll, error: lastError }
|
|
263
|
+
} else {
|
|
264
|
+
return { parsed: parsedAll }
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Populates process.env from .env file
|
|
269
|
+
function config (options) {
|
|
270
|
+
// fallback to original dotenv if DOTENV_KEY is not set
|
|
271
|
+
if (_dotenvKey(options).length === 0) {
|
|
272
|
+
return DotenvModule.configDotenv(options)
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const vaultPath = _vaultPath(options)
|
|
276
|
+
|
|
277
|
+
// dotenvKey exists but .env.vault file does not exist
|
|
278
|
+
if (!vaultPath) {
|
|
279
|
+
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`)
|
|
280
|
+
|
|
281
|
+
return DotenvModule.configDotenv(options)
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return DotenvModule._configVault(options)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function decrypt (encrypted, keyStr) {
|
|
288
|
+
const key = Buffer.from(keyStr.slice(-64), 'hex')
|
|
289
|
+
let ciphertext = Buffer.from(encrypted, 'base64')
|
|
290
|
+
|
|
291
|
+
const nonce = ciphertext.subarray(0, 12)
|
|
292
|
+
const authTag = ciphertext.subarray(-16)
|
|
293
|
+
ciphertext = ciphertext.subarray(12, -16)
|
|
294
|
+
|
|
295
|
+
try {
|
|
296
|
+
const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce)
|
|
297
|
+
aesgcm.setAuthTag(authTag)
|
|
298
|
+
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`
|
|
299
|
+
} catch (error) {
|
|
300
|
+
const isRange = error instanceof RangeError
|
|
301
|
+
const invalidKeyLength = error.message === 'Invalid key length'
|
|
302
|
+
const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data'
|
|
303
|
+
|
|
304
|
+
if (isRange || invalidKeyLength) {
|
|
305
|
+
const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)')
|
|
306
|
+
err.code = 'INVALID_DOTENV_KEY'
|
|
307
|
+
throw err
|
|
308
|
+
} else if (decryptionFailed) {
|
|
309
|
+
const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY')
|
|
310
|
+
err.code = 'DECRYPTION_FAILED'
|
|
311
|
+
throw err
|
|
312
|
+
} else {
|
|
313
|
+
throw error
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// Populate process.env with parsed values
|
|
319
|
+
function populate (processEnv, parsed, options = {}) {
|
|
320
|
+
const debug = Boolean(options && options.debug)
|
|
321
|
+
const override = Boolean(options && options.override)
|
|
322
|
+
|
|
323
|
+
if (typeof parsed !== 'object') {
|
|
324
|
+
const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')
|
|
325
|
+
err.code = 'OBJECT_REQUIRED'
|
|
326
|
+
throw err
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Set process.env
|
|
330
|
+
for (const key of Object.keys(parsed)) {
|
|
331
|
+
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
332
|
+
if (override === true) {
|
|
333
|
+
processEnv[key] = parsed[key]
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (debug) {
|
|
337
|
+
if (override === true) {
|
|
338
|
+
_debug(`"${key}" is already defined and WAS overwritten`)
|
|
339
|
+
} else {
|
|
340
|
+
_debug(`"${key}" is already defined and was NOT overwritten`)
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
} else {
|
|
344
|
+
processEnv[key] = parsed[key]
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const DotenvModule = {
|
|
350
|
+
configDotenv,
|
|
351
|
+
_configVault,
|
|
352
|
+
_parseVault,
|
|
353
|
+
config,
|
|
354
|
+
decrypt,
|
|
355
|
+
parse,
|
|
356
|
+
populate
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
module.exports.configDotenv = DotenvModule.configDotenv
|
|
360
|
+
module.exports._configVault = DotenvModule._configVault
|
|
361
|
+
module.exports._parseVault = DotenvModule._parseVault
|
|
362
|
+
module.exports.config = DotenvModule.config
|
|
363
|
+
module.exports.decrypt = DotenvModule.decrypt
|
|
364
|
+
module.exports.parse = DotenvModule.parse
|
|
365
|
+
module.exports.populate = DotenvModule.populate
|
|
366
|
+
|
|
367
|
+
module.exports = DotenvModule
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
/***/ }),
|
|
371
|
+
|
|
372
|
+
/***/ 684:
|
|
373
|
+
/***/ ((module) => {
|
|
374
|
+
|
|
375
|
+
"use strict";
|
|
376
|
+
module.exports = require("./package.json");
|
|
377
|
+
|
|
378
|
+
/***/ }),
|
|
379
|
+
|
|
380
|
+
/***/ 113:
|
|
381
|
+
/***/ ((module) => {
|
|
382
|
+
|
|
383
|
+
"use strict";
|
|
384
|
+
module.exports = require("crypto");
|
|
385
|
+
|
|
386
|
+
/***/ }),
|
|
387
|
+
|
|
388
|
+
/***/ 147:
|
|
389
|
+
/***/ ((module) => {
|
|
390
|
+
|
|
391
|
+
"use strict";
|
|
392
|
+
module.exports = require("fs");
|
|
393
|
+
|
|
394
|
+
/***/ }),
|
|
395
|
+
|
|
396
|
+
/***/ 37:
|
|
397
|
+
/***/ ((module) => {
|
|
398
|
+
|
|
399
|
+
"use strict";
|
|
400
|
+
module.exports = require("os");
|
|
401
|
+
|
|
402
|
+
/***/ }),
|
|
403
|
+
|
|
404
|
+
/***/ 17:
|
|
405
|
+
/***/ ((module) => {
|
|
406
|
+
|
|
407
|
+
"use strict";
|
|
408
|
+
module.exports = require("path");
|
|
409
|
+
|
|
410
|
+
/***/ })
|
|
411
|
+
|
|
412
|
+
/******/ });
|
|
413
|
+
/************************************************************************/
|
|
414
|
+
/******/ // The module cache
|
|
415
|
+
/******/ var __webpack_module_cache__ = {};
|
|
416
|
+
/******/
|
|
417
|
+
/******/ // The require function
|
|
418
|
+
/******/ function __nccwpck_require__(moduleId) {
|
|
419
|
+
/******/ // Check if module is in cache
|
|
420
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
421
|
+
/******/ if (cachedModule !== undefined) {
|
|
422
|
+
/******/ return cachedModule.exports;
|
|
423
|
+
/******/ }
|
|
424
|
+
/******/ // Create a new module (and put it into the cache)
|
|
425
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
426
|
+
/******/ // no module.id needed
|
|
427
|
+
/******/ // no module.loaded needed
|
|
428
|
+
/******/ exports: {}
|
|
429
|
+
/******/ };
|
|
430
|
+
/******/
|
|
431
|
+
/******/ // Execute the module function
|
|
432
|
+
/******/ var threw = true;
|
|
433
|
+
/******/ try {
|
|
434
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
|
|
435
|
+
/******/ threw = false;
|
|
436
|
+
/******/ } finally {
|
|
437
|
+
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
|
438
|
+
/******/ }
|
|
439
|
+
/******/
|
|
440
|
+
/******/ // Return the exports of the module
|
|
441
|
+
/******/ return module.exports;
|
|
442
|
+
/******/ }
|
|
443
|
+
/******/
|
|
444
|
+
/************************************************************************/
|
|
445
|
+
/******/ /* webpack/runtime/compat */
|
|
446
|
+
/******/
|
|
447
|
+
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
|
448
|
+
/******/
|
|
449
|
+
/************************************************************************/
|
|
450
|
+
/******/
|
|
451
|
+
/******/ // startup
|
|
452
|
+
/******/ // Load entry module and return exports
|
|
453
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
454
|
+
/******/ var __webpack_exports__ = __nccwpck_require__(396);
|
|
455
|
+
/******/ module.exports = __webpack_exports__;
|
|
456
|
+
/******/
|
|
457
|
+
/******/ })()
|
|
458
|
+
;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"dotenv","version":"16.4.5","funding":"https://dotenvx.com","license":"BSD-2-Clause","types":"
|
|
1
|
+
{"name":"dotenv","version":"16.4.5","funding":"https://dotenvx.com","license":"BSD-2-Clause","types":"index.d.ts","type":"commonjs"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
// TypeScript Version: 3.0
|
|
2
1
|
/// <reference types="node" />
|
|
2
|
+
// TypeScript Version: 3.0
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
interface DotenvPopulateInput {
|
|
5
5
|
[name: string]: string;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
interface DotenvParseInput {
|
|
9
9
|
[name: string]: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
interface DotenvParseOutput {
|
|
13
13
|
[name: string]: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
interface DotenvExpandOptions {
|
|
17
17
|
error?: Error;
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -33,7 +33,7 @@ export interface DotenvExpandOptions {
|
|
|
33
33
|
parsed?: DotenvParseInput;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
interface DotenvExpandOutput {
|
|
37
37
|
error?: Error;
|
|
38
38
|
parsed?: DotenvParseOutput;
|
|
39
39
|
}
|
|
@@ -47,4 +47,6 @@ export interface DotenvExpandOutput {
|
|
|
47
47
|
* @returns an object with a `parsed` key if successful or `error` key if an error occurred. example: { parsed: { KEY: 'value' } }
|
|
48
48
|
*
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
declare function expand(options?: DotenvExpandOptions): DotenvExpandOutput
|
|
51
|
+
|
|
52
|
+
export { type DotenvExpandOptions, type DotenvExpandOutput, type DotenvParseInput, type DotenvParseOutput, type DotenvPopulateInput, expand };
|
|
@@ -1 +1,146 @@
|
|
|
1
|
-
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ "use strict";
|
|
3
|
+
/******/ var __webpack_modules__ = ({
|
|
4
|
+
|
|
5
|
+
/***/ 693:
|
|
6
|
+
/***/ ((module) => {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// * /
|
|
11
|
+
// * (\\)? # is it escaped with a backslash?
|
|
12
|
+
// * (\$) # literal $
|
|
13
|
+
// * (?!\() # shouldnt be followed by parenthesis
|
|
14
|
+
// * (\{?) # first brace wrap opening
|
|
15
|
+
// * ([\w.]+) # key
|
|
16
|
+
// * (?::-((?:\$\{(?:\$\{(?:\$\{[^}]*\}|[^}])*}|[^}])*}|[^}])+))? # optional default nested 3 times
|
|
17
|
+
// * (\}?) # last brace warp closing
|
|
18
|
+
// * /xi
|
|
19
|
+
|
|
20
|
+
const DOTENV_SUBSTITUTION_REGEX = /(\\)?(\$)(?!\()(\{?)([\w.]+)(?::?-((?:\$\{(?:\$\{(?:\$\{[^}]*\}|[^}])*}|[^}])*}|[^}])+))?(\}?)/gi
|
|
21
|
+
|
|
22
|
+
function _resolveEscapeSequences (value) {
|
|
23
|
+
return value.replace(/\\\$/g, '$')
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function interpolate (value, processEnv, parsed) {
|
|
27
|
+
return value.replace(DOTENV_SUBSTITUTION_REGEX, (match, escaped, dollarSign, openBrace, key, defaultValue, closeBrace) => {
|
|
28
|
+
if (escaped === '\\') {
|
|
29
|
+
return match.slice(1)
|
|
30
|
+
} else {
|
|
31
|
+
if (processEnv[key]) {
|
|
32
|
+
if (processEnv[key] === parsed[key]) {
|
|
33
|
+
return processEnv[key]
|
|
34
|
+
} else {
|
|
35
|
+
// scenario: PASSWORD_EXPAND_NESTED=${PASSWORD_EXPAND}
|
|
36
|
+
return interpolate(processEnv[key], processEnv, parsed)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (parsed[key]) {
|
|
41
|
+
// avoid recursion from EXPAND_SELF=$EXPAND_SELF
|
|
42
|
+
if (parsed[key] === value) {
|
|
43
|
+
return parsed[key]
|
|
44
|
+
} else {
|
|
45
|
+
return interpolate(parsed[key], processEnv, parsed)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (defaultValue) {
|
|
50
|
+
if (defaultValue.startsWith('$')) {
|
|
51
|
+
return interpolate(defaultValue, processEnv, parsed)
|
|
52
|
+
} else {
|
|
53
|
+
return defaultValue
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return ''
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function expand (options) {
|
|
63
|
+
let processEnv = process.env
|
|
64
|
+
if (options && options.processEnv != null) {
|
|
65
|
+
processEnv = options.processEnv
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
for (const key in options.parsed) {
|
|
69
|
+
let value = options.parsed[key]
|
|
70
|
+
|
|
71
|
+
const inProcessEnv = Object.prototype.hasOwnProperty.call(processEnv, key)
|
|
72
|
+
if (inProcessEnv) {
|
|
73
|
+
if (processEnv[key] === options.parsed[key]) {
|
|
74
|
+
// assume was set to processEnv from the .env file if the values match and therefore interpolate
|
|
75
|
+
value = interpolate(value, processEnv, options.parsed)
|
|
76
|
+
} else {
|
|
77
|
+
// do not interpolate - assume processEnv had the intended value even if containing a $.
|
|
78
|
+
value = processEnv[key]
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
// not inProcessEnv so assume interpolation for this .env key
|
|
82
|
+
value = interpolate(value, processEnv, options.parsed)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
options.parsed[key] = _resolveEscapeSequences(value)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
for (const processKey in options.parsed) {
|
|
89
|
+
processEnv[processKey] = options.parsed[processKey]
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return options
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
module.exports.expand = expand
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
/***/ })
|
|
99
|
+
|
|
100
|
+
/******/ });
|
|
101
|
+
/************************************************************************/
|
|
102
|
+
/******/ // The module cache
|
|
103
|
+
/******/ var __webpack_module_cache__ = {};
|
|
104
|
+
/******/
|
|
105
|
+
/******/ // The require function
|
|
106
|
+
/******/ function __nccwpck_require__(moduleId) {
|
|
107
|
+
/******/ // Check if module is in cache
|
|
108
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
109
|
+
/******/ if (cachedModule !== undefined) {
|
|
110
|
+
/******/ return cachedModule.exports;
|
|
111
|
+
/******/ }
|
|
112
|
+
/******/ // Create a new module (and put it into the cache)
|
|
113
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
114
|
+
/******/ // no module.id needed
|
|
115
|
+
/******/ // no module.loaded needed
|
|
116
|
+
/******/ exports: {}
|
|
117
|
+
/******/ };
|
|
118
|
+
/******/
|
|
119
|
+
/******/ // Execute the module function
|
|
120
|
+
/******/ var threw = true;
|
|
121
|
+
/******/ try {
|
|
122
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
|
|
123
|
+
/******/ threw = false;
|
|
124
|
+
/******/ } finally {
|
|
125
|
+
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
|
126
|
+
/******/ }
|
|
127
|
+
/******/
|
|
128
|
+
/******/ // Return the exports of the module
|
|
129
|
+
/******/ return module.exports;
|
|
130
|
+
/******/ }
|
|
131
|
+
/******/
|
|
132
|
+
/************************************************************************/
|
|
133
|
+
/******/ /* webpack/runtime/compat */
|
|
134
|
+
/******/
|
|
135
|
+
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
|
136
|
+
/******/
|
|
137
|
+
/************************************************************************/
|
|
138
|
+
/******/
|
|
139
|
+
/******/ // startup
|
|
140
|
+
/******/ // Load entry module and return exports
|
|
141
|
+
/******/ // This entry module used 'module' so it can't be inlined
|
|
142
|
+
/******/ var __webpack_exports__ = __nccwpck_require__(693);
|
|
143
|
+
/******/ module.exports = __webpack_exports__;
|
|
144
|
+
/******/
|
|
145
|
+
/******/ })()
|
|
146
|
+
;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"dotenv-expand","author":"motdotla","version":"11.0.6","funding":"https://dotenvx.com","license":"BSD-2-Clause","types":"
|
|
1
|
+
{"name":"dotenv-expand","author":"motdotla","version":"11.0.6","funding":"https://dotenvx.com","license":"BSD-2-Clause","types":"index.d.ts","type":"commonjs"}
|