@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.
Files changed (54) hide show
  1. package/compiled/commander/{typings/index.d.ts → index.d.ts} +26 -24
  2. package/compiled/commander/index.js +3528 -1
  3. package/compiled/commander/package.json +1 -1
  4. package/compiled/connect-history-api-fallback/index.js +186 -1
  5. package/compiled/dotenv/{lib/main.d.ts → index.d.ts} +16 -12
  6. package/compiled/dotenv/index.js +458 -1
  7. package/compiled/dotenv/package.json +1 -1
  8. package/compiled/dotenv-expand/{lib/main.d.ts → index.d.ts} +9 -7
  9. package/compiled/dotenv-expand/index.js +146 -1
  10. package/compiled/dotenv-expand/package.json +1 -1
  11. package/compiled/http-compression/index.js +185 -1
  12. package/compiled/launch-editor-middleware/index.js +843 -1
  13. package/compiled/on-finished/index.d.ts +2 -2
  14. package/compiled/on-finished/index.js +390 -3
  15. package/compiled/on-finished/package.json +1 -1
  16. package/compiled/open/index.d.ts +1 -153
  17. package/compiled/open/index.js +526 -1
  18. package/compiled/open/package.json +1 -1
  19. package/compiled/sirv/index.d.ts +1 -0
  20. package/compiled/sirv/index.js +798 -1
  21. package/compiled/sirv/package.json +1 -1
  22. package/compiled/webpack-dev-middleware/index.d.ts +1 -0
  23. package/compiled/webpack-dev-middleware/index.js +6696 -0
  24. package/compiled/webpack-dev-middleware/license +20 -0
  25. package/compiled/webpack-dev-middleware/package.json +1 -0
  26. package/compiled/webpack-dev-middleware/schema-utils.js +1 -0
  27. package/compiled/ws/index.d.ts +7 -15
  28. package/compiled/ws/index.js +4885 -1
  29. package/compiled/ws/package.json +1 -1
  30. package/dist/cli/commands.js +1 -1
  31. package/dist/cli/prepare.js +1 -1
  32. package/dist/client/format.d.ts +5 -0
  33. package/dist/client/{formatStats.js → format.js} +22 -46
  34. package/dist/client/hmr.d.ts +5 -0
  35. package/dist/client/hmr.mjs +201 -474
  36. package/dist/client/overlay.mjs +208 -237
  37. package/dist/createContext.js +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/plugins/target.js +19 -16
  40. package/dist/provider/plugins/swc.js +1 -0
  41. package/dist/provider/shared.js +2 -2
  42. package/dist/server/devMiddleware.js +1 -1
  43. package/dist/server/devServer.js +6 -1
  44. package/dist/server/getDevMiddlewares.d.ts +3 -0
  45. package/dist/server/getDevMiddlewares.js +6 -8
  46. package/dist/server/helper.d.ts +4 -4
  47. package/dist/server/middlewares.d.ts +5 -2
  48. package/dist/server/middlewares.js +1 -7
  49. package/package.json +6 -5
  50. package/compiled/open/license +0 -9
  51. package/compiled/sirv/sirv.d.ts +0 -27
  52. package/dist/client/formatStats.d.ts +0 -12
  53. package/dist/client/hmr/createSocketUrl.d.ts +0 -12
  54. package/dist/client/hmr/index.d.ts +0 -4
