cross-spawn-esm 1.1.0 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -101,4 +101,84 @@ Github: <https://github.com/kevva/shebang-command>
101
101
  > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
102
102
  > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
103
103
  > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
104
- > THE SOFTWARE.
104
+ > THE SOFTWARE.
105
+
106
+ ## which
107
+
108
+ Github: <https://github.com/npm/node-which>
109
+
110
+ > The ISC License
111
+ >
112
+ > Copyright (c) Isaac Z. Schlueter and Contributors
113
+ >
114
+ > Permission to use, copy, modify, and/or distribute this software for any
115
+ > purpose with or without fee is hereby granted, provided that the above
116
+ > copyright notice and this permission notice appear in all copies.
117
+ >
118
+ > THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
119
+ > WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
120
+ > MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
121
+ > ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
122
+ > WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
123
+ > ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
124
+ > IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
125
+
126
+ ## isexe
127
+
128
+ Github: <https://github.com/isaacs/isexe>
129
+
130
+ > # Blue Oak Model License
131
+ >
132
+ > Version 1.0.0
133
+ >
134
+ > ## Purpose
135
+ >
136
+ > This license gives everyone as much permission to work with
137
+ > this software as possible, while protecting contributors
138
+ > from liability.
139
+ >
140
+ > ## Acceptance
141
+ >
142
+ > In order to receive this license, you must agree to its
143
+ > rules. The rules of this license are both obligations
144
+ > under that agreement and conditions to your license.
145
+ > You must not do anything with this software that triggers
146
+ > a rule that you cannot or will not follow.
147
+ >
148
+ > ## Copyright
149
+ >
150
+ > Each contributor licenses you to do everything with this
151
+ > software that would otherwise infringe that contributor's
152
+ > copyright in it.
153
+ >
154
+ > ## Notices
155
+ >
156
+ > You must ensure that everyone who gets a copy of
157
+ > any part of this software from you, with or without
158
+ > changes, also gets the text of this license or a link to
159
+ > <https://blueoakcouncil.org/license/1.0.0>.
160
+ >
161
+ > ## Excuse
162
+ >
163
+ > If anyone notifies you in writing that you have not
164
+ > complied with [Notices](#notices), you can keep your
165
+ > license by taking all practical steps to comply within 30
166
+ > days after the notice. If you do not do so, your license
167
+ > ends immediately.
168
+ >
169
+ > ## Patent
170
+ >
171
+ > Each contributor licenses you to do everything with this
172
+ > software that would otherwise infringe any patent claims
173
+ > they can license or become able to license.
174
+ >
175
+ > ## Reliability
176
+ >
177
+ > No contributor can revoke this license.
178
+ >
179
+ > ## No Liability
180
+ >
181
+ > ***As far as the law allows, this software comes as is,
182
+ > without any warranty or condition, and no contributor
183
+ > will be liable to anyone for any damages related to this
184
+ > software or this license, under any kind of legal claim.***
package/README.md CHANGED
@@ -8,8 +8,8 @@
8
8
  This is a "fork" of [cross-spawn](https://www.npmjs.com/package/cross-spawn?activeTab=readme) ( a cross-platform solution to node's spawn
9
9
  and spawnSync ) which ports its codebase to modern ESM and TypeScript.
10
10
 
11
- This package isn't a 100% drop-in replacement for **cross-spawn** ( the API differs slightly ) but it tries to behave the same as the
12
- original package. Please refer to the [Migration guide](#migration-guide) for further explanation.
11
+ This package is a drop-in replacement for **cross-spawn** which tries to behave the same as the original package. Please refer to the
12
+ [Migration guide](#migration-guide) for further explanation.
13
13
 
14
14
  ## Installation
15
15
 
@@ -60,7 +60,7 @@ const result = spawnSync("npm", ["list", "-g", "-depth", "0"], { stdio: "inherit
60
60
 
61
61
  ## Benefits
62
62
 
63
- - Overall smaller bundle size
63
+ - Overall smaller bundle size (**~50% smaller**)
64
64
  - Tree-shaking friendly
65
65
  - Zero dependencies
66
66
  - No need for an additional types package (`@types/cross-spawn`)
@@ -144,7 +144,7 @@ Beyond the API surface, a few implementation details intentionally differ:
144
144
 
145
145
  The following behaviors are intentionally kept identical to `cross-spawn`:
146
146
 
147
- - When `options.shell` is used, parsing, escaping, and shebang enhancements are disabled matching both the original and Node.js behavior.
147
+ - When `options.shell` is used, parsing, escaping, and shebang enhancements are disabled - matching both the original and Node.js behavior.
148
148
  - Windows-only ENOENT detection: when the process exits with code `1` and the command could not be resolved, an `error` event (async) or
149
149
  `result.error` (sync) is produced.
150
150
 
package/dist/index.d.ts CHANGED
@@ -159,7 +159,7 @@ interface PathKeyOptions {
159
159
  * const PATH = process.env[key];
160
160
  * //=> '/usr/local/bin:/usr/bin:/bin'
161
161
  */
162
- declare function pathKey({ env, platform }: PathKeyOptions): string;
162
+ declare function pathKey({ env, platform }?: PathKeyOptions): string;
163
163
  //#endregion
164
164
  //#region src/parse.d.ts
165
165
  /**
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ const executableRegExp = /\.(?:exe)$/i;
13
13
  const cmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
14
14
  //#endregion
15
15
  //#region src/utils/path-key.ts
16
- function pathKey({ env = _env, platform = _platform }) {
16
+ function pathKey({ env = _env, platform = _platform } = {}) {
17
17
  return platform === "win32" ? Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") ?? "Path" : "PATH";
18
18
  }
19
19
  //#endregion
@@ -39,7 +39,7 @@ function isExecutableMode(stat) {
39
39
  const { mode, uid, gid } = stat;
40
40
  return !!(mode & execOther || mode & execGroup && groups.has(gid) || mode & execOwner && uid === myUid || mode & execOwnerOrGroup && myUid === 0);
41
41
  }
42
- function isexeSync(file, { pathExt = process.env.PATHEXT ?? "" } = {}) {
42
+ function isexeSync(file, { pathExt = _env.PATHEXT ?? "" } = {}) {
43
43
  try {
44
44
  const stat = fs.statSync(file);
45
45
  if (!stat.isFile()) return false;
@@ -186,11 +186,11 @@ function parseNonShell(parsed) {
186
186
  return parsed;
187
187
  }
188
188
  function parse(command, args, options) {
189
- if (!Array.isArray(args)) {
189
+ if (args && !Array.isArray(args)) {
190
190
  options = args;
191
191
  args = [];
192
192
  }
193
- const argsCopy = args.slice(0);
193
+ const argsCopy = args ? args.slice(0) : [];
194
194
  options = Object.assign({}, options);
195
195
  const parsed = {
196
196
  command,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cross-spawn-esm",
3
3
  "type": "module",
4
- "version": "1.1.0",
4
+ "version": "1.1.3",
5
5
  "description": "ESM version of cross-spawn package",
6
6
  "author": "Timur Bikmuhametov <tim.bic22@gmail.com>",
7
7
  "license": "MIT",
@@ -37,12 +37,15 @@
37
37
  "@timbic/prettier-config": "1.2.3",
38
38
  "@types/node": "26.6.1",
39
39
  "bumpp": "12.3.0",
40
- "eslint": "10.10.0",
40
+ "eslint": "10.11.0",
41
41
  "husky": "9.1.7",
42
42
  "lint-staged": "17.5.1",
43
- "prettier": "3.9.6",
43
+ "mkdirp": "3.0.1",
44
+ "prettier": "3.9.8",
45
+ "rimraf": "6.1.3",
44
46
  "tsdown": "0.23.0",
45
- "typescript": "6.0.3"
47
+ "typescript": "6.0.3",
48
+ "vitest": "5.0.1"
46
49
  },
47
50
  "lint-staged": {
48
51
  "*/**/*.{js,ts,md,json}": [
@@ -58,6 +61,8 @@
58
61
  "lint": "eslint --cache",
59
62
  "lint:fix": "eslint --cache --fix",
60
63
  "typecheck": "tsc --noEmit",
64
+ "test": "vitest run",
65
+ "test:watch": "vitest",
61
66
  "release": "bumpp"
62
67
  }
63
68
  }