@karmaniverous/get-dotenv 4.0.0-1 → 4.0.0-2

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.
@@ -14,13 +14,13 @@ import fs$m, { createWriteStream, createReadStream } from 'node:fs';
14
14
  import { setTimeout as setTimeout$1 } from 'node:timers/promises';
15
15
  import require$$0$2 from 'stream';
16
16
  import { debuglog } from 'node:util';
17
- import require$$2 from 'os';
18
17
  import require$$0$3 from 'constants';
19
18
  import require$$4$2 from 'util';
20
19
  import require$$5 from 'assert';
21
20
  import { webcrypto } from 'node:crypto';
22
21
  import url, { fileURLToPath as fileURLToPath$1 } from 'url';
23
22
  import 'node:fs/promises';
23
+ import require$$2 from 'os';
24
24
  import require$$3 from 'crypto';
25
25
 
26
26
  // like String.prototype.search but returns the last index
@@ -23241,7 +23241,7 @@ var constants = require$$0$3;
23241
23241
  var origCwd = process.cwd;
23242
23242
  var cwd = null;
23243
23243
 
23244
- var platform$1 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
23244
+ var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
23245
23245
 
23246
23246
  process.cwd = function() {
23247
23247
  if (!cwd)
@@ -23331,7 +23331,7 @@ function patch$1 (fs) {
23331
23331
  // failures. Also, take care to yield the scheduler. Windows scheduling gives
23332
23332
  // CPU to a busy looping process, which can cause the program causing the lock
23333
23333
  // contention to be starved of CPU by node, so the contention doesn't resolve.
23334
- if (platform$1 === "win32") {
23334
+ if (platform === "win32") {
23335
23335
  fs.rename = typeof fs.rename !== 'function' ? fs.rename
23336
23336
  : (function (fs$rename) {
23337
23337
  function rename (from, to, cb) {
@@ -26350,8 +26350,6 @@ const getDotenv = async (options = {}) => {
26350
26350
  return dotenv;
26351
26351
  };
26352
26352
 
26353
- // Discover platform.
26354
- const platform = require$$2.platform();
26355
26353
  /**
26356
26354
  * Generate a Commander CLI Command for get-dotenv.
26357
26355
  */
@@ -26414,12 +26412,18 @@ const generateGetDotenvCli = ({ logger = console, preHook, postHook, ...cliOptio
26414
26412
  .enablePositionalOptions()
26415
26413
  .passThroughOptions()
26416
26414
  .action(async (options, command) => {
26417
- const { args } = command;
26418
- if (args.length)
26419
- await execaCommand(args.join(platform === 'win32' ? '\\ ' : ' '), {
26415
+ const { args, getDotenvOptions: { debug }, } = command.parent;
26416
+ if (args.length) {
26417
+ if (debug)
26418
+ logger.log('\n*** raw shell args ***\n', args);
26419
+ const shellCommand = args.join(' ');
26420
+ if (debug)
26421
+ logger.log('\n*** shell command ***\n', shellCommand);
26422
+ await execaCommand(shellCommand, {
26420
26423
  stdio: 'inherit',
26421
26424
  shell: true,
26422
26425
  });
26426
+ }
26423
26427
  }), { isDefault: true })
26424
26428
  .hook('preSubcommand', async (thisCommand) => {
26425
26429
  const rawOptions = thisCommand.opts();
@@ -26485,8 +26489,10 @@ const generateGetDotenvCli = ({ logger = console, preHook, postHook, ...cliOptio
26485
26489
  if (postHook)
26486
26490
  await postHook(dotenv);
26487
26491
  // Execute shell command.
26488
- if (command)
26489
- await execaCommand(platform === 'win32' ? command.replace(/ /g, '\\ ') : command, {
26492
+ if (command) {
26493
+ if (cliOptions.debug)
26494
+ logger.log('\n*** shell command ***\n', command);
26495
+ await execaCommand(command, {
26490
26496
  env: {
26491
26497
  ...process.env,
26492
26498
  getDotenvOptions: JSON.stringify(getDotenvOptions),
@@ -26494,6 +26500,7 @@ const generateGetDotenvCli = ({ logger = console, preHook, postHook, ...cliOptio
26494
26500
  shell: true,
26495
26501
  stdio: 'inherit',
26496
26502
  });
26503
+ }
26497
26504
  });
26498
26505
  };
26499
26506
 
package/dist/index.cjs CHANGED
@@ -15,13 +15,13 @@ var fs$m = require('node:fs');
15
15
  var promises = require('node:timers/promises');
16
16
  var require$$0$2 = require('stream');
17
17
  var node_util = require('node:util');
18
- var require$$2 = require('os');
19
18
  var require$$0$3 = require('constants');
20
19
  var require$$4$2 = require('util');
21
20
  var require$$5 = require('assert');
22
21
  var node_crypto = require('node:crypto');
23
22
  var url = require('url');
24
23
  require('node:fs/promises');
24
+ var require$$2 = require('os');
25
25
  var require$$3 = require('crypto');
26
26
 
27
27
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
@@ -23243,7 +23243,7 @@ var constants = require$$0$3;
23243
23243
  var origCwd = process.cwd;
23244
23244
  var cwd = null;
23245
23245
 
23246
- var platform$1 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
23246
+ var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
23247
23247
 
23248
23248
  process.cwd = function() {
23249
23249
  if (!cwd)
@@ -23333,7 +23333,7 @@ function patch$1 (fs) {
23333
23333
  // failures. Also, take care to yield the scheduler. Windows scheduling gives
23334
23334
  // CPU to a busy looping process, which can cause the program causing the lock
23335
23335
  // contention to be starved of CPU by node, so the contention doesn't resolve.
23336
- if (platform$1 === "win32") {
23336
+ if (platform === "win32") {
23337
23337
  fs.rename = typeof fs.rename !== 'function' ? fs.rename
23338
23338
  : (function (fs$rename) {
23339
23339
  function rename (from, to, cb) {
@@ -26352,8 +26352,6 @@ const getDotenv = async (options = {}) => {
26352
26352
  return dotenv;
26353
26353
  };
26354
26354
 
26355
- // Discover platform.
26356
- const platform = require$$2.platform();
26357
26355
  /**
26358
26356
  * Generate a Commander CLI Command for get-dotenv.
26359
26357
  */
@@ -26416,12 +26414,18 @@ const generateGetDotenvCli = ({ logger = console, preHook, postHook, ...cliOptio
26416
26414
  .enablePositionalOptions()
26417
26415
  .passThroughOptions()
26418
26416
  .action(async (options, command) => {
26419
- const { args } = command;
26420
- if (args.length)
26421
- await execaCommand(args.join(platform === 'win32' ? '\\ ' : ' '), {
26417
+ const { args, getDotenvOptions: { debug }, } = command.parent;
26418
+ if (args.length) {
26419
+ if (debug)
26420
+ logger.log('\n*** raw shell args ***\n', args);
26421
+ const shellCommand = args.join(' ');
26422
+ if (debug)
26423
+ logger.log('\n*** shell command ***\n', shellCommand);
26424
+ await execaCommand(shellCommand, {
26422
26425
  stdio: 'inherit',
26423
26426
  shell: true,
26424
26427
  });
26428
+ }
26425
26429
  }), { isDefault: true })
26426
26430
  .hook('preSubcommand', async (thisCommand) => {
26427
26431
  const rawOptions = thisCommand.opts();
@@ -26487,8 +26491,10 @@ const generateGetDotenvCli = ({ logger = console, preHook, postHook, ...cliOptio
26487
26491
  if (postHook)
26488
26492
  await postHook(dotenv);
26489
26493
  // Execute shell command.
26490
- if (command)
26491
- await execaCommand(platform === 'win32' ? command.replace(/ /g, '\\ ') : command, {
26494
+ if (command) {
26495
+ if (cliOptions.debug)
26496
+ logger.log('\n*** shell command ***\n', command);
26497
+ await execaCommand(command, {
26492
26498
  env: {
26493
26499
  ...process.env,
26494
26500
  getDotenvOptions: JSON.stringify(getDotenvOptions),
@@ -26496,6 +26502,7 @@ const generateGetDotenvCli = ({ logger = console, preHook, postHook, ...cliOptio
26496
26502
  shell: true,
26497
26503
  stdio: 'inherit',
26498
26504
  });
26505
+ }
26499
26506
  });
26500
26507
  };
26501
26508
 
package/dist/index.d.cts CHANGED
@@ -57,6 +57,10 @@ type Logger = Record<string, (...args: unknown[]) => void>;
57
57
  * Options passed programmatically to `getDotenv` and `getDotEnvSync`.
58
58
  */
59
59
  interface GetDotenvOptions {
60
+ /**
61
+ * log internals to logger
62
+ */
63
+ debug?: boolean;
60
64
  /**
61
65
  * default target environment (used if `env` is not provided)
62
66
  */
package/dist/index.d.mts CHANGED
@@ -57,6 +57,10 @@ type Logger = Record<string, (...args: unknown[]) => void>;
57
57
  * Options passed programmatically to `getDotenv` and `getDotEnvSync`.
58
58
  */
59
59
  interface GetDotenvOptions {
60
+ /**
61
+ * log internals to logger
62
+ */
63
+ debug?: boolean;
60
64
  /**
61
65
  * default target environment (used if `env` is not provided)
62
66
  */
package/dist/index.d.ts CHANGED
@@ -57,6 +57,10 @@ type Logger = Record<string, (...args: unknown[]) => void>;
57
57
  * Options passed programmatically to `getDotenv` and `getDotEnvSync`.
58
58
  */
59
59
  interface GetDotenvOptions {
60
+ /**
61
+ * log internals to logger
62
+ */
63
+ debug?: boolean;
60
64
  /**
61
65
  * default target environment (used if `env` is not provided)
62
66
  */
package/dist/index.mjs CHANGED
@@ -13,13 +13,13 @@ import fs$m, { createWriteStream, createReadStream } from 'node:fs';
13
13
  import { setTimeout as setTimeout$1 } from 'node:timers/promises';
14
14
  import require$$0$2 from 'stream';
15
15
  import { debuglog } from 'node:util';
16
- import require$$2 from 'os';
17
16
  import require$$0$3 from 'constants';
18
17
  import require$$4$2 from 'util';
19
18
  import require$$5 from 'assert';
20
19
  import { webcrypto } from 'node:crypto';
21
20
  import url, { fileURLToPath as fileURLToPath$1 } from 'url';
22
21
  import 'node:fs/promises';
22
+ import require$$2 from 'os';
23
23
  import require$$3 from 'crypto';
24
24
 
25
25
  // like String.prototype.search but returns the last index
@@ -23240,7 +23240,7 @@ var constants = require$$0$3;
23240
23240
  var origCwd = process.cwd;
23241
23241
  var cwd = null;
23242
23242
 
23243
- var platform$1 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
23243
+ var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
23244
23244
 
23245
23245
  process.cwd = function() {
23246
23246
  if (!cwd)
@@ -23330,7 +23330,7 @@ function patch$1 (fs) {
23330
23330
  // failures. Also, take care to yield the scheduler. Windows scheduling gives
23331
23331
  // CPU to a busy looping process, which can cause the program causing the lock
23332
23332
  // contention to be starved of CPU by node, so the contention doesn't resolve.
23333
- if (platform$1 === "win32") {
23333
+ if (platform === "win32") {
23334
23334
  fs.rename = typeof fs.rename !== 'function' ? fs.rename
23335
23335
  : (function (fs$rename) {
23336
23336
  function rename (from, to, cb) {
@@ -26349,8 +26349,6 @@ const getDotenv = async (options = {}) => {
26349
26349
  return dotenv;
26350
26350
  };
26351
26351
 
26352
- // Discover platform.
26353
- const platform = require$$2.platform();
26354
26352
  /**
26355
26353
  * Generate a Commander CLI Command for get-dotenv.
26356
26354
  */
@@ -26413,12 +26411,18 @@ const generateGetDotenvCli = ({ logger = console, preHook, postHook, ...cliOptio
26413
26411
  .enablePositionalOptions()
26414
26412
  .passThroughOptions()
26415
26413
  .action(async (options, command) => {
26416
- const { args } = command;
26417
- if (args.length)
26418
- await execaCommand(args.join(platform === 'win32' ? '\\ ' : ' '), {
26414
+ const { args, getDotenvOptions: { debug }, } = command.parent;
26415
+ if (args.length) {
26416
+ if (debug)
26417
+ logger.log('\n*** raw shell args ***\n', args);
26418
+ const shellCommand = args.join(' ');
26419
+ if (debug)
26420
+ logger.log('\n*** shell command ***\n', shellCommand);
26421
+ await execaCommand(shellCommand, {
26419
26422
  stdio: 'inherit',
26420
26423
  shell: true,
26421
26424
  });
26425
+ }
26422
26426
  }), { isDefault: true })
26423
26427
  .hook('preSubcommand', async (thisCommand) => {
26424
26428
  const rawOptions = thisCommand.opts();
@@ -26484,8 +26488,10 @@ const generateGetDotenvCli = ({ logger = console, preHook, postHook, ...cliOptio
26484
26488
  if (postHook)
26485
26489
  await postHook(dotenv);
26486
26490
  // Execute shell command.
26487
- if (command)
26488
- await execaCommand(platform === 'win32' ? command.replace(/ /g, '\\ ') : command, {
26491
+ if (command) {
26492
+ if (cliOptions.debug)
26493
+ logger.log('\n*** shell command ***\n', command);
26494
+ await execaCommand(command, {
26489
26495
  env: {
26490
26496
  ...process.env,
26491
26497
  getDotenvOptions: JSON.stringify(getDotenvOptions),
@@ -26493,6 +26499,7 @@ const generateGetDotenvCli = ({ logger = console, preHook, postHook, ...cliOptio
26493
26499
  shell: true,
26494
26500
  stdio: 'inherit',
26495
26501
  });
26502
+ }
26496
26503
  });
26497
26504
  };
26498
26505
 
package/package.json CHANGED
@@ -130,5 +130,5 @@
130
130
  },
131
131
  "type": "module",
132
132
  "types": "dist/index.d.ts",
133
- "version": "4.0.0-1"
133
+ "version": "4.0.0-2"
134
134
  }