@socketsecurity/lib 5.24.0 → 5.25.0
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/CHANGELOG.md +6 -0
- package/dist/archives.js +4 -4
- package/dist/constants/socket.js +1 -1
- package/dist/debug.js +5 -5
- package/dist/dlx/manifest.js +18 -20
- package/dist/errors.js +2 -3
- package/dist/external/@npmcli/package-json/lib/read-package.js +3 -2
- package/dist/external/@npmcli/package-json.js +19 -18
- package/dist/external/@npmcli/promise-spawn.js +3 -2
- package/dist/external/adm-zip.js +3 -2
- package/dist/external/debug.js +2 -1
- package/dist/external/external-pack.js +4 -3
- package/dist/external/fast-sort.js +2 -1
- package/dist/external/get-east-asian-width.js +3 -2
- package/dist/external/npm-pack.js +36 -35
- package/dist/external/p-map.js +6 -5
- package/dist/external/pico-pack.js +24 -23
- package/dist/external/supports-color.js +3 -1
- package/dist/external/tar-fs.js +9 -8
- package/dist/external/which.js +3 -2
- package/dist/external/yargs-parser.js +3 -2
- package/dist/fs.js +5 -4
- package/dist/git.js +3 -3
- package/dist/github.d.ts +3 -3
- package/dist/github.js +3 -3
- package/dist/http-request.d.ts +2 -2
- package/dist/json/edit.js +9 -9
- package/dist/json/parse.d.ts +2 -2
- package/dist/json/parse.js +2 -2
- package/dist/logger.js +5 -6
- package/dist/objects.js +28 -39
- package/dist/packages/edit.js +3 -3
- package/dist/packages/isolation.js +3 -3
- package/dist/primordials.d.ts +337 -0
- package/dist/primordials.js +828 -0
- package/dist/process-lock.js +11 -11
- package/dist/releases/github.js +4 -4
- package/dist/signal-exit.js +4 -4
- package/dist/spawn.d.ts +13 -13
- package/dist/stdio/stderr.d.ts +2 -2
- package/dist/suppress-warnings.js +2 -2
- package/package.json +12 -4
package/dist/fs.js
CHANGED
|
@@ -64,6 +64,7 @@ module.exports = __toCommonJS(fs_exports);
|
|
|
64
64
|
var import_node_process = __toESM(require("node:process"));
|
|
65
65
|
var import_arrays = require("./arrays");
|
|
66
66
|
var import_process = require("./constants/process");
|
|
67
|
+
var import_errors = require("./errors");
|
|
67
68
|
var import_globs = require("./globs");
|
|
68
69
|
var import_parse = require("./json/parse");
|
|
69
70
|
var import_objects = require("./objects");
|
|
@@ -608,8 +609,8 @@ function safeDeleteSync(filepath, options) {
|
|
|
608
609
|
onlyFiles: false
|
|
609
610
|
});
|
|
610
611
|
return;
|
|
611
|
-
} catch (
|
|
612
|
-
lastError =
|
|
612
|
+
} catch (e) {
|
|
613
|
+
lastError = e;
|
|
613
614
|
if (attempt < maxRetries) {
|
|
614
615
|
const waitMs = delay;
|
|
615
616
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, waitMs);
|
|
@@ -627,7 +628,7 @@ async function safeMkdir(path, options) {
|
|
|
627
628
|
try {
|
|
628
629
|
await fs.promises.mkdir(path, opts);
|
|
629
630
|
} catch (e) {
|
|
630
|
-
if (
|
|
631
|
+
if (!(0, import_errors.isErrnoException)(e) || e.code !== "EEXIST") {
|
|
631
632
|
throw e;
|
|
632
633
|
}
|
|
633
634
|
}
|
|
@@ -638,7 +639,7 @@ function safeMkdirSync(path, options) {
|
|
|
638
639
|
try {
|
|
639
640
|
fs.mkdirSync(path, opts);
|
|
640
641
|
} catch (e) {
|
|
641
|
-
if (
|
|
642
|
+
if (!(0, import_errors.isErrnoException)(e) || e.code !== "EEXIST") {
|
|
642
643
|
throw e;
|
|
643
644
|
}
|
|
644
645
|
}
|
package/dist/git.js
CHANGED
|
@@ -91,10 +91,10 @@ function getCachedRealpath(pathname) {
|
|
|
91
91
|
let resolved;
|
|
92
92
|
try {
|
|
93
93
|
resolved = fs.realpathSync(pathname);
|
|
94
|
-
} catch (
|
|
95
|
-
const code =
|
|
94
|
+
} catch (e) {
|
|
95
|
+
const code = e.code;
|
|
96
96
|
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
97
|
-
throw
|
|
97
|
+
throw e;
|
|
98
98
|
}
|
|
99
99
|
resolved = pathname;
|
|
100
100
|
}
|
package/dist/github.d.ts
CHANGED
|
@@ -344,9 +344,9 @@ export declare function fetchGhsaDetails(ghsaId: string, options?: GitHubFetchOp
|
|
|
344
344
|
* // Handle rate limit errors
|
|
345
345
|
* try {
|
|
346
346
|
* await fetchGitHub('https://api.github.com/repos/owner/repo')
|
|
347
|
-
* } catch (
|
|
348
|
-
* if (
|
|
349
|
-
* console.error(`Rate limited until ${
|
|
347
|
+
* } catch (e) {
|
|
348
|
+
* if (e.status === 403 && e.resetTime) {
|
|
349
|
+
* console.error(`Rate limited until ${e.resetTime}`)
|
|
350
350
|
* }
|
|
351
351
|
* }
|
|
352
352
|
* ```
|
package/dist/github.js
CHANGED
|
@@ -164,12 +164,12 @@ async function fetchGitHub(url, options) {
|
|
|
164
164
|
}
|
|
165
165
|
try {
|
|
166
166
|
return JSON.parse(response.body.toString("utf8"));
|
|
167
|
-
} catch (
|
|
167
|
+
} catch (e) {
|
|
168
168
|
throw new Error(
|
|
169
|
-
`Failed to parse GitHub API response: ${(0, import_errors.errorMessage)(
|
|
169
|
+
`Failed to parse GitHub API response: ${(0, import_errors.errorMessage)(e)}
|
|
170
170
|
URL: ${url}
|
|
171
171
|
Response may be malformed or incomplete.`,
|
|
172
|
-
{ cause:
|
|
172
|
+
{ cause: e }
|
|
173
173
|
);
|
|
174
174
|
}
|
|
175
175
|
}
|
package/dist/http-request.d.ts
CHANGED
|
@@ -674,8 +674,8 @@ export interface FetchChecksumsOptions {
|
|
|
674
674
|
* ```typescript
|
|
675
675
|
* try {
|
|
676
676
|
* await fetch('https://api.example.com')
|
|
677
|
-
* } catch (
|
|
678
|
-
* console.error(enrichErrorMessage('https://api.example.com', 'GET',
|
|
677
|
+
* } catch (e) {
|
|
678
|
+
* console.error(enrichErrorMessage('https://api.example.com', 'GET', e))
|
|
679
679
|
* }
|
|
680
680
|
* ```
|
|
681
681
|
*/
|
package/dist/json/edit.js
CHANGED
|
@@ -58,11 +58,11 @@ async function readFile(filepath) {
|
|
|
58
58
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
59
59
|
try {
|
|
60
60
|
return await fsPromises.readFile(filepath, "utf8");
|
|
61
|
-
} catch (
|
|
61
|
+
} catch (e) {
|
|
62
62
|
const isLastAttempt = attempt === maxRetries;
|
|
63
|
-
const isEnoent = (0, import_errors.isErrnoException)(
|
|
63
|
+
const isEnoent = (0, import_errors.isErrnoException)(e) && e.code === "ENOENT";
|
|
64
64
|
if (!isEnoent || isLastAttempt) {
|
|
65
|
-
throw
|
|
65
|
+
throw e;
|
|
66
66
|
}
|
|
67
67
|
const delay = import_node_process.default.platform === "win32" ? 50 * (attempt + 1) : 20;
|
|
68
68
|
await (0, import_promises.setTimeout)(delay);
|
|
@@ -91,11 +91,11 @@ async function retryWrite(filepath, content, retries = 3, baseDelay = 10) {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
return;
|
|
94
|
-
} catch (
|
|
94
|
+
} catch (e) {
|
|
95
95
|
const isLastAttempt = attempt === retries;
|
|
96
|
-
const isRetriableError = (0, import_errors.isErrnoException)(
|
|
96
|
+
const isRetriableError = (0, import_errors.isErrnoException)(e) && (e.code === "EPERM" || e.code === "EBUSY" || e.code === "ENOENT");
|
|
97
97
|
if (!isRetriableError || isLastAttempt) {
|
|
98
|
-
throw
|
|
98
|
+
throw e;
|
|
99
99
|
}
|
|
100
100
|
const delay = baseDelay * 2 ** attempt;
|
|
101
101
|
await (0, import_promises.setTimeout)(delay);
|
|
@@ -168,11 +168,11 @@ function getEditableJsonClass() {
|
|
|
168
168
|
let parseErr;
|
|
169
169
|
try {
|
|
170
170
|
this._readFileContent = await readFile(this.filename);
|
|
171
|
-
} catch (
|
|
171
|
+
} catch (e) {
|
|
172
172
|
if (!create) {
|
|
173
|
-
throw
|
|
173
|
+
throw e;
|
|
174
174
|
}
|
|
175
|
-
parseErr =
|
|
175
|
+
parseErr = e;
|
|
176
176
|
}
|
|
177
177
|
if (parseErr) {
|
|
178
178
|
throw parseErr;
|
package/dist/json/parse.d.ts
CHANGED
|
@@ -56,8 +56,8 @@ export declare function isJsonPrimitive(value: unknown): value is JsonPrimitive;
|
|
|
56
56
|
* // Enhanced error messages with filepath
|
|
57
57
|
* try {
|
|
58
58
|
* jsonParse('invalid', { filepath: 'config.json' })
|
|
59
|
-
* } catch (
|
|
60
|
-
* console.error(
|
|
59
|
+
* } catch (e) {
|
|
60
|
+
* console.error(e.message)
|
|
61
61
|
* // => "config.json: Unexpected token i in JSON at position 0"
|
|
62
62
|
* }
|
|
63
63
|
*
|
package/dist/json/parse.js
CHANGED
|
@@ -93,8 +93,8 @@ function safeJsonParse(jsonString, schema, options = {}) {
|
|
|
93
93
|
let parsed;
|
|
94
94
|
try {
|
|
95
95
|
parsed = allowPrototype ? JSONParse(jsonString) : JSONParse(jsonString, prototypePollutionReviver);
|
|
96
|
-
} catch (
|
|
97
|
-
throw new Error(`Failed to parse JSON: ${
|
|
96
|
+
} catch (e) {
|
|
97
|
+
throw new Error(`Failed to parse JSON: ${e}`);
|
|
98
98
|
}
|
|
99
99
|
if (schema) {
|
|
100
100
|
const result = (0, import_validate.validateSchema)(schema, parsed);
|
package/dist/logger.js
CHANGED
|
@@ -40,12 +40,11 @@ module.exports = __toCommonJS(logger_exports);
|
|
|
40
40
|
var import_node_process = __toESM(require("node:process"));
|
|
41
41
|
var import_is_unicode_supported = __toESM(require("./external/@socketregistry/is-unicode-supported"));
|
|
42
42
|
var import_yoctocolors_cjs = __toESM(require("./external/yoctocolors-cjs"));
|
|
43
|
+
var import_primordials = require("./primordials");
|
|
43
44
|
var import_strings = require("./strings");
|
|
44
45
|
var import_context = require("./themes/context");
|
|
45
46
|
var import_themes = require("./themes/themes");
|
|
46
47
|
const globalConsole = console;
|
|
47
|
-
const ReflectApply = Reflect.apply;
|
|
48
|
-
const ReflectConstruct = Reflect.construct;
|
|
49
48
|
let _Console;
|
|
50
49
|
let _consoleSymbols;
|
|
51
50
|
let _kGroupIndentationWidthSymbol;
|
|
@@ -226,7 +225,7 @@ class Logger {
|
|
|
226
225
|
const targetStream = stream || (methodName === "log" ? "stdout" : "stderr");
|
|
227
226
|
const indent = this.#getIndent(targetStream);
|
|
228
227
|
const logArgs = hasText ? [(0, import_strings.applyLinePrefix)(text, { prefix: indent }), ...args.slice(1)] : args;
|
|
229
|
-
ReflectApply(
|
|
228
|
+
(0, import_primordials.ReflectApply)(
|
|
230
229
|
con[methodName],
|
|
231
230
|
con,
|
|
232
231
|
logArgs
|
|
@@ -851,7 +850,7 @@ class Logger {
|
|
|
851
850
|
group(...label) {
|
|
852
851
|
const { length } = label;
|
|
853
852
|
if (length) {
|
|
854
|
-
ReflectApply(this.log, this, label);
|
|
853
|
+
(0, import_primordials.ReflectApply)(this.log, this, label);
|
|
855
854
|
}
|
|
856
855
|
this.indent(this[getKGroupIndentationWidthSymbol()]);
|
|
857
856
|
if (length) {
|
|
@@ -880,7 +879,7 @@ class Logger {
|
|
|
880
879
|
// groupCollapsed is an alias of group.
|
|
881
880
|
// https://nodejs.org/api/console.html#consolegroupcollapsed
|
|
882
881
|
groupCollapsed(...label) {
|
|
883
|
-
return ReflectApply(this.group, this, label);
|
|
882
|
+
return (0, import_primordials.ReflectApply)(this.group, this, label);
|
|
884
883
|
}
|
|
885
884
|
/**
|
|
886
885
|
* Ends the current log group and decreases indentation.
|
|
@@ -1396,7 +1395,7 @@ function constructConsole(...args) {
|
|
|
1396
1395
|
const nodeConsole = require("node:console");
|
|
1397
1396
|
_Console = nodeConsole.Console;
|
|
1398
1397
|
}
|
|
1399
|
-
return ReflectConstruct(
|
|
1398
|
+
return (0, import_primordials.ReflectConstruct)(
|
|
1400
1399
|
_Console,
|
|
1401
1400
|
// eslint-disable-line no-undef
|
|
1402
1401
|
args
|
package/dist/objects.js
CHANGED
|
@@ -43,46 +43,35 @@ __export(objects_exports, {
|
|
|
43
43
|
module.exports = __toCommonJS(objects_exports);
|
|
44
44
|
var import_core = require("./constants/core");
|
|
45
45
|
var import_arrays = require("./arrays");
|
|
46
|
+
var import_primordials = require("./primordials");
|
|
46
47
|
var import_sorts = require("./sorts");
|
|
47
|
-
const ObjectDefineProperties = Object.defineProperties;
|
|
48
|
-
const ObjectDefineProperty = Object.defineProperty;
|
|
49
|
-
const ObjectFreeze = Object.freeze;
|
|
50
|
-
const ObjectFromEntries = Object.fromEntries;
|
|
51
|
-
const ObjectGetOwnPropertyDescriptors = Object.getOwnPropertyDescriptors;
|
|
52
|
-
const ObjectGetOwnPropertyNames = Object.getOwnPropertyNames;
|
|
53
|
-
const ObjectGetPrototypeOf = Object.getPrototypeOf;
|
|
54
|
-
const ObjectHasOwn = Object.hasOwn;
|
|
55
|
-
const ObjectKeys = Object.keys;
|
|
56
|
-
const ObjectPrototype = Object.prototype;
|
|
57
|
-
const ObjectSetPrototypeOf = Object.setPrototypeOf;
|
|
58
|
-
const ReflectOwnKeys = Reflect.ownKeys;
|
|
59
48
|
// @__NO_SIDE_EFFECTS__
|
|
60
49
|
function createConstantsObject(props, options_) {
|
|
61
50
|
const options = { __proto__: null, ...options_ };
|
|
62
|
-
const attributes = ObjectFreeze({
|
|
51
|
+
const attributes = (0, import_primordials.ObjectFreeze)({
|
|
63
52
|
__proto__: null,
|
|
64
|
-
getters: options.getters ? ObjectFreeze(
|
|
65
|
-
ObjectSetPrototypeOf(/* @__PURE__ */ toSortedObject(options.getters), null)
|
|
53
|
+
getters: options.getters ? (0, import_primordials.ObjectFreeze)(
|
|
54
|
+
(0, import_primordials.ObjectSetPrototypeOf)(/* @__PURE__ */ toSortedObject(options.getters), null)
|
|
66
55
|
) : void 0,
|
|
67
|
-
internals: options.internals ? ObjectFreeze(
|
|
68
|
-
ObjectSetPrototypeOf(/* @__PURE__ */ toSortedObject(options.internals), null)
|
|
56
|
+
internals: options.internals ? (0, import_primordials.ObjectFreeze)(
|
|
57
|
+
(0, import_primordials.ObjectSetPrototypeOf)(/* @__PURE__ */ toSortedObject(options.internals), null)
|
|
69
58
|
) : void 0,
|
|
70
|
-
mixin: options.mixin ? ObjectFreeze(
|
|
71
|
-
ObjectDefineProperties(
|
|
59
|
+
mixin: options.mixin ? (0, import_primordials.ObjectFreeze)(
|
|
60
|
+
(0, import_primordials.ObjectDefineProperties)(
|
|
72
61
|
{ __proto__: null },
|
|
73
|
-
ObjectGetOwnPropertyDescriptors(options.mixin)
|
|
62
|
+
(0, import_primordials.ObjectGetOwnPropertyDescriptors)(options.mixin)
|
|
74
63
|
)
|
|
75
64
|
) : void 0,
|
|
76
|
-
props: props ? ObjectFreeze(ObjectSetPrototypeOf(/* @__PURE__ */ toSortedObject(props), null)) : void 0
|
|
65
|
+
props: props ? (0, import_primordials.ObjectFreeze)((0, import_primordials.ObjectSetPrototypeOf)(/* @__PURE__ */ toSortedObject(props), null)) : void 0
|
|
77
66
|
});
|
|
78
|
-
const lazyGetterStats = ObjectFreeze({
|
|
67
|
+
const lazyGetterStats = (0, import_primordials.ObjectFreeze)({
|
|
79
68
|
__proto__: null,
|
|
80
69
|
initialized: /* @__PURE__ */ new Set()
|
|
81
70
|
});
|
|
82
71
|
const object = defineLazyGetters(
|
|
83
72
|
{
|
|
84
73
|
__proto__: null,
|
|
85
|
-
[import_core.kInternalsSymbol]: ObjectFreeze({
|
|
74
|
+
[import_core.kInternalsSymbol]: (0, import_primordials.ObjectFreeze)({
|
|
86
75
|
__proto__: null,
|
|
87
76
|
get attributes() {
|
|
88
77
|
return attributes;
|
|
@@ -99,16 +88,16 @@ function createConstantsObject(props, options_) {
|
|
|
99
88
|
lazyGetterStats
|
|
100
89
|
);
|
|
101
90
|
if (attributes.mixin) {
|
|
102
|
-
ObjectDefineProperties(
|
|
91
|
+
(0, import_primordials.ObjectDefineProperties)(
|
|
103
92
|
object,
|
|
104
93
|
/* @__PURE__ */ toSortedObjectFromEntries(
|
|
105
|
-
(/* @__PURE__ */ objectEntries(ObjectGetOwnPropertyDescriptors(attributes.mixin))).filter(
|
|
106
|
-
(p) => !ObjectHasOwn(object, p[0])
|
|
94
|
+
(/* @__PURE__ */ objectEntries((0, import_primordials.ObjectGetOwnPropertyDescriptors)(attributes.mixin))).filter(
|
|
95
|
+
(p) => !(0, import_primordials.ObjectHasOwn)(object, p[0])
|
|
107
96
|
)
|
|
108
97
|
)
|
|
109
98
|
);
|
|
110
99
|
}
|
|
111
|
-
return ObjectFreeze(object);
|
|
100
|
+
return (0, import_primordials.ObjectFreeze)(object);
|
|
112
101
|
}
|
|
113
102
|
// @__NO_SIDE_EFFECTS__
|
|
114
103
|
function createLazyGetter(name, getter, stats) {
|
|
@@ -125,7 +114,7 @@ function createLazyGetter(name, getter, stats) {
|
|
|
125
114
|
return lazyGetter;
|
|
126
115
|
}
|
|
127
116
|
function defineGetter(object, propKey, getter) {
|
|
128
|
-
ObjectDefineProperty(object, propKey, {
|
|
117
|
+
(0, import_primordials.ObjectDefineProperty)(object, propKey, {
|
|
129
118
|
get: getter,
|
|
130
119
|
enumerable: false,
|
|
131
120
|
configurable: true
|
|
@@ -137,7 +126,7 @@ function defineLazyGetter(object, propKey, getter, stats) {
|
|
|
137
126
|
}
|
|
138
127
|
function defineLazyGetters(object, getterDefObj, stats) {
|
|
139
128
|
if (getterDefObj !== null && typeof getterDefObj === "object") {
|
|
140
|
-
const keys = ReflectOwnKeys(getterDefObj);
|
|
129
|
+
const keys = (0, import_primordials.ReflectOwnKeys)(getterDefObj);
|
|
141
130
|
for (let i = 0, { length } = keys; i < length; i += 1) {
|
|
142
131
|
const key = keys[i];
|
|
143
132
|
defineLazyGetter(object, key, getterDefObj[key], stats);
|
|
@@ -155,21 +144,21 @@ function entryKeyComparator(a, b) {
|
|
|
155
144
|
}
|
|
156
145
|
// @__NO_SIDE_EFFECTS__
|
|
157
146
|
function getKeys(obj) {
|
|
158
|
-
return /* @__PURE__ */ isObject(obj) ? ObjectKeys(obj) : [];
|
|
147
|
+
return /* @__PURE__ */ isObject(obj) ? (0, import_primordials.ObjectKeys)(obj) : [];
|
|
159
148
|
}
|
|
160
149
|
// @__NO_SIDE_EFFECTS__
|
|
161
150
|
function getOwn(obj, propKey) {
|
|
162
151
|
if (obj === null || obj === void 0) {
|
|
163
152
|
return void 0;
|
|
164
153
|
}
|
|
165
|
-
return ObjectHasOwn(obj, propKey) ? obj[propKey] : void 0;
|
|
154
|
+
return (0, import_primordials.ObjectHasOwn)(obj, propKey) ? obj[propKey] : void 0;
|
|
166
155
|
}
|
|
167
156
|
// @__NO_SIDE_EFFECTS__
|
|
168
157
|
function getOwnPropertyValues(obj) {
|
|
169
158
|
if (obj === null || obj === void 0) {
|
|
170
159
|
return [];
|
|
171
160
|
}
|
|
172
|
-
const keys = ObjectGetOwnPropertyNames(obj);
|
|
161
|
+
const keys = (0, import_primordials.ObjectGetOwnPropertyNames)(obj);
|
|
173
162
|
const { length } = keys;
|
|
174
163
|
const values = Array(length);
|
|
175
164
|
for (let i = 0; i < length; i += 1) {
|
|
@@ -183,7 +172,7 @@ function hasKeys(obj) {
|
|
|
183
172
|
return false;
|
|
184
173
|
}
|
|
185
174
|
for (const key in obj) {
|
|
186
|
-
if (ObjectHasOwn(obj, key)) {
|
|
175
|
+
if ((0, import_primordials.ObjectHasOwn)(obj, key)) {
|
|
187
176
|
return true;
|
|
188
177
|
}
|
|
189
178
|
}
|
|
@@ -194,7 +183,7 @@ function hasOwn(obj, propKey) {
|
|
|
194
183
|
if (obj === null || obj === void 0) {
|
|
195
184
|
return false;
|
|
196
185
|
}
|
|
197
|
-
return ObjectHasOwn(obj, propKey);
|
|
186
|
+
return (0, import_primordials.ObjectHasOwn)(obj, propKey);
|
|
198
187
|
}
|
|
199
188
|
// @__NO_SIDE_EFFECTS__
|
|
200
189
|
function isObject(value) {
|
|
@@ -205,8 +194,8 @@ function isObjectObject(value) {
|
|
|
205
194
|
if (value === null || typeof value !== "object" || (0, import_arrays.isArray)(value)) {
|
|
206
195
|
return false;
|
|
207
196
|
}
|
|
208
|
-
const proto = ObjectGetPrototypeOf(value);
|
|
209
|
-
return proto === null || proto === ObjectPrototype;
|
|
197
|
+
const proto = (0, import_primordials.ObjectGetPrototypeOf)(value);
|
|
198
|
+
return proto === null || proto === import_primordials.ObjectPrototype;
|
|
210
199
|
}
|
|
211
200
|
// @__NO_SIDE_EFFECTS__
|
|
212
201
|
function merge(target, source) {
|
|
@@ -229,7 +218,7 @@ function merge(target, source) {
|
|
|
229
218
|
if (isSourceArray || isTargetArray) {
|
|
230
219
|
continue;
|
|
231
220
|
}
|
|
232
|
-
const keys = ReflectOwnKeys(currentSource);
|
|
221
|
+
const keys = (0, import_primordials.ReflectOwnKeys)(currentSource);
|
|
233
222
|
for (let i = 0, { length } = keys; i < length; i += 1) {
|
|
234
223
|
const key = keys[i];
|
|
235
224
|
const srcVal = currentSource[key];
|
|
@@ -255,7 +244,7 @@ function objectEntries(obj) {
|
|
|
255
244
|
if (obj === null || obj === void 0) {
|
|
256
245
|
return [];
|
|
257
246
|
}
|
|
258
|
-
const keys = ReflectOwnKeys(obj);
|
|
247
|
+
const keys = (0, import_primordials.ReflectOwnKeys)(obj);
|
|
259
248
|
const { length } = keys;
|
|
260
249
|
const entries = Array(length);
|
|
261
250
|
const record = obj;
|
|
@@ -284,7 +273,7 @@ function toSortedObjectFromEntries(entries) {
|
|
|
284
273
|
if (!otherEntries.length && !symbolEntries.length) {
|
|
285
274
|
return {};
|
|
286
275
|
}
|
|
287
|
-
return ObjectFromEntries([
|
|
276
|
+
return (0, import_primordials.ObjectFromEntries)([
|
|
288
277
|
// The String constructor is safe to use with symbols.
|
|
289
278
|
...symbolEntries.sort(entryKeyComparator),
|
|
290
279
|
...otherEntries.sort(entryKeyComparator)
|
package/dist/packages/edit.js
CHANGED
|
@@ -151,11 +151,11 @@ function getEditablePackageJsonClass() {
|
|
|
151
151
|
let parseErr;
|
|
152
152
|
try {
|
|
153
153
|
this._readFileContent = await (0, import_read_package.read)(this.filename);
|
|
154
|
-
} catch (
|
|
154
|
+
} catch (e) {
|
|
155
155
|
if (!create) {
|
|
156
|
-
throw
|
|
156
|
+
throw e;
|
|
157
157
|
}
|
|
158
|
-
parseErr =
|
|
158
|
+
parseErr = e;
|
|
159
159
|
}
|
|
160
160
|
if (parseErr) {
|
|
161
161
|
const nodePath = /* @__PURE__ */ getPath();
|
|
@@ -69,9 +69,9 @@ async function mergePackageJson(pkgJsonPath, originalPkgJson) {
|
|
|
69
69
|
let pkgJson;
|
|
70
70
|
try {
|
|
71
71
|
pkgJson = JSON.parse(await fs.promises.readFile(pkgJsonPath, "utf8"));
|
|
72
|
-
} catch (
|
|
73
|
-
throw new Error(`Failed to parse ${pkgJsonPath}: ${(0, import_errors.errorMessage)(
|
|
74
|
-
cause:
|
|
72
|
+
} catch (e) {
|
|
73
|
+
throw new Error(`Failed to parse ${pkgJsonPath}: ${(0, import_errors.errorMessage)(e)}`, {
|
|
74
|
+
cause: e
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
const mergedPkgJson = originalPkgJson ? { ...originalPkgJson, ...pkgJson } : pkgJson;
|