@qwik.dev/core 0.0.0 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.wasm.cjs +484 -0
- package/bindings/qwik.wasm.mjs +477 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/build.d.ts +2 -0
- package/dist/build/index.cjs +35 -0
- package/dist/build/index.cjs.map +7 -0
- package/dist/build/index.d.ts +22 -0
- package/dist/build/index.dev.cjs +37 -0
- package/dist/build/index.dev.cjs.map +7 -0
- package/dist/build/index.dev.mjs +12 -0
- package/dist/build/index.dev.mjs.map +7 -0
- package/dist/build/index.mjs +12 -0
- package/dist/build/index.mjs.map +7 -0
- package/dist/build/index.prod.cjs +37 -0
- package/dist/build/index.prod.cjs.map +7 -0
- package/dist/build/index.prod.mjs +12 -0
- package/dist/build/index.prod.mjs.map +7 -0
- package/dist/build/package.json +8 -0
- package/dist/cli.cjs +4890 -0
- package/dist/core-internal.d.ts +3895 -0
- package/dist/core.cjs +10923 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.min.mjs +1 -0
- package/dist/core.mjs +10819 -0
- package/dist/core.mjs.map +1 -0
- package/dist/core.prod.cjs +5181 -0
- package/dist/core.prod.mjs +6025 -0
- package/dist/index.d.ts +2 -0
- package/dist/insights/index.d.ts +1 -0
- package/dist/insights/index.qwik.cjs +751 -0
- package/dist/insights/index.qwik.mjs +751 -0
- package/dist/insights/insights.d.ts +59 -0
- package/dist/insights/vite/index.cjs +82 -0
- package/dist/insights/vite/index.d.ts +1 -0
- package/dist/insights/vite/index.mjs +55 -0
- package/dist/insights/vite/insights-plugin.d.ts +10 -0
- package/dist/jsx-runtime/index.d.ts +2 -0
- package/dist/jsx-runtime.d.ts +2 -0
- package/dist/loader/index.cjs +4 -0
- package/dist/loader/index.d.ts +2 -0
- package/dist/loader/index.mjs +3 -0
- package/dist/loader/package.json +8 -0
- package/dist/optimizer.cjs +9145 -0
- package/dist/optimizer.d.ts +707 -0
- package/dist/optimizer.mjs +9709 -0
- package/dist/prefetch/index.cjs +4 -0
- package/dist/prefetch/index.d.ts +2 -0
- package/dist/prefetch/index.mjs +3 -0
- package/dist/prefetch/package.json +8 -0
- package/dist/qwik-prefetch.debug.js +244 -0
- package/dist/qwik-prefetch.js +1 -0
- package/dist/qwikloader.debug.js +228 -0
- package/dist/qwikloader.js +3 -0
- package/dist/server-modules.d.ts +38 -0
- package/dist/server.cjs +8942 -0
- package/dist/server.d.ts +404 -0
- package/dist/server.mjs +8877 -0
- package/dist/starters/adapters/aws-lambda/.eslintignore +2 -0
- package/dist/starters/adapters/aws-lambda/.prettierignore +2 -0
- package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/vite.config.mts +21 -0
- package/dist/starters/adapters/aws-lambda/gitignore +2 -0
- package/dist/starters/adapters/aws-lambda/package.json +23 -0
- package/dist/starters/adapters/aws-lambda/serverless.yml +31 -0
- package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +32 -0
- package/dist/starters/adapters/azure-swa/README.md +13 -0
- package/dist/starters/adapters/azure-swa/adapters/azure-swa/vite.config.mts +23 -0
- package/dist/starters/adapters/azure-swa/azure-functions/host.json +20 -0
- package/dist/starters/adapters/azure-swa/gitignore +3 -0
- package/dist/starters/adapters/azure-swa/package.json +28 -0
- package/dist/starters/adapters/azure-swa/public/staticwebapp.config.json +23 -0
- package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +22 -0
- package/dist/starters/adapters/azure-swa/swa-cli.config.json +11 -0
- package/dist/starters/adapters/bun/README.md +9 -0
- package/dist/starters/adapters/bun/adapters/bun/vite.config.mts +28 -0
- package/dist/starters/adapters/bun/package.json +27 -0
- package/dist/starters/adapters/bun/src/entry.bun.ts +46 -0
- package/dist/starters/adapters/cloud-run/Dockerfile +24 -0
- package/dist/starters/adapters/cloud-run/README.md +7 -0
- package/dist/starters/adapters/cloud-run/adapters/cloud-run/vite.config.mts +15 -0
- package/dist/starters/adapters/cloud-run/package.json +24 -0
- package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +96 -0
- package/dist/starters/adapters/cloudflare-pages/README.md +46 -0
- package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/vite.config.mts +15 -0
- package/dist/starters/adapters/cloudflare-pages/gitignore +2 -0
- package/dist/starters/adapters/cloudflare-pages/package.json +28 -0
- package/dist/starters/adapters/cloudflare-pages/public/_headers +9 -0
- package/dist/starters/adapters/cloudflare-pages/public/_redirects +1 -0
- package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +24 -0
- package/dist/starters/adapters/deno/README.md +9 -0
- package/dist/starters/adapters/deno/adapters/deno/vite.config.mts +23 -0
- package/dist/starters/adapters/deno/package.json +24 -0
- package/dist/starters/adapters/deno/src/entry.deno.ts +45 -0
- package/dist/starters/adapters/express/README.md +9 -0
- package/dist/starters/adapters/express/adapters/express/vite.config.mts +15 -0
- package/dist/starters/adapters/express/package.json +33 -0
- package/dist/starters/adapters/express/src/entry.express.tsx +70 -0
- package/dist/starters/adapters/fastify/README.md +9 -0
- package/dist/starters/adapters/fastify/adapters/fastify/vite.config.mts +15 -0
- package/dist/starters/adapters/fastify/package.json +33 -0
- package/dist/starters/adapters/fastify/src/entry.fastify.tsx +48 -0
- package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +42 -0
- package/dist/starters/adapters/firebase/.eslintignore +1 -0
- package/dist/starters/adapters/firebase/.prettierignore +1 -0
- package/dist/starters/adapters/firebase/adapters/firebase/vite.config.mts +21 -0
- package/dist/starters/adapters/firebase/firebase.json +24 -0
- package/dist/starters/adapters/firebase/functions/.gitkeep +0 -0
- package/dist/starters/adapters/firebase/functions/index.js +5 -0
- package/dist/starters/adapters/firebase/functions/package.json +25 -0
- package/dist/starters/adapters/firebase/gitignore +3 -0
- package/dist/starters/adapters/firebase/package.json +24 -0
- package/dist/starters/adapters/firebase/src/entry-firebase.tsx +22 -0
- package/dist/starters/adapters/netlify-edge/README.md +64 -0
- package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/vite.config.mts +16 -0
- package/dist/starters/adapters/netlify-edge/gitignore +2 -0
- package/dist/starters/adapters/netlify-edge/netlify.toml +3 -0
- package/dist/starters/adapters/netlify-edge/package.json +29 -0
- package/dist/starters/adapters/netlify-edge/public/_headers +2 -0
- package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +22 -0
- package/dist/starters/adapters/node-server/README.md +12 -0
- package/dist/starters/adapters/node-server/adapters/node-server/vite.config.mts +15 -0
- package/dist/starters/adapters/node-server/package.json +23 -0
- package/dist/starters/adapters/node-server/src/entry.node-server.tsx +39 -0
- package/dist/starters/adapters/static/README.md +5 -0
- package/dist/starters/adapters/static/adapters/static/vite.config.mts +19 -0
- package/dist/starters/adapters/static/package.json +19 -0
- package/dist/starters/adapters/vercel-edge/README.md +43 -0
- package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/vite.config.mts +16 -0
- package/dist/starters/adapters/vercel-edge/gitignore +2 -0
- package/dist/starters/adapters/vercel-edge/package.json +28 -0
- package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +22 -0
- package/dist/starters/adapters/vercel-edge/vercel.json +22 -0
- package/dist/starters/features/auth/package.json +20 -0
- package/dist/starters/features/auth/src/routes/plugin@auth.ts +8 -0
- package/dist/starters/features/bootstrap/package.json +33 -0
- package/dist/starters/features/bootstrap/src/components/bootstrap/alert.tsx +8 -0
- package/dist/starters/features/bootstrap/src/components/bootstrap/button.tsx +8 -0
- package/dist/starters/features/bootstrap/src/components/bootstrap/index.ts +4 -0
- package/dist/starters/features/bootstrap/src/components/bootstrap/navbar.tsx +44 -0
- package/dist/starters/features/bootstrap/src/components/bootstrap/spinner.tsx +13 -0
- package/dist/starters/features/bootstrap/src/constants/data.ts +10 -0
- package/dist/starters/features/bootstrap/src/models/bootstrap.ts +8 -0
- package/dist/starters/features/bootstrap/src/routes/bootstrap/alerts/index.tsx +28 -0
- package/dist/starters/features/bootstrap/src/routes/bootstrap/buttons/index.tsx +32 -0
- package/dist/starters/features/bootstrap/src/routes/bootstrap/index.tsx +32 -0
- package/dist/starters/features/bootstrap/src/routes/bootstrap/layout.tsx +36 -0
- package/dist/starters/features/bootstrap/src/routes/bootstrap/spinners/index.tsx +45 -0
- package/dist/starters/features/builder.io/README.md +15 -0
- package/dist/starters/features/builder.io/package.json +27 -0
- package/dist/starters/features/builder.io/src/components/builder-registry.ts +25 -0
- package/dist/starters/features/builder.io/src/components/counter/counter.module.css +23 -0
- package/dist/starters/features/builder.io/src/components/counter/counter.tsx +81 -0
- package/dist/starters/features/builder.io/src/components/gauge/gauge.module.css +27 -0
- package/dist/starters/features/builder.io/src/components/gauge/index.tsx +38 -0
- package/dist/starters/features/builder.io/src/routes/[...index]/index.tsx +44 -0
- package/dist/starters/features/cypress/cypress/fixtures/example.json +5 -0
- package/dist/starters/features/cypress/cypress/support/commands.ts +37 -0
- package/dist/starters/features/cypress/cypress/support/component-index.html +12 -0
- package/dist/starters/features/cypress/cypress/support/component.ts +42 -0
- package/dist/starters/features/cypress/cypress/tsconfig.cy.json +17 -0
- package/dist/starters/features/cypress/cypress.config.ts +10 -0
- package/dist/starters/features/cypress/cypress.d.ts +14 -0
- package/dist/starters/features/cypress/package.json +28 -0
- package/dist/starters/features/cypress/src/components/example/example.cy.tsx +18 -0
- package/dist/starters/features/cypress/src/components/example/example.tsx +17 -0
- package/dist/starters/features/drizzle/drizzle/db/.gitkeep +0 -0
- package/dist/starters/features/drizzle/drizzle/migrations/.gitkeep +0 -0
- package/dist/starters/features/drizzle/drizzle/schema.ts +24 -0
- package/dist/starters/features/drizzle/drizzle.config.ts +9 -0
- package/dist/starters/features/drizzle/package.json +41 -0
- package/dist/starters/features/drizzle/src/routes/create/index.tsx +42 -0
- package/dist/starters/features/drizzle/src/routes/users/[userId]/index.tsx +36 -0
- package/dist/starters/features/drizzle/src/routes/users/index.tsx +30 -0
- package/dist/starters/features/leaflet-map/package.json +30 -0
- package/dist/starters/features/leaflet-map/src/components/leaflet-map/index.tsx +60 -0
- package/dist/starters/features/leaflet-map/src/helpers/boundary-box.tsx +6 -0
- package/dist/starters/features/leaflet-map/src/models/location.ts +9 -0
- package/dist/starters/features/leaflet-map/src/models/map.ts +7 -0
- package/dist/starters/features/leaflet-map/src/routes/basic-map/index.tsx +25 -0
- package/dist/starters/features/localize/package.json +37 -0
- package/dist/starters/features/localize/src/entry.ssr.tsx +32 -0
- package/dist/starters/features/localize/src/locales/message.en.json +8 -0
- package/dist/starters/features/localize/src/locales/message.it.json +8 -0
- package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +94 -0
- package/dist/starters/features/localize/src/routes/[locale]/index.tsx +52 -0
- package/dist/starters/features/localize/src/routes/[locale]/layout.tsx +12 -0
- package/dist/starters/features/orama/package.json +23 -0
- package/dist/starters/features/orama/src/orama/index.ts +41 -0
- package/dist/starters/features/orama/src/routes/orama/index.tsx +110 -0
- package/dist/starters/features/pandacss/.eslintignore +3 -0
- package/dist/starters/features/pandacss/.prettierignore +2 -0
- package/dist/starters/features/pandacss/gitignore +2 -0
- package/dist/starters/features/pandacss/package.json +31 -0
- package/dist/starters/features/pandacss/panda.config.ts +22 -0
- package/dist/starters/features/pandacss/postcss.config.js +5 -0
- package/dist/starters/features/pandacss/src/global.css +5 -0
- package/dist/starters/features/pandacss/src/routes/pandacss/index.tsx +18 -0
- package/dist/starters/features/partytown/package.json +41 -0
- package/dist/starters/features/partytown/src/components/partytown/partytown.tsx +19 -0
- package/dist/starters/features/playwright/package.json +18 -0
- package/dist/starters/features/playwright/playwright-report/index.html +22024 -0
- package/dist/starters/features/playwright/playwright.config.ts +40 -0
- package/dist/starters/features/playwright/tests/example.spec.ts +14 -0
- package/dist/starters/features/postcss/.vscode/settings.json +3 -0
- package/dist/starters/features/postcss/package.json +17 -0
- package/dist/starters/features/postcss/postcss.config.js +11 -0
- package/dist/starters/features/prisma/package.json +35 -0
- package/dist/starters/features/prisma/prisma/schema.prisma +17 -0
- package/dist/starters/features/prisma/src/routes/create/index.tsx +42 -0
- package/dist/starters/features/prisma/src/routes/users/[userId]/index.tsx +31 -0
- package/dist/starters/features/prisma/src/routes/users/index.tsx +27 -0
- package/dist/starters/features/react/package.json +41 -0
- package/dist/starters/features/react/src/integrations/react/mui.tsx +60 -0
- package/dist/starters/features/react/src/routes/react/index.tsx +45 -0
- package/dist/starters/features/storybook/.storybook/main.ts +22 -0
- package/dist/starters/features/storybook/.storybook/preview-head.html +3 -0
- package/dist/starters/features/storybook/.storybook/preview.tsx +19 -0
- package/dist/starters/features/storybook/.storybook/tsconfig.json +24 -0
- package/dist/starters/features/storybook/package.json +25 -0
- package/dist/starters/features/storybook/src/components/button/button.stories.tsx +17 -0
- package/dist/starters/features/storybook/src/components/button/button.tsx +27 -0
- package/dist/starters/features/styled-vanilla-extract/package.json +28 -0
- package/dist/starters/features/styled-vanilla-extract/src/routes/styled-flower/flower.css.ts +83 -0
- package/dist/starters/features/styled-vanilla-extract/src/routes/styled-flower/index.tsx +75 -0
- package/dist/starters/features/tailwind/.prettierrc.js +3 -0
- package/dist/starters/features/tailwind/.vscode/settings.json +3 -0
- package/dist/starters/features/tailwind/package.json +18 -0
- package/dist/starters/features/tailwind/postcss.config.cjs +6 -0
- package/dist/starters/features/tailwind/src/global.css +7 -0
- package/dist/starters/features/tailwind/tailwind.config.js +8 -0
- package/dist/starters/features/turso/.env.local +2 -0
- package/dist/starters/features/turso/package.json +30 -0
- package/dist/starters/features/turso/src/utils/turso.ts +21 -0
- package/dist/starters/features/vitest/package.json +20 -0
- package/dist/starters/features/vitest/src/components/example/example.spec.tsx +32 -0
- package/dist/starters/features/vitest/src/components/example/example.tsx +17 -0
- package/dist/templates/barrel/component/index.tsx.template +13 -0
- package/dist/templates/barrel/markdown/index.md.template +5 -0
- package/dist/templates/barrel/mdx/index.mdx.template +5 -0
- package/dist/templates/barrel/route/index.tsx.template +9 -0
- package/dist/templates/qwik/component/[slug].tsx.template +13 -0
- package/dist/templates/qwik/markdown/index.md.template +5 -0
- package/dist/templates/qwik/mdx/index.mdx.template +5 -0
- package/dist/templates/qwik/route/index.tsx.template +9 -0
- package/dist/testing/index.cjs +32425 -0
- package/dist/testing/index.d.ts +140 -0
- package/dist/testing/index.mjs +32389 -0
- package/dist/testing/package.json +9 -0
- package/jsx-dev-runtime.d.ts +2 -0
- package/jsx-runtime.d.ts +2 -0
- package/loader.d.ts +2 -0
- package/optimizer.d.ts +2 -0
- package/package.json +20 -12
- package/public.d.ts +68 -0
- package/qwik-cli.cjs +4 -0
- package/server.d.ts +15 -0
- package/testing.d.ts +2 -0
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,4890 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* @qwik.dev/core/cli 2.0.0-alpha.0-dev+dd93926
|
|
4
|
+
* Copyright QwikDev. All Rights Reserved.
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
|
|
7
|
+
*/
|
|
8
|
+
"use strict";
|
|
9
|
+
var __create = Object.create;
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
14
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
16
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
+
};
|
|
18
|
+
var __export = (target, all) => {
|
|
19
|
+
for (var name in all)
|
|
20
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
21
|
+
};
|
|
22
|
+
var __copyProps = (to, from, except, desc) => {
|
|
23
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
+
for (let key of __getOwnPropNames(from))
|
|
25
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
26
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
27
|
+
}
|
|
28
|
+
return to;
|
|
29
|
+
};
|
|
30
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
31
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
32
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
33
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
34
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
35
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
36
|
+
mod
|
|
37
|
+
));
|
|
38
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
|
+
|
|
40
|
+
// node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
41
|
+
var require_src = __commonJS({
|
|
42
|
+
"node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports2, module2) {
|
|
43
|
+
"use strict";
|
|
44
|
+
var ESC = "\x1B";
|
|
45
|
+
var CSI = `${ESC}[`;
|
|
46
|
+
var beep = "\x07";
|
|
47
|
+
var cursor = {
|
|
48
|
+
to(x3, y3) {
|
|
49
|
+
if (!y3) return `${CSI}${x3 + 1}G`;
|
|
50
|
+
return `${CSI}${y3 + 1};${x3 + 1}H`;
|
|
51
|
+
},
|
|
52
|
+
move(x3, y3) {
|
|
53
|
+
let ret = "";
|
|
54
|
+
if (x3 < 0) ret += `${CSI}${-x3}D`;
|
|
55
|
+
else if (x3 > 0) ret += `${CSI}${x3}C`;
|
|
56
|
+
if (y3 < 0) ret += `${CSI}${-y3}A`;
|
|
57
|
+
else if (y3 > 0) ret += `${CSI}${y3}B`;
|
|
58
|
+
return ret;
|
|
59
|
+
},
|
|
60
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
61
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
62
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
63
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
64
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
65
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
66
|
+
left: `${CSI}G`,
|
|
67
|
+
hide: `${CSI}?25l`,
|
|
68
|
+
show: `${CSI}?25h`,
|
|
69
|
+
save: `${ESC}7`,
|
|
70
|
+
restore: `${ESC}8`
|
|
71
|
+
};
|
|
72
|
+
var scroll = {
|
|
73
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
74
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
75
|
+
};
|
|
76
|
+
var erase = {
|
|
77
|
+
screen: `${CSI}2J`,
|
|
78
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
79
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
80
|
+
line: `${CSI}2K`,
|
|
81
|
+
lineEnd: `${CSI}K`,
|
|
82
|
+
lineStart: `${CSI}1K`,
|
|
83
|
+
lines(count) {
|
|
84
|
+
let clear = "";
|
|
85
|
+
for (let i = 0; i < count; i++)
|
|
86
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
87
|
+
if (count)
|
|
88
|
+
clear += cursor.left;
|
|
89
|
+
return clear;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
module2.exports = { cursor, scroll, erase, beep };
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js
|
|
97
|
+
var require_picocolors = __commonJS({
|
|
98
|
+
"node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js"(exports2, module2) {
|
|
99
|
+
var argv = process.argv || [];
|
|
100
|
+
var env = process.env;
|
|
101
|
+
var isColorSupported = !("NO_COLOR" in env || argv.includes("--no-color")) && ("FORCE_COLOR" in env || argv.includes("--color") || process.platform === "win32" || require != null && require("tty").isatty(1) && env.TERM !== "dumb" || "CI" in env);
|
|
102
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
103
|
+
let string = "" + input;
|
|
104
|
+
let index = string.indexOf(close, open.length);
|
|
105
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
106
|
+
};
|
|
107
|
+
var replaceClose = (string, close, replace, index) => {
|
|
108
|
+
let result = "";
|
|
109
|
+
let cursor = 0;
|
|
110
|
+
do {
|
|
111
|
+
result += string.substring(cursor, index) + replace;
|
|
112
|
+
cursor = index + close.length;
|
|
113
|
+
index = string.indexOf(close, cursor);
|
|
114
|
+
} while (~index);
|
|
115
|
+
return result + string.substring(cursor);
|
|
116
|
+
};
|
|
117
|
+
var createColors = (enabled = isColorSupported) => {
|
|
118
|
+
let init2 = enabled ? formatter : () => String;
|
|
119
|
+
return {
|
|
120
|
+
isColorSupported: enabled,
|
|
121
|
+
reset: init2("\x1B[0m", "\x1B[0m"),
|
|
122
|
+
bold: init2("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
123
|
+
dim: init2("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
124
|
+
italic: init2("\x1B[3m", "\x1B[23m"),
|
|
125
|
+
underline: init2("\x1B[4m", "\x1B[24m"),
|
|
126
|
+
inverse: init2("\x1B[7m", "\x1B[27m"),
|
|
127
|
+
hidden: init2("\x1B[8m", "\x1B[28m"),
|
|
128
|
+
strikethrough: init2("\x1B[9m", "\x1B[29m"),
|
|
129
|
+
black: init2("\x1B[30m", "\x1B[39m"),
|
|
130
|
+
red: init2("\x1B[31m", "\x1B[39m"),
|
|
131
|
+
green: init2("\x1B[32m", "\x1B[39m"),
|
|
132
|
+
yellow: init2("\x1B[33m", "\x1B[39m"),
|
|
133
|
+
blue: init2("\x1B[34m", "\x1B[39m"),
|
|
134
|
+
magenta: init2("\x1B[35m", "\x1B[39m"),
|
|
135
|
+
cyan: init2("\x1B[36m", "\x1B[39m"),
|
|
136
|
+
white: init2("\x1B[37m", "\x1B[39m"),
|
|
137
|
+
gray: init2("\x1B[90m", "\x1B[39m"),
|
|
138
|
+
bgBlack: init2("\x1B[40m", "\x1B[49m"),
|
|
139
|
+
bgRed: init2("\x1B[41m", "\x1B[49m"),
|
|
140
|
+
bgGreen: init2("\x1B[42m", "\x1B[49m"),
|
|
141
|
+
bgYellow: init2("\x1B[43m", "\x1B[49m"),
|
|
142
|
+
bgBlue: init2("\x1B[44m", "\x1B[49m"),
|
|
143
|
+
bgMagenta: init2("\x1B[45m", "\x1B[49m"),
|
|
144
|
+
bgCyan: init2("\x1B[46m", "\x1B[49m"),
|
|
145
|
+
bgWhite: init2("\x1B[47m", "\x1B[49m")
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
module2.exports = createColors();
|
|
149
|
+
module2.exports.createColors = createColors;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// node_modules/.pnpm/which-pm-runs@1.1.0/node_modules/which-pm-runs/index.js
|
|
154
|
+
var require_which_pm_runs = __commonJS({
|
|
155
|
+
"node_modules/.pnpm/which-pm-runs@1.1.0/node_modules/which-pm-runs/index.js"(exports2, module2) {
|
|
156
|
+
"use strict";
|
|
157
|
+
module2.exports = function() {
|
|
158
|
+
if (!process.env.npm_config_user_agent) {
|
|
159
|
+
return void 0;
|
|
160
|
+
}
|
|
161
|
+
return pmFromUserAgent(process.env.npm_config_user_agent);
|
|
162
|
+
};
|
|
163
|
+
function pmFromUserAgent(userAgent) {
|
|
164
|
+
const pmSpec = userAgent.split(" ")[0];
|
|
165
|
+
const separatorPos = pmSpec.lastIndexOf("/");
|
|
166
|
+
const name = pmSpec.substring(0, separatorPos);
|
|
167
|
+
return {
|
|
168
|
+
name: name === "npminstall" ? "cnpm" : name,
|
|
169
|
+
version: pmSpec.substring(separatorPos + 1)
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
176
|
+
var require_windows = __commonJS({
|
|
177
|
+
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports2, module2) {
|
|
178
|
+
module2.exports = isexe;
|
|
179
|
+
isexe.sync = sync;
|
|
180
|
+
var fs8 = require("fs");
|
|
181
|
+
function checkPathExt(path3, options) {
|
|
182
|
+
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
183
|
+
if (!pathext) {
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
pathext = pathext.split(";");
|
|
187
|
+
if (pathext.indexOf("") !== -1) {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
for (var i = 0; i < pathext.length; i++) {
|
|
191
|
+
var p = pathext[i].toLowerCase();
|
|
192
|
+
if (p && path3.substr(-p.length).toLowerCase() === p) {
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
function checkStat(stat, path3, options) {
|
|
199
|
+
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
return checkPathExt(path3, options);
|
|
203
|
+
}
|
|
204
|
+
function isexe(path3, options, cb) {
|
|
205
|
+
fs8.stat(path3, function(er, stat) {
|
|
206
|
+
cb(er, er ? false : checkStat(stat, path3, options));
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function sync(path3, options) {
|
|
210
|
+
return checkStat(fs8.statSync(path3), path3, options);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
216
|
+
var require_mode = __commonJS({
|
|
217
|
+
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports2, module2) {
|
|
218
|
+
module2.exports = isexe;
|
|
219
|
+
isexe.sync = sync;
|
|
220
|
+
var fs8 = require("fs");
|
|
221
|
+
function isexe(path3, options, cb) {
|
|
222
|
+
fs8.stat(path3, function(er, stat) {
|
|
223
|
+
cb(er, er ? false : checkStat(stat, options));
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function sync(path3, options) {
|
|
227
|
+
return checkStat(fs8.statSync(path3), options);
|
|
228
|
+
}
|
|
229
|
+
function checkStat(stat, options) {
|
|
230
|
+
return stat.isFile() && checkMode(stat, options);
|
|
231
|
+
}
|
|
232
|
+
function checkMode(stat, options) {
|
|
233
|
+
var mod = stat.mode;
|
|
234
|
+
var uid = stat.uid;
|
|
235
|
+
var gid = stat.gid;
|
|
236
|
+
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
237
|
+
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
238
|
+
var u = parseInt("100", 8);
|
|
239
|
+
var g2 = parseInt("010", 8);
|
|
240
|
+
var o2 = parseInt("001", 8);
|
|
241
|
+
var ug = u | g2;
|
|
242
|
+
var ret = mod & o2 || mod & g2 && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
243
|
+
return ret;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
249
|
+
var require_isexe = __commonJS({
|
|
250
|
+
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports2, module2) {
|
|
251
|
+
var fs8 = require("fs");
|
|
252
|
+
var core;
|
|
253
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
254
|
+
core = require_windows();
|
|
255
|
+
} else {
|
|
256
|
+
core = require_mode();
|
|
257
|
+
}
|
|
258
|
+
module2.exports = isexe;
|
|
259
|
+
isexe.sync = sync;
|
|
260
|
+
function isexe(path3, options, cb) {
|
|
261
|
+
if (typeof options === "function") {
|
|
262
|
+
cb = options;
|
|
263
|
+
options = {};
|
|
264
|
+
}
|
|
265
|
+
if (!cb) {
|
|
266
|
+
if (typeof Promise !== "function") {
|
|
267
|
+
throw new TypeError("callback not provided");
|
|
268
|
+
}
|
|
269
|
+
return new Promise(function(resolve2, reject) {
|
|
270
|
+
isexe(path3, options || {}, function(er, is) {
|
|
271
|
+
if (er) {
|
|
272
|
+
reject(er);
|
|
273
|
+
} else {
|
|
274
|
+
resolve2(is);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
core(path3, options || {}, function(er, is) {
|
|
280
|
+
if (er) {
|
|
281
|
+
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
282
|
+
er = null;
|
|
283
|
+
is = false;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
cb(er, is);
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
function sync(path3, options) {
|
|
290
|
+
try {
|
|
291
|
+
return core.sync(path3, options || {});
|
|
292
|
+
} catch (er) {
|
|
293
|
+
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
294
|
+
return false;
|
|
295
|
+
} else {
|
|
296
|
+
throw er;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
304
|
+
var require_which = __commonJS({
|
|
305
|
+
"node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports2, module2) {
|
|
306
|
+
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
307
|
+
var path3 = require("path");
|
|
308
|
+
var COLON = isWindows ? ";" : ":";
|
|
309
|
+
var isexe = require_isexe();
|
|
310
|
+
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
311
|
+
var getPathInfo = (cmd, opt) => {
|
|
312
|
+
const colon = opt.colon || COLON;
|
|
313
|
+
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
|
|
314
|
+
// windows always checks the cwd first
|
|
315
|
+
...isWindows ? [process.cwd()] : [],
|
|
316
|
+
...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
|
|
317
|
+
"").split(colon)
|
|
318
|
+
];
|
|
319
|
+
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
320
|
+
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
321
|
+
if (isWindows) {
|
|
322
|
+
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
|
|
323
|
+
pathExt.unshift("");
|
|
324
|
+
}
|
|
325
|
+
return {
|
|
326
|
+
pathEnv,
|
|
327
|
+
pathExt,
|
|
328
|
+
pathExtExe
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
var which = (cmd, opt, cb) => {
|
|
332
|
+
if (typeof opt === "function") {
|
|
333
|
+
cb = opt;
|
|
334
|
+
opt = {};
|
|
335
|
+
}
|
|
336
|
+
if (!opt)
|
|
337
|
+
opt = {};
|
|
338
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
339
|
+
const found = [];
|
|
340
|
+
const step = (i) => new Promise((resolve2, reject) => {
|
|
341
|
+
if (i === pathEnv.length)
|
|
342
|
+
return opt.all && found.length ? resolve2(found) : reject(getNotFoundError(cmd));
|
|
343
|
+
const ppRaw = pathEnv[i];
|
|
344
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
345
|
+
const pCmd = path3.join(pathPart, cmd);
|
|
346
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
347
|
+
resolve2(subStep(p, i, 0));
|
|
348
|
+
});
|
|
349
|
+
const subStep = (p, i, ii) => new Promise((resolve2, reject) => {
|
|
350
|
+
if (ii === pathExt.length)
|
|
351
|
+
return resolve2(step(i + 1));
|
|
352
|
+
const ext = pathExt[ii];
|
|
353
|
+
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
354
|
+
if (!er && is) {
|
|
355
|
+
if (opt.all)
|
|
356
|
+
found.push(p + ext);
|
|
357
|
+
else
|
|
358
|
+
return resolve2(p + ext);
|
|
359
|
+
}
|
|
360
|
+
return resolve2(subStep(p, i, ii + 1));
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
364
|
+
};
|
|
365
|
+
var whichSync = (cmd, opt) => {
|
|
366
|
+
opt = opt || {};
|
|
367
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
368
|
+
const found = [];
|
|
369
|
+
for (let i = 0; i < pathEnv.length; i++) {
|
|
370
|
+
const ppRaw = pathEnv[i];
|
|
371
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
372
|
+
const pCmd = path3.join(pathPart, cmd);
|
|
373
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
374
|
+
for (let j2 = 0; j2 < pathExt.length; j2++) {
|
|
375
|
+
const cur = p + pathExt[j2];
|
|
376
|
+
try {
|
|
377
|
+
const is = isexe.sync(cur, { pathExt: pathExtExe });
|
|
378
|
+
if (is) {
|
|
379
|
+
if (opt.all)
|
|
380
|
+
found.push(cur);
|
|
381
|
+
else
|
|
382
|
+
return cur;
|
|
383
|
+
}
|
|
384
|
+
} catch (ex) {
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (opt.all && found.length)
|
|
389
|
+
return found;
|
|
390
|
+
if (opt.nothrow)
|
|
391
|
+
return null;
|
|
392
|
+
throw getNotFoundError(cmd);
|
|
393
|
+
};
|
|
394
|
+
module2.exports = which;
|
|
395
|
+
which.sync = whichSync;
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
// node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
400
|
+
var require_path_key = __commonJS({
|
|
401
|
+
"node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports2, module2) {
|
|
402
|
+
"use strict";
|
|
403
|
+
var pathKey2 = (options = {}) => {
|
|
404
|
+
const environment = options.env || process.env;
|
|
405
|
+
const platform = options.platform || process.platform;
|
|
406
|
+
if (platform !== "win32") {
|
|
407
|
+
return "PATH";
|
|
408
|
+
}
|
|
409
|
+
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
410
|
+
};
|
|
411
|
+
module2.exports = pathKey2;
|
|
412
|
+
module2.exports.default = pathKey2;
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
417
|
+
var require_resolveCommand = __commonJS({
|
|
418
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
|
|
419
|
+
"use strict";
|
|
420
|
+
var path3 = require("path");
|
|
421
|
+
var which = require_which();
|
|
422
|
+
var getPathKey = require_path_key();
|
|
423
|
+
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
424
|
+
const env = parsed.options.env || process.env;
|
|
425
|
+
const cwd = process.cwd();
|
|
426
|
+
const hasCustomCwd = parsed.options.cwd != null;
|
|
427
|
+
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
428
|
+
if (shouldSwitchCwd) {
|
|
429
|
+
try {
|
|
430
|
+
process.chdir(parsed.options.cwd);
|
|
431
|
+
} catch (err) {
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
let resolved;
|
|
435
|
+
try {
|
|
436
|
+
resolved = which.sync(parsed.command, {
|
|
437
|
+
path: env[getPathKey({ env })],
|
|
438
|
+
pathExt: withoutPathExt ? path3.delimiter : void 0
|
|
439
|
+
});
|
|
440
|
+
} catch (e2) {
|
|
441
|
+
} finally {
|
|
442
|
+
if (shouldSwitchCwd) {
|
|
443
|
+
process.chdir(cwd);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
if (resolved) {
|
|
447
|
+
resolved = path3.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
448
|
+
}
|
|
449
|
+
return resolved;
|
|
450
|
+
}
|
|
451
|
+
function resolveCommand(parsed) {
|
|
452
|
+
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
453
|
+
}
|
|
454
|
+
module2.exports = resolveCommand;
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/escape.js
|
|
459
|
+
var require_escape = __commonJS({
|
|
460
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/escape.js"(exports2, module2) {
|
|
461
|
+
"use strict";
|
|
462
|
+
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
463
|
+
function escapeCommand(arg) {
|
|
464
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
465
|
+
return arg;
|
|
466
|
+
}
|
|
467
|
+
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
468
|
+
arg = `${arg}`;
|
|
469
|
+
arg = arg.replace(/(\\*)"/g, '$1$1\\"');
|
|
470
|
+
arg = arg.replace(/(\\*)$/, "$1$1");
|
|
471
|
+
arg = `"${arg}"`;
|
|
472
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
473
|
+
if (doubleEscapeMetaChars) {
|
|
474
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
475
|
+
}
|
|
476
|
+
return arg;
|
|
477
|
+
}
|
|
478
|
+
module2.exports.command = escapeCommand;
|
|
479
|
+
module2.exports.argument = escapeArgument;
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
// node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
|
|
484
|
+
var require_shebang_regex = __commonJS({
|
|
485
|
+
"node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports2, module2) {
|
|
486
|
+
"use strict";
|
|
487
|
+
module2.exports = /^#!(.*)/;
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
// node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
|
|
492
|
+
var require_shebang_command = __commonJS({
|
|
493
|
+
"node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports2, module2) {
|
|
494
|
+
"use strict";
|
|
495
|
+
var shebangRegex = require_shebang_regex();
|
|
496
|
+
module2.exports = (string = "") => {
|
|
497
|
+
const match = string.match(shebangRegex);
|
|
498
|
+
if (!match) {
|
|
499
|
+
return null;
|
|
500
|
+
}
|
|
501
|
+
const [path3, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
502
|
+
const binary = path3.split("/").pop();
|
|
503
|
+
if (binary === "env") {
|
|
504
|
+
return argument;
|
|
505
|
+
}
|
|
506
|
+
return argument ? `${binary} ${argument}` : binary;
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js
|
|
512
|
+
var require_readShebang = __commonJS({
|
|
513
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
|
|
514
|
+
"use strict";
|
|
515
|
+
var fs8 = require("fs");
|
|
516
|
+
var shebangCommand = require_shebang_command();
|
|
517
|
+
function readShebang(command) {
|
|
518
|
+
const size = 150;
|
|
519
|
+
const buffer = Buffer.alloc(size);
|
|
520
|
+
let fd;
|
|
521
|
+
try {
|
|
522
|
+
fd = fs8.openSync(command, "r");
|
|
523
|
+
fs8.readSync(fd, buffer, 0, size, 0);
|
|
524
|
+
fs8.closeSync(fd);
|
|
525
|
+
} catch (e2) {
|
|
526
|
+
}
|
|
527
|
+
return shebangCommand(buffer.toString());
|
|
528
|
+
}
|
|
529
|
+
module2.exports = readShebang;
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js
|
|
534
|
+
var require_parse = __commonJS({
|
|
535
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
|
|
536
|
+
"use strict";
|
|
537
|
+
var path3 = require("path");
|
|
538
|
+
var resolveCommand = require_resolveCommand();
|
|
539
|
+
var escape = require_escape();
|
|
540
|
+
var readShebang = require_readShebang();
|
|
541
|
+
var isWin = process.platform === "win32";
|
|
542
|
+
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
543
|
+
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
544
|
+
function detectShebang(parsed) {
|
|
545
|
+
parsed.file = resolveCommand(parsed);
|
|
546
|
+
const shebang = parsed.file && readShebang(parsed.file);
|
|
547
|
+
if (shebang) {
|
|
548
|
+
parsed.args.unshift(parsed.file);
|
|
549
|
+
parsed.command = shebang;
|
|
550
|
+
return resolveCommand(parsed);
|
|
551
|
+
}
|
|
552
|
+
return parsed.file;
|
|
553
|
+
}
|
|
554
|
+
function parseNonShell(parsed) {
|
|
555
|
+
if (!isWin) {
|
|
556
|
+
return parsed;
|
|
557
|
+
}
|
|
558
|
+
const commandFile = detectShebang(parsed);
|
|
559
|
+
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
560
|
+
if (parsed.options.forceShell || needsShell) {
|
|
561
|
+
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
562
|
+
parsed.command = path3.normalize(parsed.command);
|
|
563
|
+
parsed.command = escape.command(parsed.command);
|
|
564
|
+
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
565
|
+
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
566
|
+
parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
|
|
567
|
+
parsed.command = process.env.comspec || "cmd.exe";
|
|
568
|
+
parsed.options.windowsVerbatimArguments = true;
|
|
569
|
+
}
|
|
570
|
+
return parsed;
|
|
571
|
+
}
|
|
572
|
+
function parse(command, args, options) {
|
|
573
|
+
if (args && !Array.isArray(args)) {
|
|
574
|
+
options = args;
|
|
575
|
+
args = null;
|
|
576
|
+
}
|
|
577
|
+
args = args ? args.slice(0) : [];
|
|
578
|
+
options = Object.assign({}, options);
|
|
579
|
+
const parsed = {
|
|
580
|
+
command,
|
|
581
|
+
args,
|
|
582
|
+
options,
|
|
583
|
+
file: void 0,
|
|
584
|
+
original: {
|
|
585
|
+
command,
|
|
586
|
+
args
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
return options.shell ? parsed : parseNonShell(parsed);
|
|
590
|
+
}
|
|
591
|
+
module2.exports = parse;
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/enoent.js
|
|
596
|
+
var require_enoent = __commonJS({
|
|
597
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/enoent.js"(exports2, module2) {
|
|
598
|
+
"use strict";
|
|
599
|
+
var isWin = process.platform === "win32";
|
|
600
|
+
function notFoundError(original, syscall) {
|
|
601
|
+
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
602
|
+
code: "ENOENT",
|
|
603
|
+
errno: "ENOENT",
|
|
604
|
+
syscall: `${syscall} ${original.command}`,
|
|
605
|
+
path: original.command,
|
|
606
|
+
spawnargs: original.args
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
function hookChildProcess(cp, parsed) {
|
|
610
|
+
if (!isWin) {
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
const originalEmit = cp.emit;
|
|
614
|
+
cp.emit = function(name, arg1) {
|
|
615
|
+
if (name === "exit") {
|
|
616
|
+
const err = verifyENOENT(arg1, parsed, "spawn");
|
|
617
|
+
if (err) {
|
|
618
|
+
return originalEmit.call(cp, "error", err);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return originalEmit.apply(cp, arguments);
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
function verifyENOENT(status, parsed) {
|
|
625
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
626
|
+
return notFoundError(parsed.original, "spawn");
|
|
627
|
+
}
|
|
628
|
+
return null;
|
|
629
|
+
}
|
|
630
|
+
function verifyENOENTSync(status, parsed) {
|
|
631
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
632
|
+
return notFoundError(parsed.original, "spawnSync");
|
|
633
|
+
}
|
|
634
|
+
return null;
|
|
635
|
+
}
|
|
636
|
+
module2.exports = {
|
|
637
|
+
hookChildProcess,
|
|
638
|
+
verifyENOENT,
|
|
639
|
+
verifyENOENTSync,
|
|
640
|
+
notFoundError
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/index.js
|
|
646
|
+
var require_cross_spawn = __commonJS({
|
|
647
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/index.js"(exports2, module2) {
|
|
648
|
+
"use strict";
|
|
649
|
+
var cp = require("child_process");
|
|
650
|
+
var parse = require_parse();
|
|
651
|
+
var enoent = require_enoent();
|
|
652
|
+
function spawn2(command, args, options) {
|
|
653
|
+
const parsed = parse(command, args, options);
|
|
654
|
+
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
655
|
+
enoent.hookChildProcess(spawned, parsed);
|
|
656
|
+
return spawned;
|
|
657
|
+
}
|
|
658
|
+
function spawnSync(command, args, options) {
|
|
659
|
+
const parsed = parse(command, args, options);
|
|
660
|
+
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
661
|
+
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
662
|
+
return result;
|
|
663
|
+
}
|
|
664
|
+
module2.exports = spawn2;
|
|
665
|
+
module2.exports.spawn = spawn2;
|
|
666
|
+
module2.exports.sync = spawnSync;
|
|
667
|
+
module2.exports._parse = parse;
|
|
668
|
+
module2.exports._enoent = enoent;
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
// node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js
|
|
673
|
+
var require_merge_stream = __commonJS({
|
|
674
|
+
"node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js"(exports2, module2) {
|
|
675
|
+
"use strict";
|
|
676
|
+
var { PassThrough } = require("stream");
|
|
677
|
+
module2.exports = function() {
|
|
678
|
+
var sources = [];
|
|
679
|
+
var output = new PassThrough({ objectMode: true });
|
|
680
|
+
output.setMaxListeners(0);
|
|
681
|
+
output.add = add;
|
|
682
|
+
output.isEmpty = isEmpty;
|
|
683
|
+
output.on("unpipe", remove);
|
|
684
|
+
Array.prototype.slice.call(arguments).forEach(add);
|
|
685
|
+
return output;
|
|
686
|
+
function add(source) {
|
|
687
|
+
if (Array.isArray(source)) {
|
|
688
|
+
source.forEach(add);
|
|
689
|
+
return this;
|
|
690
|
+
}
|
|
691
|
+
sources.push(source);
|
|
692
|
+
source.once("end", remove.bind(null, source));
|
|
693
|
+
source.once("error", output.emit.bind(output, "error"));
|
|
694
|
+
source.pipe(output, { end: false });
|
|
695
|
+
return this;
|
|
696
|
+
}
|
|
697
|
+
function isEmpty() {
|
|
698
|
+
return sources.length == 0;
|
|
699
|
+
}
|
|
700
|
+
function remove(source) {
|
|
701
|
+
sources = sources.filter(function(it) {
|
|
702
|
+
return it !== source;
|
|
703
|
+
});
|
|
704
|
+
if (!sources.length && output.readable) {
|
|
705
|
+
output.end();
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
// packages/qwik/src/cli/index.ts
|
|
713
|
+
var cli_exports = {};
|
|
714
|
+
__export(cli_exports, {
|
|
715
|
+
runCli: () => runCli,
|
|
716
|
+
updateApp: () => updateApp
|
|
717
|
+
});
|
|
718
|
+
module.exports = __toCommonJS(cli_exports);
|
|
719
|
+
|
|
720
|
+
// node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs
|
|
721
|
+
var FORCE_COLOR;
|
|
722
|
+
var NODE_DISABLE_COLORS;
|
|
723
|
+
var NO_COLOR;
|
|
724
|
+
var TERM;
|
|
725
|
+
var isTTY = true;
|
|
726
|
+
if (typeof process !== "undefined") {
|
|
727
|
+
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
|
728
|
+
isTTY = process.stdout && process.stdout.isTTY;
|
|
729
|
+
}
|
|
730
|
+
var $ = {
|
|
731
|
+
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
|
|
732
|
+
};
|
|
733
|
+
function init(x3, y3) {
|
|
734
|
+
let rgx = new RegExp(`\\x1b\\[${y3}m`, "g");
|
|
735
|
+
let open = `\x1B[${x3}m`, close = `\x1B[${y3}m`;
|
|
736
|
+
return function(txt) {
|
|
737
|
+
if (!$.enabled || txt == null) return txt;
|
|
738
|
+
return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
var reset = init(0, 0);
|
|
742
|
+
var bold = init(1, 22);
|
|
743
|
+
var dim = init(2, 22);
|
|
744
|
+
var italic = init(3, 23);
|
|
745
|
+
var underline = init(4, 24);
|
|
746
|
+
var inverse = init(7, 27);
|
|
747
|
+
var hidden = init(8, 28);
|
|
748
|
+
var strikethrough = init(9, 29);
|
|
749
|
+
var black = init(30, 39);
|
|
750
|
+
var red = init(31, 39);
|
|
751
|
+
var green = init(32, 39);
|
|
752
|
+
var yellow = init(33, 39);
|
|
753
|
+
var blue = init(34, 39);
|
|
754
|
+
var magenta = init(35, 39);
|
|
755
|
+
var cyan = init(36, 39);
|
|
756
|
+
var white = init(37, 39);
|
|
757
|
+
var gray = init(90, 39);
|
|
758
|
+
var grey = init(90, 39);
|
|
759
|
+
var bgBlack = init(40, 49);
|
|
760
|
+
var bgRed = init(41, 49);
|
|
761
|
+
var bgGreen = init(42, 49);
|
|
762
|
+
var bgYellow = init(43, 49);
|
|
763
|
+
var bgBlue = init(44, 49);
|
|
764
|
+
var bgMagenta = init(45, 49);
|
|
765
|
+
var bgCyan = init(46, 49);
|
|
766
|
+
var bgWhite = init(47, 49);
|
|
767
|
+
|
|
768
|
+
// packages/qwik/src/cli/utils/app-command.ts
|
|
769
|
+
var import_node_fs = require("node:fs");
|
|
770
|
+
var import_node_path = require("node:path");
|
|
771
|
+
var AppCommand = class {
|
|
772
|
+
args;
|
|
773
|
+
task;
|
|
774
|
+
cwd;
|
|
775
|
+
_rootDir;
|
|
776
|
+
_rootPkgJson;
|
|
777
|
+
constructor(opts) {
|
|
778
|
+
this._rootDir = opts.rootDir;
|
|
779
|
+
this.cwd = opts.cwd;
|
|
780
|
+
this.args = opts.args.slice();
|
|
781
|
+
this.task = this.args[0];
|
|
782
|
+
}
|
|
783
|
+
get rootDir() {
|
|
784
|
+
if (!this._rootDir) {
|
|
785
|
+
const fsRoot = (0, import_node_path.resolve)("/");
|
|
786
|
+
let testDir = process.cwd();
|
|
787
|
+
for (let i = 0; i < 20; i++) {
|
|
788
|
+
const pkgPath = (0, import_node_path.join)(testDir, "package.json");
|
|
789
|
+
if ((0, import_node_fs.existsSync)(pkgPath)) {
|
|
790
|
+
this._rootDir = testDir;
|
|
791
|
+
break;
|
|
792
|
+
}
|
|
793
|
+
if (testDir === fsRoot) {
|
|
794
|
+
break;
|
|
795
|
+
}
|
|
796
|
+
testDir = (0, import_node_path.dirname)(testDir);
|
|
797
|
+
}
|
|
798
|
+
if (!this._rootDir) {
|
|
799
|
+
throw new Error(`Unable to find Qwik app package.json`);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
return this._rootDir;
|
|
803
|
+
}
|
|
804
|
+
set rootDir(rootDir) {
|
|
805
|
+
this._rootDir = rootDir;
|
|
806
|
+
}
|
|
807
|
+
get packageJson() {
|
|
808
|
+
if (!this._rootPkgJson) {
|
|
809
|
+
const pkgJsonPath = (0, import_node_path.join)(this.rootDir, "package.json");
|
|
810
|
+
this._rootPkgJson = JSON.parse((0, import_node_fs.readFileSync)(pkgJsonPath, "utf-8"));
|
|
811
|
+
}
|
|
812
|
+
return this._rootPkgJson;
|
|
813
|
+
}
|
|
814
|
+
getArg(name) {
|
|
815
|
+
const key = `--${name}`;
|
|
816
|
+
const matcher = new RegExp(`^${key}($|=)`);
|
|
817
|
+
const index = this.args.findIndex((arg) => matcher.test(arg));
|
|
818
|
+
if (index === -1) {
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
if (this.args[index].includes("=")) {
|
|
822
|
+
return this.args[index].split("=")[1];
|
|
823
|
+
}
|
|
824
|
+
return this.args[index + 1];
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
// node_modules/.pnpm/@clack+core@0.3.4/node_modules/@clack/core/dist/index.mjs
|
|
829
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
830
|
+
var import_node_process = require("node:process");
|
|
831
|
+
var f = __toESM(require("node:readline"), 1);
|
|
832
|
+
var import_node_readline = __toESM(require("node:readline"), 1);
|
|
833
|
+
var import_node_tty = require("node:tty");
|
|
834
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
835
|
+
function q({ onlyFirst: t = false } = {}) {
|
|
836
|
+
const u = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
|
|
837
|
+
return new RegExp(u, t ? void 0 : "g");
|
|
838
|
+
}
|
|
839
|
+
function S(t) {
|
|
840
|
+
if (typeof t != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);
|
|
841
|
+
return t.replace(q(), "");
|
|
842
|
+
}
|
|
843
|
+
function j(t) {
|
|
844
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
845
|
+
}
|
|
846
|
+
var M = { exports: {} };
|
|
847
|
+
(function(t) {
|
|
848
|
+
var u = {};
|
|
849
|
+
t.exports = u, u.eastAsianWidth = function(e2) {
|
|
850
|
+
var s2 = e2.charCodeAt(0), C2 = e2.length == 2 ? e2.charCodeAt(1) : 0, D = s2;
|
|
851
|
+
return 55296 <= s2 && s2 <= 56319 && 56320 <= C2 && C2 <= 57343 && (s2 &= 1023, C2 &= 1023, D = s2 << 10 | C2, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
|
|
852
|
+
}, u.characterLength = function(e2) {
|
|
853
|
+
var s2 = this.eastAsianWidth(e2);
|
|
854
|
+
return s2 == "F" || s2 == "W" || s2 == "A" ? 2 : 1;
|
|
855
|
+
};
|
|
856
|
+
function F(e2) {
|
|
857
|
+
return e2.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
858
|
+
}
|
|
859
|
+
u.length = function(e2) {
|
|
860
|
+
for (var s2 = F(e2), C2 = 0, D = 0; D < s2.length; D++) C2 = C2 + this.characterLength(s2[D]);
|
|
861
|
+
return C2;
|
|
862
|
+
}, u.slice = function(e2, s2, C2) {
|
|
863
|
+
textLen = u.length(e2), s2 = s2 || 0, C2 = C2 || 1, s2 < 0 && (s2 = textLen + s2), C2 < 0 && (C2 = textLen + C2);
|
|
864
|
+
for (var D = "", i = 0, n = F(e2), E2 = 0; E2 < n.length; E2++) {
|
|
865
|
+
var h2 = n[E2], o2 = u.length(h2);
|
|
866
|
+
if (i >= s2 - (o2 == 2 ? 1 : 0)) if (i + o2 <= C2) D += h2;
|
|
867
|
+
else break;
|
|
868
|
+
i += o2;
|
|
869
|
+
}
|
|
870
|
+
return D;
|
|
871
|
+
};
|
|
872
|
+
})(M);
|
|
873
|
+
var J = M.exports;
|
|
874
|
+
var Q = j(J);
|
|
875
|
+
var X = function() {
|
|
876
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
877
|
+
};
|
|
878
|
+
var DD = j(X);
|
|
879
|
+
function A(t, u = {}) {
|
|
880
|
+
if (typeof t != "string" || t.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, t = S(t), t.length === 0)) return 0;
|
|
881
|
+
t = t.replace(DD(), " ");
|
|
882
|
+
const F = u.ambiguousIsNarrow ? 1 : 2;
|
|
883
|
+
let e2 = 0;
|
|
884
|
+
for (const s2 of t) {
|
|
885
|
+
const C2 = s2.codePointAt(0);
|
|
886
|
+
if (C2 <= 31 || C2 >= 127 && C2 <= 159 || C2 >= 768 && C2 <= 879) continue;
|
|
887
|
+
switch (Q.eastAsianWidth(s2)) {
|
|
888
|
+
case "F":
|
|
889
|
+
case "W":
|
|
890
|
+
e2 += 2;
|
|
891
|
+
break;
|
|
892
|
+
case "A":
|
|
893
|
+
e2 += F;
|
|
894
|
+
break;
|
|
895
|
+
default:
|
|
896
|
+
e2 += 1;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
return e2;
|
|
900
|
+
}
|
|
901
|
+
var m = 10;
|
|
902
|
+
var T = (t = 0) => (u) => `\x1B[${u + t}m`;
|
|
903
|
+
var P = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`;
|
|
904
|
+
var W = (t = 0) => (u, F, e2) => `\x1B[${38 + t};2;${u};${F};${e2}m`;
|
|
905
|
+
var r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
906
|
+
Object.keys(r.modifier);
|
|
907
|
+
var uD = Object.keys(r.color);
|
|
908
|
+
var FD = Object.keys(r.bgColor);
|
|
909
|
+
[...uD, ...FD];
|
|
910
|
+
function tD() {
|
|
911
|
+
const t = /* @__PURE__ */ new Map();
|
|
912
|
+
for (const [u, F] of Object.entries(r)) {
|
|
913
|
+
for (const [e2, s2] of Object.entries(F)) r[e2] = { open: `\x1B[${s2[0]}m`, close: `\x1B[${s2[1]}m` }, F[e2] = r[e2], t.set(s2[0], s2[1]);
|
|
914
|
+
Object.defineProperty(r, u, { value: F, enumerable: false });
|
|
915
|
+
}
|
|
916
|
+
return Object.defineProperty(r, "codes", { value: t, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = T(), r.color.ansi256 = P(), r.color.ansi16m = W(), r.bgColor.ansi = T(m), r.bgColor.ansi256 = P(m), r.bgColor.ansi16m = W(m), Object.defineProperties(r, { rgbToAnsi256: { value: (u, F, e2) => u === F && F === e2 ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(F / 255 * 5) + Math.round(e2 / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
|
|
917
|
+
const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
|
|
918
|
+
if (!F) return [0, 0, 0];
|
|
919
|
+
let [e2] = F;
|
|
920
|
+
e2.length === 3 && (e2 = [...e2].map((C2) => C2 + C2).join(""));
|
|
921
|
+
const s2 = Number.parseInt(e2, 16);
|
|
922
|
+
return [s2 >> 16 & 255, s2 >> 8 & 255, s2 & 255];
|
|
923
|
+
}, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
|
|
924
|
+
if (u < 8) return 30 + u;
|
|
925
|
+
if (u < 16) return 90 + (u - 8);
|
|
926
|
+
let F, e2, s2;
|
|
927
|
+
if (u >= 232) F = ((u - 232) * 10 + 8) / 255, e2 = F, s2 = F;
|
|
928
|
+
else {
|
|
929
|
+
u -= 16;
|
|
930
|
+
const i = u % 36;
|
|
931
|
+
F = Math.floor(u / 36) / 5, e2 = Math.floor(i / 6) / 5, s2 = i % 6 / 5;
|
|
932
|
+
}
|
|
933
|
+
const C2 = Math.max(F, e2, s2) * 2;
|
|
934
|
+
if (C2 === 0) return 30;
|
|
935
|
+
let D = 30 + (Math.round(s2) << 2 | Math.round(e2) << 1 | Math.round(F));
|
|
936
|
+
return C2 === 2 && (D += 60), D;
|
|
937
|
+
}, enumerable: false }, rgbToAnsi: { value: (u, F, e2) => r.ansi256ToAnsi(r.rgbToAnsi256(u, F, e2)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
|
|
938
|
+
}
|
|
939
|
+
var eD = tD();
|
|
940
|
+
var g = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
|
|
941
|
+
var sD = 39;
|
|
942
|
+
var b = "\x07";
|
|
943
|
+
var O = "[";
|
|
944
|
+
var CD = "]";
|
|
945
|
+
var I = "m";
|
|
946
|
+
var w = `${CD}8;;`;
|
|
947
|
+
var N = (t) => `${g.values().next().value}${O}${t}${I}`;
|
|
948
|
+
var L = (t) => `${g.values().next().value}${w}${t}${b}`;
|
|
949
|
+
var iD = (t) => t.split(" ").map((u) => A(u));
|
|
950
|
+
var y = (t, u, F) => {
|
|
951
|
+
const e2 = [...u];
|
|
952
|
+
let s2 = false, C2 = false, D = A(S(t[t.length - 1]));
|
|
953
|
+
for (const [i, n] of e2.entries()) {
|
|
954
|
+
const E2 = A(n);
|
|
955
|
+
if (D + E2 <= F ? t[t.length - 1] += n : (t.push(n), D = 0), g.has(n) && (s2 = true, C2 = e2.slice(i + 1).join("").startsWith(w)), s2) {
|
|
956
|
+
C2 ? n === b && (s2 = false, C2 = false) : n === I && (s2 = false);
|
|
957
|
+
continue;
|
|
958
|
+
}
|
|
959
|
+
D += E2, D === F && i < e2.length - 1 && (t.push(""), D = 0);
|
|
960
|
+
}
|
|
961
|
+
!D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
962
|
+
};
|
|
963
|
+
var rD = (t) => {
|
|
964
|
+
const u = t.split(" ");
|
|
965
|
+
let F = u.length;
|
|
966
|
+
for (; F > 0 && !(A(u[F - 1]) > 0); ) F--;
|
|
967
|
+
return F === u.length ? t : u.slice(0, F).join(" ") + u.slice(F).join("");
|
|
968
|
+
};
|
|
969
|
+
var ED = (t, u, F = {}) => {
|
|
970
|
+
if (F.trim !== false && t.trim() === "") return "";
|
|
971
|
+
let e2 = "", s2, C2;
|
|
972
|
+
const D = iD(t);
|
|
973
|
+
let i = [""];
|
|
974
|
+
for (const [E2, h2] of t.split(" ").entries()) {
|
|
975
|
+
F.trim !== false && (i[i.length - 1] = i[i.length - 1].trimStart());
|
|
976
|
+
let o2 = A(i[i.length - 1]);
|
|
977
|
+
if (E2 !== 0 && (o2 >= u && (F.wordWrap === false || F.trim === false) && (i.push(""), o2 = 0), (o2 > 0 || F.trim === false) && (i[i.length - 1] += " ", o2++)), F.hard && D[E2] > u) {
|
|
978
|
+
const B2 = u - o2, p = 1 + Math.floor((D[E2] - B2 - 1) / u);
|
|
979
|
+
Math.floor((D[E2] - 1) / u) < p && i.push(""), y(i, h2, u);
|
|
980
|
+
continue;
|
|
981
|
+
}
|
|
982
|
+
if (o2 + D[E2] > u && o2 > 0 && D[E2] > 0) {
|
|
983
|
+
if (F.wordWrap === false && o2 < u) {
|
|
984
|
+
y(i, h2, u);
|
|
985
|
+
continue;
|
|
986
|
+
}
|
|
987
|
+
i.push("");
|
|
988
|
+
}
|
|
989
|
+
if (o2 + D[E2] > u && F.wordWrap === false) {
|
|
990
|
+
y(i, h2, u);
|
|
991
|
+
continue;
|
|
992
|
+
}
|
|
993
|
+
i[i.length - 1] += h2;
|
|
994
|
+
}
|
|
995
|
+
F.trim !== false && (i = i.map((E2) => rD(E2)));
|
|
996
|
+
const n = [...i.join(`
|
|
997
|
+
`)];
|
|
998
|
+
for (const [E2, h2] of n.entries()) {
|
|
999
|
+
if (e2 += h2, g.has(h2)) {
|
|
1000
|
+
const { groups: B2 } = new RegExp(`(?:\\${O}(?<code>\\d+)m|\\${w}(?<uri>.*)${b})`).exec(n.slice(E2).join("")) || { groups: {} };
|
|
1001
|
+
if (B2.code !== void 0) {
|
|
1002
|
+
const p = Number.parseFloat(B2.code);
|
|
1003
|
+
s2 = p === sD ? void 0 : p;
|
|
1004
|
+
} else B2.uri !== void 0 && (C2 = B2.uri.length === 0 ? void 0 : B2.uri);
|
|
1005
|
+
}
|
|
1006
|
+
const o2 = eD.codes.get(Number(s2));
|
|
1007
|
+
n[E2 + 1] === `
|
|
1008
|
+
` ? (C2 && (e2 += L("")), s2 && o2 && (e2 += N(o2))) : h2 === `
|
|
1009
|
+
` && (s2 && o2 && (e2 += N(s2)), C2 && (e2 += L(C2)));
|
|
1010
|
+
}
|
|
1011
|
+
return e2;
|
|
1012
|
+
};
|
|
1013
|
+
function R(t, u, F) {
|
|
1014
|
+
return String(t).normalize().replace(/\r\n/g, `
|
|
1015
|
+
`).split(`
|
|
1016
|
+
`).map((e2) => ED(e2, u, F)).join(`
|
|
1017
|
+
`);
|
|
1018
|
+
}
|
|
1019
|
+
var oD = Object.defineProperty;
|
|
1020
|
+
var nD = (t, u, F) => u in t ? oD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
|
|
1021
|
+
var a = (t, u, F) => (nD(t, typeof u != "symbol" ? u + "" : u, F), F);
|
|
1022
|
+
function aD(t, u) {
|
|
1023
|
+
if (t === u) return;
|
|
1024
|
+
const F = t.split(`
|
|
1025
|
+
`), e2 = u.split(`
|
|
1026
|
+
`), s2 = [];
|
|
1027
|
+
for (let C2 = 0; C2 < Math.max(F.length, e2.length); C2++) F[C2] !== e2[C2] && s2.push(C2);
|
|
1028
|
+
return s2;
|
|
1029
|
+
}
|
|
1030
|
+
var V = Symbol("clack:cancel");
|
|
1031
|
+
function hD(t) {
|
|
1032
|
+
return t === V;
|
|
1033
|
+
}
|
|
1034
|
+
function v(t, u) {
|
|
1035
|
+
t.isTTY && t.setRawMode(u);
|
|
1036
|
+
}
|
|
1037
|
+
var z = /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"]]);
|
|
1038
|
+
var lD = /* @__PURE__ */ new Set(["up", "down", "left", "right", "space", "enter"]);
|
|
1039
|
+
var x = class {
|
|
1040
|
+
constructor({ render: u, input: F = import_node_process.stdin, output: e2 = import_node_process.stdout, ...s2 }, C2 = true) {
|
|
1041
|
+
a(this, "input"), a(this, "output"), a(this, "rl"), a(this, "opts"), a(this, "_track", false), a(this, "_render"), a(this, "_cursor", 0), a(this, "state", "initial"), a(this, "value"), a(this, "error", ""), a(this, "subscribers", /* @__PURE__ */ new Map()), a(this, "_prevFrame", ""), this.opts = s2, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = u.bind(this), this._track = C2, this.input = F, this.output = e2;
|
|
1042
|
+
}
|
|
1043
|
+
prompt() {
|
|
1044
|
+
const u = new import_node_tty.WriteStream(0);
|
|
1045
|
+
return u._write = (F, e2, s2) => {
|
|
1046
|
+
this._track && (this.value = this.rl.line.replace(/\t/g, ""), this._cursor = this.rl.cursor, this.emit("value", this.value)), s2();
|
|
1047
|
+
}, this.input.pipe(u), this.rl = import_node_readline.default.createInterface({ input: this.input, output: u, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), import_node_readline.default.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), v(this.input, true), this.output.on("resize", this.render), this.render(), new Promise((F, e2) => {
|
|
1048
|
+
this.once("submit", () => {
|
|
1049
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), v(this.input, false), F(this.value);
|
|
1050
|
+
}), this.once("cancel", () => {
|
|
1051
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), v(this.input, false), F(V);
|
|
1052
|
+
});
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
on(u, F) {
|
|
1056
|
+
const e2 = this.subscribers.get(u) ?? [];
|
|
1057
|
+
e2.push({ cb: F }), this.subscribers.set(u, e2);
|
|
1058
|
+
}
|
|
1059
|
+
once(u, F) {
|
|
1060
|
+
const e2 = this.subscribers.get(u) ?? [];
|
|
1061
|
+
e2.push({ cb: F, once: true }), this.subscribers.set(u, e2);
|
|
1062
|
+
}
|
|
1063
|
+
emit(u, ...F) {
|
|
1064
|
+
const e2 = this.subscribers.get(u) ?? [], s2 = [];
|
|
1065
|
+
for (const C2 of e2) C2.cb(...F), C2.once && s2.push(() => e2.splice(e2.indexOf(C2), 1));
|
|
1066
|
+
for (const C2 of s2) C2();
|
|
1067
|
+
}
|
|
1068
|
+
unsubscribe() {
|
|
1069
|
+
this.subscribers.clear();
|
|
1070
|
+
}
|
|
1071
|
+
onKeypress(u, F) {
|
|
1072
|
+
if (this.state === "error" && (this.state = "active"), (F == null ? void 0 : F.name) && !this._track && z.has(F.name) && this.emit("cursor", z.get(F.name)), (F == null ? void 0 : F.name) && lD.has(F.name) && this.emit("cursor", F.name), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === " " && this.opts.placeholder && (this.value || (this.rl.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), (F == null ? void 0 : F.name) === "return") {
|
|
1073
|
+
if (this.opts.validate) {
|
|
1074
|
+
const e2 = this.opts.validate(this.value);
|
|
1075
|
+
e2 && (this.error = e2, this.state = "error", this.rl.write(this.value));
|
|
1076
|
+
}
|
|
1077
|
+
this.state !== "error" && (this.state = "submit");
|
|
1078
|
+
}
|
|
1079
|
+
u === "" && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
1080
|
+
}
|
|
1081
|
+
close() {
|
|
1082
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
1083
|
+
`), v(this.input, false), this.rl.close(), this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
1084
|
+
}
|
|
1085
|
+
restoreCursor() {
|
|
1086
|
+
const u = R(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
1087
|
+
`).length - 1;
|
|
1088
|
+
this.output.write(import_sisteransi.cursor.move(-999, u * -1));
|
|
1089
|
+
}
|
|
1090
|
+
render() {
|
|
1091
|
+
const u = R(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
1092
|
+
if (u !== this._prevFrame) {
|
|
1093
|
+
if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
|
|
1094
|
+
else {
|
|
1095
|
+
const F = aD(this._prevFrame, u);
|
|
1096
|
+
if (this.restoreCursor(), F && (F == null ? void 0 : F.length) === 1) {
|
|
1097
|
+
const e2 = F[0];
|
|
1098
|
+
this.output.write(import_sisteransi.cursor.move(0, e2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
1099
|
+
const s2 = u.split(`
|
|
1100
|
+
`);
|
|
1101
|
+
this.output.write(s2[e2]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s2.length - e2 - 1));
|
|
1102
|
+
return;
|
|
1103
|
+
} else if (F && (F == null ? void 0 : F.length) > 1) {
|
|
1104
|
+
const e2 = F[0];
|
|
1105
|
+
this.output.write(import_sisteransi.cursor.move(0, e2)), this.output.write(import_sisteransi.erase.down());
|
|
1106
|
+
const s2 = u.split(`
|
|
1107
|
+
`).slice(e2);
|
|
1108
|
+
this.output.write(s2.join(`
|
|
1109
|
+
`)), this._prevFrame = u;
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
this.output.write(import_sisteransi.erase.down());
|
|
1113
|
+
}
|
|
1114
|
+
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
var xD = class extends x {
|
|
1119
|
+
get cursor() {
|
|
1120
|
+
return this.value ? 0 : 1;
|
|
1121
|
+
}
|
|
1122
|
+
get _value() {
|
|
1123
|
+
return this.cursor === 0;
|
|
1124
|
+
}
|
|
1125
|
+
constructor(u) {
|
|
1126
|
+
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
|
|
1127
|
+
this.value = this._value;
|
|
1128
|
+
}), this.on("confirm", (F) => {
|
|
1129
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close();
|
|
1130
|
+
}), this.on("cursor", () => {
|
|
1131
|
+
this.value = !this.value;
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
var bD = Object.defineProperty;
|
|
1136
|
+
var wD = (t, u, F) => u in t ? bD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
|
|
1137
|
+
var Z = (t, u, F) => (wD(t, typeof u != "symbol" ? u + "" : u, F), F);
|
|
1138
|
+
var yD = class extends x {
|
|
1139
|
+
constructor(u) {
|
|
1140
|
+
super(u, false), Z(this, "options"), Z(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: F }) => F === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => {
|
|
1141
|
+
switch (F) {
|
|
1142
|
+
case "left":
|
|
1143
|
+
case "up":
|
|
1144
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
1145
|
+
break;
|
|
1146
|
+
case "down":
|
|
1147
|
+
case "right":
|
|
1148
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
1149
|
+
break;
|
|
1150
|
+
}
|
|
1151
|
+
this.changeValue();
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
get _value() {
|
|
1155
|
+
return this.options[this.cursor];
|
|
1156
|
+
}
|
|
1157
|
+
changeValue() {
|
|
1158
|
+
this.value = this._value.value;
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
var SD = Object.defineProperty;
|
|
1162
|
+
var jD = (t, u, F) => u in t ? SD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
|
|
1163
|
+
var MD = (t, u, F) => (jD(t, typeof u != "symbol" ? u + "" : u, F), F);
|
|
1164
|
+
var TD = class extends x {
|
|
1165
|
+
constructor(u) {
|
|
1166
|
+
super(u), MD(this, "valueWithCursor", ""), this.on("finalize", () => {
|
|
1167
|
+
this.value || (this.value = u.defaultValue), this.valueWithCursor = this.value;
|
|
1168
|
+
}), this.on("value", () => {
|
|
1169
|
+
if (this.cursor >= this.value.length) this.valueWithCursor = `${this.value}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
|
|
1170
|
+
else {
|
|
1171
|
+
const F = this.value.slice(0, this.cursor), e2 = this.value.slice(this.cursor);
|
|
1172
|
+
this.valueWithCursor = `${F}${import_picocolors.default.inverse(e2[0])}${e2.slice(1)}`;
|
|
1173
|
+
}
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
get cursor() {
|
|
1177
|
+
return this._cursor;
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
var PD = globalThis.process.platform.startsWith("win");
|
|
1181
|
+
function WD({ input: t = import_node_process.stdin, output: u = import_node_process.stdout, overwrite: F = true, hideCursor: e2 = true } = {}) {
|
|
1182
|
+
const s2 = f.createInterface({ input: t, output: u, prompt: "", tabSize: 1 });
|
|
1183
|
+
f.emitKeypressEvents(t, s2), t.isTTY && t.setRawMode(true);
|
|
1184
|
+
const C2 = (D, { name: i }) => {
|
|
1185
|
+
if (String(D) === "" && process.exit(0), !F) return;
|
|
1186
|
+
let n = i === "return" ? 0 : -1, E2 = i === "return" ? -1 : 0;
|
|
1187
|
+
f.moveCursor(u, n, E2, () => {
|
|
1188
|
+
f.clearLine(u, 1, () => {
|
|
1189
|
+
t.once("keypress", C2);
|
|
1190
|
+
});
|
|
1191
|
+
});
|
|
1192
|
+
};
|
|
1193
|
+
return e2 && process.stdout.write(import_sisteransi.cursor.hide), t.once("keypress", C2), () => {
|
|
1194
|
+
t.off("keypress", C2), e2 && process.stdout.write(import_sisteransi.cursor.show), t.isTTY && !PD && t.setRawMode(false), s2.terminal = false, s2.close();
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
// node_modules/.pnpm/@clack+prompts@0.7.0/node_modules/@clack/prompts/dist/index.mjs
|
|
1199
|
+
var import_node_process2 = __toESM(require("node:process"), 1);
|
|
1200
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
1201
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
1202
|
+
function q2() {
|
|
1203
|
+
return import_node_process2.default.platform !== "win32" ? import_node_process2.default.env.TERM !== "linux" : Boolean(import_node_process2.default.env.CI) || Boolean(import_node_process2.default.env.WT_SESSION) || Boolean(import_node_process2.default.env.TERMINUS_SUBLIME) || import_node_process2.default.env.ConEmuTask === "{cmd::Cmder}" || import_node_process2.default.env.TERM_PROGRAM === "Terminus-Sublime" || import_node_process2.default.env.TERM_PROGRAM === "vscode" || import_node_process2.default.env.TERM === "xterm-256color" || import_node_process2.default.env.TERM === "alacritty" || import_node_process2.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1204
|
+
}
|
|
1205
|
+
var _2 = q2();
|
|
1206
|
+
var o = (r2, n) => _2 ? r2 : n;
|
|
1207
|
+
var H = o("\u25C6", "*");
|
|
1208
|
+
var I2 = o("\u25A0", "x");
|
|
1209
|
+
var x2 = o("\u25B2", "x");
|
|
1210
|
+
var S2 = o("\u25C7", "o");
|
|
1211
|
+
var K = o("\u250C", "T");
|
|
1212
|
+
var a2 = o("\u2502", "|");
|
|
1213
|
+
var d2 = o("\u2514", "\u2014");
|
|
1214
|
+
var b2 = o("\u25CF", ">");
|
|
1215
|
+
var E = o("\u25CB", " ");
|
|
1216
|
+
var C = o("\u25FB", "[\u2022]");
|
|
1217
|
+
var w2 = o("\u25FC", "[+]");
|
|
1218
|
+
var M2 = o("\u25FB", "[ ]");
|
|
1219
|
+
var U2 = o("\u25AA", "\u2022");
|
|
1220
|
+
var B = o("\u2500", "-");
|
|
1221
|
+
var Z2 = o("\u256E", "+");
|
|
1222
|
+
var z2 = o("\u251C", "+");
|
|
1223
|
+
var X2 = o("\u256F", "+");
|
|
1224
|
+
var J2 = o("\u25CF", "\u2022");
|
|
1225
|
+
var Y = o("\u25C6", "*");
|
|
1226
|
+
var Q2 = o("\u25B2", "!");
|
|
1227
|
+
var ee = o("\u25A0", "x");
|
|
1228
|
+
var y2 = (r2) => {
|
|
1229
|
+
switch (r2) {
|
|
1230
|
+
case "initial":
|
|
1231
|
+
case "active":
|
|
1232
|
+
return import_picocolors2.default.cyan(H);
|
|
1233
|
+
case "cancel":
|
|
1234
|
+
return import_picocolors2.default.red(I2);
|
|
1235
|
+
case "error":
|
|
1236
|
+
return import_picocolors2.default.yellow(x2);
|
|
1237
|
+
case "submit":
|
|
1238
|
+
return import_picocolors2.default.green(S2);
|
|
1239
|
+
}
|
|
1240
|
+
};
|
|
1241
|
+
var te = (r2) => new TD({ validate: r2.validate, placeholder: r2.placeholder, defaultValue: r2.defaultValue, initialValue: r2.initialValue, render() {
|
|
1242
|
+
var _a;
|
|
1243
|
+
const n = `${import_picocolors2.default.gray(a2)}
|
|
1244
|
+
${y2(this.state)} ${r2.message}
|
|
1245
|
+
`, i = r2.placeholder ? import_picocolors2.default.inverse(r2.placeholder[0]) + import_picocolors2.default.dim(r2.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), t = this.value ? this.valueWithCursor : i;
|
|
1246
|
+
switch (this.state) {
|
|
1247
|
+
case "error":
|
|
1248
|
+
return `${n.trim()}
|
|
1249
|
+
${import_picocolors2.default.yellow(a2)} ${t}
|
|
1250
|
+
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
1251
|
+
`;
|
|
1252
|
+
case "submit":
|
|
1253
|
+
return `${n}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.dim(this.value || r2.placeholder)}`;
|
|
1254
|
+
case "cancel":
|
|
1255
|
+
return `${n}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${((_a = this.value) == null ? void 0 : _a.trim()) ? `
|
|
1256
|
+
` + import_picocolors2.default.gray(a2) : ""}`;
|
|
1257
|
+
default:
|
|
1258
|
+
return `${n}${import_picocolors2.default.cyan(a2)} ${t}
|
|
1259
|
+
${import_picocolors2.default.cyan(d2)}
|
|
1260
|
+
`;
|
|
1261
|
+
}
|
|
1262
|
+
} }).prompt();
|
|
1263
|
+
var se = (r2) => {
|
|
1264
|
+
const n = r2.active ?? "Yes", i = r2.inactive ?? "No";
|
|
1265
|
+
return new xD({ active: n, inactive: i, initialValue: r2.initialValue ?? true, render() {
|
|
1266
|
+
const t = `${import_picocolors2.default.gray(a2)}
|
|
1267
|
+
${y2(this.state)} ${r2.message}
|
|
1268
|
+
`, s2 = this.value ? n : i;
|
|
1269
|
+
switch (this.state) {
|
|
1270
|
+
case "submit":
|
|
1271
|
+
return `${t}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.dim(s2)}`;
|
|
1272
|
+
case "cancel":
|
|
1273
|
+
return `${t}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s2))}
|
|
1274
|
+
${import_picocolors2.default.gray(a2)}`;
|
|
1275
|
+
default:
|
|
1276
|
+
return `${t}${import_picocolors2.default.cyan(a2)} ${this.value ? `${import_picocolors2.default.green(b2)} ${n}` : `${import_picocolors2.default.dim(E)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(E)} ${import_picocolors2.default.dim(i)}` : `${import_picocolors2.default.green(b2)} ${i}`}
|
|
1277
|
+
${import_picocolors2.default.cyan(d2)}
|
|
1278
|
+
`;
|
|
1279
|
+
}
|
|
1280
|
+
} }).prompt();
|
|
1281
|
+
};
|
|
1282
|
+
var ie = (r2) => {
|
|
1283
|
+
const n = (t, s2) => {
|
|
1284
|
+
const c2 = t.label ?? String(t.value);
|
|
1285
|
+
return s2 === "active" ? `${import_picocolors2.default.green(b2)} ${c2} ${t.hint ? import_picocolors2.default.dim(`(${t.hint})`) : ""}` : s2 === "selected" ? `${import_picocolors2.default.dim(c2)}` : s2 === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(c2))}` : `${import_picocolors2.default.dim(E)} ${import_picocolors2.default.dim(c2)}`;
|
|
1286
|
+
};
|
|
1287
|
+
let i = 0;
|
|
1288
|
+
return new yD({ options: r2.options, initialValue: r2.initialValue, render() {
|
|
1289
|
+
const t = `${import_picocolors2.default.gray(a2)}
|
|
1290
|
+
${y2(this.state)} ${r2.message}
|
|
1291
|
+
`;
|
|
1292
|
+
switch (this.state) {
|
|
1293
|
+
case "submit":
|
|
1294
|
+
return `${t}${import_picocolors2.default.gray(a2)} ${n(this.options[this.cursor], "selected")}`;
|
|
1295
|
+
case "cancel":
|
|
1296
|
+
return `${t}${import_picocolors2.default.gray(a2)} ${n(this.options[this.cursor], "cancelled")}
|
|
1297
|
+
${import_picocolors2.default.gray(a2)}`;
|
|
1298
|
+
default: {
|
|
1299
|
+
const s2 = r2.maxItems === void 0 ? 1 / 0 : Math.max(r2.maxItems, 5);
|
|
1300
|
+
this.cursor >= i + s2 - 3 ? i = Math.max(Math.min(this.cursor - s2 + 3, this.options.length - s2), 0) : this.cursor < i + 2 && (i = Math.max(this.cursor - 2, 0));
|
|
1301
|
+
const c2 = s2 < this.options.length && i > 0, l2 = s2 < this.options.length && i + s2 < this.options.length;
|
|
1302
|
+
return `${t}${import_picocolors2.default.cyan(a2)} ${this.options.slice(i, i + s2).map((u, m2, $4) => m2 === 0 && c2 ? import_picocolors2.default.dim("...") : m2 === $4.length - 1 && l2 ? import_picocolors2.default.dim("...") : n(u, m2 + i === this.cursor ? "active" : "inactive")).join(`
|
|
1303
|
+
${import_picocolors2.default.cyan(a2)} `)}
|
|
1304
|
+
${import_picocolors2.default.cyan(d2)}
|
|
1305
|
+
`;
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
} }).prompt();
|
|
1309
|
+
};
|
|
1310
|
+
var oe = (r2 = "") => {
|
|
1311
|
+
process.stdout.write(`${import_picocolors2.default.gray(K)} ${r2}
|
|
1312
|
+
`);
|
|
1313
|
+
};
|
|
1314
|
+
var $e = (r2 = "") => {
|
|
1315
|
+
process.stdout.write(`${import_picocolors2.default.gray(a2)}
|
|
1316
|
+
${import_picocolors2.default.gray(d2)} ${r2}
|
|
1317
|
+
|
|
1318
|
+
`);
|
|
1319
|
+
};
|
|
1320
|
+
var f2 = { message: (r2 = "", { symbol: n = import_picocolors2.default.gray(a2) } = {}) => {
|
|
1321
|
+
const i = [`${import_picocolors2.default.gray(a2)}`];
|
|
1322
|
+
if (r2) {
|
|
1323
|
+
const [t, ...s2] = r2.split(`
|
|
1324
|
+
`);
|
|
1325
|
+
i.push(`${n} ${t}`, ...s2.map((c2) => `${import_picocolors2.default.gray(a2)} ${c2}`));
|
|
1326
|
+
}
|
|
1327
|
+
process.stdout.write(`${i.join(`
|
|
1328
|
+
`)}
|
|
1329
|
+
`);
|
|
1330
|
+
}, info: (r2) => {
|
|
1331
|
+
f2.message(r2, { symbol: import_picocolors2.default.blue(J2) });
|
|
1332
|
+
}, success: (r2) => {
|
|
1333
|
+
f2.message(r2, { symbol: import_picocolors2.default.green(Y) });
|
|
1334
|
+
}, step: (r2) => {
|
|
1335
|
+
f2.message(r2, { symbol: import_picocolors2.default.green(S2) });
|
|
1336
|
+
}, warn: (r2) => {
|
|
1337
|
+
f2.message(r2, { symbol: import_picocolors2.default.yellow(Q2) });
|
|
1338
|
+
}, warning: (r2) => {
|
|
1339
|
+
f2.warn(r2);
|
|
1340
|
+
}, error: (r2) => {
|
|
1341
|
+
f2.message(r2, { symbol: import_picocolors2.default.red(ee) });
|
|
1342
|
+
} };
|
|
1343
|
+
var de = () => {
|
|
1344
|
+
const r2 = _2 ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], n = _2 ? 80 : 120;
|
|
1345
|
+
let i, t, s2 = false, c2 = "";
|
|
1346
|
+
const l2 = (v2 = "") => {
|
|
1347
|
+
s2 = true, i = WD(), c2 = v2.replace(/\.+$/, ""), process.stdout.write(`${import_picocolors2.default.gray(a2)}
|
|
1348
|
+
`);
|
|
1349
|
+
let g2 = 0, p = 0;
|
|
1350
|
+
t = setInterval(() => {
|
|
1351
|
+
const O2 = import_picocolors2.default.magenta(r2[g2]), P2 = ".".repeat(Math.floor(p)).slice(0, 3);
|
|
1352
|
+
process.stdout.write(import_sisteransi2.cursor.move(-999, 0)), process.stdout.write(import_sisteransi2.erase.down(1)), process.stdout.write(`${O2} ${c2}${P2}`), g2 = g2 + 1 < r2.length ? g2 + 1 : 0, p = p < r2.length ? p + 0.125 : 0;
|
|
1353
|
+
}, n);
|
|
1354
|
+
}, u = (v2 = "", g2 = 0) => {
|
|
1355
|
+
c2 = v2 ?? c2, s2 = false, clearInterval(t);
|
|
1356
|
+
const p = g2 === 0 ? import_picocolors2.default.green(S2) : g2 === 1 ? import_picocolors2.default.red(I2) : import_picocolors2.default.red(x2);
|
|
1357
|
+
process.stdout.write(import_sisteransi2.cursor.move(-999, 0)), process.stdout.write(import_sisteransi2.erase.down(1)), process.stdout.write(`${p} ${c2}
|
|
1358
|
+
`), i();
|
|
1359
|
+
}, m2 = (v2 = "") => {
|
|
1360
|
+
c2 = v2 ?? c2;
|
|
1361
|
+
}, $4 = (v2) => {
|
|
1362
|
+
const g2 = v2 > 1 ? "Something went wrong" : "Canceled";
|
|
1363
|
+
s2 && u(g2, v2);
|
|
1364
|
+
};
|
|
1365
|
+
return process.on("uncaughtExceptionMonitor", () => $4(2)), process.on("unhandledRejection", () => $4(2)), process.on("SIGINT", () => $4(1)), process.on("SIGTERM", () => $4(1)), process.on("exit", $4), { start: l2, stop: u, message: m2 };
|
|
1366
|
+
};
|
|
1367
|
+
|
|
1368
|
+
// packages/qwik/src/cli/utils/integrations.ts
|
|
1369
|
+
var import_node_fs3 = __toESM(require("node:fs"), 1);
|
|
1370
|
+
var import_node_path3 = require("node:path");
|
|
1371
|
+
|
|
1372
|
+
// packages/qwik/src/cli/utils/utils.ts
|
|
1373
|
+
var import_which_pm_runs = __toESM(require_which_pm_runs(), 1);
|
|
1374
|
+
var import_node_fs2 = __toESM(require("node:fs"), 1);
|
|
1375
|
+
var import_node_path2 = require("node:path");
|
|
1376
|
+
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
1377
|
+
function runCommand(cmd, args, cwd) {
|
|
1378
|
+
let child;
|
|
1379
|
+
const install = new Promise((resolve2) => {
|
|
1380
|
+
try {
|
|
1381
|
+
child = (0, import_cross_spawn.default)(cmd, args, {
|
|
1382
|
+
cwd,
|
|
1383
|
+
stdio: "ignore"
|
|
1384
|
+
});
|
|
1385
|
+
child.on("error", (e2) => {
|
|
1386
|
+
if (e2) {
|
|
1387
|
+
if (e2.message) {
|
|
1388
|
+
f2.error(red(String(e2.message)) + `
|
|
1389
|
+
|
|
1390
|
+
`);
|
|
1391
|
+
} else {
|
|
1392
|
+
f2.error(red(String(e2)) + `
|
|
1393
|
+
|
|
1394
|
+
`);
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
resolve2(false);
|
|
1398
|
+
});
|
|
1399
|
+
child.on("close", (code) => {
|
|
1400
|
+
if (code === 0) {
|
|
1401
|
+
resolve2(true);
|
|
1402
|
+
} else {
|
|
1403
|
+
resolve2(false);
|
|
1404
|
+
}
|
|
1405
|
+
});
|
|
1406
|
+
} catch (e2) {
|
|
1407
|
+
resolve2(false);
|
|
1408
|
+
}
|
|
1409
|
+
});
|
|
1410
|
+
const abort = async () => {
|
|
1411
|
+
if (child) {
|
|
1412
|
+
child.kill("SIGINT");
|
|
1413
|
+
}
|
|
1414
|
+
};
|
|
1415
|
+
return { abort, install };
|
|
1416
|
+
}
|
|
1417
|
+
async function readPackageJson(dir) {
|
|
1418
|
+
const path3 = (0, import_node_path2.join)(dir, "package.json");
|
|
1419
|
+
const pkgJson = JSON.parse(await import_node_fs2.default.promises.readFile(path3, "utf-8"));
|
|
1420
|
+
return pkgJson;
|
|
1421
|
+
}
|
|
1422
|
+
function dashToTitleCase(str) {
|
|
1423
|
+
return str.toLocaleLowerCase().split("-").map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1)).join(" ");
|
|
1424
|
+
}
|
|
1425
|
+
function limitLength(hint, maxLength = 50) {
|
|
1426
|
+
if (hint.length > maxLength) {
|
|
1427
|
+
return hint.substring(0, maxLength - 3) + "...";
|
|
1428
|
+
}
|
|
1429
|
+
return hint;
|
|
1430
|
+
}
|
|
1431
|
+
function getPackageManager() {
|
|
1432
|
+
var _a;
|
|
1433
|
+
return ((_a = (0, import_which_pm_runs.default)()) == null ? void 0 : _a.name) || "npm";
|
|
1434
|
+
}
|
|
1435
|
+
function pmRunCmd() {
|
|
1436
|
+
const pm = getPackageManager();
|
|
1437
|
+
if (pm !== "npm") {
|
|
1438
|
+
return pm;
|
|
1439
|
+
}
|
|
1440
|
+
return `${pm} run`;
|
|
1441
|
+
}
|
|
1442
|
+
function panic(msg) {
|
|
1443
|
+
console.error(`
|
|
1444
|
+
\u274C ${red(msg)}
|
|
1445
|
+
`);
|
|
1446
|
+
process.exit(1);
|
|
1447
|
+
}
|
|
1448
|
+
function bye() {
|
|
1449
|
+
$e("Take care, see you soon! \u{1F44B}");
|
|
1450
|
+
process.exit(0);
|
|
1451
|
+
}
|
|
1452
|
+
function printHeader() {
|
|
1453
|
+
console.log(
|
|
1454
|
+
blue(`
|
|
1455
|
+
${magenta("............")}
|
|
1456
|
+
.::: ${magenta(":--------:.")}
|
|
1457
|
+
.:::: ${magenta(".:-------:.")}
|
|
1458
|
+
.:::::. ${magenta(".:-------.")}
|
|
1459
|
+
::::::. ${magenta(".:------.")}
|
|
1460
|
+
::::::. ${magenta(":-----:")}
|
|
1461
|
+
::::::. ${magenta(".:-----.")}
|
|
1462
|
+
:::::::. ${magenta(".-----.")}
|
|
1463
|
+
::::::::.. ${magenta("---:.")}
|
|
1464
|
+
.:::::::::. ${magenta(":-:.")}
|
|
1465
|
+
..::::::::::::
|
|
1466
|
+
...::::
|
|
1467
|
+
`),
|
|
1468
|
+
"\n"
|
|
1469
|
+
);
|
|
1470
|
+
}
|
|
1471
|
+
async function getFilesDeep(root) {
|
|
1472
|
+
const files = [];
|
|
1473
|
+
async function getFiles(directory) {
|
|
1474
|
+
if (!import_node_fs2.default.existsSync(directory)) {
|
|
1475
|
+
return;
|
|
1476
|
+
}
|
|
1477
|
+
const filesInDirectory = await import_node_fs2.default.promises.readdir(directory);
|
|
1478
|
+
for (const file of filesInDirectory) {
|
|
1479
|
+
const absolute = (0, import_node_path2.join)(directory, file);
|
|
1480
|
+
if (import_node_fs2.default.statSync(absolute).isDirectory()) {
|
|
1481
|
+
await getFiles(absolute);
|
|
1482
|
+
} else {
|
|
1483
|
+
files.push(absolute);
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
await getFiles(root);
|
|
1488
|
+
return files;
|
|
1489
|
+
}
|
|
1490
|
+
function isUnicodeSupported() {
|
|
1491
|
+
if (process.platform !== "win32") {
|
|
1492
|
+
return process.env.TERM !== "linux";
|
|
1493
|
+
}
|
|
1494
|
+
return Boolean(process.env.CI) || Boolean(process.env.WT_SESSION) || // Windows Terminal
|
|
1495
|
+
Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
|
|
1496
|
+
process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
|
|
1497
|
+
process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1498
|
+
}
|
|
1499
|
+
var unicode = isUnicodeSupported();
|
|
1500
|
+
var s = (c2, fallback) => unicode ? c2 : fallback;
|
|
1501
|
+
var S_BAR = s("\u2502", "|");
|
|
1502
|
+
var S_BAR_H = s("\u2500", "-");
|
|
1503
|
+
var S_CORNER_TOP_RIGHT = s("\u256E", "+");
|
|
1504
|
+
var S_CONNECT_LEFT = s("\u251C", "+");
|
|
1505
|
+
var S_CORNER_BOTTOM_RIGHT = s("\u256F", "+");
|
|
1506
|
+
var S_STEP_SUBMIT = s("\u25C7", "o");
|
|
1507
|
+
function ansiRegex() {
|
|
1508
|
+
const pattern = [
|
|
1509
|
+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
1510
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
|
|
1511
|
+
].join("|");
|
|
1512
|
+
return new RegExp(pattern, "g");
|
|
1513
|
+
}
|
|
1514
|
+
var strip = (str) => str.replace(ansiRegex(), "");
|
|
1515
|
+
var note = (message = "", title = "") => {
|
|
1516
|
+
const lines = `
|
|
1517
|
+
${message}
|
|
1518
|
+
`.split("\n");
|
|
1519
|
+
const titleLen = strip(title).length;
|
|
1520
|
+
const len = Math.max(
|
|
1521
|
+
lines.reduce((sum, ln) => {
|
|
1522
|
+
ln = strip(ln);
|
|
1523
|
+
return ln.length > sum ? ln.length : sum;
|
|
1524
|
+
}, 0),
|
|
1525
|
+
titleLen
|
|
1526
|
+
) + 2;
|
|
1527
|
+
const msg = lines.map((ln) => `${gray(S_BAR)} ${white(ln)}${" ".repeat(len - strip(ln).length)}${gray(S_BAR)}`).join("\n");
|
|
1528
|
+
process.stdout.write(
|
|
1529
|
+
`${gray(S_BAR)}
|
|
1530
|
+
${green(S_STEP_SUBMIT)} ${reset(title)} ${gray(
|
|
1531
|
+
S_BAR_H.repeat(Math.max(len - titleLen - 1, 1)) + S_CORNER_TOP_RIGHT
|
|
1532
|
+
)}
|
|
1533
|
+
${msg}
|
|
1534
|
+
${gray(S_CONNECT_LEFT + S_BAR_H.repeat(len + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
1535
|
+
`
|
|
1536
|
+
);
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1539
|
+
// packages/qwik/src/cli/utils/integrations.ts
|
|
1540
|
+
var integrations = null;
|
|
1541
|
+
async function sortIntegrationsAndReturnAsClackOptions(integrations2, { maxHintLength = 50, showHint = true } = {}) {
|
|
1542
|
+
return integrations2.sort((a3, b3) => {
|
|
1543
|
+
if (a3.priority > b3.priority) {
|
|
1544
|
+
return -1;
|
|
1545
|
+
}
|
|
1546
|
+
if (a3.priority < b3.priority) {
|
|
1547
|
+
return 1;
|
|
1548
|
+
}
|
|
1549
|
+
return a3.id < b3.id ? -1 : 1;
|
|
1550
|
+
}).map((i) => ({
|
|
1551
|
+
value: i.id,
|
|
1552
|
+
label: i.name,
|
|
1553
|
+
hint: showHint && limitLength(i.pkgJson.description, maxHintLength) || void 0
|
|
1554
|
+
}));
|
|
1555
|
+
}
|
|
1556
|
+
async function loadIntegrations() {
|
|
1557
|
+
if (!integrations) {
|
|
1558
|
+
const loadingIntegrations = [];
|
|
1559
|
+
const integrationTypes = ["app", "feature", "adapter"];
|
|
1560
|
+
const integrationsDir = (0, import_node_path3.join)(__dirname, "starters");
|
|
1561
|
+
const integrationsDirNames = await import_node_fs3.default.promises.readdir(integrationsDir);
|
|
1562
|
+
await Promise.all(
|
|
1563
|
+
integrationsDirNames.map(async (integrationsDirName) => {
|
|
1564
|
+
const integrationType = integrationsDirName.slice(0, integrationsDirName.length - 1);
|
|
1565
|
+
if (integrationTypes.includes(integrationType)) {
|
|
1566
|
+
const dir = (0, import_node_path3.join)(integrationsDir, integrationsDirName);
|
|
1567
|
+
const dirItems = await import_node_fs3.default.promises.readdir(dir);
|
|
1568
|
+
await Promise.all(
|
|
1569
|
+
dirItems.map(async (dirItem) => {
|
|
1570
|
+
var _a, _b, _c;
|
|
1571
|
+
const dirPath = (0, import_node_path3.join)(dir, dirItem);
|
|
1572
|
+
const stat = await import_node_fs3.default.promises.stat(dirPath);
|
|
1573
|
+
if (stat.isDirectory()) {
|
|
1574
|
+
const pkgJson = await readPackageJson(dirPath);
|
|
1575
|
+
const integration = {
|
|
1576
|
+
id: dirItem,
|
|
1577
|
+
name: ((_a = pkgJson.__qwik__) == null ? void 0 : _a.displayName) ?? dashToTitleCase(dirItem),
|
|
1578
|
+
type: integrationType,
|
|
1579
|
+
dir: dirPath,
|
|
1580
|
+
pkgJson,
|
|
1581
|
+
docs: ((_b = pkgJson.__qwik__) == null ? void 0 : _b.docs) ?? [],
|
|
1582
|
+
priority: ((_c = pkgJson == null ? void 0 : pkgJson.__qwik__) == null ? void 0 : _c.priority) ?? 0
|
|
1583
|
+
};
|
|
1584
|
+
loadingIntegrations.push(integration);
|
|
1585
|
+
}
|
|
1586
|
+
})
|
|
1587
|
+
);
|
|
1588
|
+
}
|
|
1589
|
+
})
|
|
1590
|
+
);
|
|
1591
|
+
loadingIntegrations.sort((a3, b3) => {
|
|
1592
|
+
if (a3.priority > b3.priority) {
|
|
1593
|
+
return -1;
|
|
1594
|
+
}
|
|
1595
|
+
if (a3.priority < b3.priority) {
|
|
1596
|
+
return 1;
|
|
1597
|
+
}
|
|
1598
|
+
return a3.id < b3.id ? -1 : 1;
|
|
1599
|
+
});
|
|
1600
|
+
integrations = loadingIntegrations;
|
|
1601
|
+
}
|
|
1602
|
+
return integrations;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
// packages/qwik/src/cli/add/run-add-interactive.ts
|
|
1606
|
+
var import_node_path6 = require("node:path");
|
|
1607
|
+
|
|
1608
|
+
// packages/qwik/src/cli/utils/install-deps.ts
|
|
1609
|
+
function installDeps(pkgManager, dir) {
|
|
1610
|
+
return runCommand(pkgManager, ["install"], dir);
|
|
1611
|
+
}
|
|
1612
|
+
function runInPkg(pkgManager, args, cwd) {
|
|
1613
|
+
const cmd = pkgManager === "npm" ? "npx" : pkgManager;
|
|
1614
|
+
return runCommand(cmd, args, cwd);
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
// packages/qwik/src/cli/utils/log.ts
|
|
1618
|
+
function logNextStep(nextSteps, packageManager) {
|
|
1619
|
+
const outString = [];
|
|
1620
|
+
if (nextSteps) {
|
|
1621
|
+
nextSteps.lines.forEach(
|
|
1622
|
+
(step) => outString.push(`${step.replace(/\bpnpm\b/g, packageManager)}`)
|
|
1623
|
+
);
|
|
1624
|
+
}
|
|
1625
|
+
return outString.join("\n");
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
// packages/qwik/src/cli/add/update-app.ts
|
|
1629
|
+
var import_node_path5 = require("node:path");
|
|
1630
|
+
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
1631
|
+
|
|
1632
|
+
// packages/qwik/src/cli/add/update-files.ts
|
|
1633
|
+
var import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
1634
|
+
var import_node_path4 = require("node:path");
|
|
1635
|
+
async function mergeIntegrationDir(fileUpdates, opts, srcDir, destDir) {
|
|
1636
|
+
const items = await import_node_fs4.default.promises.readdir(srcDir);
|
|
1637
|
+
await Promise.all(
|
|
1638
|
+
items.map(async (itemName) => {
|
|
1639
|
+
const destName = itemName === "gitignore" ? ".gitignore" : itemName;
|
|
1640
|
+
const ext = (0, import_node_path4.extname)(destName);
|
|
1641
|
+
const srcChildPath = (0, import_node_path4.join)(srcDir, itemName);
|
|
1642
|
+
const destChildPath = (0, import_node_path4.join)(destDir, destName);
|
|
1643
|
+
const s2 = await import_node_fs4.default.promises.stat(srcChildPath);
|
|
1644
|
+
if (s2.isDirectory()) {
|
|
1645
|
+
await mergeIntegrationDir(fileUpdates, opts, srcChildPath, destChildPath);
|
|
1646
|
+
} else if (s2.isFile()) {
|
|
1647
|
+
if (destName === "package.json") {
|
|
1648
|
+
await mergePackageJsons(fileUpdates, srcChildPath, destChildPath);
|
|
1649
|
+
} else if (destName === "settings.json") {
|
|
1650
|
+
await mergeJsons(fileUpdates, srcChildPath, destChildPath);
|
|
1651
|
+
} else if (destName === "README.md") {
|
|
1652
|
+
await mergeReadmes(fileUpdates, srcChildPath, destChildPath);
|
|
1653
|
+
} else if (destName === ".gitignore" || destName === ".prettierignore" || destName === ".eslintignore") {
|
|
1654
|
+
await mergeIgnoresFile(fileUpdates, srcChildPath, destChildPath);
|
|
1655
|
+
} else if (ext === ".css") {
|
|
1656
|
+
await mergeCss(fileUpdates, srcChildPath, destChildPath, opts);
|
|
1657
|
+
} else if (import_node_fs4.default.existsSync(destChildPath)) {
|
|
1658
|
+
fileUpdates.files.push({
|
|
1659
|
+
path: destChildPath,
|
|
1660
|
+
content: await import_node_fs4.default.promises.readFile(srcChildPath),
|
|
1661
|
+
type: "overwrite"
|
|
1662
|
+
});
|
|
1663
|
+
} else {
|
|
1664
|
+
fileUpdates.files.push({
|
|
1665
|
+
path: destChildPath,
|
|
1666
|
+
content: await import_node_fs4.default.promises.readFile(srcChildPath),
|
|
1667
|
+
type: "create"
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
})
|
|
1672
|
+
);
|
|
1673
|
+
}
|
|
1674
|
+
async function mergePackageJsons(fileUpdates, srcPath, destPath) {
|
|
1675
|
+
var _a;
|
|
1676
|
+
const srcContent = await import_node_fs4.default.promises.readFile(srcPath, "utf-8");
|
|
1677
|
+
try {
|
|
1678
|
+
const srcPkgJson = JSON.parse(srcContent);
|
|
1679
|
+
const props = ["scripts", "dependencies", "devDependencies"];
|
|
1680
|
+
const destPkgJson = JSON.parse(await import_node_fs4.default.promises.readFile(destPath, "utf-8"));
|
|
1681
|
+
props.forEach((prop) => {
|
|
1682
|
+
mergePackageJsonSort(srcPkgJson, destPkgJson, prop);
|
|
1683
|
+
});
|
|
1684
|
+
if ((_a = destPkgJson.scripts) == null ? void 0 : _a.qwik) {
|
|
1685
|
+
const qwikVal = destPkgJson.scripts.qwik;
|
|
1686
|
+
delete destPkgJson.scripts.qwik;
|
|
1687
|
+
destPkgJson.scripts.qwik = qwikVal;
|
|
1688
|
+
}
|
|
1689
|
+
fileUpdates.files.push({
|
|
1690
|
+
path: destPath,
|
|
1691
|
+
content: JSON.stringify(destPkgJson, null, 2) + "\n",
|
|
1692
|
+
type: "modify"
|
|
1693
|
+
});
|
|
1694
|
+
} catch (e2) {
|
|
1695
|
+
fileUpdates.files.push({
|
|
1696
|
+
path: destPath,
|
|
1697
|
+
content: srcContent,
|
|
1698
|
+
type: "create"
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
async function mergeJsons(fileUpdates, srcPath, destPath) {
|
|
1703
|
+
const srcContent = await import_node_fs4.default.promises.readFile(srcPath, "utf-8");
|
|
1704
|
+
try {
|
|
1705
|
+
const srcPkgJson = JSON.parse(srcContent);
|
|
1706
|
+
const destPkgJson = JSON.parse(await import_node_fs4.default.promises.readFile(destPath, "utf-8"));
|
|
1707
|
+
Object.assign(srcPkgJson, destPkgJson);
|
|
1708
|
+
fileUpdates.files.push({
|
|
1709
|
+
path: destPath,
|
|
1710
|
+
content: JSON.stringify(srcPkgJson, null, 2) + "\n",
|
|
1711
|
+
type: "modify"
|
|
1712
|
+
});
|
|
1713
|
+
} catch (e2) {
|
|
1714
|
+
fileUpdates.files.push({
|
|
1715
|
+
path: destPath,
|
|
1716
|
+
content: srcContent,
|
|
1717
|
+
type: "create"
|
|
1718
|
+
});
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
function mergePackageJsonSort(src, dest, prop) {
|
|
1722
|
+
if (src[prop]) {
|
|
1723
|
+
if (dest[prop]) {
|
|
1724
|
+
Object.assign(dest[prop], { ...src[prop] });
|
|
1725
|
+
} else {
|
|
1726
|
+
dest[prop] = { ...src[prop] };
|
|
1727
|
+
}
|
|
1728
|
+
const sorted = {};
|
|
1729
|
+
const keys = Object.keys(dest[prop]).sort();
|
|
1730
|
+
for (const key of keys) {
|
|
1731
|
+
sorted[key] = dest[prop][key];
|
|
1732
|
+
}
|
|
1733
|
+
dest[prop] = sorted;
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
async function mergeReadmes(fileUpdates, srcPath, destPath) {
|
|
1737
|
+
const srcContent = await import_node_fs4.default.promises.readFile(srcPath, "utf-8");
|
|
1738
|
+
let type;
|
|
1739
|
+
let destContent = "";
|
|
1740
|
+
try {
|
|
1741
|
+
destContent = await import_node_fs4.default.promises.readFile(destPath, "utf-8");
|
|
1742
|
+
destContent = destContent.trim() + "\n\n" + srcContent;
|
|
1743
|
+
type = "modify";
|
|
1744
|
+
} catch (e2) {
|
|
1745
|
+
destContent = srcContent;
|
|
1746
|
+
type = "create";
|
|
1747
|
+
}
|
|
1748
|
+
const pkgManager = getPackageManager();
|
|
1749
|
+
if (pkgManager !== "npm") {
|
|
1750
|
+
destContent = destContent.replace(/\b(npm run|pnpm run|yarn( run)?)\b/g, pkgManager);
|
|
1751
|
+
}
|
|
1752
|
+
fileUpdates.files.push({
|
|
1753
|
+
path: destPath,
|
|
1754
|
+
content: destContent.trim() + "\n",
|
|
1755
|
+
type
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1758
|
+
async function mergeIgnoresFile(fileUpdates, srcPath, destPath) {
|
|
1759
|
+
const srcContent = await import_node_fs4.default.promises.readFile(srcPath, "utf-8");
|
|
1760
|
+
try {
|
|
1761
|
+
const destContent = await import_node_fs4.default.promises.readFile(destPath, "utf-8");
|
|
1762
|
+
const srcLines = srcContent.trim().split(/\r?\n/);
|
|
1763
|
+
const destLines = destContent.trim().split(/\r?\n/);
|
|
1764
|
+
for (const srcLine of srcLines) {
|
|
1765
|
+
if (!destLines.includes(srcLine)) {
|
|
1766
|
+
if (srcLine.startsWith("#")) {
|
|
1767
|
+
destLines.push("");
|
|
1768
|
+
}
|
|
1769
|
+
destLines.push(srcLine);
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
fileUpdates.files.push({
|
|
1773
|
+
path: destPath,
|
|
1774
|
+
content: destLines.join("\n").trim() + "\n",
|
|
1775
|
+
type: "modify"
|
|
1776
|
+
});
|
|
1777
|
+
} catch (e2) {
|
|
1778
|
+
fileUpdates.files.push({
|
|
1779
|
+
path: destPath,
|
|
1780
|
+
content: srcContent,
|
|
1781
|
+
type: "create"
|
|
1782
|
+
});
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
async function mergeCss(fileUpdates, srcPath, destPath, opts) {
|
|
1786
|
+
const srcContent = await import_node_fs4.default.promises.readFile(srcPath, "utf-8");
|
|
1787
|
+
try {
|
|
1788
|
+
const destContent = await import_node_fs4.default.promises.readFile(destPath, "utf-8");
|
|
1789
|
+
const mergedContent = srcContent.trim() + "\n\n" + destContent.trim() + "\n";
|
|
1790
|
+
const isAddingLibrary = opts.installDeps === true;
|
|
1791
|
+
fileUpdates.files.push({
|
|
1792
|
+
path: destPath,
|
|
1793
|
+
content: isAddingLibrary ? mergedContent : srcContent,
|
|
1794
|
+
type: isAddingLibrary ? "modify" : "overwrite"
|
|
1795
|
+
});
|
|
1796
|
+
} catch (e2) {
|
|
1797
|
+
fileUpdates.files.push({
|
|
1798
|
+
path: destPath,
|
|
1799
|
+
content: srcContent,
|
|
1800
|
+
type: "create"
|
|
1801
|
+
});
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
// packages/qwik/src/cli/add/update-vite-config.ts
|
|
1806
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
1807
|
+
var import_path = require("path");
|
|
1808
|
+
|
|
1809
|
+
// packages/qwik/src/cli/code-mod/code-mod.ts
|
|
1810
|
+
function updateViteConfig(ts, sourceText, updates) {
|
|
1811
|
+
if (!(updates == null ? void 0 : updates.imports) && !(updates == null ? void 0 : updates.qwikViteConfig) && !(updates == null ? void 0 : updates.viteConfig) && !(updates == null ? void 0 : updates.vitePlugins) && !(updates == null ? void 0 : updates.vitePluginsPrepend)) {
|
|
1812
|
+
return null;
|
|
1813
|
+
}
|
|
1814
|
+
sourceText = transformSource(ts, sourceText, () => (tsSourceFile) => {
|
|
1815
|
+
if (updates.imports) {
|
|
1816
|
+
for (const importData of updates.imports) {
|
|
1817
|
+
tsSourceFile = ensureImport(ts, tsSourceFile, importData);
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
const statements = [];
|
|
1821
|
+
for (const s2 of tsSourceFile.statements) {
|
|
1822
|
+
if (ts.isExportAssignment(s2) && s2.expression && ts.isCallExpression(s2.expression)) {
|
|
1823
|
+
if (ts.isIdentifier(s2.expression.expression) && s2.expression.expression.text === "defineConfig" && (updates.viteConfig || updates.qwikViteConfig || updates.vitePlugins || updates.vitePluginsPrepend)) {
|
|
1824
|
+
statements.push(
|
|
1825
|
+
ts.factory.updateExportAssignment(
|
|
1826
|
+
s2,
|
|
1827
|
+
s2.modifiers,
|
|
1828
|
+
updateDefineConfig(ts, s2.expression, updates)
|
|
1829
|
+
)
|
|
1830
|
+
);
|
|
1831
|
+
continue;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
statements.push(s2);
|
|
1835
|
+
}
|
|
1836
|
+
return ts.factory.updateSourceFile(tsSourceFile, statements);
|
|
1837
|
+
});
|
|
1838
|
+
return sourceText;
|
|
1839
|
+
}
|
|
1840
|
+
function ensureImport(ts, tsSourceFile, importData) {
|
|
1841
|
+
if (importData && importData.importPath) {
|
|
1842
|
+
if (Array.isArray(importData.namedImports)) {
|
|
1843
|
+
importData.namedImports.forEach((namedImport) => {
|
|
1844
|
+
tsSourceFile = ensureNamedImport(ts, tsSourceFile, namedImport, importData.importPath);
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
if (typeof importData.defaultImport === "string") {
|
|
1848
|
+
tsSourceFile = ensureDefaultImport(
|
|
1849
|
+
ts,
|
|
1850
|
+
tsSourceFile,
|
|
1851
|
+
importData.defaultImport,
|
|
1852
|
+
importData.importPath
|
|
1853
|
+
);
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
return tsSourceFile;
|
|
1857
|
+
}
|
|
1858
|
+
function ensureNamedImport(ts, tsSourceFile, namedImport, importPath) {
|
|
1859
|
+
if (!hasNamedImport(ts, tsSourceFile, namedImport, importPath)) {
|
|
1860
|
+
tsSourceFile = appendImports(ts, tsSourceFile, null, namedImport, importPath);
|
|
1861
|
+
}
|
|
1862
|
+
return tsSourceFile;
|
|
1863
|
+
}
|
|
1864
|
+
function ensureDefaultImport(ts, tsSourceFile, defaultImport, importPath) {
|
|
1865
|
+
if (!hasDefaultImport(ts, tsSourceFile, importPath)) {
|
|
1866
|
+
tsSourceFile = appendImports(ts, tsSourceFile, defaultImport, null, importPath);
|
|
1867
|
+
}
|
|
1868
|
+
return tsSourceFile;
|
|
1869
|
+
}
|
|
1870
|
+
function hasNamedImport(ts, tsSourceFile, namedImport, importPath) {
|
|
1871
|
+
return !!findNamedImport(ts, tsSourceFile, namedImport, importPath);
|
|
1872
|
+
}
|
|
1873
|
+
function hasDefaultImport(ts, tsSourceFile, importPath) {
|
|
1874
|
+
return !!findDefaultImport(ts, tsSourceFile, importPath);
|
|
1875
|
+
}
|
|
1876
|
+
function findNamedImport(ts, tsSourceFile, namedImport, importPath) {
|
|
1877
|
+
return findImportDeclarations(ts, tsSourceFile).find((n) => {
|
|
1878
|
+
if (n.importClause && n.moduleSpecifier && ts.isStringLiteral(n.moduleSpecifier)) {
|
|
1879
|
+
if (n.moduleSpecifier.text !== importPath) {
|
|
1880
|
+
return false;
|
|
1881
|
+
}
|
|
1882
|
+
const namedImports = n.importClause.namedBindings;
|
|
1883
|
+
if (namedImports && ts.isNamedImports(namedImports) && namedImports.elements) {
|
|
1884
|
+
return namedImports.elements.some((namedImportElement) => {
|
|
1885
|
+
if (ts.isImportSpecifier(namedImportElement)) {
|
|
1886
|
+
const importName = namedImportElement.name;
|
|
1887
|
+
if (importName && ts.isIdentifier(importName)) {
|
|
1888
|
+
return importName.text === namedImport;
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
return false;
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
return false;
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
function findDefaultImport(ts, tsSourceFile, importPath) {
|
|
1899
|
+
return findImportDeclarations(ts, tsSourceFile).find((n) => {
|
|
1900
|
+
if (n.importClause && n.moduleSpecifier) {
|
|
1901
|
+
const modulePath = n.moduleSpecifier;
|
|
1902
|
+
if (ts.isStringLiteral(modulePath) && modulePath.text === importPath) {
|
|
1903
|
+
const moduleDefault = n.importClause.name;
|
|
1904
|
+
if (moduleDefault && moduleDefault.text === importPath) {
|
|
1905
|
+
return true;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
return false;
|
|
1910
|
+
});
|
|
1911
|
+
}
|
|
1912
|
+
function findImportDeclarations(ts, tsSourceFile) {
|
|
1913
|
+
return tsSourceFile.statements.filter(ts.isImportDeclaration);
|
|
1914
|
+
}
|
|
1915
|
+
function appendImports(ts, tsSourceFile, defaultImport, namedImport, importPath) {
|
|
1916
|
+
const statements = tsSourceFile.statements.slice();
|
|
1917
|
+
let foundExistingImport = false;
|
|
1918
|
+
for (let i = statements.length - 1; i >= 0; i--) {
|
|
1919
|
+
const n = statements[i];
|
|
1920
|
+
if (!ts.isImportDeclaration(n)) {
|
|
1921
|
+
continue;
|
|
1922
|
+
}
|
|
1923
|
+
if (!n.moduleSpecifier || !ts.isStringLiteral(n.moduleSpecifier)) {
|
|
1924
|
+
continue;
|
|
1925
|
+
}
|
|
1926
|
+
if (n.moduleSpecifier.text !== importPath) {
|
|
1927
|
+
continue;
|
|
1928
|
+
}
|
|
1929
|
+
foundExistingImport = true;
|
|
1930
|
+
const existingNamedImports = [];
|
|
1931
|
+
if (n.importClause) {
|
|
1932
|
+
const namedImports = n.importClause.namedBindings;
|
|
1933
|
+
if (namedImports && ts.isNamedImports(namedImports) && namedImports.elements) {
|
|
1934
|
+
existingNamedImports.push(...namedImports.elements);
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
if (typeof namedImport === "string") {
|
|
1938
|
+
const identifier = ts.factory.createIdentifier(namedImport);
|
|
1939
|
+
const importSpecifier = ts.factory.createImportSpecifier(false, void 0, identifier);
|
|
1940
|
+
existingNamedImports.push(importSpecifier);
|
|
1941
|
+
}
|
|
1942
|
+
existingNamedImports.sort((a3, b3) => {
|
|
1943
|
+
const aName = a3.name.escapedText.toString();
|
|
1944
|
+
const bName = b3.name.escapedText.toString();
|
|
1945
|
+
return aName < bName ? -1 : 1;
|
|
1946
|
+
});
|
|
1947
|
+
let defaultIdentifier = n.importClause ? n.importClause.name : void 0;
|
|
1948
|
+
if (typeof defaultImport === "string") {
|
|
1949
|
+
defaultIdentifier = ts.factory.createIdentifier(defaultImport);
|
|
1950
|
+
}
|
|
1951
|
+
let namedBindings = void 0;
|
|
1952
|
+
if (existingNamedImports.length > 0) {
|
|
1953
|
+
namedBindings = ts.factory.createNamedImports(existingNamedImports);
|
|
1954
|
+
}
|
|
1955
|
+
statements[i] = ts.factory.updateImportDeclaration(
|
|
1956
|
+
n,
|
|
1957
|
+
void 0,
|
|
1958
|
+
ts.factory.createImportClause(false, defaultIdentifier, namedBindings),
|
|
1959
|
+
n.moduleSpecifier,
|
|
1960
|
+
void 0
|
|
1961
|
+
);
|
|
1962
|
+
}
|
|
1963
|
+
if (!foundExistingImport) {
|
|
1964
|
+
let defaultIdentifier = void 0;
|
|
1965
|
+
let namedBindings = void 0;
|
|
1966
|
+
if (typeof defaultImport === "string") {
|
|
1967
|
+
defaultIdentifier = ts.factory.createIdentifier(defaultImport);
|
|
1968
|
+
}
|
|
1969
|
+
if (typeof namedImport === "string") {
|
|
1970
|
+
namedBindings = ts.factory.createNamedImports([
|
|
1971
|
+
ts.factory.createImportSpecifier(
|
|
1972
|
+
false,
|
|
1973
|
+
void 0,
|
|
1974
|
+
ts.factory.createIdentifier(namedImport)
|
|
1975
|
+
)
|
|
1976
|
+
]);
|
|
1977
|
+
}
|
|
1978
|
+
const newNamedImport = ts.factory.createImportDeclaration(
|
|
1979
|
+
void 0,
|
|
1980
|
+
ts.factory.createImportClause(false, defaultIdentifier, namedBindings),
|
|
1981
|
+
ts.factory.createStringLiteral(importPath)
|
|
1982
|
+
);
|
|
1983
|
+
const lastImportIndex = findLastImportIndex(ts, tsSourceFile);
|
|
1984
|
+
statements.splice(lastImportIndex + 1, 0, newNamedImport);
|
|
1985
|
+
}
|
|
1986
|
+
return ts.factory.updateSourceFile(tsSourceFile, statements);
|
|
1987
|
+
}
|
|
1988
|
+
function findLastImportIndex(ts, tsSourceFile) {
|
|
1989
|
+
for (let i = tsSourceFile.statements.length - 1; i >= 0; i--) {
|
|
1990
|
+
const s2 = tsSourceFile.statements[i];
|
|
1991
|
+
if (ts.isImportDeclaration(s2)) {
|
|
1992
|
+
return i;
|
|
1993
|
+
}
|
|
1994
|
+
if (ts.isStringLiteral(s2) && s2.text === "use strict") {
|
|
1995
|
+
return i;
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
return 0;
|
|
1999
|
+
}
|
|
2000
|
+
function updateDefineConfig(ts, callExp, updates) {
|
|
2001
|
+
const args = [];
|
|
2002
|
+
for (let i = 0; i < callExp.arguments.length; i++) {
|
|
2003
|
+
const exp = callExp.arguments[i];
|
|
2004
|
+
if (i === 0) {
|
|
2005
|
+
if (ts.isArrowFunction(exp) && ts.isBlock(exp.body)) {
|
|
2006
|
+
args.push(
|
|
2007
|
+
ts.factory.updateArrowFunction(
|
|
2008
|
+
exp,
|
|
2009
|
+
exp.modifiers,
|
|
2010
|
+
exp.typeParameters,
|
|
2011
|
+
exp.parameters,
|
|
2012
|
+
exp.type,
|
|
2013
|
+
exp.equalsGreaterThanToken,
|
|
2014
|
+
updateDefineConfigFnReturn(ts, exp.body, updates)
|
|
2015
|
+
)
|
|
2016
|
+
);
|
|
2017
|
+
continue;
|
|
2018
|
+
}
|
|
2019
|
+
if (ts.isFunctionExpression(exp) && ts.isBlock(exp.body)) {
|
|
2020
|
+
args.push(
|
|
2021
|
+
ts.factory.updateFunctionExpression(
|
|
2022
|
+
exp,
|
|
2023
|
+
exp.modifiers,
|
|
2024
|
+
exp.asteriskToken,
|
|
2025
|
+
exp.name,
|
|
2026
|
+
exp.typeParameters,
|
|
2027
|
+
exp.parameters,
|
|
2028
|
+
exp.type,
|
|
2029
|
+
updateDefineConfigFnReturn(ts, exp.body, updates)
|
|
2030
|
+
)
|
|
2031
|
+
);
|
|
2032
|
+
continue;
|
|
2033
|
+
}
|
|
2034
|
+
if (ts.isObjectLiteralExpression(exp)) {
|
|
2035
|
+
args.push(updateVitConfigObj(ts, exp, updates));
|
|
2036
|
+
continue;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
args.push(exp);
|
|
2040
|
+
}
|
|
2041
|
+
return ts.factory.updateCallExpression(callExp, callExp.expression, callExp.typeArguments, args);
|
|
2042
|
+
}
|
|
2043
|
+
function updateDefineConfigFnReturn(ts, fnBody, updates) {
|
|
2044
|
+
const statements = [];
|
|
2045
|
+
for (const s2 of fnBody.statements) {
|
|
2046
|
+
if (ts.isReturnStatement(s2) && s2.expression && ts.isObjectLiteralExpression(s2.expression)) {
|
|
2047
|
+
statements.push(
|
|
2048
|
+
ts.factory.updateReturnStatement(s2, updateVitConfigObj(ts, s2.expression, updates))
|
|
2049
|
+
);
|
|
2050
|
+
} else {
|
|
2051
|
+
statements.push(s2);
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
return ts.factory.updateBlock(fnBody, statements);
|
|
2055
|
+
}
|
|
2056
|
+
function updateVitConfigObj(ts, obj, updates) {
|
|
2057
|
+
if (updates.viteConfig) {
|
|
2058
|
+
obj = updateObjectLiteralExpression(ts, obj, updates.viteConfig);
|
|
2059
|
+
}
|
|
2060
|
+
if (updates.vitePlugins || updates.vitePluginsPrepend || updates.qwikViteConfig) {
|
|
2061
|
+
obj = updatePlugins(ts, obj, updates);
|
|
2062
|
+
}
|
|
2063
|
+
return obj;
|
|
2064
|
+
}
|
|
2065
|
+
function updatePlugins(ts, obj, updates) {
|
|
2066
|
+
const properties = [];
|
|
2067
|
+
for (const p of obj.properties) {
|
|
2068
|
+
if (ts.isPropertyAssignment(p)) {
|
|
2069
|
+
if (p.name && ts.isIdentifier(p.name) && p.name.text === "plugins") {
|
|
2070
|
+
if (ts.isArrayLiteralExpression(p.initializer)) {
|
|
2071
|
+
properties.push(
|
|
2072
|
+
ts.factory.updatePropertyAssignment(
|
|
2073
|
+
p,
|
|
2074
|
+
p.name,
|
|
2075
|
+
updatePluginsArray(ts, p.initializer, updates)
|
|
2076
|
+
)
|
|
2077
|
+
);
|
|
2078
|
+
continue;
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
properties.push(p);
|
|
2083
|
+
}
|
|
2084
|
+
return ts.factory.updateObjectLiteralExpression(obj, properties);
|
|
2085
|
+
}
|
|
2086
|
+
function updatePluginsArray(ts, arr, updates) {
|
|
2087
|
+
var _a, _b;
|
|
2088
|
+
const elms = [...arr.elements];
|
|
2089
|
+
if (updates.vitePlugins) {
|
|
2090
|
+
for (const vitePlugin of updates.vitePlugins) {
|
|
2091
|
+
const pluginExp = createPluginCall(ts, vitePlugin);
|
|
2092
|
+
const pluginName = (_a = pluginExp == null ? void 0 : pluginExp.expression) == null ? void 0 : _a.escapedText;
|
|
2093
|
+
const alreadyDefined = elms.some(
|
|
2094
|
+
(el) => ts.isCallExpression(el) && ts.isIdentifier(el.expression) && el.expression.escapedText === pluginName
|
|
2095
|
+
);
|
|
2096
|
+
if (pluginExp && !alreadyDefined) {
|
|
2097
|
+
elms.push(pluginExp);
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
if (updates.vitePluginsPrepend) {
|
|
2102
|
+
for (const vitePlugin of updates.vitePluginsPrepend) {
|
|
2103
|
+
const pluginExp = createPluginCall(ts, vitePlugin);
|
|
2104
|
+
const pluginName = (_b = pluginExp == null ? void 0 : pluginExp.expression) == null ? void 0 : _b.escapedText;
|
|
2105
|
+
const alreadyDefined = elms.some(
|
|
2106
|
+
(el) => ts.isCallExpression(el) && ts.isIdentifier(el.expression) && el.expression.escapedText === pluginName
|
|
2107
|
+
);
|
|
2108
|
+
if (pluginExp && !alreadyDefined) {
|
|
2109
|
+
elms.unshift(pluginExp);
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
if (updates.qwikViteConfig) {
|
|
2114
|
+
for (let i = 0; i < elms.length; i++) {
|
|
2115
|
+
const elm = elms[i];
|
|
2116
|
+
if (ts.isCallExpression(elm) && ts.isIdentifier(elm.expression)) {
|
|
2117
|
+
if (elm.expression.escapedText === "qwikVite") {
|
|
2118
|
+
elms[i] = updateQwikRouterPlugin(ts, elm, updates.qwikViteConfig);
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
return ts.factory.updateArrayLiteralExpression(arr, elms);
|
|
2124
|
+
}
|
|
2125
|
+
function createPluginCall(ts, vitePlugin) {
|
|
2126
|
+
if (typeof vitePlugin === "string") {
|
|
2127
|
+
const tmp = ts.createSourceFile(
|
|
2128
|
+
"tmp.ts",
|
|
2129
|
+
"export default " + vitePlugin,
|
|
2130
|
+
ts.ScriptTarget.Latest
|
|
2131
|
+
);
|
|
2132
|
+
for (const s2 of tmp.statements) {
|
|
2133
|
+
if (ts.isExportAssignment(s2)) {
|
|
2134
|
+
return s2.expression;
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
return null;
|
|
2139
|
+
}
|
|
2140
|
+
function updateQwikRouterPlugin(ts, callExp, qwikViteConfig) {
|
|
2141
|
+
const args = callExp.arguments.slice();
|
|
2142
|
+
const config = args[0] && ts.isObjectLiteralExpression(args[0]) ? args[0] : ts.factory.createObjectLiteralExpression();
|
|
2143
|
+
args[0] = updateObjectLiteralExpression(ts, config, qwikViteConfig);
|
|
2144
|
+
return ts.factory.updateCallExpression(callExp, callExp.expression, callExp.typeArguments, args);
|
|
2145
|
+
}
|
|
2146
|
+
function updateObjectLiteralExpression(ts, obj, updateObj) {
|
|
2147
|
+
for (const [propName, value] of Object.entries(updateObj)) {
|
|
2148
|
+
if (typeof value === "string") {
|
|
2149
|
+
const tmp = ts.createSourceFile("tmp.ts", "export default " + value, ts.ScriptTarget.Latest);
|
|
2150
|
+
for (const s2 of tmp.statements) {
|
|
2151
|
+
if (ts.isExportAssignment(s2)) {
|
|
2152
|
+
const exp = s2.expression;
|
|
2153
|
+
let added = false;
|
|
2154
|
+
const properties = [];
|
|
2155
|
+
for (const p of obj.properties) {
|
|
2156
|
+
if (p.name && ts.isIdentifier(p.name) && p.name.text === propName) {
|
|
2157
|
+
properties.push(ts.factory.createPropertyAssignment(propName, exp));
|
|
2158
|
+
added = true;
|
|
2159
|
+
} else {
|
|
2160
|
+
properties.push(p);
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
if (!added) {
|
|
2164
|
+
properties.unshift(ts.factory.createPropertyAssignment(propName, exp));
|
|
2165
|
+
}
|
|
2166
|
+
obj = ts.factory.updateObjectLiteralExpression(obj, properties);
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
return obj;
|
|
2172
|
+
}
|
|
2173
|
+
function transformSource(ts, sourceText, transformer) {
|
|
2174
|
+
const t = ts.transform(ts.createSourceFile("/tmp.ts", sourceText, ts.ScriptTarget.Latest), [
|
|
2175
|
+
transformer
|
|
2176
|
+
]);
|
|
2177
|
+
const p = ts.createPrinter({
|
|
2178
|
+
removeComments: false,
|
|
2179
|
+
omitTrailingSemicolon: false,
|
|
2180
|
+
noEmitHelpers: true
|
|
2181
|
+
});
|
|
2182
|
+
return p.printFile(t.transformed[0]);
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
// packages/qwik/src/cli/add/update-vite-config.ts
|
|
2186
|
+
async function updateViteConfigs(fileUpdates, integration, rootDir) {
|
|
2187
|
+
var _a;
|
|
2188
|
+
try {
|
|
2189
|
+
const viteConfig = (_a = integration.pkgJson.__qwik__) == null ? void 0 : _a.viteConfig;
|
|
2190
|
+
if (viteConfig) {
|
|
2191
|
+
let viteConfigPath = (0, import_path.join)(rootDir, "vite.config.ts");
|
|
2192
|
+
if (!import_fs.default.existsSync(viteConfigPath)) {
|
|
2193
|
+
viteConfigPath = (0, import_path.join)(rootDir, "vite.config.mts");
|
|
2194
|
+
}
|
|
2195
|
+
if (!import_fs.default.existsSync(viteConfigPath)) {
|
|
2196
|
+
throw new Error(`Could not find vite.config.ts or vite.config.mts in ${rootDir}`);
|
|
2197
|
+
}
|
|
2198
|
+
const destContent = await import_fs.default.promises.readFile(viteConfigPath, "utf-8");
|
|
2199
|
+
const ts = (await import("typescript")).default;
|
|
2200
|
+
let updatedContent = updateViteConfig(ts, destContent, viteConfig);
|
|
2201
|
+
if (updatedContent) {
|
|
2202
|
+
try {
|
|
2203
|
+
const prettier = (await import("prettier")).default;
|
|
2204
|
+
let prettierOpts = {
|
|
2205
|
+
filepath: viteConfigPath
|
|
2206
|
+
};
|
|
2207
|
+
const opts = await prettier.resolveConfig(viteConfigPath);
|
|
2208
|
+
if (opts) {
|
|
2209
|
+
prettierOpts = { ...opts, ...prettierOpts };
|
|
2210
|
+
}
|
|
2211
|
+
updatedContent = await prettier.format(updatedContent, prettierOpts);
|
|
2212
|
+
updatedContent = updatedContent.replace(`export default`, `
|
|
2213
|
+
export default`);
|
|
2214
|
+
} catch (e2) {
|
|
2215
|
+
console.error(e2);
|
|
2216
|
+
}
|
|
2217
|
+
fileUpdates.files.push({
|
|
2218
|
+
path: viteConfigPath,
|
|
2219
|
+
content: updatedContent,
|
|
2220
|
+
type: "modify"
|
|
2221
|
+
});
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
} catch (e2) {
|
|
2225
|
+
panic(String(e2));
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
// packages/qwik/src/cli/add/update-app.ts
|
|
2230
|
+
async function updateApp(pkgManager, opts) {
|
|
2231
|
+
const integrations2 = await loadIntegrations();
|
|
2232
|
+
const integration = integrations2.find((s2) => s2.id === opts.integration);
|
|
2233
|
+
if (!integration) {
|
|
2234
|
+
throw new Error(`Unable to find integration "${opts.integration}"`);
|
|
2235
|
+
}
|
|
2236
|
+
const fileUpdates = {
|
|
2237
|
+
files: [],
|
|
2238
|
+
installedDeps: {},
|
|
2239
|
+
installedScripts: Object.keys(integration.pkgJson.scripts || {})
|
|
2240
|
+
};
|
|
2241
|
+
if (opts.installDeps) {
|
|
2242
|
+
fileUpdates.installedDeps = {
|
|
2243
|
+
...integration.pkgJson.dependencies,
|
|
2244
|
+
...integration.pkgJson.devDependencies
|
|
2245
|
+
};
|
|
2246
|
+
}
|
|
2247
|
+
await mergeIntegrationDir(fileUpdates, opts, integration.dir, opts.rootDir);
|
|
2248
|
+
if (true) {
|
|
2249
|
+
await updateViteConfigs(fileUpdates, integration, opts.rootDir);
|
|
2250
|
+
}
|
|
2251
|
+
const commit = async (showSpinner) => {
|
|
2252
|
+
const isInstallingDeps = Object.keys(fileUpdates.installedDeps).length > 0;
|
|
2253
|
+
const s2 = de();
|
|
2254
|
+
if (showSpinner) {
|
|
2255
|
+
s2.start(`Updating app${isInstallingDeps ? " and installing dependencies" : ""}...`);
|
|
2256
|
+
}
|
|
2257
|
+
let passed = true;
|
|
2258
|
+
try {
|
|
2259
|
+
const dirs = new Set(fileUpdates.files.map((f3) => (0, import_node_path5.dirname)(f3.path)));
|
|
2260
|
+
for (const dir of Array.from(dirs)) {
|
|
2261
|
+
try {
|
|
2262
|
+
import_node_fs5.default.mkdirSync(dir, { recursive: true });
|
|
2263
|
+
} catch (e2) {
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
const fsWrites = Promise.all(
|
|
2267
|
+
fileUpdates.files.map(async (f3) => {
|
|
2268
|
+
await import_node_fs5.default.promises.writeFile(f3.path, f3.content);
|
|
2269
|
+
})
|
|
2270
|
+
);
|
|
2271
|
+
if (opts.installDeps && Object.keys(fileUpdates.installedDeps).length > 0) {
|
|
2272
|
+
const { install } = installDeps(pkgManager, opts.rootDir);
|
|
2273
|
+
passed = await install;
|
|
2274
|
+
}
|
|
2275
|
+
await fsWrites;
|
|
2276
|
+
showSpinner && s2.stop("App updated");
|
|
2277
|
+
if (!passed) {
|
|
2278
|
+
const errorMessage = `${bgRed(
|
|
2279
|
+
` ${pkgManager} install failed `
|
|
2280
|
+
)}
|
|
2281
|
+
You might need to run "${cyan(
|
|
2282
|
+
`${pkgManager} install`
|
|
2283
|
+
)}" manually inside the root of the project.`;
|
|
2284
|
+
f2.error(errorMessage);
|
|
2285
|
+
}
|
|
2286
|
+
} catch (e2) {
|
|
2287
|
+
showSpinner && s2.stop("App updated");
|
|
2288
|
+
panic(String(e2));
|
|
2289
|
+
}
|
|
2290
|
+
};
|
|
2291
|
+
const result = {
|
|
2292
|
+
rootDir: opts.rootDir,
|
|
2293
|
+
integration,
|
|
2294
|
+
updates: fileUpdates,
|
|
2295
|
+
commit
|
|
2296
|
+
};
|
|
2297
|
+
return result;
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
// packages/qwik/src/cli/add/run-add-interactive.ts
|
|
2301
|
+
async function runAddInteractive(app, id) {
|
|
2302
|
+
var _a;
|
|
2303
|
+
const pkgManager = getPackageManager();
|
|
2304
|
+
const integrations2 = await loadIntegrations();
|
|
2305
|
+
let integration;
|
|
2306
|
+
printHeader();
|
|
2307
|
+
if (typeof id === "string") {
|
|
2308
|
+
integration = integrations2.find((i) => i.id === id);
|
|
2309
|
+
if (!integration) {
|
|
2310
|
+
throw new Error(`Invalid integration: ${id}`);
|
|
2311
|
+
}
|
|
2312
|
+
oe(`\u{1F98B} ${bgBlue(` Add Integration `)} ${bold(magenta(integration.id))}`);
|
|
2313
|
+
} else {
|
|
2314
|
+
oe(`\u{1F98B} ${bgBlue(` Add Integration `)}`);
|
|
2315
|
+
const integrationChoices = [
|
|
2316
|
+
...integrations2.filter((i) => i.type === "adapter"),
|
|
2317
|
+
...integrations2.filter((i) => i.type === "feature")
|
|
2318
|
+
];
|
|
2319
|
+
const integrationAnswer = await ie({
|
|
2320
|
+
message: "What integration would you like to add?",
|
|
2321
|
+
options: await sortIntegrationsAndReturnAsClackOptions(integrationChoices)
|
|
2322
|
+
});
|
|
2323
|
+
if (hD(integrationAnswer)) {
|
|
2324
|
+
bye();
|
|
2325
|
+
}
|
|
2326
|
+
integration = integrations2.find((i) => i.id === integrationAnswer);
|
|
2327
|
+
if (!integration) {
|
|
2328
|
+
throw new Error(`Invalid integration: ${id}`);
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
const integrationHasDeps = Object.keys({
|
|
2332
|
+
...integration.pkgJson.dependencies,
|
|
2333
|
+
...integration.pkgJson.devDependencies
|
|
2334
|
+
}).length > 0;
|
|
2335
|
+
let runInstall = false;
|
|
2336
|
+
if (integrationHasDeps) {
|
|
2337
|
+
runInstall = true;
|
|
2338
|
+
}
|
|
2339
|
+
const result = await updateApp(pkgManager, {
|
|
2340
|
+
rootDir: app.rootDir,
|
|
2341
|
+
integration: integration.id,
|
|
2342
|
+
installDeps: runInstall
|
|
2343
|
+
});
|
|
2344
|
+
if (app.getArg("skipConfirmation") !== "true") {
|
|
2345
|
+
await logUpdateAppResult(pkgManager, result);
|
|
2346
|
+
}
|
|
2347
|
+
await result.commit(true);
|
|
2348
|
+
const postInstall = (_a = result.integration.pkgJson.__qwik__) == null ? void 0 : _a.postInstall;
|
|
2349
|
+
if (postInstall) {
|
|
2350
|
+
const s2 = de();
|
|
2351
|
+
s2.start(`Running post install script: ${postInstall}`);
|
|
2352
|
+
await runInPkg(pkgManager, postInstall.split(" "), app.rootDir);
|
|
2353
|
+
s2.stop("Post install script complete");
|
|
2354
|
+
}
|
|
2355
|
+
logUpdateAppCommitResult(result, pkgManager);
|
|
2356
|
+
process.exit(0);
|
|
2357
|
+
}
|
|
2358
|
+
async function logUpdateAppResult(pkgManager, result) {
|
|
2359
|
+
const modifyFiles = result.updates.files.filter((f3) => f3.type === "modify");
|
|
2360
|
+
const overwriteFiles = result.updates.files.filter((f3) => f3.type === "overwrite");
|
|
2361
|
+
const createFiles = result.updates.files.filter((f3) => f3.type === "create");
|
|
2362
|
+
const installDepNames = Object.keys(result.updates.installedDeps);
|
|
2363
|
+
const installScripts = result.updates.installedScripts;
|
|
2364
|
+
const installDeps2 = installDepNames.length > 0;
|
|
2365
|
+
if (modifyFiles.length === 0 && overwriteFiles.length === 0 && createFiles.length === 0 && installScripts.length === 0 && !installDeps2) {
|
|
2366
|
+
panic(`No updates made`);
|
|
2367
|
+
}
|
|
2368
|
+
f2.step(`\u{1F47B} ${bgBlue(` Ready? `)} Add ${bold(magenta(result.integration.id))} to your app?`);
|
|
2369
|
+
if (modifyFiles.length > 0) {
|
|
2370
|
+
f2.message(
|
|
2371
|
+
[
|
|
2372
|
+
`\u{1F42C} ${cyan("Modify")}`,
|
|
2373
|
+
...modifyFiles.map((f3) => ` - ${(0, import_node_path6.relative)(process.cwd(), f3.path)}`)
|
|
2374
|
+
].join("\n")
|
|
2375
|
+
);
|
|
2376
|
+
}
|
|
2377
|
+
if (createFiles.length > 0) {
|
|
2378
|
+
f2.message(
|
|
2379
|
+
[
|
|
2380
|
+
`\u{1F31F} ${cyan(`Create`)}`,
|
|
2381
|
+
...createFiles.map((f3) => ` - ${(0, import_node_path6.relative)(process.cwd(), f3.path)}`)
|
|
2382
|
+
].join("\n")
|
|
2383
|
+
);
|
|
2384
|
+
}
|
|
2385
|
+
if (overwriteFiles.length > 0) {
|
|
2386
|
+
f2.message(
|
|
2387
|
+
[
|
|
2388
|
+
`\u{1F433} ${cyan(`Overwrite`)}`,
|
|
2389
|
+
...overwriteFiles.map((f3) => ` - ${(0, import_node_path6.relative)(process.cwd(), f3.path)}`)
|
|
2390
|
+
].join("\n")
|
|
2391
|
+
);
|
|
2392
|
+
}
|
|
2393
|
+
if (installDepNames.length > 0) {
|
|
2394
|
+
f2.message(
|
|
2395
|
+
[
|
|
2396
|
+
`\u{1F4BE} ${cyan(`Install ${pkgManager} dependenc${installDepNames.length > 1 ? "ies" : "y"}:`)}`,
|
|
2397
|
+
...installDepNames.map(
|
|
2398
|
+
(depName) => ` - ${depName} ${result.updates.installedDeps[depName]}`
|
|
2399
|
+
)
|
|
2400
|
+
].join("\n")
|
|
2401
|
+
);
|
|
2402
|
+
}
|
|
2403
|
+
if (installScripts.length > 0) {
|
|
2404
|
+
const prefix = pkgManager === "npm" ? "npm run" : pkgManager;
|
|
2405
|
+
f2.message(
|
|
2406
|
+
[
|
|
2407
|
+
`\u{1F4DC} ${cyan(`New ${pkgManager} script${installDepNames.length > 1 ? "s" : ""}:`)}`,
|
|
2408
|
+
...installScripts.map((script) => ` - ${prefix} ${script}`)
|
|
2409
|
+
].join("\n")
|
|
2410
|
+
);
|
|
2411
|
+
}
|
|
2412
|
+
const commit = await ie({
|
|
2413
|
+
message: `Ready to apply the ${bold(magenta(result.integration.id))} updates to your app?`,
|
|
2414
|
+
options: [
|
|
2415
|
+
{ label: "Yes looks good, finish update!", value: true },
|
|
2416
|
+
{ label: "Nope, cancel update", value: false }
|
|
2417
|
+
]
|
|
2418
|
+
});
|
|
2419
|
+
if (hD(commit) || !commit) {
|
|
2420
|
+
bye();
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
function logUpdateAppCommitResult(result, pkgManager) {
|
|
2424
|
+
var _a;
|
|
2425
|
+
if (result.updates.installedScripts.length > 0) {
|
|
2426
|
+
const prefix = pkgManager === "npm" || pkgManager === "bun" ? `${pkgManager} run` : pkgManager;
|
|
2427
|
+
const message = result.updates.installedScripts.map((script) => `- ${prefix} ${blue(script)}`).join("\n");
|
|
2428
|
+
note(message, "New scripts added");
|
|
2429
|
+
}
|
|
2430
|
+
const nextSteps = (_a = result.integration.pkgJson.__qwik__) == null ? void 0 : _a.nextSteps;
|
|
2431
|
+
if (nextSteps) {
|
|
2432
|
+
const noteMessage = `\u{1F7E3} ${bgMagenta(` ${nextSteps.title ?? "Action Required!"} `)}`;
|
|
2433
|
+
note(logNextStep(nextSteps, pkgManager), noteMessage);
|
|
2434
|
+
}
|
|
2435
|
+
$e(`\u{1F984} ${bgMagenta(` Success! `)} Added ${bold(cyan(result.integration.id))} to your app`);
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
// packages/qwik/src/cli/add/print-add-help.ts
|
|
2439
|
+
var SPACE_TO_HINT = 25;
|
|
2440
|
+
var MAX_HINT_LENGTH = 50;
|
|
2441
|
+
function renderIntegration(integrations2) {
|
|
2442
|
+
return integrations2.map((integration) => {
|
|
2443
|
+
const hint = limitLength(integration.pkgJson.description, MAX_HINT_LENGTH);
|
|
2444
|
+
return integration.id + " ".repeat(Math.max(SPACE_TO_HINT - integration.id.length, 2)) + dim(hint);
|
|
2445
|
+
}).join("\n");
|
|
2446
|
+
}
|
|
2447
|
+
async function printAddHelp(app) {
|
|
2448
|
+
const integrations2 = await loadIntegrations();
|
|
2449
|
+
const adapters = integrations2.filter((i) => i.type === "adapter");
|
|
2450
|
+
const features = integrations2.filter((i) => i.type === "feature");
|
|
2451
|
+
const pmRun = pmRunCmd();
|
|
2452
|
+
oe(`${pmRun} qwik ${magenta(`add`)} [integration]`);
|
|
2453
|
+
note(renderIntegration(adapters), "Adapters");
|
|
2454
|
+
note(renderIntegration(features), "Features");
|
|
2455
|
+
const proceed = await se({
|
|
2456
|
+
message: "Do you want to install an integration?",
|
|
2457
|
+
initialValue: true
|
|
2458
|
+
});
|
|
2459
|
+
if (hD(proceed) || !proceed) {
|
|
2460
|
+
bye();
|
|
2461
|
+
}
|
|
2462
|
+
const command = await ie({
|
|
2463
|
+
message: "Select an integration",
|
|
2464
|
+
options: await sortIntegrationsAndReturnAsClackOptions(integrations2)
|
|
2465
|
+
});
|
|
2466
|
+
if (hD(command)) {
|
|
2467
|
+
bye();
|
|
2468
|
+
}
|
|
2469
|
+
runAddInteractive(app, command);
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
// packages/qwik/src/cli/add/run-add-command.ts
|
|
2473
|
+
async function runAddCommand(app) {
|
|
2474
|
+
try {
|
|
2475
|
+
const id = app.args[1];
|
|
2476
|
+
if (id === "help") {
|
|
2477
|
+
await printAddHelp(app);
|
|
2478
|
+
} else {
|
|
2479
|
+
await runAddInteractive(app, id);
|
|
2480
|
+
}
|
|
2481
|
+
} catch (e2) {
|
|
2482
|
+
console.error(`\u274C ${red(String(e2))}
|
|
2483
|
+
`);
|
|
2484
|
+
process.exit(1);
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
// packages/qwik/src/cli/new/run-new-command.ts
|
|
2489
|
+
var import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
2490
|
+
var import_path2 = require("path");
|
|
2491
|
+
|
|
2492
|
+
// packages/qwik/src/cli/utils/templates.ts
|
|
2493
|
+
var import_node_fs6 = __toESM(require("node:fs"), 1);
|
|
2494
|
+
var import_node_path7 = require("node:path");
|
|
2495
|
+
var templates = null;
|
|
2496
|
+
async function loadTemplates() {
|
|
2497
|
+
if (!templates) {
|
|
2498
|
+
const allTemplates = [];
|
|
2499
|
+
const templatesDir = (0, import_node_path7.join)(__dirname, "templates");
|
|
2500
|
+
const templatesDirNames = await import_node_fs6.default.promises.readdir(templatesDir);
|
|
2501
|
+
await Promise.all(
|
|
2502
|
+
templatesDirNames.map(async (templatesDirName) => {
|
|
2503
|
+
const dir = (0, import_node_path7.join)(templatesDir, templatesDirName);
|
|
2504
|
+
const files = await readTemplates(dir);
|
|
2505
|
+
const template = { id: templatesDirName, ...files };
|
|
2506
|
+
allTemplates.push(template);
|
|
2507
|
+
})
|
|
2508
|
+
);
|
|
2509
|
+
allTemplates.sort((a3, b3) => {
|
|
2510
|
+
if (a3.id === "qwik") {
|
|
2511
|
+
return -1;
|
|
2512
|
+
} else if (b3.id === "qwik") {
|
|
2513
|
+
return 1;
|
|
2514
|
+
}
|
|
2515
|
+
return a3.id > b3.id ? 1 : -1;
|
|
2516
|
+
});
|
|
2517
|
+
templates = allTemplates;
|
|
2518
|
+
}
|
|
2519
|
+
return templates;
|
|
2520
|
+
}
|
|
2521
|
+
async function readTemplates(rootDir) {
|
|
2522
|
+
const componentDir = (0, import_node_path7.join)(rootDir, "component");
|
|
2523
|
+
const routeDir = (0, import_node_path7.join)(rootDir, "route");
|
|
2524
|
+
const markdownDir = (0, import_node_path7.join)(rootDir, "markdown");
|
|
2525
|
+
const mdxDir = (0, import_node_path7.join)(rootDir, "mdx");
|
|
2526
|
+
const component = await getFilesDeep(componentDir);
|
|
2527
|
+
const route = await getFilesDeep(routeDir);
|
|
2528
|
+
const markdown = await getFilesDeep(markdownDir);
|
|
2529
|
+
const mdx = await getFilesDeep(mdxDir);
|
|
2530
|
+
return {
|
|
2531
|
+
component: component.map((c2) => parseTemplatePath(c2, "component")),
|
|
2532
|
+
route: route.map((r2) => parseTemplatePath(r2, "route")),
|
|
2533
|
+
markdown: markdown.map((m2) => parseTemplatePath(m2, "markdown")),
|
|
2534
|
+
mdx: mdx.map((m2) => parseTemplatePath(m2, "mdx"))
|
|
2535
|
+
};
|
|
2536
|
+
}
|
|
2537
|
+
function parseTemplatePath(path3, type) {
|
|
2538
|
+
const parts = path3.split(import_node_path7.sep + type + import_node_path7.sep);
|
|
2539
|
+
return {
|
|
2540
|
+
absolute: path3,
|
|
2541
|
+
relative: parts[1]
|
|
2542
|
+
};
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
// packages/qwik/src/cli/new/print-new-help.ts
|
|
2546
|
+
async function printNewHelp() {
|
|
2547
|
+
const pmRun = pmRunCmd();
|
|
2548
|
+
const templates2 = await loadTemplates();
|
|
2549
|
+
const outString = [];
|
|
2550
|
+
outString.push(`${cyan("Interactive")}`);
|
|
2551
|
+
outString.push(` ${pmRun} qwik ${magenta(`new`)}`);
|
|
2552
|
+
outString.push(``);
|
|
2553
|
+
outString.push(`${cyan("New route")}`);
|
|
2554
|
+
outString.push(
|
|
2555
|
+
` ${pmRun} qwik ${magenta(`new /about`)}: ${dim("Create a new route for /about")}`
|
|
2556
|
+
);
|
|
2557
|
+
outString.push(``);
|
|
2558
|
+
outString.push(`${cyan("New component")}`);
|
|
2559
|
+
outString.push(
|
|
2560
|
+
` ${pmRun} qwik ${magenta(`new my-button`)}: ${dim(
|
|
2561
|
+
"Create a new component in src/components/my-button"
|
|
2562
|
+
)}`
|
|
2563
|
+
);
|
|
2564
|
+
outString.push(
|
|
2565
|
+
` ${pmRun} qwik ${magenta(`new nested/my-button`)}: ${dim(
|
|
2566
|
+
"Create a new component in src/components/nested/my-button"
|
|
2567
|
+
)}`
|
|
2568
|
+
);
|
|
2569
|
+
outString.push(``);
|
|
2570
|
+
outString.push(`${cyan("Available templates")}`);
|
|
2571
|
+
for (const t of templates2) {
|
|
2572
|
+
let postfix = "";
|
|
2573
|
+
if (t.id === "qwik") {
|
|
2574
|
+
postfix = " (default)";
|
|
2575
|
+
}
|
|
2576
|
+
outString.push(` ${t.id}${gray(postfix)}`);
|
|
2577
|
+
}
|
|
2578
|
+
note(outString.join("\n"), "Available commands");
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
// packages/qwik/src/cli/new/utils.ts
|
|
2582
|
+
var POSSIBLE_TYPES = ["component", "route", "markdown", "mdx"];
|
|
2583
|
+
|
|
2584
|
+
// packages/qwik/src/cli/new/run-new-command.ts
|
|
2585
|
+
var SLUG_KEY = "[slug]";
|
|
2586
|
+
var NAME_KEY = "[name]";
|
|
2587
|
+
var MARKDOWN_SUFFIX = ".md";
|
|
2588
|
+
var MDX_SUFFIX = ".mdx";
|
|
2589
|
+
async function runNewCommand(app) {
|
|
2590
|
+
try {
|
|
2591
|
+
if (app.args.length > 1 && app.args[1] === "help") {
|
|
2592
|
+
oe(`\u{1F52D} ${bgMagenta(" Qwik Help ")}`);
|
|
2593
|
+
await printNewHelp();
|
|
2594
|
+
bye();
|
|
2595
|
+
} else {
|
|
2596
|
+
oe(`\u2728 ${bgMagenta(" Create a new Qwik component or route ")}`);
|
|
2597
|
+
}
|
|
2598
|
+
const args = app.args.filter((a3) => !a3.startsWith("--"));
|
|
2599
|
+
const mainInput = args.slice(1).join(" ");
|
|
2600
|
+
let typeArg = void 0;
|
|
2601
|
+
let nameArg;
|
|
2602
|
+
let outDir;
|
|
2603
|
+
if (mainInput && mainInput.startsWith("/")) {
|
|
2604
|
+
if (mainInput.endsWith(MARKDOWN_SUFFIX)) {
|
|
2605
|
+
typeArg = "markdown";
|
|
2606
|
+
nameArg = mainInput.replace(MARKDOWN_SUFFIX, "");
|
|
2607
|
+
} else if (mainInput.endsWith(MDX_SUFFIX)) {
|
|
2608
|
+
typeArg = "mdx";
|
|
2609
|
+
nameArg = mainInput.replace(MDX_SUFFIX, "");
|
|
2610
|
+
} else {
|
|
2611
|
+
typeArg = "route";
|
|
2612
|
+
nameArg = mainInput;
|
|
2613
|
+
}
|
|
2614
|
+
} else if (mainInput) {
|
|
2615
|
+
typeArg = "component";
|
|
2616
|
+
nameArg = mainInput;
|
|
2617
|
+
}
|
|
2618
|
+
let templateArg = app.args.filter((a3) => a3.startsWith("--")).map((a3) => a3.substring(2)).join("");
|
|
2619
|
+
if (!templateArg && mainInput) {
|
|
2620
|
+
templateArg = "qwik";
|
|
2621
|
+
}
|
|
2622
|
+
if (!typeArg) {
|
|
2623
|
+
typeArg = await selectType();
|
|
2624
|
+
}
|
|
2625
|
+
if (!POSSIBLE_TYPES.includes(typeArg)) {
|
|
2626
|
+
throw new Error(`Invalid type: ${typeArg}`);
|
|
2627
|
+
}
|
|
2628
|
+
if (!nameArg) {
|
|
2629
|
+
nameArg = await selectName(typeArg);
|
|
2630
|
+
}
|
|
2631
|
+
const { name, slug } = parseInputName(nameArg);
|
|
2632
|
+
let template;
|
|
2633
|
+
if (!templateArg) {
|
|
2634
|
+
template = await selectTemplate(typeArg);
|
|
2635
|
+
} else {
|
|
2636
|
+
const allTemplates = await loadTemplates();
|
|
2637
|
+
const templates2 = allTemplates.filter(
|
|
2638
|
+
(i) => i.id === templateArg && i[typeArg] && i[typeArg].length
|
|
2639
|
+
);
|
|
2640
|
+
if (!templates2.length) {
|
|
2641
|
+
f2.error(`Template "${templateArg}" not found`);
|
|
2642
|
+
bye();
|
|
2643
|
+
}
|
|
2644
|
+
template = templates2[0][typeArg][0];
|
|
2645
|
+
}
|
|
2646
|
+
if (typeArg === "route" || typeArg === "markdown" || typeArg === "mdx") {
|
|
2647
|
+
outDir = (0, import_path2.join)(app.rootDir, "src", `routes`, nameArg);
|
|
2648
|
+
} else {
|
|
2649
|
+
outDir = (0, import_path2.join)(app.rootDir, "src", `components`, nameArg);
|
|
2650
|
+
}
|
|
2651
|
+
const fileOutput = await writeToFile(name, slug, template, outDir);
|
|
2652
|
+
f2.success(`${green(`${toPascal([typeArg])} "${slug}" created!`)}`);
|
|
2653
|
+
f2.message(`Emitted in ${dim(fileOutput)}`);
|
|
2654
|
+
} catch (e2) {
|
|
2655
|
+
f2.error(String(e2));
|
|
2656
|
+
await printNewHelp();
|
|
2657
|
+
}
|
|
2658
|
+
bye();
|
|
2659
|
+
}
|
|
2660
|
+
async function selectType() {
|
|
2661
|
+
const typeAnswer = await ie({
|
|
2662
|
+
message: "What would you like to create?",
|
|
2663
|
+
options: [
|
|
2664
|
+
{ value: "component", label: "Component" },
|
|
2665
|
+
{ value: "route", label: "Route" },
|
|
2666
|
+
{ value: "markdown", label: "Route (Markdown)" },
|
|
2667
|
+
{ value: "mdx", label: "Route (MDX)" }
|
|
2668
|
+
]
|
|
2669
|
+
});
|
|
2670
|
+
if (hD(typeAnswer)) {
|
|
2671
|
+
bye();
|
|
2672
|
+
}
|
|
2673
|
+
return typeAnswer;
|
|
2674
|
+
}
|
|
2675
|
+
async function selectName(type) {
|
|
2676
|
+
const messages = {
|
|
2677
|
+
route: "New route path",
|
|
2678
|
+
markdown: "New Markdown route path",
|
|
2679
|
+
mdx: "New MDX route path",
|
|
2680
|
+
component: "Name your component"
|
|
2681
|
+
};
|
|
2682
|
+
const message = messages[type];
|
|
2683
|
+
const placeholders = {
|
|
2684
|
+
route: "/product/[id]",
|
|
2685
|
+
markdown: "/some/page" + MARKDOWN_SUFFIX,
|
|
2686
|
+
mdx: "/some/page" + MDX_SUFFIX,
|
|
2687
|
+
component: "my-component"
|
|
2688
|
+
};
|
|
2689
|
+
const placeholder = placeholders[type];
|
|
2690
|
+
const nameAnswer = await te({
|
|
2691
|
+
message,
|
|
2692
|
+
placeholder,
|
|
2693
|
+
validate: (v2) => {
|
|
2694
|
+
if (v2.length < 1) {
|
|
2695
|
+
return "Value can not be empty";
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
});
|
|
2699
|
+
if (hD(nameAnswer)) {
|
|
2700
|
+
bye();
|
|
2701
|
+
}
|
|
2702
|
+
if (typeof nameAnswer !== "string") {
|
|
2703
|
+
bye();
|
|
2704
|
+
}
|
|
2705
|
+
let result = nameAnswer;
|
|
2706
|
+
if (type !== "component" && !nameAnswer.startsWith("/")) {
|
|
2707
|
+
result = `/${result}`;
|
|
2708
|
+
}
|
|
2709
|
+
if (type === "markdown") {
|
|
2710
|
+
result = result.replace(MARKDOWN_SUFFIX, "");
|
|
2711
|
+
} else if (type === "mdx") {
|
|
2712
|
+
result = result.replace(MDX_SUFFIX, "");
|
|
2713
|
+
}
|
|
2714
|
+
return result;
|
|
2715
|
+
}
|
|
2716
|
+
async function selectTemplate(typeArg) {
|
|
2717
|
+
const allTemplates = await loadTemplates();
|
|
2718
|
+
const templates2 = allTemplates.filter((i) => i[typeArg] && i[typeArg].length);
|
|
2719
|
+
if (!templates2.length) {
|
|
2720
|
+
f2.error(`No templates found for type "${typeArg}"`);
|
|
2721
|
+
bye();
|
|
2722
|
+
}
|
|
2723
|
+
if (templates2.length === 1) {
|
|
2724
|
+
return templates2[0][typeArg][0];
|
|
2725
|
+
}
|
|
2726
|
+
const templateAnswer = await ie({
|
|
2727
|
+
message: "Which template would you like to use?",
|
|
2728
|
+
options: templates2.map((t) => ({ value: t[typeArg][0], label: t.id }))
|
|
2729
|
+
});
|
|
2730
|
+
if (hD(templateAnswer)) {
|
|
2731
|
+
bye();
|
|
2732
|
+
}
|
|
2733
|
+
return templateAnswer;
|
|
2734
|
+
}
|
|
2735
|
+
async function writeToFile(name, slug, template, outDir) {
|
|
2736
|
+
const outFile = (0, import_path2.join)(outDir, template.relative);
|
|
2737
|
+
const fileOutput = inject(outFile, [
|
|
2738
|
+
[SLUG_KEY, slug],
|
|
2739
|
+
[".template", ""]
|
|
2740
|
+
]);
|
|
2741
|
+
if (import_node_fs7.default.existsSync(fileOutput)) {
|
|
2742
|
+
const filename = fileOutput.split("/").pop();
|
|
2743
|
+
throw new Error(`"${filename}" already exists in "${outDir}"`);
|
|
2744
|
+
}
|
|
2745
|
+
const text = await import_node_fs7.default.promises.readFile(template.absolute, { encoding: "utf-8" });
|
|
2746
|
+
const templateOut = inject(text, [
|
|
2747
|
+
[SLUG_KEY, slug],
|
|
2748
|
+
[NAME_KEY, name]
|
|
2749
|
+
]);
|
|
2750
|
+
await import_node_fs7.default.promises.mkdir(outDir, { recursive: true });
|
|
2751
|
+
await import_node_fs7.default.promises.writeFile(fileOutput, templateOut, { encoding: "utf-8" });
|
|
2752
|
+
return fileOutput;
|
|
2753
|
+
}
|
|
2754
|
+
function inject(raw, vars) {
|
|
2755
|
+
let output = raw;
|
|
2756
|
+
for (const v2 of vars) {
|
|
2757
|
+
output = output.replaceAll(v2[0], v2[1]);
|
|
2758
|
+
}
|
|
2759
|
+
return output;
|
|
2760
|
+
}
|
|
2761
|
+
function parseInputName(input) {
|
|
2762
|
+
const parts = input.split(/[-_\s]/g);
|
|
2763
|
+
return {
|
|
2764
|
+
slug: toSlug(parts),
|
|
2765
|
+
name: toPascal(parts)
|
|
2766
|
+
};
|
|
2767
|
+
}
|
|
2768
|
+
function toSlug(list) {
|
|
2769
|
+
return list.join("-");
|
|
2770
|
+
}
|
|
2771
|
+
function toPascal(list) {
|
|
2772
|
+
return list.map((p) => p[0].toUpperCase() + p.substring(1)).join("");
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2775
|
+
// packages/create-qwik/src/helpers/jokes.json
|
|
2776
|
+
var jokes_default = [
|
|
2777
|
+
["What's the best thing about a Boolean?", "Even if you're wrong, you're only off by a bit."],
|
|
2778
|
+
["Why did the developer stay at home?", "Because he couldn't find his keys."],
|
|
2779
|
+
["How many programmers does it take to change a lightbulb?", "None that's a hardware problem"],
|
|
2780
|
+
["A user interface is like a joke.", "If you have to explain it then it is not that good."],
|
|
2781
|
+
["['hip', 'hip']", "(hip hip array)"],
|
|
2782
|
+
["A SQL query goes into a bar, walks up to two tables and asks:", "'Can I JOIN you?'"],
|
|
2783
|
+
["Why did the developer go to therapy?", "He had too many unresolved issues."],
|
|
2784
|
+
[
|
|
2785
|
+
"Why do C# and Java developers keep breaking their keyboards?",
|
|
2786
|
+
"Because they use a strongly typed language."
|
|
2787
|
+
],
|
|
2788
|
+
["What's the object-oriented way to become wealthy?", "Inheritance"],
|
|
2789
|
+
["Where do programmers like to hangout?", "The Foo Bar."],
|
|
2790
|
+
["Why do Java programmers wear glasses?", "Because they don't C#"],
|
|
2791
|
+
["To understand what recursion is...", "You must first understand what recursion is"],
|
|
2792
|
+
["The punchline often arrives before the set-up.", "Do you know the problem with UDP jokes?"],
|
|
2793
|
+
["Why did the programmer quit his job?", "Because he didn't get arrays."],
|
|
2794
|
+
["Why was the computer tired when it got home?", "It had a hard drive."],
|
|
2795
|
+
[
|
|
2796
|
+
"There are 10 types of people in this world...",
|
|
2797
|
+
"Those who understand binary and those who don't"
|
|
2798
|
+
],
|
|
2799
|
+
["Why do programmers always mix up Halloween and Christmas?", "Because Oct 31 == Dec 25"],
|
|
2800
|
+
["I was gonna tell you a joke about UDP...", "...but you might not get it."],
|
|
2801
|
+
["Normal People: give me just a second", "Developers: give me 1000 milliseconds!"],
|
|
2802
|
+
["Why do programmers prefer dark mode?", "Because light attracts bugs."],
|
|
2803
|
+
["Why don't programmers like nature?", "It has too many bugs."],
|
|
2804
|
+
["Why was the computer freezing?", "It left its Windows open!"],
|
|
2805
|
+
["What did the Java code say to the C code?", "You've got no class."],
|
|
2806
|
+
["Why do programmers prefer the outdoors?", "Because it's free of bugs."],
|
|
2807
|
+
["Why do programmers love movies?", "Because they can 'script' the ending."],
|
|
2808
|
+
["why do desert animals hate Qwik?", "Because there's no hydration...."],
|
|
2809
|
+
["What can you do if you cannot push your git changes?", "Use the --force, Luke"],
|
|
2810
|
+
["How did the developer announce he's getting married?", "'She returned true!'"],
|
|
2811
|
+
["How many Prolog programmers does it take to change a lightbulb?", "Yes."],
|
|
2812
|
+
["Why did the developer ground their kid?", "They weren't telling the truthy"],
|
|
2813
|
+
["!false", "It's funny 'cause it's true."],
|
|
2814
|
+
["Where did the parallel function wash its hands?", "Async"],
|
|
2815
|
+
["How do functions break up?", "They stop calling each other"],
|
|
2816
|
+
["Why did the functions stop calling each other?", "Because they had constant arguments."],
|
|
2817
|
+
["What's the second movie about a database engineer called?", "The SQL."],
|
|
2818
|
+
["What did the computer do at lunchtime?", "NoSQL."],
|
|
2819
|
+
["Why doesn't Hollywood make more Big Data movies?", "Had a byte!"],
|
|
2820
|
+
["What does a baby computer call his father?", "Data!"],
|
|
2821
|
+
["I never tell the same joke twice", "I have a DRY sense of humor."],
|
|
2822
|
+
["How do programming pirates pass method parameters?", "ARRRRRGS."],
|
|
2823
|
+
["Why don't bachelors like Git?", "Because they are afraid to commit."],
|
|
2824
|
+
["Why do astronauts use Linux?", "They can't open Windows in space!"],
|
|
2825
|
+
["How do front end devs like their brownies?", "GUI"],
|
|
2826
|
+
["What do hackers do on a boat?", "Phishing."],
|
|
2827
|
+
["Why couldn't the HTML list be trusted?", "There were LI's everywhere"],
|
|
2828
|
+
["To the person who invented zero:", "Thank's for nothing!"],
|
|
2829
|
+
["What do you call a bee that lives in America?", "A USB"],
|
|
2830
|
+
["want about to a race conditions hear joke?", ""],
|
|
2831
|
+
["What is a Package Managers favorite holiday?", "Dependency Day"],
|
|
2832
|
+
["Where do we get all of these dad jokes from?", "A dad-a-base!"],
|
|
2833
|
+
["What advice do you give to a JS developer who has never played baseball?", "Try catch."],
|
|
2834
|
+
["We don't have any DNS jokes, know why?", "Because it may take 24 hours to get them"],
|
|
2835
|
+
["Why do Front-End Developers eat lunch alone?", "Because they don't know how to join tables."],
|
|
2836
|
+
["How do you help JS errors?", "You `console` them!"],
|
|
2837
|
+
["When do front end developers go out to eat?", "On their lunch <br>."],
|
|
2838
|
+
["What do you call optimistic front-end developers?", "Stack half-full developers."]
|
|
2839
|
+
];
|
|
2840
|
+
|
|
2841
|
+
// packages/create-qwik/src/helpers/jokes.ts
|
|
2842
|
+
function getRandomJoke() {
|
|
2843
|
+
const index = Math.floor(Math.random() * jokes_default.length);
|
|
2844
|
+
return jokes_default[index];
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
// packages/qwik/src/cli/joke/run-joke-command.ts
|
|
2848
|
+
async function runJokeCommand() {
|
|
2849
|
+
const [setup, punchline] = getRandomJoke();
|
|
2850
|
+
note(magenta(`${setup.trim()}
|
|
2851
|
+
${punchline.trim()}`), "\u{1F648}");
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js
|
|
2855
|
+
var import_node_buffer2 = require("node:buffer");
|
|
2856
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
2857
|
+
var import_node_child_process3 = __toESM(require("node:child_process"), 1);
|
|
2858
|
+
var import_node_process6 = __toESM(require("node:process"), 1);
|
|
2859
|
+
var import_cross_spawn2 = __toESM(require_cross_spawn(), 1);
|
|
2860
|
+
|
|
2861
|
+
// node_modules/.pnpm/strip-final-newline@3.0.0/node_modules/strip-final-newline/index.js
|
|
2862
|
+
function stripFinalNewline(input) {
|
|
2863
|
+
const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
|
|
2864
|
+
const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
|
|
2865
|
+
if (input[input.length - 1] === LF) {
|
|
2866
|
+
input = input.slice(0, -1);
|
|
2867
|
+
}
|
|
2868
|
+
if (input[input.length - 1] === CR) {
|
|
2869
|
+
input = input.slice(0, -1);
|
|
2870
|
+
}
|
|
2871
|
+
return input;
|
|
2872
|
+
}
|
|
2873
|
+
|
|
2874
|
+
// node_modules/.pnpm/npm-run-path@5.3.0/node_modules/npm-run-path/index.js
|
|
2875
|
+
var import_node_process3 = __toESM(require("node:process"), 1);
|
|
2876
|
+
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
2877
|
+
var import_node_url = require("node:url");
|
|
2878
|
+
|
|
2879
|
+
// node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
|
|
2880
|
+
function pathKey(options = {}) {
|
|
2881
|
+
const {
|
|
2882
|
+
env = process.env,
|
|
2883
|
+
platform = process.platform
|
|
2884
|
+
} = options;
|
|
2885
|
+
if (platform !== "win32") {
|
|
2886
|
+
return "PATH";
|
|
2887
|
+
}
|
|
2888
|
+
return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
// node_modules/.pnpm/npm-run-path@5.3.0/node_modules/npm-run-path/index.js
|
|
2892
|
+
var npmRunPath = ({
|
|
2893
|
+
cwd = import_node_process3.default.cwd(),
|
|
2894
|
+
path: pathOption = import_node_process3.default.env[pathKey()],
|
|
2895
|
+
preferLocal = true,
|
|
2896
|
+
execPath = import_node_process3.default.execPath,
|
|
2897
|
+
addExecPath = true
|
|
2898
|
+
} = {}) => {
|
|
2899
|
+
const cwdString = cwd instanceof URL ? (0, import_node_url.fileURLToPath)(cwd) : cwd;
|
|
2900
|
+
const cwdPath = import_node_path8.default.resolve(cwdString);
|
|
2901
|
+
const result = [];
|
|
2902
|
+
if (preferLocal) {
|
|
2903
|
+
applyPreferLocal(result, cwdPath);
|
|
2904
|
+
}
|
|
2905
|
+
if (addExecPath) {
|
|
2906
|
+
applyExecPath(result, execPath, cwdPath);
|
|
2907
|
+
}
|
|
2908
|
+
return [...result, pathOption].join(import_node_path8.default.delimiter);
|
|
2909
|
+
};
|
|
2910
|
+
var applyPreferLocal = (result, cwdPath) => {
|
|
2911
|
+
let previous;
|
|
2912
|
+
while (previous !== cwdPath) {
|
|
2913
|
+
result.push(import_node_path8.default.join(cwdPath, "node_modules/.bin"));
|
|
2914
|
+
previous = cwdPath;
|
|
2915
|
+
cwdPath = import_node_path8.default.resolve(cwdPath, "..");
|
|
2916
|
+
}
|
|
2917
|
+
};
|
|
2918
|
+
var applyExecPath = (result, execPath, cwdPath) => {
|
|
2919
|
+
const execPathString = execPath instanceof URL ? (0, import_node_url.fileURLToPath)(execPath) : execPath;
|
|
2920
|
+
result.push(import_node_path8.default.resolve(cwdPath, execPathString, ".."));
|
|
2921
|
+
};
|
|
2922
|
+
var npmRunPathEnv = ({ env = import_node_process3.default.env, ...options } = {}) => {
|
|
2923
|
+
env = { ...env };
|
|
2924
|
+
const pathName = pathKey({ env });
|
|
2925
|
+
options.path = env[pathName];
|
|
2926
|
+
env[pathName] = npmRunPath(options);
|
|
2927
|
+
return env;
|
|
2928
|
+
};
|
|
2929
|
+
|
|
2930
|
+
// node_modules/.pnpm/mimic-fn@4.0.0/node_modules/mimic-fn/index.js
|
|
2931
|
+
var copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
2932
|
+
if (property === "length" || property === "prototype") {
|
|
2933
|
+
return;
|
|
2934
|
+
}
|
|
2935
|
+
if (property === "arguments" || property === "caller") {
|
|
2936
|
+
return;
|
|
2937
|
+
}
|
|
2938
|
+
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
|
2939
|
+
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
|
2940
|
+
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
|
|
2941
|
+
return;
|
|
2942
|
+
}
|
|
2943
|
+
Object.defineProperty(to, property, fromDescriptor);
|
|
2944
|
+
};
|
|
2945
|
+
var canCopyProperty = function(toDescriptor, fromDescriptor) {
|
|
2946
|
+
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
2947
|
+
};
|
|
2948
|
+
var changePrototype = (to, from) => {
|
|
2949
|
+
const fromPrototype = Object.getPrototypeOf(from);
|
|
2950
|
+
if (fromPrototype === Object.getPrototypeOf(to)) {
|
|
2951
|
+
return;
|
|
2952
|
+
}
|
|
2953
|
+
Object.setPrototypeOf(to, fromPrototype);
|
|
2954
|
+
};
|
|
2955
|
+
var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
2956
|
+
${fromBody}`;
|
|
2957
|
+
var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
2958
|
+
var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
2959
|
+
var changeToString = (to, from, name) => {
|
|
2960
|
+
const withName = name === "" ? "" : `with ${name.trim()}() `;
|
|
2961
|
+
const newToString = wrappedToString.bind(null, withName, from.toString());
|
|
2962
|
+
Object.defineProperty(newToString, "name", toStringName);
|
|
2963
|
+
Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
|
|
2964
|
+
};
|
|
2965
|
+
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
2966
|
+
const { name } = to;
|
|
2967
|
+
for (const property of Reflect.ownKeys(from)) {
|
|
2968
|
+
copyProperty(to, from, property, ignoreNonConfigurable);
|
|
2969
|
+
}
|
|
2970
|
+
changePrototype(to, from);
|
|
2971
|
+
changeToString(to, from, name);
|
|
2972
|
+
return to;
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
// node_modules/.pnpm/onetime@6.0.0/node_modules/onetime/index.js
|
|
2976
|
+
var calledFunctions = /* @__PURE__ */ new WeakMap();
|
|
2977
|
+
var onetime = (function_, options = {}) => {
|
|
2978
|
+
if (typeof function_ !== "function") {
|
|
2979
|
+
throw new TypeError("Expected a function");
|
|
2980
|
+
}
|
|
2981
|
+
let returnValue;
|
|
2982
|
+
let callCount = 0;
|
|
2983
|
+
const functionName = function_.displayName || function_.name || "<anonymous>";
|
|
2984
|
+
const onetime2 = function(...arguments_) {
|
|
2985
|
+
calledFunctions.set(onetime2, ++callCount);
|
|
2986
|
+
if (callCount === 1) {
|
|
2987
|
+
returnValue = function_.apply(this, arguments_);
|
|
2988
|
+
function_ = null;
|
|
2989
|
+
} else if (options.throw === true) {
|
|
2990
|
+
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
2991
|
+
}
|
|
2992
|
+
return returnValue;
|
|
2993
|
+
};
|
|
2994
|
+
mimicFunction(onetime2, function_);
|
|
2995
|
+
calledFunctions.set(onetime2, callCount);
|
|
2996
|
+
return onetime2;
|
|
2997
|
+
};
|
|
2998
|
+
onetime.callCount = (function_) => {
|
|
2999
|
+
if (!calledFunctions.has(function_)) {
|
|
3000
|
+
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
3001
|
+
}
|
|
3002
|
+
return calledFunctions.get(function_);
|
|
3003
|
+
};
|
|
3004
|
+
var onetime_default = onetime;
|
|
3005
|
+
|
|
3006
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/error.js
|
|
3007
|
+
var import_node_process4 = __toESM(require("node:process"), 1);
|
|
3008
|
+
|
|
3009
|
+
// node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/main.js
|
|
3010
|
+
var import_node_os2 = require("node:os");
|
|
3011
|
+
|
|
3012
|
+
// node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/realtime.js
|
|
3013
|
+
var getRealtimeSignals = () => {
|
|
3014
|
+
const length = SIGRTMAX - SIGRTMIN + 1;
|
|
3015
|
+
return Array.from({ length }, getRealtimeSignal);
|
|
3016
|
+
};
|
|
3017
|
+
var getRealtimeSignal = (value, index) => ({
|
|
3018
|
+
name: `SIGRT${index + 1}`,
|
|
3019
|
+
number: SIGRTMIN + index,
|
|
3020
|
+
action: "terminate",
|
|
3021
|
+
description: "Application-specific signal (realtime)",
|
|
3022
|
+
standard: "posix"
|
|
3023
|
+
});
|
|
3024
|
+
var SIGRTMIN = 34;
|
|
3025
|
+
var SIGRTMAX = 64;
|
|
3026
|
+
|
|
3027
|
+
// node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/signals.js
|
|
3028
|
+
var import_node_os = require("node:os");
|
|
3029
|
+
|
|
3030
|
+
// node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/core.js
|
|
3031
|
+
var SIGNALS = [
|
|
3032
|
+
{
|
|
3033
|
+
name: "SIGHUP",
|
|
3034
|
+
number: 1,
|
|
3035
|
+
action: "terminate",
|
|
3036
|
+
description: "Terminal closed",
|
|
3037
|
+
standard: "posix"
|
|
3038
|
+
},
|
|
3039
|
+
{
|
|
3040
|
+
name: "SIGINT",
|
|
3041
|
+
number: 2,
|
|
3042
|
+
action: "terminate",
|
|
3043
|
+
description: "User interruption with CTRL-C",
|
|
3044
|
+
standard: "ansi"
|
|
3045
|
+
},
|
|
3046
|
+
{
|
|
3047
|
+
name: "SIGQUIT",
|
|
3048
|
+
number: 3,
|
|
3049
|
+
action: "core",
|
|
3050
|
+
description: "User interruption with CTRL-\\",
|
|
3051
|
+
standard: "posix"
|
|
3052
|
+
},
|
|
3053
|
+
{
|
|
3054
|
+
name: "SIGILL",
|
|
3055
|
+
number: 4,
|
|
3056
|
+
action: "core",
|
|
3057
|
+
description: "Invalid machine instruction",
|
|
3058
|
+
standard: "ansi"
|
|
3059
|
+
},
|
|
3060
|
+
{
|
|
3061
|
+
name: "SIGTRAP",
|
|
3062
|
+
number: 5,
|
|
3063
|
+
action: "core",
|
|
3064
|
+
description: "Debugger breakpoint",
|
|
3065
|
+
standard: "posix"
|
|
3066
|
+
},
|
|
3067
|
+
{
|
|
3068
|
+
name: "SIGABRT",
|
|
3069
|
+
number: 6,
|
|
3070
|
+
action: "core",
|
|
3071
|
+
description: "Aborted",
|
|
3072
|
+
standard: "ansi"
|
|
3073
|
+
},
|
|
3074
|
+
{
|
|
3075
|
+
name: "SIGIOT",
|
|
3076
|
+
number: 6,
|
|
3077
|
+
action: "core",
|
|
3078
|
+
description: "Aborted",
|
|
3079
|
+
standard: "bsd"
|
|
3080
|
+
},
|
|
3081
|
+
{
|
|
3082
|
+
name: "SIGBUS",
|
|
3083
|
+
number: 7,
|
|
3084
|
+
action: "core",
|
|
3085
|
+
description: "Bus error due to misaligned, non-existing address or paging error",
|
|
3086
|
+
standard: "bsd"
|
|
3087
|
+
},
|
|
3088
|
+
{
|
|
3089
|
+
name: "SIGEMT",
|
|
3090
|
+
number: 7,
|
|
3091
|
+
action: "terminate",
|
|
3092
|
+
description: "Command should be emulated but is not implemented",
|
|
3093
|
+
standard: "other"
|
|
3094
|
+
},
|
|
3095
|
+
{
|
|
3096
|
+
name: "SIGFPE",
|
|
3097
|
+
number: 8,
|
|
3098
|
+
action: "core",
|
|
3099
|
+
description: "Floating point arithmetic error",
|
|
3100
|
+
standard: "ansi"
|
|
3101
|
+
},
|
|
3102
|
+
{
|
|
3103
|
+
name: "SIGKILL",
|
|
3104
|
+
number: 9,
|
|
3105
|
+
action: "terminate",
|
|
3106
|
+
description: "Forced termination",
|
|
3107
|
+
standard: "posix",
|
|
3108
|
+
forced: true
|
|
3109
|
+
},
|
|
3110
|
+
{
|
|
3111
|
+
name: "SIGUSR1",
|
|
3112
|
+
number: 10,
|
|
3113
|
+
action: "terminate",
|
|
3114
|
+
description: "Application-specific signal",
|
|
3115
|
+
standard: "posix"
|
|
3116
|
+
},
|
|
3117
|
+
{
|
|
3118
|
+
name: "SIGSEGV",
|
|
3119
|
+
number: 11,
|
|
3120
|
+
action: "core",
|
|
3121
|
+
description: "Segmentation fault",
|
|
3122
|
+
standard: "ansi"
|
|
3123
|
+
},
|
|
3124
|
+
{
|
|
3125
|
+
name: "SIGUSR2",
|
|
3126
|
+
number: 12,
|
|
3127
|
+
action: "terminate",
|
|
3128
|
+
description: "Application-specific signal",
|
|
3129
|
+
standard: "posix"
|
|
3130
|
+
},
|
|
3131
|
+
{
|
|
3132
|
+
name: "SIGPIPE",
|
|
3133
|
+
number: 13,
|
|
3134
|
+
action: "terminate",
|
|
3135
|
+
description: "Broken pipe or socket",
|
|
3136
|
+
standard: "posix"
|
|
3137
|
+
},
|
|
3138
|
+
{
|
|
3139
|
+
name: "SIGALRM",
|
|
3140
|
+
number: 14,
|
|
3141
|
+
action: "terminate",
|
|
3142
|
+
description: "Timeout or timer",
|
|
3143
|
+
standard: "posix"
|
|
3144
|
+
},
|
|
3145
|
+
{
|
|
3146
|
+
name: "SIGTERM",
|
|
3147
|
+
number: 15,
|
|
3148
|
+
action: "terminate",
|
|
3149
|
+
description: "Termination",
|
|
3150
|
+
standard: "ansi"
|
|
3151
|
+
},
|
|
3152
|
+
{
|
|
3153
|
+
name: "SIGSTKFLT",
|
|
3154
|
+
number: 16,
|
|
3155
|
+
action: "terminate",
|
|
3156
|
+
description: "Stack is empty or overflowed",
|
|
3157
|
+
standard: "other"
|
|
3158
|
+
},
|
|
3159
|
+
{
|
|
3160
|
+
name: "SIGCHLD",
|
|
3161
|
+
number: 17,
|
|
3162
|
+
action: "ignore",
|
|
3163
|
+
description: "Child process terminated, paused or unpaused",
|
|
3164
|
+
standard: "posix"
|
|
3165
|
+
},
|
|
3166
|
+
{
|
|
3167
|
+
name: "SIGCLD",
|
|
3168
|
+
number: 17,
|
|
3169
|
+
action: "ignore",
|
|
3170
|
+
description: "Child process terminated, paused or unpaused",
|
|
3171
|
+
standard: "other"
|
|
3172
|
+
},
|
|
3173
|
+
{
|
|
3174
|
+
name: "SIGCONT",
|
|
3175
|
+
number: 18,
|
|
3176
|
+
action: "unpause",
|
|
3177
|
+
description: "Unpaused",
|
|
3178
|
+
standard: "posix",
|
|
3179
|
+
forced: true
|
|
3180
|
+
},
|
|
3181
|
+
{
|
|
3182
|
+
name: "SIGSTOP",
|
|
3183
|
+
number: 19,
|
|
3184
|
+
action: "pause",
|
|
3185
|
+
description: "Paused",
|
|
3186
|
+
standard: "posix",
|
|
3187
|
+
forced: true
|
|
3188
|
+
},
|
|
3189
|
+
{
|
|
3190
|
+
name: "SIGTSTP",
|
|
3191
|
+
number: 20,
|
|
3192
|
+
action: "pause",
|
|
3193
|
+
description: 'Paused using CTRL-Z or "suspend"',
|
|
3194
|
+
standard: "posix"
|
|
3195
|
+
},
|
|
3196
|
+
{
|
|
3197
|
+
name: "SIGTTIN",
|
|
3198
|
+
number: 21,
|
|
3199
|
+
action: "pause",
|
|
3200
|
+
description: "Background process cannot read terminal input",
|
|
3201
|
+
standard: "posix"
|
|
3202
|
+
},
|
|
3203
|
+
{
|
|
3204
|
+
name: "SIGBREAK",
|
|
3205
|
+
number: 21,
|
|
3206
|
+
action: "terminate",
|
|
3207
|
+
description: "User interruption with CTRL-BREAK",
|
|
3208
|
+
standard: "other"
|
|
3209
|
+
},
|
|
3210
|
+
{
|
|
3211
|
+
name: "SIGTTOU",
|
|
3212
|
+
number: 22,
|
|
3213
|
+
action: "pause",
|
|
3214
|
+
description: "Background process cannot write to terminal output",
|
|
3215
|
+
standard: "posix"
|
|
3216
|
+
},
|
|
3217
|
+
{
|
|
3218
|
+
name: "SIGURG",
|
|
3219
|
+
number: 23,
|
|
3220
|
+
action: "ignore",
|
|
3221
|
+
description: "Socket received out-of-band data",
|
|
3222
|
+
standard: "bsd"
|
|
3223
|
+
},
|
|
3224
|
+
{
|
|
3225
|
+
name: "SIGXCPU",
|
|
3226
|
+
number: 24,
|
|
3227
|
+
action: "core",
|
|
3228
|
+
description: "Process timed out",
|
|
3229
|
+
standard: "bsd"
|
|
3230
|
+
},
|
|
3231
|
+
{
|
|
3232
|
+
name: "SIGXFSZ",
|
|
3233
|
+
number: 25,
|
|
3234
|
+
action: "core",
|
|
3235
|
+
description: "File too big",
|
|
3236
|
+
standard: "bsd"
|
|
3237
|
+
},
|
|
3238
|
+
{
|
|
3239
|
+
name: "SIGVTALRM",
|
|
3240
|
+
number: 26,
|
|
3241
|
+
action: "terminate",
|
|
3242
|
+
description: "Timeout or timer",
|
|
3243
|
+
standard: "bsd"
|
|
3244
|
+
},
|
|
3245
|
+
{
|
|
3246
|
+
name: "SIGPROF",
|
|
3247
|
+
number: 27,
|
|
3248
|
+
action: "terminate",
|
|
3249
|
+
description: "Timeout or timer",
|
|
3250
|
+
standard: "bsd"
|
|
3251
|
+
},
|
|
3252
|
+
{
|
|
3253
|
+
name: "SIGWINCH",
|
|
3254
|
+
number: 28,
|
|
3255
|
+
action: "ignore",
|
|
3256
|
+
description: "Terminal window size changed",
|
|
3257
|
+
standard: "bsd"
|
|
3258
|
+
},
|
|
3259
|
+
{
|
|
3260
|
+
name: "SIGIO",
|
|
3261
|
+
number: 29,
|
|
3262
|
+
action: "terminate",
|
|
3263
|
+
description: "I/O is available",
|
|
3264
|
+
standard: "other"
|
|
3265
|
+
},
|
|
3266
|
+
{
|
|
3267
|
+
name: "SIGPOLL",
|
|
3268
|
+
number: 29,
|
|
3269
|
+
action: "terminate",
|
|
3270
|
+
description: "Watched event",
|
|
3271
|
+
standard: "other"
|
|
3272
|
+
},
|
|
3273
|
+
{
|
|
3274
|
+
name: "SIGINFO",
|
|
3275
|
+
number: 29,
|
|
3276
|
+
action: "ignore",
|
|
3277
|
+
description: "Request for process information",
|
|
3278
|
+
standard: "other"
|
|
3279
|
+
},
|
|
3280
|
+
{
|
|
3281
|
+
name: "SIGPWR",
|
|
3282
|
+
number: 30,
|
|
3283
|
+
action: "terminate",
|
|
3284
|
+
description: "Device running out of power",
|
|
3285
|
+
standard: "systemv"
|
|
3286
|
+
},
|
|
3287
|
+
{
|
|
3288
|
+
name: "SIGSYS",
|
|
3289
|
+
number: 31,
|
|
3290
|
+
action: "core",
|
|
3291
|
+
description: "Invalid system call",
|
|
3292
|
+
standard: "other"
|
|
3293
|
+
},
|
|
3294
|
+
{
|
|
3295
|
+
name: "SIGUNUSED",
|
|
3296
|
+
number: 31,
|
|
3297
|
+
action: "terminate",
|
|
3298
|
+
description: "Invalid system call",
|
|
3299
|
+
standard: "other"
|
|
3300
|
+
}
|
|
3301
|
+
];
|
|
3302
|
+
|
|
3303
|
+
// node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/signals.js
|
|
3304
|
+
var getSignals = () => {
|
|
3305
|
+
const realtimeSignals = getRealtimeSignals();
|
|
3306
|
+
const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
|
|
3307
|
+
return signals2;
|
|
3308
|
+
};
|
|
3309
|
+
var normalizeSignal = ({
|
|
3310
|
+
name,
|
|
3311
|
+
number: defaultNumber,
|
|
3312
|
+
description,
|
|
3313
|
+
action,
|
|
3314
|
+
forced = false,
|
|
3315
|
+
standard
|
|
3316
|
+
}) => {
|
|
3317
|
+
const {
|
|
3318
|
+
signals: { [name]: constantSignal }
|
|
3319
|
+
} = import_node_os.constants;
|
|
3320
|
+
const supported = constantSignal !== void 0;
|
|
3321
|
+
const number = supported ? constantSignal : defaultNumber;
|
|
3322
|
+
return { name, number, description, supported, action, forced, standard };
|
|
3323
|
+
};
|
|
3324
|
+
|
|
3325
|
+
// node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/main.js
|
|
3326
|
+
var getSignalsByName = () => {
|
|
3327
|
+
const signals2 = getSignals();
|
|
3328
|
+
return Object.fromEntries(signals2.map(getSignalByName));
|
|
3329
|
+
};
|
|
3330
|
+
var getSignalByName = ({
|
|
3331
|
+
name,
|
|
3332
|
+
number,
|
|
3333
|
+
description,
|
|
3334
|
+
supported,
|
|
3335
|
+
action,
|
|
3336
|
+
forced,
|
|
3337
|
+
standard
|
|
3338
|
+
}) => [name, { name, number, description, supported, action, forced, standard }];
|
|
3339
|
+
var signalsByName = getSignalsByName();
|
|
3340
|
+
var getSignalsByNumber = () => {
|
|
3341
|
+
const signals2 = getSignals();
|
|
3342
|
+
const length = SIGRTMAX + 1;
|
|
3343
|
+
const signalsA = Array.from(
|
|
3344
|
+
{ length },
|
|
3345
|
+
(value, number) => getSignalByNumber(number, signals2)
|
|
3346
|
+
);
|
|
3347
|
+
return Object.assign({}, ...signalsA);
|
|
3348
|
+
};
|
|
3349
|
+
var getSignalByNumber = (number, signals2) => {
|
|
3350
|
+
const signal = findSignalByNumber(number, signals2);
|
|
3351
|
+
if (signal === void 0) {
|
|
3352
|
+
return {};
|
|
3353
|
+
}
|
|
3354
|
+
const { name, description, supported, action, forced, standard } = signal;
|
|
3355
|
+
return {
|
|
3356
|
+
[number]: {
|
|
3357
|
+
name,
|
|
3358
|
+
number,
|
|
3359
|
+
description,
|
|
3360
|
+
supported,
|
|
3361
|
+
action,
|
|
3362
|
+
forced,
|
|
3363
|
+
standard
|
|
3364
|
+
}
|
|
3365
|
+
};
|
|
3366
|
+
};
|
|
3367
|
+
var findSignalByNumber = (number, signals2) => {
|
|
3368
|
+
const signal = signals2.find(({ name }) => import_node_os2.constants.signals[name] === number);
|
|
3369
|
+
if (signal !== void 0) {
|
|
3370
|
+
return signal;
|
|
3371
|
+
}
|
|
3372
|
+
return signals2.find((signalA) => signalA.number === number);
|
|
3373
|
+
};
|
|
3374
|
+
var signalsByNumber = getSignalsByNumber();
|
|
3375
|
+
|
|
3376
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/error.js
|
|
3377
|
+
var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
|
|
3378
|
+
if (timedOut) {
|
|
3379
|
+
return `timed out after ${timeout} milliseconds`;
|
|
3380
|
+
}
|
|
3381
|
+
if (isCanceled) {
|
|
3382
|
+
return "was canceled";
|
|
3383
|
+
}
|
|
3384
|
+
if (errorCode !== void 0) {
|
|
3385
|
+
return `failed with ${errorCode}`;
|
|
3386
|
+
}
|
|
3387
|
+
if (signal !== void 0) {
|
|
3388
|
+
return `was killed with ${signal} (${signalDescription})`;
|
|
3389
|
+
}
|
|
3390
|
+
if (exitCode !== void 0) {
|
|
3391
|
+
return `failed with exit code ${exitCode}`;
|
|
3392
|
+
}
|
|
3393
|
+
return "failed";
|
|
3394
|
+
};
|
|
3395
|
+
var makeError = ({
|
|
3396
|
+
stdout,
|
|
3397
|
+
stderr,
|
|
3398
|
+
all,
|
|
3399
|
+
error,
|
|
3400
|
+
signal,
|
|
3401
|
+
exitCode,
|
|
3402
|
+
command,
|
|
3403
|
+
escapedCommand,
|
|
3404
|
+
timedOut,
|
|
3405
|
+
isCanceled,
|
|
3406
|
+
killed,
|
|
3407
|
+
parsed: { options: { timeout, cwd = import_node_process4.default.cwd() } }
|
|
3408
|
+
}) => {
|
|
3409
|
+
exitCode = exitCode === null ? void 0 : exitCode;
|
|
3410
|
+
signal = signal === null ? void 0 : signal;
|
|
3411
|
+
const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
|
|
3412
|
+
const errorCode = error && error.code;
|
|
3413
|
+
const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
|
|
3414
|
+
const execaMessage = `Command ${prefix}: ${command}`;
|
|
3415
|
+
const isError = Object.prototype.toString.call(error) === "[object Error]";
|
|
3416
|
+
const shortMessage = isError ? `${execaMessage}
|
|
3417
|
+
${error.message}` : execaMessage;
|
|
3418
|
+
const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
|
|
3419
|
+
if (isError) {
|
|
3420
|
+
error.originalMessage = error.message;
|
|
3421
|
+
error.message = message;
|
|
3422
|
+
} else {
|
|
3423
|
+
error = new Error(message);
|
|
3424
|
+
}
|
|
3425
|
+
error.shortMessage = shortMessage;
|
|
3426
|
+
error.command = command;
|
|
3427
|
+
error.escapedCommand = escapedCommand;
|
|
3428
|
+
error.exitCode = exitCode;
|
|
3429
|
+
error.signal = signal;
|
|
3430
|
+
error.signalDescription = signalDescription;
|
|
3431
|
+
error.stdout = stdout;
|
|
3432
|
+
error.stderr = stderr;
|
|
3433
|
+
error.cwd = cwd;
|
|
3434
|
+
if (all !== void 0) {
|
|
3435
|
+
error.all = all;
|
|
3436
|
+
}
|
|
3437
|
+
if ("bufferedData" in error) {
|
|
3438
|
+
delete error.bufferedData;
|
|
3439
|
+
}
|
|
3440
|
+
error.failed = true;
|
|
3441
|
+
error.timedOut = Boolean(timedOut);
|
|
3442
|
+
error.isCanceled = isCanceled;
|
|
3443
|
+
error.killed = killed && !timedOut;
|
|
3444
|
+
return error;
|
|
3445
|
+
};
|
|
3446
|
+
|
|
3447
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stdio.js
|
|
3448
|
+
var aliases = ["stdin", "stdout", "stderr"];
|
|
3449
|
+
var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
|
|
3450
|
+
var normalizeStdio = (options) => {
|
|
3451
|
+
if (!options) {
|
|
3452
|
+
return;
|
|
3453
|
+
}
|
|
3454
|
+
const { stdio } = options;
|
|
3455
|
+
if (stdio === void 0) {
|
|
3456
|
+
return aliases.map((alias) => options[alias]);
|
|
3457
|
+
}
|
|
3458
|
+
if (hasAlias(options)) {
|
|
3459
|
+
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
|
|
3460
|
+
}
|
|
3461
|
+
if (typeof stdio === "string") {
|
|
3462
|
+
return stdio;
|
|
3463
|
+
}
|
|
3464
|
+
if (!Array.isArray(stdio)) {
|
|
3465
|
+
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
|
|
3466
|
+
}
|
|
3467
|
+
const length = Math.max(stdio.length, aliases.length);
|
|
3468
|
+
return Array.from({ length }, (value, index) => stdio[index]);
|
|
3469
|
+
};
|
|
3470
|
+
|
|
3471
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/kill.js
|
|
3472
|
+
var import_node_os3 = __toESM(require("node:os"), 1);
|
|
3473
|
+
|
|
3474
|
+
// node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
3475
|
+
var signals = [];
|
|
3476
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
3477
|
+
if (process.platform !== "win32") {
|
|
3478
|
+
signals.push(
|
|
3479
|
+
"SIGALRM",
|
|
3480
|
+
"SIGABRT",
|
|
3481
|
+
"SIGVTALRM",
|
|
3482
|
+
"SIGXCPU",
|
|
3483
|
+
"SIGXFSZ",
|
|
3484
|
+
"SIGUSR2",
|
|
3485
|
+
"SIGTRAP",
|
|
3486
|
+
"SIGSYS",
|
|
3487
|
+
"SIGQUIT",
|
|
3488
|
+
"SIGIOT"
|
|
3489
|
+
// should detect profiler and enable/disable accordingly.
|
|
3490
|
+
// see #21
|
|
3491
|
+
// 'SIGPROF'
|
|
3492
|
+
);
|
|
3493
|
+
}
|
|
3494
|
+
if (process.platform === "linux") {
|
|
3495
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
3496
|
+
}
|
|
3497
|
+
|
|
3498
|
+
// node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
3499
|
+
var processOk = (process7) => !!process7 && typeof process7 === "object" && typeof process7.removeListener === "function" && typeof process7.emit === "function" && typeof process7.reallyExit === "function" && typeof process7.listeners === "function" && typeof process7.kill === "function" && typeof process7.pid === "number" && typeof process7.on === "function";
|
|
3500
|
+
var kExitEmitter = Symbol.for("signal-exit emitter");
|
|
3501
|
+
var global2 = globalThis;
|
|
3502
|
+
var ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
3503
|
+
var Emitter = class {
|
|
3504
|
+
emitted = {
|
|
3505
|
+
afterExit: false,
|
|
3506
|
+
exit: false
|
|
3507
|
+
};
|
|
3508
|
+
listeners = {
|
|
3509
|
+
afterExit: [],
|
|
3510
|
+
exit: []
|
|
3511
|
+
};
|
|
3512
|
+
count = 0;
|
|
3513
|
+
id = Math.random();
|
|
3514
|
+
constructor() {
|
|
3515
|
+
if (global2[kExitEmitter]) {
|
|
3516
|
+
return global2[kExitEmitter];
|
|
3517
|
+
}
|
|
3518
|
+
ObjectDefineProperty(global2, kExitEmitter, {
|
|
3519
|
+
value: this,
|
|
3520
|
+
writable: false,
|
|
3521
|
+
enumerable: false,
|
|
3522
|
+
configurable: false
|
|
3523
|
+
});
|
|
3524
|
+
}
|
|
3525
|
+
on(ev, fn) {
|
|
3526
|
+
this.listeners[ev].push(fn);
|
|
3527
|
+
}
|
|
3528
|
+
removeListener(ev, fn) {
|
|
3529
|
+
const list = this.listeners[ev];
|
|
3530
|
+
const i = list.indexOf(fn);
|
|
3531
|
+
if (i === -1) {
|
|
3532
|
+
return;
|
|
3533
|
+
}
|
|
3534
|
+
if (i === 0 && list.length === 1) {
|
|
3535
|
+
list.length = 0;
|
|
3536
|
+
} else {
|
|
3537
|
+
list.splice(i, 1);
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
emit(ev, code, signal) {
|
|
3541
|
+
if (this.emitted[ev]) {
|
|
3542
|
+
return false;
|
|
3543
|
+
}
|
|
3544
|
+
this.emitted[ev] = true;
|
|
3545
|
+
let ret = false;
|
|
3546
|
+
for (const fn of this.listeners[ev]) {
|
|
3547
|
+
ret = fn(code, signal) === true || ret;
|
|
3548
|
+
}
|
|
3549
|
+
if (ev === "exit") {
|
|
3550
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
3551
|
+
}
|
|
3552
|
+
return ret;
|
|
3553
|
+
}
|
|
3554
|
+
};
|
|
3555
|
+
var SignalExitBase = class {
|
|
3556
|
+
};
|
|
3557
|
+
var signalExitWrap = (handler) => {
|
|
3558
|
+
return {
|
|
3559
|
+
onExit(cb, opts) {
|
|
3560
|
+
return handler.onExit(cb, opts);
|
|
3561
|
+
},
|
|
3562
|
+
load() {
|
|
3563
|
+
return handler.load();
|
|
3564
|
+
},
|
|
3565
|
+
unload() {
|
|
3566
|
+
return handler.unload();
|
|
3567
|
+
}
|
|
3568
|
+
};
|
|
3569
|
+
};
|
|
3570
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
3571
|
+
onExit() {
|
|
3572
|
+
return () => {
|
|
3573
|
+
};
|
|
3574
|
+
}
|
|
3575
|
+
load() {
|
|
3576
|
+
}
|
|
3577
|
+
unload() {
|
|
3578
|
+
}
|
|
3579
|
+
};
|
|
3580
|
+
var SignalExit = class extends SignalExitBase {
|
|
3581
|
+
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
3582
|
+
// so use a supported signal instead
|
|
3583
|
+
/* c8 ignore start */
|
|
3584
|
+
#hupSig = process4.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
3585
|
+
/* c8 ignore stop */
|
|
3586
|
+
#emitter = new Emitter();
|
|
3587
|
+
#process;
|
|
3588
|
+
#originalProcessEmit;
|
|
3589
|
+
#originalProcessReallyExit;
|
|
3590
|
+
#sigListeners = {};
|
|
3591
|
+
#loaded = false;
|
|
3592
|
+
constructor(process7) {
|
|
3593
|
+
super();
|
|
3594
|
+
this.#process = process7;
|
|
3595
|
+
this.#sigListeners = {};
|
|
3596
|
+
for (const sig of signals) {
|
|
3597
|
+
this.#sigListeners[sig] = () => {
|
|
3598
|
+
const listeners = this.#process.listeners(sig);
|
|
3599
|
+
let { count } = this.#emitter;
|
|
3600
|
+
const p = process7;
|
|
3601
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
3602
|
+
count += p.__signal_exit_emitter__.count;
|
|
3603
|
+
}
|
|
3604
|
+
if (listeners.length === count) {
|
|
3605
|
+
this.unload();
|
|
3606
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
3607
|
+
const s2 = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
3608
|
+
if (!ret)
|
|
3609
|
+
process7.kill(process7.pid, s2);
|
|
3610
|
+
}
|
|
3611
|
+
};
|
|
3612
|
+
}
|
|
3613
|
+
this.#originalProcessReallyExit = process7.reallyExit;
|
|
3614
|
+
this.#originalProcessEmit = process7.emit;
|
|
3615
|
+
}
|
|
3616
|
+
onExit(cb, opts) {
|
|
3617
|
+
if (!processOk(this.#process)) {
|
|
3618
|
+
return () => {
|
|
3619
|
+
};
|
|
3620
|
+
}
|
|
3621
|
+
if (this.#loaded === false) {
|
|
3622
|
+
this.load();
|
|
3623
|
+
}
|
|
3624
|
+
const ev = (opts == null ? void 0 : opts.alwaysLast) ? "afterExit" : "exit";
|
|
3625
|
+
this.#emitter.on(ev, cb);
|
|
3626
|
+
return () => {
|
|
3627
|
+
this.#emitter.removeListener(ev, cb);
|
|
3628
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
3629
|
+
this.unload();
|
|
3630
|
+
}
|
|
3631
|
+
};
|
|
3632
|
+
}
|
|
3633
|
+
load() {
|
|
3634
|
+
if (this.#loaded) {
|
|
3635
|
+
return;
|
|
3636
|
+
}
|
|
3637
|
+
this.#loaded = true;
|
|
3638
|
+
this.#emitter.count += 1;
|
|
3639
|
+
for (const sig of signals) {
|
|
3640
|
+
try {
|
|
3641
|
+
const fn = this.#sigListeners[sig];
|
|
3642
|
+
if (fn)
|
|
3643
|
+
this.#process.on(sig, fn);
|
|
3644
|
+
} catch (_3) {
|
|
3645
|
+
}
|
|
3646
|
+
}
|
|
3647
|
+
this.#process.emit = (ev, ...a3) => {
|
|
3648
|
+
return this.#processEmit(ev, ...a3);
|
|
3649
|
+
};
|
|
3650
|
+
this.#process.reallyExit = (code) => {
|
|
3651
|
+
return this.#processReallyExit(code);
|
|
3652
|
+
};
|
|
3653
|
+
}
|
|
3654
|
+
unload() {
|
|
3655
|
+
if (!this.#loaded) {
|
|
3656
|
+
return;
|
|
3657
|
+
}
|
|
3658
|
+
this.#loaded = false;
|
|
3659
|
+
signals.forEach((sig) => {
|
|
3660
|
+
const listener = this.#sigListeners[sig];
|
|
3661
|
+
if (!listener) {
|
|
3662
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
3663
|
+
}
|
|
3664
|
+
try {
|
|
3665
|
+
this.#process.removeListener(sig, listener);
|
|
3666
|
+
} catch (_3) {
|
|
3667
|
+
}
|
|
3668
|
+
});
|
|
3669
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
3670
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
3671
|
+
this.#emitter.count -= 1;
|
|
3672
|
+
}
|
|
3673
|
+
#processReallyExit(code) {
|
|
3674
|
+
if (!processOk(this.#process)) {
|
|
3675
|
+
return 0;
|
|
3676
|
+
}
|
|
3677
|
+
this.#process.exitCode = code || 0;
|
|
3678
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
3679
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
3680
|
+
}
|
|
3681
|
+
#processEmit(ev, ...args) {
|
|
3682
|
+
const og = this.#originalProcessEmit;
|
|
3683
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
3684
|
+
if (typeof args[0] === "number") {
|
|
3685
|
+
this.#process.exitCode = args[0];
|
|
3686
|
+
}
|
|
3687
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
3688
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
3689
|
+
return ret;
|
|
3690
|
+
} else {
|
|
3691
|
+
return og.call(this.#process, ev, ...args);
|
|
3692
|
+
}
|
|
3693
|
+
}
|
|
3694
|
+
};
|
|
3695
|
+
var process4 = globalThis.process;
|
|
3696
|
+
var {
|
|
3697
|
+
/**
|
|
3698
|
+
* Called when the process is exiting, whether via signal, explicit
|
|
3699
|
+
* exit, or running out of stuff to do.
|
|
3700
|
+
*
|
|
3701
|
+
* If the global process object is not suitable for instrumentation,
|
|
3702
|
+
* then this will be a no-op.
|
|
3703
|
+
*
|
|
3704
|
+
* Returns a function that may be used to unload signal-exit.
|
|
3705
|
+
*/
|
|
3706
|
+
onExit,
|
|
3707
|
+
/**
|
|
3708
|
+
* Load the listeners. Likely you never need to call this, unless
|
|
3709
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
3710
|
+
* Mostly exposed for the benefit of testing.
|
|
3711
|
+
*
|
|
3712
|
+
* @internal
|
|
3713
|
+
*/
|
|
3714
|
+
load,
|
|
3715
|
+
/**
|
|
3716
|
+
* Unload the listeners. Likely you never need to call this, unless
|
|
3717
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
3718
|
+
* Mostly exposed for the benefit of testing.
|
|
3719
|
+
*
|
|
3720
|
+
* @internal
|
|
3721
|
+
*/
|
|
3722
|
+
unload
|
|
3723
|
+
} = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback());
|
|
3724
|
+
|
|
3725
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/kill.js
|
|
3726
|
+
var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
|
|
3727
|
+
var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
|
|
3728
|
+
const killResult = kill(signal);
|
|
3729
|
+
setKillTimeout(kill, signal, options, killResult);
|
|
3730
|
+
return killResult;
|
|
3731
|
+
};
|
|
3732
|
+
var setKillTimeout = (kill, signal, options, killResult) => {
|
|
3733
|
+
if (!shouldForceKill(signal, options, killResult)) {
|
|
3734
|
+
return;
|
|
3735
|
+
}
|
|
3736
|
+
const timeout = getForceKillAfterTimeout(options);
|
|
3737
|
+
const t = setTimeout(() => {
|
|
3738
|
+
kill("SIGKILL");
|
|
3739
|
+
}, timeout);
|
|
3740
|
+
if (t.unref) {
|
|
3741
|
+
t.unref();
|
|
3742
|
+
}
|
|
3743
|
+
};
|
|
3744
|
+
var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
|
|
3745
|
+
var isSigterm = (signal) => signal === import_node_os3.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
|
|
3746
|
+
var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
|
|
3747
|
+
if (forceKillAfterTimeout === true) {
|
|
3748
|
+
return DEFAULT_FORCE_KILL_TIMEOUT;
|
|
3749
|
+
}
|
|
3750
|
+
if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
|
|
3751
|
+
throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
|
|
3752
|
+
}
|
|
3753
|
+
return forceKillAfterTimeout;
|
|
3754
|
+
};
|
|
3755
|
+
var spawnedCancel = (spawned, context) => {
|
|
3756
|
+
const killResult = spawned.kill();
|
|
3757
|
+
if (killResult) {
|
|
3758
|
+
context.isCanceled = true;
|
|
3759
|
+
}
|
|
3760
|
+
};
|
|
3761
|
+
var timeoutKill = (spawned, signal, reject) => {
|
|
3762
|
+
spawned.kill(signal);
|
|
3763
|
+
reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
|
|
3764
|
+
};
|
|
3765
|
+
var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
|
|
3766
|
+
if (timeout === 0 || timeout === void 0) {
|
|
3767
|
+
return spawnedPromise;
|
|
3768
|
+
}
|
|
3769
|
+
let timeoutId;
|
|
3770
|
+
const timeoutPromise = new Promise((resolve2, reject) => {
|
|
3771
|
+
timeoutId = setTimeout(() => {
|
|
3772
|
+
timeoutKill(spawned, killSignal, reject);
|
|
3773
|
+
}, timeout);
|
|
3774
|
+
});
|
|
3775
|
+
const safeSpawnedPromise = spawnedPromise.finally(() => {
|
|
3776
|
+
clearTimeout(timeoutId);
|
|
3777
|
+
});
|
|
3778
|
+
return Promise.race([timeoutPromise, safeSpawnedPromise]);
|
|
3779
|
+
};
|
|
3780
|
+
var validateTimeout = ({ timeout }) => {
|
|
3781
|
+
if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
|
|
3782
|
+
throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
|
|
3783
|
+
}
|
|
3784
|
+
};
|
|
3785
|
+
var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
|
|
3786
|
+
if (!cleanup || detached) {
|
|
3787
|
+
return timedPromise;
|
|
3788
|
+
}
|
|
3789
|
+
const removeExitHandler = onExit(() => {
|
|
3790
|
+
spawned.kill();
|
|
3791
|
+
});
|
|
3792
|
+
return timedPromise.finally(() => {
|
|
3793
|
+
removeExitHandler();
|
|
3794
|
+
});
|
|
3795
|
+
};
|
|
3796
|
+
|
|
3797
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/pipe.js
|
|
3798
|
+
var import_node_fs8 = require("node:fs");
|
|
3799
|
+
var import_node_child_process = require("node:child_process");
|
|
3800
|
+
|
|
3801
|
+
// node_modules/.pnpm/is-stream@3.0.0/node_modules/is-stream/index.js
|
|
3802
|
+
function isStream(stream) {
|
|
3803
|
+
return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
|
|
3804
|
+
}
|
|
3805
|
+
function isWritableStream(stream) {
|
|
3806
|
+
return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
|
|
3807
|
+
}
|
|
3808
|
+
|
|
3809
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/pipe.js
|
|
3810
|
+
var isExecaChildProcess = (target) => target instanceof import_node_child_process.ChildProcess && typeof target.then === "function";
|
|
3811
|
+
var pipeToTarget = (spawned, streamName, target) => {
|
|
3812
|
+
if (typeof target === "string") {
|
|
3813
|
+
spawned[streamName].pipe((0, import_node_fs8.createWriteStream)(target));
|
|
3814
|
+
return spawned;
|
|
3815
|
+
}
|
|
3816
|
+
if (isWritableStream(target)) {
|
|
3817
|
+
spawned[streamName].pipe(target);
|
|
3818
|
+
return spawned;
|
|
3819
|
+
}
|
|
3820
|
+
if (!isExecaChildProcess(target)) {
|
|
3821
|
+
throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
|
|
3822
|
+
}
|
|
3823
|
+
if (!isWritableStream(target.stdin)) {
|
|
3824
|
+
throw new TypeError("The target child process's stdin must be available.");
|
|
3825
|
+
}
|
|
3826
|
+
spawned[streamName].pipe(target.stdin);
|
|
3827
|
+
return target;
|
|
3828
|
+
};
|
|
3829
|
+
var addPipeMethods = (spawned) => {
|
|
3830
|
+
if (spawned.stdout !== null) {
|
|
3831
|
+
spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
|
|
3832
|
+
}
|
|
3833
|
+
if (spawned.stderr !== null) {
|
|
3834
|
+
spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
|
|
3835
|
+
}
|
|
3836
|
+
if (spawned.all !== void 0) {
|
|
3837
|
+
spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
|
|
3838
|
+
}
|
|
3839
|
+
};
|
|
3840
|
+
|
|
3841
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stream.js
|
|
3842
|
+
var import_node_fs9 = require("node:fs");
|
|
3843
|
+
var import_promises = require("node:timers/promises");
|
|
3844
|
+
|
|
3845
|
+
// node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/contents.js
|
|
3846
|
+
var getStreamContents = async (stream, { init: init2, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
|
|
3847
|
+
if (!isAsyncIterable(stream)) {
|
|
3848
|
+
throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
|
|
3849
|
+
}
|
|
3850
|
+
const state = init2();
|
|
3851
|
+
state.length = 0;
|
|
3852
|
+
try {
|
|
3853
|
+
for await (const chunk of stream) {
|
|
3854
|
+
const chunkType = getChunkType(chunk);
|
|
3855
|
+
const convertedChunk = convertChunk[chunkType](chunk, state);
|
|
3856
|
+
appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
|
|
3857
|
+
}
|
|
3858
|
+
appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
|
|
3859
|
+
return finalize(state);
|
|
3860
|
+
} catch (error) {
|
|
3861
|
+
error.bufferedData = finalize(state);
|
|
3862
|
+
throw error;
|
|
3863
|
+
}
|
|
3864
|
+
};
|
|
3865
|
+
var appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
|
|
3866
|
+
const convertedChunk = getFinalChunk(state);
|
|
3867
|
+
if (convertedChunk !== void 0) {
|
|
3868
|
+
appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
|
|
3869
|
+
}
|
|
3870
|
+
};
|
|
3871
|
+
var appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
|
|
3872
|
+
const chunkSize = getSize(convertedChunk);
|
|
3873
|
+
const newLength = state.length + chunkSize;
|
|
3874
|
+
if (newLength <= maxBuffer) {
|
|
3875
|
+
addNewChunk(convertedChunk, state, addChunk, newLength);
|
|
3876
|
+
return;
|
|
3877
|
+
}
|
|
3878
|
+
const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
|
|
3879
|
+
if (truncatedChunk !== void 0) {
|
|
3880
|
+
addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
|
|
3881
|
+
}
|
|
3882
|
+
throw new MaxBufferError();
|
|
3883
|
+
};
|
|
3884
|
+
var addNewChunk = (convertedChunk, state, addChunk, newLength) => {
|
|
3885
|
+
state.contents = addChunk(convertedChunk, state, newLength);
|
|
3886
|
+
state.length = newLength;
|
|
3887
|
+
};
|
|
3888
|
+
var isAsyncIterable = (stream) => typeof stream === "object" && stream !== null && typeof stream[Symbol.asyncIterator] === "function";
|
|
3889
|
+
var getChunkType = (chunk) => {
|
|
3890
|
+
var _a;
|
|
3891
|
+
const typeOfChunk = typeof chunk;
|
|
3892
|
+
if (typeOfChunk === "string") {
|
|
3893
|
+
return "string";
|
|
3894
|
+
}
|
|
3895
|
+
if (typeOfChunk !== "object" || chunk === null) {
|
|
3896
|
+
return "others";
|
|
3897
|
+
}
|
|
3898
|
+
if ((_a = globalThis.Buffer) == null ? void 0 : _a.isBuffer(chunk)) {
|
|
3899
|
+
return "buffer";
|
|
3900
|
+
}
|
|
3901
|
+
const prototypeName = objectToString.call(chunk);
|
|
3902
|
+
if (prototypeName === "[object ArrayBuffer]") {
|
|
3903
|
+
return "arrayBuffer";
|
|
3904
|
+
}
|
|
3905
|
+
if (prototypeName === "[object DataView]") {
|
|
3906
|
+
return "dataView";
|
|
3907
|
+
}
|
|
3908
|
+
if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
|
|
3909
|
+
return "typedArray";
|
|
3910
|
+
}
|
|
3911
|
+
return "others";
|
|
3912
|
+
};
|
|
3913
|
+
var { toString: objectToString } = Object.prototype;
|
|
3914
|
+
var MaxBufferError = class extends Error {
|
|
3915
|
+
name = "MaxBufferError";
|
|
3916
|
+
constructor() {
|
|
3917
|
+
super("maxBuffer exceeded");
|
|
3918
|
+
}
|
|
3919
|
+
};
|
|
3920
|
+
|
|
3921
|
+
// node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/utils.js
|
|
3922
|
+
var identity = (value) => value;
|
|
3923
|
+
var noop = () => void 0;
|
|
3924
|
+
var getContentsProp = ({ contents }) => contents;
|
|
3925
|
+
var throwObjectStream = (chunk) => {
|
|
3926
|
+
throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
|
|
3927
|
+
};
|
|
3928
|
+
var getLengthProp = (convertedChunk) => convertedChunk.length;
|
|
3929
|
+
|
|
3930
|
+
// node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/array-buffer.js
|
|
3931
|
+
async function getStreamAsArrayBuffer(stream, options) {
|
|
3932
|
+
return getStreamContents(stream, arrayBufferMethods, options);
|
|
3933
|
+
}
|
|
3934
|
+
var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
|
|
3935
|
+
var useTextEncoder = (chunk) => textEncoder.encode(chunk);
|
|
3936
|
+
var textEncoder = new TextEncoder();
|
|
3937
|
+
var useUint8Array = (chunk) => new Uint8Array(chunk);
|
|
3938
|
+
var useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
3939
|
+
var truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
|
|
3940
|
+
var addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
|
|
3941
|
+
const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
|
|
3942
|
+
new Uint8Array(newContents).set(convertedChunk, previousLength);
|
|
3943
|
+
return newContents;
|
|
3944
|
+
};
|
|
3945
|
+
var resizeArrayBufferSlow = (contents, length) => {
|
|
3946
|
+
if (length <= contents.byteLength) {
|
|
3947
|
+
return contents;
|
|
3948
|
+
}
|
|
3949
|
+
const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
|
|
3950
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
3951
|
+
return arrayBuffer;
|
|
3952
|
+
};
|
|
3953
|
+
var resizeArrayBuffer = (contents, length) => {
|
|
3954
|
+
if (length <= contents.maxByteLength) {
|
|
3955
|
+
contents.resize(length);
|
|
3956
|
+
return contents;
|
|
3957
|
+
}
|
|
3958
|
+
const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
|
|
3959
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
3960
|
+
return arrayBuffer;
|
|
3961
|
+
};
|
|
3962
|
+
var getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
|
|
3963
|
+
var SCALE_FACTOR = 2;
|
|
3964
|
+
var finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
|
|
3965
|
+
var hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
|
|
3966
|
+
var arrayBufferMethods = {
|
|
3967
|
+
init: initArrayBuffer,
|
|
3968
|
+
convertChunk: {
|
|
3969
|
+
string: useTextEncoder,
|
|
3970
|
+
buffer: useUint8Array,
|
|
3971
|
+
arrayBuffer: useUint8Array,
|
|
3972
|
+
dataView: useUint8ArrayWithOffset,
|
|
3973
|
+
typedArray: useUint8ArrayWithOffset,
|
|
3974
|
+
others: throwObjectStream
|
|
3975
|
+
},
|
|
3976
|
+
getSize: getLengthProp,
|
|
3977
|
+
truncateChunk: truncateArrayBufferChunk,
|
|
3978
|
+
addChunk: addArrayBufferChunk,
|
|
3979
|
+
getFinalChunk: noop,
|
|
3980
|
+
finalize: finalizeArrayBuffer
|
|
3981
|
+
};
|
|
3982
|
+
|
|
3983
|
+
// node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/buffer.js
|
|
3984
|
+
async function getStreamAsBuffer(stream, options) {
|
|
3985
|
+
if (!("Buffer" in globalThis)) {
|
|
3986
|
+
throw new Error("getStreamAsBuffer() is only supported in Node.js");
|
|
3987
|
+
}
|
|
3988
|
+
try {
|
|
3989
|
+
return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options));
|
|
3990
|
+
} catch (error) {
|
|
3991
|
+
if (error.bufferedData !== void 0) {
|
|
3992
|
+
error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
|
|
3993
|
+
}
|
|
3994
|
+
throw error;
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3997
|
+
var arrayBufferToNodeBuffer = (arrayBuffer) => globalThis.Buffer.from(arrayBuffer);
|
|
3998
|
+
|
|
3999
|
+
// node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/string.js
|
|
4000
|
+
async function getStreamAsString(stream, options) {
|
|
4001
|
+
return getStreamContents(stream, stringMethods, options);
|
|
4002
|
+
}
|
|
4003
|
+
var initString = () => ({ contents: "", textDecoder: new TextDecoder() });
|
|
4004
|
+
var useTextDecoder = (chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true });
|
|
4005
|
+
var addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
|
|
4006
|
+
var truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
|
|
4007
|
+
var getFinalStringChunk = ({ textDecoder }) => {
|
|
4008
|
+
const finalChunk = textDecoder.decode();
|
|
4009
|
+
return finalChunk === "" ? void 0 : finalChunk;
|
|
4010
|
+
};
|
|
4011
|
+
var stringMethods = {
|
|
4012
|
+
init: initString,
|
|
4013
|
+
convertChunk: {
|
|
4014
|
+
string: identity,
|
|
4015
|
+
buffer: useTextDecoder,
|
|
4016
|
+
arrayBuffer: useTextDecoder,
|
|
4017
|
+
dataView: useTextDecoder,
|
|
4018
|
+
typedArray: useTextDecoder,
|
|
4019
|
+
others: throwObjectStream
|
|
4020
|
+
},
|
|
4021
|
+
getSize: getLengthProp,
|
|
4022
|
+
truncateChunk: truncateStringChunk,
|
|
4023
|
+
addChunk: addStringChunk,
|
|
4024
|
+
getFinalChunk: getFinalStringChunk,
|
|
4025
|
+
finalize: getContentsProp
|
|
4026
|
+
};
|
|
4027
|
+
|
|
4028
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stream.js
|
|
4029
|
+
var import_merge_stream = __toESM(require_merge_stream(), 1);
|
|
4030
|
+
var validateInputOptions = (input) => {
|
|
4031
|
+
if (input !== void 0) {
|
|
4032
|
+
throw new TypeError("The `input` and `inputFile` options cannot be both set.");
|
|
4033
|
+
}
|
|
4034
|
+
};
|
|
4035
|
+
var getInputSync = ({ input, inputFile }) => {
|
|
4036
|
+
if (typeof inputFile !== "string") {
|
|
4037
|
+
return input;
|
|
4038
|
+
}
|
|
4039
|
+
validateInputOptions(input);
|
|
4040
|
+
return (0, import_node_fs9.readFileSync)(inputFile);
|
|
4041
|
+
};
|
|
4042
|
+
var handleInputSync = (options) => {
|
|
4043
|
+
const input = getInputSync(options);
|
|
4044
|
+
if (isStream(input)) {
|
|
4045
|
+
throw new TypeError("The `input` option cannot be a stream in sync mode");
|
|
4046
|
+
}
|
|
4047
|
+
return input;
|
|
4048
|
+
};
|
|
4049
|
+
var getInput = ({ input, inputFile }) => {
|
|
4050
|
+
if (typeof inputFile !== "string") {
|
|
4051
|
+
return input;
|
|
4052
|
+
}
|
|
4053
|
+
validateInputOptions(input);
|
|
4054
|
+
return (0, import_node_fs9.createReadStream)(inputFile);
|
|
4055
|
+
};
|
|
4056
|
+
var handleInput = (spawned, options) => {
|
|
4057
|
+
const input = getInput(options);
|
|
4058
|
+
if (input === void 0) {
|
|
4059
|
+
return;
|
|
4060
|
+
}
|
|
4061
|
+
if (isStream(input)) {
|
|
4062
|
+
input.pipe(spawned.stdin);
|
|
4063
|
+
} else {
|
|
4064
|
+
spawned.stdin.end(input);
|
|
4065
|
+
}
|
|
4066
|
+
};
|
|
4067
|
+
var makeAllStream = (spawned, { all }) => {
|
|
4068
|
+
if (!all || !spawned.stdout && !spawned.stderr) {
|
|
4069
|
+
return;
|
|
4070
|
+
}
|
|
4071
|
+
const mixed = (0, import_merge_stream.default)();
|
|
4072
|
+
if (spawned.stdout) {
|
|
4073
|
+
mixed.add(spawned.stdout);
|
|
4074
|
+
}
|
|
4075
|
+
if (spawned.stderr) {
|
|
4076
|
+
mixed.add(spawned.stderr);
|
|
4077
|
+
}
|
|
4078
|
+
return mixed;
|
|
4079
|
+
};
|
|
4080
|
+
var getBufferedData = async (stream, streamPromise) => {
|
|
4081
|
+
if (!stream || streamPromise === void 0) {
|
|
4082
|
+
return;
|
|
4083
|
+
}
|
|
4084
|
+
await (0, import_promises.setTimeout)(0);
|
|
4085
|
+
stream.destroy();
|
|
4086
|
+
try {
|
|
4087
|
+
return await streamPromise;
|
|
4088
|
+
} catch (error) {
|
|
4089
|
+
return error.bufferedData;
|
|
4090
|
+
}
|
|
4091
|
+
};
|
|
4092
|
+
var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
|
|
4093
|
+
if (!stream || !buffer) {
|
|
4094
|
+
return;
|
|
4095
|
+
}
|
|
4096
|
+
if (encoding === "utf8" || encoding === "utf-8") {
|
|
4097
|
+
return getStreamAsString(stream, { maxBuffer });
|
|
4098
|
+
}
|
|
4099
|
+
if (encoding === null || encoding === "buffer") {
|
|
4100
|
+
return getStreamAsBuffer(stream, { maxBuffer });
|
|
4101
|
+
}
|
|
4102
|
+
return applyEncoding(stream, maxBuffer, encoding);
|
|
4103
|
+
};
|
|
4104
|
+
var applyEncoding = async (stream, maxBuffer, encoding) => {
|
|
4105
|
+
const buffer = await getStreamAsBuffer(stream, { maxBuffer });
|
|
4106
|
+
return buffer.toString(encoding);
|
|
4107
|
+
};
|
|
4108
|
+
var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
|
|
4109
|
+
const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
|
|
4110
|
+
const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
|
|
4111
|
+
const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
|
|
4112
|
+
try {
|
|
4113
|
+
return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
|
|
4114
|
+
} catch (error) {
|
|
4115
|
+
return Promise.all([
|
|
4116
|
+
{ error, signal: error.signal, timedOut: error.timedOut },
|
|
4117
|
+
getBufferedData(stdout, stdoutPromise),
|
|
4118
|
+
getBufferedData(stderr, stderrPromise),
|
|
4119
|
+
getBufferedData(all, allPromise)
|
|
4120
|
+
]);
|
|
4121
|
+
}
|
|
4122
|
+
};
|
|
4123
|
+
|
|
4124
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/promise.js
|
|
4125
|
+
var nativePromisePrototype = (async () => {
|
|
4126
|
+
})().constructor.prototype;
|
|
4127
|
+
var descriptors = ["then", "catch", "finally"].map((property) => [
|
|
4128
|
+
property,
|
|
4129
|
+
Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
|
|
4130
|
+
]);
|
|
4131
|
+
var mergePromise = (spawned, promise) => {
|
|
4132
|
+
for (const [property, descriptor] of descriptors) {
|
|
4133
|
+
const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
|
|
4134
|
+
Reflect.defineProperty(spawned, property, { ...descriptor, value });
|
|
4135
|
+
}
|
|
4136
|
+
};
|
|
4137
|
+
var getSpawnedPromise = (spawned) => new Promise((resolve2, reject) => {
|
|
4138
|
+
spawned.on("exit", (exitCode, signal) => {
|
|
4139
|
+
resolve2({ exitCode, signal });
|
|
4140
|
+
});
|
|
4141
|
+
spawned.on("error", (error) => {
|
|
4142
|
+
reject(error);
|
|
4143
|
+
});
|
|
4144
|
+
if (spawned.stdin) {
|
|
4145
|
+
spawned.stdin.on("error", (error) => {
|
|
4146
|
+
reject(error);
|
|
4147
|
+
});
|
|
4148
|
+
}
|
|
4149
|
+
});
|
|
4150
|
+
|
|
4151
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/command.js
|
|
4152
|
+
var import_node_buffer = require("node:buffer");
|
|
4153
|
+
var import_node_child_process2 = require("node:child_process");
|
|
4154
|
+
var normalizeArgs = (file, args = []) => {
|
|
4155
|
+
if (!Array.isArray(args)) {
|
|
4156
|
+
return [file];
|
|
4157
|
+
}
|
|
4158
|
+
return [file, ...args];
|
|
4159
|
+
};
|
|
4160
|
+
var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
|
|
4161
|
+
var escapeArg = (arg) => {
|
|
4162
|
+
if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
|
|
4163
|
+
return arg;
|
|
4164
|
+
}
|
|
4165
|
+
return `"${arg.replaceAll('"', '\\"')}"`;
|
|
4166
|
+
};
|
|
4167
|
+
var joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
|
|
4168
|
+
var getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
|
|
4169
|
+
var SPACES_REGEXP = / +/g;
|
|
4170
|
+
var parseCommand = (command) => {
|
|
4171
|
+
const tokens = [];
|
|
4172
|
+
for (const token of command.trim().split(SPACES_REGEXP)) {
|
|
4173
|
+
const previousToken = tokens.at(-1);
|
|
4174
|
+
if (previousToken && previousToken.endsWith("\\")) {
|
|
4175
|
+
tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
|
|
4176
|
+
} else {
|
|
4177
|
+
tokens.push(token);
|
|
4178
|
+
}
|
|
4179
|
+
}
|
|
4180
|
+
return tokens;
|
|
4181
|
+
};
|
|
4182
|
+
var parseExpression = (expression) => {
|
|
4183
|
+
const typeOfExpression = typeof expression;
|
|
4184
|
+
if (typeOfExpression === "string") {
|
|
4185
|
+
return expression;
|
|
4186
|
+
}
|
|
4187
|
+
if (typeOfExpression === "number") {
|
|
4188
|
+
return String(expression);
|
|
4189
|
+
}
|
|
4190
|
+
if (typeOfExpression === "object" && expression !== null && !(expression instanceof import_node_child_process2.ChildProcess) && "stdout" in expression) {
|
|
4191
|
+
const typeOfStdout = typeof expression.stdout;
|
|
4192
|
+
if (typeOfStdout === "string") {
|
|
4193
|
+
return expression.stdout;
|
|
4194
|
+
}
|
|
4195
|
+
if (import_node_buffer.Buffer.isBuffer(expression.stdout)) {
|
|
4196
|
+
return expression.stdout.toString();
|
|
4197
|
+
}
|
|
4198
|
+
throw new TypeError(`Unexpected "${typeOfStdout}" stdout in template expression`);
|
|
4199
|
+
}
|
|
4200
|
+
throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
|
|
4201
|
+
};
|
|
4202
|
+
var concatTokens = (tokens, nextTokens, isNew) => isNew || tokens.length === 0 || nextTokens.length === 0 ? [...tokens, ...nextTokens] : [
|
|
4203
|
+
...tokens.slice(0, -1),
|
|
4204
|
+
`${tokens.at(-1)}${nextTokens[0]}`,
|
|
4205
|
+
...nextTokens.slice(1)
|
|
4206
|
+
];
|
|
4207
|
+
var parseTemplate = ({ templates: templates2, expressions, tokens, index, template }) => {
|
|
4208
|
+
const templateString = template ?? templates2.raw[index];
|
|
4209
|
+
const templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);
|
|
4210
|
+
const newTokens = concatTokens(
|
|
4211
|
+
tokens,
|
|
4212
|
+
templateTokens,
|
|
4213
|
+
templateString.startsWith(" ")
|
|
4214
|
+
);
|
|
4215
|
+
if (index === expressions.length) {
|
|
4216
|
+
return newTokens;
|
|
4217
|
+
}
|
|
4218
|
+
const expression = expressions[index];
|
|
4219
|
+
const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
|
|
4220
|
+
return concatTokens(
|
|
4221
|
+
newTokens,
|
|
4222
|
+
expressionTokens,
|
|
4223
|
+
templateString.endsWith(" ")
|
|
4224
|
+
);
|
|
4225
|
+
};
|
|
4226
|
+
var parseTemplates = (templates2, expressions) => {
|
|
4227
|
+
let tokens = [];
|
|
4228
|
+
for (const [index, template] of templates2.entries()) {
|
|
4229
|
+
tokens = parseTemplate({ templates: templates2, expressions, tokens, index, template });
|
|
4230
|
+
}
|
|
4231
|
+
return tokens;
|
|
4232
|
+
};
|
|
4233
|
+
|
|
4234
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/verbose.js
|
|
4235
|
+
var import_node_util = require("node:util");
|
|
4236
|
+
var import_node_process5 = __toESM(require("node:process"), 1);
|
|
4237
|
+
var verboseDefault = (0, import_node_util.debuglog)("execa").enabled;
|
|
4238
|
+
var padField = (field, padding) => String(field).padStart(padding, "0");
|
|
4239
|
+
var getTimestamp = () => {
|
|
4240
|
+
const date = /* @__PURE__ */ new Date();
|
|
4241
|
+
return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
|
|
4242
|
+
};
|
|
4243
|
+
var logCommand = (escapedCommand, { verbose }) => {
|
|
4244
|
+
if (!verbose) {
|
|
4245
|
+
return;
|
|
4246
|
+
}
|
|
4247
|
+
import_node_process5.default.stderr.write(`[${getTimestamp()}] ${escapedCommand}
|
|
4248
|
+
`);
|
|
4249
|
+
};
|
|
4250
|
+
|
|
4251
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js
|
|
4252
|
+
var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
|
|
4253
|
+
var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
|
|
4254
|
+
const env = extendEnv ? { ...import_node_process6.default.env, ...envOption } : envOption;
|
|
4255
|
+
if (preferLocal) {
|
|
4256
|
+
return npmRunPathEnv({ env, cwd: localDir, execPath });
|
|
4257
|
+
}
|
|
4258
|
+
return env;
|
|
4259
|
+
};
|
|
4260
|
+
var handleArguments = (file, args, options = {}) => {
|
|
4261
|
+
const parsed = import_cross_spawn2.default._parse(file, args, options);
|
|
4262
|
+
file = parsed.command;
|
|
4263
|
+
args = parsed.args;
|
|
4264
|
+
options = parsed.options;
|
|
4265
|
+
options = {
|
|
4266
|
+
maxBuffer: DEFAULT_MAX_BUFFER,
|
|
4267
|
+
buffer: true,
|
|
4268
|
+
stripFinalNewline: true,
|
|
4269
|
+
extendEnv: true,
|
|
4270
|
+
preferLocal: false,
|
|
4271
|
+
localDir: options.cwd || import_node_process6.default.cwd(),
|
|
4272
|
+
execPath: import_node_process6.default.execPath,
|
|
4273
|
+
encoding: "utf8",
|
|
4274
|
+
reject: true,
|
|
4275
|
+
cleanup: true,
|
|
4276
|
+
all: false,
|
|
4277
|
+
windowsHide: true,
|
|
4278
|
+
verbose: verboseDefault,
|
|
4279
|
+
...options
|
|
4280
|
+
};
|
|
4281
|
+
options.env = getEnv(options);
|
|
4282
|
+
options.stdio = normalizeStdio(options);
|
|
4283
|
+
if (import_node_process6.default.platform === "win32" && import_node_path9.default.basename(file, ".exe") === "cmd") {
|
|
4284
|
+
args.unshift("/q");
|
|
4285
|
+
}
|
|
4286
|
+
return { file, args, options, parsed };
|
|
4287
|
+
};
|
|
4288
|
+
var handleOutput = (options, value, error) => {
|
|
4289
|
+
if (typeof value !== "string" && !import_node_buffer2.Buffer.isBuffer(value)) {
|
|
4290
|
+
return error === void 0 ? void 0 : "";
|
|
4291
|
+
}
|
|
4292
|
+
if (options.stripFinalNewline) {
|
|
4293
|
+
return stripFinalNewline(value);
|
|
4294
|
+
}
|
|
4295
|
+
return value;
|
|
4296
|
+
};
|
|
4297
|
+
function execa(file, args, options) {
|
|
4298
|
+
const parsed = handleArguments(file, args, options);
|
|
4299
|
+
const command = joinCommand(file, args);
|
|
4300
|
+
const escapedCommand = getEscapedCommand(file, args);
|
|
4301
|
+
logCommand(escapedCommand, parsed.options);
|
|
4302
|
+
validateTimeout(parsed.options);
|
|
4303
|
+
let spawned;
|
|
4304
|
+
try {
|
|
4305
|
+
spawned = import_node_child_process3.default.spawn(parsed.file, parsed.args, parsed.options);
|
|
4306
|
+
} catch (error) {
|
|
4307
|
+
const dummySpawned = new import_node_child_process3.default.ChildProcess();
|
|
4308
|
+
const errorPromise = Promise.reject(makeError({
|
|
4309
|
+
error,
|
|
4310
|
+
stdout: "",
|
|
4311
|
+
stderr: "",
|
|
4312
|
+
all: "",
|
|
4313
|
+
command,
|
|
4314
|
+
escapedCommand,
|
|
4315
|
+
parsed,
|
|
4316
|
+
timedOut: false,
|
|
4317
|
+
isCanceled: false,
|
|
4318
|
+
killed: false
|
|
4319
|
+
}));
|
|
4320
|
+
mergePromise(dummySpawned, errorPromise);
|
|
4321
|
+
return dummySpawned;
|
|
4322
|
+
}
|
|
4323
|
+
const spawnedPromise = getSpawnedPromise(spawned);
|
|
4324
|
+
const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
|
|
4325
|
+
const processDone = setExitHandler(spawned, parsed.options, timedPromise);
|
|
4326
|
+
const context = { isCanceled: false };
|
|
4327
|
+
spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
|
|
4328
|
+
spawned.cancel = spawnedCancel.bind(null, spawned, context);
|
|
4329
|
+
const handlePromise = async () => {
|
|
4330
|
+
const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
|
|
4331
|
+
const stdout = handleOutput(parsed.options, stdoutResult);
|
|
4332
|
+
const stderr = handleOutput(parsed.options, stderrResult);
|
|
4333
|
+
const all = handleOutput(parsed.options, allResult);
|
|
4334
|
+
if (error || exitCode !== 0 || signal !== null) {
|
|
4335
|
+
const returnedError = makeError({
|
|
4336
|
+
error,
|
|
4337
|
+
exitCode,
|
|
4338
|
+
signal,
|
|
4339
|
+
stdout,
|
|
4340
|
+
stderr,
|
|
4341
|
+
all,
|
|
4342
|
+
command,
|
|
4343
|
+
escapedCommand,
|
|
4344
|
+
parsed,
|
|
4345
|
+
timedOut,
|
|
4346
|
+
isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
|
|
4347
|
+
killed: spawned.killed
|
|
4348
|
+
});
|
|
4349
|
+
if (!parsed.options.reject) {
|
|
4350
|
+
return returnedError;
|
|
4351
|
+
}
|
|
4352
|
+
throw returnedError;
|
|
4353
|
+
}
|
|
4354
|
+
return {
|
|
4355
|
+
command,
|
|
4356
|
+
escapedCommand,
|
|
4357
|
+
exitCode: 0,
|
|
4358
|
+
stdout,
|
|
4359
|
+
stderr,
|
|
4360
|
+
all,
|
|
4361
|
+
failed: false,
|
|
4362
|
+
timedOut: false,
|
|
4363
|
+
isCanceled: false,
|
|
4364
|
+
killed: false
|
|
4365
|
+
};
|
|
4366
|
+
};
|
|
4367
|
+
const handlePromiseOnce = onetime_default(handlePromise);
|
|
4368
|
+
handleInput(spawned, parsed.options);
|
|
4369
|
+
spawned.all = makeAllStream(spawned, parsed.options);
|
|
4370
|
+
addPipeMethods(spawned);
|
|
4371
|
+
mergePromise(spawned, handlePromiseOnce);
|
|
4372
|
+
return spawned;
|
|
4373
|
+
}
|
|
4374
|
+
function execaSync(file, args, options) {
|
|
4375
|
+
const parsed = handleArguments(file, args, options);
|
|
4376
|
+
const command = joinCommand(file, args);
|
|
4377
|
+
const escapedCommand = getEscapedCommand(file, args);
|
|
4378
|
+
logCommand(escapedCommand, parsed.options);
|
|
4379
|
+
const input = handleInputSync(parsed.options);
|
|
4380
|
+
let result;
|
|
4381
|
+
try {
|
|
4382
|
+
result = import_node_child_process3.default.spawnSync(parsed.file, parsed.args, { ...parsed.options, input });
|
|
4383
|
+
} catch (error) {
|
|
4384
|
+
throw makeError({
|
|
4385
|
+
error,
|
|
4386
|
+
stdout: "",
|
|
4387
|
+
stderr: "",
|
|
4388
|
+
all: "",
|
|
4389
|
+
command,
|
|
4390
|
+
escapedCommand,
|
|
4391
|
+
parsed,
|
|
4392
|
+
timedOut: false,
|
|
4393
|
+
isCanceled: false,
|
|
4394
|
+
killed: false
|
|
4395
|
+
});
|
|
4396
|
+
}
|
|
4397
|
+
const stdout = handleOutput(parsed.options, result.stdout, result.error);
|
|
4398
|
+
const stderr = handleOutput(parsed.options, result.stderr, result.error);
|
|
4399
|
+
if (result.error || result.status !== 0 || result.signal !== null) {
|
|
4400
|
+
const error = makeError({
|
|
4401
|
+
stdout,
|
|
4402
|
+
stderr,
|
|
4403
|
+
error: result.error,
|
|
4404
|
+
signal: result.signal,
|
|
4405
|
+
exitCode: result.status,
|
|
4406
|
+
command,
|
|
4407
|
+
escapedCommand,
|
|
4408
|
+
parsed,
|
|
4409
|
+
timedOut: result.error && result.error.code === "ETIMEDOUT",
|
|
4410
|
+
isCanceled: false,
|
|
4411
|
+
killed: result.signal !== null
|
|
4412
|
+
});
|
|
4413
|
+
if (!parsed.options.reject) {
|
|
4414
|
+
return error;
|
|
4415
|
+
}
|
|
4416
|
+
throw error;
|
|
4417
|
+
}
|
|
4418
|
+
return {
|
|
4419
|
+
command,
|
|
4420
|
+
escapedCommand,
|
|
4421
|
+
exitCode: 0,
|
|
4422
|
+
stdout,
|
|
4423
|
+
stderr,
|
|
4424
|
+
failed: false,
|
|
4425
|
+
timedOut: false,
|
|
4426
|
+
isCanceled: false,
|
|
4427
|
+
killed: false
|
|
4428
|
+
};
|
|
4429
|
+
}
|
|
4430
|
+
var normalizeScriptStdin = ({ input, inputFile, stdio }) => input === void 0 && inputFile === void 0 && stdio === void 0 ? { stdin: "inherit" } : {};
|
|
4431
|
+
var normalizeScriptOptions = (options = {}) => ({
|
|
4432
|
+
preferLocal: true,
|
|
4433
|
+
...normalizeScriptStdin(options),
|
|
4434
|
+
...options
|
|
4435
|
+
});
|
|
4436
|
+
function create$(options) {
|
|
4437
|
+
function $4(templatesOrOptions, ...expressions) {
|
|
4438
|
+
if (!Array.isArray(templatesOrOptions)) {
|
|
4439
|
+
return create$({ ...options, ...templatesOrOptions });
|
|
4440
|
+
}
|
|
4441
|
+
const [file, ...args] = parseTemplates(templatesOrOptions, expressions);
|
|
4442
|
+
return execa(file, args, normalizeScriptOptions(options));
|
|
4443
|
+
}
|
|
4444
|
+
$4.sync = (templates2, ...expressions) => {
|
|
4445
|
+
if (!Array.isArray(templates2)) {
|
|
4446
|
+
throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");
|
|
4447
|
+
}
|
|
4448
|
+
const [file, ...args] = parseTemplates(templates2, expressions);
|
|
4449
|
+
return execaSync(file, args, normalizeScriptOptions(options));
|
|
4450
|
+
};
|
|
4451
|
+
return $4;
|
|
4452
|
+
}
|
|
4453
|
+
var $3 = create$();
|
|
4454
|
+
function execaCommand(command, options) {
|
|
4455
|
+
const [file, ...args] = parseCommand(command);
|
|
4456
|
+
return execa(file, args, options);
|
|
4457
|
+
}
|
|
4458
|
+
|
|
4459
|
+
// packages/qwik/src/cli/utils/run-build-command.ts
|
|
4460
|
+
async function runBuildCommand(app) {
|
|
4461
|
+
const pkgJsonScripts = app.packageJson.scripts;
|
|
4462
|
+
if (!pkgJsonScripts) {
|
|
4463
|
+
throw new Error(`No "scripts" property found in package.json`);
|
|
4464
|
+
}
|
|
4465
|
+
const pkgManager = getPackageManager();
|
|
4466
|
+
const getScript = (name) => {
|
|
4467
|
+
if (pkgJsonScripts[name]) {
|
|
4468
|
+
return `${pkgManager} run ${name}`;
|
|
4469
|
+
}
|
|
4470
|
+
return void 0;
|
|
4471
|
+
};
|
|
4472
|
+
const isPreviewBuild = app.args.includes("preview");
|
|
4473
|
+
const buildLibScript = getScript("build.lib");
|
|
4474
|
+
const isLibraryBuild = !!buildLibScript;
|
|
4475
|
+
const buildClientScript = getScript("build.client");
|
|
4476
|
+
const buildPreviewScript = isPreviewBuild ? getScript("build.preview") : void 0;
|
|
4477
|
+
const buildServerScript = !isPreviewBuild ? getScript("build.server") : void 0;
|
|
4478
|
+
const buildStaticScript = getScript("build.static");
|
|
4479
|
+
const runSsgScript = getScript("ssg");
|
|
4480
|
+
const buildTypes = getScript("build.types");
|
|
4481
|
+
const lint = getScript("lint");
|
|
4482
|
+
const mode = app.getArg("mode");
|
|
4483
|
+
const prebuildScripts = Object.keys(pkgJsonScripts).filter((s2) => s2.startsWith("prebuild.")).map(getScript).filter(isString);
|
|
4484
|
+
const postbuildScripts = Object.keys(pkgJsonScripts).filter((s2) => s2.startsWith("postbuild.")).map(getScript).filter(isString);
|
|
4485
|
+
const scripts = [
|
|
4486
|
+
buildTypes,
|
|
4487
|
+
buildClientScript,
|
|
4488
|
+
buildLibScript,
|
|
4489
|
+
buildPreviewScript,
|
|
4490
|
+
buildServerScript,
|
|
4491
|
+
buildStaticScript,
|
|
4492
|
+
lint
|
|
4493
|
+
].filter(isString);
|
|
4494
|
+
if (!isLibraryBuild && !buildClientScript) {
|
|
4495
|
+
console.log(pkgJsonScripts);
|
|
4496
|
+
throw new Error(`"build.client" script not found in package.json`);
|
|
4497
|
+
}
|
|
4498
|
+
if (isPreviewBuild && !buildPreviewScript && !buildStaticScript) {
|
|
4499
|
+
throw new Error(
|
|
4500
|
+
`Neither "build.preview" or "build.static" script found in package.json for preview`
|
|
4501
|
+
);
|
|
4502
|
+
}
|
|
4503
|
+
console.log(``);
|
|
4504
|
+
for (const script of prebuildScripts) {
|
|
4505
|
+
console.log(dim(script));
|
|
4506
|
+
}
|
|
4507
|
+
for (const script of scripts) {
|
|
4508
|
+
console.log(dim(script));
|
|
4509
|
+
}
|
|
4510
|
+
for (const script of postbuildScripts) {
|
|
4511
|
+
console.log(dim(script));
|
|
4512
|
+
}
|
|
4513
|
+
console.log(``);
|
|
4514
|
+
let typecheck = null;
|
|
4515
|
+
for (const script of prebuildScripts) {
|
|
4516
|
+
try {
|
|
4517
|
+
await execaCommand(script, {
|
|
4518
|
+
cwd: app.rootDir,
|
|
4519
|
+
stdout: "inherit",
|
|
4520
|
+
stderr: "inherit",
|
|
4521
|
+
env: {
|
|
4522
|
+
FORCE_COLOR: "true"
|
|
4523
|
+
}
|
|
4524
|
+
});
|
|
4525
|
+
} catch (e2) {
|
|
4526
|
+
console.error(script, "failed");
|
|
4527
|
+
process.exitCode = 1;
|
|
4528
|
+
throw e2;
|
|
4529
|
+
}
|
|
4530
|
+
}
|
|
4531
|
+
if (buildTypes) {
|
|
4532
|
+
let copyScript = buildTypes;
|
|
4533
|
+
if (!copyScript.includes("--pretty")) {
|
|
4534
|
+
copyScript += " --pretty";
|
|
4535
|
+
}
|
|
4536
|
+
typecheck = execaCommand(copyScript, {
|
|
4537
|
+
stdout: "inherit",
|
|
4538
|
+
stderr: "inherit",
|
|
4539
|
+
cwd: app.rootDir
|
|
4540
|
+
}).then(() => ({
|
|
4541
|
+
title: "Type checked"
|
|
4542
|
+
})).catch((e2) => {
|
|
4543
|
+
let out = e2.stdout || "";
|
|
4544
|
+
if (out.startsWith("tsc")) {
|
|
4545
|
+
out = out.slice(3);
|
|
4546
|
+
}
|
|
4547
|
+
console.log("\n" + out);
|
|
4548
|
+
process.exitCode = 1;
|
|
4549
|
+
throw new Error(`Type check failed: ${out}`);
|
|
4550
|
+
});
|
|
4551
|
+
}
|
|
4552
|
+
if (buildClientScript) {
|
|
4553
|
+
const script = attachArg(buildClientScript, "mode", mode);
|
|
4554
|
+
await execaCommand(script, {
|
|
4555
|
+
stdout: "inherit",
|
|
4556
|
+
stderr: "inherit",
|
|
4557
|
+
cwd: app.rootDir
|
|
4558
|
+
}).catch((error) => {
|
|
4559
|
+
process.exitCode = 1;
|
|
4560
|
+
throw new Error(`Client build failed: ${error}`);
|
|
4561
|
+
});
|
|
4562
|
+
console.log(``);
|
|
4563
|
+
console.log(`${cyan("\u2713")} Built client modules`);
|
|
4564
|
+
}
|
|
4565
|
+
const step2 = [];
|
|
4566
|
+
if (buildLibScript) {
|
|
4567
|
+
const script = attachArg(buildLibScript, "mode", mode);
|
|
4568
|
+
const libBuild = execaCommand(script, {
|
|
4569
|
+
stdout: "inherit",
|
|
4570
|
+
stderr: "inherit",
|
|
4571
|
+
cwd: app.rootDir,
|
|
4572
|
+
env: {
|
|
4573
|
+
FORCE_COLOR: "true"
|
|
4574
|
+
}
|
|
4575
|
+
}).then((e2) => ({
|
|
4576
|
+
title: "Built library modules",
|
|
4577
|
+
stdout: e2.stdout
|
|
4578
|
+
})).catch((e2) => {
|
|
4579
|
+
console.log(``);
|
|
4580
|
+
if (e2.stderr) {
|
|
4581
|
+
console.log(e2.stderr);
|
|
4582
|
+
} else {
|
|
4583
|
+
console.log(e2.stdout);
|
|
4584
|
+
}
|
|
4585
|
+
console.log(``);
|
|
4586
|
+
process.exitCode = 1;
|
|
4587
|
+
throw e2;
|
|
4588
|
+
});
|
|
4589
|
+
step2.push(libBuild);
|
|
4590
|
+
}
|
|
4591
|
+
if (buildPreviewScript) {
|
|
4592
|
+
const script = attachArg(buildPreviewScript, "mode", mode);
|
|
4593
|
+
const previewBuild = execaCommand(script, {
|
|
4594
|
+
stdout: "inherit",
|
|
4595
|
+
stderr: "inherit",
|
|
4596
|
+
cwd: app.rootDir,
|
|
4597
|
+
env: {
|
|
4598
|
+
FORCE_COLOR: "true"
|
|
4599
|
+
}
|
|
4600
|
+
}).then((e2) => ({
|
|
4601
|
+
title: "Built preview (ssr) modules",
|
|
4602
|
+
stdout: e2.stdout
|
|
4603
|
+
})).catch((e2) => {
|
|
4604
|
+
console.log(``);
|
|
4605
|
+
if (e2.stderr) {
|
|
4606
|
+
console.log(e2.stderr);
|
|
4607
|
+
} else {
|
|
4608
|
+
console.log(e2.stdout);
|
|
4609
|
+
}
|
|
4610
|
+
console.log(``);
|
|
4611
|
+
process.exitCode = 1;
|
|
4612
|
+
throw e2;
|
|
4613
|
+
});
|
|
4614
|
+
step2.push(previewBuild);
|
|
4615
|
+
}
|
|
4616
|
+
if (buildServerScript) {
|
|
4617
|
+
const script = attachArg(buildServerScript, "mode", mode);
|
|
4618
|
+
const serverBuild = execaCommand(script, {
|
|
4619
|
+
stdout: "inherit",
|
|
4620
|
+
stderr: "inherit",
|
|
4621
|
+
cwd: app.rootDir,
|
|
4622
|
+
env: {
|
|
4623
|
+
FORCE_COLOR: "true"
|
|
4624
|
+
}
|
|
4625
|
+
}).then((e2) => ({
|
|
4626
|
+
title: "Built server (ssr) modules",
|
|
4627
|
+
stdout: e2.stdout
|
|
4628
|
+
})).catch((e2) => {
|
|
4629
|
+
console.log(``);
|
|
4630
|
+
if (e2.stderr) {
|
|
4631
|
+
console.log(e2.stderr);
|
|
4632
|
+
} else {
|
|
4633
|
+
console.log(e2.stdout);
|
|
4634
|
+
}
|
|
4635
|
+
console.log(``);
|
|
4636
|
+
process.exitCode = 1;
|
|
4637
|
+
throw e2;
|
|
4638
|
+
});
|
|
4639
|
+
step2.push(serverBuild);
|
|
4640
|
+
}
|
|
4641
|
+
if (buildStaticScript) {
|
|
4642
|
+
const staticBuild = execaCommand(buildStaticScript, {
|
|
4643
|
+
stdout: "inherit",
|
|
4644
|
+
stderr: "inherit",
|
|
4645
|
+
cwd: app.rootDir,
|
|
4646
|
+
env: {
|
|
4647
|
+
FORCE_COLOR: "true"
|
|
4648
|
+
}
|
|
4649
|
+
}).then((e2) => ({
|
|
4650
|
+
title: "Built static (ssg) modules",
|
|
4651
|
+
stdout: e2.stdout
|
|
4652
|
+
})).catch((e2) => {
|
|
4653
|
+
console.log(``);
|
|
4654
|
+
if (e2.stderr) {
|
|
4655
|
+
console.log(e2.stderr);
|
|
4656
|
+
} else {
|
|
4657
|
+
console.log(e2.stdout);
|
|
4658
|
+
}
|
|
4659
|
+
console.log(``);
|
|
4660
|
+
process.exitCode = 1;
|
|
4661
|
+
throw e2;
|
|
4662
|
+
});
|
|
4663
|
+
step2.push(staticBuild);
|
|
4664
|
+
}
|
|
4665
|
+
if (typecheck) {
|
|
4666
|
+
step2.push(typecheck);
|
|
4667
|
+
}
|
|
4668
|
+
if (lint) {
|
|
4669
|
+
const lintBuild = execaCommand(lint, {
|
|
4670
|
+
stdout: "inherit",
|
|
4671
|
+
stderr: "inherit",
|
|
4672
|
+
cwd: app.rootDir,
|
|
4673
|
+
env: {
|
|
4674
|
+
FORCE_COLOR: "true"
|
|
4675
|
+
}
|
|
4676
|
+
}).then(() => ({
|
|
4677
|
+
title: "Lint checked"
|
|
4678
|
+
})).catch((e2) => {
|
|
4679
|
+
console.log(``);
|
|
4680
|
+
console.log(e2.stdout);
|
|
4681
|
+
console.error(e2.stderr);
|
|
4682
|
+
console.log(``);
|
|
4683
|
+
process.exitCode = 1;
|
|
4684
|
+
throw e2;
|
|
4685
|
+
});
|
|
4686
|
+
step2.push(lintBuild);
|
|
4687
|
+
}
|
|
4688
|
+
if (step2.length > 0) {
|
|
4689
|
+
await Promise.all(step2).then((steps) => {
|
|
4690
|
+
steps.forEach((step) => {
|
|
4691
|
+
if (step.stdout) {
|
|
4692
|
+
console.log("");
|
|
4693
|
+
console.log(step.stdout);
|
|
4694
|
+
}
|
|
4695
|
+
console.log(`${cyan("\u2713")} ${step.title}`);
|
|
4696
|
+
});
|
|
4697
|
+
if (!isPreviewBuild && !buildServerScript && !buildStaticScript && !isLibraryBuild) {
|
|
4698
|
+
const pmRun = pmRunCmd();
|
|
4699
|
+
console.log(``);
|
|
4700
|
+
console.log(`${bgMagenta(" Missing an integration ")}`);
|
|
4701
|
+
console.log(``);
|
|
4702
|
+
console.log(`${magenta("\u30FB")} Use ${magenta(pmRun + " qwik add")} to add an integration`);
|
|
4703
|
+
console.log(`${magenta("\u30FB")} Use ${magenta(pmRun + " preview")} to preview the build`);
|
|
4704
|
+
}
|
|
4705
|
+
if (isPreviewBuild && buildStaticScript && runSsgScript) {
|
|
4706
|
+
return execaCommand(buildStaticScript, {
|
|
4707
|
+
stdout: "inherit",
|
|
4708
|
+
stderr: "inherit",
|
|
4709
|
+
cwd: app.rootDir,
|
|
4710
|
+
env: {
|
|
4711
|
+
FORCE_COLOR: "true"
|
|
4712
|
+
}
|
|
4713
|
+
}).catch((e2) => {
|
|
4714
|
+
console.log(``);
|
|
4715
|
+
if (e2.stderr) {
|
|
4716
|
+
console.log(e2.stderr);
|
|
4717
|
+
} else {
|
|
4718
|
+
console.log(e2.stdout);
|
|
4719
|
+
}
|
|
4720
|
+
console.log(``);
|
|
4721
|
+
process.exitCode = 1;
|
|
4722
|
+
});
|
|
4723
|
+
}
|
|
4724
|
+
}).catch((error) => console.log(red(error)));
|
|
4725
|
+
}
|
|
4726
|
+
for (const script of postbuildScripts) {
|
|
4727
|
+
try {
|
|
4728
|
+
await execaCommand(script, {
|
|
4729
|
+
stdout: "inherit",
|
|
4730
|
+
stderr: "inherit",
|
|
4731
|
+
cwd: app.rootDir,
|
|
4732
|
+
env: {
|
|
4733
|
+
FORCE_COLOR: "true"
|
|
4734
|
+
}
|
|
4735
|
+
});
|
|
4736
|
+
} catch (e2) {
|
|
4737
|
+
console.error(script, "failed");
|
|
4738
|
+
process.exitCode = 1;
|
|
4739
|
+
throw e2;
|
|
4740
|
+
}
|
|
4741
|
+
}
|
|
4742
|
+
console.log(``);
|
|
4743
|
+
}
|
|
4744
|
+
function attachArg(command, key, value) {
|
|
4745
|
+
if (value !== void 0) {
|
|
4746
|
+
return `${command} --${key} ${value}`;
|
|
4747
|
+
}
|
|
4748
|
+
return command;
|
|
4749
|
+
}
|
|
4750
|
+
function isString(s2) {
|
|
4751
|
+
return typeof s2 === "string" && s2.trim().length > 0;
|
|
4752
|
+
}
|
|
4753
|
+
|
|
4754
|
+
// packages/qwik/src/cli/run.ts
|
|
4755
|
+
var SPACE_TO_HINT2 = 18;
|
|
4756
|
+
var COMMANDS = [
|
|
4757
|
+
{
|
|
4758
|
+
value: "add",
|
|
4759
|
+
label: "add",
|
|
4760
|
+
hint: "Add an integration to this app",
|
|
4761
|
+
run: (app) => runAddCommand(app),
|
|
4762
|
+
showInHelp: true
|
|
4763
|
+
},
|
|
4764
|
+
{
|
|
4765
|
+
value: "build",
|
|
4766
|
+
label: "build",
|
|
4767
|
+
hint: "Parallelize builds and type checking",
|
|
4768
|
+
run: (app) => runBuildCommand(app),
|
|
4769
|
+
showInHelp: true
|
|
4770
|
+
},
|
|
4771
|
+
{
|
|
4772
|
+
value: "build preview",
|
|
4773
|
+
label: "build preview",
|
|
4774
|
+
hint: 'Same as "build", but for preview server',
|
|
4775
|
+
run: (app) => runBuildCommand(app),
|
|
4776
|
+
showInHelp: true
|
|
4777
|
+
},
|
|
4778
|
+
{
|
|
4779
|
+
value: "new",
|
|
4780
|
+
label: "new",
|
|
4781
|
+
hint: "Create a new component or route",
|
|
4782
|
+
run: (app) => runNewCommand(app),
|
|
4783
|
+
showInHelp: true
|
|
4784
|
+
},
|
|
4785
|
+
{
|
|
4786
|
+
value: "joke",
|
|
4787
|
+
label: "joke",
|
|
4788
|
+
hint: "Tell a random dad joke",
|
|
4789
|
+
run: () => runJokeCommand(),
|
|
4790
|
+
showInHelp: true
|
|
4791
|
+
},
|
|
4792
|
+
{
|
|
4793
|
+
value: "help",
|
|
4794
|
+
label: "help",
|
|
4795
|
+
hint: "Show this help",
|
|
4796
|
+
run: (app) => printHelp(app),
|
|
4797
|
+
showInHelp: false
|
|
4798
|
+
},
|
|
4799
|
+
{
|
|
4800
|
+
value: "version",
|
|
4801
|
+
label: "version",
|
|
4802
|
+
hint: "Show the version",
|
|
4803
|
+
run: () => printVersion(),
|
|
4804
|
+
showInHelp: false
|
|
4805
|
+
}
|
|
4806
|
+
];
|
|
4807
|
+
async function runCli() {
|
|
4808
|
+
printHeader();
|
|
4809
|
+
try {
|
|
4810
|
+
const app = new AppCommand({
|
|
4811
|
+
rootDir: "",
|
|
4812
|
+
cwd: process.cwd(),
|
|
4813
|
+
args: process.argv.slice(2)
|
|
4814
|
+
});
|
|
4815
|
+
await runCommand2(app);
|
|
4816
|
+
} catch (e2) {
|
|
4817
|
+
panic(String(e2));
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
async function runCommand2(app) {
|
|
4821
|
+
switch (app.task) {
|
|
4822
|
+
case "add": {
|
|
4823
|
+
await runAddCommand(app);
|
|
4824
|
+
return;
|
|
4825
|
+
}
|
|
4826
|
+
case "build": {
|
|
4827
|
+
await runBuildCommand(app);
|
|
4828
|
+
return;
|
|
4829
|
+
}
|
|
4830
|
+
case "help": {
|
|
4831
|
+
printHelp(app);
|
|
4832
|
+
return;
|
|
4833
|
+
}
|
|
4834
|
+
case "new": {
|
|
4835
|
+
await runNewCommand(app);
|
|
4836
|
+
return;
|
|
4837
|
+
}
|
|
4838
|
+
case "joke": {
|
|
4839
|
+
await runJokeCommand();
|
|
4840
|
+
return;
|
|
4841
|
+
}
|
|
4842
|
+
case "version": {
|
|
4843
|
+
printVersion();
|
|
4844
|
+
return;
|
|
4845
|
+
}
|
|
4846
|
+
}
|
|
4847
|
+
if (typeof app.task === "string") {
|
|
4848
|
+
console.log(red(`Unrecognized qwik command: ${app.task}`) + "\n");
|
|
4849
|
+
}
|
|
4850
|
+
await printHelp(app);
|
|
4851
|
+
process.exit(1);
|
|
4852
|
+
}
|
|
4853
|
+
async function printHelp(app) {
|
|
4854
|
+
const pmRun = pmRunCmd();
|
|
4855
|
+
oe(`\u{1F52D} ${bgMagenta(" Qwik Help ")}`);
|
|
4856
|
+
note(
|
|
4857
|
+
COMMANDS.filter((cmd) => cmd.showInHelp).map(
|
|
4858
|
+
(cmd) => `${pmRun} qwik ${cyan(cmd.label)}` + " ".repeat(Math.max(SPACE_TO_HINT2 - cmd.label.length, 2)) + dim(cmd.hint)
|
|
4859
|
+
).join("\n"),
|
|
4860
|
+
"Available commands"
|
|
4861
|
+
);
|
|
4862
|
+
const proceed = await se({
|
|
4863
|
+
message: "Do you want to run a command?",
|
|
4864
|
+
initialValue: true
|
|
4865
|
+
});
|
|
4866
|
+
if (hD(proceed) || !proceed) {
|
|
4867
|
+
bye();
|
|
4868
|
+
}
|
|
4869
|
+
const command = await ie({
|
|
4870
|
+
message: "Select a command",
|
|
4871
|
+
options: COMMANDS.filter((cmd) => cmd.showInHelp).map((cmd) => ({
|
|
4872
|
+
value: cmd.value,
|
|
4873
|
+
label: `${pmRun} qwik ${cyan(cmd.label)}`,
|
|
4874
|
+
hint: cmd.hint
|
|
4875
|
+
}))
|
|
4876
|
+
});
|
|
4877
|
+
if (hD(command)) {
|
|
4878
|
+
bye();
|
|
4879
|
+
}
|
|
4880
|
+
const args = command.split(" ");
|
|
4881
|
+
await runCommand2(Object.assign(app, { task: args[0], args }));
|
|
4882
|
+
}
|
|
4883
|
+
function printVersion() {
|
|
4884
|
+
console.log("2.0.0-alpha.0-dev+dd93926");
|
|
4885
|
+
}
|
|
4886
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4887
|
+
0 && (module.exports = {
|
|
4888
|
+
runCli,
|
|
4889
|
+
updateApp
|
|
4890
|
+
});
|