likec4 1.48.0 → 1.49.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/README.md +11 -1
- package/__app__/src/likec4.js +5595 -4127
- package/__app__/src/routes/index.js +3 -153
- package/__app__/src/routes/projects.js +21 -1087
- package/__app__/src/routes/single.js +1221 -16
- package/__app__/src/style.css +1 -1
- package/__app__/src/vendors.js +3507 -894
- package/__app__/src/webcomponent.js +1 -1
- package/config/schema.json +155 -143
- package/dist/THIRD-PARTY-LICENSES.md +1739 -0
- package/dist/_chunks/GraphvizBinaryAdapter.mjs +72 -0
- package/dist/_chunks/filenames.mjs +14 -0
- package/dist/_chunks/index.d.mts +224 -129
- package/dist/_chunks/index2.d.mts +2033 -1908
- package/dist/_chunks/libs/@chevrotain/gast.mjs +1 -3969
- package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -785
- package/dist/_chunks/libs/@chevrotain/utils.mjs +1 -37
- package/dist/_chunks/libs/@hono/mcp.mjs +34 -0
- package/dist/_chunks/libs/@hono/node-server.mjs +1 -436
- package/dist/_chunks/libs/@logtape/logtape.d.mts +741 -0
- package/dist/_chunks/libs/@logtape/logtape.mjs +6 -1354
- package/dist/_chunks/libs/@lume/kiwi.mjs +1 -1355
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +14 -14
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +12 -25105
- package/dist/_chunks/libs/@msgpack/msgpack.mjs +1 -1503
- package/dist/_chunks/libs/@nanostores/react.mjs +1 -30
- package/dist/_chunks/libs/@smithy/util-base64.mjs +1 -100
- package/dist/_chunks/libs/ajv.mjs +1 -777
- package/dist/_chunks/libs/atomically.mjs +1 -362
- package/dist/_chunks/libs/birpc.mjs +1 -201
- package/dist/_chunks/libs/chevrotain-allstar.mjs +2 -850
- package/dist/_chunks/libs/chevrotain.mjs +55 -6229
- package/dist/_chunks/libs/conf.mjs +1 -2258
- package/dist/_chunks/libs/defu.mjs +1 -42
- package/dist/_chunks/libs/esm-env.mjs +1 -5
- package/dist/_chunks/libs/eventemitter3.mjs +1 -243
- package/dist/_chunks/libs/fast-equals.mjs +1 -446
- package/dist/_chunks/libs/find-up-simple.mjs +1 -24
- package/dist/_chunks/libs/get-port.mjs +1 -107
- package/dist/_chunks/libs/is-docker.mjs +1 -26
- package/dist/_chunks/libs/is-error-instance.mjs +1 -26
- package/dist/_chunks/libs/is-inside-container.mjs +1 -20
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
- package/dist/_chunks/libs/isexe.mjs +1 -127
- package/dist/_chunks/libs/json5.mjs +14 -959
- package/dist/_chunks/libs/khroma.mjs +1 -605
- package/dist/_chunks/libs/ky.mjs +2 -807
- package/dist/_chunks/libs/langium.d.mts +2880 -2844
- package/dist/_chunks/libs/langium.mjs +32 -20351
- package/dist/_chunks/libs/merge-error-cause.mjs +2 -746
- package/dist/_chunks/libs/nanostores.mjs +1 -198
- package/dist/_chunks/libs/p-limit.mjs +1 -120
- package/dist/_chunks/libs/p-queue.mjs +1 -449
- package/dist/_chunks/libs/package-manager-detector.mjs +1 -559
- package/dist/_chunks/libs/package-up.mjs +1 -10
- package/dist/_chunks/libs/parse-ms.mjs +1 -36
- package/dist/_chunks/libs/pathe.mjs +1 -0
- package/dist/_chunks/libs/picomatch.mjs +1 -1673
- package/dist/_chunks/libs/pretty-ms.mjs +1 -80
- package/dist/_chunks/libs/remeda.mjs +1 -690
- package/dist/_chunks/libs/safe-stringify.mjs +1 -21
- package/dist/_chunks/libs/strip-indent.mjs +1 -15
- package/dist/_chunks/libs/tinyrainbow.mjs +1 -88
- package/dist/_chunks/libs/ts-graphviz.mjs +4 -725
- package/dist/_chunks/libs/ufo.mjs +1 -240
- package/dist/_chunks/libs/which.mjs +1 -84
- package/dist/_chunks/libs/word-wrap.mjs +12 -43
- package/dist/_chunks/node.mjs +481 -0
- package/dist/_chunks/plugin.mjs +98 -772
- package/dist/_chunks/rolldown-runtime.mjs +1 -48
- package/dist/_chunks/sequence-view.mjs +1 -575
- package/dist/cli/index.mjs +127 -1846
- package/dist/config/index.d.mts +2 -2
- package/dist/config/index.mjs +1 -6
- package/dist/index.d.mts +148 -7
- package/dist/index.mjs +1 -21
- package/dist/model/builder.mjs +1 -3
- package/dist/model/index.d.mts +57 -3
- package/dist/model/index.mjs +1 -5
- package/dist/vite-plugin/index.d.mts +4 -3
- package/dist/vite-plugin/index.mjs +1 -22
- package/dist/vite-plugin/internal.d.mts +5 -5
- package/dist/vite-plugin/internal.mjs +1 -68
- package/package.json +60 -41
- package/react/{index.d.ts → index.d.mts} +112 -70
- package/react/{index.js → index.mjs} +21361 -22064
- package/react/package.json +2 -5
- package/vite-plugin-modules.d.ts +5 -5
- package/dist/_chunks/LikeC4.d.mts +0 -121
- package/dist/_chunks/LikeC4.mjs +0 -202
- package/dist/_chunks/config-app.prod.d.mts +0 -18
- package/dist/_chunks/config-app.prod.mjs +0 -188
- package/dist/_chunks/config-webcomponent.prod.mjs +0 -71
- package/dist/_chunks/define-config.mjs +0 -409
- package/dist/_chunks/index3.d.mts +0 -60
- package/dist/_chunks/index4.d.mts +0 -1
- package/dist/_chunks/libs/@smithy/is-array-buffer.mjs +0 -10
- package/dist/_chunks/libs/hono.mjs +0 -1829
- package/dist/_chunks/libs/nanoid.mjs +0 -29
- package/dist/_chunks/model.mjs +0 -12
- package/dist/_chunks/module.d.mts +0 -71
- package/dist/_chunks/module.mjs +0 -18657
- package/dist/_chunks/vite-build.mjs +0 -69
- package/dist/_chunks/vite-dev.mjs +0 -79
- package/dist/_chunks/vite-preview.mjs +0 -27
- package/dist/language/module.d.mts +0 -5
- package/dist/language/module.mjs +0 -20
- package/dist/vite/vite-build.d.mts +0 -26
- package/dist/vite/vite-build.mjs +0 -27
- package/dist/vite/vite-dev.d.mts +0 -34
- package/dist/vite/vite-dev.mjs +0 -29
- package/dist/vite/vite-preview.d.mts +0 -20
- package/dist/vite/vite-preview.mjs +0 -26
|
@@ -1,446 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
|
|
3
|
-
const { hasOwnProperty } = Object.prototype;
|
|
4
|
-
/**
|
|
5
|
-
* Combine two comparators into a single comparators.
|
|
6
|
-
*/
|
|
7
|
-
function combineComparators(comparatorA, comparatorB) {
|
|
8
|
-
return function isEqual(a, b, state) {
|
|
9
|
-
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Wrap the provided `areItemsEqual` method to manage the circular state, allowing
|
|
14
|
-
* for circular references to be safely included in the comparison without creating
|
|
15
|
-
* stack overflows.
|
|
16
|
-
*/
|
|
17
|
-
function createIsCircular(areItemsEqual) {
|
|
18
|
-
return function isCircular(a, b, state) {
|
|
19
|
-
if (!a || !b || typeof a !== "object" || typeof b !== "object") return areItemsEqual(a, b, state);
|
|
20
|
-
const { cache } = state;
|
|
21
|
-
const cachedA = cache.get(a);
|
|
22
|
-
const cachedB = cache.get(b);
|
|
23
|
-
if (cachedA && cachedB) return cachedA === b && cachedB === a;
|
|
24
|
-
cache.set(a, b);
|
|
25
|
-
cache.set(b, a);
|
|
26
|
-
const result = areItemsEqual(a, b, state);
|
|
27
|
-
cache.delete(a);
|
|
28
|
-
cache.delete(b);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Get the properties to strictly examine, which include both own properties that are
|
|
34
|
-
* not enumerable and symbol properties.
|
|
35
|
-
*/
|
|
36
|
-
function getStrictProperties(object) {
|
|
37
|
-
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Whether the object contains the property passed as an own property.
|
|
41
|
-
*/
|
|
42
|
-
const hasOwn = Object.hasOwn || ((object, property) => hasOwnProperty.call(object, property));
|
|
43
|
-
const PREACT_VNODE = "__v";
|
|
44
|
-
const PREACT_OWNER = "__o";
|
|
45
|
-
const REACT_OWNER = "_owner";
|
|
46
|
-
const { getOwnPropertyDescriptor, keys } = Object;
|
|
47
|
-
/**
|
|
48
|
-
* Whether the values passed are equal based on a [SameValue](https://262.ecma-international.org/7.0/#sec-samevalue) basis.
|
|
49
|
-
* Simplified, this maps to if the two values are referentially equal to one another (`a === b`) or both are `NaN`.
|
|
50
|
-
*
|
|
51
|
-
* @note
|
|
52
|
-
* When available in the environment, this is just a re-export of the global
|
|
53
|
-
* [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) method.
|
|
54
|
-
*/
|
|
55
|
-
const sameValueEqual = Object.is || function sameValueEqual(a, b) {
|
|
56
|
-
return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Whether the values passed are equal based on a
|
|
60
|
-
* [Strict Equality Comparison](https://262.ecma-international.org/7.0/#sec-strict-equality-comparison) basis.
|
|
61
|
-
* Simplified, this maps to if the two values are referentially equal to one another (`a === b`).
|
|
62
|
-
*
|
|
63
|
-
* @note
|
|
64
|
-
* This is mainly available as a convenience function, such as being a default when a function to determine equality between
|
|
65
|
-
* two objects is used.
|
|
66
|
-
*/
|
|
67
|
-
function strictEqual(a, b) {
|
|
68
|
-
return a === b;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Whether the array buffers are equal in value.
|
|
72
|
-
*/
|
|
73
|
-
function areArrayBuffersEqual(a, b) {
|
|
74
|
-
return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Whether the arrays are equal in value.
|
|
78
|
-
*/
|
|
79
|
-
function areArraysEqual(a, b, state) {
|
|
80
|
-
let index = a.length;
|
|
81
|
-
if (b.length !== index) return false;
|
|
82
|
-
while (index-- > 0) if (!state.equals(a[index], b[index], index, index, a, b, state)) return false;
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Whether the dataviews are equal in value.
|
|
87
|
-
*/
|
|
88
|
-
function areDataViewsEqual(a, b) {
|
|
89
|
-
return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength));
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Whether the dates passed are equal in value.
|
|
93
|
-
*/
|
|
94
|
-
function areDatesEqual(a, b) {
|
|
95
|
-
return sameValueEqual(a.getTime(), b.getTime());
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Whether the errors passed are equal in value.
|
|
99
|
-
*/
|
|
100
|
-
function areErrorsEqual(a, b) {
|
|
101
|
-
return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Whether the `Map`s are equal in value.
|
|
105
|
-
*/
|
|
106
|
-
function areMapsEqual(a, b, state) {
|
|
107
|
-
const size = a.size;
|
|
108
|
-
if (size !== b.size) return false;
|
|
109
|
-
if (!size) return true;
|
|
110
|
-
const matchedIndices = new Array(size);
|
|
111
|
-
const aIterable = a.entries();
|
|
112
|
-
let aResult;
|
|
113
|
-
let bResult;
|
|
114
|
-
let index = 0;
|
|
115
|
-
while (aResult = aIterable.next()) {
|
|
116
|
-
if (aResult.done) break;
|
|
117
|
-
const bIterable = b.entries();
|
|
118
|
-
let hasMatch = false;
|
|
119
|
-
let matchIndex = 0;
|
|
120
|
-
while (bResult = bIterable.next()) {
|
|
121
|
-
if (bResult.done) break;
|
|
122
|
-
if (matchedIndices[matchIndex]) {
|
|
123
|
-
matchIndex++;
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
const aEntry = aResult.value;
|
|
127
|
-
const bEntry = bResult.value;
|
|
128
|
-
if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
|
|
129
|
-
hasMatch = matchedIndices[matchIndex] = true;
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
matchIndex++;
|
|
133
|
-
}
|
|
134
|
-
if (!hasMatch) return false;
|
|
135
|
-
index++;
|
|
136
|
-
}
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Whether the objects are equal in value.
|
|
141
|
-
*/
|
|
142
|
-
function areObjectsEqual(a, b, state) {
|
|
143
|
-
const properties = keys(a);
|
|
144
|
-
let index = properties.length;
|
|
145
|
-
if (keys(b).length !== index) return false;
|
|
146
|
-
while (index-- > 0) if (!isPropertyEqual(a, b, state, properties[index])) return false;
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Whether the objects are equal in value with strict property checking.
|
|
151
|
-
*/
|
|
152
|
-
function areObjectsEqualStrict(a, b, state) {
|
|
153
|
-
const properties = getStrictProperties(a);
|
|
154
|
-
let index = properties.length;
|
|
155
|
-
if (getStrictProperties(b).length !== index) return false;
|
|
156
|
-
let property;
|
|
157
|
-
let descriptorA;
|
|
158
|
-
let descriptorB;
|
|
159
|
-
while (index-- > 0) {
|
|
160
|
-
property = properties[index];
|
|
161
|
-
if (!isPropertyEqual(a, b, state, property)) return false;
|
|
162
|
-
descriptorA = getOwnPropertyDescriptor(a, property);
|
|
163
|
-
descriptorB = getOwnPropertyDescriptor(b, property);
|
|
164
|
-
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) return false;
|
|
165
|
-
}
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Whether the primitive wrappers passed are equal in value.
|
|
170
|
-
*/
|
|
171
|
-
function arePrimitiveWrappersEqual(a, b) {
|
|
172
|
-
return sameValueEqual(a.valueOf(), b.valueOf());
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Whether the regexps passed are equal in value.
|
|
176
|
-
*/
|
|
177
|
-
function areRegExpsEqual(a, b) {
|
|
178
|
-
return a.source === b.source && a.flags === b.flags;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Whether the `Set`s are equal in value.
|
|
182
|
-
*/
|
|
183
|
-
function areSetsEqual(a, b, state) {
|
|
184
|
-
const size = a.size;
|
|
185
|
-
if (size !== b.size) return false;
|
|
186
|
-
if (!size) return true;
|
|
187
|
-
const matchedIndices = new Array(size);
|
|
188
|
-
const aIterable = a.values();
|
|
189
|
-
let aResult;
|
|
190
|
-
let bResult;
|
|
191
|
-
while (aResult = aIterable.next()) {
|
|
192
|
-
if (aResult.done) break;
|
|
193
|
-
const bIterable = b.values();
|
|
194
|
-
let hasMatch = false;
|
|
195
|
-
let matchIndex = 0;
|
|
196
|
-
while (bResult = bIterable.next()) {
|
|
197
|
-
if (bResult.done) break;
|
|
198
|
-
if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
|
|
199
|
-
hasMatch = matchedIndices[matchIndex] = true;
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
matchIndex++;
|
|
203
|
-
}
|
|
204
|
-
if (!hasMatch) return false;
|
|
205
|
-
}
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Whether the TypedArray instances are equal in value.
|
|
210
|
-
*/
|
|
211
|
-
function areTypedArraysEqual(a, b) {
|
|
212
|
-
let index = a.byteLength;
|
|
213
|
-
if (b.byteLength !== index || a.byteOffset !== b.byteOffset) return false;
|
|
214
|
-
while (index-- > 0) if (a[index] !== b[index]) return false;
|
|
215
|
-
return true;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Whether the URL instances are equal in value.
|
|
219
|
-
*/
|
|
220
|
-
function areUrlsEqual(a, b) {
|
|
221
|
-
return a.hostname === b.hostname && a.pathname === b.pathname && a.protocol === b.protocol && a.port === b.port && a.hash === b.hash && a.username === b.username && a.password === b.password;
|
|
222
|
-
}
|
|
223
|
-
function isPropertyEqual(a, b, state, property) {
|
|
224
|
-
if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) return true;
|
|
225
|
-
return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
|
|
226
|
-
}
|
|
227
|
-
const toString = Object.prototype.toString;
|
|
228
|
-
/**
|
|
229
|
-
* Create a comparator method based on the type-specific equality comparators passed.
|
|
230
|
-
*/
|
|
231
|
-
function createEqualityComparator(config) {
|
|
232
|
-
const supportedComparatorMap = createSupportedComparatorMap(config);
|
|
233
|
-
const { areArraysEqual, areDatesEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, areRegExpsEqual, areSetsEqual, getUnsupportedCustomComparator } = config;
|
|
234
|
-
/**
|
|
235
|
-
* compare the value of the two objects and return true if they are equivalent in values
|
|
236
|
-
*/
|
|
237
|
-
return function comparator(a, b, state) {
|
|
238
|
-
if (a === b) return true;
|
|
239
|
-
if (a == null || b == null) return false;
|
|
240
|
-
const type = typeof a;
|
|
241
|
-
if (type !== typeof b) return false;
|
|
242
|
-
if (type !== "object") {
|
|
243
|
-
if (type === "number" || type === "bigint") return areNumbersEqual(a, b, state);
|
|
244
|
-
if (type === "function") return areFunctionsEqual(a, b, state);
|
|
245
|
-
return false;
|
|
246
|
-
}
|
|
247
|
-
const constructor = a.constructor;
|
|
248
|
-
if (constructor !== b.constructor) return false;
|
|
249
|
-
if (constructor === Object) return areObjectsEqual(a, b, state);
|
|
250
|
-
if (constructor === Array) return areArraysEqual(a, b, state);
|
|
251
|
-
if (constructor === Date) return areDatesEqual(a, b, state);
|
|
252
|
-
if (constructor === RegExp) return areRegExpsEqual(a, b, state);
|
|
253
|
-
if (constructor === Map) return areMapsEqual(a, b, state);
|
|
254
|
-
if (constructor === Set) return areSetsEqual(a, b, state);
|
|
255
|
-
if (constructor === Promise) return false;
|
|
256
|
-
if (Array.isArray(a)) return areArraysEqual(a, b, state);
|
|
257
|
-
const tag = toString.call(a);
|
|
258
|
-
const supportedComparator = supportedComparatorMap[tag];
|
|
259
|
-
if (supportedComparator) return supportedComparator(a, b, state);
|
|
260
|
-
const unsupportedCustomComparator = getUnsupportedCustomComparator && getUnsupportedCustomComparator(a, b, state, tag);
|
|
261
|
-
if (unsupportedCustomComparator) return unsupportedCustomComparator(a, b, state);
|
|
262
|
-
return false;
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Create the configuration object used for building comparators.
|
|
267
|
-
*/
|
|
268
|
-
function createEqualityComparatorConfig({ circular, createCustomConfig, strict }) {
|
|
269
|
-
let config = {
|
|
270
|
-
areArrayBuffersEqual,
|
|
271
|
-
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
|
272
|
-
areDataViewsEqual,
|
|
273
|
-
areDatesEqual,
|
|
274
|
-
areErrorsEqual,
|
|
275
|
-
areFunctionsEqual: strictEqual,
|
|
276
|
-
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
|
277
|
-
areNumbersEqual: sameValueEqual,
|
|
278
|
-
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
|
279
|
-
arePrimitiveWrappersEqual,
|
|
280
|
-
areRegExpsEqual,
|
|
281
|
-
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
|
282
|
-
areTypedArraysEqual: strict ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict) : areTypedArraysEqual,
|
|
283
|
-
areUrlsEqual,
|
|
284
|
-
getUnsupportedCustomComparator: void 0
|
|
285
|
-
};
|
|
286
|
-
if (createCustomConfig) config = Object.assign({}, config, createCustomConfig(config));
|
|
287
|
-
if (circular) {
|
|
288
|
-
const areArraysEqual = createIsCircular(config.areArraysEqual);
|
|
289
|
-
const areMapsEqual = createIsCircular(config.areMapsEqual);
|
|
290
|
-
const areObjectsEqual = createIsCircular(config.areObjectsEqual);
|
|
291
|
-
const areSetsEqual = createIsCircular(config.areSetsEqual);
|
|
292
|
-
config = Object.assign({}, config, {
|
|
293
|
-
areArraysEqual,
|
|
294
|
-
areMapsEqual,
|
|
295
|
-
areObjectsEqual,
|
|
296
|
-
areSetsEqual
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
return config;
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Default equality comparator pass-through, used as the standard `isEqual` creator for
|
|
303
|
-
* use inside the built comparator.
|
|
304
|
-
*/
|
|
305
|
-
function createInternalEqualityComparator(compare) {
|
|
306
|
-
return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
|
|
307
|
-
return compare(a, b, state);
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Create the `isEqual` function used by the consuming application.
|
|
312
|
-
*/
|
|
313
|
-
function createIsEqual({ circular, comparator, createState, equals, strict }) {
|
|
314
|
-
if (createState) return function isEqual(a, b) {
|
|
315
|
-
const { cache = circular ? /* @__PURE__ */ new WeakMap() : void 0, meta } = createState();
|
|
316
|
-
return comparator(a, b, {
|
|
317
|
-
cache,
|
|
318
|
-
equals,
|
|
319
|
-
meta,
|
|
320
|
-
strict
|
|
321
|
-
});
|
|
322
|
-
};
|
|
323
|
-
if (circular) return function isEqual(a, b) {
|
|
324
|
-
return comparator(a, b, {
|
|
325
|
-
cache: /* @__PURE__ */ new WeakMap(),
|
|
326
|
-
equals,
|
|
327
|
-
meta: void 0,
|
|
328
|
-
strict
|
|
329
|
-
});
|
|
330
|
-
};
|
|
331
|
-
const state = {
|
|
332
|
-
cache: void 0,
|
|
333
|
-
equals,
|
|
334
|
-
meta: void 0,
|
|
335
|
-
strict
|
|
336
|
-
};
|
|
337
|
-
return function isEqual(a, b) {
|
|
338
|
-
return comparator(a, b, state);
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Create a map of `toString()` values to their respective handlers for `tag`-based lookups.
|
|
343
|
-
*/
|
|
344
|
-
function createSupportedComparatorMap({ areArrayBuffersEqual, areArraysEqual, areDataViewsEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlsEqual }) {
|
|
345
|
-
return {
|
|
346
|
-
"[object Arguments]": areObjectsEqual,
|
|
347
|
-
"[object Array]": areArraysEqual,
|
|
348
|
-
"[object ArrayBuffer]": areArrayBuffersEqual,
|
|
349
|
-
"[object AsyncGeneratorFunction]": areFunctionsEqual,
|
|
350
|
-
"[object BigInt]": areNumbersEqual,
|
|
351
|
-
"[object BigInt64Array]": areTypedArraysEqual,
|
|
352
|
-
"[object BigUint64Array]": areTypedArraysEqual,
|
|
353
|
-
"[object Boolean]": arePrimitiveWrappersEqual,
|
|
354
|
-
"[object DataView]": areDataViewsEqual,
|
|
355
|
-
"[object Date]": areDatesEqual,
|
|
356
|
-
"[object Error]": areErrorsEqual,
|
|
357
|
-
"[object Float16Array]": areTypedArraysEqual,
|
|
358
|
-
"[object Float32Array]": areTypedArraysEqual,
|
|
359
|
-
"[object Float64Array]": areTypedArraysEqual,
|
|
360
|
-
"[object Function]": areFunctionsEqual,
|
|
361
|
-
"[object GeneratorFunction]": areFunctionsEqual,
|
|
362
|
-
"[object Int8Array]": areTypedArraysEqual,
|
|
363
|
-
"[object Int16Array]": areTypedArraysEqual,
|
|
364
|
-
"[object Int32Array]": areTypedArraysEqual,
|
|
365
|
-
"[object Map]": areMapsEqual,
|
|
366
|
-
"[object Number]": arePrimitiveWrappersEqual,
|
|
367
|
-
"[object Object]": (a, b, state) => typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual(a, b, state),
|
|
368
|
-
"[object RegExp]": areRegExpsEqual,
|
|
369
|
-
"[object Set]": areSetsEqual,
|
|
370
|
-
"[object String]": arePrimitiveWrappersEqual,
|
|
371
|
-
"[object URL]": areUrlsEqual,
|
|
372
|
-
"[object Uint8Array]": areTypedArraysEqual,
|
|
373
|
-
"[object Uint8ClampedArray]": areTypedArraysEqual,
|
|
374
|
-
"[object Uint16Array]": areTypedArraysEqual,
|
|
375
|
-
"[object Uint32Array]": areTypedArraysEqual
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Whether the items passed are deeply-equal in value.
|
|
380
|
-
*/
|
|
381
|
-
const deepEqual = createCustomEqual();
|
|
382
|
-
/**
|
|
383
|
-
* Whether the items passed are deeply-equal in value based on strict comparison.
|
|
384
|
-
*/
|
|
385
|
-
const strictDeepEqual = createCustomEqual({ strict: true });
|
|
386
|
-
/**
|
|
387
|
-
* Whether the items passed are deeply-equal in value, including circular references.
|
|
388
|
-
*/
|
|
389
|
-
const circularDeepEqual = createCustomEqual({ circular: true });
|
|
390
|
-
/**
|
|
391
|
-
* Whether the items passed are deeply-equal in value, including circular references,
|
|
392
|
-
* based on strict comparison.
|
|
393
|
-
*/
|
|
394
|
-
const strictCircularDeepEqual = createCustomEqual({
|
|
395
|
-
circular: true,
|
|
396
|
-
strict: true
|
|
397
|
-
});
|
|
398
|
-
/**
|
|
399
|
-
* Whether the items passed are shallowly-equal in value.
|
|
400
|
-
*/
|
|
401
|
-
const shallowEqual = createCustomEqual({ createInternalComparator: () => sameValueEqual });
|
|
402
|
-
/**
|
|
403
|
-
* Whether the items passed are shallowly-equal in value based on strict comparison
|
|
404
|
-
*/
|
|
405
|
-
const strictShallowEqual = createCustomEqual({
|
|
406
|
-
strict: true,
|
|
407
|
-
createInternalComparator: () => sameValueEqual
|
|
408
|
-
});
|
|
409
|
-
/**
|
|
410
|
-
* Whether the items passed are shallowly-equal in value, including circular references.
|
|
411
|
-
*/
|
|
412
|
-
const circularShallowEqual = createCustomEqual({
|
|
413
|
-
circular: true,
|
|
414
|
-
createInternalComparator: () => sameValueEqual
|
|
415
|
-
});
|
|
416
|
-
/**
|
|
417
|
-
* Whether the items passed are shallowly-equal in value, including circular references,
|
|
418
|
-
* based on strict comparison.
|
|
419
|
-
*/
|
|
420
|
-
const strictCircularShallowEqual = createCustomEqual({
|
|
421
|
-
circular: true,
|
|
422
|
-
createInternalComparator: () => sameValueEqual,
|
|
423
|
-
strict: true
|
|
424
|
-
});
|
|
425
|
-
/**
|
|
426
|
-
* Create a custom equality comparison method.
|
|
427
|
-
*
|
|
428
|
-
* This can be done to create very targeted comparisons in extreme hot-path scenarios
|
|
429
|
-
* where the standard methods are not performant enough, but can also be used to provide
|
|
430
|
-
* support for legacy environments that do not support expected features like
|
|
431
|
-
* `RegExp.prototype.flags` out of the box.
|
|
432
|
-
*/
|
|
433
|
-
function createCustomEqual(options = {}) {
|
|
434
|
-
const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false } = options;
|
|
435
|
-
const comparator = createEqualityComparator(createEqualityComparatorConfig(options));
|
|
436
|
-
return createIsEqual({
|
|
437
|
-
circular,
|
|
438
|
-
comparator,
|
|
439
|
-
createState,
|
|
440
|
-
equals: createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator),
|
|
441
|
-
strict
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
//#endregion
|
|
446
|
-
export { deepEqual as t };
|
|
1
|
+
const{getOwnPropertyNames,getOwnPropertySymbols}=Object,{hasOwnProperty}=Object.prototype;function combineComparators(e,t){return function n(r,i,a){return e(r,i,a)&&t(r,i,a)}}function createIsCircular(e){return function t(n,r,i){if(!n||!r||typeof n!=`object`||typeof r!=`object`)return e(n,r,i);let{cache:a}=i,o=a.get(n),s=a.get(r);if(o&&s)return o===r&&s===n;a.set(n,r),a.set(r,n);let c=e(n,r,i);return a.delete(n),a.delete(r),c}}function getStrictProperties(n){return getOwnPropertyNames(n).concat(getOwnPropertySymbols(n))}const hasOwn=Object.hasOwn||((e,t)=>hasOwnProperty.call(e,t)),{getOwnPropertyDescriptor,keys}=Object,sameValueEqual=Object.is||function e(t,n){return t===n?t!==0||1/t==1/n:t!==t&&n!==n};function strictEqual(e,t){return e===t}function areArrayBuffersEqual(e,t){return e.byteLength===t.byteLength&&areTypedArraysEqual(new Uint8Array(e),new Uint8Array(t))}function areArraysEqual(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function areDataViewsEqual(e,t){return e.byteLength===t.byteLength&&areTypedArraysEqual(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function areDatesEqual(e,t){return sameValueEqual(e.getTime(),t.getTime())}function areErrorsEqual(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function areMapsEqual(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}function areObjectsEqual(e,t,n){let r=keys(e),i=r.length;if(keys(t).length!==i)return!1;for(;i-- >0;)if(!isPropertyEqual(e,t,n,r[i]))return!1;return!0}function areObjectsEqualStrict(e,t,n){let r=getStrictProperties(e),i=r.length;if(getStrictProperties(t).length!==i)return!1;let o,c,l;for(;i-- >0;)if(o=r[i],!isPropertyEqual(e,t,n,o)||(c=getOwnPropertyDescriptor(e,o),l=getOwnPropertyDescriptor(t,o),(c||l)&&(!c||!l||c.configurable!==l.configurable||c.enumerable!==l.enumerable||c.writable!==l.writable)))return!1;return!0}function arePrimitiveWrappersEqual(e,t){return sameValueEqual(e.valueOf(),t.valueOf())}function areRegExpsEqual(e,t){return e.source===t.source&&e.flags===t.flags}function areSetsEqual(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function areTypedArraysEqual(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function areUrlsEqual(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function isPropertyEqual(e,t,n,r){return(r===`_owner`||r===`__o`||r===`__v`)&&(e.$$typeof||t.$$typeof)?!0:hasOwn(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const toString=Object.prototype.toString;function createEqualityComparator(e){let t=createSupportedComparatorMap(e),{areArraysEqual:n,areDatesEqual:r,areFunctionsEqual:i,areMapsEqual:a,areNumbersEqual:o,areObjectsEqual:s,areRegExpsEqual:c,areSetsEqual:l,getUnsupportedCustomComparator:u}=e;return function e(d,f,p){if(d===f)return!0;if(d==null||f==null)return!1;let m=typeof d;if(m!==typeof f)return!1;if(m!==`object`)return m===`number`||m===`bigint`?o(d,f,p):m===`function`?i(d,f,p):!1;let h=d.constructor;if(h!==f.constructor)return!1;if(h===Object)return s(d,f,p);if(h===Array)return n(d,f,p);if(h===Date)return r(d,f,p);if(h===RegExp)return c(d,f,p);if(h===Map)return a(d,f,p);if(h===Set)return l(d,f,p);if(h===Promise)return!1;if(Array.isArray(d))return n(d,f,p);let g=toString.call(d),_=t[g];if(_)return _(d,f,p);let v=u&&u(d,f,p,g);return v?v(d,f,p):!1}}function createEqualityComparatorConfig({circular:e,createCustomConfig:t,strict:n}){let a={areArrayBuffersEqual,areArraysEqual:n?areObjectsEqualStrict:areArraysEqual,areDataViewsEqual,areDatesEqual,areErrorsEqual,areFunctionsEqual:strictEqual,areMapsEqual:n?combineComparators(areMapsEqual,areObjectsEqualStrict):areMapsEqual,areNumbersEqual:sameValueEqual,areObjectsEqual:n?areObjectsEqualStrict:areObjectsEqual,arePrimitiveWrappersEqual,areRegExpsEqual,areSetsEqual:n?combineComparators(areSetsEqual,areObjectsEqualStrict):areSetsEqual,areTypedArraysEqual:n?combineComparators(areTypedArraysEqual,areObjectsEqualStrict):areTypedArraysEqual,areUrlsEqual,getUnsupportedCustomComparator:void 0};if(t&&(a=Object.assign({},a,t(a))),e){let e=createIsCircular(a.areArraysEqual),t=createIsCircular(a.areMapsEqual),n=createIsCircular(a.areObjectsEqual),r=createIsCircular(a.areSetsEqual);a=Object.assign({},a,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:r})}return a}function createInternalEqualityComparator(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function createIsEqual({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function a(o,s){let{cache:c=e?new WeakMap:void 0,meta:l}=n();return t(o,s,{cache:c,equals:r,meta:l,strict:i})};if(e)return function e(n,a){return t(n,a,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function e(n,r){return t(n,r,a)}}function createSupportedComparatorMap({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p}){return{"[object Arguments]":c,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":s,"[object BigInt64Array]":f,"[object BigUint64Array]":f,"[object Boolean]":l,"[object DataView]":n,"[object Date]":r,"[object Error]":i,"[object Float16Array]":f,"[object Float32Array]":f,"[object Float64Array]":f,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":f,"[object Int16Array]":f,"[object Int32Array]":f,"[object Map]":o,"[object Number]":l,"[object Object]":(e,t,n)=>typeof e.then!=`function`&&typeof t.then!=`function`&&c(e,t,n),"[object RegExp]":u,"[object Set]":d,"[object String]":l,"[object URL]":p,"[object Uint8Array]":f,"[object Uint8ClampedArray]":f,"[object Uint16Array]":f,"[object Uint32Array]":f}}const deepEqual=createCustomEqual();createCustomEqual({strict:!0}),createCustomEqual({circular:!0}),createCustomEqual({circular:!0,strict:!0}),createCustomEqual({createInternalComparator:()=>sameValueEqual}),createCustomEqual({strict:!0,createInternalComparator:()=>sameValueEqual}),createCustomEqual({circular:!0,createInternalComparator:()=>sameValueEqual}),createCustomEqual({circular:!0,createInternalComparator:()=>sameValueEqual,strict:!0});function createCustomEqual(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=createEqualityComparator(createEqualityComparatorConfig(e));return createIsEqual({circular:t,comparator:a,createState:r,equals:n?n(a):createInternalEqualityComparator(a),strict:i})}export{deepEqual as t};
|
|
@@ -1,24 +1 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import fsPromises from "node:fs/promises";
|
|
5
|
-
import process from "node:process";
|
|
6
|
-
|
|
7
|
-
//#region ../../node_modules/.pnpm/find-up-simple@1.0.0/node_modules/find-up-simple/index.js
|
|
8
|
-
const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
9
|
-
function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
10
|
-
let directory = path.resolve(toPath(cwd) ?? "");
|
|
11
|
-
const { root } = path.parse(directory);
|
|
12
|
-
stopAt = path.resolve(directory, toPath(stopAt) ?? root);
|
|
13
|
-
while (directory && directory !== stopAt && directory !== root) {
|
|
14
|
-
const filePath = path.isAbsolute(name) ? name : path.join(directory, name);
|
|
15
|
-
try {
|
|
16
|
-
const stats = fs.statSync(filePath, { throwIfNoEntry: false });
|
|
17
|
-
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
|
|
18
|
-
} catch {}
|
|
19
|
-
directory = path.dirname(directory);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
export { findUpSync as t };
|
|
1
|
+
import fs from"node:fs/promises";import path from"node:path";import fs$1 from"node:fs";import process from"node:process";import{fileURLToPath}from"node:url";const toPath=e=>e instanceof URL?fileURLToPath(e):e;function findUpSync(e,{cwd:n=process.cwd(),type:r=`file`,stopAt:i}={}){let a=path.resolve(toPath(n)??``),{root:o}=path.parse(a);for(i=path.resolve(a,toPath(i)??o);a&&a!==i&&a!==o;){let t=path.isAbsolute(e)?e:path.join(a,e);try{let e=fs$1.statSync(t,{throwIfNoEntry:!1});if(r===`file`&&e?.isFile()||r===`directory`&&e?.isDirectory())return t}catch{}a=path.dirname(a)}}export{findUpSync as t};
|
|
@@ -1,107 +1 @@
|
|
|
1
|
-
import os from "node:os";
|
|
2
|
-
import net from "node:net";
|
|
3
|
-
|
|
4
|
-
//#region ../../node_modules/.pnpm/get-port@7.1.0/node_modules/get-port/index.js
|
|
5
|
-
var Locked = class extends Error {
|
|
6
|
-
constructor(port) {
|
|
7
|
-
super(`${port} is locked`);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
const lockedPorts = {
|
|
11
|
-
old: /* @__PURE__ */ new Set(),
|
|
12
|
-
young: /* @__PURE__ */ new Set()
|
|
13
|
-
};
|
|
14
|
-
const releaseOldLockedPortsIntervalMs = 1e3 * 15;
|
|
15
|
-
const minPort = 1024;
|
|
16
|
-
const maxPort = 65535;
|
|
17
|
-
let timeout;
|
|
18
|
-
const getLocalHosts = () => {
|
|
19
|
-
const interfaces = os.networkInterfaces();
|
|
20
|
-
const results = new Set([void 0, "0.0.0.0"]);
|
|
21
|
-
for (const _interface of Object.values(interfaces)) for (const config of _interface) results.add(config.address);
|
|
22
|
-
return results;
|
|
23
|
-
};
|
|
24
|
-
const checkAvailablePort = (options) => new Promise((resolve, reject) => {
|
|
25
|
-
const server = net.createServer();
|
|
26
|
-
server.unref();
|
|
27
|
-
server.on("error", reject);
|
|
28
|
-
server.listen(options, () => {
|
|
29
|
-
const { port } = server.address();
|
|
30
|
-
server.close(() => {
|
|
31
|
-
resolve(port);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
const getAvailablePort = async (options, hosts) => {
|
|
36
|
-
if (options.host || options.port === 0) return checkAvailablePort(options);
|
|
37
|
-
for (const host of hosts) try {
|
|
38
|
-
await checkAvailablePort({
|
|
39
|
-
port: options.port,
|
|
40
|
-
host
|
|
41
|
-
});
|
|
42
|
-
} catch (error) {
|
|
43
|
-
if (!["EADDRNOTAVAIL", "EINVAL"].includes(error.code)) throw error;
|
|
44
|
-
}
|
|
45
|
-
return options.port;
|
|
46
|
-
};
|
|
47
|
-
const portCheckSequence = function* (ports) {
|
|
48
|
-
if (ports) yield* ports;
|
|
49
|
-
yield 0;
|
|
50
|
-
};
|
|
51
|
-
async function getPorts(options) {
|
|
52
|
-
let ports;
|
|
53
|
-
let exclude = /* @__PURE__ */ new Set();
|
|
54
|
-
if (options) {
|
|
55
|
-
if (options.port) ports = typeof options.port === "number" ? [options.port] : options.port;
|
|
56
|
-
if (options.exclude) {
|
|
57
|
-
const excludeIterable = options.exclude;
|
|
58
|
-
if (typeof excludeIterable[Symbol.iterator] !== "function") throw new TypeError("The `exclude` option must be an iterable.");
|
|
59
|
-
for (const element of excludeIterable) {
|
|
60
|
-
if (typeof element !== "number") throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");
|
|
61
|
-
if (!Number.isSafeInteger(element)) throw new TypeError(`Number ${element} in the exclude option is not a safe integer and can't be used`);
|
|
62
|
-
}
|
|
63
|
-
exclude = new Set(excludeIterable);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (timeout === void 0) {
|
|
67
|
-
timeout = setTimeout(() => {
|
|
68
|
-
timeout = void 0;
|
|
69
|
-
lockedPorts.old = lockedPorts.young;
|
|
70
|
-
lockedPorts.young = /* @__PURE__ */ new Set();
|
|
71
|
-
}, releaseOldLockedPortsIntervalMs);
|
|
72
|
-
if (timeout.unref) timeout.unref();
|
|
73
|
-
}
|
|
74
|
-
const hosts = getLocalHosts();
|
|
75
|
-
for (const port of portCheckSequence(ports)) try {
|
|
76
|
-
if (exclude.has(port)) continue;
|
|
77
|
-
let availablePort = await getAvailablePort({
|
|
78
|
-
...options,
|
|
79
|
-
port
|
|
80
|
-
}, hosts);
|
|
81
|
-
while (lockedPorts.old.has(availablePort) || lockedPorts.young.has(availablePort)) {
|
|
82
|
-
if (port !== 0) throw new Locked(port);
|
|
83
|
-
availablePort = await getAvailablePort({
|
|
84
|
-
...options,
|
|
85
|
-
port
|
|
86
|
-
}, hosts);
|
|
87
|
-
}
|
|
88
|
-
lockedPorts.young.add(availablePort);
|
|
89
|
-
return availablePort;
|
|
90
|
-
} catch (error) {
|
|
91
|
-
if (!["EADDRINUSE", "EACCES"].includes(error.code) && !(error instanceof Locked)) throw error;
|
|
92
|
-
}
|
|
93
|
-
throw new Error("No available ports found");
|
|
94
|
-
}
|
|
95
|
-
function portNumbers(from, to) {
|
|
96
|
-
if (!Number.isInteger(from) || !Number.isInteger(to)) throw new TypeError("`from` and `to` must be integer numbers");
|
|
97
|
-
if (from < minPort || from > maxPort) throw new RangeError(`'from' must be between ${minPort} and ${maxPort}`);
|
|
98
|
-
if (to < minPort || to > maxPort) throw new RangeError(`'to' must be between ${minPort} and ${maxPort}`);
|
|
99
|
-
if (from > to) throw new RangeError("`to` must be greater than or equal to `from`");
|
|
100
|
-
const generator = function* (from, to) {
|
|
101
|
-
for (let port = from; port <= to; port++) yield port;
|
|
102
|
-
};
|
|
103
|
-
return generator(from, to);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
//#endregion
|
|
107
|
-
export { portNumbers as n, getPorts as t };
|
|
1
|
+
import os from"node:os";import net from"node:net";var Locked=class extends Error{constructor(e){super(`${e} is locked`)}};const lockedPorts={old:new Set,young:new Set},minPort=1024,maxPort=65535;let timeout;const getLocalHosts=()=>{let t=os.networkInterfaces(),n=new Set([void 0,`0.0.0.0`]);for(let e of Object.values(t))for(let t of e)n.add(t.address);return n},checkAvailablePort=e=>new Promise((n,r)=>{let i=net.createServer();i.unref(),i.on(`error`,r),i.listen(e,()=>{let{port:e}=i.address();i.close(()=>{n(e)})})}),getAvailablePort=async(e,t)=>{if(e.host||e.port===0)return checkAvailablePort(e);for(let n of t)try{await checkAvailablePort({port:e.port,host:n})}catch(e){if(![`EADDRNOTAVAIL`,`EINVAL`].includes(e.code))throw e}return e.port},portCheckSequence=function*(e){e&&(yield*e),yield 0};async function getPorts(e){let t,i=new Set;if(e&&(e.port&&(t=typeof e.port==`number`?[e.port]:e.port),e.exclude)){let t=e.exclude;if(typeof t[Symbol.iterator]!=`function`)throw TypeError("The `exclude` option must be an iterable.");for(let e of t){if(typeof e!=`number`)throw TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(e))throw TypeError(`Number ${e} in the exclude option is not a safe integer and can't be used`)}i=new Set(t)}timeout===void 0&&(timeout=setTimeout(()=>{timeout=void 0,lockedPorts.old=lockedPorts.young,lockedPorts.young=new Set},15e3),timeout.unref&&timeout.unref());let a=getLocalHosts();for(let o of portCheckSequence(t))try{if(i.has(o))continue;let t=await getAvailablePort({...e,port:o},a);for(;lockedPorts.old.has(t)||lockedPorts.young.has(t);){if(o!==0)throw new Locked(o);t=await getAvailablePort({...e,port:o},a)}return lockedPorts.young.add(t),t}catch(e){if(![`EADDRINUSE`,`EACCES`].includes(e.code)&&!(e instanceof Locked))throw e}throw Error(`No available ports found`)}function portNumbers(e,t){if(!Number.isInteger(e)||!Number.isInteger(t))throw TypeError("`from` and `to` must be integer numbers");if(e<minPort||e>maxPort)throw RangeError(`'from' must be between ${minPort} and ${maxPort}`);if(t<minPort||t>maxPort)throw RangeError(`'to' must be between ${minPort} and ${maxPort}`);if(e>t)throw RangeError("`to` must be greater than or equal to `from`");let n=function*(e,t){for(let n=e;n<=t;n++)yield n};return n(e,t)}export{portNumbers as n,getPorts as t};
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
|
|
3
|
-
//#region ../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
|
|
4
|
-
let isDockerCached;
|
|
5
|
-
function hasDockerEnv() {
|
|
6
|
-
try {
|
|
7
|
-
fs.statSync("/.dockerenv");
|
|
8
|
-
return true;
|
|
9
|
-
} catch {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
function hasDockerCGroup() {
|
|
14
|
-
try {
|
|
15
|
-
return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
16
|
-
} catch {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function isDocker() {
|
|
21
|
-
if (isDockerCached === void 0) isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
22
|
-
return isDockerCached;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
export { isDocker as t };
|
|
1
|
+
import fs from"node:fs";let isDockerCached;function hasDockerEnv(){try{return fs.statSync(`/.dockerenv`),!0}catch{return!1}}function hasDockerCGroup(){try{return fs.readFileSync(`/proc/self/cgroup`,`utf8`).includes(`docker`)}catch{return!1}}function isDocker(){return isDockerCached===void 0&&(isDockerCached=hasDockerEnv()||hasDockerCGroup()),isDockerCached}export{isDocker as t};
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const isErrorInstance = (value) => isInstanceOfError(value) || hasErrorTag(value);
|
|
3
|
-
var main_default = isErrorInstance;
|
|
4
|
-
const isInstanceOfError = (value) => {
|
|
5
|
-
try {
|
|
6
|
-
return value instanceof Error;
|
|
7
|
-
} catch {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
const hasErrorTag = (value) => {
|
|
12
|
-
try {
|
|
13
|
-
return ERROR_TAGS.has(Object.prototype.toString.call(value));
|
|
14
|
-
} catch {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const ERROR_TAGS = new Set([
|
|
19
|
-
"[object Error]",
|
|
20
|
-
"[object DOMException]",
|
|
21
|
-
"[object DOMError]",
|
|
22
|
-
"[object Exception]"
|
|
23
|
-
]);
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
export { main_default as t };
|
|
1
|
+
const isErrorInstance=e=>isInstanceOfError(e)||hasErrorTag(e),isInstanceOfError=e=>{try{return e instanceof Error}catch{return!1}},hasErrorTag=e=>{try{return ERROR_TAGS.has(Object.prototype.toString.call(e))}catch{return!1}},ERROR_TAGS=new Set([`[object Error]`,`[object DOMException]`,`[object DOMError]`,`[object Exception]`]);export{isErrorInstance as t};
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
|
|
4
|
-
//#region ../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
|
|
5
|
-
let cachedResult;
|
|
6
|
-
const hasContainerEnv = () => {
|
|
7
|
-
try {
|
|
8
|
-
fs.statSync("/run/.containerenv");
|
|
9
|
-
return true;
|
|
10
|
-
} catch {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
function isInsideContainer() {
|
|
15
|
-
if (cachedResult === void 0) cachedResult = hasContainerEnv() || isDocker();
|
|
16
|
-
return cachedResult;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { isInsideContainer as t };
|
|
1
|
+
import{t as isDocker}from"./is-docker.mjs";import fs from"node:fs";let cachedResult;const hasContainerEnv=()=>{try{return fs.statSync(`/run/.containerenv`),!0}catch{return!1}};function isInsideContainer(){return cachedResult===void 0&&(cachedResult=hasContainerEnv()||isDocker()),cachedResult}export{isInsideContainer as t};
|