@@ -1 +1,458 @@
1
- (()=>{var e={396:(e,t,r)=>{const o=r(147);const n=r(17);const s=r(37);const c=r(113);const a=r(684);const i=a.version;const u=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function parse(e){const t={};let r=e.toString();r=r.replace(/\r\n?/gm,"\n");let o;while((o=u.exec(r))!=null){const e=o[1];let r=o[2]||"";r=r.trim();const n=r[0];r=r.replace(/^(['"`])([\s\S]*)\1$/gm,"$2");if(n==='"'){r=r.replace(/\\n/g,"\n");r=r.replace(/\\r/g,"\r")}t[e]=r}return t}function _parseVault(e){const t=_vaultPath(e);const r=l.configDotenv({path:t});if(!r.parsed){const e=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);e.code="MISSING_DATA";throw e}const o=_dotenvKey(e).split(",");const n=o.length;let s;for(let e=0;e<n;e++){try{const t=o[e].trim();const n=_instructions(r,t);s=l.decrypt(n.ciphertext,n.key);break}catch(t){if(e+1>=n){throw t}}}return l.parse(s)}function _log(e){console.log(`[dotenv@${i}][INFO] ${e}`)}function _warn(e){console.log(`[dotenv@${i}][WARN] ${e}`)}function _debug(e){console.log(`[dotenv@${i}][DEBUG] ${e}`)}function _dotenvKey(e){if(e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0){return e.DOTENV_KEY}if(process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0){return process.env.DOTENV_KEY}return""}function _instructions(e,t){let r;try{r=new URL(t)}catch(e){if(e.code==="ERR_INVALID_URL"){const e=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");e.code="INVALID_DOTENV_KEY";throw e}throw e}const o=r.password;if(!o){const e=new Error("INVALID_DOTENV_KEY: Missing key part");e.code="INVALID_DOTENV_KEY";throw e}const n=r.searchParams.get("environment");if(!n){const e=new Error("INVALID_DOTENV_KEY: Missing environment part");e.code="INVALID_DOTENV_KEY";throw e}const s=`DOTENV_VAULT_${n.toUpperCase()}`;const c=e.parsed[s];if(!c){const e=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);e.code="NOT_FOUND_DOTENV_ENVIRONMENT";throw e}return{ciphertext:c,key:o}}function _vaultPath(e){let t=null;if(e&&e.path&&e.path.length>0){if(Array.isArray(e.path)){for(const r of e.path){if(o.existsSync(r)){t=r.endsWith(".vault")?r:`${r}.vault`}}}else{t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`}}else{t=n.resolve(process.cwd(),".env.vault")}if(o.existsSync(t)){return t}return null}function _resolveHome(e){return e[0]==="~"?n.join(s.homedir(),e.slice(1)):e}function _configVault(e){_log("Loading env from encrypted .env.vault");const t=l._parseVault(e);let r=process.env;if(e&&e.processEnv!=null){r=e.processEnv}l.populate(r,t,e);return{parsed:t}}function configDotenv(e){const t=n.resolve(process.cwd(),".env");let r="utf8";const s=Boolean(e&&e.debug);if(e&&e.encoding){r=e.encoding}else{if(s){_debug("No encoding is specified. UTF-8 is used by default")}}let c=[t];if(e&&e.path){if(!Array.isArray(e.path)){c=[_resolveHome(e.path)]}else{c=[];for(const t of e.path){c.push(_resolveHome(t))}}}let a;const i={};for(const t of c){try{const n=l.parse(o.readFileSync(t,{encoding:r}));l.populate(i,n,e)}catch(e){if(s){_debug(`Failed to load ${t} ${e.message}`)}a=e}}let u=process.env;if(e&&e.processEnv!=null){u=e.processEnv}l.populate(u,i,e);if(a){return{parsed:i,error:a}}else{return{parsed:i}}}function config(e){if(_dotenvKey(e).length===0){return l.configDotenv(e)}const t=_vaultPath(e);if(!t){_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`);return l.configDotenv(e)}return l._configVault(e)}function decrypt(e,t){const r=Buffer.from(t.slice(-64),"hex");let o=Buffer.from(e,"base64");const n=o.subarray(0,12);const s=o.subarray(-16);o=o.subarray(12,-16);try{const e=c.createDecipheriv("aes-256-gcm",r,n);e.setAuthTag(s);return`${e.update(o)}${e.final()}`}catch(e){const t=e instanceof RangeError;const r=e.message==="Invalid key length";const o=e.message==="Unsupported state or unable to authenticate data";if(t||r){const e=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");e.code="INVALID_DOTENV_KEY";throw e}else if(o){const e=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");e.code="DECRYPTION_FAILED";throw e}else{throw e}}}function populate(e,t,r={}){const o=Boolean(r&&r.debug);const n=Boolean(r&&r.override);if(typeof t!=="object"){const e=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");e.code="OBJECT_REQUIRED";throw e}for(const r of Object.keys(t)){if(Object.prototype.hasOwnProperty.call(e,r)){if(n===true){e[r]=t[r]}if(o){if(n===true){_debug(`"${r}" is already defined and WAS overwritten`)}else{_debug(`"${r}" is already defined and was NOT overwritten`)}}}else{e[r]=t[r]}}}const l={configDotenv:configDotenv,_configVault:_configVault,_parseVault:_parseVault,config:config,decrypt:decrypt,parse:parse,populate:populate};e.exports.configDotenv=l.configDotenv;e.exports._configVault=l._configVault;e.exports._parseVault=l._parseVault;e.exports.config=l.config;e.exports.decrypt=l.decrypt;e.exports.parse=l.parse;e.exports.populate=l.populate;e.exports=l},684:e=>{"use strict";e.exports=require("./package.json")},113:e=>{"use strict";e.exports=require("crypto")},147:e=>{"use strict";e.exports=require("fs")},37:e=>{"use strict";e.exports=require("os")},17:e=>{"use strict";e.exports=require("path")}};var t={};function __nccwpck_require__(r){var o=t[r];if(o!==undefined){return o.exports}var n=t[r]={exports:{}};var s=true;try{e[r](n,n.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}return n.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(396);module.exports=r})();
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":"lib/main.d.ts","type":"commonjs"}
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
- export interface DotenvPopulateInput {
4
+ interface DotenvPopulateInput {
5
5
  [name: string]: string;
6
6
  }
7
7
 
8
- export interface DotenvParseInput {
8
+ interface DotenvParseInput {
9
9
  [name: string]: string;
10
10
  }
11
11
 
12
- export interface DotenvParseOutput {
12
+ interface DotenvParseOutput {
13
13
  [name: string]: string;
14
14
  }
15
15
 
16
- export interface DotenvExpandOptions {
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
- export interface DotenvExpandOutput {
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
- export function expand(options?: DotenvExpandOptions): DotenvExpandOutput
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
- (()=>{"use strict";var e={693:e=>{const r=/(\\)?(\$)(?!\()(\{?)([\w.]+)(?::?-((?:\$\{(?:\$\{(?:\$\{[^}]*\}|[^}])*}|[^}])*}|[^}])+))?(\}?)/gi;function _resolveEscapeSequences(e){return e.replace(/\\\$/g,"$")}function interpolate(e,t,n){return e.replace(r,((r,s,a,p,i,o,u)=>{if(s==="\\"){return r.slice(1)}else{if(t[i]){if(t[i]===n[i]){return t[i]}else{return interpolate(t[i],t,n)}}if(n[i]){if(n[i]===e){return n[i]}else{return interpolate(n[i],t,n)}}if(o){if(o.startsWith("$")){return interpolate(o,t,n)}else{return o}}return""}}))}function expand(e){let r=process.env;if(e&&e.processEnv!=null){r=e.processEnv}for(const t in e.parsed){let n=e.parsed[t];const s=Object.prototype.hasOwnProperty.call(r,t);if(s){if(r[t]===e.parsed[t]){n=interpolate(n,r,e.parsed)}else{n=r[t]}}else{n=interpolate(n,r,e.parsed)}e.parsed[t]=_resolveEscapeSequences(n)}for(const t in e.parsed){r[t]=e.parsed[t]}return e}e.exports.expand=expand}};var r={};function __nccwpck_require__(t){var n=r[t];if(n!==undefined){return n.exports}var s=r[t]={exports:{}};var a=true;try{e[t](s,s.exports,__nccwpck_require__);a=false}finally{if(a)delete r[t]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(693);module.exports=t})();
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":"lib/main.d.ts","type":"commonjs"}
1
+ {"name":"dotenv-expand","author":"motdotla","version":"11.0.6","funding":"https://dotenvx.com","license":"BSD-2-Clause","types":"index.d.ts","type":"commonjs"}