toiljs 0.0.116 → 0.0.118
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 +14 -0
- package/README.md +16 -7
- package/build/backend/.tsbuildinfo +1 -1
- package/build/cli/.tsbuildinfo +1 -1
- package/build/cli/index.js +2375 -258
- package/build/client/.tsbuildinfo +1 -1
- package/build/client/auth.d.ts +3 -0
- package/build/client/auth.js +19 -10
- package/build/client/dev/devtools.js +1 -1
- package/build/client/dev/error-overlay.js +1 -1
- package/build/client/index.d.ts +1 -1
- package/build/client/index.js +1 -1
- package/build/client/navigation/navigation.js +28 -3
- package/build/client/routing/Router.js +5 -2
- package/build/client/routing/mount.js +1 -1
- package/build/compiler/.tsbuildinfo +1 -1
- package/build/compiler/auth-emails.js +7 -3
- package/build/compiler/emails.js +1 -1
- package/build/compiler/index.d.ts +1 -0
- package/build/compiler/index.js +26 -5
- package/build/compiler/pages.js +2 -3
- package/build/compiler/prerender.d.ts +3 -8
- package/build/compiler/prerender.js +88 -127
- package/build/compiler/ssg.js +3 -4
- package/build/compiler/template-build.js +3 -4
- package/build/compiler/toil-docs.generated.js +8 -7
- package/build/compiler/vite.js +4 -6
- package/build/devserver/.tsbuildinfo +1 -1
- package/build/devserver/db/database.js +7 -3
- package/build/devserver/db/types.js +1 -1
- package/build/devserver/production.js +4 -3
- package/build/devserver/runtime/crypto.d.ts +1 -1
- package/build/io/.tsbuildinfo +1 -1
- package/build/logger/.tsbuildinfo +1 -1
- package/build/shared/.tsbuildinfo +1 -1
- package/examples/basic/client/routes/analytics.tsx +7 -5
- package/examples/basic/client/routes/pq.tsx +2 -1
- package/examples/basic/server/tsconfig.json +1 -3
- package/package.json +45 -44
- package/presets/no-uint8array-tostring.js +120 -153
- package/presets/oxlint.d.ts +5 -0
- package/presets/oxlint.js +224 -0
- package/server/auth/AuthController.ts +53 -14
- package/server/auth/FactorSettings.ts +41 -0
- package/server/auth/SessionEpochs.ts +58 -0
- package/server/auth/SessionRevocations.ts +13 -0
- package/server/globals/auth.ts +27 -2
- package/server/runtime/tsconfig.json +1 -3
- package/tsconfig.json +2 -11
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -90
- package/.github/ISSUE_TEMPLATE/config.yml +0 -8
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -43
- package/.github/changelog-config.json +0 -45
- package/.github/dependabot.yml +0 -27
- package/.github/workflows/ci.yml +0 -222
- package/.vscode/settings.json +0 -10
- package/docs/README.md +0 -107
- package/docs/auth/README.md +0 -104
- package/docs/auth/configuration.md +0 -105
- package/docs/auth/emails.md +0 -92
- package/docs/auth/extending.md +0 -202
- package/docs/auth/how-it-works.md +0 -138
- package/docs/auth/usage.md +0 -188
- package/docs/backend/README.md +0 -143
- package/docs/backend/data.md +0 -351
- package/docs/backend/rest.md +0 -402
- package/docs/backend/rpc.md +0 -226
- package/docs/background/README.md +0 -114
- package/docs/background/daemons.md +0 -276
- package/docs/background/derive.md +0 -179
- package/docs/cli/README.md +0 -379
- package/docs/concepts/ai-guide.md +0 -132
- package/docs/concepts/config.md +0 -416
- package/docs/concepts/decorators.md +0 -127
- package/docs/concepts/security.md +0 -108
- package/docs/concepts/tiers.md +0 -166
- package/docs/concepts/types.md +0 -216
- package/docs/database/README.md +0 -143
- package/docs/database/capacity.md +0 -350
- package/docs/database/counters.md +0 -174
- package/docs/database/documents.md +0 -277
- package/docs/database/events.md +0 -307
- package/docs/database/membership.md +0 -246
- package/docs/database/setup.md +0 -155
- package/docs/database/unique.md +0 -216
- package/docs/database/views.md +0 -246
- package/docs/frontend/README.md +0 -104
- package/docs/frontend/components.md +0 -286
- package/docs/frontend/data-fetching.md +0 -260
- package/docs/frontend/images.md +0 -148
- package/docs/frontend/metadata.md +0 -344
- package/docs/frontend/navigation.md +0 -296
- package/docs/frontend/rendering.md +0 -236
- package/docs/frontend/routing.md +0 -346
- package/docs/frontend/scripts.md +0 -118
- package/docs/frontend/search.md +0 -191
- package/docs/frontend/styling.md +0 -147
- package/docs/frontend/toil-global.md +0 -216
- package/docs/getting-started/README.md +0 -81
- package/docs/getting-started/create-project.md +0 -131
- package/docs/getting-started/deploy.md +0 -101
- package/docs/getting-started/first-app.md +0 -215
- package/docs/getting-started/installation.md +0 -124
- package/docs/getting-started/migrating.md +0 -125
- package/docs/getting-started/project-structure.md +0 -163
- package/docs/introduction/README.md +0 -66
- package/docs/introduction/design-principles.md +0 -81
- package/docs/introduction/distributed.md +0 -91
- package/docs/introduction/how-it-works.md +0 -121
- package/docs/introduction/hyperscale.md +0 -70
- package/docs/introduction/modern-stack.md +0 -85
- package/docs/introduction/vs-other-frameworks.md +0 -64
- package/docs/introduction/why-toil.md +0 -99
- package/docs/llms.txt +0 -95
- package/docs/realtime/README.md +0 -102
- package/docs/realtime/channels.md +0 -211
- package/docs/realtime/streams.md +0 -369
- package/docs/services/README.md +0 -60
- package/docs/services/analytics.md +0 -279
- package/docs/services/caching.md +0 -175
- package/docs/services/cookies.md +0 -235
- package/docs/services/crypto.md +0 -209
- package/docs/services/email.md +0 -289
- package/docs/services/environment.md +0 -141
- package/docs/services/ratelimit.md +0 -174
- package/docs/services/time.md +0 -85
- package/eslint.config.js +0 -57
- package/examples/basic/client/routes/docs/[...slug].tsx +0 -12
- package/presets/eslint.js +0 -88
- package/src/backend/index.ts +0 -204
- package/src/cli/configure.ts +0 -363
- package/src/cli/create.ts +0 -924
- package/src/cli/db.ts +0 -158
- package/src/cli/diagnostics.ts +0 -665
- package/src/cli/doctor.ts +0 -982
- package/src/cli/features.ts +0 -170
- package/src/cli/index.ts +0 -326
- package/src/cli/notify.ts +0 -120
- package/src/cli/proc.ts +0 -56
- package/src/cli/ui.ts +0 -169
- package/src/cli/update.ts +0 -248
- package/src/cli/updates.ts +0 -92
- package/src/cli/validate.ts +0 -31
- package/src/cli/version-check.ts +0 -125
- package/src/client/auth.ts +0 -869
- package/src/client/channel/channel.ts +0 -146
- package/src/client/components/Form.tsx +0 -65
- package/src/client/components/Image.tsx +0 -160
- package/src/client/components/Script.tsx +0 -113
- package/src/client/components/Slot.tsx +0 -21
- package/src/client/dev/devtools.tsx +0 -1089
- package/src/client/dev/error-overlay.tsx +0 -225
- package/src/client/errors.ts +0 -11
- package/src/client/head/head.ts +0 -182
- package/src/client/head/metadata.ts +0 -110
- package/src/client/index.ts +0 -130
- package/src/client/navigation/Link.tsx +0 -108
- package/src/client/navigation/NavLink.tsx +0 -86
- package/src/client/navigation/navigation.ts +0 -235
- package/src/client/navigation/prefetch.ts +0 -169
- package/src/client/navigation/scroll.ts +0 -53
- package/src/client/routing/Router.tsx +0 -216
- package/src/client/routing/action.ts +0 -122
- package/src/client/routing/error-boundary.tsx +0 -43
- package/src/client/routing/hooks.ts +0 -140
- package/src/client/routing/lazy.ts +0 -77
- package/src/client/routing/loader.ts +0 -381
- package/src/client/routing/match.ts +0 -47
- package/src/client/routing/mount.tsx +0 -90
- package/src/client/routing/params-context.ts +0 -10
- package/src/client/routing/slot-context.ts +0 -7
- package/src/client/rpc.ts +0 -97
- package/src/client/search/search.ts +0 -189
- package/src/client/search/use-page-search.ts +0 -73
- package/src/client/ssr/markers.tsx +0 -172
- package/src/client/stream/client.ts +0 -237
- package/src/client/types.ts +0 -73
- package/src/compiler/auth-emails.ts +0 -312
- package/src/compiler/config.ts +0 -369
- package/src/compiler/docs.ts +0 -127
- package/src/compiler/email-preview.ts +0 -314
- package/src/compiler/emails.ts +0 -404
- package/src/compiler/fonts.ts +0 -89
- package/src/compiler/generate.ts +0 -471
- package/src/compiler/image-blur.ts +0 -42
- package/src/compiler/image-report.ts +0 -88
- package/src/compiler/index.ts +0 -1362
- package/src/compiler/pages.ts +0 -49
- package/src/compiler/plugin.ts +0 -391
- package/src/compiler/prerender.ts +0 -263
- package/src/compiler/routes.ts +0 -170
- package/src/compiler/seo.ts +0 -415
- package/src/compiler/sri.ts +0 -144
- package/src/compiler/ssg.ts +0 -177
- package/src/compiler/ssr-codegen.ts +0 -85
- package/src/compiler/template-build.ts +0 -676
- package/src/compiler/template.ts +0 -262
- package/src/compiler/toil-docs.generated.ts +0 -77
- package/src/compiler/vite.ts +0 -245
- package/src/devserver/analytics/index.ts +0 -317
- package/src/devserver/config/dotenv.ts +0 -102
- package/src/devserver/config/env.ts +0 -30
- package/src/devserver/config/ratelimit.ts +0 -123
- package/src/devserver/daemon/catalog.ts +0 -120
- package/src/devserver/daemon/cron.ts +0 -87
- package/src/devserver/daemon/host.ts +0 -134
- package/src/devserver/daemon/index.ts +0 -369
- package/src/devserver/daemon/runtime.ts +0 -48
- package/src/devserver/db/catalog.ts +0 -109
- package/src/devserver/db/database.ts +0 -1834
- package/src/devserver/db/derives.ts +0 -121
- package/src/devserver/db/index.ts +0 -20
- package/src/devserver/db/routeKinds.ts +0 -191
- package/src/devserver/db/types.ts +0 -168
- package/src/devserver/email/caps.ts +0 -0
- package/src/devserver/email/config.ts +0 -141
- package/src/devserver/email/console.ts +0 -348
- package/src/devserver/email/index.ts +0 -155
- package/src/devserver/email/providers.ts +0 -131
- package/src/devserver/email/status.ts +0 -23
- package/src/devserver/email/validate.ts +0 -37
- package/src/devserver/email/wire.ts +0 -55
- package/src/devserver/http/cache.ts +0 -0
- package/src/devserver/http/envelope.ts +0 -157
- package/src/devserver/http/proxy.ts +0 -172
- package/src/devserver/http/runtime.ts +0 -387
- package/src/devserver/index.ts +0 -43
- package/src/devserver/production-ipc.ts +0 -63
- package/src/devserver/production-worker.ts +0 -83
- package/src/devserver/production.ts +0 -718
- package/src/devserver/runtime/crypto.ts +0 -587
- package/src/devserver/runtime/host.ts +0 -427
- package/src/devserver/runtime/module.ts +0 -442
- package/src/devserver/server.ts +0 -251
- package/src/devserver/ssr.ts +0 -208
- package/src/devserver/stream/catalog.ts +0 -106
- package/src/devserver/stream/host.ts +0 -42
- package/src/devserver/stream/index.ts +0 -301
- package/src/devserver/stream/manager.ts +0 -167
- package/src/devserver/stream/router.ts +0 -101
- package/src/devserver/stream/wire.ts +0 -58
- package/src/devserver/stream/ws.ts +0 -78
- package/src/devserver/wasm/sections.ts +0 -59
- package/src/devserver/wasm/surface.ts +0 -115
- package/src/io/FastMap.ts +0 -151
- package/src/io/FastSet.ts +0 -113
- package/src/io/codec.ts +0 -362
- package/src/io/index.ts +0 -10
- package/src/io/lengths.ts +0 -14
- package/src/io/types.ts +0 -19
- package/src/logger/index.ts +0 -22
- package/src/shared/index.ts +0 -46
- package/test/analytics-dev.test.ts +0 -113
- package/test/assembly/aspect-shim.ts +0 -33
- package/test/assembly/cookie.spec.ts +0 -303
- package/test/assembly/example.spec.ts +0 -22
- package/test/assembly/ssr.spec.ts +0 -95
- package/test/assembly.test.ts +0 -59
- package/test/auth-emails.test.ts +0 -118
- package/test/built-ssr.test.ts +0 -148
- package/test/channel.test.ts +0 -21
- package/test/config-host-port.test.ts +0 -59
- package/test/configure.test.ts +0 -94
- package/test/daemon-build.test.ts +0 -278
- package/test/daemon-catalog.test.ts +0 -349
- package/test/daemon-emulation.test.ts +0 -256
- package/test/db.test.ts +0 -0
- package/test/devserver-database.test.ts +0 -1102
- package/test/devserver-email.test.ts +0 -306
- package/test/devserver-pqauth.test.ts +0 -93
- package/test/devserver-secrets.test.ts +0 -63
- package/test/devserver.test.ts +0 -259
- package/test/doctor.test.ts +0 -298
- package/test/dom/Image.test.tsx +0 -144
- package/test/dom/Link.test.tsx +0 -67
- package/test/dom/NavLink.test.tsx +0 -37
- package/test/dom/Script.test.tsx +0 -48
- package/test/dom/action.test.tsx +0 -146
- package/test/dom/error-overlay.test.tsx +0 -44
- package/test/dom/loader.test.tsx +0 -121
- package/test/dom/navigation.test.ts +0 -59
- package/test/dom/revalidate.test.tsx +0 -38
- package/test/dom/route-head.test.tsx +0 -56
- package/test/dom/router-loading.test.tsx +0 -44
- package/test/dom/scroll.test.ts +0 -56
- package/test/dom/slot.test.tsx +0 -131
- package/test/dom/use-metadata.test.tsx +0 -58
- package/test/dom/view-transitions.test.tsx +0 -53
- package/test/dynamic-routing.test.ts +0 -132
- package/test/email-console.test.ts +0 -86
- package/test/email-preview.test.ts +0 -73
- package/test/emails.test.ts +0 -58
- package/test/errors.test.ts +0 -21
- package/test/example-guestbook.test.ts +0 -123
- package/test/features.test.ts +0 -149
- package/test/fixtures/bignum-wire/spec.ts +0 -25
- package/test/fixtures/daemon-app.ts +0 -65
- package/test/fixtures/stream-echo.ts +0 -26
- package/test/fixtures/stream-gate.ts +0 -28
- package/test/fixtures/stream-trap.ts +0 -18
- package/test/fixtures/stream-typed.ts +0 -41
- package/test/fonts.test.ts +0 -28
- package/test/global-setup.ts +0 -17
- package/test/head.test.ts +0 -42
- package/test/image-blur.test.ts +0 -50
- package/test/io.test.ts +0 -117
- package/test/metadata.test.ts +0 -40
- package/test/navlink.test.ts +0 -28
- package/test/pages.test.ts +0 -105
- package/test/placeholder.test.ts +0 -9
- package/test/pqauth-e2e.test.ts +0 -216
- package/test/pqauth-email.test.ts +0 -801
- package/test/prerender.test.ts +0 -116
- package/test/prettier-plugin.test.ts +0 -46
- package/test/routes.test.ts +0 -76
- package/test/rpc-bignum-wire.test.ts +0 -164
- package/test/rpc-dispatch.test.ts +0 -132
- package/test/rpc-kinds.test.ts +0 -18
- package/test/rpc.test.ts +0 -66
- package/test/search.test.ts +0 -114
- package/test/seo.test.ts +0 -175
- package/test/slot-layouts.test.ts +0 -69
- package/test/sri.test.ts +0 -129
- package/test/ssg.test.ts +0 -36
- package/test/ssr-hydration.test.tsx +0 -122
- package/test/ssr-render.test.ts +0 -197
- package/test/ssr-template.test.tsx +0 -482
- package/test/stream-emulation.test.ts +0 -479
- package/test/ui.test.ts +0 -40
- package/test/update.test.ts +0 -58
- package/test/validate.test.ts +0 -42
- package/test/version-check.test.ts +0 -130
- package/tests/data-parity/generated-parity.ts +0 -99
- package/tests/data-parity/parity.ts +0 -80
- package/tests/data-parity/spec.ts +0 -46
package/build/cli/index.js
CHANGED
|
@@ -37,16 +37,16 @@ var require_src = __commonJS({
|
|
|
37
37
|
var CSI2 = `${ESC2}[`;
|
|
38
38
|
var beep = "\x07";
|
|
39
39
|
var cursor3 = {
|
|
40
|
-
to(x,
|
|
41
|
-
if (!
|
|
42
|
-
return `${CSI2}${
|
|
40
|
+
to(x, y2) {
|
|
41
|
+
if (!y2) return `${CSI2}${x + 1}G`;
|
|
42
|
+
return `${CSI2}${y2 + 1};${x + 1}H`;
|
|
43
43
|
},
|
|
44
|
-
move(x,
|
|
44
|
+
move(x, y2) {
|
|
45
45
|
let ret = "";
|
|
46
46
|
if (x < 0) ret += `${CSI2}${-x}D`;
|
|
47
47
|
else if (x > 0) ret += `${CSI2}${x}C`;
|
|
48
|
-
if (
|
|
49
|
-
else if (
|
|
48
|
+
if (y2 < 0) ret += `${CSI2}${-y2}A`;
|
|
49
|
+
else if (y2 > 0) ret += `${CSI2}${y2}B`;
|
|
50
50
|
return ret;
|
|
51
51
|
},
|
|
52
52
|
up: (count = 1) => `${CSI2}${count}A`,
|
|
@@ -157,6 +157,2000 @@ var require_picocolors = __commonJS({
|
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
|
|
160
|
+
// node_modules/semver/internal/constants.js
|
|
161
|
+
var require_constants = __commonJS({
|
|
162
|
+
"node_modules/semver/internal/constants.js"(exports, module) {
|
|
163
|
+
"use strict";
|
|
164
|
+
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
165
|
+
var MAX_LENGTH = 256;
|
|
166
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
167
|
+
9007199254740991;
|
|
168
|
+
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
169
|
+
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
170
|
+
var RELEASE_TYPES = [
|
|
171
|
+
"major",
|
|
172
|
+
"premajor",
|
|
173
|
+
"minor",
|
|
174
|
+
"preminor",
|
|
175
|
+
"patch",
|
|
176
|
+
"prepatch",
|
|
177
|
+
"prerelease"
|
|
178
|
+
];
|
|
179
|
+
module.exports = {
|
|
180
|
+
MAX_LENGTH,
|
|
181
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
182
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
183
|
+
MAX_SAFE_INTEGER,
|
|
184
|
+
RELEASE_TYPES,
|
|
185
|
+
SEMVER_SPEC_VERSION,
|
|
186
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
187
|
+
FLAG_LOOSE: 2
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// node_modules/semver/internal/debug.js
|
|
193
|
+
var require_debug = __commonJS({
|
|
194
|
+
"node_modules/semver/internal/debug.js"(exports, module) {
|
|
195
|
+
"use strict";
|
|
196
|
+
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
197
|
+
};
|
|
198
|
+
module.exports = debug;
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// node_modules/semver/internal/re.js
|
|
203
|
+
var require_re = __commonJS({
|
|
204
|
+
"node_modules/semver/internal/re.js"(exports, module) {
|
|
205
|
+
"use strict";
|
|
206
|
+
var {
|
|
207
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
208
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
209
|
+
MAX_LENGTH
|
|
210
|
+
} = require_constants();
|
|
211
|
+
var debug = require_debug();
|
|
212
|
+
exports = module.exports = {};
|
|
213
|
+
var re = exports.re = [];
|
|
214
|
+
var safeRe = exports.safeRe = [];
|
|
215
|
+
var src = exports.src = [];
|
|
216
|
+
var safeSrc = exports.safeSrc = [];
|
|
217
|
+
var t2 = exports.t = {};
|
|
218
|
+
var R2 = 0;
|
|
219
|
+
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
220
|
+
var safeRegexReplacements = [
|
|
221
|
+
["\\s", 1],
|
|
222
|
+
["\\d", MAX_LENGTH],
|
|
223
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
224
|
+
];
|
|
225
|
+
var makeSafeRegex = (value) => {
|
|
226
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
227
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
228
|
+
}
|
|
229
|
+
return value;
|
|
230
|
+
};
|
|
231
|
+
var createToken = (name, value, isGlobal) => {
|
|
232
|
+
const safe = makeSafeRegex(value);
|
|
233
|
+
const index = R2++;
|
|
234
|
+
debug(name, index, value);
|
|
235
|
+
t2[name] = index;
|
|
236
|
+
src[index] = value;
|
|
237
|
+
safeSrc[index] = safe;
|
|
238
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
239
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
240
|
+
};
|
|
241
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
242
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
243
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
244
|
+
createToken("MAINVERSION", `(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})`);
|
|
245
|
+
createToken("MAINVERSIONLOOSE", `(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})`);
|
|
246
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t2.NONNUMERICIDENTIFIER]}|${src[t2.NUMERICIDENTIFIER]})`);
|
|
247
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t2.NONNUMERICIDENTIFIER]}|${src[t2.NUMERICIDENTIFIERLOOSE]})`);
|
|
248
|
+
createToken("PRERELEASE", `(?:-(${src[t2.PRERELEASEIDENTIFIER]}(?:\\.${src[t2.PRERELEASEIDENTIFIER]})*))`);
|
|
249
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t2.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t2.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
250
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
251
|
+
createToken("BUILD", `(?:\\+(${src[t2.BUILDIDENTIFIER]}(?:\\.${src[t2.BUILDIDENTIFIER]})*))`);
|
|
252
|
+
createToken("FULLPLAIN", `v?${src[t2.MAINVERSION]}${src[t2.PRERELEASE]}?${src[t2.BUILD]}?`);
|
|
253
|
+
createToken("FULL", `^${src[t2.FULLPLAIN]}$`);
|
|
254
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t2.MAINVERSIONLOOSE]}${src[t2.PRERELEASELOOSE]}?${src[t2.BUILD]}?`);
|
|
255
|
+
createToken("LOOSE", `^${src[t2.LOOSEPLAIN]}$`);
|
|
256
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
257
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t2.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
258
|
+
createToken("XRANGEIDENTIFIER", `${src[t2.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
259
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t2.XRANGEIDENTIFIER]})(?:\\.(${src[t2.XRANGEIDENTIFIER]})(?:\\.(${src[t2.XRANGEIDENTIFIER]})(?:${src[t2.PRERELEASE]})?${src[t2.BUILD]}?)?)?`);
|
|
260
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:${src[t2.PRERELEASELOOSE]})?${src[t2.BUILD]}?)?)?`);
|
|
261
|
+
createToken("XRANGE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAIN]}$`);
|
|
262
|
+
createToken("XRANGELOOSE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAINLOOSE]}$`);
|
|
263
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
264
|
+
createToken("COERCE", `${src[t2.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
265
|
+
createToken("COERCEFULL", src[t2.COERCEPLAIN] + `(?:${src[t2.PRERELEASE]})?(?:${src[t2.BUILD]})?(?:$|[^\\d])`);
|
|
266
|
+
createToken("COERCERTL", src[t2.COERCE], true);
|
|
267
|
+
createToken("COERCERTLFULL", src[t2.COERCEFULL], true);
|
|
268
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
269
|
+
createToken("TILDETRIM", `(\\s*)${src[t2.LONETILDE]}\\s+`, true);
|
|
270
|
+
exports.tildeTrimReplace = "$1~";
|
|
271
|
+
createToken("TILDE", `^${src[t2.LONETILDE]}${src[t2.XRANGEPLAIN]}$`);
|
|
272
|
+
createToken("TILDELOOSE", `^${src[t2.LONETILDE]}${src[t2.XRANGEPLAINLOOSE]}$`);
|
|
273
|
+
createToken("LONECARET", "(?:\\^)");
|
|
274
|
+
createToken("CARETTRIM", `(\\s*)${src[t2.LONECARET]}\\s+`, true);
|
|
275
|
+
exports.caretTrimReplace = "$1^";
|
|
276
|
+
createToken("CARET", `^${src[t2.LONECARET]}${src[t2.XRANGEPLAIN]}$`);
|
|
277
|
+
createToken("CARETLOOSE", `^${src[t2.LONECARET]}${src[t2.XRANGEPLAINLOOSE]}$`);
|
|
278
|
+
createToken("COMPARATORLOOSE", `^${src[t2.GTLT]}\\s*(${src[t2.LOOSEPLAIN]})$|^$`);
|
|
279
|
+
createToken("COMPARATOR", `^${src[t2.GTLT]}\\s*(${src[t2.FULLPLAIN]})$|^$`);
|
|
280
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t2.GTLT]}\\s*(${src[t2.LOOSEPLAIN]}|${src[t2.XRANGEPLAIN]})`, true);
|
|
281
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
282
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t2.XRANGEPLAIN]})\\s+-\\s+(${src[t2.XRANGEPLAIN]})\\s*$`);
|
|
283
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t2.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t2.XRANGEPLAINLOOSE]})\\s*$`);
|
|
284
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
285
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
286
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
// node_modules/semver/internal/parse-options.js
|
|
291
|
+
var require_parse_options = __commonJS({
|
|
292
|
+
"node_modules/semver/internal/parse-options.js"(exports, module) {
|
|
293
|
+
"use strict";
|
|
294
|
+
var looseOption = Object.freeze({ loose: true });
|
|
295
|
+
var emptyOpts = Object.freeze({});
|
|
296
|
+
var parseOptions = (options) => {
|
|
297
|
+
if (!options) {
|
|
298
|
+
return emptyOpts;
|
|
299
|
+
}
|
|
300
|
+
if (typeof options !== "object") {
|
|
301
|
+
return looseOption;
|
|
302
|
+
}
|
|
303
|
+
return options;
|
|
304
|
+
};
|
|
305
|
+
module.exports = parseOptions;
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
// node_modules/semver/internal/identifiers.js
|
|
310
|
+
var require_identifiers = __commonJS({
|
|
311
|
+
"node_modules/semver/internal/identifiers.js"(exports, module) {
|
|
312
|
+
"use strict";
|
|
313
|
+
var numeric = /^[0-9]+$/;
|
|
314
|
+
var compareIdentifiers = (a2, b) => {
|
|
315
|
+
if (typeof a2 === "number" && typeof b === "number") {
|
|
316
|
+
return a2 === b ? 0 : a2 < b ? -1 : 1;
|
|
317
|
+
}
|
|
318
|
+
const anum = numeric.test(a2);
|
|
319
|
+
const bnum = numeric.test(b);
|
|
320
|
+
if (anum && bnum) {
|
|
321
|
+
a2 = +a2;
|
|
322
|
+
b = +b;
|
|
323
|
+
}
|
|
324
|
+
return a2 === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a2 < b ? -1 : 1;
|
|
325
|
+
};
|
|
326
|
+
var rcompareIdentifiers = (a2, b) => compareIdentifiers(b, a2);
|
|
327
|
+
module.exports = {
|
|
328
|
+
compareIdentifiers,
|
|
329
|
+
rcompareIdentifiers
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
// node_modules/semver/classes/semver.js
|
|
335
|
+
var require_semver = __commonJS({
|
|
336
|
+
"node_modules/semver/classes/semver.js"(exports, module) {
|
|
337
|
+
"use strict";
|
|
338
|
+
var debug = require_debug();
|
|
339
|
+
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
340
|
+
var { safeRe: re, t: t2 } = require_re();
|
|
341
|
+
var parseOptions = require_parse_options();
|
|
342
|
+
var { compareIdentifiers } = require_identifiers();
|
|
343
|
+
var isPrereleaseIdentifier = (prerelease, identifier) => {
|
|
344
|
+
const identifiers = identifier.split(".");
|
|
345
|
+
if (identifiers.length > prerelease.length) {
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
for (let i2 = 0; i2 < identifiers.length; i2++) {
|
|
349
|
+
if (compareIdentifiers(prerelease[i2], identifiers[i2]) !== 0) {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return true;
|
|
354
|
+
};
|
|
355
|
+
var SemVer = class _SemVer {
|
|
356
|
+
constructor(version2, options) {
|
|
357
|
+
options = parseOptions(options);
|
|
358
|
+
if (version2 instanceof _SemVer) {
|
|
359
|
+
if (version2.loose === !!options.loose && version2.includePrerelease === !!options.includePrerelease) {
|
|
360
|
+
return version2;
|
|
361
|
+
} else {
|
|
362
|
+
version2 = version2.version;
|
|
363
|
+
}
|
|
364
|
+
} else if (typeof version2 !== "string") {
|
|
365
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version2}".`);
|
|
366
|
+
}
|
|
367
|
+
if (version2.length > MAX_LENGTH) {
|
|
368
|
+
throw new TypeError(
|
|
369
|
+
`version is longer than ${MAX_LENGTH} characters`
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
debug("SemVer", version2, options);
|
|
373
|
+
this.options = options;
|
|
374
|
+
this.loose = !!options.loose;
|
|
375
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
376
|
+
const m2 = version2.trim().match(options.loose ? re[t2.LOOSE] : re[t2.FULL]);
|
|
377
|
+
if (!m2) {
|
|
378
|
+
throw new TypeError(`Invalid Version: ${version2}`);
|
|
379
|
+
}
|
|
380
|
+
this.raw = version2;
|
|
381
|
+
this.major = +m2[1];
|
|
382
|
+
this.minor = +m2[2];
|
|
383
|
+
this.patch = +m2[3];
|
|
384
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
385
|
+
throw new TypeError("Invalid major version");
|
|
386
|
+
}
|
|
387
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
388
|
+
throw new TypeError("Invalid minor version");
|
|
389
|
+
}
|
|
390
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
391
|
+
throw new TypeError("Invalid patch version");
|
|
392
|
+
}
|
|
393
|
+
if (!m2[4]) {
|
|
394
|
+
this.prerelease = [];
|
|
395
|
+
} else {
|
|
396
|
+
this.prerelease = m2[4].split(".").map((id) => {
|
|
397
|
+
if (/^[0-9]+$/.test(id)) {
|
|
398
|
+
const num = +id;
|
|
399
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
400
|
+
return num;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return id;
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
this.build = m2[5] ? m2[5].split(".") : [];
|
|
407
|
+
this.format();
|
|
408
|
+
}
|
|
409
|
+
format() {
|
|
410
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
411
|
+
if (this.prerelease.length) {
|
|
412
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
413
|
+
}
|
|
414
|
+
return this.version;
|
|
415
|
+
}
|
|
416
|
+
toString() {
|
|
417
|
+
return this.version;
|
|
418
|
+
}
|
|
419
|
+
compare(other) {
|
|
420
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
421
|
+
if (!(other instanceof _SemVer)) {
|
|
422
|
+
if (typeof other === "string" && other === this.version) {
|
|
423
|
+
return 0;
|
|
424
|
+
}
|
|
425
|
+
other = new _SemVer(other, this.options);
|
|
426
|
+
}
|
|
427
|
+
if (other.version === this.version) {
|
|
428
|
+
return 0;
|
|
429
|
+
}
|
|
430
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
431
|
+
}
|
|
432
|
+
compareMain(other) {
|
|
433
|
+
if (!(other instanceof _SemVer)) {
|
|
434
|
+
other = new _SemVer(other, this.options);
|
|
435
|
+
}
|
|
436
|
+
if (this.major < other.major) {
|
|
437
|
+
return -1;
|
|
438
|
+
}
|
|
439
|
+
if (this.major > other.major) {
|
|
440
|
+
return 1;
|
|
441
|
+
}
|
|
442
|
+
if (this.minor < other.minor) {
|
|
443
|
+
return -1;
|
|
444
|
+
}
|
|
445
|
+
if (this.minor > other.minor) {
|
|
446
|
+
return 1;
|
|
447
|
+
}
|
|
448
|
+
if (this.patch < other.patch) {
|
|
449
|
+
return -1;
|
|
450
|
+
}
|
|
451
|
+
if (this.patch > other.patch) {
|
|
452
|
+
return 1;
|
|
453
|
+
}
|
|
454
|
+
return 0;
|
|
455
|
+
}
|
|
456
|
+
comparePre(other) {
|
|
457
|
+
if (!(other instanceof _SemVer)) {
|
|
458
|
+
other = new _SemVer(other, this.options);
|
|
459
|
+
}
|
|
460
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
461
|
+
return -1;
|
|
462
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
463
|
+
return 1;
|
|
464
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
465
|
+
return 0;
|
|
466
|
+
}
|
|
467
|
+
let i2 = 0;
|
|
468
|
+
do {
|
|
469
|
+
const a2 = this.prerelease[i2];
|
|
470
|
+
const b = other.prerelease[i2];
|
|
471
|
+
debug("prerelease compare", i2, a2, b);
|
|
472
|
+
if (a2 === void 0 && b === void 0) {
|
|
473
|
+
return 0;
|
|
474
|
+
} else if (b === void 0) {
|
|
475
|
+
return 1;
|
|
476
|
+
} else if (a2 === void 0) {
|
|
477
|
+
return -1;
|
|
478
|
+
} else if (a2 === b) {
|
|
479
|
+
continue;
|
|
480
|
+
} else {
|
|
481
|
+
return compareIdentifiers(a2, b);
|
|
482
|
+
}
|
|
483
|
+
} while (++i2);
|
|
484
|
+
}
|
|
485
|
+
compareBuild(other) {
|
|
486
|
+
if (!(other instanceof _SemVer)) {
|
|
487
|
+
other = new _SemVer(other, this.options);
|
|
488
|
+
}
|
|
489
|
+
let i2 = 0;
|
|
490
|
+
do {
|
|
491
|
+
const a2 = this.build[i2];
|
|
492
|
+
const b = other.build[i2];
|
|
493
|
+
debug("build compare", i2, a2, b);
|
|
494
|
+
if (a2 === void 0 && b === void 0) {
|
|
495
|
+
return 0;
|
|
496
|
+
} else if (b === void 0) {
|
|
497
|
+
return 1;
|
|
498
|
+
} else if (a2 === void 0) {
|
|
499
|
+
return -1;
|
|
500
|
+
} else if (a2 === b) {
|
|
501
|
+
continue;
|
|
502
|
+
} else {
|
|
503
|
+
return compareIdentifiers(a2, b);
|
|
504
|
+
}
|
|
505
|
+
} while (++i2);
|
|
506
|
+
}
|
|
507
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
508
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
509
|
+
inc(release, identifier, identifierBase) {
|
|
510
|
+
if (release.startsWith("pre")) {
|
|
511
|
+
if (!identifier && identifierBase === false) {
|
|
512
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
513
|
+
}
|
|
514
|
+
if (identifier) {
|
|
515
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t2.PRERELEASELOOSE] : re[t2.PRERELEASE]);
|
|
516
|
+
if (!match || match[1] !== identifier) {
|
|
517
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
switch (release) {
|
|
522
|
+
case "premajor":
|
|
523
|
+
this.prerelease.length = 0;
|
|
524
|
+
this.patch = 0;
|
|
525
|
+
this.minor = 0;
|
|
526
|
+
this.major++;
|
|
527
|
+
this.inc("pre", identifier, identifierBase);
|
|
528
|
+
break;
|
|
529
|
+
case "preminor":
|
|
530
|
+
this.prerelease.length = 0;
|
|
531
|
+
this.patch = 0;
|
|
532
|
+
this.minor++;
|
|
533
|
+
this.inc("pre", identifier, identifierBase);
|
|
534
|
+
break;
|
|
535
|
+
case "prepatch":
|
|
536
|
+
this.prerelease.length = 0;
|
|
537
|
+
this.inc("patch", identifier, identifierBase);
|
|
538
|
+
this.inc("pre", identifier, identifierBase);
|
|
539
|
+
break;
|
|
540
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
541
|
+
// prepatch.
|
|
542
|
+
case "prerelease":
|
|
543
|
+
if (this.prerelease.length === 0) {
|
|
544
|
+
this.inc("patch", identifier, identifierBase);
|
|
545
|
+
}
|
|
546
|
+
this.inc("pre", identifier, identifierBase);
|
|
547
|
+
break;
|
|
548
|
+
case "release":
|
|
549
|
+
if (this.prerelease.length === 0) {
|
|
550
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
551
|
+
}
|
|
552
|
+
this.prerelease.length = 0;
|
|
553
|
+
break;
|
|
554
|
+
case "major":
|
|
555
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
556
|
+
this.major++;
|
|
557
|
+
}
|
|
558
|
+
this.minor = 0;
|
|
559
|
+
this.patch = 0;
|
|
560
|
+
this.prerelease = [];
|
|
561
|
+
break;
|
|
562
|
+
case "minor":
|
|
563
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
564
|
+
this.minor++;
|
|
565
|
+
}
|
|
566
|
+
this.patch = 0;
|
|
567
|
+
this.prerelease = [];
|
|
568
|
+
break;
|
|
569
|
+
case "patch":
|
|
570
|
+
if (this.prerelease.length === 0) {
|
|
571
|
+
this.patch++;
|
|
572
|
+
}
|
|
573
|
+
this.prerelease = [];
|
|
574
|
+
break;
|
|
575
|
+
// This probably shouldn't be used publicly.
|
|
576
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
577
|
+
case "pre": {
|
|
578
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
579
|
+
if (this.prerelease.length === 0) {
|
|
580
|
+
this.prerelease = [base];
|
|
581
|
+
} else {
|
|
582
|
+
let i2 = this.prerelease.length;
|
|
583
|
+
while (--i2 >= 0) {
|
|
584
|
+
if (typeof this.prerelease[i2] === "number") {
|
|
585
|
+
this.prerelease[i2]++;
|
|
586
|
+
i2 = -2;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
if (i2 === -1) {
|
|
590
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
591
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
592
|
+
}
|
|
593
|
+
this.prerelease.push(base);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
if (identifier) {
|
|
597
|
+
let prerelease = [identifier, base];
|
|
598
|
+
if (identifierBase === false) {
|
|
599
|
+
prerelease = [identifier];
|
|
600
|
+
}
|
|
601
|
+
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
602
|
+
const prereleaseBase = this.prerelease[identifier.split(".").length];
|
|
603
|
+
if (isNaN(prereleaseBase)) {
|
|
604
|
+
this.prerelease = prerelease;
|
|
605
|
+
}
|
|
606
|
+
} else {
|
|
607
|
+
this.prerelease = prerelease;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
default:
|
|
613
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
614
|
+
}
|
|
615
|
+
this.raw = this.format();
|
|
616
|
+
if (this.build.length) {
|
|
617
|
+
this.raw += `+${this.build.join(".")}`;
|
|
618
|
+
}
|
|
619
|
+
return this;
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
module.exports = SemVer;
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
|
|
626
|
+
// node_modules/semver/functions/parse.js
|
|
627
|
+
var require_parse = __commonJS({
|
|
628
|
+
"node_modules/semver/functions/parse.js"(exports, module) {
|
|
629
|
+
"use strict";
|
|
630
|
+
var SemVer = require_semver();
|
|
631
|
+
var parse = (version2, options, throwErrors = false) => {
|
|
632
|
+
if (version2 instanceof SemVer) {
|
|
633
|
+
return version2;
|
|
634
|
+
}
|
|
635
|
+
try {
|
|
636
|
+
return new SemVer(version2, options);
|
|
637
|
+
} catch (er) {
|
|
638
|
+
if (!throwErrors) {
|
|
639
|
+
return null;
|
|
640
|
+
}
|
|
641
|
+
throw er;
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
module.exports = parse;
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
// node_modules/semver/functions/valid.js
|
|
649
|
+
var require_valid = __commonJS({
|
|
650
|
+
"node_modules/semver/functions/valid.js"(exports, module) {
|
|
651
|
+
"use strict";
|
|
652
|
+
var parse = require_parse();
|
|
653
|
+
var valid = (version2, options) => {
|
|
654
|
+
const v = parse(version2, options);
|
|
655
|
+
return v ? v.version : null;
|
|
656
|
+
};
|
|
657
|
+
module.exports = valid;
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
// node_modules/semver/functions/clean.js
|
|
662
|
+
var require_clean = __commonJS({
|
|
663
|
+
"node_modules/semver/functions/clean.js"(exports, module) {
|
|
664
|
+
"use strict";
|
|
665
|
+
var parse = require_parse();
|
|
666
|
+
var clean = (version2, options) => {
|
|
667
|
+
const s = parse(version2.trim().replace(/^[=v]+/, ""), options);
|
|
668
|
+
return s ? s.version : null;
|
|
669
|
+
};
|
|
670
|
+
module.exports = clean;
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
|
|
674
|
+
// node_modules/semver/functions/inc.js
|
|
675
|
+
var require_inc = __commonJS({
|
|
676
|
+
"node_modules/semver/functions/inc.js"(exports, module) {
|
|
677
|
+
"use strict";
|
|
678
|
+
var SemVer = require_semver();
|
|
679
|
+
var inc = (version2, release, options, identifier, identifierBase) => {
|
|
680
|
+
if (typeof options === "string") {
|
|
681
|
+
identifierBase = identifier;
|
|
682
|
+
identifier = options;
|
|
683
|
+
options = void 0;
|
|
684
|
+
}
|
|
685
|
+
try {
|
|
686
|
+
return new SemVer(
|
|
687
|
+
version2 instanceof SemVer ? version2.version : version2,
|
|
688
|
+
options
|
|
689
|
+
).inc(release, identifier, identifierBase).version;
|
|
690
|
+
} catch (er) {
|
|
691
|
+
return null;
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
module.exports = inc;
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
// node_modules/semver/functions/diff.js
|
|
699
|
+
var require_diff = __commonJS({
|
|
700
|
+
"node_modules/semver/functions/diff.js"(exports, module) {
|
|
701
|
+
"use strict";
|
|
702
|
+
var parse = require_parse();
|
|
703
|
+
var diff = (version1, version2) => {
|
|
704
|
+
const v1 = parse(version1, null, true);
|
|
705
|
+
const v2 = parse(version2, null, true);
|
|
706
|
+
const comparison = v1.compare(v2);
|
|
707
|
+
if (comparison === 0) {
|
|
708
|
+
return null;
|
|
709
|
+
}
|
|
710
|
+
const v1Higher = comparison > 0;
|
|
711
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
712
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
713
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
714
|
+
const lowHasPre = !!lowVersion.prerelease.length;
|
|
715
|
+
if (lowHasPre && !highHasPre) {
|
|
716
|
+
if (!lowVersion.patch && !lowVersion.minor) {
|
|
717
|
+
return "major";
|
|
718
|
+
}
|
|
719
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
720
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
721
|
+
return "minor";
|
|
722
|
+
}
|
|
723
|
+
return "patch";
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
const prefix = highHasPre ? "pre" : "";
|
|
727
|
+
if (v1.major !== v2.major) {
|
|
728
|
+
return prefix + "major";
|
|
729
|
+
}
|
|
730
|
+
if (v1.minor !== v2.minor) {
|
|
731
|
+
return prefix + "minor";
|
|
732
|
+
}
|
|
733
|
+
if (v1.patch !== v2.patch) {
|
|
734
|
+
return prefix + "patch";
|
|
735
|
+
}
|
|
736
|
+
return "prerelease";
|
|
737
|
+
};
|
|
738
|
+
module.exports = diff;
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
// node_modules/semver/functions/major.js
|
|
743
|
+
var require_major = __commonJS({
|
|
744
|
+
"node_modules/semver/functions/major.js"(exports, module) {
|
|
745
|
+
"use strict";
|
|
746
|
+
var SemVer = require_semver();
|
|
747
|
+
var major = (a2, loose) => new SemVer(a2, loose).major;
|
|
748
|
+
module.exports = major;
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
|
|
752
|
+
// node_modules/semver/functions/minor.js
|
|
753
|
+
var require_minor = __commonJS({
|
|
754
|
+
"node_modules/semver/functions/minor.js"(exports, module) {
|
|
755
|
+
"use strict";
|
|
756
|
+
var SemVer = require_semver();
|
|
757
|
+
var minor = (a2, loose) => new SemVer(a2, loose).minor;
|
|
758
|
+
module.exports = minor;
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
// node_modules/semver/functions/patch.js
|
|
763
|
+
var require_patch = __commonJS({
|
|
764
|
+
"node_modules/semver/functions/patch.js"(exports, module) {
|
|
765
|
+
"use strict";
|
|
766
|
+
var SemVer = require_semver();
|
|
767
|
+
var patch = (a2, loose) => new SemVer(a2, loose).patch;
|
|
768
|
+
module.exports = patch;
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
// node_modules/semver/functions/prerelease.js
|
|
773
|
+
var require_prerelease = __commonJS({
|
|
774
|
+
"node_modules/semver/functions/prerelease.js"(exports, module) {
|
|
775
|
+
"use strict";
|
|
776
|
+
var parse = require_parse();
|
|
777
|
+
var prerelease = (version2, options) => {
|
|
778
|
+
const parsed = parse(version2, options);
|
|
779
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
780
|
+
};
|
|
781
|
+
module.exports = prerelease;
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
|
|
785
|
+
// node_modules/semver/functions/compare.js
|
|
786
|
+
var require_compare = __commonJS({
|
|
787
|
+
"node_modules/semver/functions/compare.js"(exports, module) {
|
|
788
|
+
"use strict";
|
|
789
|
+
var SemVer = require_semver();
|
|
790
|
+
var compare = (a2, b, loose) => new SemVer(a2, loose).compare(new SemVer(b, loose));
|
|
791
|
+
module.exports = compare;
|
|
792
|
+
}
|
|
793
|
+
});
|
|
794
|
+
|
|
795
|
+
// node_modules/semver/functions/rcompare.js
|
|
796
|
+
var require_rcompare = __commonJS({
|
|
797
|
+
"node_modules/semver/functions/rcompare.js"(exports, module) {
|
|
798
|
+
"use strict";
|
|
799
|
+
var compare = require_compare();
|
|
800
|
+
var rcompare = (a2, b, loose) => compare(b, a2, loose);
|
|
801
|
+
module.exports = rcompare;
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
// node_modules/semver/functions/compare-loose.js
|
|
806
|
+
var require_compare_loose = __commonJS({
|
|
807
|
+
"node_modules/semver/functions/compare-loose.js"(exports, module) {
|
|
808
|
+
"use strict";
|
|
809
|
+
var compare = require_compare();
|
|
810
|
+
var compareLoose = (a2, b) => compare(a2, b, true);
|
|
811
|
+
module.exports = compareLoose;
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
|
|
815
|
+
// node_modules/semver/functions/compare-build.js
|
|
816
|
+
var require_compare_build = __commonJS({
|
|
817
|
+
"node_modules/semver/functions/compare-build.js"(exports, module) {
|
|
818
|
+
"use strict";
|
|
819
|
+
var SemVer = require_semver();
|
|
820
|
+
var compareBuild = (a2, b, loose) => {
|
|
821
|
+
const versionA = new SemVer(a2, loose);
|
|
822
|
+
const versionB = new SemVer(b, loose);
|
|
823
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
824
|
+
};
|
|
825
|
+
module.exports = compareBuild;
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
|
|
829
|
+
// node_modules/semver/functions/sort.js
|
|
830
|
+
var require_sort = __commonJS({
|
|
831
|
+
"node_modules/semver/functions/sort.js"(exports, module) {
|
|
832
|
+
"use strict";
|
|
833
|
+
var compareBuild = require_compare_build();
|
|
834
|
+
var sort = (list, loose) => list.sort((a2, b) => compareBuild(a2, b, loose));
|
|
835
|
+
module.exports = sort;
|
|
836
|
+
}
|
|
837
|
+
});
|
|
838
|
+
|
|
839
|
+
// node_modules/semver/functions/rsort.js
|
|
840
|
+
var require_rsort = __commonJS({
|
|
841
|
+
"node_modules/semver/functions/rsort.js"(exports, module) {
|
|
842
|
+
"use strict";
|
|
843
|
+
var compareBuild = require_compare_build();
|
|
844
|
+
var rsort = (list, loose) => list.sort((a2, b) => compareBuild(b, a2, loose));
|
|
845
|
+
module.exports = rsort;
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
|
|
849
|
+
// node_modules/semver/functions/gt.js
|
|
850
|
+
var require_gt = __commonJS({
|
|
851
|
+
"node_modules/semver/functions/gt.js"(exports, module) {
|
|
852
|
+
"use strict";
|
|
853
|
+
var compare = require_compare();
|
|
854
|
+
var gt = (a2, b, loose) => compare(a2, b, loose) > 0;
|
|
855
|
+
module.exports = gt;
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
// node_modules/semver/functions/lt.js
|
|
860
|
+
var require_lt = __commonJS({
|
|
861
|
+
"node_modules/semver/functions/lt.js"(exports, module) {
|
|
862
|
+
"use strict";
|
|
863
|
+
var compare = require_compare();
|
|
864
|
+
var lt = (a2, b, loose) => compare(a2, b, loose) < 0;
|
|
865
|
+
module.exports = lt;
|
|
866
|
+
}
|
|
867
|
+
});
|
|
868
|
+
|
|
869
|
+
// node_modules/semver/functions/eq.js
|
|
870
|
+
var require_eq = __commonJS({
|
|
871
|
+
"node_modules/semver/functions/eq.js"(exports, module) {
|
|
872
|
+
"use strict";
|
|
873
|
+
var compare = require_compare();
|
|
874
|
+
var eq = (a2, b, loose) => compare(a2, b, loose) === 0;
|
|
875
|
+
module.exports = eq;
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
|
|
879
|
+
// node_modules/semver/functions/neq.js
|
|
880
|
+
var require_neq = __commonJS({
|
|
881
|
+
"node_modules/semver/functions/neq.js"(exports, module) {
|
|
882
|
+
"use strict";
|
|
883
|
+
var compare = require_compare();
|
|
884
|
+
var neq = (a2, b, loose) => compare(a2, b, loose) !== 0;
|
|
885
|
+
module.exports = neq;
|
|
886
|
+
}
|
|
887
|
+
});
|
|
888
|
+
|
|
889
|
+
// node_modules/semver/functions/gte.js
|
|
890
|
+
var require_gte = __commonJS({
|
|
891
|
+
"node_modules/semver/functions/gte.js"(exports, module) {
|
|
892
|
+
"use strict";
|
|
893
|
+
var compare = require_compare();
|
|
894
|
+
var gte = (a2, b, loose) => compare(a2, b, loose) >= 0;
|
|
895
|
+
module.exports = gte;
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
|
|
899
|
+
// node_modules/semver/functions/lte.js
|
|
900
|
+
var require_lte = __commonJS({
|
|
901
|
+
"node_modules/semver/functions/lte.js"(exports, module) {
|
|
902
|
+
"use strict";
|
|
903
|
+
var compare = require_compare();
|
|
904
|
+
var lte = (a2, b, loose) => compare(a2, b, loose) <= 0;
|
|
905
|
+
module.exports = lte;
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
|
|
909
|
+
// node_modules/semver/functions/cmp.js
|
|
910
|
+
var require_cmp = __commonJS({
|
|
911
|
+
"node_modules/semver/functions/cmp.js"(exports, module) {
|
|
912
|
+
"use strict";
|
|
913
|
+
var eq = require_eq();
|
|
914
|
+
var neq = require_neq();
|
|
915
|
+
var gt = require_gt();
|
|
916
|
+
var gte = require_gte();
|
|
917
|
+
var lt = require_lt();
|
|
918
|
+
var lte = require_lte();
|
|
919
|
+
var cmp = (a2, op, b, loose) => {
|
|
920
|
+
switch (op) {
|
|
921
|
+
case "===":
|
|
922
|
+
if (typeof a2 === "object") {
|
|
923
|
+
a2 = a2.version;
|
|
924
|
+
}
|
|
925
|
+
if (typeof b === "object") {
|
|
926
|
+
b = b.version;
|
|
927
|
+
}
|
|
928
|
+
return a2 === b;
|
|
929
|
+
case "!==":
|
|
930
|
+
if (typeof a2 === "object") {
|
|
931
|
+
a2 = a2.version;
|
|
932
|
+
}
|
|
933
|
+
if (typeof b === "object") {
|
|
934
|
+
b = b.version;
|
|
935
|
+
}
|
|
936
|
+
return a2 !== b;
|
|
937
|
+
case "":
|
|
938
|
+
case "=":
|
|
939
|
+
case "==":
|
|
940
|
+
return eq(a2, b, loose);
|
|
941
|
+
case "!=":
|
|
942
|
+
return neq(a2, b, loose);
|
|
943
|
+
case ">":
|
|
944
|
+
return gt(a2, b, loose);
|
|
945
|
+
case ">=":
|
|
946
|
+
return gte(a2, b, loose);
|
|
947
|
+
case "<":
|
|
948
|
+
return lt(a2, b, loose);
|
|
949
|
+
case "<=":
|
|
950
|
+
return lte(a2, b, loose);
|
|
951
|
+
default:
|
|
952
|
+
throw new TypeError(`Invalid operator: ${op}`);
|
|
953
|
+
}
|
|
954
|
+
};
|
|
955
|
+
module.exports = cmp;
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
|
|
959
|
+
// node_modules/semver/functions/coerce.js
|
|
960
|
+
var require_coerce = __commonJS({
|
|
961
|
+
"node_modules/semver/functions/coerce.js"(exports, module) {
|
|
962
|
+
"use strict";
|
|
963
|
+
var SemVer = require_semver();
|
|
964
|
+
var parse = require_parse();
|
|
965
|
+
var { safeRe: re, t: t2 } = require_re();
|
|
966
|
+
var coerce = (version2, options) => {
|
|
967
|
+
if (version2 instanceof SemVer) {
|
|
968
|
+
return version2;
|
|
969
|
+
}
|
|
970
|
+
if (typeof version2 === "number") {
|
|
971
|
+
version2 = String(version2);
|
|
972
|
+
}
|
|
973
|
+
if (typeof version2 !== "string") {
|
|
974
|
+
return null;
|
|
975
|
+
}
|
|
976
|
+
options = options || {};
|
|
977
|
+
let match = null;
|
|
978
|
+
if (!options.rtl) {
|
|
979
|
+
match = version2.match(options.includePrerelease ? re[t2.COERCEFULL] : re[t2.COERCE]);
|
|
980
|
+
} else {
|
|
981
|
+
const coerceRtlRegex = options.includePrerelease ? re[t2.COERCERTLFULL] : re[t2.COERCERTL];
|
|
982
|
+
let next;
|
|
983
|
+
while ((next = coerceRtlRegex.exec(version2)) && (!match || match.index + match[0].length !== version2.length)) {
|
|
984
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
985
|
+
match = next;
|
|
986
|
+
}
|
|
987
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
988
|
+
}
|
|
989
|
+
coerceRtlRegex.lastIndex = -1;
|
|
990
|
+
}
|
|
991
|
+
if (match === null) {
|
|
992
|
+
return null;
|
|
993
|
+
}
|
|
994
|
+
const major = match[2];
|
|
995
|
+
const minor = match[3] || "0";
|
|
996
|
+
const patch = match[4] || "0";
|
|
997
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
998
|
+
const build2 = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
999
|
+
return parse(`${major}.${minor}.${patch}${prerelease}${build2}`, options);
|
|
1000
|
+
};
|
|
1001
|
+
module.exports = coerce;
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
|
|
1005
|
+
// node_modules/semver/functions/truncate.js
|
|
1006
|
+
var require_truncate = __commonJS({
|
|
1007
|
+
"node_modules/semver/functions/truncate.js"(exports, module) {
|
|
1008
|
+
"use strict";
|
|
1009
|
+
var parse = require_parse();
|
|
1010
|
+
var constants = require_constants();
|
|
1011
|
+
var SemVer = require_semver();
|
|
1012
|
+
var truncate = (version2, truncation, options) => {
|
|
1013
|
+
if (!constants.RELEASE_TYPES.includes(truncation)) {
|
|
1014
|
+
return null;
|
|
1015
|
+
}
|
|
1016
|
+
const clonedVersion = cloneInputVersion(version2, options);
|
|
1017
|
+
return clonedVersion && doTruncation(clonedVersion, truncation);
|
|
1018
|
+
};
|
|
1019
|
+
var cloneInputVersion = (version2, options) => {
|
|
1020
|
+
const versionStringToParse = version2 instanceof SemVer ? version2.version : version2;
|
|
1021
|
+
return parse(versionStringToParse, options);
|
|
1022
|
+
};
|
|
1023
|
+
var doTruncation = (version2, truncation) => {
|
|
1024
|
+
if (isPrerelease(truncation)) {
|
|
1025
|
+
return version2.version;
|
|
1026
|
+
}
|
|
1027
|
+
version2.prerelease = [];
|
|
1028
|
+
switch (truncation) {
|
|
1029
|
+
case "major":
|
|
1030
|
+
version2.minor = 0;
|
|
1031
|
+
version2.patch = 0;
|
|
1032
|
+
break;
|
|
1033
|
+
case "minor":
|
|
1034
|
+
version2.patch = 0;
|
|
1035
|
+
break;
|
|
1036
|
+
}
|
|
1037
|
+
return version2.format();
|
|
1038
|
+
};
|
|
1039
|
+
var isPrerelease = (type) => {
|
|
1040
|
+
return type.startsWith("pre");
|
|
1041
|
+
};
|
|
1042
|
+
module.exports = truncate;
|
|
1043
|
+
}
|
|
1044
|
+
});
|
|
1045
|
+
|
|
1046
|
+
// node_modules/semver/internal/lrucache.js
|
|
1047
|
+
var require_lrucache = __commonJS({
|
|
1048
|
+
"node_modules/semver/internal/lrucache.js"(exports, module) {
|
|
1049
|
+
"use strict";
|
|
1050
|
+
var LRUCache = class {
|
|
1051
|
+
constructor() {
|
|
1052
|
+
this.max = 1e3;
|
|
1053
|
+
this.map = /* @__PURE__ */ new Map();
|
|
1054
|
+
}
|
|
1055
|
+
get(key) {
|
|
1056
|
+
const value = this.map.get(key);
|
|
1057
|
+
if (value === void 0) {
|
|
1058
|
+
return void 0;
|
|
1059
|
+
} else {
|
|
1060
|
+
this.map.delete(key);
|
|
1061
|
+
this.map.set(key, value);
|
|
1062
|
+
return value;
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
delete(key) {
|
|
1066
|
+
return this.map.delete(key);
|
|
1067
|
+
}
|
|
1068
|
+
set(key, value) {
|
|
1069
|
+
const deleted = this.delete(key);
|
|
1070
|
+
if (!deleted && value !== void 0) {
|
|
1071
|
+
if (this.map.size >= this.max) {
|
|
1072
|
+
const firstKey = this.map.keys().next().value;
|
|
1073
|
+
this.delete(firstKey);
|
|
1074
|
+
}
|
|
1075
|
+
this.map.set(key, value);
|
|
1076
|
+
}
|
|
1077
|
+
return this;
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1080
|
+
module.exports = LRUCache;
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
// node_modules/semver/classes/range.js
|
|
1085
|
+
var require_range = __commonJS({
|
|
1086
|
+
"node_modules/semver/classes/range.js"(exports, module) {
|
|
1087
|
+
"use strict";
|
|
1088
|
+
var SPACE_CHARACTERS = /\s+/g;
|
|
1089
|
+
var Range = class _Range {
|
|
1090
|
+
constructor(range, options) {
|
|
1091
|
+
options = parseOptions(options);
|
|
1092
|
+
if (range instanceof _Range) {
|
|
1093
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
1094
|
+
return range;
|
|
1095
|
+
} else {
|
|
1096
|
+
return new _Range(range.raw, options);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
if (range instanceof Comparator) {
|
|
1100
|
+
this.raw = range.value;
|
|
1101
|
+
this.set = [[range]];
|
|
1102
|
+
this.formatted = void 0;
|
|
1103
|
+
return this;
|
|
1104
|
+
}
|
|
1105
|
+
this.options = options;
|
|
1106
|
+
this.loose = !!options.loose;
|
|
1107
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
1108
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
1109
|
+
this.set = this.raw.split("||").map((r2) => this.parseRange(r2.trim())).filter((c2) => c2.length);
|
|
1110
|
+
if (!this.set.length) {
|
|
1111
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
1112
|
+
}
|
|
1113
|
+
if (this.set.length > 1) {
|
|
1114
|
+
const first = this.set[0];
|
|
1115
|
+
this.set = this.set.filter((c2) => !isNullSet(c2[0]));
|
|
1116
|
+
if (this.set.length === 0) {
|
|
1117
|
+
this.set = [first];
|
|
1118
|
+
} else if (this.set.length > 1) {
|
|
1119
|
+
for (const c2 of this.set) {
|
|
1120
|
+
if (c2.length === 1 && isAny(c2[0])) {
|
|
1121
|
+
this.set = [c2];
|
|
1122
|
+
break;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
this.formatted = void 0;
|
|
1128
|
+
}
|
|
1129
|
+
get range() {
|
|
1130
|
+
if (this.formatted === void 0) {
|
|
1131
|
+
this.formatted = "";
|
|
1132
|
+
for (let i2 = 0; i2 < this.set.length; i2++) {
|
|
1133
|
+
if (i2 > 0) {
|
|
1134
|
+
this.formatted += "||";
|
|
1135
|
+
}
|
|
1136
|
+
const comps = this.set[i2];
|
|
1137
|
+
for (let k = 0; k < comps.length; k++) {
|
|
1138
|
+
if (k > 0) {
|
|
1139
|
+
this.formatted += " ";
|
|
1140
|
+
}
|
|
1141
|
+
this.formatted += comps[k].toString().trim();
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
return this.formatted;
|
|
1146
|
+
}
|
|
1147
|
+
format() {
|
|
1148
|
+
return this.range;
|
|
1149
|
+
}
|
|
1150
|
+
toString() {
|
|
1151
|
+
return this.range;
|
|
1152
|
+
}
|
|
1153
|
+
parseRange(range) {
|
|
1154
|
+
range = range.replace(BUILDSTRIPRE, "");
|
|
1155
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
1156
|
+
const memoKey = memoOpts + ":" + range;
|
|
1157
|
+
const cached = cache.get(memoKey);
|
|
1158
|
+
if (cached) {
|
|
1159
|
+
return cached;
|
|
1160
|
+
}
|
|
1161
|
+
const loose = this.options.loose;
|
|
1162
|
+
const hr = loose ? re[t2.HYPHENRANGELOOSE] : re[t2.HYPHENRANGE];
|
|
1163
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
1164
|
+
debug("hyphen replace", range);
|
|
1165
|
+
range = range.replace(re[t2.COMPARATORTRIM], comparatorTrimReplace);
|
|
1166
|
+
debug("comparator trim", range);
|
|
1167
|
+
range = range.replace(re[t2.TILDETRIM], tildeTrimReplace);
|
|
1168
|
+
debug("tilde trim", range);
|
|
1169
|
+
range = range.replace(re[t2.CARETTRIM], caretTrimReplace);
|
|
1170
|
+
debug("caret trim", range);
|
|
1171
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
1172
|
+
if (loose) {
|
|
1173
|
+
rangeList = rangeList.filter((comp) => {
|
|
1174
|
+
debug("loose invalid filter", comp, this.options);
|
|
1175
|
+
return !!comp.match(re[t2.COMPARATORLOOSE]);
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
debug("range list", rangeList);
|
|
1179
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
1180
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
1181
|
+
for (const comp of comparators) {
|
|
1182
|
+
if (isNullSet(comp)) {
|
|
1183
|
+
return [comp];
|
|
1184
|
+
}
|
|
1185
|
+
rangeMap.set(comp.value, comp);
|
|
1186
|
+
}
|
|
1187
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
1188
|
+
rangeMap.delete("");
|
|
1189
|
+
}
|
|
1190
|
+
const result = [...rangeMap.values()];
|
|
1191
|
+
cache.set(memoKey, result);
|
|
1192
|
+
return result;
|
|
1193
|
+
}
|
|
1194
|
+
intersects(range, options) {
|
|
1195
|
+
if (!(range instanceof _Range)) {
|
|
1196
|
+
throw new TypeError("a Range is required");
|
|
1197
|
+
}
|
|
1198
|
+
return this.set.some((thisComparators) => {
|
|
1199
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
1200
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
1201
|
+
return rangeComparators.every((rangeComparator) => {
|
|
1202
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
1203
|
+
});
|
|
1204
|
+
});
|
|
1205
|
+
});
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
|
1209
|
+
test(version2) {
|
|
1210
|
+
if (!version2) {
|
|
1211
|
+
return false;
|
|
1212
|
+
}
|
|
1213
|
+
if (typeof version2 === "string") {
|
|
1214
|
+
try {
|
|
1215
|
+
version2 = new SemVer(version2, this.options);
|
|
1216
|
+
} catch (er) {
|
|
1217
|
+
return false;
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
for (let i2 = 0; i2 < this.set.length; i2++) {
|
|
1221
|
+
if (testSet(this.set[i2], version2, this.options)) {
|
|
1222
|
+
return true;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
return false;
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
module.exports = Range;
|
|
1229
|
+
var LRU = require_lrucache();
|
|
1230
|
+
var cache = new LRU();
|
|
1231
|
+
var parseOptions = require_parse_options();
|
|
1232
|
+
var Comparator = require_comparator();
|
|
1233
|
+
var debug = require_debug();
|
|
1234
|
+
var SemVer = require_semver();
|
|
1235
|
+
var {
|
|
1236
|
+
safeRe: re,
|
|
1237
|
+
src,
|
|
1238
|
+
t: t2,
|
|
1239
|
+
comparatorTrimReplace,
|
|
1240
|
+
tildeTrimReplace,
|
|
1241
|
+
caretTrimReplace
|
|
1242
|
+
} = require_re();
|
|
1243
|
+
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
1244
|
+
var BUILDSTRIPRE = new RegExp(src[t2.BUILD], "g");
|
|
1245
|
+
var isNullSet = (c2) => c2.value === "<0.0.0-0";
|
|
1246
|
+
var isAny = (c2) => c2.value === "";
|
|
1247
|
+
var isSatisfiable = (comparators, options) => {
|
|
1248
|
+
let result = true;
|
|
1249
|
+
const remainingComparators = comparators.slice();
|
|
1250
|
+
let testComparator = remainingComparators.pop();
|
|
1251
|
+
while (result && remainingComparators.length) {
|
|
1252
|
+
result = remainingComparators.every((otherComparator) => {
|
|
1253
|
+
return testComparator.intersects(otherComparator, options);
|
|
1254
|
+
});
|
|
1255
|
+
testComparator = remainingComparators.pop();
|
|
1256
|
+
}
|
|
1257
|
+
return result;
|
|
1258
|
+
};
|
|
1259
|
+
var parseComparator = (comp, options) => {
|
|
1260
|
+
comp = comp.replace(re[t2.BUILD], "");
|
|
1261
|
+
debug("comp", comp, options);
|
|
1262
|
+
comp = replaceCarets(comp, options);
|
|
1263
|
+
debug("caret", comp);
|
|
1264
|
+
comp = replaceTildes(comp, options);
|
|
1265
|
+
debug("tildes", comp);
|
|
1266
|
+
comp = replaceXRanges(comp, options);
|
|
1267
|
+
debug("xrange", comp);
|
|
1268
|
+
comp = replaceStars(comp, options);
|
|
1269
|
+
debug("stars", comp);
|
|
1270
|
+
return comp;
|
|
1271
|
+
};
|
|
1272
|
+
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
1273
|
+
var invalidXRangeOrder = (M, m2, p) => isX(M) && !isX(m2) || isX(m2) && p && !isX(p);
|
|
1274
|
+
var replaceTildes = (comp, options) => {
|
|
1275
|
+
return comp.trim().split(/\s+/).map((c2) => replaceTilde(c2, options)).join(" ");
|
|
1276
|
+
};
|
|
1277
|
+
var replaceTilde = (comp, options) => {
|
|
1278
|
+
const r2 = options.loose ? re[t2.TILDELOOSE] : re[t2.TILDE];
|
|
1279
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
1280
|
+
return comp.replace(r2, (_, M, m2, p, pr) => {
|
|
1281
|
+
debug("tilde", comp, _, M, m2, p, pr);
|
|
1282
|
+
let ret;
|
|
1283
|
+
if (isX(M)) {
|
|
1284
|
+
ret = "";
|
|
1285
|
+
} else if (isX(m2)) {
|
|
1286
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
1287
|
+
} else if (isX(p)) {
|
|
1288
|
+
ret = `>=${M}.${m2}.0${z} <${M}.${+m2 + 1}.0-0`;
|
|
1289
|
+
} else if (pr) {
|
|
1290
|
+
debug("replaceTilde pr", pr);
|
|
1291
|
+
ret = `>=${M}.${m2}.${p}-${pr} <${M}.${+m2 + 1}.0-0`;
|
|
1292
|
+
} else {
|
|
1293
|
+
ret = `>=${M}.${m2}.${p} <${M}.${+m2 + 1}.0-0`;
|
|
1294
|
+
}
|
|
1295
|
+
debug("tilde return", ret);
|
|
1296
|
+
return ret;
|
|
1297
|
+
});
|
|
1298
|
+
};
|
|
1299
|
+
var replaceCarets = (comp, options) => {
|
|
1300
|
+
return comp.trim().split(/\s+/).map((c2) => replaceCaret(c2, options)).join(" ");
|
|
1301
|
+
};
|
|
1302
|
+
var replaceCaret = (comp, options) => {
|
|
1303
|
+
debug("caret", comp, options);
|
|
1304
|
+
const r2 = options.loose ? re[t2.CARETLOOSE] : re[t2.CARET];
|
|
1305
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
1306
|
+
return comp.replace(r2, (_, M, m2, p, pr) => {
|
|
1307
|
+
debug("caret", comp, _, M, m2, p, pr);
|
|
1308
|
+
let ret;
|
|
1309
|
+
if (isX(M)) {
|
|
1310
|
+
ret = "";
|
|
1311
|
+
} else if (isX(m2)) {
|
|
1312
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
1313
|
+
} else if (isX(p)) {
|
|
1314
|
+
if (M === "0") {
|
|
1315
|
+
ret = `>=${M}.${m2}.0${z} <${M}.${+m2 + 1}.0-0`;
|
|
1316
|
+
} else {
|
|
1317
|
+
ret = `>=${M}.${m2}.0${z} <${+M + 1}.0.0-0`;
|
|
1318
|
+
}
|
|
1319
|
+
} else if (pr) {
|
|
1320
|
+
debug("replaceCaret pr", pr);
|
|
1321
|
+
if (M === "0") {
|
|
1322
|
+
if (m2 === "0") {
|
|
1323
|
+
ret = `>=${M}.${m2}.${p}-${pr} <${M}.${m2}.${+p + 1}-0`;
|
|
1324
|
+
} else {
|
|
1325
|
+
ret = `>=${M}.${m2}.${p}-${pr} <${M}.${+m2 + 1}.0-0`;
|
|
1326
|
+
}
|
|
1327
|
+
} else {
|
|
1328
|
+
ret = `>=${M}.${m2}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
1329
|
+
}
|
|
1330
|
+
} else {
|
|
1331
|
+
debug("no pr");
|
|
1332
|
+
if (M === "0") {
|
|
1333
|
+
if (m2 === "0") {
|
|
1334
|
+
ret = `>=${M}.${m2}.${p} <${M}.${m2}.${+p + 1}-0`;
|
|
1335
|
+
} else {
|
|
1336
|
+
ret = `>=${M}.${m2}.${p} <${M}.${+m2 + 1}.0-0`;
|
|
1337
|
+
}
|
|
1338
|
+
} else {
|
|
1339
|
+
ret = `>=${M}.${m2}.${p} <${+M + 1}.0.0-0`;
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
debug("caret return", ret);
|
|
1343
|
+
return ret;
|
|
1344
|
+
});
|
|
1345
|
+
};
|
|
1346
|
+
var replaceXRanges = (comp, options) => {
|
|
1347
|
+
debug("replaceXRanges", comp, options);
|
|
1348
|
+
return comp.split(/\s+/).map((c2) => replaceXRange(c2, options)).join(" ");
|
|
1349
|
+
};
|
|
1350
|
+
var replaceXRange = (comp, options) => {
|
|
1351
|
+
comp = comp.trim();
|
|
1352
|
+
const r2 = options.loose ? re[t2.XRANGELOOSE] : re[t2.XRANGE];
|
|
1353
|
+
return comp.replace(r2, (ret, gtlt, M, m2, p, pr) => {
|
|
1354
|
+
debug("xRange", comp, ret, gtlt, M, m2, p, pr);
|
|
1355
|
+
if (invalidXRangeOrder(M, m2, p)) {
|
|
1356
|
+
return comp;
|
|
1357
|
+
}
|
|
1358
|
+
const xM = isX(M);
|
|
1359
|
+
const xm = xM || isX(m2);
|
|
1360
|
+
const xp = xm || isX(p);
|
|
1361
|
+
const anyX = xp;
|
|
1362
|
+
if (gtlt === "=" && anyX) {
|
|
1363
|
+
gtlt = "";
|
|
1364
|
+
}
|
|
1365
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
1366
|
+
if (xM) {
|
|
1367
|
+
if (gtlt === ">" || gtlt === "<") {
|
|
1368
|
+
ret = "<0.0.0-0";
|
|
1369
|
+
} else {
|
|
1370
|
+
ret = "*";
|
|
1371
|
+
}
|
|
1372
|
+
} else if (gtlt && anyX) {
|
|
1373
|
+
if (xm) {
|
|
1374
|
+
m2 = 0;
|
|
1375
|
+
}
|
|
1376
|
+
p = 0;
|
|
1377
|
+
if (gtlt === ">") {
|
|
1378
|
+
gtlt = ">=";
|
|
1379
|
+
if (xm) {
|
|
1380
|
+
M = +M + 1;
|
|
1381
|
+
m2 = 0;
|
|
1382
|
+
p = 0;
|
|
1383
|
+
} else {
|
|
1384
|
+
m2 = +m2 + 1;
|
|
1385
|
+
p = 0;
|
|
1386
|
+
}
|
|
1387
|
+
} else if (gtlt === "<=") {
|
|
1388
|
+
gtlt = "<";
|
|
1389
|
+
if (xm) {
|
|
1390
|
+
M = +M + 1;
|
|
1391
|
+
} else {
|
|
1392
|
+
m2 = +m2 + 1;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
if (gtlt === "<") {
|
|
1396
|
+
pr = "-0";
|
|
1397
|
+
}
|
|
1398
|
+
ret = `${gtlt + M}.${m2}.${p}${pr}`;
|
|
1399
|
+
} else if (xm) {
|
|
1400
|
+
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
1401
|
+
} else if (xp) {
|
|
1402
|
+
ret = `>=${M}.${m2}.0${pr} <${M}.${+m2 + 1}.0-0`;
|
|
1403
|
+
}
|
|
1404
|
+
debug("xRange return", ret);
|
|
1405
|
+
return ret;
|
|
1406
|
+
});
|
|
1407
|
+
};
|
|
1408
|
+
var replaceStars = (comp, options) => {
|
|
1409
|
+
debug("replaceStars", comp, options);
|
|
1410
|
+
return comp.trim().replace(re[t2.STAR], "");
|
|
1411
|
+
};
|
|
1412
|
+
var replaceGTE0 = (comp, options) => {
|
|
1413
|
+
debug("replaceGTE0", comp, options);
|
|
1414
|
+
return comp.trim().replace(re[options.includePrerelease ? t2.GTE0PRE : t2.GTE0], "");
|
|
1415
|
+
};
|
|
1416
|
+
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
1417
|
+
if (isX(fM)) {
|
|
1418
|
+
from = "";
|
|
1419
|
+
} else if (isX(fm)) {
|
|
1420
|
+
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
1421
|
+
} else if (isX(fp)) {
|
|
1422
|
+
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
1423
|
+
} else if (fpr) {
|
|
1424
|
+
from = `>=${from}`;
|
|
1425
|
+
} else {
|
|
1426
|
+
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
1427
|
+
}
|
|
1428
|
+
if (isX(tM)) {
|
|
1429
|
+
to = "";
|
|
1430
|
+
} else if (isX(tm)) {
|
|
1431
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
1432
|
+
} else if (isX(tp)) {
|
|
1433
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
1434
|
+
} else if (tpr) {
|
|
1435
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
1436
|
+
} else if (incPr) {
|
|
1437
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
1438
|
+
} else {
|
|
1439
|
+
to = `<=${to}`;
|
|
1440
|
+
}
|
|
1441
|
+
return `${from} ${to}`.trim();
|
|
1442
|
+
};
|
|
1443
|
+
var testSet = (set, version2, options) => {
|
|
1444
|
+
for (let i2 = 0; i2 < set.length; i2++) {
|
|
1445
|
+
if (!set[i2].test(version2)) {
|
|
1446
|
+
return false;
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
if (version2.prerelease.length && !options.includePrerelease) {
|
|
1450
|
+
for (let i2 = 0; i2 < set.length; i2++) {
|
|
1451
|
+
debug(set[i2].semver);
|
|
1452
|
+
if (set[i2].semver === Comparator.ANY) {
|
|
1453
|
+
continue;
|
|
1454
|
+
}
|
|
1455
|
+
if (set[i2].semver.prerelease.length > 0) {
|
|
1456
|
+
const allowed = set[i2].semver;
|
|
1457
|
+
if (allowed.major === version2.major && allowed.minor === version2.minor && allowed.patch === version2.patch) {
|
|
1458
|
+
return true;
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
return false;
|
|
1463
|
+
}
|
|
1464
|
+
return true;
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
});
|
|
1468
|
+
|
|
1469
|
+
// node_modules/semver/classes/comparator.js
|
|
1470
|
+
var require_comparator = __commonJS({
|
|
1471
|
+
"node_modules/semver/classes/comparator.js"(exports, module) {
|
|
1472
|
+
"use strict";
|
|
1473
|
+
var ANY = /* @__PURE__ */ Symbol("SemVer ANY");
|
|
1474
|
+
var Comparator = class _Comparator {
|
|
1475
|
+
static get ANY() {
|
|
1476
|
+
return ANY;
|
|
1477
|
+
}
|
|
1478
|
+
constructor(comp, options) {
|
|
1479
|
+
options = parseOptions(options);
|
|
1480
|
+
if (comp instanceof _Comparator) {
|
|
1481
|
+
if (comp.loose === !!options.loose) {
|
|
1482
|
+
return comp;
|
|
1483
|
+
} else {
|
|
1484
|
+
comp = comp.value;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
1488
|
+
debug("comparator", comp, options);
|
|
1489
|
+
this.options = options;
|
|
1490
|
+
this.loose = !!options.loose;
|
|
1491
|
+
this.parse(comp);
|
|
1492
|
+
if (this.semver === ANY) {
|
|
1493
|
+
this.value = "";
|
|
1494
|
+
} else {
|
|
1495
|
+
this.value = this.operator + this.semver.version;
|
|
1496
|
+
}
|
|
1497
|
+
debug("comp", this);
|
|
1498
|
+
}
|
|
1499
|
+
parse(comp) {
|
|
1500
|
+
const r2 = this.options.loose ? re[t2.COMPARATORLOOSE] : re[t2.COMPARATOR];
|
|
1501
|
+
const m2 = comp.match(r2);
|
|
1502
|
+
if (!m2) {
|
|
1503
|
+
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
1504
|
+
}
|
|
1505
|
+
this.operator = m2[1] !== void 0 ? m2[1] : "";
|
|
1506
|
+
if (this.operator === "=") {
|
|
1507
|
+
this.operator = "";
|
|
1508
|
+
}
|
|
1509
|
+
if (!m2[2]) {
|
|
1510
|
+
this.semver = ANY;
|
|
1511
|
+
} else {
|
|
1512
|
+
this.semver = new SemVer(m2[2], this.options.loose);
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
toString() {
|
|
1516
|
+
return this.value;
|
|
1517
|
+
}
|
|
1518
|
+
test(version2) {
|
|
1519
|
+
debug("Comparator.test", version2, this.options.loose);
|
|
1520
|
+
if (this.semver === ANY || version2 === ANY) {
|
|
1521
|
+
return true;
|
|
1522
|
+
}
|
|
1523
|
+
if (typeof version2 === "string") {
|
|
1524
|
+
try {
|
|
1525
|
+
version2 = new SemVer(version2, this.options);
|
|
1526
|
+
} catch (er) {
|
|
1527
|
+
return false;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
return cmp(version2, this.operator, this.semver, this.options);
|
|
1531
|
+
}
|
|
1532
|
+
intersects(comp, options) {
|
|
1533
|
+
if (!(comp instanceof _Comparator)) {
|
|
1534
|
+
throw new TypeError("a Comparator is required");
|
|
1535
|
+
}
|
|
1536
|
+
if (this.operator === "") {
|
|
1537
|
+
if (this.value === "") {
|
|
1538
|
+
return true;
|
|
1539
|
+
}
|
|
1540
|
+
return new Range(comp.value, options).test(this.value);
|
|
1541
|
+
} else if (comp.operator === "") {
|
|
1542
|
+
if (comp.value === "") {
|
|
1543
|
+
return true;
|
|
1544
|
+
}
|
|
1545
|
+
return new Range(this.value, options).test(comp.semver);
|
|
1546
|
+
}
|
|
1547
|
+
options = parseOptions(options);
|
|
1548
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
1549
|
+
return false;
|
|
1550
|
+
}
|
|
1551
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
1552
|
+
return false;
|
|
1553
|
+
}
|
|
1554
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
1555
|
+
return true;
|
|
1556
|
+
}
|
|
1557
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
1558
|
+
return true;
|
|
1559
|
+
}
|
|
1560
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
1561
|
+
return true;
|
|
1562
|
+
}
|
|
1563
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
1564
|
+
return true;
|
|
1565
|
+
}
|
|
1566
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
1567
|
+
return true;
|
|
1568
|
+
}
|
|
1569
|
+
return false;
|
|
1570
|
+
}
|
|
1571
|
+
};
|
|
1572
|
+
module.exports = Comparator;
|
|
1573
|
+
var parseOptions = require_parse_options();
|
|
1574
|
+
var { safeRe: re, t: t2 } = require_re();
|
|
1575
|
+
var cmp = require_cmp();
|
|
1576
|
+
var debug = require_debug();
|
|
1577
|
+
var SemVer = require_semver();
|
|
1578
|
+
var Range = require_range();
|
|
1579
|
+
}
|
|
1580
|
+
});
|
|
1581
|
+
|
|
1582
|
+
// node_modules/semver/functions/satisfies.js
|
|
1583
|
+
var require_satisfies = __commonJS({
|
|
1584
|
+
"node_modules/semver/functions/satisfies.js"(exports, module) {
|
|
1585
|
+
"use strict";
|
|
1586
|
+
var Range = require_range();
|
|
1587
|
+
var satisfies2 = (version2, range, options) => {
|
|
1588
|
+
try {
|
|
1589
|
+
range = new Range(range, options);
|
|
1590
|
+
} catch (er) {
|
|
1591
|
+
return false;
|
|
1592
|
+
}
|
|
1593
|
+
return range.test(version2);
|
|
1594
|
+
};
|
|
1595
|
+
module.exports = satisfies2;
|
|
1596
|
+
}
|
|
1597
|
+
});
|
|
1598
|
+
|
|
1599
|
+
// node_modules/semver/ranges/to-comparators.js
|
|
1600
|
+
var require_to_comparators = __commonJS({
|
|
1601
|
+
"node_modules/semver/ranges/to-comparators.js"(exports, module) {
|
|
1602
|
+
"use strict";
|
|
1603
|
+
var Range = require_range();
|
|
1604
|
+
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c2) => c2.value).join(" ").trim().split(" "));
|
|
1605
|
+
module.exports = toComparators;
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
|
|
1609
|
+
// node_modules/semver/ranges/max-satisfying.js
|
|
1610
|
+
var require_max_satisfying = __commonJS({
|
|
1611
|
+
"node_modules/semver/ranges/max-satisfying.js"(exports, module) {
|
|
1612
|
+
"use strict";
|
|
1613
|
+
var SemVer = require_semver();
|
|
1614
|
+
var Range = require_range();
|
|
1615
|
+
var maxSatisfying = (versions, range, options) => {
|
|
1616
|
+
let max = null;
|
|
1617
|
+
let maxSV = null;
|
|
1618
|
+
let rangeObj = null;
|
|
1619
|
+
try {
|
|
1620
|
+
rangeObj = new Range(range, options);
|
|
1621
|
+
} catch (er) {
|
|
1622
|
+
return null;
|
|
1623
|
+
}
|
|
1624
|
+
versions.forEach((v) => {
|
|
1625
|
+
if (rangeObj.test(v)) {
|
|
1626
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
1627
|
+
max = v;
|
|
1628
|
+
maxSV = new SemVer(max, options);
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
});
|
|
1632
|
+
return max;
|
|
1633
|
+
};
|
|
1634
|
+
module.exports = maxSatisfying;
|
|
1635
|
+
}
|
|
1636
|
+
});
|
|
1637
|
+
|
|
1638
|
+
// node_modules/semver/ranges/min-satisfying.js
|
|
1639
|
+
var require_min_satisfying = __commonJS({
|
|
1640
|
+
"node_modules/semver/ranges/min-satisfying.js"(exports, module) {
|
|
1641
|
+
"use strict";
|
|
1642
|
+
var SemVer = require_semver();
|
|
1643
|
+
var Range = require_range();
|
|
1644
|
+
var minSatisfying = (versions, range, options) => {
|
|
1645
|
+
let min = null;
|
|
1646
|
+
let minSV = null;
|
|
1647
|
+
let rangeObj = null;
|
|
1648
|
+
try {
|
|
1649
|
+
rangeObj = new Range(range, options);
|
|
1650
|
+
} catch (er) {
|
|
1651
|
+
return null;
|
|
1652
|
+
}
|
|
1653
|
+
versions.forEach((v) => {
|
|
1654
|
+
if (rangeObj.test(v)) {
|
|
1655
|
+
if (!min || minSV.compare(v) === 1) {
|
|
1656
|
+
min = v;
|
|
1657
|
+
minSV = new SemVer(min, options);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
});
|
|
1661
|
+
return min;
|
|
1662
|
+
};
|
|
1663
|
+
module.exports = minSatisfying;
|
|
1664
|
+
}
|
|
1665
|
+
});
|
|
1666
|
+
|
|
1667
|
+
// node_modules/semver/ranges/min-version.js
|
|
1668
|
+
var require_min_version = __commonJS({
|
|
1669
|
+
"node_modules/semver/ranges/min-version.js"(exports, module) {
|
|
1670
|
+
"use strict";
|
|
1671
|
+
var SemVer = require_semver();
|
|
1672
|
+
var Range = require_range();
|
|
1673
|
+
var gt = require_gt();
|
|
1674
|
+
var minVersion2 = (range, loose) => {
|
|
1675
|
+
range = new Range(range, loose);
|
|
1676
|
+
let minver = new SemVer("0.0.0");
|
|
1677
|
+
if (range.test(minver)) {
|
|
1678
|
+
return minver;
|
|
1679
|
+
}
|
|
1680
|
+
minver = new SemVer("0.0.0-0");
|
|
1681
|
+
if (range.test(minver)) {
|
|
1682
|
+
return minver;
|
|
1683
|
+
}
|
|
1684
|
+
minver = null;
|
|
1685
|
+
for (let i2 = 0; i2 < range.set.length; ++i2) {
|
|
1686
|
+
const comparators = range.set[i2];
|
|
1687
|
+
let setMin = null;
|
|
1688
|
+
comparators.forEach((comparator) => {
|
|
1689
|
+
const compver = new SemVer(comparator.semver.version);
|
|
1690
|
+
switch (comparator.operator) {
|
|
1691
|
+
case ">":
|
|
1692
|
+
if (compver.prerelease.length === 0) {
|
|
1693
|
+
compver.patch++;
|
|
1694
|
+
} else {
|
|
1695
|
+
compver.prerelease.push(0);
|
|
1696
|
+
}
|
|
1697
|
+
compver.raw = compver.format();
|
|
1698
|
+
/* fallthrough */
|
|
1699
|
+
case "":
|
|
1700
|
+
case ">=":
|
|
1701
|
+
if (!setMin || gt(compver, setMin)) {
|
|
1702
|
+
setMin = compver;
|
|
1703
|
+
}
|
|
1704
|
+
break;
|
|
1705
|
+
case "<":
|
|
1706
|
+
case "<=":
|
|
1707
|
+
break;
|
|
1708
|
+
/* istanbul ignore next */
|
|
1709
|
+
default:
|
|
1710
|
+
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
1711
|
+
}
|
|
1712
|
+
});
|
|
1713
|
+
if (setMin && (!minver || gt(minver, setMin))) {
|
|
1714
|
+
minver = setMin;
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
if (minver && range.test(minver)) {
|
|
1718
|
+
return minver;
|
|
1719
|
+
}
|
|
1720
|
+
return null;
|
|
1721
|
+
};
|
|
1722
|
+
module.exports = minVersion2;
|
|
1723
|
+
}
|
|
1724
|
+
});
|
|
1725
|
+
|
|
1726
|
+
// node_modules/semver/ranges/valid.js
|
|
1727
|
+
var require_valid2 = __commonJS({
|
|
1728
|
+
"node_modules/semver/ranges/valid.js"(exports, module) {
|
|
1729
|
+
"use strict";
|
|
1730
|
+
var Range = require_range();
|
|
1731
|
+
var validRange2 = (range, options) => {
|
|
1732
|
+
try {
|
|
1733
|
+
return new Range(range, options).range || "*";
|
|
1734
|
+
} catch (er) {
|
|
1735
|
+
return null;
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1738
|
+
module.exports = validRange2;
|
|
1739
|
+
}
|
|
1740
|
+
});
|
|
1741
|
+
|
|
1742
|
+
// node_modules/semver/ranges/outside.js
|
|
1743
|
+
var require_outside = __commonJS({
|
|
1744
|
+
"node_modules/semver/ranges/outside.js"(exports, module) {
|
|
1745
|
+
"use strict";
|
|
1746
|
+
var SemVer = require_semver();
|
|
1747
|
+
var Comparator = require_comparator();
|
|
1748
|
+
var { ANY } = Comparator;
|
|
1749
|
+
var Range = require_range();
|
|
1750
|
+
var satisfies2 = require_satisfies();
|
|
1751
|
+
var gt = require_gt();
|
|
1752
|
+
var lt = require_lt();
|
|
1753
|
+
var lte = require_lte();
|
|
1754
|
+
var gte = require_gte();
|
|
1755
|
+
var outside = (version2, range, hilo, options) => {
|
|
1756
|
+
version2 = new SemVer(version2, options);
|
|
1757
|
+
range = new Range(range, options);
|
|
1758
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
1759
|
+
switch (hilo) {
|
|
1760
|
+
case ">":
|
|
1761
|
+
gtfn = gt;
|
|
1762
|
+
ltefn = lte;
|
|
1763
|
+
ltfn = lt;
|
|
1764
|
+
comp = ">";
|
|
1765
|
+
ecomp = ">=";
|
|
1766
|
+
break;
|
|
1767
|
+
case "<":
|
|
1768
|
+
gtfn = lt;
|
|
1769
|
+
ltefn = gte;
|
|
1770
|
+
ltfn = gt;
|
|
1771
|
+
comp = "<";
|
|
1772
|
+
ecomp = "<=";
|
|
1773
|
+
break;
|
|
1774
|
+
default:
|
|
1775
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
1776
|
+
}
|
|
1777
|
+
if (satisfies2(version2, range, options)) {
|
|
1778
|
+
return false;
|
|
1779
|
+
}
|
|
1780
|
+
for (let i2 = 0; i2 < range.set.length; ++i2) {
|
|
1781
|
+
const comparators = range.set[i2];
|
|
1782
|
+
let high = null;
|
|
1783
|
+
let low = null;
|
|
1784
|
+
comparators.forEach((comparator) => {
|
|
1785
|
+
if (comparator.semver === ANY) {
|
|
1786
|
+
comparator = new Comparator(">=0.0.0");
|
|
1787
|
+
}
|
|
1788
|
+
high = high || comparator;
|
|
1789
|
+
low = low || comparator;
|
|
1790
|
+
if (gtfn(comparator.semver, high.semver, options)) {
|
|
1791
|
+
high = comparator;
|
|
1792
|
+
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
1793
|
+
low = comparator;
|
|
1794
|
+
}
|
|
1795
|
+
});
|
|
1796
|
+
if (high.operator === comp || high.operator === ecomp) {
|
|
1797
|
+
return false;
|
|
1798
|
+
}
|
|
1799
|
+
if ((!low.operator || low.operator === comp) && ltefn(version2, low.semver)) {
|
|
1800
|
+
return false;
|
|
1801
|
+
} else if (low.operator === ecomp && ltfn(version2, low.semver)) {
|
|
1802
|
+
return false;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
return true;
|
|
1806
|
+
};
|
|
1807
|
+
module.exports = outside;
|
|
1808
|
+
}
|
|
1809
|
+
});
|
|
1810
|
+
|
|
1811
|
+
// node_modules/semver/ranges/gtr.js
|
|
1812
|
+
var require_gtr = __commonJS({
|
|
1813
|
+
"node_modules/semver/ranges/gtr.js"(exports, module) {
|
|
1814
|
+
"use strict";
|
|
1815
|
+
var outside = require_outside();
|
|
1816
|
+
var gtr = (version2, range, options) => outside(version2, range, ">", options);
|
|
1817
|
+
module.exports = gtr;
|
|
1818
|
+
}
|
|
1819
|
+
});
|
|
1820
|
+
|
|
1821
|
+
// node_modules/semver/ranges/ltr.js
|
|
1822
|
+
var require_ltr = __commonJS({
|
|
1823
|
+
"node_modules/semver/ranges/ltr.js"(exports, module) {
|
|
1824
|
+
"use strict";
|
|
1825
|
+
var outside = require_outside();
|
|
1826
|
+
var ltr = (version2, range, options) => outside(version2, range, "<", options);
|
|
1827
|
+
module.exports = ltr;
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
|
|
1831
|
+
// node_modules/semver/ranges/intersects.js
|
|
1832
|
+
var require_intersects = __commonJS({
|
|
1833
|
+
"node_modules/semver/ranges/intersects.js"(exports, module) {
|
|
1834
|
+
"use strict";
|
|
1835
|
+
var Range = require_range();
|
|
1836
|
+
var intersects = (r1, r2, options) => {
|
|
1837
|
+
r1 = new Range(r1, options);
|
|
1838
|
+
r2 = new Range(r2, options);
|
|
1839
|
+
return r1.intersects(r2, options);
|
|
1840
|
+
};
|
|
1841
|
+
module.exports = intersects;
|
|
1842
|
+
}
|
|
1843
|
+
});
|
|
1844
|
+
|
|
1845
|
+
// node_modules/semver/ranges/simplify.js
|
|
1846
|
+
var require_simplify = __commonJS({
|
|
1847
|
+
"node_modules/semver/ranges/simplify.js"(exports, module) {
|
|
1848
|
+
"use strict";
|
|
1849
|
+
var satisfies2 = require_satisfies();
|
|
1850
|
+
var compare = require_compare();
|
|
1851
|
+
module.exports = (versions, range, options) => {
|
|
1852
|
+
const set = [];
|
|
1853
|
+
let first = null;
|
|
1854
|
+
let prev = null;
|
|
1855
|
+
const v = versions.sort((a2, b) => compare(a2, b, options));
|
|
1856
|
+
for (const version2 of v) {
|
|
1857
|
+
const included = satisfies2(version2, range, options);
|
|
1858
|
+
if (included) {
|
|
1859
|
+
prev = version2;
|
|
1860
|
+
if (!first) {
|
|
1861
|
+
first = version2;
|
|
1862
|
+
}
|
|
1863
|
+
} else {
|
|
1864
|
+
if (prev) {
|
|
1865
|
+
set.push([first, prev]);
|
|
1866
|
+
}
|
|
1867
|
+
prev = null;
|
|
1868
|
+
first = null;
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
if (first) {
|
|
1872
|
+
set.push([first, null]);
|
|
1873
|
+
}
|
|
1874
|
+
const ranges = [];
|
|
1875
|
+
for (const [min, max] of set) {
|
|
1876
|
+
if (min === max) {
|
|
1877
|
+
ranges.push(min);
|
|
1878
|
+
} else if (!max && min === v[0]) {
|
|
1879
|
+
ranges.push("*");
|
|
1880
|
+
} else if (!max) {
|
|
1881
|
+
ranges.push(`>=${min}`);
|
|
1882
|
+
} else if (min === v[0]) {
|
|
1883
|
+
ranges.push(`<=${max}`);
|
|
1884
|
+
} else {
|
|
1885
|
+
ranges.push(`${min} - ${max}`);
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
const simplified = ranges.join(" || ");
|
|
1889
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
1890
|
+
return simplified.length < original.length ? simplified : range;
|
|
1891
|
+
};
|
|
1892
|
+
}
|
|
1893
|
+
});
|
|
1894
|
+
|
|
1895
|
+
// node_modules/semver/ranges/subset.js
|
|
1896
|
+
var require_subset = __commonJS({
|
|
1897
|
+
"node_modules/semver/ranges/subset.js"(exports, module) {
|
|
1898
|
+
"use strict";
|
|
1899
|
+
var Range = require_range();
|
|
1900
|
+
var Comparator = require_comparator();
|
|
1901
|
+
var { ANY } = Comparator;
|
|
1902
|
+
var satisfies2 = require_satisfies();
|
|
1903
|
+
var compare = require_compare();
|
|
1904
|
+
var subset2 = (sub, dom, options = {}) => {
|
|
1905
|
+
if (sub === dom) {
|
|
1906
|
+
return true;
|
|
1907
|
+
}
|
|
1908
|
+
sub = new Range(sub, options);
|
|
1909
|
+
dom = new Range(dom, options);
|
|
1910
|
+
let sawNonNull = false;
|
|
1911
|
+
OUTER: for (const simpleSub of sub.set) {
|
|
1912
|
+
for (const simpleDom of dom.set) {
|
|
1913
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
1914
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
1915
|
+
if (isSub) {
|
|
1916
|
+
continue OUTER;
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
if (sawNonNull) {
|
|
1920
|
+
return false;
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
return true;
|
|
1924
|
+
};
|
|
1925
|
+
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
1926
|
+
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
1927
|
+
var simpleSubset = (sub, dom, options) => {
|
|
1928
|
+
if (sub === dom) {
|
|
1929
|
+
return true;
|
|
1930
|
+
}
|
|
1931
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
1932
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
1933
|
+
return true;
|
|
1934
|
+
} else if (options.includePrerelease) {
|
|
1935
|
+
sub = minimumVersionWithPreRelease;
|
|
1936
|
+
} else {
|
|
1937
|
+
sub = minimumVersion;
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
1941
|
+
if (options.includePrerelease) {
|
|
1942
|
+
return true;
|
|
1943
|
+
} else {
|
|
1944
|
+
dom = minimumVersion;
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
1948
|
+
let gt, lt;
|
|
1949
|
+
for (const c2 of sub) {
|
|
1950
|
+
if (c2.operator === ">" || c2.operator === ">=") {
|
|
1951
|
+
gt = higherGT(gt, c2, options);
|
|
1952
|
+
} else if (c2.operator === "<" || c2.operator === "<=") {
|
|
1953
|
+
lt = lowerLT(lt, c2, options);
|
|
1954
|
+
} else {
|
|
1955
|
+
eqSet.add(c2.semver);
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
if (eqSet.size > 1) {
|
|
1959
|
+
return null;
|
|
1960
|
+
}
|
|
1961
|
+
let gtltComp;
|
|
1962
|
+
if (gt && lt) {
|
|
1963
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
1964
|
+
if (gtltComp > 0) {
|
|
1965
|
+
return null;
|
|
1966
|
+
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
1967
|
+
return null;
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
for (const eq of eqSet) {
|
|
1971
|
+
if (gt && !satisfies2(eq, String(gt), options)) {
|
|
1972
|
+
return null;
|
|
1973
|
+
}
|
|
1974
|
+
if (lt && !satisfies2(eq, String(lt), options)) {
|
|
1975
|
+
return null;
|
|
1976
|
+
}
|
|
1977
|
+
for (const c2 of dom) {
|
|
1978
|
+
if (!satisfies2(eq, String(c2), options)) {
|
|
1979
|
+
return false;
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
return true;
|
|
1983
|
+
}
|
|
1984
|
+
let higher, lower;
|
|
1985
|
+
let hasDomLT, hasDomGT;
|
|
1986
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
1987
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
1988
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
1989
|
+
needDomLTPre = false;
|
|
1990
|
+
}
|
|
1991
|
+
for (const c2 of dom) {
|
|
1992
|
+
hasDomGT = hasDomGT || c2.operator === ">" || c2.operator === ">=";
|
|
1993
|
+
hasDomLT = hasDomLT || c2.operator === "<" || c2.operator === "<=";
|
|
1994
|
+
if (gt) {
|
|
1995
|
+
if (needDomGTPre) {
|
|
1996
|
+
if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomGTPre.major && c2.semver.minor === needDomGTPre.minor && c2.semver.patch === needDomGTPre.patch) {
|
|
1997
|
+
needDomGTPre = false;
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
if (c2.operator === ">" || c2.operator === ">=") {
|
|
2001
|
+
higher = higherGT(gt, c2, options);
|
|
2002
|
+
if (higher === c2 && higher !== gt) {
|
|
2003
|
+
return false;
|
|
2004
|
+
}
|
|
2005
|
+
} else if (gt.operator === ">=" && !c2.test(gt.semver)) {
|
|
2006
|
+
return false;
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
if (lt) {
|
|
2010
|
+
if (needDomLTPre) {
|
|
2011
|
+
if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomLTPre.major && c2.semver.minor === needDomLTPre.minor && c2.semver.patch === needDomLTPre.patch) {
|
|
2012
|
+
needDomLTPre = false;
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
if (c2.operator === "<" || c2.operator === "<=") {
|
|
2016
|
+
lower = lowerLT(lt, c2, options);
|
|
2017
|
+
if (lower === c2 && lower !== lt) {
|
|
2018
|
+
return false;
|
|
2019
|
+
}
|
|
2020
|
+
} else if (lt.operator === "<=" && !c2.test(lt.semver)) {
|
|
2021
|
+
return false;
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
if (!c2.operator && (lt || gt) && gtltComp !== 0) {
|
|
2025
|
+
return false;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
2029
|
+
return false;
|
|
2030
|
+
}
|
|
2031
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
2032
|
+
return false;
|
|
2033
|
+
}
|
|
2034
|
+
if (needDomGTPre || needDomLTPre) {
|
|
2035
|
+
return false;
|
|
2036
|
+
}
|
|
2037
|
+
return true;
|
|
2038
|
+
};
|
|
2039
|
+
var higherGT = (a2, b, options) => {
|
|
2040
|
+
if (!a2) {
|
|
2041
|
+
return b;
|
|
2042
|
+
}
|
|
2043
|
+
const comp = compare(a2.semver, b.semver, options);
|
|
2044
|
+
return comp > 0 ? a2 : comp < 0 ? b : b.operator === ">" && a2.operator === ">=" ? b : a2;
|
|
2045
|
+
};
|
|
2046
|
+
var lowerLT = (a2, b, options) => {
|
|
2047
|
+
if (!a2) {
|
|
2048
|
+
return b;
|
|
2049
|
+
}
|
|
2050
|
+
const comp = compare(a2.semver, b.semver, options);
|
|
2051
|
+
return comp < 0 ? a2 : comp > 0 ? b : b.operator === "<" && a2.operator === "<=" ? b : a2;
|
|
2052
|
+
};
|
|
2053
|
+
module.exports = subset2;
|
|
2054
|
+
}
|
|
2055
|
+
});
|
|
2056
|
+
|
|
2057
|
+
// node_modules/semver/index.js
|
|
2058
|
+
var require_semver2 = __commonJS({
|
|
2059
|
+
"node_modules/semver/index.js"(exports, module) {
|
|
2060
|
+
"use strict";
|
|
2061
|
+
var internalRe = require_re();
|
|
2062
|
+
var constants = require_constants();
|
|
2063
|
+
var SemVer = require_semver();
|
|
2064
|
+
var identifiers = require_identifiers();
|
|
2065
|
+
var parse = require_parse();
|
|
2066
|
+
var valid = require_valid();
|
|
2067
|
+
var clean = require_clean();
|
|
2068
|
+
var inc = require_inc();
|
|
2069
|
+
var diff = require_diff();
|
|
2070
|
+
var major = require_major();
|
|
2071
|
+
var minor = require_minor();
|
|
2072
|
+
var patch = require_patch();
|
|
2073
|
+
var prerelease = require_prerelease();
|
|
2074
|
+
var compare = require_compare();
|
|
2075
|
+
var rcompare = require_rcompare();
|
|
2076
|
+
var compareLoose = require_compare_loose();
|
|
2077
|
+
var compareBuild = require_compare_build();
|
|
2078
|
+
var sort = require_sort();
|
|
2079
|
+
var rsort = require_rsort();
|
|
2080
|
+
var gt = require_gt();
|
|
2081
|
+
var lt = require_lt();
|
|
2082
|
+
var eq = require_eq();
|
|
2083
|
+
var neq = require_neq();
|
|
2084
|
+
var gte = require_gte();
|
|
2085
|
+
var lte = require_lte();
|
|
2086
|
+
var cmp = require_cmp();
|
|
2087
|
+
var coerce = require_coerce();
|
|
2088
|
+
var truncate = require_truncate();
|
|
2089
|
+
var Comparator = require_comparator();
|
|
2090
|
+
var Range = require_range();
|
|
2091
|
+
var satisfies2 = require_satisfies();
|
|
2092
|
+
var toComparators = require_to_comparators();
|
|
2093
|
+
var maxSatisfying = require_max_satisfying();
|
|
2094
|
+
var minSatisfying = require_min_satisfying();
|
|
2095
|
+
var minVersion2 = require_min_version();
|
|
2096
|
+
var validRange2 = require_valid2();
|
|
2097
|
+
var outside = require_outside();
|
|
2098
|
+
var gtr = require_gtr();
|
|
2099
|
+
var ltr = require_ltr();
|
|
2100
|
+
var intersects = require_intersects();
|
|
2101
|
+
var simplifyRange = require_simplify();
|
|
2102
|
+
var subset2 = require_subset();
|
|
2103
|
+
module.exports = {
|
|
2104
|
+
parse,
|
|
2105
|
+
valid,
|
|
2106
|
+
clean,
|
|
2107
|
+
inc,
|
|
2108
|
+
diff,
|
|
2109
|
+
major,
|
|
2110
|
+
minor,
|
|
2111
|
+
patch,
|
|
2112
|
+
prerelease,
|
|
2113
|
+
compare,
|
|
2114
|
+
rcompare,
|
|
2115
|
+
compareLoose,
|
|
2116
|
+
compareBuild,
|
|
2117
|
+
sort,
|
|
2118
|
+
rsort,
|
|
2119
|
+
gt,
|
|
2120
|
+
lt,
|
|
2121
|
+
eq,
|
|
2122
|
+
neq,
|
|
2123
|
+
gte,
|
|
2124
|
+
lte,
|
|
2125
|
+
cmp,
|
|
2126
|
+
coerce,
|
|
2127
|
+
truncate,
|
|
2128
|
+
Comparator,
|
|
2129
|
+
Range,
|
|
2130
|
+
satisfies: satisfies2,
|
|
2131
|
+
toComparators,
|
|
2132
|
+
maxSatisfying,
|
|
2133
|
+
minSatisfying,
|
|
2134
|
+
minVersion: minVersion2,
|
|
2135
|
+
validRange: validRange2,
|
|
2136
|
+
outside,
|
|
2137
|
+
gtr,
|
|
2138
|
+
ltr,
|
|
2139
|
+
intersects,
|
|
2140
|
+
simplifyRange,
|
|
2141
|
+
subset: subset2,
|
|
2142
|
+
SemVer,
|
|
2143
|
+
re: internalRe.re,
|
|
2144
|
+
src: internalRe.src,
|
|
2145
|
+
tokens: internalRe.t,
|
|
2146
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
2147
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
2148
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
2149
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
2150
|
+
};
|
|
2151
|
+
}
|
|
2152
|
+
});
|
|
2153
|
+
|
|
160
2154
|
// src/cli/index.ts
|
|
161
2155
|
import { build, dev, start } from "toiljs/compiler";
|
|
162
2156
|
|
|
@@ -547,6 +2541,7 @@ var settings = {
|
|
|
547
2541
|
error: "Something went wrong"
|
|
548
2542
|
},
|
|
549
2543
|
withGuide: true,
|
|
2544
|
+
accessible: void 0,
|
|
550
2545
|
date: {
|
|
551
2546
|
monthNames: [...t],
|
|
552
2547
|
messages: {
|
|
@@ -558,6 +2553,12 @@ var settings = {
|
|
|
558
2553
|
}
|
|
559
2554
|
}
|
|
560
2555
|
};
|
|
2556
|
+
function isAccessible(n3) {
|
|
2557
|
+
if (n3 !== void 0) return n3;
|
|
2558
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
2559
|
+
const e = process.env.ACCESSIBLE;
|
|
2560
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
2561
|
+
}
|
|
561
2562
|
function isActionKey(n3, e) {
|
|
562
2563
|
if (typeof n3 == "string")
|
|
563
2564
|
return settings.aliases.get(n3) === e;
|
|
@@ -593,7 +2594,7 @@ function block({
|
|
|
593
2594
|
input: e = stdin,
|
|
594
2595
|
output: r2 = stdout,
|
|
595
2596
|
overwrite: o = true,
|
|
596
|
-
hideCursor:
|
|
2597
|
+
hideCursor: n3 = true
|
|
597
2598
|
} = {}) {
|
|
598
2599
|
const s = l.createInterface({
|
|
599
2600
|
input: e,
|
|
@@ -602,50 +2603,46 @@ function block({
|
|
|
602
2603
|
tabSize: 1
|
|
603
2604
|
});
|
|
604
2605
|
l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
605
|
-
const
|
|
2606
|
+
const t2 = (f, { name: a2, sequence: w }) => {
|
|
606
2607
|
const c2 = String(f);
|
|
607
|
-
if (isActionKey([c2, a2,
|
|
608
|
-
|
|
2608
|
+
if (isActionKey([c2, a2, w], "cancel")) {
|
|
2609
|
+
n3 && r2.write(import_sisteransi.cursor.show), process.exit(0);
|
|
609
2610
|
return;
|
|
610
2611
|
}
|
|
611
2612
|
if (!o) return;
|
|
612
2613
|
const i2 = a2 === "return" ? 0 : -1, m2 = a2 === "return" ? -1 : 0;
|
|
613
2614
|
l.moveCursor(r2, i2, m2, () => {
|
|
614
2615
|
l.clearLine(r2, 1, () => {
|
|
615
|
-
e.once("keypress",
|
|
2616
|
+
e.once("keypress", t2);
|
|
616
2617
|
});
|
|
617
2618
|
});
|
|
618
2619
|
};
|
|
619
|
-
return
|
|
620
|
-
e.off("keypress",
|
|
2620
|
+
return n3 && r2.write(import_sisteransi.cursor.hide), e.once("keypress", t2), () => {
|
|
2621
|
+
e.off("keypress", t2), n3 && r2.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
|
|
621
2622
|
};
|
|
622
2623
|
}
|
|
623
2624
|
var getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
624
2625
|
var getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
625
|
-
function wrapTextWithPrefix(e, r2, o,
|
|
2626
|
+
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
626
2627
|
const f = getColumns(e ?? stdout);
|
|
627
2628
|
return wrapAnsi(r2, f - o.length, {
|
|
628
2629
|
hard: true,
|
|
629
2630
|
trim: false
|
|
630
2631
|
}).split(`
|
|
631
2632
|
`).map((c2, i2, m2) => {
|
|
632
|
-
const d =
|
|
633
|
-
return i2 === 0 ? `${
|
|
2633
|
+
const d = t2 ? t2(c2, i2) : c2;
|
|
2634
|
+
return i2 === 0 ? `${n3}${d}` : i2 === m2.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
634
2635
|
}).join(`
|
|
635
2636
|
`);
|
|
636
2637
|
}
|
|
637
|
-
function runValidation(e,
|
|
2638
|
+
function runValidation(e, a2) {
|
|
638
2639
|
if ("~standard" in e) {
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
throw new TypeError(
|
|
642
|
-
"Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic."
|
|
643
|
-
);
|
|
644
|
-
return a2.issues?.at(0)?.message;
|
|
2640
|
+
const n3 = e["~standard"].validate(a2);
|
|
2641
|
+
return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
|
|
645
2642
|
}
|
|
646
|
-
return e(
|
|
2643
|
+
return e(a2);
|
|
647
2644
|
}
|
|
648
|
-
var
|
|
2645
|
+
var y = class {
|
|
649
2646
|
input;
|
|
650
2647
|
output;
|
|
651
2648
|
_abortSignal;
|
|
@@ -660,9 +2657,17 @@ var V = class {
|
|
|
660
2657
|
error = "";
|
|
661
2658
|
value;
|
|
662
2659
|
userInput = "";
|
|
2660
|
+
/**
|
|
2661
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
2662
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
2663
|
+
* and the `ACCESSIBLE` env var.
|
|
2664
|
+
*/
|
|
2665
|
+
get accessible() {
|
|
2666
|
+
return isAccessible(this.opts.accessible);
|
|
2667
|
+
}
|
|
663
2668
|
constructor(t2, e = true) {
|
|
664
|
-
const { input: i2 = stdin, output:
|
|
665
|
-
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render =
|
|
2669
|
+
const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
|
|
2670
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r2.bind(this), this._track = e, this._abortSignal = n3, this.input = i2, this.output = s;
|
|
666
2671
|
}
|
|
667
2672
|
/**
|
|
668
2673
|
* Unsubscribe all listeners
|
|
@@ -700,11 +2705,11 @@ var V = class {
|
|
|
700
2705
|
* @param data - The data to pass to the callback
|
|
701
2706
|
*/
|
|
702
2707
|
emit(t2, ...e) {
|
|
703
|
-
const i2 = this._subscribers.get(t2) ?? [],
|
|
704
|
-
for (const
|
|
705
|
-
|
|
706
|
-
for (const
|
|
707
|
-
|
|
2708
|
+
const i2 = this._subscribers.get(t2) ?? [], s = [];
|
|
2709
|
+
for (const r2 of i2)
|
|
2710
|
+
r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
|
|
2711
|
+
for (const r2 of s)
|
|
2712
|
+
r2();
|
|
708
2713
|
}
|
|
709
2714
|
prompt() {
|
|
710
2715
|
return new Promise((t2) => {
|
|
@@ -747,15 +2752,18 @@ var V = class {
|
|
|
747
2752
|
_clearUserInput() {
|
|
748
2753
|
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
749
2754
|
}
|
|
750
|
-
onKeypress(t2, e) {
|
|
751
|
-
if (this.
|
|
752
|
-
if (this.
|
|
753
|
-
|
|
754
|
-
|
|
2755
|
+
async onKeypress(t2, e) {
|
|
2756
|
+
if (this.state !== "validating") {
|
|
2757
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
|
|
2758
|
+
if (this.opts.validate) {
|
|
2759
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
2760
|
+
let s;
|
|
2761
|
+
i2 instanceof Promise ? (this.state = "validating", this.render(), s = await i2) : s = i2, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
2762
|
+
}
|
|
2763
|
+
this.state !== "error" && (this.state = "submit");
|
|
755
2764
|
}
|
|
756
|
-
this.state
|
|
2765
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
757
2766
|
}
|
|
758
|
-
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
759
2767
|
}
|
|
760
2768
|
close() {
|
|
761
2769
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
@@ -777,28 +2785,28 @@ var V = class {
|
|
|
777
2785
|
else {
|
|
778
2786
|
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
779
2787
|
if (this.restoreCursor(), e) {
|
|
780
|
-
const
|
|
781
|
-
let
|
|
782
|
-
if (
|
|
2788
|
+
const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
|
|
2789
|
+
let n3 = e.lines.find((o) => o >= s);
|
|
2790
|
+
if (n3 === void 0) {
|
|
783
2791
|
this._prevFrame = t2;
|
|
784
2792
|
return;
|
|
785
2793
|
}
|
|
786
2794
|
if (e.lines.length === 1) {
|
|
787
|
-
this.output.write(import_sisteransi.cursor.move(0,
|
|
2795
|
+
this.output.write(import_sisteransi.cursor.move(0, n3 - r2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
788
2796
|
const o = t2.split(`
|
|
789
2797
|
`);
|
|
790
|
-
this.output.write(o[
|
|
2798
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n3 - 1));
|
|
791
2799
|
return;
|
|
792
2800
|
} else if (e.lines.length > 1) {
|
|
793
|
-
if (
|
|
794
|
-
|
|
2801
|
+
if (s < r2)
|
|
2802
|
+
n3 = s;
|
|
795
2803
|
else {
|
|
796
|
-
const h2 =
|
|
2804
|
+
const h2 = n3 - r2;
|
|
797
2805
|
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
798
2806
|
}
|
|
799
2807
|
this.output.write(import_sisteransi.erase.down());
|
|
800
2808
|
const f = t2.split(`
|
|
801
|
-
`).slice(
|
|
2809
|
+
`).slice(n3);
|
|
802
2810
|
this.output.write(f.join(`
|
|
803
2811
|
`)), this._prevFrame = t2;
|
|
804
2812
|
return;
|
|
@@ -810,7 +2818,7 @@ var V = class {
|
|
|
810
2818
|
}
|
|
811
2819
|
}
|
|
812
2820
|
};
|
|
813
|
-
var r = class extends
|
|
2821
|
+
var r = class extends y {
|
|
814
2822
|
get cursor() {
|
|
815
2823
|
return this.value ? 0 : 1;
|
|
816
2824
|
}
|
|
@@ -827,7 +2835,7 @@ var r = class extends V {
|
|
|
827
2835
|
});
|
|
828
2836
|
}
|
|
829
2837
|
};
|
|
830
|
-
var a = class extends
|
|
2838
|
+
var a = class extends y {
|
|
831
2839
|
options;
|
|
832
2840
|
cursor = 0;
|
|
833
2841
|
get _value() {
|
|
@@ -877,7 +2885,7 @@ var a = class extends V {
|
|
|
877
2885
|
});
|
|
878
2886
|
}
|
|
879
2887
|
};
|
|
880
|
-
var n$1 = class n extends
|
|
2888
|
+
var n$1 = class n extends y {
|
|
881
2889
|
options;
|
|
882
2890
|
cursor = 0;
|
|
883
2891
|
get _selectedValue() {
|
|
@@ -905,7 +2913,7 @@ var n$1 = class n extends V {
|
|
|
905
2913
|
});
|
|
906
2914
|
}
|
|
907
2915
|
};
|
|
908
|
-
var n2 = class extends
|
|
2916
|
+
var n2 = class extends y {
|
|
909
2917
|
get userInputWithCursor() {
|
|
910
2918
|
if (this.state === "submit")
|
|
911
2919
|
return this.userInput;
|
|
@@ -979,6 +2987,8 @@ var symbol = (o) => {
|
|
|
979
2987
|
return styleText2("yellow", S_STEP_ERROR);
|
|
980
2988
|
case "submit":
|
|
981
2989
|
return styleText2("green", S_STEP_SUBMIT);
|
|
2990
|
+
case "validating":
|
|
2991
|
+
return styleText2("dim", S_STEP_ACTIVE);
|
|
982
2992
|
}
|
|
983
2993
|
};
|
|
984
2994
|
var symbolBar = (o) => {
|
|
@@ -1034,8 +3044,8 @@ var limitOptions = ({
|
|
|
1034
3044
|
), s = [];
|
|
1035
3045
|
let g = 0;
|
|
1036
3046
|
d && g++, c2 && g++;
|
|
1037
|
-
const T = f + (d ? 1 : 0),
|
|
1038
|
-
for (let t2 = T; t2 <
|
|
3047
|
+
const T = f + (d ? 1 : 0), y2 = W2 - (c2 ? 1 : 0);
|
|
3048
|
+
for (let t2 = T; t2 < y2; t2++) {
|
|
1039
3049
|
const n3 = e[t2], o = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
|
|
1040
3050
|
hard: true,
|
|
1041
3051
|
trim: false
|
|
@@ -1064,39 +3074,39 @@ var limitOptions = ({
|
|
|
1064
3074
|
x.push(n3);
|
|
1065
3075
|
return c2 && x.push(M), x;
|
|
1066
3076
|
};
|
|
1067
|
-
var confirm = (
|
|
1068
|
-
const a2 =
|
|
3077
|
+
var confirm = (e) => {
|
|
3078
|
+
const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
|
|
1069
3079
|
return new r({
|
|
1070
3080
|
active: a2,
|
|
1071
|
-
inactive:
|
|
1072
|
-
signal:
|
|
1073
|
-
input:
|
|
1074
|
-
output:
|
|
1075
|
-
initialValue:
|
|
3081
|
+
inactive: o,
|
|
3082
|
+
signal: e.signal,
|
|
3083
|
+
input: e.input,
|
|
3084
|
+
output: e.output,
|
|
3085
|
+
initialValue: e.initialValue ?? true,
|
|
1076
3086
|
render() {
|
|
1077
|
-
const
|
|
1078
|
-
|
|
1079
|
-
|
|
3087
|
+
const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
|
|
3088
|
+
e.output,
|
|
3089
|
+
e.message,
|
|
1080
3090
|
l2,
|
|
1081
3091
|
u3
|
|
1082
|
-
),
|
|
3092
|
+
), s = `${i2 ? `${styleText2("gray", S_BAR)}
|
|
1083
3093
|
` : ""}${f}
|
|
1084
|
-
`, c2 = this.value ? a2 :
|
|
3094
|
+
`, c2 = this.value ? a2 : o;
|
|
1085
3095
|
switch (this.state) {
|
|
1086
3096
|
case "submit": {
|
|
1087
|
-
const r2 =
|
|
1088
|
-
return `${
|
|
3097
|
+
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
3098
|
+
return `${s}${r2}${styleText2("dim", c2)}`;
|
|
1089
3099
|
}
|
|
1090
3100
|
case "cancel": {
|
|
1091
|
-
const r2 =
|
|
1092
|
-
return `${
|
|
3101
|
+
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
3102
|
+
return `${s}${r2}${styleText2(["strikethrough", "dim"], c2)}${i2 ? `
|
|
1093
3103
|
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1094
3104
|
}
|
|
1095
3105
|
default: {
|
|
1096
|
-
const r2 =
|
|
1097
|
-
return `${
|
|
3106
|
+
const r2 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", g = i2 ? styleText2("cyan", S_BAR_END) : "";
|
|
3107
|
+
return `${s}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${e.vertical ? i2 ? `
|
|
1098
3108
|
${styleText2("cyan", S_BAR)} ` : `
|
|
1099
|
-
` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim",
|
|
3109
|
+
` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
|
|
1100
3110
|
${g}
|
|
1101
3111
|
`;
|
|
1102
3112
|
}
|
|
@@ -1116,7 +3126,7 @@ var multiselect = (i2) => {
|
|
|
1116
3126
|
const u3 = (t2, a2) => {
|
|
1117
3127
|
const r2 = t2.label ?? String(t2.value);
|
|
1118
3128
|
return a2 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2(["strikethrough", "gray"], o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m(r2, (o) => styleText2("dim", o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m(r2, (o) => styleText2(["strikethrough", "dim"], o))}` : a2 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m(r2, (o) => styleText2("dim", o))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2("dim", o))}`;
|
|
1119
|
-
}, d = i2.required ?? true,
|
|
3129
|
+
}, d = i2.required ?? true, x = i2.showInstructions ?? true;
|
|
1120
3130
|
return new a({
|
|
1121
3131
|
options: i2.options,
|
|
1122
3132
|
signal: i2.signal,
|
|
@@ -1147,7 +3157,7 @@ ${styleText2(
|
|
|
1147
3157
|
`${symbol(this.state)} `
|
|
1148
3158
|
), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
|
|
1149
3159
|
` : ""}${a2}
|
|
1150
|
-
`, o = this.value ?? [],
|
|
3160
|
+
`, o = this.value ?? [], g = (n3, l2) => {
|
|
1151
3161
|
if (n3.disabled)
|
|
1152
3162
|
return u3(n3, "disabled");
|
|
1153
3163
|
const s = o.includes(n3.value);
|
|
@@ -1177,7 +3187,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
|
|
|
1177
3187
|
case "error": {
|
|
1178
3188
|
const n3 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l2 = this.error.split(`
|
|
1179
3189
|
`).map(
|
|
1180
|
-
($,
|
|
3190
|
+
($, v) => v === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`
|
|
1181
3191
|
).join(`
|
|
1182
3192
|
`), s = r2.split(`
|
|
1183
3193
|
`).length, h2 = l2.split(`
|
|
@@ -1189,7 +3199,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
|
|
|
1189
3199
|
maxItems: i2.maxItems,
|
|
1190
3200
|
columnPadding: n3.length,
|
|
1191
3201
|
rowPadding: s + h2,
|
|
1192
|
-
style:
|
|
3202
|
+
style: g
|
|
1193
3203
|
}).join(`
|
|
1194
3204
|
${n3}`)}
|
|
1195
3205
|
${l2}
|
|
@@ -1197,7 +3207,7 @@ ${l2}
|
|
|
1197
3207
|
}
|
|
1198
3208
|
default: {
|
|
1199
3209
|
const n3 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l2 = r2.split(`
|
|
1200
|
-
`).length, s =
|
|
3210
|
+
`).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
|
|
1201
3211
|
`), $ = s.length + 1;
|
|
1202
3212
|
return `${r2}${n3}${limitOptions({
|
|
1203
3213
|
output: i2.output,
|
|
@@ -1206,7 +3216,7 @@ ${l2}
|
|
|
1206
3216
|
maxItems: i2.maxItems,
|
|
1207
3217
|
columnPadding: n3.length,
|
|
1208
3218
|
rowPadding: l2 + $,
|
|
1209
|
-
style:
|
|
3219
|
+
style: g
|
|
1210
3220
|
}).join(`
|
|
1211
3221
|
${n3}`)}
|
|
1212
3222
|
${h2}
|
|
@@ -1287,7 +3297,7 @@ var spinner = ({
|
|
|
1287
3297
|
process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i2), process.on("SIGTERM", i2), process.on("exit", g), m2 && m2.addEventListener("abort", i2);
|
|
1288
3298
|
}, H = () => {
|
|
1289
3299
|
process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i2), process.removeListener("SIGTERM", i2), process.removeListener("exit", g), m2 && m2.removeEventListener("abort", i2);
|
|
1290
|
-
},
|
|
3300
|
+
}, y2 = () => {
|
|
1291
3301
|
if (p === void 0) return;
|
|
1292
3302
|
u3 && n3.write(`
|
|
1293
3303
|
`);
|
|
@@ -1307,7 +3317,7 @@ var spinner = ({
|
|
|
1307
3317
|
A(), T = setInterval(() => {
|
|
1308
3318
|
if (u3 && s === p)
|
|
1309
3319
|
return;
|
|
1310
|
-
|
|
3320
|
+
y2(), p = s;
|
|
1311
3321
|
const o = k(E[r2]);
|
|
1312
3322
|
let v;
|
|
1313
3323
|
if (u3)
|
|
@@ -1326,7 +3336,7 @@ var spinner = ({
|
|
|
1326
3336
|
}, F);
|
|
1327
3337
|
}, a2 = (e = "", r2 = 0, t2 = false) => {
|
|
1328
3338
|
if (!d) return;
|
|
1329
|
-
d = false, clearInterval(T),
|
|
3339
|
+
d = false, clearInterval(T), y2();
|
|
1330
3340
|
const o = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
|
|
1331
3341
|
s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o} ${s} ${_(w)}
|
|
1332
3342
|
`) : n3.write(`${o} ${s}
|
|
@@ -1412,19 +3422,19 @@ ${styleText2("gray", S_BAR)}` : ""}`;
|
|
|
1412
3422
|
}
|
|
1413
3423
|
default: {
|
|
1414
3424
|
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1415
|
-
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [],
|
|
1416
|
-
`),
|
|
3425
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
3426
|
+
`), b = p.length + 1;
|
|
1417
3427
|
return `${u3}${r2}${limitOptions({
|
|
1418
3428
|
output: t2.output,
|
|
1419
3429
|
cursor: this.cursor,
|
|
1420
3430
|
options: this.options,
|
|
1421
3431
|
maxItems: t2.maxItems,
|
|
1422
3432
|
columnPadding: r2.length,
|
|
1423
|
-
rowPadding: a2 +
|
|
3433
|
+
rowPadding: a2 + b,
|
|
1424
3434
|
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1425
3435
|
}).join(`
|
|
1426
3436
|
${r2}`)}
|
|
1427
|
-
${
|
|
3437
|
+
${f}
|
|
1428
3438
|
`;
|
|
1429
3439
|
}
|
|
1430
3440
|
}
|
|
@@ -1432,42 +3442,48 @@ ${b}
|
|
|
1432
3442
|
}).prompt();
|
|
1433
3443
|
};
|
|
1434
3444
|
var i = `${styleText2("gray", S_BAR)} `;
|
|
1435
|
-
var text = (
|
|
1436
|
-
validate:
|
|
1437
|
-
placeholder:
|
|
1438
|
-
defaultValue:
|
|
1439
|
-
initialValue:
|
|
1440
|
-
output:
|
|
1441
|
-
signal:
|
|
1442
|
-
input:
|
|
3445
|
+
var text = (t2) => new n2({
|
|
3446
|
+
validate: t2.validate,
|
|
3447
|
+
placeholder: t2.placeholder,
|
|
3448
|
+
defaultValue: t2.defaultValue,
|
|
3449
|
+
initialValue: t2.initialValue,
|
|
3450
|
+
output: t2.output,
|
|
3451
|
+
signal: t2.signal,
|
|
3452
|
+
input: t2.input,
|
|
1443
3453
|
render() {
|
|
1444
|
-
const
|
|
1445
|
-
` : ""}${symbol(this.state)} `}${
|
|
1446
|
-
`,
|
|
3454
|
+
const r2 = t2?.withGuide ?? settings.withGuide, l2 = `${`${r2 ? `${styleText2("gray", S_BAR)}
|
|
3455
|
+
` : ""}${symbol(this.state)} `}${t2.message}
|
|
3456
|
+
`, d = t2.placeholder && t2.placeholder.length > 0 ? (
|
|
1447
3457
|
// biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
|
|
1448
|
-
styleText2("inverse",
|
|
1449
|
-
) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor :
|
|
3458
|
+
styleText2("inverse", t2.placeholder[0]) + styleText2("dim", t2.placeholder.slice(1))
|
|
3459
|
+
) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
|
|
1450
3460
|
switch (this.state) {
|
|
3461
|
+
case "validating": {
|
|
3462
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c2 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
|
|
3463
|
+
return `${l2}${n3}${c2}
|
|
3464
|
+
${i2} ${$}
|
|
3465
|
+
`;
|
|
3466
|
+
}
|
|
1451
3467
|
case "error": {
|
|
1452
|
-
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "",
|
|
1453
|
-
return `${
|
|
1454
|
-
${
|
|
1455
|
-
${
|
|
3468
|
+
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c2 = r2 ? styleText2("yellow", S_BAR_END) : "";
|
|
3469
|
+
return `${l2.trim()}
|
|
3470
|
+
${i2}${o}
|
|
3471
|
+
${c2}${n3}
|
|
1456
3472
|
`;
|
|
1457
3473
|
}
|
|
1458
3474
|
case "submit": {
|
|
1459
|
-
const n3 =
|
|
1460
|
-
return `${
|
|
3475
|
+
const n3 = s ? `${r2 ? " " : ""}${styleText2("dim", s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
3476
|
+
return `${l2}${i2}${n3}`;
|
|
1461
3477
|
}
|
|
1462
3478
|
case "cancel": {
|
|
1463
|
-
const n3 =
|
|
1464
|
-
return `${
|
|
1465
|
-
${
|
|
3479
|
+
const n3 = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
3480
|
+
return `${l2}${i2}${n3}${s.trim() ? `
|
|
3481
|
+
${i2}` : ""}`;
|
|
1466
3482
|
}
|
|
1467
3483
|
default: {
|
|
1468
|
-
const n3 =
|
|
1469
|
-
return `${
|
|
1470
|
-
${
|
|
3484
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "";
|
|
3485
|
+
return `${l2}${n3}${o}
|
|
3486
|
+
${i2}
|
|
1471
3487
|
`;
|
|
1472
3488
|
}
|
|
1473
3489
|
}
|
|
@@ -1494,11 +3510,11 @@ var PREPROCESSOR_PKG = {
|
|
|
1494
3510
|
};
|
|
1495
3511
|
var TAILWIND_PKGS = ["tailwindcss", "@tailwindcss/vite"];
|
|
1496
3512
|
var PKG_VERSION = {
|
|
1497
|
-
sass: "^1.
|
|
1498
|
-
less: "^4.
|
|
3513
|
+
sass: "^1.104.1",
|
|
3514
|
+
less: "^4.9.1",
|
|
1499
3515
|
stylus: "^0.64.0",
|
|
1500
|
-
tailwindcss: "^4.3.
|
|
1501
|
-
"@tailwindcss/vite": "^4.3.
|
|
3516
|
+
tailwindcss: "^4.3.3",
|
|
3517
|
+
"@tailwindcss/vite": "^4.3.3"
|
|
1502
3518
|
};
|
|
1503
3519
|
var TAILWIND_ENTRY = "styles/tailwind.css";
|
|
1504
3520
|
var TAILWIND_CSS = `@import 'tailwindcss';
|
|
@@ -2045,12 +4061,13 @@ async function isEmptyDir(dir) {
|
|
|
2045
4061
|
function scaffold(name, template, features, aiTools, images) {
|
|
2046
4062
|
const toilVersion = version();
|
|
2047
4063
|
const devDependencies = {
|
|
2048
|
-
"@types/react": "^19.
|
|
2049
|
-
"@types/react-dom": "^19.
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
4064
|
+
"@types/react": "^19.3.0",
|
|
4065
|
+
"@types/react-dom": "^19.3.0",
|
|
4066
|
+
oxlint: "^1.83.0",
|
|
4067
|
+
"oxlint-tsgolint": "^7.0.2001",
|
|
4068
|
+
prettier: "^3.9.6",
|
|
4069
|
+
toilscript: "^0.1.60",
|
|
4070
|
+
typescript: "^7.0.2"
|
|
2054
4071
|
};
|
|
2055
4072
|
for (const dep of requiredPackages(features).sort()) {
|
|
2056
4073
|
devDependencies[dep] = PKG_VERSION[dep] ?? "latest";
|
|
@@ -2064,14 +4081,14 @@ function scaffold(name, template, features, aiTools, images) {
|
|
|
2064
4081
|
dev: "toiljs dev",
|
|
2065
4082
|
build: "toiljs build",
|
|
2066
4083
|
"build:server": "toiljs build --server",
|
|
2067
|
-
lint: "
|
|
4084
|
+
lint: "oxlint --type-aware client",
|
|
2068
4085
|
typecheck: "tsc --noEmit",
|
|
2069
4086
|
format: 'prettier --write "client/**/*.{ts,tsx,css,scss,less}" "client/public/**/*.html" "server/**/*.ts"'
|
|
2070
4087
|
},
|
|
2071
4088
|
dependencies: {
|
|
2072
4089
|
toiljs: `^${toilVersion}`,
|
|
2073
|
-
react: "^19.
|
|
2074
|
-
"react-dom": "^19.
|
|
4090
|
+
react: "^19.3.0",
|
|
4091
|
+
"react-dom": "^19.3.0"
|
|
2075
4092
|
},
|
|
2076
4093
|
devDependencies
|
|
2077
4094
|
};
|
|
@@ -2087,23 +4104,22 @@ export default defineConfig({
|
|
|
2087
4104
|
});
|
|
2088
4105
|
`,
|
|
2089
4106
|
"tsconfig.json": '{\n "extends": "toiljs/tsconfig",\n "compilerOptions": {\n "paths": { "shared/*": ["./shared/*"] }\n },\n "include": ["client", "shared", "emails", "toil.config.ts", "toil-env.d.ts", "toil-routes.d.ts"]\n}\n',
|
|
2090
|
-
"
|
|
4107
|
+
"oxlint.config.ts": "import toiljs from 'toiljs/oxlint';\n\nexport default toiljs;\n",
|
|
2091
4108
|
".prettierrc": '"toiljs/prettier"\n',
|
|
2092
4109
|
// Generated files don't need formatting. (toilscript server decorators like @main /
|
|
2093
4110
|
// @remote-on-functions are handled by the toiljs/prettier-plugin, so server/ is not ignored.)
|
|
2094
4111
|
".prettierignore": "node_modules\nbuild\n.toil\nshared/server.ts\ntoil-env.d.ts\ntoil-routes.d.ts\nserver/_emails.ts\nserver/_ssr/\nserver/toil-server-env.d.ts\n",
|
|
2095
4112
|
".gitignore": "node_modules\nbuild\n.toil\nshared/server.ts\ntoil-env.d.ts\ntoil-routes.d.ts\nserver/_ssr/\nhosts/*/_tmpl/\n# Local dev env vars/secrets (never commit)\n.env\n.env.secrets\n",
|
|
2096
|
-
// Use the
|
|
2097
|
-
// version, and prompt to switch, so the editor loads the toilscript LS plugin wired
|
|
2098
|
-
// in server/tsconfig.json (which clears the @database / @data editor false positives).
|
|
4113
|
+
// Use the native TypeScript 7 language server.
|
|
2099
4114
|
".vscode/settings.json": JSON.stringify(
|
|
2100
4115
|
{
|
|
2101
|
-
"
|
|
2102
|
-
"
|
|
4116
|
+
"js/ts.experimental.useTsgo": true,
|
|
4117
|
+
"oxc.typeAware": true
|
|
2103
4118
|
},
|
|
2104
4119
|
null,
|
|
2105
4120
|
4
|
|
2106
4121
|
) + "\n",
|
|
4122
|
+
".vscode/extensions.json": JSON.stringify({ recommendations: ["oxc.oxc-vscode"] }, null, 4) + "\n",
|
|
2107
4123
|
"toil-env.d.ts": TOIL_ENV_DTS,
|
|
2108
4124
|
// Stub typed-routes augmentation (RoutePath = string until the first dev/build regenerates it).
|
|
2109
4125
|
"toil-routes.d.ts": "// AUTO-GENERATED by toil, do not edit.\nexport {};\n",
|
|
@@ -2154,15 +4170,10 @@ export default defineConfig({
|
|
|
2154
4170
|
null,
|
|
2155
4171
|
4
|
|
2156
4172
|
) + "\n",
|
|
2157
|
-
// The
|
|
2158
|
-
// (`@database` static collections like `Db.users`, the `@data` codec, `@user`), so
|
|
2159
|
-
// stock TypeScript stops false-flagging them as TS2339. Editor-only; ignored by tsc.
|
|
4173
|
+
// The WebAssembly dialect is checked by toilscript during the server build.
|
|
2160
4174
|
"server/tsconfig.json": JSON.stringify(
|
|
2161
4175
|
{
|
|
2162
4176
|
extends: "toilscript/std/assembly.json",
|
|
2163
|
-
compilerOptions: {
|
|
2164
|
-
plugins: [{ name: "toilscript/std/ts-plugin.cjs" }]
|
|
2165
|
-
},
|
|
2166
4177
|
include: ["./**/*.ts"]
|
|
2167
4178
|
},
|
|
2168
4179
|
null,
|
|
@@ -2181,6 +4192,17 @@ export default defineConfig({
|
|
|
2181
4192
|
"## Build",
|
|
2182
4193
|
"",
|
|
2183
4194
|
" npm run build",
|
|
4195
|
+
"",
|
|
4196
|
+
"## Editor setup",
|
|
4197
|
+
"",
|
|
4198
|
+
"Run `npm install` first and use Node 26 for editor tooling.",
|
|
4199
|
+
"",
|
|
4200
|
+
'- **VS Code:** install [Oxc](https://marketplace.visualstudio.com/items?itemName=oxc.oxc-vscode) (`oxc.oxc-vscode`) from Extensions, or run `code --install-extension oxc.oxc-vscode`. This project already enables `"oxc.typeAware": true` in `.vscode/settings.json`.',
|
|
4201
|
+
"- **WebStorm:** install [Oxc](https://plugins.jetbrains.com/plugin/27061-oxc) through **Settings \u2192 Plugins \u2192 Marketplace**. In **Settings \u2192 Tools \u2192 Oxlint**, select **Automatic configuration** and check **Enable type aware rules**. Apply, then run **Restart Oxlint Server** through Find Action. The unchecked IDE setting overrides the project config.",
|
|
4202
|
+
"",
|
|
4203
|
+
"If WebStorm cannot find the server, select **Manual configuration**, point **Path to Oxlint Language Server** at `<project>/node_modules/oxlint/bin/oxlint`, and check **Add --lsp CLI argument**. Keep type-aware rules enabled. Leave the config path blank to discover project configs.",
|
|
4204
|
+
"",
|
|
4205
|
+
"Run `npm run lint` to check the same rules in a terminal. No separate tsgolint editor plugin is needed.",
|
|
2184
4206
|
""
|
|
2185
4207
|
].join("\n"),
|
|
2186
4208
|
// ToilDB migrations live under server/migrations/ (folder + `*.migration.ts` is enforced by
|
|
@@ -2579,6 +4601,8 @@ async function runCreate(opts) {
|
|
|
2579
4601
|
if (!install) steps.push("npm install");
|
|
2580
4602
|
steps.push(`${accent("npm run dev")} ${dim("start the dev server")}`);
|
|
2581
4603
|
steps.push(`${accent("npm run build")} ${dim("build for production")}`);
|
|
4604
|
+
steps.push("Install the Oxc plugin for VS Code or WebStorm (README.md \u2192 Editor setup)");
|
|
4605
|
+
steps.push("WebStorm: Settings \u2192 Tools \u2192 Oxlint \u2192 Enable type aware rules");
|
|
2582
4606
|
note(steps.map((l2) => dim(" ") + l2).join("\n"), "Next steps");
|
|
2583
4607
|
outro(`Created ${accent(path4.basename(name))}, happy building! ${dim("(v" + version() + ")")}`);
|
|
2584
4608
|
}
|
|
@@ -2714,13 +4738,26 @@ function runDb(action, fileArg, opts) {
|
|
|
2714
4738
|
import fs5 from "node:fs";
|
|
2715
4739
|
import { createRequire } from "node:module";
|
|
2716
4740
|
import path6 from "node:path";
|
|
2717
|
-
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
4741
|
+
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
|
|
2718
4742
|
import {
|
|
2719
4743
|
loadConfig as loadConfig2,
|
|
2720
4744
|
scanRoutes,
|
|
2721
4745
|
TOIL_SERVER_ENV_DTS as TOIL_SERVER_ENV_DTS2
|
|
2722
4746
|
} from "toiljs/compiler";
|
|
2723
4747
|
|
|
4748
|
+
// src/cli/typescript.ts
|
|
4749
|
+
var import_semver = __toESM(require_semver2(), 1);
|
|
4750
|
+
var TYPESCRIPT_SUPPORTED = ">=7.0.2 <8.0.0";
|
|
4751
|
+
var TYPESCRIPT_FIX_RANGE = "^7.0.2";
|
|
4752
|
+
function isSupportedTypeScriptVersion(version2) {
|
|
4753
|
+
return (0, import_semver.satisfies)(version2, TYPESCRIPT_SUPPORTED);
|
|
4754
|
+
}
|
|
4755
|
+
function isSupportedTypeScriptRange(range) {
|
|
4756
|
+
if (!(0, import_semver.validRange)(range)) return false;
|
|
4757
|
+
const min = (0, import_semver.minVersion)(range);
|
|
4758
|
+
return min !== null && isSupportedTypeScriptVersion(min.version) && (0, import_semver.subset)(range, TYPESCRIPT_SUPPORTED);
|
|
4759
|
+
}
|
|
4760
|
+
|
|
2724
4761
|
// src/cli/diagnostics.ts
|
|
2725
4762
|
function parseVersion(v) {
|
|
2726
4763
|
const m2 = /(\d+)(?:\.(\d+))?(?:\.(\d+))?/.exec(v);
|
|
@@ -2729,9 +4766,9 @@ function parseVersion(v) {
|
|
|
2729
4766
|
}
|
|
2730
4767
|
function satisfiesMin(version2, range) {
|
|
2731
4768
|
const [a2, b, c2] = parseVersion(version2);
|
|
2732
|
-
const [x,
|
|
4769
|
+
const [x, y2, z] = parseVersion(range);
|
|
2733
4770
|
if (a2 !== x) return a2 > x;
|
|
2734
|
-
if (b !==
|
|
4771
|
+
if (b !== y2) return b > y2;
|
|
2735
4772
|
return c2 >= z;
|
|
2736
4773
|
}
|
|
2737
4774
|
function checkNode(current, requiredRange) {
|
|
@@ -2763,47 +4800,15 @@ function checkPeer(name, installed, range) {
|
|
|
2763
4800
|
fix: ok ? void 0 : `Update ${name} to ${range}.`
|
|
2764
4801
|
};
|
|
2765
4802
|
}
|
|
2766
|
-
var TYPESCRIPT_SUPPORTED = ">=6.0.0 <7.0.0";
|
|
2767
|
-
var TYPESCRIPT_FIX_RANGE = "^6.0.3";
|
|
2768
|
-
var TYPESCRIPT_NATIVE_MAJOR = 7;
|
|
2769
|
-
function rangeMajor(range) {
|
|
2770
|
-
const m2 = /(\d+)/.exec(range.replace(/^[\s^~>=<v]*/, ""));
|
|
2771
|
-
return m2 ? Number(m2[1]) : null;
|
|
2772
|
-
}
|
|
2773
4803
|
function checkTypeScript(installed, declared) {
|
|
2774
|
-
const
|
|
2775
|
-
const
|
|
2776
|
-
const unsupported = (version2, detail) => ({
|
|
2777
|
-
id,
|
|
2778
|
-
label,
|
|
2779
|
-
status: "fail",
|
|
2780
|
-
detail,
|
|
2781
|
-
fix: `TypeScript ${version2} removed the JavaScript compiler API (it moved to 'typescript/unstable/*'), which toiljs's route-metadata extractor, the eslint preset, and typedoc all load. Pin typescript to "${TYPESCRIPT_FIX_RANGE}" and reinstall (\`toiljs doctor --fix\` does this).`
|
|
2782
|
-
});
|
|
2783
|
-
if (installed === null) {
|
|
2784
|
-
return {
|
|
2785
|
-
id,
|
|
2786
|
-
label,
|
|
2787
|
-
status: "fail",
|
|
2788
|
-
detail: `not installed (requires ${TYPESCRIPT_SUPPORTED})`,
|
|
2789
|
-
fix: `Install typescript@"${TYPESCRIPT_FIX_RANGE}".`
|
|
2790
|
-
};
|
|
2791
|
-
}
|
|
2792
|
-
const installedMajor = rangeMajor(installed);
|
|
2793
|
-
if (installedMajor !== null && installedMajor >= TYPESCRIPT_NATIVE_MAJOR) {
|
|
2794
|
-
return unsupported(String(installedMajor), `${installed} installed, unsupported`);
|
|
2795
|
-
}
|
|
2796
|
-
const declaredMajor = declared === null ? null : rangeMajor(declared);
|
|
2797
|
-
if (declaredMajor !== null && declaredMajor >= TYPESCRIPT_NATIVE_MAJOR) {
|
|
2798
|
-
return unsupported(String(declaredMajor), `package.json declares ${declared ?? ""}`);
|
|
2799
|
-
}
|
|
2800
|
-
const ok = satisfiesMin(installed, TYPESCRIPT_SUPPORTED);
|
|
4804
|
+
const installedOk = installed !== null && isSupportedTypeScriptVersion(installed);
|
|
4805
|
+
const declaredOk = declared === null || isSupportedTypeScriptRange(declared);
|
|
2801
4806
|
return {
|
|
2802
|
-
id,
|
|
2803
|
-
label,
|
|
2804
|
-
status:
|
|
2805
|
-
detail: `${installed} (requires ${TYPESCRIPT_SUPPORTED})`,
|
|
2806
|
-
fix:
|
|
4807
|
+
id: "peer:typescript",
|
|
4808
|
+
label: "typescript",
|
|
4809
|
+
status: installedOk && declaredOk ? "pass" : "fail",
|
|
4810
|
+
detail: `${installed ?? "not installed"} (requires ${TYPESCRIPT_SUPPORTED})${declaredOk ? "" : `; package.json declares ${declared}`}`,
|
|
4811
|
+
fix: installedOk && declaredOk ? void 0 : `Migrate to TypeScript 7: set typescript to "${TYPESCRIPT_FIX_RANGE}" and reinstall. Run \`toiljs doctor --fix\` to update the declaration; replace ESLint with the toiljs/oxlint preset.`
|
|
2807
4812
|
};
|
|
2808
4813
|
}
|
|
2809
4814
|
function checkPackageManager(lockfiles) {
|
|
@@ -3096,12 +5101,12 @@ function checkRestDispatch(f) {
|
|
|
3096
5101
|
};
|
|
3097
5102
|
}
|
|
3098
5103
|
function checkServerTsPlugin(present) {
|
|
3099
|
-
return
|
|
5104
|
+
return {
|
|
3100
5105
|
id: "server-ts-plugin",
|
|
3101
|
-
label: "
|
|
3102
|
-
status: "warn",
|
|
3103
|
-
detail:
|
|
3104
|
-
fix:
|
|
5106
|
+
label: "TypeScript 7 editor migration",
|
|
5107
|
+
status: present ? "warn" : "pass",
|
|
5108
|
+
detail: present ? "The legacy toilscript JavaScript language-service plugin cannot run in the TypeScript 7 native language server." : void 0,
|
|
5109
|
+
fix: present ? "Run `toiljs doctor --fix` to remove the legacy plugin. Use `toiljs build --server` for the WebAssembly dialect diagnostics." : void 0
|
|
3105
5110
|
};
|
|
3106
5111
|
}
|
|
3107
5112
|
function checkMigrationsDir(exists) {
|
|
@@ -3207,26 +5212,29 @@ function applyTypeScriptFix(root) {
|
|
|
3207
5212
|
const pkgPath = path6.join(root, "package.json");
|
|
3208
5213
|
const pkg = readJsonObject(pkgPath);
|
|
3209
5214
|
if (pkg === null) return { changed, skipped };
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
5215
|
+
let declared = false;
|
|
5216
|
+
for (const field of [
|
|
5217
|
+
"dependencies",
|
|
5218
|
+
"devDependencies",
|
|
5219
|
+
"peerDependencies",
|
|
5220
|
+
"optionalDependencies"
|
|
5221
|
+
]) {
|
|
5222
|
+
const deps = asRecord(pkg[field]);
|
|
5223
|
+
if (!deps || typeof deps.typescript !== "string") continue;
|
|
5224
|
+
declared = true;
|
|
5225
|
+
if (isSupportedTypeScriptRange(deps.typescript)) continue;
|
|
5226
|
+
changed.push(
|
|
5227
|
+
`package.json (${field}.typescript ${deps.typescript} -> ${TYPESCRIPT_FIX_RANGE})`
|
|
5228
|
+
);
|
|
5229
|
+
deps.typescript = TYPESCRIPT_FIX_RANGE;
|
|
5230
|
+
}
|
|
5231
|
+
if (!declared) {
|
|
5232
|
+
const deps = asRecord(pkg.devDependencies) ?? {};
|
|
5233
|
+
deps.typescript = TYPESCRIPT_FIX_RANGE;
|
|
5234
|
+
pkg.devDependencies = deps;
|
|
5235
|
+
changed.push(`package.json (add typescript ${TYPESCRIPT_FIX_RANGE})`);
|
|
3219
5236
|
}
|
|
3220
|
-
|
|
3221
|
-
if (deps === null) return { changed, skipped };
|
|
3222
|
-
const declared = deps.typescript;
|
|
3223
|
-
const declaredMajor = rangeMajor(declared);
|
|
3224
|
-
const installedMajor = rangeMajor(installedVersion(root, "typescript") ?? "");
|
|
3225
|
-
const unsupported = declaredMajor !== null && declaredMajor >= 7 || installedMajor !== null && installedMajor >= 7;
|
|
3226
|
-
if (!unsupported) return { changed, skipped };
|
|
3227
|
-
deps.typescript = TYPESCRIPT_FIX_RANGE;
|
|
3228
|
-
writeFile(pkgPath, JSON.stringify(pkg, null, 4) + "\n");
|
|
3229
|
-
changed.push(`package.json (typescript ${declared} -> ${TYPESCRIPT_FIX_RANGE})`);
|
|
5237
|
+
if (changed.length) writeFile(pkgPath, JSON.stringify(pkg, null, 4) + "\n");
|
|
3230
5238
|
return { changed, skipped };
|
|
3231
5239
|
}
|
|
3232
5240
|
function asRecord(value) {
|
|
@@ -3248,7 +5256,7 @@ function gatherRpcFacts(root) {
|
|
|
3248
5256
|
const tsconfig = readJsonObject(path6.join(root, "tsconfig.json"));
|
|
3249
5257
|
const gitignore = readFile(path6.join(root, ".gitignore"));
|
|
3250
5258
|
const buildServerWired = [scripts["build:server"], scripts["build"]].some(
|
|
3251
|
-
(s) => typeof s === "string" && s.includes("--rpcModule")
|
|
5259
|
+
(s) => typeof s === "string" && (s.includes("--rpcModule") || /\btoiljs\s+build\b/.test(s))
|
|
3252
5260
|
);
|
|
3253
5261
|
let tsconfigWired = false;
|
|
3254
5262
|
if (tsconfig) {
|
|
@@ -3317,7 +5325,6 @@ function gatherAuthFacts(root, toilconfig) {
|
|
|
3317
5325
|
}
|
|
3318
5326
|
return { usesAuth, sessionSecretSet: secretDefined(root, "AUTH_SESSION_SECRET") };
|
|
3319
5327
|
}
|
|
3320
|
-
var TS_PLUGIN_NAME = "toilscript/std/ts-plugin.cjs";
|
|
3321
5328
|
function serverTsconfigPath(root, toilconfig) {
|
|
3322
5329
|
const dirs = /* @__PURE__ */ new Set();
|
|
3323
5330
|
const entries = Array.isArray(toilconfig?.entries) ? toilconfig.entries.filter((e) => typeof e === "string") : [];
|
|
@@ -3517,7 +5524,10 @@ function applyPrettierFix(root, pkg) {
|
|
|
3517
5524
|
skipped.push(`${name} (add "${PRETTIER_PLUGIN}" to plugins by hand)`);
|
|
3518
5525
|
return { changed, skipped };
|
|
3519
5526
|
}
|
|
3520
|
-
obj.plugins = [
|
|
5527
|
+
obj.plugins = [
|
|
5528
|
+
...Array.isArray(obj.plugins) ? obj.plugins : [],
|
|
5529
|
+
PRETTIER_PLUGIN
|
|
5530
|
+
];
|
|
3521
5531
|
writeFile(filePath, JSON.stringify(obj, null, 4) + "\n");
|
|
3522
5532
|
changed.push(name);
|
|
3523
5533
|
return { changed, skipped };
|
|
@@ -3538,39 +5548,36 @@ function applyServerEditorFix(root, toilconfig) {
|
|
|
3538
5548
|
const changed = [];
|
|
3539
5549
|
const skipped = [];
|
|
3540
5550
|
const tsPath = serverTsconfigPath(root, toilconfig);
|
|
3541
|
-
if (tsPath
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
if (parsed
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
5551
|
+
if (tsPath !== null) {
|
|
5552
|
+
const parsed = readJsonObject(tsPath);
|
|
5553
|
+
if (parsed === null)
|
|
5554
|
+
skipped.push(
|
|
5555
|
+
`${path6.relative(root, tsPath)} (remove legacy ts-plugin from JSONC manually)`
|
|
5556
|
+
);
|
|
5557
|
+
else if (tsconfigHasToilPlugin(parsed)) {
|
|
5558
|
+
const co = asRecord(parsed.compilerOptions);
|
|
5559
|
+
if (co && Array.isArray(co.plugins)) {
|
|
5560
|
+
const plugins = co.plugins.filter((plugin) => {
|
|
5561
|
+
const name = asRecord(plugin)?.name;
|
|
5562
|
+
return typeof name !== "string" || !name.includes("ts-plugin");
|
|
5563
|
+
});
|
|
5564
|
+
if (plugins.length === 0) delete co.plugins;
|
|
5565
|
+
else co.plugins = plugins;
|
|
5566
|
+
writeFile(tsPath, JSON.stringify(parsed, null, 4) + "\n");
|
|
5567
|
+
changed.push(path6.relative(root, tsPath));
|
|
5568
|
+
}
|
|
3556
5569
|
}
|
|
3557
5570
|
}
|
|
3558
|
-
const vsPath = path6.join(root, ".vscode
|
|
3559
|
-
const
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
}
|
|
3569
|
-
if (vs["typescript.enablePromptUseWorkspaceTsdk"] !== true) {
|
|
3570
|
-
vs["typescript.enablePromptUseWorkspaceTsdk"] = true;
|
|
3571
|
-
touched = true;
|
|
3572
|
-
}
|
|
3573
|
-
if (touched) {
|
|
5571
|
+
const vsPath = path6.join(root, ".vscode/settings.json");
|
|
5572
|
+
const vs = fs5.existsSync(vsPath) ? readJsonObject(vsPath) : {};
|
|
5573
|
+
if (vs === null)
|
|
5574
|
+
skipped.push(".vscode/settings.json (enable js/ts.experimental.useTsgo manually)");
|
|
5575
|
+
else {
|
|
5576
|
+
const before = JSON.stringify(vs);
|
|
5577
|
+
delete vs["typescript.tsdk"];
|
|
5578
|
+
delete vs["typescript.enablePromptUseWorkspaceTsdk"];
|
|
5579
|
+
vs["js/ts.experimental.useTsgo"] = true;
|
|
5580
|
+
if (JSON.stringify(vs) !== before) {
|
|
3574
5581
|
fs5.mkdirSync(path6.dirname(vsPath), { recursive: true });
|
|
3575
5582
|
writeFile(vsPath, JSON.stringify(vs, null, 4) + "\n");
|
|
3576
5583
|
changed.push(".vscode/settings.json");
|
|
@@ -3578,6 +5585,71 @@ function applyServerEditorFix(root, toilconfig) {
|
|
|
3578
5585
|
}
|
|
3579
5586
|
return { changed, skipped };
|
|
3580
5587
|
}
|
|
5588
|
+
async function checkNativeTypeScriptConfig(root) {
|
|
5589
|
+
const check = { id: "typescript:config", label: "TypeScript 7 configuration" };
|
|
5590
|
+
const installed = installedVersion(root, "typescript");
|
|
5591
|
+
if (!installed || !isSupportedTypeScriptVersion(installed))
|
|
5592
|
+
return {
|
|
5593
|
+
...check,
|
|
5594
|
+
status: "fail",
|
|
5595
|
+
detail: "Install TypeScript 7 before validating compiler configuration."
|
|
5596
|
+
};
|
|
5597
|
+
const configPath = path6.join(root, "tsconfig.json");
|
|
5598
|
+
if (!fs5.existsSync(configPath))
|
|
5599
|
+
return {
|
|
5600
|
+
...check,
|
|
5601
|
+
status: "fail",
|
|
5602
|
+
detail: "tsconfig.json is missing.",
|
|
5603
|
+
fix: "Create a tsconfig.json extending toiljs/tsconfig."
|
|
5604
|
+
};
|
|
5605
|
+
try {
|
|
5606
|
+
const apiPath = createRequire(path6.join(root, "package.json")).resolve(
|
|
5607
|
+
"typescript/unstable/sync"
|
|
5608
|
+
);
|
|
5609
|
+
const native = await import(pathToFileURL(apiPath).href);
|
|
5610
|
+
const api = new native.API({ cwd: root });
|
|
5611
|
+
let snapshot;
|
|
5612
|
+
try {
|
|
5613
|
+
snapshot = api.updateSnapshot({ openProjects: [configPath] });
|
|
5614
|
+
const project = snapshot.getProject(configPath);
|
|
5615
|
+
if (!project) throw new Error("The native compiler could not load tsconfig.json.");
|
|
5616
|
+
const diagnostics = [
|
|
5617
|
+
...project.program.getConfigFileParsingDiagnostics(),
|
|
5618
|
+
...project.program.getProgramDiagnostics()
|
|
5619
|
+
].filter((diagnostic) => diagnostic.category === native.DiagnosticCategory.Error);
|
|
5620
|
+
return {
|
|
5621
|
+
...check,
|
|
5622
|
+
status: diagnostics.length ? "fail" : "pass",
|
|
5623
|
+
detail: diagnostics.length ? diagnostics.map((diagnostic) => `TS${diagnostic.code}: ${diagnostic.text}`).join("\n") : "Compiler options are compatible with TypeScript 7.",
|
|
5624
|
+
fix: diagnostics.length ? "Migrate the reported tsconfig options, preserving path mappings. See docs/getting-started/typescript7.md." : void 0
|
|
5625
|
+
};
|
|
5626
|
+
} finally {
|
|
5627
|
+
snapshot?.dispose();
|
|
5628
|
+
api.close();
|
|
5629
|
+
}
|
|
5630
|
+
} catch (error) {
|
|
5631
|
+
return {
|
|
5632
|
+
...check,
|
|
5633
|
+
status: "fail",
|
|
5634
|
+
detail: `Cannot validate native compiler configuration: ${String(error)}`
|
|
5635
|
+
};
|
|
5636
|
+
}
|
|
5637
|
+
}
|
|
5638
|
+
function checkLintMigration(root) {
|
|
5639
|
+
const pkg = readJsonObject(path6.join(root, "package.json"));
|
|
5640
|
+
const script = asRecord(pkg?.scripts)?.lint;
|
|
5641
|
+
const config = readFile(path6.join(root, "oxlint.config.ts")) ?? readFile(path6.join(root, ".oxlintrc.json")) ?? "";
|
|
5642
|
+
const configured = config.includes("toiljs/oxlint") || /["']?typeAware["']?\s*:\s*true/.test(config);
|
|
5643
|
+
const scriptOk = typeof script === "string" && /\boxlint\b/.test(script) && !/\beslint\b/.test(script) && (script.includes("--type-aware") || configured);
|
|
5644
|
+
const installed = installedVersion(root, "oxlint") !== null && installedVersion(root, "oxlint-tsgolint") !== null;
|
|
5645
|
+
return {
|
|
5646
|
+
id: "lint:typescript7",
|
|
5647
|
+
label: "Oxlint + tsgolint",
|
|
5648
|
+
status: installed && scriptOk && configured ? "pass" : "fail",
|
|
5649
|
+
detail: installed && scriptOk && configured ? "Type-aware Oxlint configured" : "Migrate the ESLint toolchain to type-aware Oxlint.",
|
|
5650
|
+
fix: installed && scriptOk && configured ? void 0 : 'Install oxlint and oxlint-tsgolint, import toiljs/oxlint in oxlint.config.ts, and set lint to "oxlint --type-aware client". Port project-specific rules into that config.'
|
|
5651
|
+
};
|
|
5652
|
+
}
|
|
3581
5653
|
function frameworkMeta() {
|
|
3582
5654
|
const pkgPath = path6.resolve(
|
|
3583
5655
|
path6.dirname(fileURLToPath3(import.meta.url)),
|
|
@@ -3714,11 +5786,13 @@ async function runDoctor(opts) {
|
|
|
3714
5786
|
const declaredTypeScript = (() => {
|
|
3715
5787
|
const pkg = readJsonObject(path6.join(root, "package.json"));
|
|
3716
5788
|
if (pkg === null) return deps.typescript ?? null;
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
5789
|
+
const ranges = [
|
|
5790
|
+
"dependencies",
|
|
5791
|
+
"devDependencies",
|
|
5792
|
+
"peerDependencies",
|
|
5793
|
+
"optionalDependencies"
|
|
5794
|
+
].map((field) => asRecord(pkg[field])?.typescript).filter((range) => typeof range === "string");
|
|
5795
|
+
return ranges.find((range) => !isSupportedTypeScriptRange(range)) ?? ranges[0] ?? null;
|
|
3722
5796
|
})();
|
|
3723
5797
|
const typeScriptCheck = checkTypeScript(
|
|
3724
5798
|
installedVersion(root, "typescript"),
|
|
@@ -3726,7 +5800,7 @@ async function runDoctor(opts) {
|
|
|
3726
5800
|
);
|
|
3727
5801
|
const rpcFix = serverPresent && opts.fix ? applyRpcFix(root) : null;
|
|
3728
5802
|
const prettierFix = serverPresent && opts.fix ? applyPrettierFix(root, projectPkg) : null;
|
|
3729
|
-
const editorFix =
|
|
5803
|
+
const editorFix = opts.fix ? applyServerEditorFix(root, toilconfig) : null;
|
|
3730
5804
|
const rpcFacts = gatherRpcFacts(root);
|
|
3731
5805
|
const restFacts = gatherRestFacts(root, toilconfig);
|
|
3732
5806
|
const authFacts = gatherAuthFacts(root, toilconfig);
|
|
@@ -3736,7 +5810,7 @@ async function runDoctor(opts) {
|
|
|
3736
5810
|
);
|
|
3737
5811
|
const serverTsPath = serverPresent ? serverTsconfigPath(root, toilconfig) : null;
|
|
3738
5812
|
const serverTsParsed = serverTsPath ? readJsonObject(serverTsPath) : null;
|
|
3739
|
-
const serverTsPluginPresent = serverTsPath === null || serverTsParsed === null ?
|
|
5813
|
+
const serverTsPluginPresent = serverTsPath === null || serverTsParsed === null ? false : tsconfigHasToilPlugin(serverTsParsed);
|
|
3740
5814
|
const applied = [typeScriptFix, rpcFix, prettierFix, editorFix].filter(
|
|
3741
5815
|
(fix) => fix !== null
|
|
3742
5816
|
);
|
|
@@ -3752,6 +5826,8 @@ async function runDoctor(opts) {
|
|
|
3752
5826
|
checkToiljsInstalled("toiljs" in deps ? version() : null),
|
|
3753
5827
|
...peerChecks,
|
|
3754
5828
|
typeScriptCheck,
|
|
5829
|
+
checkLintMigration(root),
|
|
5830
|
+
await checkNativeTypeScriptConfig(root),
|
|
3755
5831
|
checkPackageManager(LOCKFILES.filter((f) => fs5.existsSync(path6.join(root, f))))
|
|
3756
5832
|
]
|
|
3757
5833
|
},
|
|
@@ -3825,7 +5901,9 @@ function renderFix(result) {
|
|
|
3825
5901
|
if (result.changed.length > 0) {
|
|
3826
5902
|
out2.push(" " + success("fixed") + dim(` ${result.changed.join(", ")}`));
|
|
3827
5903
|
if (result.changed.some((entry) => entry.startsWith("package.json"))) {
|
|
3828
|
-
out2.push(
|
|
5904
|
+
out2.push(
|
|
5905
|
+
" " + dim("run your installer (npm/pnpm/yarn) to apply the version changes.")
|
|
5906
|
+
);
|
|
3829
5907
|
}
|
|
3830
5908
|
} else {
|
|
3831
5909
|
out2.push(" " + dim("nothing to fix."));
|
|
@@ -3872,12 +5950,8 @@ function parseNcuJson(stdout2) {
|
|
|
3872
5950
|
return {};
|
|
3873
5951
|
}
|
|
3874
5952
|
}
|
|
3875
|
-
var UNSUPPORTED_MAJOR = { typescript: 7 };
|
|
3876
5953
|
function withheldUpgrades(upgraded) {
|
|
3877
|
-
return Object.entries(upgraded).filter(([name,
|
|
3878
|
-
const ceiling = UNSUPPORTED_MAJOR[name];
|
|
3879
|
-
return ceiling !== void 0 && parseVersion2(to)[0] >= ceiling;
|
|
3880
|
-
}).map(([name]) => name).sort();
|
|
5954
|
+
return Object.entries(upgraded).filter(([name, range]) => name === "typescript" && !isSupportedTypeScriptRange(range)).map(([name]) => name);
|
|
3881
5955
|
}
|
|
3882
5956
|
var SEVERITY = { major: 0, minor: 1, patch: 2, other: 3 };
|
|
3883
5957
|
function buildRows(upgraded, currentDeps) {
|
|
@@ -3904,7 +5978,20 @@ function readDependencies(pkgPath) {
|
|
|
3904
5978
|
for (const [k, val] of Object.entries(v)) if (typeof val === "string") out2[k] = val;
|
|
3905
5979
|
return out2;
|
|
3906
5980
|
};
|
|
3907
|
-
|
|
5981
|
+
const fields = [
|
|
5982
|
+
pkg.peerDependencies,
|
|
5983
|
+
pkg.optionalDependencies,
|
|
5984
|
+
pkg.dependencies,
|
|
5985
|
+
pkg.devDependencies
|
|
5986
|
+
].map(merge);
|
|
5987
|
+
const merged = Object.assign({}, ...fields);
|
|
5988
|
+
for (const deps of fields) {
|
|
5989
|
+
if (typeof deps.typescript === "string" && !isSupportedTypeScriptRange(deps.typescript)) {
|
|
5990
|
+
merged.typescript = deps.typescript;
|
|
5991
|
+
break;
|
|
5992
|
+
}
|
|
5993
|
+
}
|
|
5994
|
+
return merged;
|
|
3908
5995
|
}
|
|
3909
5996
|
function serverDirs(root) {
|
|
3910
5997
|
const dirs = /* @__PURE__ */ new Set();
|
|
@@ -3945,7 +6032,7 @@ function rowLine(row) {
|
|
|
3945
6032
|
function noteWithheld(names) {
|
|
3946
6033
|
note(
|
|
3947
6034
|
names.map((n3) => `${dim("-")} ${n3}`).join("\n") + "\n\n" + dim(
|
|
3948
|
-
"Held back:
|
|
6035
|
+
"Held back: toiljs supports TypeScript 7 only. Compiler updates must stay within 7.x."
|
|
3949
6036
|
),
|
|
3950
6037
|
warn("Not upgraded")
|
|
3951
6038
|
);
|
|
@@ -3989,6 +6076,17 @@ async function runUpdate(opts) {
|
|
|
3989
6076
|
const upgraded = parseNcuJson(res.stdout);
|
|
3990
6077
|
const withheld = withheldUpgrades(upgraded);
|
|
3991
6078
|
for (const name of withheld) delete upgraded[name];
|
|
6079
|
+
if (!isSupportedTypeScriptRange(currentDeps.typescript ?? "") && !upgraded.typescript) {
|
|
6080
|
+
const versions = await capture("npm", ["view", "typescript@7", "version", "--json"], root);
|
|
6081
|
+
if (versions.code !== 0)
|
|
6082
|
+
throw new Error("Could not resolve a supported TypeScript 7 release.");
|
|
6083
|
+
const parsed = JSON.parse(versions.stdout);
|
|
6084
|
+
const candidates = typeof parsed === "string" ? [parsed] : Array.isArray(parsed) ? parsed : [];
|
|
6085
|
+
const latest = candidates.filter((v) => typeof v === "string").at(-1);
|
|
6086
|
+
if (!latest || !isSupportedTypeScriptRange(`^${latest}`))
|
|
6087
|
+
throw new Error("Registry returned no supported TypeScript 7 release.");
|
|
6088
|
+
upgraded.typescript = `^${latest}`;
|
|
6089
|
+
}
|
|
3992
6090
|
const rows = buildRows(upgraded, currentDeps);
|
|
3993
6091
|
if (rows.length === 0) {
|
|
3994
6092
|
s.stop("Everything is up to date");
|
|
@@ -4028,14 +6126,33 @@ async function runUpdate(opts) {
|
|
|
4028
6126
|
outro(dim("No packages selected."));
|
|
4029
6127
|
return;
|
|
4030
6128
|
}
|
|
6129
|
+
const pkg = JSON.parse(fs6.readFileSync(pkgPath, "utf8"));
|
|
6130
|
+
const targetTypeScript = selected.includes("typescript") ? upgraded.typescript : currentDeps.typescript;
|
|
6131
|
+
if (!targetTypeScript || !isSupportedTypeScriptRange(targetTypeScript)) {
|
|
6132
|
+
throw new Error("Select the TypeScript 7 migration before installing updates.");
|
|
6133
|
+
}
|
|
4031
6134
|
s.start("Updating package.json");
|
|
4032
|
-
const
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
6135
|
+
for (const name of selected) {
|
|
6136
|
+
let found = false;
|
|
6137
|
+
for (const field of [
|
|
6138
|
+
"dependencies",
|
|
6139
|
+
"devDependencies",
|
|
6140
|
+
"peerDependencies",
|
|
6141
|
+
"optionalDependencies"
|
|
6142
|
+
]) {
|
|
6143
|
+
const deps = pkg[field];
|
|
6144
|
+
if (deps && Object.hasOwn(deps, name)) {
|
|
6145
|
+
deps[name] = upgraded[name];
|
|
6146
|
+
found = true;
|
|
6147
|
+
}
|
|
6148
|
+
}
|
|
6149
|
+
if (!found) {
|
|
6150
|
+
const deps = pkg.devDependencies ?? {};
|
|
6151
|
+
deps[name] = upgraded[name];
|
|
6152
|
+
pkg.devDependencies = deps;
|
|
6153
|
+
}
|
|
6154
|
+
}
|
|
6155
|
+
fs6.writeFileSync(pkgPath, JSON.stringify(pkg, null, 4) + "\n");
|
|
4039
6156
|
s.stop("package.json updated");
|
|
4040
6157
|
note(dim(`Running ${pm.name} install\u2026`), "Install");
|
|
4041
6158
|
try {
|